claude-mux 0.7.0

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 (636) hide show
  1. package/.beads/README.md +81 -0
  2. package/.beads/config.yaml +62 -0
  3. package/.beads/interactions.jsonl +0 -0
  4. package/.beads/issues.jsonl +5 -0
  5. package/.beads/metadata.json +4 -0
  6. package/.eslintrc.json +25 -0
  7. package/.gitattributes +3 -0
  8. package/.prettierrc +7 -0
  9. package/CLAUDE.md +123 -0
  10. package/LICENSE +21 -0
  11. package/PLAN-beads-integration.md +250 -0
  12. package/README.md +366 -0
  13. package/dist/app.d.ts +2 -0
  14. package/dist/app.d.ts.map +1 -0
  15. package/dist/app.js +147 -0
  16. package/dist/app.js.map +1 -0
  17. package/dist/cli.d.ts +3 -0
  18. package/dist/cli.d.ts.map +1 -0
  19. package/dist/cli.js +65 -0
  20. package/dist/cli.js.map +1 -0
  21. package/dist/commands/index.d.ts +5 -0
  22. package/dist/commands/index.d.ts.map +1 -0
  23. package/dist/commands/index.js +5 -0
  24. package/dist/commands/index.js.map +1 -0
  25. package/dist/commands/serve.d.ts +8 -0
  26. package/dist/commands/serve.d.ts.map +1 -0
  27. package/dist/commands/serve.js +59 -0
  28. package/dist/commands/serve.js.map +1 -0
  29. package/dist/commands/setup.d.ts +4 -0
  30. package/dist/commands/setup.d.ts.map +1 -0
  31. package/dist/commands/setup.js +12 -0
  32. package/dist/commands/setup.js.map +1 -0
  33. package/dist/commands/tui.d.ts +9 -0
  34. package/dist/commands/tui.d.ts.map +1 -0
  35. package/dist/commands/tui.js +234 -0
  36. package/dist/commands/tui.js.map +1 -0
  37. package/dist/commands/uninstall.d.ts +4 -0
  38. package/dist/commands/uninstall.d.ts.map +1 -0
  39. package/dist/commands/uninstall.js +12 -0
  40. package/dist/commands/uninstall.js.map +1 -0
  41. package/dist/components/Header.d.ts +7 -0
  42. package/dist/components/Header.d.ts.map +1 -0
  43. package/dist/components/Header.js +14 -0
  44. package/dist/components/Header.js.map +1 -0
  45. package/dist/components/HelpDialog.d.ts +6 -0
  46. package/dist/components/HelpDialog.d.ts.map +1 -0
  47. package/dist/components/HelpDialog.js +14 -0
  48. package/dist/components/HelpDialog.js.map +1 -0
  49. package/dist/components/SessionEntry.d.ts +17 -0
  50. package/dist/components/SessionEntry.d.ts.map +1 -0
  51. package/dist/components/SessionEntry.js +102 -0
  52. package/dist/components/SessionEntry.js.map +1 -0
  53. package/dist/components/SessionList.d.ts +14 -0
  54. package/dist/components/SessionList.d.ts.map +1 -0
  55. package/dist/components/SessionList.js +57 -0
  56. package/dist/components/SessionList.js.map +1 -0
  57. package/dist/components/StatusBar.d.ts +6 -0
  58. package/dist/components/StatusBar.d.ts.map +1 -0
  59. package/dist/components/StatusBar.js +7 -0
  60. package/dist/components/StatusBar.js.map +1 -0
  61. package/dist/components/index.d.ts +6 -0
  62. package/dist/components/index.d.ts.map +1 -0
  63. package/dist/components/index.js +6 -0
  64. package/dist/components/index.js.map +1 -0
  65. package/dist/db/index.d.ts +2 -0
  66. package/dist/db/index.d.ts.map +1 -0
  67. package/dist/db/index.js +3 -0
  68. package/dist/db/index.js.map +1 -0
  69. package/dist/db/schema.d.ts +4 -0
  70. package/dist/db/schema.d.ts.map +1 -0
  71. package/dist/db/schema.js +23 -0
  72. package/dist/db/schema.js.map +1 -0
  73. package/dist/db/sessions-json.d.ts +85 -0
  74. package/dist/db/sessions-json.d.ts.map +1 -0
  75. package/dist/db/sessions-json.js +242 -0
  76. package/dist/db/sessions-json.js.map +1 -0
  77. package/dist/db/sessions.d.ts +38 -0
  78. package/dist/db/sessions.d.ts.map +1 -0
  79. package/dist/db/sessions.js +87 -0
  80. package/dist/db/sessions.js.map +1 -0
  81. package/dist/hooks/claude-mux-hook.d.ts +15 -0
  82. package/dist/hooks/claude-mux-hook.d.ts.map +1 -0
  83. package/dist/hooks/claude-mux-hook.js +396 -0
  84. package/dist/hooks/claude-mux-hook.js.map +1 -0
  85. package/dist/hooks/claude-watch-hook.d.ts +15 -0
  86. package/dist/hooks/claude-watch-hook.d.ts.map +1 -0
  87. package/dist/hooks/claude-watch-hook.js +396 -0
  88. package/dist/hooks/claude-watch-hook.js.map +1 -0
  89. package/dist/server/custom-server.d.ts +13 -0
  90. package/dist/server/custom-server.d.ts.map +1 -0
  91. package/dist/server/custom-server.js +63 -0
  92. package/dist/server/custom-server.js.map +1 -0
  93. package/dist/server/index.d.ts +9 -0
  94. package/dist/server/index.d.ts.map +1 -0
  95. package/dist/server/index.js +1143 -0
  96. package/dist/server/index.js.map +1 -0
  97. package/dist/server/middleware/cors.d.ts +2 -0
  98. package/dist/server/middleware/cors.d.ts.map +1 -0
  99. package/dist/server/middleware/cors.js +11 -0
  100. package/dist/server/middleware/cors.js.map +1 -0
  101. package/dist/server/routes/sessions.d.ts +3 -0
  102. package/dist/server/routes/sessions.d.ts.map +1 -0
  103. package/dist/server/routes/sessions.js +78 -0
  104. package/dist/server/routes/sessions.js.map +1 -0
  105. package/dist/server/routes/stream.d.ts +3 -0
  106. package/dist/server/routes/stream.d.ts.map +1 -0
  107. package/dist/server/routes/stream.js +45 -0
  108. package/dist/server/routes/stream.js.map +1 -0
  109. package/dist/server/types.d.ts +28 -0
  110. package/dist/server/types.d.ts.map +1 -0
  111. package/dist/server/types.js +2 -0
  112. package/dist/server/types.js.map +1 -0
  113. package/dist/server/watcher.d.ts +22 -0
  114. package/dist/server/watcher.d.ts.map +1 -0
  115. package/dist/server/watcher.js +119 -0
  116. package/dist/server/watcher.js.map +1 -0
  117. package/dist/server/websocket.d.ts +51 -0
  118. package/dist/server/websocket.d.ts.map +1 -0
  119. package/dist/server/websocket.js +156 -0
  120. package/dist/server/websocket.js.map +1 -0
  121. package/dist/server/ws-handlers.d.ts +174 -0
  122. package/dist/server/ws-handlers.d.ts.map +1 -0
  123. package/dist/server/ws-handlers.js +695 -0
  124. package/dist/server/ws-handlers.js.map +1 -0
  125. package/dist/setup/hooks.d.ts +44 -0
  126. package/dist/setup/hooks.d.ts.map +1 -0
  127. package/dist/setup/hooks.js +267 -0
  128. package/dist/setup/hooks.js.map +1 -0
  129. package/dist/setup/index.d.ts +3 -0
  130. package/dist/setup/index.d.ts.map +1 -0
  131. package/dist/setup/index.js +3 -0
  132. package/dist/setup/index.js.map +1 -0
  133. package/dist/setup/wizard.d.ts +4 -0
  134. package/dist/setup/wizard.d.ts.map +1 -0
  135. package/dist/setup/wizard.js +72 -0
  136. package/dist/setup/wizard.js.map +1 -0
  137. package/dist/tmux/detect.d.ts +25 -0
  138. package/dist/tmux/detect.d.ts.map +1 -0
  139. package/dist/tmux/detect.js +71 -0
  140. package/dist/tmux/detect.js.map +1 -0
  141. package/dist/tmux/navigate.d.ts +13 -0
  142. package/dist/tmux/navigate.d.ts.map +1 -0
  143. package/dist/tmux/navigate.js +41 -0
  144. package/dist/tmux/navigate.js.map +1 -0
  145. package/dist/tmux/pane.d.ts +57 -0
  146. package/dist/tmux/pane.d.ts.map +1 -0
  147. package/dist/tmux/pane.js +156 -0
  148. package/dist/tmux/pane.js.map +1 -0
  149. package/dist/tmux/resize.d.ts +10 -0
  150. package/dist/tmux/resize.d.ts.map +1 -0
  151. package/dist/tmux/resize.js +25 -0
  152. package/dist/tmux/resize.js.map +1 -0
  153. package/dist/utils/paths.d.ts +7 -0
  154. package/dist/utils/paths.d.ts.map +1 -0
  155. package/dist/utils/paths.js +9 -0
  156. package/dist/utils/paths.js.map +1 -0
  157. package/dist/utils/pid.d.ts +5 -0
  158. package/dist/utils/pid.d.ts.map +1 -0
  159. package/dist/utils/pid.js +14 -0
  160. package/dist/utils/pid.js.map +1 -0
  161. package/dist/utils/version.d.ts +6 -0
  162. package/dist/utils/version.d.ts.map +1 -0
  163. package/dist/utils/version.js +6 -0
  164. package/dist/utils/version.js.map +1 -0
  165. package/dist/web/client/_app/immutable/assets/0.WptSHSUl.css +1 -0
  166. package/dist/web/client/_app/immutable/assets/2.s6Kx4oz1.css +1 -0
  167. package/dist/web/client/_app/immutable/assets/4.DoNWy7tW.css +1 -0
  168. package/dist/web/client/_app/immutable/assets/AllSessionsPanel.CGHY3HLy.css +1 -0
  169. package/dist/web/client/_app/immutable/chunks/-3mUPuLP.js +1 -0
  170. package/dist/web/client/_app/immutable/chunks/B5U4_V3d.js +1 -0
  171. package/dist/web/client/_app/immutable/chunks/BHwiZXRv.js +1 -0
  172. package/dist/web/client/_app/immutable/chunks/C9P-coqM.js +1 -0
  173. package/dist/web/client/_app/immutable/chunks/Cegv0r8x.js +1 -0
  174. package/dist/web/client/_app/immutable/chunks/DU91Ml7U.js +3 -0
  175. package/dist/web/client/_app/immutable/chunks/DmdO6ygw.js +1 -0
  176. package/dist/web/client/_app/immutable/chunks/HKNo9LID.js +5 -0
  177. package/dist/web/client/_app/immutable/chunks/U4ip-C0d.js +2 -0
  178. package/dist/web/client/_app/immutable/chunks/cgUjKIhX.js +2 -0
  179. package/dist/web/client/_app/immutable/entry/app.CGIBnoln.js +2 -0
  180. package/dist/web/client/_app/immutable/entry/start.CJk8zB1j.js +1 -0
  181. package/dist/web/client/_app/immutable/nodes/0.CqlJ9a31.js +1 -0
  182. package/dist/web/client/_app/immutable/nodes/1.BQUZh2-w.js +1 -0
  183. package/dist/web/client/_app/immutable/nodes/2.CCV1YdgF.js +1 -0
  184. package/dist/web/client/_app/immutable/nodes/3.D9tDCdq8.js +1 -0
  185. package/dist/web/client/_app/immutable/nodes/4.BqPyNkFA.js +6 -0
  186. package/dist/web/client/_app/version.json +1 -0
  187. package/dist/web/client/robots.txt +3 -0
  188. package/dist/web/env.js +32 -0
  189. package/dist/web/handler.js +744 -0
  190. package/dist/web/index.js +49 -0
  191. package/dist/web/server/chunks/0-BHWsmCJv.js +23 -0
  192. package/dist/web/server/chunks/0-BHWsmCJv.js.map +1 -0
  193. package/dist/web/server/chunks/1-YRx6A8Tm.js +17 -0
  194. package/dist/web/server/chunks/1-YRx6A8Tm.js.map +1 -0
  195. package/dist/web/server/chunks/2-eC6JuGAo.js +22 -0
  196. package/dist/web/server/chunks/2-eC6JuGAo.js.map +1 -0
  197. package/dist/web/server/chunks/3-Bk-wV20p.js +32 -0
  198. package/dist/web/server/chunks/3-Bk-wV20p.js.map +1 -0
  199. package/dist/web/server/chunks/4-nteBgDrW.js +21 -0
  200. package/dist/web/server/chunks/4-nteBgDrW.js.map +1 -0
  201. package/dist/web/server/chunks/AllSessionsPanel.svelte_svelte_type_style_lang-Bt4B0-oi.js +35 -0
  202. package/dist/web/server/chunks/AllSessionsPanel.svelte_svelte_type_style_lang-Bt4B0-oi.js.map +1 -0
  203. package/dist/web/server/chunks/_layout.svelte-BIF9eZCY.js +453 -0
  204. package/dist/web/server/chunks/_layout.svelte-BIF9eZCY.js.map +1 -0
  205. package/dist/web/server/chunks/_page.svelte-Be6iabRn.js +34 -0
  206. package/dist/web/server/chunks/_page.svelte-Be6iabRn.js.map +1 -0
  207. package/dist/web/server/chunks/_page.svelte-C_fGJVSE.js +576 -0
  208. package/dist/web/server/chunks/_page.svelte-C_fGJVSE.js.map +1 -0
  209. package/dist/web/server/chunks/_page.svelte-CnfJk6cu.js +2722 -0
  210. package/dist/web/server/chunks/_page.svelte-CnfJk6cu.js.map +1 -0
  211. package/dist/web/server/chunks/_server.ts-3WAmKvn2.js +34 -0
  212. package/dist/web/server/chunks/_server.ts-3WAmKvn2.js.map +1 -0
  213. package/dist/web/server/chunks/_server.ts-BAWJCSFb.js +29 -0
  214. package/dist/web/server/chunks/_server.ts-BAWJCSFb.js.map +1 -0
  215. package/dist/web/server/chunks/_server.ts-BPpMOZCm.js +24 -0
  216. package/dist/web/server/chunks/_server.ts-BPpMOZCm.js.map +1 -0
  217. package/dist/web/server/chunks/_server.ts-BUKgRb6U.js +13 -0
  218. package/dist/web/server/chunks/_server.ts-BUKgRb6U.js.map +1 -0
  219. package/dist/web/server/chunks/_server.ts-BVHUS8fm.js +41 -0
  220. package/dist/web/server/chunks/_server.ts-BVHUS8fm.js.map +1 -0
  221. package/dist/web/server/chunks/_server.ts-BrF3od0O.js +45 -0
  222. package/dist/web/server/chunks/_server.ts-BrF3od0O.js.map +1 -0
  223. package/dist/web/server/chunks/_server.ts-C4oPmOJR.js +38 -0
  224. package/dist/web/server/chunks/_server.ts-C4oPmOJR.js.map +1 -0
  225. package/dist/web/server/chunks/_server.ts-CDAUUmG_.js +21 -0
  226. package/dist/web/server/chunks/_server.ts-CDAUUmG_.js.map +1 -0
  227. package/dist/web/server/chunks/_server.ts-CR0uWvpz.js +24 -0
  228. package/dist/web/server/chunks/_server.ts-CR0uWvpz.js.map +1 -0
  229. package/dist/web/server/chunks/_server.ts-CSqdCNGi.js +21 -0
  230. package/dist/web/server/chunks/_server.ts-CSqdCNGi.js.map +1 -0
  231. package/dist/web/server/chunks/_server.ts-DI9fzUo9.js +52 -0
  232. package/dist/web/server/chunks/_server.ts-DI9fzUo9.js.map +1 -0
  233. package/dist/web/server/chunks/_server.ts-DNjJTClI.js +46 -0
  234. package/dist/web/server/chunks/_server.ts-DNjJTClI.js.map +1 -0
  235. package/dist/web/server/chunks/_server.ts-DdbOAkOj.js +22 -0
  236. package/dist/web/server/chunks/_server.ts-DdbOAkOj.js.map +1 -0
  237. package/dist/web/server/chunks/_server.ts-Df2isGQc.js +41 -0
  238. package/dist/web/server/chunks/_server.ts-Df2isGQc.js.map +1 -0
  239. package/dist/web/server/chunks/_server.ts-Vpw25_-3.js +12 -0
  240. package/dist/web/server/chunks/_server.ts-Vpw25_-3.js.map +1 -0
  241. package/dist/web/server/chunks/_server.ts-WldRpSRi.js +26 -0
  242. package/dist/web/server/chunks/_server.ts-WldRpSRi.js.map +1 -0
  243. package/dist/web/server/chunks/alert-dialog-description-DDA6u-nS.js +2890 -0
  244. package/dist/web/server/chunks/alert-dialog-description-DDA6u-nS.js.map +1 -0
  245. package/dist/web/server/chunks/auth-DrUf-v4J.js +51 -0
  246. package/dist/web/server/chunks/auth-DrUf-v4J.js.map +1 -0
  247. package/dist/web/server/chunks/button-D6xS9rHt.js +2335 -0
  248. package/dist/web/server/chunks/button-D6xS9rHt.js.map +1 -0
  249. package/dist/web/server/chunks/chunk-EKzHsMy_.js +42 -0
  250. package/dist/web/server/chunks/chunks-DmdqVYC7.js +58 -0
  251. package/dist/web/server/chunks/chunks-DmdqVYC7.js.map +1 -0
  252. package/dist/web/server/chunks/client-CUrSQijh.js +18 -0
  253. package/dist/web/server/chunks/client-CUrSQijh.js.map +1 -0
  254. package/dist/web/server/chunks/clsx-FzI4_gi0.js +332 -0
  255. package/dist/web/server/chunks/clsx-FzI4_gi0.js.map +1 -0
  256. package/dist/web/server/chunks/error.svelte-D-c-9pTE.js +27 -0
  257. package/dist/web/server/chunks/error.svelte-D-c-9pTE.js.map +1 -0
  258. package/dist/web/server/chunks/events-BDBlYddw.js +89 -0
  259. package/dist/web/server/chunks/events-BDBlYddw.js.map +1 -0
  260. package/dist/web/server/chunks/exports-CCurQ-Tl.js +131 -0
  261. package/dist/web/server/chunks/exports-CCurQ-Tl.js.map +1 -0
  262. package/dist/web/server/chunks/hooks.server-BK1bopsh.js +86 -0
  263. package/dist/web/server/chunks/hooks.server-BK1bopsh.js.map +1 -0
  264. package/dist/web/server/chunks/index2-BQnysSj-.js +2588 -0
  265. package/dist/web/server/chunks/index2-BQnysSj-.js.map +1 -0
  266. package/dist/web/server/chunks/internal-DLENj6YI.js +61 -0
  267. package/dist/web/server/chunks/internal-DLENj6YI.js.map +1 -0
  268. package/dist/web/server/chunks/pane-Dg3pKvsm.js +94 -0
  269. package/dist/web/server/chunks/pane-Dg3pKvsm.js.map +1 -0
  270. package/dist/web/server/chunks/sessions-json-DgfkCLO7.js +107 -0
  271. package/dist/web/server/chunks/sessions-json-DgfkCLO7.js.map +1 -0
  272. package/dist/web/server/chunks/sessions.svelte-Ds82MvkB.js +178 -0
  273. package/dist/web/server/chunks/sessions.svelte-Ds82MvkB.js.map +1 -0
  274. package/dist/web/server/chunks/state.svelte-xeAZvWZ6.js +7 -0
  275. package/dist/web/server/chunks/state.svelte-xeAZvWZ6.js.map +1 -0
  276. package/dist/web/server/chunks/ws-handlers-B4r5eSP2.js +733 -0
  277. package/dist/web/server/chunks/ws-handlers-B4r5eSP2.js.map +1 -0
  278. package/dist/web/server/index.js +4907 -0
  279. package/dist/web/server/index.js.map +1 -0
  280. package/dist/web/server/manifest.js +233 -0
  281. package/dist/web/server/manifest.js.map +1 -0
  282. package/docs/images/desktop-dashboard.png +0 -0
  283. package/docs/images/desktop-session.png +0 -0
  284. package/docs/images/mobile-dashboard.png +0 -0
  285. package/docs/images/mobile-session.png +0 -0
  286. package/docs/release-checklist.md +228 -0
  287. package/docs/removing-hooks.md +135 -0
  288. package/docs/state-transitions.md +109 -0
  289. package/package.json +71 -0
  290. package/src/app.tsx +188 -0
  291. package/src/cli.ts +83 -0
  292. package/src/commands/index.ts +4 -0
  293. package/src/commands/serve.ts +75 -0
  294. package/src/commands/setup.ts +13 -0
  295. package/src/commands/tui.ts +255 -0
  296. package/src/commands/uninstall.ts +13 -0
  297. package/src/components/Header.tsx +32 -0
  298. package/src/components/HelpDialog.tsx +45 -0
  299. package/src/components/SessionEntry.tsx +202 -0
  300. package/src/components/SessionList.tsx +98 -0
  301. package/src/components/StatusBar.tsx +26 -0
  302. package/src/components/index.ts +5 -0
  303. package/src/db/index.ts +20 -0
  304. package/src/db/sessions-json.ts +314 -0
  305. package/src/hooks/claude-mux-hook.ts +498 -0
  306. package/src/server/watcher.ts +128 -0
  307. package/src/server/ws-handlers.ts +922 -0
  308. package/src/setup/hooks.ts +333 -0
  309. package/src/setup/index.ts +2 -0
  310. package/src/setup/wizard.ts +81 -0
  311. package/src/tmux/detect.ts +87 -0
  312. package/src/tmux/navigate.ts +42 -0
  313. package/src/tmux/pane.ts +167 -0
  314. package/src/tmux/resize.ts +28 -0
  315. package/src/utils/paths.ts +11 -0
  316. package/src/utils/pid.ts +12 -0
  317. package/src/utils/version.ts +5 -0
  318. package/tests/components/Header.test.tsx +42 -0
  319. package/tests/components/SessionEntry-extended.test.tsx +165 -0
  320. package/tests/components/SessionEntry.test.tsx +138 -0
  321. package/tests/components/SessionList.test.tsx +110 -0
  322. package/tests/components/StatusBar.test.tsx +31 -0
  323. package/tests/db/index.test.ts +78 -0
  324. package/tests/db/sessions.test.ts +230 -0
  325. package/tests/server/integration.test.ts +319 -0
  326. package/tests/server/sessions.test.ts +114 -0
  327. package/tests/setup/hooks-integration.test.ts +148 -0
  328. package/tests/setup/hooks.test.ts +123 -0
  329. package/tests/tmux/detect.test.ts +54 -0
  330. package/tests/tmux/navigate.test.ts +30 -0
  331. package/tests/utils/pid.test.ts +17 -0
  332. package/tsconfig.cli.json +9 -0
  333. package/tsconfig.json +22 -0
  334. package/vitest.config.ts +29 -0
  335. package/web/.svelte-kit/adapter-bun/.vite/manifest.json +408 -0
  336. package/web/.svelte-kit/adapter-bun/_app/immutable/assets/AllSessionsPanel.BKhqOrbV.css +1 -0
  337. package/web/.svelte-kit/adapter-bun/_app/immutable/assets/_layout.WptSHSUl.css +1 -0
  338. package/web/.svelte-kit/adapter-bun/_app/immutable/assets/_page.DldLgTc-.css +1 -0
  339. package/web/.svelte-kit/adapter-bun/_app/immutable/assets/_page.DoNWy7tW.css +1 -0
  340. package/web/.svelte-kit/adapter-bun/chunks/AllSessionsPanel.svelte_svelte_type_style_lang.js +49 -0
  341. package/web/.svelte-kit/adapter-bun/chunks/alert-dialog-description.js +2670 -0
  342. package/web/.svelte-kit/adapter-bun/chunks/auth.js +59 -0
  343. package/web/.svelte-kit/adapter-bun/chunks/button.js +82 -0
  344. package/web/.svelte-kit/adapter-bun/chunks/client.js +29 -0
  345. package/web/.svelte-kit/adapter-bun/chunks/context.js +133 -0
  346. package/web/.svelte-kit/adapter-bun/chunks/environment.js +34 -0
  347. package/web/.svelte-kit/adapter-bun/chunks/events.js +121 -0
  348. package/web/.svelte-kit/adapter-bun/chunks/exports.js +174 -0
  349. package/web/.svelte-kit/adapter-bun/chunks/false.js +4 -0
  350. package/web/.svelte-kit/adapter-bun/chunks/index.js +59 -0
  351. package/web/.svelte-kit/adapter-bun/chunks/index2.js +2828 -0
  352. package/web/.svelte-kit/adapter-bun/chunks/internal.js +920 -0
  353. package/web/.svelte-kit/adapter-bun/chunks/pane.js +82 -0
  354. package/web/.svelte-kit/adapter-bun/chunks/sessions-json.js +124 -0
  355. package/web/.svelte-kit/adapter-bun/chunks/sessions.svelte.js +229 -0
  356. package/web/.svelte-kit/adapter-bun/chunks/shared.js +542 -0
  357. package/web/.svelte-kit/adapter-bun/chunks/state.svelte.js +16 -0
  358. package/web/.svelte-kit/adapter-bun/chunks/utils.js +43 -0
  359. package/web/.svelte-kit/adapter-bun/chunks/ws-handlers.js +782 -0
  360. package/web/.svelte-kit/adapter-bun/entries/endpoints/api/auth/login/_server.ts.js +22 -0
  361. package/web/.svelte-kit/adapter-bun/entries/endpoints/api/auth/logout/_server.ts.js +9 -0
  362. package/web/.svelte-kit/adapter-bun/entries/endpoints/api/beads/_server.ts.js +22 -0
  363. package/web/.svelte-kit/adapter-bun/entries/endpoints/api/browse/_server.ts.js +50 -0
  364. package/web/.svelte-kit/adapter-bun/entries/endpoints/api/chrome/_server.ts.js +30 -0
  365. package/web/.svelte-kit/adapter-bun/entries/endpoints/api/files/image/_server.ts.js +53 -0
  366. package/web/.svelte-kit/adapter-bun/entries/endpoints/api/health/_server.ts.js +7 -0
  367. package/web/.svelte-kit/adapter-bun/entries/endpoints/api/projects/new-session/_server.ts.js +44 -0
  368. package/web/.svelte-kit/adapter-bun/entries/endpoints/api/sessions/_id_/_server.ts.js +20 -0
  369. package/web/.svelte-kit/adapter-bun/entries/endpoints/api/sessions/_id_/kill/_server.ts.js +36 -0
  370. package/web/.svelte-kit/adapter-bun/entries/endpoints/api/sessions/_id_/restart/_server.ts.js +40 -0
  371. package/web/.svelte-kit/adapter-bun/entries/endpoints/api/sessions/_id_/screenshots/_server.ts.js +28 -0
  372. package/web/.svelte-kit/adapter-bun/entries/endpoints/api/sessions/_id_/send/_server.ts.js +29 -0
  373. package/web/.svelte-kit/adapter-bun/entries/endpoints/api/sessions/_server.ts.js +49 -0
  374. package/web/.svelte-kit/adapter-bun/entries/endpoints/api/sessions/_target_/output/_server.ts.js +14 -0
  375. package/web/.svelte-kit/adapter-bun/entries/endpoints/api/tmux/panes/_server.ts.js +21 -0
  376. package/web/.svelte-kit/adapter-bun/entries/fallbacks/error.svelte.js +27 -0
  377. package/web/.svelte-kit/adapter-bun/entries/hooks.server.js +105 -0
  378. package/web/.svelte-kit/adapter-bun/entries/pages/_layout.svelte.js +499 -0
  379. package/web/.svelte-kit/adapter-bun/entries/pages/_page.svelte.js +3057 -0
  380. package/web/.svelte-kit/adapter-bun/entries/pages/login/_page.server.ts.js +15 -0
  381. package/web/.svelte-kit/adapter-bun/entries/pages/login/_page.svelte.js +37 -0
  382. package/web/.svelte-kit/adapter-bun/entries/pages/session/_target_/_page.svelte.js +653 -0
  383. package/web/.svelte-kit/adapter-bun/index.js +3864 -0
  384. package/web/.svelte-kit/adapter-bun/internal.js +13 -0
  385. package/web/.svelte-kit/adapter-bun/manifest-full.js +167 -0
  386. package/web/.svelte-kit/adapter-bun/manifest.js +171 -0
  387. package/web/.svelte-kit/adapter-bun/nodes/0.js +8 -0
  388. package/web/.svelte-kit/adapter-bun/nodes/1.js +8 -0
  389. package/web/.svelte-kit/adapter-bun/nodes/2.js +8 -0
  390. package/web/.svelte-kit/adapter-bun/nodes/3.js +10 -0
  391. package/web/.svelte-kit/adapter-bun/nodes/4.js +8 -0
  392. package/web/.svelte-kit/adapter-bun/remote-entry.js +541 -0
  393. package/web/.svelte-kit/adapter-node/.vite/manifest.json +223 -0
  394. package/web/.svelte-kit/adapter-node/_app/immutable/assets/_layout.4NiX29PU.css +1 -0
  395. package/web/.svelte-kit/adapter-node/_app/immutable/assets/_page.BEMzYUGV.css +1 -0
  396. package/web/.svelte-kit/adapter-node/_app/immutable/assets/_page.DOJn7TG7.css +1 -0
  397. package/web/.svelte-kit/adapter-node/chunks/context.js +121 -0
  398. package/web/.svelte-kit/adapter-node/chunks/environment.js +34 -0
  399. package/web/.svelte-kit/adapter-node/chunks/exports.js +174 -0
  400. package/web/.svelte-kit/adapter-node/chunks/false.js +4 -0
  401. package/web/.svelte-kit/adapter-node/chunks/index.js +59 -0
  402. package/web/.svelte-kit/adapter-node/chunks/index2.js +2710 -0
  403. package/web/.svelte-kit/adapter-node/chunks/internal.js +1005 -0
  404. package/web/.svelte-kit/adapter-node/chunks/sessions-json.js +109 -0
  405. package/web/.svelte-kit/adapter-node/chunks/sessions.svelte.js +67 -0
  406. package/web/.svelte-kit/adapter-node/chunks/shared.js +542 -0
  407. package/web/.svelte-kit/adapter-node/chunks/state.svelte.js +16 -0
  408. package/web/.svelte-kit/adapter-node/chunks/utils.js +43 -0
  409. package/web/.svelte-kit/adapter-node/entries/endpoints/api/browse/_server.ts.js +50 -0
  410. package/web/.svelte-kit/adapter-node/entries/endpoints/api/health/_server.ts.js +7 -0
  411. package/web/.svelte-kit/adapter-node/entries/endpoints/api/projects/new-session/_server.ts.js +44 -0
  412. package/web/.svelte-kit/adapter-node/entries/endpoints/api/sessions/_id_/_server.ts.js +20 -0
  413. package/web/.svelte-kit/adapter-node/entries/endpoints/api/sessions/_id_/kill/_server.ts.js +30 -0
  414. package/web/.svelte-kit/adapter-node/entries/endpoints/api/sessions/_id_/send/_server.ts.js +22 -0
  415. package/web/.svelte-kit/adapter-node/entries/endpoints/api/sessions/_server.ts.js +126 -0
  416. package/web/.svelte-kit/adapter-node/entries/endpoints/api/sessions/_target_/output/_server.ts.js +14 -0
  417. package/web/.svelte-kit/adapter-node/entries/fallbacks/error.svelte.js +44 -0
  418. package/web/.svelte-kit/adapter-node/entries/pages/_layout.svelte.js +12 -0
  419. package/web/.svelte-kit/adapter-node/entries/pages/_page.svelte.js +87 -0
  420. package/web/.svelte-kit/adapter-node/entries/pages/session/_target_/_page.svelte.js +76 -0
  421. package/web/.svelte-kit/adapter-node/index.js +3864 -0
  422. package/web/.svelte-kit/adapter-node/internal.js +13 -0
  423. package/web/.svelte-kit/adapter-node/manifest-full.js +103 -0
  424. package/web/.svelte-kit/adapter-node/manifest.js +107 -0
  425. package/web/.svelte-kit/adapter-node/nodes/0.js +8 -0
  426. package/web/.svelte-kit/adapter-node/nodes/1.js +8 -0
  427. package/web/.svelte-kit/adapter-node/nodes/2.js +8 -0
  428. package/web/.svelte-kit/adapter-node/nodes/3.js +8 -0
  429. package/web/.svelte-kit/adapter-node/remote-entry.js +541 -0
  430. package/web/.svelte-kit/ambient.d.ts +187 -0
  431. package/web/.svelte-kit/generated/client/app.js +33 -0
  432. package/web/.svelte-kit/generated/client/matchers.js +1 -0
  433. package/web/.svelte-kit/generated/client/nodes/0.js +1 -0
  434. package/web/.svelte-kit/generated/client/nodes/1.js +1 -0
  435. package/web/.svelte-kit/generated/client/nodes/2.js +1 -0
  436. package/web/.svelte-kit/generated/client/nodes/3.js +1 -0
  437. package/web/.svelte-kit/generated/client/nodes/4.js +1 -0
  438. package/web/.svelte-kit/generated/client-optimized/app.js +33 -0
  439. package/web/.svelte-kit/generated/client-optimized/matchers.js +1 -0
  440. package/web/.svelte-kit/generated/client-optimized/nodes/0.js +1 -0
  441. package/web/.svelte-kit/generated/client-optimized/nodes/1.js +1 -0
  442. package/web/.svelte-kit/generated/client-optimized/nodes/2.js +1 -0
  443. package/web/.svelte-kit/generated/client-optimized/nodes/3.js +1 -0
  444. package/web/.svelte-kit/generated/client-optimized/nodes/4.js +1 -0
  445. package/web/.svelte-kit/generated/root.js +3 -0
  446. package/web/.svelte-kit/generated/root.svelte +68 -0
  447. package/web/.svelte-kit/generated/server/internal.js +53 -0
  448. package/web/.svelte-kit/non-ambient.d.ts +73 -0
  449. package/web/.svelte-kit/output/client/.vite/manifest.json +203 -0
  450. package/web/.svelte-kit/output/client/_app/immutable/assets/0.WptSHSUl.css +1 -0
  451. package/web/.svelte-kit/output/client/_app/immutable/assets/2.s6Kx4oz1.css +1 -0
  452. package/web/.svelte-kit/output/client/_app/immutable/assets/4.DoNWy7tW.css +1 -0
  453. package/web/.svelte-kit/output/client/_app/immutable/assets/AllSessionsPanel.CGHY3HLy.css +1 -0
  454. package/web/.svelte-kit/output/client/_app/immutable/chunks/-3mUPuLP.js +1 -0
  455. package/web/.svelte-kit/output/client/_app/immutable/chunks/B5U4_V3d.js +1 -0
  456. package/web/.svelte-kit/output/client/_app/immutable/chunks/BHwiZXRv.js +1 -0
  457. package/web/.svelte-kit/output/client/_app/immutable/chunks/C9P-coqM.js +1 -0
  458. package/web/.svelte-kit/output/client/_app/immutable/chunks/Cegv0r8x.js +1 -0
  459. package/web/.svelte-kit/output/client/_app/immutable/chunks/DU91Ml7U.js +3 -0
  460. package/web/.svelte-kit/output/client/_app/immutable/chunks/DmdO6ygw.js +1 -0
  461. package/web/.svelte-kit/output/client/_app/immutable/chunks/HKNo9LID.js +5 -0
  462. package/web/.svelte-kit/output/client/_app/immutable/chunks/U4ip-C0d.js +2 -0
  463. package/web/.svelte-kit/output/client/_app/immutable/chunks/cgUjKIhX.js +2 -0
  464. package/web/.svelte-kit/output/client/_app/immutable/entry/app.CGIBnoln.js +2 -0
  465. package/web/.svelte-kit/output/client/_app/immutable/entry/start.CJk8zB1j.js +1 -0
  466. package/web/.svelte-kit/output/client/_app/immutable/nodes/0.CqlJ9a31.js +1 -0
  467. package/web/.svelte-kit/output/client/_app/immutable/nodes/1.BQUZh2-w.js +1 -0
  468. package/web/.svelte-kit/output/client/_app/immutable/nodes/2.CCV1YdgF.js +1 -0
  469. package/web/.svelte-kit/output/client/_app/immutable/nodes/3.D9tDCdq8.js +1 -0
  470. package/web/.svelte-kit/output/client/_app/immutable/nodes/4.BqPyNkFA.js +6 -0
  471. package/web/.svelte-kit/output/client/_app/version.json +1 -0
  472. package/web/.svelte-kit/output/client/robots.txt +3 -0
  473. package/web/.svelte-kit/output/server/.vite/manifest.json +408 -0
  474. package/web/.svelte-kit/output/server/_app/immutable/assets/AllSessionsPanel.BKhqOrbV.css +1 -0
  475. package/web/.svelte-kit/output/server/_app/immutable/assets/_layout.WptSHSUl.css +1 -0
  476. package/web/.svelte-kit/output/server/_app/immutable/assets/_page.DldLgTc-.css +1 -0
  477. package/web/.svelte-kit/output/server/_app/immutable/assets/_page.DoNWy7tW.css +1 -0
  478. package/web/.svelte-kit/output/server/chunks/AllSessionsPanel.svelte_svelte_type_style_lang.js +49 -0
  479. package/web/.svelte-kit/output/server/chunks/alert-dialog-description.js +2670 -0
  480. package/web/.svelte-kit/output/server/chunks/auth.js +59 -0
  481. package/web/.svelte-kit/output/server/chunks/button.js +82 -0
  482. package/web/.svelte-kit/output/server/chunks/client.js +29 -0
  483. package/web/.svelte-kit/output/server/chunks/context.js +133 -0
  484. package/web/.svelte-kit/output/server/chunks/environment.js +34 -0
  485. package/web/.svelte-kit/output/server/chunks/events.js +121 -0
  486. package/web/.svelte-kit/output/server/chunks/exports.js +174 -0
  487. package/web/.svelte-kit/output/server/chunks/false.js +4 -0
  488. package/web/.svelte-kit/output/server/chunks/index.js +59 -0
  489. package/web/.svelte-kit/output/server/chunks/index2.js +2828 -0
  490. package/web/.svelte-kit/output/server/chunks/internal.js +920 -0
  491. package/web/.svelte-kit/output/server/chunks/pane.js +82 -0
  492. package/web/.svelte-kit/output/server/chunks/sessions-json.js +124 -0
  493. package/web/.svelte-kit/output/server/chunks/sessions.svelte.js +229 -0
  494. package/web/.svelte-kit/output/server/chunks/shared.js +542 -0
  495. package/web/.svelte-kit/output/server/chunks/state.svelte.js +16 -0
  496. package/web/.svelte-kit/output/server/chunks/utils.js +43 -0
  497. package/web/.svelte-kit/output/server/chunks/ws-handlers.js +782 -0
  498. package/web/.svelte-kit/output/server/entries/endpoints/api/auth/login/_server.ts.js +22 -0
  499. package/web/.svelte-kit/output/server/entries/endpoints/api/auth/logout/_server.ts.js +9 -0
  500. package/web/.svelte-kit/output/server/entries/endpoints/api/beads/_server.ts.js +22 -0
  501. package/web/.svelte-kit/output/server/entries/endpoints/api/browse/_server.ts.js +50 -0
  502. package/web/.svelte-kit/output/server/entries/endpoints/api/chrome/_server.ts.js +30 -0
  503. package/web/.svelte-kit/output/server/entries/endpoints/api/files/image/_server.ts.js +53 -0
  504. package/web/.svelte-kit/output/server/entries/endpoints/api/health/_server.ts.js +7 -0
  505. package/web/.svelte-kit/output/server/entries/endpoints/api/projects/new-session/_server.ts.js +44 -0
  506. package/web/.svelte-kit/output/server/entries/endpoints/api/sessions/_id_/_server.ts.js +20 -0
  507. package/web/.svelte-kit/output/server/entries/endpoints/api/sessions/_id_/kill/_server.ts.js +36 -0
  508. package/web/.svelte-kit/output/server/entries/endpoints/api/sessions/_id_/restart/_server.ts.js +40 -0
  509. package/web/.svelte-kit/output/server/entries/endpoints/api/sessions/_id_/screenshots/_server.ts.js +28 -0
  510. package/web/.svelte-kit/output/server/entries/endpoints/api/sessions/_id_/send/_server.ts.js +29 -0
  511. package/web/.svelte-kit/output/server/entries/endpoints/api/sessions/_server.ts.js +49 -0
  512. package/web/.svelte-kit/output/server/entries/endpoints/api/sessions/_target_/output/_server.ts.js +14 -0
  513. package/web/.svelte-kit/output/server/entries/endpoints/api/tmux/panes/_server.ts.js +21 -0
  514. package/web/.svelte-kit/output/server/entries/fallbacks/error.svelte.js +27 -0
  515. package/web/.svelte-kit/output/server/entries/hooks.server.js +105 -0
  516. package/web/.svelte-kit/output/server/entries/pages/_layout.svelte.js +499 -0
  517. package/web/.svelte-kit/output/server/entries/pages/_page.svelte.js +3057 -0
  518. package/web/.svelte-kit/output/server/entries/pages/login/_page.server.ts.js +15 -0
  519. package/web/.svelte-kit/output/server/entries/pages/login/_page.svelte.js +37 -0
  520. package/web/.svelte-kit/output/server/entries/pages/session/_target_/_page.svelte.js +653 -0
  521. package/web/.svelte-kit/output/server/index.js +3864 -0
  522. package/web/.svelte-kit/output/server/internal.js +13 -0
  523. package/web/.svelte-kit/output/server/manifest-full.js +167 -0
  524. package/web/.svelte-kit/output/server/manifest.js +167 -0
  525. package/web/.svelte-kit/output/server/nodes/0.js +8 -0
  526. package/web/.svelte-kit/output/server/nodes/1.js +8 -0
  527. package/web/.svelte-kit/output/server/nodes/2.js +8 -0
  528. package/web/.svelte-kit/output/server/nodes/3.js +10 -0
  529. package/web/.svelte-kit/output/server/nodes/4.js +8 -0
  530. package/web/.svelte-kit/output/server/remote-entry.js +541 -0
  531. package/web/.svelte-kit/tsconfig.json +58 -0
  532. package/web/.svelte-kit/types/route_meta_data.json +55 -0
  533. package/web/.svelte-kit/types/src/routes/$types.d.ts +24 -0
  534. package/web/.svelte-kit/types/src/routes/api/auth/login/$types.d.ts +10 -0
  535. package/web/.svelte-kit/types/src/routes/api/auth/logout/$types.d.ts +10 -0
  536. package/web/.svelte-kit/types/src/routes/api/beads/$types.d.ts +10 -0
  537. package/web/.svelte-kit/types/src/routes/api/browse/$types.d.ts +10 -0
  538. package/web/.svelte-kit/types/src/routes/api/chrome/$types.d.ts +10 -0
  539. package/web/.svelte-kit/types/src/routes/api/files/image/$types.d.ts +10 -0
  540. package/web/.svelte-kit/types/src/routes/api/health/$types.d.ts +10 -0
  541. package/web/.svelte-kit/types/src/routes/api/projects/new-session/$types.d.ts +10 -0
  542. package/web/.svelte-kit/types/src/routes/api/sessions/$types.d.ts +10 -0
  543. package/web/.svelte-kit/types/src/routes/api/sessions/[id]/$types.d.ts +11 -0
  544. package/web/.svelte-kit/types/src/routes/api/sessions/[id]/kill/$types.d.ts +11 -0
  545. package/web/.svelte-kit/types/src/routes/api/sessions/[id]/restart/$types.d.ts +11 -0
  546. package/web/.svelte-kit/types/src/routes/api/sessions/[id]/screenshots/$types.d.ts +11 -0
  547. package/web/.svelte-kit/types/src/routes/api/sessions/[id]/send/$types.d.ts +11 -0
  548. package/web/.svelte-kit/types/src/routes/api/sessions/[target]/output/$types.d.ts +11 -0
  549. package/web/.svelte-kit/types/src/routes/api/tmux/panes/$types.d.ts +10 -0
  550. package/web/.svelte-kit/types/src/routes/login/$types.d.ts +25 -0
  551. package/web/.svelte-kit/types/src/routes/login/proxy+page.server.ts +19 -0
  552. package/web/.svelte-kit/types/src/routes/session/[target]/$types.d.ts +19 -0
  553. package/web/README.md +42 -0
  554. package/web/components.json +16 -0
  555. package/web/package.json +35 -0
  556. package/web/src/app.css +128 -0
  557. package/web/src/app.d.ts +13 -0
  558. package/web/src/app.html +11 -0
  559. package/web/src/hooks.server.ts +156 -0
  560. package/web/src/lib/assets/favicon.svg +1 -0
  561. package/web/src/lib/components/AllSessionsPanel.svelte +789 -0
  562. package/web/src/lib/components/BeadsPanel.svelte +146 -0
  563. package/web/src/lib/components/IssueItem.svelte +287 -0
  564. package/web/src/lib/components/ScreenshotsPanel.svelte +336 -0
  565. package/web/src/lib/components/SessionsSidebar.svelte +312 -0
  566. package/web/src/lib/components/TerminalRenderer.svelte +189 -0
  567. package/web/src/lib/components/ui/alert-dialog/alert-dialog-action.svelte +18 -0
  568. package/web/src/lib/components/ui/alert-dialog/alert-dialog-cancel.svelte +18 -0
  569. package/web/src/lib/components/ui/alert-dialog/alert-dialog-content.svelte +29 -0
  570. package/web/src/lib/components/ui/alert-dialog/alert-dialog-description.svelte +17 -0
  571. package/web/src/lib/components/ui/alert-dialog/alert-dialog-footer.svelte +20 -0
  572. package/web/src/lib/components/ui/alert-dialog/alert-dialog-header.svelte +20 -0
  573. package/web/src/lib/components/ui/alert-dialog/alert-dialog-overlay.svelte +20 -0
  574. package/web/src/lib/components/ui/alert-dialog/alert-dialog-portal.svelte +7 -0
  575. package/web/src/lib/components/ui/alert-dialog/alert-dialog-title.svelte +17 -0
  576. package/web/src/lib/components/ui/alert-dialog/alert-dialog-trigger.svelte +7 -0
  577. package/web/src/lib/components/ui/alert-dialog/alert-dialog.svelte +7 -0
  578. package/web/src/lib/components/ui/alert-dialog/index.ts +37 -0
  579. package/web/src/lib/components/ui/badge/badge.svelte +50 -0
  580. package/web/src/lib/components/ui/badge/index.ts +2 -0
  581. package/web/src/lib/components/ui/button/button.svelte +86 -0
  582. package/web/src/lib/components/ui/button/index.ts +17 -0
  583. package/web/src/lib/components/ui/checkbox/checkbox.svelte +36 -0
  584. package/web/src/lib/components/ui/checkbox/index.ts +6 -0
  585. package/web/src/lib/components/ui/dialog/dialog-close.svelte +7 -0
  586. package/web/src/lib/components/ui/dialog/dialog-content.svelte +45 -0
  587. package/web/src/lib/components/ui/dialog/dialog-description.svelte +17 -0
  588. package/web/src/lib/components/ui/dialog/dialog-footer.svelte +20 -0
  589. package/web/src/lib/components/ui/dialog/dialog-header.svelte +20 -0
  590. package/web/src/lib/components/ui/dialog/dialog-overlay.svelte +20 -0
  591. package/web/src/lib/components/ui/dialog/dialog-portal.svelte +7 -0
  592. package/web/src/lib/components/ui/dialog/dialog-title.svelte +17 -0
  593. package/web/src/lib/components/ui/dialog/dialog-trigger.svelte +7 -0
  594. package/web/src/lib/components/ui/dialog/dialog.svelte +7 -0
  595. package/web/src/lib/components/ui/dialog/index.ts +34 -0
  596. package/web/src/lib/components/ui/scroll-area/index.ts +10 -0
  597. package/web/src/lib/components/ui/scroll-area/scroll-area-scrollbar.svelte +31 -0
  598. package/web/src/lib/components/ui/scroll-area/scroll-area.svelte +43 -0
  599. package/web/src/lib/components/ui/textarea/index.ts +7 -0
  600. package/web/src/lib/components/ui/textarea/textarea.svelte +23 -0
  601. package/web/src/lib/index.ts +1 -0
  602. package/web/src/lib/server/auth.ts +90 -0
  603. package/web/src/lib/stores/beads.svelte.ts +163 -0
  604. package/web/src/lib/stores/input-injection.svelte.ts +39 -0
  605. package/web/src/lib/stores/preferences.svelte.ts +55 -0
  606. package/web/src/lib/stores/sessions.svelte.ts +108 -0
  607. package/web/src/lib/stores/terminal.svelte.ts +96 -0
  608. package/web/src/lib/stores/websocket-base.svelte.ts +209 -0
  609. package/web/src/lib/types/terminal.ts +31 -0
  610. package/web/src/lib/utils/terminal-parser.ts +239 -0
  611. package/web/src/lib/utils.ts +13 -0
  612. package/web/src/routes/+layout.svelte +450 -0
  613. package/web/src/routes/+page.svelte +19 -0
  614. package/web/src/routes/api/auth/login/+server.ts +34 -0
  615. package/web/src/routes/api/auth/logout/+server.ts +10 -0
  616. package/web/src/routes/api/beads/+server.ts +28 -0
  617. package/web/src/routes/api/browse/+server.ts +59 -0
  618. package/web/src/routes/api/chrome/+server.ts +35 -0
  619. package/web/src/routes/api/files/image/+server.ts +64 -0
  620. package/web/src/routes/api/health/+server.ts +6 -0
  621. package/web/src/routes/api/projects/new-session/+server.ts +50 -0
  622. package/web/src/routes/api/sessions/+server.ts +62 -0
  623. package/web/src/routes/api/sessions/[id]/+server.ts +19 -0
  624. package/web/src/routes/api/sessions/[id]/kill/+server.ts +46 -0
  625. package/web/src/routes/api/sessions/[id]/restart/+server.ts +59 -0
  626. package/web/src/routes/api/sessions/[id]/screenshots/+server.ts +32 -0
  627. package/web/src/routes/api/sessions/[id]/send/+server.ts +31 -0
  628. package/web/src/routes/api/sessions/[target]/output/+server.ts +13 -0
  629. package/web/src/routes/api/tmux/panes/+server.ts +32 -0
  630. package/web/src/routes/login/+page.server.ts +18 -0
  631. package/web/src/routes/login/+page.svelte +69 -0
  632. package/web/src/routes/session/[target]/+page.svelte +450 -0
  633. package/web/static/robots.txt +3 -0
  634. package/web/svelte.config.js +20 -0
  635. package/web/tsconfig.json +20 -0
  636. package/web/vite.config.ts +154 -0
