@selvajs/selva 4.21.0-beta.21 → 4.21.0-beta.23

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 (228) hide show
  1. package/build/adapter-node.js +1 -1
  2. package/build/client/_app/immutable/chunks/B58dPMPq.js +1 -0
  3. package/build/client/_app/immutable/chunks/B58dPMPq.js.br +1 -0
  4. package/build/client/_app/immutable/chunks/B58dPMPq.js.gz +0 -0
  5. package/build/client/_app/immutable/chunks/{C6zhj8Tc.js → DtmN00GS.js} +3 -3
  6. package/build/client/_app/immutable/chunks/DtmN00GS.js.br +0 -0
  7. package/build/client/_app/immutable/chunks/{C6zhj8Tc.js.gz → DtmN00GS.js.gz} +0 -0
  8. package/build/client/_app/immutable/entry/{app.C2KpbBu3.js → app.Dl3HM1mx.js} +2 -2
  9. package/build/client/_app/immutable/entry/app.Dl3HM1mx.js.br +0 -0
  10. package/build/client/_app/immutable/entry/app.Dl3HM1mx.js.gz +0 -0
  11. package/build/client/_app/immutable/nodes/21.BZJQikE5.js +1 -0
  12. package/build/client/_app/immutable/nodes/21.BZJQikE5.js.br +0 -0
  13. package/build/client/_app/immutable/nodes/21.BZJQikE5.js.gz +0 -0
  14. package/build/client/_app/version.json +1 -1
  15. package/build/client/_app/version.json.br +0 -0
  16. package/build/client/_app/version.json.gz +0 -0
  17. package/build/server/.vite/manifest.json +228 -187
  18. package/build/server/chunks/AppHeader.js +1 -1
  19. package/build/server/chunks/Callout.js +1 -1
  20. package/build/server/chunks/ConfirmDialog.js +1 -1
  21. package/build/server/chunks/DataTable.js +1 -1
  22. package/build/server/chunks/DefinitionCard.js +2 -2
  23. package/build/server/chunks/EmptyState.js +1 -1
  24. package/build/server/chunks/ErrorScreen.js +1 -1
  25. package/build/server/chunks/FilterableDropdown.js +1 -1
  26. package/build/server/chunks/PageContent.js +1 -1
  27. package/build/server/chunks/SectionHeader.js +1 -1
  28. package/build/server/chunks/SettingsMenu.js +1 -1
  29. package/build/server/chunks/SideNav.js +1 -1
  30. package/build/server/chunks/StatCard.js +1 -1
  31. package/build/server/chunks/UserAvatar.js +1 -1
  32. package/build/server/chunks/UserRowIdentity.js +1 -1
  33. package/build/server/chunks/activity.js +1 -1
  34. package/build/server/chunks/alert-dialog.js +1 -1
  35. package/build/server/chunks/arrow-left.js +1 -1
  36. package/build/server/chunks/arrow-right.js +1 -1
  37. package/build/server/chunks/{keepalive-DbmLH4v1.js → async-solve-Doflh4BJ.js} +5 -3
  38. package/build/server/chunks/async-solve-Doflh4BJ.js.map +1 -0
  39. package/build/server/chunks/asyncSolves.server.js +22 -0
  40. package/build/server/chunks/asyncSolves.server.js.map +1 -0
  41. package/build/server/chunks/auth-bootstrap.server.js +1 -1
  42. package/build/server/chunks/badge.js +1 -1
  43. package/build/server/chunks/boot.server.js +1 -1
  44. package/build/server/chunks/building-complex.js +1 -1
  45. package/build/server/chunks/button.js +1 -1
  46. package/build/server/chunks/capture.js +1 -1
  47. package/build/server/chunks/card-content.js +1 -1
  48. package/build/server/chunks/card-description.js +1 -1
  49. package/build/server/chunks/card-header.js +1 -1
  50. package/build/server/chunks/card-title.js +1 -1
  51. package/build/server/chunks/chevron-down.js +1 -1
  52. package/build/server/chunks/chevron-left.js +1 -1
  53. package/build/server/chunks/chevron-right.js +1 -1
  54. package/build/server/chunks/chevron-up.js +1 -1
  55. package/build/server/chunks/circle.js +1 -1
  56. package/build/server/chunks/computeRateLimit.server.js +1 -1
  57. package/build/server/chunks/copy.js +1 -1
  58. package/build/server/chunks/create-id.js +1 -1
  59. package/build/server/chunks/delete-with-blobs.js +1 -1
  60. package/build/server/chunks/dialog-description.js +1 -1
  61. package/build/server/chunks/dialog.js +1 -1
  62. package/build/server/chunks/dom-typeahead.svelte.js +1 -1
  63. package/build/server/chunks/dynamic-value-list.js +301 -0
  64. package/build/server/chunks/dynamic-value-list.js.map +1 -0
  65. package/build/server/chunks/engine.server.js +2 -1
  66. package/build/server/chunks/engine.server.js.map +1 -1
  67. package/build/server/chunks/events.js +1 -1
  68. package/build/server/chunks/external-link.js +1 -1
  69. package/build/server/chunks/folder-kanban.js +1 -1
  70. package/build/server/chunks/folder-open.js +1 -1
  71. package/build/server/chunks/folders.js +1 -1
  72. package/build/server/chunks/footerContext.svelte.js +1 -1
  73. package/build/server/chunks/gauge.js +1 -1
  74. package/build/server/chunks/handlers.js +1 -1
  75. package/build/server/chunks/index-server2.js +1 -1
  76. package/build/server/chunks/input-group.js +1 -1
  77. package/build/server/chunks/input.js +1 -1
  78. package/build/server/chunks/instance.js +4 -4
  79. package/build/server/chunks/instanceAdmins.server.js +1 -1
  80. package/build/server/chunks/internal.js +1 -1
  81. package/build/server/chunks/key-round.js +1 -1
  82. package/build/server/chunks/label.js +1 -1
  83. package/build/server/chunks/link-2.js +1 -1
  84. package/build/server/chunks/localeContext.svelte.js +1 -1
  85. package/build/server/chunks/mail.js +1 -1
  86. package/build/server/chunks/minus.js +1 -1
  87. package/build/server/chunks/package.js +2 -2
  88. package/build/server/chunks/package.js.map +1 -1
  89. package/build/server/chunks/permissions.server.js +1 -1
  90. package/build/server/chunks/plus.js +1 -1
  91. package/build/server/chunks/popper-layer-force-mount.js +1 -1
  92. package/build/server/chunks/providers.server.js +3 -28134
  93. package/build/server/chunks/providers.server.js.map +1 -1
  94. package/build/server/chunks/refresh-cw.js +1 -1
  95. package/build/server/chunks/registry.js +22 -0
  96. package/build/server/chunks/registry.js.map +1 -1
  97. package/build/server/chunks/rotate-ccw.js +1 -1
  98. package/build/server/chunks/roving-focus-group.js +1 -1
  99. package/build/server/chunks/scroll-lock.js +1 -1
  100. package/build/server/chunks/scroll-text.js +1 -1
  101. package/build/server/chunks/search.js +1 -1
  102. package/build/server/chunks/search2.js +1 -1
  103. package/build/server/chunks/select.js +1 -1
  104. package/build/server/chunks/separator.js +1 -1
  105. package/build/server/chunks/server-config-write.js +1 -1
  106. package/build/server/chunks/server.js +28298 -5
  107. package/build/server/chunks/server.js.map +1 -1
  108. package/build/server/chunks/server2.js +5 -107
  109. package/build/server/chunks/server2.js.map +1 -1
  110. package/build/server/chunks/server3.js +101 -3911
  111. package/build/server/chunks/server3.js.map +1 -1
  112. package/build/server/chunks/server4.js +3916 -41
  113. package/build/server/chunks/server4.js.map +1 -1
  114. package/build/server/chunks/server5.js +45 -0
  115. package/build/server/chunks/server5.js.map +1 -0
  116. package/build/server/chunks/settings.js +1 -1
  117. package/build/server/chunks/severity.js +1 -1
  118. package/build/server/chunks/shield-check.js +1 -1
  119. package/build/server/chunks/shield.js +1 -1
  120. package/build/server/chunks/signInMaxAge.server.js +1 -1
  121. package/build/server/chunks/solve.server.js +4 -3
  122. package/build/server/chunks/solve.server.js.map +1 -1
  123. package/build/server/chunks/star.js +1 -1
  124. package/build/server/chunks/state.js +1 -1
  125. package/build/server/chunks/sveltekit.js +1 -1
  126. package/build/server/chunks/tabs-trigger.js +1 -1
  127. package/build/server/chunks/textarea.js +1 -1
  128. package/build/server/chunks/toast-state.svelte.js +1 -1
  129. package/build/server/chunks/toggle-group-item.js +1 -1
  130. package/build/server/chunks/trash.js +1 -1
  131. package/build/server/chunks/user-plus.js +1 -1
  132. package/build/server/chunks/users.js +1 -1
  133. package/build/server/chunks/utils.js +1 -1
  134. package/build/server/chunks/x.js +1 -1
  135. package/build/server/entries/endpoints/.well-known/oauth-authorization-server/_server.ts.js +1 -1
  136. package/build/server/entries/endpoints/.well-known/oauth-protected-resource/_server.ts.js +1 -1
  137. package/build/server/entries/endpoints/.well-known/oauth-protected-resource/mcp/_server.ts.js +1 -1
  138. package/build/server/entries/endpoints/api/admin/compute/_server.ts.js +1 -1
  139. package/build/server/entries/endpoints/api/admin/compute/actions/_server.ts.js +1 -1
  140. package/build/server/entries/endpoints/api/admin/compute/status/_server.ts.js +1 -1
  141. package/build/server/entries/endpoints/api/admin/orgs/_id_/_server.ts.js +1 -1
  142. package/build/server/entries/endpoints/api/admin/orgs/_server.ts.js +1 -1
  143. package/build/server/entries/endpoints/api/admin/projects/_id_/_server.ts.js +1 -1
  144. package/build/server/entries/endpoints/api/admin/projects/_id_/grants/_grantId_/_server.ts.js +1 -1
  145. package/build/server/entries/endpoints/api/admin/projects/_id_/grants/_server.ts.js +1 -1
  146. package/build/server/entries/endpoints/api/admin/projects/_server.ts.js +1 -1
  147. package/build/server/entries/endpoints/api/admin/system/health/_server.ts.js +1 -1
  148. package/build/server/entries/endpoints/api/admin/system/update/_server.ts.js +1 -1
  149. package/build/server/entries/endpoints/api/admin/users/_id_/_server.ts.js +1 -1
  150. package/build/server/entries/endpoints/api/admin/users/_id_/disable/_server.ts.js +1 -1
  151. package/build/server/entries/endpoints/api/admin/users/_server.ts.js +1 -1
  152. package/build/server/entries/endpoints/api/files/_...path_/_server.ts.js +1 -1
  153. package/build/server/entries/endpoints/api/v1/compute/_server.ts.js +8 -4
  154. package/build/server/entries/endpoints/api/v1/compute/_server.ts.js.map +1 -1
  155. package/build/server/entries/endpoints/api/v1/definitions/_guid_/solve/_server.ts.js +12 -3
  156. package/build/server/entries/endpoints/api/v1/definitions/_guid_/solve/_server.ts.js.map +1 -1
  157. package/build/server/entries/endpoints/api/v1/solves/_solveId_/_server.ts.js +32 -0
  158. package/build/server/entries/endpoints/api/v1/solves/_solveId_/_server.ts.js.map +1 -0
  159. package/build/server/entries/endpoints/auth/email/callback/_server.ts.js +1 -1
  160. package/build/server/entries/endpoints/auth/supabase/callback/_server.ts.js +1 -1
  161. package/build/server/entries/endpoints/auth/supabase/start/_server.ts.js +1 -1
  162. package/build/server/entries/endpoints/docs/api/openapi.yaml/_server.ts.js +1 -1
  163. package/build/server/entries/endpoints/mcp/_server.ts.js +244 -41
  164. package/build/server/entries/endpoints/mcp/_server.ts.js.map +1 -1
  165. package/build/server/entries/endpoints/oauth/register/_server.ts.js +1 -1
  166. package/build/server/entries/endpoints/oauth/token/_server.ts.js +1 -1
  167. package/build/server/entries/hooks.server.js +2 -1
  168. package/build/server/entries/hooks.server.js.map +1 -1
  169. package/build/server/entries/pages/_error.svelte.js +1 -1
  170. package/build/server/entries/pages/_layout.svelte.js +1 -1
  171. package/build/server/entries/pages/_page.svelte.js +1 -1
  172. package/build/server/entries/pages/accept-invite/_page.svelte.js +1 -1
  173. package/build/server/entries/pages/admin/_error.svelte.js +1 -1
  174. package/build/server/entries/pages/admin/_layout.svelte.js +2 -2
  175. package/build/server/entries/pages/admin/_page.svelte.js +2 -2
  176. package/build/server/entries/pages/admin/audit/_page.svelte.js +1 -1
  177. package/build/server/entries/pages/admin/compute/_page.svelte.js +2 -2
  178. package/build/server/entries/pages/admin/organizations/_page.svelte.js +1 -1
  179. package/build/server/entries/pages/admin/projects/_id_/_page.svelte.js +1 -1
  180. package/build/server/entries/pages/admin/projects/_page.svelte.js +1 -1
  181. package/build/server/entries/pages/admin/system/_page.server.ts.js +1 -1
  182. package/build/server/entries/pages/admin/system/_page.svelte.js +1 -1
  183. package/build/server/entries/pages/admin/users/_page.svelte.js +1 -1
  184. package/build/server/entries/pages/auth/email/sent/_page.svelte.js +1 -1
  185. package/build/server/entries/pages/auth/email/start/_page.svelte.js +1 -1
  186. package/build/server/entries/pages/docs/api/_page.svelte.js +1 -1
  187. package/build/server/entries/pages/library/_guid_/_page.server.ts.js +1 -1
  188. package/build/server/entries/pages/library/_guid_/_page.svelte.js +71 -305
  189. package/build/server/entries/pages/library/_guid_/_page.svelte.js.map +1 -1
  190. package/build/server/entries/pages/library/_layout.svelte.js +1 -1
  191. package/build/server/entries/pages/library/_page.svelte.js +1 -1
  192. package/build/server/entries/pages/login/_page.svelte.js +1 -1
  193. package/build/server/entries/pages/oauth/authorize/_page.server.ts.js +1 -1
  194. package/build/server/entries/pages/oauth/authorize/_page.svelte.js +1 -1
  195. package/build/server/entries/pages/projects/_layout.svelte.js +1 -1
  196. package/build/server/entries/pages/projects/_page.server.ts.js +1 -1
  197. package/build/server/entries/pages/projects/_page.svelte.js +1 -1
  198. package/build/server/entries/pages/setup/_page.server.ts.js +1 -1
  199. package/build/server/entries/pages/setup/_page.svelte.js +1 -1
  200. package/build/server/entries/pages/team/_layout.svelte.js +2 -2
  201. package/build/server/entries/pages/team/_page.svelte.js +1 -1
  202. package/build/server/entries/pages/team/activity/_page.svelte.js +1 -1
  203. package/build/server/entries/pages/team/compute/_page.svelte.js +2 -2
  204. package/build/server/entries/pages/team/members/_page.svelte.js +1 -1
  205. package/build/server/entries/pages/team/projects/_page.server.ts.js +1 -1
  206. package/build/server/entries/pages/team/projects/_page.svelte.js +1 -1
  207. package/build/server/entries/pages/team/reclaim/_page.svelte.js +1 -1
  208. package/build/server/entries/pages/team/settings/_page.svelte.js +1 -1
  209. package/build/server/entries/pages/team/shares/_page.svelte.js +1 -1
  210. package/build/server/entries/pages/team/tokens/_page.svelte.js +1 -1
  211. package/build/server/index.js +1 -1
  212. package/build/server/manifest-full.js +8 -1
  213. package/build/server/manifest.js +8 -1
  214. package/build/server/nodes/21.js +1 -1
  215. package/build/server/remote-entry.js +1 -1
  216. package/build/server/server.js +8 -1
  217. package/package.json +8 -8
  218. package/templates/.env.example +5 -3
  219. package/build/client/_app/immutable/chunks/C36Kxzt3.js +0 -1
  220. package/build/client/_app/immutable/chunks/C36Kxzt3.js.br +0 -1
  221. package/build/client/_app/immutable/chunks/C36Kxzt3.js.gz +0 -0
  222. package/build/client/_app/immutable/chunks/C6zhj8Tc.js.br +0 -0
  223. package/build/client/_app/immutable/entry/app.C2KpbBu3.js.br +0 -0
  224. package/build/client/_app/immutable/entry/app.C2KpbBu3.js.gz +0 -0
  225. package/build/client/_app/immutable/nodes/21.C3YDbmsU.js +0 -1
  226. package/build/client/_app/immutable/nodes/21.C3YDbmsU.js.br +0 -0
  227. package/build/client/_app/immutable/nodes/21.C3YDbmsU.js.gz +0 -0
  228. package/build/server/chunks/keepalive-DbmLH4v1.js.map +0 -1
