@sudocode-ai/local-server 0.1.7 → 0.1.9

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 (282) hide show
  1. package/README.md +6 -0
  2. package/dist/errors/agent-errors.d.ts +43 -0
  3. package/dist/errors/agent-errors.d.ts.map +1 -0
  4. package/dist/errors/agent-errors.js +69 -0
  5. package/dist/errors/agent-errors.js.map +1 -0
  6. package/dist/execution/adapters/claude-adapter.d.ts +63 -0
  7. package/dist/execution/adapters/claude-adapter.d.ts.map +1 -0
  8. package/dist/execution/adapters/claude-adapter.js +82 -0
  9. package/dist/execution/adapters/claude-adapter.js.map +1 -0
  10. package/dist/execution/adapters/codex-adapter.d.ts +67 -0
  11. package/dist/execution/adapters/codex-adapter.d.ts.map +1 -0
  12. package/dist/execution/adapters/codex-adapter.js +183 -0
  13. package/dist/execution/adapters/codex-adapter.js.map +1 -0
  14. package/dist/execution/adapters/codex-config-builder.d.ts +30 -0
  15. package/dist/execution/adapters/codex-config-builder.d.ts.map +1 -0
  16. package/dist/execution/adapters/codex-config-builder.js +110 -0
  17. package/dist/execution/adapters/codex-config-builder.js.map +1 -0
  18. package/dist/execution/adapters/copilot-adapter.d.ts +94 -0
  19. package/dist/execution/adapters/copilot-adapter.d.ts.map +1 -0
  20. package/dist/execution/adapters/copilot-adapter.js +163 -0
  21. package/dist/execution/adapters/copilot-adapter.js.map +1 -0
  22. package/dist/execution/adapters/copilot-config-builder.d.ts +48 -0
  23. package/dist/execution/adapters/copilot-config-builder.d.ts.map +1 -0
  24. package/dist/execution/adapters/copilot-config-builder.js +125 -0
  25. package/dist/execution/adapters/copilot-config-builder.js.map +1 -0
  26. package/dist/execution/adapters/cursor-adapter.d.ts +66 -0
  27. package/dist/execution/adapters/cursor-adapter.d.ts.map +1 -0
  28. package/dist/execution/adapters/cursor-adapter.js +121 -0
  29. package/dist/execution/adapters/cursor-adapter.js.map +1 -0
  30. package/dist/execution/adapters/cursor-config-builder.d.ts +29 -0
  31. package/dist/execution/adapters/cursor-config-builder.d.ts.map +1 -0
  32. package/dist/execution/adapters/cursor-config-builder.js +49 -0
  33. package/dist/execution/adapters/cursor-config-builder.js.map +1 -0
  34. package/dist/execution/adapters/shared/config-presets.d.ts +102 -0
  35. package/dist/execution/adapters/shared/config-presets.d.ts.map +1 -0
  36. package/dist/execution/adapters/shared/config-presets.js +205 -0
  37. package/dist/execution/adapters/shared/config-presets.js.map +1 -0
  38. package/dist/execution/adapters/shared/config-utils.d.ts +95 -0
  39. package/dist/execution/adapters/shared/config-utils.d.ts.map +1 -0
  40. package/dist/execution/adapters/shared/config-utils.js +163 -0
  41. package/dist/execution/adapters/shared/config-utils.js.map +1 -0
  42. package/dist/execution/adapters/shared/index.d.ts +8 -0
  43. package/dist/execution/adapters/shared/index.d.ts.map +1 -0
  44. package/dist/execution/adapters/shared/index.js +8 -0
  45. package/dist/execution/adapters/shared/index.js.map +1 -0
  46. package/dist/execution/executors/agent-executor-wrapper.d.ts +153 -0
  47. package/dist/execution/executors/agent-executor-wrapper.d.ts.map +1 -0
  48. package/dist/execution/executors/agent-executor-wrapper.js +652 -0
  49. package/dist/execution/executors/agent-executor-wrapper.js.map +1 -0
  50. package/dist/execution/executors/executor-factory.d.ts +95 -0
  51. package/dist/execution/executors/executor-factory.d.ts.map +1 -0
  52. package/dist/execution/executors/executor-factory.js +120 -0
  53. package/dist/execution/executors/executor-factory.js.map +1 -0
  54. package/dist/execution/output/ag-ui-adapter.d.ts +0 -2
  55. package/dist/execution/output/ag-ui-adapter.d.ts.map +1 -1
  56. package/dist/execution/output/ag-ui-adapter.js +0 -2
  57. package/dist/execution/output/ag-ui-adapter.js.map +1 -1
  58. package/dist/execution/output/index.d.ts +0 -3
  59. package/dist/execution/output/index.d.ts.map +1 -1
  60. package/dist/execution/output/index.js +0 -2
  61. package/dist/execution/output/index.js.map +1 -1
  62. package/dist/execution/output/normalized-to-ag-ui-adapter.d.ts +108 -0
  63. package/dist/execution/output/normalized-to-ag-ui-adapter.d.ts.map +1 -0
  64. package/dist/execution/output/normalized-to-ag-ui-adapter.js +321 -0
  65. package/dist/execution/output/normalized-to-ag-ui-adapter.js.map +1 -0
  66. package/dist/execution/process/builders/claude.d.ts +24 -57
  67. package/dist/execution/process/builders/claude.d.ts.map +1 -1
  68. package/dist/execution/process/builders/claude.js +153 -19
  69. package/dist/execution/process/builders/claude.js.map +1 -1
  70. package/dist/execution/transport/ipc-transport-manager.d.ts +74 -0
  71. package/dist/execution/transport/ipc-transport-manager.d.ts.map +1 -0
  72. package/dist/execution/transport/ipc-transport-manager.js +104 -0
  73. package/dist/execution/transport/ipc-transport-manager.js.map +1 -0
  74. package/dist/execution/transport/transport-manager.d.ts.map +1 -1
  75. package/dist/execution/transport/transport-manager.js +3 -0
  76. package/dist/execution/transport/transport-manager.js.map +1 -1
  77. package/dist/execution/worktree/conflict-detector.d.ts +85 -0
  78. package/dist/execution/worktree/conflict-detector.d.ts.map +1 -0
  79. package/dist/execution/worktree/conflict-detector.js +129 -0
  80. package/dist/execution/worktree/conflict-detector.js.map +1 -0
  81. package/dist/execution/worktree/git-cli.d.ts +9 -0
  82. package/dist/execution/worktree/git-cli.d.ts.map +1 -1
  83. package/dist/execution/worktree/git-cli.js +10 -0
  84. package/dist/execution/worktree/git-cli.js.map +1 -1
  85. package/dist/execution/worktree/git-sync-cli.d.ts +198 -0
  86. package/dist/execution/worktree/git-sync-cli.d.ts.map +1 -0
  87. package/dist/execution/worktree/git-sync-cli.js +401 -0
  88. package/dist/execution/worktree/git-sync-cli.js.map +1 -0
  89. package/dist/execution/worktree/manager.d.ts +18 -0
  90. package/dist/execution/worktree/manager.d.ts.map +1 -1
  91. package/dist/execution/worktree/manager.js +9 -3
  92. package/dist/execution/worktree/manager.js.map +1 -1
  93. package/dist/index.d.ts +1 -3
  94. package/dist/index.d.ts.map +1 -1
  95. package/dist/index.js +124 -229
  96. package/dist/index.js.map +1 -1
  97. package/dist/middleware/project-context.d.ts +37 -0
  98. package/dist/middleware/project-context.d.ts.map +1 -0
  99. package/dist/middleware/project-context.js +91 -0
  100. package/dist/middleware/project-context.js.map +1 -0
  101. package/dist/public/assets/index-DV9Tbujb.css +1 -0
  102. package/dist/public/assets/index-DcDX9-Ad.js +740 -0
  103. package/dist/public/assets/index-DcDX9-Ad.js.map +1 -0
  104. package/dist/public/assets/{react-vendor-ByUx1V_q.js → react-vendor-DiL5hC7l.js} +2 -2
  105. package/dist/public/assets/{react-vendor-ByUx1V_q.js.map → react-vendor-DiL5hC7l.js.map} +1 -1
  106. package/dist/public/assets/ui-vendor-B4WMPEfa.js +54 -0
  107. package/dist/public/assets/ui-vendor-B4WMPEfa.js.map +1 -0
  108. package/dist/public/index.html +4 -4
  109. package/dist/routes/agents.d.ts +3 -0
  110. package/dist/routes/agents.d.ts.map +1 -0
  111. package/dist/routes/agents.js +62 -0
  112. package/dist/routes/agents.js.map +1 -0
  113. package/dist/routes/config.d.ts +3 -0
  114. package/dist/routes/config.d.ts.map +1 -0
  115. package/dist/routes/config.js +25 -0
  116. package/dist/routes/config.js.map +1 -0
  117. package/dist/routes/editors.d.ts +15 -0
  118. package/dist/routes/editors.d.ts.map +1 -0
  119. package/dist/routes/editors.js +98 -0
  120. package/dist/routes/editors.js.map +1 -0
  121. package/dist/routes/executions-stream.d.ts +8 -5
  122. package/dist/routes/executions-stream.d.ts.map +1 -1
  123. package/dist/routes/executions-stream.js +10 -6
  124. package/dist/routes/executions-stream.js.map +1 -1
  125. package/dist/routes/executions.d.ts +6 -10
  126. package/dist/routes/executions.d.ts.map +1 -1
  127. package/dist/routes/executions.js +792 -37
  128. package/dist/routes/executions.js.map +1 -1
  129. package/dist/routes/feedback.d.ts +3 -2
  130. package/dist/routes/feedback.d.ts.map +1 -1
  131. package/dist/routes/feedback.js +12 -10
  132. package/dist/routes/feedback.js.map +1 -1
  133. package/dist/routes/files.d.ts +18 -0
  134. package/dist/routes/files.d.ts.map +1 -0
  135. package/dist/routes/files.js +89 -0
  136. package/dist/routes/files.js.map +1 -0
  137. package/dist/routes/issues.d.ts +3 -2
  138. package/dist/routes/issues.d.ts.map +1 -1
  139. package/dist/routes/issues.js +19 -18
  140. package/dist/routes/issues.js.map +1 -1
  141. package/dist/routes/projects.d.ts +11 -0
  142. package/dist/routes/projects.d.ts.map +1 -0
  143. package/dist/routes/projects.js +447 -0
  144. package/dist/routes/projects.js.map +1 -0
  145. package/dist/routes/relationships.d.ts +3 -2
  146. package/dist/routes/relationships.d.ts.map +1 -1
  147. package/dist/routes/relationships.js +12 -10
  148. package/dist/routes/relationships.js.map +1 -1
  149. package/dist/routes/repo-info.d.ts +3 -0
  150. package/dist/routes/repo-info.d.ts.map +1 -0
  151. package/dist/routes/repo-info.js +203 -0
  152. package/dist/routes/repo-info.js.map +1 -0
  153. package/dist/routes/specs.d.ts +3 -2
  154. package/dist/routes/specs.d.ts.map +1 -1
  155. package/dist/routes/specs.js +19 -18
  156. package/dist/routes/specs.js.map +1 -1
  157. package/dist/routes/version.d.ts +3 -0
  158. package/dist/routes/version.d.ts.map +1 -0
  159. package/dist/routes/version.js +25 -0
  160. package/dist/routes/version.js.map +1 -0
  161. package/dist/services/agent-registry.d.ts +140 -0
  162. package/dist/services/agent-registry.d.ts.map +1 -0
  163. package/dist/services/agent-registry.js +272 -0
  164. package/dist/services/agent-registry.js.map +1 -0
  165. package/dist/services/editor-service.d.ts +57 -0
  166. package/dist/services/editor-service.d.ts.map +1 -0
  167. package/dist/services/editor-service.js +204 -0
  168. package/dist/services/editor-service.js.map +1 -0
  169. package/dist/services/execution-changes-service.d.ts +110 -0
  170. package/dist/services/execution-changes-service.d.ts.map +1 -0
  171. package/dist/services/execution-changes-service.js +700 -0
  172. package/dist/services/execution-changes-service.js.map +1 -0
  173. package/dist/services/execution-lifecycle.d.ts +1 -0
  174. package/dist/services/execution-lifecycle.d.ts.map +1 -1
  175. package/dist/services/execution-lifecycle.js +37 -7
  176. package/dist/services/execution-lifecycle.js.map +1 -1
  177. package/dist/services/execution-logs-store.d.ts +75 -0
  178. package/dist/services/execution-logs-store.d.ts.map +1 -1
  179. package/dist/services/execution-logs-store.js +142 -2
  180. package/dist/services/execution-logs-store.js.map +1 -1
  181. package/dist/services/execution-service.d.ts +82 -59
  182. package/dist/services/execution-service.d.ts.map +1 -1
  183. package/dist/services/execution-service.js +514 -469
  184. package/dist/services/execution-service.js.map +1 -1
  185. package/dist/services/execution-worker-pool.d.ts +116 -0
  186. package/dist/services/execution-worker-pool.d.ts.map +1 -0
  187. package/dist/services/execution-worker-pool.js +326 -0
  188. package/dist/services/execution-worker-pool.js.map +1 -0
  189. package/dist/services/executions.d.ts +3 -0
  190. package/dist/services/executions.d.ts.map +1 -1
  191. package/dist/services/executions.js +11 -17
  192. package/dist/services/executions.js.map +1 -1
  193. package/dist/services/export.d.ts +8 -2
  194. package/dist/services/export.d.ts.map +1 -1
  195. package/dist/services/export.js +29 -23
  196. package/dist/services/export.js.map +1 -1
  197. package/dist/services/file-search/git-ls-files-strategy.d.ts +72 -0
  198. package/dist/services/file-search/git-ls-files-strategy.d.ts.map +1 -0
  199. package/dist/services/file-search/git-ls-files-strategy.js +176 -0
  200. package/dist/services/file-search/git-ls-files-strategy.js.map +1 -0
  201. package/dist/services/file-search/index.d.ts +9 -0
  202. package/dist/services/file-search/index.d.ts.map +1 -0
  203. package/dist/services/file-search/index.js +10 -0
  204. package/dist/services/file-search/index.js.map +1 -0
  205. package/dist/services/file-search/registry.d.ts +97 -0
  206. package/dist/services/file-search/registry.d.ts.map +1 -0
  207. package/dist/services/file-search/registry.js +140 -0
  208. package/dist/services/file-search/registry.js.map +1 -0
  209. package/dist/services/file-search/strategy.d.ts +58 -0
  210. package/dist/services/file-search/strategy.d.ts.map +1 -0
  211. package/dist/services/file-search/strategy.js +8 -0
  212. package/dist/services/file-search/strategy.js.map +1 -0
  213. package/dist/services/project-context.d.ts +69 -0
  214. package/dist/services/project-context.d.ts.map +1 -0
  215. package/dist/services/project-context.js +113 -0
  216. package/dist/services/project-context.js.map +1 -0
  217. package/dist/services/project-manager.d.ts +95 -0
  218. package/dist/services/project-manager.d.ts.map +1 -0
  219. package/dist/services/project-manager.js +388 -0
  220. package/dist/services/project-manager.js.map +1 -0
  221. package/dist/services/project-registry.d.ts +98 -0
  222. package/dist/services/project-registry.d.ts.map +1 -0
  223. package/dist/services/project-registry.js +289 -0
  224. package/dist/services/project-registry.js.map +1 -0
  225. package/dist/services/prompt-resolver.d.ts +97 -0
  226. package/dist/services/prompt-resolver.d.ts.map +1 -0
  227. package/dist/services/prompt-resolver.js +377 -0
  228. package/dist/services/prompt-resolver.js.map +1 -0
  229. package/dist/services/repo-info.d.ts +12 -0
  230. package/dist/services/repo-info.d.ts.map +1 -1
  231. package/dist/services/repo-info.js +46 -0
  232. package/dist/services/repo-info.js.map +1 -1
  233. package/dist/services/version-service.d.ts +14 -0
  234. package/dist/services/version-service.d.ts.map +1 -0
  235. package/dist/services/version-service.js +57 -0
  236. package/dist/services/version-service.js.map +1 -0
  237. package/dist/services/watcher.d.ts +3 -4
  238. package/dist/services/watcher.d.ts.map +1 -1
  239. package/dist/services/watcher.js +18 -35
  240. package/dist/services/watcher.js.map +1 -1
  241. package/dist/services/websocket.d.ts +30 -16
  242. package/dist/services/websocket.d.ts.map +1 -1
  243. package/dist/services/websocket.js +102 -37
  244. package/dist/services/websocket.js.map +1 -1
  245. package/dist/services/worktree-sync-service.d.ts +326 -0
  246. package/dist/services/worktree-sync-service.d.ts.map +1 -0
  247. package/dist/services/worktree-sync-service.js +1091 -0
  248. package/dist/services/worktree-sync-service.js.map +1 -0
  249. package/dist/types/editor.d.ts +49 -0
  250. package/dist/types/editor.d.ts.map +1 -0
  251. package/dist/types/editor.js +50 -0
  252. package/dist/types/editor.js.map +1 -0
  253. package/dist/types/project.d.ts +58 -0
  254. package/dist/types/project.d.ts.map +1 -0
  255. package/dist/types/project.js +10 -0
  256. package/dist/types/project.js.map +1 -0
  257. package/dist/utils/executable-check.d.ts +36 -0
  258. package/dist/utils/executable-check.d.ts.map +1 -0
  259. package/dist/utils/executable-check.js +79 -0
  260. package/dist/utils/executable-check.js.map +1 -0
  261. package/dist/workers/execution-worker.d.ts +18 -0
  262. package/dist/workers/execution-worker.d.ts.map +1 -0
  263. package/dist/workers/execution-worker.js +340 -0
  264. package/dist/workers/execution-worker.js.map +1 -0
  265. package/dist/workers/worker-ipc.d.ts +84 -0
  266. package/dist/workers/worker-ipc.d.ts.map +1 -0
  267. package/dist/workers/worker-ipc.js +29 -0
  268. package/dist/workers/worker-ipc.js.map +1 -0
  269. package/package.json +6 -5
  270. package/dist/execution/output/ag-ui-integration.d.ts +0 -96
  271. package/dist/execution/output/ag-ui-integration.d.ts.map +0 -1
  272. package/dist/execution/output/ag-ui-integration.js +0 -96
  273. package/dist/execution/output/ag-ui-integration.js.map +0 -1
  274. package/dist/execution/output/claude-code-output-processor.d.ts +0 -321
  275. package/dist/execution/output/claude-code-output-processor.d.ts.map +0 -1
  276. package/dist/execution/output/claude-code-output-processor.js +0 -769
  277. package/dist/execution/output/claude-code-output-processor.js.map +0 -1
  278. package/dist/public/assets/index-B3SEMufD.js +0 -580
  279. package/dist/public/assets/index-B3SEMufD.js.map +0 -1
  280. package/dist/public/assets/index-D2YGL3gX.css +0 -1
  281. package/dist/public/assets/ui-vendor-CotR6bx9.js +0 -54
  282. package/dist/public/assets/ui-vendor-CotR6bx9.js.map +0 -1
@@ -1,580 +0,0 @@
1
- var $y=t=>{throw TypeError(t)};var wh=(t,e,n)=>e.has(t)||$y("Cannot "+n);var O=(t,e,n)=>(wh(t,e,"read from private field"),n?n.call(t):e.get(t)),Ce=(t,e,n)=>e.has(t)?$y("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),he=(t,e,n,r)=>(wh(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),We=(t,e,n)=>(wh(t,e,"access private method"),n);var tu=(t,e,n,r)=>({set _(s){he(t,e,s,n)},get _(){return O(t,e,r)}});import{j as f,P as yn,c as gf,a as bf,b as Eg,d as Fa,D as Cg,C as Ng,u as Tn,e as yc,f as Gu,R as _g,A as yf,g as dt,h as Tg,O as Ag,i as bk,k as Mg,T as Rg,l as Og,m as yk,n as xk,o as Ig,p as sM,q as wi,r as iM,s as vk,t as wk,v as kk,F as Sk,w as oM,x as Ek,W as aM,y as Ck}from"./ui-vendor-CotR6bx9.js";import{e as lM,g as xc,a as y,u as cM,L as Dg,O as uM,d as ft,b as ci,R as Nk,f as _r,r as _k,c as dM,h as Lg,B as fM,i as hM,j as ls,N as pM}from"./react-vendor-ByUx1V_q.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var nu={},Hy;function mM(){if(Hy)return nu;Hy=1;var t=lM();return nu.createRoot=t.createRoot,nu.hydrateRoot=t.hydrateRoot,nu}var gM=mM();const bM=xc(gM);var Ba=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},yM={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},ei,Sg,ok,xM=(ok=class{constructor(){Ce(this,ei,yM);Ce(this,Sg,!1)}setTimeoutProvider(t){he(this,ei,t)}setTimeout(t,e){return O(this,ei).setTimeout(t,e)}clearTimeout(t){O(this,ei).clearTimeout(t)}setInterval(t,e){return O(this,ei).setInterval(t,e)}clearInterval(t){O(this,ei).clearInterval(t)}},ei=new WeakMap,Sg=new WeakMap,ok),Hi=new xM;function vM(t){setTimeout(t,0)}var po=typeof window>"u"||"Deno"in globalThis;function Pn(){}function wM(t,e){return typeof t=="function"?t(e):t}function Up(t){return typeof t=="number"&&t>=0&&t!==1/0}function Tk(t,e){return Math.max(t+(e||0)-Date.now(),0)}function pi(t,e){return typeof t=="function"?t(e):t}function yr(t,e){return typeof t=="function"?t(e):t}function Uy(t,e){const{type:n="all",exact:r,fetchStatus:s,predicate:i,queryKey:o,stale:a}=t;if(o){if(r){if(e.queryHash!==Pg(o,e.options))return!1}else if(!Bl(e.queryKey,o))return!1}if(n!=="all"){const l=e.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&e.isStale()!==a||s&&s!==e.state.fetchStatus||i&&!i(e))}function Vy(t,e){const{exact:n,status:r,predicate:s,mutationKey:i}=t;if(i){if(!e.options.mutationKey)return!1;if(n){if(mo(e.options.mutationKey)!==mo(i))return!1}else if(!Bl(e.options.mutationKey,i))return!1}return!(r&&e.state.status!==r||s&&!s(e))}function Pg(t,e){return((e==null?void 0:e.queryKeyHashFn)||mo)(t)}function mo(t){return JSON.stringify(t,(e,n)=>Vp(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function Bl(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>Bl(t[n],e[n])):!1}var kM=Object.prototype.hasOwnProperty;function Ak(t,e){if(t===e)return t;const n=Wy(t)&&Wy(e);if(!n&&!(Vp(t)&&Vp(e)))return e;const s=(n?t:Object.keys(t)).length,i=n?e:Object.keys(e),o=i.length,a=n?new Array(o):{};let l=0;for(let c=0;c<o;c++){const u=n?c:i[c],d=t[u],h=e[u];if(d===h){a[u]=d,(n?c<s:kM.call(t,u))&&l++;continue}if(d===null||h===null||typeof d!="object"||typeof h!="object"){a[u]=h;continue}const p=Ak(d,h);a[u]=p,p===d&&l++}return s===o&&l===s?t:a}function Ju(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(t[n]!==e[n])return!1;return!0}function Wy(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function Vp(t){if(!qy(t))return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(!qy(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function qy(t){return Object.prototype.toString.call(t)==="[object Object]"}function SM(t){return new Promise(e=>{Hi.setTimeout(e,t)})}function Wp(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?Ak(t,e):e}function EM(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function CM(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var jg=Symbol();function Mk(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===jg?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function Rk(t,e){return typeof t=="function"?t(...e):!!t}var Ji,ti,pa,ak,NM=(ak=class extends Ba{constructor(){super();Ce(this,Ji);Ce(this,ti);Ce(this,pa);he(this,pa,e=>{if(!po&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){O(this,ti)||this.setEventListener(O(this,pa))}onUnsubscribe(){var e;this.hasListeners()||((e=O(this,ti))==null||e.call(this),he(this,ti,void 0))}setEventListener(e){var n;he(this,pa,e),(n=O(this,ti))==null||n.call(this),he(this,ti,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){O(this,Ji)!==e&&(he(this,Ji,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof O(this,Ji)=="boolean"?O(this,Ji):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Ji=new WeakMap,ti=new WeakMap,pa=new WeakMap,ak),zg=new NM;function qp(){let t,e;const n=new Promise((s,i)=>{t=s,e=i});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),t(s)},n.reject=s=>{r({status:"rejected",reason:s}),e(s)},n}var _M=vM;function TM(){let t=[],e=0,n=a=>{a()},r=a=>{a()},s=_M;const i=a=>{e?t.push(a):s(()=>{n(a)})},o=()=>{const a=t;t=[],a.length&&s(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;e++;try{l=a()}finally{e--,e||o()}return l},batchCalls:a=>(...l)=>{i(()=>{a(...l)})},schedule:i,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{s=a}}}var en=TM(),ma,ni,ga,lk,AM=(lk=class extends Ba{constructor(){super();Ce(this,ma,!0);Ce(this,ni);Ce(this,ga);he(this,ga,e=>{if(!po&&window.addEventListener){const n=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){O(this,ni)||this.setEventListener(O(this,ga))}onUnsubscribe(){var e;this.hasListeners()||((e=O(this,ni))==null||e.call(this),he(this,ni,void 0))}setEventListener(e){var n;he(this,ga,e),(n=O(this,ni))==null||n.call(this),he(this,ni,e(this.setOnline.bind(this)))}setOnline(e){O(this,ma)!==e&&(he(this,ma,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return O(this,ma)}},ma=new WeakMap,ni=new WeakMap,ga=new WeakMap,lk),Yu=new AM;function MM(t){return Math.min(1e3*2**t,3e4)}function Ok(t){return(t??"online")==="online"?Yu.isOnline():!0}var Kp=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function Ik(t){let e=!1,n=0,r;const s=qp(),i=()=>s.status!=="pending",o=g=>{var b;if(!i()){const x=new Kp(g);h(x),(b=t.onCancel)==null||b.call(t,x)}},a=()=>{e=!0},l=()=>{e=!1},c=()=>zg.isFocused()&&(t.networkMode==="always"||Yu.isOnline())&&t.canRun(),u=()=>Ok(t.networkMode)&&t.canRun(),d=g=>{i()||(r==null||r(),s.resolve(g))},h=g=>{i()||(r==null||r(),s.reject(g))},p=()=>new Promise(g=>{var b;r=x=>{(i()||c())&&g(x)},(b=t.onPause)==null||b.call(t)}).then(()=>{var g;r=void 0,i()||(g=t.onContinue)==null||g.call(t)}),m=()=>{if(i())return;let g;const b=n===0?t.initialPromise:void 0;try{g=b??t.fn()}catch(x){g=Promise.reject(x)}Promise.resolve(g).then(d).catch(x=>{var S;if(i())return;const w=t.retry??(po?0:3),v=t.retryDelay??MM,k=typeof v=="function"?v(n,x):v,N=w===!0||typeof w=="number"&&n<w||typeof w=="function"&&w(n,x);if(e||!N){h(x);return}n++,(S=t.onFail)==null||S.call(t,n,x),SM(k).then(()=>c()?void 0:p()).then(()=>{e?h(x):m()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(r==null||r(),s),cancelRetry:a,continueRetry:l,canStart:u,start:()=>(u()?m():p().then(m),s)}}var Yi,ck,Dk=(ck=class{constructor(){Ce(this,Yi)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Up(this.gcTime)&&he(this,Yi,Hi.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(po?1/0:300*1e3))}clearGcTimeout(){O(this,Yi)&&(Hi.clearTimeout(O(this,Yi)),he(this,Yi,void 0))}},Yi=new WeakMap,ck),Zi,ba,br,Xi,on,hc,Qi,Or,hs,uk,RM=(uk=class extends Dk{constructor(e){super();Ce(this,Or);Ce(this,Zi);Ce(this,ba);Ce(this,br);Ce(this,Xi);Ce(this,on);Ce(this,hc);Ce(this,Qi);he(this,Qi,!1),he(this,hc,e.defaultOptions),this.setOptions(e.options),this.observers=[],he(this,Xi,e.client),he(this,br,O(this,Xi).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,he(this,Zi,Gy(this.options)),this.state=e.state??O(this,Zi),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=O(this,on))==null?void 0:e.promise}setOptions(e){if(this.options={...O(this,hc),...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=Gy(this.options);n.data!==void 0&&(this.setState(Ky(n.data,n.dataUpdatedAt)),he(this,Zi,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&O(this,br).remove(this)}setData(e,n){const r=Wp(this.state.data,e,this.options);return We(this,Or,hs).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e,n){We(this,Or,hs).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var r,s;const n=(r=O(this,on))==null?void 0:r.promise;return(s=O(this,on))==null||s.cancel(e),n?n.then(Pn).catch(Pn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(O(this,Zi))}isActive(){return this.observers.some(e=>yr(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===jg||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>pi(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!Tk(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=O(this,on))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=O(this,on))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),O(this,br).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(O(this,on)&&(O(this,Qi)?O(this,on).cancel({revert:!0}):O(this,on).cancelRetry()),this.scheduleGc()),O(this,br).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||We(this,Or,hs).call(this,{type:"invalidate"})}async fetch(e,n){var l,c,u,d,h,p,m,g,b,x,w,v;if(this.state.fetchStatus!=="idle"&&((l=O(this,on))==null?void 0:l.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(O(this,on))return O(this,on).continueRetry(),O(this,on).promise}if(e&&this.setOptions(e),!this.options.queryFn){const k=this.observers.find(N=>N.options.queryFn);k&&this.setOptions(k.options)}const r=new AbortController,s=k=>{Object.defineProperty(k,"signal",{enumerable:!0,get:()=>(he(this,Qi,!0),r.signal)})},i=()=>{const k=Mk(this.options,n),S=(()=>{const C={client:O(this,Xi),queryKey:this.queryKey,meta:this.meta};return s(C),C})();return he(this,Qi,!1),this.options.persister?this.options.persister(k,S,this):k(S)},a=(()=>{const k={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:O(this,Xi),state:this.state,fetchFn:i};return s(k),k})();(c=this.options.behavior)==null||c.onFetch(a,this),he(this,ba,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=a.fetchOptions)==null?void 0:u.meta))&&We(this,Or,hs).call(this,{type:"fetch",meta:(d=a.fetchOptions)==null?void 0:d.meta}),he(this,on,Ik({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:k=>{k instanceof Kp&&k.revert&&this.setState({...O(this,ba),fetchStatus:"idle"}),r.abort()},onFail:(k,N)=>{We(this,Or,hs).call(this,{type:"failed",failureCount:k,error:N})},onPause:()=>{We(this,Or,hs).call(this,{type:"pause"})},onContinue:()=>{We(this,Or,hs).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const k=await O(this,on).start();if(k===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(k),(p=(h=O(this,br).config).onSuccess)==null||p.call(h,k,this),(g=(m=O(this,br).config).onSettled)==null||g.call(m,k,this.state.error,this),k}catch(k){if(k instanceof Kp){if(k.silent)return O(this,on).promise;if(k.revert){if(this.state.data===void 0)throw k;return this.state.data}}throw We(this,Or,hs).call(this,{type:"error",error:k}),(x=(b=O(this,br).config).onError)==null||x.call(b,k,this),(v=(w=O(this,br).config).onSettled)==null||v.call(w,this.state.data,k,this),k}finally{this.scheduleGc()}}},Zi=new WeakMap,ba=new WeakMap,br=new WeakMap,Xi=new WeakMap,on=new WeakMap,hc=new WeakMap,Qi=new WeakMap,Or=new WeakSet,hs=function(e){const n=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...Lk(r.data,this.options),fetchMeta:e.meta??null};case"success":const s={...r,...Ky(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return he(this,ba,e.manual?s:void 0),s;case"error":const i=e.error;return{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=n(this.state),en.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),O(this,br).notify({query:this,type:"updated",action:e})})},uk);function Lk(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ok(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function Ky(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Gy(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var qn,Qe,pc,In,eo,ya,ys,ri,mc,xa,va,to,no,si,wa,lt,pl,Gp,Jp,Yp,Zp,Xp,Qp,em,Pk,dk,OM=(dk=class extends Ba{constructor(e,n){super();Ce(this,lt);Ce(this,qn);Ce(this,Qe);Ce(this,pc);Ce(this,In);Ce(this,eo);Ce(this,ya);Ce(this,ys);Ce(this,ri);Ce(this,mc);Ce(this,xa);Ce(this,va);Ce(this,to);Ce(this,no);Ce(this,si);Ce(this,wa,new Set);this.options=n,he(this,qn,e),he(this,ri,null),he(this,ys,qp()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(O(this,Qe).addObserver(this),Jy(O(this,Qe),this.options)?We(this,lt,pl).call(this):this.updateResult(),We(this,lt,Zp).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return tm(O(this,Qe),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return tm(O(this,Qe),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,We(this,lt,Xp).call(this),We(this,lt,Qp).call(this),O(this,Qe).removeObserver(this)}setOptions(e){const n=this.options,r=O(this,Qe);if(this.options=O(this,qn).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof yr(this.options.enabled,O(this,Qe))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");We(this,lt,em).call(this),O(this,Qe).setOptions(this.options),n._defaulted&&!Ju(this.options,n)&&O(this,qn).getQueryCache().notify({type:"observerOptionsUpdated",query:O(this,Qe),observer:this});const s=this.hasListeners();s&&Yy(O(this,Qe),r,this.options,n)&&We(this,lt,pl).call(this),this.updateResult(),s&&(O(this,Qe)!==r||yr(this.options.enabled,O(this,Qe))!==yr(n.enabled,O(this,Qe))||pi(this.options.staleTime,O(this,Qe))!==pi(n.staleTime,O(this,Qe)))&&We(this,lt,Gp).call(this);const i=We(this,lt,Jp).call(this);s&&(O(this,Qe)!==r||yr(this.options.enabled,O(this,Qe))!==yr(n.enabled,O(this,Qe))||i!==O(this,si))&&We(this,lt,Yp).call(this,i)}getOptimisticResult(e){const n=O(this,qn).getQueryCache().build(O(this,qn),e),r=this.createResult(n,e);return DM(this,r)&&(he(this,In,r),he(this,ya,this.options),he(this,eo,O(this,Qe).state)),r}getCurrentResult(){return O(this,In)}trackResult(e,n){return new Proxy(e,{get:(r,s)=>(this.trackProp(s),n==null||n(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&O(this,ys).status==="pending"&&O(this,ys).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,s))})}trackProp(e){O(this,wa).add(e)}getCurrentQuery(){return O(this,Qe)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=O(this,qn).defaultQueryOptions(e),r=O(this,qn).getQueryCache().build(O(this,qn),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(e){return We(this,lt,pl).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),O(this,In)))}createResult(e,n){var R;const r=O(this,Qe),s=this.options,i=O(this,In),o=O(this,eo),a=O(this,ya),c=e!==r?e.state:O(this,pc),{state:u}=e;let d={...u},h=!1,p;if(n._optimisticResults){const _=this.hasListeners(),I=!_&&Jy(e,n),D=_&&Yy(e,r,n,s);(I||D)&&(d={...d,...Lk(u.data,e.options)}),n._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:m,errorUpdatedAt:g,status:b}=d;p=d.data;let x=!1;if(n.placeholderData!==void 0&&p===void 0&&b==="pending"){let _;i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(_=i.data,x=!0):_=typeof n.placeholderData=="function"?n.placeholderData((R=O(this,va))==null?void 0:R.state.data,O(this,va)):n.placeholderData,_!==void 0&&(b="success",p=Wp(i==null?void 0:i.data,_,n),h=!0)}if(n.select&&p!==void 0&&!x)if(i&&p===(o==null?void 0:o.data)&&n.select===O(this,mc))p=O(this,xa);else try{he(this,mc,n.select),p=n.select(p),p=Wp(i==null?void 0:i.data,p,n),he(this,xa,p),he(this,ri,null)}catch(_){he(this,ri,_)}O(this,ri)&&(m=O(this,ri),p=O(this,xa),g=Date.now(),b="error");const w=d.fetchStatus==="fetching",v=b==="pending",k=b==="error",N=v&&w,S=p!==void 0,T={status:b,fetchStatus:d.fetchStatus,isPending:v,isSuccess:b==="success",isError:k,isInitialLoading:N,isLoading:N,data:p,dataUpdatedAt:d.dataUpdatedAt,error:m,errorUpdatedAt:g,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>c.dataUpdateCount||d.errorUpdateCount>c.errorUpdateCount,isFetching:w,isRefetching:w&&!v,isLoadingError:k&&!S,isPaused:d.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:k&&S,isStale:Fg(e,n),refetch:this.refetch,promise:O(this,ys),isEnabled:yr(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const _=V=>{T.status==="error"?V.reject(T.error):T.data!==void 0&&V.resolve(T.data)},I=()=>{const V=he(this,ys,T.promise=qp());_(V)},D=O(this,ys);switch(D.status){case"pending":e.queryHash===r.queryHash&&_(D);break;case"fulfilled":(T.status==="error"||T.data!==D.value)&&I();break;case"rejected":(T.status!=="error"||T.error!==D.reason)&&I();break}}return T}updateResult(){const e=O(this,In),n=this.createResult(O(this,Qe),this.options);if(he(this,eo,O(this,Qe).state),he(this,ya,this.options),O(this,eo).data!==void 0&&he(this,va,O(this,Qe)),Ju(n,e))return;he(this,In,n);const r=()=>{if(!e)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!O(this,wa).size)return!0;const o=new Set(i??O(this,wa));return this.options.throwOnError&&o.add("error"),Object.keys(O(this,In)).some(a=>{const l=a;return O(this,In)[l]!==e[l]&&o.has(l)})};We(this,lt,Pk).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&We(this,lt,Zp).call(this)}},qn=new WeakMap,Qe=new WeakMap,pc=new WeakMap,In=new WeakMap,eo=new WeakMap,ya=new WeakMap,ys=new WeakMap,ri=new WeakMap,mc=new WeakMap,xa=new WeakMap,va=new WeakMap,to=new WeakMap,no=new WeakMap,si=new WeakMap,wa=new WeakMap,lt=new WeakSet,pl=function(e){We(this,lt,em).call(this);let n=O(this,Qe).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(Pn)),n},Gp=function(){We(this,lt,Xp).call(this);const e=pi(this.options.staleTime,O(this,Qe));if(po||O(this,In).isStale||!Up(e))return;const r=Tk(O(this,In).dataUpdatedAt,e)+1;he(this,to,Hi.setTimeout(()=>{O(this,In).isStale||this.updateResult()},r))},Jp=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(O(this,Qe)):this.options.refetchInterval)??!1},Yp=function(e){We(this,lt,Qp).call(this),he(this,si,e),!(po||yr(this.options.enabled,O(this,Qe))===!1||!Up(O(this,si))||O(this,si)===0)&&he(this,no,Hi.setInterval(()=>{(this.options.refetchIntervalInBackground||zg.isFocused())&&We(this,lt,pl).call(this)},O(this,si)))},Zp=function(){We(this,lt,Gp).call(this),We(this,lt,Yp).call(this,We(this,lt,Jp).call(this))},Xp=function(){O(this,to)&&(Hi.clearTimeout(O(this,to)),he(this,to,void 0))},Qp=function(){O(this,no)&&(Hi.clearInterval(O(this,no)),he(this,no,void 0))},em=function(){const e=O(this,qn).getQueryCache().build(O(this,qn),this.options);if(e===O(this,Qe))return;const n=O(this,Qe);he(this,Qe,e),he(this,pc,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},Pk=function(e){en.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(O(this,In))}),O(this,qn).getQueryCache().notify({query:O(this,Qe),type:"observerResultsUpdated"})})},dk);function IM(t,e){return yr(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function Jy(t,e){return IM(t,e)||t.state.data!==void 0&&tm(t,e,e.refetchOnMount)}function tm(t,e,n){if(yr(e.enabled,t)!==!1&&pi(e.staleTime,t)!=="static"){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&Fg(t,e)}return!1}function Yy(t,e,n,r){return(t!==e||yr(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&Fg(t,n)}function Fg(t,e){return yr(e.enabled,t)!==!1&&t.isStaleByTime(pi(e.staleTime,t))}function DM(t,e){return!Ju(t.getCurrentResult(),e)}function Zy(t){return{onFetch:(e,n)=>{var u,d,h,p,m;const r=e.options,s=(h=(d=(u=e.fetchOptions)==null?void 0:u.meta)==null?void 0:d.fetchMore)==null?void 0:h.direction,i=((p=e.state.data)==null?void 0:p.pages)||[],o=((m=e.state.data)==null?void 0:m.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let g=!1;const b=v=>{Object.defineProperty(v,"signal",{enumerable:!0,get:()=>(e.signal.aborted?g=!0:e.signal.addEventListener("abort",()=>{g=!0}),e.signal)})},x=Mk(e.options,e.fetchOptions),w=async(v,k,N)=>{if(g)return Promise.reject();if(k==null&&v.pages.length)return Promise.resolve(v);const C=(()=>{const I={client:e.client,queryKey:e.queryKey,pageParam:k,direction:N?"backward":"forward",meta:e.options.meta};return b(I),I})(),T=await x(C),{maxPages:R}=e.options,_=N?CM:EM;return{pages:_(v.pages,T,R),pageParams:_(v.pageParams,k,R)}};if(s&&i.length){const v=s==="backward",k=v?LM:Xy,N={pages:i,pageParams:o},S=k(r,N);a=await w(N,S,v)}else{const v=t??i.length;do{const k=l===0?o[0]??r.initialPageParam:Xy(r,a);if(l>0&&k==null)break;a=await w(a,k),l++}while(l<v)}return a};e.options.persister?e.fetchFn=()=>{var g,b;return(b=(g=e.options).persister)==null?void 0:b.call(g,c,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=c}}}function Xy(t,{pages:e,pageParams:n}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,n[r],n):void 0}function LM(t,{pages:e,pageParams:n}){var r;return e.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,n[0],n):void 0}var gc,Jr,Dn,ro,Yr,Hs,fk,PM=(fk=class extends Dk{constructor(e){super();Ce(this,Yr);Ce(this,gc);Ce(this,Jr);Ce(this,Dn);Ce(this,ro);he(this,gc,e.client),this.mutationId=e.mutationId,he(this,Dn,e.mutationCache),he(this,Jr,[]),this.state=e.state||jk(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){O(this,Jr).includes(e)||(O(this,Jr).push(e),this.clearGcTimeout(),O(this,Dn).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){he(this,Jr,O(this,Jr).filter(n=>n!==e)),this.scheduleGc(),O(this,Dn).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){O(this,Jr).length||(this.state.status==="pending"?this.scheduleGc():O(this,Dn).remove(this))}continue(){var e;return((e=O(this,ro))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var o,a,l,c,u,d,h,p,m,g,b,x,w,v,k,N,S,C,T,R;const n=()=>{We(this,Yr,Hs).call(this,{type:"continue"})},r={client:O(this,gc),meta:this.options.meta,mutationKey:this.options.mutationKey};he(this,ro,Ik({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(_,I)=>{We(this,Yr,Hs).call(this,{type:"failed",failureCount:_,error:I})},onPause:()=>{We(this,Yr,Hs).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>O(this,Dn).canRun(this)}));const s=this.state.status==="pending",i=!O(this,ro).canStart();try{if(s)n();else{We(this,Yr,Hs).call(this,{type:"pending",variables:e,isPaused:i}),await((a=(o=O(this,Dn).config).onMutate)==null?void 0:a.call(o,e,this,r));const I=await((c=(l=this.options).onMutate)==null?void 0:c.call(l,e,r));I!==this.state.context&&We(this,Yr,Hs).call(this,{type:"pending",context:I,variables:e,isPaused:i})}const _=await O(this,ro).start();return await((d=(u=O(this,Dn).config).onSuccess)==null?void 0:d.call(u,_,e,this.state.context,this,r)),await((p=(h=this.options).onSuccess)==null?void 0:p.call(h,_,e,this.state.context,r)),await((g=(m=O(this,Dn).config).onSettled)==null?void 0:g.call(m,_,null,this.state.variables,this.state.context,this,r)),await((x=(b=this.options).onSettled)==null?void 0:x.call(b,_,null,e,this.state.context,r)),We(this,Yr,Hs).call(this,{type:"success",data:_}),_}catch(_){try{throw await((v=(w=O(this,Dn).config).onError)==null?void 0:v.call(w,_,e,this.state.context,this,r)),await((N=(k=this.options).onError)==null?void 0:N.call(k,_,e,this.state.context,r)),await((C=(S=O(this,Dn).config).onSettled)==null?void 0:C.call(S,void 0,_,this.state.variables,this.state.context,this,r)),await((R=(T=this.options).onSettled)==null?void 0:R.call(T,void 0,_,e,this.state.context,r)),_}finally{We(this,Yr,Hs).call(this,{type:"error",error:_})}}finally{O(this,Dn).runNext(this)}}},gc=new WeakMap,Jr=new WeakMap,Dn=new WeakMap,ro=new WeakMap,Yr=new WeakSet,Hs=function(e){const n=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),en.batch(()=>{O(this,Jr).forEach(r=>{r.onMutationUpdate(e)}),O(this,Dn).notify({mutation:this,type:"updated",action:e})})},fk);function jk(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var xs,Ir,bc,hk,jM=(hk=class extends Ba{constructor(e={}){super();Ce(this,xs);Ce(this,Ir);Ce(this,bc);this.config=e,he(this,xs,new Set),he(this,Ir,new Map),he(this,bc,0)}build(e,n,r){const s=new PM({client:e,mutationCache:this,mutationId:++tu(this,bc)._,options:e.defaultMutationOptions(n),state:r});return this.add(s),s}add(e){O(this,xs).add(e);const n=ru(e);if(typeof n=="string"){const r=O(this,Ir).get(n);r?r.push(e):O(this,Ir).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(O(this,xs).delete(e)){const n=ru(e);if(typeof n=="string"){const r=O(this,Ir).get(n);if(r)if(r.length>1){const s=r.indexOf(e);s!==-1&&r.splice(s,1)}else r[0]===e&&O(this,Ir).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=ru(e);if(typeof n=="string"){const r=O(this,Ir).get(n),s=r==null?void 0:r.find(i=>i.state.status==="pending");return!s||s===e}else return!0}runNext(e){var r;const n=ru(e);if(typeof n=="string"){const s=(r=O(this,Ir).get(n))==null?void 0:r.find(i=>i!==e&&i.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){en.batch(()=>{O(this,xs).forEach(e=>{this.notify({type:"removed",mutation:e})}),O(this,xs).clear(),O(this,Ir).clear()})}getAll(){return Array.from(O(this,xs))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>Vy(n,r))}findAll(e={}){return this.getAll().filter(n=>Vy(e,n))}notify(e){en.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return en.batch(()=>Promise.all(e.map(n=>n.continue().catch(Pn))))}},xs=new WeakMap,Ir=new WeakMap,bc=new WeakMap,hk);function ru(t){var e;return(e=t.options.scope)==null?void 0:e.id}var vs,ii,Kn,ws,_s,Iu,nm,pk,zM=(pk=class extends Ba{constructor(n,r){super();Ce(this,_s);Ce(this,vs);Ce(this,ii);Ce(this,Kn);Ce(this,ws);he(this,vs,n),this.setOptions(r),this.bindMethods(),We(this,_s,Iu).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var s;const r=this.options;this.options=O(this,vs).defaultMutationOptions(n),Ju(this.options,r)||O(this,vs).getMutationCache().notify({type:"observerOptionsUpdated",mutation:O(this,Kn),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&mo(r.mutationKey)!==mo(this.options.mutationKey)?this.reset():((s=O(this,Kn))==null?void 0:s.state.status)==="pending"&&O(this,Kn).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=O(this,Kn))==null||n.removeObserver(this)}onMutationUpdate(n){We(this,_s,Iu).call(this),We(this,_s,nm).call(this,n)}getCurrentResult(){return O(this,ii)}reset(){var n;(n=O(this,Kn))==null||n.removeObserver(this),he(this,Kn,void 0),We(this,_s,Iu).call(this),We(this,_s,nm).call(this)}mutate(n,r){var s;return he(this,ws,r),(s=O(this,Kn))==null||s.removeObserver(this),he(this,Kn,O(this,vs).getMutationCache().build(O(this,vs),this.options)),O(this,Kn).addObserver(this),O(this,Kn).execute(n)}},vs=new WeakMap,ii=new WeakMap,Kn=new WeakMap,ws=new WeakMap,_s=new WeakSet,Iu=function(){var r;const n=((r=O(this,Kn))==null?void 0:r.state)??jk();he(this,ii,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},nm=function(n){en.batch(()=>{var r,s,i,o,a,l,c,u;if(O(this,ws)&&this.hasListeners()){const d=O(this,ii).variables,h=O(this,ii).context,p={client:O(this,vs),meta:this.options.meta,mutationKey:this.options.mutationKey};(n==null?void 0:n.type)==="success"?((s=(r=O(this,ws)).onSuccess)==null||s.call(r,n.data,d,h,p),(o=(i=O(this,ws)).onSettled)==null||o.call(i,n.data,null,d,h,p)):(n==null?void 0:n.type)==="error"&&((l=(a=O(this,ws)).onError)==null||l.call(a,n.error,d,h,p),(u=(c=O(this,ws)).onSettled)==null||u.call(c,void 0,n.error,d,h,p))}this.listeners.forEach(d=>{d(O(this,ii))})})},pk),Zr,mk,FM=(mk=class extends Ba{constructor(e={}){super();Ce(this,Zr);this.config=e,he(this,Zr,new Map)}build(e,n,r){const s=n.queryKey,i=n.queryHash??Pg(s,n);let o=this.get(i);return o||(o=new RM({client:e,queryKey:s,queryHash:i,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(s)}),this.add(o)),o}add(e){O(this,Zr).has(e.queryHash)||(O(this,Zr).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=O(this,Zr).get(e.queryHash);n&&(e.destroy(),n===e&&O(this,Zr).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){en.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return O(this,Zr).get(e)}getAll(){return[...O(this,Zr).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>Uy(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>Uy(e,r)):n}notify(e){en.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){en.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){en.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Zr=new WeakMap,mk),zt,oi,ai,ka,Sa,li,Ea,Ca,gk,BM=(gk=class{constructor(t={}){Ce(this,zt);Ce(this,oi);Ce(this,ai);Ce(this,ka);Ce(this,Sa);Ce(this,li);Ce(this,Ea);Ce(this,Ca);he(this,zt,t.queryCache||new FM),he(this,oi,t.mutationCache||new jM),he(this,ai,t.defaultOptions||{}),he(this,ka,new Map),he(this,Sa,new Map),he(this,li,0)}mount(){tu(this,li)._++,O(this,li)===1&&(he(this,Ea,zg.subscribe(async t=>{t&&(await this.resumePausedMutations(),O(this,zt).onFocus())})),he(this,Ca,Yu.subscribe(async t=>{t&&(await this.resumePausedMutations(),O(this,zt).onOnline())})))}unmount(){var t,e;tu(this,li)._--,O(this,li)===0&&((t=O(this,Ea))==null||t.call(this),he(this,Ea,void 0),(e=O(this,Ca))==null||e.call(this),he(this,Ca,void 0))}isFetching(t){return O(this,zt).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return O(this,oi).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=O(this,zt).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=O(this,zt).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(pi(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return O(this,zt).findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),s=O(this,zt).get(r.queryHash),i=s==null?void 0:s.state.data,o=wM(e,i);if(o!==void 0)return O(this,zt).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(t,e,n){return en.batch(()=>O(this,zt).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=O(this,zt).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=O(this,zt);en.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=O(this,zt);return en.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=en.batch(()=>O(this,zt).findAll(t).map(s=>s.cancel(n)));return Promise.all(r).then(Pn).catch(Pn)}invalidateQueries(t,e={}){return en.batch(()=>(O(this,zt).findAll(t).forEach(n=>{n.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},r=en.batch(()=>O(this,zt).findAll(t).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,n);return n.throwOnError||(i=i.catch(Pn)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Pn)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=O(this,zt).build(this,e);return n.isStaleByTime(pi(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Pn).catch(Pn)}fetchInfiniteQuery(t){return t.behavior=Zy(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Pn).catch(Pn)}ensureInfiniteQueryData(t){return t.behavior=Zy(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Yu.isOnline()?O(this,oi).resumePausedMutations():Promise.resolve()}getQueryCache(){return O(this,zt)}getMutationCache(){return O(this,oi)}getDefaultOptions(){return O(this,ai)}setDefaultOptions(t){he(this,ai,t)}setQueryDefaults(t,e){O(this,ka).set(mo(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...O(this,ka).values()],n={};return e.forEach(r=>{Bl(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){O(this,Sa).set(mo(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...O(this,Sa).values()],n={};return e.forEach(r=>{Bl(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...O(this,ai).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Pg(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===jg&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...O(this,ai).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){O(this,zt).clear(),O(this,oi).clear()}},zt=new WeakMap,oi=new WeakMap,ai=new WeakMap,ka=new WeakMap,Sa=new WeakMap,li=new WeakMap,Ea=new WeakMap,Ca=new WeakMap,gk),zk=y.createContext(void 0),ts=t=>{const e=y.useContext(zk);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},$M=({client:t,children:e})=>(y.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),f.jsx(zk.Provider,{value:t,children:e})),Fk=y.createContext(!1),HM=()=>y.useContext(Fk);Fk.Provider;function UM(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var VM=y.createContext(UM()),WM=()=>y.useContext(VM),qM=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&(e.isReset()||(t.retryOnMount=!1))},KM=t=>{y.useEffect(()=>{t.clearReset()},[t])},GM=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:s})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(s&&t.data===void 0||Rk(n,[t.error,r])),JM=t=>{if(t.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...s)=>n(r(...s)):n(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},YM=(t,e)=>t.isLoading&&t.isFetching&&!e,ZM=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,Qy=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function XM(t,e,n){var d,h,p,m,g;const r=HM(),s=WM(),i=ts(),o=i.defaultQueryOptions(t);(h=(d=i.getDefaultOptions().queries)==null?void 0:d._experimental_beforeQuery)==null||h.call(d,o),o._optimisticResults=r?"isRestoring":"optimistic",JM(o),qM(o,s),KM(s);const a=!i.getQueryCache().get(o.queryHash),[l]=y.useState(()=>new e(i,o)),c=l.getOptimisticResult(o),u=!r&&t.subscribed!==!1;if(y.useSyncExternalStore(y.useCallback(b=>{const x=u?l.subscribe(en.batchCalls(b)):Pn;return l.updateResult(),x},[l,u]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),y.useEffect(()=>{l.setOptions(o)},[o,l]),ZM(o,c))throw Qy(o,l,s);if(GM({result:c,errorResetBoundary:s,throwOnError:o.throwOnError,query:i.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw c.error;if((m=(p=i.getDefaultOptions().queries)==null?void 0:p._experimental_afterQuery)==null||m.call(p,o,c),o.experimental_prefetchInRender&&!po&&YM(c,r)){const b=a?Qy(o,l,s):(g=i.getQueryCache().get(o.queryHash))==null?void 0:g.promise;b==null||b.catch(Pn).finally(()=>{l.updateResult()})}return o.notifyOnChangeProps?c:l.trackResult(c)}function Io(t,e){return XM(t,OM)}function Sr(t,e){const n=ts(),[r]=y.useState(()=>new zM(n,t));y.useEffect(()=>{r.setOptions(t)},[r,t]);const s=y.useSyncExternalStore(y.useCallback(o=>r.subscribe(en.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=y.useCallback((o,a)=>{r.mutate(o,a).catch(Pn)},[r]);if(s.error&&Rk(r.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:i,mutateAsync:s.mutate}}const Bk=y.createContext(void 0);function QM({children:t}){const[e,n]=y.useState(()=>localStorage.getItem("theme")||"system"),[r,s]=y.useState(()=>e==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e==="dark"?"dark":"light");return y.useEffect(()=>{const i=window.document.documentElement;if(i.classList.remove("light","dark"),e==="system"){const o=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";i.classList.add(o),s(o)}else i.classList.add(e),s(e)},[e]),y.useEffect(()=>{localStorage.setItem("theme",e)},[e]),y.useEffect(()=>{const i=window.matchMedia("(prefers-color-scheme: dark)"),o=()=>{if(e==="system"){const a=i.matches?"dark":"light";s(a),window.document.documentElement.classList.remove("light","dark"),window.document.documentElement.classList.add(a)}};return i.addEventListener("change",o),()=>i.removeEventListener("change",o)},[e]),f.jsx(Bk.Provider,{value:{theme:e,setTheme:n,actualTheme:r},children:t})}function eR(){const t=y.useContext(Bk);if(t===void 0)throw new Error("useTheme must be used within a ThemeProvider");return t}const $k=y.createContext(null);function tR({children:t,url:e="",reconnect:n=!0,reconnectInterval:r=5e3}){const s=y.useRef(null),i=y.useRef(null),o=y.useRef(new Map),a=y.useRef(new Set),l=y.useRef(new Set),[c,u]=y.useState(!1),[d,h]=y.useState(null),p=y.useCallback(()=>{var C;if(((C=s.current)==null?void 0:C.readyState)===WebSocket.OPEN)return;const k="/ws",N=window.location.protocol==="https:"?"wss:":"ws:",S=k.startsWith("/")?`${N}//${window.location.host}${k}${e}`:`${k}${e}`;console.log("[WebSocket] Connecting to:",S);try{s.current=new WebSocket(S),s.current.onopen=()=>{console.log("[WebSocket] Connected"),u(!0),l.current.forEach(T=>{var R;if(((R=s.current)==null?void 0:R.readyState)===WebSocket.OPEN){const _=nR(T);_&&(s.current.send(JSON.stringify(_)),console.log("[WebSocket] Resubscribed to:",T))}}),a.current=new Set(l.current),l.current.clear()},s.current.onmessage=T=>{try{const R=JSON.parse(T.data);console.log("[WebSocket] Message received:",R.type),h(R),o.current.forEach(_=>{try{_(R)}catch(I){console.error("[WebSocket] Handler error:",I)}})}catch(R){console.error("[WebSocket] Failed to parse message:",R)}},s.current.onerror=T=>{console.error("[WebSocket] Error:",T)},s.current.onclose=()=>{console.log("[WebSocket] Disconnected"),u(!1),l.current=new Set(a.current),n&&(i.current=setTimeout(()=>{console.log("[WebSocket] Attempting to reconnect..."),p()},r))}}catch(T){console.error("[WebSocket] Connection failed:",T)}},[e,n,r]),m=y.useCallback(()=>{i.current&&(clearTimeout(i.current),i.current=null),s.current&&(s.current.onclose=null,s.current.close(),s.current=null),u(!1),a.current.clear(),l.current.clear()},[]),g=y.useCallback((k,N)=>{var C;const S=N?`${k}:${N}`:`${k}:*`;if(a.current.add(S),((C=s.current)==null?void 0:C.readyState)===WebSocket.OPEN){const T={type:"subscribe",entity_type:k,entity_id:N};s.current.send(JSON.stringify(T)),console.log("[WebSocket] Subscribed to:",S)}else l.current.add(S)},[]),b=y.useCallback((k,N)=>{var C;const S=N?`${k}:${N}`:`${k}:*`;if(a.current.delete(S),l.current.delete(S),((C=s.current)==null?void 0:C.readyState)===WebSocket.OPEN){const T={type:"unsubscribe",entity_type:k,entity_id:N};s.current.send(JSON.stringify(T)),console.log("[WebSocket] Unsubscribed from:",S)}},[]),x=y.useCallback((k,N)=>{o.current.set(k,N)},[]),w=y.useCallback(k=>{o.current.delete(k)},[]);y.useEffect(()=>(p(),()=>{m()}),[p,m]);const v={connected:c,lastMessage:d,subscribe:g,unsubscribe:b,addMessageHandler:x,removeMessageHandler:w};return f.jsx($k.Provider,{value:v,children:t})}function $a(){const t=y.useContext($k);if(!t)throw new Error("useWebSocketContext must be used within a WebSocketProvider");return t}function nR(t){if(t==="all")return{type:"subscribe",entity_type:"all"};const[e,n]=t.split(":");return e==="issue"||e==="spec"?{type:"subscribe",entity_type:e,entity_id:n==="*"?void 0:n}:null}/**
2
- * @license lucide-react v0.344.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */var rR={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
7
- * @license lucide-react v0.344.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const sR=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),Te=(t,e)=>{const n=y.forwardRef(({color:r="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:o,className:a="",children:l,...c},u)=>y.createElement("svg",{ref:u,...rR,width:s,height:s,stroke:r,strokeWidth:o?Number(i)*24/Number(s):i,className:["lucide",`lucide-${sR(t)}`,a].join(" "),...c},[...e.map(([d,h])=>y.createElement(d,h)),...Array.isArray(l)?l:[l]]));return n.displayName=`${t}`,n};/**
12
- * @license lucide-react v0.344.0 - ISC
13
- *
14
- * This source code is licensed under the ISC license.
15
- * See the LICENSE file in the root directory of this source tree.
16
- */const go=Te("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
17
- * @license lucide-react v0.344.0 - ISC
18
- *
19
- * This source code is licensed under the ISC license.
20
- * See the LICENSE file in the root directory of this source tree.
21
- */const Bg=Te("ArchiveRestore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]);/**
22
- * @license lucide-react v0.344.0 - ISC
23
- *
24
- * This source code is licensed under the ISC license.
25
- * See the LICENSE file in the root directory of this source tree.
26
- */const Ha=Te("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/**
27
- * @license lucide-react v0.344.0 - ISC
28
- *
29
- * This source code is licensed under the ISC license.
30
- * See the LICENSE file in the root directory of this source tree.
31
- */const xf=Te("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
32
- * @license lucide-react v0.344.0 - ISC
33
- *
34
- * This source code is licensed under the ISC license.
35
- * See the LICENSE file in the root directory of this source tree.
36
- */const iR=Te("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
37
- * @license lucide-react v0.344.0 - ISC
38
- *
39
- * This source code is licensed under the ISC license.
40
- * See the LICENSE file in the root directory of this source tree.
41
- */const oR=Te("Bold",[["path",{d:"M14 12a4 4 0 0 0 0-8H6v8",key:"v2sylx"}],["path",{d:"M15 20a4 4 0 0 0 0-8H6v8Z",key:"1ef5ya"}]]);/**
42
- * @license lucide-react v0.344.0 - ISC
43
- *
44
- * This source code is licensed under the ISC license.
45
- * See the LICENSE file in the root directory of this source tree.
46
- */const $g=Te("CheckCircle2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
47
- * @license lucide-react v0.344.0 - ISC
48
- *
49
- * This source code is licensed under the ISC license.
50
- * See the LICENSE file in the root directory of this source tree.
51
- */const vf=Te("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
52
- * @license lucide-react v0.344.0 - ISC
53
- *
54
- * This source code is licensed under the ISC license.
55
- * See the LICENSE file in the root directory of this source tree.
56
- */const $l=Te("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
57
- * @license lucide-react v0.344.0 - ISC
58
- *
59
- * This source code is licensed under the ISC license.
60
- * See the LICENSE file in the root directory of this source tree.
61
- */const Hg=Te("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
62
- * @license lucide-react v0.344.0 - ISC
63
- *
64
- * This source code is licensed under the ISC license.
65
- * See the LICENSE file in the root directory of this source tree.
66
- */const Hk=Te("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/**
67
- * @license lucide-react v0.344.0 - ISC
68
- *
69
- * This source code is licensed under the ISC license.
70
- * See the LICENSE file in the root directory of this source tree.
71
- */const aR=Te("CircleDot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/**
72
- * @license lucide-react v0.344.0 - ISC
73
- *
74
- * This source code is licensed under the ISC license.
75
- * See the LICENSE file in the root directory of this source tree.
76
- */const Hl=Te("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
77
- * @license lucide-react v0.344.0 - ISC
78
- *
79
- * This source code is licensed under the ISC license.
80
- * See the LICENSE file in the root directory of this source tree.
81
- */const vc=Te("Code2",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/**
82
- * @license lucide-react v0.344.0 - ISC
83
- *
84
- * This source code is licensed under the ISC license.
85
- * See the LICENSE file in the root directory of this source tree.
86
- */const lR=Te("CodeSquare",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m10 10-2 2 2 2",key:"p6et6i"}],["path",{d:"m14 14 2-2-2-2",key:"m075q2"}]]);/**
87
- * @license lucide-react v0.344.0 - ISC
88
- *
89
- * This source code is licensed under the ISC license.
90
- * See the LICENSE file in the root directory of this source tree.
91
- */const cR=Te("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
92
- * @license lucide-react v0.344.0 - ISC
93
- *
94
- * This source code is licensed under the ISC license.
95
- * See the LICENSE file in the root directory of this source tree.
96
- */const uR=Te("Expand",[["path",{d:"m21 21-6-6m6 6v-4.8m0 4.8h-4.8",key:"1c15vz"}],["path",{d:"M3 16.2V21m0 0h4.8M3 21l6-6",key:"1fsnz2"}],["path",{d:"M21 7.8V3m0 0h-4.8M21 3l-6 6",key:"hawz9i"}],["path",{d:"M3 7.8V3m0 0h4.8M3 3l6 6",key:"u9ee12"}]]);/**
97
- * @license lucide-react v0.344.0 - ISC
98
- *
99
- * This source code is licensed under the ISC license.
100
- * See the LICENSE file in the root directory of this source tree.
101
- */const dR=Te("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
102
- * @license lucide-react v0.344.0 - ISC
103
- *
104
- * This source code is licensed under the ISC license.
105
- * See the LICENSE file in the root directory of this source tree.
106
- */const Os=Te("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
107
- * @license lucide-react v0.344.0 - ISC
108
- *
109
- * This source code is licensed under the ISC license.
110
- * See the LICENSE file in the root directory of this source tree.
111
- */const Ua=Te("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/**
112
- * @license lucide-react v0.344.0 - ISC
113
- *
114
- * This source code is licensed under the ISC license.
115
- * See the LICENSE file in the root directory of this source tree.
116
- */const fR=Te("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);/**
117
- * @license lucide-react v0.344.0 - ISC
118
- *
119
- * This source code is licensed under the ISC license.
120
- * See the LICENSE file in the root directory of this source tree.
121
- */const hR=Te("Heading1",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]]);/**
122
- * @license lucide-react v0.344.0 - ISC
123
- *
124
- * This source code is licensed under the ISC license.
125
- * See the LICENSE file in the root directory of this source tree.
126
- */const pR=Te("Heading2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]]);/**
127
- * @license lucide-react v0.344.0 - ISC
128
- *
129
- * This source code is licensed under the ISC license.
130
- * See the LICENSE file in the root directory of this source tree.
131
- */const mR=Te("Heading3",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]]);/**
132
- * @license lucide-react v0.344.0 - ISC
133
- *
134
- * This source code is licensed under the ISC license.
135
- * See the LICENSE file in the root directory of this source tree.
136
- */const ex=Te("HelpCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
137
- * @license lucide-react v0.344.0 - ISC
138
- *
139
- * This source code is licensed under the ISC license.
140
- * See the LICENSE file in the root directory of this source tree.
141
- */const gR=Te("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
142
- * @license lucide-react v0.344.0 - ISC
143
- *
144
- * This source code is licensed under the ISC license.
145
- * See the LICENSE file in the root directory of this source tree.
146
- */const bR=Te("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
147
- * @license lucide-react v0.344.0 - ISC
148
- *
149
- * This source code is licensed under the ISC license.
150
- * See the LICENSE file in the root directory of this source tree.
151
- */const yR=Te("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);/**
152
- * @license lucide-react v0.344.0 - ISC
153
- *
154
- * This source code is licensed under the ISC license.
155
- * See the LICENSE file in the root directory of this source tree.
156
- */const Uk=Te("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/**
157
- * @license lucide-react v0.344.0 - ISC
158
- *
159
- * This source code is licensed under the ISC license.
160
- * See the LICENSE file in the root directory of this source tree.
161
- */const xR=Te("ListOrdered",[["line",{x1:"10",x2:"21",y1:"6",y2:"6",key:"76qw6h"}],["line",{x1:"10",x2:"21",y1:"12",y2:"12",key:"16nom4"}],["line",{x1:"10",x2:"21",y1:"18",y2:"18",key:"u3jurt"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/**
162
- * @license lucide-react v0.344.0 - ISC
163
- *
164
- * This source code is licensed under the ISC license.
165
- * See the LICENSE file in the root directory of this source tree.
166
- */const vR=Te("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
167
- * @license lucide-react v0.344.0 - ISC
168
- *
169
- * This source code is licensed under the ISC license.
170
- * See the LICENSE file in the root directory of this source tree.
171
- */const wR=Te("List",[["line",{x1:"8",x2:"21",y1:"6",y2:"6",key:"7ey8pc"}],["line",{x1:"8",x2:"21",y1:"12",y2:"12",key:"rjfblc"}],["line",{x1:"8",x2:"21",y1:"18",y2:"18",key:"c3b1m8"}],["line",{x1:"3",x2:"3.01",y1:"6",y2:"6",key:"1g7gq3"}],["line",{x1:"3",x2:"3.01",y1:"12",y2:"12",key:"1pjlvk"}],["line",{x1:"3",x2:"3.01",y1:"18",y2:"18",key:"28t2mc"}]]);/**
172
- * @license lucide-react v0.344.0 - ISC
173
- *
174
- * This source code is licensed under the ISC license.
175
- * See the LICENSE file in the root directory of this source tree.
176
- */const mi=Te("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
177
- * @license lucide-react v0.344.0 - ISC
178
- *
179
- * This source code is licensed under the ISC license.
180
- * See the LICENSE file in the root directory of this source tree.
181
- */const kR=Te("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
182
- * @license lucide-react v0.344.0 - ISC
183
- *
184
- * This source code is licensed under the ISC license.
185
- * See the LICENSE file in the root directory of this source tree.
186
- */const SR=Te("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
187
- * @license lucide-react v0.344.0 - ISC
188
- *
189
- * This source code is licensed under the ISC license.
190
- * See the LICENSE file in the root directory of this source tree.
191
- */const ER=Te("MessageSquareOff",[["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M3.6 3.6c-.4.3-.6.8-.6 1.4v16l4-4h10",key:"pwpm4a"}]]);/**
192
- * @license lucide-react v0.344.0 - ISC
193
- *
194
- * This source code is licensed under the ISC license.
195
- * See the LICENSE file in the root directory of this source tree.
196
- */const Ug=Te("MessageSquarePlus",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/**
197
- * @license lucide-react v0.344.0 - ISC
198
- *
199
- * This source code is licensed under the ISC license.
200
- * See the LICENSE file in the root directory of this source tree.
201
- */const wc=Te("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
202
- * @license lucide-react v0.344.0 - ISC
203
- *
204
- * This source code is licensed under the ISC license.
205
- * See the LICENSE file in the root directory of this source tree.
206
- */const CR=Te("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
207
- * @license lucide-react v0.344.0 - ISC
208
- *
209
- * This source code is licensed under the ISC license.
210
- * See the LICENSE file in the root directory of this source tree.
211
- */const Vk=Te("PauseCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]);/**
212
- * @license lucide-react v0.344.0 - ISC
213
- *
214
- * This source code is licensed under the ISC license.
215
- * See the LICENSE file in the root directory of this source tree.
216
- */const NR=Te("PlayCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);/**
217
- * @license lucide-react v0.344.0 - ISC
218
- *
219
- * This source code is licensed under the ISC license.
220
- * See the LICENSE file in the root directory of this source tree.
221
- */const _R=Te("Play",[["polygon",{points:"5 3 19 12 5 21 5 3",key:"191637"}]]);/**
222
- * @license lucide-react v0.344.0 - ISC
223
- *
224
- * This source code is licensed under the ISC license.
225
- * See the LICENSE file in the root directory of this source tree.
226
- */const bo=Te("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
227
- * @license lucide-react v0.344.0 - ISC
228
- *
229
- * This source code is licensed under the ISC license.
230
- * See the LICENSE file in the root directory of this source tree.
231
- */const TR=Te("Quote",[["path",{d:"M3 21c3 0 7-1 7-8V5c0-1.25-.756-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V20c0 1 0 1 1 1z",key:"4rm80e"}],["path",{d:"M15 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v3c0 1 0 1 1 1z",key:"10za9r"}]]);/**
232
- * @license lucide-react v0.344.0 - ISC
233
- *
234
- * This source code is licensed under the ISC license.
235
- * See the LICENSE file in the root directory of this source tree.
236
- */const AR=Te("Redo",[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]]);/**
237
- * @license lucide-react v0.344.0 - ISC
238
- *
239
- * This source code is licensed under the ISC license.
240
- * See the LICENSE file in the root directory of this source tree.
241
- */const wf=Te("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
242
- * @license lucide-react v0.344.0 - ISC
243
- *
244
- * This source code is licensed under the ISC license.
245
- * See the LICENSE file in the root directory of this source tree.
246
- */const rm=Te("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
247
- * @license lucide-react v0.344.0 - ISC
248
- *
249
- * This source code is licensed under the ISC license.
250
- * See the LICENSE file in the root directory of this source tree.
251
- */const Wk=Te("Signal",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}],["path",{d:"M12 20v-8",key:"i3yub9"}],["path",{d:"M17 20V8",key:"1tkaf5"}],["path",{d:"M22 4v16",key:"sih9yq"}]]);/**
252
- * @license lucide-react v0.344.0 - ISC
253
- *
254
- * This source code is licensed under the ISC license.
255
- * See the LICENSE file in the root directory of this source tree.
256
- */const tx=Te("StopCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{width:"6",height:"6",x:"9",y:"9",key:"1wrtvo"}]]);/**
257
- * @license lucide-react v0.344.0 - ISC
258
- *
259
- * This source code is licensed under the ISC license.
260
- * See the LICENSE file in the root directory of this source tree.
261
- */const MR=Te("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
262
- * @license lucide-react v0.344.0 - ISC
263
- *
264
- * This source code is licensed under the ISC license.
265
- * See the LICENSE file in the root directory of this source tree.
266
- */const RR=Te("Table",[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]]);/**
267
- * @license lucide-react v0.344.0 - ISC
268
- *
269
- * This source code is licensed under the ISC license.
270
- * See the LICENSE file in the root directory of this source tree.
271
- */const Do=Te("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
272
- * @license lucide-react v0.344.0 - ISC
273
- *
274
- * This source code is licensed under the ISC license.
275
- * See the LICENSE file in the root directory of this source tree.
276
- */const OR=Te("Undo",[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]]);/**
277
- * @license lucide-react v0.344.0 - ISC
278
- *
279
- * This source code is licensed under the ISC license.
280
- * See the LICENSE file in the root directory of this source tree.
281
- */const IR=Te("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
282
- * @license lucide-react v0.344.0 - ISC
283
- *
284
- * This source code is licensed under the ISC license.
285
- * See the LICENSE file in the root directory of this source tree.
286
- */const ra=Te("XCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
287
- * @license lucide-react v0.344.0 - ISC
288
- *
289
- * This source code is licensed under the ISC license.
290
- * See the LICENSE file in the root directory of this source tree.
291
- */const Sl=Te("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function qk(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(e=0;e<s;e++)t[e]&&(n=qk(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function Kk(){for(var t,e,n=0,r="",s=arguments.length;n<s;n++)(t=arguments[n])&&(e=qk(t))&&(r&&(r+=" "),r+=e);return r}const Vg="-",DR=t=>{const e=PR(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{const a=o.split(Vg);return a[0]===""&&a.length!==1&&a.shift(),Gk(a,e)||LR(o)},getConflictingClassGroupIds:(o,a)=>{const l=n[o]||[];return a&&r[o]?[...l,...r[o]]:l}}},Gk=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),s=r?Gk(t.slice(1),r):void 0;if(s)return s;if(e.validators.length===0)return;const i=t.join(Vg);return(o=e.validators.find(({validator:a})=>a(i)))==null?void 0:o.classGroupId},nx=/^\[(.+)\]$/,LR=t=>{if(nx.test(t)){const e=nx.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},PR=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return zR(Object.entries(t.classGroups),n).forEach(([i,o])=>{sm(o,r,i,e)}),r},sm=(t,e,n,r)=>{t.forEach(s=>{if(typeof s=="string"){const i=s===""?e:rx(e,s);i.classGroupId=n;return}if(typeof s=="function"){if(jR(s)){sm(s(r),e,n,r);return}e.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(([i,o])=>{sm(o,rx(e,i),n,r)})})},rx=(t,e)=>{let n=t;return e.split(Vg).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},jR=t=>t.isThemeGetter,zR=(t,e)=>e?t.map(([n,r])=>{const s=r.map(i=>typeof i=="string"?e+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([o,a])=>[e+o,a])):i);return[n,s]}):t,FR=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const s=(i,o)=>{n.set(i,o),e++,e>t&&(e=0,r=n,n=new Map)};return{get(i){let o=n.get(i);if(o!==void 0)return o;if((o=r.get(i))!==void 0)return s(i,o),o},set(i,o){n.has(i)?n.set(i,o):s(i,o)}}},Jk="!",BR=t=>{const{separator:e,experimentalParseClassName:n}=t,r=e.length===1,s=e[0],i=e.length,o=a=>{const l=[];let c=0,u=0,d;for(let b=0;b<a.length;b++){let x=a[b];if(c===0){if(x===s&&(r||a.slice(b,b+i)===e)){l.push(a.slice(u,b)),u=b+i;continue}if(x==="/"){d=b;continue}}x==="["?c++:x==="]"&&c--}const h=l.length===0?a:a.substring(u),p=h.startsWith(Jk),m=p?h.substring(1):h,g=d&&d>u?d-u:void 0;return{modifiers:l,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:g}};return n?a=>n({className:a,parseClassName:o}):o},$R=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(r=>{r[0]==="["?(e.push(...n.sort(),r),n=[]):n.push(r)}),e.push(...n.sort()),e},HR=t=>({cache:FR(t.cacheSize),parseClassName:BR(t),...DR(t)}),UR=/\s+/,VR=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s}=e,i=[],o=t.trim().split(UR);let a="";for(let l=o.length-1;l>=0;l-=1){const c=o[l],{modifiers:u,hasImportantModifier:d,baseClassName:h,maybePostfixModifierPosition:p}=n(c);let m=!!p,g=r(m?h.substring(0,p):h);if(!g){if(!m){a=c+(a.length>0?" "+a:a);continue}if(g=r(h),!g){a=c+(a.length>0?" "+a:a);continue}m=!1}const b=$R(u).join(":"),x=d?b+Jk:b,w=x+g;if(i.includes(w))continue;i.push(w);const v=s(g,m);for(let k=0;k<v.length;++k){const N=v[k];i.push(x+N)}a=c+(a.length>0?" "+a:a)}return a};function WR(){let t=0,e,n,r="";for(;t<arguments.length;)(e=arguments[t++])&&(n=Yk(e))&&(r&&(r+=" "),r+=n);return r}const Yk=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=Yk(t[r]))&&(n&&(n+=" "),n+=e);return n};function qR(t,...e){let n,r,s,i=o;function o(l){const c=e.reduce((u,d)=>d(u),t());return n=HR(c),r=n.cache.get,s=n.cache.set,i=a,a(l)}function a(l){const c=r(l);if(c)return c;const u=VR(l,n);return s(l,u),u}return function(){return i(WR.apply(null,arguments))}}const Tt=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},Zk=/^\[(?:([a-z-]+):)?(.+)\]$/i,KR=/^\d+\/\d+$/,GR=new Set(["px","full","screen"]),JR=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,YR=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ZR=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,XR=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,QR=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,cs=t=>sa(t)||GR.has(t)||KR.test(t),zs=t=>Va(t,"length",aO),sa=t=>!!t&&!Number.isNaN(Number(t)),kh=t=>Va(t,"number",sa),nl=t=>!!t&&Number.isInteger(Number(t)),eO=t=>t.endsWith("%")&&sa(t.slice(0,-1)),Ue=t=>Zk.test(t),Fs=t=>JR.test(t),tO=new Set(["length","size","percentage"]),nO=t=>Va(t,tO,Xk),rO=t=>Va(t,"position",Xk),sO=new Set(["image","url"]),iO=t=>Va(t,sO,cO),oO=t=>Va(t,"",lO),rl=()=>!0,Va=(t,e,n)=>{const r=Zk.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},aO=t=>YR.test(t)&&!ZR.test(t),Xk=()=>!1,lO=t=>XR.test(t),cO=t=>QR.test(t),uO=()=>{const t=Tt("colors"),e=Tt("spacing"),n=Tt("blur"),r=Tt("brightness"),s=Tt("borderColor"),i=Tt("borderRadius"),o=Tt("borderSpacing"),a=Tt("borderWidth"),l=Tt("contrast"),c=Tt("grayscale"),u=Tt("hueRotate"),d=Tt("invert"),h=Tt("gap"),p=Tt("gradientColorStops"),m=Tt("gradientColorStopPositions"),g=Tt("inset"),b=Tt("margin"),x=Tt("opacity"),w=Tt("padding"),v=Tt("saturate"),k=Tt("scale"),N=Tt("sepia"),S=Tt("skew"),C=Tt("space"),T=Tt("translate"),R=()=>["auto","contain","none"],_=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto",Ue,e],D=()=>[Ue,e],V=()=>["",cs,zs],j=()=>["auto",sa,Ue],L=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],q=()=>["solid","dashed","dotted","double","none"],re=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],X=()=>["start","end","center","between","around","evenly","stretch"],ce=()=>["","0",Ue],A=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ue=()=>[sa,Ue];return{cacheSize:500,separator:":",theme:{colors:[rl],spacing:[cs,zs],blur:["none","",Fs,Ue],brightness:ue(),borderColor:[t],borderRadius:["none","","full",Fs,Ue],borderSpacing:D(),borderWidth:V(),contrast:ue(),grayscale:ce(),hueRotate:ue(),invert:ce(),gap:D(),gradientColorStops:[t],gradientColorStopPositions:[eO,zs],inset:I(),margin:I(),opacity:ue(),padding:D(),saturate:ue(),scale:ue(),sepia:ce(),skew:ue(),space:D(),translate:D()},classGroups:{aspect:[{aspect:["auto","square","video",Ue]}],container:["container"],columns:[{columns:[Fs]}],"break-after":[{"break-after":A()}],"break-before":[{"break-before":A()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...L(),Ue]}],overflow:[{overflow:_()}],"overflow-x":[{"overflow-x":_()}],"overflow-y":[{"overflow-y":_()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",nl,Ue]}],basis:[{basis:I()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Ue]}],grow:[{grow:ce()}],shrink:[{shrink:ce()}],order:[{order:["first","last","none",nl,Ue]}],"grid-cols":[{"grid-cols":[rl]}],"col-start-end":[{col:["auto",{span:["full",nl,Ue]},Ue]}],"col-start":[{"col-start":j()}],"col-end":[{"col-end":j()}],"grid-rows":[{"grid-rows":[rl]}],"row-start-end":[{row:["auto",{span:[nl,Ue]},Ue]}],"row-start":[{"row-start":j()}],"row-end":[{"row-end":j()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Ue]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Ue]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...X()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...X(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...X(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[w]}],px:[{px:[w]}],py:[{py:[w]}],ps:[{ps:[w]}],pe:[{pe:[w]}],pt:[{pt:[w]}],pr:[{pr:[w]}],pb:[{pb:[w]}],pl:[{pl:[w]}],m:[{m:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],ms:[{ms:[b]}],me:[{me:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"space-x":[{"space-x":[C]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[C]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Ue,e]}],"min-w":[{"min-w":[Ue,e,"min","max","fit"]}],"max-w":[{"max-w":[Ue,e,"none","full","min","max","fit","prose",{screen:[Fs]},Fs]}],h:[{h:[Ue,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Ue,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Ue,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Ue,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Fs,zs]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",kh]}],"font-family":[{font:[rl]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Ue]}],"line-clamp":[{"line-clamp":["none",sa,kh]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",cs,Ue]}],"list-image":[{"list-image":["none",Ue]}],"list-style-type":[{list:["none","disc","decimal",Ue]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[x]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[x]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...q(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",cs,zs]}],"underline-offset":[{"underline-offset":["auto",cs,Ue]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:D()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ue]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ue]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[x]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...L(),rO]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",nO]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},iO]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[x]}],"border-style":[{border:[...q(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[x]}],"divide-style":[{divide:q()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...q()]}],"outline-offset":[{"outline-offset":[cs,Ue]}],"outline-w":[{outline:[cs,zs]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:V()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[x]}],"ring-offset-w":[{"ring-offset":[cs,zs]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Fs,oO]}],"shadow-color":[{shadow:[rl]}],opacity:[{opacity:[x]}],"mix-blend":[{"mix-blend":[...re(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":re()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Fs,Ue]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[v]}],sepia:[{sepia:[N]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[x]}],"backdrop-saturate":[{"backdrop-saturate":[v]}],"backdrop-sepia":[{"backdrop-sepia":[N]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Ue]}],duration:[{duration:ue()}],ease:[{ease:["linear","in","out","in-out",Ue]}],delay:[{delay:ue()}],animate:[{animate:["none","spin","ping","pulse","bounce",Ue]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[k]}],"scale-x":[{"scale-x":[k]}],"scale-y":[{"scale-y":[k]}],rotate:[{rotate:[nl,Ue]}],"translate-x":[{"translate-x":[T]}],"translate-y":[{"translate-y":[T]}],"skew-x":[{"skew-x":[S]}],"skew-y":[{"skew-y":[S]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Ue]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ue]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-mt":[{"scroll-mt":D()}],"scroll-mr":[{"scroll-mr":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-pe":[{"scroll-pe":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-pr":[{"scroll-pr":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ue]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[cs,zs,kh]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},dO=qR(uO);function _e(...t){return dO(Kk(t))}var fO=Symbol("radix.slottable");function hO(t){const e=({children:n})=>f.jsx(f.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=fO,e}var Qk=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),pO="VisuallyHidden",eS=y.forwardRef((t,e)=>f.jsx(yn.span,{...t,ref:e,style:{...Qk,...t.style}}));eS.displayName=pO;var mO=eS,[kf]=gf("Tooltip",[Fa]),Sf=Fa(),tS="TooltipProvider",gO=700,im="tooltip.open",[bO,Wg]=kf(tS),nS=t=>{const{__scopeTooltip:e,delayDuration:n=gO,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=t,o=y.useRef(!0),a=y.useRef(!1),l=y.useRef(0);return y.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),f.jsx(bO,{scope:e,isOpenDelayedRef:o,delayDuration:n,onOpen:y.useCallback(()=>{window.clearTimeout(l.current),o.current=!1},[]),onClose:y.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:a,onPointerInTransitChange:y.useCallback(c=>{a.current=c},[]),disableHoverableContent:s,children:i})};nS.displayName=tS;var Ul="Tooltip",[yO,kc]=kf(Ul),rS=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:s,onOpenChange:i,disableHoverableContent:o,delayDuration:a}=t,l=Wg(Ul,t.__scopeTooltip),c=Sf(e),[u,d]=y.useState(null),h=yc(),p=y.useRef(0),m=o??l.disableHoverableContent,g=a??l.delayDuration,b=y.useRef(!1),[x,w]=Gu({prop:r,defaultProp:s??!1,onChange:C=>{C?(l.onOpen(),document.dispatchEvent(new CustomEvent(im))):l.onClose(),i==null||i(C)},caller:Ul}),v=y.useMemo(()=>x?b.current?"delayed-open":"instant-open":"closed",[x]),k=y.useCallback(()=>{window.clearTimeout(p.current),p.current=0,b.current=!1,w(!0)},[w]),N=y.useCallback(()=>{window.clearTimeout(p.current),p.current=0,w(!1)},[w]),S=y.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{b.current=!0,w(!0),p.current=0},g)},[g,w]);return y.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),f.jsx(_g,{...c,children:f.jsx(yO,{scope:e,contentId:h,open:x,stateAttribute:v,trigger:u,onTriggerChange:d,onTriggerEnter:y.useCallback(()=>{l.isOpenDelayedRef.current?S():k()},[l.isOpenDelayedRef,S,k]),onTriggerLeave:y.useCallback(()=>{m?N():(window.clearTimeout(p.current),p.current=0)},[N,m]),onOpen:k,onClose:N,disableHoverableContent:m,children:n})})};rS.displayName=Ul;var om="TooltipTrigger",sS=y.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=kc(om,n),i=Wg(om,n),o=Sf(n),a=y.useRef(null),l=Tn(e,a,s.onTriggerChange),c=y.useRef(!1),u=y.useRef(!1),d=y.useCallback(()=>c.current=!1,[]);return y.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),f.jsx(yf,{asChild:!0,...o,children:f.jsx(yn.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:l,onPointerMove:dt(t.onPointerMove,h=>{h.pointerType!=="touch"&&!u.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),u.current=!0)}),onPointerLeave:dt(t.onPointerLeave,()=>{s.onTriggerLeave(),u.current=!1}),onPointerDown:dt(t.onPointerDown,()=>{s.open&&s.onClose(),c.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:dt(t.onFocus,()=>{c.current||s.onOpen()}),onBlur:dt(t.onBlur,s.onClose),onClick:dt(t.onClick,s.onClose)})})});sS.displayName=om;var qg="TooltipPortal",[xO,vO]=kf(qg,{forceMount:void 0}),iS=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:s}=t,i=kc(qg,e);return f.jsx(xO,{scope:e,forceMount:n,children:f.jsx(bf,{present:n||i.open,children:f.jsx(Eg,{asChild:!0,container:s,children:r})})})};iS.displayName=qg;var Na="TooltipContent",oS=y.forwardRef((t,e)=>{const n=vO(Na,t.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...i}=t,o=kc(Na,t.__scopeTooltip);return f.jsx(bf,{present:r||o.open,children:o.disableHoverableContent?f.jsx(aS,{side:s,...i,ref:e}):f.jsx(wO,{side:s,...i,ref:e})})}),wO=y.forwardRef((t,e)=>{const n=kc(Na,t.__scopeTooltip),r=Wg(Na,t.__scopeTooltip),s=y.useRef(null),i=Tn(e,s),[o,a]=y.useState(null),{trigger:l,onClose:c}=n,u=s.current,{onPointerInTransitChange:d}=r,h=y.useCallback(()=>{a(null),d(!1)},[d]),p=y.useCallback((m,g)=>{const b=m.currentTarget,x={x:m.clientX,y:m.clientY},w=NO(x,b.getBoundingClientRect()),v=_O(x,w),k=TO(g.getBoundingClientRect()),N=MO([...v,...k]);a(N),d(!0)},[d]);return y.useEffect(()=>()=>h(),[h]),y.useEffect(()=>{if(l&&u){const m=b=>p(b,u),g=b=>p(b,l);return l.addEventListener("pointerleave",m),u.addEventListener("pointerleave",g),()=>{l.removeEventListener("pointerleave",m),u.removeEventListener("pointerleave",g)}}},[l,u,p,h]),y.useEffect(()=>{if(o){const m=g=>{const b=g.target,x={x:g.clientX,y:g.clientY},w=(l==null?void 0:l.contains(b))||(u==null?void 0:u.contains(b)),v=!AO(x,o);w?h():v&&(h(),c())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[l,u,o,c,h]),f.jsx(aS,{...t,ref:i})}),[kO,SO]=kf(Ul,{isInside:!1}),EO=hO("TooltipContent"),aS=y.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:o,...a}=t,l=kc(Na,n),c=Sf(n),{onClose:u}=l;return y.useEffect(()=>(document.addEventListener(im,u),()=>document.removeEventListener(im,u)),[u]),y.useEffect(()=>{if(l.trigger){const d=h=>{const p=h.target;p!=null&&p.contains(l.trigger)&&u()};return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[l.trigger,u]),f.jsx(Cg,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:d=>d.preventDefault(),onDismiss:u,children:f.jsxs(Ng,{"data-state":l.stateAttribute,...c,...a,ref:e,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[f.jsx(EO,{children:r}),f.jsx(kO,{scope:n,isInside:!0,children:f.jsx(mO,{id:l.contentId,role:"tooltip",children:s||r})})]})})});oS.displayName=Na;var lS="TooltipArrow",CO=y.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=Sf(n);return SO(lS,n).isInside?null:f.jsx(Tg,{...s,...r,ref:e})});CO.displayName=lS;function NO(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),s=Math.abs(e.right-t.x),i=Math.abs(e.left-t.x);switch(Math.min(n,r,s,i)){case i:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function _O(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function TO(t){const{top:e,right:n,bottom:r,left:s}=t;return[{x:s,y:e},{x:n,y:e},{x:n,y:r},{x:s,y:r}]}function AO(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){const a=e[i],l=e[o],c=a.x,u=a.y,d=l.x,h=l.y;u>r!=h>r&&n<(d-c)*(r-u)/(h-u)+c&&(s=!s)}return s}function MO(t){const e=t.slice();return e.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),RO(e)}function RO(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r<t.length;r++){const s=t[r];for(;e.length>=2;){const i=e[e.length-1],o=e[e.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))e.pop();else break}e.push(s)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const s=t[r];for(;n.length>=2;){const i=n[n.length-1],o=n[n.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))n.pop();else break}n.push(s)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var OO=nS,IO=rS,DO=sS,LO=iS,cS=oS;const Ts=OO,Sn=IO,En=DO,gn=y.forwardRef(({className:t,sideOffset:e=4,...n},r)=>f.jsx(LO,{children:f.jsx(cS,{ref:r,sideOffset:e,className:_e("z-50 origin-[--radix-tooltip-content-transform-origin] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n})}));gn.displayName=cS.displayName;const Lo=yk,PO=xk,jO=bk,uS=y.forwardRef(({className:t,...e},n)=>f.jsx(Ag,{ref:n,"data-dialog-overlay":"true",className:_e("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));uS.displayName=Ag.displayName;const Ni=y.forwardRef(({className:t,children:e,...n},r)=>f.jsxs(jO,{children:[f.jsx(uS,{}),f.jsx(Mg,{ref:r,className:_e("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...n,children:e})]}));Ni.displayName=Mg.displayName;const _i=({className:t,...e})=>f.jsx("div",{className:_e("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});_i.displayName="DialogHeader";const Kg=({className:t,...e})=>f.jsx("div",{className:_e("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});Kg.displayName="DialogFooter";const Ti=y.forwardRef(({className:t,...e},n)=>f.jsx(Rg,{ref:n,className:_e("text-lg font-semibold leading-none tracking-tight",t),...e}));Ti.displayName=Rg.displayName;const Ef=y.forwardRef(({className:t,...e},n)=>f.jsx(Og,{ref:n,className:_e("text-sm text-muted-foreground",t),...e}));Ef.displayName=Og.displayName;function dS(t,e){return function(){return t.apply(e,arguments)}}const{toString:zO}=Object.prototype,{getPrototypeOf:Gg}=Object,{iterator:Cf,toStringTag:fS}=Symbol,Nf=(t=>e=>{const n=zO.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Fr=t=>(t=t.toLowerCase(),e=>Nf(e)===t),_f=t=>e=>typeof e===t,{isArray:Wa}=Array,_a=_f("undefined");function Sc(t){return t!==null&&!_a(t)&&t.constructor!==null&&!_a(t.constructor)&&Xn(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const hS=Fr("ArrayBuffer");function FO(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&hS(t.buffer),e}const BO=_f("string"),Xn=_f("function"),pS=_f("number"),Ec=t=>t!==null&&typeof t=="object",$O=t=>t===!0||t===!1,Du=t=>{if(Nf(t)!=="object")return!1;const e=Gg(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(fS in t)&&!(Cf in t)},HO=t=>{if(!Ec(t)||Sc(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},UO=Fr("Date"),VO=Fr("File"),WO=Fr("Blob"),qO=Fr("FileList"),KO=t=>Ec(t)&&Xn(t.pipe),GO=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Xn(t.append)&&((e=Nf(t))==="formdata"||e==="object"&&Xn(t.toString)&&t.toString()==="[object FormData]"))},JO=Fr("URLSearchParams"),[YO,ZO,XO,QO]=["ReadableStream","Request","Response","Headers"].map(Fr),eI=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Cc(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,s;if(typeof t!="object"&&(t=[t]),Wa(t))for(r=0,s=t.length;r<s;r++)e.call(null,t[r],r,t);else{if(Sc(t))return;const i=n?Object.getOwnPropertyNames(t):Object.keys(t),o=i.length;let a;for(r=0;r<o;r++)a=i[r],e.call(null,t[a],a,t)}}function mS(t,e){if(Sc(t))return null;e=e.toLowerCase();const n=Object.keys(t);let r=n.length,s;for(;r-- >0;)if(s=n[r],e===s.toLowerCase())return s;return null}const Ui=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,gS=t=>!_a(t)&&t!==Ui;function am(){const{caseless:t,skipUndefined:e}=gS(this)&&this||{},n={},r=(s,i)=>{const o=t&&mS(n,i)||i;Du(n[o])&&Du(s)?n[o]=am(n[o],s):Du(s)?n[o]=am({},s):Wa(s)?n[o]=s.slice():(!e||!_a(s))&&(n[o]=s)};for(let s=0,i=arguments.length;s<i;s++)arguments[s]&&Cc(arguments[s],r);return n}const tI=(t,e,n,{allOwnKeys:r}={})=>(Cc(e,(s,i)=>{n&&Xn(s)?t[i]=dS(s,n):t[i]=s},{allOwnKeys:r}),t),nI=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),rI=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},sI=(t,e,n,r)=>{let s,i,o;const a={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),i=s.length;i-- >0;)o=s[i],(!r||r(o,t,e))&&!a[o]&&(e[o]=t[o],a[o]=!0);t=n!==!1&&Gg(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},iI=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return r!==-1&&r===n},oI=t=>{if(!t)return null;if(Wa(t))return t;let e=t.length;if(!pS(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},aI=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Gg(Uint8Array)),lI=(t,e)=>{const r=(t&&t[Cf]).call(t);let s;for(;(s=r.next())&&!s.done;){const i=s.value;e.call(t,i[0],i[1])}},cI=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},uI=Fr("HTMLFormElement"),dI=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),sx=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),fI=Fr("RegExp"),bS=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};Cc(n,(s,i)=>{let o;(o=e(s,i,t))!==!1&&(r[i]=o||s)}),Object.defineProperties(t,r)},hI=t=>{bS(t,(e,n)=>{if(Xn(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(Xn(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},pI=(t,e)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return Wa(t)?r(t):r(String(t).split(e)),n},mI=()=>{},gI=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function bI(t){return!!(t&&Xn(t.append)&&t[fS]==="FormData"&&t[Cf])}const yI=t=>{const e=new Array(10),n=(r,s)=>{if(Ec(r)){if(e.indexOf(r)>=0)return;if(Sc(r))return r;if(!("toJSON"in r)){e[s]=r;const i=Wa(r)?[]:{};return Cc(r,(o,a)=>{const l=n(o,s+1);!_a(l)&&(i[a]=l)}),e[s]=void 0,i}}return r};return n(t,0)},xI=Fr("AsyncFunction"),vI=t=>t&&(Ec(t)||Xn(t))&&Xn(t.then)&&Xn(t.catch),yS=((t,e)=>t?setImmediate:e?((n,r)=>(Ui.addEventListener("message",({source:s,data:i})=>{s===Ui&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),Ui.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Xn(Ui.postMessage)),wI=typeof queueMicrotask<"u"?queueMicrotask.bind(Ui):typeof process<"u"&&process.nextTick||yS,kI=t=>t!=null&&Xn(t[Cf]),$={isArray:Wa,isArrayBuffer:hS,isBuffer:Sc,isFormData:GO,isArrayBufferView:FO,isString:BO,isNumber:pS,isBoolean:$O,isObject:Ec,isPlainObject:Du,isEmptyObject:HO,isReadableStream:YO,isRequest:ZO,isResponse:XO,isHeaders:QO,isUndefined:_a,isDate:UO,isFile:VO,isBlob:WO,isRegExp:fI,isFunction:Xn,isStream:KO,isURLSearchParams:JO,isTypedArray:aI,isFileList:qO,forEach:Cc,merge:am,extend:tI,trim:eI,stripBOM:nI,inherits:rI,toFlatObject:sI,kindOf:Nf,kindOfTest:Fr,endsWith:iI,toArray:oI,forEachEntry:lI,matchAll:cI,isHTMLForm:uI,hasOwnProperty:sx,hasOwnProp:sx,reduceDescriptors:bS,freezeMethods:hI,toObjectSet:pI,toCamelCase:dI,noop:mI,toFiniteNumber:gI,findKey:mS,global:Ui,isContextDefined:gS,isSpecCompliantForm:bI,toJSONObject:yI,isAsyncFn:xI,isThenable:vI,setImmediate:yS,asap:wI,isIterable:kI};function He(t,e,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}$.inherits(He,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:$.toJSONObject(this.config),code:this.code,status:this.status}}});const xS=He.prototype,vS={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{vS[t]={value:t}});Object.defineProperties(He,vS);Object.defineProperty(xS,"isAxiosError",{value:!0});He.from=(t,e,n,r,s,i)=>{const o=Object.create(xS);$.toFlatObject(t,o,function(u){return u!==Error.prototype},c=>c!=="isAxiosError");const a=t&&t.message?t.message:"Error",l=e==null&&t?t.code:e;return He.call(o,a,l,n,r,s),t&&o.cause==null&&Object.defineProperty(o,"cause",{value:t,configurable:!0}),o.name=t&&t.name||"Error",i&&Object.assign(o,i),o};const SI=null;function lm(t){return $.isPlainObject(t)||$.isArray(t)}function wS(t){return $.endsWith(t,"[]")?t.slice(0,-2):t}function ix(t,e,n){return t?t.concat(e).map(function(s,i){return s=wS(s),!n&&i?"["+s+"]":s}).join(n?".":""):e}function EI(t){return $.isArray(t)&&!t.some(lm)}const CI=$.toFlatObject($,{},null,function(e){return/^is[A-Z]/.test(e)});function Tf(t,e,n){if(!$.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=$.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(g,b){return!$.isUndefined(b[g])});const r=n.metaTokens,s=n.visitor||u,i=n.dots,o=n.indexes,l=(n.Blob||typeof Blob<"u"&&Blob)&&$.isSpecCompliantForm(e);if(!$.isFunction(s))throw new TypeError("visitor must be a function");function c(m){if(m===null)return"";if($.isDate(m))return m.toISOString();if($.isBoolean(m))return m.toString();if(!l&&$.isBlob(m))throw new He("Blob is not supported. Use a Buffer instead.");return $.isArrayBuffer(m)||$.isTypedArray(m)?l&&typeof Blob=="function"?new Blob([m]):Buffer.from(m):m}function u(m,g,b){let x=m;if(m&&!b&&typeof m=="object"){if($.endsWith(g,"{}"))g=r?g:g.slice(0,-2),m=JSON.stringify(m);else if($.isArray(m)&&EI(m)||($.isFileList(m)||$.endsWith(g,"[]"))&&(x=$.toArray(m)))return g=wS(g),x.forEach(function(v,k){!($.isUndefined(v)||v===null)&&e.append(o===!0?ix([g],k,i):o===null?g:g+"[]",c(v))}),!1}return lm(m)?!0:(e.append(ix(b,g,i),c(m)),!1)}const d=[],h=Object.assign(CI,{defaultVisitor:u,convertValue:c,isVisitable:lm});function p(m,g){if(!$.isUndefined(m)){if(d.indexOf(m)!==-1)throw Error("Circular reference detected in "+g.join("."));d.push(m),$.forEach(m,function(x,w){(!($.isUndefined(x)||x===null)&&s.call(e,x,$.isString(w)?w.trim():w,g,h))===!0&&p(x,g?g.concat(w):[w])}),d.pop()}}if(!$.isObject(t))throw new TypeError("data must be an object");return p(t),e}function ox(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function Jg(t,e){this._pairs=[],t&&Tf(t,this,e)}const kS=Jg.prototype;kS.append=function(e,n){this._pairs.push([e,n])};kS.toString=function(e){const n=e?function(r){return e.call(this,r,ox)}:ox;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function NI(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function SS(t,e,n){if(!e)return t;const r=n&&n.encode||NI;$.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(e,n):i=$.isURLSearchParams(e)?e.toString():new Jg(e,n).toString(r),i){const o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class ax{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){$.forEach(this.handlers,function(r){r!==null&&e(r)})}}const ES={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},_I=typeof URLSearchParams<"u"?URLSearchParams:Jg,TI=typeof FormData<"u"?FormData:null,AI=typeof Blob<"u"?Blob:null,MI={isBrowser:!0,classes:{URLSearchParams:_I,FormData:TI,Blob:AI},protocols:["http","https","file","blob","url","data"]},Yg=typeof window<"u"&&typeof document<"u",cm=typeof navigator=="object"&&navigator||void 0,RI=Yg&&(!cm||["ReactNative","NativeScript","NS"].indexOf(cm.product)<0),OI=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",II=Yg&&window.location.href||"http://localhost",DI=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Yg,hasStandardBrowserEnv:RI,hasStandardBrowserWebWorkerEnv:OI,navigator:cm,origin:II},Symbol.toStringTag,{value:"Module"})),kn={...DI,...MI};function LI(t,e){return Tf(t,new kn.classes.URLSearchParams,{visitor:function(n,r,s,i){return kn.isNode&&$.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}function PI(t){return $.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function jI(t){const e={},n=Object.keys(t);let r;const s=n.length;let i;for(r=0;r<s;r++)i=n[r],e[i]=t[i];return e}function CS(t){function e(n,r,s,i){let o=n[i++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),l=i>=n.length;return o=!o&&$.isArray(s)?s.length:o,l?($.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!a):((!s[o]||!$.isObject(s[o]))&&(s[o]=[]),e(n,r,s[o],i)&&$.isArray(s[o])&&(s[o]=jI(s[o])),!a)}if($.isFormData(t)&&$.isFunction(t.entries)){const n={};return $.forEachEntry(t,(r,s)=>{e(PI(r),s,n,0)}),n}return null}function zI(t,e,n){if($.isString(t))try{return(e||JSON.parse)(t),$.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const Nc={transitional:ES,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=$.isObject(e);if(i&&$.isHTMLForm(e)&&(e=new FormData(e)),$.isFormData(e))return s?JSON.stringify(CS(e)):e;if($.isArrayBuffer(e)||$.isBuffer(e)||$.isStream(e)||$.isFile(e)||$.isBlob(e)||$.isReadableStream(e))return e;if($.isArrayBufferView(e))return e.buffer;if($.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return LI(e,this.formSerializer).toString();if((a=$.isFileList(e))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return Tf(a?{"files[]":e}:e,l&&new l,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),zI(e)):e}],transformResponse:[function(e){const n=this.transitional||Nc.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if($.isResponse(e)||$.isReadableStream(e))return e;if(e&&$.isString(e)&&(r&&!this.responseType||s)){const o=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(a){if(o)throw a.name==="SyntaxError"?He.from(a,He.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:kn.classes.FormData,Blob:kn.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};$.forEach(["delete","get","head","post","put","patch"],t=>{Nc.headers[t]={}});const FI=$.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),BI=t=>{const e={};let n,r,s;return t&&t.split(`
292
- `).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!n||e[n]&&FI[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},lx=Symbol("internals");function sl(t){return t&&String(t).trim().toLowerCase()}function Lu(t){return t===!1||t==null?t:$.isArray(t)?t.map(Lu):String(t)}function $I(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}const HI=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Sh(t,e,n,r,s){if($.isFunction(r))return r.call(this,e,n);if(s&&(e=n),!!$.isString(e)){if($.isString(r))return e.indexOf(r)!==-1;if($.isRegExp(r))return r.test(e)}}function UI(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function VI(t,e){const n=$.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(s,i,o){return this[r].call(this,e,s,i,o)},configurable:!0})})}let Qn=class{constructor(e){e&&this.set(e)}set(e,n,r){const s=this;function i(a,l,c){const u=sl(l);if(!u)throw new Error("header name must be a non-empty string");const d=$.findKey(s,u);(!d||s[d]===void 0||c===!0||c===void 0&&s[d]!==!1)&&(s[d||l]=Lu(a))}const o=(a,l)=>$.forEach(a,(c,u)=>i(c,u,l));if($.isPlainObject(e)||e instanceof this.constructor)o(e,n);else if($.isString(e)&&(e=e.trim())&&!HI(e))o(BI(e),n);else if($.isObject(e)&&$.isIterable(e)){let a={},l,c;for(const u of e){if(!$.isArray(u))throw TypeError("Object iterator must return a key-value pair");a[c=u[0]]=(l=a[c])?$.isArray(l)?[...l,u[1]]:[l,u[1]]:u[1]}o(a,n)}else e!=null&&i(n,e,r);return this}get(e,n){if(e=sl(e),e){const r=$.findKey(this,e);if(r){const s=this[r];if(!n)return s;if(n===!0)return $I(s);if($.isFunction(n))return n.call(this,s,r);if($.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=sl(e),e){const r=$.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||Sh(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let s=!1;function i(o){if(o=sl(o),o){const a=$.findKey(r,o);a&&(!n||Sh(r,r[a],a,n))&&(delete r[a],s=!0)}}return $.isArray(e)?e.forEach(i):i(e),s}clear(e){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!e||Sh(this,this[i],i,e,!0))&&(delete this[i],s=!0)}return s}normalize(e){const n=this,r={};return $.forEach(this,(s,i)=>{const o=$.findKey(r,i);if(o){n[o]=Lu(s),delete n[i];return}const a=e?UI(i):String(i).trim();a!==i&&delete n[i],n[a]=Lu(s),r[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return $.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=e&&$.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(`
293
- `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const r=new this(e);return n.forEach(s=>r.set(s)),r}static accessor(e){const r=(this[lx]=this[lx]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=sl(o);r[a]||(VI(s,o),r[a]=!0)}return $.isArray(e)?e.forEach(i):i(e),this}};Qn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);$.reduceDescriptors(Qn.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});$.freezeMethods(Qn);function Eh(t,e){const n=this||Nc,r=e||n,s=Qn.from(r.headers);let i=r.data;return $.forEach(t,function(a){i=a.call(n,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function NS(t){return!!(t&&t.__CANCEL__)}function qa(t,e,n){He.call(this,t??"canceled",He.ERR_CANCELED,e,n),this.name="CanceledError"}$.inherits(qa,He,{__CANCEL__:!0});function _S(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new He("Request failed with status code "+n.status,[He.ERR_BAD_REQUEST,He.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function WI(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function qI(t,e){t=t||10;const n=new Array(t),r=new Array(t);let s=0,i=0,o;return e=e!==void 0?e:1e3,function(l){const c=Date.now(),u=r[i];o||(o=c),n[s]=l,r[s]=c;let d=i,h=0;for(;d!==s;)h+=n[d++],d=d%t;if(s=(s+1)%t,s===i&&(i=(i+1)%t),c-o<e)return;const p=u&&c-u;return p?Math.round(h*1e3/p):void 0}}function KI(t,e){let n=0,r=1e3/e,s,i;const o=(c,u=Date.now())=>{n=u,s=null,i&&(clearTimeout(i),i=null),t(...c)};return[(...c)=>{const u=Date.now(),d=u-n;d>=r?o(c,u):(s=c,i||(i=setTimeout(()=>{i=null,o(s)},r-d)))},()=>s&&o(s)]}const Zu=(t,e,n=3)=>{let r=0;const s=qI(50,250);return KI(i=>{const o=i.loaded,a=i.lengthComputable?i.total:void 0,l=o-r,c=s(l),u=o<=a;r=o;const d={loaded:o,total:a,progress:a?o/a:void 0,bytes:l,rate:c||void 0,estimated:c&&a&&u?(a-o)/c:void 0,event:i,lengthComputable:a!=null,[e?"download":"upload"]:!0};t(d)},n)},cx=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},ux=t=>(...e)=>$.asap(()=>t(...e)),GI=kn.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,kn.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(kn.origin),kn.navigator&&/(msie|trident)/i.test(kn.navigator.userAgent)):()=>!0,JI=kn.hasStandardBrowserEnv?{write(t,e,n,r,s,i,o){if(typeof document>"u")return;const a=[`${t}=${encodeURIComponent(e)}`];$.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),$.isString(r)&&a.push(`path=${r}`),$.isString(s)&&a.push(`domain=${s}`),i===!0&&a.push("secure"),$.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function YI(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function ZI(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function TS(t,e,n){let r=!YI(e);return t&&(r||n==!1)?ZI(t,e):e}const dx=t=>t instanceof Qn?{...t}:t;function yo(t,e){e=e||{};const n={};function r(c,u,d,h){return $.isPlainObject(c)&&$.isPlainObject(u)?$.merge.call({caseless:h},c,u):$.isPlainObject(u)?$.merge({},u):$.isArray(u)?u.slice():u}function s(c,u,d,h){if($.isUndefined(u)){if(!$.isUndefined(c))return r(void 0,c,d,h)}else return r(c,u,d,h)}function i(c,u){if(!$.isUndefined(u))return r(void 0,u)}function o(c,u){if($.isUndefined(u)){if(!$.isUndefined(c))return r(void 0,c)}else return r(void 0,u)}function a(c,u,d){if(d in e)return r(c,u);if(d in t)return r(void 0,c)}const l={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(c,u,d)=>s(dx(c),dx(u),d,!0)};return $.forEach(Object.keys({...t,...e}),function(u){const d=l[u]||s,h=d(t[u],e[u],u);$.isUndefined(h)&&d!==a||(n[u]=h)}),n}const AS=t=>{const e=yo({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:a}=e;if(e.headers=o=Qn.from(o),e.url=SS(TS(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),$.isFormData(n)){if(kn.hasStandardBrowserEnv||kn.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if($.isFunction(n.getHeaders)){const l=n.getHeaders(),c=["content-type","content-length"];Object.entries(l).forEach(([u,d])=>{c.includes(u.toLowerCase())&&o.set(u,d)})}}if(kn.hasStandardBrowserEnv&&(r&&$.isFunction(r)&&(r=r(e)),r||r!==!1&&GI(e.url))){const l=s&&i&&JI.read(i);l&&o.set(s,l)}return e},XI=typeof XMLHttpRequest<"u",QI=XI&&function(t){return new Promise(function(n,r){const s=AS(t);let i=s.data;const o=Qn.from(s.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:c}=s,u,d,h,p,m;function g(){p&&p(),m&&m(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let b=new XMLHttpRequest;b.open(s.method.toUpperCase(),s.url,!0),b.timeout=s.timeout;function x(){if(!b)return;const v=Qn.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),N={data:!a||a==="text"||a==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:v,config:t,request:b};_S(function(C){n(C),g()},function(C){r(C),g()},N),b=null}"onloadend"in b?b.onloadend=x:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(x)},b.onabort=function(){b&&(r(new He("Request aborted",He.ECONNABORTED,t,b)),b=null)},b.onerror=function(k){const N=k&&k.message?k.message:"Network Error",S=new He(N,He.ERR_NETWORK,t,b);S.event=k||null,r(S),b=null},b.ontimeout=function(){let k=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const N=s.transitional||ES;s.timeoutErrorMessage&&(k=s.timeoutErrorMessage),r(new He(k,N.clarifyTimeoutError?He.ETIMEDOUT:He.ECONNABORTED,t,b)),b=null},i===void 0&&o.setContentType(null),"setRequestHeader"in b&&$.forEach(o.toJSON(),function(k,N){b.setRequestHeader(N,k)}),$.isUndefined(s.withCredentials)||(b.withCredentials=!!s.withCredentials),a&&a!=="json"&&(b.responseType=s.responseType),c&&([h,m]=Zu(c,!0),b.addEventListener("progress",h)),l&&b.upload&&([d,p]=Zu(l),b.upload.addEventListener("progress",d),b.upload.addEventListener("loadend",p)),(s.cancelToken||s.signal)&&(u=v=>{b&&(r(!v||v.type?new qa(null,t,b):v),b.abort(),b=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const w=WI(s.url);if(w&&kn.protocols.indexOf(w)===-1){r(new He("Unsupported protocol "+w+":",He.ERR_BAD_REQUEST,t));return}b.send(i||null)})},eD=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,s;const i=function(c){if(!s){s=!0,a();const u=c instanceof Error?c:this.reason;r.abort(u instanceof He?u:new qa(u instanceof Error?u.message:u))}};let o=e&&setTimeout(()=>{o=null,i(new He(`timeout ${e} of ms exceeded`,He.ETIMEDOUT))},e);const a=()=>{t&&(o&&clearTimeout(o),o=null,t.forEach(c=>{c.unsubscribe?c.unsubscribe(i):c.removeEventListener("abort",i)}),t=null)};t.forEach(c=>c.addEventListener("abort",i));const{signal:l}=r;return l.unsubscribe=()=>$.asap(a),l}},tD=function*(t,e){let n=t.byteLength;if(n<e){yield t;return}let r=0,s;for(;r<n;)s=r+e,yield t.slice(r,s),r=s},nD=async function*(t,e){for await(const n of rD(t))yield*tD(n,e)},rD=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:n,value:r}=await e.read();if(n)break;yield r}}finally{await e.cancel()}},fx=(t,e,n,r)=>{const s=nD(t,e);let i=0,o,a=l=>{o||(o=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:c,value:u}=await s.next();if(c){a(),l.close();return}let d=u.byteLength;if(n){let h=i+=d;n(h)}l.enqueue(new Uint8Array(u))}catch(c){throw a(c),c}},cancel(l){return a(l),s.return()}},{highWaterMark:2})},hx=64*1024,{isFunction:su}=$,sD=(({Request:t,Response:e})=>({Request:t,Response:e}))($.global),{ReadableStream:px,TextEncoder:mx}=$.global,gx=(t,...e)=>{try{return!!t(...e)}catch{return!1}},iD=t=>{t=$.merge.call({skipUndefined:!0},sD,t);const{fetch:e,Request:n,Response:r}=t,s=e?su(e):typeof fetch=="function",i=su(n),o=su(r);if(!s)return!1;const a=s&&su(px),l=s&&(typeof mx=="function"?(m=>g=>m.encode(g))(new mx):async m=>new Uint8Array(await new n(m).arrayBuffer())),c=i&&a&&gx(()=>{let m=!1;const g=new n(kn.origin,{body:new px,method:"POST",get duplex(){return m=!0,"half"}}).headers.has("Content-Type");return m&&!g}),u=o&&a&&gx(()=>$.isReadableStream(new r("").body)),d={stream:u&&(m=>m.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(m=>{!d[m]&&(d[m]=(g,b)=>{let x=g&&g[m];if(x)return x.call(g);throw new He(`Response type '${m}' is not supported`,He.ERR_NOT_SUPPORT,b)})});const h=async m=>{if(m==null)return 0;if($.isBlob(m))return m.size;if($.isSpecCompliantForm(m))return(await new n(kn.origin,{method:"POST",body:m}).arrayBuffer()).byteLength;if($.isArrayBufferView(m)||$.isArrayBuffer(m))return m.byteLength;if($.isURLSearchParams(m)&&(m=m+""),$.isString(m))return(await l(m)).byteLength},p=async(m,g)=>{const b=$.toFiniteNumber(m.getContentLength());return b??h(g)};return async m=>{let{url:g,method:b,data:x,signal:w,cancelToken:v,timeout:k,onDownloadProgress:N,onUploadProgress:S,responseType:C,headers:T,withCredentials:R="same-origin",fetchOptions:_}=AS(m),I=e||fetch;C=C?(C+"").toLowerCase():"text";let D=eD([w,v&&v.toAbortSignal()],k),V=null;const j=D&&D.unsubscribe&&(()=>{D.unsubscribe()});let L;try{if(S&&c&&b!=="get"&&b!=="head"&&(L=await p(T,x))!==0){let ue=new n(g,{method:"POST",body:x,duplex:"half"}),be;if($.isFormData(x)&&(be=ue.headers.get("content-type"))&&T.setContentType(be),ue.body){const[E,P]=cx(L,Zu(ux(S)));x=fx(ue.body,hx,E,P)}}$.isString(R)||(R=R?"include":"omit");const q=i&&"credentials"in n.prototype,re={..._,signal:D,method:b.toUpperCase(),headers:T.normalize().toJSON(),body:x,duplex:"half",credentials:q?R:void 0};V=i&&new n(g,re);let X=await(i?I(V,_):I(g,re));const ce=u&&(C==="stream"||C==="response");if(u&&(N||ce&&j)){const ue={};["status","statusText","headers"].forEach(z=>{ue[z]=X[z]});const be=$.toFiniteNumber(X.headers.get("content-length")),[E,P]=N&&cx(be,Zu(ux(N),!0))||[];X=new r(fx(X.body,hx,E,()=>{P&&P(),j&&j()}),ue)}C=C||"text";let A=await d[$.findKey(d,C)||"text"](X,m);return!ce&&j&&j(),await new Promise((ue,be)=>{_S(ue,be,{data:A,headers:Qn.from(X.headers),status:X.status,statusText:X.statusText,config:m,request:V})})}catch(q){throw j&&j(),q&&q.name==="TypeError"&&/Load failed|fetch/i.test(q.message)?Object.assign(new He("Network Error",He.ERR_NETWORK,m,V),{cause:q.cause||q}):He.from(q,q&&q.code,m,V)}}},oD=new Map,MS=t=>{let e=t&&t.env||{};const{fetch:n,Request:r,Response:s}=e,i=[r,s,n];let o=i.length,a=o,l,c,u=oD;for(;a--;)l=i[a],c=u.get(l),c===void 0&&u.set(l,c=a?new Map:iD(e)),u=c;return c};MS();const Zg={http:SI,xhr:QI,fetch:{get:MS}};$.forEach(Zg,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const bx=t=>`- ${t}`,aD=t=>$.isFunction(t)||t===null||t===!1;function lD(t,e){t=$.isArray(t)?t:[t];const{length:n}=t;let r,s;const i={};for(let o=0;o<n;o++){r=t[o];let a;if(s=r,!aD(r)&&(s=Zg[(a=String(r)).toLowerCase()],s===void 0))throw new He(`Unknown adapter '${a}'`);if(s&&($.isFunction(s)||(s=s.get(e))))break;i[a||"#"+o]=s}if(!s){const o=Object.entries(i).map(([l,c])=>`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let a=n?o.length>1?`since :
294
- `+o.map(bx).join(`
295
- `):" "+bx(o[0]):"as no adapter specified";throw new He("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s}const RS={getAdapter:lD,adapters:Zg};function Ch(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new qa(null,t)}function yx(t){return Ch(t),t.headers=Qn.from(t.headers),t.data=Eh.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),RS.getAdapter(t.adapter||Nc.adapter,t)(t).then(function(r){return Ch(t),r.data=Eh.call(t,t.transformResponse,r),r.headers=Qn.from(r.headers),r},function(r){return NS(r)||(Ch(t),r&&r.response&&(r.response.data=Eh.call(t,t.transformResponse,r.response),r.response.headers=Qn.from(r.response.headers))),Promise.reject(r)})}const OS="1.13.2",Af={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Af[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const xx={};Af.transitional=function(e,n,r){function s(i,o){return"[Axios v"+OS+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,a)=>{if(e===!1)throw new He(s(o," has been removed"+(n?" in "+n:"")),He.ERR_DEPRECATED);return n&&!xx[o]&&(xx[o]=!0,console.warn(s(o," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(i,o,a):!0}};Af.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function cD(t,e,n){if(typeof t!="object")throw new He("options must be an object",He.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let s=r.length;for(;s-- >0;){const i=r[s],o=e[i];if(o){const a=t[i],l=a===void 0||o(a,i,t);if(l!==!0)throw new He("option "+i+" must be "+l,He.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new He("Unknown option "+i,He.ERR_BAD_OPTION)}}const Pu={assertOptions:cD,validators:Af},Ur=Pu.validators;let so=class{constructor(e){this.defaults=e||{},this.interceptors={request:new ax,response:new ax}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=`
296
- `+i):r.stack=i}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=yo(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&Pu.assertOptions(r,{silentJSONParsing:Ur.transitional(Ur.boolean),forcedJSONParsing:Ur.transitional(Ur.boolean),clarifyTimeoutError:Ur.transitional(Ur.boolean)},!1),s!=null&&($.isFunction(s)?n.paramsSerializer={serialize:s}:Pu.assertOptions(s,{encode:Ur.function,serialize:Ur.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Pu.assertOptions(n,{baseUrl:Ur.spelling("baseURL"),withXsrfToken:Ur.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&$.merge(i.common,i[n.method]);i&&$.forEach(["delete","get","head","post","put","patch","common"],m=>{delete i[m]}),n.headers=Qn.concat(o,i);const a=[];let l=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(n)===!1||(l=l&&g.synchronous,a.unshift(g.fulfilled,g.rejected))});const c=[];this.interceptors.response.forEach(function(g){c.push(g.fulfilled,g.rejected)});let u,d=0,h;if(!l){const m=[yx.bind(this),void 0];for(m.unshift(...a),m.push(...c),h=m.length,u=Promise.resolve(n);d<h;)u=u.then(m[d++],m[d++]);return u}h=a.length;let p=n;for(;d<h;){const m=a[d++],g=a[d++];try{p=m(p)}catch(b){g.call(this,b);break}}try{u=yx.call(this,p)}catch(m){return Promise.reject(m)}for(d=0,h=c.length;d<h;)u=u.then(c[d++],c[d++]);return u}getUri(e){e=yo(this.defaults,e);const n=TS(e.baseURL,e.url,e.allowAbsoluteUrls);return SS(n,e.params,e.paramsSerializer)}};$.forEach(["delete","get","head","options"],function(e){so.prototype[e]=function(n,r){return this.request(yo(r||{},{method:e,url:n,data:(r||{}).data}))}});$.forEach(["post","put","patch"],function(e){function n(r){return function(i,o,a){return this.request(yo(a||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}so.prototype[e]=n(),so.prototype[e+"Form"]=n(!0)});let uD=class IS{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(s=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(a=>{r.subscribe(a),i=a}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},e(function(i,o,a){r.reason||(r.reason=new qa(i,o,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new IS(function(s){e=s}),cancel:e}}};function dD(t){return function(n){return t.apply(null,n)}}function fD(t){return $.isObject(t)&&t.isAxiosError===!0}const um={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(um).forEach(([t,e])=>{um[e]=t});function DS(t){const e=new so(t),n=dS(so.prototype.request,e);return $.extend(n,so.prototype,e,{allOwnKeys:!0}),$.extend(n,e,null,{allOwnKeys:!0}),n.create=function(s){return DS(yo(t,s))},n}const It=DS(Nc);It.Axios=so;It.CanceledError=qa;It.CancelToken=uD;It.isCancel=NS;It.VERSION=OS;It.toFormData=Tf;It.AxiosError=He;It.Cancel=It.CanceledError;It.all=function(e){return Promise.all(e)};It.spread=dD;It.isAxiosError=fD;It.mergeConfig=yo;It.AxiosHeaders=Qn;It.formToJSON=t=>CS($.isHTMLForm(t)?new FormData(t):t);It.getAdapter=RS.getAdapter;It.HttpStatusCode=um;It.default=It;const{Axios:pZ,AxiosError:mZ,CanceledError:gZ,isCancel:bZ,CancelToken:yZ,VERSION:xZ,all:vZ,Cancel:wZ,isAxiosError:kZ,spread:SZ,toFormData:EZ,AxiosHeaders:CZ,HttpStatusCode:NZ,formToJSON:_Z,getAdapter:TZ,mergeConfig:AZ}=It;function hD({isOpen:t,onClose:e}){const{theme:n,setTheme:r}=eR(),[s,i]=y.useState(null),o=()=>{r(n==="dark"?"light":"dark")};return y.useEffect(()=>{t&&(async()=>{try{const l=await It.get("/api/version");i(l.data)}catch(l){console.error("Failed to fetch version information:",l)}})()},[t]),f.jsx(Lo,{open:t,onOpenChange:e,children:f.jsxs(Ni,{className:"max-w-md",children:[f.jsx(_i,{children:f.jsx(Ti,{children:"Settings"})}),f.jsxs("div",{className:"space-y-6 py-4",children:[f.jsxs("div",{className:"space-y-3",children:[f.jsx("h3",{className:"text-sm font-medium text-foreground",children:"Appearance"}),f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("span",{className:"text-sm text-muted-foreground",children:"Theme"}),f.jsx("button",{onClick:o,className:_e("flex items-center gap-2 rounded-lg px-3 py-2 text-sm font-medium transition-colors","bg-accent text-foreground hover:bg-accent/80"),children:n==="dark"?f.jsxs(f.Fragment,{children:[f.jsx(MR,{className:"h-4 w-4"}),f.jsx("span",{children:"Light Mode"})]}):f.jsxs(f.Fragment,{children:[f.jsx(CR,{className:"h-4 w-4"}),f.jsx("span",{children:"Dark Mode"})]})})]})]}),f.jsxs("div",{className:"space-y-3",children:[f.jsx("h3",{className:"text-sm font-medium text-foreground",children:"Version"}),f.jsxs("div",{className:"space-y-2",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("span",{className:"text-sm text-muted-foreground",children:"CLI"}),f.jsx("span",{className:"text-sm text-foreground font-mono",children:(s==null?void 0:s.cli)??"Loading..."})]}),f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("span",{className:"text-sm text-muted-foreground",children:"Server"}),f.jsx("span",{className:"text-sm text-foreground font-mono",children:(s==null?void 0:s.server)??"Loading..."})]}),f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("span",{className:"text-sm text-muted-foreground",children:"Frontend"}),f.jsx("span",{className:"text-sm text-foreground font-mono",children:(s==null?void 0:s.frontend)??"Loading..."})]})]})]})]})]})})}function pD({isOpen:t,onClose:e}){const n=[{title:"Docs",description:"Learn how to use sudocode",url:"https://docs.sudocode.ai",icon:Os},{title:"GitHub Issues",description:"Report bugs or request features",url:"https://github.com/sudocode-ai/sudocode/issues",icon:fR},{title:"Discord Community",description:"Join our community for help and discussion",url:"https://discord.gg/T3kR4EzQ6V",icon:SR}];return f.jsx(Lo,{open:t,onOpenChange:e,children:f.jsxs(Ni,{className:"max-w-md",children:[f.jsx(_i,{children:f.jsx(Ti,{children:"Resources"})}),f.jsx("div",{className:"space-y-3 py-4",children:n.map(r=>{const s=r.icon;return f.jsxs("a",{href:r.url,target:"_blank",rel:"noopener noreferrer",className:_e("flex items-start gap-3 rounded-lg border border-border p-4 transition-colors","hover:border-accent-foreground/20 hover:bg-accent"),children:[f.jsx(s,{className:"h-5 w-5 flex-shrink-0 text-muted-foreground"}),f.jsxs("div",{className:"min-w-0 flex-1",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("h3",{className:"text-sm font-medium text-foreground",children:r.title}),f.jsx(dR,{className:"h-3 w-3 text-muted-foreground"})]}),f.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:r.description})]})]},r.url)})})]})})}function mD({open:t,collapsed:e,onClose:n}){const r=cM(),[s,i]=y.useState(!1),[o,a]=y.useState(!1),l=u=>r.pathname.startsWith(u),c=[{path:"/issues",label:"Issues",icon:vR},{path:"/specs",label:"Specs",icon:Os}];return f.jsxs(Ts,{delayDuration:300,children:[t&&f.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 md:hidden",onClick:n,"aria-hidden":"true"}),f.jsxs("aside",{className:_e("fixed inset-y-0 left-0 z-50 flex flex-col border-r border-border bg-background transition-all duration-300 md:sticky md:top-0 md:z-30 md:h-screen md:translate-x-0",t?"translate-x-0":"-translate-x-full",e?"w-16":"w-64"),children:[f.jsx("div",{className:"hidden h-16 items-center justify-center md:flex",children:f.jsx("img",{src:"/logo.png",alt:"Logo",className:_e("h-10 w-10 rounded-md transition-all duration-300")})}),f.jsxs("div",{className:"flex h-16 items-center justify-between border-b border-border px-4 md:hidden",children:[f.jsx("img",{src:"/logo.png",alt:"Logo",className:"h-8 w-8 rounded-md"}),f.jsx("button",{onClick:n,className:"rounded-md p-2 text-muted-foreground hover:bg-accent hover:text-foreground","aria-label":"Close menu",children:f.jsx(Sl,{className:"h-5 w-5"})})]}),f.jsx("nav",{className:_e("flex-1 space-y-1 p-2",e?"px-2":"px-3"),children:c.map(u=>{const d=u.icon,h=l(u.path),p=f.jsxs(Dg,{to:u.path,onClick:n,className:_e("flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition-colors",h?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground",e&&"justify-center px-2"),children:[f.jsx(d,{className:"h-5 w-5 flex-shrink-0"+(h?" text-white":"")}),!e&&f.jsx("span",{children:u.label})]},u.path);return e?f.jsxs(Sn,{children:[f.jsx(En,{asChild:!0,children:p}),f.jsx(gn,{side:"right",children:u.label})]},u.path):p})}),f.jsx("div",{children:f.jsxs("div",{className:_e("space-y-1 p-2",e?"px-2":"px-3"),children:[e?f.jsxs(Sn,{children:[f.jsx(En,{asChild:!0,children:f.jsx("button",{onClick:()=>a(!0),className:_e("flex w-full items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",e&&"justify-center px-2"),"aria-label":"Help",children:f.jsx(ex,{className:"h-5 w-5 flex-shrink-0"})})}),f.jsx(gn,{side:"right",children:"Help"})]}):f.jsxs("button",{onClick:()=>a(!0),className:_e("flex w-full items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"),"aria-label":"Help",children:[f.jsx(ex,{className:"h-5 w-5 flex-shrink-0"}),f.jsx("span",{children:"Help"})]}),e?f.jsxs(Sn,{children:[f.jsx(En,{asChild:!0,children:f.jsx("button",{onClick:()=>i(!0),className:_e("flex w-full items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",e&&"justify-center px-2"),"aria-label":"Settings",children:f.jsx(rm,{className:"h-5 w-5 flex-shrink-0"})})}),f.jsx(gn,{side:"right",children:"Settings"})]}):f.jsxs("button",{onClick:()=>i(!0),className:_e("flex w-full items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"),"aria-label":"Settings",children:[f.jsx(rm,{className:"h-5 w-5 flex-shrink-0"}),f.jsx("span",{children:"Settings"})]})]})})]}),f.jsx(pD,{isOpen:o,onClose:()=>a(!1)}),f.jsx(hD,{isOpen:s,onClose:()=>i(!1)})]})}function gD(){const[t,e]=y.useState(!1);return f.jsxs("div",{className:"flex h-screen overflow-hidden bg-background",children:[!t&&f.jsx("button",{onClick:()=>e(!0),className:"fixed left-4 top-4 z-40 inline-flex rounded-md bg-background p-2 text-muted-foreground shadow-lg ring-1 ring-border hover:bg-accent hover:text-foreground md:hidden","aria-label":"Toggle menu",children:f.jsx(kR,{className:"h-5 w-5"})}),f.jsx(mD,{open:t,collapsed:!0,onClose:()=>e(!1)}),f.jsx("main",{className:"flex-1 overflow-y-auto",children:f.jsx(uM,{})})]})}const _c=It.create({baseURL:"/api",timeout:3e4,headers:{"Content-Type":"application/json"}});_c.interceptors.response.use(t=>{const e=t.data;if(!e.success){const n=new Error(e.message||"API request failed");throw n.response={data:e.error_data,status:t.status},n}return e.data},t=>{if(console.error("API Error:",t),!t.response)throw new Error("Network error: Please check your connection");const e=t.response.status;throw e===404?new Error("Resource not found"):e===500?new Error("Server error: Please try again later"):t});const Er=t=>_c.get(t),io=(t,e)=>_c.post(t,e),Xg=(t,e)=>_c.put(t,e),Ta=(t,e)=>_c.delete(t,e?{data:e}:void 0),Vi={getAll:t=>{const e=t!==void 0?`?archived=${t}`:"";return Er(`/issues${e}`)},getById:t=>Er(`/issues/${t}`),create:t=>io("/issues",t),update:(t,e)=>Xg(`/issues/${t}`,e),delete:t=>Ta(`/issues/${t}`),getFeedback:t=>Er(`/feedback?to_id=${t}`)},ea={getAll:t=>{const e=t!==void 0?`?archived=${t}`:"";return Er(`/specs${e}`)},getById:t=>Er(`/specs/${t}`),create:t=>io("/specs",t),update:(t,e)=>Xg(`/specs/${t}`,e),delete:t=>Ta(`/specs/${t}`),getFeedback:t=>Er(`/feedback?to_id=${t}`)},ia={getForEntity:(t,e)=>Er(`/relationships/${e}/${t}`),create:t=>io("/relationships",t),delete:t=>Ta("/relationships",t)},Nh={getForSpec:t=>Er(`/feedback?spec_id=${t}`),getById:t=>Er(`/feedback/${t}`),create:t=>io("/feedback",t),update:(t,e)=>Xg(`/feedback/${t}`,e),delete:t=>Ta(`/feedback/${t}`)},gr={prepare:(t,e)=>io(`/issues/${t}/executions/prepare`,e),create:(t,e)=>io(`/issues/${t}/executions`,e),getById:t=>Er(`/executions/${t}`),list:t=>Er(`/issues/${t}/executions`),createFollowUp:(t,e)=>io(`/executions/${t}/follow-up`,e),cancel:t=>Ta(`/executions/${t}`),worktreeExists:t=>Er(`/executions/${t}/worktree`),deleteWorktree:t=>Ta(`/executions/${t}/worktree`)},bD={getInfo:()=>It.get("/api/repo-info").then(t=>t.data)};function Tc(t){const e=ts(),{connected:n,subscribe:r,unsubscribe:s,addMessageHandler:i,removeMessageHandler:o}=$a(),a=Io({queryKey:t!==void 0?["issues",{archived:t}]:["issues"],queryFn:()=>Vi.getAll(t)}),l=y.useCallback(m=>{(m.type==="issue_created"||m.type==="issue_updated"||m.type==="issue_deleted")&&e.invalidateQueries({queryKey:["issues"]})},[e]);y.useEffect(()=>{const m="useIssues";return i(m,l),n&&r("issue"),()=>{o(m),s("issue")}},[n,r,s,i,o,l]);const c=Sr({mutationFn:({id:m,data:g})=>Vi.update(m,g),onMutate:async({id:m,data:g})=>{await e.cancelQueries({queryKey:["issues"]});const b=e.getQueryData(["issues"]);return e.setQueryData(["issues"],x=>x==null?void 0:x.map(w=>w.id===m?{...w,...g}:w)),{previousIssues:b}},onError:(m,g,b)=>{b!=null&&b.previousIssues&&e.setQueryData(["issues"],b.previousIssues)},onSettled:()=>{e.invalidateQueries({queryKey:["issues"]})}}),u=Sr({mutationFn:Vi.create,onSuccess:()=>{e.invalidateQueries({queryKey:["issues"]})}}),d=Sr({mutationFn:Vi.delete,onSuccess:()=>{e.invalidateQueries({queryKey:["issues"]})}}),h=m=>c.mutate({id:m,data:{archived:!0}}),p=m=>c.mutate({id:m,data:{archived:!1}});return{issues:a.data??[],isLoading:a.isLoading,isError:a.isError,error:a.error,updateIssue:c.mutate,updateIssueAsync:c.mutateAsync,createIssue:u.mutate,createIssueAsync:u.mutateAsync,deleteIssue:d.mutate,deleteIssueAsync:d.mutateAsync,archiveIssue:h,unarchiveIssue:p,isUpdating:c.isPending,isCreating:u.isPending,isDeleting:d.isPending}}function yD(t){return Io({queryKey:["issues",t],queryFn:()=>Vi.getById(t),enabled:!!t})}function xD(){const t=ts();return Sr({mutationFn:({id:e,status:n})=>Vi.update(e,{status:n}),onMutate:async({id:e,status:n})=>{await t.cancelQueries({queryKey:["issues"]});const r=t.getQueryData(["issues"]);return t.setQueryData(["issues"],s=>s==null?void 0:s.map(i=>i.id===e?{...i,status:n}:i)),{previousIssues:r}},onError:(e,n,r)=>{r!=null&&r.previousIssues&&t.setQueryData(["issues"],r.previousIssues)},onSettled:()=>{t.invalidateQueries({queryKey:["issues"]})}})}function Qg(t){const e=ts(),{connected:n,subscribe:r,unsubscribe:s,addMessageHandler:i,removeMessageHandler:o}=$a(),a=Io({queryKey:["feedback",t],queryFn:()=>Vi.getFeedback(t),enabled:!!t}),l=y.useCallback(c=>{(c.type==="feedback_created"||c.type==="feedback_updated"||c.type==="feedback_deleted")&&e.invalidateQueries({queryKey:["feedback",t]})},[t,e]);return y.useEffect(()=>{if(!t)return;const c=`useIssueFeedback-${t}`;return i(c,l),n&&r("all"),()=>{o(c),s("all")}},[n,t,r,s,i,o,l]),{feedback:a.data??[],isLoading:a.isLoading,isError:a.isError,error:a.error}}function LS(){return Io({queryKey:["repository-info"],queryFn:bD.getInfo,staleTime:6e4,retry:!1})}const Ht=y.forwardRef(({className:t,...e},n)=>f.jsx("div",{ref:n,className:_e("bg-card text-card-foreground",t),...e}));Ht.displayName="Card";const vD=y.forwardRef(({className:t,...e},n)=>f.jsx("div",{ref:n,className:_e("flex flex-col space-y-1.5 p-6",t),...e}));vD.displayName="CardHeader";const wD=y.forwardRef(({className:t,...e},n)=>f.jsx("div",{ref:n,className:_e("text-2xl font-semibold leading-none tracking-tight",t),...e}));wD.displayName="CardTitle";const kD=y.forwardRef(({className:t,...e},n)=>f.jsx("div",{ref:n,className:_e("text-sm text-muted-foreground",t),...e}));kD.displayName="CardDescription";const SD=y.forwardRef(({className:t,...e},n)=>f.jsx("div",{ref:n,className:_e("p-6 pt-0",t),...e}));SD.displayName="CardContent";const ED=y.forwardRef(({className:t,...e},n)=>f.jsx("div",{ref:n,className:_e("flex items-center p-6 pt-0",t),...e}));ED.displayName="CardFooter";const vx=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,wx=Kk,PS=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return wx(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:i}=e,o=Object.keys(s).map(c=>{const u=n==null?void 0:n[c],d=i==null?void 0:i[c];if(u===null)return null;const h=vx(u)||vx(d);return s[c][h]}),a=n&&Object.entries(n).reduce((c,u)=>{let[d,h]=u;return h===void 0||(c[d]=h),c},{}),l=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:d,className:h,...p}=u;return Object.entries(p).every(m=>{let[g,b]=m;return Array.isArray(b)?b.includes({...i,...a}[g]):{...i,...a}[g]===b})?[...c,d,h]:c},[]);return wx(t,o,l,n==null?void 0:n.class,n==null?void 0:n.className)},CD=PS("inline-flex items-center rounded-md border px-2 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground",issue:"border-blue-500/20 bg-blue-500/10 text-blue-600 dark:text-blue-400 hover:bg-blue-500/20",spec:"border-purple-500/20 bg-purple-500/10 text-purple-600 dark:text-purple-400 hover:bg-purple-500/20"}},defaultVariants:{variant:"default"}});function et({className:t,variant:e,...n}){return f.jsx("div",{className:_e(CD({variant:e}),t),...n})}const Mf=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ka(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function eb(t){return"nodeType"in t}function Un(t){var e,n;return t?Ka(t)?t:eb(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function tb(t){const{Document:e}=Un(t);return t instanceof e}function Ac(t){return Ka(t)?!1:t instanceof Un(t).HTMLElement}function jS(t){return t instanceof Un(t).SVGElement}function Ga(t){return t?Ka(t)?t.document:eb(t)?tb(t)?t:Ac(t)||jS(t)?t.ownerDocument:document:document:document}const As=Mf?y.useLayoutEffect:y.useEffect;function Rf(t){const e=y.useRef(t);return As(()=>{e.current=t}),y.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return e.current==null?void 0:e.current(...r)},[])}function ND(){const t=y.useRef(null),e=y.useCallback((r,s)=>{t.current=setInterval(r,s)},[]),n=y.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function Vl(t,e){e===void 0&&(e=[t]);const n=y.useRef(t);return As(()=>{n.current!==t&&(n.current=t)},e),n}function Mc(t,e){const n=y.useRef();return y.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function Xu(t){const e=Rf(t),n=y.useRef(null),r=y.useCallback(s=>{s!==n.current&&(e==null||e(s,n.current)),n.current=s},[]);return[n,r]}function Qu(t){const e=y.useRef();return y.useEffect(()=>{e.current=t},[t]),e.current}let _h={};function Of(t,e){return y.useMemo(()=>{if(e)return e;const n=_h[t]==null?0:_h[t]+1;return _h[t]=n,t+"-"+n},[t,e])}function zS(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return r.reduce((i,o)=>{const a=Object.entries(o);for(const[l,c]of a){const u=i[l];u!=null&&(i[l]=u+t*c)}return i},{...e})}}const oa=zS(1),ed=zS(-1);function _D(t){return"clientX"in t&&"clientY"in t}function nb(t){if(!t)return!1;const{KeyboardEvent:e}=Un(t.target);return e&&t instanceof e}function TD(t){if(!t)return!1;const{TouchEvent:e}=Un(t.target);return e&&t instanceof e}function td(t){if(TD(t)){if(t.touches&&t.touches.length){const{clientX:e,clientY:n}=t.touches[0];return{x:e,y:n}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:e,clientY:n}=t.changedTouches[0];return{x:e,y:n}}}return _D(t)?{x:t.clientX,y:t.clientY}:null}const Wl=Object.freeze({Translate:{toString(t){if(!t)return;const{x:e,y:n}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:e,scaleY:n}=t;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(t){if(t)return[Wl.Translate.toString(t),Wl.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),kx="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function AD(t){return t.matches(kx)?t:t.querySelector(kx)}const MD={display:"none"};function RD(t){let{id:e,value:n}=t;return ft.createElement("div",{id:e,style:MD},n)}function OD(t){let{id:e,announcement:n,ariaLiveType:r="assertive"}=t;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return ft.createElement("div",{id:e,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function ID(){const[t,e]=y.useState("");return{announce:y.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const FS=y.createContext(null);function DD(t){const e=y.useContext(FS);y.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function LD(){const[t]=y.useState(()=>new Set),e=y.useCallback(r=>(t.add(r),()=>t.delete(r)),[t]);return[y.useCallback(r=>{let{type:s,event:i}=r;t.forEach(o=>{var a;return(a=o[s])==null?void 0:a.call(o,i)})},[t]),e]}const PD={draggable:`
297
- To pick up a draggable item, press the space bar.
298
- While dragging, use the arrow keys to move the item.
299
- Press space again to drop the item in its new position, or press escape to cancel.
300
- `},jD={onDragStart(t){let{active:e}=t;return"Picked up draggable item "+e.id+"."},onDragOver(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was moved over droppable area "+n.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was dropped over droppable area "+n.id:"Draggable item "+e.id+" was dropped."},onDragCancel(t){let{active:e}=t;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function zD(t){let{announcements:e=jD,container:n,hiddenTextDescribedById:r,screenReaderInstructions:s=PD}=t;const{announce:i,announcement:o}=ID(),a=Of("DndLiveRegion"),[l,c]=y.useState(!1);if(y.useEffect(()=>{c(!0)},[]),DD(y.useMemo(()=>({onDragStart(d){let{active:h}=d;i(e.onDragStart({active:h}))},onDragMove(d){let{active:h,over:p}=d;e.onDragMove&&i(e.onDragMove({active:h,over:p}))},onDragOver(d){let{active:h,over:p}=d;i(e.onDragOver({active:h,over:p}))},onDragEnd(d){let{active:h,over:p}=d;i(e.onDragEnd({active:h,over:p}))},onDragCancel(d){let{active:h,over:p}=d;i(e.onDragCancel({active:h,over:p}))}}),[i,e])),!l)return null;const u=ft.createElement(ft.Fragment,null,ft.createElement(RD,{id:r,value:s.draggable}),ft.createElement(OD,{id:a,announcement:o}));return n?ci.createPortal(u,n):u}var Qt;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(Qt||(Qt={}));function nd(){}function FD(t,e){return y.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function BD(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return y.useMemo(()=>[...e].filter(r=>r!=null),[...e])}const zr=Object.freeze({x:0,y:0});function $D(t,e){const n=td(t);if(!n)return"0 0";const r={x:(n.x-e.left)/e.width*100,y:(n.y-e.top)/e.height*100};return r.x+"% "+r.y+"%"}function HD(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return r-n}function UD(t,e){if(!t||t.length===0)return null;const[n]=t;return n[e]}function VD(t,e){const n=Math.max(e.top,t.top),r=Math.max(e.left,t.left),s=Math.min(e.left+e.width,t.left+t.width),i=Math.min(e.top+e.height,t.top+t.height),o=s-r,a=i-n;if(r<s&&n<i){const l=e.width*e.height,c=t.width*t.height,u=o*a,d=u/(l+c-u);return Number(d.toFixed(4))}return 0}const BS=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=[];for(const i of r){const{id:o}=i,a=n.get(o);if(a){const l=VD(a,e);l>0&&s.push({id:o,data:{droppableContainer:i,value:l}})}}return s.sort(HD)};function WD(t,e,n){return{...t,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function $S(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:zr}function qD(t){return function(n){for(var r=arguments.length,s=new Array(r>1?r-1:0),i=1;i<r;i++)s[i-1]=arguments[i];return s.reduce((o,a)=>({...o,top:o.top+t*a.y,bottom:o.bottom+t*a.y,left:o.left+t*a.x,right:o.right+t*a.x}),{...n})}}const KD=qD(1);function HS(t){if(t.startsWith("matrix3d(")){const e=t.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(t.startsWith("matrix(")){const e=t.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function GD(t,e,n){const r=HS(e);if(!r)return t;const{scaleX:s,scaleY:i,x:o,y:a}=r,l=t.left-o-(1-s)*parseFloat(n),c=t.top-a-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),u=s?t.width/s:t.width,d=i?t.height/i:t.height;return{width:u,height:d,top:c,right:l+u,bottom:c+d,left:l}}const JD={ignoreTransform:!1};function Rc(t,e){e===void 0&&(e=JD);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:c,transformOrigin:u}=Un(t).getComputedStyle(t);c&&(n=GD(n,c,u))}const{top:r,left:s,width:i,height:o,bottom:a,right:l}=n;return{top:r,left:s,width:i,height:o,bottom:a,right:l}}function Sx(t){return Rc(t,{ignoreTransform:!0})}function YD(t){const e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function ZD(t,e){return e===void 0&&(e=Un(t).getComputedStyle(t)),e.position==="fixed"}function XD(t,e){e===void 0&&(e=Un(t).getComputedStyle(t));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const i=e[s];return typeof i=="string"?n.test(i):!1})}function rb(t,e){const n=[];function r(s){if(e!=null&&n.length>=e||!s)return n;if(tb(s)&&s.scrollingElement!=null&&!n.includes(s.scrollingElement))return n.push(s.scrollingElement),n;if(!Ac(s)||jS(s)||n.includes(s))return n;const i=Un(t).getComputedStyle(s);return s!==t&&XD(s,i)&&n.push(s),ZD(s,i)?n:r(s.parentNode)}return t?r(t):n}function US(t){const[e]=rb(t,1);return e??null}function Th(t){return!Mf||!t?null:Ka(t)?t:eb(t)?tb(t)||t===Ga(t).scrollingElement?window:Ac(t)?t:null:null}function VS(t){return Ka(t)?t.scrollX:t.scrollLeft}function WS(t){return Ka(t)?t.scrollY:t.scrollTop}function dm(t){return{x:VS(t),y:WS(t)}}var an;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(an||(an={}));function qS(t){return!Mf||!t?!1:t===document.scrollingElement}function KS(t){const e={x:0,y:0},n=qS(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},r={x:t.scrollWidth-n.width,y:t.scrollHeight-n.height},s=t.scrollTop<=e.y,i=t.scrollLeft<=e.x,o=t.scrollTop>=r.y,a=t.scrollLeft>=r.x;return{isTop:s,isLeft:i,isBottom:o,isRight:a,maxScroll:r,minScroll:e}}const QD={x:.2,y:.2};function eL(t,e,n,r,s){let{top:i,left:o,right:a,bottom:l}=n;r===void 0&&(r=10),s===void 0&&(s=QD);const{isTop:c,isBottom:u,isLeft:d,isRight:h}=KS(t),p={x:0,y:0},m={x:0,y:0},g={height:e.height*s.y,width:e.width*s.x};return!c&&i<=e.top+g.height?(p.y=an.Backward,m.y=r*Math.abs((e.top+g.height-i)/g.height)):!u&&l>=e.bottom-g.height&&(p.y=an.Forward,m.y=r*Math.abs((e.bottom-g.height-l)/g.height)),!h&&a>=e.right-g.width?(p.x=an.Forward,m.x=r*Math.abs((e.right-g.width-a)/g.width)):!d&&o<=e.left+g.width&&(p.x=an.Backward,m.x=r*Math.abs((e.left+g.width-o)/g.width)),{direction:p,speed:m}}function tL(t){if(t===document.scrollingElement){const{innerWidth:i,innerHeight:o}=window;return{top:0,left:0,right:i,bottom:o,width:i,height:o}}const{top:e,left:n,right:r,bottom:s}=t.getBoundingClientRect();return{top:e,left:n,right:r,bottom:s,width:t.clientWidth,height:t.clientHeight}}function GS(t){return t.reduce((e,n)=>oa(e,dm(n)),zr)}function nL(t){return t.reduce((e,n)=>e+VS(n),0)}function rL(t){return t.reduce((e,n)=>e+WS(n),0)}function JS(t,e){if(e===void 0&&(e=Rc),!t)return;const{top:n,left:r,bottom:s,right:i}=e(t);US(t)&&(s<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const sL=[["x",["left","right"],nL],["y",["top","bottom"],rL]];class sb{constructor(e,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=rb(n),s=GS(r);this.rect={...e},this.width=e.width,this.height=e.height;for(const[i,o,a]of sL)for(const l of o)Object.defineProperty(this,l,{get:()=>{const c=a(r),u=s[i]-c;return this.rect[l]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class El{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=e}add(e,n,r){var s;(s=this.target)==null||s.addEventListener(e,n,r),this.listeners.push([e,n,r])}}function iL(t){const{EventTarget:e}=Un(t);return t instanceof e?t:Ga(t)}function Ah(t,e){const n=Math.abs(t.x),r=Math.abs(t.y);return typeof e=="number"?Math.sqrt(n**2+r**2)>e:"x"in e&&"y"in e?n>e.x&&r>e.y:"x"in e?n>e.x:"y"in e?r>e.y:!1}var xr;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(xr||(xr={}));function Ex(t){t.preventDefault()}function oL(t){t.stopPropagation()}var bt;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(bt||(bt={}));const YS={start:[bt.Space,bt.Enter],cancel:[bt.Esc],end:[bt.Space,bt.Enter,bt.Tab]},aL=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case bt.Right:return{...n,x:n.x+25};case bt.Left:return{...n,x:n.x-25};case bt.Down:return{...n,y:n.y+25};case bt.Up:return{...n,y:n.y-25}}};class ZS{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new El(Ga(n)),this.windowListeners=new El(Un(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(xr.Resize,this.handleCancel),this.windowListeners.add(xr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(xr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,r=e.node.current;r&&JS(r),n(zr)}handleKeyDown(e){if(nb(e)){const{active:n,context:r,options:s}=this.props,{keyboardCodes:i=YS,coordinateGetter:o=aL,scrollBehavior:a="smooth"}=s,{code:l}=e;if(i.end.includes(l)){this.handleEnd(e);return}if(i.cancel.includes(l)){this.handleCancel(e);return}const{collisionRect:c}=r.current,u=c?{x:c.left,y:c.top}:zr;this.referenceCoordinates||(this.referenceCoordinates=u);const d=o(e,{active:n,context:r.current,currentCoordinates:u});if(d){const h=ed(d,u),p={x:0,y:0},{scrollableAncestors:m}=r.current;for(const g of m){const b=e.code,{isTop:x,isRight:w,isLeft:v,isBottom:k,maxScroll:N,minScroll:S}=KS(g),C=tL(g),T={x:Math.min(b===bt.Right?C.right-C.width/2:C.right,Math.max(b===bt.Right?C.left:C.left+C.width/2,d.x)),y:Math.min(b===bt.Down?C.bottom-C.height/2:C.bottom,Math.max(b===bt.Down?C.top:C.top+C.height/2,d.y))},R=b===bt.Right&&!w||b===bt.Left&&!v,_=b===bt.Down&&!k||b===bt.Up&&!x;if(R&&T.x!==d.x){const I=g.scrollLeft+h.x,D=b===bt.Right&&I<=N.x||b===bt.Left&&I>=S.x;if(D&&!h.y){g.scrollTo({left:I,behavior:a});return}D?p.x=g.scrollLeft-I:p.x=b===bt.Right?g.scrollLeft-N.x:g.scrollLeft-S.x,p.x&&g.scrollBy({left:-p.x,behavior:a});break}else if(_&&T.y!==d.y){const I=g.scrollTop+h.y,D=b===bt.Down&&I<=N.y||b===bt.Up&&I>=S.y;if(D&&!h.x){g.scrollTo({top:I,behavior:a});return}D?p.y=g.scrollTop-I:p.y=b===bt.Down?g.scrollTop-N.y:g.scrollTop-S.y,p.y&&g.scrollBy({top:-p.y,behavior:a});break}}this.handleMove(e,oa(ed(d,this.referenceCoordinates),p))}}}handleMove(e,n){const{onMove:r}=this.props;e.preventDefault(),r(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}ZS.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:r=YS,onActivation:s}=e,{active:i}=n;const{code:o}=t.nativeEvent;if(r.start.includes(o)){const a=i.activatorNode.current;return a&&t.target!==a?!1:(t.preventDefault(),s==null||s({event:t.nativeEvent}),!0)}return!1}}];function Cx(t){return!!(t&&"distance"in t)}function Nx(t){return!!(t&&"delay"in t)}class ib{constructor(e,n,r){var s;r===void 0&&(r=iL(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;const{event:i}=e,{target:o}=i;this.props=e,this.events=n,this.document=Ga(o),this.documentListeners=new El(this.document),this.listeners=new El(r),this.windowListeners=new El(Un(o)),this.initialCoordinates=(s=td(i))!=null?s:zr,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(xr.Resize,this.handleCancel),this.windowListeners.add(xr.DragStart,Ex),this.windowListeners.add(xr.VisibilityChange,this.handleCancel),this.windowListeners.add(xr.ContextMenu,Ex),this.documentListeners.add(xr.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Nx(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Cx(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,n){const{active:r,onPending:s}=this.props;s(r,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(xr.Click,oL,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(xr.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:r,initialCoordinates:s,props:i}=this,{onMove:o,options:{activationConstraint:a}}=i;if(!s)return;const l=(n=td(e))!=null?n:zr,c=ed(s,l);if(!r&&a){if(Cx(a)){if(a.tolerance!=null&&Ah(c,a.tolerance))return this.handleCancel();if(Ah(c,a.distance))return this.handleStart()}if(Nx(a)&&Ah(c,a.tolerance))return this.handleCancel();this.handlePending(a,c);return}e.cancelable&&e.preventDefault(),o(l)}handleEnd(){const{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){const{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===bt.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const lL={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class ob extends ib{constructor(e){const{event:n}=e,r=Ga(n.target);super(e,lL,r)}}ob.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const cL={move:{name:"mousemove"},end:{name:"mouseup"}};var fm;(function(t){t[t.RightClick=2]="RightClick"})(fm||(fm={}));class uL extends ib{constructor(e){super(e,cL,Ga(e.event.target))}}uL.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return n.button===fm.RightClick?!1:(r==null||r({event:n}),!0)}}];const Mh={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class dL extends ib{constructor(e){super(e,Mh)}static setup(){return window.addEventListener(Mh.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Mh.move.name,e)};function e(){}}}dL.activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;const{touches:s}=n;return s.length>1?!1:(r==null||r({event:n}),!0)}}];var Cl;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(Cl||(Cl={}));var rd;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(rd||(rd={}));function fL(t){let{acceleration:e,activator:n=Cl.Pointer,canScroll:r,draggingRect:s,enabled:i,interval:o=5,order:a=rd.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:d,threshold:h}=t;const p=pL({delta:d,disabled:!i}),[m,g]=ND(),b=y.useRef({x:0,y:0}),x=y.useRef({x:0,y:0}),w=y.useMemo(()=>{switch(n){case Cl.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Cl.DraggableRect:return s}},[n,s,l]),v=y.useRef(null),k=y.useCallback(()=>{const S=v.current;if(!S)return;const C=b.current.x*x.current.x,T=b.current.y*x.current.y;S.scrollBy(C,T)},[]),N=y.useMemo(()=>a===rd.TreeOrder?[...c].reverse():c,[a,c]);y.useEffect(()=>{if(!i||!c.length||!w){g();return}for(const S of N){if((r==null?void 0:r(S))===!1)continue;const C=c.indexOf(S),T=u[C];if(!T)continue;const{direction:R,speed:_}=eL(S,T,w,e,h);for(const I of["x","y"])p[I][R[I]]||(_[I]=0,R[I]=0);if(_.x>0||_.y>0){g(),v.current=S,m(k,o),b.current=_,x.current=R;return}}b.current={x:0,y:0},x.current={x:0,y:0},g()},[e,k,r,g,i,o,JSON.stringify(w),JSON.stringify(p),m,c,N,u,JSON.stringify(h)])}const hL={x:{[an.Backward]:!1,[an.Forward]:!1},y:{[an.Backward]:!1,[an.Forward]:!1}};function pL(t){let{delta:e,disabled:n}=t;const r=Qu(e);return Mc(s=>{if(n||!r||!s)return hL;const i={x:Math.sign(e.x-r.x),y:Math.sign(e.y-r.y)};return{x:{[an.Backward]:s.x[an.Backward]||i.x===-1,[an.Forward]:s.x[an.Forward]||i.x===1},y:{[an.Backward]:s.y[an.Backward]||i.y===-1,[an.Forward]:s.y[an.Forward]||i.y===1}}},[n,e,r])}function mL(t,e){const n=e!=null?t.get(e):void 0,r=n?n.node.current:null;return Mc(s=>{var i;return e==null?null:(i=r??s)!=null?i:null},[r,e])}function gL(t,e){return y.useMemo(()=>t.reduce((n,r)=>{const{sensor:s}=r,i=s.activators.map(o=>({eventName:o.eventName,handler:e(o.handler,r)}));return[...n,...i]},[]),[t,e])}var ql;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(ql||(ql={}));var hm;(function(t){t.Optimized="optimized"})(hm||(hm={}));const _x=new Map;function bL(t,e){let{dragging:n,dependencies:r,config:s}=e;const[i,o]=y.useState(null),{frequency:a,measure:l,strategy:c}=s,u=y.useRef(t),d=b(),h=Vl(d),p=y.useCallback(function(x){x===void 0&&(x=[]),!h.current&&o(w=>w===null?x:w.concat(x.filter(v=>!w.includes(v))))},[h]),m=y.useRef(null),g=Mc(x=>{if(d&&!n)return _x;if(!x||x===_x||u.current!==t||i!=null){const w=new Map;for(let v of t){if(!v)continue;if(i&&i.length>0&&!i.includes(v.id)&&v.rect.current){w.set(v.id,v.rect.current);continue}const k=v.node.current,N=k?new sb(l(k),k):null;v.rect.current=N,N&&w.set(v.id,N)}return w}return x},[t,i,n,d,l]);return y.useEffect(()=>{u.current=t},[t]),y.useEffect(()=>{d||p()},[n,d]),y.useEffect(()=>{i&&i.length>0&&o(null)},[JSON.stringify(i)]),y.useEffect(()=>{d||typeof a!="number"||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},a))},[a,d,p,...r]),{droppableRects:g,measureDroppableContainers:p,measuringScheduled:i!=null};function b(){switch(c){case ql.Always:return!1;case ql.BeforeDragging:return n;default:return!n}}}function ab(t,e){return Mc(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function yL(t,e){return ab(t,e)}function xL(t){let{callback:e,disabled:n}=t;const r=Rf(e),s=y.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return y.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function If(t){let{callback:e,disabled:n}=t;const r=Rf(e),s=y.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return y.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function vL(t){return new sb(Rc(t),t)}function Tx(t,e,n){e===void 0&&(e=vL);const[r,s]=y.useState(null);function i(){s(l=>{if(!t)return null;if(t.isConnected===!1){var c;return(c=l??n)!=null?c:null}const u=e(t);return JSON.stringify(l)===JSON.stringify(u)?l:u})}const o=xL({callback(l){if(t)for(const c of l){const{type:u,target:d}=c;if(u==="childList"&&d instanceof HTMLElement&&d.contains(t)){i();break}}}}),a=If({callback:i});return As(()=>{i(),t?(a==null||a.observe(t),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),o==null||o.disconnect())},[t]),r}function wL(t){const e=ab(t);return $S(t,e)}const Ax=[];function kL(t){const e=y.useRef(t),n=Mc(r=>t?r&&r!==Ax&&t&&e.current&&t.parentNode===e.current.parentNode?r:rb(t):Ax,[t]);return y.useEffect(()=>{e.current=t},[t]),n}function SL(t){const[e,n]=y.useState(null),r=y.useRef(t),s=y.useCallback(i=>{const o=Th(i.target);o&&n(a=>a?(a.set(o,dm(o)),new Map(a)):null)},[]);return y.useEffect(()=>{const i=r.current;if(t!==i){o(i);const a=t.map(l=>{const c=Th(l);return c?(c.addEventListener("scroll",s,{passive:!0}),[c,dm(c)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=t}return()=>{o(t),o(i)};function o(a){a.forEach(l=>{const c=Th(l);c==null||c.removeEventListener("scroll",s)})}},[s,t]),y.useMemo(()=>t.length?e?Array.from(e.values()).reduce((i,o)=>oa(i,o),zr):GS(t):zr,[t,e])}function Mx(t,e){e===void 0&&(e=[]);const n=y.useRef(null);return y.useEffect(()=>{n.current=null},e),y.useEffect(()=>{const r=t!==zr;r&&!n.current&&(n.current=t),!r&&n.current&&(n.current=null)},[t]),n.current?ed(t,n.current):zr}function EL(t){y.useEffect(()=>{if(!Mf)return;const e=t.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of e)n==null||n()}},t.map(e=>{let{sensor:n}=e;return n}))}function CL(t,e){return y.useMemo(()=>t.reduce((n,r)=>{let{eventName:s,handler:i}=r;return n[s]=o=>{i(o,e)},n},{}),[t,e])}function XS(t){return y.useMemo(()=>t?YD(t):null,[t])}const Rx=[];function NL(t,e){e===void 0&&(e=Rc);const[n]=t,r=XS(n?Un(n):null),[s,i]=y.useState(Rx);function o(){i(()=>t.length?t.map(l=>qS(l)?r:new sb(e(l),l)):Rx)}const a=If({callback:o});return As(()=>{a==null||a.disconnect(),o(),t.forEach(l=>a==null?void 0:a.observe(l))},[t]),s}function QS(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return Ac(e)?e:t}function _L(t){let{measure:e}=t;const[n,r]=y.useState(null),s=y.useCallback(c=>{for(const{target:u}of c)if(Ac(u)){r(d=>{const h=e(u);return d?{...d,width:h.width,height:h.height}:h});break}},[e]),i=If({callback:s}),o=y.useCallback(c=>{const u=QS(c);i==null||i.disconnect(),u&&(i==null||i.observe(u)),r(u?e(u):null)},[e,i]),[a,l]=Xu(o);return y.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const TL=[{sensor:ob,options:{}},{sensor:ZS,options:{}}],AL={current:{}},ju={draggable:{measure:Sx},droppable:{measure:Sx,strategy:ql.WhileDragging,frequency:hm.Optimized},dragOverlay:{measure:Rc}};class Nl extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,r;return(n=(r=this.get(e))==null?void 0:r.node.current)!=null?n:void 0}}const ML={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Nl,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:nd},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:ju,measureDroppableContainers:nd,windowRect:null,measuringScheduled:!1},eE={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:nd,draggableNodes:new Map,over:null,measureDroppableContainers:nd},Oc=y.createContext(eE),tE=y.createContext(ML);function RL(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Nl}}}function OL(t,e){switch(e.type){case Qt.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case Qt.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}};case Qt.DragEnd:case Qt.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Qt.RegisterDroppable:{const{element:n}=e,{id:r}=n,s=new Nl(t.droppable.containers);return s.set(r,n),{...t,droppable:{...t.droppable,containers:s}}}case Qt.SetDroppableDisabled:{const{id:n,key:r,disabled:s}=e,i=t.droppable.containers.get(n);if(!i||r!==i.key)return t;const o=new Nl(t.droppable.containers);return o.set(n,{...i,disabled:s}),{...t,droppable:{...t.droppable,containers:o}}}case Qt.UnregisterDroppable:{const{id:n,key:r}=e,s=t.droppable.containers.get(n);if(!s||r!==s.key)return t;const i=new Nl(t.droppable.containers);return i.delete(n),{...t,droppable:{...t.droppable,containers:i}}}default:return t}}function IL(t){let{disabled:e}=t;const{active:n,activatorEvent:r,draggableNodes:s}=y.useContext(Oc),i=Qu(r),o=Qu(n==null?void 0:n.id);return y.useEffect(()=>{if(!e&&!r&&i&&o!=null){if(!nb(i)||document.activeElement===i.target)return;const a=s.get(o);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const u of[l.current,c.current]){if(!u)continue;const d=AD(u);if(d){d.focus();break}}})}},[r,e,s,o,i]),null}function nE(t,e){let{transform:n,...r}=e;return t!=null&&t.length?t.reduce((s,i)=>i({transform:s,...r}),n):n}function DL(t){return y.useMemo(()=>({draggable:{...ju.draggable,...t==null?void 0:t.draggable},droppable:{...ju.droppable,...t==null?void 0:t.droppable},dragOverlay:{...ju.dragOverlay,...t==null?void 0:t.dragOverlay}}),[t==null?void 0:t.draggable,t==null?void 0:t.droppable,t==null?void 0:t.dragOverlay])}function LL(t){let{activeNode:e,measure:n,initialRect:r,config:s=!0}=t;const i=y.useRef(!1),{x:o,y:a}=typeof s=="boolean"?{x:s,y:s}:s;As(()=>{if(!o&&!a||!e){i.current=!1;return}if(i.current||!r)return;const c=e==null?void 0:e.node.current;if(!c||c.isConnected===!1)return;const u=n(c),d=$S(u,r);if(o||(d.x=0),a||(d.y=0),i.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const h=US(c);h&&h.scrollBy({top:d.y,left:d.x})}},[e,o,a,r,n])}const Df=y.createContext({...zr,scaleX:1,scaleY:1});var Vs;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(Vs||(Vs={}));const PL=y.memo(function(e){var n,r,s,i;let{id:o,accessibility:a,autoScroll:l=!0,children:c,sensors:u=TL,collisionDetection:d=BS,measuring:h,modifiers:p,...m}=e;const g=y.useReducer(OL,void 0,RL),[b,x]=g,[w,v]=LD(),[k,N]=y.useState(Vs.Uninitialized),S=k===Vs.Initialized,{draggable:{active:C,nodes:T,translate:R},droppable:{containers:_}}=b,I=C!=null?T.get(C):null,D=y.useRef({initial:null,translated:null}),V=y.useMemo(()=>{var Wt;return C!=null?{id:C,data:(Wt=I==null?void 0:I.data)!=null?Wt:AL,rect:D}:null},[C,I]),j=y.useRef(null),[L,q]=y.useState(null),[re,X]=y.useState(null),ce=Vl(m,Object.values(m)),A=Of("DndDescribedBy",o),ue=y.useMemo(()=>_.getEnabled(),[_]),be=DL(h),{droppableRects:E,measureDroppableContainers:P,measuringScheduled:z}=bL(ue,{dragging:S,dependencies:[R.x,R.y],config:be.droppable}),H=mL(T,C),B=y.useMemo(()=>re?td(re):null,[re]),J=el(),K=yL(H,be.draggable.measure);LL({activeNode:C!=null?T.get(C):null,config:J.layoutShiftCompensation,initialRect:K,measure:be.draggable.measure});const Y=Tx(H,be.draggable.measure,K),le=Tx(H?H.parentElement:null),ye=y.useRef({activatorEvent:null,active:null,activeNode:H,collisionRect:null,collisions:null,droppableRects:E,draggableNodes:T,draggingNode:null,draggingNodeRect:null,droppableContainers:_,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Re=_.getNodeFor((n=ye.current.over)==null?void 0:n.id),Oe=_L({measure:be.dragOverlay.measure}),ht=(r=Oe.nodeRef.current)!=null?r:H,De=S?(s=Oe.rect)!=null?s:Y:null,_t=!!(Oe.nodeRef.current&&Oe.rect),ot=wL(_t?null:Y),dn=XS(ht?Un(ht):null),qt=kL(S?Re??H:null),me=NL(qt),ze=nE(p,{transform:{x:R.x-ot.x,y:R.y-ot.y,scaleX:1,scaleY:1},activatorEvent:re,active:V,activeNodeRect:Y,containerNodeRect:le,draggingNodeRect:De,over:ye.current.over,overlayNodeRect:Oe.rect,scrollableAncestors:qt,scrollableAncestorRects:me,windowRect:dn}),Vt=B?oa(B,R):null,Z=SL(qt),ct=Mx(Z),F=Mx(Z,[Y]),W=oa(ze,ct),ge=De?KD(De,ze):null,Be=V&&ge?d({active:V,collisionRect:ge,droppableRects:E,droppableContainers:ue,pointerCoordinates:Vt}):null,tt=UD(Be,"id"),[Ot,Vn]=y.useState(null),On=_t?ze:oa(ze,F),dr=WD(On,(i=Ot==null?void 0:Ot.rect)!=null?i:null,Y),nr=y.useRef(null),Kt=y.useCallback((Wt,Pt)=>{let{sensor:M,options:U}=Pt;if(j.current==null)return;const Q=T.get(j.current);if(!Q)return;const we=Wt.nativeEvent,it=new M({active:j.current,activeNode:Q,event:we,options:U,context:ye,onAbort(oe){if(!T.get(oe))return;const{onDragAbort:ke}=ce.current,mt={id:oe};ke==null||ke(mt),w({type:"onDragAbort",event:mt})},onPending(oe,de,ke,mt){if(!T.get(oe))return;const{onDragPending:Ar}=ce.current,hr={id:oe,constraint:de,initialCoordinates:ke,offset:mt};Ar==null||Ar(hr),w({type:"onDragPending",event:hr})},onStart(oe){const de=j.current;if(de==null)return;const ke=T.get(de);if(!ke)return;const{onDragStart:mt}=ce.current,wt={activatorEvent:we,active:{id:de,data:ke.data,rect:D}};ci.unstable_batchedUpdates(()=>{mt==null||mt(wt),N(Vs.Initializing),x({type:Qt.DragStart,initialCoordinates:oe,active:de}),w({type:"onDragStart",event:wt}),q(nr.current),X(we)})},onMove(oe){x({type:Qt.DragMove,coordinates:oe})},onEnd:pt(Qt.DragEnd),onCancel:pt(Qt.DragCancel)});nr.current=it;function pt(oe){return async function(){const{active:ke,collisions:mt,over:wt,scrollAdjustedTranslate:Ar}=ye.current;let hr=null;if(ke&&Ar){const{cancelDrop:is}=ce.current;hr={activatorEvent:we,active:ke,collisions:mt,delta:Ar,over:wt},oe===Qt.DragEnd&&typeof is=="function"&&await Promise.resolve(is(hr))&&(oe=Qt.DragCancel)}j.current=null,ci.unstable_batchedUpdates(()=>{x({type:oe}),N(Vs.Uninitialized),Vn(null),q(null),X(null),nr.current=null;const is=oe===Qt.DragEnd?"onDragEnd":"onDragCancel";if(hr){const tl=ce.current[is];tl==null||tl(hr),w({type:is,event:hr})}})}}},[T]),fr=y.useCallback((Wt,Pt)=>(M,U)=>{const Q=M.nativeEvent,we=T.get(U);if(j.current!==null||!we||Q.dndKit||Q.defaultPrevented)return;const it={active:we};Wt(M,Pt.options,it)===!0&&(Q.dndKit={capturedBy:Pt.sensor},j.current=U,Kt(M,Pt))},[T,Kt]),sn=gL(u,fr);EL(u),As(()=>{Y&&k===Vs.Initializing&&N(Vs.Initialized)},[Y,k]),y.useEffect(()=>{const{onDragMove:Wt}=ce.current,{active:Pt,activatorEvent:M,collisions:U,over:Q}=ye.current;if(!Pt||!M)return;const we={active:Pt,activatorEvent:M,collisions:U,delta:{x:W.x,y:W.y},over:Q};ci.unstable_batchedUpdates(()=>{Wt==null||Wt(we),w({type:"onDragMove",event:we})})},[W.x,W.y]),y.useEffect(()=>{const{active:Wt,activatorEvent:Pt,collisions:M,droppableContainers:U,scrollAdjustedTranslate:Q}=ye.current;if(!Wt||j.current==null||!Pt||!Q)return;const{onDragOver:we}=ce.current,it=U.get(tt),pt=it&&it.rect.current?{id:it.id,rect:it.rect.current,data:it.data,disabled:it.disabled}:null,oe={active:Wt,activatorEvent:Pt,collisions:M,delta:{x:Q.x,y:Q.y},over:pt};ci.unstable_batchedUpdates(()=>{Vn(pt),we==null||we(oe),w({type:"onDragOver",event:oe})})},[tt]),As(()=>{ye.current={activatorEvent:re,active:V,activeNode:H,collisionRect:ge,collisions:Be,droppableRects:E,draggableNodes:T,draggingNode:ht,draggingNodeRect:De,droppableContainers:_,over:Ot,scrollableAncestors:qt,scrollAdjustedTranslate:W},D.current={initial:De,translated:ge}},[V,H,Be,ge,T,ht,De,E,_,Ot,qt,W]),fL({...J,delta:R,draggingRect:ge,pointerCoordinates:Vt,scrollableAncestors:qt,scrollableAncestorRects:me});const zo=y.useMemo(()=>({active:V,activeNode:H,activeNodeRect:Y,activatorEvent:re,collisions:Be,containerNodeRect:le,dragOverlay:Oe,draggableNodes:T,droppableContainers:_,droppableRects:E,over:Ot,measureDroppableContainers:P,scrollableAncestors:qt,scrollableAncestorRects:me,measuringConfiguration:be,measuringScheduled:z,windowRect:dn}),[V,H,Y,re,Be,le,Oe,T,_,E,Ot,P,qt,me,be,z,dn]),Fo=y.useMemo(()=>({activatorEvent:re,activators:sn,active:V,activeNodeRect:Y,ariaDescribedById:{draggable:A},dispatch:x,draggableNodes:T,over:Ot,measureDroppableContainers:P}),[re,sn,V,Y,x,A,T,Ot,P]);return ft.createElement(FS.Provider,{value:v},ft.createElement(Oc.Provider,{value:Fo},ft.createElement(tE.Provider,{value:zo},ft.createElement(Df.Provider,{value:dr},c)),ft.createElement(IL,{disabled:(a==null?void 0:a.restoreFocus)===!1})),ft.createElement(zD,{...a,hiddenTextDescribedById:A}));function el(){const Wt=(L==null?void 0:L.autoScrollEnabled)===!1,Pt=typeof l=="object"?l.enabled===!1:l===!1,M=S&&!Wt&&!Pt;return typeof l=="object"?{...l,enabled:M}:{enabled:M}}}),jL=y.createContext(null),Ox="button",zL="Draggable";function FL(t){let{id:e,data:n,disabled:r=!1,attributes:s}=t;const i=Of(zL),{activators:o,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:d,over:h}=y.useContext(Oc),{role:p=Ox,roleDescription:m="draggable",tabIndex:g=0}=s??{},b=(l==null?void 0:l.id)===e,x=y.useContext(b?Df:jL),[w,v]=Xu(),[k,N]=Xu(),S=CL(o,e),C=Vl(n);As(()=>(d.set(e,{id:e,key:i,node:w,activatorNode:k,data:C}),()=>{const R=d.get(e);R&&R.key===i&&d.delete(e)}),[d,e]);const T=y.useMemo(()=>({role:p,tabIndex:g,"aria-disabled":r,"aria-pressed":b&&p===Ox?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,g,b,m,u.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:T,isDragging:b,listeners:r?void 0:S,node:w,over:h,setNodeRef:v,setActivatorNodeRef:N,transform:x}}function BL(){return y.useContext(tE)}const $L="Droppable",HL={timeout:25};function UL(t){let{data:e,disabled:n=!1,id:r,resizeObserverConfig:s}=t;const i=Of($L),{active:o,dispatch:a,over:l,measureDroppableContainers:c}=y.useContext(Oc),u=y.useRef({disabled:n}),d=y.useRef(!1),h=y.useRef(null),p=y.useRef(null),{disabled:m,updateMeasurementsFor:g,timeout:b}={...HL,...s},x=Vl(g??r),w=y.useCallback(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{c(Array.isArray(x.current)?x.current:[x.current]),p.current=null},b)},[b]),v=If({callback:w,disabled:m||!o}),k=y.useCallback((T,R)=>{v&&(R&&(v.unobserve(R),d.current=!1),T&&v.observe(T))},[v]),[N,S]=Xu(k),C=Vl(e);return y.useEffect(()=>{!v||!N.current||(v.disconnect(),d.current=!1,v.observe(N.current))},[N,v]),y.useEffect(()=>(a({type:Qt.RegisterDroppable,element:{id:r,key:i,disabled:n,node:N,rect:h,data:C}}),()=>a({type:Qt.UnregisterDroppable,key:i,id:r})),[r]),y.useEffect(()=>{n!==u.current.disabled&&(a({type:Qt.SetDroppableDisabled,id:r,key:i,disabled:n}),u.current.disabled=n)},[r,i,n,a]),{active:o,rect:h,isOver:(l==null?void 0:l.id)===r,node:N,over:l,setNodeRef:S}}function VL(t){let{animation:e,children:n}=t;const[r,s]=y.useState(null),[i,o]=y.useState(null),a=Qu(n);return!n&&!r&&a&&s(a),As(()=>{if(!i)return;const l=r==null?void 0:r.key,c=r==null?void 0:r.props.id;if(l==null||c==null){s(null);return}Promise.resolve(e(c,i)).then(()=>{s(null)})},[e,r,i]),ft.createElement(ft.Fragment,null,n,r?y.cloneElement(r,{ref:o}):null)}const WL={x:0,y:0,scaleX:1,scaleY:1};function qL(t){let{children:e}=t;return ft.createElement(Oc.Provider,{value:eE},ft.createElement(Df.Provider,{value:WL},e))}const KL={position:"fixed",touchAction:"none"},GL=t=>nb(t)?"transform 250ms ease":void 0,JL=y.forwardRef((t,e)=>{let{as:n,activatorEvent:r,adjustScale:s,children:i,className:o,rect:a,style:l,transform:c,transition:u=GL}=t;if(!a)return null;const d=s?c:{...c,scaleX:1,scaleY:1},h={...KL,width:a.width,height:a.height,top:a.top,left:a.left,transform:Wl.Transform.toString(d),transformOrigin:s&&r?$D(r,a):void 0,transition:typeof u=="function"?u(r):u,...l};return ft.createElement(n,{className:o,style:h,ref:e},i)}),YL=t=>e=>{let{active:n,dragOverlay:r}=e;const s={},{styles:i,className:o}=t;if(i!=null&&i.active)for(const[a,l]of Object.entries(i.active))l!==void 0&&(s[a]=n.node.style.getPropertyValue(a),n.node.style.setProperty(a,l));if(i!=null&&i.dragOverlay)for(const[a,l]of Object.entries(i.dragOverlay))l!==void 0&&r.node.style.setProperty(a,l);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(const[l,c]of Object.entries(s))n.node.style.setProperty(l,c);o!=null&&o.active&&n.node.classList.remove(o.active)}},ZL=t=>{let{transform:{initial:e,final:n}}=t;return[{transform:Wl.Transform.toString(e)},{transform:Wl.Transform.toString(n)}]},XL={duration:250,easing:"ease",keyframes:ZL,sideEffects:YL({styles:{active:{opacity:"0"}}})};function QL(t){let{config:e,draggableNodes:n,droppableContainers:r,measuringConfiguration:s}=t;return Rf((i,o)=>{if(e===null)return;const a=n.get(i);if(!a)return;const l=a.node.current;if(!l)return;const c=QS(o);if(!c)return;const{transform:u}=Un(o).getComputedStyle(o),d=HS(u);if(!d)return;const h=typeof e=="function"?e:eP(e);return JS(l,s.draggable.measure),h({active:{id:i,data:a.data,node:l,rect:s.draggable.measure(l)},draggableNodes:n,dragOverlay:{node:o,rect:s.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:s,transform:d})})}function eP(t){const{duration:e,easing:n,sideEffects:r,keyframes:s}={...XL,...t};return i=>{let{active:o,dragOverlay:a,transform:l,...c}=i;if(!e)return;const u={x:a.rect.left-o.rect.left,y:a.rect.top-o.rect.top},d={scaleX:l.scaleX!==1?o.rect.width*l.scaleX/a.rect.width:1,scaleY:l.scaleY!==1?o.rect.height*l.scaleY/a.rect.height:1},h={x:l.x-u.x,y:l.y-u.y,...d},p=s({...c,active:o,dragOverlay:a,transform:{initial:l,final:h}}),[m]=p,g=p[p.length-1];if(JSON.stringify(m)===JSON.stringify(g))return;const b=r==null?void 0:r({active:o,dragOverlay:a,...c}),x=a.node.animate(p,{duration:e,easing:n,fill:"forwards"});return new Promise(w=>{x.onfinish=()=>{b==null||b(),w()}})}}let Ix=0;function tP(t){return y.useMemo(()=>{if(t!=null)return Ix++,Ix},[t])}const nP=ft.memo(t=>{let{adjustScale:e=!1,children:n,dropAnimation:r,style:s,transition:i,modifiers:o,wrapperElement:a="div",className:l,zIndex:c=999}=t;const{activatorEvent:u,active:d,activeNodeRect:h,containerNodeRect:p,draggableNodes:m,droppableContainers:g,dragOverlay:b,over:x,measuringConfiguration:w,scrollableAncestors:v,scrollableAncestorRects:k,windowRect:N}=BL(),S=y.useContext(Df),C=tP(d==null?void 0:d.id),T=nE(o,{activatorEvent:u,active:d,activeNodeRect:h,containerNodeRect:p,draggingNodeRect:b.rect,over:x,overlayNodeRect:b.rect,scrollableAncestors:v,scrollableAncestorRects:k,transform:S,windowRect:N}),R=ab(h),_=QL({config:r,draggableNodes:m,droppableContainers:g,measuringConfiguration:w}),I=R?b.setRef:void 0;return ft.createElement(qL,null,ft.createElement(VL,{animation:_},d&&C?ft.createElement(JL,{key:C,id:d.id,ref:I,as:a,activatorEvent:u,adjustScale:e,className:l,transition:i,rect:R,style:{zIndex:c,...s},transform:T},n):null))});var rP=Symbol.for("react.lazy"),sd=Nk[" use ".trim().toString()];function sP(t){return typeof t=="object"&&t!==null&&"then"in t}function rE(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===rP&&"_payload"in t&&sP(t._payload)}function sE(t){const e=oP(t),n=y.forwardRef((r,s)=>{let{children:i,...o}=r;rE(i)&&typeof sd=="function"&&(i=sd(i._payload));const a=y.Children.toArray(i),l=a.find(lP);if(l){const c=l.props.children,u=a.map(d=>d===l?y.Children.count(c)>1?y.Children.only(null):y.isValidElement(c)?c.props.children:null:d);return f.jsx(e,{...o,ref:s,children:y.isValidElement(c)?y.cloneElement(c,void 0,u):null})}return f.jsx(e,{...o,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}var iP=sE("Slot");function oP(t){const e=y.forwardRef((n,r)=>{let{children:s,...i}=n;if(rE(s)&&typeof sd=="function"&&(s=sd(s._payload)),y.isValidElement(s)){const o=uP(s),a=cP(i,s.props);return s.type!==y.Fragment&&(a.ref=r?Ig(r,o):o),y.cloneElement(s,a)}return y.Children.count(s)>1?y.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var aP=Symbol("radix.slottable");function lP(t){return y.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===aP}function cP(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...a)=>{const l=i(...a);return s(...a),l}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function uP(t){var r,s;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}const lb=PS("inline-flex items-center justify-center whitespace-nowrap text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring/40 disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed rounded-md",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90 border border-primary dark:border-primary/50 dark:text-white",destructive:"border border-destructive text-destructive hover:bg-destructive/10 dark:hover:bg-destructive/20",outline:"border border-input bg-background text-foreground hover:bg-accent hover:text-accent-foreground dark:border-input/50 dark:hover:bg-accent/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 border border-secondary dark:border-secondary/50",ghost:"text-foreground hover:bg-accent/50 hover:text-accent-foreground dark:hover:bg-accent/30",link:"text-foreground hover:underline dark:text-foreground/90",icon:"bg-transparent rounded text-muted-foreground hover:text-foreground dark:hover:text-foreground/90"},size:{default:"h-10 px-4 py-2",xs:"h-8 px-2 text-xs",sm:"h-9 px-3",lg:"h-11 px-8",icon:"h-10 w-10"}},compoundVariants:[{variant:"icon",class:"p-0 h-4"}],defaultVariants:{variant:"default",size:"default"}}),ie=y.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...s},i)=>{const o=r?iP:"button";return f.jsx(o,{className:_e(lb({variant:e,size:n,className:t})),ref:i,...s})});ie.displayName="Button";const dP=({id:t,children:e,className:n,"data-column-id":r,collapsed:s=!1})=>{const{isOver:i,setNodeRef:o}=UL({id:t});return f.jsx("div",{className:_e("flex h-full min-h-40 flex-col transition-all",i?"outline-primary":"outline-border",s&&"min-w-0",n),ref:o,"data-column-id":r,children:e})},fP=({id:t,name:e,index:n,parent:r,children:s,className:i,onClick:o,tabIndex:a,forwardedRef:l,onKeyDown:c,isOpen:u})=>{const{attributes:d,listeners:h,setNodeRef:p,isDragging:m}=FL({id:t,data:{index:n,parent:r}}),g=y.useRef(!1);y.useEffect(()=>{if(m)g.current=!0;else if(g.current){const w=setTimeout(()=>{g.current=!1},100);return()=>clearTimeout(w)}},[m]);const b=w=>{p(w),typeof l=="function"?l(w):l&&typeof l=="object"&&(l.current=w)},x=w=>{if(g.current){w.preventDefault(),w.stopPropagation();return}o==null||o()};return f.jsx(Ht,{className:_e("flex-col space-y-2 border-b p-3 outline-none",m&&"cursor-grabbing opacity-50",u&&"ring-2 ring-inset ring-secondary-foreground",i),...h,...d,ref:b,tabIndex:a,onClick:x,onKeyDown:c,"data-issue-id":t,children:s??f.jsx("p",{className:"m-0 text-sm font-medium",children:e})})},hP=({children:t,className:e,collapsed:n=!1})=>f.jsx("div",{className:_e("flex flex-1 flex-col overflow-y-auto",n&&"hidden",e),children:t}),pP=t=>"children"in t?t.children:t.collapsed??!1?f.jsx(Ht,{className:_e("sticky top-0 z-20 flex flex-col flex-1 shrink-0 items-center justify-center border-b border-dashed p-3","bg-background",t.className),style:{backgroundImage:`linear-gradient(hsl(var(${t.color}) / 0.03), hsl(var(${t.color}) / 0.03))`},children:f.jsxs("div",{className:"flex items-center gap-2 whitespace-nowrap cursor-pointer hover:opacity-80 transition-opacity",style:{writingMode:"vertical-rl",transform:"rotate(180deg)"},onClick:t.onToggleCollapse,children:[f.jsx("div",{className:"h-2 w-2 rounded-full",style:{backgroundColor:`hsl(var(${t.color}))`}}),f.jsx("p",{className:"m-0 text-sm",children:t.name}),t.count!==void 0&&f.jsx(et,{variant:"secondary",children:t.count})]})}):f.jsxs(Ht,{className:_e("sticky top-0 z-20 flex flex shrink-0 items-center gap-2 gap-2 border-b border-dashed p-3","bg-background",t.className),style:{backgroundImage:`linear-gradient(hsl(var(${t.color}) / 0.03), hsl(var(${t.color}) / 0.03))`},children:[f.jsxs("span",{className:"flex flex-1 items-center gap-2 cursor-pointer hover:opacity-80 transition-opacity",onClick:t.onToggleCollapse,children:[f.jsx("div",{className:"h-2 w-2 rounded-full",style:{backgroundColor:`hsl(var(${t.color}))`}}),f.jsx("p",{className:"m-0 text-sm",children:t.name}),t.count!==void 0&&f.jsx(et,{variant:"secondary",children:t.count})]}),f.jsxs("span",{className:"flex items-center gap-1",children:[t.onArchiveAll&&f.jsx(Ts,{children:f.jsxs(Sn,{children:[f.jsx(En,{asChild:!0,children:f.jsx(ie,{variant:"ghost",className:"m-0 h-0 p-0 text-foreground/50 hover:text-foreground",onClick:n=>{var r;n.stopPropagation(),(r=t.onArchiveAll)==null||r.call(t)},"aria-label":"Archive All",children:f.jsx(Ha,{className:"h-4 w-4"})})}),f.jsx(gn,{side:"top",children:"Archive All"})]})}),t.onAddIssue&&f.jsx(Ts,{children:f.jsxs(Sn,{children:[f.jsx(En,{asChild:!0,children:f.jsx(ie,{variant:"ghost",className:"m-0 h-0 p-0 text-foreground/50 hover:text-foreground",onClick:n=>{var r;n.stopPropagation(),(r=t.onAddIssue)==null||r.call(t)},"aria-label":"Add Issue",children:f.jsx(bo,{className:"h-4 w-4"})})}),f.jsx(gn,{side:"top",children:"Add Issue"})]})})]})]});function mP(t,e,n,r){const s={...t};return e.top+t.y<=n.top?s.y=n.top-e.top:e.bottom+t.y>=n.top+n.height&&(s.y=n.top+n.height-e.bottom),e.left+t.x<=n.left?s.x=n.left-e.left:e.right+t.x+r>=n.left+n.width&&(s.x=n.left+n.width-e.right-r),{...s,x:s.x}}const gP=t=>{const{draggingNodeRect:e,transform:n,scrollableAncestorRects:r}=t,s=r[0];return!e||!s?n:mP(n,e,s,16)},bP=({children:t,onDragEnd:e,className:n,renderDragOverlay:r,collapsedColumns:s=new Set,totalColumns:i=0})=>{const[o,a]=y.useState(null),l=BD(FD(ob,{activationConstraint:{distance:8}})),c=(()=>{if(i===0)return"auto-cols-[minmax(200px,400px)]";const u=[];return(Array.isArray(t)?t:[t]).forEach(h=>{const p=h==null?void 0:h.key;p&&s.has(p)?u.push("48px"):u.push("minmax(200px, 1fr)")}),u.join(" ")})();return f.jsxs(PL,{collisionDetection:BS,onDragStart:u=>a(u.active.id),onDragEnd:u=>{a(null),e(u)},onDragCancel:()=>a(null),sensors:l,modifiers:[gP],children:[f.jsx("div",{className:_e("inline-grid h-full grid-flow-col divide-x border-x transition-all",n),style:{gridTemplateColumns:c},children:t}),f.jsx(nP,{dropAnimation:null,children:o&&r?r(o):null})]})},yP={0:"bg-red-600 dark:bg-red-700",1:"bg-orange-600 dark:bg-orange-700",2:"bg-yellow-600 dark:bg-yellow-700",3:"bg-blue-600 dark:bg-blue-700",4:"bg-gray-600 dark:bg-gray-700"},xP={0:"P0",1:"P1",2:"P2",3:"P3",4:"P4"};function Dx({issue:t,index:e,status:n,onViewDetails:r,isOpen:s}){const i=_r(),o=y.useCallback(()=>{r?r(t):i(`/issues/${t.id}`)},[t,r,i]),a=y.useRef(null);return y.useEffect(()=>{if(!s||!a.current)return;const l=a.current;requestAnimationFrame(()=>{l.scrollIntoView({block:"center",inline:"nearest",behavior:"smooth"})})},[s]),f.jsx(fP,{id:t.id,name:t.title,index:e,parent:n,onClick:o,isOpen:s,forwardedRef:a,className:t.archived?"opacity-60":"",children:f.jsxs("div",{className:"flex min-w-0 flex-1 flex-col items-start gap-2",children:[f.jsxs("div",{className:"flex w-full items-center justify-between gap-2",children:[f.jsx("div",{className:"text-xs text-muted-foreground",children:t.id}),t.priority!==void 0&&t.priority<=3&&f.jsx("span",{className:`shrink-0 rounded-full px-2 py-0.5 text-xs text-white ${yP[t.priority]}`,children:xP[t.priority]})]}),f.jsx("h4",{className:"text-md line-clamp-2 min-w-0 flex-1 font-medium",children:t.title}),t.content&&f.jsx("p",{className:"line-clamp-2 break-words text-xs text-muted-foreground",children:(()=>{const l=t.content.replace(/^#+ /gm,"").replace(/\*\*(.+?)\*\*/g,"$1").replace(/\*(.+?)\*/g,"$1").replace(/\[(.+?)\]\(.+?\)/g,"$1").replace(/`(.+?)`/g,"$1").trim();return l.length>100?`${l.substring(0,100)}...`:l})()})]})},t.id)}const Lx=["blocked","open","in_progress","needs_review","closed"],vP={open:"Open",in_progress:"In Progress",blocked:"Blocked",needs_review:"Needs Review",closed:"Closed"},wP={open:"--chart-3",in_progress:"--chart-2",blocked:"--chart-1",needs_review:"--chart-4",closed:"--chart-5"};function kP({groupedIssues:t,onDragEnd:e,onViewIssueDetails:n,selectedIssue:r,onArchiveAllClosed:s,collapsedColumns:i=new Set,onToggleColumnCollapse:o}){const a=l=>{if(!l)return null;for(const[c,u]of Object.entries(t)){const d=u.find(h=>h.id===l);if(d){const h=u.indexOf(d);return f.jsx(Dx,{issue:d,index:h,status:c,onViewDetails:n,isOpen:!1})}}return null};return f.jsx(bP,{onDragEnd:e,renderDragOverlay:a,collapsedColumns:i,totalColumns:Lx.length,children:Lx.map(l=>{const c=t[l]||[],u=i.has(l);return f.jsxs(dP,{id:l,"data-column-id":l,collapsed:u,children:[f.jsx(pP,{name:vP[l],color:wP[l],count:c.length,onArchiveAll:l==="closed"?s:void 0,collapsed:u,onToggleCollapse:o?()=>o(l):void 0}),f.jsx(hP,{collapsed:u,children:c.map((d,h)=>f.jsx(Dx,{issue:d,index:h,status:l,onViewDetails:n,isOpen:(r==null?void 0:r.id)===d.id},d.id))})]},l)})})}const id=y.memo(kP);function bn(t){const e=Object.prototype.toString.call(t);return t instanceof Date||typeof t=="object"&&e==="[object Date]"?new t.constructor(+t):typeof t=="number"||e==="[object Number]"||typeof t=="string"||e==="[object String]"?new Date(t):new Date(NaN)}function SP(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}const iu=43200,Px=1440;let EP={};function CP(){return EP}function jx(t){const e=bn(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function zu(t,e){const n=bn(t),r=bn(e),s=n.getTime()-r.getTime();return s<0?-1:s>0?1:s}function NP(t){return SP(t,Date.now())}function _P(t,e){const n=bn(t),r=bn(e),s=n.getFullYear()-r.getFullYear(),i=n.getMonth()-r.getMonth();return s*12+i}function TP(t){return e=>{const r=(t?Math[t]:Math.trunc)(e);return r===0?0:r}}function AP(t,e){return+bn(t)-+bn(e)}function MP(t){const e=bn(t);return e.setHours(23,59,59,999),e}function RP(t){const e=bn(t),n=e.getMonth();return e.setFullYear(e.getFullYear(),n+1,0),e.setHours(23,59,59,999),e}function OP(t){const e=bn(t);return+MP(e)==+RP(e)}function IP(t,e){const n=bn(t),r=bn(e),s=zu(n,r),i=Math.abs(_P(n,r));let o;if(i<1)o=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-s*i);let a=zu(n,r)===-s;OP(bn(t))&&i===1&&zu(t,r)===1&&(a=!1),o=s*(i-Number(a))}return o===0?0:o}function DP(t,e,n){const r=AP(t,e)/1e3;return TP(n==null?void 0:n.roundingMethod)(r)}const LP={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},PP=(t,e,n)=>{let r;const s=LP[t];return typeof s=="string"?r=s:e===1?r=s.one:r=s.other.replace("{{count}}",e.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function Rh(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const jP={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},zP={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},FP={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},BP={date:Rh({formats:jP,defaultWidth:"full"}),time:Rh({formats:zP,defaultWidth:"full"}),dateTime:Rh({formats:FP,defaultWidth:"full"})},$P={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},HP=(t,e,n,r)=>$P[t];function il(t){return(e,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let s;if(r==="formatting"&&t.formattingValues){const o=t.defaultFormattingWidth||t.defaultWidth,a=n!=null&&n.width?String(n.width):o;s=t.formattingValues[a]||t.formattingValues[o]}else{const o=t.defaultWidth,a=n!=null&&n.width?String(n.width):t.defaultWidth;s=t.values[a]||t.values[o]}const i=t.argumentCallback?t.argumentCallback(e):e;return s[i]}}const UP={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},VP={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},WP={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},qP={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},KP={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},GP={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},JP=(t,e)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},YP={ordinalNumber:JP,era:il({values:UP,defaultWidth:"wide"}),quarter:il({values:VP,defaultWidth:"wide",argumentCallback:t=>t-1}),month:il({values:WP,defaultWidth:"wide"}),day:il({values:qP,defaultWidth:"wide"}),dayPeriod:il({values:KP,defaultWidth:"wide",formattingValues:GP,defaultFormattingWidth:"wide"})};function ol(t){return(e,n={})=>{const r=n.width,s=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],i=e.match(s);if(!i)return null;const o=i[0],a=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],l=Array.isArray(a)?XP(a,d=>d.test(o)):ZP(a,d=>d.test(o));let c;c=t.valueCallback?t.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;const u=e.slice(o.length);return{value:c,rest:u}}}function ZP(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function XP(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n}function QP(t){return(e,n={})=>{const r=e.match(t.matchPattern);if(!r)return null;const s=r[0],i=e.match(t.parsePattern);if(!i)return null;let o=t.valueCallback?t.valueCallback(i[0]):i[0];o=n.valueCallback?n.valueCallback(o):o;const a=e.slice(s.length);return{value:o,rest:a}}}const ej=/^(\d+)(th|st|nd|rd)?/i,tj=/\d+/i,nj={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},rj={any:[/^b/i,/^(a|c)/i]},sj={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},ij={any:[/1/i,/2/i,/3/i,/4/i]},oj={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},aj={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},lj={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},cj={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},uj={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},dj={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},fj={ordinalNumber:QP({matchPattern:ej,parsePattern:tj,valueCallback:t=>parseInt(t,10)}),era:ol({matchPatterns:nj,defaultMatchWidth:"wide",parsePatterns:rj,defaultParseWidth:"any"}),quarter:ol({matchPatterns:sj,defaultMatchWidth:"wide",parsePatterns:ij,defaultParseWidth:"any",valueCallback:t=>t+1}),month:ol({matchPatterns:oj,defaultMatchWidth:"wide",parsePatterns:aj,defaultParseWidth:"any"}),day:ol({matchPatterns:lj,defaultMatchWidth:"wide",parsePatterns:cj,defaultParseWidth:"any"}),dayPeriod:ol({matchPatterns:uj,defaultMatchWidth:"any",parsePatterns:dj,defaultParseWidth:"any"})},hj={code:"en-US",formatDistance:PP,formatLong:BP,formatRelative:HP,localize:YP,match:fj,options:{weekStartsOn:0,firstWeekContainsDate:1}};function pj(t,e,n){const r=CP(),s=(n==null?void 0:n.locale)??r.locale??hj,i=2520,o=zu(t,e);if(isNaN(o))throw new RangeError("Invalid time value");const a=Object.assign({},n,{addSuffix:n==null?void 0:n.addSuffix,comparison:o});let l,c;o>0?(l=bn(e),c=bn(t)):(l=bn(t),c=bn(e));const u=DP(c,l),d=(jx(c)-jx(l))/1e3,h=Math.round((u-d)/60);let p;if(h<2)return n!=null&&n.includeSeconds?u<5?s.formatDistance("lessThanXSeconds",5,a):u<10?s.formatDistance("lessThanXSeconds",10,a):u<20?s.formatDistance("lessThanXSeconds",20,a):u<40?s.formatDistance("halfAMinute",0,a):u<60?s.formatDistance("lessThanXMinutes",1,a):s.formatDistance("xMinutes",1,a):h===0?s.formatDistance("lessThanXMinutes",1,a):s.formatDistance("xMinutes",h,a);if(h<45)return s.formatDistance("xMinutes",h,a);if(h<90)return s.formatDistance("aboutXHours",1,a);if(h<Px){const m=Math.round(h/60);return s.formatDistance("aboutXHours",m,a)}else{if(h<i)return s.formatDistance("xDays",1,a);if(h<iu){const m=Math.round(h/Px);return s.formatDistance("xDays",m,a)}else if(h<iu*2)return p=Math.round(h/iu),s.formatDistance("aboutXMonths",p,a)}if(p=IP(c,l),p<12){const m=Math.round(h/iu);return s.formatDistance("xMonths",m,a)}else{const m=p%12,g=Math.trunc(p/12);return m<3?s.formatDistance("aboutXYears",g,a):m<9?s.formatDistance("overXYears",g,a):s.formatDistance("almostXYears",g+1,a)}}function oo(t,e){return pj(t,NP(t),e)}const ns=y.forwardRef(({className:t,type:e,...n},r)=>f.jsx("input",{type:e,className:_e("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:r,...n}));ns.displayName="Input";function zx(t,[e,n]){return Math.min(n,Math.max(e,t))}function mj(t){const e=gj(t),n=y.forwardRef((r,s)=>{const{children:i,...o}=r,a=y.Children.toArray(i),l=a.find(yj);if(l){const c=l.props.children,u=a.map(d=>d===l?y.Children.count(c)>1?y.Children.only(null):y.isValidElement(c)?c.props.children:null:d);return f.jsx(e,{...o,ref:s,children:y.isValidElement(c)?y.cloneElement(c,void 0,u):null})}return f.jsx(e,{...o,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function gj(t){const e=y.forwardRef((n,r)=>{const{children:s,...i}=n;if(y.isValidElement(s)){const o=vj(s),a=xj(i,s.props);return s.type!==y.Fragment&&(a.ref=r?Ig(r,o):o),y.cloneElement(s,a)}return y.Children.count(s)>1?y.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var bj=Symbol("radix.slottable");function yj(t){return y.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===bj}function xj(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...a)=>{const l=i(...a);return s(...a),l}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function vj(t){var r,s;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function wj(t){const e=y.useRef({value:t,previous:t});return y.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var kj=[" ","Enter","ArrowUp","ArrowDown"],Sj=[" ","Enter"],xo="Select",[Lf,Pf,Ej]=sM(xo),[Ja]=gf(xo,[Ej,Fa]),jf=Fa(),[Cj,Ai]=Ja(xo),[Nj,_j]=Ja(xo),iE=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:s,onOpenChange:i,value:o,defaultValue:a,onValueChange:l,dir:c,name:u,autoComplete:d,disabled:h,required:p,form:m}=t,g=jf(e),[b,x]=y.useState(null),[w,v]=y.useState(null),[k,N]=y.useState(!1),S=oM(c),[C,T]=Gu({prop:r,defaultProp:s??!1,onChange:i,caller:xo}),[R,_]=Gu({prop:o,defaultProp:a,onChange:l,caller:xo}),I=y.useRef(null),D=b?m||!!b.closest("form"):!0,[V,j]=y.useState(new Set),L=Array.from(V).map(q=>q.props.value).join(";");return f.jsx(_g,{...g,children:f.jsxs(Cj,{required:p,scope:e,trigger:b,onTriggerChange:x,valueNode:w,onValueNodeChange:v,valueNodeHasChildren:k,onValueNodeHasChildrenChange:N,contentId:yc(),value:R,onValueChange:_,open:C,onOpenChange:T,dir:S,triggerPointerDownPosRef:I,disabled:h,children:[f.jsx(Lf.Provider,{scope:e,children:f.jsx(Nj,{scope:t.__scopeSelect,onNativeOptionAdd:y.useCallback(q=>{j(re=>new Set(re).add(q))},[]),onNativeOptionRemove:y.useCallback(q=>{j(re=>{const X=new Set(re);return X.delete(q),X})},[]),children:n})}),D?f.jsxs(AE,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:R,onChange:q=>_(q.target.value),disabled:h,form:m,children:[R===void 0?f.jsx("option",{value:""}):null,Array.from(V)]},L):null]})})};iE.displayName=xo;var oE="SelectTrigger",aE=y.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...s}=t,i=jf(n),o=Ai(oE,n),a=o.disabled||r,l=Tn(e,o.onTriggerChange),c=Pf(n),u=y.useRef("touch"),[d,h,p]=RE(g=>{const b=c().filter(v=>!v.disabled),x=b.find(v=>v.value===o.value),w=OE(b,g,x);w!==void 0&&o.onValueChange(w.value)}),m=g=>{a||(o.onOpenChange(!0),p()),g&&(o.triggerPointerDownPosRef.current={x:Math.round(g.pageX),y:Math.round(g.pageY)})};return f.jsx(yf,{asChild:!0,...i,children:f.jsx(yn.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":ME(o.value)?"":void 0,...s,ref:l,onClick:dt(s.onClick,g=>{g.currentTarget.focus(),u.current!=="mouse"&&m(g)}),onPointerDown:dt(s.onPointerDown,g=>{u.current=g.pointerType;const b=g.target;b.hasPointerCapture(g.pointerId)&&b.releasePointerCapture(g.pointerId),g.button===0&&g.ctrlKey===!1&&g.pointerType==="mouse"&&(m(g),g.preventDefault())}),onKeyDown:dt(s.onKeyDown,g=>{const b=d.current!=="";!(g.ctrlKey||g.altKey||g.metaKey)&&g.key.length===1&&h(g.key),!(b&&g.key===" ")&&kj.includes(g.key)&&(m(),g.preventDefault())})})})});aE.displayName=oE;var lE="SelectValue",cE=y.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:s,children:i,placeholder:o="",...a}=t,l=Ai(lE,n),{onValueNodeHasChildrenChange:c}=l,u=i!==void 0,d=Tn(e,l.onValueNodeChange);return wi(()=>{c(u)},[c,u]),f.jsx(yn.span,{...a,ref:d,style:{pointerEvents:"none"},children:ME(l.value)?f.jsx(f.Fragment,{children:o}):i})});cE.displayName=lE;var Tj="SelectIcon",uE=y.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...s}=t;return f.jsx(yn.span,{"aria-hidden":!0,...s,ref:e,children:r||"▼"})});uE.displayName=Tj;var Aj="SelectPortal",dE=t=>f.jsx(Eg,{asChild:!0,...t});dE.displayName=Aj;var vo="SelectContent",fE=y.forwardRef((t,e)=>{const n=Ai(vo,t.__scopeSelect),[r,s]=y.useState();if(wi(()=>{s(new DocumentFragment)},[]),!n.open){const i=r;return i?ci.createPortal(f.jsx(hE,{scope:t.__scopeSelect,children:f.jsx(Lf.Slot,{scope:t.__scopeSelect,children:f.jsx("div",{children:t.children})})}),i):null}return f.jsx(pE,{...t,ref:e})});fE.displayName=vo;var Rr=10,[hE,Mi]=Ja(vo),Mj="SelectContentImpl",Rj=mj("SelectContent.RemoveScroll"),pE=y.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:i,onPointerDownOutside:o,side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:h,collisionPadding:p,sticky:m,hideWhenDetached:g,avoidCollisions:b,...x}=t,w=Ai(vo,n),[v,k]=y.useState(null),[N,S]=y.useState(null),C=Tn(e,B=>k(B)),[T,R]=y.useState(null),[_,I]=y.useState(null),D=Pf(n),[V,j]=y.useState(!1),L=y.useRef(!1);y.useEffect(()=>{if(v)return vk(v)},[v]),wk();const q=y.useCallback(B=>{const[J,...K]=D().map(ye=>ye.ref.current),[Y]=K.slice(-1),le=document.activeElement;for(const ye of B)if(ye===le||(ye==null||ye.scrollIntoView({block:"nearest"}),ye===J&&N&&(N.scrollTop=0),ye===Y&&N&&(N.scrollTop=N.scrollHeight),ye==null||ye.focus(),document.activeElement!==le))return},[D,N]),re=y.useCallback(()=>q([T,v]),[q,T,v]);y.useEffect(()=>{V&&re()},[V,re]);const{onOpenChange:X,triggerPointerDownPosRef:ce}=w;y.useEffect(()=>{if(v){let B={x:0,y:0};const J=Y=>{var le,ye;B={x:Math.abs(Math.round(Y.pageX)-(((le=ce.current)==null?void 0:le.x)??0)),y:Math.abs(Math.round(Y.pageY)-(((ye=ce.current)==null?void 0:ye.y)??0))}},K=Y=>{B.x<=10&&B.y<=10?Y.preventDefault():v.contains(Y.target)||X(!1),document.removeEventListener("pointermove",J),ce.current=null};return ce.current!==null&&(document.addEventListener("pointermove",J),document.addEventListener("pointerup",K,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",J),document.removeEventListener("pointerup",K,{capture:!0})}}},[v,X,ce]),y.useEffect(()=>{const B=()=>X(!1);return window.addEventListener("blur",B),window.addEventListener("resize",B),()=>{window.removeEventListener("blur",B),window.removeEventListener("resize",B)}},[X]);const[A,ue]=RE(B=>{const J=D().filter(le=>!le.disabled),K=J.find(le=>le.ref.current===document.activeElement),Y=OE(J,B,K);Y&&setTimeout(()=>Y.ref.current.focus())}),be=y.useCallback((B,J,K)=>{const Y=!L.current&&!K;(w.value!==void 0&&w.value===J||Y)&&(R(B),Y&&(L.current=!0))},[w.value]),E=y.useCallback(()=>v==null?void 0:v.focus(),[v]),P=y.useCallback((B,J,K)=>{const Y=!L.current&&!K;(w.value!==void 0&&w.value===J||Y)&&I(B)},[w.value]),z=r==="popper"?pm:mE,H=z===pm?{side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:h,collisionPadding:p,sticky:m,hideWhenDetached:g,avoidCollisions:b}:{};return f.jsx(hE,{scope:n,content:v,viewport:N,onViewportChange:S,itemRefCallback:be,selectedItem:T,onItemLeave:E,itemTextRefCallback:P,focusSelectedItem:re,selectedItemText:_,position:r,isPositioned:V,searchRef:A,children:f.jsx(kk,{as:Rj,allowPinchZoom:!0,children:f.jsx(Sk,{asChild:!0,trapped:w.open,onMountAutoFocus:B=>{B.preventDefault()},onUnmountAutoFocus:dt(s,B=>{var J;(J=w.trigger)==null||J.focus({preventScroll:!0}),B.preventDefault()}),children:f.jsx(Cg,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:B=>B.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:f.jsx(z,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:B=>B.preventDefault(),...x,...H,onPlaced:()=>j(!0),ref:C,style:{display:"flex",flexDirection:"column",outline:"none",...x.style},onKeyDown:dt(x.onKeyDown,B=>{const J=B.ctrlKey||B.altKey||B.metaKey;if(B.key==="Tab"&&B.preventDefault(),!J&&B.key.length===1&&ue(B.key),["ArrowUp","ArrowDown","Home","End"].includes(B.key)){let Y=D().filter(le=>!le.disabled).map(le=>le.ref.current);if(["ArrowUp","End"].includes(B.key)&&(Y=Y.slice().reverse()),["ArrowUp","ArrowDown"].includes(B.key)){const le=B.target,ye=Y.indexOf(le);Y=Y.slice(ye+1)}setTimeout(()=>q(Y)),B.preventDefault()}})})})})})})});pE.displayName=Mj;var Oj="SelectItemAlignedPosition",mE=y.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...s}=t,i=Ai(vo,n),o=Mi(vo,n),[a,l]=y.useState(null),[c,u]=y.useState(null),d=Tn(e,C=>u(C)),h=Pf(n),p=y.useRef(!1),m=y.useRef(!0),{viewport:g,selectedItem:b,selectedItemText:x,focusSelectedItem:w}=o,v=y.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&c&&g&&b&&x){const C=i.trigger.getBoundingClientRect(),T=c.getBoundingClientRect(),R=i.valueNode.getBoundingClientRect(),_=x.getBoundingClientRect();if(i.dir!=="rtl"){const le=_.left-T.left,ye=R.left-le,Re=C.left-ye,Oe=C.width+Re,ht=Math.max(Oe,T.width),De=window.innerWidth-Rr,_t=zx(ye,[Rr,Math.max(Rr,De-ht)]);a.style.minWidth=Oe+"px",a.style.left=_t+"px"}else{const le=T.right-_.right,ye=window.innerWidth-R.right-le,Re=window.innerWidth-C.right-ye,Oe=C.width+Re,ht=Math.max(Oe,T.width),De=window.innerWidth-Rr,_t=zx(ye,[Rr,Math.max(Rr,De-ht)]);a.style.minWidth=Oe+"px",a.style.right=_t+"px"}const I=h(),D=window.innerHeight-Rr*2,V=g.scrollHeight,j=window.getComputedStyle(c),L=parseInt(j.borderTopWidth,10),q=parseInt(j.paddingTop,10),re=parseInt(j.borderBottomWidth,10),X=parseInt(j.paddingBottom,10),ce=L+q+V+X+re,A=Math.min(b.offsetHeight*5,ce),ue=window.getComputedStyle(g),be=parseInt(ue.paddingTop,10),E=parseInt(ue.paddingBottom,10),P=C.top+C.height/2-Rr,z=D-P,H=b.offsetHeight/2,B=b.offsetTop+H,J=L+q+B,K=ce-J;if(J<=P){const le=I.length>0&&b===I[I.length-1].ref.current;a.style.bottom="0px";const ye=c.clientHeight-g.offsetTop-g.offsetHeight,Re=Math.max(z,H+(le?E:0)+ye+re),Oe=J+Re;a.style.height=Oe+"px"}else{const le=I.length>0&&b===I[0].ref.current;a.style.top="0px";const Re=Math.max(P,L+g.offsetTop+(le?be:0)+H)+K;a.style.height=Re+"px",g.scrollTop=J-P+g.offsetTop}a.style.margin=`${Rr}px 0`,a.style.minHeight=A+"px",a.style.maxHeight=D+"px",r==null||r(),requestAnimationFrame(()=>p.current=!0)}},[h,i.trigger,i.valueNode,a,c,g,b,x,i.dir,r]);wi(()=>v(),[v]);const[k,N]=y.useState();wi(()=>{c&&N(window.getComputedStyle(c).zIndex)},[c]);const S=y.useCallback(C=>{C&&m.current===!0&&(v(),w==null||w(),m.current=!1)},[v,w]);return f.jsx(Dj,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:p,onScrollButtonChange:S,children:f.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:f.jsx(yn.div,{...s,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});mE.displayName=Oj;var Ij="SelectPopperPosition",pm=y.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=Rr,...i}=t,o=jf(n);return f.jsx(Ng,{...o,...i,ref:e,align:r,collisionPadding:s,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});pm.displayName=Ij;var[Dj,cb]=Ja(vo,{}),mm="SelectViewport",gE=y.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...s}=t,i=Mi(mm,n),o=cb(mm,n),a=Tn(e,i.onViewportChange),l=y.useRef(0);return f.jsxs(f.Fragment,{children:[f.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),f.jsx(Lf.Slot,{scope:n,children:f.jsx(yn.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:dt(s.onScroll,c=>{const u=c.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:h}=o;if(h!=null&&h.current&&d){const p=Math.abs(l.current-u.scrollTop);if(p>0){const m=window.innerHeight-Rr*2,g=parseFloat(d.style.minHeight),b=parseFloat(d.style.height),x=Math.max(g,b);if(x<m){const w=x+p,v=Math.min(m,w),k=w-v;d.style.height=v+"px",d.style.bottom==="0px"&&(u.scrollTop=k>0?k:0,d.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});gE.displayName=mm;var bE="SelectGroup",[Lj,Pj]=Ja(bE),jj=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=yc();return f.jsx(Lj,{scope:n,id:s,children:f.jsx(yn.div,{role:"group","aria-labelledby":s,...r,ref:e})})});jj.displayName=bE;var yE="SelectLabel",xE=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=Pj(yE,n);return f.jsx(yn.div,{id:s.id,...r,ref:e})});xE.displayName=yE;var od="SelectItem",[zj,vE]=Ja(od),wE=y.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:i,...o}=t,a=Ai(od,n),l=Mi(od,n),c=a.value===r,[u,d]=y.useState(i??""),[h,p]=y.useState(!1),m=Tn(e,w=>{var v;return(v=l.itemRefCallback)==null?void 0:v.call(l,w,r,s)}),g=yc(),b=y.useRef("touch"),x=()=>{s||(a.onValueChange(r),a.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return f.jsx(zj,{scope:n,value:r,disabled:s,textId:g,isSelected:c,onItemTextChange:y.useCallback(w=>{d(v=>v||((w==null?void 0:w.textContent)??"").trim())},[]),children:f.jsx(Lf.ItemSlot,{scope:n,value:r,disabled:s,textValue:u,children:f.jsx(yn.div,{role:"option","aria-labelledby":g,"data-highlighted":h?"":void 0,"aria-selected":c&&h,"data-state":c?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...o,ref:m,onFocus:dt(o.onFocus,()=>p(!0)),onBlur:dt(o.onBlur,()=>p(!1)),onClick:dt(o.onClick,()=>{b.current!=="mouse"&&x()}),onPointerUp:dt(o.onPointerUp,()=>{b.current==="mouse"&&x()}),onPointerDown:dt(o.onPointerDown,w=>{b.current=w.pointerType}),onPointerMove:dt(o.onPointerMove,w=>{var v;b.current=w.pointerType,s?(v=l.onItemLeave)==null||v.call(l):b.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:dt(o.onPointerLeave,w=>{var v;w.currentTarget===document.activeElement&&((v=l.onItemLeave)==null||v.call(l))}),onKeyDown:dt(o.onKeyDown,w=>{var k;((k=l.searchRef)==null?void 0:k.current)!==""&&w.key===" "||(Sj.includes(w.key)&&x(),w.key===" "&&w.preventDefault())})})})})});wE.displayName=od;var ml="SelectItemText",kE=y.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:s,...i}=t,o=Ai(ml,n),a=Mi(ml,n),l=vE(ml,n),c=_j(ml,n),[u,d]=y.useState(null),h=Tn(e,x=>d(x),l.onItemTextChange,x=>{var w;return(w=a.itemTextRefCallback)==null?void 0:w.call(a,x,l.value,l.disabled)}),p=u==null?void 0:u.textContent,m=y.useMemo(()=>f.jsx("option",{value:l.value,disabled:l.disabled,children:p},l.value),[l.disabled,l.value,p]),{onNativeOptionAdd:g,onNativeOptionRemove:b}=c;return wi(()=>(g(m),()=>b(m)),[g,b,m]),f.jsxs(f.Fragment,{children:[f.jsx(yn.span,{id:l.textId,...i,ref:h}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren?ci.createPortal(i.children,o.valueNode):null]})});kE.displayName=ml;var SE="SelectItemIndicator",EE=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return vE(SE,n).isSelected?f.jsx(yn.span,{"aria-hidden":!0,...r,ref:e}):null});EE.displayName=SE;var gm="SelectScrollUpButton",CE=y.forwardRef((t,e)=>{const n=Mi(gm,t.__scopeSelect),r=cb(gm,t.__scopeSelect),[s,i]=y.useState(!1),o=Tn(e,r.onScrollButtonChange);return wi(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollTop>0;i(c)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?f.jsx(_E,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});CE.displayName=gm;var bm="SelectScrollDownButton",NE=y.forwardRef((t,e)=>{const n=Mi(bm,t.__scopeSelect),r=cb(bm,t.__scopeSelect),[s,i]=y.useState(!1),o=Tn(e,r.onScrollButtonChange);return wi(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollHeight-l.clientHeight,u=Math.ceil(l.scrollTop)<c;i(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?f.jsx(_E,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});NE.displayName=bm;var _E=y.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=t,i=Mi("SelectScrollButton",n),o=y.useRef(null),a=Pf(n),l=y.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return y.useEffect(()=>()=>l(),[l]),wi(()=>{var u;const c=a().find(d=>d.ref.current===document.activeElement);(u=c==null?void 0:c.ref.current)==null||u.scrollIntoView({block:"nearest"})},[a]),f.jsx(yn.div,{"aria-hidden":!0,...s,ref:e,style:{flexShrink:0,...s.style},onPointerDown:dt(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:dt(s.onPointerMove,()=>{var c;(c=i.onItemLeave)==null||c.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:dt(s.onPointerLeave,()=>{l()})})}),Fj="SelectSeparator",TE=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return f.jsx(yn.div,{"aria-hidden":!0,...r,ref:e})});TE.displayName=Fj;var ym="SelectArrow",Bj=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=jf(n),i=Ai(ym,n),o=Mi(ym,n);return i.open&&o.position==="popper"?f.jsx(Tg,{...s,...r,ref:e}):null});Bj.displayName=ym;var $j="SelectBubbleInput",AE=y.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const s=y.useRef(null),i=Tn(r,s),o=wj(e);return y.useEffect(()=>{const a=s.current;if(!a)return;const l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(o!==e&&u){const d=new Event("change",{bubbles:!0});u.call(a,e),a.dispatchEvent(d)}},[o,e]),f.jsx(yn.select,{...n,style:{...Qk,...n.style},ref:i,defaultValue:e})});AE.displayName=$j;function ME(t){return t===""||t===void 0}function RE(t){const e=iM(t),n=y.useRef(""),r=y.useRef(0),s=y.useCallback(o=>{const a=n.current+o;e(a),(function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))})(a)},[e]),i=y.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return y.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,i]}function OE(t,e,n){const s=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let o=Hj(t,Math.max(i,0));s.length===1&&(o=o.filter(c=>c!==n));const l=o.find(c=>c.textValue.toLowerCase().startsWith(s.toLowerCase()));return l!==n?l:void 0}function Hj(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var Uj=iE,IE=aE,Vj=cE,Wj=uE,qj=dE,DE=fE,Kj=gE,LE=xE,PE=wE,Gj=kE,Jj=EE,jE=CE,zE=NE,FE=TE;const Jn=Uj,Yn=Vj,zn=y.forwardRef(({className:t,children:e,...n},r)=>f.jsxs(IE,{ref:r,className:_e("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,f.jsx(Wj,{asChild:!0,children:f.jsx($l,{className:"h-4 w-4 opacity-50"})})]}));zn.displayName=IE.displayName;const BE=y.forwardRef(({className:t,...e},n)=>f.jsx(jE,{ref:n,className:_e("flex cursor-default items-center justify-center py-1",t),...e,children:f.jsx(Hg,{className:"h-4 w-4"})}));BE.displayName=jE.displayName;const $E=y.forwardRef(({className:t,...e},n)=>f.jsx(zE,{ref:n,className:_e("flex cursor-default items-center justify-center py-1",t),...e,children:f.jsx($l,{className:"h-4 w-4"})}));$E.displayName=zE.displayName;const Fn=y.forwardRef(({className:t,children:e,position:n="popper",...r},s)=>f.jsx(qj,{children:f.jsxs(DE,{ref:s,className:_e("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...r,children:[f.jsx(BE,{}),f.jsx(Kj,{className:_e("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),f.jsx($E,{})]})}));Fn.displayName=DE.displayName;const Yj=y.forwardRef(({className:t,...e},n)=>f.jsx(LE,{ref:n,className:_e("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...e}));Yj.displayName=LE.displayName;const Mt=y.forwardRef(({className:t,children:e,...n},r)=>f.jsxs(PE,{ref:r,className:_e("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[f.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(Jj,{children:f.jsx(vf,{className:"h-4 w-4"})})}),f.jsx(Gj,{children:e})]}));Mt.displayName=PE.displayName;const Zj=y.forwardRef(({className:t,...e},n)=>f.jsx(FE,{ref:n,className:_e("-mx-1 my-1 h-px bg-muted",t),...e}));Zj.displayName=FE.displayName;var Xj=Symbol("radix.slottable");function Qj(t){const e=({children:n})=>f.jsx(f.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=Xj,e}var HE="AlertDialog",[e2]=gf(HE,[Ek]),Is=Ek(),UE=t=>{const{__scopeAlertDialog:e,...n}=t,r=Is(e);return f.jsx(yk,{...r,...n,modal:!0})};UE.displayName=HE;var t2="AlertDialogTrigger",n2=y.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=Is(n);return f.jsx(xk,{...s,...r,ref:e})});n2.displayName=t2;var r2="AlertDialogPortal",VE=t=>{const{__scopeAlertDialog:e,...n}=t,r=Is(e);return f.jsx(bk,{...r,...n})};VE.displayName=r2;var s2="AlertDialogOverlay",WE=y.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=Is(n);return f.jsx(Ag,{...s,...r,ref:e})});WE.displayName=s2;var aa="AlertDialogContent",[i2,o2]=e2(aa),a2=Qj("AlertDialogContent"),qE=y.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...s}=t,i=Is(n),o=y.useRef(null),a=Tn(e,o),l=y.useRef(null);return f.jsx(aM,{contentName:aa,titleName:KE,docsSlug:"alert-dialog",children:f.jsx(i2,{scope:n,cancelRef:l,children:f.jsxs(Mg,{role:"alertdialog",...i,...s,ref:a,onOpenAutoFocus:dt(s.onOpenAutoFocus,c=>{var u;c.preventDefault(),(u=l.current)==null||u.focus({preventScroll:!0})}),onPointerDownOutside:c=>c.preventDefault(),onInteractOutside:c=>c.preventDefault(),children:[f.jsx(a2,{children:r}),f.jsx(c2,{contentRef:o})]})})})});qE.displayName=aa;var KE="AlertDialogTitle",GE=y.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=Is(n);return f.jsx(Rg,{...s,...r,ref:e})});GE.displayName=KE;var JE="AlertDialogDescription",YE=y.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=Is(n);return f.jsx(Og,{...s,...r,ref:e})});YE.displayName=JE;var l2="AlertDialogAction",ZE=y.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=Is(n);return f.jsx(Ck,{...s,...r,ref:e})});ZE.displayName=l2;var XE="AlertDialogCancel",QE=y.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:s}=o2(XE,n),i=Is(n),o=Tn(e,s);return f.jsx(Ck,{...i,...r,ref:o})});QE.displayName=XE;var c2=({contentRef:t})=>{const e=`\`${aa}\` requires a description for the component to be accessible for screen reader users.
301
-
302
- You can add a description to the \`${aa}\` by passing a \`${JE}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
303
-
304
- Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${aa}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
305
-
306
- For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return y.useEffect(()=>{var r;document.getElementById((r=t.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},u2=UE,d2=VE,eC=WE,tC=qE,nC=ZE,rC=QE,sC=GE,iC=YE;const zf=u2,f2=d2,oC=y.forwardRef(({className:t,...e},n)=>f.jsx(eC,{className:_e("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:n}));oC.displayName=eC.displayName;const Ic=y.forwardRef(({className:t,...e},n)=>f.jsxs(f2,{children:[f.jsx(oC,{}),f.jsx(tC,{ref:n,className:_e("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...e})]}));Ic.displayName=tC.displayName;const Dc=({className:t,...e})=>f.jsx("div",{className:_e("flex flex-col space-y-2 text-center sm:text-left",t),...e});Dc.displayName="AlertDialogHeader";const Lc=({className:t,...e})=>f.jsx("div",{className:_e("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});Lc.displayName="AlertDialogFooter";const Pc=y.forwardRef(({className:t,...e},n)=>f.jsx(sC,{ref:n,className:_e("text-lg font-semibold",t),...e}));Pc.displayName=sC.displayName;const jc=y.forwardRef(({className:t,...e},n)=>f.jsx(iC,{ref:n,className:_e("text-sm text-muted-foreground",t),...e}));jc.displayName=iC.displayName;const zc=y.forwardRef(({className:t,...e},n)=>f.jsx(nC,{ref:n,className:_e(lb(),t),...e}));zc.displayName=nC.displayName;const Fc=y.forwardRef(({className:t,...e},n)=>f.jsx(rC,{ref:n,className:_e(lb({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));Fc.displayName=rC.displayName;function aC({issue:t,isOpen:e,onClose:n,onConfirm:r,isDeleting:s=!1}){return t?f.jsx(zf,{open:e,onOpenChange:n,children:f.jsxs(Ic,{children:[f.jsxs(Dc,{children:[f.jsx(Pc,{children:"Delete Issue"}),f.jsxs(jc,{children:["Are you sure you want to delete ",f.jsx("strong",{children:t.title})," (",t.id,")?",f.jsx("br",{}),"This action cannot be undone."]})]}),f.jsxs(Lc,{children:[f.jsx(Fc,{disabled:s,children:"Cancel"}),f.jsx(zc,{onClick:r,disabled:s,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:s?"Deleting...":"Delete"})]})]})}):null}const lC={blocks:"Blocks",related:"Related to","discovered-from":"Discovered from",implements:"Implements",references:"References","depends-on":"Depends on"},h2={blocks:"bg-red-600 dark:bg-red-700",related:"bg-blue-600 dark:bg-blue-700","discovered-from":"bg-purple-600 dark:bg-purple-700",implements:"bg-green-600 dark:bg-green-700",references:"bg-gray-600 dark:bg-gray-700","depends-on":"bg-orange-600 dark:bg-orange-700"};function p2(t){return{blocks:"Blocked by",related:"Related to","discovered-from":"Led to discovery of",implements:"Implemented by",references:"Referenced by","depends-on":"Required by"}[t]}function m2(t,e){const n=Array.isArray(t)?t:[];return{outgoing:n.filter(r=>r.from_id===e),incoming:n.filter(r=>r.to_id===e)}}function cC({relationships:t,currentEntityId:e,currentEntityType:n,onNavigate:r,onDelete:s,showEmpty:i=!0,showGroupHeaders:o=!0}){const a=m2(t,e);if(t.length===0&&i)return f.jsx("div",{className:"py-8 text-center text-sm text-muted-foreground",children:"No relationships yet"});if(t.length===0)return null;const l=(c,u)=>{const d=u==="outgoing",h=d?c.to_id:c.from_id,p=d?c.to_type:c.from_type,m=d?lC[c.relationship_type]:p2(c.relationship_type),g=h2[c.relationship_type],b=()=>p==="issue"?`/issues/${h}`:`/specs/${h}`,x=()=>p==="issue"?f.jsx(Ua,{className:"h-3 w-3"}):f.jsx(Os,{className:"h-3 w-3"}),w=()=>p==="issue"?"issue":"spec";return f.jsxs(Ht,{className:"group flex items-center gap-2 p-2 transition-colors hover:bg-accent/50",children:[f.jsx("span",{className:`shrink-0 rounded-full px-2 py-1 text-xs font-medium text-white ${g}`,children:m}),f.jsx(iR,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),f.jsx(Dg,{to:b(),className:"min-w-0 flex-1 no-underline",children:f.jsxs(et,{variant:w(),className:"inline-flex items-center gap-1",children:[x(),h]})}),s&&f.jsxs(Sn,{children:[f.jsx(En,{asChild:!0,children:f.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>s(c),className:"h-6 w-6 shrink-0 p-0 opacity-0 transition-opacity group-hover:opacity-100","aria-label":"Remove relationship",title:"Remove relationship",children:f.jsx(Do,{className:"h-3 w-3"})})}),f.jsx(gn,{children:"Remove relationship"})]})]},`${c.from_id}-${c.to_id}-${c.relationship_type}`)};if(!o){const c=[...a.outgoing.map(u=>({rel:u,direction:"outgoing"})),...a.incoming.map(u=>({rel:u,direction:"incoming"}))];return f.jsx(Ts,{delayDuration:300,children:f.jsx("div",{className:"space-y-2",children:c.map(({rel:u,direction:d})=>l(u,d))})})}return f.jsx(Ts,{delayDuration:300,children:f.jsxs("div",{className:"space-y-4",children:[a.outgoing.length>0&&f.jsxs("div",{children:[f.jsxs("h4",{className:"mb-2 text-sm font-medium text-muted-foreground",children:["Outgoing (",a.outgoing.length,")"]}),f.jsx("div",{className:"space-y-2",children:a.outgoing.map(c=>l(c,"outgoing"))})]}),a.incoming.length>0&&f.jsxs("div",{children:[f.jsxs("h4",{className:"mb-2 text-sm font-medium text-muted-foreground",children:["Incoming (",a.incoming.length,")"]}),f.jsx("div",{className:"space-y-2",children:a.incoming.map(c=>l(c,"incoming"))})]})]})})}var g2=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],b2=g2.reduce((t,e)=>{const n=sE(`Primitive.${e}`),r=y.forwardRef((s,i)=>{const{asChild:o,...a}=s,l=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(l,{...a,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),y2="Label",uC=y.forwardRef((t,e)=>f.jsx(b2.label,{...t,ref:e,onMouseDown:n=>{var s;n.target.closest("button, input, select, textarea")||((s=t.onMouseDown)==null||s.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));uC.displayName=y2;var dC=uC;const Zn=y.forwardRef(({className:t,...e},n)=>f.jsx(dC,{ref:n,className:_e("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t),...e}));Zn.displayName=dC.displayName;function x2(t){const e=v2(t),n=y.forwardRef((r,s)=>{const{children:i,...o}=r,a=y.Children.toArray(i),l=a.find(k2);if(l){const c=l.props.children,u=a.map(d=>d===l?y.Children.count(c)>1?y.Children.only(null):y.isValidElement(c)?c.props.children:null:d);return f.jsx(e,{...o,ref:s,children:y.isValidElement(c)?y.cloneElement(c,void 0,u):null})}return f.jsx(e,{...o,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function v2(t){const e=y.forwardRef((n,r)=>{const{children:s,...i}=n;if(y.isValidElement(s)){const o=E2(s),a=S2(i,s.props);return s.type!==y.Fragment&&(a.ref=r?Ig(r,o):o),y.cloneElement(s,a)}return y.Children.count(s)>1?y.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var w2=Symbol("radix.slottable");function k2(t){return y.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===w2}function S2(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...a)=>{const l=i(...a);return s(...a),l}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function E2(t){var r,s;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Ff="Popover",[fC]=gf(Ff,[Fa]),Bc=Fa(),[C2,Ri]=fC(Ff),hC=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!1}=t,a=Bc(e),l=y.useRef(null),[c,u]=y.useState(!1),[d,h]=Gu({prop:r,defaultProp:s??!1,onChange:i,caller:Ff});return f.jsx(_g,{...a,children:f.jsx(C2,{scope:e,contentId:yc(),triggerRef:l,open:d,onOpenChange:h,onOpenToggle:y.useCallback(()=>h(p=>!p),[h]),hasCustomAnchor:c,onCustomAnchorAdd:y.useCallback(()=>u(!0),[]),onCustomAnchorRemove:y.useCallback(()=>u(!1),[]),modal:o,children:n})})};hC.displayName=Ff;var pC="PopoverAnchor",N2=y.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Ri(pC,n),i=Bc(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:a}=s;return y.useEffect(()=>(o(),()=>a()),[o,a]),f.jsx(yf,{...i,...r,ref:e})});N2.displayName=pC;var mC="PopoverTrigger",gC=y.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Ri(mC,n),i=Bc(n),o=Tn(e,s.triggerRef),a=f.jsx(yn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":wC(s.open),...r,ref:o,onClick:dt(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?a:f.jsx(yf,{asChild:!0,...i,children:a})});gC.displayName=mC;var ub="PopoverPortal",[_2,T2]=fC(ub,{forceMount:void 0}),bC=t=>{const{__scopePopover:e,forceMount:n,children:r,container:s}=t,i=Ri(ub,e);return f.jsx(_2,{scope:e,forceMount:n,children:f.jsx(bf,{present:n||i.open,children:f.jsx(Eg,{asChild:!0,container:s,children:r})})})};bC.displayName=ub;var Aa="PopoverContent",yC=y.forwardRef((t,e)=>{const n=T2(Aa,t.__scopePopover),{forceMount:r=n.forceMount,...s}=t,i=Ri(Aa,t.__scopePopover);return f.jsx(bf,{present:r||i.open,children:i.modal?f.jsx(M2,{...s,ref:e}):f.jsx(R2,{...s,ref:e})})});yC.displayName=Aa;var A2=x2("PopoverContent.RemoveScroll"),M2=y.forwardRef((t,e)=>{const n=Ri(Aa,t.__scopePopover),r=y.useRef(null),s=Tn(e,r),i=y.useRef(!1);return y.useEffect(()=>{const o=r.current;if(o)return vk(o)},[]),f.jsx(kk,{as:A2,allowPinchZoom:!0,children:f.jsx(xC,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:dt(t.onCloseAutoFocus,o=>{var a;o.preventDefault(),i.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:dt(t.onPointerDownOutside,o=>{const a=o.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;i.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:dt(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),R2=y.forwardRef((t,e)=>{const n=Ri(Aa,t.__scopePopover),r=y.useRef(!1),s=y.useRef(!1);return f.jsx(xC,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,a;(o=t.onCloseAutoFocus)==null||o.call(t,i),i.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var l,c;(l=t.onInteractOutside)==null||l.call(t,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((c=n.triggerRef.current)==null?void 0:c.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),xC=y.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...d}=t,h=Ri(Aa,n),p=Bc(n);return wk(),f.jsx(Sk,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:f.jsx(Cg,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>h.onOpenChange(!1),children:f.jsx(Ng,{"data-state":wC(h.open),role:"dialog",id:h.contentId,...p,...d,ref:e,style:{...d.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),vC="PopoverClose",O2=y.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Ri(vC,n);return f.jsx(yn.button,{type:"button",...r,ref:e,onClick:dt(t.onClick,()=>s.onOpenChange(!1))})});O2.displayName=vC;var I2="PopoverArrow",D2=y.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Bc(n);return f.jsx(Tg,{...s,...r,ref:e})});D2.displayName=I2;function wC(t){return t?"open":"closed"}var L2=hC,P2=gC,j2=bC,kC=yC;const SC=L2,EC=P2,db=y.forwardRef(({className:t,align:e="center",sideOffset:n=4,...r},s)=>f.jsx(j2,{children:f.jsx(kC,{ref:s,align:e,sideOffset:n,className:_e("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...r})}));db.displayName=kC.displayName;function z2({entities:t,value:e,onChange:n,entityType:r,onEntityTypeChange:s,disabled:i=!1,placeholder:o}){const[a,l]=y.useState(!1),[c,u]=y.useState(""),d=y.useMemo(()=>{if(!c.trim())return t;const p=c.toLowerCase();return t.filter(m=>m.id.toLowerCase().includes(p)||m.title.toLowerCase().includes(p))},[t,c]),h=t.find(p=>p.id===e);return f.jsxs("div",{className:"space-y-2",children:[f.jsx(Zn,{htmlFor:"target-id",children:"Target Entity"}),f.jsxs("div",{className:"flex gap-2",children:[f.jsxs(Jn,{value:r,onValueChange:p=>{s(p),n(""),u("")},disabled:i,children:[f.jsx(zn,{className:"w-[120px]",children:f.jsx(Yn,{})}),f.jsxs(Fn,{children:[f.jsx(Mt,{value:"issue",children:"Issue"}),f.jsx(Mt,{value:"spec",children:"Spec"})]})]}),f.jsxs(SC,{open:a,onOpenChange:l,children:[f.jsx(EC,{asChild:!0,children:f.jsxs(ie,{variant:"outline",role:"combobox","aria-expanded":a,className:"flex-1 justify-between font-normal",disabled:i,children:[h?f.jsxs("span",{className:"truncate",children:[f.jsx("span",{className:"font-medium",children:h.id}),f.jsxs("span",{className:"text-muted-foreground",children:[" - ",h.title]})]}):f.jsx("span",{className:"text-muted-foreground",children:o||(r==="issue"?"Select issue...":"Select spec...")}),f.jsx(Hk,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),f.jsx(db,{className:"w-[--radix-popover-trigger-width] p-0",align:"start",children:f.jsxs("div",{className:"flex flex-col",children:[f.jsx("div",{className:"border-b p-2",children:f.jsx(ns,{placeholder:`Search ${r==="issue"?"issues":"specs"}...`,value:c,onChange:p=>u(p.target.value),className:"h-8",autoFocus:!0})}),f.jsx("div",{className:"max-h-60 overflow-auto",children:d.length===0?f.jsxs("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:["No ",r==="issue"?"issues":"specs"," found"]}):d.map(p=>f.jsxs("button",{type:"button",className:_e("flex w-full items-start gap-2 px-3 py-2 text-left text-sm hover:bg-accent hover:text-accent-foreground",e===p.id&&"bg-accent text-accent-foreground"),onClick:()=>{n(p.id),l(!1),u("")},children:[f.jsx(vf,{className:_e("mt-0.5 h-4 w-4 shrink-0",e===p.id?"opacity-100":"opacity-0")}),f.jsxs("div",{className:"flex-1 overflow-hidden",children:[f.jsx("div",{className:"font-medium",children:p.id}),f.jsx("div",{className:"truncate text-xs text-muted-foreground",children:p.title})]})]},p.id))})]})})]})]})]})}function $c(t){const e=ts(),{connected:n,subscribe:r,unsubscribe:s,addMessageHandler:i,removeMessageHandler:o}=$a(),a=Io({queryKey:t!==void 0?["specs",{archived:t}]:["specs"],queryFn:()=>ea.getAll(t)}),l=y.useCallback(m=>{(m.type==="spec_created"||m.type==="spec_updated"||m.type==="spec_deleted")&&e.invalidateQueries({queryKey:["specs"]})},[e]);y.useEffect(()=>{const m="useSpecs";return i(m,l),n&&r("spec"),()=>{o(m),s("spec")}},[n,r,s,i,o,l]);const c=Sr({mutationFn:({id:m,data:g})=>ea.update(m,g),onMutate:async({id:m,data:g})=>{await e.cancelQueries({queryKey:["specs"]});const b=e.getQueryData(["specs"]);return e.setQueryData(["specs"],x=>x==null?void 0:x.map(w=>w.id===m?{...w,...g}:w)),{previousSpecs:b}},onError:(m,g,b)=>{b!=null&&b.previousSpecs&&e.setQueryData(["specs"],b.previousSpecs)},onSettled:()=>{e.invalidateQueries({queryKey:["specs"]})}}),u=Sr({mutationFn:ea.create,onSuccess:()=>{e.invalidateQueries({queryKey:["specs"]})}}),d=Sr({mutationFn:ea.delete,onSuccess:()=>{e.invalidateQueries({queryKey:["specs"]})}}),h=m=>c.mutate({id:m,data:{archived:!0}}),p=m=>c.mutate({id:m,data:{archived:!1}});return{specs:a.data??[],isLoading:a.isLoading,isError:a.isError,error:a.error,updateSpec:c.mutate,updateSpecAsync:c.mutateAsync,createSpec:u.mutate,createSpecAsync:u.mutateAsync,deleteSpec:d.mutate,archiveSpec:h,unarchiveSpec:p,isUpdating:c.isPending,isCreating:u.isPending}}function F2(t){const e=ts(),{connected:n,subscribe:r,unsubscribe:s,addMessageHandler:i,removeMessageHandler:o}=$a(),a=Io({queryKey:["specs",t],queryFn:()=>ea.getById(t),enabled:!!t}),l=y.useCallback(c=>{c.type==="spec_updated"&&c.data.id===t&&e.invalidateQueries({queryKey:["specs",t]})},[t,e]);return y.useEffect(()=>{if(!t)return;const c=`useSpec-${t}`;return i(c,l),n&&r("spec",t),()=>{o(c),s("spec",t)}},[n,t,r,s,i,o,l]),{spec:a.data,isLoading:a.isLoading,isError:a.isError,error:a.error}}function B2(t){const e=ts(),{connected:n,subscribe:r,unsubscribe:s,addMessageHandler:i,removeMessageHandler:o}=$a(),a=Io({queryKey:["feedback",t],queryFn:()=>ea.getFeedback(t),enabled:!!t}),l=y.useCallback(c=>{(c.type==="feedback_created"||c.type==="feedback_updated"||c.type==="feedback_deleted")&&e.invalidateQueries({queryKey:["feedback",t]})},[t,e]);return y.useEffect(()=>{if(!t)return;const c=`useSpecFeedback-${t}`;return i(c,l),n&&r("all"),()=>{o(c),s("all")}},[n,t,r,s,i,o,l]),{feedback:a.data??[],isLoading:a.isLoading,isError:a.isError,error:a.error}}const $2=["blocks","related","discovered-from","implements","references","depends-on"];function CC({fromId:t,fromType:e,onSubmit:n,onCancel:r,inline:s=!1}){const[i,o]=y.useState(""),[a,l]=y.useState("issue"),[c,u]=y.useState("related"),[d,h]=y.useState(!1),{issues:p,isLoading:m}=Tc(!1),{specs:g,isLoading:b}=$c(!1),x=p.filter(C=>C.id!==t),w=g.filter(C=>C.id!==t),v=a==="issue"?x.map(C=>({id:C.id,title:C.title})):w.map(C=>({id:C.id,title:C.title})),k=a==="issue"?m:b,N=async C=>{if(C.preventDefault(),!!i.trim()){h(!0);try{await n(i.trim(),a,c),o(""),l("issue"),u("related")}finally{h(!1)}}},S=f.jsxs("form",{onSubmit:N,className:"space-y-4",onMouseDown:C=>{C.stopPropagation()},children:[f.jsx(z2,{entities:v,value:i,onChange:o,entityType:a,onEntityTypeChange:l,disabled:d||k,placeholder:k?"Loading...":a==="issue"?"Search issues...":"Search specs..."}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(Zn,{htmlFor:"relationship-type",children:"Relationship Type"}),f.jsxs(Jn,{value:c,onValueChange:C=>u(C),children:[f.jsx(zn,{id:"relationship-type",children:f.jsx(Yn,{})}),f.jsx(Fn,{children:$2.map(C=>f.jsx(Mt,{value:C,children:lC[C]},C))})]})]}),f.jsxs("div",{className:"flex justify-end gap-2",children:[r&&f.jsx(ie,{type:"button",variant:"outline",onClick:r,disabled:d,children:"Cancel"}),f.jsx(ie,{type:"submit",disabled:!i.trim()||d,children:"Create"})]})]});return s?S:f.jsx(Ht,{className:"p-4",children:S})}const Bf=y.forwardRef(({className:t,...e},n)=>f.jsx("textarea",{className:_e("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:n,...e}));Bf.displayName="Textarea";function H2({open:t,config:e,onConfigChange:n,onClose:r}){const s=i=>{i||r()};return f.jsx(Lo,{open:t,onOpenChange:s,modal:!0,children:f.jsxs(Ni,{className:"max-w-md",onPointerDownOutside:i=>{i.stopPropagation()},children:[f.jsxs(_i,{children:[f.jsx(Ti,{children:"Advanced Agent Settings"}),f.jsx(Ef,{children:"Configure advanced execution parameters for fine-tuned control."})]}),f.jsxs("div",{className:"space-y-4",children:[f.jsxs("div",{className:"space-y-2",children:[f.jsx(Zn,{htmlFor:"timeout",children:"Timeout (ms)"}),f.jsx("input",{id:"timeout",type:"number",className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",value:e.timeout??"",onChange:i=>n({timeout:i.target.value?parseInt(i.target.value):void 0}),placeholder:"No timeout"}),f.jsx("p",{className:"text-xs text-muted-foreground",children:"Maximum execution time in milliseconds. Leave empty for no timeout."})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(Zn,{htmlFor:"maxTokens",children:"Max Tokens"}),f.jsx("input",{id:"maxTokens",type:"number",className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",value:e.maxTokens??"",onChange:i=>n({maxTokens:i.target.value?parseInt(i.target.value):void 0}),placeholder:"Model default"}),f.jsx("p",{className:"text-xs text-muted-foreground",children:"Maximum number of tokens to generate. Leave empty to use model default."})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(Zn,{htmlFor:"temperature",children:"Temperature"}),f.jsx("input",{id:"temperature",type:"number",step:"0.1",min:"0",max:"2",className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",value:e.temperature??"",onChange:i=>n({temperature:i.target.value?parseFloat(i.target.value):void 0}),placeholder:"Model default"}),f.jsx("p",{className:"text-xs text-muted-foreground",children:"Controls randomness (0-2). Lower is more focused, higher is more creative."})]})]}),f.jsx(Kg,{children:f.jsx(ie,{onClick:r,children:"Done"})})]})})}function U2({issueId:t,onStart:e,disabled:n=!1}){const[r,s]=y.useState(!0),[i,o]=y.useState(null),[a,l]=y.useState(""),[c,u]=y.useState({mode:"worktree",cleanupMode:"manual"}),[d,h]=y.useState(!1),p=y.useRef(null);y.useEffect(()=>{let v=!0;return(async()=>{if(v){s(!0);try{const N=await gr.prepare(t);v&&(o(N),u({...c,...N.defaultConfig}))}catch(N){console.error("Failed to prepare execution:",N)}finally{v&&s(!1)}}})(),()=>{v=!1}},[t]),y.useEffect(()=>{const v=p.current;if(!v)return;v.style.height="auto";const k=Math.min(v.scrollHeight,300);v.style.height=`${k}px`},[a]);const m=v=>{u({...c,...v})},g=()=>{e(c,a)},b=(i==null?void 0:i.errors)&&i.errors.length>0,x=(i==null?void 0:i.warnings)&&i.warnings.length>0,w=!r&&!b&&a.trim().length>0&&!n;return f.jsxs("div",{className:"space-y-3 p-4",children:[b&&f.jsx("div",{className:"rounded-lg border border-destructive bg-destructive/10 p-2",children:f.jsxs("div",{className:"flex items-start gap-2",children:[f.jsx(go,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-destructive"}),f.jsxs("div",{className:"flex-1 space-y-1",children:[f.jsx("p",{className:"text-xs font-medium text-destructive",children:"Errors"}),i.errors.map((v,k)=>f.jsx("p",{className:"text-xs text-destructive/90",children:v},k))]})]})}),x&&f.jsx("div",{className:"rounded-lg border border-yellow-500 bg-yellow-500/10 p-2",children:f.jsxs("div",{className:"flex items-start gap-2",children:[f.jsx(bR,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-yellow-600"}),f.jsxs("div",{className:"flex-1 space-y-1",children:[f.jsx("p",{className:"text-xs font-medium text-yellow-600",children:"Warnings"}),i.warnings.map((v,k)=>f.jsx("p",{className:"text-xs text-yellow-600/90",children:v},k))]})]})}),f.jsx("div",{children:f.jsx(Bf,{ref:p,value:a,onChange:v=>l(v.target.value),placeholder:r?"Loading prompt...":"Enter prompt for the agent...",disabled:r,className:"max-h-[300px] min-h-0 resize-none overflow-y-auto border-none bg-muted/80 py-2 text-sm shadow-none transition-[height] duration-100 focus-visible:ring-0 focus-visible:ring-offset-0",style:{height:"auto"},rows:1})}),f.jsxs("div",{className:"flex items-center gap-2",children:[(i==null?void 0:i.availableModels)&&f.jsxs(Jn,{value:c.model,onValueChange:v=>m({model:v}),disabled:r,children:[f.jsx(zn,{className:"h-8 w-[140px] text-xs",children:f.jsx(Yn,{placeholder:"Model"})}),f.jsx(Fn,{children:i.availableModels.map(v=>f.jsx(Mt,{value:v,className:"text-xs",children:v},v))})]}),f.jsxs(Jn,{value:c.mode,onValueChange:v=>m({mode:v}),disabled:r,children:[f.jsx(zn,{className:"h-8 w-[140px] text-xs",children:f.jsx(Yn,{})}),f.jsxs(Fn,{children:[f.jsx(Mt,{value:"worktree",className:"text-xs",children:"Worktree"}),f.jsx(Mt,{value:"local",className:"text-xs",children:"Local"})]})]}),c.mode==="worktree"&&(i==null?void 0:i.availableBranches)&&f.jsxs(Jn,{value:c.baseBranch,onValueChange:v=>m({baseBranch:v}),disabled:r,children:[f.jsx(zn,{className:"h-8 w-[120px] text-xs",children:f.jsx(Yn,{placeholder:"Branch"})}),f.jsx(Fn,{children:i.availableBranches.map(v=>f.jsx(Mt,{value:v,className:"text-xs",children:v},v))})]}),f.jsxs(Jn,{value:c.cleanupMode,onValueChange:v=>m({cleanupMode:v}),disabled:r,children:[f.jsx(zn,{className:"h-8 w-[120px] text-xs",children:f.jsx(Yn,{})}),f.jsxs(Fn,{children:[f.jsx(Mt,{value:"auto",className:"text-xs",children:"Auto Cleanup"}),f.jsx(Mt,{value:"manual",className:"text-xs",children:"Manual"}),f.jsx(Mt,{value:"never",className:"text-xs",children:"Never"})]})]}),f.jsx("div",{className:"ml-auto"}),f.jsxs(Sn,{children:[f.jsx(En,{asChild:!0,children:f.jsx(ie,{variant:"outline",size:"sm",onClick:()=>h(!0),disabled:r,className:"h-8 px-2",children:f.jsx(rm,{className:"h-4 w-4"})})}),f.jsx(gn,{children:"Advanced settings"})]}),f.jsxs(ie,{onClick:g,disabled:!w,size:"sm",className:"h-8 gap-2 font-semibold",children:[f.jsx(_R,{className:"h-4 w-4"}),"Run"]})]}),f.jsx(H2,{open:d,config:c,onConfigChange:m,onClose:()=>h(!1)})]})}function V2(){const t=ts(),e=Sr({mutationFn:r=>ia.create(r),onSuccess:()=>{t.invalidateQueries({queryKey:["issue-relationships"]})}}),n=Sr({mutationFn:r=>ia.delete(r),onSuccess:()=>{t.invalidateQueries({queryKey:["issue-relationships"]})}});return{createRelationship:e.mutate,createRelationshipAsync:e.mutateAsync,deleteRelationship:n.mutate,deleteRelationshipAsync:n.mutateAsync,isCreating:e.isPending,isDeleting:n.isPending}}var Oh={exports:{}},Ih={};/**
307
- * @license React
308
- * use-sync-external-store-shim.production.js
309
- *
310
- * Copyright (c) Meta Platforms, Inc. and affiliates.
311
- *
312
- * This source code is licensed under the MIT license found in the
313
- * LICENSE file in the root directory of this source tree.
314
- */var Fx;function W2(){if(Fx)return Ih;Fx=1;var t=_k();function e(d,h){return d===h&&(d!==0||1/d===1/h)||d!==d&&h!==h}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,s=t.useEffect,i=t.useLayoutEffect,o=t.useDebugValue;function a(d,h){var p=h(),m=r({inst:{value:p,getSnapshot:h}}),g=m[0].inst,b=m[1];return i(function(){g.value=p,g.getSnapshot=h,l(g)&&b({inst:g})},[d,p,h]),s(function(){return l(g)&&b({inst:g}),d(function(){l(g)&&b({inst:g})})},[d]),o(p),p}function l(d){var h=d.getSnapshot;d=d.value;try{var p=h();return!n(d,p)}catch{return!0}}function c(d,h){return h()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return Ih.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:u,Ih}var Bx;function NC(){return Bx||(Bx=1,Oh.exports=W2()),Oh.exports}var _C=NC();function hn(t){this.content=t}hn.prototype={constructor:hn,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,s=r.find(t),i=r.content.slice();return s==-1?i.push(n||t,e):(i[s+1]=e,n&&(i[s]=n)),new hn(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new hn(n)},addToStart:function(t,e){return new hn([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new hn(n)},addBefore:function(t,e,n){var r=this.remove(e),s=r.content.slice(),i=r.find(t);return s.splice(i==-1?s.length:i,0,e,n),new hn(s)},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=hn.from(t),t.size?new hn(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=hn.from(t),t.size?new hn(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=hn.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}};hn.from=function(t){if(t instanceof hn)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new hn(e)};function TC(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let s=t.child(r),i=e.child(r);if(s==i){n+=s.nodeSize;continue}if(!s.sameMarkup(i))return n;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)n++;return n}if(s.content.size||i.content.size){let o=TC(s.content,i.content,n+1);if(o!=null)return o}n+=s.nodeSize}}function AC(t,e,n,r){for(let s=t.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:n,b:r};let o=t.child(--s),a=e.child(--i),l=o.nodeSize;if(o==a){n-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:n,b:r};if(o.isText&&o.text!=a.text){let c=0,u=Math.min(o.text.length,a.text.length);for(;c<u&&o.text[o.text.length-c-1]==a.text[a.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(o.content.size||a.content.size){let c=AC(o.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}class G{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,s=0,i){for(let o=0,a=0;a<n;o++){let l=this.content[o],c=a+l.nodeSize;if(c>e&&r(l,s+a,i||null,o)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,n-u),r,s+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,s){let i="",o=!0;return this.nodesBetween(e,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?s?typeof s=="function"?s(a):s:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(o?o=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(s[s.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new G(s,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],s=0;if(n>e)for(let i=0,o=0;o<n;i++){let a=this.content[i],l=o+a.nodeSize;l>e&&((o<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,n-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,n-o-1))),r.push(a),s+=a.nodeSize),o=l}return new G(r,s)}cutByIndex(e,n){return e==n?G.empty:e==0&&n==this.content.length?this:new G(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let s=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return s[e]=n,new G(s,i)}addToStart(e){return new G([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new G(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 s=this.content[n];e(s,r,n),r+=s.nodeSize}}findDiffStart(e,n=0){return TC(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return AC(this,e,n,r)}findIndex(e){if(e==0)return ou(0,e);if(e==this.size)return ou(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 s=this.child(n),i=r+s.nodeSize;if(i>=e)return i==e?ou(n+1,i):ou(n,r);r=i}}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 G.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new G(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return G.empty;let n,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(n||(n=e.slice(0,s)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new G(n||e,r)}static from(e){if(!e)return G.empty;if(e instanceof G)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new G([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}G.empty=new G([],0);const Dh={index:0,offset:0};function ou(t,e){return Dh.index=t,Dh.offset=e,Dh}function ad(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(!ad(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!ad(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let xt=class xm{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,s)),n.push(this),r=!0),n&&n.push(i)}}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&&ad(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 s=r.create(n.attrs);return r.checkAttrs(s.attrs),s}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 xm.none;if(e instanceof xm)return[e];let n=e.slice();return n.sort((r,s)=>r.type.rank-s.type.rank),n}};xt.none=[];class ld extends Error{}class ae{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=RC(this.content,e+this.openStart,n);return r&&new ae(r,this.openStart,this.openEnd)}removeBetween(e,n){return new ae(MC(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 ae.empty;let r=n.openStart||0,s=n.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new ae(G.fromJSON(e,n.content),r,s)}static maxOpen(e,n=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)s++;return new ae(e,r,s)}}ae.empty=new ae(G.empty,0,0);function MC(t,e,n){let{index:r,offset:s}=t.findIndex(e),i=t.maybeChild(r),{index:o,offset:a}=t.findIndex(n);if(s==e||i.isText){if(a!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(MC(i.content,e-s-1,n-s-1)))}function RC(t,e,n,r){let{index:s,offset:i}=t.findIndex(e),o=t.maybeChild(s);if(i==e||o.isText)return r&&!r.canReplace(s,s,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=RC(o.content,e-i-1,n,o);return a&&t.replaceChild(s,o.copy(a))}function q2(t,e,n){if(n.openStart>t.depth)throw new ld("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new ld("Inconsistent open depths");return OC(t,e,n,0)}function OC(t,e,n,r){let s=t.index(r),i=t.node(r);if(s==e.index(r)&&r<t.depth-n.openStart){let o=OC(t,e,n,r+1);return i.copy(i.content.replaceChild(s,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,a=o.content;return lo(o,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=K2(n,t);return lo(i,DC(t,o,a,e,r))}else return lo(i,cd(t,e,r))}function IC(t,e){if(!e.type.compatibleContent(t.type))throw new ld("Cannot join "+e.type.name+" onto "+t.type.name)}function vm(t,e,n){let r=t.node(n);return IC(r,e.node(n)),r}function ao(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 _l(t,e,n,r){let s=(e||t).node(n),i=0,o=e?e.index(n):s.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(ao(t.nodeAfter,r),i++));for(let a=i;a<o;a++)ao(s.child(a),r);e&&e.depth==n&&e.textOffset&&ao(e.nodeBefore,r)}function lo(t,e){return t.type.checkContent(e),t.copy(e)}function DC(t,e,n,r,s){let i=t.depth>s&&vm(t,e,s+1),o=r.depth>s&&vm(n,r,s+1),a=[];return _l(null,t,s,a),i&&o&&e.index(s)==n.index(s)?(IC(i,o),ao(lo(i,DC(t,e,n,r,s+1)),a)):(i&&ao(lo(i,cd(t,e,s+1)),a),_l(e,n,s,a),o&&ao(lo(o,cd(n,r,s+1)),a)),_l(r,null,s,a),new G(a)}function cd(t,e,n){let r=[];if(_l(null,t,n,r),t.depth>n){let s=vm(t,e,n+1);ao(lo(s,cd(t,e,n+1)),r)}return _l(e,null,n,r),new G(r)}function K2(t,e){let n=e.depth-t.openStart,s=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)s=e.node(i).copy(G.from(s));return{start:s.resolveNoCache(t.openStart+n),end:s.resolveNoCache(s.content.size-t.openEnd-n)}}class Kl{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],s=e.child(n);return r?e.child(n).cut(r):s}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],s=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return xt.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),s=e.maybeChild(n);if(!r){let a=r;r=s,s=a}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].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 ud(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=[],s=0,i=n;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(i),c=i-l;if(r.push(o,a,s+l),!c||(o=o.child(a),o.isText))break;i=c-1,s+=l+1}return new Kl(n,r,i)}static resolveCached(e,n){let r=$x.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==n)return o}else $x.set(e,r=new G2);let s=r.elts[r.i]=Kl.resolve(e,n);return r.i=(r.i+1)%J2,s}}class G2{constructor(){this.elts=[],this.i=0}}const J2=12,$x=new WeakMap;class ud{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 Y2=Object.create(null);let gi=class wm{constructor(e,n,r,s=xt.none){this.type=e,this.attrs=n,this.marks=s,this.content=r||G.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,s=0){this.content.nodesBetween(e,n,r,s,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,s){return this.content.textBetween(e,n,r,s)}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&&ad(this.attrs,n||e.defaultAttrs||Y2)&&xt.sameSet(this.marks,r||xt.none)}copy(e=null){return e==this.content?this:new wm(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new wm(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 ae.empty;let s=this.resolve(e),i=this.resolve(n),o=r?0:s.sharedDepth(n),a=s.start(o),c=s.node(o).content.cut(s.pos-a,i.pos-a);return new ae(c,s.depth-o,i.depth-o)}replace(e,n,r){return q2(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:s}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(s==e||n.isText)return n;e-=s+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 s=this.content.child(n-1);return{node:s,index:n-1,offset:r-s.nodeSize}}resolve(e){return Kl.resolveCached(this,e)}resolveNoCache(e){return Kl.resolve(this,e)}rangeHasMark(e,n,r){let s=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}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()+")"),LC(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=G.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),a=o&&o.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=s;l<i;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,n);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=xt.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(!xt.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 s=G.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,s,r);return i.type.checkAttrs(i.attrs),i}};gi.prototype.text=void 0;class dd extends gi{constructor(e,n,r,s){if(super(e,n,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):LC(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 dd(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new dd(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 LC(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class wo{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new Z2(e,n);if(r.next==null)return wo.empty;let s=PC(r);r.next&&r.err("Unexpected trailing text");let i=sz(rz(s));return iz(i,r),i}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 s=this;for(let i=n;s&&i<r;i++)s=s.matchType(e.child(i).type);return s}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 s=[this];function i(o,a){let l=o.matchFragment(e,r);if(l&&(!n||l.validEnd))return G.from(a.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let h=i(d,a.concat(u));if(h)return h}}return null}return i(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 s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let a=s;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:a,next:l}=i.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!s.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:s}),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 s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&n(r.next[s].next)}return n(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
315
- `)}}wo.empty=new wo(!0);class Z2{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 PC(t){let e=[];do e.push(X2(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function X2(t){let e=[];do e.push(Q2(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Q2(t){let e=nz(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=ez(t,e);else break;return e}function Hx(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function ez(t,e){let n=Hx(t),r=n;return t.eat(",")&&(t.next!="}"?r=Hx(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function tz(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let s=[];for(let i in n){let o=n[i];o.isInGroup(e)&&s.push(o)}return s.length==0&&t.err("No node type or group '"+e+"' found"),s}function nz(t){if(t.eat("(")){let e=PC(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=tz(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 rz(t){let e=[[]];return s(i(t,0),n()),e;function n(){return e.push([])-1}function r(o,a,l){let c={term:l,to:a};return e[o].push(c),c}function s(o,a){o.forEach(l=>l.to=a)}function i(o,a){if(o.type=="choice")return o.exprs.reduce((l,c)=>l.concat(i(c,a)),[]);if(o.type=="seq")for(let l=0;;l++){let c=i(o.exprs[l],a);if(l==o.exprs.length-1)return c;s(c,a=n())}else if(o.type=="star"){let l=n();return r(a,l),s(i(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=n();return s(i(o.expr,a),l),s(i(o.expr,l),l),[r(l)]}else{if(o.type=="opt")return[r(a)].concat(i(o.expr,a));if(o.type=="range"){let l=a;for(let c=0;c<o.min;c++){let u=n();s(i(o.expr,l),u),l=u}if(o.max==-1)s(i(o.expr,l),l);else for(let c=o.min;c<o.max;c++){let u=n();r(l,u),s(i(o.expr,l),u),l=u}return[r(l)]}else{if(o.type=="name")return[r(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function jC(t,e){return e-t}function Ux(t,e){let n=[];return r(e),n.sort(jC);function r(s){let i=t[s];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(s);for(let o=0;o<i.length;o++){let{term:a,to:l}=i[o];!a&&n.indexOf(l)==-1&&r(l)}}}function sz(t){let e=Object.create(null);return n(Ux(t,0));function n(r){let s=[];r.forEach(o=>{t[o].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<s.length;u++)s[u][0]==a&&(c=s[u][1]);Ux(t,l).forEach(u=>{c||s.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new wo(r.indexOf(t.length-1)>-1);for(let o=0;o<s.length;o++){let a=s[o][1].sort(jC);i.next.push({type:s[o][0],next:e[a.join(",")]||n(a)})}return i}}function iz(t,e){for(let n=0,r=[t];n<r.length;n++){let s=r[n],i=!s.validEnd,o=[];for(let a=0;a<s.next.length;a++){let{type:l,next:c}=s.next[a];o.push(l.name),i&&!(l.isText||l.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function zC(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 FC(t,e){let n=Object.create(null);for(let r in t){let s=e&&e[r];if(s===void 0){let i=t[r];if(i.hasDefault)s=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=s}return n}function BC(t,e,n,r){for(let s in e)if(!(s in t))throw new RangeError(`Unsupported attribute ${s} for ${n} of type ${s}`);for(let s in t){let i=t[s];i.validate&&i.validate(e[s])}}function $C(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new az(t,r,e[r]);return n}let Vx=class HC{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=$C(e,r.attrs),this.defaultAttrs=zC(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==wo.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:FC(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new gi(this,this.computeAttrs(e),G.from(n),xt.setFrom(r))}createChecked(e=null,n,r){return n=G.from(n),this.checkContent(n),new gi(this,this.computeAttrs(e),n,xt.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=G.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let s=this.contentMatch.matchFragment(n),i=s&&s.fillBefore(G.empty,!0);return i?new gi(this,e,n.append(i),xt.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){BC(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:xt.none:e}static compile(e,n){let r=Object.create(null);e.forEach((i,o)=>r[i]=new HC(i,n,o));let s=n.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function oz(t,e,n){let r=n.split("|");return s=>{let i=s===null?"null":typeof s;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}class az{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?oz(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class $f{constructor(e,n,r,s){this.name=e,this.rank=n,this.schema=r,this.spec=s,this.attrs=$C(e,s.attrs),this.excluded=null;let i=zC(this.attrs);this.instance=i?new xt(this,i):null}create(e=null){return!e&&this.instance?this.instance:new xt(this,FC(this.attrs,e))}static compile(e,n){let r=Object.create(null),s=0;return e.forEach((i,o)=>r[i]=new $f(i,s++,n,o)),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){BC(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}let UC=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let s in e)n[s]=e[s];n.nodes=hn.from(e.nodes),n.marks=hn.from(e.marks||{}),this.nodes=Vx.compile(this.spec.nodes,this),this.marks=$f.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let i=this.nodes[s],o=i.spec.content||"",a=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=wo.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=a=="_"?null:a?Wx(this,a.split(" ")):a==""||!i.inlineContent?[]:null}for(let s in this.marks){let i=this.marks[s],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:Wx(this,o.split(" "))}this.nodeFromJSON=s=>gi.fromJSON(this,s),this.markFromJSON=s=>xt.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Vx){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,s)}text(e,n){let r=this.nodes.text;return new dd(r,r.defaultAttrs,e,xt.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 Wx(t,e){let n=[];for(let r=0;r<e.length;r++){let s=e[r],i=t.marks[s],o=i;if(i)n.push(i);else for(let a in t.marks){let l=t.marks[a];(s=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(s)>-1)&&n.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function lz(t){return t.tag!=null}function cz(t){return t.style!=null}class bi{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(s=>{if(lz(s))this.tags.push(s);else if(cz(s)){let i=/[^=]*/.exec(s.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let i=e.nodes[s.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new Kx(this,n,!1);return r.addAll(e,xt.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Kx(this,n,!0);return r.addAll(e,xt.none,n.from,n.to),ae.maxOpen(r.finish())}matchTag(e,n,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let i=this.tags[s];if(fz(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let o=i.getAttrs(e);if(o===!1)continue;i.attrs=o||void 0}return i}}}matchStyle(e,n,r,s){for(let i=s?this.styles.indexOf(s)+1:0;i<this.styles.length;i++){let o=this.styles[i],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(o.getAttrs){let l=o.getAttrs(n);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let n=[];function r(s){let i=s.priority==null?50:s.priority,o=0;for(;o<n.length;o++){let a=n[o];if((a.priority==null?50:a.priority)<i)break}n.splice(o,0,s)}for(let s in e.marks){let i=e.marks[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Gx(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let i=e.nodes[s].spec.parseDOM;i&&i.forEach(o=>{r(o=Gx(o)),o.node||o.ignore||o.mark||(o.node=s)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new bi(e,bi.schemaRules(e)))}}const VC={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},uz={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},WC={ol:!0,ul:!0},Gl=1,km=2,Tl=4;function qx(t,e,n){return e!=null?(e?Gl:0)|(e==="full"?km:0):t&&t.whitespace=="pre"?Gl|km:n&~Tl}class au{constructor(e,n,r,s,i,o){this.type=e,this.attrs=n,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=xt.none,this.match=i||(o&Tl?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(G.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Gl)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-s[0].length))}}let n=G.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(G.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&&!VC.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Kx{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=n.topNode,i,o=qx(null,n.preserveWhitespace,0)|(r?Tl:0);s?i=new au(s.type,s.attrs,xt.none,!0,n.topMatch||s.type.contentMatch,o):r?i=new au(null,null,xt.none,!0,null,o):i=new au(e.schema.topNodeType,null,xt.none,!0,null,o),this.nodes=[i],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,s=this.top,i=s.options&km?"full":this.localPreserveWS||(s.options&Gl)>0,{schema:o}=this.parser;if(i==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
316
- `);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(o.linebreakReplacement.create(),n,!0),a[l]&&this.insertNode(o.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=s.content[s.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let s=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),a;WC.hasOwnProperty(o)&&this.parser.normalizeLists&&dz(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:uz.hasOwnProperty(o))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 c,u=this.needsBlock;if(VC.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.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),c&&this.sync(i),this.needsBlock=u}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=s}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
317
- `),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 s=0;s<this.parser.matchedStyles.length;s++){let i=this.parser.matchedStyles[s],o=r.getPropertyValue(i);if(o)for(let a=void 0;;){let l=this.parser.matchStyle(i,o,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(c=>!l.clearMark(c)):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,s){let i,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(o,n.attrs||null,r,n.preserveWhitespace);l&&(i=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);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)}i&&this.sync(a)&&this.open--}addAll(e,n,r,s){let i=r||0;for(let o=r?e.childNodes[r]:e.firstChild,a=s==null?null:e.childNodes[s];o!=a;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,n);this.findAtPoint(e,i)}findPlace(e,n,r){let s,i;for(let o=this.open,a=0;o>=0;o--){let l=this.nodes[o],c=l.findWrapping(e);if(c&&(!s||s.length>c.length+a)&&(s=c,i=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!s)return null;this.sync(i);for(let o=0;o<s.length;o++)n=this.enterInner(s[o],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let s=this.findPlace(e,n,r);if(s){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=xt.none;for(let a of s.concat(e.marks))(i.type?i.type.allowsMarkType(a.type):Jx(a.type,e.type))&&(o=a.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,n,r,s){let i=this.findPlace(e.create(n),r,!1);return i&&(i=this.enterInner(e,n,r,!0,s)),i}enterInner(e,n,r,s=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=qx(e,i,o.options);o.options&Tl&&o.content.length==0&&(a|=Tl);let l=xt.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):Jx(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new au(e,n,l,s,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|=Gl)}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 s=r.length-1;s>=0;s--)e+=r[s].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 s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&n.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].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,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(s?0:1),o=(a,l)=>{for(;a>=0;a--){let c=n[a];if(c==""){if(a==n.length-1||a==0)continue;for(;l>=i;l--)if(o(a-1,l))return!0;return!1}else{let u=l>0||l==0&&s?this.nodes[l].type:r&&l>=i?r.node(l-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return o(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 dz(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&WC.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function fz(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Gx(t){let e={};for(let n in t)e[n]=t[n];return e}function Jx(t,e){let n=e.schema.nodes;for(let r in n){let s=n[r];if(!s.allowsMarkType(t))continue;let i=[],o=a=>{i.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==e||i.indexOf(u)<0&&o(u))return!0}};if(o(s.contentMatch))return!0}}class Po{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Lh(n).createDocumentFragment());let s=r,i=[];return e.forEach(o=>{if(i.length||o.marks.length){let a=0,l=0;for(;a<i.length&&l<o.marks.length;){let c=o.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(i[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<i.length;)s=i.pop()[1];for(;l<o.marks.length;){let c=o.marks[l++],u=this.serializeMark(c,o.isInline,n);u&&(i.push([c,s]),s.appendChild(u.dom),s=u.contentDOM||u.dom)}}s.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:s}=Fu(Lh(n),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,s)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let s=e.marks.length-1;s>=0;s--){let i=this.serializeMark(e.marks[s],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let s=this.marks[e.type.name];return s&&Fu(Lh(r),s(e,n),null,e.attrs)}static renderSpec(e,n,r=null,s){return Fu(e,n,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Po(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Yx(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return Yx(e.marks)}}function Yx(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Lh(t){return t.document||window.document}const Zx=new WeakMap;function hz(t){let e=Zx.get(t);return e===void 0&&Zx.set(t,e=pz(t)),e}function pz(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 s=0;s<r.length;s++)n(r[s]);else for(let s in r)n(r[s])}return n(t),e}function Fu(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let s=e[0],i;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=hz(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=s.indexOf(" ");o>0&&(n=s.slice(0,o),s=s.slice(o+1));let a,l=n?t.createElementNS(n,s):t.createElement(s),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let h=d.indexOf(" ");h>0?l.setAttributeNS(d.slice(0,h),d.slice(h+1),c[d]):d=="style"&&l.style?l.style.cssText=c[d]:l.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let h=e[d];if(h===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:p,contentDOM:m}=Fu(t,h,n,r);if(l.appendChild(p),m){if(a)throw new RangeError("Multiple content holes");a=m}}}return{dom:l,contentDOM:a}}const qC=65535,KC=Math.pow(2,16);function mz(t,e){return t+e*KC}function Xx(t){return t&qC}function gz(t){return(t-(t&qC))/KC}const GC=1,JC=2,Bu=4,YC=8;class Sm{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&YC)>0}get deletedBefore(){return(this.delInfo&(GC|Bu))>0}get deletedAfter(){return(this.delInfo&(JC|Bu))>0}get deletedAcross(){return(this.delInfo&Bu)>0}}class or{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&or.empty)return or.empty}recover(e){let n=0,r=Xx(e);if(!this.inverted)for(let s=0;s<r;s++)n+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+n+gz(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 s=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?s:0);if(l>e)break;let c=this.ranges[a+i],u=this.ranges[a+o],d=l+c;if(e<=d){let h=c?e==l?-1:e==d?1:n:n,p=l+s+(h<0?0:u);if(r)return p;let m=e==(n<0?l:d)?null:mz(a/3,e-l),g=e==l?JC:e==d?GC:Bu;return(n<0?e!=l:e!=d)&&(g|=YC),new Sm(p,g,m)}s+=u-c}return r?e+s:new Sm(e+s,0,null)}touches(e,n){let r=0,s=Xx(n),i=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+i],u=l+c;if(e<=u&&a==s*3)return!0;r+=this.ranges[a+o]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let o=this.ranges[s],a=o-(this.inverted?i:0),l=o+(this.inverted?0:i),c=this.ranges[s+n],u=this.ranges[s+r];e(a,a+c,l,l+u),i+=u-c}}invert(){return new or(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?or.empty:new or(e<0?[0,-e,0]:[0,0,e])}}or.empty=new or([]);class Jl{constructor(e,n,r=0,s=e?e.length:0){this.mirror=n,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Jl(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 s=e.getMirror(n);this.appendMap(e._maps[n],s!=null&&s<n?r+s: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 s=e.getMirror(n);this.appendMap(e._maps[n].invert(),s!=null&&s>n?r-s-1:void 0)}}invert(){let e=new Jl;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 s=0;for(let i=this.from;i<this.to;i++){let o=this._maps[i],a=o.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(i);if(l!=null&&l>i&&l<this.to){i=l,e=this._maps[l].recover(a.recover);continue}}s|=a.delInfo,e=a.pos}return r?e:new Sm(e,s,null)}}const Ph=Object.create(null);class An{getMap(){return or.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Ph[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 Ph)throw new RangeError("Duplicate use of step JSON ID "+e);return Ph[e]=n,n.prototype.jsonID=e,n}}class Yt{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Yt(e,null)}static fail(e){return new Yt(null,e)}static fromReplace(e,n,r,s){try{return Yt.ok(e.replace(n,r,s))}catch(i){if(i instanceof ld)return Yt.fail(i.message);throw i}}}function fb(t,e,n){let r=[];for(let s=0;s<t.childCount;s++){let i=t.child(s);i.content.size&&(i=i.copy(fb(i.content,e,i))),i.isInline&&(i=e(i,n,s)),r.push(i)}return G.fromArray(r)}class ui extends An{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),s=r.node(r.sharedDepth(this.to)),i=new ae(fb(n.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),n.openStart,n.openEnd);return Yt.fromReplace(e,this.from,this.to,i)}invert(){return new Lr(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 ui(n.pos,r.pos,this.mark)}merge(e){return e instanceof ui&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ui(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 ui(n.from,n.to,e.markFromJSON(n.mark))}}An.jsonID("addMark",ui);class Lr extends An{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 ae(fb(n.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),n.openStart,n.openEnd);return Yt.fromReplace(e,this.from,this.to,r)}invert(){return new ui(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 Lr(n.pos,r.pos,this.mark)}merge(e){return e instanceof Lr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Lr(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 Lr(n.from,n.to,e.markFromJSON(n.mark))}}An.jsonID("removeMark",Lr);class di extends An{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Yt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Yt.fromReplace(e,this.pos,this.pos+1,new ae(G.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 s=0;s<n.marks.length;s++)if(!n.marks[s].isInSet(r))return new di(this.pos,n.marks[s]);return new di(this.pos,this.mark)}}return new ko(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new di(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 di(n.pos,e.markFromJSON(n.mark))}}An.jsonID("addNodeMark",di);class ko extends An{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Yt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Yt.fromReplace(e,this.pos,this.pos+1,new ae(G.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new di(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new ko(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 ko(n.pos,e.markFromJSON(n.mark))}}An.jsonID("removeNodeMark",ko);class ln extends An{constructor(e,n,r,s=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=s}apply(e){return this.structure&&Em(e,this.from,this.to)?Yt.fail("Structure replace would overwrite content"):Yt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new or([this.from,this.to-this.from,this.slice.size])}invert(e){return new ln(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new ln(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof ln)||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?ae.empty:new ae(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new ln(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?ae.empty:new ae(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new ln(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 ln(n.from,n.to,ae.fromJSON(e,n.slice),!!n.structure)}}An.jsonID("replace",ln);class cn extends An{constructor(e,n,r,s,i,o,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=a}apply(e){if(this.structure&&(Em(e,this.from,this.gapFrom)||Em(e,this.gapTo,this.to)))return Yt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Yt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Yt.fromReplace(e,this.from,this.to,r):Yt.fail("Content does not fit in gap")}getMap(){return new or([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 cn(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),s=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||s<n.pos||i>r.pos?null:new cn(n.pos,r.pos,s,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,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 cn(n.from,n.to,n.gapFrom,n.gapTo,ae.fromJSON(e,n.slice),n.insert,!!n.structure)}}An.jsonID("replaceAround",cn);function Em(t,e,n){let r=t.resolve(e),s=n-e,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function bz(t,e,n,r){let s=[],i=[],o,a;t.doc.nodesBetween(e,n,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let h=Math.max(c,e),p=Math.min(c+l.nodeSize,n),m=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(m)||(o&&o.to==h&&o.mark.eq(d[g])?o.to=p:s.push(o=new Lr(h,p,d[g])));a&&a.to==h?a.to=p:i.push(a=new ui(h,p,r))}}),s.forEach(l=>t.step(l)),i.forEach(l=>t.step(l))}function yz(t,e,n,r){let s=[],i=0;t.doc.nodesBetween(e,n,(o,a)=>{if(!o.isInline)return;i++;let l=null;if(r instanceof $f){let c=o.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let c=Math.min(a+o.nodeSize,n);for(let u=0;u<l.length;u++){let d=l[u],h;for(let p=0;p<s.length;p++){let m=s[p];m.step==i-1&&d.eq(s[p].style)&&(h=m)}h?(h.to=c,h.step=i):s.push({style:d,from:Math.max(a,e),to:c,step:i})}}}),s.forEach(o=>t.step(new Lr(o.from,o.to,o.style)))}function hb(t,e,n,r=n.contentMatch,s=!0){let i=t.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<i.childCount;l++){let c=i.child(l),u=a+c.nodeSize,d=r.matchType(c.type);if(!d)o.push(new ln(a,u,ae.empty));else{r=d;for(let h=0;h<c.marks.length;h++)n.allowsMarkType(c.marks[h].type)||t.step(new Lr(a,u,c.marks[h]));if(s&&c.isText&&n.whitespace!="pre"){let h,p=/\r?\n|\r/g,m;for(;h=p.exec(c.text);)m||(m=new ae(G.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),o.push(new ln(a+h.index,a+h.index+h[0].length,m))}}a=u}if(!r.validEnd){let l=r.fillBefore(G.empty,!0);t.replace(a,a,new ae(l,0,0))}for(let l=o.length-1;l>=0;l--)t.step(o[l])}function xz(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Ya(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,s=0,i=0;;--r){let o=t.$from.node(r),a=t.$from.index(r)+s,l=t.$to.indexAfter(r)-i;if(r<t.depth&&o.canReplace(a,l,n))return r;if(r==0||o.type.spec.isolating||!xz(o,a,l))break;a&&(s=1),l<o.childCount&&(i=1)}return null}function vz(t,e,n){let{$from:r,$to:s,depth:i}=e,o=r.before(i+1),a=s.after(i+1),l=o,c=a,u=G.empty,d=0;for(let m=i,g=!1;m>n;m--)g||r.index(m)>0?(g=!0,u=G.from(r.node(m).copy(u)),d++):l--;let h=G.empty,p=0;for(let m=i,g=!1;m>n;m--)g||s.after(m+1)<s.end(m)?(g=!0,h=G.from(s.node(m).copy(h)),p++):c++;t.step(new cn(l,c,o,a,new ae(u.append(h),d,p),u.size-d,!0))}function pb(t,e,n=null,r=t){let s=wz(t,e),i=s&&kz(r,e);return i?s.map(Qx).concat({type:e,attrs:n}).concat(i.map(Qx)):null}function Qx(t){return{type:t,attrs:null}}function wz(t,e){let{parent:n,startIndex:r,endIndex:s}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let o=i.length?i[0]:e;return n.canReplaceWith(r,s,o)?i:null}function kz(t,e){let{parent:n,startIndex:r,endIndex:s}=t,i=n.child(r),o=e.contentMatch.findWrapping(i.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;l&&c<s;c++)l=l.matchType(n.child(c).type);return!l||!l.validEnd?null:o}function Sz(t,e,n){let r=G.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let a=n[o].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=G.from(n[o].type.create(n[o].attrs,r))}let s=e.start,i=e.end;t.step(new cn(s,i,s,i,new ae(r,0,0),n.length,!0))}function Ez(t,e,n,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(o,a)=>{let l=typeof s=="function"?s(o):s;if(o.isTextblock&&!o.hasMarkup(r,l)&&Cz(t.doc,t.mapping.slice(i).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!m?c=!1:!p&&m&&(c=!0)}c===!1&&XC(t,o,a,i),hb(t,t.mapping.slice(i).map(a,1),r,void 0,c===null);let u=t.mapping.slice(i),d=u.map(a,1),h=u.map(a+o.nodeSize,1);return t.step(new cn(d,h,d+1,h-1,new ae(G.from(r.create(l,null,o.marks)),0,0),1,!0)),c===!0&&ZC(t,o,a,i),!1}})}function ZC(t,e,n,r){e.forEach((s,i)=>{if(s.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(s.text);){let l=t.mapping.slice(r).map(n+1+i+o.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function XC(t,e,n,r){e.forEach((s,i)=>{if(s.type==s.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+i);t.replaceWith(o,o+1,e.type.schema.text(`
318
- `))}})}function Cz(t,e,n){let r=t.resolve(e),s=r.index();return r.parent.canReplaceWith(s,s+1,n)}function Nz(t,e,n,r,s){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let o=n.create(r,null,s||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,o);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new cn(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new ae(G.from(o),0,0),1,!0))}function Es(t,e,n=1,r){let s=t.resolve(e),i=s.depth-n,o=r&&r[r.length-1]||s.parent;if(i<0||s.parent.type.spec.isolating||!s.parent.canReplace(s.index(),s.parent.childCount)||!o.type.validContent(s.parent.content.cutByIndex(s.index(),s.parent.childCount)))return!1;for(let c=s.depth-1,u=n-2;c>i;c--,u--){let d=s.node(c),h=s.index(c);if(d.type.spec.isolating)return!1;let p=d.content.cutByIndex(h,d.childCount),m=r&&r[u+1];m&&(p=p.replaceChild(0,m.type.create(m.attrs)));let g=r&&r[u]||d;if(!d.canReplace(h+1,d.childCount)||!g.type.validContent(p))return!1}let a=s.indexAfter(i),l=r&&r[0];return s.node(i).canReplaceWith(a,a,l?l.type:s.node(i+1).type)}function _z(t,e,n=1,r){let s=t.doc.resolve(e),i=G.empty,o=G.empty;for(let a=s.depth,l=s.depth-n,c=n-1;a>l;a--,c--){i=G.from(s.node(a).copy(i));let u=r&&r[c];o=G.from(u?u.type.create(u.attrs,o):s.node(a).copy(o))}t.step(new ln(e,e,new ae(i.append(o),n,n),!0))}function Oi(t,e){let n=t.resolve(e),r=n.index();return QC(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function Tz(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let s=0;s<e.childCount;s++){let i=e.child(s),o=i.type==r?t.type.schema.nodes.text:i.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function QC(t,e){return!!(t&&e&&!t.isLeaf&&Tz(t,e))}function Hf(t,e,n=-1){let r=t.resolve(e);for(let s=r.depth;;s--){let i,o,a=r.index(s);if(s==r.depth?(i=r.nodeBefore,o=r.nodeAfter):n>0?(i=r.node(s+1),a++,o=r.node(s).maybeChild(a)):(i=r.node(s).maybeChild(a-1),o=r.node(s+1)),i&&!i.isTextblock&&QC(i,o)&&r.node(s).canReplace(a,a+1))return e;if(s==0)break;e=n<0?r.before(s):r.after(s)}}function Az(t,e,n){let r=null,{linebreakReplacement:s}=t.doc.type.schema,i=t.doc.resolve(e-n),o=i.node().type;if(s&&o.inlineContent){let u=o.whitespace=="pre",d=!!o.contentMatch.matchType(s);u&&!d?r=!1:!u&&d&&(r=!0)}let a=t.steps.length;if(r===!1){let u=t.doc.resolve(e+n);XC(t,u.node(),u.before(),a)}o.inlineContent&&hb(t,e+n-1,o,i.node().contentMatchAt(i.index()),r==null);let l=t.mapping.slice(a),c=l.map(e-n);if(t.step(new ln(c,l.map(e+n,-1),ae.empty,!0)),r===!0){let u=t.doc.resolve(c);ZC(t,u.node(),u.before(),t.steps.length)}return t}function Mz(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 s=r.depth-1;s>=0;s--){let i=r.index(s);if(r.node(s).canReplaceWith(i,i,n))return r.before(s+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let s=r.depth-1;s>=0;s--){let i=r.indexAfter(s);if(r.node(s).canReplaceWith(i,i,n))return r.after(s+1);if(i<r.node(s).childCount)return null}return null}function eN(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let s=n.content;for(let i=0;i<n.openStart;i++)s=s.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let o=r.depth;o>=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,l=r.index(o)+(a>0?1:0),c=r.node(o),u=!1;if(i==1)u=c.canReplace(l,l,s);else{let d=c.contentMatchAt(l).findWrapping(s.firstChild.type);u=d&&c.canReplaceWith(l,l,d[0])}if(u)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function Uf(t,e,n=e,r=ae.empty){if(e==n&&!r.size)return null;let s=t.resolve(e),i=t.resolve(n);return tN(s,i,r)?new ln(e,n,r):new Rz(s,i,r).fit()}function tN(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class Rz{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=G.empty;for(let s=0;s<=e.depth;s++){let i=e.node(s);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(s))})}for(let s=e.depth;s>0;s--)this.placed=G.from(e.node(s).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,s=this.close(e<0?this.$to:r.doc.resolve(e));if(!s)return null;let i=this.placed,o=r.depth,a=s.depth;for(;o&&a&&i.childCount==1;)i=i.firstChild.content,o--,a--;let l=new ae(i,o,a);return e>-1?new cn(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new ln(r.pos,s.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,s=this.unplaced.openEnd;r<e;r++){let i=n.firstChild;if(n.childCount>1&&(s=0),i.type.spec.isolating&&s<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let s,i=null;r?(i=jh(this.unplaced.content,r-1).firstChild,s=i.content):s=this.unplaced.content;let o=s.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,d=null;if(n==1&&(o?c.matchType(o.type)||(d=c.fillBefore(G.from(o),!1)):i&&l.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:a,parent:i,inject:d};if(n==2&&o&&(u=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:i,wrap:u};if(i&&c.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,s=jh(e,n);return!s.childCount||s.firstChild.isLeaf?!1:(this.unplaced=new ae(e,n+1,Math.max(r,s.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,s=jh(e,n);if(s.childCount<=1&&n>0){let i=e.size-n<=n+s.size;this.unplaced=new ae(gl(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new ae(gl(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:s,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let g=0;g<i.length;g++)this.openFrontierNode(i[g]);let o=this.unplaced,a=r?r.content:o.content,l=o.openStart-e,c=0,u=[],{match:d,type:h}=this.frontier[n];if(s){for(let g=0;g<s.childCount;g++)u.push(s.child(g));d=d.matchFragment(s)}let p=a.size+e-(o.content.size-o.openEnd);for(;c<a.childCount;){let g=a.child(c),b=d.matchType(g.type);if(!b)break;c++,(c>1||l==0||g.content.size)&&(d=b,u.push(nN(g.mark(h.allowedMarks(g.marks)),c==1?l:0,c==a.childCount?p:-1)))}let m=c==a.childCount;m||(p=-1),this.placed=bl(this.placed,n,G.from(u)),this.frontier[n].match=d,m&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,b=a;g<p;g++){let x=b.lastChild;this.frontier.push({type:x.type,match:x.contentMatchAt(x.childCount)}),b=x.content}this.unplaced=m?e==0?ae.empty:new ae(gl(o.content,e-1,1),e-1,p<0?o.openEnd:e-1):new ae(gl(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!zh(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,s=this.$to.after(r);for(;r>1&&s==this.$to.end(--r);)++s;return s}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:s}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=zh(e,n,s,r,i);if(o){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=zh(e,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:n,fit:o,move:i?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=bl(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let s=e.node(r),i=s.type.contentMatch.fillBefore(s.content,!0,e.index(r));this.openFrontierNode(s.type,s.attrs,i)}return e}openFrontierNode(e,n=null,r){let s=this.frontier[this.depth];s.match=s.match.matchType(e),this.placed=bl(this.placed,this.depth,G.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(G.empty,!0);n.childCount&&(this.placed=bl(this.placed,this.frontier.length,n))}}function gl(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(gl(t.firstChild.content,e-1,n)))}function bl(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(bl(t.lastChild.content,e-1,n)))}function jh(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function nN(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,nN(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(G.empty,!0)))),t.copy(r)}function zh(t,e,n,r,s){let i=t.node(e),o=s?t.indexAfter(e):t.index(e);if(o==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,o);return a&&!Oz(n,i.content,o)?a:null}function Oz(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function Iz(t){return t.spec.defining||t.spec.definingForContent}function Dz(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let s=t.doc.resolve(e),i=t.doc.resolve(n);if(tN(s,i,r))return t.step(new ln(e,n,r));let o=sN(s,i);o[o.length-1]==0&&o.pop();let a=-(s.depth+1);o.unshift(a);for(let h=s.depth,p=s.pos-1;h>0;h--,p--){let m=s.node(h).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;o.indexOf(h)>-1?a=h:s.before(h)==p&&o.splice(1,0,-h)}let l=o.indexOf(a),c=[],u=r.openStart;for(let h=r.content,p=0;;p++){let m=h.firstChild;if(c.push(m),p==r.openStart)break;h=m.content}for(let h=u-1;h>=0;h--){let p=c[h],m=Iz(p.type);if(m&&!p.sameMarkup(s.node(Math.abs(a)-1)))u=h;else if(m||!p.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let p=(h+u+1)%(r.openStart+1),m=c[p];if(m)for(let g=0;g<o.length;g++){let b=o[(g+l)%o.length],x=!0;b<0&&(x=!1,b=-b);let w=s.node(b-1),v=s.index(b-1);if(w.canReplaceWith(v,v,m.type,m.marks))return t.replace(s.before(b),x?i.after(b):n,new ae(rN(r.content,0,r.openStart,p),p,r.openEnd))}}let d=t.steps.length;for(let h=o.length-1;h>=0&&(t.replace(e,n,r),!(t.steps.length>d));h--){let p=o[h];p<0||(e=s.before(p),n=i.after(p))}}function rN(t,e,n,r,s){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(rN(i.content,e+1,n,r,i)))}if(e>r){let i=s.contentMatchAt(0),o=i.fillBefore(t).append(t);t=o.append(i.matchFragment(o).fillBefore(G.empty,!0))}return t}function Lz(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let s=Mz(t.doc,e,r.type);s!=null&&(e=n=s)}t.replaceRange(e,n,new ae(G.from(r),0,0))}function Pz(t,e,n){let r=t.doc.resolve(e),s=t.doc.resolve(n),i=sN(r,s);for(let o=0;o<i.length;o++){let a=i[o],l=o==i.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),s.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),s.indexAfter(a-1))))return t.delete(r.before(a),s.after(a))}for(let o=1;o<=r.depth&&o<=s.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&s.end(o)-n!=s.depth-o&&r.start(o-1)==s.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),s.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function sN(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let s=r;s>=0;s--){let i=t.start(s);if(i<t.pos-(t.depth-s)||e.end(s)>e.pos+(e.depth-s)||t.node(s).type.spec.isolating||e.node(s).type.spec.isolating)break;(i==e.start(s)||s==t.depth&&s==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&s&&e.start(s-1)==i-1)&&n.push(s)}return n}class la extends An{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 Yt.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let s=n.type.create(r,null,n.marks);return Yt.fromReplace(e,this.pos,this.pos+1,new ae(G.from(s),0,n.isLeaf?0:1))}getMap(){return or.empty}invert(e){return new la(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 la(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 la(n.pos,n.attr,n.value)}}An.jsonID("attr",la);class Yl extends An{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let s in e.attrs)n[s]=e.attrs[s];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Yt.ok(r)}getMap(){return or.empty}invert(e){return new Yl(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 Yl(n.attr,n.value)}}An.jsonID("docAttr",Yl);let Ma=class extends Error{};Ma=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Ma.prototype=Object.create(Error.prototype);Ma.prototype.constructor=Ma;Ma.prototype.name="TransformError";class mb{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Jl}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Ma(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}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=ae.empty){let s=Uf(this.doc,e,n,r);return s&&this.step(s),this}replaceWith(e,n,r){return this.replace(e,n,new ae(G.from(r),0,0))}delete(e,n){return this.replace(e,n,ae.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return Dz(this,e,n,r),this}replaceRangeWith(e,n,r){return Lz(this,e,n,r),this}deleteRange(e,n){return Pz(this,e,n),this}lift(e,n){return vz(this,e,n),this}join(e,n=1){return Az(this,e,n),this}wrap(e,n){return Sz(this,e,n),this}setBlockType(e,n=e,r,s=null){return Ez(this,e,n,r,s),this}setNodeMarkup(e,n,r=null,s){return Nz(this,e,n,r,s),this}setNodeAttribute(e,n,r){return this.step(new la(e,n,r)),this}setDocAttribute(e,n){return this.step(new Yl(e,n)),this}addNodeMark(e,n){return this.step(new di(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 xt)n.isInSet(r.marks)&&this.step(new ko(e,n));else{let s=r.marks,i,o=[];for(;i=n.isInSet(s);)o.push(new ko(e,i)),s=i.removeFromSet(s);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,n=1,r){return _z(this,e,n,r),this}addMark(e,n,r){return bz(this,e,n,r),this}removeMark(e,n,r){return yz(this,e,n,r),this}clearIncompatible(e,n,r){return hb(this,e,n,r),this}}const Fh=Object.create(null);class Pe{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new iN(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=ae.empty){let r=n.content.lastChild,s=null;for(let a=0;a<n.openEnd;a++)s=r,r=r.lastChild;let i=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:l,$to:c}=o[a],u=e.mapping.slice(i);e.replaceRange(u.map(l.pos),u.map(c.pos),a?ae.empty:n),a==0&&nv(e,i,(r?r.isInline:s&&s.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,s=this.ranges;for(let i=0;i<s.length;i++){let{$from:o,$to:a}=s[i],l=e.mapping.slice(r),c=l.map(o.pos),u=l.map(a.pos);i?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),nv(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let s=e.parent.inlineContent?new Me(e):Wo(e.node(0),e.parent,e.pos,e.index(),n,r);if(s)return s;for(let i=e.depth-1;i>=0;i--){let o=n<0?Wo(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):Wo(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new lr(e.node(0))}static atStart(e){return Wo(e,e,0,0,1)||new lr(e)}static atEnd(e){return Wo(e,e,e.content.size,e.childCount,-1)||new lr(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Fh[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 Fh)throw new RangeError("Duplicate use of selection JSON ID "+e);return Fh[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Me.between(this.$anchor,this.$head).getBookmark()}}Pe.prototype.visible=!0;class iN{constructor(e,n){this.$from=e,this.$to=n}}let ev=!1;function tv(t){!ev&&!t.parent.inlineContent&&(ev=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Me extends Pe{constructor(e,n=e){tv(e),tv(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 Pe.near(r);let s=e.resolve(n.map(this.anchor));return new Me(s.parent.inlineContent?s:r,r)}replace(e,n=ae.empty){if(super.replace(e,n),n==ae.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Me&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Vf(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 Me(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let s=e.resolve(n);return new this(s,r==n?s:e.resolve(r))}static between(e,n,r){let s=e.pos-n.pos;if((!r||s)&&(r=s>=0?1:-1),!n.parent.inlineContent){let i=Pe.findFrom(n,r,!0)||Pe.findFrom(n,-r,!0);if(i)n=i.$head;else return Pe.near(n,r)}return e.parent.inlineContent||(s==0?e=n:(e=(Pe.findFrom(e,-r,!0)||Pe.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=s<0&&(e=n))),new Me(e,n)}}Pe.jsonID("text",Me);class Vf{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Vf(e.map(this.anchor),e.map(this.head))}resolve(e){return Me.between(e.resolve(this.anchor),e.resolve(this.head))}}class Ee extends Pe{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:s}=n.mapResult(this.anchor),i=e.resolve(s);return r?Pe.near(i):new Ee(i)}content(){return new ae(G.from(this.node),0,0)}eq(e){return e instanceof Ee&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new gb(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Ee(e.resolve(n.anchor))}static create(e,n){return new Ee(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Ee.prototype.visible=!1;Pe.jsonID("node",Ee);class gb{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Vf(r,r):new gb(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&Ee.isSelectable(r)?new Ee(n):Pe.near(n)}}class lr extends Pe{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=ae.empty){if(n==ae.empty){e.delete(0,e.doc.content.size);let r=Pe.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new lr(e)}map(e){return new lr(e)}eq(e){return e instanceof lr}getBookmark(){return jz}}Pe.jsonID("all",lr);const jz={map(){return this},resolve(t){return new lr(t)}};function Wo(t,e,n,r,s,i=!1){if(e.inlineContent)return Me.create(t,n);for(let o=r-(s>0?0:1);s>0?o<e.childCount:o>=0;o+=s){let a=e.child(o);if(a.isAtom){if(!i&&Ee.isSelectable(a))return Ee.create(t,n-(s<0?a.nodeSize:0))}else{let l=Wo(t,a,n+s,s<0?a.childCount:0,s,i);if(l)return l}n+=a.nodeSize*s}return null}function nv(t,e,n){let r=t.steps.length-1;if(r<e)return;let s=t.steps[r];if(!(s instanceof ln||s instanceof cn))return;let i=t.mapping.maps[r],o;i.forEach((a,l,c,u)=>{o==null&&(o=u)}),t.setSelection(Pe.near(t.doc.resolve(o),n))}const rv=1,lu=2,sv=4;class zz extends mb{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|rv)&~lu,this.storedMarks=null,this}get selectionSet(){return(this.updated&rv)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=lu,this}ensureMarks(e){return xt.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&lu)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~lu,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)||xt.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let s=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(s.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let o=this.doc.resolve(n);i=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,s.text(e,i)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(Pe.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|=sv,this}get scrolledIntoView(){return(this.updated&sv)>0}}function iv(t,e){return!e||!t?t:t.bind(e)}class yl{constructor(e,n,r){this.name=e,this.init=iv(n.init,r),this.apply=iv(n.apply,r)}}const Fz=[new yl("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new yl("selection",{init(t,e){return t.selection||Pe.atStart(e.doc)},apply(t){return t.selection}}),new yl("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new yl("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Bh{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Fz.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 yl(r.key,r.spec.state,r))})}}class ta{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 s=this.config.plugins[r];if(s.spec.filterTransaction&&!s.spec.filterTransaction.call(s,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),s=null;for(;;){let i=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let l=s?s[o].n:0,c=s?s[o].state:this,u=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,c,r);if(u&&r.filterTransaction(u,o)){if(u.setMeta("appendedTransaction",e),!s){s=[];for(let d=0;d<this.config.plugins.length;d++)s.push(d<o?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),i=!0}s&&(s[o]={state:r,n:n.length})}}if(!i)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new ta(this.config),r=this.config.fields;for(let s=0;s<r.length;s++){let i=r[s];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new zz(this)}static create(e){let n=new Bh(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new ta(n);for(let s=0;s<n.fields.length;s++)r[n.fields[s].name]=n.fields[s].init(e,r);return r}reconfigure(e){let n=new Bh(this.schema,e.plugins),r=n.fields,s=new ta(n);for(let i=0;i<r.length;i++){let o=r[i].name;s[o]=this.hasOwnProperty(o)?this[o]:r[i].init(e,s)}return s}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 s=e[r],i=s.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(s,this[s.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 s=new Bh(e.schema,e.plugins),i=new ta(s);return s.fields.forEach(o=>{if(o.name=="doc")i.doc=gi.fromJSON(e.schema,n.doc);else if(o.name=="selection")i.selection=Pe.fromJSON(i.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){i[o.name]=c.fromJSON.call(l,e,n[a],i);return}}i[o.name]=o.init(e,i)}}),i}}function oN(t,e,n){for(let r in t){let s=t[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=oN(s,e,{})),n[r]=s}return n}class Rt{constructor(e){this.spec=e,this.props={},e.props&&oN(e.props,this,this.props),this.key=e.key?e.key.key:aN("plugin")}getState(e){return e[this.key]}}const $h=Object.create(null);function aN(t){return t in $h?t+"$"+ ++$h[t]:($h[t]=0,t+"$")}class Ut{constructor(e="key"){this.key=aN(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const bb=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function lN(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const cN=(t,e,n)=>{let r=lN(t,n);if(!r)return!1;let s=yb(r);if(!s){let o=r.blockRange(),a=o&&Ya(o);return a==null?!1:(e&&e(t.tr.lift(o,a).scrollIntoView()),!0)}let i=s.nodeBefore;if(yN(t,s,e,-1))return!0;if(r.parent.content.size==0&&(Ra(i,"end")||Ee.isSelectable(i)))for(let o=r.depth;;o--){let a=Uf(t.doc,r.before(o),r.after(o),ae.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=t.tr.step(a);l.setSelection(Ra(i,"end")?Pe.findFrom(l.doc.resolve(l.mapping.map(s.pos,-1)),-1):Ee.create(l.doc,s.pos-i.nodeSize)),e(l.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return i.isAtom&&s.depth==r.depth-1?(e&&e(t.tr.delete(s.pos-i.nodeSize,s.pos).scrollIntoView()),!0):!1},Bz=(t,e,n)=>{let r=lN(t,n);if(!r)return!1;let s=yb(r);return s?uN(t,s,e):!1},$z=(t,e,n)=>{let r=fN(t,n);if(!r)return!1;let s=xb(r);return s?uN(t,s,e):!1};function uN(t,e,n){let r=e.nodeBefore,s=r,i=e.pos-1;for(;!s.isTextblock;i--){if(s.type.spec.isolating)return!1;let u=s.lastChild;if(!u)return!1;s=u}let o=e.nodeAfter,a=o,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let u=a.firstChild;if(!u)return!1;a=u}let c=Uf(t.doc,i,l,ae.empty);if(!c||c.from!=i||c instanceof ln&&c.slice.size>=l-i)return!1;if(n){let u=t.tr.step(c);u.setSelection(Me.create(u.doc,i)),n(u.scrollIntoView())}return!0}function Ra(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 dN=(t,e,n)=>{let{$head:r,empty:s}=t.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=yb(r)}let o=i&&i.nodeBefore;return!o||!Ee.isSelectable(o)?!1:(e&&e(t.tr.setSelection(Ee.create(t.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function yb(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 fN(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const hN=(t,e,n)=>{let r=fN(t,n);if(!r)return!1;let s=xb(r);if(!s)return!1;let i=s.nodeAfter;if(yN(t,s,e,1))return!0;if(r.parent.content.size==0&&(Ra(i,"start")||Ee.isSelectable(i))){let o=Uf(t.doc,r.before(),r.after(),ae.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=t.tr.step(o);a.setSelection(Ra(i,"start")?Pe.findFrom(a.doc.resolve(a.mapping.map(s.pos)),1):Ee.create(a.doc,a.mapping.map(s.pos))),e(a.scrollIntoView())}return!0}}return i.isAtom&&s.depth==r.depth-1?(e&&e(t.tr.delete(s.pos,s.pos+i.nodeSize).scrollIntoView()),!0):!1},pN=(t,e,n)=>{let{$head:r,empty:s}=t.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;i=xb(r)}let o=i&&i.nodeAfter;return!o||!Ee.isSelectable(o)?!1:(e&&e(t.tr.setSelection(Ee.create(t.doc,i.pos)).scrollIntoView()),!0)};function xb(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 Hz=(t,e)=>{let n=t.selection,r=n instanceof Ee,s;if(r){if(n.node.isTextblock||!Oi(t.doc,n.from))return!1;s=n.from}else if(s=Hf(t.doc,n.from,-1),s==null)return!1;if(e){let i=t.tr.join(s);r&&i.setSelection(Ee.create(i.doc,s-t.doc.resolve(s).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},Uz=(t,e)=>{let n=t.selection,r;if(n instanceof Ee){if(n.node.isTextblock||!Oi(t.doc,n.to))return!1;r=n.to}else if(r=Hf(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},Vz=(t,e)=>{let{$from:n,$to:r}=t.selection,s=n.blockRange(r),i=s&&Ya(s);return i==null?!1:(e&&e(t.tr.lift(s,i).scrollIntoView()),!0)},mN=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
319
- `).scrollIntoView()),!0)};function vb(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 Wz=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let s=n.node(-1),i=n.indexAfter(-1),o=vb(s.contentMatchAt(i));if(!o||!s.canReplaceWith(i,i,o))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,o.createAndFill());l.setSelection(Pe.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},gN=(t,e)=>{let n=t.selection,{$from:r,$to:s}=n;if(n instanceof lr||r.parent.inlineContent||s.parent.inlineContent)return!1;let i=vb(s.parent.contentMatchAt(s.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let o=(!r.parentOffset&&s.index()<s.parent.childCount?r:s).pos,a=t.tr.insert(o,i.createAndFill());a.setSelection(Me.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},bN=(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 i=n.before();if(Es(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),s=r&&Ya(r);return s==null?!1:(e&&e(t.tr.lift(r,s).scrollIntoView()),!0)};function qz(t){return(e,n)=>{let{$from:r,$to:s}=e.selection;if(e.selection instanceof Ee&&e.selection.node.isBlock)return!r.parentOffset||!Es(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],o,a,l=!1,c=!1;for(let p=r.depth;;p--)if(r.node(p).isBlock){l=r.end(p)==r.pos+(r.depth-p),c=r.start(p)==r.pos-(r.depth-p),a=vb(r.node(p-1).contentMatchAt(r.indexAfter(p-1))),i.unshift(l&&a?{type:a}:null),o=p;break}else{if(p==1)return!1;i.unshift(null)}let u=e.tr;(e.selection instanceof Me||e.selection instanceof lr)&&u.deleteSelection();let d=u.mapping.map(r.pos),h=Es(u.doc,d,i.length,i);if(h||(i[0]=a?{type:a}:null,h=Es(u.doc,d,i.length,i)),!h)return!1;if(u.split(d,i.length,i),!l&&c&&r.node(o).type!=a){let p=u.mapping.map(r.before(o)),m=u.doc.resolve(p);a&&r.node(o-1).canReplaceWith(m.index(),m.index()+1,a)&&u.setNodeMarkup(u.mapping.map(r.before(o)),a)}return n&&n(u.scrollIntoView()),!0}}const Kz=qz(),Gz=(t,e)=>{let{$from:n,to:r}=t.selection,s,i=n.sharedDepth(r);return i==0?!1:(s=n.before(i),e&&e(t.tr.setSelection(Ee.create(t.doc,s))),!0)};function Jz(t,e,n){let r=e.nodeBefore,s=e.nodeAfter,i=e.index();return!r||!s||!r.type.compatibleContent(s.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(s.isTextblock||Oi(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function yN(t,e,n,r){let s=e.nodeBefore,i=e.nodeAfter,o,a,l=s.type.spec.isolating||i.type.spec.isolating;if(!l&&Jz(t,e,n))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(a=s.contentMatchAt(s.childCount)).findWrapping(i.type))&&a.matchType(o[0]||i.type).validEnd){if(n){let p=e.pos+i.nodeSize,m=G.empty;for(let x=o.length-1;x>=0;x--)m=G.from(o[x].create(null,m));m=G.from(s.copy(m));let g=t.tr.step(new cn(e.pos-1,p,e.pos,p,new ae(m,1,0),o.length,!0)),b=g.doc.resolve(p+2*o.length);b.nodeAfter&&b.nodeAfter.type==s.type&&Oi(g.doc,b.pos)&&g.join(b.pos),n(g.scrollIntoView())}return!0}let u=i.type.spec.isolating||r>0&&l?null:Pe.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),h=d&&Ya(d);if(h!=null&&h>=e.depth)return n&&n(t.tr.lift(d,h).scrollIntoView()),!0;if(c&&Ra(i,"start",!0)&&Ra(s,"end")){let p=s,m=[];for(;m.push(p),!p.isTextblock;)p=p.lastChild;let g=i,b=1;for(;!g.isTextblock;g=g.firstChild)b++;if(p.canReplace(p.childCount,p.childCount,g.content)){if(n){let x=G.empty;for(let v=m.length-1;v>=0;v--)x=G.from(m[v].copy(x));let w=t.tr.step(new cn(e.pos-m.length,e.pos+i.nodeSize,e.pos+b,e.pos+i.nodeSize-b,new ae(x,m.length,0),0,!0));n(w.scrollIntoView())}return!0}}return!1}function xN(t){return function(e,n){let r=e.selection,s=t<0?r.$from:r.$to,i=s.depth;for(;s.node(i).isInline;){if(!i)return!1;i--}return s.node(i).isTextblock?(n&&n(e.tr.setSelection(Me.create(e.doc,t<0?s.start(i):s.end(i)))),!0):!1}}const Yz=xN(-1),Zz=xN(1);function Xz(t,e=null){return function(n,r){let{$from:s,$to:i}=n.selection,o=s.blockRange(i),a=o&&pb(o,t,e);return a?(r&&r(n.tr.wrap(o,a).scrollIntoView()),!0):!1}}function ov(t,e=null){return function(n,r){let s=!1;for(let i=0;i<n.selection.ranges.length&&!s;i++){let{$from:{pos:o},$to:{pos:a}}=n.selection.ranges[i];n.doc.nodesBetween(o,a,(l,c)=>{if(s)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)s=!0;else{let u=n.doc.resolve(c),d=u.index();s=u.parent.canReplaceWith(d,d+1,t)}})}if(!s)return!1;if(r){let i=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:l}}=n.selection.ranges[o];i.setBlockType(a,l,t,e)}r(i.scrollIntoView())}return!0}}function wb(...t){return function(e,n,r){for(let s=0;s<t.length;s++)if(t[s](e,n,r))return!0;return!1}}wb(bb,cN,dN);wb(bb,hN,pN);wb(mN,gN,bN,Kz);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Qz(t,e=null){return function(n,r){let{$from:s,$to:i}=n.selection,o=s.blockRange(i);if(!o)return!1;let a=r?n.tr:null;return eF(a,o,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function eF(t,e,n,r=null){let s=!1,i=e,o=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=o.resolve(e.start-2);i=new ud(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new ud(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),s=!0}let a=pb(i,n,r,e);return a?(t&&tF(t,e,a,s,n),!0):!1}function tF(t,e,n,r,s){let i=G.empty;for(let u=n.length-1;u>=0;u--)i=G.from(n[u].type.create(n[u].attrs,i));t.step(new cn(e.start-(r?2:0),e.end,e.start,e.end,new ae(i,0,0),n.length,!0));let o=0;for(let u=0;u<n.length;u++)n[u].type==s&&(o=u+1);let a=n.length-o,l=e.start+n.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,h=!0;u<d;u++,h=!1)!h&&Es(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return t}function nF(t){return function(e,n){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,o=>o.childCount>0&&o.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?rF(e,n,t,i):sF(e,n,i):!0:!1}}function rF(t,e,n,r){let s=t.tr,i=r.end,o=r.$to.end(r.depth);i<o&&(s.step(new cn(i-1,o,i,o,new ae(G.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new ud(s.doc.resolve(r.$from.pos),s.doc.resolve(o),r.depth));const a=Ya(r);if(a==null)return!1;s.lift(r,a);let l=s.doc.resolve(s.mapping.map(i,-1)-1);return Oi(s.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&s.join(l.pos),e(s.scrollIntoView()),!0}function sF(t,e,n){let r=t.tr,s=n.parent;for(let p=n.end,m=n.endIndex-1,g=n.startIndex;m>g;m--)p-=s.child(m).nodeSize,r.delete(p-1,p+1);let i=r.doc.resolve(n.start),o=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==s.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(a?0:1),u+1,o.content.append(l?G.empty:G.from(s))))return!1;let d=i.pos,h=d+o.nodeSize;return r.step(new cn(d-(a?1:0),h+(l?1:0),d+1,h-1,new ae((a?G.empty:G.from(s.copy(G.empty))).append(l?G.empty:G.from(s.copy(G.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function iF(t){return function(e,n){let{$from:r,$to:s}=e.selection,i=r.blockRange(s,c=>c.childCount>0&&c.firstChild.type==t);if(!i)return!1;let o=i.startIndex;if(o==0)return!1;let a=i.parent,l=a.child(o-1);if(l.type!=t)return!1;if(n){let c=l.lastChild&&l.lastChild.type==a.type,u=G.from(c?t.create():null),d=new ae(G.from(t.create(null,G.from(a.type.create(null,u)))),c?3:1,0),h=i.start,p=i.end;n(e.tr.step(new cn(h-(c?3:1),p,h,p,d,1,!0)).scrollIntoView())}return!0}}const pn=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Oa=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Cm=null;const bs=function(t,e,n){let r=Cm||(Cm=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},oF=function(){Cm=null},So=function(t,e,n,r){return n&&(av(t,e,n,r,-1)||av(t,e,n,r,1))},aF=/^(img|br|input|textarea|hr)$/i;function av(t,e,n,r,s){for(var i;;){if(t==n&&e==r)return!0;if(e==(s<0?0:kr(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Hc(t)||aF.test(t.nodeName)||t.contentEditable=="false")return!1;e=pn(t)+(s<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(s<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((i=o.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=s;else return!1;else t=o,e=s<0?kr(t):0}else return!1}}function kr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function lF(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=kr(t)}else if(t.parentNode&&!Hc(t))e=pn(t),t=t.parentNode;else return null}}function cF(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&&!Hc(t))e=pn(t)+1,t=t.parentNode;else return null}}function uF(t,e,n){for(let r=e==0,s=e==kr(t);r||s;){if(t==n)return!0;let i=pn(t);if(t=t.parentNode,!t)return!1;r=r&&i==0,s=s&&i==kr(t)}}function Hc(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 Wf=function(t){return t.focusNode&&So(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function $i(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function dF(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function fF(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(kr(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(kr(r.startContainer),r.startOffset)}}}const Qr=typeof navigator<"u"?navigator:null,lv=typeof document<"u"?document:null,Ii=Qr&&Qr.userAgent||"",Nm=/Edge\/(\d+)/.exec(Ii),vN=/MSIE \d/.exec(Ii),_m=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ii),er=!!(vN||_m||Nm),yi=vN?document.documentMode:_m?+_m[1]:Nm?+Nm[1]:0,Cr=!er&&/gecko\/(\d+)/i.test(Ii);Cr&&+(/Firefox\/(\d+)/.exec(Ii)||[0,0])[1];const Tm=!er&&/Chrome\/(\d+)/.exec(Ii),Cn=!!Tm,wN=Tm?+Tm[1]:0,Bn=!er&&!!Qr&&/Apple Computer/.test(Qr.vendor),Ia=Bn&&(/Mobile\/\w+/.test(Ii)||!!Qr&&Qr.maxTouchPoints>2),vr=Ia||(Qr?/Mac/.test(Qr.platform):!1),hF=Qr?/Win/.test(Qr.platform):!1,Ss=/Android \d/.test(Ii),Uc=!!lv&&"webkitFontSmoothing"in lv.documentElement.style,pF=Uc?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function mF(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 us(t,e){return typeof t=="number"?t:t[e]}function gF(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 cv(t,e,n){let r=t.someProp("scrollThreshold")||0,s=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=Oa(o);continue}let a=o,l=a==i.body,c=l?mF(i):gF(a),u=0,d=0;if(e.top<c.top+us(r,"top")?d=-(c.top-e.top+us(s,"top")):e.bottom>c.bottom-us(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+us(s,"top")-c.top:e.bottom-c.bottom+us(s,"bottom")),e.left<c.left+us(r,"left")?u=-(c.left-e.left+us(s,"left")):e.right>c.right-us(r,"right")&&(u=e.right-c.right+us(s,"right")),u||d)if(l)i.defaultView.scrollBy(u,d);else{let p=a.scrollLeft,m=a.scrollTop;d&&(a.scrollTop+=d),u&&(a.scrollLeft+=u);let g=a.scrollLeft-p,b=a.scrollTop-m;e={left:e.left-g,top:e.top-b,right:e.right-g,bottom:e.bottom-b}}let h=l?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(h))break;o=h=="absolute"?o.offsetParent:Oa(o)}}function bF(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,s;for(let i=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=t.root.elementFromPoint(i,o);if(!a||a==t.dom||!t.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=n-20){r=a,s=l.top;break}}return{refDOM:r,refTop:s,stack:kN(t.dom)}}function kN(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Oa(r));return e}function yF({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;SN(n,r==0?0:r-e)}function SN(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:s,left:i}=t[n];r.scrollTop!=s+e&&(r.scrollTop=s+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let Bo=null;function xF(t){if(t.setActive)return t.setActive();if(Bo)return t.focus(Bo);let e=kN(t);t.focus(Bo==null?{get preventScroll(){return Bo={preventScroll:!0},!0}}:void 0),Bo||(Bo=!1,SN(e,0))}function EN(t,e){let n,r=2e8,s,i=0,o=e.top,a=e.top,l,c;for(let u=t.firstChild,d=0;u;u=u.nextSibling,d++){let h;if(u.nodeType==1)h=u.getClientRects();else if(u.nodeType==3)h=bs(u).getClientRects();else continue;for(let p=0;p<h.length;p++){let m=h[p];if(m.top<=o&&m.bottom>=a){o=Math.max(m.bottom,o),a=Math.min(m.top,a);let g=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(g<r){n=u,r=g,s=g&&n.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,u.nodeType==1&&g&&(i=d+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!l&&m.left<=e.left&&m.right>=e.left&&(l=u,c={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!n&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(i=d+1)}}return!n&&l&&(n=l,s=c,r=0),n&&n.nodeType==3?vF(n,s):!n||r&&n.nodeType==1?{node:t,offset:i}:EN(n,s)}function vF(t,e){let n=t.nodeValue.length,r=document.createRange();for(let s=0;s<n;s++){r.setEnd(t,s+1),r.setStart(t,s);let i=Us(r,1);if(i.top!=i.bottom&&kb(e,i))return{node:t,offset:s+(e.left>=(i.left+i.right)/2?1:0)}}return{node:t,offset:0}}function kb(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function wF(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function kF(t,e,n){let{node:r,offset:s}=EN(e,n),i=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();i=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,s,i)}function SF(t,e,n,r){let s=-1;for(let i=e,o=!1;i!=t.dom;){let a=t.docView.nearestDesc(i,!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)&&(!o&&l.left>r.left||l.top>r.top?s=a.posBefore:(!o&&l.right<r.left||l.bottom<r.top)&&(s=a.posAfter),o=!0),!a.contentDOM&&s<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;i=a.dom.parentNode}return s>-1?s:t.docView.posFromDOM(e,n,-1)}function CN(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let s=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),i=s;;){let o=t.childNodes[i];if(o.nodeType==1){let a=o.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(kb(e,c))return CN(o,e,c)}}if((i=(i+1)%r)==s)break}return t}function EF(t,e){let n=t.dom.ownerDocument,r,s=0,i=fF(n,e.left,e.top);i&&({node:r,offset:s}=i);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=t.dom.getBoundingClientRect();if(!kb(e,c)||(o=CN(t.dom,e,c),!o))return null}if(Bn)for(let c=o;r&&c;c=Oa(c))c.draggable&&(r=void 0);if(o=wF(o,e),r){if(Cr&&r.nodeType==1&&(s=Math.min(s,r.childNodes.length),s<r.childNodes.length)){let u=r.childNodes[s],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&s++}let c;Uc&&s&&r.nodeType==1&&(c=r.childNodes[s-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&s--,r==t.dom&&s==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(s==0||r.nodeType!=1||r.childNodes[s-1].nodeName!="BR")&&(a=SF(t,r,s,e))}a==null&&(a=kF(t,o,e));let l=t.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function uv(t){return t.top<t.bottom||t.left<t.right}function Us(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(uv(r))return r}return Array.prototype.find.call(n,uv)||t.getBoundingClientRect()}const CF=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function NN(t,e,n){let{node:r,offset:s,atom:i}=t.docView.domFromPos(e,n<0?-1:1),o=Uc||Cr;if(r.nodeType==3)if(o&&(CF.test(r.nodeValue)||(n<0?!s:s==r.nodeValue.length))){let l=Us(bs(r,s,s),n);if(Cr&&s&&/\s/.test(r.nodeValue[s-1])&&s<r.nodeValue.length){let c=Us(bs(r,s-1,s-1),-1);if(c.top==l.top){let u=Us(bs(r,s,s+1),-1);if(u.top!=l.top)return al(u,u.left<c.left)}}return l}else{let l=s,c=s,u=n<0?1:-1;return n<0&&!s?(c++,u=-1):n>=0&&s==r.nodeValue.length?(l--,u=1):n<0?l--:c++,al(Us(bs(r,l,c),u),u<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&s&&(n<0||s==kr(r))){let l=r.childNodes[s-1];if(l.nodeType==1)return Hh(l.getBoundingClientRect(),!1)}if(i==null&&s<kr(r)){let l=r.childNodes[s];if(l.nodeType==1)return Hh(l.getBoundingClientRect(),!0)}return Hh(r.getBoundingClientRect(),n>=0)}if(i==null&&s&&(n<0||s==kr(r))){let l=r.childNodes[s-1],c=l.nodeType==3?bs(l,kr(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return al(Us(c,1),!1)}if(i==null&&s<kr(r)){let l=r.childNodes[s];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?bs(l,0,o?0:1):l.nodeType==1?l:null:null;if(c)return al(Us(c,-1),!0)}return al(Us(r.nodeType==3?bs(r):r,-n),n>=0)}function al(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 Hh(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 _N(t,e,n){let r=t.state,s=t.root.activeElement;r!=e&&t.updateState(e),s!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),s!=t.dom&&s&&s.focus()}}function NF(t,e,n){let r=e.selection,s=n=="up"?r.$from:r.$to;return _N(t,e,()=>{let{node:i}=t.docView.domFromPos(s.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(i,!0);if(!a)break;if(a.node.isBlock){i=a.contentDOM||a.dom;break}i=a.dom.parentNode}let o=NN(t,s.pos,1);for(let a=i.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=bs(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let u=l[c];if(u.bottom>u.top+1&&(n=="up"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}const _F=/[\u0590-\u08ac]/;function TF(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let s=r.parentOffset,i=!s,o=s==r.parent.content.size,a=t.domSelection();return a?!_F.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?i:o:_N(t,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:d}=t.domSelectionRange(),h=a.caretBidiLevel;a.modify("move",n,"character");let p=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:m,focusOffset:g}=t.domSelectionRange(),b=m&&!p.contains(m.nodeType==1?m:m.parentNode)||l==m&&c==g;try{a.collapse(u,d),l&&(l!=u||c!=d)&&a.extend&&a.extend(l,c)}catch{}return h!=null&&(a.caretBidiLevel=h),b}):r.pos==r.start()||r.pos==r.end()}let dv=null,fv=null,hv=!1;function AF(t,e,n){return dv==e&&fv==n?hv:(dv=e,fv=n,hv=n=="up"||n=="down"?NF(t,e,n):TF(t,e,n))}const Nr=0,pv=1,Wi=2,es=3;class Vc{constructor(e,n,r,s){this.parent=e,this.children=n,this.dom=r,this.contentDOM=s,this.dirty=Nr,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 s=this.children[n];if(s==e)return r;r+=s.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 i,o;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(o)+o.size:this.posAtStart}else{let i,o;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(o):this.posAtEnd}let s;if(e==this.dom&&this.contentDOM)s=n>pn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!1;break}if(i.previousSibling)break}if(s==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){s=!0;break}if(i.nextSibling)break}}return s??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,s=e;s;s=s.parentNode){let i=this.getDesc(s),o;if(i&&(!n||i.node))if(r&&(o=i.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return i}}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 s=e;s;s=s.parentNode){let i=this.getDesc(s);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let s=this.children[n],i=r+s.size;if(r==e&&i!=r){for(;!s.border&&s.children.length;)for(let o=0;o<s.children.length;o++){let a=s.children[o];if(a.size){s=a;break}}return s}if(e<i)return s.descAt(e-r-s.border);r=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,s=0;for(let i=0;r<this.children.length;r++){let o=this.children[r],a=i+o.size;if(a>e||o instanceof AN){s=e-i;break}i=a}if(s)return this.children[r].domFromPos(s-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof TN&&i.side>=0;r--);if(n<=0){let i,o=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,o=!1);return i&&n&&o&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?pn(i.dom)+1:0}}else{let i,o=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,o=!1);return i&&o&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?pn(i.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 s=-1,i=-1;for(let o=r,a=0;;a++){let l=this.children[a],c=o+l.size;if(s==-1&&e<=c){let u=o+l.border;if(e>=u&&n<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,u);e=o;for(let d=a;d>0;d--){let h=this.children[d-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){s=pn(h.dom)+1;break}e-=h.size}s==-1&&(s=0)}if(s>-1&&(c>n||a==this.children.length-1)){n=c;for(let u=a+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){i=pn(d.dom);break}n+=d.size}i==-1&&(i=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:n,fromOffset:s,toOffset:i}}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,s=!1){let i=Math.min(e,n),o=Math.max(e,n);for(let p=0,m=0;p<this.children.length;p++){let g=this.children[p],b=m+g.size;if(i>m&&o<b)return g.setSelection(e-m-g.border,n-m-g.border,r,s);m=b}let a=this.domFromPos(e,e?-1:1),l=n==e?a:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),d=!1;if((Cr||Bn)&&e==n){let{node:p,offset:m}=a;if(p.nodeType==3){if(d=!!(m&&p.nodeValue[m-1]==`
320
- `),d&&m==p.nodeValue.length)for(let g=p,b;g;g=g.parentNode){if(b=g.nextSibling){b.nodeName=="BR"&&(a=l={node:b.parentNode,offset:pn(b)+1});break}let x=g.pmViewDesc;if(x&&x.node&&x.node.isBlock)break}}else{let g=p.childNodes[m-1];d=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(Cr&&u.focusNode&&u.focusNode!=l.node&&u.focusNode.nodeType==1){let p=u.focusNode.childNodes[u.focusOffset];p&&p.contentEditable=="false"&&(s=!0)}if(!(s||d&&Bn)&&So(a.node,a.offset,u.anchorNode,u.anchorOffset)&&So(l.node,l.offset,u.focusNode,u.focusOffset))return;let h=!1;if((c.extend||e==n)&&!(d&&Cr)){c.collapse(a.node,a.offset);try{e!=n&&c.extend(l.node,l.offset),h=!0}catch{}}if(!h){if(e>n){let m=a;a=l,l=m}let p=document.createRange();p.setEnd(l.node,l.offset),p.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(p)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,s=0;s<this.children.length;s++){let i=this.children[s],o=r+i.size;if(r==o?e<=o&&n>=r:e<o&&n>r){let a=r+i.border,l=o-i.border;if(e>=a&&n<=l){this.dirty=e==r||n==o?Wi:pv,e==a&&n==l&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=es:i.markDirty(e-a,n-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Wi:es}r=o}this.dirty=Wi}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Wi:pv;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class TN extends Vc{constructor(e,n,r,s){let i,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!i)return s;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==Nr&&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 MF extends Vc{constructor(e,n,r,s){super(e,[],n,null),this.textDOM=r,this.text=s}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 Eo extends Vc{constructor(e,n,r,s,i){super(e,[],r,s),this.mark=n,this.spec=i}static create(e,n,r,s){let i=s.nodeViews[n.type.name],o=i&&i(n,s,r);return(!o||!o.dom)&&(o=Po.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Eo(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&es||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=es&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Nr){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Nr}}slice(e,n,r){let s=Eo.create(this.parent,this.mark,!0,r),i=this.children,o=this.size;n<o&&(i=Mm(i,n,o,r)),e>0&&(i=Mm(i,0,e,r));for(let a=0;a<i.length;a++)i[a].parent=s;return s.children=i,s}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class xi extends Vc{constructor(e,n,r,s,i,o,a,l,c){super(e,[],i,o),this.node=n,this.outerDeco=r,this.innerDeco=s,this.nodeDOM=a}static create(e,n,r,s,i,o){let a=i.nodeViews[n.type.name],l,c=a&&a(n,i,()=>{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},r,s),u=c&&c.dom,d=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=Po.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let h=u;return u=ON(u,r,n),c?l=new RF(e,n,r,s,u,d||null,h,c,i,o+1):n.isText?new qf(e,n,r,s,u,h,i):new xi(e,n,r,s,u,d||null,h,i,o+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=()=>G.empty)}return e}matchesNode(e,n,r){return this.dirty==Nr&&e.eq(this.node)&&fd(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,s=n,i=e.composing?this.localCompositionInfo(e,n):null,o=i&&i.pos>-1?i:null,a=i&&i.pos<0,l=new IF(this,o&&o.node,e);PF(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!d&&l.syncToMarks(u==this.node.childCount?xt.none:this.node.child(u).marks,r,e),l.placeWidget(c,e,s)},(c,u,d,h)=>{l.syncToMarks(c.marks,r,e);let p;l.findNodeMatch(c,u,d,h)||a&&e.state.selection.from>s&&e.state.selection.to<s+c.nodeSize&&(p=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(c,u,d,p,e)||l.updateNextNode(c,u,d,e,h,s)||l.addNode(c,u,d,e,s),s+=c.nodeSize}),l.syncToMarks([],r,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==Wi)&&(o&&this.protectLocalComposition(e,o),MN(this.contentDOM,this.children,e),Ia&&jF(this.dom))}localCompositionInfo(e,n){let{from:r,to:s}=e.state.selection;if(!(e.state.selection instanceof Me)||r<n||s>n+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let o=i.nodeValue,a=zF(this.node.content,o,r-n,s-n);return a<0?null:{node:i,pos:a,text:o}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:s}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let o=new MF(this,i,n,s);e.input.compositionNodes.push(o),this.children=Mm(this.children,r,r+s.length,e,o)}update(e,n,r,s){return this.dirty==es||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,s),!0)}updateInner(e,n,r,s){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(s,this.posAtStart),this.dirty=Nr}updateOuterDeco(e){if(fd(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=RN(this.dom,this.nodeDOM,Am(this.outerDeco,this.node,n),Am(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 mv(t,e,n,r,s){ON(r,e,t);let i=new xi(void 0,t,e,n,r,r,r,s,0);return i.contentDOM&&i.updateChildren(s,0),i}class qf extends xi{constructor(e,n,r,s,i,o,a){super(e,n,r,s,i,null,o,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,s){return this.dirty==es||this.dirty!=Nr&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Nr||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,s.trackWrites==this.nodeDOM&&(s.trackWrites=null)),this.node=e,this.dirty=Nr,!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 s=this.node.cut(e,n),i=document.createTextNode(s.text);return new qf(this.parent,s,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=es)}get domAtom(){return!1}isText(e){return this.node.text==e}}class AN extends Vc{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Nr&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class RF extends xi{constructor(e,n,r,s,i,o,a,l,c,u){super(e,n,r,s,i,o,a,c,u),this.spec=l}update(e,n,r,s){if(this.dirty==es)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,s),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,s)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,s){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,s)}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 MN(t,e,n){let r=t.firstChild,s=!1;for(let i=0;i<e.length;i++){let o=e[i],a=o.dom;if(a.parentNode==t){for(;a!=r;)r=gv(r),s=!0;r=r.nextSibling}else s=!0,t.insertBefore(a,r);if(o instanceof Eo){let l=r?r.previousSibling:t.lastChild;MN(o.contentDOM,o.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=gv(r),s=!0;s&&n.trackWrites==t&&(n.trackWrites=null)}const Al=function(t){t&&(this.nodeName=t)};Al.prototype=Object.create(null);const qi=[new Al];function Am(t,e,n){if(t.length==0)return qi;let r=n?qi[0]:new Al,s=[r];for(let i=0;i<t.length;i++){let o=t[i].type.attrs;if(o){o.nodeName&&s.push(r=new Al(o.nodeName));for(let a in o){let l=o[a];l!=null&&(n&&s.length==1&&s.push(r=new Al(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 s}function RN(t,e,n,r){if(n==qi&&r==qi)return e;let s=e;for(let i=0;i<r.length;i++){let o=r[i],a=n[i];if(i){let l;a&&a.nodeName==o.nodeName&&s!=t&&(l=s.parentNode)&&l.nodeName.toLowerCase()==o.nodeName||(l=document.createElement(o.nodeName),l.pmIsDeco=!0,l.appendChild(s),a=qi[0]),s=l}OF(s,a||qi[0],o)}return s}function OF(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):[],s=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)s.indexOf(r[i])==-1&&t.classList.remove(r[i]);for(let i=0;i<s.length;i++)r.indexOf(s[i])==-1&&t.classList.add(s[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,s;for(;s=r.exec(e.style);)t.style.removeProperty(s[1])}n.style&&(t.style.cssText+=n.style)}}function ON(t,e,n){return RN(t,t,qi,Am(e,n,t.nodeType!=1))}function fd(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 gv(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class IF{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=DF(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){let s=0,i=this.stack.length>>1,o=Math.min(i,e.length);for(;s<o&&(s==i-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<i;)this.destroyRest(),this.top.dirty=Nr,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let l=this.index;l<Math.min(this.index+3,this.top.children.length);l++){let c=this.top.children[l];if(c.matchesMark(e[i])&&!this.isLocked(c.dom)){a=l;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=Eo.create(this.top,e[i],n,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,i++}}findNodeMatch(e,n,r,s){let i=-1,o;if(s>=this.preMatch.index&&(o=this.preMatch.matches[s-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))i=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){i=a;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,r,s,i){let o=this.top.children[s];return o.dirty==es&&o.dom==o.contentDOM&&(o.dirty=Wi),o.update(e,n,r,i)?(this.destroyBetween(this.index,s),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 s=this.index;s<this.top.children.length;s++)if(this.top.children[s]==r)return s}return-1}e=n}}updateNextNode(e,n,r,s,i,o){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof xi){let c=this.preMatch.matched.get(l);if(c!=null&&c!=i)return!1;let u=l.dom,d,h=this.isLocked(u)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=es&&fd(n,l.outerDeco));if(!h&&l.update(e,n,r,s))return this.destroyBetween(this.index,a),l.dom!=u&&(this.changed=!0),this.index++,!0;if(!h&&(d=this.recreateWrapper(l,e,n,r,s,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=Wi,d.updateChildren(s,o+1),d.dirty=Nr),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,s,i,o){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!fd(r,e.outerDeco)||!s.eq(e.innerDeco))return null;let a=xi.create(this.top,n,r,s,i,o);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,n,r,s,i){let o=xi.create(this.top,e,n,r,s,i);o.contentDOM&&o.updateChildren(s,i+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,n,r){let s=this.index<this.top.children.length?this.top.children[this.index]:null;if(s&&s.matchesWidget(e)&&(e==s.widget||!s.widget.type.toDOM.parentNode))this.index++;else{let i=new TN(this.top,e,n,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof Eo;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof qf)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Bn||Cn)&&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 s=new AN(this.top,[],r,null);n!=this.top?n.children.push(s):n.children.splice(this.index++,0,s),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function DF(t,e){let n=e,r=n.children.length,s=t.childCount,i=new Map,o=[];e:for(;s>0;){let a;for(;;)if(r){let c=n.children[r-1];if(c instanceof Eo)n=c,r=c.children.length;else{a=c,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(s-1))break;--s,i.set(a,s),o.push(a)}}return{index:s,matched:i,matches:o.reverse()}}function LF(t,e){return t.type.side-e.type.side}function PF(t,e,n,r){let s=e.locals(t),i=0;if(s.length==0){for(let c=0;c<t.childCount;c++){let u=t.child(c);r(u,s,e.forChild(i,u),c),i+=u.nodeSize}return}let o=0,a=[],l=null;for(let c=0;;){let u,d;for(;o<s.length&&s[o].to==i;){let b=s[o++];b.widget&&(u?(d||(d=[u])).push(b):u=b)}if(u)if(d){d.sort(LF);for(let b=0;b<d.length;b++)n(d[b],c,!!l)}else n(u,c,!!l);let h,p;if(l)p=-1,h=l,l=null;else if(c<t.childCount)p=c,h=t.child(c++);else break;for(let b=0;b<a.length;b++)a[b].to<=i&&a.splice(b--,1);for(;o<s.length&&s[o].from<=i&&s[o].to>i;)a.push(s[o++]);let m=i+h.nodeSize;if(h.isText){let b=m;o<s.length&&s[o].from<b&&(b=s[o].from);for(let x=0;x<a.length;x++)a[x].to<b&&(b=a[x].to);b<m&&(l=h.cut(b-i),h=h.cut(0,b-i),m=b,p=-1)}else for(;o<s.length&&s[o].to<m;)o++;let g=h.isInline&&!h.isLeaf?a.filter(b=>!b.inline):a.slice();r(h,g,e.forChild(i,h),p),i=m}}function jF(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 zF(t,e,n,r){for(let s=0,i=0;s<t.childCount&&i<=r;){let o=t.child(s++),a=i;if(i+=o.nodeSize,!o.isText)continue;let l=o.text;for(;s<t.childCount;){let c=t.child(s++);if(i+=c.nodeSize,!c.isText)break;l+=c.text}if(i>=n){if(i>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let c=a<r?l.lastIndexOf(e,r-a-1):-1;if(c>=0&&c+e.length+a>=n)return a+c;if(n==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function Mm(t,e,n,r,s){let i=[];for(let o=0,a=0;o<t.length;o++){let l=t[o],c=a,u=a+=l.size;c>=n||u<=e?i.push(l):(c<e&&i.push(l.slice(0,e-c,r)),s&&(i.push(s),s=void 0),u>n&&i.push(l.slice(n-c,l.size,r)))}return i}function Sb(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let s=t.docView.nearestDesc(n.focusNode),i=s&&s.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let a=r.resolve(o),l,c;if(Wf(n)){for(l=o;s&&!s.node;)s=s.parent;let d=s.node;if(s&&d.isAtom&&Ee.isSelectable(d)&&s.parent&&!(d.isInline&&uF(n.focusNode,n.focusOffset,s.dom))){let h=s.posBefore;c=new Ee(o==h?a:r.resolve(h))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=o,h=o;for(let p=0;p<n.rangeCount;p++){let m=n.getRangeAt(p);d=Math.min(d,t.docView.posFromDOM(m.startContainer,m.startOffset,1)),h=Math.max(h,t.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(d<0)return null;[l,o]=h==t.state.selection.anchor?[h,d]:[d,h],a=r.resolve(o)}else l=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let u=r.resolve(l);if(!c){let d=e=="pointer"||t.state.selection.head<a.pos&&!i?1:-1;c=Eb(t,u,a,d)}return c}function IN(t){return t.editable?t.hasFocus():LN(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Cs(t,e=!1){let n=t.state.selection;if(DN(t,n),!!IN(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Cn){let r=t.domSelectionRange(),s=t.domObserver.currentSelection;if(r.anchorNode&&s.anchorNode&&So(r.anchorNode,r.anchorOffset,s.anchorNode,s.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)BF(t);else{let{anchor:r,head:s}=n,i,o;bv&&!(n instanceof Me)&&(n.$from.parent.inlineContent||(i=yv(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=yv(t,n.to))),t.docView.setSelection(r,s,t,e),bv&&(i&&xv(i),o&&xv(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&FF(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const bv=Bn||Cn&&wN<63;function yv(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),s=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(Bn&&s&&s.contentEditable=="false")return Uh(s);if((!s||s.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(s)return Uh(s);if(i)return Uh(i)}}function Uh(t){return t.contentEditable="true",Bn&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function xv(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function FF(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,s=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=s)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!IN(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function BF(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,pn(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&er&&yi<=11&&(n.disabled=!0,n.disabled=!1)}function DN(t,e){if(e instanceof Ee){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(vv(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else vv(t)}function vv(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Eb(t,e,n,r){return t.someProp("createSelectionBetween",s=>s(t,e,n))||Me.between(e,n,r)}function wv(t){return t.editable&&!t.hasFocus()?!1:LN(t)}function LN(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 $F(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return So(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Rm(t,e){let{$anchor:n,$head:r}=t.selection,s=e>0?n.max(r):n.min(r),i=s.parent.inlineContent?s.depth?t.doc.resolve(e>0?s.after():s.before()):null:s;return i&&Pe.findFrom(i,e)}function Ws(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function kv(t,e,n){let r=t.state.selection;if(r instanceof Me)if(n.indexOf("s")>-1){let{$head:s}=r,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=t.state.doc.resolve(s.pos+i.nodeSize*(e<0?-1:1));return Ws(t,new Me(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let s=Rm(t.state,e);return s&&s instanceof Ee?Ws(t,s):!1}else if(!(vr&&n.indexOf("m")>-1)){let s=r.$head,i=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,o;if(!i||i.isText)return!1;let a=e<0?s.pos-i.nodeSize:s.pos;return i.isAtom||(o=t.docView.descAt(a))&&!o.contentDOM?Ee.isSelectable(i)?Ws(t,new Ee(e<0?t.state.doc.resolve(s.pos-i.nodeSize):s)):Uc?Ws(t,new Me(t.state.doc.resolve(e<0?a:a+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Ee&&r.node.isInline)return Ws(t,new Me(e>0?r.$to:r.$from));{let s=Rm(t.state,e);return s?Ws(t,s):!1}}}function hd(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Ml(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function $o(t,e){return e<0?HF(t):UF(t)}function HF(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s,i,o=!1;for(Cr&&n.nodeType==1&&r<hd(n)&&Ml(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(Ml(a,-1))s=n,i=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(PN(n))break;{let a=n.previousSibling;for(;a&&Ml(a,-1);)s=n.parentNode,i=pn(a),a=a.previousSibling;if(a)n=a,r=hd(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?Om(t,n,r):s&&Om(t,s,i)}function UF(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let s=hd(n),i,o;for(;;)if(r<s){if(n.nodeType!=1)break;let a=n.childNodes[r];if(Ml(a,1))i=n,o=++r;else break}else{if(PN(n))break;{let a=n.nextSibling;for(;a&&Ml(a,1);)i=a.parentNode,o=pn(a)+1,a=a.nextSibling;if(a)n=a,r=0,s=hd(n);else{if(n=n.parentNode,n==t.dom)break;r=s=0}}}i&&Om(t,i,o)}function PN(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function VF(t,e){for(;t&&e==t.childNodes.length&&!Hc(t);)e=pn(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 WF(t,e){for(;t&&!e&&!Hc(t);)e=pn(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 Om(t,e,n){if(e.nodeType!=3){let i,o;(o=VF(e,n))?(e=o,n=0):(i=WF(e,n))&&(e=i,n=i.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Wf(r)){let i=document.createRange();i.setEnd(e,n),i.setStart(e,n),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:s}=t;setTimeout(()=>{t.state==s&&Cs(t)},50)}function Sv(t,e){let n=t.state.doc.resolve(e);if(!(Cn||hF)&&n.parent.inlineContent){let s=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left<s.left?"ltr":"rtl"}if(e<n.end()){let i=t.coordsAtPos(e+1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left>s.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Ev(t,e,n){let r=t.state.selection;if(r instanceof Me&&!r.empty||n.indexOf("s")>-1||vr&&n.indexOf("m")>-1)return!1;let{$from:s,$to:i}=r;if(!s.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=Rm(t.state,e);if(o&&o instanceof Ee)return Ws(t,o)}if(!s.parent.inlineContent){let o=e<0?s:i,a=r instanceof lr?Pe.near(o,e):Pe.findFrom(o,e);return a?Ws(t,a):!1}return!1}function Cv(t,e){if(!(t.state.selection instanceof Me))return!0;let{$head:n,$anchor:r,empty:s}=t.state.selection;if(!n.sameParent(r))return!0;if(!s)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let o=t.state.tr;return e<0?o.delete(n.pos-i.nodeSize,n.pos):o.delete(n.pos,n.pos+i.nodeSize),t.dispatch(o),!0}return!1}function Nv(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function qF(t){if(!Bn||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;Nv(t,r,"true"),setTimeout(()=>Nv(t,r,"false"),20)}return!1}function KF(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function GF(t,e){let n=e.keyCode,r=KF(e);if(n==8||vr&&n==72&&r=="c")return Cv(t,-1)||$o(t,-1);if(n==46&&!e.shiftKey||vr&&n==68&&r=="c")return Cv(t,1)||$o(t,1);if(n==13||n==27)return!0;if(n==37||vr&&n==66&&r=="c"){let s=n==37?Sv(t,t.state.selection.from)=="ltr"?-1:1:-1;return kv(t,s,r)||$o(t,s)}else if(n==39||vr&&n==70&&r=="c"){let s=n==39?Sv(t,t.state.selection.from)=="ltr"?1:-1:1;return kv(t,s,r)||$o(t,s)}else{if(n==38||vr&&n==80&&r=="c")return Ev(t,-1,r)||$o(t,-1);if(n==40||vr&&n==78&&r=="c")return qF(t)||Ev(t,1,r)||$o(t,1);if(r==(vr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Cb(t,e){t.someProp("transformCopied",p=>{e=p(e,t)});let n=[],{content:r,openStart:s,openEnd:i}=e;for(;s>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,i--;let p=r.firstChild;n.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let o=t.someProp("clipboardSerializer")||Po.fromSchema(t.state.schema),a=HN(),l=a.createElement("div");l.appendChild(o.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=$N[c.nodeName.toLowerCase()]);){for(let p=u.length-1;p>=0;p--){let m=a.createElement(u[p]);for(;l.firstChild;)m.appendChild(l.firstChild);l.appendChild(m),d++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${s} ${i}${d?` -${d}`:""} ${JSON.stringify(n)}`);let h=t.someProp("clipboardTextSerializer",p=>p(e,t))||e.content.textBetween(0,e.content.size,`
321
-
322
- `);return{dom:l,text:h,slice:e}}function jN(t,e,n,r,s){let i=s.parent.type.spec.code,o,a;if(!n&&!e)return null;let l=!!e&&(r||i||!n);if(l){if(t.someProp("transformPastedText",h=>{e=h(e,i||r,t)}),i)return a=new ae(G.from(t.state.schema.text(e.replace(/\r\n?/g,`
323
- `))),0,0),t.someProp("transformPasted",h=>{a=h(a,t,!0)}),a;let d=t.someProp("clipboardTextParser",h=>h(e,s,r,t));if(d)a=d;else{let h=s.marks(),{schema:p}=t.state,m=Po.fromSchema(p);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let b=o.appendChild(document.createElement("p"));g&&b.appendChild(m.serializeNode(p.text(g,h)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),o=XF(n),Uc&&QF(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let h=o.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;o=h}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||bi.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||u),context:s,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!JF.test(h.parentNode.nodeName)?{ignore:!0}:null}})),u)a=eB(_v(a,+u[1],+u[2]),u[4]);else if(a=ae.maxOpen(YF(a.content,s),!0),a.openStart||a.openEnd){let d=0,h=0;for(let p=a.content.firstChild;d<a.openStart&&!p.type.spec.isolating;d++,p=p.firstChild);for(let p=a.content.lastChild;h<a.openEnd&&!p.type.spec.isolating;h++,p=p.lastChild);a=_v(a,d,h)}return t.someProp("transformPasted",d=>{a=d(a,t,l)}),a}const JF=/^(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 YF(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let s=e.node(n).contentMatchAt(e.index(n)),i,o=[];if(t.forEach(a=>{if(!o)return;let l=s.findWrapping(a.type),c;if(!l)return o=null;if(c=o.length&&i.length&&FN(l,i,a,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=BN(o[o.length-1],i.length));let u=zN(a,l);o.push(u),s=s.matchType(u.type),i=l}}),o)return G.from(o)}return t}function zN(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,G.from(t));return t}function FN(t,e,n,r,s){if(s<t.length&&s<e.length&&t[s]==e[s]){let i=FN(t,e,n,r.lastChild,s+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(s==t.length-1?n.type:t[s+1]))return r.copy(r.content.append(G.from(zN(n,t,s+1))))}}function BN(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,BN(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(G.empty,!0);return t.copy(n.append(r))}function Im(t,e,n,r,s,i){let o=e<0?t.firstChild:t.lastChild,a=o.content;return t.childCount>1&&(i=0),s<r-1&&(a=Im(a,e,n,r,s+1,i)),s>=n&&(a=e<0?o.contentMatchAt(0).fillBefore(a,i<=s).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(G.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(a))}function _v(t,e,n){return e<t.openStart&&(t=new ae(Im(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new ae(Im(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const $N={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 Tv=null;function HN(){return Tv||(Tv=document.implementation.createHTMLDocument("title"))}let Vh=null;function ZF(t){let e=window.trustedTypes;return e?(Vh||(Vh=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Vh.createHTML(t)):t}function XF(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=HN().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),s;if((s=r&&$N[r[1].toLowerCase()])&&(t=s.map(i=>"<"+i+">").join("")+t+s.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=ZF(t),s)for(let i=0;i<s.length;i++)n=n.querySelector(s[i])||n;return n}function QF(t){let e=t.querySelectorAll(Cn?"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 eB(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:s,openStart:i,openEnd:o}=t;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;s=G.from(l.create(r[a+1],s)),i++,o++}return new ae(s,i,o)}const $n={},Hn={},tB={touchstart:!0,touchmove:!0};class nB{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.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function rB(t){for(let e in $n){let n=$n[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{iB(t,r)&&!Nb(t,r)&&(t.editable||!(r.type in Hn))&&n(t,r)},tB[e]?{passive:!0}:void 0)}Bn&&t.dom.addEventListener("input",()=>null),Dm(t)}function fi(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function sB(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 Dm(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Nb(t,r))})}function Nb(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function iB(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 oB(t,e){!Nb(t,e)&&$n[e.type]&&(t.editable||!(e.type in Hn))&&$n[e.type](t,e)}Hn.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!VN(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Ss&&Cn&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Ia&&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",s=>s(t,$i(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||GF(t,n)?n.preventDefault():fi(t,"key")};Hn.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Hn.keypress=(t,e)=>{let n=e;if(VN(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||vr&&n.metaKey)return;if(t.someProp("handleKeyPress",s=>s(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Me)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,s,i))&&t.dispatch(i()),n.preventDefault()}};function Kf(t){return{left:t.clientX,top:t.clientY}}function aB(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function _b(t,e,n,r,s){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(t.someProp(e,a=>o>i.depth?a(t,n,i.nodeAfter,i.before(o),s,!0):a(t,n,i.node(o),i.before(o),s,!1)))return!0;return!1}function ca(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 lB(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Ee.isSelectable(r)?(ca(t,new Ee(n)),!0):!1}function cB(t,e){if(e==-1)return!1;let n=t.state.selection,r,s;n instanceof Ee&&(r=n.node);let i=t.state.doc.resolve(e);for(let o=i.depth+1;o>0;o--){let a=o>i.depth?i.nodeAfter:i.node(o);if(Ee.isSelectable(a)){r&&n.$from.depth>0&&o>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?s=i.before(n.$from.depth):s=i.before(o);break}}return s!=null?(ca(t,Ee.create(t.state.doc,s)),!0):!1}function uB(t,e,n,r,s){return _b(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(s?cB(t,n):lB(t,n))}function dB(t,e,n,r){return _b(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",s=>s(t,e,r))}function fB(t,e,n,r){return _b(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",s=>s(t,e,r))||hB(t,n,r)}function hB(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(ca(t,Me.create(r,0,r.content.size)),!0):!1;let s=r.resolve(e);for(let i=s.depth+1;i>0;i--){let o=i>s.depth?s.nodeAfter:s.node(i),a=s.before(i);if(o.inlineContent)ca(t,Me.create(r,a+1,a+1+o.content.size));else if(Ee.isSelectable(o))ca(t,Ee.create(r,a));else continue;return!0}}function Tb(t){return pd(t)}const UN=vr?"metaKey":"ctrlKey";$n.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Tb(t),s=Date.now(),i="singleClick";s-t.input.lastClick.time<500&&aB(n,t.input.lastClick)&&!n[UN]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:s,x:n.clientX,y:n.clientY,type:i,button:n.button};let o=t.posAtCoords(Kf(n));o&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new pB(t,o,n,!!r)):(i=="doubleClick"?dB:fB)(t,o.pos,o.inside,n)?n.preventDefault():fi(t,"pointer"))};class pB{constructor(e,n,r,s){this.view=e,this.pos=n,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[UN],this.allowDefault=r.shiftKey;let i,o;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),o=n.inside;else{let u=e.state.doc.resolve(n.pos);i=u.parent,o=u.depth?u.before():0}const a=s?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:c}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof Ee&&c.from<=o&&c.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Cr&&!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)),fi(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(()=>Cs(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(Kf(e))),this.updateAllowDefault(e),this.allowDefault||!n?fi(this.view,"pointer"):uB(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Bn&&this.mightDrag&&!this.mightDrag.node.isAtom||Cn&&!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)?(ca(this.view,Pe.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):fi(this.view,"pointer")}move(e){this.updateAllowDefault(e),fi(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)}}$n.touchstart=t=>{t.input.lastTouch=Date.now(),Tb(t),fi(t,"pointer")};$n.touchmove=t=>{t.input.lastTouch=Date.now(),fi(t,"pointer")};$n.contextmenu=t=>Tb(t);function VN(t,e){return t.composing?!0:Bn&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const mB=Ss?5e3:-1;Hn.compositionstart=Hn.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Me&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),pd(t,!0),t.markCursor=null;else if(pd(t,!e.selection.empty),Cr&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let s=r.focusNode,i=r.focusOffset;s&&s.nodeType==1&&i!=0;){let o=i<0?s.lastChild:s.childNodes[i-1];if(!o)break;if(o.nodeType==3){let a=t.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else s=o,i=-1}}t.input.composing=!0}WN(t,mB)};Hn.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.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,WN(t,20))};function WN(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>pd(t),e))}function qN(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=bB());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function gB(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=lF(e.focusNode,e.focusOffset),r=cF(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let s=r.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!s||!s.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function bB(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function pd(t,e=!1){if(!(Ss&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),qN(t),e||t.docView&&t.docView.dirty){let n=Sb(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 yB(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(),s=document.createRange();s.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Zl=er&&yi<15||Ia&&pF<604;$n.copy=Hn.cut=(t,e)=>{let n=e,r=t.state.selection,s=n.type=="cut";if(r.empty)return;let i=Zl?null:n.clipboardData,o=r.content(),{dom:a,text:l}=Cb(t,o);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):yB(t,a),s&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function xB(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function vB(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 s=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Xl(t,r.value,null,s,e):Xl(t,r.textContent,r.innerHTML,s,e)},50)}function Xl(t,e,n,r,s){let i=jN(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,s,i||ae.empty)))return!0;if(!i)return!1;let o=xB(i),a=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(i);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function KN(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," "):""}Hn.paste=(t,e)=>{let n=e;if(t.composing&&!Ss)return;let r=Zl?null:n.clipboardData,s=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Xl(t,KN(r),r.getData("text/html"),s,n)?n.preventDefault():vB(t,n)};class GN{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const wB=vr?"altKey":"ctrlKey";function JN(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[wB]}$n.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let s=t.state.selection,i=s.empty?null:t.posAtCoords(Kf(n)),o;if(!(i&&i.pos>=s.from&&i.pos<=(s instanceof Ee?s.to-1:s.to))){if(r&&r.mightDrag)o=Ee.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&&(o=Ee.create(t.state.doc,d.posBefore))}}let a=(o||t.state.selection).content(),{dom:l,text:c,slice:u}=Cb(t,a);(!n.dataTransfer.files.length||!Cn||wN>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Zl?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",Zl||n.dataTransfer.setData("text/plain",c),t.dragging=new GN(u,JN(t,n),o)};$n.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Hn.dragover=Hn.dragenter=(t,e)=>e.preventDefault();Hn.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let s=t.posAtCoords(Kf(n));if(!s)return;let i=t.state.doc.resolve(s.pos),o=r&&r.slice;o?t.someProp("transformPasted",m=>{o=m(o,t,!1)}):o=jN(t,KN(n.dataTransfer),Zl?null:n.dataTransfer.getData("text/html"),!1,i);let a=!!(r&&JN(t,n));if(t.someProp("handleDrop",m=>m(t,n,o||ae.empty,a))){n.preventDefault();return}if(!o)return;n.preventDefault();let l=o?eN(t.state.doc,i.pos,o):i.pos;l==null&&(l=i.pos);let c=t.state.tr;if(a){let{node:m}=r;m?m.replace(c):c.deleteSelection()}let u=c.mapping.map(l),d=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,h=c.doc;if(d?c.replaceRangeWith(u,u,o.content.firstChild):c.replaceRange(u,u,o),c.doc.eq(h))return;let p=c.doc.resolve(u);if(d&&Ee.isSelectable(o.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new Ee(p));else{let m=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((g,b,x,w)=>m=w),c.setSelection(Eb(t,p,c.doc.resolve(m)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))};$n.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())&&Cs(t)},20))};$n.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)};$n.beforeinput=(t,e)=>{if(Cn&&Ss&&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",i=>i(t,$i(8,"Backspace")))))return;let{$cursor:s}=t.state.selection;s&&s.pos>0&&t.dispatch(t.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let t in Hn)$n[t]=Hn[t];function Ql(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 md{constructor(e,n){this.toDOM=e,this.spec=n||co,this.side=this.spec.side||0}map(e,n,r,s){let{pos:i,deleted:o}=e.mapResult(n.from+s,this.side<0?-1:1);return o?null:new tn(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof md&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ql(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class vi{constructor(e,n){this.attrs=e,this.spec=n||co}map(e,n,r,s){let i=e.map(n.from+s,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+s,this.spec.inclusiveEnd?1:-1)-r;return i>=o?null:new tn(i,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof vi&&Ql(this.attrs,e.attrs)&&Ql(this.spec,e.spec)}static is(e){return e.type instanceof vi}destroy(){}}class Ab{constructor(e,n){this.attrs=e,this.spec=n||co}map(e,n,r,s){let i=e.mapResult(n.from+s,1);if(i.deleted)return null;let o=e.mapResult(n.to+s,-1);return o.deleted||o.pos<=i.pos?null:new tn(i.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:s}=e.content.findIndex(n.from),i;return s==n.from&&!(i=e.child(r)).isText&&s+i.nodeSize==n.to}eq(e){return this==e||e instanceof Ab&&Ql(this.attrs,e.attrs)&&Ql(this.spec,e.spec)}destroy(){}}class tn{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new tn(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 tn(e,e,new md(n,r))}static inline(e,n,r,s){return new tn(e,n,new vi(r,s))}static node(e,n,r,s){return new tn(e,n,new Ab(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof vi}get widget(){return this.type instanceof md}}const qo=[],co={};class yt{constructor(e,n){this.local=e.length?e:qo,this.children=n.length?n:qo}static create(e,n){return n.length?gd(n,e,0,co):wn}find(e,n,r){let s=[];return this.findInner(e??0,n??1e9,s,0,r),s}findInner(e,n,r,s,i){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=n&&a.to>=e&&(!i||i(a.spec))&&r.push(a.copy(a.from+s,a.to+s))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,n-a,r,s+a,i)}}map(e,n,r){return this==wn||e.maps.length==0?this:this.mapInner(e,n,0,0,r||co)}mapInner(e,n,r,s,i){let o;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,s);l&&l.type.valid(n,l)?(o||(o=[])).push(l):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?kB(this.children,o||[],e,n,r,s,i):o?new yt(o.sort(uo),qo):wn}add(e,n){return n.length?this==wn?yt.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let s,i=0;e.forEach((a,l)=>{let c=l+r,u;if(u=ZN(n,a,c)){for(s||(s=this.children.slice());i<s.length&&s[i]<l;)i+=3;s[i]==l?s[i+2]=s[i+2].addInner(a,u,c+1):s.splice(i,0,l,l+a.nodeSize,gd(u,a,c+1,co)),i+=3}});let o=YN(i?XN(n):n,-r);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new yt(o.length?this.local.concat(o).sort(uo):this.local,s||this.children)}remove(e){return e.length==0||this==wn?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,s=this.local;for(let i=0;i<r.length;i+=3){let o,a=r[i]+n,l=r[i+1]+n;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>a&&d.to<l&&(e[u]=null,(o||(o=[])).push(d));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(o,a+1);c!=wn?r[i+2]=c:(r.splice(i,3),i-=3)}if(s.length){for(let i=0,o;i<e.length;i++)if(o=e[i])for(let a=0;a<s.length;a++)s[a].eq(o,n)&&(s==this.local&&(s=this.local.slice()),s.splice(a--,1))}return r==this.children&&s==this.local?this:s.length||r.length?new yt(s,r):wn}forChild(e,n){if(this==wn)return this;if(n.isLeaf)return yt.empty;let r,s;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 i=e+1,o=i+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<o&&l.to>i&&l.type instanceof vi){let c=Math.max(i,l.from)-i,u=Math.min(o,l.to)-i;c<u&&(s||(s=[])).push(l.copy(c,u))}}if(s){let a=new yt(s.sort(uo),qo);return r?new Js([a,r]):a}return r||wn}eq(e){if(this==e)return!0;if(!(e instanceof yt)||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 Mb(this.localsInner(e))}localsInner(e){if(this==wn)return qo;if(e.inlineContent||!this.local.some(vi.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof vi||n.push(this.local[r]);return n}forEachSet(e){e(this)}}yt.empty=new yt([],[]);yt.removeOverlap=Mb;const wn=yt.empty;class Js{constructor(e){this.members=e}map(e,n){const r=this.members.map(s=>s.map(e,n,co));return Js.from(r)}forChild(e,n){if(n.isLeaf)return yt.empty;let r=[];for(let s=0;s<this.members.length;s++){let i=this.members[s].forChild(e,n);i!=wn&&(i instanceof Js?r=r.concat(i.members):r.push(i))}return Js.from(r)}eq(e){if(!(e instanceof Js)||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 s=0;s<this.members.length;s++){let i=this.members[s].localsInner(e);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let o=0;o<i.length;o++)n.push(i[o])}}return n?Mb(r?n:n.sort(uo)):qo}static from(e){switch(e.length){case 0:return wn;case 1:return e[0];default:return new Js(e.every(n=>n instanceof yt)?e:e.reduce((n,r)=>n.concat(r instanceof yt?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function kB(t,e,n,r,s,i,o){let a=t.slice();for(let c=0,u=i;c<n.maps.length;c++){let d=0;n.maps[c].forEach((h,p,m,g)=>{let b=g-m-(p-h);for(let x=0;x<a.length;x+=3){let w=a[x+1];if(w<0||h>w+u-d)continue;let v=a[x]+u-d;p>=v?a[x+1]=h<=v?-2:-1:h>=u&&b&&(a[x]+=b,a[x+1]+=b)}d+=b}),u=n.maps[c].map(u,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let u=n.map(t[c]+i),d=u-s;if(d<0||d>=r.content.size){l=!0;continue}let h=n.map(t[c+1]+i,-1),p=h-s,{index:m,offset:g}=r.content.findIndex(d),b=r.maybeChild(m);if(b&&g==d&&g+b.nodeSize==p){let x=a[c+2].mapInner(n,b,u+1,t[c]+i+1,o);x!=wn?(a[c]=d,a[c+1]=p,a[c+2]=x):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=SB(a,t,e,n,s,i,o),u=gd(c,r,0,o);e=u.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<u.children.length;d+=3){let p=u.children[d];for(;h<a.length&&a[h]<p;)h+=3;a.splice(h,0,u.children[d],u.children[d+1],u.children[d+2])}}return new yt(e.sort(uo),a)}function YN(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let s=t[r];n.push(new tn(s.from+e,s.to+e,s.type))}return n}function SB(t,e,n,r,s,i,o){function a(l,c){for(let u=0;u<l.local.length;u++){let d=l.local[u].map(r,s,c);d?n.push(d):o.onRemove&&o.onRemove(l.local[u].spec)}for(let u=0;u<l.children.length;u+=3)a(l.children[u+2],l.children[u]+c+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&a(t[l+2],e[l]+i+1);return n}function ZN(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,s=null;for(let i=0,o;i<t.length;i++)(o=t[i])&&o.from>n&&o.to<r&&((s||(s=[])).push(o),t[i]=null);return s}function XN(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function gd(t,e,n,r){let s=[],i=!1;e.forEach((a,l)=>{let c=ZN(t,a,l+n);if(c){i=!0;let u=gd(c,a,n+l+1,r);u!=wn&&s.push(l,l+a.nodeSize,u)}});let o=YN(i?XN(t):t,-n).sort(uo);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(r.onRemove&&r.onRemove(o[a].spec),o.splice(a--,1));return o.length||s.length?new yt(o,s):wn}function uo(t,e){return t.from-e.from||t.to-e.to}function Mb(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let s=n+1;s<e.length;s++){let i=e[s];if(i.from==r.from){i.to!=r.to&&(e==t&&(e=t.slice()),e[s]=i.copy(i.from,r.to),Av(e,s+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),Av(e,s,r.copy(i.from,r.to)));break}}}return e}function Av(t,e,n){for(;e<t.length&&uo(n,t[e])>0;)e++;t.splice(e,0,n)}function Wh(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=wn&&e.push(r)}),t.cursorWrapper&&e.push(yt.create(t.state.doc,[t.cursorWrapper.deco])),Js.from(e)}const EB={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},CB=er&&yi<=11;class NB{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 _B{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new NB,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let s=0;s<r.length;s++)this.queue.push(r[s]);er&&yi<=11&&r.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():this.flush()}),CB&&(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,EB)),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(wv(this.view)){if(this.suppressingSelectionUpdates)return Cs(this.view);if(er&&yi<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&So(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 i=e.focusNode;i;i=Oa(i))n.add(i);for(let i=e.anchorNode;i;i=Oa(i))if(n.has(i)){r=i;break}let s=r&&this.view.docView.nearestDesc(r);if(s&&s.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(),s=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&wv(e)&&!this.ignoreSelectionChange(r),i=-1,o=-1,a=!1,l=[];if(e.editable)for(let u=0;u<n.length;u++){let d=this.registerMutation(n[u],l);d&&(i=i<0?d.from:Math.min(d.from,i),o=o<0?d.to:Math.max(d.to,o),d.typeOver&&(a=!0))}if(Cr&&l.length){let u=l.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,h]=u;d.parentNode&&d.parentNode.parentNode==h.parentNode?h.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let h of u){let p=h.parentNode;p&&p.nodeName=="LI"&&(!d||MB(e,d)!=p)&&h.remove()}}}let c=null;i<0&&s&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Wf(r)&&(c=Sb(e))&&c.eq(Pe.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Cs(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||s)&&(i>-1&&(e.docView.markDirty(i,o),TB(e)),this.handleDOMChange(i,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Cs(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 u=0;u<e.addedNodes.length;u++){let d=e.addedNodes[u];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 s=e.previousSibling,i=e.nextSibling;if(er&&yi<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:h}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(s=d),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(i=h)}let o=s&&s.parentNode==e.target?pn(s)+1:0,a=r.localPosFromDOM(e.target,o,-1),l=i&&i.parentNode==e.target?pn(i):e.target.childNodes.length,c=r.localPosFromDOM(e.target,l,1);return{from:a,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Mv=new WeakMap,Rv=!1;function TB(t){if(!Mv.has(t)&&(Mv.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Cr,Rv)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."),Rv=!0}}function Ov(t,e){let n=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return So(o.node,o.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function AB(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return Ov(t,s)}let n;function r(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?Ov(t,n):null}function MB(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 RB(t,e,n){let{node:r,fromOffset:s,toOffset:i,from:o,to:a}=t.docView.parseRange(e,n),l=t.domSelectionRange(),c,u=l.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:l.anchorOffset}],Wf(l)||c.push({node:l.focusNode,offset:l.focusOffset})),Cn&&t.input.lastKeyCode===8)for(let b=i;b>s;b--){let x=r.childNodes[b-1],w=x.pmViewDesc;if(x.nodeName=="BR"&&!w){i=b;break}if(!w||w.size)break}let d=t.state.doc,h=t.someProp("domParser")||bi.fromSchema(t.state.schema),p=d.resolve(o),m=null,g=h.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:s,to:i,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:OB,context:p});if(c&&c[0].pos!=null){let b=c[0].pos,x=c[1]&&c[1].pos;x==null&&(x=b),m={anchor:b+o,head:x+o}}return{doc:g,sel:m,from:o,to:a}}function OB(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Bn&&/^(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||Bn&&/^(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 IB=/^(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 DB(t,e,n,r,s){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let C=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,T=Sb(t,C);if(T&&!t.state.selection.eq(T)){if(Cn&&Ss&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",_=>_(t,$i(13,"Enter"))))return;let R=t.state.tr.setSelection(T);C=="pointer"?R.setMeta("pointer",!0):C=="key"&&R.scrollIntoView(),i&&R.setMeta("composition",i),t.dispatch(R)}return}let o=t.state.doc.resolve(e),a=o.sharedDepth(n);e=o.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l=t.state.selection,c=RB(t,e,n),u=t.state.doc,d=u.slice(c.from,c.to),h,p;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(h=t.state.selection.to,p="end"):(h=t.state.selection.from,p="start"),t.input.lastKeyCode=null;let m=jB(d.content,c.doc.content,c.from,h,p);if(m&&t.input.domChangeCount++,(Ia&&t.input.lastIOSEnter>Date.now()-225||Ss)&&s.some(C=>C.nodeType==1&&!IB.test(C.nodeName))&&(!m||m.endA>=m.endB)&&t.someProp("handleKeyDown",C=>C(t,$i(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!m)if(r&&l instanceof Me&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))m={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let C=Iv(t,t.state.doc,c.sel);if(C&&!C.eq(t.state.selection)){let T=t.state.tr.setSelection(C);i&&T.setMeta("composition",i),t.dispatch(T)}}return}t.state.selection.from<t.state.selection.to&&m.start==m.endB&&t.state.selection instanceof Me&&(m.start>t.state.selection.from&&m.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?m.start=t.state.selection.from:m.endA<t.state.selection.to&&m.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(m.endB+=t.state.selection.to-m.endA,m.endA=t.state.selection.to)),er&&yi<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>c.from&&c.doc.textBetween(m.start-c.from-1,m.start-c.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let g=c.doc.resolveNoCache(m.start-c.from),b=c.doc.resolveNoCache(m.endB-c.from),x=u.resolve(m.start),w=g.sameParent(b)&&g.parent.inlineContent&&x.end()>=m.endA;if((Ia&&t.input.lastIOSEnter>Date.now()-225&&(!w||s.some(C=>C.nodeName=="DIV"||C.nodeName=="P"))||!w&&g.pos<c.doc.content.size&&(!g.sameParent(b)||!g.parent.inlineContent)&&g.pos<b.pos&&!/\S/.test(c.doc.textBetween(g.pos,b.pos,"","")))&&t.someProp("handleKeyDown",C=>C(t,$i(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>m.start&&PB(u,m.start,m.endA,g,b)&&t.someProp("handleKeyDown",C=>C(t,$i(8,"Backspace")))){Ss&&Cn&&t.domObserver.suppressSelectionUpdates();return}Cn&&m.endB==m.start&&(t.input.lastChromeDelete=Date.now()),Ss&&!w&&g.start()!=b.start()&&b.parentOffset==0&&g.depth==b.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==m.endA&&(m.endB-=2,b=c.doc.resolveNoCache(m.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(C){return C(t,$i(13,"Enter"))})},20));let v=m.start,k=m.endA,N=C=>{let T=C||t.state.tr.replace(v,k,c.doc.slice(m.start-c.from,m.endB-c.from));if(c.sel){let R=Iv(t,T.doc,c.sel);R&&!(Cn&&t.composing&&R.empty&&(m.start!=m.endB||t.input.lastChromeDelete<Date.now()-100)&&(R.head==v||R.head==T.mapping.map(k)-1)||er&&R.empty&&R.head==v)&&T.setSelection(R)}return i&&T.setMeta("composition",i),T.scrollIntoView()},S;if(w)if(g.pos==b.pos){er&&yi<=11&&g.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Cs(t),20));let C=N(t.state.tr.delete(v,k)),T=u.resolve(m.start).marksAcross(u.resolve(m.endA));T&&C.ensureMarks(T),t.dispatch(C)}else if(m.endA==m.endB&&(S=LB(g.parent.content.cut(g.parentOffset,b.parentOffset),x.parent.content.cut(x.parentOffset,m.endA-x.start())))){let C=N(t.state.tr);S.type=="add"?C.addMark(v,k,S.mark):C.removeMark(v,k,S.mark),t.dispatch(C)}else if(g.parent.child(g.index()).isText&&g.index()==b.index()-(b.textOffset?0:1)){let C=g.parent.textBetween(g.parentOffset,b.parentOffset),T=()=>N(t.state.tr.insertText(C,v,k));t.someProp("handleTextInput",R=>R(t,v,k,C,T))||t.dispatch(T())}else t.dispatch(N());else t.dispatch(N())}function Iv(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Eb(t,e.resolve(n.anchor),e.resolve(n.head))}function LB(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,s=n,i=r,o,a,l;for(let u=0;u<r.length;u++)s=r[u].removeFromSet(s);for(let u=0;u<n.length;u++)i=n[u].removeFromSet(i);if(s.length==1&&i.length==0)a=s[0],o="add",l=u=>u.mark(a.addToSet(u.marks));else if(s.length==0&&i.length==1)a=i[0],o="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(l(e.child(u)));if(G.from(c).eq(t))return{mark:a,type:o}}function PB(t,e,n,r,s){if(n-e<=s.pos-r.pos||qh(r,!0,!1)<s.pos)return!1;let i=t.resolve(e);if(!r.parent.isTextblock){let a=i.nodeAfter;return a!=null&&n==e+a.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let o=t.resolve(qh(i,!0,!0));return!o.parent.isTextblock||o.pos>n||qh(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function qh(t,e,n){let r=t.depth,s=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,s++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,s++}return s}function jB(t,e,n,r,s){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:o,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(s=="end"){let l=Math.max(0,i-Math.min(o,a));r-=o+l-i}if(o<i&&t.size<e.size){let l=r<=i&&r>=o?i-r:0;i-=l,i&&i<e.size&&Dv(e.textBetween(i-1,i+1))&&(i+=l?1:-1),a=i+(a-o),o=i}else if(a<i){let l=r<=i&&r>=a?i-r:0;i-=l,i&&i<t.size&&Dv(t.textBetween(i-1,i+1))&&(i+=l?1:-1),o=i+(o-a),a=i}return{start:i,endA:o,endB:a}}function Dv(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 QN{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 nB,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Fv),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=jv(this),Pv(this),this.nodeViews=zv(this),this.docView=mv(this.state.doc,Lv(this),Wh(this),this.dom,this),this.domObserver=new _B(this,(r,s,i,o)=>DB(this,r,s,i,o)),this.domObserver.start(),rB(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&&Dm(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Fv),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 s=this.state,i=!1,o=!1;e.storedMarks&&this.composing&&(qN(this),o=!0),this.state=e;let a=s.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=zv(this);FB(p,this.nodeViews)&&(this.nodeViews=p,i=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&Dm(this),this.editable=jv(this),Pv(this);let l=Wh(this),c=Lv(this),u=s.plugins!=e.plugins&&!s.doc.eq(e.doc)?"reset":e.scrollToSelection>s.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(e.doc,c,l);(d||!e.selection.eq(s.selection))&&(o=!0);let h=u=="preserve"&&o&&this.dom.style.overflowAnchor==null&&bF(this);if(o){this.domObserver.stop();let p=d&&(er||Cn)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&zB(s.selection,e.selection);if(d){let m=Cn?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=gB(this)),(i||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=mv(e.doc,c,l,this.dom,this)),m&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&$F(this))?Cs(this,p):(DN(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(s),!((r=this.dragging)===null||r===void 0)&&r.node&&!s.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,s),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():h&&yF(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 Ee){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&cv(this,n.getBoundingClientRect(),e)}else cv(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,s=-1;if(this.state.doc.nodeAt(r.from)==r.node)s=r.from;else{let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==r.node&&(s=i)}this.dragging=new GN(e.slice,e.move,s<0?void 0:Ee.create(this.state.doc,s))}someProp(e,n){let r=this._props&&this._props[e],s;if(r!=null&&(s=n?n(r):r))return s;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(s=n?n(a):a))return s}let i=this.state.plugins;if(i)for(let o=0;o<i.length;o++){let a=i[o].props[e];if(a!=null&&(s=n?n(a):a))return s}}hasFocus(){if(er){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&&xF(this.dom),Cs(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 EF(this,e)}coordsAtPos(e,n=1){return NN(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 s=this.docView.posFromDOM(e,n,r);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(e,n){return AF(this,n||this.state,e)}pasteHTML(e,n){return Xl(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Xl(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return Cb(this,e)}destroy(){this.docView&&(sB(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Wh(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,oF())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return oB(this,e)}domSelectionRange(){let e=this.domSelection();return e?Bn&&this.root.nodeType===11&&dF(this.dom.ownerDocument)==this.dom&&AB(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}QN.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function Lv(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"),[tn.node(0,t.state.doc.content.size,e)]}function Pv(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:tn.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function jv(t){return!t.someProp("editable",e=>e(t.state)===!1)}function zB(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 zv(t){let e=Object.create(null);function n(r){for(let s in r)Object.prototype.hasOwnProperty.call(e,s)||(e[s]=r[s])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function FB(t,e){let n=0,r=0;for(let s in t){if(t[s]!=e[s])return!0;n++}for(let s in e)r++;return n!=r}function Fv(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 ki={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:"'"},bd={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},BB=typeof navigator<"u"&&/Mac/.test(navigator.platform),$B=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var mn=0;mn<10;mn++)ki[48+mn]=ki[96+mn]=String(mn);for(var mn=1;mn<=24;mn++)ki[mn+111]="F"+mn;for(var mn=65;mn<=90;mn++)ki[mn]=String.fromCharCode(mn+32),bd[mn]=String.fromCharCode(mn);for(var Kh in ki)bd.hasOwnProperty(Kh)||(bd[Kh]=ki[Kh]);function HB(t){var e=BB&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||$B&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?bd:ki)[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 UB=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),VB=typeof navigator<"u"&&/Win/.test(navigator.platform);function WB(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,s,i,o;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))s=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))UB?o=!0:s=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),s&&(n="Ctrl-"+n),o&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function qB(t){let e=Object.create(null);for(let n in t)e[WB(n)]=t[n];return e}function Gh(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 KB(t){return new Rt({props:{handleKeyDown:Rb(t)}})}function Rb(t){let e=qB(t);return function(n,r){let s=HB(r),i,o=e[Gh(s,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let a=e[Gh(s,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(VB&&r.ctrlKey&&r.altKey)&&(i=ki[r.keyCode])&&i!=s){let a=e[Gh(i,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}var GB=Object.defineProperty,Ob=(t,e)=>{for(var n in e)GB(t,n,{get:e[n],enumerable:!0})};function Gf(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:s}=n,{storedMarks:i}=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 i},get selection(){return r},get doc(){return s},get tr(){return r=n.selection,s=n.doc,i=n.storedMarks,n}}}var Jf=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:s}=n,i=this.buildProps(s);return Object.fromEntries(Object.entries(t).map(([o,a])=>[o,(...c)=>{const u=a(...c)(i);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(s),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:s}=this,{view:i}=r,o=[],a=!!t,l=t||s.tr,c=()=>(!a&&e&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(l),o.every(d=>d===!0)),u={...Object.fromEntries(Object.entries(n).map(([d,h])=>[d,(...m)=>{const g=this.buildProps(l,e),b=h(...m)(g);return o.push(b),u}])),run:c};return u}createCan(t){const{rawCommands:e,state:n}=this,r=!1,s=t||n.tr,i=this.buildProps(s,r);return{...Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...c)=>l(...c)({...i,dispatch:void 0})])),chain:()=>this.createChain(s,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:s}=this,{view:i}=r,o={tr:t,editor:r,view:i,state:Gf({state:s,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,(...c)=>l(...c)(o)]))}};return o}},e1={};Ob(e1,{blur:()=>JB,clearContent:()=>YB,clearNodes:()=>ZB,command:()=>XB,createParagraphNear:()=>QB,cut:()=>e$,deleteCurrentNode:()=>t$,deleteNode:()=>n$,deleteRange:()=>r$,deleteSelection:()=>s$,enter:()=>i$,exitCode:()=>o$,extendMarkRange:()=>a$,first:()=>l$,focus:()=>c$,forEach:()=>u$,insertContent:()=>d$,insertContentAt:()=>p$,joinBackward:()=>b$,joinDown:()=>g$,joinForward:()=>y$,joinItemBackward:()=>x$,joinItemForward:()=>v$,joinTextblockBackward:()=>w$,joinTextblockForward:()=>k$,joinUp:()=>m$,keyboardShortcut:()=>E$,lift:()=>C$,liftEmptyBlock:()=>N$,liftListItem:()=>_$,newlineInCode:()=>T$,resetAttributes:()=>A$,scrollIntoView:()=>M$,selectAll:()=>R$,selectNodeBackward:()=>O$,selectNodeForward:()=>I$,selectParentNode:()=>D$,selectTextblockEnd:()=>L$,selectTextblockStart:()=>P$,setContent:()=>j$,setMark:()=>e4,setMeta:()=>t4,setNode:()=>n4,setNodeSelection:()=>r4,setTextSelection:()=>s4,sinkListItem:()=>i4,splitBlock:()=>o4,splitListItem:()=>a4,toggleList:()=>l4,toggleMark:()=>c4,toggleNode:()=>u4,toggleWrap:()=>d4,undoInputRule:()=>f4,unsetAllMarks:()=>h4,unsetMark:()=>p4,updateAttributes:()=>m4,wrapIn:()=>g4,wrapInList:()=>b4});var JB=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())==null||n.removeAllRanges())}),!0),YB=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),ZB=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:s}=r;return n&&s.forEach(({$from:i,$to:o})=>{t.doc.nodesBetween(i.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(l)),h=c.resolve(u.map(l+a.nodeSize)),p=d.blockRange(h);if(!p)return;const m=Ya(p);if(a.type.isTextblock){const{defaultType:g}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(p.start,g)}(m||m===0)&&e.lift(p,m)})}),!0},XB=t=>e=>t(e),QB=()=>({state:t,dispatch:e})=>gN(t,e),e$=(t,e)=>({editor:n,tr:r})=>{const{state:s}=n,i=s.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,i.content),r.setSelection(new Me(r.doc.resolve(Math.max(o-1,0)))),!0},t$=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const s=t.selection.$anchor;for(let i=s.depth;i>0;i-=1)if(s.node(i).type===r.type){if(e){const a=s.before(i),l=s.after(i);t.delete(a,l).scrollIntoView()}return!0}return!1};function Zt(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 n$=t=>({tr:e,state:n,dispatch:r})=>{const s=Zt(t,n.schema),i=e.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===s){if(r){const l=i.before(o),c=i.after(o);e.delete(l,c).scrollIntoView()}return!0}return!1},r$=t=>({tr:e,dispatch:n})=>{const{from:r,to:s}=t;return n&&e.delete(r,s),!0},s$=()=>({state:t,dispatch:e})=>bb(t,e),i$=()=>({commands:t})=>t.keyboardShortcut("Enter"),o$=()=>({state:t,dispatch:e})=>Wz(t,e);function Ib(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function yd(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(s=>n.strict?e[s]===t[s]:Ib(e[s])?e[s].test(t[s]):e[s]===t[s]):!0}function t1(t,e,n={}){return t.find(r=>r.type===e&&yd(Object.fromEntries(Object.keys(n).map(s=>[s,r.attrs[s]])),n))}function Bv(t,e,n={}){return!!t1(t,e,n)}function Db(t,e,n){var r;if(!t||!e)return;let s=t.parent.childAfter(t.parentOffset);if((!s.node||!s.node.marks.some(u=>u.type===e))&&(s=t.parent.childBefore(t.parentOffset)),!s.node||!s.node.marks.some(u=>u.type===e)||(n=n||((r=s.node.marks[0])==null?void 0:r.attrs),!t1([...s.node.marks],e,n)))return;let o=s.index,a=t.start()+s.offset,l=o+1,c=a+s.node.nodeSize;for(;o>0&&Bv([...t.parent.child(o-1).marks],e,n);)o-=1,a-=t.parent.child(o).nodeSize;for(;l<t.parent.childCount&&Bv([...t.parent.child(l).marks],e,n);)c+=t.parent.child(l).nodeSize,l+=1;return{from:a,to:c}}function Ds(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 a$=(t,e={})=>({tr:n,state:r,dispatch:s})=>{const i=Ds(t,r.schema),{doc:o,selection:a}=n,{$from:l,from:c,to:u}=a;if(s){const d=Db(l,i,e);if(d&&d.from<=c&&d.to>=u){const h=Me.create(o,d.from,d.to);n.setSelection(h)}}return!0},l$=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 n1(t){return t instanceof Me}function Ki(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function r1(t,e=null){if(!e)return null;const n=Pe.atStart(t),r=Pe.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const s=n.from,i=r.to;return e==="all"?Me.create(t,Ki(0,s,i),Ki(t.content.size,s,i)):Me.create(t,Ki(e,s,i),Ki(e,s,i))}function s1(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Yf(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var c$=(t=null,e={})=>({editor:n,view:r,tr:s,dispatch:i})=>{e={scrollIntoView:!0,...e};const o=()=>{(Yf()||s1())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&t===null||t===!1)return!0;if(i&&t===null&&!n1(n.state.selection))return o(),!0;const a=r1(s.doc,t)||n.state.selection,l=n.state.selection.eq(a);return i&&(l||s.setSelection(a),l&&s.storedMarks&&s.setStoredMarks(s.storedMarks),o()),!0},u$=(t,e)=>n=>t.every((r,s)=>e(r,{...n,index:s})),d$=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),i1=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&&i1(r)}return t};function cu(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 i1(n)}function ec(t,e,n){if(t instanceof gi||t instanceof G)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,s=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return G.fromArray(t.map(a=>e.nodeFromJSON(a)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),ec("",e,n)}if(s){if(n.errorOnInvalidContent){let o=!1,a="";const l=new UC({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(o=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?bi.fromSchema(l).parseSlice(cu(t),n.parseOptions):bi.fromSchema(l).parse(cu(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const i=bi.fromSchema(e);return n.slice?i.parseSlice(cu(t),n.parseOptions).content:i.parse(cu(t),n.parseOptions)}return ec("",e,n)}function f$(t,e,n){const r=t.steps.length-1;if(r<e)return;const s=t.steps[r];if(!(s instanceof ln||s instanceof cn))return;const i=t.mapping.maps[r];let o=0;i.forEach((a,l,c,u)=>{o===0&&(o=u)}),t.setSelection(Pe.near(t.doc.resolve(o),n))}var h$=t=>!("type"in t),p$=(t,e,n)=>({tr:r,dispatch:s,editor:i})=>{var o;if(s){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;const l=b=>{i.emit("contentError",{editor:i,error:b,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{ec(e,i.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(b){l(b)}try{a=ec(e,i.schema,{parseOptions:c,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:i.options.enableContentCheck})}catch(b){return l(b),!1}let{from:u,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},h=!0,p=!0;if((h$(a)?a:[a]).forEach(b=>{b.check(),h=h?b.isText&&b.marks.length===0:!1,p=p?b.isBlock:!1}),u===d&&p){const{parent:b}=r.doc.resolve(u);b.isTextblock&&!b.type.spec.code&&!b.childCount&&(u-=1,d+=1)}let g;if(h){if(Array.isArray(e))g=e.map(b=>b.text||"").join("");else if(e instanceof G){let b="";e.forEach(x=>{x.text&&(b+=x.text)}),g=b}else typeof e=="object"&&e&&e.text?g=e.text:g=e;r.insertText(g,u,d)}else{g=a;const b=r.doc.resolve(u),x=b.node(),w=b.parentOffset===0,v=x.isText||x.isTextblock,k=x.content.size>0;w&&v&&k&&(u=Math.max(0,u-1)),r.replaceWith(u,d,g)}n.updateSelection&&f$(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:g}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:g})}return!0},m$=()=>({state:t,dispatch:e})=>Hz(t,e),g$=()=>({state:t,dispatch:e})=>Uz(t,e),b$=()=>({state:t,dispatch:e})=>cN(t,e),y$=()=>({state:t,dispatch:e})=>hN(t,e),x$=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Hf(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},v$=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Hf(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},w$=()=>({state:t,dispatch:e})=>Bz(t,e),k$=()=>({state:t,dispatch:e})=>$z(t,e);function o1(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function S$(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,s,i,o;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))s=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))Yf()||o1()?o=!0:s=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(n=`Alt-${n}`),s&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),i&&(n=`Shift-${n}`),n}var E$=t=>({editor:e,view:n,tr:r,dispatch:s})=>{const i=S$(t).split(/-(?!$)/),o=i.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,a))});return l==null||l.steps.forEach(c=>{const u=c.map(r.mapping);u&&s&&r.maybeStep(u)}),!0};function Si(t,e,n={}){const{from:r,to:s,empty:i}=t.selection,o=e?Zt(e,t.schema):null,a=[];t.doc.nodesBetween(r,s,(d,h)=>{if(d.isText)return;const p=Math.max(r,h),m=Math.min(s,h+d.nodeSize);a.push({node:d,from:p,to:m})});const l=s-r,c=a.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>yd(d.node.attrs,n,{strict:!1}));return i?!!c.length:c.reduce((d,h)=>d+h.to-h.from,0)>=l}var C$=(t,e={})=>({state:n,dispatch:r})=>{const s=Zt(t,n.schema);return Si(n,s,e)?Vz(n,r):!1},N$=()=>({state:t,dispatch:e})=>bN(t,e),_$=t=>({state:e,dispatch:n})=>{const r=Zt(t,e.schema);return nF(r)(e,n)},T$=()=>({state:t,dispatch:e})=>mN(t,e);function Zf(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function $v(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,s)=>(n.includes(s)||(r[s]=t[s]),r),{})}var A$=(t,e)=>({tr:n,state:r,dispatch:s})=>{let i=null,o=null;const a=Zf(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(i=Zt(t,r.schema)),a==="mark"&&(o=Ds(t,r.schema)),s&&n.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(c,u)=>{i&&i===c.type&&n.setNodeMarkup(u,void 0,$v(c.attrs,e)),o&&c.marks.length&&c.marks.forEach(d=>{o===d.type&&n.addMark(u,u+c.nodeSize,o.create($v(d.attrs,e)))})})}),!0):!1},M$=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),R$=()=>({tr:t,dispatch:e})=>{if(e){const n=new lr(t.doc);t.setSelection(n)}return!0},O$=()=>({state:t,dispatch:e})=>dN(t,e),I$=()=>({state:t,dispatch:e})=>pN(t,e),D$=()=>({state:t,dispatch:e})=>Gz(t,e),L$=()=>({state:t,dispatch:e})=>Zz(t,e),P$=()=>({state:t,dispatch:e})=>Yz(t,e);function Lm(t,e,n={},r={}){return ec(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var j$=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:s,tr:i,dispatch:o,commands:a})=>{const{doc:l}=i;if(r.preserveWhitespace!=="full"){const c=Lm(t,s.schema,r,{errorOnInvalidContent:e??s.options.enableContentCheck});return o&&i.replaceWith(0,l.content.size,c).setMeta("preventUpdate",!n),!0}return o&&i.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:l.content.size},t,{parseOptions:r,errorOnInvalidContent:e??s.options.enableContentCheck})};function a1(t,e){const n=Ds(e,t.schema),{from:r,to:s,empty:i}=t.selection,o=[];i?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,s,l=>{o.push(...l.marks)});const a=o.find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function l1(t,e){const n=new mb(t);return e.forEach(r=>{r.steps.forEach(s=>{n.step(s)})}),n}function z$(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 Pm(t,e){const n=[];return t.descendants((r,s)=>{e(r)&&n.push({node:r,pos:s})}),n}function F$(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(s,i)=>{n(s)&&r.push({node:s,pos:i})}),r}function c1(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 Xf(t){return e=>c1(e.$from,t)}function Ne(t,e,n){return t.config[e]===void 0&&t.parent?Ne(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?Ne(t.parent,e,n):null}):t.config[e]}function Lb(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=Ne(e,"addExtensions",n);return r?[e,...Lb(r())]:e}).flat(10)}function Pb(t,e){const n=Po.fromSchema(e).serializeFragment(t),s=document.implementation.createHTMLDocument().createElement("div");return s.appendChild(n),s.innerHTML}function u1(t){return typeof t=="function"}function at(t,e=void 0,...n){return u1(t)?e?t.bind(e)(...n):t(...n):t}function B$(t={}){return Object.keys(t).length===0&&t.constructor===Object}function tc(t){const e=t.filter(s=>s.type==="extension"),n=t.filter(s=>s.type==="node"),r=t.filter(s=>s.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function d1(t){const e=[],{nodeExtensions:n,markExtensions:r}=tc(t),s=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage,extensions:s},l=Ne(o,"addGlobalAttributes",a);if(!l)return;l().forEach(u=>{u.types.forEach(d=>{Object.entries(u.attributes).forEach(([h,p])=>{e.push({type:d,name:h,attribute:{...i,...p}})})})})}),s.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage},l=Ne(o,"addAttributes",a);if(!l)return;const c=l();Object.entries(c).forEach(([u,d])=>{const h={...i,...d};typeof(h==null?void 0:h.default)=="function"&&(h.default=h.default()),h!=null&&h.isRequired&&(h==null?void 0:h.default)===void 0&&delete h.default,e.push({type:o.name,name:u,attribute:h})})}),e}function Nt(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([s,i])=>{if(!r[s]){r[s]=i;return}if(s==="class"){const a=i?String(i).split(" "):[],l=r[s]?r[s].split(" "):[],c=a.filter(u=>!l.includes(u));r[s]=[...l,...c].join(" ")}else if(s==="style"){const a=i?i.split(";").map(u=>u.trim()).filter(Boolean):[],l=r[s]?r[s].split(";").map(u=>u.trim()).filter(Boolean):[],c=new Map;l.forEach(u=>{const[d,h]=u.split(":").map(p=>p.trim());c.set(d,h)}),a.forEach(u=>{const[d,h]=u.split(":").map(p=>p.trim());c.set(d,h)}),r[s]=Array.from(c.entries()).map(([u,d])=>`${u}: ${d}`).join("; ")}else r[s]=i}),r},{})}function nc(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)=>Nt(n,r),{})}function $$(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function Hv(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 s=e.reduce((i,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(n):$$(n.getAttribute(o.name));return a==null?i:{...i,[o.name]:a}},{});return{...r,...s}}}}function Uv(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&B$(n)?!1:n!=null))}function Vv(t){var e,n,r;const s={};return!((e=t==null?void 0:t.attribute)!=null&&e.isRequired)&&((n=t==null?void 0:t.attribute)==null?void 0:n.default)!==void 0&&(s.default=t.attribute.default),((r=t==null?void 0:t.attribute)==null?void 0:r.validate)!==void 0&&(s.validate=t.attribute.validate),[t.name,s]}function H$(t,e){var n;const r=d1(t),{nodeExtensions:s,markExtensions:i}=tc(t),o=(n=s.find(c=>Ne(c,"topNode")))==null?void 0:n.name,a=Object.fromEntries(s.map(c=>{const u=r.filter(x=>x.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},h=t.reduce((x,w)=>{const v=Ne(w,"extendNodeSchema",d);return{...x,...v?v(c):{}}},{}),p=Uv({...h,content:at(Ne(c,"content",d)),marks:at(Ne(c,"marks",d)),group:at(Ne(c,"group",d)),inline:at(Ne(c,"inline",d)),atom:at(Ne(c,"atom",d)),selectable:at(Ne(c,"selectable",d)),draggable:at(Ne(c,"draggable",d)),code:at(Ne(c,"code",d)),whitespace:at(Ne(c,"whitespace",d)),linebreakReplacement:at(Ne(c,"linebreakReplacement",d)),defining:at(Ne(c,"defining",d)),isolating:at(Ne(c,"isolating",d)),attrs:Object.fromEntries(u.map(Vv))}),m=at(Ne(c,"parseHTML",d));m&&(p.parseDOM=m.map(x=>Hv(x,u)));const g=Ne(c,"renderHTML",d);g&&(p.toDOM=x=>g({node:x,HTMLAttributes:nc(x,u)}));const b=Ne(c,"renderText",d);return b&&(p.toText=b),[c.name,p]})),l=Object.fromEntries(i.map(c=>{const u=r.filter(b=>b.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},h=t.reduce((b,x)=>{const w=Ne(x,"extendMarkSchema",d);return{...b,...w?w(c):{}}},{}),p=Uv({...h,inclusive:at(Ne(c,"inclusive",d)),excludes:at(Ne(c,"excludes",d)),group:at(Ne(c,"group",d)),spanning:at(Ne(c,"spanning",d)),code:at(Ne(c,"code",d)),attrs:Object.fromEntries(u.map(Vv))}),m=at(Ne(c,"parseHTML",d));m&&(p.parseDOM=m.map(b=>Hv(b,u)));const g=Ne(c,"renderHTML",d);return g&&(p.toDOM=b=>g({mark:b,HTMLAttributes:nc(b,u)})),[c.name,p]}));return new UC({topNode:o,nodes:a,marks:l})}function U$(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function jb(t){return t.sort((n,r)=>{const s=Ne(n,"priority")||100,i=Ne(r,"priority")||100;return s>i?-1:s<i?1:0})}function f1(t){const e=jb(Lb(t)),n=U$(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 h1(t,e,n){const{from:r,to:s}=e,{blockSeparator:i=`
324
-
325
- `,textSerializers:o={}}=n||{};let a="";return t.nodesBetween(r,s,(l,c,u,d)=>{var h;l.isBlock&&c>r&&(a+=i);const p=o==null?void 0:o[l.type.name];if(p)return u&&(a+=p({node:l,pos:c,parent:u,index:d,range:e})),!1;l.isText&&(a+=(h=l==null?void 0:l.text)==null?void 0:h.slice(Math.max(r,c)-c,s-c))}),a}function V$(t,e){const n={from:0,to:t.content.size};return h1(t,n,e)}function p1(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function W$(t,e){const n=Zt(e,t.schema),{from:r,to:s}=t.selection,i=[];t.doc.nodesBetween(r,s,a=>{i.push(a)});const o=i.reverse().find(a=>a.type.name===n.name);return o?{...o.attrs}:{}}function m1(t,e){const n=Zf(typeof e=="string"?e:e.name,t.schema);return n==="node"?W$(t,e):n==="mark"?a1(t,e):{}}function q$(t,e=JSON.stringify){const n={};return t.filter(r=>{const s=e(r);return Object.prototype.hasOwnProperty.call(n,s)?!1:n[s]=!0})}function K$(t){const e=q$(t);return e.length===1?e:e.filter((n,r)=>!e.filter((i,o)=>o!==r).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function g1(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((s,i)=>{const o=[];if(s.ranges.length)s.forEach((a,l)=>{o.push({from:a,to:l})});else{const{from:a,to:l}=n[i];if(a===void 0||l===void 0)return;o.push({from:a,to:l})}o.forEach(({from:a,to:l})=>{const c=e.slice(i).map(a,-1),u=e.slice(i).map(l),d=e.invert().map(c,-1),h=e.invert().map(u);r.push({oldRange:{from:d,to:h},newRange:{from:c,to:u}})})}),K$(r)}function zb(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(s=>{const i=n.resolve(t),o=Db(i,s.type);o&&r.push({mark:s,...o})}):n.nodesBetween(t,e,(s,i)=>{!s||(s==null?void 0:s.nodeSize)===void 0||r.push(...s.marks.map(o=>({from:i,to:i+s.nodeSize,mark:o})))}),r}var G$=(t,e,n,r=20)=>{const s=t.doc.resolve(n);let i=r,o=null;for(;i>0&&o===null;){const a=s.node(i);(a==null?void 0:a.type.name)===e?o=a:i-=1}return[o,i]};function Jh(t,e){return e.nodes[t]||e.marks[t]||null}function $u(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const s=t.find(i=>i.type===e&&i.name===r);return s?s.attribute.keepOnSplit:!1}))}var J$=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(s,i,o,a)=>{var l,c;const u=((c=(l=s.type.spec).toText)==null?void 0:c.call(l,{node:s,pos:i,parent:o,index:a}))||s.textContent||"%leaf%";n+=s.isAtom&&!s.isText?u:u.slice(0,Math.max(0,r-i))}),n};function jm(t,e,n={}){const{empty:r,ranges:s}=t.selection,i=e?Ds(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>i?i.name===d.type.name:!0).find(d=>yd(d.attrs,n,{strict:!1}));let o=0;const a=[];if(s.forEach(({$from:d,$to:h})=>{const p=d.pos,m=h.pos;t.doc.nodesBetween(p,m,(g,b)=>{if(!g.isText&&!g.marks.length)return;const x=Math.max(p,b),w=Math.min(m,b+g.nodeSize),v=w-x;o+=v,a.push(...g.marks.map(k=>({mark:k,from:x,to:w})))})}),o===0)return!1;const l=a.filter(d=>i?i.name===d.mark.type.name:!0).filter(d=>yd(d.mark.attrs,n,{strict:!1})).reduce((d,h)=>d+h.to-h.from,0),c=a.filter(d=>i?d.mark.type!==i&&d.mark.type.excludes(i):!0).reduce((d,h)=>d+h.to-h.from,0);return(l>0?l+c:l)>=o}function Y$(t,e,n={}){if(!e)return Si(t,null,n)||jm(t,null,n);const r=Zf(e,t.schema);return r==="node"?Si(t,e,n):r==="mark"?jm(t,e,n):!1}var Z$=(t,e)=>{const{$from:n,$to:r,$anchor:s}=t.selection;if(e){const i=Xf(a=>a.type.name===e)(t.selection);if(!i)return!1;const o=t.doc.resolve(i.pos+1);return s.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},X$=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function Wv(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function qv(t,e){const{nodeExtensions:n}=tc(e),r=n.find(o=>o.name===t);if(!r)return!1;const s={name:r.name,options:r.options,storage:r.storage},i=at(Ne(r,"group",s));return typeof i!="string"?!1:i.split(" ").includes("list")}function Qf(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let s=!0;return t.content.forEach(i=>{s!==!1&&(Qf(i,{ignoreWhitespace:n,checkChildren:e})||(s=!1))}),s}return!1}function b1(t){return t instanceof Ee}function Q$(t,e,n){var r;const{selection:s}=e;let i=null;if(n1(s)&&(i=s.$cursor),i){const a=(r=t.storedMarks)!=null?r:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(a)||!a.some(c=>c.type.excludes(n)))}const{ranges:o}=s;return o.some(({$from:a,$to:l})=>{let c=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,l.pos,(u,d,h)=>{if(c)return!1;if(u.isInline){const p=!h||h.type.allowsMarkType(n),m=!!n.isInSet(u.marks)||!u.marks.some(g=>g.type.excludes(n));c=p&&m}return!c}),c})}var e4=(t,e={})=>({tr:n,state:r,dispatch:s})=>{const{selection:i}=n,{empty:o,ranges:a}=i,l=Ds(t,r.schema);if(s)if(o){const c=a1(r,l);n.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(h,p)=>{const m=Math.max(p,u),g=Math.min(p+h.nodeSize,d);h.marks.find(x=>x.type===l)?h.marks.forEach(x=>{l===x.type&&n.addMark(m,g,l.create({...x.attrs,...e}))}):n.addMark(m,g,l.create(e))})});return Q$(r,n,l)},t4=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),n4=(t,e={})=>({state:n,dispatch:r,chain:s})=>{const i=Zt(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),i.isTextblock?s().command(({commands:a})=>ov(i,{...o,...e})(n)?!0:a.clearNodes()).command(({state:a})=>ov(i,{...o,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},r4=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,s=Ki(t,0,r.content.size),i=Ee.create(r,s);e.setSelection(i)}return!0},s4=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:s,to:i}=typeof t=="number"?{from:t,to:t}:t,o=Me.atStart(r).from,a=Me.atEnd(r).to,l=Ki(s,o,a),c=Ki(i,o,a),u=Me.create(r,l,c);e.setSelection(u)}return!0},i4=t=>({state:e,dispatch:n})=>{const r=Zt(t,e.schema);return iF(r)(e,n)};function Kv(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(s=>e==null?void 0:e.includes(s.type.name));t.tr.ensureMarks(r)}}var o4=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:s})=>{const{selection:i,doc:o}=e,{$from:a,$to:l}=i,c=s.extensionManager.attributes,u=$u(c,a.node().type.name,a.node().attrs);if(i instanceof Ee&&i.node.isBlock)return!a.parentOffset||!Es(o,a.pos)?!1:(r&&(t&&Kv(n,s.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:z$(a.node(-1).contentMatchAt(a.indexAfter(-1)));let p=d&&h?[{type:h,attrs:u}]:void 0,m=Es(e.doc,e.mapping.map(a.pos),1,p);if(!p&&!m&&Es(e.doc,e.mapping.map(a.pos),1,h?[{type:h}]:void 0)&&(m=!0,p=h?[{type:h,attrs:u}]:void 0),r){if(m&&(i instanceof Me&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,p),h&&!d&&!a.parentOffset&&a.parent.type!==h)){const g=e.mapping.map(a.before()),b=e.doc.resolve(g);a.node(-1).canReplaceWith(b.index(),b.index()+1,h)&&e.setNodeMarkup(e.mapping.map(a.before()),h)}t&&Kv(n,s.extensionManager.splittableMarks),e.scrollIntoView()}return m},a4=(t,e={})=>({tr:n,state:r,dispatch:s,editor:i})=>{var o;const a=Zt(t,r.schema),{$from:l,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||l.depth<2||!l.sameParent(c))return!1;const d=l.node(-1);if(d.type!==a)return!1;const h=i.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(s){let x=G.empty;const w=l.index(-1)?1:l.index(-2)?2:3;for(let T=l.depth-w;T>=l.depth-3;T-=1)x=G.from(l.node(T).copy(x));const v=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,k={...$u(h,l.node().type.name,l.node().attrs),...e},N=((o=a.contentMatch.defaultType)==null?void 0:o.createAndFill(k))||void 0;x=x.append(G.from(a.createAndFill(null,N)||void 0));const S=l.before(l.depth-(w-1));n.replace(S,l.after(-v),new ae(x,4-w,0));let C=-1;n.doc.nodesBetween(S,n.doc.content.size,(T,R)=>{if(C>-1)return!1;T.isTextblock&&T.content.size===0&&(C=R+1)}),C>-1&&n.setSelection(Me.near(n.doc.resolve(C))),n.scrollIntoView()}return!0}const p=c.pos===l.end()?d.contentMatchAt(0).defaultType:null,m={...$u(h,d.type.name,d.attrs),...e},g={...$u(h,l.node().type.name,l.node().attrs),...e};n.delete(l.pos,c.pos);const b=p?[{type:a,attrs:m},{type:p,attrs:g}]:[{type:a,attrs:m}];if(!Es(n.doc,l.pos,2))return!1;if(s){const{selection:x,storedMarks:w}=r,{splittableMarks:v}=i.extensionManager,k=w||x.$to.parentOffset&&x.$from.marks();if(n.split(l.pos,2,b).scrollIntoView(),!k||!s)return!0;const N=k.filter(S=>v.includes(S.type.name));n.ensureMarks(N)}return!0},Yh=(t,e)=>{const n=Xf(o=>o.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 s=t.doc.nodeAt(r);return n.node.type===(s==null?void 0:s.type)&&Oi(t.doc,n.pos)&&t.join(n.pos),!0},Zh=(t,e)=>{const n=Xf(o=>o.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 s=t.doc.nodeAt(r);return n.node.type===(s==null?void 0:s.type)&&Oi(t.doc,r)&&t.join(r),!0},l4=(t,e,n,r={})=>({editor:s,tr:i,state:o,dispatch:a,chain:l,commands:c,can:u})=>{const{extensions:d,splittableMarks:h}=s.extensionManager,p=Zt(t,o.schema),m=Zt(e,o.schema),{selection:g,storedMarks:b}=o,{$from:x,$to:w}=g,v=x.blockRange(w),k=b||g.$to.parentOffset&&g.$from.marks();if(!v)return!1;const N=Xf(S=>qv(S.type.name,d))(g);if(v.depth>=1&&N&&v.depth-N.depth<=1){if(N.node.type===p)return c.liftListItem(m);if(qv(N.node.type.name,d)&&p.validContent(N.node.content)&&a)return l().command(()=>(i.setNodeMarkup(N.pos,p),!0)).command(()=>Yh(i,p)).command(()=>Zh(i,p)).run()}return!n||!k||!a?l().command(()=>u().wrapInList(p,r)?!0:c.clearNodes()).wrapInList(p,r).command(()=>Yh(i,p)).command(()=>Zh(i,p)).run():l().command(()=>{const S=u().wrapInList(p,r),C=k.filter(T=>h.includes(T.type.name));return i.ensureMarks(C),S?!0:c.clearNodes()}).wrapInList(p,r).command(()=>Yh(i,p)).command(()=>Zh(i,p)).run()},c4=(t,e={},n={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:i=!1}=n,o=Ds(t,r.schema);return jm(r,o,e)?s.unsetMark(o,{extendEmptyMarkRange:i}):s.setMark(o,e)},u4=(t,e,n={})=>({state:r,commands:s})=>{const i=Zt(t,r.schema),o=Zt(e,r.schema),a=Si(r,i,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?s.setNode(o,l):s.setNode(i,{...l,...n})},d4=(t,e={})=>({state:n,commands:r})=>{const s=Zt(t,n.schema);return Si(n,s,e)?r.lift(s):r.wrapIn(s,e)},f4=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const s=n[r];let i;if(s.spec.isInputRules&&(i=s.getState(t))){if(e){const o=t.tr,a=i.transform;for(let l=a.steps.length-1;l>=0;l-=1)o.step(a.steps[l].invert(a.docs[l]));if(i.text){const l=o.doc.resolve(i.from).marks();o.replaceWith(i.from,i.to,t.schema.text(i.text,l))}else o.delete(i.from,i.to)}return!0}}return!1},h4=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:s}=n;return r||e&&s.forEach(i=>{t.removeMark(i.$from.pos,i.$to.pos)}),!0},p4=(t,e={})=>({tr:n,state:r,dispatch:s})=>{var i;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=n,l=Ds(t,r.schema),{$from:c,empty:u,ranges:d}=a;if(!s)return!0;if(u&&o){let{from:h,to:p}=a;const m=(i=c.marks().find(b=>b.type===l))==null?void 0:i.attrs,g=Db(c,l,m);g&&(h=g.from,p=g.to),n.removeMark(h,p,l)}else d.forEach(h=>{n.removeMark(h.$from.pos,h.$to.pos,l)});return n.removeStoredMark(l),!0},m4=(t,e={})=>({tr:n,state:r,dispatch:s})=>{let i=null,o=null;const a=Zf(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(i=Zt(t,r.schema)),a==="mark"&&(o=Ds(t,r.schema)),s&&n.selection.ranges.forEach(l=>{const c=l.$from.pos,u=l.$to.pos;let d,h,p,m;n.selection.empty?r.doc.nodesBetween(c,u,(g,b)=>{i&&i===g.type&&(p=Math.max(b,c),m=Math.min(b+g.nodeSize,u),d=b,h=g)}):r.doc.nodesBetween(c,u,(g,b)=>{b<c&&i&&i===g.type&&(p=Math.max(b,c),m=Math.min(b+g.nodeSize,u),d=b,h=g),b>=c&&b<=u&&(i&&i===g.type&&n.setNodeMarkup(b,void 0,{...g.attrs,...e}),o&&g.marks.length&&g.marks.forEach(x=>{if(o===x.type){const w=Math.max(b,c),v=Math.min(b+g.nodeSize,u);n.addMark(w,v,o.create({...x.attrs,...e}))}}))}),h&&(d!==void 0&&n.setNodeMarkup(d,void 0,{...h.attrs,...e}),o&&h.marks.length&&h.marks.forEach(g=>{o===g.type&&n.addMark(p,m,o.create({...g.attrs,...e}))}))}),!0):!1},g4=(t,e={})=>({state:n,dispatch:r})=>{const s=Zt(t,n.schema);return Xz(s,e)(n,r)},b4=(t,e={})=>({state:n,dispatch:r})=>{const s=Zt(t,n.schema);return Qz(s,e)(n,r)},y4=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={}}},eh=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},x4=(t,e)=>{if(Ib(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 uu(t){var e;const{editor:n,from:r,to:s,text:i,rules:o,plugin:a}=t,{view:l}=n;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||(e=c.nodeBefore||c.nodeAfter)!=null&&e.marks.find(h=>h.type.spec.code))return!1;let u=!1;const d=J$(c)+i;return o.forEach(h=>{if(u)return;const p=x4(d,h.find);if(!p)return;const m=l.state.tr,g=Gf({state:l.state,transaction:m}),b={from:r-(p[0].length-i.length),to:s},{commands:x,chain:w,can:v}=new Jf({editor:n,state:g});h.handler({state:g,range:b,match:p,commands:x,chain:w,can:v})===null||!m.steps.length||(h.undoable&&m.setMeta(a,{transform:m,from:r,to:s,text:i}),l.dispatch(m),u=!0)}),u}function v4(t){const{editor:e,rules:n}=t,r=new Rt({state:{init(){return null},apply(s,i,o){const a=s.getMeta(r);if(a)return a;const l=s.getMeta("applyInputRules");return!!l&&setTimeout(()=>{let{text:u}=l;typeof u=="string"?u=u:u=Pb(G.from(u),o.schema);const{from:d}=l,h=d+u.length;uu({editor:e,from:d,to:h,text:u,rules:n,plugin:r})}),s.selectionSet||s.docChanged?null:i}},props:{handleTextInput(s,i,o,a){return uu({editor:e,from:i,to:o,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:i}=s.state.selection;i&&uu({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(s,i){if(i.key!=="Enter")return!1;const{$cursor:o}=s.state.selection;return o?uu({editor:e,from:o.pos,to:o.pos,text:`
326
- `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function w4(t){return Object.prototype.toString.call(t).slice(8,-1)}function du(t){return w4(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function y1(t,e){const n={...t};return du(t)&&du(e)&&Object.keys(e).forEach(r=>{du(e[r])&&du(t[r])?n[r]=y1(t[r],e[r]):n[r]=e[r]}),n}var Fb=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{...at(Ne(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...at(Ne(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>y1(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},Di=class x1 extends Fb{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new x1(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,s=e.state.selection.$from;if(s.pos===s.end()){const o=s.marks();if(!!!o.find(c=>(c==null?void 0:c.type.name)===n.name))return!1;const l=o.find(c=>(c==null?void 0:c.type.name)===n.name);return l&&r.removeStoredMark(l),r.insertText(" ",s.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 k4(t){return typeof t=="number"}var S4=class{constructor(t){this.find=t.find,this.handler=t.handler}},E4=(t,e,n)=>{if(Ib(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(s=>{const i=[s.text];return i.index=s.index,i.input=t,i.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(s.replaceWith)),i}):[]};function C4(t){const{editor:e,state:n,from:r,to:s,rule:i,pasteEvent:o,dropEvent:a}=t,{commands:l,chain:c,can:u}=new Jf({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,s,(p,m)=>{var g,b,x,w,v;if((b=(g=p.type)==null?void 0:g.spec)!=null&&b.code||!(p.isText||p.isTextblock||p.isInline))return;const k=(v=(w=(x=p.content)==null?void 0:x.size)!=null?w:p.nodeSize)!=null?v:0,N=Math.max(r,m),S=Math.min(s,m+k);if(N>=S)return;const C=p.isText?p.text||"":p.textBetween(N-m,S-m,void 0,"");E4(C,i.find,o).forEach(R=>{if(R.index===void 0)return;const _=N+R.index+1,I=_+R[0].length,D={from:n.tr.mapping.map(_),to:n.tr.mapping.map(I)},V=i.handler({state:n,range:D,match:R,commands:l,chain:c,can:u,pasteEvent:o,dropEvent:a});d.push(V)})}),d.every(p=>p!==null)}var fu=null,N4=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function _4(t){const{editor:e,rules:n}=t;let r=null,s=!1,i=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:u,from:d,to:h,rule:p,pasteEvt:m})=>{const g=u.tr,b=Gf({state:u,transaction:g});if(!(!C4({editor:e,state:b,from:Math.max(d-1,0),to:h.b-1,rule:p,pasteEvent:m,dropEvent:a})||!g.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return n.map(u=>new Rt({view(d){const h=m=>{var g;r=(g=d.dom.parentElement)!=null&&g.contains(m.target)?d.dom.parentElement:null,r&&(fu=e)},p=()=>{fu&&(fu=null)};return window.addEventListener("dragstart",h),window.addEventListener("dragend",p),{destroy(){window.removeEventListener("dragstart",h),window.removeEventListener("dragend",p)}}},props:{handleDOMEvents:{drop:(d,h)=>{if(i=r===d.dom.parentElement,a=h,!i){const p=fu;p!=null&&p.isEditable&&setTimeout(()=>{const m=p.state.selection;m&&p.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(d,h)=>{var p;const m=(p=h.clipboardData)==null?void 0:p.getData("text/html");return o=h,s=!!(m!=null&&m.includes("data-pm-slice")),!1}}},appendTransaction:(d,h,p)=>{const m=d[0],g=m.getMeta("uiEvent")==="paste"&&!s,b=m.getMeta("uiEvent")==="drop"&&!i,x=m.getMeta("applyPasteRules"),w=!!x;if(!g&&!b&&!w)return;if(w){let{text:N}=x;typeof N=="string"?N=N:N=Pb(G.from(N),p.schema);const{from:S}=x,C=S+N.length,T=N4(N);return l({rule:u,state:p,from:S,to:{b:C},pasteEvt:T})}const v=h.doc.content.findDiffStart(p.doc.content),k=h.doc.content.findDiffEnd(p.doc.content);if(!(!k4(v)||!k||v===k.b))return l({rule:u,state:p,from:v,to:k,pasteEvt:o})}}))}var th=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=f1(t),this.schema=H$(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:Jh(e.name,this.schema)},r=Ne(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return jb([...this.extensions].reverse()).flatMap(r=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Jh(r.name,this.schema)},i=[],o=Ne(r,"addKeyboardShortcuts",s);let a={};if(r.type==="mark"&&Ne(r,"exitable",s)&&(a.ArrowRight=()=>Di.handleExit({editor:t,mark:r})),o){const h=Object.fromEntries(Object.entries(o()).map(([p,m])=>[p,()=>m({editor:t})]));a={...a,...h}}const l=KB(a);i.push(l);const c=Ne(r,"addInputRules",s);if(Wv(r,t.options.enableInputRules)&&c){const h=c();if(h&&h.length){const p=v4({editor:t,rules:h}),m=Array.isArray(p)?p:[p];i.push(...m)}}const u=Ne(r,"addPasteRules",s);if(Wv(r,t.options.enablePasteRules)&&u){const h=u();if(h&&h.length){const p=_4({editor:t,rules:h});i.push(...p)}}const d=Ne(r,"addProseMirrorPlugins",s);if(d){const h=d();i.push(...h)}return i})}get attributes(){return d1(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=tc(this.extensions);return Object.fromEntries(e.filter(n=>!!Ne(n,"addNodeView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Zt(n.name,this.schema)},i=Ne(n,"addNodeView",s);if(!i)return[];const o=i();if(!o)return[];const a=(l,c,u,d,h)=>{const p=nc(l,r);return o({node:l,view:c,getPos:u,decorations:d,innerDecorations:h,editor:t,extension:n,HTMLAttributes:p})};return[n.name,a]}))}get markViews(){const{editor:t}=this,{markExtensions:e}=tc(this.extensions);return Object.fromEntries(e.filter(n=>!!Ne(n,"addMarkView")).map(n=>{const r=this.attributes.filter(a=>a.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Ds(n.name,this.schema)},i=Ne(n,"addMarkView",s);if(!i)return[];const o=(a,l,c)=>{const u=nc(a,r);return i()({mark:a,view:l,inline:c,editor:t,extension:n,HTMLAttributes:u,updateAttributes:d=>{H4(a,t,d)}})};return[n.name,o]}))}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:Jh(e.name,this.schema)};e.type==="mark"&&((n=at(Ne(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const s=Ne(e,"onBeforeCreate",r),i=Ne(e,"onCreate",r),o=Ne(e,"onUpdate",r),a=Ne(e,"onSelectionUpdate",r),l=Ne(e,"onTransaction",r),c=Ne(e,"onFocus",r),u=Ne(e,"onBlur",r),d=Ne(e,"onDestroy",r);s&&this.editor.on("beforeCreate",s),i&&this.editor.on("create",i),o&&this.editor.on("update",o),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),c&&this.editor.on("focus",c),u&&this.editor.on("blur",u),d&&this.editor.on("destroy",d)})}};th.resolve=f1;th.sort=jb;th.flatten=Lb;var T4={};Ob(T4,{ClipboardTextSerializer:()=>w1,Commands:()=>k1,Delete:()=>S1,Drop:()=>E1,Editable:()=>C1,FocusEvents:()=>_1,Keymap:()=>T1,Paste:()=>A1,Tabindex:()=>M1,focusEventsPluginKey:()=>N1});var Dt=class v1 extends Fb{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new v1(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},w1=Dt.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Rt({key:new Ut("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:s}=e,{ranges:i}=s,o=Math.min(...i.map(u=>u.$from.pos)),a=Math.max(...i.map(u=>u.$to.pos)),l=p1(n);return h1(r,{from:o,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),k1=Dt.create({name:"commands",addCommands(){return{...e1}}}),S1=Dt.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,s;const i=()=>{var o,a,l,c;if((c=(l=(a=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:a.filterTransaction)==null?void 0:l.call(a,t))!=null?c:t.getMeta("y-sync$"))return;const u=l1(t.before,[t,...e]);g1(u).forEach(p=>{u.mapping.mapResult(p.oldRange.from).deletedAfter&&u.mapping.mapResult(p.oldRange.to).deletedBefore&&u.before.nodesBetween(p.oldRange.from,p.oldRange.to,(m,g)=>{const b=g+m.nodeSize-2,x=p.oldRange.from<=g&&b<=p.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:g,to:b,newFrom:u.mapping.map(g),newTo:u.mapping.map(b),deletedRange:p.oldRange,newRange:p.newRange,partial:!x,editor:this.editor,transaction:t,combinedTransform:u})})});const h=u.mapping;u.steps.forEach((p,m)=>{var g,b;if(p instanceof Lr){const x=h.slice(m).map(p.from,-1),w=h.slice(m).map(p.to),v=h.invert().map(x,-1),k=h.invert().map(w),N=(g=u.doc.nodeAt(x-1))==null?void 0:g.marks.some(C=>C.eq(p.mark)),S=(b=u.doc.nodeAt(w))==null?void 0:b.marks.some(C=>C.eq(p.mark));this.editor.emit("delete",{type:"mark",mark:p.mark,from:p.from,to:p.to,deletedRange:{from:v,to:k},newRange:{from:x,to:w},partial:!!(S||N),editor:this.editor,transaction:t,combinedTransform:u})}})};(s=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||s?setTimeout(i,0):i()}}),E1=Dt.create({name:"drop",addProseMirrorPlugins(){return[new Rt({key:new Ut("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),C1=Dt.create({name:"editable",addProseMirrorPlugins(){return[new Rt({key:new Ut("editable"),props:{editable:()=>this.editor.options.editable}})]}}),N1=new Ut("focusEvents"),_1=Dt.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Rt({key:N1,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}}}})]}}),T1=Dt.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:u,$anchor:d}=l,{pos:h,parent:p}=d,m=d.parent.isTextblock&&h>0?a.doc.resolve(h-1):d,g=m.parent.type.spec.isolating,b=d.pos-d.parentOffset,x=g&&m.parent.childCount===1?b===d.pos:Pe.atStart(c).from===h;return!u||!p.type.isTextblock||p.textContent.length||!x||x&&d.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},s={...r},i={...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 Yf()||o1()?i:s},addProseMirrorPlugins(){return[new Rt({key:new Ut("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),s=t.some(g=>g.getMeta("preventClearDocument"));if(!r||s)return;const{empty:i,from:o,to:a}=e.selection,l=Pe.atStart(e.doc).from,c=Pe.atEnd(e.doc).to;if(i||!(o===l&&a===c)||!Qf(n.doc))return;const h=n.tr,p=Gf({state:n,transaction:h}),{commands:m}=new Jf({editor:this.editor,state:p});if(m.clearNodes(),!!h.steps.length)return h}})]}}),A1=Dt.create({name:"paste",addProseMirrorPlugins(){return[new Rt({key:new Ut("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),M1=Dt.create({name:"tabindex",addProseMirrorPlugins(){return[new Rt({key:new Ut("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),A4=class Ko{constructor(e,n,r=!1,s=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=s}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 Ko(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 Ko(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 Ko(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const s=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,o=this.pos+r+(i?0:1);if(o<0||o>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(o);if(!s&&a.depth<=this.depth)return;const l=new Ko(a,this.editor,s,s?n:null);s&&(l.actualDepth=this.depth+1),e.push(new Ko(a,this.editor,s,s?n:null))}),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,s=this.parent;for(;s&&!r;){if(s.node.type.name===e)if(Object.keys(n).length>0){const i=s.node.attrs,o=Object.keys(n);for(let a=0;a<o.length;a+=1){const l=o[a];if(i[l]!==n[l])break}}else r=s;s=s.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let s=[];if(!this.children||this.children.length===0)return s;const i=Object.keys(n);return this.children.forEach(o=>{r&&s.length>0||(o.node.type.name===e&&i.every(l=>n[l]===o.node.attrs[l])&&s.push(o),!(r&&s.length>0)&&(s=s.concat(o.querySelectorAll(e,n,r))))}),s}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},M4=`.ProseMirror {
327
- position: relative;
328
- }
329
-
330
- .ProseMirror {
331
- word-wrap: break-word;
332
- white-space: pre-wrap;
333
- white-space: break-spaces;
334
- -webkit-font-variant-ligatures: none;
335
- font-variant-ligatures: none;
336
- font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
337
- }
338
-
339
- .ProseMirror [contenteditable="false"] {
340
- white-space: normal;
341
- }
342
-
343
- .ProseMirror [contenteditable="false"] [contenteditable="true"] {
344
- white-space: pre-wrap;
345
- }
346
-
347
- .ProseMirror pre {
348
- white-space: pre-wrap;
349
- }
350
-
351
- img.ProseMirror-separator {
352
- display: inline !important;
353
- border: none !important;
354
- margin: 0 !important;
355
- width: 0 !important;
356
- height: 0 !important;
357
- }
358
-
359
- .ProseMirror-gapcursor {
360
- display: none;
361
- pointer-events: none;
362
- position: absolute;
363
- margin: 0;
364
- }
365
-
366
- .ProseMirror-gapcursor:after {
367
- content: "";
368
- display: block;
369
- position: absolute;
370
- top: -2px;
371
- width: 20px;
372
- border-top: 1px solid black;
373
- animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
374
- }
375
-
376
- @keyframes ProseMirror-cursor-blink {
377
- to {
378
- visibility: hidden;
379
- }
380
- }
381
-
382
- .ProseMirror-hideselection *::selection {
383
- background: transparent;
384
- }
385
-
386
- .ProseMirror-hideselection *::-moz-selection {
387
- background: transparent;
388
- }
389
-
390
- .ProseMirror-hideselection * {
391
- caret-color: transparent;
392
- }
393
-
394
- .ProseMirror-focused .ProseMirror-gapcursor {
395
- display: block;
396
- }`;function R4(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const s=document.createElement("style");return e&&s.setAttribute("nonce",e),s.setAttribute("data-tiptap-style",""),s.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(s),s}var O4=class extends y4{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!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},this.isCapturingTransaction=!1,this.capturedTransaction=null,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:s,moved:i})=>this.options.onDrop(r,s,i)),this.on("paste",({event:r,slice:s})=>this.options.onPaste(r,s)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=r1(e,this.options.autofocus);this.editorState=ta.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!=null&&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=R4(M4,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=u1(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(s=>{const i=typeof s=="string"?`${s}$`:s.key;n=n.filter(o=>!o.key.startsWith(i))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;const r=[...this.options.enableCoreExtensions?[C1,w1.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),k1,_1,T1,M1,E1,A1,S1].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s==null?void 0:s.type));this.extensionManager=new th(r,this)}createCommandManager(){this.commandManager=new Jf({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Lm(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=Lm(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){var e;this.editorView=new QN(t,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)==null?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const n=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(n),this.prependClass(),this.injectCSS();const r=this.view.dom;r.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(c=>{var u;return(u=this.capturedTransaction)==null?void 0:u.step(c)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),s=n.includes(t),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!s)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 o=n.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),a=o==null?void 0:o.getMeta("focus"),l=o==null?void 0:o.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:o}),l&&this.emit("blur",{editor:this,event:l.event,transaction:o}),!(t.getMeta("preventUpdate")||!n.some(c=>c.docChanged)||i.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return m1(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return Y$(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Pb(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
397
-
398
- `,textSerializers:n={}}=t||{};return V$(this.state.doc,{blockSeparator:e,textSerializers:{...p1(this.schema),...n}})}get isEmpty(){return Qf(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}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);return new A4(e,this)}get $doc(){return this.$pos(0)}};function Da(t){return new eh({find:t.find,handler:({state:e,range:n,match:r})=>{const s=at(t.getAttributes,void 0,r);if(s===!1||s===null)return null;const{tr:i}=e,o=r[r.length-1],a=r[0];if(o){const l=a.search(/\S/),c=n.from+a.indexOf(o),u=c+o.length;if(zb(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===t.type&&g!==p.mark.type)).filter(p=>p.to>c).length)return null;u<n.to&&i.delete(u,n.to),c>n.from&&i.delete(n.from+l,c);const h=n.from+l+o.length;i.addMark(n.from+l,h,t.type.create(s||{})),i.removeStoredMark(t.type)}},undoable:t.undoable})}function R1(t){return new eh({find:t.find,handler:({state:e,range:n,match:r})=>{const s=at(t.getAttributes,void 0,r)||{},{tr:i}=e,o=n.from;let a=n.to;const l=t.type.create(s);if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=o+c;u>a?u=a:a=u+r[1].length;const d=r[0][r[0].length-1];i.insertText(d,o+r[0].length-1),i.replaceWith(u,a,l)}else if(r[0]){const c=t.type.isInline?o:o-1;i.insert(c,t.type.create(s)).delete(i.mapping.map(o),i.mapping.map(a))}i.scrollIntoView()},undoable:t.undoable})}function zm(t){return new eh({find:t.find,handler:({state:e,range:n,match:r})=>{const s=e.doc.resolve(n.from),i=at(t.getAttributes,void 0,r)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,i)},undoable:t.undoable})}function La(t){return new eh({find:t.find,handler:({state:e,range:n,match:r,chain:s})=>{const i=at(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),l=o.doc.resolve(n.from).blockRange(),c=l&&pb(l,t.type,i);if(!c)return null;if(o.wrap(l,c),t.keepMarks&&t.editor){const{selection:d,storedMarks:h}=e,{splittableMarks:p}=t.editor.extensionManager,m=h||d.$to.parentOffset&&d.$from.marks();if(m){const g=m.filter(b=>p.includes(b.type.name));o.ensureMarks(g)}}if(t.keepAttributes){const d=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";s().updateAttributes(d,i).run()}const u=o.doc.resolve(n.from-1).nodeBefore;u&&u.type===t.type&&Oi(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,u))&&o.join(n.from-1)},undoable:t.undoable})}var I4=t=>"touches"in t,D4=class{constructor(t){this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.handleMouseMove=o=>{if(!this.isResizing||!this.activeHandle)return;const a=o.clientX-this.startX,l=o.clientY-this.startY;this.handleResize(a,l)},this.handleTouchMove=o=>{if(!this.isResizing||!this.activeHandle)return;const a=o.touches[0];if(!a)return;const l=a.clientX-this.startX,c=a.clientY-this.startY;this.handleResize(l,c)},this.handleMouseUp=()=>{if(!this.isResizing)return;const o=this.element.offsetWidth,a=this.element.offsetHeight;this.onCommit(o,a),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=o=>{o.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=o=>{o.key==="Shift"&&(this.isShiftKeyPressed=!1)};var e,n,r,s,i;this.node=t.node,this.element=t.element,this.contentElement=t.contentElement,this.getPos=t.getPos,this.onResize=t.onResize,this.onCommit=t.onCommit,this.onUpdate=t.onUpdate,(e=t.options)!=null&&e.min&&(this.minSize={...this.minSize,...t.options.min}),(n=t.options)!=null&&n.max&&(this.maxSize=t.options.max),(r=t==null?void 0:t.options)!=null&&r.directions&&(this.directions=t.options.directions),(s=t.options)!=null&&s.preserveAspectRatio&&(this.preserveAspectRatio=t.options.preserveAspectRatio),(i=t.options)!=null&&i.className&&(this.classNames={container:t.options.className.container||"",wrapper:t.options.className.wrapper||"",handle:t.options.className.handle||"",resizing:t.options.className.resizing||""}),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles()}get dom(){return this.container}get contentDOM(){return this.contentElement}update(t,e,n){return t.type!==this.node.type?!1:(this.node=t,this.onUpdate?this.onUpdate(t,e,n):!0)}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.container.remove()}createContainer(){const t=document.createElement("div");return t.dataset.resizeContainer="",t.dataset.node=this.node.type.name,t.style.display="flex",t.style.justifyContent="flex-start",t.style.alignItems="flex-start",this.classNames.container&&(t.className=this.classNames.container),t.appendChild(this.wrapper),t}createWrapper(){const t=document.createElement("div");return t.style.position="relative",t.style.display="block",t.dataset.resizeWrapper="",this.classNames.wrapper&&(t.className=this.classNames.wrapper),t.appendChild(this.element),t}createHandle(t){const e=document.createElement("div");return e.dataset.resizeHandle=t,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(t,e){const n=e.includes("top"),r=e.includes("bottom"),s=e.includes("left"),i=e.includes("right");n&&(t.style.top="0"),r&&(t.style.bottom="0"),s&&(t.style.left="0"),i&&(t.style.right="0"),(e==="top"||e==="bottom")&&(t.style.left="0",t.style.right="0"),(e==="left"||e==="right")&&(t.style.top="0",t.style.bottom="0")}attachHandles(){this.directions.forEach(t=>{const e=this.createHandle(t);this.positionHandle(e,t),e.addEventListener("mousedown",n=>this.handleResizeStart(n,t)),e.addEventListener("touchstart",n=>this.handleResizeStart(n,t)),this.wrapper.appendChild(e)})}applyInitialSize(){const t=this.node.attrs.width,e=this.node.attrs.height;t?(this.element.style.width=`${t}px`,this.initialWidth=t):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(t,e){t.preventDefault(),t.stopPropagation(),this.isResizing=!0,this.activeHandle=e,I4(t)?(this.startX=t.touches[0].clientX,this.startY=t.touches[0].clientY):(this.startX=t.clientX,this.startY=t.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(t,e){if(!this.activeHandle)return;const n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:s}=this.calculateNewDimensions(this.activeHandle,t,e),i=this.applyConstraints(r,s,n);this.element.style.width=`${i.width}px`,this.element.style.height=`${i.height}px`,this.onResize&&this.onResize(i.width,i.height)}calculateNewDimensions(t,e,n){let r=this.startWidth,s=this.startHeight;const i=t.includes("right"),o=t.includes("left"),a=t.includes("bottom"),l=t.includes("top");return i?r=this.startWidth+e:o&&(r=this.startWidth-e),a?s=this.startHeight+n:l&&(s=this.startHeight-n),(t==="right"||t==="left")&&(r=this.startWidth+(i?e:-e)),(t==="top"||t==="bottom")&&(s=this.startHeight+(a?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,s,t):{width:r,height:s}}applyConstraints(t,e,n){var r,s,i,o;if(!n){let c=Math.max(this.minSize.width,t),u=Math.max(this.minSize.height,e);return(r=this.maxSize)!=null&&r.width&&(c=Math.min(this.maxSize.width,c)),(s=this.maxSize)!=null&&s.height&&(u=Math.min(this.maxSize.height,u)),{width:c,height:u}}let a=t,l=e;return a<this.minSize.width&&(a=this.minSize.width,l=a/this.aspectRatio),l<this.minSize.height&&(l=this.minSize.height,a=l*this.aspectRatio),(i=this.maxSize)!=null&&i.width&&a>this.maxSize.width&&(a=this.maxSize.width,l=a/this.aspectRatio),(o=this.maxSize)!=null&&o.height&&l>this.maxSize.height&&(l=this.maxSize.height,a=l*this.aspectRatio),{width:a,height:l}}applyAspectRatio(t,e,n){const r=n==="left"||n==="right",s=n==="top"||n==="bottom";return r?{width:t,height:t/this.aspectRatio}:s?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}};function L4(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof Ee){const i=r.index();return r.parent.canReplaceWith(i,i+1,e)}let s=r.depth;for(;s>=0;){const i=r.index(s);if(r.node(s).contentMatchAt(i).matchType(e))return!0;s-=1}return!1}var P4={};Ob(P4,{createAtomBlockMarkdownSpec:()=>j4,createBlockMarkdownSpec:()=>z4,createInlineMarkdownSpec:()=>$4,parseAttributes:()=>Bb,parseIndentedBlocks:()=>Fm,renderNestedMarkdownContent:()=>Hb,serializeAttributes:()=>$b});function Bb(t){if(!(t!=null&&t.trim()))return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,c=>(n.push(c),`__QUOTED_${n.length-1}__`)),s=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(s){const c=s.map(u=>u.trim().slice(1));e.class=c.join(" ")}const i=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(e.id=i[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,c,u])=>{var d;const h=parseInt(((d=u.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),p=n[h];p&&(e[c]=p.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(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(e[u]=!0)}),e}function $b(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 j4(t){const{nodeName:e,name:n,parseAttributes:r=Bb,serializeAttributes:s=$b,defaultAttributes:i={},requiredAttributes:o=[],allowedAttributes:a}=t,l=n||e,c=u=>{if(!a)return u;const d={};return a.forEach(h=>{h in u&&(d[h]=u[h])}),d};return{parseMarkdown:(u,d)=>{const h={...i,...u.attributes};return d.createNode(e,h,[])},markdownTokenizer:{name:e,level:"block",start(u){var d;const h=new RegExp(`^:::${l}(?:\\s|$)`,"m"),p=(d=u.match(h))==null?void 0:d.index;return p!==void 0?p:-1},tokenize(u,d,h){const p=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=u.match(p);if(!m)return;const g=m[1]||"",b=r(g);if(!o.find(w=>!(w in b)))return{type:e,raw:m[0],attributes:b}}},renderMarkdown:u=>{const d=c(u.attrs||{}),h=s(d),p=h?` {${h}}`:"";return`:::${l}${p} :::`}}}function z4(t){const{nodeName:e,name:n,getContent:r,parseAttributes:s=Bb,serializeAttributes:i=$b,defaultAttributes:o={},content:a="block",allowedAttributes:l}=t,c=n||e,u=d=>{if(!l)return d;const h={};return l.forEach(p=>{p in d&&(h[p]=d[p])}),h};return{parseMarkdown:(d,h)=>{let p;if(r){const g=r(d);p=typeof g=="string"?[{type:"text",text:g}]:g}else a==="block"?p=h.parseChildren(d.tokens||[]):p=h.parseInline(d.tokens||[]);const m={...o,...d.attributes};return h.createNode(e,m,p)},markdownTokenizer:{name:e,level:"block",start(d){var h;const p=new RegExp(`^:::${c}`,"m"),m=(h=d.match(p))==null?void 0:h.index;return m!==void 0?m:-1},tokenize(d,h,p){var m;const g=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),b=d.match(g);if(!b)return;const[x,w=""]=b,v=s(w);let k=1;const N=x.length;let S="";const C=/^:::([\w-]*)(\s.*)?/gm,T=d.slice(N);for(C.lastIndex=0;;){const R=C.exec(T);if(R===null)break;const _=R.index,I=R[1];if(!((m=R[2])!=null&&m.endsWith(":::"))){if(I)k+=1;else if(k-=1,k===0){const D=T.slice(0,_);S=D.trim();const V=d.slice(0,N+_+R[0].length);let j=[];if(S)if(a==="block")for(j=p.blockTokens(D),j.forEach(L=>{L.text&&(!L.tokens||L.tokens.length===0)&&(L.tokens=p.inlineTokens(L.text))});j.length>0;){const L=j[j.length-1];if(L.type==="paragraph"&&(!L.text||L.text.trim()===""))j.pop();else break}else j=p.inlineTokens(S);return{type:e,raw:V,attributes:v,content:S,tokens:j}}}}}},renderMarkdown:(d,h)=>{const p=u(d.attrs||{}),m=i(p),g=m?` {${m}}`:"",b=h.renderChildren(d.content||[],`
399
-
400
- `);return`:::${c}${g}
401
-
402
- ${b}
403
-
404
- :::`}}}function F4(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,s,i,o]=r;e[s]=i||o,r=n.exec(t)}return e}function B4(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function $4(t){const{nodeName:e,name:n,getContent:r,parseAttributes:s=F4,serializeAttributes:i=B4,defaultAttributes:o={},selfClosing:a=!1,allowedAttributes:l}=t,c=n||e,u=h=>{if(!l)return h;const p={};return l.forEach(m=>{m in h&&(p[m]=h[m])}),p},d=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(h,p)=>{const m={...o,...h.attributes};if(a)return p.createNode(e,m);const g=r?r(h):h.content||"";return g?p.createNode(e,m,[p.createTextNode(g)]):p.createNode(e,m,[])},markdownTokenizer:{name:e,level:"inline",start(h){const p=a?new RegExp(`\\[${d}\\s*[^\\]]*\\]`):new RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),m=h.match(p),g=m==null?void 0:m.index;return g!==void 0?g:-1},tokenize(h,p,m){const g=a?new RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),b=h.match(g);if(!b)return;let x="",w="";if(a){const[,k]=b;w=k}else{const[,k,N]=b;w=k,x=N||""}const v=s(w.trim());return{type:e,raw:b[0],content:x.trim(),attributes:v}}},renderMarkdown:h=>{let p="";r?p=r(h):h.content&&h.content.length>0&&(p=h.content.filter(x=>x.type==="text").map(x=>x.text).join(""));const m=u(h.attrs||{}),g=i(m),b=g?` ${g}`:"";return a?`[${c}${b}]`:`[${c}${b}]${p}[/${c}]`}}}function Fm(t,e,n){var r,s,i,o;const a=t.split(`
405
- `),l=[];let c="",u=0;const d=e.baseIndentSize||2;for(;u<a.length;){const h=a[u],p=h.match(e.itemPattern);if(!p){if(l.length>0)break;if(h.trim()===""){u+=1;continue}else return}const m=e.extractItemData(p),{indentLevel:g,mainContent:b}=m;c=`${c}${h}
406
- `;const x=[b];for(u+=1;u<a.length;){const N=a[u];if(N.trim()===""){const C=a.slice(u+1).findIndex(_=>_.trim()!=="");if(C===-1)break;if((((s=(r=a[u+1+C].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:s.length)||0)>g){x.push(N),c=`${c}${N}
407
- `,u+=1;continue}else break}if((((o=(i=N.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:o.length)||0)>g)x.push(N),c=`${c}${N}
408
- `,u+=1;else break}let w;const v=x.slice(1);if(v.length>0){const N=v.map(S=>S.slice(g+d)).join(`
409
- `);N.trim()&&(e.customNestedParser?w=e.customNestedParser(N):w=n.blockTokens(N))}const k=e.createToken(m,w);l.push(k)}if(l.length!==0)return{items:l,raw:c.trim()}}function Hb(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const s=typeof n=="function"?n(r):n,[i,...o]=t.content,a=e.renderChildren([i]),l=[`${s}${a}`];return o&&o.length>0&&o.forEach(c=>{const u=e.renderChildren([c]);if(u){const d=u.split(`
410
- `).map(h=>h?e.indent(h):"").join(`
411
- `);l.push(d)}}),l.join(`
412
- `)}function H4(t,e,n={}){const{state:r}=e,{doc:s,tr:i}=r,o=t;s.descendants((a,l)=>{const c=i.mapping.map(l),u=i.mapping.map(l)+a.nodeSize;let d=null;if(a.marks.forEach(p=>{if(p!==o)return!1;d=p}),!d)return;let h=!1;if(Object.keys(n).forEach(p=>{n[p]!==d.attrs[p]&&(h=!0)}),h){const p=t.type.create({...t.attrs,...n});i.removeMark(c,u,t.type),i.addMark(c,u,p)}}),i.docChanged&&e.view.dispatch(i)}var nn=class O1 extends Fb{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new O1(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},U4=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,s,i,o,a;const{view:l}=this.editor,c=t.target,u=c.nodeType===3?(e=c.parentElement)==null?void 0:e.closest("[data-drag-handle]"):c.closest("[data-drag-handle]");if(!this.dom||(n=this.contentDOM)!=null&&n.contains(c)||!u)return;let d=0,h=0;if(this.dom!==u){const w=this.dom.getBoundingClientRect(),v=u.getBoundingClientRect(),k=(s=t.offsetX)!=null?s:(r=t.nativeEvent)==null?void 0:r.offsetX,N=(o=t.offsetY)!=null?o:(i=t.nativeEvent)==null?void 0:i.offsetY;d=v.x-w.x+k,h=v.y-w.y+N}const p=this.dom.cloneNode(!0);try{const w=this.dom.getBoundingClientRect();p.style.width=`${Math.round(w.width)}px`,p.style.height=`${Math.round(w.height)}px`,p.style.boxSizing="border-box",p.style.pointerEvents="none"}catch{}let m=null;try{m=document.createElement("div"),m.style.position="absolute",m.style.top="-9999px",m.style.left="-9999px",m.style.pointerEvents="none",m.appendChild(p),document.body.appendChild(m),(a=t.dataTransfer)==null||a.setDragImage(p,d,h)}finally{m&&setTimeout(()=>{try{m==null||m.remove()}catch{}},0)}const g=this.getPos();if(typeof g!="number")return;const b=Ee.create(l.state.doc,g),x=l.state.tr.setSelection(b);l.dispatch(x)}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 s=t.type.startsWith("drag"),i=t.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!i&&!s)return!0;const{isEditable:a}=this.editor,{isDragging:l}=this,c=!!this.node.type.spec.draggable,u=Ee.isSelectable(this.node),d=t.type==="copy",h=t.type==="paste",p=t.type==="cut",m=t.type==="mousedown";if(!c&&u&&s&&t.target===this.dom&&t.preventDefault(),c&&s&&!l&&t.target===this.dom)return t.preventDefault(),!1;if(c&&a&&!l&&m){const g=n.closest("[data-drag-handle]");g&&(this.dom===g||this.dom.contains(g))&&(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!(l||i||d||h||p||m&&u)}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"&&(Yf()||s1())&&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 Co(t){return new S4({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:s})=>{const i=at(t.getAttributes,void 0,r,s);if(i===!1||i===null)return null;const{tr:o}=e,a=r[r.length-1],l=r[0];let c=n.to;if(a){const u=l.search(/\S/),d=n.from+l.indexOf(a),h=d+a.length;if(zb(n.from,n.to,e.doc).filter(m=>m.mark.type.excluded.find(b=>b===t.type&&b!==m.mark.type)).filter(m=>m.to>d).length)return null;h<n.to&&o.delete(h,n.to),d>n.from&&o.delete(n.from+u,d),c=n.from+u+a.length,o.addMark(n.from+u,c,t.type.create(i||{})),o.removeStoredMark(t.type)}}})}var Xh,Gv;function V4(){return Gv||(Gv=1,Xh=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,s,i;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(s=r;s--!==0;)if(!t(e[s],n[s]))return!1;return!0}if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(s of e.entries())if(!n.has(s[0]))return!1;for(s of e.entries())if(!t(s[1],n.get(s[0])))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(s of e.entries())if(!n.has(s[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(n)){if(r=e.length,r!=n.length)return!1;for(s=r;s--!==0;)if(e[s]!==n[s])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(i=Object.keys(e),r=i.length,r!==Object.keys(n).length)return!1;for(s=r;s--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[s]))return!1;for(s=r;s--!==0;){var o=i[s];if(!(o==="_owner"&&e.$$typeof)&&!t(e[o],n[o]))return!1}return!0}return e!==e&&n!==n}),Xh}var W4=V4();const q4=xc(W4);var Qh={exports:{}},ep={};/**
413
- * @license React
414
- * use-sync-external-store-shim/with-selector.production.js
415
- *
416
- * Copyright (c) Meta Platforms, Inc. and affiliates.
417
- *
418
- * This source code is licensed under the MIT license found in the
419
- * LICENSE file in the root directory of this source tree.
420
- */var Jv;function K4(){if(Jv)return ep;Jv=1;var t=_k(),e=NC();function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var r=typeof Object.is=="function"?Object.is:n,s=e.useSyncExternalStore,i=t.useRef,o=t.useEffect,a=t.useMemo,l=t.useDebugValue;return ep.useSyncExternalStoreWithSelector=function(c,u,d,h,p){var m=i(null);if(m.current===null){var g={hasValue:!1,value:null};m.current=g}else g=m.current;m=a(function(){function x(S){if(!w){if(w=!0,v=S,S=h(S),p!==void 0&&g.hasValue){var C=g.value;if(p(C,S))return k=C}return k=S}if(C=k,r(v,S))return C;var T=h(S);return p!==void 0&&p(C,T)?(v=S,C):(v=S,k=T)}var w=!1,v,k,N=d===void 0?null:d;return[function(){return x(u())},N===null?void 0:function(){return x(N())}]},[u,d,h,p]);var b=s(c,m[0],m[1]);return o(function(){g.hasValue=!0,g.value=b},[b]),l(b),b},ep}var Yv;function G4(){return Yv||(Yv=1,Qh.exports=K4()),Qh.exports}var J4=G4(),Y4=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},Z4=({contentComponent:t})=>{const e=_C.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return f.jsx(f.Fragment,{children:Object.values(e)})};function X4(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:dM.createPortal(r.reactElement,r.element,n)},t.forEach(s=>s())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(s=>s())}}}var Q4=class extends ft.Component{constructor(t){var e;super(t),this.editorContentRef=ft.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const t=this.props.editor;if(t&&!t.isDestroyed&&t.options.element){if(t.contentComponent)return;const e=this.editorContentRef.current;e.append(t.view.dom),t.setOptions({element:e}),t.contentComponent=X4(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=t.contentComponent.subscribe(()=>{this.setState(n=>n.hasContentComponentInitialized?n:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),t.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var t;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.firstChild))return;const n=document.createElement("div");n.append(e.view.dom),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return f.jsxs(f.Fragment,{children:[f.jsx("div",{ref:Y4(e,this.editorContentRef),...n}),(t==null?void 0:t.contentComponent)&&f.jsx(Z4,{contentComponent:t.contentComponent})]})}},e3=y.forwardRef((t,e)=>{const n=ft.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return ft.createElement(Q4,{key:n,innerRef:e,...t})}),t3=ft.memo(e3),n3=typeof window<"u"?y.useLayoutEffect:y.useEffect,r3=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function s3(t){var e;const[n]=y.useState(()=>new r3(t.editor)),r=J4.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:q4);return n3(()=>n.watch(t.editor),[t.editor,n]),y.useDebugValue(r),r}var i3=!1,Bm=typeof window>"u",o3=Bm||!!(typeof window<"u"&&window.next),a3=class I1{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?Bm||o3?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var s,i;return(i=(s=this.options.current).onBeforeCreate)==null?void 0:i.call(s,...r)},onBlur:(...r)=>{var s,i;return(i=(s=this.options.current).onBlur)==null?void 0:i.call(s,...r)},onCreate:(...r)=>{var s,i;return(i=(s=this.options.current).onCreate)==null?void 0:i.call(s,...r)},onDestroy:(...r)=>{var s,i;return(i=(s=this.options.current).onDestroy)==null?void 0:i.call(s,...r)},onFocus:(...r)=>{var s,i;return(i=(s=this.options.current).onFocus)==null?void 0:i.call(s,...r)},onSelectionUpdate:(...r)=>{var s,i;return(i=(s=this.options.current).onSelectionUpdate)==null?void 0:i.call(s,...r)},onTransaction:(...r)=>{var s,i;return(i=(s=this.options.current).onTransaction)==null?void 0:i.call(s,...r)},onUpdate:(...r)=>{var s,i;return(i=(s=this.options.current).onUpdate)==null?void 0:i.call(s,...r)},onContentError:(...r)=>{var s,i;return(i=(s=this.options.current).onContentError)==null?void 0:i.call(s,...r)},onDrop:(...r)=>{var s,i;return(i=(s=this.options.current).onDrop)==null?void 0:i.call(s,...r)},onPaste:(...r)=>{var s,i;return(i=(s=this.options.current).onPaste)==null?void 0:i.call(s,...r)},onDelete:(...r)=>{var s,i;return(i=(s=this.options.current).onDelete)==null?void 0:i.call(s,...r)}};return new O4(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((s,i)=>{var o;return s===((o=n.extensions)==null?void 0:o[i])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?I1.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,s)=>r===e[s]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function l3(t={},e=[]){const n=y.useRef(t);n.current=t;const[r]=y.useState(()=>new a3(n)),s=_C.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return y.useDebugValue(s),y.useEffect(r.onRender(e)),s3({editor:s,selector:({transactionNumber:i})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&i===0?0:i+1}),s}var c3=y.createContext({editor:null});c3.Consumer;var D1=y.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),L1=()=>y.useContext(D1);function u3({as:t="div",...e}){const{nodeViewContentRef:n,nodeViewContentChildren:r}=L1();return f.jsx(t,{...e,ref:n,"data-node-view-content":"",style:{whiteSpace:"pre-wrap",...e.style},children:r})}var P1=ft.forwardRef((t,e)=>{const{onDragStart:n}=L1(),r=t.as||"div";return f.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});function Zv(t){return!!(typeof t=="function"&&t.prototype&&t.prototype.isReactComponent)}function Xv(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.forward_ref)"||t.$$typeof.description==="react.forward_ref"))}function d3(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.memo)"||t.$$typeof.description==="react.memo"))}function f3(t){if(Zv(t)||Xv(t))return!0;if(d3(t)){const e=t.type;if(e)return Zv(e)||Xv(e)}return!1}function h3(){try{if(y.version)return parseInt(y.version.split(".")[0],10)>=19}catch{}return!1}var p3=class{constructor(t,{editor:e,props:n={},as:r="div",className:s=""}){this.ref=null,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=t,this.editor=e,this.props=n,this.element=document.createElement(r),this.element.classList.add("react-renderer"),s&&this.element.classList.add(...s.split(" ")),this.editor.isInitialized?ci.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.render()})}render(){var t;const e=this.component,n=this.props,r=this.editor,s=h3(),i=f3(e),o={...n};o.ref&&!(s||i)&&delete o.ref,!o.ref&&(s||i)&&(o.ref=a=>{this.ref=a}),this.reactElement=f.jsx(e,{...o}),(t=r==null?void 0:r.contentComponent)==null||t.setRenderer(this.id,this)}updateProps(t={}){this.props={...this.props,...t},this.render()}destroy(){var t;const e=this.editor;(t=e==null?void 0:e.contentComponent)==null||t.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(t){Object.keys(t).forEach(e=>{this.element.setAttribute(e,t[e])})}};ft.createContext({markViewContentRef:()=>{}});var m3=class extends U4{constructor(t,e,n){if(super(t,e,n),!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const r=this.dom.querySelector("[data-node-view-content]");if(!r)return;r.appendChild(this.contentDOMElement)}}mount(){const t={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extension,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(l={})=>this.updateAttributes(l),deleteNode:()=>this.deleteNode(),ref:y.createRef()};if(!this.component.displayName){const l=c=>c.charAt(0).toUpperCase()+c.substring(1);this.component.displayName=l(this.extension.name)}const r={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:l=>{l&&this.contentDOMElement&&l.firstChild!==this.contentDOMElement&&(l.hasAttribute("data-node-view-wrapper")&&l.removeAttribute("data-node-view-wrapper"),l.appendChild(this.contentDOMElement))}},s=this.component,i=y.memo(l=>f.jsx(D1.Provider,{value:r,children:y.createElement(s,l)}));i.displayName="ReactNodeView";let o=this.node.isInline?"span":"div";this.options.as&&(o=this.options.as);const{className:a=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new p3(i,{editor:this.editor,props:t,as:o,className:`node-${this.node.type.name} ${a}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var t;if(this.renderer.element.firstElementChild&&!((t=this.renderer.element.firstElementChild)!=null&&t.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){const{from:t,to:e}=this.editor.state.selection,n=this.getPos();if(typeof n=="number")if(t<=n&&e>=n+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(t,e,n){const r=s=>{this.renderer.updateProps(s),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(t.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const s=this.node,i=this.decorations,o=this.innerDecorations;return this.node=t,this.decorations=e,this.innerDecorations=n,this.options.update({oldNode:s,oldDecorations:i,newNode:t,newDecorations:e,oldInnerDecorations:o,innerDecorations:n,updateProps:()=>r({node:t,decorations:e,innerDecorations:n})})}return t===this.node&&this.decorations===e&&this.innerDecorations===n||(this.node=t,this.decorations=e,this.innerDecorations=n,r({node:t,decorations:e,innerDecorations:n})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null}updateElementAttributes(){if(this.options.attrs){let t={};if(typeof this.options.attrs=="function"){const e=this.editor.extensionManager.attributes,n=nc(this.node,e);t=this.options.attrs({node:this.node,HTMLAttributes:n})}else t=this.options.attrs;this.renderer.updateAttributes(t)}}};function j1(t,e){return n=>n.editor.contentComponent?new m3(t,n,e):{}}var xd=(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]},g3=/^\s*>\s$/,b3=nn.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return xd("blockquote",{...Nt(this.options.HTMLAttributes,t),children:xd("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach(s=>{const a=e.renderChildren([s]).split(`
421
- `).map(l=>l.trim()===""?n:`${n} ${l}`);r.push(a.join(`
422
- `))}),r.join(`
423
- ${n}
424
- `)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[La({find:g3,type:this.type})]}}),y3=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,x3=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,v3=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,w3=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,k3=Di.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 xd("strong",{...Nt(this.options.HTMLAttributes,t),children:xd("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),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[Da({find:y3,type:this.type}),Da({find:v3,type:this.type})]},addPasteRules(){return[Co({find:x3,type:this.type}),Co({find:w3,type:this.type})]}}),S3=/(^|[^`])`([^`]+)`(?!`)$/,E3=/(^|[^`])`([^`]+)`(?!`)/g,C3=Di.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",Nt(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[Da({find:S3,type:this.type})]},addPasteRules(){return[Co({find:E3,type:this.type})]}}),tp=4,N3=/^```([a-z]+)?[\s\n]$/,_3=/^~~~([a-z]+)?[\s\n]$/,z1=nn.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:tp,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const i=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",Nt(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const s=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${s}`,e.renderChildren(t.content),"```"].join(`
425
- `):r=`\`\`\`${s}
426
-
427
- \`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:tp,{state:r}=t,{selection:s}=r,{$from:i,empty:o}=s;if(i.parent.type!==this.type)return!1;const a=" ".repeat(n);return o?t.commands.insertContent(a):t.commands.command(({tr:l})=>{const{from:c,to:u}=s,p=r.doc.textBetween(c,u,`
428
- `,`
429
- `).split(`
430
- `).map(m=>a+m).join(`
431
- `);return l.replaceWith(c,u,r.schema.text(p)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:tp,{state:r}=t,{selection:s}=r,{$from:i,empty:o}=s;return i.parent.type!==this.type?!1:o?t.commands.command(({tr:a})=>{var l;const{pos:c}=i,u=i.start(),d=i.end(),p=r.doc.textBetween(u,d,`
432
- `,`
433
- `).split(`
434
- `);let m=0,g=0;const b=c-u;for(let S=0;S<p.length;S+=1){if(g+p[S].length>=b){m=S;break}g+=p[S].length+1}const w=((l=p[m].match(/^ */))==null?void 0:l[0])||"",v=Math.min(w.length,n);if(v===0)return!0;let k=u;for(let S=0;S<m;S+=1)k+=p[S].length+1;return a.delete(k,k+v),c-k<=v&&a.setSelection(Me.create(a.doc,k)),!0}):t.commands.command(({tr:a})=>{const{from:l,to:c}=s,h=r.doc.textBetween(l,c,`
435
- `,`
436
- `).split(`
437
- `).map(p=>{var m;const g=((m=p.match(/^ */))==null?void 0:m[0])||"",b=Math.min(g.length,n);return p.slice(b)}).join(`
438
- `);return a.replaceWith(l,c,r.schema.text(h)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:s}=n;if(!s||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
439
-
440
- `);return!i||!o?!1:t.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:s,empty:i}=n;if(!i||s.parent.type!==this.type||!(s.parentOffset===s.parent.nodeSize-2))return!1;const a=s.after();return a===void 0?!1:r.nodeAt(a)?t.commands.command(({tr:c})=>(c.setSelection(Pe.near(r.resolve(a))),!0)):t.commands.exitCode()}}},addInputRules(){return[zm({find:N3,type:this.type,getAttributes:t=>({language:t[1]})}),zm({find:_3,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Rt({key:new Ut("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),s=r?JSON.parse(r):void 0,i=s==null?void 0:s.mode;if(!n||!i)return!1;const{tr:o,schema:a}=t.state,l=a.text(n.replace(/\r\n?/g,`
441
- `));return o.replaceSelectionWith(this.type.create({language:i},l)),o.selection.$from.parent.type!==this.type&&o.setSelection(Me.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),T3=z1,A3=nn.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
442
-
443
- `):""}),M3=nn.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Nt(this.options.HTMLAttributes,t)]},renderText(){return`
444
- `},renderMarkdown:()=>`
445
- `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:s,storedMarks:i}=n;if(s.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:a}=r.extensionManager,l=i||s.$to.parentOffset&&s.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&l&&o){const d=l.filter(h=>a.includes(h.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),R3=nn.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,Nt(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,s="#".repeat(r);return t.content?`${s} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>zm({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),O3=nn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",Nt(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!L4(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,s=t();return b1(n)?s.insertContentAt(r.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({state:i,tr:o,dispatch:a})=>{if(a){const{$to:l}=o.selection,c=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?o.setSelection(Me.create(o.doc,l.pos+1)):l.nodeAfter.isBlock?o.setSelection(Ee.create(o.doc,l.pos)):o.setSelection(Me.create(o.doc,l.pos));else{const u=i.schema.nodes[this.options.nextNodeType]||l.parent.type.contentMatch.defaultType,d=u==null?void 0:u.create();d&&(o.insert(c,d),o.setSelection(Me.create(o.doc,c+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[R1({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),I3=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,D3=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,L3=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,P3=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,j3=Di.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",Nt(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||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Da({find:I3,type:this.type}),Da({find:L3,type:this.type})]},addPasteRules(){return[Co({find:D3,type:this.type}),Co({find:P3,type:this.type})]}});const z3="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",F3="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",$m="numeric",Hm="ascii",Um="alpha",Rl="asciinumeric",xl="alphanumeric",Vm="domain",F1="emoji",B3="scheme",$3="slashscheme",np="whitespace";function H3(t,e){return t in e||(e[t]=[]),e[t]}function Gi(t,e,n){e[$m]&&(e[Rl]=!0,e[xl]=!0),e[Hm]&&(e[Rl]=!0,e[Um]=!0),e[Rl]&&(e[xl]=!0),e[Um]&&(e[xl]=!0),e[xl]&&(e[Vm]=!0),e[F1]&&(e[Vm]=!0);for(const r in e){const s=H3(r,n);s.indexOf(t)<0&&s.push(t)}}function U3(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function Gn(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Gn.groups={};Gn.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const s=e.jr[r][0],i=e.jr[r][1];if(i&&s.test(t))return i}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let s=0;s<t.length;s++)this.tt(t[s],e,n,r)},tr(t,e,n,r){r=r||Gn.groups;let s;return e&&e.j?s=e:(s=new Gn(e),n&&r&&Gi(e,n,r)),this.jr.push([t,s]),s},ts(t,e,n,r){let s=this;const i=t.length;if(!i)return s;for(let o=0;o<i-1;o++)s=s.tt(t[o]);return s.tt(t[i-1],e,n,r)},tt(t,e,n,r){r=r||Gn.groups;const s=this;if(e&&e.j)return s.j[t]=e,e;const i=e;let o,a=s.go(t);if(a?(o=new Gn,Object.assign(o.j,a.j),o.jr.push.apply(o.jr,a.jr),o.jd=a.jd,o.t=a.t):o=new Gn,i){if(r)if(o.t&&typeof o.t=="string"){const l=Object.assign(U3(o.t,r),n);Gi(i,l,r)}else n&&Gi(i,n,r);o.t=i}return s.j[t]=o,o}};const qe=(t,e,n,r,s)=>t.ta(e,n,r,s),jt=(t,e,n,r,s)=>t.tr(e,n,r,s),Qv=(t,e,n,r,s)=>t.ts(e,n,r,s),ee=(t,e,n,r,s)=>t.tt(e,n,r,s),ps="WORD",Wm="UWORD",B1="ASCIINUMERICAL",$1="ALPHANUMERICAL",rc="LOCALHOST",qm="TLD",Km="UTLD",Hu="SCHEME",Go="SLASH_SCHEME",Ub="NUM",Gm="WS",Vb="NL",Ol="OPENBRACE",Il="CLOSEBRACE",vd="OPENBRACKET",wd="CLOSEBRACKET",kd="OPENPAREN",Sd="CLOSEPAREN",Ed="OPENANGLEBRACKET",Cd="CLOSEANGLEBRACKET",Nd="FULLWIDTHLEFTPAREN",_d="FULLWIDTHRIGHTPAREN",Td="LEFTCORNERBRACKET",Ad="RIGHTCORNERBRACKET",Md="LEFTWHITECORNERBRACKET",Rd="RIGHTWHITECORNERBRACKET",Od="FULLWIDTHLESSTHAN",Id="FULLWIDTHGREATERTHAN",Dd="AMPERSAND",Ld="APOSTROPHE",Pd="ASTERISK",qs="AT",jd="BACKSLASH",zd="BACKTICK",Fd="CARET",Ys="COLON",Wb="COMMA",Bd="DOLLAR",Wr="DOT",$d="EQUALS",qb="EXCLAMATION",mr="HYPHEN",Dl="PERCENT",Hd="PIPE",Ud="PLUS",Vd="POUND",Ll="QUERY",Kb="QUOTE",H1="FULLWIDTHMIDDLEDOT",Gb="SEMI",qr="SLASH",Pl="TILDE",Wd="UNDERSCORE",U1="EMOJI",qd="SYM";var V1=Object.freeze({__proto__:null,ALPHANUMERICAL:$1,AMPERSAND:Dd,APOSTROPHE:Ld,ASCIINUMERICAL:B1,ASTERISK:Pd,AT:qs,BACKSLASH:jd,BACKTICK:zd,CARET:Fd,CLOSEANGLEBRACKET:Cd,CLOSEBRACE:Il,CLOSEBRACKET:wd,CLOSEPAREN:Sd,COLON:Ys,COMMA:Wb,DOLLAR:Bd,DOT:Wr,EMOJI:U1,EQUALS:$d,EXCLAMATION:qb,FULLWIDTHGREATERTHAN:Id,FULLWIDTHLEFTPAREN:Nd,FULLWIDTHLESSTHAN:Od,FULLWIDTHMIDDLEDOT:H1,FULLWIDTHRIGHTPAREN:_d,HYPHEN:mr,LEFTCORNERBRACKET:Td,LEFTWHITECORNERBRACKET:Md,LOCALHOST:rc,NL:Vb,NUM:Ub,OPENANGLEBRACKET:Ed,OPENBRACE:Ol,OPENBRACKET:vd,OPENPAREN:kd,PERCENT:Dl,PIPE:Hd,PLUS:Ud,POUND:Vd,QUERY:Ll,QUOTE:Kb,RIGHTCORNERBRACKET:Ad,RIGHTWHITECORNERBRACKET:Rd,SCHEME:Hu,SEMI:Gb,SLASH:qr,SLASH_SCHEME:Go,SYM:qd,TILDE:Pl,TLD:qm,UNDERSCORE:Wd,UTLD:Km,UWORD:Wm,WORD:ps,WS:Gm});const ds=/[a-z]/,ll=new RegExp("\\p{L}","u"),rp=new RegExp("\\p{Emoji}","u"),fs=/\d/,sp=/\s/,ew="\r",ip=`
446
- `,V3="️",W3="‍",op="";let hu=null,pu=null;function q3(t=[]){const e={};Gn.groups=e;const n=new Gn;hu==null&&(hu=tw(z3)),pu==null&&(pu=tw(F3)),ee(n,"'",Ld),ee(n,"{",Ol),ee(n,"}",Il),ee(n,"[",vd),ee(n,"]",wd),ee(n,"(",kd),ee(n,")",Sd),ee(n,"<",Ed),ee(n,">",Cd),ee(n,"(",Nd),ee(n,")",_d),ee(n,"「",Td),ee(n,"」",Ad),ee(n,"『",Md),ee(n,"』",Rd),ee(n,"<",Od),ee(n,">",Id),ee(n,"&",Dd),ee(n,"*",Pd),ee(n,"@",qs),ee(n,"`",zd),ee(n,"^",Fd),ee(n,":",Ys),ee(n,",",Wb),ee(n,"$",Bd),ee(n,".",Wr),ee(n,"=",$d),ee(n,"!",qb),ee(n,"-",mr),ee(n,"%",Dl),ee(n,"|",Hd),ee(n,"+",Ud),ee(n,"#",Vd),ee(n,"?",Ll),ee(n,'"',Kb),ee(n,"/",qr),ee(n,";",Gb),ee(n,"~",Pl),ee(n,"_",Wd),ee(n,"\\",jd),ee(n,"・",H1);const r=jt(n,fs,Ub,{[$m]:!0});jt(r,fs,r);const s=jt(r,ds,B1,{[Rl]:!0}),i=jt(r,ll,$1,{[xl]:!0}),o=jt(n,ds,ps,{[Hm]:!0});jt(o,fs,s),jt(o,ds,o),jt(s,fs,s),jt(s,ds,s);const a=jt(n,ll,Wm,{[Um]:!0});jt(a,ds),jt(a,fs,i),jt(a,ll,a),jt(i,fs,i),jt(i,ds),jt(i,ll,i);const l=ee(n,ip,Vb,{[np]:!0}),c=ee(n,ew,Gm,{[np]:!0}),u=jt(n,sp,Gm,{[np]:!0});ee(n,op,u),ee(c,ip,l),ee(c,op,u),jt(c,sp,u),ee(u,ew),ee(u,ip),jt(u,sp,u),ee(u,op,u);const d=jt(n,rp,U1,{[F1]:!0});ee(d,"#"),jt(d,rp,d),ee(d,V3,d);const h=ee(d,W3);ee(h,"#"),jt(h,rp,d);const p=[[ds,o],[fs,s]],m=[[ds,null],[ll,a],[fs,i]];for(let g=0;g<hu.length;g++)Bs(n,hu[g],qm,ps,p);for(let g=0;g<pu.length;g++)Bs(n,pu[g],Km,Wm,m);Gi(qm,{tld:!0,ascii:!0},e),Gi(Km,{utld:!0,alpha:!0},e),Bs(n,"file",Hu,ps,p),Bs(n,"mailto",Hu,ps,p),Bs(n,"http",Go,ps,p),Bs(n,"https",Go,ps,p),Bs(n,"ftp",Go,ps,p),Bs(n,"ftps",Go,ps,p),Gi(Hu,{scheme:!0,ascii:!0},e),Gi(Go,{slashscheme:!0,ascii:!0},e),t=t.sort((g,b)=>g[0]>b[0]?1:-1);for(let g=0;g<t.length;g++){const b=t[g][0],w=t[g][1]?{[B3]:!0}:{[$3]:!0};b.indexOf("-")>=0?w[Vm]=!0:ds.test(b)?fs.test(b)?w[Rl]=!0:w[Hm]=!0:w[$m]=!0,Qv(n,b,b,w)}return Qv(n,"localhost",rc,{ascii:!0}),n.jd=new Gn(qd),{start:n,tokens:Object.assign({groups:e},V1)}}function W1(t,e){const n=K3(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=n.length,s=[];let i=0,o=0;for(;o<r;){let a=t,l=null,c=0,u=null,d=-1,h=-1;for(;o<r&&(l=a.go(n[o]));)a=l,a.accepts()?(d=0,h=0,u=a):d>=0&&(d+=n[o].length,h++),c+=n[o].length,i+=n[o].length,o++;i-=d,o-=h,c-=d,s.push({t:u.t,v:e.slice(i-c,i),s:i-c,e:i})}return s}function K3(t){const e=[],n=t.length;let r=0;for(;r<n;){let s=t.charCodeAt(r),i,o=s<55296||s>56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function Bs(t,e,n,r,s){let i;const o=e.length;for(let a=0;a<o-1;a++){const l=e[a];t.j[l]?i=t.j[l]:(i=new Gn(r),i.jr=s.slice(),t.j[l]=i),t=i}return i=new Gn(n),i.jr=s.slice(),t.j[e[o-1]]=i,i}function tw(t){const e=[],n=[];let r=0,s="0123456789";for(;r<t.length;){let i=0;for(;s.indexOf(t[r+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let o=parseInt(t.substring(r,r+i),10);o>0;o--)n.pop();r+=i}else n.push(t[r]),r++}return e}const sc={defaultProtocol:"http",events:null,format:nw,formatHref:nw,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Jb(t,e=null){let n=Object.assign({},sc);t&&(n=Object.assign(n,t instanceof Jb?t.o:t));const r=n.ignoreTags,s=[];for(let i=0;i<r.length;i++)s.push(r[i].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=s}Jb.prototype={o:sc,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let s=this.o[t];return s&&(typeof s=="object"?(s=n.t in s?s[n.t]:sc[t],typeof s=="function"&&r&&(s=s(e,n))):typeof s=="function"&&r&&(s=s(e,n.t,n)),s)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function nw(t){return t}function q1(t,e){this.t="token",this.v=t,this.tk=e}q1.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=sc.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),s=t.get("tagName",n,e),i=this.toFormattedString(t),o={},a=t.get("className",n,e),l=t.get("target",n,e),c=t.get("rel",n,e),u=t.getObj("attributes",n,e),d=t.getObj("events",n,e);return o.href=r,a&&(o.class=a),l&&(o.target=l),c&&(o.rel=c),u&&Object.assign(o,u),{tagName:s,attributes:o,content:i,eventListeners:d}}};function nh(t,e){class n extends q1{constructor(s,i){super(s,i),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const rw=nh("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),sw=nh("text"),G3=nh("nl"),mu=nh("url",{isLink:!0,toHref(t=sc.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==rc&&t[1].t===Ys}}),pr=t=>new Gn(t);function J3({groups:t}){const e=t.domain.concat([Dd,Pd,qs,jd,zd,Fd,Bd,$d,mr,Ub,Dl,Hd,Ud,Vd,qr,qd,Pl,Wd]),n=[Ld,Ys,Wb,Wr,qb,Dl,Ll,Kb,Gb,Ed,Cd,Ol,Il,wd,vd,kd,Sd,Nd,_d,Td,Ad,Md,Rd,Od,Id],r=[Dd,Ld,Pd,jd,zd,Fd,Bd,$d,mr,Ol,Il,Dl,Hd,Ud,Vd,Ll,qr,qd,Pl,Wd],s=pr(),i=ee(s,Pl);qe(i,r,i),qe(i,t.domain,i);const o=pr(),a=pr(),l=pr();qe(s,t.domain,o),qe(s,t.scheme,a),qe(s,t.slashscheme,l),qe(o,r,i),qe(o,t.domain,o);const c=ee(o,qs);ee(i,qs,c),ee(a,qs,c),ee(l,qs,c);const u=ee(i,Wr);qe(u,r,i),qe(u,t.domain,i);const d=pr();qe(c,t.domain,d),qe(d,t.domain,d);const h=ee(d,Wr);qe(h,t.domain,d);const p=pr(rw);qe(h,t.tld,p),qe(h,t.utld,p),ee(c,rc,p);const m=ee(d,mr);ee(m,mr,m),qe(m,t.domain,d),qe(p,t.domain,d),ee(p,Wr,h),ee(p,mr,m);const g=ee(p,Ys);qe(g,t.numeric,rw);const b=ee(o,mr),x=ee(o,Wr);ee(b,mr,b),qe(b,t.domain,o),qe(x,r,i),qe(x,t.domain,o);const w=pr(mu);qe(x,t.tld,w),qe(x,t.utld,w),qe(w,t.domain,o),qe(w,r,i),ee(w,Wr,x),ee(w,mr,b),ee(w,qs,c);const v=ee(w,Ys),k=pr(mu);qe(v,t.numeric,k);const N=pr(mu),S=pr();qe(N,e,N),qe(N,n,S),qe(S,e,N),qe(S,n,S),ee(w,qr,N),ee(k,qr,N);const C=ee(a,Ys),T=ee(l,Ys),R=ee(T,qr),_=ee(R,qr);qe(a,t.domain,o),ee(a,Wr,x),ee(a,mr,b),qe(l,t.domain,o),ee(l,Wr,x),ee(l,mr,b),qe(C,t.domain,N),ee(C,qr,N),ee(C,Ll,N),qe(_,t.domain,N),qe(_,e,N),ee(_,qr,N);const I=[[Ol,Il],[vd,wd],[kd,Sd],[Ed,Cd],[Nd,_d],[Td,Ad],[Md,Rd],[Od,Id]];for(let D=0;D<I.length;D++){const[V,j]=I[D],L=ee(N,V);ee(S,V,L),ee(L,j,N);const q=pr(mu);qe(L,e,q);const re=pr();qe(L,n),qe(q,e,q),qe(q,n,re),qe(re,e,q),qe(re,n,re),ee(q,j,N),ee(re,j,N)}return ee(s,rc,w),ee(s,Vb,G3),{start:s,tokens:V1}}function Y3(t,e,n){let r=n.length,s=0,i=[],o=[];for(;s<r;){let a=t,l=null,c=null,u=0,d=null,h=-1;for(;s<r&&!(l=a.go(n[s].t));)o.push(n[s++]);for(;s<r&&(c=l||a.go(n[s].t));)l=null,a=c,a.accepts()?(h=0,d=a):h>=0&&h++,s++,u++;if(h<0)s-=u,s<r&&(o.push(n[s]),s++);else{o.length>0&&(i.push(ap(sw,e,o)),o=[]),s-=h,u-=h;const p=d.t,m=n.slice(s-u,s);i.push(ap(p,e,m))}}return o.length>0&&i.push(ap(sw,e,o)),i}function ap(t,e,n){const r=n[0].s,s=n[n.length-1].e,i=e.slice(r,s);return new t(i,n)}const Z3=typeof console<"u"&&console&&console.warn||(()=>{}),X3="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",At={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Q3(){return Gn.groups={},At.scanner=null,At.parser=null,At.tokenQueue=[],At.pluginQueue=[],At.customSchemes=[],At.initialized=!1,At}function iw(t,e=!1){if(At.initialized&&Z3(`linkifyjs: already initialized - will not register custom scheme "${t}" ${X3}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
447
- 1. Must only contain digits, lowercase ASCII letters or "-"
448
- 2. Cannot start or end with "-"
449
- 3. "-" cannot repeat`);At.customSchemes.push([t,e])}function eH(){At.scanner=q3(At.customSchemes);for(let t=0;t<At.tokenQueue.length;t++)At.tokenQueue[t][1]({scanner:At.scanner});At.parser=J3(At.scanner.tokens);for(let t=0;t<At.pluginQueue.length;t++)At.pluginQueue[t][1]({scanner:At.scanner,parser:At.parser});return At.initialized=!0,At}function Yb(t){return At.initialized||eH(),Y3(At.parser.start,t,W1(At.scanner.start,t))}Yb.scan=W1;function K1(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new Jb(n),s=Yb(t),i=[];for(let o=0;o<s.length;o++){const a=s[o];a.isLink&&(!e||a.t===e)&&r.check(a)&&i.push(a.toFormattedObject(r))}return i}var Zb="[\0-   ᠎ -\u2029  ]",tH=new RegExp(Zb),nH=new RegExp(`${Zb}$`),rH=new RegExp(Zb,"g");function sH(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function iH(t){return new Rt({key:new Ut("autolink"),appendTransaction:(e,n,r)=>{const s=e.some(c=>c.docChanged)&&!n.doc.eq(r.doc),i=e.some(c=>c.getMeta("preventAutolink"));if(!s||i)return;const{tr:o}=r,a=l1(n.doc,[...e]);if(g1(a).forEach(({newRange:c})=>{const u=F$(r.doc,c,p=>p.isTextblock);let d,h;if(u.length>1)d=u[0],h=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(u.length){const p=r.doc.textBetween(c.from,c.to," "," ");if(!nH.test(p))return;d=u[0],h=r.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&h){const p=h.split(tH).filter(Boolean);if(p.length<=0)return!1;const m=p[p.length-1],g=d.pos+h.lastIndexOf(m);if(!m)return!1;const b=Yb(m).map(x=>x.toObject(t.defaultProtocol));if(!sH(b))return!1;b.filter(x=>x.isLink).map(x=>({...x,from:g+x.start+1,to:g+x.end+1})).filter(x=>r.schema.marks.code?!r.doc.rangeHasMark(x.from,x.to,r.schema.marks.code):!0).filter(x=>t.validate(x.value)).filter(x=>t.shouldAutoLink(x.value)).forEach(x=>{zb(x.from,x.to,r.doc).some(w=>w.mark.type===t.type)||o.addMark(x.from,x.to,t.type.create({href:x.href}))})}}),!!o.steps.length)return o}})}function oH(t){return new Rt({key:new Ut("handleClickLink"),props:{handleClick:(e,n,r)=>{var s,i;if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{let u=r.target;const d=[];for(;u.nodeName!=="DIV";)d.push(u),u=u.parentNode;o=d.find(h=>h.nodeName==="A")}if(!o)return!1;const a=m1(e.state,t.type.name),l=(s=o==null?void 0:o.href)!=null?s:a.href,c=(i=o==null?void 0:o.target)!=null?i:a.target;return t.enableClickSelection&&t.editor.commands.extendMarkRange(t.type.name),o&&l?(window.open(l,c),!0):!1}}})}function aH(t){return new Rt({key:new Ut("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:s}=t,{state:i}=e,{selection:o}=i,{empty:a}=o;if(a)return!1;let l="";r.content.forEach(u=>{l+=u.textContent});const c=K1(l,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===l);return!l||!c||s!==void 0&&!s(c.href)?!1:t.editor.commands.setMark(t.type,{href:c.href})}}})}function zi(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const s=typeof r=="string"?r:r.scheme;s&&n.push(s)}),!t||t.replace(rH,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var lH=Di.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){iw(t);return}iw(t.scheme,t.optionalSlashes)})},onDestroy(){Q3()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!zi(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!zi(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!zi(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Nt(this.options.HTMLAttributes,t),0]:["a",Nt(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n;const r=((n=t.attrs)==null?void 0:n.href)||"";return`[${e.renderChildren(t)}](${r})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!zi(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!zi(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Co({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,s=K1(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:o=>!!zi(o,n),protocols:n,defaultProtocol:r}));s.length&&s.forEach(i=>{this.options.shouldAutoLink(i.value)&&e.push({text:i.value,data:{href:i.href},index:i.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(iH({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:s=>!!zi(s,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(oH({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(aH({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),cH=Object.defineProperty,uH=(t,e)=>{for(var n in e)cH(t,n,{get:e[n],enumerable:!0})},dH="listItem",ow="textStyle",aw=/^\s*([-+*])\s$/,G1=nn.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",Nt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
450
- `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(dH,this.editor.getAttributes(ow)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=La({find:aw,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=La({find:aw,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(ow),editor:this.editor})),[t]}}),J1=nn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Nt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{if(t.type!=="list_item")return[];let n=[];if(t.tokens&&t.tokens.length>0)if(t.tokens.some(s=>s.type==="paragraph"))n=e.parseChildren(t.tokens);else{const s=t.tokens[0];if(s&&s.type==="text"&&s.tokens&&s.tokens.length>0){if(n=[{type:"paragraph",content:e.parseInline(s.tokens)}],t.tokens.length>1){const o=t.tokens.slice(1),a=e.parseChildren(o);n.push(...a)}}else n=e.parseChildren(t.tokens)}return n.length===0&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(t,e,n)=>Hb(t,e,r=>r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${r.index+1}. `:"- ",n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),fH={};uH(fH,{findListItemPos:()=>Wc,getNextListDepth:()=>Xb,handleBackspace:()=>Jm,handleDelete:()=>Ym,hasListBefore:()=>Y1,hasListItemAfter:()=>hH,hasListItemBefore:()=>Z1,listItemHasSubList:()=>X1,nextListIsDeeper:()=>Q1,nextListIsHigher:()=>e_});var Wc=(t,e)=>{const{$from:n}=e.selection,r=Zt(t,e.schema);let s=null,i=n.depth,o=n.pos,a=null;for(;i>0&&a===null;)s=n.node(i),s.type===r?a=i:(i-=1,o-=1);return a===null?null:{$pos:e.doc.resolve(o),depth:a}},Xb=(t,e)=>{const n=Wc(t,e);if(!n)return!1;const[,r]=G$(e,t,n.$pos.pos+4);return r},Y1=(t,e,n)=>{const{$anchor:r}=t.selection,s=Math.max(0,r.pos-2),i=t.doc.resolve(s).node();return!(!i||!n.includes(i.type.name))},Z1=(t,e)=>{var n;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-2);return!(s.index()===0||((n=s.nodeBefore)==null?void 0:n.type.name)!==t)},X1=(t,e,n)=>{if(!n)return!1;const r=Zt(t,e.schema);let s=!1;return n.descendants(i=>{i.type===r&&(s=!0)}),s},Jm=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!Si(t.state,e)&&Y1(t.state,e,n)){const{$anchor:a}=t.state.selection,l=t.state.doc.resolve(a.before()-1),c=[];l.node().descendants((h,p)=>{h.type.name===e&&c.push({node:h,pos:p})});const u=c.at(-1);if(!u)return!1;const d=t.state.doc.resolve(l.start()+u.pos+1);return t.chain().cut({from:a.start()-1,to:a.end()+1},d.end()).joinForward().run()}if(!Si(t.state,e)||!X$(t.state))return!1;const r=Wc(e,t.state);if(!r)return!1;const i=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=X1(e,t.state,i);return Z1(e,t.state)&&!o?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},Q1=(t,e)=>{const n=Xb(t,e),r=Wc(t,e);return!r||!n?!1:n>r.depth},e_=(t,e)=>{const n=Xb(t,e),r=Wc(t,e);return!r||!n?!1:n<r.depth},Ym=(t,e)=>{if(!Si(t.state,e)||!Z$(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:s}=n;return!n.empty&&r.sameParent(s)?!1:Q1(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():e_(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},hH=(t,e)=>{var n;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-r.parentOffset-2);return!(s.index()===s.parent.childCount-1||((n=s.nodeAfter)==null?void 0:n.type.name)!==t)},t_=Dt.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Ym(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&Ym(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&Jm(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&Jm(t,n,r)&&(e=!0)}),e}}}}),lw=/^(\s*)(\d+)\.\s+(.*)$/,pH=/^\s/;function mH(t){const e=[];let n=0,r=0;for(;n<t.length;){const s=t[n],i=s.match(lw);if(!i)break;const[,o,a,l]=i,c=o.length;let u=l,d=n+1;const h=[s];for(;d<t.length;){const p=t[d];if(p.match(lw))break;if(p.trim()==="")h.push(p),u+=`
451
- `,d+=1;else if(p.match(pH))h.push(p),u+=`
452
- ${p.slice(c+2)}`,d+=1;else break}e.push({indent:c,number:parseInt(a,10),content:u.trim(),raw:h.join(`
453
- `)}),r=d,n=d}return[e,r]}function n_(t,e,n){var r;const s=[];let i=0;for(;i<t.length;){const o=t[i];if(o.indent===e){const a=o.content.split(`
454
- `),l=((r=a[0])==null?void 0:r.trim())||"",c=[];l&&c.push({type:"paragraph",raw:l,tokens:n.inlineTokens(l)});const u=a.slice(1).join(`
455
- `).trim();if(u){const p=n.blockTokens(u);c.push(...p)}let d=i+1;const h=[];for(;d<t.length&&t[d].indent>e;)h.push(t[d]),d+=1;if(h.length>0){const p=Math.min(...h.map(g=>g.indent)),m=n_(h,p,n);c.push({type:"list",ordered:!0,start:h[0].number,items:m,raw:h.map(g=>g.raw).join(`
456
- `)})}s.push({type:"list_item",raw:o.raw,tokens:c}),i=d}else i+=1}return s}function gH(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(s=>{if(s.type==="paragraph"||s.type==="list"||s.type==="blockquote"||s.type==="code")r.push(...e.parseChildren([s]));else if(s.type==="text"&&s.tokens){const i=e.parseChildren([s]);r.push({type:"paragraph",content:i})}else{const i=e.parseChildren([s]);i.length>0&&r.push(...i)}}),{type:"listItem",content:r}})}var bH="listItem",cw="textStyle",uw=/^(\d+)\.\s$/,r_=nn.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",Nt(this.options.HTMLAttributes,n),0]:["ol",Nt(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.items?gH(t.items,e):[];return n!==1?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
457
- `):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e==null?void 0:e.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var r;const s=t.split(`
458
- `),[i,o]=mH(s);if(i.length===0)return;const a=n_(i,0,n);return a.length===0?void 0:{type:"list",ordered:!0,start:((r=i[0])==null?void 0:r.number)||1,items:a,raw:s.slice(0,o).join(`
459
- `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(bH,this.editor.getAttributes(cw)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=La({find:uw,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=La({find:uw,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(cw)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),yH=/^\s*(\[([( |x])?\])\s$/,xH=nn.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",Nt(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const s=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return Hb(t,e,s)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const s=document.createElement("li"),i=document.createElement("label"),o=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),c=u=>{var d,h;a.ariaLabel=((h=(d=this.options.a11y)==null?void 0:d.checkboxLabel)==null?void 0:h.call(d,u,a.checked))||`Task item checkbox for ${u.textContent||"empty task item"}`};return c(t),i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",u=>u.preventDefault()),a.addEventListener("change",u=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:d}=u.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{const p=n();if(typeof p!="number")return!1;const m=h.doc.nodeAt(p);return h.setNodeMarkup(p,void 0,{...m==null?void 0:m.attrs,checked:d}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,d)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,d])=>{s.setAttribute(u,d)}),s.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,i.append(a,o),s.append(i,l),Object.entries(e).forEach(([u,d])=>{s.setAttribute(u,d)}),{dom:s,contentDOM:l,update:u=>u.type!==this.type?!1:(s.dataset.checked=u.attrs.checked,a.checked=u.attrs.checked,c(u),!0)}}},addInputRules(){return[La({find:yH,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),vH=nn.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",Nt(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
460
- `):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=i=>{const o=Fm(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,l)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:n.inlineTokens(a.mainContent),nestedTokens:l}),customNestedParser:r},n);return o?[{type:"taskList",raw:o.raw,items:o.items}]:n.blockTokens(i)},s=Fm(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,o)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:n.inlineTokens(i.mainContent),nestedTokens:o}),customNestedParser:r},n);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),wH=Dt.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(G1.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(J1.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(t_.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(r_.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(xH.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(vH.configure(this.options.taskList)),t}}),kH=nn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Nt(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];return n.length===1&&n[0].type==="image"?e.parseChildren([n[0]]):e.createNode("paragraph",void 0,e.parseInline(n))},renderMarkdown:(t,e)=>!t||!Array.isArray(t.content)?"":e.renderChildren(t.content),addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),SH=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,EH=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,CH=Di.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",Nt(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[Da({find:SH,type:this.type})]},addPasteRules(){return[Co({find:EH,type:this.type})]}}),NH=nn.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),_H=Di.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",Nt(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 s=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!s)return;const i=s[2].trim();return{type:"underline",raw:s[0],text:i,tokens:n.inlineTokens(i)}}},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()}}});function TH(t={}){return new Rt({view(e){return new AH(e,t)}})}class AH{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let i=o=>{this[s](o)};return e.dom.addEventListener(s,i),{name:s,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,s=this.editorView.dom,i=s.getBoundingClientRect(),o=i.width/s.offsetWidth,a=i.height/s.offsetHeight;if(n){let d=e.nodeBefore,h=e.nodeAfter;if(d||h){let p=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(p){let m=p.getBoundingClientRect(),g=d?m.bottom:m.top;d&&h&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let b=this.width/2*a;r={left:m.left,right:m.right,top:g-b,bottom:g+b}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*o;r={left:d.left-h,right:d.left+h,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,u;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=l.getBoundingClientRect(),h=d.width/l.offsetWidth,p=d.height/l.offsetHeight;c=d.left-l.scrollLeft*h,u=d.top-l.scrollTop*p}this.element.style.left=(r.left-c)/o+"px",this.element.style.top=(r.top-u)/a+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),s=r&&r.type.spec.disableDropCursor,i=typeof s=="function"?s(this.editorView,n,e):s;if(n&&!i){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=eN(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Ft extends Pe{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Ft.valid(r)?new Ft(r):Pe.near(r)}content(){return ae.empty}eq(e){return e instanceof Ft&&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 Ft(e.resolve(n.pos))}getBookmark(){return new Qb(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!MH(e)||!RH(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let s=n.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&Ft.valid(e))return e;let s=e.pos,i=null;for(let o=e.depth;;o--){let a=e.node(o);if(n>0?e.indexAfter(o)<a.childCount:e.index(o)>0){i=a.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;s+=n;let l=e.doc.resolve(s);if(Ft.valid(l))return l}for(;;){let o=n>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!Ee.isSelectable(i)){e=e.doc.resolve(s+i.nodeSize*n),r=!1;continue e}break}i=o,s+=n;let a=e.doc.resolve(s);if(Ft.valid(a))return a}return null}}}Ft.prototype.visible=!1;Ft.findFrom=Ft.findGapCursorFrom;Pe.jsonID("gapcursor",Ft);class Qb{constructor(e){this.pos=e}map(e){return new Qb(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Ft.valid(n)?new Ft(n):Pe.near(n)}}function s_(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function MH(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 s=r.child(n-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||s_(s.type))return!0;if(s.inlineContent)return!1}}return!0}function RH(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 s=r.child(n);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||s_(s.type))return!0;if(s.inlineContent)return!1}}return!0}function OH(){return new Rt({props:{decorations:PH,createSelectionBetween(t,e,n){return e.pos==n.pos&&Ft.valid(n)?new Ft(n):null},handleClick:DH,handleKeyDown:IH,handleDOMEvents:{beforeinput:LH}}})}const IH=Rb({ArrowLeft:gu("horiz",-1),ArrowRight:gu("horiz",1),ArrowUp:gu("vert",-1),ArrowDown:gu("vert",1)});function gu(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,i){let o=r.selection,a=e>0?o.$to:o.$from,l=o.empty;if(o instanceof Me){if(!i.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=Ft.findGapCursorFrom(a,e,l);return c?(s&&s(r.tr.setSelection(new Ft(c))),!0):!1}}function DH(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Ft.valid(r))return!1;let s=t.posAtCoords({left:n.clientX,top:n.clientY});return s&&s.inside>-1&&Ee.isSelectable(t.state.doc.nodeAt(s.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Ft(r))),!0)}function LH(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Ft))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 s=G.empty;for(let o=r.length-1;o>=0;o--)s=G.from(r[o].createAndFill(null,s));let i=t.state.tr.replace(n.pos,n.pos,new ae(s,0,0));return i.setSelection(Me.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function PH(t){if(!(t.selection instanceof Ft))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",yt.create(t.doc,[tn.widget(t.selection.head,e,{key:"gapcursor"})])}var Kd=200,un=function(){};un.prototype.append=function(e){return e.length?(e=un.from(e),!this.length&&e||e.length<Kd&&this.leafAppend(e)||this.length<Kd&&e.leafPrepend(this)||this.appendInner(e)):this};un.prototype.prepend=function(e){return e.length?un.from(e).append(this):this};un.prototype.appendInner=function(e){return new jH(this,e)};un.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?un.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};un.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};un.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)};un.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(i,o){return s.push(e(i,o))},n,r),s};un.from=function(e){return e instanceof un?e:e&&e.length?new i_(e):un.empty};var i_=(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(s,i){return s==0&&i==this.length?this:new e(this.values.slice(s,i))},e.prototype.getInner=function(s){return this.values[s]},e.prototype.forEachInner=function(s,i,o,a){for(var l=i;l<o;l++)if(s(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(s,i,o,a){for(var l=i-1;l>=o;l--)if(s(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(s){if(this.length+s.length<=Kd)return new e(this.values.concat(s.flatten()))},e.prototype.leafPrepend=function(s){if(this.length+s.length<=Kd)return new e(s.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(un);un.empty=new i_([]);var jH=(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,s,i,o){var a=this.left.length;if(s<a&&this.left.forEachInner(r,s,Math.min(i,a),o)===!1||i>a&&this.right.forEachInner(r,Math.max(s-a,0),Math.min(this.length,i)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,i,o){var a=this.left.length;if(s>a&&this.right.forEachInvertedInner(r,s-a,Math.max(i,a)-a,o+a)===!1||i<a&&this.left.forEachInvertedInner(r,Math.min(s,a),i,o)===!1)return!1},e.prototype.sliceInner=function(r,s){if(r==0&&s==this.length)return this;var i=this.left.length;return s<=i?this.left.slice(r,s):r>=i?this.right.slice(r-i,s-i):this.left.slice(r,i).append(this.right.slice(0,s-i))},e.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new e(this.left,s)},e.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new e(s,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})(un);const zH=500;class Dr{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 s,i;n&&(s=this.remapping(r,this.items.length),i=s.maps.length);let o=e.tr,a,l,c=[],u=[];return this.items.forEach((d,h)=>{if(!d.step){s||(s=this.remapping(r,h+1),i=s.maps.length),i--,u.push(d);return}if(s){u.push(new Kr(d.map));let p=d.step.map(s.slice(i)),m;p&&o.maybeStep(p).doc&&(m=o.mapping.maps[o.mapping.maps.length-1],c.push(new Kr(m,void 0,void 0,c.length+u.length))),i--,m&&s.appendMap(m,i)}else o.maybeStep(d.step);if(d.selection)return a=s?d.selection.map(s.slice(i)):d.selection,l=new Dr(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,n,r,s){let i=[],o=this.eventCount,a=this.items,l=!s&&a.length?a.get(a.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),h=new Kr(e.mapping.maps[u],d,n),p;(p=l&&l.merge(h))&&(h=p,u?i.pop():a=a.slice(0,a.length-1)),i.push(h),n&&(o++,n=void 0),s||(l=h)}let c=o-r.depth;return c>BH&&(a=FH(a,c),o-=c),new Dr(a.append(i),o)}remapping(e,n){let r=new Jl;return this.items.forEach((s,i)=>{let o=s.mirrorOffset!=null&&i-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new Dr(this.items.append(e.map(n=>new Kr(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-n),i=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},s);let l=n;this.items.forEach(h=>{let p=i.getMirror(--l);if(p==null)return;o=Math.min(o,p);let m=i.maps[p];if(h.step){let g=e.steps[p].invert(e.docs[p]),b=h.selection&&h.selection.map(i.slice(l+1,p));b&&a++,r.push(new Kr(m,g,b))}else r.push(new Kr(m))},s);let c=[];for(let h=n;h<o;h++)c.push(new Kr(i.maps[h]));let u=this.items.slice(0,s).append(c).append(r),d=new Dr(u,a);return d.emptyItemCount()>zH&&(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,s=[],i=0;return this.items.forEach((o,a)=>{if(a>=e)s.push(o),o.selection&&i++;else if(o.step){let l=o.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let u=o.selection&&o.selection.map(n.slice(r));u&&i++;let d=new Kr(c.invert(),l,u),h,p=s.length-1;(h=s.length&&s[p].merge(d))?s[p]=h:s.push(d)}}else o.map&&r--},this.items.length,0),new Dr(un.from(s.reverse()),i)}}Dr.empty=new Dr(un.empty,0);function FH(t,e){let n;return t.forEach((r,s)=>{if(r.selection&&e--==0)return n=s,!1}),t.slice(n)}class Kr{constructor(e,n,r,s){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Kr(n.getMap().invert(),n,this.selection)}}}class Ks{constructor(e,n,r,s,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=s,this.prevComposition=i}}const BH=20;function $H(t,e,n,r){let s=n.getMeta(fo),i;if(s)return s.historyState;n.getMeta(VH)&&(t=new Ks(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(fo))return o.getMeta(fo).redo?new Ks(t.done.addTransform(n,void 0,r,Uu(e)),t.undone,dw(n.mapping.maps),t.prevTime,t.prevComposition):new Ks(t.done,t.undone.addTransform(n,void 0,r,Uu(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!o&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!HH(n,t.prevRanges)),c=o?lp(t.prevRanges,n.mapping):dw(n.mapping.maps);return new Ks(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,Uu(e)),Dr.empty,c,n.time,a??t.prevComposition)}else return(i=n.getMeta("rebased"))?new Ks(t.done.rebased(n,i),t.undone.rebased(n,i),lp(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Ks(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),lp(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function HH(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,s)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&s>=e[i]&&(n=!0)}),n}function dw(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,s,i,o)=>e.push(i,o));return e}function lp(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let s=e.map(t[r],1),i=e.map(t[r+1],-1);s<=i&&n.push(s,i)}return n}function UH(t,e,n){let r=Uu(e),s=fo.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,r);if(!i)return null;let o=i.selection.resolve(i.transform.doc),a=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),s,r),l=new Ks(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(o).setMeta(fo,{redo:n,historyState:l})}let cp=!1,fw=null;function Uu(t){let e=t.plugins;if(fw!=e){cp=!1,fw=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){cp=!0;break}}return cp}const fo=new Ut("history"),VH=new Ut("closeHistory");function WH(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Rt({key:fo,state:{init(){return new Ks(Dr.empty,Dr.empty,null,0,-1)},apply(e,n,r){return $H(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,s=r=="historyUndo"?a_:r=="historyRedo"?l_:null;return!s||!e.editable?!1:(n.preventDefault(),s(e.state,e.dispatch))}}}})}function o_(t,e){return(n,r)=>{let s=fo.getState(n);if(!s||(t?s.undone:s.done).eventCount==0)return!1;if(r){let i=UH(s,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}const a_=o_(!1,!0),l_=o_(!0,!0);Dt.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;if(((t==null?void 0:t.mode)||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new Rt({key:new Ut("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const s=this.options.limit;if(s==null||s===0){t=!0;return}const i=this.storage.characters({node:r.doc});if(i>s){const o=i-s,a=0,l=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const c=r.tr.deleteRange(a,l);return t=!0,c}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const s=this.storage.characters({node:n.doc}),i=this.storage.characters({node:e.doc});if(i<=r||s>r&&i>r&&i<=s)return!0;if(s>r&&i>r&&i>s||!e.getMeta("paste"))return!1;const a=e.selection.$head.pos,l=i-r,c=a-l,u=a;return e.deleteRange(c,u),!(this.storage.characters({node:e.doc})>r)}})]}});var qH=Dt.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[TH(this.options)]}});Dt.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Rt({key:new Ut("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:s}=e,i=[];if(!n||!r)return yt.create(t,[]);let o=0;this.options.mode==="deepest"&&t.descendants((l,c)=>{if(l.isText)return;if(!(s>=c&&s<=c+l.nodeSize-1))return!1;o+=1});let a=0;return t.descendants((l,c)=>{if(l.isText||!(s>=c&&s<=c+l.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&o-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";i.push(tn.node(c,c+l.nodeSize,{class:this.options.className}))}),yt.create(t,i)}}})]}});var KH=Dt.create({name:"gapCursor",addProseMirrorPlugins(){return[OH()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=at(Ne(t,"allowGapCursor",n)))!=null?e:null}}}),GH=Dt.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Rt({key:new Ut("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,s=[];if(!n)return null;const i=this.editor.isEmpty;return t.descendants((o,a)=>{const l=r>=a&&r<=a+o.nodeSize,c=!o.isLeaf&&Qf(o);if((l||!this.options.showOnlyCurrent)&&c){const u=[this.options.emptyNodeClass];i&&u.push(this.options.emptyEditorClass);const d=tn.node(a,a+o.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:o,pos:a,hasAnchor:l}):this.options.placeholder});s.push(d)}return this.options.includeChildren}),yt.create(t,s)}}})]}});Dt.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new Rt({key:new Ut("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||b1(n.selection)||t.view.dragging?null:yt.create(n.doc,[tn.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function hw({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||(e==null?void 0:e.type)===t}var JH=Dt.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new Ut(this.name),n=((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||this.options.node||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(n).includes(s.name));return[new Rt({key:e,appendTransaction:(s,i,o)=>{const{doc:a,tr:l,schema:c}=o,u=e.getState(o),d=a.content.size,h=c.nodes[n];if(u)return l.insert(d,h.create())},state:{init:(s,i)=>{const o=i.tr.doc.lastChild;return!hw({node:o,types:r})},apply:(s,i)=>{if(!s.docChanged||s.getMeta("__uniqueIDTransaction"))return i;const o=s.doc.lastChild;return!hw({node:o,types:r})}}})]}}),YH=Dt.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>a_(t,e),redo:()=>({state:t,dispatch:e})=>l_(t,e)}},addProseMirrorPlugins(){return[WH(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),ZH=Dt.create({name:"starterKit",addExtensions(){var t,e,n,r;const s=[];return this.options.bold!==!1&&s.push(k3.configure(this.options.bold)),this.options.blockquote!==!1&&s.push(b3.configure(this.options.blockquote)),this.options.bulletList!==!1&&s.push(G1.configure(this.options.bulletList)),this.options.code!==!1&&s.push(C3.configure(this.options.code)),this.options.codeBlock!==!1&&s.push(z1.configure(this.options.codeBlock)),this.options.document!==!1&&s.push(A3.configure(this.options.document)),this.options.dropcursor!==!1&&s.push(qH.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&s.push(KH.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&s.push(M3.configure(this.options.hardBreak)),this.options.heading!==!1&&s.push(R3.configure(this.options.heading)),this.options.undoRedo!==!1&&s.push(YH.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&s.push(O3.configure(this.options.horizontalRule)),this.options.italic!==!1&&s.push(j3.configure(this.options.italic)),this.options.listItem!==!1&&s.push(J1.configure(this.options.listItem)),this.options.listKeymap!==!1&&s.push(t_.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&s.push(lH.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&s.push(r_.configure(this.options.orderedList)),this.options.paragraph!==!1&&s.push(kH.configure(this.options.paragraph)),this.options.strike!==!1&&s.push(CH.configure(this.options.strike)),this.options.text!==!1&&s.push(NH.configure(this.options.text)),this.options.underline!==!1&&s.push(_H.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&s.push(JH.configure((r=this.options)==null?void 0:r.trailingNode)),s}}),XH=ZH,up,pw;function QH(){if(pw)return up;pw=1;function t(M){return M instanceof Map?M.clear=M.delete=M.set=function(){throw new Error("map is read-only")}:M instanceof Set&&(M.add=M.clear=M.delete=function(){throw new Error("set is read-only")}),Object.freeze(M),Object.getOwnPropertyNames(M).forEach(U=>{const Q=M[U],we=typeof Q;(we==="object"||we==="function")&&!Object.isFrozen(Q)&&t(Q)}),M}class e{constructor(U){U.data===void 0&&(U.data={}),this.data=U.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function n(M){return M.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function r(M,...U){const Q=Object.create(null);for(const we in M)Q[we]=M[we];return U.forEach(function(we){for(const it in we)Q[it]=we[it]}),Q}const s="</span>",i=M=>!!M.scope,o=(M,{prefix:U})=>{if(M.startsWith("language:"))return M.replace("language:","language-");if(M.includes(".")){const Q=M.split(".");return[`${U}${Q.shift()}`,...Q.map((we,it)=>`${we}${"_".repeat(it+1)}`)].join(" ")}return`${U}${M}`};class a{constructor(U,Q){this.buffer="",this.classPrefix=Q.classPrefix,U.walk(this)}addText(U){this.buffer+=n(U)}openNode(U){if(!i(U))return;const Q=o(U.scope,{prefix:this.classPrefix});this.span(Q)}closeNode(U){i(U)&&(this.buffer+=s)}value(){return this.buffer}span(U){this.buffer+=`<span class="${U}">`}}const l=(M={})=>{const U={children:[]};return Object.assign(U,M),U};class c{constructor(){this.rootNode=l(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(U){this.top.children.push(U)}openNode(U){const Q=l({scope:U});this.add(Q),this.stack.push(Q)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(U){return this.constructor._walk(U,this.rootNode)}static _walk(U,Q){return typeof Q=="string"?U.addText(Q):Q.children&&(U.openNode(Q),Q.children.forEach(we=>this._walk(U,we)),U.closeNode(Q)),U}static _collapse(U){typeof U!="string"&&U.children&&(U.children.every(Q=>typeof Q=="string")?U.children=[U.children.join("")]:U.children.forEach(Q=>{c._collapse(Q)}))}}class u extends c{constructor(U){super(),this.options=U}addText(U){U!==""&&this.add(U)}startScope(U){this.openNode(U)}endScope(){this.closeNode()}__addSublanguage(U,Q){const we=U.root;Q&&(we.scope=`language:${Q}`),this.add(we)}toHTML(){return new a(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function d(M){return M?typeof M=="string"?M:M.source:null}function h(M){return g("(?=",M,")")}function p(M){return g("(?:",M,")*")}function m(M){return g("(?:",M,")?")}function g(...M){return M.map(Q=>d(Q)).join("")}function b(M){const U=M[M.length-1];return typeof U=="object"&&U.constructor===Object?(M.splice(M.length-1,1),U):{}}function x(...M){return"("+(b(M).capture?"":"?:")+M.map(we=>d(we)).join("|")+")"}function w(M){return new RegExp(M.toString()+"|").exec("").length-1}function v(M,U){const Q=M&&M.exec(U);return Q&&Q.index===0}const k=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function N(M,{joinWith:U}){let Q=0;return M.map(we=>{Q+=1;const it=Q;let pt=d(we),oe="";for(;pt.length>0;){const de=k.exec(pt);if(!de){oe+=pt;break}oe+=pt.substring(0,de.index),pt=pt.substring(de.index+de[0].length),de[0][0]==="\\"&&de[1]?oe+="\\"+String(Number(de[1])+it):(oe+=de[0],de[0]==="("&&Q++)}return oe}).map(we=>`(${we})`).join(U)}const S=/\b\B/,C="[a-zA-Z]\\w*",T="[a-zA-Z_]\\w*",R="\\b\\d+(\\.\\d+)?",_="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",I="\\b(0b[01]+)",D="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",V=(M={})=>{const U=/^#![ ]*\//;return M.binary&&(M.begin=g(U,/.*\b/,M.binary,/\b.*/)),r({scope:"meta",begin:U,end:/$/,relevance:0,"on:begin":(Q,we)=>{Q.index!==0&&we.ignoreMatch()}},M)},j={begin:"\\\\[\\s\\S]",relevance:0},L={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[j]},q={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[j]},re={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},X=function(M,U,Q={}){const we=r({scope:"comment",begin:M,end:U,contains:[]},Q);we.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const it=x("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return we.contains.push({begin:g(/[ ]+/,"(",it,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),we},ce=X("//","$"),A=X("/\\*","\\*/"),ue=X("#","$"),be={scope:"number",begin:R,relevance:0},E={scope:"number",begin:_,relevance:0},P={scope:"number",begin:I,relevance:0},z={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[j,{begin:/\[/,end:/\]/,relevance:0,contains:[j]}]},H={scope:"title",begin:C,relevance:0},B={scope:"title",begin:T,relevance:0},J={begin:"\\.\\s*"+T,relevance:0};var Y=Object.freeze({__proto__:null,APOS_STRING_MODE:L,BACKSLASH_ESCAPE:j,BINARY_NUMBER_MODE:P,BINARY_NUMBER_RE:I,COMMENT:X,C_BLOCK_COMMENT_MODE:A,C_LINE_COMMENT_MODE:ce,C_NUMBER_MODE:E,C_NUMBER_RE:_,END_SAME_AS_BEGIN:function(M){return Object.assign(M,{"on:begin":(U,Q)=>{Q.data._beginMatch=U[1]},"on:end":(U,Q)=>{Q.data._beginMatch!==U[1]&&Q.ignoreMatch()}})},HASH_COMMENT_MODE:ue,IDENT_RE:C,MATCH_NOTHING_RE:S,METHOD_GUARD:J,NUMBER_MODE:be,NUMBER_RE:R,PHRASAL_WORDS_MODE:re,QUOTE_STRING_MODE:q,REGEXP_MODE:z,RE_STARTERS_RE:D,SHEBANG:V,TITLE_MODE:H,UNDERSCORE_IDENT_RE:T,UNDERSCORE_TITLE_MODE:B});function le(M,U){M.input[M.index-1]==="."&&U.ignoreMatch()}function ye(M,U){M.className!==void 0&&(M.scope=M.className,delete M.className)}function Re(M,U){U&&M.beginKeywords&&(M.begin="\\b("+M.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",M.__beforeBegin=le,M.keywords=M.keywords||M.beginKeywords,delete M.beginKeywords,M.relevance===void 0&&(M.relevance=0))}function Oe(M,U){Array.isArray(M.illegal)&&(M.illegal=x(...M.illegal))}function ht(M,U){if(M.match){if(M.begin||M.end)throw new Error("begin & end are not supported with match");M.begin=M.match,delete M.match}}function De(M,U){M.relevance===void 0&&(M.relevance=1)}const _t=(M,U)=>{if(!M.beforeMatch)return;if(M.starts)throw new Error("beforeMatch cannot be used with starts");const Q=Object.assign({},M);Object.keys(M).forEach(we=>{delete M[we]}),M.keywords=Q.keywords,M.begin=g(Q.beforeMatch,h(Q.begin)),M.starts={relevance:0,contains:[Object.assign(Q,{endsParent:!0})]},M.relevance=0,delete Q.beforeMatch},ot=["of","and","for","in","not","or","if","then","parent","list","value"],dn="keyword";function qt(M,U,Q=dn){const we=Object.create(null);return typeof M=="string"?it(Q,M.split(" ")):Array.isArray(M)?it(Q,M):Object.keys(M).forEach(function(pt){Object.assign(we,qt(M[pt],U,pt))}),we;function it(pt,oe){U&&(oe=oe.map(de=>de.toLowerCase())),oe.forEach(function(de){const ke=de.split("|");we[ke[0]]=[pt,me(ke[0],ke[1])]})}}function me(M,U){return U?Number(U):ze(M)?0:1}function ze(M){return ot.includes(M.toLowerCase())}const Vt={},Z=M=>{console.error(M)},ct=(M,...U)=>{console.log(`WARN: ${M}`,...U)},F=(M,U)=>{Vt[`${M}/${U}`]||(console.log(`Deprecated as of ${M}. ${U}`),Vt[`${M}/${U}`]=!0)},W=new Error;function ge(M,U,{key:Q}){let we=0;const it=M[Q],pt={},oe={};for(let de=1;de<=U.length;de++)oe[de+we]=it[de],pt[de+we]=!0,we+=w(U[de-1]);M[Q]=oe,M[Q]._emit=pt,M[Q]._multi=!0}function Be(M){if(Array.isArray(M.begin)){if(M.skip||M.excludeBegin||M.returnBegin)throw Z("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),W;if(typeof M.beginScope!="object"||M.beginScope===null)throw Z("beginScope must be object"),W;ge(M,M.begin,{key:"beginScope"}),M.begin=N(M.begin,{joinWith:""})}}function tt(M){if(Array.isArray(M.end)){if(M.skip||M.excludeEnd||M.returnEnd)throw Z("skip, excludeEnd, returnEnd not compatible with endScope: {}"),W;if(typeof M.endScope!="object"||M.endScope===null)throw Z("endScope must be object"),W;ge(M,M.end,{key:"endScope"}),M.end=N(M.end,{joinWith:""})}}function Ot(M){M.scope&&typeof M.scope=="object"&&M.scope!==null&&(M.beginScope=M.scope,delete M.scope)}function Vn(M){Ot(M),typeof M.beginScope=="string"&&(M.beginScope={_wrap:M.beginScope}),typeof M.endScope=="string"&&(M.endScope={_wrap:M.endScope}),Be(M),tt(M)}function On(M){function U(oe,de){return new RegExp(d(oe),"m"+(M.case_insensitive?"i":"")+(M.unicodeRegex?"u":"")+(de?"g":""))}class Q{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(de,ke){ke.position=this.position++,this.matchIndexes[this.matchAt]=ke,this.regexes.push([ke,de]),this.matchAt+=w(de)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const de=this.regexes.map(ke=>ke[1]);this.matcherRe=U(N(de,{joinWith:"|"}),!0),this.lastIndex=0}exec(de){this.matcherRe.lastIndex=this.lastIndex;const ke=this.matcherRe.exec(de);if(!ke)return null;const mt=ke.findIndex((Ar,hr)=>hr>0&&Ar!==void 0),wt=this.matchIndexes[mt];return ke.splice(0,mt),Object.assign(ke,wt)}}class we{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(de){if(this.multiRegexes[de])return this.multiRegexes[de];const ke=new Q;return this.rules.slice(de).forEach(([mt,wt])=>ke.addRule(mt,wt)),ke.compile(),this.multiRegexes[de]=ke,ke}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(de,ke){this.rules.push([de,ke]),ke.type==="begin"&&this.count++}exec(de){const ke=this.getMatcher(this.regexIndex);ke.lastIndex=this.lastIndex;let mt=ke.exec(de);if(this.resumingScanAtSamePosition()&&!(mt&&mt.index===this.lastIndex)){const wt=this.getMatcher(0);wt.lastIndex=this.lastIndex+1,mt=wt.exec(de)}return mt&&(this.regexIndex+=mt.position+1,this.regexIndex===this.count&&this.considerAll()),mt}}function it(oe){const de=new we;return oe.contains.forEach(ke=>de.addRule(ke.begin,{rule:ke,type:"begin"})),oe.terminatorEnd&&de.addRule(oe.terminatorEnd,{type:"end"}),oe.illegal&&de.addRule(oe.illegal,{type:"illegal"}),de}function pt(oe,de){const ke=oe;if(oe.isCompiled)return ke;[ye,ht,Vn,_t].forEach(wt=>wt(oe,de)),M.compilerExtensions.forEach(wt=>wt(oe,de)),oe.__beforeBegin=null,[Re,Oe,De].forEach(wt=>wt(oe,de)),oe.isCompiled=!0;let mt=null;return typeof oe.keywords=="object"&&oe.keywords.$pattern&&(oe.keywords=Object.assign({},oe.keywords),mt=oe.keywords.$pattern,delete oe.keywords.$pattern),mt=mt||/\w+/,oe.keywords&&(oe.keywords=qt(oe.keywords,M.case_insensitive)),ke.keywordPatternRe=U(mt,!0),de&&(oe.begin||(oe.begin=/\B|\b/),ke.beginRe=U(ke.begin),!oe.end&&!oe.endsWithParent&&(oe.end=/\B|\b/),oe.end&&(ke.endRe=U(ke.end)),ke.terminatorEnd=d(ke.end)||"",oe.endsWithParent&&de.terminatorEnd&&(ke.terminatorEnd+=(oe.end?"|":"")+de.terminatorEnd)),oe.illegal&&(ke.illegalRe=U(oe.illegal)),oe.contains||(oe.contains=[]),oe.contains=[].concat(...oe.contains.map(function(wt){return nr(wt==="self"?oe:wt)})),oe.contains.forEach(function(wt){pt(wt,ke)}),oe.starts&&pt(oe.starts,de),ke.matcher=it(ke),ke}if(M.compilerExtensions||(M.compilerExtensions=[]),M.contains&&M.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return M.classNameAliases=r(M.classNameAliases||{}),pt(M)}function dr(M){return M?M.endsWithParent||dr(M.starts):!1}function nr(M){return M.variants&&!M.cachedVariants&&(M.cachedVariants=M.variants.map(function(U){return r(M,{variants:null},U)})),M.cachedVariants?M.cachedVariants:dr(M)?r(M,{starts:M.starts?r(M.starts):null}):Object.isFrozen(M)?r(M):M}var Kt="11.11.1";class fr extends Error{constructor(U,Q){super(U),this.name="HTMLInjectionError",this.html=Q}}const sn=n,zo=r,Fo=Symbol("nomatch"),el=7,Wt=function(M){const U=Object.create(null),Q=Object.create(null),we=[];let it=!0;const pt="Could not find the language '{}', did you forget to load/include a language module?",oe={disableAutodetect:!0,name:"Plain text",contains:[]};let de={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:u};function ke(se){return de.noHighlightRe.test(se)}function mt(se){let Ae=se.className+" ";Ae+=se.parentNode?se.parentNode.className:"";const Xe=de.languageDetectRe.exec(Ae);if(Xe){const kt=Ps(Xe[1]);return kt||(ct(pt.replace("{}",Xe[1])),ct("Falling back to no-highlight mode for this block.",se)),kt?Xe[1]:"no-highlight"}return Ae.split(/\s+/).find(kt=>ke(kt)||Ps(kt))}function wt(se,Ae,Xe){let kt="",Xt="";typeof Ae=="object"?(kt=se,Xe=Ae.ignoreIllegals,Xt=Ae.language):(F("10.7.0","highlight(lang, code, ...args) has been deprecated."),F("10.7.0",`Please use highlight(code, options) instead.
461
- https://github.com/highlightjs/highlight.js/issues/2277`),Xt=se,kt=Ae),Xe===void 0&&(Xe=!0);const Mr={code:kt,language:Xt};Zc("before:highlight",Mr);const js=Mr.result?Mr.result:Ar(Mr.language,Mr.code,Xe);return js.code=Mr.code,Zc("after:highlight",js),js}function Ar(se,Ae,Xe,kt){const Xt=Object.create(null);function Mr(fe,Se){return fe.keywords[Se]}function js(){if(!$e.keywords){fn.addText(St);return}let fe=0;$e.keywordPatternRe.lastIndex=0;let Se=$e.keywordPatternRe.exec(St),Je="";for(;Se;){Je+=St.substring(fe,Se.index);const ut=Hr.case_insensitive?Se[0].toLowerCase():Se[0],xn=Mr($e,ut);if(xn){const[as,nM]=xn;if(fn.addText(Je),Je="",Xt[ut]=(Xt[ut]||0)+1,Xt[ut]<=el&&(eu+=nM),as.startsWith("_"))Je+=Se[0];else{const rM=Hr.classNameAliases[as]||as;$r(Se[0],rM)}}else Je+=Se[0];fe=$e.keywordPatternRe.lastIndex,Se=$e.keywordPatternRe.exec(St)}Je+=St.substring(fe),fn.addText(Je)}function Xc(){if(St==="")return;let fe=null;if(typeof $e.subLanguage=="string"){if(!U[$e.subLanguage]){fn.addText(St);return}fe=Ar($e.subLanguage,St,!0,By[$e.subLanguage]),By[$e.subLanguage]=fe._top}else fe=is(St,$e.subLanguage.length?$e.subLanguage:null);$e.relevance>0&&(eu+=fe.relevance),fn.__addSublanguage(fe._emitter,fe.language)}function rr(){$e.subLanguage!=null?Xc():js(),St=""}function $r(fe,Se){fe!==""&&(fn.startScope(Se),fn.addText(fe),fn.endScope())}function Py(fe,Se){let Je=1;const ut=Se.length-1;for(;Je<=ut;){if(!fe._emit[Je]){Je++;continue}const xn=Hr.classNameAliases[fe[Je]]||fe[Je],as=Se[Je];xn?$r(as,xn):(St=as,js(),St=""),Je++}}function jy(fe,Se){return fe.scope&&typeof fe.scope=="string"&&fn.openNode(Hr.classNameAliases[fe.scope]||fe.scope),fe.beginScope&&(fe.beginScope._wrap?($r(St,Hr.classNameAliases[fe.beginScope._wrap]||fe.beginScope._wrap),St=""):fe.beginScope._multi&&(Py(fe.beginScope,Se),St="")),$e=Object.create(fe,{parent:{value:$e}}),$e}function zy(fe,Se,Je){let ut=v(fe.endRe,Je);if(ut){if(fe["on:end"]){const xn=new e(fe);fe["on:end"](Se,xn),xn.isMatchIgnored&&(ut=!1)}if(ut){for(;fe.endsParent&&fe.parent;)fe=fe.parent;return fe}}if(fe.endsWithParent)return zy(fe.parent,Se,Je)}function ZA(fe){return $e.matcher.regexIndex===0?(St+=fe[0],1):(vh=!0,0)}function XA(fe){const Se=fe[0],Je=fe.rule,ut=new e(Je),xn=[Je.__beforeBegin,Je["on:begin"]];for(const as of xn)if(as&&(as(fe,ut),ut.isMatchIgnored))return ZA(Se);return Je.skip?St+=Se:(Je.excludeBegin&&(St+=Se),rr(),!Je.returnBegin&&!Je.excludeBegin&&(St=Se)),jy(Je,fe),Je.returnBegin?0:Se.length}function QA(fe){const Se=fe[0],Je=Ae.substring(fe.index),ut=zy($e,fe,Je);if(!ut)return Fo;const xn=$e;$e.endScope&&$e.endScope._wrap?(rr(),$r(Se,$e.endScope._wrap)):$e.endScope&&$e.endScope._multi?(rr(),Py($e.endScope,fe)):xn.skip?St+=Se:(xn.returnEnd||xn.excludeEnd||(St+=Se),rr(),xn.excludeEnd&&(St=Se));do $e.scope&&fn.closeNode(),!$e.skip&&!$e.subLanguage&&(eu+=$e.relevance),$e=$e.parent;while($e!==ut.parent);return ut.starts&&jy(ut.starts,fe),xn.returnEnd?0:Se.length}function eM(){const fe=[];for(let Se=$e;Se!==Hr;Se=Se.parent)Se.scope&&fe.unshift(Se.scope);fe.forEach(Se=>fn.openNode(Se))}let Qc={};function Fy(fe,Se){const Je=Se&&Se[0];if(St+=fe,Je==null)return rr(),0;if(Qc.type==="begin"&&Se.type==="end"&&Qc.index===Se.index&&Je===""){if(St+=Ae.slice(Se.index,Se.index+1),!it){const ut=new Error(`0 width match regex (${se})`);throw ut.languageName=se,ut.badRule=Qc.rule,ut}return 1}if(Qc=Se,Se.type==="begin")return XA(Se);if(Se.type==="illegal"&&!Xe){const ut=new Error('Illegal lexeme "'+Je+'" for mode "'+($e.scope||"<unnamed>")+'"');throw ut.mode=$e,ut}else if(Se.type==="end"){const ut=QA(Se);if(ut!==Fo)return ut}if(Se.type==="illegal"&&Je==="")return St+=`
462
- `,1;if(xh>1e5&&xh>Se.index*3)throw new Error("potential infinite loop, way more iterations than matches");return St+=Je,Je.length}const Hr=Ps(se);if(!Hr)throw Z(pt.replace("{}",se)),new Error('Unknown language: "'+se+'"');const tM=On(Hr);let yh="",$e=kt||tM;const By={},fn=new de.__emitter(de);eM();let St="",eu=0,ji=0,xh=0,vh=!1;try{if(Hr.__emitTokens)Hr.__emitTokens(Ae,fn);else{for($e.matcher.considerAll();;){xh++,vh?vh=!1:$e.matcher.considerAll(),$e.matcher.lastIndex=ji;const fe=$e.matcher.exec(Ae);if(!fe)break;const Se=Ae.substring(ji,fe.index),Je=Fy(Se,fe);ji=fe.index+Je}Fy(Ae.substring(ji))}return fn.finalize(),yh=fn.toHTML(),{language:se,value:yh,relevance:eu,illegal:!1,_emitter:fn,_top:$e}}catch(fe){if(fe.message&&fe.message.includes("Illegal"))return{language:se,value:sn(Ae),illegal:!0,relevance:0,_illegalBy:{message:fe.message,index:ji,context:Ae.slice(ji-100,ji+100),mode:fe.mode,resultSoFar:yh},_emitter:fn};if(it)return{language:se,value:sn(Ae),illegal:!1,relevance:0,errorRaised:fe,_emitter:fn,_top:$e};throw fe}}function hr(se){const Ae={value:sn(se),illegal:!1,relevance:0,_top:oe,_emitter:new de.__emitter(de)};return Ae._emitter.addText(se),Ae}function is(se,Ae){Ae=Ae||de.languages||Object.keys(U);const Xe=hr(se),kt=Ae.filter(Ps).filter(Ly).map(rr=>Ar(rr,se,!1));kt.unshift(Xe);const Xt=kt.sort((rr,$r)=>{if(rr.relevance!==$r.relevance)return $r.relevance-rr.relevance;if(rr.language&&$r.language){if(Ps(rr.language).supersetOf===$r.language)return 1;if(Ps($r.language).supersetOf===rr.language)return-1}return 0}),[Mr,js]=Xt,Xc=Mr;return Xc.secondBest=js,Xc}function tl(se,Ae,Xe){const kt=Ae&&Q[Ae]||Xe;se.classList.add("hljs"),se.classList.add(`language-${kt}`)}function bh(se){let Ae=null;const Xe=mt(se);if(ke(Xe))return;if(Zc("before:highlightElement",{el:se,language:Xe}),se.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",se);return}if(se.children.length>0&&(de.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(se)),de.throwUnescapedHTML))throw new fr("One of your code blocks includes unescaped HTML.",se.innerHTML);Ae=se;const kt=Ae.textContent,Xt=Xe?wt(kt,{language:Xe,ignoreIllegals:!0}):is(kt);se.innerHTML=Xt.value,se.dataset.highlighted="yes",tl(se,Xe,Xt.language),se.result={language:Xt.language,re:Xt.relevance,relevance:Xt.relevance},Xt.secondBest&&(se.secondBest={language:Xt.secondBest.language,relevance:Xt.secondBest.relevance}),Zc("after:highlightElement",{el:se,result:Xt,text:kt})}function $A(se){de=zo(de,se)}const HA=()=>{Yc(),F("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function UA(){Yc(),F("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Iy=!1;function Yc(){function se(){Yc()}if(document.readyState==="loading"){Iy||window.addEventListener("DOMContentLoaded",se,!1),Iy=!0;return}document.querySelectorAll(de.cssSelector).forEach(bh)}function VA(se,Ae){let Xe=null;try{Xe=Ae(M)}catch(kt){if(Z("Language definition for '{}' could not be registered.".replace("{}",se)),it)Z(kt);else throw kt;Xe=oe}Xe.name||(Xe.name=se),U[se]=Xe,Xe.rawDefinition=Ae.bind(null,M),Xe.aliases&&Dy(Xe.aliases,{languageName:se})}function WA(se){delete U[se];for(const Ae of Object.keys(Q))Q[Ae]===se&&delete Q[Ae]}function qA(){return Object.keys(U)}function Ps(se){return se=(se||"").toLowerCase(),U[se]||U[Q[se]]}function Dy(se,{languageName:Ae}){typeof se=="string"&&(se=[se]),se.forEach(Xe=>{Q[Xe.toLowerCase()]=Ae})}function Ly(se){const Ae=Ps(se);return Ae&&!Ae.disableAutodetect}function KA(se){se["before:highlightBlock"]&&!se["before:highlightElement"]&&(se["before:highlightElement"]=Ae=>{se["before:highlightBlock"](Object.assign({block:Ae.el},Ae))}),se["after:highlightBlock"]&&!se["after:highlightElement"]&&(se["after:highlightElement"]=Ae=>{se["after:highlightBlock"](Object.assign({block:Ae.el},Ae))})}function GA(se){KA(se),we.push(se)}function JA(se){const Ae=we.indexOf(se);Ae!==-1&&we.splice(Ae,1)}function Zc(se,Ae){const Xe=se;we.forEach(function(kt){kt[Xe]&&kt[Xe](Ae)})}function YA(se){return F("10.7.0","highlightBlock will be removed entirely in v12.0"),F("10.7.0","Please use highlightElement now."),bh(se)}Object.assign(M,{highlight:wt,highlightAuto:is,highlightAll:Yc,highlightElement:bh,highlightBlock:YA,configure:$A,initHighlighting:HA,initHighlightingOnLoad:UA,registerLanguage:VA,unregisterLanguage:WA,listLanguages:qA,getLanguage:Ps,registerAliases:Dy,autoDetection:Ly,inherit:zo,addPlugin:GA,removePlugin:JA}),M.debugMode=function(){it=!1},M.safeMode=function(){it=!0},M.versionString=Kt,M.regex={concat:g,lookahead:h,either:x,optional:m,anyNumberOfTimes:p};for(const se in Y)typeof Y[se]=="object"&&t(Y[se]);return Object.assign(M,Y),M},Pt=Wt({});return Pt.newInstance=()=>Wt({}),up=Pt,Pt.HighlightJS=Pt,Pt.default=Pt,up}var eU=QH();const c_=xc(eU);function u_(t,e=[]){return t.flatMap(n=>{const r=[...e,...n.properties?n.properties.className:[]];return n.children?u_(n.children,r):{text:n.value,classes:r}})}function mw(t){return t.value||t.children||[]}function tU(t){return!!c_.getLanguage(t)}function gw({doc:t,name:e,lowlight:n,defaultLanguage:r}){const s=[];return Pm(t,i=>i.type.name===e).forEach(i=>{var o;let a=i.pos+1;const l=i.node.attrs.language||r,c=n.listLanguages(),u=l&&(c.includes(l)||tU(l)||(o=n.registered)!=null&&o.call(n,l))?mw(n.highlight(l,i.node.textContent)):mw(n.highlightAuto(i.node.textContent));u_(u).forEach(d=>{const h=a+d.text.length;if(d.classes.length){const p=tn.inline(a,h,{class:d.classes.join(" ")});s.push(p)}a=h})}),yt.create(t,s)}function nU(t){return typeof t=="function"}function rU({name:t,lowlight:e,defaultLanguage:n}){if(!["highlight","highlightAuto","listLanguages"].every(s=>nU(e[s])))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");const r=new Rt({key:new Ut("lowlight"),state:{init:(s,{doc:i})=>gw({doc:i,name:t,lowlight:e,defaultLanguage:n}),apply:(s,i,o,a)=>{const l=o.selection.$head.parent.type.name,c=a.selection.$head.parent.type.name,u=Pm(o.doc,h=>h.type.name===t),d=Pm(a.doc,h=>h.type.name===t);return s.docChanged&&([l,c].includes(t)||d.length!==u.length||s.steps.some(h=>h.from!==void 0&&h.to!==void 0&&u.some(p=>p.pos>=h.from&&p.pos+p.node.nodeSize<=h.to)))?gw({doc:s.doc,name:t,lowlight:e,defaultLanguage:n}):i.map(s.mapping,s.doc)}},props:{decorations(s){return r.getState(s)}}});return r}var sU=T3.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),lowlight:{},languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}},addProseMirrorPlugins(){var t;return[...((t=this.parent)==null?void 0:t.call(this))||[],rU({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}}),iU=sU,oU=GH;function aU(t){const e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",s="[a-zA-Z_]\\w*::",o="(?!struct)("+r+"|"+e.optional(s)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",a={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},u={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},d={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(c,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:e.optional(s)+t.IDENT_RE,relevance:0},p=e.optional(s)+t.IDENT_RE+"\\s*\\(",m=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],g=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],b=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],x=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],k={type:g,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:b},N={className:"function.dispatch",relevance:0,keywords:{_hint:x},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},S=[N,d,a,n,t.C_BLOCK_COMMENT_MODE,u,c],C={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:k,contains:S.concat([{begin:/\(/,end:/\)/,keywords:k,contains:S.concat(["self"]),relevance:0}]),relevance:0},T={className:"function",begin:"("+o+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:k,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:k,relevance:0},{begin:p,returnBegin:!0,contains:[h],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[c,u]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:k,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,c,u,a,{begin:/\(/,end:/\)/,keywords:k,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,c,u,a]}]},a,n,t.C_BLOCK_COMMENT_MODE,d]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:k,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(C,T,N,S,[d,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:k,contains:["self",a]},{begin:t.IDENT_RE+"::",keywords:k},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function lU(t){const e={type:["boolean","byte","word","String"],built_in:["KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],_hints:["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],literal:["DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"]},n=aU(t),r=n.keywords;return r.type=[...r.type,...e.type],r.literal=[...r.literal,...e.literal],r.built_in=[...r.built_in,...e.built_in],r._hints=e._hints,n.name="Arduino",n.aliases=["ino"],n.supersetOf="cpp",n}function cU(t){const e=t.regex,n={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:e.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const s={className:"subst",begin:/\$\(/,end:/\)/,contains:[t.BACKSLASH_ESCAPE]},i=t.inherit(t.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},a={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,n,s]};s.contains.push(a);const l={match:/\\"/},c={className:"string",begin:/'/,end:/'/},u={match:/\\'/},d={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},t.NUMBER_MODE,n]},h=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],p=t.SHEBANG({binary:`(${h.join("|")})`,relevance:10}),m={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[t.inherit(t.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},g=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],b=["true","false"],x={match:/(\/[a-z._-]+)+/},w=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],v=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],k=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],N=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:g,literal:b,built_in:[...w,...v,"set","shopt",...k,...N]},contains:[p,t.SHEBANG(),m,d,i,o,x,a,l,c,u,n]}}function uU(t){const e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",s="[a-zA-Z_]\\w*::",o="("+r+"|"+e.optional(s)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",a={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},u={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},d={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(c,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:e.optional(s)+t.IDENT_RE,relevance:0},p=e.optional(s)+t.IDENT_RE+"\\s*\\(",b={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},x=[d,a,n,t.C_BLOCK_COMMENT_MODE,u,c],w={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:b,contains:x.concat([{begin:/\(/,end:/\)/,keywords:b,contains:x.concat(["self"]),relevance:0}]),relevance:0},v={begin:"("+o+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:b,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:b,relevance:0},{begin:p,returnBegin:!0,contains:[t.inherit(h,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,c,u,a,{begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,c,u,a]}]},a,n,t.C_BLOCK_COMMENT_MODE,d]};return{name:"C",aliases:["h"],keywords:b,disableAutodetect:!0,illegal:"</",contains:[].concat(w,v,x,[d,{begin:t.IDENT_RE+"::",keywords:b},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},t.TITLE_MODE]}]),exports:{preprocessor:d,strings:c,keywords:b}}}function dU(t){const e=t.regex,n=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",s="[a-zA-Z_]\\w*::",o="(?!struct)("+r+"|"+e.optional(s)+"[a-zA-Z_]\\w*"+e.optional("<[^<>]+>")+")",a={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},u={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},d={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(c,{className:"string"}),{className:"string",begin:/<.*?>/},n,t.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:e.optional(s)+t.IDENT_RE,relevance:0},p=e.optional(s)+t.IDENT_RE+"\\s*\\(",m=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],g=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],b=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],x=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],k={type:g,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:b},N={className:"function.dispatch",relevance:0,keywords:{_hint:x},begin:e.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,e.lookahead(/(<[^<>]+>|)\s*\(/))},S=[N,d,a,n,t.C_BLOCK_COMMENT_MODE,u,c],C={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:k,contains:S.concat([{begin:/\(/,end:/\)/,keywords:k,contains:S.concat(["self"]),relevance:0}]),relevance:0},T={className:"function",begin:"("+o+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:k,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:k,relevance:0},{begin:p,returnBegin:!0,contains:[h],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[c,u]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:k,relevance:0,contains:[n,t.C_BLOCK_COMMENT_MODE,c,u,a,{begin:/\(/,end:/\)/,keywords:k,relevance:0,contains:["self",n,t.C_BLOCK_COMMENT_MODE,c,u,a]}]},a,n,t.C_BLOCK_COMMENT_MODE,d]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:k,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(C,T,N,S,[d,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:k,contains:["self",a]},{begin:t.IDENT_RE+"::",keywords:k},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function fU(t){const e=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],n=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],r=["default","false","null","true"],s=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],i=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],o={keyword:s.concat(i),built_in:e,literal:r},a=t.inherit(t.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),l={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},c={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},u={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},d=t.inherit(u,{illegal:/\n/}),h={className:"subst",begin:/\{/,end:/\}/,keywords:o},p=t.inherit(h,{illegal:/\n/}),m={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},t.BACKSLASH_ESCAPE,p]},g={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},h]},b=t.inherit(g,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},p]});h.contains=[g,m,u,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,l,t.C_BLOCK_COMMENT_MODE],p.contains=[b,m,d,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,l,t.inherit(t.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const x={variants:[c,g,m,u,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},w={begin:"<",end:">",contains:[{beginKeywords:"in out"},a]},v=t.IDENT_RE+"(<"+t.IDENT_RE+"(\\s*,\\s*"+t.IDENT_RE+")*>)?(\\[\\])?",k={begin:"@"+t.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:o,illegal:/::/,contains:[t.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:"<!--|-->"},{begin:"</?",end:">"}]}]}),t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},x,l,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},a,w,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,w,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+v+"\\s+)+"+t.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:o,contains:[{beginKeywords:n.join(" "),relevance:0},{begin:t.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[t.TITLE_MODE,w],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,relevance:0,contains:[x,l,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},k]}}const hU=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),pU=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],mU=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],gU=[...pU,...mU],bU=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),yU=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),xU=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),vU=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function wU(t){const e=t.regex,n=hU(t),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},s="and or not only",i=/@-?\w[\w]*(-\w+)*/,o="[a-zA-Z-][a-zA-Z0-9_-]*",a=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+o,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+yU.join("|")+")"},{begin:":(:)?("+xU.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+vU.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...a,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...a,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:e.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:i},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:s,attribute:bU.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...a,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+gU.join("|")+")\\b"}]}}function kU(t){const e=t.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:e.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:e.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}function SU(t){const i={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:i,illegal:"</",contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{className:"string",variants:[t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[t.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:i,illegal:/["']/}]}]}}function EU(t){const e=t.regex,n=/[_A-Za-z][_0-9A-Za-z]*/;return{name:"GraphQL",aliases:["gql"],case_insensitive:!0,disableAutodetect:!1,keywords:{keyword:["query","mutation","subscription","type","input","schema","directive","interface","union","scalar","fragment","enum","on"],literal:["true","false","null"]},contains:[t.HASH_COMMENT_MODE,t.QUOTE_STRING_MODE,t.NUMBER_MODE,{scope:"punctuation",match:/[.]{3}/,relevance:0},{scope:"punctuation",begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:"variable",begin:/\$/,end:/\W/,excludeEnd:!0,relevance:0},{scope:"meta",match:/@\w+/,excludeEnd:!0},{scope:"symbol",begin:e.concat(n,e.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}}function CU(t){const e=t.regex,n={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:t.NUMBER_RE}]},r=t.COMMENT();r.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];const s={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},i={className:"literal",begin:/\bon|off|true|false|yes|no\b/},o={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},a={begin:/\[/,end:/\]/,contains:[r,i,s,o,n,"self"],relevance:0},l=/[A-Za-z0-9_-]+/,c=/"(\\"|[^"])*"/,u=/'[^']*'/,d=e.either(l,c,u),h=e.concat(d,"(\\s*\\.\\s*",d,")*",e.lookahead(/\s*=\s*[^#\s]/));return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[r,{className:"section",begin:/\[+/,end:/\]+/},{begin:h,className:"attr",starts:{end:/$/,contains:[r,a,i,s,o,n]}}]}}var Jo="[0-9](_*[0-9])*",bu=`\\.(${Jo})`,yu="[0-9a-fA-F](_*[0-9a-fA-F])*",bw={className:"number",variants:[{begin:`(\\b(${Jo})((${bu})|\\.)?|(${bu}))[eE][+-]?(${Jo})[fFdD]?\\b`},{begin:`\\b(${Jo})((${bu})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${bu})[fFdD]?\\b`},{begin:`\\b(${Jo})[fFdD]\\b`},{begin:`\\b0[xX]((${yu})\\.?|(${yu})?\\.(${yu}))[pP][+-]?(${Jo})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${yu})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function d_(t,e,n){return n===-1?"":t.replace(e,r=>d_(t,e,n-1))}function NU(t){const e=t.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=n+d_("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),l={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},c={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},u={className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[t.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:l,illegal:/<\/|#/,contains:[t.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[t.BACKSLASH_ESCAPE]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[e.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,n],className:{1:"keyword",3:"title.class"},contains:[u,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",t.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:l,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[c,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,bw,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},bw,c]}}const yw="[A-Za-z$_][0-9A-Za-z$_]*",_U=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],TU=["true","false","null","undefined","NaN","Infinity"],f_=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],h_=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],p_=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],AU=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],MU=[].concat(p_,f_,h_);function RU(t){const e=t.regex,n=(X,{after:ce})=>{const A="</"+X[0].slice(1);return X.input.indexOf(A,ce)!==-1},r=yw,s={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(X,ce)=>{const A=X[0].length+X.index,ue=X.input[A];if(ue==="<"||ue===","){ce.ignoreMatch();return}ue===">"&&(n(X,{after:A})||ce.ignoreMatch());let be;const E=X.input.substring(A);if(be=E.match(/^\s*=/)){ce.ignoreMatch();return}if((be=E.match(/^\s+extends\s+/))&&be.index===0){ce.ignoreMatch();return}}},a={$pattern:yw,keyword:_U,literal:TU,built_in:MU,"variable.language":AU},l="[0-9](_?[0-9])*",c=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={className:"number",variants:[{begin:`(\\b(${u})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${u})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,h],subLanguage:"css"}},g={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},b={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,h]},w={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},v=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,p,m,g,b,{match:/\$\d+/},d];h.contains=v.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(v)});const k=[].concat(w,h.contains),N=k.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(k)}]),S={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:N},C={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},T={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...f_,...h_]}},R={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},_={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[S],illegal:/%/},I={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function D(X){return e.concat("(?!",X.join("|"),")")}const V={match:e.concat(/\b/,D([...p_,"super","import"].map(X=>`${X}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},j={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},L={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},S]},q="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",re={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(q)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[S]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:N,CLASS_REFERENCE:T},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),R,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,p,m,g,b,w,{match:/\$\d+/},d,T,{scope:"attr",match:r+e.lookahead(":"),relevance:0},re,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[w,t.REGEXP_MODE,{className:"function",begin:q,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:N}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:i},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},_,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[S,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},j,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[S]},V,I,C,L,{match:/\$[(.]/}]}}function OU(t){const e={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],s={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[e,n,t.QUOTE_STRING_MODE,s,t.C_NUMBER_MODE,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var Yo="[0-9](_*[0-9])*",xu=`\\.(${Yo})`,vu="[0-9a-fA-F](_*[0-9a-fA-F])*",IU={className:"number",variants:[{begin:`(\\b(${Yo})((${xu})|\\.)?|(${xu}))[eE][+-]?(${Yo})[fFdD]?\\b`},{begin:`\\b(${Yo})((${xu})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${xu})[fFdD]?\\b`},{begin:`\\b(${Yo})[fFdD]\\b`},{begin:`\\b0[xX]((${vu})\\.?|(${vu})?\\.(${vu}))[pP][+-]?(${Yo})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${vu})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function DU(t){const e={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},n={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},r={className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"@"},s={className:"subst",begin:/\$\{/,end:/\}/,contains:[t.C_NUMBER_MODE]},i={className:"variable",begin:"\\$"+t.UNDERSCORE_IDENT_RE},o={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[i,s]},{begin:"'",end:"'",illegal:/\n/,contains:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[t.BACKSLASH_ESCAPE,i,s]}]};s.contains.push(o);const a={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+t.UNDERSCORE_IDENT_RE+")?"},l={className:"meta",begin:"@"+t.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[t.inherit(o,{className:"string"}),"self"]}]},c=IU,u=t.COMMENT("/\\*","\\*/",{contains:[t.C_BLOCK_COMMENT_MODE]}),d={variants:[{className:"type",begin:t.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},h=d;return h.variants[1].contains=[d],d.variants[1].contains=[h],{name:"Kotlin",aliases:["kt","kts"],keywords:e,contains:[t.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),t.C_LINE_COMMENT_MODE,u,n,r,a,l,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:e,relevance:5,contains:[{begin:t.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[t.UNDERSCORE_TITLE_MODE]},{className:"type",begin:/</,end:/>/,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:e,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[d,t.C_LINE_COMMENT_MODE,u],relevance:0},t.C_LINE_COMMENT_MODE,u,a,l,o,t.C_NUMBER_MODE]},u]},{begin:[/class|interface|trait/,/\s+/,t.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},t.UNDERSCORE_TITLE_MODE,{className:"type",begin:/</,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},a,l]},o,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:`
463
- `},c]}}const LU=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),PU=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],jU=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],zU=[...PU,...jU],FU=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),m_=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),g_=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),BU=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),$U=m_.concat(g_).sort().reverse();function HU(t){const e=LU(t),n=$U,r="and or not only",s="[\\w-]+",i="("+s+"|@\\{"+s+"\\})",o=[],a=[],l=function(v){return{className:"string",begin:"~?"+v+".*?"+v}},c=function(v,k,N){return{className:v,begin:k,relevance:N}},u={$pattern:/[a-z-]+/,keyword:r,attribute:FU.join(" ")},d={begin:"\\(",end:"\\)",contains:a,keywords:u,relevance:0};a.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,l("'"),l('"'),e.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},e.HEXCOLOR,d,c("variable","@@?"+s,10),c("variable","@\\{"+s+"\\}"),c("built_in","~?`[^`]*?`"),{className:"attribute",begin:s+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},e.IMPORTANT,{beginKeywords:"and not"},e.FUNCTION_DISPATCH);const h=a.concat({begin:/\{/,end:/\}/,contains:o}),p={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(a)},m={begin:i+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+BU.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:a}}]},g={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:u,returnEnd:!0,contains:a,relevance:0}},b={className:"variable",variants:[{begin:"@"+s+"\\s*:",relevance:15},{begin:"@"+s}],starts:{end:"[;}]",returnEnd:!0,contains:h}},x={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:i,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,p,c("keyword","all\\b"),c("variable","@\\{"+s+"\\}"),{begin:"\\b("+zU.join("|")+")\\b",className:"selector-tag"},e.CSS_NUMBER_MODE,c("selector-tag",i,0),c("selector-id","#"+i),c("selector-class","\\."+i,0),c("selector-tag","&",0),e.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+m_.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+g_.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:h},{begin:"!important"},e.FUNCTION_DISPATCH]},w={begin:s+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[x]};return o.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,g,b,w,m,x,p,e.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:o}}function UU(t){const e="\\[=*\\[",n="\\]=*\\]",r={begin:e,end:n,contains:["self"]},s=[t.COMMENT("--(?!"+e+")","$"),t.COMMENT("--"+e,n,{contains:[r],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:t.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:s.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[t.inherit(t.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:s}].concat(s)},t.C_NUMBER_MODE,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{className:"string",begin:e,end:n,contains:[r],relevance:5}])}}function VU(t){const e={className:"variable",variants:[{begin:"\\$\\("+t.UNDERSCORE_IDENT_RE+"\\)",contains:[t.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},n={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,e]},r={className:"variable",begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:"subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value"},contains:[e,n]},s={begin:"^"+t.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},i={className:"meta",begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},o={className:"section",begin:/^[^\s]+:/,end:/$/,contains:[e]};return{name:"Makefile",aliases:["mk","mak","make"],keywords:{$pattern:/[\w-]+/,keyword:"define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath"},contains:[t.HASH_COMMENT_MODE,e,n,r,s,i,o]}}function WU(t){const e=t.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},s={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},i={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},o={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},a=/[A-Za-z][A-Za-z0-9+.-]*/,l={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:e.concat(/\[.+?\]\(/,a,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},c={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},u={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},d=t.inherit(c,{contains:[]}),h=t.inherit(u,{contains:[]});c.contains.push(h),u.contains.push(d);let p=[n,l];return[c,u,d,h].forEach(x=>{x.contains=x.contains.concat(p)}),p=p.concat(c,u),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:p},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:p}]}]},n,i,c,u,{className:"quote",begin:"^>\\s+",contains:p,end:"$"},s,r,l,o,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function qU(t){const e={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},n=/[a-zA-Z@][a-zA-Z0-9_]*/,a={"variable.language":["this","super"],$pattern:n,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},l={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:a,illegal:"</",contains:[e,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,t.C_NUMBER_MODE,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,{className:"string",variants:[{begin:'@"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]}]},{className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),{className:"string",begin:/<.*?>/,end:/$/,illegal:"\\n"},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+l.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:l,contains:[t.UNDERSCORE_TITLE_MODE]},{begin:"\\."+t.UNDERSCORE_IDENT_RE,relevance:0}]}}function KU(t){const e=t.regex,n=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],r=/[dualxmsipngr]{0,12}/,s={$pattern:/[\w.]+/,keyword:n.join(" ")},i={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:s},o={begin:/->\{/,end:/\}/},a={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},l={scope:"variable",variants:[{begin:/\$\d/},{begin:e.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[a]},c={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},u=[t.BACKSLASH_ESCAPE,i,l],d=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],h=(g,b,x="\\1")=>{const w=x==="\\1"?x:e.concat(x,b);return e.concat(e.concat("(?:",g,")"),b,/(?:\\.|[^\\\/])*?/,w,/(?:\\.|[^\\\/])*?/,x,r)},p=(g,b,x)=>e.concat(e.concat("(?:",g,")"),b,/(?:\\.|[^\\\/])*?/,x,r),m=[l,t.HASH_COMMENT_MODE,t.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),o,{className:"string",contains:u,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},c,{begin:"(\\/\\/|"+t.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[t.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:h("s|tr|y",e.either(...d,{capture:!0}))},{begin:h("s|tr|y","\\(","\\)")},{begin:h("s|tr|y","\\[","\\]")},{begin:h("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:p("(?:m|qr)?",/\//,/\//)},{begin:p("m|qr",e.either(...d,{capture:!0}),/\1/)},{begin:p("m|qr",/\(/,/\)/)},{begin:p("m|qr",/\[/,/\]/)},{begin:p("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE,a]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE,a,c]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return i.contains=m,o.contains=m,{name:"Perl",aliases:["pl","pm"],keywords:s,contains:m}}function GU(t){const e=t.regex,n=/(?![A-Za-z0-9])(?![$])/,r=e.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),s=e.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),i=e.concat(/[A-Z]+/,n),o={scope:"variable",match:"\\$+"+r},a={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},l={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},c=t.inherit(t.APOS_STRING_MODE,{illegal:null}),u=t.inherit(t.QUOTE_STRING_MODE,{illegal:null,contains:t.QUOTE_STRING_MODE.contains.concat(l)}),d={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:t.QUOTE_STRING_MODE.contains.concat(l),"on:begin":(j,L)=>{L.data._beginMatch=j[1]||j[2]},"on:end":(j,L)=>{L.data._beginMatch!==j[1]&&L.ignoreMatch()}},h=t.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),p=`[
464
- ]`,m={scope:"string",variants:[u,c,d,h]},g={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},b=["false","null","true"],x=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],w=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],k={keyword:x,literal:(j=>{const L=[];return j.forEach(q=>{L.push(q),q.toLowerCase()===q?L.push(q.toUpperCase()):L.push(q.toLowerCase())}),L})(b),built_in:w},N=j=>j.map(L=>L.replace(/\|\d+$/,"")),S={variants:[{match:[/new/,e.concat(p,"+"),e.concat("(?!",N(w).join("\\b|"),"\\b)"),s],scope:{1:"keyword",4:"title.class"}}]},C=e.concat(r,"\\b(?!\\()"),T={variants:[{match:[e.concat(/::/,e.lookahead(/(?!class\b)/)),C],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[s,e.concat(/::/,e.lookahead(/(?!class\b)/)),C],scope:{1:"title.class",3:"variable.constant"}},{match:[s,e.concat("::",e.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[s,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},R={scope:"attr",match:e.concat(r,e.lookahead(":"),e.lookahead(/(?!::)/))},_={relevance:0,begin:/\(/,end:/\)/,keywords:k,contains:[R,o,T,t.C_BLOCK_COMMENT_MODE,m,g,S]},I={relevance:0,match:[/\b/,e.concat("(?!fn\\b|function\\b|",N(x).join("\\b|"),"|",N(w).join("\\b|"),"\\b)"),r,e.concat(p,"*"),e.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[_]};_.contains.push(I);const D=[R,T,t.C_BLOCK_COMMENT_MODE,m,g,S],V={begin:e.concat(/#\[\s*\\?/,e.either(s,i)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:b,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:b,keyword:["new","array"]},contains:["self",...D]},...D,{scope:"meta",variants:[{match:s},{match:i}]}]};return{case_insensitive:!1,keywords:k,contains:[V,t.HASH_COMMENT_MODE,t.COMMENT("//","$"),t.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:t.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},a,{scope:"variable.language",match:/\$this\b/},o,I,T,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},S,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},t.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:k,contains:["self",V,o,T,t.C_BLOCK_COMMENT_MODE,m,g]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},t.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[t.inherit(t.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},t.UNDERSCORE_TITLE_MODE]},m,g]}}function JU(t){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},t.inherit(t.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),t.inherit(t.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function YU(t){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function ZU(t){const e=t.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],a={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},l={className:"meta",begin:/^(>>>|\.\.\.) /},c={className:"subst",begin:/\{/,end:/\}/,keywords:a,illegal:/#/},u={begin:/\{\{/,relevance:0},d={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,l,u,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,l,u,c]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[t.BACKSLASH_ESCAPE,u,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,u,c]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},h="[0-9](_?[0-9])*",p=`(\\b(${h}))?\\.(${h})|\\b(${h})\\.`,m=`\\b|${r.join("|")}`,g={className:"number",relevance:0,variants:[{begin:`(\\b(${h})|(${p}))[eE][+-]?(${h})[jJ]?(?=${m})`},{begin:`(${p})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${m})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${m})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${m})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${m})`},{begin:`\\b(${h})[jJ](?=${m})`}]},b={className:"comment",begin:e.lookahead(/# type:/),end:/$/,keywords:a,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},x={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:["self",l,g,d,t.HASH_COMMENT_MODE]}]};return c.contains=[d,g,l],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:a,illegal:/(<\/|\?)|=>/,contains:[l,g,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},d,b,t.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[x]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[g,x,d]}]}}function XU(t){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function QU(t){const e=t.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=e.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),s=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,i=e.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:n,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[t.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:e.lookahead(e.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),t.HASH_COMMENT_MODE,{scope:"string",contains:[t.BACKSLASH_ESCAPE],variants:[t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[s,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[i,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:s},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:i},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function eV(t){const e=t.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=e.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),s=e.concat(r,/(::\w+)*/),o={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},a={className:"doctag",begin:"@[A-Za-z]+"},l={begin:"#<",end:">"},c=[t.COMMENT("#","$",{contains:[a]}),t.COMMENT("^=begin","^=end",{contains:[a],relevance:10}),t.COMMENT("^__END__",t.MATCH_NOTHING_RE)],u={className:"subst",begin:/#\{/,end:/\}/,keywords:o},d={className:"string",contains:[t.BACKSLASH_ESCAPE,u],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:e.concat(/<<[-~]?'?/,e.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[t.BACKSLASH_ESCAPE,u]})]}]},h="[1-9](_?[0-9])*|0",p="[0-9](_?[0-9])*",m={className:"number",relevance:0,variants:[{begin:`\\b(${h})(\\.(${p}))?([eE][+-]?(${p})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},g={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:o}]},S=[d,{variants:[{match:[/class\s+/,s,/\s+<\s+/,s]},{match:[/\b(class|module)\s+/,s]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:o},{match:[/(include|extend)\s+/,s],scope:{2:"title.class"},keywords:o},{relevance:0,match:[s,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[g]},{begin:t.IDENT_RE+"::"},{className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[d,{begin:n}],relevance:0},m,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:o},{begin:"("+t.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[t.BACKSLASH_ESCAPE,u],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(l,c),relevance:0}].concat(l,c);u.contains=S,g.contains=S;const _=[{begin:/^\s*=>/,starts:{end:"$",contains:S}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:o,contains:S}}];return c.unshift(l),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:o,illegal:/\/\*/,contains:[t.SHEBANG({binary:"ruby"})].concat(_).concat(c).concat(S)}}function tV(t){const e=t.regex,n=/(r#)?/,r=e.concat(n,t.UNDERSCORE_IDENT_RE),s=e.concat(n,t.IDENT_RE),i={className:"title.function.invoke",relevance:0,begin:e.concat(/\b/,/(?!let|for|while|if|else|match\b)/,s,e.lookahead(/\s*\(/))},o="([ui](8|16|32|64|128|size)|f(32|64))?",a=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],l=["true","false","Some","None","Ok","Err"],c=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],u=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:t.IDENT_RE+"!?",type:u,keyword:a,literal:l,built_in:c},illegal:"</",contains:[t.C_LINE_COMMENT_MODE,t.COMMENT("/\\*","\\*/",{contains:["self"]}),t.inherit(t.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+o},{begin:"\\b0o([0-7_]+)"+o},{begin:"\\b0x([A-Fa-f0-9_]+)"+o},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+o}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:t.IDENT_RE+"::",keywords:{keyword:"Self",built_in:c,type:u}},{className:"punctuation",begin:"->"},i]}}const nV=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),rV=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],sV=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],iV=[...rV,...sV],oV=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),aV=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),lV=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),cV=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function uV(t){const e=nV(t),n=lV,r=aV,s="@[a-z-]+",i="and or not only",a={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,e.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},e.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+iV.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},a,{begin:/\(/,end:/\)/,contains:[e.CSS_NUMBER_MODE]},e.CSS_VARIABLE,{className:"attribute",begin:"\\b("+cV.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[e.BLOCK_COMMENT,a,e.HEXCOLOR,e.CSS_NUMBER_MODE,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,e.IMPORTANT,e.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:s,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:oV.join(" ")},contains:[{begin:s,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},a,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,e.HEXCOLOR,e.CSS_NUMBER_MODE]},e.FUNCTION_DISPATCH]}}function dV(t){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function fV(t){const e=t.regex,n=t.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},s={begin:/"/,end:/"/,contains:[{match:/""/}]},i=["true","false","unknown"],o=["double precision","large object","with timezone","without timezone"],a=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],l=["add","asc","collation","desc","final","first","last","view"],c=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],u=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],d=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],h=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],p=u,m=[...c,...l].filter(N=>!u.includes(N)),g={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},b={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},x={match:e.concat(/\b/,e.either(...p),/\s*\(/),relevance:0,keywords:{built_in:p}};function w(N){return e.concat(/\b/,e.either(...N.map(S=>S.replace(/\s+/,"\\s+"))),/\b/)}const v={scope:"keyword",match:w(h),relevance:0};function k(N,{exceptions:S,when:C}={}){const T=C;return S=S||[],N.map(R=>R.match(/\|\d+$/)||S.includes(R)?R:T(R)?`${R}|0`:R)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:k(m,{when:N=>N.length<3}),literal:i,type:a,built_in:d},contains:[{scope:"type",match:w(o)},v,x,g,r,s,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,n,b]}}function b_(t){return t?typeof t=="string"?t:t.source:null}function cl(t){return gt("(?=",t,")")}function gt(...t){return t.map(n=>b_(n)).join("")}function hV(t){const e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function Ln(...t){return"("+(hV(t).capture?"":"?:")+t.map(r=>b_(r)).join("|")+")"}const ey=t=>gt(/\b/,t,/\w$/.test(t)?/\b/:/\B/),pV=["Protocol","Type"].map(ey),xw=["init","self"].map(ey),mV=["Any","Self"],dp=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],vw=["false","nil","true"],gV=["assignment","associativity","higherThan","left","lowerThan","none","right"],bV=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],ww=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],y_=Ln(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),x_=Ln(y_,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),fp=gt(y_,x_,"*"),v_=Ln(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),Gd=Ln(v_,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),Vr=gt(v_,Gd,"*"),wu=gt(/[A-Z]/,Gd,"*"),yV=["attached","autoclosure",gt(/convention\(/,Ln("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",gt(/objc\(/,Vr,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],xV=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function vV(t){const e={match:/\s+/,relevance:0},n=t.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[t.C_LINE_COMMENT_MODE,n],s={match:[/\./,Ln(...pV,...xw)],className:{2:"keyword"}},i={match:gt(/\./,Ln(...dp)),relevance:0},o=dp.filter(De=>typeof De=="string").concat(["_|0"]),a=dp.filter(De=>typeof De!="string").concat(mV).map(ey),l={variants:[{className:"keyword",match:Ln(...a,...xw)}]},c={$pattern:Ln(/\b\w+/,/#\w+/),keyword:o.concat(bV),literal:vw},u=[s,i,l],d={match:gt(/\./,Ln(...ww)),relevance:0},h={className:"built_in",match:gt(/\b/,Ln(...ww),/(?=\()/)},p=[d,h],m={match:/->/,relevance:0},g={className:"operator",relevance:0,variants:[{match:fp},{match:`\\.(\\.|${x_})+`}]},b=[m,g],x="([0-9]_*)+",w="([0-9a-fA-F]_*)+",v={className:"number",relevance:0,variants:[{match:`\\b(${x})(\\.(${x}))?([eE][+-]?(${x}))?\\b`},{match:`\\b0x(${w})(\\.(${w}))?([pP][+-]?(${x}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},k=(De="")=>({className:"subst",variants:[{match:gt(/\\/,De,/[0\\tnr"']/)},{match:gt(/\\/,De,/u\{[0-9a-fA-F]{1,8}\}/)}]}),N=(De="")=>({className:"subst",match:gt(/\\/,De,/[\t ]*(?:[\r\n]|\r\n)/)}),S=(De="")=>({className:"subst",label:"interpol",begin:gt(/\\/,De,/\(/),end:/\)/}),C=(De="")=>({begin:gt(De,/"""/),end:gt(/"""/,De),contains:[k(De),N(De),S(De)]}),T=(De="")=>({begin:gt(De,/"/),end:gt(/"/,De),contains:[k(De),S(De)]}),R={className:"string",variants:[C(),C("#"),C("##"),C("###"),T(),T("#"),T("##"),T("###")]},_=[t.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[t.BACKSLASH_ESCAPE]}],I={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:_},D=De=>{const _t=gt(De,/\//),ot=gt(/\//,De);return{begin:_t,end:ot,contains:[..._,{scope:"comment",begin:`#(?!.*${ot})`,end:/$/}]}},V={scope:"regexp",variants:[D("###"),D("##"),D("#"),I]},j={match:gt(/`/,Vr,/`/)},L={className:"variable",match:/\$\d+/},q={className:"variable",match:`\\$${Gd}+`},re=[j,L,q],X={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:xV,contains:[...b,v,R]}]}},ce={scope:"keyword",match:gt(/@/,Ln(...yV),cl(Ln(/\(/,/\s+/)))},A={scope:"meta",match:gt(/@/,Vr)},ue=[X,ce,A],be={match:cl(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:gt(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,Gd,"+")},{className:"type",match:wu,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:gt(/\s+&\s+/,cl(wu)),relevance:0}]},E={begin:/</,end:/>/,keywords:c,contains:[...r,...u,...ue,m,be]};be.contains.push(E);const P={match:gt(Vr,/\s*:/),keywords:"_|0",relevance:0},z={begin:/\(/,end:/\)/,relevance:0,keywords:c,contains:["self",P,...r,V,...u,...p,...b,v,R,...re,...ue,be]},H={begin:/</,end:/>/,keywords:"repeat each",contains:[...r,be]},B={begin:Ln(cl(gt(Vr,/\s*:/)),cl(gt(Vr,/\s+/,Vr,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:Vr}]},J={begin:/\(/,end:/\)/,keywords:c,contains:[B,...r,...u,...b,v,R,...ue,be,z],endsParent:!0,illegal:/["']/},K={match:[/(func|macro)/,/\s+/,Ln(j.match,Vr,fp)],className:{1:"keyword",3:"title.function"},contains:[H,J,e],illegal:[/\[/,/%/]},Y={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[H,J,e],illegal:/\[|%/},le={match:[/operator/,/\s+/,fp],className:{1:"keyword",3:"title"}},ye={begin:[/precedencegroup/,/\s+/,wu],className:{1:"keyword",3:"title"},contains:[be],keywords:[...gV,...vw],end:/}/},Re={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Oe={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},ht={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,Vr,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:c,contains:[H,...u,{begin:/:/,end:/\{/,keywords:c,contains:[{scope:"title.class.inherited",match:wu},...u],relevance:0}]};for(const De of R.variants){const _t=De.contains.find(dn=>dn.label==="interpol");_t.keywords=c;const ot=[...u,...p,...b,v,R,...re];_t.contains=[...ot,{begin:/\(/,end:/\)/,contains:["self",...ot]}]}return{name:"Swift",keywords:c,contains:[...r,K,Y,Re,Oe,ht,le,ye,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},V,...u,...p,...b,v,R,...re,...ue,be,z]}}const Jd="[A-Za-z$_][0-9A-Za-z$_]*",w_=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],k_=["true","false","null","undefined","NaN","Infinity"],S_=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],E_=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],C_=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],N_=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],__=[].concat(C_,S_,E_);function wV(t){const e=t.regex,n=(X,{after:ce})=>{const A="</"+X[0].slice(1);return X.input.indexOf(A,ce)!==-1},r=Jd,s={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(X,ce)=>{const A=X[0].length+X.index,ue=X.input[A];if(ue==="<"||ue===","){ce.ignoreMatch();return}ue===">"&&(n(X,{after:A})||ce.ignoreMatch());let be;const E=X.input.substring(A);if(be=E.match(/^\s*=/)){ce.ignoreMatch();return}if((be=E.match(/^\s+extends\s+/))&&be.index===0){ce.ignoreMatch();return}}},a={$pattern:Jd,keyword:w_,literal:k_,built_in:__,"variable.language":N_},l="[0-9](_?[0-9])*",c=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={className:"number",variants:[{begin:`(\\b(${u})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${u})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,h],subLanguage:"css"}},g={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},b={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,h]},w={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},v=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,p,m,g,b,{match:/\$\d+/},d];h.contains=v.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(v)});const k=[].concat(w,h.contains),N=k.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(k)}]),S={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:N},C={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,e.concat(r,"(",e.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},T={relevance:0,match:e.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...S_,...E_]}},R={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},_={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[S],illegal:/%/},I={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function D(X){return e.concat("(?!",X.join("|"),")")}const V={match:e.concat(/\b/,D([...C_,"super","import"].map(X=>`${X}\\s*\\(`)),r,e.lookahead(/\s*\(/)),className:"title.function",relevance:0},j={begin:e.concat(/\./,e.lookahead(e.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},L={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},S]},q="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",re={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,e.lookahead(q)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[S]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:N,CLASS_REFERENCE:T},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),R,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,p,m,g,b,w,{match:/\$\d+/},d,T,{scope:"attr",match:r+e.lookahead(":"),relevance:0},re,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[w,t.REGEXP_MODE,{className:"function",begin:q,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:N}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:i},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},_,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[S,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},j,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[S]},V,I,C,L,{match:/\$[(.]/}]}}function kV(t){const e=t.regex,n=wV(t),r=Jd,s=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],i={begin:[/namespace/,/\s+/,t.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},o={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:s},contains:[n.exports.CLASS_REFERENCE]},a={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},l=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],c={$pattern:Jd,keyword:w_.concat(l),literal:k_,built_in:__.concat(s),"variable.language":N_},u={className:"meta",begin:"@"+r},d=(g,b,x)=>{const w=g.contains.findIndex(v=>v.label===b);if(w===-1)throw new Error("can not find mode to replace");g.contains.splice(w,1,x)};Object.assign(n.keywords,c),n.exports.PARAMS_CONTAINS.push(u);const h=n.contains.find(g=>g.scope==="attr"),p=Object.assign({},h,{match:e.concat(r,e.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,h,p]),n.contains=n.contains.concat([u,i,o,p]),d(n,"shebang",t.SHEBANG()),d(n,"use_strict",a);const m=n.contains.find(g=>g.label==="func.def");return m.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function SV(t){const e=t.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},s=/\d{1,2}\/\d{1,2}\/\d{4}/,i=/\d{4}-\d{1,2}-\d{1,2}/,o=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,a=/\d{1,2}(:\d{1,2}){1,2}/,l={className:"literal",variants:[{begin:e.concat(/# */,e.either(i,s),/ *#/)},{begin:e.concat(/# */,a,/ *#/)},{begin:e.concat(/# */,o,/ *#/)},{begin:e.concat(/# */,e.either(i,s),/ +/,e.either(o,a),/ *#/)}]},c={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},u={className:"label",begin:/^\w+:/},d=t.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),h=t.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[n,r,l,c,u,d,h,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[h]}]}}function EV(t){t.regex;const e=t.COMMENT(/\(;/,/;\)/);e.contains.push("self");const n=t.COMMENT(/;;/,/$/),r=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],s={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},i={className:"variable",begin:/\$[\w_]+/},o={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},a={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},l={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},c={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:r},contains:[n,e,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},i,o,s,t.QUOTE_STRING_MODE,l,c,a]}}function CV(t){const e=t.regex,n=e.concat(/[\p{L}_]/u,e.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,s={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},i={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=t.inherit(i,{begin:/\(/,end:/\)/}),a=t.inherit(t.APOS_STRING_MODE,{className:"string"}),l=t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),c={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[s]},{begin:/'/,end:/'/,contains:[s]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[i,l,a,o,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[i,o,l,a]}]}]},t.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},s,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[l]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[c],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[c],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:e.concat(/</,e.lookahead(e.concat(n,e.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:c}]},{className:"tag",begin:e.concat(/<\//,e.lookahead(e.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function NV(t){const e="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},s={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},i={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},o={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[t.BACKSLASH_ESCAPE,s]},a=t.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),h={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},p={end:",",endsWithParent:!0,excludeEnd:!0,keywords:e,relevance:0},m={begin:/\{/,end:/\}/,contains:[p],illegal:"\\n",relevance:0},g={begin:"\\[",end:"\\]",contains:[p],illegal:"\\n",relevance:0},b=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+t.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+t.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},t.HASH_COMMENT_MODE,{beginKeywords:e,keywords:{literal:e}},h,{className:"number",begin:t.C_NUMBER_RE+"\\b",relevance:0},m,g,i,o],x=[...b];return x.pop(),x.push(a),p.contains=x,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:b}}const _V={arduino:lU,bash:cU,c:uU,cpp:dU,csharp:fU,css:wU,diff:kU,go:SU,graphql:EU,ini:CU,java:NU,javascript:RU,json:OU,kotlin:DU,less:HU,lua:UU,makefile:VU,markdown:WU,objectivec:qU,perl:KU,php:GU,"php-template":JU,plaintext:YU,python:ZU,"python-repl":XU,r:QU,ruby:eV,rust:tV,scss:uV,shell:dV,sql:fV,swift:vV,typescript:kV,vbnet:SV,wasm:EV,xml:CV,yaml:NV};const kw={},TV="hljs-";function AV(t){const e=c_.newInstance();return t&&i(t),{highlight:n,highlightAuto:r,listLanguages:s,register:i,registerAlias:o,registered:a};function n(l,c,u){const d=u||kw,h=typeof d.prefix=="string"?d.prefix:TV;if(!e.getLanguage(l))throw new Error("Unknown language: `"+l+"` is not registered");e.configure({__emitter:MV,classPrefix:h});const p=e.highlight(c,{ignoreIllegals:!0,language:l});if(p.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:p.errorRaised});const m=p._emitter.root,g=m.data;return g.language=p.language,g.relevance=p.relevance,m}function r(l,c){const d=(c||kw).subset||s();let h=-1,p=0,m;for(;++h<d.length;){const g=d[h];if(!e.getLanguage(g))continue;const b=n(g,l,c);b.data&&b.data.relevance!==void 0&&b.data.relevance>p&&(p=b.data.relevance,m=b)}return m||{type:"root",children:[],data:{language:void 0,relevance:p}}}function s(){return e.listLanguages()}function i(l,c){if(typeof l=="string")e.registerLanguage(l,c);else{let u;for(u in l)Object.hasOwn(l,u)&&e.registerLanguage(u,l[u])}}function o(l,c){if(typeof l=="string")e.registerAliases(typeof c=="string"?c:[...c],{languageName:l});else{let u;for(u in l)if(Object.hasOwn(l,u)){const d=l[u];e.registerAliases(typeof d=="string"?d:[...d],{languageName:u})}}}function a(l){return!!e.getLanguage(l)}}class MV{constructor(e){this.options=e,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(e){if(e==="")return;const n=this.stack[this.stack.length-1],r=n.children[n.children.length-1];r&&r.type==="text"?r.value+=e:n.children.push({type:"text",value:e})}startScope(e){this.openNode(String(e))}endScope(){this.closeNode()}__addSublanguage(e,n){const r=this.stack[this.stack.length-1],s=e.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:s}):r.children.push(...s)}openNode(e){const n=this,r=e.split(".").map(function(o,a){return a?o+"_".repeat(a):n.options.classPrefix+o}),s=this.stack[this.stack.length-1],i={type:"element",tagName:"span",properties:{className:r},children:[]};s.children.push(i),this.stack.push(i)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}function Sw(t){if(t)throw t}var hp,Ew;function RV(){if(Ew)return hp;Ew=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=function(c){return typeof Array.isArray=="function"?Array.isArray(c):e.call(c)==="[object Array]"},i=function(c){if(!c||e.call(c)!=="[object Object]")return!1;var u=t.call(c,"constructor"),d=c.constructor&&c.constructor.prototype&&t.call(c.constructor.prototype,"isPrototypeOf");if(c.constructor&&!u&&!d)return!1;var h;for(h in c);return typeof h>"u"||t.call(c,h)},o=function(c,u){n&&u.name==="__proto__"?n(c,u.name,{enumerable:!0,configurable:!0,value:u.newValue,writable:!0}):c[u.name]=u.newValue},a=function(c,u){if(u==="__proto__")if(t.call(c,u)){if(r)return r(c,u).value}else return;return c[u]};return hp=function l(){var c,u,d,h,p,m,g=arguments[0],b=1,x=arguments.length,w=!1;for(typeof g=="boolean"&&(w=g,g=arguments[1]||{},b=2),(g==null||typeof g!="object"&&typeof g!="function")&&(g={});b<x;++b)if(c=arguments[b],c!=null)for(u in c)d=a(g,u),h=a(c,u),g!==h&&(w&&h&&(i(h)||(p=s(h)))?(p?(p=!1,m=d&&s(d)?d:[]):m=d&&i(d)?d:{},o(g,{name:u,newValue:l(w,m,h)})):typeof h<"u"&&o(g,{name:u,newValue:h}));return g},hp}var OV=RV();const pp=xc(OV);function Zm(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 IV(){const t=[],e={run:n,use:r};return e;function n(...s){let i=-1;const o=s.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...s);function a(l,...c){const u=t[++i];let d=-1;if(l){o(l);return}for(;++d<s.length;)(c[d]===null||c[d]===void 0)&&(c[d]=s[d]);s=c,u?DV(u,a)(...c):o(null,...c)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return t.push(s),e}}function DV(t,e){let n;return r;function r(...o){const a=t.length>o.length;let l;a&&o.push(s);try{l=t.apply(this,o)}catch(c){const u=c;if(a&&n)throw u;return s(u)}a||(l&&l.then&&typeof l.then=="function"?l.then(i,s):l instanceof Error?s(l):i(l))}function s(o,...a){n||(n=!0,e(o,...a))}function i(o){s(null,o)}}function jl(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?Cw(t.position):"start"in t||"end"in t?Cw(t):"line"in t||"column"in t?Xm(t):""}function Xm(t){return Nw(t&&t.line)+":"+Nw(t&&t.column)}function Cw(t){return Xm(t&&t.start)+"-"+Xm(t&&t.end)}function Nw(t){return t&&typeof t=="number"?t:1}class Mn extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},o=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof e=="string"?s=e:!i.cause&&e&&(o=!0,s=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const a=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=a?a.line:void 0,this.name=jl(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Mn.prototype.file="";Mn.prototype.name="";Mn.prototype.reason="";Mn.prototype.message="";Mn.prototype.stack="";Mn.prototype.column=void 0;Mn.prototype.line=void 0;Mn.prototype.ancestors=void 0;Mn.prototype.cause=void 0;Mn.prototype.fatal=void 0;Mn.prototype.place=void 0;Mn.prototype.ruleId=void 0;Mn.prototype.source=void 0;const Gr={basename:LV,dirname:PV,extname:jV,join:zV,sep:"/"};function LV(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');qc(t);let n=0,r=-1,s=t.length,i;if(e===void 0||e.length===0||e.length>t.length){for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let o=-1,a=e.length-1;for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else o<0&&(i=!0,o=s+1),a>-1&&(t.codePointAt(s)===e.codePointAt(a--)?a<0&&(r=s):(a=-1,r=o));return n===r?r=o:r<0&&(r=t.length),t.slice(n,r)}function PV(t){if(qc(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 jV(t){qc(t);let e=t.length,n=-1,r=0,s=-1,i=0,o;for(;e--;){const a=t.codePointAt(e);if(a===47){if(o){r=e+1;break}continue}n<0&&(o=!0,n=e+1),a===46?s<0?s=e:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":t.slice(s,n)}function zV(...t){let e=-1,n;for(;++e<t.length;)qc(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":FV(n)}function FV(t){qc(t);const e=t.codePointAt(0)===47;let n=BV(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function BV(t,e){let n="",r=0,s=-1,i=0,o=-1,a,l;for(;++o<=t.length;){if(o<t.length)a=t.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(s===o-1||i===1))if(s!==o-1&&i===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("/")),s=o,i=0;continue}}else if(n.length>0){n="",r=0,s=o,i=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(s+1,o):n=t.slice(s+1,o),r=o-s-1;s=o,i=0}else a===46&&i>-1?i++:i=-1}return n}function qc(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const $V={cwd:HV};function HV(){return"/"}function Qm(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function UV(t){if(typeof t=="string")t=new URL(t);else if(!Qm(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 VV(t)}function VV(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 s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(e)}const mp=["history","path","basename","stem","extname","dirname"];class T_{constructor(e){let n;e?Qm(e)?n={path:e}:typeof e=="string"||WV(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":$V.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<mp.length;){const i=mp[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let s;for(s in n)mp.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?Gr.basename(this.path):void 0}set basename(e){bp(e,"basename"),gp(e,"basename"),this.path=Gr.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Gr.dirname(this.path):void 0}set dirname(e){_w(this.basename,"dirname"),this.path=Gr.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Gr.extname(this.path):void 0}set extname(e){if(gp(e,"extname"),_w(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=Gr.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Qm(e)&&(e=UV(e)),bp(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Gr.basename(this.path,this.extname):void 0}set stem(e){bp(e,"stem"),gp(e,"stem"),this.path=Gr.join(this.dirname||"",e+(this.extname||""))}fail(e,n,r){const s=this.message(e,n,r);throw s.fatal=!0,s}info(e,n,r){const s=this.message(e,n,r);return s.fatal=void 0,s}message(e,n,r){const s=new Mn(e,n,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function gp(t,e){if(t&&t.includes(Gr.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Gr.sep+"`")}function bp(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function _w(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function WV(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const qV=(function(t){const r=this.constructor.prototype,s=r[t],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i}),KV={}.hasOwnProperty;class ty extends qV{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=IV()}copy(){const e=new ty;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];e.use(...r)}return e.data(pp(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(vp("data",this.frozen),this.namespace[e]=n,this):KV.call(this.namespace,e)&&this.namespace[e]||void 0:e?(vp("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 s=n.call(e,...r);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=ku(e),r=this.parser||this.Parser;return yp("parse",r),r(String(n),n)}process(e,n){const r=this;return this.freeze(),yp("process",this.parser||this.Parser),xp("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,o){const a=ku(e),l=r.parse(a);r.run(l,a,function(u,d,h){if(u||!d||!h)return c(u);const p=d,m=r.stringify(p,h);JV(m)?h.value=m:h.result=m,c(u,h)});function c(u,d){u||!d?o(u):i?i(d):n(void 0,d)}}}processSync(e){let n=!1,r;return this.freeze(),yp("processSync",this.parser||this.Parser),xp("processSync",this.compiler||this.Compiler),this.process(e,s),Aw("processSync","process",n),r;function s(i,o){n=!0,Sw(i),r=o}}run(e,n,r){Tw(e),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(o,a){const l=ku(n);s.run(e,l,c);function c(u,d,h){const p=d||e;u?a(u):o?o(p):r(void 0,p,h)}}}runSync(e,n){let r=!1,s;return this.run(e,n,i),Aw("runSync","run",r),s;function i(o,a){Sw(o),s=a,r=!0}}stringify(e,n){this.freeze();const r=ku(n),s=this.compiler||this.Compiler;return xp("stringify",s),Tw(e),s(e,r)}use(e,...n){const r=this.attachers,s=this.namespace;if(vp("use",this.frozen),e!=null)if(typeof e=="function")l(e,n);else if(typeof e=="object")Array.isArray(e)?a(e):o(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function i(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[u,...d]=c;l(u,d)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))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(c.plugins),c.settings&&(s.settings=pp(!0,s.settings,c.settings))}function a(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){const d=c[u];i(d)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let d=-1,h=-1;for(;++d<r.length;)if(r[d][0]===c){h=d;break}if(h===-1)r.push([c,...u]);else if(u.length>0){let[p,...m]=u;const g=r[h][1];Zm(g)&&Zm(p)&&(p=pp(!0,g,p)),r[h]=[c,p,...m]}}}}const A_=new ty().freeze();function yp(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function xp(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function vp(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 Tw(t){if(!Zm(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function Aw(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function ku(t){return GV(t)?t:new T_(t)}function GV(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function JV(t){return typeof t=="string"||YV(t)}function YV(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const ZV={};function ny(t,e){const n=ZV,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return M_(t,r,s)}function M_(t,e,n){if(XV(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 Mw(t.children,e,n)}return Array.isArray(t)?Mw(t,e,n):""}function Mw(t,e,n){const r=[];let s=-1;for(;++s<t.length;)r[s]=M_(t[s],e,n);return r.join("")}function XV(t){return!!(t&&typeof t=="object")}const Rw=document.createElement("i");function ry(t){const e="&"+t+";";Rw.innerHTML=e;const n=Rw.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function cr(t,e,n,r){const s=t.length;let i=0,o;if(e<0?e=-e>s?0:s+e:e=e>s?s:e,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(e,n),t.splice(...o);else for(n&&t.splice(e,n);i<r.length;)o=r.slice(i,i+1e4),o.unshift(e,0),t.splice(...o),i+=1e4,e+=1e4}function wr(t,e){return t.length>0?(cr(t,t.length,0,e),t):e}const Ow={}.hasOwnProperty;function R_(t){const e={};let n=-1;for(;++n<t.length;)QV(e,t[n]);return e}function QV(t,e){let n;for(n in e){const s=(Ow.call(t,n)?t[n]:void 0)||(t[n]={}),i=e[n];let o;if(i)for(o in i){Ow.call(s,o)||(s[o]=[]);const a=i[o];e5(s[o],Array.isArray(a)?a:a?[a]:[])}}}function e5(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);cr(t,0,0,r)}function O_(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)}function Pr(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const jn=Li(/[A-Za-z]/),Nn=Li(/[\dA-Za-z]/),t5=Li(/[#-'*+\--9=?A-Z^-~]/);function Yd(t){return t!==null&&(t<32||t===127)}const eg=Li(/\d/),n5=Li(/[\dA-Fa-f]/),r5=Li(/[!-/:-@[-`{-~]/);function Ie(t){return t!==null&&t<-2}function vt(t){return t!==null&&(t<0||t===32)}function Ze(t){return t===-2||t===-1||t===32}const rh=Li(new RegExp("\\p{P}|\\p{S}","u")),No=Li(/\s/);function Li(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Za(t){const e=[];let n=-1,r=0,s=0;for(;++n<t.length;){const i=t.charCodeAt(n);let o="";if(i===37&&Nn(t.charCodeAt(n+1))&&Nn(t.charCodeAt(n+2)))s=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const a=t.charCodeAt(n+1);i<56320&&a>56319&&a<57344?(o=String.fromCharCode(i,a),s=1):o="�"}else o=String.fromCharCode(i);o&&(e.push(t.slice(r,n),encodeURIComponent(o)),r=n+s+1,o=""),s&&(n+=s,s=0)}return e.join("")+t.slice(r)}function nt(t,e,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(l){return Ze(l)?(t.enter(n),a(l)):e(l)}function a(l){return Ze(l)&&i++<s?(t.consume(l),a):(t.exit(n),e(l))}}const s5={tokenize:i5};function i5(t){const e=t.attempt(this.parser.constructs.contentInitial,r,s);let n;return e;function r(a){if(a===null){t.consume(a);return}return t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),nt(t,e,"linePrefix")}function s(a){return t.enter("paragraph"),i(a)}function i(a){const l=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,o(a)}function o(a){if(a===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(a);return}return Ie(a)?(t.consume(a),t.exit("chunkText"),i):(t.consume(a),o)}}const o5={tokenize:a5},Iw={tokenize:l5};function a5(t){const e=this,n=[];let r=0,s,i,o;return a;function a(v){if(r<n.length){const k=n[r];return e.containerState=k[1],t.attempt(k[0].continuation,l,c)(v)}return c(v)}function l(v){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,s&&w();const k=e.events.length;let N=k,S;for(;N--;)if(e.events[N][0]==="exit"&&e.events[N][1].type==="chunkFlow"){S=e.events[N][1].end;break}x(r);let C=k;for(;C<e.events.length;)e.events[C][1].end={...S},C++;return cr(e.events,N+1,0,e.events.slice(k)),e.events.length=C,c(v)}return a(v)}function c(v){if(r===n.length){if(!s)return h(v);if(s.currentConstruct&&s.currentConstruct.concrete)return m(v);e.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(Iw,u,d)(v)}function u(v){return s&&w(),x(r),h(v)}function d(v){return e.parser.lazy[e.now().line]=r!==n.length,o=e.now().offset,m(v)}function h(v){return e.containerState={},t.attempt(Iw,p,m)(v)}function p(v){return r++,n.push([e.currentConstruct,e.containerState]),h(v)}function m(v){if(v===null){s&&w(),x(0),t.consume(v);return}return s=s||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),g(v)}function g(v){if(v===null){b(t.exit("chunkFlow"),!0),x(0),t.consume(v);return}return Ie(v)?(t.consume(v),b(t.exit("chunkFlow")),r=0,e.interrupt=void 0,a):(t.consume(v),g)}function b(v,k){const N=e.sliceStream(v);if(k&&N.push(null),v.previous=i,i&&(i.next=v),i=v,s.defineSkip(v.start),s.write(N),e.parser.lazy[v.start.line]){let S=s.events.length;for(;S--;)if(s.events[S][1].start.offset<o&&(!s.events[S][1].end||s.events[S][1].end.offset>o))return;const C=e.events.length;let T=C,R,_;for(;T--;)if(e.events[T][0]==="exit"&&e.events[T][1].type==="chunkFlow"){if(R){_=e.events[T][1].end;break}R=!0}for(x(r),S=C;S<e.events.length;)e.events[S][1].end={..._},S++;cr(e.events,T+1,0,e.events.slice(C)),e.events.length=S}}function x(v){let k=n.length;for(;k-- >v;){const N=n[k];e.containerState=N[1],N[0].exit.call(e,t)}n.length=v}function w(){s.write([null]),i=void 0,s=void 0,e.containerState._closeFlow=void 0}}function l5(t,e,n){return nt(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Pa(t){if(t===null||vt(t)||No(t))return 1;if(rh(t))return 2}function sh(t,e,n){const r=[];let s=-1;for(;++s<t.length;){const i=t[s].resolveAll;i&&!r.includes(i)&&(e=i(e,n),r.push(i))}return e}const tg={name:"attention",resolveAll:c5,tokenize:u5};function c5(t,e){let n=-1,r,s,i,o,a,l,c,u;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};Dw(d,-l),Dw(h,l),o={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},i={type:l>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},s={type:l>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},t[r][1].end={...o.start},t[n][1].start={...a.end},c=[],t[r][1].end.offset-t[r][1].start.offset&&(c=wr(c,[["enter",t[r][1],e],["exit",t[r][1],e]])),c=wr(c,[["enter",s,e],["enter",o,e],["exit",o,e],["enter",i,e]]),c=wr(c,sh(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),c=wr(c,[["exit",i,e],["enter",a,e],["exit",a,e],["exit",s,e]]),t[n][1].end.offset-t[n][1].start.offset?(u=2,c=wr(c,[["enter",t[n][1],e],["exit",t[n][1],e]])):u=0,cr(t,r-1,n-r+3,c),n=r+c.length-u-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function u5(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=Pa(r);let i;return o;function o(l){return i=l,t.enter("attentionSequence"),a(l)}function a(l){if(l===i)return t.consume(l),a;const c=t.exit("attentionSequence"),u=Pa(l),d=!u||u===2&&s||n.includes(l),h=!s||s===2&&u||n.includes(r);return c._open=!!(i===42?d:d&&(s||!h)),c._close=!!(i===42?h:h&&(u||!d)),e(l)}}function Dw(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const d5={name:"autolink",tokenize:f5};function f5(t,e,n){let r=0;return s;function s(p){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(p),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),i}function i(p){return jn(p)?(t.consume(p),o):p===64?n(p):c(p)}function o(p){return p===43||p===45||p===46||Nn(p)?(r=1,a(p)):c(p)}function a(p){return p===58?(t.consume(p),r=0,l):(p===43||p===45||p===46||Nn(p))&&r++<32?(t.consume(p),a):(r=0,c(p))}function l(p){return p===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(p),t.exit("autolinkMarker"),t.exit("autolink"),e):p===null||p===32||p===60||Yd(p)?n(p):(t.consume(p),l)}function c(p){return p===64?(t.consume(p),u):t5(p)?(t.consume(p),c):n(p)}function u(p){return Nn(p)?d(p):n(p)}function d(p){return p===46?(t.consume(p),r=0,u):p===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(p),t.exit("autolinkMarker"),t.exit("autolink"),e):h(p)}function h(p){if((p===45||Nn(p))&&r++<63){const m=p===45?h:d;return t.consume(p),m}return n(p)}}const Kc={partial:!0,tokenize:h5};function h5(t,e,n){return r;function r(i){return Ze(i)?nt(t,s,"linePrefix")(i):s(i)}function s(i){return i===null||Ie(i)?e(i):n(i)}}const I_={continuation:{tokenize:m5},exit:g5,name:"blockQuote",tokenize:p5};function p5(t,e,n){const r=this;return s;function s(o){if(o===62){const a=r.containerState;return a.open||(t.enter("blockQuote",{_container:!0}),a.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(o),t.exit("blockQuoteMarker"),i}return n(o)}function i(o){return Ze(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function m5(t,e,n){const r=this;return s;function s(o){return Ze(o)?nt(t,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return t.attempt(I_,e,n)(o)}}function g5(t){t.exit("blockQuote")}const D_={name:"characterEscape",tokenize:b5};function b5(t,e,n){return r;function r(i){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(i),t.exit("escapeMarker"),s}function s(i){return r5(i)?(t.enter("characterEscapeValue"),t.consume(i),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(i)}}const L_={name:"characterReference",tokenize:y5};function y5(t,e,n){const r=this;let s=0,i,o;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"),c):(t.enter("characterReferenceValue"),i=31,o=Nn,u(d))}function c(d){return d===88||d===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(d),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),i=6,o=n5,u):(t.enter("characterReferenceValue"),i=7,o=eg,u(d))}function u(d){if(d===59&&s){const h=t.exit("characterReferenceValue");return o===Nn&&!ry(r.sliceSerialize(h))?n(d):(t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return o(d)&&s++<i?(t.consume(d),u):n(d)}}const Lw={partial:!0,tokenize:v5},Pw={concrete:!0,name:"codeFenced",tokenize:x5};function x5(t,e,n){const r=this,s={partial:!0,tokenize:N};let i=0,o=0,a;return l;function l(S){return c(S)}function c(S){const C=r.events[r.events.length-1];return i=C&&C[1].type==="linePrefix"?C[2].sliceSerialize(C[1],!0).length:0,a=S,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),u(S)}function u(S){return S===a?(o++,t.consume(S),u):o<3?n(S):(t.exit("codeFencedFenceSequence"),Ze(S)?nt(t,d,"whitespace")(S):d(S))}function d(S){return S===null||Ie(S)?(t.exit("codeFencedFence"),r.interrupt?e(S):t.check(Lw,g,k)(S)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),h(S))}function h(S){return S===null||Ie(S)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),d(S)):Ze(S)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),nt(t,p,"whitespace")(S)):S===96&&S===a?n(S):(t.consume(S),h)}function p(S){return S===null||Ie(S)?d(S):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),m(S))}function m(S){return S===null||Ie(S)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),d(S)):S===96&&S===a?n(S):(t.consume(S),m)}function g(S){return t.attempt(s,k,b)(S)}function b(S){return t.enter("lineEnding"),t.consume(S),t.exit("lineEnding"),x}function x(S){return i>0&&Ze(S)?nt(t,w,"linePrefix",i+1)(S):w(S)}function w(S){return S===null||Ie(S)?t.check(Lw,g,k)(S):(t.enter("codeFlowValue"),v(S))}function v(S){return S===null||Ie(S)?(t.exit("codeFlowValue"),w(S)):(t.consume(S),v)}function k(S){return t.exit("codeFenced"),e(S)}function N(S,C,T){let R=0;return _;function _(L){return S.enter("lineEnding"),S.consume(L),S.exit("lineEnding"),I}function I(L){return S.enter("codeFencedFence"),Ze(L)?nt(S,D,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):D(L)}function D(L){return L===a?(S.enter("codeFencedFenceSequence"),V(L)):T(L)}function V(L){return L===a?(R++,S.consume(L),V):R>=o?(S.exit("codeFencedFenceSequence"),Ze(L)?nt(S,j,"whitespace")(L):j(L)):T(L)}function j(L){return L===null||Ie(L)?(S.exit("codeFencedFence"),C(L)):T(L)}}}function v5(t,e,n){const r=this;return s;function s(o){return o===null?n(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i)}function i(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}const wp={name:"codeIndented",tokenize:k5},w5={partial:!0,tokenize:S5};function k5(t,e,n){const r=this;return s;function s(c){return t.enter("codeIndented"),nt(t,i,"linePrefix",5)(c)}function i(c){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?l(c):Ie(c)?t.attempt(w5,o,l)(c):(t.enter("codeFlowValue"),a(c))}function a(c){return c===null||Ie(c)?(t.exit("codeFlowValue"),o(c)):(t.consume(c),a)}function l(c){return t.exit("codeIndented"),e(c)}}function S5(t,e,n){const r=this;return s;function s(o){return r.parser.lazy[r.now().line]?n(o):Ie(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s):nt(t,i,"linePrefix",5)(o)}function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(o):Ie(o)?s(o):n(o)}}const E5={name:"codeText",previous:N5,resolve:C5,tokenize:_5};function C5(t){let e=t.length-4,n=3,r,s;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;)s===void 0?r!==e&&t[r][1].type!=="lineEnding"&&(s=r):(r===e||t[r][1].type==="lineEnding")&&(t[s][1].type="codeTextData",r!==s+2&&(t[s][1].end=t[r-1][1].end,t.splice(s+2,r-s-2),e-=r-s-2,r=s+2),s=void 0);return t}function N5(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function _5(t,e,n){let r=0,s,i;return o;function o(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?(i=t.enter("codeTextSequence"),s=0,u(d)):Ie(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),l):(t.enter("codeTextData"),c(d))}function c(d){return d===null||d===32||d===96||Ie(d)?(t.exit("codeTextData"),l(d)):(t.consume(d),c)}function u(d){return d===96?(t.consume(d),s++,u):s===r?(t.exit("codeTextSequence"),t.exit("codeText"),e(d)):(i.type="codeTextData",c(d))}}class T5{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 s=n||0;this.setCursor(Math.trunc(e));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&ul(this.left,r),i.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),ul(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),ul(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);ul(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);ul(this.left,n.reverse())}}}function ul(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 P_(t){const e={};let n=-1,r,s,i,o,a,l,c;const u=new T5(t);for(;++n<u.length;){for(;n in e;)n=e[n];if(r=u.get(n),n&&r[1].type==="chunkFlow"&&u.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,A5(u,n)),n=e[n],c=!0);else if(r[1]._container){for(i=n,s=void 0;i--;)if(o=u.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(s&&(u.get(s)[1].type="lineEndingBlank"),o[1].type="lineEnding",s=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;s&&(r[1].end={...u.get(s)[1].start},a=u.slice(s,n),a.unshift(r),u.splice(s,n-s+1,a))}}return cr(t,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function A5(t,e){const n=t.get(e)[1],r=t.get(e)[2];let s=e-1;const i=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,l=[],c={};let u,d,h=-1,p=n,m=0,g=0;const b=[g];for(;p;){for(;t.get(++s)[1]!==p;);i.push(s),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=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,b.push(g),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):b.pop(),h=b.length;h--;){const x=a.slice(b[h],b[h+1]),w=i.pop();l.push([w,w+x.length-1]),t.splice(w,2,x)}for(l.reverse(),h=-1;++h<l.length;)c[m+l[h][0]]=m+l[h][1],m+=l[h][1]-l[h][0]-1;return c}const M5={resolve:O5,tokenize:I5},R5={partial:!0,tokenize:D5};function O5(t){return P_(t),t}function I5(t,e){let n;return r;function r(a){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),s(a)}function s(a){return a===null?i(a):Ie(a)?t.check(R5,o,i)(a):(t.consume(a),s)}function i(a){return t.exit("chunkContent"),t.exit("content"),e(a)}function o(a){return t.consume(a),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function D5(t,e,n){const r=this;return s;function s(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),nt(t,i,"linePrefix")}function i(o){if(o===null||Ie(o))return n(o);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(o):t.interrupt(r.parser.constructs.flow,n,e)(o)}}function j_(t,e,n,r,s,i,o,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return d;function d(x){return x===60?(t.enter(r),t.enter(s),t.enter(i),t.consume(x),t.exit(i),h):x===null||x===32||x===41||Yd(x)?n(x):(t.enter(r),t.enter(o),t.enter(a),t.enter("chunkString",{contentType:"string"}),g(x))}function h(x){return x===62?(t.enter(i),t.consume(x),t.exit(i),t.exit(s),t.exit(r),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),p(x))}function p(x){return x===62?(t.exit("chunkString"),t.exit(a),h(x)):x===null||x===60||Ie(x)?n(x):(t.consume(x),x===92?m:p)}function m(x){return x===60||x===62||x===92?(t.consume(x),p):p(x)}function g(x){return!u&&(x===null||x===41||vt(x))?(t.exit("chunkString"),t.exit(a),t.exit(o),t.exit(r),e(x)):u<c&&x===40?(t.consume(x),u++,g):x===41?(t.consume(x),u--,g):x===null||x===32||x===40||Yd(x)?n(x):(t.consume(x),x===92?b:g)}function b(x){return x===40||x===41||x===92?(t.consume(x),g):g(x)}}function z_(t,e,n,r,s,i){const o=this;let a=0,l;return c;function c(p){return t.enter(r),t.enter(s),t.consume(p),t.exit(s),t.enter(i),u}function u(p){return a>999||p===null||p===91||p===93&&!l||p===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(p):p===93?(t.exit(i),t.enter(s),t.consume(p),t.exit(s),t.exit(r),e):Ie(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),u):(t.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===null||p===91||p===93||Ie(p)||a++>999?(t.exit("chunkString"),u(p)):(t.consume(p),l||(l=!Ze(p)),p===92?h:d)}function h(p){return p===91||p===92||p===93?(t.consume(p),a++,d):d(p)}}function F_(t,e,n,r,s,i){let o;return a;function a(h){return h===34||h===39||h===40?(t.enter(r),t.enter(s),t.consume(h),t.exit(s),o=h===40?41:h,l):n(h)}function l(h){return h===o?(t.enter(s),t.consume(h),t.exit(s),t.exit(r),e):(t.enter(i),c(h))}function c(h){return h===o?(t.exit(i),l(o)):h===null?n(h):Ie(h)?(t.enter("lineEnding"),t.consume(h),t.exit("lineEnding"),nt(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),u(h))}function u(h){return h===o||h===null||Ie(h)?(t.exit("chunkString"),c(h)):(t.consume(h),h===92?d:u)}function d(h){return h===o||h===92?(t.consume(h),u):u(h)}}function zl(t,e){let n;return r;function r(s){return Ie(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),n=!0,r):Ze(s)?nt(t,r,n?"linePrefix":"lineSuffix")(s):e(s)}}const L5={name:"definition",tokenize:j5},P5={partial:!0,tokenize:z5};function j5(t,e,n){const r=this;let s;return i;function i(p){return t.enter("definition"),o(p)}function o(p){return z_.call(r,t,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return s=Pr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(t.enter("definitionMarker"),t.consume(p),t.exit("definitionMarker"),l):n(p)}function l(p){return vt(p)?zl(t,c)(p):c(p)}function c(p){return j_(t,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function u(p){return t.attempt(P5,d,d)(p)}function d(p){return Ze(p)?nt(t,h,"whitespace")(p):h(p)}function h(p){return p===null||Ie(p)?(t.exit("definition"),r.parser.defined.push(s),e(p)):n(p)}}function z5(t,e,n){return r;function r(a){return vt(a)?zl(t,s)(a):n(a)}function s(a){return F_(t,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function i(a){return Ze(a)?nt(t,o,"whitespace")(a):o(a)}function o(a){return a===null||Ie(a)?e(a):n(a)}}const F5={name:"hardBreakEscape",tokenize:B5};function B5(t,e,n){return r;function r(i){return t.enter("hardBreakEscape"),t.consume(i),s}function s(i){return Ie(i)?(t.exit("hardBreakEscape"),e(i)):n(i)}}const $5={name:"headingAtx",resolve:H5,tokenize:U5};function H5(t,e){let n=t.length-2,r=3,s,i;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&&(s={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},i={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},cr(t,r,n-r+1,[["enter",s,e],["enter",i,e],["exit",i,e],["exit",s,e]])),t}function U5(t,e,n){let r=0;return s;function s(u){return t.enter("atxHeading"),i(u)}function i(u){return t.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&r++<6?(t.consume(u),o):u===null||vt(u)?(t.exit("atxHeadingSequence"),a(u)):n(u)}function a(u){return u===35?(t.enter("atxHeadingSequence"),l(u)):u===null||Ie(u)?(t.exit("atxHeading"),e(u)):Ze(u)?nt(t,a,"whitespace")(u):(t.enter("atxHeadingText"),c(u))}function l(u){return u===35?(t.consume(u),l):(t.exit("atxHeadingSequence"),a(u))}function c(u){return u===null||u===35||vt(u)?(t.exit("atxHeadingText"),a(u)):(t.consume(u),c)}}const V5=["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"],jw=["pre","script","style","textarea"],W5={concrete:!0,name:"htmlFlow",resolveTo:G5,tokenize:J5},q5={partial:!0,tokenize:Z5},K5={partial:!0,tokenize:Y5};function G5(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 J5(t,e,n){const r=this;let s,i,o,a,l;return c;function c(E){return u(E)}function u(E){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(E),d}function d(E){return E===33?(t.consume(E),h):E===47?(t.consume(E),i=!0,g):E===63?(t.consume(E),s=3,r.interrupt?e:A):jn(E)?(t.consume(E),o=String.fromCharCode(E),b):n(E)}function h(E){return E===45?(t.consume(E),s=2,p):E===91?(t.consume(E),s=5,a=0,m):jn(E)?(t.consume(E),s=4,r.interrupt?e:A):n(E)}function p(E){return E===45?(t.consume(E),r.interrupt?e:A):n(E)}function m(E){const P="CDATA[";return E===P.charCodeAt(a++)?(t.consume(E),a===P.length?r.interrupt?e:D:m):n(E)}function g(E){return jn(E)?(t.consume(E),o=String.fromCharCode(E),b):n(E)}function b(E){if(E===null||E===47||E===62||vt(E)){const P=E===47,z=o.toLowerCase();return!P&&!i&&jw.includes(z)?(s=1,r.interrupt?e(E):D(E)):V5.includes(o.toLowerCase())?(s=6,P?(t.consume(E),x):r.interrupt?e(E):D(E)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(E):i?w(E):v(E))}return E===45||Nn(E)?(t.consume(E),o+=String.fromCharCode(E),b):n(E)}function x(E){return E===62?(t.consume(E),r.interrupt?e:D):n(E)}function w(E){return Ze(E)?(t.consume(E),w):_(E)}function v(E){return E===47?(t.consume(E),_):E===58||E===95||jn(E)?(t.consume(E),k):Ze(E)?(t.consume(E),v):_(E)}function k(E){return E===45||E===46||E===58||E===95||Nn(E)?(t.consume(E),k):N(E)}function N(E){return E===61?(t.consume(E),S):Ze(E)?(t.consume(E),N):v(E)}function S(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(t.consume(E),l=E,C):Ze(E)?(t.consume(E),S):T(E)}function C(E){return E===l?(t.consume(E),l=null,R):E===null||Ie(E)?n(E):(t.consume(E),C)}function T(E){return E===null||E===34||E===39||E===47||E===60||E===61||E===62||E===96||vt(E)?N(E):(t.consume(E),T)}function R(E){return E===47||E===62||Ze(E)?v(E):n(E)}function _(E){return E===62?(t.consume(E),I):n(E)}function I(E){return E===null||Ie(E)?D(E):Ze(E)?(t.consume(E),I):n(E)}function D(E){return E===45&&s===2?(t.consume(E),q):E===60&&s===1?(t.consume(E),re):E===62&&s===4?(t.consume(E),ue):E===63&&s===3?(t.consume(E),A):E===93&&s===5?(t.consume(E),ce):Ie(E)&&(s===6||s===7)?(t.exit("htmlFlowData"),t.check(q5,be,V)(E)):E===null||Ie(E)?(t.exit("htmlFlowData"),V(E)):(t.consume(E),D)}function V(E){return t.check(K5,j,be)(E)}function j(E){return t.enter("lineEnding"),t.consume(E),t.exit("lineEnding"),L}function L(E){return E===null||Ie(E)?V(E):(t.enter("htmlFlowData"),D(E))}function q(E){return E===45?(t.consume(E),A):D(E)}function re(E){return E===47?(t.consume(E),o="",X):D(E)}function X(E){if(E===62){const P=o.toLowerCase();return jw.includes(P)?(t.consume(E),ue):D(E)}return jn(E)&&o.length<8?(t.consume(E),o+=String.fromCharCode(E),X):D(E)}function ce(E){return E===93?(t.consume(E),A):D(E)}function A(E){return E===62?(t.consume(E),ue):E===45&&s===2?(t.consume(E),A):D(E)}function ue(E){return E===null||Ie(E)?(t.exit("htmlFlowData"),be(E)):(t.consume(E),ue)}function be(E){return t.exit("htmlFlow"),e(E)}}function Y5(t,e,n){const r=this;return s;function s(o){return Ie(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):n(o)}function i(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}function Z5(t,e,n){return r;function r(s){return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),t.attempt(Kc,e,n)}}const X5={name:"htmlText",tokenize:Q5};function Q5(t,e,n){const r=this;let s,i,o;return a;function a(A){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(A),l}function l(A){return A===33?(t.consume(A),c):A===47?(t.consume(A),N):A===63?(t.consume(A),v):jn(A)?(t.consume(A),T):n(A)}function c(A){return A===45?(t.consume(A),u):A===91?(t.consume(A),i=0,m):jn(A)?(t.consume(A),w):n(A)}function u(A){return A===45?(t.consume(A),p):n(A)}function d(A){return A===null?n(A):A===45?(t.consume(A),h):Ie(A)?(o=d,re(A)):(t.consume(A),d)}function h(A){return A===45?(t.consume(A),p):d(A)}function p(A){return A===62?q(A):A===45?h(A):d(A)}function m(A){const ue="CDATA[";return A===ue.charCodeAt(i++)?(t.consume(A),i===ue.length?g:m):n(A)}function g(A){return A===null?n(A):A===93?(t.consume(A),b):Ie(A)?(o=g,re(A)):(t.consume(A),g)}function b(A){return A===93?(t.consume(A),x):g(A)}function x(A){return A===62?q(A):A===93?(t.consume(A),x):g(A)}function w(A){return A===null||A===62?q(A):Ie(A)?(o=w,re(A)):(t.consume(A),w)}function v(A){return A===null?n(A):A===63?(t.consume(A),k):Ie(A)?(o=v,re(A)):(t.consume(A),v)}function k(A){return A===62?q(A):v(A)}function N(A){return jn(A)?(t.consume(A),S):n(A)}function S(A){return A===45||Nn(A)?(t.consume(A),S):C(A)}function C(A){return Ie(A)?(o=C,re(A)):Ze(A)?(t.consume(A),C):q(A)}function T(A){return A===45||Nn(A)?(t.consume(A),T):A===47||A===62||vt(A)?R(A):n(A)}function R(A){return A===47?(t.consume(A),q):A===58||A===95||jn(A)?(t.consume(A),_):Ie(A)?(o=R,re(A)):Ze(A)?(t.consume(A),R):q(A)}function _(A){return A===45||A===46||A===58||A===95||Nn(A)?(t.consume(A),_):I(A)}function I(A){return A===61?(t.consume(A),D):Ie(A)?(o=I,re(A)):Ze(A)?(t.consume(A),I):R(A)}function D(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(t.consume(A),s=A,V):Ie(A)?(o=D,re(A)):Ze(A)?(t.consume(A),D):(t.consume(A),j)}function V(A){return A===s?(t.consume(A),s=void 0,L):A===null?n(A):Ie(A)?(o=V,re(A)):(t.consume(A),V)}function j(A){return A===null||A===34||A===39||A===60||A===61||A===96?n(A):A===47||A===62||vt(A)?R(A):(t.consume(A),j)}function L(A){return A===47||A===62||vt(A)?R(A):n(A)}function q(A){return A===62?(t.consume(A),t.exit("htmlTextData"),t.exit("htmlText"),e):n(A)}function re(A){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(A),t.exit("lineEnding"),X}function X(A){return Ze(A)?nt(t,ce,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):ce(A)}function ce(A){return t.enter("htmlTextData"),o(A)}}const sy={name:"labelEnd",resolveAll:rW,resolveTo:sW,tokenize:iW},eW={tokenize:oW},tW={tokenize:aW},nW={tokenize:lW};function rW(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 s=r.type==="labelImage"?4:2;r.type="data",e+=s}}return t.length!==n.length&&cr(t,0,t.length,n),t}function sW(t,e){let n=t.length,r=0,s,i,o,a;for(;n--;)if(s=t[n][1],i){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;t[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(o){if(t[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(i=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(o=n);const l={type:t[i][1].type==="labelLink"?"link":"image",start:{...t[i][1].start},end:{...t[t.length-1][1].end}},c={type:"label",start:{...t[i][1].start},end:{...t[o][1].end}},u={type:"labelText",start:{...t[i+r+2][1].end},end:{...t[o-2][1].start}};return a=[["enter",l,e],["enter",c,e]],a=wr(a,t.slice(i+1,i+r+3)),a=wr(a,[["enter",u,e]]),a=wr(a,sh(e.parser.constructs.insideSpan.null,t.slice(i+r+4,o-3),e)),a=wr(a,[["exit",u,e],t[o-2],t[o-1],["exit",c,e]]),a=wr(a,t.slice(o+1)),a=wr(a,[["exit",l,e]]),cr(t,i,t.length,a),t}function iW(t,e,n){const r=this;let s=r.events.length,i,o;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){i=r.events[s][1];break}return a;function a(h){return i?i._inactive?d(h):(o=r.parser.defined.includes(Pr(r.sliceSerialize({start:i.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(eW,u,o?u:d)(h):h===91?t.attempt(tW,u,o?c:d)(h):o?u(h):d(h)}function c(h){return t.attempt(nW,u,d)(h)}function u(h){return e(h)}function d(h){return i._balanced=!0,n(h)}}function oW(t,e,n){return r;function r(d){return t.enter("resource"),t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),s}function s(d){return vt(d)?zl(t,i)(d):i(d)}function i(d){return d===41?u(d):j_(t,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return vt(d)?zl(t,l)(d):u(d)}function a(d){return n(d)}function l(d){return d===34||d===39||d===40?F_(t,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return vt(d)?zl(t,u)(d):u(d)}function u(d){return d===41?(t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),t.exit("resource"),e):n(d)}}function aW(t,e,n){const r=this;return s;function s(a){return z_.call(r,t,i,o,"reference","referenceMarker","referenceString")(a)}function i(a){return r.parser.defined.includes(Pr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(a):n(a)}function o(a){return n(a)}}function lW(t,e,n){return r;function r(i){return t.enter("reference"),t.enter("referenceMarker"),t.consume(i),t.exit("referenceMarker"),s}function s(i){return i===93?(t.enter("referenceMarker"),t.consume(i),t.exit("referenceMarker"),t.exit("reference"),e):n(i)}}const cW={name:"labelStartImage",resolveAll:sy.resolveAll,tokenize:uW};function uW(t,e,n){const r=this;return s;function s(a){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(a),t.exit("labelImageMarker"),i}function i(a){return a===91?(t.enter("labelMarker"),t.consume(a),t.exit("labelMarker"),t.exit("labelImage"),o):n(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):e(a)}}const dW={name:"labelStartLink",resolveAll:sy.resolveAll,tokenize:fW};function fW(t,e,n){const r=this;return s;function s(o){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(o),t.exit("labelMarker"),t.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):e(o)}}const kp={name:"lineEnding",tokenize:hW};function hW(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),nt(t,e,"linePrefix")}}const Vu={name:"thematicBreak",tokenize:pW};function pW(t,e,n){let r=0,s;return i;function i(c){return t.enter("thematicBreak"),o(c)}function o(c){return s=c,a(c)}function a(c){return c===s?(t.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||Ie(c))?(t.exit("thematicBreak"),e(c)):n(c)}function l(c){return c===s?(t.consume(c),r++,l):(t.exit("thematicBreakSequence"),Ze(c)?nt(t,a,"whitespace")(c):a(c))}}const Wn={continuation:{tokenize:yW},exit:vW,name:"list",tokenize:bW},mW={partial:!0,tokenize:wW},gW={partial:!0,tokenize:xW};function bW(t,e,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,o=0;return a;function a(p){const m=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:eg(p)){if(r.containerState.type||(r.containerState.type=m,t.enter(m,{_container:!0})),m==="listUnordered")return t.enter("listItemPrefix"),p===42||p===45?t.check(Vu,n,c)(p):c(p);if(!r.interrupt||p===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(p)}return n(p)}function l(p){return eg(p)&&++o<10?(t.consume(p),l):(!r.interrupt||o<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(t.exit("listItemValue"),c(p)):n(p)}function c(p){return t.enter("listItemMarker"),t.consume(p),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,t.check(Kc,r.interrupt?n:u,t.attempt(mW,h,d))}function u(p){return r.containerState.initialBlankLine=!0,i++,h(p)}function d(p){return Ze(p)?(t.enter("listItemPrefixWhitespace"),t.consume(p),t.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return r.containerState.size=i+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(p)}}function yW(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(Kc,s,i);function s(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,nt(t,e,"listItemIndent",r.containerState.size+1)(a)}function i(a){return r.containerState.furtherBlankLines||!Ze(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(gW,e,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,nt(t,t.attempt(Wn,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function xW(t,e,n){const r=this;return nt(t,s,"listItemIndent",r.containerState.size+1);function s(i){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?e(i):n(i)}}function vW(t){t.exit(this.containerState.type)}function wW(t,e,n){const r=this;return nt(t,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const o=r.events[r.events.length-1];return!Ze(i)&&o&&o[1].type==="listItemPrefixWhitespace"?e(i):n(i)}}const zw={name:"setextUnderline",resolveTo:kW,tokenize:SW};function kW(t,e){let n=t.length,r,s,i;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(s=n)}else t[n][1].type==="content"&&t.splice(n,1),!i&&t[n][1].type==="definition"&&(i=n);const o={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[s][1].type="setextHeadingText",i?(t.splice(s,0,["enter",o,e]),t.splice(i+1,0,["exit",t[r][1],e]),t[r][1].end={...t[i][1].end}):t[r][1]=o,t.push(["exit",o,e]),t}function SW(t,e,n){const r=this;let s;return i;function i(c){let u=r.events.length,d;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){d=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(t.enter("setextHeadingLine"),s=c,o(c)):n(c)}function o(c){return t.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===s?(t.consume(c),a):(t.exit("setextHeadingLineSequence"),Ze(c)?nt(t,l,"lineSuffix")(c):l(c))}function l(c){return c===null||Ie(c)?(t.exit("setextHeadingLine"),e(c)):n(c)}}const EW={tokenize:CW};function CW(t){const e=this,n=t.attempt(Kc,r,t.attempt(this.parser.constructs.flowInitial,s,nt(t,t.attempt(this.parser.constructs.flow,s,t.attempt(M5,s)),"linePrefix")));return n;function r(i){if(i===null){t.consume(i);return}return t.enter("lineEndingBlank"),t.consume(i),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function s(i){if(i===null){t.consume(i);return}return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const NW={resolveAll:$_()},_W=B_("string"),TW=B_("text");function B_(t){return{resolveAll:$_(t==="text"?AW:void 0),tokenize:e};function e(n){const r=this,s=this.parser.constructs[t],i=n.attempt(s,o,a);return o;function o(u){return c(u)?i(u):a(u)}function a(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),l}function l(u){return c(u)?(n.exit("data"),i(u)):(n.consume(u),l)}function c(u){if(u===null)return!0;const d=s[u];let h=-1;if(d)for(;++h<d.length;){const p=d[h];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function $_(t){return e;function e(n,r){let s=-1,i;for(;++s<=n.length;)i===void 0?n[s]&&n[s][1].type==="data"&&(i=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==i+2&&(n[i][1].end=n[s-1][1].end,n.splice(i+2,s-i-2),s=i+2),i=void 0);return t?t(n,r):n}}function AW(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],s=e.sliceStream(r);let i=s.length,o=-1,a=0,l;for(;i--;){const c=s[i];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(c===-2)l=!0,a++;else if(c!==-1){i++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(a=0),a){const c={type:n===t.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:r.start._bufferIndex+o,_index:r.start._index+i,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(t.splice(n,0,["enter",c,e],["exit",c,e]),n+=2)}n++}return t}const MW={42:Wn,43:Wn,45:Wn,48:Wn,49:Wn,50:Wn,51:Wn,52:Wn,53:Wn,54:Wn,55:Wn,56:Wn,57:Wn,62:I_},RW={91:L5},OW={[-2]:wp,[-1]:wp,32:wp},IW={35:$5,42:Vu,45:[zw,Vu],60:W5,61:zw,95:Vu,96:Pw,126:Pw},DW={38:L_,92:D_},LW={[-5]:kp,[-4]:kp,[-3]:kp,33:cW,38:L_,42:tg,60:[d5,X5],91:dW,92:[F5,D_],93:sy,95:tg,96:E5},PW={null:[tg,NW]},jW={null:[42,95]},zW={null:[]},FW=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:jW,contentInitial:RW,disable:zW,document:MW,flow:IW,flowInitial:OW,insideSpan:PW,string:DW,text:LW},Symbol.toStringTag,{value:"Module"}));function BW(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 s={},i=[];let o=[],a=[];const l={attempt:C(N),check:C(S),consume:w,enter:v,exit:k,interrupt:C(S,{interrupt:!0})},c={code:null,containerState:{},defineSkip:g,events:[],now:m,parser:t,previous:null,sliceSerialize:h,sliceStream:p,write:d};let u=e.tokenize.call(c,l);return e.resolveAll&&i.push(e),c;function d(I){return o=wr(o,I),b(),o[o.length-1]!==null?[]:(T(e,0),c.events=sh(i,c.events,c),c.events)}function h(I,D){return HW(p(I),D)}function p(I){return $W(o,I)}function m(){const{_bufferIndex:I,_index:D,line:V,column:j,offset:L}=r;return{_bufferIndex:I,_index:D,line:V,column:j,offset:L}}function g(I){s[I.line]=I.column,_()}function b(){let I;for(;r._index<o.length;){const D=o[r._index];if(typeof D=="string")for(I=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===I&&r._bufferIndex<D.length;)x(D.charCodeAt(r._bufferIndex));else x(D)}}function x(I){u=u(I)}function w(I){Ie(I)?(r.line++,r.column=1,r.offset+=I===-3?2:1,_()):I!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=I}function v(I,D){const V=D||{};return V.type=I,V.start=m(),c.events.push(["enter",V,c]),a.push(V),V}function k(I){const D=a.pop();return D.end=m(),c.events.push(["exit",D,c]),D}function N(I,D){T(I,D.from)}function S(I,D){D.restore()}function C(I,D){return V;function V(j,L,q){let re,X,ce,A;return Array.isArray(j)?be(j):"tokenize"in j?be([j]):ue(j);function ue(H){return B;function B(J){const K=J!==null&&H[J],Y=J!==null&&H.null,le=[...Array.isArray(K)?K:K?[K]:[],...Array.isArray(Y)?Y:Y?[Y]:[]];return be(le)(J)}}function be(H){return re=H,X=0,H.length===0?q:E(H[X])}function E(H){return B;function B(J){return A=R(),ce=H,H.partial||(c.currentConstruct=H),H.name&&c.parser.constructs.disable.null.includes(H.name)?z():H.tokenize.call(D?Object.assign(Object.create(c),D):c,l,P,z)(J)}}function P(H){return I(ce,A),L}function z(H){return A.restore(),++X<re.length?E(re[X]):q}}}function T(I,D){I.resolveAll&&!i.includes(I)&&i.push(I),I.resolve&&cr(c.events,D,c.events.length-D,I.resolve(c.events.slice(D),c)),I.resolveTo&&(c.events=I.resolveTo(c.events,c))}function R(){const I=m(),D=c.previous,V=c.currentConstruct,j=c.events.length,L=Array.from(a);return{from:j,restore:q};function q(){r=I,c.previous=D,c.currentConstruct=V,c.events.length=j,a=L,_()}}function _(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function $W(t,e){const n=e.start._index,r=e.start._bufferIndex,s=e.end._index,i=e.end._bufferIndex;let o;if(n===s)o=[t[n].slice(r,i)];else{if(o=t.slice(n,s),r>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}i>0&&o.push(t[s].slice(0,i))}return o}function HW(t,e){let n=-1;const r=[];let s;for(;++n<t.length;){const i=t[n];let o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
465
- `;break}case-3:{o=`\r
466
- `;break}case-2:{o=e?" ":" ";break}case-1:{if(!e&&s)continue;o=" ";break}default:o=String.fromCharCode(i)}s=i===-2,r.push(o)}return r.join("")}function UW(t){const r={constructs:R_([FW,...(t||{}).extensions||[]]),content:s(s5),defined:[],document:s(o5),flow:s(EW),lazy:{},string:s(_W),text:s(TW)};return r;function s(i){return o;function o(a){return BW(r,i,a)}}}function VW(t){for(;!P_(t););return t}const Fw=/[\0\t\n\r]/g;function WW(){let t=1,e="",n=!0,r;return s;function s(i,o,a){const l=[];let c,u,d,h,p;for(i=e+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),d=0,e="",n&&(i.charCodeAt(0)===65279&&d++,n=void 0);d<i.length;){if(Fw.lastIndex=d,c=Fw.exec(i),h=c&&c.index!==void 0?c.index:i.length,p=i.charCodeAt(h),!c){e=i.slice(d);break}if(p===10&&d===h&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),d<h&&(l.push(i.slice(d,h)),t+=h-d),p){case 0:{l.push(65533),t++;break}case 9:{for(u=Math.ceil(t/4)*4,l.push(-2);t++<u;)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 qW=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function KW(t){return t.replace(qW,GW)}function GW(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),i=s===120||s===88;return O_(n.slice(i?2:1),i?16:10)}return ry(n)||t}const H_={}.hasOwnProperty;function JW(t,e,n){return typeof e!="string"&&(n=e,e=void 0),YW(n)(VW(UW(n).document().write(WW()(t,e,!0))))}function YW(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(dn),autolinkProtocol:R,autolinkEmail:R,atxHeading:i(ht),blockQuote:i(Y),characterEscape:R,characterReference:R,codeFenced:i(le),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(le,o),codeText:i(ye,o),codeTextData:R,data:R,codeFlowValue:R,definition:i(Re),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(Oe),hardBreakEscape:i(De),hardBreakTrailing:i(De),htmlFlow:i(_t,o),htmlFlowData:R,htmlText:i(_t,o),htmlTextData:R,image:i(ot),label:o,link:i(dn),listItem:i(me),listItemValue:h,listOrdered:i(qt,d),listUnordered:i(qt),paragraph:i(ze),reference:E,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(ht),strong:i(Vt),thematicBreak:i(ct)},exit:{atxHeading:l(),atxHeadingSequence:N,autolink:l(),autolinkEmail:K,autolinkProtocol:J,blockQuote:l(),characterEscapeValue:_,characterReferenceMarkerHexadecimal:z,characterReferenceMarkerNumeric:z,characterReferenceValue:H,characterReference:B,codeFenced:l(b),codeFencedFence:g,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:_,codeIndented:l(x),codeText:l(L),codeTextData:_,data:_,definition:l(),definitionDestinationString:k,definitionLabelString:w,definitionTitleString:v,emphasis:l(),hardBreakEscape:l(D),hardBreakTrailing:l(D),htmlFlow:l(V),htmlFlowData:_,htmlText:l(j),htmlTextData:_,image:l(re),label:ce,labelText:X,lineEnding:I,link:l(q),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:P,resourceDestinationString:A,resourceTitleString:ue,resource:be,setextHeading:l(T),setextHeadingLineSequence:C,setextHeadingText:S,strong:l(),thematicBreak:l()}};U_(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(F){let W={type:"root",children:[]};const ge={stack:[W],tokenStack:[],config:e,enter:a,exit:c,buffer:o,resume:u,data:n},Be=[];let tt=-1;for(;++tt<F.length;)if(F[tt][1].type==="listOrdered"||F[tt][1].type==="listUnordered")if(F[tt][0]==="enter")Be.push(tt);else{const Ot=Be.pop();tt=s(F,Ot,tt)}for(tt=-1;++tt<F.length;){const Ot=e[F[tt][0]];H_.call(Ot,F[tt][1].type)&&Ot[F[tt][1].type].call(Object.assign({sliceSerialize:F[tt][2].sliceSerialize},ge),F[tt][1])}if(ge.tokenStack.length>0){const Ot=ge.tokenStack[ge.tokenStack.length-1];(Ot[1]||Bw).call(ge,void 0,Ot[0])}for(W.position={start:$s(F.length>0?F[0][1].start:{line:1,column:1,offset:0}),end:$s(F.length>0?F[F.length-2][1].end:{line:1,column:1,offset:0})},tt=-1;++tt<e.transforms.length;)W=e.transforms[tt](W)||W;return W}function s(F,W,ge){let Be=W-1,tt=-1,Ot=!1,Vn,On,dr,nr;for(;++Be<=ge;){const Kt=F[Be];switch(Kt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Kt[0]==="enter"?tt++:tt--,nr=void 0;break}case"lineEndingBlank":{Kt[0]==="enter"&&(Vn&&!nr&&!tt&&!dr&&(dr=Be),nr=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:nr=void 0}if(!tt&&Kt[0]==="enter"&&Kt[1].type==="listItemPrefix"||tt===-1&&Kt[0]==="exit"&&(Kt[1].type==="listUnordered"||Kt[1].type==="listOrdered")){if(Vn){let fr=Be;for(On=void 0;fr--;){const sn=F[fr];if(sn[1].type==="lineEnding"||sn[1].type==="lineEndingBlank"){if(sn[0]==="exit")continue;On&&(F[On][1].type="lineEndingBlank",Ot=!0),sn[1].type="lineEnding",On=fr}else if(!(sn[1].type==="linePrefix"||sn[1].type==="blockQuotePrefix"||sn[1].type==="blockQuotePrefixWhitespace"||sn[1].type==="blockQuoteMarker"||sn[1].type==="listItemIndent"))break}dr&&(!On||dr<On)&&(Vn._spread=!0),Vn.end=Object.assign({},On?F[On][1].start:Kt[1].end),F.splice(On||Be,0,["exit",Vn,Kt[2]]),Be++,ge++}if(Kt[1].type==="listItemPrefix"){const fr={type:"listItem",_spread:!1,start:Object.assign({},Kt[1].start),end:void 0};Vn=fr,F.splice(Be,0,["enter",fr,Kt[2]]),Be++,ge++,dr=void 0,nr=!0}}}return F[W][1]._spread=Ot,ge}function i(F,W){return ge;function ge(Be){a.call(this,F(Be),Be),W&&W.call(this,Be)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(F,W,ge){this.stack[this.stack.length-1].children.push(F),this.stack.push(F),this.tokenStack.push([W,ge||void 0]),F.position={start:$s(W.start),end:void 0}}function l(F){return W;function W(ge){F&&F.call(this,ge),c.call(this,ge)}}function c(F,W){const ge=this.stack.pop(),Be=this.tokenStack.pop();if(Be)Be[0].type!==F.type&&(W?W.call(this,F,Be[0]):(Be[1]||Bw).call(this,F,Be[0]));else throw new Error("Cannot close `"+F.type+"` ("+jl({start:F.start,end:F.end})+"): it’s not open");ge.position.end=$s(F.end)}function u(){return ny(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function h(F){if(this.data.expectingFirstListItemValue){const W=this.stack[this.stack.length-2];W.start=Number.parseInt(this.sliceSerialize(F),10),this.data.expectingFirstListItemValue=void 0}}function p(){const F=this.resume(),W=this.stack[this.stack.length-1];W.lang=F}function m(){const F=this.resume(),W=this.stack[this.stack.length-1];W.meta=F}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const F=this.resume(),W=this.stack[this.stack.length-1];W.value=F.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const F=this.resume(),W=this.stack[this.stack.length-1];W.value=F.replace(/(\r?\n|\r)$/g,"")}function w(F){const W=this.resume(),ge=this.stack[this.stack.length-1];ge.label=W,ge.identifier=Pr(this.sliceSerialize(F)).toLowerCase()}function v(){const F=this.resume(),W=this.stack[this.stack.length-1];W.title=F}function k(){const F=this.resume(),W=this.stack[this.stack.length-1];W.url=F}function N(F){const W=this.stack[this.stack.length-1];if(!W.depth){const ge=this.sliceSerialize(F).length;W.depth=ge}}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(F){const W=this.stack[this.stack.length-1];W.depth=this.sliceSerialize(F).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function R(F){const ge=this.stack[this.stack.length-1].children;let Be=ge[ge.length-1];(!Be||Be.type!=="text")&&(Be=Z(),Be.position={start:$s(F.start),end:void 0},ge.push(Be)),this.stack.push(Be)}function _(F){const W=this.stack.pop();W.value+=this.sliceSerialize(F),W.position.end=$s(F.end)}function I(F){const W=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ge=W.children[W.children.length-1];ge.position.end=$s(F.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(W.type)&&(R.call(this,F),_.call(this,F))}function D(){this.data.atHardBreak=!0}function V(){const F=this.resume(),W=this.stack[this.stack.length-1];W.value=F}function j(){const F=this.resume(),W=this.stack[this.stack.length-1];W.value=F}function L(){const F=this.resume(),W=this.stack[this.stack.length-1];W.value=F}function q(){const F=this.stack[this.stack.length-1];if(this.data.inReference){const W=this.data.referenceType||"shortcut";F.type+="Reference",F.referenceType=W,delete F.url,delete F.title}else delete F.identifier,delete F.label;this.data.referenceType=void 0}function re(){const F=this.stack[this.stack.length-1];if(this.data.inReference){const W=this.data.referenceType||"shortcut";F.type+="Reference",F.referenceType=W,delete F.url,delete F.title}else delete F.identifier,delete F.label;this.data.referenceType=void 0}function X(F){const W=this.sliceSerialize(F),ge=this.stack[this.stack.length-2];ge.label=KW(W),ge.identifier=Pr(W).toLowerCase()}function ce(){const F=this.stack[this.stack.length-1],W=this.resume(),ge=this.stack[this.stack.length-1];if(this.data.inReference=!0,ge.type==="link"){const Be=F.children;ge.children=Be}else ge.alt=W}function A(){const F=this.resume(),W=this.stack[this.stack.length-1];W.url=F}function ue(){const F=this.resume(),W=this.stack[this.stack.length-1];W.title=F}function be(){this.data.inReference=void 0}function E(){this.data.referenceType="collapsed"}function P(F){const W=this.resume(),ge=this.stack[this.stack.length-1];ge.label=W,ge.identifier=Pr(this.sliceSerialize(F)).toLowerCase(),this.data.referenceType="full"}function z(F){this.data.characterReferenceType=F.type}function H(F){const W=this.sliceSerialize(F),ge=this.data.characterReferenceType;let Be;ge?(Be=O_(W,ge==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Be=ry(W);const tt=this.stack[this.stack.length-1];tt.value+=Be}function B(F){const W=this.stack.pop();W.position.end=$s(F.end)}function J(F){_.call(this,F);const W=this.stack[this.stack.length-1];W.url=this.sliceSerialize(F)}function K(F){_.call(this,F);const W=this.stack[this.stack.length-1];W.url="mailto:"+this.sliceSerialize(F)}function Y(){return{type:"blockquote",children:[]}}function le(){return{type:"code",lang:null,meta:null,value:""}}function ye(){return{type:"inlineCode",value:""}}function Re(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Oe(){return{type:"emphasis",children:[]}}function ht(){return{type:"heading",depth:0,children:[]}}function De(){return{type:"break"}}function _t(){return{type:"html",value:""}}function ot(){return{type:"image",title:null,url:"",alt:null}}function dn(){return{type:"link",title:null,url:"",children:[]}}function qt(F){return{type:"list",ordered:F.type==="listOrdered",start:null,spread:F._spread,children:[]}}function me(F){return{type:"listItem",spread:F._spread,checked:null,children:[]}}function ze(){return{type:"paragraph",children:[]}}function Vt(){return{type:"strong",children:[]}}function Z(){return{type:"text",value:""}}function ct(){return{type:"thematicBreak"}}}function $s(t){return{line:t.line,column:t.column,offset:t.offset}}function U_(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?U_(t,r):ZW(t,r)}}function ZW(t,e){let n;for(n in e)if(H_.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 Bw(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+jl({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+jl({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+jl({start:e.start,end:e.end})+") is still open")}function V_(t){const e=this;e.parser=n;function n(r){return JW(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function Zd(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(e);for(;s!==-1;)r++,s=n.indexOf(e,s+e.length);return r}function XW(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}const ih=(function(t){if(t==null)return nq;if(typeof t=="function")return oh(t);if(typeof t=="object")return Array.isArray(t)?QW(t):eq(t);if(typeof t=="string")return tq(t);throw new Error("Expected function, string, or object as test")});function QW(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=ih(t[n]);return oh(r);function r(...s){let i=-1;for(;++i<e.length;)if(e[i].apply(this,s))return!0;return!1}}function eq(t){const e=t;return oh(n);function n(r){const s=r;let i;for(i in t)if(s[i]!==e[i])return!1;return!0}}function tq(t){return oh(e);function e(n){return n&&n.type===t}}function oh(t){return e;function e(n,r,s){return!!(rq(n)&&t.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function nq(){return!0}function rq(t){return t!==null&&typeof t=="object"&&"type"in t}const W_=[],sq=!0,ng=!1,iq="skip";function q_(t,e,n,r){let s;typeof e=="function"&&typeof n!="function"?(r=n,n=e):s=e;const i=ih(s),o=r?-1:1;a(t,void 0,[])();function a(l,c,u){const d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){const p=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(h,"name",{value:"node ("+(l.type+(p?"<"+p+">":""))+")"})}return h;function h(){let p=W_,m,g,b;if((!e||i(l,c,u[u.length-1]||void 0))&&(p=oq(n(l,u)),p[0]===ng))return p;if("children"in l&&l.children){const x=l;if(x.children&&p[0]!==iq)for(g=(r?x.children.length:-1)+o,b=u.concat(x);g>-1&&g<x.children.length;){const w=x.children[g];if(m=a(w,g,b)(),m[0]===ng)return m;g=typeof m[1]=="number"?m[1]:g+o}}return p}}}function oq(t){return Array.isArray(t)?t:typeof t=="number"?[sq,t]:t==null?W_:[t]}function aq(t,e,n){const s=ih((n||{}).ignore||[]),i=lq(e);let o=-1;for(;++o<i.length;)q_(t,"text",a);function a(c,u){let d=-1,h;for(;++d<u.length;){const p=u[d],m=h?h.children:void 0;if(s(p,m?m.indexOf(p):void 0,h))return;h=p}if(h)return l(c,u)}function l(c,u){const d=u[u.length-1],h=i[o][0],p=i[o][1];let m=0;const b=d.children.indexOf(c);let x=!1,w=[];h.lastIndex=0;let v=h.exec(c.value);for(;v;){const k=v.index,N={index:v.index,input:v.input,stack:[...u,c]};let S=p(...v,N);if(typeof S=="string"&&(S=S.length>0?{type:"text",value:S}:void 0),S===!1?h.lastIndex=k+1:(m!==k&&w.push({type:"text",value:c.value.slice(m,k)}),Array.isArray(S)?w.push(...S):S&&w.push(S),m=k+v[0].length,x=!0),!h.global)break;v=h.exec(c.value)}return x?(m<c.value.length&&w.push({type:"text",value:c.value.slice(m)}),d.children.splice(b,1,...w)):w=[c],b+w.length}}function lq(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 s=n[r];e.push([cq(s[0]),uq(s[1])])}return e}function cq(t){return typeof t=="string"?new RegExp(XW(t),"g"):t}function uq(t){return typeof t=="function"?t:function(){return t}}const Sp="phrasing",Ep=["autolink","link","image","label"];function dq(){return{transforms:[yq],enter:{literalAutolink:hq,literalAutolinkEmail:Cp,literalAutolinkHttp:Cp,literalAutolinkWww:Cp},exit:{literalAutolink:bq,literalAutolinkEmail:gq,literalAutolinkHttp:pq,literalAutolinkWww:mq}}}function fq(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Sp,notInConstruct:Ep},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Sp,notInConstruct:Ep},{character:":",before:"[ps]",after:"\\/",inConstruct:Sp,notInConstruct:Ep}]}}function hq(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function Cp(t){this.config.enter.autolinkProtocol.call(this,t)}function pq(t){this.config.exit.autolinkProtocol.call(this,t)}function mq(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 gq(t){this.config.exit.autolinkEmail.call(this,t)}function bq(t){this.exit(t)}function yq(t){aq(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,xq],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),vq]],{ignore:["link","linkReference"]})}function xq(t,e,n,r,s){let i="";if(!K_(s)||(/^w/i.test(e)&&(n=e+n,e="",i="http://"),!wq(n)))return!1;const o=kq(n+r);if(!o[0])return!1;const a={type:"link",title:null,url:i+e+o[0],children:[{type:"text",value:e+o[0]}]};return o[1]?[a,{type:"text",value:o[1]}]:a}function vq(t,e,n,r){return!K_(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+n,children:[{type:"text",value:e+"@"+n}]}}function wq(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 kq(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 s=Zd(t,"(");let i=Zd(t,")");for(;r!==-1&&s>i;)t+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[t,n]}function K_(t,e){const n=t.input.charCodeAt(t.index-1);return(t.index===0||No(n)||rh(n))&&(!e||n!==47)}G_.peek=Rq;function Sq(){this.buffer()}function Eq(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function Cq(){this.buffer()}function Nq(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function _q(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Pr(this.sliceSerialize(t)).toLowerCase(),n.label=e}function Tq(t){this.exit(t)}function Aq(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Pr(this.sliceSerialize(t)).toLowerCase(),n.label=e}function Mq(t){this.exit(t)}function Rq(){return"["}function G_(t,e,n,r){const s=n.createTracker(r);let i=s.move("[^");const o=n.enter("footnoteReference"),a=n.enter("reference");return i+=s.move(n.safe(n.associationId(t),{after:"]",before:i})),a(),o(),i+=s.move("]"),i}function Oq(){return{enter:{gfmFootnoteCallString:Sq,gfmFootnoteCall:Eq,gfmFootnoteDefinitionLabelString:Cq,gfmFootnoteDefinition:Nq},exit:{gfmFootnoteCallString:_q,gfmFootnoteCall:Tq,gfmFootnoteDefinitionLabelString:Aq,gfmFootnoteDefinition:Mq}}}function Iq(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:n,footnoteReference:G_},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,o){const a=i.createTracker(o);let l=a.move("[^");const c=i.enter("footnoteDefinition"),u=i.enter("label");return l+=a.move(i.safe(i.associationId(r),{before:l,after:"]"})),u(),l+=a.move("]:"),r.children&&r.children.length>0&&(a.shift(4),l+=a.move((e?`
467
- `:" ")+i.indentLines(i.containerFlow(r,a.current()),e?J_:Dq))),c(),l}}function Dq(t,e,n){return e===0?t:J_(t,e,n)}function J_(t,e,n){return(n?"":" ")+t}const Lq=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Y_.peek=Bq;function Pq(){return{canContainEols:["delete"],enter:{strikethrough:zq},exit:{strikethrough:Fq}}}function jq(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Lq}],handlers:{delete:Y_}}}function zq(t){this.enter({type:"delete",children:[]},t)}function Fq(t){this.exit(t)}function Y_(t,e,n,r){const s=n.createTracker(r),i=n.enter("strikethrough");let o=s.move("~~");return o+=n.containerPhrasing(t,{...s.current(),before:o,after:"~"}),o+=s.move("~~"),i(),o}function Bq(){return"~"}function $q(t){return t.length}function Hq(t,e){const n=e||{},r=(n.align||[]).concat(),s=n.stringLength||$q,i=[],o=[],a=[],l=[];let c=0,u=-1;for(;++u<t.length;){const g=[],b=[];let x=-1;for(t[u].length>c&&(c=t[u].length);++x<t[u].length;){const w=Uq(t[u][x]);if(n.alignDelimiters!==!1){const v=s(w);b[x]=v,(l[x]===void 0||v>l[x])&&(l[x]=v)}g.push(w)}o[u]=g,a[u]=b}let d=-1;if(typeof r=="object"&&"length"in r)for(;++d<c;)i[d]=$w(r[d]);else{const g=$w(r);for(;++d<c;)i[d]=g}d=-1;const h=[],p=[];for(;++d<c;){const g=i[d];let b="",x="";g===99?(b=":",x=":"):g===108?b=":":g===114&&(x=":");let w=n.alignDelimiters===!1?1:Math.max(1,l[d]-b.length-x.length);const v=b+"-".repeat(w)+x;n.alignDelimiters!==!1&&(w=b.length+w+x.length,w>l[d]&&(l[d]=w),p[d]=w),h[d]=v}o.splice(1,0,h),a.splice(1,0,p),u=-1;const m=[];for(;++u<o.length;){const g=o[u],b=a[u];d=-1;const x=[];for(;++d<c;){const w=g[d]||"";let v="",k="";if(n.alignDelimiters!==!1){const N=l[d]-(b[d]||0),S=i[d];S===114?v=" ".repeat(N):S===99?N%2?(v=" ".repeat(N/2+.5),k=" ".repeat(N/2-.5)):(v=" ".repeat(N/2),k=v):k=" ".repeat(N)}n.delimiterStart!==!1&&!d&&x.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&w==="")&&(n.delimiterStart!==!1||d)&&x.push(" "),n.alignDelimiters!==!1&&x.push(v),x.push(w),n.alignDelimiters!==!1&&x.push(k),n.padding!==!1&&x.push(" "),(n.delimiterEnd!==!1||d!==c-1)&&x.push("|")}m.push(n.delimiterEnd===!1?x.join("").replace(/ +$/,""):x.join(""))}return m.join(`
468
- `)}function Uq(t){return t==null?"":String(t)}function $w(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 Hw={}.hasOwnProperty;function Vq(t,e){const n=e||{};function r(s,...i){let o=r.invalid;const a=r.handlers;if(s&&Hw.call(s,t)){const l=String(s[t]);o=Hw.call(a,l)?a[l]:r.unknown}if(o)return o.call(this,s,...i)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}function Wq(t,e,n,r){const s=n.enter("blockquote"),i=n.createTracker(r);i.move("> "),i.shift(2);const o=n.indentLines(n.containerFlow(t,i.current()),qq);return s(),o}function qq(t,e,n){return">"+(n?"":" ")+t}function Kq(t,e){return Uw(t,e.inConstruct,!0)&&!Uw(t,e.notInConstruct,!1)}function Uw(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 Vw(t,e,n,r){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
469
- `&&Kq(n.stack,n.unsafe[s]))return/[ \t]/.test(r.before)?"":" ";return`\\
470
- `}function Gq(t,e){const n=String(t);let r=n.indexOf(e),s=r,i=0,o=0;if(typeof e!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===s?++i>o&&(o=i):i=1,s=r+e.length,r=n.indexOf(e,s);return o}function Jq(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 Yq(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 Zq(t,e,n,r){const s=Yq(n),i=t.value||"",o=s==="`"?"GraveAccent":"Tilde";if(Jq(t,n)){const d=n.enter("codeIndented"),h=n.indentLines(i,Xq);return d(),h}const a=n.createTracker(r),l=s.repeat(Math.max(Gq(i,s)+1,3)),c=n.enter("codeFenced");let u=a.move(l);if(t.lang){const d=n.enter(`codeFencedLang${o}`);u+=a.move(n.safe(t.lang,{before:u,after:" ",encode:["`"],...a.current()})),d()}if(t.lang&&t.meta){const d=n.enter(`codeFencedMeta${o}`);u+=a.move(" "),u+=a.move(n.safe(t.meta,{before:u,after:`
471
- `,encode:["`"],...a.current()})),d()}return u+=a.move(`
472
- `),i&&(u+=a.move(i+`
473
- `)),u+=a.move(l),c(),u}function Xq(t,e,n){return(n?"":" ")+t}function iy(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 Qq(t,e,n,r){const s=iy(n),i=s==='"'?"Quote":"Apostrophe",o=n.enter("definition");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("[");return c+=l.move(n.safe(n.associationId(t),{before:c,after:"]",...l.current()})),c+=l.move("]: "),a(),!t.url||/[\0- \u007F]/.test(t.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(t.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(t.url,{before:c,after:t.title?" ":`
474
- `,...l.current()}))),a(),t.title&&(a=n.enter(`title${i}`),c+=l.move(" "+s),c+=l.move(n.safe(t.title,{before:c,after:s,...l.current()})),c+=l.move(s),a()),o(),c}function e9(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 ic(t){return"&#x"+t.toString(16).toUpperCase()+";"}function Xd(t,e,n){const r=Pa(t),s=Pa(e);return r===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Z_.peek=t9;function Z_(t,e,n,r){const s=e9(n),i=n.enter("emphasis"),o=n.createTracker(r),a=o.move(s);let l=o.move(n.containerPhrasing(t,{after:s,before:a,...o.current()}));const c=l.charCodeAt(0),u=Xd(r.before.charCodeAt(r.before.length-1),c,s);u.inside&&(l=ic(c)+l.slice(1));const d=l.charCodeAt(l.length-1),h=Xd(r.after.charCodeAt(0),d,s);h.inside&&(l=l.slice(0,-1)+ic(d));const p=o.move(s);return i(),n.attentionEncodeSurroundingInfo={after:h.outside,before:u.outside},a+l+p}function t9(t,e,n){return n.options.emphasis||"*"}function oy(t,e,n,r){let s,i,o;typeof e=="function"&&typeof n!="function"?(i=void 0,o=e,s=n):(i=e,o=n,s=r),q_(t,i,a,s);function a(l,c){const u=c[c.length-1],d=u?u.children.indexOf(l):void 0;return o(l,d,u)}}function n9(t,e){let n=!1;return oy(t,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,ng}),!!((!t.depth||t.depth<3)&&ny(t)&&(e.options.setext||n))}function r9(t,e,n,r){const s=Math.max(Math.min(6,t.depth||1),1),i=n.createTracker(r);if(n9(t,n)){const u=n.enter("headingSetext"),d=n.enter("phrasing"),h=n.containerPhrasing(t,{...i.current(),before:`
475
- `,after:`
476
- `});return d(),u(),h+`
477
- `+(s===1?"=":"-").repeat(h.length-(Math.max(h.lastIndexOf("\r"),h.lastIndexOf(`
478
- `))+1))}const o="#".repeat(s),a=n.enter("headingAtx"),l=n.enter("phrasing");i.move(o+" ");let c=n.containerPhrasing(t,{before:"# ",after:`
479
- `,...i.current()});return/^[\t ]/.test(c)&&(c=ic(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,n.options.closeAtx&&(c+=" "+o),l(),a(),c}X_.peek=s9;function X_(t){return t.value||""}function s9(){return"<"}Q_.peek=i9;function Q_(t,e,n,r){const s=iy(n),i=s==='"'?"Quote":"Apostrophe",o=n.enter("image");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("![");return c+=l.move(n.safe(t.alt,{before:c,after:"]",...l.current()})),c+=l.move("]("),a(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(t.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(t.url,{before:c,after:t.title?" ":")",...l.current()}))),a(),t.title&&(a=n.enter(`title${i}`),c+=l.move(" "+s),c+=l.move(n.safe(t.title,{before:c,after:s,...l.current()})),c+=l.move(s),a()),c+=l.move(")"),o(),c}function i9(){return"!"}eT.peek=o9;function eT(t,e,n,r){const s=t.referenceType,i=n.enter("imageReference");let o=n.enter("label");const a=n.createTracker(r);let l=a.move("![");const c=n.safe(t.alt,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),o();const u=n.stack;n.stack=[],o=n.enter("reference");const d=n.safe(n.associationId(t),{before:l,after:"]",...a.current()});return o(),n.stack=u,i(),s==="full"||!c||c!==d?l+=a.move(d+"]"):s==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function o9(){return"!"}tT.peek=a9;function tT(t,e,n){let r=t.value||"",s="`",i=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i<n.unsafe.length;){const o=n.unsafe[i],a=n.compilePattern(o);let l;if(o.atBreak)for(;l=a.exec(r);){let c=l.index;r.charCodeAt(c)===10&&r.charCodeAt(c-1)===13&&c--,r=r.slice(0,c)+" "+r.slice(l.index+1)}}return s+r+s}function a9(){return"`"}function nT(t,e){const n=ny(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))}rT.peek=l9;function rT(t,e,n,r){const s=iy(n),i=s==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let a,l;if(nT(t,n)){const u=n.stack;n.stack=[],a=n.enter("autolink");let d=o.move("<");return d+=o.move(n.containerPhrasing(t,{before:d,after:">",...o.current()})),d+=o.move(">"),a(),n.stack=u,d}a=n.enter("link"),l=n.enter("label");let c=o.move("[");return c+=o.move(n.containerPhrasing(t,{before:c,after:"](",...o.current()})),c+=o.move("]("),l(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(l=n.enter("destinationLiteral"),c+=o.move("<"),c+=o.move(n.safe(t.url,{before:c,after:">",...o.current()})),c+=o.move(">")):(l=n.enter("destinationRaw"),c+=o.move(n.safe(t.url,{before:c,after:t.title?" ":")",...o.current()}))),l(),t.title&&(l=n.enter(`title${i}`),c+=o.move(" "+s),c+=o.move(n.safe(t.title,{before:c,after:s,...o.current()})),c+=o.move(s),l()),c+=o.move(")"),a(),c}function l9(t,e,n){return nT(t,n)?"<":"["}sT.peek=c9;function sT(t,e,n,r){const s=t.referenceType,i=n.enter("linkReference");let o=n.enter("label");const a=n.createTracker(r);let l=a.move("[");const c=n.containerPhrasing(t,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),o();const u=n.stack;n.stack=[],o=n.enter("reference");const d=n.safe(n.associationId(t),{before:l,after:"]",...a.current()});return o(),n.stack=u,i(),s==="full"||!c||c!==d?l+=a.move(d+"]"):s==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function c9(){return"["}function ay(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 u9(t){const e=ay(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 d9(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 iT(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 f9(t,e,n,r){const s=n.enter("list"),i=n.bulletCurrent;let o=t.ordered?d9(n):ay(n);const a=t.ordered?o==="."?")":".":u9(n);let l=e&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!t.ordered){const u=t.children?t.children[0]:void 0;if((o==="*"||o==="-")&&u&&(!u.children||!u.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),iT(n)===o&&u){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&&(o=a),n.bulletCurrent=o;const c=n.containerFlow(t,r);return n.bulletLastUsed=o,n.bulletCurrent=i,s(),c}function h9(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 p9(t,e,n,r){const s=h9(n);let i=n.bulletCurrent||ay(n);e&&e.type==="list"&&e.ordered&&(i=(typeof e.start=="number"&&e.start>-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+i);let o=i.length+1;(s==="tab"||s==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(o=Math.ceil(o/4)*4);const a=n.createTracker(r);a.move(i+" ".repeat(o-i.length)),a.shift(o);const l=n.enter("listItem"),c=n.indentLines(n.containerFlow(t,a.current()),u);return l(),c;function u(d,h,p){return h?(p?"":" ".repeat(o))+d:(p?i:i+" ".repeat(o-i.length))+d}}function m9(t,e,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),o=n.containerPhrasing(t,r);return i(),s(),o}const g9=ih(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function b9(t,e,n,r){return(t.children.some(function(o){return g9(o)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function y9(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}oT.peek=x9;function oT(t,e,n,r){const s=y9(n),i=n.enter("strong"),o=n.createTracker(r),a=o.move(s+s);let l=o.move(n.containerPhrasing(t,{after:s,before:a,...o.current()}));const c=l.charCodeAt(0),u=Xd(r.before.charCodeAt(r.before.length-1),c,s);u.inside&&(l=ic(c)+l.slice(1));const d=l.charCodeAt(l.length-1),h=Xd(r.after.charCodeAt(0),d,s);h.inside&&(l=l.slice(0,-1)+ic(d));const p=o.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:h.outside,before:u.outside},a+l+p}function x9(t,e,n){return n.options.strong||"*"}function v9(t,e,n,r){return n.safe(t.value,r)}function w9(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 k9(t,e,n){const r=(iT(n)+(n.options.ruleSpaces?" ":"")).repeat(w9(n));return n.options.ruleSpaces?r.slice(0,-1):r}const aT={blockquote:Wq,break:Vw,code:Zq,definition:Qq,emphasis:Z_,hardBreak:Vw,heading:r9,html:X_,image:Q_,imageReference:eT,inlineCode:tT,link:rT,linkReference:sT,list:f9,listItem:p9,paragraph:m9,root:b9,strong:oT,text:v9,thematicBreak:k9};function S9(){return{enter:{table:E9,tableData:Ww,tableHeader:Ww,tableRow:N9},exit:{codeText:_9,table:C9,tableData:Np,tableHeader:Np,tableRow:Np}}}function E9(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 C9(t){this.exit(t),this.data.inTable=void 0}function N9(t){this.enter({type:"tableRow",children:[]},t)}function Np(t){this.exit(t)}function Ww(t){this.enter({type:"tableCell",children:[]},t)}function _9(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,T9));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function T9(t,e){return e==="|"?e:t}function A9(t){const e=t||{},n=e.tableCellPadding,r=e.tablePipeAlign,s=e.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
480
- `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:h,table:o,tableCell:l,tableRow:a}};function o(p,m,g,b){return c(u(p,g,b),p.align)}function a(p,m,g,b){const x=d(p,g,b),w=c([x]);return w.slice(0,w.indexOf(`
481
- `))}function l(p,m,g,b){const x=g.enter("tableCell"),w=g.enter("phrasing"),v=g.containerPhrasing(p,{...b,before:i,after:i});return w(),x(),v}function c(p,m){return Hq(p,{align:m,alignDelimiters:r,padding:n,stringLength:s})}function u(p,m,g){const b=p.children;let x=-1;const w=[],v=m.enter("table");for(;++x<b.length;)w[x]=d(b[x],m,g);return v(),w}function d(p,m,g){const b=p.children;let x=-1;const w=[],v=m.enter("tableRow");for(;++x<b.length;)w[x]=l(b[x],p,m,g);return v(),w}function h(p,m,g){let b=aT.inlineCode(p,m,g);return g.stack.includes("tableCell")&&(b=b.replace(/\|/g,"\\$&")),b}}function M9(){return{exit:{taskListCheckValueChecked:qw,taskListCheckValueUnchecked:qw,paragraph:O9}}}function R9(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:I9}}}function qw(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function O9(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 s=e.children;let i=-1,o;for(;++i<s.length;){const a=s[i];if(a.type==="paragraph"){o=a;break}}o===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 I9(t,e,n,r){const s=t.children[0],i=typeof t.checked=="boolean"&&s&&s.type==="paragraph",o="["+(t.checked?"x":" ")+"] ",a=n.createTracker(r);i&&a.move(o);let l=aT.listItem(t,e,n,{...r,...a.current()});return i&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),l;function c(u){return u+o}}function D9(){return[dq(),Oq(),Pq(),S9(),M9()]}function L9(t){return{extensions:[fq(),Iq(t),jq(),A9(t),R9()]}}const P9={tokenize:H9,partial:!0},lT={tokenize:U9,partial:!0},cT={tokenize:V9,partial:!0},uT={tokenize:W9,partial:!0},j9={tokenize:q9,partial:!0},dT={name:"wwwAutolink",tokenize:B9,previous:hT},fT={name:"protocolAutolink",tokenize:$9,previous:pT},Ls={name:"emailAutolink",tokenize:F9,previous:mT},rs={};function z9(){return{text:rs}}let Fi=48;for(;Fi<123;)rs[Fi]=Ls,Fi++,Fi===58?Fi=65:Fi===91&&(Fi=97);rs[43]=Ls;rs[45]=Ls;rs[46]=Ls;rs[95]=Ls;rs[72]=[Ls,fT];rs[104]=[Ls,fT];rs[87]=[Ls,dT];rs[119]=[Ls,dT];function F9(t,e,n){const r=this;let s,i;return o;function o(d){return!rg(d)||!mT.call(r,r.previous)||ly(r.events)?n(d):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),a(d))}function a(d){return rg(d)?(t.consume(d),a):d===64?(t.consume(d),l):n(d)}function l(d){return d===46?t.check(j9,u,c)(d):d===45||d===95||Nn(d)?(i=!0,t.consume(d),l):u(d)}function c(d){return t.consume(d),s=!0,l}function u(d){return i&&s&&jn(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(d)):n(d)}}function B9(t,e,n){const r=this;return s;function s(o){return o!==87&&o!==119||!hT.call(r,r.previous)||ly(r.events)?n(o):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(P9,t.attempt(lT,t.attempt(cT,i),n),n)(o))}function i(o){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(o)}}function $9(t,e,n){const r=this;let s="",i=!1;return o;function o(d){return(d===72||d===104)&&pT.call(r,r.previous)&&!ly(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),s+=String.fromCodePoint(d),t.consume(d),a):n(d)}function a(d){if(jn(d)&&s.length<5)return s+=String.fromCodePoint(d),t.consume(d),a;if(d===58){const h=s.toLowerCase();if(h==="http"||h==="https")return t.consume(d),l}return n(d)}function l(d){return d===47?(t.consume(d),i?c:(i=!0,l)):n(d)}function c(d){return d===null||Yd(d)||vt(d)||No(d)||rh(d)?n(d):t.attempt(lT,t.attempt(cT,u),n)(d)}function u(d){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(d)}}function H9(t,e,n){let r=0;return s;function s(o){return(o===87||o===119)&&r<3?(r++,t.consume(o),s):o===46&&r===3?(t.consume(o),i):n(o)}function i(o){return o===null?n(o):e(o)}}function U9(t,e,n){let r,s,i;return o;function o(c){return c===46||c===95?t.check(uT,l,a)(c):c===null||vt(c)||No(c)||c!==45&&rh(c)?l(c):(i=!0,t.consume(c),o)}function a(c){return c===95?r=!0:(s=r,r=void 0),t.consume(c),o}function l(c){return s||r||!i?n(c):e(c)}}function V9(t,e){let n=0,r=0;return s;function s(o){return o===40?(n++,t.consume(o),s):o===41&&r<n?i(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?t.check(uT,e,i)(o):o===null||vt(o)||No(o)?e(o):(t.consume(o),s)}function i(o){return o===41&&r++,t.consume(o),s}}function W9(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),i):a===93?(t.consume(a),s):a===60||a===null||vt(a)||No(a)?e(a):n(a)}function s(a){return a===null||a===40||a===91||vt(a)||No(a)?e(a):r(a)}function i(a){return jn(a)?o(a):n(a)}function o(a){return a===59?(t.consume(a),r):jn(a)?(t.consume(a),o):n(a)}}function q9(t,e,n){return r;function r(i){return t.consume(i),s}function s(i){return Nn(i)?n(i):e(i)}}function hT(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||vt(t)}function pT(t){return!jn(t)}function mT(t){return!(t===47||rg(t))}function rg(t){return t===43||t===45||t===46||t===95||Nn(t)}function ly(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}const K9={tokenize:t6,partial:!0};function G9(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:X9,continuation:{tokenize:Q9},exit:e6}},text:{91:{name:"gfmFootnoteCall",tokenize:Z9},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:J9,resolveTo:Y9}}}}function J9(t,e,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;s--;){const l=r.events[s][1];if(l.type==="labelImage"){o=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(!o||!o._balanced)return n(l);const c=Pr(r.sliceSerialize({start:o.end,end:r.now()}));return c.codePointAt(0)!==94||!i.includes(c.slice(1))?n(l):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(l),t.exit("gfmFootnoteCallLabelMarker"),e(l))}}function Y9(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)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},t[t.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},a=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",s,e],["exit",s,e],["enter",i,e],["enter",o,e],["exit",o,e],["exit",i,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...a),t}function Z9(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,o;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",c)}function c(d){if(i>999||d===93&&!o||d===null||d===91||vt(d))return n(d);if(d===93){t.exit("chunkString");const h=t.exit("gfmFootnoteCallString");return s.includes(Pr(r.sliceSerialize(h)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(d)}return vt(d)||(o=!0),i++,t.consume(d),d===92?u:c}function u(d){return d===91||d===92||d===93?(t.consume(d),i++,c):c(d)}}function X9(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,o=0,a;return l;function l(m){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(m){return m===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",u):n(m)}function u(m){if(o>999||m===93&&!a||m===null||m===91||vt(m))return n(m);if(m===93){t.exit("chunkString");const g=t.exit("gfmFootnoteDefinitionLabelString");return i=Pr(r.sliceSerialize(g)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(m),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),h}return vt(m)||(a=!0),o++,t.consume(m),m===92?d:u}function d(m){return m===91||m===92||m===93?(t.consume(m),o++,u):u(m)}function h(m){return m===58?(t.enter("definitionMarker"),t.consume(m),t.exit("definitionMarker"),s.includes(i)||s.push(i),nt(t,p,"gfmFootnoteDefinitionWhitespace")):n(m)}function p(m){return e(m)}}function Q9(t,e,n){return t.check(Kc,e,t.attempt(K9,e,n))}function e6(t){t.exit("gfmFootnoteDefinition")}function t6(t,e,n){const r=this;return nt(t,s,"gfmFootnoteDefinitionIndent",5);function s(i){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?e(i):n(i)}}function n6(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(o,a){let l=-1;for(;++l<o.length;)if(o[l][0]==="enter"&&o[l][1].type==="strikethroughSequenceTemporary"&&o[l][1]._close){let c=l;for(;c--;)if(o[c][0]==="exit"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._open&&o[l][1].end.offset-o[l][1].start.offset===o[c][1].end.offset-o[c][1].start.offset){o[l][1].type="strikethroughSequence",o[c][1].type="strikethroughSequence";const u={type:"strikethrough",start:Object.assign({},o[c][1].start),end:Object.assign({},o[l][1].end)},d={type:"strikethroughText",start:Object.assign({},o[c][1].end),end:Object.assign({},o[l][1].start)},h=[["enter",u,a],["enter",o[c][1],a],["exit",o[c][1],a],["enter",d,a]],p=a.parser.constructs.insideSpan.null;p&&cr(h,h.length,0,sh(p,o.slice(c+1,l),a)),cr(h,h.length,0,[["exit",d,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",u,a]]),cr(o,c-1,l-c+3,h),l=c+h.length-2;break}}for(l=-1;++l<o.length;)o[l][1].type==="strikethroughSequenceTemporary"&&(o[l][1].type="data");return o}function i(o,a,l){const c=this.previous,u=this.events;let d=0;return h;function h(m){return c===126&&u[u.length-1][1].type!=="characterEscape"?l(m):(o.enter("strikethroughSequenceTemporary"),p(m))}function p(m){const g=Pa(c);if(m===126)return d>1?l(m):(o.consume(m),d++,p);if(d<2&&!n)return l(m);const b=o.exit("strikethroughSequenceTemporary"),x=Pa(m);return b._open=!x||x===2&&!!g,b._close=!g||g===2&&!!x,a(m)}}}class r6{constructor(){this.map=[]}add(e,n,r){s6(this,e,n,r)}consume(e){if(this.map.sort(function(i,o){return i[0]-o[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 s=r.pop();for(;s;){for(const i of s)e.push(i);s=r.pop()}this.map.length=0}}function s6(t,e,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s<t.map.length;){if(t.map[s][0]===e){t.map[s][1]+=n,t.map[s][2].push(...r);return}s+=1}t.map.push([e,n,r])}}function i6(t,e){let n=!1;const r=[];for(;e<t.length;){const s=t[e];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&r.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const i=r.length-1;r[i]=r[i]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);e+=1}return r}function o6(){return{flow:{null:{name:"table",tokenize:a6,resolveAll:l6}}}}function a6(t,e,n){const r=this;let s=0,i=0,o;return a;function a(_){let I=r.events.length-1;for(;I>-1;){const j=r.events[I][1].type;if(j==="lineEnding"||j==="linePrefix")I--;else break}const D=I>-1?r.events[I][1].type:null,V=D==="tableHead"||D==="tableRow"?S:l;return V===S&&r.parser.lazy[r.now().line]?n(_):V(_)}function l(_){return t.enter("tableHead"),t.enter("tableRow"),c(_)}function c(_){return _===124||(o=!0,i+=1),u(_)}function u(_){return _===null?n(_):Ie(_)?i>1?(i=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(_),t.exit("lineEnding"),p):n(_):Ze(_)?nt(t,u,"whitespace")(_):(i+=1,o&&(o=!1,s+=1),_===124?(t.enter("tableCellDivider"),t.consume(_),t.exit("tableCellDivider"),o=!0,u):(t.enter("data"),d(_)))}function d(_){return _===null||_===124||vt(_)?(t.exit("data"),u(_)):(t.consume(_),_===92?h:d)}function h(_){return _===92||_===124?(t.consume(_),d):d(_)}function p(_){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(_):(t.enter("tableDelimiterRow"),o=!1,Ze(_)?nt(t,m,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):m(_))}function m(_){return _===45||_===58?b(_):_===124?(o=!0,t.enter("tableCellDivider"),t.consume(_),t.exit("tableCellDivider"),g):N(_)}function g(_){return Ze(_)?nt(t,b,"whitespace")(_):b(_)}function b(_){return _===58?(i+=1,o=!0,t.enter("tableDelimiterMarker"),t.consume(_),t.exit("tableDelimiterMarker"),x):_===45?(i+=1,x(_)):_===null||Ie(_)?k(_):N(_)}function x(_){return _===45?(t.enter("tableDelimiterFiller"),w(_)):N(_)}function w(_){return _===45?(t.consume(_),w):_===58?(o=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(_),t.exit("tableDelimiterMarker"),v):(t.exit("tableDelimiterFiller"),v(_))}function v(_){return Ze(_)?nt(t,k,"whitespace")(_):k(_)}function k(_){return _===124?m(_):_===null||Ie(_)?!o||s!==i?N(_):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(_)):N(_)}function N(_){return n(_)}function S(_){return t.enter("tableRow"),C(_)}function C(_){return _===124?(t.enter("tableCellDivider"),t.consume(_),t.exit("tableCellDivider"),C):_===null||Ie(_)?(t.exit("tableRow"),e(_)):Ze(_)?nt(t,C,"whitespace")(_):(t.enter("data"),T(_))}function T(_){return _===null||_===124||vt(_)?(t.exit("data"),C(_)):(t.consume(_),_===92?R:T)}function R(_){return _===92||_===124?(t.consume(_),T):T(_)}}function l6(t,e){let n=-1,r=!0,s=0,i=[0,0,0,0],o=[0,0,0,0],a=!1,l=0,c,u,d;const h=new r6;for(;++n<t.length;){const p=t[n],m=p[1];p[0]==="enter"?m.type==="tableHead"?(a=!1,l!==0&&(Kw(h,e,l,c,u),u=void 0,l=0),c={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},h.add(n,0,[["enter",c,e]])):m.type==="tableRow"||m.type==="tableDelimiterRow"?(r=!0,d=void 0,i=[0,0,0,0],o=[0,n+1,0,0],a&&(a=!1,u={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},h.add(n,0,[["enter",u,e]])),s=m.type==="tableDelimiterRow"?2:u?3:1):s&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(i[1]!==0&&(o[0]=o[1],d=Su(h,e,i,s,void 0,d),i=[0,0,0,0]),o[2]=n)):m.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(o[0]=o[1],d=Su(h,e,i,s,void 0,d)),i=o,o=[i[1],n,0,0])):m.type==="tableHead"?(a=!0,l=n):m.type==="tableRow"||m.type==="tableDelimiterRow"?(l=n,i[1]!==0?(o[0]=o[1],d=Su(h,e,i,s,n,d)):o[1]!==0&&(d=Su(h,e,o,s,n,d)),s=0):s&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(o[3]=n)}for(l!==0&&Kw(h,e,l,c,u),h.consume(e.events),n=-1;++n<e.events.length;){const p=e.events[n];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=i6(e.events,n))}return t}function Su(t,e,n,r,s,i){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(i.end=Object.assign({},Zo(e.events,n[0])),t.add(n[0],0,[["exit",i,e]]));const l=Zo(e.events,n[1]);if(i={type:o,start:Object.assign({},l),end:Object.assign({},l)},t.add(n[1],0,[["enter",i,e]]),n[2]!==0){const c=Zo(e.events,n[2]),u=Zo(e.events,n[3]),d={type:a,start:Object.assign({},c),end:Object.assign({},u)};if(t.add(n[2],0,[["enter",d,e]]),r!==2){const h=e.events[n[2]],p=e.events[n[3]];if(h[1].end=Object.assign({},p[1].end),h[1].type="chunkText",h[1].contentType="text",n[3]>n[2]+1){const m=n[2]+1,g=n[3]-n[2]-1;t.add(m,g,[])}}t.add(n[3]+1,0,[["exit",d,e]])}return s!==void 0&&(i.end=Object.assign({},Zo(e.events,s)),t.add(s,0,[["exit",i,e]]),i=void 0),i}function Kw(t,e,n,r,s){const i=[],o=Zo(e.events,n);s&&(s.end=Object.assign({},o),i.push(["exit",s,e])),r.end=Object.assign({},o),i.push(["exit",r,e]),t.add(n+1,0,i)}function Zo(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const c6={name:"tasklistCheck",tokenize:d6};function u6(){return{text:{91:c6}}}function d6(t,e,n){const r=this;return s;function s(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),i)}function i(l){return vt(l)?(t.enter("taskListCheckValueUnchecked"),t.consume(l),t.exit("taskListCheckValueUnchecked"),o):l===88||l===120?(t.enter("taskListCheckValueChecked"),t.consume(l),t.exit("taskListCheckValueChecked"),o):n(l)}function o(l){return l===93?(t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),a):n(l)}function a(l){return Ie(l)?e(l):Ze(l)?t.check({tokenize:f6},e,n)(l):n(l)}}function f6(t,e,n){return nt(t,r,"whitespace");function r(s){return s===null?n(s):e(s)}}function h6(t){return R_([z9(),G9(),n6(t),o6(),u6()])}const p6={};function cy(t){const e=this,n=t||p6,r=e.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(h6(n)),i.push(D9()),o.push(L9(n))}function m6(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 g6(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
482
- `}]}function b6(t,e){const n=e.value?e.value+`
483
- `:"",r={};e.lang&&(r.className=["language-"+e.lang]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return e.meta&&(s.data={meta:e.meta}),t.patch(e,s),s=t.applyData(e,s),s={type:"element",tagName:"pre",properties:{},children:[s]},t.patch(e,s),s}function y6(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function x6(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function v6(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=String(e.identifier).toUpperCase(),s=Za(r.toLowerCase()),i=t.footnoteOrder.indexOf(r);let o,a=t.footnoteCounts.get(r);a===void 0?(a=0,t.footnoteOrder.push(r),o=t.footnoteOrder.length):o=i+1,a+=1,t.footnoteCounts.set(r,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};t.patch(e,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return t.patch(e,c),t.applyData(e,c)}function w6(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 k6(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function gT(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 s=t.all(e),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const o=s[s.length-1];return o&&o.type==="text"?o.value+=r:s.push({type:"text",value:r}),s}function S6(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return gT(t,e);const s={src:Za(r.url||""),alt:e.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return t.patch(e,i),t.applyData(e,i)}function E6(t,e){const n={src:Za(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 C6(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 N6(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return gT(t,e);const s={href:Za(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:t.all(e)};return t.patch(e,i),t.applyData(e,i)}function _6(t,e){const n={href:Za(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 T6(t,e,n){const r=t.all(e),s=n?A6(n):bT(e),i={},o=[];if(typeof e.checked=="boolean"){const u=r[0];let d;u&&u.type==="element"&&u.tagName==="p"?d=u:(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:[]}),i.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const u=r[a];(s||a!==0||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
484
- `}),u.type==="element"&&u.tagName==="p"&&!s?o.push(...u.children):o.push(u)}const l=r[r.length-1];l&&(s||l.type!=="element"||l.tagName!=="p")&&o.push({type:"text",value:`
485
- `});const c={type:"element",tagName:"li",properties:i,children:o};return t.patch(e,c),t.applyData(e,c)}function A6(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=bT(n[r])}return e}function bT(t){const e=t.spread;return e??t.children.length>1}function M6(t,e){const n={},r=t.all(e);let s=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++s<r.length;){const o=r[s];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:e.ordered?"ol":"ul",properties:n,children:t.wrap(r,!0)};return t.patch(e,i),t.applyData(e,i)}function R6(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function O6(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)}function I6(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}const yT=xT("end"),uy=xT("start");function xT(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 D6(t){const e=uy(t),n=yT(t);if(e&&n)return{start:e,end:n}}function L6(t,e){const n=t.all(e),r=n.shift(),s=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:t.wrap([r],!0)};t.patch(e.children[0],o),s.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},a=uy(e.children[1]),l=yT(e.children[e.children.length-1]);a&&l&&(o.position={start:a,end:l}),s.push(o)}const i={type:"element",tagName:"table",properties:{},children:t.wrap(s,!0)};return t.patch(e,i),t.applyData(e,i)}function P6(t,e,n){const r=n?n.children:void 0,i=(r?r.indexOf(e):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,a=o?o.length:e.children.length;let l=-1;const c=[];for(;++l<a;){const d=e.children[l],h={},p=o?o[l]:void 0;p&&(h.align=p);let m={type:"element",tagName:i,properties:h,children:[]};d&&(m.children=t.all(d),t.patch(d,m),m=t.applyData(d,m)),c.push(m)}const u={type:"element",tagName:"tr",properties:{},children:t.wrap(c,!0)};return t.patch(e,u),t.applyData(e,u)}function j6(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}const Gw=9,Jw=32;function z6(t){const e=String(t),n=/\r?\n|\r/g;let r=n.exec(e),s=0;const i=[];for(;r;)i.push(Yw(e.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(e);return i.push(Yw(e.slice(s),s>0,!1)),i.join("")}function Yw(t,e,n){let r=0,s=t.length;if(e){let i=t.codePointAt(r);for(;i===Gw||i===Jw;)r++,i=t.codePointAt(r)}if(n){let i=t.codePointAt(s-1);for(;i===Gw||i===Jw;)s--,i=t.codePointAt(s-1)}return s>r?t.slice(r,s):""}function F6(t,e){const n={type:"text",value:z6(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function B6(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const $6={blockquote:m6,break:g6,code:b6,delete:y6,emphasis:x6,footnoteReference:v6,heading:w6,html:k6,imageReference:S6,image:E6,inlineCode:C6,linkReference:N6,link:_6,listItem:T6,list:M6,paragraph:R6,root:O6,strong:I6,table:L6,tableCell:j6,tableRow:P6,text:F6,thematicBreak:B6,toml:Eu,yaml:Eu,definition:Eu,footnoteDefinition:Eu};function Eu(){}const vT=-1,ah=0,Fl=1,Qd=2,dy=3,fy=4,hy=5,py=6,wT=7,kT=8,Zw=typeof self=="object"?self:globalThis,H6=(t,e)=>{const n=(s,i)=>(t.set(i,s),s),r=s=>{if(t.has(s))return t.get(s);const[i,o]=e[s];switch(i){case ah:case vT:return n(o,s);case Fl:{const a=n([],s);for(const l of o)a.push(r(l));return a}case Qd:{const a=n({},s);for(const[l,c]of o)a[r(l)]=r(c);return a}case dy:return n(new Date(o),s);case fy:{const{source:a,flags:l}=o;return n(new RegExp(a,l),s)}case hy:{const a=n(new Map,s);for(const[l,c]of o)a.set(r(l),r(c));return a}case py:{const a=n(new Set,s);for(const l of o)a.add(r(l));return a}case wT:{const{name:a,message:l}=o;return n(new Zw[a](l),s)}case kT:return n(BigInt(o),s);case"BigInt":return n(Object(BigInt(o)),s);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return n(new DataView(a),o)}}return n(new Zw[i](o),s)};return r},Xw=t=>H6(new Map,t)(0),Ho="",{toString:U6}={},{keys:V6}=Object,dl=t=>{const e=typeof t;if(e!=="object"||!t)return[ah,e];const n=U6.call(t).slice(8,-1);switch(n){case"Array":return[Fl,Ho];case"Object":return[Qd,Ho];case"Date":return[dy,Ho];case"RegExp":return[fy,Ho];case"Map":return[hy,Ho];case"Set":return[py,Ho];case"DataView":return[Fl,n]}return n.includes("Array")?[Fl,n]:n.includes("Error")?[wT,n]:[Qd,n]},Cu=([t,e])=>t===ah&&(e==="function"||e==="symbol"),W6=(t,e,n,r)=>{const s=(o,a)=>{const l=r.push(o)-1;return n.set(a,l),l},i=o=>{if(n.has(o))return n.get(o);let[a,l]=dl(o);switch(a){case ah:{let u=o;switch(l){case"bigint":a=kT,u=o.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return s([vT],o)}return s([a,u],o)}case Fl:{if(l){let h=o;return l==="DataView"?h=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(h=new Uint8Array(o)),s([l,[...h]],o)}const u=[],d=s([a,u],o);for(const h of o)u.push(i(h));return d}case Qd:{if(l)switch(l){case"BigInt":return s([l,o.toString()],o);case"Boolean":case"Number":case"String":return s([l,o.valueOf()],o)}if(e&&"toJSON"in o)return i(o.toJSON());const u=[],d=s([a,u],o);for(const h of V6(o))(t||!Cu(dl(o[h])))&&u.push([i(h),i(o[h])]);return d}case dy:return s([a,o.toISOString()],o);case fy:{const{source:u,flags:d}=o;return s([a,{source:u,flags:d}],o)}case hy:{const u=[],d=s([a,u],o);for(const[h,p]of o)(t||!(Cu(dl(h))||Cu(dl(p))))&&u.push([i(h),i(p)]);return d}case py:{const u=[],d=s([a,u],o);for(const h of o)(t||!Cu(dl(h)))&&u.push(i(h));return d}}const{message:c}=o;return s([a,{name:l,message:c}],o)};return i},Qw=(t,{json:e,lossy:n}={})=>{const r=[];return W6(!(e||n),!!e,new Map,r)(t),r},ef=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?Xw(Qw(t,e)):structuredClone(t):(t,e)=>Xw(Qw(t,e));function q6(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 K6(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function G6(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||q6,r=t.options.footnoteBackLabel||K6,s=t.options.footnoteLabel||"Footnotes",i=t.options.footnoteLabelTagName||"h2",o=t.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let l=-1;for(;++l<t.footnoteOrder.length;){const c=t.footnoteById.get(t.footnoteOrder[l]);if(!c)continue;const u=t.all(c),d=String(c.identifier).toUpperCase(),h=Za(d.toLowerCase());let p=0;const m=[],g=t.footnoteCounts.get(d);for(;g!==void 0&&++p<=g;){m.length>0&&m.push({type:"text",value:" "});let w=typeof n=="string"?n:n(l,p);typeof w=="string"&&(w={type:"text",value:w}),m.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+h+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,p),className:["data-footnote-backref"]},children:Array.isArray(w)?w:[w]})}const b=u[u.length-1];if(b&&b.type==="element"&&b.tagName==="p"){const w=b.children[b.children.length-1];w&&w.type==="text"?w.value+=" ":b.children.push({type:"text",value:" "}),b.children.push(...m)}else u.push(...m);const x={type:"element",tagName:"li",properties:{id:e+"fn-"+h},children:t.wrap(u,!0)};t.patch(c,x),a.push(x)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...ef(o),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
486
- `},{type:"element",tagName:"ol",properties:{},children:t.wrap(a,!0)},{type:"text",value:`
487
- `}]}}const sg={}.hasOwnProperty,J6={};function Y6(t,e){const n=e||J6,r=new Map,s=new Map,i=new Map,o={...$6,...n.handlers},a={all:c,applyData:X6,definitionById:r,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:o,one:l,options:n,patch:Z6,wrap:eK};return oy(t,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){const d=u.type==="definition"?r:s,h=String(u.identifier).toUpperCase();d.has(h)||d.set(h,u)}}),a;function l(u,d){const h=u.type,p=a.handlers[h];if(sg.call(a.handlers,h)&&p)return p(a,u,d);if(a.options.passThrough&&a.options.passThrough.includes(h)){if("children"in u){const{children:g,...b}=u,x=ef(b);return x.children=a.all(u),x}return ef(u)}return(a.options.unknownHandler||Q6)(a,u,d)}function c(u){const d=[];if("children"in u){const h=u.children;let p=-1;for(;++p<h.length;){const m=a.one(h[p],u);if(m){if(p&&h[p-1].type==="break"&&(!Array.isArray(m)&&m.type==="text"&&(m.value=e0(m.value)),!Array.isArray(m)&&m.type==="element")){const g=m.children[0];g&&g.type==="text"&&(g.value=e0(g.value))}Array.isArray(m)?d.push(...m):d.push(m)}}}return d}}function Z6(t,e){t.position&&(e.position=D6(t))}function X6(t,e){let n=e;if(t&&t.data){const r=t.data.hName,s=t.data.hChildren,i=t.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const o="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:o}}n.type==="element"&&i&&Object.assign(n.properties,ef(i)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function Q6(t,e){const n=e.data||{},r="value"in e&&!(sg.call(n,"hProperties")||sg.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 eK(t,e){const n=[];let r=-1;for(e&&n.push({type:"text",value:`
488
- `});++r<t.length;)r&&n.push({type:"text",value:`
489
- `}),n.push(t[r]);return e&&t.length>0&&n.push({type:"text",value:`
490
- `}),n}function e0(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function t0(t,e){const n=Y6(t,e),r=n.one(t,void 0),s=G6(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:`
491
- `},s),i}function ST(t,e){return t&&"run"in t?async function(n,r){const s=t0(n,{file:r,...e});await t.run(s,r)}:function(n,r){return t0(n,{file:r,...t||e})}}const tK=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class Gc{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}Gc.prototype.normal={};Gc.prototype.property={};Gc.prototype.space=void 0;function ET(t,e){const n={},r={};for(const s of t)Object.assign(n,s.property),Object.assign(r,s.normal);return new Gc(n,r,e)}function ig(t){return t.toLowerCase()}class tr{constructor(e,n){this.attribute=n,this.property=e}}tr.prototype.attribute="";tr.prototype.booleanish=!1;tr.prototype.boolean=!1;tr.prototype.commaOrSpaceSeparated=!1;tr.prototype.commaSeparated=!1;tr.prototype.defined=!1;tr.prototype.mustUseProperty=!1;tr.prototype.number=!1;tr.prototype.overloadedBoolean=!1;tr.prototype.property="";tr.prototype.spaceSeparated=!1;tr.prototype.space=void 0;let nK=0;const Ve=jo(),Gt=jo(),og=jo(),te=jo(),Et=jo(),ua=jo(),sr=jo();function jo(){return 2**++nK}const ag=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ve,booleanish:Gt,commaOrSpaceSeparated:sr,commaSeparated:ua,number:te,overloadedBoolean:og,spaceSeparated:Et},Symbol.toStringTag,{value:"Module"})),_p=Object.keys(ag);class my extends tr{constructor(e,n,r,s){let i=-1;if(super(e,n),n0(this,"space",s),typeof r=="number")for(;++i<_p.length;){const o=_p[i];n0(this,_p[i],(r&ag[o])===ag[o])}}}my.prototype.defined=!0;function n0(t,e,n){n&&(t[e]=n)}function Xa(t){const e={},n={};for(const[r,s]of Object.entries(t.properties)){const i=new my(r,t.transform(t.attributes||{},r),s,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),e[r]=i,n[ig(r)]=r,n[ig(i.attribute)]=r}return new Gc(e,n,t.space)}const CT=Xa({properties:{ariaActiveDescendant:null,ariaAtomic:Gt,ariaAutoComplete:null,ariaBusy:Gt,ariaChecked:Gt,ariaColCount:te,ariaColIndex:te,ariaColSpan:te,ariaControls:Et,ariaCurrent:null,ariaDescribedBy:Et,ariaDetails:null,ariaDisabled:Gt,ariaDropEffect:Et,ariaErrorMessage:null,ariaExpanded:Gt,ariaFlowTo:Et,ariaGrabbed:Gt,ariaHasPopup:null,ariaHidden:Gt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Et,ariaLevel:te,ariaLive:null,ariaModal:Gt,ariaMultiLine:Gt,ariaMultiSelectable:Gt,ariaOrientation:null,ariaOwns:Et,ariaPlaceholder:null,ariaPosInSet:te,ariaPressed:Gt,ariaReadOnly:Gt,ariaRelevant:null,ariaRequired:Gt,ariaRoleDescription:Et,ariaRowCount:te,ariaRowIndex:te,ariaRowSpan:te,ariaSelected:Gt,ariaSetSize:te,ariaSort:null,ariaValueMax:te,ariaValueMin:te,ariaValueNow:te,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function NT(t,e){return e in t?t[e]:e}function _T(t,e){return NT(t,e.toLowerCase())}const rK=Xa({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ua,acceptCharset:Et,accessKey:Et,action:null,allow:null,allowFullScreen:Ve,allowPaymentRequest:Ve,allowUserMedia:Ve,alt:null,as:null,async:Ve,autoCapitalize:null,autoComplete:Et,autoFocus:Ve,autoPlay:Ve,blocking:Et,capture:null,charSet:null,checked:Ve,cite:null,className:Et,cols:te,colSpan:null,content:null,contentEditable:Gt,controls:Ve,controlsList:Et,coords:te|ua,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ve,defer:Ve,dir:null,dirName:null,disabled:Ve,download:og,draggable:Gt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ve,formTarget:null,headers:Et,height:te,hidden:og,high:te,href:null,hrefLang:null,htmlFor:Et,httpEquiv:Et,id:null,imageSizes:null,imageSrcSet:null,inert:Ve,inputMode:null,integrity:null,is:null,isMap:Ve,itemId:null,itemProp:Et,itemRef:Et,itemScope:Ve,itemType:Et,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ve,low:te,manifest:null,max:null,maxLength:te,media:null,method:null,min:null,minLength:te,multiple:Ve,muted:Ve,name:null,nonce:null,noModule:Ve,noValidate:Ve,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:Ve,optimum:te,pattern:null,ping:Et,placeholder:null,playsInline:Ve,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ve,referrerPolicy:null,rel:Et,required:Ve,reversed:Ve,rows:te,rowSpan:te,sandbox:Et,scope:null,scoped:Ve,seamless:Ve,selected:Ve,shadowRootClonable:Ve,shadowRootDelegatesFocus:Ve,shadowRootMode:null,shape:null,size:te,sizes:null,slot:null,span:te,spellCheck:Gt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:te,step:null,style:null,tabIndex:te,target:null,title:null,translate:null,type:null,typeMustMatch:Ve,useMap:null,value:Gt,width:te,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Et,axis:null,background:null,bgColor:null,border:te,borderColor:null,bottomMargin:te,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ve,declare:Ve,event:null,face:null,frame:null,frameBorder:null,hSpace:te,leftMargin:te,link:null,longDesc:null,lowSrc:null,marginHeight:te,marginWidth:te,noResize:Ve,noHref:Ve,noShade:Ve,noWrap:Ve,object:null,profile:null,prompt:null,rev:null,rightMargin:te,rules:null,scheme:null,scrolling:Gt,standby:null,summary:null,text:null,topMargin:te,valueType:null,version:null,vAlign:null,vLink:null,vSpace:te,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ve,disableRemotePlayback:Ve,prefix:null,property:null,results:te,security:null,unselectable:null},space:"html",transform:_T}),sK=Xa({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:sr,accentHeight:te,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:te,amplitude:te,arabicForm:null,ascent:te,attributeName:null,attributeType:null,azimuth:te,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:te,by:null,calcMode:null,capHeight:te,className:Et,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:te,diffuseConstant:te,direction:null,display:null,dur:null,divisor:te,dominantBaseline:null,download:Ve,dx:null,dy:null,edgeMode:null,editable:null,elevation:te,enableBackground:null,end:null,event:null,exponent:te,externalResourcesRequired:null,fill:null,fillOpacity:te,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:ua,g2:ua,glyphName:ua,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:te,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:te,horizOriginX:te,horizOriginY:te,id:null,ideographic:te,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:te,k:te,k1:te,k2:te,k3:te,k4:te,kernelMatrix:sr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:te,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:te,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:te,overlineThickness:te,paintOrder:null,panose1:null,path:null,pathLength:te,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Et,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:te,pointsAtY:te,pointsAtZ:te,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:sr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:sr,rev:sr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:sr,requiredFeatures:sr,requiredFonts:sr,requiredFormats:sr,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:te,specularExponent:te,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:te,strikethroughThickness:te,string:null,stroke:null,strokeDashArray:sr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:te,strokeOpacity:te,strokeWidth:null,style:null,surfaceScale:te,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:sr,tabIndex:te,tableValues:null,target:null,targetX:te,targetY:te,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:sr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:te,underlineThickness:te,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:te,values:null,vAlphabetic:te,vMathematical:te,vectorEffect:null,vHanging:te,vIdeographic:te,version:null,vertAdvY:te,vertOriginX:te,vertOriginY:te,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:te,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:NT}),TT=Xa({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()}}),AT=Xa({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:_T}),MT=Xa({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),iK={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},oK=/[A-Z]/g,r0=/-[a-z]/g,aK=/^data[-\w.:]+$/i;function RT(t,e){const n=ig(e);let r=e,s=tr;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&aK.test(e)){if(e.charAt(4)==="-"){const i=e.slice(5).replace(r0,cK);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=e.slice(4);if(!r0.test(i)){let o=i.replace(oK,lK);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}s=my}return new s(r,e)}function lK(t){return"-"+t.toLowerCase()}function cK(t){return t.charAt(1).toUpperCase()}const OT=ET([CT,rK,TT,AT,MT],"html"),Jc=ET([CT,sK,TT,AT,MT],"svg"),uK=/["&'<>`]/g,dK=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,fK=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,hK=/[|\\{}()[\]^$+*?.]/g,s0=new WeakMap;function pK(t,e){if(t=t.replace(e.subset?mK(e.subset):uK,r),e.subset||e.escapeOnly)return t;return t.replace(dK,n).replace(fK,r);function n(s,i,o){return e.format((s.charCodeAt(0)-55296)*1024+s.charCodeAt(1)-56320+65536,o.charCodeAt(i+2),e)}function r(s,i,o){return e.format(s.charCodeAt(0),o.charCodeAt(i+1),e)}}function mK(t){let e=s0.get(t);return e||(e=gK(t),s0.set(t,e)),e}function gK(t){const e=[];let n=-1;for(;++n<t.length;)e.push(t[n].replace(hK,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}const bK=/[\dA-Fa-f]/;function yK(t,e,n){const r="&#x"+t.toString(16).toUpperCase();return n&&e&&!bK.test(String.fromCharCode(e))?r:r+";"}const xK=/\d/;function vK(t,e,n){const r="&#"+String(t);return n&&e&&!xK.test(String.fromCharCode(e))?r:r+";"}const wK=["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"],Tp={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:"€"},kK=["cent","copy","divide","gt","lt","not","para","times"],IT={}.hasOwnProperty,lg={};let Nu;for(Nu in Tp)IT.call(Tp,Nu)&&(lg[Tp[Nu]]=Nu);const SK=/[^\dA-Za-z]/;function EK(t,e,n,r){const s=String.fromCharCode(t);if(IT.call(lg,s)){const i=lg[s],o="&"+i;return n&&wK.includes(i)&&!kK.includes(i)&&(!r||e&&e!==61&&SK.test(String.fromCharCode(e)))?o:o+";"}return""}function CK(t,e,n){let r=yK(t,e,n.omitOptionalSemicolons),s;if((n.useNamedReferences||n.useShortestReferences)&&(s=EK(t,e,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!s)&&n.useShortestReferences){const i=vK(t,e,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return s&&(!n.useShortestReferences||s.length<r.length)?s:r}function da(t,e){return pK(t,Object.assign({format:CK},e))}const NK=/^>|^->|<!--|-->|--!>|<!-$/g,_K=[">"],TK=["<",">"];function AK(t,e,n,r){return r.settings.bogusComments?"<?"+da(t.value,Object.assign({},r.settings.characterReferences,{subset:_K}))+">":"<!--"+t.value.replace(NK,s)+"-->";function s(i){return da(i,Object.assign({},r.settings.characterReferences,{subset:TK}))}}function MK(t,e,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}function DT(t,e){const n=e||{};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function LT(t){return t.join(" ").trim()}const RK=/[ \t\n\f\r]/g;function lh(t){return typeof t=="object"?t.type==="text"?i0(t.value):!1:i0(t)}function i0(t){return t.replace(RK,"")===""}const rn=jT(1),PT=jT(-1),OK=[];function jT(t){return e;function e(n,r,s){const i=n?n.children:OK;let o=(r||0)+t,a=i[o];if(!s)for(;a&&lh(a);)o+=t,a=i[o];return a}}const IK={}.hasOwnProperty;function zT(t){return e;function e(n,r,s){return IK.call(t,n.tagName)&&t[n.tagName](n,r,s)}}const gy=zT({body:LK,caption:Ap,colgroup:Ap,dd:FK,dt:zK,head:Ap,html:DK,li:jK,optgroup:BK,option:$K,p:PK,rp:o0,rt:o0,tbody:UK,td:a0,tfoot:VK,th:a0,thead:HK,tr:WK});function Ap(t,e,n){const r=rn(n,e,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&lh(r.value.charAt(0)))}function DK(t,e,n){const r=rn(n,e);return!r||r.type!=="comment"}function LK(t,e,n){const r=rn(n,e);return!r||r.type!=="comment"}function PK(t,e,n){const r=rn(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 jK(t,e,n){const r=rn(n,e);return!r||r.type==="element"&&r.tagName==="li"}function zK(t,e,n){const r=rn(n,e);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function FK(t,e,n){const r=rn(n,e);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function o0(t,e,n){const r=rn(n,e);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function BK(t,e,n){const r=rn(n,e);return!r||r.type==="element"&&r.tagName==="optgroup"}function $K(t,e,n){const r=rn(n,e);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function HK(t,e,n){const r=rn(n,e);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function UK(t,e,n){const r=rn(n,e);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function VK(t,e,n){return!rn(n,e)}function WK(t,e,n){const r=rn(n,e);return!r||r.type==="element"&&r.tagName==="tr"}function a0(t,e,n){const r=rn(n,e);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const qK=zT({body:JK,colgroup:YK,head:GK,html:KK,tbody:ZK});function KK(t){const e=rn(t,-1);return!e||e.type!=="comment"}function GK(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 JK(t){const e=rn(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&lh(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function YK(t,e,n){const r=PT(n,e),s=rn(t,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&gy(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="col")}function ZK(t,e,n){const r=PT(n,e),s=rn(t,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&gy(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="tr")}const _u={name:[[`
492
- \f\r &/=>`.split(""),`
493
- \f\r "&'/=>\``.split("")],[`\0
494
- \f\r "&'/<=>`.split(""),`\0
495
- \f\r "&'/<=>\``.split("")]],unquoted:[[`
496
- \f\r &>`.split(""),`\0
497
- \f\r "&'<=>\``.split("")],[`\0
498
- \f\r "&'<=>\``.split(""),`\0
499
- \f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function XK(t,e,n,r){const s=r.schema,i=s.space==="svg"?!1:r.settings.omitOptionalTags;let o=s.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(t.tagName.toLowerCase());const a=[];let l;s.space==="html"&&t.tagName==="svg"&&(r.schema=Jc);const c=QK(r,t.properties),u=r.all(s.space==="html"&&t.tagName==="template"?t.content:t);return r.schema=s,u&&(o=!1),(c||!i||!qK(t,e,n))&&(a.push("<",t.tagName,c?" "+c:""),o&&(s.space==="svg"||r.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!r.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&a.push(" "),a.push("/")),a.push(">")),a.push(u),!o&&(!i||!gy(t,e,n))&&a.push("</"+t.tagName+">"),a.join("")}function QK(t,e){const n=[];let r=-1,s;if(e){for(s in e)if(e[s]!==null&&e[s]!==void 0){const i=eG(t,s,e[s]);i&&n.push(i)}}for(;++r<n.length;){const i=t.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&i!=='"'&&i!=="'"&&(n[r]+=" ")}return n.join("")}function eG(t,e,n){const r=RT(t.schema,e),s=t.settings.allowParseErrors&&t.schema.space==="html"?0:1,i=t.settings.allowDangerousCharacters?0:1;let o=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=da(r.attribute,Object.assign({},t.settings.characterReferences,{subset:_u.name[s][i]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?DT:LT)(n,{padLeft:!t.settings.tightCommaSeparatedLists}):String(n),t.settings.collapseEmptyAttributes&&!n)?l:(t.settings.preferUnquoted&&(a=da(n,Object.assign({},t.settings.characterReferences,{attribute:!0,subset:_u.unquoted[s][i]}))),a!==n&&(t.settings.quoteSmart&&Zd(n,o)>Zd(n,t.alternative)&&(o=t.alternative),a=o+da(n,Object.assign({},t.settings.characterReferences,{subset:(o==="'"?_u.single:_u.double)[s][i],attribute:!0}))+o),l+(a&&"="+a))}const tG=["<","&"];function FT(t,e,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?t.value:da(t.value,Object.assign({},r.settings.characterReferences,{subset:tG}))}function nG(t,e,n,r){return r.settings.allowDangerousHtml?t.value:FT(t,e,n,r)}function rG(t,e,n,r){return r.all(t)}const sG=Vq("type",{invalid:iG,unknown:oG,handlers:{comment:AK,doctype:MK,element:XK,raw:nG,root:rG,text:FT}});function iG(t){throw new Error("Expected node, not `"+t+"`")}function oG(t){const e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}const aG={},lG={},cG=[];function uG(t,e){const n=e||aG,r=n.quote||'"',s=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:dG,all:fG,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||tK,characterReferences:n.characterReferences||lG,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?Jc:OT,quote:r,alternative:s}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function dG(t,e,n){return sG(t,e,n,this)}function fG(t){const e=[],n=t&&t.children||cG;let r=-1;for(;++r<n.length;)e[r]=this.one(n[r],r,t);return e.join("")}function hG(t){const e=this,n={...e.data("settings"),...t};e.compiler=r;function r(s){return uG(s,n)}}function pG(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])}return t}function cg(t,e){return Array(e+1).join(t)}function BT(t){return t.replace(/^\n*/,"")}function $T(t){for(var e=t.length;e>0&&t[e-1]===`
500
- `;)e--;return t.substring(0,e)}function HT(t){return $T(BT(t))}var mG=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];function by(t){return yy(t,mG)}var UT=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function VT(t){return yy(t,UT)}function gG(t){return qT(t,UT)}var WT=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function bG(t){return yy(t,WT)}function yG(t){return qT(t,WT)}function yy(t,e){return e.indexOf(t.nodeName)>=0}function qT(t,e){return t.getElementsByTagName&&e.some(function(n){return t.getElementsByTagName(n).length})}var Rn={};Rn.paragraph={filter:"p",replacement:function(t){return`
501
-
502
- `+t+`
503
-
504
- `}};Rn.lineBreak={filter:"br",replacement:function(t,e,n){return n.br+`
505
- `}};Rn.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(t,e,n){var r=Number(e.nodeName.charAt(1));if(n.headingStyle==="setext"&&r<3){var s=cg(r===1?"=":"-",t.length);return`
506
-
507
- `+t+`
508
- `+s+`
509
-
510
- `}else return`
511
-
512
- `+cg("#",r)+" "+t+`
513
-
514
- `}};Rn.blockquote={filter:"blockquote",replacement:function(t){return t=HT(t).replace(/^/gm,"> "),`
515
-
516
- `+t+`
517
-
518
- `}};Rn.list={filter:["ul","ol"],replacement:function(t,e){var n=e.parentNode;return n.nodeName==="LI"&&n.lastElementChild===e?`
519
- `+t:`
520
-
521
- `+t+`
522
-
523
- `}};Rn.listItem={filter:"li",replacement:function(t,e,n){var r=n.bulletListMarker+" ",s=e.parentNode;if(s.nodeName==="OL"){var i=s.getAttribute("start"),o=Array.prototype.indexOf.call(s.children,e);r=(i?Number(i)+o:o+1)+". "}var a=/\n$/.test(t);return t=HT(t)+(a?`
524
- `:""),t=t.replace(/\n/gm,`
525
- `+" ".repeat(r.length)),r+t+(e.nextSibling?`
526
- `:"")}};Rn.indentedCodeBlock={filter:function(t,e){return e.codeBlockStyle==="indented"&&t.nodeName==="PRE"&&t.firstChild&&t.firstChild.nodeName==="CODE"},replacement:function(t,e,n){return`
527
-
528
- `+e.firstChild.textContent.replace(/\n/g,`
529
- `)+`
530
-
531
- `}};Rn.fencedCodeBlock={filter:function(t,e){return e.codeBlockStyle==="fenced"&&t.nodeName==="PRE"&&t.firstChild&&t.firstChild.nodeName==="CODE"},replacement:function(t,e,n){for(var r=e.firstChild.getAttribute("class")||"",s=(r.match(/language-(\S+)/)||[null,""])[1],i=e.firstChild.textContent,o=n.fence.charAt(0),a=3,l=new RegExp("^"+o+"{3,}","gm"),c;c=l.exec(i);)c[0].length>=a&&(a=c[0].length+1);var u=cg(o,a);return`
532
-
533
- `+u+s+`
534
- `+i.replace(/\n$/,"")+`
535
- `+u+`
536
-
537
- `}};Rn.horizontalRule={filter:"hr",replacement:function(t,e,n){return`
538
-
539
- `+n.hr+`
540
-
541
- `}};Rn.inlineLink={filter:function(t,e){return e.linkStyle==="inlined"&&t.nodeName==="A"&&t.getAttribute("href")},replacement:function(t,e){var n=e.getAttribute("href");n&&(n=n.replace(/([()])/g,"\\$1"));var r=tf(e.getAttribute("title"));return r&&(r=' "'+r.replace(/"/g,'\\"')+'"'),"["+t+"]("+n+r+")"}};Rn.referenceLink={filter:function(t,e){return e.linkStyle==="referenced"&&t.nodeName==="A"&&t.getAttribute("href")},replacement:function(t,e,n){var r=e.getAttribute("href"),s=tf(e.getAttribute("title"));s&&(s=' "'+s+'"');var i,o;switch(n.linkReferenceStyle){case"collapsed":i="["+t+"][]",o="["+t+"]: "+r+s;break;case"shortcut":i="["+t+"]",o="["+t+"]: "+r+s;break;default:var a=this.references.length+1;i="["+t+"]["+a+"]",o="["+a+"]: "+r+s}return this.references.push(o),i},references:[],append:function(t){var e="";return this.references.length&&(e=`
542
-
543
- `+this.references.join(`
544
- `)+`
545
-
546
- `,this.references=[]),e}};Rn.emphasis={filter:["em","i"],replacement:function(t,e,n){return t.trim()?n.emDelimiter+t+n.emDelimiter:""}};Rn.strong={filter:["strong","b"],replacement:function(t,e,n){return t.trim()?n.strongDelimiter+t+n.strongDelimiter:""}};Rn.code={filter:function(t){var e=t.previousSibling||t.nextSibling,n=t.parentNode.nodeName==="PRE"&&!e;return t.nodeName==="CODE"&&!n},replacement:function(t){if(!t)return"";t=t.replace(/\r?\n|\r/g," ");for(var e=/^`|^ .*?[^ ].* $|`$/.test(t)?" ":"",n="`",r=t.match(/`+/gm)||[];r.indexOf(n)!==-1;)n=n+"`";return n+e+t+e+n}};Rn.image={filter:"img",replacement:function(t,e){var n=tf(e.getAttribute("alt")),r=e.getAttribute("src")||"",s=tf(e.getAttribute("title")),i=s?' "'+s+'"':"";return r?"!["+n+"]("+r+i+")":""}};function tf(t){return t?t.replace(/(\n+\s*)+/g,`
547
- `):""}function KT(t){this.options=t,this._keep=[],this._remove=[],this.blankRule={replacement:t.blankReplacement},this.keepReplacement=t.keepReplacement,this.defaultRule={replacement:t.defaultReplacement},this.array=[];for(var e in t.rules)this.array.push(t.rules[e])}KT.prototype={add:function(t,e){this.array.unshift(e)},keep:function(t){this._keep.unshift({filter:t,replacement:this.keepReplacement})},remove:function(t){this._remove.unshift({filter:t,replacement:function(){return""}})},forNode:function(t){if(t.isBlank)return this.blankRule;var e;return(e=Mp(this.array,t,this.options))||(e=Mp(this._keep,t,this.options))||(e=Mp(this._remove,t,this.options))?e:this.defaultRule},forEach:function(t){for(var e=0;e<this.array.length;e++)t(this.array[e],e)}};function Mp(t,e,n){for(var r=0;r<t.length;r++){var s=t[r];if(xG(s,e,n))return s}}function xG(t,e,n){var r=t.filter;if(typeof r=="string"){if(r===e.nodeName.toLowerCase())return!0}else if(Array.isArray(r)){if(r.indexOf(e.nodeName.toLowerCase())>-1)return!0}else if(typeof r=="function"){if(r.call(t,e,n))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function vG(t){var e=t.element,n=t.isBlock,r=t.isVoid,s=t.isPre||function(d){return d.nodeName==="PRE"};if(!(!e.firstChild||s(e))){for(var i=null,o=!1,a=null,l=l0(a,e,s);l!==e;){if(l.nodeType===3||l.nodeType===4){var c=l.data.replace(/[ \r\n\t]+/g," ");if((!i||/ $/.test(i.data))&&!o&&c[0]===" "&&(c=c.substr(1)),!c){l=Rp(l);continue}l.data=c,i=l}else if(l.nodeType===1)n(l)||l.nodeName==="BR"?(i&&(i.data=i.data.replace(/ $/,"")),i=null,o=!1):r(l)||s(l)?(i=null,o=!0):i&&(o=!1);else{l=Rp(l);continue}var u=l0(a,l,s);a=l,l=u}i&&(i.data=i.data.replace(/ $/,""),i.data||Rp(i))}}function Rp(t){var e=t.nextSibling||t.parentNode;return t.parentNode.removeChild(t),e}function l0(t,e,n){return t&&t.parentNode===e||n(e)?e.nextSibling||e.parentNode:e.firstChild||e.nextSibling||e.parentNode}var xy=typeof window<"u"?window:{};function wG(){var t=xy.DOMParser,e=!1;try{new t().parseFromString("","text/html")&&(e=!0)}catch{}return e}function kG(){var t=function(){};return SG()?t.prototype.parseFromString=function(e){var n=new window.ActiveXObject("htmlfile");return n.designMode="on",n.open(),n.write(e),n.close(),n}:t.prototype.parseFromString=function(e){var n=document.implementation.createHTMLDocument("");return n.open(),n.write(e),n.close(),n},t}function SG(){var t=!1;try{document.implementation.createHTMLDocument("").open()}catch{xy.ActiveXObject&&(t=!0)}return t}var EG=wG()?xy.DOMParser:kG();function CG(t,e){var n;if(typeof t=="string"){var r=NG().parseFromString('<x-turndown id="turndown-root">'+t+"</x-turndown>","text/html");n=r.getElementById("turndown-root")}else n=t.cloneNode(!0);return vG({element:n,isBlock:by,isVoid:VT,isPre:e.preformattedCode?_G:null}),n}var Op;function NG(){return Op=Op||new EG,Op}function _G(t){return t.nodeName==="PRE"||t.nodeName==="CODE"}function TG(t,e){return t.isBlock=by(t),t.isCode=t.nodeName==="CODE"||t.parentNode.isCode,t.isBlank=AG(t),t.flankingWhitespace=MG(t,e),t}function AG(t){return!VT(t)&&!bG(t)&&/^\s*$/i.test(t.textContent)&&!gG(t)&&!yG(t)}function MG(t,e){if(t.isBlock||e.preformattedCode&&t.isCode)return{leading:"",trailing:""};var n=RG(t.textContent);return n.leadingAscii&&c0("left",t,e)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&c0("right",t,e)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function RG(t){var e=t.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:e[1],leadingAscii:e[2],leadingNonAscii:e[3],trailing:e[4],trailingNonAscii:e[5],trailingAscii:e[6]}}function c0(t,e,n){var r,s,i;return t==="left"?(r=e.previousSibling,s=/ $/):(r=e.nextSibling,s=/^ /),r&&(r.nodeType===3?i=s.test(r.nodeValue):n.preformattedCode&&r.nodeName==="CODE"?i=!1:r.nodeType===1&&!by(r)&&(i=s.test(r.textContent))),i}var OG=Array.prototype.reduce,IG=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function nf(t){if(!(this instanceof nf))return new nf(t);var e={rules:Rn,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(n,r){return r.isBlock?`
548
-
549
- `:""},keepReplacement:function(n,r){return r.isBlock?`
550
-
551
- `+r.outerHTML+`
552
-
553
- `:r.outerHTML},defaultReplacement:function(n,r){return r.isBlock?`
554
-
555
- `+n+`
556
-
557
- `:n}};this.options=pG({},e,t),this.rules=new KT(this.options)}nf.prototype={turndown:function(t){if(!PG(t))throw new TypeError(t+" is not a string, or an element/document/fragment node.");if(t==="")return"";var e=GT.call(this,new CG(t,this.options));return DG.call(this,e)},use:function(t){if(Array.isArray(t))for(var e=0;e<t.length;e++)this.use(t[e]);else if(typeof t=="function")t(this);else throw new TypeError("plugin must be a Function or an Array of Functions");return this},addRule:function(t,e){return this.rules.add(t,e),this},keep:function(t){return this.rules.keep(t),this},remove:function(t){return this.rules.remove(t),this},escape:function(t){return IG.reduce(function(e,n){return e.replace(n[0],n[1])},t)}};function GT(t){var e=this;return OG.call(t.childNodes,function(n,r){r=new TG(r,e.options);var s="";return r.nodeType===3?s=r.isCode?r.nodeValue:e.escape(r.nodeValue):r.nodeType===1&&(s=LG.call(e,r)),JT(n,s)},"")}function DG(t){var e=this;return this.rules.forEach(function(n){typeof n.append=="function"&&(t=JT(t,n.append(e.options)))}),t.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function LG(t){var e=this.rules.forNode(t),n=GT.call(this,t),r=t.flankingWhitespace;return(r.leading||r.trailing)&&(n=n.trim()),r.leading+e.replacement(n,t,this.options)+r.trailing}function JT(t,e){var n=$T(t),r=BT(e),s=Math.max(t.length-n.length,e.length-r.length),i=`
558
-
559
- `.substring(0,s);return n+i+r}function PG(t){return t!=null&&(typeof t=="string"||t.nodeType&&(t.nodeType===1||t.nodeType===9||t.nodeType===11))}function jG(t){var o;if(!t)return[];const e=t.split(`
560
- `),n=[];let r=!1,s=!1,i=!1;for(let a=0;a<e.length;a++){const c=e[a].trim();if(c.startsWith("```"))if(r=!r,r){n.push(a+1),i=!0,s=!1;continue}else{s=!1;continue}if(r)continue;if(!c){s=!1;continue}const u=/^#{1,6}\s/.test(c),d=/^[-*+]\s/.test(c),h=/^\d+\.\s/.test(c),p=c.startsWith(">"),m=/^[-*_]{3,}$/.test(c);if(d||h){s||(n.push(a+1),i=!0,s=!0);continue}s=!1,(u||p||m||!i||!((o=e[a-1])!=null&&o.trim()))&&(n.push(a+1),i=!0)}return n}var ug,dg;if(typeof WeakMap<"u"){let t=new WeakMap;ug=e=>t.get(e),dg=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;ug=r=>{for(let s=0;s<t.length;s+=2)if(t[s]==r)return t[s+1]},dg=(r,s)=>(n==10&&(n=0),t[n++]=r,t[n++]=s)}var $t=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,s=e/this.width|0;let i=r+1,o=s+1;for(let a=1;i<this.width&&this.map[e+a]==n;a++)i++;for(let a=1;o<this.height&&this.map[e+this.width*a]==n;a++)o++;return{left:r,top:s,right:i,bottom:o}}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:s,top:i,bottom:o}=this.findCell(t);return e=="horiz"?(n<0?r==0:s==this.width)?null:this.map[i*this.width+(n<0?r-1:s)]:(n<0?i==0:o==this.height)?null:this.map[r+this.width*(n<0?i-1:o)]}rectBetween(t,e){const{left:n,right:r,top:s,bottom:i}=this.findCell(t),{left:o,right:a,top:l,bottom:c}=this.findCell(e);return{left:Math.min(n,o),top:Math.min(s,l),right:Math.max(r,a),bottom:Math.max(i,c)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let s=t.left;s<t.right;s++){const i=r*this.width+s,o=this.map[i];n[o]||(n[o]=!0,!(s==t.left&&s&&this.map[i-1]==o||r==t.top&&r&&this.map[i-this.width]==o)&&e.push(o))}return e}positionAt(t,e,n){for(let r=0,s=0;;r++){const i=s+n.child(r).nodeSize;if(r==t){let o=e+t*this.width;const a=(t+1)*this.width;for(;o<a&&this.map[o]<s;)o++;return o==a?i-1:this.map[o]}s=i}}static get(t){return ug(t)||dg(t,zG(t))}};function zG(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=FG(t),n=t.childCount,r=[];let s=0,i=null;const o=[];for(let c=0,u=e*n;c<u;c++)r[c]=0;for(let c=0,u=0;c<n;c++){const d=t.child(c);u++;for(let m=0;;m++){for(;s<r.length&&r[s]!=0;)s++;if(m==d.childCount)break;const g=d.child(m),{colspan:b,rowspan:x,colwidth:w}=g.attrs;for(let v=0;v<x;v++){if(v+c>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:u,n:x-v});break}const k=s+v*e;for(let N=0;N<b;N++){r[k+N]==0?r[k+N]=u:(i||(i=[])).push({type:"collision",row:c,pos:u,n:b-N});const S=w&&w[N];if(S){const C=(k+N)%e*2,T=o[C];T==null||T!=S&&o[C+1]==1?(o[C]=S,o[C+1]=1):T==S&&o[C+1]++}}}s+=b,u+=g.nodeSize}const h=(c+1)*e;let p=0;for(;s<h;)r[s++]==0&&p++;p&&(i||(i=[])).push({type:"missing",row:c,n:p}),u++}(e===0||n===0)&&(i||(i=[])).push({type:"zero_sized"});const a=new $t(e,n,r,i);let l=!1;for(let c=0;!l&&c<o.length;c+=2)o[c]!=null&&o[c+1]<n&&(l=!0);return l&&BG(a,o,t),a}function FG(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const s=t.child(r);let i=0;if(n)for(let o=0;o<r;o++){const a=t.child(o);for(let l=0;l<a.childCount;l++){const c=a.child(l);o+c.attrs.rowspan>r&&(i+=c.attrs.colspan)}}for(let o=0;o<s.childCount;o++){const a=s.child(o);i+=a.attrs.colspan,a.attrs.rowspan>1&&(n=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function BG(t,e,n){t.problems||(t.problems=[]);const r={};for(let s=0;s<t.map.length;s++){const i=t.map[s];if(r[i])continue;r[i]=!0;const o=n.nodeAt(i);if(!o)throw new RangeError(`No cell with offset ${i} found`);let a=null;const l=o.attrs;for(let c=0;c<l.colspan;c++){const u=(s+c)%t.width,d=e[u*2];d!=null&&(!l.colwidth||l.colwidth[c]!=d)&&((a||(a=$G(l)))[c]=d)}a&&t.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:a})}}function $G(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function _n(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],s=r.spec.tableRole;s&&(e[s]=r)}}return e}var Zs=new Ut("selectingCells");function Qa(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 HG(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 Br(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 ch(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=Qa(e.$head)||UG(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function UG(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 fg(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function VG(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function vy(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function YT(t,e,n){const r=t.node(-1),s=$t.get(r),i=t.start(-1),o=s.nextCell(t.pos-i,e,n);return o==null?null:t.node(0).resolve(i+o)}function _o(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(s=>s>0)||(r.colwidth=null)),r}function ZT(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let s=0;s<n;s++)r.colwidth.splice(e,0,0)}return r}function WG(t,e,n){const r=_n(e.type.schema).header_cell;for(let s=0;s<t.height;s++)if(e.nodeAt(t.map[n+s*t.width]).type!=r)return!1;return!0}var Ct=class ms extends Pe{constructor(e,n=e){const r=e.node(-1),s=$t.get(r),i=e.start(-1),o=s.rectBetween(e.pos-i,n.pos-i),a=e.node(0),l=s.cellsInRect(o).filter(u=>u!=n.pos-i);l.unshift(n.pos-i);const c=l.map(u=>{const d=r.nodeAt(u);if(!d)throw RangeError(`No cell with offset ${u} found`);const h=i+u+1;return new iN(a.resolve(h),a.resolve(h+d.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),s=e.resolve(n.map(this.$headCell.pos));if(fg(r)&&fg(s)&&vy(r,s)){const i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?ms.rowSelection(r,s):i&&this.isColSelection()?ms.colSelection(r,s):new ms(r,s)}return Me.between(r,s)}content(){const e=this.$anchorCell.node(-1),n=$t.get(e),r=this.$anchorCell.start(-1),s=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},o=[];for(let l=s.top;l<s.bottom;l++){const c=[];for(let u=l*n.width+s.left,d=s.left;d<s.right;d++,u++){const h=n.map[u];if(i[h])continue;i[h]=!0;const p=n.findCell(h);let m=e.nodeAt(h);if(!m)throw RangeError(`No cell with offset ${h} found`);const g=s.left-p.left,b=p.right-s.right;if(g>0||b>0){let x=m.attrs;if(g>0&&(x=_o(x,0,g)),b>0&&(x=_o(x,x.colspan-b,b)),p.left<s.left){if(m=m.type.createAndFill(x),!m)throw RangeError(`Could not create cell with attrs ${JSON.stringify(x)}`)}else m=m.type.create(x,m.content)}if(p.top<s.top||p.bottom>s.bottom){const x={...m.attrs,rowspan:Math.min(p.bottom,s.bottom)-Math.max(p.top,s.top)};p.top<s.top?m=m.type.createAndFill(x):m=m.type.create(x,m.content)}c.push(m)}o.push(e.child(l).copy(G.from(c)))}const a=this.isColSelection()&&this.isRowSelection()?e:o;return new ae(G.from(a),1,1)}replace(e,n=ae.empty){const r=e.steps.length,s=this.ranges;for(let o=0;o<s.length;o++){const{$from:a,$to:l}=s[o],c=e.mapping.slice(r);e.replace(c.map(a.pos),c.map(l.pos),o?ae.empty:n)}const i=Pe.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,n){this.replace(e,new ae(G.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=$t.get(n),s=this.$anchorCell.start(-1),i=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-s,this.$headCell.pos-s));for(let o=0;o<i.length;o++)e(n.nodeAt(i[o]),s+i[o])}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,s=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,s)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),s=$t.get(r),i=e.start(-1),o=s.findCell(e.pos-i),a=s.findCell(n.pos-i),l=e.node(0);return o.top<=a.top?(o.top>0&&(e=l.resolve(i+s.map[o.left])),a.bottom<s.height&&(n=l.resolve(i+s.map[s.width*(s.height-1)+a.right-1]))):(a.top>0&&(n=l.resolve(i+s.map[a.left])),o.bottom<s.height&&(e=l.resolve(i+s.map[s.width*(s.height-1)+o.right-1]))),new ms(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=$t.get(e),r=this.$anchorCell.start(-1),s=n.colCount(this.$anchorCell.pos-r),i=n.colCount(this.$headCell.pos-r);if(Math.min(s,i)>0)return!1;const o=s+this.$anchorCell.nodeAfter.attrs.colspan,a=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,a)==n.width}eq(e){return e instanceof ms&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),s=$t.get(r),i=e.start(-1),o=s.findCell(e.pos-i),a=s.findCell(n.pos-i),l=e.node(0);return o.left<=a.left?(o.left>0&&(e=l.resolve(i+s.map[o.top*s.width])),a.right<s.width&&(n=l.resolve(i+s.map[s.width*(a.top+1)-1]))):(a.left>0&&(n=l.resolve(i+s.map[a.top*s.width])),o.right<s.width&&(e=l.resolve(i+s.map[s.width*(o.top+1)-1]))),new ms(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new ms(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new ms(e.resolve(n),e.resolve(r))}getBookmark(){return new qG(this.$anchorCell.pos,this.$headCell.pos)}};Ct.prototype.visible=!1;Pe.jsonID("cell",Ct);var qG=class XT{constructor(e,n){this.anchor=e,this.head=n}map(e){return new XT(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&&vy(n,r)?new Ct(n,r):Pe.near(r,1)}};function KG(t){if(!(t.selection instanceof Ct))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(tn.node(r,r+n.nodeSize,{class:"selectedCell"}))}),yt.create(t.doc,e)}function GG({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,s=t.depth;for(;s>=0&&!(t.after(s+1)<t.end(s));s--,n++);for(let i=e.depth;i>=0&&!(e.before(i+1)>e.start(i));i--,r--);return n==r&&/row|table/.test(t.node(s).type.spec.tableRole)}function JG({$from:t,$to:e}){let n,r;for(let s=t.depth;s>0;s--){const i=t.node(s);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){n=i;break}}for(let s=e.depth;s>0;s--){const i=e.node(s);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){r=i;break}}return n!==r&&e.parentOffset===0}function YG(t,e,n){const r=(e||t).selection,s=(e||t).doc;let i,o;if(r instanceof Ee&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")i=Ct.create(s,r.from);else if(o=="row"){const a=s.resolve(r.from+1);i=Ct.rowSelection(a,a)}else if(!n){const a=$t.get(r.node),l=r.from+1,c=l+a.map[a.width*a.height-1];i=Ct.create(s,l+1,c)}}else r instanceof Me&&GG(r)?i=Me.create(s,r.from):r instanceof Me&&JG(r)&&(i=Me.create(s,r.$from.start(),r.$from.end()));return i&&(e||(e=t.tr)).setSelection(i),e}var ZG=new Ut("fix-tables");function QT(t,e,n,r){const s=t.childCount,i=e.childCount;e:for(let o=0,a=0;o<i;o++){const l=e.child(o);for(let c=a,u=Math.min(s,o+3);c<u;c++)if(t.child(c)==l){a=c+1,n+=l.nodeSize;continue e}r(l,n),a<s&&t.child(a).sameMarkup(l)?QT(t.child(a),l,n+1,r):l.nodesBetween(0,l.content.size,r,n+1),n+=l.nodeSize}}function eA(t,e){let n;const r=(s,i)=>{s.type.spec.tableRole=="table"&&(n=XG(t,s,i,n))};return e?e.doc!=t.doc&&QT(e.doc,t.doc,0,r):t.doc.descendants(r),n}function XG(t,e,n,r){const s=$t.get(e);if(!s.problems)return r;r||(r=t.tr);const i=[];for(let l=0;l<s.height;l++)i.push(0);for(let l=0;l<s.problems.length;l++){const c=s.problems[l];if(c.type=="collision"){const u=e.nodeAt(c.pos);if(!u)continue;const d=u.attrs;for(let h=0;h<d.rowspan;h++)i[c.row+h]+=c.n;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,_o(d,d.colspan-c.n,c.n))}else if(c.type=="missing")i[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...u.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const u=r.mapping.map(n);r.delete(u,u+e.nodeSize)}}let o,a;for(let l=0;l<i.length;l++)i[l]&&(o==null&&(o=l),a=l);for(let l=0,c=n+1;l<s.height;l++){const u=e.child(l),d=c+u.nodeSize,h=i[l];if(h>0){let p="cell";u.firstChild&&(p=u.firstChild.type.spec.tableRole);const m=[];for(let b=0;b<h;b++){const x=_n(t.schema)[p].createAndFill();x&&m.push(x)}const g=(l==0||o==l-1)&&a==l?c+1:d-1;r.insert(r.mapping.map(g),m)}c=d}return r.setMeta(ZG,{fixTables:!0})}function ss(t){const e=t.selection,n=ch(t),r=n.node(-1),s=n.start(-1),i=$t.get(r);return{...e instanceof Ct?i.rectBetween(e.$anchorCell.pos-s,e.$headCell.pos-s):i.findCell(n.pos-s),tableStart:s,map:i,table:r}}function tA(t,{map:e,tableStart:n,table:r},s){let i=s>0?-1:0;WG(e,r,s+i)&&(i=s==0||s==e.width?null:0);for(let o=0;o<e.height;o++){const a=o*e.width+s;if(s>0&&s<e.width&&e.map[a-1]==e.map[a]){const l=e.map[a],c=r.nodeAt(l);t.setNodeMarkup(t.mapping.map(n+l),null,ZT(c.attrs,s-e.colCount(l))),o+=c.attrs.rowspan-1}else{const l=i==null?_n(r.type.schema).cell:r.nodeAt(e.map[a+i]).type,c=e.positionAt(o,s,r);t.insert(t.mapping.map(n+c),l.createAndFill())}}return t}function QG(t,e){if(!Br(t))return!1;if(e){const n=ss(t);e(tA(t.tr,n,n.left))}return!0}function e8(t,e){if(!Br(t))return!1;if(e){const n=ss(t);e(tA(t.tr,n,n.right))}return!0}function t8(t,{map:e,table:n,tableStart:r},s){const i=t.mapping.maps.length;for(let o=0;o<e.height;){const a=o*e.width+s,l=e.map[a],c=n.nodeAt(l),u=c.attrs;if(s>0&&e.map[a-1]==l||s<e.width-1&&e.map[a+1]==l)t.setNodeMarkup(t.mapping.slice(i).map(r+l),null,_o(u,s-e.colCount(l)));else{const d=t.mapping.slice(i).map(r+l);t.delete(d,d+c.nodeSize)}o+=u.rowspan}}function n8(t,e){if(!Br(t))return!1;if(e){const n=ss(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let s=n.right-1;t8(r,n,s),s!=n.left;s--){const i=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!i)throw RangeError("No table found");n.table=i,n.map=$t.get(i)}e(r)}return!0}function r8(t,e,n){var r;const s=_n(e.type.schema).header_cell;for(let i=0;i<t.width;i++)if(((r=e.nodeAt(t.map[i+n*t.width]))==null?void 0:r.type)!=s)return!1;return!0}function nA(t,{map:e,tableStart:n,table:r},s){var i;let o=n;for(let c=0;c<s;c++)o+=r.child(c).nodeSize;const a=[];let l=s>0?-1:0;r8(e,r,s+l)&&(l=s==0||s==e.height?null:0);for(let c=0,u=e.width*s;c<e.width;c++,u++)if(s>0&&s<e.height&&e.map[u]==e.map[u-e.width]){const d=e.map[u],h=r.nodeAt(d).attrs;t.setNodeMarkup(n+d,null,{...h,rowspan:h.rowspan+1}),c+=h.colspan-1}else{const d=l==null?_n(r.type.schema).cell:(i=r.nodeAt(e.map[u+l*e.width]))==null?void 0:i.type,h=d==null?void 0:d.createAndFill();h&&a.push(h)}return t.insert(o,_n(r.type.schema).row.create(null,a)),t}function s8(t,e){if(!Br(t))return!1;if(e){const n=ss(t);e(nA(t.tr,n,n.top))}return!0}function i8(t,e){if(!Br(t))return!1;if(e){const n=ss(t);e(nA(t.tr,n,n.bottom))}return!0}function o8(t,{map:e,table:n,tableStart:r},s){let i=0;for(let c=0;c<s;c++)i+=n.child(c).nodeSize;const o=i+n.child(s).nodeSize,a=t.mapping.maps.length;t.delete(i+r,o+r);const l=new Set;for(let c=0,u=s*e.width;c<e.width;c++,u++){const d=e.map[u];if(!l.has(d)){if(l.add(d),s>0&&d==e.map[u-e.width]){const h=n.nodeAt(d).attrs;t.setNodeMarkup(t.mapping.slice(a).map(d+r),null,{...h,rowspan:h.rowspan-1}),c+=h.colspan-1}else if(s<e.height&&d==e.map[u+e.width]){const h=n.nodeAt(d),p=h.attrs,m=h.type.create({...p,rowspan:h.attrs.rowspan-1},h.content),g=e.positionAt(s+1,c,n);t.insert(t.mapping.slice(a).map(r+g),m),c+=p.colspan-1}}}}function a8(t,e){if(!Br(t))return!1;if(e){const n=ss(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let s=n.bottom-1;o8(r,n,s),s!=n.top;s--){const i=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!i)throw RangeError("No table found");n.table=i,n.map=$t.get(n.table)}e(r)}return!0}function u0(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function l8({width:t,height:e,map:n},r){let s=r.top*t+r.left,i=s,o=(r.bottom-1)*t+r.left,a=s+(r.right-r.left-1);for(let l=r.top;l<r.bottom;l++){if(r.left>0&&n[i]==n[i-1]||r.right<t&&n[a]==n[a+1])return!0;i+=t,a+=t}for(let l=r.left;l<r.right;l++){if(r.top>0&&n[s]==n[s-t]||r.bottom<e&&n[o]==n[o+t])return!0;s++,o++}return!1}function d0(t,e){const n=t.selection;if(!(n instanceof Ct)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=ss(t),{map:s}=r;if(l8(s,r))return!1;if(e){const i=t.tr,o={};let a=G.empty,l,c;for(let u=r.top;u<r.bottom;u++)for(let d=r.left;d<r.right;d++){const h=s.map[u*s.width+d],p=r.table.nodeAt(h);if(!(o[h]||!p))if(o[h]=!0,l==null)l=h,c=p;else{u0(p)||(a=a.append(p.content));const m=i.mapping.map(h+r.tableStart);i.delete(m,m+p.nodeSize)}}if(l==null||c==null)return!0;if(i.setNodeMarkup(l+r.tableStart,null,{...ZT(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),a.size){const u=l+1+c.content.size,d=u0(c)?l+1:u;i.replaceWith(d+r.tableStart,u+r.tableStart,a)}i.setSelection(new Ct(i.doc.resolve(l+r.tableStart))),e(i)}return!0}function f0(t,e){const n=_n(t.schema);return c8(({node:r})=>n[r.type.spec.tableRole])(t,e)}function c8(t){return(e,n)=>{var r;const s=e.selection;let i,o;if(s instanceof Ct){if(s.$anchorCell.pos!=s.$headCell.pos)return!1;i=s.$anchorCell.nodeAfter,o=s.$anchorCell.pos}else{if(i=HG(s.$from),!i)return!1;o=(r=Qa(s.$from))==null?void 0:r.pos}if(i==null||o==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let a=i.attrs;const l=[],c=a.colwidth;a.rowspan>1&&(a={...a,rowspan:1}),a.colspan>1&&(a={...a,colspan:1});const u=ss(e),d=e.tr;for(let p=0;p<u.right-u.left;p++)l.push(c?{...a,colwidth:c&&c[p]?[c[p]]:null}:a);let h;for(let p=u.top;p<u.bottom;p++){let m=u.map.positionAt(p,u.left,u.table);p==u.top&&(m+=i.nodeSize);for(let g=u.left,b=0;g<u.right;g++,b++)g==u.left&&p==u.top||d.insert(h=d.mapping.map(m+u.tableStart,1),t({node:i,row:p,col:g}).createAndFill(l[b]))}d.setNodeMarkup(o,t({node:i,row:u.top,col:u.left}),l[0]),s instanceof Ct&&d.setSelection(new Ct(d.doc.resolve(s.$anchorCell.pos),h?d.doc.resolve(h):void 0)),n(d)}return!0}}function u8(t,e){return function(n,r){if(!Br(n))return!1;const s=ch(n);if(s.nodeAfter.attrs[t]===e)return!1;if(r){const i=n.tr;n.selection instanceof Ct?n.selection.forEachCell((o,a)=>{o.attrs[t]!==e&&i.setNodeMarkup(a,null,{...o.attrs,[t]:e})}):i.setNodeMarkup(s.pos,null,{...s.nodeAfter.attrs,[t]:e}),r(i)}return!0}}function d8(t){return function(e,n){if(!Br(e))return!1;if(n){const r=_n(e.schema),s=ss(e),i=e.tr,o=s.map.cellsInRect(t=="column"?{left:s.left,top:0,right:s.right,bottom:s.map.height}:t=="row"?{left:0,top:s.top,right:s.map.width,bottom:s.bottom}:s),a=o.map(l=>s.table.nodeAt(l));for(let l=0;l<o.length;l++)a[l].type==r.header_cell&&i.setNodeMarkup(s.tableStart+o[l],r.cell,a[l].attrs);if(i.steps.length==0)for(let l=0;l<o.length;l++)i.setNodeMarkup(s.tableStart+o[l],r.header_cell,a[l].attrs);n(i)}return!0}}function h0(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 s=0;s<r.length;s++){const i=e.table.nodeAt(r[s]);if(i&&i.type!==n.header_cell)return!1}return!0}function oc(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?d8(t):function(n,r){if(!Br(n))return!1;if(r){const s=_n(n.schema),i=ss(n),o=n.tr,a=h0("row",i,s),l=h0("column",i,s),u=(t==="column"?a:t==="row"?l:!1)?1:0,d=t=="column"?{left:0,top:u,right:1,bottom:i.map.height}:t=="row"?{left:u,top:0,right:i.map.width,bottom:1}:i,h=t=="column"?l?s.cell:s.header_cell:t=="row"?a?s.cell:s.header_cell:s.cell;i.map.cellsInRect(d).forEach(p=>{const m=p+i.tableStart,g=o.doc.nodeAt(m);g&&o.setNodeMarkup(m,h,g.attrs)}),r(o)}return!0}}oc("row",{useDeprecatedLogic:!0});oc("column",{useDeprecatedLogic:!0});var f8=oc("cell",{useDeprecatedLogic:!0});function h8(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,s=t.before();r>=0;r--){const i=t.node(-1).child(r),o=i.lastChild;if(o)return s-1-o.nodeSize;s-=i.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),s=t.after();r<n.childCount;r++){const i=n.child(r);if(i.childCount)return s+1;s+=i.nodeSize}}return null}function p0(t){return function(e,n){if(!Br(e))return!1;const r=h8(ch(e),t);if(r==null)return!1;if(n){const s=e.doc.resolve(r);n(e.tr.setSelection(Me.between(s,VG(s))).scrollIntoView())}return!0}}function p8(t,e){const n=t.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function Tu(t,e){const n=t.selection;if(!(n instanceof Ct))return!1;if(e){const r=t.tr,s=_n(t.schema).cell.createAndFill().content;n.forEachCell((i,o)=>{i.content.eq(s)||r.replace(r.mapping.map(o+1),r.mapping.map(o+i.nodeSize-1),new ae(s,0,0))}),r.docChanged&&e(r)}return!0}function m8(t){if(!t.size)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 s=e.child(0),i=s.type.spec.tableRole,o=s.type.schema,a=[];if(i=="row")for(let l=0;l<e.childCount;l++){let c=e.child(l).content;const u=l?0:Math.max(0,n-1),d=l<e.childCount-1?0:Math.max(0,r-1);(u||d)&&(c=hg(_n(o).row,new ae(c,u,d)).content),a.push(c)}else if(i=="cell"||i=="header_cell")a.push(n||r?hg(_n(o).row,new ae(e,n,r)).content:e);else return null;return g8(o,a)}function g8(t,e){const n=[];for(let s=0;s<e.length;s++){const i=e[s];for(let o=i.childCount-1;o>=0;o--){const{rowspan:a,colspan:l}=i.child(o).attrs;for(let c=s;c<s+a;c++)n[c]=(n[c]||0)+l}}let r=0;for(let s=0;s<n.length;s++)r=Math.max(r,n[s]);for(let s=0;s<n.length;s++)if(s>=e.length&&e.push(G.empty),n[s]<r){const i=_n(t).cell.createAndFill(),o=[];for(let a=n[s];a<r;a++)o.push(i);e[s]=e[s].append(G.from(o))}return{height:e.length,width:r,rows:e}}function hg(t,e){const n=t.createAndFill();return new mb(n).replace(0,n.content.size,e).doc}function b8({width:t,height:e,rows:n},r,s){if(t!=r){const i=[],o=[];for(let a=0;a<n.length;a++){const l=n[a],c=[];for(let u=i[a]||0,d=0;u<r;d++){let h=l.child(d%l.childCount);u+h.attrs.colspan>r&&(h=h.type.createChecked(_o(h.attrs,h.attrs.colspan,u+h.attrs.colspan-r),h.content)),c.push(h),u+=h.attrs.colspan;for(let p=1;p<h.attrs.rowspan;p++)i[a+p]=(i[a+p]||0)+h.attrs.colspan}o.push(G.from(c))}n=o,t=r}if(e!=s){const i=[];for(let o=0,a=0;o<s;o++,a++){const l=[],c=n[a%e];for(let u=0;u<c.childCount;u++){let d=c.child(u);o+d.attrs.rowspan>s&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,s-d.attrs.rowspan)},d.content)),l.push(d)}i.push(G.from(l))}n=i,e=s}return{width:t,height:e,rows:n}}function y8(t,e,n,r,s,i,o){const a=t.doc.type.schema,l=_n(a);let c,u;if(s>e.width)for(let d=0,h=0;d<e.height;d++){const p=n.child(d);h+=p.nodeSize;const m=[];let g;p.lastChild==null||p.lastChild.type==l.cell?g=c||(c=l.cell.createAndFill()):g=u||(u=l.header_cell.createAndFill());for(let b=e.width;b<s;b++)m.push(g);t.insert(t.mapping.slice(o).map(h-1+r),m)}if(i>e.height){const d=[];for(let m=0,g=(e.height-1)*e.width;m<Math.max(e.width,s);m++){const b=m>=e.width?!1:n.nodeAt(e.map[g+m]).type==l.header_cell;d.push(b?u||(u=l.header_cell.createAndFill()):c||(c=l.cell.createAndFill()))}const h=l.row.create(null,G.from(d)),p=[];for(let m=e.height;m<i;m++)p.push(h);t.insert(t.mapping.slice(o).map(r+n.nodeSize-2),p)}return!!(c||u)}function m0(t,e,n,r,s,i,o,a){if(o==0||o==e.height)return!1;let l=!1;for(let c=s;c<i;c++){const u=o*e.width+c,d=e.map[u];if(e.map[u-e.width]==d){l=!0;const h=n.nodeAt(d),{top:p,left:m}=e.findCell(d);t.setNodeMarkup(t.mapping.slice(a).map(d+r),null,{...h.attrs,rowspan:o-p}),t.insert(t.mapping.slice(a).map(e.positionAt(o,m,n)),h.type.createAndFill({...h.attrs,rowspan:p+h.attrs.rowspan-o})),c+=h.attrs.colspan-1}}return l}function g0(t,e,n,r,s,i,o,a){if(o==0||o==e.width)return!1;let l=!1;for(let c=s;c<i;c++){const u=c*e.width+o,d=e.map[u];if(e.map[u-1]==d){l=!0;const h=n.nodeAt(d),p=e.colCount(d),m=t.mapping.slice(a).map(d+r);t.setNodeMarkup(m,null,_o(h.attrs,o-p,h.attrs.colspan-(o-p))),t.insert(m+h.nodeSize,h.type.createAndFill(_o(h.attrs,0,o-p))),c+=h.attrs.rowspan-1}}return l}function b0(t,e,n,r,s){let i=n?t.doc.nodeAt(n-1):t.doc;if(!i)throw new Error("No table found");let o=$t.get(i);const{top:a,left:l}=r,c=l+s.width,u=a+s.height,d=t.tr;let h=0;function p(){if(i=n?d.doc.nodeAt(n-1):d.doc,!i)throw new Error("No table found");o=$t.get(i),h=d.mapping.maps.length}y8(d,o,i,n,c,u,h)&&p(),m0(d,o,i,n,l,c,a,h)&&p(),m0(d,o,i,n,l,c,u,h)&&p(),g0(d,o,i,n,a,u,l,h)&&p(),g0(d,o,i,n,a,u,c,h)&&p();for(let m=a;m<u;m++){const g=o.positionAt(m,l,i),b=o.positionAt(m,c,i);d.replace(d.mapping.slice(h).map(g+n),d.mapping.slice(h).map(b+n),new ae(s.rows[m-a],0,0))}p(),d.setSelection(new Ct(d.doc.resolve(n+o.positionAt(a,l,i)),d.doc.resolve(n+o.positionAt(u-1,c-1,i)))),e(d)}var x8=Rb({ArrowLeft:Au("horiz",-1),ArrowRight:Au("horiz",1),ArrowUp:Au("vert",-1),ArrowDown:Au("vert",1),"Shift-ArrowLeft":Mu("horiz",-1),"Shift-ArrowRight":Mu("horiz",1),"Shift-ArrowUp":Mu("vert",-1),"Shift-ArrowDown":Mu("vert",1),Backspace:Tu,"Mod-Backspace":Tu,Delete:Tu,"Mod-Delete":Tu});function Wu(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function Au(t,e){return(n,r,s)=>{if(!s)return!1;const i=n.selection;if(i instanceof Ct)return Wu(n,r,Pe.near(i.$headCell,e));if(t!="horiz"&&!i.empty)return!1;const o=rA(s,t,e);if(o==null)return!1;if(t=="horiz")return Wu(n,r,Pe.near(n.doc.resolve(i.head+e),e));{const a=n.doc.resolve(o),l=YT(a,t,e);let c;return l?c=Pe.near(l,1):e<0?c=Pe.near(n.doc.resolve(a.before(-1)),-1):c=Pe.near(n.doc.resolve(a.after(-1)),1),Wu(n,r,c)}}}function Mu(t,e){return(n,r,s)=>{if(!s)return!1;const i=n.selection;let o;if(i instanceof Ct)o=i;else{const l=rA(s,t,e);if(l==null)return!1;o=new Ct(n.doc.resolve(l))}const a=YT(o.$headCell,t,e);return a?Wu(n,r,new Ct(o.$anchorCell,a)):!1}}function v8(t,e){const n=t.state.doc,r=Qa(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new Ct(r))),!0):!1}function w8(t,e,n){if(!Br(t.state))return!1;let r=m8(n);const s=t.state.selection;if(s instanceof Ct){r||(r={width:1,height:1,rows:[G.from(hg(_n(t.state.schema).cell,n))]});const i=s.$anchorCell.node(-1),o=s.$anchorCell.start(-1),a=$t.get(i).rectBetween(s.$anchorCell.pos-o,s.$headCell.pos-o);return r=b8(r,a.right-a.left,a.bottom-a.top),b0(t.state,t.dispatch,o,a,r),!0}else if(r){const i=ch(t.state),o=i.start(-1);return b0(t.state,t.dispatch,o,$t.get(i.node(-1)).findCell(i.pos-o),r),!0}else return!1}function k8(t,e){var n;if(e.ctrlKey||e.metaKey)return;const r=y0(t,e.target);let s;if(e.shiftKey&&t.state.selection instanceof Ct)i(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(s=Qa(t.state.selection.$anchor))!=null&&((n=Ip(t,e))==null?void 0:n.pos)!=s.pos)i(s,e),e.preventDefault();else if(!r)return;function i(l,c){let u=Ip(t,c);const d=Zs.getState(t.state)==null;if(!u||!vy(l,u))if(d)u=l;else return;const h=new Ct(l,u);if(d||!t.state.selection.eq(h)){const p=t.state.tr.setSelection(h);d&&p.setMeta(Zs,l.pos),t.dispatch(p)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",a),Zs.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Zs,-1))}function a(l){const c=l,u=Zs.getState(t.state);let d;if(u!=null)d=t.state.doc.resolve(u);else if(y0(t,c.target)!=r&&(d=Ip(t,e),!d))return o();d&&i(d,c)}t.root.addEventListener("mouseup",o),t.root.addEventListener("dragstart",o),t.root.addEventListener("mousemove",a)}function rA(t,e,n){if(!(t.state.selection instanceof Me))return null;const{$head:r}=t.state.selection;for(let s=r.depth-1;s>=0;s--){const i=r.node(s);if((n<0?r.index(s):r.indexAfter(s))!=(n<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const a=r.before(s),l=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(l)?a:null}}return null}function y0(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Ip(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});return n&&n?Qa(t.state.doc.resolve(n.pos)):null}var S8=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,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",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),pg(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,pg(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function pg(t,e,n,r,s,i){var o;let a=0,l=!0,c=e.firstChild;const u=t.firstChild;if(u){for(let d=0,h=0;d<u.childCount;d++){const{colspan:p,colwidth:m}=u.child(d).attrs;for(let g=0;g<p;g++,h++){const b=s==h?i:m&&m[g],x=b?b+"px":"";if(a+=b||r,b||(l=!1),c)c.style.width!=x&&(c.style.width=x),c=c.nextSibling;else{const w=document.createElement("col");w.style.width=x,e.appendChild(w)}}}for(;c;){const d=c.nextSibling;(o=c.parentNode)==null||o.removeChild(c),c=d}l?(n.style.width=a+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=a+"px")}}var ar=new Ut("tableColumnResizing");function E8({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=S8,lastColumnResizable:s=!0}={}){const i=new Rt({key:ar,state:{init(o,a){var l,c;const u=(c=(l=i.spec)==null?void 0:l.props)==null?void 0:c.nodeViews,d=_n(a.schema).table.name;return r&&u&&(u[d]=(h,p)=>new r(h,n,p)),new C8(-1,!1)},apply(o,a){return a.apply(o)}},props:{attributes:o=>{const a=ar.getState(o);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,a)=>{N8(o,a,t,s)},mouseleave:o=>{_8(o)},mousedown:(o,a)=>{T8(o,a,e,n)}},decorations:o=>{const a=ar.getState(o);if(a&&a.activeHandle>-1)return I8(o,a.activeHandle)},nodeViews:{}}});return i}var C8=class qu{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(ar);if(r&&r.setHandle!=null)return new qu(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new qu(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let s=e.mapping.map(n.activeHandle,-1);return fg(e.doc.resolve(s))||(s=-1),new qu(s,n.dragging)}return n}};function N8(t,e,n,r){if(!t.editable)return;const s=ar.getState(t.state);if(s&&!s.dragging){const i=M8(e.target);let o=-1;if(i){const{left:a,right:l}=i.getBoundingClientRect();e.clientX-a<=n?o=x0(t,e,"left",n):l-e.clientX<=n&&(o=x0(t,e,"right",n))}if(o!=s.activeHandle){if(!r&&o!==-1){const a=t.state.doc.resolve(o),l=a.node(-1),c=$t.get(l),u=a.start(-1);if(c.colCount(a.pos-u)+a.nodeAfter.attrs.colspan-1==c.width-1)return}sA(t,o)}}}function _8(t){if(!t.editable)return;const e=ar.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&sA(t,-1)}function T8(t,e,n,r){var s;if(!t.editable)return!1;const i=(s=t.dom.ownerDocument.defaultView)!=null?s:window,o=ar.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const a=t.state.doc.nodeAt(o.activeHandle),l=A8(t,o.activeHandle,a.attrs);t.dispatch(t.state.tr.setMeta(ar,{setDragging:{startX:e.clientX,startWidth:l}}));function c(d){i.removeEventListener("mouseup",c),i.removeEventListener("mousemove",u);const h=ar.getState(t.state);h!=null&&h.dragging&&(R8(t,h.activeHandle,v0(h.dragging,d,n)),t.dispatch(t.state.tr.setMeta(ar,{setDragging:null})))}function u(d){if(!d.which)return c(d);const h=ar.getState(t.state);if(h&&h.dragging){const p=v0(h.dragging,d,n);w0(t,h.activeHandle,p,r)}}return w0(t,o.activeHandle,l,r),i.addEventListener("mouseup",c),i.addEventListener("mousemove",u),e.preventDefault(),!0}function A8(t,e,{colspan:n,colwidth:r}){const s=r&&r[r.length-1];if(s)return s;const i=t.domAtPos(e);let a=i.node.childNodes[i.offset].offsetWidth,l=n;if(r)for(let c=0;c<n;c++)r[c]&&(a-=r[c],l--);return a/l}function M8(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function x0(t,e,n,r){const s=n=="right"?-r:r,i=t.posAtCoords({left:e.clientX+s,top:e.clientY});if(!i)return-1;const{pos:o}=i,a=Qa(t.state.doc.resolve(o));if(!a)return-1;if(n=="right")return a.pos;const l=$t.get(a.node(-1)),c=a.start(-1),u=l.map.indexOf(a.pos-c);return u%l.width==0?-1:c+l.map[u-1]}function v0(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function sA(t,e){t.dispatch(t.state.tr.setMeta(ar,{setHandle:e}))}function R8(t,e,n){const r=t.state.doc.resolve(e),s=r.node(-1),i=$t.get(s),o=r.start(-1),a=i.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,l=t.state.tr;for(let c=0;c<i.height;c++){const u=c*i.width+a;if(c&&i.map[u]==i.map[u-i.width])continue;const d=i.map[u],h=s.nodeAt(d).attrs,p=h.colspan==1?0:a-i.colCount(d);if(h.colwidth&&h.colwidth[p]==n)continue;const m=h.colwidth?h.colwidth.slice():O8(h.colspan);m[p]=n,l.setNodeMarkup(o+d,null,{...h,colwidth:m})}l.docChanged&&t.dispatch(l)}function w0(t,e,n,r){const s=t.state.doc.resolve(e),i=s.node(-1),o=s.start(-1),a=$t.get(i).colCount(s.pos-o)+s.nodeAfter.attrs.colspan-1;let l=t.domAtPos(s.start(-1)).node;for(;l&&l.nodeName!="TABLE";)l=l.parentNode;l&&pg(i,l.firstChild,l,r,a,n)}function O8(t){return Array(t).fill(0)}function I8(t,e){var n;const r=[],s=t.doc.resolve(e),i=s.node(-1);if(!i)return yt.empty;const o=$t.get(i),a=s.start(-1),l=o.colCount(s.pos-a)+s.nodeAfter.attrs.colspan-1;for(let c=0;c<o.height;c++){const u=l+c*o.width;if((l==o.width-1||o.map[u]!=o.map[u+1])&&(c==0||o.map[u]!=o.map[u-o.width])){const d=o.map[u],h=a+d+i.nodeAt(d).nodeSize-1,p=document.createElement("div");p.className="column-resize-handle",(n=ar.getState(t))!=null&&n.dragging&&r.push(tn.node(a+d,a+d+i.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),r.push(tn.widget(h,p))}}return yt.create(t.doc,r)}function D8({allowTableNodeSelection:t=!1}={}){return new Rt({key:Zs,state:{init(){return null},apply(e,n){const r=e.getMeta(Zs);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:s,pos:i}=e.mapping.mapResult(n);return s?null:i}},props:{decorations:KG,handleDOMEvents:{mousedown:k8},createSelectionBetween(e){return Zs.getState(e.state)!=null?e.state.selection:null},handleTripleClick:v8,handleKeyDown:x8,handlePaste:w8},appendTransaction(e,n,r){return YG(r,eA(r,n),t)}})}var iA=nn.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{var e,n;const r=t.getAttribute("colwidth"),s=r?r.split(",").map(i=>parseInt(i,10)):null;if(!s){const i=(e=t.closest("table"))==null?void 0:e.querySelectorAll("colgroup > col"),o=Array.from(((n=t.parentElement)==null?void 0:n.children)||[]).indexOf(t);if(o&&o>-1&&i&&i[o]){const a=i[o].getAttribute("width");return a?[parseInt(a,10)]:null}}return s}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",Nt(this.options.HTMLAttributes,t),0]}}),oA=nn.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",Nt(this.options.HTMLAttributes,t),0]}}),aA=nn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Nt(this.options.HTMLAttributes,t),0]}});function mg(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function k0(t,e,n,r,s,i){var o;let a=0,l=!0,c=e.firstChild;const u=t.firstChild;if(u!==null)for(let h=0,p=0;h<u.childCount;h+=1){const{colspan:m,colwidth:g}=u.child(h).attrs;for(let b=0;b<m;b+=1,p+=1){const x=s===p?i:g&&g[b],w=x?`${x}px`:"";if(a+=x||r,x||(l=!1),c){if(c.style.width!==w){const[v,k]=mg(r,x);c.style.setProperty(v,k)}c=c.nextSibling}else{const v=document.createElement("col"),[k,N]=mg(r,x);v.style.setProperty(k,N),e.appendChild(v)}}}for(;c;){const h=c.nextSibling;(o=c.parentNode)==null||o.removeChild(c),c=h}const d=t.attrs.style&&typeof t.attrs.style=="string"&&/\bwidth\s*:/i.test(t.attrs.style);l&&!d?(n.style.width=`${a}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${a}px`)}var L8=class{constructor(t,e){this.node=t,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),t.attrs.style&&(this.table.style.cssText=t.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),k0(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,k0(t,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(t){const e=t.target,n=this.dom.contains(e),r=this.contentDOM.contains(e);return!!(n&&!r&&(t.type==="attributes"||t.type==="childList"||t.type==="characterData"))}};function P8(t,e,n,r){let s=0,i=!0;const o=[],a=t.firstChild;if(!a)return{};for(let d=0,h=0;d<a.childCount;d+=1){const{colspan:p,colwidth:m}=a.child(d).attrs;for(let g=0;g<p;g+=1,h+=1){const b=n===h?r:m&&m[g];s+=b||e,b||(i=!1);const[x,w]=mg(e,b);o.push(["col",{style:`${x}: ${w}`}])}}const l=i?`${s}px`:"",c=i?"":`${s}px`;return{colgroup:["colgroup",{},...o],tableWidth:l,tableMinWidth:c}}function S0(t,e){return t.createAndFill()}function j8(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach(n=>{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function z8(t,e,n,r,s){const i=j8(t),o=[],a=[];for(let c=0;c<n;c+=1){const u=S0(i.cell);if(u&&a.push(u),r){const d=S0(i.header_cell);d&&o.push(d)}}const l=[];for(let c=0;c<e;c+=1)l.push(i.row.createChecked(null,r&&c===0?o:a));return i.table.createChecked(null,l)}function F8(t){return t instanceof Ct}var Ru=({editor:t})=>{const{selection:e}=t.state;if(!F8(e))return!1;let n=0;const r=c1(e.ranges[0].$from,i=>i.type.name==="table");return r==null||r.node.descendants(i=>{if(i.type.name==="table")return!1;["tableCell","tableHeader"].includes(i.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},B8="";function $8(t){return(t||"").replace(/\s+/g," ").trim()}function H8(t,e,n={}){var r;const s=(r=n.cellLineSeparator)!=null?r:B8;if(!t||!t.content||t.content.length===0)return"";const i=[];t.content.forEach(m=>{const g=[];m.content&&m.content.forEach(b=>{let x="";b.content&&Array.isArray(b.content)&&b.content.length>1?x=b.content.map(N=>e.renderChildren(N)).join(s):x=b.content?e.renderChildren(b.content):"";const w=$8(x),v=b.type==="tableHeader";g.push({text:w,isHeader:v})}),i.push(g)});const o=i.reduce((m,g)=>Math.max(m,g.length),0);if(o===0)return"";const a=new Array(o).fill(0);i.forEach(m=>{var g;for(let b=0;b<o;b+=1){const w=(((g=m[b])==null?void 0:g.text)||"").length;w>a[b]&&(a[b]=w),a[b]<3&&(a[b]=3)}});const l=(m,g)=>m+" ".repeat(Math.max(0,g-m.length)),c=i[0],u=c.some(m=>m.isHeader);let d=`
561
- `;const h=new Array(o).fill(0).map((m,g)=>u&&c[g]&&c[g].text||"");return d+=`| ${h.map((m,g)=>l(m,a[g])).join(" | ")} |
562
- `,d+=`| ${a.map(m=>"-".repeat(Math.max(3,m))).join(" | ")} |
563
- `,(u?i.slice(1):i).forEach(m=>{d+=`| ${new Array(o).fill(0).map((g,b)=>l(m[b]&&m[b].text||"",a[b])).join(" | ")} |
564
- `}),d}var U8=H8,lA=nn.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:L8,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:s}=P8(t,this.options.cellMinWidth),i=e.style;function o(){return i||(r?`width: ${r}`:`min-width: ${s}`)}const a=["table",Nt(this.options.HTMLAttributes,e,{style:o()}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},a]:a},parseMarkdown:(t,e)=>{const n=[];if(t.header){const r=[];t.header.forEach(s=>{r.push(e.createNode("tableHeader",{},[{type:"paragraph",content:e.parseInline(s.tokens)}]))}),n.push(e.createNode("tableRow",{},r))}return t.rows&&t.rows.forEach(r=>{const s=[];r.forEach(i=>{s.push(e.createNode("tableCell",{},[{type:"paragraph",content:e.parseInline(i.tokens)}]))}),n.push(e.createNode("tableRow",{},s))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>U8(t,e),addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:s,editor:i})=>{const o=z8(i.schema,t,e,n);if(s){const a=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(Me.near(r.doc.resolve(a)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>QG(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>e8(t,e),deleteColumn:()=>({state:t,dispatch:e})=>n8(t,e),addRowBefore:()=>({state:t,dispatch:e})=>s8(t,e),addRowAfter:()=>({state:t,dispatch:e})=>i8(t,e),deleteRow:()=>({state:t,dispatch:e})=>a8(t,e),deleteTable:()=>({state:t,dispatch:e})=>p8(t,e),mergeCells:()=>({state:t,dispatch:e})=>d0(t,e),splitCell:()=>({state:t,dispatch:e})=>f0(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>oc("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>oc("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>f8(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>d0(t,e)?!0:f0(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>u8(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>p0(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>p0(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&eA(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=Ct.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Ru,"Mod-Backspace":Ru,Delete:Ru,"Mod-Delete":Ru}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[E8({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],D8({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:at(Ne(t,"tableRole",e))}}});Dt.create({name:"tableKit",addExtensions(){const t=[];return this.options.table!==!1&&t.push(lA.configure(this.options.table)),this.options.tableCell!==!1&&t.push(iA.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(oA.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(aA.configure(this.options.tableRow)),t}});var V8=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,W8=nn.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",Nt(this.options.HTMLAttributes,t)]},parseMarkdown:(t,e)=>e.createNode("image",{src:t.href,title:t.title,alt:t.text}),renderMarkdown:t=>{var e,n,r,s,i,o;const a=(n=(e=t.attrs)==null?void 0:e.src)!=null?n:"",l=(s=(r=t.attrs)==null?void 0:r.alt)!=null?s:"",c=(o=(i=t.attrs)==null?void 0:i.title)!=null?o:"";return c?`![${l}](${a} "${c}")`:`![${l}](${a})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u"||!this.editor.isEditable)return null;const{directions:t,minWidth:e,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:s,getPos:i,HTMLAttributes:o})=>{const a=document.createElement("img");Object.entries(o).forEach(([u,d])=>{if(d!=null)switch(u){case"width":case"height":break;default:a.setAttribute(u,d);break}}),a.src=o.src;const l=new D4({element:a,node:s,getPos:i,onResize:(u,d)=>{a.style.width=`${u}px`,a.style.height=`${d}px`},onCommit:(u,d)=>{const h=i();h!==void 0&&this.editor.chain().setNodeSelection(h).updateAttributes(this.name,{width:u,height:d}).run()},onUpdate:(u,d,h)=>u.type===s.type,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:r===!0}}),c=l.dom;return c.style.visibility="hidden",c.style.pointerEvents="none",a.onload=()=>{c.style.visibility="",c.style.pointerEvents=""},l}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[R1({find:V8,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),q8=W8;function K8({editor:t,getPos:e}){const n=()=>{const o=e();if(typeof o=="number")try{const a=t.state.doc.resolve(o+1);let l=o+1;return a.node(a.depth).descendants((u,d)=>u.type.name==="tableCell"||u.type.name==="tableHeader"?(l=o+1+d+1,!1):!0),t.chain().focus().setTextSelection(l).run(),!0}catch(a){return console.error("Failed to select table cell:",a),!1}return!1},r=()=>{if(console.log("addRowBelow called"),n()){const o=t.chain().focus().addRowAfter().run();console.log("addRowAfter result:",o)}},s=()=>{if(console.log("addColumnRight called"),n()){const o=t.chain().focus().addColumnAfter().run();console.log("addColumnAfter result:",o)}},i=()=>{if(console.log("deleteTable called"),n()){const o=t.chain().focus().deleteTable().run();console.log("deleteTable result:",o)}};return f.jsxs(P1,{className:"group relative my-4 inline-block",children:[f.jsx("div",{className:"pointer-events-none absolute bottom-0 right-0 top-0 flex flex-col justify-center opacity-0 transition-opacity group-hover:opacity-100",children:f.jsx("div",{className:"pointer-events-auto flex flex-col gap-1",children:f.jsx(ie,{size:"sm",variant:"ghost",onClick:s,className:"h-5 w-5 bg-background/30 p-0 backdrop-blur-sm hover:bg-background/60",type:"button",children:f.jsx(bo,{className:"h-3 w-3"})})})}),f.jsx("div",{className:"pointer-events-none absolute -bottom-6 left-0 right-0 flex justify-center gap-2 opacity-0 transition-opacity group-hover:opacity-100",children:f.jsxs("div",{className:"pointer-events-auto flex gap-1",children:[f.jsx(ie,{size:"sm",variant:"ghost",onClick:r,className:"h-5 bg-background/30 px-2 text-xs backdrop-blur-sm hover:bg-background/60",type:"button",children:f.jsx(bo,{className:"h-3 w-3"})}),f.jsx(ie,{size:"sm",variant:"ghost",onClick:i,className:"h-5 bg-background/30 px-2 text-xs text-destructive backdrop-blur-sm hover:bg-background/60 hover:text-destructive",type:"button",children:f.jsx(Do,{className:"h-3 w-3"})})]})}),f.jsx(u3,{as:"table",className:"w-full table-auto border-collapse"})]})}function G8({node:t}){const{entityId:e,entityType:n,displayText:r,relationshipType:s}=t.attrs,i=()=>n==="issue"?`/issues/${e}`:`/specs/${e}`,o=()=>n==="issue"?f.jsx(Ua,{className:"h-3 w-3"}):f.jsx(Os,{className:"h-3 w-3"}),a=()=>n==="issue"?"issue":"spec",l=r||e;return f.jsxs(P1,{as:"span",className:"inline-block",children:[f.jsx(Dg,{to:i(),className:"no-underline",contentEditable:!1,children:f.jsxs(et,{variant:a(),className:"inline-flex items-center gap-1",children:[o(),l]})}),s&&f.jsx("span",{className:"ml-1 text-xs text-muted-foreground",contentEditable:!1,children:s})]})}const J8=nn.create({name:"entityMention",addOptions(){return{HTMLAttributes:{}}},inline:!0,group:"inline",atom:!0,addAttributes(){return{entityId:{default:null,parseHTML:t=>t.getAttribute("data-entity-id"),renderHTML:t=>t.entityId?{"data-entity-id":t.entityId}:{}},entityType:{default:null,parseHTML:t=>t.getAttribute("data-entity-type"),renderHTML:t=>t.entityType?{"data-entity-type":t.entityType}:{}},displayText:{default:null,parseHTML:t=>t.getAttribute("data-display-text"),renderHTML:t=>t.displayText?{"data-display-text":t.displayText}:{}},relationshipType:{default:null,parseHTML:t=>t.getAttribute("data-relationship-type"),renderHTML:t=>t.relationshipType?{"data-relationship-type":t.relationshipType}:{}}}},parseHTML(){return[{tag:"span[data-entity-id]"}]},renderHTML({node:t,HTMLAttributes:e}){return["span",Nt({"data-entity-id":t.attrs.entityId},{"data-entity-type":t.attrs.entityType},this.options.HTMLAttributes,e),t.attrs.entityId]},addNodeView(){return j1(G8)},addCommands(){return{setEntityMention:t=>({commands:e})=>{const n=t.startsWith("ISSUE-")||t.startsWith("i-")?"issue":"spec";return e.insertContent({type:this.name,attrs:{entityId:t,entityType:n}})}}}}),Y8=Di.create({name:"feedbackHighlight",addOptions(){return{HTMLAttributes:{}}},addAttributes(){return{feedbackId:{default:null,parseHTML:t=>t.getAttribute("data-feedback-id"),renderHTML:t=>t.feedbackId?{"data-feedback-id":t.feedbackId}:{}}}},parseHTML(){return[{tag:"mark[data-feedback-id]"}]},renderHTML({HTMLAttributes:t}){return["mark",{...this.options.HTMLAttributes,...t,class:"feedback-highlight bg-yellow-100 cursor-pointer hover:bg-yellow-200 transition-colors"},0]},addCommands(){return{setFeedbackHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleFeedbackHighlight:t=>({commands:e})=>e.toggleMark(this.name,t),unsetFeedbackHighlight:()=>({commands:t})=>t.unsetMark(this.name)}}});function Z8(t){return t.replace(new RegExp("(?<!\\\\)\\[\\[((?:[is]-[0-9a-z]{4,8})|(?:[A-Z]+-\\d+))(?:\\|([^\\]]+))?\\]\\](?:\\{\\s*([^}]+)\\s*\\})?","g"),(e,n,r,s)=>{const i=n.startsWith("ISSUE-")||n.startsWith("i-")?"issue":"spec",o=r==null?void 0:r.trim(),a=s==null?void 0:s.trim();return`<span ${[`data-entity-id="${n}"`,`data-entity-type="${i}"`,o?`data-display-text="${Dp(o)}"`:"",a?`data-relationship-type="${Dp(a)}"`:""].filter(Boolean).join(" ")}>${Dp(o||n)}</span>`})}function Dp(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}const X8=AV(_V);function E0(){const t=new nf({headingStyle:"atx",codeBlockStyle:"fenced",bulletListMarker:"-",hr:"---",emDelimiter:"_",strongDelimiter:"**"});return t.addRule("strikethrough",{filter:["del","s"],replacement:e=>`~~${e}~~`}),t.addRule("table",{filter:"table",replacement:e=>`
565
- `+e+`
566
- `}),t.addRule("tableRow",{filter:"tr",replacement:(e,n)=>{const r="|"+e+`
567
- `,s=n.querySelectorAll("th");if(s.length>0){const i="|"+Array.from(s).map(()=>" --- |").join("")+`
568
- `;return r+i}return r}}),t.addRule("tableCell",{filter:["th","td"],replacement:e=>" "+e.trim()+" |"}),t.addRule("listItem",{filter:"li",replacement:(e,n)=>{e=e.trim().replace(/\n\n/g,`
569
- `);const r=n.parentNode;return r?(/ol/i.test(r.nodeName)?"1. ":"- ")+e.replace(/\n/g,`
570
- `)+`
571
- `:e}}),t.addRule("entityMention",{filter:e=>e.nodeName==="SPAN"&&e.hasAttribute("data-entity-id"),replacement:(e,n)=>{const r=n,s=r.getAttribute("data-entity-id"),i=r.getAttribute("data-display-text"),o=r.getAttribute("data-relationship-type");if(!s)return e;let a=`[[${s}`;return i&&(a+=`|${i}`),a+="]]",o&&(a+=`{ ${o} }`),a}}),t}const Q8=Dt.create({name:"tabHandler",addKeyboardShortcuts(){return{Tab:()=>{const{state:t}=this.editor,{$from:e}=t.selection,n=e.node(e.depth-1);return n&&n.type.name==="listItem"?this.editor.commands.sinkListItem("listItem"):this.editor.commands.insertContent(" ")},"Shift-Tab":()=>{const{state:t}=this.editor,{$from:e}=t.selection,n=e.node(e.depth-1);return n&&n.type.name==="listItem"?this.editor.commands.liftListItem("listItem"):!1}}}}),e7=Dt.create({name:"lineNumbers",addGlobalAttributes(){return[{types:["heading","paragraph","codeBlock","blockquote","orderedList","bulletList"],attributes:{lineNumber:{default:null,parseHTML:t=>t.getAttribute("data-line-number"),renderHTML:t=>t.lineNumber?{"data-line-number":t.lineNumber}:{}}}}]}});function uh({content:t,editable:e=!1,onSave:n,onChange:r,onCancel:s,className:i="",showToolbar:o=!1,feedback:a=[],onFeedbackClick:l,showLineNumbers:c=!1,selectedLine:u,onLineClick:d,placeholder:h}){const[p,m]=y.useState(""),[g,b]=y.useState(!1),x=y.useRef(!1),w=y.useRef(""),v=l3({extensions:[XH.configure({heading:{levels:[1,2,3,4,5,6],HTMLAttributes:{class:"font-bold"}},codeBlock:!1,code:{HTMLAttributes:{class:"bg-muted/50 rounded px-1.5 py-0.5 font-mono text-sm"}},blockquote:{HTMLAttributes:{class:"border-l-4 border-primary/50 pl-4 italic text-muted-foreground my-4"}},bulletList:!1,orderedList:!1,listItem:!1,listKeymap:!1}),iU.configure({lowlight:X8,HTMLAttributes:{class:"bg-muted/50 rounded-md p-4 font-mono text-sm my-4 overflow-x-auto"}}),oU.configure({placeholder:h,emptyEditorClass:"is-editor-empty"}),lA.extend({addNodeView(){return j1(K8)}}).configure({resizable:!0,HTMLAttributes:{class:"border-collapse table-auto w-full"}}),aA,oA.configure({HTMLAttributes:{class:"border border-border bg-muted/50 px-4 py-2 text-left font-bold"}}),iA.configure({HTMLAttributes:{class:"border border-border px-4 py-2"}}),q8.configure({HTMLAttributes:{class:"max-w-full h-auto rounded-md my-4"}}),wH,Q8,e7,J8,Y8],editable:e,content:p,onUpdate:({editor:T})=>{if(!x.current&&(b(!0),r)){const R=T.getHTML(),I=E0().turndown(R);I!==w.current&&(w.current=I,r(I))}}});y.useEffect(()=>{if(!t){m("");return}const T=Z8(t);A_().use(V_).use(cy).use(ST,{allowDangerousHtml:!0}).use(hG,{allowDangerousHtml:!0}).process(T).then(R=>{m(String(R))}).catch(R=>{console.error("Failed to convert markdown to HTML:",R),m(`<pre>${t}</pre>`)})},[t]),y.useEffect(()=>{v&&p&&(v.isFocused||(x.current=!0,v.commands.setContent(p),b(!1),w.current=t,setTimeout(()=>{x.current=!1},100)))},[p,v,t]),y.useEffect(()=>{v&&v.setEditable(e)},[e,v]),y.useEffect(()=>{if(!v||!l)return;const T=_=>{const D=_.target.closest("[data-feedback-id]");if(D){const V=D.getAttribute("data-feedback-id");V&&l(V)}},R=v.view.dom;return R.addEventListener("click",T),()=>{R.removeEventListener("click",T)}},[v,l]),y.useEffect(()=>{if(!v||!c||!t)return;const T=()=>{const _=jG(t),{state:I}=v,{tr:D}=I;let V=0;I.doc.descendants((j,L,q)=>{if(q===I.doc&&j.isBlock){const re=_[V]||V+1;return D.setNodeMarkup(L,void 0,{...j.attrs,lineNumber:String(re)}),V++,!1}return!0}),D.docChanged&&v.view.dispatch(D)},R=setTimeout(()=>{T()},100);return()=>{clearTimeout(R)}},[v,c,t]),y.useEffect(()=>{if(!v||!c)return;const T=_=>{const D=_.target.closest(".ProseMirror > *");if(!D)return;const V=parseInt(D.getAttribute("data-line-number")||"0");V>0&&d&&d(V)},R=v.view.dom;return R.addEventListener("click",T),()=>{R.removeEventListener("click",T)}},[v,c,d]),y.useEffect(()=>{if(!v||!c)return;const T=v.view.dom.querySelectorAll(".ProseMirror > *");T.forEach(R=>R.classList.remove("selected-line")),u&&u>0&&T.forEach(R=>{parseInt(R.getAttribute("data-line-number")||"0")===u&&R.classList.add("selected-line")})},[v,c,u]);const k=()=>{if(!v||!n)return;const T=v.getHTML(),_=E0().turndown(T);n(_),b(!1)},N=()=>{v&&(v.commands.setContent(p),b(!1)),s==null||s()},S=()=>{const T=window.prompt("Enter image URL:");T&&v&&v.chain().focus().setImage({src:T}).run()},C=()=>{v&&v.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run()};return v?f.jsxs("div",{className:i,children:[e&&o&&f.jsxs("div",{className:"flex flex-wrap items-center gap-1 border-b border-border bg-muted/30 pl-2 pr-4 py-2",children:[f.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>v.chain().focus().toggleBold().run(),className:v.isActive("bold")?"bg-muted":"",type:"button",children:f.jsx(oR,{className:"h-4 w-4"})}),f.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>v.chain().focus().toggleItalic().run(),className:v.isActive("italic")?"bg-muted":"",type:"button",children:f.jsx(yR,{className:"h-4 w-4"})}),f.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>v.chain().focus().toggleCode().run(),className:v.isActive("code")?"bg-muted":"",type:"button",children:f.jsx(cR,{className:"h-4 w-4"})}),f.jsx("div",{className:"mx-1 h-6 w-px bg-border"}),f.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>v.chain().focus().toggleHeading({level:1}).run(),className:v.isActive("heading",{level:1})?"bg-muted":"",type:"button",children:f.jsx(hR,{className:"h-4 w-4"})}),f.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>v.chain().focus().toggleHeading({level:2}).run(),className:v.isActive("heading",{level:2})?"bg-muted":"",type:"button",children:f.jsx(pR,{className:"h-4 w-4"})}),f.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>v.chain().focus().toggleHeading({level:3}).run(),className:v.isActive("heading",{level:3})?"bg-muted":"",type:"button",children:f.jsx(mR,{className:"h-4 w-4"})}),f.jsx("div",{className:"mx-1 h-6 w-px bg-border"}),f.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>v.chain().focus().toggleBulletList().run(),className:v.isActive("bulletList")?"bg-muted":"",type:"button",children:f.jsx(wR,{className:"h-4 w-4"})}),f.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>v.chain().focus().toggleOrderedList().run(),className:v.isActive("orderedList")?"bg-muted":"",type:"button",children:f.jsx(xR,{className:"h-4 w-4"})}),f.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>v.chain().focus().toggleBlockquote().run(),className:v.isActive("blockquote")?"bg-muted":"",type:"button",children:f.jsx(TR,{className:"h-4 w-4"})}),f.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>v.chain().focus().toggleCodeBlock().run(),className:v.isActive("codeBlock")?"bg-muted":"",type:"button",children:f.jsx(lR,{className:"h-4 w-4"})}),f.jsx("div",{className:"mx-1 h-6 w-px bg-border"}),f.jsx(ie,{variant:"ghost",size:"sm",onClick:C,className:v.isActive("table")?"bg-muted":"",type:"button",children:f.jsx(RR,{className:"h-4 w-4"})}),f.jsx(ie,{variant:"ghost",size:"sm",onClick:S,type:"button",children:f.jsx(gR,{className:"h-4 w-4"})}),f.jsx("div",{className:"mx-1 h-6 w-px bg-border"}),f.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>v.chain().focus().undo().run(),disabled:!v.can().undo(),type:"button",children:f.jsx(OR,{className:"h-4 w-4"})}),f.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>v.chain().focus().redo().run(),disabled:!v.can().redo(),type:"button",children:f.jsx(AR,{className:"h-4 w-4"})}),f.jsx("div",{className:"flex-1"}),f.jsx(ie,{variant:"outline",size:"sm",onClick:N,type:"button",children:"Cancel"}),f.jsx(ie,{variant:"default",size:"sm",onClick:k,disabled:!g,type:"button",children:"Save"})]}),f.jsx("div",{className:`pl-3 pr-6 py-6 ${c?"tiptap-with-line-numbers":""}`,children:f.jsx(t3,{editor:v,className:"tiptap-editor prose prose-sm dark:prose-invert max-w-none"})})]}):f.jsx("div",{className:i,children:f.jsxs("div",{className:"animate-pulse",children:[f.jsx("div",{className:"mb-2 h-4 w-3/4 rounded bg-muted"}),f.jsx("div",{className:"mb-2 h-4 w-1/2 rounded bg-muted"}),f.jsx("div",{className:"h-4 w-5/6 rounded bg-muted"})]})})}const t7=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,n7=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,r7={};function C0(t,e){return(r7.jsx?n7:t7).test(t)}var Uo={},Lp,N0;function s7(){if(N0)return Lp;N0=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,a=/^\s+|\s+$/g,l=`
572
- `,c="/",u="*",d="",h="comment",p="declaration";function m(b,x){if(typeof b!="string")throw new TypeError("First argument must be a string");if(!b)return[];x=x||{};var w=1,v=1;function k(j){var L=j.match(e);L&&(w+=L.length);var q=j.lastIndexOf(l);v=~q?j.length-q:v+j.length}function N(){var j={line:w,column:v};return function(L){return L.position=new S(j),R(),L}}function S(j){this.start=j,this.end={line:w,column:v},this.source=x.source}S.prototype.content=b;function C(j){var L=new Error(x.source+":"+w+":"+v+": "+j);if(L.reason=j,L.filename=x.source,L.line=w,L.column=v,L.source=b,!x.silent)throw L}function T(j){var L=j.exec(b);if(L){var q=L[0];return k(q),b=b.slice(q.length),L}}function R(){T(n)}function _(j){var L;for(j=j||[];L=I();)L!==!1&&j.push(L);return j}function I(){var j=N();if(!(c!=b.charAt(0)||u!=b.charAt(1))){for(var L=2;d!=b.charAt(L)&&(u!=b.charAt(L)||c!=b.charAt(L+1));)++L;if(L+=2,d===b.charAt(L-1))return C("End of comment missing");var q=b.slice(2,L-2);return v+=2,k(q),b=b.slice(L),v+=2,j({type:h,comment:q})}}function D(){var j=N(),L=T(r);if(L){if(I(),!T(s))return C("property missing ':'");var q=T(i),re=j({type:p,property:g(L[0].replace(t,d)),value:q?g(q[0].replace(t,d)):d});return T(o),re}}function V(){var j=[];_(j);for(var L;L=D();)L!==!1&&(j.push(L),_(j));return j}return R(),V()}function g(b){return b?b.replace(a,d):d}return Lp=m,Lp}var _0;function i7(){if(_0)return Uo;_0=1;var t=Uo&&Uo.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Uo,"__esModule",{value:!0}),Uo.default=n;const e=t(s7());function n(r,s){let i=null;if(!r||typeof r!="string")return i;const o=(0,e.default)(r),a=typeof s=="function";return o.forEach(l=>{if(l.type!=="declaration")return;const{property:c,value:u}=l;a?s(c,u,l):u&&(i=i||{},i[c]=u)}),i}return Uo}var fl={},T0;function o7(){if(T0)return fl;T0=1,Object.defineProperty(fl,"__esModule",{value:!0}),fl.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,i=function(c){return!c||n.test(c)||t.test(c)},o=function(c,u){return u.toUpperCase()},a=function(c,u){return"".concat(u,"-")},l=function(c,u){return u===void 0&&(u={}),i(c)?c:(c=c.toLowerCase(),u.reactCompat?c=c.replace(s,a):c=c.replace(r,a),c.replace(e,o))};return fl.camelCase=l,fl}var hl,A0;function a7(){if(A0)return hl;A0=1;var t=hl&&hl.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},e=t(i7()),n=o7();function r(s,i){var o={};return!s||typeof s!="string"||(0,e.default)(s,function(a,l){a&&l&&(o[(0,n.camelCase)(a,i)]=l)}),o}return r.default=r,hl=r,hl}var l7=a7();const c7=xc(l7),wy={}.hasOwnProperty,u7=new Map,d7=/[A-Z]/g,f7=new Set(["table","tbody","thead","tfoot","tr"]),h7=new Set(["td","th"]),cA="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function p7(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let r;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=k7(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=w7(n,e.jsx,e.jsxs)}const s={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:r,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?Jc:OT,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},i=uA(s,t,void 0);return i&&typeof i!="string"?i:s.create(t,s.Fragment,{children:i||void 0},void 0)}function uA(t,e,n){if(e.type==="element")return m7(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return g7(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return y7(t,e,n);if(e.type==="mdxjsEsm")return b7(t,e);if(e.type==="root")return x7(t,e,n);if(e.type==="text")return v7(t,e)}function m7(t,e,n){const r=t.schema;let s=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Jc,t.schema=s),t.ancestors.push(e);const i=fA(t,e.tagName,!1),o=S7(t,e);let a=Sy(t,e);return f7.has(e.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!lh(l):!0})),dA(t,o,i,e),ky(o,a),t.ancestors.pop(),t.schema=r,t.create(e,i,o,n)}function g7(t,e){if(e.data&&e.data.estree&&t.evaluater){const r=e.data.estree.body[0];return r.type,t.evaluater.evaluateExpression(r.expression)}ac(t,e.position)}function b7(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);ac(t,e.position)}function y7(t,e,n){const r=t.schema;let s=r;e.name==="svg"&&r.space==="html"&&(s=Jc,t.schema=s),t.ancestors.push(e);const i=e.name===null?t.Fragment:fA(t,e.name,!0),o=E7(t,e),a=Sy(t,e);return dA(t,o,i,e),ky(o,a),t.ancestors.pop(),t.schema=r,t.create(e,i,o,n)}function x7(t,e,n){const r={};return ky(r,Sy(t,e)),t.create(e,t.Fragment,r,n)}function v7(t,e){return e.value}function dA(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function ky(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function w7(t,e,n){return r;function r(s,i,o,a){const c=Array.isArray(o.children)?n:e;return a?c(i,o,a):c(i,o)}}function k7(t,e){return n;function n(r,s,i,o){const a=Array.isArray(i.children),l=uy(r);return e(s,i,o,a,{columnNumber:l?l.column-1:void 0,fileName:t,lineNumber:l?l.line:void 0},void 0)}}function S7(t,e){const n={};let r,s;for(s in e.properties)if(s!=="children"&&wy.call(e.properties,s)){const i=C7(t,s,e.properties[s]);if(i){const[o,a]=i;t.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&h7.has(e.tagName)?r=a:n[o]=a}}if(r){const i=n.style||(n.style={});i[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function E7(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const i=r.data.estree.body[0];i.type;const o=i.expression;o.type;const a=o.properties[0];a.type,Object.assign(n,t.evaluater.evaluateExpression(a.argument))}else ac(t,e.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&t.evaluater){const a=r.value.data.estree.body[0];a.type,i=t.evaluater.evaluateExpression(a.expression)}else ac(t,e.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function Sy(t,e){const n=[];let r=-1;const s=t.passKeys?new Map:u7;for(;++r<e.children.length;){const i=e.children[r];let o;if(t.passKeys){const l=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(l){const c=s.get(l)||0;o=l+"-"+c,s.set(l,c+1)}}const a=uA(t,i,o);a!==void 0&&n.push(a)}return n}function C7(t,e,n){const r=RT(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?DT(n):LT(n)),r.property==="style"){let s=typeof n=="object"?n:N7(t,String(n));return t.stylePropertyNameCase==="css"&&(s=_7(s)),["style",s]}return[t.elementAttributeNameCase==="react"&&r.space?iK[r.property]||r.property:r.attribute,n]}}function N7(t,e){try{return c7(e,{reactCompat:!0})}catch(n){if(t.ignoreInvalidStyle)return{};const r=n,s=new Mn("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=t.filePath||void 0,s.url=cA+"#cannot-parse-style-attribute",s}}function fA(t,e,n){let r;if(!n)r={type:"Literal",value:e};else if(e.includes(".")){const s=e.split(".");let i=-1,o;for(;++i<s.length;){const a=C0(s[i])?{type:"Identifier",name:s[i]}:{type:"Literal",value:s[i]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(i&&a.type==="Literal"),optional:!1}:a}r=o}else r=C0(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(r.type==="Literal"){const s=r.value;return wy.call(t.components,s)?t.components[s]:s}if(t.evaluater)return t.evaluater.evaluateExpression(r);ac(t)}function ac(t,e){const n=new Mn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=t.filePath||void 0,n.url=cA+"#cannot-handle-mdx-estrees-without-createevaluater",n}function _7(t){const e={};let n;for(n in t)wy.call(t,n)&&(e[T7(n)]=t[n]);return e}function T7(t){let e=t.replace(d7,A7);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function A7(t){return"-"+t.toLowerCase()}const Pp={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},M7="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",M0=[],R0={allowDangerousHtml:!0},R7=/^(https?|ircs?|mailto|xmpp)$/i,O7=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Ey(t){const e=I7(t),n=D7(t);return L7(e.runSync(e.parse(n),n),t)}function I7(t){const e=t.rehypePlugins||M0,n=t.remarkPlugins||M0,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...R0}:R0;return A_().use(V_).use(n).use(ST,r).use(e)}function D7(t){const e=t.children||"",n=new T_;return typeof e=="string"&&(n.value=e),n}function L7(t,e){const n=e.allowedElements,r=e.allowElement,s=e.components,i=e.disallowedElements,o=e.skipHtml,a=e.unwrapDisallowed,l=e.urlTransform||P7;for(const u of O7)Object.hasOwn(e,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+M7+u.id,void 0);return e.className&&(t={type:"element",tagName:"div",properties:{className:e.className},children:t.type==="root"?t.children:[t]}),oy(t,c),p7(t,{Fragment:f.Fragment,components:s,ignoreInvalidStyle:!0,jsx:f.jsx,jsxs:f.jsxs,passKeys:!0,passNode:!0});function c(u,d,h){if(u.type==="raw"&&h&&typeof d=="number")return o?h.children.splice(d,1):h.children[d]={type:"text",value:u.value},d;if(u.type==="element"){let p;for(p in Pp)if(Object.hasOwn(Pp,p)&&Object.hasOwn(u.properties,p)){const m=u.properties[p],g=Pp[p];(g===null||g.includes(u.tagName))&&(u.properties[p]=l(String(m||""),p,u))}}if(u.type==="element"){let p=n?!n.includes(u.tagName):i?i.includes(u.tagName):!1;if(!p&&r&&typeof d=="number"&&(p=!r(u,d,h)),p&&h&&typeof d=="number")return a&&u.children?h.children.splice(d,1,...u.children):h.children.splice(d,1),d}}}function P7(t){const e=t.indexOf(":"),n=t.indexOf("?"),r=t.indexOf("#"),s=t.indexOf("/");return e===-1||s!==-1&&e>s||n!==-1&&e>n||r!==-1&&e>r||R7.test(t.slice(0,e))?t:""}const j7={preparing:{label:"Preparing",variant:"secondary",icon:f.jsx(Hl,{className:"h-3 w-3"})},pending:{label:"Pending",variant:"secondary",icon:f.jsx(Hl,{className:"h-3 w-3"})},running:{label:"Running",variant:"default",icon:f.jsx(mi,{className:"h-3 w-3 animate-spin"})},paused:{label:"Paused",variant:"outline",icon:f.jsx(Vk,{className:"h-3 w-3"})},completed:{label:"Completed",variant:"default",icon:f.jsx($g,{className:"h-3 w-3"})},failed:{label:"Failed",variant:"destructive",icon:f.jsx(ra,{className:"h-3 w-3"})},cancelled:{label:"Cancelled",variant:"secondary",icon:f.jsx(tx,{className:"h-3 w-3"})},stopped:{label:"Stopped",variant:"secondary",icon:f.jsx(tx,{className:"h-3 w-3"})}};function z7({items:t,className:e=""}){const n=_r(),r=[...t].sort((a,l)=>new Date(a.created_at).getTime()-new Date(l.created_at).getTime());if(r.length===0)return f.jsx("div",{className:`text-center text-sm text-muted-foreground ${e}`,children:"No activity yet"});const s=a=>{switch(a){case"comment":return"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200";case"suggestion":return"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200";case"request":return"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200";default:return"bg-gray-100 text-gray-800 dark:bg-gray-900 dark:text-gray-200"}},i=a=>f.jsx("div",{className:"group relative",children:f.jsxs(Ht,{className:`flex flex-col gap-2 rounded-r-md border-l-4 border-l-blue-700/50 bg-blue-50/50 p-4 transition-opacity dark:bg-blue-950/20 ${a.dismissed?"opacity-50":""}`,children:[f.jsx("div",{className:"mb-2 flex items-start justify-between gap-2",children:f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx(wc,{className:"h-4 w-4 text-blue-600 dark:text-blue-400"}),f.jsx(et,{className:`text-xs ${s(a.feedback_type)}`,children:a.feedback_type}),f.jsx("button",{onClick:()=>n(`/issues/${a.from_id}`),children:f.jsx(et,{variant:"issue",className:"cursor-pointer font-mono text-xs hover:opacity-80",children:a.from_id})}),a.agent?f.jsxs("span",{className:"text-xs text-muted-foreground",children:[a.agent," ",oo(new Date(a.created_at),{addSuffix:!0})]}):f.jsx("span",{className:"text-xs text-muted-foreground",children:oo(new Date(a.created_at),{addSuffix:!0})}),a.dismissed&&f.jsx(et,{variant:"secondary",className:"text-xs",children:"dismissed"})]})}),a.anchor&&(()=>{try{const l=JSON.parse(a.anchor);if(l.line_number||l.text_snippet)return f.jsx("div",{children:f.jsxs("span",{className:"rounded bg-muted/50 p-2 text-xs text-muted-foreground",children:[l.line_number&&f.jsxs("span",{children:["Line ",l.line_number,": "]}),l.text_snippet&&f.jsxs("span",{className:"font-mono italic",children:["“",l.text_snippet,"”"]})]})})}catch{}return null})(),f.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:f.jsx(Ey,{remarkPlugins:[cy],components:{p:({children:l})=>f.jsx("p",{className:"my-1 break-words leading-relaxed",children:l}),h1:({children:l})=>f.jsx("h1",{className:"my-2 break-words text-lg font-bold",children:l}),h2:({children:l})=>f.jsx("h2",{className:"my-2 break-words text-base font-bold",children:l}),h3:({children:l})=>f.jsx("h3",{className:"my-1 break-words text-sm font-bold",children:l}),ul:({children:l})=>f.jsx("ul",{className:"my-1 pl-4",children:l}),ol:({children:l})=>f.jsx("ol",{className:"my-1 pl-4",children:l}),li:({children:l})=>f.jsx("li",{className:"my-0.5 break-words",children:l}),code:({children:l,className:c})=>!c?f.jsx("code",{className:"break-words rounded bg-muted px-1 py-0.5 font-mono text-xs",children:l}):f.jsx("code",{className:`my-1 block overflow-x-auto rounded bg-muted p-2 font-mono text-xs ${c||""}`,children:l}),pre:({children:l})=>f.jsx("pre",{className:"my-1 overflow-x-auto",children:l}),blockquote:({children:l})=>f.jsx("blockquote",{className:"my-1 break-words border-l-2 border-muted-foreground/30 pl-2 italic",children:l}),a:({href:l,children:c})=>f.jsx("a",{href:l,className:"break-all text-primary underline hover:text-primary/80",target:"_blank",rel:"noopener noreferrer",children:c}),strong:({children:l})=>f.jsx("strong",{className:"font-semibold",children:l}),em:({children:l})=>f.jsx("em",{className:"italic",children:l})},children:a.content})})]})},a.id),o=a=>{const l=j7[a.status]||{label:a.status,variant:"outline",icon:f.jsx(Hl,{className:"h-3 w-3"})},c=a.completed_at||a.started_at||a.created_at;let u=[];if(a.files_changed)try{u=typeof a.files_changed=="string"?JSON.parse(a.files_changed):a.files_changed}catch(h){console.error("Failed to parse files_changed:",h)}const d=(h,p=8)=>h.substring(0,p);return f.jsx("div",{children:f.jsxs(Ht,{className:"cursor-pointer rounded-r-md border-l-4 border-l-green-500/50 bg-green-50/50 p-4 transition-colors hover:bg-green-100/50 dark:bg-green-950/20 dark:hover:bg-green-950/50",onClick:()=>n(`/executions/${a.id}`),children:[f.jsx("div",{className:"mb-2 flex items-start justify-between gap-2",children:f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx(NR,{className:"h-4 w-4 text-green-600 dark:text-green-400"}),f.jsx("code",{className:"font-mono text-xs text-muted-foreground",children:d(a.id)}),f.jsxs(et,{variant:l.variant,className:"gap-1",children:[l.icon,l.label]}),f.jsx("span",{className:"text-xs text-muted-foreground",children:oo(new Date(c),{addSuffix:!0})})]})}),f.jsxs("div",{className:"space-y-1 text-sm",children:[f.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[f.jsx("span",{children:a.model}),f.jsx("span",{children:"•"}),f.jsx("span",{className:"capitalize",children:a.mode})]}),a.error&&f.jsxs("div",{className:"line-clamp-2 rounded bg-destructive/10 p-2 text-xs text-destructive",children:["Error: ",a.error]}),u.length>0&&f.jsxs("div",{className:"text-xs text-muted-foreground",children:[u.length," file(s) changed"]})]})]})},a.id)};return f.jsx("div",{className:`space-y-3 ${e}`,children:r.map(a=>a.itemType==="execution"?o(a):i(a))})}const O0="sudocode:details:viewMode",I0="sudocode:issue:descriptionCollapsed",F7=[{value:"open",label:"Open"},{value:"in_progress",label:"In Progress"},{value:"blocked",label:"Blocked"},{value:"needs_review",label:"Needs Review"},{value:"closed",label:"Closed"}],B7=[{value:"0",label:"Critical (P0)"},{value:"1",label:"High (P1)"},{value:"2",label:"Medium (P2)"},{value:"3",label:"Low (P3)"},{value:"4",label:"None (P4)"}];function Cy({issue:t,onClose:e,onUpdate:n,onDelete:r,onArchive:s,onUnarchive:i,isUpdating:o=!1,isDeleting:a=!1,showOpenDetail:l=!1,hideTopControls:c=!1,viewMode:u,onViewModeChange:d,showViewToggleInline:h=!0,feedback:p=[]}){const m=_r(),[g,b]=y.useState(t.title),[x,w]=y.useState(t.content||""),[v,k]=y.useState(t.status),[N,S]=y.useState(()=>{const Z=localStorage.getItem(O0);return Z!==null?JSON.parse(Z):"formatted"}),[C,T]=y.useState(()=>{const Z=localStorage.getItem(I0);return Z!==null?JSON.parse(Z):!1}),R=y.useRef(null),_=u??N,I=Z=>{d?d(Z):S(Z)},[D,V]=y.useState(t.priority),[j,L]=y.useState(!1),[q,re]=y.useState([]),[X,ce]=y.useState(!1),[A,ue]=y.useState(!1),[be,E]=y.useState(!1),[P,z]=y.useState([]),H=y.useRef(null),B=y.useRef(null),{subscribe:J,unsubscribe:K,addMessageHandler:Y,removeMessageHandler:le}=$a(),{createRelationshipAsync:ye,deleteRelationshipAsync:Re}=V2(),Oe=y.useRef(n),ht=y.useRef({title:g,content:x,status:v,priority:D,hasChanges:be});y.useEffect(()=>{Oe.current=n},[n]),y.useEffect(()=>{ht.current={title:g,content:x,status:v,priority:D,hasChanges:be}},[g,x,v,D,be]),y.useEffect(()=>{B.current&&(clearTimeout(B.current),B.current=null),E(!1)},[t.id]),y.useEffect(()=>{u||localStorage.setItem(O0,JSON.stringify(N))},[N,u]),y.useEffect(()=>{localStorage.setItem(I0,JSON.stringify(C))},[C]),y.useEffect(()=>{b(t.title),w(t.content||""),k(t.status),V(t.priority),E(!1)},[t]),y.useEffect(()=>{let Z=!0;return(async()=>{if(Z){ue(!0);try{const F=await ia.getForEntity(t.id,"issue");let W=[];if(Array.isArray(F))W=F;else if(F&&typeof F=="object"&&"outgoing"in F&&"incoming"in F){const ge=F;W=[...ge.outgoing||[],...ge.incoming||[]]}Z&&re(W)}catch(F){console.error("Failed to fetch relationships:",F),Z&&re([])}finally{Z&&ue(!1)}}})(),()=>{Z=!1}},[t.id]),y.useEffect(()=>{let Z=!0;const ct=async()=>{if(Z)try{const ge=await gr.list(t.id);Z&&z(ge)}catch(ge){console.error("Failed to fetch executions:",ge),Z&&z([])}};ct();const F=`issue-panel-executions-${t.id}`,W=ge=>{(ge.type==="execution_created"||ge.type==="execution_updated"||ge.type==="execution_status_changed"||ge.type==="execution_deleted")&&ct()};return J("issue",t.id),Y(F,W),()=>{Z=!1,le(F),K("issue",t.id)}},[t.id,J,K,Y,le]),y.useEffect(()=>{const Z=ct=>{var U;if(!H.current||!e)return;const F=ct.target,W=F;if(W.closest("[data-issue-id]")||W.closest("[data-panel-resize-handle-id]")||(U=W.classList)!=null&&U.contains("cursor-col-resize"))return;const tt=W.closest('[role="dialog"]'),Ot=W.closest('[role="alertdialog"]'),Vn=W.closest('[role="listbox"]'),On=W.closest("[data-radix-popper-content-wrapper]"),dr=W.closest("[data-radix-select-content]"),nr=W.closest("[data-radix-select-viewport]"),Kt=W.closest('[data-state="open"]'),fr=document.querySelector('[data-radix-select-trigger][data-state="open"]'),sn=W.hasAttribute("data-dialog-overlay")||W.closest("[data-dialog-overlay]"),zo=Vn||dr||nr||Kt||!!fr,Fo=W.closest(".ProseMirror"),el=W.closest(".tiptap-editor"),Wt=W.closest("[data-tippy-root]"),Pt=W.closest(".tippy-box");if(tt||Ot||On||sn||Fo||el||Wt||Pt||zo)return;const M=H.current.contains(F);if(X){const Q=H.current.querySelector("[data-relationship-form-container]");if((Q==null?void 0:Q.contains(F))||!1)return;if(M){ce(!1);return}else{ce(!1);return}}else M||e()};return document.addEventListener("mousedown",Z),()=>{document.removeEventListener("mousedown",Z)}},[e,X]),y.useEffect(()=>{const Z=ct=>{e&&(j||X||ct.key==="Escape"&&e())};return document.addEventListener("keydown",Z),()=>{document.removeEventListener("keydown",Z)}},[e,j,X]),y.useEffect(()=>{if(!(!be||!Oe.current))return B.current&&clearTimeout(B.current),B.current=setTimeout(()=>{var Z;(Z=Oe.current)==null||Z.call(Oe,{title:g,content:x,status:v,priority:D}),E(!1)},1e3),()=>{B.current&&clearTimeout(B.current)}},[g,x,v,D,be]),y.useEffect(()=>()=>{const{hasChanges:Z,title:ct,content:F,status:W,priority:ge}=ht.current;Z&&Oe.current&&Oe.current({title:ct,content:F,status:W,priority:ge})},[]),y.useEffect(()=>{if(_==="markdown"&&R.current){const Z=R.current;Z.style.height="auto",Z.style.height=`${Z.scrollHeight}px`}},[x,_]);const De=Z=>{b(Z),E(!0)},_t=Z=>{w(Z),E(!0)},ot=Z=>{k(Z),E(!0)},dn=Z=>{V(Z),E(!0)},qt=()=>{r==null||r(),L(!1)},me=async(Z,ct,F)=>{try{const W=await ye({from_id:t.id,from_type:"issue",to_id:Z,to_type:ct,relationship_type:F});re([...q,W]),ce(!1)}catch(W){console.error("Failed to create relationship:",W)}},ze=async Z=>{try{await Re({from_id:Z.from_id,from_type:Z.from_type,to_id:Z.to_id,to_type:Z.to_type,relationship_type:Z.relationship_type}),re(q.filter(ct=>!(ct.from_id===Z.from_id&&ct.to_id===Z.to_id&&ct.relationship_type===Z.relationship_type)))}catch(ct){console.error("Failed to delete relationship:",ct)}},Vt=async(Z,ct)=>{try{await gr.create(t.id,{config:Z,prompt:ct})}catch(F){console.error("Failed to create execution:",F)}};return f.jsx(Ts,{delayDuration:300,children:f.jsxs("div",{className:"flex h-full w-full flex-col",ref:H,children:[!c&&f.jsxs("div",{className:"flex items-center justify-between px-6 py-3",children:[f.jsxs("div",{className:"flex items-center gap-4",children:[e&&f.jsxs(Sn,{children:[f.jsx(En,{asChild:!0,children:f.jsx("button",{onClick:e,className:"text-muted-foreground hover:text-foreground","aria-label":"Back",children:f.jsx(xf,{className:"h-4 w-4"})})}),f.jsx(gn,{children:"Close (ESC)"})]}),l&&f.jsxs(Sn,{children:[f.jsx(En,{asChild:!0,children:f.jsx("button",{onClick:()=>m(`/issues/${t.id}`),className:"text-muted-foreground hover:text-foreground","aria-label":"Open in full page",children:f.jsx(uR,{className:"h-4 w-4"})})}),f.jsx(gn,{children:"Open in full page"})]})]}),f.jsxs("div",{className:"flex items-center gap-4",children:[h&&f.jsxs("div",{className:"mr-4 flex gap-1 rounded-md border border-border bg-muted/30 p-1",children:[f.jsxs(ie,{variant:_==="formatted"?"outline":"ghost",size:"sm",onClick:()=>I("formatted"),className:`h-7 rounded-sm ${_==="formatted"?"shadow-sm":"text-muted-foreground hover:bg-muted"}`,children:[f.jsx(Os,{className:"mr-2 h-4 w-4"}),"Formatted"]}),f.jsxs(ie,{variant:_==="markdown"?"outline":"ghost",size:"sm",onClick:()=>I("markdown"),className:`h-7 rounded-sm ${_==="markdown"?"shadow-sm":"text-muted-foreground hover:bg-muted"}`,children:[f.jsx(vc,{className:"mr-2 h-4 w-4"}),"Markdown"]})]}),(s||i)&&f.jsxs(Sn,{children:[f.jsx(En,{asChild:!0,children:f.jsx("button",{onClick:()=>t.archived?i==null?void 0:i(t.id):s==null?void 0:s(t.id),className:"text-muted-foreground hover:text-foreground","aria-label":t.archived?"Unarchive":"Archive",disabled:o,children:t.archived?f.jsx(Bg,{className:"h-4 w-4"}):f.jsx(Ha,{className:"h-4 w-4"})})}),f.jsx(gn,{children:t.archived?"Unarchive":"Archive"})]}),r&&f.jsxs(Sn,{children:[f.jsx(En,{asChild:!0,children:f.jsx("button",{onClick:()=>L(!0),className:"text-muted-foreground hover:text-destructive","aria-label":"Delete",disabled:o||a,children:f.jsx(Do,{className:"h-4 w-4"})})}),f.jsx(gn,{children:"Delete issue"})]})]})]}),f.jsx("div",{className:`w-full flex-1 overflow-y-auto ${c?"py-4":"py-3"}`,children:f.jsxs("div",{className:"mx-auto w-full max-w-7xl space-y-4 px-6",children:[f.jsxs("div",{className:"space-y-2 pb-3",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(et,{variant:"issue",className:"font-mono",children:t.id}),t.parent_id&&f.jsxs(f.Fragment,{children:[f.jsx(Ua,{className:"h-3.5 w-3.5 text-muted-foreground"}),f.jsx("span",{className:"text-sm text-muted-foreground",children:"Parent: "}),f.jsx("button",{onClick:()=>m(`/issues/${t.parent_id}`),children:f.jsx(et,{variant:"issue",className:"cursor-pointer hover:opacity-80",children:t.parent_id})})]})]}),n&&f.jsx("div",{className:"text-xs italic text-muted-foreground",children:o?"Saving...":be?"Unsaved changes...":"All changes saved"})]}),f.jsx(ns,{value:g,onChange:Z=>De(Z.target.value),placeholder:"Issue title...",disabled:o,className:"border-none bg-transparent px-0 text-2xl font-semibold shadow-none focus-visible:ring-0"})]}),f.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(aR,{className:"h-4 w-4 text-muted-foreground"}),f.jsxs(Jn,{value:v,onValueChange:Z=>ot(Z),disabled:o,children:[f.jsx(zn,{className:"h-8 w-auto gap-3 rounded-md border-none bg-accent px-3 shadow-none hover:bg-accent/80",children:f.jsx(Yn,{placeholder:"Status"})}),f.jsx(Fn,{children:F7.map(Z=>f.jsx(Mt,{value:Z.value,children:Z.label},Z.value))})]})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(Wk,{className:"h-4 w-4 text-muted-foreground"}),f.jsxs(Jn,{value:String(D),onValueChange:Z=>dn(parseInt(Z)),disabled:o,children:[f.jsx(zn,{className:"h-8 w-auto gap-3 rounded-md border-none bg-accent px-3 shadow-none hover:bg-accent/80",children:f.jsx(Yn,{placeholder:"Priority"})}),f.jsx(Fn,{children:B7.map(Z=>f.jsx(Mt,{value:Z.value,children:Z.label},Z.value))})]})]}),f.jsx("div",{className:"ml-auto text-xs text-muted-foreground",children:t.closed_at?`Closed ${oo(new Date(t.closed_at.endsWith("Z")?t.closed_at:t.closed_at+"Z"),{addSuffix:!0})}`:`Updated ${oo(new Date(t.updated_at.endsWith("Z")?t.updated_at:t.updated_at+"Z"),{addSuffix:!0})}`})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsxs("div",{className:"flex items-center gap-4",children:[f.jsxs("div",{className:"flex items-center gap-1",children:[f.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Relationships"}),f.jsx(et,{variant:"secondary",children:q.length})]}),f.jsxs(ie,{variant:"outline",size:"xs",onClick:()=>ce(!X),className:"h-6",children:[f.jsx(bo,{className:"mr-1 h-4 w-4"}),"Add"]})]}),X&&f.jsx("div",{className:"rounded-lg border p-4","data-relationship-form-container":!0,children:f.jsx(CC,{fromId:t.id,fromType:"issue",onSubmit:me,onCancel:()=>ce(!1)})}),A?f.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:"Loading relationships..."}):f.jsx(cC,{relationships:q,currentEntityId:t.id,currentEntityType:"issue",onDelete:ze,showEmpty:!1,showGroupHeaders:!1})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Description"}),f.jsx(ie,{variant:"ghost",size:"xs",onClick:()=>T(!C),className:"h-6 gap-1 text-muted-foreground",children:C?f.jsxs(f.Fragment,{children:[f.jsx($l,{className:"h-4 w-4"}),"Expand"]}):f.jsxs(f.Fragment,{children:[f.jsx(Hg,{className:"h-4 w-4"}),"Collapse"]})})]}),f.jsxs("div",{className:"relative",children:[f.jsx("div",{className:`overflow-hidden transition-all duration-300 ease-in-out ${C?"max-h-[200px] cursor-pointer 2xl:max-h-[300px]":""}`,onClick:()=>{C&&T(!1)},children:f.jsx(Ht,{className:"overflow-hidden rounded-md border",children:_==="formatted"?f.jsx(uh,{content:x,editable:!C,onChange:_t,onCancel:()=>{w(t.content||""),E(!1)},className:"min-h-[200px]",placeholder:"Issue description..."}):f.jsx("div",{className:"p-4",children:f.jsx("textarea",{ref:R,value:x,onChange:Z=>_t(Z.target.value),placeholder:"Issue description in markdown...",className:"w-full resize-none border-none bg-transparent font-mono text-sm leading-6 outline-none focus:ring-0",spellCheck:!1,disabled:C,style:{minHeight:"200px"}})})})}),C&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"pointer-events-none absolute bottom-0 left-0 right-0 h-16 bg-gradient-to-t from-background to-transparent"}),f.jsx("div",{className:"absolute bottom-2 left-1/2 -translate-x-1/2",children:f.jsxs(ie,{variant:"outline",size:"sm",onClick:Z=>{Z.stopPropagation(),T(!1)},className:"gap-1 shadow-sm",children:[f.jsx($l,{className:"h-4 w-4"}),"Expand"]})})]})]})]}),t.assignee&&f.jsx("div",{className:"border-t pt-4",children:f.jsxs("div",{className:"text-sm",children:[f.jsx("span",{className:"text-muted-foreground",children:"Assignee: "}),f.jsx("span",{children:t.assignee})]})}),f.jsxs("div",{className:"space-y-2",children:[f.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Activity"}),f.jsx(z7,{items:[...p.map(Z=>({...Z,itemType:"feedback"})),...P.map(Z=>({...Z,itemType:"execution"}))]})]})]})}),f.jsx("div",{className:"border-t border-border bg-muted/30",children:f.jsx("div",{className:"mx-auto w-full max-w-7xl px-6",children:f.jsx(U2,{issueId:t.id,onStart:Vt,disabled:t.archived||o})})}),f.jsx(aC,{issue:t,isOpen:j,onClose:()=>L(!1),onConfirm:qt,isDeleting:a})]})})}const D0="sudocode:issueEditor:viewMode",$7=[{value:"open",label:"Open"},{value:"in_progress",label:"In Progress"},{value:"blocked",label:"Blocked"},{value:"needs_review",label:"Needs Review"},{value:"closed",label:"Closed"}],H7=[{value:"0",label:"Critical (P0)"},{value:"1",label:"High (P1)"},{value:"2",label:"Medium (P2)"},{value:"3",label:"Low (P3)"},{value:"4",label:"None (P4)"}];function U7({issue:t,onSave:e,onCancel:n,isLoading:r=!1}){const[s,i]=y.useState((t==null?void 0:t.title)||""),[o,a]=y.useState((t==null?void 0:t.content)||""),[l,c]=y.useState((t==null?void 0:t.status)||"open"),[u,d]=y.useState((t==null?void 0:t.priority)??2),[h,p]=y.useState({}),[m,g]=y.useState(()=>{const v=localStorage.getItem(D0);return v!==null?JSON.parse(v):"formatted"}),b=y.useRef(null);y.useEffect(()=>{t&&(i(t.title),a(t.content||""),c(t.status),d(t.priority))},[t]),y.useEffect(()=>{localStorage.setItem(D0,JSON.stringify(m))},[m]),y.useEffect(()=>{if(m==="markdown"&&b.current){const v=b.current;v.style.height="auto",v.style.height=`${v.scrollHeight}px`}},[o,m]);const x=()=>{const v={};return s.trim()?s.length>200&&(v.title="Title must be less than 200 characters"):v.title="Title is required",p(v),Object.keys(v).length===0},w=v=>{v.preventDefault(),x()&&e({title:s,content:o,status:l,priority:u})};return f.jsxs("form",{onSubmit:w,className:"space-y-4",children:[f.jsxs("div",{className:"space-y-2",children:[f.jsxs(Zn,{htmlFor:"title",children:["Title ",f.jsx("span",{className:"text-destructive",children:"*"})]}),f.jsx(ns,{id:"title",value:s,onChange:v=>i(v.target.value),placeholder:"Enter issue title...",className:h.title?"border-destructive":"",disabled:r}),h.title&&f.jsx("p",{className:"text-sm text-destructive",children:h.title})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx(Zn,{htmlFor:"content",children:"Details"}),f.jsxs("div",{className:"flex gap-1 rounded-md border border-border bg-muted/30 p-1",children:[f.jsxs(ie,{variant:m==="formatted"?"outline":"ghost",size:"sm",onClick:()=>g("formatted"),className:`h-7 rounded-sm ${m==="formatted"?"shadow-sm":"text-muted-foreground hover:bg-muted"}`,type:"button",children:[f.jsx(Os,{className:"mr-2 h-4 w-4"}),"Formatted"]}),f.jsxs(ie,{variant:m==="markdown"?"outline":"ghost",size:"sm",onClick:()=>g("markdown"),className:`h-7 rounded-sm ${m==="markdown"?"shadow-sm":"text-muted-foreground hover:bg-muted"}`,type:"button",children:[f.jsx(vc,{className:"mr-2 h-4 w-4"}),"Markdown"]})]})]}),f.jsx(Ht,{className:"overflow-hidden rounded-md border",children:m==="formatted"?f.jsx(uh,{content:o,editable:!0,onChange:v=>a(v),onSave:v=>a(v),onCancel:()=>{t&&a(t.content||"")},className:"min-h-[300px]",placeholder:"Issue description..."}):f.jsx("div",{className:"p-4",children:f.jsx("textarea",{ref:b,value:o,onChange:v=>a(v.target.value),placeholder:"Issue description in markdown...",className:"w-full resize-none border-none bg-transparent font-mono text-sm leading-6 outline-none focus:ring-0",spellCheck:!1,style:{minHeight:"300px"},disabled:r})})})]}),f.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[f.jsxs("div",{className:"space-y-2",children:[f.jsx(Zn,{htmlFor:"status",children:"Status"}),f.jsxs(Jn,{value:l,onValueChange:v=>c(v),disabled:r,children:[f.jsx(zn,{id:"status",children:f.jsx(Yn,{placeholder:"Select status"})}),f.jsx(Fn,{children:$7.map(v=>f.jsx(Mt,{value:v.value,children:v.label},v.value))})]})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(Zn,{htmlFor:"priority",children:"Priority"}),f.jsxs(Jn,{value:String(u),onValueChange:v=>d(parseInt(v)),disabled:r,children:[f.jsx(zn,{id:"priority",children:f.jsx(Yn,{placeholder:"Select priority"})}),f.jsx(Fn,{children:H7.map(v=>f.jsx(Mt,{value:v.value,children:v.label},v.value))})]})]})]}),f.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[f.jsx(ie,{type:"button",variant:"outline",onClick:n,disabled:r,children:"Cancel"}),f.jsx(ie,{type:"submit",disabled:r,children:r?"Saving...":t?"Update Issue":"Create Issue"})]})]})}function V7({isOpen:t,onClose:e,onCreate:n,isCreating:r=!1,defaultStatus:s}){const[i,o]=y.useState(!1),a=c=>{n(c),o(!1)},l=()=>{i&&!window.confirm("You have unsaved changes. Are you sure you want to close?")||(o(!1),e())};return f.jsx(Lo,{open:t,onOpenChange:l,children:f.jsxs(Ni,{className:"max-h-[90vh] max-w-2xl overflow-y-auto",children:[f.jsx(_i,{children:f.jsx(Ti,{children:"Create New Issue"})}),f.jsx(U7,{issue:s?{status:s,priority:2}:null,onSave:a,onCancel:l,isLoading:r})]})})}const dh=y.createContext(null);dh.displayName="PanelGroupContext";const Bt={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},Ny=10,ho=y.useLayoutEffect,L0=Nk.useId,W7=typeof L0=="function"?L0:()=>null;let q7=0;function _y(t=null){const e=W7(),n=y.useRef(t||e||null);return n.current===null&&(n.current=""+q7++),t??n.current}function hA({children:t,className:e="",collapsedSize:n,collapsible:r,defaultSize:s,forwardedRef:i,id:o,maxSize:a,minSize:l,onCollapse:c,onExpand:u,onResize:d,order:h,style:p,tagName:m="div",...g}){const b=y.useContext(dh);if(b===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:x,expandPanel:w,getPanelSize:v,getPanelStyle:k,groupId:N,isPanelCollapsed:S,reevaluatePanelConstraints:C,registerPanel:T,resizePanel:R,unregisterPanel:_}=b,I=_y(o),D=y.useRef({callbacks:{onCollapse:c,onExpand:u,onResize:d},constraints:{collapsedSize:n,collapsible:r,defaultSize:s,maxSize:a,minSize:l},id:I,idIsFromProps:o!==void 0,order:h});y.useRef({didLogMissingDefaultSizeWarning:!1}),ho(()=>{const{callbacks:j,constraints:L}=D.current,q={...L};D.current.id=I,D.current.idIsFromProps=o!==void 0,D.current.order=h,j.onCollapse=c,j.onExpand=u,j.onResize=d,L.collapsedSize=n,L.collapsible=r,L.defaultSize=s,L.maxSize=a,L.minSize=l,(q.collapsedSize!==L.collapsedSize||q.collapsible!==L.collapsible||q.maxSize!==L.maxSize||q.minSize!==L.minSize)&&C(D.current,q)}),ho(()=>{const j=D.current;return T(j),()=>{_(j)}},[h,I,T,_]),y.useImperativeHandle(i,()=>({collapse:()=>{x(D.current)},expand:j=>{w(D.current,j)},getId(){return I},getSize(){return v(D.current)},isCollapsed(){return S(D.current)},isExpanded(){return!S(D.current)},resize:j=>{R(D.current,j)}}),[x,w,v,S,I,R]);const V=k(D.current,s);return y.createElement(m,{...g,children:t,className:e,id:I,style:{...V,...p},[Bt.groupId]:N,[Bt.panel]:"",[Bt.panelCollapsible]:r||void 0,[Bt.panelId]:I,[Bt.panelSize]:parseFloat(""+V.flexGrow).toFixed(1)})}const lc=y.forwardRef((t,e)=>y.createElement(hA,{...t,forwardedRef:e}));hA.displayName="Panel";lc.displayName="forwardRef(Panel)";let gg=null,Ku=-1,Xs=null;function K7(t,e,n){const r=(e&yA)!==0,s=(e&xA)!==0,i=(e&vA)!==0,o=(e&wA)!==0;if(e){if(r)return i?"se-resize":o?"ne-resize":"e-resize";if(s)return i?"sw-resize":o?"nw-resize":"w-resize";if(i)return"s-resize";if(o)return"n-resize"}switch(t){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function G7(){Xs!==null&&(document.head.removeChild(Xs),gg=null,Xs=null,Ku=-1)}function jp(t,e,n){var r,s;const i=K7(t,e);if(gg!==i){if(gg=i,Xs===null&&(Xs=document.createElement("style"),document.head.appendChild(Xs)),Ku>=0){var o;(o=Xs.sheet)===null||o===void 0||o.removeRule(Ku)}Ku=(r=(s=Xs.sheet)===null||s===void 0?void 0:s.insertRule(`*{cursor: ${i} !important;}`))!==null&&r!==void 0?r:-1}}function pA(t){return t.type==="keydown"}function mA(t){return t.type.startsWith("pointer")}function gA(t){return t.type.startsWith("mouse")}function fh(t){if(mA(t)){if(t.isPrimary)return{x:t.clientX,y:t.clientY}}else if(gA(t))return{x:t.clientX,y:t.clientY};return{x:1/0,y:1/0}}function J7(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function Y7(t,e,n){return t.x<e.x+e.width&&t.x+t.width>e.x&&t.y<e.y+e.height&&t.y+t.height>e.y}function Z7(t,e){if(t===e)throw new Error("Cannot compare node with itself");const n={a:z0(t),b:z0(e)};let r;for(;n.a.at(-1)===n.b.at(-1);)t=n.a.pop(),e=n.b.pop(),r=t;Ke(r,"Stacking order can only be calculated for elements with a common ancestor");const s={a:j0(P0(n.a)),b:j0(P0(n.b))};if(s.a===s.b){const i=r.childNodes,o={a:n.a.at(-1),b:n.b.at(-1)};let a=i.length;for(;a--;){const l=i[a];if(l===o.a)return 1;if(l===o.b)return-1}}return Math.sign(s.a-s.b)}const X7=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Q7(t){var e;const n=getComputedStyle((e=bA(t))!==null&&e!==void 0?e:t).display;return n==="flex"||n==="inline-flex"}function eJ(t){const e=getComputedStyle(t);return!!(e.position==="fixed"||e.zIndex!=="auto"&&(e.position!=="static"||Q7(t))||+e.opacity<1||"transform"in e&&e.transform!=="none"||"webkitTransform"in e&&e.webkitTransform!=="none"||"mixBlendMode"in e&&e.mixBlendMode!=="normal"||"filter"in e&&e.filter!=="none"||"webkitFilter"in e&&e.webkitFilter!=="none"||"isolation"in e&&e.isolation==="isolate"||X7.test(e.willChange)||e.webkitOverflowScrolling==="touch")}function P0(t){let e=t.length;for(;e--;){const n=t[e];if(Ke(n,"Missing node"),eJ(n))return n}return null}function j0(t){return t&&Number(getComputedStyle(t).zIndex)||0}function z0(t){const e=[];for(;t;)e.push(t),t=bA(t);return e}function bA(t){const{parentNode:e}=t;return e&&e instanceof ShadowRoot?e.host:e}const yA=1,xA=2,vA=4,wA=8,tJ=J7()==="coarse";let jr=[],fa=!1,Qs=new Map,hh=new Map;const cc=new Set;function nJ(t,e,n,r,s){var i;const{ownerDocument:o}=e,a={direction:n,element:e,hitAreaMargins:r,setResizeHandlerState:s},l=(i=Qs.get(o))!==null&&i!==void 0?i:0;return Qs.set(o,l+1),cc.add(a),rf(),function(){var u;hh.delete(t),cc.delete(a);const d=(u=Qs.get(o))!==null&&u!==void 0?u:1;if(Qs.set(o,d-1),rf(),d===1&&Qs.delete(o),jr.includes(a)){const h=jr.indexOf(a);h>=0&&jr.splice(h,1),ph(),s("up",!0,null)}}}function rJ(t){const{target:e}=t,{x:n,y:r}=fh(t);fa=!0,Ty({target:e,x:n,y:r}),rf(),jr.length>0&&(sf("down",t),ph(),t.preventDefault(),kA(e)||t.stopImmediatePropagation())}function zp(t){const{x:e,y:n}=fh(t);if(fa&&t.type!=="pointerleave"&&t.buttons===0&&(fa=!1,sf("up",t)),!fa){const{target:r}=t;Ty({target:r,x:e,y:n})}sf("move",t),ph(),jr.length>0&&t.preventDefault()}function Fp(t){const{target:e}=t,{x:n,y:r}=fh(t);hh.clear(),fa=!1,jr.length>0&&(t.preventDefault(),kA(e)||t.stopImmediatePropagation()),sf("up",t),Ty({target:e,x:n,y:r}),ph(),rf()}function kA(t){let e=t;for(;e;){if(e.hasAttribute(Bt.resizeHandle))return!0;e=e.parentElement}return!1}function Ty({target:t,x:e,y:n}){jr.splice(0);let r=null;(t instanceof HTMLElement||t instanceof SVGElement)&&(r=t),cc.forEach(s=>{const{element:i,hitAreaMargins:o}=s,a=i.getBoundingClientRect(),{bottom:l,left:c,right:u,top:d}=a,h=tJ?o.coarse:o.fine;if(e>=c-h&&e<=u+h&&n>=d-h&&n<=l+h){if(r!==null&&document.contains(r)&&i!==r&&!i.contains(r)&&!r.contains(i)&&Z7(r,i)>0){let m=r,g=!1;for(;m&&!m.contains(i);){if(Y7(m.getBoundingClientRect(),a)){g=!0;break}m=m.parentElement}if(g)return}jr.push(s)}})}function Bp(t,e){hh.set(t,e)}function ph(){let t=!1,e=!1;jr.forEach(r=>{const{direction:s}=r;s==="horizontal"?t=!0:e=!0});let n=0;hh.forEach(r=>{n|=r}),t&&e?jp("intersection",n):t?jp("horizontal",n):e?jp("vertical",n):G7()}let $p;function rf(){var t;(t=$p)===null||t===void 0||t.abort(),$p=new AbortController;const e={capture:!0,signal:$p.signal};cc.size&&(fa?(jr.length>0&&Qs.forEach((n,r)=>{const{body:s}=r;n>0&&(s.addEventListener("contextmenu",Fp,e),s.addEventListener("pointerleave",zp,e),s.addEventListener("pointermove",zp,e))}),Qs.forEach((n,r)=>{const{body:s}=r;s.addEventListener("pointerup",Fp,e),s.addEventListener("pointercancel",Fp,e)})):Qs.forEach((n,r)=>{const{body:s}=r;n>0&&(s.addEventListener("pointerdown",rJ,e),s.addEventListener("pointermove",zp,e))}))}function sf(t,e){cc.forEach(n=>{const{setResizeHandlerState:r}=n,s=jr.includes(n);r(t,s,e)})}function sJ(){const[t,e]=y.useState(0);return y.useCallback(()=>e(n=>n+1),[])}function Ke(t,e){if(!t)throw console.error(e),Error(e)}function To(t,e,n=Ny){return t.toFixed(n)===e.toFixed(n)?0:t>e?1:-1}function ks(t,e,n=Ny){return To(t,e,n)===0}function ir(t,e,n){return To(t,e,n)===0}function iJ(t,e,n){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++){const s=t[r],i=e[r];if(!ir(s,i,n))return!1}return!0}function na({panelConstraints:t,panelIndex:e,size:n}){const r=t[e];Ke(r!=null,`Panel constraints not found for index ${e}`);let{collapsedSize:s=0,collapsible:i,maxSize:o=100,minSize:a=0}=r;if(To(n,a)<0)if(i){const l=(s+a)/2;To(n,l)<0?n=s:n=a}else n=a;return n=Math.min(o,n),n=parseFloat(n.toFixed(Ny)),n}function vl({delta:t,initialLayout:e,panelConstraints:n,pivotIndices:r,prevLayout:s,trigger:i}){if(ir(t,0))return e;const o=[...e],[a,l]=r;Ke(a!=null,"Invalid first pivot index"),Ke(l!=null,"Invalid second pivot index");let c=0;if(i==="keyboard"){{const d=t<0?l:a,h=n[d];Ke(h,`Panel constraints not found for index ${d}`);const{collapsedSize:p=0,collapsible:m,minSize:g=0}=h;if(m){const b=e[d];if(Ke(b!=null,`Previous layout not found for panel index ${d}`),ir(b,p)){const x=g-b;To(x,Math.abs(t))>0&&(t=t<0?0-x:x)}}}{const d=t<0?a:l,h=n[d];Ke(h,`No panel constraints found for index ${d}`);const{collapsedSize:p=0,collapsible:m,minSize:g=0}=h;if(m){const b=e[d];if(Ke(b!=null,`Previous layout not found for panel index ${d}`),ir(b,g)){const x=b-p;To(x,Math.abs(t))>0&&(t=t<0?0-x:x)}}}}{const d=t<0?1:-1;let h=t<0?l:a,p=0;for(;;){const g=e[h];Ke(g!=null,`Previous layout not found for panel index ${h}`);const x=na({panelConstraints:n,panelIndex:h,size:100})-g;if(p+=x,h+=d,h<0||h>=n.length)break}const m=Math.min(Math.abs(t),Math.abs(p));t=t<0?0-m:m}{let h=t<0?a:l;for(;h>=0&&h<n.length;){const p=Math.abs(t)-Math.abs(c),m=e[h];Ke(m!=null,`Previous layout not found for panel index ${h}`);const g=m-p,b=na({panelConstraints:n,panelIndex:h,size:g});if(!ir(m,b)&&(c+=m-b,o[h]=b,c.toFixed(3).localeCompare(Math.abs(t).toFixed(3),void 0,{numeric:!0})>=0))break;t<0?h--:h++}}if(iJ(s,o))return s;{const d=t<0?l:a,h=e[d];Ke(h!=null,`Previous layout not found for panel index ${d}`);const p=h+c,m=na({panelConstraints:n,panelIndex:d,size:p});if(o[d]=m,!ir(m,p)){let g=p-m,x=t<0?l:a;for(;x>=0&&x<n.length;){const w=o[x];Ke(w!=null,`Previous layout not found for panel index ${x}`);const v=w+g,k=na({panelConstraints:n,panelIndex:x,size:v});if(ir(w,k)||(g-=k-w,o[x]=k),ir(g,0))break;t>0?x--:x++}}}const u=o.reduce((d,h)=>h+d,0);return ir(u,100)?o:s}function oJ({layout:t,panelsArray:e,pivotIndices:n}){let r=0,s=100,i=0,o=0;const a=n[0];Ke(a!=null,"No pivot index found"),e.forEach((d,h)=>{const{constraints:p}=d,{maxSize:m=100,minSize:g=0}=p;h===a?(r=g,s=m):(i+=g,o+=m)});const l=Math.min(s,100-i),c=Math.max(r,100-o),u=t[a];return{valueMax:l,valueMin:c,valueNow:u}}function uc(t,e=document){return Array.from(e.querySelectorAll(`[${Bt.resizeHandleId}][data-panel-group-id="${t}"]`))}function SA(t,e,n=document){const s=uc(t,n).findIndex(i=>i.getAttribute(Bt.resizeHandleId)===e);return s??null}function EA(t,e,n){const r=SA(t,e,n);return r!=null?[r,r+1]:[-1,-1]}function aJ(t){return t instanceof HTMLElement?!0:typeof t=="object"&&t!==null&&"tagName"in t&&"getAttribute"in t}function CA(t,e=document){if(aJ(e)&&e.dataset.panelGroupId==t)return e;const n=e.querySelector(`[data-panel-group][data-panel-group-id="${t}"]`);return n||null}function mh(t,e=document){const n=e.querySelector(`[${Bt.resizeHandleId}="${t}"]`);return n||null}function lJ(t,e,n,r=document){var s,i,o,a;const l=mh(e,r),c=uc(t,r),u=l?c.indexOf(l):-1,d=(s=(i=n[u])===null||i===void 0?void 0:i.id)!==null&&s!==void 0?s:null,h=(o=(a=n[u+1])===null||a===void 0?void 0:a.id)!==null&&o!==void 0?o:null;return[d,h]}function cJ({committedValuesRef:t,eagerValuesRef:e,groupId:n,layout:r,panelDataArray:s,panelGroupElement:i,setLayout:o}){y.useRef({didWarnAboutMissingResizeHandle:!1}),ho(()=>{if(!i)return;const a=uc(n,i);for(let l=0;l<s.length-1;l++){const{valueMax:c,valueMin:u,valueNow:d}=oJ({layout:r,panelsArray:s,pivotIndices:[l,l+1]}),h=a[l];if(h!=null){const p=s[l];Ke(p,`No panel data found for index "${l}"`),h.setAttribute("aria-controls",p.id),h.setAttribute("aria-valuemax",""+Math.round(c)),h.setAttribute("aria-valuemin",""+Math.round(u)),h.setAttribute("aria-valuenow",d!=null?""+Math.round(d):"")}}return()=>{a.forEach((l,c)=>{l.removeAttribute("aria-controls"),l.removeAttribute("aria-valuemax"),l.removeAttribute("aria-valuemin"),l.removeAttribute("aria-valuenow")})}},[n,r,s,i]),y.useEffect(()=>{if(!i)return;const a=e.current;Ke(a,"Eager values not found");const{panelDataArray:l}=a,c=CA(n,i);Ke(c!=null,`No group found for id "${n}"`);const u=uc(n,i);Ke(u,`No resize handles found for group id "${n}"`);const d=u.map(h=>{const p=h.getAttribute(Bt.resizeHandleId);Ke(p,"Resize handle element has no handle id attribute");const[m,g]=lJ(n,p,l,i);if(m==null||g==null)return()=>{};const b=x=>{if(!x.defaultPrevented)switch(x.key){case"Enter":{x.preventDefault();const w=l.findIndex(v=>v.id===m);if(w>=0){const v=l[w];Ke(v,`No panel data found for index ${w}`);const k=r[w],{collapsedSize:N=0,collapsible:S,minSize:C=0}=v.constraints;if(k!=null&&S){const T=vl({delta:ir(k,N)?C-N:N-k,initialLayout:r,panelConstraints:l.map(R=>R.constraints),pivotIndices:EA(n,p,i),prevLayout:r,trigger:"keyboard"});r!==T&&o(T)}}break}}};return h.addEventListener("keydown",b),()=>{h.removeEventListener("keydown",b)}});return()=>{d.forEach(h=>h())}},[i,t,e,n,r,s,o])}function F0(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function NA(t,e){const n=t==="horizontal",{x:r,y:s}=fh(e);return n?r:s}function uJ(t,e,n,r,s){const i=n==="horizontal",o=mh(e,s);Ke(o,`No resize handle element found for id "${e}"`);const a=o.getAttribute(Bt.groupId);Ke(a,"Resize handle element has no group id attribute");let{initialCursorPosition:l}=r;const c=NA(n,t),u=CA(a,s);Ke(u,`No group element found for id "${a}"`);const d=u.getBoundingClientRect(),h=i?d.width:d.height;return(c-l)/h*100}function dJ(t,e,n,r,s,i){if(pA(t)){const o=n==="horizontal";let a=0;t.shiftKey?a=100:s!=null?a=s:a=10;let l=0;switch(t.key){case"ArrowDown":l=o?0:a;break;case"ArrowLeft":l=o?-a:0;break;case"ArrowRight":l=o?a:0;break;case"ArrowUp":l=o?0:-a;break;case"End":l=100;break;case"Home":l=-100;break}return l}else return r==null?0:uJ(t,e,n,r,i)}function fJ({panelDataArray:t}){const e=Array(t.length),n=t.map(i=>i.constraints);let r=0,s=100;for(let i=0;i<t.length;i++){const o=n[i];Ke(o,`Panel constraints not found for index ${i}`);const{defaultSize:a}=o;a!=null&&(r++,e[i]=a,s-=a)}for(let i=0;i<t.length;i++){const o=n[i];Ke(o,`Panel constraints not found for index ${i}`);const{defaultSize:a}=o;if(a!=null)continue;const l=t.length-r,c=s/l;r++,e[i]=c,s-=c}return e}function Vo(t,e,n){e.forEach((r,s)=>{const i=t[s];Ke(i,`Panel data not found for index ${s}`);const{callbacks:o,constraints:a,id:l}=i,{collapsedSize:c=0,collapsible:u}=a,d=n[l];if(d==null||r!==d){n[l]=r;const{onCollapse:h,onExpand:p,onResize:m}=o;m&&m(r,d),u&&(h||p)&&(p&&(d==null||ks(d,c))&&!ks(r,c)&&p(),h&&(d==null||!ks(d,c))&&ks(r,c)&&h())}})}function Ou(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!=e[n])return!1;return!0}function hJ({defaultSize:t,dragState:e,layout:n,panelData:r,panelIndex:s,precision:i=3}){const o=n[s];let a;return o==null?a=t!=null?t.toFixed(i):"1":r.length===1?a="1":a=o.toFixed(i),{flexBasis:0,flexGrow:a,flexShrink:1,overflow:"hidden",pointerEvents:e!==null?"none":void 0}}function pJ(t,e=10){let n=null;return(...s)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{t(...s)},e)}}function B0(t){try{if(typeof localStorage<"u")t.getItem=e=>localStorage.getItem(e),t.setItem=(e,n)=>{localStorage.setItem(e,n)};else throw new Error("localStorage not supported in this environment")}catch(e){console.error(e),t.getItem=()=>null,t.setItem=()=>{}}}function _A(t){return`react-resizable-panels:${t}`}function TA(t){return t.map(e=>{const{constraints:n,id:r,idIsFromProps:s,order:i}=e;return s?r:i?`${i}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((e,n)=>e.localeCompare(n)).join(",")}function AA(t,e){try{const n=_A(t),r=e.getItem(n);if(r){const s=JSON.parse(r);if(typeof s=="object"&&s!=null)return s}}catch{}return null}function mJ(t,e,n){var r,s;const i=(r=AA(t,n))!==null&&r!==void 0?r:{},o=TA(e);return(s=i[o])!==null&&s!==void 0?s:null}function gJ(t,e,n,r,s){var i;const o=_A(t),a=TA(e),l=(i=AA(t,s))!==null&&i!==void 0?i:{};l[a]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{s.setItem(o,JSON.stringify(l))}catch(c){console.error(c)}}function $0({layout:t,panelConstraints:e}){const n=[...t],r=n.reduce((i,o)=>i+o,0);if(n.length!==e.length)throw Error(`Invalid ${e.length} panel layout: ${n.map(i=>`${i}%`).join(", ")}`);if(!ir(r,100)&&n.length>0)for(let i=0;i<e.length;i++){const o=n[i];Ke(o!=null,`No layout data found for index ${i}`);const a=100/r*o;n[i]=a}let s=0;for(let i=0;i<e.length;i++){const o=n[i];Ke(o!=null,`No layout data found for index ${i}`);const a=na({panelConstraints:e,panelIndex:i,size:o});o!=a&&(s+=o-a,n[i]=a)}if(!ir(s,0))for(let i=0;i<e.length;i++){const o=n[i];Ke(o!=null,`No layout data found for index ${i}`);const a=o+s,l=na({panelConstraints:e,panelIndex:i,size:a});if(o!==l&&(s-=l-o,n[i]=l,ir(s,0)))break}return n}const bJ=100,wl={getItem:t=>(B0(wl),wl.getItem(t)),setItem:(t,e)=>{B0(wl),wl.setItem(t,e)}},H0={};function MA({autoSaveId:t=null,children:e,className:n="",direction:r,forwardedRef:s,id:i=null,onLayout:o=null,keyboardResizeBy:a=null,storage:l=wl,style:c,tagName:u="div",...d}){const h=_y(i),p=y.useRef(null),[m,g]=y.useState(null),[b,x]=y.useState([]),w=sJ(),v=y.useRef({}),k=y.useRef(new Map),N=y.useRef(0),S=y.useRef({autoSaveId:t,direction:r,dragState:m,id:h,keyboardResizeBy:a,onLayout:o,storage:l}),C=y.useRef({layout:b,panelDataArray:[],panelDataArrayChanged:!1});y.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),y.useImperativeHandle(s,()=>({getId:()=>S.current.id,getLayout:()=>{const{layout:E}=C.current;return E},setLayout:E=>{const{onLayout:P}=S.current,{layout:z,panelDataArray:H}=C.current,B=$0({layout:E,panelConstraints:H.map(J=>J.constraints)});F0(z,B)||(x(B),C.current.layout=B,P&&P(B),Vo(H,B,v.current))}}),[]),ho(()=>{S.current.autoSaveId=t,S.current.direction=r,S.current.dragState=m,S.current.id=h,S.current.onLayout=o,S.current.storage=l}),cJ({committedValuesRef:S,eagerValuesRef:C,groupId:h,layout:b,panelDataArray:C.current.panelDataArray,setLayout:x,panelGroupElement:p.current}),y.useEffect(()=>{const{panelDataArray:E}=C.current;if(t){if(b.length===0||b.length!==E.length)return;let P=H0[t];P==null&&(P=pJ(gJ,bJ),H0[t]=P);const z=[...E],H=new Map(k.current);P(t,z,H,b,l)}},[t,b,l]),y.useEffect(()=>{});const T=y.useCallback(E=>{const{onLayout:P}=S.current,{layout:z,panelDataArray:H}=C.current;if(E.constraints.collapsible){const B=H.map(le=>le.constraints),{collapsedSize:J=0,panelSize:K,pivotIndices:Y}=Bi(H,E,z);if(Ke(K!=null,`Panel size not found for panel "${E.id}"`),!ks(K,J)){k.current.set(E.id,K);const ye=Xo(H,E)===H.length-1?K-J:J-K,Re=vl({delta:ye,initialLayout:z,panelConstraints:B,pivotIndices:Y,prevLayout:z,trigger:"imperative-api"});Ou(z,Re)||(x(Re),C.current.layout=Re,P&&P(Re),Vo(H,Re,v.current))}}},[]),R=y.useCallback((E,P)=>{const{onLayout:z}=S.current,{layout:H,panelDataArray:B}=C.current;if(E.constraints.collapsible){const J=B.map(Oe=>Oe.constraints),{collapsedSize:K=0,panelSize:Y=0,minSize:le=0,pivotIndices:ye}=Bi(B,E,H),Re=P??le;if(ks(Y,K)){const Oe=k.current.get(E.id),ht=Oe!=null&&Oe>=Re?Oe:Re,_t=Xo(B,E)===B.length-1?Y-ht:ht-Y,ot=vl({delta:_t,initialLayout:H,panelConstraints:J,pivotIndices:ye,prevLayout:H,trigger:"imperative-api"});Ou(H,ot)||(x(ot),C.current.layout=ot,z&&z(ot),Vo(B,ot,v.current))}}},[]),_=y.useCallback(E=>{const{layout:P,panelDataArray:z}=C.current,{panelSize:H}=Bi(z,E,P);return Ke(H!=null,`Panel size not found for panel "${E.id}"`),H},[]),I=y.useCallback((E,P)=>{const{panelDataArray:z}=C.current,H=Xo(z,E);return hJ({defaultSize:P,dragState:m,layout:b,panelData:z,panelIndex:H})},[m,b]),D=y.useCallback(E=>{const{layout:P,panelDataArray:z}=C.current,{collapsedSize:H=0,collapsible:B,panelSize:J}=Bi(z,E,P);return Ke(J!=null,`Panel size not found for panel "${E.id}"`),B===!0&&ks(J,H)},[]),V=y.useCallback(E=>{const{layout:P,panelDataArray:z}=C.current,{collapsedSize:H=0,collapsible:B,panelSize:J}=Bi(z,E,P);return Ke(J!=null,`Panel size not found for panel "${E.id}"`),!B||To(J,H)>0},[]),j=y.useCallback(E=>{const{panelDataArray:P}=C.current;P.push(E),P.sort((z,H)=>{const B=z.order,J=H.order;return B==null&&J==null?0:B==null?-1:J==null?1:B-J}),C.current.panelDataArrayChanged=!0,w()},[w]);ho(()=>{if(C.current.panelDataArrayChanged){C.current.panelDataArrayChanged=!1;const{autoSaveId:E,onLayout:P,storage:z}=S.current,{layout:H,panelDataArray:B}=C.current;let J=null;if(E){const Y=mJ(E,B,z);Y&&(k.current=new Map(Object.entries(Y.expandToSizes)),J=Y.layout)}J==null&&(J=fJ({panelDataArray:B}));const K=$0({layout:J,panelConstraints:B.map(Y=>Y.constraints)});F0(H,K)||(x(K),C.current.layout=K,P&&P(K),Vo(B,K,v.current))}}),ho(()=>{const E=C.current;return()=>{E.layout=[]}},[]);const L=y.useCallback(E=>{let P=!1;const z=p.current;return z&&window.getComputedStyle(z,null).getPropertyValue("direction")==="rtl"&&(P=!0),function(B){B.preventDefault();const J=p.current;if(!J)return()=>null;const{direction:K,dragState:Y,id:le,keyboardResizeBy:ye,onLayout:Re}=S.current,{layout:Oe,panelDataArray:ht}=C.current,{initialLayout:De}=Y??{},_t=EA(le,E,J);let ot=dJ(B,E,K,Y,ye,J);const dn=K==="horizontal";dn&&P&&(ot=-ot);const qt=ht.map(Vt=>Vt.constraints),me=vl({delta:ot,initialLayout:De??Oe,panelConstraints:qt,pivotIndices:_t,prevLayout:Oe,trigger:pA(B)?"keyboard":"mouse-or-touch"}),ze=!Ou(Oe,me);(mA(B)||gA(B))&&N.current!=ot&&(N.current=ot,!ze&&ot!==0?dn?Bp(E,ot<0?yA:xA):Bp(E,ot<0?vA:wA):Bp(E,0)),ze&&(x(me),C.current.layout=me,Re&&Re(me),Vo(ht,me,v.current))}},[]),q=y.useCallback((E,P)=>{const{onLayout:z}=S.current,{layout:H,panelDataArray:B}=C.current,J=B.map(Oe=>Oe.constraints),{panelSize:K,pivotIndices:Y}=Bi(B,E,H);Ke(K!=null,`Panel size not found for panel "${E.id}"`);const ye=Xo(B,E)===B.length-1?K-P:P-K,Re=vl({delta:ye,initialLayout:H,panelConstraints:J,pivotIndices:Y,prevLayout:H,trigger:"imperative-api"});Ou(H,Re)||(x(Re),C.current.layout=Re,z&&z(Re),Vo(B,Re,v.current))},[]),re=y.useCallback((E,P)=>{const{layout:z,panelDataArray:H}=C.current,{collapsedSize:B=0,collapsible:J}=P,{collapsedSize:K=0,collapsible:Y,maxSize:le=100,minSize:ye=0}=E.constraints,{panelSize:Re}=Bi(H,E,z);Re!=null&&(J&&Y&&ks(Re,B)?ks(B,K)||q(E,K):Re<ye?q(E,ye):Re>le&&q(E,le))},[q]),X=y.useCallback((E,P)=>{const{direction:z}=S.current,{layout:H}=C.current;if(!p.current)return;const B=mh(E,p.current);Ke(B,`Drag handle element not found for id "${E}"`);const J=NA(z,P);g({dragHandleId:E,dragHandleRect:B.getBoundingClientRect(),initialCursorPosition:J,initialLayout:H})},[]),ce=y.useCallback(()=>{g(null)},[]),A=y.useCallback(E=>{const{panelDataArray:P}=C.current,z=Xo(P,E);z>=0&&(P.splice(z,1),delete v.current[E.id],C.current.panelDataArrayChanged=!0,w())},[w]),ue=y.useMemo(()=>({collapsePanel:T,direction:r,dragState:m,expandPanel:R,getPanelSize:_,getPanelStyle:I,groupId:h,isPanelCollapsed:D,isPanelExpanded:V,reevaluatePanelConstraints:re,registerPanel:j,registerResizeHandle:L,resizePanel:q,startDragging:X,stopDragging:ce,unregisterPanel:A,panelGroupElement:p.current}),[T,m,r,R,_,I,h,D,V,re,j,L,q,X,ce,A]),be={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return y.createElement(dh.Provider,{value:ue},y.createElement(u,{...d,children:e,className:n,id:i,ref:p,style:{...be,...c},[Bt.group]:"",[Bt.groupDirection]:r,[Bt.groupId]:h}))}const Ay=y.forwardRef((t,e)=>y.createElement(MA,{...t,forwardedRef:e}));MA.displayName="PanelGroup";Ay.displayName="forwardRef(PanelGroup)";function Xo(t,e){return t.findIndex(n=>n===e||n.id===e.id)}function Bi(t,e,n){const r=Xo(t,e),i=r===t.length-1?[r-1,r]:[r,r+1],o=n[r];return{...e.constraints,panelSize:o,pivotIndices:i}}function yJ({disabled:t,handleId:e,resizeHandler:n,panelGroupElement:r}){y.useEffect(()=>{if(t||n==null||r==null)return;const s=mh(e,r);if(s==null)return;const i=o=>{if(!o.defaultPrevented)switch(o.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{o.preventDefault(),n(o);break}case"F6":{o.preventDefault();const a=s.getAttribute(Bt.groupId);Ke(a,`No group element found for id "${a}"`);const l=uc(a,r),c=SA(a,e,r);Ke(c!==null,`No resize element found for id "${e}"`);const u=o.shiftKey?c>0?c-1:l.length-1:c+1<l.length?c+1:0;l[u].focus();break}}};return s.addEventListener("keydown",i),()=>{s.removeEventListener("keydown",i)}},[r,t,e,n])}function My({children:t=null,className:e="",disabled:n=!1,hitAreaMargins:r,id:s,onBlur:i,onClick:o,onDragging:a,onFocus:l,onPointerDown:c,onPointerUp:u,style:d={},tabIndex:h=0,tagName:p="div",...m}){var g,b;const x=y.useRef(null),w=y.useRef({onClick:o,onDragging:a,onPointerDown:c,onPointerUp:u});y.useEffect(()=>{w.current.onClick=o,w.current.onDragging=a,w.current.onPointerDown=c,w.current.onPointerUp=u});const v=y.useContext(dh);if(v===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:k,groupId:N,registerResizeHandle:S,startDragging:C,stopDragging:T,panelGroupElement:R}=v,_=_y(s),[I,D]=y.useState("inactive"),[V,j]=y.useState(!1),[L,q]=y.useState(null),re=y.useRef({state:I});ho(()=>{re.current.state=I}),y.useEffect(()=>{if(n)q(null);else{const ue=S(_);q(()=>ue)}},[n,_,S]);const X=(g=r==null?void 0:r.coarse)!==null&&g!==void 0?g:15,ce=(b=r==null?void 0:r.fine)!==null&&b!==void 0?b:5;y.useEffect(()=>{if(n||L==null)return;const ue=x.current;Ke(ue,"Element ref not attached");let be=!1;return nJ(_,ue,k,{coarse:X,fine:ce},(P,z,H)=>{if(!z){D("inactive");return}switch(P){case"down":{D("drag"),be=!1,Ke(H,'Expected event to be defined for "down" action'),C(_,H);const{onDragging:B,onPointerDown:J}=w.current;B==null||B(!0),J==null||J();break}case"move":{const{state:B}=re.current;be=!0,B!=="drag"&&D("hover"),Ke(H,'Expected event to be defined for "move" action'),L(H);break}case"up":{D("hover"),T();const{onClick:B,onDragging:J,onPointerUp:K}=w.current;J==null||J(!1),K==null||K(),be||B==null||B();break}}})},[X,k,n,ce,S,_,L,C,T]),yJ({disabled:n,handleId:_,resizeHandler:L,panelGroupElement:R});const A={touchAction:"none",userSelect:"none"};return y.createElement(p,{...m,children:t,className:e,id:s,onBlur:()=>{j(!1),i==null||i()},onFocus:()=>{j(!0),l==null||l()},ref:x,role:"separator",style:{...A,...d},tabIndex:h,[Bt.groupDirection]:k,[Bt.groupId]:N,[Bt.resizeHandle]:"",[Bt.resizeHandleActive]:I==="drag"?"pointer":V?"keyboard":void 0,[Bt.resizeHandleEnabled]:!n,[Bt.resizeHandleId]:_,[Bt.resizeHandleState]:I})}My.displayName="PanelResizeHandle";const U0="sudocode:issues:sortOption";function xJ(){var J;const t=_r(),{issues:e,isLoading:n,isError:r,error:s,createIssueAsync:i,updateIssue:o,deleteIssue:a,archiveIssue:l,unarchiveIssue:c,isCreating:u,isUpdating:d,isDeleting:h}=Tc(),p=xD(),{data:m}=LS(),[g,b]=y.useState(),{feedback:x}=Qg((g==null?void 0:g.id)||""),[w,v]=y.useState(!1),[k,N]=y.useState(),[S,C]=y.useState(!1),[T,R]=y.useState(""),[_,I]=y.useState(()=>{try{const K=localStorage.getItem(U0);if(K&&["priority","newest","last-updated"].includes(K))return K}catch(K){console.error("Failed to load sort preference from localStorage:",K)}return"priority"}),[D,V]=y.useState(()=>{try{const K=localStorage.getItem("issuesPage.collapsedColumns");if(K){const Y=JSON.parse(K);return new Set(Y)}}catch{}return new Set}),j=y.useCallback(K=>{const Y=K;I(Y);try{localStorage.setItem(U0,Y)}catch(le){console.error("Failed to save sort preference to localStorage:",le)}},[]),L=y.useMemo(()=>{const K=T?e.filter(le=>{const ye=T.toLowerCase();return le.title.toLowerCase().includes(ye)||le.content&&le.content.toLowerCase().includes(ye)}):e,Y={open:[],in_progress:[],blocked:[],needs_review:[],closed:[]};return K.forEach(le=>{const ye=le.status.toLowerCase();Y[ye]?Y[ye].push(le):Y.open.push(le)}),Object.keys(Y).forEach(le=>{Y[le].sort((Re,Oe)=>{switch(_){case"priority":return Re.priority!==Oe.priority?Re.priority-Oe.priority:new Date(Oe.created_at).getTime()-new Date(Re.created_at).getTime();case"newest":return new Date(Oe.created_at).getTime()-new Date(Re.created_at).getTime();case"last-updated":return new Date(Oe.updated_at).getTime()-new Date(Re.updated_at).getTime();default:return 0}})}),Y},[e,T,_]),q=y.useCallback(K=>{const{active:Y,over:le}=K;if(!le||!Y.data.current)return;const ye=Y.id,Re=le.id,Oe=e.find(ht=>ht.id===ye);!Oe||Oe.status===Re||p.mutate({id:ye,status:Re})},[e,p]),re=y.useCallback(K=>{b(K)},[]),X=y.useCallback(()=>{b(void 0)},[]),ce=y.useCallback(K=>{N(K),v(!0)},[]),A=y.useCallback(async K=>{try{await i(K),v(!1),N(void 0)}catch(Y){console.error("Failed to create issue:",Y)}},[i]),ue=y.useCallback(K=>{g&&o({id:g.id,data:K})},[g,o]),be=y.useCallback(()=>{g&&(a(g.id),b(void 0))},[g,a]),E=y.useCallback(K=>{l(K)},[l]),P=y.useCallback(K=>{c(K)},[c]),z=y.useCallback(()=>{C(!0)},[]),H=y.useCallback(()=>{(L.closed||[]).forEach(Y=>{l(Y.id)}),C(!1)},[L.closed,l]),B=y.useCallback(K=>{V(Y=>{const le=new Set(Y);le.has(K)?le.delete(K):le.add(K);try{localStorage.setItem("issuesPage.collapsedColumns",JSON.stringify(Array.from(le)))}catch{}return le})},[]);return n?f.jsx("div",{className:"flex items-center justify-center p-8",children:f.jsx("p",{className:"text-muted-foreground",children:"Loading issues..."})}):r?f.jsx("div",{className:"flex items-center justify-center p-8",children:f.jsxs("p",{className:"text-destructive",children:["Error loading issues: ",(s==null?void 0:s.message)||"Unknown error"]})}):f.jsxs("div",{className:"flex h-screen flex-col",children:[f.jsxs("div",{className:"flex items-center justify-between border-b bg-background p-4",children:[f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("h1",{className:"text-2xl font-bold",children:"Issues"}),f.jsx(et,{variant:"secondary",children:e.length})]}),m&&f.jsxs("div",{className:"flex items-center gap-2 pl-3 text-sm text-muted-foreground",children:[f.jsx("span",{className:"font-medium",children:m.name}),f.jsx(Ua,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:m.branch})]})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsxs("div",{className:"relative",children:[f.jsx(wf,{className:"absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),f.jsx(ns,{type:"text",placeholder:"Filter issues...",value:T,onChange:K=>R(K.target.value),className:"h-9 w-64 pl-8"})]}),f.jsxs(Jn,{value:_,onValueChange:j,children:[f.jsx(zn,{className:"h-9 w-[100px]",children:f.jsx(Yn,{})}),f.jsxs(Fn,{children:[f.jsx(Mt,{value:"priority",children:"Priority"}),f.jsx(Mt,{value:"newest",children:"Newest"}),f.jsx(Mt,{value:"last-updated",children:"Updated"})]})]}),f.jsxs(ie,{onClick:()=>t("/issues/archived"),variant:"ghost",size:"sm",className:"gap-1 text-muted-foreground hover:text-foreground",children:[f.jsx(Ha,{className:"h-4 w-4"}),"Archived"]}),f.jsxs(ie,{onClick:()=>ce(),variant:"default",size:"sm",className:"text-primary-foreground hover:bg-primary/90",children:[f.jsx(bo,{className:"mr-2 h-4 w-4"}),"Create Issue"]})]})]}),f.jsx("div",{className:"flex flex-1 overflow-hidden",children:g?f.jsxs(Ay,{direction:"horizontal",className:"h-full min-h-0",onLayout:K=>{if(K.length===2)try{localStorage.setItem("issuesPage.panelSizes",JSON.stringify(K))}catch{}},children:[f.jsx(lc,{id:"kanban",order:1,defaultSize:(()=>{try{const K=localStorage.getItem("issuesPage.panelSizes");if(K){const Y=JSON.parse(K);if(Array.isArray(Y)&&Y.length===2)return Y[0]}}catch{}return 66})(),minSize:30,className:"min-h-0 min-w-0 overflow-auto",children:f.jsx(id,{groupedIssues:L,onDragEnd:q,onViewIssueDetails:re,selectedIssue:g,onArchiveAllClosed:z,collapsedColumns:D,onToggleColumnCollapse:B})}),f.jsxs(My,{className:"group relative z-30 w-1 cursor-col-resize touch-none bg-border focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-offset-1 focus-visible:ring-offset-background",children:[f.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-border"}),f.jsxs("div",{className:"pointer-events-none absolute left-1/2 top-1/2 flex -translate-x-1/2 -translate-y-1/2 flex-col items-center gap-1 rounded-full border border-border bg-muted/90 px-1.5 py-3 opacity-70 shadow-sm transition-opacity group-hover:opacity-100 group-focus:opacity-100",children:[f.jsx("span",{className:"h-1 w-1 rounded-full bg-muted-foreground"}),f.jsx("span",{className:"h-1 w-1 rounded-full bg-muted-foreground"}),f.jsx("span",{className:"h-1 w-1 rounded-full bg-muted-foreground"})]})]}),f.jsx(lc,{id:"details",order:2,defaultSize:(()=>{try{const K=localStorage.getItem("issuesPage.panelSizes");if(K){const Y=JSON.parse(K);if(Array.isArray(Y)&&Y.length===2)return Y[1]}}catch{}return 34})(),minSize:20,className:"min-h-0 min-w-0 overflow-hidden border-l bg-background shadow-lg",children:f.jsx(Cy,{issue:g,onClose:X,onUpdate:ue,onDelete:be,onArchive:E,onUnarchive:P,isUpdating:d,isDeleting:h,showOpenDetail:!0,feedback:x})})]}):f.jsx("div",{className:"flex-1 overflow-auto",children:f.jsx(id,{groupedIssues:L,onDragEnd:q,onViewIssueDetails:re,selectedIssue:g,onArchiveAllClosed:z,collapsedColumns:D,onToggleColumnCollapse:B})})}),f.jsx(V7,{isOpen:w,onClose:()=>{v(!1),N(void 0)},onCreate:A,isCreating:u,defaultStatus:k}),f.jsx(zf,{open:S,onOpenChange:C,children:f.jsxs(Ic,{children:[f.jsxs(Dc,{children:[f.jsx(Pc,{children:"Archive All Closed Issues?"}),f.jsxs(jc,{children:["This will archive all ",((J=L.closed)==null?void 0:J.length)||0," closed issues. You can view archived issues later from the Archived Issues page."]})]}),f.jsxs(Lc,{children:[f.jsx(Fc,{children:"Cancel"}),f.jsx(zc,{onClick:H,children:"Archive All"})]})]})})]})}const V0="sudocode:details:viewMode";function vJ(){const{id:t}=Lg(),e=_r(),{data:n,isLoading:r,isError:s}=yD(t||""),{feedback:i}=Qg(t||""),{updateIssue:o,deleteIssue:a,archiveIssue:l,unarchiveIssue:c,isUpdating:u,isDeleting:d}=Tc(),[h,p]=y.useState(!1),[m,g]=y.useState(()=>{const k=localStorage.getItem(V0);return k!==null?JSON.parse(k):"formatted"}),b=k=>{t&&o({id:t,data:k})},x=()=>{t&&(a(t),e("/issues"))},w=k=>{l(k),e("/issues")},v=k=>{c(k),e("/issues")};return y.useEffect(()=>{localStorage.setItem(V0,JSON.stringify(m))},[m]),r?f.jsx("div",{className:"flex items-center justify-center p-12",children:f.jsxs("div",{className:"text-center",children:[f.jsx("div",{className:"mx-auto mb-4 h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"}),f.jsx("p",{className:"text-muted-foreground",children:"Loading issue..."})]})}):s||!n?f.jsx("div",{className:"flex items-center justify-center p-12",children:f.jsxs("div",{className:"text-center",children:[f.jsx("h2",{className:"mb-2 text-2xl font-bold",children:"Issue not found"}),f.jsx("p",{className:"mb-4 text-muted-foreground",children:"The issue you're looking for doesn't exist or has been deleted."}),f.jsx(ie,{onClick:()=>e("/issues"),children:"Back to Issues"})]})}):f.jsxs("div",{className:"flex h-screen flex-col",children:[f.jsxs("div",{className:"flex items-center justify-between border-b bg-background p-2 sm:p-4",children:[f.jsx("div",{className:"flex items-center gap-2 sm:gap-4",children:f.jsxs(ie,{variant:"ghost",size:"sm",onClick:()=>e("/issues"),children:["← ",f.jsx("span",{className:"ml-1 hidden sm:inline",children:"Back to Issues"})]})}),f.jsxs("div",{className:"flex items-center gap-1 sm:gap-2",children:[f.jsxs("div",{className:"inline-flex rounded-md border border-border bg-muted/30 p-1",children:[f.jsxs(ie,{variant:m==="formatted"?"outline":"ghost",size:"sm",onClick:()=>g("formatted"),className:`h-7 rounded-sm ${m==="formatted"?"shadow-sm":"text-muted-foreground hover:bg-muted"}`,children:[f.jsx(Os,{className:"h-4 w-4 sm:mr-2"}),f.jsx("span",{className:"hidden sm:inline",children:"Formatted"})]}),f.jsxs(ie,{variant:m==="markdown"?"outline":"ghost",size:"sm",onClick:()=>g("markdown"),className:`h-7 rounded-sm ${m==="markdown"?"shadow-sm":"text-muted-foreground hover:bg-muted"}`,children:[f.jsx(vc,{className:"h-4 w-4 sm:mr-2"}),f.jsx("span",{className:"hidden sm:inline",children:"Markdown"})]})]}),n.archived?f.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>v(n.id),disabled:u,children:[f.jsx(Bg,{className:"h-4 w-4 sm:mr-2"}),f.jsx("span",{className:"hidden sm:inline",children:"Unarchive"})]}):f.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>w(n.id),disabled:u,children:[f.jsx(Ha,{className:"h-4 w-4 sm:mr-2"}),f.jsx("span",{className:"hidden sm:inline",children:"Archive"})]}),f.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>p(!0),disabled:u||d,children:[f.jsx(Do,{className:"h-4 w-4 sm:mr-2"}),f.jsx("span",{className:"hidden sm:inline",children:"Delete"})]})]})]}),f.jsx("div",{className:"flex flex-1 overflow-hidden",children:f.jsx(Cy,{issue:n,onUpdate:b,isUpdating:u,isDeleting:d,hideTopControls:!0,viewMode:m,onViewModeChange:g,showViewToggleInline:!1,feedback:i})}),f.jsx(aC,{issue:n,isOpen:h,onClose:()=>p(!1),onConfirm:x,isDeleting:d})]})}const wJ={0:"bg-red-600 dark:bg-red-700",1:"bg-orange-600 dark:bg-orange-700",2:"bg-yellow-600 dark:bg-yellow-700",3:"bg-blue-600 dark:bg-blue-700",4:"bg-gray-600 dark:bg-gray-700"},kJ={0:"P0",1:"P1",2:"P2",3:"P3",4:"P4"};function SJ({spec:t,onClick:e}){const n=y.useCallback(()=>{e==null||e(t)},[t,e]),r=t.content?t.content.slice(0,200)+(t.content.length>200?"...":""):"";return f.jsx(Ht,{className:`cursor-pointer border border-border p-4 transition-shadow hover:shadow-md ${t.archived?"opacity-60":""}`,onClick:n,children:f.jsxs("div",{className:"flex flex-col gap-3",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx("div",{className:"flex items-center gap-2",children:f.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:t.id})}),t.priority!==void 0&&t.priority<=3&&f.jsx("span",{className:`shrink-0 rounded-full px-2 py-0.5 text-xs text-white ${wJ[t.priority]}`,children:kJ[t.priority]})]}),f.jsx("h3",{className:"line-clamp-2 text-lg font-semibold",children:t.title}),r&&f.jsx("p",{className:"line-clamp-3 text-sm text-muted-foreground",children:r}),f.jsx("div",{className:"flex flex-col gap-2",children:t.file_path&&f.jsx("p",{className:"truncate font-mono text-xs text-muted-foreground",children:t.file_path})})]})})}function RA({specs:t,loading:e=!1,emptyMessage:n="No specs found"}){const r=_r(),s=i=>{r(`/specs/${i.id}`)};return e?f.jsx("div",{className:"flex items-center justify-center p-12",children:f.jsxs("div",{className:"text-center",children:[f.jsx("div",{className:"mx-auto mb-4 h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"}),f.jsx("p",{className:"text-muted-foreground",children:"Loading specs..."})]})}):!t||t.length===0?f.jsx("div",{className:"flex items-center justify-center p-12",children:f.jsxs("div",{className:"text-center",children:[f.jsx("p",{className:"text-lg text-muted-foreground",children:n}),f.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Create a new spec to get started"})]})}):f.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:t.map(i=>f.jsx(SJ,{spec:i,onClick:s},i.id))})}const W0="sudocode:specEditor:viewMode";function EJ({spec:t,onSave:e,onCancel:n}){const{createSpecAsync:r,updateSpecAsync:s,isCreating:i}=$c(),[o,a]=y.useState((t==null?void 0:t.title)||""),[l,c]=y.useState((t==null?void 0:t.content)||""),[u,d]=y.useState((t==null?void 0:t.priority)??3),[h,p]=y.useState(null),[m,g]=y.useState(()=>{const w=localStorage.getItem(W0);return w!==null?JSON.parse(w):"formatted"}),b=y.useRef(null);y.useEffect(()=>{localStorage.setItem(W0,JSON.stringify(m))},[m]),y.useEffect(()=>{if(m==="markdown"&&b.current){const w=b.current;w.style.height="auto",w.style.height=`${w.scrollHeight}px`}},[l,m]);const x=async w=>{if(w.preventDefault(),p(null),!o.trim()){p("Title is required");return}try{const v={title:o.trim(),content:l.trim()||void 0,priority:u};if(t){const k=await s({id:t.id,data:v});e==null||e(k)}else{const k=await r(v);e==null||e(k)}}catch(v){p(v instanceof Error?v.message:"Failed to save spec")}};return f.jsx(Ht,{className:"p-6",children:f.jsx("form",{onSubmit:x,children:f.jsxs("div",{className:"space-y-4",children:[f.jsx("div",{children:f.jsx("h2",{className:"mb-4 text-2xl font-bold",children:t?"Edit Spec":"New Spec"})}),h&&f.jsx("div",{className:"rounded-md bg-destructive/10 p-3 text-sm text-destructive",children:h}),f.jsxs("div",{children:[f.jsx("label",{htmlFor:"title",className:"mb-2 block text-sm font-medium",children:"Title *"}),f.jsx("input",{id:"title",type:"text",value:o,onChange:w=>a(w.target.value),className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm",placeholder:"Enter spec title"})]}),f.jsxs("div",{children:[f.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[f.jsx("label",{htmlFor:"content",className:"text-sm font-medium",children:"Content"}),f.jsxs("div",{className:"flex gap-1 rounded-md border border-border bg-muted/30 p-1",children:[f.jsxs(ie,{variant:m==="formatted"?"outline":"ghost",size:"sm",onClick:()=>g("formatted"),className:`h-7 rounded-sm ${m==="formatted"?"shadow-sm":"text-muted-foreground hover:bg-muted"}`,type:"button",children:[f.jsx(Os,{className:"mr-2 h-4 w-4"}),"Formatted"]}),f.jsxs(ie,{variant:m==="markdown"?"outline":"ghost",size:"sm",onClick:()=>g("markdown"),className:`h-7 rounded-sm ${m==="markdown"?"shadow-sm":"text-muted-foreground hover:bg-muted"}`,type:"button",children:[f.jsx(vc,{className:"mr-2 h-4 w-4"}),"Markdown"]})]})]}),f.jsx(Ht,{className:"overflow-hidden rounded-md border",children:m==="formatted"?f.jsx(uh,{content:l,editable:!0,onChange:w=>c(w),onSave:w=>c(w),onCancel:()=>{t&&c(t.content||"")},className:"min-h-[300px]",placeholder:"Spec content (markdown supported)..."}):f.jsx("div",{className:"p-4",children:f.jsx("textarea",{ref:b,id:"content",value:l,onChange:w=>c(w.target.value),className:"w-full resize-none border-none bg-transparent font-mono text-sm leading-6 outline-none focus:ring-0",placeholder:"Spec content (markdown supported)...",spellCheck:!1,style:{minHeight:"300px"},disabled:i})})})]}),f.jsxs("div",{children:[f.jsx("label",{htmlFor:"priority",className:"mb-2 block text-sm font-medium",children:"Priority"}),f.jsxs("select",{id:"priority",value:u,onChange:w=>d(Number(w.target.value)),className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm",children:[f.jsx("option",{value:0,children:"Critical (0)"}),f.jsx("option",{value:1,children:"High (1)"}),f.jsx("option",{value:2,children:"Medium (2)"}),f.jsx("option",{value:3,children:"Low (3)"}),f.jsx("option",{value:4,children:"None (4)"})]})]}),f.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[n&&f.jsx(ie,{type:"button",variant:"outline",onClick:n,disabled:i,children:"Cancel"}),f.jsx(ie,{type:"submit",disabled:i,children:i?"Saving...":t?"Update":"Create"})]})]})})})}const q0="sudocode:specs:sortOption";function CJ(){const{specs:t,isLoading:e}=$c(),{data:n}=LS(),[r,s]=y.useState(!1),[i,o]=y.useState(""),[a,l]=y.useState(()=>{try{const p=localStorage.getItem(q0);if(p&&["priority","newest","last-updated"].includes(p))return p}catch(p){console.error("Failed to load sort preference from localStorage:",p)}return"priority"}),c=_r(),u=p=>{s(!1),c(`/specs/${p.id}`)},d=p=>{const m=p;l(m);try{localStorage.setItem(q0,m)}catch(g){console.error("Failed to save sort preference to localStorage:",g)}},h=y.useMemo(()=>[...i?t.filter(g=>{const b=i.toLowerCase();return g.title.toLowerCase().includes(b)||g.content&&g.content.toLowerCase().includes(b)}):t].sort((g,b)=>{switch(a){case"priority":return g.priority!==b.priority?g.priority-b.priority:new Date(b.created_at).getTime()-new Date(g.created_at).getTime();case"newest":return new Date(b.created_at).getTime()-new Date(g.created_at).getTime();case"last-updated":return new Date(b.updated_at).getTime()-new Date(g.updated_at).getTime();default:return 0}}),[t,i,a]);return r?f.jsx("div",{className:"flex-1 p-8",children:f.jsx(EJ,{onSave:u,onCancel:()=>s(!1)})}):f.jsxs("div",{className:"flex h-screen flex-col",children:[f.jsxs("div",{className:"flex items-center justify-between border-b bg-background p-4",children:[f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("h1",{className:"text-2xl font-bold",children:"Specs"}),f.jsx(et,{variant:"secondary",children:t.length})]}),n&&f.jsxs("div",{className:"flex items-center gap-2 pl-3 text-sm text-muted-foreground",children:[f.jsx("span",{className:"font-medium",children:n.name}),f.jsx(Ua,{className:"h-3.5 w-3.5"}),f.jsx("span",{children:n.branch})]})]}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsxs("div",{className:"relative",children:[f.jsx(wf,{className:"absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),f.jsx(ns,{type:"text",placeholder:"Filter specs...",value:i,onChange:p=>o(p.target.value),className:"h-9 w-64 pl-8"})]}),f.jsxs(ie,{onClick:()=>c("/specs/archived"),variant:"ghost",size:"sm",className:"gap-1 text-muted-foreground hover:text-foreground",children:[f.jsx(Ha,{className:"h-4 w-4"}),"Archived"]}),f.jsxs(ie,{onClick:()=>s(!0),variant:"default",size:"sm",className:"text-primary-foreground hover:bg-primary/90",children:[f.jsx(bo,{className:"mr-2 h-4 w-4"}),"Create Spec"]})]})]}),f.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden px-8 py-4",children:[f.jsx("div",{className:"mb-4 flex justify-end",children:f.jsxs(Jn,{value:a,onValueChange:d,children:[f.jsx(zn,{className:"h-9 w-[180px]",children:f.jsx(Yn,{})}),f.jsxs(Fn,{children:[f.jsx(Mt,{value:"priority",children:"Priority"}),f.jsx(Mt,{value:"newest",children:"Newest"}),f.jsx(Mt,{value:"last-updated",children:"Last Updated"})]})]})}),f.jsx("div",{className:"flex-1 overflow-auto",children:f.jsx(RA,{specs:h,loading:e})})]})]})}function NJ(t){const e=ts(),n=Sr({mutationFn:i=>Nh.create(i),onSuccess:()=>{e.invalidateQueries({queryKey:["feedback",t]})}}),r=Sr({mutationFn:({id:i,data:o})=>Nh.update(i,o),onMutate:async({id:i,data:o})=>{await e.cancelQueries({queryKey:["feedback",t]});const a=e.getQueryData(["feedback",t]);return e.setQueryData(["feedback",t],l=>l==null?void 0:l.map(c=>{if(c.id!==i)return c;const u={};return o.content!==void 0&&(u.content=o.content),o.feedback_type!==void 0&&(u.feedback_type=o.feedback_type),o.dismissed!==void 0&&(u.dismissed=o.dismissed),o.anchor!==void 0&&(u.anchor=typeof o.anchor=="string"?o.anchor:JSON.stringify(o.anchor)),{...c,...u}})),{previousFeedback:a}},onError:(i,o,a)=>{a!=null&&a.previousFeedback&&e.setQueryData(["feedback",t],a.previousFeedback)},onSettled:()=>{e.invalidateQueries({queryKey:["feedback",t]})}}),s=Sr({mutationFn:i=>Nh.delete(i),onMutate:async i=>{await e.cancelQueries({queryKey:["feedback",t]});const o=e.getQueryData(["feedback",t]);return e.setQueryData(["feedback",t],a=>a==null?void 0:a.filter(l=>l.id!==i)),{previousFeedback:o}},onError:(i,o,a)=>{a!=null&&a.previousFeedback&&e.setQueryData(["feedback",t],a.previousFeedback)},onSettled:()=>{e.invalidateQueries({queryKey:["feedback",t]})}});return{createFeedback:n.mutate,createFeedbackAsync:n.mutateAsync,updateFeedback:r.mutate,updateFeedbackAsync:r.mutateAsync,deleteFeedback:s.mutate,deleteFeedbackAsync:s.mutateAsync,isCreating:n.isPending,isUpdating:r.isPending,isDeleting:s.isPending}}function _J({type:t,count:e=1,onClick:n,className:r=""}){const s=()=>{switch(t){case"comment":return f.jsx(wc,{className:"h-3 w-3"});case"suggestion":return f.jsx(Uk,{className:"h-3 w-3"});case"request":return f.jsx(go,{className:"h-3 w-3"})}},i=()=>{switch(t){case"comment":return"bg-blue-600 hover:bg-blue-700 dark:bg-blue-700 dark:hover:bg-blue-800";case"suggestion":return"bg-yellow-600 hover:bg-yellow-700 dark:bg-yellow-700 dark:hover:bg-yellow-800";case"request":return"bg-orange-600 hover:bg-orange-700 dark:bg-orange-700 dark:hover:bg-orange-800"}};return f.jsxs("button",{onClick:n,className:`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium text-white transition-colors ${i()} ${r}`,title:`${e} ${t}${e>1?"s":""}`,children:[s(),e>1&&f.jsx("span",{children:e})]})}function TJ({content:t,showLineNumbers:e=!0,highlightLines:n=[],feedback:r=[],selectedLine:s,onLineClick:i,onTextSelect:o,onFeedbackClick:a,editable:l=!1,onChange:c,className:u=""}){const d=y.useRef(null),h=y.useMemo(()=>t.split(`
573
- `),[t]),p=y.useMemo(()=>{const x=new Map;return r.forEach(w=>{try{const v=w.anchor?JSON.parse(w.anchor):null;if(v!=null&&v.line_number){const k=x.get(v.line_number)||[];x.set(v.line_number,[...k,w])}else if(v!=null&&v.text_snippet){const k=v.text_snippet.replace(/\.\.\./g,"").trim();if(k){const N=t.split(`
574
- `);for(let S=0;S<N.length;S++)if(N[S].includes(k)){const C=S+1,T=x.get(C)||[];x.set(C,[...T,w]);break}}}}catch(v){console.error("Failed to parse feedback anchor:",v)}}),x},[r,t]),m=x=>{i==null||i(x)},g=x=>{if(!o)return;const w=window.getSelection(),v=w==null?void 0:w.toString().trim();v&&v.length>0&&o(v,x)},b=x=>{c==null||c(x.target.value)};return y.useEffect(()=>{if(l&&d.current){const x=d.current;x.style.height="auto",x.style.height=`${x.scrollHeight}px`}},[t,l]),f.jsx(Ht,{className:`overflow-hidden ${u}`,children:f.jsx("div",{className:"relative",children:l?f.jsx("div",{className:"pl-2 pr-4 py-4",children:f.jsx("textarea",{ref:d,value:t,onChange:b,className:"w-full resize-none border-none bg-transparent font-mono text-sm leading-6 outline-none focus:ring-0",spellCheck:!1})}):f.jsx("div",{className:`grid overflow-x-auto ${e?"grid-cols-[auto_1fr]":"grid-cols-1"}`,children:h.flatMap((x,w)=>{const v=w+1,k=p.get(v)||[],N=[];return e&&N.push(f.jsx("div",{className:`select-none border-r border-border bg-muted/30 pl-1 pr-2 py-1 text-right font-mono text-[10px] leading-6 text-muted-foreground transition-colors hover:bg-primary/10 ${n.includes(v)?"font-bold text-primary":""} ${s===v?"bg-primary/20":""}`,"data-line-number":v,onClick:()=>m(v),children:v},`line-${w}`)),N.push(f.jsx("div",{className:`group relative pl-2 pr-4 py-1 font-mono text-sm leading-6 ${n.includes(v)?"bg-primary/10":""} ${s===v?"bg-primary/20":""}`,"data-line":v,children:f.jsxs("div",{className:"flex items-start gap-2",children:[f.jsx("pre",{className:"m-0 inline flex-1 cursor-pointer whitespace-pre-wrap break-words font-mono transition-colors hover:bg-muted/30",onClick:()=>m(v),onMouseUp:()=>g(v),children:x||" "}),k.length>0&&f.jsx("div",{className:"flex flex-wrap gap-1",children:Array.from(new Set(k.map(S=>S.feedback_type))).map(S=>{const C=k.filter(T=>T.feedback_type===S);return f.jsx(_J,{type:S,count:C.length,onClick:()=>a==null?void 0:a(C[0])},S)})})]})},`content-${w}`)),N})})})})}function AJ({content:t,feedback:e=[],selectedLine:n,onLineClick:r,onTextSelect:s,onFeedbackClick:i,onChange:o,viewMode:a="formatted",onViewModeChange:l,className:c=""}){return f.jsx(Ht,{className:`overflow-hidden ${c}`,children:a==="formatted"?f.jsx(uh,{content:t,editable:!0,onChange:o,onCancel:()=>{},showLineNumbers:!0,selectedLine:n,onLineClick:r,placeholder:"Spec content..."}):f.jsx(TJ,{content:t,feedback:e,selectedLine:n,onLineClick:r,onTextSelect:s,onFeedbackClick:i,showLineNumbers:!1,editable:!0,onChange:o})})}function MJ({feedback:t,onDismiss:e,onDelete:n,onClick:r,className:s="",maxHeight:i=500,isCompact:o=!1}){const[a,l]=y.useState(!1),[c,u]=y.useState(!o),d=_r();let h=null;try{t.anchor&&(h=JSON.parse(t.anchor))}catch(b){console.error("Failed to parse feedback anchor:",b)}const p=b=>{switch(b){case"comment":return f.jsx(wc,{className:"h-4 w-4"});case"suggestion":return f.jsx(Uk,{className:"h-4 w-4"});case"request":return f.jsx(go,{className:"h-4 w-4"})}},m=b=>{switch(b){case"comment":return"text-blue-600 bg-blue-50";case"suggestion":return"text-yellow-600 bg-yellow-50";case"request":return"text-orange-600 bg-orange-50"}},g=()=>h?h.line_number?`L${h.line_number}`:h.section_heading?`§ ${h.section_heading}`:h.text_snippet?`"${h.text_snippet.slice(0,30)}${h.text_snippet.length>30?"...":""}"`:null:null;return f.jsx(Ts,{children:f.jsx(Ht,{className:`relative cursor-pointer rounded-lg border-2 bg-card shadow-sm transition-all hover:border-primary/30 hover:shadow-lg ${t.dismissed?"opacity-60":""} ${s}`,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),onClick:r,children:f.jsxs("div",{className:"p-3",children:[f.jsxs("div",{className:"mb-2",children:[f.jsxs("div",{className:"flex items-center justify-between gap-2",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:`flex-shrink-0 rounded-full p-1.5 ${m(t.feedback_type)}`,title:t.feedback_type,children:p(t.feedback_type)}),f.jsx("button",{className:"text-xs font-medium text-foreground hover:text-primary hover:underline",onClick:b=>{b.stopPropagation(),d(`/issues/${t.from_id}`)},children:t.from_id})]}),(e||n)&&f.jsxs("div",{className:"flex flex-shrink-0 gap-1 transition-opacity duration-150",style:{opacity:a?1:0},children:[!t.dismissed&&e&&f.jsxs(Sn,{children:[f.jsx(En,{asChild:!0,children:f.jsx(ie,{variant:"ghost",size:"sm",onClick:b=>{b.stopPropagation(),e(t.id)},className:"h-6 w-6 p-0",children:f.jsx(vf,{className:"h-3 w-3"})})}),f.jsx(gn,{children:f.jsx("p",{children:"Dismiss"})})]}),t.dismissed&&e&&f.jsxs(Sn,{children:[f.jsx(En,{asChild:!0,children:f.jsx(ie,{variant:"ghost",size:"sm",onClick:b=>{b.stopPropagation(),e(t.id)},className:"h-6 w-6 p-0",children:f.jsx(Sl,{className:"h-3 w-3"})})}),f.jsx(gn,{children:f.jsx("p",{children:"Restore"})})]}),n&&f.jsxs(Sn,{children:[f.jsx(En,{asChild:!0,children:f.jsx(ie,{variant:"ghost",size:"sm",onClick:b=>{b.stopPropagation(),n(t.id)},className:"h-6 w-6 p-0",children:f.jsx(Do,{className:"h-3 w-3"})})}),f.jsx(gn,{children:f.jsx("p",{children:"Delete"})})]})]})]}),f.jsxs("div",{className:"ml-9 flex items-center gap-2 text-xs text-muted-foreground",children:[h&&g()&&f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"flex-shrink-0",children:g()}),f.jsx("span",{className:"flex-shrink-0",children:"•"})]}),f.jsx("span",{className:"flex-shrink-0",children:oo(new Date(t.created_at.endsWith("Z")?t.created_at:t.created_at+"Z"),{addSuffix:!0})})]})]}),f.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none text-sm text-foreground",style:{maxHeight:c?`${i}px`:"3rem",overflowY:"auto",overflowX:"auto"},children:f.jsx(Ey,{remarkPlugins:[cy],components:{p:({children:b})=>f.jsx("p",{className:"my-1 break-words",children:b}),h1:({children:b})=>f.jsx("h1",{className:"my-1 text-lg font-bold break-words",children:b}),h2:({children:b})=>f.jsx("h2",{className:"my-1 text-base font-bold break-words",children:b}),h3:({children:b})=>f.jsx("h3",{className:"my-1 text-sm font-bold break-words",children:b}),ul:({children:b})=>f.jsx("ul",{className:"my-1 pl-4",children:b}),ol:({children:b})=>f.jsx("ol",{className:"my-1 pl-4",children:b}),li:({children:b})=>f.jsx("li",{className:"my-0.5 break-words",children:b}),code:({children:b,className:x})=>!x?f.jsx("code",{className:"break-words rounded bg-muted px-1 py-0.5 font-mono text-xs",children:b}):f.jsx("code",{className:`my-1 block overflow-x-auto rounded bg-muted p-2 font-mono text-xs ${x||""}`,children:b}),pre:({children:b})=>f.jsx("pre",{className:"my-1 overflow-x-auto",children:b}),blockquote:({children:b})=>f.jsx("blockquote",{className:"my-1 border-l-2 border-muted-foreground/30 pl-2 italic break-words",children:b}),a:({href:b,children:x})=>f.jsx("a",{href:b,className:"break-all text-primary underline hover:text-primary/80",target:"_blank",rel:"noopener noreferrer",onClick:w=>w.stopPropagation(),children:x}),strong:({children:b})=>f.jsx("strong",{className:"font-semibold",children:b}),em:({children:b})=>f.jsx("em",{className:"italic",children:b})},children:t.content})}),t.content.length>100&&f.jsx("button",{className:"mt-1 text-xs text-primary hover:underline",onClick:b=>{b.stopPropagation(),u(!c)},children:c?"Show less":"Show more"})]})})})}function RJ({positions:t,cardHeight:e=120,minSpacing:n=8,measuredHeights:r}){return y.useMemo(()=>{const s=new Map,i=Array.from(t.entries()).map(([a,l])=>({id:a,idealTop:l})).sort((a,l)=>a.idealTop-l.idealTop),o=[];for(const a of i){const l=(r==null?void 0:r.get(a.id))??e;let c=a.idealTop,u=!0;for(;u;){u=!1;for(const h of o){const p=h.actualTop+h.height+n,m=c+l;if(c<p&&m>h.actualTop){c=p,u=!0;break}}}const d={id:a.id,idealTop:a.idealTop,actualTop:c,height:l};o.push(d),s.set(a.id,d)}return s},[t,e,n,r])}const K0="sudocode:specs:showRelationshipsCollapsed";function OJ(t){if(!t)return null;try{return JSON.parse(t)}catch{return null}}function IJ({feedback:t,positions:e,onFeedbackClick:n,onDismiss:r,onDelete:s,addFeedbackButton:i,className:o="",relationships:a,currentEntityId:l,currentEntityType:c="spec",onDeleteRelationship:u,onCreateRelationship:d}){const h=y.useRef(null),p=y.useRef(new Map),[m,g]=y.useState(new Map),[b,x]=y.useState(!1),[w,v]=y.useState(()=>{const R=localStorage.getItem(K0);return R!==null?JSON.parse(R):!1}),k=(R,_,I)=>{d&&(d(R,_,I),x(!1))};y.useEffect(()=>{localStorage.setItem(K0,JSON.stringify(w))},[w]);const N=y.useCallback(()=>{const R=new Map;let _=!1;t.forEach(I=>{const D=p.current.get(I.id);if(D){const j=D.getBoundingClientRect().height,L=m.get(I.id);L===void 0||Math.abs(j-L)>5?(R.set(I.id,j),_=!0):R.set(I.id,L)}}),_&&g(R)},[t,m]);y.useEffect(()=>{const R=setTimeout(N,100),_=setInterval(N,500),I=()=>{N()};return window.addEventListener("resize",I),()=>{clearTimeout(R),clearInterval(_),window.removeEventListener("resize",I)}},[N]);const S=y.useCallback(R=>_=>{_?p.current.set(R,_):p.current.delete(R)},[]),C=y.useMemo(()=>{const R=new Map,_=16;return t.forEach(I=>{const D=OJ(I.anchor);if(!D||!D.line_number)R.set(I.id,_);else{const V=e.get(I.id);V!==void 0&&R.set(I.id,Math.max(V,_))}}),R},[t,e]),T=RJ({positions:C,cardHeight:130,minSpacing:8,measuredHeights:m});return f.jsxs("div",{className:`flex h-full w-64 flex-col bg-background pr-4 sm:w-80 md:w-96 lg:w-[28rem] xl:w-[30rem] 2xl:w-[40rem] ${o}`,children:[l&&f.jsxs("div",{className:"p-2",children:[f.jsxs("div",{className:"mb-2 flex cursor-pointer items-center justify-between rounded-md border p-2",onClick:()=>v(!w),children:[f.jsxs("div",{className:"flex items-center gap-2",children:[w?f.jsx($l,{className:"h-4 w-4 text-muted-foreground"}):f.jsx(Hg,{className:"h-4 w-4 text-muted-foreground"}),f.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Relationships"}),a&&a.length>0&&f.jsx(et,{variant:"secondary",children:a.length})]}),d&&f.jsxs(ie,{variant:"outline",size:"xs",onClick:R=>{R.stopPropagation(),x(!0)},className:"h-6",children:[f.jsx(bo,{className:"mr-1 h-4 w-4"}),"Add"]})]}),!w&&a&&a.length>0&&f.jsx(cC,{relationships:a,currentEntityId:l,currentEntityType:c,onDelete:u,showEmpty:!1,showGroupHeaders:!1})]}),f.jsx(Lo,{open:b,onOpenChange:x,children:f.jsxs(Ni,{children:[f.jsx(_i,{children:f.jsx(Ti,{children:"Add Relationship"})}),l&&f.jsx(CC,{fromId:l,fromType:c,onSubmit:k,onCancel:()=>x(!1)})]})}),i&&f.jsx("div",{className:"p-2",children:i}),f.jsx("div",{className:"relative min-h-full flex-1",children:f.jsxs("div",{ref:h,className:"relative w-full pt-4",children:[t.map(R=>{const _=T.get(R.id);return _?f.jsx("div",{ref:S(R.id),className:"absolute w-full px-1",style:{top:`${_.actualTop}px`,zIndex:10},children:f.jsx(MJ,{feedback:R,onClick:()=>n==null?void 0:n(R),onDismiss:r?()=>r(R.id):void 0,onDelete:s?()=>s(R.id):void 0,maxHeight:800,isCompact:!1})},R.id):null}),t.length>0&&f.jsx("div",{style:{height:`${Math.max(...Array.from(T.values()).map(R=>R.actualTop+R.height))+100}px`,pointerEvents:"none"}})]})})]})}function DJ({issues:t=[],selectedIssueId:e,onIssueSelect:n,issueId:r,lineNumber:s,textSnippet:i,onSubmit:o,onCancel:a,className:l=""}){const[c,u]=y.useState("comment"),[d,h]=y.useState(""),[p,m]=y.useState(!1),[g,b]=y.useState(!1),[x,w]=y.useState(""),v=e||r,k=y.useMemo(()=>{if(!x.trim())return t;const C=x.toLowerCase();return t.filter(T=>T.id.toLowerCase().includes(C)||T.title.toLowerCase().includes(C))},[t,x]),N=t.find(C=>C.id===v),S=async C=>{if(C.preventDefault(),!!d.trim()){m(!0);try{let T;(s||i)&&(T={line_number:s,text_snippet:i,anchor_status:"valid",last_verified_at:new Date().toISOString()}),await o({type:c,content:d.trim(),anchor:T}),h(""),u("comment")}finally{m(!1)}}};return f.jsxs("form",{onSubmit:S,className:`space-y-4 ${l}`,children:[(s||i)&&f.jsxs("div",{className:"rounded-md bg-muted/50 p-2 text-sm",children:[s&&f.jsxs("div",{className:"font-medium",children:["Line ",s]}),i&&f.jsxs("div",{className:"text-muted-foreground",children:['"',i.slice(0,60),i.length>60?"...":"",'"']})]}),t.length>0&&n&&f.jsxs("div",{className:"space-y-2",children:[f.jsx(Zn,{htmlFor:"issue-select",children:"Issue"}),f.jsxs(SC,{open:g,onOpenChange:b,children:[f.jsx(EC,{asChild:!0,children:f.jsxs(ie,{id:"issue-select",variant:"outline",role:"combobox","aria-expanded":g,className:"w-full justify-between font-normal",disabled:p,children:[N?f.jsxs("span",{className:"truncate",children:[f.jsx("span",{className:"font-medium",children:N.id}),f.jsxs("span",{className:"text-muted-foreground",children:[" - ",N.title]})]}):f.jsx("span",{className:"text-muted-foreground",children:"Search issues..."}),f.jsx(Hk,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),f.jsx(db,{className:"w-[--radix-popover-trigger-width] p-0",align:"start",children:f.jsxs("div",{className:"flex flex-col",children:[f.jsx("div",{className:"border-b p-2",children:f.jsx(ns,{placeholder:"Search issues...",value:x,onChange:C=>w(C.target.value),className:"h-8",autoFocus:!0})}),f.jsx("div",{className:"max-h-60 overflow-auto",children:k.length===0?f.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"No issues found"}):k.map(C=>f.jsxs("button",{type:"button",className:_e("flex w-full items-start gap-2 px-3 py-2 text-left text-sm hover:bg-accent hover:text-accent-foreground",v===C.id&&"bg-accent text-accent-foreground"),onClick:()=>{n(C.id),b(!1),w("")},children:[f.jsx(vf,{className:_e("mt-0.5 h-4 w-4 shrink-0",v===C.id?"opacity-100":"opacity-0")}),f.jsxs("div",{className:"flex-1 overflow-hidden",children:[f.jsx("div",{className:"font-medium",children:C.id}),f.jsx("div",{className:"truncate text-xs text-muted-foreground",children:C.title})]})]},C.id))})]})})]})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(Zn,{htmlFor:"feedback-type",children:"Type"}),f.jsxs(Jn,{value:c,onValueChange:C=>u(C),children:[f.jsx(zn,{id:"feedback-type",children:f.jsx(Yn,{})}),f.jsxs(Fn,{children:[f.jsx(Mt,{value:"comment",children:"Comment"}),f.jsx(Mt,{value:"suggestion",children:"Suggestion"}),f.jsx(Mt,{value:"request",children:"Request"})]})]})]}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(Zn,{htmlFor:"feedback-content",children:"Content"}),f.jsx(Bf,{id:"feedback-content",placeholder:"Enter your feedback...",value:d,onChange:C=>h(C.target.value),rows:4,required:!0,className:"resize-none"})]}),f.jsxs("div",{className:"flex gap-2",children:[f.jsx(ie,{type:"submit",disabled:!d.trim()||!v||p,children:p?"Adding...":"Add Feedback"}),f.jsx(ie,{type:"button",variant:"outline",onClick:a,children:"Cancel"})]})]})}function LJ({issues:t,lineNumber:e,textSnippet:n,onSubmit:r,triggerButton:s}){const[i,o]=y.useState(!1),[a,l]=y.useState(),c=async u=>{a&&(await r({issueId:a,...u}),o(!1),l(void 0))};return f.jsxs(Lo,{open:i,onOpenChange:o,children:[f.jsx(PO,{asChild:!0,children:s||f.jsxs(ie,{variant:"outline",size:"sm",children:[f.jsx(Ug,{className:"mr-2 h-4 w-4"}),"Add Feedback"]})}),f.jsxs(Ni,{className:"sm:max-w-[500px]",children:[f.jsxs(_i,{children:[f.jsx(Ti,{children:"Add Feedback"}),f.jsxs(Ef,{children:["Add a comment, suggestion, or request to this spec.",e&&` Anchored to line ${e}.`]})]}),f.jsx(DJ,{issues:t,selectedIssueId:a,onIssueSelect:l,lineNumber:e,textSnippet:n,onSubmit:c,onCancel:()=>o(!1)})]})]})}function PJ(t,e){let n=null;return(...r)=>{n&&clearTimeout(n),n=setTimeout(()=>t(...r),e)}}function jJ(t){if(!t)return null;try{return JSON.parse(t)}catch{return null}}function zJ(t,e){const[n,r]=y.useState(new Map),s=y.useRef(null),i=y.useRef(null);return y.useEffect(()=>{const o=()=>{const u=new Map,d=e.current;if(!d){r(u);return}t.forEach(h=>{var g;const p=jJ(h.anchor);if(!p)return;let m=d.querySelector(`[data-feedback-id="${h.id}"]`);if(!m&&p.line_number!==void 0&&(m=d.querySelector(`[data-line-number="${p.line_number}"]`),!m)){const b=Array.from(d.querySelectorAll("[data-line-number]"));if(b.length>0&&p.line_number>0){let x=null,w=0;for(const v of b){const k=parseInt(v.getAttribute("data-line-number")||"0");k>0&&k<=p.line_number&&k>w&&(w=k,x=v)}m=x||b[0]}}if(!m&&p.text_snippet){const b=p.text_snippet.replace(/\.\.\./g,"").trim();if(b){const x=Array.from(d.querySelectorAll("[data-line-number]"));for(const w of x)if((g=w.textContent)!=null&&g.includes(b)){m=w;break}}}if(m){let b=0,x=m;for(;x&&x!==d;)b+=x.offsetTop,x=x.offsetParent;u.set(h.id,b)}}),r(u)},a=()=>{i.current!==null&&cancelAnimationFrame(i.current),i.current=requestAnimationFrame(o)},l=PJ(o,100),c=e.current;return c==null||c.addEventListener("scroll",a,{passive:!0}),window.addEventListener("resize",l),s.current=setTimeout(o,50),()=>{c==null||c.removeEventListener("scroll",a),window.removeEventListener("resize",l),s.current&&clearTimeout(s.current),i.current!==null&&cancelAnimationFrame(i.current)}},[t,e]),n}function FJ({spec:t,isOpen:e,onClose:n,onConfirm:r,isDeleting:s=!1}){return t?f.jsx(zf,{open:e,onOpenChange:n,children:f.jsxs(Ic,{children:[f.jsxs(Dc,{children:[f.jsx(Pc,{children:"Delete Spec"}),f.jsxs(jc,{children:["Are you sure you want to delete ",f.jsx("strong",{children:t.title})," (",t.id,")?",f.jsx("br",{}),"This action cannot be undone."]})]}),f.jsxs(Lc,{children:[f.jsx(Fc,{disabled:s,children:"Cancel"}),f.jsx(zc,{onClick:r,disabled:s,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:s?"Deleting...":"Delete"})]})]})}):null}const BJ=[{value:"0",label:"Critical (P0)"},{value:"1",label:"High (P1)"},{value:"2",label:"Medium (P2)"},{value:"3",label:"Low (P3)"},{value:"4",label:"None (P4)"}],G0="sudocode:specs:showFeedbackPanel",J0="sudocode:details:viewMode";function $J(){const{id:t}=Lg(),e=_r(),{spec:n,isLoading:r,isError:s}=F2(t||""),{feedback:i}=B2(t||""),{issues:o}=Tc(),{updateSpec:a,isUpdating:l,archiveSpec:c,unarchiveSpec:u,deleteSpec:d}=$c(),{createFeedback:h,updateFeedback:p,deleteFeedback:m}=NJ(t||""),[g,b]=y.useState(null),[x,w]=y.useState(null),[v,k]=y.useState(()=>{const me=localStorage.getItem(G0);return me!==null?JSON.parse(me):!0}),[N,S]=y.useState(()=>{const me=localStorage.getItem(J0);return me!==null?JSON.parse(me):"formatted"}),[C,T]=y.useState(!1),[R,_]=y.useState(!1),[I,D]=y.useState(""),[V,j]=y.useState(""),[L,q]=y.useState(2),[re,X]=y.useState(!1),[ce,A]=y.useState([]),[ue,be]=y.useState(!1),E=y.useRef(null),P=y.useRef(a),z=y.useRef({title:I,content:V,priority:L,hasChanges:re}),H=y.useRef(t),B=y.useRef(null),J=zJ(i,B);if(y.useEffect(()=>{P.current=a},[a]),y.useEffect(()=>{z.current={title:I,content:V,priority:L,hasChanges:re}},[I,V,L,re]),y.useEffect(()=>{H.current=t},[t]),y.useEffect(()=>{E.current&&(clearTimeout(E.current),E.current=null),X(!1)},[t]),y.useEffect(()=>{n&&(D(n.title),j(n.content||""),q(n.priority??2),X(!1))},[n]),y.useEffect(()=>{(async()=>{if(t){be(!0);try{const ze=await ia.getForEntity(t,"spec");let Vt=[];if(Array.isArray(ze))Vt=ze;else if(ze&&typeof ze=="object"&&"outgoing"in ze&&"incoming"in ze){const Z=ze;Vt=[...Z.outgoing||[],...Z.incoming||[]]}A(Vt)}catch(ze){console.error("Failed to fetch relationships:",ze),A([])}finally{be(!1)}}})()},[t]),y.useEffect(()=>{if(!(!re||!t))return E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{P.current({id:t,data:{title:I,content:V,priority:L}}),X(!1)},1e3),()=>{E.current&&clearTimeout(E.current)}},[I,V,L,re]),y.useEffect(()=>()=>{const{hasChanges:me,title:ze,content:Vt,priority:Z}=z.current,ct=H.current;me&&ct&&P.current&&P.current({id:ct,data:{title:ze,content:Vt,priority:Z}})},[]),y.useEffect(()=>{localStorage.setItem(G0,JSON.stringify(v))},[v]),y.useEffect(()=>{localStorage.setItem(J0,JSON.stringify(N))},[N]),r)return f.jsx("div",{className:"flex items-center justify-center p-12",children:f.jsxs("div",{className:"text-center",children:[f.jsx("div",{className:"mx-auto mb-4 h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"}),f.jsx("p",{className:"text-muted-foreground",children:"Loading spec..."})]})});if(s||!n)return f.jsx("div",{className:"flex items-center justify-center p-12",children:f.jsxs("div",{className:"text-center",children:[f.jsx("h2",{className:"mb-2 text-2xl font-bold",children:"Spec not found"}),f.jsx("p",{className:"mb-4 text-muted-foreground",children:"The spec you're looking for doesn't exist or has been deleted."}),f.jsx(ie,{onClick:()=>e("/specs"),children:"Back to Specs"})]})});const K=me=>{b(me),w(null),k(!0)},Y=(me,ze)=>{w(me),b(ze),k(!0)},le=me=>{try{const ze=me.anchor?JSON.parse(me.anchor):null;ze!=null&&ze.line_number&&b(ze.line_number)}catch(ze){console.error("Failed to parse feedback anchor:",ze)}},ye=me=>{D(me),X(!0)},Re=me=>{j(me),X(!0)},Oe=me=>{q(me),X(!0)},ht=me=>{const ze=i.find(Vt=>Vt.id===me);ze&&p({id:me,data:{dismissed:!ze.dismissed}})},De=me=>{m(me)},_t=async me=>{if(!t){console.error("Cannot create feedback without spec ID");return}await h({to_id:t,issue_id:me.issueId,feedback_type:me.type,content:me.content,anchor:me.anchor})},ot=async me=>{try{await ia.delete({from_id:me.from_id,from_type:me.from_type,to_id:me.to_id,to_type:me.to_type,relationship_type:me.relationship_type}),A(ce.filter(ze=>!(ze.from_id===me.from_id&&ze.to_id===me.to_id&&ze.relationship_type===me.relationship_type)))}catch(ze){console.error("Failed to delete relationship:",ze)}},dn=async(me,ze,Vt)=>{if(t)try{const Z=await ia.create({from_id:t,from_type:"spec",to_id:me,to_type:ze,relationship_type:Vt});A([...ce,Z])}catch(Z){console.error("Failed to create relationship:",Z)}},qt=async()=>{if(t){_(!0);try{await d(t),T(!1),e("/specs")}catch(me){console.error("Failed to delete spec:",me)}finally{_(!1)}}};return f.jsxs("div",{className:"flex h-screen flex-col",children:[f.jsxs("div",{className:"flex items-center justify-between border-b bg-background p-2 sm:p-4",children:[f.jsx("div",{className:"flex items-center gap-2 sm:gap-4",children:f.jsxs(ie,{variant:"ghost",size:"sm",onClick:()=>e("/specs"),children:["← ",f.jsx("span",{className:"ml-1 hidden sm:inline",children:"Back to Specs"})]})}),f.jsxs("div",{className:"flex items-center gap-1 sm:gap-2",children:[f.jsx("div",{className:"flex items-center gap-1 sm:gap-2",children:f.jsxs("div",{className:"inline-flex rounded-md border border-border bg-muted/30 p-1",children:[f.jsxs(ie,{variant:N==="formatted"?"outline":"ghost",size:"sm",onClick:()=>S("formatted"),className:`h-7 rounded-sm ${N==="formatted"?"shadow-sm":"text-muted-foreground hover:bg-muted"}`,children:[f.jsx(Os,{className:"h-4 w-4 sm:mr-2"}),f.jsx("span",{className:"hidden sm:inline",children:"Formatted"})]}),f.jsxs(ie,{variant:N==="source"?"outline":"ghost",size:"sm",onClick:()=>S("source"),className:`h-7 rounded-sm ${N==="source"?"shadow-sm":"text-muted-foreground hover:bg-muted"}`,children:[f.jsx(vc,{className:"h-4 w-4 sm:mr-2"}),f.jsx("span",{className:"hidden sm:inline",children:"Markdown"})]})]})}),f.jsx(Ts,{children:f.jsxs(Sn,{children:[f.jsx(En,{asChild:!0,children:f.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>k(!v),children:[v?f.jsx(ER,{className:"h-4 w-4"}):f.jsx(wc,{className:"h-4 w-4"}),i.length>0&&f.jsx("span",{className:"ml-2 rounded-full bg-primary px-2 py-0.5 text-xs text-primary-foreground",children:i.length})]})}),f.jsx(gn,{children:f.jsxs("p",{children:[v?"Hide":"Show"," feedback"]})})]})}),n.archived?f.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>u(n.id),disabled:l,children:[f.jsx(Bg,{className:"h-4 w-4 sm:mr-2"}),f.jsx("span",{className:"hidden sm:inline",children:"Unarchive"})]}):f.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>c(n.id),disabled:l,children:[f.jsx(Ha,{className:"h-4 w-4 sm:mr-2"}),f.jsx("span",{className:"hidden sm:inline",children:"Archive"})]}),f.jsx(Ts,{children:f.jsxs(Sn,{children:[f.jsx(En,{asChild:!0,children:f.jsx(ie,{variant:"outline",size:"sm",onClick:()=>T(!0),disabled:l||R,children:f.jsx(Do,{className:"h-4 w-4"})})}),f.jsx(gn,{children:"Delete spec"})]})})]})]}),f.jsx("div",{ref:B,className:"flex flex-1 overflow-auto xl:justify-center",children:f.jsxs("div",{className:"flex w-full 2xl:max-w-[128rem]",children:[f.jsx("div",{className:"flex-1 px-3 py-4 sm:px-6 lg:px-12 xl:px-16",children:f.jsxs("div",{className:"mx-auto max-w-full space-y-3",children:[f.jsxs("div",{className:"space-y-2 pb-3",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(et,{variant:"spec",className:"font-mono",children:n.id}),n.parent_id&&f.jsxs(f.Fragment,{children:[f.jsx(Ua,{className:"h-3.5 w-3.5 text-muted-foreground"}),f.jsx("span",{className:"text-sm text-muted-foreground",children:"Parent: "}),f.jsx("button",{onClick:()=>e(`/specs/${n.parent_id}`),children:f.jsx(et,{variant:"spec",className:"cursor-pointer hover:opacity-80",children:n.parent_id})})]})]}),f.jsx("div",{className:"text-xs italic text-muted-foreground",children:l?"Saving...":re?"Unsaved changes...":"All changes saved"})]}),f.jsx(ns,{value:I,onChange:me=>ye(me.target.value),disabled:l,placeholder:"Spec title...",className:"border-none bg-transparent px-0 text-2xl font-semibold shadow-none focus-visible:ring-0"})]}),f.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(Wk,{className:"h-4 w-4 text-muted-foreground"}),f.jsxs(Jn,{value:String(L),onValueChange:me=>Oe(parseInt(me)),disabled:l,children:[f.jsx(zn,{className:"h-8 w-auto gap-3 rounded-md border-none bg-accent px-3 shadow-none hover:bg-accent/80",children:f.jsx(Yn,{placeholder:"Priority"})}),f.jsx(Fn,{children:BJ.map(me=>f.jsx(Mt,{value:me.value,children:me.label},me.value))})]})]}),f.jsx("div",{className:"ml-auto flex items-center gap-4 text-xs text-muted-foreground",children:n.updated_at&&f.jsxs("div",{className:"ml-auto flex items-center text-xs text-muted-foreground",children:["Updated"," ",oo(new Date(n.updated_at.endsWith("Z")?n.updated_at:n.updated_at+"Z"),{addSuffix:!0})]})})]}),V!==void 0?f.jsx(AJ,{content:V,feedback:i,selectedLine:g,onLineClick:K,onTextSelect:Y,onFeedbackClick:le,onChange:Re,viewMode:N,onViewModeChange:S}):f.jsx(Ht,{className:"p-8 text-center",children:f.jsx("p",{className:"text-muted-foreground",children:"No content available for this spec."})})]})}),v&&f.jsx(IJ,{feedback:i,positions:J,relationships:ce,currentEntityId:t,onFeedbackClick:le,onDismiss:ht,onDelete:De,onDeleteRelationship:ot,onCreateRelationship:dn,addFeedbackButton:f.jsx("div",{className:"flex justify-center",children:f.jsx(LJ,{issues:o,lineNumber:g||void 0,onSubmit:_t,triggerButton:f.jsxs(ie,{variant:"secondary",size:"sm",children:[f.jsx(Ug,{className:"mr-2 h-4 w-4"}),"Add Feedback"]})})})})]})}),f.jsx(FJ,{spec:n,isOpen:C,onClose:()=>T(!1),onConfirm:qt,isDeleting:R})]})}function HJ(){const t=_r(),{issues:e,isLoading:n,isError:r,error:s,updateIssue:i,deleteIssue:o,unarchiveIssue:a,isUpdating:l,isDeleting:c}=Tc(!0),[u,d]=y.useState(),{feedback:h}=Qg((u==null?void 0:u.id)||""),[p,m]=y.useState(""),g=y.useMemo(()=>{const N=p?e.filter(C=>{const T=p.toLowerCase();return C.title.toLowerCase().includes(T)||C.content&&C.content.toLowerCase().includes(T)}):e,S={open:[],in_progress:[],blocked:[],needs_review:[],closed:[]};return N.forEach(C=>{const T=C.status.toLowerCase();S[T]?S[T].push(C):S.open.push(C)}),Object.keys(S).forEach(C=>{const T=C;T==="closed"?S[T].sort((R,_)=>{const I=R.closed_at?new Date(R.closed_at).getTime():0;return(_.closed_at?new Date(_.closed_at).getTime():0)-I}):S[T].sort((R,_)=>R.priority!==_.priority?R.priority-_.priority:new Date(R.created_at).getTime()-new Date(_.created_at).getTime())}),S},[e,p]),b=y.useCallback(N=>{d(N)},[]),x=y.useCallback(()=>{d(void 0)},[]),w=y.useCallback(N=>{u&&i({id:u.id,data:N})},[u,i]),v=y.useCallback(()=>{u&&(o(u.id),d(void 0))},[u,o]),k=y.useCallback(N=>{a(N)},[a]);return n?f.jsx("div",{className:"flex items-center justify-center p-8",children:f.jsx("p",{className:"text-muted-foreground",children:"Loading archived issues..."})}):r?f.jsx("div",{className:"flex items-center justify-center p-8",children:f.jsxs("p",{className:"text-destructive",children:["Error loading archived issues: ",(s==null?void 0:s.message)||"Unknown error"]})}):f.jsxs("div",{className:"flex h-screen flex-col",children:[f.jsxs("div",{className:"flex items-center justify-between border-b bg-background p-4",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>t("/issues"),className:"h-8 w-8 p-0",children:f.jsx(xf,{className:"h-4 w-4"})}),f.jsxs("div",{children:[f.jsx("h1",{className:"text-2xl font-bold",children:"Archived Issues"}),f.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.length," archived issues"]})]})]}),f.jsxs("div",{className:"relative",children:[f.jsx(wf,{className:"absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),f.jsx(ns,{type:"text",placeholder:"Filter issues...",value:p,onChange:N=>m(N.target.value),className:"h-9 w-64 pl-8"})]})]}),f.jsx("div",{className:"flex flex-1 overflow-hidden",children:u?f.jsxs(Ay,{direction:"horizontal",className:"h-full min-h-0",onLayout:N=>{if(N.length===2)try{localStorage.setItem("archivedIssuesPage.panelSizes",JSON.stringify(N))}catch{}},children:[f.jsx(lc,{id:"kanban",order:1,defaultSize:(()=>{try{const N=localStorage.getItem("archivedIssuesPage.panelSizes");if(N){const S=JSON.parse(N);if(Array.isArray(S)&&S.length===2)return S[0]}}catch{}return 66})(),minSize:30,className:"min-h-0 min-w-0 overflow-auto",children:f.jsx(id,{groupedIssues:g,onDragEnd:()=>{},onViewIssueDetails:b,selectedIssue:u})}),f.jsxs(My,{className:"group relative z-30 w-1 cursor-col-resize touch-none bg-border focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-offset-1 focus-visible:ring-offset-background",children:[f.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-border"}),f.jsxs("div",{className:"pointer-events-none absolute left-1/2 top-1/2 flex -translate-x-1/2 -translate-y-1/2 flex-col items-center gap-1 rounded-full border border-border bg-muted/90 px-1.5 py-3 opacity-70 shadow-sm transition-opacity group-hover:opacity-100 group-focus:opacity-100",children:[f.jsx("span",{className:"h-1 w-1 rounded-full bg-muted-foreground"}),f.jsx("span",{className:"h-1 w-1 rounded-full bg-muted-foreground"}),f.jsx("span",{className:"h-1 w-1 rounded-full bg-muted-foreground"})]})]}),f.jsx(lc,{id:"details",order:2,defaultSize:(()=>{try{const N=localStorage.getItem("archivedIssuesPage.panelSizes");if(N){const S=JSON.parse(N);if(Array.isArray(S)&&S.length===2)return S[1]}}catch{}return 34})(),minSize:20,className:"min-h-0 min-w-0 overflow-hidden border-l bg-background shadow-lg",children:f.jsx(Cy,{issue:u,onClose:x,onUpdate:w,onDelete:v,onUnarchive:k,isUpdating:l,isDeleting:c,feedback:h})})]}):f.jsx("div",{className:"flex-1 overflow-auto",children:f.jsx(id,{groupedIssues:g,onDragEnd:()=>{},onViewIssueDetails:b,selectedIssue:u})})})]})}function UJ(){const{specs:t,isLoading:e}=$c(!0),n=_r(),[r,s]=y.useState(""),i=r?t.filter(o=>{const a=r.toLowerCase();return o.title.toLowerCase().includes(a)||o.content&&o.content.toLowerCase().includes(a)}):t;return f.jsxs("div",{className:"flex-1 p-8",children:[f.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[f.jsxs("div",{children:[f.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[f.jsx(ie,{variant:"ghost",size:"sm",onClick:()=>n("/specs"),className:"h-8 w-8 p-0",children:f.jsx(xf,{className:"h-4 w-4"})}),f.jsx("h1",{className:"text-3xl font-bold",children:"Archived Specs"})]}),f.jsx("p",{className:"text-muted-foreground ml-10",children:e?"Loading...":`${t.length} archived spec${t.length!==1?"s":""}`})]}),f.jsxs("div",{className:"relative",children:[f.jsx(wf,{className:"absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),f.jsx(ns,{type:"text",placeholder:"Filter specs...",value:r,onChange:o=>s(o.target.value),className:"h-9 w-64 pl-8"})]})]}),f.jsx(RA,{specs:i,loading:e})]})}var st;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{const i={};for(const o of s)i[o]=o;return i},t.getValidEnumValues=s=>{const i=t.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),o={};for(const a of i)o[a]=s[a];return t.objectValues(o)},t.objectValues=s=>t.objectKeys(s).map(function(i){return s[i]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},t.find=(s,i)=>{for(const o of s)if(i(o))return o},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=r,t.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(st||(st={}));var Y0;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Y0||(Y0={}));const xe=st.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Gs=t=>{switch(typeof t){case"undefined":return xe.undefined;case"string":return xe.string;case"number":return Number.isNaN(t)?xe.nan:xe.number;case"boolean":return xe.boolean;case"function":return xe.function;case"bigint":return xe.bigint;case"symbol":return xe.symbol;case"object":return Array.isArray(t)?xe.array:t===null?xe.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?xe.promise:typeof Map<"u"&&t instanceof Map?xe.map:typeof Set<"u"&&t instanceof Set?xe.set:typeof Date<"u"&&t instanceof Date?xe.date:xe.object;default:return xe.unknown}},ne=st.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Ms extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(i){return i.message},r={_errors:[]},s=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let a=r,l=0;for(;l<o.path.length;){const c=o.path[l];l===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(o))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return s(this),r}static assert(e){if(!(e instanceof Ms))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,st.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const s of this.issues)if(s.path.length>0){const i=s.path[0];n[i]=n[i]||[],n[i].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Ms.create=t=>new Ms(t);const bg=(t,e)=>{let n;switch(t.code){case ne.invalid_type:t.received===xe.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case ne.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,st.jsonStringifyReplacer)}`;break;case ne.unrecognized_keys:n=`Unrecognized key(s) in object: ${st.joinValues(t.keys,", ")}`;break;case ne.invalid_union:n="Invalid input";break;case ne.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${st.joinValues(t.options)}`;break;case ne.invalid_enum_value:n=`Invalid enum value. Expected ${st.joinValues(t.options)}, received '${t.received}'`;break;case ne.invalid_arguments:n="Invalid function arguments";break;case ne.invalid_return_type:n="Invalid function return type";break;case ne.invalid_date:n="Invalid date";break;case ne.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:st.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case ne.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case ne.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case ne.custom:n="Invalid input";break;case ne.invalid_intersection_types:n="Intersection results could not be merged";break;case ne.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case ne.not_finite:n="Number must be finite";break;default:n=e.defaultError,st.assertNever(t)}return{message:n}};let VJ=bg;function WJ(){return VJ}const qJ=t=>{const{data:e,path:n,errorMaps:r,issueData:s}=t,i=[...n,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let a="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)a=c(o,{data:e,defaultError:a}).message;return{...s,path:i,message:a}};function pe(t,e){const n=WJ(),r=qJ({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===bg?void 0:bg].filter(s=>!!s)});t.common.issues.push(r)}class ur{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const s of n){if(s.status==="aborted")return je;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const s of n){const i=await s.key,o=await s.value;r.push({key:i,value:o})}return ur.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const s of n){const{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return je;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[i.value]=o.value)}return{status:e.value,value:r}}}const je=Object.freeze({status:"aborted"}),kl=t=>({status:"dirty",value:t}),Tr=t=>({status:"valid",value:t}),Z0=t=>t.status==="aborted",X0=t=>t.status==="dirty",ja=t=>t.status==="valid",of=t=>typeof Promise<"u"&&t instanceof Promise;var ve;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(ve||(ve={}));class Ei{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Q0=(t,e)=>{if(ja(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Ms(t.common.issues);return this._error=n,this._error}}};function Ye(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(o,a)=>{const{message:l}=t;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:s}}class rt{get description(){return this._def.description}_getType(e){return Gs(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Gs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ur,ctx:{common:e.parent.common,data:e.data,parsedType:Gs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(of(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Gs(e)},s=this._parseSync({data:e,path:r.path,parent:r});return Q0(r,s)}"~validate"(e){var r,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Gs(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:n});return ja(i)?{value:i.value}:{issues:n.common.issues}}catch(i){(s=(r=i==null?void 0:i.message)==null?void 0:r.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(i=>ja(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Gs(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(of(s)?s:Promise.resolve(s));return Q0(r,i)}refine(e,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,i)=>{const o=e(s),a=()=>i.addIssue({code:ne.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new Ro({schema:this,typeName:Fe.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Ns.create(this,this._def)}nullable(){return Oo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Xr.create(this)}promise(){return ff.create(this,this._def)}or(e){return lf.create([this,e],this._def)}and(e){return cf.create(this,e,this._def)}transform(e){return new Ro({...Ye(this._def),schema:this,typeName:Fe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new hf({...Ye(this._def),innerType:this,defaultValue:n,typeName:Fe.ZodDefault})}brand(){return new LA({typeName:Fe.ZodBranded,type:this,...Ye(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new pf({...Ye(this._def),innerType:this,catchValue:n,typeName:Fe.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Oy.create(this,e)}readonly(){return mf.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const KJ=/^c[^\s-]{8,}$/i,GJ=/^[0-9a-z]+$/,JJ=/^[0-9A-HJKMNP-TV-Z]{26}$/i,YJ=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,ZJ=/^[a-z0-9_-]{21}$/i,XJ=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,QJ=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,eY=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,tY="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Hp;const nY=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,rY=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,sY=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,iY=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,oY=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,aY=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,OA="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",lY=new RegExp(`^${OA}$`);function IA(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function cY(t){return new RegExp(`^${IA(t)}$`)}function uY(t){let e=`${OA}T${IA(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function dY(t,e){return!!((e==="v4"||!e)&&nY.test(t)||(e==="v6"||!e)&&sY.test(t))}function fY(t,e){if(!XJ.test(t))return!1;try{const[n]=t.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function hY(t,e){return!!((e==="v4"||!e)&&rY.test(t)||(e==="v6"||!e)&&iY.test(t))}class hi extends rt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==xe.string){const i=this._getOrReturnCtx(e);return pe(i,{code:ne.invalid_type,expected:xe.string,received:i.parsedType}),je}const r=new ur;let s;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),pe(s,{code:ne.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),pe(s,{code:ne.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const o=e.data.length>i.value,a=e.data.length<i.value;(o||a)&&(s=this._getOrReturnCtx(e,s),o?pe(s,{code:ne.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&pe(s,{code:ne.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")eY.test(e.data)||(s=this._getOrReturnCtx(e,s),pe(s,{validation:"email",code:ne.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Hp||(Hp=new RegExp(tY,"u")),Hp.test(e.data)||(s=this._getOrReturnCtx(e,s),pe(s,{validation:"emoji",code:ne.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")YJ.test(e.data)||(s=this._getOrReturnCtx(e,s),pe(s,{validation:"uuid",code:ne.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")ZJ.test(e.data)||(s=this._getOrReturnCtx(e,s),pe(s,{validation:"nanoid",code:ne.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")KJ.test(e.data)||(s=this._getOrReturnCtx(e,s),pe(s,{validation:"cuid",code:ne.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")GJ.test(e.data)||(s=this._getOrReturnCtx(e,s),pe(s,{validation:"cuid2",code:ne.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")JJ.test(e.data)||(s=this._getOrReturnCtx(e,s),pe(s,{validation:"ulid",code:ne.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),pe(s,{validation:"url",code:ne.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),pe(s,{validation:"regex",code:ne.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),pe(s,{code:ne.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),pe(s,{code:ne.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),pe(s,{code:ne.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?uY(i).test(e.data)||(s=this._getOrReturnCtx(e,s),pe(s,{code:ne.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?lY.test(e.data)||(s=this._getOrReturnCtx(e,s),pe(s,{code:ne.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?cY(i).test(e.data)||(s=this._getOrReturnCtx(e,s),pe(s,{code:ne.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?QJ.test(e.data)||(s=this._getOrReturnCtx(e,s),pe(s,{validation:"duration",code:ne.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?dY(e.data,i.version)||(s=this._getOrReturnCtx(e,s),pe(s,{validation:"ip",code:ne.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?fY(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),pe(s,{validation:"jwt",code:ne.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?hY(e.data,i.version)||(s=this._getOrReturnCtx(e,s),pe(s,{validation:"cidr",code:ne.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?oY.test(e.data)||(s=this._getOrReturnCtx(e,s),pe(s,{validation:"base64",code:ne.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?aY.test(e.data)||(s=this._getOrReturnCtx(e,s),pe(s,{validation:"base64url",code:ne.invalid_string,message:i.message}),r.dirty()):st.assertNever(i);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:ne.invalid_string,...ve.errToObj(r)})}_addCheck(e){return new hi({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ve.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ve.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ve.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ve.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ve.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ve.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ve.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ve.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ve.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ve.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ve.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ve.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ve.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...ve.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...ve.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...ve.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...ve.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...ve.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...ve.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...ve.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...ve.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...ve.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...ve.errToObj(n)})}nonempty(e){return this.min(1,ve.errToObj(e))}trim(){return new hi({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new hi({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new hi({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}hi.create=t=>new hi({checks:[],typeName:Fe.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...Ye(t)});function pY(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,i=Number.parseInt(t.toFixed(s).replace(".","")),o=Number.parseInt(e.toFixed(s).replace(".",""));return i%o/10**s}class za extends rt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==xe.number){const i=this._getOrReturnCtx(e);return pe(i,{code:ne.invalid_type,expected:xe.number,received:i.parsedType}),je}let r;const s=new ur;for(const i of this._def.checks)i.kind==="int"?st.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),pe(r,{code:ne.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),pe(r,{code:ne.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),pe(r,{code:ne.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?pY(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),pe(r,{code:ne.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),pe(r,{code:ne.not_finite,message:i.message}),s.dirty()):st.assertNever(i);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,ve.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ve.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ve.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ve.toString(n))}setLimit(e,n,r,s){return new za({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ve.toString(s)}]})}_addCheck(e){return new za({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ve.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ve.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ve.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ve.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ve.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ve.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:ve.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ve.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ve.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&st.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}}za.create=t=>new za({checks:[],typeName:Fe.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Ye(t)});class dc extends rt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==xe.bigint)return this._getInvalidInput(e);let r;const s=new ur;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),pe(r,{code:ne.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),pe(r,{code:ne.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),pe(r,{code:ne.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):st.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return pe(n,{code:ne.invalid_type,expected:xe.bigint,received:n.parsedType}),je}gte(e,n){return this.setLimit("min",e,!0,ve.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ve.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ve.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ve.toString(n))}setLimit(e,n,r,s){return new dc({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:ve.toString(s)}]})}_addCheck(e){return new dc({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ve.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ve.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ve.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ve.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ve.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}dc.create=t=>new dc({checks:[],typeName:Fe.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...Ye(t)});class ek extends rt{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==xe.boolean){const r=this._getOrReturnCtx(e);return pe(r,{code:ne.invalid_type,expected:xe.boolean,received:r.parsedType}),je}return Tr(e.data)}}ek.create=t=>new ek({typeName:Fe.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Ye(t)});class af extends rt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==xe.date){const i=this._getOrReturnCtx(e);return pe(i,{code:ne.invalid_type,expected:xe.date,received:i.parsedType}),je}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return pe(i,{code:ne.invalid_date}),je}const r=new ur;let s;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),pe(s,{code:ne.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),pe(s,{code:ne.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):st.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new af({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:ve.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:ve.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}af.create=t=>new af({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Fe.ZodDate,...Ye(t)});class tk extends rt{_parse(e){if(this._getType(e)!==xe.symbol){const r=this._getOrReturnCtx(e);return pe(r,{code:ne.invalid_type,expected:xe.symbol,received:r.parsedType}),je}return Tr(e.data)}}tk.create=t=>new tk({typeName:Fe.ZodSymbol,...Ye(t)});class yg extends rt{_parse(e){if(this._getType(e)!==xe.undefined){const r=this._getOrReturnCtx(e);return pe(r,{code:ne.invalid_type,expected:xe.undefined,received:r.parsedType}),je}return Tr(e.data)}}yg.create=t=>new yg({typeName:Fe.ZodUndefined,...Ye(t)});class xg extends rt{_parse(e){if(this._getType(e)!==xe.null){const r=this._getOrReturnCtx(e);return pe(r,{code:ne.invalid_type,expected:xe.null,received:r.parsedType}),je}return Tr(e.data)}}xg.create=t=>new xg({typeName:Fe.ZodNull,...Ye(t)});class vg extends rt{constructor(){super(...arguments),this._any=!0}_parse(e){return Tr(e.data)}}vg.create=t=>new vg({typeName:Fe.ZodAny,...Ye(t)});class nk extends rt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Tr(e.data)}}nk.create=t=>new nk({typeName:Fe.ZodUnknown,...Ye(t)});class Ci extends rt{_parse(e){const n=this._getOrReturnCtx(e);return pe(n,{code:ne.invalid_type,expected:xe.never,received:n.parsedType}),je}}Ci.create=t=>new Ci({typeName:Fe.ZodNever,...Ye(t)});class rk extends rt{_parse(e){if(this._getType(e)!==xe.undefined){const r=this._getOrReturnCtx(e);return pe(r,{code:ne.invalid_type,expected:xe.void,received:r.parsedType}),je}return Tr(e.data)}}rk.create=t=>new rk({typeName:Fe.ZodVoid,...Ye(t)});class Xr extends rt{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==xe.array)return pe(n,{code:ne.invalid_type,expected:xe.array,received:n.parsedType}),je;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,a=n.data.length<s.exactLength.value;(o||a)&&(pe(n,{code:o?ne.too_big:ne.too_small,minimum:a?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(pe(n,{code:ne.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(pe(n,{code:ne.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>s.type._parseAsync(new Ei(n,o,n.path,a)))).then(o=>ur.mergeArray(r,o));const i=[...n.data].map((o,a)=>s.type._parseSync(new Ei(n,o,n.path,a)));return ur.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new Xr({...this._def,minLength:{value:e,message:ve.toString(n)}})}max(e,n){return new Xr({...this._def,maxLength:{value:e,message:ve.toString(n)}})}length(e,n){return new Xr({...this._def,exactLength:{value:e,message:ve.toString(n)}})}nonempty(e){return this.min(1,e)}}Xr.create=(t,e)=>new Xr({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Fe.ZodArray,...Ye(e)});function Qo(t){if(t instanceof Jt){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=Ns.create(Qo(r))}return new Jt({...t._def,shape:()=>e})}else return t instanceof Xr?new Xr({...t._def,type:Qo(t.element)}):t instanceof Ns?Ns.create(Qo(t.unwrap())):t instanceof Oo?Oo.create(Qo(t.unwrap())):t instanceof Ao?Ao.create(t.items.map(e=>Qo(e))):t}class Jt extends rt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=st.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==xe.object){const c=this._getOrReturnCtx(e);return pe(c,{code:ne.invalid_type,expected:xe.object,received:c.parsedType}),je}const{status:r,ctx:s}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ci&&this._def.unknownKeys==="strip"))for(const c in s.data)o.includes(c)||a.push(c);const l=[];for(const c of o){const u=i[c],d=s.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Ei(s,d,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof Ci){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:s.data[u]}});else if(c==="strict")a.length>0&&(pe(s,{code:ne.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of a){const d=s.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Ei(s,d,s.path,u)),alwaysSet:u in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const d=await u.key,h=await u.value;c.push({key:d,value:h,alwaysSet:u.alwaysSet})}return c}).then(c=>ur.mergeObjectSync(r,c)):ur.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return ve.errToObj,new Jt({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var i,o;const s=((o=(i=this._def).errorMap)==null?void 0:o.call(i,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:ve.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new Jt({...this._def,unknownKeys:"strip"})}passthrough(){return new Jt({...this._def,unknownKeys:"passthrough"})}extend(e){return new Jt({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Jt({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Fe.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new Jt({...this._def,catchall:e})}pick(e){const n={};for(const r of st.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new Jt({...this._def,shape:()=>n})}omit(e){const n={};for(const r of st.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new Jt({...this._def,shape:()=>n})}deepPartial(){return Qo(this)}partial(e){const n={};for(const r of st.objectKeys(this.shape)){const s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}return new Jt({...this._def,shape:()=>n})}required(e){const n={};for(const r of st.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof Ns;)i=i._def.innerType;n[r]=i}return new Jt({...this._def,shape:()=>n})}keyof(){return DA(st.objectKeys(this.shape))}}Jt.create=(t,e)=>new Jt({shape:()=>t,unknownKeys:"strip",catchall:Ci.create(),typeName:Fe.ZodObject,...Ye(e)});Jt.strictCreate=(t,e)=>new Jt({shape:()=>t,unknownKeys:"strict",catchall:Ci.create(),typeName:Fe.ZodObject,...Ye(e)});Jt.lazycreate=(t,e)=>new Jt({shape:t,unknownKeys:"strip",catchall:Ci.create(),typeName:Fe.ZodObject,...Ye(e)});class lf extends rt{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function s(i){for(const a of i)if(a.result.status==="valid")return a.result;for(const a of i)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(a=>new Ms(a.ctx.common.issues));return pe(n,{code:ne.invalid_union,unionErrors:o}),je}if(n.common.async)return Promise.all(r.map(async i=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let i;const o=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const a=o.map(l=>new Ms(l));return pe(n,{code:ne.invalid_union,unionErrors:a}),je}}get options(){return this._def.options}}lf.create=(t,e)=>new lf({options:t,typeName:Fe.ZodUnion,...Ye(e)});const gs=t=>t instanceof kg?gs(t.schema):t instanceof Ro?gs(t.innerType()):t instanceof uf?[t.value]:t instanceof Mo?t.options:t instanceof df?st.objectValues(t.enum):t instanceof hf?gs(t._def.innerType):t instanceof yg?[void 0]:t instanceof xg?[null]:t instanceof Ns?[void 0,...gs(t.unwrap())]:t instanceof Oo?[null,...gs(t.unwrap())]:t instanceof LA||t instanceof mf?gs(t.unwrap()):t instanceof pf?gs(t._def.innerType):[];class Ry extends rt{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==xe.object)return pe(n,{code:ne.invalid_type,expected:xe.object,received:n.parsedType}),je;const r=this.discriminator,s=n.data[r],i=this.optionsMap.get(s);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(pe(n,{code:ne.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),je)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){const s=new Map;for(const i of n){const o=gs(i.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const a of o){if(s.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);s.set(a,i)}}return new Ry({typeName:Fe.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:s,...Ye(r)})}}function wg(t,e){const n=Gs(t),r=Gs(e);if(t===e)return{valid:!0,data:t};if(n===xe.object&&r===xe.object){const s=st.objectKeys(e),i=st.objectKeys(t).filter(a=>s.indexOf(a)!==-1),o={...t,...e};for(const a of i){const l=wg(t[a],e[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(n===xe.array&&r===xe.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let i=0;i<t.length;i++){const o=t[i],a=e[i],l=wg(o,a);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return n===xe.date&&r===xe.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class cf extends rt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=(i,o)=>{if(Z0(i)||Z0(o))return je;const a=wg(i.value,o.value);return a.valid?((X0(i)||X0(o))&&n.dirty(),{status:n.value,value:a.data}):(pe(r,{code:ne.invalid_intersection_types}),je)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}cf.create=(t,e,n)=>new cf({left:t,right:e,typeName:Fe.ZodIntersection,...Ye(n)});class Ao extends rt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==xe.array)return pe(r,{code:ne.invalid_type,expected:xe.array,received:r.parsedType}),je;if(r.data.length<this._def.items.length)return pe(r,{code:ne.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),je;!this._def.rest&&r.data.length>this._def.items.length&&(pe(r,{code:ne.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((o,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new Ei(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>ur.mergeArray(n,o)):ur.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new Ao({...this._def,rest:e})}}Ao.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ao({items:t,typeName:Fe.ZodTuple,rest:null,...Ye(e)})};class sk extends rt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==xe.map)return pe(r,{code:ne.invalid_type,expected:xe.map,received:r.parsedType}),je;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([a,l],c)=>({key:s._parse(new Ei(r,a,r.path,[c,"key"])),value:i._parse(new Ei(r,l,r.path,[c,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of o){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return je;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of o){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return je;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}}sk.create=(t,e,n)=>new sk({valueType:e,keyType:t,typeName:Fe.ZodMap,...Ye(n)});class fc extends rt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==xe.set)return pe(r,{code:ne.invalid_type,expected:xe.set,received:r.parsedType}),je;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(pe(r,{code:ne.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(pe(r,{code:ne.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const i=this._def.valueType;function o(l){const c=new Set;for(const u of l){if(u.status==="aborted")return je;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const a=[...r.data.values()].map((l,c)=>i._parse(new Ei(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(e,n){return new fc({...this._def,minSize:{value:e,message:ve.toString(n)}})}max(e,n){return new fc({...this._def,maxSize:{value:e,message:ve.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}fc.create=(t,e)=>new fc({valueType:t,minSize:null,maxSize:null,typeName:Fe.ZodSet,...Ye(e)});class kg extends rt{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}kg.create=(t,e)=>new kg({getter:t,typeName:Fe.ZodLazy,...Ye(e)});class uf extends rt{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return pe(n,{received:n.data,code:ne.invalid_literal,expected:this._def.value}),je}return{status:"valid",value:e.data}}get value(){return this._def.value}}uf.create=(t,e)=>new uf({value:t,typeName:Fe.ZodLiteral,...Ye(e)});function DA(t,e){return new Mo({values:t,typeName:Fe.ZodEnum,...Ye(e)})}class Mo extends rt{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return pe(n,{expected:st.joinValues(r),received:n.parsedType,code:ne.invalid_type}),je}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return pe(n,{received:n.data,code:ne.invalid_enum_value,options:r}),je}return Tr(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return Mo.create(e,{...this._def,...n})}exclude(e,n=this._def){return Mo.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}Mo.create=DA;class df extends rt{_parse(e){const n=st.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==xe.string&&r.parsedType!==xe.number){const s=st.objectValues(n);return pe(r,{expected:st.joinValues(s),received:r.parsedType,code:ne.invalid_type}),je}if(this._cache||(this._cache=new Set(st.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=st.objectValues(n);return pe(r,{received:r.data,code:ne.invalid_enum_value,options:s}),je}return Tr(e.data)}get enum(){return this._def.values}}df.create=(t,e)=>new df({values:t,typeName:Fe.ZodNativeEnum,...Ye(e)});class ff extends rt{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==xe.promise&&n.common.async===!1)return pe(n,{code:ne.invalid_type,expected:xe.promise,received:n.parsedType}),je;const r=n.parsedType===xe.promise?n.data:Promise.resolve(n.data);return Tr(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}ff.create=(t,e)=>new ff({type:t,typeName:Fe.ZodPromise,...Ye(e)});class Ro extends rt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Fe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:o=>{pe(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const o=s.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return je;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?je:l.status==="dirty"||n.value==="dirty"?kl(l.value):l});{if(n.value==="aborted")return je;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?je:a.status==="dirty"||n.value==="dirty"?kl(a.value):a}}if(s.type==="refinement"){const o=a=>{const l=s.refinement(a,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?je:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?je:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(s.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!ja(o))return je;const a=s.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>ja(o)?Promise.resolve(s.transform(o.value,i)).then(a=>({status:n.value,value:a})):je);st.assertNever(s)}}Ro.create=(t,e,n)=>new Ro({schema:t,typeName:Fe.ZodEffects,effect:e,...Ye(n)});Ro.createWithPreprocess=(t,e,n)=>new Ro({schema:e,effect:{type:"preprocess",transform:t},typeName:Fe.ZodEffects,...Ye(n)});class Ns extends rt{_parse(e){return this._getType(e)===xe.undefined?Tr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ns.create=(t,e)=>new Ns({innerType:t,typeName:Fe.ZodOptional,...Ye(e)});class Oo extends rt{_parse(e){return this._getType(e)===xe.null?Tr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Oo.create=(t,e)=>new Oo({innerType:t,typeName:Fe.ZodNullable,...Ye(e)});class hf extends rt{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===xe.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}hf.create=(t,e)=>new hf({innerType:t,typeName:Fe.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Ye(e)});class pf extends rt{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return of(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ms(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ms(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}pf.create=(t,e)=>new pf({innerType:t,typeName:Fe.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Ye(e)});class ik extends rt{_parse(e){if(this._getType(e)!==xe.nan){const r=this._getOrReturnCtx(e);return pe(r,{code:ne.invalid_type,expected:xe.nan,received:r.parsedType}),je}return{status:"valid",value:e.data}}}ik.create=t=>new ik({typeName:Fe.ZodNaN,...Ye(t)});class LA extends rt{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Oy extends rt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?je:i.status==="dirty"?(n.dirty(),kl(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?je:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new Oy({in:e,out:n,typeName:Fe.ZodPipeline})}}class mf extends rt{_parse(e){const n=this._def.innerType._parse(e),r=s=>(ja(s)&&(s.value=Object.freeze(s.value)),s);return of(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}mf.create=(t,e)=>new mf({innerType:t,typeName:Fe.ZodReadonly,...Ye(e)});var Fe;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Fe||(Fe={}));const Le=hi.create,mY=za.create,Rs=vg.create;Ci.create;const ha=Xr.create,Pi=Jt.create,PA=lf.create,jA=Ry.create;cf.create;Ao.create;const Ge=uf.create;Mo.create;const gY=df.create;ff.create;Ns.create;Oo.create;var bY=Pi({name:Le(),arguments:Le()}),yY=Pi({id:Le(),type:Ge("function"),function:bY}),gh=Pi({id:Le(),role:Le(),content:Le().optional(),name:Le().optional()}),xY=gh.extend({role:Ge("developer"),content:Le()}),vY=gh.extend({role:Ge("system"),content:Le()}),wY=gh.extend({role:Ge("assistant"),content:Le().optional(),toolCalls:ha(yY).optional()}),kY=gh.extend({role:Ge("user"),content:Le()}),SY=Pi({id:Le(),content:Le(),role:Ge("tool"),toolCallId:Le(),error:Le().optional()}),zA=jA("role",[xY,vY,wY,kY,SY]);PA([Ge("developer"),Ge("system"),Ge("assistant"),Ge("user"),Ge("tool")]);var EY=Pi({description:Le(),value:Le()}),CY=Pi({name:Le(),description:Le(),parameters:Rs()});Pi({threadId:Le(),runId:Le(),state:Rs(),messages:ha(zA),tools:ha(CY),context:ha(EY),forwardedProps:Rs()});var NY=Rs(),FA=PA([Ge("developer"),Ge("system"),Ge("assistant"),Ge("user")]),vn=(t=>(t.TEXT_MESSAGE_START="TEXT_MESSAGE_START",t.TEXT_MESSAGE_CONTENT="TEXT_MESSAGE_CONTENT",t.TEXT_MESSAGE_END="TEXT_MESSAGE_END",t.TEXT_MESSAGE_CHUNK="TEXT_MESSAGE_CHUNK",t.THINKING_TEXT_MESSAGE_START="THINKING_TEXT_MESSAGE_START",t.THINKING_TEXT_MESSAGE_CONTENT="THINKING_TEXT_MESSAGE_CONTENT",t.THINKING_TEXT_MESSAGE_END="THINKING_TEXT_MESSAGE_END",t.TOOL_CALL_START="TOOL_CALL_START",t.TOOL_CALL_ARGS="TOOL_CALL_ARGS",t.TOOL_CALL_END="TOOL_CALL_END",t.TOOL_CALL_CHUNK="TOOL_CALL_CHUNK",t.TOOL_CALL_RESULT="TOOL_CALL_RESULT",t.THINKING_START="THINKING_START",t.THINKING_END="THINKING_END",t.STATE_SNAPSHOT="STATE_SNAPSHOT",t.STATE_DELTA="STATE_DELTA",t.MESSAGES_SNAPSHOT="MESSAGES_SNAPSHOT",t.RAW="RAW",t.CUSTOM="CUSTOM",t.RUN_STARTED="RUN_STARTED",t.RUN_FINISHED="RUN_FINISHED",t.RUN_ERROR="RUN_ERROR",t.STEP_STARTED="STEP_STARTED",t.STEP_FINISHED="STEP_FINISHED",t))(vn||{}),Lt=Pi({type:gY(vn),timestamp:mY().optional(),rawEvent:Rs().optional()}),_Y=Lt.extend({type:Ge("TEXT_MESSAGE_START"),messageId:Le(),role:FA.default("assistant")}),BA=Lt.extend({type:Ge("TEXT_MESSAGE_CONTENT"),messageId:Le(),delta:Le().refine(t=>t.length>0,"Delta must not be an empty string")}),TY=Lt.extend({type:Ge("TEXT_MESSAGE_END"),messageId:Le()}),AY=Lt.extend({type:Ge("TEXT_MESSAGE_CHUNK"),messageId:Le().optional(),role:FA.optional(),delta:Le().optional()}),MY=Lt.extend({type:Ge("THINKING_TEXT_MESSAGE_START")}),RY=BA.omit({messageId:!0,type:!0}).extend({type:Ge("THINKING_TEXT_MESSAGE_CONTENT")}),OY=Lt.extend({type:Ge("THINKING_TEXT_MESSAGE_END")}),IY=Lt.extend({type:Ge("TOOL_CALL_START"),toolCallId:Le(),toolCallName:Le(),parentMessageId:Le().optional()}),DY=Lt.extend({type:Ge("TOOL_CALL_ARGS"),toolCallId:Le(),delta:Le()}),LY=Lt.extend({type:Ge("TOOL_CALL_END"),toolCallId:Le()}),PY=Lt.extend({messageId:Le(),type:Ge("TOOL_CALL_RESULT"),toolCallId:Le(),content:Le(),role:Ge("tool").optional()}),jY=Lt.extend({type:Ge("TOOL_CALL_CHUNK"),toolCallId:Le().optional(),toolCallName:Le().optional(),parentMessageId:Le().optional(),delta:Le().optional()}),zY=Lt.extend({type:Ge("THINKING_START"),title:Le().optional()}),FY=Lt.extend({type:Ge("THINKING_END")}),BY=Lt.extend({type:Ge("STATE_SNAPSHOT"),snapshot:NY}),$Y=Lt.extend({type:Ge("STATE_DELTA"),delta:ha(Rs())}),HY=Lt.extend({type:Ge("MESSAGES_SNAPSHOT"),messages:ha(zA)}),UY=Lt.extend({type:Ge("RAW"),event:Rs(),source:Le().optional()}),VY=Lt.extend({type:Ge("CUSTOM"),name:Le(),value:Rs()}),WY=Lt.extend({type:Ge("RUN_STARTED"),threadId:Le(),runId:Le()}),qY=Lt.extend({type:Ge("RUN_FINISHED"),threadId:Le(),runId:Le(),result:Rs().optional()}),KY=Lt.extend({type:Ge("RUN_ERROR"),message:Le(),code:Le().optional()}),GY=Lt.extend({type:Ge("STEP_STARTED"),stepName:Le()}),JY=Lt.extend({type:Ge("STEP_FINISHED"),stepName:Le()});jA("type",[_Y,BA,TY,AY,zY,FY,MY,RY,OY,IY,DY,LY,jY,PY,BY,$Y,HY,UY,VY,WY,qY,KY,GY,JY]);function YY(t){const{executionId:e,autoConnect:n=!0,reconnectOnError:r=!1,endpoint:s,onEvent:i}=t,[o,a]=y.useState("idle"),[l,c]=y.useState({runId:null,threadId:null,status:"idle",currentStep:null,error:null,startTime:null,endTime:null}),[u,d]=y.useState(new Map),[h,p]=y.useState(new Map),[m,g]=y.useState({}),[b,x]=y.useState(null),w=y.useRef(null),v=y.useRef(null),k=y.useRef(i),N=y.useRef(!1);y.useEffect(()=>{k.current=i},[i]);const S=y.useCallback(E=>{var P,z;c(H=>({...H,runId:E.runId,threadId:E.threadId,status:"running",startTime:E.timestamp||Date.now()})),(z=(P=k.current)==null?void 0:P.onRunStarted)==null||z.call(P,E)},[]),C=y.useCallback(E=>{var P,z;c(H=>({...H,status:"completed",endTime:E.timestamp||Date.now()})),(z=(P=k.current)==null?void 0:P.onRunFinished)==null||z.call(P,E),N.current=!0,w.current&&(w.current.close(),w.current=null,a("disconnected"))},[]),T=y.useCallback(E=>{var P,z;c(H=>({...H,status:"error",error:E.message,endTime:E.timestamp||Date.now()})),x(new Error(E.message)),(z=(P=k.current)==null?void 0:P.onRunError)==null||z.call(P,E),N.current=!0,w.current&&(w.current.close(),w.current=null,a("disconnected"))},[]),R=y.useCallback(E=>{var P,z;c(H=>({...H,currentStep:E.stepName})),(z=(P=k.current)==null?void 0:P.onStepStarted)==null||z.call(P,E)},[]),_=y.useCallback(E=>{var P,z;(z=(P=k.current)==null?void 0:P.onStepFinished)==null||z.call(P,E)},[]),I=y.useCallback(E=>{d(P=>{const z=new Map(P);return z.set(E.messageId,{messageId:E.messageId,role:E.role||"assistant",content:"",complete:!1,timestamp:E.timestamp||Date.now()}),z})},[]),D=y.useCallback(E=>{d(P=>{var B,J;const z=new Map(P),H=z.get(E.messageId);if(H){const K={...H,content:H.content+E.delta};z.set(E.messageId,K),(J=(B=k.current)==null?void 0:B.onMessage)==null||J.call(B,K)}return z})},[]),V=y.useCallback(E=>{d(P=>{var B,J;const z=new Map(P),H=z.get(E.messageId);if(H){const K={...H,complete:!0};z.set(E.messageId,K),(J=(B=k.current)==null?void 0:B.onMessage)==null||J.call(B,K)}return z})},[]),j=y.useCallback(E=>{var P,z;p(H=>{const B=new Map(H);return B.set(E.toolCallId,{toolCallId:E.toolCallId,toolCallName:E.toolCallName,args:"",status:"started",startTime:E.timestamp||Date.now()}),B}),(z=(P=k.current)==null?void 0:P.onToolCallStart)==null||z.call(P,E)},[]),L=y.useCallback(E=>{p(P=>{const z=new Map(P),H=z.get(E.toolCallId);return H&&z.set(E.toolCallId,{...H,args:H.args+E.delta,status:"executing"}),z})},[]),q=y.useCallback(E=>{var P,z;p(H=>{const B=new Map(H),J=B.get(E.toolCallId);return J&&B.set(E.toolCallId,{...J,endTime:E.timestamp||Date.now()}),B}),(z=(P=k.current)==null?void 0:P.onToolCallEnd)==null||z.call(P,E)},[]),re=y.useCallback(E=>{p(P=>{const z=new Map(P),H=z.get(E.toolCallId);return H&&z.set(E.toolCallId,{...H,result:E.content,status:"completed"}),z})},[]),X=y.useCallback(E=>{var P,z;g(E.snapshot),(z=(P=k.current)==null?void 0:P.onStateUpdate)==null||z.call(P,E.snapshot)},[]),ce=y.useCallback(E=>{g(P=>{var H,B;let z={...P};for(const J of E.delta)if(J.op==="replace"){const K=J.path.slice(1);z={...z,[K]:J.value}}else if(J.op==="add"){const K=J.path.slice(1);z={...z,[K]:J.value}}return(B=(H=k.current)==null?void 0:H.onStateUpdate)==null||B.call(H,z),z})},[]),A=y.useCallback(()=>{if(N.current){console.debug("[SSE] Skipping connection - execution already completed");return}if(w.current){console.warn("EventSource already connected");return}const E=s||`/api/executions/${e}/stream`;console.debug("[SSE]. Connecting to SSE stream",{executionId:e,url:E,timestamp:new Date().toISOString()}),a("connecting"),x(null);try{const P=new EventSource(E);w.current=P,P.onopen=()=>{console.debug("[SSE]. SSE connection established",{executionId:e,timestamp:new Date().toISOString()}),a("connected")},P.onerror=z=>{if(console.error("EventSource error:",z),N.current){ue();return}a("error"),x(new Error("SSE connection error")),r&&v.current===null&&(console.debug("[SSE] Reconnecting in 3 seconds..."),v.current=setTimeout(()=>{v.current=null,ue(),A()},3e3))},P.addEventListener(vn.RUN_STARTED,z=>{S(JSON.parse(z.data))}),P.addEventListener(vn.RUN_FINISHED,z=>{C(JSON.parse(z.data))}),P.addEventListener(vn.RUN_ERROR,z=>{T(JSON.parse(z.data))}),P.addEventListener(vn.STEP_STARTED,z=>{R(JSON.parse(z.data))}),P.addEventListener(vn.STEP_FINISHED,z=>{_(JSON.parse(z.data))}),P.addEventListener(vn.TEXT_MESSAGE_START,z=>{I(JSON.parse(z.data))}),P.addEventListener(vn.TEXT_MESSAGE_CONTENT,z=>{D(JSON.parse(z.data))}),P.addEventListener(vn.TEXT_MESSAGE_END,z=>{V(JSON.parse(z.data))}),P.addEventListener(vn.TOOL_CALL_START,z=>{j(JSON.parse(z.data))}),P.addEventListener(vn.TOOL_CALL_ARGS,z=>{L(JSON.parse(z.data))}),P.addEventListener(vn.TOOL_CALL_END,z=>{q(JSON.parse(z.data))}),P.addEventListener(vn.TOOL_CALL_RESULT,z=>{re(JSON.parse(z.data))}),P.addEventListener(vn.STATE_SNAPSHOT,z=>{X(JSON.parse(z.data))}),P.addEventListener(vn.STATE_DELTA,z=>{ce(JSON.parse(z.data))})}catch(P){console.error("Failed to create EventSource:",P),a("error"),x(P instanceof Error?P:new Error("Unknown error"))}},[e,s,r,S,C,T,R,_,I,D,V,j,L,q,re,X,ce]),ue=y.useCallback(()=>{v.current&&(clearTimeout(v.current),v.current=null),w.current&&(w.current.close(),w.current=null,a("disconnected"))},[]),be=y.useCallback(()=>{N.current=!1,ue(),A()},[ue,A]);return y.useEffect(()=>(n&&A(),()=>{v.current&&(clearTimeout(v.current),v.current=null),w.current&&(w.current.close(),w.current=null,a("disconnected"))}),[n,e]),{connectionStatus:o,execution:l,messages:u,toolCalls:h,state:m,error:b,connect:A,disconnect:ue,reconnect:be,isConnected:o==="connected"}}function ZY(t,e){var s,i,o,a,l,c;const n=[],r=Date.now();switch(t.type){case"assistant":{const u=((s=t.message)==null?void 0:s.content)||[];for(const d of u)if(d.type==="text"&&d.text)n.push({type:"CUSTOM",timestamp:r,name:"TEXT_MESSAGE_CONTENT",value:{content:d.text}});else if(d.type==="tool_use"){const h=d.id||`tool-${Date.now()}`;n.push({type:"TOOL_CALL_START",timestamp:r,toolCallId:h,toolCallName:d.name||"unknown"},{type:"TOOL_CALL_ARGS",timestamp:r,toolCallId:h,delta:JSON.stringify(d.input||{})})}break}case"tool_result":{const u=((i=t.result)==null?void 0:i.tool_use_id)||"unknown",h=((a=(((o=t.result)==null?void 0:o.content)||[]).find(p=>p.type==="text"))==null?void 0:a.text)||"";n.push({type:"TOOL_CALL_END",timestamp:r,toolCallId:u},{type:"TOOL_CALL_RESULT",timestamp:r,messageId:`msg-${u}`,toolCallId:u,content:h});break}case"result":{if(t.usage){const u=t.usage;n.push({type:"CUSTOM",timestamp:r,name:"USAGE_UPDATE",value:{inputTokens:u.input_tokens||0,outputTokens:u.output_tokens||0,cacheTokens:u.cache_read_input_tokens||0,totalTokens:(u.input_tokens||0)+(u.output_tokens||0)}})}break}case"error":{n.push({type:"RUN_ERROR",timestamp:r,message:((l=t.error)==null?void 0:l.message)||"Unknown error",errorType:(c=t.error)==null?void 0:c.type});break}}return n}async function XY(t){const e=[];let n=0;for(let r=0;r<t.length;r++){const s=t[r].trim();if(s)try{const i=JSON.parse(s),o=ZY(i,n);e.push(...o),n+=o.length}catch(i){console.warn(`[parseExecutionLogs] Failed to parse log line ${r+1}:`,i instanceof Error?i.message:String(i))}}return e}function QY(t){const[e,n]=y.useState([]),[r,s]=y.useState(!0),[i,o]=y.useState(null),[a,l]=y.useState(null);return y.useEffect(()=>{s(!0),o(null),n([]),l(null);const c=new AbortController;async function u(){try{const d=await fetch(`/api/executions/${t}/logs`,{signal:c.signal});if(!d.ok)throw d.status===404?new Error(`Execution not found: ${t}`):new Error(`Failed to fetch execution logs: ${d.status} ${d.statusText}`);const h=await d.json();if(!h.success)throw new Error(h.message||"Failed to fetch execution logs");const p=await XY(h.data.logs);n(p),l(h.data.metadata)}catch(d){if(d instanceof Error&&d.name==="AbortError")return;const h=d instanceof Error?d:new Error("Unknown error fetching execution logs");o(h),console.error("[useExecutionLogs] Error:",h)}finally{c.signal.aborted||s(!1)}}return u(),()=>{c.abort()}},[t]),{events:e,loading:r,error:i,metadata:a}}function eZ({messages:t,toolCalls:e,renderMarkdown:n=!0,className:r=""}){const s=y.useMemo(()=>{const i=[];return t.forEach(o=>{i.push({type:"message",timestamp:o.timestamp,data:o})}),e.forEach(o=>{i.push({type:"tool_call",timestamp:o.startTime,data:o})}),i.sort((o,a)=>o.timestamp-a.timestamp)},[t,e]);return s.length===0?null:f.jsx("div",{className:`space-y-3 ${r}`,children:s.map(i=>{if(i.type==="message"){const o=i.data;return f.jsxs("div",{className:"flex gap-3 items-start",children:[f.jsx("div",{className:"mt-1 flex-shrink-0",children:f.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-full bg-primary/10",children:f.jsx(wc,{className:"h-4 w-4 text-primary"})})}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[f.jsx(et,{variant:"outline",className:"text-xs",children:o.role}),!o.complete&&f.jsx(mi,{className:"h-3 w-3 animate-spin text-muted-foreground"})]}),f.jsx("div",{className:"rounded-lg bg-muted/50 p-3 text-sm",children:n?f.jsx(Ey,{className:"prose prose-sm max-w-none dark:prose-invert",components:{p:({children:a})=>f.jsx("p",{className:"mb-2 last:mb-0",children:a}),code:({inline:a,children:l,...c})=>a?f.jsx("code",{className:"bg-background px-1 py-0.5 rounded text-xs",...c,children:l}):f.jsx("pre",{className:"bg-background p-2 rounded overflow-x-auto",children:f.jsx("code",{...c,children:l})}),ul:({children:a})=>f.jsx("ul",{className:"list-disc pl-4 mb-2",children:a}),ol:({children:a})=>f.jsx("ol",{className:"list-decimal pl-4 mb-2",children:a}),li:({children:a})=>f.jsx("li",{className:"mb-1",children:a}),a:({children:a,href:l})=>f.jsx("a",{href:l,className:"text-primary hover:underline",target:"_blank",rel:"noopener noreferrer",children:a})},children:o.content}):f.jsx("div",{className:"whitespace-pre-wrap",children:o.content})})]})]},`msg-${o.messageId}`)}else{const o=i.data;return f.jsxs("div",{className:"flex gap-3 items-start",children:[f.jsx("div",{className:"mt-1 flex-shrink-0",children:f.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-full bg-blue-500/10",children:f.jsx(IR,{className:"h-4 w-4 text-blue-500"})})}),f.jsx("div",{className:"flex-1 min-w-0",children:f.jsxs("div",{className:"rounded-lg border bg-card p-3 text-sm",children:[f.jsxs("div",{className:"flex items-center justify-between mb-2",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("span",{className:"font-medium",children:o.toolCallName}),f.jsx(et,{variant:o.status==="completed"?"default":o.status==="error"?"destructive":"secondary",className:"text-xs",children:o.status})]}),o.endTime&&f.jsxs("span",{className:"text-xs text-muted-foreground",children:[((o.endTime-o.startTime)/1e3).toFixed(2),"s"]})]}),o.args&&f.jsxs("details",{className:"mt-2",children:[f.jsx("summary",{className:"cursor-pointer text-xs text-muted-foreground hover:text-foreground",children:"Arguments"}),f.jsx("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto",children:o.args})]}),o.result&&f.jsxs("details",{className:"mt-2",open:o.status==="completed",children:[f.jsx("summary",{className:"cursor-pointer text-xs text-muted-foreground hover:text-foreground",children:"Result"}),f.jsx("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-h-40",children:o.result})]}),o.error&&f.jsx("div",{className:"mt-2 text-xs text-destructive bg-destructive/10 p-2 rounded",children:o.error})]})})]},`tool-${o.toolCallId}`)}})})}function tZ({executionId:t,execution:e,onComplete:n,onError:r,className:s=""}){const i=y.useMemo(()=>e?["preparing","pending","running","paused"].includes(e.status):!0,[e]),o=YY({executionId:t,autoConnect:i}),a=QY(t),{connectionStatus:l,execution:c,messages:u,toolCalls:d,state:h,error:p,isConnected:m}=y.useMemo(()=>{var v;if(i)return{connectionStatus:o.connectionStatus,execution:o.execution,messages:o.messages,toolCalls:o.toolCalls,state:o.state,error:o.error,isConnected:o.isConnected};{const k=new Map,N=new Map,S={};return a.events&&a.events.forEach(C=>{if(C.type==="TEXT_MESSAGE_CONTENT"||C.name==="TEXT_MESSAGE_CONTENT"){const T=C.value||C;k.set(k.size,{id:k.size,content:T.content||T.text,timestamp:C.timestamp||Date.now()})}else if(C.type==="TOOL_CALL_START"||C.name==="TOOL_CALL_START"){const T=C.value||C;N.set(T.toolCallId,{id:T.toolCallId,name:T.name,status:"running",timestamp:C.timestamp||Date.now()})}else if(C.type==="TOOL_CALL_RESULT"||C.name==="TOOL_CALL_RESULT"){const T=C.value||C,R=N.get(T.toolCallId);R&&N.set(T.toolCallId,{...R,status:"completed",result:T.result})}}),{connectionStatus:a.loading?"connecting":a.error?"error":"connected",execution:{status:(e==null?void 0:e.status)||"completed",runId:t,currentStep:void 0,error:(v=a.error)==null?void 0:v.message,startTime:void 0,endTime:void 0},messages:k,toolCalls:N,state:S,error:a.error,isConnected:!1}}},[i,o,a,t,e]);y.useEffect(()=>{c.status==="completed"&&n&&n()},[c.status,n]),y.useEffect(()=>{p&&r&&r(p)},[p,r]);const g=d.size,b=Array.from(d.values()).filter(v=>v.status==="completed").length,x=u.size,w=()=>l==="connecting"?f.jsxs(et,{variant:"outline",className:"flex items-center gap-1",children:[f.jsx(mi,{className:"h-3 w-3 animate-spin"}),"Connecting..."]}):l==="error"||c.status==="error"?f.jsxs(et,{variant:"destructive",className:"flex items-center gap-1",children:[f.jsx(ra,{className:"h-3 w-3"}),"Error"]}):c.status==="completed"?f.jsxs(et,{variant:"default",className:"flex items-center gap-1 bg-green-600",children:[f.jsx($g,{className:"h-3 w-3"}),"Completed"]}):c.status==="running"?f.jsxs(et,{variant:"default",className:"flex items-center gap-1",children:[f.jsx(mi,{className:"h-3 w-3 animate-spin"}),"Running"]}):f.jsxs(et,{variant:"secondary",className:"flex items-center gap-1",children:[f.jsx(go,{className:"h-3 w-3"}),"Idle"]});return l==="connecting"&&c.status==="idle"?f.jsx(Ht,{className:`p-6 ${s}`,children:f.jsxs("div",{className:"flex items-center justify-center gap-2 text-muted-foreground",children:[f.jsx(mi,{className:"h-4 w-4 animate-spin"}),f.jsx("span",{children:"Connecting to execution stream..."})]})}):f.jsxs(Ht,{className:`flex flex-col ${s}`,children:[f.jsxs("div",{className:"border-b px-6 py-4",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx("h3",{className:"font-semibold",children:"Execution Monitor"}),w()]}),f.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[c.runId&&f.jsxs("span",{className:"font-mono text-xs",children:["Run: ",c.runId.slice(0,8)]}),m&&f.jsx(et,{variant:"outline",className:"text-xs",children:"Live"})]})]}),c.currentStep&&f.jsxs("div",{className:"mt-3 text-sm text-muted-foreground",children:[f.jsx("span",{className:"font-medium",children:"Current step:"})," ",c.currentStep]}),h.progress!==void 0&&h.totalSteps&&f.jsxs("div",{className:"mt-3",children:[f.jsxs("div",{className:"flex items-center justify-between text-sm text-muted-foreground mb-1",children:[f.jsx("span",{children:"Progress"}),f.jsxs("span",{children:[h.progress," / ",h.totalSteps]})]}),f.jsx("div",{className:"h-2 bg-secondary rounded-full overflow-hidden",children:f.jsx("div",{className:"h-full bg-primary transition-all duration-300",style:{width:`${h.progress/h.totalSteps*100}%`}})})]})]}),f.jsxs("div",{className:"flex-1 overflow-auto px-6 py-4",children:[(p||c.error)&&f.jsx("div",{className:"rounded-md bg-destructive/10 border border-destructive/20 p-4 mb-4",children:f.jsxs("div",{className:"flex items-start gap-2",children:[f.jsx(ra,{className:"h-5 w-5 text-destructive mt-0.5"}),f.jsxs("div",{className:"flex-1",children:[f.jsx("h4",{className:"font-semibold text-destructive",children:"Error"}),f.jsx("p",{className:"text-sm text-destructive/90 mt-1",children:c.error||(p==null?void 0:p.message)})]})]})}),(x>0||g>0)&&f.jsx(eZ,{messages:u,toolCalls:d,renderMarkdown:!0}),x===0&&g===0&&!p&&!c.error&&f.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center text-muted-foreground",children:[f.jsx(go,{className:"h-8 w-8 mb-2"}),f.jsx("p",{className:"text-sm",children:"No execution activity yet"}),f.jsx("p",{className:"text-xs mt-1",children:m?"Waiting for events...":"Connecting..."})]})]}),f.jsx("div",{className:"border-t px-6 py-3 bg-muted/30",children:f.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[f.jsxs("div",{className:"flex items-center gap-4",children:[f.jsxs("span",{children:[f.jsx("span",{className:"font-medium",children:g})," tool calls"]}),f.jsxs("span",{children:[f.jsx("span",{className:"font-medium",children:b})," completed"]}),f.jsxs("span",{children:[f.jsx("span",{className:"font-medium",children:x})," messages"]})]}),h.tokenUsage&&f.jsxs("div",{className:"flex items-center gap-4",children:[f.jsxs("span",{children:[f.jsx("span",{className:"font-medium",children:h.tokenUsage})," tokens"]}),h.cost&&f.jsx("span",{children:f.jsxs("span",{className:"font-medium",children:["$",h.cost.toFixed(4)]})})]}),c.startTime&&c.endTime&&f.jsxs("span",{children:["Duration:"," ",f.jsxs("span",{className:"font-medium",children:[((c.endTime-c.startTime)/1e3).toFixed(2),"s"]})]})]})})]})}function nZ({open:t,onSubmit:e,onCancel:n}){const[r,s]=y.useState(""),[i,o]=y.useState(!1),[a,l]=y.useState(null),c=async()=>{if(r.trim().length===0){l("Feedback cannot be empty");return}o(!0),l(null);try{await e(r.trim()),s(""),l(null)}catch(p){l(p instanceof Error?p.message:"Failed to submit feedback")}finally{o(!1)}},u=()=>{i||(s(""),l(null),n())},d=p=>{!p&&!i&&u()},h=r.trim().length>0&&!i;return f.jsx(Lo,{open:t,onOpenChange:d,children:f.jsxs(Ni,{className:"max-w-2xl",children:[f.jsxs(_i,{children:[f.jsx(Ti,{children:"Continue Execution"}),f.jsx(Ef,{children:"Provide additional feedback to continue the agent's work in the same environment."})]}),f.jsxs("div",{className:"space-y-4",children:[a&&f.jsx("div",{className:"rounded-lg border border-destructive bg-destructive/10 p-3",children:f.jsxs("div",{className:"flex items-start gap-2",children:[f.jsx(go,{className:"h-5 w-5 text-destructive mt-0.5 flex-shrink-0"}),f.jsx("p",{className:"text-sm text-destructive",children:a})]})}),f.jsxs("div",{className:"space-y-2",children:[f.jsx(Zn,{htmlFor:"feedback",children:"Feedback"}),f.jsx(Bf,{id:"feedback",value:r,onChange:p=>s(p.target.value),rows:8,placeholder:`Provide feedback or additional instructions for the agent.
575
-
576
- Examples:
577
- • "Please add error handling for edge cases"
578
- • "Can you explain the approach you took?"
579
- • "Also add tests for this functionality"`,className:"resize-none",disabled:i}),f.jsx("p",{className:"text-xs text-muted-foreground",children:"The agent will continue working in the same environment with this feedback."})]})]}),f.jsxs(Kg,{children:[f.jsx(ie,{variant:"outline",onClick:u,disabled:i,children:"Cancel"}),f.jsx(ie,{onClick:c,disabled:!h,children:i?"Submitting...":"Continue"})]})]})})}function rZ({worktreePath:t,isOpen:e,onClose:n,onConfirm:r,isDeleting:s=!1}){return t?f.jsx(zf,{open:e,onOpenChange:n,children:f.jsxs(Ic,{children:[f.jsxs(Dc,{children:[f.jsx(Pc,{children:"Delete Worktree"}),f.jsxs(jc,{children:["Are you sure you want to delete the worktree? This action cannot be undone.",f.jsx("br",{}),f.jsx("br",{}),f.jsx("strong",{children:"Worktree path:"}),f.jsx("br",{}),f.jsx("code",{className:"text-xs",children:t})]})]}),f.jsxs(Lc,{children:[f.jsx(Fc,{disabled:s,children:"Cancel"}),f.jsx(zc,{onClick:r,disabled:s,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:s?"Deleting...":"Delete"})]})]})}):null}function sZ({executionId:t,onFollowUpCreated:e}){const[n,r]=y.useState(null),[s,i]=y.useState(!0),[o,a]=y.useState(null),[l,c]=y.useState(!1),[u,d]=y.useState(!1),[h,p]=y.useState(!1),[m,g]=y.useState(!1),[b,x]=y.useState(!1);y.useEffect(()=>{(async()=>{i(!0),a(null);try{const D=await gr.getById(t);if(r(D),D.worktree_path)try{const V=await gr.worktreeExists(t);x(V.exists)}catch(V){console.error("Failed to check worktree status:",V),x(!1)}}catch(D){a(D instanceof Error?D.message:"Failed to load execution")}finally{i(!1)}})()},[t]);const w=y.useCallback(async()=>{try{const I=await gr.getById(t);if(r(I),I.worktree_path)try{const D=await gr.worktreeExists(t);x(D.exists)}catch(D){console.error("Failed to check worktree status:",D),x(!1)}}catch(I){console.error("Failed to reload execution:",I)}},[t]),v=y.useCallback(I=>{a(I.message)},[]),k=async()=>{if(n){p(!0);try{await gr.cancel(t);const I=await gr.getById(t);r(I)}catch(I){a(I instanceof Error?I.message:"Failed to cancel execution")}finally{p(!1)}}},N=async I=>{const D=await gr.createFollowUp(t,{feedback:I});c(!1),e&&e(D.id)},S=async()=>{if(!(!n||!n.worktree_path)){g(!0);try{await gr.deleteWorktree(t),x(!1);const I=await gr.getById(t);r(I),d(!1)}catch(I){a(I instanceof Error?I.message:"Failed to delete worktree")}finally{g(!1)}}},C=I=>{switch(I){case"preparing":return f.jsxs(et,{variant:"secondary",className:"flex items-center gap-1",children:[f.jsx(Hl,{className:"h-3 w-3"}),"Preparing"]});case"pending":return f.jsxs(et,{variant:"secondary",className:"flex items-center gap-1",children:[f.jsx(Hl,{className:"h-3 w-3"}),"Pending"]});case"running":return f.jsxs(et,{variant:"default",className:"flex items-center gap-1",children:[f.jsx(mi,{className:"h-3 w-3 animate-spin"}),"Running"]});case"paused":return f.jsxs(et,{variant:"outline",className:"flex items-center gap-1",children:[f.jsx(Vk,{className:"h-3 w-3"}),"Paused"]});case"completed":return f.jsxs(et,{variant:"default",className:"flex items-center gap-1 bg-green-600",children:[f.jsx($g,{className:"h-3 w-3"}),"Completed"]});case"failed":return f.jsxs(et,{variant:"destructive",className:"flex items-center gap-1",children:[f.jsx(ra,{className:"h-3 w-3"}),"Failed"]});case"cancelled":return f.jsxs(et,{variant:"secondary",className:"flex items-center gap-1",children:[f.jsx(Sl,{className:"h-3 w-3"}),"Cancelled"]});case"stopped":return f.jsxs(et,{variant:"secondary",className:"flex items-center gap-1",children:[f.jsx(Sl,{className:"h-3 w-3"}),"Stopped"]});default:return f.jsxs(et,{variant:"secondary",className:"flex items-center gap-1",children:[f.jsx(go,{className:"h-3 w-3"}),String(I).charAt(0).toUpperCase()+String(I).slice(1)]})}};if(s)return f.jsx(Ht,{className:"p-6",children:f.jsxs("div",{className:"flex items-center justify-center gap-2 text-muted-foreground",children:[f.jsx(mi,{className:"h-4 w-4 animate-spin"}),f.jsx("span",{children:"Loading execution..."})]})});if(o||!n)return f.jsx(Ht,{className:"p-6",children:f.jsxs("div",{className:"flex items-start gap-2 text-destructive",children:[f.jsx(ra,{className:"mt-0.5 h-5 w-5"}),f.jsxs("div",{children:[f.jsx("h4",{className:"font-semibold",children:"Error Loading Execution"}),f.jsx("p",{className:"mt-1 text-sm",children:o||"Execution not found"})]})]})});const T=n.status==="running",R=n.status==="completed"||n.status==="failed"||n.status==="stopped",_=n.worktree_path&&b;return f.jsxs("div",{className:"space-y-4",children:[f.jsx(Ht,{className:"p-6",children:f.jsxs("div",{className:"flex items-start justify-between",children:[f.jsxs("div",{className:"flex-1 space-y-3",children:[f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx("h2",{className:"text-xl font-semibold",children:"Execution"}),C(n.status)]}),f.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[f.jsxs("div",{children:[f.jsx("span",{className:"text-muted-foreground",children:"ID:"}),f.jsx("span",{className:"ml-2 font-mono",children:n.id})]}),f.jsxs("div",{children:[f.jsx("span",{className:"text-muted-foreground",children:"Issue:"}),f.jsx("span",{className:"ml-2 font-mono",children:n.issue_id})]}),f.jsxs("div",{children:[f.jsx("span",{className:"text-muted-foreground",children:"Mode:"}),f.jsx("span",{className:"ml-2 capitalize",children:n.mode})]}),f.jsxs("div",{children:[f.jsx("span",{className:"text-muted-foreground",children:"Model:"}),f.jsx("span",{className:"ml-2",children:n.model})]}),n.target_branch&&f.jsxs("div",{children:[f.jsx("span",{className:"text-muted-foreground",children:"Base Branch:"}),f.jsx("span",{className:"ml-2 font-mono",children:n.target_branch})]}),n.worktree_path&&f.jsxs("div",{children:[f.jsx("span",{className:"text-muted-foreground",children:"Worktree:"}),f.jsx("span",{className:"ml-2 font-mono text-xs",children:n.worktree_path}),b?f.jsx(et,{variant:"secondary",className:"ml-2 text-xs",children:"exists"}):f.jsx(et,{variant:"outline",className:"ml-2 text-xs text-muted-foreground",children:"deleted"})]})]}),f.jsxs("div",{className:"flex gap-4 text-xs text-muted-foreground",children:[n.created_at&&f.jsxs("div",{children:["Created:"," ",new Date(n.created_at).toLocaleString("en-US",{dateStyle:"short",timeStyle:"short"})]}),n.started_at&&f.jsxs("div",{children:["Started:"," ",new Date(n.started_at).toLocaleString("en-US",{dateStyle:"short",timeStyle:"short"})]}),n.completed_at&&f.jsxs("div",{children:["Completed:"," ",new Date(n.completed_at).toLocaleString("en-US",{dateStyle:"short",timeStyle:"short"})]})]}),n.error&&f.jsx("div",{className:"rounded-md border border-destructive/20 bg-destructive/10 p-3 text-sm",children:f.jsxs("div",{className:"flex items-start gap-2",children:[f.jsx(ra,{className:"mt-0.5 h-4 w-4 text-destructive"}),f.jsxs("div",{children:[f.jsx("h5",{className:"font-medium text-destructive",children:"Execution Error"}),f.jsx("p",{className:"mt-1 text-destructive/90",children:n.error})]})]})})]}),f.jsxs("div",{className:"ml-4 flex gap-2",children:[T&&f.jsx(ie,{variant:"destructive",size:"sm",onClick:k,disabled:h,children:h?f.jsxs(f.Fragment,{children:[f.jsx(mi,{className:"mr-2 h-4 w-4 animate-spin"}),"Cancelling..."]}):f.jsxs(f.Fragment,{children:[f.jsx(Sl,{className:"mr-2 h-4 w-4"}),"Cancel"]})}),R&&f.jsxs(ie,{variant:"default",size:"sm",onClick:()=>c(!0),children:[f.jsx(Ug,{className:"mr-2 h-4 w-4"}),"Follow Up"]}),_&&f.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>d(!0),disabled:m,children:[f.jsx(Do,{className:"mr-2 h-4 w-4"}),"Delete Worktree"]})]})]})}),(n.status==="running"||n.status==="preparing"||n.status==="pending"||n.status==="paused"||n.status==="completed"||n.status==="failed"||n.status==="cancelled"||n.status==="stopped")&&f.jsx(tZ,{executionId:t,execution:n,onComplete:w,onError:v}),f.jsx(nZ,{open:l,onSubmit:N,onCancel:()=>c(!1)}),f.jsx(rZ,{worktreePath:n.worktree_path,isOpen:u,onClose:()=>d(!1),onConfirm:S,isDeleting:m})]})}function iZ(){const{id:t}=Lg(),e=_r();if(!t)return f.jsx("div",{className:"flex items-center justify-center p-12",children:f.jsxs("div",{className:"text-center",children:[f.jsx("h2",{className:"mb-2 text-2xl font-bold",children:"Invalid Execution"}),f.jsx("p",{className:"mb-4 text-muted-foreground",children:"No execution ID provided."}),f.jsx(ie,{onClick:()=>e("/issues"),children:"Back to Issues"})]})});const n=r=>{e(`/executions/${r}`)};return f.jsxs("div",{className:"flex h-screen flex-col",children:[f.jsx("div",{className:"flex items-center justify-between border-b bg-background p-4",children:f.jsx("div",{className:"flex items-center gap-4",children:f.jsxs(ie,{variant:"ghost",size:"sm",onClick:()=>e(-1),children:[f.jsx(xf,{className:"mr-2 h-4 w-4"}),"Back"]})})}),f.jsx("div",{className:"flex-1 overflow-auto p-6",children:f.jsx(sZ,{executionId:t,onFollowUpCreated:n})})]})}const oZ=new BM({defaultOptions:{queries:{staleTime:3e4,gcTime:36e5,refetchOnWindowFocus:!1,retry:1}}});function aZ(){return f.jsx($M,{client:oZ,children:f.jsx(tR,{children:f.jsx(QM,{children:f.jsx(fM,{children:f.jsx(hM,{children:f.jsxs(ls,{path:"/",element:f.jsx(gD,{}),children:[f.jsx(ls,{index:!0,element:f.jsx(pM,{to:"/issues",replace:!0})}),f.jsx(ls,{path:"issues",element:f.jsx(xJ,{})}),f.jsx(ls,{path:"issues/archived",element:f.jsx(HJ,{})}),f.jsx(ls,{path:"issues/:id",element:f.jsx(vJ,{})}),f.jsx(ls,{path:"specs",element:f.jsx(CJ,{})}),f.jsx(ls,{path:"specs/archived",element:f.jsx(UJ,{})}),f.jsx(ls,{path:"specs/:id",element:f.jsx($J,{})}),f.jsx(ls,{path:"executions/:id",element:f.jsx(iZ,{})})]})})})})})})}bM.createRoot(document.getElementById("root")).render(f.jsx(ft.StrictMode,{children:f.jsx(aZ,{})}));
580
- //# sourceMappingURL=index-B3SEMufD.js.map