agentbox-app 0.1.6

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 (302) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +176 -0
  3. package/bin/agentbox.mjs +103 -0
  4. package/briefs/adhd-mode.md +5 -0
  5. package/briefs/message-rules.md +95 -0
  6. package/briefs/worker.md +230 -0
  7. package/briefs/writing-rules.md +336 -0
  8. package/main/account-discovery.mjs +145 -0
  9. package/main/account-tooling.mjs +261 -0
  10. package/main/agent-activity.mjs +56 -0
  11. package/main/agent-files.mjs +422 -0
  12. package/main/agent-schedule.mjs +254 -0
  13. package/main/agent-sessions.mjs +435 -0
  14. package/main/agents.mjs +1095 -0
  15. package/main/analytics.mjs +206 -0
  16. package/main/answer-modes.mjs +206 -0
  17. package/main/approval-prompt-server.mjs +160 -0
  18. package/main/approvals.mjs +487 -0
  19. package/main/artifact-path.mjs +144 -0
  20. package/main/claude-bin.mjs +311 -0
  21. package/main/claude-input.mjs +117 -0
  22. package/main/claude-models.mjs +244 -0
  23. package/main/claude-plan.mjs +148 -0
  24. package/main/claude-usage.mjs +149 -0
  25. package/main/code-change.mjs +383 -0
  26. package/main/code-file.mjs +116 -0
  27. package/main/codex-account.mjs +146 -0
  28. package/main/codex-app-server.mjs +796 -0
  29. package/main/codex-approvals.mjs +712 -0
  30. package/main/codex-bin.mjs +261 -0
  31. package/main/codex-compaction.mjs +49 -0
  32. package/main/codex-models.mjs +194 -0
  33. package/main/codex-session.mjs +797 -0
  34. package/main/codex-threads.mjs +268 -0
  35. package/main/codex-usage-file.mjs +192 -0
  36. package/main/codex-usage.mjs +149 -0
  37. package/main/codex-watch.mjs +35 -0
  38. package/main/codex.mjs +757 -0
  39. package/main/config.mjs +345 -0
  40. package/main/copy-selection.mjs +55 -0
  41. package/main/crash-report.mjs +158 -0
  42. package/main/demo.mjs +254 -0
  43. package/main/dev-window.mjs +103 -0
  44. package/main/doc-file.mjs +99 -0
  45. package/main/doc-scheme.mjs +126 -0
  46. package/main/first-run.mjs +190 -0
  47. package/main/folders.mjs +91 -0
  48. package/main/fresh-user.mjs +120 -0
  49. package/main/git-change.mjs +323 -0
  50. package/main/img-scheme.mjs +90 -0
  51. package/main/instruction-settings.mjs +205 -0
  52. package/main/ipc.mjs +1558 -0
  53. package/main/live-replies.mjs +77 -0
  54. package/main/machine.mjs +113 -0
  55. package/main/main.mjs +972 -0
  56. package/main/menu.mjs +177 -0
  57. package/main/notify.mjs +155 -0
  58. package/main/open-source-file.mjs +8 -0
  59. package/main/project-identity.mjs +149 -0
  60. package/main/provider-commands.mjs +32 -0
  61. package/main/rail-note.mjs +74 -0
  62. package/main/repeats.mjs +261 -0
  63. package/main/row-label.mjs +185 -0
  64. package/main/screen-detail.mjs +44 -0
  65. package/main/serve.mjs +262 -0
  66. package/main/settings.mjs +912 -0
  67. package/main/staleness.mjs +76 -0
  68. package/main/store/chats.mjs +188 -0
  69. package/main/store/home.mjs +383 -0
  70. package/main/store/migrate.mjs +40 -0
  71. package/main/store/paths.mjs +82 -0
  72. package/main/store/pending-writes.mjs +122 -0
  73. package/main/store/project-lock.mjs +200 -0
  74. package/main/store/project.mjs +523 -0
  75. package/main/store/queues.mjs +31 -0
  76. package/main/store/work-items.mjs +299 -0
  77. package/main/store/write-queue.mjs +14 -0
  78. package/main/store-modules.mjs +23 -0
  79. package/main/store.mjs +1269 -0
  80. package/main/supervisor.mjs +6875 -0
  81. package/main/task-commands.mjs +161 -0
  82. package/main/task-folders-offthread.mjs +84 -0
  83. package/main/task-folders-thread.mjs +13 -0
  84. package/main/task-folders.mjs +409 -0
  85. package/main/task-remote-control.mjs +65 -0
  86. package/main/task-terminals.mjs +169 -0
  87. package/main/terminal-access.mjs +6 -0
  88. package/main/updater.mjs +240 -0
  89. package/main/zoom-keys.mjs +54 -0
  90. package/main/zoom-readout.mjs +20 -0
  91. package/mcp/agentbox-mcp.sh +34 -0
  92. package/mcp/core/account.mjs +77 -0
  93. package/mcp/core/chat.mjs +61 -0
  94. package/mcp/core/documents.mjs +238 -0
  95. package/mcp/core/page.mjs +152 -0
  96. package/mcp/core/products.mjs +110 -0
  97. package/mcp/core/skills.mjs +126 -0
  98. package/mcp/core/work.mjs +377 -0
  99. package/mcp/stdio.mjs +70 -0
  100. package/mcp/tools.mjs +257 -0
  101. package/package.json +186 -0
  102. package/renderer/dist/assets/Geist-Variable-Bj2R_7yk.woff2 +0 -0
  103. package/renderer/dist/assets/GeistMono-Variable-Dispecij.woff2 +0 -0
  104. package/renderer/dist/assets/addon-fit-YJmn1quW.js +12 -0
  105. package/renderer/dist/assets/addon-serialize-CsFQTvP_.js +13 -0
  106. package/renderer/dist/assets/cel-dusk-CS5I7kJS.webp +0 -0
  107. package/renderer/dist/assets/cel-dusk-DUslqS6B.webp +0 -0
  108. package/renderer/dist/assets/cel-dusk-Jt_xVGxp.webp +0 -0
  109. package/renderer/dist/assets/cel-dusk-sm-BBkV-tWT.webp +0 -0
  110. package/renderer/dist/assets/frost-haze-CxPSOBEg.webp +0 -0
  111. package/renderer/dist/assets/frost-haze-sm-C_w21qgd.webp +0 -0
  112. package/renderer/dist/assets/gouache-valley-ChSu14-t.webp +0 -0
  113. package/renderer/dist/assets/gouache-valley-d9qasI6k.webp +0 -0
  114. package/renderer/dist/assets/gouache-valley-sm-CdLjT5Ec.webp +0 -0
  115. package/renderer/dist/assets/ice-BC8luINc.webp +0 -0
  116. package/renderer/dist/assets/ice-CP9PrKHo.webp +0 -0
  117. package/renderer/dist/assets/ice-river-D6ziOhLY.webp +0 -0
  118. package/renderer/dist/assets/ice-river-UVM2-JY_.webp +0 -0
  119. package/renderer/dist/assets/ice-river-bErJwYWW.webp +0 -0
  120. package/renderer/dist/assets/ice-river-sm-Bg1U-SIj.webp +0 -0
  121. package/renderer/dist/assets/ice-sm-CbVcg3_D.webp +0 -0
  122. package/renderer/dist/assets/index-CwiDv5bL.css +32 -0
  123. package/renderer/dist/assets/index-D9hCAVPl.js +684 -0
  124. package/renderer/dist/assets/lake-C0WaW-6E.webp +0 -0
  125. package/renderer/dist/assets/lake-CSKjLC5K.webp +0 -0
  126. package/renderer/dist/assets/lake-ETGcOb25.webp +0 -0
  127. package/renderer/dist/assets/lake-harbour-BCQRbrHb.webp +0 -0
  128. package/renderer/dist/assets/lake-harbour-B_wfXTmE.webp +0 -0
  129. package/renderer/dist/assets/lake-harbour-Te1pEvBh.webp +0 -0
  130. package/renderer/dist/assets/lake-harbour-sm-Cme_ShEg.webp +0 -0
  131. package/renderer/dist/assets/lake-sm-CbG72Hbv.webp +0 -0
  132. package/renderer/dist/assets/lino-coast-CUZHcucI.webp +0 -0
  133. package/renderer/dist/assets/lino-coast-DP4J7cgd.webp +0 -0
  134. package/renderer/dist/assets/lino-coast-kOIAffr_.webp +0 -0
  135. package/renderer/dist/assets/lino-coast-sm-C1Mdbgit.webp +0 -0
  136. package/renderer/dist/assets/moon-pines-BskgnnXR.webp +0 -0
  137. package/renderer/dist/assets/moon-pines-CFSIIwt0.webp +0 -0
  138. package/renderer/dist/assets/moon-pines-PNhdOYww.webp +0 -0
  139. package/renderer/dist/assets/moon-pines-sm-C6K1NomK.webp +0 -0
  140. package/renderer/dist/assets/orbit-rings-2XV36Ch3.webp +0 -0
  141. package/renderer/dist/assets/orbit-rings-C4NrcYGQ.webp +0 -0
  142. package/renderer/dist/assets/orbit-rings-DGLk07dT.webp +0 -0
  143. package/renderer/dist/assets/orbit-rings-sm-Dky3YdvL.webp +0 -0
  144. package/renderer/dist/assets/peach-haze-2-C6f7xnWw.webp +0 -0
  145. package/renderer/dist/assets/peach-haze-2-sm-Dj_Ez_Sb.webp +0 -0
  146. package/renderer/dist/assets/pixel-harbour-DQjqMROg.webp +0 -0
  147. package/renderer/dist/assets/pixel-harbour-Dw71H_bc.webp +0 -0
  148. package/renderer/dist/assets/pixel-harbour-kOZfm-GM.webp +0 -0
  149. package/renderer/dist/assets/pixel-harbour-sm-Dturjuky.webp +0 -0
  150. package/renderer/dist/assets/pixel-orbit-C296JVMO.webp +0 -0
  151. package/renderer/dist/assets/pixel-orbit-C4oMRDSx.webp +0 -0
  152. package/renderer/dist/assets/pixel-orbit-CqVmQ4eh.webp +0 -0
  153. package/renderer/dist/assets/pixel-orbit-sm-CHagC_nO.webp +0 -0
  154. package/renderer/dist/assets/pixel-ridge-C6LYu6uE.webp +0 -0
  155. package/renderer/dist/assets/pixel-ridge-CIUCEESs.webp +0 -0
  156. package/renderer/dist/assets/pixel-ridge-sm-BnE0F_w-.webp +0 -0
  157. package/renderer/dist/assets/riso-hills-7heKVtry.webp +0 -0
  158. package/renderer/dist/assets/riso-hills-CIjAL3J6.webp +0 -0
  159. package/renderer/dist/assets/riso-hills-sm-DHsnbCfP.webp +0 -0
  160. package/renderer/dist/assets/slate-haze-BPWdkNsw.webp +0 -0
  161. package/renderer/dist/assets/slate-haze-sm-B0Cb5a2W.webp +0 -0
  162. package/renderer/dist/assets/source-sans-3-cyrillic-ext-wght-normal-DzyfIafT.woff2 +0 -0
  163. package/renderer/dist/assets/source-sans-3-cyrillic-wght-normal-BMDVbyM7.woff2 +0 -0
  164. package/renderer/dist/assets/source-sans-3-greek-ext-wght-normal-BWSLJLk6.woff2 +0 -0
  165. package/renderer/dist/assets/source-sans-3-greek-wght-normal-C9H9m1vD.woff2 +0 -0
  166. package/renderer/dist/assets/source-sans-3-latin-ext-wght-normal-C8iNium2.woff2 +0 -0
  167. package/renderer/dist/assets/source-sans-3-latin-wght-normal-BqRLTx4X.woff2 +0 -0
  168. package/renderer/dist/assets/source-sans-3-vietnamese-wght-normal-C1uRvKPU.woff2 +0 -0
  169. package/renderer/dist/assets/valley-haze-BDHPqoJy.webp +0 -0
  170. package/renderer/dist/assets/valley-haze-sm-CTyjmPAG.webp +0 -0
  171. package/renderer/dist/assets/vector-dunes-DzzWLdKo.webp +0 -0
  172. package/renderer/dist/assets/vector-dunes-Yr9NBQUy.webp +0 -0
  173. package/renderer/dist/assets/vector-dunes-sm-D8MYY6ms.webp +0 -0
  174. package/renderer/dist/assets/watercolour-mist-BCGKN4u4.webp +0 -0
  175. package/renderer/dist/assets/watercolour-mist-BF-jk5MC.webp +0 -0
  176. package/renderer/dist/assets/watercolour-mist-sm-Ds1xzTw9.webp +0 -0
  177. package/renderer/dist/assets/woodblock-sea-B1um67Z9.webp +0 -0
  178. package/renderer/dist/assets/woodblock-sea-DKQdYs32.webp +0 -0
  179. package/renderer/dist/assets/woodblock-sea-sm-BJzNq8xh.webp +0 -0
  180. package/renderer/dist/assets/xterm-BT7tBf8A.js +27 -0
  181. package/renderer/dist/emulator/audio-rules.mjs +74 -0
  182. package/renderer/dist/emulator/data/compression/README.md +11 -0
  183. package/renderer/dist/emulator/data/compression/extract7z.js +1 -0
  184. package/renderer/dist/emulator/data/compression/extractzip.js +1 -0
  185. package/renderer/dist/emulator/data/compression/libunrar.js +519 -0
  186. package/renderer/dist/emulator/data/compression/libunrar.wasm +0 -0
  187. package/renderer/dist/emulator/data/cores/README.md +22 -0
  188. package/renderer/dist/emulator/data/cores/mgba-legacy-wasm.data +0 -0
  189. package/renderer/dist/emulator/data/cores/mgba-thread-legacy-wasm.data +0 -0
  190. package/renderer/dist/emulator/data/cores/mgba-thread-wasm.data +0 -0
  191. package/renderer/dist/emulator/data/cores/mgba-wasm.data +0 -0
  192. package/renderer/dist/emulator/data/cores/package.json +65 -0
  193. package/renderer/dist/emulator/data/cores/reports/mgba.json +1 -0
  194. package/renderer/dist/emulator/data/emulator.css +1614 -0
  195. package/renderer/dist/emulator/data/loader.js +170 -0
  196. package/renderer/dist/emulator/data/localization/README.md +63 -0
  197. package/renderer/dist/emulator/data/localization/af-FR.json +339 -0
  198. package/renderer/dist/emulator/data/localization/ar-AR.json +301 -0
  199. package/renderer/dist/emulator/data/localization/ben-BEN.json +301 -0
  200. package/renderer/dist/emulator/data/localization/de-GER.json +301 -0
  201. package/renderer/dist/emulator/data/localization/el-GR.json +301 -0
  202. package/renderer/dist/emulator/data/localization/en-US.json +339 -0
  203. package/renderer/dist/emulator/data/localization/es-ES.json +310 -0
  204. package/renderer/dist/emulator/data/localization/fa-AF.json +310 -0
  205. package/renderer/dist/emulator/data/localization/hi-HI.json +301 -0
  206. package/renderer/dist/emulator/data/localization/it-IT.json +302 -0
  207. package/renderer/dist/emulator/data/localization/ja-JA.json +301 -0
  208. package/renderer/dist/emulator/data/localization/jv-JV.json +301 -0
  209. package/renderer/dist/emulator/data/localization/ko-KO.json +336 -0
  210. package/renderer/dist/emulator/data/localization/pt-BR.json +361 -0
  211. package/renderer/dist/emulator/data/localization/retroarch.json +617 -0
  212. package/renderer/dist/emulator/data/localization/ro-RO.json +310 -0
  213. package/renderer/dist/emulator/data/localization/ru-RU.json +301 -0
  214. package/renderer/dist/emulator/data/localization/tr-TR.json +310 -0
  215. package/renderer/dist/emulator/data/localization/vi-VN.json +302 -0
  216. package/renderer/dist/emulator/data/localization/zh-CN.json +351 -0
  217. package/renderer/dist/emulator/data/src/GameManager.js +464 -0
  218. package/renderer/dist/emulator/data/src/compression.js +142 -0
  219. package/renderer/dist/emulator/data/src/emulator.js +6158 -0
  220. package/renderer/dist/emulator/data/src/gamepad.js +167 -0
  221. package/renderer/dist/emulator/data/src/nipplejs.js +1 -0
  222. package/renderer/dist/emulator/data/src/shaders.js +236 -0
  223. package/renderer/dist/emulator/data/src/socket.io.min.js +7 -0
  224. package/renderer/dist/emulator/data/src/storage.js +125 -0
  225. package/renderer/dist/emulator/data/version.json +5 -0
  226. package/renderer/dist/emulator/host.js +299 -0
  227. package/renderer/dist/emulator/index.html +28 -0
  228. package/renderer/dist/emulator/provenance.json +6 -0
  229. package/renderer/dist/fixtures/onboard/designs/w-n13/the-first-row.html +1 -0
  230. package/renderer/dist/index.html +13 -0
  231. package/scripts/after-install.mjs +59 -0
  232. package/scripts/approval-server.sh +43 -0
  233. package/scripts/before-publish.mjs +133 -0
  234. package/shared/agent-import.d.mts +13 -0
  235. package/shared/agent-import.mjs +252 -0
  236. package/shared/agents.d.mts +190 -0
  237. package/shared/agents.mjs +937 -0
  238. package/shared/analytics-events.mjs +63 -0
  239. package/shared/answers.d.mts +12 -0
  240. package/shared/answers.mjs +80 -0
  241. package/shared/artifact-keys.d.mts +28 -0
  242. package/shared/artifact-keys.mjs +140 -0
  243. package/shared/bridge-map.mjs +128 -0
  244. package/shared/claude-commands.d.mts +20 -0
  245. package/shared/claude-commands.generated.mjs +149 -0
  246. package/shared/claude-commands.mjs +131 -0
  247. package/shared/claude-models.generated.d.mts +15 -0
  248. package/shared/claude-models.generated.mjs +26 -0
  249. package/shared/claude-usage.d.mts +16 -0
  250. package/shared/claude-usage.mjs +172 -0
  251. package/shared/codex-commands.d.mts +4 -0
  252. package/shared/codex-commands.mjs +17 -0
  253. package/shared/codex-import.d.mts +38 -0
  254. package/shared/codex-import.mjs +232 -0
  255. package/shared/codex-modes.mjs +159 -0
  256. package/shared/codex-usage.mjs +180 -0
  257. package/shared/contracts.mjs +412 -0
  258. package/shared/crash-scrub.mjs +182 -0
  259. package/shared/dashboard.mjs +481 -0
  260. package/shared/dead-run-trace.mjs +127 -0
  261. package/shared/demo-world.mjs +415 -0
  262. package/shared/effort-levels.d.mts +15 -0
  263. package/shared/effort-levels.mjs +76 -0
  264. package/shared/engines.d.mts +62 -0
  265. package/shared/engines.mjs +389 -0
  266. package/shared/first-run-examples.mjs +60 -0
  267. package/shared/first-run-line.mjs +149 -0
  268. package/shared/first-run-practice.d.mts +32 -0
  269. package/shared/first-run-practice.mjs +254 -0
  270. package/shared/first-run-shape.mjs +100 -0
  271. package/shared/fresh-user-home.mjs +189 -0
  272. package/shared/hook-failure.mjs +22 -0
  273. package/shared/install-id.mjs +39 -0
  274. package/shared/instruction-defaults.json +5 -0
  275. package/shared/library-folder.mjs +28 -0
  276. package/shared/notify-rules.mjs +120 -0
  277. package/shared/product-name.d.mts +6 -0
  278. package/shared/product-name.mjs +144 -0
  279. package/shared/project-folder-check.d.mts +22 -0
  280. package/shared/project-folder-check.mjs +152 -0
  281. package/shared/provider-commands.d.mts +8 -0
  282. package/shared/provider-commands.mjs +58 -0
  283. package/shared/rank.d.mts +19 -0
  284. package/shared/rank.mjs +146 -0
  285. package/shared/recovery.mjs +26 -0
  286. package/shared/referenced-files.d.mts +11 -0
  287. package/shared/referenced-files.mjs +122 -0
  288. package/shared/repeats.d.mts +45 -0
  289. package/shared/repeats.mjs +193 -0
  290. package/shared/schemes.mjs +33 -0
  291. package/shared/settings-terminal.d.mts +1 -0
  292. package/shared/settings-terminal.mjs +14 -0
  293. package/shared/side-build.mjs +57 -0
  294. package/shared/spawn-trouble.d.mts +8 -0
  295. package/shared/spawn-trouble.mjs +599 -0
  296. package/shared/terminal-state.d.mts +1 -0
  297. package/shared/terminal-state.mjs +58 -0
  298. package/shared/usage.d.mts +53 -0
  299. package/shared/usage.mjs +319 -0
  300. package/shared/work-items.mjs +561 -0
  301. package/shared/work-lines.mjs +360 -0
  302. package/worker-permissions.json +6 -0
@@ -0,0 +1,684 @@
1
+ var z2=Object.defineProperty;var _2=(e,t,n)=>t in e?z2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var O1=(e,t,n)=>_2(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();var fh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Kp(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var qA={exports:{}},qp={},YA={exports:{}},et={};/**
2
+ * @license React
3
+ * react.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var td=Symbol.for("react.element"),F2=Symbol.for("react.portal"),B2=Symbol.for("react.fragment"),H2=Symbol.for("react.strict_mode"),W2=Symbol.for("react.profiler"),U2=Symbol.for("react.provider"),V2=Symbol.for("react.context"),K2=Symbol.for("react.forward_ref"),q2=Symbol.for("react.suspense"),Y2=Symbol.for("react.memo"),G2=Symbol.for("react.lazy"),I1=Symbol.iterator;function J2(e){return e===null||typeof e!="object"?null:(e=I1&&e[I1]||e["@@iterator"],typeof e=="function"?e:null)}var GA={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},JA=Object.assign,QA={};function Xa(e,t,n){this.props=e,this.context=t,this.refs=QA,this.updater=n||GA}Xa.prototype.isReactComponent={};Xa.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Xa.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function XA(){}XA.prototype=Xa.prototype;function Wx(e,t,n){this.props=e,this.context=t,this.refs=QA,this.updater=n||GA}var Ux=Wx.prototype=new XA;Ux.constructor=Wx;JA(Ux,Xa.prototype);Ux.isPureReactComponent=!0;var D1=Array.isArray,ZA=Object.prototype.hasOwnProperty,Vx={current:null},ej={key:!0,ref:!0,__self:!0,__source:!0};function tj(e,t,n){var r,s={},o=null,i=null;if(t!=null)for(r in t.ref!==void 0&&(i=t.ref),t.key!==void 0&&(o=""+t.key),t)ZA.call(t,r)&&!ej.hasOwnProperty(r)&&(s[r]=t[r]);var l=arguments.length-2;if(l===1)s.children=n;else if(1<l){for(var a=Array(l),c=0;c<l;c++)a[c]=arguments[c+2];s.children=a}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)s[r]===void 0&&(s[r]=l[r]);return{$$typeof:td,type:e,key:o,ref:i,props:s,_owner:Vx.current}}function Q2(e,t){return{$$typeof:td,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Kx(e){return typeof e=="object"&&e!==null&&e.$$typeof===td}function X2(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var L1=/\/+/g;function bg(e,t){return typeof e=="object"&&e!==null&&e.key!=null?X2(""+e.key):t.toString(36)}function $f(e,t,n,r,s){var o=typeof e;(o==="undefined"||o==="boolean")&&(e=null);var i=!1;if(e===null)i=!0;else switch(o){case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case td:case F2:i=!0}}if(i)return i=e,s=s(i),e=r===""?"."+bg(i,0):r,D1(s)?(n="",e!=null&&(n=e.replace(L1,"$&/")+"/"),$f(s,t,n,"",function(c){return c})):s!=null&&(Kx(s)&&(s=Q2(s,n+(!s.key||i&&i.key===s.key?"":(""+s.key).replace(L1,"$&/")+"/")+e)),t.push(s)),1;if(i=0,r=r===""?".":r+":",D1(e))for(var l=0;l<e.length;l++){o=e[l];var a=r+bg(o,l);i+=$f(o,t,n,a,s)}else if(a=J2(e),typeof a=="function")for(e=a.call(e),l=0;!(o=e.next()).done;)o=o.value,a=r+bg(o,l++),i+=$f(o,t,n,a,s);else if(o==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return i}function $d(e,t,n){if(e==null)return e;var r=[],s=0;return $f(e,r,"","",function(o){return t.call(n,o,s++)}),r}function Z2(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Zn={current:null},zf={transition:null},e$={ReactCurrentDispatcher:Zn,ReactCurrentBatchConfig:zf,ReactCurrentOwner:Vx};function nj(){throw Error("act(...) is not supported in production builds of React.")}et.Children={map:$d,forEach:function(e,t,n){$d(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return $d(e,function(){t++}),t},toArray:function(e){return $d(e,function(t){return t})||[]},only:function(e){if(!Kx(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};et.Component=Xa;et.Fragment=B2;et.Profiler=W2;et.PureComponent=Wx;et.StrictMode=H2;et.Suspense=q2;et.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=e$;et.act=nj;et.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=JA({},e.props),s=e.key,o=e.ref,i=e._owner;if(t!=null){if(t.ref!==void 0&&(o=t.ref,i=Vx.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(a in t)ZA.call(t,a)&&!ej.hasOwnProperty(a)&&(r[a]=t[a]===void 0&&l!==void 0?l[a]:t[a])}var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){l=Array(a);for(var c=0;c<a;c++)l[c]=arguments[c+2];r.children=l}return{$$typeof:td,type:e.type,key:s,ref:o,props:r,_owner:i}};et.createContext=function(e){return e={$$typeof:V2,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:U2,_context:e},e.Consumer=e};et.createElement=tj;et.createFactory=function(e){var t=tj.bind(null,e);return t.type=e,t};et.createRef=function(){return{current:null}};et.forwardRef=function(e){return{$$typeof:K2,render:e}};et.isValidElement=Kx;et.lazy=function(e){return{$$typeof:G2,_payload:{_status:-1,_result:e},_init:Z2}};et.memo=function(e,t){return{$$typeof:Y2,type:e,compare:t===void 0?null:t}};et.startTransition=function(e){var t=zf.transition;zf.transition={};try{e()}finally{zf.transition=t}};et.unstable_act=nj;et.useCallback=function(e,t){return Zn.current.useCallback(e,t)};et.useContext=function(e){return Zn.current.useContext(e)};et.useDebugValue=function(){};et.useDeferredValue=function(e){return Zn.current.useDeferredValue(e)};et.useEffect=function(e,t){return Zn.current.useEffect(e,t)};et.useId=function(){return Zn.current.useId()};et.useImperativeHandle=function(e,t,n){return Zn.current.useImperativeHandle(e,t,n)};et.useInsertionEffect=function(e,t){return Zn.current.useInsertionEffect(e,t)};et.useLayoutEffect=function(e,t){return Zn.current.useLayoutEffect(e,t)};et.useMemo=function(e,t){return Zn.current.useMemo(e,t)};et.useReducer=function(e,t,n){return Zn.current.useReducer(e,t,n)};et.useRef=function(e){return Zn.current.useRef(e)};et.useState=function(e){return Zn.current.useState(e)};et.useSyncExternalStore=function(e,t,n){return Zn.current.useSyncExternalStore(e,t,n)};et.useTransition=function(){return Zn.current.useTransition()};et.version="18.3.1";YA.exports=et;var w=YA.exports;const Dn=Kp(w);/**
10
+ * @license React
11
+ * react-jsx-runtime.production.min.js
12
+ *
13
+ * Copyright (c) Facebook, Inc. and its affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var t$=w,n$=Symbol.for("react.element"),r$=Symbol.for("react.fragment"),s$=Object.prototype.hasOwnProperty,o$=t$.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i$={key:!0,ref:!0,__self:!0,__source:!0};function rj(e,t,n){var r,s={},o=null,i=null;n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(i=t.ref);for(r in t)s$.call(t,r)&&!i$.hasOwnProperty(r)&&(s[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)s[r]===void 0&&(s[r]=t[r]);return{$$typeof:n$,type:e,key:o,ref:i,props:s,_owner:o$.current}}qp.Fragment=r$;qp.jsx=rj;qp.jsxs=rj;qA.exports=qp;var d=qA.exports,kw={},sj={exports:{}},Nr={},oj={exports:{}},ij={};/**
18
+ * @license React
19
+ * scheduler.production.min.js
20
+ *
21
+ * Copyright (c) Facebook, Inc. and its affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */(function(e){function t(B,J){var M=B.length;B.push(J);e:for(;0<M;){var Q=M-1>>>1,ce=B[Q];if(0<s(ce,J))B[Q]=J,B[M]=ce,M=Q;else break e}}function n(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var J=B[0],M=B.pop();if(M!==J){B[0]=M;e:for(var Q=0,ce=B.length,C=ce>>>1;Q<C;){var re=2*(Q+1)-1,W=B[re],V=re+1,Se=B[V];if(0>s(W,M))V<ce&&0>s(Se,W)?(B[Q]=Se,B[V]=M,Q=V):(B[Q]=W,B[re]=M,Q=re);else if(V<ce&&0>s(Se,M))B[Q]=Se,B[V]=M,Q=V;else break e}}return J}function s(B,J){var M=B.sortIndex-J.sortIndex;return M!==0?M:B.id-J.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var i=Date,l=i.now();e.unstable_now=function(){return i.now()-l}}var a=[],c=[],u=1,f=null,h=3,p=!1,m=!1,y=!1,x=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function b(B){for(var J=n(c);J!==null;){if(J.callback===null)r(c);else if(J.startTime<=B)r(c),J.sortIndex=J.expirationTime,t(a,J);else break;J=n(c)}}function E(B){if(y=!1,b(B),!m)if(n(a)!==null)m=!0,I(N);else{var J=n(c);J!==null&&ne(E,J.startTime-B)}}function N(B,J){m=!1,y&&(y=!1,k(R),R=-1),p=!0;var M=h;try{for(b(J),f=n(a);f!==null&&(!(f.expirationTime>J)||B&&!_());){var Q=f.callback;if(typeof Q=="function"){f.callback=null,h=f.priorityLevel;var ce=Q(f.expirationTime<=J);J=e.unstable_now(),typeof ce=="function"?f.callback=ce:f===n(a)&&r(a),b(J)}else r(a);f=n(a)}if(f!==null)var C=!0;else{var re=n(c);re!==null&&ne(E,re.startTime-J),C=!1}return C}finally{f=null,h=M,p=!1}}var T=!1,A=null,R=-1,$=5,L=-1;function _(){return!(e.unstable_now()-L<$)}function j(){if(A!==null){var B=e.unstable_now();L=B;var J=!0;try{J=A(!0,B)}finally{J?F():(T=!1,A=null)}}else T=!1}var F;if(typeof v=="function")F=function(){v(j)};else if(typeof MessageChannel<"u"){var ae=new MessageChannel,G=ae.port2;ae.port1.onmessage=j,F=function(){G.postMessage(null)}}else F=function(){x(j,0)};function I(B){A=B,T||(T=!0,F())}function ne(B,J){R=x(function(){B(e.unstable_now())},J)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(B){B.callback=null},e.unstable_continueExecution=function(){m||p||(m=!0,I(N))},e.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):$=0<B?Math.floor(1e3/B):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(a)},e.unstable_next=function(B){switch(h){case 1:case 2:case 3:var J=3;break;default:J=h}var M=h;h=J;try{return B()}finally{h=M}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(B,J){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var M=h;h=B;try{return J()}finally{h=M}},e.unstable_scheduleCallback=function(B,J,M){var Q=e.unstable_now();switch(typeof M=="object"&&M!==null?(M=M.delay,M=typeof M=="number"&&0<M?Q+M:Q):M=Q,B){case 1:var ce=-1;break;case 2:ce=250;break;case 5:ce=1073741823;break;case 4:ce=1e4;break;default:ce=5e3}return ce=M+ce,B={id:u++,callback:J,priorityLevel:B,startTime:M,expirationTime:ce,sortIndex:-1},M>Q?(B.sortIndex=M,t(c,B),n(a)===null&&B===n(c)&&(y?(k(R),R=-1):y=!0,ne(E,M-Q))):(B.sortIndex=ce,t(a,B),m||p||(m=!0,I(N))),B},e.unstable_shouldYield=_,e.unstable_wrapCallback=function(B){var J=h;return function(){var M=h;h=J;try{return B.apply(this,arguments)}finally{h=M}}}})(ij);oj.exports=ij;var l$=oj.exports;/**
26
+ * @license React
27
+ * react-dom.production.min.js
28
+ *
29
+ * Copyright (c) Facebook, Inc. and its affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var a$=w,Er=l$;function ue(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var lj=new Set,wu={};function Tl(e,t){Oa(e,t),Oa(e+"Capture",t)}function Oa(e,t){for(wu[e]=t,e=0;e<t.length;e++)lj.add(t[e])}var uo=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),xw=Object.prototype.hasOwnProperty,c$=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,P1={},$1={};function u$(e){return xw.call($1,e)?!0:xw.call(P1,e)?!1:c$.test(e)?$1[e]=!0:(P1[e]=!0,!1)}function d$(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function f$(e,t,n,r){if(t===null||typeof t>"u"||d$(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function er(e,t,n,r,s,o,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=i}var vn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){vn[e]=new er(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];vn[t]=new er(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){vn[e]=new er(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){vn[e]=new er(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){vn[e]=new er(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){vn[e]=new er(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){vn[e]=new er(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){vn[e]=new er(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){vn[e]=new er(e,5,!1,e.toLowerCase(),null,!1,!1)});var qx=/[\-:]([a-z])/g;function Yx(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(qx,Yx);vn[t]=new er(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(qx,Yx);vn[t]=new er(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(qx,Yx);vn[t]=new er(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){vn[e]=new er(e,1,!1,e.toLowerCase(),null,!1,!1)});vn.xlinkHref=new er("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){vn[e]=new er(e,1,!1,e.toLowerCase(),null,!0,!0)});function Gx(e,t,n,r){var s=vn.hasOwnProperty(t)?vn[t]:null;(s!==null?s.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(f$(t,n,s,r)&&(n=null),r||s===null?u$(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):s.mustUseProperty?e[s.propertyName]=n===null?s.type===3?!1:"":n:(t=s.attributeName,r=s.attributeNamespace,n===null?e.removeAttribute(t):(s=s.type,n=s===3||s===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var yo=a$.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,zd=Symbol.for("react.element"),sa=Symbol.for("react.portal"),oa=Symbol.for("react.fragment"),Jx=Symbol.for("react.strict_mode"),bw=Symbol.for("react.profiler"),aj=Symbol.for("react.provider"),cj=Symbol.for("react.context"),Qx=Symbol.for("react.forward_ref"),vw=Symbol.for("react.suspense"),Sw=Symbol.for("react.suspense_list"),Xx=Symbol.for("react.memo"),Po=Symbol.for("react.lazy"),uj=Symbol.for("react.offscreen"),z1=Symbol.iterator;function hc(e){return e===null||typeof e!="object"?null:(e=z1&&e[z1]||e["@@iterator"],typeof e=="function"?e:null)}var Dt=Object.assign,vg;function jc(e){if(vg===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);vg=t&&t[1]||""}return`
34
+ `+vg+e}var Sg=!1;function Cg(e,t){if(!e||Sg)return"";Sg=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(c){var r=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){r=c}e.call(t.prototype)}else{try{throw Error()}catch(c){r=c}e()}}catch(c){if(c&&r&&typeof c.stack=="string"){for(var s=c.stack.split(`
35
+ `),o=r.stack.split(`
36
+ `),i=s.length-1,l=o.length-1;1<=i&&0<=l&&s[i]!==o[l];)l--;for(;1<=i&&0<=l;i--,l--)if(s[i]!==o[l]){if(i!==1||l!==1)do if(i--,l--,0>l||s[i]!==o[l]){var a=`
37
+ `+s[i].replace(" at new "," at ");return e.displayName&&a.includes("<anonymous>")&&(a=a.replace("<anonymous>",e.displayName)),a}while(1<=i&&0<=l);break}}}finally{Sg=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?jc(e):""}function h$(e){switch(e.tag){case 5:return jc(e.type);case 16:return jc("Lazy");case 13:return jc("Suspense");case 19:return jc("SuspenseList");case 0:case 2:case 15:return e=Cg(e.type,!1),e;case 11:return e=Cg(e.type.render,!1),e;case 1:return e=Cg(e.type,!0),e;default:return""}}function Cw(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case oa:return"Fragment";case sa:return"Portal";case bw:return"Profiler";case Jx:return"StrictMode";case vw:return"Suspense";case Sw:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case cj:return(e.displayName||"Context")+".Consumer";case aj:return(e._context.displayName||"Context")+".Provider";case Qx:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Xx:return t=e.displayName||null,t!==null?t:Cw(e.type)||"Memo";case Po:t=e._payload,e=e._init;try{return Cw(e(t))}catch{}}return null}function p$(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Cw(t);case 8:return t===Jx?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function fi(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function dj(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function m$(e){var t=dj(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(i){r=""+i,o.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(i){r=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function _d(e){e._valueTracker||(e._valueTracker=m$(e))}function fj(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=dj(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function hh(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Ew(e,t){var n=t.checked;return Dt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function _1(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=fi(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function hj(e,t){t=t.checked,t!=null&&Gx(e,"checked",t,!1)}function Nw(e,t){hj(e,t);var n=fi(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Tw(e,t.type,n):t.hasOwnProperty("defaultValue")&&Tw(e,t.type,fi(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function F1(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Tw(e,t,n){(t!=="number"||hh(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Mc=Array.isArray;function va(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s<n.length;s++)t["$"+n[s]]=!0;for(n=0;n<e.length;n++)s=t.hasOwnProperty("$"+e[n].value),e[n].selected!==s&&(e[n].selected=s),s&&r&&(e[n].defaultSelected=!0)}else{for(n=""+fi(n),t=null,s=0;s<e.length;s++){if(e[s].value===n){e[s].selected=!0,r&&(e[s].defaultSelected=!0);return}t!==null||e[s].disabled||(t=e[s])}t!==null&&(t.selected=!0)}}function Aw(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(ue(91));return Dt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function B1(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(ue(92));if(Mc(n)){if(1<n.length)throw Error(ue(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:fi(n)}}function pj(e,t){var n=fi(t.value),r=fi(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function H1(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function mj(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function jw(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?mj(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Fd,gj=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,s){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,s)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Fd=Fd||document.createElement("div"),Fd.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Fd.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ku(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Wc={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},g$=["Webkit","ms","Moz","O"];Object.keys(Wc).forEach(function(e){g$.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Wc[t]=Wc[e]})});function yj(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Wc.hasOwnProperty(e)&&Wc[e]?(""+t).trim():t+"px"}function wj(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=yj(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var y$=Dt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Mw(e,t){if(t){if(y$[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(ue(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(ue(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(ue(61))}if(t.style!=null&&typeof t.style!="object")throw Error(ue(62))}}function Rw(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ow=null;function Zx(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Iw=null,Sa=null,Ca=null;function W1(e){if(e=sd(e)){if(typeof Iw!="function")throw Error(ue(280));var t=e.stateNode;t&&(t=Xp(t),Iw(e.stateNode,e.type,t))}}function kj(e){Sa?Ca?Ca.push(e):Ca=[e]:Sa=e}function xj(){if(Sa){var e=Sa,t=Ca;if(Ca=Sa=null,W1(e),t)for(e=0;e<t.length;e++)W1(t[e])}}function bj(e,t){return e(t)}function vj(){}var Eg=!1;function Sj(e,t,n){if(Eg)return e(t,n);Eg=!0;try{return bj(e,t,n)}finally{Eg=!1,(Sa!==null||Ca!==null)&&(vj(),xj())}}function xu(e,t){var n=e.stateNode;if(n===null)return null;var r=Xp(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(ue(231,t,typeof n));return n}var Dw=!1;if(uo)try{var pc={};Object.defineProperty(pc,"passive",{get:function(){Dw=!0}}),window.addEventListener("test",pc,pc),window.removeEventListener("test",pc,pc)}catch{Dw=!1}function w$(e,t,n,r,s,o,i,l,a){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(u){this.onError(u)}}var Uc=!1,ph=null,mh=!1,Lw=null,k$={onError:function(e){Uc=!0,ph=e}};function x$(e,t,n,r,s,o,i,l,a){Uc=!1,ph=null,w$.apply(k$,arguments)}function b$(e,t,n,r,s,o,i,l,a){if(x$.apply(this,arguments),Uc){if(Uc){var c=ph;Uc=!1,ph=null}else throw Error(ue(198));mh||(mh=!0,Lw=c)}}function Al(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function Cj(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function U1(e){if(Al(e)!==e)throw Error(ue(188))}function v$(e){var t=e.alternate;if(!t){if(t=Al(e),t===null)throw Error(ue(188));return t!==e?null:e}for(var n=e,r=t;;){var s=n.return;if(s===null)break;var o=s.alternate;if(o===null){if(r=s.return,r!==null){n=r;continue}break}if(s.child===o.child){for(o=s.child;o;){if(o===n)return U1(s),e;if(o===r)return U1(s),t;o=o.sibling}throw Error(ue(188))}if(n.return!==r.return)n=s,r=o;else{for(var i=!1,l=s.child;l;){if(l===n){i=!0,n=s,r=o;break}if(l===r){i=!0,r=s,n=o;break}l=l.sibling}if(!i){for(l=o.child;l;){if(l===n){i=!0,n=o,r=s;break}if(l===r){i=!0,r=o,n=s;break}l=l.sibling}if(!i)throw Error(ue(189))}}if(n.alternate!==r)throw Error(ue(190))}if(n.tag!==3)throw Error(ue(188));return n.stateNode.current===n?e:t}function Ej(e){return e=v$(e),e!==null?Nj(e):null}function Nj(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Nj(e);if(t!==null)return t;e=e.sibling}return null}var Tj=Er.unstable_scheduleCallback,V1=Er.unstable_cancelCallback,S$=Er.unstable_shouldYield,C$=Er.unstable_requestPaint,Wt=Er.unstable_now,E$=Er.unstable_getCurrentPriorityLevel,e0=Er.unstable_ImmediatePriority,Aj=Er.unstable_UserBlockingPriority,gh=Er.unstable_NormalPriority,N$=Er.unstable_LowPriority,jj=Er.unstable_IdlePriority,Yp=null,js=null;function T$(e){if(js&&typeof js.onCommitFiberRoot=="function")try{js.onCommitFiberRoot(Yp,e,void 0,(e.current.flags&128)===128)}catch{}}var rs=Math.clz32?Math.clz32:M$,A$=Math.log,j$=Math.LN2;function M$(e){return e>>>=0,e===0?32:31-(A$(e)/j$|0)|0}var Bd=64,Hd=4194304;function Rc(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function yh(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,o=e.pingedLanes,i=n&268435455;if(i!==0){var l=i&~s;l!==0?r=Rc(l):(o&=i,o!==0&&(r=Rc(o)))}else i=n&~s,i!==0?r=Rc(i):o!==0&&(r=Rc(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,o=t&-t,s>=o||s===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-rs(t),s=1<<n,r|=e[n],t&=~s;return r}function R$(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function O$(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,o=e.pendingLanes;0<o;){var i=31-rs(o),l=1<<i,a=s[i];a===-1?(!(l&n)||l&r)&&(s[i]=R$(l,t)):a<=t&&(e.expiredLanes|=l),o&=~l}}function Pw(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Mj(){var e=Bd;return Bd<<=1,!(Bd&4194240)&&(Bd=64),e}function Ng(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function nd(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-rs(t),e[t]=n}function I$(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var s=31-rs(n),o=1<<s;t[s]=0,r[s]=-1,e[s]=-1,n&=~o}}function t0(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-rs(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}var pt=0;function Rj(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Oj,n0,Ij,Dj,Lj,$w=!1,Wd=[],Xo=null,Zo=null,ei=null,bu=new Map,vu=new Map,Bo=[],D$="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function K1(e,t){switch(e){case"focusin":case"focusout":Xo=null;break;case"dragenter":case"dragleave":Zo=null;break;case"mouseover":case"mouseout":ei=null;break;case"pointerover":case"pointerout":bu.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":vu.delete(t.pointerId)}}function mc(e,t,n,r,s,o){return e===null||e.nativeEvent!==o?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:o,targetContainers:[s]},t!==null&&(t=sd(t),t!==null&&n0(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function L$(e,t,n,r,s){switch(t){case"focusin":return Xo=mc(Xo,e,t,n,r,s),!0;case"dragenter":return Zo=mc(Zo,e,t,n,r,s),!0;case"mouseover":return ei=mc(ei,e,t,n,r,s),!0;case"pointerover":var o=s.pointerId;return bu.set(o,mc(bu.get(o)||null,e,t,n,r,s)),!0;case"gotpointercapture":return o=s.pointerId,vu.set(o,mc(vu.get(o)||null,e,t,n,r,s)),!0}return!1}function Pj(e){var t=Ui(e.target);if(t!==null){var n=Al(t);if(n!==null){if(t=n.tag,t===13){if(t=Cj(n),t!==null){e.blockedOn=t,Lj(e.priority,function(){Ij(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function _f(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=zw(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Ow=r,n.target.dispatchEvent(r),Ow=null}else return t=sd(n),t!==null&&n0(t),e.blockedOn=n,!1;t.shift()}return!0}function q1(e,t,n){_f(e)&&n.delete(t)}function P$(){$w=!1,Xo!==null&&_f(Xo)&&(Xo=null),Zo!==null&&_f(Zo)&&(Zo=null),ei!==null&&_f(ei)&&(ei=null),bu.forEach(q1),vu.forEach(q1)}function gc(e,t){e.blockedOn===t&&(e.blockedOn=null,$w||($w=!0,Er.unstable_scheduleCallback(Er.unstable_NormalPriority,P$)))}function Su(e){function t(s){return gc(s,e)}if(0<Wd.length){gc(Wd[0],e);for(var n=1;n<Wd.length;n++){var r=Wd[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Xo!==null&&gc(Xo,e),Zo!==null&&gc(Zo,e),ei!==null&&gc(ei,e),bu.forEach(t),vu.forEach(t),n=0;n<Bo.length;n++)r=Bo[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Bo.length&&(n=Bo[0],n.blockedOn===null);)Pj(n),n.blockedOn===null&&Bo.shift()}var Ea=yo.ReactCurrentBatchConfig,wh=!0;function $$(e,t,n,r){var s=pt,o=Ea.transition;Ea.transition=null;try{pt=1,r0(e,t,n,r)}finally{pt=s,Ea.transition=o}}function z$(e,t,n,r){var s=pt,o=Ea.transition;Ea.transition=null;try{pt=4,r0(e,t,n,r)}finally{pt=s,Ea.transition=o}}function r0(e,t,n,r){if(wh){var s=zw(e,t,n,r);if(s===null)Pg(e,t,r,kh,n),K1(e,r);else if(L$(s,e,t,n,r))r.stopPropagation();else if(K1(e,r),t&4&&-1<D$.indexOf(e)){for(;s!==null;){var o=sd(s);if(o!==null&&Oj(o),o=zw(e,t,n,r),o===null&&Pg(e,t,r,kh,n),o===s)break;s=o}s!==null&&r.stopPropagation()}else Pg(e,t,r,null,n)}}var kh=null;function zw(e,t,n,r){if(kh=null,e=Zx(r),e=Ui(e),e!==null)if(t=Al(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Cj(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return kh=e,null}function $j(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(E$()){case e0:return 1;case Aj:return 4;case gh:case N$:return 16;case jj:return 536870912;default:return 16}default:return 16}}var Ko=null,s0=null,Ff=null;function zj(){if(Ff)return Ff;var e,t=s0,n=t.length,r,s="value"in Ko?Ko.value:Ko.textContent,o=s.length;for(e=0;e<n&&t[e]===s[e];e++);var i=n-e;for(r=1;r<=i&&t[n-r]===s[o-r];r++);return Ff=s.slice(e,1<r?1-r:void 0)}function Bf(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Ud(){return!0}function Y1(){return!1}function Tr(e){function t(n,r,s,o,i){this._reactName=n,this._targetInst=s,this.type=r,this.nativeEvent=o,this.target=i,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(o):o[l]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?Ud:Y1,this.isPropagationStopped=Y1,this}return Dt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Ud)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Ud)},persist:function(){},isPersistent:Ud}),t}var Za={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},o0=Tr(Za),rd=Dt({},Za,{view:0,detail:0}),_$=Tr(rd),Tg,Ag,yc,Gp=Dt({},rd,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:i0,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==yc&&(yc&&e.type==="mousemove"?(Tg=e.screenX-yc.screenX,Ag=e.screenY-yc.screenY):Ag=Tg=0,yc=e),Tg)},movementY:function(e){return"movementY"in e?e.movementY:Ag}}),G1=Tr(Gp),F$=Dt({},Gp,{dataTransfer:0}),B$=Tr(F$),H$=Dt({},rd,{relatedTarget:0}),jg=Tr(H$),W$=Dt({},Za,{animationName:0,elapsedTime:0,pseudoElement:0}),U$=Tr(W$),V$=Dt({},Za,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),K$=Tr(V$),q$=Dt({},Za,{data:0}),J1=Tr(q$),Y$={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},G$={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},J$={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Q$(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=J$[e])?!!t[e]:!1}function i0(){return Q$}var X$=Dt({},rd,{key:function(e){if(e.key){var t=Y$[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Bf(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?G$[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:i0,charCode:function(e){return e.type==="keypress"?Bf(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Bf(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Z$=Tr(X$),ez=Dt({},Gp,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Q1=Tr(ez),tz=Dt({},rd,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:i0}),nz=Tr(tz),rz=Dt({},Za,{propertyName:0,elapsedTime:0,pseudoElement:0}),sz=Tr(rz),oz=Dt({},Gp,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),iz=Tr(oz),lz=[9,13,27,32],l0=uo&&"CompositionEvent"in window,Vc=null;uo&&"documentMode"in document&&(Vc=document.documentMode);var az=uo&&"TextEvent"in window&&!Vc,_j=uo&&(!l0||Vc&&8<Vc&&11>=Vc),X1=" ",Z1=!1;function Fj(e,t){switch(e){case"keyup":return lz.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Bj(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ia=!1;function cz(e,t){switch(e){case"compositionend":return Bj(t);case"keypress":return t.which!==32?null:(Z1=!0,X1);case"textInput":return e=t.data,e===X1&&Z1?null:e;default:return null}}function uz(e,t){if(ia)return e==="compositionend"||!l0&&Fj(e,t)?(e=zj(),Ff=s0=Ko=null,ia=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return _j&&t.locale!=="ko"?null:t.data;default:return null}}var dz={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function eS(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!dz[e.type]:t==="textarea"}function Hj(e,t,n,r){kj(r),t=xh(t,"onChange"),0<t.length&&(n=new o0("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Kc=null,Cu=null;function fz(e){Zj(e,0)}function Jp(e){var t=ca(e);if(fj(t))return e}function hz(e,t){if(e==="change")return t}var Wj=!1;if(uo){var Mg;if(uo){var Rg="oninput"in document;if(!Rg){var tS=document.createElement("div");tS.setAttribute("oninput","return;"),Rg=typeof tS.oninput=="function"}Mg=Rg}else Mg=!1;Wj=Mg&&(!document.documentMode||9<document.documentMode)}function nS(){Kc&&(Kc.detachEvent("onpropertychange",Uj),Cu=Kc=null)}function Uj(e){if(e.propertyName==="value"&&Jp(Cu)){var t=[];Hj(t,Cu,e,Zx(e)),Sj(fz,t)}}function pz(e,t,n){e==="focusin"?(nS(),Kc=t,Cu=n,Kc.attachEvent("onpropertychange",Uj)):e==="focusout"&&nS()}function mz(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Jp(Cu)}function gz(e,t){if(e==="click")return Jp(t)}function yz(e,t){if(e==="input"||e==="change")return Jp(t)}function wz(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var cs=typeof Object.is=="function"?Object.is:wz;function Eu(e,t){if(cs(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var s=n[r];if(!xw.call(t,s)||!cs(e[s],t[s]))return!1}return!0}function rS(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function sS(e,t){var n=rS(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=rS(n)}}function Vj(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Vj(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Kj(){for(var e=window,t=hh();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=hh(e.document)}return t}function a0(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function kz(e){var t=Kj(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Vj(n.ownerDocument.documentElement,n)){if(r!==null&&a0(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,o=Math.min(r.start,s);r=r.end===void 0?o:Math.min(r.end,s),!e.extend&&o>r&&(s=r,r=o,o=s),s=sS(n,o);var i=sS(n,r);s&&i&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var xz=uo&&"documentMode"in document&&11>=document.documentMode,la=null,_w=null,qc=null,Fw=!1;function oS(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Fw||la==null||la!==hh(r)||(r=la,"selectionStart"in r&&a0(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),qc&&Eu(qc,r)||(qc=r,r=xh(_w,"onSelect"),0<r.length&&(t=new o0("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=la)))}function Vd(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var aa={animationend:Vd("Animation","AnimationEnd"),animationiteration:Vd("Animation","AnimationIteration"),animationstart:Vd("Animation","AnimationStart"),transitionend:Vd("Transition","TransitionEnd")},Og={},qj={};uo&&(qj=document.createElement("div").style,"AnimationEvent"in window||(delete aa.animationend.animation,delete aa.animationiteration.animation,delete aa.animationstart.animation),"TransitionEvent"in window||delete aa.transitionend.transition);function Qp(e){if(Og[e])return Og[e];if(!aa[e])return e;var t=aa[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in qj)return Og[e]=t[n];return e}var Yj=Qp("animationend"),Gj=Qp("animationiteration"),Jj=Qp("animationstart"),Qj=Qp("transitionend"),Xj=new Map,iS="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function gi(e,t){Xj.set(e,t),Tl(t,[e])}for(var Ig=0;Ig<iS.length;Ig++){var Dg=iS[Ig],bz=Dg.toLowerCase(),vz=Dg[0].toUpperCase()+Dg.slice(1);gi(bz,"on"+vz)}gi(Yj,"onAnimationEnd");gi(Gj,"onAnimationIteration");gi(Jj,"onAnimationStart");gi("dblclick","onDoubleClick");gi("focusin","onFocus");gi("focusout","onBlur");gi(Qj,"onTransitionEnd");Oa("onMouseEnter",["mouseout","mouseover"]);Oa("onMouseLeave",["mouseout","mouseover"]);Oa("onPointerEnter",["pointerout","pointerover"]);Oa("onPointerLeave",["pointerout","pointerover"]);Tl("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Tl("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Tl("onBeforeInput",["compositionend","keypress","textInput","paste"]);Tl("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Tl("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Tl("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Oc="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Sz=new Set("cancel close invalid load scroll toggle".split(" ").concat(Oc));function lS(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,b$(r,t,void 0,e),e.currentTarget=null}function Zj(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],s=r.event;r=r.listeners;e:{var o=void 0;if(t)for(var i=r.length-1;0<=i;i--){var l=r[i],a=l.instance,c=l.currentTarget;if(l=l.listener,a!==o&&s.isPropagationStopped())break e;lS(s,l,c),o=a}else for(i=0;i<r.length;i++){if(l=r[i],a=l.instance,c=l.currentTarget,l=l.listener,a!==o&&s.isPropagationStopped())break e;lS(s,l,c),o=a}}}if(mh)throw e=Lw,mh=!1,Lw=null,e}function Et(e,t){var n=t[Vw];n===void 0&&(n=t[Vw]=new Set);var r=e+"__bubble";n.has(r)||(eM(t,e,2,!1),n.add(r))}function Lg(e,t,n){var r=0;t&&(r|=4),eM(n,e,r,t)}var Kd="_reactListening"+Math.random().toString(36).slice(2);function Nu(e){if(!e[Kd]){e[Kd]=!0,lj.forEach(function(n){n!=="selectionchange"&&(Sz.has(n)||Lg(n,!1,e),Lg(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Kd]||(t[Kd]=!0,Lg("selectionchange",!1,t))}}function eM(e,t,n,r){switch($j(t)){case 1:var s=$$;break;case 4:s=z$;break;default:s=r0}n=s.bind(null,t,n,e),s=void 0,!Dw||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),r?s!==void 0?e.addEventListener(t,n,{capture:!0,passive:s}):e.addEventListener(t,n,!0):s!==void 0?e.addEventListener(t,n,{passive:s}):e.addEventListener(t,n,!1)}function Pg(e,t,n,r,s){var o=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var i=r.tag;if(i===3||i===4){var l=r.stateNode.containerInfo;if(l===s||l.nodeType===8&&l.parentNode===s)break;if(i===4)for(i=r.return;i!==null;){var a=i.tag;if((a===3||a===4)&&(a=i.stateNode.containerInfo,a===s||a.nodeType===8&&a.parentNode===s))return;i=i.return}for(;l!==null;){if(i=Ui(l),i===null)return;if(a=i.tag,a===5||a===6){r=o=i;continue e}l=l.parentNode}}r=r.return}Sj(function(){var c=o,u=Zx(n),f=[];e:{var h=Xj.get(e);if(h!==void 0){var p=o0,m=e;switch(e){case"keypress":if(Bf(n)===0)break e;case"keydown":case"keyup":p=Z$;break;case"focusin":m="focus",p=jg;break;case"focusout":m="blur",p=jg;break;case"beforeblur":case"afterblur":p=jg;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=G1;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=B$;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=nz;break;case Yj:case Gj:case Jj:p=U$;break;case Qj:p=sz;break;case"scroll":p=_$;break;case"wheel":p=iz;break;case"copy":case"cut":case"paste":p=K$;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=Q1}var y=(t&4)!==0,x=!y&&e==="scroll",k=y?h!==null?h+"Capture":null:h;y=[];for(var v=c,b;v!==null;){b=v;var E=b.stateNode;if(b.tag===5&&E!==null&&(b=E,k!==null&&(E=xu(v,k),E!=null&&y.push(Tu(v,E,b)))),x)break;v=v.return}0<y.length&&(h=new p(h,m,null,n,u),f.push({event:h,listeners:y}))}}if(!(t&7)){e:{if(h=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",h&&n!==Ow&&(m=n.relatedTarget||n.fromElement)&&(Ui(m)||m[fo]))break e;if((p||h)&&(h=u.window===u?u:(h=u.ownerDocument)?h.defaultView||h.parentWindow:window,p?(m=n.relatedTarget||n.toElement,p=c,m=m?Ui(m):null,m!==null&&(x=Al(m),m!==x||m.tag!==5&&m.tag!==6)&&(m=null)):(p=null,m=c),p!==m)){if(y=G1,E="onMouseLeave",k="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(y=Q1,E="onPointerLeave",k="onPointerEnter",v="pointer"),x=p==null?h:ca(p),b=m==null?h:ca(m),h=new y(E,v+"leave",p,n,u),h.target=x,h.relatedTarget=b,E=null,Ui(u)===c&&(y=new y(k,v+"enter",m,n,u),y.target=b,y.relatedTarget=x,E=y),x=E,p&&m)t:{for(y=p,k=m,v=0,b=y;b;b=ql(b))v++;for(b=0,E=k;E;E=ql(E))b++;for(;0<v-b;)y=ql(y),v--;for(;0<b-v;)k=ql(k),b--;for(;v--;){if(y===k||k!==null&&y===k.alternate)break t;y=ql(y),k=ql(k)}y=null}else y=null;p!==null&&aS(f,h,p,y,!1),m!==null&&x!==null&&aS(f,x,m,y,!0)}}e:{if(h=c?ca(c):window,p=h.nodeName&&h.nodeName.toLowerCase(),p==="select"||p==="input"&&h.type==="file")var N=hz;else if(eS(h))if(Wj)N=yz;else{N=mz;var T=pz}else(p=h.nodeName)&&p.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(N=gz);if(N&&(N=N(e,c))){Hj(f,N,n,u);break e}T&&T(e,h,c),e==="focusout"&&(T=h._wrapperState)&&T.controlled&&h.type==="number"&&Tw(h,"number",h.value)}switch(T=c?ca(c):window,e){case"focusin":(eS(T)||T.contentEditable==="true")&&(la=T,_w=c,qc=null);break;case"focusout":qc=_w=la=null;break;case"mousedown":Fw=!0;break;case"contextmenu":case"mouseup":case"dragend":Fw=!1,oS(f,n,u);break;case"selectionchange":if(xz)break;case"keydown":case"keyup":oS(f,n,u)}var A;if(l0)e:{switch(e){case"compositionstart":var R="onCompositionStart";break e;case"compositionend":R="onCompositionEnd";break e;case"compositionupdate":R="onCompositionUpdate";break e}R=void 0}else ia?Fj(e,n)&&(R="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(R="onCompositionStart");R&&(_j&&n.locale!=="ko"&&(ia||R!=="onCompositionStart"?R==="onCompositionEnd"&&ia&&(A=zj()):(Ko=u,s0="value"in Ko?Ko.value:Ko.textContent,ia=!0)),T=xh(c,R),0<T.length&&(R=new J1(R,e,null,n,u),f.push({event:R,listeners:T}),A?R.data=A:(A=Bj(n),A!==null&&(R.data=A)))),(A=az?cz(e,n):uz(e,n))&&(c=xh(c,"onBeforeInput"),0<c.length&&(u=new J1("onBeforeInput","beforeinput",null,n,u),f.push({event:u,listeners:c}),u.data=A))}Zj(f,t)})}function Tu(e,t,n){return{instance:e,listener:t,currentTarget:n}}function xh(e,t){for(var n=t+"Capture",r=[];e!==null;){var s=e,o=s.stateNode;s.tag===5&&o!==null&&(s=o,o=xu(e,n),o!=null&&r.unshift(Tu(e,o,s)),o=xu(e,t),o!=null&&r.push(Tu(e,o,s))),e=e.return}return r}function ql(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function aS(e,t,n,r,s){for(var o=t._reactName,i=[];n!==null&&n!==r;){var l=n,a=l.alternate,c=l.stateNode;if(a!==null&&a===r)break;l.tag===5&&c!==null&&(l=c,s?(a=xu(n,o),a!=null&&i.unshift(Tu(n,a,l))):s||(a=xu(n,o),a!=null&&i.push(Tu(n,a,l)))),n=n.return}i.length!==0&&e.push({event:t,listeners:i})}var Cz=/\r\n?/g,Ez=/\u0000|\uFFFD/g;function cS(e){return(typeof e=="string"?e:""+e).replace(Cz,`
38
+ `).replace(Ez,"")}function qd(e,t,n){if(t=cS(t),cS(e)!==t&&n)throw Error(ue(425))}function bh(){}var Bw=null,Hw=null;function Ww(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Uw=typeof setTimeout=="function"?setTimeout:void 0,Nz=typeof clearTimeout=="function"?clearTimeout:void 0,uS=typeof Promise=="function"?Promise:void 0,Tz=typeof queueMicrotask=="function"?queueMicrotask:typeof uS<"u"?function(e){return uS.resolve(null).then(e).catch(Az)}:Uw;function Az(e){setTimeout(function(){throw e})}function $g(e,t){var n=t,r=0;do{var s=n.nextSibling;if(e.removeChild(n),s&&s.nodeType===8)if(n=s.data,n==="/$"){if(r===0){e.removeChild(s),Su(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);Su(t)}function ti(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function dS(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var ec=Math.random().toString(36).slice(2),Ts="__reactFiber$"+ec,Au="__reactProps$"+ec,fo="__reactContainer$"+ec,Vw="__reactEvents$"+ec,jz="__reactListeners$"+ec,Mz="__reactHandles$"+ec;function Ui(e){var t=e[Ts];if(t)return t;for(var n=e.parentNode;n;){if(t=n[fo]||n[Ts]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=dS(e);e!==null;){if(n=e[Ts])return n;e=dS(e)}return t}e=n,n=e.parentNode}return null}function sd(e){return e=e[Ts]||e[fo],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function ca(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(ue(33))}function Xp(e){return e[Au]||null}var Kw=[],ua=-1;function yi(e){return{current:e}}function Tt(e){0>ua||(e.current=Kw[ua],Kw[ua]=null,ua--)}function vt(e,t){ua++,Kw[ua]=e.current,e.current=t}var hi={},_n=yi(hi),lr=yi(!1),hl=hi;function Ia(e,t){var n=e.type.contextTypes;if(!n)return hi;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},o;for(o in n)s[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function ar(e){return e=e.childContextTypes,e!=null}function vh(){Tt(lr),Tt(_n)}function fS(e,t,n){if(_n.current!==hi)throw Error(ue(168));vt(_n,t),vt(lr,n)}function tM(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(ue(108,p$(e)||"Unknown",s));return Dt({},n,r)}function Sh(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||hi,hl=_n.current,vt(_n,e),vt(lr,lr.current),!0}function hS(e,t,n){var r=e.stateNode;if(!r)throw Error(ue(169));n?(e=tM(e,t,hl),r.__reactInternalMemoizedMergedChildContext=e,Tt(lr),Tt(_n),vt(_n,e)):Tt(lr),vt(lr,n)}var Zs=null,Zp=!1,zg=!1;function nM(e){Zs===null?Zs=[e]:Zs.push(e)}function Rz(e){Zp=!0,nM(e)}function wi(){if(!zg&&Zs!==null){zg=!0;var e=0,t=pt;try{var n=Zs;for(pt=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Zs=null,Zp=!1}catch(s){throw Zs!==null&&(Zs=Zs.slice(e+1)),Tj(e0,wi),s}finally{pt=t,zg=!1}}return null}var da=[],fa=0,Ch=null,Eh=0,Ir=[],Dr=0,pl=null,ro=1,so="";function $i(e,t){da[fa++]=Eh,da[fa++]=Ch,Ch=e,Eh=t}function rM(e,t,n){Ir[Dr++]=ro,Ir[Dr++]=so,Ir[Dr++]=pl,pl=e;var r=ro;e=so;var s=32-rs(r)-1;r&=~(1<<s),n+=1;var o=32-rs(t)+s;if(30<o){var i=s-s%5;o=(r&(1<<i)-1).toString(32),r>>=i,s-=i,ro=1<<32-rs(t)+s|n<<s|r,so=o+e}else ro=1<<o|n<<s|r,so=e}function c0(e){e.return!==null&&($i(e,1),rM(e,1,0))}function u0(e){for(;e===Ch;)Ch=da[--fa],da[fa]=null,Eh=da[--fa],da[fa]=null;for(;e===pl;)pl=Ir[--Dr],Ir[Dr]=null,so=Ir[--Dr],Ir[Dr]=null,ro=Ir[--Dr],Ir[Dr]=null}var vr=null,br=null,Mt=!1,Zr=null;function sM(e,t){var n=_r(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function pS(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,vr=e,br=ti(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,vr=e,br=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=pl!==null?{id:ro,overflow:so}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=_r(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,vr=e,br=null,!0):!1;default:return!1}}function qw(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Yw(e){if(Mt){var t=br;if(t){var n=t;if(!pS(e,t)){if(qw(e))throw Error(ue(418));t=ti(n.nextSibling);var r=vr;t&&pS(e,t)?sM(r,n):(e.flags=e.flags&-4097|2,Mt=!1,vr=e)}}else{if(qw(e))throw Error(ue(418));e.flags=e.flags&-4097|2,Mt=!1,vr=e}}}function mS(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;vr=e}function Yd(e){if(e!==vr)return!1;if(!Mt)return mS(e),Mt=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Ww(e.type,e.memoizedProps)),t&&(t=br)){if(qw(e))throw oM(),Error(ue(418));for(;t;)sM(e,t),t=ti(t.nextSibling)}if(mS(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(ue(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){br=ti(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}br=null}}else br=vr?ti(e.stateNode.nextSibling):null;return!0}function oM(){for(var e=br;e;)e=ti(e.nextSibling)}function Da(){br=vr=null,Mt=!1}function d0(e){Zr===null?Zr=[e]:Zr.push(e)}var Oz=yo.ReactCurrentBatchConfig;function wc(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(ue(309));var r=n.stateNode}if(!r)throw Error(ue(147,e));var s=r,o=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===o?t.ref:(t=function(i){var l=s.refs;i===null?delete l[o]:l[o]=i},t._stringRef=o,t)}if(typeof e!="string")throw Error(ue(284));if(!n._owner)throw Error(ue(290,e))}return e}function Gd(e,t){throw e=Object.prototype.toString.call(t),Error(ue(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function gS(e){var t=e._init;return t(e._payload)}function iM(e){function t(k,v){if(e){var b=k.deletions;b===null?(k.deletions=[v],k.flags|=16):b.push(v)}}function n(k,v){if(!e)return null;for(;v!==null;)t(k,v),v=v.sibling;return null}function r(k,v){for(k=new Map;v!==null;)v.key!==null?k.set(v.key,v):k.set(v.index,v),v=v.sibling;return k}function s(k,v){return k=oi(k,v),k.index=0,k.sibling=null,k}function o(k,v,b){return k.index=b,e?(b=k.alternate,b!==null?(b=b.index,b<v?(k.flags|=2,v):b):(k.flags|=2,v)):(k.flags|=1048576,v)}function i(k){return e&&k.alternate===null&&(k.flags|=2),k}function l(k,v,b,E){return v===null||v.tag!==6?(v=Vg(b,k.mode,E),v.return=k,v):(v=s(v,b),v.return=k,v)}function a(k,v,b,E){var N=b.type;return N===oa?u(k,v,b.props.children,E,b.key):v!==null&&(v.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===Po&&gS(N)===v.type)?(E=s(v,b.props),E.ref=wc(k,v,b),E.return=k,E):(E=Yf(b.type,b.key,b.props,null,k.mode,E),E.ref=wc(k,v,b),E.return=k,E)}function c(k,v,b,E){return v===null||v.tag!==4||v.stateNode.containerInfo!==b.containerInfo||v.stateNode.implementation!==b.implementation?(v=Kg(b,k.mode,E),v.return=k,v):(v=s(v,b.children||[]),v.return=k,v)}function u(k,v,b,E,N){return v===null||v.tag!==7?(v=nl(b,k.mode,E,N),v.return=k,v):(v=s(v,b),v.return=k,v)}function f(k,v,b){if(typeof v=="string"&&v!==""||typeof v=="number")return v=Vg(""+v,k.mode,b),v.return=k,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case zd:return b=Yf(v.type,v.key,v.props,null,k.mode,b),b.ref=wc(k,null,v),b.return=k,b;case sa:return v=Kg(v,k.mode,b),v.return=k,v;case Po:var E=v._init;return f(k,E(v._payload),b)}if(Mc(v)||hc(v))return v=nl(v,k.mode,b,null),v.return=k,v;Gd(k,v)}return null}function h(k,v,b,E){var N=v!==null?v.key:null;if(typeof b=="string"&&b!==""||typeof b=="number")return N!==null?null:l(k,v,""+b,E);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case zd:return b.key===N?a(k,v,b,E):null;case sa:return b.key===N?c(k,v,b,E):null;case Po:return N=b._init,h(k,v,N(b._payload),E)}if(Mc(b)||hc(b))return N!==null?null:u(k,v,b,E,null);Gd(k,b)}return null}function p(k,v,b,E,N){if(typeof E=="string"&&E!==""||typeof E=="number")return k=k.get(b)||null,l(v,k,""+E,N);if(typeof E=="object"&&E!==null){switch(E.$$typeof){case zd:return k=k.get(E.key===null?b:E.key)||null,a(v,k,E,N);case sa:return k=k.get(E.key===null?b:E.key)||null,c(v,k,E,N);case Po:var T=E._init;return p(k,v,b,T(E._payload),N)}if(Mc(E)||hc(E))return k=k.get(b)||null,u(v,k,E,N,null);Gd(v,E)}return null}function m(k,v,b,E){for(var N=null,T=null,A=v,R=v=0,$=null;A!==null&&R<b.length;R++){A.index>R?($=A,A=null):$=A.sibling;var L=h(k,A,b[R],E);if(L===null){A===null&&(A=$);break}e&&A&&L.alternate===null&&t(k,A),v=o(L,v,R),T===null?N=L:T.sibling=L,T=L,A=$}if(R===b.length)return n(k,A),Mt&&$i(k,R),N;if(A===null){for(;R<b.length;R++)A=f(k,b[R],E),A!==null&&(v=o(A,v,R),T===null?N=A:T.sibling=A,T=A);return Mt&&$i(k,R),N}for(A=r(k,A);R<b.length;R++)$=p(A,k,R,b[R],E),$!==null&&(e&&$.alternate!==null&&A.delete($.key===null?R:$.key),v=o($,v,R),T===null?N=$:T.sibling=$,T=$);return e&&A.forEach(function(_){return t(k,_)}),Mt&&$i(k,R),N}function y(k,v,b,E){var N=hc(b);if(typeof N!="function")throw Error(ue(150));if(b=N.call(b),b==null)throw Error(ue(151));for(var T=N=null,A=v,R=v=0,$=null,L=b.next();A!==null&&!L.done;R++,L=b.next()){A.index>R?($=A,A=null):$=A.sibling;var _=h(k,A,L.value,E);if(_===null){A===null&&(A=$);break}e&&A&&_.alternate===null&&t(k,A),v=o(_,v,R),T===null?N=_:T.sibling=_,T=_,A=$}if(L.done)return n(k,A),Mt&&$i(k,R),N;if(A===null){for(;!L.done;R++,L=b.next())L=f(k,L.value,E),L!==null&&(v=o(L,v,R),T===null?N=L:T.sibling=L,T=L);return Mt&&$i(k,R),N}for(A=r(k,A);!L.done;R++,L=b.next())L=p(A,k,R,L.value,E),L!==null&&(e&&L.alternate!==null&&A.delete(L.key===null?R:L.key),v=o(L,v,R),T===null?N=L:T.sibling=L,T=L);return e&&A.forEach(function(j){return t(k,j)}),Mt&&$i(k,R),N}function x(k,v,b,E){if(typeof b=="object"&&b!==null&&b.type===oa&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case zd:e:{for(var N=b.key,T=v;T!==null;){if(T.key===N){if(N=b.type,N===oa){if(T.tag===7){n(k,T.sibling),v=s(T,b.props.children),v.return=k,k=v;break e}}else if(T.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===Po&&gS(N)===T.type){n(k,T.sibling),v=s(T,b.props),v.ref=wc(k,T,b),v.return=k,k=v;break e}n(k,T);break}else t(k,T);T=T.sibling}b.type===oa?(v=nl(b.props.children,k.mode,E,b.key),v.return=k,k=v):(E=Yf(b.type,b.key,b.props,null,k.mode,E),E.ref=wc(k,v,b),E.return=k,k=E)}return i(k);case sa:e:{for(T=b.key;v!==null;){if(v.key===T)if(v.tag===4&&v.stateNode.containerInfo===b.containerInfo&&v.stateNode.implementation===b.implementation){n(k,v.sibling),v=s(v,b.children||[]),v.return=k,k=v;break e}else{n(k,v);break}else t(k,v);v=v.sibling}v=Kg(b,k.mode,E),v.return=k,k=v}return i(k);case Po:return T=b._init,x(k,v,T(b._payload),E)}if(Mc(b))return m(k,v,b,E);if(hc(b))return y(k,v,b,E);Gd(k,b)}return typeof b=="string"&&b!==""||typeof b=="number"?(b=""+b,v!==null&&v.tag===6?(n(k,v.sibling),v=s(v,b),v.return=k,k=v):(n(k,v),v=Vg(b,k.mode,E),v.return=k,k=v),i(k)):n(k,v)}return x}var La=iM(!0),lM=iM(!1),Nh=yi(null),Th=null,ha=null,f0=null;function h0(){f0=ha=Th=null}function p0(e){var t=Nh.current;Tt(Nh),e._currentValue=t}function Gw(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Na(e,t){Th=e,f0=ha=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(ir=!0),e.firstContext=null)}function Ur(e){var t=e._currentValue;if(f0!==e)if(e={context:e,memoizedValue:t,next:null},ha===null){if(Th===null)throw Error(ue(308));ha=e,Th.dependencies={lanes:0,firstContext:e}}else ha=ha.next=e;return t}var Vi=null;function m0(e){Vi===null?Vi=[e]:Vi.push(e)}function aM(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,m0(t)):(n.next=s.next,s.next=n),t.interleaved=n,ho(e,r)}function ho(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var $o=!1;function g0(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function cM(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function lo(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ni(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,at&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,ho(e,n)}return s=r.interleaved,s===null?(t.next=t,m0(r)):(t.next=s.next,s.next=t),r.interleaved=t,ho(e,n)}function Hf(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,t0(e,n)}}function yS(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?s=o=i:o=o.next=i,n=n.next}while(n!==null);o===null?s=o=t:o=o.next=t}else s=o=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:o,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Ah(e,t,n,r){var s=e.updateQueue;$o=!1;var o=s.firstBaseUpdate,i=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var a=l,c=a.next;a.next=null,i===null?o=c:i.next=c,i=a;var u=e.alternate;u!==null&&(u=u.updateQueue,l=u.lastBaseUpdate,l!==i&&(l===null?u.firstBaseUpdate=c:l.next=c,u.lastBaseUpdate=a))}if(o!==null){var f=s.baseState;i=0,u=c=a=null,l=o;do{var h=l.lane,p=l.eventTime;if((r&h)===h){u!==null&&(u=u.next={eventTime:p,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var m=e,y=l;switch(h=t,p=n,y.tag){case 1:if(m=y.payload,typeof m=="function"){f=m.call(p,f,h);break e}f=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=y.payload,h=typeof m=="function"?m.call(p,f,h):m,h==null)break e;f=Dt({},f,h);break e;case 2:$o=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,h=s.effects,h===null?s.effects=[l]:h.push(l))}else p={eventTime:p,lane:h,tag:l.tag,payload:l.payload,callback:l.callback,next:null},u===null?(c=u=p,a=f):u=u.next=p,i|=h;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;h=l,l=h.next,h.next=null,s.lastBaseUpdate=h,s.shared.pending=null}}while(!0);if(u===null&&(a=f),s.baseState=a,s.firstBaseUpdate=c,s.lastBaseUpdate=u,t=s.shared.interleaved,t!==null){s=t;do i|=s.lane,s=s.next;while(s!==t)}else o===null&&(s.shared.lanes=0);gl|=i,e.lanes=i,e.memoizedState=f}}function wS(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],s=r.callback;if(s!==null){if(r.callback=null,r=n,typeof s!="function")throw Error(ue(191,s));s.call(r)}}}var od={},Ms=yi(od),ju=yi(od),Mu=yi(od);function Ki(e){if(e===od)throw Error(ue(174));return e}function y0(e,t){switch(vt(Mu,t),vt(ju,e),vt(Ms,od),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:jw(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=jw(t,e)}Tt(Ms),vt(Ms,t)}function Pa(){Tt(Ms),Tt(ju),Tt(Mu)}function uM(e){Ki(Mu.current);var t=Ki(Ms.current),n=jw(t,e.type);t!==n&&(vt(ju,e),vt(Ms,n))}function w0(e){ju.current===e&&(Tt(Ms),Tt(ju))}var Rt=yi(0);function jh(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var _g=[];function k0(){for(var e=0;e<_g.length;e++)_g[e]._workInProgressVersionPrimary=null;_g.length=0}var Wf=yo.ReactCurrentDispatcher,Fg=yo.ReactCurrentBatchConfig,ml=0,It=null,Xt=null,nn=null,Mh=!1,Yc=!1,Ru=0,Iz=0;function An(){throw Error(ue(321))}function x0(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!cs(e[n],t[n]))return!1;return!0}function b0(e,t,n,r,s,o){if(ml=o,It=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Wf.current=e===null||e.memoizedState===null?$z:zz,e=n(r,s),Yc){o=0;do{if(Yc=!1,Ru=0,25<=o)throw Error(ue(301));o+=1,nn=Xt=null,t.updateQueue=null,Wf.current=_z,e=n(r,s)}while(Yc)}if(Wf.current=Rh,t=Xt!==null&&Xt.next!==null,ml=0,nn=Xt=It=null,Mh=!1,t)throw Error(ue(300));return e}function v0(){var e=Ru!==0;return Ru=0,e}function bs(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return nn===null?It.memoizedState=nn=e:nn=nn.next=e,nn}function Vr(){if(Xt===null){var e=It.alternate;e=e!==null?e.memoizedState:null}else e=Xt.next;var t=nn===null?It.memoizedState:nn.next;if(t!==null)nn=t,Xt=e;else{if(e===null)throw Error(ue(310));Xt=e,e={memoizedState:Xt.memoizedState,baseState:Xt.baseState,baseQueue:Xt.baseQueue,queue:Xt.queue,next:null},nn===null?It.memoizedState=nn=e:nn=nn.next=e}return nn}function Ou(e,t){return typeof t=="function"?t(e):t}function Bg(e){var t=Vr(),n=t.queue;if(n===null)throw Error(ue(311));n.lastRenderedReducer=e;var r=Xt,s=r.baseQueue,o=n.pending;if(o!==null){if(s!==null){var i=s.next;s.next=o.next,o.next=i}r.baseQueue=s=o,n.pending=null}if(s!==null){o=s.next,r=r.baseState;var l=i=null,a=null,c=o;do{var u=c.lane;if((ml&u)===u)a!==null&&(a=a.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:e(r,c.action);else{var f={lane:u,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};a===null?(l=a=f,i=r):a=a.next=f,It.lanes|=u,gl|=u}c=c.next}while(c!==null&&c!==o);a===null?i=r:a.next=l,cs(r,t.memoizedState)||(ir=!0),t.memoizedState=r,t.baseState=i,t.baseQueue=a,n.lastRenderedState=r}if(e=n.interleaved,e!==null){s=e;do o=s.lane,It.lanes|=o,gl|=o,s=s.next;while(s!==e)}else s===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Hg(e){var t=Vr(),n=t.queue;if(n===null)throw Error(ue(311));n.lastRenderedReducer=e;var r=n.dispatch,s=n.pending,o=t.memoizedState;if(s!==null){n.pending=null;var i=s=s.next;do o=e(o,i.action),i=i.next;while(i!==s);cs(o,t.memoizedState)||(ir=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function dM(){}function fM(e,t){var n=It,r=Vr(),s=t(),o=!cs(r.memoizedState,s);if(o&&(r.memoizedState=s,ir=!0),r=r.queue,S0(mM.bind(null,n,r,e),[e]),r.getSnapshot!==t||o||nn!==null&&nn.memoizedState.tag&1){if(n.flags|=2048,Iu(9,pM.bind(null,n,r,s,t),void 0,null),rn===null)throw Error(ue(349));ml&30||hM(n,t,s)}return s}function hM(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=It.updateQueue,t===null?(t={lastEffect:null,stores:null},It.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function pM(e,t,n,r){t.value=n,t.getSnapshot=r,gM(t)&&yM(e)}function mM(e,t,n){return n(function(){gM(t)&&yM(e)})}function gM(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!cs(e,n)}catch{return!0}}function yM(e){var t=ho(e,1);t!==null&&ss(t,e,1,-1)}function kS(e){var t=bs();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ou,lastRenderedState:e},t.queue=e,e=e.dispatch=Pz.bind(null,It,e),[t.memoizedState,e]}function Iu(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=It.updateQueue,t===null?(t={lastEffect:null,stores:null},It.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function wM(){return Vr().memoizedState}function Uf(e,t,n,r){var s=bs();It.flags|=e,s.memoizedState=Iu(1|t,n,void 0,r===void 0?null:r)}function em(e,t,n,r){var s=Vr();r=r===void 0?null:r;var o=void 0;if(Xt!==null){var i=Xt.memoizedState;if(o=i.destroy,r!==null&&x0(r,i.deps)){s.memoizedState=Iu(t,n,o,r);return}}It.flags|=e,s.memoizedState=Iu(1|t,n,o,r)}function xS(e,t){return Uf(8390656,8,e,t)}function S0(e,t){return em(2048,8,e,t)}function kM(e,t){return em(4,2,e,t)}function xM(e,t){return em(4,4,e,t)}function bM(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function vM(e,t,n){return n=n!=null?n.concat([e]):null,em(4,4,bM.bind(null,t,e),n)}function C0(){}function SM(e,t){var n=Vr();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&x0(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function CM(e,t){var n=Vr();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&x0(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function EM(e,t,n){return ml&21?(cs(n,t)||(n=Mj(),It.lanes|=n,gl|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,ir=!0),e.memoizedState=n)}function Dz(e,t){var n=pt;pt=n!==0&&4>n?n:4,e(!0);var r=Fg.transition;Fg.transition={};try{e(!1),t()}finally{pt=n,Fg.transition=r}}function NM(){return Vr().memoizedState}function Lz(e,t,n){var r=si(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},TM(e))AM(t,n);else if(n=aM(e,t,n,r),n!==null){var s=Jn();ss(n,e,r,s),jM(n,t,r)}}function Pz(e,t,n){var r=si(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(TM(e))AM(t,s);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var i=t.lastRenderedState,l=o(i,n);if(s.hasEagerState=!0,s.eagerState=l,cs(l,i)){var a=t.interleaved;a===null?(s.next=s,m0(t)):(s.next=a.next,a.next=s),t.interleaved=s;return}}catch{}finally{}n=aM(e,t,s,r),n!==null&&(s=Jn(),ss(n,e,r,s),jM(n,t,r))}}function TM(e){var t=e.alternate;return e===It||t!==null&&t===It}function AM(e,t){Yc=Mh=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function jM(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,t0(e,n)}}var Rh={readContext:Ur,useCallback:An,useContext:An,useEffect:An,useImperativeHandle:An,useInsertionEffect:An,useLayoutEffect:An,useMemo:An,useReducer:An,useRef:An,useState:An,useDebugValue:An,useDeferredValue:An,useTransition:An,useMutableSource:An,useSyncExternalStore:An,useId:An,unstable_isNewReconciler:!1},$z={readContext:Ur,useCallback:function(e,t){return bs().memoizedState=[e,t===void 0?null:t],e},useContext:Ur,useEffect:xS,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Uf(4194308,4,bM.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Uf(4194308,4,e,t)},useInsertionEffect:function(e,t){return Uf(4,2,e,t)},useMemo:function(e,t){var n=bs();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=bs();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Lz.bind(null,It,e),[r.memoizedState,e]},useRef:function(e){var t=bs();return e={current:e},t.memoizedState=e},useState:kS,useDebugValue:C0,useDeferredValue:function(e){return bs().memoizedState=e},useTransition:function(){var e=kS(!1),t=e[0];return e=Dz.bind(null,e[1]),bs().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=It,s=bs();if(Mt){if(n===void 0)throw Error(ue(407));n=n()}else{if(n=t(),rn===null)throw Error(ue(349));ml&30||hM(r,t,n)}s.memoizedState=n;var o={value:n,getSnapshot:t};return s.queue=o,xS(mM.bind(null,r,o,e),[e]),r.flags|=2048,Iu(9,pM.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=bs(),t=rn.identifierPrefix;if(Mt){var n=so,r=ro;n=(r&~(1<<32-rs(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Ru++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=Iz++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},zz={readContext:Ur,useCallback:SM,useContext:Ur,useEffect:S0,useImperativeHandle:vM,useInsertionEffect:kM,useLayoutEffect:xM,useMemo:CM,useReducer:Bg,useRef:wM,useState:function(){return Bg(Ou)},useDebugValue:C0,useDeferredValue:function(e){var t=Vr();return EM(t,Xt.memoizedState,e)},useTransition:function(){var e=Bg(Ou)[0],t=Vr().memoizedState;return[e,t]},useMutableSource:dM,useSyncExternalStore:fM,useId:NM,unstable_isNewReconciler:!1},_z={readContext:Ur,useCallback:SM,useContext:Ur,useEffect:S0,useImperativeHandle:vM,useInsertionEffect:kM,useLayoutEffect:xM,useMemo:CM,useReducer:Hg,useRef:wM,useState:function(){return Hg(Ou)},useDebugValue:C0,useDeferredValue:function(e){var t=Vr();return Xt===null?t.memoizedState=e:EM(t,Xt.memoizedState,e)},useTransition:function(){var e=Hg(Ou)[0],t=Vr().memoizedState;return[e,t]},useMutableSource:dM,useSyncExternalStore:fM,useId:NM,unstable_isNewReconciler:!1};function Qr(e,t){if(e&&e.defaultProps){t=Dt({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Jw(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Dt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var tm={isMounted:function(e){return(e=e._reactInternals)?Al(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Jn(),s=si(e),o=lo(r,s);o.payload=t,n!=null&&(o.callback=n),t=ni(e,o,s),t!==null&&(ss(t,e,s,r),Hf(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Jn(),s=si(e),o=lo(r,s);o.tag=1,o.payload=t,n!=null&&(o.callback=n),t=ni(e,o,s),t!==null&&(ss(t,e,s,r),Hf(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Jn(),r=si(e),s=lo(n,r);s.tag=2,t!=null&&(s.callback=t),t=ni(e,s,r),t!==null&&(ss(t,e,r,n),Hf(t,e,r))}};function bS(e,t,n,r,s,o,i){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,o,i):t.prototype&&t.prototype.isPureReactComponent?!Eu(n,r)||!Eu(s,o):!0}function MM(e,t,n){var r=!1,s=hi,o=t.contextType;return typeof o=="object"&&o!==null?o=Ur(o):(s=ar(t)?hl:_n.current,r=t.contextTypes,o=(r=r!=null)?Ia(e,s):hi),t=new t(n,o),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=tm,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=o),t}function vS(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&tm.enqueueReplaceState(t,t.state,null)}function Qw(e,t,n,r){var s=e.stateNode;s.props=n,s.state=e.memoizedState,s.refs={},g0(e);var o=t.contextType;typeof o=="object"&&o!==null?s.context=Ur(o):(o=ar(t)?hl:_n.current,s.context=Ia(e,o)),s.state=e.memoizedState,o=t.getDerivedStateFromProps,typeof o=="function"&&(Jw(e,t,o,n),s.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(t=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),t!==s.state&&tm.enqueueReplaceState(s,s.state,null),Ah(e,n,s,r),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function $a(e,t){try{var n="",r=t;do n+=h$(r),r=r.return;while(r);var s=n}catch(o){s=`
39
+ Error generating stack: `+o.message+`
40
+ `+o.stack}return{value:e,source:t,stack:s,digest:null}}function Wg(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Xw(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Fz=typeof WeakMap=="function"?WeakMap:Map;function RM(e,t,n){n=lo(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Ih||(Ih=!0,ak=r),Xw(e,t)},n}function OM(e,t,n){n=lo(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var s=t.value;n.payload=function(){return r(s)},n.callback=function(){Xw(e,t)}}var o=e.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){Xw(e,t),typeof r!="function"&&(ri===null?ri=new Set([this]):ri.add(this));var i=t.stack;this.componentDidCatch(t.value,{componentStack:i!==null?i:""})}),n}function SS(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Fz;var s=new Set;r.set(t,s)}else s=r.get(t),s===void 0&&(s=new Set,r.set(t,s));s.has(n)||(s.add(n),e=e_.bind(null,e,t,n),t.then(e,e))}function CS(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function ES(e,t,n,r,s){return e.mode&1?(e.flags|=65536,e.lanes=s,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=lo(-1,1),t.tag=2,ni(n,t,1))),n.lanes|=1),e)}var Bz=yo.ReactCurrentOwner,ir=!1;function Yn(e,t,n,r){t.child=e===null?lM(t,null,n,r):La(t,e.child,n,r)}function NS(e,t,n,r,s){n=n.render;var o=t.ref;return Na(t,s),r=b0(e,t,n,r,o,s),n=v0(),e!==null&&!ir?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,po(e,t,s)):(Mt&&n&&c0(t),t.flags|=1,Yn(e,t,r,s),t.child)}function TS(e,t,n,r,s){if(e===null){var o=n.type;return typeof o=="function"&&!O0(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=o,IM(e,t,o,r,s)):(e=Yf(n.type,null,r,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,!(e.lanes&s)){var i=o.memoizedProps;if(n=n.compare,n=n!==null?n:Eu,n(i,r)&&e.ref===t.ref)return po(e,t,s)}return t.flags|=1,e=oi(o,r),e.ref=t.ref,e.return=t,t.child=e}function IM(e,t,n,r,s){if(e!==null){var o=e.memoizedProps;if(Eu(o,r)&&e.ref===t.ref)if(ir=!1,t.pendingProps=r=o,(e.lanes&s)!==0)e.flags&131072&&(ir=!0);else return t.lanes=e.lanes,po(e,t,s)}return Zw(e,t,n,r,s)}function DM(e,t,n){var r=t.pendingProps,s=r.children,o=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},vt(ma,wr),wr|=n;else{if(!(n&1073741824))return e=o!==null?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,vt(ma,wr),wr|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=o!==null?o.baseLanes:n,vt(ma,wr),wr|=r}else o!==null?(r=o.baseLanes|n,t.memoizedState=null):r=n,vt(ma,wr),wr|=r;return Yn(e,t,s,n),t.child}function LM(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Zw(e,t,n,r,s){var o=ar(n)?hl:_n.current;return o=Ia(t,o),Na(t,s),n=b0(e,t,n,r,o,s),r=v0(),e!==null&&!ir?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,po(e,t,s)):(Mt&&r&&c0(t),t.flags|=1,Yn(e,t,n,s),t.child)}function AS(e,t,n,r,s){if(ar(n)){var o=!0;Sh(t)}else o=!1;if(Na(t,s),t.stateNode===null)Vf(e,t),MM(t,n,r),Qw(t,n,r,s),r=!0;else if(e===null){var i=t.stateNode,l=t.memoizedProps;i.props=l;var a=i.context,c=n.contextType;typeof c=="object"&&c!==null?c=Ur(c):(c=ar(n)?hl:_n.current,c=Ia(t,c));var u=n.getDerivedStateFromProps,f=typeof u=="function"||typeof i.getSnapshotBeforeUpdate=="function";f||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(l!==r||a!==c)&&vS(t,i,r,c),$o=!1;var h=t.memoizedState;i.state=h,Ah(t,r,i,s),a=t.memoizedState,l!==r||h!==a||lr.current||$o?(typeof u=="function"&&(Jw(t,n,u,r),a=t.memoizedState),(l=$o||bS(t,n,l,r,h,a,c))?(f||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount()),typeof i.componentDidMount=="function"&&(t.flags|=4194308)):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=a),i.props=r,i.state=a,i.context=c,r=l):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,cM(e,t),l=t.memoizedProps,c=t.type===t.elementType?l:Qr(t.type,l),i.props=c,f=t.pendingProps,h=i.context,a=n.contextType,typeof a=="object"&&a!==null?a=Ur(a):(a=ar(n)?hl:_n.current,a=Ia(t,a));var p=n.getDerivedStateFromProps;(u=typeof p=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(l!==f||h!==a)&&vS(t,i,r,a),$o=!1,h=t.memoizedState,i.state=h,Ah(t,r,i,s);var m=t.memoizedState;l!==f||h!==m||lr.current||$o?(typeof p=="function"&&(Jw(t,n,p,r),m=t.memoizedState),(c=$o||bS(t,n,c,r,h,m,a)||!1)?(u||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(r,m,a),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(r,m,a)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),i.props=r,i.state=m,i.context=a,r=c):(typeof i.componentDidUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return ek(e,t,n,r,o,s)}function ek(e,t,n,r,s,o){LM(e,t);var i=(t.flags&128)!==0;if(!r&&!i)return s&&hS(t,n,!1),po(e,t,o);r=t.stateNode,Bz.current=t;var l=i&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&i?(t.child=La(t,e.child,null,o),t.child=La(t,null,l,o)):Yn(e,t,l,o),t.memoizedState=r.state,s&&hS(t,n,!0),t.child}function PM(e){var t=e.stateNode;t.pendingContext?fS(e,t.pendingContext,t.pendingContext!==t.context):t.context&&fS(e,t.context,!1),y0(e,t.containerInfo)}function jS(e,t,n,r,s){return Da(),d0(s),t.flags|=256,Yn(e,t,n,r),t.child}var tk={dehydrated:null,treeContext:null,retryLane:0};function nk(e){return{baseLanes:e,cachePool:null,transitions:null}}function $M(e,t,n){var r=t.pendingProps,s=Rt.current,o=!1,i=(t.flags&128)!==0,l;if((l=i)||(l=e!==null&&e.memoizedState===null?!1:(s&2)!==0),l?(o=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),vt(Rt,s&1),e===null)return Yw(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(i=r.children,e=r.fallback,o?(r=t.mode,o=t.child,i={mode:"hidden",children:i},!(r&1)&&o!==null?(o.childLanes=0,o.pendingProps=i):o=sm(i,r,0,null),e=nl(e,r,n,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=nk(n),t.memoizedState=tk,e):E0(t,i));if(s=e.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return Hz(e,t,i,r,l,s,n);if(o){o=r.fallback,i=t.mode,s=e.child,l=s.sibling;var a={mode:"hidden",children:r.children};return!(i&1)&&t.child!==s?(r=t.child,r.childLanes=0,r.pendingProps=a,t.deletions=null):(r=oi(s,a),r.subtreeFlags=s.subtreeFlags&14680064),l!==null?o=oi(l,o):(o=nl(o,i,n,null),o.flags|=2),o.return=t,r.return=t,r.sibling=o,t.child=r,r=o,o=t.child,i=e.child.memoizedState,i=i===null?nk(n):{baseLanes:i.baseLanes|n,cachePool:null,transitions:i.transitions},o.memoizedState=i,o.childLanes=e.childLanes&~n,t.memoizedState=tk,r}return o=e.child,e=o.sibling,r=oi(o,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function E0(e,t){return t=sm({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Jd(e,t,n,r){return r!==null&&d0(r),La(t,e.child,null,n),e=E0(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Hz(e,t,n,r,s,o,i){if(n)return t.flags&256?(t.flags&=-257,r=Wg(Error(ue(422))),Jd(e,t,i,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(o=r.fallback,s=t.mode,r=sm({mode:"visible",children:r.children},s,0,null),o=nl(o,s,i,null),o.flags|=2,r.return=t,o.return=t,r.sibling=o,t.child=r,t.mode&1&&La(t,e.child,null,i),t.child.memoizedState=nk(i),t.memoizedState=tk,o);if(!(t.mode&1))return Jd(e,t,i,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var l=r.dgst;return r=l,o=Error(ue(419)),r=Wg(o,r,void 0),Jd(e,t,i,r)}if(l=(i&e.childLanes)!==0,ir||l){if(r=rn,r!==null){switch(i&-i){case 4:s=2;break;case 16:s=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(r.suspendedLanes|i)?0:s,s!==0&&s!==o.retryLane&&(o.retryLane=s,ho(e,s),ss(r,e,s,-1))}return R0(),r=Wg(Error(ue(421))),Jd(e,t,i,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=t_.bind(null,e),s._reactRetry=t,null):(e=o.treeContext,br=ti(s.nextSibling),vr=t,Mt=!0,Zr=null,e!==null&&(Ir[Dr++]=ro,Ir[Dr++]=so,Ir[Dr++]=pl,ro=e.id,so=e.overflow,pl=t),t=E0(t,r.children),t.flags|=4096,t)}function MS(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Gw(e.return,t,n)}function Ug(e,t,n,r,s){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=s)}function zM(e,t,n){var r=t.pendingProps,s=r.revealOrder,o=r.tail;if(Yn(e,t,r.children,n),r=Rt.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&MS(e,n,t);else if(e.tag===19)MS(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(vt(Rt,r),!(t.mode&1))t.memoizedState=null;else switch(s){case"forwards":for(n=t.child,s=null;n!==null;)e=n.alternate,e!==null&&jh(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),Ug(t,!1,s,n,o);break;case"backwards":for(n=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&jh(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}Ug(t,!0,n,null,o);break;case"together":Ug(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Vf(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function po(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),gl|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(ue(153));if(t.child!==null){for(e=t.child,n=oi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=oi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Wz(e,t,n){switch(t.tag){case 3:PM(t),Da();break;case 5:uM(t);break;case 1:ar(t.type)&&Sh(t);break;case 4:y0(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;vt(Nh,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(vt(Rt,Rt.current&1),t.flags|=128,null):n&t.child.childLanes?$M(e,t,n):(vt(Rt,Rt.current&1),e=po(e,t,n),e!==null?e.sibling:null);vt(Rt,Rt.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return zM(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),vt(Rt,Rt.current),r)break;return null;case 22:case 23:return t.lanes=0,DM(e,t,n)}return po(e,t,n)}var _M,rk,FM,BM;_M=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};rk=function(){};FM=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,Ki(Ms.current);var o=null;switch(n){case"input":s=Ew(e,s),r=Ew(e,r),o=[];break;case"select":s=Dt({},s,{value:void 0}),r=Dt({},r,{value:void 0}),o=[];break;case"textarea":s=Aw(e,s),r=Aw(e,r),o=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=bh)}Mw(n,r);var i;n=null;for(c in s)if(!r.hasOwnProperty(c)&&s.hasOwnProperty(c)&&s[c]!=null)if(c==="style"){var l=s[c];for(i in l)l.hasOwnProperty(i)&&(n||(n={}),n[i]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(wu.hasOwnProperty(c)?o||(o=[]):(o=o||[]).push(c,null));for(c in r){var a=r[c];if(l=s!=null?s[c]:void 0,r.hasOwnProperty(c)&&a!==l&&(a!=null||l!=null))if(c==="style")if(l){for(i in l)!l.hasOwnProperty(i)||a&&a.hasOwnProperty(i)||(n||(n={}),n[i]="");for(i in a)a.hasOwnProperty(i)&&l[i]!==a[i]&&(n||(n={}),n[i]=a[i])}else n||(o||(o=[]),o.push(c,n)),n=a;else c==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,l=l?l.__html:void 0,a!=null&&l!==a&&(o=o||[]).push(c,a)):c==="children"?typeof a!="string"&&typeof a!="number"||(o=o||[]).push(c,""+a):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(wu.hasOwnProperty(c)?(a!=null&&c==="onScroll"&&Et("scroll",e),o||l===a||(o=[])):(o=o||[]).push(c,a))}n&&(o=o||[]).push("style",n);var c=o;(t.updateQueue=c)&&(t.flags|=4)}};BM=function(e,t,n,r){n!==r&&(t.flags|=4)};function kc(e,t){if(!Mt)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function jn(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Uz(e,t,n){var r=t.pendingProps;switch(u0(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return jn(t),null;case 1:return ar(t.type)&&vh(),jn(t),null;case 3:return r=t.stateNode,Pa(),Tt(lr),Tt(_n),k0(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Yd(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Zr!==null&&(dk(Zr),Zr=null))),rk(e,t),jn(t),null;case 5:w0(t);var s=Ki(Mu.current);if(n=t.type,e!==null&&t.stateNode!=null)FM(e,t,n,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(ue(166));return jn(t),null}if(e=Ki(Ms.current),Yd(t)){r=t.stateNode,n=t.type;var o=t.memoizedProps;switch(r[Ts]=t,r[Au]=o,e=(t.mode&1)!==0,n){case"dialog":Et("cancel",r),Et("close",r);break;case"iframe":case"object":case"embed":Et("load",r);break;case"video":case"audio":for(s=0;s<Oc.length;s++)Et(Oc[s],r);break;case"source":Et("error",r);break;case"img":case"image":case"link":Et("error",r),Et("load",r);break;case"details":Et("toggle",r);break;case"input":_1(r,o),Et("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!o.multiple},Et("invalid",r);break;case"textarea":B1(r,o),Et("invalid",r)}Mw(n,o),s=null;for(var i in o)if(o.hasOwnProperty(i)){var l=o[i];i==="children"?typeof l=="string"?r.textContent!==l&&(o.suppressHydrationWarning!==!0&&qd(r.textContent,l,e),s=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(o.suppressHydrationWarning!==!0&&qd(r.textContent,l,e),s=["children",""+l]):wu.hasOwnProperty(i)&&l!=null&&i==="onScroll"&&Et("scroll",r)}switch(n){case"input":_d(r),F1(r,o,!0);break;case"textarea":_d(r),H1(r);break;case"select":case"option":break;default:typeof o.onClick=="function"&&(r.onclick=bh)}r=s,t.updateQueue=r,r!==null&&(t.flags|=4)}else{i=s.nodeType===9?s:s.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=mj(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=i.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[Ts]=t,e[Au]=r,_M(e,t,!1,!1),t.stateNode=e;e:{switch(i=Rw(n,r),n){case"dialog":Et("cancel",e),Et("close",e),s=r;break;case"iframe":case"object":case"embed":Et("load",e),s=r;break;case"video":case"audio":for(s=0;s<Oc.length;s++)Et(Oc[s],e);s=r;break;case"source":Et("error",e),s=r;break;case"img":case"image":case"link":Et("error",e),Et("load",e),s=r;break;case"details":Et("toggle",e),s=r;break;case"input":_1(e,r),s=Ew(e,r),Et("invalid",e);break;case"option":s=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=Dt({},r,{value:void 0}),Et("invalid",e);break;case"textarea":B1(e,r),s=Aw(e,r),Et("invalid",e);break;default:s=r}Mw(n,s),l=s;for(o in l)if(l.hasOwnProperty(o)){var a=l[o];o==="style"?wj(e,a):o==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,a!=null&&gj(e,a)):o==="children"?typeof a=="string"?(n!=="textarea"||a!=="")&&ku(e,a):typeof a=="number"&&ku(e,""+a):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(wu.hasOwnProperty(o)?a!=null&&o==="onScroll"&&Et("scroll",e):a!=null&&Gx(e,o,a,i))}switch(n){case"input":_d(e),F1(e,r,!1);break;case"textarea":_d(e),H1(e);break;case"option":r.value!=null&&e.setAttribute("value",""+fi(r.value));break;case"select":e.multiple=!!r.multiple,o=r.value,o!=null?va(e,!!r.multiple,o,!1):r.defaultValue!=null&&va(e,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=bh)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return jn(t),null;case 6:if(e&&t.stateNode!=null)BM(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(ue(166));if(n=Ki(Mu.current),Ki(Ms.current),Yd(t)){if(r=t.stateNode,n=t.memoizedProps,r[Ts]=t,(o=r.nodeValue!==n)&&(e=vr,e!==null))switch(e.tag){case 3:qd(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&qd(r.nodeValue,n,(e.mode&1)!==0)}o&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Ts]=t,t.stateNode=r}return jn(t),null;case 13:if(Tt(Rt),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Mt&&br!==null&&t.mode&1&&!(t.flags&128))oM(),Da(),t.flags|=98560,o=!1;else if(o=Yd(t),r!==null&&r.dehydrated!==null){if(e===null){if(!o)throw Error(ue(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(ue(317));o[Ts]=t}else Da(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;jn(t),o=!1}else Zr!==null&&(dk(Zr),Zr=null),o=!0;if(!o)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||Rt.current&1?Zt===0&&(Zt=3):R0())),t.updateQueue!==null&&(t.flags|=4),jn(t),null);case 4:return Pa(),rk(e,t),e===null&&Nu(t.stateNode.containerInfo),jn(t),null;case 10:return p0(t.type._context),jn(t),null;case 17:return ar(t.type)&&vh(),jn(t),null;case 19:if(Tt(Rt),o=t.memoizedState,o===null)return jn(t),null;if(r=(t.flags&128)!==0,i=o.rendering,i===null)if(r)kc(o,!1);else{if(Zt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=jh(e),i!==null){for(t.flags|=128,kc(o,!1),r=i.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)o=n,e=r,o.flags&=14680066,i=o.alternate,i===null?(o.childLanes=0,o.lanes=e,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=i.childLanes,o.lanes=i.lanes,o.child=i.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=i.memoizedProps,o.memoizedState=i.memoizedState,o.updateQueue=i.updateQueue,o.type=i.type,e=i.dependencies,o.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return vt(Rt,Rt.current&1|2),t.child}e=e.sibling}o.tail!==null&&Wt()>za&&(t.flags|=128,r=!0,kc(o,!1),t.lanes=4194304)}else{if(!r)if(e=jh(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),kc(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!Mt)return jn(t),null}else 2*Wt()-o.renderingStartTime>za&&n!==1073741824&&(t.flags|=128,r=!0,kc(o,!1),t.lanes=4194304);o.isBackwards?(i.sibling=t.child,t.child=i):(n=o.last,n!==null?n.sibling=i:t.child=i,o.last=i)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Wt(),t.sibling=null,n=Rt.current,vt(Rt,r?n&1|2:n&1),t):(jn(t),null);case 22:case 23:return M0(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?wr&1073741824&&(jn(t),t.subtreeFlags&6&&(t.flags|=8192)):jn(t),null;case 24:return null;case 25:return null}throw Error(ue(156,t.tag))}function Vz(e,t){switch(u0(t),t.tag){case 1:return ar(t.type)&&vh(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Pa(),Tt(lr),Tt(_n),k0(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return w0(t),null;case 13:if(Tt(Rt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ue(340));Da()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Tt(Rt),null;case 4:return Pa(),null;case 10:return p0(t.type._context),null;case 22:case 23:return M0(),null;case 24:return null;default:return null}}var Qd=!1,Ln=!1,Kz=typeof WeakSet=="function"?WeakSet:Set,Ne=null;function pa(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){$t(e,t,r)}else n.current=null}function sk(e,t,n){try{n()}catch(r){$t(e,t,r)}}var RS=!1;function qz(e,t){if(Bw=wh,e=Kj(),a0(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var i=0,l=-1,a=-1,c=0,u=0,f=e,h=null;t:for(;;){for(var p;f!==n||s!==0&&f.nodeType!==3||(l=i+s),f!==o||r!==0&&f.nodeType!==3||(a=i+r),f.nodeType===3&&(i+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===e)break t;if(h===n&&++c===s&&(l=i),h===o&&++u===r&&(a=i),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=l===-1||a===-1?null:{start:l,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(Hw={focusedElem:e,selectionRange:n},wh=!1,Ne=t;Ne!==null;)if(t=Ne,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ne=e;else for(;Ne!==null;){t=Ne;try{var m=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var y=m.memoizedProps,x=m.memoizedState,k=t.stateNode,v=k.getSnapshotBeforeUpdate(t.elementType===t.type?y:Qr(t.type,y),x);k.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var b=t.stateNode.containerInfo;b.nodeType===1?b.textContent="":b.nodeType===9&&b.documentElement&&b.removeChild(b.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ue(163))}}catch(E){$t(t,t.return,E)}if(e=t.sibling,e!==null){e.return=t.return,Ne=e;break}Ne=t.return}return m=RS,RS=!1,m}function Gc(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var o=s.destroy;s.destroy=void 0,o!==void 0&&sk(t,n,o)}s=s.next}while(s!==r)}}function nm(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function ok(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function HM(e){var t=e.alternate;t!==null&&(e.alternate=null,HM(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Ts],delete t[Au],delete t[Vw],delete t[jz],delete t[Mz])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function WM(e){return e.tag===5||e.tag===3||e.tag===4}function OS(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||WM(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ik(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=bh));else if(r!==4&&(e=e.child,e!==null))for(ik(e,t,n),e=e.sibling;e!==null;)ik(e,t,n),e=e.sibling}function lk(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(lk(e,t,n),e=e.sibling;e!==null;)lk(e,t,n),e=e.sibling}var mn=null,Xr=!1;function No(e,t,n){for(n=n.child;n!==null;)UM(e,t,n),n=n.sibling}function UM(e,t,n){if(js&&typeof js.onCommitFiberUnmount=="function")try{js.onCommitFiberUnmount(Yp,n)}catch{}switch(n.tag){case 5:Ln||pa(n,t);case 6:var r=mn,s=Xr;mn=null,No(e,t,n),mn=r,Xr=s,mn!==null&&(Xr?(e=mn,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):mn.removeChild(n.stateNode));break;case 18:mn!==null&&(Xr?(e=mn,n=n.stateNode,e.nodeType===8?$g(e.parentNode,n):e.nodeType===1&&$g(e,n),Su(e)):$g(mn,n.stateNode));break;case 4:r=mn,s=Xr,mn=n.stateNode.containerInfo,Xr=!0,No(e,t,n),mn=r,Xr=s;break;case 0:case 11:case 14:case 15:if(!Ln&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var o=s,i=o.destroy;o=o.tag,i!==void 0&&(o&2||o&4)&&sk(n,t,i),s=s.next}while(s!==r)}No(e,t,n);break;case 1:if(!Ln&&(pa(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){$t(n,t,l)}No(e,t,n);break;case 21:No(e,t,n);break;case 22:n.mode&1?(Ln=(r=Ln)||n.memoizedState!==null,No(e,t,n),Ln=r):No(e,t,n);break;default:No(e,t,n)}}function IS(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Kz),t.forEach(function(r){var s=n_.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Jr(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];try{var o=e,i=t,l=i;e:for(;l!==null;){switch(l.tag){case 5:mn=l.stateNode,Xr=!1;break e;case 3:mn=l.stateNode.containerInfo,Xr=!0;break e;case 4:mn=l.stateNode.containerInfo,Xr=!0;break e}l=l.return}if(mn===null)throw Error(ue(160));UM(o,i,s),mn=null,Xr=!1;var a=s.alternate;a!==null&&(a.return=null),s.return=null}catch(c){$t(s,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)VM(t,e),t=t.sibling}function VM(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Jr(t,e),ws(e),r&4){try{Gc(3,e,e.return),nm(3,e)}catch(y){$t(e,e.return,y)}try{Gc(5,e,e.return)}catch(y){$t(e,e.return,y)}}break;case 1:Jr(t,e),ws(e),r&512&&n!==null&&pa(n,n.return);break;case 5:if(Jr(t,e),ws(e),r&512&&n!==null&&pa(n,n.return),e.flags&32){var s=e.stateNode;try{ku(s,"")}catch(y){$t(e,e.return,y)}}if(r&4&&(s=e.stateNode,s!=null)){var o=e.memoizedProps,i=n!==null?n.memoizedProps:o,l=e.type,a=e.updateQueue;if(e.updateQueue=null,a!==null)try{l==="input"&&o.type==="radio"&&o.name!=null&&hj(s,o),Rw(l,i);var c=Rw(l,o);for(i=0;i<a.length;i+=2){var u=a[i],f=a[i+1];u==="style"?wj(s,f):u==="dangerouslySetInnerHTML"?gj(s,f):u==="children"?ku(s,f):Gx(s,u,f,c)}switch(l){case"input":Nw(s,o);break;case"textarea":pj(s,o);break;case"select":var h=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!o.multiple;var p=o.value;p!=null?va(s,!!o.multiple,p,!1):h!==!!o.multiple&&(o.defaultValue!=null?va(s,!!o.multiple,o.defaultValue,!0):va(s,!!o.multiple,o.multiple?[]:"",!1))}s[Au]=o}catch(y){$t(e,e.return,y)}}break;case 6:if(Jr(t,e),ws(e),r&4){if(e.stateNode===null)throw Error(ue(162));s=e.stateNode,o=e.memoizedProps;try{s.nodeValue=o}catch(y){$t(e,e.return,y)}}break;case 3:if(Jr(t,e),ws(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Su(t.containerInfo)}catch(y){$t(e,e.return,y)}break;case 4:Jr(t,e),ws(e);break;case 13:Jr(t,e),ws(e),s=e.child,s.flags&8192&&(o=s.memoizedState!==null,s.stateNode.isHidden=o,!o||s.alternate!==null&&s.alternate.memoizedState!==null||(A0=Wt())),r&4&&IS(e);break;case 22:if(u=n!==null&&n.memoizedState!==null,e.mode&1?(Ln=(c=Ln)||u,Jr(t,e),Ln=c):Jr(t,e),ws(e),r&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!u&&e.mode&1)for(Ne=e,u=e.child;u!==null;){for(f=Ne=u;Ne!==null;){switch(h=Ne,p=h.child,h.tag){case 0:case 11:case 14:case 15:Gc(4,h,h.return);break;case 1:pa(h,h.return);var m=h.stateNode;if(typeof m.componentWillUnmount=="function"){r=h,n=h.return;try{t=r,m.props=t.memoizedProps,m.state=t.memoizedState,m.componentWillUnmount()}catch(y){$t(r,n,y)}}break;case 5:pa(h,h.return);break;case 22:if(h.memoizedState!==null){LS(f);continue}}p!==null?(p.return=h,Ne=p):LS(f)}u=u.sibling}e:for(u=null,f=e;;){if(f.tag===5){if(u===null){u=f;try{s=f.stateNode,c?(o=s.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"):(l=f.stateNode,a=f.memoizedProps.style,i=a!=null&&a.hasOwnProperty("display")?a.display:null,l.style.display=yj("display",i))}catch(y){$t(e,e.return,y)}}}else if(f.tag===6){if(u===null)try{f.stateNode.nodeValue=c?"":f.memoizedProps}catch(y){$t(e,e.return,y)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;u===f&&(u=null),f=f.return}u===f&&(u=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Jr(t,e),ws(e),r&4&&IS(e);break;case 21:break;default:Jr(t,e),ws(e)}}function ws(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(WM(n)){var r=n;break e}n=n.return}throw Error(ue(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(ku(s,""),r.flags&=-33);var o=OS(e);lk(e,o,s);break;case 3:case 4:var i=r.stateNode.containerInfo,l=OS(e);ik(e,l,i);break;default:throw Error(ue(161))}}catch(a){$t(e,e.return,a)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Yz(e,t,n){Ne=e,KM(e)}function KM(e,t,n){for(var r=(e.mode&1)!==0;Ne!==null;){var s=Ne,o=s.child;if(s.tag===22&&r){var i=s.memoizedState!==null||Qd;if(!i){var l=s.alternate,a=l!==null&&l.memoizedState!==null||Ln;l=Qd;var c=Ln;if(Qd=i,(Ln=a)&&!c)for(Ne=s;Ne!==null;)i=Ne,a=i.child,i.tag===22&&i.memoizedState!==null?PS(s):a!==null?(a.return=i,Ne=a):PS(s);for(;o!==null;)Ne=o,KM(o),o=o.sibling;Ne=s,Qd=l,Ln=c}DS(e)}else s.subtreeFlags&8772&&o!==null?(o.return=s,Ne=o):DS(e)}}function DS(e){for(;Ne!==null;){var t=Ne;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Ln||nm(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Ln)if(n===null)r.componentDidMount();else{var s=t.elementType===t.type?n.memoizedProps:Qr(t.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&wS(t,o,r);break;case 3:var i=t.updateQueue;if(i!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}wS(t,i,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var a=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":a.autoFocus&&n.focus();break;case"img":a.src&&(n.src=a.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var c=t.alternate;if(c!==null){var u=c.memoizedState;if(u!==null){var f=u.dehydrated;f!==null&&Su(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(ue(163))}Ln||t.flags&512&&ok(t)}catch(h){$t(t,t.return,h)}}if(t===e){Ne=null;break}if(n=t.sibling,n!==null){n.return=t.return,Ne=n;break}Ne=t.return}}function LS(e){for(;Ne!==null;){var t=Ne;if(t===e){Ne=null;break}var n=t.sibling;if(n!==null){n.return=t.return,Ne=n;break}Ne=t.return}}function PS(e){for(;Ne!==null;){var t=Ne;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{nm(4,t)}catch(a){$t(t,n,a)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var s=t.return;try{r.componentDidMount()}catch(a){$t(t,s,a)}}var o=t.return;try{ok(t)}catch(a){$t(t,o,a)}break;case 5:var i=t.return;try{ok(t)}catch(a){$t(t,i,a)}}}catch(a){$t(t,t.return,a)}if(t===e){Ne=null;break}var l=t.sibling;if(l!==null){l.return=t.return,Ne=l;break}Ne=t.return}}var Gz=Math.ceil,Oh=yo.ReactCurrentDispatcher,N0=yo.ReactCurrentOwner,Br=yo.ReactCurrentBatchConfig,at=0,rn=null,qt=null,bn=0,wr=0,ma=yi(0),Zt=0,Du=null,gl=0,rm=0,T0=0,Jc=null,sr=null,A0=0,za=1/0,Qs=null,Ih=!1,ak=null,ri=null,Xd=!1,qo=null,Dh=0,Qc=0,ck=null,Kf=-1,qf=0;function Jn(){return at&6?Wt():Kf!==-1?Kf:Kf=Wt()}function si(e){return e.mode&1?at&2&&bn!==0?bn&-bn:Oz.transition!==null?(qf===0&&(qf=Mj()),qf):(e=pt,e!==0||(e=window.event,e=e===void 0?16:$j(e.type)),e):1}function ss(e,t,n,r){if(50<Qc)throw Qc=0,ck=null,Error(ue(185));nd(e,n,r),(!(at&2)||e!==rn)&&(e===rn&&(!(at&2)&&(rm|=n),Zt===4&&Ho(e,bn)),cr(e,r),n===1&&at===0&&!(t.mode&1)&&(za=Wt()+500,Zp&&wi()))}function cr(e,t){var n=e.callbackNode;O$(e,t);var r=yh(e,e===rn?bn:0);if(r===0)n!==null&&V1(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&V1(n),t===1)e.tag===0?Rz($S.bind(null,e)):nM($S.bind(null,e)),Tz(function(){!(at&6)&&wi()}),n=null;else{switch(Rj(r)){case 1:n=e0;break;case 4:n=Aj;break;case 16:n=gh;break;case 536870912:n=jj;break;default:n=gh}n=eR(n,qM.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function qM(e,t){if(Kf=-1,qf=0,at&6)throw Error(ue(327));var n=e.callbackNode;if(Ta()&&e.callbackNode!==n)return null;var r=yh(e,e===rn?bn:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Lh(e,r);else{t=r;var s=at;at|=2;var o=GM();(rn!==e||bn!==t)&&(Qs=null,za=Wt()+500,tl(e,t));do try{Xz();break}catch(l){YM(e,l)}while(!0);h0(),Oh.current=o,at=s,qt!==null?t=0:(rn=null,bn=0,t=Zt)}if(t!==0){if(t===2&&(s=Pw(e),s!==0&&(r=s,t=uk(e,s))),t===1)throw n=Du,tl(e,0),Ho(e,r),cr(e,Wt()),n;if(t===6)Ho(e,r);else{if(s=e.current.alternate,!(r&30)&&!Jz(s)&&(t=Lh(e,r),t===2&&(o=Pw(e),o!==0&&(r=o,t=uk(e,o))),t===1))throw n=Du,tl(e,0),Ho(e,r),cr(e,Wt()),n;switch(e.finishedWork=s,e.finishedLanes=r,t){case 0:case 1:throw Error(ue(345));case 2:zi(e,sr,Qs);break;case 3:if(Ho(e,r),(r&130023424)===r&&(t=A0+500-Wt(),10<t)){if(yh(e,0)!==0)break;if(s=e.suspendedLanes,(s&r)!==r){Jn(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=Uw(zi.bind(null,e,sr,Qs),t);break}zi(e,sr,Qs);break;case 4:if(Ho(e,r),(r&4194240)===r)break;for(t=e.eventTimes,s=-1;0<r;){var i=31-rs(r);o=1<<i,i=t[i],i>s&&(s=i),r&=~o}if(r=s,r=Wt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Gz(r/1960))-r,10<r){e.timeoutHandle=Uw(zi.bind(null,e,sr,Qs),r);break}zi(e,sr,Qs);break;case 5:zi(e,sr,Qs);break;default:throw Error(ue(329))}}}return cr(e,Wt()),e.callbackNode===n?qM.bind(null,e):null}function uk(e,t){var n=Jc;return e.current.memoizedState.isDehydrated&&(tl(e,t).flags|=256),e=Lh(e,t),e!==2&&(t=sr,sr=n,t!==null&&dk(t)),e}function dk(e){sr===null?sr=e:sr.push.apply(sr,e)}function Jz(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var s=n[r],o=s.getSnapshot;s=s.value;try{if(!cs(o(),s))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Ho(e,t){for(t&=~T0,t&=~rm,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-rs(t),r=1<<n;e[n]=-1,t&=~r}}function $S(e){if(at&6)throw Error(ue(327));Ta();var t=yh(e,0);if(!(t&1))return cr(e,Wt()),null;var n=Lh(e,t);if(e.tag!==0&&n===2){var r=Pw(e);r!==0&&(t=r,n=uk(e,r))}if(n===1)throw n=Du,tl(e,0),Ho(e,t),cr(e,Wt()),n;if(n===6)throw Error(ue(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,zi(e,sr,Qs),cr(e,Wt()),null}function j0(e,t){var n=at;at|=1;try{return e(t)}finally{at=n,at===0&&(za=Wt()+500,Zp&&wi())}}function yl(e){qo!==null&&qo.tag===0&&!(at&6)&&Ta();var t=at;at|=1;var n=Br.transition,r=pt;try{if(Br.transition=null,pt=1,e)return e()}finally{pt=r,Br.transition=n,at=t,!(at&6)&&wi()}}function M0(){wr=ma.current,Tt(ma)}function tl(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Nz(n)),qt!==null)for(n=qt.return;n!==null;){var r=n;switch(u0(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&vh();break;case 3:Pa(),Tt(lr),Tt(_n),k0();break;case 5:w0(r);break;case 4:Pa();break;case 13:Tt(Rt);break;case 19:Tt(Rt);break;case 10:p0(r.type._context);break;case 22:case 23:M0()}n=n.return}if(rn=e,qt=e=oi(e.current,null),bn=wr=t,Zt=0,Du=null,T0=rm=gl=0,sr=Jc=null,Vi!==null){for(t=0;t<Vi.length;t++)if(n=Vi[t],r=n.interleaved,r!==null){n.interleaved=null;var s=r.next,o=n.pending;if(o!==null){var i=o.next;o.next=s,r.next=i}n.pending=r}Vi=null}return e}function YM(e,t){do{var n=qt;try{if(h0(),Wf.current=Rh,Mh){for(var r=It.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}Mh=!1}if(ml=0,nn=Xt=It=null,Yc=!1,Ru=0,N0.current=null,n===null||n.return===null){Zt=1,Du=t,qt=null;break}e:{var o=e,i=n.return,l=n,a=t;if(t=bn,l.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){var c=a,u=l,f=u.tag;if(!(u.mode&1)&&(f===0||f===11||f===15)){var h=u.alternate;h?(u.updateQueue=h.updateQueue,u.memoizedState=h.memoizedState,u.lanes=h.lanes):(u.updateQueue=null,u.memoizedState=null)}var p=CS(i);if(p!==null){p.flags&=-257,ES(p,i,l,o,t),p.mode&1&&SS(o,c,t),t=p,a=c;var m=t.updateQueue;if(m===null){var y=new Set;y.add(a),t.updateQueue=y}else m.add(a);break e}else{if(!(t&1)){SS(o,c,t),R0();break e}a=Error(ue(426))}}else if(Mt&&l.mode&1){var x=CS(i);if(x!==null){!(x.flags&65536)&&(x.flags|=256),ES(x,i,l,o,t),d0($a(a,l));break e}}o=a=$a(a,l),Zt!==4&&(Zt=2),Jc===null?Jc=[o]:Jc.push(o),o=i;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var k=RM(o,a,t);yS(o,k);break e;case 1:l=a;var v=o.type,b=o.stateNode;if(!(o.flags&128)&&(typeof v.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(ri===null||!ri.has(b)))){o.flags|=65536,t&=-t,o.lanes|=t;var E=OM(o,l,t);yS(o,E);break e}}o=o.return}while(o!==null)}QM(n)}catch(N){t=N,qt===n&&n!==null&&(qt=n=n.return);continue}break}while(!0)}function GM(){var e=Oh.current;return Oh.current=Rh,e===null?Rh:e}function R0(){(Zt===0||Zt===3||Zt===2)&&(Zt=4),rn===null||!(gl&268435455)&&!(rm&268435455)||Ho(rn,bn)}function Lh(e,t){var n=at;at|=2;var r=GM();(rn!==e||bn!==t)&&(Qs=null,tl(e,t));do try{Qz();break}catch(s){YM(e,s)}while(!0);if(h0(),at=n,Oh.current=r,qt!==null)throw Error(ue(261));return rn=null,bn=0,Zt}function Qz(){for(;qt!==null;)JM(qt)}function Xz(){for(;qt!==null&&!S$();)JM(qt)}function JM(e){var t=ZM(e.alternate,e,wr);e.memoizedProps=e.pendingProps,t===null?QM(e):qt=t,N0.current=null}function QM(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=Vz(n,t),n!==null){n.flags&=32767,qt=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Zt=6,qt=null;return}}else if(n=Uz(n,t,wr),n!==null){qt=n;return}if(t=t.sibling,t!==null){qt=t;return}qt=t=e}while(t!==null);Zt===0&&(Zt=5)}function zi(e,t,n){var r=pt,s=Br.transition;try{Br.transition=null,pt=1,Zz(e,t,n,r)}finally{Br.transition=s,pt=r}return null}function Zz(e,t,n,r){do Ta();while(qo!==null);if(at&6)throw Error(ue(327));n=e.finishedWork;var s=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(ue(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(I$(e,o),e===rn&&(qt=rn=null,bn=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Xd||(Xd=!0,eR(gh,function(){return Ta(),null})),o=(n.flags&15990)!==0,n.subtreeFlags&15990||o){o=Br.transition,Br.transition=null;var i=pt;pt=1;var l=at;at|=4,N0.current=null,qz(e,n),VM(n,e),kz(Hw),wh=!!Bw,Hw=Bw=null,e.current=n,Yz(n),C$(),at=l,pt=i,Br.transition=o}else e.current=n;if(Xd&&(Xd=!1,qo=e,Dh=s),o=e.pendingLanes,o===0&&(ri=null),T$(n.stateNode),cr(e,Wt()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)s=t[n],r(s.value,{componentStack:s.stack,digest:s.digest});if(Ih)throw Ih=!1,e=ak,ak=null,e;return Dh&1&&e.tag!==0&&Ta(),o=e.pendingLanes,o&1?e===ck?Qc++:(Qc=0,ck=e):Qc=0,wi(),null}function Ta(){if(qo!==null){var e=Rj(Dh),t=Br.transition,n=pt;try{if(Br.transition=null,pt=16>e?16:e,qo===null)var r=!1;else{if(e=qo,qo=null,Dh=0,at&6)throw Error(ue(331));var s=at;for(at|=4,Ne=e.current;Ne!==null;){var o=Ne,i=o.child;if(Ne.flags&16){var l=o.deletions;if(l!==null){for(var a=0;a<l.length;a++){var c=l[a];for(Ne=c;Ne!==null;){var u=Ne;switch(u.tag){case 0:case 11:case 15:Gc(8,u,o)}var f=u.child;if(f!==null)f.return=u,Ne=f;else for(;Ne!==null;){u=Ne;var h=u.sibling,p=u.return;if(HM(u),u===c){Ne=null;break}if(h!==null){h.return=p,Ne=h;break}Ne=p}}}var m=o.alternate;if(m!==null){var y=m.child;if(y!==null){m.child=null;do{var x=y.sibling;y.sibling=null,y=x}while(y!==null)}}Ne=o}}if(o.subtreeFlags&2064&&i!==null)i.return=o,Ne=i;else e:for(;Ne!==null;){if(o=Ne,o.flags&2048)switch(o.tag){case 0:case 11:case 15:Gc(9,o,o.return)}var k=o.sibling;if(k!==null){k.return=o.return,Ne=k;break e}Ne=o.return}}var v=e.current;for(Ne=v;Ne!==null;){i=Ne;var b=i.child;if(i.subtreeFlags&2064&&b!==null)b.return=i,Ne=b;else e:for(i=v;Ne!==null;){if(l=Ne,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:nm(9,l)}}catch(N){$t(l,l.return,N)}if(l===i){Ne=null;break e}var E=l.sibling;if(E!==null){E.return=l.return,Ne=E;break e}Ne=l.return}}if(at=s,wi(),js&&typeof js.onPostCommitFiberRoot=="function")try{js.onPostCommitFiberRoot(Yp,e)}catch{}r=!0}return r}finally{pt=n,Br.transition=t}}return!1}function zS(e,t,n){t=$a(n,t),t=RM(e,t,1),e=ni(e,t,1),t=Jn(),e!==null&&(nd(e,1,t),cr(e,t))}function $t(e,t,n){if(e.tag===3)zS(e,e,n);else for(;t!==null;){if(t.tag===3){zS(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(ri===null||!ri.has(r))){e=$a(n,e),e=OM(t,e,1),t=ni(t,e,1),e=Jn(),t!==null&&(nd(t,1,e),cr(t,e));break}}t=t.return}}function e_(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Jn(),e.pingedLanes|=e.suspendedLanes&n,rn===e&&(bn&n)===n&&(Zt===4||Zt===3&&(bn&130023424)===bn&&500>Wt()-A0?tl(e,0):T0|=n),cr(e,t)}function XM(e,t){t===0&&(e.mode&1?(t=Hd,Hd<<=1,!(Hd&130023424)&&(Hd=4194304)):t=1);var n=Jn();e=ho(e,t),e!==null&&(nd(e,t,n),cr(e,n))}function t_(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),XM(e,n)}function n_(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(ue(314))}r!==null&&r.delete(t),XM(e,n)}var ZM;ZM=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||lr.current)ir=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return ir=!1,Wz(e,t,n);ir=!!(e.flags&131072)}else ir=!1,Mt&&t.flags&1048576&&rM(t,Eh,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Vf(e,t),e=t.pendingProps;var s=Ia(t,_n.current);Na(t,n),s=b0(null,t,r,e,s,n);var o=v0();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ar(r)?(o=!0,Sh(t)):o=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,g0(t),s.updater=tm,t.stateNode=s,s._reactInternals=t,Qw(t,r,e,n),t=ek(null,t,r,!0,o,n)):(t.tag=0,Mt&&o&&c0(t),Yn(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Vf(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=s_(r),e=Qr(r,e),s){case 0:t=Zw(null,t,r,e,n);break e;case 1:t=AS(null,t,r,e,n);break e;case 11:t=NS(null,t,r,e,n);break e;case 14:t=TS(null,t,r,Qr(r.type,e),n);break e}throw Error(ue(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Qr(r,s),Zw(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Qr(r,s),AS(e,t,r,s,n);case 3:e:{if(PM(t),e===null)throw Error(ue(387));r=t.pendingProps,o=t.memoizedState,s=o.element,cM(e,t),Ah(t,r,null,n);var i=t.memoizedState;if(r=i.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){s=$a(Error(ue(423)),t),t=jS(e,t,r,n,s);break e}else if(r!==s){s=$a(Error(ue(424)),t),t=jS(e,t,r,n,s);break e}else for(br=ti(t.stateNode.containerInfo.firstChild),vr=t,Mt=!0,Zr=null,n=lM(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Da(),r===s){t=po(e,t,n);break e}Yn(e,t,r,n)}t=t.child}return t;case 5:return uM(t),e===null&&Yw(t),r=t.type,s=t.pendingProps,o=e!==null?e.memoizedProps:null,i=s.children,Ww(r,s)?i=null:o!==null&&Ww(r,o)&&(t.flags|=32),LM(e,t),Yn(e,t,i,n),t.child;case 6:return e===null&&Yw(t),null;case 13:return $M(e,t,n);case 4:return y0(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=La(t,null,r,n):Yn(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Qr(r,s),NS(e,t,r,s,n);case 7:return Yn(e,t,t.pendingProps,n),t.child;case 8:return Yn(e,t,t.pendingProps.children,n),t.child;case 12:return Yn(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,o=t.memoizedProps,i=s.value,vt(Nh,r._currentValue),r._currentValue=i,o!==null)if(cs(o.value,i)){if(o.children===s.children&&!lr.current){t=po(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var l=o.dependencies;if(l!==null){i=o.child;for(var a=l.firstContext;a!==null;){if(a.context===r){if(o.tag===1){a=lo(-1,n&-n),a.tag=2;var c=o.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?a.next=a:(a.next=u.next,u.next=a),c.pending=a}}o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),Gw(o.return,n,t),l.lanes|=n;break}a=a.next}}else if(o.tag===10)i=o.type===t.type?null:o.child;else if(o.tag===18){if(i=o.return,i===null)throw Error(ue(341));i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),Gw(i,n,t),i=o.sibling}else i=o.child;if(i!==null)i.return=o;else for(i=o;i!==null;){if(i===t){i=null;break}if(o=i.sibling,o!==null){o.return=i.return,i=o;break}i=i.return}o=i}Yn(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,Na(t,n),s=Ur(s),r=r(s),t.flags|=1,Yn(e,t,r,n),t.child;case 14:return r=t.type,s=Qr(r,t.pendingProps),s=Qr(r.type,s),TS(e,t,r,s,n);case 15:return IM(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Qr(r,s),Vf(e,t),t.tag=1,ar(r)?(e=!0,Sh(t)):e=!1,Na(t,n),MM(t,r,s),Qw(t,r,s,n),ek(null,t,r,!0,e,n);case 19:return zM(e,t,n);case 22:return DM(e,t,n)}throw Error(ue(156,t.tag))};function eR(e,t){return Tj(e,t)}function r_(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function _r(e,t,n,r){return new r_(e,t,n,r)}function O0(e){return e=e.prototype,!(!e||!e.isReactComponent)}function s_(e){if(typeof e=="function")return O0(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Qx)return 11;if(e===Xx)return 14}return 2}function oi(e,t){var n=e.alternate;return n===null?(n=_r(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Yf(e,t,n,r,s,o){var i=2;if(r=e,typeof e=="function")O0(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case oa:return nl(n.children,s,o,t);case Jx:i=8,s|=8;break;case bw:return e=_r(12,n,t,s|2),e.elementType=bw,e.lanes=o,e;case vw:return e=_r(13,n,t,s),e.elementType=vw,e.lanes=o,e;case Sw:return e=_r(19,n,t,s),e.elementType=Sw,e.lanes=o,e;case uj:return sm(n,s,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case aj:i=10;break e;case cj:i=9;break e;case Qx:i=11;break e;case Xx:i=14;break e;case Po:i=16,r=null;break e}throw Error(ue(130,e==null?e:typeof e,""))}return t=_r(i,n,t,s),t.elementType=e,t.type=r,t.lanes=o,t}function nl(e,t,n,r){return e=_r(7,e,r,t),e.lanes=n,e}function sm(e,t,n,r){return e=_r(22,e,r,t),e.elementType=uj,e.lanes=n,e.stateNode={isHidden:!1},e}function Vg(e,t,n){return e=_r(6,e,null,t),e.lanes=n,e}function Kg(e,t,n){return t=_r(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function o_(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ng(0),this.expirationTimes=Ng(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ng(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function I0(e,t,n,r,s,o,i,l,a){return e=new o_(e,t,n,l,a),t===1?(t=1,o===!0&&(t|=8)):t=0,o=_r(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},g0(o),e}function i_(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:sa,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function tR(e){if(!e)return hi;e=e._reactInternals;e:{if(Al(e)!==e||e.tag!==1)throw Error(ue(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(ar(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(ue(171))}if(e.tag===1){var n=e.type;if(ar(n))return tM(e,n,t)}return t}function nR(e,t,n,r,s,o,i,l,a){return e=I0(n,r,!0,e,s,o,i,l,a),e.context=tR(null),n=e.current,r=Jn(),s=si(n),o=lo(r,s),o.callback=t??null,ni(n,o,s),e.current.lanes=s,nd(e,s,r),cr(e,r),e}function om(e,t,n,r){var s=t.current,o=Jn(),i=si(s);return n=tR(n),t.context===null?t.context=n:t.pendingContext=n,t=lo(o,i),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=ni(s,t,i),e!==null&&(ss(e,s,i,o),Hf(e,s,i)),i}function Ph(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function _S(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function D0(e,t){_S(e,t),(e=e.alternate)&&_S(e,t)}function l_(){return null}var rR=typeof reportError=="function"?reportError:function(e){console.error(e)};function L0(e){this._internalRoot=e}im.prototype.render=L0.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(ue(409));om(e,t,null,null)};im.prototype.unmount=L0.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;yl(function(){om(null,e,null,null)}),t[fo]=null}};function im(e){this._internalRoot=e}im.prototype.unstable_scheduleHydration=function(e){if(e){var t=Dj();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Bo.length&&t!==0&&t<Bo[n].priority;n++);Bo.splice(n,0,e),n===0&&Pj(e)}};function P0(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function lm(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function FS(){}function a_(e,t,n,r,s){if(s){if(typeof r=="function"){var o=r;r=function(){var c=Ph(i);o.call(c)}}var i=nR(t,r,e,0,null,!1,!1,"",FS);return e._reactRootContainer=i,e[fo]=i.current,Nu(e.nodeType===8?e.parentNode:e),yl(),i}for(;s=e.lastChild;)e.removeChild(s);if(typeof r=="function"){var l=r;r=function(){var c=Ph(a);l.call(c)}}var a=I0(e,0,!1,null,null,!1,!1,"",FS);return e._reactRootContainer=a,e[fo]=a.current,Nu(e.nodeType===8?e.parentNode:e),yl(function(){om(t,a,n,r)}),a}function am(e,t,n,r,s){var o=n._reactRootContainer;if(o){var i=o;if(typeof s=="function"){var l=s;s=function(){var a=Ph(i);l.call(a)}}om(t,i,e,s)}else i=a_(n,t,e,s,r);return Ph(i)}Oj=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Rc(t.pendingLanes);n!==0&&(t0(t,n|1),cr(t,Wt()),!(at&6)&&(za=Wt()+500,wi()))}break;case 13:yl(function(){var r=ho(e,1);if(r!==null){var s=Jn();ss(r,e,1,s)}}),D0(e,1)}};n0=function(e){if(e.tag===13){var t=ho(e,134217728);if(t!==null){var n=Jn();ss(t,e,134217728,n)}D0(e,134217728)}};Ij=function(e){if(e.tag===13){var t=si(e),n=ho(e,t);if(n!==null){var r=Jn();ss(n,e,t,r)}D0(e,t)}};Dj=function(){return pt};Lj=function(e,t){var n=pt;try{return pt=e,t()}finally{pt=n}};Iw=function(e,t,n){switch(t){case"input":if(Nw(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var s=Xp(r);if(!s)throw Error(ue(90));fj(r),Nw(r,s)}}}break;case"textarea":pj(e,n);break;case"select":t=n.value,t!=null&&va(e,!!n.multiple,t,!1)}};bj=j0;vj=yl;var c_={usingClientEntryPoint:!1,Events:[sd,ca,Xp,kj,xj,j0]},xc={findFiberByHostInstance:Ui,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},u_={bundleType:xc.bundleType,version:xc.version,rendererPackageName:xc.rendererPackageName,rendererConfig:xc.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:yo.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Ej(e),e===null?null:e.stateNode},findFiberByHostInstance:xc.findFiberByHostInstance||l_,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Zd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Zd.isDisabled&&Zd.supportsFiber)try{Yp=Zd.inject(u_),js=Zd}catch{}}Nr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=c_;Nr.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!P0(t))throw Error(ue(200));return i_(e,t,null,n)};Nr.createRoot=function(e,t){if(!P0(e))throw Error(ue(299));var n=!1,r="",s=rR;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=I0(e,1,!1,null,null,n,!1,r,s),e[fo]=t.current,Nu(e.nodeType===8?e.parentNode:e),new L0(t)};Nr.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(ue(188)):(e=Object.keys(e).join(","),Error(ue(268,e)));return e=Ej(t),e=e===null?null:e.stateNode,e};Nr.flushSync=function(e){return yl(e)};Nr.hydrate=function(e,t,n){if(!lm(t))throw Error(ue(200));return am(null,e,t,!0,n)};Nr.hydrateRoot=function(e,t,n){if(!P0(e))throw Error(ue(405));var r=n!=null&&n.hydratedSources||null,s=!1,o="",i=rR;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(i=n.onRecoverableError)),t=nR(t,null,e,1,n??null,s,!1,o,i),e[fo]=t.current,Nu(e),r)for(e=0;e<r.length;e++)n=r[e],s=n._getVersion,s=s(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,s]:t.mutableSourceEagerHydrationData.push(n,s);return new im(t)};Nr.render=function(e,t,n){if(!lm(t))throw Error(ue(200));return am(null,e,t,!1,n)};Nr.unmountComponentAtNode=function(e){if(!lm(e))throw Error(ue(40));return e._reactRootContainer?(yl(function(){am(null,null,e,!1,function(){e._reactRootContainer=null,e[fo]=null})}),!0):!1};Nr.unstable_batchedUpdates=j0;Nr.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!lm(n))throw Error(ue(200));if(e==null||e._reactInternals===void 0)throw Error(ue(38));return am(e,t,n,!1,r)};Nr.version="18.3.1-next-f1338f8080-20240426";function sR(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(sR)}catch(e){console.error(e)}}sR(),sj.exports=Nr;var ki=sj.exports;const d_=Kp(ki);var oR,BS=ki;oR=kw.createRoot=BS.createRoot,kw.hydrateRoot=BS.hydrateRoot;function f_(e,t,n){const r=new URLSearchParams(e),s=r.get("focus");if(s==="1")return n[0];if(r.get("fixtures")==="1")return t.find(o=>o.id===s)}function $h(e){return`runs/${e}/the-change-it-made.change`}function qg(e){return{name:e,children:new Map,file:null}}function iR(e){const t=qg("");for(const s of e){const o=String(s.path).split("/").filter(Boolean);let i=t;for(const c of o.slice(0,-1))i.children.has(c)||i.children.set(c,qg(c)),i=i.children.get(c);const l=o[o.length-1]??s.path,a=qg(l);a.file=s,i.children.set(l,a)}const n=[],r=(s,o,i)=>{const l=[...s.children.values()],a=l.filter(u=>!u.file).sort((u,f)=>u.name.localeCompare(f.name)),c=l.filter(u=>u.file).sort((u,f)=>u.name.localeCompare(f.name));for(const u of a){let f=u.name,h=u;for(;h.children.size===1;){const m=[...h.children.values()][0];if(m.file)break;f+=`/${m.name}`,h=m}const p=lR(h);n.push({kind:"folder",label:f,depth:o,key:`${i}${f}/`,plus:p.reduce((m,y)=>m+(y.plus??0),0),minus:p.reduce((m,y)=>m+(y.minus??0),0),files:p.length}),r(h,o+1,`${i}${f}/`)}for(const u of c)n.push({kind:"file",label:u.name,depth:o,key:u.file.path,path:u.file.path,plus:u.file.plus??0,minus:u.file.minus??0})};return r(t,0,""),n}function lR(e){return e.file?[e.file]:[...e.children.values()].flatMap(lR)}function HS(e,t){const n=[];let r=null;for(const s of e)r!==null&&s.depth>r||(r=null,n.push(s),s.kind==="folder"&&t.has(s.key)&&(r=s.depth));return n}function h_(e){return e===1?"1 file":`${e} files`}function p_(e){var n;const t=((n=e.files)==null?void 0:n.length)??0;return`${h_(t)} +${e.plus??0} −${e.minus??0}`}function m_(e){const t=e.startedAt??0,n=e.endedAt??0;if(!t||!n||n<=t)return"";const r=Math.round((n-t)/6e4);if(r<1)return"under a minute";if(r===1)return"1 minute";if(r<60)return`${r} minutes`;const s=Math.round(r/60);return s===1?"1 hour":`${s} hours`}const g_=new Set(["const","let","var","function","return","if","else","for","while","of","in","import","from","export","default","class","extends","new","await","async","try","catch","finally","throw","typeof","instanceof","delete","void","type","interface","enum","as","null","undefined","true","false","this","switch","case","break","continue","do","yield","static","public","private"]);function aR(e){const t=[],n=(i,l)=>{l&&t.push({c:i,s:l})};let r=0,s="";const o=()=>{n("",s),s=""};for(;r<e.length;){const i=e.slice(r),l=i.slice(0,2);if(l==="//"||l==="/*"||i[0]==="#"&&/^#(!|\s)/.test(i))return o(),n("com",i),t;const a=i[0];if(a==='"'||a==="'"||a==="`"){let f=1;for(;f<i.length;){if(i[f]==="\\"){f+=2;continue}if(i[f]===a){f+=1;break}f+=1}o(),n("str",i.slice(0,f)),r+=f;continue}const c=i.match(/^[A-Za-z_$][\w$]*/);if(c){const f=c[0];o(),g_.has(f)?n("kw",f):/^[A-Z]/.test(f)?n("typ",f):n("",f),r+=f.length;continue}const u=i.match(/^\d[\d_.a-fA-FxX]*/);if(u){o(),n("num",u[0]),r+=u[0].length;continue}s+=i[0],r+=1}return o(),t}function y_(e){return{rows:e,hidden:0}}function w_(e){return e.map((t,n)=>n)}const k_=18.6,x_=4;function WS(e,t){var l,a,c,u,f;const n=(a=e==null?void 0:e.nums)==null?void 0:a[(((l=e.nums)==null?void 0:l.length)??0)-1],r=(c=t==null?void 0:t.nums)==null?void 0:c[0];if(!n||!r)return null;const s=(u=[...(e==null?void 0:e.nums)??[]].reverse().find(h=>h[1]!=null))==null?void 0:u[1],o=(f=((t==null?void 0:t.nums)??[]).find(h=>h[1]!=null))==null?void 0:f[1];if(s==null||o==null)return null;const i=o-s-1;return i>0?i:null}function b_(e){return Math.round(e*k_+x_)}function v_(e){const t=new Map(iR(e).filter(n=>n.kind==="file").map((n,r)=>[n.path,r]));return[...e].sort((n,r)=>(t.get(n.path)??0)-(t.get(r.path)??0))}function fk(e,t){return e&&new URLSearchParams(t).has("reviewLab")}function S_(e,t,n="approve"){const r=n==="feedback"?`Feedback on ${t}:`:`Looks good: ${t}`;return e.split(`
41
+ `).includes(r)?e:e?`${e}
42
+
43
+ ${r}`:r}function C_(e){return e.slice(0,6).map(([t,n],r)=>({mark:t,text:n,line:r+1}))}function E_(e){return{visible:e.slice(0,3),remaining:Math.max(0,e.length-3),total:e.length}}const N_=aR;function T_(e){return e>1?"Review all files":e===1?"Review full file":"Open preview"}function A_(e,t){return t===void 0?e.split(/[?#]/)[0].split("/").pop()||e:`Code changes · ${t} file${t===1?"":"s"}`}async function j_({send:e,accepted:t,failed:n}){try{await e()}catch(r){return await n(r),!1}return await t(),!0}function M_({target:e,children:t}){const[n]=w.useState(()=>{const r=document.createElement("div");return r.className="artifact-host",r});return w.useLayoutEffect(()=>{if(e)return e.appendChild(n),()=>{n.remove()}},[e,n]),ki.createPortal(t,n)}function R_(e,t){return e==="beside"&&t<1e3?"focus":e}function O_(e,t){return Math.max(560/t,Math.min(1-400/t,e))}function cR(e){try{const t=new URL(e);return["http:","https:"].includes(t.protocol)&&["localhost","127.0.0.1","[::1]"].includes(t.hostname)}catch{return!1}}const I_=1800,US={width:260,height:110};function D_(e){return e.reaching||e.awake}const L_=""+new URL("cel-dusk-sm-BBkV-tWT.webp",import.meta.url).href,P_=""+new URL("cel-dusk-CS5I7kJS.webp",import.meta.url).href,$_=""+new URL("frost-haze-sm-C_w21qgd.webp",import.meta.url).href,z_=""+new URL("frost-haze-CxPSOBEg.webp",import.meta.url).href,__=""+new URL("gouache-valley-sm-CdLjT5Ec.webp",import.meta.url).href,F_=""+new URL("gouache-valley-d9qasI6k.webp",import.meta.url).href,B_=""+new URL("ice-river-sm-Bg1U-SIj.webp",import.meta.url).href,H_=""+new URL("ice-river-UVM2-JY_.webp",import.meta.url).href,W_=""+new URL("ice-sm-CbVcg3_D.webp",import.meta.url).href,U_=""+new URL("ice-BC8luINc.webp",import.meta.url).href,V_=""+new URL("lake-harbour-sm-Cme_ShEg.webp",import.meta.url).href,K_=""+new URL("lake-harbour-Te1pEvBh.webp",import.meta.url).href,q_=""+new URL("lake-sm-CbG72Hbv.webp",import.meta.url).href,Y_=""+new URL("lake-ETGcOb25.webp",import.meta.url).href,G_=""+new URL("lino-coast-sm-C1Mdbgit.webp",import.meta.url).href,J_=""+new URL("lino-coast-kOIAffr_.webp",import.meta.url).href,Q_=""+new URL("moon-pines-sm-C6K1NomK.webp",import.meta.url).href,X_=""+new URL("moon-pines-CFSIIwt0.webp",import.meta.url).href,Z_=""+new URL("orbit-rings-sm-Dky3YdvL.webp",import.meta.url).href,eF=""+new URL("orbit-rings-2XV36Ch3.webp",import.meta.url).href,tF=""+new URL("peach-haze-2-sm-Dj_Ez_Sb.webp",import.meta.url).href,nF=""+new URL("peach-haze-2-C6f7xnWw.webp",import.meta.url).href,rF=""+new URL("pixel-harbour-sm-Dturjuky.webp",import.meta.url).href,sF=""+new URL("pixel-harbour-Dw71H_bc.webp",import.meta.url).href,oF=""+new URL("pixel-orbit-sm-CHagC_nO.webp",import.meta.url).href,iF=""+new URL("pixel-orbit-C296JVMO.webp",import.meta.url).href,lF=""+new URL("pixel-ridge-sm-BnE0F_w-.webp",import.meta.url).href,aF=""+new URL("pixel-ridge-C6LYu6uE.webp",import.meta.url).href,cF=""+new URL("riso-hills-sm-DHsnbCfP.webp",import.meta.url).href,uF=""+new URL("riso-hills-7heKVtry.webp",import.meta.url).href,dF=""+new URL("slate-haze-sm-B0Cb5a2W.webp",import.meta.url).href,fF=""+new URL("slate-haze-BPWdkNsw.webp",import.meta.url).href,hF=""+new URL("valley-haze-sm-CTyjmPAG.webp",import.meta.url).href,pF=""+new URL("valley-haze-BDHPqoJy.webp",import.meta.url).href,mF=""+new URL("vector-dunes-sm-D8MYY6ms.webp",import.meta.url).href,gF=""+new URL("vector-dunes-Yr9NBQUy.webp",import.meta.url).href,yF=""+new URL("watercolour-mist-sm-Ds1xzTw9.webp",import.meta.url).href,wF=""+new URL("watercolour-mist-BF-jk5MC.webp",import.meta.url).href,kF=""+new URL("woodblock-sea-sm-BJzNq8xh.webp",import.meta.url).href,xF=""+new URL("woodblock-sea-DKQdYs32.webp",import.meta.url).href,VS=Object.fromEntries(Object.entries(Object.assign({"./assets/cel-dusk-sm.webp":L_,"./assets/cel-dusk.webp":P_,"./assets/frost-haze-sm.webp":$_,"./assets/frost-haze.webp":z_,"./assets/gouache-valley-sm.webp":__,"./assets/gouache-valley.webp":F_,"./assets/ice-river-sm.webp":B_,"./assets/ice-river.webp":H_,"./assets/ice-sm.webp":W_,"./assets/ice.webp":U_,"./assets/lake-harbour-sm.webp":V_,"./assets/lake-harbour.webp":K_,"./assets/lake-sm.webp":q_,"./assets/lake.webp":Y_,"./assets/lino-coast-sm.webp":G_,"./assets/lino-coast.webp":J_,"./assets/moon-pines-sm.webp":Q_,"./assets/moon-pines.webp":X_,"./assets/orbit-rings-sm.webp":Z_,"./assets/orbit-rings.webp":eF,"./assets/peach-haze-2-sm.webp":tF,"./assets/peach-haze-2.webp":nF,"./assets/pixel-harbour-sm.webp":rF,"./assets/pixel-harbour.webp":sF,"./assets/pixel-orbit-sm.webp":oF,"./assets/pixel-orbit.webp":iF,"./assets/pixel-ridge-sm.webp":lF,"./assets/pixel-ridge.webp":aF,"./assets/riso-hills-sm.webp":cF,"./assets/riso-hills.webp":uF,"./assets/slate-haze-sm.webp":dF,"./assets/slate-haze.webp":fF,"./assets/valley-haze-sm.webp":hF,"./assets/valley-haze.webp":pF,"./assets/vector-dunes-sm.webp":mF,"./assets/vector-dunes.webp":gF,"./assets/watercolour-mist-sm.webp":yF,"./assets/watercolour-mist.webp":wF,"./assets/woodblock-sea-sm.webp":kF,"./assets/woodblock-sea.webp":xF})).map(([e,t])=>[e.replace("./assets/","").replace(".webp",""),t])),bF={"orbital-glass":"orbit-rings"};function vF(e,t){if(e==="none")return null;const n=bF[e]??e;return VS[t?`${n}-sm`:n]??VS[n]??null}const KS=new Map,SF=700;function Aa(e){if(typeof document>"u")return Promise.resolve();const t=document.documentElement.getAttribute("data-skin-detail")==="soft",n=vF(e,t);if(!n)return Promise.resolve();let r=KS.get(n);if(!r){const s=new Image;s.decoding="async",s.src=n,r=s.decode().catch(()=>{}),KS.set(n,r)}return Promise.race([r,new Promise(s=>setTimeout(s,SF))])}function CF(e){const t=document.documentElement,n=()=>{t.setAttribute("data-look-switching",""),e(),requestAnimationFrame(()=>requestAnimationFrame(()=>t.removeAttribute("data-look-switching")))},r=document;typeof r.startViewTransition=="function"?r.startViewTransition(n):n()}const uR={plus:4,minus:2,editCount:1,files:[{path:"renderer/src/components/ProjectStart.tsx",plus:4,minus:2,hunks:[{said:"Keep the first task in the inbox until the user reviews it.",rows:[["=","export function startProject(project: Project) {"],["-",' const task = createTask(project, { status: "running" });'],["-"," return startAgent(task);"],["+"," return createTask(project, {"],["+",' status: "inbox",'],["+",' title: "Ready to set up onboarding?",'],["+"," });"],["=","}"]]}]}]},EF=`# The first task
44
+
45
+ Starting a project should give you one clear next step.
46
+
47
+ ## Proposed behavior
48
+
49
+ - Place the proposal in the inbox.
50
+ - Wait for the user to review it.
51
+ - Begin work after their reply.
52
+
53
+ ## What stays the same
54
+
55
+ Existing tasks continue to run normally. The change only applies when a new project is created.
56
+
57
+ *Sample document for comparing artifact layouts.*`,NF={plus:10,minus:2,editCount:4,files:[...uR.files,...["renderer/src/project-defaults.ts","tests/project-start.test.ts","docs/project-start.md"].map((e,t)=>({path:e,plus:2,minus:0,hunks:[{said:"Keep new projects waiting for a reply.",rows:[["+",['export const initialStatus = "inbox";','expect(startProject(project).status).toBe("inbox");',"# Starting a project"][t]],["+",["export const autoStart = false;","expect(startAgent).not.toHaveBeenCalled();","New tasks wait for your reply before running."][t]]]}]}))]},pi=[{id:"claude",label:"Claude Code",word:"Claude Code"},{id:"codex",label:"Codex",word:"Codex"}],TF=pi.map(e=>e.id),Ft="claude";function qS(e){return typeof e=="string"&&TF.includes(e)}function id(e){var t;return((t=pi.find(n=>n.id===e))==null?void 0:t.label)??pi[0].label}const AF=[{alias:"opus",id:"claude-opus-5-5",label:"Opus 5.5",defaultLevel:"medium"},{alias:"claude-opus-5",id:"claude-opus-5",label:"Opus 5",defaultLevel:"high"},{alias:"sonnet",id:"claude-sonnet-5",label:"Sonnet 5",defaultLevel:"high"},{alias:"claude-sonnet-4-6",id:"claude-sonnet-4-6",label:"Sonnet 4.6",defaultLevel:null},{alias:"haiku",id:"claude-haiku-4-5",label:"Haiku 4.5",defaultLevel:null},{alias:"claude-3-5-haiku",id:"claude-3-5-haiku",label:"Haiku 3.5",defaultLevel:null},{alias:"fable",id:"claude-fable-5-1",label:"Fable 5.1",defaultLevel:"high"},{alias:"claude-fable-5",id:"claude-fable-5",label:"Fable 5",defaultLevel:"high"}],dR=AF.map(e=>({id:e.alias,label:e.label,model:e.id,defaultLevel:e.defaultLevel}));let fR=null;function jF(e){fR=Array.isArray(e)&&e.length?e:null}function hR(){return fR??dR}const $0="opus";function MF(e){const t=e??$0,n=hR();return n.some(s=>s.id===t)?n:[...n,{id:t,label:t}]}const Lu="";function xi(e,t=null){return e!=="codex"?$0:t??Lu}function pR(e,t,{codexModels:n=[],codexDefault:r=null}={}){if(e!=="codex")return MF(t);const s=t??xi(e,r);return s===Lu?[...n,{id:Lu,label:"Codex's own"}]:n.some(o=>o.id===s)?n:[...n,{id:s,label:s}]}function RF(e,t,n={}){var s;const r=t??xi(e,n.codexDefault??null);return((s=pR(e,r,n).find(o=>o.id===r))==null?void 0:s.label)??r}function OF(e,t,n=null){return!!t&&t!==xi(e,n)}const YS="zero.lastModel";function hk(e=null){return e==="codex"?`${YS}.codex`:YS}function Yg(e=globalThis.localStorage,t=null,n=null){try{const r=e==null?void 0:e.getItem(hk(t));return!r||r===xi(t,n)?null:r}catch{return null}}function IF(e,t=globalThis.localStorage,n=null,r=null){try{!e||e===xi(n,r)?t==null||t.removeItem(hk(n)):t==null||t.setItem(hk(n),e)}catch{}}const Le="agentbox",cm=Object.freeze(["Powerup","Astral","Zero"]),Pn=Le.charAt(0).toUpperCase()+Le.slice(1),mR=e=>String(e).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""),z0=mR(Le),DF=Object.freeze(cm.map(mR));Object.freeze([z0,...DF]);Object.freeze(cm.map(e=>e.toUpperCase().replace(/[^A-Z0-9]+/g,"_")));const te=Date.now(),Ce=6e4,lt=36e5,Ic={products:[{slug:"kestrel",dir:"/fixtures/kestrel",name:"Kestrel",oneLiner:"Collectible card games, made beautiful",repoPath:"/Users/you/Desktop/dev/kestrel"},{slug:"onboard",dir:"/fixtures/onboard",name:"Onboard",oneLiner:"Employee onboarding that runs itself",repoPath:null},{slug:"thicket",dir:"/fixtures/thicket",name:"Thicket",oneLiner:"Strength programming for busy people",repoPath:null}],items:[{id:"w-p0",product:"kestrel",productName:"Kestrel",status:"done",kind:"question",title:"The card art is finished and nothing is built. The build menu is the step you named before code.",body:'You said "not yet, we still need to design and plan before building." Design ended when you took the economy, so the menu is the only thing between Kestrel and its first line of code. Approving this gets you one page that says what the build menu makes.',labels:[],priority:2,epoch:4,claim:null,createdAt:te-40*Ce,updatedAt:te-27*Ce},{id:"w-p1",product:"kestrel",productName:"Kestrel",status:"blocked",kind:"task",parent:"w-p0",title:"The build menu has never started, six schedules in. One tap tomorrow may be all it needs.",body:["Every session this product has been given for two days started within fifteen seconds of you pushing the menu's hour, and at that instant the menu is the one row nobody is allowed to touch. So the product gets a drive session instead, and the hour you picked passes with nothing awake to notice it. I recommend a free test: tomorrow after 8am, open the inbox and do anything except push that hour again.","","## Where we were","You have set this row's hour six times, most recently a few minutes ago, for 8am tomorrow. Five drive sessions before this one read that as you picking the hour, which it is, and correctly filed nothing."].join(`
58
+ `),answer:"I think the next step is to design the art? We may need fal.ai to create the models, not sure how to best turn our art into something we can code with",labels:[],priority:2,epoch:5,claim:null,wrote:{answer:{ts:te-4*Ce,source:"founder"}},createdAt:te-17*Ce,updatedAt:te-4*Ce},{id:"w-p2",product:"kestrel",productName:"Kestrel",status:"open",kind:"question",parent:"w-p0",title:"The art needs a house style before any of it is generated.",body:"Three of the five sample cards came back in different lighting, so they cannot sit in one hand together. Fixing that after generation costs more than deciding it now. I recommend one page of style rules, written from the two cards you liked, against [round 3](designs/frame-round-3.html).",labels:[],priority:1,epoch:1,claim:null,createdAt:te-9*Ce,updatedAt:te-9*Ce},{id:"w-p3",product:"kestrel",productName:"Kestrel",status:"done",kind:"review",title:"The card frames are built, both sizes, and the art is ready. Merging is the only thing left.",body:["Someone who opens a booster now sees the new frame, and I recommend merging it. It is two components and one flag, and anyone who opens nothing sees pixel for pixel what they see today. The three sizes are in `designs/frame-round-3.html`.","","## Options","1. Merge it. It rides the next deploy (recommended)","2. Hold it behind the flag for a week"].join(`
59
+ `),answer:"Rejected. I do not want the frame changing before the art style is settled.",result:`Closed, because the thing this was blocked on came back as a no. You were asked to pick one of three redesigned frames and you refused all three and the idea behind them, so there is nothing here left to build or merge.
60
+
61
+ Your rejection stands fully enacted. Nothing was merged, and the branch is still on no other branch. Checked against main just now, not assumed.`,labels:["app","merge"],priority:5,epoch:3,claim:null,wrote:{answer:{ts:te-65*Ce,source:"founder"},status:{ts:te-2*Ce,source:"agent"}},createdAt:te-90*Ce,updatedAt:te-2*Ce},{id:"w-p4",product:"kestrel",productName:"Kestrel",status:"done",kind:"directive",title:"The booster opening animation is too slow on the second card.",body:"The booster opening animation is too slow on the second card. It feels fine on the first and then it drags, and by the fifth I am waiting on it rather than watching it.",answer:"Yes, try it at 200ms and show me.",result:["**The second card is at 200ms and it is on the branch, ready to merge.**","","All five cards now turn at the same speed, which is what made the second one feel like a stall: it was the only one at 340. A full booster is 1.1 seconds faster end to end, measured on the real build over ten opens, not estimated.","","The one judgement left is the flip on the rare card, which still holds a beat longer on purpose. Merge it as it is, take the beat off the rare card too, or leave it on the branch until you have opened one yourself.","","## Options","1. Merge it (recommended)","2. Take the extra beat off the rare card first","3. Leave it on the branch until I have opened one"].join(`
62
+ `),labels:["founder"],priority:5,epoch:2,claim:null,wrote:{body:{ts:te-3*lt,source:"founder"},answer:{ts:te-70*Ce,source:"founder"},result:{ts:te-3*Ce,source:"agent"},status:{ts:te-3*Ce,source:"agent"}},createdAt:te-3*lt,updatedAt:te-3*Ce},{id:"w-a1",product:"kestrel",productName:"Kestrel",status:"open",kind:"question",title:"Pricing page: annual toggle default on or off?",body:["## Where we were","You asked for a pricing page draft. I proposed three tiers with annual default. You said annual-default felt presumptuous before we have testimonials.","","## Context","The page is rebuilt with the monthly default. Simulated users (5 personas) now hesitate at the annual toggle: 3 of 5 never noticed it, which costs us the anchor. Screenshot attached shows the toggle placement.","","![pricing toggle](fixture://pricing.png)","","## Options",'1. Monthly default, toggle moved above the fold with a "2 months free" chip (recommended)',"2. Annual default, first testimonial quote placed beside it","3. Ship monthly-only, add annual after the first 10 paying users","","## What happens next","I ship the winner tonight, then re-run the 5-persona panel on the live page. Meanwhile I moved on to the checkout error copy.","","## Cost of being wrong","Low. One-line change to revert, and the panel re-run catches a regression within the hour."].join(`
63
+ `),labels:["pricing"],priority:2,epoch:3,claim:null,createdAt:te-22*Ce,updatedAt:te-22*Ce},{id:"w-b2",product:"onboard",productName:"Onboard",status:"open",kind:"review",title:"Review: welcome-email sequence rewrite (3 emails)",body:["## Where we were",'First draft last week read as AI-generated to you ("delve", exclamation marks). You asked for plain, specific, one idea per email.',"","## Context","Rewritten. Email 1 is 61 words. Diff and rendered previews:","","[View the diff](fixture://diff) · [Preview email 1](http://localhost:4801/emails/1)","","## What happens next","On approve, these go into the drip for new signups only. No existing user is re-mailed.","","## Cost of being wrong","Medium. Real humans receive these; a bad tone lands in inboxes we cannot unsend."].join(`
64
+ `),labels:["marketing","email"],priority:1,epoch:5,claim:null,createdAt:te-2*lt,updatedAt:te-71*Ce},{id:"w-c3",product:"thicket",productName:"Thicket",status:"blocked",kind:"task",title:"Stripe account: needs your identity verification to go live",body:["## Context","Test-mode checkout works end to end. Going live requires identity verification that only you can complete (government ID, ~5 minutes at the Stripe dashboard).","","[Open Stripe verification](https://dashboard.stripe.com/settings)","","## What happens next","The moment the account is live I flip the publishable key and re-run the paid-signup journey.","","## Cost of being wrong","None, but every day unverified is a day nothing can be sold."].join(`
65
+ `),labels:["payments"],priority:3,epoch:2,claim:null,createdAt:te-26*lt,updatedAt:te-26*lt},{id:"w-d4",product:"kestrel",productName:"Kestrel",status:"claimed",kind:"bug",title:"Card zoom flickers on Safari",labels:["frontend"],priority:1,epoch:4,claim:{holder:"zero-worker-9f2",leaseUntil:te+4*Ce},createdAt:te-48*Ce,updatedAt:te-3*Ce,body:"Repro: hover any card in the gallery on Safari 19. The zoom transform re-triggers on every mousemove."},{id:"w-e5",product:"onboard",productName:"Onboard",status:"claimed",kind:"task",title:"Instrument the new signup flow",labels:["analytics"],priority:0,epoch:1,claim:{holder:"zero-worker-b81",leaseUntil:te+2*Ce},createdAt:te-31*Ce,updatedAt:te-1*Ce},{id:"w-m12",product:"onboard",productName:"Onboard",status:"open",kind:"design",title:"Onboarding: three first run flows are drawn, and one of them is yours to pick",body:`**Pick the walkthrough, already working, or teach as you go.**
66
+
67
+ Three first run flows are drawn, in the lake skin, as screens you can actually look at.`,note:`**Pick the walkthrough, already working, or teach as you go.**
68
+
69
+ Three first run flows are drawn, in the lake skin, as screens you can actually look at. They are in your documents.
70
+
71
+ The walkthrough is six composed screens, one idea each, then the app. It is the closest to onboarding somebody in person and the most beautiful of the three.
72
+
73
+ Nothing is coded until you say which one.`,labels:["design"],priority:5,epoch:2,claim:null,createdAt:te-40*Ce,updatedAt:te-19*Ce},{id:"w-n13",product:"onboard",productName:"Onboard",status:"open",kind:"review",title:"The first row a new project makes is fixed and needs your yes",body:`**Merge the first row change, or pick different words for it.**
74
+
75
+ Making a project used to compose a row the fleet took as work, so an agent started before you had said anything. It asks now, and nothing runs until you reply.
76
+
77
+ The page shows the row before and after:
78
+
79
+ /fixtures/onboard/designs/w-n13/the-first-row.html`,labels:["review"],priority:5,epoch:2,claim:null,createdAt:te-52*Ce,updatedAt:te-12*Ce},{id:"w-i9",product:"onboard",productName:"Onboard",status:"open",kind:"design",title:"Design the build menu: what resources make, and what unlocks it",answer:"Option 1: One design pass, delivered as an HTML page you read.",labels:["design"],priority:4,epoch:7,claim:null,createdAt:te-7*lt,updatedAt:te-2*lt},{id:"w-j10",product:"thicket",productName:"Thicket",status:"open",kind:"task",title:"Bring back a list of name alternatives to react to",answer:"Option 1: A page of twenty or so candidates, grouped by what each promises.",labels:[],priority:4,epoch:3,claim:null,createdAt:te-14*lt,updatedAt:te-5*lt},{id:"w-k11",product:"kestrel",productName:"Kestrel",status:"open",kind:"directive",title:"Your depth signal is built, and the sign up count was wrong",body:["The depth signal you approved is built and verified, waiting on one thing from you.","","A visitor who reads the whole page now leaves marks at 25, 50, 75 and 100 carrying the","campaign that brought them; a visitor who stops at the first screen leaves none. Today","those two people are the same row.","","## What is owed","Whether to merge it. Nothing else waits on this."].join(`
80
+ `),labels:["gtm"],priority:1,epoch:4,claim:null,runAt:te+9*lt,wrote:{runAt:{ts:te-12*Ce,source:"agent"}},createdAt:te-5*lt,updatedAt:te-12*Ce},{id:"w-h8",product:"kestrel",productName:"Kestrel",status:"done",kind:"directive",title:"can you check our metrics? i want to see if the new pricing page moved signups",result:["Checked, and there is real news: the first stranger off the ad reached checkout tonight.","","On signups themselves the honest answer is that eleven people settle nothing. 1 signup from","13 visitors since the rewrite against 2 from 174 before it, our own rows excluded."].join(`
81
+ `),labels:["founder"],priority:9,epoch:4,claim:null,createdAt:te-21*Ce,updatedAt:te-4*Ce,wrote:{status:{ts:te-4*Ce,source:"agent"}}},{id:"w-h9",product:"onboard",productName:"Onboard",status:"claimed",kind:"directive",title:"Can the welcome email wait until they finish setup?",body:'Can the welcome email wait until they finish setup? Right now it goes out the second someone signs up, so people are getting a "you are all set" email while they are still halfway through the form, and two of them have written back asking what they were supposed to have done. I would rather it went out when they actually finish, and if they never finish then it should be a different email entirely, something that says come back and pick up where you left off.',note:"Found it. The email fires on account creation in signup.ts, not on the setup step, so it cannot see whether anyone finished. Moving the trigger to the completion event now.",labels:["founder"],priority:5,epoch:2,claim:null,createdAt:te-55*Ce,updatedAt:te-6*Ce,wrote:{body:{ts:te-55*Ce,source:"founder"},note:{ts:te-6*Ce,source:"agent"}}},{id:"w-k11",product:"kestrel",productName:"Kestrel",status:"done",kind:"question",title:"The best one is Tripo and it costs twenty cents. The only part I cannot do myself is opening the account it needs.",body:"Every one of these tools wants an account with a card on it before it will answer a single call. I hold your image key and nothing else, so that signup is the only part of this I cannot do.",answer:"status?",result:"Nothing is running, and nothing is waiting on me. It all sits with you.",labels:["v1","pipeline","spend"],priority:7,epoch:9,claim:null,createdAt:te-6*lt,updatedAt:te-34*Ce,wrote:{answer:{ts:te-37*Ce,source:"founder"},status:{ts:te-34*Ce,source:"agent"}}},{id:"w-f6",product:"thicket",productName:"Thicket",status:"done",kind:"task",title:"Program builder: deload weeks",result:"Shipped. Deload every 4th week, user-adjustable. Panel re-run: 5/5 completed setup.",labels:[],priority:0,epoch:2,claim:null,createdAt:te-3*24*lt,updatedAt:te-5*lt},{id:"w-g7",product:"kestrel",productName:"Kestrel",status:"done",kind:"question",title:"Holo effect: CSS or WebGL?",answer:"Option 1. CSS. Revisit only if the panel complains.",result:"Shipped CSS holo. 60fps on the test devices.",labels:["frontend"],priority:0,epoch:6,claim:null,createdAt:te-2*24*lt,updatedAt:te-26*lt}],supervisor:{paused:!1,capacity:3,productOrder:["onboard","kestrel","thicket"],stalled:["w-i9","w-j10"],running:[{itemId:"w-d4",product:"kestrel",startedAt:te-3*Ce,activity:[{id:"demo-tests",label:"Running npx vitest run",detail:"npx vitest run",startedAt:te-17e3}],tail:["tool: Read","tool: Grep","Found it: the transform is applied in both the hover class and the JS tilt handler.","tool: Edit"]},{itemId:"w-e5",product:"onboard",startedAt:te-12*Ce,tail:["tool: mcp__agentbox__read_document","Reading the analytics contract before instrumenting.","tool: Edit","tool: Bash"]}]},approvals:[{id:"ap-1",at:te-4e4,product:"kestrel",item:"w-d4",tool:"Bash",input:{command:"npx vercel deploy --prod --prebuilt",description:"Deploy the pricing page to production"}},{id:"ap-2",at:te-22e3,product:"onboard",item:"w-e5",tool:"Bash",input:{command:"git push origin main",description:"Push the analytics instrumentation commit"}},{id:"ap-3",at:te-8e3,product:"kestrel",item:"w-d4",tool:"Write",input:{file_path:"src/components/Pricing.tsx",description:"Rewrite the annual toggle"}}],engines:{choices:[pi[0]],workspace:Ft,byItem:{}},config:{}},GS=e=>new Date(e).toTimeString().slice(0,8);function ef(e,t,n,r){const s=`# ${t}
82
+ # fixture · spawned ${new Date(e).toISOString()}
83
+
84
+ `,o=n.map(([l,a])=>`${GS(e+l*1e3)} ${a}`).join(`
85
+ `);if(!r)return`${s}${o}
86
+ `;const i=r.code===0?"success · 27 turns":"success ERROR · 1 turns";return`${s}${o}
87
+
88
+ ${GS(r.at)} == RESULT (${i}) ==
89
+ ${r.result}
90
+
91
+ # exited (${r.code}) ${new Date(r.at).toISOString()}
92
+ `}const LF={"w-d4":[{startedAt:te-3*Ce,text:ef(te-3*Ce,"Card zoom flickers on Safari",[[0,"I'll start on the Safari flicker, reading the gallery component first."],[3,"[Read] src/components/Gallery.tsx"],[11,"[Grep] transform:"],[19,"[Read] src/styles/card.css"],[34,"[Read] src/tilt.ts"],[52,"Found it: the transform is applied in both the hover class and the JS tilt handler."],[58,"[Edit] src/styles/card.css"],[71,"[Bash] npx vitest run card"],[96,"The class alone still flickers, so the tilt handler has to stop writing transform at all."],[104,"[Edit] src/tilt.ts"],[119,"[Bash] npx vitest run card"],[142,"Green on Safari 19 and Chrome. Writing the test that would have caught this."],[150,"[Write] tests/card-tilt-owns-one-transform.test.ts"],[163,"[Bash] npx vitest run"]])}],"w-p3":[{startedAt:te-7*Ce,text:ef(te-7*Ce,"The card frames are built, both sizes, and the art is ready.",[[0,"Took the job. Reading your answer before anything else."],[4,"[mcp__agentbox__claim_work_item] w-p3"],[12,"[mcp__agentbox__read_document] strategy/art-style.md"],[26,"You rejected all three frames and the idea behind them, so there is nothing here to merge."],[33,"[Bash] git log --oneline -5 main"],[39,"[Bash] git branch --contains kestrel/frames"],[48,"Checked rather than assumed: the frame branch is on no other branch, and main has never carried it."],[57,"[Bash] npx vitest run"],[96,"Suite green at 218 tests, so nothing half-merged is sitting in the tree."],[104,"[Edit] docs/decisions.md"],[119,"Recording the rejection where the next session will read it, not just on the row."],[126,"[Edit] docs/decisions.md"],[140,"[mcp__agentbox__update_work_item] w-p3"],[148,"Closed the row with the result above."]],{at:te-2*Ce,code:0,result:"Closed, because the thing this was blocked on came back as a no. You were asked to pick one of three redesigned frames and you refused all three and the idea behind them, so there is nothing here left to build or merge."})}],"w-m12":[{startedAt:te-40*Ce,text:ef(te-40*Ce,"Onboarding: three first run flows",[[0,"Now the three first run flows, drawn in the lake skin."],[12,"[Read] renderer/src/styles.css"],[40,"[Write] /tmp/compose-flows.mjs"],[96,"[Bash] node /tmp/compose-flows.mjs"],[310,"[mcp__agentbox__write_document] designs/w-78c45faed4/first-run-flows.html"],[318,"They are in your documents."]],{at:te-19*Ce,code:0,result:"Three first run flows drawn."})}],"w-i9":[{startedAt:te-2*lt,text:ef(te-2*lt,"Design the build menu: what resources make, and what unlocks it",[[0,"Started on your answer."]],{at:te-2*lt+3e3,code:1,result:"API Error: Claude AI usage limit reached. Your weekly limit resets at 4pm."})}]},PF={"w-n13":[{id:"w-n13",ts:te-52*Ce,source:"agent",patch:{title:"The first row a new project makes is fixed and needs your yes",status:"open",kind:"review",priority:5,body:`**Merge the first row change, or pick different words for it.**
93
+
94
+ Making a project used to compose a row the fleet took as work, so an agent started before you had said anything. It asks now, and nothing runs until you reply.
95
+
96
+ The page shows the row before and after:
97
+
98
+ /fixtures/onboard/designs/w-n13/the-first-row.html`}}],"w-p1":[{id:"w-p1",ts:te-17*Ce,source:"agent",patch:{title:"Six schedules, no session: something is eating the build menu's hour",status:"open",kind:"task",priority:2,parent:"w-p0",body:"The menu has been scheduled six times and has never started. I do not know why yet."}},{id:"w-p1",ts:te-16*Ce,source:"agent",epoch:5,claim:{holder:"mcp-40122",leaseUntil:te-11*Ce},patch:{status:"claimed"}},{id:"w-p1",ts:te-12*Ce,source:"agent",epoch:5,patch:{title:"The build menu has never started, six schedules in. One tap tomorrow may be all it needs."}},{id:"w-p1",ts:te-11*Ce,source:"agent",epoch:5,patch:{status:"blocked",note:"Read every session this product has been given for two days. Each one started within fifteen seconds of the menu's hour, and at that instant the menu is the one row nobody may touch."}},{id:"w-p1",ts:te-4*Ce,source:"founder",patch:{answer:"I think the next step is to design the art? We may need fal.ai to create the models, not sure how to best turn our art into something we can code with"}}],"w-p0":[{id:"w-p0",ts:te-40*Ce,source:"agent",patch:{title:"The card art is finished and nothing is built. The build menu is the step you named before code.",status:"open",kind:"question",priority:2,body:'You said "not yet, we still need to design and plan before building."'}},{id:"w-p0",ts:te-31*Ce,source:"agent",epoch:4,claim:{holder:"mcp-38801",leaseUntil:te-26*Ce},patch:{status:"claimed"}},{id:"w-p0",ts:te-27*Ce,source:"agent",epoch:4,patch:{status:"done"}}]},JS=[{id:"r-3f9a21bc44",product:"harbour",productName:"Harbour",title:"Every day at 9am, run a synthetic user through Harbour onboarding",body:`From the landing page to the first artifact, as a new user with a fresh email.
99
+
100
+ What I want back:
101
+ - Anything that broke, with the step it broke on.
102
+ - Anything that took longer than ten seconds.
103
+ - Nothing else. If it all worked, say so and stop.
104
+
105
+ Skip:
106
+ - The billing screen, it is not wired yet.
107
+ - The invite flow.`,every:"day",at:"09:00",createdAt:te-6*24*lt,served:new Date(te).toISOString().slice(0,10),misses:0,alerted:0,lastOccurrence:"r-3f9a21bc44-today"},{id:"r-77c1e0aa31",product:"kestrel",productName:"Kestrel",title:"Every morning, check overnight signups against yesterday",every:"day",at:"08:00",createdAt:te-12*24*lt,served:new Date(te).toISOString().slice(0,10),misses:0,alerted:0,lastOccurrence:"r-77c1e0aa31-today"}],To=(e,t,n)=>{const r=new Date;return r.setDate(r.getDate()-e),r.setHours(t,n,0,0),r.getTime()},$F=[{id:"r-3f9a21bc44-today",product:"harbour",productName:"Harbour",title:"Every day at 9am, run a synthetic user through Harbour onboarding · today",kind:"directive",status:"done",labels:["founder","repeat:r-3f9a21bc44"],priority:5,epoch:1,claim:null,result:"email verification took 41 seconds to send · filed as its own item",createdAt:To(0,9,3),updatedAt:To(0,9,14)},{id:"r-3f9a21bc44-yesterday",product:"harbour",productName:"Harbour",title:"Every day at 9am, run a synthetic user through Harbour onboarding · yesterday",kind:"directive",status:"done",labels:["founder","repeat:r-3f9a21bc44","clean"],priority:5,epoch:1,claim:null,createdAt:To(1,9,6),updatedAt:To(1,9,12)},{id:"r-3f9a21bc44-saturday",product:"harbour",productName:"Harbour",title:"Every day at 9am, run a synthetic user through Harbour onboarding · Sat",kind:"directive",status:"done",labels:["founder","repeat:r-3f9a21bc44","clean"],priority:5,epoch:1,claim:null,createdAt:To(2,14,41),updatedAt:To(2,14,52)},{id:"r-77c1e0aa31-today",product:"kestrel",productName:"Kestrel",title:"Every morning, check overnight signups against yesterday · today",kind:"directive",status:"done",labels:["founder","repeat:r-77c1e0aa31","clean"],priority:5,epoch:1,claim:null,createdAt:To(0,8,2),updatedAt:To(0,8,9)}],zF={kestrel:{stage:"prelaunch",headline:{label:"Steps to launch",value:"3"},rows:[{label:"Next milestone",value:"First paying customer"},{label:"Real users",value:"4"},{label:"Revenue",value:"$0"},{label:"Panel verdict",value:"4/5 completed checkout"}],intent:"Ship pricing page, then open the waitlist to the 61 signups."},onboard:{stage:"launched",headline:{label:"Weekly active",value:"12"},rows:[{label:"Next milestone",value:"20 weekly active"},{label:"Signups this week",value:"5"},{label:"Revenue",value:"$147 MRR"},{label:"Churn",value:"unmeasured, needs 30 days of data"}],intent:"Fix the drip sequence, then test the LinkedIn channel."},thicket:{stage:"prelaunch",headline:{label:"Steps to launch",value:"1"},rows:[{label:"Next milestone",value:"Launch"},{label:"Blocker",value:"Stripe identity verification (you)"},{label:"Real users",value:"0"}],intent:"Launch the moment payments go live."}},_F=864e5,Ao=(e,t,n)=>{const r=new Date(Date.now()-e*_F);return r.setHours(t,n,0,0),r.getTime()},FF={products:[{slug:"harbour-new",dir:"/fixtures/harbour-new",name:"Harbour (New)",oneLiner:"",repoPath:null}],items:[["m1","The four pages are built. Your signup rate per page is ready.","Built and tested on main. Please review the analytics and copy.",Ao(2,16,20)],["m2","The setup cut is on today’s main, tested and green.","Safe to deploy when you say go. Needs your yes to ship.",Ao(1,15,10)],["m3","Nobody has read our heaviest user or the only users.","Added a first-time user email and in-app nudges. Needs your yes to ship.",Ao(1,14,40)],["m4","Merged and live: the privacy page describes the product.","You asked for clearer language. This is live.",Ao(1,13,30)],["m5","Our signup number counts an event that has never occurred.","Fixed the event tracking and backfilled the last 7 days. Needs your yes to ship.",Ao(0,10,3)],["m6","Standing deploys: one yes for deploying work.","CI is green and staging is verified. Approve to deploy to production?",Ao(0,10,3)],["m7","I want to sell a couple things. First, I have a psa 101…","Blocked by Stripe account verification. Your action is needed.",Ao(1,11,5)],["m8","I want you to help me with this and maintain it. If I…","Blocked by missing API key in production secrets. Your action is needed.",Ao(1,10,15)]].map(([e,t,n,r])=>({id:e,product:"harbour-new",productName:"Harbour (New)",status:"open",kind:"question",title:t,body:n,labels:[],priority:5,epoch:1,claim:null,createdAt:r,updatedAt:r})),approvals:[],supervisor:{paused:!1,running:[],capacity:3},config:Ic.config},BF={"harbour-new":{stage:"launched",headline:null,rows:[{label:"Next milestone",value:"20 weekly active"},{label:"Signups this week",value:"5"},{label:"Revenue",value:"$147 MRR"},{label:"Churn",value:"unmeasured, needs 30 days of data"}],intent:"Fix the drip sequence, then test the LinkedIn channel."}},HF=[{pid:4102,ppid:1,sessionId:"f-1",name:"kestrel-2c",cwd:"/Users/you/Desktop/dev/kestrel",startedAt:te-42*Ce,status:null,waitingFor:null,lastActiveAt:te-8e3,lastSaid:"The set is inconsistent. The resumed run reused a stale card back.",product:null,productName:null,startedByZero:!1},{pid:4118,ppid:1,sessionId:"f-2",name:"onboard-c4",cwd:"/Users/you/Desktop/dev/onboard",startedAt:te-31*Ce,status:null,waitingFor:null,lastActiveAt:te-4e4,lastSaid:"Merged and green. Now filing the one thing her reply raised.",product:null,productName:null,startedByZero:!1},{pid:4133,ppid:1,sessionId:"f-3",name:"kestrel-87",cwd:"/Users/you/Desktop/dev/kestrel",startedAt:te-3*lt,status:null,waitingFor:null,lastActiveAt:te-7e4,about:"Card art pipeline: the second pass on the commons",lastSaid:"The live page renders and matches the commit.",product:"kestrel",productName:"Kestrel",startedByZero:!1},{pid:4140,ppid:1,sessionId:"f-4",name:"thicket-69",cwd:"/Users/you/Desktop/dev/thicket",startedAt:te-2*lt,status:null,waitingFor:null,lastActiveAt:te-4*Ce,about:"Deload weeks are landing a session early",lastSaid:"Carrying on. The cut is fixed and verified.",product:null,productName:null,startedByZero:!1},{pid:3901,ppid:1,sessionId:"f-5",name:"onboard-48",cwd:"/Users/you/Desktop/dev/onboard",startedAt:te-6*lt,status:"idle",waitingFor:null,lastActiveAt:te-2*lt,about:"Open project as electron app",lastSaid:"Done. Anything else?",product:null,productName:null,startedByZero:!1},{pid:3846,ppid:1,sessionId:"f-6",name:"thicket-46",cwd:"/Users/you/Desktop/dev/thicket",startedAt:te-9*lt,status:"idle",waitingFor:null,lastActiveAt:te-3*lt,about:"Install ADHD-friendly coding skill",lastSaid:"Installed. It is on the path.",product:null,productName:null,startedByZero:!1},{pid:3102,ppid:1,sessionId:"f-7",name:"kestrel-54",cwd:"/Users/you/Desktop/dev/kestrel",startedAt:te-50*lt,status:"idle",waitingFor:null,lastActiveAt:te-46*lt,about:"Rename the economy doc",lastSaid:"Renamed.",product:null,productName:null,startedByZero:!1}],WF={ok:!0,workspace:{agentsRunning:!0,sessionsAtOnce:3,capacity:6,running:2,model:"claude-opus-5",permission:"bypassPermissions",permissionArgs:["--model","claude-opus-5","--allowedTools","mcp__agentbox","Bash(git fetch:*)","Bash(git push:*)","Bash(git merge:*)","--permission-mode","bypassPermissions"],accounts:[{profile:"default",label:"default",dir:null,email:"you@example.com",accountUuid:"acct-personal",live:!0,cooldownUntil:0,running:2,plan:{label:"Max 20x",max:!0}},{profile:"/Users/you/.claude-second",label:".claude-second",dir:"/Users/you/.claude-second",email:"work@example.com",accountUuid:"acct-work",live:!0,cooldownUntil:0,running:0,plan:{label:"Max 20x",max:!0}}],accountsNote:null,storePath:"/Users/you/Zero/accounts/00000000-0000-4000-8000-000000000000",homePath:"/Users/you",claudeBin:"/Users/you/.local/bin/claude",claudeFound:!0,claudeCertain:!0,claudeInstallUrl:"https://code.claude.com/docs/en/setup",engine:Ft,engineChoices:[pi[0]],codexModels:[],codexModelDefault:null,codexModel:null,claudeModels:dR.map(e=>({id:e.id,label:e.label,model:e.model})),codex:null,standingLines:20,messageRulesLines:254,projectsWithInstructions:1,projectCount:3},projects:[{slug:"kestrel",name:"Kestrel",dir:"/fixtures/kestrel",repoPath:"/Users/you/Desktop/dev/kestrel",autonomous:!0,permission:"workspace",permissionArgs:null,running:2,instructions:["The card art is the product. Never ship a card that renders wrong,","even to a test account.","","Screens are designs first. Draw it, show me, then build the one I pick."].join(`
108
+ `)},{slug:"onboard",name:"Onboard",dir:"/fixtures/onboard",repoPath:null,autonomous:!1,permission:"workspace",permissionArgs:null,running:0,instructions:""},{slug:"thicket",name:"Thicket",dir:"/fixtures/thicket",repoPath:null,autonomous:!1,permission:"plan",permissionArgs:["--model","claude-opus-5","--allowedTools","mcp__agentbox","--permission-mode","plan"],running:0,instructions:""}]},UF=["missing","claude","codex"];function VF(e){return UF.includes(e)?e:null}const KF=[{id:"gpt-5.6-sol",label:"GPT-5.6-Sol"},{id:"gpt-5.6-terra",label:"GPT-5.6-Terra"},{id:"gpt-5.6-luna",label:"GPT-5.6-Luna"},{id:"gpt-5.5",label:"GPT-5.5"},{id:"gpt-5.4",label:"GPT-5.4"},{id:"gpt-5.4-mini",label:"GPT-5.4-Mini"}],qF="gpt-5.6-sol",QS="https://learn.chatgpt.com/docs/codex/cli",YF="/Users/you/.local/bin/codex",GF={claude:{"w-e5":"codex","w-b2":"codex"},codex:{"w-d4":Ft,"w-a1":Ft}},XS=[{span:"session",qualifier:null,name:"This session",percent:38,resetsText:"6:19pm",resetsOn:null,resetsAt:te+2*lt+40*Ce,zone:"America/Los_Angeles"},{span:"week",qualifier:"all models",name:"This week",percent:71,resetsText:"4pm",resetsOn:"Sep 8",resetsAt:te+3*24*lt,zone:"America/Los_Angeles"}],ZS=[{span:"session",qualifier:null,name:"This session",percent:33,resetsText:null,resetsOn:null,resetsAt:te+4*lt,zone:null},{span:"week",qualifier:null,name:"This week",percent:63,resetsText:null,resetsOn:null,resetsAt:te+5*24*lt,zone:null}];function JF(e){return e?e==="missing"?{codex:{found:!1,certain:!0,bin:"",url:QS,trouble:null}}:{engine:e,engineChoices:pi,codexModels:KF,codexModelDefault:qF,codexModel:null,codex:{found:!0,certain:!0,bin:YF,url:QS,trouble:null}}:null}function tf(e,t){if(!t||t==="missing")return e;const n=GF[t],r=s=>n[s]??t;return{...e,engines:{choices:pi,workspace:t,byItem:{...n}},items:e.items.map(s=>n[s.id]?{...s,engine:n[s.id]}:s),supervisor:{...e.supervisor,running:e.supervisor.running.map(s=>({...s,engine:r(s.itemId)}))},usage:{engine:t,limits:t==="codex"?ZS:XS,at:te-4*Ce},usageByEngine:[{engine:"claude",limits:XS,at:te-4*Ce},{engine:"codex",limits:ZS,at:te-4*Ce}]}}function QF(){const e=Date.now(),t=6e4;return{ok:!0,name:"harbour-71",total:34,omitted:29,turns:[{at:e-4*1440*t,who:"you",text:"I made a new product in Harbour called Powerup but I don’t see it. I want to be able to see it so i can assign it tasks."},{at:e-4*1440*t+26*t,who:"it",text:"Found it. the app and Harbour read different stores: the composer lists directories under the account root, and the new product was written to the other one."},{at:e-4*1440*t+54*t,who:"you",text:"okay no worries. just make sure that auth persists across sessions now that im logged in."},{at:e-90*t,who:"it",text:"Auth holds across a restart now, and the sync backlog is drained. One thing left that I need you on."},{at:e-40*t,who:"you",text:"go ahead"}]}}function eC(){return{user:[{name:"leon-okafor-image-feedback",title:"Leon Okafor Image Feedback",line:"Leon Okafor QA agent variant that gives feedback on screenshots passed directly to it — no browser automation.",scope:"all",path:"/Users/you/.claude/agents/leon-okafor-image-feedback.md"},{name:"leon-okafor-qa",title:"Leon Okafor QA",line:`QA agent that embodies the persona of Leon Okafor — a 22-year-old Nigerian-American YC founder being onboarded to ${Le}.`,scope:"all",path:"/Users/you/.claude/agents/leon-okafor-qa.md"},{name:"localhost-qa",title:"Localhost QA",line:"Use this skill after completing any frontend or UI code changes to validate them against the running app.",scope:"all",path:"/Users/you/.claude/agents/localhost-qa.md"},{name:"qa-browser-tester",title:"QA Browser Tester",line:"Playwright-powered browser testing subagent.",scope:"all",path:"/Users/you/.claude/agents/qa-browser-tester.md"}],project:[{name:"cleanup-analyzer",title:"Cleanup Analyzer",line:"Run static analysis tools and get structured cleanup recommendations.",scope:"project",path:"/Users/you/Desktop/dev/sidecar-desktop/.claude/agents/cleanup-analyzer.md"},{name:"docs-reviewer",title:"Docs Reviewer",line:"Review developer documentation for accuracy, consistency with the codebase, and quality.",scope:"project",path:"/Users/you/Desktop/dev/sidecar-desktop/.claude/agents/docs-reviewer.md"},{name:"plan-checker",title:"Plan Checker",line:"Validate implementation plans against documented architecture patterns.",scope:"project",path:"/Users/you/Desktop/dev/sidecar-desktop/.claude/agents/plan-checker.md"},{name:"userguide-reviewer",title:"Userguide Reviewer",line:"Review user guide documentation against actual system features.",scope:"project",path:"/Users/you/Desktop/dev/sidecar-desktop/.claude/agents/userguide-reviewer.md"}],chosen:null}}function XF(){const e=Date.now(),t=3600*1e3,n={folder:"/Users/you/Desktop/dev/zero",folderName:"zero",short:"~/Desktop/dev/zero"},r={folder:"/Users/you/Desktop/dev/harbour",folderName:"harbour",short:"~/Desktop/dev/harbour"};return[["s1","this is a test",1,n],["s2","please run zero (latest version) and also give me a command to do so",30,n],["s3","see attached images if you can see them (lmk if not). there’s only a...",76,n],["s4","Can you please reopen the Powerup application, also known as Zero, using...",76,n],["s5","I don't know what's going on right now, but for some reason, after...",77,n],["s6",'nonstop keep getting a popup "chromium wants to use your confidential...',81,n],["s7","Open the most recent version of this project as an electron app please",98,n],["s8","I want you to install this skill across my projects for coding...",142,r],["s9","tried to open zero here but it failed.",142,r]].map(([o,i,l,a])=>({id:o,source:"terminal",title:i,when:e-l*t,path:`/Users/you/.claude/projects/${a.folderName}/${o}.jsonl`,...a}))}const ZF={"/Users/you":["Desktop","Documents","dev","Downloads"],"/Users/you/dev":["house","kestrel","orchard"],"/Users/you/dev/house":["src","tests"],"/Users":["you"]};function e4(e){const t=e==="~"||!e.startsWith("/")?"/Users/you":e,n=ZF[t]??[];return{at:t,parent:t==="/"?null:t.slice(0,t.lastIndexOf("/"))||"/",home:"/Users/you",folders:n.map(r=>({name:r,path:`${t}/${r}`})),refused:t==="/Users/you"?"That is your whole home folder. Pick the folder your project’s code is in.":null}}const t4={terminal:"zero:terminal",snapshot:"zero:snapshot",dashboard:"zero:dashboard",commandCatalog:"zero:command-catalog",remoteControl:"zero:remote-control",command:"zero:command",compact:"zero:compact",compactionStatus:"zero:compaction-status",answer:"zero:answer",compose:"zero:compose",schedule:"zero:schedule",repeats:"zero:repeats",composeRepeat:"zero:compose-repeat",setRepeat:"zero:set-repeat",endRepeat:"zero:end-repeat",pauseSupervisor:"zero:supervisor-pause",createProduct:"zero:create-product",firstRunAnswer:"zero:first-run-answer",firstRunExamples:"zero:first-run-examples",firstRunPractice:"zero:first-run-practice",firstRunPracticeEnd:"zero:first-run-practice-end",firstRunWalking:"zero:first-run-walking",openFreshUser:"zero:open-fresh-user",openDemo:"zero:open-demo",chooseFolder:"zero:choose-folder",listFolders:"zero:list-folders",folderExists:"zero:folder-exists",agentFiles:"zero:agent-files",agentFolders:"zero:agent-folders",importAgents:"zero:import-agents",agentThreads:"zero:agent-threads",importThreads:"zero:import-threads",badge:"zero:badge",bootInfo:"zero:boot-info",updateCheck:"zero:update-check",updateInstall:"zero:update-install",notify:"zero:notify",stopSession:"zero:stop-session",reopen:"zero:reopen",instructionRead:"zero:instruction-read",instructionWrite:"zero:instruction-write",instructionHistory:"zero:instruction-history",instructionVersion:"zero:instruction-version",standingRead:"zero:standing-read",standingWrite:"zero:standing-write",messageRulesRead:"zero:message-rules-read",messageRulesWrite:"zero:message-rules-write",settingsRead:"zero:settings-read",claudeRecheck:"zero:claude-recheck",codexRecheck:"zero:codex-recheck",codexAddAccount:"zero:codex-add-account",claudeAddAccount:"zero:claude-add-account",setProjectSetting:"zero:settings-set-project",setWorkspaceSetting:"zero:settings-set-workspace",projectRename:"zero:project-rename",projectIcon:"zero:project-icon",projectIconClear:"zero:project-icon-clear",projectInstructionsRead:"zero:project-instructions-read",projectInstructionsWrite:"zero:project-instructions-write",saveAttachments:"zero:save-attachments",stageAttachment:"zero:stage-attachment",crash:"zero:crash",track:"zero:track",sessionTrace:"zero:session-trace",itemHistory:"zero:item-history",openArtifact:"zero:open-artifact",readDoc:"zero:read-doc",codeChange:"zero:code-change",codeFile:"zero:code-file",saveCodeFile:"zero:save-code-file",writeDoc:"zero:write-doc",railNote:"zero:rail-note",saveRailNote:"zero:save-rail-note",agentReply:"zero:agent-reply",agentReveal:"zero:agent-reveal",agentConversation:"zero:agent-conversation",scheduleAgent:"zero:schedule-agent",closeAgent:"zero:close-agent",unreplyAgent:"zero:unreply-agent",resumeAgents:"zero:resume-agents",resumeItems:"zero:resume-items",redeliver:"zero:redeliver",setProductOrder:"zero:set-product-order",setProductHidden:"zero:set-product-hidden",approve:"zero:approve"},n4={onApprovalAnswered:"zero:approval-answered",onChanged:"zero:changed",onFind:"zero:find",onZoomPercent:"zero:zoom-percent",onRecovered:"zero:recovered",onOpenItem:"zero:open-item",onScreenDetail:"zero:screen-detail",onEscapeBrowser:"zero:escape-browser",onKeyInTheFile:"zero:key-in-the-file"},r4={notify:["arrivals"],track:["name"],instructionWrite:["id","text"],instructionVersion:["id","at"]},s4=["pathForFile"],o4="x-agentbox-token",tC="agentbox-token";function i4(){const e=new URL(location.href),t=e.searchParams.get("token");if(t){e.searchParams.delete("token"),history.replaceState(null,"",e.toString());try{sessionStorage.setItem(tC,t)}catch{}return t}try{return sessionStorage.getItem(tC)}catch{return null}}function l4(){if(typeof window>"u"||window.zero)return!1;const e=i4();if(!e)return!1;const t=async(o,i)=>{const l=await fetch(`/api/${encodeURIComponent(o)}`,{method:"POST",headers:{"content-type":"application/json",[o4]:e},body:JSON.stringify(i??null)});if(!l.ok){const a=await l.json().catch(()=>({}));throw new Error(a.error??`${Pn} could not answer ${o}.`)}return l.json()},n={};for(const[o,i]of Object.entries(t4)){const l=r4[o];n[o]=l?(...a)=>t(i,Object.fromEntries(l.map((c,u)=>[c,a[u]]))):a=>t(i,a)}for(const o of s4)n[o]=()=>null;const r=new Map;for(const[o,i]of Object.entries(n4))n[o]=l=>{const a=r.get(i)??new Set;return r.set(i,a),a.add(l),()=>a.delete(l)};const s=new EventSource(`/events?token=${encodeURIComponent(e)}`);return s.onmessage=o=>{var l;let i;try{i=JSON.parse(o.data)}catch{return}if(i.channel)for(const a of r.get(i.channel)??[])try{a((l=i.args)==null?void 0:l[0])}catch{}},window.zero=n,!0}l4();const a4=typeof location>"u"?"":location.search,yn=new URLSearchParams(a4),Re=yn.has("fixtures")||typeof window>"u"||!window.zero,bc=yn.get("fixtures")==="empty",nC=Math.max(0,Math.min(99,Number(yn.get("working")??0)||0)),c4=yn.get("fixtures")==="crowded",rC=yn.get("fixtures")==="mock",Dc=VF(yn.get("engines")),u4=["Crown","Meadow","Delete","Cascade","Orchard","Kestrel","Kestrel (2)","Harbour","Harbour (2)","Harbour (3)","Harbour (empty duplicate)","Harbour (empty duplicate 2)","Harbour (New)","Lantern","Personal","Repro Product","Repro Product (2)","Repro Product (3)","Test","Test (2)","The Frontier","Untitled"],yr=`quit and reopen ${Le} to change settings`,jo={ok:!0,workspace:{agentsRunning:!0,sessionsAtOnce:0,capacity:0,running:0,model:null,permission:"custom",codexMode:"auto",permissionArgs:[],outsideAgents:"off",accounts:[],accountsNote:null,diagnostics:!0,diagnosticsDestination:!1,adhdMode:!1,storePath:"",homePath:"",claudeBin:"",claudeFound:!1,claudeCertain:!1,claudeInstallUrl:"",standingLines:0,messageRulesLines:0,projectsWithInstructions:0,projectCount:0},projects:[]},ts=structuredClone(WF),sC=JF(Dc);sC&&Object.assign(ts.workspace,structuredClone(sC));function Gg(e,t){const n=ts.workspace;if(e==="workspace")t.key==="sessionsAtOnce"?(n.sessionsAtOnce=Math.max(1,Math.min(n.slotsMax??12,Number(t.value)||1)),n.capacity=n.sessionsAtOnce*Math.max(1,n.accounts.length)):n[t.key]=t.value;else{const r=ts.projects.find(s=>s.slug===t.product);r&&(r[t.key]=t.value)}return ts.workspace.projectsWithInstructions=ts.projects.filter(r=>r.instructions.trim()).length,structuredClone(ts)}const q={isFixtures:Re,async snapshot(){if(bc){const e={...structuredClone(Ic),items:[],approvals:[],supervisor:{paused:!1,running:[],capacity:3}};return nC&&(e.supervisor.running=Array.from({length:nC},(t,n)=>({itemId:`w-working-${n+1}`,product:"kestrel",startedAt:Date.now()-(n+1)*6e4,tail:["tool: Read"]}))),tf(e,Dc)}if(rC)return tf(structuredClone(FF),Dc);if(c4){const e=structuredClone(Ic);return e.products=u4.map(t=>({slug:t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,""),dir:`/fixtures/${t}`,name:t,oneLiner:"",repoPath:null})),e.supervisor.productOrder=e.products.map(t=>t.slug),e.supervisor.hiddenProducts=(yn.get("hidden")??"").split(",").filter(Boolean),yn.has("approvals")||(e.approvals=[]),tf(e,Dc)}if(Re){const e=structuredClone(Ic);e.items=[...e.items,...structuredClone($F)],e.agents=structuredClone(HF),yn.has("stale")&&(e.restartNeeded={files:["main/supervisor.mjs","main/ipc.mjs","preload.cjs","shared/rank.mjs"],since:Date.now()-2.9*24*36e5});const t=yn.get("update");if(t){const n={ready:{phase:"ready",newVersion:"0.2.0",percent:100,ready:!0,readyAt:Date.now()-372e4},downloading:{phase:"downloading",newVersion:"0.2.0",percent:47},current:{phase:"current"},error:{phase:"error",error:"Could not reach the internet."}};e.update={phase:"idle",currentVersion:"0.1.0",newVersion:null,percent:null,error:null,checkedAt:Date.now()-4*6e4,readyAt:null,ready:!1,...n[t]??{}}}return yn.has("approvals")||(e.approvals=[]),tf(e,Dc)}return window.zero.snapshot()},async updateCheck(){return Re?{phase:"ready",currentVersion:"0.1.0",newVersion:"0.2.0",percent:100,error:null,checkedAt:Date.now(),readyAt:Date.now(),ready:!0}:window.zero.updateCheck()},async updateInstall(){return Re?{started:!0}:window.zero.updateInstall()},async agentReply(e){var t,n;return Re?yn.has("agentUnsure")?{ok:!1,reason:"That agent is not listening any more."}:{ok:!0,delivered:!0,working:!0}:((n=(t=window.zero)==null?void 0:t.agentReply)==null?void 0:n.call(t,e))??{ok:!1,reason:"The message could not be handed over."}},async agentReveal(e){var t,n;return Re?{ok:!0,name:"CNVS"}:((n=(t=window.zero)==null?void 0:t.agentReveal)==null?void 0:n.call(t,e))??{ok:!1,reason:`${Pn} cannot tell which window it is running in.`}},async agentConversation(e){var t,n;return Re?QF():((n=(t=window.zero)==null?void 0:t.agentConversation)==null?void 0:n.call(t,e))??{ok:!1,reason:"That conversation could not be read."}},async sessionTrace(e){var t,n;return Re?{sessions:LF[e.id]??[]}:((n=(t=window.zero)==null?void 0:t.sessionTrace)==null?void 0:n.call(t,e))??{sessions:[]}},async resolveDoc(e){if(Re&&["artifact-layout-sample.change","review-bundle.change"].includes(e.src))return{ok:!0,opened:e.src};if(Re&&e.src==="artifact-layout-sample.md")return{ok:!0,opened:e.src};if(Re&&e.product==="onboard"&&["designs/w-n13/the-first-row.html","/fixtures/onboard/designs/w-n13/the-first-row.html"].includes(e.src))return{ok:!0,opened:e.src,url:"/fixtures/onboard/designs/w-n13/the-first-row.html"};const t=window.zero;return t!=null&&t.openArtifact?t.openArtifact({...e,mode:"resolve"}):{ok:!1,error:`quit and reopen ${Le} to open documents here`}},async readDoc(e){if(Re&&e.src==="artifact-layout-sample.md")return{ok:!0,text:EF,mtime:0};const t=window.zero;return t!=null&&t.readDoc?t.readDoc(e):{ok:!1,error:`quit and reopen ${Le} to open documents here`}},async codeChange(e){if(Re&&e.src==="review-bundle.change")return{ok:!0,change:NF};if(Re&&e.src==="artifact-layout-sample.change")return{ok:!0,change:uR};const t=window.zero;return t!=null&&t.codeChange?t.codeChange(e):{ok:!1,error:`quit and reopen ${Le} to open changes here`}},async codeFile(e){const t=window.zero;return t!=null&&t.codeFile?t.codeFile(e):{ok:!1,error:`quit and reopen ${Le} to edit files here`}},async saveCodeFile(e){const t=window.zero;return t!=null&&t.saveCodeFile?t.saveCodeFile(e):{ok:!1,error:`quit and reopen ${Le} to save this file`}},async writeDoc(e){const t=window.zero;return t!=null&&t.writeDoc?t.writeDoc(e):{ok:!1,error:`quit and reopen ${Le} to save this file`}},async railNote(e){const t=window.zero;return t!=null&&t.railNote?t.railNote({product:e}):{ok:!1,error:`quit and reopen ${Le} to keep a note here`}},async saveRailNote(e){const t=window.zero;return t!=null&&t.saveRailNote?t.saveRailNote(e):{ok:!1,error:`quit and reopen ${Le} to save this note`}},async openArtifactExternally(e){const t=window.zero;return t!=null&&t.openArtifact?t.openArtifact(e):(window.open(e.src,"_blank"),{ok:!0})},async itemHistory(e){if(Re)return{ok:!0,lines:PF[e.id]??[]};const t=window.zero;return t!=null&&t.itemHistory?t.itemHistory(e):{ok:!1,lines:[],error:`quit and reopen ${Le} to see this`}},async dashboard(e){return rC?BF[e]??null:Re?zF[e]??null:window.zero.dashboard(e)},async terminal(e){var t;if(Re)throw new Error("Terminal requires the desktop app and a real task.");if(!((t=window.zero)!=null&&t.terminal))throw new Error(`Restart ${Le} to use the terminal.`);return window.zero.terminal(e)},async commandCatalog(e){return Re?["code-review","simplify","verify"]:window.zero.commandCatalog(e)},async command(e){return Re?{state:"done",at:Date.now(),text:"Command completed.",name:e.text}:window.zero.command(e)},async compact(e){return Re?{state:"done",at:Date.now()}:window.zero.compact(e)},async remoteControl(e){return Re?null:window.zero.remoteControl(e)},async compactionStatus(e){if(Re){const t=yn.get("command-state");return t&&t!=="menu"?{state:t,at:Date.now()}:null}return window.zero.compactionStatus(e)},async answer(e){return Re?null:window.zero.answer(e)},async compose(e){var t;if(Re){const n=Date.now();return{id:`w-fixture${n.toString(36)}`,product:e.product,productName:((t=Ic.products.find(r=>r.slug===e.product))==null?void 0:t.name)??e.product,status:"open",title:e.title,body:e.body,kind:e.kind??"directive",labels:["founder"],priority:e.priority??5,epoch:1,claim:null,...e.runAt?{runAt:e.runAt}:{},...e.model?{model:e.model}:{},...e.engine?{engine:e.engine}:{},createdAt:n,updatedAt:n}}return window.zero.compose(e)},async firstRunAnswer(e){if(Re)return{line:"A fixture project, with no folder under it to read.",found:!1};const t=window.zero;return t!=null&&t.firstRunAnswer?t.firstRunAnswer(e):null},async firstRunExamples(e){if(Re)return null;const t=window.zero;return t!=null&&t.firstRunExamples?t.firstRunExamples(e):null},async firstRunPractice(){if(Re)return null;const e=window.zero;return e!=null&&e.firstRunPractice?e.firstRunPractice():null},async firstRunPracticeEnd(){var t;if(Re)return;const e=window.zero;try{await((t=e==null?void 0:e.firstRunPracticeEnd)==null?void 0:t.call(e))}catch{}},async firstRunWalking(e){if(Re)return;const t=window.zero;if(t!=null&&t.firstRunWalking)try{await t.firstRunWalking({walking:e})}catch{}},async openFreshUser(e=!0){if(Re)return{ok:!1,error:"Not in this preview."};const t=window.zero;if(!(t!=null&&t.openFreshUser))return{ok:!1,error:`This window is running an older ${Le}. Quit it and open it again.`};try{return await t.openFreshUser({withAgents:e})}catch(n){return{ok:!1,error:(n==null?void 0:n.message)??"It could not be opened."}}},async openDemo(){if(Re)return{ok:!1,error:"Not in this preview."};const e=window.zero;if(!(e!=null&&e.openDemo))return{ok:!1,error:`This window is running an older ${Le}. Quit it and open it again.`};try{return await e.openDemo()}catch(t){return{ok:!1,error:(t==null?void 0:t.message)??"It could not be opened."}}},async schedule(e){return Re?null:window.zero.schedule(e)},async scheduleAgent(e){var n,r;if(Re)return{ok:!0,runAt:e.runAt};const t=await((r=(n=window.zero)==null?void 0:n.scheduleAgent)==null?void 0:r.call(n,e));if(!(t!=null&&t.ok))throw new Error("the app could not keep that moment");return t},async unreplyAgent(e){var n,r;return Re?{ok:!0,repliedAt:0}:await((r=(n=window.zero)==null?void 0:n.unreplyAgent)==null?void 0:r.call(n,e))??{ok:!1,repliedAt:0}},async closeAgent(e){var n,r;if(Re)return{ok:!0,doneThrough:e.through};const t=await((r=(n=window.zero)==null?void 0:n.closeAgent)==null?void 0:r.call(n,e));if(!(t!=null&&t.ok))throw new Error("the app could not close that row");return t},async repeats(){return bc?[]:Re?JS:window.zero.repeats()},async composeRepeat(e){return Re?null:window.zero.composeRepeat(e)},async setRepeat(e){if(Re){const t=JS.find(n=>n.id===e.id);return t?(Object.assign(t,e.rule),t):null}return window.zero.setRepeat(e)},async endRepeat(e){return Re?null:window.zero.endRepeat(e)},async settings(){if(Re)return structuredClone(ts);const e=window.zero;return e!=null&&e.settingsRead?e.settingsRead():{...jo,ok:!1,error:yr}},async recheckClaude(){var n,r,s;const e="https://code.claude.com/docs/en/setup";if(Re){const o=ts.workspace;return{found:!!o.claudeFound,certain:!!o.claudeCertain,url:o.claudeInstallUrl||e}}const t=window.zero;if(!(t!=null&&t.claudeRecheck))return{found:!1,certain:!1,url:e};try{const o=await t.claudeRecheck();return o!=null&&o.ok?{found:!!((n=o.workspace)!=null&&n.claudeFound),certain:((r=o.workspace)==null?void 0:r.claudeCertain)===!0,url:((s=o.workspace)==null?void 0:s.claudeInstallUrl)||e}:{found:!1,certain:!1,url:e}}catch{return{found:!1,certain:!1,url:e}}},async addCodexAccount(){if(Re)return{ok:!0,command:"CODEX_HOME=/tmp/.codex-2 codex login",home:"/tmp/.codex-2"};const e=window.zero;if(!(e!=null&&e.codexAddAccount))return{ok:!1,error:yr};try{return await e.codexAddAccount()??{ok:!1,error:"could not add an account"}}catch(t){return{ok:!1,error:String((t==null?void 0:t.message)??t)}}},async addClaudeAccount(){if(Re)return{ok:!0,command:"CLAUDE_CONFIG_DIR=/tmp/.claude-2 claude auth login",home:"/tmp/.claude-2"};const e=window.zero;if(!(e!=null&&e.claudeAddAccount))return{ok:!1,error:yr};try{return await e.claudeAddAccount()??{ok:!1,error:"could not add an account"}}catch(t){return{ok:!1,error:String((t==null?void 0:t.message)??t)}}},async recheckCodex(){var t,n;if(Re){const r=ts.workspace.codex;return{found:!!(r!=null&&r.found),certain:!!(r!=null&&r.certain)}}const e=window.zero;if(!(e!=null&&e.codexRecheck))return{found:!1,certain:!1};try{const r=await e.codexRecheck();return r!=null&&r.ok?{found:!!((t=r.workspace)!=null&&t.found),certain:((n=r.workspace)==null?void 0:n.certain)===!0}:{found:!1,certain:!1}}catch{return{found:!1,certain:!1}}},async setProjectSetting(e){if(Re)return Gg("project",e);const t=window.zero;return t!=null&&t.setProjectSetting?t.setProjectSetting(e):{...jo,ok:!1,error:yr}},async renameProject(e){if(Re)return Gg("project",{product:e.product,key:"name",value:e.name});const t=window.zero;return t!=null&&t.projectRename?t.projectRename(e):{...jo,ok:!1,error:yr}},async pickProjectIcon(e){if(Re)return{...jo,ok:!0,canceled:!0};const t=window.zero;return t!=null&&t.projectIcon?t.projectIcon(e):{...jo,ok:!1,error:yr}},async clearProjectIcon(e){if(Re)return{...jo,ok:!0};const t=window.zero;return t!=null&&t.projectIconClear?t.projectIconClear(e):{...jo,ok:!1,error:yr}},async importAgents(e){if(Re)return{added:e.agents.length,already:0};const t=window.zero;if(!(t!=null&&t.importAgents)){if(t!=null&&t.setProjectSetting)try{await t.setProjectSetting({product:e.product,key:"agents",value:e.agents})}catch{}return{added:0,already:0}}try{const n=await t.importAgents(e);return{added:Number((n==null?void 0:n.added)??0),already:Number((n==null?void 0:n.already)??0)}}catch{return{added:0,already:0}}},async setWorkspaceSetting(e){if(Re)return Gg("workspace",e);const t=window.zero;return t!=null&&t.setWorkspaceSetting?t.setWorkspaceSetting(e):{...jo,ok:!1,error:yr}},async projectInstructions(e){if(Re){const n=ts.projects.find(r=>r.slug===e);return{ok:!0,text:(n==null?void 0:n.instructions)??""}}const t=window.zero;return t!=null&&t.projectInstructionsRead?t.projectInstructionsRead({product:e}):{ok:!1,text:"",error:yr}},async writeProjectInstructions(e,t){if(Re){const r=ts.projects.find(s=>s.slug===e);return r&&(r.instructions=t),{ok:!1,error:"fixtures have nowhere to save this"}}const n=window.zero;return n!=null&&n.projectInstructionsWrite?n.projectInstructionsWrite({product:e,text:t}):{ok:!1,error:yr}},async createProduct(e){return Re?null:window.zero.createProduct(e)},async chooseFolder(e){if(Re)return yn.has("refusedFolder")?{path:null,refused:"That is your whole home folder. Agents would work across everything on this Mac, and macOS will ask you about Downloads, Music and every app you have. Pick the folder your project’s code is in."}:{path:"/Users/you/Desktop/dev/house"};const t=window.zero;if(!(t!=null&&t.chooseFolder))return{path:null};const n=await t.chooseFolder({startIn:e});return{path:(n==null?void 0:n.path)??null,refused:(n==null?void 0:n.refused)??void 0,browse:(n==null?void 0:n.browse)===!0}},async listFolders(e,t=!1){if(Re)return e4(e??"~");const n=window.zero;if(!(n!=null&&n.listFolders))return{at:e??"~",parent:null,home:"~",folders:[],unreadable:yr};const r=await n.listFolders({at:e,showHidden:t});return{at:(r==null?void 0:r.at)??e??"~",parent:(r==null?void 0:r.parent)??null,home:(r==null?void 0:r.home)??"~",folders:Array.isArray(r==null?void 0:r.folders)?r.folders:[],refused:(r==null?void 0:r.refused)??null,unreadable:(r==null?void 0:r.unreadable)??void 0}},async folderExists(e){if(Re)return!1;const t=window.zero;if(!(t!=null&&t.folderExists))return!0;const n=await t.folderExists({path:e});return!!(n!=null&&n.exists)},async agentFiles(e){if(Re){const n=eC();return bc?{user:[],project:[],chosen:null}:yn.has("noProjectAgents")?{...n,project:[]}:n}const t=window.zero;if(!(t!=null&&t.agentFiles))return{user:[],project:[],chosen:null};try{const n=await t.agentFiles(e);return{user:(n==null?void 0:n.user)??[],project:(n==null?void 0:n.project)??[],chosen:(n==null?void 0:n.chosen)??null}}catch{return{user:[],project:[],chosen:null}}},async agentFolders(){if(Re)return bc||yn.has("noOtherFolders")?[]:[{folder:"/home/dev/sidecar-desktop",short:"~/Desktop/dev/sidecar-desktop",name:"sidecar-desktop",count:4,agents:eC().project.map(t=>({...t,path:`/home/dev/sidecar-desktop/.claude/agents/${t.name}.md`}))}];const e=window.zero;if(!(e!=null&&e.agentFolders))return[];try{const t=await e.agentFolders();return Array.isArray(t==null?void 0:t.folders)?t.folders:[]}catch{return[]}},async agentThreads(){if(Re)return bc||yn.has("noThreads")?[]:XF();const e=window.zero;if(!(e!=null&&e.agentThreads))return[];try{const t=await e.agentThreads();return Array.isArray(t==null?void 0:t.threads)?t.threads:[]}catch{return[]}},async importThreads(e){if(Re)return{added:e.threads.length,already:0};const t=window.zero;if(!(t!=null&&t.importThreads))return{added:0,already:0};try{const n=await t.importThreads(e);return{added:Number((n==null?void 0:n.added)??0),already:Number((n==null?void 0:n.already)??0)}}catch{return{added:0,already:0}}},async pauseSupervisor(e){if(!Re)return window.zero.pauseSupervisor(e)},onChanged(e){return Re?()=>{}:window.zero.onChanged(e)}},nf=Object.freeze(Object.defineProperty({__proto__:null,RESTART_NOTE:yr,api:q},Symbol.toStringTag,{value:"Module"}));function d4(e){return e.fromTask&&e.index>=0?{index:e.index,excludeId:e.id}:null}const pk=[{name:"model",description:"Set the AI model for Claude Code",menuDescription:null,whole:!0,argumentHint:"<model>",aliases:[]},{name:"effort",description:"Set effort level for model usage",menuDescription:null,whole:!0,argumentHint:null,aliases:[]},{name:"fast",description:"Toggle fast mode",menuDescription:null,whole:!1,argumentHint:"[on|off]",aliases:[]},{name:"goal",description:"Set a goal — keep working until the condition is met",menuDescription:null,whole:!0,argumentHint:null,aliases:[]},{name:"context",description:"Show current context usage",menuDescription:null,whole:!0,argumentHint:null,aliases:[]},{name:"usage",description:"Show session cost, plan usage, and what's contributing to your limits",menuDescription:"Show session cost and plan usage",whole:!0,argumentHint:null,aliases:["cost","stats"]},{name:"mcp",description:"Manage MCP servers",menuDescription:null,whole:!0,argumentHint:"[reconnect|enable|disable [<server>|all]]",aliases:[]},{name:"compact",description:"Free up context by summarizing the conversation so far",menuDescription:null,whole:!0,argumentHint:"<optional custom summarization instructions>",aliases:[]},{name:"advisor",description:"Let Claude consult a stronger model at key moments",menuDescription:null,whole:!0,argumentHint:null,aliases:[]},{name:"autocompact",description:"Configure the auto-compact window size",menuDescription:null,whole:!0,argumentHint:"[auto|<tokens>]",aliases:[]},{name:"output-style",description:"List output styles or switch to one",menuDescription:null,whole:!0,argumentHint:"[style]",aliases:[]},{name:"recap",description:"Generate a one-line session recap now",menuDescription:null,whole:!0,argumentHint:null,aliases:[]},{name:"reload-skills",description:"Pick up skills added or changed on disk during this session",menuDescription:null,whole:!0,argumentHint:null,aliases:[]},{name:"list-agents",description:"List subagents, teammates, and other Claude sessions you can message",menuDescription:null,whole:!0,argumentHint:null,aliases:["peers"]},{name:"focus",description:"Toggle focus view: just your prompt, summary, and response",menuDescription:null,whole:!0,argumentHint:"[on|off]",aliases:[]},{name:"reload-plugins",description:"Activate pending plugin changes in the current session",menuDescription:null,whole:!0,argumentHint:"[--force]",aliases:[]}];function gR(e){return[e.name,...e.aliases??[]]}function f4(e){return(e.menuDescription||e.description).replace(/\s*—\s*/g,", ")}function h4(e){return`/${e.name} `}function yR(e,t=[]){if(typeof e!="string"||!e.startsWith("/"))return null;const n=e.match(/^\/([a-z][a-z0-9:_-]*)(?:(\s[\s\S]*))?$/i);if(!n)return null;const r=n[1].toLowerCase(),s=r==="review"&&t.includes("code-review")?"code-review":r,o=pk.find(l=>gR(l).includes(s))??(t.includes(s)?{name:s}:null);if(!o)return null;const i=(n[2]??"").trim();return i?`/${o.name} ${i}`:`/${o.name}`}function p4(e,t,n){return!e||e.agent||(n??Ft)!==Ft?!1:yR(t)!==null}function m4(e,t){return e?t?t.product===e.product&&t.id===e.id?e:null:e:null}function g4(e,t){return!t&&e?"inbox":"stay"}function y4(e,t,n){if(!t)return null;const r=e.find(s=>s.id===t.id&&s.product===t.product);return!r||r===t?null:n||(r.updatedAt??0)!==(t.updatedAt??0)?r:null}const w4="clean",oC="repeat:";function um(e){const t=((e==null?void 0:e.labels)??[]).find(n=>typeof n=="string"&&n.startsWith(oC));return t?t.slice(oC.length):null}function dm(e){return!!um(e)&&((e==null?void 0:e.labels)??[]).includes(w4)}const k4=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function _0(e){return!e||typeof e.at!="string"||!/^([01]\d|2[0-3]):[0-5]\d$/.test(e.at)?!1:e.every==="day"||e.every==="weekday"?!0:e.every==="week"?Number.isInteger(e.on)&&e.on>=0&&e.on<=6:!1}function mo(e){if(!_0(e))return"Once";const t=x4(e.at);return e.every==="day"?`daily at ${t}`:e.every==="weekday"?`weekdays at ${t}`:`${k4[e.on]}s at ${t}`}function x4(e){const[t,n]=e.split(":").map(Number),r=new Date;return r.setHours(t,n,0,0),r.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}).toLowerCase().replace(/\s/g,"")}function wR(e,t){return e.every==="day"?!0:e.every==="weekday"?t.getDay()>=1&&t.getDay()<=5:t.getDay()===e.on}function b4(e=Date.now()){const t=new Date(e),n=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0");return`${t.getFullYear()}-${n}-${r}`}function v4(e,t=Date.now()){if(!_0(e))return null;const[n,r]=e.at.split(":").map(Number),s=new Date(t),o=new Date(s.getFullYear(),s.getMonth(),s.getDate(),n,r,0,0);o.getTime()>t&&o.setDate(o.getDate()-1);for(let i=0;i<8;i++){if(wR(e,o))return b4(o.getTime());o.setDate(o.getDate()-1)}return null}function kR(e,t=Date.now()){if(!_0(e)||e.endedAt)return null;const[n,r]=e.at.split(":").map(Number),s=new Date(t),o=new Date(s.getFullYear(),s.getMonth(),s.getDate(),n,r,0,0);o.getTime()<=t&&o.setDate(o.getDate()+1);for(let i=0;i<8;i++){if(wR(e,o))return o.getTime();o.setDate(o.getDate()+1)}return null}function zh(e,t){return!e||!t?e===t:e.every===t.every&&e.at===t.at&&(e.on??null)===(t.on??null)}function Yo(e,t=Date.now()){const n=Math.max(0,Math.floor((t-e)/1e3));if(n<60)return`${n}s`;const r=Math.floor(n/60);if(r<60)return`${r}m`;const s=Math.floor(r/60);if(s<24)return`${s}h`;const o=Math.floor(s/24);return o<7?`${o}d`:new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function _h(e,t=Date.now()){const n=new Date(e);return Math.floor((Pu(t)-Pu(e))/864e5)===0?n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}):n.toLocaleDateString(void 0,{month:"short",day:"numeric"}).toUpperCase()}function fm(e,t=Date.now()){const n=Math.floor((Pu(t)-Pu(e))/864e5);return n===0?"Today":n===-1?"Tomorrow":n<0?new Date(e).toLocaleDateString(void 0,{weekday:"long",month:"short",day:"numeric"}):n===1?"Yesterday":n<7?"Last 7 days":"Earlier"}function Pu(e){const t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function mk(e){if(!e)return[];const t=e.split(`
109
+ `);let n=!1;const r=[];for(const s of t){if(/^#{1,4}\s/.test(s)){n=/option/i.test(s);continue}if(!n)continue;const o=s.match(/^\s*(\d+)[.)]\s+(.*)$/);o&&r.push({n:Number(o[1]),text:o[2].trim(),recommended:/\(recommended\)/i.test(o[2])})}return r}function hm(e){return mk(e.result).length?"result":mk(e.note).length?"note":"body"}function ga(e){return mk(e[hm(e)])}function xR(e){var r,s,o,i;if(!ga(e).length)return!1;if(!e.answer||e.answer==="(withdrawn)")return!0;const t=((s=(r=e.wrote)==null?void 0:r.answer)==null?void 0:s.ts)??0;return(((i=(o=e.wrote)==null?void 0:o[hm(e)])==null?void 0:i.ts)??0)>t}const S4=["sun","mon","tue","wed","thu","fri","sat"];function C4(e,t){return e.trim()?t?"typed":"refuse":"selected"}const bR={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,fifteen:15,"twenty five":25,twenty:20,thirty:30,"forty five":45,forty:40,fifty:50,sixty:60,ninety:90},E4=new RegExp(`^(${Object.keys(bR).sort((e,t)=>t.length-e.length).map(e=>e.replace(" ","[\\s-]+")).join("|")})\\b`);function vR(e,t=Date.now()){let n=e.trim().toLowerCase().replace(/\s+/g," ");if(!n)return null;if(n==="next week")return aC(lC(t,1),t);if(n==="tonight"||n==="this evening"||n==="evening"){const o=new Date(t);return o.setHours(18,0,0,0),o.getTime()<=t&&o.setDate(o.getDate()+1),Io(o.getTime(),t)}if(/^(tomorrow|tomorrow morning|tmrw|tmr|tom)$/.test(n)){const o=new Date(t+864e5);return o.setHours(8,0,0,0),Io(o.getTime(),t)}n=n.replace(/^in /,""),(n==="an hour"||n==="a hour")&&(n="1h"),n==="a day"&&(n="1d"),(n==="half an hour"||n==="half hour")&&(n="30m"),n=n.replace(/^next /,""),n=n.replace(E4,o=>String(bR[o.replace(/[\s-]+/g," ")]));let r=n.match(/^(\d+)\s*m(?:ins?|inutes?)?$/);if(r)return Io(t+Number(r[1])*6e4,t);if(r=n.match(/^(\d+(?:\.\d+)?)\s*h(?:ours?|rs?)?$/),r)return Io(t+Number(r[1])*36e5,t);if(r=n.match(/^(\d+)\s*d(?:ays?)?$/),r){const o=new Date(t+Number(r[1])*864e5);return o.setHours(8,0,0,0),Io(o.getTime(),t)}if(r=n.match(/^(\d{1,2})(?::(\d{2}))?\s*(am|pm)?$/),r){let o=Number(r[1]);const i=Number(r[2]??0),l=r[3];if(o>23||i>59)return null;l==="pm"&&o<12&&(o+=12),l==="am"&&o===12&&(o=0);const a=new Date(t);return a.setHours(o,i,0,0),a.getTime()<=t&&a.setDate(a.getDate()+1),Io(a.getTime(),t)}const s=n.match(/^(sun|mon|tue|wed|thu|fri|sat)[a-z]*(?:\s+(?:at\s+)?(.+))?$/);if(s){const o=lC(t,S4.indexOf(s[1]));if(!s[2])return aC(o,t);const i=CR(s[2]);if(!i)return null;const[l,a]=i.split(":").map(Number);return o.setHours(l,a,0,0),Io(o.getTime(),t)}return null}const N4=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],T4=String.raw`(?:sun|sunday|sundays|mon|monday|mondays|tue|tues|tuesday|tuesdays|wed|weds|wednesday|wednesdays|thu|thur|thurs|thursday|thursdays|fri|friday|fridays|sat|saturday|saturdays)`,A4=String.raw`(?:sundays|mondays|tuesdays|wednesdays|thursdays|fridays|saturdays)`,SR=String.raw`(?:(?:every|each)\s+(?:other\s+day|weekday|weekdays|day|morning|night|evening|${T4})|daily|weekdays?|${A4})`,j4=new RegExp(`^${SR}\\b`,"i"),M4=new RegExp(`\\b(${SR})\\s+(?:at\\s+)?([0-9][^,.]*)`,"i"),iC=/other day|night|evening/i;function F0(e){const t=(e??"").split(`
110
+ `)[0].trim().toLowerCase().replace(/\s+/g," ");if(!t)return null;for(const r of t.split(",")){const s=r.trim().match(j4);if(!s)continue;if(iC.test(s[0]))return{unreadable:!0};const i=r.trim().slice(s[0].length).trim().match(/^at\s+(.+)$/);return i?Jg(s[0],i[1]):Jg(s[0],"")}const n=t.match(M4);return n?iC.test(n[1])?{unreadable:!0}:Jg(n[1],n[2]):null}function Jg(e,t){const n=t?CR(t):"08:00";if(!n)return{unreadable:!0};const r=e.toLowerCase();if(/weekday/.test(r))return Qg({every:"weekday",at:n});const s=N4.findIndex(o=>new RegExp(`\\b${o.slice(0,3)}`).test(r));return s>=0&&!/every day|each day|daily|morning/.test(r)?Qg({every:"week",on:s,at:n}):Qg({every:"day",at:n})}function CR(e){const t=e.trim().match(/^(\d{1,2})(?::(\d{2}))?\s*(am|pm)?\b/);if(!t)return null;let n=Number(t[1]);const r=Number(t[2]??0),s=t[3];return r>59||n>23?null:(s==="pm"&&n<12&&(n+=12),s==="am"&&n===12&&(n=0),`${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}`)}function Qg(e){return{rule:e,label:mo(e)}}function lC(e,t){const n=new Date(e);return n.setDate(n.getDate()+((t-n.getDay()+7)%7||7)),n}function aC(e,t){return e.setHours(8,0,0,0),Io(e.getTime(),t)}function Io(e,t){const n=new Date(e),r=Math.floor((e-Pu(t))/864e5),s=n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}),o=r===0?"today":r===1?"tomorrow":n.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"});return{ts:e,label:`${o}, ${s}`}}function ER(e,t){return e.replace(/^#{1,4}\s.*$/gm,n=>t==="keep"?n.replace(/^#{1,4}\s*/,""):"").replace(/!\[[^\]]*\]\([^)]*\)/g,"").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/[*_`>#]/g,"").split(`
111
+ `).map(n=>n.trim()).filter(Boolean).join(" ")}function R4(e){return e?ER(e,"drop"):""}function rf(e){return e?ER(e,"keep"):""}function NR(e){return R4(e).slice(0,200)}const O4=["result","title","body"];function I4(e,t){return O4.some(n=>{var s;const r=(s=e==null?void 0:e.wrote)==null?void 0:s[n];return!!r&&r.source==="agent"&&(r.ts??0)>t})}function TR(e){var r,s;const t=e==null?void 0:e.answer;if(!t||t==="(withdrawn)")return!1;const n=((s=(r=e==null?void 0:e.wrote)==null?void 0:r.answer)==null?void 0:s.ts)??0;return n>0&&((e==null?void 0:e.answeredThrough)??0)>=n?I4(e,n):!1}function D4(e){const t=Math.max(0,Math.trunc(e??0)),n=t!==1;return`${t} task${n?"s":""} ${n?"have":"has"} not been able to run`}const pm="trouble";function Rn(e){return!!e&&e.id===pm}function L4(e){if(e.cause==="at-limit"){const t=/at (\d[^.]*)\./.exec(e.next);return t?`back at ${t[1]}`:"back when the limit resets"}return e.cause==="signed-out"?"need a login":e.cause==="org-blocked"?"need an admin":e.cause==="workspace"?"need the folder trusted":e.cause==="interrupted"?"retrying on their own":"stopped, still trying"}function Fh(e){var t;return(t=e.byCause)!=null&&t.length?e.byCause:[{cause:e.cause==="mixed"?"unknown":e.cause,count:e.count??1,what:e.message,next:e.remedy,act:null,hers:!1}]}function P4(e){return e.count??Fh(e).reduce((t,n)=>t+n.count,0)}function $4(e){return D4(P4(e))}function z4(e){return Fh(e).map(t=>`${t.count} ${L4(t)}`).join(" · ")}function _4(e,t=[]){const n=new Map(t.map(l=>[l.id,l])),r=e.stopped??(e.ids??[]).map(l=>({id:l,cause:"unknown"})),s=[z4(e)];for(const l of Fh(e)){const a=r.filter(c=>c.cause===l.cause);s.push(`**${l.what}.** ${l.next}`),a.length&&s.push(a.map(c=>{const u=n.get(c.id);return`- ${u?u.title:"A task that is no longer in your inbox"}${u!=null&&u.productName?` (${u.productName})`:""}`}).join(`
112
+ `))}const o=new Set(Fh(e).map(l=>l.cause)),i=r.filter(l=>!o.has(l.cause));return i.length&&(s.push(`**${i.length} more.** ${Pn} keeps trying on its own.`),s.push(i.map(l=>{var a;return`- ${((a=n.get(l.id))==null?void 0:a.title)??"A task that is no longer in your inbox"}`}).join(`
113
+ `))),s.join(`
114
+
115
+ `)}function F4(e,t=[]){return{id:pm,product:"",productName:"",status:"open",title:$4(e),body:_4(e,t),kind:"trouble",labels:[],priority:5,epoch:0,claim:null,createdAt:e.since,updatedAt:e.since}}const Bh=e=>(e.labels??[]).includes("founder"),ya=e=>e.answer&&e.answer!=="(withdrawn)"?e.answer:void 0,B4=["title","body","answer"];function H4(e){var n;let t=0;for(const r of B4){const s=(n=e.wrote)==null?void 0:n[r];(s==null?void 0:s.source)==="founder"&&(t=Math.max(t,s.ts??0))}return t}function AR(e){var n;if(e.status!=="open"||!Bh(e)||ya(e)||!e.result)return!1;const t=(n=e.wrote)==null?void 0:n.result;return!!t&&t.source==="agent"&&(t.ts??0)>H4(e)}function Gf(e,t=Date.now()){var n,r;return e.status==="done"?!1:(e.runAt??0)>t&&((r=(n=e.wrote)==null?void 0:n.runAt)==null?void 0:r.source)!=="founder"}function W4(e,t=0){var r,s;const n=((s=(r=e.wrote)==null?void 0:r.runAt)==null?void 0:s.source)==="founder"?e.runAt??0:0;return Math.max(n,t)}function jR(e,{deliveredThrough:t=0,hiddenUntil:n=0,now:r=Date.now()}={}){var s,o,i,l;return n>r||dm(e)?!1:Gf(e,r)||e.status!=="done"&&e.status!=="claimed"&&TR(e)||AR(e)?!0:e.status==="done"?!Bh(e)&&!ya(e)||((o=(s=e.wrote)==null?void 0:s.status)==null?void 0:o.source)==="founder"?!1:(((l=(i=e.wrote)==null?void 0:i.status)==null?void 0:l.ts)??e.updatedAt??0)>t:e.status==="blocked"?!0:e.kind==="question"||e.kind==="review"||e.status==="open"&&!Bh(e)?!ya(e):!1}function Hh(e,{deferredUntil:t=0,now:n=Date.now()}={}){return t>n?!1:e.status==="claimed"?!0:TR(e)||AR(e)?!1:e.status==="open"&&ya(e)?!0:e.status==="open"&&e.kind!=="question"&&e.kind!=="review"&&Bh(e)}function U4(e,{deferredUntil:t=0,now:n=Date.now()}={}){return Hh(e,{deferredUntil:t,now:n})}function cC(e,{deliveredThrough:t=0,hiddenUntil:n=0,deferredUntil:r=0,now:s=Date.now()}={}){return Hh(e,{deferredUntil:r,now:s})||n>s&&e.status!=="done"?!0:jR(e,{deliveredThrough:t,hiddenUntil:n,now:s})}function uC(e){return e==="blocked"||e==="done"?"open":void 0}function dC(e){return{answer:"(withdrawn)",status:e}}function V4(e,t=Date.now()){return(e.runAt??0)>t}function K4(e,t){const n=new Map(t.map(o=>[o.id,o])),r=new Set(e.map(o=>o.id)),s=new Set;for(const o of t){let i=o;const l=new Set([i.id]);for(;i.parent;){const a=n.get(i.parent);if(!a||l.has(a.id))break;l.add(a.id),r.has(a.id)&&s.add(a.id),i=a}}return s}function q4(e,t){const n=new Map(t.map(o=>[o.id,o])),r=new Set(e.map(o=>o.id)),s=[];for(const o of e){let i=n.get(o.id)??o;const l=new Set([i.id]);for(;i.parent;){const a=n.get(i.parent);if(!a||l.has(a.id))break;l.add(a.id),r.has(a.id)||(r.add(a.id),s.push(a)),i=a}}return s}function fC(e,t={}){return t.shift?"range":e==="box"||t.meta||t.ctrl?"toggle":"open"}function MR(e,t){var o,i,l,a;if(e.id===pm)return no((e.body??"").split(`
116
+ `)[0].trim());const n=t==="done"||e.status==="done",r=(((i=(o=e.wrote)==null?void 0:o.result)==null?void 0:i.ts)??0)>(((a=(l=e.wrote)==null?void 0:l.body)==null?void 0:a.ts)??0),s=!!e.result&&(n||r);return no(NR(s?e.result:Y4(e)))}function hC(e){return(e.label??"").trim()||(e.title??"")}function Y4(e){const t=e.body??"",n=(e.title??"").replace(/…$/,"").trim();return n&&t.startsWith(n)?t.slice(n.length).trim():t}const gk=112;function no(e,t=gk){if(e.length<=t)return e;const n=e.slice(0,t+1),r=Math.max(n.lastIndexOf(". "),n.lastIndexOf("? "),n.lastIndexOf("! "));if(r>40)return e.slice(0,r+1);const s=n.lastIndexOf(" ");return`${e.slice(0,s>40?s:t).trimEnd()}…`}function pC(e){return(t,n)=>e(n)-e(t)||n.updatedAt-t.updatedAt}const G4="Urgent",J4="Everything else";function Q4(e,t=!1){return t?[]:e==="inbox"?[{key:"R",word:"Reply"},{key:"E",word:"Close"}]:e==="snoozed"?[{key:"E",word:"Back to inbox"},{key:"S",word:"Remind me"}]:[{key:"⏎",word:"Open"}]}function X4(e,t,n){if(!t)return e;const r=t.key;return r?t.rows.includes(n)?e.filter(s=>s.key.toUpperCase()===r.toUpperCase()):[]:[]}const Z4=100;function e3(e){if(!Array.isArray(e))return[];const t=new Set,n=[];for(const r of e)typeof r!="string"||!r||t.has(r)||(t.add(r),n.push(r));return n}function t3(e,t){const n=e.indexOf(t);return n===-1?0:(e.length-n)*Z4}const Xg=5;function RR(e){var n,r;if(!e||((r=(n=e.wrote)==null?void 0:n.priority)==null?void 0:r.source)==="agent")return Xg;const t=e.priority;return Number.isFinite(t)&&t>0?t:Xg}const n3=9;function r3(e,t,n){if(!Array.isArray(e))return 0;for(let r=0;r<e.length;r+=1){const s=e[r];if(s&&(n<s.top||n<=s.bottom&&t<s.left+s.width/2))return r}return e.length}function s3(e,t,n){const r=e3(e).filter(o=>o!==t),s=Math.max(0,Math.min(r.length,Math.trunc(n)));return r.splice(s,0,t),r}function rl(e){return!!e&&RR(e)>=n3}function o3(e){if(!e.reading||e.typing||rl(e.reading))return null;for(const t of e.inbox)if(t.id!==e.reading.id&&rl(t)&&!e.known.has(t.id)&&!e.spent.has(t.id))return t;return null}function i3(e,t){if(!e)return null;const n=t.find(r=>r.id===e.id&&r.product===e.product);return!n||n.status==="done"?null:n}const l3=/^(\d\d):(\d\d):(\d\d) {2}(.*)$/,a3=/^# exited \((-?\d+)\)(?:\s+(\S+))?/;function c3(e,t){const n=e<12?"am":"pm";return`${e%12===0?12:e%12}:${String(t).padStart(2,"0")}${n}`}function Wh(e,t,n,r){const s=new Date(e),o=Date.UTC(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate(),t,n,r);return o<e?o+864e5:o}function mC(e){const t=new Date(e);return c3(t.getHours(),t.getMinutes())}function u3(e){const t=e.split(/\n\s*\n/)[0].trim();if(t.length<=300)return t;const n=t.slice(0,300),r=Math.max(n.lastIndexOf(". "),n.lastIndexOf("? "),n.lastIndexOf("! "));return`${(r>120?n.slice(0,r+1):n).trim()}…`}function d3(e,t){const n=i=>i.replace(/[\s*_`#]+/g," ").trim().toLowerCase(),[r,s]=[n(e),n(t)],o=Math.min(r.length,s.length,60);return o<25?!1:r.slice(0,o)===s.slice(0,o)}function f3(e){var n;const t=e.trim();if(!t)return"The run stopped without saying why.";if(/usage limit|rate.?limit|quota/i.test(t)){const r=(n=t.match(/resets? at ([^.\n]+)/i))==null?void 0:n[1];return`Claude turned the session away: the usage limit is used up${r?`, and resets at ${r.trim()}`:""}.`}return/went to sleep mid-response/i.test(t)?"Your computer went to sleep mid-response, so the agent was cut off part-way.":/credit balance|insufficient/i.test(t)?"Claude refused the session: the account is out of credit.":t.replace(/^API Error:\s*/i,"").split(`
117
+ `)[0].slice(0,300)}function h3(e){var m;const t=[],n=new Set;let r=0,s=0,o=null,i=!1,l="",a=!1,c=null,u=null,f=null;for(const y of e.text.split(`
118
+ `)){const x=l3.exec(y);if(!x){const v=a3.exec(y);if(v){c=Number(v[1]);const b=Date.parse(v[2]??"");Number.isNaN(b)||(u=b),o=null;continue}if(y.startsWith("#"))continue;if(i){l+=`${y}
119
+ `;continue}o&&y.trim()&&(o.text+=`
120
+ ${y}`);continue}const k=x[4];if(k.startsWith("== RESULT")){i=!0,f=Wh(e.startedAt,Number(x[1]),Number(x[2]),Number(x[3])),a=/ERROR/.test(k)||/error/i.test(((m=k.match(/\(([^)]*)\)/))==null?void 0:m[1])??""),o=null;continue}if(i=!1,k.startsWith("[")){const v=k.indexOf("]"),b=v>0?k.slice(1,v):"",E=v>0?k.slice(v+1).trim():"";r+=1,o&&(o.actions+=1),/^(Write|Edit|NotebookEdit)$/.test(b)&&E&&n.add(E),/create_work_item/.test(b)&&(s+=1);continue}k.startsWith("stderr:")||k.trim()&&(o={time:mC(Wh(e.startedAt,Number(x[1]),Number(x[2]),Number(x[3]))),text:k,actions:0},t.push(o))}const h=t[t.length-1];h&&l&&d3(h.text,l)&&t.pop();for(const y of t)y.text=u3(y.text);u===null&&f!==null&&(u=f);const p=a||c!==null&&c!==0;if(p){const y=f3(l);t.push({time:u?mC(u):"",text:y,actions:0,failed:!0})}return{steps:t,actions:r,files:n,filed:s,failed:p,endedAt:u,exitCode:c}}function p3(e){var f;const t=[...e].filter(h=>h&&h.text).sort((h,p)=>h.startedAt-p.startedAt);if(!t.length)return null;const n=[],r=new Set;let s=0,o=0,i=!1,l=null,a=null,c=0,u=null;for(const h of t){const p=h3(h);n.push(...p.steps),p.files.forEach(m=>r.add(m)),s+=p.actions,o+=p.filed,i=p.failed,l=p.failed?((f=p.steps[p.steps.length-1])==null?void 0:f.text)??null:null,a=p.endedAt,p.endedAt?(c+=Math.max(0,p.endedAt-h.startedAt),u=null):u=h.startedAt}return{steps:n,actions:s,files:r.size,filed:o,startedAt:t[0].startedAt,endedAt:a,worked:c,openSince:u,failed:i,failure:l,sessions:t.length,raw:t.map(h=>h.text).join(`
121
+ `)}}function Zg(e){const t=Math.max(0,Math.round(e/1e3));if(t<60)return`${t} second${t===1?"":"s"}`;const n=Math.floor(t/60);return n<60?`${n} minute${n===1?"":"s"}`:`${Math.floor(n/60)}h ${n%60}m`}function OR(e,t=0){return e==="working"&&t>0?t===1?"1 Subagent Working":`${t} Subagents Working`:e==="working"?"Working":e==="queued"?"Queued":e==="paused"?"Paused":e==="silent"?"Nothing came back":"Nothing running"}function yk(e){const t=Math.max(0,Math.floor(e/1e3));if(t<60)return"just now";const n=Math.floor(t/60);return n<60?`${n}m`:`${Math.floor(n/60)}h ${n%60}m`}function gC(e){const t=typeof e=="string"?e.trim():"";return!!t&&t!=="(withdrawn)"}function IR(e,t){return!!t&&!gC(e.result)&&!gC(e.note)}function DR(e,t={}){const{session:n=null,queued:r=[],stalled:s=!1,paused:o=!1,silent:i=null,inProgress:l=!1,scheduledUntil:a=0,now:c=Date.now()}=t;if(e.agent||e.status==="done")return null;if(n){const u=Math.max(0,c-n.startedAt),f=n.helpers??0;if(f>0){const h=f===1?"one subagent":`${f} subagents`;return{state:"working",line:u<6e4?`The agent just started on this, with ${h} out.`:`The agent is working with ${h}, ${Zg(u)} in.`}}return{state:"working",line:u<6e4?"The agent just started on this.":`The agent is working, ${Zg(u)} in.`}}if(s||a>c)return null;if(IR(e,i)){const u=Math.max(0,c-(i.endedAt||c));return{state:"silent",line:u<6e4?"The last agent finished without saying anything. Send it a message to find out what happened.":`The last agent finished without saying anything, ${Zg(u)} ago. Send it a message to find out what happened.`}}return l?r.includes(e.id)?{state:"queued",line:"Queued. An agent starts on it as soon as one is free."}:o?{state:"paused",line:"Agents are paused, so nothing will start on this."}:{state:"idle",line:"No agent is on this, and none is waiting to start."}:null}function m3(e,t={}){const{inProgress:n=!1,scheduledUntil:r=0,now:s=Date.now()}=t;return e.status==="done"?"closed":e.status==="blocked"?"blocked":r>s?"scheduled":n?"progress":"inbox"}const g3={progress:"In progress",inbox:"In your inbox",scheduled:"Scheduled",closed:"Closed",blocked:"Blocked"},_i={progress:"This is in progress.",inbox:"This is in your inbox, waiting for you.",scheduled:"This is scheduled and is not running yet.",closed:"This is closed.",blocked:"This is blocked and is waiting for you."};function y3(e){let t=0;for(const n of Object.values(e.wrote??{}))n&&n.ts>t&&(t=n.ts);return t||e.updatedAt||0}function LR(e={}){return e.engineChoice?id(e.engine??null):null}function wk(e={}){var t;return LR({...e,engine:((t=e.session)==null?void 0:t.engine)??e.engine??null})}function w3(e,t={}){var c;const n=t.now??Date.now(),r=m3(e,t),s=DR(e,{...t,now:n}),i=(e.labels??[]).some(u=>u==="codex"||u==="codex-import"||u==="not-imported")?id("codex"):wk(t),l=t.session?yk(Math.max(0,n-t.session.startedAt)):null,a=s?OR(s.state,((c=t.session)==null?void 0:c.helpers)??0):null;return{where:r,whereWord:g3[r],state:(s==null?void 0:s.state)??null,stateWord:a,span:l,engineWord:i,age:l?null:Yo(y3(e),n),line:k3({where:r,live:(s==null?void 0:s.line)??null,engineWord:i,span:l})}}function k3({where:e,live:t,engineWord:n,span:r}){if(e==="closed")return _i[e];const s=n??"The agent";return r?`${_i[e]} ${s} has been working on this for ${r}.`:t&&!n?`${_i[e]} ${t}`:t?`${_i[e]} ${t} It will run on ${n}.`:n?`${_i[e]} It will run on ${n}.`:_i[e]}const B0="update";function qn(e){return!!e&&e.id===B0}function yC(e,t){return t.walking||!(e!=null&&e.ready)?!1:!(t.closed&&t.closed===(e.newVersion??""))}const Uh={ready:`A new version of ${Le} is ready`,how:`Restart ${Le} when you are ready. It has already downloaded, restarting takes a few seconds and puts you back where you were.`,restart:"Restart to update"};function x3(e){const t=e==null?void 0:e.currentVersion,n=e==null?void 0:e.newVersion;return t?n&&n!==t?`You are on ${t}. The new one is ${n}.`:`You are on ${t}.`:null}function b3(e){const t=x3(e);return t?`${Uh.how}
122
+
123
+ ${t}`:Uh.how}function v3(e,t=Date.now()){const n=(e==null?void 0:e.readyAt)??t;return{id:B0,product:"",productName:"",status:"open",title:Uh.ready,body:b3(e),kind:"update",labels:[],priority:5,epoch:0,claim:null,createdAt:n,updatedAt:n}}const S3="codex-import",C3="codex",E3="not-imported";function N3(e){for(const t of(e==null?void 0:e.labels)??[])if(typeof t=="string"&&t.startsWith("codex:"))return t.slice(6);return null}const H0=(e,t)=>((e==null?void 0:e.labels)??[]).includes(t),Xc=e=>!!e&&H0(e,S3)&&e.status!=="done",kk=e=>!!e&&H0(e,E3)&&e.status==="done",T3=e=>!!e&&H0(e,C3)&&!!N3(e),Zc=(e,t)=>T3(e)&&e.status!=="done"&&!t.has(e.id),A3="just imported",j3=[{key:"1",word:"Yes"},{key:"2",word:"No"}],M3=[{key:"I",word:"Import"}],R3=e=>e==="yes"?"Yes":"Not now",O3="Not imported",I3={"‘":"'","’":"'",ʼ:"'","“":'"',"”":'"',"–":"-","—":"-"};function _a(e){return e.toLowerCase().replace(/[‘’ʼ“”–—]/g,t=>I3[t])}function PR(e){const t=_a(e).trim(),n=t.length>2&&t.startsWith('"')&&t.endsWith('"'),r=(n?t.slice(1,-1):t).trim(),s=W0(r.replace(/"/g," ").split(/\s+/)),o=s.length>1?s.join(" "):"";return{terms:s,phrase:o,quoted:n&&s.length>0}}function W0(e){return e.map(t=>_a(t)).filter(Boolean)}function xk(e){return e.replace(/\s+/g," ")}function sf(e){return P3(e).map(t=>({raw:t,folded:xk(_a(t))}))}const wC=new WeakMap;function $R(e){const t=wC.get(e);if(t)return t;const n=xk(_a([e.label,e.title].filter(Boolean).join(" . "))),r=rf(e.body),s=rf(e.result),o=rf(e.note),i=rf(e.answer),l=[r,s,o,i].filter(Boolean).join(" . "),a=`${n} . ${xk(_a(l))}`,c={title:n,all:a,body:sf(r),result:sf(s),note:sf(o),answer:sf(i)};return wC.set(e,c),c}function kC(e){return e>="a"&&e<="z"||e>="0"&&e<="9"}function $u(e,t,n=0,r=!1){if(!t)return-1;let s=e.indexOf(t,n);for(;s>=0;){const o=s===0||!kC(e[s-1]),i=!r||!kC(e[s+t.length]??"");if(o&&i)return s;s=e.indexOf(t,s+1)}return-1}function U0(e,t,n,r=0){return $u(e,t[n],r,n<t.length-1)}function xC(e,t){return t.every((n,r)=>U0(e,t,r)>=0)}function D3(e,t){if(t.terms.length===0)return 0;const n=$R(e);if(t.phrase){if($u(n.title,t.phrase)>=0)return 4;if($u(n.all,t.phrase)>=0)return 3;if(t.quoted)return 0}return xC(n.title,t.terms)?2:xC(n.all,t.terms)?1:0}function L3(e,t){const n=PR(t);return n.terms.length===0?[...e].sort((r,s)=>(s.updatedAt??0)-(r.updatedAt??0)).map(r=>({item:r,summary:bC(r,[])})):e.map(r=>({item:r,n:D3(r,n)})).filter(r=>r.n>0).sort((r,s)=>s.n-r.n||(s.item.updatedAt??0)-(r.item.updatedAt??0)).map(({item:r})=>({item:r,summary:bC(r,n.terms,n.phrase)}))}function bC(e,t,n=""){const r=e.status==="done",{body:s,result:o,note:i,answer:l}=$R(e),a=r?[o,s,i]:[s,o,i];for(const c of n?["phrase","words"]:["words"]){const u=c==="phrase";for(const h of a){const p=vC(h,t,n,gk,u);if(p)return p}const f=vC(l,t,n,gk,u);if(f)return f}return MR(e,r?"done":"inbox")}function vC(e,t,n,r,s=!1){const o=W0(t);if(!n&&o.length===0)return"";if(n){for(const i of e)if(!($u(i.folded,n)<0))return CC(i.raw,Math.max(0,SC(i,o)),r)}if(s)return"";for(const i of e){const l=SC(i,o);if(l>=0)return CC(i.raw,l,r)}return""}function P3(e){return e.split(new RegExp("(?<=[.!?])\\s+")).map(t=>t.trim()).filter(Boolean)}function SC(e,t){const n=t.map((r,s)=>s).sort((r,s)=>t[s].length-t[r].length);for(const r of n){const s=U0(e.folded,t,r);if(s>=0)return s}return-1}function CC(e,t,n){if(e.length<=n)return e;let s=Math.max(0,t-24);if(s>0){const i=e.indexOf(" ",s);s=i>=0&&i<t?i+1:s}let o=Math.min(e.length,s+n);if(o<e.length){const i=e.lastIndexOf(" ",o);i>t&&(o=i)}return`${s>0?"…":""}${e.slice(s,o).trim()}${o<e.length?"…":""}`}function $3(e,t,n=""){if(!e)return[];const r=W0(t);if(r.length===0)return[{text:e,hit:!1}];const s=_a(e),o=[],i=(u,f)=>{let h=f(0);for(;h>=0;)o.push([h,h+u.length]),h=f(h+1)};if(r.forEach((u,f)=>i(u,h=>U0(s,r,f,h))),n&&i(n,u=>$u(s,n,u)),o.length===0)return[{text:e,hit:!1}];o.sort((u,f)=>u[0]-f[0]||u[1]-f[1]);const l=[];for(const[u,f]of o){const h=l[l.length-1];h&&u<=h[1]?h[1]=Math.max(h[1],f):l.push([u,f])}const a=[];let c=0;for(const[u,f]of l)u>c&&a.push({text:e.slice(c,u),hit:!1}),a.push({text:e.slice(u,f),hit:!0}),c=f;return c<e.length&&a.push({text:e.slice(c),hit:!1}),a}function EC({engineChoice:e,engines:t,item:n}){var o;if(!e||!t)return null;const s=(n.labels??[]).some(i=>i==="codex"||i==="codex-import"||i==="not-imported")?"codex":((o=t.byItem)==null?void 0:o[n.id])??t.workspace??Ft;return LR({engineChoice:e,engine:s})}function NC({text:e,terms:t,phrase:n}){return t!=null&&t.length?d.jsx(d.Fragment,{children:$3(e,t,n).map((r,s)=>r.hit?d.jsx("b",{className:"hit",children:r.text},s):d.jsx("span",{children:r.text},s))}):d.jsx(d.Fragment,{children:e})}function z3(e,t,n=Date.now()){const r=kR(e,n),s=r?`${new Date(r).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})} ${fm(r,n).toLowerCase()}`:"not scheduled";return t?t.status==="open"||t.status==="claimed"?{when:s,last:`running, started ${Yo(t.createdAt,n)}`}:dm(t)?{when:s,last:`last run ${_h(t.updatedAt,n)}, clean`}:{when:s,last:`last run ${_h(t.updatedAt,n)}, ${NR(t.result)||"needs a look"}`}:{when:s,last:"not run yet"}}function _3(e,t){const n=[];return e.forEach((r,s)=>{const o=t(r,s),i=n[n.length-1];(!i||i.label!==o)&&n.push({key:r.id,label:o,items:[]}),n[n.length-1].items.push({item:r,index:s})}),n}function F3({items:e,view:t,keyView:n,hoveredId:r,selected:s,seen:o,running:i,engineChoice:l,engines:a,stalled:c,queued:u,silent:f,paused:h,multiSel:p,snoozes:m,repeats:y,allItems:x,terms:k,phrase:v,summaries:b,ranked:E,emptyText:N,walk:T,onSelect:A,onOpen:R,onOpenRepeat:$,onToggle:L,onRange:_,onHover:j,onAnswerImport:F}){const ae=t==="snoozed"?y??[]:[],G=Q4(n??t,p.size>0),I=ce=>Xc(e.find(C=>C.id===ce))?[]:X4(ce===pm||ce===B0?G.filter(C=>C.key!=="R"):G,T??null,ce);if(e.length===0&&ae.length===0)return N?d.jsx("div",{className:"empty",children:N}):null;const ne=ce=>Math.max(ce.runAt??0,(m==null?void 0:m[ce.id])??0),B=ce=>ne(ce)||ce.updatedAt,J=ce=>new Date(ce).toLocaleString(void 0,{weekday:"short",hour:"numeric",minute:"2-digit"}),M=t==="inbox"&&!E?e.findIndex(rl):-1,Q=_3(e,(ce,C)=>t==="done"&&kk(ce)?O3:t==="snoozed"&&!Rn(ce)&&!E?`Returns ${fm(B(ce))}`:M>=0&&C>=M?rl(ce)?G4:J4:"");return d.jsxs("div",{className:"list",children:[ae.length>0&&d.jsxs("div",{children:[d.jsx("div",{className:"day-label",children:"Repeating"}),ae.map(ce=>{const C=x??e,re=ce.lastOccurrence?C.find(V=>V.id===ce.lastOccurrence)??null:null,W=z3(ce,re);return d.jsxs("div",{className:"row",onClick:()=>$==null?void 0:$(ce),children:[d.jsx("span",{className:"mark"}),d.jsxs("div",{className:"row-main",children:[d.jsx("div",{className:"subject",children:ce.title}),d.jsx("div",{className:"preview",children:W.last})]}),d.jsxs("div",{className:"row-end",children:[d.jsx("span",{className:"chip",children:"daily"}),d.jsx("span",{className:"product",children:ce.productName}),d.jsx("span",{className:"time",children:W.when})]})]},ce.id)})]}),Q.map(ce=>d.jsxs("div",{children:[ce.label&&d.jsx("div",{className:"day-label",children:ce.label}),ce.items.map(({item:C,index:re})=>{const W=i.find(ye=>ye.itemId===C.id),V=p.has(C.id),Se=Rn(C)||qn(C);return d.jsxs("div",{"data-item-id":C.id,...t==="inbox"&&!Xc(C)?{"data-hint":"row","data-hint-text":".subject"}:{},className:`row ${Se?"trouble-row ":""}${re===s?"selected":""} ${V?"checked":""}`,onMouseMove:()=>{r!==C.id&&(j==null||j(C.id))},onMouseLeave:()=>{r===C.id&&(j==null||j(null))},onClick:ye=>{const De=fC("row",{shift:ye.shiftKey,meta:ye.metaKey,ctrl:ye.ctrlKey});if(De==="range"){_(re);return}if(De==="toggle"){L(re);return}A(re),R(C)},children:[Se?d.jsx("span",{className:"trouble-rule","aria-hidden":"true"}):d.jsx("button",{type:"button",className:`mark${V?" on":""}`,role:"checkbox","aria-checked":V,"aria-label":`${V?"Deselect":"Select"} ${hC(C)}`,onClick:ye=>{ye.stopPropagation(),fC("box",{shift:ye.shiftKey})==="range"?_(re):L(re)},children:d.jsx("span",{className:"box","aria-hidden":"true"})}),d.jsxs("div",{className:"row-main",children:[d.jsx("div",{className:"subject",children:d.jsx(NC,{text:hC(C),terms:k,phrase:v})}),d.jsx("div",{className:"preview",children:d.jsx(NC,{text:(b==null?void 0:b.get(C.id))??MR(C,t),terms:k,phrase:v})})]}),d.jsx("div",{className:"row-end",children:T&&I(C.id).length?d.jsx("span",{className:"row-keys",children:I(C.id).map(ye=>d.jsxs("span",{className:"row-key",children:[d.jsx("kbd",{children:ye.key}),d.jsx("span",{className:"row-key-word",children:ye.word})]},ye.key))}):Xc(C)?d.jsx("span",{className:"row-keys import-keys",children:j3.map(ye=>d.jsxs("button",{type:"button",className:"row-key",title:ye.word,onClick:De=>{De.stopPropagation(),F==null||F(C,ye.key==="1"?"yes":"no")},children:[d.jsx("kbd",{children:ye.key}),d.jsx("span",{className:"row-key-word",children:ye.word})]},ye.key))}):d.jsxs(d.Fragment,{children:[t==="done"&&kk(C)?d.jsx("span",{className:"row-keys import-keys import-key",children:M3.map(ye=>d.jsxs("button",{type:"button",className:"row-key",title:ye.word,onClick:De=>{De.stopPropagation(),F==null||F(C,"yes")},children:[d.jsx("kbd",{children:ye.key}),d.jsx("span",{className:"row-key-word",children:ye.word})]},ye.key))}):null,rl(C)||C.agent?null:(C.priority??5)>=7?d.jsxs("span",{className:"prio-bars p3",title:"high priority",children:[d.jsx("i",{}),d.jsx("i",{}),d.jsx("i",{})]}):(C.priority??5)<=2?d.jsxs("span",{className:"prio-bars p1 low",title:"low priority",children:[d.jsx("i",{}),d.jsx("i",{}),d.jsx("i",{})]}):null,d.jsx("span",{className:"product",children:C.productName}),!Zc(C,o)&&!W&&EC({engineChoice:l,engines:a,item:C})&&d.jsx("span",{className:"time agent",children:EC({engineChoice:l,engines:a,item:C})}),!Zc(C,o)&&W&&wk({engineChoice:l,session:W})&&d.jsx("span",{className:"time agent",children:wk({engineChoice:l,session:W})}),Zc(C,o)?d.jsx("span",{className:"time imported",children:A3}):W?d.jsxs("span",{className:"time working",children:["working · ",Yo(W.startedAt)]}):c!=null&&c.includes(C.id)?d.jsxs("span",{className:"time stalled",children:["stopped · ",Yo(C.updatedAt)]}):IR(C,f==null?void 0:f[C.id])?d.jsxs("span",{className:"time quiet",title:"An agent ran on this and finished without writing anything back. Send it a message to find out what happened.",children:["nothing came back · ",Yo(f[C.id].endedAt||C.updatedAt)]}):u!=null&&u.includes(C.id)?d.jsx("span",{className:"time",children:"queued"}):h&&t==="progress"?d.jsx("span",{className:"time",children:"paused"}):d.jsx("span",{className:"time",children:t==="snoozed"?J(B(C)):t==="inbox"?_h(C.updatedAt):Yo(C.updatedAt)})]})})]},C.id)})]},ce.key))]})}function B3({product:e,id:t}){const[n,r]=w.useState(null),[s,o]=w.useState(!1),i={product:e,id:t};w.useEffect(()=>{let u=!1;const f=()=>q.remoteControl({product:e,id:t,action:"status"}).then(m=>{u||r(m)}).catch(()=>{});f();const h=setInterval(f,1e3),p=()=>{q.remoteControl({product:e,id:t,action:"toggle"}).then(m=>{u||r(m)}).catch(m=>{u||r({state:"failed",at:Date.now(),text:m.message})})};return window.addEventListener("task-remote-control-open",p),()=>{u=!0,clearInterval(h),window.removeEventListener("task-remote-control-open",p)}},[e,t]);const l=async u=>{o(!0);try{r(await q.remoteControl({...i,action:u}))}catch(f){r({state:"failed",at:Date.now(),text:f instanceof Error?f.message:"The operation failed."})}finally{o(!1)}};if(!n||n.state==="off")return null;const a=["ready","connected"].includes(n.state),c=["connecting","disconnecting","reconnecting"].includes(n.state);return d.jsxs("section",{className:"thread remote-control",onMouseDown:u=>u.stopPropagation(),"aria-label":"Remote control",children:[d.jsx("div",{className:"remote-command",children:"/remote-control"}),d.jsxs("div",{className:"remote-card",children:[d.jsxs("div",{className:"remote-main",children:[d.jsxs("svg",{className:"remote-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[d.jsx("rect",{x:"3",y:"4",width:"12",height:"10",rx:"2"}),d.jsx("path",{d:"M7 18h4M9 14v4"}),d.jsx("rect",{x:"16",y:"9",width:"5",height:"11",rx:"1.5"})]}),d.jsxs("div",{className:"remote-copy",children:[d.jsx("div",{className:"remote-eyebrow",role:"status",children:a?"Remote control is on":c?n.state==="connecting"?"Connecting…":n.state==="disconnecting"?"Turning off…":"Reconnecting…":"Remote control"}),d.jsx("h3",{children:a?"Your conversation goes with you":n.state==="failed"?"Couldn’t connect":"Pick up on another device"}),d.jsx("p",{children:n.text||(a?"Open this chat in Claude on your phone or browser.":"Continue this chat in Claude on your phone or browser.")})]})]}),d.jsxs("div",{className:"remote-footer",children:[d.jsx("p",{className:"remote-permission",children:a||c?`Keep ${Pn} running on this Mac.`:"Anthropic syncs this conversation. Remote messages use this task’s tools and permissions."}),d.jsxs("div",{className:"remote-actions",children:[a&&n.url?d.jsxs("a",{className:"remote-primary",href:n.url,target:"_blank",rel:"noreferrer",children:["Open in Claude ",d.jsx("span",{"aria-hidden":"true",children:"↗"})]}):!c&&!n.mayBeActive?d.jsxs("button",{className:"remote-primary",disabled:s,onClick:()=>void l("enable"),children:[n.state==="failed"?"Try again":"Enable Remote Control"," ",d.jsx("span",{"aria-hidden":"true",children:"→"})]}):null,d.jsx("button",{className:"remote-secondary",disabled:s||n.state==="connecting"||n.state==="disconnecting",onClick:()=>void l(n.mayBeActive||a||c?"disable":"dismiss"),children:n.mayBeActive||a||c?"Turn off":"Not now"})]})]})]})]})}function Fa(e){if(!e)return null;const t=String(e).split(/[?#]/)[0];return/\.html?$/i.test(t)?"html":/\.(md|markdown)$/i.test(t)?"markdown":/\.change$/i.test(t)?"code":/\.(png|jpe?g|gif|webp|svg)$/i.test(t)?"image":null}function H3(e){return Fa(e)!==null}function zR(e,t=[]){const n=String(e??"").replace(/^file:\/\//,"").replace(/\/+$/,"");if(!n)return[];let r="";for(const o of t){if(!o)continue;const i=o.replace(/\/+$/,"");(n===i||n.startsWith(`${i}/`))&&i.length>r.length&&(r=i)}if(r){const o=r.split("/").filter(Boolean).slice(-1),i=n.slice(r.length+1).split("/").filter(Boolean);return[...o,...i]}return n.split("/").filter(Boolean).slice(-3)}function W3(e){const t=zR(e);return t[t.length-1]??""}const U3=.25,V3=.75,_R=.5,Jf=.72;function V0(e){return Number.isFinite(e)?Math.min(V3,Math.max(U3,e)):_R}function TC(e,t){return t?V0((t-e)/t):_R}const FR="zero.docPane.split.v1";function K3(e){try{const t=e==null?void 0:e.getItem(FR);if(!t)return Jf;const n=Number.parseFloat(t);return Number.isFinite(n)?V0(n):Jf}catch{return Jf}}function q3(e,t){try{e==null||e.setItem(FR,String(V0(t)))}catch{}}function Y3(e){return!!e&&!e.auto}function G3(e){return!!e}const J3="doc-view";function Q3(e){var t;return!e||String(e.tagName??"").toUpperCase()!=="IFRAME"?!1:!!((t=e.classList)!=null&&t.contains(J3))}function Wo({ready:e=!1,delayed:t=!1}){const[n,r]=w.useState(!t);return w.useEffect(()=>{if(r(!t),!t||e)return;const s=setTimeout(()=>r(!0),500);return()=>clearTimeout(s)},[t,e]),d.jsx("div",{className:"preview-loading",role:"status","aria-label":"Loading preview","aria-hidden":e||!n,"data-ready":e,"data-delayed":t&&!n,children:d.jsxs("div",{className:"preview-skeleton","aria-hidden":"true",children:[d.jsx("div",{className:"preview-skeleton-title"}),d.jsx("div",{className:"preview-skeleton-line"}),d.jsx("div",{className:"preview-skeleton-line preview-skeleton-short"}),d.jsx("div",{className:"preview-skeleton-block"}),d.jsx("div",{className:"preview-skeleton-line"}),d.jsx("div",{className:"preview-skeleton-line preview-skeleton-short"})]})})}function X3(e){let t=!1,n=requestAnimationFrame(()=>{t||(n=requestAnimationFrame(()=>{t||e()}))});return()=>{t=!0,cancelAnimationFrame(n)}}function BR(e){const[t,n]=w.useState(null),r=w.useRef(null);w.useEffect(()=>(n(null),()=>{var o;(o=r.current)==null||o.call(r)}),[e]);const s=w.useCallback(()=>{var o;(o=r.current)==null||o.call(r),r.current=X3(()=>n(e))},[e]);return[e!==null&&t===e,s]}class Z3{constructor(t=12){O1(this,"entries",new Map);this.limit=t}acquire(t,n){let r=this.entries.get(t);return r||(r={value:n(),users:0}),r.users++,this.entries.delete(t),this.entries.set(t,r),this.trim(),r.value}release(t){const n=this.entries.get(t);n&&(n.users=Math.max(0,n.users-1)),this.trim()}trim(){for(const[t,n]of this.entries){if(this.entries.size<=this.limit)break;n.users||(this.entries.delete(t),n.value.dispose())}}}function AC({product:e,path:t}){const n=Fa(t)??"html",[r,s]=w.useState(null),o=w.useRef(null),[i,l]=w.useState(0),[a,c]=w.useState(null),[u,f]=BR(a),[h,p]=w.useState(!1);return w.useEffect(()=>{let m=!0;return c(null),p(!1),s(null),n==="code"||n==="markdown"?((n==="code"?q.codeChange({product:e,src:t}).then(x=>{if(!x.ok||!x.change)throw new Error("Unavailable");return x.change.files.flatMap(v=>[v.path,...v.hunks.flatMap(b=>b.rows.map(([E,N])=>`${E==="="?" ":E} ${N}`))]).slice(0,5).join(`
124
+ `)}):q.readDoc({product:e,src:t}).then(x=>{if(!x.ok)throw new Error("Unavailable");return(x.text??"").split(`
125
+ `).filter(k=>k.trim()).slice(0,5).join(`
126
+ `)})).then(x=>{m&&s(x||"Empty document")}).catch(()=>{m&&p(!0)}),()=>{m=!1}):(q.resolveDoc({product:e,src:t}).then(y=>{m&&(y.ok&&y.url?c(y.url):p(!0))}).catch(()=>{m&&p(!0)}),()=>{m=!1})},[e,t,n]),w.useEffect(()=>{if(!o.current)return;const m=new ResizeObserver(([y])=>{y.contentRect.width>0&&l(y.contentRect.width)});return m.observe(o.current),()=>m.disconnect()},[]),d.jsxs("div",{ref:o,className:"artifact-thumbnail","data-kind":n,"aria-label":"Artifact preview",children:[r!==null?d.jsx("pre",{children:r}):a&&!h?d.jsx("iframe",{src:a,title:`Preview of ${t.split("/").pop()}`,sandbox:"allow-same-origin",tabIndex:-1,loading:"lazy",onError:()=>p(!0),onLoad:f,style:{opacity:u?.55:0,transform:`scale(${i/1200})`}}):h?d.jsx("span",{children:"Preview unavailable"}):d.jsx(Wo,{delayed:!0}),a&&!h&&d.jsx(Wo,{ready:u,delayed:!0})]})}const jC=new Z3(12);let Yl=null;function MC(){return Yl||(Yl=document.createElement("div"),Yl.hidden=!0,Yl.inert=!0,document.body.appendChild(Yl)),Yl}function RC(e,t){e.moveBefore(t,null)}function eB({product:e,path:t,revision:n=0}){const r=w.useRef(null),s=typeof Element<"u"&&"moveBefore"in Element.prototype;return w.useLayoutEffect(()=>{if(!s||!r.current)return;const o=JSON.stringify([e,t,n]),i=jC.acquire(o,()=>{const l=document.createElement("div");l.style.display="contents",MC().appendChild(l);const a=oR(l);return a.render(d.jsx(AC,{product:e,path:t})),{host:l,dispose:()=>{queueMicrotask(()=>{a.unmount(),l.remove()})}}});return RC(r.current,i.host),()=>{RC(MC(),i.host),jC.release(o)}},[e,t,n,s]),s?d.jsx("div",{ref:r,className:"retained-preview"}):d.jsx(AC,{product:e,path:t})}function tB({product:e,path:t,revision:n,open:r=!1,onOpen:s,onAddContext:o}){var m;const[i,l]=w.useState(null),[a,c]=w.useState(!1),u=Fa(t)==="code";w.useEffect(()=>{let y=!0;return l(null),c(!1),u&&q.codeChange({product:e,src:t}).then(x=>{y&&(x.ok&&x.change?l(x.change):c(!0))}).catch(()=>{y&&c(!0)}),()=>{y=!1}},[e,t,n,u]);const f=u?"Code changes":Fa(t)==="markdown"?"Document":"Design",h=E_((i==null?void 0:i.files)??[]),p=T_(i?h.total:0);return d.jsxs("section",{className:"direct-review","aria-label":`${f} review`,children:[d.jsx("button",{type:"button",className:"review-card-hit","aria-expanded":r,"aria-label":i?`Open all ${h.total} changed files`:`Open ${f.toLowerCase()} preview`,onClick:s}),d.jsxs("header",{children:[d.jsx("span",{className:"review-title",children:A_(t,i?h.total:void 0)}),d.jsxs("span",{className:"review-status",children:[d.jsx("i",{}),"Ready for review"]})]}),d.jsx("div",{className:"review-inset",children:i?d.jsxs("div",{className:"review-bundle",children:[d.jsxs("div",{className:"review-files",children:[h.visible.map(y=>d.jsxs("div",{children:[d.jsx("span",{children:y.path.split("/").pop()}),d.jsxs("small",{children:["+",y.plus," −",y.minus]})]},y.path)),h.remaining>0&&d.jsxs("p",{children:["+",h.remaining," more file",h.remaining===1?"":"s"]})]}),d.jsx("div",{className:"review-code","aria-label":"Code excerpt",children:C_(((m=i.files[0])==null?void 0:m.hunks.flatMap(y=>y.rows))??[]).map(y=>d.jsxs("div",{className:"review-code-line","data-mark":y.mark,children:[d.jsx("span",{className:"review-line-number","aria-hidden":"true",children:y.line}),d.jsxs("code",{children:[d.jsx("span",{className:"review-mark",children:y.mark==="="?" ":y.mark}),N_(y.text).map((x,k)=>d.jsx("span",{className:x.c?`t-${x.c}`:void 0,children:x.s},k))]})]},y.line))})]}):u?d.jsx("div",{className:"review-code-placeholder",children:a?d.jsx("span",{children:"Preview unavailable"}):d.jsx(Wo,{delayed:!0})}):d.jsx(eB,{product:e,path:t,revision:n})}),d.jsxs("footer",{className:"review-controls",children:[d.jsxs("button",{type:"button",className:"review-open","aria-expanded":r,"aria-label":p,title:`${p} beside the conversation`,onClick:s,children:[d.jsx(ey,{kind:"expand"}),d.jsx("span",{children:p})]}),o&&d.jsxs("div",{className:"review-responses",children:[d.jsxs("button",{type:"button",className:"review-feedback","aria-label":"Feedback / changes",title:"Add feedback context to your reply draft",onClick:()=>o("feedback"),children:[d.jsx(ey,{kind:"feedback"}),d.jsx("span",{children:"Feedback"})]}),d.jsxs("button",{type:"button",className:"review-accept",title:"Add Looks good to your reply draft","aria-label":"Looks good",onClick:()=>o("approve"),children:[d.jsx(ey,{kind:"approve"}),d.jsx("span",{children:"Looks good"})]})]})]})]})}function ey({kind:e}){return d.jsx("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e==="expand"?d.jsx("path",{d:"M12 3.5h4.5V8M16.5 3.5l-5 5M8 16.5H3.5V12M3.5 16.5l5-5"}):e==="approve"?d.jsx("path",{d:"m4.5 10 3.5 3.5 7.5-7.5"}):d.jsx("path",{d:"M5 4h10a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H9l-4.5 3v-3H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2Z"})})}function bk(e){if(typeof e!="string"||/[\r\n]/.test(e))return null;const t=e.trim().match(/^((?:\/|\.\/)?[\w@.-]+(?:\/[\w@.-]+)*\.(?:[cm]?jsx?|tsx?|py|go|rs|rb|java|kt|swift|[ch](?:pp)?|cs|css|scss|vue|svelte|sql|sh|json|ya?ml|toml))(?::[1-9]\d*(?:-[1-9]\d*)?|#L[1-9]\d*)?$/i);return!t||t[1].split("/").includes("..")?null:t[1]}const nB="modulepreload",rB=function(e,t){return new URL(e,t).href},OC={},qi=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){const i=document.getElementsByTagName("link"),l=document.querySelector("meta[property=csp-nonce]"),a=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));s=Promise.allSettled(n.map(c=>{if(c=rB(c,r),c in OC)return;OC[c]=!0;const u=c.endsWith(".css"),f=u?'[rel="stylesheet"]':"";if(!!r)for(let m=i.length-1;m>=0;m--){const y=i[m];if(y.href===c&&(!u||y.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${c}"]${f}`))return;const p=document.createElement("link");if(p.rel=u?"stylesheet":nB,u||(p.as="script"),p.crossOrigin="",p.href=c,a&&p.setAttribute("nonce",a),document.head.appendChild(p),u)return new Promise((m,y)=>{p.addEventListener("load",m),p.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${c}`)))})}))}function o(i){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=i,window.dispatchEvent(l),!l.defaultPrevented)throw i}return s.then(i=>{for(const l of i||[])l.status==="rejected"&&o(l.reason);return t().catch(o)})},sB=/^(zsh|bash|sh|fish|ksh|dash|tcsh|csh|Shell)$/i;function oB(e){const t=String(e).replace(/^-+/,"");return(t.split("/").pop()||t).replace(/^-+/,"")}function iB(e,t){if(t)return!1;const n=String(e||"").trim();return n?!sB.test(oB(n)):!1}function K0(){return d.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinecap:"round","aria-hidden":"true",children:d.jsx("path",{d:"M6.6 6.6 17.4 17.4M17.4 6.6 6.6 17.4"})})}const IC=new Map,ty=new Map;function HR({product:e,id:t,headerTarget:n,startOpen:r=!1}){const s=JSON.stringify({product:e,id:t}),o=ty.get(s),[i,l]=w.useState((o==null?void 0:o.open)??r),[a,c]=w.useState((o==null?void 0:o.placement)??"bottom"),[u,f]=w.useState(""),[h,p]=w.useState(""),[m,y]=w.useState(!1),[x,k]=w.useState("Shell"),[v,b]=w.useState(0),E=w.useRef(null);w.useEffect(()=>{ty.set(s,{open:i,placement:a})},[s,i,a]),w.useEffect(()=>{const R=()=>l(!0),$=()=>l(L=>!L);return window.addEventListener("task-terminal-open",R),window.addEventListener("task-terminal-toggle",$),()=>{window.removeEventListener("task-terminal-open",R),window.removeEventListener("task-terminal-toggle",$)}},[]),w.useEffect(()=>{if(!i||!E.current)return;let R=!1,$,L=()=>{};return f(""),y(!1),(async()=>{try{const[{Terminal:_},{FitAddon:j},{SerializeAddon:F}]=await Promise.all([qi(()=>import("./xterm-BT7tBf8A.js"),[],import.meta.url),qi(()=>import("./addon-fit-YJmn1quW.js"),[],import.meta.url),qi(()=>import("./addon-serialize-CsFQTvP_.js"),[],import.meta.url)]);if(R||!E.current)return;const ae=getComputedStyle(E.current),G=new _({cursorBlink:!0,screenReaderMode:!0,allowTransparency:!0,fontFamily:"Menlo, Monaco, monospace",fontSize:12,scrollback:5e3,allowProposedApi:!1,theme:{background:"#00000000",foreground:ae.color},convertEol:!1}),I=new j,ne=new F;G.loadAddon(ne),G.loadAddon(I),G.open(E.current);let B=0,J=!1,M="",Q=Promise.resolve();const ce=Te=>{R||f(Te instanceof Error?Te.message:String(Te))},C=()=>{var Te,le;!J||R||!((Te=E.current)!=null&&Te.clientWidth)||!((le=E.current)!=null&&le.clientHeight)||(I.fit(),J&&q.terminal({product:e,id:t,action:"resize",cols:Math.max(2,Math.min(500,G.cols)),rows:Math.max(2,Math.min(300,G.rows))}).catch(ce))},re=new ResizeObserver(C);re.observe(E.current);const W=G.onData(Te=>{Q=Q.then(async()=>{for(let le=0;le<Te.length;le+=16384)await q.terminal({product:e,id:t,action:"write",data:Te.slice(le,le+16384)})}).catch(ce)});L=()=>{J&&IC.set(s,{token:M,screen:ne.serialize({scrollback:1e3}),offset:B,cols:G.cols,rows:G.rows}),re.disconnect(),W.dispose(),G.dispose()};const V=async Te=>{R||(p(Te.cwd),k(Te.process),y(Te.exited),Te.truncated&&(G.reset(),G.writeln("[Earlier terminal output omitted]")),await new Promise(le=>G.write(Te.data,le)),B=Te.offset)};let Se=await q.terminal({product:e,id:t,action:"open"});if(R)return;M=Se.token;const ye=IC.get(s);(ye==null?void 0:ye.token)===M&&(G.resize(ye.cols,ye.rows),await new Promise(Te=>G.write(ye.screen,Te)),Se=await q.terminal({product:e,id:t,action:"read",offset:ye.offset})),await V(Se),J=!0,C(),G.focus();const De=async()=>{try{const Te=await q.terminal({product:e,id:t,action:"read",offset:B});await V(Te),R||($=setTimeout(De,150))}catch(Te){ce(Te)}};$=setTimeout(De,150)}catch(_){R||f(_ instanceof Error?_.message:String(_))}})(),()=>{R=!0,$&&clearTimeout($),L()}},[i,e,t,v]);async function N(){try{await q.terminal({product:e,id:t,action:"close"}),ty.set(s,{open:!1,placement:a}),y(!0),k("Ended"),l(!1)}catch(R){f(String(R))}}async function T(){try{await q.terminal({product:e,id:t,action:"close"}),b(R=>R+1)}catch(R){f(String(R))}}const A=d.jsx("button",{className:`icon-btn terminal-header-control${i?" on":""}`,"data-hint":"terminal","data-hint-align":"right",title:i?"Hide terminal":"Open terminal","aria-label":i?"Hide terminal":"Open terminal","aria-expanded":i,onClick:()=>l(!i),children:d.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[d.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),d.jsx("path",{d:"m7 9 3 3-3 3m6 0h4"})]})});return d.jsxs(d.Fragment,{children:[n&&ki.createPortal(A,n),i&&d.jsxs("section",{className:`task-terminal task-terminal-${a}`,"aria-label":"Task terminal",children:[d.jsx(lB,{cwd:h,processName:x,exited:m,placement:a,onStop:()=>void q.terminal({product:e,id:t,action:"write",data:""}).catch(R=>f(String(R))),onEnd:()=>void N(),onPlacement:()=>c(a==="bottom"?"side":"bottom"),onHide:()=>l(!1)}),u&&d.jsxs("div",{className:"task-terminal-message",role:"alert",children:[u," ",d.jsx("button",{onClick:()=>b(R=>R+1),children:"Retry"})]}),d.jsx("div",{className:"task-terminal-screen",ref:E}),m&&d.jsxs("div",{className:"task-terminal-message",children:["Shell exited. ",d.jsx("button",{onClick:()=>void T(),children:"New session"})]})]})]})}function lB({cwd:e,processName:t,exited:n,placement:r,onStop:s,onEnd:o,onPlacement:i,onHide:l}){const a=iB(t,n);return d.jsxs("header",{className:"task-terminal-toolbar",children:[d.jsx("strong",{children:"Terminal"}),d.jsx("span",{className:"task-terminal-folder",title:e,children:e.split("/").filter(Boolean).pop()||"Opening…"}),d.jsxs("span",{className:"task-terminal-controls",children:[d.jsx("span",{className:"task-terminal-process",children:t}),a&&d.jsx("button",{className:"task-terminal-word",title:`Stop ${t} (Ctrl+C). The shell stays open.`,onClick:s,children:"Stop command"}),d.jsx("button",{className:"task-terminal-word",title:"End this shell and everything it started. The terminal closes.",onClick:o,children:"End shell"}),d.jsx("button",{className:"task-terminal-icon","aria-label":r==="bottom"?"Move terminal to side":"Move terminal to bottom",title:r==="bottom"?"Move to side":"Move to bottom",onClick:i,children:d.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.3","aria-hidden":"true",children:[d.jsx("rect",{x:"2",y:"3",width:"16",height:"14",rx:"2"}),r==="bottom"?d.jsx("path",{d:"M12 3v14"}):d.jsx("path",{d:"M2 12h16"})]})}),d.jsx("button",{className:"task-terminal-icon task-terminal-hide","aria-label":"Hide terminal panel",title:"Hide the terminal. The shell keeps running.",onClick:l,children:d.jsx(K0,{})})]})]})}function aB(e,t){let n=!1,r,s;const o=async()=>{try{const i=await e(),l=JSON.stringify(i);!n&&l!==s&&(s=l,t(i))}catch{}finally{n||(r=setTimeout(o,1e3))}};return o(),()=>{n=!0,clearTimeout(r)}}const Kn=(e,t,n=null,r=[])=>({name:e,description:t,menuDescription:null,whole:!0,argumentHint:n,aliases:r}),WR=[Kn("model","Show models or change this task’s model","[model]"),Kn("effort","Show or change reasoning effort","[level]"),Kn("compact","Free up context in this conversation"),Kn("review","Review uncommitted changes, a branch, or specific instructions","[--base branch | --commit sha | instructions]"),Kn("status","Show this task’s configuration and conversation status"),Kn("usage","Show the account’s last reported usage"),Kn("skills","List skills available in this project"),Kn("mcp","Show this conversation’s connected MCP servers"),Kn("goal","View, pause, or clear this conversation’s goal","[pause | clear]"),Kn("diff","Show staged and unstaged changes"),Kn("rename","Rename this task","<name>"),Kn("copy","Copy the last assistant response"),Kn("help","Show available commands and remaining compatibility gaps")],vk=WR.filter(e=>["model","effort","diff","rename","help"].includes(e.name)),cB=Kn("fork","Start a new task from this conversation","<what to try instead>");function Sk(e){return e==="codex"?WR:[Kn("remote-control","Continue this conversation in Claude on another device",null,["rc"]),cB,...pk.map(t=>vk.find(n=>n.name===t.name)??t),...vk.filter(t=>!pk.some(n=>n.name===t.name))]}function DC(e,t){if(typeof e!="string")return null;const n=e.trim().match(/^\/([a-z][a-z0-9:_-]*)(?:\s+([\s\S]*))?$/i);if(!n)return null;const r=n[1].toLowerCase(),s=(n[2]??"").trim(),o=Sk(t).find(i=>gR(i).includes(r));return o?o.name==="fork"?{name:"fork",args:s,route:"fork"}:{name:o.name,args:s,route:o.name==="remote-control"?"remote":t==="codex"?"codex":vk.some(i=>i.name===o.name)?"local":"claude"}:{name:r,args:s,route:"unavailable"}}function uB(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const dB=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,fB=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,hB={};function LC(e,t){return(hB.jsx?fB:dB).test(e)}const pB=/[ \t\n\f\r]/g;function mB(e){return typeof e=="object"?e.type==="text"?PC(e.value):!1:PC(e)}function PC(e){return e.replace(pB,"")===""}let ld=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};ld.prototype.normal={};ld.prototype.property={};ld.prototype.space=void 0;function UR(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new ld(n,r,t)}function Ck(e){return e.toLowerCase()}class dr{constructor(t,n){this.attribute=n,this.property=t}}dr.prototype.attribute="";dr.prototype.booleanish=!1;dr.prototype.boolean=!1;dr.prototype.commaOrSpaceSeparated=!1;dr.prototype.commaSeparated=!1;dr.prototype.defined=!1;dr.prototype.mustUseProperty=!1;dr.prototype.number=!1;dr.prototype.overloadedBoolean=!1;dr.prototype.property="";dr.prototype.spaceSeparated=!1;dr.prototype.space=void 0;let gB=0;const Ve=jl(),Vt=jl(),Ek=jl(),de=jl(),mt=jl(),sl=jl(),gr=jl();function jl(){return 2**++gB}const Nk=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ve,booleanish:Vt,commaOrSpaceSeparated:gr,commaSeparated:sl,number:de,overloadedBoolean:Ek,spaceSeparated:mt},Symbol.toStringTag,{value:"Module"})),ny=Object.keys(Nk);class q0 extends dr{constructor(t,n,r,s){let o=-1;if(super(t,n),$C(this,"space",s),typeof r=="number")for(;++o<ny.length;){const i=ny[o];$C(this,ny[o],(r&Nk[i])===Nk[i])}}}q0.prototype.defined=!0;function $C(e,t,n){n&&(e[t]=n)}function tc(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const o=new q0(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[Ck(r)]=r,n[Ck(o.attribute)]=r}return new ld(t,n,e.space)}const VR=tc({properties:{ariaActiveDescendant:null,ariaAtomic:Vt,ariaAutoComplete:null,ariaBusy:Vt,ariaChecked:Vt,ariaColCount:de,ariaColIndex:de,ariaColSpan:de,ariaControls:mt,ariaCurrent:null,ariaDescribedBy:mt,ariaDetails:null,ariaDisabled:Vt,ariaDropEffect:mt,ariaErrorMessage:null,ariaExpanded:Vt,ariaFlowTo:mt,ariaGrabbed:Vt,ariaHasPopup:null,ariaHidden:Vt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:mt,ariaLevel:de,ariaLive:null,ariaModal:Vt,ariaMultiLine:Vt,ariaMultiSelectable:Vt,ariaOrientation:null,ariaOwns:mt,ariaPlaceholder:null,ariaPosInSet:de,ariaPressed:Vt,ariaReadOnly:Vt,ariaRelevant:null,ariaRequired:Vt,ariaRoleDescription:mt,ariaRowCount:de,ariaRowIndex:de,ariaRowSpan:de,ariaSelected:Vt,ariaSetSize:de,ariaSort:null,ariaValueMax:de,ariaValueMin:de,ariaValueNow:de,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function KR(e,t){return t in e?e[t]:t}function qR(e,t){return KR(e,t.toLowerCase())}const yB=tc({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:sl,acceptCharset:mt,accessKey:mt,action:null,allow:null,allowFullScreen:Ve,allowPaymentRequest:Ve,allowUserMedia:Ve,alpha:Ve,alt:null,as:null,async:Ve,autoCapitalize:null,autoComplete:mt,autoFocus:Ve,autoPlay:Ve,blocking:mt,capture:null,charSet:null,checked:Ve,cite:null,className:mt,closedBy:null,colorSpace:null,cols:de,colSpan:de,command:null,commandFor:null,content:null,contentEditable:Vt,controls:Ve,controlsList:mt,coords:de|sl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ve,defer:Ve,dir:null,dirName:null,disabled:Ve,download:Ek,draggable:Vt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ve,formTarget:null,headers:mt,height:de,hidden:Ek,high:de,href:null,hrefLang:null,htmlFor:mt,httpEquiv:mt,id:null,imageSizes:null,imageSrcSet:null,inert:Ve,inputMode:null,integrity:null,is:null,isMap:Ve,itemId:null,itemProp:mt,itemRef:mt,itemScope:Ve,itemType:mt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ve,low:de,manifest:null,max:null,maxLength:de,media:null,method:null,min:null,minLength:de,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:de,pattern:null,ping:mt,placeholder:null,playsInline:Ve,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ve,referrerPolicy:null,rel:mt,required:Ve,reversed:Ve,rows:de,rowSpan:de,sandbox:mt,scope:null,scoped:Ve,seamless:Ve,selected:Ve,shadowRootClonable:Ve,shadowRootCustomElementRegistry:Ve,shadowRootDelegatesFocus:Ve,shadowRootMode:null,shadowRootSerializable:Ve,shape:null,size:de,sizes:null,slot:null,span:de,spellCheck:Vt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:de,step:null,style:null,tabIndex:de,target:null,title:null,translate:null,type:null,typeMustMatch:Ve,useMap:null,value:Vt,width:de,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:mt,axis:null,background:null,bgColor:null,border:de,borderColor:null,bottomMargin:de,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:de,leftMargin:de,link:null,longDesc:null,lowSrc:null,marginHeight:de,marginWidth:de,noResize:Ve,noHref:Ve,noShade:Ve,noWrap:Ve,object:null,profile:null,prompt:null,rev:null,rightMargin:de,rules:null,scheme:null,scrolling:Vt,standby:null,summary:null,text:null,topMargin:de,valueType:null,version:null,vAlign:null,vLink:null,vSpace:de,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Ve,disablePictureInPicture:Ve,disableRemotePlayback:Ve,exportParts:sl,part:mt,prefix:null,property:null,results:de,security:null,unselectable:null},space:"html",transform:qR}),wB=tc({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",maskType:"mask-type",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:gr,accentHeight:de,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:de,amplitude:de,arabicForm:null,ascent:de,attributeName:null,attributeType:null,azimuth:de,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:de,by:null,calcMode:null,capHeight:de,className:mt,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:de,diffuseConstant:de,direction:null,display:null,dur:null,divisor:de,dominantBaseline:null,download:Ve,dx:null,dy:null,edgeMode:null,editable:null,elevation:de,enableBackground:null,end:null,event:null,exponent:de,externalResourcesRequired:null,fill:null,fillOpacity:de,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:sl,g2:sl,glyphName:sl,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:de,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:de,horizOriginX:de,horizOriginY:de,id:null,ideographic:de,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:de,k:de,k1:de,k2:de,k3:de,k4:de,kernelMatrix:gr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:de,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:de,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:de,overlineThickness:de,paintOrder:null,panose1:null,path:null,pathLength:de,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:mt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:de,pointsAtY:de,pointsAtZ:de,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:gr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:gr,rev:gr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:gr,requiredFeatures:gr,requiredFonts:gr,requiredFormats:gr,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:de,specularExponent:de,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:de,strikethroughThickness:de,string:null,stroke:null,strokeDashArray:gr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:de,strokeOpacity:de,strokeWidth:null,style:null,surfaceScale:de,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:gr,tabIndex:de,tableValues:null,target:null,targetX:de,targetY:de,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:gr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:de,underlineThickness:de,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:de,values:null,vAlphabetic:de,vMathematical:de,vectorEffect:null,vHanging:de,vIdeographic:de,version:null,vertAdvY:de,vertOriginX:de,vertOriginY:de,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:de,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:KR}),YR=tc({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),GR=tc({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:qR}),JR=tc({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),kB={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"},xB=/[A-Z]/g,zC=/-[a-z]/g,bB=/^data[-\w.:]+$/i;function vB(e,t){const n=Ck(t);let r=t,s=dr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&bB.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(zC,CB);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!zC.test(o)){let i=o.replace(xB,SB);i.charAt(0)!=="-"&&(i="-"+i),t="data"+i}}s=q0}return new s(r,t)}function SB(e){return"-"+e.toLowerCase()}function CB(e){return e.charAt(1).toUpperCase()}const EB=UR([VR,yB,YR,GR,JR],"html"),Y0=UR([VR,wB,YR,GR,JR],"svg");function NB(e){return e.join(" ").trim()}var G0={},_C=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,TB=/\n/g,AB=/^\s*/,jB=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,MB=/^:\s*/,RB=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,OB=/^[;\s]*/,IB=/^\s+|\s+$/g,DB=`
127
+ `,FC="/",BC="*",Bi="",LB="comment",PB="declaration";function $B(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function s(m){var y=m.match(TB);y&&(n+=y.length);var x=m.lastIndexOf(DB);r=~x?m.length-x:r+m.length}function o(){var m={line:n,column:r};return function(y){return y.position=new i(m),c(),y}}function i(m){this.start=m,this.end={line:n,column:r},this.source=t.source}i.prototype.content=e;function l(m){var y=new Error(t.source+":"+n+":"+r+": "+m);if(y.reason=m,y.filename=t.source,y.line=n,y.column=r,y.source=e,!t.silent)throw y}function a(m){var y=m.exec(e);if(y){var x=y[0];return s(x),e=e.slice(x.length),y}}function c(){a(AB)}function u(m){var y;for(m=m||[];y=f();)y!==!1&&m.push(y);return m}function f(){var m=o();if(!(FC!=e.charAt(0)||BC!=e.charAt(1))){for(var y=2;Bi!=e.charAt(y)&&(BC!=e.charAt(y)||FC!=e.charAt(y+1));)++y;if(y+=2,Bi===e.charAt(y-1))return l("End of comment missing");var x=e.slice(2,y-2);return r+=2,s(x),e=e.slice(y),r+=2,m({type:LB,comment:x})}}function h(){var m=o(),y=a(jB);if(y){if(f(),!a(MB))return l("property missing ':'");var x=a(RB),k=m({type:PB,property:HC(y[0].replace(_C,Bi)),value:x?HC(x[0].replace(_C,Bi)):Bi});return a(OB),k}}function p(){var m=[];u(m);for(var y;y=h();)y!==!1&&(m.push(y),u(m));return m}return c(),p()}function HC(e){return e?e.replace(IB,Bi):Bi}var zB=$B,_B=fh&&fh.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(G0,"__esModule",{value:!0});G0.default=BB;const FB=_B(zB);function BB(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,FB.default)(e),s=typeof t=="function";return r.forEach(o=>{if(o.type!=="declaration")return;const{property:i,value:l}=o;s?t(i,l,o):l&&(n=n||{},n[i]=l)}),n}var mm={};Object.defineProperty(mm,"__esModule",{value:!0});mm.camelCase=void 0;var HB=/^--[a-zA-Z0-9_-]+$/,WB=/-([a-z])/g,UB=/^[^-]+$/,VB=/^-(webkit|moz|ms|o|khtml)-/,KB=/^-(ms)-/,qB=function(e){return!e||UB.test(e)||HB.test(e)},YB=function(e,t){return t.toUpperCase()},WC=function(e,t){return"".concat(t,"-")},GB=function(e,t){return t===void 0&&(t={}),qB(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(KB,WC):e=e.replace(VB,WC),e.replace(WB,YB))};mm.camelCase=GB;var JB=fh&&fh.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},QB=JB(G0),XB=mm;function Tk(e,t){var n={};return!e||typeof e!="string"||(0,QB.default)(e,function(r,s){r&&s&&(n[(0,XB.camelCase)(r,t)]=s)}),n}Tk.default=Tk;var ZB=Tk;const e5=Kp(ZB),QR=XR("end"),J0=XR("start");function XR(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};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 t5(e){const t=J0(e),n=QR(e);if(t&&n)return{start:t,end:n}}function eu(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?UC(e.position):"start"in e||"end"in e?UC(e):"line"in e||"column"in e?Ak(e):""}function Ak(e){return VC(e&&e.line)+":"+VC(e&&e.column)}function UC(e){return Ak(e&&e.start)+"-"+Ak(e&&e.end)}function VC(e){return e&&typeof e=="number"?e:1}class Hn extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",o={},i=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?s=t:!o.cause&&t&&(i=!0,s=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof r=="string"){const a=r.indexOf(":");a===-1?o.ruleId=r:(o.source=r.slice(0,a),o.ruleId=r.slice(a+1))}if(!o.place&&o.ancestors&&o.ancestors){const a=o.ancestors[o.ancestors.length-1];a&&(o.place=a.position)}const l=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=l?l.line:void 0,this.name=eu(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=i&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Hn.prototype.file="";Hn.prototype.name="";Hn.prototype.reason="";Hn.prototype.message="";Hn.prototype.stack="";Hn.prototype.column=void 0;Hn.prototype.line=void 0;Hn.prototype.ancestors=void 0;Hn.prototype.cause=void 0;Hn.prototype.fatal=void 0;Hn.prototype.place=void 0;Hn.prototype.ruleId=void 0;Hn.prototype.source=void 0;const Q0={}.hasOwnProperty,n5=new Map,r5=/[A-Z]/g,s5=new Set(["table","tbody","thead","tfoot","tr"]),o5=new Set(["td","th"]),ZR="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function i5(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=p5(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=h5(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Y0:EB,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=eO(s,e,void 0);return o&&typeof o!="string"?o:s.create(e,s.Fragment,{children:o||void 0},void 0)}function eO(e,t,n){if(t.type==="element")return l5(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return a5(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return u5(e,t,n);if(t.type==="mdxjsEsm")return c5(e,t);if(t.type==="root")return d5(e,t,n);if(t.type==="text")return f5(e,t)}function l5(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Y0,e.schema=s),e.ancestors.push(t);const o=nO(e,t.tagName,!1),i=m5(e,t);let l=Z0(e,t);return s5.has(t.tagName)&&(l=l.filter(function(a){return typeof a=="string"?!mB(a):!0})),tO(e,i,o,t),X0(i,l),e.ancestors.pop(),e.schema=r,e.create(t,o,i,n)}function a5(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}zu(e,t.position)}function c5(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);zu(e,t.position)}function u5(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=Y0,e.schema=s),e.ancestors.push(t);const o=t.name===null?e.Fragment:nO(e,t.name,!0),i=g5(e,t),l=Z0(e,t);return tO(e,i,o,t),X0(i,l),e.ancestors.pop(),e.schema=r,e.create(t,o,i,n)}function d5(e,t,n){const r={};return X0(r,Z0(e,t)),e.create(t,e.Fragment,r,n)}function f5(e,t){return t.value}function tO(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function X0(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function h5(e,t,n){return r;function r(s,o,i,l){const c=Array.isArray(i.children)?n:t;return l?c(o,i,l):c(o,i)}}function p5(e,t){return n;function n(r,s,o,i){const l=Array.isArray(o.children),a=J0(r);return t(s,o,i,l,{columnNumber:a?a.column-1:void 0,fileName:e,lineNumber:a?a.line:void 0},void 0)}}function m5(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&Q0.call(t.properties,s)){const o=y5(e,s,t.properties[s]);if(o){const[i,l]=o;e.tableCellAlignToStyle&&i==="align"&&typeof l=="string"&&o5.has(t.tagName)?r=l:n[i]=l}}if(r){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function g5(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const o=r.data.estree.body[0];o.type;const i=o.expression;i.type;const l=i.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else zu(e,t.position);else{const s=r.name;let o;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,o=e.evaluater.evaluateExpression(l.expression)}else zu(e,t.position);else o=r.value===null?!0:r.value;n[s]=o}return n}function Z0(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:n5;for(;++r<t.children.length;){const o=t.children[r];let i;if(e.passKeys){const a=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(a){const c=s.get(a)||0;i=a+"-"+c,s.set(a,c+1)}}const l=eO(e,o,i);l!==void 0&&n.push(l)}return n}function y5(e,t,n){const r=vB(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?uB(n):NB(n)),r.property==="style"){let s=typeof n=="object"?n:w5(e,String(n));return e.stylePropertyNameCase==="css"&&(s=k5(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?kB[r.property]||r.property:r.attribute,n]}}function w5(e,t){try{return e5(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new Hn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=ZR+"#cannot-parse-style-attribute",s}}function nO(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let o=-1,i;for(;++o<s.length;){const l=LC(s[o])?{type:"Identifier",name:s[o]}:{type:"Literal",value:s[o]};i=i?{type:"MemberExpression",object:i,property:l,computed:!!(o&&l.type==="Literal"),optional:!1}:l}r=i}else r=LC(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return Q0.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);zu(e)}function zu(e,t){const n=new Hn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=ZR+"#cannot-handle-mdx-estrees-without-createevaluater",n}function k5(e){const t={};let n;for(n in e)Q0.call(e,n)&&(t[x5(n)]=e[n]);return t}function x5(e){let t=e.replace(r5,b5);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function b5(e){return"-"+e.toLowerCase()}const ry={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"]},v5={};function eb(e,t){const n=v5,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return rO(e,r,s)}function rO(e,t,n){if(S5(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return KC(e.children,t,n)}return Array.isArray(e)?KC(e,t,n):""}function KC(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=rO(e[s],t,n);return r.join("")}function S5(e){return!!(e&&typeof e=="object")}const qC=document.createElement("i");function tb(e){const t="&"+e+";";qC.innerHTML=t;const n=qC.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Sr(e,t,n,r){const s=e.length;let o=0,i;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)i=Array.from(r),i.unshift(t,n),e.splice(...i);else for(n&&e.splice(t,n);o<r.length;)i=r.slice(o,o+1e4),i.unshift(t,0),e.splice(...i),o+=1e4,t+=1e4}function Lr(e,t){return e.length>0?(Sr(e,e.length,0,t),e):t}const YC={}.hasOwnProperty;function sO(e){const t={};let n=-1;for(;++n<e.length;)C5(t,e[n]);return t}function C5(e,t){let n;for(n in t){const s=(YC.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let i;if(o)for(i in o){YC.call(s,i)||(s[i]=[]);const l=o[i];E5(s[i],Array.isArray(l)?l:l?[l]:[])}}}function E5(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Sr(e,0,0,r)}function oO(e,t){const n=Number.parseInt(e,t);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 is(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Gn=bi(/[A-Za-z]/),$n=bi(/[\dA-Za-z]/),N5=bi(/[#-'*+\--9=?A-Z^-~]/);function Vh(e){return e!==null&&(e<32||e===127)}const jk=bi(/\d/),T5=bi(/[\dA-Fa-f]/),A5=bi(/[!-/:-@[-`{-~]/);function Be(e){return e!==null&&e<-2}function yt(e){return e!==null&&(e<0||e===32)}function Ze(e){return e===-2||e===-1||e===32}const gm=bi(new RegExp("\\p{P}|\\p{S}","u")),wl=bi(/\s/);function bi(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function nc(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const o=e.charCodeAt(n);let i="";if(o===37&&$n(e.charCodeAt(n+1))&&$n(e.charCodeAt(n+2)))s=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(i=String.fromCharCode(o));else if(o>55295&&o<57344){const l=e.charCodeAt(n+1);o<56320&&l>56319&&l<57344?(i=String.fromCharCode(o,l),s=1):i="�"}else i=String.fromCharCode(o);i&&(t.push(e.slice(r,n),encodeURIComponent(i)),r=n+s+1,i=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function st(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let o=0;return i;function i(a){return Ze(a)?(e.enter(n),l(a)):t(a)}function l(a){return Ze(a)&&o++<s?(e.consume(a),l):(e.exit(n),t(a))}}const j5={tokenize:M5};function M5(e){const t=e.attempt(this.parser.constructs.contentInitial,r,s);let n;return t;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),st(e,t,"linePrefix")}function s(l){return e.enter("paragraph"),o(l)}function o(l){const a=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=a),n=a,i(l)}function i(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return Be(l)?(e.consume(l),e.exit("chunkText"),o):(e.consume(l),i)}}const R5={tokenize:O5},GC={tokenize:I5};function O5(e){const t=this,n=[];let r=0,s,o,i;return l;function l(b){if(r<n.length){const E=n[r];return t.containerState=E[1],e.attempt(E[0].continuation,a,c)(b)}return c(b)}function a(b){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&v();const E=t.events.length;let N=E,T;for(;N--;)if(t.events[N][0]==="exit"&&t.events[N][1].type==="chunkFlow"){T=t.events[N][1].end;break}k(r);let A=E;for(;A<t.events.length;)t.events[A][1].end={...T},A++;return Sr(t.events,N+1,0,t.events.slice(E)),t.events.length=A,c(b)}return l(b)}function c(b){if(r===n.length){if(!s)return h(b);if(s.currentConstruct&&s.currentConstruct.concrete)return m(b);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(GC,u,f)(b)}function u(b){return s&&v(),k(r),h(b)}function f(b){return t.parser.lazy[t.now().line]=r!==n.length,i=t.now().offset,m(b)}function h(b){return t.containerState={},e.attempt(GC,p,m)(b)}function p(b){return r++,n.push([t.currentConstruct,t.containerState]),h(b)}function m(b){if(b===null){s&&v(),k(0),e.consume(b);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:o}),y(b)}function y(b){if(b===null){x(e.exit("chunkFlow"),!0),k(0),e.consume(b);return}return Be(b)?(e.consume(b),x(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(b),y)}function x(b,E){const N=t.sliceStream(b);if(E&&N.push(null),b.previous=o,o&&(o.next=b),o=b,s.defineSkip(b.start),s.write(N),t.parser.lazy[b.start.line]){let T=s.events.length;for(;T--;)if(s.events[T][1].start.offset<i&&(!s.events[T][1].end||s.events[T][1].end.offset>i))return;const A=t.events.length;let R=A,$,L;for(;R--;)if(t.events[R][0]==="exit"&&t.events[R][1].type==="chunkFlow"){if($){L=t.events[R][1].end;break}$=!0}for(k(r),T=A;T<t.events.length;)t.events[T][1].end={...L},T++;Sr(t.events,R+1,0,t.events.slice(A)),t.events.length=T}}function k(b){let E=n.length;for(;E-- >b;){const N=n[E];t.containerState=N[1],N[0].exit.call(t,e)}n.length=b}function v(){s.write([null]),o=void 0,s=void 0,t.containerState._closeFlow=void 0}}function I5(e,t,n){return st(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ba(e){if(e===null||yt(e)||wl(e))return 1;if(gm(e))return 2}function ym(e,t,n){const r=[];let s=-1;for(;++s<e.length;){const o=e[s].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const Mk={name:"attention",resolveAll:D5,tokenize:L5};function D5(e,t){let n=-1,r,s,o,i,l,a,c,u;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;a=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f={...e[r][1].end},h={...e[n][1].start};JC(f,-a),JC(h,a),i={type:a>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},l={type:a>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},o={type:a>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:a>1?"strong":"emphasis",start:{...i.start},end:{...l.end}},e[r][1].end={...i.start},e[n][1].start={...l.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=Lr(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=Lr(c,[["enter",s,t],["enter",i,t],["exit",i,t],["enter",o,t]]),c=Lr(c,ym(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=Lr(c,[["exit",o,t],["enter",l,t],["exit",l,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,c=Lr(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):u=0,Sr(e,r-1,n-r+3,c),n=r+c.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function L5(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=Ba(r);let o;return i;function i(a){return o=a,e.enter("attentionSequence"),l(a)}function l(a){if(a===o)return e.consume(a),l;const c=e.exit("attentionSequence"),u=Ba(a),f=!u||u===2&&s||n.includes(a),h=!s||s===2&&u||n.includes(r);return c._open=!!(o===42?f:f&&(s||!h)),c._close=!!(o===42?h:h&&(u||!f)),t(a)}}function JC(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const P5={name:"autolink",tokenize:$5};function $5(e,t,n){let r=0;return s;function s(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(p){return Gn(p)?(e.consume(p),i):p===64?n(p):c(p)}function i(p){return p===43||p===45||p===46||$n(p)?(r=1,l(p)):c(p)}function l(p){return p===58?(e.consume(p),r=0,a):(p===43||p===45||p===46||$n(p))&&r++<32?(e.consume(p),l):(r=0,c(p))}function a(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||Vh(p)?n(p):(e.consume(p),a)}function c(p){return p===64?(e.consume(p),u):N5(p)?(e.consume(p),c):n(p)}function u(p){return $n(p)?f(p):n(p)}function f(p){return p===46?(e.consume(p),r=0,u):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):h(p)}function h(p){if((p===45||$n(p))&&r++<63){const m=p===45?h:f;return e.consume(p),m}return n(p)}}const ad={partial:!0,tokenize:z5};function z5(e,t,n){return r;function r(o){return Ze(o)?st(e,s,"linePrefix")(o):s(o)}function s(o){return o===null||Be(o)?t(o):n(o)}}const iO={continuation:{tokenize:F5},exit:B5,name:"blockQuote",tokenize:_5};function _5(e,t,n){const r=this;return s;function s(i){if(i===62){const l=r.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(i),e.exit("blockQuoteMarker"),o}return n(i)}function o(i){return Ze(i)?(e.enter("blockQuotePrefixWhitespace"),e.consume(i),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(i))}}function F5(e,t,n){const r=this;return s;function s(i){return Ze(i)?st(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i):o(i)}function o(i){return e.attempt(iO,t,n)(i)}}function B5(e){e.exit("blockQuote")}const lO={name:"characterEscape",tokenize:H5};function H5(e,t,n){return r;function r(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),s}function s(o){return A5(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const aO={name:"characterReference",tokenize:W5};function W5(e,t,n){const r=this;let s=0,o,i;return l;function l(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),a}function a(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),o=31,i=$n,u(f))}function c(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,i=T5,u):(e.enter("characterReferenceValue"),o=7,i=jk,u(f))}function u(f){if(f===59&&s){const h=e.exit("characterReferenceValue");return i===$n&&!tb(r.sliceSerialize(h))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return i(f)&&s++<o?(e.consume(f),u):n(f)}}const QC={partial:!0,tokenize:V5},XC={concrete:!0,name:"codeFenced",tokenize:U5};function U5(e,t,n){const r=this,s={partial:!0,tokenize:N};let o=0,i=0,l;return a;function a(T){return c(T)}function c(T){const A=r.events[r.events.length-1];return o=A&&A[1].type==="linePrefix"?A[2].sliceSerialize(A[1],!0).length:0,l=T,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(T)}function u(T){return T===l?(i++,e.consume(T),u):i<3?n(T):(e.exit("codeFencedFenceSequence"),Ze(T)?st(e,f,"whitespace")(T):f(T))}function f(T){return T===null||Be(T)?(e.exit("codeFencedFence"),r.interrupt?t(T):e.check(QC,y,E)(T)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(T))}function h(T){return T===null||Be(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(T)):Ze(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),st(e,p,"whitespace")(T)):T===96&&T===l?n(T):(e.consume(T),h)}function p(T){return T===null||Be(T)?f(T):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(T))}function m(T){return T===null||Be(T)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(T)):T===96&&T===l?n(T):(e.consume(T),m)}function y(T){return e.attempt(s,E,x)(T)}function x(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),k}function k(T){return o>0&&Ze(T)?st(e,v,"linePrefix",o+1)(T):v(T)}function v(T){return T===null||Be(T)?e.check(QC,y,E)(T):(e.enter("codeFlowValue"),b(T))}function b(T){return T===null||Be(T)?(e.exit("codeFlowValue"),v(T)):(e.consume(T),b)}function E(T){return e.exit("codeFenced"),t(T)}function N(T,A,R){let $=0;return L;function L(G){return T.enter("lineEnding"),T.consume(G),T.exit("lineEnding"),_}function _(G){return T.enter("codeFencedFence"),Ze(G)?st(T,j,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(G):j(G)}function j(G){return G===l?(T.enter("codeFencedFenceSequence"),F(G)):R(G)}function F(G){return G===l?($++,T.consume(G),F):$>=i?(T.exit("codeFencedFenceSequence"),Ze(G)?st(T,ae,"whitespace")(G):ae(G)):R(G)}function ae(G){return G===null||Be(G)?(T.exit("codeFencedFence"),A(G)):R(G)}}}function V5(e,t,n){const r=this;return s;function s(i){return i===null?n(i):(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),o)}function o(i){return r.parser.lazy[r.now().line]?n(i):t(i)}}const sy={name:"codeIndented",tokenize:q5},K5={partial:!0,tokenize:Y5};function q5(e,t,n){const r=this;return s;function s(c){return e.enter("codeIndented"),st(e,o,"linePrefix",5)(c)}function o(c){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?i(c):n(c)}function i(c){return c===null?a(c):Be(c)?e.attempt(K5,i,a)(c):(e.enter("codeFlowValue"),l(c))}function l(c){return c===null||Be(c)?(e.exit("codeFlowValue"),i(c)):(e.consume(c),l)}function a(c){return e.exit("codeIndented"),t(c)}}function Y5(e,t,n){const r=this;return s;function s(i){return r.parser.lazy[r.now().line]?n(i):Be(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),s):st(e,o,"linePrefix",5)(i)}function o(i){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(i):Be(i)?s(i):n(i)}}const G5={name:"codeText",previous:Q5,resolve:J5,tokenize:X5};function J5(e){let t=e.length-4,n=3,r,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)s===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(s=r):(r===t||e[r][1].type==="lineEnding")&&(e[s][1].type="codeTextData",r!==s+2&&(e[s][1].end=e[r-1][1].end,e.splice(s+2,r-s-2),t-=r-s-2,r=s+2),s=void 0);return e}function Q5(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function X5(e,t,n){let r=0,s,o;return i;function i(f){return e.enter("codeText"),e.enter("codeTextSequence"),l(f)}function l(f){return f===96?(e.consume(f),r++,l):(e.exit("codeTextSequence"),a(f))}function a(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),a):f===96?(o=e.enter("codeTextSequence"),s=0,u(f)):Be(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),a):(e.enter("codeTextData"),c(f))}function c(f){return f===null||f===32||f===96||Be(f)?(e.exit("codeTextData"),a(f)):(e.consume(f),c)}function u(f){return f===96?(e.consume(f),s++,u):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(o.type="codeTextData",c(f))}}class Z5{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const s=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&vc(this.left,r),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),vc(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),vc(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);vc(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);vc(this.left,n.reverse())}}}function vc(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function cO(e){const t={};let n=-1,r,s,o,i,l,a,c;const u=new Z5(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type==="chunkFlow"&&u.get(n-1)[1].type==="listItemPrefix"&&(a=r[1]._tokenizer.events,o=0,o<a.length&&a[o][1].type==="lineEndingBlank"&&(o+=2),o<a.length&&a[o][1].type==="content"))for(;++o<a.length&&a[o][1].type!=="content";)a[o][1].type==="chunkText"&&(a[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,eH(u,n)),n=t[n],c=!0);else if(r[1]._container){for(o=n,s=void 0;o--;)if(i=u.get(o),i[1].type==="lineEnding"||i[1].type==="lineEndingBlank")i[0]==="enter"&&(s&&(u.get(s)[1].type="lineEndingBlank"),i[1].type="lineEnding",s=o);else if(!(i[1].type==="linePrefix"||i[1].type==="listItemIndent"))break;s&&(r[1].end={...u.get(s)[1].start},l=u.slice(s,n),l.unshift(r),u.splice(s,n-s+1,l))}}return Sr(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function eH(e,t){const n=e.get(t)[1],r=e.get(t)[2];let s=t-1;const o=[];let i=n._tokenizer;i||(i=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(i._contentTypeTextTrailing=!0));const l=i.events,a=[],c={};let u,f,h=-1,p=n,m=0,y=0;const x=[y];for(;p;){for(;e.get(++s)[1]!==p;);o.push(s),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),f&&i.defineSkip(p.start),p._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=!0),i.write(u),p._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=void 0)),f=p,p=p.next}for(p=n;++h<l.length;)l[h][0]==="exit"&&l[h-1][0]==="enter"&&l[h][1].type===l[h-1][1].type&&l[h][1].start.line!==l[h][1].end.line&&(y=h+1,x.push(y),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(i.events=[],p?(p._tokenizer=void 0,p.previous=void 0):x.pop(),h=x.length;h--;){const k=l.slice(x[h],x[h+1]),v=o.pop();a.push([v,v+k.length-1]),e.splice(v,2,k)}for(a.reverse(),h=-1;++h<a.length;)c[m+a[h][0]]=m+a[h][1],m+=a[h][1]-a[h][0]-1;return c}const tH={resolve:rH,tokenize:sH},nH={partial:!0,tokenize:oH};function rH(e){return cO(e),e}function sH(e,t){let n;return r;function r(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(l)}function s(l){return l===null?o(l):Be(l)?e.check(nH,i,o)(l):(e.consume(l),s)}function o(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function i(l){return e.consume(l),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function oH(e,t,n){const r=this;return s;function s(i){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),st(e,o,"linePrefix")}function o(i){if(i===null||Be(i))return n(i);const l=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function uO(e,t,n,r,s,o,i,l,a){const c=a||Number.POSITIVE_INFINITY;let u=0;return f;function f(k){return k===60?(e.enter(r),e.enter(s),e.enter(o),e.consume(k),e.exit(o),h):k===null||k===32||k===41||Vh(k)?n(k):(e.enter(r),e.enter(i),e.enter(l),e.enter("chunkString",{contentType:"string"}),y(k))}function h(k){return k===62?(e.enter(o),e.consume(k),e.exit(o),e.exit(s),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),p(k))}function p(k){return k===62?(e.exit("chunkString"),e.exit(l),h(k)):k===null||k===60||Be(k)?n(k):(e.consume(k),k===92?m:p)}function m(k){return k===60||k===62||k===92?(e.consume(k),p):p(k)}function y(k){return!u&&(k===null||k===41||yt(k))?(e.exit("chunkString"),e.exit(l),e.exit(i),e.exit(r),t(k)):u<c&&k===40?(e.consume(k),u++,y):k===41?(e.consume(k),u--,y):k===null||k===32||k===40||Vh(k)?n(k):(e.consume(k),k===92?x:y)}function x(k){return k===40||k===41||k===92?(e.consume(k),y):y(k)}}function dO(e,t,n,r,s,o){const i=this;let l=0,a;return c;function c(p){return e.enter(r),e.enter(s),e.consume(p),e.exit(s),e.enter(o),u}function u(p){return l>999||p===null||p===91||p===93&&!a||p===94&&!l&&"_hiddenFootnoteSupport"in i.parser.constructs?n(p):p===93?(e.exit(o),e.enter(s),e.consume(p),e.exit(s),e.exit(r),t):Be(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||Be(p)||l++>999?(e.exit("chunkString"),u(p)):(e.consume(p),a||(a=!Ze(p)),p===92?h:f)}function h(p){return p===91||p===92||p===93?(e.consume(p),l++,f):f(p)}}function fO(e,t,n,r,s,o){let i;return l;function l(h){return h===34||h===39||h===40?(e.enter(r),e.enter(s),e.consume(h),e.exit(s),i=h===40?41:h,a):n(h)}function a(h){return h===i?(e.enter(s),e.consume(h),e.exit(s),e.exit(r),t):(e.enter(o),c(h))}function c(h){return h===i?(e.exit(o),a(i)):h===null?n(h):Be(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),st(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(h))}function u(h){return h===i||h===null||Be(h)?(e.exit("chunkString"),c(h)):(e.consume(h),h===92?f:u)}function f(h){return h===i||h===92?(e.consume(h),u):u(h)}}function tu(e,t){let n;return r;function r(s){return Be(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):Ze(s)?st(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const iH={name:"definition",tokenize:aH},lH={partial:!0,tokenize:cH};function aH(e,t,n){const r=this;let s;return o;function o(p){return e.enter("definition"),i(p)}function i(p){return dO.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return s=is(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),a):n(p)}function a(p){return yt(p)?tu(e,c)(p):c(p)}function c(p){return uO(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function u(p){return e.attempt(lH,f,f)(p)}function f(p){return Ze(p)?st(e,h,"whitespace")(p):h(p)}function h(p){return p===null||Be(p)?(e.exit("definition"),r.parser.defined.push(s),t(p)):n(p)}}function cH(e,t,n){return r;function r(l){return yt(l)?tu(e,s)(l):n(l)}function s(l){return fO(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function o(l){return Ze(l)?st(e,i,"whitespace")(l):i(l)}function i(l){return l===null||Be(l)?t(l):n(l)}}const uH={name:"hardBreakEscape",tokenize:dH};function dH(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),s}function s(o){return Be(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const fH={name:"headingAtx",resolve:hH,tokenize:pH};function hH(e,t){let n=e.length-2,r=3,s,o;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Sr(e,r,n-r+1,[["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t]])),e}function pH(e,t,n){let r=0;return s;function s(u){return e.enter("atxHeading"),o(u)}function o(u){return e.enter("atxHeadingSequence"),i(u)}function i(u){return u===35&&r++<6?(e.consume(u),i):u===null||yt(u)?(e.exit("atxHeadingSequence"),l(u)):n(u)}function l(u){return u===35?(e.enter("atxHeadingSequence"),a(u)):u===null||Be(u)?(e.exit("atxHeading"),t(u)):Ze(u)?st(e,l,"whitespace")(u):(e.enter("atxHeadingText"),c(u))}function a(u){return u===35?(e.consume(u),a):(e.exit("atxHeadingSequence"),l(u))}function c(u){return u===null||u===35||yt(u)?(e.exit("atxHeadingText"),l(u)):(e.consume(u),c)}}const mH=["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"],ZC=["pre","script","style","textarea"],gH={concrete:!0,name:"htmlFlow",resolveTo:kH,tokenize:xH},yH={partial:!0,tokenize:vH},wH={partial:!0,tokenize:bH};function kH(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function xH(e,t,n){const r=this;let s,o,i,l,a;return c;function c(C){return u(C)}function u(C){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(C),f}function f(C){return C===33?(e.consume(C),h):C===47?(e.consume(C),o=!0,y):C===63?(e.consume(C),s=3,r.interrupt?t:M):Gn(C)?(e.consume(C),i=String.fromCharCode(C),x):n(C)}function h(C){return C===45?(e.consume(C),s=2,p):C===91?(e.consume(C),s=5,l=0,m):Gn(C)?(e.consume(C),s=4,r.interrupt?t:M):n(C)}function p(C){return C===45?(e.consume(C),r.interrupt?t:M):n(C)}function m(C){const re="CDATA[";return C===re.charCodeAt(l++)?(e.consume(C),l===re.length?r.interrupt?t:j:m):n(C)}function y(C){return Gn(C)?(e.consume(C),i=String.fromCharCode(C),x):n(C)}function x(C){if(C===null||C===47||C===62||yt(C)){const re=C===47,W=i.toLowerCase();return!re&&!o&&ZC.includes(W)?(s=1,r.interrupt?t(C):j(C)):mH.includes(i.toLowerCase())?(s=6,re?(e.consume(C),k):r.interrupt?t(C):j(C)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(C):o?v(C):b(C))}return C===45||$n(C)?(e.consume(C),i+=String.fromCharCode(C),x):n(C)}function k(C){return C===62?(e.consume(C),r.interrupt?t:j):n(C)}function v(C){return Ze(C)?(e.consume(C),v):L(C)}function b(C){return C===47?(e.consume(C),L):C===58||C===95||Gn(C)?(e.consume(C),E):Ze(C)?(e.consume(C),b):L(C)}function E(C){return C===45||C===46||C===58||C===95||$n(C)?(e.consume(C),E):N(C)}function N(C){return C===61?(e.consume(C),T):Ze(C)?(e.consume(C),N):b(C)}function T(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(e.consume(C),a=C,A):Ze(C)?(e.consume(C),T):R(C)}function A(C){return C===a?(e.consume(C),a=null,$):C===null||Be(C)?n(C):(e.consume(C),A)}function R(C){return C===null||C===34||C===39||C===47||C===60||C===61||C===62||C===96||yt(C)?N(C):(e.consume(C),R)}function $(C){return C===47||C===62||Ze(C)?b(C):n(C)}function L(C){return C===62?(e.consume(C),_):n(C)}function _(C){return C===null||Be(C)?j(C):Ze(C)?(e.consume(C),_):n(C)}function j(C){return C===45&&s===2?(e.consume(C),I):C===60&&s===1?(e.consume(C),ne):C===62&&s===4?(e.consume(C),Q):C===63&&s===3?(e.consume(C),M):C===93&&s===5?(e.consume(C),J):Be(C)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(yH,ce,F)(C)):C===null||Be(C)?(e.exit("htmlFlowData"),F(C)):(e.consume(C),j)}function F(C){return e.check(wH,ae,ce)(C)}function ae(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),G}function G(C){return C===null||Be(C)?F(C):(e.enter("htmlFlowData"),j(C))}function I(C){return C===45?(e.consume(C),M):j(C)}function ne(C){return C===47?(e.consume(C),i="",B):j(C)}function B(C){if(C===62){const re=i.toLowerCase();return ZC.includes(re)?(e.consume(C),Q):j(C)}return Gn(C)&&i.length<8?(e.consume(C),i+=String.fromCharCode(C),B):j(C)}function J(C){return C===93?(e.consume(C),M):j(C)}function M(C){return C===62?(e.consume(C),Q):C===45&&s===2?(e.consume(C),M):j(C)}function Q(C){return C===null||Be(C)?(e.exit("htmlFlowData"),ce(C)):(e.consume(C),Q)}function ce(C){return e.exit("htmlFlow"),t(C)}}function bH(e,t,n){const r=this;return s;function s(i){return Be(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),o):n(i)}function o(i){return r.parser.lazy[r.now().line]?n(i):t(i)}}function vH(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(ad,t,n)}}const SH={name:"htmlText",tokenize:CH};function CH(e,t,n){const r=this;let s,o,i;return l;function l(M){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(M),a}function a(M){return M===33?(e.consume(M),c):M===47?(e.consume(M),N):M===63?(e.consume(M),b):Gn(M)?(e.consume(M),R):n(M)}function c(M){return M===45?(e.consume(M),u):M===91?(e.consume(M),o=0,m):Gn(M)?(e.consume(M),v):n(M)}function u(M){return M===45?(e.consume(M),p):n(M)}function f(M){return M===null?n(M):M===45?(e.consume(M),h):Be(M)?(i=f,ne(M)):(e.consume(M),f)}function h(M){return M===45?(e.consume(M),p):f(M)}function p(M){return M===62?I(M):M===45?h(M):f(M)}function m(M){const Q="CDATA[";return M===Q.charCodeAt(o++)?(e.consume(M),o===Q.length?y:m):n(M)}function y(M){return M===null?n(M):M===93?(e.consume(M),x):Be(M)?(i=y,ne(M)):(e.consume(M),y)}function x(M){return M===93?(e.consume(M),k):y(M)}function k(M){return M===62?I(M):M===93?(e.consume(M),k):y(M)}function v(M){return M===null||M===62?I(M):Be(M)?(i=v,ne(M)):(e.consume(M),v)}function b(M){return M===null?n(M):M===63?(e.consume(M),E):Be(M)?(i=b,ne(M)):(e.consume(M),b)}function E(M){return M===62?I(M):b(M)}function N(M){return Gn(M)?(e.consume(M),T):n(M)}function T(M){return M===45||$n(M)?(e.consume(M),T):A(M)}function A(M){return Be(M)?(i=A,ne(M)):Ze(M)?(e.consume(M),A):I(M)}function R(M){return M===45||$n(M)?(e.consume(M),R):M===47||M===62||yt(M)?$(M):n(M)}function $(M){return M===47?(e.consume(M),I):M===58||M===95||Gn(M)?(e.consume(M),L):Be(M)?(i=$,ne(M)):Ze(M)?(e.consume(M),$):I(M)}function L(M){return M===45||M===46||M===58||M===95||$n(M)?(e.consume(M),L):_(M)}function _(M){return M===61?(e.consume(M),j):Be(M)?(i=_,ne(M)):Ze(M)?(e.consume(M),_):$(M)}function j(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),s=M,F):Be(M)?(i=j,ne(M)):Ze(M)?(e.consume(M),j):(e.consume(M),ae)}function F(M){return M===s?(e.consume(M),s=void 0,G):M===null?n(M):Be(M)?(i=F,ne(M)):(e.consume(M),F)}function ae(M){return M===null||M===34||M===39||M===60||M===61||M===96?n(M):M===47||M===62||yt(M)?$(M):(e.consume(M),ae)}function G(M){return M===47||M===62||yt(M)?$(M):n(M)}function I(M){return M===62?(e.consume(M),e.exit("htmlTextData"),e.exit("htmlText"),t):n(M)}function ne(M){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),B}function B(M){return Ze(M)?st(e,J,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):J(M)}function J(M){return e.enter("htmlTextData"),i(M)}}const nb={name:"labelEnd",resolveAll:AH,resolveTo:jH,tokenize:MH},EH={tokenize:RH},NH={tokenize:OH},TH={tokenize:IH};function AH(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const s=r.type==="labelImage"?4:2;r.type="data",t+=s}}return e.length!==n.length&&Sr(e,0,e.length,n),e}function jH(e,t){let n=e.length,r=0,s,o,i,l;for(;n--;)if(s=e[n][1],o){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(i){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(o=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(i=n);const a={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[o][1].start},end:{...e[i][1].end}},u={type:"labelText",start:{...e[o+r+2][1].end},end:{...e[i-2][1].start}};return l=[["enter",a,t],["enter",c,t]],l=Lr(l,e.slice(o+1,o+r+3)),l=Lr(l,[["enter",u,t]]),l=Lr(l,ym(t.parser.constructs.insideSpan.null,e.slice(o+r+4,i-3),t)),l=Lr(l,[["exit",u,t],e[i-2],e[i-1],["exit",c,t]]),l=Lr(l,e.slice(i+1)),l=Lr(l,[["exit",a,t]]),Sr(e,o,e.length,l),e}function MH(e,t,n){const r=this;let s=r.events.length,o,i;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){o=r.events[s][1];break}return l;function l(h){return o?o._inactive?f(h):(i=r.parser.defined.includes(is(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),a):n(h)}function a(h){return h===40?e.attempt(EH,u,i?u:f)(h):h===91?e.attempt(NH,u,i?c:f)(h):i?u(h):f(h)}function c(h){return e.attempt(TH,u,f)(h)}function u(h){return t(h)}function f(h){return o._balanced=!0,n(h)}}function RH(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),s}function s(f){return yt(f)?tu(e,o)(f):o(f)}function o(f){return f===41?u(f):uO(e,i,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function i(f){return yt(f)?tu(e,a)(f):u(f)}function l(f){return n(f)}function a(f){return f===34||f===39||f===40?fO(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):u(f)}function c(f){return yt(f)?tu(e,u)(f):u(f)}function u(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function OH(e,t,n){const r=this;return s;function s(l){return dO.call(r,e,o,i,"reference","referenceMarker","referenceString")(l)}function o(l){return r.parser.defined.includes(is(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function i(l){return n(l)}}function IH(e,t,n){return r;function r(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),s}function s(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const DH={name:"labelStartImage",resolveAll:nb.resolveAll,tokenize:LH};function LH(e,t,n){const r=this;return s;function s(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),o}function o(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),i):n(l)}function i(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const PH={name:"labelStartLink",resolveAll:nb.resolveAll,tokenize:$H};function $H(e,t,n){const r=this;return s;function s(i){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(i),e.exit("labelMarker"),e.exit("labelLink"),o}function o(i){return i===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(i):t(i)}}const oy={name:"lineEnding",tokenize:zH};function zH(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),st(e,t,"linePrefix")}}const Qf={name:"thematicBreak",tokenize:_H};function _H(e,t,n){let r=0,s;return o;function o(c){return e.enter("thematicBreak"),i(c)}function i(c){return s=c,l(c)}function l(c){return c===s?(e.enter("thematicBreakSequence"),a(c)):r>=3&&(c===null||Be(c))?(e.exit("thematicBreak"),t(c)):n(c)}function a(c){return c===s?(e.consume(c),r++,a):(e.exit("thematicBreakSequence"),Ze(c)?st(e,l,"whitespace")(c):l(c))}}const rr={continuation:{tokenize:WH},exit:VH,name:"list",tokenize:HH},FH={partial:!0,tokenize:KH},BH={partial:!0,tokenize:UH};function HH(e,t,n){const r=this,s=r.events[r.events.length-1];let o=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,i=0;return l;function l(p){const m=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:jk(p)){if(r.containerState.type||(r.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(Qf,n,c)(p):c(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),a(p)}return n(p)}function a(p){return jk(p)&&++i<10?(e.consume(p),a):(!r.interrupt||i<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),c(p)):n(p)}function c(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(ad,r.interrupt?n:u,e.attempt(FH,h,f))}function u(p){return r.containerState.initialBlankLine=!0,o++,h(p)}function f(p){return Ze(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function WH(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(ad,s,o);function s(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,st(e,t,"listItemIndent",r.containerState.size+1)(l)}function o(l){return r.containerState.furtherBlankLines||!Ze(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,i(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(BH,t,i)(l))}function i(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,st(e,e.attempt(rr,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function UH(e,t,n){const r=this;return st(e,s,"listItemIndent",r.containerState.size+1);function s(o){const i=r.events[r.events.length-1];return i&&i[1].type==="listItemIndent"&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(o):n(o)}}function VH(e){e.exit(this.containerState.type)}function KH(e,t,n){const r=this;return st(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(o){const i=r.events[r.events.length-1];return!Ze(o)&&i&&i[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const eE={name:"setextUnderline",resolveTo:qH,tokenize:YH};function qH(e,t){let n=e.length,r,s,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const i={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",o?(e.splice(s,0,["enter",i,t]),e.splice(o+1,0,["exit",e[r][1],t]),e[r][1].end={...e[o][1].end}):e[r][1]=i,e.push(["exit",i,t]),e}function YH(e,t,n){const r=this;let s;return o;function o(c){let u=r.events.length,f;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){f=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),s=c,i(c)):n(c)}function i(c){return e.enter("setextHeadingLineSequence"),l(c)}function l(c){return c===s?(e.consume(c),l):(e.exit("setextHeadingLineSequence"),Ze(c)?st(e,a,"lineSuffix")(c):a(c))}function a(c){return c===null||Be(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const GH={tokenize:JH};function JH(e){const t=this,n=e.attempt(ad,r,e.attempt(this.parser.constructs.flowInitial,s,st(e,e.attempt(this.parser.constructs.flow,s,e.attempt(tH,s)),"linePrefix")));return n;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const QH={resolveAll:pO()},XH=hO("string"),ZH=hO("text");function hO(e){return{resolveAll:pO(e==="text"?e6:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],o=n.attempt(s,i,l);return i;function i(u){return c(u)?o(u):l(u)}function l(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),a}function a(u){return c(u)?(n.exit("data"),o(u)):(n.consume(u),a)}function c(u){if(u===null)return!0;const f=s[u];let h=-1;if(f)for(;++h<f.length;){const p=f[h];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function pO(e){return t;function t(n,r){let s=-1,o;for(;++s<=n.length;)o===void 0?n[s]&&n[s][1].type==="data"&&(o=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==o+2&&(n[o][1].end=n[s-1][1].end,n.splice(o+2,s-o-2),s=o+2),o=void 0);return e?e(n,r):n}}function e6(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],s=t.sliceStream(r);let o=s.length,i=-1,l=0,a;for(;o--;){const c=s[o];if(typeof c=="string"){for(i=c.length;c.charCodeAt(i-1)===32;)l++,i--;if(i)break;i=-1}else if(c===-2)a=!0,l++;else if(c!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const c={type:n===e.length||a||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?i:r.start._bufferIndex+i,_index:r.start._index+o,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}const t6={42:rr,43:rr,45:rr,48:rr,49:rr,50:rr,51:rr,52:rr,53:rr,54:rr,55:rr,56:rr,57:rr,62:iO},n6={91:iH},r6={[-2]:sy,[-1]:sy,32:sy},s6={35:fH,42:Qf,45:[eE,Qf],60:gH,61:eE,95:Qf,96:XC,126:XC},o6={38:aO,92:lO},i6={[-5]:oy,[-4]:oy,[-3]:oy,33:DH,38:aO,42:Mk,60:[P5,SH],91:PH,92:[uH,lO],93:nb,95:Mk,96:G5},l6={null:[Mk,QH]},a6={null:[42,95]},c6={null:[]},u6=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:a6,contentInitial:n6,disable:c6,document:t6,flow:s6,flowInitial:r6,insideSpan:l6,string:o6,text:i6},Symbol.toStringTag,{value:"Module"}));function d6(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},o=[];let i=[],l=[];const a={attempt:A(N),check:A(T),consume:v,enter:b,exit:E,interrupt:A(T,{interrupt:!0})},c={code:null,containerState:{},defineSkip:y,events:[],now:m,parser:e,previous:null,sliceSerialize:h,sliceStream:p,write:f};let u=t.tokenize.call(c,a);return t.resolveAll&&o.push(t),c;function f(_){return i=Lr(i,_),x(),i[i.length-1]!==null?[]:(R(t,0),c.events=ym(o,c.events,c),c.events)}function h(_,j){return h6(p(_),j)}function p(_){return f6(i,_)}function m(){const{_bufferIndex:_,_index:j,line:F,column:ae,offset:G}=r;return{_bufferIndex:_,_index:j,line:F,column:ae,offset:G}}function y(_){s[_.line]=_.column,L()}function x(){let _;for(;r._index<i.length;){const j=i[r._index];if(typeof j=="string")for(_=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===_&&r._bufferIndex<j.length;)k(j.charCodeAt(r._bufferIndex));else k(j)}}function k(_){u=u(_)}function v(_){Be(_)?(r.line++,r.column=1,r.offset+=_===-3?2:1,L()):_!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===i[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=_}function b(_,j){const F=j||{};return F.type=_,F.start=m(),c.events.push(["enter",F,c]),l.push(F),F}function E(_){const j=l.pop();return j.end=m(),c.events.push(["exit",j,c]),j}function N(_,j){R(_,j.from)}function T(_,j){j.restore()}function A(_,j){return F;function F(ae,G,I){let ne,B,J,M;return Array.isArray(ae)?ce(ae):"tokenize"in ae?ce([ae]):Q(ae);function Q(V){return Se;function Se(ye){const De=ye!==null&&V[ye],Te=ye!==null&&V.null,le=[...Array.isArray(De)?De:De?[De]:[],...Array.isArray(Te)?Te:Te?[Te]:[]];return ce(le)(ye)}}function ce(V){return ne=V,B=0,V.length===0?I:C(V[B])}function C(V){return Se;function Se(ye){return M=$(),J=V,V.partial||(c.currentConstruct=V),V.name&&c.parser.constructs.disable.null.includes(V.name)?W():V.tokenize.call(j?Object.assign(Object.create(c),j):c,a,re,W)(ye)}}function re(V){return _(J,M),G}function W(V){return M.restore(),++B<ne.length?C(ne[B]):I}}}function R(_,j){_.resolveAll&&!o.includes(_)&&o.push(_),_.resolve&&Sr(c.events,j,c.events.length-j,_.resolve(c.events.slice(j),c)),_.resolveTo&&(c.events=_.resolveTo(c.events,c))}function $(){const _=m(),j=c.previous,F=c.currentConstruct,ae=c.events.length,G=Array.from(l);return{from:ae,restore:I};function I(){r=_,c.previous=j,c.currentConstruct=F,c.events.length=ae,l=G,L()}}function L(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function f6(e,t){const n=t.start._index,r=t.start._bufferIndex,s=t.end._index,o=t.end._bufferIndex;let i;if(n===s)i=[e[n].slice(r,o)];else{if(i=e.slice(n,s),r>-1){const l=i[0];typeof l=="string"?i[0]=l.slice(r):i.shift()}o>0&&i.push(e[s].slice(0,o))}return i}function h6(e,t){let n=-1;const r=[];let s;for(;++n<e.length;){const o=e[n];let i;if(typeof o=="string")i=o;else switch(o){case-5:{i="\r";break}case-4:{i=`
128
+ `;break}case-3:{i=`\r
129
+ `;break}case-2:{i=t?" ":" ";break}case-1:{if(!t&&s)continue;i=" ";break}default:i=String.fromCharCode(o)}s=o===-2,r.push(i)}return r.join("")}function p6(e){const r={constructs:sO([u6,...(e||{}).extensions||[]]),content:s(j5),defined:[],document:s(R5),flow:s(GH),lazy:{},string:s(XH),text:s(ZH)};return r;function s(o){return i;function i(l){return d6(r,o,l)}}}function m6(e){for(;!cO(e););return e}const tE=/[\0\t\n\r]/g;function g6(){let e=1,t="",n=!0,r;return s;function s(o,i,l){const a=[];let c,u,f,h,p;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(i||void 0).decode(o)),f=0,t="",n&&(o.charCodeAt(0)===65279&&f++,n=void 0);f<o.length;){if(tE.lastIndex=f,c=tE.exec(o),h=c&&c.index!==void 0?c.index:o.length,p=o.charCodeAt(h),!c){t=o.slice(f);break}if(p===10&&f===h&&r)a.push(-3),r=void 0;else switch(r&&(a.push(-5),r=void 0),f<h&&(a.push(o.slice(f,h)),e+=h-f),p){case 0:{a.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,a.push(-2);e++<u;)a.push(-1);break}case 10:{a.push(-4),e=1;break}default:r=!0,e=1}f=h+1}return l&&(r&&a.push(-5),t&&a.push(t),a.push(null)),a}}const y6=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function w6(e){return e.replace(y6,k6)}function k6(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),o=s===120||s===88;return oO(n.slice(o?2:1),o?16:10)}return tb(n)||e}const mO={}.hasOwnProperty;function x6(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),b6(n)(m6(p6(n).document().write(g6()(e,t,!0))))}function b6(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(se),autolinkProtocol:$,autolinkEmail:$,atxHeading:o(we),blockQuote:o(Te),characterEscape:$,characterReference:$,codeFenced:o(le),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:o(le,i),codeText:o(K,i),codeTextData:$,data:$,codeFlowValue:$,definition:o(me),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:o(U),hardBreakEscape:o(Oe),hardBreakTrailing:o(Oe),htmlFlow:o(Ie,i),htmlFlowData:$,htmlText:o(Ie,i),htmlTextData:$,image:o(ct),label:i,link:o(se),listItem:o(ve),listItemValue:h,listOrdered:o(he,f),listUnordered:o(he),paragraph:o(He),reference:C,referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:o(we),strong:o(tt),thematicBreak:o(oe)},exit:{atxHeading:a(),atxHeadingSequence:N,autolink:a(),autolinkEmail:De,autolinkProtocol:ye,blockQuote:a(),characterEscapeValue:L,characterReferenceMarkerHexadecimal:W,characterReferenceMarkerNumeric:W,characterReferenceValue:V,characterReference:Se,codeFenced:a(x),codeFencedFence:y,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:L,codeIndented:a(k),codeText:a(G),codeTextData:L,data:L,definition:a(),definitionDestinationString:E,definitionLabelString:v,definitionTitleString:b,emphasis:a(),hardBreakEscape:a(j),hardBreakTrailing:a(j),htmlFlow:a(F),htmlFlowData:L,htmlText:a(ae),htmlTextData:L,image:a(ne),label:J,labelText:B,lineEnding:_,link:a(I),listItem:a(),listOrdered:a(),listUnordered:a(),paragraph:a(),referenceString:re,resourceDestinationString:M,resourceTitleString:Q,resource:ce,setextHeading:a(R),setextHeadingLineSequence:A,setextHeadingText:T,strong:a(),thematicBreak:a()}};gO(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(P){let ee={type:"root",children:[]};const Ae={stack:[ee],tokenStack:[],config:t,enter:l,exit:c,buffer:i,resume:u,data:n},We=[];let Je=-1;for(;++Je<P.length;)if(P[Je][1].type==="listOrdered"||P[Je][1].type==="listUnordered")if(P[Je][0]==="enter")We.push(Je);else{const wt=We.pop();Je=s(P,wt,Je)}for(Je=-1;++Je<P.length;){const wt=t[P[Je][0]];mO.call(wt,P[Je][1].type)&&wt[P[Je][1].type].call(Object.assign({sliceSerialize:P[Je][2].sliceSerialize},Ae),P[Je][1])}if(Ae.tokenStack.length>0){const wt=Ae.tokenStack[Ae.tokenStack.length-1];(wt[1]||nE).call(Ae,void 0,wt[0])}for(ee.position={start:Mo(P.length>0?P[0][1].start:{line:1,column:1,offset:0}),end:Mo(P.length>0?P[P.length-2][1].end:{line:1,column:1,offset:0})},Je=-1;++Je<t.transforms.length;)ee=t.transforms[Je](ee)||ee;return ee}function s(P,ee,Ae){let We=ee-1,Je=-1,wt=!1,un,dt,Cn,Ut;for(;++We<=Ae;){const be=P[We];switch(be[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{be[0]==="enter"?Je++:Je--,Ut=void 0;break}case"lineEndingBlank":{be[0]==="enter"&&(un&&!Ut&&!Je&&!Cn&&(Cn=We),Ut=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ut=void 0}if(!Je&&be[0]==="enter"&&be[1].type==="listItemPrefix"||Je===-1&&be[0]==="exit"&&(be[1].type==="listUnordered"||be[1].type==="listOrdered")){if(un){let Ye=We;for(dt=void 0;Ye--;){const rt=P[Ye];if(rt[1].type==="lineEnding"||rt[1].type==="lineEndingBlank"){if(rt[0]==="exit")continue;dt&&(P[dt][1].type="lineEndingBlank",wt=!0),rt[1].type="lineEnding",dt=Ye}else if(!(rt[1].type==="linePrefix"||rt[1].type==="blockQuotePrefix"||rt[1].type==="blockQuotePrefixWhitespace"||rt[1].type==="blockQuoteMarker"||rt[1].type==="listItemIndent"))break}Cn&&(!dt||Cn<dt)&&(un._spread=!0),un.end=Object.assign({},dt?P[dt][1].start:be[1].end),P.splice(dt||We,0,["exit",un,be[2]]),We++,Ae++}if(be[1].type==="listItemPrefix"){const Ye={type:"listItem",_spread:!1,start:Object.assign({},be[1].start),end:void 0};un=Ye,P.splice(We,0,["enter",Ye,be[2]]),We++,Ae++,Cn=void 0,Ut=!0}}}return P[ee][1]._spread=wt,Ae}function o(P,ee){return Ae;function Ae(We){l.call(this,P(We),We),ee&&ee.call(this,We)}}function i(){this.stack.push({type:"fragment",children:[]})}function l(P,ee,Ae){this.stack[this.stack.length-1].children.push(P),this.stack.push(P),this.tokenStack.push([ee,Ae||void 0]),P.position={start:Mo(ee.start),end:void 0}}function a(P){return ee;function ee(Ae){P&&P.call(this,Ae),c.call(this,Ae)}}function c(P,ee){const Ae=this.stack.pop(),We=this.tokenStack.pop();if(We)We[0].type!==P.type&&(ee?ee.call(this,P,We[0]):(We[1]||nE).call(this,P,We[0]));else throw new Error("Cannot close `"+P.type+"` ("+eu({start:P.start,end:P.end})+"): it’s not open");Ae.position.end=Mo(P.end)}function u(){return eb(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function h(P){if(this.data.expectingFirstListItemValue){const ee=this.stack[this.stack.length-2];ee.start=Number.parseInt(this.sliceSerialize(P),10),this.data.expectingFirstListItemValue=void 0}}function p(){const P=this.resume(),ee=this.stack[this.stack.length-1];ee.lang=P}function m(){const P=this.resume(),ee=this.stack[this.stack.length-1];ee.meta=P}function y(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function x(){const P=this.resume(),ee=this.stack[this.stack.length-1];ee.value=P.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const P=this.resume(),ee=this.stack[this.stack.length-1];ee.value=P.replace(/(\r?\n|\r)$/g,"")}function v(P){const ee=this.resume(),Ae=this.stack[this.stack.length-1];Ae.label=ee,Ae.identifier=is(this.sliceSerialize(P)).toLowerCase()}function b(){const P=this.resume(),ee=this.stack[this.stack.length-1];ee.title=P}function E(){const P=this.resume(),ee=this.stack[this.stack.length-1];ee.url=P}function N(P){const ee=this.stack[this.stack.length-1];if(!ee.depth){const Ae=this.sliceSerialize(P).length;ee.depth=Ae}}function T(){this.data.setextHeadingSlurpLineEnding=!0}function A(P){const ee=this.stack[this.stack.length-1];ee.depth=this.sliceSerialize(P).codePointAt(0)===61?1:2}function R(){this.data.setextHeadingSlurpLineEnding=void 0}function $(P){const Ae=this.stack[this.stack.length-1].children;let We=Ae[Ae.length-1];(!We||We.type!=="text")&&(We=Ct(),We.position={start:Mo(P.start),end:void 0},Ae.push(We)),this.stack.push(We)}function L(P){const ee=this.stack.pop();ee.value+=this.sliceSerialize(P),ee.position.end=Mo(P.end)}function _(P){const ee=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ae=ee.children[ee.children.length-1];Ae.position.end=Mo(P.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ee.type)&&($.call(this,P),L.call(this,P))}function j(){this.data.atHardBreak=!0}function F(){const P=this.resume(),ee=this.stack[this.stack.length-1];ee.value=P}function ae(){const P=this.resume(),ee=this.stack[this.stack.length-1];ee.value=P}function G(){const P=this.resume(),ee=this.stack[this.stack.length-1];ee.value=P}function I(){const P=this.stack[this.stack.length-1];if(this.data.inReference){const ee=this.data.referenceType||"shortcut";P.type+="Reference",P.referenceType=ee,delete P.url,delete P.title}else delete P.identifier,delete P.label;this.data.referenceType=void 0}function ne(){const P=this.stack[this.stack.length-1];if(this.data.inReference){const ee=this.data.referenceType||"shortcut";P.type+="Reference",P.referenceType=ee,delete P.url,delete P.title}else delete P.identifier,delete P.label;this.data.referenceType=void 0}function B(P){const ee=this.sliceSerialize(P),Ae=this.stack[this.stack.length-2];Ae.label=w6(ee),Ae.identifier=is(ee).toLowerCase()}function J(){const P=this.stack[this.stack.length-1],ee=this.resume(),Ae=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ae.type==="link"){const We=P.children;Ae.children=We}else Ae.alt=ee}function M(){const P=this.resume(),ee=this.stack[this.stack.length-1];ee.url=P}function Q(){const P=this.resume(),ee=this.stack[this.stack.length-1];ee.title=P}function ce(){this.data.inReference=void 0}function C(){this.data.referenceType="collapsed"}function re(P){const ee=this.resume(),Ae=this.stack[this.stack.length-1];Ae.label=ee,Ae.identifier=is(this.sliceSerialize(P)).toLowerCase(),this.data.referenceType="full"}function W(P){this.data.characterReferenceType=P.type}function V(P){const ee=this.sliceSerialize(P),Ae=this.data.characterReferenceType;let We;Ae?(We=oO(ee,Ae==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):We=tb(ee);const Je=this.stack[this.stack.length-1];Je.value+=We}function Se(P){const ee=this.stack.pop();ee.position.end=Mo(P.end)}function ye(P){L.call(this,P);const ee=this.stack[this.stack.length-1];ee.url=this.sliceSerialize(P)}function De(P){L.call(this,P);const ee=this.stack[this.stack.length-1];ee.url="mailto:"+this.sliceSerialize(P)}function Te(){return{type:"blockquote",children:[]}}function le(){return{type:"code",lang:null,meta:null,value:""}}function K(){return{type:"inlineCode",value:""}}function me(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function U(){return{type:"emphasis",children:[]}}function we(){return{type:"heading",depth:0,children:[]}}function Oe(){return{type:"break"}}function Ie(){return{type:"html",value:""}}function ct(){return{type:"image",title:null,url:"",alt:null}}function se(){return{type:"link",title:null,url:"",children:[]}}function he(P){return{type:"list",ordered:P.type==="listOrdered",start:null,spread:P._spread,children:[]}}function ve(P){return{type:"listItem",spread:P._spread,checked:null,children:[]}}function He(){return{type:"paragraph",children:[]}}function tt(){return{type:"strong",children:[]}}function Ct(){return{type:"text",value:""}}function oe(){return{type:"thematicBreak"}}}function Mo(e){return{line:e.line,column:e.column,offset:e.offset}}function gO(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?gO(e,r):v6(e,r)}}function v6(e,t){let n;for(n in t)if(mO.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function nE(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+eu({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+eu({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+eu({start:t.start,end:t.end})+") is still open")}function S6(e){const t=this;t.parser=n;function n(r){return x6(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function C6(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function E6(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
130
+ `}]}function N6(e,t){const n=t.value?t.value+`
131
+ `:"",r={},s=t.lang?t.lang.split(/\s+/):[];s.length>0&&(r.className=["language-"+s[0]]);let o={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function T6(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function A6(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function j6(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=nc(r.toLowerCase()),o=e.footnoteOrder.indexOf(r);let i,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),i=e.footnoteOrder.length):i=o+1,l+=1,e.footnoteCounts.set(r,l);const a={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(i)}]};e.patch(t,a);const c={type:"element",tagName:"sup",properties:{},children:[a]};return e.patch(t,c),e.applyData(t,c)}function M6(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function R6(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function yO(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const s=e.all(t),o=s[0];o&&o.type==="text"?o.value="["+o.value:s.unshift({type:"text",value:"["});const i=s[s.length-1];return i&&i.type==="text"?i.value+=r:s.push({type:"text",value:r}),s}function O6(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return yO(e,t);const s={src:nc(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const o={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,o),e.applyData(t,o)}function I6(e,t){const n={src:nc(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function D6(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function L6(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return yO(e,t);const s={href:nc(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const o={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function P6(e,t){const n={href:nc(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function $6(e,t,n){const r=e.all(t),s=n?z6(n):wO(t),o={},i=[];if(typeof t.checked=="boolean"){const u=r[0];let f;u&&u.type==="element"&&u.tagName==="p"?f=u:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let l=-1;for(;++l<r.length;){const u=r[l];(s||l!==0||u.type!=="element"||u.tagName!=="p")&&i.push({type:"text",value:`
132
+ `}),u.type==="element"&&u.tagName==="p"&&!s?i.push(...u.children):i.push(u)}const a=r[r.length-1];a&&(s||a.type!=="element"||a.tagName!=="p")&&i.push({type:"text",value:`
133
+ `});const c={type:"element",tagName:"li",properties:o,children:i};return e.patch(t,c),e.applyData(t,c)}function z6(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=wO(n[r])}return t}function wO(e){const t=e.spread;return t??e.children.length>1}function _6(e,t){const n={},r=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s<r.length;){const i=r[s];if(i.type==="element"&&i.tagName==="li"&&i.properties&&Array.isArray(i.properties.className)&&i.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,o),e.applyData(t,o)}function F6(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function B6(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function H6(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function W6(e,t){const n=e.all(t),r=n.shift(),s=[];if(r){const i={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],i),s.push(i)}if(n.length>0){const i={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=J0(t.children[1]),a=QR(t.children[t.children.length-1]);l&&a&&(i.position={start:l,end:a}),s.push(i)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,o),e.applyData(t,o)}function U6(e,t,n){const r=n?n.children:void 0,o=(r?r.indexOf(t):1)===0?"th":"td",i=n&&n.type==="table"?n.align:void 0,l=i?i.length:t.children.length;let a=-1;const c=[];for(;++a<l;){const f=t.children[a],h={},p=i?i[a]:void 0;p&&(h.align=p);let m={type:"element",tagName:o,properties:h,children:[]};f&&(m.children=e.all(f),e.patch(f,m),m=e.applyData(f,m)),c.push(m)}const u={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,u),e.applyData(t,u)}function V6(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const rE=9,sE=32;function K6(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const o=[];for(;r;)o.push(oE(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return o.push(oE(t.slice(s),s>0,!1)),o.join("")}function oE(e,t,n){let r=0,s=e.length;if(t){let o=e.codePointAt(r);for(;o===rE||o===sE;)r++,o=e.codePointAt(r)}if(n){let o=e.codePointAt(s-1);for(;o===rE||o===sE;)s--,o=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function q6(e,t){const n={type:"text",value:K6(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Y6(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const G6={blockquote:C6,break:E6,code:N6,delete:T6,emphasis:A6,footnoteReference:j6,heading:M6,html:R6,imageReference:O6,image:I6,inlineCode:D6,linkReference:L6,link:P6,listItem:$6,list:_6,paragraph:F6,root:B6,strong:H6,table:W6,tableCell:V6,tableRow:U6,text:q6,thematicBreak:Y6,toml:of,yaml:of,definition:of,footnoteDefinition:of};function of(){}const kO=-1,wm=0,nu=1,Kh=2,rb=3,sb=4,ob=5,ib=6,xO=7,bO=8,vO=typeof self=="object"?self:globalThis,iE=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new vO[e](t)},J6=(e,t)=>{const n=(s,o)=>(e.set(o,s),s),r=s=>{if(e.has(s))return e.get(s);const[o,i]=t[s];switch(o){case wm:case kO:return n(i,s);case nu:{const l=n([],s);for(const a of i)l.push(r(a));return l}case Kh:{const l=n({},s);for(const[a,c]of i)l[r(a)]=r(c);return l}case rb:return n(new Date(i),s);case sb:{const{source:l,flags:a}=i;return n(new RegExp(l,a),s)}case ob:{const l=n(new Map,s);for(const[a,c]of i)l.set(r(a),r(c));return l}case ib:{const l=n(new Set,s);for(const a of i)l.add(r(a));return l}case xO:{const{name:l,message:a}=i;return n(typeof vO[l]=="function"?iE(l,a):new Error(a),s)}case bO:return n(BigInt(i),s);case"BigInt":return n(Object(BigInt(i)),s);case"ArrayBuffer":return n(new Uint8Array(i).buffer,i);case"DataView":{const{buffer:l}=new Uint8Array(i);return n(new DataView(l),i)}}return n(iE(o,i),s)};return r},lE=e=>J6(new Map,e)(0),Fi="",{toString:Q6}={},{keys:X6}=Object,Sc=e=>{const t=typeof e;if(t!=="object"||!e)return[wm,t];const n=Q6.call(e).slice(8,-1);switch(n){case"Array":return[nu,Fi];case"Object":return[Kh,Fi];case"Date":return[rb,Fi];case"RegExp":return[sb,Fi];case"Map":return[ob,Fi];case"Set":return[ib,Fi];case"DataView":return[nu,n]}return n.includes("Array")?[nu,n]:e instanceof Error?[xO,e.name||"Error"]:[Kh,n]},lf=([e,t])=>e===wm&&(t==="function"||t==="symbol"),Z6=(e,t,n,r)=>{const s=(i,l)=>{const a=r.push(i)-1;return n.set(l,a),a},o=i=>{if(n.has(i))return n.get(i);let[l,a]=Sc(i);switch(l){case wm:{let u=i;switch(a){case"bigint":l=bO,u=i.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+a);u=null;break;case"undefined":return s([kO],i)}return s([l,u],i)}case nu:{if(a){let h=i;return a==="DataView"?h=new Uint8Array(i.buffer):a==="ArrayBuffer"&&(h=new Uint8Array(i)),s([a,[...h]],i)}const u=[],f=s([l,u],i);for(const h of i)u.push(o(h));return f}case Kh:{if(a)switch(a){case"BigInt":return s([a,i.toString()],i);case"Boolean":case"Number":case"String":return s([a,i.valueOf()],i)}if(t&&"toJSON"in i)return o(i.toJSON());const u=[],f=s([l,u],i);for(const h of X6(i))(e||!lf(Sc(i[h])))&&u.push([o(h),o(i[h])]);return f}case rb:return s([l,isNaN(i.getTime())?Fi:i.toISOString()],i);case sb:{const{source:u,flags:f}=i;return s([l,{source:u,flags:f}],i)}case ob:{const u=[],f=s([l,u],i);for(const[h,p]of i)(e||!(lf(Sc(h))||lf(Sc(p))))&&u.push([o(h),o(p)]);return f}case ib:{const u=[],f=s([l,u],i);for(const h of i)(e||!lf(Sc(h)))&&u.push(o(h));return f}}const{message:c}=i;return s([l,{name:a,message:c}],i)};return o},aE=(e,{json:t,lossy:n}={})=>{const r=[];return Z6(!(t||n),!!t,new Map,r)(e),r},qh=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?lE(aE(e,t)):structuredClone(e):(e,t)=>lE(aE(e,t));function eW(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function tW(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function nW(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||eW,r=e.options.footnoteBackLabel||tW,s=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",i=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let a=-1;for(;++a<e.footnoteOrder.length;){const c=e.footnoteById.get(e.footnoteOrder[a]);if(!c)continue;const u=e.all(c),f=String(c.identifier).toUpperCase(),h=nc(f.toLowerCase());let p=0;const m=[],y=e.footnoteCounts.get(f);for(;y!==void 0&&++p<=y;){m.length>0&&m.push({type:"text",value:" "});let v=typeof n=="string"?n:n(a,p);typeof v=="string"&&(v={type:"text",value:v}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+h+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(a,p),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const x=u[u.length-1];if(x&&x.type==="element"&&x.tagName==="p"){const v=x.children[x.children.length-1];v&&v.type==="text"?v.value+=" ":x.children.push({type:"text",value:" "}),x.children.push(...m)}else u.push(...m);const k={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(u,!0)};e.patch(c,k),l.push(k)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...qh(i),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
134
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
135
+ `}]}}const km=function(e){if(e==null)return iW;if(typeof e=="function")return xm(e);if(typeof e=="object")return Array.isArray(e)?rW(e):sW(e);if(typeof e=="string")return oW(e);throw new Error("Expected function, string, or object as test")};function rW(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=km(e[n]);return xm(r);function r(...s){let o=-1;for(;++o<t.length;)if(t[o].apply(this,s))return!0;return!1}}function sW(e){const t=e;return xm(n);function n(r){const s=r;let o;for(o in e)if(s[o]!==t[o])return!1;return!0}}function oW(e){return xm(t);function t(n){return n&&n.type===e}}function xm(e){return t;function t(n,r,s){return!!(lW(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function iW(){return!0}function lW(e){return e!==null&&typeof e=="object"&&"type"in e}const SO=[],aW=!0,Rk=!1,cW="skip";function CO(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const o=km(s),i=r?-1:1;l(e,void 0,[])();function l(a,c,u){const f=a&&typeof a=="object"?a:{};if(typeof f.type=="string"){const p=typeof f.tagName=="string"?f.tagName:typeof f.name=="string"?f.name:void 0;Object.defineProperty(h,"name",{value:"node ("+(a.type+(p?"<"+p+">":""))+")"})}return h;function h(){let p=SO,m,y,x;if((!t||o(a,c,u[u.length-1]||void 0))&&(p=uW(n(a,u)),p[0]===Rk))return p;if("children"in a&&a.children){const k=a;if(k.children&&p[0]!==cW)for(y=(r?k.children.length:-1)+i,x=u.concat(k);y>-1&&y<k.children.length;){const v=k.children[y];if(m=l(v,y,x)(),m[0]===Rk)return m;y=typeof m[1]=="number"?m[1]:y+i}}return p}}}function uW(e){return Array.isArray(e)?e:typeof e=="number"?[aW,e]:e==null?SO:[e]}function lb(e,t,n,r){let s,o,i;typeof t=="function"&&typeof n!="function"?(o=void 0,i=t,s=n):(o=t,i=n,s=r),CO(e,o,l,s);function l(a,c){const u=c[c.length-1],f=u?u.children.indexOf(a):void 0;return i(a,f,u)}}const Ok={}.hasOwnProperty,dW={};function fW(e,t){const n=t||dW,r=new Map,s=new Map,o=new Map,i={...G6,...n.handlers},l={all:c,applyData:pW,definitionById:r,footnoteById:s,footnoteCounts:o,footnoteOrder:[],handlers:i,one:a,options:n,patch:hW,wrap:gW};return lb(e,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){const f=u.type==="definition"?r:s,h=String(u.identifier).toUpperCase();f.has(h)||f.set(h,u)}}),l;function a(u,f){const h=u.type,p=l.handlers[h];if(Ok.call(l.handlers,h)&&p)return p(l,u,f);if(l.options.passThrough&&l.options.passThrough.includes(h)){if("children"in u){const{children:y,...x}=u,k=qh(x);return k.children=l.all(u),k}return qh(u)}return(l.options.unknownHandler||mW)(l,u,f)}function c(u){const f=[];if("children"in u){const h=u.children;let p=-1;for(;++p<h.length;){const m=l.one(h[p],u);if(m){if(p&&h[p-1].type==="break"&&(!Array.isArray(m)&&m.type==="text"&&(m.value=cE(m.value)),!Array.isArray(m)&&m.type==="element")){const y=m.children[0];y&&y.type==="text"&&(y.value=cE(y.value))}Array.isArray(m)?f.push(...m):f.push(m)}}}return f}}function hW(e,t){e.position&&(t.position=t5(e))}function pW(e,t){let n=t;if(e&&e.data){const r=e.data.hName,s=e.data.hChildren,o=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const i="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:i}}n.type==="element"&&o&&Object.assign(n.properties,qh(o)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function mW(e,t){const n=t.data||{},r="value"in t&&!(Ok.call(n,"hProperties")||Ok.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function gW(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
136
+ `});++r<e.length;)r&&n.push({type:"text",value:`
137
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
138
+ `}),n}function cE(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function uE(e,t){const n=fW(e,t),r=n.one(e,void 0),s=nW(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&o.children.push({type:"text",value:`
139
+ `},s),o}function yW(e,t){return e&&"run"in e?async function(n,r){const s=uE(n,{file:r,...t});await e.run(s,r)}:function(n,r){return uE(n,{file:r,...e||t})}}function dE(e){if(e)throw e}var Xf=Object.prototype.hasOwnProperty,EO=Object.prototype.toString,fE=Object.defineProperty,hE=Object.getOwnPropertyDescriptor,pE=function(t){return typeof Array.isArray=="function"?Array.isArray(t):EO.call(t)==="[object Array]"},mE=function(t){if(!t||EO.call(t)!=="[object Object]")return!1;var n=Xf.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Xf.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var s;for(s in t);return typeof s>"u"||Xf.call(t,s)},gE=function(t,n){fE&&n.name==="__proto__"?fE(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},yE=function(t,n){if(n==="__proto__")if(Xf.call(t,n)){if(hE)return hE(t,n).value}else return;return t[n]},wW=function e(){var t,n,r,s,o,i,l=arguments[0],a=1,c=arguments.length,u=!1;for(typeof l=="boolean"&&(u=l,l=arguments[1]||{},a=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});a<c;++a)if(t=arguments[a],t!=null)for(n in t)r=yE(l,n),s=yE(t,n),l!==s&&(u&&s&&(mE(s)||(o=pE(s)))?(o?(o=!1,i=r&&pE(r)?r:[]):i=r&&mE(r)?r:{},gE(l,{name:n,newValue:e(u,i,s)})):typeof s<"u"&&gE(l,{name:n,newValue:s}));return l};const iy=Kp(wW);function Ik(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function kW(){const e=[],t={run:n,use:r};return t;function n(...s){let o=-1;const i=s.pop();if(typeof i!="function")throw new TypeError("Expected function as last argument, not "+i);l(null,...s);function l(a,...c){const u=e[++o];let f=-1;if(a){i(a);return}for(;++f<s.length;)(c[f]===null||c[f]===void 0)&&(c[f]=s[f]);s=c,u?xW(u,l)(...c):i(null,...c)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function xW(e,t){let n;return r;function r(...i){const l=e.length>i.length;let a;l&&i.push(s);try{a=e.apply(this,i)}catch(c){const u=c;if(l&&n)throw u;return s(u)}l||(a&&a.then&&typeof a.then=="function"?a.then(o,s):a instanceof Error?s(a):o(a))}function s(i,...l){n||(n=!0,t(i,...l))}function o(i){s(null,i)}}const vs={basename:bW,dirname:vW,extname:SW,join:CW,sep:"/"};function bW(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');cd(e);let n=0,r=-1,s=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(o){n=s+1;break}}else r<0&&(o=!0,r=s+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let i=-1,l=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(o){n=s+1;break}}else i<0&&(o=!0,i=s+1),l>-1&&(e.codePointAt(s)===t.codePointAt(l--)?l<0&&(r=s):(l=-1,r=i));return n===r?r=i:r<0&&(r=e.length),e.slice(n,r)}function vW(e){if(cd(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function SW(e){cd(e);let t=e.length,n=-1,r=0,s=-1,o=0,i;for(;t--;){const l=e.codePointAt(t);if(l===47){if(i){r=t+1;break}continue}n<0&&(i=!0,n=t+1),l===46?s<0?s=t:o!==1&&(o=1):s>-1&&(o=-1)}return s<0||n<0||o===0||o===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function CW(...e){let t=-1,n;for(;++t<e.length;)cd(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":EW(n)}function EW(e){cd(e);const t=e.codePointAt(0)===47;let n=NW(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function NW(e,t){let n="",r=0,s=-1,o=0,i=-1,l,a;for(;++i<=e.length;){if(i<e.length)l=e.codePointAt(i);else{if(l===47)break;l=47}if(l===47){if(!(s===i-1||o===1))if(s!==i-1&&o===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(a=n.lastIndexOf("/"),a!==n.length-1){a<0?(n="",r=0):(n=n.slice(0,a),r=n.length-1-n.lastIndexOf("/")),s=i,o=0;continue}}else if(n.length>0){n="",r=0,s=i,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,i):n=e.slice(s+1,i),r=i-s-1;s=i,o=0}else l===46&&o>-1?o++:o=-1}return n}function cd(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const TW={cwd:AW};function AW(){return"/"}function Dk(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function jW(e){if(typeof e=="string")e=new URL(e);else if(!Dk(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return MW(e)}function MW(e){if(e.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 t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.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(t)}const ly=["history","path","basename","stem","extname","dirname"];class NO{constructor(t){let n;t?Dk(t)?n={path:t}:typeof t=="string"||RW(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":TW.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<ly.length;){const o=ly[r];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let s;for(s in n)ly.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?vs.basename(this.path):void 0}set basename(t){cy(t,"basename"),ay(t,"basename"),this.path=vs.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?vs.dirname(this.path):void 0}set dirname(t){wE(this.basename,"dirname"),this.path=vs.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?vs.extname(this.path):void 0}set extname(t){if(ay(t,"extname"),wE(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=vs.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Dk(t)&&(t=jW(t)),cy(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?vs.basename(this.path,this.extname):void 0}set stem(t){cy(t,"stem"),ay(t,"stem"),this.path=vs.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const s=this.message(t,n,r);throw s.fatal=!0,s}info(t,n,r){const s=this.message(t,n,r);return s.fatal=void 0,s}message(t,n,r){const s=new Hn(t,n,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function ay(e,t){if(e&&e.includes(vs.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+vs.sep+"`")}function cy(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function wE(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function RW(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const OW=function(e){const r=this.constructor.prototype,s=r[e],o=function(){return s.apply(o,arguments)};return Object.setPrototypeOf(o,r),o},IW={}.hasOwnProperty;class ab extends OW{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=kW()}copy(){const t=new ab;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(iy(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(fy("data",this.frozen),this.namespace[t]=n,this):IW.call(this.namespace,t)&&this.namespace[t]||void 0:t?(fy("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=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(t,...r);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=af(t),r=this.parser||this.Parser;return uy("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),uy("process",this.parser||this.Parser),dy("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(o,i){const l=af(t),a=r.parse(l);r.run(a,l,function(u,f,h){if(u||!f||!h)return c(u);const p=f,m=r.stringify(p,h);PW(m)?h.value=m:h.result=m,c(u,h)});function c(u,f){u||!f?i(u):o?o(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),uy("processSync",this.parser||this.Parser),dy("processSync",this.compiler||this.Compiler),this.process(t,s),xE("processSync","process",n),r;function s(o,i){n=!0,dE(o),r=i}}run(t,n,r){kE(t),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?o(void 0,r):new Promise(o);function o(i,l){const a=af(n);s.run(t,a,c);function c(u,f,h){const p=f||t;u?l(u):i?i(p):r(void 0,p,h)}}}runSync(t,n){let r=!1,s;return this.run(t,n,o),xE("runSync","run",r),s;function o(i,l){dE(i),s=l,r=!0}}stringify(t,n){this.freeze();const r=af(n),s=this.compiler||this.Compiler;return dy("stringify",s),kE(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(fy("use",this.frozen),t!=null)if(typeof t=="function")a(t,n);else if(typeof t=="object")Array.isArray(t)?l(t):i(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(c){if(typeof c=="function")a(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[u,...f]=c;a(u,f)}else i(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function i(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");l(c.plugins),c.settings&&(s.settings=iy(!0,s.settings,c.settings))}function l(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){const f=c[u];o(f)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function a(c,u){let f=-1,h=-1;for(;++f<r.length;)if(r[f][0]===c){h=f;break}if(h===-1)r.push([c,...u]);else if(u.length>0){let[p,...m]=u;const y=r[h][1];Ik(y)&&Ik(p)&&(p=iy(!0,y,p)),r[h]=[c,p,...m]}}}}const DW=new ab().freeze();function uy(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function dy(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function fy(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function kE(e){if(!Ik(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function xE(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function af(e){return LW(e)?e:new NO(e)}function LW(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function PW(e){return typeof e=="string"||$W(e)}function $W(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const zW="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",bE=[],vE={allowDangerousHtml:!0},_W=/^(https?|ircs?|mailto|xmpp)$/i,FW=[{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 Lc(e){const t=BW(e),n=HW(e);return WW(t.runSync(t.parse(n),n),e)}function BW(e){const t=e.rehypePlugins||bE,n=e.remarkPlugins||bE,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...vE}:vE;return DW().use(S6).use(n).use(yW,r).use(t)}function HW(e){const t=e.children||"",n=new NO;return typeof t=="string"&&(n.value=t),n}function WW(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,o=t.disallowedElements,i=t.skipHtml,l=t.unwrapDisallowed,a=t.urlTransform||UW;for(const u of FW)Object.hasOwn(t,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+zW+u.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),lb(e,c),i5(e,{Fragment:d.Fragment,components:s,ignoreInvalidStyle:!0,jsx:d.jsx,jsxs:d.jsxs,passKeys:!0,passNode:!0});function c(u,f,h){if(u.type==="raw"&&h&&typeof f=="number")return i?h.children.splice(f,1):h.children[f]={type:"text",value:u.value},f;if(u.type==="element"){let p;for(p in ry)if(Object.hasOwn(ry,p)&&Object.hasOwn(u.properties,p)){const m=u.properties[p],y=ry[p];(y===null||y.includes(u.tagName))&&(u.properties[p]=a(String(m||""),p,u))}}if(u.type==="element"){let p=n?!n.includes(u.tagName):o?o.includes(u.tagName):!1;if(!p&&r&&typeof f=="number"&&(p=!r(u,f,h)),p&&h&&typeof f=="number")return l&&u.children?h.children.splice(f,1,...u.children):h.children.splice(f,1),f}}}function UW(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||r!==-1&&t>r||_W.test(e.slice(0,t))?e:""}function SE(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(t);for(;s!==-1;)r++,s=n.indexOf(t,s+t.length);return r}function VW(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function KW(e,t,n){const s=km((n||{}).ignore||[]),o=qW(t);let i=-1;for(;++i<o.length;)CO(e,"text",l);function l(c,u){let f=-1,h;for(;++f<u.length;){const p=u[f],m=h?h.children:void 0;if(s(p,m?m.indexOf(p):void 0,h))return;h=p}if(h)return a(c,u)}function a(c,u){const f=u[u.length-1],h=o[i][0],p=o[i][1];let m=0;const x=f.children.indexOf(c);let k=!1,v=[];h.lastIndex=0;let b=h.exec(c.value);for(;b;){const E=b.index,N={index:b.index,input:b.input,stack:[...u,c]};let T=p(...b,N);if(typeof T=="string"&&(T=T.length>0?{type:"text",value:T}:void 0),T===!1?h.lastIndex=E+1:(m!==E&&v.push({type:"text",value:c.value.slice(m,E)}),Array.isArray(T)?v.push(...T):T&&v.push(T),m=E+b[0].length,k=!0),!h.global)break;b=h.exec(c.value)}return k?(m<c.value.length&&v.push({type:"text",value:c.value.slice(m)}),f.children.splice(x,1,...v)):v=[c],x+v.length}}function qW(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const s=n[r];t.push([YW(s[0]),GW(s[1])])}return t}function YW(e){return typeof e=="string"?new RegExp(VW(e),"g"):e}function GW(e){return typeof e=="function"?e:function(){return e}}const hy="phrasing",py=["autolink","link","image","label"];function JW(){return{transforms:[rU],enter:{literalAutolink:XW,literalAutolinkEmail:my,literalAutolinkHttp:my,literalAutolinkWww:my},exit:{literalAutolink:nU,literalAutolinkEmail:tU,literalAutolinkHttp:ZW,literalAutolinkWww:eU}}}function QW(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:hy,notInConstruct:py},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:hy,notInConstruct:py},{character:":",before:"[ps]",after:"\\/",inConstruct:hy,notInConstruct:py}]}}function XW(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function my(e){this.config.enter.autolinkProtocol.call(this,e)}function ZW(e){this.config.exit.autolinkProtocol.call(this,e)}function eU(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function tU(e){this.config.exit.autolinkEmail.call(this,e)}function nU(e){this.exit(e)}function rU(e){KW(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,sU],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),oU]],{ignore:["link","linkReference"]})}function sU(e,t,n,r,s){let o="";if(!TO(s)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!iU(n)))return!1;const i=lU(n+r);if(!i[0])return!1;const l={type:"link",title:null,url:o+t+i[0],children:[{type:"text",value:t+i[0]}]};return i[1]?[l,{type:"text",value:i[1]}]:l}function oU(e,t,n,r){return!TO(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function iU(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function lU(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const s=SE(e,"(");let o=SE(e,")");for(;r!==-1&&s>o;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),o++;return[e,n]}function TO(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||wl(n)||gm(n))&&(!t||n!==47)}AO.peek=gU;function aU(){this.buffer()}function cU(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function uU(){this.buffer()}function dU(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function fU(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=is(this.sliceSerialize(e)).toLowerCase(),n.label=t}function hU(e){this.exit(e)}function pU(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=is(this.sliceSerialize(e)).toLowerCase(),n.label=t}function mU(e){this.exit(e)}function gU(){return"["}function AO(e,t,n,r){const s=n.createTracker(r);let o=s.move("[^");const i=n.enter("footnoteReference"),l=n.enter("reference");return o+=s.move(n.safe(n.associationId(e),{after:"]",before:o})),l(),i(),o+=s.move("]"),o}function yU(){return{enter:{gfmFootnoteCallString:aU,gfmFootnoteCall:cU,gfmFootnoteDefinitionLabelString:uU,gfmFootnoteDefinition:dU},exit:{gfmFootnoteCallString:fU,gfmFootnoteCall:hU,gfmFootnoteDefinitionLabelString:pU,gfmFootnoteDefinition:mU}}}function wU(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:AO},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,o,i){const l=o.createTracker(i);let a=l.move("[^");const c=o.enter("footnoteDefinition"),u=o.enter("label");return a+=l.move(o.safe(o.associationId(r),{before:a,after:"]"})),u(),a+=l.move("]:"),r.children&&r.children.length>0&&(l.shift(4),a+=l.move((t?`
140
+ `:" ")+o.indentLines(o.containerFlow(r,l.current()),t?jO:kU))),c(),a}}function kU(e,t,n){return t===0?e:jO(e,t,n)}function jO(e,t,n){return(n?"":" ")+e}const xU=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];MO.peek=EU;function bU(){return{canContainEols:["delete"],enter:{strikethrough:SU},exit:{strikethrough:CU}}}function vU(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:xU}],handlers:{delete:MO}}}function SU(e){this.enter({type:"delete",children:[]},e)}function CU(e){this.exit(e)}function MO(e,t,n,r){const s=n.createTracker(r),o=n.enter("strikethrough");let i=s.move("~~");return i+=n.containerPhrasing(e,{...s.current(),before:i,after:"~"}),i+=s.move("~~"),o(),i}function EU(){return"~"}function NU(e){return e.length}function TU(e,t){const n=t||{},r=(n.align||[]).concat(),s=n.stringLength||NU,o=[],i=[],l=[],a=[];let c=0,u=-1;for(;++u<e.length;){const y=[],x=[];let k=-1;for(e[u].length>c&&(c=e[u].length);++k<e[u].length;){const v=AU(e[u][k]);if(n.alignDelimiters!==!1){const b=s(v);x[k]=b,(a[k]===void 0||b>a[k])&&(a[k]=b)}y.push(v)}i[u]=y,l[u]=x}let f=-1;if(typeof r=="object"&&"length"in r)for(;++f<c;)o[f]=CE(r[f]);else{const y=CE(r);for(;++f<c;)o[f]=y}f=-1;const h=[],p=[];for(;++f<c;){const y=o[f];let x="",k="";y===99?(x=":",k=":"):y===108?x=":":y===114&&(k=":");let v=n.alignDelimiters===!1?1:Math.max(1,a[f]-x.length-k.length);const b=x+"-".repeat(v)+k;n.alignDelimiters!==!1&&(v=x.length+v+k.length,v>a[f]&&(a[f]=v),p[f]=v),h[f]=b}i.splice(1,0,h),l.splice(1,0,p),u=-1;const m=[];for(;++u<i.length;){const y=i[u],x=l[u];f=-1;const k=[];for(;++f<c;){const v=y[f]||"";let b="",E="";if(n.alignDelimiters!==!1){const N=a[f]-(x[f]||0),T=o[f];T===114?b=" ".repeat(N):T===99?N%2?(b=" ".repeat(N/2+.5),E=" ".repeat(N/2-.5)):(b=" ".repeat(N/2),E=b):E=" ".repeat(N)}n.delimiterStart!==!1&&!f&&k.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&v==="")&&(n.delimiterStart!==!1||f)&&k.push(" "),n.alignDelimiters!==!1&&k.push(b),k.push(v),n.alignDelimiters!==!1&&k.push(E),n.padding!==!1&&k.push(" "),(n.delimiterEnd!==!1||f!==c-1)&&k.push("|")}m.push(n.delimiterEnd===!1?k.join("").replace(/ +$/,""):k.join(""))}return m.join(`
141
+ `)}function AU(e){return e==null?"":String(e)}function CE(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function jU(e,t,n,r){const s=n.enter("blockquote"),o=n.createTracker(r);o.move("> "),o.shift(2);const i=n.indentLines(n.containerFlow(e,o.current()),MU);return s(),i}function MU(e,t,n){return">"+(n?"":" ")+e}function RU(e,t){return EE(e,t.inConstruct,!0)&&!EE(e,t.notInConstruct,!1)}function EE(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function NE(e,t,n,r){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
142
+ `&&RU(n.stack,n.unsafe[s]))return/[ \t]/.test(r.before)?"":" ";return`\\
143
+ `}function OU(e,t){const n=String(e);let r=n.indexOf(t),s=r,o=0,i=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===s?++o>i&&(i=o):o=1,s=r+t.length,r=n.indexOf(t,s);return i}function IU(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function DU(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function LU(e,t,n,r){const s=DU(n),o=e.value||"",i=s==="`"?"GraveAccent":"Tilde";if(IU(e,n)){const f=n.enter("codeIndented"),h=n.indentLines(o,PU);return f(),h}const l=n.createTracker(r),a=s.repeat(Math.max(OU(o,s)+1,3)),c=n.enter("codeFenced");let u=l.move(a);if(e.lang){const f=n.enter(`codeFencedLang${i}`);u+=l.move(n.safe(e.lang,{before:u,after:" ",encode:["`"],...l.current()})),f()}if(e.lang&&e.meta){const f=n.enter(`codeFencedMeta${i}`);u+=l.move(" "),u+=l.move(n.safe(e.meta,{before:u,after:`
144
+ `,encode:["`"],...l.current()})),f()}return u+=l.move(`
145
+ `),o&&(u+=l.move(o+`
146
+ `)),u+=l.move(a),c(),u}function PU(e,t,n){return(n?"":" ")+e}function cb(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function $U(e,t,n,r){const s=cb(n),o=s==='"'?"Quote":"Apostrophe",i=n.enter("definition");let l=n.enter("label");const a=n.createTracker(r);let c=a.move("[");return c+=a.move(n.safe(n.associationId(e),{before:c,after:"]",...a.current()})),c+=a.move("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),c+=a.move("<"),c+=a.move(n.safe(e.url,{before:c,after:">",...a.current()})),c+=a.move(">")):(l=n.enter("destinationRaw"),c+=a.move(n.safe(e.url,{before:c,after:e.title?" ":`
147
+ `,...a.current()}))),l(),e.title&&(l=n.enter(`title${o}`),c+=a.move(" "+s),c+=a.move(n.safe(e.title,{before:c,after:s,...a.current()})),c+=a.move(s),l()),i(),c}function zU(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function _u(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Yh(e,t,n){const r=Ba(e),s=Ba(t);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}}RO.peek=_U;function RO(e,t,n,r){const s=zU(n),o=n.enter("emphasis"),i=n.createTracker(r),l=i.move(s);let a=i.move(n.containerPhrasing(e,{after:s,before:l,...i.current()}));const c=a.charCodeAt(0),u=Yh(r.before.charCodeAt(r.before.length-1),c,s);u.inside&&(a=_u(c)+a.slice(1));const f=a.charCodeAt(a.length-1),h=Yh(r.after.charCodeAt(0),f,s);h.inside&&(a=a.slice(0,-1)+_u(f));const p=i.move(s);return o(),n.attentionEncodeSurroundingInfo={after:h.outside,before:u.outside},l+a+p}function _U(e,t,n){return n.options.emphasis||"*"}function FU(e,t){let n=!1;return lb(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Rk}),!!((!e.depth||e.depth<3)&&eb(e)&&(t.options.setext||n))}function BU(e,t,n,r){const s=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(r);if(FU(e,n)){const u=n.enter("headingSetext"),f=n.enter("phrasing"),h=n.containerPhrasing(e,{...o.current(),before:`
148
+ `,after:`
149
+ `});return f(),u(),h+`
150
+ `+(s===1?"=":"-").repeat(h.length-(Math.max(h.lastIndexOf("\r"),h.lastIndexOf(`
151
+ `))+1))}const i="#".repeat(s),l=n.enter("headingAtx"),a=n.enter("phrasing");o.move(i+" ");let c=n.containerPhrasing(e,{before:"# ",after:`
152
+ `,...o.current()});return/^[\t ]/.test(c)&&(c=_u(c.charCodeAt(0))+c.slice(1)),c=c?i+" "+c:i,n.options.closeAtx&&(c+=" "+i),a(),l(),c}OO.peek=HU;function OO(e){return e.value||""}function HU(){return"<"}IO.peek=WU;function IO(e,t,n,r){const s=cb(n),o=s==='"'?"Quote":"Apostrophe",i=n.enter("image");let l=n.enter("label");const a=n.createTracker(r);let c=a.move("![");return c+=a.move(n.safe(e.alt,{before:c,after:"]",...a.current()})),c+=a.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),c+=a.move("<"),c+=a.move(n.safe(e.url,{before:c,after:">",...a.current()})),c+=a.move(">")):(l=n.enter("destinationRaw"),c+=a.move(n.safe(e.url,{before:c,after:e.title?" ":")",...a.current()}))),l(),e.title&&(l=n.enter(`title${o}`),c+=a.move(" "+s),c+=a.move(n.safe(e.title,{before:c,after:s,...a.current()})),c+=a.move(s),l()),c+=a.move(")"),i(),c}function WU(){return"!"}DO.peek=UU;function DO(e,t,n,r){const s=e.referenceType,o=n.enter("imageReference");let i=n.enter("label");const l=n.createTracker(r);let a=l.move("![");const c=n.safe(e.alt,{before:a,after:"]",...l.current()});a+=l.move(c+"]["),i();const u=n.stack;n.stack=[],i=n.enter("reference");const f=n.safe(n.associationId(e),{before:a,after:"]",...l.current()});return i(),n.stack=u,o(),s==="full"||!c||c!==f?a+=l.move(f+"]"):s==="shortcut"?a=a.slice(0,-1):a+=l.move("]"),a}function UU(){return"!"}LO.peek=VU;function LO(e,t,n){let r=e.value||"",s="`",o=-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+" ");++o<n.unsafe.length;){const i=n.unsafe[o],l=n.compilePattern(i);let a;if(i.atBreak)for(;a=l.exec(r);){let c=a.index;r.charCodeAt(c)===10&&r.charCodeAt(c-1)===13&&c--,r=r.slice(0,c)+" "+r.slice(a.index+1)}}return s+r+s}function VU(){return"`"}function PO(e,t){const n=eb(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}$O.peek=KU;function $O(e,t,n,r){const s=cb(n),o=s==='"'?"Quote":"Apostrophe",i=n.createTracker(r);let l,a;if(PO(e,n)){const u=n.stack;n.stack=[],l=n.enter("autolink");let f=i.move("<");return f+=i.move(n.containerPhrasing(e,{before:f,after:">",...i.current()})),f+=i.move(">"),l(),n.stack=u,f}l=n.enter("link"),a=n.enter("label");let c=i.move("[");return c+=i.move(n.containerPhrasing(e,{before:c,after:"](",...i.current()})),c+=i.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),c+=i.move("<"),c+=i.move(n.safe(e.url,{before:c,after:">",...i.current()})),c+=i.move(">")):(a=n.enter("destinationRaw"),c+=i.move(n.safe(e.url,{before:c,after:e.title?" ":")",...i.current()}))),a(),e.title&&(a=n.enter(`title${o}`),c+=i.move(" "+s),c+=i.move(n.safe(e.title,{before:c,after:s,...i.current()})),c+=i.move(s),a()),c+=i.move(")"),l(),c}function KU(e,t,n){return PO(e,n)?"<":"["}zO.peek=qU;function zO(e,t,n,r){const s=e.referenceType,o=n.enter("linkReference");let i=n.enter("label");const l=n.createTracker(r);let a=l.move("[");const c=n.containerPhrasing(e,{before:a,after:"]",...l.current()});a+=l.move(c+"]["),i();const u=n.stack;n.stack=[],i=n.enter("reference");const f=n.safe(n.associationId(e),{before:a,after:"]",...l.current()});return i(),n.stack=u,o(),s==="full"||!c||c!==f?a+=l.move(f+"]"):s==="shortcut"?a=a.slice(0,-1):a+=l.move("]"),a}function qU(){return"["}function ub(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function YU(e){const t=ub(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function GU(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function _O(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function JU(e,t,n,r){const s=n.enter("list"),o=n.bulletCurrent;let i=e.ordered?GU(n):ub(n);const l=e.ordered?i==="."?")":".":YU(n);let a=t&&n.bulletLastUsed?i===n.bulletLastUsed:!1;if(!e.ordered){const u=e.children?e.children[0]:void 0;if((i==="*"||i==="-")&&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&&(a=!0),_O(n)===i&&u){let f=-1;for(;++f<e.children.length;){const h=e.children[f];if(h&&h.type==="listItem"&&h.children&&h.children[0]&&h.children[0].type==="thematicBreak"){a=!0;break}}}}a&&(i=l),n.bulletCurrent=i;const c=n.containerFlow(e,r);return n.bulletLastUsed=i,n.bulletCurrent=o,s(),c}function QU(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function XU(e,t,n,r){const s=QU(n);let o=n.bulletCurrent||ub(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let i=o.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(i=Math.ceil(i/4)*4);const l=n.createTracker(r);l.move(o+" ".repeat(i-o.length)),l.shift(i);const a=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,l.current()),u);return a(),c;function u(f,h,p){return h?(p?"":" ".repeat(i))+f:(p?o:o+" ".repeat(i-o.length))+f}}function ZU(e,t,n,r){const s=n.enter("paragraph"),o=n.enter("phrasing"),i=n.containerPhrasing(e,r);return o(),s(),i}const eV=km(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function tV(e,t,n,r){return(e.children.some(function(i){return eV(i)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function nV(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}FO.peek=rV;function FO(e,t,n,r){const s=nV(n),o=n.enter("strong"),i=n.createTracker(r),l=i.move(s+s);let a=i.move(n.containerPhrasing(e,{after:s,before:l,...i.current()}));const c=a.charCodeAt(0),u=Yh(r.before.charCodeAt(r.before.length-1),c,s);u.inside&&(a=_u(c)+a.slice(1));const f=a.charCodeAt(a.length-1),h=Yh(r.after.charCodeAt(0),f,s);h.inside&&(a=a.slice(0,-1)+_u(f));const p=i.move(s+s);return o(),n.attentionEncodeSurroundingInfo={after:h.outside,before:u.outside},l+a+p}function rV(e,t,n){return n.options.strong||"*"}function sV(e,t,n,r){return n.safe(e.value,r)}function oV(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function iV(e,t,n){const r=(_O(n)+(n.options.ruleSpaces?" ":"")).repeat(oV(n));return n.options.ruleSpaces?r.slice(0,-1):r}const BO={blockquote:jU,break:NE,code:LU,definition:$U,emphasis:RO,hardBreak:NE,heading:BU,html:OO,image:IO,imageReference:DO,inlineCode:LO,link:$O,linkReference:zO,list:JU,listItem:XU,paragraph:ZU,root:tV,strong:FO,text:sV,thematicBreak:iV};function lV(){return{enter:{table:aV,tableData:TE,tableHeader:TE,tableRow:uV},exit:{codeText:dV,table:cV,tableData:gy,tableHeader:gy,tableRow:gy}}}function aV(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function cV(e){this.exit(e),this.data.inTable=void 0}function uV(e){this.enter({type:"tableRow",children:[]},e)}function gy(e){this.exit(e)}function TE(e){this.enter({type:"tableCell",children:[]},e)}function dV(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,fV));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function fV(e,t){return t==="|"?t:e}function hV(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,s=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
153
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:h,table:i,tableCell:a,tableRow:l}};function i(p,m,y,x){return c(u(p,y,x),p.align)}function l(p,m,y,x){const k=f(p,y,x),v=c([k]);return v.slice(0,v.indexOf(`
154
+ `))}function a(p,m,y,x){const k=y.enter("tableCell"),v=y.enter("phrasing"),b=y.containerPhrasing(p,{...x,before:o,after:o});return v(),k(),b}function c(p,m){return TU(p,{align:m,alignDelimiters:r,padding:n,stringLength:s})}function u(p,m,y){const x=p.children;let k=-1;const v=[],b=m.enter("table");for(;++k<x.length;)v[k]=f(x[k],m,y);return b(),v}function f(p,m,y){const x=p.children;let k=-1;const v=[],b=m.enter("tableRow");for(;++k<x.length;)v[k]=a(x[k],p,m,y);return b(),v}function h(p,m,y){let x=BO.inlineCode(p,m,y);return y.stack.includes("tableCell")&&(x=x.replace(/\|/g,"\\$&")),x}}function pV(){return{exit:{taskListCheckValueChecked:AE,taskListCheckValueUnchecked:AE,paragraph:gV}}}function mV(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:yV}}}function AE(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function gV(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const s=t.children;let o=-1,i;for(;++o<s.length;){const l=s[o];if(l.type==="paragraph"){i=l;break}}i===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(e)}function yV(e,t,n,r){const s=e.children[0],o=typeof e.checked=="boolean"&&s&&s.type==="paragraph",i="["+(e.checked?"x":" ")+"] ",l=n.createTracker(r);o&&l.move(i);let a=BO.listItem(e,t,n,{...r,...l.current()});return o&&(a=a.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),a;function c(u){return u+i}}function wV(){return[JW(),yU(),bU(),lV(),pV()]}function kV(e){return{extensions:[QW(),wU(e),vU(),hV(e),mV()]}}const xV={tokenize:NV,partial:!0},HO={tokenize:TV,partial:!0},WO={tokenize:AV,partial:!0},UO={tokenize:jV,partial:!0},bV={tokenize:MV,partial:!0},VO={name:"wwwAutolink",tokenize:CV,previous:qO},KO={name:"protocolAutolink",tokenize:EV,previous:YO},wo={name:"emailAutolink",tokenize:SV,previous:GO},Is={};function vV(){return{text:Is}}let Ri=48;for(;Ri<123;)Is[Ri]=wo,Ri++,Ri===58?Ri=65:Ri===91&&(Ri=97);Is[43]=wo;Is[45]=wo;Is[46]=wo;Is[95]=wo;Is[72]=[wo,KO];Is[104]=[wo,KO];Is[87]=[wo,VO];Is[119]=[wo,VO];function SV(e,t,n){const r=this;let s,o;return i;function i(f){return!Lk(f)||!GO.call(r,r.previous)||db(r.events)?n(f):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),l(f))}function l(f){return Lk(f)?(e.consume(f),l):f===64?(e.consume(f),a):n(f)}function a(f){return f===46?e.check(bV,u,c)(f):f===45||f===95||$n(f)?(o=!0,e.consume(f),a):u(f)}function c(f){return e.consume(f),s=!0,a}function u(f){return o&&s&&Gn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(f)):n(f)}}function CV(e,t,n){const r=this;return s;function s(i){return i!==87&&i!==119||!qO.call(r,r.previous)||db(r.events)?n(i):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(xV,e.attempt(HO,e.attempt(WO,o),n),n)(i))}function o(i){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(i)}}function EV(e,t,n){const r=this;let s="",o=!1;return i;function i(f){return(f===72||f===104)&&YO.call(r,r.previous)&&!db(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(f),e.consume(f),l):n(f)}function l(f){if(Gn(f)&&s.length<5)return s+=String.fromCodePoint(f),e.consume(f),l;if(f===58){const h=s.toLowerCase();if(h==="http"||h==="https")return e.consume(f),a}return n(f)}function a(f){return f===47?(e.consume(f),o?c:(o=!0,a)):n(f)}function c(f){return f===null||Vh(f)||yt(f)||wl(f)||gm(f)?n(f):e.attempt(HO,e.attempt(WO,u),n)(f)}function u(f){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(f)}}function NV(e,t,n){let r=0;return s;function s(i){return(i===87||i===119)&&r<3?(r++,e.consume(i),s):i===46&&r===3?(e.consume(i),o):n(i)}function o(i){return i===null?n(i):t(i)}}function TV(e,t,n){let r,s,o;return i;function i(c){return c===46||c===95?e.check(UO,a,l)(c):c===null||yt(c)||wl(c)||c!==45&&gm(c)?a(c):(o=!0,e.consume(c),i)}function l(c){return c===95?r=!0:(s=r,r=void 0),e.consume(c),i}function a(c){return s||r||!o?n(c):t(c)}}function AV(e,t){let n=0,r=0;return s;function s(i){return i===40?(n++,e.consume(i),s):i===41&&r<n?o(i):i===33||i===34||i===38||i===39||i===41||i===42||i===44||i===46||i===58||i===59||i===60||i===63||i===93||i===95||i===126?e.check(UO,t,o)(i):i===null||yt(i)||wl(i)?t(i):(e.consume(i),s)}function o(i){return i===41&&r++,e.consume(i),s}}function jV(e,t,n){return r;function r(l){return l===33||l===34||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===63||l===95||l===126?(e.consume(l),r):l===38?(e.consume(l),o):l===93?(e.consume(l),s):l===60||l===null||yt(l)||wl(l)?t(l):n(l)}function s(l){return l===null||l===40||l===91||yt(l)||wl(l)?t(l):r(l)}function o(l){return Gn(l)?i(l):n(l)}function i(l){return l===59?(e.consume(l),r):Gn(l)?(e.consume(l),i):n(l)}}function MV(e,t,n){return r;function r(o){return e.consume(o),s}function s(o){return $n(o)?n(o):t(o)}}function qO(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||yt(e)}function YO(e){return!Gn(e)}function GO(e){return!(e===47||Lk(e))}function Lk(e){return e===43||e===45||e===46||e===95||$n(e)}function db(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const RV={tokenize:_V,partial:!0};function OV(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:PV,continuation:{tokenize:$V},exit:zV}},text:{91:{name:"gfmFootnoteCall",tokenize:LV},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:IV,resolveTo:DV}}}}function IV(e,t,n){const r=this;let s=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i;for(;s--;){const a=r.events[s][1];if(a.type==="labelImage"){i=a;break}if(a.type==="gfmFootnoteCall"||a.type==="labelLink"||a.type==="label"||a.type==="image"||a.type==="link")break}return l;function l(a){if(!i||!i._balanced)return n(a);const c=is(r.sliceSerialize({start:i.end,end:r.now()}));return c.codePointAt(0)!==94||!o.includes(c.slice(1))?n(a):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(a),e.exit("gfmFootnoteCallLabelMarker"),t(a))}}function DV(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},i={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},l=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",o,t],["enter",i,t],["exit",i,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...l),e}function LV(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o=0,i;return l;function l(f){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),a}function a(f){return f!==94?n(f):(e.enter("gfmFootnoteCallMarker"),e.consume(f),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(f){if(o>999||f===93&&!i||f===null||f===91||yt(f))return n(f);if(f===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return s.includes(is(r.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return yt(f)||(i=!0),o++,e.consume(f),f===92?u:c}function u(f){return f===91||f===92||f===93?(e.consume(f),o++,c):c(f)}}function PV(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,i=0,l;return a;function a(m){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(m){return m===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",u):n(m)}function u(m){if(i>999||m===93&&!l||m===null||m===91||yt(m))return n(m);if(m===93){e.exit("chunkString");const y=e.exit("gfmFootnoteDefinitionLabelString");return o=is(r.sliceSerialize(y)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return yt(m)||(l=!0),i++,e.consume(m),m===92?f:u}function f(m){return m===91||m===92||m===93?(e.consume(m),i++,u):u(m)}function h(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),s.includes(o)||s.push(o),st(e,p,"gfmFootnoteDefinitionWhitespace")):n(m)}function p(m){return t(m)}}function $V(e,t,n){return e.check(ad,t,e.attempt(RV,t,n))}function zV(e){e.exit("gfmFootnoteDefinition")}function _V(e,t,n){const r=this;return st(e,s,"gfmFootnoteDefinitionIndent",5);function s(o){const i=r.events[r.events.length-1];return i&&i[1].type==="gfmFootnoteDefinitionIndent"&&i[2].sliceSerialize(i[1],!0).length===4?t(o):n(o)}}function FV(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:o,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(i,l){let a=-1;for(;++a<i.length;)if(i[a][0]==="enter"&&i[a][1].type==="strikethroughSequenceTemporary"&&i[a][1]._close){let c=a;for(;c--;)if(i[c][0]==="exit"&&i[c][1].type==="strikethroughSequenceTemporary"&&i[c][1]._open&&i[a][1].end.offset-i[a][1].start.offset===i[c][1].end.offset-i[c][1].start.offset){i[a][1].type="strikethroughSequence",i[c][1].type="strikethroughSequence";const u={type:"strikethrough",start:Object.assign({},i[c][1].start),end:Object.assign({},i[a][1].end)},f={type:"strikethroughText",start:Object.assign({},i[c][1].end),end:Object.assign({},i[a][1].start)},h=[["enter",u,l],["enter",i[c][1],l],["exit",i[c][1],l],["enter",f,l]],p=l.parser.constructs.insideSpan.null;p&&Sr(h,h.length,0,ym(p,i.slice(c+1,a),l)),Sr(h,h.length,0,[["exit",f,l],["enter",i[a][1],l],["exit",i[a][1],l],["exit",u,l]]),Sr(i,c-1,a-c+3,h),a=c+h.length-2;break}}for(a=-1;++a<i.length;)i[a][1].type==="strikethroughSequenceTemporary"&&(i[a][1].type="data");return i}function o(i,l,a){const c=this.previous,u=this.events;let f=0;return h;function h(m){return c===126&&u[u.length-1][1].type!=="characterEscape"?a(m):(i.enter("strikethroughSequenceTemporary"),p(m))}function p(m){const y=Ba(c);if(m===126)return f>1?a(m):(i.consume(m),f++,p);if(f<2&&!n)return a(m);const x=i.exit("strikethroughSequenceTemporary"),k=Ba(m);return x._open=!k||k===2&&!!y,x._close=!y||y===2&&!!k,l(m)}}}class BV{constructor(){this.map=[]}add(t,n,r){HV(this,t,n,r)}consume(t){if(this.map.sort(function(o,i){return o[0]-i[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let s=r.pop();for(;s;){for(const o of s)t.push(o);s=r.pop()}this.map.length=0}}function HV(e,t,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s<e.map.length;){if(e.map[s][0]===t){e.map[s][1]+=n,e.map[s][2].push(...r);return}s+=1}e.map.push([t,n,r])}}function WV(e,t){let n=!1;const r=[];for(;t<e.length;){const s=e[t];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=r.length-1;r[o]=r[o]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function UV(){return{flow:{null:{name:"table",tokenize:VV,resolveAll:KV}}}}function VV(e,t,n){const r=this;let s=0,o=0,i;return l;function l(L){let _=r.events.length-1;for(;_>-1;){const ae=r.events[_][1].type;if(ae==="lineEnding"||ae==="linePrefix")_--;else break}const j=_>-1?r.events[_][1].type:null,F=j==="tableHead"||j==="tableRow"?T:a;return F===T&&r.parser.lazy[r.now().line]?n(L):F(L)}function a(L){return e.enter("tableHead"),e.enter("tableRow"),c(L)}function c(L){return L===124||(i=!0,o+=1),u(L)}function u(L){return L===null?n(L):Be(L)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),p):n(L):Ze(L)?st(e,u,"whitespace")(L):(o+=1,i&&(i=!1,s+=1),L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),i=!0,u):(e.enter("data"),f(L)))}function f(L){return L===null||L===124||yt(L)?(e.exit("data"),u(L)):(e.consume(L),L===92?h:f)}function h(L){return L===92||L===124?(e.consume(L),f):f(L)}function p(L){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(L):(e.enter("tableDelimiterRow"),i=!1,Ze(L)?st(e,m,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):m(L))}function m(L){return L===45||L===58?x(L):L===124?(i=!0,e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),y):N(L)}function y(L){return Ze(L)?st(e,x,"whitespace")(L):x(L)}function x(L){return L===58?(o+=1,i=!0,e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),k):L===45?(o+=1,k(L)):L===null||Be(L)?E(L):N(L)}function k(L){return L===45?(e.enter("tableDelimiterFiller"),v(L)):N(L)}function v(L){return L===45?(e.consume(L),v):L===58?(i=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),b):(e.exit("tableDelimiterFiller"),b(L))}function b(L){return Ze(L)?st(e,E,"whitespace")(L):E(L)}function E(L){return L===124?m(L):L===null||Be(L)?!i||s!==o?N(L):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(L)):N(L)}function N(L){return n(L)}function T(L){return e.enter("tableRow"),A(L)}function A(L){return L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),A):L===null||Be(L)?(e.exit("tableRow"),t(L)):Ze(L)?st(e,A,"whitespace")(L):(e.enter("data"),R(L))}function R(L){return L===null||L===124||yt(L)?(e.exit("data"),A(L)):(e.consume(L),L===92?$:R)}function $(L){return L===92||L===124?(e.consume(L),R):R(L)}}function KV(e,t){let n=-1,r=!0,s=0,o=[0,0,0,0],i=[0,0,0,0],l=!1,a=0,c,u,f;const h=new BV;for(;++n<e.length;){const p=e[n],m=p[1];p[0]==="enter"?m.type==="tableHead"?(l=!1,a!==0&&(jE(h,t,a,c,u),u=void 0,a=0),c={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},h.add(n,0,[["enter",c,t]])):m.type==="tableRow"||m.type==="tableDelimiterRow"?(r=!0,f=void 0,o=[0,0,0,0],i=[0,n+1,0,0],l&&(l=!1,u={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},h.add(n,0,[["enter",u,t]])),s=m.type==="tableDelimiterRow"?2:u?3:1):s&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")?(r=!1,i[2]===0&&(o[1]!==0&&(i[0]=i[1],f=cf(h,t,o,s,void 0,f),o=[0,0,0,0]),i[2]=n)):m.type==="tableCellDivider"&&(r?r=!1:(o[1]!==0&&(i[0]=i[1],f=cf(h,t,o,s,void 0,f)),o=i,i=[o[1],n,0,0])):m.type==="tableHead"?(l=!0,a=n):m.type==="tableRow"||m.type==="tableDelimiterRow"?(a=n,o[1]!==0?(i[0]=i[1],f=cf(h,t,o,s,n,f)):i[1]!==0&&(f=cf(h,t,i,s,n,f)),s=0):s&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(i[3]=n)}for(a!==0&&jE(h,t,a,c,u),h.consume(t.events),n=-1;++n<t.events.length;){const p=t.events[n];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=WV(t.events,n))}return e}function cf(e,t,n,r,s,o){const i=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",l="tableContent";n[0]!==0&&(o.end=Object.assign({},Xl(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const a=Xl(t.events,n[1]);if(o={type:i,start:Object.assign({},a),end:Object.assign({},a)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const c=Xl(t.events,n[2]),u=Xl(t.events,n[3]),f={type:l,start:Object.assign({},c),end:Object.assign({},u)};if(e.add(n[2],0,[["enter",f,t]]),r!==2){const h=t.events[n[2]],p=t.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,y=n[3]-n[2]-1;e.add(m,y,[])}}e.add(n[3]+1,0,[["exit",f,t]])}return s!==void 0&&(o.end=Object.assign({},Xl(t.events,s)),e.add(s,0,[["exit",o,t]]),o=void 0),o}function jE(e,t,n,r,s){const o=[],i=Xl(t.events,n);s&&(s.end=Object.assign({},i),o.push(["exit",s,t])),r.end=Object.assign({},i),o.push(["exit",r,t]),e.add(n+1,0,o)}function Xl(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const qV={name:"tasklistCheck",tokenize:GV};function YV(){return{text:{91:qV}}}function GV(e,t,n){const r=this;return s;function s(a){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(a):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(a),e.exit("taskListCheckMarker"),o)}function o(a){return yt(a)?(e.enter("taskListCheckValueUnchecked"),e.consume(a),e.exit("taskListCheckValueUnchecked"),i):a===88||a===120?(e.enter("taskListCheckValueChecked"),e.consume(a),e.exit("taskListCheckValueChecked"),i):n(a)}function i(a){return a===93?(e.enter("taskListCheckMarker"),e.consume(a),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),l):n(a)}function l(a){return Be(a)?t(a):Ze(a)?e.check({tokenize:JV},t,n)(a):n(a)}}function JV(e,t,n){return st(e,r,"whitespace");function r(s){return s===null?n(s):t(s)}}function QV(e){return sO([vV(),OV(),FV(e),UV(),YV()])}const XV={};function ru(e){const t=this,n=e||XV,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),i=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(QV(n)),o.push(wV()),i.push(kV(n))}const ol=["default","acceptEdits","plan","auto","dontAsk","bypassPermissions"],Yi={default:"Manual",acceptEdits:"Accept edits",plan:"Plan",auto:"Auto",dontAsk:"Don't Ask",bypassPermissions:"Bypass Permissions",custom:"Custom"},ZV={default:"manual mode on",acceptEdits:"accept edits on",plan:"plan mode on",auto:"auto mode on",dontAsk:"don't ask on",bypassPermissions:"bypass permissions on",custom:"set by hand"},Gh={default:"Runs without asking: reads only.",acceptEdits:"Runs without asking: reads, file edits, and common filesystem commands like mkdir, mv and cp.",plan:"Runs without asking: reads, plus commands the classifier approves when auto mode is available.",auto:"Runs without asking: everything, with background safety checks.",dontAsk:"Runs without asking: only pre-approved tools. Nothing else is put in front of you, so nothing waits.",bypassPermissions:"Runs without asking: everything.",custom:"Set by hand in zero.config.json. The screen leaves it exactly as it found it."},Pk="A mode is only the starting point. Your own rules sit on top of it: an allow rule can let something through without asking, and your deny rules still apply. A few dangerous actions are never auto-approved, whatever you pick.",e8={default:"runs reads only",acceptEdits:"runs reads, edits and everyday file commands",plan:"runs reads, plans and approved commands",auto:"runs everything, with safety checks",dontAsk:"runs what is already approved, and never waits",bypassPermissions:"runs everything",custom:"set by hand"},$k={default:["manual","default"],acceptEdits:["accept-edits","acceptedits","accept","edits"],plan:["plan"],auto:["auto"],dontAsk:["dont-ask","dontask","deny"],bypassPermissions:["bypass-permissions","bypasspermissions","bypass","yolo"],custom:[]},t8={default:"/manual",acceptEdits:"/accept-edits",plan:"/plan",auto:"/auto",dontAsk:"/dont-ask",bypassPermissions:"/bypass-permissions",custom:"/custom"},n8="What this message runs without asking";function yy(e){if(!e.startsWith("/"))return null;const t=e.slice(1);return/\s/.test(t)?null:t.toLowerCase()}function r8(e){if(e===null)return[];if(e==="")return[...ol];const t=ol.filter(r=>{var s;return(s=$k[r][0])==null?void 0:s.startsWith(e)}),n=ol.filter(r=>!t.includes(r)&&$k[r].some(s=>s.startsWith(e)));return[...t,...n]}function s8(e){return e?ol.find(t=>$k[t].includes(e))??null:null}const wy=["default","acceptEdits","plan","auto"];function o8(e){if(!e)return"default";const t=wy.indexOf(e);return t<0?"default":wy[(t+1)%wy.length]}const i8="/clear",l8="whatever this project is already set to",JO=["clear","reset","project"];function a8(e,t){const n=r8(e);return!t||e===null?n:e===""?[...n,null]:JO.some(r=>r.startsWith(e))?[...n,null]:n}function c8(e){return!!e&&JO.includes(e)}const il=["read-only","auto","full-access"],ME="auto",QO={"read-only":{label:"Read only",sandbox:"read-only",approvalPolicy:"on-request",what:"Reads and searches. Writes nothing and runs nothing that changes anything."},auto:{label:"Auto",sandbox:"workspace-write",approvalPolicy:"on-request",approvalsReviewer:"auto_review",what:"Works inside the project folder. Asks before going outside it or onto the network."},"full-access":{label:"Full access",sandbox:"danger-full-access",approvalPolicy:"never",what:"Anything, anywhere on this Mac, without asking."}},fb={"read-only":"/read-only",auto:"/auto","full-access":"/full-access"},u8={"read-only":"reads and searches, writes nothing",auto:"works in the project folder, asks to leave it","full-access":"anything, anywhere, without asking"};function d8(e,t){if(e===null)return[];const n=il.filter(s=>fb[s].slice(1).startsWith(e.toLowerCase())),r=t&&"clear".startsWith(e.toLowerCase())?[null]:[];return[...n,...r]}const f8={"read-only":"read only on",auto:"auto on","full-access":"full access on"};function h8(e){const t=il.indexOf(e);return il[(t+1)%il.length]}function p8(e){return e?il.find(n=>fb[n]===`/${e}`)??null:null}function m8(e){return e.kind==="mode"?`mode:${e.mode??"clear"}`:e.kind==="codexMode"?`codex:${e.mode??"clear"}`:`cmd:${e.cmd.name}`}function g8(e,t,n,r=[]){if(e===null)return[];const o=[...n?r.filter(a=>!Sk("claude-code").some(c=>c.name===a||c.aliases.includes(a))).map(a=>({name:a,description:"Run this Claude Code command",menuDescription:null,whole:!0,argumentHint:"[arguments]",aliases:[]})):[],...Sk(n?"claude-code":"codex")].filter(a=>[a.name,...a.aliases].some(c=>c.startsWith(e.toLowerCase())));if(!n)return[...d8(e,t).map(c=>({kind:"codexMode",mode:c})),...o.map(c=>({kind:"command",cmd:c}))];const i=a8(e,t).map(a=>({kind:"mode",mode:a})),l=o.map(a=>({kind:"command",cmd:a}));return[...i,...l]}function y8(e){return e.kind==="command"?{typed:`/${e.cmd.name}`,says:f4(e.cmd)}:e.mode===null?{typed:i8,says:l8}:e.kind==="codexMode"?{typed:fb[e.mode],says:u8[e.mode]}:{typed:t8[e.mode],says:e8[e.mode]}}function w8(e){if(typeof e!="string")return null;const t=e.trim();return/^\/compact(?:\s|$)/i.test(t)?{name:"compact",valid:/^\/compact$/i.test(t)}:null}const zk=Object.freeze({running:"Compacting this conversation…",done:"Conversation compacted. You can continue this task.",failed:"Couldn’t compact this conversation. Try again.",busy:"Wait for the current response to finish and pause any active goal, then run /compact.",unavailable:"Compaction isn’t available with this Codex version.",missing:"This task doesn’t have a Codex conversation to compact yet.",invalid:"Run /compact on its own. Your draft has been kept."}),Fu=new Set;async function XO(e){let t;try{t=await q.compact(e)}catch{t={state:"failed",at:Date.now()}}for(const n of Fu)n(e,t);return t}async function k8(e,t){let n;for(const r of Fu)r(e,{state:"pending",text:"Running command…",at:Date.now()});try{n=await q.command({...e,text:t})}catch{n={state:"failed",text:"The command failed. Your draft has been kept.",at:Date.now()}}for(const r of Fu)r(e,n.state==="copy"?{...n,text:"Response ready to copy."}:n);return n}function x8({item:e,engine:t="codex"}){const[n,r]=w.useState(null);return w.useEffect(()=>{let s=!1,o;const i=(a,c)=>{a.id!==e.id||a.product!==e.product||s||(clearTimeout(o),r(c),c.state==="running"&&(o=setTimeout(l,500)))},l=async()=>{try{const a=await q.compactionStatus(e);a&&i(e,a)}catch{s||i(e,{state:"failed",at:Date.now()})}};return r(null),Fu.add(i),l(),()=>{s=!0,clearTimeout(o),Fu.delete(i)}},[e.product,e.id]),!n||n.name==="remote-control"&&n.state==="done"||n.state==="forward"?null:d.jsx("div",{className:"thread",children:d.jsxs("div",{className:"thread-block",role:n.state==="failed"?"alert":"status","aria-live":"polite",children:[d.jsx("div",{className:"thread-head",children:n.name?`/${n.name}`:t==="codex"?"Codex":"Claude Code"}),d.jsx("p",{style:{whiteSpace:"pre-wrap",overflowWrap:"anywhere"},children:n.text??zk[n.state]??zk.failed}),n.state==="failed"&&!n.text&&d.jsx("button",{type:"button",className:"compose-word",onClick:()=>void XO(e),children:"Try again"})]})})}const Ro=8,uf=8;function b8(e){let t=0,n=window.innerWidth;for(let r=e;r&&r!==document.body;r=r.parentElement){if(getComputedStyle(r).overflowX==="visible")continue;const s=r.getBoundingClientRect();t=Math.max(t,s.left),n=Math.min(n,s.right)}return{left:t,right:n}}function v8(e,t=window.innerHeight,n){var h;const r=e.style;r.top=r.bottom=r.maxHeight=r.overflowY=r.left=r.right="";const s=e.getBoundingClientRect(),o=(h=e.parentElement)==null?void 0:h.getBoundingClientRect();if(!o)return;const i=b8(e.parentElement);if(s.left<i.left+Ro||s.right>i.right-Ro){const p=Math.max(i.left+Ro,Math.min(s.left,i.right-Ro-s.width));r.left=`${Math.round(p-o.left)}px`,r.right="auto"}if(s.top>=Ro&&s.bottom<=t-Ro)return;const l=t-o.bottom-uf-Ro,a=o.top-uf-Ro,c=s.height,u=l>=c||a<c&&l>=a;u?(r.top=`calc(100% + ${uf}px)`,r.bottom="auto"):(r.top="auto",r.bottom=`calc(100% + ${uf}px)`);const f=Math.floor(u?l:a);c>f&&(r.maxHeight=`${Math.max(f,96)}px`,r.overflowY="auto")}function ud(e,t,n=[]){w.useLayoutEffect(()=>{var o;if(!t)return;const r=(o=e.current)==null?void 0:o.querySelector(":scope > .prio-menu, :scope > .when-menu");if(!r)return;const s=()=>v8(r);return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[t,...n])}const RE={runAt:0,repeat:null},_k=e=>e&&e[0].toUpperCase()+e.slice(1);function ZO(e,t="Starts now"){return e.repeat?_k(mo(e.repeat)):e.runAt?_k(S8(e.runAt)):t}function S8(e,t=Date.now()){const n=Math.round((e-t)/6e4);if(n<=0)return"Starts now";if(n<90)return`Starts in ${n} minutes`;const r=new Date(e),s=r.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}).toLowerCase().replace(/\s/g,"");return new Date(t).toDateString()===r.toDateString()?`Starts at ${s}`:`Starts ${r.toLocaleDateString(void 0,{weekday:"long"})} at ${s}`}const Zf=e=>new Date(e).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}).toUpperCase(),eI=e=>new Date(e).toLocaleString(void 0,{weekday:"short",hour:"numeric",minute:"2-digit"}).toUpperCase();function C8(e=Date.now()){const t=[{label:"Now",ts:0,hint:""},{label:"In 30 minutes",ts:e+18e5,hint:Zf(e+18e5)},{label:"In 4 hours",ts:e+144e5,hint:Zf(e+144e5)}],n=new Date(e);n.setHours(18,0,0,0),n.getTime()>e&&t.push({label:"This evening",ts:n.getTime(),hint:Zf(n.getTime())});const r=new Date(e+864e5);return r.setHours(8,0,0,0),t.push({label:"Tomorrow",ts:r.getTime(),hint:eI(r.getTime())}),t}function E8(e=Date.now()){const t=new Date(e).getDay(),n=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][t];return[{label:"Once",rule:null},{label:"Every morning at 8:00am",rule:{every:"day",at:"08:00"}},{label:"Every weekday at 9:00am",rule:{every:"weekday",at:"09:00"}},{label:`Every ${n} at 9:00am`,rule:{every:"week",on:t,at:"09:00"}}]}function N8(e,t=Date.now()){const n=(e??"").trim();if(!n)return null;const r=F0(n);if(r&&"rule"in r)return{runAt:0,repeat:r.rule};const s=vR(n,t);return s?{runAt:s.ts,repeat:null}:null}function T8(e,t=Date.now()){return e.repeat?mo(e.repeat):e.runAt?new Date(t).toDateString()===new Date(e.runAt).toDateString()?Zf(e.runAt):eI(e.runAt):"now"}function tI(e,t){const n=(t??"").trim().toLowerCase().replace(/\s+/g," ");if(!n)return!0;const r=e.toLowerCase();return r.startsWith(n)||r.split(" ").some((s,o)=>o>0&&s.startsWith(n))}function nI(e,t=Date.now()){const n=(e??"").trim().replace(/\s+/g," ");if(!n)return null;const r=N8(n,t);return r?{label:_k(n),hint:T8(r,t),value:r}:null}function rI(e,t){return t.some(n=>n.label.toLowerCase()===e.label.toLowerCase()||!!n.ts&&!!e.value.runAt&&Math.round(n.ts/6e4)===Math.round(e.value.runAt/6e4)||!!n.value.repeat&&!!e.value.repeat&&mo(n.value.repeat)===mo(e.value.repeat))}function OE(e,t){return e.repeat||t.repeat?!!e.repeat&&!!t.repeat&&mo(e.repeat)===mo(t.repeat):!0}function A8(e,t=Date.now()){const n=C8(t).filter(s=>tI(s.label,e)).map(s=>({label:s.label,hint:s.hint,ts:s.ts,value:{runAt:s.ts,repeat:null}})),r=nI(e,t);return!r||rI(r,n)?n:[{label:r.label,hint:r.hint,ts:null,value:r.value,typed:!0},...n]}function j8(e,t=Date.now(),n=!1){const r=E8(t).filter(o=>tI(o.label,e)).map(o=>({label:o.label,hint:"",ts:null,value:{runAt:0,repeat:o.rule}})),s=nI(e,t);return!s||rI(s,r)||n&&!s.value.repeat?r:[{label:s.label,hint:s.hint,ts:null,value:s.value,typed:!0},...r]}function sI({value:e,onChange:t,note:n,only:r,empty:s,onOpenChange:o}){const[i,l]=w.useState(!1);w.useEffect(()=>{o==null||o(i)},[i]);const a=r==="repeat",[c,u]=w.useState(a?"repeat":"start"),[f,h]=w.useState(""),p=w.useRef(null),m=w.useRef(null);ud(p,i,[c,f]),w.useEffect(()=>{if(!i)return;h(""),u(a||e.repeat?"repeat":"start");const R=$=>{var L;(L=p.current)!=null&&L.contains($.target)||l(!1)};return document.addEventListener("pointerdown",R),()=>document.removeEventListener("pointerdown",R)},[i]),w.useEffect(()=>{var R;i&&((R=m.current)==null||R.focus())},[i,c]);const y=R=>{t(R),l(!1)},x=!!n,k=R=>!!R.repeat&&x,v=c==="start"?A8(f):j8(f,Date.now(),a),b=!!f.trim()&&!v.length,E=()=>{if(!f.trim())return;const R=v.find($=>!k($.value));R&&y(R.value)},N=b&&d.jsx("span",{className:"when-row empty",children:d.jsx("span",{className:"when-row-label",children:a?"not a repeat":"not a time"})}),T=R=>d.jsxs("button",{type:"button",className:`when-row ${R.typed?"typed":""} ${!R.typed&&(R.ts===null?OE(R.value,e):!e.repeat&&e.runAt===R.ts)?"on":""} ${k(R.value)?"off":""}`,disabled:k(R.value),onClick:()=>y(R.value),children:[d.jsx("span",{className:"when-row-label",children:R.label}),d.jsx("span",{className:"when-row-hint",children:R.hint||(OE(R.value,e)&&R.value.repeat?"✓":"")})]},R.typed?"typed":R.label),A=R=>d.jsx("span",{className:"when-type-row",children:d.jsx("input",{ref:m,className:"when-type",value:f,placeholder:R,onChange:$=>h($.target.value),onKeyDown:$=>{$.stopPropagation(),$.key==="Escape"&&($.preventDefault(),l(!1)),$.key==="Enter"&&($.preventDefault(),E())}})});return d.jsxs("span",{className:"when-wrap",ref:p,children:[i&&d.jsx("span",{className:"when-menu",role:"dialog","aria-label":a?"How often this comes back":"When this runs",children:c==="start"?d.jsxs(d.Fragment,{children:[v.map(T),N,A("or type: in three hours, 9am, tomorrow"),d.jsx("span",{className:"when-sep"}),d.jsxs("button",{type:"button",className:"when-door",onClick:()=>{u("repeat"),h("")},children:[d.jsx("span",{className:"when-door-label",children:"Repeats…"}),d.jsx("span",{className:"when-door-arrow",children:"›"})]})]}):d.jsxs(d.Fragment,{children:[!a&&d.jsxs(d.Fragment,{children:[d.jsxs("button",{type:"button",className:"when-door back",onClick:()=>{u("start"),h("")},children:[d.jsx("span",{className:"when-door-arrow",children:"‹"}),d.jsx("span",{className:"when-door-label",children:"Starts"})]}),d.jsx("span",{className:"when-sep"})]}),n&&d.jsx("span",{className:"when-note",children:n}),v.map(T),N,A("or type: every friday at 5pm")]})}),d.jsx("button",{type:"button",className:`compose-word ${e.runAt||e.repeat?"set":""} ${i?"open":""}`,title:a?"How often this comes back":"When this runs","aria-haspopup":"dialog","aria-expanded":i,onClick:()=>l(R=>!R),children:ZO(e,s)})]})}const hb=Object.freeze([{id:"low",label:"Low"},{id:"medium",label:"Medium"},{id:"high",label:"High"},{id:"xhigh",label:"Extra"},{id:"max",label:"Max"}]);function oI(e){return typeof e=="string"&&hb.some(t=>t.id===e)}function bm(e){return typeof e=="string"&&/^[a-z][a-z0-9]{0,23}$/.test(e)}function M8(e){const t=hb.find(n=>n.id===e);return t?t.label:bm(e)?e.charAt(0).toUpperCase()+e.slice(1):null}const iI=hb.map(e=>({id:e.id,label:e.label}));function lI(e,t,{codexModels:n=[],codexDefault:r=null}={}){if(e!=="codex")return iI;const s=t??xi(e,r);if(s===Lu)return[];const o=n.find(i=>i.id===s);return((o==null?void 0:o.levels)??[]).filter(i=>bm(i)).map(i=>({id:i,label:M8(i)??i}))}function aI(e,t=iI){return!!e&&t.some(n=>n.id===e)}function R8(e,t,{codexModels:n=[],codexDefault:r=null}={}){var o,i;const s=t??xi(e,r);return e==="codex"?s===Lu?null:((o=n.find(l=>l.id===s))==null?void 0:o.defaultLevel)??null:((i=hR().find(l=>l.id===s))==null?void 0:i.defaultLevel)??null}function O8(e,t,n){return aI(e,t)?e:n&&t.some(r=>r.id===n)?n:null}const IE="zero.lastEffort";function Fk(e=null){return e==="codex"?`${IE}.codex`:IE}function ky(e=globalThis.localStorage,t=null){try{const n=e==null?void 0:e.getItem(Fk(t));return(t==="codex"?bm(n):oI(n))?n:null}catch{return null}}function I8(e,t=globalThis.localStorage,n=null){try{(n==="codex"?bm(e):oI(e))?t==null||t.setItem(Fk(n),e):t==null||t.removeItem(Fk(n))}catch{}}function cI({value:e,onChange:t,title:n,onOpenChange:r,engine:s=null,codexModels:o=[],codexDefault:i=null,effort:l=null,onEffortChange:a}){const[c,u]=w.useState(!1),[f,h]=w.useState(0),p=w.useRef(null),m=xi(s,i),y=pR(s,e,{codexModels:o,codexDefault:i}),x=a?lI(s,e,{codexModels:o,codexDefault:i}):[],k=O8(l,x,R8(s,e,{codexModels:o,codexDefault:i}));w.useEffect(()=>{r==null||r(c)},[c]),ud(p,c,[y.length,x.length]),w.useEffect(()=>{if(!c)return;h(Math.max(0,y.findIndex(E=>E.id===(e??m))));const b=E=>{var N;(N=p.current)!=null&&N.contains(E.target)||u(!1)};return document.addEventListener("pointerdown",b),()=>document.removeEventListener("pointerdown",b)},[c,e,s]);const v=b=>{t(b===m?null:b),u(!1)};return d.jsxs("span",{className:"compose-word-wrap",ref:p,children:[c&&d.jsxs("span",{className:"prio-menu model-menu",role:"listbox","aria-label":"Model",children:[y.map((b,E)=>d.jsx("button",{role:"option","aria-selected":b.id===(e??m),className:`prio-menu-row ${E===f?"cursor":""} ${b.id===(e??m)?"on":""}`,onPointerEnter:()=>h(E),onClick:()=>v(b.id),children:d.jsx("span",{className:"prio-menu-label",children:b.label})},b.id)),a&&x.length>0&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"model-menu-rule",role:"separator"}),d.jsx("span",{className:"effort-head",id:"effort-head",children:"Effort"}),d.jsx("span",{className:"effort-strip",role:"radiogroup","aria-labelledby":"effort-head",children:x.map(b=>d.jsx("button",{type:"button",role:"radio","aria-checked":b.id===k,className:b.id===k?"on":"",onClick:()=>a(b.id===l?null:b.id),children:b.label},b.id))})]})]}),d.jsx("button",{type:"button",className:`compose-word ${e?"set":""} ${c?"open":""}`,title:n??"Which model picks this up","aria-haspopup":"listbox","aria-expanded":c,onClick:()=>u(b=>!b),onKeyDown:b=>{if(!c){(b.key==="ArrowUp"||b.key==="ArrowDown"||b.key==="Enter"||b.key===" ")&&(b.preventDefault(),u(!0));return}b.key==="Escape"&&(b.preventDefault(),b.stopPropagation(),u(!1)),b.key==="ArrowDown"&&(b.preventDefault(),h(E=>(E+1)%y.length)),b.key==="ArrowUp"&&(b.preventDefault(),h(E=>(E-1+y.length)%y.length)),b.key==="Enter"&&(b.preventDefault(),y[f]&&v(y[f].id))},children:RF(s,e,{codexModels:o,codexDefault:i})})]})}const DE=e=>/\.(png|jpe?g|gif|webp)$/i.test(e);function D8(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>t(String(r.result).split(",")[1]??""),r.onerror=n,r.readAsDataURL(e)})}async function pb(e){var n,r,s,o,i,l,a,c;const t=[];for(const u of Array.from(e)){const f=((r=(n=window.zero)==null?void 0:n.pathForFile)==null?void 0:r.call(n,u))??null;if(f){const h=DE(u.name);let p=null;if(h)try{p=((i=await((o=(s=window.zero)==null?void 0:s.stageAttachment)==null?void 0:o.call(s,{name:u.name||"file",srcPath:f})))==null?void 0:i.path)??null}catch{p=null}t.push({name:u.name||"file",srcPath:p??f,image:h})}else{const h=u.name&&u.name!=="image.png"?u.name:`pasted-${Date.now()%1e5}.png`,p=u.type.startsWith("image/")||DE(h),m=await D8(u);let y=null;try{y=((c=await((a=(l=window.zero)==null?void 0:l.stageAttachment)==null?void 0:a.call(l,{name:h,dataBase64:m})))==null?void 0:c.path)??null}catch{y=null}t.push(y?{name:h,srcPath:y,image:p}:{name:h,dataBase64:m,image:p})}}return t}async function uI(e){var n;const t=[];for(const r of Array.from(((n=e.clipboardData)==null?void 0:n.items)??[]))if(r.kind==="file"){const s=r.getAsFile();s&&t.push(s)}return t.length?pb(t):[]}async function dI(e,t){var r;return!t.length||!((r=window.zero)!=null&&r.saveAttachments)?"":(await window.zero.saveAttachments({product:e,files:t.map(({name:s,dataBase64:o,srcPath:i})=>({name:s,dataBase64:o,srcPath:i}))})).map(s=>s.image?`![${s.name}](${s.rel})`:`[${s.name}](${s.rel})`).join(`
155
+ `)}const fI=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""),L8=`${z0}-doc`,hI=`${z0}-img`,P8=Object.freeze([L8,...cm.map(e=>`${fI(e)}-doc`)]),$8=Object.freeze([hI,...cm.map(e=>`${fI(e)}-img`)]),z8=Object.freeze([...P8,...$8]),_8=`${hI}://file`;function su(e){if(!e||!e.startsWith("/"))return e;const t=e.split("/").filter(Boolean).map(encodeURIComponent);return`${_8}/${t.join("/")}`}const LE=/^\s*([-*+•]|\d+[.)])\s/,F8=/[{}<>]|=>|&&|\|\||`|:\/\/|;\s*$|^\s*[$#>]\s|^\s*(const|let|var|function|class|def|import|export|return|if|for|while|echo|cd|npm|git|sudo)\b/,B8=/\S {2,}\S/,H8=.8,W8=40,PE=.2,U8=.4,V8=4;function pI(e){return e.split(`
156
+ `).filter(t=>t.trim().length>0)}function mI(e){const t=pI(e);if(t.length<2||t.filter(l=>/^[ \t]/.test(l)).length/t.length>U8||t.filter(l=>F8.test(l)).length/t.length>PE||t.filter(l=>B8.test(l)).length/t.length>PE||t.reduce((l,a)=>l+a.trim().split(/\s+/).length,0)/t.length<V8)return!1;const i=Math.max(...t.map(l=>l.length));return i<W8?!1:K8(e.split(`
157
+ `),i)>0}function gI(e,t,n){return!e.trim()||!t.trim()||LE.test(t)||/^[ \t]/.test(t)||LE.test(e)||/^[ \t]/.test(e)?!1:e.length>=n*H8}function K8(e,t){let n=0;for(let r=0;r<e.length-1;r+=1)gI(e[r],e[r+1],t)&&(n+=1);return n}function mb(e){if(!mI(e))return e;const t=pI(e),n=Math.max(...t.map(i=>i.length)),r=e.split(`
158
+ `),s=[];let o=null;for(const i of r){if(o!==null&&s.length&&gI(o,i,n)){const l=s[s.length-1];s[s.length-1]=`${l.replace(/\s+$/,"")} ${i.trim()}`}else s.push(i);o=i}return s.join(`
159
+ `)}const q8=new RegExp(`^(file|${z8.join("|")}):`,"i");function gb(e){var r,s,o;const t=((r=e==null?void 0:e.querySelector("code"))==null?void 0:r.className)??"",n=(o=(s=/language-([\w-]+)/.exec(t))==null?void 0:s[1])==null?void 0:o.toLowerCase();return!!n&&!["text","txt","plain","markdown","md","email"].includes(n)}function Y8(e){const t=(e==null?void 0:e.innerText)??"";return gb(e)?t:mb(t)}function G8(e){if(!e.complete||!e.naturalWidth)return null;try{const t=document.createElement("canvas");t.width=e.naturalWidth,t.height=e.naturalHeight;const n=t.getContext("2d");return n?(n.drawImage(e,0,0),t.toDataURL("image/png")):null}catch{return null}}function J8(e,t){Array.from(e.querySelectorAll("img")).forEach((r,s)=>{const o=t[s],i=o?G8(o):null;if(i){r.setAttribute("src",i),r.removeAttribute("crossorigin");return}const l=r.getAttribute("alt");r.replaceWith(l?document.createTextNode(l):document.createTextNode(""))});for(const r of Array.from(e.querySelectorAll("a"))){const s=r.getAttribute("href")??"";q8.test(s)&&r.replaceWith(document.createTextNode(r.textContent??""))}for(const r of Array.from(e.querySelectorAll("pre"))){if(gb(r))continue;const s=r.querySelector("code")??r,o=s.textContent??"";mI(o)&&(s.textContent=mb(o))}}function Q8(e,t){var h;if(!t||!e.clipboardData)return;const n=window.getSelection();if(!n||n.isCollapsed||n.rangeCount===0)return;const r=n.getRangeAt(0);if(!t.contains(r.commonAncestorContainer))return;const s=document.createElement("div");s.appendChild(r.cloneContents());const o=Array.from(t.querySelectorAll("img")).filter(p=>r.intersectsNode(p)),i=document.createDocumentFragment();for(;s.firstChild;)i.appendChild(s.firstChild);J8(i,o);const l=document.createElement("div");l.appendChild(i),e.clipboardData.setData("text/html",l.innerHTML);const a=r.commonAncestorContainer,c=((h=a.nodeType===1?a:a.parentElement)==null?void 0:h.closest("pre"))??null,u=n.toString(),f=c&&t.contains(c)&&!gb(c);e.clipboardData.setData("text/plain",f?mb(u):u),e.preventDefault()}const yb="png|jpe?g|gif|webp|svg|html?|pdf|md|markdown|csv|txt|json|ya?ml|sql|sh|css|jsx?|tsx?|mjs|cjs|py|rb|go|rs|toml|change",X8=new RegExp(String.raw`(?<![\w./:@-])(?:\.\/)?[\w-][\w./-]*\.(?:${yb})\b`,"gi"),Z8=new RegExp(String.raw`!?\[[^\]\n]*\]\(\s*([^)\s]+?)\s*(?:\s+"[^"]*")?\)`,"g"),e9=new RegExp(String.raw`(?<![\w.:@/-])/[\w-][\w./-]*\.(?:${yb})\b`,"gi"),t9=/^([a-z]+:|\/|#)/i;function wb(...e){const t=e[e.length-1],n=t&&typeof t=="object"?e.pop():null,r=String((n==null?void 0:n.dir)??"").replace(/\/+$/,""),s=[],o=new Set,i=l=>{if(!l)return;let a=l.replace(/^\.\//,"").trim();if(r&&a.startsWith(r+"/")&&(a=a.slice(r.length+1)),!a||t9.test(a)||!new RegExp(String.raw`\.(?:${yb})$`,"i").test(a))return;const c=a.toLowerCase();o.has(c)||(o.add(c),s.push(a))};for(const l of e){if(!l)continue;const a=String(l),c=[];for(const u of a.matchAll(Z8))c.push({at:u.index??0,path:u[1]});for(const u of a.matchAll(X8))c.push({at:u.index??0,path:u[0]});if(r)for(const u of a.matchAll(e9))c.push({at:u.index??0,path:u[0]});c.sort((u,f)=>u.at-f.at);for(const u of c)i(u.path)}return s}function n9(e){const t=e;if(!t||typeof t!="object"||!Array.isArray(t.files))return null;const n=t.files.length,r=Number(t.plus??0),s=Number(t.minus??0);return!Number.isFinite(r)||!Number.isFinite(s)||n<=0||r<=0&&s<=0?null:{files:n,plus:r,minus:s}}function $E(e){return Math.abs(e).toLocaleString("en-US")}function yI(e){const t=[];return e.plus>0&&t.push({sign:"+",text:`+${$E(e.plus)}`}),e.minus>0&&t.push({sign:"−",text:`−${$E(e.minus)}`}),t}function wI(e){return e.files===1?"1 file":`${e.files} files`}function r9(e){return`${yI(e).map(t=>t.text).join(" ")} in ${wI(e)}`}const kI=/(^|\/)(designs?|demos?)\/[^?#]*\.html?$/i,s9=/\.change$/i;function o9(e){return kI.test(String(e??"").split(/[?#]/)[0])}function i9(e){const t=String(e??"").split(/[?#]/)[0];return kI.test(t)||s9.test(t)}function l9(e,t=null){return wb(e.result,e.note,e.body,e.answer,{dir:t}).filter(o9)}const a9=new Set(["state.md","decisions.md","notes.md","instructions.md","memory.md","claude.md","readme.md"]);function xI(e){const t=String(e??"").split(/[?#]/)[0].split("/").pop()??"";return a9.has(t.toLowerCase())}function zE(e,t=[],n=null){const r=i=>i9(i)&&!xI(i),s=wb(e.result,e.note,e.body,e.answer,{dir:n}).filter(r),o=new Set(s.map(i=>i.toLowerCase()));return[...s,...t.filter(i=>r(i)&&!o.has(i.toLowerCase()))]}const c9="html?|pdf|png|jpe?g|gif|webp|svg|csv",_E=new RegExp(String.raw`(?<![\w./:@-])(?:\.\/)?[\w-][\w./-]*\.(?:${c9})\b`,"gi"),u9=/\.(png|jpe?g|gif|webp|svg)$/i,d9=new Set(["link","linkReference","image","imageReference","definition","inlineCode","code","html"]);function f9(e){const t=[];let n=0;_E.lastIndex=0;for(const r of e.matchAll(_E)){const s=r.index??0;s>n&&t.push({type:"text",value:e.slice(n,s)}),t.push(u9.test(r[0])?{type:"image",url:r[0],alt:r[0]}:{type:"link",url:r[0],children:[{type:"text",value:r[0]}]}),n=s+r[0].length}return t.length?(n<e.length&&t.push({type:"text",value:e.slice(n)}),t):[]}function bI(e){if(!e||!Array.isArray(e.children))return;const t=[];for(const n of e.children){if(n.type==="text"&&typeof n.value=="string"){const r=f9(n.value);if(r.length){t.push(...r);continue}t.push(n);continue}d9.has(n.type)||bI(n),t.push(n)}e.children=t}function h9(){return e=>{bI(e)}}const vi=e=>e??globalThis.localStorage;function kl(e){return`zero.draft.${e.product}:${e.id}`}function xl(e,t){return vi(t).getItem(kl(e))??""}function vm(e,t,n){const r=vi(n);t?r.setItem(kl(e),t):r.removeItem(kl(e))}function FE(e,t){const n=vi(t);n.removeItem(kl(e)),n.removeItem(ou(e))}function ou(e){return`zero.draftimg.${e.product}:${e.id}`}function Ha(e,t){const n=vi(t).getItem(ou(e));if(!n)return[];try{const r=JSON.parse(n);return Array.isArray(r)?r.filter(s=>s&&typeof s=="object"&&typeof s.name=="string"&&(s.dataBase64||s.srcPath)).map(s=>({name:s.name,dataBase64:s.dataBase64,srcPath:s.srcPath,image:!!s.image})):[]}catch{return[]}}function kb(e,t,n){const r=vi(n);let s=(t??[]).slice();const o=[],i=()=>{const l=s.map(a=>!!a.dataBase64).lastIndexOf(!0);return l<0?!1:(o.unshift(s[l]),s=s.filter((a,c)=>c!==l),!0)};for(;;){if(!s.length){try{r.removeItem(ou(e))}catch{}return{kept:s,dropped:o}}const l=JSON.stringify(s);if(l.length<=vI)try{return r.setItem(ou(e),l),{kept:s,dropped:o}}catch{}if(!i()){try{r.removeItem(ou(e))}catch{}return{kept:[],dropped:o}}}}function p9(e,t){return!!xl(e,t).trim()||Ha(e,t).length>0}function BE(e,t,n=[],r){const s=String(t??"").trim(),o=(n??[]).filter(i=>i&&!!i.name&&(!!i.dataBase64||!!i.srcPath));return!s&&!o.length||xl(e,r).trim()||Ha(e,r).length?!1:(s&&vm(e,s,r),o.length&&kb(e,o,r),!0)}function m9(e,t,n=[],r){const s=xl(e,r);vm(e,[s,t.trim()].filter(Boolean).join(`
160
+
161
+ `),r),kb(e,[...Ha(e,r),...n],r),typeof window<"u"&&window.dispatchEvent(new CustomEvent("zero:reply-restored",{detail:kl(e)}))}const iu="zero.draft.compose",vI=3e6,Pc={text:"",attachments:[],priority:null,when:{runAt:0,repeat:null},dropped:0},g9=e=>{if(!e||typeof e!="object")return null;const t=e,n=typeof t.name=="string"?t.name:"";if(!n)return null;const r=typeof t.dataBase64=="string"?t.dataBase64:void 0,s=typeof t.srcPath=="string"?t.srcPath:void 0;return!r&&!s?null:{name:n,...r?{dataBase64:r}:{},...s?{srcPath:s}:{},image:!!t.image}};function xb(e){let t=null;try{t=vi(e).getItem(iu)}catch{return{...Pc}}if(!t)return{...Pc};let n;try{n=JSON.parse(t)}catch{return{...Pc}}if(!n||typeof n!="object")return{...Pc};const r=n,s=r.when&&typeof r.when=="object"?r.when:{};return{text:typeof r.text=="string"?r.text:"",attachments:(Array.isArray(r.attachments)?r.attachments:[]).map(g9).filter(o=>!!o),priority:typeof r.priority=="string"?r.priority:null,when:{runAt:typeof s.runAt=="number"?s.runAt:0,repeat:s.repeat??null},dropped:typeof r.dropped=="number"&&r.dropped>0?r.dropped:0}}function Bk(e){return!e.text.trim()&&!e.attachments.length&&!e.priority&&!e.when.runAt&&!e.when.repeat}function SI(e,t){const n=vi(t);if(Bk(e)){try{n.removeItem(iu)}catch{}return{...Pc}}let r=e.attachments.slice(),s=0;const o=()=>{const l={...e,attachments:r,dropped:s},a=JSON.stringify(l);if(a.length>vI)return null;try{n.setItem(iu,a)}catch{return null}return l};for(;;){const l=o();if(l)return l;const a=r.map(c=>!!c.dataBase64).lastIndexOf(!0);if(a<0)break;r=r.filter((c,u)=>u!==a),s+=1}const i={...e,attachments:r,dropped:s};try{n.setItem(iu,JSON.stringify(i))}catch{return i}return i}function y9(e){try{vi(e).removeItem(iu)}catch{}}function w9(e,t){return!e||Bk(e)||!Bk(xb(t))?!1:(SI(e,t),!0)}const k9=100;function x9(e){return e.replace(/\s+/g," ").trim()}function b9(e,t){if(e.length<=t)return e;const n=e.slice(0,t),r=n.lastIndexOf(" ");return`${(r>t*.6?n.slice(0,r):n).trimEnd()}…`}function v9(e){const t=(e??[]).filter(r=>r&&r.name);if(!t.length)return"";const n=t.every(r=>r.image)?"image":"file";return`${t.length} ${n}${t.length===1?"":"s"}`}function S9(e,t=[],n,r=k9){const s=x9(String(e??"")),o=v9(t);return!s&&!o?{draft:!1,text:n?`Reply to ${n}…`:"Reply…",files:""}:s?{draft:!0,text:b9(s,r),files:o}:{draft:!0,text:o,files:""}}const Sm=.4,HE=3;function C9(e,t=Sm){const n=e.paneHeight*t-e.chromeHeight-e.padY;return Number.isFinite(n)?Math.max(HE,Math.floor(n/e.lineHeight)):HE}function CI(e,t=Sm){return C9(e,t)*e.lineHeight+e.padY}function E9(e,t=Sm){const n=Math.min(e.scrollHeight,CI(e,t));return Math.max(e.floor,n)}const Cc=e=>{const t=parseFloat(e);return Number.isFinite(t)?t:0};function N9(e){const t=getComputedStyle(e),n=Cc(t.lineHeight)||Cc(t.fontSize)*1.55||22,r=Cc(t.paddingTop)+Cc(t.paddingBottom),s=e.closest(".dock-card"),o=e.closest(".focus-pane"),i=(o==null?void 0:o.getBoundingClientRect().height)||window.innerHeight||0,l=s?Math.max(0,s.getBoundingClientRect().height-e.getBoundingClientRect().height):0;return{paneHeight:i,chromeHeight:l,lineHeight:n,padY:r,floor:Cc(t.minHeight),scrollHeight:e.scrollHeight}}function WE(e,t=Sm){if(!e)return;e.style.height="auto";const n=N9(e),r=E9(n,t);e.style.maxHeight=`${CI(n,t)}px`,e.style.height=`${r}px`}const T9=2500,UE=["wheel","touchstart","keydown","mousedown"],A9=700,j9="p, h1, h2, h3, h4, h5, h6, li, pre, blockquote, tr, img, iframe";function xy(e){if(typeof e.querySelectorAll!="function"||typeof e.getBoundingClientRect!="function")return null;const t=e.getBoundingClientRect().top,n=e.querySelectorAll(j9);let r=0,s=n.length-1,o=-1;for(;r<=s;){const l=r+s>>1;n[l].getBoundingClientRect().bottom>t?(o=l,s=l-1):r=l+1}if(o<0)return null;const i=n[o];return{node:i,offset:i.getBoundingClientRect().top-t}}function M9(e,t){if(!t.node.isConnected||!e.contains(t.node))return!1;const n=t.node.getBoundingClientRect().top-e.getBoundingClientRect().top,r=Math.max(0,Math.min(Cm(e),Math.round(e.scrollTop+n-t.offset)));return Math.round(e.scrollTop)!==r&&(e.scrollTop=r),!0}function by(e){var r;const t=e.clientWidth,n=(r=e.firstElementChild)==null?void 0:r.clientWidth;return typeof t=="number"?t*1e5+(typeof n=="number"?n:0):-1}function Cm(e){return Math.max(0,Math.round(e.scrollHeight-e.clientHeight))}function df(e){return Math.max(0,Cm(e)-Math.round(e.scrollTop))}const ff=24,VE=new WeakMap,Hk=e=>{const t=VE.get(e);if(t)return t;const n={live:0,placed:null};return VE.set(e,n),n};function R9(e,t={}){if(!e)return()=>{};const n=t.now??(()=>Date.now());let r=!0,s=!0,o=-1,i=!1,l=-1/0;const a=()=>n()-l<=A9;let c=by(e),u=null;const f=()=>{if(!r)return;if(Hk(e).live>0){i=!0,o=Math.round(e.scrollTop);return}i&&(i=!1,s=df(e)<=ff,o=Math.round(e.scrollTop));const b=by(e),E=b!==c;if(c=b,E&&!s){u&&M9(e,u)&&(o=Math.round(e.scrollTop),u=xy(e));return}if(!E&&a()&&o>=0&&Math.round(e.scrollTop)!==o&&(s=df(e)<=ff),!s){u=xy(e);return}const N=Cm(e);Math.round(e.scrollTop)!==N&&(e.scrollTop=N),o=N},h=()=>{if(r){if(by(e)!==c){f();return}a()&&Math.round(e.scrollTop)!==o&&(s=df(e)<=ff),s||(u=xy(e)),o=Math.round(e.scrollTop)}},p=globalThis.ResizeObserver,m=p?new p(()=>f()):null,y=()=>f(),x=()=>{l=n()};function k(){if(r){r=!1,m==null||m.disconnect(),e.removeEventListener("scroll",h),e.removeEventListener("load",y,!0);for(const b of UE)e.removeEventListener(b,x)}}e.addEventListener("scroll",h,{passive:!0}),e.addEventListener("load",y,!0);for(const b of UE)e.addEventListener(b,x,{passive:!0});m&&(m.observe(e),e.firstElementChild&&m.observe(e.firstElementChild));const v=Hk(e).placed;return v!==null&&Math.round(e.scrollTop)===v&&(s=df(e)<=ff,o=v),f(),k}function O9(e,t,n={}){if(!e||!(t>0))return()=>{};const r=n.now??(()=>Date.now()),s=n.window??T9,o=r();let i=!0;const l=Hk(e);l.live+=1,l.placed=null;const a=()=>{if(!i)return;const m=Math.min(t,Cm(e));Math.round(e.scrollTop)!==m&&(e.scrollTop=m),m>=t&&p()},c=["wheel","touchstart","keydown","mousedown"],u=globalThis.ResizeObserver,f=u?new u(()=>a()):null,h=setInterval(()=>{if(r()-o>=s){p();return}a()},100);function p(){if(i){i=!1,l.live=Math.max(0,l.live-1),l.placed=Math.round(e.scrollTop),f==null||f.disconnect(),clearInterval(h);for(const m of c)e.removeEventListener(m,p)}}for(const m of c)e.addEventListener(m,p,{passive:!0});return f&&(f.observe(e),e.firstElementChild&&f.observe(e.firstElementChild)),a(),p}function I9(e){return e.scrollHeight-e.clientHeight>1}function D9(e,t){return e===null?null:t?e:null}const L9=130;function P9(e){return/^\s*\d+[.)]\s/.test(e)||/^\s*[-*+]\s/.test(e)||/^!\[[^\]]*\]\([^)]*\)$/.test(e)||/^>/.test(e)||/^([-*_]\s*){3,}$/.test(e)}function $9(e){return e.replace(/!\[[^\]]*\]\([^)]*\)/g,"").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/[*_`#]/g,"").replace(/\s+/g," ").trim()}const z9=/where we were|^\s*gist\s*$/i;function EI(e){const t=e[hm(e)]??"",n=(e.title??"").replace(/…$/,"").trim();let r="";for(const s of t.split(`
162
+ `)){let o=s.trim();if(!o)continue;if(/^#{1,4}\s/.test(o)){r=o.replace(/^#{1,4}\s*/,"");continue}if(P9(o)||z9.test(r))continue;n&&o.startsWith(n)&&(o=o.slice(n.length).trim());const i=o.match(/^\*\*(.+?)\*\*/),l=$9(i?i[1]:o);if(l)return l}return""}function _9(e){return no(EI(e),L9)}function F9(e,t,n){return e?t.length>e.length?!0:!!n&&n.scrollHeight-n.clientHeight>1:!1}const KE={Bash:"ran",Read:"read",Write:"wrote",Edit:"edited",MultiEdit:"edited",NotebookEdit:"edited",Glob:"looked for",Grep:"searched for",WebFetch:"fetched",WebSearch:"searched the web for",Task:"sent off a helper",TodoWrite:"kept its list",ListAgents:"listed the other sessions",SendMessage:"messaged",ToolSearch:"looked up a tool",Skill:"used a skill",AskUserQuestion:"asked a question",BashOutput:"checked on a command",KillShell:"stopped a command",ExitPlanMode:"finished planning"};function B9(e){const t=String(e??"").trim();return t?KE[t]?KE[t]:(t.startsWith("mcp__")?t.slice(t.lastIndexOf("__")+2):t).replace(/_+/g," ").trim().toLowerCase()||"did something":"did something"}const qE=3;function H9(e,t="",n=""){const r=String(e??"").trim();if(!r)return"";if(!r.startsWith("/")&&!r.startsWith("~"))return r;let s=r;s=s.replace(/^\/private\/tmp\//,"/tmp/");const o=String(t??"").replace(/^\/private\/tmp\//,"/tmp/").replace(/\/+$/,"");if(o&&(s===o||s.startsWith(`${o}/`))){const l=s===o?"":s.slice(o.length+1);return l?YE(l):"./"}const i=String(n??"").replace(/\/+$/,"");return i&&s.startsWith(`${i}/`)&&(s=`~/${s.slice(i.length+1)}`),YE(s)}function YE(e){const t=e.startsWith("~/")?"~/":e.startsWith("/")?"/":"",r=e.slice(t.length).split("/").filter(Boolean);return r.length<=qE?t+r.join("/"):`…/${r.slice(-qE).join("/")}`}const W9=[/^cd\s+(?:"[^"]*"|'[^']*'|[^\s;&|]+)\s*(?:&&|;|\n)\s*/,/^export\s+[A-Za-z_][A-Za-z0-9_]*=(?:"[^"]*"|'[^']*'|[^\s;&]*)\s*(?:&&|;|\n)\s*/,/^[A-Za-z_][A-Za-z0-9_]*=(?:"[^"]*"|'[^']*'|[^\s;&]*)\s*(?:&&|;|\n)\s*/,/^(?:source|\.)\s+(?:"[^"]*"|'[^']*'|[^\s;&|]+)\s*(?:&&|;|\n)\s*/,/^echo\s+(?:"[^"]*(?:===|---)[^"]*"|'[^']*(?:===|---)[^']*')\s*(?:&&|;|\n)\s*/],U9=/<<-?\s*(['"]?)([A-Za-z_][A-Za-z0-9_]*)\1([\s\S]*)$/,V9=12;function K9(e,t){for(const n of String(e??"").split(`
163
+ `)){const r=n.trim();if(!(!r||r===t)&&!(r.startsWith("#")||r.startsWith("//")))return r}return""}function q9(e){let t=String(e??"").trim();if(!t)return"";const n=t;for(let s=0;s<6;s+=1){const o=t;for(const i of W9)t=t.replace(i,"");if(t===o)break}const r=t.match(U9);if(r){const s=t.slice(0,r.index).trim(),o=s.length<=V9?K9(r[3],r[2]):"";t=o?`${s} … ${o}`:`${s} …`}return t=t.replace(/\s+/g," ").trim(),t||n.replace(/\s+/g," ").trim()}const Y9=3;function G9(e,{min:t=Y9}={}){const n=[];let r=[];const s=()=>{r.length&&(r.length>=t?n.push({kind:"run",at:r[0].at??0,items:r}):n.push(...r),r=[])};for(const o of e??[]){if(o&&o.kind==="work"){r.push(o);continue}s(),n.push(o)}return s(),n}const J9=new Set(["ran","read","wrote","edited","looked for","searched for","fetched","messaged"]),GE=3;function Q9(e){const t=(e??[]).filter(Boolean);if(!t.length)return"";const n=new Map;for(const i of t)n.set(i.verb,(n.get(i.verb)??0)+1);const r=[...n.entries()].sort((i,l)=>l[1]-i[1]||i[0].localeCompare(l[0]));if(r.length===1&&J9.has(r[0][0]))return`${t.length} thing${t.length===1?"":"s"} it ${r[0][0]}`;const s=r.slice(0,GE).map(([i,l])=>l===1?i:`${i} ${l}`),o=r.slice(GE).reduce((i,[,l])=>i+l,0);return o&&s.push(`${o} more`),`${t.length} things it did · ${s.join(" · ")}`}function X9(e){const t=(e??[]).filter(n=>n&&n.failed).length;return t?`${t} failed`:""}const Z9=new Set(["Edit","Write","MultiEdit","NotebookEdit"]);function eK(e,t){if(!Z9.has(String(e??"")))return"";const n=t??{};return String(n.file_path??n.notebook_path??"").trim()}function tK(e,t){const n=String(t??"").trim().replace(/^\/private\/tmp\//,"/tmp/");if(!n)return null;let r=null;for(const s of e??[]){const o=String(s??"").trim();!o||!(o===n||n.endsWith(`/${o}`)||o.replace(/^\/private\/tmp\//,"/tmp/")===n)||(!r||o.length>r.length)&&(r=s)}return r}function Wa(e){return e.status==="waiting"}function bb(e){return Wa(e)&&e.waitingFor==="input needed"}function nK(e){return(e==null?void 0:e.waitingFor)==="permission prompt"}function Em(e){const t=(e==null?void 0:e.repliedAt)??0;return!t||!(e!=null&&e.status)||NI(e)?!1:!rK(e,t)}function rK(e,t){return((e==null?void 0:e.statusAt)??0)<=t?!1:(e==null?void 0:e.status)==="idle"||(e==null?void 0:e.status)==="waiting"}function hf(e){return e!=null&&e.sessionId?`session:${e.sessionId}`:`pid:${(e==null?void 0:e.pid)??0}:${(e==null?void 0:e.startedAt)??0}`}function sK(e,t=Date.now()){return((e==null?void 0:e.runAt)??0)>t}function NI(e){return((e==null?void 0:e.doneThrough)??0)>0}function vb(e){if(!Number.isFinite(e)||e<0)return"a moment";const t=Math.floor(e/864e5);if(t>=1)return`${t} day${t===1?"":"s"}`;const n=Math.floor(e/36e5);if(n>=1)return`${n} hour${n===1?"":"s"}`;const r=Math.max(1,Math.floor(e/6e4));return`${r} minute${r===1?"":"s"}`}function TI(e){const t=e.productName;return t||(e.cwd??"").split("/").filter(Boolean).pop()||"an unknown folder"}function AI(e){return String(e??"").replace(/```[\s\S]*?```/g," ").replace(/\[Image[^\]]*\]/g," ").replace(/[*_`#>]/g,"").replace(/\s+/g," ").replace(/ +([.,;:!?])/g,"$1").trim()}function Jh(e,t=180){const n=AI(e);if(!n)return"";if(n.length<=t)return n;const r=n.slice(0,t+1),s=Math.max(r.lastIndexOf(". "),r.lastIndexOf("? "),r.lastIndexOf("! "));return s>40?n.slice(0,s+1):`${n.slice(0,r.lastIndexOf(" ")>40?r.lastIndexOf(" "):t).trimEnd()}…`}function oK(e,t=180){return Jh(e.lastSaid,t)}function iK(e,t=320){const n=AI(e);if(!n)return"";if(n.length<=t)return n;const r=n.slice(-t),s=[r.indexOf(". "),r.indexOf("? "),r.indexOf("! ")].filter(l=>l>=0),o=s.length?Math.min(...s)+2:-1;return`…${(o>=0&&o<t-40?r.slice(o):r.slice(r.indexOf(" ")+1)).trim()}`}function lK(e,t){const n=Number(e==null?void 0:e.saidAt)||0;if(!n)return"**It stopped here:**";const r=Wk(n,t),s=Math.max(Number(e==null?void 0:e.repliedAt)||0,...jI(e).map(o=>Number(o==null?void 0:o.at)||0));return s&&s>n?`**It has not answered yet. It last spoke ${r}:**`:`**It answered ${r}:**`}function aK(e,t=180){return Jh(e.lastAsked,t)}function Sb(e){return String((e==null?void 0:e.about)??"").replace(/\s+/g," ").trim()}function cK(e,t=Date.now()){const n=Sb(e);return n?`${e.name}: ${n}`:bb(e)?`${e.name} is waiting for you`:Wa(e)?`${e.name} needs you where it is running`:Em(e)?`${e.name} is working on what you told it`:`${e.name} has been quiet for ${vb(t-(e.lastActiveAt??e.startedAt??t))}`}function jI(e){const t=((e==null?void 0:e.asked)??[]).filter(l=>l&&l.text),n=((e==null?void 0:e.spoke)??[]).filter(l=>l&&l.text);if(!n.length||!t.length)return t;const r=new Set(t.map(l=>l.text.replace(/\s+/g," ").trim())),s=[...t];for(const l of n){const a=String(l.text).replace(/\s+/g," ").trim();r.has(a)||(r.add(a),s.push({at:l.at,text:a}))}const[o,...i]=s;return i.sort((l,a)=>(l.at??0)-(a.at??0)),o?[o,...i]:[]}const uK=60;function dK(e){const t=e.filter(n=>n.text.length>=uK);return t.length?t:e}function Wk(e,t){if(!e)return"";const n=t-e;return n<0||n<9e4?"just now":`${vb(n)} ago`}function fK(e,t=Date.now()){const n=jI(e),r=iK(e.lastSaid),s=TI(e),o=[],[i,...l]=n;if(i){const c=Wk(i.at,t);o.push(`**You started it${c?` ${c}`:""} with:**
164
+
165
+ “${Jh(i.text,420)}”`)}else{const c=aK(e);c&&o.push(`**The last thing you told it:**
166
+
167
+ “${c}”`)}if(l.length){const c=dK(l).slice(-3),u=c.map(h=>{const p=Wk(h.at,t);return`- ${p?`${p}: `:""}“${Jh(h.text,260)}”`}),f=l.length>c.length?`, over ${l.length} more messages,`:"";o.push(`**Then${f} you said:**
168
+
169
+ ${u.join(`
170
+ `)}`)}r&&o.push(`${lK(e,t)}
171
+
172
+ “${r}”`);const a=(e.touched??[]).slice(-3);return o.push(a.length?`It is working in ${s}, in ${hK(a)}.`:`It is working in ${s}.`),`
173
+
174
+ ${o.join(`
175
+
176
+ `)}`}function hK(e){return e.length===1?e[0]:`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function pK(e,t=Date.now()){const n=vb(t-(e.lastActiveAt??e.startedAt??t)),r=cK(e,t),s=fK(e,t);return Em(e)?{title:r,body:`**You replied, and ${e.name} is working on it.**
177
+
178
+ It comes back to your inbox when it stops, whether it finishes or asks you something. Nothing here needs you meanwhile.${s}`}:bb(e)?{title:r,body:`**Reply to ${e.name}, which has been waiting ${n}.**
179
+
180
+ It finished what it was doing and stopped for an answer. Whatever you type here goes straight into it.${s}`}:Wa(e)?{title:r,body:`**Answer ${e.name} in its own window, not here.**
181
+
182
+ It is asking to approve something, and a message from ${Le} would wait behind that box instead of clearing it.${s}`}:{title:r,body:`**Close ${e.name} if you no longer need it here.**
183
+
184
+ It is asking for nothing and has done nothing for ${n}. Closing it takes it out of your inbox and leaves the session running.${s}`}}function mK(e,t=Date.now(),n="all"){return e.startedByZero||n==="off"||Em(e)||!Wa(e)&&!Sb(e)||n==="waiting"&&!Wa(e)?!1:!sK(e,t)&&!NI(e)}function gK(e,t=Date.now(),n="all"){return e.startedByZero||n==="off"?!1:Em(e)}function MI(e){return!e.startedByZero}const yK=24*60*60*1e3;function wK(e,t=Date.now()){if(!MI(e))return!1;const n=e.lastActiveAt||e.startedAt||0;return n>0&&t-n<=yK}function kK(e){return Sb(e)||oK(e)||"Has not said anything yet"}function xK(e,t){return(t.lastActiveAt??0)-(e.lastActiveAt??0)}const RI=3,bK=40;function vK(e){return e?`Show the ${e} message${e===1?"":"s"} in between`:""}const SK=20,CK=200;function EK(e){return e?`and ${e} more thing${e===1?"":"s"} it ran, not shown`:""}function JE(e,t){return!t||t<=e?"":`${t-e} more line${t-e===1?"":"s"} came back, not kept`}function NK(e,{opening:t=RI,keep:n=bK,whole:r=!1}={}){const s=(e??[]).filter(u=>u&&(u.kind==="work"?!0:!!u.text)),o=[];if(s.forEach((u,f)=>{u.kind!=="work"&&o.push(f)}),r||o.length<=n)return{events:QE(s),omitted:0};const i=o[t],l=o[o.length-(n-t)],a=s.slice(l);a.length&&a[0].kind!=="work"&&a[0].same&&(a[0]={...a[0],resumed:!0});const c=[...s.slice(0,i),...a];return{events:QE(c),omitted:o.length-n}}function TK(e,t,{opening:n=RI}={}){if(!t)return-1;let r=0;for(let s=0;s<((e==null?void 0:e.length)??0);s+=1)if(e[s].kind!=="work"&&(r+=1,r===n+1))return s-1;return((e==null?void 0:e.length)??0)-1}function QE(e,{run:t=SK,total:n=CK}={}){const r=[];let s=0,o=0;for(const c of e){if(c.kind!=="work"){o&&(r[r.length-1]={...r[r.length-1],more:o},o=0),s=0,r.push(c);continue}if(s+=1,s>t){o+=1;continue}r.push(c)}o&&(r[r.length-1]={...r[r.length-1],more:o});const i=r.filter(c=>c.kind==="work").length;if(i<=n)return r;let l=i-n;const a=[];for(const c of r){if(l&&c.kind==="work"&&!c.more){l-=1;continue}a.push(c)}return a}function XE(e){let t=0;for(const n of e??[])!n||n.kind==="work"||!n.text||n.same||(t+=1);return t}const AK=/<\/(?:antml:)?(?:result|invoke|parameter|function_calls)>|<(?:antml:)?parameter\s+name=/;function jK(e){const t=[];let n=0;for(;n<e.length;){if(e.startsWith("```",n)){const o=e.indexOf("```",n+3),i=o<0?e.length:o+3;t.push([n,i]),n=i;continue}if(e[n]==="`"){const o=e.indexOf("`",n+1),i=o<0?n+1:o+1;t.push([n,i]),n=i;continue}n+=1}const r=new RegExp(AK.source,"g");let s=r.exec(e);for(;s;){if(!t.some(([o,i])=>s.index>=o&&s.index<i))return s.index;s=r.exec(e)}return-1}function MK(e){if(typeof e!="string")return e;const t=jK(e);return t<0?e:e.slice(0,t).trimEnd()}function vy(e){const t=e==null?void 0:e.trim();return t&&t!=="(withdrawn)"?t:null}function ZE(e,t){var n,r;return((r=(n=e.wrote)==null?void 0:n[t])==null?void 0:r.ts)??e.updatedAt}function RK(e){var t,n;return e.status!=="done"?null:((n=(t=e.wrote)==null?void 0:t.status)==null?void 0:n.source)==="founder"?"founder":"agent"}function OK(e){var t;return RK(e)==="agent"&&!!((t=e.result)!=null&&t.trim())}function eN(e,t){const n=vy(e.answer);if(n)return{kind:"replied",text:n,at:ZE(e,"answer")};if(!t)return null;const r=vy(t.answer);return r?{kind:"said",text:r,at:ZE(t,"answer"),on:t.title}:t.kind==="directive"?{kind:"said",text:vy(t.body)??t.title,at:t.createdAt,on:t.title}:{kind:"origin",title:t.title,at:t.updatedAt}}const IK=e=>e.dataBase64?`data:image/png;base64,${e.dataBase64}`:e.srcPath?su(e.srcPath):"";function OI({attachments:e,onRemove:t}){return e.length?d.jsx("div",{className:"attach-row",children:e.map((n,r)=>n.image?d.jsxs("div",{className:"attach-thumb",title:n.name,children:[d.jsx("img",{src:IK(n),alt:n.name}),d.jsx("button",{className:"attach-remove",onClick:()=>t(r),children:"×"})]},r):d.jsxs("button",{className:"attach-chip",title:"Remove",onClick:()=>t(r),children:[n.name," ×"]},r))}):null}const Sy=44;function DK(e){const t=e.trim();if(t.length<=Sy)return t.replace(/[,;:.\s]+$/,"");const n=t.slice(0,Sy),r=n.lastIndexOf(" ");return`${(r>Sy/2?n.slice(0,r):n).replace(/[,;:.\s]+$/,"")}…`}function LK({title:e,onBack:t}){return d.jsxs("div",{className:"urgent-bar",children:[d.jsxs("button",{className:"urgent-return",onClick:t,children:[d.jsx("span",{className:"urgent-return-arrow",children:"←"})," Back to ",DK(e)]}),d.jsx("span",{className:"urgent-word",children:"Urgent"})]})}const PK={ran:"ran commands",read:"read files",wrote:"wrote files",edited:"edited files","searched for":"searched files","looked for":"looked for files",fetched:"read web pages"};function $K(e){if(!e.length)return"";const t=e.length===1?`${e[0].verb} ${e[0].subject||""}`.trim():[...new Set(e.map(n=>PK[n.verb]||n.verb))].join(", ");return t.charAt(0).toUpperCase()+t.slice(1)}function Nm(e){(e.key==="Enter"||e.key===" ")&&e.stopPropagation()}function zK(e){let t=0;return e.forEach((n,r)=>{n.kind!=="work"&&(t=r+1)}),e.slice(t).filter(n=>n.kind==="work")}function _K(e,t){const n=[...e],r=s=>s.replace(/\s+/g," ").trim();for(const s of t)for(let o=n.length-1;o>=0;o--){const i=n[o];if(!(i.at!=null&&s.startedAt!=null&&i.at<s.startedAt-1e3)&&r(i.full||i.subject||"")===r(s.detail)){n.splice(o,1);break}}return n}function FK(e,t=-1){let n=null;return e.map((r,s)=>{if(s>0&&s-1===t&&(n=null),r.kind==="run"||r.kind==="work")return!1;const o=r.who==="you"&&n!=="you"&&s>0;return n=r.who??null,o})}function BK(e,t=-1){const n=r=>r.kind!=="run"&&r.kind!=="work";return e.map((r,s)=>{if(!n(r)||r.who!=="you")return!1;for(let o=s+1;o<e.length;o++){if(o-1===t)return!0;if(n(e[o]))return e[o].who!=="you"}return s<e.length-1})}function Mn(e){const t=typeof e=="string"?e.trim():"";return t&&t!=="(withdrawn)"?t:null}function Bs(e,t){return!!e&&Object.prototype.hasOwnProperty.call(e,t)}function HK(e){const t=new Date(e),n=t.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});return`${t.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"})}, ${n}`}function WK(e,t){const n=[];let r=null,s=!0,o=!1;const i=(t??Ft)===Ft;let l=!1;for(const a of e){const c=a.patch??null,u=a.source==="founder",f=u?"you":"agent",h=a.ts;if(!(a.heartbeat||a.release)){if(a.claim){n.push({at:h,who:"agent",said:"An agent picked it up",pickup:!0});continue}if(s&&Bs(c,"title")){s=!1,r=String(c.title??""),Mn(c.body)&&(o=!0),n.push({at:h,who:f,said:u?"You opened this":"An agent opened this",...Mn(c.body)?{words:Mn(c.body),message:!0,field:"body"}:{}});continue}if(!(!c||!Object.keys(c).length)){if(!o&&Mn(c.body)&&!Bs(c,"answer")&&!Mn(c.result)&&!Mn(c.note)){o=!0,Bs(c,"title")&&(r=String(c.title??"")),n.push({at:h,who:f,said:u?"You opened this":"An agent opened this",words:Mn(c.body),message:!0,field:"body"});continue}if(o&&Mn(c.body)&&!Bs(c,"answer")&&!Mn(c.result)&&!Mn(c.note)){const p=n.findIndex(m=>m.field==="body");if(p>=0&&n[p].who===f){const m=Mn(c.body);n[p].words!==m&&(n[p]={...n[p],words:m})}if(!Bs(c,"title"))continue}if(Bs(c,"answer")){const p=Mn(c.answer);l=i&&!!p&&yR(p)!==null,n.push(p?{at:h,who:"you",said:"You replied",words:p,message:!0,field:"answer"}:{at:h,who:"you",said:"You withdrew your reply"});continue}if(Mn(c.result)){n.push({at:h,who:"agent",said:"It came back to you",words:Mn(c.result),message:!0,field:"result"});continue}if(Mn(c.note)){n.push({at:h,who:"agent",said:"It checked in",words:Mn(c.note),message:!0,field:"note"});continue}if(Bs(c,"title")){const p=r;r=String(c.title??""),n.push({at:h,who:f,said:u?"You renamed it":"It renamed itself",...p?{words:`was "${p}"`}:{}});continue}if(Bs(c,"runAt")){const p=Number(c.runAt)||0;p?n.push({at:h,who:f,said:u?"You put it off":"It paused this",words:`until ${HK(p)}`}):n.push({at:h,who:f,said:u?"You brought it back":"It let this run now"});continue}if(Bs(c,"status")){const p=String(c.status??"");if(p==="claimed")continue;if(p==="done"){n.push({at:h,who:f,said:u?"You marked it done":"It closed this"});continue}if(p==="blocked"){n.push({at:h,who:"agent",said:l?"It answered you":"It stopped and asked you"}),l=!1;continue}if(p==="open"){n.push({at:h,who:f,said:u?"You sent it back":"It handed this back"});continue}}}}}return n}function UK(e,t){const n=e.filter(l=>l.pickup),r=[...t].filter(l=>l&&l.text).sort((l,a)=>l.startedAt-a.startedAt);if(!n.length||!r.length)return e;const s=r.map(()=>!1),o=new Map;for(const l of n)for(let a=r.length-1;a>=0;a-=1)if(!(s[a]||r[a].startedAt>l.at)){s[a]=!0,o.set(l,[r[a]]);break}const i=r.filter((l,a)=>!s[a]);if(i.length){const l=[...i,...o.get(n[0])??[]].sort((a,c)=>a.startedAt-c.startedAt);o.set(n[0],l)}return e.map(l=>{const a=o.get(l);if(!(a!=null&&a.length))return l;const c=a.map(u=>p3([u])).filter(u=>!!u);return c.length?{...l,runs:c}:l})}function VK(e,t=Date.now()){const n=Math.floor((tN(t)-tN(e))/864e5);return n===0?"Today":n===1?"Yesterday":new Date(e).toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric"})}function KK(e){return new Date(e).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}).replace(/\s?([AP])M/i,(t,n)=>n.toLowerCase()+"m")}function tN(e){const t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}const qK=6;function II({events:e,omitted:t=0,onWhole:n,onOpenOrigin:r,name:s,landOn:o,md:i,code:l}){const[a,c]=w.useState(new Map),[u,f]=w.useState(new Set),h=w.useRef(null);w.useEffect(()=>{c(new Map),f(new Set)},[o]),w.useEffect(()=>{var T;const N=(T=h.current)==null?void 0:T.closest(".focus-scroll");return R9(N)},[o]);const p=TK(e,t),m=w.useRef(null),y=()=>{var N;return(N=h.current)==null?void 0:N.closest(".focus-scroll")},x=()=>{const N=y();m.current=N?N.scrollHeight-N.scrollTop:null,n()};w.useLayoutEffect(()=>{const N=m.current;if(N===null)return;m.current=null;const T=y();T&&(T.scrollTop=Math.max(0,T.scrollHeight-N))},[e]);const k=G9(e.map((N,T)=>({...N,i:T})),{min:1}),v=k.findIndex(N=>{var T;return(N.kind==="run"?(T=N.items[N.items.length-1])==null?void 0:T.i:N.i)===p}),b=FK(k,v),E=BK(k,v);return d.jsxs("div",{className:"thread",children:[k.map((N,T)=>{var _,j;const A=N.kind==="run"?((_=N.items[0])==null?void 0:_.i)??-1:N.i,R=N.kind==="run"?((j=N.items[N.items.length-1])==null?void 0:j.i)??-1:N.i,$=(F,ae)=>c(G=>{const I=new Map(G);return ae===eo?I.delete(F):I.set(F,ae),I}),L=N.kind==="run"?"is-run":N.kind==="work"?"is-work":N.same?"is-msg-same":"is-msg";return d.jsxs("div",{className:`thread-block ${L} ${R===p?"has-gap":""}`,children:[N.kind==="run"?d.jsx(GK,{items:N.items,open:u.has(A),onToggle:()=>f(F=>{const ae=new Set(F);return ae.has(A)?ae.delete(A):ae.add(A),ae}),lineState:F=>a.get(F)??eo,onStepLine:$,code:l}):N.kind==="work"?d.jsx(PI,{work:N,state:a.get(A)??eo,onStep:F=>$(A,F),code:l}):d.jsxs("div",{className:`msg ${N.who==="you"?"yours":""} ${b[T]?"turn":""} ${E[T]?"turn-end":""}${N.same&&!N.resumed?"same":""} ${N.pending?"sending":""}`,children:[(!N.same||N.resumed)&&d.jsxs("div",{className:"msg-head",children:[d.jsx("span",{className:"msg-who",children:N.who==="you"?"You":s}),N.pending?d.jsx("span",{className:"msg-when msg-sending",children:N.held?"Sending… press Z to undo":"Sending…"}):d.jsx("span",{className:"msg-when",children:JK(N.at)}),N.on&&d.jsxs("button",{type:"button",className:"msg-on",onClick:r,children:["on ",N.on]})]}),d.jsx("div",{className:"msg-body",children:i(N.text??"")})]}),R===p&&d.jsx("button",{type:"button",className:"thread-gap",onClick:x,children:vK(t)})]},`${N.at}-${A}-${T}`)}),d.jsx("div",{ref:h})]})}const YK=[{who:"them",lines:[96,88,61]},{work:54},{work:38},{who:"you",lines:[72]},{who:"them",lines:[93,84,90,47]},{work:46},{who:"them",lines:[88,71]},{work:61},{who:"them",lines:[91,86,94,79,52]},{who:"you",lines:[83,44]},{who:"them",lines:[90,76,58]}];function DI({head:e}){return d.jsxs("div",{className:"thread thread-waiting","aria-busy":"true",children:[d.jsx("div",{className:"thread-head",children:e}),YK.map((t,n)=>"work"in t?d.jsx("div",{className:"sk-did",style:{width:`${t.work}%`}},n):d.jsxs("div",{className:`sk-msg ${t.who==="you"?"yours":""}`,children:[d.jsx("div",{className:"sk-name"}),t.lines.map((r,s)=>d.jsx("div",{className:"sk-line",style:{width:`${r}%`}},s))]},n))]})}const LI=d.jsx("svg",{viewBox:"0 0 8 8",width:"8",height:"8","aria-hidden":"true",focusable:"false",children:d.jsx("path",{d:"M2.6 1.2 L5.6 4 L2.6 6.8",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})});function GK({items:e,open:t,onToggle:n,lineState:r,onStepLine:s,code:o}){const i=X9(e);return d.jsxs("div",{className:`did-run ${t?"open":""}`,children:[d.jsxs("button",{className:"did-head did-run-head",onKeyDown:Nm,"aria-expanded":t,title:Q9(e),onClick:n,children:[d.jsx("span",{className:"did-run-mark",children:LI}),d.jsx("span",{className:"did-verb",children:$K(e)}),!!i&&d.jsx("span",{className:"did-run-bad",children:i})]}),t&&d.jsx("div",{className:"did-run-body",children:e.map(l=>d.jsx(PI,{work:l,state:r(l.i),onStep:a=>s(l.i,a),code:o},l.i))})]})}const eo=0,nN=1,Cy=2;function PI({work:e,state:t,onStep:n,code:r}){const s=(e.output??"").split(`
185
+ `).filter((m,y,x)=>!(y===x.length-1&&m==="")),o=w.useRef(null),[i,l]=w.useState(!1);w.useLayoutEffect(()=>{const m=o.current;if(!m){l(!1);return}const y=()=>l(m.scrollWidth>m.clientWidth+1);y();const x=new ResizeObserver(y);return x.observe(m),()=>x.disconnect()},[e.subject]);const a=s.length>0||!!e.full||i,c=e.full||(i?e.subject:""),u=t===Cy?s:s.slice(0,qK),f=s.length-u.length,h=r&&e.file?tK(r.paths,e.file):null,p=a&&t===eo&&e.lines>1?d.jsxs("span",{className:"did-note",children:[e.lines," lines"]}):null;return d.jsxs("div",{className:`did ${e.failed?"bad":""} ${t!==eo?"open":""}`,children:[d.jsxs("div",{className:"did-line",children:[d.jsxs("button",{className:"did-head",onKeyDown:Nm,onClick:()=>n(t===eo?nN:eo),disabled:!a,children:[a&&d.jsx("span",{className:"did-mark",children:LI}),d.jsx("span",{className:"did-verb",children:e.verb}),e.subject&&!h&&d.jsx("code",{className:"did-cmd",ref:o,children:e.subject}),!h&&p]}),h&&d.jsxs("button",{type:"button",className:"did-file",title:`Open ${h} in the code`,onClick:()=>r.open(h),children:[d.jsx("span",{className:"did-file-mark","aria-hidden":"true"}),d.jsx("code",{className:"did-cmd",ref:h?o:void 0,children:e.subject||h})]}),h&&p]}),t!==eo&&!!c&&d.jsx("pre",{className:"did-full",children:c}),t!==eo&&s.length>0&&d.jsx("pre",{className:"did-out",children:u.join(`
186
+ `)}),t===nN&&f>0&&d.jsxs("button",{className:"did-more",onClick:()=>n(Cy),children:["show all ",s.length," lines"]}),t===Cy&&!!JE(s.length,e.lines)&&d.jsx("div",{className:"did-cut",children:JE(s.length,e.lines)}),!!e.more&&d.jsx("div",{className:"did-cut",children:EK(e.more)})]})}function JK(e){return e?`${VK(e)} ${KK(e)}`:""}function QK({pid:e,sessionId:t,cwd:n,name:r,movedAt:s,md:o}){const[i,l]=w.useState(null),[a,c]=w.useState(!1);w.useEffect(()=>{c(!1)},[e,t,n]);const u=w.useRef(null),f=`${e}|${t??""}|${n}`;return w.useEffect(()=>{let h=!0;return u.current!==f&&(l(null),u.current=f),q.agentConversation({pid:e,sessionId:t,cwd:n,whole:a}).then(p=>{h&&l(p!=null&&p.ok?{events:p.turns??[],omitted:p.omitted??0,total:p.total??0}:{events:[],omitted:0,total:0,error:(p==null?void 0:p.reason)??"That conversation could not be read."})}).catch(p=>{h&&l({events:[],omitted:0,total:0,error:String((p==null?void 0:p.message)??p)})}),()=>{h=!1}},[e,t,n,s,a]),i?i.error?d.jsx("div",{className:"thread-wait",children:i.error}):i.events.length?d.jsx(II,{events:i.events,omitted:i.omitted,onWhole:()=>c(!0),name:r,landOn:`${t??e}`,md:o}):d.jsx("div",{className:"thread-wait",children:"Nothing has been said in this session yet."}):d.jsx(DI,{head:`Reading the conversation with ${r}…`})}const XK=[0,1,2,7,null,3,6,5,4];function ZK({still:e=!1}){return d.jsx("span",{className:`live-mark ${e?"is-still":""}`,"aria-hidden":"true",children:XK.map((t,n)=>d.jsx("span",{className:"live-lattice-cell","data-hole":t===null||void 0,style:t===null?void 0:{animationDelay:`${t*186-1488}ms`}},n))})}const e7=/^(\d\d):(\d\d):(\d\d) {2}(.*)$/,t7=/^# exited \((-?\d+)\)/;function n7(e,t,n,r){const s=new Date(Wh(e,t,n,r));return`${s.getHours()%12===0?12:s.getHours()%12}:${String(s.getMinutes()).padStart(2,"0")}:${String(s.getSeconds()).padStart(2,"0")}`}function r7(e){const t=e.replace(/\s+/g," ").trim();return t.length<=300?t:`${t.slice(0,300).trim()}…`}function wa(e){return e.replace(/[^\S\n]+$/gm,"").replace(/\n{3,}/g,`
187
+
188
+ `).trim()}function s7(e){const t=[];let n=!1,r=!1,s=0;for(const o of((e==null?void 0:e.text)??"").split(`
189
+ `)){const i=e7.exec(o);if(!i){if(t7.test(o)){r=!0,n=!1;continue}if(o.startsWith("#")||n||r)continue;const f=t[t.length-1];if(!f||f.kind!=="say")continue;if(!o.trim()){s+=1;continue}f.text=wa(`${f.text}${s?`
190
+
191
+ `:`
192
+ `}${o}`),s=0;continue}s=0;const l=i[4],a=Wh(e.startedAt,Number(i[1]),Number(i[2]),Number(i[3])),c=n7(e.startedAt,Number(i[1]),Number(i[2]),Number(i[3]));if(l.startsWith("== RESULT")){n=!0;continue}if(n=!1,l.startsWith("stderr:")||!l.trim())continue;const u=l.startsWith("[")?"tool":"say";t.push({time:c,at:a,kind:u,text:u==="tool"?r7(l):wa(l)})}return t}const o7=/^\[([^\]]+)\]\s*(.*)$/;function rN(e,t,n){const r=t==="Bash"?q9(n):H9(n);return{kind:"work",at:e,verb:B9(t),subject:r,...eK(t,{file_path:n.trim()})?{file:n.trim()}:{},...r&&r!==n.trim()?{full:n.trim()}:{},output:"",lines:0,failed:!1}}function Uk(e){const t=[];for(const n of s7(e)){if(n.kind==="tool"){const r=o7.exec(n.text);t.push(r?rN(n.at,r[1],r[2]):rN(n.at,"",n.text));continue}t.push({at:n.at,who:"it",text:n.text})}return t}function sN(e){return{kind:"work",at:e.at,verb:e.said,subject:e.words??"",output:"",lines:0,failed:!1}}const Ua=e=>e.replace(/\s+/g," ").trim().toLowerCase();function Qh(e){const t=(e.split(`
193
+ `).find(n=>n.trim())??"").trim();return Ua(t.replace(/\*\*/g,"")).replace(/[.?!:]+$/,"")}const Vk=40;function $I(e){const t=e.split(`
194
+ `),n=t.findIndex(s=>s.trim());if(n<0)return null;const r=t.slice(n+1).join(`
195
+ `).replace(/^\s+/,"");return r.trim()?r:null}function Kk(e){return e.kind!=="work"&&!!(e.text??"").trim()}function oN(e,t){if(Qh(e)===Qh(t))return!0;const n=Ua(e),r=$I(t);return!n||!r||n.length<Vk?!1:Ua(r).replace(n,"").trim()===""}function i7(e){const t=new Set,n=new Map;return e.forEach((r,s)=>{if(!Kk(r.node))return;if(r.node.who==="you"){n.clear();return}if(!r.answer)return;const o=`${r.answer.field}
196
+ ${Ua(r.answer.text)}`,i=n.get(o);i!==void 0&&t.add(i),n.set(o,s)}),t}function l7(e){const t=new Map;e.forEach((o,i)=>{o.run!==null&&Kk(o.node)&&t.set(o.run,i)});const n=i7(e),r=new Map;let s=-1;for(let o=0;o<e.length;o+=1){const i=e[o];if(!Kk(i.node)||n.has(o))continue;const l=s>=0?e[s]:null;if(!l||l.node.who!=="it"||i.node.who!=="it"){s=o;continue}const a=Ua(l.node.text??""),c=Ua(i.node.text??"");if(!a||!c){s=o;continue}if(a===c){l.answer&&!i.answer?n.add(o):(n.add(s),s=o);continue}const u=i.run!==null&&t.get(i.run)===o&&!!l.answer,f=l.run!==null&&t.get(l.run)===s&&!!i.answer;if(u&&oN(l.node.text??"",i.node.text??"")){n.add(o);continue}if(f&&oN(i.node.text??"",l.node.text??"")){n.add(s),s=o;continue}if(c.includes(a)&&a.length>=Vk){n.add(s),s=o;continue}if(a.includes(c)&&c.length>=Vk){n.add(o);continue}if(Qh(l.node.text??"")!==Qh(i.node.text??"")){s=o;continue}const h=$I(i.node.text??"");h&&r.set(o,h),s=o}return e.map((o,i)=>{const l=r.get(i);return l?{...o,node:{...o.node,text:l}}:o}).filter((o,i)=>!n.has(i))}function a7(e,t,n,r={}){const s=UK(WK(e,r.engine),t),o=[];let i=-1,l=null;const a=[];if(!s.some(k=>k.pickup)){for(const k of t)if(k!=null&&k.text)for(const v of Uk(k))a.push({node:v,run:k.startedAt,answer:null})}for(const k of s){if(k.pickup){const v=k.runs??[];if(!v.length){a.push({node:sN(k),run:null,answer:null});continue}for(const b of v)for(const E of Uk({startedAt:b.startedAt,text:b.raw}))a.push({node:E,run:b.startedAt,answer:null});continue}if(k.message&&k.words){const v=k.who==="agent"&&(k.field==="result"||k.field==="note");a.push({node:{at:k.at,who:k.who==="you"?"you":"it",text:k.words},run:null,answer:v?{at:k.at,text:k.words,field:k.field}:null});continue}a.push({node:sN(k),run:null,answer:null})}if(n!=null&&n.text){const k=wa(n.text),v=a.some(b=>b.node.kind!=="work"&&b.node.who==="it"&&wa(b.node.text??"")===k);k&&!v&&a.push({node:{at:n.at,who:"it",text:k},run:n.run,answer:null})}const c=new Set;for(const k of[...r.pending??[]].sort((v,b)=>v.at-b.at)){const v=wa(k.text);if(!v)continue;const b=a.find(E=>!c.has(E)&&E.node.kind!=="work"&&E.node.who==="you"&&(E.node.at??0)>=k.at&&wa(E.node.text??"")===v);if(b){c.add(b);continue}a.push({node:{at:k.at,who:"you",text:k.text,pending:!0,held:k.held},run:null,answer:null})}const u=a.map(k=>{if(k.node.kind==="work")return k;const v=MK(k.node.text??"");return v===(k.node.text??"")?k:{...k,node:{...k.node,text:v},answer:k.answer?{...k.answer,text:v}:null}});u.sort((k,v)=>(k.node.at??0)-(v.node.at??0));const f=l7(u);let h;for(const k of f){if(k.node.kind==="work"){o.push(k.node);continue}const v=k.run!==null&&k.run===h;h=k.run,i=o.length,k.answer?l={i:o.length,...k.answer}:k.run===null&&(l=null),o.push(v?{...k.node,same:!0}:k.node)}const p=l&&l.i===i?{at:l.at,text:l.text,field:l.field}:null,m=XE(o);p&&o.splice(l.i,1);const y=NK(o,{whole:!!r.whole}),x=XE(y.events)+(p?1:0);return{events:y.events,outcome:p,total:m,omitted:m-x}}const c7=15e3;function u7({item:e,facts:t}){var N,T,A,R,$,L;const[n,r]=w.useState(!1),s=w.useId(),[o,i]=w.useState([]),[l,a]=w.useState(!1);w.useEffect(()=>{if(i([]),a(!1),!n||!t.session)return;let _=!0;const j=()=>q.sessionTrace({product:e.product,id:e.id}).then(G=>{if(!_)return;const I=((G==null?void 0:G.sessions)??[]).at(-1);i(I?zK(Uk(I)).filter(ne=>ne.kind==="work"):[]),a(!1)}).catch(()=>{_&&a(!0)});j();const F=q.onChanged(j),ae=setInterval(j,8e3);return()=>{_=!1,F(),clearInterval(ae)}},[n,e.id,e.product,(N=t.session)==null?void 0:N.startedAt]),w.useEffect(()=>r(!1),[e.id,e.product,(T=t.session)==null?void 0:T.startedAt]);const[c,u]=w.useState(()=>Date.now()),f=!!t.session||!!((A=t.silent)!=null&&A.endedAt);w.useEffect(()=>{if(!f)return;const _=setInterval(()=>u(Date.now()),c7);return()=>clearInterval(_)},[f]);const h=DR(e,{...t,now:c});if(!h)return null;const p=h.state==="working",m=t.session?yk(Math.max(0,c-t.session.startedAt)):h.state==="silent"&&((R=t.silent)!=null&&R.endedAt)?yk(Math.max(0,c-t.silent.endedAt)):null,y=(($=t.session)==null?void 0:$.activity)??[],x=y[y.length-1],k=p?(x==null?void 0:x.label)||"Thinking":OR(h.state,((L=t.session)==null?void 0:L.helpers)??0),v=_K(o,y),b=v.slice(-5),E=v.length-b.length;return d.jsxs("div",{className:"live-activity",children:[d.jsxs("div",{className:`live-brief live-${h.state}`,children:[d.jsx(ZK,{still:!p}),p?d.jsxs("button",{type:"button",className:"live-disclosure",onKeyDown:Nm,"aria-expanded":n,"aria-controls":s,onClick:()=>r(_=>!_),children:[d.jsx("span",{className:"live-word is-shimmering",children:k}),y.length>1&&d.jsxs("span",{className:"live-span",children:["+",y.length-1]}),m&&d.jsx("span",{className:"live-span",children:m}),d.jsx("svg",{className:"live-chevron",viewBox:"0 0 12 12","aria-hidden":"true",children:d.jsx("path",{d:"m4 2 4 4-4 4"})})]}):d.jsx("span",{className:"live-word",children:k}),!p&&m&&d.jsx("span",{className:"live-span",children:m}),d.jsx("span",{className:"live-announcement",role:"status",children:p?k:h.line})]}),p&&n&&d.jsxs("div",{className:"live-details",id:s,children:[E>0&&d.jsxs("div",{className:"live-earlier",children:[E," earlier ",E===1?"step":"steps"," since it last said something"]}),b.map((_,j)=>d.jsx(iN,{label:`${_.verb.charAt(0).toUpperCase()}${_.verb.slice(1)} ${_.subject}`,detail:_.full||_.subject||""},`${_.at}-${j}`)),y.map(_=>d.jsx(iN,{label:_.label,detail:_.detail},_.id)),l&&d.jsx("div",{children:"Couldn’t read the command history."}),!l&&!y.length&&!b.length&&d.jsx("div",{children:"No commands yet."})]})]})}function iN({label:e,detail:t}){return d.jsxs("details",{className:"live-command",children:[d.jsxs("summary",{onKeyDown:Nm,children:[d.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[d.jsx("rect",{x:"1.5",y:"1.5",width:"13",height:"13",rx:"3"}),d.jsx("path",{d:"m4 5 3 3-3 3m5 0h3"})]}),d.jsx("span",{children:e})]}),d.jsx("pre",{children:t})]})}const d7=15e3;function f7({parts:e}){const t=e.filter(Boolean);return d.jsx("span",{className:"fm-said",children:t.join(" · ")})}function h7({item:e,facts:t,returned:n,figures:r}){const[s,o]=w.useState(()=>Date.now()),i=!!t.session;w.useEffect(()=>{if(!i)return;const a=setInterval(()=>o(Date.now()),d7);return()=>clearInterval(a)},[i]);const l=w3(e,{...t,now:s});return d.jsxs("div",{className:"focus-meta by-lead","aria-label":l.line,title:_i[l.where],children:[l.stateWord&&d.jsx("span",{className:"live-word",children:l.stateWord}),l.span&&d.jsx("span",{className:"live-span",children:l.span}),d.jsx(f7,{parts:[l.whereWord,l.engineWord,l.age?Rn(e)?`nothing has started for ${l.age}`:qn(e)?`downloaded ${l.age} ago`:`last moved ${l.age} ago`:null]}),n&&d.jsx("span",{className:"chip chip-returned",children:"back from snooze"}),r]})}function p7(e){var n;let t=e.length;for(;t>0&&((n=e[t-1])==null?void 0:n.kind)==="work";)t-=1;return t===e.length?e:e.slice(0,t)}const m7=8e3,g7="The agent";function y7({item:e,engine:t,session:n,opening:r,sending:s,onOpenOrigin:o,md:i,clean:l,onOpenDoc:a}){const[c,u]=w.useState(null),[f,h]=w.useState([]),[p,m]=w.useState([]),[y,x]=w.useState(!1);if(w.useEffect(()=>{x(!1)},[e.product,e.id]),w.useEffect(()=>{u(null),h([]),m([])},[e.product,e.id]),w.useEffect(()=>{let $=!0;const L=()=>{q.itemHistory({product:e.product,id:e.id}).then(F=>{$&&u({lines:(F==null?void 0:F.lines)??[],error:F!=null&&F.ok||F==null?void 0:F.error})}).catch(F=>{$&&u({lines:[],error:String((F==null?void 0:F.message)??F)})}),q.sessionTrace({product:e.product,id:e.id}).then(F=>{$&&h((F==null?void 0:F.sessions)??[])}).catch(()=>{$&&h([])}),q.codeChange({product:e.product,src:$h(e.id)}).then(F=>{var G;if(!$)return;const ae=(F!=null&&F.ok?(G=F.change)==null?void 0:G.files:null)??[];m(ae.map(I=>I.path).filter(Boolean))}).catch(()=>{$&&m([])})};if(L(),!n)return()=>{$=!1};const _=q.onChanged(L),j=setInterval(L,m7);return()=>{$=!1,_(),clearInterval(j)}},[e.product,e.id,e.updatedAt,n==null?void 0:n.startedAt]),!c)return d.jsx(DI,{head:"Reading this conversation…"});if(c.error)return d.jsx("div",{className:"thread-wait",children:c.error});const k=n!=null&&n.saying&&n.sayingAt?{text:n.saying,at:n.sayingAt,run:n.startedAt}:null,v=a7(c.lines,f,k,{whole:y,engine:t,pending:s}),b=v.events.map($=>$.kind==="work"?$:{...$,text:l($.text??"")}),E=n?p7(b):b,N=r?[{at:r.at,who:"you",text:r.text,on:r.on},...E]:E,{omitted:T,outcome:A}=v;if(!b.length&&!r&&!A)return d.jsx("div",{className:"thread-wait",children:"Nothing has been said here yet."});const R=A&&(OK(e)&&A.field==="result"?d.jsx("div",{className:"outcome",children:i(l(A.text))}):d.jsxs("div",{className:"appendix appendix-foot",children:[d.jsx("div",{className:"appendix-label",children:A.field==="result"?"Result":"Latest checkpoint"}),i(l(A.text))]}));return d.jsxs(d.Fragment,{children:[d.jsx(II,{events:N,omitted:T,name:g7,landOn:e.id,onWhole:()=>x(!0),onOpenOrigin:o,md:i,code:p.length&&a?{paths:p,open:$=>a($h(e.id),$)}:null}),R]})}const Pr=[{id:"urgent",label:"Urgent",value:9},{id:"high",label:"High",value:7},{id:"medium",label:"Medium",value:5},{id:"low",label:"Low",value:2}];function rc(e){const t=e??5;return t>=9?"urgent":t>=7?"high":t<=2?"low":"medium"}function zI(e){return Pr.find(t=>t.id===e).value}function _I(e){return Pr.find(t=>t.id===e).label}function lN(e){if(!e.length)return[];const t=new Set(e.map(s=>rc(s.priority))),n=t.size===1?[...t][0]:null,r=e.length>1?` (${e.length} selected)`:"";return Pr.map(s=>({id:`priority-${s.id}`,label:`Priority: ${s.label}${r}${s.id===n?" (current)":""}`,value:s.value,current:s.id===n}))}const FI="zero.lastPriority",BI=e=>e??globalThis.localStorage??null;function w7(e){var n;let t=null;try{t=((n=BI(e))==null?void 0:n.getItem(FI))??null}catch{return null}return Pr.some(r=>r.id===t)?t:null}function k7(e,t){var n;try{(n=BI(t))==null||n.setItem(FI,e)}catch{}}function aN({id:e}){if(e==="urgent")return d.jsxs("span",{className:"prio-bars p4",children:[d.jsx("i",{}),d.jsx("i",{}),d.jsx("i",{}),d.jsx("i",{})]});const t=e==="low"?1:e==="medium"?2:3;return d.jsxs("span",{className:`prio-bars p${t}`,children:[d.jsx("i",{}),d.jsx("i",{}),d.jsx("i",{})]})}function HI({value:e,set:t=!1,onChange:n,title:r,variant:s="tag",onOpenChange:o}){const[i,l]=w.useState(!1);w.useEffect(()=>{o==null||o(i)},[i]);const[a,c]=w.useState(0),u=w.useRef(null);ud(u,i),w.useEffect(()=>{if(!i)return;c(Math.max(0,Pr.findIndex(m=>m.id===e)));const p=m=>{var y;(y=u.current)!=null&&y.contains(m.target)||l(!1)};return document.addEventListener("pointerdown",p),()=>document.removeEventListener("pointerdown",p)},[i,e]);const f=p=>{n(p),l(!1)},h=s==="word";return d.jsxs("span",{className:h?"compose-word-wrap":"prio-wrap",ref:u,children:[i&&d.jsx("span",{className:"prio-menu",role:"listbox","aria-label":"Priority",children:Pr.map((p,m)=>d.jsxs("button",{role:"option","aria-selected":p.id===e,className:`prio-menu-row ${m===a?"cursor":""} ${p.id===e?"on":""}`,onPointerEnter:()=>c(m),onClick:()=>f(p.id),children:[d.jsx(aN,{id:p.id}),d.jsx("span",{className:"prio-menu-label",children:p.label})]},p.id))}),d.jsxs("button",{type:"button",className:[h?"compose-word":"prio-tag",e==="urgent"?"urgent":"",t?"set":"",i?"open":""].filter(Boolean).join(" "),title:r??"Priority","aria-haspopup":"listbox","aria-expanded":i,onClick:()=>l(p=>!p),onKeyDown:p=>{if(!i){(p.key==="ArrowUp"||p.key==="ArrowDown"||p.key==="Enter"||p.key===" ")&&(p.preventDefault(),l(!0));return}p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),l(!1)),p.key==="ArrowDown"&&(p.preventDefault(),c(m=>(m+1)%Pr.length)),p.key==="ArrowUp"&&(p.preventDefault(),c(m=>(m-1+Pr.length)%Pr.length)),p.key==="Enter"&&(p.preventDefault(),f(Pr[a].id))},children:[!h&&d.jsx(aN,{id:e}),_I(e)]})]})}function x7(e){const t=e.split(`
197
+ `),n=[];let r=!1;for(const s of t)/^#{1,4}\s/.test(s)?r=/option/i.test(s):r&&s.trim()&&!/^\s*\d+[.)]\s/.test(s)&&(r=!1),r||n.push(s);return n.join(`
198
+ `)}const b7=/^[\w-][\w./-]*\.(png|jpe?g|gif|webp|html?|pdf|md|csv|txt|json)$/i,v7=[ru,h9];function S7(e,t=Date.now()){const n=new Date(e).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});return`${fm(e,t).toLowerCase()} ${n}`}function C7({children:e}){const t=w.useRef(null),[n,r]=w.useState(!1);return d.jsxs("div",{className:"code-wrap",children:[d.jsx("pre",{ref:t,children:e}),d.jsx("button",{className:`code-copy ${n?"copied":""}`,onClick:()=>{navigator.clipboard.writeText(Y8(t.current)).then(()=>{r(!0),setTimeout(()=>r(!1),1600)}).catch(()=>{})},children:n?"copied ✓":"copy"})]})}function Ey({src:e,alt:t,roots:n,onOpen:r}){const[s,o]=w.useState(0);if(!e)return null;if(/^data:/.test(e))return d.jsx("img",{src:e,alt:t??"",className:"inline-image"});const i=(c,u)=>r?d.jsx("button",{type:"button",className:"inline-image-open","data-copy-file":/^https?:/.test(c)?void 0:c,title:c,onClick:()=>r(c),children:u}):u;if(/^https?:/.test(e))return i(e,d.jsx("img",{src:e,alt:t??"",className:"inline-image"}));if(/^file:\/\//.test(e)){const c=decodeURIComponent(e.slice(7));return i(c,d.jsx("img",{src:su(c),alt:t??"",className:"inline-image",crossOrigin:"anonymous"}))}if(e.startsWith("/"))return i(e,d.jsx("img",{src:su(e),alt:t??"",className:"inline-image",crossOrigin:"anonymous"}));const l=e.replace(/^\.\//,""),a=n.map(c=>su(`${c}/${l}`));return s>=a.length?d.jsxs("span",{className:"missing-artifact",children:["missing image: ",l]}):i(l,d.jsx("img",{src:a[s],alt:t??"",className:"inline-image",crossOrigin:"anonymous",onError:()=>o(s+1)}))}function Ny({product:e,src:t,fallback:n,onOpen:r,children:s}){const[o,i]=w.useState(n);return w.useEffect(()=>{var l,a;i(n),!(!t||/^https?:/.test(t))&&((a=(l=window.zero)==null?void 0:l.openArtifact)==null||a.call(l,{product:e,src:bk(t)??t,mode:"resolve"}).then(c=>{c!=null&&c.ok&&c.opened&&i(`file://${c.opened}`)}).catch(()=>{}))},[e,t]),d.jsx("a",{href:o,onClick:l=>{l.preventDefault(),r()},rel:"noreferrer",children:s})}function E7({product:e,path:t,fallback:n,open:r,onOpen:s}){const[o,i]=w.useState(null);return w.useEffect(()=>{let l=!0;const a=window.zero;return a!=null&&a.openArtifact?(a.openArtifact({product:e,src:t,mode:"resolve"}).then(c=>{l&&i(c!=null&&c.ok&&c.opened?`file://${c.opened}`:null)}).catch(()=>{l&&i(null)}),()=>{l=!1}):(i(n??null),()=>{l=!1})},[e,t]),o?r?d.jsxs("button",{type:"button",className:"embed-collapsed",onClick:s,children:[d.jsx("span",{className:"ec-mark","aria-hidden":"true"}),d.jsx("span",{className:"ec-name",children:t}),d.jsx("span",{className:"ec-state",children:"open on the right"})]}):d.jsxs("div",{className:"artifact-embed",children:[d.jsxs("div",{className:"artifact-embed-bar",children:[d.jsx("button",{type:"button",className:"artifact-embed-path",onClick:s,children:t}),d.jsx("a",{href:o,target:"_blank",rel:"noreferrer",children:"open ↗"})]}),d.jsx("iframe",{src:o,tabIndex:-1,sandbox:"allow-scripts",title:t})]}):null}function N7({artifactView:e,previewSample:t,onOpenArtifact:n,artifactSlot:r,inlineArtifacts:s,headerTarget:o,terminalHeaderTarget:i,item:l,parent:a,blockedBy:c,runningMode:u,engineChoice:f,runningEngine:h,codexModels:p,codexModelDefault:m,session:y,live:x,stoppable:k,productDir:v,repoDir:b,selectedOption:E,interruptedFrom:N,onBackToInterrupted:T,returnedFromSnooze:A,scheduledUntil:R,scheduledByAgent:$,replyOpen:L,sending:_,stalled:j,openDoc:F,resumeAt:ae,onScrolled:G,onOpenDoc:I,onRedeliver:ne,onUnschedule:B,onClose:J,onResolve:M,onPick:Q,onReply:ce,onReplySend:C,onReplyClose:re,onStop:W,onReopen:V,onSnooze:Se,onReveal:ye,onOpenItem:De,onNotice:Te,onInstallUpdate:le}){const K=ga(l),me=l.agent??null,U=me?bb(me):!1,we=eN(l,a),Oe=!me&&(we==null?void 0:we.kind)==="said"?{text:we.text,at:we.at,on:we.on}:null,Ie=Rn(l),ct=qn(l),se=Ie||ct,he=me?nK(me):!1,ve=w.useMemo(()=>S9(xl(l),Ha(l),me==null?void 0:me.name),[L,l.product,l.id,me==null?void 0:me.name]),He=w.useRef(null),tt=w.useRef(null),Ct=w.useRef("");w.useEffect(()=>{if(!(!ae||ae.id!==l.id||Ct.current===l.id)&&He.current)return Ct.current=l.id,O9(He.current,ae.top)},[l.id,ae]),w.useEffect(()=>{const pe=He.current;if(!pe||!G)return;let ft=!1;const ut=()=>{ft=!0},Un=()=>{ft&&G(Math.round(pe.scrollTop))},Me=["wheel","touchstart","keydown","mousedown"];for(const nt of Me)pe.addEventListener(nt,ut,{passive:!0});return pe.addEventListener("scroll",Un,{passive:!0}),()=>{for(const nt of Me)pe.removeEventListener(nt,ut);pe.removeEventListener("scroll",Un)}},[l.id,G]);const[oe,P]=w.useState(!0);w.useEffect(()=>{P(!0)},[l.id]);const ee=w.useRef(null);w.useEffect(()=>{var pe;E!==null&&((pe=ee.current)==null||pe.scrollIntoView({block:"nearest"}))},[E]);const[Ae,We]=w.useState(null);w.useEffect(()=>{We(null)},[l.id,oe]);const Je=(pe,ft)=>{const ut=ft.querySelector(".opt-text");We(D9(pe,!!ut&&I9(ut)))},wt=Ae===null?null:K.find(pe=>pe.n===Ae)??null,[un,dt]=w.useState(!1);w.useEffect(()=>{dt(!1)},[l.id]);const Cn=pe=>{dt(F9(jr,Ai,pe.querySelector("span")))},Ut=l.product,[be,Ye]=w.useState(null);w.useEffect(()=>{let pe=!0;if(Ye(null),me)return()=>{pe=!1};const ft=()=>{q.codeChange({product:l.product,src:$h(l.id)}).then(Un=>{pe&&Ye(Un!=null&&Un.ok?n9(Un.change):null)}).catch(()=>{pe&&Ye(null)})};if(ft(),!y)return()=>{pe=!1};const ut=setInterval(ft,4e3);return()=>{pe=!1,clearInterval(ut)}},[l.product,l.id,l.updatedAt,y==null?void 0:y.startedAt,me]);const{resolveSrc:rt,mdComponents:Jt,openHref:Kr,roots:Ls}=w.useMemo(()=>{const pe=Me=>!Me||/^(https?|file|data):/.test(Me)||!v?Me:`file://${v}/${Me.replace(/^\.\//,"")}`,ft=[v,v&&`${v}/designs`,v&&`${v}/attachments`,b,b&&`${b}/designs`].filter(Boolean),ut=Me=>{if(!Me)return;if(I&&(!/^https?:/.test(Me)&&H3(Me)||cR(Me))){I(Me);return}const nt=window.zero;if(!(nt!=null&&nt.openArtifact)){window.open(pe(Me),"_blank");return}const dn=bk(Me);nt.openArtifact({product:Ut,src:dn??Me,...dn?{mode:"source"}:{}}).then(tr=>{tr!=null&&tr.ok||Te((tr==null?void 0:tr.error)||`${Me} could not be opened.`)})};return{resolveSrc:pe,mdComponents:{pre:({children:Me})=>d.jsx(C7,{children:Me}),a:({href:Me,children:nt})=>{if(Me&&!/^(https?|data):/.test(Me)&&/\.(png|jpe?g|gif|webp|svg)(?:[?#]|$)/i.test(Me)){const dn=typeof nt=="string"?nt:Me;return d.jsx(Ey,{src:Me,alt:dn,roots:ft,onOpen:ut},Me)}return d.jsx(Ny,{product:Ut,src:Me,fallback:pe(Me),onOpen:()=>ut(Me),children:nt})},img:({src:Me,alt:nt})=>d.jsx(Ey,{src:Me,alt:nt,roots:ft,onOpen:ut},Me),code:({children:Me,className:nt})=>{const dn=String(Me??""),tr=!nt&&bk(dn);if(tr)return d.jsx(Ny,{product:Ut,src:tr,fallback:pe(tr),onOpen:()=>ut(tr),children:d.jsx("code",{children:dn})});if(!nt&&b7.test(dn.trim())){const Yr=dn.trim();return/\.(png|jpe?g|gif|webp)$/i.test(Yr)?d.jsx(Ey,{src:Yr,alt:Yr,roots:ft,onOpen:ut},Yr):d.jsx(Ny,{product:Ut,src:Yr,fallback:pe(Yr),onOpen:()=>ut(Yr),children:d.jsx("code",{children:Yr})})}return d.jsx("code",{className:nt,children:Me})}},openHref:ut,roots:ft}},[Ut,v,b,Te,I]),fr=pe=>d.jsx(Lc,{remarkPlugins:v7,components:Jt,children:pe}),X=w.useRef(null),Ke=w.useCallback(pe=>{X.current=pe,r==null||r(pe)},[r]);w.useEffect(()=>{var pe;r&&((pe=X.current)==null||pe.scrollIntoView({block:"nearest"}))},[F,!!r]);const Qe=w.useMemo(()=>l9(l,v),[l.result,l.note,l.body,l.answer,v]),Qt=fk(q.isFixtures,location.search)?"review-bundle.change":"artifact-layout-sample.change",Ni=t==="multiple"?["designs/w-n13/the-first-row.html",Qt,"artifact-layout-sample.md"]:t?[t==="code"?Qt:t==="notes"?"artifact-layout-sample.md":"designs/w-n13/the-first-row.html"]:[...new Set([...Qe,...wb(l.result,l.note,l.body,l.answer,{dir:v}).filter(pe=>/\.(md|markdown)$/i.test(pe)&&!xI(pe))])],Ar=xR(l),En=Ar&&(e!=="focus"||L),Ti=hm(l),qr=(l[Ti]??"").trim(),jr=w.useMemo(()=>_9(l),[l.result,l.note,l.body,l.title]),Ai=w.useMemo(()=>EI(l),[l.result,l.note,l.body,l.title]),ji=pe=>(Ar&&qr&&pe.trim()===qr?x7(pe):pe).replace(/^##\s*Gist\s*\n+/i,""),Ps=d.jsx(h7,{item:l,returned:!!A,facts:{...x,session:y,stalled:j,scheduledUntil:R,engineChoice:f,engine:h,inProgress:k},figures:be?d.jsxs("button",{type:"button",className:"change-figures",title:`Open the code · ${r9(be)}`,onClick:()=>I==null?void 0:I($h(l.id)),children:[yI(be).map(({sign:pe,text:ft})=>d.jsx("span",{className:pe==="+"?"code-plus":"code-minus",children:ft},pe)),d.jsxs("span",{className:"cf-files",children:["in ",wI(be)]})]}):null}),Bt=d.jsx("button",{className:"back-esc","data-hint":"back",onClick:J,"aria-label":"Back (esc)",title:"Back (esc)",children:d.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",children:d.jsx("path",{d:"M10 3.5L5.5 8l4.5 4.5"})})}),Ht=d.jsxs("div",{className:"keep-line",children:[d.jsx("div",{className:"keep-line-title",children:l.title}),Ps]});return d.jsxs("div",{className:"focus-pane",children:[!o&&Bt,o?ki.createPortal(d.jsxs(d.Fragment,{children:[Bt,Ht]}),o):Ht,d.jsx("div",{className:"focus-scroll",ref:He,children:d.jsxs("div",{className:"focus",children:[N&&d.jsx(LK,{title:N,onBack:T??J}),d.jsxs("div",{className:"focus-body markdown agent-thread",ref:tt,onCopy:pe=>Q8(pe.nativeEvent,tt.current),children:[d.jsx(T7,{recap:Oe?null:eN(l,a),onOpen:()=>a&&De(a)}),j&&d.jsxs("button",{className:"stalled-bar",onClick:ne,children:[d.jsx("span",{className:"stalled-bar-label",children:"The agent stopped without finishing this. Your answer is still waiting."}),d.jsx("span",{className:"stalled-bar-go",children:"restart the agent →"})]}),l.status==="blocked"&&c&&d.jsxs("button",{className:"blocked-by",onClick:()=>De(c),children:[d.jsx("span",{className:"blocked-by-label",children:"Waiting on"}),d.jsx("span",{className:"blocked-by-title",children:c.title}),d.jsx("span",{className:"blocked-by-go",children:"open →"})]}),l.answer==="(withdrawn)"&&d.jsx("div",{className:"your-reply your-reply-withdrawn",children:d.jsx("div",{className:"your-reply-label",children:"You withdrew your reply (Z undoes a send)"})}),me&&d.jsx(QK,{pid:me.pid,sessionId:me.sessionId,cwd:me.cwd,name:me.name,movedAt:me.lastActiveAt??0,md:fr}),se?d.jsx("div",{className:"outcome",children:fr(l.body??"")}):!me&&d.jsx(y7,{item:l,engine:h,session:y,opening:Oe,sending:_,onOpenOrigin:()=>a&&De(a),md:fr,clean:ji,onOpenDoc:I}),!me&&d.jsx(B3,{product:l.product,id:l.id},`remote:${l.product}:${l.id}`),!me&&d.jsx(x8,{engine:h??"claude-code",item:l},`${l.product}:${l.id}`),d.jsx(u7,{item:l,facts:{...x,session:y,stalled:j,scheduledUntil:R}})]}),r&&d.jsx("div",{className:"inline-artifact",ref:Ke}),s&&d.jsx("div",{className:"artifact-entry-list","aria-label":"Attachments",children:Ni.map(pe=>d.jsx(tB,{product:Ut,path:pe,revision:l.updatedAt,open:F===pe,onOpen:()=>n==null?void 0:n(pe,"beside"),onAddContext:fk(q.isFixtures,location.search)?ft=>{vm(l,S_(xl(l),pe,ft)),window.dispatchEvent(new CustomEvent("zero:reply-restored",{detail:kl(l)})),ce()}:void 0},pe))}),!s&&Qe.map(pe=>{const ft=!!F&&F===pe;return ft?null:d.jsx(E7,{product:Ut,path:pe,fallback:rt(pe),open:ft,onOpen:()=>Kr(pe)},pe)}),((R??0)>0&&!!B||!!me&&!U&&!!ye||k||!me&&l.status==="blocked"&&!y)&&d.jsxs("div",{className:"focus-actions",children:[(R??0)>0&&B&&d.jsxs("button",{className:"focus-unschedule",onClick:B,children:[$?"let it run now":"back to inbox",d.jsxs("span",{className:"dim",children:[" · ",$?"the agent paused this until":"scheduled for"," ",S7(R)]})]}),me&&!U&&ye&&d.jsxs("button",{className:"focus-stop",onClick:ye,children:["take me to it",d.jsxs("span",{className:"dim",children:[" · ","opens the app it is running in"]})]}),k&&d.jsxs("button",{className:"focus-stop",onClick:W,children:[y?"stop this agent":"stop this task",d.jsxs("span",{className:"dim",children:[" · ","moves it back to your inbox"]})]}),!me&&l.status==="blocked"&&!y&&d.jsx("button",{onClick:V,children:"send back to agent"})]})]})}),d.jsx("div",{className:"focus-dock",children:d.jsx("div",{className:"focus-dock-inner",children:d.jsxs("div",{className:"dock-card",children:[En&&d.jsxs("div",{className:"opt-strip",children:[d.jsxs("div",{className:`opt-head ${jr?"opt-head-ask":""}`,onMouseEnter:pe=>Cn(pe.currentTarget),onMouseLeave:()=>dt(!1),children:[d.jsx("span",{children:jr||"Their options · pick or write your own"}),d.jsx("button",{className:"opt-collapse",onClick:()=>P(pe=>!pe),title:oe?"Collapse options":"Expand options",children:d.jsx("svg",{viewBox:"0 0 16 16",className:oe?"":"flipped",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",children:d.jsx("path",{d:"M4 6l4 4 4-4"})})})]}),oe&&wt&&d.jsxs("div",{className:"opt-peek",children:[d.jsxs("div",{className:"opt-peek-head",children:["Option ",wt.n,", in full"]}),d.jsx(Lc,{remarkPlugins:[ru],children:wt.text.replace(/\s*\(recommended\)/i,"")})]}),!wt&&un&&d.jsxs("div",{className:"opt-peek",children:[d.jsx("div",{className:"opt-peek-head",children:"The question, in full"}),d.jsx(Lc,{remarkPlugins:[ru],children:Ai})]}),oe&&K.map(pe=>d.jsxs("button",{ref:pe.n===E?ee:void 0,className:`opt-row ${pe.n===E?"selected":""}`,onClick:()=>Q(pe.n),onMouseEnter:ft=>Je(pe.n,ft.currentTarget),onMouseLeave:()=>We(null),children:[d.jsx("span",{className:"opt-key",children:pe.n}),d.jsx("span",{className:"opt-text",children:d.jsx(Lc,{remarkPlugins:[ru],components:{p:({children:ft})=>d.jsx(d.Fragment,{children:ft})},children:pe.text.replace(/\s*\(recommended\)/i,"")})}),pe.n===E?d.jsx("span",{className:"opt-rec",children:"↵ send"}):pe.recommended&&d.jsx("span",{className:"opt-rec",children:"recommended"})]},pe.n))]}),ct?d.jsx("button",{className:"dock-pill",onClick:()=>le==null?void 0:le(),children:d.jsx("span",{className:"dock-pill-text",children:Uh.restart})}):Ie?null:he?d.jsx("div",{className:"dock-pill dock-pill-static",children:d.jsx("span",{className:"dock-pill-text",children:"Answer this one in its own window. A message from here would wait behind the box it is stuck on."})}):L?d.jsx(M7,{item:l,runningMode:u,runningEngine:h,codexModels:p,codexModelDefault:m,onSend:C,onClose:re,onNotice:Te}):d.jsxs("button",{className:`dock-pill${ve.draft?" dock-pill-kept":""}`,onClick:ce,children:[d.jsx("span",{className:"dock-pill-text",children:ve.text}),ve.files&&d.jsx("span",{className:"dock-pill-files",children:ve.files}),d.jsx("span",{className:"dock-pill-key",children:d.jsx("kbd",{children:"R"})})]})]})})}),d.jsx(HR,{product:l.product,id:l.id,headerTarget:i},`${l.product}:${l.id}`)]})}function T7({recap:e,onOpen:t}){if(!e||e.kind==="replied")return null;const n=e.kind==="said"?e.on:e.title;return d.jsxs("div",{className:"origin origin-oneline",onClick:t,title:`Open ${n}`,children:[d.jsxs("div",{className:"origin-label",children:["In response to · ",Yo(e.at)," ago",d.jsx("span",{className:"origin-open",children:"open →"})]}),d.jsx("div",{className:"origin-title",children:n})]})}function A7({rows:e,at:t,onPick:n,onHover:r}){const s=w.useRef(null);return w.useEffect(()=>{var o,i;(i=(o=s.current)==null?void 0:o.querySelector(".slash-row.cursor"))==null||i.scrollIntoView({block:"nearest"})},[t,e.length]),d.jsx("div",{className:"slash-menu",role:"listbox","aria-label":n8,ref:s,children:e.map((o,i)=>{const{typed:l,says:a}=y8(o);return d.jsxs("button",{className:i===t?"slash-row cursor":"slash-row",role:"option","aria-selected":i===t,onMouseDown:c=>{c.preventDefault(),n(o)},onMouseEnter:()=>r(i),children:[d.jsx("span",{className:"slash-cmd",children:l}),d.jsx("span",{className:"slash-hint",children:a})]},m8(o))})})}function j7({value:e,options:t,label:n,onChange:r}){const[s,o]=w.useState(!1),i=w.useRef(null);ud(i,s),w.useEffect(()=>{if(!s)return;const a=c=>{i.current&&!i.current.contains(c.target)&&o(!1)};return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[s]);const l=t.find(a=>a.value===e);return d.jsxs("span",{className:"compose-word-wrap",ref:i,children:[s&&d.jsx("span",{className:"prio-menu model-menu",role:"listbox","aria-label":n,children:t.map(a=>d.jsx("button",{type:"button",role:"option","aria-selected":a.value===e,className:`prio-menu-row ${a.value===e?"on":""}`,onClick:()=>{r(a.value),o(!1)},children:d.jsx("span",{className:"prio-menu-label",children:a.label})},a.value))}),d.jsx("button",{type:"button",className:`compose-word set ${s?"open":""}`,title:n,"aria-haspopup":"listbox","aria-expanded":s,onClick:()=>o(a=>!a),children:((l==null?void 0:l.label)??e).replace(/(^|\s)\S/g,a=>a.toUpperCase())})]})}function M7({item:e,runningMode:t,runningEngine:n,codexModels:r=[],codexModelDefault:s=null,onSend:o,onClose:i,onNotice:l}){const[a,c]=w.useState(()=>xl(e)),[u,f]=w.useState(()=>Ha(e));w.useEffect(()=>{const U=we=>{we.detail===kl(e)&&(c(xl(e)),f(Ha(e)))};return window.addEventListener("zero:reply-restored",U),()=>window.removeEventListener("zero:reply-restored",U)},[e.product,e.id]);const[h,p]=w.useState(0),[m,y]=w.useState(null),x=rc(e.priority),k=m??x,[v,b]=w.useState(!1),[E,N]=w.useState(e.model??null),[T,A]=w.useState(e.effort??null);w.useEffect(()=>{b(!1),N(e.model??null),A(e.effort??null)},[e.product,e.id,e.model,e.effort]);const R=w.useRef(null),[$,L]=w.useState(e.answerMode??null),[_,j]=w.useState(0),[F,ae]=w.useState([]),G=!e.agent&&(n??Ft)===Ft&&yy(a)!==null;w.useEffect(()=>{if(ae([]),!!G)return aB(()=>q.commandCatalog(e),ae)},[e.product,e.id,n,G]),w.useEffect(()=>{vm(e,a)},[a,e.product,e.id]),w.useEffect(()=>{const{dropped:U}=kb(e,u);p(U.length)},[u,e.product,e.id]),w.useEffect(()=>{var U;(U=R.current)==null||U.focus()},[]),w.useEffect(()=>{L(e.answerMode??null)},[e.id,e.product]),w.useEffect(()=>{WE(R.current)}),w.useEffect(()=>{var Oe;const U=(Oe=R.current)==null?void 0:Oe.closest(".focus-pane");if(!U||typeof ResizeObserver>"u")return;const we=new ResizeObserver(()=>WE(R.current));return we.observe(U),()=>we.disconnect()},[]);const I=async U=>{if(!(U??a).trim()&&!u.length)return;const we=a,Oe=()=>{var He;((He=R.current)==null?void 0:He.value)===we&&(c(""),FE(e))},Ie=n==="codex"&&!e.agent?w8(U??a):null;if(Ie){if(!Ie.valid||u.length){l(zk.invalid);return}const He=await XO({product:e.product,id:e.id});(He.state==="running"||He.state==="done")&&Oe();return}if(e.agent?null:DC(U??a,n??"claude-code")){if(u.length){l("Send this command without attachments. Your draft has been kept.");return}const He=await k8({product:e.product,id:e.id},U??a);if(He.state==="copy")try{await navigator.clipboard.writeText(He.text??""),l("Response copied.")}catch{l("Could not copy the response. Your draft has been kept.");return}if(["done","copy"].includes(He.state)&&Oe(),He.state!=="forward")return}const se=(U??a).trim(),he={words:se,attachments:u},ve=await dI(e.product,u);FE(e),o([se,ve].filter(Boolean).join(`
199
+
200
+ `),m?zI(m):void 0,Te,he,$,v?{model:E,effort:T}:void 0)},ne=!!a.trim()||u.length>0,B=(n??Ft)===Ft,J=!e.agent,M=e.agent?null:yy(a),Q=g8(M,$!==null,B,F),ce=Q.length>0,C=$??(B?t??"auto":ME),re=U=>B?ZV[U]:f8[U];w.useEffect(()=>{j(0)},[M,F]);const W=U=>{if(U===null){l(`Permissions · back to this project's setting, ${re(B?t??"auto":ME)}`);return}l(`Permissions · ${re(U)} for this thread`)},V=U=>{var we;L(U),W(U),yy(a)!==null&&c(""),(we=R.current)==null||we.focus()},Se=(U,we="run")=>{var Oe,Ie;if(U.kind==="mode"||U.kind==="codexMode"){V(U.mode);return}if(we==="fill"){c(h4(U.cmd)),(Oe=R.current)==null||Oe.focus();return}if(((Ie=DC(`/${U.cmd.name}`,n??"claude-code"))==null?void 0:Ie.route)!=="claude"){I(`/${U.cmd.name}`);return}c(""),I(`/${U.cmd.name}`)},ye=U=>{const we=J&&U.startsWith("/")&&U.endsWith(" ")?U.slice(1,-1).toLowerCase():null,Oe=B?s8(we):p8(we);if(Oe){V(Oe);return}if($!==null&&c8(we)){V(null);return}c(U)};w.useEffect(()=>{if(ne)return;const U=we=>{var Ie,ct;((ct=(Ie=we.target)==null?void 0:Ie.closest)==null?void 0:ct.call(Ie,".dock-card"))||i()};return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[ne,i]);const De=!!um(e),[Te,le]=w.useState(null),K=F0(a),me=w.useRef(null);return w.useEffect(()=>{const U=K&&"rule"in K?K.rule:null;U&&!zh(U,me.current)&&le(U),!U&&me.current&&zh(Te,me.current)&&le(null),me.current=U},[K&&"rule"in K?K.rule.at:null]),d.jsxs(d.Fragment,{children:[ce&&d.jsx(A7,{rows:Q,at:_,onPick:Se,onHover:j}),d.jsx("textarea",{className:"dock-input",ref:R,value:a,onChange:U=>ye(U.target.value),placeholder:"What should the agent do next?",onKeyDown:U=>{var we;if(U.key==="Tab"&&U.shiftKey&&J){U.preventDefault();const Oe=B?o8(C):h8(C);L(Oe),W(Oe);return}if(ce){if(U.key==="ArrowDown"){U.preventDefault(),j(Oe=>(Oe+1)%Q.length);return}if(U.key==="ArrowUp"){U.preventDefault(),j(Oe=>(Oe-1+Q.length)%Q.length);return}if(U.key==="Enter"&&!U.metaKey&&!U.ctrlKey||U.key==="Tab"){U.preventDefault(),Se(Q[_]??Q[0],U.key==="Tab"?"fill":"run");return}if(U.key==="Escape"){U.preventDefault(),U.stopPropagation(),c("");return}}(U.metaKey||U.ctrlKey)&&U.key==="Enter"&&I(),U.key==="Escape"&&(U.stopPropagation(),ne?(we=R.current)==null||we.blur():i())},onPaste:async U=>{const we=await uI(U);we.length&&(U.preventDefault(),f(Oe=>[...Oe,...we]))},onDragOver:U=>U.preventDefault(),onDrop:async U=>{U.preventDefault();const we=await pb(U.dataTransfer.files);we.length&&f(Oe=>[...Oe,...we])}}),d.jsx(OI,{attachments:u,onRemove:U=>f(we=>we.filter((Oe,Ie)=>Ie!==U))}),Te&&d.jsx("div",{className:"compose-note",children:De?"This changes the repeating task.":"This makes it repeating."}),K&&"unreadable"in K&&d.jsx("div",{className:"compose-note",children:"Not understood, so this happens once."}),h>0&&d.jsx("div",{className:"compose-note",children:h===1?"One pasted image is too big to save. Closing the box loses it.":`${h} pasted images are too big to save. Closing the box loses them.`}),d.jsxs("div",{className:"compose-sentence",children:[d.jsx("span",{className:"compose-clauses",children:e.agent?d.jsxs("span",{className:"dim",children:["Goes straight into ",e.agent.name,"."]}):d.jsxs(d.Fragment,{children:[d.jsx(HI,{variant:"word",value:k,set:!!m,onChange:y,title:"Priority"})," priority. ",Te&&d.jsxs(d.Fragment,{children:[d.jsx(sI,{value:{runAt:0,repeat:Te},onChange:U=>le(U.repeat),only:"repeat",empty:"Runs once"}),". "]}),J&&d.jsxs(d.Fragment,{children:["In ",d.jsx(j7,{label:"What this message may do",value:C,options:B?ol.map(U=>({value:U,label:Yi[U]})):il.map(U=>({value:U,label:QO[U].label})),onChange:U=>V(U)})," Mode. "]}),"On ",d.jsx(cI,{value:E,onChange:U=>{b(!0),N(U)},engine:n,codexModels:r,codexDefault:s,effort:T,onEffortChange:U=>{b(!0),A(U)},title:"Which model this conversation runs on"}),"."]})}),d.jsxs("button",{className:"dock-send",onClick:()=>I(),disabled:!ne,title:"Send · ⌘↵",children:["Send ",d.jsx("kbd",{children:"⌘↵"})]})]})]})}function qk({kind:e,children:t}){return d.jsx("svg",{width:"16",height:"16",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e==="open"?d.jsx("path",{d:"M11 3h6v6m0-6-8 8M7 4H4a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1h11a1 1 0 0 0 1-1v-3"}):e==="close"?d.jsx("path",{d:"m5 5 10 10M15 5 5 15"}):t})}function R7(e,t){return{label:t?"Exit Focus":"Focus",hint:t?"Return to the task · Esc":"Give this document the full workspace",icon:e==="text"?null:`${e.startsWith("corners")?"corners":e}-${t?"exit":"enter"}`}}function O7({style:e,focused:t,onClick:n}){const r=R7(e,t);return d.jsxs("button",{type:"button",className:`artifact-expand focus-mode-control${e==="corners-icon"||e==="corners-bare"?" focus-icon-only":""}${e==="corners-bare"?" focus-bare":""}`,title:r.hint,"aria-label":r.label,onClick:n,children:[r.icon&&d.jsx(qk,{children:e.startsWith("corners")?d.jsx("path",{d:t?"M3 7h4V3m6 0v4h4M3 13h4v4m6 0v-4h4":"M7 3H3v4m10-4h4v4M3 13v4h4m6 0h4v-4"}):d.jsxs(d.Fragment,{children:[d.jsx("rect",{x:"2.5",y:"3.5",width:"15",height:"13",rx:"1"}),t?d.jsx(d.Fragment,{children:d.jsx("path",{d:"M7.5 3.5v13M12 8l-2 2 2 2m-2-2h5"})}):d.jsx("rect",{x:"6",y:"6.5",width:"8",height:"7",rx:".5"})]})}),e!=="corners-icon"&&e!=="corners-bare"&&d.jsx("span",{children:r.label}),t&&e==="text"&&d.jsx("kbd",{children:"Esc"})]})}function gn(e){this.content=e}gn.prototype={constructor:gn,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,s=r.find(e),o=r.content.slice();return s==-1?o.push(n||e,t):(o[s+1]=t,n&&(o[s]=n)),new gn(o)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new gn(n)},addToStart:function(e,t){return new gn([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new gn(n)},addBefore:function(e,t,n){var r=this.remove(t),s=r.content.slice(),o=r.find(e);return s.splice(o==-1?s.length:o,0,t,n),new gn(s)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=gn.from(e),e.size?new gn(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=gn.from(e),e.size?new gn(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=gn.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}};gn.from=function(e){if(e instanceof gn)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new gn(t)};function WI(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let s=e.child(r),o=t.child(r);if(s==o){n+=s.nodeSize;continue}if(!s.sameMarkup(o))return n;if(s.isText&&s.text!=o.text){let i=s.text,l=o.text,a=0;for(;i[a]==l[a];a++)n++;return a&&a<i.length&&a<l.length&&KI(i.charCodeAt(a-1))&&VI(i.charCodeAt(a))&&n--,n}if(s.content.size||o.content.size){let i=WI(s.content,o.content,n+1);if(i!=null)return i}n+=s.nodeSize}}function UI(e,t,n,r){for(let s=e.childCount,o=t.childCount;;){if(s==0||o==0)return s==o?null:{a:n,b:r};let i=e.child(--s),l=t.child(--o),a=i.nodeSize;if(i==l){n-=a,r-=a;continue}if(!i.sameMarkup(l))return{a:n,b:r};if(i.isText&&i.text!=l.text){let c=i.text,u=l.text,f=c.length,h=u.length;for(;f>0&&h>0&&c[f-1]==u[h-1];)f--,h--,n--,r--;return f&&h&&f<c.length&&KI(c.charCodeAt(f-1))&&VI(c.charCodeAt(f))&&(n++,r++),{a:n,b:r}}if(i.content.size||l.content.size){let c=UI(i.content,l.content,n-1,r-1);if(c)return c}n-=a,r-=a}}function VI(e){return e>=56320&&e<57344}function KI(e){return e>=55296&&e<56320}class Z{constructor(t,n){if(this.content=t,this.size=n||0,n==null)for(let r=0;r<t.length;r++)this.size+=t[r].nodeSize}nodesBetween(t,n,r,s=0,o){for(let i=0,l=0;l<n;i++){let a=this.content[i],c=l+a.nodeSize;if(c>t&&r(a,s+l,o||null,i)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,t-u),Math.min(a.content.size,n-u),r,s+u)}l=c}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,n,r,s){let o="",i=!0;return this.nodesBetween(t,n,(l,a)=>{let c=l.isText?l.text.slice(Math.max(t,a)-a,n-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(i?i=!1:o+=r),o+=c},0),o}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,s=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(s[s.length-1]=n.withText(n.text+r.text),o=1);o<t.content.length;o++)s.push(t.content[o]);return new Z(s,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],s=0;if(n>t)for(let o=0,i=0;i<n;o++){let l=this.content[o],a=i+l.nodeSize;a>t&&((i<t||a>n)&&(l.isText?l=l.cut(Math.max(0,t-i),Math.min(l.text.length,n-i)):l=l.cut(Math.max(0,t-i-1),Math.min(l.content.size,n-i-1))),r.push(l),s+=l.nodeSize),i=a}return new Z(r,s)}cutByIndex(t,n){return t==n?Z.empty:t==0&&n==this.content.length?this:new Z(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let s=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return s[t]=n,new Z(s,o)}addToStart(t){return new Z([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new Z(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(t.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(t){let n=this.content[t];if(!n)throw new RangeError("Index "+t+" out of range for "+this);return n}maybeChild(t){return this.content[t]||null}forEach(t){for(let n=0,r=0;n<this.content.length;n++){let s=this.content[n];t(s,r,n),r+=s.nodeSize}}findDiffStart(t,n=0){return WI(this,t,n)}findDiffEnd(t,n=this.size,r=t.size){return UI(this,t,n,r)}findIndex(t){if(t==0)return pf(0,t);if(t==this.size)return pf(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let n=0,r=0;;n++){let s=this.child(n),o=r+s.nodeSize;if(o>=t)return o==t?pf(n+1,o):pf(n,r);r=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,n){if(!n)return Z.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return Z.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return Z.empty;let n,r=0;for(let s=0;s<t.length;s++){let o=t[s];r+=o.nodeSize,s&&o.isText&&t[s-1].sameMarkup(o)?(n||(n=t.slice(0,s)),n[n.length-1]=o.withText(n[n.length-1].text+o.text)):n&&n.push(o)}return new Z(n||t,r)}static from(t){if(!t)return Z.empty;if(t instanceof Z)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new Z([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Z.empty=new Z([],0);const Ty={index:0,offset:0};function pf(e,t){return Ty.index=e,Ty.offset=t,Ty}function Xh(e,t){if(e===t)return!0;if(!(e&&typeof e=="object")||!(t&&typeof t=="object"))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!Xh(e[r],t[r]))return!1}else{for(let r in e)if(!(r in t)||!Xh(e[r],t[r]))return!1;for(let r in t)if(!(r in e))return!1}return!0}let gt=class Yk{constructor(t,n){this.type=t,this.attrs=n}addToSet(t){let n,r=!1;for(let s=0;s<t.length;s++){let o=t[s];if(this.eq(o))return t;if(this.type.excludes(o.type))n||(n=t.slice(0,s));else{if(o.type.excludes(this.type))return t;!r&&o.type.rank>this.type.rank&&(n||(n=t.slice(0,s)),n.push(this),r=!0),n&&n.push(o)}}return n||(n=t.slice()),r||n.push(this),n}removeFromSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return t.slice(0,n).concat(t.slice(n+1));return t}isInSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return!0;return!1}eq(t){return this==t||this.type==t.type&&Xh(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=t.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(t,n){if(t==n)return!0;if(t.length!=n.length)return!1;for(let r=0;r<t.length;r++)if(!t[r].eq(n[r]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return Yk.none;if(t instanceof Yk)return[t];let n=t.slice();return n.sort((r,s)=>r.type.rank-s.type.rank),n}};gt.none=[];class Bu extends Error{}class xe{constructor(t,n,r){this.content=t,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=YI(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new xe(r,this.openStart,this.openEnd)}removeBetween(t,n){return new xe(qI(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,n){if(!n)return xe.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 xe(Z.fromJSON(t,n.content),r,s)}static maxOpen(t,n=!0){let r=0,s=0;for(let o=t.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=t.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)s++;return new xe(t,r,s)}}xe.empty=new xe(Z.empty,0,0);function qI(e,t,n){let{index:r,offset:s}=e.findIndex(t),o=e.maybeChild(r),{index:i,offset:l}=e.findIndex(n);if(s==t||o.isText){if(l!=n&&!e.child(i).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=i)throw new RangeError("Removing non-flat range");return e.replaceChild(r,o.copy(qI(o.content,t-s-1,n-s-1)))}function YI(e,t,n,r,s,o){let{index:i,offset:l}=e.findIndex(t),a=e.maybeChild(i);if(l==t||a.isText)return o&&r<=0&&s<=0&&!o.canReplace(i,i,n)?null:e.cut(0,t).append(n).append(e.cut(t));let c=YI(a.content,t-l-1,n,i==0?r-1:0,i==e.childCount-1?s-1:0,a);return c&&e.replaceChild(i,a.copy(c))}function I7(e,t,n){if(n.openStart>e.depth)throw new Bu("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Bu("Inconsistent open depths");return GI(e,t,n,0)}function GI(e,t,n,r){let s=e.index(r),o=e.node(r);if(s==t.index(r)&&r<e.depth-n.openStart){let i=GI(e,t,n,r+1);return o.copy(o.content.replaceChild(s,i))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let i=e.parent,l=i.content;return al(i,l.cut(0,e.parentOffset).append(n.content).append(l.cut(t.parentOffset)))}else{let{start:i,end:l}=D7(n,e);return al(o,QI(e,i,l,t,r))}else return al(o,Zh(e,t,r))}function JI(e,t){if(!t.type.compatibleContent(e.type))throw new Bu("Cannot join "+t.type.name+" onto "+e.type.name)}function Gk(e,t,n){let r=e.node(n);return JI(r,t.node(n)),r}function ll(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function lu(e,t,n,r){let s=(t||e).node(n),o=0,i=t?t.index(n):s.childCount;e&&(o=e.index(n),e.depth>n?o++:e.textOffset&&(ll(e.nodeAfter,r),o++));for(let l=o;l<i;l++)ll(s.child(l),r);t&&t.depth==n&&t.textOffset&&ll(t.nodeBefore,r)}function al(e,t){if(!e.type.validContent(t))throw new Bu("Invalid content for node "+e.type.name);return e.copy(t)}function QI(e,t,n,r,s){let o=e.depth>s&&Gk(e,t,s+1),i=r.depth>s&&Gk(n,r,s+1),l=[];return lu(null,e,s,l),o&&i&&t.index(s)==n.index(s)?(JI(o,i),ll(al(o,QI(e,t,n,r,s+1)),l)):(o&&ll(al(o,Zh(e,t,s+1)),l),lu(t,n,s,l),i&&ll(al(i,Zh(n,r,s+1)),l)),lu(r,null,s,l),new Z(l)}function Zh(e,t,n){let r=[];if(lu(null,e,n,r),e.depth>n){let s=Gk(e,t,n+1);ll(al(s,Zh(e,t,n+1)),r)}return lu(t,null,n,r),new Z(r)}function D7(e,t){let n=t.depth-e.openStart,s=t.node(n).copy(e.content);for(let o=n-1;o>=0;o--)s=t.node(o).copy(Z.from(s));return{start:s.resolveNoCache(e.openStart+n),end:s.resolveNoCache(s.content.size-e.openEnd-n)}}class Hu{constructor(t,n,r){this.pos=t,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(t){return t==null?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[this.resolveDepth(t)*3]}index(t){return this.path[this.resolveDepth(t)*3+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)}start(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]}after(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]+this.path[t*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,n=this.index(this.depth);if(n==t.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=t.child(n);return r?t.child(n).cut(r):s}get nodeBefore(){let t=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(t).cut(0,n):t==0?null:this.parent.child(t-1)}posAtIndex(t,n){n=this.resolveDepth(n);let r=this.path[n*3],s=n==0?0:this.path[n*3-1]+1;for(let o=0;o<t;o++)s+=r.child(o).nodeSize;return s}marks(){let t=this.parent,n=this.index();if(t.content.size==0)return gt.none;if(this.textOffset)return t.child(n).marks;let r=t.maybeChild(n-1),s=t.maybeChild(n);if(!r){let l=r;r=s,s=l}let o=r.marks;for(var i=0;i<o.length;i++)o[i].type.spec.inclusive===!1&&(!s||!o[i].isInSet(s.marks))&&(o=o[i--].removeFromSet(o));return o}marksAcross(t){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,s=t.parent.maybeChild(t.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!s||!r[o].isInSet(s.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(t){for(let n=this.depth;n>0;n--)if(this.start(n)<=t&&this.end(n)>=t)return n;return 0}blockRange(t=this,n){if(t.pos<this.pos)return t.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);r>=0;r--)if(t.pos<=this.end(r)&&(!n||n(this.node(r))))return new ep(this,t,r);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let n=1;n<=this.depth;n++)t+=(t?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return t+":"+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw new RangeError("Position "+n+" out of range");let r=[],s=0,o=n;for(let i=t;;){let{index:l,offset:a}=i.content.findIndex(o),c=o-a;if(r.push(i,l,s+a),!c||(i=i.child(l),i.isText))break;o=c-1,s+=a+1}return new Hu(n,r,o)}static resolveCached(t,n){let r=cN.get(t);if(r)for(let o=0;o<r.elts.length;o++){let i=r.elts[o];if(i.pos==n)return i}else cN.set(t,r=new L7);let s=r.elts[r.i]=Hu.resolve(t,n);return r.i=(r.i+1)%P7,s}}class L7{constructor(){this.elts=[],this.i=0}}const P7=12,cN=new WeakMap;class ep{constructor(t,n,r){this.$from=t,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 $7=Object.create(null);let ii=class Jk{constructor(t,n,r,s=gt.none){this.type=t,this.attrs=n,this.marks=s,this.content=r||Z.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,n,r,s=0){this.content.nodesBetween(t,n,r,s,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,n,r,s){return this.content.textBetween(t,n,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,n,r){return this.type==t&&Xh(this.attrs,n||t.defaultAttrs||$7)&&gt.sameSet(this.marks,r||gt.none)}copy(t=null){return t==this.content?this:new Jk(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new Jk(this.type,this.attrs,this.content,t)}cut(t,n=this.content.size){return t==0&&n==this.content.size?this:this.copy(this.content.cut(t,n))}slice(t,n=this.content.size,r=!1){if(t==n)return xe.empty;let s=this.resolve(t),o=this.resolve(n),i=r?0:s.sharedDepth(n),l=s.start(i),c=s.node(i).content.cut(s.pos-l,o.pos-l);return new xe(c,s.depth-i,o.depth-i)}replace(t,n,r){return I7(this.resolve(t),this.resolve(n),r)}nodeAt(t){for(let n=this;;){let{index:r,offset:s}=n.content.findIndex(t);if(n=n.maybeChild(r),!n)return null;if(s==t||n.isText)return n;t-=s+1}}childAfter(t){let{index:n,offset:r}=this.content.findIndex(t);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(t){if(t==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(t);if(r<t)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(t){return Hu.resolveCached(this,t)}resolveNoCache(t){return Hu.resolve(this,t)}rangeHasMark(t,n,r){let s=!1;return n>t&&this.nodesBetween(t,n,o=>(r.isInSet(o.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 t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),XI(this.marks,t)}contentMatchAt(t){let n=this.type.contentMatch.matchFragment(this.content,0,t);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(t,n,r=Z.empty,s=0,o=r.childCount){let i=this.contentMatchAt(t).matchFragment(r,s,o),l=i&&i.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let a=s;a<o;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(t,n,r,s){if(s&&!this.type.allowsMarks(s))return!1;let o=this.contentMatchAt(t).matchType(r),i=o&&o.matchFragment(this.content,n);return i?i.validEnd:!1}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let t=gt.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),t=r.addToSet(t)}if(!gt.sameSet(t,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 t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(n=>n.toJSON())),t}static fromJSON(t,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(t.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(n.text,r)}let s=Z.fromJSON(t,n.content),o=t.nodeType(n.type).create(n.attrs,s,r);return o.type.checkAttrs(o.attrs),o}};ii.prototype.text=void 0;class tp extends ii{constructor(t,n,r,s){if(super(t,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):XI(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,n){return this.text.slice(t,n)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new tp(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new tp(this.type,this.attrs,t,this.marks)}cut(t=0,n=this.text.length){return t==0&&n==this.text.length?this:this.withText(this.text.slice(t,n))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function XI(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class bl{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new z7(t,n);if(r.next==null)return bl.empty;let s=ZI(r);r.next&&r.err("Unexpected trailing text");let o=V7(U7(s));return K7(o,r),o}matchType(t){for(let n=0;n<this.next.length;n++)if(this.next[n].type==t)return this.next[n].next;return null}matchFragment(t,n=0,r=t.childCount){let s=this;for(let o=n;s&&o<r;o++)s=s.matchType(t.child(o).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:n}=this.next[t];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(t){for(let n=0;n<this.next.length;n++)for(let r=0;r<t.next.length;r++)if(this.next[n].type==t.next[r].type)return!0;return!1}fillBefore(t,n=!1,r=0){let s=[this];function o(i,l){let a=i.matchFragment(t,r);if(a&&(!n||a.validEnd))return Z.from(l.map(c=>c.createAndFill()));for(let c=0;c<i.next.length;c++){let{type:u,next:f}=i.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(f)==-1){s.push(f);let h=o(f,l.concat(u));if(h)return h}}return null}return o(this,[])}findWrapping(t){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==t)return this.wrapCache[r+1];let n=this.computeWrapping(t);return this.wrapCache.push(t,n),n}computeWrapping(t){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),o=s.match;if(o.matchType(t)){let i=[];for(let l=s;l.type;l=l.via)i.push(l.type);return i.reverse()}for(let i=0;i<o.next.length;i++){let{type:l,next:a}=o.next[i];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!s.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),n[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];function n(r){t.push(r);for(let s=0;s<r.next.length;s++)t.indexOf(r.next[s].next)==-1&&n(r.next[s].next)}return n(this),t.map((r,s)=>{let o=s+(r.validEnd?"*":" ")+" ";for(let i=0;i<r.next.length;i++)o+=(i?", ":"")+r.next[i].type.name+"->"+t.indexOf(r.next[i].next);return o}).join(`
201
+ `)}}bl.empty=new bl(!0);class z7{constructor(t,n){this.string=t,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=t.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(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function ZI(e){let t=[];do t.push(_7(e));while(e.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function _7(e){let t=[];do t.push(F7(e));while(e.next&&e.next!=")"&&e.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function F7(e){let t=W7(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else if(e.eat("{"))t=B7(e,t);else break;return t}function uN(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function B7(e,t){let n=uN(e),r=n;return e.eat(",")&&(e.next!="}"?r=uN(e):r=-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function H7(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let s=[];for(let o in n){let i=n[o];i.isInGroup(t)&&s.push(i)}return s.length==0&&e.err("No node type or group '"+t+"' found"),s}function W7(e){if(e.eat("(")){let t=ZI(e);return e.eat(")")||e.err("Missing closing paren"),t}else if(/\W/.test(e.next))e.err("Unexpected token '"+e.next+"'");else{let t=H7(e,e.next).map(n=>(e.inline==null?e.inline=n.isInline:e.inline!=n.isInline&&e.err("Mixing inline and block content"),{type:"name",value:n}));return e.pos++,t.length==1?t[0]:{type:"choice",exprs:t}}}function U7(e){let t=[[]];return s(o(e,0),n()),t;function n(){return t.push([])-1}function r(i,l,a){let c={term:a,to:l};return t[i].push(c),c}function s(i,l){i.forEach(a=>a.to=l)}function o(i,l){if(i.type=="choice")return i.exprs.reduce((a,c)=>a.concat(o(c,l)),[]);if(i.type=="seq")for(let a=0;;a++){let c=o(i.exprs[a],l);if(a==i.exprs.length-1)return c;s(c,l=n())}else if(i.type=="star"){let a=n();return r(l,a),s(o(i.expr,a),a),[r(a)]}else if(i.type=="plus"){let a=n();return s(o(i.expr,l),a),s(o(i.expr,a),a),[r(a)]}else{if(i.type=="opt")return[r(l)].concat(o(i.expr,l));if(i.type=="range"){let a=l;for(let c=0;c<i.min;c++){let u=n();s(o(i.expr,a),u),a=u}if(i.max==-1)s(o(i.expr,a),a);else for(let c=i.min;c<i.max;c++){let u=n();r(a,u),s(o(i.expr,a),u),a=u}return[r(a)]}else{if(i.type=="name")return[r(l,void 0,i.value)];throw new Error("Unknown expr type")}}}}function eD(e,t){return t-e}function dN(e,t){let n=[];return r(t),n.sort(eD);function r(s){let o=e[s];if(o.length==1&&!o[0].term)return r(o[0].to);n.push(s);for(let i=0;i<o.length;i++){let{term:l,to:a}=o[i];!l&&n.indexOf(a)==-1&&r(a)}}}function V7(e){let t=Object.create(null);return n(dN(e,0));function n(r){let s=[];r.forEach(i=>{e[i].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<s.length;u++)s[u][0]==l&&(c=s[u][1]);dN(e,a).forEach(u=>{c||s.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let o=t[r.join(",")]=new bl(r.indexOf(e.length-1)>-1);for(let i=0;i<s.length;i++){let l=s[i][1].sort(eD);o.next.push({type:s[i][0],next:t[l.join(",")]||n(l)})}return o}}function K7(e,t){for(let n=0,r=[e];n<r.length;n++){let s=r[n],o=!s.validEnd,i=[];for(let l=0;l<s.next.length;l++){let{type:a,next:c}=s.next[l];i.push(a.name),o&&!(a.isText||a.hasRequiredAttrs())&&(o=!1),r.indexOf(c)==-1&&r.push(c)}o&&t.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function tD(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function nD(e,t){let n=Object.create(null);for(let r in e){let s=t&&t[r];if(s===void 0){let o=e[r];if(o.hasDefault)s=o.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=s}return n}function rD(e,t,n,r){for(let s in t)if(!(s in e))throw new RangeError(`Unsupported attribute ${s} for ${n} of type ${r}`);for(let s in e)e[s].validate&&e[s].validate(t[s])}function sD(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new Y7(e,r,t[r]);return n}let fN=class oD{constructor(t,n,r){this.name=t,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=sD(t,r.attrs),this.defaultAttrs=tD(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||t=="text"),this.isText=t=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==bl.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(t){return this.groups.indexOf(t)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:nD(this.attrs,t)}create(t=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new ii(this,this.computeAttrs(t),Z.from(n),gt.setFrom(r))}createChecked(t=null,n,r){return n=Z.from(n),this.checkContent(n),new ii(this,this.computeAttrs(t),n,gt.setFrom(r))}createAndFill(t=null,n,r){if(t=this.computeAttrs(t),n=Z.from(n),n.size){let i=this.contentMatch.fillBefore(n);if(!i)return null;n=i.append(n)}let s=this.contentMatch.matchFragment(n),o=s&&s.fillBefore(Z.empty,!0);return o?new ii(this,t,n.append(o),gt.setFrom(r)):null}validContent(t){let n=this.contentMatch.matchFragment(t);if(!n||!n.validEnd)return!1;for(let r=0;r<t.childCount;r++)if(!this.allowsMarks(t.child(r).marks))return!1;return!0}checkContent(t){if(!this.validContent(t))throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0,50)}`)}checkAttrs(t){rD(this.attrs,t,"node",this.name)}allowsMarkType(t){return this.markSet==null||this.markSet.indexOf(t)>-1}allowsMarks(t){if(this.markSet==null)return!0;for(let n=0;n<t.length;n++)if(!this.allowsMarkType(t[n].type))return!1;return!0}allowedMarks(t){if(this.markSet==null)return t;let n;for(let r=0;r<t.length;r++)this.allowsMarkType(t[r].type)?n&&n.push(t[r]):n||(n=t.slice(0,r));return n?n.length?n:gt.none:t}static compile(t,n){let r=Object.create(null);t.forEach((o,i)=>r[o]=new oD(o,n,i));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 o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function q7(e,t,n){let r=n.split("|");return s=>{let o=s===null?"null":typeof s;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${o}`)}}class Y7{constructor(t,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?q7(t,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Tm{constructor(t,n,r,s){this.name=t,this.rank=n,this.schema=r,this.spec=s,this.attrs=sD(t,s.attrs),this.excluded=null;let o=tD(this.attrs);this.instance=o?new gt(this,o):null}create(t=null){return!t&&this.instance?this.instance:new gt(this,nD(this.attrs,t))}static compile(t,n){let r=Object.create(null),s=0;return t.forEach((o,i)=>r[o]=new Tm(o,s++,n,i)),r}removeFromSet(t){for(var n=0;n<t.length;n++)t[n].type==this&&(t=t.slice(0,n).concat(t.slice(n+1)),n--);return t}isInSet(t){for(let n=0;n<t.length;n++)if(t[n].type==this)return t[n]}checkAttrs(t){rD(this.attrs,t,"mark",this.name)}excludes(t){return this.excluded.indexOf(t)>-1}}class iD{constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let s in t)n[s]=t[s];n.nodes=gn.from(t.nodes),n.marks=gn.from(t.marks||{}),this.nodes=fN.compile(this.spec.nodes,this),this.marks=Tm.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 o=this.nodes[s],i=o.spec.content||"",l=o.spec.marks;if(o.contentMatch=r[i]||(r[i]=bl.parse(i,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=l=="_"?null:l?hN(this,l.split(" ")):l==""||!o.inlineContent?[]:null}for(let s in this.marks){let o=this.marks[s],i=o.spec.excludes;o.excluded=i==null?[o]:i==""?[]:hN(this,i.split(" "))}this.nodeFromJSON=s=>ii.fromJSON(this,s),this.markFromJSON=s=>gt.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,n=null,r,s){if(typeof t=="string")t=this.nodeType(t);else if(t instanceof fN){if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}else throw new RangeError("Invalid node type: "+t);return t.createChecked(n,r,s)}text(t,n){let r=this.nodes.text;return new tp(r,r.defaultAttrs,t,gt.setFrom(n))}mark(t,n){return typeof t=="string"&&(t=this.marks[t]),t.create(n)}nodeType(t){let n=this.nodes[t];if(!n)throw new RangeError("Unknown node type: "+t);return n}}function hN(e,t){let n=[];for(let r=0;r<t.length;r++){let s=t[r],o=e.marks[s],i=o;if(o)n.push(o);else for(let l in e.marks){let a=e.marks[l];(s=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(s)>-1)&&n.push(i=a)}if(!i)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}function G7(e){return e.tag!=null}function J7(e){return e.style!=null}class li{constructor(t,n){this.schema=t,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(s=>{if(G7(s))this.tags.push(s);else if(J7(s)){let o=/[^=]*/.exec(s.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let o=t.nodes[s.node];return o.contentMatch.matchType(o)})}parse(t,n={}){let r=new mN(this,n,!1);return r.addAll(t,gt.none,n.from,n.to),r.finish()}parseSlice(t,n={}){let r=new mN(this,n,!0);return r.addAll(t,gt.none,n.from,n.to),xe.maxOpen(r.finish())}matchTag(t,n,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let o=this.tags[s];if(Z7(t,o.tag)&&(o.namespace===void 0||t.namespaceURI==o.namespace)&&(!o.context||n.matchesContext(o.context))){if(o.getAttrs){let i=o.getAttrs(t);if(i===!1)continue;o.attrs=i||void 0}return o}}}matchStyle(t,n,r,s){for(let o=s?this.styles.indexOf(s)+1:0;o<this.styles.length;o++){let i=this.styles[o],l=i.style;if(!(l.indexOf(t)!=0||i.context&&!r.matchesContext(i.context)||l.length>t.length&&(l.charCodeAt(t.length)!=61||l.slice(t.length+1)!=n))){if(i.getAttrs){let a=i.getAttrs(n);if(a===!1)continue;i.attrs=a||void 0}return i}}}static schemaRules(t){let n=[];function r(s){let o=s.priority==null?50:s.priority,i=0;for(;i<n.length;i++){let l=n[i];if((l.priority==null?50:l.priority)<o)break}n.splice(i,0,s)}for(let s in t.marks){let o=t.marks[s].spec.parseDOM;o&&o.forEach(i=>{r(i=gN(i)),i.mark||i.ignore||i.clearMark||(i.mark=s)})}for(let s in t.nodes){let o=t.nodes[s].spec.parseDOM;o&&o.forEach(i=>{r(i=gN(i)),i.node||i.ignore||i.mark||(i.node=s)})}return n}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new li(t,li.schemaRules(t)))}}const lD={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Q7={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},aD={ol:!0,ul:!0},Wu=1,Qk=2,au=4;function pN(e,t,n){return t!=null?(t?Wu:0)|(t==="full"?Qk:0):e&&e.whitespace=="pre"?Wu|Qk:n&~au}class mf{constructor(t,n,r,s,o,i){this.type=t,this.attrs=n,this.marks=r,this.solid=s,this.options=i,this.content=[],this.activeMarks=gt.none,this.match=o||(i&au?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(Z.from(t));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(t.type))?(this.match=r,s):null}}return this.match.findWrapping(t.type)}finish(t){if(!(this.options&Wu)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-s[0].length))}}let n=Z.from(this.content);return!t&&this.match&&(n=n.append(this.match.fillBefore(Z.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!lD.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class mN{constructor(t,n,r){this.parser=t,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=n.topNode,o,i=pN(null,n.preserveWhitespace,0)|(r?au:0);s?o=new mf(s.type,s.attrs,gt.none,!0,n.topMatch||s.type.contentMatch,i):r?o=new mf(null,null,gt.none,!0,null,i):o=new mf(t.schema.topNodeType,null,gt.none,!0,null,i),this.nodes=[o],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,n){t.nodeType==3?this.addTextNode(t,n):t.nodeType==1&&this.addElement(t,n)}addTextNode(t,n){let r=t.nodeValue,s=this.top,o=s.options&Qk?"full":this.localPreserveWS||(s.options&Wu)>0,{schema:i}=this.parser;if(o==="full"||s.inlineContext(t)||/[^ \t\r\n\u000c]/.test(r)){if(o)if(o==="full")r=r.replace(/\r\n?/g,`
202
+ `);else if(i.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(i.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(i.linebreakReplacement.create(),n,!0),l[a]&&this.insertNode(i.text(l[a]),n,!/\S/.test(l[a]));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 l=s.content[s.content.length-1],a=t.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(i.text(r),n,!/\S/.test(r)),this.findInText(t)}else this.findInside(t)}addElement(t,n,r){let s=this.localPreserveWS,o=this.top;(t.tagName=="PRE"||/pre/.test(t.style&&t.style.whiteSpace))&&(this.localPreserveWS=!0);let i=t.nodeName.toLowerCase(),l;aD.hasOwnProperty(i)&&this.parser.normalizeLists&&X7(t);let a=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(l=this.parser.matchTag(t,this,r));e:if(a?a.ignore:Q7.hasOwnProperty(i))this.findInside(t),this.ignoreFallback(t,n);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(t=a.skip);let c,u=this.needsBlock;if(lD.hasOwnProperty(i))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),c=!0,o.type||(this.needsBlock=!0);else if(!t.firstChild){this.leafFallback(t,n);break e}let f=a&&a.skip?n:this.readStyles(t,n);f&&this.addAll(t,f),c&&this.sync(o),this.needsBlock=u}else{let c=this.readStyles(t,n);c&&this.addElementByRule(t,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=s}leafFallback(t,n){t.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode(`
203
+ `),n)}ignoreFallback(t,n){t.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(t,n){let r=t.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let o=this.parser.matchedStyles[s],i=r.getPropertyValue(o);if(i)for(let l=void 0;;){let a=this.parser.matchStyle(o,i,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?n=n.filter(c=>!a.clearMark(c)):n=n.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return n}addElementByRule(t,n,r,s){let o,i;if(n.node)if(i=this.parser.schema.nodes[n.node],i.isLeaf)this.insertNode(i.create(n.attrs),r,t.nodeName=="BR")||this.leafFallback(t,r);else{let a=this.enter(i,n.attrs||null,r,n.preserveWhitespace);a&&(o=!0,r=a)}else{let a=this.parser.schema.marks[n.mark];r=r.concat(a.create(n.attrs))}let l=this.top;if(i&&i.isLeaf)this.findInside(t);else if(s)this.addElement(t,r,s);else if(n.getContent)this.findInside(t),n.getContent(t,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=t;typeof n.contentElement=="string"?a=t.querySelector(n.contentElement):typeof n.contentElement=="function"?a=n.contentElement(t):n.contentElement&&(a=n.contentElement),this.findAround(t,a,!0),this.addAll(a,r),this.findAround(t,a,!1)}o&&this.sync(l)&&this.open--}addAll(t,n,r,s){let o=r||0;for(let i=r?t.childNodes[r]:t.firstChild,l=s==null?null:t.childNodes[s];i!=l;i=i.nextSibling,++o)this.findAtPoint(t,o),this.addDOM(i,n);this.findAtPoint(t,o)}findPlace(t,n,r){let s,o;for(let i=this.open,l=0;i>=0;i--){let a=this.nodes[i],c=a.findWrapping(t);if(c&&(!s||s.length>c.length+l)&&(s=c,o=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!s)return null;this.sync(o);for(let i=0;i<s.length;i++)n=this.enterInner(s[i],null,n,!1);return n}insertNode(t,n,r){if(t.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(n=this.enterInner(o,null,n))}let s=this.findPlace(t,n,r);if(s){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(t.type));let i=gt.none;for(let l of s.concat(t.marks))(o.type?o.type.allowsMarkType(l.type):yN(l.type,t.type))&&(i=l.addToSet(i));return o.content.push(t.mark(i)),!0}return!1}enter(t,n,r,s){let o=this.findPlace(t.create(n),r,!1);return o&&(o=this.enterInner(t,n,r,!0,s)),o}enterInner(t,n,r,s=!1,o){this.closeExtra();let i=this.top;i.match=i.match&&i.match.matchType(t);let l=pN(t,o,i.options);i.options&au&&i.content.length==0&&(l|=au);let a=gt.none;return r=r.filter(c=>(i.type?i.type.allowsMarkType(c.type):yN(c.type,t))?(a=c.addToSet(a),!1):!0),this.nodes.push(new mf(t,n,a,s,null,l)),this.open++,r}closeExtra(t=!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(t));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(t){for(let n=this.open;n>=0;n--){if(this.nodes[n]==t)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Wu)}return!1}get currentPos(){this.closeExtra();let t=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let s=r.length-1;s>=0;s--)t+=r[s].nodeSize;n&&t++}return t}findAtPoint(t,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==t&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&t.nodeType==1&&t.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(t,n,r){if(t!=n&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&t.nodeType==1&&t.contains(this.find[s].node)&&n.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].pos=this.currentPos)}findInText(t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==t&&(this.find[n].pos=this.currentPos-(t.nodeValue.length-this.find[n].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let n=t.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(s?0:1),i=(l,a)=>{for(;l>=0;l--){let c=n[l];if(c==""){if(l==n.length-1||l==0)continue;for(;a>=o;a--)if(i(l-1,a))return!0;return!1}else{let u=a>0||a==0&&s?this.nodes[a].type:r&&a>=o?r.node(a-o).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return i(n.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.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 X7(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let r=t.nodeType==1?t.nodeName.toLowerCase():null;r&&aD.hasOwnProperty(r)&&n?(n.appendChild(t),t=n):r=="li"?n=t:r&&(n=null)}}function Z7(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function gN(e){let t={};for(let n in e)t[n]=e[n];return t}function yN(e,t){let n=t.schema.nodes;for(let r in n){let s=n[r];if(!s.allowsMarkType(e))continue;let o=[],i=l=>{o.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==t||o.indexOf(u)<0&&i(u))return!0}};if(i(s.contentMatch))return!0}}class Ml{constructor(t,n){this.nodes=t,this.marks=n}serializeFragment(t,n={},r){r||(r=gf(n).createDocumentFragment());let s=r,o=[];return t.forEach(i=>{if(o.length||i.marks.length){let l=0,a=0;for(;l<o.length&&a<i.marks.length;){let c=i.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(o[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<o.length;)s=o.pop()[1];for(;a<i.marks.length;){let c=i.marks[a++],u=this.serializeMark(c,i.isInline,n);u&&(o.push([c,s]),s.appendChild(u.dom),s=u.contentDOM||u.dom)}}s.appendChild(this.serializeNodeInner(i,n))}),r}serializeNodeInner(t,n){if(t.isText)return gf(n).createTextNode(t.text);let{dom:r,contentDOM:s}=eh(gf(n),this.nodes[t.type.name](t),null,t.attrs);if(s){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,n,s)}return r}serializeNode(t,n={}){let r=this.serializeNodeInner(t,n);for(let s=t.marks.length-1;s>=0;s--){let o=this.serializeMark(t.marks[s],t.isInline,n);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(t,n,r={}){let s=this.marks[t.type.name];return s&&eh(gf(r),s(t,n),null,t.attrs)}static renderSpec(t,n,r=null,s){return typeof n=="string"?{dom:t.createTextNode(n)}:eh(t,n,r,s)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new Ml(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let n=wN(t.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(t){return wN(t.marks)}}function wN(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function gf(e){return e.document||window.document}const kN=new WeakMap;function eq(e){let t=kN.get(e);return t===void 0&&kN.set(e,t=tq(e)),t}function tq(e){let t=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")t||(t=[]),t.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(e),t}function eh(e,t,n,r){if(t.nodeType==1)return{dom:t};if(t.dom&&t.dom.nodeType==1)return t;let s=t[0],o;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=eq(r))&&o.indexOf(t)>-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 i=s.indexOf(" ");i>0&&(n=s.slice(0,i),s=s.slice(i+1));let l,a=n?e.createElementNS(n,s):e.createElement(s),c=t[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let f in c)if(c[f]!=null){let h=f.indexOf(" ");h>0?a.setAttributeNS(f.slice(0,h),f.slice(h+1),c[f]):f=="style"&&a.style?a.style.cssText=c[f]:a.setAttribute(f,c[f])}}for(let f=u;f<t.length;f++){let h=t[f];if(h===0){if(f<t.length-1||f>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else if(typeof h=="string")a.appendChild(e.createTextNode(h));else{let{dom:p,contentDOM:m}=eh(e,h,n,r);if(a.appendChild(p),m){if(l)throw new RangeError("Multiple content holes");l=m}}}return{dom:a,contentDOM:l}}const cD=65535,uD=Math.pow(2,16);function nq(e,t){return e+t*uD}function xN(e){return e&cD}function rq(e){return(e-(e&cD))/uD}const dD=1,fD=2,th=4,hD=8;class Xk{constructor(t,n,r){this.pos=t,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&hD)>0}get deletedBefore(){return(this.delInfo&(dD|th))>0}get deletedAfter(){return(this.delInfo&(fD|th))>0}get deletedAcross(){return(this.delInfo&th)>0}}class kr{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&kr.empty)return kr.empty}recover(t){let n=0,r=xN(t);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+rq(t)}mapResult(t,n=1){return this._map(t,n,!1)}map(t,n=1){return this._map(t,n,!0)}_map(t,n,r){let s=0,o=this.inverted?2:1,i=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?s:0);if(a>t)break;let c=this.ranges[l+o],u=this.ranges[l+i],f=a+c;if(t<=f){let h=c?t==a?-1:t==f?1:n:n,p=a+s+(h<0?0:u);if(r)return p;let m=t==(n<0?a:f)?null:nq(l/3,t-a),y=t==a?fD:t==f?dD:th;return(n<0?t!=a:t!=f)&&(y|=hD),new Xk(p,y,m)}s+=u-c}return r?t+s:new Xk(t+s,0,null)}touches(t,n){let r=0,s=xN(n),o=this.inverted?2:1,i=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>t)break;let c=this.ranges[l+o],u=a+c;if(t<=u&&l==s*3)return!0;r+=this.ranges[l+i]-c}return!1}forEach(t){let n=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,o=0;s<this.ranges.length;s+=3){let i=this.ranges[s],l=i-(this.inverted?o:0),a=i+(this.inverted?0:o),c=this.ranges[s+n],u=this.ranges[s+r];t(l,l+c,a,a+u),o+=u-c}}invert(){return new kr(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?kr.empty:new kr(t<0?[0,-t,0]:[0,0,t])}}kr.empty=new kr([]);class Uu{constructor(t,n,r=0,s=t?t.length:0){this.mirror=n,this.from=r,this.to=s,this._maps=t||[],this.ownData=!(t||n)}get maps(){return this._maps}slice(t=0,n=this.maps.length){return new Uu(this._maps,this.mirror,t,n)}appendMap(t,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(t),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(t){for(let n=0,r=this._maps.length;n<t._maps.length;n++){let s=t.getMirror(n);this.appendMap(t._maps[n],s!=null&&s<n?r+s:void 0)}}getMirror(t){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==t)return this.mirror[n+(n%2?-1:1)]}}setMirror(t,n){this.mirror||(this.mirror=[]),this.mirror.push(t,n)}appendMappingInverted(t){for(let n=t.maps.length-1,r=this._maps.length+t._maps.length;n>=0;n--){let s=t.getMirror(n);this.appendMap(t._maps[n].invert(),s!=null&&s>n?r-s-1:void 0)}}invert(){let t=new Uu;return t.appendMappingInverted(this),t}map(t,n=1){if(this.mirror)return this._map(t,n,!0);for(let r=this.from;r<this.to;r++)t=this._maps[r].map(t,n);return t}mapResult(t,n=1){return this._map(t,n,!1)}_map(t,n,r){let s=0;for(let o=this.from;o<this.to;o++){let i=this._maps[o],l=i.mapResult(t,n);if(l.recover!=null){let a=this.getMirror(o);if(a!=null&&a>o&&a<this.to){o=a,t=this._maps[a].recover(l.recover);continue}}s|=l.delInfo,t=l.pos}return r?t:new Xk(t,s,null)}}const Ay=Object.create(null);class Wn{getMap(){return kr.empty}merge(t){return null}static fromJSON(t,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Ay[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in Ay)throw new RangeError("Duplicate use of step JSON ID "+t);return Ay[t]=n,n.prototype.jsonID=t,n}}class Yt{constructor(t,n){this.doc=t,this.failed=n}static ok(t){return new Yt(t,null)}static fail(t){return new Yt(null,t)}static fromReplace(t,n,r,s){try{return Yt.ok(t.replace(n,r,s))}catch(o){if(o instanceof Bu)return Yt.fail(o.message);throw o}}}function Cb(e,t,n){let r=[];for(let s=0;s<e.childCount;s++){let o=e.child(s);o.content.size&&(o=o.copy(Cb(o.content,t,o))),o.isInline&&(o=t(o,n,s)),r.push(o)}return Z.fromArray(r)}class Go extends Wn{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=t.resolve(this.from),s=r.node(r.sharedDepth(this.to)),o=new xe(Cb(n.content,(i,l)=>!i.isAtom||!l.type.allowsMarkType(this.mark.type)?i:i.mark(this.mark.addToSet(i.marks)),s),n.openStart,n.openEnd);return Yt.fromReplace(t,this.from,this.to,o)}invert(){return new As(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Go(n.pos,r.pos,this.mark)}merge(t){return t instanceof Go&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Go(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Go(n.from,n.to,t.markFromJSON(n.mark))}}Wn.jsonID("addMark",Go);class As extends Wn{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=new xe(Cb(n.content,s=>s.mark(this.mark.removeFromSet(s.marks)),t),n.openStart,n.openEnd);return Yt.fromReplace(t,this.from,this.to,r)}invert(){return new Go(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new As(n.pos,r.pos,this.mark)}merge(t){return t instanceof As&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new As(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new As(n.from,n.to,t.markFromJSON(n.mark))}}Wn.jsonID("removeMark",As);class Jo extends Wn{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.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(t,this.pos,this.pos+1,new xe(Z.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.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 Jo(this.pos,n.marks[s]);return new Jo(this.pos,this.mark)}}return new vl(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new Jo(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Jo(n.pos,t.markFromJSON(n.mark))}}Wn.jsonID("addNodeMark",Jo);class vl extends Wn{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.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(t,this.pos,this.pos+1,new xe(Z.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Jo(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new vl(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new vl(n.pos,t.markFromJSON(n.mark))}}Wn.jsonID("removeNodeMark",vl);class Kt extends Wn{constructor(t,n,r,s=!1){super(),this.from=t,this.to=n,this.slice=r,this.structure=s}apply(t){return this.structure&&Zk(t,this.from,this.to)?Yt.fail("Structure replace would overwrite content"):Yt.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new kr([this.from,this.to-this.from,this.slice.size])}invert(t){return new Kt(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.to,-1),r=this.from==this.to&&Kt.MAP_BIAS<0?n:t.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new Kt(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof Kt)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?xe.empty:new xe(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new Kt(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?xe.empty:new xe(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new Kt(t.from,this.to,n,this.structure)}else return null}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Kt(n.from,n.to,xe.fromJSON(t,n.slice),!!n.structure)}}Kt.MAP_BIAS=1;Wn.jsonID("replace",Kt);class sn extends Wn{constructor(t,n,r,s,o,i,l=!1){super(),this.from=t,this.to=n,this.gapFrom=r,this.gapTo=s,this.slice=o,this.insert=i,this.structure=l}apply(t){if(this.structure&&(Zk(t,this.from,this.gapFrom)||Zk(t,this.gapTo,this.to)))return Yt.fail("Structure gap-replace would overwrite content");let n=t.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(t,this.from,this.to,r):Yt.fail("Content does not fit in gap")}getMap(){return new kr([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new sn(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),s=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||s<n.pos||o>r.pos?null:new sn(n.pos,r.pos,s,o,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,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 sn(n.from,n.to,n.gapFrom,n.gapTo,xe.fromJSON(t,n.slice),n.insert,!!n.structure)}}Wn.jsonID("replaceAround",sn);function Zk(e,t,n){let r=e.resolve(t),s=n-t,o=r.depth;for(;s>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,s--;if(s>0){let i=r.node(o).maybeChild(r.indexAfter(o));for(;s>0;){if(!i||i.isLeaf)return!0;i=i.firstChild,s--}}return!1}function sq(e,t,n,r){let s=[],o=[],i,l;e.doc.nodesBetween(t,n,(a,c,u)=>{if(!a.isInline)return;let f=a.marks;if(!r.isInSet(f)&&u.type.allowsMarkType(r.type)){let h=Math.max(c,t),p=Math.min(c+a.nodeSize,n),m=r.addToSet(f);for(let y=0;y<f.length;y++)f[y].isInSet(m)||(i&&i.to==h&&i.mark.eq(f[y])?i.to=p:s.push(i=new As(h,p,f[y])));l&&l.to==h?l.to=p:o.push(l=new Go(h,p,r))}}),s.forEach(a=>e.step(a)),o.forEach(a=>e.step(a))}function oq(e,t,n,r){let s=[],o=0;e.doc.nodesBetween(t,n,(i,l)=>{if(!i.isInline)return;o++;let a=null;if(r instanceof Tm){let c=i.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(i.marks)&&(a=[r]):a=i.marks;if(a&&a.length){let c=Math.min(l+i.nodeSize,n);for(let u=0;u<a.length;u++){let f=a[u],h;for(let p=0;p<s.length;p++){let m=s[p];m.step==o-1&&f.eq(s[p].style)&&(h=m)}h?(h.to=c,h.step=o):s.push({style:f,from:Math.max(l,t),to:c,step:o})}}}),s.forEach(i=>e.step(new As(i.from,i.to,i.style)))}function Eb(e,t,n,r=n.contentMatch,s=!0){let o=e.doc.nodeAt(t),i=[],l=t+1;for(let a=0;a<o.childCount;a++){let c=o.child(a),u=l+c.nodeSize,f=r.matchType(c.type);if(!f)i.push(new Kt(l,u,xe.empty));else{r=f;for(let h=0;h<c.marks.length;h++)n.allowsMarkType(c.marks[h].type)||e.step(new As(l,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 xe(Z.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),i.push(new Kt(l+h.index,l+h.index+h[0].length,m))}}l=u}if(!r.validEnd){let a=r.fillBefore(Z.empty,!0);e.replace(l,l,new xe(a,0,0))}for(let a=i.length-1;a>=0;a--)e.step(i[a])}function iq(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function sc(e){let n=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let r=e.depth,s=0,o=0;;--r){let i=e.$from.node(r),l=e.$from.index(r)+s,a=e.$to.indexAfter(r)-o;if(r<e.depth&&i.canReplace(l,a,n))return r;if(r==0||i.type.spec.isolating||!iq(i,l,a))break;l&&(s=1),a<i.childCount&&(o=1)}return null}function lq(e,t,n){let{$from:r,$to:s,depth:o}=t,i=r.before(o+1),l=s.after(o+1),a=i,c=l,u=Z.empty,f=0;for(let m=o,y=!1;m>n;m--)y||r.index(m)>0?(y=!0,u=Z.from(r.node(m).copy(u)),f++):a--;let h=Z.empty,p=0;for(let m=o,y=!1;m>n;m--)y||s.after(m+1)<s.end(m)?(y=!0,h=Z.from(s.node(m).copy(h)),p++):c++;e.step(new sn(a,c,i,l,new xe(u.append(h),f,p),u.size-f,!0))}function Nb(e,t,n=null,r=e){let s=aq(e,t),o=s&&cq(r,t);return o?s.map(bN).concat({type:t,attrs:n}).concat(o.map(bN)):null}function bN(e){return{type:e,attrs:null}}function aq(e,t){let{parent:n,startIndex:r,endIndex:s}=e,o=n.contentMatchAt(r).findWrapping(t);if(!o)return null;let i=o.length?o[0]:t;return n.canReplaceWith(r,s,i)?o:null}function cq(e,t){let{parent:n,startIndex:r,endIndex:s}=e,o=n.child(r),i=t.contentMatch.findWrapping(o.type);if(!i)return null;let a=(i.length?i[i.length-1]:t).contentMatch;for(let c=r;a&&c<s;c++)a=a.matchType(n.child(c).type);return!a||!a.validEnd?null:i}function uq(e,t,n){let r=Z.empty;for(let i=n.length-1;i>=0;i--){if(r.size){let l=n[i].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=Z.from(n[i].type.create(n[i].attrs,r))}let s=t.start,o=t.end;e.step(new sn(s,o,s,o,new xe(r,0,0),n.length,!0))}function dq(e,t,n,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=e.steps.length;e.doc.nodesBetween(t,n,(i,l)=>{let a=typeof s=="function"?s(i):s;if(i.isTextblock&&!i.hasMarkup(r,a)&&fq(e.doc,e.mapping.slice(o).map(l),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&&mD(e,i,l,o),Eb(e,e.mapping.slice(o).map(l,1),r,void 0,c===null);let u=e.mapping.slice(o),f=u.map(l,1),h=u.map(l+i.nodeSize,1);return e.step(new sn(f,h,f+1,h-1,new xe(Z.from(r.create(a,null,i.marks)),0,0),1,!0)),c===!0&&pD(e,i,l,o),!1}})}function pD(e,t,n,r){t.forEach((s,o)=>{if(s.isText){let i,l=/\r?\n|\r/g;for(;i=l.exec(s.text);){let a=e.mapping.slice(r).map(n+1+o+i.index);e.replaceWith(a,a+1,t.type.schema.linebreakReplacement.create())}}})}function mD(e,t,n,r){t.forEach((s,o)=>{if(s.type==s.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+o);e.replaceWith(i,i+1,t.type.schema.text(`
204
+ `))}})}function fq(e,t,n){let r=e.resolve(t),s=r.index();return r.parent.canReplaceWith(s,s+1,n)}function hq(e,t,n,r,s){let o=e.doc.nodeAt(t);if(!o)throw new RangeError("No node at given position");n||(n=o.type);let i=n.create(r,null,s||o.marks);if(o.isLeaf)return e.replaceWith(t,t+o.nodeSize,i);if(!n.validContent(o.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new sn(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new xe(Z.from(i),0,0),1,!0))}function ao(e,t,n=1,r){let s=e.resolve(t),o=s.depth-n,i=r&&r[r.length-1]||s.parent;if(o<0||s.parent.type.spec.isolating||!s.parent.canReplace(s.index(),s.parent.childCount)||!i.type.validContent(s.parent.content.cutByIndex(s.index(),s.parent.childCount)))return!1;for(let c=s.depth-1,u=n-2;c>o;c--,u--){let f=s.node(c),h=s.index(c);if(f.type.spec.isolating)return!1;let p=f.content.cutByIndex(h,f.childCount),m=r&&r[u+1];m&&(p=p.replaceChild(0,m.type.create(m.attrs)));let y=r&&r[u]||f;if(!f.canReplace(h+1,f.childCount)||!y.type.validContent(p))return!1}let l=s.indexAfter(o),a=r&&r[0];return s.node(o).canReplaceWith(l,l,a?a.type:s.node(o+1).type)}function pq(e,t,n=1,r){let s=e.doc.resolve(t),o=Z.empty,i=Z.empty;for(let l=s.depth,a=s.depth-n,c=n-1;l>a;l--,c--){o=Z.from(s.node(l).copy(o));let u=r&&r[c];i=Z.from(u?u.type.create(u.attrs,i):s.node(l).copy(i))}e.step(new Kt(t,t,new xe(o.append(i),n,n),!0))}function Si(e,t){let n=e.resolve(t),r=n.index();return gD(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function mq(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let s=0;s<t.childCount;s++){let o=t.child(s),i=o.type==r?e.type.schema.nodes.text:o.type;if(n=n.matchType(i),!n||!e.type.allowsMarks(o.marks))return!1}return n.validEnd}function gD(e,t){return!!(e&&t&&!e.isLeaf&&mq(e,t))}function Am(e,t,n=-1){let r=e.resolve(t);for(let s=r.depth;;s--){let o,i,l=r.index(s);if(s==r.depth?(o=r.nodeBefore,i=r.nodeAfter):n>0?(o=r.node(s+1),l++,i=r.node(s).maybeChild(l)):(o=r.node(s).maybeChild(l-1),i=r.node(s+1)),o&&!o.isTextblock&&gD(o,i)&&r.node(s).canReplace(l,l+1))return t;if(s==0)break;t=n<0?r.before(s):r.after(s)}}function gq(e,t,n){let r=null,{linebreakReplacement:s}=e.doc.type.schema,o=e.doc.resolve(t-n),i=o.node().type;if(s&&i.inlineContent){let u=i.whitespace=="pre",f=!!i.contentMatch.matchType(s);u&&!f?r=!1:!u&&f&&(r=!0)}let l=e.steps.length;if(r===!1){let u=e.doc.resolve(t+n);mD(e,u.node(),u.before(),l)}i.inlineContent&&Eb(e,t+n-1,i,o.node().contentMatchAt(o.index()),r==null);let a=e.mapping.slice(l),c=a.map(t-n);if(e.step(new Kt(c,a.map(t+n,-1),xe.empty,!0)),r===!0){let u=e.doc.resolve(c);pD(e,u.node(),u.before(),e.steps.length)}return e}function yq(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(r.parentOffset==0)for(let s=r.depth-1;s>=0;s--){let o=r.index(s);if(r.node(s).canReplaceWith(o,o,n))return r.before(s+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let s=r.depth-1;s>=0;s--){let o=r.indexAfter(s);if(r.node(s).canReplaceWith(o,o,n))return r.after(s+1);if(o<r.node(s).childCount)return null}return null}function yD(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let s=n.content;for(let o=0;o<n.openStart;o++)s=s.firstChild.content;for(let o=1;o<=(n.openStart==0&&n.size?2:1);o++)for(let i=r.depth;i>=0;i--){let l=i==r.depth?0:r.pos<=(r.start(i+1)+r.end(i+1))/2?-1:1,a=r.index(i)+(l>0?1:0),c=r.node(i),u=!1;if(o==1)u=c.canReplace(a,a,s);else{let f=c.contentMatchAt(a).findWrapping(s.firstChild.type);u=f&&c.canReplaceWith(a,a,f[0])}if(u)return l==0?r.pos:l<0?r.before(i+1):r.after(i+1)}return null}function jm(e,t,n=t,r=xe.empty){if(t==n&&!r.size)return null;let s=e.resolve(t),o=e.resolve(n);return wD(s,o,r)?new Kt(t,n,r):new wq(s,o,r).fit()}function wD(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}class wq{constructor(t,n,r){this.$from=t,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=Z.empty;for(let s=0;s<=t.depth;s++){let o=t.node(s);this.frontier.push({type:o.type,match:o.contentMatchAt(t.indexAfter(s))})}for(let s=t.depth;s>0;s--)this.placed=Z.from(t.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 t=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,s=this.close(t<0?this.$to:r.doc.resolve(t));if(!s)return null;let o=this.placed,i=r.depth,l=s.depth;for(;i&&l&&o.childCount==1;)o=o.firstChild.content,i--,l--;let a=new xe(o,i,l);return t>-1?new sn(r.pos,t,this.$to.pos,this.$to.end(),a,n):a.size||r.pos!=this.$to.pos?new Kt(r.pos,s.pos,a):null}findFittable(){let t=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,s=this.unplaced.openEnd;r<t;r++){let o=n.firstChild;if(n.childCount>1&&(s=0),o.type.spec.isolating&&s<=r){t=r;break}n=o.content}for(let n=1;n<=2;n++)for(let r=n==1?t:this.unplaced.openStart;r>=0;r--){let s,o=null;r?(o=jy(this.unplaced.content,r-1).firstChild,s=o.content):s=this.unplaced.content;let i=s.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],u,f=null;if(n==1&&(i?c.matchType(i.type)||(f=c.fillBefore(Z.from(i),!1)):o&&a.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:l,parent:o,inject:f};if(n==2&&i&&(u=c.findWrapping(i.type)))return{sliceDepth:r,frontierDepth:l,parent:o,wrap:u};if(o&&c.matchType(o.type))break}}}openMore(){let{content:t,openStart:n,openEnd:r}=this.unplaced,s=jy(t,n);return!s.childCount||s.firstChild.isLeaf?!1:(this.unplaced=new xe(t,n+1,Math.max(r,s.size+n>=t.size-r?n+1:0)),!0)}dropNode(){let{content:t,openStart:n,openEnd:r}=this.unplaced,s=jy(t,n);if(s.childCount<=1&&n>0){let o=t.size-n<=n+s.size;this.unplaced=new xe($c(t,n-1,1),n-1,o?n-1:r)}else this.unplaced=new xe($c(t,n,1),n,r)}placeNodes({sliceDepth:t,frontierDepth:n,parent:r,inject:s,wrap:o}){for(;this.depth>n;)this.closeFrontierNode();if(o)for(let y=0;y<o.length;y++)this.openFrontierNode(o[y]);let i=this.unplaced,l=r?r.content:i.content,a=i.openStart-t,c=0,u=[],{match:f,type:h}=this.frontier[n];if(s){for(let y=0;y<s.childCount;y++)u.push(s.child(y));f=f.matchFragment(s)}let p=l.size+t-(i.content.size-i.openEnd);for(;c<l.childCount;){let y=l.child(c),x=f.matchType(y.type);if(!x)break;c++,(c>1||a==0||y.content.size)&&(f=x,u.push(kD(y.mark(h.allowedMarks(y.marks)),c==1?a:0,c==l.childCount?p:-1)))}let m=c==l.childCount;m||(p=-1),this.placed=zc(this.placed,n,Z.from(u)),this.frontier[n].match=f,m&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let y=0,x=l;y<p;y++){let k=x.lastChild;this.frontier.push({type:k.type,match:k.contentMatchAt(k.childCount)}),x=k.content}this.unplaced=m?t==0?xe.empty:new xe($c(i.content,t-1,1),t-1,p<0?i.openEnd:t-1):new xe($c(i.content,t,c),i.openStart,i.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let t=this.frontier[this.depth],n;if(!t.type.isTextblock||!My(this.$to,this.$to.depth,t.type,t.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(t){e:for(let n=Math.min(this.depth,t.depth);n>=0;n--){let{match:r,type:s}=this.frontier[n],o=n<t.depth&&t.end(n+1)==t.pos+(t.depth-(n+1)),i=My(t,n,s,r,o);if(i){for(let l=n-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],u=My(t,l,c,a,!0);if(!u||u.childCount)continue e}return{depth:n,fit:i,move:o?t.doc.resolve(t.after(n+1)):t}}}}close(t){let n=this.findCloseLevel(t);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=zc(this.placed,n.depth,n.fit)),t=n.move;for(let r=n.depth+1;r<=t.depth;r++){let s=t.node(r),o=s.type.contentMatch.fillBefore(s.content,!0,t.index(r));this.openFrontierNode(s.type,s.attrs,o)}return t}openFrontierNode(t,n=null,r){let s=this.frontier[this.depth];s.match=s.match.matchType(t),this.placed=zc(this.placed,this.depth,Z.from(t.create(n,r))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(Z.empty,!0);n.childCount&&(this.placed=zc(this.placed,this.frontier.length,n))}}function $c(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy($c(e.firstChild.content,t-1,n)))}function zc(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(zc(e.lastChild.content,t-1,n)))}function jy(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function kD(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,kD(r.firstChild,t-1,r.childCount==1?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(Z.empty,!0)))),e.copy(r)}function My(e,t,n,r,s){let o=e.node(t),i=s?e.indexAfter(t):e.index(t);if(i==o.childCount&&!n.compatibleContent(o.type))return null;let l=r.fillBefore(o.content,!0,i);return l&&!kq(n,o.content,i)?l:null}function kq(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function xq(e){return e.spec.defining||e.spec.definingForContent}function bq(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let s=e.doc.resolve(t),o=e.doc.resolve(n);if(wD(s,o,r))return e.step(new Kt(t,n,r));let i=bD(s,o);i[i.length-1]==0&&i.pop();let l=-(s.depth+1);i.unshift(l);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;i.indexOf(h)>-1?l=h:s.before(h)==p&&i.splice(1,0,-h)}let a=i.indexOf(l),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=xq(p.type);if(m&&!p.sameMarkup(s.node(Math.abs(l)-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 y=0;y<i.length;y++){let x=i[(y+a)%i.length],k=!0;x<0&&(k=!1,x=-x);let v=s.node(x-1),b=s.index(x-1);if(v.canReplaceWith(b,b,m.type,m.marks))return e.replace(s.before(x),k?o.after(x):n,new xe(xD(r.content,0,r.openStart,p),p,r.openEnd))}}let f=e.steps.length;for(let h=i.length-1;h>=0&&(e.replace(t,n,r),!(e.steps.length>f));h--){let p=i[h];p<0||(t=s.before(p),n=o.after(p))}}function xD(e,t,n,r,s){if(t<n){let o=e.firstChild;e=e.replaceChild(0,o.copy(xD(o.content,t+1,n,r,o)))}if(t>r){let o=s.contentMatchAt(0),i=o.fillBefore(e).append(e);e=i.append(o.matchFragment(i).fillBefore(Z.empty,!0))}return e}function vq(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let s=yq(e.doc,t,r.type);s!=null&&(t=n=s)}e.replaceRange(t,n,new xe(Z.from(r),0,0))}function Sq(e,t,n){let r=e.doc.resolve(t),s=e.doc.resolve(n);if(r.parent.isTextblock&&s.parent.isTextblock&&r.start()!=s.start()&&r.parentOffset==0&&s.parentOffset==0){let i=r.sharedDepth(n),l=!1;for(let a=r.depth;a>i;a--)r.node(a).type.spec.isolating&&(l=!0);for(let a=s.depth;a>i;a--)s.node(a).type.spec.isolating&&(l=!0);if(!l){for(let a=r.depth;a>0&&t==r.start(a);a--)t=r.before(a);for(let a=s.depth;a>0&&n==s.start(a);a--)n=s.before(a);r=e.doc.resolve(t),s=e.doc.resolve(n)}}let o=bD(r,s);for(let i=0;i<o.length;i++){let l=o[i],a=i==o.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return e.delete(r.start(l),s.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),s.indexAfter(l-1))))return e.delete(r.before(l),s.after(l))}for(let i=1;i<=r.depth&&i<=s.depth;i++)if(t-r.start(i)==r.depth-i&&n>r.end(i)&&s.end(i)-n!=s.depth-i&&r.start(i-1)==s.start(i-1)&&r.node(i-1).canReplace(r.index(i-1),s.index(i-1)))return e.delete(r.before(i),n);e.delete(t,n)}function bD(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let s=r;s>=0;s--){let o=e.start(s);if(o<e.pos-(e.depth-s)||t.end(s)>t.pos+(t.depth-s)||e.node(s).type.spec.isolating||t.node(s).type.spec.isolating)break;(o==t.start(s)||s==e.depth&&s==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&s&&t.start(s-1)==o-1)&&n.push(s)}return n}class ja extends Wn{constructor(t,n,r){super(),this.pos=t,this.attr=n,this.value=r}apply(t){let n=t.nodeAt(this.pos);if(!n)return Yt.fail("No node at attribute step's position");let r=Object.create(null);for(let o in n.attrs)r[o]=n.attrs[o];r[this.attr]=this.value;let s=n.type.create(r,null,n.marks);return Yt.fromReplace(t,this.pos,this.pos+1,new xe(Z.from(s),0,n.isLeaf?0:1))}getMap(){return kr.empty}invert(t){return new ja(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new ja(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new ja(n.pos,n.attr,n.value)}}Wn.jsonID("attr",ja);class Vu extends Wn{constructor(t,n){super(),this.attr=t,this.value=n}apply(t){let n=Object.create(null);for(let s in t.attrs)n[s]=t.attrs[s];n[this.attr]=this.value;let r=t.type.create(n,t.content,t.marks);return Yt.ok(r)}getMap(){return kr.empty}invert(t){return new Vu(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Vu(n.attr,n.value)}}Wn.jsonID("docAttr",Vu);let Va=class extends Error{};Va=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n};Va.prototype=Object.create(Error.prototype);Va.prototype.constructor=Va;Va.prototype.name="TransformError";class Tb{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new Uu}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let n=this.maybeStep(t);if(n.failed)throw new Va(n.failed);return this}maybeStep(t){let n=t.apply(this.doc);return n.failed||this.addStep(t,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let t=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let s=this.mapping.maps[r];r&&(t=s.map(t,1),n=s.map(n,-1)),s.forEach((o,i,l,a)=>{t=Math.min(t,l),n=Math.max(n,a)})}return t==1e9?null:{from:t,to:n}}addStep(t,n){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=n}replace(t,n=t,r=xe.empty){let s=jm(this.doc,t,n,r);return s&&this.step(s),this}replaceWith(t,n,r){return this.replace(t,n,new xe(Z.from(r),0,0))}delete(t,n){return this.replace(t,n,xe.empty)}insert(t,n){return this.replaceWith(t,t,n)}replaceRange(t,n,r){return bq(this,t,n,r),this}replaceRangeWith(t,n,r){return vq(this,t,n,r),this}deleteRange(t,n){return Sq(this,t,n),this}lift(t,n){return lq(this,t,n),this}join(t,n=1){return gq(this,t,n),this}wrap(t,n){return uq(this,t,n),this}setBlockType(t,n=t,r,s=null){return dq(this,t,n,r,s),this}setNodeMarkup(t,n,r=null,s){return hq(this,t,n,r,s),this}setNodeAttribute(t,n,r){return this.step(new ja(t,n,r)),this}setDocAttribute(t,n){return this.step(new Vu(t,n)),this}addNodeMark(t,n){return this.step(new Jo(t,n)),this}removeNodeMark(t,n){let r=this.doc.nodeAt(t);if(!r)throw new RangeError("No node at position "+t);if(n instanceof gt)n.isInSet(r.marks)&&this.step(new vl(t,n));else{let s=r.marks,o,i=[];for(;o=n.isInSet(s);)i.push(new vl(t,o)),s=o.removeFromSet(s);for(let l=i.length-1;l>=0;l--)this.step(i[l])}return this}split(t,n=1,r){return pq(this,t,n,r),this}addMark(t,n,r){return sq(this,t,n,r),this}removeMark(t,n,r){return oq(this,t,n,r),this}clearIncompatible(t,n,r){return Eb(this,t,n,r),this}}const Ry=Object.create(null);class Ue{constructor(t,n,r){this.$anchor=t,this.$head=n,this.ranges=r||[new vD(t.min(n),t.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 t=this.ranges;for(let n=0;n<t.length;n++)if(t[n].$from.pos!=t[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t,n=xe.empty){let r=n.content.lastChild,s=null;for(let l=0;l<n.openEnd;l++)s=r,r=r.lastChild;let o=t.steps.length,i=this.ranges;for(let l=0;l<i.length;l++){let{$from:a,$to:c}=i[l],u=t.mapping.slice(o);t.replaceRange(u.map(a.pos),u.map(c.pos),l?xe.empty:n),l==0&&CN(t,o,(r?r.isInline:s&&s.isTextblock)?-1:1)}}replaceWith(t,n){let r=t.steps.length,s=this.ranges;for(let o=0;o<s.length;o++){let{$from:i,$to:l}=s[o],a=t.mapping.slice(r),c=a.map(i.pos),u=a.map(l.pos);o?t.deleteRange(c,u):(t.replaceRangeWith(c,u,n),CN(t,r,n.isInline?-1:1))}}static findFrom(t,n,r=!1){let s=t.parent.inlineContent?new Pe(t):Zl(t.node(0),t.parent,t.pos,t.index(),n,r);if(s)return s;for(let o=t.depth-1;o>=0;o--){let i=n<0?Zl(t.node(0),t.node(o),t.before(o+1),t.index(o),n,r):Zl(t.node(0),t.node(o),t.after(o+1),t.index(o)+1,n,r);if(i)return i}return null}static near(t,n=1){return this.findFrom(t,n)||this.findFrom(t,-n)||new Cr(t.node(0))}static atStart(t){return Zl(t,t,0,0,1)||new Cr(t)}static atEnd(t){return Zl(t,t,t.content.size,t.childCount,-1)||new Cr(t)}static fromJSON(t,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Ry[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in Ry)throw new RangeError("Duplicate use of selection JSON ID "+t);return Ry[t]=n,n.prototype.jsonID=t,n}getBookmark(){return Pe.between(this.$anchor,this.$head).getBookmark()}}Ue.prototype.visible=!0;class vD{constructor(t,n){this.$from=t,this.$to=n}}let vN=!1;function SN(e){!vN&&!e.parent.inlineContent&&(vN=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class Pe extends Ue{constructor(t,n=t){SN(t),SN(n),super(t,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return Ue.near(r);let s=t.resolve(n.map(this.anchor));return new Pe(s.parent.inlineContent?s:r,r)}replace(t,n=xe.empty){if(super.replace(t,n),n==xe.empty){let r=this.$from.marksAcross(this.$to);r&&t.ensureMarks(r)}}eq(t){return t instanceof Pe&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new Mm(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Pe(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){let s=t.resolve(n);return new this(s,r==n?s:t.resolve(r))}static between(t,n,r){let s=t.pos-n.pos;if((!r||s)&&(r=s>=0?1:-1),!n.parent.inlineContent){let o=Ue.findFrom(n,r,!0)||Ue.findFrom(n,-r,!0);if(o)n=o.$head;else return Ue.near(n,r)}return t.parent.inlineContent||(s==0?t=n:(t=(Ue.findFrom(t,-r,!0)||Ue.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=s<0&&(t=n))),new Pe(t,n)}}Ue.jsonID("text",Pe);class Mm{constructor(t,n){this.anchor=t,this.head=n}map(t){return new Mm(t.map(this.anchor),t.map(this.head))}resolve(t){return Pe.between(t.resolve(this.anchor),t.resolve(this.head))}}class $e extends Ue{constructor(t){let n=t.nodeAfter,r=t.node(0).resolve(t.pos+n.nodeSize);super(t,r),this.node=n}map(t,n){let{deleted:r,pos:s}=n.mapResult(this.anchor),o=t.resolve(s);return r?Ue.near(o):new $e(o)}content(){return new xe(Z.from(this.node),0,0)}eq(t){return t instanceof $e&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Ab(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new $e(t.resolve(n.anchor))}static create(t,n){return new $e(t.resolve(n))}static isSelectable(t){return!t.isText&&t.type.spec.selectable!==!1}}$e.prototype.visible=!1;Ue.jsonID("node",$e);class Ab{constructor(t){this.anchor=t}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new Mm(r,r):new Ab(r)}resolve(t){let n=t.resolve(this.anchor),r=n.nodeAfter;return r&&$e.isSelectable(r)?new $e(n):Ue.near(n)}}class Cr extends Ue{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,n=xe.empty){if(n==xe.empty){t.delete(0,t.doc.content.size);let r=Ue.atStart(t.doc);r.eq(t.selection)||t.setSelection(r)}else super.replace(t,n)}toJSON(){return{type:"all"}}static fromJSON(t){return new Cr(t)}map(t){return new Cr(t)}eq(t){return t instanceof Cr}getBookmark(){return Cq}}Ue.jsonID("all",Cr);const Cq={map(){return this},resolve(e){return new Cr(e)}};function Zl(e,t,n,r,s,o=!1){if(t.inlineContent)return Pe.create(e,n);for(let i=r-(s>0?0:1);s>0?i<t.childCount:i>=0;i+=s){let l=t.child(i);if(l.isAtom){if(!o&&$e.isSelectable(l))return $e.create(e,n-(s<0?l.nodeSize:0))}else{let a=Zl(e,l,n+s,s<0?l.childCount:0,s,o);if(a)return a}n+=l.nodeSize*s}return null}function CN(e,t,n){let r=e.steps.length-1;if(r<t)return;let s=e.steps[r];if(!(s instanceof Kt||s instanceof sn))return;let o=e.mapping.maps[r],i;o.forEach((l,a,c,u)=>{i==null&&(i=u)}),e.setSelection(Ue.near(e.doc.resolve(i),n))}const EN=1,yf=2,NN=4;class Eq extends Tb{constructor(t){super(t.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=t.selection,this.storedMarks=t.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(t){if(t.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=t,this.curSelectionFor=this.steps.length,this.updated=(this.updated|EN)&~yf,this.storedMarks=null,this}get selectionSet(){return(this.updated&EN)>0}setStoredMarks(t){return this.storedMarks=t,this.updated|=yf,this}ensureMarks(t){return gt.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this}addStoredMark(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&yf)>0}addStep(t,n){super.addStep(t,n),this.updated=this.updated&~yf,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t,n=!0){let r=this.selection;return n&&(t=t.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||gt.none))),r.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,n,r){let s=this.doc.type.schema;if(n==null)return t?this.replaceSelectionWith(s.text(t),!0):this.deleteSelection();{if(r==null&&(r=n),!t)return this.deleteRange(n,r);let o=this.storedMarks;if(!o){let i=this.doc.resolve(n);o=r==n?i.marks():i.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,s.text(t,o)),!this.selection.empty&&this.selection.to==n+t.length&&this.setSelection(Ue.near(this.selection.$to)),this}}setMeta(t,n){return this.meta[typeof t=="string"?t:t.key]=n,this}getMeta(t){return this.meta[typeof t=="string"?t:t.key]}get isGeneric(){for(let t in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=NN,this}get scrolledIntoView(){return(this.updated&NN)>0}}function TN(e,t){return!t||!e?e:e.bind(t)}class _c{constructor(t,n,r){this.name=t,this.init=TN(n.init,r),this.apply=TN(n.apply,r)}}const Nq=[new _c("doc",{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new _c("selection",{init(e,t){return e.selection||Ue.atStart(t.doc)},apply(e){return e.selection}}),new _c("storedMarks",{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new _c("scrollToSelection",{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})];class Oy{constructor(t,n){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Nq.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 _c(r.key,r.spec.state,r))})}}class ka{constructor(t){this.config=t}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(t){return this.applyTransaction(t).state}filterTransaction(t,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,t,this))return!1}return!0}applyTransaction(t){if(!this.filterTransaction(t))return{state:this,transactions:[]};let n=[t],r=this.applyInner(t),s=null;for(;;){let o=!1;for(let i=0;i<this.config.plugins.length;i++){let l=this.config.plugins[i];if(l.spec.appendTransaction){let a=s?s[i].n:0,c=s?s[i].state:this,u=a<n.length&&l.spec.appendTransaction.call(l,a?n.slice(a):n,c,r);if(u&&r.filterTransaction(u,i)){if(u.setMeta("appendedTransaction",t),!s){s=[];for(let f=0;f<this.config.plugins.length;f++)s.push(f<i?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),o=!0}s&&(s[i]={state:r,n:n.length})}}if(!o)return{state:r,transactions:n}}}applyInner(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new ka(this.config),r=this.config.fields;for(let s=0;s<r.length;s++){let o=r[s];n[o.name]=o.apply(t,this[o.name],this,n)}return n}get tr(){return new Eq(this)}static create(t){let n=new Oy(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new ka(n);for(let s=0;s<n.fields.length;s++)r[n.fields[s].name]=n.fields[s].init(t,r);return r}reconfigure(t){let n=new Oy(this.schema,t.plugins),r=n.fields,s=new ka(n);for(let o=0;o<r.length;o++){let i=r[o].name;s[i]=this.hasOwnProperty(i)?this[i]:r[o].init(t,s)}return s}toJSON(t){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),t&&typeof t=="object")for(let r in t){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let s=t[r],o=s.spec.state;o&&o.toJSON&&(n[r]=o.toJSON.call(s,this[s.key]))}return n}static fromJSON(t,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let s=new Oy(t.schema,t.plugins),o=new ka(s);return s.fields.forEach(i=>{if(i.name=="doc")o.doc=ii.fromJSON(t.schema,n.doc);else if(i.name=="selection")o.selection=Ue.fromJSON(o.doc,n.selection);else if(i.name=="storedMarks")n.storedMarks&&(o.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==i.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){o[i.name]=c.fromJSON.call(a,t,n[l],o);return}}o[i.name]=i.init(t,o)}}),o}}function SD(e,t,n){for(let r in e){let s=e[r];s instanceof Function?s=s.bind(t):r=="handleDOMEvents"&&(s=SD(s,t,{})),n[r]=s}return n}class Gt{constructor(t){this.spec=t,this.props={},t.props&&SD(t.props,this,this.props),this.key=t.key?t.key.key:CD("plugin")}getState(t){return t[this.key]}}const Iy=Object.create(null);function CD(e){return e in Iy?e+"$"+ ++Iy[e]:(Iy[e]=0,e+"$")}class Sn{constructor(t="key"){this.key=CD(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}const wn=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},Ka=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t};let ex=null;const Xs=function(e,t,n){let r=ex||(ex=document.createRange());return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},Tq=function(){ex=null},Sl=function(e,t,n,r){return n&&(AN(e,t,n,r,-1)||AN(e,t,n,r,1))},Aq=/^(img|br|input|textarea|hr)$/i;function AN(e,t,n,r,s){for(var o;;){if(e==n&&t==r)return!0;if(t==(s<0?0:$r(e))){let i=e.parentNode;if(!i||i.nodeType!=1||dd(e)||Aq.test(e.nodeName)||e.contentEditable=="false")return!1;t=wn(e)+(s<0?0:1),e=i}else if(e.nodeType==1){let i=e.childNodes[t+(s<0?-1:0)];if(i.nodeType==1&&i.contentEditable=="false")if(!((o=i.pmViewDesc)===null||o===void 0)&&o.ignoreForSelection)t+=s;else return!1;else e=i,t=s<0?$r(e):0}else return!1}}function $r(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function jq(e,t){for(;;){if(e.nodeType==3&&t)return e;if(e.nodeType==1&&t>0){if(e.contentEditable=="false")return null;e=e.childNodes[t-1],t=$r(e)}else if(e.parentNode&&!dd(e))t=wn(e),e=e.parentNode;else return null}}function Mq(e,t){for(;;){if(e.nodeType==3&&t<e.nodeValue.length)return e;if(e.nodeType==1&&t<e.childNodes.length){if(e.contentEditable=="false")return null;e=e.childNodes[t],t=0}else if(e.parentNode&&!dd(e))t=wn(e)+1,e=e.parentNode;else return null}}function Rq(e,t,n){for(let r=t==0,s=t==$r(e);r||s;){if(e==n)return!0;let o=wn(e);if(e=e.parentNode,!e)return!1;r=r&&o==0,s=s&&o==$r(e)}}function dd(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const Rm=function(e){return e.focusNode&&Sl(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function Hi(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}function Oq(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function Iq(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min($r(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min($r(r.startContainer),r.startOffset)}}}const Rs=typeof navigator<"u"?navigator:null,jN=typeof document<"u"?document:null,Ci=Rs&&Rs.userAgent||"",tx=/Edge\/(\d+)/.exec(Ci),ED=/MSIE \d/.exec(Ci),nx=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ci),ur=!!(ED||nx||tx),ai=ED?document.documentMode:nx?+nx[1]:tx?+tx[1]:0,Hr=!ur&&/gecko\/(\d+)/i.test(Ci);Hr&&+(/Firefox\/(\d+)/.exec(Ci)||[0,0])[1];const rx=!ur&&/Chrome\/(\d+)/.exec(Ci),xn=!!rx,ND=rx?+rx[1]:0,Fn=!ur&&!!Rs&&/Apple Computer/.test(Rs.vendor),qa=Fn&&(/Mobile\/\w+/.test(Ci)||!!Rs&&Rs.maxTouchPoints>2),Or=qa||(Rs?/Mac/.test(Rs.platform):!1),TD=Rs?/Win/.test(Rs.platform):!1,oo=/Android \d/.test(Ci),fd=!!jN&&"webkitFontSmoothing"in jN.documentElement.style,Dq=fd?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Lq(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function Hs(e,t){return typeof e=="number"?e:e[t]}function Pq(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function MN(e,t,n){if(!sx(t)&&t.left==0)return;let r=e.someProp("scrollThreshold")||0,s=e.someProp("scrollMargin")||5,o=e.dom.ownerDocument;for(let i=n||e.dom;i;){if(i.nodeType!=1){i=Ka(i);continue}let l=i,a=l==o.body,c=a?Lq(o):Pq(l),u=0,f=0;if(t.top<c.top+Hs(r,"top")?f=-(c.top-t.top+Hs(s,"top")):t.bottom>c.bottom-Hs(r,"bottom")&&(f=t.bottom-t.top>c.bottom-c.top?t.top+Hs(s,"top")-c.top:t.bottom-c.bottom+Hs(s,"bottom")),t.left<c.left+Hs(r,"left")?u=-(c.left-t.left+Hs(s,"left")):t.right>c.right-Hs(r,"right")&&(u=t.right-c.right+Hs(s,"right")),u||f)if(a)o.defaultView.scrollBy(u,f);else{let p=l.scrollLeft,m=l.scrollTop;f&&(l.scrollTop+=f),u&&(l.scrollLeft+=u);let y=l.scrollLeft-p,x=l.scrollTop-m;t={left:t.left-y,top:t.top-x,right:t.right-y,bottom:t.bottom-x}}let h=a?"fixed":getComputedStyle(i).position;if(/^(fixed|sticky)$/.test(h))break;i=h=="absolute"?i.offsetParent:Ka(i)}}function $q(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,s;for(let o=(t.left+t.right)/2,i=n+1;i<Math.min(innerHeight,t.bottom);i+=5){let l=e.root.elementFromPoint(o,i);if(!l||l==e.dom||!e.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=n-20){r=l,s=a.top;break}}return{refDOM:r,refTop:s,stack:AD(e.dom)}}function AD(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=Ka(r));return t}function zq({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;jD(n,r==0?0:r-t)}function jD(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:s,left:o}=e[n];r.scrollTop!=s+t&&(r.scrollTop=s+t),r.scrollLeft!=o&&(r.scrollLeft=o)}}let Gl=null;function _q(e){if(e.setActive)return e.setActive();if(Gl)return e.focus(Gl);let t=AD(e);e.focus(Gl==null?{get preventScroll(){return Gl={preventScroll:!0},!0}}:void 0),Gl||(Gl=!1,jD(t,0))}function MD(e,t){let n,r=2e8,s,o=0,i=t.top,l=t.top,a,c;for(let u=e.firstChild,f=0;u;u=u.nextSibling,f++){let h;if(u.nodeType==1)h=u.getClientRects();else if(u.nodeType==3)h=Xs(u).getClientRects();else continue;for(let p=0;p<h.length;p++){let m=h[p];if(m.top<=i&&m.bottom>=l){i=Math.max(m.bottom,i),l=Math.min(m.top,l);let y=m.left>t.left?m.left-t.left:m.right<t.left?t.left-m.right:0;if(y<r){n=u,r=y,s=y&&n.nodeType==3?{left:m.right<t.left?m.right:m.left,top:t.top}:t,u.nodeType==1&&y&&(o=f+(t.left>=(m.left+m.right)/2?1:0));continue}}else m.top>t.top&&!a&&m.left<=t.left&&m.right>=t.left&&(a=u,c={left:Math.max(m.left,Math.min(m.right,t.left)),top:m.top});!n&&(t.left>=m.right&&t.top>=m.top||t.left>=m.left&&t.top>=m.bottom)&&(o=f+1)}}return!n&&a&&(n=a,s=c,r=0),n&&n.nodeType==3?Fq(n,s):!n||r&&n.nodeType==1?{node:e,offset:o}:MD(n,s)}function Fq(e,t){let n=e.nodeValue.length,r=document.createRange(),s;for(let o=0;o<n;o++){r.setEnd(e,o+1),r.setStart(e,o);let i=Do(r,1);if(i.top!=i.bottom&&jb(t,i)){s={node:e,offset:o+(t.left>=(i.left+i.right)/2?1:0)};break}}return r.detach(),s||{node:e,offset:0}}function jb(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function Bq(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function Hq(e,t,n){let{node:r,offset:s}=MD(t,n),o=-1;if(r.nodeType==1&&!r.firstChild){let i=r.getBoundingClientRect();o=i.left!=i.right&&n.left>(i.left+i.right)/2?1:-1}return e.docView.posFromDOM(r,s,o)}function Wq(e,t,n,r){let s=-1;for(let o=t,i=!1;o!=e.dom;){let l=e.docView.nearestDesc(o,!0),a;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!i&&a.left>r.left||a.top>r.top?s=l.posBefore:(!i&&a.right<r.left||a.bottom<r.top)&&(s=l.posAfter),i=!0),!l.contentDOM&&s<0&&!l.node.isText))return(l.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?l.posBefore:l.posAfter;o=l.dom.parentNode}return s>-1?s:e.docView.posFromDOM(t,n,-1)}function RD(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let s=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),o=s;;){let i=e.childNodes[o];if(i.nodeType==1){let l=i.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(jb(t,c))return RD(i,t,c)}}if((o=(o+1)%r)==s)break}return e}function Uq(e,t){let n=e.dom.ownerDocument,r,s=0,o=Iq(n,t.left,t.top);o&&({node:r,offset:s}=o);let i=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),l;if(!i||!e.dom.contains(i.nodeType!=1?i.parentNode:i)){let c=e.dom.getBoundingClientRect();if(!jb(t,c)||(i=RD(e.dom,t,c),!i))return null}if(Fn)for(let c=i;r&&c;c=Ka(c))c.draggable&&(r=void 0);if(i=Bq(i,t),r){if(Hr&&r.nodeType==1&&(s=Math.min(s,r.childNodes.length),s<r.childNodes.length)){let u=r.childNodes[s],f;u.nodeName=="IMG"&&(f=u.getBoundingClientRect()).right<=t.left&&f.bottom>t.top&&s++}let c;fd&&s&&r.nodeType==1&&(c=r.childNodes[s-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=t.top&&s--,r==e.dom&&s==r.childNodes.length-1&&r.lastChild.nodeType==1&&t.top>r.lastChild.getBoundingClientRect().bottom?l=e.state.doc.content.size:(s==0||r.nodeType!=1||r.childNodes[s-1].nodeName!="BR")&&(l=Wq(e,r,s,t))}l==null&&(l=Hq(e,i,t));let a=e.docView.nearestDesc(i,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function sx(e){return e.top<e.bottom||e.left<e.right}function Do(e,t){let n=e.getClientRects();if(n.length){let r=n[t<0?0:n.length-1];if(sx(r))return r}return Array.prototype.find.call(n,sx)||e.getBoundingClientRect()}const Vq=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function OD(e,t,n){let{node:r,offset:s,atom:o}=e.docView.domFromPos(t,n<0?-1:1),i=fd||Hr;if(r.nodeType==3)if(i&&(Vq.test(r.nodeValue)||(n<0?!s:s==r.nodeValue.length))){let a=Do(Xs(r,s,s),n);if(Hr&&s&&/\s/.test(r.nodeValue[s-1])&&s<r.nodeValue.length){let c=Do(Xs(r,s-1,s-1),-1);if(c.top==a.top){let u=Do(Xs(r,s,s+1),-1);if(u.top!=a.top)return Ec(u,u.left<c.left)}}return a}else{let a=s,c=s,u=n<0?1:-1;return n<0&&!s?(c++,u=-1):n>=0&&s==r.nodeValue.length?(a--,u=1):n<0?a--:c++,Ec(Do(Xs(r,a,c),u),u<0)}if(!e.state.doc.resolve(t-(o||0)).parent.inlineContent){if(o==null&&s&&(n<0||s==$r(r))){let a=r.childNodes[s-1];if(a.nodeType==1)return Dy(a.getBoundingClientRect(),!1)}if(o==null&&s<$r(r)){let a=r.childNodes[s];if(a.nodeType==1)return Dy(a.getBoundingClientRect(),!0)}return Dy(r.getBoundingClientRect(),n>=0)}if(o==null&&s&&(n<0||s==$r(r))){let a=r.childNodes[s-1],c=a.nodeType==3?Xs(a,$r(a)-(i?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return Ec(Do(c,1),!1)}if(o==null&&s<$r(r)){let a=r.childNodes[s];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?Xs(a,0,i?0:1):a.nodeType==1?a:null:null;if(c)return Ec(Do(c,-1),!0)}return Ec(Do(r.nodeType==3?Xs(r):r,-n),n>=0)}function Ec(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function Dy(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function ID(e,t,n){let r=e.state,s=e.root.activeElement;r!=t&&e.updateState(t),s!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),s!=e.dom&&s&&s.focus()}}function Kq(e,t,n){let r=t.selection,s=n=="up"?r.$from:r.$to;return ID(e,t,()=>{let{node:o}=e.docView.domFromPos(s.pos,n=="up"?-1:1);for(;;){let l=e.docView.nearestDesc(o,!0);if(!l)break;if(l.node.isBlock){o=l.contentDOM||l.dom;break}o=l.dom.parentNode}let i=OD(e,s.pos,1);for(let l=o.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=Xs(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let u=a[c];if(u.bottom>u.top+1&&(n=="up"?i.top-u.top>(u.bottom-i.top)*2:u.bottom-i.bottom>(i.bottom-u.top)*2))return!1}}return!0})}const qq=/[\u0590-\u08ac]/;function Yq(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let s=r.parentOffset,o=!s,i=s==r.parent.content.size,l=e.domSelection();return l?!qq.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?o:i:ID(e,t,()=>{let{focusNode:a,focusOffset:c,anchorNode:u,anchorOffset:f}=e.domSelectionRange(),h=l.caretBidiLevel;l.modify("move",n,"character");let p=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:m,focusOffset:y}=e.domSelectionRange(),x=m&&!p.contains(m.nodeType==1?m:m.parentNode)||a==m&&c==y;try{l.collapse(u,f),a&&(a!=u||c!=f)&&l.extend&&l.extend(a,c)}catch{}return h!=null&&(l.caretBidiLevel=h),x}):r.pos==r.start()||r.pos==r.end()}let RN=null,ON=null,IN=!1;function Gq(e,t,n){return RN==t&&ON==n?IN:(RN=t,ON=n,IN=n=="up"||n=="down"?Kq(e,t,n):Yq(e,t,n))}const Wr=0,DN=1,Gi=2,ls=3;class hd{constructor(t,n,r,s){this.parent=t,this.children=n,this.dom=r,this.contentDOM=s,this.dirty=Wr,r.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,n,r){return!1}matchesHack(t){return!1}parseRule(t){return null}stopEvent(t){return!1}get size(){let t=0;for(let n=0;n<this.children.length;n++)t+=this.children[n].size;return t}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let t=0;t<this.children.length;t++)this.children[t].destroy()}posBeforeChild(t){for(let n=0,r=this.posAtStart;;n++){let s=this.children[n];if(s==t)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(t,n,r){if(this.contentDOM&&this.contentDOM.contains(t.nodeType==1?t:t.parentNode))if(r<0){let o,i;if(t==this.contentDOM)o=t.childNodes[n-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;o=t.previousSibling}for(;o&&!((i=o.pmViewDesc)&&i.parent==this);)o=o.previousSibling;return o?this.posBeforeChild(i)+i.size:this.posAtStart}else{let o,i;if(t==this.contentDOM)o=t.childNodes[n];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;o=t.nextSibling}for(;o&&!((i=o.pmViewDesc)&&i.parent==this);)o=o.nextSibling;return o?this.posBeforeChild(i):this.posAtEnd}let s;if(t==this.dom&&this.contentDOM)s=n>wn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=t.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let o=t;;o=o.parentNode){if(o==this.dom){s=!1;break}if(o.previousSibling)break}if(s==null&&n==t.childNodes.length)for(let o=t;;o=o.parentNode){if(o==this.dom){s=!0;break}if(o.nextSibling)break}}return s??r>0?this.posAtEnd:this.posAtStart}nearestDesc(t,n=!1){for(let r=!0,s=t;s;s=s.parentNode){let o=this.getDesc(s),i;if(o&&(!n||o.node))if(r&&(i=o.nodeDOM)&&!(i.nodeType==1?i.contains(t.nodeType==1?t:t.parentNode):i==t))r=!1;else return o}}getDesc(t){let n=t.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(t,n,r){for(let s=t;s;s=s.parentNode){let o=this.getDesc(s);if(o)return o.localPosFromDOM(t,n,r)}return-1}descAt(t){for(let n=0,r=0;n<this.children.length;n++){let s=this.children[n],o=r+s.size;if(r==t&&o!=r){for(;!s.border&&s.children.length;)for(let i=0;i<s.children.length;i++){let l=s.children[i];if(l.size){s=l;break}}return s}if(t<o)return s.descAt(t-r-s.border);r=o}}domFromPos(t,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:t+1};let r=0,s=0;for(let o=0;r<this.children.length;r++){let i=this.children[r],l=o+i.size;if(l>t||i instanceof LD){s=t-o;break}o=l}if(s)return this.children[r].domFromPos(s-this.children[r].border,n);for(let o;r&&!(o=this.children[r-1]).size&&o instanceof DD&&o.side>=0;r--);if(n<=0){let o,i=!0;for(;o=r?this.children[r-1]:null,!(!o||o.dom.parentNode==this.contentDOM);r--,i=!1);return o&&n&&i&&!o.border&&!o.domAtom?o.domFromPos(o.size,n):{node:this.contentDOM,offset:o?wn(o.dom)+1:0}}else{let o,i=!0;for(;o=r<this.children.length?this.children[r]:null,!(!o||o.dom.parentNode==this.contentDOM);r++,i=!1);return o&&i&&!o.border&&!o.domAtom?o.domFromPos(0,n):{node:this.contentDOM,offset:o?wn(o.dom):this.contentDOM.childNodes.length}}}parseRange(t,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:t,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let s=-1,o=-1;for(let i=r,l=0;;l++){let a=this.children[l],c=i+a.size;if(s==-1&&t<=c){let u=i+a.border;if(t>=u&&n<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(t,n,u);t=i;for(let f=l;f>0;f--){let h=this.children[f-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){s=wn(h.dom)+1;break}t-=h.size}s==-1&&(s=0)}if(s>-1&&(c>n||l==this.children.length-1)){n=c;for(let u=l+1;u<this.children.length;u++){let f=this.children[u];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){o=wn(f.dom);break}n+=f.size}o==-1&&(o=this.contentDOM.childNodes.length);break}i=c}return{node:this.contentDOM,from:t,to:n,fromOffset:s,toOffset:o}}emptyChildAt(t){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[t<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(t)}domAfterPos(t){let{node:n,offset:r}=this.domFromPos(t,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+t);return n.childNodes[r]}setSelection(t,n,r,s=!1){let o=Math.min(t,n),i=Math.max(t,n);for(let p=0,m=0;p<this.children.length;p++){let y=this.children[p],x=m+y.size;if(o>m&&i<x)return y.setSelection(t-m-y.border,n-m-y.border,r,s);m=x}let l=this.domFromPos(t,t?-1:1),a=n==t?l:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),f=!1;if((Hr||Fn)&&t==n){let{node:p,offset:m}=l;if(p.nodeType==3){if(f=!!(m&&p.nodeValue[m-1]==`
205
+ `),f&&m==p.nodeValue.length)for(let y=p,x;y;y=y.parentNode){if(x=y.nextSibling){x.nodeName=="BR"&&(l=a={node:x.parentNode,offset:wn(x)+1});break}let k=y.pmViewDesc;if(k&&k.node&&k.node.isBlock)break}}else{let y=p.childNodes[m-1];f=y&&(y.nodeName=="BR"||y.contentEditable=="false")}}if(Hr&&u.focusNode&&u.focusNode!=a.node&&u.focusNode.nodeType==1){let p=u.focusNode.childNodes[u.focusOffset];p&&p.contentEditable=="false"&&(s=!0)}if(!(s||f&&Fn)&&Sl(l.node,l.offset,u.anchorNode,u.anchorOffset)&&Sl(a.node,a.offset,u.focusNode,u.focusOffset))return;let h=!1;if((c.extend||t==n)&&!(f&&Hr)){c.collapse(l.node,l.offset);try{t!=n&&c.extend(a.node,a.offset),h=!0}catch{}}if(!h){if(t>n){let m=l;l=a,a=m}let p=document.createRange();p.setEnd(a.node,a.offset),p.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(p)}}ignoreMutation(t){return!this.contentDOM&&t.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(t,n){for(let r=0,s=0;s<this.children.length;s++){let o=this.children[s],i=r+o.size;if(r==i?t<=i&&n>=r:t<i&&n>r){let l=r+o.border,a=i-o.border;if(t>=l&&n<=a){this.dirty=t==r||n==i?Gi:DN,t==l&&n==a&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=ls:o.markDirty(t-l,n-l);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?Gi:ls}r=i}this.dirty=Gi}markParentsDirty(){let t=1;for(let n=this.parent;n;n=n.parent,t++){let r=t==1?Gi:DN;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(t){return!1}}class DD extends hd{constructor(t,n,r,s){let o,i=n.type.toDOM;if(typeof i=="function"&&(i=i(r,()=>{if(!o)return s;if(o.parent)return o.parent.posBeforeChild(o)})),!n.type.spec.raw){if(i.nodeType!=1){let l=document.createElement("span");l.appendChild(i),i=l}i.contentEditable="false",i.classList.add("ProseMirror-widget")}super(t,[],i,null),this.widget=n,this.widget=n,o=this}matchesWidget(t){return this.dirty==Wr&&t.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(t){let n=this.widget.spec.stopEvent;return n?n(t):!1}ignoreMutation(t){return t.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 Jq extends hd{constructor(t,n,r,s){super(t,[],n,null),this.textDOM=r,this.text=s}get size(){return this.text.length}localPosFromDOM(t,n){return t!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return t.type==="characterData"&&t.target.nodeValue==t.oldValue}}class ci extends hd{constructor(t,n,r,s,o){super(t,[],r,s),this.mark=n,this.spec=o}static create(t,n,r,s){let o=s.nodeViews[n.type.name],i=o&&o(n,s,r);return(!i||!i.dom)&&(i=Ml.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new ci(t,n,i.dom,i.contentDOM||i.dom,i)}parseRule(){return this.dirty&ls||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return this.dirty!=ls&&this.mark.eq(t)}markDirty(t,n){if(super.markDirty(t,n),this.dirty!=Wr){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Wr}}slice(t,n,r){let s=ci.create(this.parent,this.mark,!0,r),o=this.children,i=this.size;n<i&&(o=ix(o,n,i,r)),t>0&&(o=ix(o,0,t,r));for(let l=0;l<o.length;l++)o[l].parent=s;return s.children=o,s}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class ui extends hd{constructor(t,n,r,s,o,i,l){super(t,[],o,i),this.node=n,this.outerDeco=r,this.innerDeco=s,this.nodeDOM=l}static create(t,n,r,s,o,i){let l=o.nodeViews[n.type.name],a,c=l&&l(n,o,()=>{if(!a)return i;if(a.parent)return a.parent.posBeforeChild(a)},r,s),u=c&&c.dom,f=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:f}=Ml.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!f&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let h=u;return u=zD(u,r,n),c?a=new Qq(t,n,r,s,u,f||null,h,c):n.isText?new Om(t,n,r,s,u,h):new ui(t,n,r,s,u,f||null,h)}parseRule(t){if(this.node.type.spec.reparseInView)return null;let n={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(n.preserveWhitespace="full"),!this.contentDOM)n.getContent=()=>this.node.content;else if(!this.contentLost)n.contentElement=this.contentDOM;else{for(let r=this.children.length-1;r>=0;r--){let s=this.children[r];if(this.dom.contains(s.dom.parentNode)){n.contentElement=s.dom.parentNode;break}}if(!n.contentElement){let r=t&&t.find(s=>s.nodeType==1&&t.indexOf(s.parentNode)<0&&this.dom.contains(s));r?n.contentElement=r:n.getContent=()=>Z.empty}}return n}matchesNode(t,n,r){return this.dirty==Wr&&t.eq(this.node)&&np(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,n){let r=this.node.inlineContent,s=n,o=t.composing?this.localCompositionInfo(t,n):null,i=o&&o.pos>-1?o:null,l=o&&o.pos<0,a=new Zq(this,i&&i.node,t);nY(this.node,this.innerDeco,(c,u,f)=>{c.spec.marks?a.syncToMarks(c.spec.marks,r,t,u):c.type.side>=0&&!f&&a.syncToMarks(u==this.node.childCount?gt.none:this.node.child(u).marks,r,t,u),a.placeWidget(c,t,s)},(c,u,f,h)=>{a.syncToMarks(c.marks,r,t,h);let p;a.findNodeMatch(c,u,f,h)||l&&t.state.selection.from>s&&t.state.selection.to<s+c.nodeSize&&(p=a.findIndexWithChild(o.node))>-1&&a.updateNodeAt(c,u,f,p,t)||a.updateNextNode(c,u,f,t,h,s)||a.addNode(c,u,f,t,s),s+=c.nodeSize}),a.syncToMarks([],r,t,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==Gi)&&(i&&this.protectLocalComposition(t,i),PD(this.contentDOM,this.children,t),qa&&rY(this.dom))}localCompositionInfo(t,n){let{from:r,to:s}=t.state.selection;if(!(t.state.selection instanceof Pe)||r<n||s>n+this.node.content.size)return null;let o=t.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let i=o.nodeValue,l=sY(this.node.content,i,r-n,s-n);return l<0?null:{node:o,pos:l,text:i}}else return{node:o,pos:-1,text:""}}protectLocalComposition(t,{node:n,pos:r,text:s}){if(this.getDesc(n))return;let o=n;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let i=new Jq(this,o,n,s);t.input.compositionNodes.push(i),this.children=ix(this.children,r,r+s.length,t,i)}update(t,n,r,s){return this.dirty==ls||!t.sameMarkup(this.node)?!1:(this.updateInner(t,n,r,s),!0)}updateInner(t,n,r,s){this.updateOuterDeco(n),this.node=t,this.innerDeco=r,this.contentDOM&&this.updateChildren(s,this.posAtStart),this.dirty=Wr}updateOuterDeco(t){if(np(t,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=$D(this.dom,this.nodeDOM,ox(this.outerDeco,this.node,n),ox(t,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=t}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 LN(e,t,n,r,s){zD(r,t,e);let o=new ui(void 0,e,t,n,r,r,r);return o.contentDOM&&o.updateChildren(s,0),o}class Om extends ui{constructor(t,n,r,s,o,i){super(t,n,r,s,o,null,i)}parseRule(){let t=this.nodeDOM.parentNode;for(;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}}update(t,n,r,s){return this.dirty==ls||this.dirty!=Wr&&!this.inParent()||!t.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Wr||t.text!=this.node.text)&&t.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=t.text,s.trackWrites==this.nodeDOM&&(s.trackWrites=null)),this.node=t,this.dirty=Wr,!0)}inParent(){let t=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==t)return!0;return!1}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,n,r){return t==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(t,n,r)}ignoreMutation(t){return t.type!="characterData"&&t.type!="selection"}slice(t,n,r){let s=this.node.cut(t,n),o=document.createTextNode(s.text);return new Om(this.parent,s,this.outerDeco,this.innerDeco,o,o)}markDirty(t,n){super.markDirty(t,n),this.dom!=this.nodeDOM&&(t==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=ls)}get domAtom(){return!1}isText(t){return this.node.text==t}}class LD extends hd{parseRule(){return{ignore:!0}}matchesHack(t){return this.dirty==Wr&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Qq extends ui{constructor(t,n,r,s,o,i,l,a){super(t,n,r,s,o,i,l),this.spec=a}update(t,n,r,s){if(this.dirty==ls)return!1;if(this.spec.update&&(this.node.type==t.type||this.spec.multiType)){let o=this.spec.update(t,n,r);return o&&this.updateInner(t,n,r,s),o}else return!this.contentDOM&&!t.isLeaf?!1:super.update(t,n,r,s)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,n,r,s){this.spec.setSelection?this.spec.setSelection(t,n,r.root):super.setSelection(t,n,r,s)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(t){return this.spec.stopEvent?this.spec.stopEvent(t):!1}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}}function PD(e,t,n){let r=e.firstChild,s=!1;for(let o=0;o<t.length;o++){let i=t[o],l=i.dom;if(l.parentNode==e){for(;l!=r;)r=PN(r),s=!0;r=r.nextSibling}else s=!0,e.insertBefore(l,r);if(i instanceof ci){let a=r?r.previousSibling:e.lastChild;PD(i.contentDOM,i.children,n),r=a?a.nextSibling:e.firstChild}}for(;r;)r=PN(r),s=!0;s&&n.trackWrites==e&&(n.trackWrites=null)}const cu=function(e){e&&(this.nodeName=e)};cu.prototype=Object.create(null);const Ji=[new cu];function ox(e,t,n){if(e.length==0)return Ji;let r=n?Ji[0]:new cu,s=[r];for(let o=0;o<e.length;o++){let i=e[o].type.attrs;if(i){i.nodeName&&s.push(r=new cu(i.nodeName));for(let l in i){let a=i[l];a!=null&&(n&&s.length==1&&s.push(r=new cu(t.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+a:l=="style"?r.style=(r.style?r.style+";":"")+a:l!="nodeName"&&(r[l]=a))}}}return s}function $D(e,t,n,r){if(n==Ji&&r==Ji)return t;let s=t;for(let o=0;o<r.length;o++){let i=r[o],l=n[o];if(o){let a;l&&l.nodeName==i.nodeName&&s!=e&&(a=s.parentNode)&&a.nodeName.toLowerCase()==i.nodeName||(a=document.createElement(i.nodeName),a.pmIsDeco=!0,a.appendChild(s),l=Ji[0]),s=a}Xq(s,l||Ji[0],i)}return s}function Xq(e,t,n){for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&e.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],s=n.class?n.class.split(" ").filter(Boolean):[];for(let o=0;o<r.length;o++)s.indexOf(r[o])==-1&&e.classList.remove(r[o]);for(let o=0;o<s.length;o++)r.indexOf(s[o])==-1&&e.classList.add(s[o]);e.classList.length==0&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,s;for(;s=r.exec(t.style);)e.style.removeProperty(s[1])}n.style&&(e.style.cssText+=n.style)}}function zD(e,t,n){return $D(e,e,Ji,ox(t,n,e.nodeType!=1))}function np(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function PN(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class Zq{constructor(t,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=eY(t.node.content,t)}destroyBetween(t,n){if(t!=n){for(let r=t;r<n;r++)this.top.children[r].destroy();this.top.children.splice(t,n-t),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(t,n,r,s){let o=0,i=this.stack.length>>1,l=Math.min(i,t.length);for(;o<l&&(o==i-1?this.top:this.stack[o+1<<1]).matchesMark(t[o])&&t[o].type.spec.spanning!==!1;)o++;for(;o<i;)this.destroyRest(),this.top.dirty=Wr,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<t.length;){this.stack.push(this.top,this.index+1);let a=-1,c=this.top.children.length;s<this.preMatch.index&&(c=Math.min(this.index+3,c));for(let u=this.index;u<c;u++){let f=this.top.children[u];if(f.matchesMark(t[i])&&!this.isLocked(f.dom)){a=u;break}}if(a<0&&this.index<this.top.children.length){let u=this.top.children[this.index];u instanceof ci&&u.dirty!=ls&&u.mark.type==t[i].type&&u.spec.update&&!this.isLocked(u.dom)&&u.spec.update(t[i])&&(u.mark=t[i],a=this.index,this.changed=!0)}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let u=ci.create(this.top,t[i],n,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,i++}}findNodeMatch(t,n,r,s){let o=-1,i;if(s>=this.preMatch.index&&(i=this.preMatch.matches[s-this.preMatch.index]).parent==this.top&&i.matchesNode(t,n,r))o=this.top.children.indexOf(i,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let c=this.top.children[l];if(c.matchesNode(t,n,r)&&!this.preMatch.matched.has(c)){o=l;break}}return o<0?!1:(this.destroyBetween(this.index,o),this.index++,!0)}updateNodeAt(t,n,r,s,o){let i=this.top.children[s];return i.dirty==ls&&i.dom==i.contentDOM&&(i.dirty=Gi),i.update(t,n,r,o)?(this.destroyBetween(this.index,s),this.index++,!0):!1}findIndexWithChild(t){for(;;){let n=t.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=t.pmViewDesc;if(r){for(let s=this.index;s<this.top.children.length;s++)if(this.top.children[s]==r)return s}return-1}t=n}}updateNextNode(t,n,r,s,o,i){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof ui){let c=this.preMatch.matched.get(a);if(c!=null&&c!=o)return!1;let u=a.dom,f,h=this.isLocked(u)&&!(t.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==t.text&&a.dirty!=ls&&np(n,a.outerDeco));if(!h&&a.update(t,n,r,s))return this.destroyBetween(this.index,l),a.dom!=u&&(this.changed=!0),this.index++,!0;if(!h&&(f=this.recreateWrapper(a,t,n,r,s,i)))return this.destroyBetween(this.index,l),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=Gi,f.updateChildren(s,i+1),f.dirty=Wr),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(t,n,r,s,o,i){if(t.dirty||n.isAtom||!t.children.length||!t.node.content.eq(n.content)||!np(r,t.outerDeco)||!s.eq(t.innerDeco))return null;let l=ui.create(this.top,n,r,s,o,i);if(l.contentDOM){l.children=t.children,t.children=[];for(let a of l.children)a.parent=l}return t.destroy(),l}addNode(t,n,r,s,o){let i=ui.create(this.top,t,n,r,s,o);i.contentDOM&&i.updateChildren(s,o+1),this.top.children.splice(this.index++,0,i),this.changed=!0}placeWidget(t,n,r){let s=this.index<this.top.children.length?this.top.children[this.index]:null;if(s&&s.matchesWidget(t)&&(t==s.widget||!s.widget.type.toDOM.parentNode))this.index++;else{let o=new DD(this.top,t,n,r);this.top.children.splice(this.index++,0,o),this.changed=!0}}addTextblockHacks(){let t=this.top.children[this.index-1],n=this.top;for(;t instanceof ci;)n=t,t=n.children[n.children.length-1];(!t||!(t instanceof Om)||/\n$/.test(t.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(t.node.text))&&((Fn||xn)&&t&&t.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(t,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(t))this.index++;else{let r=document.createElement(t);t=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),t=="BR"&&(r.className="ProseMirror-trailingBreak");let s=new LD(this.top,[],r,null);n!=this.top?n.children.push(s):n.children.splice(this.index++,0,s),this.changed=!0}}isLocked(t){return this.lock&&(t==this.lock||t.nodeType==1&&t.contains(this.lock.parentNode))}}function eY(e,t){let n=t,r=n.children.length,s=e.childCount,o=new Map,i=[];e:for(;s>0;){let l;for(;;)if(r){let c=n.children[r-1];if(c instanceof ci)n=c,r=c.children.length;else{l=c,r--;break}}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}let a=l.node;if(a){if(a!=e.child(s-1))break;--s,o.set(l,s),i.push(l)}}return{index:s,matched:o,matches:i.reverse()}}function tY(e,t){return e.type.side-t.type.side}function nY(e,t,n,r){let s=t.locals(e),o=0;if(s.length==0){for(let c=0;c<e.childCount;c++){let u=e.child(c);r(u,s,t.forChild(o,u),c),o+=u.nodeSize}return}let i=0,l=[],a=null;for(let c=0;;){let u,f;for(;i<s.length&&s[i].to==o;){let x=s[i++];x.widget&&(u?(f||(f=[u])).push(x):u=x)}if(u)if(f){f.sort(tY);for(let x=0;x<f.length;x++)n(f[x],c,!!a)}else n(u,c,!!a);let h,p;if(a)p=-1,h=a,a=null;else if(c<e.childCount)p=c,h=e.child(c++);else break;for(let x=0;x<l.length;x++)l[x].to<=o&&l.splice(x--,1);for(;i<s.length&&s[i].from<=o&&s[i].to>o;)l.push(s[i++]);let m=o+h.nodeSize;if(h.isText){let x=m;i<s.length&&s[i].from<x&&(x=s[i].from);for(let k=0;k<l.length;k++)l[k].to<x&&(x=l[k].to);x<m&&(a=h.cut(x-o),h=h.cut(0,x-o),m=x,p=-1)}else for(;i<s.length&&s[i].to<m;)i++;let y=h.isInline&&!h.isLeaf?l.filter(x=>!x.inline):l.slice();r(h,y,t.forChild(o,h),p),o=m}}function rY(e){if(e.nodeName=="UL"||e.nodeName=="OL"){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}function sY(e,t,n,r){for(let s=0,o=0;s<e.childCount&&o<=r;){let i=e.child(s++),l=o;if(o+=i.nodeSize,!i.isText)continue;let a=i.text;for(;s<e.childCount;){let c=e.child(s++);if(o+=c.nodeSize,!c.isText)break;a+=c.text}if(o>=n){if(o>=r&&a.slice(r-t.length-l,r-l)==t)return r-t.length;let c=l<r?a.lastIndexOf(t,r-l-1):-1;if(c>=0&&c+t.length+l>=n)return l+c;if(n==r&&a.length>=r+t.length-l&&a.slice(r-l,r-l+t.length)==t)return r}}return-1}function ix(e,t,n,r,s){let o=[];for(let i=0,l=0;i<e.length;i++){let a=e[i],c=l,u=l+=a.size;c>=n||u<=t?o.push(a):(c<t&&o.push(a.slice(0,t-c,r)),s&&(o.push(s),s=void 0),u>n&&o.push(a.slice(n-c,a.size,r)))}return o}function Mb(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let s=e.docView.nearestDesc(n.focusNode),o=s&&s.size==0,i=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(i<0)return null;let l=r.resolve(i),a,c;if(Rm(n)){for(a=i;s&&!s.node;)s=s.parent;let f=s.node;if(s&&f.isAtom&&$e.isSelectable(f)&&s.parent&&!(f.isInline&&Rq(n.focusNode,n.focusOffset,s.dom))){let h=s.posBefore;c=new $e(i==h?l:r.resolve(h))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let f=i,h=i;for(let p=0;p<n.rangeCount;p++){let m=n.getRangeAt(p);f=Math.min(f,e.docView.posFromDOM(m.startContainer,m.startOffset,1)),h=Math.max(h,e.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(f<0)return null;[a,i]=h==e.state.selection.anchor?[h,f]:[f,h],l=r.resolve(i)}else a=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let u=r.resolve(a);if(!c){let f=t=="pointer"||e.state.selection.head<l.pos&&!o?1:-1;c=Rb(e,u,l,f)}return c}function _D(e){return e.editable?e.hasFocus():BD(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function co(e,t=!1){let n=e.state.selection;if(FD(e,n),!_D(e))return;let r=e.input.mouseDown;if(!t&&xn&&r){let s=e.domSelectionRange(),o=e.domObserver.currentSelection;if(s.anchorNode&&o.anchorNode&&Sl(s.anchorNode,s.anchorOffset,o.anchorNode,o.anchorOffset)&&r.delaySelUpdate()){e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)iY(e);else{let{anchor:s,head:o}=n,i,l;$N&&!(n instanceof Pe)&&(n.$from.parent.inlineContent||(i=zN(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(l=zN(e,n.to))),e.docView.setSelection(s,o,e,t),$N&&(i&&_N(i),l&&_N(l)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&oY(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}const $N=Fn||xn&&ND<63;function zN(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),s=r<n.childNodes.length?n.childNodes[r]:null,o=r?n.childNodes[r-1]:null;if(Fn&&s&&s.contentEditable=="false")return Ly(s);if((!s||s.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(s)return Ly(s);if(o)return Ly(o)}}function Ly(e){return e.contentEditable="true",Fn&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function _N(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function oY(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,s=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=s)&&(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{(!_D(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})}function iY(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r=n.nodeName=="IMG";r?t.collapse(n.parentNode,wn(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&ur&&ai<=11&&(n.disabled=!0,n.disabled=!1)}function FD(e,t){if(t instanceof $e){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(FN(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else FN(e)}function FN(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function Rb(e,t,n,r){return e.someProp("createSelectionBetween",s=>s(e,t,n))||Pe.between(t,n,r)}function BN(e){return e.editable&&!e.hasFocus()?!1:BD(e)}function BD(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function lY(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return Sl(t.node,t.offset,n.anchorNode,n.anchorOffset)}function lx(e,t){let{$anchor:n,$head:r}=e.selection,s=t>0?n.max(r):n.min(r),o=s.parent.inlineContent?s.depth?e.doc.resolve(t>0?s.after():s.before()):null:s;return o&&Ue.findFrom(o,t)}function zo(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function HN(e,t,n){let r=e.state.selection;if(r instanceof Pe)if(n.indexOf("s")>-1){let{$head:s}=r,o=s.textOffset?null:t<0?s.nodeBefore:s.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let i=e.state.doc.resolve(s.pos+o.nodeSize*(t<0?-1:1));return zo(e,new Pe(r.$anchor,i))}else if(r.empty){if(e.endOfTextblock(t>0?"forward":"backward")){let s=lx(e.state,t);return s&&s instanceof $e?zo(e,s):!1}else if(!(Or&&n.indexOf("m")>-1)){let s=r.$head,o=s.textOffset?null:t<0?s.nodeBefore:s.nodeAfter,i;if(!o||o.isText)return!1;let l=t<0?s.pos-o.nodeSize:s.pos;return o.isAtom||(i=e.docView.descAt(l))&&!i.contentDOM?$e.isSelectable(o)?zo(e,new $e(t<0?e.state.doc.resolve(s.pos-o.nodeSize):s)):fd?zo(e,new Pe(e.state.doc.resolve(t<0?l:l+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof $e&&r.node.isInline)return zo(e,new Pe(t>0?r.$to:r.$from));{let s=lx(e.state,t);return s?zo(e,s):!1}}}function rp(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function uu(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!="BR")}function Jl(e,t){return t<0?aY(e):cY(e)}function aY(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let s,o,i=!1;for(Hr&&n.nodeType==1&&r<rp(n)&&uu(n.childNodes[r],-1)&&(i=!0);;)if(r>0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(uu(l,-1))s=n,o=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if(HD(n))break;{let l=n.previousSibling;for(;l&&uu(l,-1);)s=n.parentNode,o=wn(l),l=l.previousSibling;if(l)n=l,r=rp(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}i?ax(e,n,r):s&&ax(e,s,o)}function cY(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let s=rp(n),o,i;for(;;)if(r<s){if(n.nodeType!=1)break;let l=n.childNodes[r];if(uu(l,1))o=n,i=++r;else break}else{if(HD(n))break;{let l=n.nextSibling;for(;l&&uu(l,1);)o=l.parentNode,i=wn(l)+1,l=l.nextSibling;if(l)n=l,r=0,s=rp(n);else{if(n=n.parentNode,n==e.dom)break;r=s=0}}}o&&ax(e,o,i)}function HD(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function uY(e,t){for(;e&&t==e.childNodes.length&&!dd(e);)t=wn(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;e=n,t=0}}function dY(e,t){for(;e&&!t&&!dd(e);)t=wn(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;e=n,t=e.childNodes.length}}function ax(e,t,n){if(t.nodeType!=3){let o,i;(i=uY(t,n))?(t=i,n=0):(o=dY(t,n))&&(t=o,n=o.nodeValue.length)}let r=e.domSelection();if(!r)return;if(Rm(r)){let o=document.createRange();o.setEnd(t,n),o.setStart(t,n),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:s}=e;setTimeout(()=>{e.state==s&&co(e)},50)}function WN(e,t){let n=e.state.doc.resolve(t);if(!(xn||TD)&&n.parent.inlineContent){let s=e.coordsAtPos(t);if(t>n.start()){let o=e.coordsAtPos(t-1),i=(o.top+o.bottom)/2;if(i>s.top&&i<s.bottom&&Math.abs(o.left-s.left)>1)return o.left<s.left?"ltr":"rtl"}if(t<n.end()){let o=e.coordsAtPos(t+1),i=(o.top+o.bottom)/2;if(i>s.top&&i<s.bottom&&Math.abs(o.left-s.left)>1)return o.left>s.left?"ltr":"rtl"}}return getComputedStyle(e.dom).direction=="rtl"?"rtl":"ltr"}function UN(e,t,n){let r=e.state.selection;if(r instanceof Pe&&!r.empty||n.indexOf("s")>-1||Or&&n.indexOf("m")>-1)return!1;let{$from:s,$to:o}=r;if(!s.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let i=lx(e.state,t);if(i&&i instanceof $e)return zo(e,i)}if(!s.parent.inlineContent){let i=t<0?s:o,l=r instanceof Cr?Ue.near(i,t):Ue.findFrom(i,t);return l?zo(e,l):!1}return!1}function VN(e,t){if(!(e.state.selection instanceof Pe))return!0;let{$head:n,$anchor:r,empty:s}=e.state.selection;if(!n.sameParent(r))return!0;if(!s)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let o=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let i=e.state.tr;return t<0?i.delete(n.pos-o.nodeSize,n.pos):i.delete(n.pos,n.pos+o.nodeSize),e.dispatch(i),!0}return!1}function KN(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function fY(e){if(!Fn||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&t.nodeType==1&&n==0&&t.firstChild&&t.firstChild.contentEditable=="false"){let r=t.firstChild;KN(e,r,"true"),setTimeout(()=>KN(e,r,"false"),20)}return!1}function hY(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}function pY(e,t){let n=t.keyCode,r=hY(t);if(n==8||Or&&n==72&&r=="c")return VN(e,-1)||Jl(e,-1);if(n==46&&!t.shiftKey||Or&&n==68&&r=="c")return VN(e,1)||Jl(e,1);if(n==13||n==27)return!0;if(n==37||Or&&n==66&&r=="c"){let s=n==37?WN(e,e.state.selection.from)=="ltr"?-1:1:-1;return HN(e,s,r)||Jl(e,s)}else if(n==39||Or&&n==70&&r=="c"){let s=n==39?WN(e,e.state.selection.from)=="ltr"?1:-1:1;return HN(e,s,r)||Jl(e,s)}else{if(n==38||Or&&n==80&&r=="c")return UN(e,-1,r)||Jl(e,-1);if(n==40||Or&&n==78&&r=="c")return fY(e)||UN(e,1,r)||Jl(e,1);if(r==(Or?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Ob(e,t){e.someProp("transformCopied",p=>{t=p(t,e)});let n=[],{content:r,openStart:s,openEnd:o}=t;for(;s>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,o--;let p=r.firstChild;n.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let i=e.someProp("clipboardSerializer")||Ml.fromSchema(e.state.schema),l=YD(),a=l.createElement("div");a.appendChild(i.serializeFragment(r,{document:l}));let c=a.firstChild,u,f=0;for(;c&&c.nodeType==1&&(u=qD[c.nodeName.toLowerCase()]);){for(let p=u.length-1;p>=0;p--){let m=l.createElement(u[p]);for(;a.firstChild;)m.appendChild(a.firstChild);a.appendChild(m),f++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${s} ${o}${f?` -${f}`:""} ${JSON.stringify(n)}`);let h=e.someProp("clipboardTextSerializer",p=>p(t,e))||t.content.textBetween(0,t.content.size,`
206
+
207
+ `);return{dom:a,text:h,slice:t}}function WD(e,t,n,r,s){let o=s.parent.type.spec.code,i,l;if(!n&&!t)return null;let a=!!t&&(r||o||!n);if(a){if(e.someProp("transformPastedText",h=>{t=h(t,o||r,e)}),o)return l=new xe(Z.from(e.state.schema.text(t.replace(/\r\n?/g,`
208
+ `))),0,0),e.someProp("transformPasted",h=>{l=h(l,e,!0)}),l;let f=e.someProp("clipboardTextParser",h=>h(t,s,r,e));if(f)l=f;else{let h=s.marks(),{schema:p}=e.state,m=Ml.fromSchema(p);i=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(y=>{let x=i.appendChild(document.createElement("p"));y&&x.appendChild(m.serializeNode(p.text(y,h)))})}}else e.someProp("transformPastedHTML",f=>{n=f(n,e)}),i=wY(n),fd&&kY(i);let c=i&&i.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let f=+u[3];f>0;f--){let h=i.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;i=h}if(l||(l=(e.someProp("clipboardParser")||e.someProp("domParser")||li.fromSchema(e.state.schema)).parseSlice(i,{preserveWhitespace:!!(a||u),context:s,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!mY.test(h.parentNode.nodeName)?{ignore:!0}:null}})),u)l=xY(qN(l,+u[1],+u[2]),u[4]);else if(l=xe.maxOpen(gY(l.content,s),!0),l.openStart||l.openEnd){let f=0,h=0;for(let p=l.content.firstChild;f<l.openStart&&!p.type.spec.isolating;f++,p=p.firstChild);for(let p=l.content.lastChild;h<l.openEnd&&!p.type.spec.isolating;h++,p=p.lastChild);l=qN(l,f,h)}return e.someProp("transformPasted",f=>{l=f(l,e,a)}),l}const mY=/^(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 gY(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let s=t.node(n).contentMatchAt(t.index(n)),o,i=[];if(e.forEach(l=>{if(!i)return;let a=s.findWrapping(l.type),c;if(!a)return i=null;if(c=i.length&&o.length&&VD(a,o,l,i[i.length-1],0))i[i.length-1]=c;else{i.length&&(i[i.length-1]=KD(i[i.length-1],o.length));let u=UD(l,a);i.push(u),s=s.matchType(u.type),o=a}}),i)return Z.from(i)}return e}function UD(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,Z.from(e));return e}function VD(e,t,n,r,s){if(s<e.length&&s<t.length&&e[s]==t[s]){let o=VD(e,t,n,r.lastChild,s+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(s==e.length-1?n.type:e[s+1]))return r.copy(r.content.append(Z.from(UD(n,e,s+1))))}}function KD(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,KD(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(Z.empty,!0);return e.copy(n.append(r))}function cx(e,t,n,r,s,o){let i=t<0?e.firstChild:e.lastChild,l=i.content;return e.childCount>1&&(o=0),s<r-1&&(l=cx(l,t,n,r,s+1,o)),s>=n&&(l=t<0?i.contentMatchAt(0).fillBefore(l,o<=s).append(l):l.append(i.contentMatchAt(i.childCount).fillBefore(Z.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,i.copy(l))}function qN(e,t,n){return t<e.openStart&&(e=new xe(cx(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new xe(cx(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const qD={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function YD(){return document.implementation.createHTMLDocument("title")}let Py=null;function yY(e){let t=window.trustedTypes;return t?(Py||(Py=t.defaultPolicy||t.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Py.createHTML(e)):e}function wY(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=YD(),r=n.body,s=/<([a-z][^>\s]+)/i.exec(e),o;if((o=s&&qD[s[1].toLowerCase()])&&(e=o.map(i=>"<"+i+">").join("")+e+o.map(i=>"</"+i+">").reverse().join("")),r.innerHTML=yY(e),o)for(let i=0;i<o.length;i++)r=r.querySelector(o[i])||r;for(let i=0;i<n.styleSheets.length;i++){let l=n.styleSheets[i];for(let a=0;a<l.rules.length;a++){let c=l.rules[a];if(c instanceof CSSStyleRule){let u=r.querySelectorAll(c.selectorText);for(let f=0;f<u.length;f++)u[f].style.cssText+=c.style.cssText}}}return r}function kY(e){let t=e.querySelectorAll(xn?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}function xY(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch{return e}let{content:s,openStart:o,openEnd:i}=e;for(let l=r.length-2;l>=0;l-=2){let a=n.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;s=Z.from(a.create(r[l+1],s)),o++,i++}return new xe(s,o,i)}const Qn={},Xn={},bY={touchstart:!0,touchmove:!0};class vY{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function SY(e){for(let t in Qn){let n=Qn[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=r=>{EY(e,r)&&!Ib(e,r)&&(e.editable||!(r.type in Xn))&&n(e,r)},bY[t]?{passive:!0}:void 0)}Fn&&e.dom.addEventListener("input",()=>null),ux(e)}function io(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function CY(e){e.input.mouseDown&&e.input.mouseDown.done(),e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function ux(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=r=>Ib(e,r))})}function Ib(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function EY(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function NY(e,t){!Ib(e,t)&&Qn[t.type]&&(e.editable||!(t.type in Xn))&&Qn[t.type](e,t)}Xn.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!XD(e)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(oo&&xn&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),qa&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();e.input.lastIOSEnter=r,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==r&&(e.someProp("handleKeyDown",s=>s(e,Hi(13,"Enter"))),e.input.lastIOSEnter=0)},200)}else e.someProp("handleKeyDown",r=>r(e,n))||pY(e,n)?n.preventDefault():io(e,"key")};Xn.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)};Xn.keypress=(e,t)=>{let n=t;if(XD(e)||!n.charCode||n.ctrlKey&&!n.altKey||Or&&n.metaKey)return;if(e.someProp("handleKeyPress",s=>s(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof Pe)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(n.charCode),o=()=>e.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!e.someProp("handleTextInput",i=>i(e,r.$from.pos,r.$to.pos,s,o))&&e.dispatch(o()),n.preventDefault()}};function pd(e){return{left:e.clientX,top:e.clientY}}function TY(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function Db(e,t,n,r,s){if(r==-1)return!1;let o=e.state.doc.resolve(r);for(let i=o.depth+1;i>0;i--)if(e.someProp(t,l=>i>o.depth?l(e,n,o.nodeAfter,o.before(i),s,!0):l(e,n,o.node(i),o.before(i),s,!1)))return!0;return!1}function md(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);r.setMeta("pointer",!0),e.dispatch(r)}function AY(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&$e.isSelectable(r)?(md(e,new $e(n)),!0):!1}function jY(e,t){if(t==-1)return!1;let n=e.state.selection,r,s;n instanceof $e&&(r=n.node);let o=e.state.doc.resolve(t);for(let i=o.depth+1;i>0;i--){let l=i>o.depth?o.nodeAfter:o.node(i);if($e.isSelectable(l)){r&&n.$from.depth>0&&i>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?s=o.before(n.$from.depth):s=o.before(i);break}}return s!=null?(md(e,$e.create(e.state.doc,s)),!0):!1}function MY(e,t,n,r,s){return Db(e,"handleClickOn",t,n,r)||e.someProp("handleClick",o=>o(e,t,r))||(s?jY(e,n):AY(e,n))}function RY(e,t,n,r){return Db(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",s=>s(e,t,r))}function OY(e,t,n,r){return Db(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",s=>s(e,t,r))||IY(e,n,r)}function IY(e,t,n){if(n.button!=0)return!1;let r=GD(e,t,!0),s=e.state.doc;return r?(md(e,r),r instanceof Pe&&s.eq(e.state.doc)&&(e.input.mouseDown=new LY(e,r)),!0):!1}function GD(e,t,n){let r=e.state.doc;if(t==-1)return r.inlineContent?Pe.create(r,0,r.content.size):null;let s=r.resolve(t);for(let o=s.depth+1;o>0;o--){let i=o>s.depth?s.nodeAfter:s.node(o),l=s.before(o);if(i.inlineContent)return Pe.create(r,l+1,l+1+i.content.size);if(n&&$e.isSelectable(i))return $e.create(r,l)}return null}function Lb(e){return sp(e)}const JD=Or?"metaKey":"ctrlKey";Qn.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=Lb(e),s=Date.now(),o="singleClick";s-e.input.lastClick.time<500&&TY(n,e.input.lastClick)&&!n[JD]&&e.input.lastClick.button==n.button&&(e.input.lastClick.type=="singleClick"?o="doubleClick":e.input.lastClick.type=="doubleClick"&&(o="tripleClick")),e.input.lastClick={time:s,x:n.clientX,y:n.clientY,type:o,button:n.button},e.input.mouseDown&&e.input.mouseDown.done();let i=e.posAtCoords(pd(n));i&&(o=="singleClick"?e.input.mouseDown=new DY(e,i,n,!!r):(o=="doubleClick"?RY:OY)(e,i.pos,i.inside,n)?n.preventDefault():io(e,"pointer"))};class QD{constructor(t){this.view=t,this.mightDrag=null,t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(t){this.done()}move(t){t.buttons==0&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}}class DY extends QD{constructor(t,n,r,s){super(t),this.pos=n,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.startDoc=t.state.doc,this.selectNode=!!r[JD],this.allowDefault=r.shiftKey;let o,i;if(n.inside>-1)o=t.state.doc.nodeAt(n.inside),i=n.inside;else{let u=t.state.doc.resolve(n.pos);o=u.parent,i=u.depth?u.before():0}const l=s?null:r.target,a=l?t.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:c}=t.state;r.button==0&&(o.type.spec.draggable&&o.type.spec.selectable!==!1||c instanceof $e&&c.from<=i&&c.to>i)&&(this.mightDrag={node:o,pos:i,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Hr&&!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()),io(t,"pointer")}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>{this.view.isDestroyed||co(this.view)})}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(pd(t))),this.updateAllowDefault(t),this.allowDefault||!n?io(this.view,"pointer"):MY(this.view,n.pos,n.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||Fn&&this.mightDrag&&!this.mightDrag.node.isAtom||xn&&!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)?(md(this.view,Ue.near(this.view.state.doc.resolve(n.pos))),t.preventDefault()):io(this.view,"pointer")}move(t){this.updateAllowDefault(t),io(this.view,"pointer"),super.move(t)}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}}class LY extends QD{constructor(t,n){super(t),this.startSelection=n,this.startDoc=t.state.doc}move(t){if(t.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}t.preventDefault(),io(this.view,"pointer");let n=this.view.posAtCoords(pd(t)),r=n&&GD(this.view,n.inside,!1);if(!r)return;let{doc:s}=this.view.state,o=this.startSelection,[i,l]=r.from<o.from?[o.to,r.from]:[o.from,r.to];md(this.view,Pe.create(s,i,l))}}Qn.touchstart=e=>{e.input.lastTouch=Date.now(),Lb(e),io(e,"pointer")};Qn.touchmove=e=>{e.input.lastTouch=Date.now(),io(e,"pointer")};Qn.contextmenu=e=>Lb(e);function XD(e,t){return e.composing?!0:Fn&&Math.abs(Date.now()-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}const PY=oo?5e3:-1;Xn.compositionstart=Xn.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof Pe&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||xn&&TD&&$Y(e)))e.markCursor=e.state.storedMarks||n.marks(),sp(e,!0),e.markCursor=null;else if(sp(e,!t.selection.empty),Hr&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=e.domSelectionRange();for(let s=r.focusNode,o=r.focusOffset;s&&s.nodeType==1&&o!=0;){let i=o<0?s.lastChild:s.childNodes[o-1];if(!i)break;if(i.nodeType==3){let l=e.domSelection();l&&l.collapse(i,i.nodeValue.length);break}else s=i,o=-1}}e.input.composing=!0}ZD(e,PY)};function $Y(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||t.nodeType!=1||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}Xn.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now(),e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,ZD(e,20))};function ZD(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>sp(e),t))}function eL(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function zY(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=jq(t.focusNode,t.focusOffset),r=Mq(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let s=r.pmViewDesc,o=e.domObserver.lastChangedTextNode;if(n==o||r==o)return o;if(!s||!s.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let i=n.pmViewDesc;if(!(!i||!i.isText(n.nodeValue)))return r}}return n||r}function sp(e,t=!1){if(!(oo&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),eL(e),t||e.docView&&e.docView.dirty){let n=Mb(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function _Y(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),s=document.createRange();s.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}const Ku=ur&&ai<15||qa&&Dq<604;Qn.copy=Xn.cut=(e,t)=>{let n=t,r=e.state.selection,s=n.type=="cut";if(r.empty)return;let o=Ku?null:n.clipboardData,i=r.content(),{dom:l,text:a}=Ob(e,i);o?(n.preventDefault(),o.clearData(),o.setData("text/html",l.innerHTML),o.setData("text/plain",a)):_Y(e,l),s&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function FY(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function BY(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let s=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?qu(e,r.value,null,s,t):qu(e,r.textContent,r.innerHTML,s,t)},50)}function qu(e,t,n,r,s){let o=WD(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",a=>a(e,s,o||xe.empty)))return!0;if(!o)return!1;let i=FY(o),l=i?e.state.tr.replaceSelectionWith(i,r):e.state.tr.replaceSelection(o);return e.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function tL(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Xn.paste=(e,t)=>{let n=t;if(e.composing&&!oo)return;let r=Ku?null:n.clipboardData,s=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&qu(e,tL(r),r.getData("text/html"),s,n)?n.preventDefault():BY(e,n)};class nL{constructor(t,n,r){this.slice=t,this.move=n,this.node=r}}const HY=Or?"altKey":"ctrlKey";function rL(e,t){let n;return e.someProp("dragCopies",r=>{n=n||r(t)}),n!=null?!n:!t[HY]}Qn.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let s=e.state.selection,o=s.empty?null:e.posAtCoords(pd(n)),i;if(!(o&&o.pos>=s.from&&o.pos<=(s instanceof $e?s.to-1:s.to))){if(r&&r.mightDrag)i=$e.create(e.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let f=e.docView.nearestDesc(n.target,!0);f&&f.node.type.spec.draggable&&f!=e.docView&&(i=$e.create(e.state.doc,f.posBefore))}}let l=(i||e.state.selection).content(),{dom:a,text:c,slice:u}=Ob(e,l);(!n.dataTransfer.files.length||!xn||ND>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Ku?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",Ku||n.dataTransfer.setData("text/plain",c),e.dragging=new nL(u,rL(e,n),i)};Qn.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)};Xn.dragover=Xn.dragenter=(e,t)=>t.preventDefault();Xn.drop=(e,t)=>{try{WY(e,t,e.dragging)}finally{e.dragging=null}};function WY(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(pd(t));if(!r)return;let s=e.state.doc.resolve(r.pos),o=n&&n.slice;o?e.someProp("transformPasted",p=>{o=p(o,e,!1)}):o=WD(e,tL(t.dataTransfer),Ku?null:t.dataTransfer.getData("text/html"),!1,s);let i=!!(n&&rL(e,t));if(e.someProp("handleDrop",p=>p(e,t,o||xe.empty,i))){t.preventDefault();return}if(!o)return;t.preventDefault();let l=o?yD(e.state.doc,s.pos,o):s.pos;l==null&&(l=s.pos);let a=e.state.tr;if(i){let{node:p}=n;p?p.replace(a):a.deleteSelection()}let c=a.mapping.map(l),u=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,f=a.doc;if(u?a.replaceRangeWith(c,c,o.content.firstChild):a.replaceRange(c,c,o),a.doc.eq(f))return;let h=a.doc.resolve(c);if(u&&$e.isSelectable(o.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(o.content.firstChild))a.setSelection(new $e(h));else{let p=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((m,y,x,k)=>p=k),a.setSelection(Rb(e,h,a.doc.resolve(p)))}e.focus(),e.dispatch(a.setMeta("uiEvent","drop"))}Qn.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&co(e)},20))};Qn.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)};Qn.beforeinput=(e,t)=>{if(oo&&t.inputType=="deleteContentBackward"){e.domObserver.flushSoon();let{domChangeCount:r}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=r||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",o=>o(e,Hi(8,"Backspace")))))return;let{$cursor:s}=e.state.selection;s&&s.pos>0&&e.dispatch(e.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let e in Xn)Qn[e]=Xn[e];function Yu(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class op{constructor(t,n){this.toDOM=t,this.spec=n||cl,this.side=this.spec.side||0}map(t,n,r,s){let{pos:o,deleted:i}=t.mapResult(n.from+s,this.side<0?-1:1);return i?null:new zn(o-r,o-r,this)}valid(){return!0}eq(t){return this==t||t instanceof op&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&Yu(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class di{constructor(t,n){this.attrs=t,this.spec=n||cl}map(t,n,r,s){let o=t.map(n.from+s,this.spec.inclusiveStart?-1:1)-r,i=t.map(n.to+s,this.spec.inclusiveEnd?1:-1)-r;return o>=i?null:new zn(o,i,this)}valid(t,n){return n.from<n.to}eq(t){return this==t||t instanceof di&&Yu(this.attrs,t.attrs)&&Yu(this.spec,t.spec)}static is(t){return t.type instanceof di}destroy(){}}class Pb{constructor(t,n){this.attrs=t,this.spec=n||cl}map(t,n,r,s){let o=t.mapResult(n.from+s,1);if(o.deleted)return null;let i=t.mapResult(n.to+s,-1);return i.deleted||i.pos<=o.pos?null:new zn(o.pos-r,i.pos-r,this)}valid(t,n){let{index:r,offset:s}=t.content.findIndex(n.from),o;return s==n.from&&!(o=t.child(r)).isText&&s+o.nodeSize==n.to}eq(t){return this==t||t instanceof Pb&&Yu(this.attrs,t.attrs)&&Yu(this.spec,t.spec)}destroy(){}}class zn{constructor(t,n,r){this.from=t,this.to=n,this.type=r}copy(t,n){return new zn(t,n,this.type)}eq(t,n=0){return this.type.eq(t.type)&&this.from+n==t.from&&this.to+n==t.to}map(t,n,r){return this.type.map(t,this,n,r)}static widget(t,n,r){return new zn(t,t,new op(n,r))}static inline(t,n,r,s){return new zn(t,n,new di(r,s))}static node(t,n,r,s){return new zn(t,n,new Pb(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof di}get widget(){return this.type instanceof op}}const ea=[],cl={};class Ot{constructor(t,n){this.local=t.length?t:ea,this.children=n.length?n:ea}static create(t,n){return n.length?ip(n,t,0,cl):In}find(t,n,r){let s=[];return this.findInner(t??0,n??1e9,s,0,r),s}findInner(t,n,r,s,o){for(let i=0;i<this.local.length;i++){let l=this.local[i];l.from<=n&&l.to>=t&&(!o||o(l.spec))&&r.push(l.copy(l.from+s,l.to+s))}for(let i=0;i<this.children.length;i+=3)if(this.children[i]<n&&this.children[i+1]>t){let l=this.children[i]+1;this.children[i+2].findInner(t-l,n-l,r,s+l,o)}}map(t,n,r){return this==In||t.maps.length==0?this:this.mapInner(t,n,0,0,r||cl)}mapInner(t,n,r,s,o){let i;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(t,r,s);a&&a.type.valid(n,a)?(i||(i=[])).push(a):o.onRemove&&o.onRemove(this.local[l].spec)}return this.children.length?UY(this.children,i||[],t,n,r,s,o):i?new Ot(i.sort(ul),ea):In}add(t,n){return n.length?this==In?Ot.create(t,n):this.addInner(t,n,0):this}addInner(t,n,r){let s,o=0;t.forEach((l,a)=>{let c=a+r,u;if(u=oL(n,l,c)){for(s||(s=this.children.slice());o<s.length&&s[o]<a;)o+=3;s[o]==a?s[o+2]=s[o+2].addInner(l,u,c+1):s.splice(o,0,a,a+l.nodeSize,ip(u,l,c+1,cl)),o+=3}});let i=sL(o?iL(n):n,-r);for(let l=0;l<i.length;l++)i[l].type.valid(t,i[l])||i.splice(l--,1);return new Ot(i.length?this.local.concat(i).sort(ul):this.local,s||this.children)}remove(t){return t.length==0||this==In?this:this.removeInner(t,0)}removeInner(t,n){let r=this.children,s=this.local;for(let o=0;o<r.length;o+=3){let i,l=r[o]+n,a=r[o+1]+n;for(let u=0,f;u<t.length;u++)(f=t[u])&&f.from>l&&f.to<a&&(t[u]=null,(i||(i=[])).push(f));if(!i)continue;r==this.children&&(r=this.children.slice());let c=r[o+2].removeInner(i,l+1);c!=In?r[o+2]=c:(r.splice(o,3),o-=3)}if(s.length){for(let o=0,i;o<t.length;o++)if(i=t[o])for(let l=0;l<s.length;l++)s[l].eq(i,n)&&(s==this.local&&(s=this.local.slice()),s.splice(l--,1))}return r==this.children&&s==this.local?this:s.length||r.length?new Ot(s,r):In}forChild(t,n){if(this==In)return this;if(n.isLeaf)return Ot.empty;let r,s;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=t){this.children[l]==t&&(r=this.children[l+2]);break}let o=t+1,i=o+n.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<i&&a.to>o&&a.type instanceof di){let c=Math.max(o,a.from)-o,u=Math.min(i,a.to)-o;c<u&&(s||(s=[])).push(a.copy(c,u))}}if(s){let l=new Ot(s.sort(ul),ea);return r?new Uo([l,r]):l}return r||In}eq(t){if(this==t)return!0;if(!(t instanceof Ot)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(t.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=t.children[n]||this.children[n+1]!=t.children[n+1]||!this.children[n+2].eq(t.children[n+2]))return!1;return!0}locals(t){return $b(this.localsInner(t))}localsInner(t){if(this==In)return ea;if(t.inlineContent||!this.local.some(di.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof di||n.push(this.local[r]);return n}forEachSet(t){t(this)}}Ot.empty=new Ot([],[]);Ot.removeOverlap=$b;const In=Ot.empty;class Uo{constructor(t){this.members=t}map(t,n){const r=this.members.map(s=>s.map(t,n,cl));return Uo.from(r)}forChild(t,n){if(n.isLeaf)return Ot.empty;let r=[];for(let s=0;s<this.members.length;s++){let o=this.members[s].forChild(t,n);o!=In&&(o instanceof Uo?r=r.concat(o.members):r.push(o))}return Uo.from(r)}eq(t){if(!(t instanceof Uo)||t.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(t.members[n]))return!1;return!0}locals(t){let n,r=!0;for(let s=0;s<this.members.length;s++){let o=this.members[s].localsInner(t);if(o.length)if(!n)n=o;else{r&&(n=n.slice(),r=!1);for(let i=0;i<o.length;i++)n.push(o[i])}}return n?$b(r?n:n.sort(ul)):ea}static from(t){switch(t.length){case 0:return In;case 1:return t[0];default:return new Uo(t.every(n=>n instanceof Ot)?t:t.reduce((n,r)=>n.concat(r instanceof Ot?r:r.members),[]))}}forEachSet(t){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(t)}}function UY(e,t,n,r,s,o,i){let l=e.slice();for(let c=0,u=o;c<n.maps.length;c++){let f=0;n.maps[c].forEach((h,p,m,y)=>{let x=y-m-(p-h);for(let k=0;k<l.length;k+=3){let v=l[k+1];if(v<0||h>v+u-f)continue;let b=l[k]+u-f;p>=b?l[k+1]=h<=b?-2:-1:h>=u&&x&&(l[k]+=x,l[k+1]+=x)}f+=x}),u=n.maps[c].map(u,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let u=n.map(e[c]+o),f=u-s;if(f<0||f>=r.content.size){a=!0;continue}let h=n.map(e[c+1]+o,-1),p=h-s,{index:m,offset:y}=r.content.findIndex(f),x=r.maybeChild(m);if(x&&y==f&&y+x.nodeSize==p){let k=l[c+2].mapInner(n,x,u+1,e[c]+o+1,i);k!=In?(l[c]=f,l[c+1]=p,l[c+2]=k):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=VY(l,e,t,n,s,o,i),u=ip(c,r,0,i);t=u.local;for(let f=0;f<l.length;f+=3)l[f+1]<0&&(l.splice(f,3),f-=3);for(let f=0,h=0;f<u.children.length;f+=3){let p=u.children[f];for(;h<l.length&&l[h]<p;)h+=3;l.splice(h,0,u.children[f],u.children[f+1],u.children[f+2])}}return new Ot(t.sort(ul),l)}function sL(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let s=e[r];n.push(new zn(s.from+t,s.to+t,s.type))}return n}function VY(e,t,n,r,s,o,i){function l(a,c){for(let u=0;u<a.local.length;u++){let f=a.local[u].map(r,s,c);f?n.push(f):i.onRemove&&i.onRemove(a.local[u].spec)}for(let u=0;u<a.children.length;u+=3)l(a.children[u+2],a.children[u]+c+1)}for(let a=0;a<e.length;a+=3)e[a+1]==-1&&l(e[a+2],t[a]+o+1);return n}function oL(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,s=null;for(let o=0,i;o<e.length;o++)(i=e[o])&&i.from>n&&i.to<r&&((s||(s=[])).push(i),e[o]=null);return s}function iL(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function ip(e,t,n,r){let s=[],o=!1;t.forEach((l,a)=>{let c=oL(e,l,a+n);if(c){o=!0;let u=ip(c,l,n+a+1,r);u!=In&&s.push(a,a+l.nodeSize,u)}});let i=sL(o?iL(e):e,-n).sort(ul);for(let l=0;l<i.length;l++)i[l].type.valid(t,i[l])||(r.onRemove&&r.onRemove(i[l].spec),i.splice(l--,1));return i.length||s.length?new Ot(i,s):In}function ul(e,t){return e.from-t.from||e.to-t.to}function $b(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let s=n+1;s<t.length;s++){let o=t[s];if(o.from==r.from){o.to!=r.to&&(t==e&&(t=e.slice()),t[s]=o.copy(o.from,r.to),YN(t,s+1,o.copy(r.to,o.to)));continue}else{o.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,o.from),YN(t,s,r.copy(o.from,r.to)));break}}}return t}function YN(e,t,n){for(;t<e.length&&ul(n,e[t])>0;)t++;e.splice(t,0,n)}function $y(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=In&&t.push(r)}),e.cursorWrapper&&t.push(Ot.create(e.state.doc,[e.cursorWrapper.deco])),Uo.from(t)}const KY={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},qY=ur&&ai<=11;class YY{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset}}class GY{constructor(t,n){this.view=t,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new YY,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]);ur&&ai<=11&&r.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():Fn&&t.composing&&r.some(s=>s.type=="childList"&&s.target.nodeName=="TR")?(t.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),qY&&(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,KY)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let t=this.observer.takeRecords();if(t.length){for(let n=0;n<t.length;n++)this.queue.push(t[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(BN(this.view)){if(this.suppressingSelectionUpdates)return co(this.view);if(ur&&ai<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&Sl(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(t){if(!t.focusNode)return!0;let n=new Set,r;for(let o=t.focusNode;o;o=Ka(o))n.add(o);for(let o=t.anchorNode;o;o=Ka(o))if(n.has(o)){r=o;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 t of this.observer.takeRecords())this.queue.push(t);return this.queue}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=t.domSelectionRange(),s=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&BN(t)&&!this.ignoreSelectionChange(r),o=-1,i=-1,l=!1,a=[];if(t.editable)for(let u=0;u<n.length;u++){let f=this.registerMutation(n[u],a);f&&(o=o<0?f.from:Math.min(f.from,o),i=i<0?f.to:Math.max(f.to,i),f.typeOver&&(l=!0))}if(a.some(u=>u.nodeName=="BR")&&(t.input.lastKeyCode==8||t.input.lastKeyCode==46||xn&&(t.composing||t.input.compositionEndedAt>Date.now()-50)&&n.some(u=>u.type=="childList"&&u.removedNodes.length))){for(let u of a)if(u.nodeName=="BR"&&u.parentNode){let f=u.nextSibling;for(;f&&f.nodeType==1;){if(f.contentEditable=="false"){u.parentNode.removeChild(u);break}f=f.firstChild}}}else if(Hr&&a.length){let u=a.filter(f=>f.nodeName=="BR");if(u.length==2){let[f,h]=u;f.parentNode&&f.parentNode.parentNode==h.parentNode?h.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let h of u){let p=h.parentNode;p&&p.nodeName=="LI"&&(!f||XY(t,f)!=p)&&h.remove()}}}let c=null;o<0&&s&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&Rm(r)&&(c=Mb(t))&&c.eq(Ue.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,co(t),this.currentSelection.set(r),t.scrollToSelection()):(o>-1||s)&&(o>-1&&(t.docView.markDirty(o,i),JY(t)),t.input.badSafariComposition&&(t.input.badSafariComposition=!1,ZY(t,a)),this.handleDOMChange(o,i,l,a),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||co(t),this.currentSelection.set(r))}registerMutation(t,n){if(n.indexOf(t.target)>-1)return null;let r=this.view.docView.nearestDesc(t.target);if(t.type=="attributes"&&(r==this.view.docView||t.attributeName=="contenteditable"||t.attributeName=="style"&&!t.oldValue&&!t.target.getAttribute("style"))||!r||r.ignoreMutation(t))return null;if(t.type=="childList"){for(let u=0;u<t.addedNodes.length;u++){let f=t.addedNodes[u];n.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(t.target))return{from:r.posBefore,to:r.posAfter};let s=t.previousSibling,o=t.nextSibling;if(ur&&ai<=11&&t.addedNodes.length)for(let u=0;u<t.addedNodes.length;u++){let{previousSibling:f,nextSibling:h}=t.addedNodes[u];(!f||Array.prototype.indexOf.call(t.addedNodes,f)<0)&&(s=f),(!h||Array.prototype.indexOf.call(t.addedNodes,h)<0)&&(o=h)}let i=s&&s.parentNode==t.target?wn(s)+1:0,l=r.localPosFromDOM(t.target,i,-1),a=o&&o.parentNode==t.target?wn(o):t.target.childNodes.length,c=r.localPosFromDOM(t.target,a,1);return{from:l,to:c}}else return t.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=t.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:t.target.nodeValue==t.oldValue})}}let GN=new WeakMap,JN=!1;function JY(e){if(!GN.has(e)&&(GN.set(e,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=Hr,JN)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."),JN=!0}}function QN(e,t){let n=t.startContainer,r=t.startOffset,s=t.endContainer,o=t.endOffset,i=e.domAtPos(e.state.selection.anchor);return Sl(i.node,i.offset,s,o)&&([n,r,s,o]=[s,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:o}}function QY(e,t){if(t.getComposedRanges){let s=t.getComposedRanges(e.root)[0];if(s)return QN(e,s)}let n;function r(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",r,!0),n?QN(e,n):null}function XY(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let r=e.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function ZY(e,t){var n;let{focusNode:r,focusOffset:s}=e.domSelectionRange();for(let o of t)if(((n=o.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let i=o.nextSibling;for(;i&&i.nodeName!="TD"&&i.nodeName!="TH";)i=i.nextSibling;if(i){let l=i;for(;;){let a=l.firstChild;if(!a||a.nodeType!=1||a.contentEditable=="false"||/^(BR|IMG)$/.test(a.nodeName))break;l=a}l.insertBefore(o,l.firstChild),r==o&&e.domSelection().collapse(o,s)}else o.parentNode.removeChild(o)}}function eG(e,t,n,r){let{node:s,fromOffset:o,toOffset:i,from:l,to:a}=e.docView.parseRange(t,n),c=e.domSelectionRange(),u,f=c.anchorNode;if(f&&e.dom.contains(f.nodeType==1?f:f.parentNode)&&(u=[{node:f,offset:c.anchorOffset}],Rm(c)||u.push({node:c.focusNode,offset:c.focusOffset})),xn&&e.input.lastKeyCode===8)for(let k=i;k>o;k--){let v=s.childNodes[k-1],b=v.pmViewDesc;if(v.nodeName=="BR"&&!b){i=k;break}if(!b||b.size)break}let h=e.state.doc,p=e.someProp("domParser")||li.fromSchema(e.state.schema),m=h.resolve(l),y=null,x=p.parse(s,{topNode:m.parent,topMatch:m.parent.contentMatchAt(m.index()),topOpen:!0,from:o,to:i,preserveWhitespace:m.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:tG(r),context:m});if(u&&u[0].pos!=null){let k=u[0].pos,v=u[1]&&u[1].pos;v==null&&(v=k),y={anchor:k+l,head:v+l}}return{doc:x,sel:y,from:l,to:a}}const tG=e=>t=>{let n=t.pmViewDesc;if(n)return n.parseRule(e);if(t.nodeName=="BR"&&t.parentNode){if(Fn&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let r=document.createElement("div");return r.appendChild(document.createElement("li")),{skip:r}}else if(t.parentNode.lastChild==t||Fn&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null},nG=/^(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 rG(e,t,n,r,s){let o=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let A=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,R=Mb(e,A);if(R&&!e.state.selection.eq(R)){if(xn&&oo&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",L=>L(e,Hi(13,"Enter"))))return;let $=e.state.tr.setSelection(R);A=="pointer"?$.setMeta("pointer",!0):A=="key"&&$.scrollIntoView(),o&&$.setMeta("composition",o),e.dispatch($)}return}let i=e.state.doc.resolve(t),l=i.sharedDepth(n);t=i.before(l+1),n=e.state.doc.resolve(n).after(l+1);let a=e.state.selection,c=eG(e,t,n,s),u=e.state.doc,f=u.slice(c.from,c.to),h,p;e.input.lastKeyCode===8&&Date.now()-100<e.input.lastKeyCodeTime?(h=e.state.selection.to,p="end"):(h=e.state.selection.from,p="start"),e.input.lastKeyCode=null;let m=iG(f.content,c.doc.content,c.from,h,p);if(m&&e.input.domChangeCount++,(qa&&e.input.lastIOSEnter>Date.now()-225||oo)&&s.some(A=>A.nodeType==1&&!nG.test(A.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp("handleKeyDown",A=>A(e,Hi(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!m)if(r&&a instanceof Pe&&!a.empty&&a.$head.sameParent(a.$anchor)&&!e.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))m={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let A=XN(e,e.state.doc,c.sel);if(A&&!A.eq(e.state.selection)){let R=e.state.tr.setSelection(A);o&&R.setMeta("composition",o),e.dispatch(R)}}return}e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof Pe&&(m.start>e.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=c.from?m.start=e.state.selection.from:m.endA<e.state.selection.to&&m.endA>=e.state.selection.to-2&&e.state.selection.to<=c.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),ur&&ai<=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 y=c.doc.resolveNoCache(m.start-c.from),x=c.doc.resolveNoCache(m.endB-c.from),k=u.resolve(m.start),v=y.sameParent(x)&&y.parent.inlineContent&&k.end()>=m.endA;if((qa&&e.input.lastIOSEnter>Date.now()-225&&(!v||s.some(A=>A.nodeName=="DIV"||A.nodeName=="P"))||!v&&y.pos<c.doc.content.size&&(!y.sameParent(x)||!y.parent.inlineContent)&&y.pos<x.pos&&!/\S/.test(c.doc.textBetween(y.pos,x.pos,"","")))&&e.someProp("handleKeyDown",A=>A(e,Hi(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&oG(u,m.start,m.endA,y,x)&&e.someProp("handleKeyDown",A=>A(e,Hi(8,"Backspace")))){oo&&xn&&e.domObserver.suppressSelectionUpdates();return}xn&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),oo&&!v&&y.start()!=x.start()&&x.parentOffset==0&&y.depth==x.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==m.endA&&(m.endB-=2,x=c.doc.resolveNoCache(m.endB-c.from),setTimeout(()=>{e.someProp("handleKeyDown",function(A){return A(e,Hi(13,"Enter"))})},20));let b=m.start,E=m.endA,N=A=>{let R=A||e.state.tr.replace(b,E,c.doc.slice(m.start-c.from,m.endB-c.from));if(c.sel){let $=XN(e,R.doc,c.sel);$&&!(xn&&e.composing&&$.empty&&(m.start!=m.endB||e.input.lastChromeDelete<Date.now()-100)&&($.head==b||$.head==R.mapping.map(E)-1)||ur&&$.empty&&$.head==b)&&R.setSelection($)}return o&&R.setMeta("composition",o),R.scrollIntoView()},T;if(v)if(y.pos==x.pos){ur&&ai<=11&&y.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>co(e),20));let A=N(e.state.tr.delete(b,E)),R=u.resolve(m.start).marksAcross(u.resolve(m.endA));R&&A.ensureMarks(R),e.dispatch(A)}else if(m.endA==m.endB&&(T=sG(y.parent.content.cut(y.parentOffset,x.parentOffset),k.parent.content.cut(k.parentOffset,m.endA-k.start())))){let A=N(e.state.tr);T.type=="add"?A.addMark(b,E,T.mark):A.removeMark(b,E,T.mark),e.dispatch(A)}else if(y.parent.child(y.index()).isText&&y.index()==x.index()-(x.textOffset?0:1)){let A=y.parent.textBetween(y.parentOffset,x.parentOffset),R=()=>N(e.state.tr.insertText(A,b,E));e.someProp("handleTextInput",$=>$(e,b,E,A,R))||e.dispatch(R())}else e.dispatch(N());else e.dispatch(N())}function XN(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:Rb(e,t.resolve(n.anchor),t.resolve(n.head))}function sG(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,s=n,o=r,i,l,a;for(let u=0;u<r.length;u++)s=r[u].removeFromSet(s);for(let u=0;u<n.length;u++)o=n[u].removeFromSet(o);if(s.length==1&&o.length==0)l=s[0],i="add",a=u=>u.mark(l.addToSet(u.marks));else if(s.length==0&&o.length==1)l=o[0],i="remove",a=u=>u.mark(l.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<t.childCount;u++)c.push(a(t.child(u)));if(Z.from(c).eq(e))return{mark:l,type:i}}function oG(e,t,n,r,s){if(n-t<=s.pos-r.pos||zy(r,!0,!1)<s.pos)return!1;let o=e.resolve(t);if(!r.parent.isTextblock){let l=o.nodeAfter;return l!=null&&n==t+l.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let i=e.resolve(zy(o,!0,!0));return!i.parent.isTextblock||i.pos>n||zy(i,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(i.parent.content)}function zy(e,t,n){let r=e.depth,s=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,s++,t=!1;if(n){let o=e.node(r).maybeChild(e.indexAfter(r));for(;o&&!o.isLeaf;)o=o.firstChild,s++}return s}function iG(e,t,n,r,s){let o=e.findDiffStart(t,n),i=n+e.size,l=n+t.size;if(o==null)return null;let{a,b:c}=e.findDiffEnd(t,i,l);if(s=="end"){let u=Math.max(0,o-Math.min(a,c));r-=a+u-o}if(a<o&&i<l){let u=r<=o&&r>=a?o-r:0;o-=u,c=o+(c-a),a=o}else if(c<o){let u=r<=o&&r>=c?o-r:0;o-=u,a=o+(a-c),c=o}return{start:o,endA:a,endB:c}}class lL{constructor(t,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 vY,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(rT),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):typeof t=="function"?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=tT(this),eT(this),this.nodeViews=nT(this),this.docView=LN(this.state.doc,ZN(this),$y(this),this.dom,this),this.domObserver=new GY(this,(r,s,o,i)=>rG(this,r,s,o,i)),this.domObserver.start(),SY(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let t=this._props;this._props={};for(let n in t)this._props[n]=t[n];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&ux(this);let n=this._props;this._props=t,t.plugins&&(t.plugins.forEach(rT),this.directPlugins=t.plugins),this.updateStateInner(t.state,n)}setProps(t){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in t)n[r]=t[r];this.update(n)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,n){var r;let s=this.state,o=!1,i=!1;t.storedMarks&&this.composing&&(eL(this),i=!0),this.state=t;let l=s.plugins!=t.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=nT(this);aG(p,this.nodeViews)&&(this.nodeViews=p,o=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&ux(this),this.editable=tT(this),eT(this);let a=$y(this),c=ZN(this),u=s.plugins!=t.plugins&&!s.doc.eq(t.doc)?"reset":t.scrollToSelection>s.scrollToSelection?"to selection":"preserve",f=o||!this.docView.matchesNode(t.doc,c,a);(f||!t.selection.eq(s.selection))&&(i=!0);let h=u=="preserve"&&i&&this.dom.style.overflowAnchor==null&&$q(this);if(i){this.domObserver.stop();let p=f&&(ur||xn)&&!this.composing&&!s.selection.empty&&!t.selection.empty&&lG(s.selection,t.selection);if(f){let y=xn?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=zY(this)),(o||!this.docView.update(t.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=LN(t.doc,c,a,this.dom,this)),y&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(p=!0)}let m=this.input.mouseDown;p||!(m&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&lY(this)&&m.delaySelUpdate())?co(this,p):(FD(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(s),!((r=this.dragging)===null||r===void 0)&&r.node&&!s.doc.eq(t.doc)&&this.updateDraggedNode(this.dragging,s),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():h&&zq(h)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(!(!t||!this.dom.contains(t.nodeType==1?t:t.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof $e){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&MN(this,n.getBoundingClientRect(),t)}else MN(this,this.coordsAtPos(this.state.selection.head,1),t)}}destroyPluginViews(){let t;for(;t=this.pluginViews.pop();)t.destroy&&t.destroy()}updatePluginViews(t){if(!t||t.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,t)}}updateDraggedNode(t,n){let r=t.node,s=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)s=r.from;else{let o=r.from+(this.state.doc.content.size-n.doc.content.size);(o>0&&o<this.state.doc.content.size&&this.state.doc.nodeAt(o))==r.node&&(s=o)}this.dragging=new nL(t.slice,t.move,s<0?void 0:$e.create(this.state.doc,s))}someProp(t,n){let r=this._props&&this._props[t],s;if(r!=null&&(s=n?n(r):r))return s;for(let i=0;i<this.directPlugins.length;i++){let l=this.directPlugins[i].props[t];if(l!=null&&(s=n?n(l):l))return s}let o=this.state.plugins;if(o)for(let i=0;i<o.length;i++){let l=o[i].props[t];if(l!=null&&(s=n?n(l):l))return s}}hasFocus(){if(ur){let t=this.root.activeElement;if(t==this.dom)return!0;if(!t||!this.dom.contains(t))return!1;for(;t&&this.dom!=t&&this.dom.contains(t);){if(t.contentEditable=="false")return!1;t=t.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&_q(this.dom),co(this),this.domObserver.start()}get root(){let t=this._root;if(t==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 t||document}updateRoot(){this._root=null}posAtCoords(t){return Uq(this,t)}coordsAtPos(t,n=1){return OD(this,t,n)}domAtPos(t,n=0){return this.docView.domFromPos(t,n)}nodeDOM(t){let n=this.docView.descAt(t);return n?n.nodeDOM:null}posAtDOM(t,n,r=-1){let s=this.docView.posFromDOM(t,n,r);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(t,n){return Gq(this,n||this.state,t)}pasteHTML(t,n){return qu(this,"",t,!1,n||new ClipboardEvent("paste"))}pasteText(t,n){return qu(this,t,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(t){return Ob(this,t)}destroy(){this.docView&&(CY(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],$y(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Tq())}get isDestroyed(){return this.docView==null}dispatchEvent(t){return NY(this,t)}domSelectionRange(){let t=this.domSelection();return t?Fn&&this.root.nodeType===11&&Oq(this.dom.ownerDocument)==this.dom&&QY(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}lL.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function ZN(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(e.state)),n)for(let r in n)r=="class"?t.class+=" "+n[r]:r=="style"?t.style=(t.style?t.style+";":"")+n[r]:!t[r]&&r!="contenteditable"&&r!="nodeName"&&(t[r]=String(n[r]))}),t.translate||(t.translate="no"),[zn.node(0,e.state.doc.content.size,t)]}function eT(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:zn.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function tT(e){return!e.someProp("editable",t=>t(e.state)===!1)}function lG(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function nT(e){let t=Object.create(null);function n(r){for(let s in r)Object.prototype.hasOwnProperty.call(t,s)||(t[s]=r[s])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function aG(e,t){let n=0,r=0;for(let s in e){if(e[s]!=t[s])return!0;n++}for(let s in t)r++;return n!=r}function rT(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var mi={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:"'"},lp={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},cG=typeof navigator<"u"&&/Mac/.test(navigator.platform),uG=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var kn=0;kn<10;kn++)mi[48+kn]=mi[96+kn]=String(kn);for(var kn=1;kn<=24;kn++)mi[kn+111]="F"+kn;for(var kn=65;kn<=90;kn++)mi[kn]=String.fromCharCode(kn+32),lp[kn]=String.fromCharCode(kn);for(var _y in mi)lp.hasOwnProperty(_y)||(lp[_y]=mi[_y]);function dG(e){var t=cG&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||uG&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?lp:mi)[e.keyCode]||e.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 fG=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),hG=typeof navigator<"u"&&/Win/.test(navigator.platform);function pG(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n=="Space"&&(n=" ");let r,s,o,i;for(let l=0;l<t.length-1;l++){let a=t[l];if(/^(cmd|meta|m)$/i.test(a))i=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))s=!0;else if(/^s(hift)?$/i.test(a))o=!0;else if(/^mod$/i.test(a))fG?i=!0:s=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(n="Alt-"+n),s&&(n="Ctrl-"+n),i&&(n="Meta-"+n),o&&(n="Shift-"+n),n}function mG(e){let t=Object.create(null);for(let n in e)t[pG(n)]=e[n];return t}function Fy(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function gG(e){return new Gt({props:{handleKeyDown:zb(e)}})}function zb(e){let t=mG(e);return function(n,r){let s=dG(r),o,i=t[Fy(s,r)];if(i&&i(n.state,n.dispatch,n))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let l=t[Fy(s,r,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(hG&&r.ctrlKey&&r.altKey)&&(o=mi[r.keyCode])&&o!=s){let l=t[Fy(o,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}const _b=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function aL(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const cL=(e,t,n)=>{let r=aL(e,n);if(!r)return!1;let s=Fb(r);if(!s){let i=r.blockRange(),l=i&&sc(i);return l==null?!1:(t&&t(e.tr.lift(i,l).scrollIntoView()),!0)}let o=s.nodeBefore;if(wL(e,s,t,-1))return!0;if(r.parent.content.size==0&&(Ya(o,"end")||$e.isSelectable(o)))for(let i=r.depth;;i--){let l=jm(e.doc,r.before(i),r.after(i),xe.empty);if(l&&l.slice.size<l.to-l.from){if(t){let a=e.tr.step(l);a.setSelection(Ya(o,"end")?Ue.findFrom(a.doc.resolve(a.mapping.map(s.pos,-1)),-1):$e.create(a.doc,s.pos-o.nodeSize)),t(a.scrollIntoView())}return!0}if(i==1||r.node(i-1).childCount>1)break}return o.isAtom&&s.depth==r.depth-1?(t&&t(e.tr.delete(s.pos-o.nodeSize,s.pos).scrollIntoView()),!0):!1},yG=(e,t,n)=>{let r=aL(e,n);if(!r)return!1;let s=Fb(r);return s?uL(e,s,t):!1},wG=(e,t,n)=>{let r=fL(e,n);if(!r)return!1;let s=Bb(r);return s?uL(e,s,t):!1};function uL(e,t,n){let r=t.nodeBefore,s=r,o=t.pos-1;for(;!s.isTextblock;o--){if(s.type.spec.isolating)return!1;let u=s.lastChild;if(!u)return!1;s=u}let i=t.nodeAfter,l=i,a=t.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let c=jm(e.doc,o,a,xe.empty);if(!c||c.from!=o||c instanceof Kt&&c.slice.size>=a-o)return!1;if(n){let u=e.tr.step(c);u.setSelection(Pe.create(u.doc,o)),n(u.scrollIntoView())}return!0}function Ya(e,t,n=!1){for(let r=e;r;r=t=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const dL=(e,t,n)=>{let{$head:r,empty:s}=e.selection,o=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;o=Fb(r)}let i=o&&o.nodeBefore;return!i||!$e.isSelectable(i)?!1:(t&&t(e.tr.setSelection($e.create(e.doc,o.pos-i.nodeSize)).scrollIntoView()),!0)};function Fb(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function fL(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}const hL=(e,t,n)=>{let r=fL(e,n);if(!r)return!1;let s=Bb(r);if(!s)return!1;let o=s.nodeAfter;if(wL(e,s,t,1))return!0;if(r.parent.content.size==0&&(Ya(o,"start")||$e.isSelectable(o))){let i=jm(e.doc,r.before(),r.after(),xe.empty);if(i&&i.slice.size<i.to-i.from){if(t){let l=e.tr.step(i);l.setSelection(Ya(o,"start")?Ue.findFrom(l.doc.resolve(l.mapping.map(s.pos)),1):$e.create(l.doc,l.mapping.map(s.pos))),t(l.scrollIntoView())}return!0}}return o.isAtom&&s.depth==r.depth-1?(t&&t(e.tr.delete(s.pos,s.pos+o.nodeSize).scrollIntoView()),!0):!1},pL=(e,t,n)=>{let{$head:r,empty:s}=e.selection,o=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;o=Bb(r)}let i=o&&o.nodeAfter;return!i||!$e.isSelectable(i)?!1:(t&&t(e.tr.setSelection($e.create(e.doc,o.pos)).scrollIntoView()),!0)};function Bb(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}const kG=(e,t)=>{let n=e.selection,r=n instanceof $e,s;if(r){if(n.node.isTextblock||!Si(e.doc,n.from))return!1;s=n.from}else if(s=Am(e.doc,n.from,-1),s==null)return!1;if(t){let o=e.tr.join(s);r&&o.setSelection($e.create(o.doc,s-e.doc.resolve(s).nodeBefore.nodeSize)),t(o.scrollIntoView())}return!0},xG=(e,t)=>{let n=e.selection,r;if(n instanceof $e){if(n.node.isTextblock||!Si(e.doc,n.to))return!1;r=n.to}else if(r=Am(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},bG=(e,t)=>{let{$from:n,$to:r}=e.selection,s=n.blockRange(r),o=s&&sc(s);return o==null?!1:(t&&t(e.tr.lift(s,o).scrollIntoView()),!0)},mL=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
209
+ `).scrollIntoView()),!0)};function Hb(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const vG=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let s=n.node(-1),o=n.indexAfter(-1),i=Hb(s.contentMatchAt(o));if(!i||!s.canReplaceWith(o,o,i))return!1;if(t){let l=n.after(),a=e.tr.replaceWith(l,l,i.createAndFill());a.setSelection(Ue.near(a.doc.resolve(l),1)),t(a.scrollIntoView())}return!0},gL=(e,t)=>{let n=e.selection,{$from:r,$to:s}=n;if(n instanceof Cr||r.parent.inlineContent||s.parent.inlineContent)return!1;let o=Hb(s.parent.contentMatchAt(s.indexAfter()));if(!o||!o.isTextblock)return!1;if(t){let i=(!r.parentOffset&&s.index()<s.parent.childCount?r:s).pos,l=e.tr.insert(i,o.createAndFill());l.setSelection(Pe.create(l.doc,i+1)),t(l.scrollIntoView())}return!0},yL=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let o=n.before();if(ao(e.doc,o))return t&&t(e.tr.split(o).scrollIntoView()),!0}let r=n.blockRange(),s=r&&sc(r);return s==null?!1:(t&&t(e.tr.lift(r,s).scrollIntoView()),!0)};function SG(e){return(t,n)=>{if(t.selection instanceof $e&&t.selection.node.isBlock){let{$from:p}=t.selection;return!p.parentOffset||!ao(t.doc,p.pos)?!1:(n&&n(t.tr.split(p.pos).scrollIntoView()),!0)}if(!t.selection.$from.depth)return!1;let r=t.tr;!t.selection.empty&&(t.selection instanceof Pe||t.selection instanceof Cr)&&r.deleteSelection();let{$from:s}=r.selection,o=r.steps.length,i=[],l,a,c=!1,u=!1;for(let p=s.depth;;p--)if(s.node(p).isBlock){c=s.end(p)==s.pos+(s.depth-p),u=s.start(p)==s.pos-(s.depth-p),a=Hb(s.node(p-1).contentMatchAt(s.indexAfter(p-1))),i.unshift(c&&a?{type:a}:null),l=p;break}else{if(p==1)return!1;i.unshift(null)}let f=s.pos,h=ao(r.doc,f,i.length,i);if(h||(i[0]=a?{type:a}:null,h=ao(r.doc,f,i.length,i)),!h)return!1;if(r.split(f,i.length,i),!c&&u&&s.node(l).type!=a){let p=r.mapping.slice(o),m=p.map(s.before(l)),y=r.doc.resolve(m);a&&s.node(l-1).canReplaceWith(y.index(),y.index()+1,a)&&r.setNodeMarkup(p.map(s.before(l)),a)}return n&&n(r.scrollIntoView()),!0}}const CG=SG(),EG=(e,t)=>{let{$from:n,to:r}=e.selection,s,o=n.sharedDepth(r);return o==0?!1:(s=n.before(o),t&&t(e.tr.setSelection($e.create(e.doc,s))),!0)};function NG(e,t,n){let r=t.nodeBefore,s=t.nodeAfter,o=t.index();return!r||!s||!r.type.compatibleContent(s.type)?!1:!r.content.size&&t.parent.canReplace(o-1,o)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(o,o+1)||!(s.isTextblock||Si(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function wL(e,t,n,r){let s=t.nodeBefore,o=t.nodeAfter,i,l,a=s.type.spec.isolating||o.type.spec.isolating;if(!a&&NG(e,t,n))return!0;let c=!a&&t.parent.canReplace(t.index(),t.index()+1);if(c&&(i=(l=s.contentMatchAt(s.childCount)).findWrapping(o.type))&&l.matchType(i[0]||o.type).validEnd){if(n){let p=t.pos+o.nodeSize,m=Z.empty;for(let k=i.length-1;k>=0;k--)m=Z.from(i[k].create(null,m));m=Z.from(s.copy(m));let y=e.tr.step(new sn(t.pos-1,p,t.pos,p,new xe(m,1,0),i.length,!0)),x=y.doc.resolve(p+2*i.length);x.nodeAfter&&x.nodeAfter.type==s.type&&Si(y.doc,x.pos)&&y.join(x.pos),n(y.scrollIntoView())}return!0}let u=o.type.spec.isolating||r>0&&a?null:Ue.findFrom(t,1),f=u&&u.$from.blockRange(u.$to),h=f&&sc(f);if(h!=null&&h>=t.depth)return n&&n(e.tr.lift(f,h).scrollIntoView()),!0;if(c&&Ya(o,"start",!0)&&Ya(s,"end")){let p=s,m=[];for(;m.push(p),!p.isTextblock;)p=p.lastChild;let y=o,x=1;for(;!y.isTextblock;y=y.firstChild)x++;if(p.canReplace(p.childCount,p.childCount,y.content)){if(n){let k=Z.empty;for(let b=m.length-1;b>=0;b--)k=Z.from(m[b].copy(k));let v=e.tr.step(new sn(t.pos-m.length,t.pos+o.nodeSize,t.pos+x,t.pos+o.nodeSize-x,new xe(k,m.length,0),0,!0));n(v.scrollIntoView())}return!0}}return!1}function kL(e){return function(t,n){let r=t.selection,s=e<0?r.$from:r.$to,o=s.depth;for(;s.node(o).isInline;){if(!o)return!1;o--}return s.node(o).isTextblock?(n&&n(t.tr.setSelection(Pe.create(t.doc,e<0?s.start(o):s.end(o)))),!0):!1}}const TG=kL(-1),AG=kL(1);function jG(e,t=null){return function(n,r){let{$from:s,$to:o}=n.selection,i=s.blockRange(o),l=i&&Nb(i,e,t);return l?(r&&r(n.tr.wrap(i,l).scrollIntoView()),!0):!1}}function sT(e,t=null){return function(n,r){let s=!1;for(let o=0;o<n.selection.ranges.length&&!s;o++){let{$from:{pos:i},$to:{pos:l}}=n.selection.ranges[o];n.doc.nodesBetween(i,l,(a,c)=>{if(s)return!1;if(!(!a.isTextblock||a.hasMarkup(e,t)))if(a.type==e)s=!0;else{let u=n.doc.resolve(c),f=u.index();s=u.parent.canReplaceWith(f,f+1,e)}})}if(!s)return!1;if(r){let o=n.tr;for(let i=0;i<n.selection.ranges.length;i++){let{$from:{pos:l},$to:{pos:a}}=n.selection.ranges[i];o.setBlockType(l,a,e,t)}r(o.scrollIntoView())}return!0}}function Wb(...e){return function(t,n,r){for(let s=0;s<e.length;s++)if(e[s](t,n,r))return!0;return!1}}Wb(_b,cL,dL);Wb(_b,hL,pL);Wb(mL,gL,yL,CG);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function MG(e,t=null){return function(n,r){let{$from:s,$to:o}=n.selection,i=s.blockRange(o);if(!i)return!1;let l=r?n.tr:null;return RG(l,i,e,t)?(r&&r(l.scrollIntoView()),!0):!1}}function RG(e,t,n,r=null){let s=!1,o=t,i=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let a=i.resolve(t.start-2);o=new ep(a,a,t.depth),t.endIndex<t.parent.childCount&&(t=new ep(t.$from,i.resolve(t.$to.end(t.depth)),t.depth)),s=!0}let l=Nb(o,n,r,t);return l?(e&&OG(e,t,l,s,n),!0):!1}function OG(e,t,n,r,s){let o=Z.empty;for(let u=n.length-1;u>=0;u--)o=Z.from(n[u].type.create(n[u].attrs,o));e.step(new sn(t.start-(r?2:0),t.end,t.start,t.end,new xe(o,0,0),n.length,!0));let i=0;for(let u=0;u<n.length;u++)n[u].type==s&&(i=u+1);let l=n.length-i,a=t.start+n.length-(r?2:0),c=t.parent;for(let u=t.startIndex,f=t.endIndex,h=!0;u<f;u++,h=!1)!h&&ao(e.doc,a,l)&&(e.split(a,l),a+=2*l),a+=c.child(u).nodeSize;return e}function IG(e){return function(t,n){let{$from:r,$to:s}=t.selection,o=r.blockRange(s,i=>i.childCount>0&&i.firstChild.type==e);return o?n?r.node(o.depth-1).type==e?DG(t,n,e,o):LG(t,n,o):!0:!1}}function DG(e,t,n,r){let s=e.tr,o=r.end,i=r.$to.end(r.depth);o<i&&(s.step(new sn(o-1,i,o,i,new xe(Z.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new ep(s.doc.resolve(r.$from.pos),s.doc.resolve(i),r.depth));const l=sc(r);if(l==null)return!1;s.lift(r,l);let a=s.doc.resolve(s.mapping.map(o,-1)-1);return Si(s.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&s.join(a.pos),t(s.scrollIntoView()),!0}function LG(e,t,n){let r=e.tr,s=n.parent;for(let p=n.end,m=n.endIndex-1,y=n.startIndex;m>y;m--)p-=s.child(m).nodeSize,r.delete(p-1,p+1);let o=r.doc.resolve(n.start),i=o.nodeAfter;if(r.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,a=n.endIndex==s.childCount,c=o.node(-1),u=o.index(-1);if(!c.canReplace(u+(l?0:1),u+1,i.content.append(a?Z.empty:Z.from(s))))return!1;let f=o.pos,h=f+i.nodeSize;return r.step(new sn(f-(l?1:0),h+(a?1:0),f+1,h-1,new xe((l?Z.empty:Z.from(s.copy(Z.empty))).append(a?Z.empty:Z.from(s.copy(Z.empty))),l?0:1,a?0:1),l?0:1)),t(r.scrollIntoView()),!0}function PG(e){return function(t,n){let{$from:r,$to:s}=t.selection,o=r.blockRange(s,c=>c.childCount>0&&c.firstChild.type==e);if(!o)return!1;let i=o.startIndex;if(i==0)return!1;let l=o.parent,a=l.child(i-1);if(a.type!=e)return!1;if(n){let c=a.lastChild&&a.lastChild.type==l.type,u=Z.from(c?e.create():null),f=new xe(Z.from(e.create(null,Z.from(l.type.create(null,u)))),c?3:1,0),h=o.start,p=o.end;n(t.tr.step(new sn(h-(c?3:1),p,h,p,f,1,!0)).scrollIntoView())}return!0}}function Im(e){const{state:t,transaction:n}=e;let{selection:r}=n,{doc:s}=n,{storedMarks:o}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return o},get selection(){return r},get doc(){return s},get tr(){return r=n.selection,s=n.doc,o=n.storedMarks,n}}}class Dm{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:n,state:r}=this,{view:s}=n,{tr:o}=r,i=this.buildProps(o);return Object.fromEntries(Object.entries(t).map(([l,a])=>[l,(...u)=>{const f=a(...u)(i);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(o),f}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,n=!0){const{rawCommands:r,editor:s,state:o}=this,{view:i}=s,l=[],a=!!t,c=t||o.tr,u=()=>(!a&&n&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(c),l.every(h=>h===!0)),f={...Object.fromEntries(Object.entries(r).map(([h,p])=>[h,(...y)=>{const x=this.buildProps(c,n),k=p(...y)(x);return l.push(k),f}])),run:u};return f}createCan(t){const{rawCommands:n,state:r}=this,s=!1,o=t||r.tr,i=this.buildProps(o,s);return{...Object.fromEntries(Object.entries(n).map(([a,c])=>[a,(...u)=>c(...u)({...i,dispatch:void 0})])),chain:()=>this.createChain(o,s)}}buildProps(t,n=!0){const{rawCommands:r,editor:s,state:o}=this,{view:i}=s,l={tr:t,editor:s,view:i,state:Im({state:o,transaction:t}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(t,n),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(r).map(([a,c])=>[a,(...u)=>c(...u)(l)]))}};return l}}class $G{constructor(){this.callbacks={}}on(t,n){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(n),this}emit(t,...n){const r=this.callbacks[t];return r&&r.forEach(s=>s.apply(this,n)),this}off(t,n){const r=this.callbacks[t];return r&&(n?this.callbacks[t]=r.filter(s=>s!==n):delete this.callbacks[t]),this}once(t,n){const r=(...s)=>{this.off(t,r),n.apply(this,s)};return this.on(t,r)}removeAllListeners(){this.callbacks={}}}function je(e,t,n){return e.config[t]===void 0&&e.parent?je(e.parent,t,n):typeof e.config[t]=="function"?e.config[t].bind({...n,parent:e.parent?je(e.parent,t,n):null}):e.config[t]}function Lm(e){const t=e.filter(s=>s.type==="extension"),n=e.filter(s=>s.type==="node"),r=e.filter(s=>s.type==="mark");return{baseExtensions:t,nodeExtensions:n,markExtensions:r}}function xL(e){const t=[],{nodeExtensions:n,markExtensions:r}=Lm(e),s=[...n,...r],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return e.forEach(i=>{const l={name:i.name,options:i.options,storage:i.storage,extensions:s},a=je(i,"addGlobalAttributes",l);if(!a)return;a().forEach(u=>{u.types.forEach(f=>{Object.entries(u.attributes).forEach(([h,p])=>{t.push({type:f,name:h,attribute:{...o,...p}})})})})}),s.forEach(i=>{const l={name:i.name,options:i.options,storage:i.storage},a=je(i,"addAttributes",l);if(!a)return;const c=a();Object.entries(c).forEach(([u,f])=>{const h={...o,...f};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,t.push({type:i.name,name:u,attribute:h})})}),t}function ln(e,t){if(typeof e=="string"){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}function At(...e){return e.filter(t=>!!t).reduce((t,n)=>{const r={...t};return Object.entries(n).forEach(([s,o])=>{if(!r[s]){r[s]=o;return}if(s==="class"){const l=o?String(o).split(" "):[],a=r[s]?r[s].split(" "):[],c=l.filter(u=>!a.includes(u));r[s]=[...a,...c].join(" ")}else if(s==="style"){const l=o?o.split(";").map(u=>u.trim()).filter(Boolean):[],a=r[s]?r[s].split(";").map(u=>u.trim()).filter(Boolean):[],c=new Map;a.forEach(u=>{const[f,h]=u.split(":").map(p=>p.trim());c.set(f,h)}),l.forEach(u=>{const[f,h]=u.split(":").map(p=>p.trim());c.set(f,h)}),r[s]=Array.from(c.entries()).map(([u,f])=>`${u}: ${f}`).join("; ")}else r[s]=o}),r},{})}function dx(e,t){return t.filter(n=>n.type===e.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(e.attrs)||{}:{[n.name]:e.attrs[n.name]}).reduce((n,r)=>At(n,r),{})}function bL(e){return typeof e=="function"}function qe(e,t=void 0,...n){return bL(e)?t?e.bind(t)(...n):e(...n):e}function zG(e={}){return Object.keys(e).length===0&&e.constructor===Object}function _G(e){return typeof e!="string"?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e==="true"?!0:e==="false"?!1:e}function oT(e,t){return"style"in e?e:{...e,getAttrs:n=>{const r=e.getAttrs?e.getAttrs(n):e.attrs;if(r===!1)return!1;const s=t.reduce((o,i)=>{const l=i.attribute.parseHTML?i.attribute.parseHTML(n):_G(n.getAttribute(i.name));return l==null?o:{...o,[i.name]:l}},{});return{...r,...s}}}}function iT(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>t==="attrs"&&zG(n)?!1:n!=null))}function FG(e,t){var n;const r=xL(e),{nodeExtensions:s,markExtensions:o}=Lm(e),i=(n=s.find(c=>je(c,"topNode")))===null||n===void 0?void 0:n.name,l=Object.fromEntries(s.map(c=>{const u=r.filter(k=>k.type===c.name),f={name:c.name,options:c.options,storage:c.storage,editor:t},h=e.reduce((k,v)=>{const b=je(v,"extendNodeSchema",f);return{...k,...b?b(c):{}}},{}),p=iT({...h,content:qe(je(c,"content",f)),marks:qe(je(c,"marks",f)),group:qe(je(c,"group",f)),inline:qe(je(c,"inline",f)),atom:qe(je(c,"atom",f)),selectable:qe(je(c,"selectable",f)),draggable:qe(je(c,"draggable",f)),code:qe(je(c,"code",f)),whitespace:qe(je(c,"whitespace",f)),linebreakReplacement:qe(je(c,"linebreakReplacement",f)),defining:qe(je(c,"defining",f)),isolating:qe(je(c,"isolating",f)),attrs:Object.fromEntries(u.map(k=>{var v;return[k.name,{default:(v=k==null?void 0:k.attribute)===null||v===void 0?void 0:v.default}]}))}),m=qe(je(c,"parseHTML",f));m&&(p.parseDOM=m.map(k=>oT(k,u)));const y=je(c,"renderHTML",f);y&&(p.toDOM=k=>y({node:k,HTMLAttributes:dx(k,u)}));const x=je(c,"renderText",f);return x&&(p.toText=x),[c.name,p]})),a=Object.fromEntries(o.map(c=>{const u=r.filter(x=>x.type===c.name),f={name:c.name,options:c.options,storage:c.storage,editor:t},h=e.reduce((x,k)=>{const v=je(k,"extendMarkSchema",f);return{...x,...v?v(c):{}}},{}),p=iT({...h,inclusive:qe(je(c,"inclusive",f)),excludes:qe(je(c,"excludes",f)),group:qe(je(c,"group",f)),spanning:qe(je(c,"spanning",f)),code:qe(je(c,"code",f)),attrs:Object.fromEntries(u.map(x=>{var k;return[x.name,{default:(k=x==null?void 0:x.attribute)===null||k===void 0?void 0:k.default}]}))}),m=qe(je(c,"parseHTML",f));m&&(p.parseDOM=m.map(x=>oT(x,u)));const y=je(c,"renderHTML",f);return y&&(p.toDOM=x=>y({mark:x,HTMLAttributes:dx(x,u)})),[c.name,p]}));return new iD({topNode:i,nodes:l,marks:a})}function By(e,t){return t.nodes[e]||t.marks[e]||null}function lT(e,t){return Array.isArray(t)?t.some(n=>(typeof n=="string"?n:n.name)===e.name):t}function Ub(e,t){const n=Ml.fromSchema(t).serializeFragment(e),s=document.implementation.createHTMLDocument().createElement("div");return s.appendChild(n),s.innerHTML}const BG=(e,t=500)=>{let n="";const r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(s,o,i,l)=>{var a,c;const u=((c=(a=s.type.spec).toText)===null||c===void 0?void 0:c.call(a,{node:s,pos:o,parent:i,index:l}))||s.textContent||"%leaf%";n+=s.isAtom&&!s.isText?u:u.slice(0,Math.max(0,r-o))}),n};function Vb(e){return Object.prototype.toString.call(e)==="[object RegExp]"}class gd{constructor(t){this.find=t.find,this.handler=t.handler}}const HG=(e,t)=>{if(Vb(t))return t.exec(e);const n=t(e);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function wf(e){var t;const{editor:n,from:r,to:s,text:o,rules:i,plugin:l}=e,{view:a}=n;if(a.composing)return!1;const c=a.state.doc.resolve(r);if(c.parent.type.spec.code||!((t=c.nodeBefore||c.nodeAfter)===null||t===void 0)&&t.marks.find(h=>h.type.spec.code))return!1;let u=!1;const f=BG(c)+o;return i.forEach(h=>{if(u)return;const p=HG(f,h.find);if(!p)return;const m=a.state.tr,y=Im({state:a.state,transaction:m}),x={from:r-(p[0].length-o.length),to:s},{commands:k,chain:v,can:b}=new Dm({editor:n,state:y});h.handler({state:y,range:x,match:p,commands:k,chain:v,can:b})===null||!m.steps.length||(m.setMeta(l,{transform:m,from:r,to:s,text:o}),a.dispatch(m),u=!0)}),u}function WG(e){const{editor:t,rules:n}=e,r=new Gt({state:{init(){return null},apply(s,o,i){const l=s.getMeta(r);if(l)return l;const a=s.getMeta("applyInputRules");return!!a&&setTimeout(()=>{let{text:u}=a;typeof u=="string"?u=u:u=Ub(Z.from(u),i.schema);const{from:f}=a,h=f+u.length;wf({editor:t,from:f,to:h,text:u,rules:n,plugin:r})}),s.selectionSet||s.docChanged?null:o}},props:{handleTextInput(s,o,i,l){return wf({editor:t,from:o,to:i,text:l,rules:n,plugin:r})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:o}=s.state.selection;o&&wf({editor:t,from:o.pos,to:o.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(s,o){if(o.key!=="Enter")return!1;const{$cursor:i}=s.state.selection;return i?wf({editor:t,from:i.pos,to:i.pos,text:`
210
+ `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function UG(e){return Object.prototype.toString.call(e).slice(8,-1)}function kf(e){return UG(e)!=="Object"?!1:e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function Pm(e,t){const n={...e};return kf(e)&&kf(t)&&Object.keys(t).forEach(r=>{kf(t[r])&&kf(e[r])?n[r]=Pm(e[r],t[r]):n[r]=t[r]}),n}class Os{constructor(t={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=qe(je(this,"addOptions",{name:this.name}))),this.storage=qe(je(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new Os(t)}configure(t={}){const n=this.extend({...this.config,addOptions:()=>Pm(this.options,t)});return n.name=this.name,n.parent=this.parent,n}extend(t={}){const n=new Os(t);return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=qe(je(n,"addOptions",{name:n.name})),n.storage=qe(je(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:t,mark:n}){const{tr:r}=t.state,s=t.state.selection.$from;if(s.pos===s.end()){const i=s.marks();if(!!!i.find(c=>(c==null?void 0:c.type.name)===n.name))return!1;const a=i.find(c=>(c==null?void 0:c.type.name)===n.name);return a&&r.removeStoredMark(a),r.insertText(" ",s.pos),t.view.dispatch(r),!0}return!1}}function VG(e){return typeof e=="number"}class KG{constructor(t){this.find=t.find,this.handler=t.handler}}const qG=(e,t,n)=>{if(Vb(t))return[...e.matchAll(t)];const r=t(e,n);return r?r.map(s=>{const o=[s.text];return o.index=s.index,o.input=e,o.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(s.replaceWith)),o}):[]};function YG(e){const{editor:t,state:n,from:r,to:s,rule:o,pasteEvent:i,dropEvent:l}=e,{commands:a,chain:c,can:u}=new Dm({editor:t,state:n}),f=[];return n.doc.nodesBetween(r,s,(p,m)=>{if(!p.isTextblock||p.type.spec.code)return;const y=Math.max(r,m),x=Math.min(s,m+p.content.size),k=p.textBetween(y-m,x-m,void 0,"");qG(k,o.find,i).forEach(b=>{if(b.index===void 0)return;const E=y+b.index+1,N=E+b[0].length,T={from:n.tr.mapping.map(E),to:n.tr.mapping.map(N)},A=o.handler({state:n,range:T,match:b,commands:a,chain:c,can:u,pasteEvent:i,dropEvent:l});f.push(A)})}),f.every(p=>p!==null)}let xf=null;const GG=e=>{var t;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(t=n.clipboardData)===null||t===void 0||t.setData("text/html",e),n};function JG(e){const{editor:t,rules:n}=e;let r=null,s=!1,o=!1,i=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const a=({state:u,from:f,to:h,rule:p,pasteEvt:m})=>{const y=u.tr,x=Im({state:u,transaction:y});if(!(!YG({editor:t,state:x,from:Math.max(f-1,0),to:h.b-1,rule:p,pasteEvent:m,dropEvent:l})||!y.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return i=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,y}};return n.map(u=>new Gt({view(f){const h=m=>{var y;r=!((y=f.dom.parentElement)===null||y===void 0)&&y.contains(m.target)?f.dom.parentElement:null,r&&(xf=t)},p=()=>{xf&&(xf=null)};return window.addEventListener("dragstart",h),window.addEventListener("dragend",p),{destroy(){window.removeEventListener("dragstart",h),window.removeEventListener("dragend",p)}}},props:{handleDOMEvents:{drop:(f,h)=>{if(o=r===f.dom.parentElement,l=h,!o){const p=xf;p!=null&&p.isEditable&&setTimeout(()=>{const m=p.state.selection;m&&p.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(f,h)=>{var p;const m=(p=h.clipboardData)===null||p===void 0?void 0:p.getData("text/html");return i=h,s=!!(m!=null&&m.includes("data-pm-slice")),!1}}},appendTransaction:(f,h,p)=>{const m=f[0],y=m.getMeta("uiEvent")==="paste"&&!s,x=m.getMeta("uiEvent")==="drop"&&!o,k=m.getMeta("applyPasteRules"),v=!!k;if(!y&&!x&&!v)return;if(v){let{text:N}=k;typeof N=="string"?N=N:N=Ub(Z.from(N),p.schema);const{from:T}=k,A=T+N.length,R=GG(N);return a({rule:u,state:p,from:T,to:{b:A},pasteEvt:R})}const b=h.doc.content.findDiffStart(p.doc.content),E=h.doc.content.findDiffEnd(p.doc.content);if(!(!VG(b)||!E||b===E.b))return a({rule:u,state:p,from:b,to:E,pasteEvt:i})}}))}function QG(e){const t=e.filter((n,r)=>e.indexOf(n)!==r);return Array.from(new Set(t))}class xa{constructor(t,n){this.splittableMarks=[],this.editor=n,this.extensions=xa.resolve(t),this.schema=FG(this.extensions,n),this.setupExtensions()}static resolve(t){const n=xa.sort(xa.flatten(t)),r=QG(n.map(s=>s.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(s=>`'${s}'`).join(", ")}]. This can lead to issues.`),n}static flatten(t){return t.map(n=>{const r={name:n.name,options:n.options,storage:n.storage},s=je(n,"addExtensions",r);return s?[n,...this.flatten(s())]:n}).flat(10)}static sort(t){return t.sort((r,s)=>{const o=je(r,"priority")||100,i=je(s,"priority")||100;return o>i?-1:o<i?1:0})}get commands(){return this.extensions.reduce((t,n)=>{const r={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:By(n.name,this.schema)},s=je(n,"addCommands",r);return s?{...t,...s()}:t},{})}get plugins(){const{editor:t}=this,n=xa.sort([...this.extensions].reverse()),r=[],s=[],o=n.map(i=>{const l={name:i.name,options:i.options,storage:i.storage,editor:t,type:By(i.name,this.schema)},a=[],c=je(i,"addKeyboardShortcuts",l);let u={};if(i.type==="mark"&&je(i,"exitable",l)&&(u.ArrowRight=()=>Os.handleExit({editor:t,mark:i})),c){const y=Object.fromEntries(Object.entries(c()).map(([x,k])=>[x,()=>k({editor:t})]));u={...u,...y}}const f=gG(u);a.push(f);const h=je(i,"addInputRules",l);lT(i,t.options.enableInputRules)&&h&&r.push(...h());const p=je(i,"addPasteRules",l);lT(i,t.options.enablePasteRules)&&p&&s.push(...p());const m=je(i,"addProseMirrorPlugins",l);if(m){const y=m();a.push(...y)}return a}).flat();return[WG({editor:t,rules:r}),...JG({editor:t,rules:s}),...o]}get attributes(){return xL(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:n}=Lm(this.extensions);return Object.fromEntries(n.filter(r=>!!je(r,"addNodeView")).map(r=>{const s=this.attributes.filter(a=>a.type===r.name),o={name:r.name,options:r.options,storage:r.storage,editor:t,type:ln(r.name,this.schema)},i=je(r,"addNodeView",o);if(!i)return[];const l=(a,c,u,f,h)=>{const p=dx(a,s);return i()({node:a,view:c,getPos:u,decorations:f,innerDecorations:h,editor:t,extension:r,HTMLAttributes:p})};return[r.name,l]}))}setupExtensions(){this.extensions.forEach(t=>{var n;this.editor.extensionStorage[t.name]=t.storage;const r={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:By(t.name,this.schema)};t.type==="mark"&&(!((n=qe(je(t,"keepOnSplit",r)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(t.name);const s=je(t,"onBeforeCreate",r),o=je(t,"onCreate",r),i=je(t,"onUpdate",r),l=je(t,"onSelectionUpdate",r),a=je(t,"onTransaction",r),c=je(t,"onFocus",r),u=je(t,"onBlur",r),f=je(t,"onDestroy",r);s&&this.editor.on("beforeCreate",s),o&&this.editor.on("create",o),i&&this.editor.on("update",i),l&&this.editor.on("selectionUpdate",l),a&&this.editor.on("transaction",a),c&&this.editor.on("focus",c),u&&this.editor.on("blur",u),f&&this.editor.on("destroy",f)})}}class an{constructor(t={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=qe(je(this,"addOptions",{name:this.name}))),this.storage=qe(je(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new an(t)}configure(t={}){const n=this.extend({...this.config,addOptions:()=>Pm(this.options,t)});return n.name=this.name,n.parent=this.parent,n}extend(t={}){const n=new an({...this.config,...t});return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=qe(je(n,"addOptions",{name:n.name})),n.storage=qe(je(n,"addStorage",{name:n.name,options:n.options})),n}}function vL(e,t,n){const{from:r,to:s}=t,{blockSeparator:o=`
211
+
212
+ `,textSerializers:i={}}=n||{};let l="";return e.nodesBetween(r,s,(a,c,u,f)=>{var h;a.isBlock&&c>r&&(l+=o);const p=i==null?void 0:i[a.type.name];if(p)return u&&(l+=p({node:a,pos:c,parent:u,index:f,range:t})),!1;a.isText&&(l+=(h=a==null?void 0:a.text)===null||h===void 0?void 0:h.slice(Math.max(r,c)-c,s-c))}),l}function SL(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,t])=>t.spec.toText).map(([t,n])=>[t,n.spec.toText]))}const XG=an.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Gt({key:new Sn("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:s}=t,{ranges:o}=s,i=Math.min(...o.map(u=>u.$from.pos)),l=Math.max(...o.map(u=>u.$to.pos)),a=SL(n);return vL(r,{from:i,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),ZG=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),(n=window==null?void 0:window.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),eJ=(e=!1)=>({commands:t})=>t.setContent("",e),tJ=()=>({state:e,tr:t,dispatch:n})=>{const{selection:r}=t,{ranges:s}=r;return n&&s.forEach(({$from:o,$to:i})=>{e.doc.nodesBetween(o.pos,i.pos,(l,a)=>{if(l.type.isText)return;const{doc:c,mapping:u}=t,f=c.resolve(u.map(a)),h=c.resolve(u.map(a+l.nodeSize)),p=f.blockRange(h);if(!p)return;const m=sc(p);if(l.type.isTextblock){const{defaultType:y}=f.parent.contentMatchAt(f.index());t.setNodeMarkup(p.start,y)}(m||m===0)&&t.lift(p,m)})}),!0},nJ=e=>t=>e(t),rJ=()=>({state:e,dispatch:t})=>gL(e,t),sJ=(e,t)=>({editor:n,tr:r})=>{const{state:s}=n,o=s.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);const i=r.mapping.map(t);return r.insert(i,o.content),r.setSelection(new Pe(r.doc.resolve(Math.max(i-1,0)))),!0},oJ=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;const s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===r.type){if(t){const l=s.before(o),a=s.after(o);e.delete(l,a).scrollIntoView()}return!0}return!1},iJ=e=>({tr:t,state:n,dispatch:r})=>{const s=ln(e,n.schema),o=t.selection.$anchor;for(let i=o.depth;i>0;i-=1)if(o.node(i).type===s){if(r){const a=o.before(i),c=o.after(i);t.delete(a,c).scrollIntoView()}return!0}return!1},lJ=e=>({tr:t,dispatch:n})=>{const{from:r,to:s}=e;return n&&t.delete(r,s),!0},aJ=()=>({state:e,dispatch:t})=>_b(e,t),cJ=()=>({commands:e})=>e.keyboardShortcut("Enter"),uJ=()=>({state:e,dispatch:t})=>vG(e,t);function ap(e,t,n={strict:!0}){const r=Object.keys(t);return r.length?r.every(s=>n.strict?t[s]===e[s]:Vb(t[s])?t[s].test(e[s]):t[s]===e[s]):!0}function CL(e,t,n={}){return e.find(r=>r.type===t&&ap(Object.fromEntries(Object.keys(n).map(s=>[s,r.attrs[s]])),n))}function aT(e,t,n={}){return!!CL(e,t,n)}function Kb(e,t,n){var r;if(!e||!t)return;let s=e.parent.childAfter(e.parentOffset);if((!s.node||!s.node.marks.some(u=>u.type===t))&&(s=e.parent.childBefore(e.parentOffset)),!s.node||!s.node.marks.some(u=>u.type===t)||(n=n||((r=s.node.marks[0])===null||r===void 0?void 0:r.attrs),!CL([...s.node.marks],t,n)))return;let i=s.index,l=e.start()+s.offset,a=i+1,c=l+s.node.nodeSize;for(;i>0&&aT([...e.parent.child(i-1).marks],t,n);)i-=1,l-=e.parent.child(i).nodeSize;for(;a<e.parent.childCount&&aT([...e.parent.child(a).marks],t,n);)c+=e.parent.child(a).nodeSize,a+=1;return{from:l,to:c}}function Ei(e,t){if(typeof e=="string"){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}const dJ=(e,t={})=>({tr:n,state:r,dispatch:s})=>{const o=Ei(e,r.schema),{doc:i,selection:l}=n,{$from:a,from:c,to:u}=l;if(s){const f=Kb(a,o,t);if(f&&f.from<=c&&f.to>=u){const h=Pe.create(i,f.from,f.to);n.setSelection(h)}}return!0},fJ=e=>t=>{const n=typeof e=="function"?e(t):e;for(let r=0;r<n.length;r+=1)if(n[r](t))return!0;return!1};function EL(e){return e instanceof Pe}function Qi(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function NL(e,t=null){if(!t)return null;const n=Ue.atStart(e),r=Ue.atEnd(e);if(t==="start"||t===!0)return n;if(t==="end")return r;const s=n.from,o=r.to;return t==="all"?Pe.create(e,Qi(0,s,o),Qi(e.content.size,s,o)):Pe.create(e,Qi(t,s,o),Qi(t,s,o))}function cT(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function cp(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function hJ(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const pJ=(e=null,t={})=>({editor:n,view:r,tr:s,dispatch:o})=>{t={scrollIntoView:!0,...t};const i=()=>{(cp()||cT())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),hJ()&&!cp()&&!cT()&&r.dom.focus({preventScroll:!0}))})};if(r.hasFocus()&&e===null||e===!1)return!0;if(o&&e===null&&!EL(n.state.selection))return i(),!0;const l=NL(s.doc,e)||n.state.selection,a=n.state.selection.eq(l);return o&&(a||s.setSelection(l),a&&s.storedMarks&&s.setStoredMarks(s.storedMarks),i()),!0},mJ=(e,t)=>n=>e.every((r,s)=>t(r,{...n,index:s})),gJ=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),TL=e=>{const t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){const r=t[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):r.nodeType===1&&TL(r)}return e};function bf(e){const t=`<body>${e}</body>`,n=new window.DOMParser().parseFromString(t,"text/html").body;return TL(n)}function Gu(e,t,n){if(e instanceof ii||e instanceof Z)return e;n={slice:!0,parseOptions:{},...n};const r=typeof e=="object"&&e!==null,s=typeof e=="string";if(r)try{if(Array.isArray(e)&&e.length>0)return Z.fromArray(e.map(l=>t.nodeFromJSON(l)));const i=t.nodeFromJSON(e);return n.errorOnInvalidContent&&i.check(),i}catch(o){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",o),Gu("",t,n)}if(s){if(n.errorOnInvalidContent){let i=!1,l="";const a=new iD({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(i=!0,l=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?li.fromSchema(a).parseSlice(bf(e),n.parseOptions):li.fromSchema(a).parse(bf(e),n.parseOptions),n.errorOnInvalidContent&&i)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const o=li.fromSchema(t);return n.slice?o.parseSlice(bf(e),n.parseOptions).content:o.parse(bf(e),n.parseOptions)}return Gu("",t,n)}function yJ(e,t,n){const r=e.steps.length-1;if(r<t)return;const s=e.steps[r];if(!(s instanceof Kt||s instanceof sn))return;const o=e.mapping.maps[r];let i=0;o.forEach((l,a,c,u)=>{i===0&&(i=u)}),e.setSelection(Ue.near(e.doc.resolve(i),n))}const wJ=e=>!("type"in e),kJ=(e,t,n)=>({tr:r,dispatch:s,editor:o})=>{var i;if(s){n={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l;const a=x=>{o.emit("contentError",{editor:o,error:x,disableCollaboration:()=>{o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{Gu(t,o.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(x){a(x)}try{l=Gu(t,o.schema,{parseOptions:c,errorOnInvalidContent:(i=n.errorOnInvalidContent)!==null&&i!==void 0?i:o.options.enableContentCheck})}catch(x){return a(x),!1}let{from:u,to:f}=typeof e=="number"?{from:e,to:e}:{from:e.from,to:e.to},h=!0,p=!0;if((wJ(l)?l:[l]).forEach(x=>{x.check(),h=h?x.isText&&x.marks.length===0:!1,p=p?x.isBlock:!1}),u===f&&p){const{parent:x}=r.doc.resolve(u);x.isTextblock&&!x.type.spec.code&&!x.childCount&&(u-=1,f+=1)}let y;if(h){if(Array.isArray(t))y=t.map(x=>x.text||"").join("");else if(t instanceof Z){let x="";t.forEach(k=>{k.text&&(x+=k.text)}),y=x}else typeof t=="object"&&t&&t.text?y=t.text:y=t;r.insertText(y,u,f)}else y=l,r.replaceWith(u,f,y);n.updateSelection&&yJ(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:y}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:y})}return!0},xJ=()=>({state:e,dispatch:t})=>kG(e,t),bJ=()=>({state:e,dispatch:t})=>xG(e,t),vJ=()=>({state:e,dispatch:t})=>cL(e,t),SJ=()=>({state:e,dispatch:t})=>hL(e,t),CJ=()=>({state:e,dispatch:t,tr:n})=>{try{const r=Am(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},EJ=()=>({state:e,dispatch:t,tr:n})=>{try{const r=Am(e.doc,e.selection.$from.pos,1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},NJ=()=>({state:e,dispatch:t})=>yG(e,t),TJ=()=>({state:e,dispatch:t})=>wG(e,t);function AL(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function AJ(e){const t=e.split(/-(?!$)/);let n=t[t.length-1];n==="Space"&&(n=" ");let r,s,o,i;for(let l=0;l<t.length-1;l+=1){const a=t[l];if(/^(cmd|meta|m)$/i.test(a))i=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))s=!0;else if(/^s(hift)?$/i.test(a))o=!0;else if(/^mod$/i.test(a))cp()||AL()?i=!0:s=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return r&&(n=`Alt-${n}`),s&&(n=`Ctrl-${n}`),i&&(n=`Meta-${n}`),o&&(n=`Shift-${n}`),n}const jJ=e=>({editor:t,view:n,tr:r,dispatch:s})=>{const o=AJ(e).split(/-(?!$)/),i=o.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:i==="Space"?" ":i,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),a=t.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,l))});return a==null||a.steps.forEach(c=>{const u=c.map(r.mapping);u&&s&&r.maybeStep(u)}),!0};function Ju(e,t,n={}){const{from:r,to:s,empty:o}=e.selection,i=t?ln(t,e.schema):null,l=[];e.doc.nodesBetween(r,s,(f,h)=>{if(f.isText)return;const p=Math.max(r,h),m=Math.min(s,h+f.nodeSize);l.push({node:f,from:p,to:m})});const a=s-r,c=l.filter(f=>i?i.name===f.node.type.name:!0).filter(f=>ap(f.node.attrs,n,{strict:!1}));return o?!!c.length:c.reduce((f,h)=>f+h.to-h.from,0)>=a}const MJ=(e,t={})=>({state:n,dispatch:r})=>{const s=ln(e,n.schema);return Ju(n,s,t)?bG(n,r):!1},RJ=()=>({state:e,dispatch:t})=>yL(e,t),OJ=e=>({state:t,dispatch:n})=>{const r=ln(e,t.schema);return IG(r)(t,n)},IJ=()=>({state:e,dispatch:t})=>mL(e,t);function $m(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function uT(e,t){const n=typeof t=="string"?[t]:t;return Object.keys(e).reduce((r,s)=>(n.includes(s)||(r[s]=e[s]),r),{})}const DJ=(e,t)=>({tr:n,state:r,dispatch:s})=>{let o=null,i=null;const l=$m(typeof e=="string"?e:e.name,r.schema);return l?(l==="node"&&(o=ln(e,r.schema)),l==="mark"&&(i=Ei(e,r.schema)),s&&n.selection.ranges.forEach(a=>{r.doc.nodesBetween(a.$from.pos,a.$to.pos,(c,u)=>{o&&o===c.type&&n.setNodeMarkup(u,void 0,uT(c.attrs,t)),i&&c.marks.length&&c.marks.forEach(f=>{i===f.type&&n.addMark(u,u+c.nodeSize,i.create(uT(f.attrs,t)))})})}),!0):!1},LJ=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),PJ=()=>({tr:e,dispatch:t})=>{if(t){const n=new Cr(e.doc);e.setSelection(n)}return!0},$J=()=>({state:e,dispatch:t})=>dL(e,t),zJ=()=>({state:e,dispatch:t})=>pL(e,t),_J=()=>({state:e,dispatch:t})=>EG(e,t),FJ=()=>({state:e,dispatch:t})=>AG(e,t),BJ=()=>({state:e,dispatch:t})=>TG(e,t);function fx(e,t,n={},r={}){return Gu(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const HJ=(e,t=!1,n={},r={})=>({editor:s,tr:o,dispatch:i,commands:l})=>{var a,c;const{doc:u}=o;if(n.preserveWhitespace!=="full"){const f=fx(e,s.schema,n,{errorOnInvalidContent:(a=r.errorOnInvalidContent)!==null&&a!==void 0?a:s.options.enableContentCheck});return i&&o.replaceWith(0,u.content.size,f).setMeta("preventUpdate",!t),!0}return i&&o.setMeta("preventUpdate",!t),l.insertContentAt({from:0,to:u.content.size},e,{parseOptions:n,errorOnInvalidContent:(c=r.errorOnInvalidContent)!==null&&c!==void 0?c:s.options.enableContentCheck})};function jL(e,t){const n=Ei(t,e.schema),{from:r,to:s,empty:o}=e.selection,i=[];o?(e.storedMarks&&i.push(...e.storedMarks),i.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,s,a=>{i.push(...a.marks)});const l=i.find(a=>a.type.name===n.name);return l?{...l.attrs}:{}}function WJ(e,t){const n=new Tb(e);return t.forEach(r=>{r.steps.forEach(s=>{n.step(s)})}),n}function UJ(e){for(let t=0;t<e.edgeCount;t+=1){const{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function VJ(e,t,n){const r=[];return e.nodesBetween(t.from,t.to,(s,o)=>{n(s)&&r.push({node:s,pos:o})}),r}function ML(e,t){for(let n=e.depth;n>0;n-=1){const r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function qb(e){return t=>ML(t.$from,e)}function KJ(e,t){const n={from:0,to:e.content.size};return vL(e,n,t)}function qJ(e,t){const n=ln(t,e.schema),{from:r,to:s}=e.selection,o=[];e.doc.nodesBetween(r,s,l=>{o.push(l)});const i=o.reverse().find(l=>l.type.name===n.name);return i?{...i.attrs}:{}}function RL(e,t){const n=$m(typeof t=="string"?t:t.name,e.schema);return n==="node"?qJ(e,t):n==="mark"?jL(e,t):{}}function YJ(e,t=JSON.stringify){const n={};return e.filter(r=>{const s=t(r);return Object.prototype.hasOwnProperty.call(n,s)?!1:n[s]=!0})}function GJ(e){const t=YJ(e);return t.length===1?t:t.filter((n,r)=>!t.filter((o,i)=>i!==r).some(o=>n.oldRange.from>=o.oldRange.from&&n.oldRange.to<=o.oldRange.to&&n.newRange.from>=o.newRange.from&&n.newRange.to<=o.newRange.to))}function JJ(e){const{mapping:t,steps:n}=e,r=[];return t.maps.forEach((s,o)=>{const i=[];if(s.ranges.length)s.forEach((l,a)=>{i.push({from:l,to:a})});else{const{from:l,to:a}=n[o];if(l===void 0||a===void 0)return;i.push({from:l,to:a})}i.forEach(({from:l,to:a})=>{const c=t.slice(o).map(l,-1),u=t.slice(o).map(a),f=t.invert().map(c,-1),h=t.invert().map(u);r.push({oldRange:{from:f,to:h},newRange:{from:c,to:u}})})}),GJ(r)}function Yb(e,t,n){const r=[];return e===t?n.resolve(e).marks().forEach(s=>{const o=n.resolve(e),i=Kb(o,s.type);i&&r.push({mark:s,...i})}):n.nodesBetween(e,t,(s,o)=>{!s||(s==null?void 0:s.nodeSize)===void 0||r.push(...s.marks.map(i=>({from:o,to:o+s.nodeSize,mark:i})))}),r}function nh(e,t,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const s=e.find(o=>o.type===t&&o.name===r);return s?s.attribute.keepOnSplit:!1}))}function hx(e,t,n={}){const{empty:r,ranges:s}=e.selection,o=t?Ei(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(f=>o?o.name===f.type.name:!0).find(f=>ap(f.attrs,n,{strict:!1}));let i=0;const l=[];if(s.forEach(({$from:f,$to:h})=>{const p=f.pos,m=h.pos;e.doc.nodesBetween(p,m,(y,x)=>{if(!y.isText&&!y.marks.length)return;const k=Math.max(p,x),v=Math.min(m,x+y.nodeSize),b=v-k;i+=b,l.push(...y.marks.map(E=>({mark:E,from:k,to:v})))})}),i===0)return!1;const a=l.filter(f=>o?o.name===f.mark.type.name:!0).filter(f=>ap(f.mark.attrs,n,{strict:!1})).reduce((f,h)=>f+h.to-h.from,0),c=l.filter(f=>o?f.mark.type!==o&&f.mark.type.excludes(o):!0).reduce((f,h)=>f+h.to-h.from,0);return(a>0?a+c:a)>=i}function QJ(e,t,n={}){if(!t)return Ju(e,null,n)||hx(e,null,n);const r=$m(t,e.schema);return r==="node"?Ju(e,t,n):r==="mark"?hx(e,t,n):!1}function dT(e,t){const{nodeExtensions:n}=Lm(t),r=n.find(i=>i.name===e);if(!r)return!1;const s={name:r.name,options:r.options,storage:r.storage},o=qe(je(r,"group",s));return typeof o!="string"?!1:o.split(" ").includes("list")}function zm(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(e.type.name==="hardBreak")return!0;if(e.isText)return/^\s*$/m.test((r=e.text)!==null&&r!==void 0?r:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let s=!0;return e.content.forEach(o=>{s!==!1&&(zm(o,{ignoreWhitespace:n,checkChildren:t})||(s=!1))}),s}return!1}function XJ(e){return e instanceof $e}function ZJ(e,t,n){var r;const{selection:s}=t;let o=null;if(EL(s)&&(o=s.$cursor),o){const l=(r=e.storedMarks)!==null&&r!==void 0?r:o.marks();return!!n.isInSet(l)||!l.some(a=>a.type.excludes(n))}const{ranges:i}=s;return i.some(({$from:l,$to:a})=>{let c=l.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(n):!1;return e.doc.nodesBetween(l.pos,a.pos,(u,f,h)=>{if(c)return!1;if(u.isInline){const p=!h||h.type.allowsMarkType(n),m=!!n.isInSet(u.marks)||!u.marks.some(y=>y.type.excludes(n));c=p&&m}return!c}),c})}const eQ=(e,t={})=>({tr:n,state:r,dispatch:s})=>{const{selection:o}=n,{empty:i,ranges:l}=o,a=Ei(e,r.schema);if(s)if(i){const c=jL(r,a);n.addStoredMark(a.create({...c,...t}))}else l.forEach(c=>{const u=c.$from.pos,f=c.$to.pos;r.doc.nodesBetween(u,f,(h,p)=>{const m=Math.max(p,u),y=Math.min(p+h.nodeSize,f);h.marks.find(k=>k.type===a)?h.marks.forEach(k=>{a===k.type&&n.addMark(m,y,a.create({...k.attrs,...t}))}):n.addMark(m,y,a.create(t))})});return ZJ(r,n,a)},tQ=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),nQ=(e,t={})=>({state:n,dispatch:r,chain:s})=>{const o=ln(e,n.schema);let i;return n.selection.$anchor.sameParent(n.selection.$head)&&(i=n.selection.$anchor.parent.attrs),o.isTextblock?s().command(({commands:l})=>sT(o,{...i,...t})(n)?!0:l.clearNodes()).command(({state:l})=>sT(o,{...i,...t})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},rQ=e=>({tr:t,dispatch:n})=>{if(n){const{doc:r}=t,s=Qi(e,0,r.content.size),o=$e.create(r,s);t.setSelection(o)}return!0},sQ=e=>({tr:t,dispatch:n})=>{if(n){const{doc:r}=t,{from:s,to:o}=typeof e=="number"?{from:e,to:e}:e,i=Pe.atStart(r).from,l=Pe.atEnd(r).to,a=Qi(s,i,l),c=Qi(o,i,l),u=Pe.create(r,a,c);t.setSelection(u)}return!0},oQ=e=>({state:t,dispatch:n})=>{const r=ln(e,t.schema);return PG(r)(t,n)};function fT(e,t){const n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){const r=n.filter(s=>t==null?void 0:t.includes(s.type.name));e.tr.ensureMarks(r)}}const iQ=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:s})=>{const{selection:o,doc:i}=t,{$from:l,$to:a}=o,c=s.extensionManager.attributes,u=nh(c,l.node().type.name,l.node().attrs);if(o instanceof $e&&o.node.isBlock)return!l.parentOffset||!ao(i,l.pos)?!1:(r&&(e&&fT(n,s.extensionManager.splittableMarks),t.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const f=a.parentOffset===a.parent.content.size,h=l.depth===0?void 0:UJ(l.node(-1).contentMatchAt(l.indexAfter(-1)));let p=f&&h?[{type:h,attrs:u}]:void 0,m=ao(t.doc,t.mapping.map(l.pos),1,p);if(!p&&!m&&ao(t.doc,t.mapping.map(l.pos),1,h?[{type:h}]:void 0)&&(m=!0,p=h?[{type:h,attrs:u}]:void 0),r){if(m&&(o instanceof Pe&&t.deleteSelection(),t.split(t.mapping.map(l.pos),1,p),h&&!f&&!l.parentOffset&&l.parent.type!==h)){const y=t.mapping.map(l.before()),x=t.doc.resolve(y);l.node(-1).canReplaceWith(x.index(),x.index()+1,h)&&t.setNodeMarkup(t.mapping.map(l.before()),h)}e&&fT(n,s.extensionManager.splittableMarks),t.scrollIntoView()}return m},lQ=(e,t={})=>({tr:n,state:r,dispatch:s,editor:o})=>{var i;const l=ln(e,r.schema),{$from:a,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||a.depth<2||!a.sameParent(c))return!1;const f=a.node(-1);if(f.type!==l)return!1;const h=o.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==l||a.index(-2)!==a.node(-2).childCount-1)return!1;if(s){let k=Z.empty;const v=a.index(-1)?1:a.index(-2)?2:3;for(let R=a.depth-v;R>=a.depth-3;R-=1)k=Z.from(a.node(R).copy(k));const b=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,E={...nh(h,a.node().type.name,a.node().attrs),...t},N=((i=l.contentMatch.defaultType)===null||i===void 0?void 0:i.createAndFill(E))||void 0;k=k.append(Z.from(l.createAndFill(null,N)||void 0));const T=a.before(a.depth-(v-1));n.replace(T,a.after(-b),new xe(k,4-v,0));let A=-1;n.doc.nodesBetween(T,n.doc.content.size,(R,$)=>{if(A>-1)return!1;R.isTextblock&&R.content.size===0&&(A=$+1)}),A>-1&&n.setSelection(Pe.near(n.doc.resolve(A))),n.scrollIntoView()}return!0}const p=c.pos===a.end()?f.contentMatchAt(0).defaultType:null,m={...nh(h,f.type.name,f.attrs),...t},y={...nh(h,a.node().type.name,a.node().attrs),...t};n.delete(a.pos,c.pos);const x=p?[{type:l,attrs:m},{type:p,attrs:y}]:[{type:l,attrs:m}];if(!ao(n.doc,a.pos,2))return!1;if(s){const{selection:k,storedMarks:v}=r,{splittableMarks:b}=o.extensionManager,E=v||k.$to.parentOffset&&k.$from.marks();if(n.split(a.pos,2,x).scrollIntoView(),!E||!s)return!0;const N=E.filter(T=>b.includes(T.type.name));n.ensureMarks(N)}return!0},Hy=(e,t)=>{const n=qb(i=>i.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const s=e.doc.nodeAt(r);return n.node.type===(s==null?void 0:s.type)&&Si(e.doc,n.pos)&&e.join(n.pos),!0},Wy=(e,t)=>{const n=qb(i=>i.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const s=e.doc.nodeAt(r);return n.node.type===(s==null?void 0:s.type)&&Si(e.doc,r)&&e.join(r),!0},aQ=(e,t,n,r={})=>({editor:s,tr:o,state:i,dispatch:l,chain:a,commands:c,can:u})=>{const{extensions:f,splittableMarks:h}=s.extensionManager,p=ln(e,i.schema),m=ln(t,i.schema),{selection:y,storedMarks:x}=i,{$from:k,$to:v}=y,b=k.blockRange(v),E=x||y.$to.parentOffset&&y.$from.marks();if(!b)return!1;const N=qb(T=>dT(T.type.name,f))(y);if(b.depth>=1&&N&&b.depth-N.depth<=1){if(N.node.type===p)return c.liftListItem(m);if(dT(N.node.type.name,f)&&p.validContent(N.node.content)&&l)return a().command(()=>(o.setNodeMarkup(N.pos,p),!0)).command(()=>Hy(o,p)).command(()=>Wy(o,p)).run()}return!n||!E||!l?a().command(()=>u().wrapInList(p,r)?!0:c.clearNodes()).wrapInList(p,r).command(()=>Hy(o,p)).command(()=>Wy(o,p)).run():a().command(()=>{const T=u().wrapInList(p,r),A=E.filter(R=>h.includes(R.type.name));return o.ensureMarks(A),T?!0:c.clearNodes()}).wrapInList(p,r).command(()=>Hy(o,p)).command(()=>Wy(o,p)).run()},cQ=(e,t={},n={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:o=!1}=n,i=Ei(e,r.schema);return hx(r,i,t)?s.unsetMark(i,{extendEmptyMarkRange:o}):s.setMark(i,t)},uQ=(e,t,n={})=>({state:r,commands:s})=>{const o=ln(e,r.schema),i=ln(t,r.schema),l=Ju(r,o,n);let a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),l?s.setNode(i,a):s.setNode(o,{...a,...n})},dQ=(e,t={})=>({state:n,commands:r})=>{const s=ln(e,n.schema);return Ju(n,s,t)?r.lift(s):r.wrapIn(s,t)},fQ=()=>({state:e,dispatch:t})=>{const n=e.plugins;for(let r=0;r<n.length;r+=1){const s=n[r];let o;if(s.spec.isInputRules&&(o=s.getState(e))){if(t){const i=e.tr,l=o.transform;for(let a=l.steps.length-1;a>=0;a-=1)i.step(l.steps[a].invert(l.docs[a]));if(o.text){const a=i.doc.resolve(o.from).marks();i.replaceWith(o.from,o.to,e.schema.text(o.text,a))}else i.delete(o.from,o.to)}return!0}}return!1},hQ=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,{empty:r,ranges:s}=n;return r||t&&s.forEach(o=>{e.removeMark(o.$from.pos,o.$to.pos)}),!0},pQ=(e,t={})=>({tr:n,state:r,dispatch:s})=>{var o;const{extendEmptyMarkRange:i=!1}=t,{selection:l}=n,a=Ei(e,r.schema),{$from:c,empty:u,ranges:f}=l;if(!s)return!0;if(u&&i){let{from:h,to:p}=l;const m=(o=c.marks().find(x=>x.type===a))===null||o===void 0?void 0:o.attrs,y=Kb(c,a,m);y&&(h=y.from,p=y.to),n.removeMark(h,p,a)}else f.forEach(h=>{n.removeMark(h.$from.pos,h.$to.pos,a)});return n.removeStoredMark(a),!0},mQ=(e,t={})=>({tr:n,state:r,dispatch:s})=>{let o=null,i=null;const l=$m(typeof e=="string"?e:e.name,r.schema);return l?(l==="node"&&(o=ln(e,r.schema)),l==="mark"&&(i=Ei(e,r.schema)),s&&n.selection.ranges.forEach(a=>{const c=a.$from.pos,u=a.$to.pos;let f,h,p,m;n.selection.empty?r.doc.nodesBetween(c,u,(y,x)=>{o&&o===y.type&&(p=Math.max(x,c),m=Math.min(x+y.nodeSize,u),f=x,h=y)}):r.doc.nodesBetween(c,u,(y,x)=>{x<c&&o&&o===y.type&&(p=Math.max(x,c),m=Math.min(x+y.nodeSize,u),f=x,h=y),x>=c&&x<=u&&(o&&o===y.type&&n.setNodeMarkup(x,void 0,{...y.attrs,...t}),i&&y.marks.length&&y.marks.forEach(k=>{if(i===k.type){const v=Math.max(x,c),b=Math.min(x+y.nodeSize,u);n.addMark(v,b,i.create({...k.attrs,...t}))}}))}),h&&(f!==void 0&&n.setNodeMarkup(f,void 0,{...h.attrs,...t}),i&&h.marks.length&&h.marks.forEach(y=>{i===y.type&&n.addMark(p,m,i.create({...y.attrs,...t}))}))}),!0):!1},gQ=(e,t={})=>({state:n,dispatch:r})=>{const s=ln(e,n.schema);return jG(s,t)(n,r)},yQ=(e,t={})=>({state:n,dispatch:r})=>{const s=ln(e,n.schema);return MG(s,t)(n,r)};var wQ=Object.freeze({__proto__:null,blur:ZG,clearContent:eJ,clearNodes:tJ,command:nJ,createParagraphNear:rJ,cut:sJ,deleteCurrentNode:oJ,deleteNode:iJ,deleteRange:lJ,deleteSelection:aJ,enter:cJ,exitCode:uJ,extendMarkRange:dJ,first:fJ,focus:pJ,forEach:mJ,insertContent:gJ,insertContentAt:kJ,joinBackward:vJ,joinDown:bJ,joinForward:SJ,joinItemBackward:CJ,joinItemForward:EJ,joinTextblockBackward:NJ,joinTextblockForward:TJ,joinUp:xJ,keyboardShortcut:jJ,lift:MJ,liftEmptyBlock:RJ,liftListItem:OJ,newlineInCode:IJ,resetAttributes:DJ,scrollIntoView:LJ,selectAll:PJ,selectNodeBackward:$J,selectNodeForward:zJ,selectParentNode:_J,selectTextblockEnd:FJ,selectTextblockStart:BJ,setContent:HJ,setMark:eQ,setMeta:tQ,setNode:nQ,setNodeSelection:rQ,setTextSelection:sQ,sinkListItem:oQ,splitBlock:iQ,splitListItem:lQ,toggleList:aQ,toggleMark:cQ,toggleNode:uQ,toggleWrap:dQ,undoInputRule:fQ,unsetAllMarks:hQ,unsetMark:pQ,updateAttributes:mQ,wrapIn:gQ,wrapInList:yQ});const kQ=an.create({name:"commands",addCommands(){return{...wQ}}}),xQ=an.create({name:"drop",addProseMirrorPlugins(){return[new Gt({key:new Sn("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),bQ=an.create({name:"editable",addProseMirrorPlugins(){return[new Gt({key:new Sn("editable"),props:{editable:()=>this.editor.options.editable}})]}}),vQ=new Sn("focusEvents"),SQ=an.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new Gt({key:vQ,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;const r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;const r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),CQ=an.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first(({commands:i})=>[()=>i.undoInputRule(),()=>i.command(({tr:l})=>{const{selection:a,doc:c}=l,{empty:u,$anchor:f}=a,{pos:h,parent:p}=f,m=f.parent.isTextblock&&h>0?l.doc.resolve(h-1):f,y=m.parent.type.spec.isolating,x=f.pos-f.parentOffset,k=y&&m.parent.childCount===1?x===f.pos:Ue.atStart(c).from===h;return!u||!p.type.isTextblock||p.textContent.length||!k||k&&f.parent.type.name==="paragraph"?!1:i.clearNodes()}),()=>i.deleteSelection(),()=>i.joinBackward(),()=>i.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:i})=>[()=>i.deleteSelection(),()=>i.deleteCurrentNode(),()=>i.joinForward(),()=>i.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:i})=>[()=>i.newlineInCode(),()=>i.createParagraphNear(),()=>i.liftEmptyBlock(),()=>i.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},s={...r},o={...r,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return cp()||AL()?o:s},addProseMirrorPlugins(){return[new Gt({key:new Sn("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(y=>y.getMeta("composition")))return;const r=e.some(y=>y.docChanged)&&!t.doc.eq(n.doc),s=e.some(y=>y.getMeta("preventClearDocument"));if(!r||s)return;const{empty:o,from:i,to:l}=t.selection,a=Ue.atStart(t.doc).from,c=Ue.atEnd(t.doc).to;if(o||!(i===a&&l===c)||!zm(n.doc))return;const h=n.tr,p=Im({state:n,transaction:h}),{commands:m}=new Dm({editor:this.editor,state:p});if(m.clearNodes(),!!h.steps.length)return h}})]}}),EQ=an.create({name:"paste",addProseMirrorPlugins(){return[new Gt({key:new Sn("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),NQ=an.create({name:"tabindex",addProseMirrorPlugins(){return[new Gt({key:new Sn("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class Wi{get name(){return this.node.type.name}constructor(t,n,r=!1,s=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=t,this.editor=n,this.currentNode=s}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var t;return(t=this.actualDepth)!==null&&t!==void 0?t:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(t){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},t)}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 t=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(t);return new Wi(n,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new Wi(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new Wi(t,this.editor)}get children(){const t=[];return this.node.content.forEach((n,r)=>{const s=n.isBlock&&!n.isTextblock,o=n.isAtom&&!n.isText,i=this.pos+r+(o?0:1);if(i<0||i>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(i);if(!s&&l.depth<=this.depth)return;const a=new Wi(l,this.editor,s,s?n:null);s&&(a.actualDepth=this.depth+1),t.push(new Wi(l,this.editor,s,s?n:null))}),t}get firstChild(){return this.children[0]||null}get lastChild(){const t=this.children;return t[t.length-1]||null}closest(t,n={}){let r=null,s=this.parent;for(;s&&!r;){if(s.node.type.name===t)if(Object.keys(n).length>0){const o=s.node.attrs,i=Object.keys(n);for(let l=0;l<i.length;l+=1){const a=i[l];if(o[a]!==n[a])break}}else r=s;s=s.parent}return r}querySelector(t,n={}){return this.querySelectorAll(t,n,!0)[0]||null}querySelectorAll(t,n={},r=!1){let s=[];if(!this.children||this.children.length===0)return s;const o=Object.keys(n);return this.children.forEach(i=>{r&&s.length>0||(i.node.type.name===t&&o.every(a=>n[a]===i.node.attrs[a])&&s.push(i),!(r&&s.length>0)&&(s=s.concat(i.querySelectorAll(t,n,r))))}),s}setAttribute(t){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...t}),this.editor.view.dispatch(n)}}const TQ=`.ProseMirror {
213
+ position: relative;
214
+ }
215
+
216
+ .ProseMirror {
217
+ word-wrap: break-word;
218
+ white-space: pre-wrap;
219
+ white-space: break-spaces;
220
+ -webkit-font-variant-ligatures: none;
221
+ font-variant-ligatures: none;
222
+ font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
223
+ }
224
+
225
+ .ProseMirror [contenteditable="false"] {
226
+ white-space: normal;
227
+ }
228
+
229
+ .ProseMirror [contenteditable="false"] [contenteditable="true"] {
230
+ white-space: pre-wrap;
231
+ }
232
+
233
+ .ProseMirror pre {
234
+ white-space: pre-wrap;
235
+ }
236
+
237
+ img.ProseMirror-separator {
238
+ display: inline !important;
239
+ border: none !important;
240
+ margin: 0 !important;
241
+ width: 0 !important;
242
+ height: 0 !important;
243
+ }
244
+
245
+ .ProseMirror-gapcursor {
246
+ display: none;
247
+ pointer-events: none;
248
+ position: absolute;
249
+ margin: 0;
250
+ }
251
+
252
+ .ProseMirror-gapcursor:after {
253
+ content: "";
254
+ display: block;
255
+ position: absolute;
256
+ top: -2px;
257
+ width: 20px;
258
+ border-top: 1px solid black;
259
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
260
+ }
261
+
262
+ @keyframes ProseMirror-cursor-blink {
263
+ to {
264
+ visibility: hidden;
265
+ }
266
+ }
267
+
268
+ .ProseMirror-hideselection *::selection {
269
+ background: transparent;
270
+ }
271
+
272
+ .ProseMirror-hideselection *::-moz-selection {
273
+ background: transparent;
274
+ }
275
+
276
+ .ProseMirror-hideselection * {
277
+ caret-color: transparent;
278
+ }
279
+
280
+ .ProseMirror-focused .ProseMirror-gapcursor {
281
+ display: block;
282
+ }
283
+
284
+ .tippy-box[data-animation=fade][data-state=hidden] {
285
+ opacity: 0
286
+ }`;function AQ(e,t,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const s=document.createElement("style");return t&&s.setAttribute("nonce",t),s.setAttribute("data-tiptap-style",""),s.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(s),s}let jQ=class extends $G{constructor(t={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),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,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:n})=>{throw n},onPaste:()=>null,onDrop:()=>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("contentError",this.options.onContentError),this.createView(),this.injectCSS(),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:n,slice:r,moved:s})=>this.options.onDrop(n,r,s)),this.on("paste",({event:n,slice:r})=>this.options.onPaste(n,r)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}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&&document&&(this.css=AQ(TQ,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,n=!0){this.setOptions({editable:t}),n&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(t,n){const r=bL(n)?n(t,[...this.state.plugins]):[...this.state.plugins,t],s=this.state.reconfigure({plugins:r});return this.view.updateState(s),s}unregisterPlugin(t){if(this.isDestroyed)return;const n=this.state.plugins;let r=n;if([].concat(t).forEach(o=>{const i=typeof o=="string"?`${o}$`:o.key;r=r.filter(l=>!l.key.startsWith(i))}),n.length===r.length)return;const s=this.state.reconfigure({plugins:r});return this.view.updateState(s),s}createExtensionManager(){var t,n;const s=[...this.options.enableCoreExtensions?[bQ,XG.configure({blockSeparator:(n=(t=this.options.coreExtensionOptions)===null||t===void 0?void 0:t.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),kQ,SQ,CQ,NQ,xQ,EQ].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o==null?void 0:o.type));this.extensionManager=new xa(s,this)}createCommandManager(){this.commandManager=new Dm({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var t;let n;try{n=fx(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(i){if(!(i instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(i.message))throw i;this.emit("contentError",{editor:this,error:i,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(l=>l.name!=="collaboration"),this.createExtensionManager()}}),n=fx(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const r=NL(n,this.options.autofocus);this.view=new lL(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...(t=this.options.editorProps)===null||t===void 0?void 0:t.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:ka.create({doc:n,selection:r||void 0})});const s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.createNodeViews(),this.prependClass();const o=this.view.dom;o.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const n=this.capturedTransaction;return this.capturedTransaction=null,n}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(i=>{var l;return(l=this.capturedTransaction)===null||l===void 0?void 0:l.step(i)});return}const n=this.state.apply(t),r=!this.state.selection.eq(n.selection);this.emit("beforeTransaction",{editor:this,transaction:t,nextState:n}),this.view.updateState(n),this.emit("transaction",{editor:this,transaction:t}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const s=t.getMeta("focus"),o=t.getMeta("blur");s&&this.emit("focus",{editor:this,event:s.event,transaction:t}),o&&this.emit("blur",{editor:this,event:o.event,transaction:t}),!(!t.docChanged||t.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:t})}getAttributes(t){return RL(this.state,t)}isActive(t,n){const r=typeof t=="string"?t:null,s=typeof t=="string"?n:t;return QJ(this.state,r,s)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Ub(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:n=`
287
+
288
+ `,textSerializers:r={}}=t||{};return KJ(this.state.doc,{blockSeparator:n,textSerializers:{...SL(this.schema),...r}})}get isEmpty(){return zm(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){const t=this.view.dom;t&&t.editor&&delete t.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var t;return!(!((t=this.view)===null||t===void 0)&&t.docView)}$node(t,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelector(t,n))||null}$nodes(t,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelectorAll(t,n))||null}$pos(t){const n=this.state.doc.resolve(t);return new Wi(n,this)}get $doc(){return this.$pos(0)}};function Ga(e){return new gd({find:e.find,handler:({state:t,range:n,match:r})=>{const s=qe(e.getAttributes,void 0,r);if(s===!1||s===null)return null;const{tr:o}=t,i=r[r.length-1],l=r[0];if(i){const a=l.search(/\S/),c=n.from+l.indexOf(i),u=c+i.length;if(Yb(n.from,n.to,t.doc).filter(p=>p.mark.type.excluded.find(y=>y===e.type&&y!==p.mark.type)).filter(p=>p.to>c).length)return null;u<n.to&&o.delete(u,n.to),c>n.from&&o.delete(n.from+a,c);const h=n.from+a+i.length;o.addMark(n.from+a,h,e.type.create(s||{})),o.removeStoredMark(e.type)}}})}function MQ(e){return new gd({find:e.find,handler:({state:t,range:n,match:r})=>{const s=qe(e.getAttributes,void 0,r)||{},{tr:o}=t,i=n.from;let l=n.to;const a=e.type.create(s);if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=i+c;u>l?u=l:l=u+r[1].length;const f=r[0][r[0].length-1];o.insertText(f,i+r[0].length-1),o.replaceWith(u,l,a)}else if(r[0]){const c=e.type.isInline?i:i-1;o.insert(c,e.type.create(s)).delete(o.mapping.map(i),o.mapping.map(l))}o.scrollIntoView()}})}function px(e){return new gd({find:e.find,handler:({state:t,range:n,match:r})=>{const s=t.doc.resolve(n.from),o=qe(e.getAttributes,void 0,r)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,o)}})}function hT(e){return new gd({find:e.find,handler:({state:t,range:n,match:r})=>{let s=e.replace,o=n.from;const i=n.to;if(r[1]){const l=r[0].lastIndexOf(r[1]);s+=r[0].slice(l+r[1].length),o+=l;const a=o-i;a>0&&(s=r[0].slice(l-a,l)+s,o=i)}t.tr.insertText(s,o,i)}})}function Ja(e){return new gd({find:e.find,handler:({state:t,range:n,match:r,chain:s})=>{const o=qe(e.getAttributes,void 0,r)||{},i=t.tr.delete(n.from,n.to),a=i.doc.resolve(n.from).blockRange(),c=a&&Nb(a,e.type,o);if(!c)return null;if(i.wrap(a,c),e.keepMarks&&e.editor){const{selection:f,storedMarks:h}=t,{splittableMarks:p}=e.editor.extensionManager,m=h||f.$to.parentOffset&&f.$from.marks();if(m){const y=m.filter(x=>p.includes(x.type.name));i.ensureMarks(y)}}if(e.keepAttributes){const f=e.type.name==="bulletList"||e.type.name==="orderedList"?"listItem":"taskList";s().updateAttributes(f,o).run()}const u=i.doc.resolve(n.from-1).nodeBefore;u&&u.type===e.type&&Si(i.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,u))&&i.join(n.from-1)}})}let cn=class mx{constructor(t={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=qe(je(this,"addOptions",{name:this.name}))),this.storage=qe(je(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new mx(t)}configure(t={}){const n=this.extend({...this.config,addOptions:()=>Pm(this.options,t)});return n.name=this.name,n.parent=this.parent,n}extend(t={}){const n=new mx(t);return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=qe(je(n,"addOptions",{name:n.name})),n.storage=qe(je(n,"addStorage",{name:n.name,options:n.options})),n}};function Cl(e){return new KG({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:s})=>{const o=qe(e.getAttributes,void 0,r,s);if(o===!1||o===null)return null;const{tr:i}=t,l=r[r.length-1],a=r[0];let c=n.to;if(l){const u=a.search(/\S/),f=n.from+a.indexOf(l),h=f+l.length;if(Yb(n.from,n.to,t.doc).filter(m=>m.mark.type.excluded.find(x=>x===e.type&&x!==m.mark.type)).filter(m=>m.to>f).length)return null;h<n.to&&i.delete(h,n.to),f>n.from&&i.delete(n.from+u,f),c=n.from+u+l.length,i.addMark(n.from+u,c,e.type.create(o||{})),i.removeStoredMark(e.type)}}})}function RQ(e,t){const{selection:n}=e,{$from:r}=n;if(n instanceof $e){const o=r.index();return r.parent.canReplaceWith(o,o+1,t)}let s=r.depth;for(;s>=0;){const o=r.index(s);if(r.node(s).contentMatchAt(o).matchType(t))return!0;s-=1}return!1}function OQ(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var OL={exports:{}},Uy={};/**
289
+ * @license React
290
+ * use-sync-external-store-shim.production.min.js
291
+ *
292
+ * Copyright (c) Facebook, Inc. and its affiliates.
293
+ *
294
+ * This source code is licensed under the MIT license found in the
295
+ * LICENSE file in the root directory of this source tree.
296
+ */var pT;function IQ(){if(pT)return Uy;pT=1;var e=Dn;function t(f,h){return f===h&&(f!==0||1/f===1/h)||f!==f&&h!==h}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,s=e.useEffect,o=e.useLayoutEffect,i=e.useDebugValue;function l(f,h){var p=h(),m=r({inst:{value:p,getSnapshot:h}}),y=m[0].inst,x=m[1];return o(function(){y.value=p,y.getSnapshot=h,a(y)&&x({inst:y})},[f,p,h]),s(function(){return a(y)&&x({inst:y}),f(function(){a(y)&&x({inst:y})})},[f]),i(p),p}function a(f){var h=f.getSnapshot;f=f.value;try{var p=h();return!n(f,p)}catch{return!0}}function c(f,h){return h()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:l;return Uy.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,Uy}OL.exports=IQ();var Gb=OL.exports;const DQ=(...e)=>t=>{e.forEach(n=>{typeof n=="function"?n(t):n&&(n.current=t)})},LQ=({contentComponent:e})=>{const t=Gb.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return Dn.createElement(Dn.Fragment,null,Object.values(t))};function PQ(){const e=new Set;let t={};return{subscribe(n){return e.add(n),()=>{e.delete(n)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,r){t={...t,[n]:d_.createPortal(r.reactElement,r.element,n)},e.forEach(s=>s())},removeRenderer(n){const r={...t};delete r[n],t=r,e.forEach(s=>s())}}}class $Q extends Dn.Component{constructor(t){var n;super(t),this.editorContentRef=Dn.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!(!((n=t.editor)===null||n===void 0)&&n.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 n=this.editorContentRef.current;n.append(...t.options.element.childNodes),t.setOptions({element:n}),t.contentComponent=PQ(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=t.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),t.createNodeViews(),this.initialized=!0}}componentWillUnmount(){const t=this.props.editor;if(!t||(this.initialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),t.contentComponent=null,!t.options.element.firstChild))return;const n=document.createElement("div");n.append(...t.options.element.childNodes),t.setOptions({element:n})}render(){const{editor:t,innerRef:n,...r}=this.props;return Dn.createElement(Dn.Fragment,null,Dn.createElement("div",{ref:DQ(n,this.editorContentRef),...r}),(t==null?void 0:t.contentComponent)&&Dn.createElement(LQ,{contentComponent:t.contentComponent}))}}const zQ=w.forwardRef((e,t)=>{const n=Dn.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return Dn.createElement($Q,{key:n,innerRef:t,...e})}),_Q=Dn.memo(zQ);var FQ=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,s,o;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(s=r;s--!==0;)if(!e(t[s],n[s]))return!1;return!0}if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(s of t.entries())if(!n.has(s[0]))return!1;for(s of t.entries())if(!e(s[1],n.get(s[0])))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(s of t.entries())if(!n.has(s[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(n)){if(r=t.length,r!=n.length)return!1;for(s=r;s--!==0;)if(t[s]!==n[s])return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(o=Object.keys(t),r=o.length,r!==Object.keys(n).length)return!1;for(s=r;s--!==0;)if(!Object.prototype.hasOwnProperty.call(n,o[s]))return!1;for(s=r;s--!==0;){var i=o[s];if(!(i==="_owner"&&t.$$typeof)&&!e(t[i],n[i]))return!1}return!0}return t!==t&&n!==n},BQ=OQ(FQ),IL={exports:{}},Vy={};/**
297
+ * @license React
298
+ * use-sync-external-store-shim/with-selector.production.min.js
299
+ *
300
+ * Copyright (c) Facebook, Inc. and its affiliates.
301
+ *
302
+ * This source code is licensed under the MIT license found in the
303
+ * LICENSE file in the root directory of this source tree.
304
+ */var mT;function HQ(){if(mT)return Vy;mT=1;var e=Dn,t=Gb;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=t.useSyncExternalStore,o=e.useRef,i=e.useEffect,l=e.useMemo,a=e.useDebugValue;return Vy.useSyncExternalStoreWithSelector=function(c,u,f,h,p){var m=o(null);if(m.current===null){var y={hasValue:!1,value:null};m.current=y}else y=m.current;m=l(function(){function k(T){if(!v){if(v=!0,b=T,T=h(T),p!==void 0&&y.hasValue){var A=y.value;if(p(A,T))return E=A}return E=T}if(A=E,r(b,T))return A;var R=h(T);return p!==void 0&&p(A,R)?A:(b=T,E=R)}var v=!1,b,E,N=f===void 0?null:f;return[function(){return k(u())},N===null?void 0:function(){return k(N())}]},[u,f,h,p]);var x=s(c,m[0],m[1]);return i(function(){y.hasValue=!0,y.value=x},[x]),a(x),x},Vy}IL.exports=HQ();var WQ=IL.exports;const UQ=typeof window<"u"?w.useLayoutEffect:w.useEffect;class VQ{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 n=()=>{this.transactionNumber+=1,this.subscribers.forEach(s=>s())},r=this.editor;return r.on("transaction",n),()=>{r.off("transaction",n)}}}}function KQ(e){var t;const[n]=w.useState(()=>new VQ(e.editor)),r=WQ.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,e.selector,(t=e.equalityFn)!==null&&t!==void 0?t:BQ);return UQ(()=>n.watch(e.editor),[e.editor,n]),w.useDebugValue(r),r}const qQ=!1,gx=typeof window>"u",YQ=gx||!!(typeof window<"u"&&window.next);class Jb{constructor(t){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=t,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(t){this.editor=t,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?gx||YQ?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const t={...this.options.current,onBeforeCreate:(...r)=>{var s,o;return(o=(s=this.options.current).onBeforeCreate)===null||o===void 0?void 0:o.call(s,...r)},onBlur:(...r)=>{var s,o;return(o=(s=this.options.current).onBlur)===null||o===void 0?void 0:o.call(s,...r)},onCreate:(...r)=>{var s,o;return(o=(s=this.options.current).onCreate)===null||o===void 0?void 0:o.call(s,...r)},onDestroy:(...r)=>{var s,o;return(o=(s=this.options.current).onDestroy)===null||o===void 0?void 0:o.call(s,...r)},onFocus:(...r)=>{var s,o;return(o=(s=this.options.current).onFocus)===null||o===void 0?void 0:o.call(s,...r)},onSelectionUpdate:(...r)=>{var s,o;return(o=(s=this.options.current).onSelectionUpdate)===null||o===void 0?void 0:o.call(s,...r)},onTransaction:(...r)=>{var s,o;return(o=(s=this.options.current).onTransaction)===null||o===void 0?void 0:o.call(s,...r)},onUpdate:(...r)=>{var s,o;return(o=(s=this.options.current).onUpdate)===null||o===void 0?void 0:o.call(s,...r)},onContentError:(...r)=>{var s,o;return(o=(s=this.options.current).onContentError)===null||o===void 0?void 0:o.call(s,...r)},onDrop:(...r)=>{var s,o;return(o=(s=this.options.current).onDrop)===null||o===void 0?void 0:o.call(s,...r)},onPaste:(...r)=>{var s,o;return(o=(s=this.options.current).onPaste)===null||o===void 0?void 0:o.call(s,...r)}};return new jQ(t)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(t){return this.subscriptions.add(t),()=>{this.subscriptions.delete(t)}}static compareOptions(t,n){return Object.keys(t).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&t.extensions&&n.extensions?t.extensions.length!==n.extensions.length?!1:t.extensions.every((s,o)=>{var i;return s===((i=n.extensions)===null||i===void 0?void 0:i[o])}):t[r]===n[r])}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?Jb.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(t){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=t;return}if(this.previousDeps.length===t.length&&this.previousDeps.every((r,s)=>r===t[s]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=t}scheduleDestroy(){const t=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===t){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===t&&this.setEditor(null))},1)}}function GQ(e={},t=[]){const n=w.useRef(e);n.current=e;const[r]=w.useState(()=>new Jb(n)),s=Gb.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return w.useDebugValue(s),w.useEffect(r.onRender(t)),KQ({editor:s,selector:({transactionNumber:o})=>e.shouldRerenderOnTransaction===!1?null:e.immediatelyRender&&o===0?0:o+1}),s}const JQ=w.createContext({editor:null});JQ.Consumer;const QQ=w.createContext({onDragStart:void 0}),XQ=()=>w.useContext(QQ);Dn.forwardRef((e,t)=>{const{onDragStart:n}=XQ(),r=e.as||"div";return Dn.createElement(r,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...e.style}})});const ZQ=/^\s*>\s$/,eX=cn.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:e}){return["blockquote",At(this.options.HTMLAttributes,e),0]},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Ja({find:ZQ,type:this.type})]}}),tX=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,nX=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,rX=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,sX=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,oX=Os.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>e.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return["strong",At(this.options.HTMLAttributes,e),0]},addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Ga({find:tX,type:this.type}),Ga({find:rX,type:this.type})]},addPasteRules(){return[Cl({find:nX,type:this.type}),Cl({find:sX,type:this.type})]}}),iX="listItem",gT="textStyle",yT=/^\s*([-+*])\s$/,lX=cn.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:e}){return["ul",At(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(iX,this.editor.getAttributes(gT)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=Ja({find:yT,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Ja({find:yT,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(gT),editor:this.editor})),[e]}}),aX=/(^|[^`])`([^`]+)`(?!`)/,cX=/(^|[^`])`([^`]+)`(?!`)/g,uX=Os.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:e}){return["code",At(this.options.HTMLAttributes,e),0]},addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Ga({find:aX,type:this.type})]},addPasteRules(){return[Cl({find:cX,type:this.type})]}}),dX=/^```([a-z]+)?[\s\n]$/,fX=/^~~~([a-z]+)?[\s\n]$/,hX=cn.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;const{languageClassPrefix:n}=this.options,o=[...((t=e.firstElementChild)===null||t===void 0?void 0:t.classList)||[]].filter(i=>i.startsWith(n)).map(i=>i.replace(n,""))[0];return o||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:e,HTMLAttributes:t}){return["pre",At(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:t}=e,{selection:n}=t,{$from:r,empty:s}=n;if(!s||r.parent.type!==this.type)return!1;const o=r.parentOffset===r.parent.nodeSize-2,i=r.parent.textContent.endsWith(`
305
+
306
+ `);return!o||!i?!1:e.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;const{state:t}=e,{selection:n,doc:r}=t,{$from:s,empty:o}=n;if(!o||s.parent.type!==this.type||!(s.parentOffset===s.parent.nodeSize-2))return!1;const l=s.after();return l===void 0?!1:r.nodeAt(l)?e.commands.command(({tr:c})=>(c.setSelection(Ue.near(r.resolve(l))),!0)):e.commands.exitCode()}}},addInputRules(){return[px({find:dX,type:this.type,getAttributes:e=>({language:e[1]})}),px({find:fX,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new Gt({key:new Sn("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;const n=t.clipboardData.getData("text/plain"),r=t.clipboardData.getData("vscode-editor-data"),s=r?JSON.parse(r):void 0,o=s==null?void 0:s.mode;if(!n||!o)return!1;const{tr:i,schema:l}=e.state,a=l.text(n.replace(/\r\n?/g,`
307
+ `));return i.replaceSelectionWith(this.type.create({language:o},a)),i.selection.$from.parent.type!==this.type&&i.setSelection(Pe.near(i.doc.resolve(Math.max(0,i.selection.from-2)))),i.setMeta("paste",!0),e.dispatch(i),!0}}})]}}),pX=cn.create({name:"doc",topNode:!0,content:"block+"});function mX(e={}){return new Gt({view(t){return new gX(t,e)}})}class gX{constructor(t,n){var r;this.editorView=t,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,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 o=i=>{this[s](i)};return t.dom.addEventListener(s,o),{name:s,handler:o}})}destroy(){this.handlers.forEach(({name:t,handler:n})=>this.editorView.dom.removeEventListener(t,n))}update(t,n){if(this.cursorPos!=null&&n.doc!=t.state.doc)if(this.lastDragEvent){let r=this.computeTarget(this.lastDragEvent);r==this.cursorPos?this.updateOverlay():this.setCursor(r)}else this.updateOverlay()}setCursor(t){t!=this.cursorPos&&(this.cursorPos=t,t==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let t=this.editorView.state.doc.resolve(this.cursorPos),n=!t.parent.inlineContent,r,s=this.editorView.dom,o=s.getBoundingClientRect(),i=o.width/s.offsetWidth,l=o.height/s.offsetHeight;if(n){let f=t.nodeBefore,h=t.nodeAfter;if(f||h){let p=this.editorView.nodeDOM(this.cursorPos-(f?f.nodeSize:0));if(p){let m=p.getBoundingClientRect(),y=f?m.bottom:m.top;f&&h&&(y=(y+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let x=this.width/2*l;r={left:m.left,right:m.right,top:y-x,bottom:y+x}}}}if(!r){let f=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*i;r={left:f.left-h,right:f.left+h,top:f.top,bottom:f.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.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(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,u=-pageYOffset;else{let f=a.getBoundingClientRect(),h=f.width/a.offsetWidth,p=f.height/a.offsetHeight;c=f.left-a.scrollLeft*h,u=f.top-a.scrollTop*p}this.element.style.left=(r.left-c)/i+"px",this.element.style.top=(r.top-u)/l+"px",this.element.style.width=(r.right-r.left)/i+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(t){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),t)}computeTarget(t){let n=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),s=r&&r.type.spec.disableDropCursor,o=typeof s=="function"?s(this.editorView,n,t):s;if(!n||o)return null;let i=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=yD(this.editorView.state.doc,i,this.editorView.dragging.slice);l!=null&&(i=l)}return i}dragover(t){if(!this.editorView.editable)return;this.lastDragEvent=t;let n=this.computeTarget(t);n!=null&&(this.setCursor(n),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(t){this.editorView.dom.contains(t.relatedTarget)||this.setCursor(null)}}const yX=an.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[mX(this.options)]}});class zt extends Ue{constructor(t){super(t,t)}map(t,n){let r=t.resolve(n.map(this.head));return zt.valid(r)?new zt(r):Ue.near(r)}content(){return xe.empty}eq(t){return t instanceof zt&&t.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new zt(t.resolve(n.pos))}getBookmark(){return new Qb(this.anchor)}static valid(t){let n=t.parent;if(n.inlineContent||!wX(t)||!kX(t))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let s=n.contentMatchAt(t.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(t,n,r=!1){e:for(;;){if(!r&&zt.valid(t))return t;let s=t.pos,o=null;for(let i=t.depth;;i--){let l=t.node(i);if(n>0?t.indexAfter(i)<l.childCount:t.index(i)>0){o=l.child(n>0?t.indexAfter(i):t.index(i)-1);break}else if(i==0)return null;s+=n;let a=t.doc.resolve(s);if(zt.valid(a))return a}for(;;){let i=n>0?o.firstChild:o.lastChild;if(!i){if(o.isAtom&&!o.isText&&!$e.isSelectable(o)){t=t.doc.resolve(s+o.nodeSize*n),r=!1;continue e}break}o=i,s+=n;let l=t.doc.resolve(s);if(zt.valid(l))return l}return null}}}zt.prototype.visible=!1;zt.findFrom=zt.findGapCursorFrom;Ue.jsonID("gapcursor",zt);class Qb{constructor(t){this.pos=t}map(t){return new Qb(t.map(this.pos))}resolve(t){let n=t.resolve(this.pos);return zt.valid(n)?new zt(n):Ue.near(n)}}function DL(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function wX(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);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||DL(s.type))return!0;if(s.inlineContent)return!1}}return!0}function kX(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||DL(s.type))return!0;if(s.inlineContent)return!1}}return!0}function xX(){return new Gt({props:{decorations:CX,createSelectionBetween(e,t,n){return t.pos==n.pos&&zt.valid(n)?new zt(n):null},handleClick:vX,handleKeyDown:bX,handleDOMEvents:{beforeinput:SX}}})}const bX=zb({ArrowLeft:vf("horiz",-1),ArrowRight:vf("horiz",1),ArrowUp:vf("vert",-1),ArrowDown:vf("vert",1)});function vf(e,t){const n=e=="vert"?t>0?"down":"up":t>0?"right":"left";return function(r,s,o){let i=r.selection,l=t>0?i.$to:i.$from,a=i.empty;if(i instanceof Pe){if(!o.endOfTextblock(n)||l.depth==0)return!1;a=!1,l=r.doc.resolve(t>0?l.after():l.before())}let c=zt.findGapCursorFrom(l,t,a);return c?(s&&s(r.tr.setSelection(new zt(c))),!0):!1}}function vX(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!zt.valid(r))return!1;let s=e.posAtCoords({left:n.clientX,top:n.clientY});return s&&s.inside>-1&&$e.isSelectable(e.state.doc.nodeAt(s.inside))?!1:(e.dispatch(e.state.tr.setSelection(new zt(r))),!0)}function SX(e,t){if(t.inputType!="insertCompositionText"||!(e.state.selection instanceof zt))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let s=Z.empty;for(let i=r.length-1;i>=0;i--)s=Z.from(r[i].createAndFill(null,s));let o=e.state.tr.replace(n.pos,n.pos,new xe(s,0,0));return o.setSelection(Pe.near(o.doc.resolve(n.pos+1))),e.dispatch(o),!1}function CX(e){if(!(e.selection instanceof zt))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",Ot.create(e.doc,[zn.widget(e.selection.head,t,{key:"gapcursor"})])}const EX=an.create({name:"gapCursor",addProseMirrorPlugins(){return[xX()]},extendNodeSchema(e){var t;const n={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:(t=qe(je(e,"allowGapCursor",n)))!==null&&t!==void 0?t:null}}}),NX=cn.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:e}){return["br",At(this.options.HTMLAttributes,e)]},renderText(){return`
308
+ `},addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{const{selection:s,storedMarks:o}=n;if(s.$from.parent.type.spec.isolating)return!1;const{keepMarks:i}=this.options,{splittableMarks:l}=r.extensionManager,a=o||s.$to.parentOffset&&s.$from.marks();return t().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&a&&i){const f=a.filter(h=>l.includes(h.type.name));c.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),TX=cn.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(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,At(this.options.HTMLAttributes,t),0]},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,"paragraph",e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>px({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}});var up=200,on=function(){};on.prototype.append=function(t){return t.length?(t=on.from(t),!this.length&&t||t.length<up&&this.leafAppend(t)||this.length<up&&t.leafPrepend(this)||this.appendInner(t)):this};on.prototype.prepend=function(t){return t.length?on.from(t).append(this):this};on.prototype.appendInner=function(t){return new AX(this,t)};on.prototype.slice=function(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.length),t>=n?on.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,n))};on.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};on.prototype.forEach=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(t,n,r,0):this.forEachInvertedInner(t,n,r,0)};on.prototype.map=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(o,i){return s.push(t(o,i))},n,r),s};on.from=function(t){return t instanceof on?t:t&&t.length?new LL(t):on.empty};var LL=function(e){function t(r){e.call(this),this.values=r}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(s,o){return s==0&&o==this.length?this:new t(this.values.slice(s,o))},t.prototype.getInner=function(s){return this.values[s]},t.prototype.forEachInner=function(s,o,i,l){for(var a=o;a<i;a++)if(s(this.values[a],l+a)===!1)return!1},t.prototype.forEachInvertedInner=function(s,o,i,l){for(var a=o-1;a>=i;a--)if(s(this.values[a],l+a)===!1)return!1},t.prototype.leafAppend=function(s){if(this.length+s.length<=up)return new t(this.values.concat(s.flatten()))},t.prototype.leafPrepend=function(s){if(this.length+s.length<=up)return new t(s.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(on);on.empty=new LL([]);var AX=function(e){function t(n,r){e.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},t.prototype.forEachInner=function(r,s,o,i){var l=this.left.length;if(s<l&&this.left.forEachInner(r,s,Math.min(o,l),i)===!1||o>l&&this.right.forEachInner(r,Math.max(s-l,0),Math.min(this.length,o)-l,i+l)===!1)return!1},t.prototype.forEachInvertedInner=function(r,s,o,i){var l=this.left.length;if(s>l&&this.right.forEachInvertedInner(r,s-l,Math.max(o,l)-l,i+l)===!1||o<l&&this.left.forEachInvertedInner(r,Math.min(s,l),o,i)===!1)return!1},t.prototype.sliceInner=function(r,s){if(r==0&&s==this.length)return this;var o=this.left.length;return s<=o?this.left.slice(r,s):r>=o?this.right.slice(r-o,s-o):this.left.slice(r,o).append(this.right.slice(0,s-o))},t.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new t(this.left,s)},t.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new t(s,this.right)},t.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new t(this.left,new t(this.right,r)):new t(this,r)},t}(on);const jX=500;class ns{constructor(t,n){this.items=t,this.eventCount=n}popEvent(t,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,o;n&&(s=this.remapping(r,this.items.length),o=s.maps.length);let i=t.tr,l,a,c=[],u=[];return this.items.forEach((f,h)=>{if(!f.step){s||(s=this.remapping(r,h+1),o=s.maps.length),o--,u.push(f);return}if(s){u.push(new Ss(f.map));let p=f.step.map(s.slice(o)),m;p&&i.maybeStep(p).doc&&(m=i.mapping.maps[i.mapping.maps.length-1],c.push(new Ss(m,void 0,void 0,c.length+u.length))),o--,m&&s.appendMap(m,o)}else i.maybeStep(f.step);if(f.selection)return l=s?f.selection.map(s.slice(o)):f.selection,a=new ns(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:i,selection:l}}addTransform(t,n,r,s){let o=[],i=this.eventCount,l=this.items,a=!s&&l.length?l.get(l.length-1):null;for(let u=0;u<t.steps.length;u++){let f=t.steps[u].invert(t.docs[u]),h=new Ss(t.mapping.maps[u],f,n),p;(p=a&&a.merge(h))&&(h=p,u?o.pop():l=l.slice(0,l.length-1)),o.push(h),n&&(i++,n=void 0),s||(a=h)}let c=i-r.depth;return c>RX&&(l=MX(l,c),i-=c),new ns(l.append(o),i)}remapping(t,n){let r=new Uu;return this.items.forEach((s,o)=>{let i=s.mirrorOffset!=null&&o-s.mirrorOffset>=t?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,i)},t,n),r}addMaps(t){return this.eventCount==0?this:new ns(this.items.append(t.map(n=>new Ss(n))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-n),o=t.mapping,i=t.steps.length,l=this.eventCount;this.items.forEach(h=>{h.selection&&l--},s);let a=n;this.items.forEach(h=>{let p=o.getMirror(--a);if(p==null)return;i=Math.min(i,p);let m=o.maps[p];if(h.step){let y=t.steps[p].invert(t.docs[p]),x=h.selection&&h.selection.map(o.slice(a+1,p));x&&l++,r.push(new Ss(m,y,x))}else r.push(new Ss(m))},s);let c=[];for(let h=n;h<i;h++)c.push(new Ss(o.maps[h]));let u=this.items.slice(0,s).append(c).append(r),f=new ns(u,l);return f.emptyItemCount()>jX&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let t=0;return this.items.forEach(n=>{n.step||t++}),t}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,s=[],o=0;return this.items.forEach((i,l)=>{if(l>=t)s.push(i),i.selection&&o++;else if(i.step){let a=i.step.map(n.slice(r)),c=a&&a.getMap();if(r--,c&&n.appendMap(c,r),a){let u=i.selection&&i.selection.map(n.slice(r));u&&o++;let f=new Ss(c.invert(),a,u),h,p=s.length-1;(h=s.length&&s[p].merge(f))?s[p]=h:s.push(f)}}else i.map&&r--},this.items.length,0),new ns(on.from(s.reverse()),o)}}ns.empty=new ns(on.empty,0);function MX(e,t){let n;return e.forEach((r,s)=>{if(r.selection&&t--==0)return n=s,!1}),e.slice(n)}class Ss{constructor(t,n,r,s){this.map=t,this.step=n,this.selection=r,this.mirrorOffset=s}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new Ss(n.getMap().invert(),n,this.selection)}}}class _o{constructor(t,n,r,s,o){this.done=t,this.undone=n,this.prevRanges=r,this.prevTime=s,this.prevComposition=o}}const RX=20;function OX(e,t,n,r){let s=n.getMeta(dl),o;if(s)return s.historyState;n.getMeta(LX)&&(e=new _o(e.done,e.undone,null,0,-1));let i=n.getMeta("appendedTransaction");if(n.steps.length==0)return e;if(i&&i.getMeta(dl))return i.getMeta(dl).redo?new _o(e.done.addTransform(n,void 0,r,rh(t)),e.undone,wT(n.mapping.maps),e.prevTime,e.prevComposition):new _o(e.done,e.undone.addTransform(n,void 0,r,rh(t)),null,e.prevTime,e.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(i&&i.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),a=e.prevTime==0||!i&&e.prevComposition!=l&&(e.prevTime<(n.time||0)-r.newGroupDelay||!IX(n,e.prevRanges)),c=i?Ky(e.prevRanges,n.mapping):wT(n.mapping.maps);return new _o(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,rh(t)),ns.empty,c,n.time,l??e.prevComposition)}else return(o=n.getMeta("rebased"))?new _o(e.done.rebased(n,o),e.undone.rebased(n,o),Ky(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new _o(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),Ky(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function IX(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((r,s)=>{for(let o=0;o<t.length;o+=2)r<=t[o+1]&&s>=t[o]&&(n=!0)}),n}function wT(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((r,s,o,i)=>t.push(o,i));return t}function Ky(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let s=t.map(e[r],1),o=t.map(e[r+1],-1);s<=o&&n.push(s,o)}return n}function DX(e,t,n){let r=rh(t),s=dl.get(t).spec.config,o=(n?e.undone:e.done).popEvent(t,r);if(!o)return null;let i=o.selection.resolve(o.transform.doc),l=(n?e.done:e.undone).addTransform(o.transform,t.selection.getBookmark(),s,r),a=new _o(n?l:o.remaining,n?o.remaining:l,null,0,-1);return o.transform.setSelection(i).setMeta(dl,{redo:n,historyState:a})}let qy=!1,kT=null;function rh(e){let t=e.plugins;if(kT!=t){qy=!1,kT=t;for(let n=0;n<t.length;n++)if(t[n].spec.historyPreserveItems){qy=!0;break}}return qy}const dl=new Sn("history"),LX=new Sn("closeHistory");function PX(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new Gt({key:dl,state:{init(){return new _o(ns.empty,ns.empty,null,0,-1)},apply(t,n,r){return OX(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(t,n){let r=n.inputType,s=r=="historyUndo"?$L:r=="historyRedo"?zL:null;return!s||!t.editable?!1:(n.preventDefault(),s(t.state,t.dispatch))}}}})}function PL(e,t){return(n,r)=>{let s=dl.getState(n);if(!s||(e?s.undone:s.done).eventCount==0)return!1;if(r){let o=DX(s,n,e);o&&r(t?o.scrollIntoView():o)}return!0}}const $L=PL(!1,!0),zL=PL(!0,!0),$X=an.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>$L(e,t),redo:()=>({state:e,dispatch:t})=>zL(e,t)}},addProseMirrorPlugins(){return[PX(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()}}}),zX=cn.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:e}){return["hr",At(this.options.HTMLAttributes,e)]},addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!RQ(t,t.schema.nodes[this.name]))return!1;const{selection:n}=t,{$from:r,$to:s}=n,o=e();return r.parentOffset===0?o.insertContentAt({from:Math.max(r.pos-1,0),to:s.pos},{type:this.name}):XJ(n)?o.insertContentAt(s.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({tr:i,dispatch:l})=>{var a;if(l){const{$to:c}=i.selection,u=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?i.setSelection(Pe.create(i.doc,c.pos+1)):c.nodeAfter.isBlock?i.setSelection($e.create(i.doc,c.pos)):i.setSelection(Pe.create(i.doc,c.pos));else{const f=(a=c.parent.type.contentMatch.defaultType)===null||a===void 0?void 0:a.create();f&&(i.insert(u,f),i.setSelection(Pe.create(i.doc,u+1)))}i.scrollIntoView()}return!0}).run()}}},addInputRules(){return[MQ({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),_X=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,FX=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,BX=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,HX=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,WX=Os.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>e.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",At(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Ga({find:_X,type:this.type}),Ga({find:BX,type:this.type})]},addPasteRules(){return[Cl({find:FX,type:this.type}),Cl({find:HX,type:this.type})]}}),UX=cn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:e}){return["li",At(this.options.HTMLAttributes,e),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),VX="listItem",xT="textStyle",bT=/^(\d+)\.\s$/,KX=cn.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:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:null,parseHTML:e=>e.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:e}){const{start:t,...n}=e;return t===1?["ol",At(this.options.HTMLAttributes,n),0]:["ol",At(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(VX,this.editor.getAttributes(xT)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=Ja({find:bT,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Ja({find:bT,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(xT)}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1],editor:this.editor})),[e]}}),qX=cn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:e}){return["p",At(this.options.HTMLAttributes,e),0]},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),YX=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,GX=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,JX=Os.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["s",At(this.options.HTMLAttributes,e),0]},addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Ga({find:YX,type:this.type})]},addPasteRules(){return[Cl({find:GX,type:this.type})]}}),QX=cn.create({name:"text",group:"inline"}),XX=an.create({name:"starterKit",addExtensions(){const e=[];return this.options.bold!==!1&&e.push(oX.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(eX.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(lX.configure(this.options.bulletList)),this.options.code!==!1&&e.push(uX.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(hX.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(pX.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(yX.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(EX.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(NX.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(TX.configure(this.options.heading)),this.options.history!==!1&&e.push($X.configure(this.options.history)),this.options.horizontalRule!==!1&&e.push(zX.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(WX.configure(this.options.italic)),this.options.listItem!==!1&&e.push(UX.configure(this.options.listItem)),this.options.orderedList!==!1&&e.push(KX.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(qX.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(JX.configure(this.options.strike)),this.options.text!==!1&&e.push(QX.configure(this.options.text)),e}}),ZX=an.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Gt({key:new Sn("placeholder"),props:{decorations:({doc:e,selection:t})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=t,s=[];if(!n)return null;const o=this.editor.isEmpty;return e.descendants((i,l)=>{const a=r>=l&&r<=l+i.nodeSize,c=!i.isLeaf&&zm(i);if((a||!this.options.showOnlyCurrent)&&c){const u=[this.options.emptyNodeClass];o&&u.push(this.options.emptyEditorClass);const f=zn.node(l,l+i.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:i,pos:l,hasAnchor:a}):this.options.placeholder});s.push(f)}return this.options.includeChildren}),Ot.create(e,s)}}})]}}),eZ=cn.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:e}){return["ul",At(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),tZ=/^\s*(\[([( |x])?\])\s$/,nZ=cn.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:e=>{const t=e.getAttribute("data-checked");return t===""||t==="true"},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return["li",At(this.options.HTMLAttributes,t,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:e.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{const s=document.createElement("li"),o=document.createElement("label"),i=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div"),c=()=>{var u,f;l.ariaLabel=((f=(u=this.options.a11y)===null||u===void 0?void 0:u.checkboxLabel)===null||f===void 0?void 0:f.call(u,e,l.checked))||`Task item checkbox for ${e.textContent||"empty task item"}`};return c(),o.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",u=>u.preventDefault()),l.addEventListener("change",u=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:f}=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:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,f)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,f])=>{s.setAttribute(u,f)}),s.dataset.checked=e.attrs.checked,l.checked=e.attrs.checked,o.append(l,i),s.append(o,a),Object.entries(t).forEach(([u,f])=>{s.setAttribute(u,f)}),{dom:s,contentDOM:a,update:u=>u.type!==this.type?!1:(s.dataset.checked=u.attrs.checked,l.checked=u.attrs.checked,c(),!0)}}},addInputRules(){return[Ja({find:tZ,type:this.type,getAttributes:e=>({checked:e[e.length-1]==="x"})})]}}),rZ="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",sZ="ελ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",yx="numeric",wx="ascii",kx="alpha",du="asciinumeric",Fc="alphanumeric",xx="domain",_L="emoji",oZ="scheme",iZ="slashscheme",Yy="whitespace";function lZ(e,t){return e in t||(t[e]=[]),t[e]}function Xi(e,t,n){t[yx]&&(t[du]=!0,t[Fc]=!0),t[wx]&&(t[du]=!0,t[kx]=!0),t[du]&&(t[Fc]=!0),t[kx]&&(t[Fc]=!0),t[Fc]&&(t[xx]=!0),t[_L]&&(t[xx]=!0);for(const r in t){const s=lZ(r,n);s.indexOf(e)<0&&s.push(e)}}function aZ(e,t){const n={};for(const r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}function or(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}or.groups={};or.prototype={accepts(){return!!this.t},go(e){const t=this,n=t.j[e];if(n)return n;for(let r=0;r<t.jr.length;r++){const s=t.jr[r][0],o=t.jr[r][1];if(o&&s.test(e))return o}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let s=0;s<e.length;s++)this.tt(e[s],t,n,r)},tr(e,t,n,r){r=r||or.groups;let s;return t&&t.j?s=t:(s=new or(t),n&&r&&Xi(t,n,r)),this.jr.push([e,s]),s},ts(e,t,n,r){let s=this;const o=e.length;if(!o)return s;for(let i=0;i<o-1;i++)s=s.tt(e[i]);return s.tt(e[o-1],t,n,r)},tt(e,t,n,r){r=r||or.groups;const s=this;if(t&&t.j)return s.j[e]=t,t;const o=t;let i,l=s.go(e);if(l?(i=new or,Object.assign(i.j,l.j),i.jr.push.apply(i.jr,l.jr),i.jd=l.jd,i.t=l.t):i=new or,o){if(r)if(i.t&&typeof i.t=="string"){const a=Object.assign(aZ(i.t,r),n);Xi(o,a,r)}else n&&Xi(o,n,r);i.t=o}return s.j[e]=i,i}};const Ge=(e,t,n,r,s)=>e.ta(t,n,r,s),Pt=(e,t,n,r,s)=>e.tr(t,n,r,s),vT=(e,t,n,r,s)=>e.ts(t,n,r,s),fe=(e,t,n,r,s)=>e.tt(t,n,r,s),Ys="WORD",bx="UWORD",FL="ASCIINUMERICAL",BL="ALPHANUMERICAL",Qu="LOCALHOST",vx="TLD",Sx="UTLD",sh="SCHEME",ta="SLASH_SCHEME",Xb="NUM",Cx="WS",Zb="NL",fu="OPENBRACE",hu="CLOSEBRACE",dp="OPENBRACKET",fp="CLOSEBRACKET",hp="OPENPAREN",pp="CLOSEPAREN",mp="OPENANGLEBRACKET",gp="CLOSEANGLEBRACKET",yp="FULLWIDTHLEFTPAREN",wp="FULLWIDTHRIGHTPAREN",kp="LEFTCORNERBRACKET",xp="RIGHTCORNERBRACKET",bp="LEFTWHITECORNERBRACKET",vp="RIGHTWHITECORNERBRACKET",Sp="FULLWIDTHLESSTHAN",Cp="FULLWIDTHGREATERTHAN",Ep="AMPERSAND",Np="APOSTROPHE",Tp="ASTERISK",Fo="AT",Ap="BACKSLASH",jp="BACKTICK",Mp="CARET",Zi="COLON",ev="COMMA",Rp="DOLLAR",Cs="DOT",Op="EQUALS",tv="EXCLAMATION",Rr="HYPHEN",pu="PERCENT",Ip="PIPE",Dp="PLUS",Lp="POUND",mu="QUERY",nv="QUOTE",HL="FULLWIDTHMIDDLEDOT",rv="SEMI",Es="SLASH",gu="TILDE",Pp="UNDERSCORE",WL="EMOJI",$p="SYM";var UL=Object.freeze({__proto__:null,ALPHANUMERICAL:BL,AMPERSAND:Ep,APOSTROPHE:Np,ASCIINUMERICAL:FL,ASTERISK:Tp,AT:Fo,BACKSLASH:Ap,BACKTICK:jp,CARET:Mp,CLOSEANGLEBRACKET:gp,CLOSEBRACE:hu,CLOSEBRACKET:fp,CLOSEPAREN:pp,COLON:Zi,COMMA:ev,DOLLAR:Rp,DOT:Cs,EMOJI:WL,EQUALS:Op,EXCLAMATION:tv,FULLWIDTHGREATERTHAN:Cp,FULLWIDTHLEFTPAREN:yp,FULLWIDTHLESSTHAN:Sp,FULLWIDTHMIDDLEDOT:HL,FULLWIDTHRIGHTPAREN:wp,HYPHEN:Rr,LEFTCORNERBRACKET:kp,LEFTWHITECORNERBRACKET:bp,LOCALHOST:Qu,NL:Zb,NUM:Xb,OPENANGLEBRACKET:mp,OPENBRACE:fu,OPENBRACKET:dp,OPENPAREN:hp,PERCENT:pu,PIPE:Ip,PLUS:Dp,POUND:Lp,QUERY:mu,QUOTE:nv,RIGHTCORNERBRACKET:xp,RIGHTWHITECORNERBRACKET:vp,SCHEME:sh,SEMI:rv,SLASH:Es,SLASH_SCHEME:ta,SYM:$p,TILDE:gu,TLD:vx,UNDERSCORE:Pp,UTLD:Sx,UWORD:bx,WORD:Ys,WS:Cx});const Ws=/[a-z]/,Nc=new RegExp("\\p{L}","u"),Gy=new RegExp("\\p{Emoji}","u"),Us=/\d/,Jy=/\s/,ST="\r",Qy=`
309
+ `,cZ="️",uZ="‍",Xy="";let Sf=null,Cf=null;function dZ(e=[]){const t={};or.groups=t;const n=new or;Sf==null&&(Sf=CT(rZ)),Cf==null&&(Cf=CT(sZ)),fe(n,"'",Np),fe(n,"{",fu),fe(n,"}",hu),fe(n,"[",dp),fe(n,"]",fp),fe(n,"(",hp),fe(n,")",pp),fe(n,"<",mp),fe(n,">",gp),fe(n,"(",yp),fe(n,")",wp),fe(n,"「",kp),fe(n,"」",xp),fe(n,"『",bp),fe(n,"』",vp),fe(n,"<",Sp),fe(n,">",Cp),fe(n,"&",Ep),fe(n,"*",Tp),fe(n,"@",Fo),fe(n,"`",jp),fe(n,"^",Mp),fe(n,":",Zi),fe(n,",",ev),fe(n,"$",Rp),fe(n,".",Cs),fe(n,"=",Op),fe(n,"!",tv),fe(n,"-",Rr),fe(n,"%",pu),fe(n,"|",Ip),fe(n,"+",Dp),fe(n,"#",Lp),fe(n,"?",mu),fe(n,'"',nv),fe(n,"/",Es),fe(n,";",rv),fe(n,"~",gu),fe(n,"_",Pp),fe(n,"\\",Ap),fe(n,"・",HL);const r=Pt(n,Us,Xb,{[yx]:!0});Pt(r,Us,r);const s=Pt(r,Ws,FL,{[du]:!0}),o=Pt(r,Nc,BL,{[Fc]:!0}),i=Pt(n,Ws,Ys,{[wx]:!0});Pt(i,Us,s),Pt(i,Ws,i),Pt(s,Us,s),Pt(s,Ws,s);const l=Pt(n,Nc,bx,{[kx]:!0});Pt(l,Ws),Pt(l,Us,o),Pt(l,Nc,l),Pt(o,Us,o),Pt(o,Ws),Pt(o,Nc,o);const a=fe(n,Qy,Zb,{[Yy]:!0}),c=fe(n,ST,Cx,{[Yy]:!0}),u=Pt(n,Jy,Cx,{[Yy]:!0});fe(n,Xy,u),fe(c,Qy,a),fe(c,Xy,u),Pt(c,Jy,u),fe(u,ST),fe(u,Qy),Pt(u,Jy,u),fe(u,Xy,u);const f=Pt(n,Gy,WL,{[_L]:!0});fe(f,"#"),Pt(f,Gy,f),fe(f,cZ,f);const h=fe(f,uZ);fe(h,"#"),Pt(h,Gy,f);const p=[[Ws,i],[Us,s]],m=[[Ws,null],[Nc,l],[Us,o]];for(let y=0;y<Sf.length;y++)Oo(n,Sf[y],vx,Ys,p);for(let y=0;y<Cf.length;y++)Oo(n,Cf[y],Sx,bx,m);Xi(vx,{tld:!0,ascii:!0},t),Xi(Sx,{utld:!0,alpha:!0},t),Oo(n,"file",sh,Ys,p),Oo(n,"mailto",sh,Ys,p),Oo(n,"http",ta,Ys,p),Oo(n,"https",ta,Ys,p),Oo(n,"ftp",ta,Ys,p),Oo(n,"ftps",ta,Ys,p),Xi(sh,{scheme:!0,ascii:!0},t),Xi(ta,{slashscheme:!0,ascii:!0},t),e=e.sort((y,x)=>y[0]>x[0]?1:-1);for(let y=0;y<e.length;y++){const x=e[y][0],v=e[y][1]?{[oZ]:!0}:{[iZ]:!0};x.indexOf("-")>=0?v[xx]=!0:Ws.test(x)?Us.test(x)?v[du]=!0:v[wx]=!0:v[yx]=!0,vT(n,x,x,v)}return vT(n,"localhost",Qu,{ascii:!0}),n.jd=new or($p),{start:n,tokens:Object.assign({groups:t},UL)}}function VL(e,t){const n=fZ(t.replace(/[A-Z]/g,l=>l.toLowerCase())),r=n.length,s=[];let o=0,i=0;for(;i<r;){let l=e,a=null,c=0,u=null,f=-1,h=-1;for(;i<r&&(a=l.go(n[i]));)l=a,l.accepts()?(f=0,h=0,u=l):f>=0&&(f+=n[i].length,h++),c+=n[i].length,o+=n[i].length,i++;o-=f,i-=h,c-=f,s.push({t:u.t,v:t.slice(o-c,o),s:o-c,e:o})}return s}function fZ(e){const t=[],n=e.length;let r=0;for(;r<n;){let s=e.charCodeAt(r),o,i=s<55296||s>56319||r+1===n||(o=e.charCodeAt(r+1))<56320||o>57343?e[r]:e.slice(r,r+2);t.push(i),r+=i.length}return t}function Oo(e,t,n,r,s){let o;const i=t.length;for(let l=0;l<i-1;l++){const a=t[l];e.j[a]?o=e.j[a]:(o=new or(r),o.jr=s.slice(),e.j[a]=o),e=o}return o=new or(n),o.jr=s.slice(),e.j[t[i-1]]=o,o}function CT(e){const t=[],n=[];let r=0,s="0123456789";for(;r<e.length;){let o=0;for(;s.indexOf(e[r+o])>=0;)o++;if(o>0){t.push(n.join(""));for(let i=parseInt(e.substring(r,r+o),10);i>0;i--)n.pop();r+=o}else n.push(e[r]),r++}return t}const Xu={defaultProtocol:"http",events:null,format:ET,formatHref:ET,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function sv(e,t=null){let n=Object.assign({},Xu);e&&(n=Object.assign(n,e instanceof sv?e.o:e));const r=n.ignoreTags,s=[];for(let o=0;o<r.length;o++)s.push(r[o].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=s}sv.prototype={o:Xu,ignoreTags:[],defaultRender(e){return e},check(e){return this.get("validate",e.toString(),e)},get(e,t,n){const r=t!=null;let s=this.o[e];return s&&(typeof s=="object"?(s=n.t in s?s[n.t]:Xu[e],typeof s=="function"&&r&&(s=s(t,n))):typeof s=="function"&&r&&(s=s(t,n.t,n)),s)},getObj(e,t,n){let r=this.o[e];return typeof r=="function"&&t!=null&&(r=r(t,n.t,n)),r},render(e){const t=e.render(this);return(this.get("render",null,e)||this.defaultRender)(t,e.t,e)}};function ET(e){return e}function KL(e,t){this.t="token",this.v=e,this.tk=t}KL.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){const t=this.toString(),n=e.get("truncate",t,this),r=e.get("format",t,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(e){return e.get("formatHref",this.toHref(e.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=Xu.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get("validate",this.toString(),this)},render(e){const t=this,n=this.toHref(e.get("defaultProtocol")),r=e.get("formatHref",n,this),s=e.get("tagName",n,t),o=this.toFormattedString(e),i={},l=e.get("className",n,t),a=e.get("target",n,t),c=e.get("rel",n,t),u=e.getObj("attributes",n,t),f=e.getObj("events",n,t);return i.href=r,l&&(i.class=l),a&&(i.target=a),c&&(i.rel=c),u&&Object.assign(i,u),{tagName:s,attributes:i,content:o,eventListeners:f}}};function _m(e,t){class n extends KL{constructor(s,o){super(s,o),this.t=e}}for(const r in t)n.prototype[r]=t[r];return n.t=e,n}const hZ=_m("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),NT=_m("text"),pZ=_m("nl"),Ef=_m("url",{isLink:!0,toHref(e=Xu.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){const e=this.tk;return e.length>=2&&e[0].t!==Qu&&e[1].t===Zi}}),Mr=e=>new or(e);function mZ({groups:e}){const t=e.domain.concat([Ep,Tp,Fo,Ap,jp,Mp,Rp,Op,Rr,Xb,pu,Ip,Dp,Lp,Es,$p,gu,Pp]),n=[Np,Zi,ev,Cs,tv,pu,mu,nv,rv,mp,gp,fu,hu,fp,dp,hp,pp,yp,wp,kp,xp,bp,vp,Sp,Cp],r=[Ep,Np,Tp,Ap,jp,Mp,Rp,Op,Rr,fu,hu,pu,Ip,Dp,Lp,mu,Es,$p,gu,Pp],s=Mr(),o=fe(s,gu);Ge(o,r,o),Ge(o,e.domain,o);const i=Mr(),l=Mr(),a=Mr();Ge(s,e.domain,i),Ge(s,e.scheme,l),Ge(s,e.slashscheme,a),Ge(i,r,o),Ge(i,e.domain,i);const c=fe(i,Fo);fe(o,Fo,c),fe(l,Fo,c),fe(a,Fo,c);const u=fe(o,Cs);Ge(u,r,o),Ge(u,e.domain,o);const f=Mr();Ge(c,e.domain,f),Ge(f,e.domain,f);const h=fe(f,Cs);Ge(h,e.domain,f);const p=Mr(hZ);Ge(h,e.tld,p),Ge(h,e.utld,p),fe(c,Qu,p);const m=fe(f,Rr);fe(m,Rr,m),Ge(m,e.domain,f),Ge(p,e.domain,f),fe(p,Cs,h),fe(p,Rr,m);const y=fe(i,Rr),x=fe(i,Cs);fe(y,Rr,y),Ge(y,e.domain,i),Ge(x,r,o),Ge(x,e.domain,i);const k=Mr(Ef);Ge(x,e.tld,k),Ge(x,e.utld,k),Ge(k,e.domain,i),Ge(k,r,o),fe(k,Cs,x),fe(k,Rr,y),fe(k,Fo,c);const v=fe(k,Zi),b=Mr(Ef);Ge(v,e.numeric,b);const E=Mr(Ef),N=Mr();Ge(E,t,E),Ge(E,n,N),Ge(N,t,E),Ge(N,n,N),fe(k,Es,E),fe(b,Es,E);const T=fe(l,Zi),A=fe(a,Zi),R=fe(A,Es),$=fe(R,Es);Ge(l,e.domain,i),fe(l,Cs,x),fe(l,Rr,y),Ge(a,e.domain,i),fe(a,Cs,x),fe(a,Rr,y),Ge(T,e.domain,E),fe(T,Es,E),fe(T,mu,E),Ge($,e.domain,E),Ge($,t,E),fe($,Es,E);const L=[[fu,hu],[dp,fp],[hp,pp],[mp,gp],[yp,wp],[kp,xp],[bp,vp],[Sp,Cp]];for(let _=0;_<L.length;_++){const[j,F]=L[_],ae=fe(E,j);fe(N,j,ae);const G=Mr(Ef);Ge(ae,t,G);const I=Mr();Ge(ae,n,I),fe(ae,F,E),Ge(G,t,G),Ge(G,n,I),Ge(I,t,G),Ge(I,n,I),fe(G,F,E),fe(I,F,E)}return fe(s,Qu,k),fe(s,Zb,pZ),{start:s,tokens:UL}}function gZ(e,t,n){let r=n.length,s=0,o=[],i=[];for(;s<r;){let l=e,a=null,c=null,u=0,f=null,h=-1;for(;s<r&&!(a=l.go(n[s].t));)i.push(n[s++]);for(;s<r&&(c=a||l.go(n[s].t));)a=null,l=c,l.accepts()?(h=0,f=l):h>=0&&h++,s++,u++;if(h<0)s-=u,s<r&&(i.push(n[s]),s++);else{i.length>0&&(o.push(Zy(NT,t,i)),i=[]),s-=h,u-=h;const p=f.t,m=n.slice(s-u,s);o.push(Zy(p,t,m))}}return i.length>0&&o.push(Zy(NT,t,i)),o}function Zy(e,t,n){const r=n[0].s,s=n[n.length-1].e,o=t.slice(r,s);return new e(o,n)}const yZ=typeof console<"u"&&console&&console.warn||(()=>{}),wZ="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Nt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function kZ(){return or.groups={},Nt.scanner=null,Nt.parser=null,Nt.tokenQueue=[],Nt.pluginQueue=[],Nt.customSchemes=[],Nt.initialized=!1,Nt}function TT(e,t=!1){if(Nt.initialized&&yZ(`linkifyjs: already initialized - will not register custom scheme "${e}" ${wZ}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw new Error(`linkifyjs: incorrect scheme format.
310
+ 1. Must only contain digits, lowercase ASCII letters or "-"
311
+ 2. Cannot start or end with "-"
312
+ 3. "-" cannot repeat`);Nt.customSchemes.push([e,t])}function xZ(){Nt.scanner=dZ(Nt.customSchemes);for(let e=0;e<Nt.tokenQueue.length;e++)Nt.tokenQueue[e][1]({scanner:Nt.scanner});Nt.parser=mZ(Nt.scanner.tokens);for(let e=0;e<Nt.pluginQueue.length;e++)Nt.pluginQueue[e][1]({scanner:Nt.scanner,parser:Nt.parser});return Nt.initialized=!0,Nt}function ov(e){return Nt.initialized||xZ(),gZ(Nt.parser.start,e,VL(Nt.scanner.start,e))}ov.scan=VL;function qL(e,t=null,n=null){if(t&&typeof t=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}const r=new sv(n),s=ov(e),o=[];for(let i=0;i<s.length;i++){const l=s[i];l.isLink&&(!t||l.t===t)&&r.check(l)&&o.push(l.toFormattedObject(r))}return o}const iv="[\0-   ᠎ -\u2029  ]",bZ=new RegExp(iv),vZ=new RegExp(`${iv}$`),SZ=new RegExp(iv,"g");function CZ(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?["()","[]"].includes(e[0].value+e[2].value):!1}function EZ(e){return new Gt({key:new Sn("autolink"),appendTransaction:(t,n,r)=>{const s=t.some(c=>c.docChanged)&&!n.doc.eq(r.doc),o=t.some(c=>c.getMeta("preventAutolink"));if(!s||o)return;const{tr:i}=r,l=WJ(n.doc,[...t]);if(JJ(l).forEach(({newRange:c})=>{const u=VJ(r.doc,c,p=>p.isTextblock);let f,h;if(u.length>1)f=u[0],h=r.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(u.length){const p=r.doc.textBetween(c.from,c.to," "," ");if(!vZ.test(p))return;f=u[0],h=r.doc.textBetween(f.pos,c.to,void 0," ")}if(f&&h){const p=h.split(bZ).filter(Boolean);if(p.length<=0)return!1;const m=p[p.length-1],y=f.pos+h.lastIndexOf(m);if(!m)return!1;const x=ov(m).map(k=>k.toObject(e.defaultProtocol));if(!CZ(x))return!1;x.filter(k=>k.isLink).map(k=>({...k,from:y+k.start+1,to:y+k.end+1})).filter(k=>r.schema.marks.code?!r.doc.rangeHasMark(k.from,k.to,r.schema.marks.code):!0).filter(k=>e.validate(k.value)).filter(k=>e.shouldAutoLink(k.value)).forEach(k=>{Yb(k.from,k.to,r.doc).some(v=>v.mark.type===e.type)||i.addMark(k.from,k.to,e.type.create({href:k.href}))})}}),!!i.steps.length)return i}})}function NZ(e){return new Gt({key:new Sn("handleClickLink"),props:{handleClick:(t,n,r)=>{var s,o;if(r.button!==0||!t.editable)return!1;let i=r.target;const l=[];for(;i.nodeName!=="DIV";)l.push(i),i=i.parentNode;if(!l.find(h=>h.nodeName==="A"))return!1;const a=RL(t.state,e.type.name),c=r.target,u=(s=c==null?void 0:c.href)!==null&&s!==void 0?s:a.href,f=(o=c==null?void 0:c.target)!==null&&o!==void 0?o:a.target;return c&&u?(window.open(u,f),!0):!1}}})}function TZ(e){return new Gt({key:new Sn("handlePasteLink"),props:{handlePaste:(t,n,r)=>{const{state:s}=t,{selection:o}=s,{empty:i}=o;if(i)return!1;let l="";r.content.forEach(c=>{l+=c.textContent});const a=qL(l,{defaultProtocol:e.defaultProtocol}).find(c=>c.isLink&&c.value===l);return!l||!a?!1:e.editor.commands.setMark(e.type,{href:a.href})}}})}function Oi(e,t){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(r=>{const s=typeof r=="string"?r:r.scheme;s&&n.push(s)}),!e||e.replace(SZ,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const AZ=Os.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{if(typeof e=="string"){TT(e);return}TT(e.scheme,e.optionalSlashes)})},onDestroy(){kZ()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(e,t)=>!!Oi(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>!!e}},addAttributes(){return{href:{default:null,parseHTML(e){return e.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:e=>{const t=e.getAttribute("href");return!t||!this.options.isAllowedUri(t,{defaultValidate:n=>!!Oi(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:t=>!!Oi(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",At(this.options.HTMLAttributes,e),0]:["a",At(this.options.HTMLAttributes,{...e,href:""}),0]},addCommands(){return{setLink:e=>({chain:t})=>{const{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Oi(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta("preventAutolink",!0).run():!1},toggleLink:e=>({chain:t})=>{const{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Oi(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Cl({find:e=>{const t=[];if(e){const{protocols:n,defaultProtocol:r}=this.options,s=qL(e).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:i=>!!Oi(i,n),protocols:n,defaultProtocol:r}));s.length&&s.forEach(o=>t.push({text:o.value,data:{href:o.href},index:o.start}))}return t},type:this.type,getAttributes:e=>{var t;return{href:(t=e.data)===null||t===void 0?void 0:t.href}}})]},addProseMirrorPlugins(){const e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(EZ({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:s=>!!Oi(s,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&e.push(NZ({type:this.type})),this.options.linkOnPaste&&e.push(TZ({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),e}});let Ex,Nx;if(typeof WeakMap<"u"){let e=new WeakMap;Ex=t=>e.get(t),Nx=(t,n)=>(e.set(t,n),n)}else{const e=[];let n=0;Ex=r=>{for(let s=0;s<e.length;s+=2)if(e[s]==r)return e[s+1]},Nx=(r,s)=>(n==10&&(n=0),e[n++]=r,e[n++]=s)}var _t=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){const n=this.map[t];if(n!=e)continue;const r=t%this.width,s=t/this.width|0;let o=r+1,i=s+1;for(let l=1;o<this.width&&this.map[t+l]==n;l++)o++;for(let l=1;i<this.height&&this.map[t+this.width*l]==n;l++)i++;return{left:r,top:s,right:o,bottom:i}}throw new RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){const{left:r,right:s,top:o,bottom:i}=this.findCell(e);return t=="horiz"?(n<0?r==0:s==this.width)?null:this.map[o*this.width+(n<0?r-1:s)]:(n<0?o==0:i==this.height)?null:this.map[r+this.width*(n<0?o-1:i)]}rectBetween(e,t){const{left:n,right:r,top:s,bottom:o}=this.findCell(e),{left:i,right:l,top:a,bottom:c}=this.findCell(t);return{left:Math.min(n,i),top:Math.min(s,a),right:Math.max(r,l),bottom:Math.max(o,c)}}cellsInRect(e){const t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let s=e.left;s<e.right;s++){const o=r*this.width+s,i=this.map[o];n[i]||(n[i]=!0,!(s==e.left&&s&&this.map[o-1]==i||r==e.top&&r&&this.map[o-this.width]==i)&&t.push(i))}return t}positionAt(e,t,n){for(let r=0,s=0;;r++){const o=s+n.child(r).nodeSize;if(r==e){let i=t+e*this.width;const l=(e+1)*this.width;for(;i<l&&this.map[i]<s;)i++;return i==l?o-1:this.map[i]}s=o}}static get(e){return Ex(e)||Nx(e,jZ(e))}};function jZ(e){if(e.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+e.type.name);const t=MZ(e),n=e.childCount,r=[];let s=0,o=null;const i=[];for(let c=0,u=t*n;c<u;c++)r[c]=0;for(let c=0,u=0;c<n;c++){const f=e.child(c);u++;for(let m=0;;m++){for(;s<r.length&&r[s]!=0;)s++;if(m==f.childCount)break;const y=f.child(m),{colspan:x,rowspan:k,colwidth:v}=y.attrs;for(let b=0;b<k;b++){if(b+c>=n){(o||(o=[])).push({type:"overlong_rowspan",pos:u,n:k-b});break}const E=s+b*t;for(let N=0;N<x;N++){r[E+N]==0?r[E+N]=u:(o||(o=[])).push({type:"collision",row:c,pos:u,n:x-N});const T=v&&v[N];if(T){const A=(E+N)%t*2,R=i[A];R==null||R!=T&&i[A+1]==1?(i[A]=T,i[A+1]=1):R==T&&i[A+1]++}}}s+=x,u+=y.nodeSize}const h=(c+1)*t;let p=0;for(;s<h;)r[s++]==0&&p++;p&&(o||(o=[])).push({type:"missing",row:c,n:p}),u++}(t===0||n===0)&&(o||(o=[])).push({type:"zero_sized"});const l=new _t(t,n,r,o);let a=!1;for(let c=0;!a&&c<i.length;c+=2)i[c]!=null&&i[c+1]<n&&(a=!0);return a&&RZ(l,i,e),l}function MZ(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){const s=e.child(r);let o=0;if(n)for(let i=0;i<r;i++){const l=e.child(i);for(let a=0;a<l.childCount;a++){const c=l.child(a);i+c.attrs.rowspan>r&&(o+=c.attrs.colspan)}}for(let i=0;i<s.childCount;i++){const l=s.child(i);o+=l.attrs.colspan,l.attrs.rowspan>1&&(n=!0)}t==-1?t=o:t!=o&&(t=Math.max(t,o))}return t}function RZ(e,t,n){e.problems||(e.problems=[]);const r={};for(let s=0;s<e.map.length;s++){const o=e.map[s];if(r[o])continue;r[o]=!0;const i=n.nodeAt(o);if(!i)throw new RangeError(`No cell with offset ${o} found`);let l=null;const a=i.attrs;for(let c=0;c<a.colspan;c++){const u=t[(s+c)%e.width*2];u!=null&&(!a.colwidth||a.colwidth[c]!=u)&&((l||(l=OZ(a)))[c]=u)}l&&e.problems.unshift({type:"colwidth mismatch",pos:o,colwidth:l})}}function OZ(e){if(e.colwidth)return e.colwidth.slice();const t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function Bn(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(const n in e.nodes){const r=e.nodes[n],s=r.spec.tableRole;s&&(t[s]=r)}}return t}const Vo=new Sn("selectingCells");function El(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return e.node(0).resolve(e.before(t+1));return null}function IZ(e){for(let t=e.depth;t>0;t--){const n=e.node(t).type.spec.tableRole;if(n==="cell"||n==="header_cell")return e.node(t)}return null}function us(e){const t=e.selection.$head;for(let n=t.depth;n>0;n--)if(t.node(n).type.spec.tableRole=="row")return!0;return!1}function Fm(e){const t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&t.node.type.spec.tableRole=="cell")return t.$anchor;const n=El(t.$head)||DZ(t.$head);if(n)return n;throw new RangeError(`No cell found around position ${t.head}`)}function DZ(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){const r=t.type.spec.tableRole;if(r=="cell"||r=="header_cell")return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){const r=t.type.spec.tableRole;if(r=="cell"||r=="header_cell")return e.doc.resolve(n-t.nodeSize)}}function Tx(e){return e.parent.type.spec.tableRole=="row"&&!!e.nodeAfter}function LZ(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function lv(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function YL(e,t,n){const r=e.node(-1),s=_t.get(r),o=e.start(-1),i=s.nextCell(e.pos-o,t,n);return i==null?null:e.node(0).resolve(o+i)}function Nl(e,t,n=1){const r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(s=>s>0)||(r.colwidth=null)),r}function GL(e,t,n=1){const r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let s=0;s<n;s++)r.colwidth.splice(t,0,0)}return r}function PZ(e,t,n){const r=Bn(t.type.schema).header_cell;for(let s=0;s<e.height;s++)if(t.nodeAt(e.map[n+s*e.width]).type!=r)return!1;return!0}var St=class Gs extends Ue{constructor(t,n=t){const r=t.node(-1),s=_t.get(r),o=t.start(-1),i=s.rectBetween(t.pos-o,n.pos-o),l=t.node(0),a=s.cellsInRect(i).filter(u=>u!=n.pos-o);a.unshift(n.pos-o);const c=a.map(u=>{const f=r.nodeAt(u);if(!f)throw new RangeError(`No cell with offset ${u} found`);const h=o+u+1;return new vD(l.resolve(h),l.resolve(h+f.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=t,this.$headCell=n}map(t,n){const r=t.resolve(n.map(this.$anchorCell.pos)),s=t.resolve(n.map(this.$headCell.pos));if(Tx(r)&&Tx(s)&&lv(r,s)){const o=this.$anchorCell.node(-1)!=r.node(-1);return o&&this.isRowSelection()?Gs.rowSelection(r,s):o&&this.isColSelection()?Gs.colSelection(r,s):new Gs(r,s)}return Pe.between(r,s)}content(){const t=this.$anchorCell.node(-1),n=_t.get(t),r=this.$anchorCell.start(-1),s=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),o={},i=[];for(let a=s.top;a<s.bottom;a++){const c=[];for(let u=a*n.width+s.left,f=s.left;f<s.right;f++,u++){const h=n.map[u];if(o[h])continue;o[h]=!0;const p=n.findCell(h);let m=t.nodeAt(h);if(!m)throw new RangeError(`No cell with offset ${h} found`);const y=s.left-p.left,x=p.right-s.right;if(y>0||x>0){let k=m.attrs;if(y>0&&(k=Nl(k,0,y)),x>0&&(k=Nl(k,k.colspan-x,x)),p.left<s.left){if(m=m.type.createAndFill(k),!m)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(k)}`)}else m=m.type.create(k,m.content)}if(p.top<s.top||p.bottom>s.bottom){const k={...m.attrs,rowspan:Math.min(p.bottom,s.bottom)-Math.max(p.top,s.top)};p.top<s.top?m=m.type.createAndFill(k):m=m.type.create(k,m.content)}c.push(m)}i.push(t.child(a).copy(Z.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?t:i;return new xe(Z.from(l),1,1)}replace(t,n=xe.empty){const r=t.steps.length,s=this.ranges;for(let i=0;i<s.length;i++){const{$from:l,$to:a}=s[i],c=t.mapping.slice(r);t.replace(c.map(l.pos),c.map(a.pos),i?xe.empty:n)}const o=Ue.findFrom(t.doc.resolve(t.mapping.slice(r).map(this.to)),-1);o&&t.setSelection(o)}replaceWith(t,n){this.replace(t,new xe(Z.from(n),0,0))}forEachCell(t){const n=this.$anchorCell.node(-1),r=_t.get(n),s=this.$anchorCell.start(-1),o=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-s,this.$headCell.pos-s));for(let i=0;i<o.length;i++)t(n.nodeAt(o[i]),s+o[i])}isColSelection(){const t=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(t,n)>0)return!1;const r=t+this.$anchorCell.nodeAfter.attrs.rowspan,s=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,s)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){const r=t.node(-1),s=_t.get(r),o=t.start(-1),i=s.findCell(t.pos-o),l=s.findCell(n.pos-o),a=t.node(0);return i.top<=l.top?(i.top>0&&(t=a.resolve(o+s.map[i.left])),l.bottom<s.height&&(n=a.resolve(o+s.map[s.width*(s.height-1)+l.right-1]))):(l.top>0&&(n=a.resolve(o+s.map[l.left])),i.bottom<s.height&&(t=a.resolve(o+s.map[s.width*(s.height-1)+i.right-1]))),new Gs(t,n)}isRowSelection(){const t=this.$anchorCell.node(-1),n=_t.get(t),r=this.$anchorCell.start(-1),s=n.colCount(this.$anchorCell.pos-r),o=n.colCount(this.$headCell.pos-r);if(Math.min(s,o)>0)return!1;const i=s+this.$anchorCell.nodeAfter.attrs.colspan,l=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(i,l)==n.width}eq(t){return t instanceof Gs&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){const r=t.node(-1),s=_t.get(r),o=t.start(-1),i=s.findCell(t.pos-o),l=s.findCell(n.pos-o),a=t.node(0);return i.left<=l.left?(i.left>0&&(t=a.resolve(o+s.map[i.top*s.width])),l.right<s.width&&(n=a.resolve(o+s.map[s.width*(l.top+1)-1]))):(l.left>0&&(n=a.resolve(o+s.map[l.top*s.width])),i.right<s.width&&(t=a.resolve(o+s.map[s.width*(i.top+1)-1]))),new Gs(t,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new Gs(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new Gs(t.resolve(n),t.resolve(r))}getBookmark(){return new $Z(this.$anchorCell.pos,this.$headCell.pos)}};St.prototype.visible=!1;Ue.jsonID("cell",St);var $Z=class JL{constructor(t,n){this.anchor=t,this.head=n}map(t){return new JL(t.map(this.anchor),t.map(this.head))}resolve(t){const n=t.resolve(this.anchor),r=t.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&&lv(n,r)?new St(n,r):Ue.near(r,1)}};function zZ(e){if(!(e.selection instanceof St))return null;const t=[];return e.selection.forEachCell((n,r)=>{t.push(zn.node(r,r+n.nodeSize,{class:"selectedCell"}))}),Ot.create(e.doc,t)}function _Z({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,s=e.depth;for(;s>=0&&!(e.after(s+1)<e.end(s));s--,n++);for(let o=t.depth;o>=0&&!(t.before(o+1)>t.start(o));o--,r--);return n==r&&/row|table/.test(e.node(s).type.spec.tableRole)}function FZ({$from:e,$to:t}){let n,r;for(let s=e.depth;s>0;s--){const o=e.node(s);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){n=o;break}}for(let s=t.depth;s>0;s--){const o=t.node(s);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){r=o;break}}return n!==r&&t.parentOffset===0}function BZ(e,t,n){const r=(t||e).selection,s=(t||e).doc;let o,i;if(r instanceof $e&&(i=r.node.type.spec.tableRole)){if(i=="cell"||i=="header_cell")o=St.create(s,r.from);else if(i=="row"){const l=s.resolve(r.from+1);o=St.rowSelection(l,l)}else if(!n){const l=_t.get(r.node),a=r.from+1,c=a+l.map[l.width*l.height-1];o=St.create(s,a+1,c)}}else r instanceof Pe&&_Z(r)?o=Pe.create(s,r.from):r instanceof Pe&&FZ(r)&&(o=Pe.create(s,r.$from.start(),r.$from.end()));return o&&(t||(t=e.tr)).setSelection(o),t}const HZ=new Sn("fix-tables");function QL(e,t,n,r){const s=e.childCount,o=t.childCount;e:for(let i=0,l=0;i<o;i++){const a=t.child(i);for(let c=l,u=Math.min(s,i+3);c<u;c++)if(e.child(c)==a){l=c+1,n+=a.nodeSize;continue e}r(a,n),l<s&&e.child(l).sameMarkup(a)?QL(e.child(l),a,n+1,r):a.nodesBetween(0,a.content.size,r,n+1),n+=a.nodeSize}}function XL(e,t){let n;const r=(s,o)=>{s.type.spec.tableRole=="table"&&(n=WZ(e,s,o,n))};return t?t.doc!=e.doc&&QL(t.doc,e.doc,0,r):e.doc.descendants(r),n}function WZ(e,t,n,r){const s=_t.get(t);if(!s.problems)return r;r||(r=e.tr);const o=[];for(let a=0;a<s.height;a++)o.push(0);for(let a=0;a<s.problems.length;a++){const c=s.problems[a];if(c.type=="collision"){const u=t.nodeAt(c.pos);if(!u)continue;const f=u.attrs;for(let h=0;h<f.rowspan;h++)o[c.row+h]+=c.n;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,Nl(f,f.colspan-c.n,c.n))}else if(c.type=="missing")o[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const u=t.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=t.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+t.nodeSize)}}let i,l;for(let a=0;a<o.length;a++)o[a]&&(i==null&&(i=a),l=a);for(let a=0,c=n+1;a<s.height;a++){const u=t.child(a),f=c+u.nodeSize,h=o[a];if(h>0){let p="cell";u.firstChild&&(p=u.firstChild.type.spec.tableRole);const m=[];for(let x=0;x<h;x++){const k=Bn(e.schema)[p].createAndFill();k&&m.push(k)}const y=(a==0||i==a-1)&&l==a?c+1:f-1;r.insert(r.mapping.map(y),m)}c=f}return r.setMeta(HZ,{fixTables:!0})}function Ds(e){const t=e.selection,n=Fm(e),r=n.node(-1),s=n.start(-1),o=_t.get(r);return{...t instanceof St?o.rectBetween(t.$anchorCell.pos-s,t.$headCell.pos-s):o.findCell(n.pos-s),tableStart:s,map:o,table:r}}function ZL(e,{map:t,tableStart:n,table:r},s){let o=s>0?-1:0;PZ(t,r,s+o)&&(o=s==0||s==t.width?null:0);for(let i=0;i<t.height;i++){const l=i*t.width+s;if(s>0&&s<t.width&&t.map[l-1]==t.map[l]){const a=t.map[l],c=r.nodeAt(a);e.setNodeMarkup(e.mapping.map(n+a),null,GL(c.attrs,s-t.colCount(a))),i+=c.attrs.rowspan-1}else{const a=o==null?Bn(r.type.schema).cell:r.nodeAt(t.map[l+o]).type,c=t.positionAt(i,s,r);e.insert(e.mapping.map(n+c),a.createAndFill())}}return e}function UZ(e,t){if(!us(e))return!1;if(t){const n=Ds(e);t(ZL(e.tr,n,n.left))}return!0}function VZ(e,t){if(!us(e))return!1;if(t){const n=Ds(e);t(ZL(e.tr,n,n.right))}return!0}function KZ(e,{map:t,table:n,tableStart:r},s){const o=e.mapping.maps.length;for(let i=0;i<t.height;){const l=i*t.width+s,a=t.map[l],c=n.nodeAt(a),u=c.attrs;if(s>0&&t.map[l-1]==a||s<t.width-1&&t.map[l+1]==a)e.setNodeMarkup(e.mapping.slice(o).map(r+a),null,Nl(u,s-t.colCount(a)));else{const f=e.mapping.slice(o).map(r+a);e.delete(f,f+c.nodeSize)}i+=u.rowspan}}function qZ(e,t){if(!us(e))return!1;if(t){const n=Ds(e),r=e.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let s=n.right-1;KZ(r,n,s),s!=n.left;s--){const o=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!o)throw new RangeError("No table found");n.table=o,n.map=_t.get(o)}t(r)}return!0}function YZ(e,t,n){var r;const s=Bn(t.type.schema).header_cell;for(let o=0;o<e.width;o++)if(((r=t.nodeAt(e.map[o+n*e.width]))===null||r===void 0?void 0:r.type)!=s)return!1;return!0}function eP(e,{map:t,tableStart:n,table:r},s){let o=n;for(let c=0;c<s;c++)o+=r.child(c).nodeSize;const i=[];let l=s>0?-1:0;YZ(t,r,s+l)&&(l=s==0||s==t.height?null:0);for(let c=0,u=t.width*s;c<t.width;c++,u++)if(s>0&&s<t.height&&t.map[u]==t.map[u-t.width]){const f=t.map[u],h=r.nodeAt(f).attrs;e.setNodeMarkup(n+f,null,{...h,rowspan:h.rowspan+1}),c+=h.colspan-1}else{var a;const f=l==null?Bn(r.type.schema).cell:(a=r.nodeAt(t.map[u+l*t.width]))===null||a===void 0?void 0:a.type,h=f==null?void 0:f.createAndFill();h&&i.push(h)}return e.insert(o,Bn(r.type.schema).row.create(null,i)),e}function GZ(e,t){if(!us(e))return!1;if(t){const n=Ds(e);t(eP(e.tr,n,n.top))}return!0}function JZ(e,t){if(!us(e))return!1;if(t){const n=Ds(e);t(eP(e.tr,n,n.bottom))}return!0}function QZ(e,{map:t,table:n,tableStart:r},s){let o=0;for(let c=0;c<s;c++)o+=n.child(c).nodeSize;const i=o+n.child(s).nodeSize,l=e.mapping.maps.length;e.delete(o+r,i+r);const a=new Set;for(let c=0,u=s*t.width;c<t.width;c++,u++){const f=t.map[u];if(!a.has(f)){if(a.add(f),s>0&&f==t.map[u-t.width]){const h=n.nodeAt(f).attrs;e.setNodeMarkup(e.mapping.slice(l).map(f+r),null,{...h,rowspan:h.rowspan-1}),c+=h.colspan-1}else if(s<t.height&&f==t.map[u+t.width]){const h=n.nodeAt(f),p=h.attrs,m=h.type.create({...p,rowspan:h.attrs.rowspan-1},h.content),y=t.positionAt(s+1,c,n);e.insert(e.mapping.slice(l).map(r+y),m),c+=p.colspan-1}}}}function XZ(e,t){if(!us(e))return!1;if(t){const n=Ds(e),r=e.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let s=n.bottom-1;QZ(r,n,s),s!=n.top;s--){const o=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!o)throw new RangeError("No table found");n.table=o,n.map=_t.get(n.table)}t(r)}return!0}function AT(e){const t=e.content;return t.childCount==1&&t.child(0).isTextblock&&t.child(0).childCount==0}function ZZ({width:e,height:t,map:n},r){let s=r.top*e+r.left,o=s,i=(r.bottom-1)*e+r.left,l=s+(r.right-r.left-1);for(let a=r.top;a<r.bottom;a++){if(r.left>0&&n[o]==n[o-1]||r.right<e&&n[l]==n[l+1])return!0;o+=e,l+=e}for(let a=r.left;a<r.right;a++){if(r.top>0&&n[s]==n[s-e]||r.bottom<t&&n[i]==n[i+e])return!0;s++,i++}return!1}function jT(e,t){const n=e.selection;if(!(n instanceof St)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=Ds(e),{map:s}=r;if(ZZ(s,r))return!1;if(t){const o=e.tr,i={};let l=Z.empty,a,c;for(let u=r.top;u<r.bottom;u++)for(let f=r.left;f<r.right;f++){const h=s.map[u*s.width+f],p=r.table.nodeAt(h);if(!(i[h]||!p))if(i[h]=!0,a==null)a=h,c=p;else{AT(p)||(l=l.append(p.content));const m=o.mapping.map(h+r.tableStart);o.delete(m,m+p.nodeSize)}}if(a==null||c==null)return!0;if(o.setNodeMarkup(a+r.tableStart,null,{...GL(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),l.size>0){const u=a+1+c.content.size,f=AT(c)?a+1:u;o.replaceWith(f+r.tableStart,u+r.tableStart,l)}o.setSelection(new St(o.doc.resolve(a+r.tableStart))),t(o)}return!0}function MT(e,t){const n=Bn(e.schema);return eee(({node:r})=>n[r.type.spec.tableRole])(e,t)}function eee(e){return(t,n)=>{const r=t.selection;let s,o;if(r instanceof St){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;s=r.$anchorCell.nodeAfter,o=r.$anchorCell.pos}else{var i;if(s=IZ(r.$from),!s)return!1;o=(i=El(r.$from))===null||i===void 0?void 0:i.pos}if(s==null||o==null||s.attrs.colspan==1&&s.attrs.rowspan==1)return!1;if(n){let l=s.attrs;const a=[],c=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const u=Ds(t),f=t.tr;for(let p=0;p<u.right-u.left;p++)a.push(c?{...l,colwidth:c&&c[p]?[c[p]]:null}:l);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+=s.nodeSize);for(let y=u.left,x=0;y<u.right;y++,x++)y==u.left&&p==u.top||f.insert(h=f.mapping.map(m+u.tableStart,1),e({node:s,row:p,col:y}).createAndFill(a[x]))}f.setNodeMarkup(o,e({node:s,row:u.top,col:u.left}),a[0]),r instanceof St&&f.setSelection(new St(f.doc.resolve(r.$anchorCell.pos),h?f.doc.resolve(h):void 0)),n(f)}return!0}}function tee(e,t){return function(n,r){if(!us(n))return!1;const s=Fm(n);if(s.nodeAfter.attrs[e]===t)return!1;if(r){const o=n.tr;n.selection instanceof St?n.selection.forEachCell((i,l)=>{i.attrs[e]!==t&&o.setNodeMarkup(l,null,{...i.attrs,[e]:t})}):o.setNodeMarkup(s.pos,null,{...s.nodeAfter.attrs,[e]:t}),r(o)}return!0}}function nee(e){return function(t,n){if(!us(t))return!1;if(n){const r=Bn(t.schema),s=Ds(t),o=t.tr,i=s.map.cellsInRect(e=="column"?{left:s.left,top:0,right:s.right,bottom:s.map.height}:e=="row"?{left:0,top:s.top,right:s.map.width,bottom:s.bottom}:s),l=i.map(a=>s.table.nodeAt(a));for(let a=0;a<i.length;a++)l[a].type==r.header_cell&&o.setNodeMarkup(s.tableStart+i[a],r.cell,l[a].attrs);if(o.steps.length===0)for(let a=0;a<i.length;a++)o.setNodeMarkup(s.tableStart+i[a],r.header_cell,l[a].attrs);n(o)}return!0}}function RT(e,t,n){const r=t.map.cellsInRect({left:0,top:0,right:e=="row"?t.map.width:1,bottom:e=="column"?t.map.height:1});for(let s=0;s<r.length;s++){const o=t.table.nodeAt(r[s]);if(o&&o.type!==n.header_cell)return!1}return!0}function Zu(e,t){return t=t||{useDeprecatedLogic:!1},t.useDeprecatedLogic?nee(e):function(n,r){if(!us(n))return!1;if(r){const s=Bn(n.schema),o=Ds(n),i=n.tr,l=RT("row",o,s),a=RT("column",o,s),c=(e==="column"?l:e==="row"&&a)?1:0,u=e=="column"?{left:0,top:c,right:1,bottom:o.map.height}:e=="row"?{left:c,top:0,right:o.map.width,bottom:1}:o,f=e=="column"?a?s.cell:s.header_cell:e=="row"?l?s.cell:s.header_cell:s.cell;o.map.cellsInRect(u).forEach(h=>{const p=h+o.tableStart,m=i.doc.nodeAt(p);m&&i.setNodeMarkup(p,f,m.attrs)}),r(i)}return!0}}Zu("row",{useDeprecatedLogic:!0});Zu("column",{useDeprecatedLogic:!0});const ree=Zu("cell",{useDeprecatedLogic:!0});function see(e,t){if(t<0){const n=e.nodeBefore;if(n)return e.pos-n.nodeSize;for(let r=e.index(-1)-1,s=e.before();r>=0;r--){const o=e.node(-1).child(r),i=o.lastChild;if(i)return s-1-i.nodeSize;s-=o.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;const n=e.node(-1);for(let r=e.indexAfter(-1),s=e.after();r<n.childCount;r++){const o=n.child(r);if(o.childCount)return s+1;s+=o.nodeSize}}return null}function OT(e){return function(t,n){if(!us(t))return!1;const r=see(Fm(t),e);if(r==null)return!1;if(n){const s=t.doc.resolve(r);n(t.tr.setSelection(Pe.between(s,LZ(s))).scrollIntoView())}return!0}}function oee(e,t){const n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole=="table")return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function Nf(e,t){const n=e.selection;if(!(n instanceof St))return!1;if(t){const r=e.tr,s=Bn(e.schema).cell.createAndFill().content;n.forEachCell((o,i)=>{o.content.eq(s)||r.replace(r.mapping.map(i+1),r.mapping.map(i+o.nodeSize-1),new xe(s,0,0))}),r.docChanged&&t(r)}return!0}function iee(e){if(e.size===0)return null;let{content:t,openStart:n,openEnd:r}=e;for(;t.childCount==1&&(n>0&&r>0||t.child(0).type.spec.tableRole=="table");)n--,r--,t=t.child(0).content;const s=t.child(0),o=s.type.spec.tableRole,i=s.type.schema,l=[];if(o=="row")for(let a=0;a<t.childCount;a++){let c=t.child(a).content;const u=a?0:Math.max(0,n-1),f=a<t.childCount-1?0:Math.max(0,r-1);(u||f)&&(c=Ax(Bn(i).row,new xe(c,u,f)).content),l.push(c)}else if(o=="cell"||o=="header_cell")l.push(n||r?Ax(Bn(i).row,new xe(t,n,r)).content:t);else return null;return lee(i,l)}function lee(e,t){const n=[];for(let s=0;s<t.length;s++){const o=t[s];for(let i=o.childCount-1;i>=0;i--){const{rowspan:l,colspan:a}=o.child(i).attrs;for(let c=s;c<s+l;c++)n[c]=(n[c]||0)+a}}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>=t.length&&t.push(Z.empty),n[s]<r){const o=Bn(e).cell.createAndFill(),i=[];for(let l=n[s];l<r;l++)i.push(o);t[s]=t[s].append(Z.from(i))}return{height:t.length,width:r,rows:t}}function Ax(e,t){const n=e.createAndFill();return new Tb(n).replace(0,n.content.size,t).doc}function aee({width:e,height:t,rows:n},r,s){if(e!=r){const o=[],i=[];for(let l=0;l<n.length;l++){const a=n[l],c=[];for(let u=o[l]||0,f=0;u<r;f++){let h=a.child(f%a.childCount);u+h.attrs.colspan>r&&(h=h.type.createChecked(Nl(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++)o[l+p]=(o[l+p]||0)+h.attrs.colspan}i.push(Z.from(c))}n=i,e=r}if(t!=s){const o=[];for(let i=0,l=0;i<s;i++,l++){const a=[],c=n[l%t];for(let u=0;u<c.childCount;u++){let f=c.child(u);i+f.attrs.rowspan>s&&(f=f.type.create({...f.attrs,rowspan:Math.max(1,s-f.attrs.rowspan)},f.content)),a.push(f)}o.push(Z.from(a))}n=o,t=s}return{width:e,height:t,rows:n}}function cee(e,t,n,r,s,o,i){const l=e.doc.type.schema,a=Bn(l);let c,u;if(s>t.width)for(let f=0,h=0;f<t.height;f++){const p=n.child(f);h+=p.nodeSize;const m=[];let y;p.lastChild==null||p.lastChild.type==a.cell?y=c||(c=a.cell.createAndFill()):y=u||(u=a.header_cell.createAndFill());for(let x=t.width;x<s;x++)m.push(y);e.insert(e.mapping.slice(i).map(h-1+r),m)}if(o>t.height){const f=[];for(let m=0,y=(t.height-1)*t.width;m<Math.max(t.width,s);m++){const x=m>=t.width?!1:n.nodeAt(t.map[y+m]).type==a.header_cell;f.push(x?u||(u=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}const h=a.row.create(null,Z.from(f)),p=[];for(let m=t.height;m<o;m++)p.push(h);e.insert(e.mapping.slice(i).map(r+n.nodeSize-2),p)}return!!(c||u)}function IT(e,t,n,r,s,o,i,l){if(i==0||i==t.height)return!1;let a=!1;for(let c=s;c<o;c++){const u=i*t.width+c,f=t.map[u];if(t.map[u-t.width]==f){a=!0;const h=n.nodeAt(f),{top:p,left:m}=t.findCell(f);e.setNodeMarkup(e.mapping.slice(l).map(f+r),null,{...h.attrs,rowspan:i-p}),e.insert(e.mapping.slice(l).map(t.positionAt(i,m,n)),h.type.createAndFill({...h.attrs,rowspan:p+h.attrs.rowspan-i})),c+=h.attrs.colspan-1}}return a}function DT(e,t,n,r,s,o,i,l){if(i==0||i==t.width)return!1;let a=!1;for(let c=s;c<o;c++){const u=c*t.width+i,f=t.map[u];if(t.map[u-1]==f){a=!0;const h=n.nodeAt(f),p=t.colCount(f),m=e.mapping.slice(l).map(f+r);e.setNodeMarkup(m,null,Nl(h.attrs,i-p,h.attrs.colspan-(i-p))),e.insert(m+h.nodeSize,h.type.createAndFill(Nl(h.attrs,0,i-p))),c+=h.attrs.rowspan-1}}return a}function LT(e,t,n,r,s){let o=n?e.doc.nodeAt(n-1):e.doc;if(!o)throw new Error("No table found");let i=_t.get(o);const{top:l,left:a}=r,c=a+s.width,u=l+s.height,f=e.tr;let h=0;function p(){if(o=n?f.doc.nodeAt(n-1):f.doc,!o)throw new Error("No table found");i=_t.get(o),h=f.mapping.maps.length}cee(f,i,o,n,c,u,h)&&p(),IT(f,i,o,n,a,c,l,h)&&p(),IT(f,i,o,n,a,c,u,h)&&p(),DT(f,i,o,n,l,u,a,h)&&p(),DT(f,i,o,n,l,u,c,h)&&p();for(let m=l;m<u;m++){const y=i.positionAt(m,a,o),x=i.positionAt(m,c,o);f.replace(f.mapping.slice(h).map(y+n),f.mapping.slice(h).map(x+n),new xe(s.rows[m-l],0,0))}p(),f.setSelection(new St(f.doc.resolve(n+i.positionAt(l,a,o)),f.doc.resolve(n+i.positionAt(u-1,c-1,o)))),t(f)}const uee=zb({ArrowLeft:Tf("horiz",-1),ArrowRight:Tf("horiz",1),ArrowUp:Tf("vert",-1),ArrowDown:Tf("vert",1),"Shift-ArrowLeft":Af("horiz",-1),"Shift-ArrowRight":Af("horiz",1),"Shift-ArrowUp":Af("vert",-1),"Shift-ArrowDown":Af("vert",1),Backspace:Nf,"Mod-Backspace":Nf,Delete:Nf,"Mod-Delete":Nf});function oh(e,t,n){return n.eq(e.selection)?!1:(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function Tf(e,t){return(n,r,s)=>{if(!s)return!1;const o=n.selection;if(o instanceof St)return oh(n,r,Ue.near(o.$headCell,t));if(e!="horiz"&&!o.empty)return!1;const i=tP(s,e,t);if(i==null)return!1;if(e=="horiz")return oh(n,r,Ue.near(n.doc.resolve(o.head+t),t));{const l=n.doc.resolve(i),a=YL(l,e,t);let c;return a?c=Ue.near(a,1):t<0?c=Ue.near(n.doc.resolve(l.before(-1)),-1):c=Ue.near(n.doc.resolve(l.after(-1)),1),oh(n,r,c)}}}function Af(e,t){return(n,r,s)=>{if(!s)return!1;const o=n.selection;let i;if(o instanceof St)i=o;else{const a=tP(s,e,t);if(a==null)return!1;i=new St(n.doc.resolve(a))}const l=YL(i.$headCell,e,t);return l?oh(n,r,new St(i.$anchorCell,l)):!1}}function dee(e,t){const n=e.state.doc,r=El(n.resolve(t));return r?(e.dispatch(e.state.tr.setSelection(new St(r))),!0):!1}function fee(e,t,n){if(!us(e.state))return!1;let r=iee(n);const s=e.state.selection;if(s instanceof St){r||(r={width:1,height:1,rows:[Z.from(Ax(Bn(e.state.schema).cell,n))]});const o=s.$anchorCell.node(-1),i=s.$anchorCell.start(-1),l=_t.get(o).rectBetween(s.$anchorCell.pos-i,s.$headCell.pos-i);return r=aee(r,l.right-l.left,l.bottom-l.top),LT(e.state,e.dispatch,i,l,r),!0}else if(r){const o=Fm(e.state),i=o.start(-1);return LT(e.state,e.dispatch,i,_t.get(o.node(-1)).findCell(o.pos-i),r),!0}else return!1}function hee(e,t){var n;if(t.button!=0||t.ctrlKey||t.metaKey)return;const r=PT(e,t.target);let s;if(t.shiftKey&&e.state.selection instanceof St)o(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&r&&(s=El(e.state.selection.$anchor))!=null&&((n=ew(e,t))===null||n===void 0?void 0:n.pos)!=s.pos)o(s,t),t.preventDefault();else if(!r)return;function o(a,c){let u=ew(e,c);const f=Vo.getState(e.state)==null;if(!u||!lv(a,u))if(f)u=a;else return;const h=new St(a,u);if(f||!e.state.selection.eq(h)){const p=e.state.tr.setSelection(h);f&&p.setMeta(Vo,a.pos),e.dispatch(p)}}function i(){e.root.removeEventListener("mouseup",i),e.root.removeEventListener("dragstart",i),e.root.removeEventListener("mousemove",l),Vo.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(Vo,-1))}function l(a){const c=a,u=Vo.getState(e.state);let f;if(u!=null)f=e.state.doc.resolve(u);else if(PT(e,c.target)!=r&&(f=ew(e,t),!f))return i();f&&o(f,c)}e.root.addEventListener("mouseup",i),e.root.addEventListener("dragstart",i),e.root.addEventListener("mousemove",l)}function tP(e,t,n){if(!(e.state.selection instanceof Pe))return null;const{$head:r}=e.state.selection;for(let s=r.depth-1;s>=0;s--){const o=r.node(s);if((n<0?r.index(s):r.indexAfter(s))!=(n<0?0:o.childCount))return null;if(o.type.spec.tableRole=="cell"||o.type.spec.tableRole=="header_cell"){const i=r.before(s),l=t=="vert"?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(l)?i:null}}return null}function PT(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName=="TD"||t.nodeName=="TH")return t;return null}function ew(e,t){const n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:r,pos:s}=n;return r>=0&&El(e.state.doc.resolve(r))||El(e.state.doc.resolve(s))}var pee=class{constructor(t,n){this.node=t,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")),jx(t,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!=this.node.type?!1:(this.node=t,jx(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function jx(e,t,n,r,s,o){let i=0,l=!0,a=t.firstChild;const c=e.firstChild;if(c){for(let f=0,h=0;f<c.childCount;f++){const{colspan:p,colwidth:m}=c.child(f).attrs;for(let y=0;y<p;y++,h++){const x=s==h?o:m&&m[y],k=x?x+"px":"";if(i+=x||r,x||(l=!1),a)a.style.width!=k&&(a.style.width=k),a=a.nextSibling;else{const v=document.createElement("col");v.style.width=k,t.appendChild(v)}}}for(;a;){var u;const f=a.nextSibling;(u=a.parentNode)===null||u===void 0||u.removeChild(a),a=f}l?(n.style.width=i+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=i+"px")}}const xr=new Sn("tableColumnResizing");function mee({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=pee,lastColumnResizable:s=!0}={}){const o=new Gt({key:xr,state:{init(i,l){var a;const c=(a=o.spec)===null||a===void 0||(a=a.props)===null||a===void 0?void 0:a.nodeViews,u=Bn(l.schema).table.name;return r&&c&&(c[u]=(f,h)=>new r(f,n,h)),new gee(-1,!1)},apply(i,l){return l.apply(i)}},props:{attributes:i=>{const l=xr.getState(i);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(i,l)=>{yee(i,l,e,s)},mouseleave:i=>{wee(i)},mousedown:(i,l)=>{kee(i,l,t,n)}},decorations:i=>{const l=xr.getState(i);if(l&&l.activeHandle>-1)return Cee(i,l.activeHandle)},nodeViews:{}}});return o}var gee=class ih{constructor(t,n){this.activeHandle=t,this.dragging=n}apply(t){const n=this,r=t.getMeta(xr);if(r&&r.setHandle!=null)return new ih(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new ih(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&t.docChanged){let s=t.mapping.map(n.activeHandle,-1);return Tx(t.doc.resolve(s))||(s=-1),new ih(s,n.dragging)}return n}};function yee(e,t,n,r){if(!e.editable)return;const s=xr.getState(e.state);if(s&&!s.dragging){const o=bee(t.target);let i=-1;if(o){const{left:l,right:a}=o.getBoundingClientRect();t.clientX-l<=n?i=$T(e,t,"left",n):a-t.clientX<=n&&(i=$T(e,t,"right",n))}if(i!=s.activeHandle){if(!r&&i!==-1){const l=e.state.doc.resolve(i),a=l.node(-1),c=_t.get(a),u=l.start(-1);if(c.colCount(l.pos-u)+l.nodeAfter.attrs.colspan-1==c.width-1)return}nP(e,i)}}}function wee(e){if(!e.editable)return;const t=xr.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&nP(e,-1)}function kee(e,t,n,r){var s;if(!e.editable)return!1;const o=(s=e.dom.ownerDocument.defaultView)!==null&&s!==void 0?s:window,i=xr.getState(e.state);if(!i||i.activeHandle==-1||i.dragging)return!1;const l=e.state.doc.nodeAt(i.activeHandle),a=xee(e,i.activeHandle,l.attrs);e.dispatch(e.state.tr.setMeta(xr,{setDragging:{startX:t.clientX,startWidth:a}}));function c(f){o.removeEventListener("mouseup",c),o.removeEventListener("mousemove",u);const h=xr.getState(e.state);h!=null&&h.dragging&&(vee(e,h.activeHandle,zT(h.dragging,f,n)),e.dispatch(e.state.tr.setMeta(xr,{setDragging:null})))}function u(f){if(!f.which)return c(f);const h=xr.getState(e.state);if(h&&h.dragging){const p=zT(h.dragging,f,n);_T(e,h.activeHandle,p,r)}}return _T(e,i.activeHandle,a,r),o.addEventListener("mouseup",c),o.addEventListener("mousemove",u),t.preventDefault(),!0}function xee(e,t,{colspan:n,colwidth:r}){const s=r&&r[r.length-1];if(s)return s;const o=e.domAtPos(t);let i=o.node.childNodes[o.offset].offsetWidth,l=n;if(r)for(let a=0;a<n;a++)r[a]&&(i-=r[a],l--);return i/l}function bee(e){for(;e&&e.nodeName!="TD"&&e.nodeName!="TH";)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}function $T(e,t,n,r){const s=n=="right"?-r:r,o=e.posAtCoords({left:t.clientX+s,top:t.clientY});if(!o)return-1;const{pos:i}=o,l=El(e.state.doc.resolve(i));if(!l)return-1;if(n=="right")return l.pos;const a=_t.get(l.node(-1)),c=l.start(-1),u=a.map.indexOf(l.pos-c);return u%a.width==0?-1:c+a.map[u-1]}function zT(e,t,n){const r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function nP(e,t){e.dispatch(e.state.tr.setMeta(xr,{setHandle:t}))}function vee(e,t,n){const r=e.state.doc.resolve(t),s=r.node(-1),o=_t.get(s),i=r.start(-1),l=o.colCount(r.pos-i)+r.nodeAfter.attrs.colspan-1,a=e.state.tr;for(let c=0;c<o.height;c++){const u=c*o.width+l;if(c&&o.map[u]==o.map[u-o.width])continue;const f=o.map[u],h=s.nodeAt(f).attrs,p=h.colspan==1?0:l-o.colCount(f);if(h.colwidth&&h.colwidth[p]==n)continue;const m=h.colwidth?h.colwidth.slice():See(h.colspan);m[p]=n,a.setNodeMarkup(i+f,null,{...h,colwidth:m})}a.docChanged&&e.dispatch(a)}function _T(e,t,n,r){const s=e.state.doc.resolve(t),o=s.node(-1),i=s.start(-1),l=_t.get(o).colCount(s.pos-i)+s.nodeAfter.attrs.colspan-1;let a=e.domAtPos(s.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&jx(o,a.firstChild,a,r,l,n)}function See(e){return Array(e).fill(0)}function Cee(e,t){const n=[],r=e.doc.resolve(t),s=r.node(-1);if(!s)return Ot.empty;const o=_t.get(s),i=r.start(-1),l=o.colCount(r.pos-i)+r.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])){var a;const f=o.map[u],h=i+f+s.nodeAt(f).nodeSize-1,p=document.createElement("div");p.className="column-resize-handle",!((a=xr.getState(e))===null||a===void 0)&&a.dragging&&n.push(zn.node(i+f,i+f+s.nodeAt(f).nodeSize,{class:"column-resize-dragging"})),n.push(zn.widget(h,p))}}return Ot.create(e.doc,n)}function Eee({allowTableNodeSelection:e=!1}={}){return new Gt({key:Vo,state:{init(){return null},apply(t,n){const r=t.getMeta(Vo);if(r!=null)return r==-1?null:r;if(n==null||!t.docChanged)return n;const{deleted:s,pos:o}=t.mapping.mapResult(n);return s?null:o}},props:{decorations:zZ,handleDOMEvents:{mousedown:hee},createSelectionBetween(t){return Vo.getState(t.state)!=null?t.state.selection:null},handleTripleClick:dee,handleKeyDown:uee,handlePaste:fee},appendTransaction(t,n,r){return BZ(r,XL(r,n),e)}})}function Mx(e,t){return t?["width",`${Math.max(t,e)}px`]:["min-width",`${e}px`]}function FT(e,t,n,r,s,o){var i;let l=0,a=!0,c=t.firstChild;const u=e.firstChild;if(u!==null)for(let f=0,h=0;f<u.childCount;f+=1){const{colspan:p,colwidth:m}=u.child(f).attrs;for(let y=0;y<p;y+=1,h+=1){const x=s===h?o:m&&m[y],k=x?`${x}px`:"";if(l+=x||r,x||(a=!1),c){if(c.style.width!==k){const[v,b]=Mx(r,x);c.style.setProperty(v,b)}c=c.nextSibling}else{const v=document.createElement("col"),[b,E]=Mx(r,x);v.style.setProperty(b,E),t.appendChild(v)}}}for(;c;){const f=c.nextSibling;(i=c.parentNode)===null||i===void 0||i.removeChild(c),c=f}a?(n.style.width=`${l}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${l}px`)}class Nee{constructor(t,n){this.node=t,this.cellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),FT(t,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!==this.node.type?!1:(this.node=t,FT(t,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(t){return t.type==="attributes"&&(t.target===this.table||this.colgroup.contains(t.target))}}function Tee(e,t,n,r){let s=0,o=!0;const i=[],l=e.firstChild;if(!l)return{};for(let f=0,h=0;f<l.childCount;f+=1){const{colspan:p,colwidth:m}=l.child(f).attrs;for(let y=0;y<p;y+=1,h+=1){const x=n===h?r:m&&m[y];s+=x||t,x||(o=!1);const[k,v]=Mx(t,x);i.push(["col",{style:`${k}: ${v}`}])}}const a=o?`${s}px`:"",c=o?"":`${s}px`;return{colgroup:["colgroup",{},...i],tableWidth:a,tableMinWidth:c}}function BT(e,t){return e.createAndFill()}function Aee(e){if(e.cached.tableNodeTypes)return e.cached.tableNodeTypes;const t={};return Object.keys(e.nodes).forEach(n=>{const r=e.nodes[n];r.spec.tableRole&&(t[r.spec.tableRole]=r)}),e.cached.tableNodeTypes=t,t}function jee(e,t,n,r,s){const o=Aee(e),i=[],l=[];for(let c=0;c<n;c+=1){const u=BT(o.cell);if(u&&l.push(u),r){const f=BT(o.header_cell);f&&i.push(f)}}const a=[];for(let c=0;c<t;c+=1)a.push(o.row.createChecked(null,r&&c===0?i:l));return o.table.createChecked(null,a)}function Mee(e){return e instanceof St}const jf=({editor:e})=>{const{selection:t}=e.state;if(!Mee(t))return!1;let n=0;const r=ML(t.ranges[0].$from,o=>o.type.name==="table");return r==null||r.node.descendants(o=>{if(o.type.name==="table")return!1;["tableCell","tableHeader"].includes(o.type.name)&&(n+=1)}),n===t.ranges.length?(e.commands.deleteTable(),!0):!1},Ree=cn.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:Nee,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:e,HTMLAttributes:t}){const{colgroup:n,tableWidth:r,tableMinWidth:s}=Tee(e,this.options.cellMinWidth),o=["table",At(this.options.HTMLAttributes,t,{style:r?`width: ${r}`:`min-width: ${s}`}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},o]:o},addCommands(){return{insertTable:({rows:e=3,cols:t=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:s,editor:o})=>{const i=jee(o.schema,e,t,n);if(s){const l=r.selection.from+1;r.replaceSelectionWith(i).scrollIntoView().setSelection(Pe.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:e,dispatch:t})=>UZ(e,t),addColumnAfter:()=>({state:e,dispatch:t})=>VZ(e,t),deleteColumn:()=>({state:e,dispatch:t})=>qZ(e,t),addRowBefore:()=>({state:e,dispatch:t})=>GZ(e,t),addRowAfter:()=>({state:e,dispatch:t})=>JZ(e,t),deleteRow:()=>({state:e,dispatch:t})=>XZ(e,t),deleteTable:()=>({state:e,dispatch:t})=>oee(e,t),mergeCells:()=>({state:e,dispatch:t})=>jT(e,t),splitCell:()=>({state:e,dispatch:t})=>MT(e,t),toggleHeaderColumn:()=>({state:e,dispatch:t})=>Zu("column")(e,t),toggleHeaderRow:()=>({state:e,dispatch:t})=>Zu("row")(e,t),toggleHeaderCell:()=>({state:e,dispatch:t})=>ree(e,t),mergeOrSplit:()=>({state:e,dispatch:t})=>jT(e,t)?!0:MT(e,t),setCellAttribute:(e,t)=>({state:n,dispatch:r})=>tee(e,t)(n,r),goToNextCell:()=>({state:e,dispatch:t})=>OT(1)(e,t),goToPreviousCell:()=>({state:e,dispatch:t})=>OT(-1)(e,t),fixTables:()=>({state:e,dispatch:t})=>(t&&XL(e),!0),setCellSelection:e=>({tr:t,dispatch:n})=>{if(n){const r=St.create(t.doc,e.anchorCell,e.headCell);t.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:jf,"Mod-Backspace":jf,Delete:jf,"Mod-Delete":jf}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[mee({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],Eee({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(e){const t={name:e.name,options:e.options,storage:e.storage};return{tableRole:qe(je(e,"tableRole",t))}}}),Oee=cn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:e}){return["tr",At(this.options.HTMLAttributes,e),0]}}),Iee=cn.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{const t=e.getAttribute("colwidth");return t?t.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:e}){return["th",At(this.options.HTMLAttributes,e),0]}}),Dee=cn.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{const t=e.getAttribute("colwidth");return t?t.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:e}){return["td",At(this.options.HTMLAttributes,e),0]}}),Lee=Os.create({name:"underline",parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["u",At(e),0]},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function Pee(e,t){const n=e.schema.nodes.heading,r=e.schema.nodes.paragraph;if(!n||!r)return!1;const{from:s,to:o}=e.selection,i=[];if(e.doc.nodesBetween(s,o,(l,a)=>{l.type===n&&i.push({node:l,pos:a})}),!i.length)return!1;if(t){const{tr:l}=e,a=e.schema.marks.bold;for(const{node:c,pos:u}of i)l.setNodeMarkup(u,r,{},c.marks),a&&c.content.size&&l.removeMark(u+1,u+1+c.content.size,a);t(l.scrollIntoView())}return!0}const $ee=an.create({name:"unboldHeading",priority:1e3,addKeyboardShortcuts(){const e=()=>Pee(this.editor.state,this.editor.view.dispatch);return{"Mod-b":e,"Mod-B":e}}}),zee=an.create({name:"arrows",addInputRules(){return[hT({find:/--?>$/,replace:"→"}),hT({find:/<--?$/,replace:"←"})]}}),_ee=cn.create({name:"image",group:"block",atom:!0,draggable:!0,selectable:!0,addAttributes(){return{src:{default:null},alt:{default:null}}},parseHTML(){return[{tag:"img[src]"}]},renderHTML({HTMLAttributes:e}){return["img",At(e)]}});function Fee(e,{tables:t=!0}={}){return[XX.configure({heading:{levels:[1,2,3]}}),Lee,$ee,zee,_ee,AZ.configure({openOnClick:!1,autolink:!0}),eZ,nZ.configure({nested:!0}),...t?[Ree.configure({resizable:!1}),Oee,Iee,Dee]:[],ZX.configure({placeholder:e})]}function Bee(e){return e.replace(/\r\n?/g,`
313
+ `)}const Hee=/^(#{1,6})\s+(.*)$/,Wee=/^(\s*)[-*](?:\s+(.*))?$/,Uee=/^(\s*)\d+\.\s+(.*)$/,Vee=/^\[( |x|X)\](?:\s+(.*))?$/,tw=/^>\s?(.*)$/,Kee=/^```(\w*)\s*$/,qee=/^(-{3,}|\*{3,}|_{3,})\s*$/,HT=/^\s*\|(.+)\|\s*$/,WT=/^\s*\|(\s*:?-{2,}:?\s*\|)+\s*$/,Yee=/^!\[([^\]]*)\]\(([^)\s]+)\)\s*$/;function UT(e){const t=e.trim().replace(/^\|/,"").replace(/\|$/,""),n=[];let r="";for(let s=0;s<t.length;s++){if(t[s]==="\\"&&t[s+1]==="|"){r+="|",s++;continue}if(t[s]==="|"){n.push(r.trim()),r="";continue}r+=t[s]}return n.push(r.trim()),n}const Gee=new RegExp([/\\([\\`*_~[\]()#>|.!+-])/,/`([^`]+?)`/,/<u>([\s\S]+?)<\/u>/,/\[([^\]]+?)\]\(([^)\s]+?)\)/,new RegExp("\\*\\*\\*(?!\\s)([^*]+?)(?<!\\s)\\*\\*\\*"),new RegExp("\\*\\*(?!\\s)([\\s\\S]+?)(?<!\\s)\\*\\*"),new RegExp("~~(?!\\s)([^~]+?)(?<!\\s)~~"),new RegExp("~(?!\\s)([^~]+?)(?<!\\s)~"),new RegExp("\\*(?!\\s)([^*]+?)(?<!\\s)\\*"),new RegExp("(?<![A-Za-z0-9])_(?!\\s)([^_]+?)(?<!\\s)_(?![A-Za-z0-9])")].map(e=>e.source).join("|"),"g"),Ii=(e,t)=>e.map(n=>({...n,marks:[...n.marks||[],t]}));function to(e){const t=[];let n="";const r=()=>{n&&(t.push({type:"text",text:n}),n="")},s=new RegExp(Gee.source,"g");let o=0,i;for(;(i=s.exec(e))!==null;){if(n+=e.slice(o,i.index),i[1]!==void 0)n+=i[1];else if(i[2]!==void 0)r(),t.push({type:"text",text:i[2],marks:[{type:"code"}]});else if(i[3]!==void 0)r(),t.push(...Ii(to(i[3]),{type:"underline"}));else if(i[4]!==void 0){const l=/^(https?:|mailto:|\/)/i.test(i[5])?i[5]:"#";r(),t.push(...Ii(to(i[4]),{type:"link",attrs:{href:l}}))}else i[6]!==void 0?(r(),t.push(...Ii(Ii(to(i[6]),{type:"bold"}),{type:"italic"}))):i[7]!==void 0?(r(),t.push(...Ii(to(i[7]),{type:"bold"}))):i[8]!==void 0||i[9]!==void 0?(r(),t.push(...Ii(to(i[8]??i[9]),{type:"strike"}))):(r(),t.push(...Ii(to(i[10]??i[11]),{type:"italic"})));o=s.lastIndex}return n+=e.slice(o),r(),t}function rP(e){const t=[];for(const n of to(e.join(`
314
+ `))){if(n.type!=="text"||!(n.text||"").includes(`
315
+ `)){t.push(n);continue}n.text.split(`
316
+ `).forEach((r,s)=>{s&&t.push({type:"hardBreak"}),r&&t.push({...n,text:r})})}return t}function Rx(e){const t=e.match(Uee);if(t)return{indent:t[1].length,ordered:!0,n:Number.parseInt(t[0].trim(),10)||1,text:t[2].trim(),extra:[]};const n=e.match(Wee);if(!n)return null;const r=(n[2]??"").trim(),s=r.match(Vee);return s?{indent:n[1].length,ordered:!1,checked:s[1].toLowerCase()==="x",text:(s[2]??"").trim(),extra:[]}:{indent:n[1].length,ordered:!1,text:r,extra:[]}}function Jee(e,t,n){const r=[];let s=t;for(;s<e.length;){const o=e[s],i=Rx(o);if(i){r.push(i),s++;continue}if(o.trim()===""){let l=s;for(;l<e.length&&e[l].trim()==="";)l++;const a=l<e.length?e[l]:"";if(l<e.length&&(Rx(a)||/^\s{2,}\S/.test(a)&&r.length)){s=l;continue}break}if(/^\s{2,}\S/.test(o)&&r.length){r[r.length-1].extra.push(o.trim()),s++;continue}break}return n(s),r}function Qee(e){let t=0;const n=r=>{const s=[];let o=null,i="";const l=e[t].indent;for(;t<e.length&&e[t].indent>=r;){const a=e[t];if(a.indent>=l+2){const h=n(l+2),p=o==null?void 0:o.content[o.content.length-1];p?p.content.push(...h):s.push(...h);continue}const c=a.checked!==void 0?"taskList":a.ordered?"orderedList":"bulletList";(!o||i!==c)&&(o=c==="orderedList"&&(a.n??1)!==1?{type:c,attrs:{start:a.n},content:[]}:{type:c,content:[]},i=c,s.push(o));const u=rP([a.text,...a.extra]),f=u.length?{type:"paragraph",content:u}:{type:"paragraph"};o.content.push(a.checked!==void 0?{type:"taskItem",attrs:{checked:a.checked},content:[f]}:{type:"listItem",content:[f]}),t++}return s};return n(0)}function lh(e){const t=Bee(e??"").split(`
317
+ `),n=[];let r=0,s=0;const o=()=>{if(n.length)for(let c=1;c<s;c++)n.push({type:"paragraph"});s=0},i=(...c)=>{o(),n.push(...c)};let l=[];const a=()=>{if(!l.length)return;const c=[];let u=[],f=0;for(const h of l){if(h.trim()===""){f+=1;continue}f&&(u.length&&(c.push(u),u=[]),c.push(f),f=0),u.push(h)}u.length&&c.push(u),l=[];for(const h of c)typeof h=="number"?(s=h,o()):i({type:"paragraph",content:rP(h)});s=f};for(;r<t.length;){const c=t[r],u=c.match(Kee);if(u){a();const p=u[1]||null,m=[];for(r++;r<t.length&&!/^```\s*$/.test(t[r]);)m.push(t[r]),r++;r++,i({type:"codeBlock",attrs:{language:p},content:m.length?[{type:"text",text:m.join(`
318
+ `)}]:void 0});continue}const f=c.match(Hee);if(f){a(),i({type:"heading",attrs:{level:Math.min(3,f[1].length)},content:to(f[2].trim())}),r++;continue}if(qee.test(c)&&c.trim().startsWith("---")){a(),i({type:"horizontalRule"}),r++;continue}const h=c.match(Yee);if(h){a(),i({type:"image",attrs:{alt:h[1]||null,src:h[2]}}),r++;continue}if(Rx(c)){a();const p=Jee(t,r,m=>{r=m});i(...Qee(p));continue}if(tw.test(c)){a();const p=[];for(;r<t.length&&tw.test(t[r]);)p.push(t[r].match(tw)[1]),r++;const m=lh(p.join(`
319
+ `)).content;i({type:"blockquote",content:m.length?m:[{type:"paragraph"}]});continue}if(HT.test(c)&&r+1<t.length&&WT.test(t[r+1])){a();const p=UT(c);r+=2;const m=[];for(;r<t.length&&HT.test(t[r])&&!WT.test(t[r]);)m.push(UT(t[r])),r++;const y=x=>k=>({type:x,content:[{type:"paragraph",content:to(k)}]});i({type:"table",content:[{type:"tableRow",content:p.map(y("tableHeader"))},...m.map(x=>({type:"tableRow",content:p.map((k,v)=>y("tableCell")(x[v]??""))}))]});continue}l.push(c),r++}return a(),{type:"doc",content:n.length?n:[{type:"paragraph"}]}}function nw(e,t,n=t){const r=e.match(/^(\s*)([\s\S]*?)(\s*)$/);return r[2]?`${r[1]}${t}${r[2]}${n}${r[3]}`:e}const VT=["underline","strike","bold","italic","link"];function KT(e,t){var r;const n=(e.marks||[]).find(s=>s.type===t);return n?t==="link"?`link:${((r=n.attrs)==null?void 0:r.href)??""}`:t:null}function Xee(e,t,n){return e==="italic"?nw(t,"*"):e==="bold"?nw(t,"**"):e==="strike"?nw(t,"~~"):e==="underline"?`<u>${t}</u>`:`[${t}](${n})`}function sP(e,t){if(t>=VT.length)return e.map(s=>{if(s.type==="hardBreak")return`
320
+ `;const o=s.text||"";return(s.marks||[]).some(i=>i.type==="code")?"`"+o+"`":o}).join("");const n=VT[t];let r="";for(let s=0;s<e.length;){if(e[s].type==="hardBreak"){r+=`
321
+ `,s+=1;continue}const o=KT(e[s],n);let i=s+1;for(;i<e.length&&(e[i].type==="hardBreak"||KT(e[i],n)===o);)i+=1;for(;i-1>s&&e[i-1].type==="hardBreak";)i-=1;const l=e.slice(s,i),a=sP(l,t+1);r+=o===null?a:Xee(n,a,o.slice(5)),s=i}return r}function yu(e){if(!Array.isArray(e))return"";let t="",n=[];const r=()=>{n.length&&(t+=sP(n,0),n=[])};for(const s of e){if(s.type!=="text"&&s.type!=="hardBreak"){r(),t+=yu(s.content);continue}n.push(s)}return r(),t}function Zee(e){const t=e.match(/`{3,}/g),n=t?Math.max(...t.map(r=>r.length)):0;return"`".repeat(Math.max(3,n+1))}const oP=new Set(["bulletList","orderedList","taskList"]);function iP(e,t){const n=[];return(e.content||[]).forEach((r,s)=>{var c,u;const o=e.type==="orderedList"?`${(((c=e.attrs)==null?void 0:c.start)??1)+s}. `:e.type==="taskList"?`- [${(u=r.attrs)!=null&&u.checked?"x":" "}] `:"- ",i=t+" ".repeat(o.length);let l=!1;const a=f=>{n.push(t+o+f),l=!0};for(const f of r.content||[])if(oP.has(f.type))l||a(""),n.push(iP(f,i));else for(const h of yu(f.content).split(`
322
+ `))l?h&&n.push(i+h):a(h);l||a("")}),n.map(r=>r.replace(/\s+$/,"")).join(`
323
+ `)}const qT="";function ah(e){var s,o,i;const t=[];for(const l of(e==null?void 0:e.content)||[])if(l.type==="heading"){const a=yu(l.content);a.trim()&&t.push(`${"#".repeat(Math.min(6,((s=l.attrs)==null?void 0:s.level)||1))} ${a}`)}else if(oP.has(l.type)){const a=iP(l,"");a.trim()&&t.push(a)}else if(l.type==="codeBlock"){const a=(l.content||[]).map(u=>u.text||"").join(""),c=Zee(a);t.push(`${c}${((o=l.attrs)==null?void 0:o.language)||""}
324
+ ${a}
325
+ ${c}`)}else if(l.type==="blockquote"){const a=ah(l).trim();a&&t.push(a.split(`
326
+ `).map(c=>c?`> ${c}`:">").join(`
327
+ `))}else if(l.type==="horizontalRule")t.push("---");else if(l.type==="image")(i=l.attrs)!=null&&i.src&&t.push(`![${l.attrs.alt||""}](${l.attrs.src})`);else if(l.type==="table"){const a=l.content||[],c=f=>(f.content||[]).map(h=>yu(h.content)).join(" ").replace(/\n/g," ").replace(/\|/g,"\\|").trim(),u=[];a.forEach((f,h)=>{const p=f.content||[];u.push(`| ${p.map(c).join(" | ")} |`),h===0&&u.push(`|${p.map(()=>" --- ").join("|")}|`)}),u.length&&t.push(u.join(`
328
+ `))}else{const a=yu(l.content);a.trim()?t.push(a):l.type==="paragraph"&&t.push(qT)}let n="",r=0;for(const l of t){if(l===qT){n&&(r+=1);continue}n&&(n+=`
329
+
330
+ `+`
331
+ `.repeat(r)),n+=l,r=0}return n+(n?`
332
+ `:"")}function zp(e){return e.split(`
333
+ `)}function ete(e,t){let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n+=1;return n}function tte(e,t,n){let r=0;for(;r<e.length-n&&r<t.length-n&&e[e.length-1-r]===t[t.length-1-r];)r+=1;return r}function nte(e,t){if(e===t)return null;const n=zp(e),r=zp(t),s=ete(n,r),o=tte(n,r,s);return{from:s,to:n.length-o,insert:r.slice(s,r.length-o)}}function rte(e,t){const n=l=>{const a=new Map;return l.forEach(c=>{c.trim()&&a.set(c,(a.get(c)??0)+1)}),a},r=n(e),s=n(t),o=new Map;t.forEach((l,a)=>{s.get(l)===1&&o.set(l,a)});const i=[];return e.forEach((l,a)=>{if(r.get(l)!==1)return;const c=o.get(l);c!==void 0&&(i.length&&c<=i[i.length-1][1]||i.push([a,c]))}),i}function YT(e,t,n,r){let s=[0,0],o=[n,r];for(const a of t)if(a[0]<e)s=a;else{o=a;break}const i=o[0]-s[0],l=o[1]-s[1];return i!==l?null:s[1]+(e-s[0])}function ste(e,t,n){if(t===n)return e;if(e===t)return n;const r=nte(t,n);if(!r)return e;const s=zp(t),o=zp(e),i=rte(s,o),l=YT(r.from,i,s.length,o.length),a=YT(r.to,i,s.length,o.length);return l===null||a===null||a<l?null:[...o.slice(0,l),...r.insert,...o.slice(a)].join(`
334
+ `)}function ote(e){return!e||typeof e.key!="string"?!1:e.key==="Escape"?!0:!!(e.metaKey||e.ctrlKey)}function ite(e){return!e||typeof e.key!="string"?null:e.key==="Escape"?"close":(e.meta||e.ctrl)&&e.key.toLowerCase()==="k"?"palette":ate({key:e.key,meta:e.meta,control:e.ctrl,alt:e.alt})?"app":null}const lte=new Set(["e","j","k","r","c","n","s","z","b","g","/","\\"]);function ate(e){return!e||typeof e.key!="string"||e.meta||e.control||e.alt?!1:lte.has(e.key.toLowerCase())}const cte=900;function ute(e){const t=e.trim();return t?/^(https?:|mailto:)/i.test(t)?t:/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)?`mailto:${t}`:`https://${t}`:""}function dte(e){return e.replace(/^https?:\/\//i,"").replace(/^mailto:/i,"")}function fte({product:e,src:t,text:n,mtime:r,onSaved:s,onNotice:o}){const i=w.useRef(n),l=w.useRef(ah(lh(n))),a=w.useRef(r),c=w.useRef(!1),u=w.useRef(null);w.useEffect(()=>{a.current=r},[r]);const f=w.useMemo(()=>Fee("Write anything…"),[]),h=GQ({extensions:f,content:lh(n),editable:!0,onUpdate:()=>{c.current=!0,u.current!=null&&window.clearTimeout(u.current),u.current=window.setTimeout(p,cte)}}),p=async()=>{if(!h||!c.current)return;const I=ah(h.getJSON());if(I===l.current){c.current=!1;return}c.current=!1;const ne=ste(i.current,l.current,I),B=ne??I,J=await q.writeDoc({product:e,src:t,text:B,mtime:a.current});J.ok?(i.current=B,l.current=I,a.current=J.mtime??0,s(J.mtime??0),ne===null&&o("Saved. The rest of the file was reformatted as well.")):(c.current=!0,o(J.error??"That could not be saved."))};w.useEffect(()=>{if(!h||n===i.current||c.current)return;const I=lh(n);i.current=n,l.current=ah(I),h.commands.setContent(I)},[n,h]),w.useEffect(()=>{const I=ne=>{if(!(ne.metaKey||ne.ctrlKey)||ne.key!=="s"&&ne.key!=="S")return;ne.preventDefault(),u.current!=null&&(window.clearTimeout(u.current),u.current=null);const B=c.current;Promise.resolve(p()).then(()=>{B&&!c.current&&o("Saved.")})};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[h]),w.useEffect(()=>{const I=()=>{p()};return window.addEventListener("blur",I),()=>{window.removeEventListener("blur",I),u.current!=null&&window.clearTimeout(u.current),I()}},[h]);const[m,y]=w.useState(null),[x,k]=w.useState(!1),[v,b]=w.useState(""),[E,N]=w.useState(!1),T=w.useRef(null),A=()=>{T.current!=null&&(window.clearTimeout(T.current),T.current=null)},R=()=>{A(),T.current=window.setTimeout(()=>y(I=>I!=null&&I.pinned?I:null),140)},$=(I,ne)=>{if(!h)return;const B=I.getAttribute("href")||"",J=I.getBoundingClientRect();let M=0;try{M=h.view.posAtDOM(I,0)}catch{M=0}A(),k(!1),N(!1),y({href:B,left:Math.max(8,Math.min(J.left,window.innerWidth-340)),top:J.bottom+6,pos:M,pinned:ne})},L=I=>{var ne,B;return(B=(ne=I.target).closest)==null?void 0:B.call(ne,"a")},_=()=>{if(!m)return;const I=m.href;q.openArtifactExternally({product:e,src:I}).then(ne=>{ne.ok||o(ne.error??"That link could not be opened.")}),y(null)},j=async()=>{if(m)try{await navigator.clipboard.writeText(m.href),N(!0),window.setTimeout(()=>N(!1),1200)}catch{}},F=()=>{m&&(b(m.href),k(!0),y({...m,pinned:!0}))},ae=()=>{if(!m||!h)return;const I=ute(v);I&&(h.chain().focus().setTextSelection(m.pos).extendMarkRange("link").setLink({href:I}).run(),y({...m,href:I})),k(!1)},G=()=>{!m||!h||(h.chain().focus().setTextSelection(m.pos).extendMarkRange("link").unsetLink().run(),y(null),k(!1))};return w.useEffect(()=>{if(!(m!=null&&m.pinned))return;const I=B=>{var M,Q;const J=B.target;(M=J.closest)!=null&&M.call(J,".link-pop")||(Q=J.closest)!=null&&Q.call(J,"a")||(y(null),k(!1))},ne=B=>{B.key==="Escape"&&(B.stopPropagation(),y(null),k(!1))};return document.addEventListener("mousedown",I),document.addEventListener("keydown",ne,!0),()=>{document.removeEventListener("mousedown",I),document.removeEventListener("keydown",ne,!0)}},[m==null?void 0:m.pinned]),d.jsxs("div",{className:"doc-rich markdown",onKeyDown:I=>{if(I.key==="Escape"){I.preventDefault(),I.stopPropagation(),h==null||h.commands.blur();return}ote(I)||I.stopPropagation()},onMouseOver:I=>{const ne=L(I);ne&&(A(),!x&&(m&&m.href===(ne.getAttribute("href")||"")||$(ne,(m==null?void 0:m.pinned)??!1)))},onMouseOut:I=>{L(I)&&R()},onClick:I=>{const ne=L(I);ne&&(I.preventDefault(),$(ne,!0))},children:[d.jsx(_Q,{editor:h,className:"doc-rich-content"}),m&&ki.createPortal(d.jsx("div",{className:"link-pop",style:{left:m.left,top:m.top},onMouseEnter:A,onMouseLeave:R,children:x?d.jsxs("div",{className:"link-pop-edit",children:[d.jsx("input",{autoFocus:!0,value:v,placeholder:"Paste or type a link",onChange:I=>b(I.target.value),onKeyDown:I=>{I.key==="Enter"&&(I.preventDefault(),ae()),I.key==="Escape"&&(I.preventDefault(),k(!1))}}),d.jsx("button",{type:"button",className:"link-pop-btn",onClick:ae,children:"Save"})]}):d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:"link-pop-url",title:m.href,onClick:_,children:dte(m.href)||"link"}),d.jsxs("span",{className:"link-pop-actions",children:[d.jsx("button",{type:"button",className:"link-pop-btn",onClick:_,children:"Visit"}),d.jsx("button",{type:"button",className:"link-pop-btn",onClick:j,children:E?"Copied":"Copy"}),d.jsx("button",{type:"button",className:"link-pop-btn",onClick:F,children:"Edit"}),d.jsx("button",{type:"button",className:"link-pop-btn",onClick:G,children:"Remove"})]})]})}),document.body)]})}function hte(e,t,n){if(!e.length)return"";if(e.length===1){const o=e[0],i=Math.max(0,Math.min(t,o.length)),l=Math.max(i,Math.min(n,o.length));return o.slice(i,l)}const r=e[0],s=e[e.length-1];return[r.slice(Math.max(0,Math.min(t,r.length))),...e.slice(1,-1),s.slice(0,Math.max(0,Math.min(n,s.length)))].join(`
335
+ `)}function pte(e){return e.filter(([t])=>t!=="-").map(([,t])=>t)}function mte(e){const n=String(e??"").split(`
336
+ `),r=n.length>1&&n[n.length-1]==="";return r&&n.pop(),{lines:n,trailing:r}}function gte(e,t){const n=[];if(!t.length||t.length>e.length)return n;for(let r=0;r+t.length<=e.length;r++){let s=!0;for(let o=0;o<t.length;o++)if(e[r+o]!==t[o]){s=!1;break}s&&n.push(r)}return n}function yte(e,t){const{lines:n,trailing:r}=mte(e);let s=n.slice(),o=0;const i=t.filter(a=>a.edits.size>0);if(!i.length)return{ok:!0,text:e,lines:0};const l=[];for(const a of i){const c=pte(a.rows);if(!c.length)return{ok:!1,error:"Those lines were removed by the run, so there is nothing in the file to save them onto."};const u=a.rows.map((h,p)=>({row:h,i:p})).filter(({row:h})=>h[0]!=="-").map(({row:h,i:p})=>a.edits.has(p)?a.edits.get(p):h[1]),f=gte(s,c);if(!f.length)return{ok:!1,error:"The file has changed since this run, so those lines are not in it any more. Nothing was saved."};l.push({at:f[0],before:c,after:u}),o+=[...a.edits.keys()].length}l.sort((a,c)=>c.at-a.at);for(const a of l){if(s.slice(a.at,a.at+a.before.length).join(`
337
+ `)!==a.before.join(`
338
+ `))return{ok:!1,error:"Two of those edits overlap in the file, so nothing was saved."};s=[...s.slice(0,a.at),...a.after,...s.slice(a.at+a.before.length)]}return{ok:!0,text:s.join(`
339
+ `)+(r?`
340
+ `:""),lines:o}}function wte(e,t){return`Saved ${e.split("/").pop()||e}, ${t} line${t===1?"":"s"}.`}function rw(e){return[...e.entries()].filter(([,t])=>[...t.values()].some(n=>n.size>0)).map(([t])=>t)}const kte=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End","j","k"]);function xte(e){return kte.has(e.length===1?e.toLowerCase():e)}function bte(e,t,{meta:n=!1}={}){const r=Math.max(0,t.max),s=l=>Math.max(0,Math.min(r,Math.round(l))),o=t.row>0?t.row:19,i=Math.max(o,t.view-o*2);switch(e){case"ArrowDown":return n?r:s(t.top+o);case"ArrowUp":return n?0:s(t.top-o);case"PageDown":return s(t.top+i);case"PageUp":return s(t.top-i);case"Home":return 0;case"End":return r;default:return null}}function vte(e,t,n){if(n<=0)return null;const r=s=>Math.max(0,Math.min(n-1,s));switch(e){case"ArrowDown":return r(t+1);case"ArrowUp":return r(t-1);case"Home":return 0;case"End":return n-1;default:return null}}function Ste(e,t,{shift:n=!1,meta:r=!1}={}){if(n||r)return null;switch(e){case"ArrowUp":return{move:-1,col:t.col};case"ArrowDown":return{move:1,col:t.col};case"ArrowLeft":return t.col===0?{move:-1,col:1/0}:null;case"ArrowRight":return t.col>=t.len?{move:1,col:0}:null;default:return null}}function Cte(e,t,n){if(!n.length)return null;const r=Math.max(0,Math.min(n.length-1,t.line)),s=i=>Math.max(0,Math.min(n.length-1,i)),o=(i,l)=>({line:i,col:Math.max(0,Math.min(l,n[i]))});switch(e){case"ArrowDown":return r>=n.length-1?o(r,n[r]):o(s(r+1),t.col);case"ArrowUp":return r<=0?o(r,0):o(s(r-1),t.col);case"ArrowRight":return t.col>=n[r]?r>=n.length-1?null:o(s(r+1),0):o(r,t.col+1);case"ArrowLeft":return t.col<=0?r<=0?null:o(s(r-1),n[s(r-1)]):o(r,t.col-1);case"Home":return o(r,0);case"End":return o(r,n[r]);default:return null}}function Ete(e){return e==="ArrowDown"||e==="ArrowUp"||e==="ArrowLeft"||e==="ArrowRight"||e==="Home"||e==="End"}function Nte(e,t,n=12){let r=0;for(let s=0;s<e.length;s++)e[s]-t<=n&&(r=s);return r}function Tte(e,t={}){return t.meta||t.ctrl||t.alt?!1:e==="Backspace"||e==="Delete"||e==="Enter"?!0:e.length===1}function Ate(e){return e.startsWith("insert")||e.startsWith("delete")}function jte(){return[...document.querySelectorAll(".code-body .code-line")].filter(e=>e.isContentEditable)}function sw(e){const t=window.getSelection();if(!t||!t.focusNode||!e.contains(t.focusNode))return 0;const n=document.createRange();return n.selectNodeContents(e),n.setEnd(t.focusNode,t.focusOffset),n.toString().length}function ch(e,t){const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let r=t,s=null,o=0;for(let i=n.nextNode();i;i=n.nextNode()){s=i;const l=i.data.length;if(r<=l){o=r;break}r-=l,o=l}return s?{node:s,offset:Math.min(o,s.data.length)}:{node:e,offset:0}}function Mte(e,t){e.focus();const{node:n,offset:r}=ch(e,t),s=document.createRange();s.setStart(n,r),s.collapse(!0);const o=window.getSelection();o==null||o.removeAllRanges(),o==null||o.addRange(s),e.scrollIntoView({block:"nearest"})}const GT=new Map;function Rte(e,t){const n=`${e}
341
+ ${t}`,r=GT.get(n);if(r)return r;const s=new Map;return GT.set(n,s),s}function av(){return[...document.querySelectorAll(".code-body .code-line")]}function Ote(e){return av().filter(t=>e.intersectsNode(t)).filter(t=>{var n;return!((n=t.closest(".code-row"))!=null&&n.classList.contains("cr-minus"))})}function JT(){const e=window.getSelection();if(!e||e.rangeCount===0||e.isCollapsed)return 0;const t=e.getRangeAt(0);return av().filter(n=>t.intersectsNode(n)).length}function ow(e,t,n){if(!e.contains(t))return 0;const r=document.createRange();return r.selectNodeContents(e),r.setEnd(t,n),r.toString().length}function Ite({line:e}){const t=w.useMemo(()=>aR(e),[e]);return d.jsx(d.Fragment,{children:t.map((n,r)=>n.c?d.jsx("span",{className:`t-${n.c}`,children:n.s},r):d.jsx("span",{children:n.s},r))})}function QT({plus:e,minus:t}){return d.jsxs("span",{className:"code-counts",children:[e>0&&d.jsxs("span",{className:"code-plus",children:["+",e]}),t>0&&d.jsxs("span",{className:"code-minus",children:["−",t]})]})}const Dte=w.memo(function({mark:t,line:n,num:r,editable:s,onEdit:o,onDone:i}){return d.jsxs("div",{className:`code-row${t==="+"?" cr-plus":t==="-"?" cr-minus":""}${s?" cr-live":""}`,children:[d.jsx("span",{className:"code-num","aria-hidden":"true",children:r??""}),d.jsx("span",{className:"code-mark","aria-hidden":"true",children:t==="="?"":t==="+"?"+":"−"}),d.jsx("span",{className:"code-line",contentEditable:s||void 0,suppressContentEditableWarning:s,spellCheck:!1,onInput:s?l=>o(l.currentTarget.textContent??""):void 0,onBlur:s?i:void 0,onKeyDown:s?l=>{l.key==="Enter"&&l.preventDefault(),l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),l.currentTarget.blur())}:void 0,onPaste:s?l=>{l.preventDefault();const a=l.clipboardData.getData("text/plain").replace(/[\r\n]+/g," ");document.execCommand("insertText",!1,a)}:void 0,children:d.jsx(Ite,{line:n})})]})},(e,t)=>e.mark===t.mark&&e.line===t.line&&e.num===t.num&&e.editable===t.editable);function Lte({hunk:e,editable:t,pending:n,onEdit:r,onDone:s}){const{rows:o}=w.useMemo(()=>y_(e.rows),[e.rows]),i=w.useMemo(()=>w_(e.rows),[e.rows]),l=(a,c,u)=>{var m;const f=(a==="-"||n==null?void 0:n.get(i[u]))??c,h=(m=e.nums)==null?void 0:m[i[u]],p=(a==="-"?h==null?void 0:h[0]:h==null?void 0:h[1])??null;return d.jsx(Dte,{mark:a,line:f,num:p,editable:t&&a!=="-",onEdit:y=>r(i[u],y),onDone:s},`${i[u]}:${c}`)};return d.jsx("div",{className:"code-hunk",style:{containIntrinsicSize:`auto ${b_(o.length)}px`},children:o.map(([a,c],u)=>l(a,c,u))})}const Pte=w.memo(function({file:t,pending:n,onEdit:r,onDone:s}){return d.jsx(d.Fragment,{children:t.hunks.map((o,i)=>d.jsxs("div",{className:"code-hunk-block",children:[i>0&&WS(t.hunks[i-1],o)!==null&&d.jsx("div",{className:"code-skip","aria-hidden":"true",children:d.jsxs("span",{children:[WS(t.hunks[i-1],o)," lines not shown"]})}),d.jsx(Lte,{hunk:o,editable:!0,pending:(n==null?void 0:n.get(i))??null,onEdit:(l,a)=>r(t.path,i,l,a),onDone:s})]},i))})});function $te({product:e,src:t,change:n,startAt:r=null,startAtFrom:s=0,onFileAt:o,onNotice:i}){var ce;const l=w.useMemo(()=>v_(n.files??[]),[n.files]),a=w.useMemo(()=>iR(l),[l]),[c,u]=w.useState(()=>new Set),f=w.useMemo(()=>HS(a,c),[a,c]),h=w.useMemo(()=>f.filter(C=>C.kind==="file"),[f]),[p,m]=w.useState(0),y=w.useRef(null),x=w.useRef(new Map),k=w.useRef(null),v=w.useRef(new Map),b=w.useRef(!1),E=w.useRef(null),N=w.useRef(null),T=w.useRef(null),A=h[Math.min(p,Math.max(0,h.length-1))],R=w.useRef(Rte(e,t)),$=w.useRef(new Map([...R.current].map(([C,re])=>[C,new Map([...re].map(([W,V])=>[W,new Map(V)]))]))),[L,_]=w.useState(0),[j,F]=w.useState(!1),ae=w.useCallback((C,re,W,V)=>{const Se=rw(R.current).length,ye=R.current.get(C)??new Map,De=ye.get(re)??new Map;De.set(W,V),ye.set(re,De),R.current.set(C,ye),rw(R.current).length!==Se&&_(Te=>Te+1)},[]),G=w.useCallback(()=>_(C=>C+1),[]),I=()=>rw(R.current),ne=w.useCallback(async()=>{var W;const C=I();if(!C.length||j)return;F(!0);const re=[];try{for(const V of C){const Se=l.find(me=>me.path===V),ye=R.current.get(V);if(!Se||!ye)continue;const De=await q.codeFile({product:e,src:t,path:V});if(!De.ok||typeof De.text!="string"){i(De.error??`${V} could not be opened, so nothing was saved.`);continue}const Te=[...ye.entries()].filter(([,me])=>me.size>0).map(([me,U])=>{var we;return{hunk:me,rows:((we=Se.hunks[me])==null?void 0:we.rows)??[],edits:U}}),le=yte(De.text,Te);if(!le.ok){i(le.error);continue}if(le.text===De.text){R.current.delete(V);continue}const K=await q.saveCodeFile({product:e,src:t,path:V,text:le.text,mtime:De.mtime??0});if(!K.ok){i(K.error??`${V} could not be saved.`);continue}for(const[me,U]of ye.entries()){const we=(W=Se.hunks[me])==null?void 0:W.rows;if(we)for(const[Oe,Ie]of U.entries())we[Oe]&&(we[Oe][1]=Ie)}R.current.delete(V),re.push(wte(V,le.lines))}}finally{F(!1),_(V=>V+1)}re.length&&i(re.join(" "))},[l,e,n,j,i]);w.useEffect(()=>{const C=W=>{var le,K,me,U,we,Oe,Ie,ct;if((W.metaKey||W.ctrlKey)&&(W.key==="s"||W.key==="S")){W.preventDefault(),(K=(le=W.target)==null?void 0:le.blur)==null||K.call(le),ne();return}const V=W.target,Se=String((V==null?void 0:V.tagName)??"").toUpperCase();if(W.shiftKey&&!W.metaKey&&!W.altKey&&!W.ctrlKey&&Ete(W.key)){const se=av(),he=N.current,ve=he?se[he.head.line]:(me=V==null?void 0:V.closest)==null?void 0:me.call(V,".code-line"),He=he?he.head.line:se.indexOf(ve);if(ve&&He>=0){const tt=he?he.anchor:{line:He,col:V!=null&&V.isContentEditable?sw(ve):0},Ct=he?he.head:{line:He,col:sw(ve)},oe=Cte(W.key,Ct,se.map(P=>(P.textContent??"").length));if(oe){W.preventDefault(),N.current={anchor:tt,head:oe},oe.line!==tt.line&&((we=(U=document.activeElement)==null?void 0:U.blur)==null||we.call(U));const P=ch(se[tt.line],tt.col),ee=ch(se[oe.line],oe.col);(Oe=window.getSelection())==null||Oe.setBaseAndExtent(P.node,P.offset,ee.node,ee.offset),se[oe.line].scrollIntoView({block:"nearest"});return}}}if(JT()>1&&Tte(W.key,{meta:W.metaKey,ctrl:W.ctrlKey,alt:W.altKey})){W.preventDefault();return}W.shiftKey||(N.current=null);const ye=(Ie=V==null?void 0:V.closest)==null?void 0:Ie.call(V,".code-line");if(ye&&(V!=null&&V.isContentEditable)){const se=ye.textContent??"",he=Ste(W.key,{col:sw(ye),len:se.length},{shift:W.shiftKey,meta:W.metaKey});if(!he)return;const ve=jte(),He=ve.indexOf(ye),tt=ve[He+he.move];if(He<0||!tt){(W.key==="ArrowUp"||W.key==="ArrowDown")&&W.preventDefault();return}W.preventDefault(),G(),Mte(tt,he.col===1/0?(tt.textContent??"").length:he.col);return}if(Se==="INPUT"||Se==="TEXTAREA"||V!=null&&V.isContentEditable||W.ctrlKey||W.altKey)return;if(!!((ct=V==null?void 0:V.closest)!=null&&ct.call(V,".code-tree"))&&!W.metaKey){const se=vte(W.key,p,h.length);if(se!=null){W.preventDefault(),b.current=!1,m(se);return}}const Te=y.current;if(Te){const se=Te.querySelector(".code-row"),he=bte(W.key,{row:se?Math.round(se.getBoundingClientRect().height):19,view:Te.clientHeight,top:Te.scrollTop,max:Te.scrollHeight-Te.clientHeight},{meta:W.metaKey});if(he!=null){W.preventDefault(),Te.scrollTop=he;return}}W.metaKey},re=W=>{const V=W.inputType??"";Ate(V)&&JT()>1&&W.preventDefault()};return window.addEventListener("keydown",C),window.addEventListener("beforeinput",re,!0),()=>{window.removeEventListener("keydown",C),window.removeEventListener("beforeinput",re,!0)}},[h.length,A==null?void 0:A.key,p,ne,G]),w.useEffect(()=>{const C=y.current;if(!C)return;let re=null,W=!1;const V=(le,K)=>{const me=document;return me.caretRangeFromPoint?me.caretRangeFromPoint(le,K):null},Se=le=>{var Oe,Ie,ct,se,he;if(re=null,W=!1,le.button!==0||le.detail>1)return;const K=le.target,me=(Oe=K==null?void 0:K.closest)==null?void 0:Oe.call(K,".code-line");if(le.shiftKey&&T.current&&me){const ve=V(le.clientX,le.clientY),He=T.current;if(ve&&He.line!==me){le.preventDefault(),(ct=(Ie=document.activeElement)==null?void 0:Ie.blur)==null||ct.call(Ie);const tt=ch(He.line,He.col);(se=window.getSelection())==null||se.setBaseAndExtent(tt.node,tt.offset,ve.startContainer,ve.startOffset),N.current=null;return}}if(me){const ve=V(le.clientX,le.clientY);ve&&(re={node:ve.startContainer,offset:ve.startOffset,line:me}),T.current={line:me,col:ve?ow(me,ve.startContainer,ve.startOffset):0},N.current=null;return}T.current=null,N.current=null;const U=(he=K==null?void 0:K.closest)==null?void 0:he.call(K,".code-row"),we=U==null?void 0:U.querySelector(".code-line");we&&(re={node:we,offset:0,line:null},T.current={line:we,col:0})},ye=le=>{var we,Oe,Ie,ct;if(!re||!(le.buttons&1))return;const K=(Oe=(we=document.elementFromPoint(le.clientX,le.clientY))==null?void 0:we.closest)==null?void 0:Oe.call(we,".code-line");if(!K||K===re.line)return;const me=V(le.clientX,le.clientY),U=window.getSelection();!me||!U||(W||(W=!0,(ct=(Ie=document.activeElement)==null?void 0:Ie.blur)==null||ct.call(Ie)),U.setBaseAndExtent(re.node,re.offset,me.startContainer,me.startOffset),le.preventDefault())},De=()=>{re=null},Te=le=>{var he;const K=window.getSelection();if(!K||K.rangeCount===0||K.isCollapsed)return;const me=K.getRangeAt(0),U=Ote(me);if(U.length<2)return;const we=U[0],Oe=U[U.length-1],Ie=U.map(ve=>ve.textContent??"");let ct=we.contains(me.startContainer)?ow(we,me.startContainer,me.startOffset):0,se=Oe.contains(me.endContainer)?ow(Oe,me.endContainer,me.endOffset):Ie[Ie.length-1].length;Ie.length>1&&se===0&&(Ie.pop(),se=Ie[Ie.length-1].length),Ie.length>1&&ct>=Ie[0].length&&(Ie.shift(),ct=0),(he=le.clipboardData)==null||he.setData("text/plain",hte(Ie,ct,se)),le.preventDefault()};return C.addEventListener("mousedown",Se),window.addEventListener("mousemove",ye),window.addEventListener("mouseup",De),document.addEventListener("copy",Te,!0),()=>{C.removeEventListener("mousedown",Se),window.removeEventListener("mousemove",ye),window.removeEventListener("mouseup",De),document.removeEventListener("copy",Te,!0)}},[]),w.useEffect(()=>{o((A==null?void 0:A.path)??null)},[A==null?void 0:A.path]),w.useEffect(()=>{if(!r)return;const C=h.findIndex(re=>re.path===r);C>=0&&(b.current=!1,m(C))},[r,s,h.length]),w.useEffect(()=>{if(!A)return;const C=b.current;if(C&&(b.current=!1),!C){const V=y.current,Se=A.path;if(V&&x.current.get(Se)){E.current=Se;let ye=0,De=0;const Te=()=>{var me;const le=(me=x.current.get(Se))==null?void 0:me.parentElement;if(!V||!le||E.current!==Se){E.current=null;return}const K=le.getBoundingClientRect().top-V.getBoundingClientRect().top;if(Math.abs(K)<=1)De+=1;else{De=0;const U=Math.max(0,V.scrollHeight-V.clientHeight);V.scrollTop=Math.max(0,Math.min(U,V.scrollTop+K))}if(De>=3||(ye+=1)>20){E.current=null;return}requestAnimationFrame(Te)};requestAnimationFrame(Te)}}const re=k.current,W=v.current.get(A.path);if(re&&W){const V=W.getBoundingClientRect(),Se=re.getBoundingClientRect();V.top<Se.top?re.scrollTop+=V.top-Se.top:V.bottom>Se.bottom&&(re.scrollTop+=V.bottom-Se.bottom)}},[A==null?void 0:A.path]);const B=w.useRef([]),J=w.useCallback(()=>{const C=y.current;if(!C)return;const re=C.getBoundingClientRect().top;B.current=h.map(W=>{var Se;const V=(Se=x.current.get(W.path))==null?void 0:Se.parentElement;return V?V.getBoundingClientRect().top-re+C.scrollTop:Number.POSITIVE_INFINITY})},[h]);w.useEffect(()=>{const C=y.current;if(!C)return;let re=0,W=-1;const V=()=>{re||(re=requestAnimationFrame(()=>{if(re=0,C.scrollHeight!==W&&(W=C.scrollHeight,J()),E.current)return;const ye=Nte(B.current,C.scrollTop);m(De=>De===ye?De:(b.current=!0,ye))}))},Se=()=>{E.current=null};return C.addEventListener("scroll",V,{passive:!0}),C.addEventListener("wheel",Se,{passive:!0}),C.addEventListener("touchstart",Se,{passive:!0}),C.addEventListener("mousedown",Se),window.addEventListener("keydown",Se),()=>{C.removeEventListener("scroll",V),C.removeEventListener("wheel",Se),C.removeEventListener("touchstart",Se),C.removeEventListener("mousedown",Se),window.removeEventListener("keydown",Se),re&&cancelAnimationFrame(re)}},[h,J]);const M=m_(n),Q=w.useMemo(()=>new Set(I()),[L,j]);return d.jsxs("div",{className:"code-artifact",children:[d.jsxs("div",{className:"code-file-pick",children:[d.jsx("select",{className:"code-file-picker","aria-label":"File to review",value:(A==null?void 0:A.path)??((ce=h[0])==null?void 0:ce.path)??"",onChange:C=>{b.current=!1,m(h.findIndex(re=>re.path===C.target.value))},children:h.map(C=>d.jsxs("option",{value:C.path,children:[C.path,Q.has(C.path)?" · Unsaved":""]},C.path))}),d.jsx("svg",{className:"code-pick-caret",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:d.jsx("path",{d:"M4 6l4 4 4-4"})})]}),d.jsxs("div",{className:"code-tree",children:[d.jsxs("div",{className:"code-tree-head",children:[d.jsx("span",{className:"code-tree-count",children:p_(n)}),M&&d.jsxs("span",{className:"code-tree-took",children:["in ",M]})]}),d.jsx("div",{className:"code-tree-rows",ref:k,children:f.map(C=>C.kind==="folder"?d.jsxs("button",{type:"button",className:`code-node code-folder${c.has(C.key)?" is-shut":""}`,style:{paddingLeft:12+C.depth*13},onClick:()=>{const re=new Set(c);re.has(C.key)?re.delete(C.key):re.add(C.key);const W=(A==null?void 0:A.path)??null,V=W?HS(a,re).filter(Se=>Se.kind==="file").findIndex(Se=>Se.path===W):-1;V>=0&&V!==p&&m(V),u(re)},children:[d.jsx("svg",{className:"code-caret",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:d.jsx("path",{d:"M6 4l4 4-4 4"})}),d.jsx("span",{className:"code-node-name",children:C.label}),d.jsx("span",{className:"code-node-n",children:C.files})]},C.key):d.jsxs("button",{type:"button",ref:re=>{v.current.set(C.path,re)},className:`code-node code-file${(A==null?void 0:A.path)===C.path?" is-at":""}`,style:{paddingLeft:12+C.depth*13},title:C.path,onClick:()=>{b.current=!1,m(h.findIndex(re=>re.path===C.path))},children:[d.jsx("span",{className:"code-node-name",children:C.label}),Q.has(C.path)?d.jsx("span",{className:"code-unsaved",title:"Not saved yet. Press ⌘S.",children:"•"}):d.jsx(QT,{plus:C.plus,minus:C.minus})]},C.key))})]}),d.jsx("div",{className:"code-body",ref:y,children:l.map(C=>d.jsxs("section",{className:"code-file-block",children:[d.jsxs("div",{className:`code-file-head${(A==null?void 0:A.path)===C.path?" is-at":""}`,ref:re=>{x.current.set(C.path,re)},children:[d.jsx("span",{className:"code-file-name",children:C.path.split("/").pop()}),d.jsx("span",{className:"code-file-where",children:C.path.split("/").slice(0,-1).join("/")}),d.jsx(QT,{plus:C.plus,minus:C.minus}),Q.has(C.path)&&d.jsx("span",{className:"code-file-unsaved",title:"Not saved yet. Press ⌘S.",children:"Unsaved"})]}),d.jsx(Pte,{file:C,pending:$.current.get(C.path)??null,onEdit:ae,onDone:G})]},C.path))})]})}function cv({children:e}){return d.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e})}const zte=()=>d.jsxs(cv,{children:[d.jsx("path",{d:"M14 4.8h5.2V10"}),d.jsx("path",{d:"M19.2 4.8 11.6 12.4"}),d.jsx("path",{d:"M18.4 14.2v3.6a1.6 1.6 0 0 1-1.6 1.6H6.2a1.6 1.6 0 0 1-1.6-1.6V7.2a1.6 1.6 0 0 1 1.6-1.6h3.6"})]}),_te=()=>d.jsxs(cv,{children:[d.jsx("path",{d:"M6.6 6.6 17.4 17.4"}),d.jsx("path",{d:"M17.4 6.6 6.6 17.4"})]});function Fte({doc:e,roots:t,split:n,onSplit:r,onClose:s,onNotice:o,mode:i,onMode:l,headerTarget:a,focusControlStyle:c}){const u=Fa(e.src)??"html",[f,h]=w.useState(null),[p,m]=w.useState(null),[y,x]=w.useState(0),[k,v]=w.useState(null),[b,E]=w.useState(null),[N,T]=BR(b),[A,R]=w.useState(null),[$,L]=w.useState(null);w.useEffect(()=>{let M=!0;return h(null),m(null),v(null),x(0),E(null),R(null),cR(e.src)?(h(e.src),E(e.src),()=>{M=!1}):(q.resolveDoc({product:e.product,src:e.src}).then(Q=>{if(M){if(!Q.ok||!Q.opened){v(Q.error??"That file could not be found.");return}h(Q.opened),E(Q.url??null)}}),u==="code"&&q.codeChange({product:e.product,src:e.src}).then(Q=>{if(M){if(!Q.ok||!Q.change){v(Q.error??"That change could not be read.");return}R(Q.change)}}),u==="markdown"&&q.readDoc({product:e.product,src:e.src}).then(Q=>{if(M){if(!Q.ok){v(Q.error??"That file could not be read.");return}m(Q.text??""),x(Q.mtime??0)}}),()=>{M=!1})},[e.product,e.src,u]);const _=w.useRef(null),[j,F]=w.useState(!1),ae=M=>{var Q;M.preventDefault(),(Q=_.current)==null||Q.setPointerCapture(M.pointerId),F(!0)},G=M=>{var ce,C;if(!j)return;const Q=(C=(ce=_.current)==null?void 0:ce.closest(".body"))==null?void 0:C.getBoundingClientRect();r(Q?TC(M.clientX-Q.left,Q.width):TC(M.clientX,window.innerWidth))},I=M=>{var Q;if(j){try{(Q=_.current)==null||Q.releasePointerCapture(M.pointerId)}catch{}F(!1)}},ne=zR(f??e.src,t),B=()=>{const M=u==="code"?$??e.src:e.src;q.openArtifactExternally({product:e.product,src:M}).then(Q=>{Q.ok||o(Q.error??"That file could not be opened.")})},J=d.jsxs("div",{className:"doc-head",children:[d.jsx("div",{className:"doc-crumb",title:f??e.src,children:ne.map((M,Q)=>d.jsxs("span",{className:"doc-crumb-part",children:[Q>0&&d.jsx("span",{className:"doc-crumb-sep",children:"›"}),d.jsx("span",{className:Q===ne.length-1?"doc-crumb-leaf":void 0,children:M})]},`${M}-${Q}`))}),d.jsxs("span",{className:"doc-marks",children:[l&&(c?d.jsx(O7,{style:c,focused:!!a,onClick:()=>a?s():l("focus")}):!a&&d.jsxs("button",{type:"button",className:"artifact-expand","aria-label":"Expand preview",title:"Expand preview to Focus",onClick:()=>l("focus"),children:[d.jsx(cv,{children:d.jsx("path",{d:"M14 5h5v5M19 5l-6 6M10 19H5v-5M5 19l6-6"})}),d.jsx("span",{children:"Focus"})]})),d.jsx("button",{type:"button",className:"doc-mark",title:u==="code"?"Open this file in your editor":`Open outside ${Le}`,onClick:B,children:c?d.jsx(qk,{kind:"open"}):d.jsx(zte,{})}),d.jsx("button",{type:"button",className:"doc-mark",title:a?"Exit Focus":"Close this document (esc)",onClick:s,children:c?d.jsx(qk,{kind:"close"}):d.jsx(_te,{})})]})]});return d.jsxs("aside",{className:`doc-pane ${u==="html"?"doc-html":u==="code"?"doc-code":u==="image"?"doc-image":"doc-md"}${j?" dragging":""}`,style:{flexBasis:`${n*100}%`},children:[d.jsx("div",{ref:_,className:"doc-grip",role:"separator","aria-orientation":"vertical","aria-label":"Resize the document",onPointerDown:ae,onPointerMove:G,onPointerUp:I,onPointerCancel:I,onDoubleClick:()=>r(Jf)}),d.jsxs("div",{className:"doc-card",children:[a?ki.createPortal(J,a):J,k?d.jsx("div",{className:"doc-missing",children:k}):u==="image"?f?d.jsx("img",{className:"doc-view doc-picture",src:su(f),alt:W3(f),crossOrigin:"anonymous",onError:()=>v("That picture could not be drawn.")}):d.jsx(Wo,{}):u==="code"?A?d.jsx($te,{product:e.product,src:e.src,change:A,startAt:e.at??null,startAtFrom:e.atFrom??0,onFileAt:L,onNotice:o}):d.jsx(Wo,{}):u==="html"?f?b?d.jsxs("div",{className:"preview-frame","aria-busy":!N,children:[d.jsx(Wo,{ready:N}),d.jsx("iframe",{onLoad:T,onError:()=>v("This preview could not be loaded."),style:{opacity:N?1:0},className:"doc-view",src:b,sandbox:"allow-scripts allow-same-origin",title:ne.join("/")},b)]}):d.jsxs("div",{className:"doc-missing",children:["Quit and reopen ",Le," to see this page's pictures."]}):d.jsx(Wo,{}):p===null?d.jsx(Wo,{}):d.jsx(fte,{product:e.product,src:e.src,text:p,mtime:y,onSaved:M=>x(M),onNotice:o},f??e.src)]})]})}const Bte=3e4,Hte=8e3;function Wte(e,t){const n=e[e.length-1];return n?{take:n,rest:e.slice(0,-1),instant:t-n.at<=Bte}:{take:null,rest:[],instant:!1}}function Ute(e,t){return t-e<=Hte}function Vte(e){return`Press Z again to ${e}.`}const Kte="Nothing to undo yet.",qte=new Set(["Shift","Meta","Control","Alt","CapsLock"]),lP="zero.where",Yte=["inbox","snoozed","progress","done"];function aP(e){let t;try{t=JSON.parse(e.getItem(lP)??"null")}catch{return null}if(!t||typeof t!="object")return null;const n=t,s={view:Yte.includes(n.view)?n.view:"inbox"},o=a=>{if(!a||typeof a!="object")return;const c=a;if(!(typeof c.product!="string"||typeof c.id!="string")&&!(!c.product||!c.id))return{product:c.product,id:c.id}},i=o(n.item);i&&(s.item=i),i&&typeof n.scroll=="number"&&Number.isFinite(n.scroll)&&n.scroll>0&&(s.scroll=Math.round(n.scroll));const l=o(n.repeat);if(l&&(s.repeat=l),n.doc&&typeof n.doc=="object"){const a=n.doc;typeof a.product=="string"&&typeof a.src=="string"&&a.product&&a.src&&(s.doc={product:a.product,src:a.src})}return n.settings===!0&&(s.settings=!0),typeof n.search=="string"&&(s.search=n.search),typeof n.row=="string"&&n.row&&(s.row=n.row),s}function Gte(e,t){const n=aP(e);n!=null&&n.item&&(t>0?n.scroll=Math.round(t):delete n.scroll,cP(e,n))}function cP(e,t){try{e.setItem(lP,JSON.stringify(t))}catch{}}function XT(e){return e?e.view!=="inbox"||!!e.item||!!e.repeat||!!e.settings||e.search!==void 0||!!e.row:!1}const Jte=/^(Write|Edit|NotebookEdit)$/,Qte=/write_document$/,Xte=/\.(html?|png|jpe?g|gif|webp|pdf|change)$/i,Zte=/^(sessions|attachments|node_modules|scripts|\.)\//,ene=/^\d\d:\d\d:\d\d {2}(.*)$/;function tne(e){if(!e.startsWith("["))return null;const t=e.indexOf("]");return t<=0?null:{tool:e.slice(1,t),arg:e.slice(t+1).trim()}}function nne(e,t){const n=[...e].filter(Boolean).sort((r,s)=>r.length-s.length);for(const r of n){const s=r.endsWith("/")?r:`${r}/`;if(t.startsWith(s))return t.slice(s.length)}return null}function rne(e,t){const n=t.filter(Boolean),r=[],s=new Set,o=l=>{const a=l.replace(/^\.\//,"").trim();if(!a||!Xte.test(a)||Zte.test(a))return;const c=a.toLowerCase();s.has(c)||(s.add(c),r.push(a))},i=[...e].filter(l=>l&&l.text).sort((l,a)=>l.startedAt-a.startedAt);for(const l of i)for(const a of l.text.split(`
342
+ `)){const c=ene.exec(a);if(!c)continue;const u=tne(c[1]);if(!u||!u.arg)continue;if(Qte.test(u.tool)){o(u.arg);continue}if(!Jte.test(u.tool))continue;const f=nne(n,u.arg);f&&o(f)}return r}const Ox=120,sne=24;function one(e){const t=e.search(/[.!?](\s|$)/);return t>=sne&&t<Ox?e.slice(0,t+1):no(e,Ox)}function uv(e){const t=e.trim(),n=t.split(`
343
+ `),r=(n[0]??"").trim();return r.length<=Ox?{title:r,body:n.slice(1).join(`
344
+ `).trim()}:{title:one(r),body:t}}function ine(e){const t=(e.body??"").trim();if(!t)return e.title;if(t===e.title)return t;const n=uv(t);return n.body===t&&n.title===e.title?t:`${e.title}
345
+ ${t}`}function lne(e,t,n){return e.find(r=>r.slug===n)??t[0]??e[0]??null}function ane(e,t,n){if(!e.length)return null;const r=e.findIndex(o=>o.slug===t),s=r>=0?r:n>0?-1:0;return e[(s+n+e.length)%e.length]??null}const Ix="zero.lastProduct";function Di(e){try{e?localStorage.setItem(Ix,e):localStorage.removeItem(Ix)}catch{}}function ZT(){try{return localStorage.getItem(Ix)}catch{return null}}function cne(e,t,{practiceSlug:n="practice"}={}){if(!t)return!1;const r=e.find(s=>s.slug===t);return r?r.practice===!0:t===n}function une({value:e,choices:t,onChange:n,title:r,onOpenChange:s}){const[o,i]=w.useState(!1),[l,a]=w.useState(0),c=w.useRef(null),u=t,f=u.length>1;if(w.useEffect(()=>{s==null||s(o)},[o]),ud(c,o),w.useEffect(()=>{if(!o)return;a(Math.max(0,u.findIndex(m=>m.id===(e??Ft))));const p=m=>{var y;(y=c.current)!=null&&y.contains(m.target)||i(!1)};return document.addEventListener("pointerdown",p),()=>document.removeEventListener("pointerdown",p)},[o,e]),!f)return null;const h=p=>{n(p===Ft?null:p),i(!1)};return d.jsxs("span",{className:"compose-word-wrap",ref:c,children:[o&&d.jsx("span",{className:"prio-menu model-menu",role:"listbox","aria-label":"Coding agent",children:u.map((p,m)=>d.jsx("button",{role:"option","aria-selected":p.id===(e??Ft),className:`prio-menu-row ${m===l?"cursor":""} ${p.id===(e??Ft)?"on":""}`,onPointerEnter:()=>a(m),onClick:()=>h(p.id),children:d.jsx("span",{className:"prio-menu-label",children:p.label})},p.id))}),d.jsx("button",{type:"button",className:`compose-word ${e?"set":""} ${o?"open":""}`,title:r??"Which coding agent picks this up","aria-haspopup":"listbox","aria-expanded":o,onClick:()=>i(p=>!p),onKeyDown:p=>{if(!o){(p.key==="ArrowUp"||p.key==="ArrowDown"||p.key==="Enter"||p.key===" ")&&(p.preventDefault(),i(!0));return}p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),i(!1)),p.key==="ArrowDown"&&(p.preventDefault(),a(m=>(m+1)%u.length)),p.key==="ArrowUp"&&(p.preventDefault(),a(m=>(m-1+u.length)%u.length)),p.key==="Enter"&&(p.preventDefault(),u[l]&&h(u[l].id))},children:id(e)})]})}const uP="zero.lastEngine";function eA(e,t){return!e||e===Ft?null:(t??[]).some(n=>n.id===e)?e:null}function dne(e=globalThis.localStorage,t=null){const n=t&&qS(t)&&t!==Ft?t:null;try{const r=e==null?void 0:e.getItem(uP);return!r||!qS(r)?n:r===Ft?null:r}catch{return n}}function fne(e,t=globalThis.localStorage){try{t==null||t.setItem(uP,e||Ft)}catch{}}function hne(e){return e.priorityChanged||e.whenSet||e.modelChanged||e.effortChanged}function pne(e){return e.hovered||e.menuOpen||hne(e)}function mne(e){return e.hasProjectClause?"project":"priority"}const gne="Nothing runs in Practice, it is only somewhere to try things out. Pick one of your own projects and this will start.";function yne(e,t={}){return!(e!=null&&e.practice)||t.scripted?null:gne}function wne(e){const t=`Sent to ${e.to}`;return`${e.when?`${t} · ${e.when}`:t} · Z to undo`}const iw="zero.lastProduct",kne=4;function xne({products:e,hidden:t,onSend:n,onReorder:r,onHide:s,onNewProject:o,selectProject:i,engineChoices:l,workspaceEngine:a,codexModels:c,codexModelDefault:u,prefill:f,onClose:h}){const p=new Set(t),[m,y]=w.useState(!1),x=m?e:e.filter(X=>!p.has(X.slug)),k=e.length-e.filter(X=>!p.has(X.slug)).length,[v,b]=w.useState(()=>localStorage.getItem(iw)??""),E=lne(e,x,v),N=X=>{b(X),localStorage.setItem(iw,X)};w.useEffect(()=>{i&&N(i)},[i]);const T=w.useRef(xb()),[A,R]=w.useState(()=>T.current.text),[$,L]=w.useState(()=>T.current.priority??w7()),_=X=>{L(X),k7(X)},j=l??[pi[0]],[F,ae]=w.useState(()=>eA(dne(void 0,a),j)),[G,I]=w.useState(()=>Yg(void 0,F,u??null)),ne=X=>{I(X),IF(X,void 0,F,u??null)},B=X=>{ae(X),fne(X),I(Yg(void 0,X,u??null)),M(ky(void 0,X))},[J,M]=w.useState(()=>ky(void 0,F)),Q=X=>{M(X),I8(X,void 0,F)},ce=lI(F,G,{codexModels:c??[],codexDefault:u??null}),C=aI(J,ce)?J:null,re=w.useRef({prio:$,model:G,engine:F,effort:J});w.useEffect(()=>{const X=eA(F,j);if(X===F)return;const Ke=Yg(void 0,X,u??null),Qe=ky(void 0,X);ae(X),I(Ke),M(Qe),re.current={...re.current,engine:X,model:Ke,effort:Qe}},[j.map(X=>X.id).join(",")]);const[W,V]=w.useState(!1),[Se,ye]=w.useState(!1),[De,Te]=w.useState(!1),[le,K]=w.useState(!1),[me,U]=w.useState(!1),[we,Oe]=w.useState(()=>T.current.attachments),[Ie,ct]=w.useState(0),[se,he]=w.useState(null),[ve,He]=w.useState(()=>{const X=T.current.when;return X.runAt||X.repeat?{runAt:X.runAt,repeat:X.repeat??null}:RE}),tt=ve.repeat,Ct=F0(A),oe=w.useRef(null);w.useEffect(()=>{const X=Ct&&"rule"in Ct?Ct.rule:null;X&&!zh(X,oe.current)&&He({runAt:0,repeat:X}),!X&&oe.current&&zh(tt,oe.current)&&He(RE),oe.current=X},[Ct&&"rule"in Ct?Ct.rule.at:null]);const P=w.useRef(null),ee=w.useRef(null),[Ae,We]=w.useState(!1),Je=w.useRef(null),wt=w.useRef(null),[un,dt]=w.useState(!1),Cn=E==null?void 0:E.name;w.useLayoutEffect(()=>{var Qt;const X=wt.current;if(!X)return;const Ke=()=>dt(X.scrollWidth>X.clientWidth+.5);Ke();let Qe=!0;return(Qt=document.fonts)==null||Qt.ready.then(()=>{Qe&&Ke()}),()=>{Qe=!1}},[Cn]),w.useEffect(()=>{const X=P.current;X&&(X.focus(),X.setSelectionRange(X.value.length,X.value.length))},[]);const Ut=w.useRef(!1);w.useEffect(()=>{if(!f||Ut.current)return;Ut.current=!0;const X=f.title;let Ke=0;const Qe=setInterval(()=>{Ke+=1,R(X.slice(0,Ke));const Qt=P.current;Qt&&Qt.setSelectionRange(Ke,Ke),Ke>=X.length&&(clearInterval(Qe),f.body&&R(`${X}
346
+
347
+ ${f.body}`))},26);return()=>clearInterval(Qe)},[f==null?void 0:f.title]),w.useEffect(()=>{f!=null&&f.product&&b(f.product)},[f==null?void 0:f.product]),w.useEffect(()=>{const X=SI({text:A,attachments:we,priority:$,when:{runAt:ve.runAt,repeat:ve.repeat},dropped:0});ct(X.dropped)},[A,we,$,ve.runAt,ve.repeat]),w.useEffect(()=>{if(!Ae)return;const X=Ke=>{var Qe;(Qe=Je.current)!=null&&Qe.contains(Ke.target)||We(!1)};return document.addEventListener("pointerdown",X),()=>document.removeEventListener("pointerdown",X)},[Ae]);const be=yne(E,{scripted:!!f}),Ye=async()=>{var En;const X=A.trim();if(!X&&!we.length||!E||be)return;const{title:Ke,body:Qe}=uv(X||`Attached: ${(En=we[0])==null?void 0:En.name}`),Qt=await dI(E.slug,we),Ni=[Qe,Qt].filter(Boolean).join(`
348
+
349
+ `);localStorage.setItem(iw,E.slug),await n({product:E.slug,title:Ke,body:Ni||void 0,kind:"directive",priority:$?zI($):5,...tt?{repeat:tt}:{},...ve.runAt&&!tt?{runAt:ve.runAt}:{},...F==="codex"?OF(F,G,u??null)?{model:G}:{}:{model:G??$0},...j.length>1?{engine:F??Ft}:{},...C?{effort:C}:{}})!==!1&&y9()},rt=X=>Ke=>{if(Ke.button!==0)return;const Qe=Ke.currentTarget,Qt=ee.current;if(!Qt)return;const Ar=[...Qt.querySelectorAll(".compose-product")].map(Bt=>Bt.getBoundingClientRect()),En=Qt.getBoundingClientRect(),Ti={x:Ke.clientX,y:Ke.clientY};let qr=!1,jr=X;Qe.setPointerCapture(Ke.pointerId);const Ai=Bt=>{const Ht=Bt<Ar.length?Ar[Bt]:Ar[Ar.length-1];return{x:(Bt<Ar.length?Ht.left-3:Ht.right+3)-En.left,y:Ht.top-En.top,h:Ht.height}},ji=Bt=>{const Ht=Bt.clientX-Ti.x,pe=Bt.clientY-Ti.y;!qr&&Math.hypot(Ht,pe)<kne||(qr=!0,jr=r3(Ar,Bt.clientX,Bt.clientY),he({from:X,to:jr,dx:Ht,dy:pe,caret:Ai(jr)}))},Ps=()=>{var pe,ft;if(Qe.removeEventListener("pointermove",ji),Qe.removeEventListener("pointerup",Ps),Qe.removeEventListener("pointercancel",Ps),he(null),!qr){const ut=x[X];ut&&N(ut.slug),We(!1),(pe=P.current)==null||pe.focus();return}const Bt=x[X],Ht=jr<x.length?x[jr]:null;if(Bt&&(Ht==null?void 0:Ht.slug)!==Bt.slug){const ut=e.map(Me=>Me.slug).filter(Me=>Me!==Bt.slug),Un=Ht?ut.indexOf(Ht.slug):ut.length;ut.splice(Un<0?ut.length:Un,0,Bt.slug),r(ut)}(ft=P.current)==null||ft.focus()};Qe.addEventListener("pointermove",ji),Qe.addEventListener("pointerup",Ps),Qe.addEventListener("pointercancel",Ps)},Jt=d.jsxs("span",{className:"proj-menu",children:[d.jsx("span",{className:"proj-head",children:"Which project"}),d.jsxs("span",{className:"compose-to",ref:ee,children:[x.map((X,Ke)=>d.jsxs("button",{className:["compose-product",X.slug===(E==null?void 0:E.slug)?"active":"",(se==null?void 0:se.from)===Ke?"dragging":"",p.has(X.slug)?"is-hidden":""].filter(Boolean).join(" "),style:(se==null?void 0:se.from)===Ke?{transform:`translate(${se.dx}px, ${se.dy}px)`}:void 0,onPointerDown:rt(Ke),children:[d.jsxs("span",{className:"chip-grip","aria-hidden":"true",children:[d.jsx("i",{}),d.jsx("i",{}),d.jsx("i",{}),d.jsx("i",{}),d.jsx("i",{}),d.jsx("i",{})]}),X.name,d.jsx("span",{className:"chip-hide",role:"button","aria-label":p.has(X.slug)?`Show ${X.name}`:`Hide ${X.name}`,title:p.has(X.slug)?"Show in this list":"Hide from this list",onPointerDown:Qe=>Qe.stopPropagation(),onClick:Qe=>{Qe.stopPropagation(),s(X.slug,!p.has(X.slug))},children:p.has(X.slug)?"+":"×"})]},X.slug)),k>0&&d.jsx("button",{className:`compose-reveal ${m?"on":""}`,onClick:()=>y(X=>!X),children:m?"done":`${k} hidden`}),o&&d.jsx("button",{className:"compose-reveal np-chip-new",onClick:o,children:"+ New project"}),(se==null?void 0:se.caret)&&d.jsx("span",{className:"compose-caret",style:{left:se.caret.x,top:se.caret.y,height:se.caret.h}})]})]}),Kr=(!!A.trim()||we.length>0)&&!be,Ls=x.length>1||!!(E!=null&&E.practice),fr={hovered:W,menuOpen:Ae||Se||De||le||me,priorityChanged:$!==re.current.prio,whenSet:!!(ve.runAt||ve.repeat),modelChanged:G!==re.current.model||F!==re.current.engine,effortChanged:J!==re.current.effort,hasProjectClause:Ls};return d.jsx("div",{className:"modal-backdrop compose-backdrop",onClick:h,children:d.jsxs("div",{className:"modal compose",onClick:X=>X.stopPropagation(),children:[d.jsx("textarea",{ref:P,className:"compose-text",value:A,onChange:X=>R(X.target.value),placeholder:"What do you need done?",onKeyDown:X=>{if(X.key==="Escape"&&h(),(X.metaKey||X.ctrlKey)&&X.key==="Enter"&&Ye(),X.key==="Tab"){X.preventDefault();const Ke=ane(x,(E==null?void 0:E.slug)??"",X.shiftKey?-1:1);Ke&&N(Ke.slug)}},onPaste:async X=>{const Ke=await uI(X);Ke.length&&(X.preventDefault(),Oe(Qe=>[...Qe,...Ke]))},onDragOver:X=>X.preventDefault(),onDrop:async X=>{X.preventDefault();const Ke=await pb(X.dataTransfer.files);Ke.length&&Oe(Qe=>[...Qe,...Ke])}}),d.jsx(OI,{attachments:we,onRemove:X=>Oe(Ke=>Ke.filter((Qe,Qt)=>Qt!==X))}),be&&d.jsx("div",{className:"compose-note refuses",children:be}),tt&&d.jsx("div",{className:"compose-note",children:"The first run is now."}),Ct&&"unreadable"in Ct&&d.jsx("div",{className:"compose-note",children:"Not understood, so this runs once, now."}),Ie>0&&d.jsx("div",{className:"compose-note",children:Ie===1?"One pasted image is too big to save. Closing the card loses it.":`${Ie} pasted images are too big to save. Closing the card loses them.`}),d.jsxs("div",{className:["compose-sentence",pne(fr)?"open":"quiet",`rest-${mne(fr)}`].filter(Boolean).join(" "),onPointerEnter:()=>V(!0),onPointerLeave:()=>V(!1),children:[d.jsxs("span",{className:"compose-clauses",children:[Ls&&d.jsxs(d.Fragment,{children:[d.jsxs("span",{className:"clause clause-project",children:["For ",d.jsxs("span",{className:"compose-word-wrap",ref:Je,children:[Ae&&Jt,d.jsxs("button",{type:"button",ref:wt,className:`compose-word ${Ae?"open":""} ${un?"cut":""}`,"aria-haspopup":"dialog","aria-expanded":Ae,onClick:()=>We(X=>!X),title:(E==null?void 0:E.name)??"Which project this is for",children:[(E==null?void 0:E.name)??"a project",d.jsx("span",{className:"compose-word-stop",children:"."})]})]})]})," "]}),d.jsxs("span",{className:"clause clause-priority",children:[d.jsx(HI,{variant:"word",value:$??rc(5),set:!!$,onChange:_,onOpenChange:ye,title:"Priority"})," priority."]})," ",d.jsxs("span",{className:"clause clause-when",children:[d.jsx(sI,{value:ve,onChange:He,onOpenChange:Te}),"."]})," ",j.length>1&&d.jsxs(d.Fragment,{children:[d.jsxs("span",{className:"clause clause-engine",children:["With ",d.jsx(une,{value:F,choices:j,onChange:B,onOpenChange:U}),"."]})," "]}),d.jsxs("span",{className:"clause clause-model",children:["On ",d.jsx(cI,{value:G,onChange:ne,onOpenChange:K,engine:F,codexModels:c??[],codexDefault:u??null,effort:C,onEffortChange:Q}),"."]})]}),d.jsxs("button",{className:"dock-send",onClick:Ye,disabled:!Kr,title:be??"Start it · ⌘↵",children:["Start it ",d.jsx("kbd",{children:"⌘↵"})]})]})]})})}const bne=["Desktop","Documents","Downloads","Movies","Music","Pictures","Library","Public"],vne=["/","/Applications","/Library","/System","/Users","/Volumes","/private","/tmp","/var","/etc","/usr","/bin","/sbin","/opt","/net","/cores"];function _p(e){const t=String(e??"").trim();return t?t.length>1?t.replace(/\/+$/,""):t:""}function Sne(e,t){const n=_p(t);return n?e===n?"":e.startsWith(`${n}/`)?e.slice(n.length+1):null:null}function Cne(e,{home:t=""}={}){const n=_p(e);if(!n)return{ok:!0};const r=n==="~"||n==="~/"?"":n.startsWith("~/")?n.slice(2):Sne(n,t);return r===""?{ok:!1,reason:"home",say:"That is your whole home folder. Agents would work across everything on this Mac, and macOS will ask you about Downloads, Music and every app you have. Pick the folder your project’s code is in."}:r!==null&&bne.includes(r)?{ok:!1,reason:"guarded",say:`${r} holds a lot more than one project, and macOS guards it, so choosing it means a run of permission panels. Pick the folder inside it that your project’s code is in.`}:vne.includes(n)?{ok:!1,reason:"system",say:`${n} is part of macOS rather than one of your projects. Pick the folder your project’s code is in.`}:/^\/Volumes\/[^/]+$/.test(n)?{ok:!1,reason:"volume",say:`${n} is a whole disk rather than one project. Pick the folder your project’s code is in.`}:{ok:!0}}function Ene(e=[],{home:t="~"}={}){const n=new Map;for(const o of e){const i=_p(o);if(!i)continue;const l=i.lastIndexOf("/");if(l<=0)continue;const a=i.slice(0,l);Cne(a,{home:t}).ok&&n.set(a,(n.get(a)??0)+1)}let r=null,s=0;for(const[o,i]of n)(i>s||i===s&&r&&o.length<r.length)&&(r=o,s=i);return r??`${_p(t)||"~"}/dev`}function Nne(e,t){return!t||!e.startsWith(t)?e:e===t?"~":`~${e.slice(t.length)}`}function dP({startIn:e,onPick:t,onClose:n}){const[r,s]=w.useState(null),[o,i]=w.useState(""),[l,a]=w.useState(!0),c=w.useRef(0),u=w.useCallback(async y=>{const x=++c.current;a(!0);const k=await q.listFolders(y);x===c.current&&(s(k),i(k.at),a(!1))},[]);w.useEffect(()=>{u(e??null)},[u,e]);const f=(r==null?void 0:r.at)??"",h=(r==null?void 0:r.home)??"",p=!!f&&!(r!=null&&r.refused)&&!(r!=null&&r.unreadable),m=()=>{p&&t(f)};return d.jsx("div",{className:"modal-backdrop fp-backdrop",onClick:n,children:d.jsxs("div",{className:"modal fp-card",onClick:y=>y.stopPropagation(),role:"dialog","aria-label":"Choose a folder",onKeyDown:y=>{y.key==="Escape"&&(y.stopPropagation(),n()),(y.metaKey||y.ctrlKey)&&y.key==="Enter"&&m()},children:[d.jsxs("div",{className:"fp-head",children:[d.jsx("button",{className:"fp-up",onClick:()=>(r==null?void 0:r.parent)&&u(r.parent),disabled:!(r!=null&&r.parent)||l,title:"Up one folder",children:"Up"}),d.jsx("div",{className:"fp-field",children:d.jsx("input",{className:"fp-path",value:o,spellCheck:!1,onChange:y=>i(y.target.value),onKeyDown:y=>{y.key==="Enter"&&(y.preventDefault(),u(o))},"aria-label":"Folder path"})})]}),d.jsxs("div",{className:"fp-list",role:"listbox","aria-busy":l,children:[(r==null?void 0:r.unreadable)&&d.jsx("p",{className:"fp-note",children:r.unreadable}),r&&!r.unreadable&&r.folders.length===0&&d.jsx("p",{className:"fp-note",children:"No folders in here."}),r==null?void 0:r.folders.map(y=>d.jsx("button",{className:"fp-row",onClick:()=>void u(y.path),onDoubleClick:()=>t(y.path),children:y.name},y.path))]}),(r==null?void 0:r.refused)&&d.jsx("p",{className:"fp-refused",children:r.refused}),d.jsxs("div",{className:"fp-foot",children:[d.jsx("span",{className:"fp-where",children:f?Nne(f,h):""}),d.jsx("button",{className:"fp-cancel",onClick:n,children:"Cancel"}),d.jsx("button",{className:"fp-use",onClick:m,disabled:!p,children:"Use this folder"})]})]})})}function Tne(e,t="~/dev"){const n=Ane(e);return n?`${t.replace(/\/+$/,"")}/${n}`:null}function Ane(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,40)}function jne(e){return e.replace(/^\/Users\/[^/]+/,"~")}function Mne({onCreate:e,onClose:t,parent:n="~/dev"}){const[r,s]=w.useState(""),[o,i]=w.useState(null),[l,a]=w.useState(!1),[c,u]=w.useState(!1),[f,h]=w.useState(!1),[p,m]=w.useState(null),[y,x]=w.useState(!1),k=w.useRef(null);w.useEffect(()=>{var A;return(A=k.current)==null?void 0:A.focus()},[]);const v=l?null:o??Tne(r,n);w.useEffect(()=>{if(!v){u(!1);return}if(o){u(!0);return}let A=!0;const R=setTimeout(()=>{q.folderExists(v).then($=>{A&&u($)})},160);return()=>{A=!1,clearTimeout(R)}},[v,o]);const b=w.useMemo(()=>v?d.jsxs(d.Fragment,{children:["Its code is in ",d.jsx("span",{className:"np-word",children:jne(v)}),c?".":", a new folder."]}):d.jsxs(d.Fragment,{children:["Its code is in ",d.jsx("span",{className:"np-word",children:"a folder you choose"}),"."]}),[v,c]),E=A=>{m(null),i(A),a(!1),x(!1)},N=async()=>{const{path:A,refused:R,browse:$}=await q.chooseFolder(o??void 0);if($){x(!0);return}if(R){m(R);return}A&&E(A)},T=()=>{!r.trim()||f||(h(!0),Promise.resolve(e({name:r.trim(),repoPath:v})).finally(()=>h(!1)))};return y?d.jsx(dP,{startIn:o??v,onPick:E,onClose:()=>x(!1)}):d.jsx("div",{className:"modal-backdrop compose-backdrop",onClick:t,children:d.jsxs("div",{className:"modal compose np-card",onClick:A=>A.stopPropagation(),children:[d.jsx("input",{ref:k,className:"np-name",value:r,onChange:A=>{s(A.target.value),a(!1),m(null)},placeholder:"What is the project called?",onKeyDown:A=>{A.key==="Escape"&&t(),(A.metaKey||A.ctrlKey)&&A.key==="Enter"&&T(),A.key==="Enter"&&!A.metaKey&&!A.ctrlKey&&(A.preventDefault(),T())}}),d.jsxs("div",{className:"np-sentence",children:[d.jsx("button",{type:"button",className:"np-clauses",onClick:N,title:"Choose the folder",onKeyDown:A=>{(A.key==="Backspace"||A.key==="Delete")&&(A.preventDefault(),i(null),a(!0))},children:b}),d.jsxs("button",{className:"dock-send",disabled:!r.trim()||f,onClick:T,children:["Make it ",d.jsx("kbd",{children:"⌘↵"})]})]}),p&&d.jsx("p",{className:"np-refused",children:p})]})})}const Dx="Practice",Rne="practice",dv={title:"Add a sign-out button to the Practice app.",body:`Practice is a pretend project, not your code and not ${Le}. This one is written for you already.`},Qa=[{kind:"task",title:"Added the sign-in route. Tests green.",body:"Add a sign-in route at /sign-in. Reuse whatever we already have for sessions.",trace:["Reading how auth works here before I touch anything.","[Read] src/server/auth.ts","[Read] src/server/routes.ts","[Grep] createSession","There is already a signed session cookie in here, seven days, refreshed on use. I will reuse it rather than adding tokens, because two ways to be signed in is the bug that follows.","[Write] src/server/routes/sign-in.ts","[Edit] src/server/routes.ts","[Edit] src/server/auth.ts","[Bash] npm test -- auth","Fourteen tests, all green, and nothing else in the suite moved."],result:"I reused the session cookie rather than tokens. Say if you disagree.",agoMs:6*6e4},{kind:"task",title:"Fixed the flaky checkout test.",body:"checkout.spec.ts fails about one run in five on CI and passes every time on my Mac. Find out why.",trace:["[Bash] npx vitest run checkout.spec.ts --repeat 20","Three failures in twenty, every one of them on the same assertion, so it is a race and not the assertion.","[Read] tests/checkout.spec.ts","[Read] tests/fixtures/cart.ts","The fixture writes the cart and returns before the write lands. The test reads it straight away, so on a slow machine it reads an empty cart.","[Edit] tests/fixtures/cart.ts","[Bash] npx vitest run checkout.spec.ts --repeat 40","Forty for forty. I changed the fixture and nothing in the test itself."],result:"It was a race on the fixture. It awaits now. Nothing else changed.",agoMs:14*6e4},{kind:"task",later:!0,title:"The check runs are 40 seconds slower than Monday.",body:"CI got slower this week and nobody changed the workflow. Find out what did it.",trace:["[Bash] gh run list --limit 40 --json databaseId,createdAt,conclusion","Monday it was 2m14s and today it is 2m54s, and the step that grew is the type check rather than the tests.","[Read] .github/workflows/ci.yml","[Read] tsconfig.json","[Bash] npx tsc --noEmit --extendedDiagnostics","The type check now runs over every package instead of the ones that changed, because the project references came out of tsconfig in the pnpm move.","Putting them back means splitting the config per package and re-pointing the workflow. It is about half a day and nothing is broken while it waits."],result:"It is the type check running over every package. The fix is half a day of config, and nothing breaks while it waits.",agoMs:22*6e4},{kind:"question",waiting:!0,title:"Delete 340 lines of dead code?",body:"Have a look for anything in src/ that nothing imports.",trace:["[Bash] npx knip --include files,exports","[Read] src/lib/legacy-client.ts","[Grep] legacy-client","[Read] src/lib/format-old.ts","[Grep] formatOld","Three files, 340 lines. Nothing in src/ imports any of them and nothing in tests/ does either.","The legacy client is the one I would ask about: it is the only thing left that speaks to the v1 API, so if anything outside this repository still calls that, deleting it is the end of it."],result:["Nothing imports any of the three, so this is safe on my side, but the legacy client is the last thing that speaks v1 and I would rather you said so.","","## Options","1. Delete all three (recommended)","2. Keep the legacy client, delete the other two","3. Leave all of it alone"].join(`
350
+ `),agoMs:31*6e4}],Ma={step:"welcome",folder:null,name:"",product:null,practice:null,item:null,sentAt:null,examples:[]};function One(e){return{...Ma,tutorial:!0,step:"hand",product:e}}function Ine(e){return e!=null&&e.tutorial?"end":"done"}function Dne(e,t){switch(t.t){case"start":return e.step==="welcome"?{...e,step:"folder"}:e;case"folder":return{...e,folder:t.path,name:!e.name||e.folder&&e.name===tA(e.folder)?tA(t.path):e.name};case"name":return{...e,name:t.name};case"made":return{...e,product:t.product,step:"inbox"};case"practice":return{...e,practice:t.product,examples:t.examples,step:"make"};case"sent":return{...e,item:t.item,sentAt:t.at,step:"working"};case"answered":return e.step==="working"?{...e,step:"open"}:e;case"staged":return{...e,examples:t.examples,step:"clear"};case"finish":return{...e,step:"landed"}}}function Vs(e,t){return{...e,step:t}}function Lne(e){return e==="folder"?"welcome":e==="name"?"folder":null}function tA(e){return(e.replace(/\/+$/,"").split("/").pop()??"").replace(/[-_.]+/g," ").trim().replace(/\s+/g," ").split(" ").map(n=>n&&n[0].toUpperCase()+n.slice(1)).join(" ")}function Pne(e,{home:t="",max:n=6}={}){const r=new Map,s=t.replace(/\/+$/,"");for(const o of e){const i=String(o.folder??"").replace(/\/+$/,"");if(!i||i===s||i==="/")continue;const l=o.source==="codex"?"codex":"claude",a=r.get(i);if(a){a.when=Math.max(a.when,o.when??0),a.via.includes(l)||a.via.push(l);continue}r.set(i,{folder:i,name:i.split("/").pop()??i,short:o.short||fP(i,t),when:o.when??0,via:[l]})}return[...r.values()].sort((o,i)=>i.when-o.when).slice(0,n)}function fP(e,t){const n=(t??"").replace(/\/+$/,"");return n&&e.startsWith(n+"/")?"~"+e.slice(n.length):e}function nA(e){return e.forced?!0:!e.done&&e.products===0}const $ne=dv.title,zne=dv.body,_ne=15e3,Fne="first-run",Bne=2e3;function rA(e,t){if(!t||t.step==="landed")return e;if(t.step==="done")return[];if(t.step==="clear"||t.step==="snooze"||t.step==="unblock"){const n=new Set(t.examples);return e.filter(r=>n.has(r.id))}if(t.step==="where"){const n=new Set([...t.examples,t.item].filter(Boolean));return e.filter(r=>n.has(r.id))}return e.filter(n=>n.id===t.item)}function Hne(e){return e.findIndex(t=>t.waiting)}function Wne(e){return e.findIndex(t=>t.later)}function Une(e,t,n,r){if(!t||!t.examples.length)return!1;const s=new Set(e.map(o=>o.id));return!t.examples.some((o,i)=>i!==n&&i!==r&&s.has(o))}function Vne(e,t,n,r){if(!t)return[];const s=new Set(e.map(o=>o.id));return t.examples.filter((o,i)=>i!==n&&i!==r&&s.has(o))}function Bm(e,t){return!e||t<0?null:e.examples[t]??null}function Kne(e,t,n){const r=Bm(t,n);return r?!e.some(s=>s.id===r):!1}function Hm(e,t){return!e||t<0?null:e.examples[t]??null}const hP="That one is an agent stopped, waiting on you. Open it and answer it.";function lw(e,t,n,r){return!e||e.step==="landed"?null:t===Hm(e,n)?hP:t===Bm(e,r)?"That one is not finished. Press S to deal with it later.":null}function qne(e,t,n){return!e||e.step==="landed"?null:t===Hm(e,n)?hP:null}function Yne(e,t,n,r,s,o={}){if(!t)return[];const i=new Set(n.map(a=>a.id)),l=a=>a&&i.has(a)?[a]:[];return e==="clear"?Vne(n,t,r,s):e==="snooze"?o.picking?[]:l(Bm(t,s)):e==="unblock"?o.opened?[]:l(Hm(t,r)):[]}function Gne(e,t){return!e.length||!t?!1:!e.includes(t)}function Jne(e,t){if(!t||!t.examples.length)return!1;const n=new Set(e.map(r=>r.id));return!t.examples.some(r=>n.has(r))}const Ee={head:"Run dozens of coding agents from one inbox.",headSub:"Works with Claude Code and Codex.",terms:"Get started means you agree to the terms and the privacy policy.",getStarted:"Get started",page:"Set up your first project.",folderQ:"Where is your code?",folderPick:"Choose a folder on this Mac",folderClause:"This is the folder the agents will run in.",folderAgain:"Choose a different one",folderHead:"Which project should your agents work on first?",folderLede:"Pick its folder. Your agents run inside it.",folderRecent:"Where you have run agents recently",folderOther:"Choose another folder",folderFirst:"Choose a folder",folderVia:{claude:"Claude Code",codex:"Codex"},nameIn:"Agents will work in",nameChange:"Change",nameGo:"Continue",missing:`${Pn} could not find Claude Code on this Mac, and your agents run on it.`,missingLink:"Get Claude Code",nameQ:"What is this project called?",nameClause:"Taken from the folder. Change it to anything you like.",next:"Next",takenName:e=>`You already have a project called ${e}. Give this one another name.`,emptyName:"A project needs a name with letters or numbers in it.",notMade:e=>`${Pn} could not make the project. ${e}`,submit:"Submit",back:"Back",lookQ:`Pick how ${Le} looks.`,lookMore:"Randomize my theme",lookClause:"Press ⌘K and type theme to change it later.",lookGo:"Next",intro:[{head:"All your Claude Code and Codex agents report to one inbox",line:"Each agent writes back here the moment it finishes or gets stuck",piece:"list"},{head:"You only see an agent when it needs you",line:"The rest keep working in In progress until they finish or have a question",piece:"progress"},{head:"So one person can run dozens of agents at once",line:"No terminals to watch and no tabs to check",piece:"empty"}],pieceEmpty:"Nothing is waiting on you.",pieceAgents:"Active agents",introOn:(e,t)=>`${e} of ${t}`,introNext:"Next",handHead:"This is the tutorial.",handLine:"Nothing in here is your code and nothing you do in here is saved. Your own project is made already and it is waiting behind this.",handGo:"Start the tutorial",leave:"Skip",leaveHead:"Stay for the walk?",leaveLine:`It is the quickest way to pick up the few keys ${Le} runs on, and it is the only place they are shown to you. You can leave now and start it again whenever you like from ⌘K.`,leaveStay:"Keep going",leaveGo:"Skip it",offerHead:"Take the tutorial first?",offerLine:`A pretend project with pretend work in it, and the few keys ${Le} runs on. Nothing in it is your code and nothing in it is kept.`,offerGo:"Start the tutorial",offerNot:"Not now",offerLater:"Any time: press ⌘K and type tutorial.",bandTag:"Tutorial",band:"Nothing in here is yours and nothing is saved.",bandLine:"nothing in here is real",bringHead:"Add the agents already on this Mac.",agentsOffer:`${Pn} watches them and puts what they send you in your inbox.`,agentsFrom:e=>`Read from ${e}`,agentsAll:"Every project",agentsHere:"Only this project",agentsNoneAll:"No agents in your home folder yet. Anything you put there works in every project.",agentsNoneHere:"No agents in this project folder yet. Anything you put there works here only.",agentsRead:`Each one you keep lands in your inbox. ${Pn} never moves the file.`,finishHead:"You are ready to get started.",finishLine:"Your inbox is empty and no agent is waiting on you.",finishLineAgents:"Getting your inbox back to empty is the goal.",finishGo:"Open my inbox",gateHead:`${Pn} needs Claude Code.`,gateDo:`Install it, then check again. Your inbox opens as soon as ${Le} can see it.`,gateCheck:"Check again",gateChecking:"Looking",gateStill:"Still nothing here. A fresh install can take a moment to appear."};function Qne(e,t){return e.missing?{show:!0,blocked:!0,go:!1,head:Ee.gateHead,line:Ee.missing}:t.read?{show:!0,blocked:!1,go:!0,head:Ee.bringHead,line:Ee.agentsOffer}:{show:!1,blocked:!1,go:!1,head:"",line:""}}function sA(e){return!e.missing}const pn=(e,t,n=null,r="",s={})=>({quiet:e,lead:t,key:n,tail:r,...s}),Xne=["inbox","progress","done"];function Lx(e,t){const n=e!=null&&e.length?e:Xne;return n[(n.indexOf(t??"inbox")+1)%n.length]}const Zne={inbox:" to come back.",snoozed:" for the one you put off.",progress:" for the agent you answered.",done:" for everything you closed."};function pP(e,t,n={}){switch(e){case"make":return pn("A task is a job you hand to an agent.","Press ","N"," to write your first one.");case"task":return pn("","Press ","⌘↵"," to start it.");case"working":return t>=_ne?pn("Your agent is running.","Still reading. A bigger project takes longer than this one, and the answer will be here when it comes."):pn("Your agent is running.","It comes back in a few seconds.");case"open":return pn("Your agent worked on its own, and this row is what it sent back.","Press ","↵"," to open it.");case"answer":return pn("Every task ends one of two ways.","Reply to it, or press ","E"," to close it.");case"clear":return pn(n.left===1?"This one is finished too.":"This one is finished. Z brings back anything you close.","Press ","E"," to close it.",{caps:2});case"snooze":return n.picking?pn("Pick when it should come back.","It leaves your inbox until then and comes back on its own."):pn("Real work, but not for today. An empty inbox is the goal.","Press ","S"," to deal with it later.");case"unblock":return n.opened?pn("Your agent gave you three answers to pick from.","Press ","1"," to send the one it recommends."):pn("An agent is stopped here. Closing it leaves it stopped for good.","Press ","↵"," to open it.");case"where":{const r=tre(n.tabs??[],Lx(n.tabs,n.view)),s=Zne[Lx(n.tabs,n.view)]??" for the next one.";return n.view==="snoozed"?pn("The one you put off is here, and it comes back on its own.","Press ",r,s):n.view==="progress"?pn("The agent you answered is here, working without you.","Press ",r,s):n.view==="done"?pn("Everything you finished is kept here.","Press ",r,s):pn("Great! Your inbox is now empty. That is inbox zero, and it is the goal.","Press ",r," to see where it all went.")}case"command":return n.palette?pn(`Every command in ${Le} is in this list.`,"Press ","esc"," to close it."):pn("Everything you just did is one key away. So is this: type tutorial.","Press ","⌘K"," then make your first real task.");default:return null}}const oA=4e3;function Fp(e){const t=e.key??"";if(e.metaKey&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&/^[1-4]$/.test(t))return`⌘${t}`;const n=!!e.metaKey||!!e.ctrlKey;return n&&t==="Enter"?"⌘↵":n&&t.toLowerCase()==="k"?"⌘K":n?null:t==="Enter"?"↵":t==="Tab"?"⇥":t.length===1&&/[a-z0-9]/i.test(t)?t.toUpperCase():null}const ere={"⇥":"Tab","⌘1":"Command–1","⌘2":"Command–2","⌘3":"Command–3","⌘4":"Command–4","↵":"Return"};function tre(e,t){const n=e.indexOf(t);return n>=0&&n<4?`⌘${n+1}`:"⌘1"}function nre(e){return e?ere[e]??null:null}function mP(e,t){if(!e)return!1;const n=Fp(t);return n!==null&&n!==e}const rre='input, textarea, [contenteditable="true"], [contenteditable=""], .fr-stay-scrim';function Bp(e){const t=e;return!t||typeof t.closest!="function"?!0:!t.closest(rre)}const sre="⇥";function ore(e,t,n){return!Bp(n)||!mP(e,t)?!1:Fp(t)!==sre}const ire=".fr-tether, .fr-ring, .fr-veil, .fr-band, .fr-out",lre={unblock:[".focus-dock"]};function are(e,t){const n=e;if(!n||typeof n.closest!="function"||!Bp(n)||n.closest(ire))return!1;const r=t.filter(s=>!!s);return r.length?!r.some(s=>s===n||typeof s.contains=="function"&&s.contains(n)):!1}const iA=["pointerdown","mousedown","mouseup","click","dblclick"],gP=["make","task","working","open","answer","clear","snooze","unblock","where","command"],Ql={make:['button[aria-label="New task"]'],task:[".modal.compose .dock-send"],working:[".list-pane .row"],open:[".list-pane .row"],answer:[".focus-dock .dock-card",".focus-dock"],clear:[".list-pane .row"],snooze:[".modal.snooze .palette-list",".list-pane .row"],unblock:[".opt-strip",".list-pane .row"],where:[".workspace-navigation .workspace-tabs",".tabs"],command:[".modal.palette",'button[aria-label="Commands"]']},lA={clear:".list-pane .row:last-of-type",snooze:".list-pane .row:last-of-type"};function cre(e,t){const n=t.filter(o=>o.w>0&&o.h>0&&o.position!=="absolute"&&o.position!=="fixed");if(!n.length)return e;const r=Math.min(...n.map(o=>o.x)),s=Math.min(...n.map(o=>o.y));return{x:r,y:s,w:Math.max(...n.map(o=>o.x+o.w))-r,h:Math.max(...n.map(o=>o.y+o.h))-s}}const yP=6,ure=14,dre=.34;function wP(e){const t=Math.min(e.w,e.h);return Math.max(yP,Math.min(ure,Math.round(t*dre)))}function fre(e,t){let n=1/0;for(const r of t){const s=Math.max(e.x-(r.x+r.w),r.x-(e.x+e.w)),o=Math.max(e.y-(r.y+r.h),r.y-(e.y+e.h)),i=Math.max(s,o);i<0||(n=Math.min(n,i/2))}return n}const hre=12,pre=6,mre=.26;function gre(e){const t=Math.min(e.w,e.h);return Math.max(pre,Math.min(hre,Math.round(t*mre)))}const Hp=18,yre=360,wre=180,kre=220,Wp=22;function xre(e,t,n,r=1/0){const s=Math.max(yP,Math.min(wP(e),Math.floor(r))),o=Math.round(e.x-s),i=Math.round(e.y-s),l=Math.round(e.w+s*2),a=Math.round(e.h+s*2),c=e.x+e.w>n.w-kre,u=Math.round(e.x),f=Math.min(t.right,n.w),h=c?e.x+e.w:f-u-32,p=Math.max(wre,Math.min(yre,h)),m=i+a+Hp,y=m+Wp*2+16<=n.h,x=y?m:Math.round(i-Hp-Wp);return{ring:{x:o,y:i,w:l,h:a,r:gre({w:l,h:a})},text:{x:u,y:x,w:p,right:c?Math.round(n.w-(e.x+e.w)):null},below:y}}function bre(e,t,n,r){const s=n.filter(i=>i.bottom>e&&i.top<e+t);if(!s.length)return e;const o=Math.round(Math.max(...s.map(i=>i.bottom))+10);return o+t>r.h?e:o}const vre={task:"body",working:".list-pane",open:".list-pane",clear:".list-pane",snooze:".list-pane",answer:".focus-pane"},Up=10,Sre=".list-pane .row, .dock-card, .modal, .focus-actions",Wm="zero.firstRun",fv="zero.firstRun.done";function Cre(e,t){return typeof e=="string"&&fl.includes(e)?e:e==="note"?"clear":t?"landed":"welcome"}function Ere(e){try{const t=e.getItem(Wm);if(!t)return Ma;const n=JSON.parse(t);return{...Ma,...n,step:Cre(n.step,!!n.product)}}catch{return Ma}}function Nre(e,t){try{e.setItem(Wm,JSON.stringify(t))}catch{}}function Tre(e){try{e.setItem(fv,"1"),e.removeItem(Wm)}catch{}}function aA(e){try{return e.getItem(fv)==="1"}catch{return!1}}function Are(e){try{e.removeItem(fv),e.removeItem(Wm)}catch{}}const fl=["welcome","folder","name","inbox","away","goal","look","hand","make","task","working","open","answer","clear","snooze","unblock","where","command","done","landed"];function jre(e){const t=fl.indexOf(e);return t<0||t+1>=fl.length?null:fl[t+1]}function Mre(e){const t=fl.indexOf(e),n=fl.indexOf("look");return t>=0&&n>=0&&t<n}const Rre={inbox:0,away:1,goal:2},Ore=["make","task","working","open","answer","clear","snooze","unblock","where","command"];function hv(e){return!!e&&!!e.practice&&Ore.includes(e.step)}function Ire(e){return e?e==="1"?"welcome":fl.includes(e)?e:null:null}function Um(e){return e.user.length+e.project.length>0}function Dre(e){return!e||!Um(e)}function Lre(e,t){return t||e&&Um(e)?e:null}function Pre(e,t){return!e||Um(t)}function $re(e,t){return t||e&&e.some(n=>n.count>0)?e:null}function cA(e,t){const n=String(e??"").trim();if(/already exists/i.test(n))return Ee.takenName(t);if(/needs a name/i.test(n))return Ee.emptyName;const r=n.replace(/^Error invoking remote method '[^']*':\s*/i,"").replace(/^Error:\s*/i,"");return Ee.notMade(r?/[.!?]$/.test(r)?r:`${r}.`:"It did not say why.")}function uA(e,{filter:t=null,last:n=null}={}){var s;const r=o=>!!o&&e.some(i=>i.slug===o);return r(t)?t:r(n)?n:((s=e[0])==null?void 0:s.slug)??null}function kP(e,t){var n;return((n=e.find(r=>r.slug===t))==null?void 0:n.repoPath)??null}function Px(e,t){var n;return((n=e.find(r=>r.slug===t))==null?void 0:n.name)??""}function zre(e){return(e??"").replace(/^\/Users\/[^/]+/,"~")}const _re=["no","One","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten"],es=e=>e>=0&&e<=10?_re[e]:String(e),ks={head:"Add the agents already on this Mac.",noProject:"Make a project first, and your agents can land in its inbox.",newProject:"New project…",headNone:"No agents to bring across yet.",noneWhere:e=>`Nothing in ${e}, and nothing in any folder you work in.`,noneLater:"When you have some, press ⌘K and type import.",lookAgain:"Look again",looking:"Looking",foot:"Each one you keep lands in your inbox, and your agent files stay where they are.",go:"Add them",reading:"Reading this Mac…"};function go(e){return[...e.items.map(t=>t.path),...(e.threads??[]).map(t=>t.path)]}function Vm(e,t){const n=t?new Set(t):null;let r=0,s=0;for(const o of e)r+=o.items.filter(i=>!n||n.has(i.path)).length,s+=(o.threads??[]).filter(i=>!n||n.has(i.path)).length;return{agents:r,threads:s}}function pv({agents:e,threads:t}){const n=(r,s)=>`${es(r).toLowerCase()} ${s}${r===1?"":"s"}`;return e&&t?`${n(e,"agent")} and ${n(t,"thread")}`:t?n(t,"thread"):n(e,"agent")}function Fre({found:e,folders:t=[],products:n=[],project:r=null,threads:s=[]}){const o=[],i=Px(n,r),l=kP(n,r);e!=null&&e.user.length&&o.push({key:"everywhere",kind:"everywhere",name:i,slug:r,folder:null,where:Js.homeFolder,items:e.user,threads:[]}),e!=null&&e.project.length&&r&&o.push({key:`project:${r}`,kind:"project",name:i,slug:r,folder:l,where:zre(l),items:e.project,threads:[]});const a=n.map(f=>f.name);for(const f of Hre(t,n)){const h=hA(f,a);a.push(h),o.push({key:`new:${f.folder}`,kind:"new",name:h,slug:null,folder:f.folder,where:f.short,items:f.agents??[],threads:[]})}const c=new Map(o.filter(f=>f.folder).map(f=>[aw(f.folder),f])),u=new Map(n.filter(f=>f.repoPath).map(f=>[aw(f.repoPath),f]));for(const f of s){const h=aw(f.folder);if(!h)continue;let p=c.get(h);if(!p){const m=u.get(h),y=m?{key:`project:${m.slug}`,kind:"project",name:m.name,slug:m.slug,folder:f.folder,where:f.short,items:[],threads:[]}:{key:`new:${f.folder}`,kind:"new",name:hA({name:f.folderName},a),slug:null,folder:f.folder,where:f.short,items:[],threads:[]};m||a.push(y.name),o.push(y),c.set(h,y),p=y}p.threads.push(f)}return o}const aw=e=>String(e??"").replace(/\/+$/,""),Js={everywhere:"Every project",homeFolder:"~/.claude/agents",landBefore:"They work everywhere, so their rows go to",landAfter:".",landNowhere:"They work everywhere. Make a project and they have an inbox.",newBadge:"New project",n:e=>String(e.length)};function dA({added:e=0,already:t=0,name:n="",inboxes:r=1,made:s=[],noun:o="agent"}){if(e===0&&t===0)return"Nothing was ticked, so nothing was filed.";const i=r>1,l=n?` ${n}`:"";if(e===0)return i?t===1?`That ${o} already has a row.`:`${es(t)} of them already have rows.`:t===1?`That ${o} already has a row in${l}.`:`${es(t)} of them already have rows in${l}.`;const a=e===1?"One row is":`${es(e)} rows are`,c=i?`${a} in ${es(r).toLowerCase()} inboxes.`:`${a} in your ${s.length===1?"new ":""}${n} inbox.`,u=i&&s.length?s.length===1?` ${s[0]} is new.`:` ${es(s.length)} of them are new.`:"";if(t===0)return`${c}${u}`;const f=t===1?" One already had one.":` ${es(t)} already had rows.`;return`${c}${f}${u}`}function Bre({read:e,picked:t,dests:n}){if(!e||t.length===0)return!1;const r=new Set(t);for(const s of n)if(go(s).some(o=>r.has(o))&&s.kind!=="new"&&!s.slug)return!1;return!0}function fA(e,t,n){const r=new Set(t);return r.has(n)?r.delete(n):r.add(n),e.flatMap(go).filter(s=>r.has(s))}function hA(e,t=[]){const n=((e==null?void 0:e.name)??"").trim();if(!n)return"";const r=/[A-Z\s]/.test(n)?n:n.replace(/[-_.]+/g," ").split(" ").filter(Boolean).map(o=>o.replace(/^\w/,i=>i.toUpperCase())).join(" "),s=new Set(t.map(cw));if(!s.has(cw(r)))return r;for(let o=2;o<100;o+=1)if(!s.has(cw(`${r} ${o}`)))return`${r} ${o}`;return r}function cw(e){return(e??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,40)}function Hre(e,t){const n=new Set(t.map(r=>(r.repoPath??"").replace(/\/+$/,"")).filter(Boolean));return e.filter(r=>!n.has(r.folder.replace(/\/+$/,"")))}const Mf={pick:"Choose which ones",pickWhy:"Pick a whole project, or single agents inside it.",never:`${Pn} never moves your agent files.`};function Wre(e){const t=Vm(e);return t.agents+t.threads===1?`Add the one ${t.threads?"thread":"agent"}`:`Add all ${pv(t)}`}function Ure(e,t){const n=go(e);if(n.length===0)return"none";const r=new Set(t),s=n.filter(o=>r.has(o)).length;return s===0?"none":s===n.length?"all":"some"}function Vre(e,t,n){const r=e.find(l=>l.key===n);if(!r)return t;const s=new Set(t),o=go(r),i=o.some(l=>s.has(l));for(const l of o)i?s.delete(l):s.add(l);return e.flatMap(go).filter(l=>s.has(l))}function pA(e){return e.flatMap(go)}function Kre(e){const t=Vm(e),n=e.length;if(t.agents+t.threads===0)return"";const r=pv(t),s=`${es(n).toLowerCase()} folder${n===1?"":"s"}`;return`${r[0].toUpperCase()}${r.slice(1)} in ${s}.`}function qre(e,t){return t.length===0?"Nothing ticked":`Add ${pv(Vm(e,t))}`}function Yre(e,t){const n=new Set(t);return e.filter(r=>r.kind==="new"&&go(r).some(s=>n.has(s))).map(r=>r.name)}function mA(e,t){const n=new Set(t),r=e.filter(l=>go(l).some(a=>n.has(a))).length,s=Yre(e,t);if(r===0)return"";const o=r===1?"":`${Pn} files them under ${es(r).toLowerCase()} projects.`,i=s.length===0?"":s.length===1?`${s[0]} becomes a new project.`:`${es(s.length)} of them become new projects.`;return[o,i].filter(Boolean).join(" ")}function Gre(e,t=Date.now()){const n=new Date(Number(e)||0);if(!Number.isFinite(n.getTime())||!e)return"";const r=o=>new Date(o.getFullYear(),o.getMonth(),o.getDate()).getTime(),s=Math.round((r(new Date(t))-r(n))/864e5);return s<=0?"today":s===1?"yesterday":s<7?`on ${n.toLocaleDateString("en-US",{weekday:"long"})}`:""}function Jre(e){return e==="codex"?"in Codex":e==="desktop"?"in the Claude Code desktop app":"in a terminal"}function Qre(){return d.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:d.jsx("path",{d:"M4 12.5 9.5 18 20 6.5"})})}function Xre(){return d.jsx("svg",{className:"ia-caret",width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:d.jsx("path",{d:"M9 5.5 16.5 12 9 18.5"})})}function xP({products:e,filter:t,walk:n,onDone:r,onNewProject:s,onProjectMade:o,onClose:i}){const l=(()=>{try{return localStorage.getItem("zero.lastProduct")}catch{return null}})(),[a,c]=w.useState(()=>uA(e,{filter:t,last:l})),[u,f]=w.useState(null),[h,p]=w.useState([]),[m,y]=w.useState(!1),[x,k]=w.useState(!1),[v,b]=w.useState(n?n.folders:null),[E,N]=w.useState(null),[T,A]=w.useState([]),[R,$]=w.useState("door"),[L,_]=w.useState([]),j=w.useMemo(()=>[...e,...T.filter(oe=>!e.some(P=>P.slug===oe.slug))],[e,T]),F=kP(j,a),ae=Px(j,a);w.useEffect(()=>{if(a&&j.some(P=>P.slug===a))return;const oe=uA(j,{filter:t,last:l});oe&&oe!==a&&c(oe)},[j,t,l,a]);const G=n==null?void 0:n.folders;w.useEffect(()=>{if(n){b(G??null);return}let oe=!0;return(async()=>{const P=await q.agentFolders();oe&&b(P)})(),()=>{oe=!1}},[n,G]),w.useEffect(()=>{let oe=!0;return(async()=>{const P=await q.agentThreads();oe&&N(P)})(),()=>{oe=!1}},[]),w.useEffect(()=>{let oe=!0;return f(null),(async()=>{const P=await q.agentFiles({folder:F,product:a});oe&&f({user:P.user,project:P.project})})(),()=>{oe=!1}},[F,a]);const I=w.useMemo(()=>Fre({found:u,folders:v??[],products:j,project:a,threads:E??[]}),[u,v,j,a,E]),ne=w.useMemo(()=>new Set(h),[h]),B=I.length>0,J=!!u&&!!v&&E!==null,M=Bre({read:J,picked:h,dests:I}),[Q,ce]=w.useState(!1),C=w.useCallback(async()=>{if(!Q){ce(!0);try{const[oe,P]=await Promise.all([q.agentFiles({folder:F,product:a}),q.agentFolders()]);f({user:oe.user,project:oe.project}),b(P)}finally{ce(!1)}}},[Q,F,a]),re=w.useCallback(async oe=>{if(!(m||oe.length===0)){y(!0);try{const P=new Set(oe),ee=new Map,Ae=[];for(const be of I){const Ye=be.items.filter(Jt=>P.has(Jt.path)).map(Jt=>Jt.name),rt=(be.threads??[]).filter(Jt=>P.has(Jt.path)).map(Jt=>Jt.id);if(!(!Ye.length&&!rt.length)){if(be.kind==="new"&&be.folder)Ae.push({folder:be.folder,name:be.name,load:{names:Ye,ids:rt}});else if(be.slug){const Jt=ee.get(be.slug)??{names:[],ids:[]};ee.set(be.slug,{names:[...Jt.names,...Ye],ids:[...Jt.ids,...rt]})}}}let We=0,Je=0,wt=0,un="";const dt=[],Cn=async(be,Ye)=>{if(Ye.names.length){const rt=await q.importAgents({product:be,agents:Ye.names});We+=rt.added,Je+=rt.already}if(Ye.ids.length){const rt=await q.importThreads({product:be,threads:Ye.ids});We+=rt.added,Je+=rt.already}wt+=1};for(const[be,Ye]of ee)await Cn(be,Ye),un=Px(j,be);for(const be of Ae){let Ye=null;try{const rt=await q.createProduct({name:be.name,repoPath:be.folder});Ye=(rt==null?void 0:rt.slug)??null}catch{Ye=null}Ye&&(dt.push(be.name),A(rt=>[...rt,{slug:Ye,name:be.name,repoPath:be.folder}]),o==null||o(Ye),await Cn(Ye,be.load),un=be.name)}const Ut=Vm(I,oe);r({added:We,already:Je,name:wt===1?un:"",inboxes:wt,made:dt,noun:Ut.agents?"agent":"thread"})}finally{y(!1)}}},[m,I,j,r,o]),W=w.useCallback(()=>re(pA(I)),[re,I]);w.useEffect(()=>{const oe=P=>{if(P.key==="Escape"){if(P.preventDefault(),x){k(!1);return}if(R==="pick"){$("door");return}if(n)return;i();return}if(P.key==="Enter"&&(P.metaKey||P.ctrlKey)){if(P.preventDefault(),n&&!B){n.onSkip();return}R==="door"?W():M&&re(h)}};return window.addEventListener("keydown",oe),()=>window.removeEventListener("keydown",oe)},[re,W,h,x,M,R,B,n,i]);const V=w.useRef(null),[Se,ye]=w.useState(0),De=w.useCallback(()=>{const oe=V.current;if(!oe){ye(0);return}const P=oe.getBoundingClientRect(),ee=[...oe.querySelectorAll("[data-sec]")];ye(ee.filter(Ae=>Ae.getBoundingClientRect().top+10>P.bottom).length)},[]);w.useEffect(()=>{De()});const Te=Se>0&&d.jsxs("button",{className:"ia-more",onClick:()=>{const oe=V.current;oe&&oe.scrollBy({top:oe.clientHeight-44,behavior:"smooth"})},children:[es(Se)," more below"]}),le=Kre(I),K=oe=>Ure(oe,h),me=oe=>p(Vre(I,h,oe.key)),U=oe=>L.includes(oe),we=oe=>_(P=>P.includes(oe)?P.filter(ee=>ee!==oe):[...P,oe]),Oe=oe=>oe.kind==="everywhere"?Js.everywhere:oe.name,Ie=mA(I,h),ct=({s:oe})=>d.jsxs("span",{className:`ia-box is-${oe}`,"aria-hidden":"true",children:[oe==="all"&&d.jsx(Qre,{}),oe==="some"&&d.jsx("span",{className:"ia-half"})]}),se=oe=>{const P=ne.has(oe.path);return d.jsxs("button",{className:P?"ia-agent on":"ia-agent","aria-pressed":P,onClick:()=>p(fA(I,h,oe.path)),children:[d.jsx(ct,{s:P?"all":"none"}),d.jsxs("span",{className:"ia-agent-text",children:[d.jsx("span",{className:"ia-agent-name",children:oe.title}),oe.line&&d.jsx("span",{className:"ia-agent-line",children:oe.line})]})]},oe.path)},he=oe=>{const P=ne.has(oe.path),ee=Gre(oe.when),Ae=`${Jre(oe.source)}${ee?`, ${ee}`:""}`;return d.jsxs("button",{className:P?"ia-agent on":"ia-agent","aria-pressed":P,onClick:()=>p(fA(I,h,oe.path)),children:[d.jsx(ct,{s:P?"all":"none"}),d.jsxs("span",{className:"ia-agent-text",children:[d.jsx("span",{className:"ia-agent-name",children:oe.title}),d.jsx("span",{className:"ia-agent-line",children:`${Ae[0].toUpperCase()}${Ae.slice(1)}`})]})]},oe.path)},ve=oe=>d.jsxs("span",{className:"ia-goes",children:[j.length>0?d.jsxs(d.Fragment,{children:[Js.landBefore," ",d.jsx("button",{type:"button",className:"ia-word","aria-expanded":x,onClick:P=>{P.stopPropagation(),j.length>1&&k(ee=>!ee)},children:ae}),Js.landAfter]}):Js.landNowhere,x&&j.length>1&&d.jsx("span",{className:"ia-projects",role:"listbox",children:j.map(P=>d.jsx("button",{role:"option","aria-selected":P.slug===a,className:P.slug===a?"ia-project on":"ia-project",onClick:ee=>{ee.stopPropagation(),k(!1),c(P.slug)},children:P.name},P.slug))})]}),He=d.jsxs("div",{className:"ia-doors",children:[d.jsxs("button",{className:"ia-door is-first",onClick:W,disabled:m,children:[d.jsxs("span",{className:"ia-door-name",children:[Wre(I),d.jsx("kbd",{children:"⌘↵"})]}),d.jsx("span",{className:"ia-door-why",children:mA(I,pA(I))||ks.foot})]}),d.jsxs("button",{className:"ia-door",onClick:()=>$("pick"),children:[d.jsx("span",{className:"ia-door-name",children:Mf.pick}),d.jsx("span",{className:"ia-door-why",children:Mf.pickWhy})]}),d.jsx("p",{className:"ia-read",children:Mf.never})]}),tt=d.jsxs(d.Fragment,{children:[d.jsx("div",{className:Se>0?"ia-scroll ia-stack ia-fading":"ia-scroll ia-stack",ref:V,onScroll:De,children:I.map(oe=>d.jsxs("div",{className:U(oe.key)?"ia-blk open":"ia-blk","data-sec":"",children:[d.jsxs("div",{className:"ia-blk-head",children:[d.jsx("button",{className:"ia-pick",onClick:()=>me(oe),"aria-label":`Keep everything in ${Oe(oe)}`,children:d.jsx(ct,{s:K(oe)})}),d.jsxs("button",{className:"ia-blk-main",onClick:()=>we(oe.key),"aria-expanded":U(oe.key),children:[d.jsxs("span",{className:"ia-blk-line",children:[d.jsx("span",{className:"ia-blk-name",children:Oe(oe)}),oe.kind==="new"&&d.jsx("span",{className:"ia-tag",children:Js.newBadge}),d.jsx("span",{className:"ia-blk-n",children:Js.n(go(oe))}),d.jsx(Xre,{})]}),d.jsx("span",{className:"ia-blk-where",children:oe.kind==="everywhere"?d.jsxs(d.Fragment,{children:[Js.homeFolder,". ",ve()]}):oe.where})]})]}),U(oe.key)&&d.jsxs("div",{className:"ia-blk-list",children:[oe.items.map(se),(oe.threads??[]).map(he)]})]},oe.key))}),Te]}),Ct=R==="pick"?tt:He;return d.jsx("div",{className:"modal-backdrop compose-backdrop",onClick:n?void 0:i,children:d.jsxs("div",{className:`modal ia-card on-${R}${n?" in-walk":""}`,onClick:oe=>oe.stopPropagation(),children:[d.jsxs("div",{className:"ia-top",children:[R==="pick"?d.jsx("button",{className:"ia-back",onClick:()=>$("door"),children:Mf.pick}):d.jsx("h1",{className:"ia-head",children:J&&!B?ks.headNone:ks.head}),J&&B&&d.jsx("div",{className:"ia-top-right",children:d.jsx("span",{className:"ia-total",children:le})})]}),n&&R==="door"&&B&&d.jsx("p",{className:"ia-offer",children:n.line}),!J&&d.jsx("div",{className:"ia-empty",children:ks.reading}),J&&!B&&d.jsxs("div",{className:"ia-none",children:[d.jsx("p",{className:"ia-none-where",children:ks.noneWhere(Js.homeFolder)}),d.jsx("p",{className:"ia-none-later",children:ks.noneLater}),d.jsx("button",{type:"button",className:"ia-look-again",onClick:C,disabled:Q,children:Q?ks.looking:ks.lookAgain})]}),J&&B&&Ct,J&&B&&j.length===0&&!I.some(oe=>oe.kind==="new")&&d.jsxs("p",{className:"ia-line",children:[ks.noProject," ",d.jsx("button",{type:"button",className:"ia-word",onClick:s,children:ks.newProject})]}),J&&B&&R==="pick"&&d.jsxs(d.Fragment,{children:[d.jsxs("p",{className:"ia-read",children:[Ee.agentsRead,Ie&&d.jsxs(d.Fragment,{children:[" ",Ie]})]}),d.jsx("div",{className:"ia-foot",children:d.jsxs("button",{className:"dock-send",disabled:!M||m,onClick:()=>re(h),children:[qre(I,h)," ",d.jsx("kbd",{children:"⌘↵"})]})})]}),n&&R==="door"&&d.jsx("button",{type:"button",className:"ia-walk-on",onClick:n.onSkip,disabled:m,children:n.skip})]})})}function Zre(e,t,n=Date.now()){return t.filter(r=>um(r)===e.id).sort((r,s)=>s.createdAt-r.createdAt).map(r=>{const s=dm(r),o=r.status==="open"||r.status==="claimed";return{id:r.id,when:_h(r.createdAt,n),what:o?"running":s?"clean":r.result||"finished without saying anything",news:!o&&!s,late:ese(e,r)}})}function ese(e,t,n){const r=v4(e,t.createdAt);if(!r)return null;const[s,o,i]=r.split("-").map(Number),[l,a]=e.at.split(":").map(Number),c=new Date(s,o-1,i,l,a,0,0).getTime();return t.createdAt-c<15*6e4?null:`ran ${Yo(c,t.createdAt)} late`}function tse(e){return`${new Date(e).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})} ${fm(e).toLowerCase()}`}function nse({rule:e,items:t,editing:n,onClose:r,onEdit:s,onEditClose:o,onSave:i,onEnd:l}){const a=Zre(e,t),c=kR(e),u=new Date(`2026-01-01T${e.at}:00`).toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}),f=ine(e);return d.jsxs("div",{className:"focus-pane",children:[d.jsx("div",{className:"focus-scroll",children:d.jsxs("div",{className:"focus",children:[d.jsxs("div",{className:"focus-head",children:[d.jsxs("button",{className:"back-esc in-head",onClick:r,"aria-label":"Back",children:[d.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",children:d.jsx("path",{d:"M10 3.5L5.5 8l4.5 4.5"})}),d.jsx("span",{children:"esc"})]}),d.jsxs("div",{children:[d.jsx("div",{className:"focus-title",children:e.title}),d.jsxs("div",{className:"focus-meta",children:[d.jsx("span",{children:e.productName}),d.jsx("span",{children:"·"}),d.jsxs("span",{children:["daily at ",u]}),c&&d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"·"}),d.jsxs("span",{children:["next ",tse(c)]})]})]})]})]}),e.body&&d.jsx("div",{className:"focus-body",children:d.jsx("div",{className:"markdown",children:d.jsx(Lc,{remarkPlugins:[ru],children:e.body})})}),d.jsxs("div",{className:"runs",children:[a.length===0&&d.jsx("div",{className:"run",children:d.jsx("span",{className:"run-what",children:"It has not run yet."})}),a.map(h=>d.jsxs("div",{className:"run",children:[d.jsx("span",{className:"run-when",children:h.when}),d.jsxs("span",{className:h.news?"run-what news":"run-what",children:[h.what,h.late?` · ${h.late}`:""]})]},h.id))]}),d.jsx("div",{className:"runs-note",children:"The runs still on file."})]})}),d.jsx("div",{className:"focus-dock",children:d.jsxs("div",{className:"focus-dock-inner",children:[d.jsx("div",{className:"dock-card",children:n?d.jsx(rse,{message:f,onSave:i,onClose:o}):d.jsxs("button",{className:"dock-pill",onClick:s,children:[d.jsx("span",{className:"dock-pill-text",children:"Change what it does…"}),d.jsx("span",{className:"dock-pill-key",children:d.jsx("kbd",{children:"R"})})]})}),d.jsx("button",{className:"rule-end",onClick:l,children:"End this repeating task"})]})})]})}function rse({message:e,onSave:t,onClose:n}){const[r,s]=w.useState(e),o=w.useRef(null);w.useEffect(()=>{const a=o.current;a&&(a.focus(),a.setSelectionRange(a.value.length,a.value.length),a.scrollTop=a.scrollHeight)},[]);const i=r.trim()!==e.trim(),l=()=>{i&&r.trim()&&t(r.trim())};return d.jsxs(d.Fragment,{children:[d.jsx("textarea",{className:"dock-input rule-input",ref:o,value:r,onChange:a=>s(a.target.value),placeholder:"What should it do every time?",onKeyDown:a=>{(a.metaKey||a.ctrlKey)&&a.key==="Enter"&&l(),a.key==="Escape"&&(a.stopPropagation(),n())}}),d.jsxs("div",{className:"compose-sentence",children:[d.jsx("span",{className:"compose-clauses",children:d.jsx("span",{className:"dim",children:"Every run after this one reads this."})}),d.jsxs("button",{className:"dock-send",onClick:l,disabled:!i||!r.trim(),title:"Save · ⌘↵",children:["Save ",d.jsx("kbd",{children:"⌘↵"})]})]})]})}function sse(e){const t=new Map;return e.map(n=>{const r=t.get(n.id)??0;return t.set(n.id,r+1),r?`${n.id}#${r}`:n.id})}function ose(){return typeof window>"u"||typeof window.matchMedia!="function"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function ise(e){if(typeof window>"u"||typeof window.matchMedia!="function")return()=>{};const t=window.matchMedia("(prefers-color-scheme: dark)"),n=()=>e(t.matches?"dark":"light");return t.addEventListener("change",n),()=>t.removeEventListener("change",n)}function Ra(e){return e==="light"||e==="dark"?e:e==="match"?ose():"dark"}function lse(e){return e==="light"||e==="dark"||e==="match"?e:"dark"}const Qo="zero.theme";function Bc(e,t=document.documentElement){t.setAttribute("data-theme",e)}const tn=[{id:"valley-haze",name:"Valley Haze",note:"The gouache valley, thrown out of focus. A blurred warm wash, edge to edge."},{id:"frost-haze",name:"Frost Haze",note:"Paper cooled toward blue. Light, with a cold edge to it.",light:!0},{id:"slate-haze",name:"Slate Haze",note:"A cool mid ground with a pale card on it. Between the two ends.",light:!0},{id:"lake",name:"Lake",note:"The landing page’s photograph, in dark mode."},{id:"ice",name:"Ice",note:"Blue daylight entering a glacier cave from the right."},{id:"pixel-ridge",name:"Pixel Ridge",note:"Pixel art. Flat ridges into a low sun, pixel conifers on the near cliff."},{id:"peach-haze-2",name:"Peach Haze",note:"A diagonal peach glow across a sage and mauve wash.",light:!0},{id:"orbital-glass",name:"Orbital Glass",note:"A ringed planet through clear glass, with quiet gray text."},{id:"pixel-orbit",name:"Pixel Orbit",note:"Pixel art. A ringed planet low over a dark plain."},{id:"woodblock-sea",name:"Woodblock Sea",note:"A Japanese woodblock print. Pines on a headland, the sun on the water."},{id:"riso-hills",name:"Riso Hills",note:"A two colour risograph print in blue and coral ink."},{id:"gouache-valley",name:"Gouache Valley",note:"A painted animation background in gouache. A valley and a still river."},{id:"watercolour-mist",name:"Watercolor Mist",note:"A wet on wet watercolour. Five washes of mountain into mist."},{id:"ember-grid",name:"Ember Grid",note:"The launch film’s look. A warm dark grey, a faint dot grid, square corners and one orange."}],zr="zero.skin";function ba(e){return tn.some(t=>t.id===e)?e:"none"}function ase(e){var t;return((t=tn.find(n=>n.id===e))==null?void 0:t.name)??"None"}function cse(e,t){return t==="none"?e:t}const Ns=[...tn.map(e=>({id:e.id,name:e.name})),{id:"light",name:"Light"},{id:"dark",name:"Dark"}];function use(e,t=Ra("match")){const n=e.getItem(Qo),r=e.getItem(zr);if(r==="peach-haze"){e.setItem(Qo,"light"),e.setItem(zr,"peach-haze-2");return}if(n===null&&r===null){const o=as(ed);e.setItem(Qo,o.theme),e.setItem(zr,String(o.skin));return}if(n==="match"||r===null||["ice-river","lake-harbour","moon-pines","cel-dusk","pixel-harbour","vector-dunes","lino-coast"].includes(r)){const o=n==="match"?t:Ra(n),i=r&&ba(r)!=="none"?as(r):as(o==="light"?"frost-haze":"valley-haze");e.setItem(Qo,i.theme),e.setItem(zr,i.skin)}}function as(e){var t;return e==="light"?{theme:"light",skin:"none"}:e==="dark"?{theme:"dark",skin:"none"}:e==="match"?{theme:"match",skin:"none"}:{theme:(t=tn.find(n=>n.id===e))!=null&&t.light?"light":"dark",skin:e}}function Hc(e,t=document.documentElement){e==="none"?t.removeAttribute("data-skin"):t.setAttribute("data-skin",e)}function gA(e,t=document.documentElement){e==="soft"?t.setAttribute("data-skin-detail","soft"):t.removeAttribute("data-skin-detail")}function yA(e){return e==="soft"?"soft":"sharp"}const Lo="zero.skin.tune",Fr={panelOpacity:{min:0,max:1,step:.01},backgroundBlur:{min:0,max:80,step:1},blur:{min:0,max:80,step:1},dim:{min:0,max:.85,step:.01}},On={lake:{blur:8,backgroundBlur:5,dim:.63},ice:{blur:2,dim:.85},"ice-river":{blur:2,dim:.735},"lake-harbour":{blur:2,dim:.68},"pixel-ridge":{blur:4,backgroundBlur:6,dim:.77},"pixel-orbit":{blur:0,backgroundBlur:5,dim:.2},"woodblock-sea":{blur:4,backgroundBlur:12,dim:.84},"riso-hills":{blur:2,backgroundBlur:3,dim:.85},"gouache-valley":{blur:4,backgroundBlur:5,dim:.75},"vector-dunes":{blur:2,dim:.775},"watercolour-mist":{blur:2,backgroundBlur:4,dim:.85},"orbit-rings":{blur:2,dim:0},"moon-pines":{blur:2,dim:0},"cel-dusk":{blur:2,dim:0},"pixel-harbour":{blur:2,dim:0},"lino-coast":{blur:2,dim:.85},"valley-haze":{blur:2,dim:0},"frost-haze":{blur:2,dim:0},"slate-haze":{blur:2,dim:0},"orbital-glass":{blur:30,dim:.3,backgroundBlur:24,panelOpacity:.16},"peach-haze-2":{blur:0,dim:.35,backgroundBlur:0,panelOpacity:.2},"ember-grid":{blur:0,dim:0}},dse=(e,t,n)=>e<t?t:e>n?n:e;function na(e,t){const n=On[t]??On.lake;let r;try{r=e?JSON.parse(e):null}catch{return n}const s=r==null?void 0:r[t];if(!s||typeof s!="object")return n;const o=(i,l,a)=>typeof i=="number"&&Number.isFinite(i)?dse(i,a.min,a.max):l;return{...s.backgroundBlur!==void 0||n.backgroundBlur!==void 0?{backgroundBlur:s.backgroundBlur===void 0?n.backgroundBlur:o(s.backgroundBlur,0,Fr.backgroundBlur)}:{},...n.panelOpacity!==void 0?{panelOpacity:o(s.panelOpacity,n.panelOpacity,Fr.panelOpacity)}:{},blur:o(s.blur,n.blur,Fr.blur),dim:o(s.dim,n.dim,Fr.dim)}}function fse(e,t,n){let r={};try{const s=e?JSON.parse(e):null;s&&typeof s=="object"&&(r=s)}catch{}return JSON.stringify({...r,[t]:n})}function ra(e,t=document.documentElement){t.style.setProperty("--skin-panel-opacity",e.panelOpacity===void 0?"":String(e.panelOpacity)),t.style.setProperty("--skin-background-blur",`${e.backgroundBlur??0}px`),t.style.setProperty("--skin-blur",`${e.blur}px`),t.style.setProperty("--skin-dim",String(e.dim))}const ed="ember-grid";function bP(e){return e==="none"||e===ed?$x:e}const $x="gouache-valley";function hse(e,t){if(e.getItem(t)!==null||e.getItem(zr)!==null)return null;const n=as(ed);return e.setItem(t,n.theme),e.setItem(zr,String(n.skin)),n}function pse(e,t){const n=e.trim().toLowerCase().split(/\s+/).filter(Boolean);if(!n.length)return!0;const r=`${t.label} ${t.keywords??""}`.toLowerCase();return n.every(s=>r.includes(s))}const mse=["snooze"];function gse(e,t){if(!e.trim())return t;const n=r=>mse.includes(r.id)?0:1;return[...t].sort((r,s)=>n(r)-n(s))}const yse="light mode dark mode appearance colours colors";function wse(e){const t=[],n=e!=="light"&&e!=="dark"&&e!=="match";t.push({id:"theme-picker",label:"Themes…",hint:"all of them at once, without leaving this screen",keywords:"theme themes background picture photo wallpaper appearance skin look",opens:"themes"});const r=as(e).theme==="light"?"valley-haze":"frost-haze";return t.push({id:"theme",label:r==="valley-haze"?"Switch to dark":"Switch to light",hint:"themes",keywords:yse,to:r}),n&&t.push({id:"theme-off",label:`Turn off ${ase(e)}`,hint:"back to plain dark, no picture",keywords:"theme background picture photo wallpaper appearance",to:"dark"}),t}const wA=32;function kse(e){const t=e.trim();let n=t;if(t.length>wA){const r=t.slice(0,wA),s=r.lastIndexOf(" ");n=`${(s>0?r.slice(0,s):r).trimEnd()}…`}return`Nothing matches “${n}”.`}function xse({products:e,supervisorPaused:t,itemCommands:n=[],batch:r=!1,order:s=[],look:o,onSetLook:i,onThemes:l,staleFiles:a=[],updateReady:c=null,onInstallUpdate:u,filtering:f=!1,onOpenFilter:h,onClearFilter:p,onView:m,onPause:y,onResume:x,onRankFirst:k,onNewProject:v,onStanding:b,onSettings:E,onShortcuts:N,panelUp:T,onTogglePanel:A,keyHints:R,onSetKeyHints:$,onSearch:L,onFirstRun:_,onTutorial:j,onImportAgents:F,onFreshUser:ae,onDemo:G,onClose:I}){const[ne,B]=w.useState(""),[J,M]=w.useState(0),Q=w.useRef(null);w.useEffect(()=>{var W;return(W=Q.current)==null?void 0:W.focus()},[]);const ce=w.useMemo(()=>[{id:"new-project",label:"New project…",hint:"name it, and it is yours",run:v},...n,{id:"filter",label:"Filter…",hint:"Project, priority or agent",run:h},...f?[{id:"clear-filter",label:"Clear filter",run:p}]:[],...e.map((W,V)=>({id:`rank-${W.slug}`,label:`Rank ${W.name} first`,hint:s.includes(W.slug)?`now #${V+1} of ${e.length}`:"not ranked yet",run:()=>k(W.slug)})),{id:"search",label:"Search tasks",keyHint:"/",run:L},{id:"view-inbox",label:"Inbox",run:()=>m("inbox")},{id:"view-progress",label:"In progress",run:()=>m("progress")},{id:"view-done",label:"Closed",run:()=>m("done")},...wse(o).map(W=>({id:W.id,label:W.label,hint:W.hint,keywords:W.keywords,run:W.opens==="themes"?l:()=>i(W.to)})),...c?[{id:"update",label:`Restart to update ${Le}`,hint:`version ${c} has downloaded · restarting puts you back where you were`,keywords:"update upgrade new version restart",run:()=>u==null?void 0:u()}]:[],...a.length?[{id:"stale",label:`Restart ${Le} to pick up main-process changes`,hint:`${a.length} file${a.length===1?"":"s"} changed since this one started · ⌘R will not pick them up`,run:()=>{}}]:[],{id:"pause",label:t?"Unpause agents":"Pause agents",hint:t?"sessions will spawn again":"no new sessions spawn",run:()=>y(!t)},...r?[]:[{id:"resume-stopped",label:"Resume interrupted agents",hint:"respawn work stranded by a usage limit or crash",run:x}],{id:"standing",label:"General agent instructions…",hint:"every agent, every task",keywords:"standing instructions rules your my brief guidelines preferences every agent every session tell agents dont do",run:b},{id:"settings",label:"Settings…",hint:"the workspace, and every project",run:E},{id:"shortcuts",label:"Keyboard shortcuts",hint:`every key ${Le} has`,keywords:"keys keyboard shortcut hotkeys commands cheatsheet help what does press bindings",run:N},{id:"panel",label:T?"Collapse sidebar":"Expand sidebar",hint:"what this product is, and what else is open on it",keyHint:"\\",run:A},{id:"import-agents",label:"Import your Claude Code agents",hint:"the ones already on this Mac · they land in your inbox",keywords:"import agents claude code subagents existing mine bring across add my",run:F},{id:"tutorial",label:"Take the tutorial",hint:"a pretend project · nothing is kept",keywords:"tutorial practice practise walkthrough walk tour again show me around teach learn training how does this work sandbox lesson",run:j},{id:"first-run",label:`Set ${Le} up again`,hint:"from the welcome screen · makes a project",keywords:"onboarding first run new user welcome intro setup start over from scratch install fresh",run:_},{id:"demo",label:"Open a demo inbox",hint:"invented work · yours keeps running",keywords:"demo demonstration present presentation pitch investor customer screen share screenshare record video sample fake example stage not mine hide my work",run:G},{id:"fresh-user",label:`Open ${Le} as a new user`,hint:"nothing set up · yours keeps running",keywords:"new user fresh install stranger onboarding first run clean empty blank test website download nothing of mine agents claude code sessions",run:()=>ae(!1)},{id:"keyhints",label:R?"Turn off keyboard shortcut hints":"Turn on keyboard shortcut hints",hint:"the keys a row and the tabs offer, drawn when you point at them",run:()=>$(!R)}],[n,r,e,t,s,v,f,h,p,m,y,x,k,b,E,N,o,i,l,a,c,u,T,A,R,$,L,_,j,F,ae,G]),C=w.useMemo(()=>{const W=ne.trim().toLowerCase();return W?gse(W,ce.filter(V=>pse(W,V))):ce},[ce,ne]),re=w.useMemo(()=>sse(C),[C]);return w.useEffect(()=>M(0),[ne]),d.jsx("div",{className:"modal-backdrop palette-backdrop",onClick:I,children:d.jsxs("div",{className:"modal palette",onClick:W=>W.stopPropagation(),children:[d.jsx("input",{ref:Q,className:"palette-input",value:ne,onChange:W=>B(W.target.value),placeholder:"Type a command…",onKeyDown:W=>{W.key==="Escape"&&I(),W.key==="ArrowDown"&&(W.preventDefault(),M(V=>Math.max(0,Math.min(V+1,C.length-1)))),W.key==="ArrowUp"&&(W.preventDefault(),M(V=>Math.max(0,V-1))),W.key==="Enter"&&C[J]&&C[J].run()}}),d.jsxs("div",{className:"palette-list",children:[C.length===0&&d.jsx("div",{className:"palette-empty",children:kse(ne)}),C.map((W,V)=>d.jsxs("div",{className:`palette-item ${V===J?"selected":""}`,onClick:W.run,onMouseEnter:()=>M(V),children:[d.jsx("span",{children:W.label}),W.keyHint?d.jsx("span",{className:"palette-key",children:W.keyHint}):W.hint&&d.jsx("span",{className:"palette-hint",children:W.hint})]},re[V]))]})]})})}const uw=`quit and reopen ${Le} to edit these`,bse=e=>/No handler registered/i.test(e),vP={sentence:"General agent instructions. Every agent reads them before your task, on every project.",placeholder:"Don't hand me summary .md files. Put the answer on the work item.",reader:()=>{var e;return(e=window.zero)==null?void 0:e.standingRead},writer:()=>{var e;return(e=window.zero)==null?void 0:e.standingWrite}};function vse({kind:e=vP,onClose:t}){const[n,r]=w.useState(null),[s,o]=w.useState("idle"),[i,l]=w.useState(null),a=w.useRef(null),c=w.useRef(null),u=w.useRef(null);w.useEffect(()=>{const y=e.reader();if(!y){r(""),o("failed"),l(uw);return}y().then(x=>{r((x==null?void 0:x.text)??""),x!=null&&x.error&&(o("failed"),l(x.error))}).catch(()=>{r(""),o("failed"),l(uw)})},[]),w.useEffect(()=>{if(n===null)return;const y=a.current;y&&(y.focus(),y.setSelectionRange(0,0),y.scrollTop=0)},[n!==null]);const f=async y=>{o("saving");try{const x=e.writer();if(!x)throw new Error("this window cannot reach the instructions file");const k=await x({text:y});if(k&&k.ok===!1)throw new Error(k.error||"could not save");u.current=null,o("saved"),l(null)}catch(x){const k=String((x==null?void 0:x.message)??x);o("failed"),l(bse(k)?uw:k)}},h=y=>{r(y),u.current=y,o("saving"),c.current&&window.clearTimeout(c.current),c.current=window.setTimeout(()=>f(y),400)},p=()=>{c.current&&window.clearTimeout(c.current),u.current!==null?f(u.current).finally(t):t()},m=s==="failed"?i??"not saved":s==="saving"?"saving…":s==="saved"?"saved":e.sentence;return d.jsx("div",{className:"modal-backdrop compose-backdrop",onClick:p,children:d.jsxs("div",{className:"modal compose rules-card",onClick:y=>y.stopPropagation(),children:[d.jsx("textarea",{ref:a,className:"rules-text",spellCheck:!1,value:n??"",placeholder:n===null?"loading…":e.placeholder,disabled:n===null,onChange:y=>h(y.target.value),onKeyDown:y=>{y.key==="Escape"&&(y.preventDefault(),p()),y.stopPropagation()}}),d.jsxs("div",{className:"rules-sentence",children:[d.jsx("span",{className:"rules-clauses",children:m}),d.jsxs("button",{type:"button",className:"dock-send",onClick:p,children:["Done ",d.jsx("kbd",{children:"esc"})]})]})]})})}const Sse=`This is about the LAST message you send, the one that ends your run. Whoever
351
+ asked for it reads it in a list beside twenty others and usually decides what to
352
+ do next without opening anything. Ten seconds is the real budget.
353
+
354
+ FIRST, WHAT WERE YOU ASKED FOR. Everything below is written for a run that DID
355
+ something and now needs a decision. WHEN YOU WERE ASKED A QUESTION INSTEAD,
356
+ THE ANSWER IS THE WHOLE DELIVERABLE and these rules serve it rather than
357
+ replace it: line one carries the answer and never a question back, the length
358
+ is theirs and not ours, and you offer nothing, because work they did not ask
359
+ for is not a pick. Read this, explain that, what is their methodology,
360
+ summarise this: those are questions. Answer them the way any good assistant
361
+ would, then stop.
362
+
363
+ **Line one is the thing they have to say back, in bold, with nothing above it.**
364
+ YOUR MESSAGE BEGINS WITH THE TWO ASTERISKS. Not a heading and not a sentence of
365
+ context first. A question they can answer or a word they can pick. When they
366
+ asked YOU a question, line one is instead the most useful sentence of your
367
+ answer, still bold and still first, because the thing they have to say back is
368
+ nothing and the thing they came for is the answer. It keeps the same budget
369
+ below: if the answer will not fit, the shortest true version of it goes first
370
+ and the rest follows underneath.
371
+ One sentence, under fifteen words and under 110 characters. The app draws it
372
+ twice, in the list and as the heading over your options, and both cut it there.
373
+ The asterisks are where the cut lands: leave them out and it takes your whole
374
+ first paragraph and cuts that mid-word. No jargon and no file names.
375
+ Not the topic, not a status, not the title again. If there is genuinely nothing
376
+ to say back, it says what happened instead: "Done, the tests are green and
377
+ nothing needs you."
378
+
379
+ The sentence you will want to put above the bold line is housekeeping: the tests
380
+ are green, nothing is committed. It is true, it is not what they have to say
381
+ back, and it goes underneath.
382
+
383
+ Then the answer itself, in plain full sentences, the way you would say it out
384
+ loud. What happened, what you measured, what you would do next. One idea per
385
+ sentence. Under 200 words, no headings and no bullet lists. Everything you did is
386
+ already in the conversation above this message, so do not say it twice: this is
387
+ the ten second version and the detail is one scroll up.
388
+
389
+ THE ANSWER IS WRITTEN ONCE, AND THIS MESSAGE IS IT. On a work item the app
390
+ writes your last message onto the row when you end, options and all. So never
391
+ write the answer onto the row yourself as well: that second copy is the answer
392
+ twice on one screen.
393
+
394
+ THAT CAP IS ON REPORTING YOUR OWN WORK, NOT ON ANSWERING THEM. It is short only
395
+ because the work is readable above it. An answer they asked for is readable
396
+ nowhere else, so there the ask sets the size, "give me the details" means give
397
+ the details, and headings or a list are fine if that is how the thing is shaped.
398
+ Being brief about your run is a courtesy. Being brief about their question is
399
+ failing to answer it.
400
+
401
+ Never give a number you did not measure. "I don't know" is an answer.
402
+
403
+ THE ANSWER IS IN THIS MESSAGE, NOT IN A FILE BESIDE IT.Write the finding, the
404
+ numbers and the recommendation here; make no report to hold them. What you
405
+ would have made anyway, a design, an app running at a port, a change to
406
+ review, gets its path or address on its own line, and a design or a change
407
+ opens beside the message by itself. Not the source files you edited, which are
408
+ no use to them.
409
+
410
+ Steps they must take are a numbered list, five at most, the first one doable now.
411
+
412
+ If anything at all is left for them to decide, end with an Options section, in
413
+ these words. Left for THEM to decide: something already in front of them that
414
+ your run put there.
415
+
416
+ ## Options
417
+ 1. The move you would make (recommended)
418
+ 2. A real alternative
419
+
420
+ LINE ONE AND THE OPTIONS ARE ONE QUESTION, NOT TWO. The options are the answers
421
+ to line one, in the same words. So write line one LAST, off the options you
422
+ ended up with, and read them back together: if someone said option one
423
+ out loud, it has to answer line one. When it does not, they have two questions
424
+ stacked on each other and must open the message to see which is which.
425
+
426
+ Two options is a fine list and three is the most that helps. Mark exactly one
427
+ recommended. Every option has to be something you would start on without asking
428
+ another question first. Name each choice in your prose too, because the list is
429
+ often drawn elsewhere on the screen and a sentence pointing at "option two"
430
+ then points at nothing.
431
+
432
+ IF YOUR RUN CHANGED ANYTHING, THERE IS SOMETHING TO DECIDE. Edited files, a
433
+ branch, a draft, a page you built: none of it is finished until the person
434
+ reading you says what happens to it. So the options are what to do with the
435
+ thing, in their words: ship it, change this part first, throw it away. Do not
436
+ call the run settled to save yourself the asking, or make them type "merge it"
437
+ because you did not offer it. The only run that ends with no options
438
+ is one that changed nothing.
439
+
440
+ AND READING CHANGES NOTHING. Reading, searching, explaining and answering
441
+ leave the world as they found it, so a question answered ends with no options,
442
+ and that is the right ending and not a lazy one. NEVER INVENT A PICK OUT OF
443
+ WORK THEY DID NOT ASK FOR. Offering to go and draft something else is not an
444
+ option, it is a new task, and it costs them the answer they came for.
445
+ `,Cse=`- The first line is the thing to do or answer, in bold.
446
+ - Steps are a numbered list of five or fewer, and the first one is small.
447
+ - No recap, no preamble, no closing offer.
448
+ - Work in progress says where it is in one clause.
449
+ - Time is given in units, or not at all.
450
+ `,Ese=`# How to work
451
+
452
+ <!-- store-tools:start -->
453
+ You are a worker session in {{name}}, the founder's agent inbox. You were spawned
454
+ for exactly one work item (above), you do that work, you write your state back,
455
+ and you end. There is no long-lived you: anything you do not write into the
456
+ work item or the product's documents is gone when you exit. Sessions are
457
+ cattle; the store is the truth.
458
+ <!-- store-tools:end -->
459
+ <!-- no-store-tools:start -->
460
+ You are a worker session in {{name}}, the founder's agent inbox. You were spawned
461
+ for exactly one work item (above), you do that work, and you end. There is no
462
+ long-lived you.
463
+
464
+ THIS INSTALL GIVES YOU NO TOOLS FOR THE INBOX ITSELF. You cannot claim this
465
+ item, check in on it, file another one, set its status or close it, and nothing
466
+ you attempt that way will work. Do not go looking for those tools and do not
467
+ hand-edit the inbox's own files to fake them.
468
+
469
+ Two things of yours reach the founder, and only two. The plain sentences you say
470
+ as you go, which the app puts on the row while you are working. And YOUR LAST
471
+ MESSAGE, which the app writes onto the row as the result the second you exit,
472
+ and which parks the row in her inbox for her to read and reply to. So your last
473
+ message is not a sign-off. It is the whole of what she gets, and the rules for
474
+ writing it are at the end of this brief.
475
+ <!-- no-store-tools:end -->
476
+
477
+ The founder is building several products at once through this inbox. Their
478
+ attention is the scarcest resource in the system, scarcer than your tokens.
479
+ Everything below follows from that.
480
+
481
+ ## The store
482
+
483
+ <!-- store-tools:start -->
484
+ The product's docs directory holds its documents and work items; use the store
485
+ tools, not the files. Make a document only when plain Claude Code would; the
486
+ answer is the message.
487
+ <!-- store-tools:end -->
488
+ <!-- no-store-tools:start -->
489
+ The product's docs directory holds its documents; edit them with your ordinary
490
+ tools, and make one only when plain Claude Code would. Its work items are NOT
491
+ yours to edit: the app owns that file, and your last message is how this row
492
+ gets written.
493
+ <!-- no-store-tools:end -->
494
+
495
+ The product's documents are your context; read what you need before acting.
496
+ A decision recorded there holds unless the founder has said otherwise since.
497
+
498
+ ## Altitude
499
+
500
+ <!-- store-tools:start -->
501
+ A founder directive is not always a product task. It can be spoken at the
502
+ level of the work system itself: priorities, what to scrap, how to operate
503
+ (close everything that does not serve X, stop pursuing Y). Execute those
504
+ directly: close the obsolete items yourself with a one-line reason each, file
505
+ one review summarizing what you closed and kept and why, and treat the stated
506
+ priorities as the newest grounding for everything after.
507
+ <!-- store-tools:end -->
508
+ <!-- no-store-tools:start -->
509
+ A founder directive is not always a product task. It can be spoken at the
510
+ level of the work system itself: priorities, what to scrap, how to operate
511
+ (close everything that does not serve X, stop pursuing Y). Treat those as the
512
+ newest grounding for everything after. You cannot close anybody's rows, so
513
+ name the ones you believe are dead in your last message, one line of reason
514
+ each, and let her clear them.
515
+ <!-- no-store-tools:end -->
516
+
517
+ ## The ask sets the size of the run
518
+
519
+ EVERYTHING BELOW DESCRIBES THE BIGGEST KIND OF RUN, and most rows are not
520
+ that. Its length is not an instruction to make your row bigger than it was. A
521
+ row that asks a question wants an answer, not a project: read it, answer it,
522
+ stop.
523
+
524
+ So on anything general, read this PDF, what does this code do, find me X, you
525
+ are a good general assistant first and this brief is scaffolding around that.
526
+ If following a rule here would make your answer worse than a plain Claude Code
527
+ session's, you are misapplying it. Answer well, then apply what actually fits.
528
+
529
+ ## Doing the work
530
+
531
+ <!-- store-tools:start -->
532
+ - Claim your item first (claim_work_item with your item id). If the claim is
533
+ refused, someone else has it: end immediately, reporting nothing.
534
+ - Leave priority alone on anything you file. The app decides what runs next
535
+ from the founder's own order over her products, and her tag on an item is
536
+ the only one that changes it.
537
+ - Actions outside your standing grants do not silently fail any more: the
538
+ permission system asks the founder LIVE (an approval card in her inbox app)
539
+ and blocks you until she answers, up to 15 minutes. Spend these asks like
540
+ interruptions, because they are: exhaust what your grants already allow,
541
+ batch the gated part into as few commands as possible, and if she denies
542
+ or the ask times out, do not retry it; finish what you can and file the
543
+ remainder as a review with the exact commands.
544
+ - EVERYTHING YOU FILE IS A PROPOSAL: nothing you create runs until the founder
545
+ approves it from the inbox, so write it for her to decide rather than as a
546
+ note to another agent.
547
+ - Code changes happen in the product's repo (your cwd), on a branch, committed
548
+ as you go. Name the branch the way this repo already names branches; read a
549
+ few with \`git branch\` and follow them. Never commit to main; the founder
550
+ reviews through the inbox.
551
+ - YOUR CWD IS ALREADY YOUR OWN FOLDER, one per task on its own branch. Do not
552
+ make a second one or delete this one. Your branch keeps the commits.
553
+ - CHANGE A FILE WITH THE EDITING TOOL, NEVER WITH sed OR A HEREDOC. Your own
554
+ harness instructions tell you the opposite and they are wrong here, so this
555
+ line overrules them. Two reasons, and the second one is the one that gets
556
+ forgotten. The card the founder and her users open to read what you changed
557
+ now reads the repository as well, so a file you rewrite with a shell command
558
+ does reach it, but ONLY if your work is in a checkout: on a product with no
559
+ repository the conversation is the only reading there is. And the sentence
560
+ you wrote just before a change, which is what makes the change readable by
561
+ someone who is not you, exists nowhere else at all. Reading and searching
562
+ with the shell stays right and stays faster. Writing does not.
563
+ - NAME EACH STEP IN A SENTENCE SHE WOULD USE, out loud, before you take it.
564
+ One plain line, no jargon and no tool names: "Now the IPC handlers and the
565
+ bridge", not "Running Edit on main/ipc.mjs". Those sentences are what the
566
+ founder actually reads about your run: the app shows the newest one while you
567
+ work and keeps the rest as the record of what happened, with everything you
568
+ typed folded away behind them. A session that narrates nothing leaves a row
569
+ that says it did nothing.
570
+ - When the work is done, set the status if it needs setting, then END WITH YOUR
571
+ ANSWER AS YOUR LAST MESSAGE: what changed and how you verified it, shaped by
572
+ the rules at the foot of this brief. The app writes that message onto the row
573
+ as its result the moment you exit. Do not pass \`result\` for this row yourself;
574
+ the answer said twice is the fault this replaces.
575
+ - ANSWERING HER IS NOT CLOSING HER ROW. Hers, 2026-09-27: "If I ask for
576
+ something, its job is to return it back. Only when I request it, 'Close it,'
577
+ or say, 'All right, I'm done with this,' or something like that, should it
578
+ close it." So on a row she wrote (labelled \`founder\`), answer and leave the
579
+ status alone: the row stays open and reaches her as an answer. Set
580
+ it done only when she has asked you to, and then pass her exact words asking
581
+ for it as \`closeBecause\`; the store leaves the row open without them. Rows an
582
+ agent filed are still yours to close, except that a thread she is talking on
583
+ is hers to end: if her reply was a request for information, or the work it
584
+ points at is still ahead of you, leave it open or blocked.
585
+ - If you set status blocked, say what would unblock it, and when that is the
586
+ founder's to do, file it as a child work item (parent: this item id) so her
587
+ row can take her straight to it.
588
+ <!-- store-tools:end -->
589
+ <!-- no-store-tools:start -->
590
+ - There is nothing to claim and nothing to release. The app gave this row to
591
+ you alone before it started you, and it takes it back when you exit.
592
+ - Actions outside your standing grants do not silently fail any more: the
593
+ permission system asks the founder LIVE (an approval card in her inbox app)
594
+ and blocks you until she answers, up to 15 minutes. Spend these asks like
595
+ interruptions, because they are: exhaust what your grants already allow,
596
+ batch the gated part into as few commands as possible, and if she denies
597
+ or the ask times out, do not retry it; finish what you can and say what is
598
+ left in your last message, with the exact commands.
599
+ - You cannot file work, so nothing you find becomes a task by itself. Anything
600
+ worth doing next goes in your last message, in one sentence, as something she
601
+ can say yes to. Her attention is the gate here on purpose.
602
+ - Code changes happen in the product's repo (your cwd), on a branch, committed
603
+ as you go. Name the branch the way this repo already names branches; read a
604
+ few with \`git branch\` and follow them. Never commit to main; the founder
605
+ reviews through the inbox.
606
+ - YOUR CWD IS ALREADY YOUR OWN FOLDER, one per task on its own branch. Do not
607
+ make a second one or delete this one. Your branch keeps the commits.
608
+ - NAME EACH STEP IN A SENTENCE SHE WOULD USE, out loud, before you take it.
609
+ One plain line, no jargon and no tool names: "Now the IPC handlers and the
610
+ bridge", not "Running Edit on main/ipc.mjs". Those sentences are what the
611
+ founder actually reads about your run: the app shows the newest one while you
612
+ work and keeps the rest as the record of what happened, with everything you
613
+ typed folded away behind them. A session that narrates nothing leaves a row
614
+ that says it did nothing. It is also the only progress she can see before you
615
+ finish, so say one before every real step.
616
+ - When the work is done, STOP AND WRITE THE LAST MESSAGE. That message is the
617
+ result: what changed and how you verified it, in two or three sentences,
618
+ shaped by the rules at the foot of this brief. The app lands it on the row and
619
+ puts the row in her inbox. There is no other way to report and no second
620
+ chance at it.
621
+ - If something stopped you, the first line of your last message says what
622
+ stopped you and what would undo it. The row reaches her either way, so a
623
+ blocker she can act on is worth more than a partial job dressed up as a
624
+ finished one. Her reply comes back to a fresh session on this same row, with
625
+ everything said here in front of it.
626
+ <!-- no-store-tools:end -->
627
+
628
+ <!-- subagent-rule:start -->
629
+ ## One row, or several
630
+
631
+ Split work into separate work items when each piece needs its own answer from
632
+ the founder or its own session. Keep helpers inside one item when their work
633
+ combines into a single result.
634
+
635
+ Twenty issues off one call are twenty rows. A research task fanned across ten
636
+ subagents that merge into one document is one row, however many subagents it
637
+ takes. Spawning a subagent is not by itself a reason to file anything.
638
+ <!-- subagent-rule:end -->
639
+
640
+ ## Honesty
641
+
642
+ Report what actually happened. A test you did not run is not "passing"; a
643
+ thing you could not do is stated as such, with what you tried. A fabricated
644
+ result in this system poisons the founder's view of their own company, which
645
+ is the worst failure available to you.
646
+
647
+ <!-- repeat-rules:start -->
648
+ ## If this item is one run of a repeating task
649
+
650
+ Its body says so at the top, and its labels carry \`repeat:<id>\`. It runs again
651
+ tomorrow whatever happens here, so this run does not have to carry the future:
652
+ finish the day's work, not the whole standing job.
653
+
654
+ <!-- store-tools:start -->
655
+ Finish one of two ways.
656
+
657
+ Nothing she needs to know: update the item with \`status: "done"\` and labels
658
+ \`["founder", "repeat:<id>", "clean"]\` IN THE SAME CALL, sending all three
659
+ because labels replace the array rather than merging, and end on one short
660
+ line. That is what clean means. Finishing quietly is the ordinary case for a
661
+ task that runs every morning, and it is why she can leave one running.
662
+
663
+ Anything she should see: finish normally, with a last message saying what you found,
664
+ and do NOT set the clean label. It reaches her inbox, which is the entire point
665
+ of running this daily. Anything that deserves its own life gets filed as its
666
+ own item, the ordinary way.
667
+
668
+ The clean label is the only thing in {{name}} that makes finishing hide a row,
669
+ so it is required to hide and never to show. If you are unsure which of the
670
+ two this is, it is the second one.
671
+ <!-- store-tools:end -->
672
+ <!-- no-store-tools:start -->
673
+ The clean label is the only thing in {{name}} that makes finishing hide a row,
674
+ and setting a label is one of the things you cannot do here. So there is no
675
+ quiet finish available to you: your last message reaches her every morning
676
+ whatever it says. On a run with nothing in it, say that in one line and stop.
677
+ One line costs her a second to read and tells her the job is still alive.
678
+ <!-- no-store-tools:end -->
679
+ <!-- repeat-rules:end -->
680
+ `,mv={messages:Sse,adhd:Cse,system:Ese},kA=[{id:"rules",label:"General agent instructions",description:"Your instructions for every agent, on every project. The default is an empty page.",defaultText:""},{id:"messages",label:"How agents write to you",description:"The titles, opening lines and questions you receive, and the last message of every task. Empty the box and agents follow none of it.",defaultText:mv.messages}],Nse=[{id:"system",label:"System prompt",description:`${Pn}’s task-brief template for project work. Keep the template placeholders for task context. Personal tasks use your message directly. The coding provider’s own system instructions are managed by that provider.`,defaultText:mv.system}],Rf={id:"adhd",label:"ADHD mode",description:"",defaultText:mv.adhd},xA=new Map,uh=()=>new URLSearchParams(location.search).has("fixtures")||!window.zero;function SP(e){const[t,n]=w.useState(null),[r,s]=w.useState(e.defaultText),[o,i]=w.useState(""),[l,a]=w.useState(!1),c=w.useRef(null),u=w.useRef(null),f=w.useRef(Promise.resolve()),h=v=>{c.current=null,f.current=f.current.then(async()=>{var b;try{if(uh())xA.set(e.id,v);else{if(!((b=window.zero)!=null&&b.instructionWrite))throw new Error(`Reopen ${Le} to save instructions.`);const E=await window.zero.instructionWrite(e.id,v);if(!E.ok)throw new Error(E.error||"Could not save")}i(uh()?"Saved in this preview":"Saved"),a(!1)}catch(E){i(String(E.message)),a(!0)}})};w.useEffect(()=>{var b;let v=!0;return uh()?(n(xA.get(e.id)??e.defaultText),i("Preview edits stay in this browser session.")):(b=window.zero)!=null&&b.instructionRead?window.zero.instructionRead(e.id).then(E=>{v&&(E.error?i(E.error):(n(E.text),s(E.defaultText)))}).catch(E=>i(E.message)):i(`Reopen ${Le} to edit instructions.`),()=>{v=!1,u.current&&clearTimeout(u.current),c.current!==null&&h(c.current)}},[e.id]);const p=v=>{n(v),c.current=v,i("Saving…"),u.current&&clearTimeout(u.current),u.current=setTimeout(()=>h(v),400)},[m,y]=w.useState(null);return{text:t,defaultText:r,status:o,edit:p,restore:(v,b)=>{t!==null&&y({text:t,label:b}),p(v)},undo:l?null:m,undoRestore:()=>{m&&(p(m.text),y(null))}}}function bA(e,t=Date.now()){const n=new Date(e),r=n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}),s=i=>{const l=new Date(i);return l.setHours(0,0,0,0),l.getTime()},o=Math.round((s(t)-s(e))/864e5);return o===0?`Today at ${r}`:o===1?`Yesterday at ${r}`:o<7?`${n.toLocaleDateString(void 0,{weekday:"long"})} at ${r}`:`${n.toLocaleDateString(void 0,{month:"short",day:"numeric"})} at ${r}`}const vA=e=>e===0?"an empty page":`${e.toLocaleString()} characters`;function CP({section:e,text:t,defaultText:n,onPick:r}){const[s,o]=w.useState(!1),[i,l]=w.useState(null),[a,c]=w.useState(""),u=w.useRef(null);w.useEffect(()=>{var y;if(!s)return;let h=!0;c(""),uh()||!((y=window.zero)!=null&&y.instructionHistory)?l([]):window.zero.instructionHistory(e.id).then(x=>{h&&(x.error&&c(x.error),l(x.versions??[]))}).catch(x=>{h&&(c(String(x.message)),l([]))});const p=x=>{var k;(k=u.current)!=null&&k.contains(x.target)||o(!1)},m=x=>{x.key==="Escape"&&(x.stopPropagation(),o(!1))};return document.addEventListener("mousedown",p),document.addEventListener("keydown",m,!0),()=>{h=!1,document.removeEventListener("mousedown",p),document.removeEventListener("keydown",m,!0)}},[s,e.id]);const f=async(h,p)=>{var m;o(!1);try{if(!((m=window.zero)!=null&&m.instructionVersion))throw new Error(`Reopen ${Le} to restore a version.`);const y=await window.zero.instructionVersion(e.id,h);if(y.error)throw new Error(y.error);r(y.text,p)}catch(y){c(String(y.message))}};return d.jsxs("div",{className:"instruction-restore",ref:u,children:[d.jsx("button",{type:"button",className:"instruction-restore-link","aria-expanded":s,"aria-haspopup":"menu",disabled:t===null,onClick:()=>o(h=>!h),children:"Restore"}),s&&d.jsxs("div",{className:"instruction-restore-menu",role:"menu","aria-label":`Restore ${e.label}`,children:[i===null&&d.jsx("div",{className:"instruction-restore-empty",children:"Looking for earlier versions…"}),(i==null?void 0:i.length)===0&&d.jsx("div",{className:"instruction-restore-empty",children:"No earlier versions of yours yet. One is kept each time you come back to this box."}),i==null?void 0:i.map(h=>d.jsxs("button",{type:"button",role:"menuitem",onClick:()=>void f(h.ts,bA(h.ts)),children:[d.jsx("span",{children:bA(h.ts)}),d.jsx("span",{className:"instruction-restore-size",children:vA(h.chars)})]},h.ts)),d.jsxs("button",{type:"button",role:"menuitem",className:"instruction-restore-original",disabled:t===n,onClick:()=>{o(!1),r(n,"the original")},children:[d.jsx("span",{children:"The original"}),d.jsx("span",{className:"instruction-restore-size",children:vA(n.length)})]}),a&&d.jsx("div",{className:"instruction-restore-empty",children:a})]})]})}function Tse(){const[e,t]=w.useState(null);return w.useEffect(()=>{let r=!0;return q.settings().then(s=>{r&&s.ok&&t(!!s.workspace.adhdMode)}),()=>{r=!1}},[]),[e,async r=>{const s=await q.setWorkspaceSetting({key:"adhdMode",value:r});s.ok&&t(!!s.workspace.adhdMode)}]}function SA({section:e}){const{text:t,defaultText:n,status:r,edit:s,restore:o,undo:i,undoRestore:l}=SP(e),a=e.id==="messages",[c,u]=Tse(),f=w.useRef(null);return w.useEffect(()=>{var h;t!==null&&((h=f.current)==null||h.focus({preventScroll:!0}))},[t!==null]),d.jsxs("div",{className:"instruction-editor",children:[d.jsxs("div",{className:"instruction-editor-head",children:[d.jsx("h2",{children:e.label}),d.jsx(CP,{section:e,text:t,defaultText:n,onPick:o})]}),d.jsx("p",{children:e.description}),a&&c!==null&&d.jsxs("div",{className:"instruction-toggle",children:[d.jsxs("div",{children:[d.jsx("div",{className:"instruction-toggle-label",children:"ADHD mode"}),d.jsx("div",{className:"instruction-toggle-desc",children:"Adds a short set of rules under yours."})]}),d.jsx("button",{type:"button",role:"switch","aria-checked":c,"aria-label":"ADHD mode",className:`set-sw ${c?"on":""}`,onClick:()=>void u(!c)})]}),d.jsx("textarea",{ref:f,"aria-label":e.label,spellCheck:!1,disabled:t===null,value:t??"",onChange:h=>s(h.target.value),onKeyDown:h=>h.stopPropagation(),placeholder:"Write your instructions here…"}),d.jsx("div",{className:"instruction-save",role:"status",children:i?d.jsxs(d.Fragment,{children:["Restored ",i.label.toLowerCase(),". ",d.jsx("button",{type:"button",className:"instruction-undo",onClick:l,children:"Undo"})]}):r}),a&&c&&d.jsx(Ase,{})]})}function Ase(){const{text:e,defaultText:t,status:n,edit:r,restore:s,undo:o,undoRestore:i}=SP(Rf);return d.jsxs("div",{className:"instruction-sub",children:[d.jsxs("div",{className:"instruction-editor-head",children:[d.jsx("h3",{children:Rf.label}),d.jsx(CP,{section:Rf,text:e,defaultText:t,onPick:s})]}),d.jsx("textarea",{"aria-label":Rf.label,spellCheck:!1,disabled:e===null,value:e??"",onChange:l=>r(l.target.value),onKeyDown:l=>l.stopPropagation(),placeholder:"Write your instructions here…"}),d.jsx("div",{className:"instruction-save",role:"status",children:o?d.jsxs(d.Fragment,{children:["Restored ",o.label.toLowerCase(),". ",d.jsx("button",{type:"button",className:"instruction-undo",onClick:i,children:"Undo"})]}):n})]})}function jse(){const[e,t]=w.useState(kA[0]),[n,r]=w.useState(!1);return d.jsxs("div",{className:"set-inner instructions-page",children:[d.jsx("div",{className:"instruction-tabs","aria-label":"Instruction sections",children:kA.map(s=>d.jsx("button",{"aria-pressed":s.id===e.id,onClick:()=>t(s),children:s.label},s.id))}),d.jsx(SA,{section:e},e.id),d.jsxs("div",{className:"instruction-advanced",children:[d.jsx("button",{className:"instruction-advanced-toggle","aria-expanded":n,onClick:()=>r(s=>!s),children:n?"Hide advanced":"Advanced"}),n&&Nse.map(s=>d.jsx(SA,{section:s},s.id))]})]})}function Mse(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||null}catch{return null}}const Rse={year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1};function CA(e,t){if(!t)return null;try{const n=new Intl.DateTimeFormat("en-US",{timeZone:t,...Rse}).formatToParts(new Date(e)),r=o=>{var i;return Number((i=n.find(l=>l.type===o))==null?void 0:i.value)},s={year:r("year"),month:r("month"),day:r("day"),hour:r("hour")%24,minute:r("minute"),second:r("second")};return Object.values(s).every(Number.isFinite)?s:null}catch{return null}}function Ose(e,t,n){const r=CA(e,n),s=CA(t,n);if(r&&s)return r.year===s.year&&r.month===s.month&&r.day===s.day;const o=new Date(e),i=new Date(t);return o.getFullYear()===i.getFullYear()&&o.getMonth()===i.getMonth()&&o.getDate()===i.getDate()}const EP="any moment";function Ise(e){const t=Math.max(0,Math.floor(e/6e4));if(t<1)return EP;if(t<60)return`${t}m`;const n=Math.floor(t/60);if(n>=24){const r=Math.floor(n/24),s=n%24;return s?`${r}d ${s}h`:`${r}d`}return`${n}h ${t%60}m`}function Dse(e,t=Date.now()){const n=Mse();return(e??[]).map(r=>({key:`${r.span}:${r.qualifier??""}`,name:r.name,used:r.percent,when:Lse(r,t,n)}))}function Lse(e,t,n){if(e.resetsText)return e.resetsAt&&Ose(e.resetsAt,t,e.zone??n)?`Resets ${e.resetsText}`:e.resetsOn?`Resets ${e.resetsOn} at ${e.resetsText}`:`Resets ${e.resetsText}`;if(!e.resetsAt)return null;const r=Ise(e.resetsAt-t);return r===EP?`Resets ${r}`:`Resets in ${r}`}function gv(){return d.jsxs("svg",{className:"match-mark",width:"13",height:"13",viewBox:"0 0 12 12","aria-hidden":"true",children:[d.jsx("circle",{cx:"6",cy:"6",r:"5.2",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),d.jsx("path",{d:"M6 0.8 A5.2 5.2 0 0 1 6 11.2 Z",fill:"currentColor"})]})}const zx=QO,Pse=il,EA=24;function Rl({src:e,name:t,size:n=24}){if(e)return d.jsx("img",{className:"product-mark",src:e,alt:"",width:n,height:n,"aria-hidden":"true"});const r=Array.from({length:EA},(s,o)=>{const i=o/EA*Math.PI*2,l=Math.cos(i),a=Math.sin(i),c=o%2===0?5.6:6.4,u=o%2===0?11:9.6;return d.jsx("line",{x1:12+l*c,y1:12+a*c,x2:12+l*u,y2:12+a*u},o)});return d.jsxs("svg",{className:"product-mark",width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round","aria-hidden":"true",children:[d.jsx("title",{children:t}),r]})}const $se=[{label:"In your inbox",keys:[{keys:["J","↓"],join:"or",what:"Move down the list."},{keys:["K","↑"],join:"or",what:"Move up the list."},{keys:["↵"],what:"Open the task you are on."},{keys:["⌘1","⌘4"],join:"to",what:"Go straight to a section of the sidebar, counting from the top."},{keys:["esc"],what:"Go back one step: a file, then the task, then the list."}]},{label:"In a task you have opened",keys:[{keys:["R"],what:"Write back to the agent."},{keys:["⌘↵"],what:"Send what you have typed."},{keys:["↑","↓"],what:"Move through the options an agent has offered."},{keys:["↵"],what:"Send the option you have selected."},{keys:["1","9"],join:"to",what:"Pick an option by its number."},{keys:["⌘J"],what:"Show or hide this task’s terminal."}]},{label:"Closing, scheduling and undoing",keys:[{keys:["E"],what:"Close the task and take it out of your inbox."},{keys:["S"],what:"Put the task off until a time you pick."},{keys:["Z"],what:"Undo the last thing you did."},{keys:["⌘A"],what:"Tick every task in the list. Press it again to untick."}]},{label:"Anywhere in the app",keys:[{keys:["⌘K"],what:`The command bar: everything ${Le} can do, by name.`},{keys:["N"],what:"Start a new task."},{keys:["/"],what:"Search your tasks."},{keys:["\\"],what:"Show or hide the left sidebar."},{keys:["⌘Y","⌘N"],join:"or",what:"Allow or deny a card asking to run something."}]}],Of={product:"zero:settings",id:"codex-login"};function NP(e){var r;const t=(r=e.match(/^\/Users\/[^/]+/))==null?void 0:r[0];return(t?`~${e.slice(t.length)}`:e).replace(/([0-9a-f]{8})-[0-9a-f-]{20,}/i,"$1…")}function dw({on:e,onChange:t,label:n,busy:r}){return d.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":n,className:`set-sw ${e?"on":""} ${r?"busy":""}`,onClick:()=>t(!e)})}function zse({value:e,min:t,max:n,onChange:r,label:s}){return d.jsxs("div",{className:"set-step","aria-label":s,children:[d.jsx("button",{type:"button","aria-label":`${s}, fewer`,disabled:e<=t,onClick:()=>r(e-1),children:"−"}),d.jsx("span",{className:"val",children:e}),d.jsx("button",{type:"button","aria-label":`${s}, more`,disabled:e>=n,onClick:()=>r(e+1),children:"+"})]})}function _se({value:e,options:t,onChange:n}){return d.jsx("div",{className:"set-seg",children:t.map(r=>d.jsx("button",{type:"button",className:r.value===e?"on":"",onClick:()=>n(r.value),children:r.label},r.value))})}function NA({label:e,value:t,options:n,onChange:r,title:s}){const[o,i]=w.useState(!1),l=w.useRef(null);w.useEffect(()=>{if(!o)return;const c=f=>{l.current&&!l.current.contains(f.target)&&i(!1)},u=f=>{f.key==="Escape"&&i(!1)};return document.addEventListener("mousedown",c),document.addEventListener("keydown",u),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",u)}},[o]);const a=n.find(c=>c.value===t);return d.jsxs("div",{className:`set-picker${o?" open":""}`,children:[d.jsx("div",{className:"set-picker-label",children:e}),d.jsxs("span",{className:"set-picker-wrap",ref:l,children:[d.jsxs("button",{type:"button",className:"set-picker-now",title:s,"aria-haspopup":"listbox","aria-expanded":o,onClick:()=>i(c=>!c),children:[(a==null?void 0:a.label)??t,d.jsx("svg",{className:"set-picker-chev",width:"9",height:"9",viewBox:"0 0 10 10","aria-hidden":"true",children:d.jsx("path",{d:"M2.2 4 L5 6.8 L7.8 4",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})})]}),o&&d.jsx("span",{className:"set-picker-menu",role:"listbox","aria-label":e,children:n.map(c=>d.jsx("button",{type:"button",role:"option","aria-selected":c.value===t,className:`set-picker-row${c.value===t?" on":""}`,onClick:()=>{r(c.value),i(!1)},children:c.label},c.value))})]})]})}function If({label:e,desc:t,value:n,min:r,max:s,step:o,format:i,onChange:l}){const a=(n-r)/(s-r)*100;return d.jsxs("div",{className:"set-row set-dial-row",children:[d.jsxs("div",{className:"set-row-text",children:[d.jsx("div",{className:"set-row-label",children:e}),d.jsx("div",{className:"set-row-desc",children:t})]}),d.jsxs("div",{className:"set-dial",children:[d.jsx("input",{type:"range",className:"set-range",min:r,max:s,step:o,value:n,"aria-label":e,style:{"--fill":`${a}%`},onChange:c=>l(Number(c.currentTarget.value))}),d.jsx("span",{className:"set-dial-val",children:i(n)})]})]})}const Fse=e=>tn.some(t=>t.id===e),Bse=e=>{var t;return((t=tn.find(n=>n.id===e))==null?void 0:t.name)??"Picture"};function xs({label:e,desc:t,children:n}){return d.jsxs("div",{className:"set-row",children:[d.jsxs("div",{className:"set-row-text",children:[d.jsx("div",{className:"set-row-label",children:e}),t&&d.jsx("div",{className:"set-row-desc",children:t})]}),n&&d.jsx("div",{className:"set-row-ctl",children:n})]})}function Hse({cmd:e}){const[t,n]=w.useState(!1);return d.jsx("button",{type:"button",className:"set-copy",title:e,onClick:async()=>{try{await navigator.clipboard.writeText(e),n(!0),window.setTimeout(()=>n(!1),1200)}catch{}},children:t?"Copied":"Copy the command"})}function TA(e,t,n){var s,o,i,l,a;const r=t.find(c=>c.engine===n)??null;return n==="codex"?{engine:n,name:"Codex",reading:r,found:!!((s=e.codex)!=null&&s.found),certain:!!((o=e.codex)!=null&&o.certain),trouble:((i=e.codex)==null?void 0:i.trouble)??null,url:((l=e.codex)==null?void 0:l.url)??"",accounts:(((a=e.codex)==null?void 0:a.accounts)??[]).map(c=>({profile:c.profile,email:c.email,plan:c.plan,chosen:c.chosen,signedIn:c.signedIn,trouble:null,dir:null}))}:{engine:n,name:"Claude Code",reading:r,found:!!e.claudeFound,certain:e.claudeCertain!==!1,trouble:null,url:e.claudeInstallUrl??"",accounts:(e.accounts??[]).map(c=>{var u,f;return{profile:c.profile,email:c.email??null,plan:((u=c.plan)==null?void 0:u.label)??null,chosen:!!c.chosen,signedIn:!!c.email,trouble:((f=c.trouble)==null?void 0:f.note)??null,dir:c.dir??null}})}}function Wse({reading:e,now:t}){var r;const n=(r=e==null?void 0:e.limits)!=null&&r.length?Dse(e.limits,t):[];return n.length?d.jsx(d.Fragment,{children:n.map(s=>d.jsxs("div",{className:"settings-usage-window",children:[d.jsxs("div",{children:[d.jsx("span",{children:s.name}),d.jsxs("span",{children:[s.used,"% used"]})]}),d.jsx("span",{className:"usage-meter wide","aria-hidden":"true",children:d.jsx("i",{style:{width:`${s.used}%`}})}),s.when&&d.jsx("p",{children:s.when})]},s.key))}):d.jsx("p",{className:"ac-none",children:"No usage reading yet"})}function Use({agent:e,now:t,onChoose:n,onAdd:r,onChecked:s,settings:o}){const[i,l]=w.useState(!1),[a,c]=w.useState(null),u=async()=>{l(!0);try{const p=await(e.engine==="codex"?q.recheckCodex():q.recheckClaude());c(p.found),await s()}finally{l(!1)}},f=e.accounts,h=f.some(p=>p.chosen);return d.jsxs("section",{className:"ac-card","aria-label":e.name,children:[d.jsxs("div",{className:"ac-top",children:[d.jsx("span",{className:"ac-name",children:e.name}),!e.found&&d.jsx("span",{className:"ac-warn",children:e.certain?"not on this Mac":"cannot tell"})]}),e.found&&e.trouble&&d.jsx("p",{className:"ac-trouble",children:e.trouble}),d.jsxs("div",{className:"ac-split",children:[d.jsx("div",{className:"ac-usage",children:d.jsx(Wse,{reading:e.reading,now:t})}),d.jsxs("div",{className:"ac-rest",children:[e.found&&d.jsxs("div",{className:"ac-list",children:[f.map(p=>{const m=h?p.chosen:!1,y=p.email??"Not signed in";return p.trouble?d.jsxs("div",{className:"ac-item ac-item-bad",children:[d.jsxs("div",{className:"ac-bad-text",children:[d.jsx("span",{className:"ac-item-mail",children:y}),d.jsx("span",{className:"ac-bad-note",children:p.trouble})]}),p.dir&&d.jsx(Hse,{cmd:`CLAUDE_CONFIG_DIR=${p.dir} claude`})]},p.profile):d.jsxs("button",{type:"button",className:`ac-item ${m?"on":""}`,"aria-pressed":m,onClick:()=>n(e.engine,p.profile),children:[d.jsx("span",{className:"ac-item-mail",children:y}),m&&d.jsx("span",{className:"ac-badge",children:"In use"}),d.jsx("span",{className:"ac-item-end",children:p.plan??(p.signedIn?"":"sign in")})]},p.profile)}),!h&&f.length>1&&d.jsx("p",{className:"ac-hint",children:"Work runs on all of these. Pick one to use it on its own."}),d.jsxs("button",{type:"button",className:"ac-item ac-item-add",onClick:()=>r(e),children:[d.jsx("span",{className:"ac-item-mail",children:"Add account"}),d.jsx("span",{className:"ac-item-end",children:"+"})]})]}),!e.found&&d.jsxs("div",{className:"ac-list",children:[e.certain&&d.jsxs("a",{className:"ac-item ac-item-add",href:e.url,target:"_blank",rel:"noreferrer",children:[d.jsxs("span",{className:"ac-item-mail",children:["Get ",e.name]}),d.jsx("span",{className:"ac-item-end",children:"↗"})]}),d.jsxs("button",{type:"button",className:"ac-item ac-item-add",disabled:i,onClick:u,children:[d.jsx("span",{className:"ac-item-mail",children:i?"Looking…":"Check again"}),d.jsx("span",{className:"ac-item-end",children:a===!1?"still nothing":""})]})]}),e.found&&o&&d.jsx("div",{className:"ac-settings",children:o})]})]})]})}function Vse({command:e}){const t=w.useRef(!1);return w.useEffect(()=>{!e||t.current||(t.current=!0,(async()=>{try{await q.terminal({...Of,action:"open"}),await q.terminal({...Of,action:"write",data:`${e}\r`})}catch{}})())},[e]),d.jsx("div",{className:"ac-shell",children:d.jsx(HR,{product:Of.product,id:Of.id,startOpen:!0})})}const Ks=({label:e,note:t,warn:n,children:r})=>d.jsxs("div",{className:"set-group",children:[e&&d.jsx("div",{className:"set-group-label",children:e}),n&&d.jsx("p",{className:"set-warn set-group-warn",children:n}),d.jsx("div",{className:"set-plate",children:r}),t&&d.jsx("div",{className:"set-group-note",children:t})]});function Kse({keys:e,join:t,what:n}){return d.jsxs("div",{className:"set-key-row",children:[d.jsx("div",{className:"set-key-caps",children:e.map((r,s)=>d.jsxs(w.Fragment,{children:[s>0&&t&&d.jsx("span",{className:"set-key-join",children:t}),d.jsx("kbd",{children:r})]},r))}),d.jsx("div",{className:"set-key-say",children:n})]})}const Df=Gh,qse=ol.map(e=>({value:e,label:Yi[e]})),Yse=Pse.map(e=>({value:e,label:zx[e].label})),Gse=[{value:"all",label:"All of them"},{value:"waiting",label:"Only the stuck ones"},{value:"off",label:"None"}],Jse={all:"Every one of them is a row in your inbox you can read and close. Closing one only takes it out of the inbox.",waiting:"Only the ones that have stopped and are waiting for you to type. The rest run without interrupting you.",off:"None of them reach your inbox. One running in a project’s folder is still in that project’s sidebar, so you can open it from there."};function Qse({project:e,onSaved:t}){const[n,r]=w.useState(e.instructions),[s,o]=w.useState("idle"),[i,l]=w.useState(null),a=w.useRef(null),c=w.useRef(null),u=e.slug,f=w.useRef(e.instructions);f.current=e.instructions,w.useEffect(()=>{r(f.current),o("idle"),l(null),c.current=null},[u]);const h=w.useCallback(async y=>{o("saving");const x=await q.writeProjectInstructions(e.slug,y);x.ok?(c.current=null,o("saved"),l(null),t()):(o("failed"),l(x.error??"could not save"))},[e.slug,t]);w.useEffect(()=>()=>{a.current&&window.clearTimeout(a.current),c.current!==null&&h(c.current)},[e.slug]);const p=y=>{r(y),c.current=y,o("saving"),a.current&&window.clearTimeout(a.current),a.current=window.setTimeout(()=>void h(y),400)},m=s==="failed"?i??"not saved":s==="saving"?"saving…":s==="saved"?"saved":`Every agent on ${e.name} reads this, after your rules.`;return d.jsxs("div",{className:"set-instr",children:[d.jsx("textarea",{spellCheck:!1,value:n,placeholder:`Rules that apply to ${e.name} and nothing else. Agents on other projects never see them.`,onChange:y=>p(y.target.value),onKeyDown:y=>y.stopPropagation()}),d.jsxs("div",{className:"set-instr-foot",children:[d.jsx("span",{children:m}),d.jsxs("span",{className:"set-mono",children:[e.slug,"/instructions.md"]})]})]})}function Xse({project:e,onPick:t,onClear:n}){return d.jsxs("span",{className:"set-icon-pick",children:[d.jsx("button",{type:"button",className:"set-icon-btn",onClick:()=>void t(),title:e.logo?"Change this project’s picture":"Give this project a picture","aria-label":e.logo?`Change the picture for ${e.name}`:`Give ${e.name} a picture`,children:d.jsx(Rl,{src:e.logo,name:e.name,size:26})}),e.logo&&d.jsx("button",{type:"button",className:"set-icon-clear",onClick:()=>void n(),title:"Go back to the default mark","aria-label":`Remove the picture for ${e.name}`,children:d.jsx("svg",{viewBox:"0 0 10 10","aria-hidden":"true",children:d.jsx("path",{d:"M3 3l4 4M7 3l-4 4",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]})}function Zse({project:e,onRename:t}){const[n,r]=w.useState(!1),[s,o]=w.useState(e.name),i=w.useRef(null);if(w.useEffect(()=>{if(!n)return;o(e.name);const a=requestAnimationFrame(()=>{var c,u;(c=i.current)==null||c.focus(),(u=i.current)==null||u.select()});return()=>cancelAnimationFrame(a)},[n,e.name]),!n)return d.jsx("h1",{className:"set-title set-title-edit",tabIndex:0,role:"button",title:"Click to rename this project",onClick:()=>r(!0),onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),r(!0))},children:e.name});const l=()=>{r(!1);const a=s.trim();a&&a!==e.name&&t(a)};return d.jsx("input",{ref:i,className:"set-title set-title-input",value:s,"aria-label":`Name for ${e.name}`,onChange:a=>o(a.target.value),onBlur:l,onKeyDown:a=>{a.stopPropagation(),a.key==="Enter"&&(a.preventDefault(),l()),a.key==="Escape"&&(a.preventDefault(),r(!1))}})}function eoe({projects:e,onOpen:t,onNew:n}){const[r,s]=w.useState(""),o=r.trim().toLowerCase(),i=o?e.filter(a=>a.name.toLowerCase().includes(o)||a.slug.toLowerCase().includes(o)||(a.dir??"").toLowerCase().includes(o)):e,l=a=>a.autonomous?"on its own":null;return d.jsxs(d.Fragment,{children:[d.jsx("h1",{className:"set-title",children:"Projects"}),d.jsxs("p",{className:"set-lede",children:[e.length===1?"One project.":`${e.length} projects.`," Open one to change its picture, its rules and how its agents run."]}),d.jsxs("div",{className:"proj-index-top",children:[d.jsx("input",{className:"proj-index-find",type:"search",value:r,placeholder:"Find a project","aria-label":"Find a project",onChange:a=>s(a.target.value)}),n&&d.jsx("button",{type:"button",className:"set-ghost",onClick:n,children:"New project"})]}),!e.length&&d.jsx("div",{className:"set-nav-empty",children:"No projects yet."}),!!e.length&&!i.length&&d.jsxs("div",{className:"set-nav-empty",children:["Nothing here matches “",r.trim(),"”."]}),d.jsx("div",{className:"proj-index",children:i.map(a=>d.jsxs("button",{type:"button",className:"proj-card",onClick:()=>t(a.slug),children:[d.jsx(Rl,{src:a.logo,name:a.name,size:30}),d.jsxs("span",{className:"proj-card-text",children:[d.jsx("span",{className:"proj-card-name",children:a.name}),d.jsx("span",{className:"proj-card-where",children:NP(a.dir)})]}),a.running>0&&d.jsxs("span",{className:"set-nav-flag",children:[a.running," running"]}),l(a)&&d.jsx("span",{className:"set-nav-flag",children:l(a)})]},a.slug))})]})}function toe({look:e,onSetLook:t,tune:n,onSetTune:r,onResetTune:s,keyHints:o,onSetKeyHints:i,startPane:l,usageReadings:a=[],now:c=Date.now(),embedded:u=!1,onSectionChange:f,onNewProject:h,onClose:p}){var G;const[m,y]=w.useState(null),[x,k]=w.useState(()=>{const I=l||new URLSearchParams(location.search).get("settings")||"";return I==="instructions"||I==="appearance"||I==="general"||I==="shortcuts"||I==="projects"?I:I==="accounts"||I==="agents"?"general":I==="themes"?"appearance":I.startsWith("project:")?{project:I.slice(8)}:"general"});w.useEffect(()=>{f==null||f(x==="instructions"||x==="shortcuts"||x==="projects"?x:typeof x=="object"?"projects":null)},[x]);const[v,b]=w.useState(null),E=w.useCallback(async()=>{const I=await q.settings();y(I),I.ok||b(I.error??"could not read settings")},[]);w.useEffect(()=>{E()},[E]),w.useEffect(()=>{const I=ne=>{ne.key==="Escape"&&(ne.preventDefault(),ne.stopPropagation(),p())};return window.addEventListener("keydown",I,!0),()=>window.removeEventListener("keydown",I,!0)},[p]);const N=w.useCallback(async I=>{const ne=await I;ne.ok?(y(ne),b(null)):b(ne.error??"could not save that")},[]),[T,A]=w.useState(null),R=(I,ne,B)=>N(q.setProjectSetting({product:I,key:ne,value:B})),$=(I,ne)=>N(q.setWorkspaceSetting({key:I,value:ne})),L=(m==null?void 0:m.projects)??[],_=w.useMemo(()=>typeof x=="string"?null:L.find(I=>I.slug===x.project)??null,[x,L]);w.useEffect(()=>{typeof x!="string"&&m&&!_&&k("projects")},[x,m,_]);const j=m==null?void 0:m.workspace,ae=((j==null?void 0:j.engineChoices)??[]).length>1;return d.jsxs("div",{className:`settings-screen${u?" settings-embedded":""}`,"data-pane":typeof x=="string"?x:"project",children:[d.jsxs("div",{className:"set-nav",children:[d.jsxs("div",{className:"set-nav-top",children:[d.jsxs("button",{type:"button",className:"set-nav-back",onClick:p,"aria-label":"Back",children:[d.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",children:d.jsx("path",{d:"M10 3.5L5.5 8l4.5 4.5"})}),d.jsx("span",{children:"esc"})]}),d.jsx("div",{className:"set-nav-title",children:"Settings"})]}),d.jsxs("div",{className:"set-nav-scroll",children:[d.jsx("div",{className:"set-nav-group",children:"Workspace"}),[["general","General"],["appearance","Themes"],["instructions","Instructions"],["shortcuts","Shortcuts"]].map(([I,ne])=>d.jsxs("button",{type:"button",className:`set-nav-item ${x===I?"on":""}`,onClick:()=>k(I),children:[d.jsx("span",{className:"set-nav-label",children:ne}),I==="general"&&j&&j.running>0&&d.jsxs("span",{className:"set-nav-flag",children:[j.running," running"]})]},I)),d.jsxs("div",{className:"set-nav-group np-head",children:[d.jsx("span",{children:"Projects"}),h&&d.jsx("button",{type:"button",className:"np-plus",title:"New project","aria-label":"New project",onClick:h,children:"+"})]}),d.jsxs("button",{type:"button",className:`set-nav-item ${x==="projects"?"on":""}`,onClick:()=>k("projects"),children:[d.jsx("span",{className:"set-nav-label",children:"All projects"}),!!L.length&&d.jsx("span",{className:"set-nav-flag",children:L.length})]}),_&&d.jsxs("button",{type:"button",className:"set-nav-item on",onClick:()=>k({project:_.slug}),children:[d.jsx("span",{className:"set-nav-ico",children:d.jsx(Rl,{src:_.logo,name:_.name,size:15})}),d.jsx("span",{className:"set-nav-label",children:_.name})]}),m&&!L.length&&d.jsx("div",{className:"set-nav-empty",children:"No projects yet."})]}),j&&d.jsx("div",{className:"set-nav-foot",title:j.storePath,children:NP(j.storePath)})]}),d.jsxs("div",{className:"set-pane",children:[x==="instructions"&&d.jsx(jse,{}),v&&v!==yr&&x!=="shortcuts"&&d.jsx("div",{className:"set-error",children:v}),!m&&x!=="shortcuts"&&x!=="instructions"&&d.jsx("div",{className:"set-inner",children:d.jsx("div",{className:"set-lede",children:"Reading settings…"})}),m&&x==="projects"&&d.jsx("div",{className:"set-inner",children:d.jsx(eoe,{projects:L,onOpen:I=>k({project:I}),onNew:h})}),m&&j&&x==="general"&&d.jsxs("div",{className:"set-inner",children:[d.jsx("h1",{className:"set-title",children:"General"}),d.jsx("p",{className:"set-lede",children:"Your usage, your coding agents, how many run at once, and what they are allowed to do."}),j.accountsNote&&d.jsx("p",{className:"ac-note",role:"status",children:j.accountsNote}),d.jsx("div",{className:"ac-cards",children:[TA(j,a,"claude"),...j.codex?[TA(j,a,"codex")]:[]].map(I=>{var ne;return d.jsx(Use,{agent:I,now:c,settings:I.engine==="codex"?d.jsx(d.Fragment,{children:d.jsxs("div",{className:"ac-field",children:[d.jsx(NA,{label:"What it may do",title:"The starting point for every Codex agent. A project can be set to its own.",value:j.codexMode,options:Yse,onChange:B=>$("codexMode",B)}),d.jsx("div",{className:"ac-field-line",children:(ne=zx[j.codexMode])==null?void 0:ne.what})]})}):d.jsx(d.Fragment,{children:d.jsx("div",{className:"ac-field",children:j.permission==="custom"?d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"set-picker-label",children:"Permissions"}),d.jsx("div",{className:"ac-field-line",children:Df.custom})]}):d.jsxs(d.Fragment,{children:[d.jsx(NA,{label:"Permissions",title:"Claude Code's own modes. The starting point for every Claude Code agent, and a single reply can be sent in another.",value:j.permission,options:qse,onChange:B=>$("permission",B)}),d.jsx("div",{className:"ac-field-line",children:Df[j.permission]}),d.jsx("div",{className:"ac-field-line",children:Pk})]})})}),onChoose:(B,J)=>N(q.setWorkspaceSetting({key:"activeAccount",value:{engine:B,profile:J}})),onAdd:async B=>{const J=B.engine==="codex"?await q.addCodexAccount():await q.addClaudeAccount();A(J.ok?{engine:B.engine,name:B.name,command:J.command}:{engine:B.engine,name:B.name,error:J.error}),await E()},onChecked:E},I.engine)})}),T&&d.jsxs("div",{className:"ac-adding",children:[d.jsxs("div",{className:"ac-adding-top",children:[d.jsx("span",{children:T.error?"Could not add an account":`Sign in to ${T.name??"your account"}`}),d.jsx("button",{type:"button",className:"ac-adding-x","aria-label":"Close",onClick:()=>{A(null),E()},children:"×"})]}),T.error?d.jsx("p",{children:T.error}):d.jsxs("p",{children:["Finish signing in below. It opens your browser, and the account lands in the ",T.name??"agent"," ","card when it is done."]}),!T.error&&d.jsx(Vse,{command:T.command})]})]}),m&&j&&x==="general"&&d.jsxs("div",{className:"set-inner",children:[d.jsx(Ks,{label:"Agents",note:j.running?`${j.running} running right now, of ${j.capacity} at once.`:`Nothing running right now. Room for ${j.capacity} at once.`,children:d.jsx(xs,{label:"Agents at once",desc:`${j.sessionsAtOnceFromPlan?`Your plan is ${j.sessionsAtOnceFromPlan}, so ${Le} starts one ${ae?"Claude Code agent ":""}at a time. Put it up whenever you like. `:""}${j.accounts.length>1?`Per account. With ${j.accounts.length} connected, up to ${j.sessionsAtOnce*j.accounts.length} run together. The rest wait in line.`:j.sessionsAtOnce>1?`Up to ${j.sessionsAtOnce} run together. The rest wait in line.`:j.sessionsAtOnceFromPlan?"The rest wait in line.":"One runs at a time. The rest wait in line."}${j.machineNote?` ${j.machineNote}`:""}`,children:d.jsx(zse,{label:"Agents at once",value:j.sessionsAtOnce,min:1,max:j.slotsMax??12,onChange:I=>$("sessionsAtOnce",I)})})}),d.jsx(Ks,{label:"Agents you started yourself",note:`${Pn} reads this Mac every few seconds. An agent you answer in its own terminal leaves your inbox on its own.`,children:d.jsxs("div",{className:"set-row set-row-stack",children:[d.jsx(_se,{value:j.outsideAgents,options:Gse,onChange:I=>$("outsideAgents",I)}),d.jsxs("div",{className:"set-row-desc set-stack-desc",children:["Claude Code you started in a terminal or another app, not from here."," ",Jse[j.outsideAgents]]})]})}),d.jsx(Ks,{label:"Keys",note:"The keys themselves are on the Shortcuts page.",children:d.jsx(xs,{label:"Show keyboard shortcut hints",desc:"Point at a task and its right end says that task's keys. The tabs say the tab key moves between them, and the magnifier and the plus name theirs. Off, none of it is drawn and every key still works.",children:d.jsx(dw,{label:"Show keyboard shortcut hints",on:o,onChange:i})})}),d.jsx(Ks,{label:`Where ${Le} keeps things on this Mac`,children:d.jsx(xs,{label:"Your projects, tasks and documents",desc:j.storePath})}),d.jsx(Ks,{label:`What ${Le} sends`,note:j.diagnosticsDestination?"Turning it off stops both from that moment. It does not delete what was sent before.":"This copy has nowhere to send to, so nothing leaves it either way.",children:d.jsx(xs,{label:"Counts and crash reports",desc:`That ${Le} was opened, that a task was opened, that a reply was sent, and a report when something breaks. Never your code, your prompts, your keys or your paths, and never a title.`,children:d.jsx(dw,{label:"Counts and crash reports",on:j.diagnostics,onChange:I=>$("diagnostics",I)})})})]}),m&&x==="appearance"&&d.jsxs("div",{className:"set-inner",children:[d.jsx("h1",{className:"set-title",children:"Themes"}),d.jsx("p",{className:"set-lede",children:"How the app looks. Also on ⌘K."}),d.jsx("div",{className:"look-row",children:Ns.map(I=>d.jsxs("button",{className:`look${e===I.id?" on":""}`,"aria-pressed":e===I.id,onPointerEnter:()=>void Aa(as(I.id).skin),onFocus:()=>void Aa(as(I.id).skin),onClick:()=>t(I.id),children:[d.jsxs("span",{className:`look-swatch ${I.id}`,"aria-hidden":"true",children:[I.id==="match"&&d.jsx(gv,{}),d.jsx("span",{className:"look-tick","aria-hidden":"true",children:d.jsx("svg",{width:"11",height:"11",viewBox:"0 0 11 11",fill:"none",children:d.jsx("path",{d:"M1.6 5.7 4.2 8.3 9.4 2.7",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),d.jsx("span",{className:"look-name",children:I.name})]},I.id))}),Fse(e)&&d.jsxs(Ks,{label:Bse(e),note:"Changes appear immediately and are saved for this theme.",children:[On[e].panelOpacity!==void 0&&d.jsx(If,{label:e==="orbital-glass"?"Panel tint":"Panel whiteness",desc:"Reduce the tint to let more of the background show through.",value:n.panelOpacity??On[e].panelOpacity,...Fr.panelOpacity,format:I=>`${Math.round(I*100)}%`,onChange:I=>r({...n,panelOpacity:I})}),d.jsx(If,{label:"Foreground blur",desc:"Softens the glass behind your tasks.",value:n.blur,...Fr.blur,format:I=>I===0?"none":`${I}px`,onChange:I=>r({...n,blur:I})}),d.jsx(If,{label:"Background blur",desc:"Softens the whole backdrop, including behind the sidebar.",value:n.backgroundBlur??0,...Fr.backgroundBlur,format:I=>`${I}px`,onChange:I=>r({...n,backgroundBlur:I})}),d.jsx(If,{label:"Darkness",desc:"How far the picture is turned down under the app.",value:n.dim,...Fr.dim,format:I=>`${Math.round(I*100)}%`,onChange:I=>r({...n,dim:I})}),d.jsx(xs,{label:"What it shipped with",desc:`Foreground blur ${On[e].blur}px, background blur ${On[e].backgroundBlur??0}px, darkness ${Math.round(On[e].dim*100)}%${On[e].panelOpacity!==void 0?`, panel whiteness ${Math.round(On[e].panelOpacity*100)}%`:""}.`,children:d.jsx("button",{type:"button",className:"set-ghost",disabled:n.panelOpacity===On[e].panelOpacity&&(n.backgroundBlur??0)===(On[e].backgroundBlur??0)&&n.blur===On[e].blur&&n.dim===On[e].dim,onClick:s,children:"Put it back"})})]})]}),x==="shortcuts"&&d.jsxs("div",{className:"set-inner set-keys-page",children:[d.jsx("h1",{className:"set-title",children:"Shortcuts"}),d.jsx("div",{className:"set-keys-grid",children:$se.map(I=>d.jsxs("div",{className:"set-group",children:[d.jsx("div",{className:"set-group-label",children:I.label}),d.jsx("div",{className:"set-plate set-keys",children:I.keys.map(ne=>d.jsx(Kse,{...ne},ne.keys.join("+")))})]},I.label))})]}),m&&_&&d.jsxs("div",{className:"set-inner",children:[d.jsxs("button",{type:"button",className:"set-crumb",onClick:()=>k("projects"),children:[d.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",children:d.jsx("path",{d:"M10 3.5L5.5 8l4.5 4.5"})}),d.jsx("span",{children:"All projects"})]}),d.jsxs("div",{className:"set-title-row",children:[d.jsx(Xse,{project:_,onPick:()=>N(q.pickProjectIcon({product:_.slug})),onClear:()=>N(q.clearProjectIcon({product:_.slug}))}),d.jsx(Zse,{project:_,onRename:I=>N(q.renameProject({product:_.slug,name:I}))})]}),d.jsx("p",{className:"set-lede",children:"Everything here is this project only. Other projects are unaffected."}),d.jsxs(Ks,{label:"How it runs",children:[d.jsx(xs,{label:"Let agents start the tasks they file here",desc:"A task an agent writes on this project gets a session straight away. Without this it waits in your inbox for your yes. Questions and reviews always wait for you either way.",children:d.jsx(dw,{label:"Let agents start the tasks they file here",on:_.autonomous,onChange:I=>R(_.slug,"autonomous",I)})}),_.permission!=="workspace"&&d.jsx(xs,{label:ae?"This project has its own Claude Code permissions":"This project has its own permissions",desc:_.permission==="custom"?Df.custom:`${Df[_.permission]} ${Pk}`,children:d.jsx("button",{type:"button",className:"set-ghost",onClick:()=>R(_.slug,"permission","workspace"),children:"Use the workspace setting"})}),ae&&_.codexMode!=="workspace"&&d.jsx(xs,{label:"This project has its own Codex permissions",desc:((G=zx[_.codexMode])==null?void 0:G.what)??"",children:d.jsx("button",{type:"button",className:"set-ghost",onClick:()=>R(_.slug,"codexMode","workspace"),children:"Use the workspace setting"})})]}),d.jsx(Ks,{label:"Instructions for this project",note:"A project without any behaves exactly as it did before this screen existed.",children:d.jsx(Qse,{project:_,onSaved:E})}),d.jsxs(Ks,{label:"Where this project is kept on this Mac",children:[d.jsx(xs,{label:"Documents",desc:_.dir}),d.jsx(xs,{label:"Repository",desc:_.repoPath??"No code repo registered for this project."})]})]})]})]})}const noe=e=>tn.some(t=>t.id===e),Lf=(e,t,n)=>Math.min(n,Math.max(t,e)),AA=e=>e===0?"none":`${Math.round(e)}px`,jA=e=>`${Math.round(e*100)}%`,MA={blur:1,dim:.05},roe=()=>d.jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[d.jsx("path",{d:"M1 4v6h6",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"}),d.jsx("path",{d:"M3.51 15a9 9 0 1 0 2.13-9.36L1 10",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})]});function Pf({label:e,value:t,min:n,max:r,step:s,nudge:o,format:i,onChange:l,preset:a,onReset:c}){const u=w.useRef(null),f=w.useRef({}),h=w.useRef(t);h.current=t;const p=w.useRef(!1),[m,y]=w.useState(!1),x=(t-n)/(r-n)*100,k=Math.abs(t-a)>s/2,v=A=>{var _;const R=(_=u.current)==null?void 0:_.getBoundingClientRect();if(!R||R.width===0)return;const $=n+(A-R.left)/R.width*(r-n),L=Math.round($/s)*s;l(Lf(Number(L.toFixed(4)),n,r))},b=A=>l(Lf(Number((h.current+A*o).toFixed(4)),n,r)),E=()=>{clearTimeout(f.current.t),clearInterval(f.current.i),f.current={}},N=A=>{b(A),E(),f.current.t=setTimeout(()=>{f.current.i=setInterval(()=>b(A),100)},400)};w.useEffect(()=>E,[]);const T=A=>d.jsx("button",{type:"button",className:`theme-dial-nudge ${A>0?"more":"less"}`,"aria-label":`${A>0?"More":"Less"} ${e.toLowerCase()}`,onPointerDown:R=>{R.preventDefault(),N(A)},onPointerUp:E,onPointerLeave:E,onPointerCancel:E,children:A>0?"+":"−"});return d.jsxs("div",{className:`theme-dial${m?" live":""}${k?" moved":""}`,children:[T(-1),d.jsx("span",{className:"theme-dial-label",children:e}),d.jsx("span",{className:"theme-dial-val",children:i(t)}),T(1),d.jsx("button",{type:"button",className:"theme-dial-late",tabIndex:k?0:-1,"aria-hidden":!k,title:`Back to ${i(a)}`,"aria-label":`Put ${e.toLowerCase()} back to ${i(a)}`,onClick:c,children:d.jsx(roe,{})}),d.jsx("button",{type:"button",className:"theme-dial-track",role:"slider","aria-label":e,"aria-valuemin":n,"aria-valuemax":r,"aria-valuenow":t,"aria-valuetext":i(t),onPointerDown:A=>{p.current=!0,y(!0),A.currentTarget.setPointerCapture(A.pointerId),v(A.clientX)},onPointerMove:A=>{p.current&&v(A.clientX)},onPointerUp:A=>{p.current=!1,y(!1),A.currentTarget.releasePointerCapture(A.pointerId)},onPointerCancel:()=>{p.current=!1,y(!1)},onKeyDown:A=>{(A.key==="ArrowRight"||A.key==="ArrowUp")&&(A.preventDefault(),A.stopPropagation(),l(Lf(Number((t+s).toFixed(4)),n,r))),(A.key==="ArrowLeft"||A.key==="ArrowDown")&&(A.preventDefault(),A.stopPropagation(),l(Lf(Number((t-s).toFixed(4)),n,r)))},children:d.jsx("span",{className:"theme-dial-line",ref:u,children:d.jsx("i",{style:{width:`${x}%`}})})})]})}function soe({look:e,onSetLook:t,tune:n,onSetTune:r,onClose:s}){const o=w.useRef(null),i=noe(e),l=Math.max(0,Ns.findIndex(f=>f.id===e)),a=(i?On[e]:void 0)??On[tn[0].id],c=w.useRef(l);w.useEffect(()=>{c.current=l},[l]);const u=w.useCallback(f=>{c.current=(c.current+f+Ns.length)%Ns.length,t(Ns[c.current].id)},[t]);return w.useEffect(()=>{var f,h;(h=(f=o.current)==null?void 0:f.querySelector(".look.on"))==null||h.scrollIntoView({block:"nearest",inline:"center"});for(const p of[1,-1])Aa(as(Ns[(l+p+Ns.length)%Ns.length].id).skin)},[l]),w.useEffect(()=>{const f=h=>{var m;const p=h.target;(m=p==null?void 0:p.classList)!=null&&m.contains("theme-dial-track")&&(h.key==="ArrowRight"||h.key==="ArrowLeft"||h.key==="ArrowUp"||h.key==="ArrowDown")||(h.key==="ArrowRight"?(h.preventDefault(),u(1)):h.key==="ArrowLeft"?(h.preventDefault(),u(-1)):(h.key==="Escape"||h.key==="Enter")&&(h.preventDefault(),h.stopPropagation(),s()))};return window.addEventListener("keydown",f,!0),()=>window.removeEventListener("keydown",f,!0)},[u,s]),d.jsx("div",{className:"themes-backdrop",onMouseDown:s,children:d.jsxs("div",{className:"theme-picker",onMouseDown:f=>f.stopPropagation(),role:"dialog","aria-label":"Themes",children:[d.jsx("button",{type:"button",className:"theme-picker-x","aria-label":"Close",onClick:s,children:d.jsx("svg",{width:"11",height:"11",viewBox:"0 0 11 11",fill:"none","aria-hidden":"true",children:d.jsx("path",{d:"M1.6 1.6 9.4 9.4M9.4 1.6 1.6 9.4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),d.jsxs("div",{className:"theme-picker-head",children:[d.jsx("span",{className:"theme-picker-title",children:"Themes"}),i&&d.jsxs("div",{className:"theme-dials",children:[a.panelOpacity!==void 0&&d.jsx(Pf,{label:i==="orbital-glass"?"Panel tint":"Panel whiteness",value:n.panelOpacity??a.panelOpacity,...Fr.panelOpacity,nudge:.05,format:jA,onChange:f=>r({...n,panelOpacity:f}),preset:a.panelOpacity,onReset:()=>r({...n,panelOpacity:a.panelOpacity})}),d.jsx(Pf,{label:"Foreground blur",value:n.blur,...Fr.blur,nudge:MA.blur,format:AA,onChange:f=>r({...n,blur:f}),preset:a.blur,onReset:()=>r({...n,blur:a.blur})}),d.jsx(Pf,{label:"Background blur",value:n.backgroundBlur??0,...Fr.backgroundBlur,nudge:4,format:AA,onChange:f=>r({...n,backgroundBlur:f}),preset:a.backgroundBlur??0,onReset:()=>r({...n,backgroundBlur:a.backgroundBlur??0})}),d.jsx(Pf,{label:"Darkness",value:n.dim,...Fr.dim,nudge:MA.dim,format:jA,onChange:f=>r({...n,dim:f}),preset:a.dim,onReset:()=>r({...n,dim:a.dim})})]})]}),d.jsx("div",{className:"theme-picker-strip",ref:o,children:Ns.map(f=>d.jsxs("button",{className:`look${e===f.id?" on":""}`,"aria-pressed":e===f.id,onPointerEnter:()=>void Aa(as(f.id).skin),onFocus:()=>void Aa(as(f.id).skin),onClick:()=>t(f.id),children:[d.jsxs("span",{className:`look-swatch ${f.id}`,"aria-hidden":"true",children:[f.id==="match"&&d.jsx(gv,{}),d.jsx("span",{className:"look-tick","aria-hidden":"true",children:d.jsx("svg",{width:"11",height:"11",viewBox:"0 0 11 11",fill:"none",children:d.jsx("path",{d:"M1.6 5.7 4.2 8.3 9.4 2.7",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),d.jsx("span",{className:"look-name",children:f.name})]},f.id))})]})})}function ooe({title:e,subtitle:t,placeholder:n,hintWhenRefused:r,options:s,parse:o,previewOf:i,onChoose:l,onClose:a}){const[c,u]=w.useState(""),[f,h]=w.useState(0),[p,m]=w.useState(!1),y=w.useRef(null),x=o(c);w.useEffect(()=>{var v;return(v=y.current)==null?void 0:v.focus()},[]);const k=()=>{const v=C4(c,x);if(v==="typed"&&x)l(x.value,x.label);else if(v==="selected"){const b=s[f];b&&l(b.value,b.label.toLowerCase())}else m(!0)};return d.jsx("div",{className:"modal-backdrop",onClick:v=>{v.stopPropagation(),a()},children:d.jsxs("div",{className:"modal snooze",onClick:v=>v.stopPropagation(),children:[d.jsx("div",{className:"modal-title",children:e}),t&&d.jsx("div",{className:"modal-subtitle",children:t}),d.jsxs("div",{className:"snooze-input-row",children:[d.jsx("input",{ref:y,className:"palette-input snooze-input",value:c,placeholder:n,onChange:v=>{u(v.target.value),m(!1)},onKeyDown:v=>{v.stopPropagation(),v.key==="Escape"&&a(),v.key==="Enter"&&k(),v.key==="ArrowDown"&&(v.preventDefault(),h(b=>Math.min(b+1,s.length-1))),v.key==="ArrowUp"&&(v.preventDefault(),h(b=>Math.max(0,b-1)))}}),c&&d.jsx("span",{className:`snooze-preview ${x?"":"invalid"}`,children:x?i(x.value):"not a time"})]}),p&&d.jsxs("div",{className:"snooze-refused",children:[Pn,' did not understand "',c.trim(),'", so nothing was set. ',r]}),d.jsx("div",{className:"palette-list",children:s.map((v,b)=>d.jsxs("div",{className:`palette-item ${!c&&b===f?"selected":""}`,onClick:()=>l(v.value,v.label.toLowerCase()),onMouseMove:()=>h(b),children:[d.jsx("span",{children:v.label}),d.jsx("span",{className:"palette-hint",children:v.hint??""})]},v.label))})]})})}function ioe(e=Date.now()){const t=[];t.push({label:"In 30 minutes",ts:e+30*6e4}),t.push({label:"In 4 hours",ts:e+4*36e5});const n=new Date(e);n.setHours(18,0,0,0),n.getTime()>e&&t.push({label:"This evening",ts:n.getTime()});const r=new Date(e+864e5);r.setHours(8,0,0,0),t.push({label:"Tomorrow",ts:r.getTime()});const s=new Date(e);return s.setDate(s.getDate()+((1-s.getDay()+7)%7||7)),s.setHours(8,0,0,0),t.push({label:"Next week",ts:s.getTime()}),t}const RA=e=>new Date(e).toLocaleString(void 0,{weekday:"short",hour:"numeric",minute:"2-digit"}).toUpperCase();function loe({item:e,count:t=1,onPick:n,onNow:r,onClose:s}){const o=w.useMemo(()=>{const i=ioe();return r?[{label:"Now (back to inbox)",ts:0,now:!0},...i]:i},[r]);return d.jsx(ooe,{title:"Schedule",subtitle:t>1?`${t} items`:e.title,placeholder:"Try: 30m, 3h, 8am, tomorrow, next week",hintWhenRefused:"Try 30m, 3h, 8am, tomorrow, or next week.",options:o.map(i=>({label:i.label,value:i.ts,hint:i.now?"":RA(i.ts)})),parse:i=>{const l=vR(i);return l?{value:l.ts,label:l.label}:null},previewOf:i=>RA(i),onChoose:(i,l)=>{i===0&&r?r():n(i,l)},onClose:s})}function aoe({working:e,onCompose:t,onAgents:n}){return d.jsx("div",{className:"zero-state idle",children:d.jsxs("div",{className:"idle-zero-col",children:[d.jsx("b",{className:"idle-zero",children:"0"}),d.jsxs("span",{className:"idle-zero-say",children:["Inbox zero",e>0&&d.jsxs(d.Fragment,{children:[" · ",d.jsx("button",{className:"idle-zero-agents",onClick:n,children:e===1?"one agent working":`${e} agents working`})]})]}),d.jsxs("button",{className:"idle-field",onClick:t,children:[d.jsx("span",{className:"idle-ph",children:"What do you need done?"}),d.jsx("span",{className:"idle-key",children:"N"})]})]})})}function coe(e,t,n){const r=Array.isArray(e)?e.filter(Boolean):[],s=t?r.find(i=>i.id===t.id)??((n==null?void 0:n.id)===t.id?n:null):null;if(s)return{card:s,verdict:t.allow?"allow":"deny",waiting:r.filter(i=>i.id!==s.id).length};const o=r[0]??null;return{card:o,verdict:null,waiting:o?r.length-1:0}}const OA=`${Pn} could not read what this asks for.`;function uoe(e,t){const n=/^mcp__(.+)__(.+)$/.exec(t??"");if(n){const s=`${n[1]} / ${n[2]}`;let o=OA;if(e&&typeof e=="object"&&!Array.isArray(e))try{const i=Object.entries(e).map(([l,a])=>{const c=JSON.stringify(a,null,2);if(c===void 0)throw new Error("Unreadable argument");return`${l}: ${c}`});o=i.length?i.join(`
681
+
682
+ `):"No arguments."}catch{}return{what:"asks to use",body:`${s}
683
+
684
+ ${o}`}}const r=e??{};return typeof r.changes=="string"&&r.changes?{what:"asks to change",body:r.changes}:typeof r.command=="string"?{what:"asks to run",body:r.command}:typeof r.host=="string"&&r.host?{what:"asks to reach",body:r.host}:typeof r.file_path=="string"?{what:"asks to run",body:r.file_path}:{what:"asks to run",body:OA}}const doe=new Set(["r","s","c","n","/"]);function foe(e){return doe.has(e.toLowerCase())}const hoe=new Set(["reply"]);function poe(e){return e&&hoe.has(e)?null:e}const TP={modal:null,settings:!1,importAgents:!1,newProject:!1};function moe(e){return TP}const goe=700;function yoe(e,t={}){const n=t.wait??goe;let r;const s=()=>{r&&clearTimeout(r),r=void 0};return{point(o){s(),e(null),o!==null&&(r=setTimeout(()=>{r=void 0,e(o)},n))},stop(){s(),e(null)}}}function woe(e){return e.length<=1?[e]:e==="esc"?[e]:[...e]}const fw={"new-task":[{key:"N",what:"New task"}],sidebar:[{key:"\\",what:"Show or hide the sidebar"}],"section-1":[{key:"⌘1",what:"Go to this section"}],"section-2":[{key:"⌘2",what:"Go to this section"}],"section-3":[{key:"⌘3",what:"Go to this section"}],"section-4":[{key:"⌘4",what:"Go to this section"}],row:[{key:"↵",what:"Open task"},{key:"E",what:"Mark done"},{key:"S",what:"Schedule for later"}],commands:[{key:"⌘K",what:"Everything by name"}],search:[{key:"/",what:"Search your tasks"}],terminal:[{key:"⌘J",what:"Show or hide the terminal"}],back:[{key:"esc",what:"Go back one level"}]},hw=7,pw=8;function koe(e,t,n,r="left",s,o=0){if(e.width<=0&&e.height<=0)return null;const i=e.bottom+hw+t.height>n.height-pw,l=i?e.top-hw-t.height:e.bottom+hw,a=r==="right"?e.right-t.width:s?s.left-o:e.left,c=Math.max(pw,Math.min(a,n.width-t.width-pw));return{top:Math.round(l),left:Math.round(c),rose:i}}function IA(e){return e>=1&&e<=4?`section-${e}`:void 0}function xoe({lines:e,comp:t,align:n,text:r}){const s=w.useRef(null),[o,i]=w.useState(null);return w.useLayoutEffect(()=>{const l=s.current;if(!l)return;const a=l.getBoundingClientRect(),c=getComputedStyle(l),u=parseFloat(c.paddingLeft||"0")+parseFloat(c.borderLeftWidth||"0");i(koe(t,{width:a.width,height:a.height},{width:window.innerWidth,height:window.innerHeight},n??"left",r?{left:r.left}:void 0,u))},[t,r,n,e]),d.jsx("div",{ref:s,className:"hint-plate","aria-hidden":"true",style:o?{top:o.top,left:o.left}:{top:0,left:0,opacity:0,visibility:"hidden"},children:e.map(l=>d.jsxs("div",{className:"hint-line",children:[d.jsx("span",{className:"hint-caps",children:woe(l.key).map((a,c)=>d.jsx("kbd",{children:a},`${a}-${c}`))}),d.jsx("span",{className:"hint-what",children:l.what})]},l.key))})}const boe=[{id:"plain",label:"Nothing up there",note:"A 34 point strip with nothing in it, and the task starts under it. This is what is on the branch now."},{id:"line",label:"The row’s own line up top",note:"The product, the kind and the age move up into the strip, and the line under the title goes. The title starts 23 points higher."},{id:"edge",label:"No strip at all",note:"The task begins at the very top of the window. You can still drag the window by the same band, it is just not drawn."},{id:"card",label:"The task on a card",note:"The same 3 point corner and 22 point padding the inbox card has, so the task is an object on the ground rather than the window."},{id:"wide",label:"The words take the width",note:"The reading column goes from 780 to 980 points and centres in the space it actually has."},{id:"header",label:"A real header",note:"A 56 point band carrying the title and the age, and the big title in the body goes. The header stays while you scroll."}],AP="zero.taskShape",voe="data-task-shape",Soe="plain";function jP(e){return boe.some(t=>t.id===e)?e:Soe}function Coe(e,t=document.documentElement){t.setAttribute(voe,e)}function MP(){return d.jsx("svg",{className:"compose-glyph",width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinecap:"round","aria-hidden":"true",children:d.jsx("path",{d:"M12 4.4v15.2M4.4 12h15.2"})})}function Eoe(){return d.jsxs("svg",{className:"compose-glyph",width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[d.jsx("path",{d:"M4.5 8h8M16.5 8h3M4.5 16h3M11.5 16h8"}),d.jsx("circle",{cx:"14.5",cy:"8",r:"2"}),d.jsx("circle",{cx:"9.5",cy:"16",r:"2"})]})}function _x({view:e}){return d.jsxs("svg",{className:"workspace-nav-icon",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e==="inbox"&&d.jsxs(d.Fragment,{children:[d.jsx("path",{d:"M4.5 13.2 6.7 6.4A2 2 0 0 1 8.6 5h6.8a2 2 0 0 1 1.9 1.4l2.2 6.8V17a2 2 0 0 1-2 2h-11a2 2 0 0 1-2-2z"}),d.jsx("path",{d:"M4.5 13.2h4.1l1.1 2.1h4.6l1.1-2.1h4.1"})]}),e==="snoozed"&&d.jsxs(d.Fragment,{children:[d.jsx("rect",{x:"4.5",y:"5.5",width:"15",height:"14",rx:"3"}),d.jsx("path",{d:"M8.5 3.8V7M15.5 3.8V7M4.5 10h15"}),d.jsx("circle",{cx:"15.2",cy:"15",r:"1.1",fill:"currentColor",stroke:"none"})]}),e==="progress"&&d.jsxs(d.Fragment,{children:[d.jsx("path",{d:"M12 4.5a7.5 7.5 0 1 1-7.5 7.5"}),d.jsx("path",{d:"M4.5 12A7.5 7.5 0 0 1 12 4.5",opacity:".3"})]}),e==="done"&&d.jsxs(d.Fragment,{children:[d.jsx("rect",{x:"4.5",y:"10",width:"15",height:"9.5",rx:"2"}),d.jsx("path",{d:"M6.5 7h11M8.5 4.5h7"})]})]})}function Noe(e){return d.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[d.jsx("rect",{x:"3.8",y:"5",width:"16.4",height:"14",rx:"3.2"}),d.jsx("path",{d:"M9.6 5v14"})]})}function RP(){return d.jsxs("svg",{className:"compose-glyph",width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinecap:"round","aria-hidden":"true",children:[d.jsx("circle",{cx:"10.8",cy:"10.8",r:"6.6"}),d.jsx("path",{d:"M15.6 15.6 20 20"})]})}function Toe({inFullScreen:e=!1,walking:t=!1}={}){return!0}function Aoe(e){return{inbox:"Inbox",snoozed:"Scheduled",progress:"In progress",done:"Closed"}[e]??"Inbox"}function OP({scheduledCount:e=0,view:t="inbox"}={}){const n=Number.isFinite(e)?Math.max(0,Math.floor(e)):0;return[["inbox","Inbox"],["progress","In progress"],...n>0||t==="snoozed"?[["snoozed","Scheduled"]]:[],["done","Closed"]]}function DA({searching:e=!1,workspaceNavigation:t=!1,focused:n=!1,settingsOpen:r=!1}={}){return e?!(t&&n&&!r):!1}function joe(e){return!e.metaKey||e.altKey||e.ctrlKey||e.shiftKey||e.repeat||e.defaultPrevented?0:/^[1-4]$/.test(e.key)?Number(e.key):0}function Moe({view:e,collapsed:t,onToggle:n,onView:r,onSearch:s,onCompose:o,inboxCount:i=0,scheduledCount:l=0,usage:a,onSettings:c,onInstructions:u,page:f}){const h=Number.isFinite(i)?Math.max(0,Math.floor(i)):0,p=`${h} ${h===1?"task":"tasks"} waiting`,m=Number.isFinite(l)?Math.max(0,Math.floor(l)):0,y=OP({scheduledCount:m,view:e}),x=N=>N==="inbox"?h:0,k=N=>p,v=["snoozed","done"],b=([N,T],A)=>d.jsxs("button",{"data-tab":N,"data-hint":IA(A+1),"data-hint-text":"span",className:`workspace-tab${!f&&e===N?" active":""}${x(N)>0?" has-count":""}`,"aria-label":T,"aria-current":!f&&e===N?"page":void 0,title:x(N)>0?`${T} · ${k()}`:t?T:void 0,onClick:()=>r(N),children:[d.jsx(_x,{view:N}),d.jsx("span",{children:T}),x(N)>0&&d.jsx("small",{className:"workspace-running","aria-label":k(),children:x(N)})]},N),E=([N,T],A)=>d.jsxs("button",{"data-tab":N,"data-hint":IA(A+1),"data-hint-text":"span","aria-label":T,"aria-current":!f&&e===N?"page":void 0,title:t?T:void 0,onClick:()=>r(N),children:[d.jsx(_x,{view:N}),d.jsx("span",{children:T})]},N);return d.jsxs("aside",{className:"workspace-navigation","aria-label":"Workspace",children:[d.jsxs("button",{className:"workspace-search","data-hint":"search","data-hint-text":"span",title:"Search tasks (/)","aria-label":"Search tasks",onClick:s,children:[d.jsx(RP,{}),d.jsx("span",{children:"Search"}),d.jsx("kbd",{children:"/"})]}),d.jsx("div",{className:"workspace-section",children:d.jsx("span",{children:"Workspace"})}),d.jsx("nav",{className:"workspace-tabs","aria-label":"Tasks",children:y.map((N,T)=>v.includes(N[0])?null:b(N,T))}),d.jsxs("div",{className:"workspace-bottom",children:[d.jsxs("div",{className:"workspace-utilities",children:[y.map((N,T)=>v.includes(N[0])?E(N,T):null),u&&d.jsxs("button",{"aria-label":"Instructions","aria-current":f==="instructions"?"page":void 0,title:"Instructions for every agent",onClick:u,children:[d.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.3","aria-hidden":"true",children:d.jsx("path",{d:"M6 3.5h8l4 4V20H6zM14 3.5V8h4M9 12h6M9 16h6"})}),d.jsx("span",{children:"Instructions"})]}),c&&d.jsxs("button",{"aria-label":"Settings","aria-current":f==="settings"?"page":void 0,title:"Settings",onClick:c,children:[d.jsx(Eoe,{}),d.jsx("span",{children:"Settings"})]})]}),a&&d.jsx("div",{className:"workspace-usage",children:a}),d.jsxs("div",{className:"workspace-footer",children:[d.jsxs("button",{className:"workspace-create","data-hint":"new-task",title:"New task (N)",onClick:o,children:[d.jsx(MP,{}),d.jsx("span",{children:"New task"})]}),d.jsx("button",{className:"workspace-toggle","data-hint":"sidebar","data-hint-align":"right","aria-label":t?"Expand sidebar":"Collapse sidebar",title:t?"Expand sidebar":"Collapse sidebar",onClick:n,children:d.jsx(Noe,{collapsed:t})})]})]})]})}const Roe=1300;function Ooe(){const[e,t]=w.useState(null),[n,r]=w.useState(!1);return w.useEffect(()=>{var i,l;let s=0;return((l=(i=window.zero)==null?void 0:i.onZoomPercent)==null?void 0:l.call(i,a=>{const c=Number(a==null?void 0:a.percent);Number.isFinite(c)&&t({percent:c,stamp:++s})}))??(()=>{})},[]),w.useEffect(()=>{if(!e)return;r(!0);const s=setTimeout(()=>r(!1),Roe);return()=>clearTimeout(s)},[e]),e?d.jsxs("div",{className:`zoom-readout${n?" up":""}`,children:[e.percent,"%"]}):null}const Ioe="['‘’]",Doe='["“”]';function Loe(e){const t=e.trim();if(!t)return null;let n="";for(const r of t.split(/(\s+)/))if(r){if(/^\s+$/.test(r)){n+="\\s+";continue}for(const s of r)s==="'"||s==="‘"||s==="’"?n+=Ioe:s==='"'||s==="“"||s==="”"?n+=Doe:n+=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}return new RegExp(n,"gi")}function Poe(e,t){const n=Loe(t);if(!n)return[];const r=[];for(const s of e.matchAll(n))s[0].length!==0&&r.push([s.index,s.index+s[0].length]);return r}const $oe="\0";function zoe(e,t){let n="";const r=[];e.forEach((o,i)=>{i>0&&o.block!==e[i-1].block&&(n+=$oe),r.push(n.length),n+=o.text});const s=(o,i)=>{let l=0,a=e.length-1;for(;l<a;){const c=l+a+1>>1;(i?r[c]>=o:r[c]>o)?a=c-1:l=c}return l};return Poe(n,t).map(([o,i])=>{const l=s(o,!1),a=s(i,!0);return{startRun:l,startOffset:o-r[l],endRun:a,endOffset:i-r[a]}})}function _oe(e,t,n){return t<=0?-1:e<0?n===1?0:t-1:(e+n+t)%t}function Foe(e,t,n){return n.trim()?t===0?"No matches":`${Math.max(0,e)+1} of ${t}`:""}const Boe=new Set(["A","ABBR","B","BDI","BDO","CITE","CODE","DATA","DEL","DFN","EM","I","INS","KBD","LABEL","MARK","Q","S","SAMP","SMALL","SPAN","STRONG","SUB","SUP","TIME","U","VAR"]),Hoe=new Set(["SCRIPT","STYLE","NOSCRIPT","TEMPLATE","TEXTAREA","SVG"]);function Woe(e){let t=e;for(;t&&Boe.has(t.tagName);)t=t.parentElement;return t}function Uoe(){const e=[],t=[],n=new Map,r=o=>{let i=n.get(o);if(i===void 0){const l=o.checkVisibility;i=typeof l=="function"?l.call(o,{visibilityProperty:!0,checkVisibilityCSS:!0}):!0,n.set(o,i)}return i},s=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,{acceptNode(o){const i=o.parentElement;return!i||!o.nodeValue||Hoe.has(i.tagName.toUpperCase())||i.closest("[data-find-bar]")?NodeFilter.FILTER_REJECT:r(i)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}});for(let o=s.nextNode();o;o=s.nextNode()){const i=o;e.push({text:i.nodeValue??"",block:Woe(i.parentElement)}),t.push(i)}return{runs:e,nodes:t}}function mw(e){const{runs:t,nodes:n}=Uoe();return zoe(t,e).map(r=>{const s=document.createRange();return s.setStart(n[r.startRun],r.startOffset),s.setEnd(n[r.endRun],r.endOffset),s})}const IP="find-match",Fx="find-current";function Voe(e,t){const n=CSS.highlights,r=window.Highlight;!n||!r||(n.set(IP,new r(...e)),t>=0&&e[t]?n.set(Fx,new r(e[t])):n.delete(Fx))}function LA(){const e=CSS.highlights;e==null||e.delete(IP),e==null||e.delete(Fx)}const DP=e=>{const t=e.getBoundingClientRect();return t.height>0&&t.bottom>0&&t.top<window.innerHeight};function PA(e){if(!e||DP(e))return;const t=e.startContainer.parentElement;t==null||t.scrollIntoView({block:"center",inline:"nearest"})}function Koe(){const[e,t]=w.useState(!1),[n,r]=w.useState(""),[s,o]=w.useState(-1),[i,l]=w.useState(0),a=w.useRef(null),c=w.useRef([]),u=w.useRef(-1),f=w.useRef(null),h=w.useRef(!1),p=w.useRef(""),m=(b,E)=>{c.current=b,u.current=E,l(b.length),o(E),Voe(b,E)},y=w.useCallback(b=>{const E=b.trim()?mw(b):[],N=E.findIndex(DP),T=E.length===0?-1:N>=0?N:0;m(E,T),PA(E[T])},[]),x=w.useCallback(b=>{const E=p.current.trim()?mw(p.current):[],N=_oe(Math.min(u.current,E.length-1),E.length,b);m(E,N),PA(E[N])},[]),k=w.useCallback(()=>{h.current=!1,t(!1),LA(),c.current=[],u.current=-1;const b=f.current;f.current=null,b&&b.isConnected&&typeof b.focus=="function"&&b.focus()},[]);if(w.useEffect(()=>{var E,N;return((N=(E=window.zero)==null?void 0:E.onFind)==null?void 0:N.call(E,T=>{const A=Number(T==null?void 0:T.step)||0;if(!h.current){const R=document.activeElement;f.current=R&&!R.closest("[data-find-bar]")?R:null,h.current=!0,t(!0)}requestAnimationFrame(()=>{var R,$;(R=a.current)==null||R.focus(),A===0?($=a.current)==null||$.select():x(A>0?1:-1)})}))??(()=>{})},[x]),w.useEffect(()=>{if(p.current=n,!e)return;const b=setTimeout(()=>y(n),60);return()=>clearTimeout(b)},[n,e,y]),w.useEffect(()=>{if(!e)return;let b=null;const E=new MutationObserver(N=>{!N.some(A=>{const R=A.target.nodeType===Node.ELEMENT_NODE?A.target:A.target.parentElement;return!(R!=null&&R.closest("[data-find-bar]"))})||!p.current.trim()||(b&&clearTimeout(b),b=setTimeout(()=>{const A=mw(p.current);m(A,A.length===0?-1:Math.min(Math.max(u.current,0),A.length-1))},200))});return E.observe(document.body,{childList:!0,subtree:!0,characterData:!0}),()=>{E.disconnect(),b&&clearTimeout(b)}},[e]),w.useEffect(()=>()=>LA(),[]),!e)return null;const v=Foe(s,i,n);return d.jsxs("div",{className:"find-bar","data-find-bar":!0,role:"search",children:[d.jsx("input",{ref:a,className:"find-input",value:n,placeholder:"Find",spellCheck:!1,"aria-label":"Find on this screen",onChange:b=>r(b.target.value),onKeyDown:b=>{b.key==="Escape"?(b.preventDefault(),b.stopPropagation(),k()):b.key==="Enter"&&(b.preventDefault(),b.stopPropagation(),x(b.shiftKey?-1:1))}}),d.jsx("span",{className:`find-count${i===0&&n.trim()?" none":""}`,children:v}),d.jsx("button",{type:"button",className:"find-step","aria-label":"Previous match",disabled:i===0,onClick:()=>x(-1),children:"↑"}),d.jsx("button",{type:"button",className:"find-step","aria-label":"Next match",disabled:i===0,onClick:()=>x(1),children:"↓"}),d.jsx("button",{type:"button",className:"find-step","aria-label":"Close",onClick:k,children:"×"})]})}function qoe(e,t){const n=e.filter(r=>r.slug===t.product);return n.length||!t.product?n:[{slug:t.product,name:t.name,repoPath:t.folder}]}function Yoe(){return d.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:d.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"})})}function Goe(){return d.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round","aria-hidden":"true",children:d.jsx("path",{d:"M12 5v14M5 12h14"})})}function Joe(){return d.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:d.jsx("path",{d:"M4 12.5 9.5 18 20 6.5"})})}function Qoe({run:e,blocked:t,onLeave:n}){const[r,s]=w.useState(!1);return w.useEffect(()=>{if(!r)return;const o=i=>{i.key!=="Escape"||i.metaKey||i.ctrlKey||i.altKey||(i.preventDefault(),i.stopPropagation(),i.stopImmediatePropagation(),s(!1))};return window.addEventListener("keydown",o,!0),()=>window.removeEventListener("keydown",o,!0)},[r]),t||!hv(e)?null:d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:"fr-out",onClick:()=>s(!0),children:Ee.leave}),r&&d.jsx("div",{className:"fr-stay-scrim",role:"dialog","aria-modal":"true","aria-label":Ee.leaveHead,children:d.jsxs("div",{className:"fr-stay",children:[d.jsx("div",{className:"fr-stay-head",children:Ee.leaveHead}),d.jsx("div",{className:"fr-stay-line",children:Ee.leaveLine}),d.jsxs("div",{className:"fr-stay-row",children:[d.jsx("button",{type:"button",className:"fr-stay-go",autoFocus:!0,onClick:n,children:Ee.leaveGo}),d.jsx("button",{type:"button",className:"fr-stay-keep",onClick:()=>s(!1),children:Ee.leaveStay})]})]})})]})}function LP(e){const t=e.getBoundingClientRect();if(!t.width||!t.height)return null;const n={x:t.left,y:t.top,w:t.width,h:t.height};return[...e.childNodes].some(s=>s.nodeType===3&&(s.nodeValue??"").trim()!=="")?n:cre(n,[...e.children].map(s=>{const o=s.getBoundingClientRect();return{x:o.left,y:o.top,w:o.width,h:o.height,position:getComputedStyle(s).position}}))}function Xoe(e){const t=e.parentElement;return t?[...t.children].filter(n=>n!==e&&getComputedStyle(n).position==="static").map(n=>LP(n)).filter(n=>n!==null):[]}function Zoe(e,t,n){const r=typeof document.elementsFromPoint=="function"?document.elementsFromPoint(e,t):[document.elementFromPoint(e,t)].filter(Boolean);for(const s of r){if(s.closest(".fr-tether, .fr-ring, .fr-out")||n&&(s===n||n.contains(s)||s.contains(n)))continue;if([...s.childNodes].some(i=>i.nodeType===3&&(i.nodeValue??"").trim()!==""))return s.getBoundingClientRect()}return null}function $A(e){for(const t of e){const n=document.querySelector(t);if(n)return n}return null}function el({cap:e,className:t}){const n=nre(e);return d.jsxs("kbd",{className:t,children:[e,n?d.jsx("span",{className:"fr-cap-word",children:n}):null]})}function zA({say:e,beat:t,pointed:n,knock:r=0}){const[s,o]=w.useState(0),[i,l]=w.useState(!1),a=w.useRef({beat:[],pointed:null});a.current={beat:t??[],pointed:n??null},w.useEffect(()=>{if(o(0),l(!1),!e.key)return;let u=!0,f=setTimeout(()=>{u&&l(!0)},oA);const h=p=>{if(Bp(p.target)&&Fp(p)!==null){if(l(!1),clearTimeout(f),f=setTimeout(()=>{u&&l(!0)},oA),Fp(p)===e.key&&Gne(a.current.beat,a.current.pointed)){o(m=>m+1),Bp(p.target)&&(p.preventDefault(),p.stopPropagation(),p.stopImmediatePropagation());return}mP(e.key,p)&&(o(m=>m+1),ore(e.key,p,p.target)&&(p.preventDefault(),p.stopPropagation(),p.stopImmediatePropagation()))}};return window.addEventListener("keydown",h,!0),()=>{u=!1,clearTimeout(f),window.removeEventListener("keydown",h,!0)}},[e.key]);const c=s+r;return d.jsxs(d.Fragment,{children:[e.quiet?d.jsx("span",{className:"fr-quiet",children:e.quiet}):null,d.jsxs("span",{className:e.quiet?"fr-loud":"fr-loud fr-alone",children:[e.lead,e.key&&d.jsx(el,{cap:e.key,className:`${c?"fr-wrong":""}${i?" fr-breathe":""}`.trim()||void 0},c),e.tail]}),e.caps&&e.key?d.jsx(eie,{of:e.caps,cap:e.key,left:t==null?void 0:t.length}):null]})}function eie({of:e,cap:t,left:n}){const[r,s]=w.useState(e);w.useEffect(()=>{if(n!==void 0)return;const l=()=>s(document.querySelectorAll(".list-pane .row").length);l();const a=setInterval(l,200);return()=>clearInterval(a)},[n]);const i=Math.max(0,Math.min(e,e-(n??r)));return d.jsx("span",{className:"fr-lights","aria-hidden":"true",children:Array.from({length:e},(l,a)=>d.jsx("kbd",{className:a<i?"fr-lit":void 0,children:t},a))})}function tie(e,t=null){if(!e)return 0;e.style.removeProperty("--fr-lift");const n=e.getBoundingClientRect(),r=Math.round(n.bottom-window.innerHeight+Up),s=t&&!t.below?Math.round(n.bottom-(t.ring.y-Hp)):0,o=Math.max(r,s);if(o<=0)return 0;const i=Math.min(o,Math.max(0,n.top-Up));return i<=0?0:(e.style.setProperty("--fr-lift",`${-i}px`),i)}function gw(){for(const t of document.querySelectorAll("[data-fr-room]"))t.removeAttribute("data-fr-room");const e=document.querySelector(".list-pane");e==null||e.style.removeProperty("--fr-room")}function _A(e,t=".tabs"){const n=[...document.querySelectorAll(t)],r=n.length?n[n.length-1].getBoundingClientRect().right:0;return Math.round(Math.max(e.ring.x+e.ring.w+10,r)+26)}function nie(e){if(!e)return 0;e.style.removeProperty("--fr-drop");const n=(()=>{const s=e.getBoundingClientRect();let o=null;for(const i of document.querySelectorAll(Sre)){const l=i.getBoundingClientRect();if(l.width<8||l.height<8||!(s.left<l.right&&s.right>l.left))continue;const a=Math.round(s.top-l.bottom);a>=-40&&a<200&&(o===null||a<o)&&(o=a)}return o})();if(n===null||n>=Up)return 0;const r=Up-n;return e.style.setProperty("--fr-drop",`${r}px`),r}function Bx({box:e,knocked:t=""}){if(!e)return d.jsx("div",{className:`fr-veil${t}`,"aria-hidden":"true"});const n=Math.round(e.x+e.w/2),r=Math.round(e.y+e.h/2),s=Math.round(e.w/2+26),o=Math.round(e.h/2+26),i=`radial-gradient(${s+150}px ${o+150}px at ${n}px ${r}px, rgba(0,0,0,0) 0%, rgba(0,0,0,0) ${Math.round(100*s/(s+150))}%, rgba(0,0,0,1) 100%)`;return d.jsx("div",{className:`fr-veil${t}`,style:{WebkitMaskImage:i,maskImage:i},"aria-hidden":"true"})}function rie({selector:e,boundsSel:t,underSel:n,makesRoom:r,say:s,beside:o,besideRing:i,besideOf:l,beat:a,pointed:c,hold:u,also:f}){const[h,p]=w.useState(null),m=w.useRef(null),[y,x]=w.useState(0);w.useEffect(()=>{x(0)},[e.join("|")]),w.useLayoutEffect(()=>{let E=!0;const N=()=>{if(!E)return;const A=$A(e);if(!A){p(null);return}const R=[...document.querySelectorAll(".modal-backdrop")];if(R.length&&!R.some(I=>I.contains(A))){p(null);return}const $=LP(A);if(!$){p(null);return}const L=t?document.querySelector(t):null,_=L?L.getBoundingClientRect():null,j={w:window.innerWidth,h:window.innerHeight},F=fre($,Xoe(A)),ae=xre($,{left:_?_.left:0,right:_?_.right:j.w},j,F),G=n&&!r?document.querySelector(n):null;if(G&&(ae.text.y=Math.round(G.getBoundingClientRect().bottom+wP($)+Hp)),ae.below&&!G&&!r)for(let I=0;I<4;I+=1){const B=[ae.text.x+4,ae.text.x+Math.min(ae.text.w,300)/2,ae.text.x+Math.min(ae.text.w,300)-4].map(M=>Zoe(M,ae.text.y+Wp/2,A)).filter(Boolean);if(!B.length)break;const J=bre(ae.text.y,Wp,B,j);if(J===ae.text.y)break;ae.text.y=J}p(ae),gw()};N();const T=setInterval(N,200);return window.addEventListener("resize",N),()=>{E=!1,clearInterval(T),window.removeEventListener("resize",N)}},[e.join("|"),t,n,r]),w.useLayoutEffect(()=>{gw()}),w.useLayoutEffect(()=>()=>gw(),[]);const k=w.useRef(!1);if(k.current=!!h,w.useEffect(()=>{if(!u)return;const E=N=>{if(!k.current)return;const T=[$A(e),...(f??[]).flatMap(A=>[...document.querySelectorAll(A)])];are(N.target,T)&&(N.stopPropagation(),N.stopImmediatePropagation(),N.type==="click"&&(N.preventDefault(),x(A=>A+1)))};for(const N of iA)window.addEventListener(N,E,!0);return()=>{for(const N of iA)window.removeEventListener(N,E,!0)}},[u,e.join("|"),(f??[]).join("|")]),w.useLayoutEffect(()=>{nie(m.current),tie(m.current,h)}),!h)return null;const v=10,b=y?" fr-knock":"";return d.jsxs(d.Fragment,{children:[d.jsx(Bx,{box:h.ring,knocked:b},y),d.jsx("svg",{className:"fr-ring",style:{left:h.ring.x-v,top:h.ring.y-v},width:h.ring.w+v*2,height:h.ring.h+v*2,"aria-hidden":"true",children:d.jsx("rect",{className:`halo${b}`,x:v,y:v,width:h.ring.w,height:h.ring.h,rx:h.ring.r},y)}),o?d.jsx("p",{ref:m,className:"fr-tether beside",style:{left:i?Math.round(h.ring.x+h.ring.w+26):_A(h,l),top:h.ring.y+h.ring.h/2,maxWidth:i?Math.max(240,window.innerWidth-(h.ring.x+h.ring.w+26)-40):Math.max(240,window.innerWidth-_A(h,l)-200)},role:"status",children:d.jsx(zA,{say:s,beat:a,pointed:c,knock:y})}):d.jsx("p",{ref:m,className:h.text.right===null?"fr-tether":"fr-tether right",style:h.text.right===null?{left:h.text.x,top:h.text.y,maxWidth:h.text.w}:{right:h.text.right,top:h.text.y,maxWidth:h.text.w},role:"status",children:d.jsx(zA,{say:s,beat:a,pointed:c,knock:y})})]})}function sie({found:e,folders:t,claude:n,products:r,project:s,onDone:o,onFiled:i,onProjectMade:l,onRecheck:a}){e&&Um(e)||t!=null&&t.some(y=>y.count>0);const c=Qne(n,{read:e!==null&&t!==null}),[u,f]=w.useState(!1),[h,p]=w.useState(!1),m=async()=>{if(!u){f(!0);try{p(await a())}finally{f(!1)}}};return c.show?c.blocked?d.jsxs(d.Fragment,{children:[d.jsx(Bx,{box:null}),d.jsxs("div",{className:c.blocked?"fr-finish gate":"fr-finish",role:"status",children:[d.jsx("h1",{className:"fr-finish-head",children:c.head}),d.jsx("p",{className:"fr-finish-line",children:c.line}),c.blocked&&d.jsxs(d.Fragment,{children:[d.jsx("p",{className:"fr-gate-do",children:Ee.gateDo}),d.jsxs("div",{className:"fr-gate-acts",children:[d.jsx("a",{className:"fr-finish-go",href:n.url,target:"_blank",rel:"noreferrer",autoFocus:!0,children:Ee.missingLink}),d.jsx("button",{className:"fr-gate-again",onClick:m,disabled:u,children:u?Ee.gateChecking:Ee.gateCheck})]}),h&&!u&&d.jsx("p",{className:"fr-gate-still",children:Ee.gateStill})]})]})]}):d.jsxs(d.Fragment,{children:[d.jsx(Bx,{box:null}),d.jsx(xP,{products:r,filter:s,walk:{line:Ee.agentsOffer,skip:Ee.finishGo,onSkip:()=>o([]),folders:t},onDone:i,onProjectMade:l,onNewProject:()=>{},onClose:()=>{}})]}):null}const oie=5200;function iie({agents:e,onGone:t}){const n=w.useRef(Array.from({length:40},(r,s)=>({left:4+s*97%92,delay:s*53%40/100,drift:s*31%120-60,spin:s*71%540-270,hue:[199,267,42,158,12][s%5],fall:62+s*17%26})));return w.useEffect(()=>{const r=setTimeout(t,oie),s=()=>t(),o=setTimeout(()=>window.addEventListener("keydown",s),0);return()=>{clearTimeout(r),clearTimeout(o),window.removeEventListener("keydown",s)}},[t]),d.jsxs("div",{className:"fr-landed","aria-live":"polite",children:[d.jsx("div",{className:"fr-burst","aria-hidden":"true",children:n.current.map((r,s)=>d.jsx("span",{className:"fr-bit",style:{left:`${r.left}%`,animationDelay:`${r.delay}s`,"--fr-drift":`${r.drift}px`,"--fr-spin":`${r.spin}deg`,"--fr-fall":`${r.fall}vh`,background:`hsl(${r.hue} 78% 62%)`}},s))}),d.jsxs("div",{className:"fr-landed-say",children:[d.jsx("h1",{className:"fr-landed-head",children:Ee.finishHead}),d.jsx("p",{className:"fr-landed-line",children:e?Ee.finishLineAgents:Ee.finishLine})]})]})}function lie(){return d.jsxs("div",{className:"fr-band",role:"note",children:[d.jsx("div",{className:"fr-band-drag","aria-hidden":"true"}),d.jsxs("span",{className:"fr-band-pill",children:[d.jsx("span",{className:"fr-band-dot","aria-hidden":"true"}),d.jsx("span",{className:"fr-band-tag",children:Ee.bandTag}),d.jsx("span",{className:"fr-band-say",children:Ee.band})]})]})}function Hx({count:e=0,on:t="inbox"}){const n=(r,s,o=t===r)=>d.jsxs("button",{className:`workspace-tab${o?" active":""}${r==="inbox"&&e>0?" has-count":""}`,type:"button",tabIndex:-1,children:[d.jsx(_x,{view:r}),d.jsx("span",{children:s}),r==="inbox"&&e>0&&d.jsx("small",{className:"workspace-running",children:e})]});return d.jsxs("div",{className:"workspace-navigation fr-piece-nav","aria-hidden":"true",children:[d.jsxs("nav",{className:"workspace-tabs",children:[n("inbox","Inbox"),n("progress","In progress")]}),d.jsx("div",{className:"fr-piece-nav-foot",children:n("done","Closed")})]})}const Vp=[{title:"Moved the pricing page onto the new layout.",result:"Screens match the design at all three widths. Ready to merge.",agoMs:38*6e4,project:"Storefront"},{title:"Which push provider should the app use?",result:"Two work. One is free up to ten thousand devices, the other has better delivery reports.",agoMs:44*6e4,project:"Mobile"},{title:"Wrote the migration guide for version two.",result:"Every renamed option has an example. I left the CLI section for you.",agoMs:52*6e4,project:"Docs"},{title:"Upgraded the database driver.",result:"All 412 tests pass. Connection time is down by about a third.",agoMs:61*6e4,project:"Storefront"}],FA=[{title:"Add rate limiting to the public API.",step:"Writing tests for the burst case.",project:"Storefront"},{title:"Port the settings screen to SwiftUI.",step:"Reading the old view controller.",project:"Mobile"},{title:"Find why checkout is slow on Safari.",step:"Profiling the payment form.",project:"Storefront"},{title:"Document the webhook retries.",step:"Drafting the examples.",project:"Docs"},{title:"Upgrade to React 19.",step:"Fixing two type errors in the cart.",project:"Storefront"},{title:"Add offline mode to the reader.",step:"Caching the last ten articles.",project:"Mobile"},{title:"Split the search index by locale.",step:"Rebuilding the French index.",project:"Docs"}];function aie({kind:e}){return e==="progress"?d.jsxs("div",{className:"fr-piece fr-piece-with-nav","aria-hidden":"true",children:[d.jsx(Hx,{on:"progress",count:3}),d.jsx("div",{className:"list-pane",children:d.jsxs("div",{className:"list",children:[d.jsx("div",{children:d.jsx("div",{className:"day-label",children:"Working now"})}),FA.map(t=>d.jsxs("div",{className:"row",children:[d.jsxs("div",{className:"row-main",children:[d.jsx("div",{className:"subject",children:t.title}),d.jsx("div",{className:"preview",children:t.step})]}),d.jsx("div",{className:"row-end",children:d.jsx("span",{className:"product",children:t.project})})]},t.title))]})})]}):e==="ask"?d.jsx("div",{className:"fr-piece fr-piece-ask","aria-hidden":"true",children:d.jsxs("div",{className:"modal compose",children:[d.jsx("div",{className:"compose-text",children:dv.title}),d.jsxs("div",{className:"compose-sentence quiet rest-project",children:[d.jsx("span",{className:"compose-clauses",children:d.jsxs("span",{className:"clause clause-project",children:["For ",Dx,"."]})}),d.jsxs("button",{className:"dock-send",type:"button",tabIndex:-1,children:["Start it ",d.jsx("kbd",{children:"⌘↵"})]})]})]})}):d.jsxs("div",{className:"fr-piece fr-piece-with-nav","aria-hidden":"true",children:[d.jsx(Hx,{count:e==="list"?Qa.length+Vp.length:0}),e==="list"?d.jsx("div",{className:"list-pane",children:d.jsxs("div",{className:"list",children:[d.jsx("div",{children:d.jsx("div",{className:"day-label",children:"Today"})}),[...Qa.map(t=>({...t,project:Dx})),...Vp].map(t=>d.jsxs("div",{className:"row",children:[d.jsxs("div",{className:"row-main",children:[d.jsx("div",{className:"subject",children:t.title}),d.jsx("div",{className:"preview",children:t.result})]}),d.jsxs("div",{className:"row-end",children:[d.jsx("span",{className:"product",children:t.project}),d.jsxs("span",{className:"time",children:[Math.round(t.agoMs/6e4),"m"]})]})]},t.title))]})}):d.jsx("div",{className:"list-pane bare fr-piece-empty",children:d.jsx("div",{className:"zero-state idle",children:d.jsxs("div",{className:"idle-zero-col",children:[d.jsx("b",{className:"idle-zero",children:"0"}),d.jsxs("span",{className:"idle-zero-say",children:["Inbox zero · ",FA.length," agents working"]}),d.jsxs("span",{className:"idle-field",children:[d.jsx("span",{className:"idle-ph",children:"What do you need done?"}),d.jsx("span",{className:"idle-key",children:"N"})]})]})})})]})}function cie(){return d.jsx("div",{className:"fr-look-app","aria-hidden":"true",children:d.jsxs("div",{className:"body",children:[d.jsx(Hx,{count:Qa.length+Vp.length}),d.jsx("div",{className:"list-pane",children:d.jsxs("div",{className:"list",children:[d.jsx("div",{children:d.jsx("div",{className:"day-label",children:"Today"})}),[...Qa.map(e=>({...e,project:Dx})),...Vp].map(e=>d.jsxs("div",{className:"row",children:[d.jsxs("div",{className:"row-main",children:[d.jsx("div",{className:"subject",children:e.title}),d.jsx("div",{className:"preview",children:e.result})]}),d.jsxs("div",{className:"row-end",children:[d.jsx("span",{className:"product",children:e.project}),d.jsxs("span",{className:"time",children:[Math.round(e.agoMs/6e4),"m"]})]})]},e.title))]})})]})})}const uie=["dark","light"];function die({look:e,onPick:t,onNext:n}){var u;w.useEffect(()=>{const f=p=>{p.key==="Enter"&&(p.preventDefault(),n())},h=setTimeout(()=>window.addEventListener("keydown",f),0);return()=>{clearTimeout(h),window.removeEventListener("keydown",f)}},[n]);const r=bP(e),[s,o]=w.useState(()=>{const f=tn.findIndex(h=>h.id===r);return f===-1?Math.max(0,tn.findIndex(h=>h.id===ed)):f});w.useEffect(()=>{r!==e&&tn.some(f=>f.id===r)&&t(r)},[]);const i=w.useRef([]),l=()=>{if(!i.current.length){i.current=tn.map((h,p)=>p).filter(h=>h!==s);for(let h=i.current.length-1;h>0;h--){const p=Math.floor(Math.random()*(h+1));[i.current[h],i.current[p]]=[i.current[p],i.current[h]]}}const f=i.current.pop();o(f),t(tn[f].id)},a=tn[s].id===$x?ed:$x,c=[{id:tn[s].id,name:tn[s].name},{id:a,name:((u=tn.find(f=>f.id===a))==null?void 0:u.name)??String(a)},...uie.map(f=>{var h;return{id:f,name:((h=Ns.find(p=>p.id===f))==null?void 0:h.name)??f}})];return d.jsxs("div",{className:"fr-screen fr-screen-look",children:[d.jsx(cie,{}),d.jsx("div",{className:"fr-look-veil","aria-hidden":"true"}),d.jsxs("div",{className:"fr-look-mid",children:[d.jsx("h1",{className:"fr-look-q",children:Ee.lookQ}),d.jsx("div",{className:"look-row fr-look-row",children:c.map(f=>d.jsxs("button",{className:`look${e===f.id?" on":""}`,"aria-pressed":e===f.id,onClick:()=>t(f.id),children:[d.jsxs("span",{className:`look-swatch shot ${f.id}`,"aria-hidden":"true",children:[f.id==="match"&&d.jsx(gv,{}),d.jsx("span",{className:"look-tick","aria-hidden":"true",children:d.jsx(Joe,{})})]}),d.jsx("span",{className:"look-name",children:f.name})]},f.id))}),d.jsx("button",{className:"fr-look-more",onClick:l,children:Ee.lookMore}),d.jsx("p",{className:"fr-look-clause",children:Ee.lookClause}),d.jsxs("button",{className:"fr-go",onClick:n,children:[Ee.lookGo," ",d.jsx(el,{cap:"↵"})]})]})]})}function fie({n:e,head:t,line:n,piece:r,onNext:s}){return w.useEffect(()=>{const o=l=>{l.key==="Enter"&&(l.preventDefault(),s())},i=setTimeout(()=>window.addEventListener("keydown",o),0);return()=>{clearTimeout(i),window.removeEventListener("keydown",o)}},[s]),d.jsxs("div",{className:"fr-screen fr-screen-intro",children:[d.jsxs("div",{className:"fr-brand",children:[d.jsx(Rl,{name:Le,size:18}),Le]}),d.jsx(aie,{kind:r}),d.jsxs("div",{className:"fr-corner",children:[d.jsxs("div",{children:[d.jsx("div",{className:"fr-intro-on",children:Ee.introOn(e,Ee.intro.length)}),d.jsx("h1",{className:"fr-head",children:t}),d.jsx("p",{className:"fr-intro-line",children:n})]}),d.jsxs("button",{className:"fr-go",onClick:s,children:[Ee.introNext," ",d.jsx(el,{cap:"↵"})]})]})]})}function hie({head:e,line:t,go:n,onNext:r}){return w.useEffect(()=>{const s=i=>{i.key==="Enter"&&(i.preventDefault(),r())},o=setTimeout(()=>window.addEventListener("keydown",s),0);return()=>{clearTimeout(o),window.removeEventListener("keydown",s)}},[r]),d.jsxs("div",{className:"fr-screen",children:[d.jsxs("div",{className:"fr-brand",children:[d.jsx(Rl,{name:Le,size:18}),Le]}),d.jsx("div",{className:"fr-stack",children:d.jsxs("div",{className:"fr-finish",role:"status",children:[d.jsx("h1",{className:"fr-finish-head",children:e}),d.jsx("p",{className:"fr-finish-line",children:t}),d.jsx("button",{className:"fr-finish-go",onClick:r,autoFocus:!0,children:n})]})})]})}function pie({run:e,claude:t,home:n,opened:r,waiting:s,later:o,picking:i,palette:l,view:a,tabs:c,look:u,products:f=[],beat:h,pointed:p,onEvent:m,onStep:y,onSkipToApp:x,onPractice:k,onDone:v,onFiled:b,onProjectMade:E,onRecheck:N,onSetLook:T}){const A=w.useRef(null),[R,$]=w.useState(!1),[L,_]=w.useState(null),[j,F]=w.useState(null),[ae,G]=w.useState(!1),[I,ne]=w.useState(null),[B,J]=w.useState(0),M=e.step==="welcome"||e.step==="folder";w.useEffect(()=>{if(!M||I)return;let se=!0;return qi(async()=>{const{api:he}=await Promise.resolve().then(()=>nf);return{api:he}},void 0,import.meta.url).then(({api:he})=>he.agentThreads()).then(he=>{se&&ne(Pne(he,{home:n}))}).catch(()=>{se&&ne([])}),()=>{se=!1}},[M,I,n]);const[Q,ce]=w.useState(()=>Date.now()),[C,re]=w.useState(null),[W,V]=w.useState(0),[Se,ye]=w.useState(null),De=se=>{const he=jre(se);he&&y(he)};w.useEffect(()=>{if(e.step!=="working")return;const se=setInterval(()=>ce(Date.now()),1e3);return()=>clearInterval(se)},[e.step]),w.useEffect(()=>{var se;e.step==="name"&&((se=A.current)==null||se.focus())},[e.step]);const Te=Lne(e.step),le=Dre(C);w.useEffect(()=>{if(e.step!=="command"&&e.step!=="done"||!le)return;let se=!0;return(async()=>{const{api:he}=await qi(async()=>{const{api:tt}=await Promise.resolve().then(()=>nf);return{api:tt}},void 0,import.meta.url),ve=await he.agentFiles({folder:e.folder,product:e.product});if(!se)return;const He={user:ve.user,project:ve.project};Pre(C,He)&&re(He)})(),()=>{se=!1}},[e.step,e.folder,e.product,C,le,W]),w.useEffect(()=>{if(e.step!=="done"||Se)return;let se=!0;return(async()=>{const{api:he}=await qi(async()=>{const{api:He}=await Promise.resolve().then(()=>nf);return{api:He}},void 0,import.meta.url);let ve=[];try{ve=await he.agentFolders()}catch{ve=[]}se&&ye(ve)})(),()=>{se=!1}},[e.step,Se]),w.useEffect(()=>{if(e.step!=="welcome")return;const se=he=>{he.key==="Enter"&&(he.preventDefault(),m({t:"start"}))};return window.addEventListener("keydown",se),()=>window.removeEventListener("keydown",se)},[e.step,m]);const K=(I==null?void 0:I.length)??0;w.useEffect(()=>{if(e.step!=="folder"||I===null)return;const se=ve=>{ve.key==="ArrowDown"&&(ve.preventDefault(),J(He=>Math.min(K,He+1))),ve.key==="ArrowUp"&&(ve.preventDefault(),J(He=>Math.max(0,He-1))),ve.key==="Enter"&&(ve.preventDefault(),B<K&&I[B]?U(I[B].folder):me())},he=setTimeout(()=>window.addEventListener("keydown",se),0);return()=>{clearTimeout(he),window.removeEventListener("keydown",se)}});const me=async()=>{const{api:se}=await qi(async()=>{const{api:tt}=await Promise.resolve().then(()=>nf);return{api:tt}},void 0,import.meta.url),{path:he,refused:ve,browse:He}=await se.chooseFolder(e.folder??void 0);if(He){F(null),G(!0);return}if(ve){F(ve);return}he&&U(he)},U=se=>{F(null),m({t:"folder",path:se}),y("name")},we=async()=>{if(!(!e.name.trim()||R)){$(!0),_(null);try{const se=await x({name:e.name.trim(),folder:e.folder});se&&_(se)}finally{$(!1)}}};if(e.step==="look")return d.jsx(die,{look:u,onPick:T,onNext:()=>De("look")});const Oe=Rre[e.step];if(Oe!=null){const se=Ee.intro[Oe];return d.jsx(fie,{n:Oe+1,head:se.head,line:se.line,piece:se.piece,onNext:()=>De(e.step)})}if(e.step==="hand")return d.jsx(hie,{head:Ee.handHead,line:Ee.handLine,go:Ee.handGo,onNext:k});if(gP.includes(e.step)){const se=pP(e.step,e.sentAt?Q-e.sentAt:0,{opened:r,view:a,picking:i,palette:l,left:h==null?void 0:h.length,tabs:c});if(!se)return null;const he=(e.step==="working"||e.step==="open")&&e.item,ve=e.step==="where"?Lx(c,a):null,He=e.step==="clear"?(h==null?void 0:h[0])??null:null,tt=he?[`.list-pane .row[data-item-id="${e.item}"]`,...Ql[e.step]??[]]:He?[`.list-pane .row[data-item-id="${He}"]`,...Ql.clear??[]]:e.step==="unblock"&&s&&!r?[`.list-pane .row[data-item-id="${s}"]`,...Ql.unblock??[]]:e.step==="snooze"&&o&&!i?[`.list-pane .row[data-item-id="${o}"]`,...Ql.snooze??[]]:ve?[`.workspace-navigation [data-tab="${ve}"]`,`.tabs .tab[data-tab="${ve}"]`,...Ql.where??[]]:Ql[e.step];return!tt||!tt.length?null:d.jsx(rie,{selector:tt,beside:e.step==="where"||e.step==="command"&&!!l,besideRing:e.step==="command"&&!!l,besideOf:e.step==="where"?".workspace-navigation, .tabs":void 0,boundsSel:vre[e.step],underSel:e.step==="snooze"&&i?".modal.snooze":lA[e.step],makesRoom:(e.step==="clear"||e.step==="snooze"&&!i)&&!!lA[e.step],say:se,beat:h,pointed:p,hold:hv(e),also:lre[e.step]})}if(e.step==="done")return d.jsx(sie,{found:C,folders:Se,claude:t,products:qoe(f,e),project:e.product,onDone:v,onFiled:b,onProjectMade:E,onRecheck:async()=>{const se=N?await N():!0;return se||(re(he=>Lre(he,se)),ye(he=>$re(he,se)),V(he=>he+1)),se}});if(e.step==="landed")return null;const Ie=e.folder?fP(e.folder,n):null,ct=Te&&d.jsx("button",{type:"button",className:"back-esc fr-back",onClick:()=>y(Te),"aria-label":Ee.back,title:Ee.back,children:d.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",children:d.jsx("path",{d:"M10 3.5L5.5 8l4.5 4.5"})})});return d.jsxs("div",{className:ct?"fr-screen has-back":"fr-screen",children:[ct,d.jsxs("div",{className:"fr-brand",children:[d.jsx(Rl,{name:Le,size:18}),Le]}),e.step==="welcome"&&d.jsxs("div",{className:"fr-corner",children:[d.jsxs("div",{children:[d.jsx("h1",{className:"fr-head",children:Ee.head}),d.jsx("p",{className:"fr-sub",children:Ee.headSub})]}),d.jsxs("button",{className:"fr-go",onClick:()=>m({t:"start"}),children:[Ee.getStarted," ",d.jsx(el,{cap:"↵"})]})]}),ae&&d.jsx(dP,{startIn:e.folder??null,onPick:se=>{G(!1),U(se)},onClose:()=>G(!1)}),e.step==="folder"&&d.jsxs("div",{className:"fr-stack fr-stack-folders",children:[d.jsx("h1",{className:"fr-page",children:Ee.folderHead}),d.jsx("p",{className:"fr-lede",children:Ee.folderLede}),d.jsxs("div",{className:"fr-card fr-folders",role:"listbox","aria-label":Ee.folderHead,children:[I&&I.length>0&&d.jsx("div",{className:"fr-folders-label",children:Ee.folderRecent}),(I??[]).map((se,he)=>d.jsxs("button",{type:"button",role:"option","aria-selected":B===he,className:`fr-folder${B===he?" lit":""}${e.folder===se.folder?" on":""}`,onMouseEnter:()=>J(he),onClick:()=>U(se.folder),children:[d.jsx("span",{className:"fr-fold",children:d.jsx(Yoe,{})}),d.jsx("span",{className:"fr-folder-name",children:se.name}),d.jsx("span",{className:"fr-folder-path",children:se.short}),d.jsx("span",{className:"fr-folder-via",children:se.via.map(ve=>Ee.folderVia[ve]).join(" · ")}),d.jsx("span",{className:"fr-folder-key",children:B===he&&d.jsx(el,{cap:"↵"})})]},se.folder)),d.jsxs("button",{type:"button",role:"option","aria-selected":B===((I==null?void 0:I.length)??0),className:`fr-folder fr-folder-other${B===((I==null?void 0:I.length)??0)?" lit":""}`,onMouseEnter:()=>J((I==null?void 0:I.length)??0),onClick:me,children:[d.jsx("span",{className:"fr-fold",children:d.jsx(Goe,{})}),d.jsx("span",{className:"fr-folder-name",children:I&&I.length?Ee.folderOther:Ee.folderFirst}),d.jsx("span",{className:"fr-folder-key",children:B===((I==null?void 0:I.length)??0)&&d.jsx(el,{cap:"↵"})})]})]}),j&&d.jsx("p",{className:"fr-note fr-refused",children:j})]}),e.step==="name"&&d.jsxs("div",{className:"fr-stack fr-stack-folders",children:[d.jsx("h1",{className:"fr-page",children:Ee.nameQ}),d.jsxs("p",{className:"fr-lede",children:[Ee.nameIn," ",d.jsx("span",{className:"fr-lede-path",children:Ie}),"."," ",d.jsx("button",{type:"button",className:"fr-lede-link",onClick:()=>y("folder"),children:Ee.nameChange})]}),d.jsxs("div",{className:"fr-card fr-name-card",children:[d.jsx("input",{ref:A,className:"fr-name",value:e.name,spellCheck:!1,onChange:se=>{_(null),m({t:"name",name:se.target.value})},onKeyDown:se=>{se.key==="Enter"&&(se.preventDefault(),we())}}),d.jsxs("button",{className:"fr-submit",onClick:we,disabled:!e.name.trim()||R,children:[Ee.nameGo," ",d.jsx(el,{cap:"↵"})]})]}),L&&d.jsx("p",{className:"fr-note fr-notmade",role:"alert",children:L})]})]})}const mie=["a","b","e"];function gie(e){return e&&mie.includes(e)?e:null}const qs={page:"What may your agents do?",q:"While you are not watching.",note:"You can change this any time, for everything or for one message.",rules:Pk,finishQ:"What your agents may do.",tick:"Recommended"};function yie({modes:e,value:t,onPick:n}){return d.jsx("div",{className:"fr-list fr-modes",children:e.map(r=>d.jsxs("button",{className:r===t?"fr-agent fr-mode on":"fr-agent fr-mode",onClick:()=>n(r),children:[d.jsx("span",{className:"fr-tick",children:d.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:d.jsx("path",{d:"M4 12.5 9.5 18 20 6.5"})})}),d.jsxs("span",{className:"grow",children:[d.jsx("span",{className:"fr-agent-name",children:Yi[r]}),d.jsx("span",{className:"fr-agent-line",children:Gh[r]})]})]},r))})}function wie({variant:e,value:t,onPick:n}){return d.jsxs("div",{className:"fr-screen",children:[d.jsxs("div",{className:"fr-brand",children:[d.jsx(Rl,{name:Le,size:18}),Le]}),e==="a"&&d.jsxs("div",{className:"fr-stack",children:[d.jsx("h1",{className:"fr-page",children:qs.page}),d.jsxs("div",{className:"fr-card",children:[d.jsx("div",{className:"fr-q",children:qs.q}),d.jsx(yie,{modes:ol,value:t,onPick:n}),d.jsx("button",{className:"fr-submit",children:Ee.submit})]}),d.jsx("p",{className:"fr-note",children:qs.note}),d.jsx("p",{className:"fr-note",style:{marginTop:6},children:qs.rules})]}),e==="b"&&d.jsxs("div",{className:"fr-stack",children:[d.jsx("h1",{className:"fr-page",children:qs.page}),d.jsxs("div",{className:"fr-card",children:[d.jsxs("div",{className:"fr-switch",children:[d.jsxs("button",{className:t==="bypassPermissions"?"fr-side":"fr-side on",onClick:()=>n("auto"),children:[Yi.auto,d.jsx("span",{className:"fr-side-n",children:qs.tick})]}),d.jsx("button",{className:t==="bypassPermissions"?"fr-side on":"fr-side",onClick:()=>n("bypassPermissions"),children:Yi.bypassPermissions})]}),d.jsx("p",{className:"fr-q",style:{padding:"12px 18px 16px"},children:Gh[t==="bypassPermissions"?"bypassPermissions":"auto"]}),d.jsx("button",{className:"fr-submit",children:Ee.submit})]}),d.jsx("p",{className:"fr-note",children:"Manual, Accept edits, Plan and Don't ask are in Settings, with everything else."}),d.jsx("p",{className:"fr-note",style:{marginTop:6},children:qs.rules})]}),e==="e"&&d.jsx(d.Fragment,{children:d.jsxs("div",{className:"fr-finish wide",role:"status",children:[d.jsx("h1",{className:"fr-finish-head",children:Ee.finishHead}),d.jsx("p",{className:"fr-finish-line",children:Ee.finishLine}),d.jsxs("div",{className:"fr-offer",children:[d.jsx("div",{className:"fr-offer-say",children:qs.finishQ}),d.jsxs("div",{className:"fr-switch",role:"tablist",children:[d.jsx("button",{role:"tab","aria-selected":t!=="bypassPermissions",className:t==="bypassPermissions"?"fr-side":"fr-side on",onClick:()=>n("auto"),children:Yi.auto}),d.jsx("button",{role:"tab","aria-selected":t==="bypassPermissions",className:t==="bypassPermissions"?"fr-side on":"fr-side",onClick:()=>n("bypassPermissions"),children:Yi.bypassPermissions})]}),d.jsxs("p",{className:"fr-offer-read",children:[Gh[t==="bypassPermissions"?"bypassPermissions":"auto"]," ",qs.rules]})]}),d.jsxs("div",{className:"fr-offer",children:[d.jsx("div",{className:"fr-offer-say",children:Ee.agentsOffer}),d.jsxs("div",{className:"fr-switch",role:"tablist",children:[d.jsxs("button",{role:"tab","aria-selected":!0,className:"fr-side on",children:[Ee.agentsAll,d.jsx("span",{className:"fr-side-n",children:"3"})]}),d.jsxs("button",{role:"tab","aria-selected":!1,className:"fr-side",children:[Ee.agentsHere,d.jsx("span",{className:"fr-side-n",children:"0"})]})]}),d.jsx("div",{className:"fr-list",children:[["Leon Okafor QA",`QA agent that embodies the persona of Leon Okafor, a founder being onboarded to ${Le}.`],["Localhost QA","Validate frontend changes against the running app."],["Docs Reviewer","Review developer documentation for accuracy against the codebase."]].map(([r,s])=>d.jsxs("button",{className:"fr-agent on",children:[d.jsx("span",{className:"fr-tick",children:d.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:d.jsx("path",{d:"M4 12.5 9.5 18 20 6.5"})})}),d.jsxs("span",{className:"grow",children:[d.jsx("span",{className:"fr-agent-name",children:r}),d.jsx("span",{className:"fr-agent-line",children:s})]})]},r))}),d.jsx("p",{className:"fr-offer-read",children:Ee.agentsRead})]}),d.jsx("button",{className:"fr-finish-go",children:Ee.finishGo})]})})]})}function kie(e,t){return!e||e.step!=="answer"||t?null:e.item??"no-task"}function xie(e,t){return!!t&&e!==t}function bie({onStart:e,onNot:t}){const n=w.useRef(null);return w.useEffect(()=>{const r=s=>{s.key!=="Escape"||s.metaKey||s.ctrlKey||s.altKey||(s.preventDefault(),s.stopPropagation(),s.stopImmediatePropagation(),t())};return window.addEventListener("keydown",r,!0),()=>window.removeEventListener("keydown",r,!0)},[t]),w.useEffect(()=>{const r=setTimeout(()=>{var s;return(s=n.current)==null?void 0:s.focus()},0);return()=>clearTimeout(r)},[]),d.jsx("div",{className:"fr-stay-scrim",role:"dialog","aria-modal":"true","aria-label":Ee.offerHead,children:d.jsxs("div",{className:"fr-stay",children:[d.jsx("div",{className:"fr-stay-head",children:Ee.offerHead}),d.jsx("div",{className:"fr-stay-line",children:Ee.offerLine}),d.jsxs("div",{className:"fr-stay-row",children:[d.jsx("button",{ref:n,type:"button",className:"fr-stay-go",onClick:e,children:Ee.offerGo}),d.jsx("button",{type:"button",className:"fr-stay-keep",onClick:t,children:Ee.offerNot})]})]})})}const PP="zero.tutorial.offered";function vie(e){try{return e.getItem(PP)!=="1"}catch{return!1}}function yw(e){try{e.setItem(PP,"1")}catch{}}function Sie(e){return e.made&&!e.walking&&!e.offered}function Cie(e,...t){for(const n of t){if(!n)continue;const r=e.find(s=>s.slug===n);if(r&&r.practice!==!0)return r.slug}return null}const Eie={project:null,priority:null,harness:null},BA=["claude","codex"],Nie=new Set(["codex","codex-import","not-imported"]);function $P(e){return e.engine==="codex"||(e.labels??[]).some(t=>Nie.has(t)||t.startsWith("codex:"))?"codex":"claude"}function Tie(e,t,n){return n==="project"?!t.project||e.product===t.project:n==="priority"?!t.priority||rc(e.priority)===t.priority:!t.harness||$P(e)===t.harness}const zP=["project","priority","harness"];function _P(e,t,n){return zP.every(r=>r===n||Tie(e,t,r))}function HA(e){return zP.some(t=>e[t]!==null)}function Aie(e,t,n){return{...e,[t]:e[t]===n?null:n}}function jie(e,t){return{...e,[t]:null}}const dh=(e,t)=>{var n;return((n=t.find(r=>r.slug===e))==null?void 0:n.name)??e},Mie=e=>Pr.find(t=>t.id===e).label;function Rie(e,t){const n=[];return e.project&&n.push({part:"project",label:dh(e.project,t)}),e.priority&&n.push({part:"priority",label:Mie(e.priority)}),e.harness&&n.push({part:"harness",label:id(e.harness)}),n}const ww=5;function Oie(e,t,n){const r=(m,y)=>{const x=new Map;for(const k of e)_P(k,t,m)&&x.set(y(k),(x.get(y(k))??0)+1);return x},s=r("project",m=>m.product);s.delete(""),t.project&&!s.has(t.project)&&s.set(t.project,0);const o=[...s.entries()].sort((m,y)=>y[1]-m[1]||dh(m[0],n).localeCompare(dh(y[0],n))).map(([m,y])=>({value:m,label:dh(m,n),count:y,on:m===t.project}));let i=o.slice(0,ww),l=o.slice(ww);const a=l.find(m=>m.on);a&&(i=[...i.slice(0,ww-1),a],l=o.filter(m=>!i.includes(m)));const c=r("priority",m=>rc(m.priority)),u=Pr.map(m=>({value:m.id,label:m.label,count:c.get(m.id)??0,on:t.priority===m.id})),f=r("harness",$P),p=BA.every(m=>(f.get(m)??0)>0)||t.harness?BA.map(m=>({value:m,label:id(m),count:f.get(m)??0,on:t.harness===m})):[];return{projects:i,moreProjects:l,priorities:u,harnesses:p}}function Iie(){return d.jsx("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinecap:"round","aria-hidden":"true",children:d.jsx("path",{d:"M4.6 7.4h14.8M7.4 12h9.2M10.2 16.6h3.6"})})}function Die(e,t){const n=(s,o)=>o.map(i=>({kind:"row",row:i,pick:{part:s,value:i.value}}));if(t==="more")return[{kind:"back"},...n("project",e.moreProjects)];const r=[];return e.projects.length&&(r.push({kind:"head",label:"Project"},...n("project",e.projects)),e.moreProjects.length&&r.push({kind:"more"}),r.push({kind:"sep"})),r.push({kind:"head",label:"Priority"},...n("priority",e.priorities)),e.harnesses.length&&r.push({kind:"sep"},{kind:"head",label:"Agent"},...n("harness",e.harnesses)),r}const Lie=e=>e.kind==="row"||e.kind==="more"||e.kind==="back";function Pie({filter:e,menu:t,tags:n,open:r,onOpen:s,onClose:o,onPick:i,onClear:l}){const[a,c]=w.useState("main"),[u,f]=w.useState(-1),h=w.useRef(null),p=w.useRef(null),m=Die(t,a),y=m.map((b,E)=>Lie(b)?E:-1).filter(b=>b>=0);w.useEffect(()=>{var b;r&&(c("main"),f(-1),(b=p.current)==null||b.focus())},[r]),w.useEffect(()=>{if(!r)return;const b=E=>{var N;(N=h.current)!=null&&N.contains(E.target)||o()};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[r,o]);const x=b=>{if(b.kind==="more"){c("more"),f(-1);return}if(b.kind==="back"){c("main"),f(-1);return}b.kind==="row"&&i(b.pick.part,b.pick.value)},k=b=>{var N;b.stopPropagation();const E=y.indexOf(u);b.key==="Escape"?(b.preventDefault(),a==="more"?(c("main"),f(-1)):o()):b.key==="ArrowDown"?(b.preventDefault(),f(y[Math.min(E+1,y.length-1)]??-1)):b.key==="ArrowUp"?(b.preventDefault(),f(y[Math.max(E-1,0)]??-1)):b.key==="ArrowRight"&&((N=m[u])==null?void 0:N.kind)==="more"?(b.preventDefault(),x(m[u])):(b.key==="ArrowLeft"||b.key==="Backspace")&&a==="more"?(b.preventDefault(),c("main"),f(-1)):b.key==="Enter"&&m[u]&&(b.preventDefault(),x(m[u]))},v=n.length>0;return d.jsxs(d.Fragment,{children:[n.map(b=>d.jsxs("button",{className:"box-filter-tag",title:`Stop filtering by ${b.label}`,onClick:()=>l(b.part),children:[d.jsx("span",{children:b.label}),d.jsx(K0,{})]},b.part)),d.jsxs("span",{className:"when-wrap box-filter",ref:h,children:[d.jsx("button",{className:`icon-btn${r||v?" on":""}`,title:"Filter","aria-label":"Filter","aria-haspopup":"menu","aria-expanded":r,onClick:()=>r?o():s(),children:d.jsx(Iie,{})}),r&&d.jsx("div",{className:"when-menu box-filter-menu",role:"menu",tabIndex:-1,ref:p,onKeyDown:k,children:m.map((b,E)=>{if(b.kind==="head")return d.jsx("div",{className:"when-head",children:b.label},E);if(b.kind==="sep")return d.jsx("span",{className:"when-sep"},E);const N=E===u?" hot":"";return b.kind==="more"||b.kind==="back"?d.jsxs("button",{className:`when-door${b.kind==="back"?" back":""}${N}`,onMouseEnter:()=>f(E),onClick:()=>x(b),children:[d.jsx("span",{className:"when-door-label",children:b.kind==="more"?"More projects":"‹ Projects"}),b.kind==="more"&&d.jsx("span",{className:"when-door-arrow",children:"›"})]},E):d.jsxs("button",{role:"menuitemradio","aria-checked":b.row.on,className:`when-row${b.row.on?" on":""}${N}`,onMouseEnter:()=>f(E),onClick:()=>x(b),children:[d.jsx("span",{className:"when-row-label",children:b.row.label}),b.row.on&&d.jsx("span",{className:"box-filter-tick","aria-hidden":"true",children:"✓"}),d.jsx("span",{className:"when-row-hint",children:b.row.count.toLocaleString()})]},E)})})]})]})}const $ie=e=>e&&"item"in e?e.item:null,Tc=48,zie=1e4,Li=Hne(Qa),Pi=Wne(Qa),WA="zero.seen",_ie='button, a, input, textarea, select, [role="button"], [contenteditable=""], [contenteditable="true"], .row, .modal, .palette, .focus-dock',Fie="zero.panel",UA="zero.keyhints",VA="zero.snooze",KA="zero.deliveredThrough",Ac=(()=>{const e=Number(localStorage.getItem(KA));if(Number.isFinite(e)&&e>0)return e;const t=Date.now();return localStorage.setItem(KA,String(t)),t})(),Bie=e=>e.answer&&e.answer!=="(withdrawn)"?e.answer:void 0;function Hie(){var r1,s1,o1,i1,l1,a1,c1,u1,d1,f1,h1,p1,m1,g1,y1,w1,k1,x1,b1,v1,S1,C1,E1,N1,T1;const[e,t]=w.useState(null),n=w.useRef(aP(window.localStorage)),[r,s]=w.useState(!1),o=w.useRef(null),[i,l]=w.useState(null),a=w.useRef(0),[c,u]=w.useState(null),[f,h]=w.useState("inbox"),[p,m]=w.useState(()=>{try{return Number(localStorage.getItem("zero.troubleClosed"))||0}catch{return 0}}),y=w.useCallback(g=>{m(g);try{localStorage.setItem("zero.troubleClosed",String(g))}catch{}},[]),[x,k]=w.useState(0),[v,b]=w.useState(null),[E,N]=w.useState(null),[T,A]=w.useState(null),R=w.useRef(null);R.current||(R.current=yoe(A)),w.useEffect(()=>{var g;(g=R.current)==null||g.point(E)},[E]),w.useEffect(()=>()=>{var g;return(g=R.current)==null?void 0:g.stop()},[]);const[$,L]=w.useState(()=>localStorage.getItem(UA)!=="0"),_=w.useCallback(g=>{var S;L(g),localStorage.setItem(UA,g?"1":"0"),g||(b(null),N(null),(S=R.current)==null||S.stop())},[]),[j,F]=w.useState(null),ae=w.useRef(null);ae.current=j;const[G,I]=w.useState(null),[ne,B]=w.useState([]),J=w.useCallback(g=>ne.filter(S=>S.product===g.product&&S.id===g.id),[ne]),M=j?((s1=(r1=e==null?void 0:e.engines)==null?void 0:r1.byItem)==null?void 0:s1[j.id])??((o1=e==null?void 0:e.engines)==null?void 0:o1.workspace)??null:null,[Q,ce]=w.useState(null),[C,re]=w.useState(null),W=w.useRef(null),V=w.useRef(new Set),[Se,ye]=w.useState(!1),De=!!j||!!Q,[Te]=w.useState(()=>jP(localStorage.getItem(AP))),[le,K]=w.useState(null),me=$&&!le;w.useEffect(()=>{var g;me||(N(null),(g=R.current)==null||g.stop())},[me]),w.useEffect(()=>{if(!me)return;const g=O=>{var Y,ge;const D=(ge=(Y=O.target)==null?void 0:Y.closest)==null?void 0:ge.call(Y,"[data-hint]"),H=D==null?void 0:D.dataset.hint;if(!D||!H||!fw[H]){N(ie=>ie&&null);return}N(ie=>ie&&ie.el===D?ie:{id:H,el:D})},S=O=>{O.relatedTarget||N(null)};return document.addEventListener("mousemove",g,!0),document.addEventListener("mouseout",S,!0),()=>{document.removeEventListener("mousemove",g,!0),document.removeEventListener("mouseout",S,!0)}},[me]),w.useEffect(()=>{if(!T)return;const g=()=>{var O;N(null),(O=R.current)==null||O.stop()};window.addEventListener("scroll",g,!0),window.addEventListener("resize",g),window.addEventListener("keydown",g,!0);const S=new MutationObserver(()=>{T.el.isConnected||g()});return S.observe(document.body,{childList:!0,subtree:!0}),()=>{window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",g),window.removeEventListener("keydown",g,!0),S.disconnect()}},[T]);const[U,we]=w.useState(!1),[Oe,Ie]=w.useState(!1),[ct,se]=w.useState(null),[he,ve]=w.useState(()=>new URLSearchParams(location.search).has("settings")),He=w.useRef(TP);He.current={modal:le,settings:he,importAgents:Oe,newProject:U};const[tt,Ct]=w.useState(null),[oe,P]=w.useState(null),[ee,Ae]=w.useState(null),[We,Je]=w.useState(null),[wt,un]=w.useState(null),dt=w.useMemo(()=>({project:ee,priority:We,harness:wt}),[ee,We,wt]),Cn=g=>{Ae(g.project),Je(g.priority),un(g.harness),k(0)},Ut=w.useCallback(()=>K(g=>g==="filter"?null:g),[]),[be,Ye]=w.useState(null),rt=w.useRef(null),Jt=w.useRef(null),[Kr,Ls]=w.useState(()=>localStorage.getItem("powerup.sidebar.collapsed")!=="true"),fr=w.useRef(null),X=w.useRef(Kr);X.current=Kr,w.useEffect(()=>{fr.current===null&&(localStorage.setItem(Fie,Kr?"1":"0"),localStorage.setItem("powerup.sidebar.collapsed",String(!Kr)))},[Kr]);const Ke=w.useCallback(()=>Ls(g=>!g),[]),[Qe,Qt]=w.useState(()=>lse(localStorage.getItem(Qo))),[Ni,Ar]=w.useState(()=>Ra("match"));w.useEffect(()=>ise(Ar),[]);const[En,Ti]=w.useState(()=>ba(localStorage.getItem(zr))),qr=cse(Qe,En),[jr,Ai]=w.useState(()=>{const g=ba(localStorage.getItem(zr));return na(localStorage.getItem(Lo),g==="none"?tn[0].id:g)}),ji=w.useRef(0),[Ps,Bt]=w.useState(null),Ht=w.useCallback(g=>{const{theme:S,skin:O}=as(g);localStorage.setItem(Qo,S),localStorage.setItem(zr,O);const D=++ji.current;Bt(g),Aa(O).then(()=>{D===ji.current&&CF(()=>ki.flushSync(()=>{if(Bt(null),Qt(S),Bc(Ra(S)),Ti(O),Hc(O),O!=="none"){const H=na(localStorage.getItem(Lo),O);Ai(H),ra(H)}}))})},[]),pe=w.useCallback(g=>{const S=ba(localStorage.getItem(zr));S!=="none"&&(Ai(g),ra(g),localStorage.setItem(Lo,fse(localStorage.getItem(Lo),S,g)))},[]),ft=w.useCallback(()=>{const g=ba(localStorage.getItem(zr));g!=="none"&&pe(On[g])},[pe]),[ut,Un]=w.useState(()=>new Set(JSON.parse(localStorage.getItem(WA)??"[]"))),[Me,nt]=w.useState(new Set),[dn,tr]=w.useState(()=>JSON.parse(localStorage.getItem(VA)??"{}")),[Yr,Km]=w.useState([]),Lt=w.useCallback(g=>{const S=Object.assign(g,{at:Date.now()});return Km(O=>[...O,S]),S},[]),oc=w.useRef(null),[Ol,qm]=w.useState(null),[yd,BP]=w.useState(()=>{try{return localStorage.getItem("zero.updateClosed")||""}catch{return""}}),Ym=w.useCallback(g=>{BP(g);try{localStorage.setItem("zero.updateClosed",g)}catch{}},[]),[Gm]=w.useState(()=>gie(new URLSearchParams(location.search).get("modes"))),[HP,WP]=w.useState("auto"),wd=w.useRef(null),[Jm,yv]=w.useState(()=>Number(localStorage.getItem("zero.zeroSince"))||null),[ic,kd]=w.useState(null),wv=w.useRef(null),[xd,Qm]=w.useState(null),[ds,bd]=w.useState(null),[z,nr]=w.useState(null),[kv,xv]=w.useState(null),[bv,Xm]=w.useState(null),[vd,vv]=w.useState({missing:!1,url:"https://code.claude.com/docs/en/setup"}),[Sv,UP]=w.useState(""),ko=w.useRef(null);ko.current=z;const Cv=w.useRef(vd);Cv.current=vd;const Sd=w.useRef(Ire(new URLSearchParams(location.search).get("firstrun")));w.useEffect(()=>{if(z||!e||!nA({products:e.products.length,done:aA(localStorage),forced:!!Sd.current}))return;nr(Sd.current?{...Ma,step:Sd.current}:Ere(localStorage));const g=hse(localStorage,Qo);g&&(Qt(g.theme),Ti(g.skin))},[e,z]),w.useEffect(()=>{z&&Nre(localStorage,z)},[z]);const[Ev,VP]=w.useState([]),[Nv,KP]=w.useState(null);w.useEffect(()=>{q.settings().then(g=>{var D,H,Y,ge;const S=(D=g.workspace)==null?void 0:D.homePath;typeof S=="string"&&S&&UP(S),jF((H=g.workspace)==null?void 0:H.claudeModels);const O=(Y=g.workspace)==null?void 0:Y.codexModels;Array.isArray(O)&&VP(O),KP(((ge=g.workspace)==null?void 0:ge.codexModelDefault)??null)}).catch(()=>{})},[]);const Tv=!!z&&z.step==="done";w.useEffect(()=>{Tv&&q.settings().then(g=>{var O,D,H;const S=g.ok!==!1&&((O=g.workspace)==null?void 0:O.claudeCertain)===!0;vv({missing:S&&!((D=g.workspace)!=null&&D.claudeFound),url:((H=g.workspace)==null?void 0:H.claudeInstallUrl)||"https://code.claude.com/docs/en/setup"})}).catch(()=>{})},[Tv]);const qP=w.useCallback(async()=>{const g=await q.recheckClaude(),S=g.certain&&!g.found;return vv({missing:S,url:g.url}),S},[]),xo=w.useCallback(g=>{nr(S=>S&&Dne(S,g))},[]),Il=hv(z),en=Il?ee:null;w.useEffect(()=>{!Il||!(z!=null&&z.practice)||Ae(z.practice)},[Il,z==null?void 0:z.practice]),w.useEffect(()=>{z&&(z.step==="make"&&(F(null),K(null),h("inbox")),z.step==="task"&&K("compose"),z.step==="working"&&(K(null),h("progress"),k(0)),z.step==="open"&&(K(null),h("inbox"),k(0)),z.step==="clear"&&(K(null),F(null),h("inbox"),k(0)),z.step==="snooze"&&(F(null),h("inbox"),k(0)),z.step==="unblock"&&(K(null),h("inbox"),k(0)),z.step==="where"&&(K(null),F(null)),z.step==="command"&&(K(null),F(null),h("inbox")))},[z==null?void 0:z.step]),w.useEffect(()=>{(z==null?void 0:z.step)!=="make"||le!=="compose"||nr(g=>g&&Vs(g,"task"))},[z==null?void 0:z.step,le]),w.useEffect(()=>{(z==null?void 0:z.step)!=="open"||!j||j.id!==z.item||nr(g=>g&&Vs(g,"answer"))},[z==null?void 0:z.step,j==null?void 0:j.id]),w.useEffect(()=>{if((z==null?void 0:z.step)!=="working"||!z.item||!e)return;const g=e.items.find(O=>O.id===z.item);!g||!(g.result||g.status==="done"||g.status==="blocked")||(h("inbox"),xo({t:"answered"}))},[e,z==null?void 0:z.step,z==null?void 0:z.item]),w.useEffect(()=>{if((z==null?void 0:z.step)!=="working"||!z.item)return;const g=z.practice??z.product;if(!g)return;const S=z.item;let O=!0;const D=setTimeout(async()=>{try{await q.firstRunAnswer({product:g,id:S})}catch{}O&&await _e()},Bne);return()=>{O=!1,clearTimeout(D)}},[z==null?void 0:z.step,z==null?void 0:z.item,z==null?void 0:z.product,z==null?void 0:z.practice]);const $s=!!z&&z.step!=="landed";w.useEffect(()=>{if($s)return q.firstRunWalking(!0),()=>{q.firstRunWalking(!1)}},[$s]);const Av=w.useRef(null),Zm=kie(z,!!j);w.useEffect(()=>{xie(Av.current,Zm)&&(Av.current=Zm,(async()=>{var D,H,Y,ge,ie,ze;const g=((D=ko.current)==null?void 0:D.examples)??[];if(g.length){await((H=hr.current)==null?void 0:H.call(hr)),xo({t:"staged",examples:g});return}const S=((Y=ko.current)==null?void 0:Y.practice)??((ge=ko.current)==null?void 0:ge.product)??null;let O=[];if(S)try{O=((ie=await q.firstRunExamples({product:S}))==null?void 0:ie.ids)??[]}catch{O=[]}await((ze=hr.current)==null?void 0:ze.call(hr)),O.length?xo({t:"staged",examples:O}):nr(Xe=>Xe&&Vs(Xe,"command"))})())},[Zm,xo]);const Dl=w.useCallback(()=>{const g=moe(He.current);K(g.modal),ve(g.settings),Ct(null),Ie(g.importAgents),we(g.newProject)},[]),lc=w.useCallback((g,{celebrate:S=!0,filed:O=null,practised:D=!1}={})=>{var Y,ge;if(!sA(Cv.current))return;Dl(),D&&yw(localStorage);const H=((Y=ko.current)==null?void 0:Y.product)??null;H&&O===null&&q.importAgents({product:H,agents:g}).catch(()=>{}),q.firstRunPracticeEnd().then(()=>{var ie;return(ie=hr.current)==null?void 0:ie.call(hr)}),Ae(null),Di(((ge=ko.current)==null?void 0:ge.product)??null),Tre(localStorage),nr(null),S&&xv({agents:(O??g.length)>0})},[Dl]),YP=w.useCallback(()=>{Are(localStorage),Dl(),F(null),h("inbox"),Cd.current=!1,setTimeout(()=>nr({...Ma}),0)},[Dl]),jv=w.useCallback(g=>{yw(localStorage),Xm(null),Dl(),F(null),h("inbox"),Cd.current=!1,setTimeout(()=>nr(One(g)),0)},[Dl]),Cd=w.useRef(!1);w.useEffect(()=>{if((z==null?void 0:z.step)==="command"){if(le==="palette"){Cd.current=!0;return}if(Cd.current){if(Ine(z)==="end"){lc([],{practised:!0});return}nr(g=>g&&Vs(g,"done"))}}},[z,le,lc]);const eg=w.useRef(new Set),tg=w.useRef(new Set),Ed=w.useRef(null),Mv=3e3,fs=w.useRef(null),ng=w.useCallback(async()=>{var S;const g=fs.current;g&&(fs.current=null,clearTimeout(g.timer),await g.run(),bd(null),await((S=hr.current)==null?void 0:S.call(hr)))},[]),_e=w.useCallback(async()=>t(await q.snapshot()),[]),hr=w.useRef();hr.current=_e,w.useEffect(()=>{_e();const g=q.onChanged(_e),S=setInterval(_e,1e4);return()=>{g(),clearInterval(S)}},[_e]);const Rv=w.useRef(!1);w.useEffect(()=>{if(Rv.current||!e)return;const g=f_(location.search,e.items,ot);if(g){Rv.current=!0,F(g);const S=new URLSearchParams(location.search).get("panel");S==="1"&&Ls(!0),S==="0"&&Ls(!1)}});const kt=Date.now(),ht=rA((e==null?void 0:e.items)??[],z),Ll=w.useMemo(()=>[...((e==null?void 0:e.agents)??[]).filter(MI)].sort(xK).map(S=>{const{title:O,body:D}=pK(S,kt);return{id:`agent:${S.pid}`,product:S.product??"",productName:S.productName??TI(S),status:"open",title:O,body:D,kind:"agent",labels:[],priority:Wa(S)?9:1,epoch:0,claim:null,createdAt:S.startedAt,updatedAt:S.lastActiveAt||S.startedAt,runAt:S.runAt??0,...S.runAt?{wrote:{runAt:{ts:S.runAtSetAt??S.runAt,source:"founder"}}}:{},agent:S}}),[e==null?void 0:e.agents,kt]),Pl=w.useMemo(()=>rA(Ll.filter(g=>!en||g.product===en),z),[Ll,en,z]),Nd=((i1=e==null?void 0:e.config)==null?void 0:i1.outsideAgents)??"off",Nn=w.useCallback(g=>Math.max(g.runAt??0,dn[g.id]??0),[dn]),hs=w.useCallback(g=>W4(g,dn[g.id]??0),[dn]),$l=w.useMemo(()=>{const g=e==null?void 0:e.supervisor.spawnTrouble;return!g||p===g.since?null:F4(g,ht)},[e==null?void 0:e.supervisor.spawnTrouble,ht,p]),zl=w.useMemo(()=>{const g=e==null?void 0:e.update;return yC(g,{walking:$s,closed:yd})?v3(g):null},[e==null?void 0:e.update,yd,$s]),zs=w.useMemo(()=>[...ht,...Ll,...$l?[$l]:[],...zl?[zl]:[]],[ht,Ll,$l,zl]),Td=w.useMemo(()=>ht.filter(g=>g.id===ds||g.product&&en&&g.product!==en?!1:jR(g,{deliveredThrough:Ac,hiddenUntil:hs(g),now:kt})),[ht,hs,en,kt,ds]),Ov=w.useMemo(()=>ht.filter(g=>g.id===ds||g.product&&en&&g.product!==en?!1:cC(g,{deliveredThrough:Ac,hiddenUntil:hs(g),deferredUntil:Nn(g),now:kt})),[ht,ds,en,Nn,hs,Ac,kt]),Ad=w.useCallback(g=>t3((e==null?void 0:e.supervisor.productOrder)??[],g.product)+RR(g),[e==null?void 0:e.supervisor.productOrder]),ot=w.useMemo(()=>{const g=Td,S=K4(g,Ov),O=Fe=>S.has(Fe),D=Pl.filter(Fe=>Fe.id!==ds&&Fe.agent&&mK(Fe.agent,kt,Nd)),H=[...g.filter(Fe=>!O(Fe.id)),...D].sort(pC(Ad)),Y=H.filter(Fe=>Zc(Fe,ut)),ge=Y.length?H.filter(Fe=>!Zc(Fe,ut)):H,ie=ge.filter(rl),ze=ie.length?ge.filter(Fe=>!rl(Fe)):ge;return[...[...$l?[$l]:[],...zl?[zl]:[],...Y],...ie,...ze]},[Td,Ov,Pl,Nd,Ad,kt,ds,$l,zl,ut]);w.useEffect(()=>{(z==null?void 0:z.step)==="clear"&&Une(ot,z,Li,Pi)&&nr(g=>g&&Vs(g,"snooze"))},[ot,z==null?void 0:z.step,z==null?void 0:z.examples.join("|")]),w.useEffect(()=>{(z==null?void 0:z.step)==="snooze"&&Kne(ot,z,Pi)&&nr(g=>g&&Vs(g,"unblock"))},[ot,z==null?void 0:z.step,z==null?void 0:z.examples.join("|")]),w.useEffect(()=>{(z==null?void 0:z.step)==="unblock"&&Jne(ot,z)&&nr(g=>g&&Vs(g,"where"))},[ot,z==null?void 0:z.step,z==null?void 0:z.examples.join("|")]);const rg=w.useMemo(()=>{const g=(e==null?void 0:e.supervisor.productOrder)??[],S=(e==null?void 0:e.products)??[],O=g.map(H=>S.find(Y=>Y.slug===H)).filter(H=>!!H),D=S.filter(H=>!g.includes(H.slug)).sort((H,Y)=>H.name.localeCompare(Y.name));return[...O,...D]},[e==null?void 0:e.products,e==null?void 0:e.supervisor.productOrder]);w.useEffect(()=>{if(z||!e)return;const g=ZT();cne(e.products,g,{practiceSlug:Rne})&&Di(null)},[z,e==null?void 0:e.products]);const _l=w.useMemo(()=>[...ht.filter(g=>{if(en&&g.product!==en)return!1;const S=Nn(g);return g.id===ds&&S<=kt?!0:Hh(g,{deferredUntil:S,now:kt})}),...Pl.filter(g=>g.agent&&gK(g.agent,kt,Nd))].sort(pC(Ad)),[ht,Pl,Nd,en,ds,Nn,Ad,kt]),Fl=w.useMemo(()=>ht.filter(g=>g.status==="done"&&(!en||g.product===en)).sort((g,S)=>S.updatedAt-g.updatedAt),[ht,en]),bo=w.useMemo(()=>[...ht.filter(g=>hs(g)>kt&&g.status!=="done"&&(!en||g.product===en)),...Pl.filter(g=>(g.runAt??0)>kt)].sort((g,S)=>hs(g)-hs(S)),[ht,Pl,hs,en,kt]),[Bl,ac]=w.useState([]);w.useEffect(()=>{q.repeats().then(ac).catch(()=>{})},[(l1=e==null?void 0:e.items)==null?void 0:l1.length,f]);const sg=bo.length+Bl.length,cc=w.useMemo(()=>OP({scheduledCount:sg,view:f}).map(([g])=>g),[sg,f]),og=w.useRef(new Set);w.useEffect(()=>{if((z==null?void 0:z.step)!=="where"){og.current=new Set;return}if(f!=="inbox"){og.current.add(f);return}cc.some(g=>g!=="inbox"&&!og.current.has(g))||nr(g=>g&&Vs(g,"command"))},[f,z==null?void 0:z.step,cc]);const ig=w.useMemo(()=>be===null?null:L3(ht,be),[ht,be]),GP=w.useMemo(()=>new Map((ig??[]).map(g=>[g.item.id,g.summary])),[ig]),JP=!!be,Hl=w.useMemo(()=>be===null?void 0:PR(be),[be]),jd=w.useCallback(()=>{Ye(g=>g!==null?g:(Jt.current={view:f,selected:x},"")),F(null),K(null),k(0),requestAnimationFrame(()=>{var g;return(g=rt.current)==null?void 0:g.focus()})},[f,x]),Wl=w.useCallback(()=>{Ye(null);const g=Jt.current;Jt.current=null,g&&(h(g.view),k(g.selected))},[]),Iv=w.useMemo(()=>z?Yne(z.step,z,ot,Li,Pi,{opened:!!j,picking:le==="snooze"}):[],[z,ot,j,le]),QP=z&&gP.includes(z.step)?((a1=pP(z.step,0,{opened:!!j,view:f,picking:le==="snooze",palette:le==="palette",tabs:cc}))==null?void 0:a1.key)??null:null,uc=f==="inbox"?ot:f==="snoozed"?bo:f==="progress"?_l:Fl,XP=w.useMemo(()=>HA(dt)?uc.filter(g=>Rn(g)||qn(g)||_P(g,dt)):uc,[uc,dt]),jt=be!==null?(ig??[]).map(g=>g.item):XP,ZP=w.useMemo(()=>le==="filter"?Oie(uc.filter(g=>!Rn(g)&&!qn(g)),dt,(e==null?void 0:e.products)??[]):null,[le,uc,dt,e==null?void 0:e.products]),e2=w.useMemo(()=>{const g=(e==null?void 0:e.supervisor.running)??[];return(z==null?void 0:z.step)!=="working"||!z.item?g:[{itemId:z.item,product:z.product??"",startedAt:z.sentAt??Date.now(),tail:[]},...g]},[e==null?void 0:e.supervisor.running,z==null?void 0:z.step,z==null?void 0:z.item,z==null?void 0:z.product,z==null?void 0:z.sentAt]),Tn=jt[Math.min(x,Math.max(0,jt.length-1))],xt=(v&&!Me.size?jt.find(g=>g.id===v):void 0)??Tn,[it,ps]=w.useState(null),[Md,Dv]=w.useState(new URLSearchParams(location.search).has("reviewLab")?"code":"multiple"),[lg,t2]=w.useState("header-tools-open"),[Lv,n2]=w.useState("corners-bare"),[ag,r2]=w.useState("glass"),ms=fk(q.isFixtures,location.search);w.useEffect(()=>(document.documentElement.dataset.codeReview="glass",()=>{delete document.documentElement.dataset.codeReview}),[]),w.useEffect(()=>(document.documentElement.dataset.textReview=ms?ag:"glass",()=>{delete document.documentElement.dataset.textReview}),[ms,ag]);const Pv=w.useRef(!1);w.useEffect(()=>{if(ms&&e&&!Pv.current){const g=e.items.find(S=>S.id==="w-n13");g&&(Pv.current=!0,F(g))}},[ms,e]),w.useEffect(()=>{document.documentElement.dataset.reviewStyle=ms?lg:"header-tools-open"},[ms,lg]);const[vo,cg]=w.useState("beside"),[$v,zv]=w.useState(!1);w.useEffect(()=>{if(it&&vo==="focus"){fr.current===null&&X.current&&(fr.current=!0,Ls(!1));return}if(fr.current!==null){const g=fr.current;fr.current=null,Ls(g)}},[it,vo]);const Ul=!!it&&vo==="focus";w.useEffect(()=>{if(!Ul||le!=="reply")return;const g=()=>K(null),S=D=>{var Y;const H=D.target;(Y=H==null?void 0:H.closest)!=null&&Y.call(H,".focus-dock")||g()},O=()=>{var D;((D=document.activeElement)==null?void 0:D.tagName)==="IFRAME"&&g()};return document.addEventListener("mousedown",S),window.addEventListener("blur",O),()=>{document.removeEventListener("mousedown",S),window.removeEventListener("blur",O)}},[Ul,le]);const[s2,ug]=w.useState(!1),[o2,dg]=w.useState(!1),dc=w.useRef(null),_v=w.useCallback(()=>{ug(!0),dc.current&&window.clearTimeout(dc.current),dc.current=window.setTimeout(()=>ug(!1),I_)},[]);w.useEffect(()=>{if(!Ul){ug(!1),dg(!1);return}const g=O=>{var D,H;_v(),dg(!!((H=(D=O.target)==null?void 0:D.closest)!=null&&H.call(D,".doc-marks, .chrome-reach")))},S=()=>dg(!1);return window.addEventListener("mousemove",g),window.addEventListener("blur",S),()=>{window.removeEventListener("mousemove",g),window.removeEventListener("blur",S),dc.current&&window.clearTimeout(dc.current)}},[Ul,_v]);const i2=D_({reaching:o2,awake:s2}),l2="margin-left",[Fv,a2]=w.useState("corner"),c2=q.isFixtures&&new URLSearchParams(location.search).has("artifactTweaks"),Bv=()=>{vo==="focus"&&$v?cg("beside"):ps(null)},[Rd,u2]=w.useState(null),[Hv,d2]=w.useState(1e3);w.useEffect(()=>{if(!Rd)return;const g=new ResizeObserver(([S])=>d2(S.contentRect.width));return g.observe(Rd),()=>g.disconnect()},[Rd]);const[f2,h2]=w.useState(()=>K3(window.localStorage)),p2=w.useMemo(()=>{const g=(e==null?void 0:e.products.find(S=>S.slug===(it==null?void 0:it.product)))??null;return g?[g.dir,g.dir&&`${g.dir}/designs`,g.dir&&`${g.dir}/attachments`,g.repoPath,g.repoPath&&`${g.repoPath}/designs`].filter(Boolean):[]},[e==null?void 0:e.products,it==null?void 0:it.product]),m2=w.useCallback(g=>{h2(g),q3(window.localStorage,g)},[]);w.useEffect(()=>{var S,O;return((O=(S=window.zero)==null?void 0:S.onKeyInTheFile)==null?void 0:O.call(S,D=>{var Y,ge,ie,ze,Xe,Fe;if(!Q3(document.activeElement))return;const H=ite(D);if(H==="close"){if(!G3(it))return;(ge=(Y=document.activeElement)==null?void 0:Y.blur)==null||ge.call(Y),ps(null);return}if(H==="palette"){(ze=(ie=document.activeElement)==null?void 0:ie.blur)==null||ze.call(ie),K(Vn=>Vn==="palette"?null:"palette");return}H==="app"&&((Fe=(Xe=document.activeElement)==null?void 0:Xe.blur)==null||Fe.call(Xe),window.dispatchEvent(new KeyboardEvent("keydown",{key:D.key,bubbles:!0})))}))??(()=>{})},[it]);const _s=(De?j:Tn)??Tn??null;e==null||e.products.find(g=>g.slug===(_s==null?void 0:_s.product));const fg=w.useRef(null);w.useEffect(()=>{var ge;ps(null);const g=j;if(!g)return;const S=fg.current;if(fg.current=null,S&&S.id===g.id){(!Fs||!((ge=S.doc)!=null&&ge.auto))&&ps(S.doc);return}if(Fs)return;let O=!0;const D=(e==null?void 0:e.products.find(ie=>ie.slug===g.product))??null,H=D?[D.dir,`${D.dir}/designs`,`${D.dir}/attachments`,D.repoPath,D.repoPath&&`${D.repoPath}/designs`]:[],Y=async ie=>{for(const ze of ie.slice(0,8)){const Xe=await q.resolveDoc({product:g.product,src:ze});if(!O)return null;if(Xe!=null&&Xe.ok&&Xe.opened)return ze}return null};return(async()=>{let ie=await Y(zE(g,[],(D==null?void 0:D.dir)??null));if(O){if(!ie){const ze=await q.sessionTrace({product:g.product,id:g.id}).catch(()=>null);if(!O)return;const Xe=rne((ze==null?void 0:ze.sessions)??[],H);ie=await Y(zE(g,Xe,(D==null?void 0:D.dir)??null))}!O||!ie||ps({product:g.product,src:ie,auto:!0})}})().catch(()=>{}),()=>{O=!1}},[j==null?void 0:j.id,j==null?void 0:j.product]),w.useEffect(()=>{var ge,ie,ze,Xe;if(!e)return;const g=new Set(ot.map(Fe=>Fe.id)),S=eg.current.size===0,O=S?[]:ot.filter(Fe=>!eg.current.has(Fe.id));eg.current=g,(ie=(ge=window.zero)==null?void 0:ge.badge)==null||ie.call(ge,ot.length);const D=new Set((e.approvals??[]).map(Fe=>Fe.id)),H=tg.current.size===0&&S?[]:(e.approvals??[]).filter(Fe=>!tg.current.has(Fe.id));tg.current=D;const Y=[...O.map(Fe=>({id:Fe.id,title:Fe.title,product:Fe.product,productName:Fe.productName,kind:"item"})),...H.map(Fe=>{var Vn,ys,fn;return{id:Fe.id,title:String(((Vn=Fe.input)==null?void 0:Vn.description)??((ys=Fe.input)==null?void 0:ys.command)??Fe.tool??"a command"),product:Fe.product,productName:((fn=e.products.find(hn=>hn.slug===Fe.product))==null?void 0:fn.name)??Fe.product,kind:"approval"}})];Y.length&&((Xe=(ze=window.zero)==null?void 0:ze.notify)==null||Xe.call(ze,Y))},[e,ot]),w.useEffect(()=>{Qm(null)},[j==null?void 0:j.id]);const g2=420;w.useEffect(()=>{var S,O;return((O=(S=window.zero)==null?void 0:S.onApprovalAnswered)==null?void 0:O.call(S,D=>kd(D)))??(()=>{})},[]),w.useEffect(()=>{if(!ic)return;const g=setTimeout(()=>kd(null),g2);return()=>clearTimeout(g)},[ic]),w.useEffect(()=>{var g;ic||(wv.current=((g=e==null?void 0:e.approvals)==null?void 0:g[0])??null)},[e==null?void 0:e.approvals,ic]),w.useEffect(()=>{j&&p9(j)&&K("reply")},[j==null?void 0:j.id]),w.useEffect(()=>{j||K(poe)},[j]),w.useEffect(()=>{if(le!=="reply")return;const g=S=>{var D,H,Y;const O=S.target;(D=O==null?void 0:O.closest)!=null&&D.call(O,_ie)||(K(null),(Y=(H=document.activeElement)==null?void 0:H.blur)==null||Y.call(H))};return window.addEventListener("pointerdown",g,!0),()=>window.removeEventListener("pointerdown",g,!0)},[le]),w.useEffect(()=>{localStorage.setItem(WA,JSON.stringify([...ut].slice(-2e3)))},[ut]),w.useEffect(()=>{localStorage.setItem(VA,JSON.stringify(dn))},[dn]);const bt=w.useCallback(g=>{Un(S=>new Set(S).add(g.id))},[]);w.useEffect(()=>{const g=new Set(ot.map(O=>O.id));if(W.current===null){W.current=g;return}const S=o3({reading:j,inbox:ot,known:W.current,spent:V.current,typing:!!le||be!==null});W.current=g,!(!S||!j)&&(V.current.add(S.id),re(j),F(S),bt(S))},[ot,j,le,be,bt]),w.useEffect(()=>{var S;if(j||!C)return;const g=i3(C,ht);re(null),g&&(F(g),(S=wd.current)==null||S.call(wd,"Back to what you were reading"))},[j,C,ht]),w.useEffect(()=>{const g=y4(ht,j,G);g&&F(g)},[ht,j,G]),w.useEffect(()=>{const g=m4(G,j);if(g!==G){I(g);return}if(!G||g4(G,j)!=="inbox")return;I(null),h("inbox");const S=ot.findIndex(O=>O.id===G.id&&O.product===G.product);k(S>=0?S:0)},[j,G,ot]),w.useEffect(()=>{var S,O;return((O=(S=window.zero)==null?void 0:S.onOpenItem)==null?void 0:O.call(S,({id:D})=>{const H=[...ot,..._l,...bo,...Fl].find(Y=>Y.id===D);H&&(Ye(null),F(H),bt(H))}))??(()=>{})},[ot,_l,bo,Fl,bt]);const Wv=w.useCallback(g=>{const S=Ll.find(O=>O.id===`agent:${g}`);S&&(F(S),bt(S))},[Ll,bt]),hg=w.useCallback(g=>g?[...ot,..._l,...bo,...Fl].find(S=>S.id===g)??null:null,[ot,_l,bo,Fl]),y2=w.useCallback(g=>{const S=hg(g);S&&(Ye(null),F(S),bt(S))},[hg,bt]);w.useMemo(()=>{const g=(_s==null?void 0:_s.product)??null;if(!g)return[];const S=ht.filter(D=>D.product===g&&D.id!==ds).filter(D=>cC(D,{deliveredThrough:Ac,hiddenUntil:hs(D),deferredUntil:Nn(D),now:kt})).map(D=>({key:D.id,line:D.title,at:D.updatedAt,open:()=>{F(D),bt(D)}})),O=($s?[]:(e==null?void 0:e.agents)??[]).filter(D=>D.product===g&&wK(D,kt)).map(D=>({key:`agent:${D.pid}`,line:kK(D),at:D.lastActiveAt||D.startedAt,open:()=>Wv(D.pid)}));return[...S,...O].sort((D,H)=>H.at-D.at)},[_s==null?void 0:_s.product,ht,e==null?void 0:e.agents,ds,Ac,hs,Nn,kt,bt,Wv]);const pg=w.useRef(null);w.useEffect(()=>{var S,O;const g=(j==null?void 0:j.id)??null;if(!g||g===pg.current){g||(pg.current=null);return}pg.current=g;try{(O=(S=window.zero)==null?void 0:S.track)==null||O.call(S,"task_opened")}catch{}},[j==null?void 0:j.id]);const mg=w.useRef(null),ke=w.useCallback((g,S)=>{qm({text:g,goes:S}),mg.current&&clearTimeout(mg.current),mg.current=setTimeout(()=>qm(null),S?6e3:2500)},[]);wd.current=ke,w.useEffect(()=>{var g;if(!((g=window.zero)!=null&&g.bootInfo)){l(!1);return}window.zero.bootInfo().then(S=>{if(gA(yA(S==null?void 0:S.screenDetail)),l(!!(S!=null&&S.reloaded)),S!=null&&S.recovered){ke(S.recovered);return}if(!(S!=null&&S.reloaded))return;const O=S.builtAt?new Date(S.builtAt).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}):null;ke(O?`Reloaded · build ${O}`:"Reloaded")}).catch(()=>l(!1))},[ke]),w.useEffect(()=>{var g,S;return(S=(g=window.zero)==null?void 0:g.onRecovered)==null?void 0:S.call(g,O=>{O!=null&&O.text&&ke(O.text)})},[ke]);const w2=w.useCallback(async g=>{K(null);const S=await q.openFreshUser(g);if(!S.ok){ke(S.error??"It could not be opened.");return}const O=(S.notes??[]).filter(Y=>g||!Y.includes(".claude")),D=O.length?` · ${O[0]}`:"",H=g?`Opening a new ${Le} that can see your agents.`:`Opening a brand new ${Le} with nothing of yours in it.`;ke(`${H} Yours keeps running.${D}`)},[ke]),k2=w.useCallback(async()=>{var O;K(null);const g=await q.openDemo();if(!g.ok){ke(g.error??"It could not be opened.");return}const S=(O=g.notes)!=null&&O.length?` · ${g.notes[0]}`:"";ke(`Opening a demo inbox with ${g.rows??0} rows in it. Yours keeps running.${S}`)},[ke]);w.useEffect(()=>{var g,S;return(S=(g=window.zero)==null?void 0:g.onScreenDetail)==null?void 0:S.call(g,O=>gA(yA(O==null?void 0:O.detail)))},[]);const Uv=w.useCallback(g=>{const S=ot.findIndex(O=>O.id===g.id);Ed.current=d4({fromTask:!!j,index:S,id:g.id})},[ot,j]),gs=w.useCallback(g=>{Uv(g),F(null)},[Uv]),pr=w.useCallback(async(g,S,O,D,H,Y)=>{await ng(),H||gs(g),K(null),bd(g.id),ke(`${O} · press Z to undo`,H?void 0:Y);const ge=setTimeout(async()=>{var ie;((ie=fs.current)==null?void 0:ie.timer)===ge&&(fs.current=null,await S(),await _e(),bd(ze=>ze===g.id?null:ze))},Mv);fs.current={item:g,timer:ge,run:S,restore:D}},[ng,gs,_e,ke]),Vv=w.useCallback(async g=>{const S=g.agent,O=hf(S),D=S.lastActiveAt||S.startedAt||Date.now();await pr(g,async()=>{await q.closeAgent({key:O,through:D}),Lt({label:`Back in your inbox: ${S.name}`,undoes:`put ${S.name} back in your inbox`,run:async()=>{await q.closeAgent({key:O,through:0})}})},`Closed: ${S.name}`)},[pr,Lt]),Kv=w.useCallback(async(g,S)=>{const O=p;await pr(g,async()=>{y(S),Lt({label:"Back in your inbox: what is not running",undoes:"put the stopped tasks back in your inbox",run:async()=>{y(O)}})},"Closed: what is not running")},[pr,y,p,Lt]),qv=w.useCallback(async(g,S)=>{const O=yd;await pr(g,async()=>{Ym(S),Lt({label:"Back in your inbox: the new version",undoes:"put the new version back in your inbox",run:async()=>{Ym(O)}})},"Closed. The update is still in Settings")},[pr,Ym,yd,Lt]),So=w.useCallback(async g=>{var O,D;const S=lw(z,g.id,Li,Pi);if(S){ke(S);return}if(g.agent){await Vv(g);return}if(Rn(g)){const H=(O=e==null?void 0:e.supervisor.spawnTrouble)==null?void 0:O.since;H&&await Kv(g,H);return}if(qn(g)){await qv(g,((D=e==null?void 0:e.update)==null?void 0:D.newVersion)??"");return}await pr(g,async()=>{await q.answer({product:g.product,id:g.id,status:"done"}),Lt({label:`Reopened: ${no(g.title,Tc)}`,undoes:`reopen “${no(g.title,Tc)}”`,run:async()=>{await q.answer({product:g.product,id:g.id,status:"open"})}})},`Closed: ${no(g.title,Tc)}`)},[pr,Vv,Kv,qv,(c1=e==null?void 0:e.supervisor.spawnTrouble)==null?void 0:c1.since,(u1=e==null?void 0:e.update)==null?void 0:u1.newVersion,z,ke,Lt]),x2=w.useCallback(async g=>{if(Rn(g)){await So(g);return}if(qn(g)){q.updateInstall();return}const S=ga(g),O=S.find(Y=>Y.recommended)??S[0],D=g.status==="open"&&g.kind!=="question"&&g.kind!=="review"&&!(g.labels??[]).includes("founder")&&!Bie(g),H=async(Y,ge)=>{await pr(g,async()=>{await q.answer({product:g.product,id:g.id,answer:Y}),Lt({label:"Approval withdrawn, back in your inbox",undoes:"take back that approval and stop the agent",run:async()=>{var ie,ze;await((ze=(ie=window.zero)==null?void 0:ie.stopSession)==null?void 0:ze.call(ie,{product:g.product,id:g.id})),await q.answer({product:g.product,id:g.id,answer:"(withdrawn)",status:"open"})}})},ge,void 0,void 0,{product:g.product,id:g.id})};g.kind==="question"&&O&&!g.answer?await H(`Option ${O.n}: ${O.text}`,`Approved: option ${O.n} → ${g.productName}`):g.kind==="review"&&!g.answer?await H("Approved. Proceed as you proposed.",`Approved → ${g.productName} will enact it`):D?await H("Approved. Run it.",`Running → ${g.title.slice(0,40)}`):await So(g)},[_e,ke,So]),b2=w.useCallback(async(g,S,O,D,H,Y,ge)=>{if(g.agent||Rn(g)||qn(g))return;const ie=uC(g.status);if(e==null?void 0:e.supervisor.running.some(fn=>fn.itemId===g.id&&fn.product===g.product)){I({product:g.product,id:g.id}),K(null);const fn=Date.now(),hn={product:g.product,id:g.id,at:fn,text:S,held:!0},fc={...hn,held:!1};B(mr=>[...mr,hn]);const A1={label:"Your message is already with the agent. Send another one to add to it.",undoes:"go back to that conversation",run:async()=>{F(g),bt(g)}},j1=async()=>{B(mr=>mr.map(Eo=>Eo===hn?fc:Eo)),Lt(A1),await j_({send:()=>q.answer({product:g.product,id:g.id,answer:S,...O!=null?{priority:O}:{},...H!==void 0?{permissionMode:H}:{},...ge?{model:ge.model,effort:ge.effort}:{}}),accepted:async()=>{await _e(),setTimeout(()=>B(mr=>mr.filter(Eo=>Eo!==hn&&Eo!==fc)),zie)},failed:mr=>{var Ld,R1;B(xg=>xg.filter(Pd=>Pd!==hn&&Pd!==fc)),Km(xg=>xg.filter(Pd=>Pd!==A1)),m9(g,(D==null?void 0:D.words)??S,(D==null?void 0:D.attachments)??[]),((Ld=ae.current)==null?void 0:Ld.id)===g.id&&((R1=ae.current)==null?void 0:R1.product)===g.product?(K("reply"),ke(mr.message||"Could not send. Your message is back in the reply box.")):ke("A message you sent did not reach its agent. Click to open it, your words are back in the reply box.",{product:g.product,id:g.id})}})};await ng();const M1=setTimeout(()=>{var mr;((mr=fs.current)==null?void 0:mr.timer)===M1&&(fs.current=null,j1())},Mv);fs.current={item:g,timer:M1,run:j1,restore:()=>{B(Eo=>Eo.filter(Ld=>Ld!==hn));const mr=BE(g,(D==null?void 0:D.words)??S,(D==null?void 0:D.attachments)??[]);return mr&&K("reply"),mr?{item:g}:null}};return}const Xe=()=>BE(g,(D==null?void 0:D.words)??S,(D==null?void 0:D.attachments)??[])?{item:g}:null,Fe=V4(g,Date.now()),Vn=g.runAt??0,ys=p4(g,S,Y);ys&&I({product:g.product,id:g.id}),await pr(g,async()=>{await q.answer({product:g.product,id:g.id,answer:S,...ie?{status:ie}:{},...O!=null?{priority:O}:{},...H!==void 0?{permissionMode:H}:{},...ge?{model:ge.model,effort:ge.effort}:{}}),Fe&&(await q.schedule({product:g.product,id:g.id,runAt:0}),tr(fn=>{const hn={...fn};return delete hn[g.id],hn})),Lt({label:"Reply withdrawn, back in your inbox",undoes:"take back that reply and stop the agent",restore:Xe,run:async()=>{var fn,hn;Fe&&await q.schedule({product:g.product,id:g.id,runAt:Vn}),await((hn=(fn=window.zero)==null?void 0:fn.stopSession)==null?void 0:hn.call(fn,{product:g.product,id:g.id})),await q.answer({product:g.product,id:g.id,...dC(g.status)}),I(null)}})},`Sent → ${g.productName}`,Xe,ys,{product:g.product,id:g.id})},[pr,e==null?void 0:e.supervisor.running,ke,_e,bt,Lt]),v2=w.useCallback(async(g,S)=>{const O=g.agent;if(!O)return;K(null),gs(g);const D=await q.agentReply({pid:O.pid,text:S});if(D!=null&&D.ok?D.working?ke(`${O.name} is working on it`):ke(`Sent → ${O.name}`):ke((D==null?void 0:D.reason)??"The message could not be handed over."),D!=null&&D.ok&&D.key){const H=D.key;Lt({label:`Back in your inbox. Your message to ${O.name} had already been sent.`,undoes:`take back your message to ${O.name}`,run:async()=>{await q.unreplyAgent({key:H}),_e()}})}_e()},[_e,ke,gs]),S2=w.useCallback(async g=>{const S=g.agent;if(!S)return;const O=await q.agentReveal({pid:S.pid});O!=null&&O.ok||ke((O==null?void 0:O.reason)??`${Pn} cannot tell which window it is running in.`)},[ke]),Od=w.useCallback(async(g,S)=>{if(!(g.agent||Rn(g)||qn(g)))try{await q.answer({product:g.product,id:g.id,answer:R3(S)}),ke(S==="yes"?`Imported into ${g.productName}. It is in your inbox.`:"Not imported. It waits in Closed under Not imported.")}catch(O){ke(`Could not answer: ${O.message}`)}},[ke]),Id=w.useCallback(async(g,S)=>{if(g.agent||Rn(g)||qn(g))return;const O=ga(g).find(H=>H.n===S);if(!O)return;const D=uC(g.status);await pr(g,async()=>{await q.answer({product:g.product,id:g.id,answer:`Option ${O.n}: ${O.text}`,...D?{status:D}:{}}),Lt({label:`Option ${O.n} withdrawn, back in your inbox`,undoes:`take back option ${O.n}`,run:async()=>{var H,Y;await((Y=(H=window.zero)==null?void 0:H.stopSession)==null?void 0:Y.call(H,{product:g.product,id:g.id})),await q.answer({product:g.product,id:g.id,...dC(g.status)})}})},`Option ${O.n} → ${g.productName}`,void 0,void 0,{product:g.product,id:g.id})},[pr,Lt]),Yv=w.useCallback((g,S,O,D)=>{Lt({label:g,undoes:S,restore:()=>w9(O)?{compose:!0}:null,run:D})},[Lt]),Gv=w.useCallback(async(g,S)=>{if(!g.length)return;const O=_I(rc(S)).toLowerCase();await Promise.all(g.map(D=>q.answer({product:D.product,id:D.id,priority:S}))),ke(g.length>1?`${g.length} set to ${O}`:`Priority: ${O}`),await _e()},[_e,ke]),[Gr,Dd]=w.useState(null),Mi=w.useCallback(g=>{const S=Array.isArray(g)?g:[g];if(S.some(Rn)){ke("Nothing to put off here. Press E to close it until something else stops.");return}if(S.some(qn)){ke("Nothing to put off here. Press E to close it. The update stays in Settings.");return}const O=S.map(D=>qne(z,D.id,Li)).find(D=>!!D);if(O){ke(O);return}Dd(g),K("snooze")},[z,ke]),Vl=w.useCallback(async(g,S)=>{g.agent?await q.scheduleAgent({key:hf(g.agent),runAt:S}):await q.schedule({product:g.product,id:g.id,runAt:S})},[]),C2=w.useCallback(async(g,S,O)=>{const D=Array.isArray(g)?g:[g],H=[...D,...q4(D.filter(ge=>!ge.agent),Td)];K(null),Dd(null),nt(new Set);try{for(const ge of H)await Vl(ge,S)}catch(ge){ke(`Could not schedule: ${(ge==null?void 0:ge.message)??"the store refused the write"}`),_e();return}gs(D[0]),ke(D.length>1?`${D.length} scheduled for ${O}`:`Scheduled for ${O}`);const Y=new Map(H.map(ge=>[ge.id,ge.runAt??0]));Lt({label:"Schedule canceled, back in the inbox",undoes:"cancel that schedule",run:async()=>{for(const ge of H)await Vl(ge,Y.get(ge.id)??0);_e()}}),_e()},[ke,_e,Td,Vl,gs,Lt]),Kl=w.useCallback(async g=>{const S=Array.isArray(g)?g:[g],O=new Map(S.map(Y=>[Y.id,Y.runAt??0]));K(null),Dd(null),F(null),nt(new Set);const D=S.every(Y=>Gf(Y,Date.now())),H=D?"Running again":"Back in the inbox";ke(S.length>1?`${S.length} ${D?"running again":"back in the inbox"}`:H),tr(Y=>{const ge={...Y};for(const ie of S)delete ge[ie.id];return ge});for(const Y of S)await Vl(Y,0);Lt({label:"Scheduled again",undoes:"put that schedule back",run:async()=>{for(const Y of S)await Vl(Y,O.get(Y.id)??0);_e()}}),_e()},[ke,_e,Vl,Lt]),gg=w.useCallback(async g=>{const S=zs.filter(D=>g.has(D.id)&&lw(z,D.id,Li,Pi));if(S.length){ke(lw(z,S[0].id,Li,Pi));return}const O=zs.filter(D=>g.has(D.id));for(const D of O)D.agent?await q.closeAgent({key:hf(D.agent),through:D.agent.lastActiveAt||D.agent.startedAt||Date.now()}):await q.answer({product:D.product,id:D.id,status:"done"});Lt({label:`Reopened ${O.length} items`,undoes:`reopen those ${O.length} tasks`,run:async()=>{for(const D of O)D.agent?await q.closeAgent({key:hf(D.agent),through:0}):await q.answer({product:D.product,id:D.id,status:"open"})}}),ke(`Closed: ${O.length} items`),nt(new Set),await _e()},[zs,_e,ke,z]),Co=w.useCallback(g=>{var S;return!!((S=e==null?void 0:e.supervisor.running)!=null&&S.some(O=>O.itemId===g.id))},[e==null?void 0:e.supervisor.running]),Jv=w.useCallback(async g=>{var O,D;if(g.agent||Rn(g)||qn(g))return;const S=Co(g);I({product:g.product,id:g.id}),await((D=(O=window.zero)==null?void 0:O.stopSession)==null?void 0:D.call(O,{product:g.product,id:g.id})),ke(S?"Agent stopped. Back in your inbox. Reply to redirect it.":"Stopped before it started. Back in your inbox. Reply to redirect it."),await _e()},[_e,ke,Co]),Qv=w.useCallback(async g=>{var O,D;if(g.agent||Rn(g)||qn(g))return;const S=await((D=(O=window.zero)==null?void 0:O.redeliver)==null?void 0:D.call(O,{product:g.product,id:g.id}));ke(S!=null&&S.ok?`A fresh agent is picking this up → ${g.productName}`:"Nothing here to restart"),await _e()},[_e,ke]),Xv=w.useCallback(async g=>{var S,O;g.agent||Rn(g)||qn(g)||(await((O=(S=window.zero)==null?void 0:S.reopen)==null?void 0:O.call(S,{product:g.product,id:g.id})),ke(`Back in the queue → ${g.productName}`),gs(g),await _e())},[_e,ke,gs]),yg=w.useCallback(g=>!g.agent&&U4(g,{deferredUntil:Nn(g),now:kt}),[Nn,kt]),E2=w.useCallback(async g=>{var O,D;const S=await((D=(O=window.zero)==null?void 0:O.resumeAgents)==null?void 0:D.call(O,g?{ids:g}:void 0));nt(new Set),ke(S!=null&&S.cleared?`Resuming: ${S.cleared} interrupted ${S.cleared===1?"agent":"agents"} respawning`:"Nothing stranded. Anything waiting respawns on its own"),await _e()},[_e,ke]),Zv=w.useCallback(async g=>{var Y,ge;const S=g.map(ie=>ie.id),O=await((ge=(Y=window.zero)==null?void 0:Y.resumeItems)==null?void 0:ge.call(Y,{ids:S}));nt(new Set);const D=(O==null?void 0:O.resumed)??0,H=(O==null?void 0:O.queued)??0;ke(D||H?[D?`${D} resumed`:"",H?`${H} waiting for a slot`:""].filter(Boolean).join(", "):O!=null&&O.working?"Already working on it":"Nothing to resume"),D>0&&gs(g[0]),await _e()},[_e,ke,gs]),wg=w.useCallback(async()=>{var Xe,Fe;const g=fs.current;if(g){fs.current=null,clearTimeout(g.timer),Ed.current=null,bd(null);const Vn=(Xe=g.restore)==null?void 0:Xe.call(g);F(g.item),ke(Vn?"Undone. Your message is back in the reply box.":"Undone. Nothing was sent.");return}const S=Date.now(),{take:O,rest:D,instant:H}=Wte(Yr,S);if(!O){oc.current=null,ke(Kte);return}const Y=oc.current,ge=(Y==null?void 0:Y.entry)===O&&Ute(Y.at,S);if(!H&&!ge){oc.current={entry:O,at:S},ke(Vte(O.undoes));return}oc.current=null,Km(D),await O.run();const ie=(Fe=O.restore)==null?void 0:Fe.call(O),ze=$ie(ie??null);ke(ze?`${O.label} · your message is back in the reply box`:ie?`${O.label} · your task is back in the new task card`:O.label),await _e(),ze?(F(ze),bt(ze)):ie&&(F(null),K("compose"))},[Yr,_e,ke,bt]);w.useEffect(()=>{const g=S=>{var Y,ge;if(!qte.has(S.key)&&S.key!=="z"&&S.key!=="Z"&&(oc.current=null),he)return;if(U){S.key==="Escape"&&(S.preventDefault(),we(!1));return}const O=S.target,D=(O==null?void 0:O.tagName)==="TEXTAREA"||(O==null?void 0:O.tagName)==="INPUT"||!!(O!=null&&O.isContentEditable);if((S.metaKey||S.ctrlKey)&&S.key.toLowerCase()==="k"){S.preventDefault(),K(ie=>ie==="palette"?null:"palette");return}if((S.metaKey||S.ctrlKey)&&S.key.toLowerCase()==="j"){if(S.preventDefault(),!j||j.agent){ke("Open a task to use its terminal");return}window.dispatchEvent(new Event("task-terminal-toggle"));return}if(S.key==="Tab")return;const H=joe(S);if(H&&!D&&!le&&!De){const ze=cc[H-1];if(!ze)return;S.preventDefault(),b(null),(ge=(Y=document.activeElement)==null?void 0:Y.blur)==null||ge.call(Y),Wl(),nt(new Set),h(ze),k(0);return}if((S.metaKey||S.ctrlKey)&&!S.shiftKey&&S.key.toLowerCase()==="a"&&!D&&!le){S.preventDefault(),F(null),nt(ie=>ie.size>=jt.length&&jt.length>0?new Set:new Set(jt.map(ze=>ze.id)));return}if(!(S.metaKey||S.ctrlKey||S.altKey)){if(le||D){S.key==="Escape"&&!D&&K(null);return}if(foe(S.key)&&S.preventDefault(),S.key==="\\"){S.preventDefault(),Ke();return}if(S.key==="/"){S.preventDefault(),jd();return}if(Q){S.key==="Escape"?(S.preventDefault(),ce(null),ye(!1)):(S.key==="r"||S.key==="R")&&(S.preventDefault(),ye(!0));return}if(j){if(Fa(it==null?void 0:it.src)==="code"&&xte(S.key))return;const ie=xR(j)?ga(j):[];if(S.key==="Escape")Y3(it)?Bv():F(null);else if(S.key==="ArrowDown"&&ie.length)S.preventDefault(),Qm(ze=>{const Xe=ie.findIndex(Fe=>Fe.n===ze);return ie[Math.min(Xe+1,ie.length-1)].n});else if(S.key==="ArrowUp"&&ie.length)S.preventDefault(),Qm(ze=>{const Xe=ie.findIndex(Fe=>Fe.n===ze);return Xe<=0?null:ie[Xe-1].n});else if(S.key==="Enter")S.preventDefault(),xd!==null&&Id(j,xd);else if(S.key==="j"||S.key==="J"||S.key==="k"||S.key==="K"){S.preventDefault();const ze=jt.findIndex(ys=>ys.id===j.id),Xe=ze>=0?ze:x,Fe=S.key==="j"||S.key==="J"?Xe+1:Xe-1,Vn=jt[Fe];Vn&&(F(Vn),bt(Vn),k(Fe))}else S.key==="e"||S.key==="E"?(S.preventDefault(),So(j)):S.key==="r"||S.key==="R"?(S.preventDefault(),ps(null),K("reply")):S.key==="c"||S.key==="C"||S.key==="n"||S.key==="N"?(S.preventDefault(),K("compose")):S.key==="s"||S.key==="S"?Mi(j):S.key==="z"||S.key==="Z"?(S.preventDefault(),wg()):/^[1-9]$/.test(S.key)&&Id(j,Number(S.key));return}switch(S.key){case"j":case"J":case"ArrowDown":{S.preventDefault(),b(null);const ie=Math.min(x+1,Math.max(0,jt.length-1));S.shiftKey?nt(ze=>new Set([...ze,...Tn?[Tn.id]:[],...jt[ie]?[jt[ie].id]:[]])):Me.size&&nt(new Set),k(ie);break}case"k":case"K":case"ArrowUp":{S.preventDefault(),b(null);const ie=Math.max(0,x-1);S.shiftKey?nt(ze=>new Set([...ze,...Tn?[Tn.id]:[],...jt[ie]?[jt[ie].id]:[]])):Me.size&&nt(new Set),k(ie);break}case"Enter":!Me.size&&xt&&(F(xt),bt(xt));break;case"e":case"E":S.preventDefault(),f==="snoozed"?Kl(Me.size?zs.filter(ie=>Me.has(ie.id)):xt?[xt]:[]):Me.size?gg(Me):xt&&f==="inbox"&&So(xt);break;case"r":case"R":!Me.size&&xt&&f==="inbox"&&(S.preventDefault(),F(xt),bt(xt),K("reply"));break;case"1":!Me.size&&xt&&Xc(xt)&&(S.preventDefault(),Od(xt,"yes"));break;case"2":!Me.size&&xt&&Xc(xt)&&(S.preventDefault(),Od(xt,"no"));break;case"i":case"I":!Me.size&&xt&&f==="done"&&kk(xt)&&(S.preventDefault(),Od(xt,"yes"));break;case"s":case"S":Me.size?Mi(zs.filter(ie=>Me.has(ie.id))):xt&&(f==="inbox"||f==="snoozed")&&Mi(xt);break;case"c":case"C":case"n":case"N":S.preventDefault(),K("compose");break;case"z":case"Z":wg();break;case"Escape":Me.size?nt(new Set):be!==null&&Wl();break}}};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[le,U,j,Q,De,Ke,Tn,xt,jt,f,So,Mi,Id,wg,bt,xd,bo,Kl,ht,zs,gg,x,ke,e,Me,_e,he,be,jd,Wl,it,vo,$v]),w.useEffect(()=>{var g,S;be!==null&&(j||le||he?(g=rt.current)==null||g.blur():(S=rt.current)==null||S.focus())},[be,j,le,he]),w.useEffect(()=>{k(g=>Math.min(g,Math.max(0,jt.length-1)))},[jt.length]),w.useEffect(()=>{if(i===null||i&&!r)return;const g={view:f};j&&(g.item={product:j.product,id:j.id}),Q&&(g.repeat={product:Q.product,id:Q.id}),it&&(g.doc={product:it.product,src:it.src}),he&&(g.settings=!0),be!==null&&(g.search=be),Tn&&(g.row=Tn.id),cP(window.localStorage,g)},[i,r,f,j==null?void 0:j.id,j==null?void 0:j.product,Q==null?void 0:Q.id,it==null?void 0:it.src,it==null?void 0:it.product,he,be,Tn==null?void 0:Tn.id]),w.useEffect(()=>{if(r||i!==!0||!e)return;if(z||nA({products:e.products.length,done:aA(localStorage),forced:!!Sd.current})){s(!0);return}const g=n.current;if(!XT(g)){s(!0);return}if(g.repeat&&Bl.length===0)return;s(!0),h(g.view),g.settings&&ve(!0),g.search!==void 0&&(Jt.current={view:g.view,selected:0},Ye(g.search));const S=g.repeat?Bl.find(D=>D.id===g.repeat.id&&D.product===g.repeat.product)??null:null,O=g.item?zs.find(D=>D.id===g.item.id&&D.product===g.item.product)??null:null;S?ce(S):O&&(fg.current={id:O.id,doc:g.doc?{...g.doc}:null},g.scroll&&u({id:O.id,top:g.scroll}),F(O)),o.current=g.row??null},[r,i,e,Bl,zs,z]),w.useEffect(()=>{if(!r||!o.current)return;const g=jt.findIndex(S=>S.id===o.current);g>=0?(o.current=null,k(g)):jt.length&&(o.current=null)},[r,jt]);const N2=i===null||i===!0&&!r&&XT(n.current);w.useEffect(()=>{const g=Ed.current;if(!g||f!=="inbox"||j)return;Ed.current=null;const S=ot.filter(H=>H.id!==g.excludeId),O=Math.min(g.index,S.length-1),D=S[O];D&&(F(D),bt(D),k(O))},[ot,f,j,bt]),w.useEffect(()=>{if(e)if(ot.length===0){if(!Jm){const g=Date.now();localStorage.setItem("zero.zeroSince",String(g)),yv(g)}}else Jm&&(localStorage.removeItem("zero.zeroSince"),yv(null))},[e,ot.length,Jm]);const Fs=Toe({inFullScreen:De,walking:$s}),kg=R_(vo,Hv),[T2,A2]=w.useState(null),j2="balanced",[M2,R2]=w.useState(null),[O2,I2]=w.useState(null),e1=!Kr,D2=Ke,L2=async(g,S)=>{if(g.agent||Rn(g)||qn(g))return;const O=um(g);try{O?(await q.setRepeat({product:g.product,id:O,rule:S}),ke(`Now ${mo(S)}`)):(await q.composeRepeat({product:g.product,title:g.title,body:g.body,priority:g.priority,rule:S,engine:g.engine,model:g.model}),ke(`Repeating: ${mo(S)}`)),ac(await q.repeats())}catch(D){ke(`Not set: ${D.message}`)}};w.useMemo(()=>{const g=new Date;return g.setHours(0,0,0,0),ht.filter(S=>S.status==="done"&&!dm(S)&&S.updatedAt>=g.getTime()).length},[ht]);const t1=z!==null&&Mre(z.step),n1=z===null&&En==="none"&&f==="inbox"&&ot.length===0&&!j&&!he&&be===null;if(w.useEffect(()=>{if(t1){const g=bP(En);Bc("dark"),Hc(g),g!=="none"&&ra(na(localStorage.getItem(Lo),g));return}if(n1){const g=En;Bc("dark"),Hc(g),g!=="none"&&ra(na(localStorage.getItem(Lo),g));return}Bc(Ra(Qe)),document.documentElement.setAttribute("data-machine",Ni),Hc(En),En!=="none"&&ra(na(localStorage.getItem(Lo),En))},[n1,t1,Qe,En,Ni]),N2)return d.jsx("div",{className:"boot",children:Le});if(!e)return d.jsx("div",{className:"boot",children:Le});const P2=f==="inbox"&&ot.length===0&&!j&&!he&&be===null,$2=be===null&&!j&&!Q&&jt.length===0&&!(f==="snoozed"&&Bl.length>0);return d.jsxs("div",{"data-design-toolbar":c2?Fv:"corner","data-preview-treatment":l2,"data-reading-width":j2,"data-artifact-layout":it?kg:void 0,"data-chrome":Ul?i2?"up":"away":void 0,className:`app workspace-layout${j&&!he?" workspace-task":""}${he?" workspace-settings":""}${e1?" workspace-collapsed":""}${it?" doc-open":""}${Il?" banded":""}${le==="reply"?" composing":""}`,children:[ms&&d.jsxs("div",{className:"review-lab-controls",children:[d.jsx("span",{children:"Review exploration"}),d.jsxs("select",{"aria-label":"Focus controls",value:Lv,onChange:g=>n2(g.target.value),children:[d.jsx("option",{value:"text",children:"Focus · Text only"}),d.jsx("option",{value:"corners",children:"Focus · Frame corners + label"}),d.jsx("option",{value:"corners-icon",children:"Focus · Frame corners button"}),d.jsx("option",{value:"corners-bare",children:"Focus · Bare frame corners"}),d.jsx("option",{value:"layout",children:"Focus · Workspace layout"})]}),d.jsxs("select",{"aria-label":"Review file type",value:Md,onChange:g=>{Dv(g.target.value),ps(null)},children:[d.jsx("option",{value:"code",children:"Code"}),d.jsx("option",{value:"design",children:"Design"}),d.jsx("option",{value:"notes",children:"Text"}),d.jsx("option",{value:"multiple",children:"All three"})]}),d.jsxs("select",{"aria-label":"Review actions",value:lg,onChange:g=>t2(g.target.value),children:[d.jsx("option",{value:"header-balanced-open",children:"1 · Balanced · open only"}),d.jsx("option",{value:"header-tools-open",children:"2 · Compact · open only"}),d.jsx("option",{value:"header-card-only",children:"3 · Clickable card · no controls"}),d.jsx("option",{value:"header-feedback-only",children:"4 · Clickable card · feedback tools"}),d.jsx("option",{value:"header-balanced",children:"Compare · all controls"})]}),Md!=="code"&&d.jsxs("select",{"aria-label":"Text surface",value:ag,onChange:g=>r2(g.target.value),children:[d.jsx("option",{value:"clear",children:"Text · Fully transparent"}),d.jsx("option",{value:"glass",children:"Text · Matched glass"})]})]}),!ms&&q.isFixtures&&new URLSearchParams(location.search).has("artifactTweaks")&&d.jsxs("div",{className:"artifact-tweaks",children:[d.jsxs("select",{"aria-label":"Design toolbar",value:Fv,onChange:g=>a2(g.target.value),children:[d.jsx("option",{value:"floating",children:"Floating bar"}),d.jsx("option",{value:"corner",children:"Corner controls"}),d.jsx("option",{value:"edge",children:"Top edge"}),d.jsx("option",{value:"always",children:"Always visible"})]}),j&&d.jsxs("select",{"aria-label":"Sample artifact",value:Md,onChange:g=>{Dv(g.target.value),ps(null)},children:[d.jsx("option",{value:"multiple",children:"Multiple artifacts"}),d.jsx("option",{value:"design",children:"Design sample"}),d.jsx("option",{value:"code",children:"Code sample"}),d.jsx("option",{value:"notes",children:"Notes sample"})]})]}),d.jsx(Moe,{page:he?"settings":null,onSettings:()=>{Ct(null),ve(!0)},inboxCount:ot.length,scheduledCount:sg,view:f,collapsed:e1,onToggle:D2,onSearch:jd,onCompose:()=>K("compose"),onView:g=>{ve(!1),Ct(null),Wl(),h(g),F(null),ce(null),k(0),nt(new Set)}}),Ul&&d.jsx("div",{className:"chrome-reach",style:{width:US.width,height:US.height},"aria-hidden":"true"}),d.jsxs("header",{className:"topbar",children:[DA({searching:be!==null,workspaceNavigation:Fs,focused:!!j,settingsOpen:he})?d.jsxs("nav",{className:"tabs searching",children:[d.jsx("span",{className:"search-glyph",children:d.jsx(RP,{})}),d.jsx("input",{ref:rt,className:"search-q",value:be??"",placeholder:"Search tasks",spellCheck:!1,autoComplete:"off","aria-label":"Search tasks",onChange:g=>{Ye(g.target.value),k(0)},onKeyDown:g=>{g.key==="Escape"?(g.preventDefault(),Wl()):g.key==="ArrowDown"?(g.preventDefault(),k(S=>Math.min(S+1,Math.max(0,jt.length-1)))):g.key==="ArrowUp"?(g.preventDefault(),k(S=>Math.max(0,S-1))):g.key==="Enter"&&Tn&&(g.preventDefault(),F(Tn),bt(Tn))}}),d.jsx("button",{className:"search-out",title:"Close search","aria-label":"Close search",onClick:Wl,children:d.jsx(K0,{})})]}):he?d.jsxs("div",{className:"workspace-page-heading",children:[d.jsx("button",{className:"workspace-back","aria-label":"Back to previous page",title:"Back to previous page (Esc)",onClick:()=>{ve(!1),Ct(null)},children:d.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:d.jsx("path",{d:"m14 6-6 6 6 6"})})}),d.jsx("h1",{className:"workspace-title",children:oe==="projects"?"Projects":"Settings"})]}):j?d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"workspace-task-header",ref:I2}),d.jsx("div",{className:"workspace-artifact-header",ref:A2})]}):d.jsx("h1",{className:"workspace-title",children:Aoe(f)}),!DA({searching:be!==null,workspaceNavigation:Fs,focused:!!j,settingsOpen:he})&&d.jsxs("div",{className:"topbar-right",children:[e.supervisor.paused&&d.jsx("span",{className:"paused-chip",children:"agents paused"}),d.jsxs(d.Fragment,{children:[!Fs,j&&d.jsx("span",{style:{display:"contents"},ref:R2}),!j&&!he&&!Il&&d.jsx(Pie,{filter:dt,menu:ZP??{projects:[],moreProjects:[],priorities:[],harnesses:[]},tags:Rie(dt,e.products),open:le==="filter",onOpen:()=>K("filter"),onClose:Ut,onPick:(g,S)=>{Cn(Aie(dt,g,S)),K(null)},onClear:g=>Cn(jie(dt,g))}),d.jsx("button",{className:"icon-btn","data-hint":"new-task","data-hint-align":"right",title:"New task","aria-label":"New task",onClick:()=>K("compose"),children:d.jsx(MP,{})}),d.jsx("button",{className:"icon-btn","data-hint":"commands","data-hint-align":"right",title:"Commands","aria-label":"Commands",onClick:()=>K("palette"),children:d.jsx("span",{className:"cmd-glyph","aria-hidden":"true",children:"⌘"})}),!Fs]})]})]}),d.jsx("div",{ref:u2,hidden:he&&Fs,className:"body",children:P2?z===null&&d.jsx(aoe,{working:e.supervisor.running.length,onCompose:()=>K("compose"),onAgents:()=>{h("progress"),F(null),k(0)}}):d.jsxs(d.Fragment,{children:[d.jsx("main",{className:`list-pane${j||Q?" pinned":""}${$2?" bare":""}`,children:Q?d.jsx(nse,{rule:Q,items:ht,editing:Se,onClose:()=>{ce(null),ye(!1)},onEdit:()=>ye(!0),onEditClose:()=>ye(!1),onSave:async g=>{const{title:S,body:O}=uv(g);try{await q.setRepeat({product:Q.product,id:Q.id,rule:{title:S,body:O}});const D=await q.repeats();ac(D),ce(D.find(H=>H.id===Q.id)??null),ye(!1),ke("Changed. The next run reads this.")}catch(D){ke(`Not changed: ${D.message}`)}},onEnd:async()=>{await q.endRepeat({product:Q.product,id:Q.id}),ce(null),ac(await q.repeats()),ke(`Ended: ${Q.title}`)}}):j?d.jsx(N7,{headerTarget:O2,terminalHeaderTarget:M2,inlineArtifacts:Fs,previewSample:q.isFixtures&&(ms||new URLSearchParams(location.search).has("artifactTweaks"))?Md:void 0,artifactView:it?kg:void 0,onOpenArtifact:(g,S)=>{zv(!1),cg(S),ps({product:j.product,src:g})},item:j,onInstallUpdate:()=>{q.updateInstall()},resumeAt:c,onScrolled:g=>{const S=Date.now();S-a.current<250||(a.current=S,Gte(window.localStorage,g))},openDoc:(it==null?void 0:it.src)??null,onOpenDoc:(g,S)=>ps({product:j.product,src:g,at:S,...S?{atFrom:Date.now()}:{}}),parent:j.parent?ht.find(g=>g.id===j.parent&&g.product===j.product)??null:null,blockedBy:ht.find(g=>g.parent===j.id&&g.product===j.product&&g.status!=="done")??null,onOpenItem:g=>{F(g),bt(g)},onNotice:ke,runningMode:((f1=(d1=e.config)==null?void 0:d1.permission)==null?void 0:f1[j.product])??((p1=(h1=e.config)==null?void 0:h1.permission)==null?void 0:p1[""]),engineChoice:(((g1=(m1=e.engines)==null?void 0:m1.choices)==null?void 0:g1.length)??1)>1,runningEngine:M,productDir:((y1=e.products.find(g=>g.slug===j.product))==null?void 0:y1.dir)??null,repoDir:((w1=e.products.find(g=>g.slug===j.product))==null?void 0:w1.repoPath)??null,selectedOption:xd,interruptedFrom:C&&C.id!==j.id?C.title:null,onBackToInterrupted:()=>F(null),returnedFromSnooze:Nn(j)>0&&Nn(j)<=kt,scheduledUntil:Nn(j)>kt?Nn(j):0,scheduledByAgent:Gf(j,kt),onUnschedule:()=>Kl(j),replyOpen:le==="reply",sending:J(j),stalled:((k1=e.supervisor.stalled)==null?void 0:k1.includes(j.id))??!1,onRedeliver:()=>Qv(j),onClose:()=>F(null),onResolve:()=>So(j),onPick:g=>Id(j,g),onReply:()=>K("reply"),codexModels:Ev,codexModelDefault:Nv,onReplySend:(g,S,O,D,H,Y)=>{if(j.agent){v2(j,g);return}O&&L2(j,O),b2(j,g,S,D,H,M,Y)},onReplyClose:()=>K(null),onStop:()=>Jv(j),onReveal:()=>S2(j),onSnooze:$s?void 0:()=>Mi(j),onReopen:()=>Xv(j),session:e.supervisor.running.find(g=>g.itemId===j.id)??null,live:{queued:e.supervisor.queued,paused:e.supervisor.paused,running:e.supervisor.running.length,capacity:e.supervisor.capacity,inProgress:Hh(j,{deferredUntil:Nn(j),now:kt}),silent:((x1=e.supervisor.silent)==null?void 0:x1[j.id])??null},stoppable:!$s&&yg(j)}):d.jsx(F3,{items:jt,view:be!==null?"inbox":f,selected:x,seen:ut,running:e2,engineChoice:(((v1=(b1=e.engines)==null?void 0:b1.choices)==null?void 0:v1.length)??1)>1,engines:e.engines,stalled:e.supervisor.stalled,queued:e.supervisor.queued,silent:e.supervisor.silent,paused:e.supervisor.paused,multiSel:Me,snoozes:dn,repeats:be!==null?[]:Bl,allItems:ht,terms:Hl==null?void 0:Hl.terms,phrase:Hl==null?void 0:Hl.phrase,summaries:GP,ranked:JP,walk:z&&be===null?{key:QP,rows:Iv}:null,emptyText:be?`Nothing matches “${be}”.`:void 0,keyView:f,hoveredId:v,onHover:$?b:void 0,onSelect:g=>k(g),onOpenRepeat:g=>{F(null),ce(g)},onOpen:g=>{F(g),bt(g)},onAnswerImport:Od,onToggle:g=>{var O;const S=(O=jt[g])==null?void 0:O.id;S&&(nt(D=>{const H=new Set(D);return H.has(S)?H.delete(S):H.add(S),H}),k(g))},onRange:g=>{const[S,O]=[Math.min(x,g),Math.max(x,g)];nt(D=>new Set([...D,...jt.slice(S,O+1).map(H=>H.id)])),k(g)}})}),it&&d.jsx(M_,{target:Rd,children:d.jsx(Fte,{doc:it,roots:p2,focusControlStyle:ms?Lv:"corners-bare",headerTarget:kg==="focus"?T2:null,mode:vo,onMode:g=>{zv(vo==="beside"),cg(g)},split:O_(f2,Hv),onSplit:m2,onClose:Bv,onNotice:ke})})]})}),le==="compose"&&d.jsx(xne,{products:rg,engineChoices:(S1=e.engines)==null?void 0:S1.choices,workspaceEngine:(C1=e.engines)==null?void 0:C1.workspace,codexModels:Ev,codexModelDefault:Nv,onSend:async g=>{var Y,ge;const S=(Y=e.products.find(ie=>ie.slug===g.product))==null?void 0:Y.name,O=xb();if(g.repeat){let ie=null;try{ie=await q.composeRepeat({product:g.product,title:g.title,body:g.body,priority:g.priority,rule:g.repeat,engine:g.engine,model:g.model})}catch(ze){return ke(`Not set: ${ze.message}`),!1}K(null),ie!=null&&ie.id&&Yv(`Repeating task canceled: ${no(g.title,Tc)}`,"cancel that repeating task",O,async()=>{await q.endRepeat({product:g.product,id:ie.id}),ac(await q.repeats())}),ke(`Repeating → ${S} · Z to undo`),await _e();return}const D=((ge=ko.current)==null?void 0:ge.step)==="task",H=await q.compose(D?{...g,labels:[Fne]}:g);if(K(null),H!=null&&H.id&&D){xo({t:"sent",item:H.id,at:Date.now()}),await _e();return}H!=null&&H.id&&Yv(`Withdrawn: ${no(g.title,Tc)}`,"take back the task you just made",O,async()=>{await q.answer({product:g.product,id:H.id,status:"done"})}),ke(wne({to:S??g.product,when:g.runAt?ZO({runAt:g.runAt,repeat:null}):null}),H!=null&&H.id?{product:g.product,id:H.id}:void 0),await _e()},hidden:e.supervisor.hiddenProducts??[],onReorder:async g=>{var S,O;await((O=(S=window.zero)==null?void 0:S.setProductOrder)==null?void 0:O.call(S,{order:g})),await _e()},onHide:async(g,S)=>{var D,H,Y;await((H=(D=window.zero)==null?void 0:D.setProductHidden)==null?void 0:H.call(D,{product:g,hidden:S}));const O=((Y=e.products.find(ge=>ge.slug===g))==null?void 0:Y.name)??g;ke(S?`${O} hidden from the composer`:`${O} shown again`),await _e()},onNewProject:()=>we(!0),selectProject:ct,prefill:(z==null?void 0:z.step)==="task"?{title:$ne,body:zne,product:z.practice??z.product}:void 0,onClose:()=>K(null)}),le==="palette"&&d.jsx(xse,{onFirstRun:YP,onTutorial:()=>jv(Cie(e.products,ee,ZT())),onImportAgents:()=>{K(null),Ie(!0)},onFreshUser:w2,onDemo:k2,products:rg,supervisorPaused:e.supervisor.paused,batch:Me.size>0,look:qr,onSetLook:g=>{Ht(g),K(null)},onThemes:()=>K("themes"),staleFiles:((E1=e.restartNeeded)==null?void 0:E1.files)??[],updateReady:yC(e.update,{walking:$s,closed:""})?((N1=e.update)==null?void 0:N1.newVersion)??null:null,onInstallUpdate:()=>{K(null),q.updateInstall()},panelUp:Kr,onTogglePanel:()=>{K(null),Ke()},keyHints:$,onSetKeyHints:g=>{K(null),_(g)},onSearch:jd,itemCommands:(()=>{var H;if(Me.size){const Y=zs.filter(ie=>Me.has(ie.id)),ge=Y.length;return[...f!=="snoozed"?[{id:"done",label:`Close (${ge} selected)`,keyHint:"E",run:()=>{K(null),gg(Me)}}]:[],{id:"snooze",label:`Remind Me (Snooze ${ge} selected)`,keyHint:"S",run:()=>Mi(Y)},...Y.some(ie=>Nn(ie)>Date.now())?[{id:"unsnooze",label:`Back to Inbox (${ge} selected)`,run:()=>Kl(Y)}]:[],{id:"read",label:`Mark Read (${ge} selected)`,run:()=>{Un(ie=>new Set([...ie,...Y.map(ze=>ze.id)])),nt(new Set),K(null)}},...Y.filter(ie=>!Co(ie)).length?[{id:"resume",label:`Resume Agents (${Y.filter(ie=>!Co(ie)).length} of ${ge} selected)`,run:()=>{K(null),Zv(Y.filter(ie=>!Co(ie)))}}]:[],...lN(Y).map(ie=>({...ie,run:()=>{K(null),Gv(Y,ie.value)}}))]}const g=j??xt;if(!g)return[];const S=ga(g),O=S.find(Y=>Y.recommended)??S[0],D=()=>{F(g),bt(g)};return[...j?[{id:"remote-control",label:"Remote Control",keywords:"phone mobile continue claude rc",run:()=>{K(null),window.dispatchEvent(new Event("task-remote-control-open"))}},{id:"open-terminal",label:"Open Terminal",keywords:"shell command console",run:()=>{K(null),window.dispatchEvent(new Event("task-terminal-open"))}}]:[],...!g.agent&&!g.answer&&(g.kind==="review"||g.kind==="question"&&O||g.status==="open"&&g.kind!=="question"&&!(g.labels??[]).includes("founder"))?[{id:"approve",label:g.kind==="question"?"Approve Recommended":g.kind==="review"?"Approve (Proceed as Proposed)":"Approve (Run It)",run:()=>{K(null),x2(g)}}]:[],{id:"done",label:g.agent?"Close This":"Close This Task",keyHint:"E",run:()=>{K(null),So(g)}},{id:"reply",label:"Reply",keyHint:"R",run:()=>{D(),K("reply")}},...!g.agent&&!Co(g)&&!yg(g)?[{id:"resume-any",label:g.status==="done"?"Resume This Agent (Reopen and Carry On)":"Resume This Agent",run:()=>{K(null),Zv([g])}}]:[],ut.has(g.id)?{id:"unread",label:"Mark Unread",run:()=>{Un(Y=>{const ge=new Set(Y);return ge.delete(g.id),ge}),K(null)}}:{id:"read",label:"Mark Read",run:()=>{bt(g),K(null)}},...Nn(g)>Date.now()?[{id:"unsnooze",label:Gf(g,kt)?"Let It Run Now":"Back to Inbox",keyHint:"E",run:()=>Kl(g)}]:[],{id:"snooze",label:"Remind Me (Snooze)",keyHint:"S",run:()=>Mi(g)},...yg(g)?[{id:"stop",label:Co(g)?"Stop Agent (Moves to Inbox)":"Stop Task (Moves to Inbox)",hint:Co(g)?void 0:"nothing has started on it yet",run:()=>{K(null),Jv(g)}}]:[],...g.status==="blocked"?[{id:"send-back",label:"Send Back to Agent",run:()=>{K(null),Xv(g)}}]:[],...(H=e.supervisor.stalled)!=null&&H.includes(g.id)?[{id:"redeliver",label:"Restart the Agent (It Stopped)",run:()=>{K(null),Qv(g)}}]:[],...j?[]:[{id:"open",label:"Open",keyHint:"↵",run:()=>{K(null),D()}}],...lN([g]).map(Y=>({...Y,run:()=>{K(null),Gv([g],Y.value)}}))]})(),filtering:HA(dt),onOpenFilter:()=>K("filter"),onClearFilter:()=>{Cn(Eie),K(null)},onView:g=>{h(g),K(null),k(0)},onPause:async g=>{await q.pauseSupervisor(g),K(null),await _e()},order:e.supervisor.productOrder??[],onRankFirst:async g=>{var D,H,Y;K(null);const S=s3(rg.map(ge=>ge.slug),g,0);await((H=(D=window.zero)==null?void 0:D.setProductOrder)==null?void 0:H.call(D,{order:S}));const O=((Y=e.products.find(ge=>ge.slug===g))==null?void 0:Y.name)??g;ke(`${O} is now first`),await _e()},onResume:()=>{K(null),E2(null)},onNewProject:()=>{K(null),we(!0)},onStanding:()=>K("standing"),onSettings:()=>{K(null),Ct(null),ve(!0)},onShortcuts:()=>{K(null),Ct("shortcuts"),ve(!0)},onClose:()=>K(null)}),le==="themes"&&d.jsx(soe,{look:Ps??qr,onSetLook:Ht,tune:jr,onSetTune:pe,onClose:()=>K(null)}),he&&d.jsx(toe,{embedded:Fs,usageReadings:e.usageByEngine??(e.usage?[e.usage]:[]),now:kt,onSectionChange:P,look:Ps??qr,onSetLook:Ht,keyHints:$,onSetKeyHints:_,tune:jr,onSetTune:pe,onResetTune:ft,startPane:tt,onNewProject:()=>we(!0),onClose:()=>{ve(!1),Ct(null)}},tt??"general"),Oe&&d.jsx(xP,{products:e.products,filter:ee,onNewProject:()=>{Ie(!1),we(!0)},onProjectMade:g=>{Di(g),_e()},onDone:async({added:g,already:S,name:O,inboxes:D,made:H,noun:Y})=>{Ie(!1),ke(dA({added:g,already:S,name:O,inboxes:D,made:H,noun:Y})),await _e()},onClose:()=>Ie(!1)}),U&&d.jsx(Mne,{parent:Ene(((e==null?void 0:e.products)??[]).map(g=>g.repoPath).filter(g=>!!g),{home:Sv||"~"}),onCreate:async({name:g,repoPath:S})=>{try{const O=await q.createProduct({name:g,repoPath:S});we(!1);const D=(O==null?void 0:O.slug)??null;D&&(Di(D),se(D)),ke(S?`New project: ${g} · its code is in ${S}`:`New project: ${g}`),await _e(),Sie({made:!!D,walking:ko.current!==null,offered:!vie(localStorage)})&&Xm({product:D})}catch(O){ke(cA(O.message,g))}},onClose:()=>we(!1)}),Gm&&d.jsx(wie,{variant:Gm,value:HP,onPick:WP}),z&&!Gm&&d.jsx(pie,{run:z,claude:vd,home:Sv,opened:!!j,waiting:Hm(z,Li),later:Bm(z,Pi),beat:Iv,pointed:(xt==null?void 0:xt.id)??null,picking:le==="snooze",palette:le==="palette",view:f,tabs:cc,look:qr,onSetLook:Ht,products:e.products,onEvent:xo,onStep:g=>nr(S=>S&&Vs(S,g)),onSkipToApp:async({name:g,folder:S})=>{try{const O=await q.createProduct({name:g,repoPath:S}),D=(O==null?void 0:O.slug)??null;if(!D)throw new Error("the project was not made");return Di(D),se(D),await _e(),xo({t:"made",product:D}),null}catch(O){return cA(O.message,g)}},onPractice:async()=>{let g=null;try{g=await q.firstRunPractice()}catch{g=null}const S=(g==null?void 0:g.slug)??null;S&&(Di(S),se(S)),await _e(),xo({t:"practice",product:S??"",examples:(g==null?void 0:g.examples)??[]})},onDone:g=>lc(g,{practised:!0}),onFiled:({added:g,already:S,inboxes:O,made:D,noun:H})=>{lc([],{filed:g,practised:!0}),(g||S)&&ke(dA({added:g,already:S,name:D.length===1?D[0]:"",inboxes:O,made:D,noun:H}))},onProjectMade:g=>{Di(g),_e()},onRecheck:qP}),z&&d.jsx(Qoe,{run:z,blocked:!sA(vd),onLeave:()=>lc([],{celebrate:!1})}),kv&&d.jsx(iie,{agents:kv.agents,onGone:()=>xv(null)}),bv&&!z&&d.jsx(bie,{onStart:()=>jv(bv.product),onNot:()=>{yw(localStorage),Xm(null),ke(Ee.offerLater)}}),Il&&d.jsx(lie,{}),le==="standing"&&d.jsx(vse,{kind:vP,onClose:()=>K(null)}),(()=>{const{card:g,verdict:S,waiting:O}=coe(e.approvals,ic,wv.current);if(!g)return null;const D=uoe(g.input,g.tool);return d.jsx("div",{className:"approvals",children:d.jsxs("div",{className:"approval-stack",children:[O>1&&d.jsx("div",{className:"approval-ghost g2"}),O>0&&d.jsx("div",{className:"approval-ghost g1"}),d.jsxs("div",{className:`approval-card${S?` answered ${S}`:""}`,children:[S&&d.jsxs("div",{className:"approval-verdict","aria-live":"polite",children:[d.jsx("span",{className:"approval-verdict-mark","aria-hidden":"true",children:S==="allow"?"✓":"✕"}),d.jsx("span",{className:"approval-verdict-word",children:S==="allow"?"Allowed":"Denied"})]}),(()=>{var Fe,Vn,ys,fn,hn;const H=hg(g.item),Y=g.tool.startsWith("mcp__"),ge=((Fe=e.products.find(fc=>fc.slug===g.product))==null?void 0:Fe.name)??g.product??"an agent",ie=!Y&&((Vn=g.input)!=null&&Vn.description)?String(g.input.description).slice(0,200):null,ze=!Y&&((ys=g.input)!=null&&ys.cwd)?String(g.input.cwd):null,Xe=[ie?D.what:null,ze?`in ${ze}`:null].filter(Boolean).join(" ");return d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"approval-lede",children:[d.jsx("span",{className:"approval-lede-text",children:ie??d.jsxs(d.Fragment,{children:[ge," ",D.what]})}),O>0&&d.jsxs("span",{className:"approval-count",children:["+",O," waiting"]})]}),d.jsx("pre",{className:"approval-cmd",children:D.body}),!Y&&((fn=g.input)==null?void 0:fn.host)&&d.jsxs("div",{className:"approval-opens",children:["opens the network to ",String(g.input.host)]}),!Y&&((hn=g.input)==null?void 0:hn.grantRoot)&&d.jsxs("div",{className:"approval-opens",children:["and asks to write anywhere under ",String(g.input.grantRoot)," for the rest of this run"]}),(Xe||H)&&d.jsxs("div",{className:"approval-meta",children:[Xe&&d.jsx("span",{className:"approval-where",children:Xe}),H&&d.jsxs("button",{type:"button",className:"approval-task",title:"Open this agent. The card stays where it is.",onClick:()=>y2(g.item),children:[d.jsx("span",{className:"approval-task-title",children:H.title}),d.jsx("span",{className:"approval-task-go","aria-hidden":"true",children:"↗"})]})]})]})})(),d.jsxs("div",{className:"approval-actions",children:[d.jsx("button",{className:"approval-allow",onClick:async()=>{var H,Y;kd({id:g.id,allow:!0}),await((Y=(H=window.zero)==null?void 0:H.approve)==null?void 0:Y.call(H,{id:g.id,allow:!0})),await _e()},children:"Allow"}),d.jsx("button",{className:"approval-deny",onClick:async()=>{var H,Y;kd({id:g.id,allow:!1}),await((Y=(H=window.zero)==null?void 0:H.approve)==null?void 0:Y.call(H,{id:g.id,allow:!1})),await _e()},children:"Deny"}),d.jsxs("span",{className:"approval-hint",children:["⌘Y / ⌘N · ",g.tool]})]})]},g.id)]})})})(),le==="snooze"&&Gr&&d.jsx(loe,{item:Array.isArray(Gr)?Gr[0]:Gr,count:Array.isArray(Gr)?Gr.length:1,onPick:(g,S)=>C2(Gr,g,S),onNow:(Array.isArray(Gr)?Gr:[Gr]).some(g=>Nn(g)>Date.now())?()=>Kl(Gr):void 0,onClose:()=>{K(null),Dd(null)}}),Ol&&(Ol.goes?d.jsxs("button",{type:"button",className:"toast toast-goes",onClick:()=>{const g=[...ot,..._l,...bo,...Fl].find(S=>S.id===Ol.goes.id&&S.product===Ol.goes.product);qm(null),g&&(Ye(null),F(g),bt(g))},children:[Ol.text,d.jsx("span",{className:"toast-go",children:"Open it"})]}):d.jsx("div",{className:"toast",children:Ol.text})),me&&T&&fw[T.id]&&d.jsx(xoe,{lines:fw[T.id],comp:T.el.getBoundingClientRect(),align:T.el.dataset.hintAlign==="right"?"right":"left",text:T.el.dataset.hintText?((T1=T.el.querySelector(T.el.dataset.hintText))==null?void 0:T1.getBoundingClientRect())??null:null}),d.jsx(Ooe,{}),d.jsx(Koe,{})]})}const FP=(e,t,n)=>{var r,s;try{(s=(r=window.zero)==null?void 0:r.crash)==null||s.call(r,{name:e,message:t,stack:n})}catch{}};window.addEventListener("error",e=>{var t,n,r;FP(((t=e.error)==null?void 0:t.name)??"Error",((n=e.error)==null?void 0:n.message)??String(e.message??""),((r=e.error)==null?void 0:r.stack)??"")});window.addEventListener("unhandledrejection",e=>{const t=e.reason;FP((t==null?void 0:t.name)??"UnhandledRejection",(t==null?void 0:t.message)??String(t??""),(t==null?void 0:t.stack)??"")});use(localStorage);Bc(Ra(localStorage.getItem(Qo)));const Wie=()=>{const e=ba(localStorage.getItem(zr));Hc(e),e!=="none"&&ra(na(localStorage.getItem(Lo),e)),Coe(jP(localStorage.getItem(AP)))},Uie=()=>{Wie(),kw.createRoot(document.getElementById("root")).render(d.jsx(Dn.StrictMode,{children:d.jsx(Hie,{})}))};Uie();