@@ -0,0 +1,2710 @@
1
+ import { r as run_all, f as deferred, i as includes, h as safe_equals, j as equals, o as object_prototype, k as array_prototype, l as get_descriptor, m as get_prototype_of, p as is_array, q as is_extensible, t as index_of, e as escape_html, n as noop, u as set_ssr_context, c as ssr_context, v as push$1, w as pop$1 } from "./context.js";
2
+ import { clsx as clsx$1 } from "clsx";
3
+ import { B as BROWSER } from "./false.js";
4
+ import * as devalue from "devalue";
5
+ const DERIVED = 1 << 1;
6
+ const EFFECT = 1 << 2;
7
+ const RENDER_EFFECT = 1 << 3;
8
+ const MANAGED_EFFECT = 1 << 24;
9
+ const BLOCK_EFFECT = 1 << 4;
10
+ const BRANCH_EFFECT = 1 << 5;
11
+ const ROOT_EFFECT = 1 << 6;
12
+ const BOUNDARY_EFFECT = 1 << 7;
13
+ const CONNECTED = 1 << 9;
14
+ const CLEAN = 1 << 10;
15
+ const DIRTY = 1 << 11;
16
+ const MAYBE_DIRTY = 1 << 12;
17
+ const INERT = 1 << 13;
18
+ const DESTROYED = 1 << 14;
19
+ const EFFECT_RAN = 1 << 15;
20
+ const EFFECT_TRANSPARENT = 1 << 16;
21
+ const EAGER_EFFECT = 1 << 17;
22
+ const HEAD_EFFECT = 1 << 18;
23
+ const EFFECT_PRESERVED = 1 << 19;
24
+ const USER_EFFECT = 1 << 20;
25
+ const WAS_MARKED = 1 << 15;
26
+ const REACTION_IS_UPDATING = 1 << 21;
27
+ const ASYNC = 1 << 22;
28
+ const ERROR_VALUE = 1 << 23;
29
+ const STATE_SYMBOL = /* @__PURE__ */ Symbol("$state");
30
+ const LEGACY_PROPS = /* @__PURE__ */ Symbol("legacy props");
31
+ const STALE_REACTION = new class StaleReactionError extends Error {
32
+ name = "StaleReactionError";
33
+ message = "The reaction that called `getAbortSignal()` was re-run or destroyed";
34
+ }();
35
+ const COMMENT_NODE = 8;
36
+ function effect_update_depth_exceeded() {
37
+ {
38
+ throw new Error(`https://svelte.dev/e/effect_update_depth_exceeded`);
39
+ }
40
+ }
41
+ function hydration_failed() {
42
+ {
43
+ throw new Error(`https://svelte.dev/e/hydration_failed`);
44
+ }
45
+ }
46
+ function state_descriptors_fixed() {
47
+ {
48
+ throw new Error(`https://svelte.dev/e/state_descriptors_fixed`);
49
+ }
50
+ }
51
+ function state_prototype_fixed() {
52
+ {
53
+ throw new Error(`https://svelte.dev/e/state_prototype_fixed`);
54
+ }
55
+ }
56
+ function state_unsafe_mutation() {
57
+ {
58
+ throw new Error(`https://svelte.dev/e/state_unsafe_mutation`);
59
+ }
60
+ }
61
+ function svelte_boundary_reset_onerror() {
62
+ {
63
+ throw new Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`);
64
+ }
65
+ }
66
+ const HYDRATION_START = "[";
67
+ const HYDRATION_START_ELSE = "[!";
68
+ const HYDRATION_END = "]";
69
+ const HYDRATION_ERROR = {};
70
+ const ELEMENT_IS_NAMESPACED = 1;
71
+ const ELEMENT_PRESERVE_ATTRIBUTE_CASE = 1 << 1;
72
+ const ELEMENT_IS_INPUT = 1 << 2;
73
+ const UNINITIALIZED = /* @__PURE__ */ Symbol();
74
+ let tracing_mode_flag = false;
75
+ let component_context = null;
76
+ function set_component_context(context) {
77
+ component_context = context;
78
+ }
79
+ function push(props, runes = false, fn) {
80
+ component_context = {
81
+ p: component_context,
82
+ i: false,
83
+ c: null,
84
+ e: null,
85
+ s: props,
86
+ x: null,
87
+ l: null
88
+ };
89
+ }
90
+ function pop(component) {
91
+ var context = (
92
+ /** @type {ComponentContext} */
93
+ component_context
94
+ );
95
+ var effects = context.e;
96
+ if (effects !== null) {
97
+ context.e = null;
98
+ for (var fn of effects) {
99
+ create_user_effect(fn);
100
+ }
101
+ }
102
+ context.i = true;
103
+ component_context = context.p;
104
+ return (
105
+ /** @type {T} */
106
+ {}
107
+ );
108
+ }
109
+ function is_runes() {
110
+ return true;
111
+ }
112
+ let micro_tasks = [];
113
+ function run_micro_tasks() {
114
+ var tasks = micro_tasks;
115
+ micro_tasks = [];
116
+ run_all(tasks);
117
+ }
118
+ function queue_micro_task(fn) {
119
+ if (micro_tasks.length === 0 && !is_flushing_sync) {
120
+ var tasks = micro_tasks;
121
+ queueMicrotask(() => {
122
+ if (tasks === micro_tasks) run_micro_tasks();
123
+ });
124
+ }
125
+ micro_tasks.push(fn);
126
+ }
127
+ function flush_tasks() {
128
+ while (micro_tasks.length > 0) {
129
+ run_micro_tasks();
130
+ }
131
+ }
132
+ function handle_error(error) {
133
+ var effect = active_effect;
134
+ if (effect === null) {
135
+ active_reaction.f |= ERROR_VALUE;
136
+ return error;
137
+ }
138
+ if ((effect.f & EFFECT_RAN) === 0) {
139
+ if ((effect.f & BOUNDARY_EFFECT) === 0) {
140
+ throw error;
141
+ }
142
+ effect.b.error(error);
143
+ } else {
144
+ invoke_error_boundary(error, effect);
145
+ }
146
+ }
147
+ function invoke_error_boundary(error, effect) {
148
+ while (effect !== null) {
149
+ if ((effect.f & BOUNDARY_EFFECT) !== 0) {
150
+ try {
151
+ effect.b.error(error);
152
+ return;
153
+ } catch (e) {
154
+ error = e;
155
+ }
156
+ }
157
+ effect = effect.parent;
158
+ }
159
+ throw error;
160
+ }
161
+ const STATUS_MASK = -7169;
162
+ function set_signal_status(signal, status) {
163
+ signal.f = signal.f & STATUS_MASK | status;
164
+ }
165
+ function update_derived_status(derived) {
166
+ if ((derived.f & CONNECTED) !== 0 || derived.deps === null) {
167
+ set_signal_status(derived, CLEAN);
168
+ } else {
169
+ set_signal_status(derived, MAYBE_DIRTY);
170
+ }
171
+ }
172
+ function clear_marked(deps) {
173
+ if (deps === null) return;
174
+ for (const dep of deps) {
175
+ if ((dep.f & DERIVED) === 0 || (dep.f & WAS_MARKED) === 0) {
176
+ continue;
177
+ }
178
+ dep.f ^= WAS_MARKED;
179
+ clear_marked(
180
+ /** @type {Derived} */
181
+ dep.deps
182
+ );
183
+ }
184
+ }
185
+ function defer_effect(effect, dirty_effects, maybe_dirty_effects) {
186
+ if ((effect.f & DIRTY) !== 0) {
187
+ dirty_effects.add(effect);
188
+ } else if ((effect.f & MAYBE_DIRTY) !== 0) {
189
+ maybe_dirty_effects.add(effect);
190
+ }
191
+ clear_marked(effect.deps);
192
+ set_signal_status(effect, CLEAN);
193
+ }
194
+ const batches = /* @__PURE__ */ new Set();
195
+ let current_batch = null;
196
+ let batch_values = null;
197
+ let queued_root_effects = [];
198
+ let last_scheduled_effect = null;
199
+ let is_flushing = false;
200
+ let is_flushing_sync = false;
201
+ class Batch {
202
+ committed = false;
203
+ /**
204
+ * The current values of any sources that are updated in this batch
205
+ * They keys of this map are identical to `this.#previous`
206
+ * @type {Map<Source, any>}
207
+ */
208
+ current = /* @__PURE__ */ new Map();
209
+ /**
210
+ * The values of any sources that are updated in this batch _before_ those updates took place.
211
+ * They keys of this map are identical to `this.#current`
212
+ * @type {Map<Source, any>}
213
+ */
214
+ previous = /* @__PURE__ */ new Map();
215
+ /**
216
+ * When the batch is committed (and the DOM is updated), we need to remove old branches
217
+ * and append new ones by calling the functions added inside (if/each/key/etc) blocks
218
+ * @type {Set<() => void>}
219
+ */
220
+ #commit_callbacks = /* @__PURE__ */ new Set();
221
+ /**
222
+ * If a fork is discarded, we need to destroy any effects that are no longer needed
223
+ * @type {Set<(batch: Batch) => void>}
224
+ */
225
+ #discard_callbacks = /* @__PURE__ */ new Set();
226
+ /**
227
+ * The number of async effects that are currently in flight
228
+ */
229
+ #pending = 0;
230
+ /**
231
+ * The number of async effects that are currently in flight, _not_ inside a pending boundary
232
+ */
233
+ #blocking_pending = 0;
234
+ /**
235
+ * A deferred that resolves when the batch is committed, used with `settled()`
236
+ * TODO replace with Promise.withResolvers once supported widely enough
237
+ * @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}
238
+ */
239
+ #deferred = null;
240
+ /**
241
+ * Deferred effects (which run after async work has completed) that are DIRTY
242
+ * @type {Set<Effect>}
243
+ */
244
+ #dirty_effects = /* @__PURE__ */ new Set();
245
+ /**
246
+ * Deferred effects that are MAYBE_DIRTY
247
+ * @type {Set<Effect>}
248
+ */
249
+ #maybe_dirty_effects = /* @__PURE__ */ new Set();
250
+ /**
251
+ * A set of branches that still exist, but will be destroyed when this batch
252
+ * is committed — we skip over these during `process`
253
+ * @type {Set<Effect>}
254
+ */
255
+ skipped_effects = /* @__PURE__ */ new Set();
256
+ is_fork = false;
257
+ #decrement_queued = false;
258
+ is_deferred() {
259
+ return this.is_fork || this.#blocking_pending > 0;
260
+ }
261
+ /**
262
+ *
263
+ * @param {Effect[]} root_effects
264
+ */
265
+ process(root_effects) {
266
+ queued_root_effects = [];
267
+ this.apply();
268
+ var effects = [];
269
+ var render_effects = [];
270
+ for (const root of root_effects) {
271
+ this.#traverse_effect_tree(root, effects, render_effects);
272
+ }
273
+ if (this.is_deferred()) {
274
+ this.#defer_effects(render_effects);
275
+ this.#defer_effects(effects);
276
+ } else {
277
+ for (const fn of this.#commit_callbacks) fn();
278
+ this.#commit_callbacks.clear();
279
+ if (this.#pending === 0) {
280
+ this.#commit();
281
+ }
282
+ current_batch = null;
283
+ flush_queued_effects(render_effects);
284
+ flush_queued_effects(effects);
285
+ this.#deferred?.resolve();
286
+ }
287
+ batch_values = null;
288
+ }
289
+ /**
290
+ * Traverse the effect tree, executing effects or stashing
291
+ * them for later execution as appropriate
292
+ * @param {Effect} root
293
+ * @param {Effect[]} effects
294
+ * @param {Effect[]} render_effects
295
+ */
296
+ #traverse_effect_tree(root, effects, render_effects) {
297
+ root.f ^= CLEAN;
298
+ var effect = root.first;
299
+ var pending_boundary = null;
300
+ while (effect !== null) {
301
+ var flags = effect.f;
302
+ var is_branch = (flags & (BRANCH_EFFECT | ROOT_EFFECT)) !== 0;
303
+ var is_skippable_branch = is_branch && (flags & CLEAN) !== 0;
304
+ var skip = is_skippable_branch || (flags & INERT) !== 0 || this.skipped_effects.has(effect);
305
+ if (!skip && effect.fn !== null) {
306
+ if (is_branch) {
307
+ effect.f ^= CLEAN;
308
+ } else if (pending_boundary !== null && (flags & (EFFECT | RENDER_EFFECT | MANAGED_EFFECT)) !== 0) {
309
+ pending_boundary.b.defer_effect(effect);
310
+ } else if ((flags & EFFECT) !== 0) {
311
+ effects.push(effect);
312
+ } else if (is_dirty(effect)) {
313
+ if ((flags & BLOCK_EFFECT) !== 0) this.#maybe_dirty_effects.add(effect);
314
+ update_effect(effect);
315
+ }
316
+ var child = effect.first;
317
+ if (child !== null) {
318
+ effect = child;
319
+ continue;
320
+ }
321
+ }
322
+ var parent = effect.parent;
323
+ effect = effect.next;
324
+ while (effect === null && parent !== null) {
325
+ if (parent === pending_boundary) {
326
+ pending_boundary = null;
327
+ }
328
+ effect = parent.next;
329
+ parent = parent.parent;
330
+ }
331
+ }
332
+ }
333
+ /**
334
+ * @param {Effect[]} effects
335
+ */
336
+ #defer_effects(effects) {
337
+ for (var i = 0; i < effects.length; i += 1) {
338
+ defer_effect(effects[i], this.#dirty_effects, this.#maybe_dirty_effects);
339
+ }
340
+ }
341
+ /**
342
+ * Associate a change to a given source with the current
343
+ * batch, noting its previous and current values
344
+ * @param {Source} source
345
+ * @param {any} value
346
+ */
347
+ capture(source2, value) {
348
+ if (value !== UNINITIALIZED && !this.previous.has(source2)) {
349
+ this.previous.set(source2, value);
350
+ }
351
+ if ((source2.f & ERROR_VALUE) === 0) {
352
+ this.current.set(source2, source2.v);
353
+ batch_values?.set(source2, source2.v);
354
+ }
355
+ }
356
+ activate() {
357
+ current_batch = this;
358
+ this.apply();
359
+ }
360
+ deactivate() {
361
+ if (current_batch !== this) return;
362
+ current_batch = null;
363
+ batch_values = null;
364
+ }
365
+ flush() {
366
+ this.activate();
367
+ if (queued_root_effects.length > 0) {
368
+ flush_effects();
369
+ if (current_batch !== null && current_batch !== this) {
370
+ return;
371
+ }
372
+ } else if (this.#pending === 0) {
373
+ this.process([]);
374
+ }
375
+ this.deactivate();
376
+ }
377
+ discard() {
378
+ for (const fn of this.#discard_callbacks) fn(this);
379
+ this.#discard_callbacks.clear();
380
+ }
381
+ #commit() {
382
+ if (batches.size > 1) {
383
+ this.previous.clear();
384
+ var previous_batch_values = batch_values;
385
+ var is_earlier = true;
386
+ for (const batch of batches) {
387
+ if (batch === this) {
388
+ is_earlier = false;
389
+ continue;
390
+ }
391
+ const sources = [];
392
+ for (const [source2, value] of this.current) {
393
+ if (batch.current.has(source2)) {
394
+ if (is_earlier && value !== batch.current.get(source2)) {
395
+ batch.current.set(source2, value);
396
+ } else {
397
+ continue;
398
+ }
399
+ }
400
+ sources.push(source2);
401
+ }
402
+ if (sources.length === 0) {
403
+ continue;
404
+ }
405
+ const others = [...batch.current.keys()].filter((s) => !this.current.has(s));
406
+ if (others.length > 0) {
407
+ var prev_queued_root_effects = queued_root_effects;
408
+ queued_root_effects = [];
409
+ const marked = /* @__PURE__ */ new Set();
410
+ const checked = /* @__PURE__ */ new Map();
411
+ for (const source2 of sources) {
412
+ mark_effects(source2, others, marked, checked);
413
+ }
414
+ if (queued_root_effects.length > 0) {
415
+ current_batch = batch;
416
+ batch.apply();
417
+ for (const root of queued_root_effects) {
418
+ batch.#traverse_effect_tree(root, [], []);
419
+ }
420
+ batch.deactivate();
421
+ }
422
+ queued_root_effects = prev_queued_root_effects;
423
+ }
424
+ }
425
+ current_batch = null;
426
+ batch_values = previous_batch_values;
427
+ }
428
+ this.committed = true;
429
+ batches.delete(this);
430
+ }
431
+ /**
432
+ *
433
+ * @param {boolean} blocking
434
+ */
435
+ increment(blocking) {
436
+ this.#pending += 1;
437
+ if (blocking) this.#blocking_pending += 1;
438
+ }
439
+ /**
440
+ *
441
+ * @param {boolean} blocking
442
+ */
443
+ decrement(blocking) {
444
+ this.#pending -= 1;
445
+ if (blocking) this.#blocking_pending -= 1;
446
+ if (this.#decrement_queued) return;
447
+ this.#decrement_queued = true;
448
+ queue_micro_task(() => {
449
+ this.#decrement_queued = false;
450
+ if (!this.is_deferred()) {
451
+ this.revive();
452
+ } else if (queued_root_effects.length > 0) {
453
+ this.flush();
454
+ }
455
+ });
456
+ }
457
+ revive() {
458
+ for (const e of this.#dirty_effects) {
459
+ this.#maybe_dirty_effects.delete(e);
460
+ set_signal_status(e, DIRTY);
461
+ schedule_effect(e);
462
+ }
463
+ for (const e of this.#maybe_dirty_effects) {
464
+ set_signal_status(e, MAYBE_DIRTY);
465
+ schedule_effect(e);
466
+ }
467
+ this.flush();
468
+ }
469
+ /** @param {() => void} fn */
470
+ oncommit(fn) {
471
+ this.#commit_callbacks.add(fn);
472
+ }
473
+ /** @param {(batch: Batch) => void} fn */
474
+ ondiscard(fn) {
475
+ this.#discard_callbacks.add(fn);
476
+ }
477
+ settled() {
478
+ return (this.#deferred ??= deferred()).promise;
479
+ }
480
+ static ensure() {
481
+ if (current_batch === null) {
482
+ const batch = current_batch = new Batch();
483
+ batches.add(current_batch);
484
+ if (!is_flushing_sync) {
485
+ queue_micro_task(() => {
486
+ if (current_batch !== batch) {
487
+ return;
488
+ }
489
+ batch.flush();
490
+ });
491
+ }
492
+ }
493
+ return current_batch;
494
+ }
495
+ apply() {
496
+ return;
497
+ }
498
+ }
499
+ function flushSync(fn) {
500
+ var was_flushing_sync = is_flushing_sync;
501
+ is_flushing_sync = true;
502
+ try {
503
+ var result;
504
+ if (fn) ;
505
+ while (true) {
506
+ flush_tasks();
507
+ if (queued_root_effects.length === 0) {
508
+ current_batch?.flush();
509
+ if (queued_root_effects.length === 0) {
510
+ last_scheduled_effect = null;
511
+ return (
512
+ /** @type {T} */
513
+ result
514
+ );
515
+ }
516
+ }
517
+ flush_effects();
518
+ }
519
+ } finally {
520
+ is_flushing_sync = was_flushing_sync;
521
+ }
522
+ }
523
+ function flush_effects() {
524
+ is_flushing = true;
525
+ var source_stacks = null;
526
+ try {
527
+ var flush_count = 0;
528
+ while (queued_root_effects.length > 0) {
529
+ var batch = Batch.ensure();
530
+ if (flush_count++ > 1e3) {
531
+ var updates, entry;
532
+ if (BROWSER) ;
533
+ infinite_loop_guard();
534
+ }
535
+ batch.process(queued_root_effects);
536
+ old_values.clear();
537
+ if (BROWSER) ;
538
+ }
539
+ } finally {
540
+ is_flushing = false;
541
+ last_scheduled_effect = null;
542
+ }
543
+ }
544
+ function infinite_loop_guard() {
545
+ try {
546
+ effect_update_depth_exceeded();
547
+ } catch (error) {
548
+ invoke_error_boundary(error, last_scheduled_effect);
549
+ }
550
+ }
551
+ let eager_block_effects = null;
552
+ function flush_queued_effects(effects) {
553
+ var length = effects.length;
554
+ if (length === 0) return;
555
+ var i = 0;
556
+ while (i < length) {
557
+ var effect = effects[i++];
558
+ if ((effect.f & (DESTROYED | INERT)) === 0 && is_dirty(effect)) {
559
+ eager_block_effects = /* @__PURE__ */ new Set();
560
+ update_effect(effect);
561
+ if (effect.deps === null && effect.first === null && effect.nodes === null) {
562
+ if (effect.teardown === null && effect.ac === null) {
563
+ unlink_effect(effect);
564
+ } else {
565
+ effect.fn = null;
566
+ }
567
+ }
568
+ if (eager_block_effects?.size > 0) {
569
+ old_values.clear();
570
+ for (const e of eager_block_effects) {
571
+ if ((e.f & (DESTROYED | INERT)) !== 0) continue;
572
+ const ordered_effects = [e];
573
+ let ancestor = e.parent;
574
+ while (ancestor !== null) {
575
+ if (eager_block_effects.has(ancestor)) {
576
+ eager_block_effects.delete(ancestor);
577
+ ordered_effects.push(ancestor);
578
+ }
579
+ ancestor = ancestor.parent;
580
+ }
581
+ for (let j = ordered_effects.length - 1; j >= 0; j--) {
582
+ const e2 = ordered_effects[j];
583
+ if ((e2.f & (DESTROYED | INERT)) !== 0) continue;
584
+ update_effect(e2);
585
+ }
586
+ }
587
+ eager_block_effects.clear();
588
+ }
589
+ }
590
+ }
591
+ eager_block_effects = null;
592
+ }
593
+ function mark_effects(value, sources, marked, checked) {
594
+ if (marked.has(value)) return;
595
+ marked.add(value);
596
+ if (value.reactions !== null) {
597
+ for (const reaction of value.reactions) {
598
+ const flags = reaction.f;
599
+ if ((flags & DERIVED) !== 0) {
600
+ mark_effects(
601
+ /** @type {Derived} */
602
+ reaction,
603
+ sources,
604
+ marked,
605
+ checked
606
+ );
607
+ } else if ((flags & (ASYNC | BLOCK_EFFECT)) !== 0 && (flags & DIRTY) === 0 && depends_on(reaction, sources, checked)) {
608
+ set_signal_status(reaction, DIRTY);
609
+ schedule_effect(
610
+ /** @type {Effect} */
611
+ reaction
612
+ );
613
+ }
614
+ }
615
+ }
616
+ }
617
+ function depends_on(reaction, sources, checked) {
618
+ const depends = checked.get(reaction);
619
+ if (depends !== void 0) return depends;
620
+ if (reaction.deps !== null) {
621
+ for (const dep of reaction.deps) {
622
+ if (includes.call(sources, dep)) {
623
+ return true;
624
+ }
625
+ if ((dep.f & DERIVED) !== 0 && depends_on(
626
+ /** @type {Derived} */
627
+ dep,
628
+ sources,
629
+ checked
630
+ )) {
631
+ checked.set(
632
+ /** @type {Derived} */
633
+ dep,
634
+ true
635
+ );
636
+ return true;
637
+ }
638
+ }
639
+ }
640
+ checked.set(reaction, false);
641
+ return false;
642
+ }
643
+ function schedule_effect(signal) {
644
+ var effect = last_scheduled_effect = signal;
645
+ while (effect.parent !== null) {
646
+ effect = effect.parent;
647
+ var flags = effect.f;
648
+ if (is_flushing && effect === active_effect && (flags & BLOCK_EFFECT) !== 0 && (flags & HEAD_EFFECT) === 0) {
649
+ return;
650
+ }
651
+ if ((flags & (ROOT_EFFECT | BRANCH_EFFECT)) !== 0) {
652
+ if ((flags & CLEAN) === 0) return;
653
+ effect.f ^= CLEAN;
654
+ }
655
+ }
656
+ queued_root_effects.push(effect);
657
+ }
658
+ function destroy_derived_effects(derived) {
659
+ var effects = derived.effects;
660
+ if (effects !== null) {
661
+ derived.effects = null;
662
+ for (var i = 0; i < effects.length; i += 1) {
663
+ destroy_effect(
664
+ /** @type {Effect} */
665
+ effects[i]
666
+ );
667
+ }
668
+ }
669
+ }
670
+ function get_derived_parent_effect(derived) {
671
+ var parent = derived.parent;
672
+ while (parent !== null) {
673
+ if ((parent.f & DERIVED) === 0) {
674
+ return (parent.f & DESTROYED) === 0 ? (
675
+ /** @type {Effect} */
676
+ parent
677
+ ) : null;
678
+ }
679
+ parent = parent.parent;
680
+ }
681
+ return null;
682
+ }
683
+ function execute_derived(derived) {
684
+ var value;
685
+ var prev_active_effect = active_effect;
686
+ set_active_effect(get_derived_parent_effect(derived));
687
+ {
688
+ try {
689
+ derived.f &= ~WAS_MARKED;
690
+ destroy_derived_effects(derived);
691
+ value = update_reaction(derived);
692
+ } finally {
693
+ set_active_effect(prev_active_effect);
694
+ }
695
+ }
696
+ return value;
697
+ }
698
+ function update_derived(derived) {
699
+ var value = execute_derived(derived);
700
+ if (!derived.equals(value)) {
701
+ derived.wv = increment_write_version();
702
+ if (!current_batch?.is_fork || derived.deps === null) {
703
+ derived.v = value;
704
+ if (derived.deps === null) {
705
+ set_signal_status(derived, CLEAN);
706
+ return;
707
+ }
708
+ }
709
+ }
710
+ if (is_destroying_effect) {
711
+ return;
712
+ }
713
+ if (batch_values !== null) {
714
+ if (effect_tracking() || current_batch?.is_fork) {
715
+ batch_values.set(derived, value);
716
+ }
717
+ } else {
718
+ update_derived_status(derived);
719
+ }
720
+ }
721
+ let eager_effects = /* @__PURE__ */ new Set();
722
+ const old_values = /* @__PURE__ */ new Map();
723
+ let eager_effects_deferred = false;
724
+ function source(v, stack) {
725
+ var signal = {
726
+ f: 0,
727
+ // TODO ideally we could skip this altogether, but it causes type errors
728
+ v,
729
+ reactions: null,
730
+ equals,
731
+ rv: 0,
732
+ wv: 0
733
+ };
734
+ return signal;
735
+ }
736
+ // @__NO_SIDE_EFFECTS__
737
+ function state(v, stack) {
738
+ const s = source(v);
739
+ push_reaction_value(s);
740
+ return s;
741
+ }
742
+ // @__NO_SIDE_EFFECTS__
743
+ function mutable_source(initial_value, immutable = false, trackable = true) {
744
+ const s = source(initial_value);
745
+ if (!immutable) {
746
+ s.equals = safe_equals;
747
+ }
748
+ return s;
749
+ }
750
+ function set(source2, value, should_proxy = false) {
751
+ if (active_reaction !== null && // since we are untracking the function inside `$inspect.with` we need to add this check
752
+ // to ensure we error if state is set inside an inspect effect
753
+ (!untracking || (active_reaction.f & EAGER_EFFECT) !== 0) && is_runes() && (active_reaction.f & (DERIVED | BLOCK_EFFECT | ASYNC | EAGER_EFFECT)) !== 0 && (current_sources === null || !includes.call(current_sources, source2))) {
754
+ state_unsafe_mutation();
755
+ }
756
+ let new_value = should_proxy ? proxy(value) : value;
757
+ return internal_set(source2, new_value);
758
+ }
759
+ function internal_set(source2, value) {
760
+ if (!source2.equals(value)) {
761
+ var old_value = source2.v;
762
+ if (is_destroying_effect) {
763
+ old_values.set(source2, value);
764
+ } else {
765
+ old_values.set(source2, old_value);
766
+ }
767
+ source2.v = value;
768
+ var batch = Batch.ensure();
769
+ batch.capture(source2, old_value);
770
+ if ((source2.f & DERIVED) !== 0) {
771
+ const derived = (
772
+ /** @type {Derived} */
773
+ source2
774
+ );
775
+ if ((source2.f & DIRTY) !== 0) {
776
+ execute_derived(derived);
777
+ }
778
+ update_derived_status(derived);
779
+ }
780
+ source2.wv = increment_write_version();
781
+ mark_reactions(source2, DIRTY);
782
+ if (active_effect !== null && (active_effect.f & CLEAN) !== 0 && (active_effect.f & (BRANCH_EFFECT | ROOT_EFFECT)) === 0) {
783
+ if (untracked_writes === null) {
784
+ set_untracked_writes([source2]);
785
+ } else {
786
+ untracked_writes.push(source2);
787
+ }
788
+ }
789
+ if (!batch.is_fork && eager_effects.size > 0 && !eager_effects_deferred) {
790
+ flush_eager_effects();
791
+ }
792
+ }
793
+ return value;
794
+ }
795
+ function flush_eager_effects() {
796
+ eager_effects_deferred = false;
797
+ for (const effect of eager_effects) {
798
+ if ((effect.f & CLEAN) !== 0) {
799
+ set_signal_status(effect, MAYBE_DIRTY);
800
+ }
801
+ if (is_dirty(effect)) {
802
+ update_effect(effect);
803
+ }
804
+ }
805
+ eager_effects.clear();
806
+ }
807
+ function increment(source2) {
808
+ set(source2, source2.v + 1);
809
+ }
810
+ function mark_reactions(signal, status) {
811
+ var reactions = signal.reactions;
812
+ if (reactions === null) return;
813
+ var length = reactions.length;
814
+ for (var i = 0; i < length; i++) {
815
+ var reaction = reactions[i];
816
+ var flags = reaction.f;
817
+ var not_dirty = (flags & DIRTY) === 0;
818
+ if (not_dirty) {
819
+ set_signal_status(reaction, status);
820
+ }
821
+ if ((flags & DERIVED) !== 0) {
822
+ var derived = (
823
+ /** @type {Derived} */
824
+ reaction
825
+ );
826
+ batch_values?.delete(derived);
827
+ if ((flags & WAS_MARKED) === 0) {
828
+ if (flags & CONNECTED) {
829
+ reaction.f |= WAS_MARKED;
830
+ }
831
+ mark_reactions(derived, MAYBE_DIRTY);
832
+ }
833
+ } else if (not_dirty) {
834
+ if ((flags & BLOCK_EFFECT) !== 0 && eager_block_effects !== null) {
835
+ eager_block_effects.add(
836
+ /** @type {Effect} */
837
+ reaction
838
+ );
839
+ }
840
+ schedule_effect(
841
+ /** @type {Effect} */
842
+ reaction
843
+ );
844
+ }
845
+ }
846
+ }
847
+ function proxy(value) {
848
+ if (typeof value !== "object" || value === null || STATE_SYMBOL in value) {
849
+ return value;
850
+ }
851
+ const prototype = get_prototype_of(value);
852
+ if (prototype !== object_prototype && prototype !== array_prototype) {
853
+ return value;
854
+ }
855
+ var sources = /* @__PURE__ */ new Map();
856
+ var is_proxied_array = is_array(value);
857
+ var version = /* @__PURE__ */ state(0);
858
+ var parent_version = update_version;
859
+ var with_parent = (fn) => {
860
+ if (update_version === parent_version) {
861
+ return fn();
862
+ }
863
+ var reaction = active_reaction;
864
+ var version2 = update_version;
865
+ set_active_reaction(null);
866
+ set_update_version(parent_version);
867
+ var result = fn();
868
+ set_active_reaction(reaction);
869
+ set_update_version(version2);
870
+ return result;
871
+ };
872
+ if (is_proxied_array) {
873
+ sources.set("length", /* @__PURE__ */ state(
874
+ /** @type {any[]} */
875
+ value.length
876
+ ));
877
+ }
878
+ return new Proxy(
879
+ /** @type {any} */
880
+ value,
881
+ {
882
+ defineProperty(_, prop, descriptor) {
883
+ if (!("value" in descriptor) || descriptor.configurable === false || descriptor.enumerable === false || descriptor.writable === false) {
884
+ state_descriptors_fixed();
885
+ }
886
+ var s = sources.get(prop);
887
+ if (s === void 0) {
888
+ s = with_parent(() => {
889
+ var s2 = /* @__PURE__ */ state(descriptor.value);
890
+ sources.set(prop, s2);
891
+ return s2;
892
+ });
893
+ } else {
894
+ set(s, descriptor.value, true);
895
+ }
896
+ return true;
897
+ },
898
+ deleteProperty(target, prop) {
899
+ var s = sources.get(prop);
900
+ if (s === void 0) {
901
+ if (prop in target) {
902
+ const s2 = with_parent(() => /* @__PURE__ */ state(UNINITIALIZED));
903
+ sources.set(prop, s2);
904
+ increment(version);
905
+ }
906
+ } else {
907
+ set(s, UNINITIALIZED);
908
+ increment(version);
909
+ }
910
+ return true;
911
+ },
912
+ get(target, prop, receiver) {
913
+ if (prop === STATE_SYMBOL) {
914
+ return value;
915
+ }
916
+ var s = sources.get(prop);
917
+ var exists = prop in target;
918
+ if (s === void 0 && (!exists || get_descriptor(target, prop)?.writable)) {
919
+ s = with_parent(() => {
920
+ var p = proxy(exists ? target[prop] : UNINITIALIZED);
921
+ var s2 = /* @__PURE__ */ state(p);
922
+ return s2;
923
+ });
924
+ sources.set(prop, s);
925
+ }
926
+ if (s !== void 0) {
927
+ var v = get(s);
928
+ return v === UNINITIALIZED ? void 0 : v;
929
+ }
930
+ return Reflect.get(target, prop, receiver);
931
+ },
932
+ getOwnPropertyDescriptor(target, prop) {
933
+ var descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
934
+ if (descriptor && "value" in descriptor) {
935
+ var s = sources.get(prop);
936
+ if (s) descriptor.value = get(s);
937
+ } else if (descriptor === void 0) {
938
+ var source2 = sources.get(prop);
939
+ var value2 = source2?.v;
940
+ if (source2 !== void 0 && value2 !== UNINITIALIZED) {
941
+ return {
942
+ enumerable: true,
943
+ configurable: true,
944
+ value: value2,
945
+ writable: true
946
+ };
947
+ }
948
+ }
949
+ return descriptor;
950
+ },
951
+ has(target, prop) {
952
+ if (prop === STATE_SYMBOL) {
953
+ return true;
954
+ }
955
+ var s = sources.get(prop);
956
+ var has = s !== void 0 && s.v !== UNINITIALIZED || Reflect.has(target, prop);
957
+ if (s !== void 0 || active_effect !== null && (!has || get_descriptor(target, prop)?.writable)) {
958
+ if (s === void 0) {
959
+ s = with_parent(() => {
960
+ var p = has ? proxy(target[prop]) : UNINITIALIZED;
961
+ var s2 = /* @__PURE__ */ state(p);
962
+ return s2;
963
+ });
964
+ sources.set(prop, s);
965
+ }
966
+ var value2 = get(s);
967
+ if (value2 === UNINITIALIZED) {
968
+ return false;
969
+ }
970
+ }
971
+ return has;
972
+ },
973
+ set(target, prop, value2, receiver) {
974
+ var s = sources.get(prop);
975
+ var has = prop in target;
976
+ if (is_proxied_array && prop === "length") {
977
+ for (var i = value2; i < /** @type {Source<number>} */
978
+ s.v; i += 1) {
979
+ var other_s = sources.get(i + "");
980
+ if (other_s !== void 0) {
981
+ set(other_s, UNINITIALIZED);
982
+ } else if (i in target) {
983
+ other_s = with_parent(() => /* @__PURE__ */ state(UNINITIALIZED));
984
+ sources.set(i + "", other_s);
985
+ }
986
+ }
987
+ }
988
+ if (s === void 0) {
989
+ if (!has || get_descriptor(target, prop)?.writable) {
990
+ s = with_parent(() => /* @__PURE__ */ state(void 0));
991
+ set(s, proxy(value2));
992
+ sources.set(prop, s);
993
+ }
994
+ } else {
995
+ has = s.v !== UNINITIALIZED;
996
+ var p = with_parent(() => proxy(value2));
997
+ set(s, p);
998
+ }
999
+ var descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
1000
+ if (descriptor?.set) {
1001
+ descriptor.set.call(receiver, value2);
1002
+ }
1003
+ if (!has) {
1004
+ if (is_proxied_array && typeof prop === "string") {
1005
+ var ls = (
1006
+ /** @type {Source<number>} */
1007
+ sources.get("length")
1008
+ );
1009
+ var n = Number(prop);
1010
+ if (Number.isInteger(n) && n >= ls.v) {
1011
+ set(ls, n + 1);
1012
+ }
1013
+ }
1014
+ increment(version);
1015
+ }
1016
+ return true;
1017
+ },
1018
+ ownKeys(target) {
1019
+ get(version);
1020
+ var own_keys = Reflect.ownKeys(target).filter((key2) => {
1021
+ var source3 = sources.get(key2);
1022
+ return source3 === void 0 || source3.v !== UNINITIALIZED;
1023
+ });
1024
+ for (var [key, source2] of sources) {
1025
+ if (source2.v !== UNINITIALIZED && !(key in target)) {
1026
+ own_keys.push(key);
1027
+ }
1028
+ }
1029
+ return own_keys;
1030
+ },
1031
+ setPrototypeOf() {
1032
+ state_prototype_fixed();
1033
+ }
1034
+ }
1035
+ );
1036
+ }
1037
+ var $window;
1038
+ var first_child_getter;
1039
+ var next_sibling_getter;
1040
+ function init_operations() {
1041
+ if ($window !== void 0) {
1042
+ return;
1043
+ }
1044
+ $window = window;
1045
+ var element_prototype = Element.prototype;
1046
+ var node_prototype = Node.prototype;
1047
+ var text_prototype = Text.prototype;
1048
+ first_child_getter = get_descriptor(node_prototype, "firstChild").get;
1049
+ next_sibling_getter = get_descriptor(node_prototype, "nextSibling").get;
1050
+ if (is_extensible(element_prototype)) {
1051
+ element_prototype.__click = void 0;
1052
+ element_prototype.__className = void 0;
1053
+ element_prototype.__attributes = null;
1054
+ element_prototype.__style = void 0;
1055
+ element_prototype.__e = void 0;
1056
+ }
1057
+ if (is_extensible(text_prototype)) {
1058
+ text_prototype.__t = void 0;
1059
+ }
1060
+ }
1061
+ function create_text(value = "") {
1062
+ return document.createTextNode(value);
1063
+ }
1064
+ // @__NO_SIDE_EFFECTS__
1065
+ function get_first_child(node) {
1066
+ return (
1067
+ /** @type {TemplateNode | null} */
1068
+ first_child_getter.call(node)
1069
+ );
1070
+ }
1071
+ // @__NO_SIDE_EFFECTS__
1072
+ function get_next_sibling(node) {
1073
+ return (
1074
+ /** @type {TemplateNode | null} */
1075
+ next_sibling_getter.call(node)
1076
+ );
1077
+ }
1078
+ function clear_text_content(node) {
1079
+ node.textContent = "";
1080
+ }
1081
+ function without_reactive_context(fn) {
1082
+ var previous_reaction = active_reaction;
1083
+ var previous_effect = active_effect;
1084
+ set_active_reaction(null);
1085
+ set_active_effect(null);
1086
+ try {
1087
+ return fn();
1088
+ } finally {
1089
+ set_active_reaction(previous_reaction);
1090
+ set_active_effect(previous_effect);
1091
+ }
1092
+ }
1093
+ function push_effect(effect, parent_effect) {
1094
+ var parent_last = parent_effect.last;
1095
+ if (parent_last === null) {
1096
+ parent_effect.last = parent_effect.first = effect;
1097
+ } else {
1098
+ parent_last.next = effect;
1099
+ effect.prev = parent_last;
1100
+ parent_effect.last = effect;
1101
+ }
1102
+ }
1103
+ function create_effect(type, fn, sync) {
1104
+ var parent = active_effect;
1105
+ if (parent !== null && (parent.f & INERT) !== 0) {
1106
+ type |= INERT;
1107
+ }
1108
+ var effect = {
1109
+ ctx: component_context,
1110
+ deps: null,
1111
+ nodes: null,
1112
+ f: type | DIRTY | CONNECTED,
1113
+ first: null,
1114
+ fn,
1115
+ last: null,
1116
+ next: null,
1117
+ parent,
1118
+ b: parent && parent.b,
1119
+ prev: null,
1120
+ teardown: null,
1121
+ wv: 0,
1122
+ ac: null
1123
+ };
1124
+ if (sync) {
1125
+ try {
1126
+ update_effect(effect);
1127
+ effect.f |= EFFECT_RAN;
1128
+ } catch (e2) {
1129
+ destroy_effect(effect);
1130
+ throw e2;
1131
+ }
1132
+ } else if (fn !== null) {
1133
+ schedule_effect(effect);
1134
+ }
1135
+ var e = effect;
1136
+ if (sync && e.deps === null && e.teardown === null && e.nodes === null && e.first === e.last && // either `null`, or a singular child
1137
+ (e.f & EFFECT_PRESERVED) === 0) {
1138
+ e = e.first;
1139
+ if ((type & BLOCK_EFFECT) !== 0 && (type & EFFECT_TRANSPARENT) !== 0 && e !== null) {
1140
+ e.f |= EFFECT_TRANSPARENT;
1141
+ }
1142
+ }
1143
+ if (e !== null) {
1144
+ e.parent = parent;
1145
+ if (parent !== null) {
1146
+ push_effect(e, parent);
1147
+ }
1148
+ if (active_reaction !== null && (active_reaction.f & DERIVED) !== 0 && (type & ROOT_EFFECT) === 0) {
1149
+ var derived = (
1150
+ /** @type {Derived} */
1151
+ active_reaction
1152
+ );
1153
+ (derived.effects ??= []).push(e);
1154
+ }
1155
+ }
1156
+ return effect;
1157
+ }
1158
+ function effect_tracking() {
1159
+ return active_reaction !== null && !untracking;
1160
+ }
1161
+ function create_user_effect(fn) {
1162
+ return create_effect(EFFECT | USER_EFFECT, fn, false);
1163
+ }
1164
+ function component_root(fn) {
1165
+ Batch.ensure();
1166
+ const effect = create_effect(ROOT_EFFECT | EFFECT_PRESERVED, fn, true);
1167
+ return (options = {}) => {
1168
+ return new Promise((fulfil) => {
1169
+ if (options.outro) {
1170
+ pause_effect(effect, () => {
1171
+ destroy_effect(effect);
1172
+ fulfil(void 0);
1173
+ });
1174
+ } else {
1175
+ destroy_effect(effect);
1176
+ fulfil(void 0);
1177
+ }
1178
+ });
1179
+ };
1180
+ }
1181
+ function render_effect(fn, flags = 0) {
1182
+ return create_effect(RENDER_EFFECT | flags, fn, true);
1183
+ }
1184
+ function block(fn, flags = 0) {
1185
+ var effect = create_effect(BLOCK_EFFECT | flags, fn, true);
1186
+ return effect;
1187
+ }
1188
+ function branch(fn) {
1189
+ return create_effect(BRANCH_EFFECT | EFFECT_PRESERVED, fn, true);
1190
+ }
1191
+ function execute_effect_teardown(effect) {
1192
+ var teardown = effect.teardown;
1193
+ if (teardown !== null) {
1194
+ const previously_destroying_effect = is_destroying_effect;
1195
+ const previous_reaction = active_reaction;
1196
+ set_is_destroying_effect(true);
1197
+ set_active_reaction(null);
1198
+ try {
1199
+ teardown.call(null);
1200
+ } finally {
1201
+ set_is_destroying_effect(previously_destroying_effect);
1202
+ set_active_reaction(previous_reaction);
1203
+ }
1204
+ }
1205
+ }
1206
+ function destroy_effect_children(signal, remove_dom = false) {
1207
+ var effect = signal.first;
1208
+ signal.first = signal.last = null;
1209
+ while (effect !== null) {
1210
+ const controller2 = effect.ac;
1211
+ if (controller2 !== null) {
1212
+ without_reactive_context(() => {
1213
+ controller2.abort(STALE_REACTION);
1214
+ });
1215
+ }
1216
+ var next = effect.next;
1217
+ if ((effect.f & ROOT_EFFECT) !== 0) {
1218
+ effect.parent = null;
1219
+ } else {
1220
+ destroy_effect(effect, remove_dom);
1221
+ }
1222
+ effect = next;
1223
+ }
1224
+ }
1225
+ function destroy_block_effect_children(signal) {
1226
+ var effect = signal.first;
1227
+ while (effect !== null) {
1228
+ var next = effect.next;
1229
+ if ((effect.f & BRANCH_EFFECT) === 0) {
1230
+ destroy_effect(effect);
1231
+ }
1232
+ effect = next;
1233
+ }
1234
+ }
1235
+ function destroy_effect(effect, remove_dom = true) {
1236
+ var removed = false;
1237
+ if ((remove_dom || (effect.f & HEAD_EFFECT) !== 0) && effect.nodes !== null && effect.nodes.end !== null) {
1238
+ remove_effect_dom(
1239
+ effect.nodes.start,
1240
+ /** @type {TemplateNode} */
1241
+ effect.nodes.end
1242
+ );
1243
+ removed = true;
1244
+ }
1245
+ destroy_effect_children(effect, remove_dom && !removed);
1246
+ remove_reactions(effect, 0);
1247
+ set_signal_status(effect, DESTROYED);
1248
+ var transitions = effect.nodes && effect.nodes.t;
1249
+ if (transitions !== null) {
1250
+ for (const transition of transitions) {
1251
+ transition.stop();
1252
+ }
1253
+ }
1254
+ execute_effect_teardown(effect);
1255
+ var parent = effect.parent;
1256
+ if (parent !== null && parent.first !== null) {
1257
+ unlink_effect(effect);
1258
+ }
1259
+ effect.next = effect.prev = effect.teardown = effect.ctx = effect.deps = effect.fn = effect.nodes = effect.ac = null;
1260
+ }
1261
+ function remove_effect_dom(node, end) {
1262
+ while (node !== null) {
1263
+ var next = node === end ? null : /* @__PURE__ */ get_next_sibling(node);
1264
+ node.remove();
1265
+ node = next;
1266
+ }
1267
+ }
1268
+ function unlink_effect(effect) {
1269
+ var parent = effect.parent;
1270
+ var prev = effect.prev;
1271
+ var next = effect.next;
1272
+ if (prev !== null) prev.next = next;
1273
+ if (next !== null) next.prev = prev;
1274
+ if (parent !== null) {
1275
+ if (parent.first === effect) parent.first = next;
1276
+ if (parent.last === effect) parent.last = prev;
1277
+ }
1278
+ }
1279
+ function pause_effect(effect, callback, destroy = true) {
1280
+ var transitions = [];
1281
+ pause_children(effect, transitions, true);
1282
+ var fn = () => {
1283
+ if (destroy) destroy_effect(effect);
1284
+ if (callback) callback();
1285
+ };
1286
+ var remaining = transitions.length;
1287
+ if (remaining > 0) {
1288
+ var check = () => --remaining || fn();
1289
+ for (var transition of transitions) {
1290
+ transition.out(check);
1291
+ }
1292
+ } else {
1293
+ fn();
1294
+ }
1295
+ }
1296
+ function pause_children(effect, transitions, local) {
1297
+ if ((effect.f & INERT) !== 0) return;
1298
+ effect.f ^= INERT;
1299
+ var t = effect.nodes && effect.nodes.t;
1300
+ if (t !== null) {
1301
+ for (const transition of t) {
1302
+ if (transition.is_global || local) {
1303
+ transitions.push(transition);
1304
+ }
1305
+ }
1306
+ }
1307
+ var child = effect.first;
1308
+ while (child !== null) {
1309
+ var sibling = child.next;
1310
+ var transparent = (child.f & EFFECT_TRANSPARENT) !== 0 || // If this is a branch effect without a block effect parent,
1311
+ // it means the parent block effect was pruned. In that case,
1312
+ // transparency information was transferred to the branch effect.
1313
+ (child.f & BRANCH_EFFECT) !== 0 && (effect.f & BLOCK_EFFECT) !== 0;
1314
+ pause_children(child, transitions, transparent ? local : false);
1315
+ child = sibling;
1316
+ }
1317
+ }
1318
+ function move_effect(effect, fragment) {
1319
+ if (!effect.nodes) return;
1320
+ var node = effect.nodes.start;
1321
+ var end = effect.nodes.end;
1322
+ while (node !== null) {
1323
+ var next = node === end ? null : /* @__PURE__ */ get_next_sibling(node);
1324
+ fragment.append(node);
1325
+ node = next;
1326
+ }
1327
+ }
1328
+ let is_updating_effect = false;
1329
+ let is_destroying_effect = false;
1330
+ function set_is_destroying_effect(value) {
1331
+ is_destroying_effect = value;
1332
+ }
1333
+ let active_reaction = null;
1334
+ let untracking = false;
1335
+ function set_active_reaction(reaction) {
1336
+ active_reaction = reaction;
1337
+ }
1338
+ let active_effect = null;
1339
+ function set_active_effect(effect) {
1340
+ active_effect = effect;
1341
+ }
1342
+ let current_sources = null;
1343
+ function push_reaction_value(value) {
1344
+ if (active_reaction !== null && true) {
1345
+ if (current_sources === null) {
1346
+ current_sources = [value];
1347
+ } else {
1348
+ current_sources.push(value);
1349
+ }
1350
+ }
1351
+ }
1352
+ let new_deps = null;
1353
+ let skipped_deps = 0;
1354
+ let untracked_writes = null;
1355
+ function set_untracked_writes(value) {
1356
+ untracked_writes = value;
1357
+ }
1358
+ let write_version = 1;
1359
+ let read_version = 0;
1360
+ let update_version = read_version;
1361
+ function set_update_version(value) {
1362
+ update_version = value;
1363
+ }
1364
+ function increment_write_version() {
1365
+ return ++write_version;
1366
+ }
1367
+ function is_dirty(reaction) {
1368
+ var flags = reaction.f;
1369
+ if ((flags & DIRTY) !== 0) {
1370
+ return true;
1371
+ }
1372
+ if (flags & DERIVED) {
1373
+ reaction.f &= ~WAS_MARKED;
1374
+ }
1375
+ if ((flags & MAYBE_DIRTY) !== 0) {
1376
+ var dependencies = (
1377
+ /** @type {Value[]} */
1378
+ reaction.deps
1379
+ );
1380
+ var length = dependencies.length;
1381
+ for (var i = 0; i < length; i++) {
1382
+ var dependency = dependencies[i];
1383
+ if (is_dirty(
1384
+ /** @type {Derived} */
1385
+ dependency
1386
+ )) {
1387
+ update_derived(
1388
+ /** @type {Derived} */
1389
+ dependency
1390
+ );
1391
+ }
1392
+ if (dependency.wv > reaction.wv) {
1393
+ return true;
1394
+ }
1395
+ }
1396
+ if ((flags & CONNECTED) !== 0 && // During time traveling we don't want to reset the status so that
1397
+ // traversal of the graph in the other batches still happens
1398
+ batch_values === null) {
1399
+ set_signal_status(reaction, CLEAN);
1400
+ }
1401
+ }
1402
+ return false;
1403
+ }
1404
+ function schedule_possible_effect_self_invalidation(signal, effect, root = true) {
1405
+ var reactions = signal.reactions;
1406
+ if (reactions === null) return;
1407
+ if (current_sources !== null && includes.call(current_sources, signal)) {
1408
+ return;
1409
+ }
1410
+ for (var i = 0; i < reactions.length; i++) {
1411
+ var reaction = reactions[i];
1412
+ if ((reaction.f & DERIVED) !== 0) {
1413
+ schedule_possible_effect_self_invalidation(
1414
+ /** @type {Derived} */
1415
+ reaction,
1416
+ effect,
1417
+ false
1418
+ );
1419
+ } else if (effect === reaction) {
1420
+ if (root) {
1421
+ set_signal_status(reaction, DIRTY);
1422
+ } else if ((reaction.f & CLEAN) !== 0) {
1423
+ set_signal_status(reaction, MAYBE_DIRTY);
1424
+ }
1425
+ schedule_effect(
1426
+ /** @type {Effect} */
1427
+ reaction
1428
+ );
1429
+ }
1430
+ }
1431
+ }
1432
+ function update_reaction(reaction) {
1433
+ var previous_deps = new_deps;
1434
+ var previous_skipped_deps = skipped_deps;
1435
+ var previous_untracked_writes = untracked_writes;
1436
+ var previous_reaction = active_reaction;
1437
+ var previous_sources = current_sources;
1438
+ var previous_component_context = component_context;
1439
+ var previous_untracking = untracking;
1440
+ var previous_update_version = update_version;
1441
+ var flags = reaction.f;
1442
+ new_deps = /** @type {null | Value[]} */
1443
+ null;
1444
+ skipped_deps = 0;
1445
+ untracked_writes = null;
1446
+ active_reaction = (flags & (BRANCH_EFFECT | ROOT_EFFECT)) === 0 ? reaction : null;
1447
+ current_sources = null;
1448
+ set_component_context(reaction.ctx);
1449
+ untracking = false;
1450
+ update_version = ++read_version;
1451
+ if (reaction.ac !== null) {
1452
+ without_reactive_context(() => {
1453
+ reaction.ac.abort(STALE_REACTION);
1454
+ });
1455
+ reaction.ac = null;
1456
+ }
1457
+ try {
1458
+ reaction.f |= REACTION_IS_UPDATING;
1459
+ var fn = (
1460
+ /** @type {Function} */
1461
+ reaction.fn
1462
+ );
1463
+ var result = fn();
1464
+ var deps = reaction.deps;
1465
+ if (new_deps !== null) {
1466
+ var i;
1467
+ remove_reactions(reaction, skipped_deps);
1468
+ if (deps !== null && skipped_deps > 0) {
1469
+ deps.length = skipped_deps + new_deps.length;
1470
+ for (i = 0; i < new_deps.length; i++) {
1471
+ deps[skipped_deps + i] = new_deps[i];
1472
+ }
1473
+ } else {
1474
+ reaction.deps = deps = new_deps;
1475
+ }
1476
+ if (effect_tracking() && (reaction.f & CONNECTED) !== 0) {
1477
+ for (i = skipped_deps; i < deps.length; i++) {
1478
+ (deps[i].reactions ??= []).push(reaction);
1479
+ }
1480
+ }
1481
+ } else if (deps !== null && skipped_deps < deps.length) {
1482
+ remove_reactions(reaction, skipped_deps);
1483
+ deps.length = skipped_deps;
1484
+ }
1485
+ if (is_runes() && untracked_writes !== null && !untracking && deps !== null && (reaction.f & (DERIVED | MAYBE_DIRTY | DIRTY)) === 0) {
1486
+ for (i = 0; i < /** @type {Source[]} */
1487
+ untracked_writes.length; i++) {
1488
+ schedule_possible_effect_self_invalidation(
1489
+ untracked_writes[i],
1490
+ /** @type {Effect} */
1491
+ reaction
1492
+ );
1493
+ }
1494
+ }
1495
+ if (previous_reaction !== null && previous_reaction !== reaction) {
1496
+ read_version++;
1497
+ if (previous_reaction.deps !== null) {
1498
+ for (let i2 = 0; i2 < previous_skipped_deps; i2 += 1) {
1499
+ previous_reaction.deps[i2].rv = read_version;
1500
+ }
1501
+ }
1502
+ if (previous_deps !== null) {
1503
+ for (const dep of previous_deps) {
1504
+ dep.rv = read_version;
1505
+ }
1506
+ }
1507
+ if (untracked_writes !== null) {
1508
+ if (previous_untracked_writes === null) {
1509
+ previous_untracked_writes = untracked_writes;
1510
+ } else {
1511
+ previous_untracked_writes.push(.../** @type {Source[]} */
1512
+ untracked_writes);
1513
+ }
1514
+ }
1515
+ }
1516
+ if ((reaction.f & ERROR_VALUE) !== 0) {
1517
+ reaction.f ^= ERROR_VALUE;
1518
+ }
1519
+ return result;
1520
+ } catch (error) {
1521
+ return handle_error(error);
1522
+ } finally {
1523
+ reaction.f ^= REACTION_IS_UPDATING;
1524
+ new_deps = previous_deps;
1525
+ skipped_deps = previous_skipped_deps;
1526
+ untracked_writes = previous_untracked_writes;
1527
+ active_reaction = previous_reaction;
1528
+ current_sources = previous_sources;
1529
+ set_component_context(previous_component_context);
1530
+ untracking = previous_untracking;
1531
+ update_version = previous_update_version;
1532
+ }
1533
+ }
1534
+ function remove_reaction(signal, dependency) {
1535
+ let reactions = dependency.reactions;
1536
+ if (reactions !== null) {
1537
+ var index = index_of.call(reactions, signal);
1538
+ if (index !== -1) {
1539
+ var new_length = reactions.length - 1;
1540
+ if (new_length === 0) {
1541
+ reactions = dependency.reactions = null;
1542
+ } else {
1543
+ reactions[index] = reactions[new_length];
1544
+ reactions.pop();
1545
+ }
1546
+ }
1547
+ }
1548
+ if (reactions === null && (dependency.f & DERIVED) !== 0 && // Destroying a child effect while updating a parent effect can cause a dependency to appear
1549
+ // to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`
1550
+ // allows us to skip the expensive work of disconnecting and immediately reconnecting it
1551
+ (new_deps === null || !includes.call(new_deps, dependency))) {
1552
+ var derived = (
1553
+ /** @type {Derived} */
1554
+ dependency
1555
+ );
1556
+ if ((derived.f & CONNECTED) !== 0) {
1557
+ derived.f ^= CONNECTED;
1558
+ derived.f &= ~WAS_MARKED;
1559
+ }
1560
+ update_derived_status(derived);
1561
+ destroy_derived_effects(derived);
1562
+ remove_reactions(derived, 0);
1563
+ }
1564
+ }
1565
+ function remove_reactions(signal, start_index) {
1566
+ var dependencies = signal.deps;
1567
+ if (dependencies === null) return;
1568
+ for (var i = start_index; i < dependencies.length; i++) {
1569
+ remove_reaction(signal, dependencies[i]);
1570
+ }
1571
+ }
1572
+ function update_effect(effect) {
1573
+ var flags = effect.f;
1574
+ if ((flags & DESTROYED) !== 0) {
1575
+ return;
1576
+ }
1577
+ set_signal_status(effect, CLEAN);
1578
+ var previous_effect = active_effect;
1579
+ var was_updating_effect = is_updating_effect;
1580
+ active_effect = effect;
1581
+ is_updating_effect = true;
1582
+ try {
1583
+ if ((flags & (BLOCK_EFFECT | MANAGED_EFFECT)) !== 0) {
1584
+ destroy_block_effect_children(effect);
1585
+ } else {
1586
+ destroy_effect_children(effect);
1587
+ }
1588
+ execute_effect_teardown(effect);
1589
+ var teardown = update_reaction(effect);
1590
+ effect.teardown = typeof teardown === "function" ? teardown : null;
1591
+ effect.wv = write_version;
1592
+ var dep;
1593
+ if (BROWSER && tracing_mode_flag && (effect.f & DIRTY) !== 0 && effect.deps !== null) ;
1594
+ } finally {
1595
+ is_updating_effect = was_updating_effect;
1596
+ active_effect = previous_effect;
1597
+ }
1598
+ }
1599
+ function get(signal) {
1600
+ var flags = signal.f;
1601
+ var is_derived = (flags & DERIVED) !== 0;
1602
+ if (active_reaction !== null && !untracking) {
1603
+ var destroyed = active_effect !== null && (active_effect.f & DESTROYED) !== 0;
1604
+ if (!destroyed && (current_sources === null || !includes.call(current_sources, signal))) {
1605
+ var deps = active_reaction.deps;
1606
+ if ((active_reaction.f & REACTION_IS_UPDATING) !== 0) {
1607
+ if (signal.rv < read_version) {
1608
+ signal.rv = read_version;
1609
+ if (new_deps === null && deps !== null && deps[skipped_deps] === signal) {
1610
+ skipped_deps++;
1611
+ } else if (new_deps === null) {
1612
+ new_deps = [signal];
1613
+ } else {
1614
+ new_deps.push(signal);
1615
+ }
1616
+ }
1617
+ } else {
1618
+ (active_reaction.deps ??= []).push(signal);
1619
+ var reactions = signal.reactions;
1620
+ if (reactions === null) {
1621
+ signal.reactions = [active_reaction];
1622
+ } else if (!includes.call(reactions, active_reaction)) {
1623
+ reactions.push(active_reaction);
1624
+ }
1625
+ }
1626
+ }
1627
+ }
1628
+ if (is_destroying_effect && old_values.has(signal)) {
1629
+ return old_values.get(signal);
1630
+ }
1631
+ if (is_derived) {
1632
+ var derived = (
1633
+ /** @type {Derived} */
1634
+ signal
1635
+ );
1636
+ if (is_destroying_effect) {
1637
+ var value = derived.v;
1638
+ if ((derived.f & CLEAN) === 0 && derived.reactions !== null || depends_on_old_values(derived)) {
1639
+ value = execute_derived(derived);
1640
+ }
1641
+ old_values.set(derived, value);
1642
+ return value;
1643
+ }
1644
+ var should_connect = (derived.f & CONNECTED) === 0 && !untracking && active_reaction !== null && (is_updating_effect || (active_reaction.f & CONNECTED) !== 0);
1645
+ var is_new = derived.deps === null;
1646
+ if (is_dirty(derived)) {
1647
+ if (should_connect) {
1648
+ derived.f |= CONNECTED;
1649
+ }
1650
+ update_derived(derived);
1651
+ }
1652
+ if (should_connect && !is_new) {
1653
+ reconnect(derived);
1654
+ }
1655
+ }
1656
+ if (batch_values?.has(signal)) {
1657
+ return batch_values.get(signal);
1658
+ }
1659
+ if ((signal.f & ERROR_VALUE) !== 0) {
1660
+ throw signal.v;
1661
+ }
1662
+ return signal.v;
1663
+ }
1664
+ function reconnect(derived) {
1665
+ if (derived.deps === null) return;
1666
+ derived.f |= CONNECTED;
1667
+ for (const dep of derived.deps) {
1668
+ (dep.reactions ??= []).push(derived);
1669
+ if ((dep.f & DERIVED) !== 0 && (dep.f & CONNECTED) === 0) {
1670
+ reconnect(
1671
+ /** @type {Derived} */
1672
+ dep
1673
+ );
1674
+ }
1675
+ }
1676
+ }
1677
+ function depends_on_old_values(derived) {
1678
+ if (derived.v === UNINITIALIZED) return true;
1679
+ if (derived.deps === null) return false;
1680
+ for (const dep of derived.deps) {
1681
+ if (old_values.has(dep)) {
1682
+ return true;
1683
+ }
1684
+ if ((dep.f & DERIVED) !== 0 && depends_on_old_values(
1685
+ /** @type {Derived} */
1686
+ dep
1687
+ )) {
1688
+ return true;
1689
+ }
1690
+ }
1691
+ return false;
1692
+ }
1693
+ function untrack(fn) {
1694
+ var previous_untracking = untracking;
1695
+ try {
1696
+ untracking = true;
1697
+ return fn();
1698
+ } finally {
1699
+ untracking = previous_untracking;
1700
+ }
1701
+ }
1702
+ const DOM_BOOLEAN_ATTRIBUTES = [
1703
+ "allowfullscreen",
1704
+ "async",
1705
+ "autofocus",
1706
+ "autoplay",
1707
+ "checked",
1708
+ "controls",
1709
+ "default",
1710
+ "disabled",
1711
+ "formnovalidate",
1712
+ "indeterminate",
1713
+ "inert",
1714
+ "ismap",
1715
+ "loop",
1716
+ "multiple",
1717
+ "muted",
1718
+ "nomodule",
1719
+ "novalidate",
1720
+ "open",
1721
+ "playsinline",
1722
+ "readonly",
1723
+ "required",
1724
+ "reversed",
1725
+ "seamless",
1726
+ "selected",
1727
+ "webkitdirectory",
1728
+ "defer",
1729
+ "disablepictureinpicture",
1730
+ "disableremoteplayback"
1731
+ ];
1732
+ function is_boolean_attribute(name) {
1733
+ return DOM_BOOLEAN_ATTRIBUTES.includes(name);
1734
+ }
1735
+ const PASSIVE_EVENTS = ["touchstart", "touchmove"];
1736
+ function is_passive_event(name) {
1737
+ return PASSIVE_EVENTS.includes(name);
1738
+ }
1739
+ const replacements = {
1740
+ translate: /* @__PURE__ */ new Map([
1741
+ [true, "yes"],
1742
+ [false, "no"]
1743
+ ])
1744
+ };
1745
+ function attr(name, value, is_boolean = false) {
1746
+ if (name === "hidden" && value !== "until-found") {
1747
+ is_boolean = true;
1748
+ }
1749
+ if (value == null || !value && is_boolean) return "";
1750
+ const normalized = name in replacements && replacements[name].get(value) || value;
1751
+ const assignment = is_boolean ? "" : `="${escape_html(normalized, true)}"`;
1752
+ return ` ${name}${assignment}`;
1753
+ }
1754
+ function clsx(value) {
1755
+ if (typeof value === "object") {
1756
+ return clsx$1(value);
1757
+ } else {
1758
+ return value ?? "";
1759
+ }
1760
+ }
1761
+ const whitespace = [..." \n\r\f \v\uFEFF"];
1762
+ function to_class(value, hash, directives) {
1763
+ var classname = value == null ? "" : "" + value;
1764
+ if (hash) {
1765
+ classname = classname ? classname + " " + hash : hash;
1766
+ }
1767
+ if (directives) {
1768
+ for (var key in directives) {
1769
+ if (directives[key]) {
1770
+ classname = classname ? classname + " " + key : key;
1771
+ } else if (classname.length) {
1772
+ var len = key.length;
1773
+ var a = 0;
1774
+ while ((a = classname.indexOf(key, a)) >= 0) {
1775
+ var b = a + len;
1776
+ if ((a === 0 || whitespace.includes(classname[a - 1])) && (b === classname.length || whitespace.includes(classname[b]))) {
1777
+ classname = (a === 0 ? "" : classname.substring(0, a)) + classname.substring(b + 1);
1778
+ } else {
1779
+ a = b;
1780
+ }
1781
+ }
1782
+ }
1783
+ }
1784
+ }
1785
+ return classname === "" ? null : classname;
1786
+ }
1787
+ function append_styles(styles, important = false) {
1788
+ var separator = important ? " !important;" : ";";
1789
+ var css = "";
1790
+ for (var key in styles) {
1791
+ var value = styles[key];
1792
+ if (value != null && value !== "") {
1793
+ css += " " + key + ": " + value + separator;
1794
+ }
1795
+ }
1796
+ return css;
1797
+ }
1798
+ function to_css_name(name) {
1799
+ if (name[0] !== "-" || name[1] !== "-") {
1800
+ return name.toLowerCase();
1801
+ }
1802
+ return name;
1803
+ }
1804
+ function to_style(value, styles) {
1805
+ if (styles) {
1806
+ var new_style = "";
1807
+ var normal_styles;
1808
+ var important_styles;
1809
+ if (Array.isArray(styles)) {
1810
+ normal_styles = styles[0];
1811
+ important_styles = styles[1];
1812
+ } else {
1813
+ normal_styles = styles;
1814
+ }
1815
+ if (value) {
1816
+ value = String(value).replaceAll(/\s*\/\*.*?\*\/\s*/g, "").trim();
1817
+ var in_str = false;
1818
+ var in_apo = 0;
1819
+ var in_comment = false;
1820
+ var reserved_names = [];
1821
+ if (normal_styles) {
1822
+ reserved_names.push(...Object.keys(normal_styles).map(to_css_name));
1823
+ }
1824
+ if (important_styles) {
1825
+ reserved_names.push(...Object.keys(important_styles).map(to_css_name));
1826
+ }
1827
+ var start_index = 0;
1828
+ var name_index = -1;
1829
+ const len = value.length;
1830
+ for (var i = 0; i < len; i++) {
1831
+ var c = value[i];
1832
+ if (in_comment) {
1833
+ if (c === "/" && value[i - 1] === "*") {
1834
+ in_comment = false;
1835
+ }
1836
+ } else if (in_str) {
1837
+ if (in_str === c) {
1838
+ in_str = false;
1839
+ }
1840
+ } else if (c === "/" && value[i + 1] === "*") {
1841
+ in_comment = true;
1842
+ } else if (c === '"' || c === "'") {
1843
+ in_str = c;
1844
+ } else if (c === "(") {
1845
+ in_apo++;
1846
+ } else if (c === ")") {
1847
+ in_apo--;
1848
+ }
1849
+ if (!in_comment && in_str === false && in_apo === 0) {
1850
+ if (c === ":" && name_index === -1) {
1851
+ name_index = i;
1852
+ } else if (c === ";" || i === len - 1) {
1853
+ if (name_index !== -1) {
1854
+ var name = to_css_name(value.substring(start_index, name_index).trim());
1855
+ if (!reserved_names.includes(name)) {
1856
+ if (c !== ";") {
1857
+ i++;
1858
+ }
1859
+ var property = value.substring(start_index, i).trim();
1860
+ new_style += " " + property + ";";
1861
+ }
1862
+ }
1863
+ start_index = i + 1;
1864
+ name_index = -1;
1865
+ }
1866
+ }
1867
+ }
1868
+ }
1869
+ if (normal_styles) {
1870
+ new_style += append_styles(normal_styles);
1871
+ }
1872
+ if (important_styles) {
1873
+ new_style += append_styles(important_styles, true);
1874
+ }
1875
+ new_style = new_style.trim();
1876
+ return new_style === "" ? null : new_style;
1877
+ }
1878
+ return value == null ? null : String(value);
1879
+ }
1880
+ function subscribe_to_store(store, run, invalidate) {
1881
+ if (store == null) {
1882
+ run(void 0);
1883
+ return noop;
1884
+ }
1885
+ const unsub = untrack(
1886
+ () => store.subscribe(
1887
+ run,
1888
+ // @ts-expect-error
1889
+ invalidate
1890
+ )
1891
+ );
1892
+ return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;
1893
+ }
1894
+ const BLOCK_OPEN = `<!--${HYDRATION_START}-->`;
1895
+ const BLOCK_CLOSE = `<!--${HYDRATION_END}-->`;
1896
+ const EMPTY_COMMENT = `<!---->`;
1897
+ let controller = null;
1898
+ function abort() {
1899
+ controller?.abort(STALE_REACTION);
1900
+ controller = null;
1901
+ }
1902
+ function await_invalid() {
1903
+ const error = new Error(`await_invalid
1904
+ Encountered asynchronous work while rendering synchronously.
1905
+ https://svelte.dev/e/await_invalid`);
1906
+ error.name = "Svelte error";
1907
+ throw error;
1908
+ }
1909
+ function invalid_csp() {
1910
+ const error = new Error(`invalid_csp
1911
+ \`csp.nonce\` was set while \`csp.hash\` was \`true\`. These options cannot be used simultaneously.
1912
+ https://svelte.dev/e/invalid_csp`);
1913
+ error.name = "Svelte error";
1914
+ throw error;
1915
+ }
1916
+ function server_context_required() {
1917
+ const error = new Error(`server_context_required
1918
+ Could not resolve \`render\` context.
1919
+ https://svelte.dev/e/server_context_required`);
1920
+ error.name = "Svelte error";
1921
+ throw error;
1922
+ }
1923
+ function unresolved_hydratable(key, stack) {
1924
+ {
1925
+ console.warn(`https://svelte.dev/e/unresolved_hydratable`);
1926
+ }
1927
+ }
1928
+ function get_render_context() {
1929
+ const store = als?.getStore();
1930
+ {
1931
+ server_context_required();
1932
+ }
1933
+ return store;
1934
+ }
1935
+ let als = null;
1936
+ let text_encoder;
1937
+ let crypto;
1938
+ async function sha256(data) {
1939
+ text_encoder ??= new TextEncoder();
1940
+ crypto ??= globalThis.crypto?.subtle?.digest ? globalThis.crypto : (
1941
+ // @ts-ignore - we don't install node types in the prod build
1942
+ (await import("node:crypto")).webcrypto
1943
+ );
1944
+ const hash_buffer = await crypto.subtle.digest("SHA-256", text_encoder.encode(data));
1945
+ return base64_encode(hash_buffer);
1946
+ }
1947
+ function base64_encode(bytes) {
1948
+ if (globalThis.Buffer) {
1949
+ return globalThis.Buffer.from(bytes).toString("base64");
1950
+ }
1951
+ let binary = "";
1952
+ for (let i = 0; i < bytes.length; i++) {
1953
+ binary += String.fromCharCode(bytes[i]);
1954
+ }
1955
+ return btoa(binary);
1956
+ }
1957
+ class Renderer {
1958
+ /**
1959
+ * The contents of the renderer.
1960
+ * @type {RendererItem[]}
1961
+ */
1962
+ #out = [];
1963
+ /**
1964
+ * Any `onDestroy` callbacks registered during execution of this renderer.
1965
+ * @type {(() => void)[] | undefined}
1966
+ */
1967
+ #on_destroy = void 0;
1968
+ /**
1969
+ * Whether this renderer is a component body.
1970
+ * @type {boolean}
1971
+ */
1972
+ #is_component_body = false;
1973
+ /**
1974
+ * The type of string content that this renderer is accumulating.
1975
+ * @type {RendererType}
1976
+ */
1977
+ type;
1978
+ /** @type {Renderer | undefined} */
1979
+ #parent;
1980
+ /**
1981
+ * Asynchronous work associated with this renderer
1982
+ * @type {Promise<void> | undefined}
1983
+ */
1984
+ promise = void 0;
1985
+ /**
1986
+ * State which is associated with the content tree as a whole.
1987
+ * It will be re-exposed, uncopied, on all children.
1988
+ * @type {SSRState}
1989
+ * @readonly
1990
+ */
1991
+ global;
1992
+ /**
1993
+ * State that is local to the branch it is declared in.
1994
+ * It will be shallow-copied to all children.
1995
+ *
1996
+ * @type {{ select_value: string | undefined }}
1997
+ */
1998
+ local;
1999
+ /**
2000
+ * @param {SSRState} global
2001
+ * @param {Renderer | undefined} [parent]
2002
+ */
2003
+ constructor(global, parent) {
2004
+ this.#parent = parent;
2005
+ this.global = global;
2006
+ this.local = parent ? { ...parent.local } : { select_value: void 0 };
2007
+ this.type = parent ? parent.type : "body";
2008
+ }
2009
+ /**
2010
+ * @param {(renderer: Renderer) => void} fn
2011
+ */
2012
+ head(fn) {
2013
+ const head2 = new Renderer(this.global, this);
2014
+ head2.type = "head";
2015
+ this.#out.push(head2);
2016
+ head2.child(fn);
2017
+ }
2018
+ /**
2019
+ * @param {Array<Promise<void>>} blockers
2020
+ * @param {(renderer: Renderer) => void} fn
2021
+ */
2022
+ async_block(blockers, fn) {
2023
+ this.#out.push(BLOCK_OPEN);
2024
+ this.async(blockers, fn);
2025
+ this.#out.push(BLOCK_CLOSE);
2026
+ }
2027
+ /**
2028
+ * @param {Array<Promise<void>>} blockers
2029
+ * @param {(renderer: Renderer) => void} fn
2030
+ */
2031
+ async(blockers, fn) {
2032
+ let callback = fn;
2033
+ if (blockers.length > 0) {
2034
+ const context = ssr_context;
2035
+ callback = (renderer) => {
2036
+ return Promise.all(blockers).then(() => {
2037
+ const previous_context = ssr_context;
2038
+ try {
2039
+ set_ssr_context(context);
2040
+ return fn(renderer);
2041
+ } finally {
2042
+ set_ssr_context(previous_context);
2043
+ }
2044
+ });
2045
+ };
2046
+ }
2047
+ this.child(callback);
2048
+ }
2049
+ /**
2050
+ * @param {Array<() => void>} thunks
2051
+ */
2052
+ run(thunks) {
2053
+ const context = ssr_context;
2054
+ let promise = Promise.resolve(thunks[0]());
2055
+ const promises = [promise];
2056
+ for (const fn of thunks.slice(1)) {
2057
+ promise = promise.then(() => {
2058
+ const previous_context = ssr_context;
2059
+ set_ssr_context(context);
2060
+ try {
2061
+ return fn();
2062
+ } finally {
2063
+ set_ssr_context(previous_context);
2064
+ }
2065
+ });
2066
+ promises.push(promise);
2067
+ }
2068
+ return promises;
2069
+ }
2070
+ /**
2071
+ * Create a child renderer. The child renderer inherits the state from the parent,
2072
+ * but has its own content.
2073
+ * @param {(renderer: Renderer) => MaybePromise<void>} fn
2074
+ */
2075
+ child(fn) {
2076
+ const child = new Renderer(this.global, this);
2077
+ this.#out.push(child);
2078
+ const parent = ssr_context;
2079
+ set_ssr_context({
2080
+ ...ssr_context,
2081
+ p: parent,
2082
+ c: null,
2083
+ r: child
2084
+ });
2085
+ const result = fn(child);
2086
+ set_ssr_context(parent);
2087
+ if (result instanceof Promise) {
2088
+ if (child.global.mode === "sync") {
2089
+ await_invalid();
2090
+ }
2091
+ result.catch(() => {
2092
+ });
2093
+ child.promise = result;
2094
+ }
2095
+ return child;
2096
+ }
2097
+ /**
2098
+ * Create a component renderer. The component renderer inherits the state from the parent,
2099
+ * but has its own content. It is treated as an ordering boundary for ondestroy callbacks.
2100
+ * @param {(renderer: Renderer) => MaybePromise<void>} fn
2101
+ * @param {Function} [component_fn]
2102
+ * @returns {void}
2103
+ */
2104
+ component(fn, component_fn) {
2105
+ push$1();
2106
+ const child = this.child(fn);
2107
+ child.#is_component_body = true;
2108
+ pop$1();
2109
+ }
2110
+ /**
2111
+ * @param {Record<string, any>} attrs
2112
+ * @param {(renderer: Renderer) => void} fn
2113
+ * @param {string | undefined} [css_hash]
2114
+ * @param {Record<string, boolean> | undefined} [classes]
2115
+ * @param {Record<string, string> | undefined} [styles]
2116
+ * @param {number | undefined} [flags]
2117
+ * @param {boolean | undefined} [is_rich]
2118
+ * @returns {void}
2119
+ */
2120
+ select(attrs, fn, css_hash, classes, styles, flags, is_rich) {
2121
+ const { value, ...select_attrs } = attrs;
2122
+ this.push(`<select${attributes(select_attrs, css_hash, classes, styles, flags)}>`);
2123
+ this.child((renderer) => {
2124
+ renderer.local.select_value = value;
2125
+ fn(renderer);
2126
+ });
2127
+ this.push(`${is_rich ? "<!>" : ""}</select>`);
2128
+ }
2129
+ /**
2130
+ * @param {Record<string, any>} attrs
2131
+ * @param {string | number | boolean | ((renderer: Renderer) => void)} body
2132
+ * @param {string | undefined} [css_hash]
2133
+ * @param {Record<string, boolean> | undefined} [classes]
2134
+ * @param {Record<string, string> | undefined} [styles]
2135
+ * @param {number | undefined} [flags]
2136
+ * @param {boolean | undefined} [is_rich]
2137
+ */
2138
+ option(attrs, body, css_hash, classes, styles, flags, is_rich) {
2139
+ this.#out.push(`<option${attributes(attrs, css_hash, classes, styles, flags)}`);
2140
+ const close = (renderer, value, { head: head2, body: body2 }) => {
2141
+ if ("value" in attrs) {
2142
+ value = attrs.value;
2143
+ }
2144
+ if (value === this.local.select_value) {
2145
+ renderer.#out.push(" selected");
2146
+ }
2147
+ renderer.#out.push(`>${body2}${is_rich ? "<!>" : ""}</option>`);
2148
+ if (head2) {
2149
+ renderer.head((child) => child.push(head2));
2150
+ }
2151
+ };
2152
+ if (typeof body === "function") {
2153
+ this.child((renderer) => {
2154
+ const r = new Renderer(this.global, this);
2155
+ body(r);
2156
+ if (this.global.mode === "async") {
2157
+ return r.#collect_content_async().then((content) => {
2158
+ close(renderer, content.body.replaceAll("<!---->", ""), content);
2159
+ });
2160
+ } else {
2161
+ const content = r.#collect_content();
2162
+ close(renderer, content.body.replaceAll("<!---->", ""), content);
2163
+ }
2164
+ });
2165
+ } else {
2166
+ close(this, body, { body });
2167
+ }
2168
+ }
2169
+ /**
2170
+ * @param {(renderer: Renderer) => void} fn
2171
+ */
2172
+ title(fn) {
2173
+ const path = this.get_path();
2174
+ const close = (head2) => {
2175
+ this.global.set_title(head2, path);
2176
+ };
2177
+ this.child((renderer) => {
2178
+ const r = new Renderer(renderer.global, renderer);
2179
+ fn(r);
2180
+ if (renderer.global.mode === "async") {
2181
+ return r.#collect_content_async().then((content) => {
2182
+ close(content.head);
2183
+ });
2184
+ } else {
2185
+ const content = r.#collect_content();
2186
+ close(content.head);
2187
+ }
2188
+ });
2189
+ }
2190
+ /**
2191
+ * @param {string | (() => Promise<string>)} content
2192
+ */
2193
+ push(content) {
2194
+ if (typeof content === "function") {
2195
+ this.child(async (renderer) => renderer.push(await content()));
2196
+ } else {
2197
+ this.#out.push(content);
2198
+ }
2199
+ }
2200
+ /**
2201
+ * @param {() => void} fn
2202
+ */
2203
+ on_destroy(fn) {
2204
+ (this.#on_destroy ??= []).push(fn);
2205
+ }
2206
+ /**
2207
+ * @returns {number[]}
2208
+ */
2209
+ get_path() {
2210
+ return this.#parent ? [...this.#parent.get_path(), this.#parent.#out.indexOf(this)] : [];
2211
+ }
2212
+ /**
2213
+ * @deprecated this is needed for legacy component bindings
2214
+ */
2215
+ copy() {
2216
+ const copy = new Renderer(this.global, this.#parent);
2217
+ copy.#out = this.#out.map((item) => item instanceof Renderer ? item.copy() : item);
2218
+ copy.promise = this.promise;
2219
+ return copy;
2220
+ }
2221
+ /**
2222
+ * @param {Renderer} other
2223
+ * @deprecated this is needed for legacy component bindings
2224
+ */
2225
+ subsume(other) {
2226
+ if (this.global.mode !== other.global.mode) {
2227
+ throw new Error(
2228
+ "invariant: A renderer cannot switch modes. If you're seeing this, there's a compiler bug. File an issue!"
2229
+ );
2230
+ }
2231
+ this.local = other.local;
2232
+ this.#out = other.#out.map((item) => {
2233
+ if (item instanceof Renderer) {
2234
+ item.subsume(item);
2235
+ }
2236
+ return item;
2237
+ });
2238
+ this.promise = other.promise;
2239
+ this.type = other.type;
2240
+ }
2241
+ get length() {
2242
+ return this.#out.length;
2243
+ }
2244
+ /**
2245
+ * Only available on the server and when compiling with the `server` option.
2246
+ * Takes a component and returns an object with `body` and `head` properties on it, which you can use to populate the HTML when server-rendering your app.
2247
+ * @template {Record<string, any>} Props
2248
+ * @param {Component<Props>} component
2249
+ * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string; csp?: Csp }} [options]
2250
+ * @returns {RenderOutput}
2251
+ */
2252
+ static render(component, options = {}) {
2253
+ let sync;
2254
+ const result = (
2255
+ /** @type {RenderOutput} */
2256
+ {}
2257
+ );
2258
+ Object.defineProperties(result, {
2259
+ html: {
2260
+ get: () => {
2261
+ return (sync ??= Renderer.#render(component, options)).body;
2262
+ }
2263
+ },
2264
+ head: {
2265
+ get: () => {
2266
+ return (sync ??= Renderer.#render(component, options)).head;
2267
+ }
2268
+ },
2269
+ body: {
2270
+ get: () => {
2271
+ return (sync ??= Renderer.#render(component, options)).body;
2272
+ }
2273
+ },
2274
+ hashes: {
2275
+ value: {
2276
+ script: ""
2277
+ }
2278
+ },
2279
+ then: {
2280
+ value: (
2281
+ /**
2282
+ * this is not type-safe, but honestly it's the best I can do right now, and it's a straightforward function.
2283
+ *
2284
+ * @template TResult1
2285
+ * @template [TResult2=never]
2286
+ * @param { (value: SyncRenderOutput) => TResult1 } onfulfilled
2287
+ * @param { (reason: unknown) => TResult2 } onrejected
2288
+ */
2289
+ (onfulfilled, onrejected) => {
2290
+ {
2291
+ const result2 = sync ??= Renderer.#render(component, options);
2292
+ const user_result = onfulfilled({
2293
+ head: result2.head,
2294
+ body: result2.body,
2295
+ html: result2.body,
2296
+ hashes: { script: [] }
2297
+ });
2298
+ return Promise.resolve(user_result);
2299
+ }
2300
+ }
2301
+ )
2302
+ }
2303
+ });
2304
+ return result;
2305
+ }
2306
+ /**
2307
+ * Collect all of the `onDestroy` callbacks registered during rendering. In an async context, this is only safe to call
2308
+ * after awaiting `collect_async`.
2309
+ *
2310
+ * Child renderers are "porous" and don't affect execution order, but component body renderers
2311
+ * create ordering boundaries. Within a renderer, callbacks run in order until hitting a component boundary.
2312
+ * @returns {Iterable<() => void>}
2313
+ */
2314
+ *#collect_on_destroy() {
2315
+ for (const component of this.#traverse_components()) {
2316
+ yield* component.#collect_ondestroy();
2317
+ }
2318
+ }
2319
+ /**
2320
+ * Performs a depth-first search of renderers, yielding the deepest components first, then additional components as we backtrack up the tree.
2321
+ * @returns {Iterable<Renderer>}
2322
+ */
2323
+ *#traverse_components() {
2324
+ for (const child of this.#out) {
2325
+ if (typeof child !== "string") {
2326
+ yield* child.#traverse_components();
2327
+ }
2328
+ }
2329
+ if (this.#is_component_body) {
2330
+ yield this;
2331
+ }
2332
+ }
2333
+ /**
2334
+ * @returns {Iterable<() => void>}
2335
+ */
2336
+ *#collect_ondestroy() {
2337
+ if (this.#on_destroy) {
2338
+ for (const fn of this.#on_destroy) {
2339
+ yield fn;
2340
+ }
2341
+ }
2342
+ for (const child of this.#out) {
2343
+ if (child instanceof Renderer && !child.#is_component_body) {
2344
+ yield* child.#collect_ondestroy();
2345
+ }
2346
+ }
2347
+ }
2348
+ /**
2349
+ * Render a component. Throws if any of the children are performing asynchronous work.
2350
+ *
2351
+ * @template {Record<string, any>} Props
2352
+ * @param {Component<Props>} component
2353
+ * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string }} options
2354
+ * @returns {AccumulatedContent}
2355
+ */
2356
+ static #render(component, options) {
2357
+ var previous_context = ssr_context;
2358
+ try {
2359
+ const renderer = Renderer.#open_render("sync", component, options);
2360
+ const content = renderer.#collect_content();
2361
+ return Renderer.#close_render(content, renderer);
2362
+ } finally {
2363
+ abort();
2364
+ set_ssr_context(previous_context);
2365
+ }
2366
+ }
2367
+ /**
2368
+ * Render a component.
2369
+ *
2370
+ * @template {Record<string, any>} Props
2371
+ * @param {Component<Props>} component
2372
+ * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string; csp?: Csp }} options
2373
+ * @returns {Promise<AccumulatedContent & { hashes: { script: Sha256Source[] } }>}
2374
+ */
2375
+ static async #render_async(component, options) {
2376
+ const previous_context = ssr_context;
2377
+ try {
2378
+ const renderer = Renderer.#open_render("async", component, options);
2379
+ const content = await renderer.#collect_content_async();
2380
+ const hydratables = await renderer.#collect_hydratables();
2381
+ if (hydratables !== null) {
2382
+ content.head = hydratables + content.head;
2383
+ }
2384
+ return Renderer.#close_render(content, renderer);
2385
+ } finally {
2386
+ set_ssr_context(previous_context);
2387
+ abort();
2388
+ }
2389
+ }
2390
+ /**
2391
+ * Collect all of the code from the `out` array and return it as a string, or a promise resolving to a string.
2392
+ * @param {AccumulatedContent} content
2393
+ * @returns {AccumulatedContent}
2394
+ */
2395
+ #collect_content(content = { head: "", body: "" }) {
2396
+ for (const item of this.#out) {
2397
+ if (typeof item === "string") {
2398
+ content[this.type] += item;
2399
+ } else if (item instanceof Renderer) {
2400
+ item.#collect_content(content);
2401
+ }
2402
+ }
2403
+ return content;
2404
+ }
2405
+ /**
2406
+ * Collect all of the code from the `out` array and return it as a string.
2407
+ * @param {AccumulatedContent} content
2408
+ * @returns {Promise<AccumulatedContent>}
2409
+ */
2410
+ async #collect_content_async(content = { head: "", body: "" }) {
2411
+ await this.promise;
2412
+ for (const item of this.#out) {
2413
+ if (typeof item === "string") {
2414
+ content[this.type] += item;
2415
+ } else if (item instanceof Renderer) {
2416
+ await item.#collect_content_async(content);
2417
+ }
2418
+ }
2419
+ return content;
2420
+ }
2421
+ async #collect_hydratables() {
2422
+ const ctx = get_render_context().hydratable;
2423
+ for (const [_, key] of ctx.unresolved_promises) {
2424
+ unresolved_hydratable(key, ctx.lookup.get(key)?.stack ?? "<missing stack trace>");
2425
+ }
2426
+ for (const comparison of ctx.comparisons) {
2427
+ await comparison;
2428
+ }
2429
+ return await this.#hydratable_block(ctx);
2430
+ }
2431
+ /**
2432
+ * @template {Record<string, any>} Props
2433
+ * @param {'sync' | 'async'} mode
2434
+ * @param {import('svelte').Component<Props>} component
2435
+ * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string; csp?: Csp }} options
2436
+ * @returns {Renderer}
2437
+ */
2438
+ static #open_render(mode, component, options) {
2439
+ const renderer = new Renderer(
2440
+ new SSRState(mode, options.idPrefix ? options.idPrefix + "-" : "", options.csp)
2441
+ );
2442
+ renderer.push(BLOCK_OPEN);
2443
+ if (options.context) {
2444
+ push$1();
2445
+ ssr_context.c = options.context;
2446
+ ssr_context.r = renderer;
2447
+ }
2448
+ component(renderer, options.props ?? {});
2449
+ if (options.context) {
2450
+ pop$1();
2451
+ }
2452
+ renderer.push(BLOCK_CLOSE);
2453
+ return renderer;
2454
+ }
2455
+ /**
2456
+ * @param {AccumulatedContent} content
2457
+ * @param {Renderer} renderer
2458
+ * @returns {AccumulatedContent & { hashes: { script: Sha256Source[] } }}
2459
+ */
2460
+ static #close_render(content, renderer) {
2461
+ for (const cleanup of renderer.#collect_on_destroy()) {
2462
+ cleanup();
2463
+ }
2464
+ let head2 = content.head + renderer.global.get_title();
2465
+ let body = content.body;
2466
+ for (const { hash, code } of renderer.global.css) {
2467
+ head2 += `<style id="${hash}">${code}</style>`;
2468
+ }
2469
+ return {
2470
+ head: head2,
2471
+ body,
2472
+ hashes: {
2473
+ script: renderer.global.csp.script_hashes
2474
+ }
2475
+ };
2476
+ }
2477
+ /**
2478
+ * @param {HydratableContext} ctx
2479
+ */
2480
+ async #hydratable_block(ctx) {
2481
+ if (ctx.lookup.size === 0) {
2482
+ return null;
2483
+ }
2484
+ let entries = [];
2485
+ let has_promises = false;
2486
+ for (const [k, v] of ctx.lookup) {
2487
+ if (v.promises) {
2488
+ has_promises = true;
2489
+ for (const p of v.promises) await p;
2490
+ }
2491
+ entries.push(`[${devalue.uneval(k)},${v.serialized}]`);
2492
+ }
2493
+ let prelude = `const h = (window.__svelte ??= {}).h ??= new Map();`;
2494
+ if (has_promises) {
2495
+ prelude = `const r = (v) => Promise.resolve(v);
2496
+ ${prelude}`;
2497
+ }
2498
+ const body = `
2499
+ {
2500
+ ${prelude}
2501
+
2502
+ for (const [k, v] of [
2503
+ ${entries.join(",\n ")}
2504
+ ]) {
2505
+ h.set(k, v);
2506
+ }
2507
+ }
2508
+ `;
2509
+ let csp_attr = "";
2510
+ if (this.global.csp.nonce) {
2511
+ csp_attr = ` nonce="${this.global.csp.nonce}"`;
2512
+ } else if (this.global.csp.hash) {
2513
+ const hash = await sha256(body);
2514
+ this.global.csp.script_hashes.push(`sha256-${hash}`);
2515
+ }
2516
+ return `
2517
+ <script${csp_attr}>${body}<\/script>`;
2518
+ }
2519
+ }
2520
+ class SSRState {
2521
+ /** @readonly @type {Csp & { script_hashes: Sha256Source[] }} */
2522
+ csp;
2523
+ /** @readonly @type {'sync' | 'async'} */
2524
+ mode;
2525
+ /** @readonly @type {() => string} */
2526
+ uid;
2527
+ /** @readonly @type {Set<{ hash: string; code: string }>} */
2528
+ css = /* @__PURE__ */ new Set();
2529
+ /** @type {{ path: number[], value: string }} */
2530
+ #title = { path: [], value: "" };
2531
+ /**
2532
+ * @param {'sync' | 'async'} mode
2533
+ * @param {string} id_prefix
2534
+ * @param {Csp} csp
2535
+ */
2536
+ constructor(mode, id_prefix = "", csp = { hash: false }) {
2537
+ this.mode = mode;
2538
+ this.csp = { ...csp, script_hashes: [] };
2539
+ let uid = 1;
2540
+ this.uid = () => `${id_prefix}s${uid++}`;
2541
+ }
2542
+ get_title() {
2543
+ return this.#title.value;
2544
+ }
2545
+ /**
2546
+ * Performs a depth-first (lexicographic) comparison using the path. Rejects sets
2547
+ * from earlier than or equal to the current value.
2548
+ * @param {string} value
2549
+ * @param {number[]} path
2550
+ */
2551
+ set_title(value, path) {
2552
+ const current = this.#title.path;
2553
+ let i = 0;
2554
+ let l = Math.min(path.length, current.length);
2555
+ while (i < l && path[i] === current[i]) i += 1;
2556
+ if (path[i] === void 0) return;
2557
+ if (current[i] === void 0 || path[i] > current[i]) {
2558
+ this.#title.path = path;
2559
+ this.#title.value = value;
2560
+ }
2561
+ }
2562
+ }
2563
+ const INVALID_ATTR_NAME_CHAR_REGEX = /[\s'">/=\u{FDD0}-\u{FDEF}\u{FFFE}\u{FFFF}\u{1FFFE}\u{1FFFF}\u{2FFFE}\u{2FFFF}\u{3FFFE}\u{3FFFF}\u{4FFFE}\u{4FFFF}\u{5FFFE}\u{5FFFF}\u{6FFFE}\u{6FFFF}\u{7FFFE}\u{7FFFF}\u{8FFFE}\u{8FFFF}\u{9FFFE}\u{9FFFF}\u{AFFFE}\u{AFFFF}\u{BFFFE}\u{BFFFF}\u{CFFFE}\u{CFFFF}\u{DFFFE}\u{DFFFF}\u{EFFFE}\u{EFFFF}\u{FFFFE}\u{FFFFF}\u{10FFFE}\u{10FFFF}]/u;
2564
+ function render(component, options = {}) {
2565
+ if (options.csp?.hash && options.csp.nonce) {
2566
+ invalid_csp();
2567
+ }
2568
+ return Renderer.render(
2569
+ /** @type {Component<Props>} */
2570
+ component,
2571
+ options
2572
+ );
2573
+ }
2574
+ function head(hash, renderer, fn) {
2575
+ renderer.head((renderer2) => {
2576
+ renderer2.push(`<!--${hash}-->`);
2577
+ renderer2.child(fn);
2578
+ renderer2.push(EMPTY_COMMENT);
2579
+ });
2580
+ }
2581
+ function attributes(attrs, css_hash, classes, styles, flags = 0) {
2582
+ if (styles) {
2583
+ attrs.style = to_style(attrs.style, styles);
2584
+ }
2585
+ if (attrs.class) {
2586
+ attrs.class = clsx(attrs.class);
2587
+ }
2588
+ if (css_hash || classes) {
2589
+ attrs.class = to_class(attrs.class, css_hash, classes);
2590
+ }
2591
+ let attr_str = "";
2592
+ let name;
2593
+ const is_html = (flags & ELEMENT_IS_NAMESPACED) === 0;
2594
+ const lowercase = (flags & ELEMENT_PRESERVE_ATTRIBUTE_CASE) === 0;
2595
+ const is_input = (flags & ELEMENT_IS_INPUT) !== 0;
2596
+ for (name in attrs) {
2597
+ if (typeof attrs[name] === "function") continue;
2598
+ if (name[0] === "$" && name[1] === "$") continue;
2599
+ if (INVALID_ATTR_NAME_CHAR_REGEX.test(name)) continue;
2600
+ var value = attrs[name];
2601
+ if (lowercase) {
2602
+ name = name.toLowerCase();
2603
+ }
2604
+ if (is_input) {
2605
+ if (name === "defaultvalue" || name === "defaultchecked") {
2606
+ name = name === "defaultvalue" ? "value" : "checked";
2607
+ if (attrs[name]) continue;
2608
+ }
2609
+ }
2610
+ attr_str += attr(name, value, is_html && is_boolean_attribute(name));
2611
+ }
2612
+ return attr_str;
2613
+ }
2614
+ function stringify(value) {
2615
+ return typeof value === "string" ? value : value == null ? "" : value + "";
2616
+ }
2617
+ function attr_class(value, hash, directives) {
2618
+ var result = to_class(value, hash, directives);
2619
+ return result ? ` class="${escape_html(result, true)}"` : "";
2620
+ }
2621
+ function attr_style(value, directives) {
2622
+ var result = to_style(value, directives);
2623
+ return result ? ` style="${escape_html(result, true)}"` : "";
2624
+ }
2625
+ function store_get(store_values, store_name, store) {
2626
+ if (store_name in store_values && store_values[store_name][0] === store) {
2627
+ return store_values[store_name][2];
2628
+ }
2629
+ store_values[store_name]?.[1]();
2630
+ store_values[store_name] = [store, null, void 0];
2631
+ const unsub = subscribe_to_store(
2632
+ store,
2633
+ /** @param {any} v */
2634
+ (v) => store_values[store_name][2] = v
2635
+ );
2636
+ store_values[store_name][1] = unsub;
2637
+ return store_values[store_name][2];
2638
+ }
2639
+ function unsubscribe_stores(store_values) {
2640
+ for (const store_name in store_values) {
2641
+ store_values[store_name][1]();
2642
+ }
2643
+ }
2644
+ function ensure_array_like(array_like_or_iterator) {
2645
+ if (array_like_or_iterator) {
2646
+ return array_like_or_iterator.length !== void 0 ? array_like_or_iterator : Array.from(array_like_or_iterator);
2647
+ }
2648
+ return [];
2649
+ }
2650
+ export {
2651
+ attr as $,
2652
+ internal_set as A,
2653
+ Batch as B,
2654
+ COMMENT_NODE as C,
2655
+ DIRTY as D,
2656
+ destroy_effect as E,
2657
+ invoke_error_boundary as F,
2658
+ svelte_boundary_reset_onerror as G,
2659
+ HYDRATION_ERROR as H,
2660
+ EFFECT_TRANSPARENT as I,
2661
+ EFFECT_PRESERVED as J,
2662
+ BOUNDARY_EFFECT as K,
2663
+ init_operations as L,
2664
+ MAYBE_DIRTY as M,
2665
+ get_first_child as N,
2666
+ hydration_failed as O,
2667
+ clear_text_content as P,
2668
+ component_root as Q,
2669
+ is_passive_event as R,
2670
+ push as S,
2671
+ pop as T,
2672
+ set as U,
2673
+ LEGACY_PROPS as V,
2674
+ flushSync as W,
2675
+ mutable_source as X,
2676
+ render as Y,
2677
+ head as Z,
2678
+ attr_class as _,
2679
+ HYDRATION_END as a,
2680
+ ensure_array_like as a0,
2681
+ attr_style as a1,
2682
+ stringify as a2,
2683
+ store_get as a3,
2684
+ unsubscribe_stores as a4,
2685
+ HYDRATION_START as b,
2686
+ HYDRATION_START_ELSE as c,
2687
+ get as d,
2688
+ effect_tracking as e,
2689
+ active_effect as f,
2690
+ get_next_sibling as g,
2691
+ block as h,
2692
+ increment as i,
2693
+ branch as j,
2694
+ create_text as k,
2695
+ defer_effect as l,
2696
+ set_active_effect as m,
2697
+ set_active_reaction as n,
2698
+ set_component_context as o,
2699
+ pause_effect as p,
2700
+ queue_micro_task as q,
2701
+ render_effect as r,
2702
+ source as s,
2703
+ handle_error as t,
2704
+ untrack as u,
2705
+ active_reaction as v,
2706
+ component_context as w,
2707
+ move_effect as x,
2708
+ set_signal_status as y,
2709
+ schedule_effect as z
2710
+ };