@@ -1,45 +1,3920 @@
1
- import { d as spread_props } from "./server3.js";
2
- import { n as Icon } from "./utils.js";
3
- // ../../node_modules/.pnpm/@lucide+svelte@1.66.0_svelte@5.57.3_@typescript-eslint+types@8.72.1_/node_modules/@lucide/svelte/dist/icons/server.svelte
4
- var __iconData = {
5
- "name": "server",
6
- "size": 24,
7
- "node": [
8
- ["rect", {
9
- "width": "20",
10
- "height": "8",
11
- "x": "2",
12
- "y": "2",
13
- "rx": "2",
14
- "ry": "2"
15
- }],
16
- ["rect", {
17
- "width": "20",
18
- "height": "8",
19
- "x": "2",
20
- "y": "14",
21
- "rx": "2",
22
- "ry": "2"
23
- }],
24
- ["line", {
25
- "x1": "6",
26
- "x2": "6.01",
27
- "y1": "6",
28
- "y2": "6"
29
- }],
30
- ["line", {
31
- "x1": "6",
32
- "x2": "6.01",
33
- "y1": "18",
34
- "y2": "18"
35
- }]
36
- ]
1
+ import { t as uneval } from "./uneval.js";
2
+ import { clsx } from "clsx";
3
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/constants.js
4
+ var HYDRATION_ERROR = {};
5
+ var UNINITIALIZED = Symbol("uninitialized");
6
+ var ATTACHMENT_KEY = "@attach";
7
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/escaping.js
8
+ var ATTR_REGEX = /[&"<]/g;
9
+ var CONTENT_REGEX = /[&<]/g;
10
+ /**
11
+ * @template V
12
+ * @param {V} value
13
+ * @param {boolean} [is_attr]
14
+ */
15
+ function escape_html(value, is_attr) {
16
+ const str = String(value ?? "");
17
+ const pattern = is_attr ? ATTR_REGEX : CONTENT_REGEX;
18
+ pattern.lastIndex = 0;
19
+ let escaped = "";
20
+ let last = 0;
21
+ while (pattern.test(str)) {
22
+ const i = pattern.lastIndex - 1;
23
+ const ch = str[i];
24
+ escaped += str.substring(last, i) + (ch === "&" ? "&amp;" : ch === "\"" ? "&quot;" : "&lt;");
25
+ last = i + 1;
26
+ }
27
+ return escaped + str.substring(last);
28
+ }
29
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/shared/utils.js
30
+ var is_array = Array.isArray;
31
+ var index_of = Array.prototype.indexOf;
32
+ var includes = Array.prototype.includes;
33
+ var array_from = Array.from;
34
+ var object_keys = Object.keys;
35
+ var define_property = Object.defineProperty;
36
+ var get_descriptor = Object.getOwnPropertyDescriptor;
37
+ var object_prototype = Object.prototype;
38
+ var array_prototype = Array.prototype;
39
+ var get_prototype_of = Object.getPrototypeOf;
40
+ var is_extensible = Object.isExtensible;
41
+ var has_own_property = Object.prototype.hasOwnProperty;
42
+ var noop = () => {};
43
+ /** @param {Function} fn */
44
+ function run(fn) {
45
+ return fn();
46
+ }
47
+ /** @param {Array<() => void>} arr */
48
+ function run_all(arr) {
49
+ for (var i = 0; i < arr.length; i++) arr[i]();
50
+ }
51
+ /**
52
+ * TODO replace with Promise.withResolvers once supported widely enough
53
+ * @template [T=void]
54
+ */
55
+ function deferred() {
56
+ /** @type {(value: T) => void} */
57
+ var resolve;
58
+ /** @type {(reason: any) => void} */
59
+ var reject;
60
+ return {
61
+ promise: new Promise((res, rej) => {
62
+ resolve = res;
63
+ reject = rej;
64
+ }),
65
+ resolve,
66
+ reject
67
+ };
68
+ }
69
+ /**
70
+ * @template V
71
+ * @param {V} value
72
+ * @param {V | (() => V)} fallback
73
+ * @param {boolean} [lazy]
74
+ * @returns {V}
75
+ */
76
+ function fallback(value, fallback, lazy = false) {
77
+ return value === void 0 ? lazy ? fallback() : fallback : value;
78
+ }
79
+ /**
80
+ * When encountering a situation like `let [a, b, c] = $derived(blah())`,
81
+ * we need to stash an intermediate value that `a`, `b`, and `c` derive
82
+ * from, in case it's an iterable
83
+ * @template T
84
+ * @param {ArrayLike<T> | Iterable<T>} value
85
+ * @param {number} [n]
86
+ * @returns {Array<T>}
87
+ */
88
+ function to_array(value, n) {
89
+ if (Array.isArray(value)) return value;
90
+ if (n === void 0 || !(Symbol.iterator in value)) return Array.from(value);
91
+ /** @type {T[]} */
92
+ const array = [];
93
+ for (const element of value) {
94
+ array.push(element);
95
+ if (array.length === n) break;
96
+ }
97
+ return array;
98
+ }
99
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/shared/attributes.js
100
+ /**
101
+ * `<div translate={false}>` should be rendered as `<div translate="no">` and _not_
102
+ * `<div translate="false">`, which is equivalent to `<div translate="yes">`. There
103
+ * may be other odd cases that need to be added to this list in future
104
+ * @type {Record<string, Map<any, string>>}
105
+ */
106
+ var replacements = { translate: /* @__PURE__ */ new Map([[true, "yes"], [false, "no"]]) };
107
+ /**
108
+ * @template V
109
+ * @param {string} name
110
+ * @param {V} value
111
+ * @param {boolean} [is_boolean]
112
+ * @returns {string}
113
+ */
114
+ function attr(name, value, is_boolean = false) {
115
+ if (name === "hidden" && value !== "until-found") is_boolean = true;
116
+ if (value == null || is_boolean && !value && value !== "") return "";
117
+ const normalized = has_own_property.call(replacements, name) && replacements[name].get(value) || value;
118
+ return ` ${name}${is_boolean ? `=""` : `="${escape_html(normalized, true)}"`}`;
119
+ }
120
+ /**
121
+ * Small wrapper around clsx to preserve Svelte's (weird) handling of falsy values.
122
+ * TODO Svelte 6 revisit this, and likely turn all falsy values into the empty string (what clsx also does)
123
+ * @param {any} value
124
+ */
125
+ function clsx$1(value) {
126
+ if (typeof value === "object") return clsx(value);
127
+ else return value ?? "";
128
+ }
129
+ var whitespace = [..." \n\r\f\xA0\v"];
130
+ /**
131
+ * @param {any} value
132
+ * @param {string | null} [hash]
133
+ * @param {Record<string, boolean>} [directives]
134
+ * @returns {string | null}
135
+ */
136
+ function to_class(value, hash, directives) {
137
+ var classname = value == null ? "" : "" + value;
138
+ if (hash) classname = classname ? classname + " " + hash : hash;
139
+ if (directives) {
140
+ for (var key of Object.keys(directives)) if (directives[key]) classname = classname ? classname + " " + key : key;
141
+ else if (classname.length) {
142
+ var len = key.length;
143
+ var a = 0;
144
+ while ((a = classname.indexOf(key, a)) >= 0) {
145
+ var b = a + len;
146
+ if ((a === 0 || whitespace.includes(classname[a - 1])) && (b === classname.length || whitespace.includes(classname[b]))) classname = (a === 0 ? "" : classname.substring(0, a)) + classname.substring(b + 1);
147
+ else a = b;
148
+ }
149
+ }
150
+ }
151
+ return classname === "" ? null : classname;
152
+ }
153
+ /**
154
+ *
155
+ * @param {Record<string,any>} styles
156
+ * @param {boolean} important
157
+ */
158
+ function append_styles(styles, important = false) {
159
+ var separator = important ? " !important;" : ";";
160
+ var css = "";
161
+ for (var key of Object.keys(styles)) {
162
+ var value = styles[key];
163
+ if (value != null && value !== "") css += " " + key + ": " + value + separator;
164
+ }
165
+ return css;
166
+ }
167
+ /**
168
+ * @param {string} name
169
+ * @returns {string}
170
+ */
171
+ function to_css_name(name) {
172
+ if (name[0] !== "-" || name[1] !== "-") return name.toLowerCase();
173
+ return name;
174
+ }
175
+ /**
176
+ * @param {any} value
177
+ * @param {Record<string, any> | [Record<string, any>, Record<string, any>]} [styles]
178
+ * @returns {string | null}
179
+ */
180
+ function to_style(value, styles) {
181
+ if (styles) {
182
+ var new_style = "";
183
+ /** @type {Record<string,any> | undefined} */
184
+ var normal_styles;
185
+ /** @type {Record<string,any> | undefined} */
186
+ var important_styles;
187
+ if (Array.isArray(styles)) {
188
+ normal_styles = styles[0];
189
+ important_styles = styles[1];
190
+ } else normal_styles = styles;
191
+ if (value) {
192
+ value = String(value).replaceAll(/\/\*.*?\*\//g, "").trim();
193
+ /** @type {boolean | '"' | "'"} */
194
+ var in_str = false;
195
+ var in_apo = 0;
196
+ var in_comment = false;
197
+ var reserved_names = [];
198
+ if (normal_styles) reserved_names.push(...Object.keys(normal_styles).map(to_css_name));
199
+ if (important_styles) reserved_names.push(...Object.keys(important_styles).map(to_css_name));
200
+ var start_index = 0;
201
+ var name_index = -1;
202
+ const len = value.length;
203
+ for (var i = 0; i < len; i++) {
204
+ var c = value[i];
205
+ if (in_comment) {
206
+ if (c === "/" && value[i - 1] === "*") in_comment = false;
207
+ } else if (in_str) {
208
+ if (in_str === c) in_str = false;
209
+ } else if (c === "/" && value[i + 1] === "*") in_comment = true;
210
+ else if (c === "\"" || c === "'") in_str = c;
211
+ else if (c === "(") in_apo++;
212
+ else if (c === ")") in_apo--;
213
+ if (!in_comment && in_str === false && in_apo === 0) {
214
+ if (c === ":" && name_index === -1) name_index = i;
215
+ else if (c === ";" || i === len - 1) {
216
+ if (name_index !== -1) {
217
+ var name = to_css_name(value.substring(start_index, name_index).trim());
218
+ if (!reserved_names.includes(name)) {
219
+ if (c !== ";") i++;
220
+ var property = value.substring(start_index, i).trim();
221
+ new_style += " " + property + ";";
222
+ }
223
+ }
224
+ start_index = i + 1;
225
+ name_index = -1;
226
+ }
227
+ }
228
+ }
229
+ }
230
+ if (normal_styles) new_style += append_styles(normal_styles);
231
+ if (important_styles) new_style += append_styles(important_styles, true);
232
+ new_style = new_style.trim();
233
+ return new_style === "" ? null : new_style;
234
+ }
235
+ return value == null ? null : String(value);
236
+ }
237
+ var CLEAN = 1024;
238
+ var DIRTY = 2048;
239
+ var MAYBE_DIRTY = 4096;
240
+ var INERT = 8192;
241
+ var DESTROYED = 16384;
242
+ /** Set once a reaction has run for the first time */
243
+ var REACTION_RAN = 32768;
244
+ /** Effect is in the process of getting destroyed. Can be observed in child teardown functions */
245
+ var DESTROYING = 1 << 25;
246
+ /**
247
+ * 'Transparent' effects do not create a transition boundary.
248
+ * This is on a block effect 99% of the time but may also be on a branch effect if its parent block effect was pruned
249
+ */
250
+ var EFFECT_TRANSPARENT = 65536;
251
+ var EFFECT_PRESERVED = 1 << 19;
252
+ var USER_EFFECT = 1 << 20;
253
+ var REACTION_IS_UPDATING = 1 << 21;
254
+ var ERROR_VALUE = 1 << 23;
255
+ var STATE_SYMBOL = Symbol("$state");
256
+ /** Marks component export objects, so that `proxy(...)` leaves them untouched */
257
+ var COMPONENT_SYMBOL = Symbol("component");
258
+ var LEGACY_PROPS = Symbol("legacy props");
259
+ var PROXY_PATH_SYMBOL = Symbol("proxy path");
260
+ var ATTRIBUTES_CACHE = Symbol("attributes");
261
+ var CLASS_CACHE = Symbol("class");
262
+ var STYLE_CACHE = Symbol("style");
263
+ var TEXT_CACHE = Symbol("text");
264
+ /** allow users to ignore aborted signal errors if `reason.name === 'StaleReactionError` */
265
+ var STALE_REACTION = new class StaleReactionError extends Error {
266
+ name = "StaleReactionError";
267
+ message = "The reaction that called `getAbortSignal()` was re-run or destroyed";
268
+ }();
269
+ globalThis.document?.contentType;
270
+ /**
271
+ * Reading a derived belonging to a now-destroyed effect may result in stale values
272
+ */
273
+ function derived_inert() {
274
+ console.warn(`https://svelte.dev/e/derived_inert`);
275
+ }
276
+ /**
277
+ * Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near %location%
278
+ * @param {string | undefined | null} [location]
279
+ */
280
+ function hydration_mismatch(location) {
281
+ console.warn(`https://svelte.dev/e/hydration_mismatch`);
282
+ }
283
+ /**
284
+ * Tried to unmount a component that was not mounted
285
+ */
286
+ function lifecycle_double_unmount() {
287
+ console.warn(`https://svelte.dev/e/lifecycle_double_unmount`);
288
+ }
289
+ /**
290
+ * A `<svelte:boundary>` `reset` function only resets the boundary the first time it is called
291
+ */
292
+ function svelte_boundary_reset_noop() {
293
+ console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`);
294
+ }
295
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/client/dom/hydration.js
296
+ /** @import { TemplateNode } from '#client' */
297
+ /**
298
+ * Use this variable to guard everything related to hydration code so it can be treeshaken out
299
+ * if the user doesn't use the `hydrate` method and these code paths are therefore not needed.
300
+ */
301
+ var hydrating = false;
302
+ /** @param {boolean} value */
303
+ function set_hydrating(value) {
304
+ hydrating = value;
305
+ }
306
+ /**
307
+ * The node that is currently being hydrated. This starts out as the first node inside the opening
308
+ * <!--[--> comment, and updates each time a component calls `$.child(...)` or `$.sibling(...)`.
309
+ * When entering a block (e.g. `{#if ...}`), `hydrate_node` is the block opening comment; by the
310
+ * time we leave the block it is the closing comment, which serves as the block's anchor.
311
+ * @type {TemplateNode}
312
+ */
313
+ var hydrate_node;
314
+ /** @param {TemplateNode | null} node */
315
+ function set_hydrate_node(node) {
316
+ if (node === null) {
317
+ hydration_mismatch();
318
+ throw HYDRATION_ERROR;
319
+ }
320
+ return hydrate_node = node;
321
+ }
322
+ function hydrate_next() {
323
+ return set_hydrate_node(/* @__PURE__ */ get_next_sibling(hydrate_node));
324
+ }
325
+ function next(count = 1) {
326
+ if (hydrating) {
327
+ var i = count;
328
+ var node = hydrate_node;
329
+ while (i--) node = /* @__PURE__ */ get_next_sibling(node);
330
+ hydrate_node = node;
331
+ }
332
+ }
333
+ /**
334
+ * Skips or removes (depending on {@link remove}) all nodes starting at `hydrate_node` up until the next hydration end comment
335
+ * @param {boolean} remove
336
+ */
337
+ function skip_nodes(remove = true) {
338
+ var depth = 0;
339
+ var node = hydrate_node;
340
+ while (true) {
341
+ if (node.nodeType === 8) {
342
+ var data = node.data;
343
+ if (data === "]") {
344
+ if (depth === 0) return node;
345
+ depth -= 1;
346
+ } else if (data === "[" || data === "[!" || data[0] === "[" && !isNaN(Number(data.slice(1)))) depth += 1;
347
+ }
348
+ var next = /* @__PURE__ */ get_next_sibling(node);
349
+ if (remove) node.remove();
350
+ node = next;
351
+ }
352
+ }
353
+ /**
354
+ *
355
+ * @param {TemplateNode} node
356
+ */
357
+ function read_hydration_instruction(node) {
358
+ if (!node || node.nodeType !== 8) {
359
+ hydration_mismatch();
360
+ throw HYDRATION_ERROR;
361
+ }
362
+ return node.data;
363
+ }
364
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/client/reactivity/equality.js
365
+ /** @import { Equals } from '#client' */
366
+ /** @type {Equals} */
367
+ function equals(value) {
368
+ return value === this.v;
369
+ }
370
+ /**
371
+ * @param {unknown} a
372
+ * @param {unknown} b
373
+ * @returns {boolean}
374
+ */
375
+ function safe_not_equal(a, b) {
376
+ return a != a ? b == b : a !== b || a !== null && typeof a === "object" || typeof a === "function";
377
+ }
378
+ /** @type {Equals} */
379
+ function safe_equals(value) {
380
+ return !safe_not_equal(value, this.v);
381
+ }
382
+ /**
383
+ * `%name%(...)` can only be used during component initialisation
384
+ * @param {string} name
385
+ * @returns {never}
386
+ */
387
+ function lifecycle_outside_component(name) {
388
+ throw new Error(`https://svelte.dev/e/lifecycle_outside_component`);
389
+ }
390
+ /**
391
+ * `setContext` must be called when a component first initializes, not in a subsequent effect or after an `await` expression
392
+ * @returns {never}
393
+ */
394
+ function set_context_after_init() {
395
+ throw new Error(`https://svelte.dev/e/set_context_after_init`);
396
+ }
397
+ /**
398
+ * Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state
399
+ * @returns {never}
400
+ */
401
+ function effect_update_depth_exceeded() {
402
+ throw new Error(`https://svelte.dev/e/effect_update_depth_exceeded`);
403
+ }
404
+ /**
405
+ * Failed to hydrate the application
406
+ * @returns {never}
407
+ */
408
+ function hydration_failed() {
409
+ throw new Error(`https://svelte.dev/e/hydration_failed`);
410
+ }
411
+ /**
412
+ * The `%rune%` rune is only available inside `.svelte` and `.svelte.js/ts` files
413
+ * @param {string} rune
414
+ * @returns {never}
415
+ */
416
+ function rune_outside_svelte(rune) {
417
+ throw new Error(`https://svelte.dev/e/rune_outside_svelte`);
418
+ }
419
+ /**
420
+ * Property descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.
421
+ * @returns {never}
422
+ */
423
+ function state_descriptors_fixed() {
424
+ throw new Error(`https://svelte.dev/e/state_descriptors_fixed`);
425
+ }
426
+ /**
427
+ * Cannot set prototype of `$state` object
428
+ * @returns {never}
429
+ */
430
+ function state_prototype_fixed() {
431
+ throw new Error(`https://svelte.dev/e/state_prototype_fixed`);
432
+ }
433
+ /**
434
+ * Updating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`
435
+ * @returns {never}
436
+ */
437
+ function state_unsafe_mutation() {
438
+ throw new Error(`https://svelte.dev/e/state_unsafe_mutation`);
439
+ }
440
+ /**
441
+ * A `<svelte:boundary>` `reset` function cannot be called while an error is still being handled
442
+ * @returns {never}
443
+ */
444
+ function svelte_boundary_reset_onerror() {
445
+ throw new Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`);
446
+ }
447
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/flags/index.js
448
+ /** True if experimental.async=true */
449
+ var async_mode_flag = false;
450
+ /** True if we're not certain that we only have Svelte 5 code in the compilation */
451
+ var legacy_mode_flag = false;
452
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/shared/clone.js
453
+ /** @import { Snapshot } from './types' */
454
+ /**
455
+ * In dev, we keep track of which properties could not be cloned. In prod
456
+ * we don't bother, but we keep a dummy array around so that the
457
+ * signature stays the same
458
+ * @type {string[]}
459
+ */
460
+ var empty = [];
461
+ /**
462
+ * @template T
463
+ * @param {T} value
464
+ * @param {boolean} [skip_warning]
465
+ * @param {boolean} [no_tojson]
466
+ * @returns {Snapshot<T>}
467
+ */
468
+ function snapshot(value, skip_warning = false, no_tojson = false) {
469
+ return clone(value, /* @__PURE__ */ new Map(), "", empty, null, no_tojson);
470
+ }
471
+ /**
472
+ * @template T
473
+ * @param {T} value
474
+ * @param {Map<T, Snapshot<T>>} cloned
475
+ * @param {string} path
476
+ * @param {string[]} paths
477
+ * @param {null | T} [original] The original value, if `value` was produced from a `toJSON` call
478
+ * @param {boolean} [no_tojson]
479
+ * @returns {Snapshot<T>}
480
+ */
481
+ function clone(value, cloned, path, paths, original = null, no_tojson = false) {
482
+ if (typeof value === "object" && value !== null) {
483
+ var unwrapped = cloned.get(value);
484
+ if (unwrapped !== void 0) return unwrapped;
485
+ if (value instanceof Map) return new Map(value);
486
+ if (value instanceof Set) return new Set(value);
487
+ if (is_array(value)) {
488
+ var copy = Array(value.length);
489
+ cloned.set(value, copy);
490
+ if (original !== null) cloned.set(original, copy);
491
+ for (var i = 0; i < value.length; i += 1) {
492
+ var element = value[i];
493
+ if (i in value) copy[i] = clone(element, cloned, path, paths, null, no_tojson);
494
+ }
495
+ return copy;
496
+ }
497
+ if (get_prototype_of(value) === object_prototype) {
498
+ /** @type {Snapshot<any>} */
499
+ copy = {};
500
+ cloned.set(value, copy);
501
+ if (original !== null) cloned.set(original, copy);
502
+ for (var key of Object.keys(value)) copy[key] = clone(value[key], cloned, path, paths, null, no_tojson);
503
+ return copy;
504
+ }
505
+ if (value instanceof Date) {
506
+ value.getTime();
507
+ return structuredClone(value);
508
+ }
509
+ if (typeof value.toJSON === "function" && !no_tojson) return clone(
510
+ /** @type {T & { toJSON(): any } } */
511
+ value.toJSON(),
512
+ cloned,
513
+ path,
514
+ paths,
515
+ value
516
+ );
517
+ }
518
+ if (value instanceof EventTarget) return value;
519
+ try {
520
+ return structuredClone(value);
521
+ } catch (e) {
522
+ return value;
523
+ }
524
+ }
525
+ /**
526
+ * @template {Value} T
527
+ * @param {T} source
528
+ * @param {string} label
529
+ * @returns {T}
530
+ */
531
+ function tag(source, label) {
532
+ source.label = label;
533
+ tag_proxy(source.v, label);
534
+ return source;
535
+ }
536
+ /**
537
+ * @param {unknown} value
538
+ * @param {string} label
539
+ */
540
+ function tag_proxy(value, label) {
541
+ value?.[PROXY_PATH_SYMBOL]?.(label);
542
+ return value;
543
+ }
544
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/shared/context.js
545
+ /**
546
+ * @typedef {{ p: Context | null, c: Map<unknown, unknown> | null }} Context
547
+ */
548
+ /**
549
+ * @param {Context} context
550
+ * @returns {Map<unknown, unknown> | null}
551
+ */
552
+ function get_parent_context(context) {
553
+ let parent = context.p;
554
+ while (parent !== null && parent.c === null) parent = parent.p;
555
+ return parent?.c ?? null;
556
+ }
557
+ /**
558
+ * @param {Context | null} context
559
+ * @param {string} name
560
+ * @returns {Map<unknown, unknown>}
561
+ */
562
+ function get_or_init_context_map(context, name) {
563
+ if (context === null) lifecycle_outside_component(name);
564
+ return context.c ??= new Map(get_parent_context(context) || void 0);
565
+ }
566
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/client/context.js
567
+ /** @import { ComponentContext, DevStackEntry, Effect } from '#client' */
568
+ /** @type {ComponentContext | null} */
569
+ var component_context = null;
570
+ /** @param {ComponentContext | null} context */
571
+ function set_component_context(context) {
572
+ component_context = context;
573
+ }
574
+ /**
575
+ * @param {Record<string, unknown>} props
576
+ * @param {any} runes
577
+ * @param {Function} [fn]
578
+ * @returns {void}
579
+ */
580
+ function push$1(props, runes = false, fn) {
581
+ component_context = {
582
+ p: component_context,
583
+ i: false,
584
+ c: null,
585
+ e: null,
586
+ s: props,
587
+ x: null,
588
+ r: active_effect,
589
+ l: legacy_mode_flag && !runes ? {
590
+ s: null,
591
+ u: null,
592
+ $: []
593
+ } : null
594
+ };
595
+ }
596
+ /**
597
+ * @template {Record<string, any>} T
598
+ * @param {T} [component]
599
+ * @returns {T}
600
+ */
601
+ function pop$1(component) {
602
+ var context = component_context;
603
+ var effects = context.e;
604
+ if (effects !== null) {
605
+ context.e = null;
606
+ for (var fn of effects) create_user_effect(fn);
607
+ }
608
+ if (component !== void 0) context.x = component;
609
+ context.i = true;
610
+ component_context = context.p;
611
+ return mark_as_component(component);
612
+ }
613
+ /**
614
+ * Add a symbol to the object (or create one if undefined) to mark it as a component so it isn't proxified.
615
+ * @param {any} component
616
+ */
617
+ function mark_as_component(component = {}) {
618
+ define_property(component, COMPONENT_SYMBOL, { value: true });
619
+ return component;
620
+ }
621
+ /** @returns {boolean} */
622
+ function is_runes() {
623
+ return !legacy_mode_flag || component_context !== null && component_context.l === null;
624
+ }
625
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/client/dom/task.js
626
+ /** @type {Array<() => void>} */
627
+ var micro_tasks = [];
628
+ function run_micro_tasks() {
629
+ var tasks = micro_tasks;
630
+ micro_tasks = [];
631
+ run_all(tasks);
632
+ }
633
+ /**
634
+ * @param {() => void} fn
635
+ */
636
+ function queue_micro_task(fn) {
637
+ if (micro_tasks.length === 0 && !is_flushing_sync) {
638
+ var tasks = micro_tasks;
639
+ queueMicrotask(() => {
640
+ if (tasks === micro_tasks) run_micro_tasks();
641
+ });
642
+ }
643
+ micro_tasks.push(fn);
644
+ }
645
+ /**
646
+ * Synchronously run any queued tasks.
647
+ */
648
+ function flush_tasks() {
649
+ while (micro_tasks.length > 0) run_micro_tasks();
650
+ }
651
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/client/reactivity/status.js
652
+ /** @import { Derived, Signal } from '#client' */
653
+ var STATUS_MASK = ~(DIRTY | MAYBE_DIRTY | CLEAN);
654
+ /**
655
+ * @param {Signal} signal
656
+ * @param {number} status
657
+ */
658
+ function set_signal_status(signal, status) {
659
+ signal.f = signal.f & STATUS_MASK | status;
660
+ }
661
+ /**
662
+ * Set a derived's status to CLEAN or MAYBE_DIRTY based on its connection state.
663
+ * @param {Derived} derived
664
+ */
665
+ function update_derived_status(derived) {
666
+ if ((derived.f & 512) !== 0 || derived.deps === null) set_signal_status(derived, CLEAN);
667
+ else set_signal_status(derived, MAYBE_DIRTY);
668
+ }
669
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/client/reactivity/utils.js
670
+ /** @import { Effect } from '#client' */
671
+ /**
672
+ * @param {Effect} effect
673
+ * @param {Map<Effect, number>} dirty_reactions
674
+ */
675
+ function defer_effect(effect, dirty_reactions) {
676
+ if ((effect.f & 2048) !== 0) dirty_reactions.set(effect, DIRTY);
677
+ else if ((effect.f & 4096) !== 0 && dirty_reactions.get(effect) !== 2048) dirty_reactions.set(effect, MAYBE_DIRTY);
678
+ set_signal_status(effect, CLEAN);
679
+ }
680
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js
681
+ /**
682
+ * @template T
683
+ * @param {() => T} fn
684
+ */
685
+ function without_reactive_context(fn) {
686
+ var previous_reaction = active_reaction;
687
+ var previous_effect = active_effect;
688
+ set_active_reaction(null);
689
+ set_active_effect(null);
690
+ try {
691
+ return fn();
692
+ } finally {
693
+ set_active_reaction(previous_reaction);
694
+ set_active_effect(previous_effect);
695
+ }
696
+ }
697
+ var OBSOLETE = Symbol("obsolete");
698
+ /**
699
+ * @param {Derived} derived
700
+ * @returns {void}
701
+ */
702
+ function destroy_derived_effects(derived) {
703
+ var effects = derived.effects;
704
+ if (effects !== null) {
705
+ derived.effects = null;
706
+ for (var i = 0; i < effects.length; i += 1) destroy_effect(effects[i]);
707
+ }
708
+ }
709
+ /**
710
+ * @template T
711
+ * @param {Derived} derived
712
+ * @returns {T}
713
+ */
714
+ function execute_derived(derived) {
715
+ var value;
716
+ var prev_active_effect = active_effect;
717
+ var parent = derived.parent;
718
+ if (!is_destroying_effect && parent !== null && derived.v !== UNINITIALIZED && (parent.f & 24576) !== 0) {
719
+ derived_inert();
720
+ return derived.v;
721
+ }
722
+ set_active_effect(parent);
723
+ try {
724
+ destroy_derived_effects(derived);
725
+ value = update_reaction(derived);
726
+ } finally {
727
+ set_active_effect(prev_active_effect);
728
+ }
729
+ return value;
730
+ }
731
+ /**
732
+ * @param {Derived} derived
733
+ * @returns {void}
734
+ */
735
+ function update_derived(derived) {
736
+ var value = execute_derived(derived);
737
+ if (!derived.equals(value)) {
738
+ derived.wv = increment_write_version();
739
+ if (!current_batch?.is_fork || derived.deps === null) {
740
+ if (current_batch !== null) {
741
+ current_batch.capture(derived, value, true);
742
+ previous_batch?.capture(derived, value, true);
743
+ } else derived.v = value;
744
+ if (derived.deps === null) {
745
+ set_signal_status(derived, CLEAN);
746
+ return;
747
+ }
748
+ }
749
+ }
750
+ if (is_destroying_effect) return;
751
+ if (batch_values !== null) {
752
+ if (effect_tracking() || current_batch?.is_fork) batch_values.set(derived, value);
753
+ } else update_derived_status(derived);
754
+ }
755
+ /**
756
+ * @param {Derived} derived
757
+ */
758
+ function freeze_derived_effects(derived) {
759
+ if (derived.effects === null) return;
760
+ for (const e of derived.effects) if (e.teardown || e.ac) {
761
+ e.teardown?.();
762
+ if (e.ac !== null) without_reactive_context(() => {
763
+ /** @type {AbortController} */ e.ac.abort(STALE_REACTION);
764
+ e.ac = null;
765
+ });
766
+ if (e.fn !== null) e.teardown = noop;
767
+ remove_reactions(e, 0);
768
+ destroy_effect_children(e);
769
+ }
770
+ }
771
+ /**
772
+ * @param {Derived} derived
773
+ */
774
+ function unfreeze_derived_effects(derived) {
775
+ if (derived.effects === null) return;
776
+ for (const e of derived.effects) if (e.teardown && e.fn !== null) update_effect(e);
777
+ }
778
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/client/reactivity/batch.js
779
+ /** @import { Fork } from 'svelte' */
780
+ /** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
781
+ /** @type {Batch | null} */
782
+ var first_batch = null;
783
+ /** @type {Batch | null} */
784
+ var last_batch = null;
785
+ /** @type {Batch | null} */
786
+ var current_batch = null;
787
+ /**
788
+ * This is needed to avoid overwriting inputs
789
+ * @type {Batch | null}
790
+ */
791
+ var previous_batch = null;
792
+ /**
793
+ * When time travelling (i.e. working in one batch, while other batches
794
+ * still have ongoing work), we ignore the real values of affected
795
+ * signals in favour of their values within the batch
796
+ * @type {Map<Value, any> | null}
797
+ */
798
+ var batch_values = null;
799
+ /** @type {Effect | null} */
800
+ var last_scheduled_effect = null;
801
+ var is_flushing_sync = false;
802
+ var is_processing = false;
803
+ /**
804
+ * During traversal, this is an array. Newly created effects are (if not immediately
805
+ * executed) pushed to this array, rather than going through the scheduling
806
+ * rigamarole that would cause another turn of the flush loop.
807
+ * @type {Effect[] | null}
808
+ */
809
+ var collected_effects = null;
810
+ /**
811
+ * An array of effects that are marked during traversal as a result of a `set`
812
+ * (not `internal_set`) call. These will be added to the next batch and
813
+ * trigger another `batch.process()`
814
+ * @type {Effect[] | null}
815
+ * @deprecated when we get rid of legacy mode and stores, we can get rid of this
816
+ */
817
+ var legacy_updates = null;
818
+ var flush_count = 0;
819
+ var uid = 1;
820
+ var Batch = class Batch {
821
+ id = uid++;
822
+ /** True as soon as `#process` was called */
823
+ started = false;
824
+ linked = true;
825
+ /** @type {Batch | null} */
826
+ prev = null;
827
+ /** @type {Batch | null} */
828
+ next = null;
829
+ /** @type {Map<Effect, ReturnType<typeof deferred<any>>>} */
830
+ async_deriveds = /* @__PURE__ */ new Map();
831
+ /**
832
+ * The current values of any signals that are updated in this batch.
833
+ * Tuple format: [value, is_derived] (note: is_derived is false for deriveds, too, if they were overridden via assignment)
834
+ * The keys of this map are identical to `this.previous`
835
+ * @type {Map<Value, [any, boolean]>}
836
+ */
837
+ current = /* @__PURE__ */ new Map();
838
+ /**
839
+ * The values of any signals (sources and deriveds) that are updated in this batch _before_ those updates took place.
840
+ * The keys of this map are identical to `this.current`
841
+ * @type {Map<Value, any>}
842
+ */
843
+ previous = /* @__PURE__ */ new Map();
844
+ /**
845
+ * When the batch is committed (and the DOM is updated), we need to remove old branches
846
+ * and append new ones by calling the functions added inside (if/each/key/etc) blocks
847
+ * @type {Set<(batch: Batch) => void>}
848
+ */
849
+ #commit_callbacks = /* @__PURE__ */ new Set();
850
+ /**
851
+ * If a fork is discarded, we need to destroy any effects that are no longer needed
852
+ * @type {Set<(batch: Batch) => void>}
853
+ */
854
+ #discard_callbacks = /* @__PURE__ */ new Set();
855
+ /**
856
+ * The number of async effects that are currently in flight
857
+ */
858
+ #pending = 0;
859
+ /**
860
+ * Async effects that are currently in flight, _not_ inside a pending boundary
861
+ * @type {Map<Effect, number>}
862
+ */
863
+ #blocking_pending = /* @__PURE__ */ new Map();
864
+ /**
865
+ * A deferred that resolves when the batch is committed, used with `settled()`
866
+ * TODO replace with Promise.withResolvers once supported widely enough
867
+ * @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}
868
+ */
869
+ #deferred = null;
870
+ /**
871
+ * Effects that were scheduled in this batch but not yet 'resolved' into the
872
+ * root effects that need to be flushed. Resolving — the upwards traversal that
873
+ * marks the path to each effect on the shared effect tree (see #resolve) — is
874
+ * deferred until the batch is processed, so that the markers are created and
875
+ * consumed within a single traversal. Scheduling into other batches (which can
876
+ * happen concurrently, e.g. while a batch is committed) can therefore never
877
+ * observe (and be confused by) this batch's markers.
878
+ * May contain duplicates — deduplication happens during resolving
879
+ * @type {Effect[]}
880
+ */
881
+ #scheduled = [];
882
+ /**
883
+ * Effects created while this batch was active.
884
+ * @type {Effect[]}
885
+ */
886
+ #new_effects = [];
887
+ /**
888
+ * Deferred effects (which run after async work has completed) and their status (DIRTY or MAYBE_DIRTY)
889
+ * @type {Map<Effect, number>}
890
+ */
891
+ #dirty_reactions = /* @__PURE__ */ new Map();
892
+ /**
893
+ * A map of branches that still exist, but will be destroyed when this batch
894
+ * is committed — we skip over these during `process`.
895
+ * The value contains child effects that were dirty/maybe_dirty before being reset,
896
+ * so they can be rescheduled if the branch survives.
897
+ * @type {Map<Effect, { d: Effect[], m: Effect[] }>}
898
+ */
899
+ #skipped_branches = /* @__PURE__ */ new Map();
900
+ /**
901
+ * Inverse of #skipped_branches which we need to tell prior batches to unskip them when committing
902
+ * @type {Set<Effect>}
903
+ */
904
+ #unskipped_branches = /* @__PURE__ */ new Set();
905
+ is_fork = false;
906
+ #decrement_queued = false;
907
+ constructor() {
908
+ if (last_batch === null) first_batch = last_batch = this;
909
+ else {
910
+ last_batch.next = this;
911
+ this.prev = last_batch;
912
+ }
913
+ last_batch = this;
914
+ }
915
+ #is_deferred() {
916
+ if (this.is_fork) return true;
917
+ for (const effect of this.#blocking_pending.keys()) if (!this.#is_skipped(effect)) return true;
918
+ return false;
919
+ }
920
+ /**
921
+ * Whether `effect` is inside a branch that this batch skips
922
+ * @param {Effect} effect
923
+ */
924
+ #is_skipped(effect) {
925
+ for (var e = effect; e !== null; e = e.parent) if (this.#skipped_branches.has(e)) return true;
926
+ return false;
927
+ }
928
+ /**
929
+ * Add an effect to the #skipped_branches map and reset its children
930
+ * @param {Effect} effect
931
+ */
932
+ skip_effect(effect) {
933
+ if (!this.#skipped_branches.has(effect)) this.#skipped_branches.set(effect, {
934
+ d: [],
935
+ m: []
936
+ });
937
+ this.#unskipped_branches.delete(effect);
938
+ }
939
+ /**
940
+ * Remove an effect from the #skipped_branches map and reschedule
941
+ * any tracked dirty/maybe_dirty child effects
942
+ * @param {Effect} effect
943
+ * @param {(e: Effect) => void} callback
944
+ */
945
+ unskip_effect(effect, callback = (e) => this.schedule(e)) {
946
+ var tracked = this.#skipped_branches.get(effect);
947
+ if (tracked) {
948
+ this.#skipped_branches.delete(effect);
949
+ for (var e of tracked.d) {
950
+ set_signal_status(e, DIRTY);
951
+ callback(e);
952
+ }
953
+ for (e of tracked.m) {
954
+ set_signal_status(e, MAYBE_DIRTY);
955
+ callback(e);
956
+ }
957
+ }
958
+ this.#unskipped_branches.add(effect);
959
+ }
960
+ /**
961
+ * Convert the effects that were scheduled in this batch into the root effects
962
+ * that need to be traversed, marking the path to each effect (by clearing the
963
+ * `CLEAN` flag on ancestor branches) so that the traversal can find them.
964
+ * This happens right before traversal rather than at scheduling time, so that
965
+ * the markers left on the (shared) effect tree are created and consumed within
966
+ * a single traversal — scheduling into other batches can never observe them
967
+ * @returns {Effect[]}
968
+ */
969
+ #resolve() {
970
+ /** @type {Effect[]} */
971
+ var roots = [];
972
+ for (const effect of this.#scheduled) {
973
+ if ((effect.f & 16384) !== 0 || (effect.f & 6144) === 0) continue;
974
+ var e = effect;
975
+ var covered = false;
976
+ while (e.parent !== null) {
977
+ e = e.parent;
978
+ var flags = e.f;
979
+ if ((flags & 96) !== 0) {
980
+ if ((flags & 1024) === 0) {
981
+ covered = true;
982
+ break;
983
+ }
984
+ e.f ^= CLEAN;
985
+ }
986
+ }
987
+ if (!covered) roots.push(e);
988
+ }
989
+ this.#scheduled = [];
990
+ return roots;
991
+ }
992
+ #process() {
993
+ this.started = true;
994
+ for (const [e, status] of this.#dirty_reactions) {
995
+ set_signal_status(e, status);
996
+ this.schedule(e);
997
+ }
998
+ this.apply();
999
+ /** @type {Effect[]} */
1000
+ var effects = collected_effects = [];
1001
+ /** @type {Effect[]} */
1002
+ var render_effects = [];
1003
+ /**
1004
+ * @type {Effect[]}
1005
+ * @deprecated when we get rid of legacy mode and stores, we can get rid of this
1006
+ */
1007
+ var updates = legacy_updates = [];
1008
+ while (this.#scheduled.length > 0) {
1009
+ if (flush_count++ > 1e3) {
1010
+ this.#unlink();
1011
+ infinite_loop_guard();
1012
+ }
1013
+ for (const root of this.#resolve()) try {
1014
+ this.#traverse(root, effects, render_effects);
1015
+ } catch (e) {
1016
+ reset_all(root);
1017
+ if (!this.#is_deferred()) this.discard();
1018
+ throw e;
1019
+ }
1020
+ }
1021
+ current_batch = null;
1022
+ if (updates.length > 0) {
1023
+ var batch = Batch.ensure();
1024
+ for (const e of updates) batch.schedule(e);
1025
+ }
1026
+ collected_effects = null;
1027
+ legacy_updates = null;
1028
+ if (this.#is_deferred()) {
1029
+ this.#defer_effects(render_effects);
1030
+ this.#defer_effects(effects);
1031
+ for (const [e, t] of this.#skipped_branches) reset_branch(e, t);
1032
+ if (updates.length > 0)
1033
+ /** @type {Batch} */ current_batch.#process();
1034
+ return;
1035
+ }
1036
+ const earlier_batch = this.#find_earlier_batch();
1037
+ if (earlier_batch) {
1038
+ this.#defer_effects(render_effects);
1039
+ this.#defer_effects(effects);
1040
+ earlier_batch.#merge(this);
1041
+ return;
1042
+ }
1043
+ this.#dirty_reactions.clear();
1044
+ for (const fn of this.#commit_callbacks) fn(this);
1045
+ this.#commit_callbacks.clear();
1046
+ previous_batch = this;
1047
+ flush_queued_effects(render_effects);
1048
+ flush_queued_effects(effects);
1049
+ previous_batch = null;
1050
+ this.#deferred?.resolve();
1051
+ var next_batch = current_batch;
1052
+ if (this.#pending === 0 && (this.#scheduled.length === 0 || next_batch !== null)) {
1053
+ this.#unlink();
1054
+ if (async_mode_flag) {
1055
+ this.#commit();
1056
+ current_batch = next_batch;
1057
+ }
1058
+ }
1059
+ if (next_batch !== null) {
1060
+ old_values.clear();
1061
+ next_batch.#process();
1062
+ }
1063
+ }
1064
+ /**
1065
+ * Traverse the effect tree, executing effects or stashing
1066
+ * them for later execution as appropriate
1067
+ * @param {Effect} root
1068
+ * @param {Effect[]} effects
1069
+ * @param {Effect[]} render_effects
1070
+ */
1071
+ #traverse(root, effects, render_effects) {
1072
+ root.f ^= CLEAN;
1073
+ var effect = root.first;
1074
+ while (effect !== null) {
1075
+ var flags = effect.f;
1076
+ var is_branch = (flags & 96) !== 0;
1077
+ if (!(is_branch && (flags & 1024) !== 0 || (flags & 8192) !== 0 || this.#skipped_branches.has(effect)) && effect.fn !== null) {
1078
+ if (is_branch) effect.f ^= CLEAN;
1079
+ else if ((flags & 4) !== 0) effects.push(effect);
1080
+ else if (async_mode_flag && (flags & 16777224) !== 0) render_effects.push(effect);
1081
+ else if (is_dirty(effect)) {
1082
+ if ((flags & 16) !== 0) this.add_dirty_reaction(effect, MAYBE_DIRTY);
1083
+ update_effect(effect);
1084
+ }
1085
+ var child = effect.first;
1086
+ if (child !== null) {
1087
+ effect = child;
1088
+ continue;
1089
+ }
1090
+ }
1091
+ while (effect !== null) {
1092
+ var next = effect.next;
1093
+ if (next !== null) {
1094
+ effect = next;
1095
+ break;
1096
+ }
1097
+ effect = effect.parent;
1098
+ }
1099
+ }
1100
+ }
1101
+ #find_earlier_batch() {
1102
+ for (var batch = this.prev; batch !== null; batch = batch.prev) if (!batch.is_fork && this.#intersects(batch)) return batch;
1103
+ return null;
1104
+ }
1105
+ /** @param {Batch} batch */
1106
+ #intersects(batch) {
1107
+ for (const [source, [, is_derived]] of this.current) {
1108
+ if (is_derived) continue;
1109
+ if (batch.current.has(source)) return true;
1110
+ }
1111
+ return false;
1112
+ }
1113
+ /**
1114
+ * @param {Batch} batch
1115
+ */
1116
+ #merge(batch) {
1117
+ for (const [source, value] of batch.current) {
1118
+ if (!this.previous.has(source) && batch.previous.has(source)) this.previous.set(source, batch.previous.get(source));
1119
+ this.current.set(source, value);
1120
+ }
1121
+ for (const [effect, deferred] of batch.async_deriveds) {
1122
+ const d = this.async_deriveds.get(effect);
1123
+ if (d) deferred.promise.then(d.resolve).catch(d.reject);
1124
+ }
1125
+ batch.async_deriveds.clear();
1126
+ this.transfer_reactions(batch.#dirty_reactions);
1127
+ /**
1128
+ * mark all effects that depend on `batch.current`, except the
1129
+ * async effects that we just resolved (TODO unless they depend
1130
+ * on values in this batch that are NOT in the later batch?).
1131
+ * Through this we also will populate the correct #skipped_branches,
1132
+ * oncommit callbacks etc, so we don't need to merge them separately.
1133
+ * @param {Value} value
1134
+ */
1135
+ const mark = (value) => {
1136
+ var reactions = value.reactions;
1137
+ if (reactions === null) return;
1138
+ if ((value.f & 2) !== 0 && (value.f & 6144) === 0) return;
1139
+ for (const reaction of reactions) {
1140
+ var flags = reaction.f;
1141
+ if ((flags & 2) !== 0) mark(reaction);
1142
+ else {
1143
+ var effect = reaction;
1144
+ if (flags & 4194320 && !this.async_deriveds.has(effect)) {
1145
+ this.#dirty_reactions.delete(effect);
1146
+ set_signal_status(effect, DIRTY);
1147
+ this.schedule(effect);
1148
+ }
1149
+ }
1150
+ }
1151
+ };
1152
+ for (const source of this.current.keys()) mark(source);
1153
+ this.oncommit(() => batch.discard());
1154
+ batch.#unlink();
1155
+ current_batch = this;
1156
+ this.#process();
1157
+ }
1158
+ /**
1159
+ * @param {Effect[]} effects
1160
+ */
1161
+ #defer_effects(effects) {
1162
+ for (var i = 0; i < effects.length; i += 1) defer_effect(effects[i], this.#dirty_reactions);
1163
+ }
1164
+ /**
1165
+ * Associate a change to a given source with the current
1166
+ * batch, noting its previous and current values
1167
+ * @param {Value} source
1168
+ * @param {any} value
1169
+ * @param {boolean} [is_derived]
1170
+ */
1171
+ capture(source, value, is_derived = false) {
1172
+ if (source.v !== UNINITIALIZED && !this.previous.has(source)) this.previous.set(source, source.v);
1173
+ if ((source.f & 8388608) === 0) {
1174
+ this.current.set(source, [value, is_derived]);
1175
+ batch_values?.set(source, value);
1176
+ }
1177
+ if (!this.is_fork) source.v = value;
1178
+ }
1179
+ activate() {
1180
+ current_batch = this;
1181
+ }
1182
+ deactivate() {
1183
+ current_batch = null;
1184
+ batch_values = null;
1185
+ }
1186
+ flush() {
1187
+ try {
1188
+ is_processing = true;
1189
+ current_batch = this;
1190
+ this.#process();
1191
+ } finally {
1192
+ flush_count = 0;
1193
+ last_scheduled_effect = null;
1194
+ collected_effects = null;
1195
+ legacy_updates = null;
1196
+ is_processing = false;
1197
+ current_batch = null;
1198
+ batch_values = null;
1199
+ old_values.clear();
1200
+ }
1201
+ }
1202
+ discard() {
1203
+ for (const fn of this.#discard_callbacks) fn(this);
1204
+ this.#discard_callbacks.clear();
1205
+ for (const deferred of this.async_deriveds.values()) deferred.reject(OBSOLETE);
1206
+ this.#unlink();
1207
+ this.#deferred?.resolve();
1208
+ }
1209
+ /**
1210
+ * @param {Effect} effect
1211
+ */
1212
+ register_created_effect(effect) {
1213
+ this.#new_effects.push(effect);
1214
+ }
1215
+ #commit() {
1216
+ for (let batch = first_batch; batch !== null; batch = batch.next) {
1217
+ var is_earlier = batch.id < this.id;
1218
+ /** @type {Source[]} */
1219
+ var sources = [];
1220
+ for (const [source, [value, is_derived]] of this.current) {
1221
+ if (batch.current.has(source)) {
1222
+ var batch_value = batch.current.get(source)[0];
1223
+ if (is_earlier && value !== batch_value) batch.current.set(source, [value, is_derived]);
1224
+ else continue;
1225
+ }
1226
+ sources.push(source);
1227
+ }
1228
+ if (is_earlier) for (const [effect, deferred] of this.async_deriveds) {
1229
+ const d = batch.async_deriveds.get(effect);
1230
+ if (d) deferred.promise.then(d.resolve).catch(d.reject);
1231
+ }
1232
+ var current = [...batch.current.keys()].filter((source) => !batch.current.get(source)[1]);
1233
+ if (!batch.started || current.length === 0) continue;
1234
+ var others = current.filter((source) => !this.current.has(source));
1235
+ if (others.length === 0) {
1236
+ if (is_earlier) batch.discard();
1237
+ } else if (sources.length > 0) {
1238
+ if (is_earlier) for (const unskipped of this.#unskipped_branches) batch.unskip_effect(unskipped, (e) => {
1239
+ if ((e.f & 4194320) !== 0) batch.schedule(e);
1240
+ else batch.#defer_effects([e]);
1241
+ });
1242
+ batch.activate();
1243
+ /** @type {Set<Value>} */
1244
+ var marked = /* @__PURE__ */ new Set();
1245
+ /** @type {Map<Reaction, boolean>} */
1246
+ var checked = /* @__PURE__ */ new Map();
1247
+ for (var source of sources) mark_effects(source, others, marked, checked);
1248
+ checked = /* @__PURE__ */ new Map();
1249
+ var current_unequal = [...batch.current].filter(([c, v1]) => {
1250
+ const v2 = this.current.get(c);
1251
+ if (!v2) return true;
1252
+ return v2[0] !== v1[0] || v2[1] !== v1[1];
1253
+ }).map(([c]) => c);
1254
+ if (current_unequal.length > 0) {
1255
+ for (const effect of this.#new_effects) if ((effect.f & 155648) === 0 && depends_on(effect, current_unequal, checked)) {
1256
+ if ((effect.f & 4194320) !== 0) {
1257
+ set_signal_status(effect, DIRTY);
1258
+ batch.schedule(effect);
1259
+ } else batch.add_dirty_reaction(effect, DIRTY);
1260
+ }
1261
+ }
1262
+ if (batch.#scheduled.length > 0 && !batch.#decrement_queued) {
1263
+ batch.apply();
1264
+ for (var root of batch.#resolve()) batch.#traverse(root, [], []);
1265
+ }
1266
+ batch.deactivate();
1267
+ }
1268
+ }
1269
+ }
1270
+ /**
1271
+ * @param {boolean} blocking
1272
+ * @param {Effect} effect
1273
+ */
1274
+ increment(blocking, effect) {
1275
+ this.#pending += 1;
1276
+ if (blocking) {
1277
+ let blocking_pending_count = this.#blocking_pending.get(effect) ?? 0;
1278
+ this.#blocking_pending.set(effect, blocking_pending_count + 1);
1279
+ }
1280
+ }
1281
+ /**
1282
+ * @param {boolean} blocking
1283
+ * @param {Effect} effect
1284
+ */
1285
+ decrement(blocking, effect) {
1286
+ this.#pending -= 1;
1287
+ if (blocking) {
1288
+ let blocking_pending_count = this.#blocking_pending.get(effect) ?? 0;
1289
+ if (blocking_pending_count === 1) this.#blocking_pending.delete(effect);
1290
+ else this.#blocking_pending.set(effect, blocking_pending_count - 1);
1291
+ }
1292
+ if (this.#decrement_queued) return;
1293
+ this.#decrement_queued = true;
1294
+ queue_micro_task(() => {
1295
+ this.#decrement_queued = false;
1296
+ if (this.linked) this.flush();
1297
+ });
1298
+ }
1299
+ /**
1300
+ * @param {Map<Effect, number>} dirty_reactions
1301
+ */
1302
+ transfer_reactions(dirty_reactions) {
1303
+ for (const [effect, status] of dirty_reactions) this.add_dirty_reaction(effect, status);
1304
+ dirty_reactions.clear();
1305
+ }
1306
+ /**
1307
+ * @param {Effect} effect
1308
+ * @param {number} status
1309
+ */
1310
+ add_dirty_reaction(effect, status) {
1311
+ if (status === 2048 || this.#dirty_reactions.get(effect) !== 2048) this.#dirty_reactions.set(effect, status);
1312
+ }
1313
+ /** @param {(batch: Batch) => void} fn */
1314
+ oncommit(fn) {
1315
+ this.#commit_callbacks.add(fn);
1316
+ }
1317
+ /** @param {(batch: Batch) => void} fn */
1318
+ ondiscard(fn) {
1319
+ this.#discard_callbacks.add(fn);
1320
+ }
1321
+ settled() {
1322
+ return (this.#deferred ??= deferred()).promise;
1323
+ }
1324
+ static ensure() {
1325
+ if (current_batch === null) {
1326
+ const batch = current_batch = new Batch();
1327
+ if (!is_processing && !is_flushing_sync) queue_micro_task(() => {
1328
+ if (!batch.started) batch.flush();
1329
+ });
1330
+ }
1331
+ return current_batch;
1332
+ }
1333
+ apply() {
1334
+ if (!async_mode_flag || !this.is_fork && this.prev === null && this.next === null) {
1335
+ batch_values = null;
1336
+ return;
1337
+ }
1338
+ batch_values = /* @__PURE__ */ new Map();
1339
+ for (const [source, [value]] of this.current) batch_values.set(source, value);
1340
+ for (let batch = first_batch; batch !== null; batch = batch.next) {
1341
+ if (batch === this || batch.is_fork) continue;
1342
+ if (batch.id >= this.id || !batch.#intersects(this)) {
1343
+ for (const [source, previous] of batch.previous) if (!batch_values.has(source)) batch_values.set(source, previous);
1344
+ }
1345
+ }
1346
+ }
1347
+ /**
1348
+ *
1349
+ * @param {Effect} effect
1350
+ */
1351
+ schedule(effect) {
1352
+ last_scheduled_effect = effect;
1353
+ if (effect.b?.is_pending && (effect.f & 16777228) !== 0 && (effect.f & 32768) === 0) {
1354
+ effect.b.defer_effect(effect);
1355
+ return;
1356
+ }
1357
+ this.#scheduled.push(effect);
1358
+ }
1359
+ #unlink() {
1360
+ if (!this.linked) return;
1361
+ var prev = this.prev;
1362
+ var next = this.next;
1363
+ if (prev === null) first_batch = next;
1364
+ else prev.next = next;
1365
+ if (next === null) last_batch = prev;
1366
+ else next.prev = prev;
1367
+ this.linked = false;
1368
+ }
37
1369
  };
38
- __iconData.node;
39
- function Server($$renderer, $$props) {
40
- let { $$slots, $$events, ...props } = $$props;
41
- Icon($$renderer, spread_props([props, { icon: __iconData }]));
1370
+ /**
1371
+ * Synchronously flush any pending updates.
1372
+ * Returns void if no callback is provided, otherwise returns the result of calling the callback.
1373
+ * @template [T=void]
1374
+ * @param {(() => T) | undefined} [fn]
1375
+ * @returns {T}
1376
+ */
1377
+ function flushSync(fn) {
1378
+ var was_flushing_sync = is_flushing_sync;
1379
+ var prev_previous_batch = previous_batch;
1380
+ previous_batch = null;
1381
+ is_flushing_sync = true;
1382
+ try {
1383
+ var result;
1384
+ if (fn) {
1385
+ flushSync();
1386
+ result = fn();
1387
+ }
1388
+ while (true) {
1389
+ flush_tasks();
1390
+ if (current_batch === null) return result;
1391
+ current_batch.flush();
1392
+ }
1393
+ } finally {
1394
+ is_flushing_sync = was_flushing_sync;
1395
+ previous_batch = prev_previous_batch;
1396
+ }
1397
+ }
1398
+ function infinite_loop_guard() {
1399
+ try {
1400
+ effect_update_depth_exceeded();
1401
+ } catch (error) {
1402
+ invoke_error_boundary(error, last_scheduled_effect);
1403
+ }
1404
+ }
1405
+ /** @type {Set<Effect> | null} */
1406
+ var eager_block_effects = null;
1407
+ /**
1408
+ * @param {Array<Effect>} effects
1409
+ * @returns {void}
1410
+ */
1411
+ function flush_queued_effects(effects) {
1412
+ var length = effects.length;
1413
+ if (length === 0) return;
1414
+ var i = 0;
1415
+ while (i < length) {
1416
+ var effect = effects[i++];
1417
+ if ((effect.f & 24576) === 0 && is_dirty(effect)) {
1418
+ eager_block_effects = /* @__PURE__ */ new Set();
1419
+ update_effect(effect);
1420
+ if (effect.deps === null && effect.first === null && effect.nodes === null && effect.teardown === null && effect.ac === null) unlink_effect(effect);
1421
+ if (eager_block_effects?.size > 0) {
1422
+ old_values.clear();
1423
+ for (const e of eager_block_effects) {
1424
+ if ((e.f & 24576) !== 0) continue;
1425
+ /** @type {Effect[]} */
1426
+ const ordered_effects = [e];
1427
+ let ancestor = e.parent;
1428
+ while (ancestor !== null) {
1429
+ if (eager_block_effects.has(ancestor)) {
1430
+ eager_block_effects.delete(ancestor);
1431
+ ordered_effects.push(ancestor);
1432
+ }
1433
+ ancestor = ancestor.parent;
1434
+ }
1435
+ for (let j = ordered_effects.length - 1; j >= 0; j--) {
1436
+ const e = ordered_effects[j];
1437
+ if ((e.f & 24576) !== 0) continue;
1438
+ update_effect(e);
1439
+ }
1440
+ }
1441
+ eager_block_effects.clear();
1442
+ }
1443
+ }
1444
+ }
1445
+ eager_block_effects = null;
1446
+ }
1447
+ /**
1448
+ * This is similar to `mark_reactions`, but it only marks async/block effects
1449
+ * depending on `value` and at least one of the other `sources`, so that
1450
+ * these effects can re-run after another batch has been committed
1451
+ * @param {Value} value
1452
+ * @param {Source[]} sources
1453
+ * @param {Set<Value>} marked
1454
+ * @param {Map<Reaction, boolean>} checked
1455
+ */
1456
+ function mark_effects(value, sources, marked, checked) {
1457
+ if (marked.has(value)) return;
1458
+ marked.add(value);
1459
+ if (value.reactions !== null) for (const reaction of value.reactions) {
1460
+ const flags = reaction.f;
1461
+ if ((flags & 2) !== 0) mark_effects(reaction, sources, marked, checked);
1462
+ else if ((flags & 4194320) !== 0 && (flags & 2048) === 0 && depends_on(reaction, sources, checked)) {
1463
+ set_signal_status(reaction, DIRTY);
1464
+ schedule_effect(reaction);
1465
+ }
1466
+ }
1467
+ }
1468
+ /**
1469
+ * @param {Reaction} reaction
1470
+ * @param {Source[]} sources
1471
+ * @param {Map<Reaction, boolean>} checked
1472
+ */
1473
+ function depends_on(reaction, sources, checked) {
1474
+ const depends = checked.get(reaction);
1475
+ if (depends !== void 0) return depends;
1476
+ if (reaction.deps !== null) for (const dep of reaction.deps) {
1477
+ if (includes.call(sources, dep)) return true;
1478
+ if ((dep.f & 2) !== 0 && depends_on(dep, sources, checked)) {
1479
+ checked.set(dep, true);
1480
+ return true;
1481
+ }
1482
+ }
1483
+ checked.set(reaction, false);
1484
+ return false;
1485
+ }
1486
+ /**
1487
+ * @param {Effect} effect
1488
+ * @returns {void}
1489
+ */
1490
+ function schedule_effect(effect) {
1491
+ /** @type {Batch} */ current_batch.schedule(effect);
1492
+ }
1493
+ /**
1494
+ * Mark all the effects inside a skipped branch CLEAN, so that
1495
+ * they can be correctly rescheduled later. Tracks dirty and maybe_dirty
1496
+ * effects so they can be rescheduled if the branch survives.
1497
+ * @param {Effect} effect
1498
+ * @param {{ d: Effect[], m: Effect[] }} tracked
1499
+ */
1500
+ function reset_branch(effect, tracked) {
1501
+ if ((effect.f & 32) !== 0 && (effect.f & 1024) !== 0) return;
1502
+ if ((effect.f & 2048) !== 0) tracked.d.push(effect);
1503
+ else if ((effect.f & 4096) !== 0) tracked.m.push(effect);
1504
+ set_signal_status(effect, CLEAN);
1505
+ var e = effect.first;
1506
+ while (e !== null) {
1507
+ reset_branch(e, tracked);
1508
+ e = e.next;
1509
+ }
1510
+ }
1511
+ /**
1512
+ * Mark an entire effect tree clean following an error
1513
+ * @param {Effect} effect
1514
+ */
1515
+ function reset_all(effect) {
1516
+ set_signal_status(effect, CLEAN);
1517
+ var e = effect.first;
1518
+ while (e !== null) {
1519
+ reset_all(e);
1520
+ e = e.next;
1521
+ }
1522
+ }
1523
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/client/reactivity/sources.js
1524
+ /** @import { Derived, Effect, Source, Value } from '#client' */
1525
+ /** @type {Set<Effect>} */
1526
+ var eager_effects = /* @__PURE__ */ new Set();
1527
+ /** @type {Map<Value, any>} */
1528
+ var old_values = /* @__PURE__ */ new Map();
1529
+ var eager_effects_deferred = false;
1530
+ /**
1531
+ * @template V
1532
+ * @param {V} v
1533
+ * @param {Error | null} [stack]
1534
+ * @returns {Source<V>}
1535
+ */
1536
+ function source(v, stack) {
1537
+ return {
1538
+ f: 0,
1539
+ v,
1540
+ reactions: null,
1541
+ equals,
1542
+ rv: 0,
1543
+ wv: 0
1544
+ };
1545
+ }
1546
+ /**
1547
+ * @template V
1548
+ * @param {V} v
1549
+ * @param {Error | null} [stack]
1550
+ */
1551
+ /*#__NO_SIDE_EFFECTS__*/
1552
+ function state(v, stack) {
1553
+ const s = source(v, stack);
1554
+ push_reaction_value(s);
1555
+ return s;
1556
+ }
1557
+ /**
1558
+ * @template V
1559
+ * @param {V} initial_value
1560
+ * @param {boolean} [immutable]
1561
+ * @returns {Source<V>}
1562
+ */
1563
+ /*#__NO_SIDE_EFFECTS__*/
1564
+ function mutable_source(initial_value, immutable = false, trackable = true) {
1565
+ const s = source(initial_value);
1566
+ if (!immutable) s.equals = safe_equals;
1567
+ if (legacy_mode_flag && trackable && component_context !== null && component_context.l !== null) (component_context.l.s ??= []).push(s);
1568
+ return s;
1569
+ }
1570
+ /**
1571
+ * @template V
1572
+ * @param {Value<V>} source
1573
+ * @param {V} value
1574
+ * @param {boolean} [should_proxy]
1575
+ * @returns {V}
1576
+ */
1577
+ function set(source, value, should_proxy = false) {
1578
+ if (active_reaction !== null && (!untracking || (active_reaction.f & 131072) !== 0) && is_runes() && (active_reaction.f & 4325394) !== 0 && (current_sources === null || !current_sources.has(source))) state_unsafe_mutation();
1579
+ return internal_set(source, should_proxy ? proxy(value) : value, legacy_updates);
1580
+ }
1581
+ /**
1582
+ * A set of signals we have already seen while traversing in mark_reactions.
1583
+ * Not always set to balance the common case of sources only having a couple
1584
+ * of (transitive) dependencies (where always creating a Set would be bad for perf)
1585
+ * with the edge case of extremely deep or wide dependency arrays with cycles.
1586
+ * @type {Set<any> | null}
1587
+ */
1588
+ var seen = null;
1589
+ /** Number of transitive dependencies, see {@link seen} for more info */
1590
+ var count_deps = 0;
1591
+ /**
1592
+ * @template V
1593
+ * @param {Value<V>} source
1594
+ * @param {V} value
1595
+ * @param {Effect[] | null} [updated_during_traversal]
1596
+ * @returns {V}
1597
+ */
1598
+ function internal_set(source, value, updated_during_traversal = null) {
1599
+ if (!source.equals(value)) {
1600
+ if (is_destroying_effect) old_values.set(source, value);
1601
+ else if (!old_values.has(source)) old_values.set(source, source.v);
1602
+ var batch = Batch.ensure();
1603
+ batch.capture(source, value);
1604
+ if ((source.f & 2) !== 0) {
1605
+ const derived = source;
1606
+ if ((source.f & 2048) !== 0) execute_derived(derived);
1607
+ if (batch_values === null) update_derived_status(derived);
1608
+ }
1609
+ source.wv = increment_write_version();
1610
+ seen = null;
1611
+ count_deps = 0;
1612
+ mark_reactions(source, DIRTY, updated_during_traversal);
1613
+ seen = null;
1614
+ if (is_runes() && active_effect !== null && (active_effect.f & 1024) !== 0 && (active_effect.f & 96) === 0) {
1615
+ if (untracked_writes === null) set_untracked_writes([source]);
1616
+ else untracked_writes.push(source);
1617
+ }
1618
+ if (!batch.is_fork && eager_effects.size > 0 && !eager_effects_deferred) flush_eager_effects();
1619
+ }
1620
+ return value;
1621
+ }
1622
+ function flush_eager_effects() {
1623
+ eager_effects_deferred = false;
1624
+ for (const effect of eager_effects) {
1625
+ if ((effect.f & 1024) !== 0) set_signal_status(effect, MAYBE_DIRTY);
1626
+ let dirty;
1627
+ try {
1628
+ dirty = is_dirty(effect);
1629
+ } catch {
1630
+ dirty = true;
1631
+ }
1632
+ if (dirty) update_effect(effect);
1633
+ }
1634
+ eager_effects.clear();
1635
+ }
1636
+ /**
1637
+ * Silently (without using `get`) increment a source
1638
+ * @param {Source<number>} source
1639
+ */
1640
+ function increment(source) {
1641
+ set(source, source.v + 1);
1642
+ }
1643
+ /**
1644
+ * @param {Value} signal
1645
+ * @param {number} status should be DIRTY or MAYBE_DIRTY
1646
+ * @param {Effect[] | null} updated_during_traversal
1647
+ * @returns {void}
1648
+ */
1649
+ function mark_reactions(signal, status, updated_during_traversal) {
1650
+ var reactions = signal.reactions;
1651
+ if (reactions === null) return;
1652
+ var runes = is_runes();
1653
+ var length = reactions.length;
1654
+ count_deps += length;
1655
+ if (count_deps > 1e5 && seen === null) seen = /* @__PURE__ */ new Set();
1656
+ if (seen !== null) {
1657
+ if (seen.has(signal)) return;
1658
+ seen.add(signal);
1659
+ }
1660
+ for (var i = 0; i < length; i++) {
1661
+ var reaction = reactions[i];
1662
+ var flags = reaction.f;
1663
+ if (!runes && reaction === active_effect) continue;
1664
+ var not_dirty = (flags & DIRTY) === 0;
1665
+ if (not_dirty) set_signal_status(reaction, status);
1666
+ if ((flags & 131072) !== 0) eager_effects.add(reaction);
1667
+ else if ((flags & 2) !== 0) {
1668
+ var derived = reaction;
1669
+ batch_values?.delete(derived);
1670
+ mark_reactions(derived, MAYBE_DIRTY, updated_during_traversal);
1671
+ } else if (not_dirty) {
1672
+ var effect = reaction;
1673
+ if ((flags & 16) !== 0 && eager_block_effects !== null) eager_block_effects.add(effect);
1674
+ if (updated_during_traversal !== null) updated_during_traversal.push(effect);
1675
+ else schedule_effect(effect);
1676
+ }
1677
+ }
1678
+ }
1679
+ /**
1680
+ * @template T
1681
+ * @param {T} value
1682
+ * @returns {T}
1683
+ */
1684
+ function proxy(value) {
1685
+ if (typeof value !== "object" || value === null || STATE_SYMBOL in value || COMPONENT_SYMBOL in value) return value;
1686
+ const prototype = get_prototype_of(value);
1687
+ if (prototype !== object_prototype && prototype !== array_prototype) return value;
1688
+ /** @type {Map<any, Source<any>>} */
1689
+ var sources = /* @__PURE__ */ new Map();
1690
+ var is_proxied_array = is_array(value);
1691
+ var version = /* @__PURE__ */ state(0);
1692
+ var stack = null;
1693
+ var parent_version = update_version;
1694
+ /**
1695
+ * Executes the proxy in the context of the reaction it was originally created in, if any
1696
+ * @template T
1697
+ * @param {() => T} fn
1698
+ */
1699
+ var with_parent = (fn) => {
1700
+ if (update_version === parent_version) return fn();
1701
+ var reaction = active_reaction;
1702
+ var version = update_version;
1703
+ set_active_reaction(null);
1704
+ set_update_version(parent_version);
1705
+ var result = fn();
1706
+ set_active_reaction(reaction);
1707
+ set_update_version(version);
1708
+ return result;
1709
+ };
1710
+ if (is_proxied_array) sources.set("length", /* @__PURE__ */ state(
1711
+ /** @type {any[]} */
1712
+ value.length,
1713
+ stack
1714
+ ));
1715
+ return new Proxy(value, {
1716
+ defineProperty(_, prop, descriptor) {
1717
+ if (!("value" in descriptor) || descriptor.configurable === false || descriptor.enumerable === false || descriptor.writable === false) state_descriptors_fixed();
1718
+ var s = sources.get(prop);
1719
+ if (s === void 0) with_parent(() => {
1720
+ var s = /* @__PURE__ */ state(descriptor.value, stack);
1721
+ sources.set(prop, s);
1722
+ return s;
1723
+ });
1724
+ else set(s, descriptor.value, true);
1725
+ return true;
1726
+ },
1727
+ deleteProperty(target, prop) {
1728
+ var s = sources.get(prop);
1729
+ if (s === void 0) {
1730
+ if (prop in target) {
1731
+ const s = with_parent(() => /* @__PURE__ */ state(UNINITIALIZED, stack));
1732
+ sources.set(prop, s);
1733
+ increment(version);
1734
+ }
1735
+ } else {
1736
+ set(s, UNINITIALIZED);
1737
+ increment(version);
1738
+ }
1739
+ return true;
1740
+ },
1741
+ get(target, prop, receiver) {
1742
+ if (prop === STATE_SYMBOL) return value;
1743
+ var s = sources.get(prop);
1744
+ var exists = prop in target;
1745
+ if (s === void 0 && (!exists || get_descriptor(target, prop)?.writable)) {
1746
+ s = with_parent(() => {
1747
+ return /* @__PURE__ */ state(proxy(exists ? target[prop] : UNINITIALIZED), stack);
1748
+ });
1749
+ sources.set(prop, s);
1750
+ }
1751
+ if (s !== void 0) {
1752
+ var v = get(s);
1753
+ return v === UNINITIALIZED ? void 0 : v;
1754
+ }
1755
+ return Reflect.get(target, prop, receiver);
1756
+ },
1757
+ getOwnPropertyDescriptor(target, prop) {
1758
+ this.has?.(target, prop);
1759
+ var descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
1760
+ var s = sources.get(prop);
1761
+ if (s !== void 0) {
1762
+ var value = get(s);
1763
+ if (value === UNINITIALIZED) return;
1764
+ if (descriptor && "value" in descriptor) descriptor.value = value;
1765
+ else return {
1766
+ enumerable: true,
1767
+ configurable: true,
1768
+ value,
1769
+ writable: true
1770
+ };
1771
+ }
1772
+ return descriptor;
1773
+ },
1774
+ has(target, prop) {
1775
+ if (prop === STATE_SYMBOL) return true;
1776
+ var s = sources.get(prop);
1777
+ var has = s !== void 0 && s.v !== UNINITIALIZED || Reflect.has(target, prop);
1778
+ if (s !== void 0 || (active_effect !== null || active_reaction !== null) && (!has || get_descriptor(target, prop)?.writable)) {
1779
+ if (s === void 0) {
1780
+ s = with_parent(() => {
1781
+ return /* @__PURE__ */ state(has ? proxy(target[prop]) : UNINITIALIZED, stack);
1782
+ });
1783
+ sources.set(prop, s);
1784
+ }
1785
+ if (get(s) === UNINITIALIZED) return false;
1786
+ }
1787
+ return has;
1788
+ },
1789
+ set(target, prop, value, receiver) {
1790
+ var s = sources.get(prop);
1791
+ var has = prop in target;
1792
+ if (is_proxied_array && prop === "length") for (var i = value; i < s.v; i += 1) {
1793
+ var other_s = sources.get(i + "");
1794
+ if (other_s !== void 0) set(other_s, UNINITIALIZED);
1795
+ else if (i in target) {
1796
+ other_s = with_parent(() => /* @__PURE__ */ state(UNINITIALIZED, stack));
1797
+ sources.set(i + "", other_s);
1798
+ }
1799
+ }
1800
+ if (s === void 0) {
1801
+ if (!has || get_descriptor(target, prop)?.writable) {
1802
+ s = with_parent(() => /* @__PURE__ */ state(void 0, stack));
1803
+ set(s, proxy(value));
1804
+ sources.set(prop, s);
1805
+ }
1806
+ } else {
1807
+ has = s.v !== UNINITIALIZED;
1808
+ var p = with_parent(() => proxy(value));
1809
+ set(s, p);
1810
+ }
1811
+ var descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
1812
+ if (descriptor?.set) descriptor.set.call(receiver, value);
1813
+ if (!has) {
1814
+ if (is_proxied_array && typeof prop === "string") {
1815
+ var ls = sources.get("length");
1816
+ var n = Number(prop);
1817
+ if (Number.isInteger(n) && n >= ls.v) set(ls, n + 1);
1818
+ }
1819
+ increment(version);
1820
+ }
1821
+ return true;
1822
+ },
1823
+ ownKeys(target) {
1824
+ get(version);
1825
+ var own_keys = Reflect.ownKeys(target).filter((key) => {
1826
+ var source = sources.get(key);
1827
+ return source === void 0 || source.v !== UNINITIALIZED;
1828
+ });
1829
+ for (var [key, source] of sources) if (source.v !== UNINITIALIZED && !(key in target)) own_keys.push(key);
1830
+ return own_keys;
1831
+ },
1832
+ setPrototypeOf() {
1833
+ state_prototype_fixed();
1834
+ }
1835
+ });
1836
+ }
1837
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/client/dom/operations.js
1838
+ /** @type {Window} */
1839
+ var $window;
1840
+ /** @type {() => Node | null} */
1841
+ var first_child_getter;
1842
+ /** @type {() => Node | null} */
1843
+ var next_sibling_getter;
1844
+ /**
1845
+ * Initialize these lazily to avoid issues when using the runtime in a server context
1846
+ * where these globals are not available while avoiding a separate server entry point
1847
+ */
1848
+ function init_operations() {
1849
+ if ($window !== void 0) return;
1850
+ $window = window;
1851
+ /Firefox/.test(navigator.userAgent);
1852
+ var element_prototype = Element.prototype;
1853
+ var node_prototype = Node.prototype;
1854
+ var text_prototype = Text.prototype;
1855
+ first_child_getter = get_descriptor(node_prototype, "firstChild").get;
1856
+ next_sibling_getter = get_descriptor(node_prototype, "nextSibling").get;
1857
+ if (is_extensible(element_prototype)) {
1858
+ /** @type {any} */ element_prototype[CLASS_CACHE] = void 0;
1859
+ /** @type {any} */ element_prototype[ATTRIBUTES_CACHE] = null;
1860
+ /** @type {any} */ element_prototype[STYLE_CACHE] = void 0;
1861
+ element_prototype.__e = void 0;
1862
+ }
1863
+ if (is_extensible(text_prototype))
1864
+ /** @type {any} */ text_prototype[TEXT_CACHE] = void 0;
1865
+ }
1866
+ /**
1867
+ * @param {string} value
1868
+ * @returns {Text}
1869
+ */
1870
+ function create_text(value = "") {
1871
+ return document.createTextNode(value);
1872
+ }
1873
+ /**
1874
+ * @template {Node} N
1875
+ * @param {N} node
1876
+ */
1877
+ /*@__NO_SIDE_EFFECTS__*/
1878
+ function get_first_child(node) {
1879
+ return first_child_getter.call(node);
1880
+ }
1881
+ /**
1882
+ * @template {Node} N
1883
+ * @param {N} node
1884
+ */
1885
+ /*@__NO_SIDE_EFFECTS__*/
1886
+ function get_next_sibling(node) {
1887
+ return next_sibling_getter.call(node);
1888
+ }
1889
+ /**
1890
+ * @template {Node} N
1891
+ * @param {N} node
1892
+ * @returns {void}
1893
+ */
1894
+ function clear_text_content(node) {
1895
+ node.textContent = "";
1896
+ }
1897
+ /**
1898
+ * Branching here is intentional and load-bearing for perf. `createElement(tag)`
1899
+ * hits a fast path in Blink that `createElementNS(NAMESPACE_HTML, tag)` doesn't,
1900
+ * and passing an explicit `undefined` as the trailing options arg measurably
1901
+ * slows both APIs. Funnelling every case through a single `createElementNS(ns,
1902
+ * tag, options)` call would be smaller but slower on the HTML path.
1903
+ *
1904
+ * @template {keyof HTMLElementTagNameMap | string} T
1905
+ * @param {T} tag
1906
+ * @param {string} [namespace]
1907
+ * @param {string} [is]
1908
+ * @returns {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element}
1909
+ */
1910
+ function create_element(tag, namespace, is) {
1911
+ if (namespace == null || namespace === "http://www.w3.org/1999/xhtml") return is ? document.createElement(tag, { is }) : document.createElement(tag);
1912
+ return is ? document.createElementNS(namespace, tag, { is }) : document.createElementNS(namespace, tag);
1913
+ }
1914
+ /**
1915
+ * @param {unknown} error
1916
+ */
1917
+ function handle_error(error) {
1918
+ var effect = active_effect;
1919
+ if (effect === null) {
1920
+ /** @type {Derived} */ active_reaction.f |= ERROR_VALUE;
1921
+ return error;
1922
+ }
1923
+ if ((effect.f & 32768) === 0 && (effect.f & 4) === 0) throw error;
1924
+ invoke_error_boundary(error, effect);
1925
+ }
1926
+ /**
1927
+ * @param {unknown} error
1928
+ * @param {Effect | null} effect
1929
+ */
1930
+ function invoke_error_boundary(error, effect) {
1931
+ if (error === HYDRATION_ERROR) throw error;
1932
+ if (effect !== null && (effect.f & 16384) !== 0) return;
1933
+ while (effect !== null) {
1934
+ if ((effect.f & 128) !== 0 && (effect.f & 33570816) === 0) {
1935
+ if ((effect.f & 32768) === 0) throw error;
1936
+ try {
1937
+ /** @type {Boundary} */ effect.b.error(error);
1938
+ return;
1939
+ } catch (e) {
1940
+ error = e;
1941
+ }
1942
+ }
1943
+ effect = effect.parent;
1944
+ }
1945
+ throw error;
1946
+ }
1947
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/client/reactivity/effects.js
1948
+ /** @import { Blocker, ComponentContext, ComponentContextLegacy, Derived, Effect, TemplateNode, TransitionManager } from '#client' */
1949
+ /**
1950
+ * @param {Effect} effect
1951
+ * @param {Effect} parent_effect
1952
+ */
1953
+ function push_effect(effect, parent_effect) {
1954
+ var parent_last = parent_effect.last;
1955
+ if (parent_last === null) parent_effect.last = parent_effect.first = effect;
1956
+ else {
1957
+ parent_last.next = effect;
1958
+ effect.prev = parent_last;
1959
+ parent_effect.last = effect;
1960
+ }
1961
+ }
1962
+ /**
1963
+ * @param {number} type
1964
+ * @param {null | (() => void | (() => void))} fn
1965
+ * @returns {Effect}
1966
+ */
1967
+ function create_effect(type, fn) {
1968
+ var parent = active_effect;
1969
+ if (parent !== null && (parent.f & 8192) !== 0) type |= INERT;
1970
+ /** @type {Effect} */
1971
+ var effect = {
1972
+ ctx: component_context,
1973
+ deps: null,
1974
+ nodes: null,
1975
+ f: type | DIRTY | 512,
1976
+ first: null,
1977
+ fn,
1978
+ last: null,
1979
+ next: null,
1980
+ parent,
1981
+ b: parent && parent.b,
1982
+ prev: null,
1983
+ teardown: null,
1984
+ wv: 0,
1985
+ ac: null
1986
+ };
1987
+ current_batch?.register_created_effect(effect);
1988
+ /** @type {Effect | null} */
1989
+ var e = effect;
1990
+ if ((type & 4) !== 0) {
1991
+ if (collected_effects !== null) collected_effects.push(effect);
1992
+ else Batch.ensure().schedule(effect);
1993
+ } else if (fn !== null) {
1994
+ try {
1995
+ update_effect(effect);
1996
+ } catch (e) {
1997
+ destroy_effect(effect);
1998
+ throw e;
1999
+ }
2000
+ if (e.deps === null && e.teardown === null && e.nodes === null && e.first === e.last && (e.f & 524288) === 0) {
2001
+ e = e.first;
2002
+ if ((type & 16) !== 0 && (type & 65536) !== 0 && e !== null) e.f |= EFFECT_TRANSPARENT;
2003
+ }
2004
+ }
2005
+ if (e !== null) {
2006
+ e.parent = parent;
2007
+ if (parent !== null) push_effect(e, parent);
2008
+ if (active_reaction !== null && (active_reaction.f & 2) !== 0 && (type & 64) === 0) {
2009
+ var derived = active_reaction;
2010
+ (derived.effects ??= []).push(e);
2011
+ }
2012
+ }
2013
+ return effect;
2014
+ }
2015
+ /**
2016
+ * Internal representation of `$effect.tracking()`
2017
+ * @returns {boolean}
2018
+ */
2019
+ function effect_tracking() {
2020
+ return active_reaction !== null && !untracking;
2021
+ }
2022
+ /**
2023
+ * @param {() => void | (() => void)} fn
2024
+ */
2025
+ function create_user_effect(fn) {
2026
+ return create_effect(4 | USER_EFFECT, fn);
2027
+ }
2028
+ /**
2029
+ * Internal representation of `$effect.root(...)`
2030
+ * @param {() => void | (() => void)} fn
2031
+ * @returns {() => void}
2032
+ */
2033
+ function effect_root(fn) {
2034
+ Batch.ensure();
2035
+ const effect = create_effect(64 | EFFECT_PRESERVED, fn);
2036
+ return () => {
2037
+ destroy_effect(effect);
2038
+ };
2039
+ }
2040
+ /**
2041
+ * An effect root whose children can transition out
2042
+ * @param {() => void} fn
2043
+ * @returns {(options?: { outro?: boolean }) => Promise<void>}
2044
+ */
2045
+ function component_root(fn) {
2046
+ Batch.ensure();
2047
+ const effect = create_effect(64 | EFFECT_PRESERVED, fn);
2048
+ return (options = {}) => {
2049
+ return new Promise((fulfil) => {
2050
+ if (options.outro) pause_effect(effect, () => {
2051
+ destroy_effect(effect);
2052
+ fulfil(void 0);
2053
+ });
2054
+ else {
2055
+ destroy_effect(effect);
2056
+ fulfil(void 0);
2057
+ }
2058
+ });
2059
+ };
2060
+ }
2061
+ /**
2062
+ * @param {() => void | (() => void)} fn
2063
+ * @returns {Effect}
2064
+ */
2065
+ function render_effect(fn, flags = 0) {
2066
+ return create_effect(8 | flags, fn);
2067
+ }
2068
+ /**
2069
+ * @param {(() => void)} fn
2070
+ * @param {number} flags
2071
+ */
2072
+ function block(fn, flags = 0) {
2073
+ return create_effect(16 | flags, fn);
2074
+ }
2075
+ /**
2076
+ * @param {(() => void)} fn
2077
+ */
2078
+ function branch(fn) {
2079
+ return create_effect(32 | EFFECT_PRESERVED, fn);
2080
+ }
2081
+ /**
2082
+ * @param {Effect} effect
2083
+ */
2084
+ function execute_effect_teardown(effect) {
2085
+ var teardown = effect.teardown;
2086
+ if (teardown !== null) {
2087
+ const previously_destroying_effect = is_destroying_effect;
2088
+ const previous_reaction = active_reaction;
2089
+ set_is_destroying_effect(true);
2090
+ set_active_reaction(null);
2091
+ try {
2092
+ teardown.call(null);
2093
+ } catch (error) {
2094
+ invoke_error_boundary(error, effect.parent);
2095
+ } finally {
2096
+ set_is_destroying_effect(previously_destroying_effect);
2097
+ set_active_reaction(previous_reaction);
2098
+ }
2099
+ }
2100
+ }
2101
+ /**
2102
+ * @param {Effect} signal
2103
+ * @param {boolean} remove_dom
2104
+ * @returns {void}
2105
+ */
2106
+ function destroy_effect_children(signal, remove_dom = false) {
2107
+ var effect = signal.first;
2108
+ signal.first = signal.last = null;
2109
+ while (effect !== null) {
2110
+ const controller = effect.ac;
2111
+ if (controller !== null) without_reactive_context(() => {
2112
+ controller.abort(STALE_REACTION);
2113
+ });
2114
+ var next = effect.next;
2115
+ if ((effect.f & 64) !== 0) effect.parent = null;
2116
+ else destroy_effect(effect, remove_dom);
2117
+ effect = next;
2118
+ }
2119
+ }
2120
+ /**
2121
+ * @param {Effect} signal
2122
+ * @returns {void}
2123
+ */
2124
+ function destroy_block_effect_children(signal) {
2125
+ var effect = signal.first;
2126
+ while (effect !== null) {
2127
+ var next = effect.next;
2128
+ if ((effect.f & 32) === 0) destroy_effect(effect);
2129
+ effect = next;
2130
+ }
2131
+ }
2132
+ /**
2133
+ * @param {Effect} effect
2134
+ * @param {boolean} [remove_dom]
2135
+ * @returns {void}
2136
+ */
2137
+ function destroy_effect(effect, remove_dom = true) {
2138
+ var removed = false;
2139
+ if ((remove_dom || (effect.f & 262144) !== 0) && effect.nodes !== null && effect.nodes.end !== null) {
2140
+ remove_effect_dom(effect.nodes.start, effect.nodes.end);
2141
+ removed = true;
2142
+ }
2143
+ effect.f |= DESTROYING;
2144
+ destroy_effect_children(effect, remove_dom && !removed);
2145
+ remove_reactions(effect, 0);
2146
+ var transitions = effect.nodes && effect.nodes.t;
2147
+ if (transitions !== null) for (const transition of transitions) transition.stop();
2148
+ execute_effect_teardown(effect);
2149
+ effect.f ^= DESTROYING;
2150
+ effect.f |= DESTROYED;
2151
+ var parent = effect.parent;
2152
+ if (parent !== null && parent.first !== null) unlink_effect(effect);
2153
+ effect.next = effect.prev = effect.teardown = effect.ctx = effect.deps = effect.fn = effect.nodes = effect.ac = effect.b = null;
2154
+ }
2155
+ /**
2156
+ *
2157
+ * @param {TemplateNode | null} node
2158
+ * @param {TemplateNode} end
2159
+ */
2160
+ function remove_effect_dom(node, end) {
2161
+ while (node !== null) {
2162
+ /** @type {TemplateNode | null} */
2163
+ var next = node === end ? null : /* @__PURE__ */ get_next_sibling(node);
2164
+ node.remove();
2165
+ node = next;
2166
+ }
2167
+ }
2168
+ /**
2169
+ * Detach an effect from the effect tree, freeing up memory and
2170
+ * reducing the amount of work that happens on subsequent traversals
2171
+ * @param {Effect} effect
2172
+ */
2173
+ function unlink_effect(effect) {
2174
+ var parent = effect.parent;
2175
+ var prev = effect.prev;
2176
+ var next = effect.next;
2177
+ if (prev !== null) prev.next = next;
2178
+ if (next !== null) next.prev = prev;
2179
+ if (parent !== null) {
2180
+ if (parent.first === effect) parent.first = next;
2181
+ if (parent.last === effect) parent.last = prev;
2182
+ }
2183
+ }
2184
+ /**
2185
+ * When a block effect is removed, we don't immediately destroy it or yank it
2186
+ * out of the DOM, because it might have transitions. Instead, we 'pause' it.
2187
+ * It stays around (in memory, and in the DOM) until outro transitions have
2188
+ * completed, and if the state change is reversed then we _resume_ it.
2189
+ * A paused effect does not update, and the DOM subtree becomes inert.
2190
+ * @param {Effect} effect
2191
+ * @param {() => void} [callback]
2192
+ * @param {boolean} [destroy]
2193
+ */
2194
+ function pause_effect(effect, callback, destroy = true) {
2195
+ /** @type {TransitionManager[]} */
2196
+ var transitions = [];
2197
+ effect.f |= 256;
2198
+ pause_children(effect, transitions, true);
2199
+ var fn = () => {
2200
+ if (destroy) destroy_effect(effect);
2201
+ if (callback) callback();
2202
+ };
2203
+ var remaining = transitions.length;
2204
+ if (remaining > 0) {
2205
+ var check = () => --remaining || fn();
2206
+ for (var transition of transitions) transition.out(check);
2207
+ } else fn();
2208
+ }
2209
+ /**
2210
+ * @param {Effect} effect
2211
+ * @param {TransitionManager[]} transitions
2212
+ * @param {boolean} local
2213
+ */
2214
+ function pause_children(effect, transitions, local) {
2215
+ if ((effect.f & 8192) !== 0) return;
2216
+ effect.f ^= INERT;
2217
+ var t = effect.nodes && effect.nodes.t;
2218
+ if (t !== null) {
2219
+ for (const transition of t) if (transition.is_global || local) transitions.push(transition);
2220
+ }
2221
+ var child = effect.first;
2222
+ while (child !== null) {
2223
+ var sibling = child.next;
2224
+ if ((child.f & 64) === 0) {
2225
+ var transparent = (child.f & 65536) !== 0 || (child.f & 32) !== 0 && (effect.f & 16) !== 0;
2226
+ pause_children(child, transitions, transparent ? local : false);
2227
+ }
2228
+ child = sibling;
2229
+ }
2230
+ }
2231
+ /**
2232
+ * @param {Effect} effect
2233
+ * @param {DocumentFragment} fragment
2234
+ */
2235
+ function move_effect(effect, fragment) {
2236
+ if (!effect.nodes) return;
2237
+ /** @type {TemplateNode | null} */
2238
+ var node = effect.nodes.start;
2239
+ var end = effect.nodes.end;
2240
+ while (node !== null) {
2241
+ /** @type {TemplateNode | null} */
2242
+ var next = node === end ? null : /* @__PURE__ */ get_next_sibling(node);
2243
+ fragment.append(node);
2244
+ node = next;
2245
+ }
2246
+ }
2247
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/client/legacy.js
2248
+ /**
2249
+ * @type {Set<Value> | null}
2250
+ * @deprecated
2251
+ */
2252
+ var captured_signals = null;
2253
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/client/runtime.js
2254
+ /** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
2255
+ var is_destroying_effect = false;
2256
+ /** @param {boolean} value */
2257
+ function set_is_destroying_effect(value) {
2258
+ is_destroying_effect = value;
2259
+ }
2260
+ /** @type {null | Reaction} */
2261
+ var active_reaction = null;
2262
+ var untracking = false;
2263
+ /** @param {null | Reaction} reaction */
2264
+ function set_active_reaction(reaction) {
2265
+ active_reaction = reaction;
2266
+ }
2267
+ /** @type {null | Effect} */
2268
+ var active_effect = null;
2269
+ /** @param {null | Effect} effect */
2270
+ function set_active_effect(effect) {
2271
+ active_effect = effect;
2272
+ }
2273
+ /**
2274
+ * When sources are created within a reaction, reading and writing
2275
+ * them within that reaction should not cause a re-run
2276
+ * @type {null | Set<Value>}
2277
+ */
2278
+ var current_sources = null;
2279
+ /** @param {Value} value */
2280
+ function push_reaction_value(value) {
2281
+ if (active_reaction !== null && (!async_mode_flag && (active_reaction.f & 2097152) !== 0 || (active_reaction.f & 2) !== 0)) (current_sources ??= /* @__PURE__ */ new Set()).add(value);
2282
+ }
2283
+ /**
2284
+ * The dependencies of the reaction that is currently being executed. In many cases,
2285
+ * the dependencies are unchanged between runs, and so this will be `null` unless
2286
+ * and until a new dependency is accessed — we track this via `skipped_deps`
2287
+ * @type {null | Value[]}
2288
+ */
2289
+ var new_deps = null;
2290
+ var skipped_deps = 0;
2291
+ /**
2292
+ * Tracks writes that the effect it's executed in doesn't listen to yet,
2293
+ * so that the dependency can be added to the effect later on if it then reads it
2294
+ * @type {null | Value[]}
2295
+ */
2296
+ var untracked_writes = null;
2297
+ /** @param {null | Value[]} value */
2298
+ function set_untracked_writes(value) {
2299
+ untracked_writes = value;
2300
+ }
2301
+ /**
2302
+ * @type {number} Used by sources and deriveds for handling updates.
2303
+ * Version starts from 1 so that unowned deriveds differentiate between a created effect and a run one for tracing
2304
+ **/
2305
+ var write_version = 1;
2306
+ /** @type {number} Used to version each read of a source of derived to avoid duplicating dependencies inside a reaction */
2307
+ var read_version = 0;
2308
+ var update_version = read_version;
2309
+ /** @param {number} value */
2310
+ function set_update_version(value) {
2311
+ update_version = value;
2312
+ }
2313
+ function increment_write_version() {
2314
+ return ++write_version;
2315
+ }
2316
+ /**
2317
+ * Determines whether a derived or effect is dirty.
2318
+ * If it is MAYBE_DIRTY, will set the status to CLEAN
2319
+ * @param {Reaction} reaction
2320
+ * @returns {boolean}
2321
+ */
2322
+ function is_dirty(reaction) {
2323
+ var flags = reaction.f;
2324
+ if ((flags & 2048) !== 0) return true;
2325
+ if ((flags & 4096) !== 0) {
2326
+ var dependencies = reaction.deps;
2327
+ var length = dependencies.length;
2328
+ for (var i = 0; i < length; i++) {
2329
+ var dependency = dependencies[i];
2330
+ if (is_dirty(dependency)) update_derived(dependency);
2331
+ if (dependency.wv > reaction.wv) return true;
2332
+ }
2333
+ if ((flags & 512) !== 0 && batch_values === null) set_signal_status(reaction, CLEAN);
2334
+ }
2335
+ return false;
2336
+ }
2337
+ /**
2338
+ * @param {Value} signal
2339
+ * @param {Effect} effect
2340
+ * @param {boolean} [root]
2341
+ */
2342
+ function schedule_possible_effect_self_invalidation(signal, effect, root = true) {
2343
+ var reactions = signal.reactions;
2344
+ if (reactions === null) return;
2345
+ if (!async_mode_flag && current_sources !== null && current_sources.has(signal)) return;
2346
+ for (var i = 0; i < reactions.length; i++) {
2347
+ var reaction = reactions[i];
2348
+ if ((reaction.f & 2) !== 0) schedule_possible_effect_self_invalidation(reaction, effect, false);
2349
+ else if (effect === reaction) {
2350
+ if (root) set_signal_status(reaction, DIRTY);
2351
+ else if ((reaction.f & 1024) !== 0) set_signal_status(reaction, MAYBE_DIRTY);
2352
+ schedule_effect(reaction);
2353
+ }
2354
+ }
2355
+ }
2356
+ /** @param {Reaction} reaction */
2357
+ function update_reaction(reaction) {
2358
+ var previous_deps = new_deps;
2359
+ var previous_skipped_deps = skipped_deps;
2360
+ var previous_untracked_writes = untracked_writes;
2361
+ var previous_reaction = active_reaction;
2362
+ var previous_sources = current_sources;
2363
+ var previous_component_context = component_context;
2364
+ var previous_untracking = untracking;
2365
+ var previous_update_version = update_version;
2366
+ var flags = reaction.f;
2367
+ new_deps = null;
2368
+ skipped_deps = 0;
2369
+ untracked_writes = null;
2370
+ active_reaction = (flags & 96) === 0 ? reaction : null;
2371
+ current_sources = null;
2372
+ set_component_context(reaction.ctx);
2373
+ untracking = false;
2374
+ update_version = ++read_version;
2375
+ if (reaction.ac !== null) {
2376
+ without_reactive_context(() => {
2377
+ /** @type {AbortController} */ reaction.ac.abort(STALE_REACTION);
2378
+ });
2379
+ reaction.ac = null;
2380
+ }
2381
+ try {
2382
+ reaction.f |= REACTION_IS_UPDATING;
2383
+ var fn = reaction.fn;
2384
+ var result = fn();
2385
+ reaction.f |= REACTION_RAN;
2386
+ var deps = update_dependencies(reaction);
2387
+ if (is_runes() && untracked_writes !== null && !untracking && deps !== null && (reaction.f & 6146) === 0) for (var i = 0; i < untracked_writes.length; i++) schedule_possible_effect_self_invalidation(untracked_writes[i], reaction);
2388
+ if (previous_reaction !== null && previous_reaction !== reaction) {
2389
+ read_version++;
2390
+ if (previous_reaction.deps !== null) for (let i = 0; i < previous_skipped_deps; i += 1) previous_reaction.deps[i].rv = read_version;
2391
+ if (previous_deps !== null) for (const dep of previous_deps) dep.rv = read_version;
2392
+ if (untracked_writes !== null) {
2393
+ if (previous_untracked_writes === null) previous_untracked_writes = untracked_writes;
2394
+ else previous_untracked_writes.push(...untracked_writes);
2395
+ }
2396
+ }
2397
+ if ((reaction.f & 8388608) !== 0) reaction.f ^= ERROR_VALUE;
2398
+ return result;
2399
+ } catch (error) {
2400
+ update_dependencies(reaction);
2401
+ return handle_error(error);
2402
+ } finally {
2403
+ reaction.f ^= REACTION_IS_UPDATING;
2404
+ new_deps = previous_deps;
2405
+ skipped_deps = previous_skipped_deps;
2406
+ untracked_writes = previous_untracked_writes;
2407
+ active_reaction = previous_reaction;
2408
+ current_sources = previous_sources;
2409
+ set_component_context(previous_component_context);
2410
+ untracking = previous_untracking;
2411
+ update_version = previous_update_version;
2412
+ }
2413
+ }
2414
+ /**
2415
+ * @param {Reaction} reaction
2416
+ */
2417
+ function update_dependencies(reaction) {
2418
+ var deps = reaction.deps;
2419
+ var is_fork = current_batch?.is_fork;
2420
+ if (new_deps !== null) {
2421
+ var i;
2422
+ if (!is_fork) remove_reactions(reaction, skipped_deps);
2423
+ if (deps !== null && skipped_deps > 0) {
2424
+ deps.length = skipped_deps + new_deps.length;
2425
+ for (i = 0; i < new_deps.length; i++) deps[skipped_deps + i] = new_deps[i];
2426
+ } else reaction.deps = deps = new_deps;
2427
+ if (effect_tracking() && (reaction.f & 512) !== 0) for (i = skipped_deps; i < deps.length; i++) (deps[i].reactions ??= []).push(reaction);
2428
+ } else if (!is_fork && deps !== null && skipped_deps < deps.length) {
2429
+ remove_reactions(reaction, skipped_deps);
2430
+ deps.length = skipped_deps;
2431
+ }
2432
+ return deps;
2433
+ }
2434
+ /**
2435
+ * @template V
2436
+ * @param {Reaction} signal
2437
+ * @param {Value<V>} dependency
2438
+ * @returns {void}
2439
+ */
2440
+ function remove_reaction(signal, dependency) {
2441
+ let reactions = dependency.reactions;
2442
+ if (reactions !== null) {
2443
+ var index = index_of.call(reactions, signal);
2444
+ if (index !== -1) {
2445
+ var new_length = reactions.length - 1;
2446
+ if (new_length === 0) reactions = dependency.reactions = null;
2447
+ else {
2448
+ reactions[index] = reactions[new_length];
2449
+ reactions.pop();
2450
+ }
2451
+ }
2452
+ }
2453
+ if (reactions === null && (dependency.f & 2) !== 0 && (new_deps === null || !includes.call(new_deps, dependency))) {
2454
+ var derived = dependency;
2455
+ if ((derived.f & 512) !== 0) derived.f ^= 512;
2456
+ if (derived.v !== UNINITIALIZED) update_derived_status(derived);
2457
+ if (derived.ac !== null) without_reactive_context(() => {
2458
+ /** @type {AbortController} */ derived.ac.abort(STALE_REACTION);
2459
+ derived.ac = null;
2460
+ set_signal_status(derived, DIRTY);
2461
+ });
2462
+ freeze_derived_effects(derived);
2463
+ remove_reactions(derived, 0);
2464
+ }
2465
+ }
2466
+ /**
2467
+ * @param {Reaction} signal
2468
+ * @param {number} start_index
2469
+ * @returns {void}
2470
+ */
2471
+ function remove_reactions(signal, start_index) {
2472
+ var dependencies = signal.deps;
2473
+ if (dependencies === null) return;
2474
+ for (var i = start_index; i < dependencies.length; i++) remove_reaction(signal, dependencies[i]);
2475
+ }
2476
+ /**
2477
+ * @param {Effect} effect
2478
+ * @returns {void}
2479
+ */
2480
+ function update_effect(effect) {
2481
+ var flags = effect.f;
2482
+ if ((flags & 16384) !== 0) return;
2483
+ set_signal_status(effect, CLEAN);
2484
+ var previous_effect = active_effect;
2485
+ active_effect = effect;
2486
+ try {
2487
+ if ((flags & 16777232) !== 0) destroy_block_effect_children(effect);
2488
+ else destroy_effect_children(effect);
2489
+ execute_effect_teardown(effect);
2490
+ var teardown = update_reaction(effect);
2491
+ effect.teardown = typeof teardown === "function" ? teardown : null;
2492
+ effect.wv = write_version;
2493
+ } finally {
2494
+ active_effect = previous_effect;
2495
+ }
2496
+ }
2497
+ /**
2498
+ * @template V
2499
+ * @param {Value<V>} signal
2500
+ * @returns {V}
2501
+ */
2502
+ function get(signal) {
2503
+ var is_derived = (signal.f & 2) !== 0;
2504
+ captured_signals?.add(signal);
2505
+ if (active_reaction !== null && !untracking) {
2506
+ if (!(active_effect !== null && (active_effect.f & 16384) !== 0) && (current_sources === null || !current_sources.has(signal))) {
2507
+ var deps = active_reaction.deps;
2508
+ if ((active_reaction.f & 2097152) !== 0) {
2509
+ if (signal.rv < read_version) {
2510
+ signal.rv = read_version;
2511
+ if (new_deps === null && deps !== null && deps[skipped_deps] === signal) skipped_deps++;
2512
+ else if (new_deps === null) new_deps = [signal];
2513
+ else new_deps.push(signal);
2514
+ }
2515
+ } else {
2516
+ active_reaction.deps ??= [];
2517
+ if (!includes.call(active_reaction.deps, signal)) active_reaction.deps.push(signal);
2518
+ var reactions = signal.reactions;
2519
+ if (reactions === null) signal.reactions = [active_reaction];
2520
+ else if (!includes.call(reactions, active_reaction)) reactions.push(active_reaction);
2521
+ }
2522
+ }
2523
+ }
2524
+ if (is_destroying_effect && old_values.has(signal)) return old_values.get(signal);
2525
+ if (is_derived) {
2526
+ var derived = signal;
2527
+ if (is_destroying_effect) {
2528
+ var value = derived.v;
2529
+ if ((derived.f & 1024) === 0 && derived.reactions !== null || depends_on_old_values(derived)) value = execute_derived(derived);
2530
+ old_values.set(derived, value);
2531
+ return value;
2532
+ }
2533
+ var should_connect = (derived.f & 512) === 0 && !untracking && active_reaction !== null && (active_reaction.f & 512) !== 0;
2534
+ var is_new = (derived.f & REACTION_RAN) === 0;
2535
+ if (is_dirty(derived)) {
2536
+ if (should_connect) derived.f |= 512;
2537
+ update_derived(derived);
2538
+ }
2539
+ if (should_connect && !is_new) {
2540
+ unfreeze_derived_effects(derived);
2541
+ reconnect(derived);
2542
+ }
2543
+ }
2544
+ if (batch_values?.has(signal)) return batch_values.get(signal);
2545
+ if ((signal.f & 8388608) !== 0) throw signal.v;
2546
+ return signal.v;
2547
+ }
2548
+ /**
2549
+ * (Re)connect a disconnected derived, so that it is notified
2550
+ * of changes in `mark_reactions`
2551
+ * @param {Derived} derived
2552
+ */
2553
+ function reconnect(derived) {
2554
+ derived.f |= 512;
2555
+ if (derived.deps === null) return;
2556
+ for (const dep of derived.deps) {
2557
+ var reactions = dep.reactions;
2558
+ if (reactions === null) dep.reactions = [derived];
2559
+ else if (!includes.call(reactions, derived)) reactions.push(derived);
2560
+ if ((dep.f & 2) !== 0 && (dep.f & 512) === 0) {
2561
+ unfreeze_derived_effects(dep);
2562
+ reconnect(dep);
2563
+ }
2564
+ }
2565
+ }
2566
+ /** @param {Derived} derived */
2567
+ function depends_on_old_values(derived) {
2568
+ if (derived.v === UNINITIALIZED) return true;
2569
+ if (derived.deps === null) return false;
2570
+ for (const dep of derived.deps) {
2571
+ if (old_values.has(dep)) return true;
2572
+ if ((dep.f & 2) !== 0 && depends_on_old_values(dep)) return true;
2573
+ }
2574
+ return false;
2575
+ }
2576
+ /**
2577
+ * When used inside a [`$derived`](https://svelte.dev/docs/svelte/$derived) or [`$effect`](https://svelte.dev/docs/svelte/$effect),
2578
+ * any state read inside `fn` will not be treated as a dependency.
2579
+ *
2580
+ * ```ts
2581
+ * $effect(() => {
2582
+ * // this will run when `data` changes, but not when `time` changes
2583
+ * save(data, {
2584
+ * timestamp: untrack(() => time)
2585
+ * });
2586
+ * });
2587
+ * ```
2588
+ * @template T
2589
+ * @param {() => T} fn
2590
+ * @returns {T}
2591
+ */
2592
+ function untrack(fn) {
2593
+ var previous_untracking = untracking;
2594
+ try {
2595
+ untracking = true;
2596
+ return fn();
2597
+ } finally {
2598
+ untracking = previous_untracking;
2599
+ }
2600
+ }
2601
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/server/hydration.js
2602
+ var BLOCK_OPEN = `<!--[-->`;
2603
+ var BLOCK_CLOSE = `<!--]-->`;
2604
+ var EMPTY_COMMENT = `<!---->`;
2605
+ var VOID_ELEMENT_NAMES = [
2606
+ "area",
2607
+ "base",
2608
+ "br",
2609
+ "col",
2610
+ "command",
2611
+ "embed",
2612
+ "hr",
2613
+ "img",
2614
+ "input",
2615
+ "keygen",
2616
+ "link",
2617
+ "meta",
2618
+ "param",
2619
+ "source",
2620
+ "track",
2621
+ "wbr"
2622
+ ];
2623
+ /**
2624
+ * Returns `true` if `name` is of a void element
2625
+ * @param {string} name
2626
+ */
2627
+ function is_void(name) {
2628
+ return VOID_ELEMENT_NAMES.includes(name) || name.toLowerCase() === "!doctype";
2629
+ }
2630
+ /**
2631
+ * Attributes that are boolean, i.e. they are present or not present.
2632
+ */
2633
+ var DOM_BOOLEAN_ATTRIBUTES = [
2634
+ "allowfullscreen",
2635
+ "async",
2636
+ "autofocus",
2637
+ "autoplay",
2638
+ "checked",
2639
+ "controls",
2640
+ "default",
2641
+ "disabled",
2642
+ "formnovalidate",
2643
+ "indeterminate",
2644
+ "inert",
2645
+ "ismap",
2646
+ "loop",
2647
+ "multiple",
2648
+ "muted",
2649
+ "nomodule",
2650
+ "novalidate",
2651
+ "open",
2652
+ "playsinline",
2653
+ "readonly",
2654
+ "required",
2655
+ "reversed",
2656
+ "seamless",
2657
+ "selected",
2658
+ "webkitdirectory",
2659
+ "defer",
2660
+ "disablepictureinpicture",
2661
+ "disableremoteplayback"
2662
+ ];
2663
+ /**
2664
+ * Returns `true` if `name` is a boolean attribute
2665
+ * @param {string} name
2666
+ */
2667
+ function is_boolean_attribute(name) {
2668
+ return DOM_BOOLEAN_ATTRIBUTES.includes(name);
2669
+ }
2670
+ [...DOM_BOOLEAN_ATTRIBUTES];
2671
+ /**
2672
+ * Subset of delegated events which should be passive by default.
2673
+ * These two are already passive via browser defaults on window, document and body.
2674
+ * But since
2675
+ * - we're delegating them
2676
+ * - they happen often
2677
+ * - they apply to mobile which is generally less performant
2678
+ * we're marking them as passive by default for other elements, too.
2679
+ */
2680
+ var PASSIVE_EVENTS = ["touchstart", "touchmove"];
2681
+ /**
2682
+ * Returns `true` if `name` is a passive event
2683
+ * @param {string} name
2684
+ */
2685
+ function is_passive_event(name) {
2686
+ return PASSIVE_EVENTS.includes(name);
2687
+ }
2688
+ /** List of elements that require raw contents and should not have SSR comments put in them */
2689
+ var RAW_TEXT_ELEMENTS = [
2690
+ "textarea",
2691
+ "script",
2692
+ "style",
2693
+ "title"
2694
+ ];
2695
+ /** @param {string} name */
2696
+ function is_raw_text_element(name) {
2697
+ return RAW_TEXT_ELEMENTS.includes(name);
2698
+ }
2699
+ var REGEX_VALID_TAG_NAME = /^[a-zA-Z][a-zA-Z0-9]*(-[a-zA-Z0-9.\-_\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}]*)?$/u;
2700
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/server/errors.js
2701
+ /**
2702
+ * The node API `AsyncLocalStorage` is not available, but is required to use async server rendering.
2703
+ * @returns {never}
2704
+ */
2705
+ function async_local_storage_unavailable() {
2706
+ const error = /* @__PURE__ */ new Error(`async_local_storage_unavailable\nThe node API \`AsyncLocalStorage\` is not available, but is required to use async server rendering.\nhttps://svelte.dev/e/async_local_storage_unavailable`);
2707
+ error.name = "Svelte error";
2708
+ throw error;
2709
+ }
2710
+ /**
2711
+ * Encountered asynchronous work while rendering synchronously.
2712
+ * @returns {never}
2713
+ */
2714
+ function await_invalid() {
2715
+ const error = /* @__PURE__ */ new Error(`await_invalid\nEncountered asynchronous work while rendering synchronously.\nhttps://svelte.dev/e/await_invalid`);
2716
+ error.name = "Svelte error";
2717
+ throw error;
2718
+ }
2719
+ /**
2720
+ * `<svelte:element this="%tag%">` is not a valid element name — the element will not be rendered
2721
+ * @param {string} tag
2722
+ * @returns {never}
2723
+ */
2724
+ function dynamic_element_invalid_tag(tag) {
2725
+ const error = /* @__PURE__ */ new Error(`dynamic_element_invalid_tag\n\`<svelte:element this="${tag}">\` is not a valid element name — the element will not be rendered\nhttps://svelte.dev/e/dynamic_element_invalid_tag`);
2726
+ error.name = "Svelte error";
2727
+ throw error;
2728
+ }
2729
+ /**
2730
+ * The `html` property of server render results has been deprecated. Use `body` instead.
2731
+ * @returns {never}
2732
+ */
2733
+ function html_deprecated() {
2734
+ const error = /* @__PURE__ */ new Error(`html_deprecated\nThe \`html\` property of server render results has been deprecated. Use \`body\` instead.\nhttps://svelte.dev/e/html_deprecated`);
2735
+ error.name = "Svelte error";
2736
+ throw error;
2737
+ }
2738
+ /**
2739
+ * `csp.nonce` was set while `csp.hash` was `true`. These options cannot be used simultaneously.
2740
+ * @returns {never}
2741
+ */
2742
+ function invalid_csp() {
2743
+ const error = /* @__PURE__ */ new Error(`invalid_csp\n\`csp.nonce\` was set while \`csp.hash\` was \`true\`. These options cannot be used simultaneously.\nhttps://svelte.dev/e/invalid_csp`);
2744
+ error.name = "Svelte error";
2745
+ throw error;
2746
+ }
2747
+ /**
2748
+ * The `idPrefix` option cannot include `--`.
2749
+ * @returns {never}
2750
+ */
2751
+ function invalid_id_prefix() {
2752
+ const error = /* @__PURE__ */ new Error(`invalid_id_prefix\nThe \`idPrefix\` option cannot include \`--\`.\nhttps://svelte.dev/e/invalid_id_prefix`);
2753
+ error.name = "Svelte error";
2754
+ throw error;
2755
+ }
2756
+ /**
2757
+ * `%name%(...)` is not available on the server
2758
+ * @param {string} name
2759
+ * @returns {never}
2760
+ */
2761
+ function lifecycle_function_unavailable(name) {
2762
+ const error = /* @__PURE__ */ new Error(`lifecycle_function_unavailable\n\`${name}(...)\` is not available on the server\nhttps://svelte.dev/e/lifecycle_function_unavailable`);
2763
+ error.name = "Svelte error";
2764
+ throw error;
2765
+ }
2766
+ /**
2767
+ * Could not resolve `render` context.
2768
+ * @returns {never}
2769
+ */
2770
+ function server_context_required() {
2771
+ const error = /* @__PURE__ */ new Error(`server_context_required\nCould not resolve \`render\` context.\nhttps://svelte.dev/e/server_context_required`);
2772
+ error.name = "Svelte error";
2773
+ throw error;
2774
+ }
2775
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/server/context.js
2776
+ /** @import { SSRContext } from '#server' */
2777
+ /** @type {SSRContext | null} */
2778
+ var ssr_context = null;
2779
+ /** @param {SSRContext | null} v */
2780
+ function set_ssr_context(v) {
2781
+ ssr_context = v;
2782
+ }
2783
+ /**
2784
+ * @template T
2785
+ * @param {any} key
2786
+ * @returns {T}
2787
+ */
2788
+ function getContext(key) {
2789
+ return get_or_init_context_map(ssr_context, "getContext").get(key);
2790
+ }
2791
+ /**
2792
+ * @template T
2793
+ * @param {any} key
2794
+ * @param {T} context
2795
+ * @returns {T}
2796
+ */
2797
+ function setContext(key, context) {
2798
+ const context_map = get_or_init_context_map(ssr_context, "setContext");
2799
+ if (ssr_context.i) set_context_after_init();
2800
+ context_map.set(key, context);
2801
+ return context;
2802
+ }
2803
+ /**
2804
+ * @param {any} key
2805
+ * @returns {boolean}
2806
+ */
2807
+ function hasContext(key) {
2808
+ return get_or_init_context_map(ssr_context, "hasContext").has(key);
2809
+ }
2810
+ /** @returns {Map<any, any>} */
2811
+ function getAllContexts() {
2812
+ return get_or_init_context_map(ssr_context, "getAllContexts");
2813
+ }
2814
+ /**
2815
+ * @param {Function} [fn]
2816
+ */
2817
+ function push(fn) {
2818
+ ssr_context = {
2819
+ p: ssr_context,
2820
+ c: null,
2821
+ r: null,
2822
+ i: false
2823
+ };
2824
+ }
2825
+ function pop() {
2826
+ ssr_context = ssr_context.p;
2827
+ }
2828
+ /**
2829
+ * A `hydratable` value with key `%key%` was created, but at least part of it was not used during the render.
2830
+ *
2831
+ * The `hydratable` was initialized in:
2832
+ * %stack%
2833
+ * @param {string} key
2834
+ * @param {string} stack
2835
+ */
2836
+ function unresolved_hydratable(key, stack) {
2837
+ console.warn(`https://svelte.dev/e/unresolved_hydratable`);
2838
+ }
2839
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/server/render-context.js
2840
+ /** @import { AsyncLocalStorage } from 'node:async_hooks' */
2841
+ /** @import { RenderContext } from '#server' */
2842
+ /** @type {Promise<void> | null} */
2843
+ var current_render = null;
2844
+ /** @type {RenderContext | null} */
2845
+ var context = null;
2846
+ /** @returns {RenderContext} */
2847
+ function get_render_context() {
2848
+ const store = context ?? als?.getStore();
2849
+ if (!store) server_context_required();
2850
+ return store;
2851
+ }
2852
+ /**
2853
+ * @template T
2854
+ * @param {() => Promise<T>} fn
2855
+ * @returns {Promise<T>}
2856
+ */
2857
+ async function with_render_context(fn) {
2858
+ context = { hydratable: {
2859
+ lookup: /* @__PURE__ */ new Map(),
2860
+ comparisons: [],
2861
+ unresolved_promises: /* @__PURE__ */ new Map()
2862
+ } };
2863
+ if (in_webcontainer()) {
2864
+ const { promise, resolve } = deferred();
2865
+ const previous_render = current_render;
2866
+ current_render = promise;
2867
+ await previous_render;
2868
+ return fn().finally(resolve);
2869
+ }
2870
+ try {
2871
+ if (als === null) async_local_storage_unavailable();
2872
+ return als.run(context, fn);
2873
+ } finally {
2874
+ context = null;
2875
+ }
2876
+ }
2877
+ /** @type {AsyncLocalStorage<RenderContext | null> | null} */
2878
+ var als = null;
2879
+ /** @type {Promise<void> | null} */
2880
+ var als_import = null;
2881
+ /**
2882
+ *
2883
+ * @returns {Promise<void>}
2884
+ */
2885
+ function init_render_context() {
2886
+ als_import ??= import("node:async_hooks").then((hooks) => {
2887
+ als = new hooks.AsyncLocalStorage();
2888
+ }).then(noop, noop);
2889
+ return als_import;
2890
+ }
2891
+ function in_webcontainer() {
2892
+ return !!globalThis.process?.versions?.webcontainer;
2893
+ }
2894
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/server/crypto.js
2895
+ var text_encoder;
2896
+ var crypto;
2897
+ /** @param {string} module_name */
2898
+ var obfuscated_import = (module_name) => import(
2899
+ /* @vite-ignore */
2900
+ module_name
2901
+ );
2902
+ /** @param {string} data */
2903
+ async function sha256(data) {
2904
+ text_encoder ??= new TextEncoder();
2905
+ crypto ??= globalThis.crypto?.subtle?.digest ? globalThis.crypto : (await obfuscated_import("node:crypto")).webcrypto;
2906
+ return base64_encode(await crypto.subtle.digest("SHA-256", text_encoder.encode(data)));
2907
+ }
2908
+ /**
2909
+ * @param {Uint8Array} bytes
2910
+ * @returns {string}
2911
+ */
2912
+ function base64_encode(bytes) {
2913
+ if (globalThis.Buffer) return globalThis.Buffer.from(bytes).toString("base64");
2914
+ let binary = "";
2915
+ for (let i = 0; i < bytes.length; i++) binary += String.fromCharCode(bytes[i]);
2916
+ return btoa(binary);
2917
+ }
2918
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/server/renderer.js
2919
+ /** @import { Component } from 'svelte' */
2920
+ /** @import { HydratableContext, SSRContext } from './types.js' */
2921
+ /** @import { Csp, RenderOutput, SyncRenderOutput, Sha256Source } from '../../server/public.js' */
2922
+ /** @import { MaybePromise } from '#shared' */
2923
+ /** @typedef {'head' | 'body'} RendererType */
2924
+ /** @typedef {{ [key in RendererType]: string }} AccumulatedContent */
2925
+ /**
2926
+ * @typedef {string | Renderer} RendererItem
2927
+ */
2928
+ var RenderResult = class {
2929
+ /** @type {() => AccumulatedContent} */
2930
+ #render;
2931
+ /** @type {() => Promise<AccumulatedContent & { hashes: { script: Sha256Source[] } }>} */
2932
+ #render_async;
2933
+ /** @type {AccumulatedContent | undefined} */
2934
+ #sync;
2935
+ /** @type {{ script: '' }} */
2936
+ #hashes = { script: "" };
2937
+ /** @type {Promise<AccumulatedContent & { hashes: { script: Sha256Source[] } }> | undefined} */
2938
+ #promise;
2939
+ /**
2940
+ * @param {() => AccumulatedContent} render
2941
+ * @param {() => Promise<AccumulatedContent & { hashes: { script: Sha256Source[] } }>} render_async
2942
+ */
2943
+ constructor(render, render_async) {
2944
+ this.#render = render;
2945
+ this.#render_async = render_async;
2946
+ }
2947
+ #get() {
2948
+ return this.#sync ??= this.#render();
2949
+ }
2950
+ get html() {
2951
+ return this.#get().body;
2952
+ }
2953
+ get head() {
2954
+ return this.#get().head;
2955
+ }
2956
+ get body() {
2957
+ return this.#get().body;
2958
+ }
2959
+ get hashes() {
2960
+ return this.#hashes;
2961
+ }
2962
+ /**
2963
+ * This is not type-safe, but honestly it's the best I can do right now, and it's a straightforward function.
2964
+ *
2965
+ * @template TResult1
2966
+ * @template [TResult2=never]
2967
+ * @param {(value: SyncRenderOutput) => TResult1} onfulfilled
2968
+ * @param {(reason: unknown) => TResult2} onrejected
2969
+ */
2970
+ then(onfulfilled, onrejected) {
2971
+ if (!async_mode_flag) {
2972
+ const result = this.#get();
2973
+ const user_result = onfulfilled({
2974
+ head: result.head,
2975
+ body: result.body,
2976
+ html: result.body,
2977
+ hashes: { script: [] }
2978
+ });
2979
+ return Promise.resolve(user_result);
2980
+ }
2981
+ this.#promise ??= this.#render_async().then((result) => {
2982
+ Object.defineProperty(result, "html", { get: () => {
2983
+ html_deprecated();
2984
+ } });
2985
+ return result;
2986
+ });
2987
+ return this.#promise.then((result) => onfulfilled(result), onrejected);
2988
+ }
2989
+ };
2990
+ /**
2991
+ * Renderers are basically a tree of `string | Renderer`s, where each `Renderer` in the tree represents
2992
+ * work that may or may not have completed. A renderer can be {@link collect}ed to aggregate the
2993
+ * content from itself and all of its children, but this will throw if any of the children are
2994
+ * performing asynchronous work. To asynchronously collect a renderer, just `await` it.
2995
+ *
2996
+ * The `string` values within a renderer are always associated with the {@link type} of that renderer. To switch types,
2997
+ * call {@link child} with a different `type` argument.
2998
+ */
2999
+ var Renderer = class Renderer {
3000
+ /**
3001
+ * The contents of the renderer.
3002
+ * @type {RendererItem[]}
3003
+ */
3004
+ #out = [];
3005
+ /**
3006
+ * Any `onDestroy` callbacks registered during execution of this renderer.
3007
+ * @type {(() => void)[] | undefined}
3008
+ */
3009
+ #on_destroy = void 0;
3010
+ /**
3011
+ * Whether this renderer is a component body.
3012
+ * @type {boolean}
3013
+ */
3014
+ #is_component_body = false;
3015
+ /**
3016
+ * If set, this renderer is an error boundary. When async collection
3017
+ * of the children fails, the failed snippet is rendered instead.
3018
+ * @type {{
3019
+ * failed: (renderer: Renderer, error: unknown, reset: () => void) => void;
3020
+ * transformError: (error: unknown) => unknown;
3021
+ * context: SSRContext | null;
3022
+ * } | null}
3023
+ */
3024
+ #boundary = null;
3025
+ /**
3026
+ * The type of string content that this renderer is accumulating.
3027
+ * @type {RendererType}
3028
+ */
3029
+ type;
3030
+ /** @type {Renderer | undefined} */
3031
+ #parent;
3032
+ /**
3033
+ * Asynchronous work associated with this renderer
3034
+ * @type {Promise<void> | undefined}
3035
+ */
3036
+ promise = void 0;
3037
+ /**
3038
+ * State which is associated with the content tree as a whole.
3039
+ * It will be re-exposed, uncopied, on all children.
3040
+ * @type {SSRState}
3041
+ * @readonly
3042
+ */
3043
+ global;
3044
+ /**
3045
+ * State that is local to the branch it is declared in.
3046
+ * It will be shallow-copied to all children.
3047
+ *
3048
+ * @type {{ select_value: any, multiple: boolean }}
3049
+ */
3050
+ local;
3051
+ /**
3052
+ * @param {SSRState} global
3053
+ * @param {Renderer | undefined} [parent]
3054
+ */
3055
+ constructor(global, parent) {
3056
+ this.#parent = parent;
3057
+ this.global = global;
3058
+ this.local = parent ? { ...parent.local } : {
3059
+ select_value: void 0,
3060
+ multiple: false
3061
+ };
3062
+ this.type = parent ? parent.type : "body";
3063
+ }
3064
+ /**
3065
+ * @param {(renderer: Renderer) => void} fn
3066
+ */
3067
+ head(fn) {
3068
+ const head = new Renderer(this.global, this);
3069
+ head.type = "head";
3070
+ this.#out.push(head);
3071
+ head.child(fn);
3072
+ }
3073
+ /**
3074
+ * @param {Array<Promise<void>>} blockers
3075
+ * @param {(renderer: Renderer) => void} fn
3076
+ */
3077
+ async_block(blockers, fn) {
3078
+ this.#out.push(BLOCK_OPEN);
3079
+ this.async(blockers, fn);
3080
+ this.#out.push(BLOCK_CLOSE);
3081
+ }
3082
+ /**
3083
+ * @param {Array<Promise<void>>} blockers
3084
+ * @param {(renderer: Renderer) => void} fn
3085
+ */
3086
+ async(blockers, fn) {
3087
+ let callback = fn;
3088
+ if (blockers.length > 0) {
3089
+ const context = ssr_context;
3090
+ callback = (renderer) => {
3091
+ return Promise.all(blockers).then(() => {
3092
+ const previous_context = ssr_context;
3093
+ try {
3094
+ set_ssr_context(context);
3095
+ return fn(renderer);
3096
+ } finally {
3097
+ set_ssr_context(previous_context);
3098
+ }
3099
+ });
3100
+ };
3101
+ }
3102
+ this.child(callback);
3103
+ }
3104
+ /**
3105
+ * @param {Array<() => void>} thunks
3106
+ */
3107
+ run(thunks) {
3108
+ const context = ssr_context;
3109
+ let promise = Promise.resolve(thunks[0]());
3110
+ const promises = [promise];
3111
+ if (context !== null && thunks.length > 1) context.i = true;
3112
+ for (const fn of thunks.slice(1)) {
3113
+ promise = promise.then(() => {
3114
+ const previous_context = ssr_context;
3115
+ set_ssr_context(context);
3116
+ try {
3117
+ return fn();
3118
+ } finally {
3119
+ set_ssr_context(previous_context);
3120
+ }
3121
+ });
3122
+ promises.push(promise);
3123
+ }
3124
+ promise.catch(noop);
3125
+ this.promise = this.global.track(promise);
3126
+ return promises;
3127
+ }
3128
+ /**
3129
+ * @param {(renderer: Renderer) => MaybePromise<void>} fn
3130
+ */
3131
+ child_block(fn) {
3132
+ this.#out.push(BLOCK_OPEN);
3133
+ this.child(fn);
3134
+ this.#out.push(BLOCK_CLOSE);
3135
+ }
3136
+ /**
3137
+ * Create a child renderer. The child renderer inherits the state from the parent,
3138
+ * but has its own content.
3139
+ * @param {(renderer: Renderer) => MaybePromise<void>} fn
3140
+ */
3141
+ child(fn) {
3142
+ const child = new Renderer(this.global, this);
3143
+ this.#out.push(child);
3144
+ const parent = ssr_context;
3145
+ set_ssr_context({
3146
+ ...ssr_context,
3147
+ p: parent,
3148
+ c: null,
3149
+ r: child,
3150
+ i: ssr_context?.i ?? false
3151
+ });
3152
+ const result = fn(child);
3153
+ set_ssr_context(parent);
3154
+ if (result instanceof Promise) {
3155
+ result.catch(noop);
3156
+ result.finally(() => set_ssr_context(null)).catch(noop);
3157
+ if (child.global.mode === "sync") await_invalid();
3158
+ child.promise = child.global.track(result);
3159
+ }
3160
+ return child;
3161
+ }
3162
+ /**
3163
+ * Render children inside an error boundary. If the children throw and the API-level
3164
+ * `transformError` transform handles the error (doesn't re-throw), the `failed` snippet is
3165
+ * rendered instead. Otherwise the error propagates.
3166
+ *
3167
+ * @param {{ failed?: (renderer: Renderer, error: unknown, reset: () => void) => void }} props
3168
+ * @param {(renderer: Renderer) => MaybePromise<void>} children_fn
3169
+ */
3170
+ boundary(props, children_fn) {
3171
+ const child = new Renderer(this.global, this);
3172
+ this.#out.push(child);
3173
+ const parent_context = ssr_context;
3174
+ if (props.failed) child.#boundary = {
3175
+ failed: props.failed,
3176
+ transformError: this.global.transformError,
3177
+ context: parent_context
3178
+ };
3179
+ set_ssr_context({
3180
+ ...ssr_context,
3181
+ p: parent_context,
3182
+ c: null,
3183
+ r: child,
3184
+ i: ssr_context?.i ?? false
3185
+ });
3186
+ try {
3187
+ const result = children_fn(child);
3188
+ set_ssr_context(parent_context);
3189
+ if (result instanceof Promise) {
3190
+ if (child.global.mode === "sync") await_invalid();
3191
+ result.catch(noop);
3192
+ child.promise = child.global.track(result);
3193
+ }
3194
+ } catch (error) {
3195
+ set_ssr_context(parent_context);
3196
+ const failed_snippet = props.failed;
3197
+ if (!failed_snippet) throw error;
3198
+ const result = this.global.transformError(error);
3199
+ child.#out.length = 0;
3200
+ child.#boundary = null;
3201
+ if (result instanceof Promise) {
3202
+ if (this.global.mode === "sync") await_invalid();
3203
+ child.promise = child.global.track(
3204
+ /** @type {Promise<unknown>} */
3205
+ result.then((transformed) => {
3206
+ set_ssr_context(parent_context);
3207
+ child.#out.push(Renderer.#serialize_failed_boundary(transformed));
3208
+ failed_snippet(child, transformed, noop);
3209
+ child.#out.push(BLOCK_CLOSE);
3210
+ })
3211
+ );
3212
+ child.promise.catch(noop);
3213
+ } else {
3214
+ child.#out.push(Renderer.#serialize_failed_boundary(result));
3215
+ failed_snippet(child, result, noop);
3216
+ child.#out.push(BLOCK_CLOSE);
3217
+ }
3218
+ }
3219
+ }
3220
+ /**
3221
+ * Create a component renderer. The component renderer inherits the state from the parent,
3222
+ * but has its own content. It is treated as an ordering boundary for ondestroy callbacks.
3223
+ * @param {(renderer: Renderer) => MaybePromise<void>} fn
3224
+ * @param {Function} [component_fn]
3225
+ * @returns {void}
3226
+ */
3227
+ component(fn, component_fn) {
3228
+ push(component_fn);
3229
+ this.child((renderer) => {
3230
+ renderer.#is_component_body = true;
3231
+ return fn(renderer);
3232
+ });
3233
+ pop();
3234
+ }
3235
+ /**
3236
+ * @param {Record<string, any>} attrs
3237
+ * @param {(renderer: Renderer) => void} fn
3238
+ * @param {string | undefined} [css_hash]
3239
+ * @param {Record<string, boolean> | undefined} [classes]
3240
+ * @param {Record<string, string> | undefined} [styles]
3241
+ * @param {number | undefined} [flags]
3242
+ * @param {boolean | undefined} [is_rich]
3243
+ * @returns {void}
3244
+ */
3245
+ select(attrs, fn, css_hash, classes, styles, flags, is_rich) {
3246
+ const { value, defaultValue, ...select_attrs } = attrs;
3247
+ if (select_attrs.multiple === "") select_attrs.multiple = true;
3248
+ this.push(`<select${attributes(select_attrs, css_hash, classes, styles, flags)}>`);
3249
+ this.child((renderer) => {
3250
+ renderer.local.select_value = value === void 0 ? defaultValue : value;
3251
+ renderer.local.multiple = !!select_attrs.multiple;
3252
+ fn(renderer);
3253
+ });
3254
+ this.push(`${is_rich ? "<!>" : ""}</select>`);
3255
+ }
3256
+ /**
3257
+ * @param {Record<string, any>} attrs
3258
+ * @param {string | number | boolean | ((renderer: Renderer) => void)} body
3259
+ * @param {string | undefined} [css_hash]
3260
+ * @param {Record<string, boolean> | undefined} [classes]
3261
+ * @param {Record<string, string> | undefined} [styles]
3262
+ * @param {number | undefined} [flags]
3263
+ * @param {boolean | undefined} [is_rich]
3264
+ */
3265
+ option(attrs, body, css_hash, classes, styles, flags, is_rich) {
3266
+ this.#out.push(`<option${attributes(attrs, css_hash, classes, styles, flags)}`);
3267
+ /**
3268
+ * @param {Renderer} renderer
3269
+ * @param {any} value
3270
+ * @param {{ head?: string, body: any }} content
3271
+ */
3272
+ const close = (renderer, value, { head, body }) => {
3273
+ if (has_own_property.call(attrs, "value")) value = attrs.value;
3274
+ var select_value = this.local.select_value;
3275
+ if (this.local.multiple && is_array(select_value) ? select_value.includes(value) : value === select_value) renderer.#out.push(" selected=\"\"");
3276
+ renderer.#out.push(`>${body}${is_rich ? "<!>" : ""}</option>`);
3277
+ if (head) renderer.head((child) => child.push(head));
3278
+ };
3279
+ if (typeof body === "function") this.child((renderer) => {
3280
+ const r = new Renderer(this.global, this);
3281
+ body(r);
3282
+ if (this.global.mode === "async") return r.#collect_content_async().then((content) => {
3283
+ close(renderer, content.body.replaceAll("<!---->", ""), content);
3284
+ });
3285
+ else {
3286
+ const content = r.#collect_content();
3287
+ close(renderer, content.body.replaceAll("<!---->", ""), content);
3288
+ }
3289
+ });
3290
+ else close(this, body, { body: escape_html(body) });
3291
+ }
3292
+ /**
3293
+ * @param {(renderer: Renderer) => void} fn
3294
+ */
3295
+ title(fn) {
3296
+ const path = this.get_path();
3297
+ /** @param {string} head */
3298
+ const close = (head) => {
3299
+ this.global.set_title(head, path);
3300
+ };
3301
+ this.child((renderer) => {
3302
+ const r = new Renderer(renderer.global, renderer);
3303
+ fn(r);
3304
+ if (renderer.global.mode === "async") return r.#collect_content_async().then((content) => {
3305
+ close(content.head);
3306
+ });
3307
+ else {
3308
+ const content = r.#collect_content();
3309
+ close(content.head);
3310
+ }
3311
+ });
3312
+ }
3313
+ /**
3314
+ * @param {string | (() => Promise<string>)} content
3315
+ */
3316
+ push(content) {
3317
+ if (typeof content === "function") this.child(async (renderer) => renderer.push(await content()));
3318
+ else this.#out.push(content);
3319
+ }
3320
+ /**
3321
+ * @param {() => void} fn
3322
+ */
3323
+ on_destroy(fn) {
3324
+ (this.#on_destroy ??= []).push(fn);
3325
+ }
3326
+ /**
3327
+ * @returns {number[]}
3328
+ */
3329
+ get_path() {
3330
+ return this.#parent ? [...this.#parent.get_path(), this.#parent.#out.indexOf(this)] : [];
3331
+ }
3332
+ /**
3333
+ * @deprecated this is needed for legacy component bindings
3334
+ */
3335
+ copy() {
3336
+ const copy = new Renderer(this.global, this.#parent);
3337
+ copy.type = this.type;
3338
+ copy.#out = this.#out.map((item) => item instanceof Renderer ? item.copy() : item);
3339
+ copy.promise = this.promise;
3340
+ return copy;
3341
+ }
3342
+ /**
3343
+ * @param {Renderer} other
3344
+ * @deprecated this is needed for legacy component bindings
3345
+ */
3346
+ subsume(other) {
3347
+ if (this.global.mode !== other.global.mode) throw new Error("invariant: A renderer cannot switch modes. If you're seeing this, there's a compiler bug. File an issue!");
3348
+ this.local = other.local;
3349
+ this.#out = other.#out.map((item, i) => {
3350
+ const current = this.#out[i];
3351
+ if (current instanceof Renderer && item instanceof Renderer) {
3352
+ current.subsume(item);
3353
+ return current;
3354
+ }
3355
+ return item;
3356
+ });
3357
+ this.promise = other.promise;
3358
+ this.type = other.type;
3359
+ }
3360
+ get length() {
3361
+ return this.#out.length;
3362
+ }
3363
+ /**
3364
+ * Creates the hydration comment that marks the start of a failed boundary.
3365
+ * The error is JSON-serialized and embedded inside an HTML comment for the client
3366
+ * to parse during hydration. The JSON is escaped to prevent `-->` or `<!--` sequences
3367
+ * from breaking out of the comment (XSS). Uses unicode escapes which `JSON.parse()`
3368
+ * handles transparently.
3369
+ * @param {unknown} error
3370
+ * @returns {string}
3371
+ */
3372
+ static #serialize_failed_boundary(error) {
3373
+ return `<!--[?${JSON.stringify(error).replace(/>/g, "\\u003e").replace(/</g, "\\u003c")}-->`;
3374
+ }
3375
+ /**
3376
+ * Only available on the server and when compiling with the `server` option.
3377
+ * 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.
3378
+ * @template {Record<string, any>} Props
3379
+ * @param {Component<Props>} component
3380
+ * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string; csp?: Csp }} [options]
3381
+ * @returns {RenderOutput}
3382
+ */
3383
+ static render(component, options = {}) {
3384
+ return new RenderResult(() => Renderer.#render(component, options), () => init_render_context().then(() => with_render_context(() => Renderer.#render_async(component, options))));
3385
+ }
3386
+ /**
3387
+ * Collect all of the `onDestroy` callbacks registered during rendering. In an async context, this is only safe to call
3388
+ * after awaiting `collect_async`.
3389
+ *
3390
+ * Child renderers are "porous" and don't affect execution order, but component body renderers
3391
+ * create ordering boundaries. Within a renderer, callbacks run in order until hitting a component boundary.
3392
+ * @returns {Iterable<() => void>}
3393
+ */
3394
+ *#collect_on_destroy() {
3395
+ for (const component of this.#traverse_components()) yield* component.#collect_ondestroy();
3396
+ }
3397
+ /**
3398
+ * Performs a depth-first search of renderers, yielding the deepest components first, then additional components as we backtrack up the tree.
3399
+ * @returns {Iterable<Renderer>}
3400
+ */
3401
+ *#traverse_components() {
3402
+ for (const child of this.#out) if (typeof child !== "string") yield* child.#traverse_components();
3403
+ if (this.#is_component_body) yield this;
3404
+ }
3405
+ /**
3406
+ * @returns {Iterable<() => void>}
3407
+ */
3408
+ *#collect_ondestroy() {
3409
+ if (this.#on_destroy) for (const fn of this.#on_destroy) yield fn;
3410
+ for (const child of this.#out) if (child instanceof Renderer && !child.#is_component_body) yield* child.#collect_ondestroy();
3411
+ }
3412
+ /**
3413
+ * Runs every `onDestroy` callback in this renderer tree. On a failed render,
3414
+ * cleanup errors are suppressed so they do not mask the render error.
3415
+ * @param {boolean} suppress_errors
3416
+ */
3417
+ #run_on_destroy(suppress_errors) {
3418
+ let first_error;
3419
+ let has_error = false;
3420
+ for (const cleanup of this.#collect_on_destroy()) try {
3421
+ cleanup();
3422
+ } catch (error) {
3423
+ if (!suppress_errors && !has_error) {
3424
+ first_error = error;
3425
+ has_error = true;
3426
+ }
3427
+ }
3428
+ if (has_error) throw first_error;
3429
+ }
3430
+ /**
3431
+ * @param {'sync' | 'async'} mode
3432
+ * @param {{ idPrefix?: string; csp?: Csp; transformError?: (error: unknown) => unknown }} options
3433
+ * @returns {Renderer}
3434
+ */
3435
+ static #create(mode, options) {
3436
+ if (options.idPrefix?.includes("--")) invalid_id_prefix();
3437
+ return new Renderer(new SSRState(mode, options.idPrefix ? options.idPrefix + "-" : "", options.csp, options.transformError));
3438
+ }
3439
+ /**
3440
+ * Render a component. Throws if any of the children are performing asynchronous work.
3441
+ *
3442
+ * @template {Record<string, any>} Props
3443
+ * @param {Component<Props>} component
3444
+ * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string }} options
3445
+ * @returns {AccumulatedContent}
3446
+ */
3447
+ static #render(component, options) {
3448
+ var previous_context = ssr_context;
3449
+ const renderer = Renderer.#create("sync", options);
3450
+ /** @type {AccumulatedContent | undefined} */
3451
+ let result;
3452
+ let render_error;
3453
+ let failed = false;
3454
+ try {
3455
+ try {
3456
+ Renderer.#open_render(renderer, component, options);
3457
+ result = Renderer.#close_render(renderer.#collect_content(), renderer);
3458
+ } catch (error) {
3459
+ render_error = error;
3460
+ failed = true;
3461
+ }
3462
+ renderer.#run_on_destroy(failed);
3463
+ if (failed) throw render_error;
3464
+ return result;
3465
+ } finally {
3466
+ renderer.global.abort();
3467
+ set_ssr_context(previous_context);
3468
+ }
3469
+ }
3470
+ /**
3471
+ * Render a component.
3472
+ *
3473
+ * @template {Record<string, any>} Props
3474
+ * @param {Component<Props>} component
3475
+ * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string; csp?: Csp }} options
3476
+ * @returns {Promise<AccumulatedContent & { hashes: { script: Sha256Source[] } }>}
3477
+ */
3478
+ static async #render_async(component, options) {
3479
+ const previous_context = ssr_context;
3480
+ const renderer = Renderer.#create("async", options);
3481
+ /** @type {(AccumulatedContent & { hashes: { script: Sha256Source[] } }) | undefined} */
3482
+ let result;
3483
+ let render_error;
3484
+ let failed = false;
3485
+ try {
3486
+ try {
3487
+ Renderer.#open_render(renderer, component, options);
3488
+ const content = await renderer.#collect_content_async();
3489
+ const hydratables = await renderer.#collect_hydratables();
3490
+ if (hydratables !== null) content.head = hydratables + content.head;
3491
+ result = Renderer.#close_render(content, renderer);
3492
+ } catch (error) {
3493
+ render_error = error;
3494
+ failed = true;
3495
+ renderer.global.abort();
3496
+ await renderer.global.settle();
3497
+ }
3498
+ renderer.#run_on_destroy(failed);
3499
+ if (failed) throw render_error;
3500
+ return result;
3501
+ } finally {
3502
+ set_ssr_context(previous_context);
3503
+ renderer.global.abort();
3504
+ }
3505
+ }
3506
+ /**
3507
+ * Collect all of the code from the `out` array and return it as a string, or a promise resolving to a string.
3508
+ * @param {AccumulatedContent} content
3509
+ * @returns {AccumulatedContent}
3510
+ */
3511
+ #collect_content(content = {
3512
+ head: "",
3513
+ body: ""
3514
+ }) {
3515
+ for (const item of this.#out) if (typeof item === "string") content[this.type] += item;
3516
+ else if (item instanceof Renderer) item.#collect_content(content);
3517
+ return content;
3518
+ }
3519
+ /**
3520
+ * Collect all of the code from the `out` array and return it as a string.
3521
+ * @param {AccumulatedContent} content
3522
+ * @returns {Promise<AccumulatedContent>}
3523
+ */
3524
+ async #collect_content_async(content = {
3525
+ head: "",
3526
+ body: ""
3527
+ }) {
3528
+ await this.promise;
3529
+ for (const item of this.#out) if (typeof item === "string") content[this.type] += item;
3530
+ else if (item instanceof Renderer) {
3531
+ if (item.#boundary) {
3532
+ /** @type {AccumulatedContent} */
3533
+ const boundary_content = {
3534
+ head: "",
3535
+ body: ""
3536
+ };
3537
+ try {
3538
+ await item.#collect_content_async(boundary_content);
3539
+ content.head += boundary_content.head;
3540
+ content.body += boundary_content.body;
3541
+ } catch (error) {
3542
+ const { context, failed, transformError } = item.#boundary;
3543
+ set_ssr_context(context);
3544
+ let promise = transformError(error);
3545
+ set_ssr_context(null);
3546
+ let transformed = await promise;
3547
+ set_ssr_context(context);
3548
+ const failed_renderer = new Renderer(item.global, item);
3549
+ failed_renderer.type = item.type;
3550
+ failed_renderer.#out.push(Renderer.#serialize_failed_boundary(transformed));
3551
+ failed(failed_renderer, transformed, noop);
3552
+ failed_renderer.#out.push(BLOCK_CLOSE);
3553
+ await failed_renderer.#collect_content_async(content);
3554
+ }
3555
+ } else await item.#collect_content_async(content);
3556
+ }
3557
+ return content;
3558
+ }
3559
+ async #collect_hydratables() {
3560
+ const ctx = get_render_context().hydratable;
3561
+ for (const [_, key] of ctx.unresolved_promises) unresolved_hydratable(key, ctx.lookup.get(key)?.stack ?? "<missing stack trace>");
3562
+ for (const comparison of ctx.comparisons) await comparison;
3563
+ return await this.#hydratable_block(ctx);
3564
+ }
3565
+ /**
3566
+ * @template {Record<string, any>} Props
3567
+ * @param {Renderer} renderer
3568
+ * @param {import('svelte').Component<Props>} component
3569
+ * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string; csp?: Csp; transformError?: (error: unknown) => unknown }} options
3570
+ * @returns {void}
3571
+ */
3572
+ static #open_render(renderer, component, options) {
3573
+ var previous_context = ssr_context;
3574
+ try {
3575
+ set_ssr_context({
3576
+ p: null,
3577
+ c: options.context ?? null,
3578
+ r: renderer,
3579
+ i: false
3580
+ });
3581
+ renderer.push(BLOCK_OPEN);
3582
+ component(renderer, options.props ?? {});
3583
+ renderer.push(BLOCK_CLOSE);
3584
+ } finally {
3585
+ set_ssr_context(previous_context);
3586
+ }
3587
+ }
3588
+ /**
3589
+ * @param {AccumulatedContent} content
3590
+ * @param {Renderer} renderer
3591
+ * @returns {AccumulatedContent & { hashes: { script: Sha256Source[] } }}
3592
+ */
3593
+ static #close_render(content, renderer) {
3594
+ let head = content.head + renderer.global.get_title();
3595
+ let body = content.body;
3596
+ for (const { hash, code } of renderer.global.css) head += `<style id="${hash}">${code}</style>`;
3597
+ return {
3598
+ head,
3599
+ body,
3600
+ hashes: { script: renderer.global.csp.script_hashes }
3601
+ };
3602
+ }
3603
+ /**
3604
+ * @param {HydratableContext} ctx
3605
+ */
3606
+ async #hydratable_block(ctx) {
3607
+ if (ctx.lookup.size === 0) return null;
3608
+ let entries = [];
3609
+ let has_promises = false;
3610
+ for (const [k, v] of ctx.lookup) {
3611
+ if (v.promises) {
3612
+ has_promises = true;
3613
+ for (const p of v.promises) await p;
3614
+ }
3615
+ entries.push(`[${uneval(k)},${v.serialized}]`);
3616
+ }
3617
+ let prelude = `const h = (window.__svelte ??= {}).h ??= new Map();`;
3618
+ if (has_promises) prelude = `const r = (v) => Promise.resolve(v);
3619
+ ${prelude}`;
3620
+ const body = `
3621
+ {
3622
+ ${prelude}
3623
+
3624
+ for (const [k, v] of [
3625
+ ${entries.join(",\n ")}
3626
+ ]) {
3627
+ h.set(k, v);
3628
+ }
3629
+ }
3630
+ `;
3631
+ let csp_attr = "";
3632
+ if (this.global.csp.nonce) csp_attr = ` nonce="${this.global.csp.nonce}"`;
3633
+ else if (this.global.csp.hash) {
3634
+ const hash = await sha256(body);
3635
+ this.global.csp.script_hashes.push(`sha256-${hash}`);
3636
+ }
3637
+ return `\n\t\t<script${csp_attr}>${body}<\/script>`;
3638
+ }
3639
+ };
3640
+ var SSRState = class {
3641
+ /** @readonly @type {Csp & { script_hashes: Sha256Source[] }} */
3642
+ csp;
3643
+ /** @readonly @type {'sync' | 'async'} */
3644
+ mode;
3645
+ /** @readonly @type {() => string} */
3646
+ uid;
3647
+ /** @readonly @type {Set<{ hash: string; code: string }>} */
3648
+ css = /* @__PURE__ */ new Set();
3649
+ /** @type {Set<Promise<unknown>>} */
3650
+ #pending = /* @__PURE__ */ new Set();
3651
+ /** @type {AbortController | null} */
3652
+ #controller = null;
3653
+ #aborted = false;
3654
+ /**
3655
+ * `transformError` passed to `render`. Called when an error boundary catches an error.
3656
+ * Throws by default if unset in `render`.
3657
+ * @type {(error: unknown) => unknown}
3658
+ */
3659
+ transformError;
3660
+ /** @type {{ path: number[], value: string }} */
3661
+ #title = {
3662
+ path: [],
3663
+ value: ""
3664
+ };
3665
+ /**
3666
+ * @param {'sync' | 'async'} mode
3667
+ * @param {string} id_prefix
3668
+ * @param {Csp} csp
3669
+ * @param {((error: unknown) => unknown) | undefined} [transformError]
3670
+ */
3671
+ constructor(mode, id_prefix = "", csp = { hash: false }, transformError) {
3672
+ this.mode = mode;
3673
+ this.csp = {
3674
+ ...csp,
3675
+ script_hashes: []
3676
+ };
3677
+ this.transformError = transformError ?? ((error) => {
3678
+ throw error;
3679
+ });
3680
+ let uid = 1;
3681
+ this.uid = () => `${id_prefix}s${uid++}`;
3682
+ }
3683
+ /**
3684
+ * @template T
3685
+ * @param {Promise<T>} promise
3686
+ * @returns {Promise<T>}
3687
+ */
3688
+ track(promise) {
3689
+ this.#pending.add(promise);
3690
+ promise.then(() => this.#pending.delete(promise), () => this.#pending.delete(promise));
3691
+ return promise;
3692
+ }
3693
+ async settle() {
3694
+ while (this.#pending.size > 0) await Promise.allSettled([...this.#pending]);
3695
+ }
3696
+ abort() {
3697
+ if (this.#aborted) return;
3698
+ this.#aborted = true;
3699
+ this.#controller?.abort(STALE_REACTION);
3700
+ }
3701
+ get_abort_signal() {
3702
+ const controller = this.#controller ??= new AbortController();
3703
+ if (this.#aborted) controller.abort(STALE_REACTION);
3704
+ return controller.signal;
3705
+ }
3706
+ get_title() {
3707
+ return this.#title.value;
3708
+ }
3709
+ /**
3710
+ * Performs a depth-first (lexicographic) comparison using the path. Rejects sets
3711
+ * from earlier than or equal to the current value.
3712
+ * @param {string} value
3713
+ * @param {number[]} path
3714
+ */
3715
+ set_title(value, path) {
3716
+ const current = this.#title.path;
3717
+ let i = 0;
3718
+ let l = Math.min(path.length, current.length);
3719
+ while (i < l && path[i] === current[i]) i += 1;
3720
+ if (path[i] === void 0) return;
3721
+ if (current[i] === void 0 || path[i] > current[i]) {
3722
+ this.#title.path = path;
3723
+ this.#title.value = value;
3724
+ }
3725
+ }
3726
+ };
3727
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/server/blocks/html.js
3728
+ /**
3729
+ * @param {string} value
3730
+ */
3731
+ function html(value) {
3732
+ return "<!---->" + String(value ?? "") + "<!---->";
3733
+ }
3734
+ // ../../node_modules/.pnpm/svelte@5.57.3_@typescript-eslint+types@8.72.1/node_modules/svelte/src/internal/server/index.js
3735
+ var 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;
3736
+ /**
3737
+ * @param {Renderer} renderer
3738
+ * @param {string} tag
3739
+ * @param {() => void} attributes_fn
3740
+ * @param {() => void} children_fn
3741
+ * @returns {void}
3742
+ */
3743
+ function element(renderer, tag, attributes_fn = noop, children_fn = noop) {
3744
+ renderer.push("<!---->");
3745
+ if (tag) {
3746
+ if (!REGEX_VALID_TAG_NAME.test(tag)) dynamic_element_invalid_tag(tag);
3747
+ renderer.push(`<${tag}`);
3748
+ attributes_fn();
3749
+ renderer.push(`>`);
3750
+ if (!is_void(tag)) {
3751
+ children_fn();
3752
+ if (!is_raw_text_element(tag)) renderer.push(EMPTY_COMMENT);
3753
+ renderer.push(`</${tag}>`);
3754
+ }
3755
+ }
3756
+ renderer.push("<!---->");
3757
+ }
3758
+ /**
3759
+ * Only available on the server and when compiling with the `server` option.
3760
+ * 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.
3761
+ * @template {Record<string, any>} Props
3762
+ * @param {Component<Props> | ComponentType<SvelteComponent<Props>>} component
3763
+ * @param {{ props?: Omit<Props, '$$slots' | '$$events'>; context?: Map<any, any>; idPrefix?: string; csp?: Csp; transformError?: (error: unknown) => unknown }} [options]
3764
+ * @returns {RenderOutput}
3765
+ */
3766
+ function render(component, options = {}) {
3767
+ if (options.csp?.hash && options.csp.nonce) invalid_csp();
3768
+ return Renderer.render(component, options);
3769
+ }
3770
+ /**
3771
+ * @param {string} hash
3772
+ * @param {Renderer} renderer
3773
+ * @param {(renderer: Renderer) => Promise<void> | void} fn
3774
+ * @returns {void}
3775
+ */
3776
+ function head(hash, renderer, fn) {
3777
+ renderer.head((renderer) => {
3778
+ renderer.push(`<!--${hash}-->`);
3779
+ renderer.child(fn);
3780
+ renderer.push(EMPTY_COMMENT);
3781
+ });
3782
+ }
3783
+ /**
3784
+ * @param {Record<string, unknown>} attrs
3785
+ * @param {string} [css_hash]
3786
+ * @param {Record<string, boolean>} [classes]
3787
+ * @param {Record<string, string>} [styles]
3788
+ * @param {number} [flags]
3789
+ * @returns {string}
3790
+ */
3791
+ function attributes(attrs, css_hash, classes, styles, flags = 0) {
3792
+ if (styles) attrs.style = to_style(attrs.style, styles);
3793
+ if (attrs.class) attrs.class = clsx$1(attrs.class);
3794
+ if (css_hash || classes) attrs.class = to_class(attrs.class, css_hash, classes);
3795
+ let attr_str = "";
3796
+ let name;
3797
+ const is_html = (flags & 1) === 0;
3798
+ const lowercase = (flags & 2) === 0;
3799
+ const is_input = (flags & 4) !== 0;
3800
+ const names = Object.keys(attrs);
3801
+ outer: for (let i = 0; i < names.length; i++) {
3802
+ name = names[i];
3803
+ if (typeof attrs[name] === "function") continue;
3804
+ if (name[0] === "$" && name[1] === "$") continue;
3805
+ if (name === "" || INVALID_ATTR_NAME_CHAR_REGEX.test(name)) continue;
3806
+ var value = attrs[name];
3807
+ var lower = name.toLowerCase();
3808
+ if (lowercase) name = lower;
3809
+ if (lower.length > 2 && lower.startsWith("on")) continue;
3810
+ if (is_input) {
3811
+ if (name === "defaultvalue" || name === "defaultchecked") {
3812
+ name = name === "defaultvalue" ? "value" : "checked";
3813
+ if (name in attrs) continue;
3814
+ for (let j = 0; j < names.length; j++) if (names[j].toLowerCase() === name) continue outer;
3815
+ }
3816
+ }
3817
+ attr_str += attr(name, value, is_html && is_boolean_attribute(name));
3818
+ }
3819
+ return attr_str;
3820
+ }
3821
+ /**
3822
+ * @param {Record<string, unknown>[]} props
3823
+ * @returns {Record<string, unknown>}
3824
+ */
3825
+ function spread_props(props) {
3826
+ /** @type {Record<string, unknown>} */
3827
+ const merged_props = {};
3828
+ let key;
3829
+ for (let i = 0; i < props.length; i++) {
3830
+ const obj = props[i];
3831
+ if (obj == null) continue;
3832
+ for (key of Object.keys(obj)) {
3833
+ const desc = Object.getOwnPropertyDescriptor(obj, key);
3834
+ if (desc) Object.defineProperty(merged_props, key, desc);
3835
+ else merged_props[key] = obj[key];
3836
+ }
3837
+ }
3838
+ return merged_props;
3839
+ }
3840
+ /**
3841
+ * @param {unknown} value
3842
+ * @returns {string}
3843
+ */
3844
+ function stringify(value) {
3845
+ return typeof value === "string" ? value : value == null ? "" : value + "";
3846
+ }
3847
+ /**
3848
+ * @param {any} value
3849
+ * @param {string | undefined} [hash]
3850
+ * @param {Record<string, boolean>} [directives]
3851
+ */
3852
+ function attr_class(value, hash, directives) {
3853
+ var result = to_class(value, hash, directives);
3854
+ return result ? ` class="${escape_html(result, true)}"` : "";
3855
+ }
3856
+ /**
3857
+ * @param {any} value
3858
+ * @param {Record<string,any>|[Record<string,any>,Record<string,any>]} [directives]
3859
+ */
3860
+ function attr_style(value, directives) {
3861
+ var result = to_style(value, directives);
3862
+ return result ? ` style="${escape_html(result, true)}"` : "";
3863
+ }
3864
+ /**
3865
+ * Legacy mode: If the prop has a fallback and is bound in the
3866
+ * parent component, propagate the fallback value upwards.
3867
+ * @param {Record<string, unknown>} props_parent
3868
+ * @param {Record<string, unknown>} props_now
3869
+ */
3870
+ function bind_props(props_parent, props_now) {
3871
+ for (const key of Object.keys(props_now)) {
3872
+ const initial_value = props_parent[key];
3873
+ const value = props_now[key];
3874
+ if (initial_value === void 0 && value !== void 0 && Object.getOwnPropertyDescriptor(props_parent, key)?.set) props_parent[key] = value;
3875
+ }
3876
+ }
3877
+ /** @param {any} array_like_or_iterator */
3878
+ function ensure_array_like(array_like_or_iterator) {
3879
+ if (array_like_or_iterator) return array_like_or_iterator.length !== void 0 ? array_like_or_iterator : Array.from(array_like_or_iterator);
3880
+ return [];
3881
+ }
3882
+ /**
3883
+ * @template V
3884
+ * @param {() => V} get_value
3885
+ */
3886
+ function once(get_value) {
3887
+ let value = UNINITIALIZED;
3888
+ return () => {
3889
+ if (value === UNINITIALIZED) value = get_value();
3890
+ return value;
3891
+ };
3892
+ }
3893
+ /**
3894
+ * Create an unique ID
3895
+ * @param {Renderer} renderer
3896
+ * @returns {string}
3897
+ */
3898
+ function props_id(renderer) {
3899
+ const uid = renderer.global.uid();
3900
+ renderer.push("<!--$" + uid + "-->");
3901
+ return uid;
3902
+ }
3903
+ /**
3904
+ * @template T
3905
+ * @param {()=>T} fn
3906
+ * @returns {(new_value?: T) => (T | void)}
3907
+ */
3908
+ function derived(fn) {
3909
+ const get_value = ssr_context === null ? fn : once(fn);
3910
+ /** @type {T | undefined} */
3911
+ let updated_value;
3912
+ return function(new_value) {
3913
+ if (arguments.length === 0) return updated_value ?? get_value();
3914
+ updated_value = new_value;
3915
+ return updated_value;
3916
+ };
42
3917
  }
43
- export { Server as t };
3918
+ export { queue_micro_task as $, destroy_effect as A, array_from as At, get_first_child as B, get as C, DESTROYING as Ct, block as D, REACTION_RAN as Dt, untrack as E, LEGACY_PROPS as Et, render_effect as F, run as Ft, mutable_source as G, init_operations as H, invoke_error_boundary as I, to_array as It, Batch as J, set as K, clear_text_content as L, escape_html as Lt, effect_tracking as M, fallback as Mt, move_effect as N, noop as Nt, branch as O, attr as Ot, pause_effect as P, object_keys as Pt, defer_effect as Q, create_element as R, ATTACHMENT_KEY as Rt, active_reaction as S, DESTROYED as St, set_active_reaction as T, EFFECT_TRANSPARENT as Tt, increment as U, get_next_sibling as V, internal_set as W, flushSync as X, current_batch as Y, without_reactive_context as Z, setContext as _, set_hydrating as _t, derived as a, tag as at, is_passive_event as b, lifecycle_double_unmount as bt, head as c, hydration_failed as ct, spread_props as d, hydrate_next as dt, component_context as et, stringify as f, hydrate_node as ft, hasContext as g, set_hydrate_node as gt, getContext as h, read_hydration_instruction as ht, bind_props as i, set_component_context as it, effect_root as j, define_property as jt, component_root as k, clsx$1 as kt, props_id as l, rune_outside_svelte as lt, getAllContexts as m, next as mt, attr_style as n, pop$1 as nt, element as o, snapshot as ot, html as p, hydrating as pt, source as q, attributes as r, push$1 as rt, ensure_array_like as s, async_mode_flag as st, attr_class as t, mark_as_component as tt, render as u, svelte_boundary_reset_onerror as ut, ssr_context as v, skip_nodes as vt, set_active_effect as w, EFFECT_PRESERVED as wt, active_effect as x, svelte_boundary_reset_noop as xt, lifecycle_function_unavailable as y, hydration_mismatch as yt, create_text as z, HYDRATION_ERROR as zt };
44
3919
 
45
3920
  //# sourceMappingURL=server4.js.map