@pie-element/simple-cloze 0.1.4-next.2 → 0.1.4-next.4
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.
- package/dist/author/index.js +27879 -24961
- package/dist/author/index.js.map +1 -1
- package/dist/browser/author/index.js +18351 -16236
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/{client-Cas_f5u-.js → client-Dt8SOe5Z.js} +1035 -1069
- package/dist/browser/client-Dt8SOe5Z.js.map +1 -0
- package/dist/browser/controller/index.js.map +1 -1
- package/dist/browser/delivery/index.js +32 -32
- package/dist/browser/delivery/index.js.map +1 -1
- package/dist/browser/print/index.js +8 -8
- package/dist/browser/print/index.js.map +1 -1
- package/dist/controller/index.js.map +1 -1
- package/dist/delivery/index.js +2138 -2061
- package/dist/delivery/index.js.map +1 -1
- package/dist/index.iife.js +3 -3
- package/dist/index.js +2138 -2061
- package/dist/index.js.map +1 -1
- package/dist/print/index.js +1867 -1797
- package/dist/print/index.js.map +1 -1
- package/module/print.js +2021 -0
- package/module/print.js.map +1 -0
- package/package.json +20 -9
- package/print.js +2 -0
- package/dist/browser/client-Cas_f5u-.js.map +0 -1
package/dist/delivery/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
//#region ../../../node_modules/.bun/svelte@5.
|
|
1
|
+
//#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/disclose-version.js
|
|
2
2
|
if (typeof window !== "undefined") {
|
|
3
3
|
var _window$__svelte, _window;
|
|
4
4
|
((_window$__svelte = (_window = window).__svelte ?? (_window.__svelte = {})).v ?? (_window$__svelte.v = /* @__PURE__ */ new Set())).add("5");
|
|
5
5
|
}
|
|
6
6
|
//#endregion
|
|
7
|
-
//#region ../../../node_modules/.bun/svelte@5.
|
|
7
|
+
//#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/constants.js
|
|
8
8
|
var HYDRATION_ERROR = {};
|
|
9
9
|
var UNINITIALIZED = Symbol("uninitialized");
|
|
10
10
|
var NAMESPACE_SVG = "http://www.w3.org/2000/svg";
|
|
11
11
|
var NAMESPACE_MATHML = "http://www.w3.org/1998/Math/MathML";
|
|
12
12
|
//#endregion
|
|
13
|
-
//#region ../../../node_modules/.bun/svelte@5.
|
|
13
|
+
//#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/shared/utils.js
|
|
14
14
|
var is_array = Array.isArray;
|
|
15
15
|
var index_of = Array.prototype.indexOf;
|
|
16
16
|
var includes = Array.prototype.includes;
|
|
@@ -47,7 +47,7 @@ function deferred() {
|
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
//#endregion
|
|
50
|
-
//#region \0@oxc-project+runtime@0.
|
|
50
|
+
//#region \0@oxc-project+runtime@0.139.0/helpers/esm/typeof.js
|
|
51
51
|
function _typeof(o) {
|
|
52
52
|
"@babel/helpers - typeof";
|
|
53
53
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -57,7 +57,7 @@ function _typeof(o) {
|
|
|
57
57
|
}, _typeof(o);
|
|
58
58
|
}
|
|
59
59
|
//#endregion
|
|
60
|
-
//#region \0@oxc-project+runtime@0.
|
|
60
|
+
//#region \0@oxc-project+runtime@0.139.0/helpers/esm/toPrimitive.js
|
|
61
61
|
function toPrimitive(t, r) {
|
|
62
62
|
if ("object" != _typeof(t) || !t) return t;
|
|
63
63
|
var e = t[Symbol.toPrimitive];
|
|
@@ -69,13 +69,13 @@ function toPrimitive(t, r) {
|
|
|
69
69
|
return ("string" === r ? String : Number)(t);
|
|
70
70
|
}
|
|
71
71
|
//#endregion
|
|
72
|
-
//#region \0@oxc-project+runtime@0.
|
|
72
|
+
//#region \0@oxc-project+runtime@0.139.0/helpers/esm/toPropertyKey.js
|
|
73
73
|
function toPropertyKey(t) {
|
|
74
74
|
var i = toPrimitive(t, "string");
|
|
75
75
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
76
76
|
}
|
|
77
77
|
//#endregion
|
|
78
|
-
//#region \0@oxc-project+runtime@0.
|
|
78
|
+
//#region \0@oxc-project+runtime@0.139.0/helpers/esm/defineProperty.js
|
|
79
79
|
function _defineProperty(e, r, t) {
|
|
80
80
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
81
81
|
value: t,
|
|
@@ -111,6 +111,8 @@ var REACTION_IS_UPDATING = 1 << 21;
|
|
|
111
111
|
var ASYNC = 1 << 22;
|
|
112
112
|
var ERROR_VALUE = 1 << 23;
|
|
113
113
|
var STATE_SYMBOL = Symbol("$state");
|
|
114
|
+
/** Marks component export objects, so that `proxy(...)` leaves them untouched */
|
|
115
|
+
var COMPONENT_SYMBOL = Symbol("component");
|
|
114
116
|
var LEGACY_PROPS = Symbol("legacy props");
|
|
115
117
|
var LOADING_ATTR_SYMBOL = Symbol("");
|
|
116
118
|
var ATTRIBUTES_CACHE = Symbol("attributes");
|
|
@@ -127,88 +129,6 @@ var STALE_REACTION = new class StaleReactionError extends Error {
|
|
|
127
129
|
}();
|
|
128
130
|
var IS_XHTML = !!globalThis.document?.contentType && /* @__PURE__ */ globalThis.document.contentType.includes("xml");
|
|
129
131
|
/**
|
|
130
|
-
* `%name%(...)` can only be used during component initialisation
|
|
131
|
-
* @param {string} name
|
|
132
|
-
* @returns {never}
|
|
133
|
-
*/
|
|
134
|
-
function lifecycle_outside_component(name) {
|
|
135
|
-
throw new Error(`https://svelte.dev/e/lifecycle_outside_component`);
|
|
136
|
-
}
|
|
137
|
-
//#endregion
|
|
138
|
-
//#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/errors.js
|
|
139
|
-
/**
|
|
140
|
-
* Cannot create a `$derived(...)` with an `await` expression outside of an effect tree
|
|
141
|
-
* @returns {never}
|
|
142
|
-
*/
|
|
143
|
-
function async_derived_orphan() {
|
|
144
|
-
throw new Error(`https://svelte.dev/e/async_derived_orphan`);
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* `%rune%` cannot be used inside an effect cleanup function
|
|
148
|
-
* @param {string} rune
|
|
149
|
-
* @returns {never}
|
|
150
|
-
*/
|
|
151
|
-
function effect_in_teardown(rune) {
|
|
152
|
-
throw new Error(`https://svelte.dev/e/effect_in_teardown`);
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Effect cannot be created inside a `$derived` value that was not itself created inside an effect
|
|
156
|
-
* @returns {never}
|
|
157
|
-
*/
|
|
158
|
-
function effect_in_unowned_derived() {
|
|
159
|
-
throw new Error(`https://svelte.dev/e/effect_in_unowned_derived`);
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* `%rune%` can only be used inside an effect (e.g. during component initialisation)
|
|
163
|
-
* @param {string} rune
|
|
164
|
-
* @returns {never}
|
|
165
|
-
*/
|
|
166
|
-
function effect_orphan(rune) {
|
|
167
|
-
throw new Error(`https://svelte.dev/e/effect_orphan`);
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state
|
|
171
|
-
* @returns {never}
|
|
172
|
-
*/
|
|
173
|
-
function effect_update_depth_exceeded() {
|
|
174
|
-
throw new Error(`https://svelte.dev/e/effect_update_depth_exceeded`);
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Failed to hydrate the application
|
|
178
|
-
* @returns {never}
|
|
179
|
-
*/
|
|
180
|
-
function hydration_failed() {
|
|
181
|
-
throw new Error(`https://svelte.dev/e/hydration_failed`);
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Property descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.
|
|
185
|
-
* @returns {never}
|
|
186
|
-
*/
|
|
187
|
-
function state_descriptors_fixed() {
|
|
188
|
-
throw new Error(`https://svelte.dev/e/state_descriptors_fixed`);
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Cannot set prototype of `$state` object
|
|
192
|
-
* @returns {never}
|
|
193
|
-
*/
|
|
194
|
-
function state_prototype_fixed() {
|
|
195
|
-
throw new Error(`https://svelte.dev/e/state_prototype_fixed`);
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Updating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`
|
|
199
|
-
* @returns {never}
|
|
200
|
-
*/
|
|
201
|
-
function state_unsafe_mutation() {
|
|
202
|
-
throw new Error(`https://svelte.dev/e/state_unsafe_mutation`);
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* A `<svelte:boundary>` `reset` function cannot be called while an error is still being handled
|
|
206
|
-
* @returns {never}
|
|
207
|
-
*/
|
|
208
|
-
function svelte_boundary_reset_onerror() {
|
|
209
|
-
throw new Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`);
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
132
|
* Reading a derived belonging to a now-destroyed effect may result in stale values
|
|
213
133
|
*/
|
|
214
134
|
function derived_inert() {
|
|
@@ -228,7 +148,7 @@ function svelte_boundary_reset_noop() {
|
|
|
228
148
|
console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`);
|
|
229
149
|
}
|
|
230
150
|
//#endregion
|
|
231
|
-
//#region ../../../node_modules/.bun/svelte@5.
|
|
151
|
+
//#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/hydration.js
|
|
232
152
|
/** @import { TemplateNode } from '#client' */
|
|
233
153
|
/**
|
|
234
154
|
* Use this variable to guard everything related to hydration code so it can be treeshaken out
|
|
@@ -307,7 +227,7 @@ function read_hydration_instruction(node) {
|
|
|
307
227
|
return node.data;
|
|
308
228
|
}
|
|
309
229
|
//#endregion
|
|
310
|
-
//#region ../../../node_modules/.bun/svelte@5.
|
|
230
|
+
//#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/equality.js
|
|
311
231
|
/** @import { Equals } from '#client' */
|
|
312
232
|
/** @type {Equals} */
|
|
313
233
|
function equals(value) {
|
|
@@ -325,14 +245,96 @@ function safe_not_equal(a, b) {
|
|
|
325
245
|
function safe_equals(value) {
|
|
326
246
|
return !safe_not_equal(value, this.v);
|
|
327
247
|
}
|
|
248
|
+
/**
|
|
249
|
+
* `%name%(...)` can only be used during component initialisation
|
|
250
|
+
* @param {string} name
|
|
251
|
+
* @returns {never}
|
|
252
|
+
*/
|
|
253
|
+
function lifecycle_outside_component(name) {
|
|
254
|
+
throw new Error(`https://svelte.dev/e/lifecycle_outside_component`);
|
|
255
|
+
}
|
|
256
|
+
//#endregion
|
|
257
|
+
//#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/errors.js
|
|
258
|
+
/**
|
|
259
|
+
* Cannot create a `$derived(...)` with an `await` expression outside of an effect tree
|
|
260
|
+
* @returns {never}
|
|
261
|
+
*/
|
|
262
|
+
function async_derived_orphan() {
|
|
263
|
+
throw new Error(`https://svelte.dev/e/async_derived_orphan`);
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* `%rune%` cannot be used inside an effect cleanup function
|
|
267
|
+
* @param {string} rune
|
|
268
|
+
* @returns {never}
|
|
269
|
+
*/
|
|
270
|
+
function effect_in_teardown(rune) {
|
|
271
|
+
throw new Error(`https://svelte.dev/e/effect_in_teardown`);
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Effect cannot be created inside a `$derived` value that was not itself created inside an effect
|
|
275
|
+
* @returns {never}
|
|
276
|
+
*/
|
|
277
|
+
function effect_in_unowned_derived() {
|
|
278
|
+
throw new Error(`https://svelte.dev/e/effect_in_unowned_derived`);
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* `%rune%` can only be used inside an effect (e.g. during component initialisation)
|
|
282
|
+
* @param {string} rune
|
|
283
|
+
* @returns {never}
|
|
284
|
+
*/
|
|
285
|
+
function effect_orphan(rune) {
|
|
286
|
+
throw new Error(`https://svelte.dev/e/effect_orphan`);
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state
|
|
290
|
+
* @returns {never}
|
|
291
|
+
*/
|
|
292
|
+
function effect_update_depth_exceeded() {
|
|
293
|
+
throw new Error(`https://svelte.dev/e/effect_update_depth_exceeded`);
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Failed to hydrate the application
|
|
297
|
+
* @returns {never}
|
|
298
|
+
*/
|
|
299
|
+
function hydration_failed() {
|
|
300
|
+
throw new Error(`https://svelte.dev/e/hydration_failed`);
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Property descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.
|
|
304
|
+
* @returns {never}
|
|
305
|
+
*/
|
|
306
|
+
function state_descriptors_fixed() {
|
|
307
|
+
throw new Error(`https://svelte.dev/e/state_descriptors_fixed`);
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Cannot set prototype of `$state` object
|
|
311
|
+
* @returns {never}
|
|
312
|
+
*/
|
|
313
|
+
function state_prototype_fixed() {
|
|
314
|
+
throw new Error(`https://svelte.dev/e/state_prototype_fixed`);
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Updating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`
|
|
318
|
+
* @returns {never}
|
|
319
|
+
*/
|
|
320
|
+
function state_unsafe_mutation() {
|
|
321
|
+
throw new Error(`https://svelte.dev/e/state_unsafe_mutation`);
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* A `<svelte:boundary>` `reset` function cannot be called while an error is still being handled
|
|
325
|
+
* @returns {never}
|
|
326
|
+
*/
|
|
327
|
+
function svelte_boundary_reset_onerror() {
|
|
328
|
+
throw new Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`);
|
|
329
|
+
}
|
|
328
330
|
//#endregion
|
|
329
|
-
//#region ../../../node_modules/.bun/svelte@5.
|
|
331
|
+
//#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/flags/index.js
|
|
330
332
|
/** True if experimental.async=true */
|
|
331
333
|
var async_mode_flag = false;
|
|
332
334
|
/** True if we're not certain that we only have Svelte 5 code in the compilation */
|
|
333
335
|
var legacy_mode_flag = false;
|
|
334
336
|
//#endregion
|
|
335
|
-
//#region ../../../node_modules/.bun/svelte@5.
|
|
337
|
+
//#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/context.js
|
|
336
338
|
/** @import { ComponentContext, DevStackEntry, Effect } from '#client' */
|
|
337
339
|
/** @type {ComponentContext | null} */
|
|
338
340
|
var component_context = null;
|
|
@@ -377,14 +379,22 @@ function pop(component) {
|
|
|
377
379
|
if (component !== void 0) context.x = component;
|
|
378
380
|
context.i = true;
|
|
379
381
|
component_context = context.p;
|
|
380
|
-
return component
|
|
382
|
+
return mark_as_component(component);
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Add a symbol to the object (or create one if undefined) to mark it as a component so it isn't proxified.
|
|
386
|
+
* @param {any} component
|
|
387
|
+
*/
|
|
388
|
+
function mark_as_component(component = {}) {
|
|
389
|
+
define_property(component, COMPONENT_SYMBOL, { value: true });
|
|
390
|
+
return component;
|
|
381
391
|
}
|
|
382
392
|
/** @returns {boolean} */
|
|
383
393
|
function is_runes() {
|
|
384
394
|
return !legacy_mode_flag || component_context !== null && component_context.l === null;
|
|
385
395
|
}
|
|
386
396
|
//#endregion
|
|
387
|
-
//#region ../../../node_modules/.bun/svelte@5.
|
|
397
|
+
//#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/task.js
|
|
388
398
|
/** @type {Array<() => void>} */
|
|
389
399
|
var micro_tasks = [];
|
|
390
400
|
function run_micro_tasks() {
|
|
@@ -410,39 +420,8 @@ function queue_micro_task(fn) {
|
|
|
410
420
|
function flush_tasks() {
|
|
411
421
|
while (micro_tasks.length > 0) run_micro_tasks();
|
|
412
422
|
}
|
|
413
|
-
/**
|
|
414
|
-
* @param {unknown} error
|
|
415
|
-
*/
|
|
416
|
-
function handle_error(error) {
|
|
417
|
-
var effect = active_effect;
|
|
418
|
-
if (effect === null) {
|
|
419
|
-
/** @type {Derived} */ active_reaction.f |= ERROR_VALUE;
|
|
420
|
-
return error;
|
|
421
|
-
}
|
|
422
|
-
if ((effect.f & 32768) === 0 && (effect.f & 4) === 0) throw error;
|
|
423
|
-
invoke_error_boundary(error, effect);
|
|
424
|
-
}
|
|
425
|
-
/**
|
|
426
|
-
* @param {unknown} error
|
|
427
|
-
* @param {Effect | null} effect
|
|
428
|
-
*/
|
|
429
|
-
function invoke_error_boundary(error, effect) {
|
|
430
|
-
while (effect !== null) {
|
|
431
|
-
if ((effect.f & 128) !== 0) {
|
|
432
|
-
if ((effect.f & 32768) === 0) throw error;
|
|
433
|
-
try {
|
|
434
|
-
/** @type {Boundary} */ effect.b.error(error);
|
|
435
|
-
return;
|
|
436
|
-
} catch (e) {
|
|
437
|
-
error = e;
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
effect = effect.parent;
|
|
441
|
-
}
|
|
442
|
-
throw error;
|
|
443
|
-
}
|
|
444
423
|
//#endregion
|
|
445
|
-
//#region ../../../node_modules/.bun/svelte@5.
|
|
424
|
+
//#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/status.js
|
|
446
425
|
/** @import { Derived, Signal } from '#client' */
|
|
447
426
|
var STATUS_MASK = ~(DIRTY | MAYBE_DIRTY | CLEAN);
|
|
448
427
|
/**
|
|
@@ -461,7 +440,7 @@ function update_derived_status(derived) {
|
|
|
461
440
|
else set_signal_status(derived, MAYBE_DIRTY);
|
|
462
441
|
}
|
|
463
442
|
//#endregion
|
|
464
|
-
//#region ../../../node_modules/.bun/svelte@5.
|
|
443
|
+
//#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/utils.js
|
|
465
444
|
/** @import { Derived, Effect, Value } from '#client' */
|
|
466
445
|
/**
|
|
467
446
|
* @param {Value[] | null} deps
|
|
@@ -489,1467 +468,1068 @@ function defer_effect(effect, dirty_effects, maybe_dirty_effects) {
|
|
|
489
468
|
set_signal_status(effect, CLEAN);
|
|
490
469
|
}
|
|
491
470
|
//#endregion
|
|
492
|
-
//#region ../../../node_modules/.bun/svelte@5.
|
|
471
|
+
//#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/store.js
|
|
493
472
|
/**
|
|
494
473
|
* We set this to `true` when updating a store so that we correctly
|
|
495
474
|
* schedule effects if the update takes place inside a `$:` effect
|
|
496
475
|
*/
|
|
497
476
|
var legacy_is_updating_store = false;
|
|
498
477
|
//#endregion
|
|
499
|
-
//#region
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
function _assertClassBrand(e, t, n) {
|
|
516
|
-
if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
|
|
517
|
-
throw new TypeError("Private element is not present on this object");
|
|
518
|
-
}
|
|
519
|
-
//#endregion
|
|
520
|
-
//#region \0@oxc-project+runtime@0.133.0/helpers/esm/classPrivateFieldSet2.js
|
|
521
|
-
function _classPrivateFieldSet2(s, a, r) {
|
|
522
|
-
return s.set(_assertClassBrand(s, a), r), r;
|
|
523
|
-
}
|
|
524
|
-
//#endregion
|
|
525
|
-
//#region \0@oxc-project+runtime@0.133.0/helpers/esm/classPrivateFieldGet2.js
|
|
526
|
-
function _classPrivateFieldGet2(s, a) {
|
|
527
|
-
return s.get(_assertClassBrand(s, a));
|
|
478
|
+
//#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js
|
|
479
|
+
/**
|
|
480
|
+
* @template T
|
|
481
|
+
* @param {() => T} fn
|
|
482
|
+
*/
|
|
483
|
+
function without_reactive_context(fn) {
|
|
484
|
+
var previous_reaction = active_reaction;
|
|
485
|
+
var previous_effect = active_effect;
|
|
486
|
+
set_active_reaction(null);
|
|
487
|
+
set_active_effect(null);
|
|
488
|
+
try {
|
|
489
|
+
return fn();
|
|
490
|
+
} finally {
|
|
491
|
+
set_active_reaction(previous_reaction);
|
|
492
|
+
set_active_effect(previous_effect);
|
|
493
|
+
}
|
|
528
494
|
}
|
|
529
495
|
//#endregion
|
|
530
|
-
//#region ../../../node_modules/.bun/svelte@5.
|
|
531
|
-
/** @import {
|
|
532
|
-
/** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
|
|
533
|
-
var _Batch;
|
|
534
|
-
/** @type {Batch | null} */
|
|
535
|
-
var first_batch = null;
|
|
536
|
-
/** @type {Batch | null} */
|
|
537
|
-
var last_batch = null;
|
|
538
|
-
/** @type {Batch | null} */
|
|
539
|
-
var current_batch = null;
|
|
496
|
+
//#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/async.js
|
|
497
|
+
/** @import { Blocker, Effect, Source, Value } from '#client' */
|
|
540
498
|
/**
|
|
541
|
-
*
|
|
542
|
-
* @
|
|
499
|
+
* @param {Blocker[]} blockers
|
|
500
|
+
* @param {Array<() => any>} sync
|
|
501
|
+
* @param {Array<() => Promise<any>>} async
|
|
502
|
+
* @param {(values: Value[]) => any} fn
|
|
543
503
|
*/
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
*/
|
|
551
|
-
var batch_values = null;
|
|
552
|
-
/** @type {Effect | null} */
|
|
553
|
-
var last_scheduled_effect = null;
|
|
554
|
-
var is_flushing_sync = false;
|
|
555
|
-
var is_processing = false;
|
|
556
|
-
/**
|
|
557
|
-
* During traversal, this is an array. Newly created effects are (if not immediately
|
|
558
|
-
* executed) pushed to this array, rather than going through the scheduling
|
|
559
|
-
* rigamarole that would cause another turn of the flush loop.
|
|
560
|
-
* @type {Effect[] | null}
|
|
561
|
-
*/
|
|
562
|
-
var collected_effects = null;
|
|
563
|
-
/**
|
|
564
|
-
* An array of effects that are marked during traversal as a result of a `set`
|
|
565
|
-
* (not `internal_set`) call. These will be added to the next batch and
|
|
566
|
-
* trigger another `batch.process()`
|
|
567
|
-
* @type {Effect[] | null}
|
|
568
|
-
* @deprecated when we get rid of legacy mode and stores, we can get rid of this
|
|
569
|
-
*/
|
|
570
|
-
var legacy_updates = null;
|
|
571
|
-
var flush_count = 0;
|
|
572
|
-
var uid = 1;
|
|
573
|
-
var _started = /* @__PURE__ */ new WeakMap();
|
|
574
|
-
var _prev = /* @__PURE__ */ new WeakMap();
|
|
575
|
-
var _next = /* @__PURE__ */ new WeakMap();
|
|
576
|
-
var _commit_callbacks = /* @__PURE__ */ new WeakMap();
|
|
577
|
-
var _discard_callbacks = /* @__PURE__ */ new WeakMap();
|
|
578
|
-
var _pending = /* @__PURE__ */ new WeakMap();
|
|
579
|
-
var _blocking_pending = /* @__PURE__ */ new WeakMap();
|
|
580
|
-
var _deferred = /* @__PURE__ */ new WeakMap();
|
|
581
|
-
var _roots = /* @__PURE__ */ new WeakMap();
|
|
582
|
-
var _new_effects = /* @__PURE__ */ new WeakMap();
|
|
583
|
-
var _dirty_effects$1 = /* @__PURE__ */ new WeakMap();
|
|
584
|
-
var _maybe_dirty_effects$1 = /* @__PURE__ */ new WeakMap();
|
|
585
|
-
var _skipped_branches = /* @__PURE__ */ new WeakMap();
|
|
586
|
-
var _unskipped_branches = /* @__PURE__ */ new WeakMap();
|
|
587
|
-
var _decrement_queued = /* @__PURE__ */ new WeakMap();
|
|
588
|
-
var _Batch_brand = /* @__PURE__ */ new WeakSet();
|
|
589
|
-
var Batch = class Batch {
|
|
590
|
-
constructor() {
|
|
591
|
-
_classPrivateMethodInitSpec(this, _Batch_brand);
|
|
592
|
-
_defineProperty(this, "id", uid++);
|
|
593
|
-
_classPrivateFieldInitSpec(this, _started, false);
|
|
594
|
-
_defineProperty(this, "linked", true);
|
|
595
|
-
_classPrivateFieldInitSpec(this, _prev, null);
|
|
596
|
-
_classPrivateFieldInitSpec(this, _next, null);
|
|
597
|
-
_defineProperty(
|
|
598
|
-
this,
|
|
599
|
-
/** @type {Map<Effect, ReturnType<typeof deferred<any>>>} */
|
|
600
|
-
"async_deriveds",
|
|
601
|
-
/* @__PURE__ */ new Map()
|
|
602
|
-
);
|
|
603
|
-
_defineProperty(
|
|
604
|
-
this,
|
|
605
|
-
/**
|
|
606
|
-
* The current values of any signals that are updated in this batch.
|
|
607
|
-
* Tuple format: [value, is_derived] (note: is_derived is false for deriveds, too, if they were overridden via assignment)
|
|
608
|
-
* They keys of this map are identical to `this.#previous`
|
|
609
|
-
* @type {Map<Value, [any, boolean]>}
|
|
610
|
-
*/
|
|
611
|
-
"current",
|
|
612
|
-
/* @__PURE__ */ new Map()
|
|
613
|
-
);
|
|
614
|
-
_defineProperty(
|
|
615
|
-
this,
|
|
616
|
-
/**
|
|
617
|
-
* The values of any signals (sources and deriveds) that are updated in this batch _before_ those updates took place.
|
|
618
|
-
* They keys of this map are identical to `this.#current`
|
|
619
|
-
* @type {Map<Value, any>}
|
|
620
|
-
*/
|
|
621
|
-
"previous",
|
|
622
|
-
/* @__PURE__ */ new Map()
|
|
623
|
-
);
|
|
624
|
-
_classPrivateFieldInitSpec(this, _commit_callbacks, /* @__PURE__ */ new Set());
|
|
625
|
-
_classPrivateFieldInitSpec(this, _discard_callbacks, /* @__PURE__ */ new Set());
|
|
626
|
-
_classPrivateFieldInitSpec(this, _pending, 0);
|
|
627
|
-
_classPrivateFieldInitSpec(this, _blocking_pending, /* @__PURE__ */ new Map());
|
|
628
|
-
_classPrivateFieldInitSpec(this, _deferred, null);
|
|
629
|
-
_classPrivateFieldInitSpec(this, _roots, []);
|
|
630
|
-
_classPrivateFieldInitSpec(this, _new_effects, []);
|
|
631
|
-
_classPrivateFieldInitSpec(this, _dirty_effects$1, /* @__PURE__ */ new Set());
|
|
632
|
-
_classPrivateFieldInitSpec(this, _maybe_dirty_effects$1, /* @__PURE__ */ new Set());
|
|
633
|
-
_classPrivateFieldInitSpec(this, _skipped_branches, /* @__PURE__ */ new Map());
|
|
634
|
-
_classPrivateFieldInitSpec(this, _unskipped_branches, /* @__PURE__ */ new Set());
|
|
635
|
-
_defineProperty(this, "is_fork", false);
|
|
636
|
-
_classPrivateFieldInitSpec(this, _decrement_queued, false);
|
|
637
|
-
if (last_batch === null) first_batch = last_batch = this;
|
|
638
|
-
else {
|
|
639
|
-
_classPrivateFieldSet2(_next, last_batch, this);
|
|
640
|
-
_classPrivateFieldSet2(_prev, this, last_batch);
|
|
641
|
-
}
|
|
642
|
-
last_batch = this;
|
|
643
|
-
}
|
|
644
|
-
/**
|
|
645
|
-
* Add an effect to the #skipped_branches map and reset its children
|
|
646
|
-
* @param {Effect} effect
|
|
647
|
-
*/
|
|
648
|
-
skip_effect(effect) {
|
|
649
|
-
if (!_classPrivateFieldGet2(_skipped_branches, this).has(effect)) _classPrivateFieldGet2(_skipped_branches, this).set(effect, {
|
|
650
|
-
d: [],
|
|
651
|
-
m: []
|
|
652
|
-
});
|
|
653
|
-
_classPrivateFieldGet2(_unskipped_branches, this).delete(effect);
|
|
654
|
-
}
|
|
655
|
-
/**
|
|
656
|
-
* Remove an effect from the #skipped_branches map and reschedule
|
|
657
|
-
* any tracked dirty/maybe_dirty child effects
|
|
658
|
-
* @param {Effect} effect
|
|
659
|
-
* @param {(e: Effect) => void} callback
|
|
660
|
-
*/
|
|
661
|
-
unskip_effect(effect, callback = (e) => this.schedule(e)) {
|
|
662
|
-
var tracked = _classPrivateFieldGet2(_skipped_branches, this).get(effect);
|
|
663
|
-
if (tracked) {
|
|
664
|
-
_classPrivateFieldGet2(_skipped_branches, this).delete(effect);
|
|
665
|
-
for (var e of tracked.d) {
|
|
666
|
-
set_signal_status(e, DIRTY);
|
|
667
|
-
callback(e);
|
|
668
|
-
}
|
|
669
|
-
for (e of tracked.m) {
|
|
670
|
-
set_signal_status(e, MAYBE_DIRTY);
|
|
671
|
-
callback(e);
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
_classPrivateFieldGet2(_unskipped_branches, this).add(effect);
|
|
675
|
-
}
|
|
676
|
-
/**
|
|
677
|
-
* Associate a change to a given source with the current
|
|
678
|
-
* batch, noting its previous and current values
|
|
679
|
-
* @param {Value} source
|
|
680
|
-
* @param {any} value
|
|
681
|
-
* @param {boolean} [is_derived]
|
|
682
|
-
*/
|
|
683
|
-
capture(source, value, is_derived = false) {
|
|
684
|
-
if (source.v !== UNINITIALIZED && !this.previous.has(source)) this.previous.set(source, source.v);
|
|
685
|
-
if ((source.f & 8388608) === 0) {
|
|
686
|
-
this.current.set(source, [value, is_derived]);
|
|
687
|
-
batch_values?.set(source, value);
|
|
688
|
-
}
|
|
689
|
-
if (!this.is_fork) source.v = value;
|
|
690
|
-
}
|
|
691
|
-
activate() {
|
|
692
|
-
current_batch = this;
|
|
693
|
-
}
|
|
694
|
-
deactivate() {
|
|
695
|
-
current_batch = null;
|
|
696
|
-
batch_values = null;
|
|
697
|
-
}
|
|
698
|
-
flush() {
|
|
699
|
-
try {
|
|
700
|
-
is_processing = true;
|
|
701
|
-
current_batch = this;
|
|
702
|
-
_assertClassBrand(_Batch_brand, this, _process).call(this);
|
|
703
|
-
} finally {
|
|
704
|
-
flush_count = 0;
|
|
705
|
-
last_scheduled_effect = null;
|
|
706
|
-
collected_effects = null;
|
|
707
|
-
legacy_updates = null;
|
|
708
|
-
is_processing = false;
|
|
709
|
-
current_batch = null;
|
|
710
|
-
batch_values = null;
|
|
711
|
-
old_values.clear();
|
|
712
|
-
}
|
|
713
|
-
}
|
|
714
|
-
discard() {
|
|
715
|
-
for (const fn of _classPrivateFieldGet2(_discard_callbacks, this)) fn(this);
|
|
716
|
-
_classPrivateFieldGet2(_discard_callbacks, this).clear();
|
|
717
|
-
_assertClassBrand(_Batch_brand, this, _unlink).call(this);
|
|
718
|
-
_classPrivateFieldGet2(_deferred, this)?.resolve();
|
|
719
|
-
}
|
|
720
|
-
/**
|
|
721
|
-
* @param {Effect} effect
|
|
722
|
-
*/
|
|
723
|
-
register_created_effect(effect) {
|
|
724
|
-
_classPrivateFieldGet2(_new_effects, this).push(effect);
|
|
725
|
-
}
|
|
726
|
-
/**
|
|
727
|
-
* @param {boolean} blocking
|
|
728
|
-
* @param {Effect} effect
|
|
729
|
-
*/
|
|
730
|
-
increment(blocking, effect) {
|
|
731
|
-
_classPrivateFieldSet2(_pending, this, _classPrivateFieldGet2(_pending, this) + 1);
|
|
732
|
-
if (blocking) {
|
|
733
|
-
let blocking_pending_count = _classPrivateFieldGet2(_blocking_pending, this).get(effect) ?? 0;
|
|
734
|
-
_classPrivateFieldGet2(_blocking_pending, this).set(effect, blocking_pending_count + 1);
|
|
735
|
-
}
|
|
736
|
-
}
|
|
737
|
-
/**
|
|
738
|
-
* @param {boolean} blocking
|
|
739
|
-
* @param {Effect} effect
|
|
740
|
-
*/
|
|
741
|
-
decrement(blocking, effect) {
|
|
742
|
-
_classPrivateFieldSet2(_pending, this, _classPrivateFieldGet2(_pending, this) - 1);
|
|
743
|
-
if (blocking) {
|
|
744
|
-
let blocking_pending_count = _classPrivateFieldGet2(_blocking_pending, this).get(effect) ?? 0;
|
|
745
|
-
if (blocking_pending_count === 1) _classPrivateFieldGet2(_blocking_pending, this).delete(effect);
|
|
746
|
-
else _classPrivateFieldGet2(_blocking_pending, this).set(effect, blocking_pending_count - 1);
|
|
747
|
-
}
|
|
748
|
-
if (_classPrivateFieldGet2(_decrement_queued, this)) return;
|
|
749
|
-
_classPrivateFieldSet2(_decrement_queued, this, true);
|
|
750
|
-
queue_micro_task(() => {
|
|
751
|
-
_classPrivateFieldSet2(_decrement_queued, this, false);
|
|
752
|
-
if (this.linked) this.flush();
|
|
753
|
-
});
|
|
754
|
-
}
|
|
755
|
-
/**
|
|
756
|
-
* @param {Set<Effect>} dirty_effects
|
|
757
|
-
* @param {Set<Effect>} maybe_dirty_effects
|
|
758
|
-
*/
|
|
759
|
-
transfer_effects(dirty_effects, maybe_dirty_effects) {
|
|
760
|
-
for (const e of dirty_effects) _classPrivateFieldGet2(_dirty_effects$1, this).add(e);
|
|
761
|
-
for (const e of maybe_dirty_effects) _classPrivateFieldGet2(_maybe_dirty_effects$1, this).add(e);
|
|
762
|
-
dirty_effects.clear();
|
|
763
|
-
maybe_dirty_effects.clear();
|
|
764
|
-
}
|
|
765
|
-
/** @param {(batch: Batch) => void} fn */
|
|
766
|
-
oncommit(fn) {
|
|
767
|
-
_classPrivateFieldGet2(_commit_callbacks, this).add(fn);
|
|
768
|
-
}
|
|
769
|
-
/** @param {(batch: Batch) => void} fn */
|
|
770
|
-
ondiscard(fn) {
|
|
771
|
-
_classPrivateFieldGet2(_discard_callbacks, this).add(fn);
|
|
772
|
-
}
|
|
773
|
-
settled() {
|
|
774
|
-
return (_classPrivateFieldGet2(_deferred, this) ?? _classPrivateFieldSet2(_deferred, this, deferred())).promise;
|
|
775
|
-
}
|
|
776
|
-
static ensure() {
|
|
777
|
-
if (current_batch === null) {
|
|
778
|
-
const batch = current_batch = new Batch();
|
|
779
|
-
if (!is_processing && !is_flushing_sync) queue_micro_task(() => {
|
|
780
|
-
if (!_classPrivateFieldGet2(_started, batch)) batch.flush();
|
|
781
|
-
});
|
|
782
|
-
}
|
|
783
|
-
return current_batch;
|
|
784
|
-
}
|
|
785
|
-
apply() {
|
|
786
|
-
if (!async_mode_flag || !this.is_fork && _classPrivateFieldGet2(_prev, this) === null && _classPrivateFieldGet2(_next, this) === null) {
|
|
787
|
-
batch_values = null;
|
|
788
|
-
return;
|
|
789
|
-
}
|
|
790
|
-
batch_values = /* @__PURE__ */ new Map();
|
|
791
|
-
for (const [source, [value]] of this.current) batch_values.set(source, value);
|
|
792
|
-
for (let batch = first_batch; batch !== null; batch = _classPrivateFieldGet2(_next, batch)) {
|
|
793
|
-
if (batch === this || batch.is_fork) continue;
|
|
794
|
-
var intersects = false;
|
|
795
|
-
if (batch.id < this.id) for (const [source, [, is_derived]] of batch.current) {
|
|
796
|
-
if (is_derived) continue;
|
|
797
|
-
if (this.current.has(source)) {
|
|
798
|
-
intersects = true;
|
|
799
|
-
break;
|
|
800
|
-
}
|
|
801
|
-
}
|
|
802
|
-
if (!intersects) {
|
|
803
|
-
for (const [source, previous] of batch.previous) if (!batch_values.has(source)) batch_values.set(source, previous);
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
}
|
|
807
|
-
/**
|
|
808
|
-
*
|
|
809
|
-
* @param {Effect} effect
|
|
810
|
-
*/
|
|
811
|
-
schedule(effect) {
|
|
812
|
-
last_scheduled_effect = effect;
|
|
813
|
-
if (effect.b?.is_pending && (effect.f & 16777228) !== 0 && (effect.f & 32768) === 0) {
|
|
814
|
-
effect.b.defer_effect(effect);
|
|
815
|
-
return;
|
|
816
|
-
}
|
|
817
|
-
var e = effect;
|
|
818
|
-
while (e.parent !== null) {
|
|
819
|
-
e = e.parent;
|
|
820
|
-
var flags = e.f;
|
|
821
|
-
if (collected_effects !== null && e === active_effect) {
|
|
822
|
-
if (async_mode_flag) return;
|
|
823
|
-
if ((active_reaction === null || (active_reaction.f & 2) === 0) && !legacy_is_updating_store) return;
|
|
824
|
-
}
|
|
825
|
-
if ((flags & 96) !== 0) {
|
|
826
|
-
if ((flags & 1024) === 0) return;
|
|
827
|
-
e.f ^= CLEAN;
|
|
828
|
-
}
|
|
829
|
-
}
|
|
830
|
-
_classPrivateFieldGet2(_roots, this).push(e);
|
|
831
|
-
}
|
|
832
|
-
};
|
|
833
|
-
_Batch = Batch;
|
|
834
|
-
function _is_deferred() {
|
|
835
|
-
if (this.is_fork) return true;
|
|
836
|
-
for (const effect of _classPrivateFieldGet2(_blocking_pending, this).keys()) {
|
|
837
|
-
var e = effect;
|
|
838
|
-
var skipped = false;
|
|
839
|
-
while (e.parent !== null) {
|
|
840
|
-
if (_classPrivateFieldGet2(_skipped_branches, this).has(e)) {
|
|
841
|
-
skipped = true;
|
|
842
|
-
break;
|
|
843
|
-
}
|
|
844
|
-
e = e.parent;
|
|
845
|
-
}
|
|
846
|
-
if (!skipped) return true;
|
|
847
|
-
}
|
|
848
|
-
return false;
|
|
849
|
-
}
|
|
850
|
-
function _process() {
|
|
851
|
-
_classPrivateFieldSet2(_started, this, true);
|
|
852
|
-
if (flush_count++ > 1e3) {
|
|
853
|
-
_assertClassBrand(_Batch_brand, this, _unlink).call(this);
|
|
854
|
-
infinite_loop_guard();
|
|
855
|
-
}
|
|
856
|
-
for (const e of _classPrivateFieldGet2(_dirty_effects$1, this)) {
|
|
857
|
-
_classPrivateFieldGet2(_maybe_dirty_effects$1, this).delete(e);
|
|
858
|
-
set_signal_status(e, DIRTY);
|
|
859
|
-
this.schedule(e);
|
|
860
|
-
}
|
|
861
|
-
for (const e of _classPrivateFieldGet2(_maybe_dirty_effects$1, this)) {
|
|
862
|
-
set_signal_status(e, MAYBE_DIRTY);
|
|
863
|
-
this.schedule(e);
|
|
864
|
-
}
|
|
865
|
-
const roots = _classPrivateFieldGet2(_roots, this);
|
|
866
|
-
_classPrivateFieldSet2(_roots, this, []);
|
|
867
|
-
this.apply();
|
|
868
|
-
/** @type {Effect[]} */
|
|
869
|
-
var effects = collected_effects = [];
|
|
870
|
-
/** @type {Effect[]} */
|
|
871
|
-
var render_effects = [];
|
|
872
|
-
/**
|
|
873
|
-
* @type {Effect[]}
|
|
874
|
-
* @deprecated when we get rid of legacy mode and stores, we can get rid of this
|
|
875
|
-
*/
|
|
876
|
-
var updates = legacy_updates = [];
|
|
877
|
-
for (const root of roots) try {
|
|
878
|
-
_assertClassBrand(_Batch_brand, this, _traverse).call(this, root, effects, render_effects);
|
|
879
|
-
} catch (e) {
|
|
880
|
-
reset_all(root);
|
|
881
|
-
if (!_assertClassBrand(_Batch_brand, this, _is_deferred).call(this)) this.discard();
|
|
882
|
-
throw e;
|
|
883
|
-
}
|
|
884
|
-
current_batch = null;
|
|
885
|
-
if (updates.length > 0) {
|
|
886
|
-
var batch = _Batch.ensure();
|
|
887
|
-
for (const e of updates) batch.schedule(e);
|
|
888
|
-
}
|
|
889
|
-
collected_effects = null;
|
|
890
|
-
legacy_updates = null;
|
|
891
|
-
if (_assertClassBrand(_Batch_brand, this, _is_deferred).call(this)) {
|
|
892
|
-
_assertClassBrand(_Batch_brand, this, _defer_effects).call(this, render_effects);
|
|
893
|
-
_assertClassBrand(_Batch_brand, this, _defer_effects).call(this, effects);
|
|
894
|
-
for (const [e, t] of _classPrivateFieldGet2(_skipped_branches, this)) reset_branch(e, t);
|
|
895
|
-
if (updates.length > 0)
|
|
896
|
-
/** @type {Batch} */ _assertClassBrand(_Batch_brand, current_batch, _process).call(current_batch);
|
|
504
|
+
function flatten(blockers, sync, async, fn) {
|
|
505
|
+
const d = is_runes() ? derived : derived_safe_equal;
|
|
506
|
+
var pending = blockers.filter((b) => !b.settled);
|
|
507
|
+
var deriveds = sync.map(d);
|
|
508
|
+
if (async.length === 0 && pending.length === 0) {
|
|
509
|
+
fn(deriveds);
|
|
897
510
|
return;
|
|
898
511
|
}
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
512
|
+
var parent = active_effect;
|
|
513
|
+
var restore = capture();
|
|
514
|
+
var blocker_promise = pending.length === 1 ? pending[0].promise : pending.length > 1 ? Promise.all(pending.map((b) => b.promise)) : null;
|
|
515
|
+
/**
|
|
516
|
+
* @param {Source[]} async
|
|
517
|
+
*/
|
|
518
|
+
function finish(async) {
|
|
519
|
+
if ((parent.f & 16384) !== 0) return;
|
|
520
|
+
restore();
|
|
521
|
+
try {
|
|
522
|
+
fn([...deriveds, ...async]);
|
|
523
|
+
} catch (error) {
|
|
524
|
+
invoke_error_boundary(error, parent);
|
|
525
|
+
}
|
|
526
|
+
unset_context();
|
|
527
|
+
}
|
|
528
|
+
var decrement_pending = increment_pending();
|
|
529
|
+
if (async.length === 0) {
|
|
530
|
+
/** @type {Promise<any>} */ blocker_promise.then(() => finish([])).finally(decrement_pending);
|
|
904
531
|
return;
|
|
905
532
|
}
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
for (const fn of _classPrivateFieldGet2(_commit_callbacks, this)) fn(this);
|
|
909
|
-
_classPrivateFieldGet2(_commit_callbacks, this).clear();
|
|
910
|
-
previous_batch = this;
|
|
911
|
-
flush_queued_effects(render_effects);
|
|
912
|
-
flush_queued_effects(effects);
|
|
913
|
-
previous_batch = null;
|
|
914
|
-
_classPrivateFieldGet2(_deferred, this)?.resolve();
|
|
915
|
-
var next_batch = current_batch;
|
|
916
|
-
if (_classPrivateFieldGet2(_pending, this) === 0 && (_classPrivateFieldGet2(_roots, this).length === 0 || next_batch !== null)) {
|
|
917
|
-
_assertClassBrand(_Batch_brand, this, _unlink).call(this);
|
|
918
|
-
if (async_mode_flag) {
|
|
919
|
-
_assertClassBrand(_Batch_brand, this, _commit$1).call(this);
|
|
920
|
-
current_batch = next_batch;
|
|
921
|
-
}
|
|
533
|
+
function run() {
|
|
534
|
+
Promise.all(async.map((expression) => /* @__PURE__ */ async_derived(expression))).then(finish).catch((error) => invoke_error_boundary(error, parent)).finally(decrement_pending);
|
|
922
535
|
}
|
|
923
|
-
if (
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
536
|
+
if (blocker_promise) blocker_promise.then(() => {
|
|
537
|
+
restore();
|
|
538
|
+
run();
|
|
539
|
+
unset_context();
|
|
540
|
+
});
|
|
541
|
+
else run();
|
|
928
542
|
}
|
|
929
543
|
/**
|
|
930
|
-
*
|
|
931
|
-
*
|
|
932
|
-
*
|
|
933
|
-
* @param {Effect[]} effects
|
|
934
|
-
* @param {Effect[]} render_effects
|
|
544
|
+
* Captures the current effect context so that we can restore it after
|
|
545
|
+
* some asynchronous work has happened (so that e.g. `await a + b`
|
|
546
|
+
* causes `b` to be registered as a dependency).
|
|
935
547
|
*/
|
|
936
|
-
function
|
|
937
|
-
|
|
938
|
-
var
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
update_effect(effect);
|
|
949
|
-
}
|
|
950
|
-
var child = effect.first;
|
|
951
|
-
if (child !== null) {
|
|
952
|
-
effect = child;
|
|
953
|
-
continue;
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
|
-
while (effect !== null) {
|
|
957
|
-
var next = effect.next;
|
|
958
|
-
if (next !== null) {
|
|
959
|
-
effect = next;
|
|
960
|
-
break;
|
|
961
|
-
}
|
|
962
|
-
effect = effect.parent;
|
|
548
|
+
function capture() {
|
|
549
|
+
var previous_effect = active_effect;
|
|
550
|
+
var previous_reaction = active_reaction;
|
|
551
|
+
var previous_component_context = component_context;
|
|
552
|
+
var previous_batch = current_batch;
|
|
553
|
+
return function restore(activate_batch = true) {
|
|
554
|
+
set_active_effect(previous_effect);
|
|
555
|
+
set_active_reaction(previous_reaction);
|
|
556
|
+
set_component_context(previous_component_context);
|
|
557
|
+
if (activate_batch && (previous_effect.f & 16384) === 0) {
|
|
558
|
+
previous_batch?.activate();
|
|
559
|
+
previous_batch?.apply();
|
|
963
560
|
}
|
|
964
|
-
}
|
|
561
|
+
};
|
|
965
562
|
}
|
|
966
|
-
function
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
}
|
|
972
|
-
batch = _classPrivateFieldGet2(_prev, batch);
|
|
973
|
-
}
|
|
974
|
-
return null;
|
|
563
|
+
function unset_context(deactivate_batch = true) {
|
|
564
|
+
set_active_effect(null);
|
|
565
|
+
set_active_reaction(null);
|
|
566
|
+
set_component_context(null);
|
|
567
|
+
if (deactivate_batch) current_batch?.deactivate();
|
|
975
568
|
}
|
|
976
569
|
/**
|
|
977
|
-
* @
|
|
570
|
+
* @returns {(skip?: boolean) => void}
|
|
978
571
|
*/
|
|
979
|
-
function
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
/**
|
|
990
|
-
* mark all effects that depend on `batch.current`, except the
|
|
991
|
-
* async effects that we just resolved (TODO unless they depend
|
|
992
|
-
* on values in this batch that are NOT in the later batch?).
|
|
993
|
-
* Through this we also will populate the correct #skipped_branches,
|
|
994
|
-
* oncommit callbacks etc, so we don't need to merge them separately.
|
|
995
|
-
* @param {Value} value
|
|
996
|
-
*/
|
|
997
|
-
const mark = (value) => {
|
|
998
|
-
var reactions = value.reactions;
|
|
999
|
-
if (reactions === null) return;
|
|
1000
|
-
for (const reaction of reactions) {
|
|
1001
|
-
var flags = reaction.f;
|
|
1002
|
-
if ((flags & 2) !== 0) mark(reaction);
|
|
1003
|
-
else {
|
|
1004
|
-
var effect = reaction;
|
|
1005
|
-
if (flags & 4194320 && !this.async_deriveds.has(effect)) {
|
|
1006
|
-
_classPrivateFieldGet2(_maybe_dirty_effects$1, this).delete(effect);
|
|
1007
|
-
set_signal_status(effect, DIRTY);
|
|
1008
|
-
this.schedule(effect);
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
}
|
|
572
|
+
function increment_pending() {
|
|
573
|
+
var effect = active_effect;
|
|
574
|
+
var boundary = effect.b;
|
|
575
|
+
var batch = current_batch;
|
|
576
|
+
var blocking = !!boundary?.is_rendered();
|
|
577
|
+
boundary?.update_pending_count(1, batch);
|
|
578
|
+
batch.increment(blocking, effect);
|
|
579
|
+
return () => {
|
|
580
|
+
boundary?.update_pending_count(-1, batch);
|
|
581
|
+
batch.decrement(blocking, effect);
|
|
1012
582
|
};
|
|
1013
|
-
for (const source of this.current.keys()) mark(source);
|
|
1014
|
-
this.oncommit(() => batch.discard());
|
|
1015
|
-
_assertClassBrand(_Batch_brand, batch, _unlink).call(batch);
|
|
1016
|
-
current_batch = this;
|
|
1017
|
-
_assertClassBrand(_Batch_brand, this, _process).call(this);
|
|
1018
583
|
}
|
|
1019
584
|
/**
|
|
1020
|
-
* @
|
|
585
|
+
* @template V
|
|
586
|
+
* @param {() => V} fn
|
|
587
|
+
* @returns {Derived<V>}
|
|
1021
588
|
*/
|
|
1022
|
-
|
|
1023
|
-
|
|
589
|
+
/*#__NO_SIDE_EFFECTS__*/
|
|
590
|
+
function derived(fn) {
|
|
591
|
+
var flags = 2 | DIRTY;
|
|
592
|
+
if (active_effect !== null) active_effect.f |= EFFECT_PRESERVED;
|
|
593
|
+
return {
|
|
594
|
+
ctx: component_context,
|
|
595
|
+
deps: null,
|
|
596
|
+
effects: null,
|
|
597
|
+
equals,
|
|
598
|
+
f: flags,
|
|
599
|
+
fn,
|
|
600
|
+
reactions: null,
|
|
601
|
+
rv: 0,
|
|
602
|
+
v: UNINITIALIZED,
|
|
603
|
+
wv: 0,
|
|
604
|
+
parent: active_effect,
|
|
605
|
+
ac: null
|
|
606
|
+
};
|
|
1024
607
|
}
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
608
|
+
var OBSOLETE = Symbol("obsolete");
|
|
609
|
+
/**
|
|
610
|
+
* @template V
|
|
611
|
+
* @param {() => V | Promise<V>} fn
|
|
612
|
+
* @param {string} [label]
|
|
613
|
+
* @param {string} [location] If provided, print a warning if the value is not read immediately after update
|
|
614
|
+
* @returns {Promise<Source<V>>}
|
|
615
|
+
*/
|
|
616
|
+
/*#__NO_SIDE_EFFECTS__*/
|
|
617
|
+
function async_derived(fn, label, location) {
|
|
618
|
+
let parent = active_effect;
|
|
619
|
+
if (parent === null) async_derived_orphan();
|
|
620
|
+
var promise = void 0;
|
|
621
|
+
var signal = source(UNINITIALIZED);
|
|
622
|
+
var should_suspend = !active_reaction;
|
|
623
|
+
/** @type {Set<ReturnType<typeof deferred<V>>>} */
|
|
624
|
+
var deferreds = /* @__PURE__ */ new Set();
|
|
625
|
+
async_effect(() => {
|
|
626
|
+
var effect = active_effect;
|
|
627
|
+
/** @type {ReturnType<typeof deferred<V>>} */
|
|
628
|
+
var d = deferred();
|
|
629
|
+
promise = d.promise;
|
|
630
|
+
try {
|
|
631
|
+
Promise.resolve(fn()).then(d.resolve, (e) => {
|
|
632
|
+
if (e !== STALE_REACTION) d.reject(e);
|
|
633
|
+
}).finally(unset_context);
|
|
634
|
+
} catch (error) {
|
|
635
|
+
d.reject(error);
|
|
636
|
+
unset_context();
|
|
1037
637
|
}
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
if (
|
|
638
|
+
var batch = current_batch;
|
|
639
|
+
if (should_suspend) {
|
|
640
|
+
if ((effect.f & 32768) !== 0) var decrement_pending = increment_pending();
|
|
641
|
+
if (parent.b?.is_rendered()) batch.async_deriveds.get(effect)?.reject(OBSOLETE);
|
|
642
|
+
else for (const d of deferreds.values()) d.reject(OBSOLETE);
|
|
643
|
+
deferreds.add(d);
|
|
644
|
+
batch.async_deriveds.set(effect, d);
|
|
1041
645
|
}
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
});
|
|
646
|
+
/**
|
|
647
|
+
* @param {any} value
|
|
648
|
+
* @param {unknown} error
|
|
649
|
+
*/
|
|
650
|
+
const handler = (value, error = void 0) => {
|
|
651
|
+
decrement_pending?.();
|
|
652
|
+
deferreds.delete(d);
|
|
653
|
+
if (error === OBSOLETE) return;
|
|
1051
654
|
batch.activate();
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
var current_unequal = [...batch.current].filter(([c, v1]) => {
|
|
1059
|
-
const v2 = this.current.get(c);
|
|
1060
|
-
if (!v2) return true;
|
|
1061
|
-
return v2[0] !== v1[0] || v2[1] !== v1[1];
|
|
1062
|
-
}).map(([c]) => c);
|
|
1063
|
-
if (current_unequal.length > 0) {
|
|
1064
|
-
for (const effect of _classPrivateFieldGet2(_new_effects, this)) if ((effect.f & 155648) === 0 && depends_on(effect, current_unequal, checked)) if ((effect.f & 4194320) !== 0) {
|
|
1065
|
-
set_signal_status(effect, DIRTY);
|
|
1066
|
-
batch.schedule(effect);
|
|
1067
|
-
} else _classPrivateFieldGet2(_dirty_effects$1, batch).add(effect);
|
|
1068
|
-
}
|
|
1069
|
-
if (_classPrivateFieldGet2(_roots, batch).length > 0 && !_classPrivateFieldGet2(_decrement_queued, batch)) {
|
|
1070
|
-
batch.apply();
|
|
1071
|
-
for (var root of _classPrivateFieldGet2(_roots, batch)) _assertClassBrand(_Batch_brand, batch, _traverse).call(batch, root, [], []);
|
|
1072
|
-
_classPrivateFieldSet2(_roots, batch, []);
|
|
655
|
+
if (error) {
|
|
656
|
+
signal.f |= ERROR_VALUE;
|
|
657
|
+
internal_set(signal, error);
|
|
658
|
+
} else {
|
|
659
|
+
if ((signal.f & 8388608) !== 0) signal.f ^= ERROR_VALUE;
|
|
660
|
+
internal_set(signal, value);
|
|
1073
661
|
}
|
|
1074
662
|
batch.deactivate();
|
|
663
|
+
};
|
|
664
|
+
d.promise.then(handler, (e) => handler(null, e || "unknown"));
|
|
665
|
+
});
|
|
666
|
+
teardown(() => {
|
|
667
|
+
for (const d of deferreds) d.reject(OBSOLETE);
|
|
668
|
+
});
|
|
669
|
+
return new Promise((fulfil) => {
|
|
670
|
+
/** @param {Promise<V>} p */
|
|
671
|
+
function next(p) {
|
|
672
|
+
function go() {
|
|
673
|
+
if (p === promise) fulfil(signal);
|
|
674
|
+
else next(promise);
|
|
675
|
+
}
|
|
676
|
+
p.then(go, go);
|
|
1075
677
|
}
|
|
1076
|
-
|
|
1077
|
-
}
|
|
1078
|
-
function _unlink() {
|
|
1079
|
-
if (!this.linked) return;
|
|
1080
|
-
var prev = _classPrivateFieldGet2(_prev, this);
|
|
1081
|
-
var next = _classPrivateFieldGet2(_next, this);
|
|
1082
|
-
if (prev === null) first_batch = next;
|
|
1083
|
-
else _classPrivateFieldSet2(_next, prev, next);
|
|
1084
|
-
if (next === null) last_batch = prev;
|
|
1085
|
-
else _classPrivateFieldSet2(_prev, next, prev);
|
|
1086
|
-
this.linked = false;
|
|
678
|
+
next(promise);
|
|
679
|
+
});
|
|
1087
680
|
}
|
|
1088
681
|
/**
|
|
1089
|
-
*
|
|
1090
|
-
*
|
|
1091
|
-
* @
|
|
1092
|
-
* @param {(() => T) | undefined} [fn]
|
|
1093
|
-
* @returns {T}
|
|
682
|
+
* @template V
|
|
683
|
+
* @param {() => V} fn
|
|
684
|
+
* @returns {Derived<V>}
|
|
1094
685
|
*/
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
if (fn) {
|
|
1101
|
-
if (current_batch !== null && !current_batch.is_fork) current_batch.flush();
|
|
1102
|
-
result = fn();
|
|
1103
|
-
}
|
|
1104
|
-
while (true) {
|
|
1105
|
-
flush_tasks();
|
|
1106
|
-
if (current_batch === null) return result;
|
|
1107
|
-
current_batch.flush();
|
|
1108
|
-
}
|
|
1109
|
-
} finally {
|
|
1110
|
-
is_flushing_sync = was_flushing_sync;
|
|
1111
|
-
}
|
|
686
|
+
/*#__NO_SIDE_EFFECTS__*/
|
|
687
|
+
function user_derived(fn) {
|
|
688
|
+
const d = /* @__PURE__ */ derived(fn);
|
|
689
|
+
if (!async_mode_flag) push_reaction_value(d);
|
|
690
|
+
return d;
|
|
1112
691
|
}
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
692
|
+
/**
|
|
693
|
+
* @template V
|
|
694
|
+
* @param {() => V} fn
|
|
695
|
+
* @returns {Derived<V>}
|
|
696
|
+
*/
|
|
697
|
+
/*#__NO_SIDE_EFFECTS__*/
|
|
698
|
+
function derived_safe_equal(fn) {
|
|
699
|
+
const signal = /* @__PURE__ */ derived(fn);
|
|
700
|
+
signal.equals = safe_equals;
|
|
701
|
+
return signal;
|
|
1119
702
|
}
|
|
1120
|
-
/** @type {Set<Effect> | null} */
|
|
1121
|
-
var eager_block_effects = null;
|
|
1122
703
|
/**
|
|
1123
|
-
* @param {
|
|
704
|
+
* @param {Derived} derived
|
|
1124
705
|
* @returns {void}
|
|
1125
706
|
*/
|
|
1126
|
-
function
|
|
1127
|
-
var
|
|
1128
|
-
if (
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
var effect = effects[i++];
|
|
1132
|
-
if ((effect.f & 24576) === 0 && is_dirty(effect)) {
|
|
1133
|
-
eager_block_effects = /* @__PURE__ */ new Set();
|
|
1134
|
-
update_effect(effect);
|
|
1135
|
-
if (effect.deps === null && effect.first === null && effect.nodes === null && effect.teardown === null && effect.ac === null) unlink_effect(effect);
|
|
1136
|
-
if (eager_block_effects?.size > 0) {
|
|
1137
|
-
old_values.clear();
|
|
1138
|
-
for (const e of eager_block_effects) {
|
|
1139
|
-
if ((e.f & 24576) !== 0) continue;
|
|
1140
|
-
/** @type {Effect[]} */
|
|
1141
|
-
const ordered_effects = [e];
|
|
1142
|
-
let ancestor = e.parent;
|
|
1143
|
-
while (ancestor !== null) {
|
|
1144
|
-
if (eager_block_effects.has(ancestor)) {
|
|
1145
|
-
eager_block_effects.delete(ancestor);
|
|
1146
|
-
ordered_effects.push(ancestor);
|
|
1147
|
-
}
|
|
1148
|
-
ancestor = ancestor.parent;
|
|
1149
|
-
}
|
|
1150
|
-
for (let j = ordered_effects.length - 1; j >= 0; j--) {
|
|
1151
|
-
const e = ordered_effects[j];
|
|
1152
|
-
if ((e.f & 24576) !== 0) continue;
|
|
1153
|
-
update_effect(e);
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1156
|
-
eager_block_effects.clear();
|
|
1157
|
-
}
|
|
1158
|
-
}
|
|
707
|
+
function destroy_derived_effects(derived) {
|
|
708
|
+
var effects = derived.effects;
|
|
709
|
+
if (effects !== null) {
|
|
710
|
+
derived.effects = null;
|
|
711
|
+
for (var i = 0; i < effects.length; i += 1) destroy_effect(effects[i]);
|
|
1159
712
|
}
|
|
1160
|
-
eager_block_effects = null;
|
|
1161
713
|
}
|
|
1162
714
|
/**
|
|
1163
|
-
*
|
|
1164
|
-
*
|
|
1165
|
-
*
|
|
1166
|
-
* @param {Value} value
|
|
1167
|
-
* @param {Source[]} sources
|
|
1168
|
-
* @param {Set<Value>} marked
|
|
1169
|
-
* @param {Map<Reaction, boolean>} checked
|
|
715
|
+
* @template T
|
|
716
|
+
* @param {Derived} derived
|
|
717
|
+
* @returns {T}
|
|
1170
718
|
*/
|
|
1171
|
-
function
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
719
|
+
function execute_derived(derived) {
|
|
720
|
+
var value;
|
|
721
|
+
var prev_active_effect = active_effect;
|
|
722
|
+
var parent = derived.parent;
|
|
723
|
+
if (!is_destroying_effect && parent !== null && derived.v !== UNINITIALIZED && (parent.f & 24576) !== 0) {
|
|
724
|
+
derived_inert();
|
|
725
|
+
return derived.v;
|
|
726
|
+
}
|
|
727
|
+
set_active_effect(parent);
|
|
728
|
+
try {
|
|
729
|
+
derived.f &= ~WAS_MARKED;
|
|
730
|
+
destroy_derived_effects(derived);
|
|
731
|
+
value = update_reaction(derived);
|
|
732
|
+
} finally {
|
|
733
|
+
set_active_effect(prev_active_effect);
|
|
1181
734
|
}
|
|
735
|
+
return value;
|
|
1182
736
|
}
|
|
1183
737
|
/**
|
|
1184
|
-
* @param {
|
|
1185
|
-
* @
|
|
1186
|
-
* @param {Map<Reaction, boolean>} checked
|
|
738
|
+
* @param {Derived} derived
|
|
739
|
+
* @returns {void}
|
|
1187
740
|
*/
|
|
1188
|
-
function
|
|
1189
|
-
|
|
1190
|
-
if (
|
|
1191
|
-
|
|
1192
|
-
if (
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
741
|
+
function update_derived(derived) {
|
|
742
|
+
var value = execute_derived(derived);
|
|
743
|
+
if (!derived.equals(value)) {
|
|
744
|
+
derived.wv = increment_write_version();
|
|
745
|
+
if (!current_batch?.is_fork || derived.deps === null) {
|
|
746
|
+
if (current_batch !== null) {
|
|
747
|
+
current_batch.capture(derived, value, true);
|
|
748
|
+
previous_batch?.capture(derived, value, true);
|
|
749
|
+
} else derived.v = value;
|
|
750
|
+
if (derived.deps === null) {
|
|
751
|
+
set_signal_status(derived, CLEAN);
|
|
752
|
+
return;
|
|
753
|
+
}
|
|
1196
754
|
}
|
|
1197
755
|
}
|
|
1198
|
-
|
|
1199
|
-
|
|
756
|
+
if (is_destroying_effect) return;
|
|
757
|
+
if (batch_values !== null) {
|
|
758
|
+
if (effect_tracking() || current_batch?.is_fork) batch_values.set(derived, value);
|
|
759
|
+
} else update_derived_status(derived);
|
|
1200
760
|
}
|
|
1201
761
|
/**
|
|
1202
|
-
* @param {
|
|
1203
|
-
* @returns {void}
|
|
762
|
+
* @param {Derived} derived
|
|
1204
763
|
*/
|
|
1205
|
-
function
|
|
1206
|
-
|
|
764
|
+
function freeze_derived_effects(derived) {
|
|
765
|
+
if (derived.effects === null) return;
|
|
766
|
+
for (const e of derived.effects) if (e.teardown || e.ac) {
|
|
767
|
+
e.teardown?.();
|
|
768
|
+
if (e.ac !== null) without_reactive_context(() => {
|
|
769
|
+
/** @type {AbortController} */ e.ac.abort(STALE_REACTION);
|
|
770
|
+
e.ac = null;
|
|
771
|
+
});
|
|
772
|
+
if (e.fn !== null) e.teardown = noop;
|
|
773
|
+
remove_reactions(e, 0);
|
|
774
|
+
destroy_effect_children(e);
|
|
775
|
+
}
|
|
1207
776
|
}
|
|
1208
777
|
/**
|
|
1209
|
-
*
|
|
1210
|
-
* they can be correctly rescheduled later. Tracks dirty and maybe_dirty
|
|
1211
|
-
* effects so they can be rescheduled if the branch survives.
|
|
1212
|
-
* @param {Effect} effect
|
|
1213
|
-
* @param {{ d: Effect[], m: Effect[] }} tracked
|
|
778
|
+
* @param {Derived} derived
|
|
1214
779
|
*/
|
|
1215
|
-
function
|
|
1216
|
-
if (
|
|
1217
|
-
if (
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
780
|
+
function unfreeze_derived_effects(derived) {
|
|
781
|
+
if (derived.effects === null) return;
|
|
782
|
+
for (const e of derived.effects) if (e.teardown && e.fn !== null) update_effect(e);
|
|
783
|
+
}
|
|
784
|
+
//#endregion
|
|
785
|
+
//#region \0@oxc-project+runtime@0.139.0/helpers/esm/checkPrivateRedeclaration.js
|
|
786
|
+
function _checkPrivateRedeclaration(e, t) {
|
|
787
|
+
if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
788
|
+
}
|
|
789
|
+
//#endregion
|
|
790
|
+
//#region \0@oxc-project+runtime@0.139.0/helpers/esm/classPrivateMethodInitSpec.js
|
|
791
|
+
function _classPrivateMethodInitSpec(e, a) {
|
|
792
|
+
_checkPrivateRedeclaration(e, a), a.add(e);
|
|
793
|
+
}
|
|
794
|
+
//#endregion
|
|
795
|
+
//#region \0@oxc-project+runtime@0.139.0/helpers/esm/classPrivateFieldInitSpec.js
|
|
796
|
+
function _classPrivateFieldInitSpec(e, t, a) {
|
|
797
|
+
_checkPrivateRedeclaration(e, t), t.set(e, a);
|
|
1225
798
|
}
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
set_signal_status(effect, CLEAN);
|
|
1232
|
-
var e = effect.first;
|
|
1233
|
-
while (e !== null) {
|
|
1234
|
-
reset_all(e);
|
|
1235
|
-
e = e.next;
|
|
1236
|
-
}
|
|
799
|
+
//#endregion
|
|
800
|
+
//#region \0@oxc-project+runtime@0.139.0/helpers/esm/assertClassBrand.js
|
|
801
|
+
function _assertClassBrand(e, t, n) {
|
|
802
|
+
if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
|
|
803
|
+
throw new TypeError("Private element is not present on this object");
|
|
1237
804
|
}
|
|
1238
805
|
//#endregion
|
|
1239
|
-
//#region
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
* It's particularly useful for integrating with web APIs like `MediaQuery`, `IntersectionObserver`, or `WebSocket`.
|
|
1243
|
-
*
|
|
1244
|
-
* If `subscribe` is called inside an effect (including indirectly, for example inside a getter),
|
|
1245
|
-
* the `start` callback will be called with an `update` function. Whenever `update` is called, the effect re-runs.
|
|
1246
|
-
*
|
|
1247
|
-
* If `start` returns a cleanup function, it will be called when the effect is destroyed.
|
|
1248
|
-
*
|
|
1249
|
-
* If `subscribe` is called in multiple effects, `start` will only be called once as long as the effects
|
|
1250
|
-
* are active, and the returned teardown function will only be called when all effects are destroyed.
|
|
1251
|
-
*
|
|
1252
|
-
* It's best understood with an example. Here's an implementation of [`MediaQuery`](https://svelte.dev/docs/svelte/svelte-reactivity#MediaQuery):
|
|
1253
|
-
*
|
|
1254
|
-
* ```js
|
|
1255
|
-
* import { createSubscriber } from 'svelte/reactivity';
|
|
1256
|
-
* import { on } from 'svelte/events';
|
|
1257
|
-
*
|
|
1258
|
-
* export class MediaQuery {
|
|
1259
|
-
* #query;
|
|
1260
|
-
* #subscribe;
|
|
1261
|
-
*
|
|
1262
|
-
* constructor(query) {
|
|
1263
|
-
* this.#query = window.matchMedia(`(${query})`);
|
|
1264
|
-
*
|
|
1265
|
-
* this.#subscribe = createSubscriber((update) => {
|
|
1266
|
-
* // when the `change` event occurs, re-run any effects that read `this.current`
|
|
1267
|
-
* const off = on(this.#query, 'change', update);
|
|
1268
|
-
*
|
|
1269
|
-
* // stop listening when all the effects are destroyed
|
|
1270
|
-
* return () => off();
|
|
1271
|
-
* });
|
|
1272
|
-
* }
|
|
1273
|
-
*
|
|
1274
|
-
* get current() {
|
|
1275
|
-
* // This makes the getter reactive, if read in an effect
|
|
1276
|
-
* this.#subscribe();
|
|
1277
|
-
*
|
|
1278
|
-
* // Return the current state of the query, whether or not we're in an effect
|
|
1279
|
-
* return this.#query.matches;
|
|
1280
|
-
* }
|
|
1281
|
-
* }
|
|
1282
|
-
* ```
|
|
1283
|
-
* @param {(update: () => void) => (() => void) | void} start
|
|
1284
|
-
* @since 5.7.0
|
|
1285
|
-
*/
|
|
1286
|
-
function createSubscriber(start) {
|
|
1287
|
-
let subscribers = 0;
|
|
1288
|
-
let version = source(0);
|
|
1289
|
-
/** @type {(() => void) | void} */
|
|
1290
|
-
let stop;
|
|
1291
|
-
return () => {
|
|
1292
|
-
if (effect_tracking()) {
|
|
1293
|
-
get(version);
|
|
1294
|
-
render_effect(() => {
|
|
1295
|
-
if (subscribers === 0) stop = untrack(() => start(() => increment(version)));
|
|
1296
|
-
subscribers += 1;
|
|
1297
|
-
return () => {
|
|
1298
|
-
queue_micro_task(() => {
|
|
1299
|
-
subscribers -= 1;
|
|
1300
|
-
if (subscribers === 0) {
|
|
1301
|
-
stop?.();
|
|
1302
|
-
stop = void 0;
|
|
1303
|
-
increment(version);
|
|
1304
|
-
}
|
|
1305
|
-
});
|
|
1306
|
-
};
|
|
1307
|
-
});
|
|
1308
|
-
}
|
|
1309
|
-
};
|
|
806
|
+
//#region \0@oxc-project+runtime@0.139.0/helpers/esm/classPrivateFieldSet2.js
|
|
807
|
+
function _classPrivateFieldSet2(s, a, r) {
|
|
808
|
+
return s.set(_assertClassBrand(s, a), r), r;
|
|
1310
809
|
}
|
|
1311
810
|
//#endregion
|
|
1312
|
-
//#region
|
|
1313
|
-
|
|
811
|
+
//#region \0@oxc-project+runtime@0.139.0/helpers/esm/classPrivateFieldGet2.js
|
|
812
|
+
function _classPrivateFieldGet2(s, a) {
|
|
813
|
+
return s.get(_assertClassBrand(s, a));
|
|
814
|
+
}
|
|
815
|
+
//#endregion
|
|
816
|
+
//#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/batch.js
|
|
817
|
+
/** @import { Fork } from 'svelte' */
|
|
818
|
+
/** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
|
|
819
|
+
var _Batch;
|
|
820
|
+
/** @type {Batch | null} */
|
|
821
|
+
var first_batch = null;
|
|
822
|
+
/** @type {Batch | null} */
|
|
823
|
+
var last_batch = null;
|
|
824
|
+
/** @type {Batch | null} */
|
|
825
|
+
var current_batch = null;
|
|
1314
826
|
/**
|
|
1315
|
-
*
|
|
1316
|
-
*
|
|
1317
|
-
* failed?: ((anchor: Node, error: () => unknown, reset: () => () => void) => void) | null;
|
|
1318
|
-
* pending?: ((anchor: Node) => void) | null;
|
|
1319
|
-
* }} BoundaryProps
|
|
827
|
+
* This is needed to avoid overwriting inputs
|
|
828
|
+
* @type {Batch | null}
|
|
1320
829
|
*/
|
|
1321
|
-
var
|
|
830
|
+
var previous_batch = null;
|
|
1322
831
|
/**
|
|
1323
|
-
*
|
|
1324
|
-
*
|
|
1325
|
-
*
|
|
1326
|
-
* @
|
|
1327
|
-
* @returns {void}
|
|
832
|
+
* When time travelling (i.e. working in one batch, while other batches
|
|
833
|
+
* still have ongoing work), we ignore the real values of affected
|
|
834
|
+
* signals in favour of their values within the batch
|
|
835
|
+
* @type {Map<Value, any> | null}
|
|
1328
836
|
*/
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
var
|
|
1333
|
-
var
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
var
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
var
|
|
1349
|
-
var
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
837
|
+
var batch_values = null;
|
|
838
|
+
/** @type {Effect | null} */
|
|
839
|
+
var last_scheduled_effect = null;
|
|
840
|
+
var is_flushing_sync = false;
|
|
841
|
+
var is_processing = false;
|
|
842
|
+
/**
|
|
843
|
+
* During traversal, this is an array. Newly created effects are (if not immediately
|
|
844
|
+
* executed) pushed to this array, rather than going through the scheduling
|
|
845
|
+
* rigamarole that would cause another turn of the flush loop.
|
|
846
|
+
* @type {Effect[] | null}
|
|
847
|
+
*/
|
|
848
|
+
var collected_effects = null;
|
|
849
|
+
/**
|
|
850
|
+
* An array of effects that are marked during traversal as a result of a `set`
|
|
851
|
+
* (not `internal_set`) call. These will be added to the next batch and
|
|
852
|
+
* trigger another `batch.process()`
|
|
853
|
+
* @type {Effect[] | null}
|
|
854
|
+
* @deprecated when we get rid of legacy mode and stores, we can get rid of this
|
|
855
|
+
*/
|
|
856
|
+
var legacy_updates = null;
|
|
857
|
+
var flush_count = 0;
|
|
858
|
+
var uid = 1;
|
|
859
|
+
var _started = /* @__PURE__ */ new WeakMap();
|
|
860
|
+
var _prev = /* @__PURE__ */ new WeakMap();
|
|
861
|
+
var _next = /* @__PURE__ */ new WeakMap();
|
|
862
|
+
var _commit_callbacks = /* @__PURE__ */ new WeakMap();
|
|
863
|
+
var _discard_callbacks = /* @__PURE__ */ new WeakMap();
|
|
864
|
+
var _pending = /* @__PURE__ */ new WeakMap();
|
|
865
|
+
var _blocking_pending = /* @__PURE__ */ new WeakMap();
|
|
866
|
+
var _deferred = /* @__PURE__ */ new WeakMap();
|
|
867
|
+
var _roots = /* @__PURE__ */ new WeakMap();
|
|
868
|
+
var _new_effects = /* @__PURE__ */ new WeakMap();
|
|
869
|
+
var _dirty_effects$1 = /* @__PURE__ */ new WeakMap();
|
|
870
|
+
var _maybe_dirty_effects$1 = /* @__PURE__ */ new WeakMap();
|
|
871
|
+
var _skipped_branches = /* @__PURE__ */ new WeakMap();
|
|
872
|
+
var _unskipped_branches = /* @__PURE__ */ new WeakMap();
|
|
873
|
+
var _decrement_queued = /* @__PURE__ */ new WeakMap();
|
|
874
|
+
var _Batch_brand = /* @__PURE__ */ new WeakSet();
|
|
875
|
+
var Batch = class Batch {
|
|
876
|
+
constructor() {
|
|
877
|
+
_classPrivateMethodInitSpec(this, _Batch_brand);
|
|
878
|
+
_defineProperty(this, "id", uid++);
|
|
879
|
+
_classPrivateFieldInitSpec(this, _started, false);
|
|
880
|
+
_defineProperty(this, "linked", true);
|
|
881
|
+
_classPrivateFieldInitSpec(this, _prev, null);
|
|
882
|
+
_classPrivateFieldInitSpec(this, _next, null);
|
|
1358
883
|
_defineProperty(
|
|
1359
884
|
this,
|
|
1360
|
-
/** @type {
|
|
1361
|
-
"
|
|
1362
|
-
|
|
885
|
+
/** @type {Map<Effect, ReturnType<typeof deferred<any>>>} */
|
|
886
|
+
"async_deriveds",
|
|
887
|
+
/* @__PURE__ */ new Map()
|
|
1363
888
|
);
|
|
1364
|
-
_defineProperty(this, "is_pending", false);
|
|
1365
889
|
_defineProperty(
|
|
1366
|
-
this,
|
|
1367
|
-
/**
|
|
1368
|
-
*
|
|
1369
|
-
*
|
|
1370
|
-
*
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
_classPrivateFieldInitSpec(this,
|
|
1387
|
-
_classPrivateFieldInitSpec(this,
|
|
1388
|
-
_classPrivateFieldInitSpec(this,
|
|
1389
|
-
_classPrivateFieldInitSpec(this,
|
|
1390
|
-
_classPrivateFieldInitSpec(this,
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
}
|
|
1404
|
-
|
|
1405
|
-
this.transform_error = transform_error ?? this.parent?.transform_error ?? ((e) => e);
|
|
1406
|
-
_classPrivateFieldSet2(_effect, this, block(() => {
|
|
1407
|
-
if (hydrating) {
|
|
1408
|
-
const comment = _classPrivateFieldGet2(_hydrate_open, this);
|
|
1409
|
-
hydrate_next();
|
|
1410
|
-
const server_rendered_pending = comment.data === "[!";
|
|
1411
|
-
if (comment.data.startsWith("[?")) {
|
|
1412
|
-
const serialized_error = JSON.parse(comment.data.slice(2));
|
|
1413
|
-
_assertClassBrand(_Boundary_brand, this, _hydrate_failed_content).call(this, serialized_error);
|
|
1414
|
-
} else if (server_rendered_pending) _assertClassBrand(_Boundary_brand, this, _hydrate_pending_content).call(this);
|
|
1415
|
-
else _assertClassBrand(_Boundary_brand, this, _hydrate_resolved_content).call(this);
|
|
1416
|
-
} else _assertClassBrand(_Boundary_brand, this, _render).call(this);
|
|
1417
|
-
}, flags));
|
|
1418
|
-
if (hydrating) _classPrivateFieldSet2(_anchor, this, hydrate_node);
|
|
890
|
+
this,
|
|
891
|
+
/**
|
|
892
|
+
* The current values of any signals that are updated in this batch.
|
|
893
|
+
* Tuple format: [value, is_derived] (note: is_derived is false for deriveds, too, if they were overridden via assignment)
|
|
894
|
+
* They keys of this map are identical to `this.#previous`
|
|
895
|
+
* @type {Map<Value, [any, boolean]>}
|
|
896
|
+
*/
|
|
897
|
+
"current",
|
|
898
|
+
/* @__PURE__ */ new Map()
|
|
899
|
+
);
|
|
900
|
+
_defineProperty(
|
|
901
|
+
this,
|
|
902
|
+
/**
|
|
903
|
+
* The values of any signals (sources and deriveds) that are updated in this batch _before_ those updates took place.
|
|
904
|
+
* They keys of this map are identical to `this.#current`
|
|
905
|
+
* @type {Map<Value, any>}
|
|
906
|
+
*/
|
|
907
|
+
"previous",
|
|
908
|
+
/* @__PURE__ */ new Map()
|
|
909
|
+
);
|
|
910
|
+
_classPrivateFieldInitSpec(this, _commit_callbacks, /* @__PURE__ */ new Set());
|
|
911
|
+
_classPrivateFieldInitSpec(this, _discard_callbacks, /* @__PURE__ */ new Set());
|
|
912
|
+
_classPrivateFieldInitSpec(this, _pending, 0);
|
|
913
|
+
_classPrivateFieldInitSpec(this, _blocking_pending, /* @__PURE__ */ new Map());
|
|
914
|
+
_classPrivateFieldInitSpec(this, _deferred, null);
|
|
915
|
+
_classPrivateFieldInitSpec(this, _roots, []);
|
|
916
|
+
_classPrivateFieldInitSpec(this, _new_effects, []);
|
|
917
|
+
_classPrivateFieldInitSpec(this, _dirty_effects$1, /* @__PURE__ */ new Set());
|
|
918
|
+
_classPrivateFieldInitSpec(this, _maybe_dirty_effects$1, /* @__PURE__ */ new Set());
|
|
919
|
+
_classPrivateFieldInitSpec(this, _skipped_branches, /* @__PURE__ */ new Map());
|
|
920
|
+
_classPrivateFieldInitSpec(this, _unskipped_branches, /* @__PURE__ */ new Set());
|
|
921
|
+
_defineProperty(this, "is_fork", false);
|
|
922
|
+
_classPrivateFieldInitSpec(this, _decrement_queued, false);
|
|
923
|
+
if (last_batch === null) first_batch = last_batch = this;
|
|
924
|
+
else {
|
|
925
|
+
_classPrivateFieldSet2(_next, last_batch, this);
|
|
926
|
+
_classPrivateFieldSet2(_prev, this, last_batch);
|
|
927
|
+
}
|
|
928
|
+
last_batch = this;
|
|
1419
929
|
}
|
|
1420
930
|
/**
|
|
1421
|
-
*
|
|
931
|
+
* Add an effect to the #skipped_branches map and reset its children
|
|
1422
932
|
* @param {Effect} effect
|
|
1423
933
|
*/
|
|
1424
|
-
|
|
1425
|
-
|
|
934
|
+
skip_effect(effect) {
|
|
935
|
+
if (!_classPrivateFieldGet2(_skipped_branches, this).has(effect)) _classPrivateFieldGet2(_skipped_branches, this).set(effect, {
|
|
936
|
+
d: [],
|
|
937
|
+
m: []
|
|
938
|
+
});
|
|
939
|
+
_classPrivateFieldGet2(_unskipped_branches, this).delete(effect);
|
|
1426
940
|
}
|
|
1427
941
|
/**
|
|
1428
|
-
*
|
|
1429
|
-
*
|
|
942
|
+
* Remove an effect from the #skipped_branches map and reschedule
|
|
943
|
+
* any tracked dirty/maybe_dirty child effects
|
|
944
|
+
* @param {Effect} effect
|
|
945
|
+
* @param {(e: Effect) => void} callback
|
|
1430
946
|
*/
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
947
|
+
unskip_effect(effect, callback = (e) => this.schedule(e)) {
|
|
948
|
+
var tracked = _classPrivateFieldGet2(_skipped_branches, this).get(effect);
|
|
949
|
+
if (tracked) {
|
|
950
|
+
_classPrivateFieldGet2(_skipped_branches, this).delete(effect);
|
|
951
|
+
for (var e of tracked.d) {
|
|
952
|
+
set_signal_status(e, DIRTY);
|
|
953
|
+
callback(e);
|
|
954
|
+
}
|
|
955
|
+
for (e of tracked.m) {
|
|
956
|
+
set_signal_status(e, MAYBE_DIRTY);
|
|
957
|
+
callback(e);
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
_classPrivateFieldGet2(_unskipped_branches, this).add(effect);
|
|
1436
961
|
}
|
|
1437
962
|
/**
|
|
1438
|
-
*
|
|
1439
|
-
*
|
|
1440
|
-
*
|
|
1441
|
-
* @param {
|
|
1442
|
-
* @param {
|
|
963
|
+
* Associate a change to a given source with the current
|
|
964
|
+
* batch, noting its previous and current values
|
|
965
|
+
* @param {Value} source
|
|
966
|
+
* @param {any} value
|
|
967
|
+
* @param {boolean} [is_derived]
|
|
1443
968
|
*/
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
if (_classPrivateFieldGet2(_effect_pending, this)) internal_set(_classPrivateFieldGet2(_effect_pending, this), _classPrivateFieldGet2(_local_pending_count, this));
|
|
1452
|
-
});
|
|
1453
|
-
}
|
|
1454
|
-
get_effect_pending() {
|
|
1455
|
-
_classPrivateFieldGet2(_effect_pending_subscriber, this).call(this);
|
|
1456
|
-
return get(_classPrivateFieldGet2(_effect_pending, this));
|
|
969
|
+
capture(source, value, is_derived = false) {
|
|
970
|
+
if (source.v !== UNINITIALIZED && !this.previous.has(source)) this.previous.set(source, source.v);
|
|
971
|
+
if ((source.f & 8388608) === 0) {
|
|
972
|
+
this.current.set(source, [value, is_derived]);
|
|
973
|
+
batch_values?.set(source, value);
|
|
974
|
+
}
|
|
975
|
+
if (!this.is_fork) source.v = value;
|
|
1457
976
|
}
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
if (!_classPrivateFieldGet2(_props, this).onerror && !_classPrivateFieldGet2(_props, this).failed) throw error;
|
|
1461
|
-
if (current_batch?.is_fork) {
|
|
1462
|
-
if (_classPrivateFieldGet2(_main_effect, this)) current_batch.skip_effect(_classPrivateFieldGet2(_main_effect, this));
|
|
1463
|
-
if (_classPrivateFieldGet2(_pending_effect, this)) current_batch.skip_effect(_classPrivateFieldGet2(_pending_effect, this));
|
|
1464
|
-
if (_classPrivateFieldGet2(_failed_effect, this)) current_batch.skip_effect(_classPrivateFieldGet2(_failed_effect, this));
|
|
1465
|
-
current_batch.oncommit(() => {
|
|
1466
|
-
_assertClassBrand(_Boundary_brand, this, _handle_error).call(this, error);
|
|
1467
|
-
});
|
|
1468
|
-
} else _assertClassBrand(_Boundary_brand, this, _handle_error).call(this, error);
|
|
977
|
+
activate() {
|
|
978
|
+
current_batch = this;
|
|
1469
979
|
}
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
_classPrivateFieldSet2(_main_effect, this, branch(() => _classPrivateFieldGet2(_children, this).call(this, _classPrivateFieldGet2(_anchor, this))));
|
|
1474
|
-
} catch (error) {
|
|
1475
|
-
this.error(error);
|
|
980
|
+
deactivate() {
|
|
981
|
+
current_batch = null;
|
|
982
|
+
batch_values = null;
|
|
1476
983
|
}
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
this.is_pending = true;
|
|
1492
|
-
_classPrivateFieldSet2(_pending_effect, this, branch(() => pending(_classPrivateFieldGet2(_anchor, this))));
|
|
1493
|
-
queue_micro_task(() => {
|
|
1494
|
-
var fragment = _classPrivateFieldSet2(_offscreen_fragment, this, document.createDocumentFragment());
|
|
1495
|
-
var anchor = create_text();
|
|
1496
|
-
fragment.append(anchor);
|
|
1497
|
-
_classPrivateFieldSet2(_main_effect, this, _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
|
|
1498
|
-
return branch(() => _classPrivateFieldGet2(_children, this).call(this, anchor));
|
|
1499
|
-
}));
|
|
1500
|
-
if (_classPrivateFieldGet2(_pending_count, this) === 0) {
|
|
1501
|
-
_classPrivateFieldGet2(_anchor, this).before(fragment);
|
|
1502
|
-
_classPrivateFieldSet2(_offscreen_fragment, this, null);
|
|
1503
|
-
pause_effect(_classPrivateFieldGet2(_pending_effect, this), () => {
|
|
1504
|
-
_classPrivateFieldSet2(_pending_effect, this, null);
|
|
1505
|
-
});
|
|
1506
|
-
_assertClassBrand(_Boundary_brand, this, _resolve).call(this, current_batch);
|
|
984
|
+
flush() {
|
|
985
|
+
try {
|
|
986
|
+
is_processing = true;
|
|
987
|
+
current_batch = this;
|
|
988
|
+
_assertClassBrand(_Batch_brand, this, _process).call(this);
|
|
989
|
+
} finally {
|
|
990
|
+
flush_count = 0;
|
|
991
|
+
last_scheduled_effect = null;
|
|
992
|
+
collected_effects = null;
|
|
993
|
+
legacy_updates = null;
|
|
994
|
+
is_processing = false;
|
|
995
|
+
current_batch = null;
|
|
996
|
+
batch_values = null;
|
|
997
|
+
old_values.clear();
|
|
1507
998
|
}
|
|
1508
|
-
});
|
|
1509
|
-
}
|
|
1510
|
-
function _render() {
|
|
1511
|
-
try {
|
|
1512
|
-
this.is_pending = this.has_pending_snippet();
|
|
1513
|
-
_classPrivateFieldSet2(_pending_count, this, 0);
|
|
1514
|
-
_classPrivateFieldSet2(_local_pending_count, this, 0);
|
|
1515
|
-
_classPrivateFieldSet2(_main_effect, this, branch(() => {
|
|
1516
|
-
_classPrivateFieldGet2(_children, this).call(this, _classPrivateFieldGet2(_anchor, this));
|
|
1517
|
-
}));
|
|
1518
|
-
if (_classPrivateFieldGet2(_pending_count, this) > 0) {
|
|
1519
|
-
var fragment = _classPrivateFieldSet2(_offscreen_fragment, this, document.createDocumentFragment());
|
|
1520
|
-
move_effect(_classPrivateFieldGet2(_main_effect, this), fragment);
|
|
1521
|
-
const pending = _classPrivateFieldGet2(_props, this).pending;
|
|
1522
|
-
_classPrivateFieldSet2(_pending_effect, this, branch(() => pending(_classPrivateFieldGet2(_anchor, this))));
|
|
1523
|
-
} else _assertClassBrand(_Boundary_brand, this, _resolve).call(this, current_batch);
|
|
1524
|
-
} catch (error) {
|
|
1525
|
-
this.error(error);
|
|
1526
999
|
}
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
batch.transfer_effects(_classPrivateFieldGet2(_dirty_effects, this), _classPrivateFieldGet2(_maybe_dirty_effects, this));
|
|
1534
|
-
}
|
|
1535
|
-
/**
|
|
1536
|
-
* @template T
|
|
1537
|
-
* @param {() => T} fn
|
|
1538
|
-
*/
|
|
1539
|
-
function _run(fn) {
|
|
1540
|
-
var previous_effect = active_effect;
|
|
1541
|
-
var previous_reaction = active_reaction;
|
|
1542
|
-
var previous_ctx = component_context;
|
|
1543
|
-
set_active_effect(_classPrivateFieldGet2(_effect, this));
|
|
1544
|
-
set_active_reaction(_classPrivateFieldGet2(_effect, this));
|
|
1545
|
-
set_component_context(_classPrivateFieldGet2(_effect, this).ctx);
|
|
1546
|
-
try {
|
|
1547
|
-
Batch.ensure();
|
|
1548
|
-
return fn();
|
|
1549
|
-
} catch (e) {
|
|
1550
|
-
handle_error(e);
|
|
1551
|
-
return null;
|
|
1552
|
-
} finally {
|
|
1553
|
-
set_active_effect(previous_effect);
|
|
1554
|
-
set_active_reaction(previous_reaction);
|
|
1555
|
-
set_component_context(previous_ctx);
|
|
1000
|
+
discard() {
|
|
1001
|
+
for (const fn of _classPrivateFieldGet2(_discard_callbacks, this)) fn(this);
|
|
1002
|
+
_classPrivateFieldGet2(_discard_callbacks, this).clear();
|
|
1003
|
+
for (const deferred of this.async_deriveds.values()) deferred.reject(OBSOLETE);
|
|
1004
|
+
_assertClassBrand(_Batch_brand, this, _unlink).call(this);
|
|
1005
|
+
_classPrivateFieldGet2(_deferred, this)?.resolve();
|
|
1556
1006
|
}
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1007
|
+
/**
|
|
1008
|
+
* @param {Effect} effect
|
|
1009
|
+
*/
|
|
1010
|
+
register_created_effect(effect) {
|
|
1011
|
+
_classPrivateFieldGet2(_new_effects, this).push(effect);
|
|
1012
|
+
}
|
|
1013
|
+
/**
|
|
1014
|
+
* @param {boolean} blocking
|
|
1015
|
+
* @param {Effect} effect
|
|
1016
|
+
*/
|
|
1017
|
+
increment(blocking, effect) {
|
|
1018
|
+
_classPrivateFieldSet2(_pending, this, _classPrivateFieldGet2(_pending, this) + 1);
|
|
1019
|
+
if (blocking) {
|
|
1020
|
+
let blocking_pending_count = _classPrivateFieldGet2(_blocking_pending, this).get(effect) ?? 0;
|
|
1021
|
+
_classPrivateFieldGet2(_blocking_pending, this).set(effect, blocking_pending_count + 1);
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
/**
|
|
1025
|
+
* @param {boolean} blocking
|
|
1026
|
+
* @param {Effect} effect
|
|
1027
|
+
*/
|
|
1028
|
+
decrement(blocking, effect) {
|
|
1029
|
+
_classPrivateFieldSet2(_pending, this, _classPrivateFieldGet2(_pending, this) - 1);
|
|
1030
|
+
if (blocking) {
|
|
1031
|
+
let blocking_pending_count = _classPrivateFieldGet2(_blocking_pending, this).get(effect) ?? 0;
|
|
1032
|
+
if (blocking_pending_count === 1) _classPrivateFieldGet2(_blocking_pending, this).delete(effect);
|
|
1033
|
+
else _classPrivateFieldGet2(_blocking_pending, this).set(effect, blocking_pending_count - 1);
|
|
1569
1034
|
}
|
|
1570
|
-
return;
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
if (_classPrivateFieldGet2(_pending_effect, this)) pause_effect(_classPrivateFieldGet2(_pending_effect, this), () => {
|
|
1576
|
-
_classPrivateFieldSet2(_pending_effect, this, null);
|
|
1035
|
+
if (_classPrivateFieldGet2(_decrement_queued, this)) return;
|
|
1036
|
+
_classPrivateFieldSet2(_decrement_queued, this, true);
|
|
1037
|
+
queue_micro_task(() => {
|
|
1038
|
+
_classPrivateFieldSet2(_decrement_queued, this, false);
|
|
1039
|
+
if (this.linked) this.flush();
|
|
1577
1040
|
});
|
|
1578
|
-
if (_classPrivateFieldGet2(_offscreen_fragment, this)) {
|
|
1579
|
-
_classPrivateFieldGet2(_anchor, this).before(_classPrivateFieldGet2(_offscreen_fragment, this));
|
|
1580
|
-
_classPrivateFieldSet2(_offscreen_fragment, this, null);
|
|
1581
|
-
}
|
|
1582
1041
|
}
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
* @param {
|
|
1586
|
-
*/
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1042
|
+
/**
|
|
1043
|
+
* @param {Set<Effect>} dirty_effects
|
|
1044
|
+
* @param {Set<Effect>} maybe_dirty_effects
|
|
1045
|
+
*/
|
|
1046
|
+
transfer_effects(dirty_effects, maybe_dirty_effects) {
|
|
1047
|
+
for (const e of dirty_effects) _classPrivateFieldGet2(_dirty_effects$1, this).add(e);
|
|
1048
|
+
for (const e of maybe_dirty_effects) _classPrivateFieldGet2(_maybe_dirty_effects$1, this).add(e);
|
|
1049
|
+
dirty_effects.clear();
|
|
1050
|
+
maybe_dirty_effects.clear();
|
|
1591
1051
|
}
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1052
|
+
/** @param {(batch: Batch) => void} fn */
|
|
1053
|
+
oncommit(fn) {
|
|
1054
|
+
_classPrivateFieldGet2(_commit_callbacks, this).add(fn);
|
|
1595
1055
|
}
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1056
|
+
/** @param {(batch: Batch) => void} fn */
|
|
1057
|
+
ondiscard(fn) {
|
|
1058
|
+
_classPrivateFieldGet2(_discard_callbacks, this).add(fn);
|
|
1599
1059
|
}
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
next();
|
|
1603
|
-
set_hydrate_node(skip_nodes());
|
|
1060
|
+
settled() {
|
|
1061
|
+
return (_classPrivateFieldGet2(_deferred, this) ?? _classPrivateFieldSet2(_deferred, this, deferred())).promise;
|
|
1604
1062
|
}
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
svelte_boundary_reset_noop();
|
|
1612
|
-
return;
|
|
1063
|
+
static ensure() {
|
|
1064
|
+
if (current_batch === null) {
|
|
1065
|
+
const batch = current_batch = new Batch();
|
|
1066
|
+
if (!is_processing && !is_flushing_sync) queue_micro_task(() => {
|
|
1067
|
+
if (!_classPrivateFieldGet2(_started, batch)) batch.flush();
|
|
1068
|
+
});
|
|
1613
1069
|
}
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
_assertClassBrand(_Boundary_brand, this, _render).call(this);
|
|
1621
|
-
});
|
|
1622
|
-
};
|
|
1623
|
-
/** @param {unknown} transformed_error */
|
|
1624
|
-
const handle_error_result = (transformed_error) => {
|
|
1625
|
-
try {
|
|
1626
|
-
calling_on_error = true;
|
|
1627
|
-
onerror?.(transformed_error, reset);
|
|
1628
|
-
calling_on_error = false;
|
|
1629
|
-
} catch (error) {
|
|
1630
|
-
invoke_error_boundary(error, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent);
|
|
1070
|
+
return current_batch;
|
|
1071
|
+
}
|
|
1072
|
+
apply() {
|
|
1073
|
+
if (!async_mode_flag || !this.is_fork && _classPrivateFieldGet2(_prev, this) === null && _classPrivateFieldGet2(_next, this) === null) {
|
|
1074
|
+
batch_values = null;
|
|
1075
|
+
return;
|
|
1631
1076
|
}
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1077
|
+
batch_values = /* @__PURE__ */ new Map();
|
|
1078
|
+
for (const [source, [value]] of this.current) batch_values.set(source, value);
|
|
1079
|
+
for (let batch = first_batch; batch !== null; batch = _classPrivateFieldGet2(_next, batch)) {
|
|
1080
|
+
if (batch === this || batch.is_fork) continue;
|
|
1081
|
+
var intersects = false;
|
|
1082
|
+
if (batch.id < this.id) for (const [source, [, is_derived]] of batch.current) {
|
|
1083
|
+
if (is_derived) continue;
|
|
1084
|
+
if (this.current.has(source)) {
|
|
1085
|
+
intersects = true;
|
|
1086
|
+
break;
|
|
1087
|
+
}
|
|
1643
1088
|
}
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1089
|
+
if (!intersects) {
|
|
1090
|
+
for (const [source, previous] of batch.previous) if (!batch_values.has(source)) batch_values.set(source, previous);
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
/**
|
|
1095
|
+
*
|
|
1096
|
+
* @param {Effect} effect
|
|
1097
|
+
*/
|
|
1098
|
+
schedule(effect) {
|
|
1099
|
+
last_scheduled_effect = effect;
|
|
1100
|
+
if (effect.b?.is_pending && (effect.f & 16777228) !== 0 && (effect.f & 32768) === 0) {
|
|
1101
|
+
effect.b.defer_effect(effect);
|
|
1653
1102
|
return;
|
|
1654
1103
|
}
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1104
|
+
var e = effect;
|
|
1105
|
+
while (e.parent !== null) {
|
|
1106
|
+
e = e.parent;
|
|
1107
|
+
var flags = e.f;
|
|
1108
|
+
if (collected_effects !== null && e === active_effect) {
|
|
1109
|
+
if (async_mode_flag) return;
|
|
1110
|
+
if ((active_reaction === null || (active_reaction.f & 2) === 0) && !legacy_is_updating_store) return;
|
|
1111
|
+
}
|
|
1112
|
+
if ((flags & 96) !== 0) {
|
|
1113
|
+
if ((flags & 1024) === 0) return;
|
|
1114
|
+
e.f ^= CLEAN;
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
_classPrivateFieldGet2(_roots, this).push(e);
|
|
1118
|
+
}
|
|
1119
|
+
};
|
|
1120
|
+
_Batch = Batch;
|
|
1121
|
+
function _is_deferred() {
|
|
1122
|
+
if (this.is_fork) return true;
|
|
1123
|
+
for (const effect of _classPrivateFieldGet2(_blocking_pending, this).keys()) {
|
|
1124
|
+
var e = effect;
|
|
1125
|
+
var skipped = false;
|
|
1126
|
+
while (e.parent !== null) {
|
|
1127
|
+
if (_classPrivateFieldGet2(_skipped_branches, this).has(e)) {
|
|
1128
|
+
skipped = true;
|
|
1129
|
+
break;
|
|
1130
|
+
}
|
|
1131
|
+
e = e.parent;
|
|
1132
|
+
}
|
|
1133
|
+
if (!skipped) return true;
|
|
1134
|
+
}
|
|
1135
|
+
return false;
|
|
1663
1136
|
}
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
* @param {Array<() => any>} sync
|
|
1670
|
-
* @param {Array<() => Promise<any>>} async
|
|
1671
|
-
* @param {(values: Value[]) => any} fn
|
|
1672
|
-
*/
|
|
1673
|
-
function flatten(blockers, sync, async, fn) {
|
|
1674
|
-
const d = is_runes() ? derived : derived_safe_equal;
|
|
1675
|
-
var pending = blockers.filter((b) => !b.settled);
|
|
1676
|
-
var deriveds = sync.map(d);
|
|
1677
|
-
if (async.length === 0 && pending.length === 0) {
|
|
1678
|
-
fn(deriveds);
|
|
1679
|
-
return;
|
|
1137
|
+
function _process() {
|
|
1138
|
+
_classPrivateFieldSet2(_started, this, true);
|
|
1139
|
+
if (flush_count++ > 1e3) {
|
|
1140
|
+
_assertClassBrand(_Batch_brand, this, _unlink).call(this);
|
|
1141
|
+
infinite_loop_guard();
|
|
1680
1142
|
}
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1143
|
+
for (const e of _classPrivateFieldGet2(_dirty_effects$1, this)) {
|
|
1144
|
+
_classPrivateFieldGet2(_maybe_dirty_effects$1, this).delete(e);
|
|
1145
|
+
set_signal_status(e, DIRTY);
|
|
1146
|
+
this.schedule(e);
|
|
1147
|
+
}
|
|
1148
|
+
for (const e of _classPrivateFieldGet2(_maybe_dirty_effects$1, this)) {
|
|
1149
|
+
set_signal_status(e, MAYBE_DIRTY);
|
|
1150
|
+
this.schedule(e);
|
|
1151
|
+
}
|
|
1152
|
+
const roots = _classPrivateFieldGet2(_roots, this);
|
|
1153
|
+
_classPrivateFieldSet2(_roots, this, []);
|
|
1154
|
+
this.apply();
|
|
1155
|
+
/** @type {Effect[]} */
|
|
1156
|
+
var effects = collected_effects = [];
|
|
1157
|
+
/** @type {Effect[]} */
|
|
1158
|
+
var render_effects = [];
|
|
1684
1159
|
/**
|
|
1685
|
-
* @
|
|
1160
|
+
* @type {Effect[]}
|
|
1161
|
+
* @deprecated when we get rid of legacy mode and stores, we can get rid of this
|
|
1686
1162
|
*/
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1163
|
+
var updates = legacy_updates = [];
|
|
1164
|
+
for (const root of roots) try {
|
|
1165
|
+
_assertClassBrand(_Batch_brand, this, _traverse).call(this, root, effects, render_effects);
|
|
1166
|
+
} catch (e) {
|
|
1167
|
+
reset_all(root);
|
|
1168
|
+
if (!_assertClassBrand(_Batch_brand, this, _is_deferred).call(this)) this.discard();
|
|
1169
|
+
throw e;
|
|
1170
|
+
}
|
|
1171
|
+
current_batch = null;
|
|
1172
|
+
if (updates.length > 0) {
|
|
1173
|
+
var batch = _Batch.ensure();
|
|
1174
|
+
for (const e of updates) batch.schedule(e);
|
|
1175
|
+
}
|
|
1176
|
+
collected_effects = null;
|
|
1177
|
+
legacy_updates = null;
|
|
1178
|
+
if (_assertClassBrand(_Batch_brand, this, _is_deferred).call(this)) {
|
|
1179
|
+
_assertClassBrand(_Batch_brand, this, _defer_effects).call(this, render_effects);
|
|
1180
|
+
_assertClassBrand(_Batch_brand, this, _defer_effects).call(this, effects);
|
|
1181
|
+
for (const [e, t] of _classPrivateFieldGet2(_skipped_branches, this)) reset_branch(e, t);
|
|
1182
|
+
if (updates.length > 0)
|
|
1183
|
+
/** @type {Batch} */ _assertClassBrand(_Batch_brand, current_batch, _process).call(current_batch);
|
|
1184
|
+
return;
|
|
1185
|
+
}
|
|
1186
|
+
const earlier_batch = _assertClassBrand(_Batch_brand, this, _find_earlier_batch).call(this);
|
|
1187
|
+
if (earlier_batch) {
|
|
1188
|
+
_assertClassBrand(_Batch_brand, this, _defer_effects).call(this, render_effects);
|
|
1189
|
+
_assertClassBrand(_Batch_brand, this, _defer_effects).call(this, effects);
|
|
1190
|
+
_assertClassBrand(_Batch_brand, earlier_batch, _merge).call(earlier_batch, this);
|
|
1191
|
+
return;
|
|
1192
|
+
}
|
|
1193
|
+
_classPrivateFieldGet2(_dirty_effects$1, this).clear();
|
|
1194
|
+
_classPrivateFieldGet2(_maybe_dirty_effects$1, this).clear();
|
|
1195
|
+
for (const fn of _classPrivateFieldGet2(_commit_callbacks, this)) fn(this);
|
|
1196
|
+
_classPrivateFieldGet2(_commit_callbacks, this).clear();
|
|
1197
|
+
previous_batch = this;
|
|
1198
|
+
flush_queued_effects(render_effects);
|
|
1199
|
+
flush_queued_effects(effects);
|
|
1200
|
+
previous_batch = null;
|
|
1201
|
+
_classPrivateFieldGet2(_deferred, this)?.resolve();
|
|
1202
|
+
var next_batch = current_batch;
|
|
1203
|
+
if (_classPrivateFieldGet2(_pending, this) === 0 && (_classPrivateFieldGet2(_roots, this).length === 0 || next_batch !== null)) {
|
|
1204
|
+
_assertClassBrand(_Batch_brand, this, _unlink).call(this);
|
|
1205
|
+
if (async_mode_flag) {
|
|
1206
|
+
_assertClassBrand(_Batch_brand, this, _commit$1).call(this);
|
|
1207
|
+
current_batch = next_batch;
|
|
1694
1208
|
}
|
|
1695
|
-
unset_context();
|
|
1696
|
-
}
|
|
1697
|
-
var decrement_pending = increment_pending();
|
|
1698
|
-
if (async.length === 0) {
|
|
1699
|
-
/** @type {Promise<any>} */ blocker_promise.then(() => finish([])).finally(decrement_pending);
|
|
1700
|
-
return;
|
|
1701
1209
|
}
|
|
1702
|
-
|
|
1703
|
-
|
|
1210
|
+
if (_classPrivateFieldGet2(_roots, this).length > 0) if (next_batch !== null) {
|
|
1211
|
+
const batch = next_batch;
|
|
1212
|
+
_classPrivateFieldGet2(_roots, batch).push(..._classPrivateFieldGet2(_roots, this).filter((r) => !_classPrivateFieldGet2(_roots, batch).includes(r)));
|
|
1213
|
+
} else next_batch = this;
|
|
1214
|
+
if (next_batch !== null) {
|
|
1215
|
+
old_values.clear();
|
|
1216
|
+
_assertClassBrand(_Batch_brand, next_batch, _process).call(next_batch);
|
|
1704
1217
|
}
|
|
1705
|
-
if (blocker_promise) blocker_promise.then(() => {
|
|
1706
|
-
restore();
|
|
1707
|
-
run();
|
|
1708
|
-
unset_context();
|
|
1709
|
-
});
|
|
1710
|
-
else run();
|
|
1711
1218
|
}
|
|
1712
1219
|
/**
|
|
1713
|
-
*
|
|
1714
|
-
*
|
|
1715
|
-
*
|
|
1220
|
+
* Traverse the effect tree, executing effects or stashing
|
|
1221
|
+
* them for later execution as appropriate
|
|
1222
|
+
* @param {Effect} root
|
|
1223
|
+
* @param {Effect[]} effects
|
|
1224
|
+
* @param {Effect[]} render_effects
|
|
1716
1225
|
*/
|
|
1717
|
-
function
|
|
1718
|
-
|
|
1719
|
-
var
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1226
|
+
function _traverse(root, effects, render_effects) {
|
|
1227
|
+
root.f ^= CLEAN;
|
|
1228
|
+
var effect = root.first;
|
|
1229
|
+
while (effect !== null) {
|
|
1230
|
+
var flags = effect.f;
|
|
1231
|
+
var is_branch = (flags & 96) !== 0;
|
|
1232
|
+
if (!(is_branch && (flags & 1024) !== 0 || (flags & 8192) !== 0 || _classPrivateFieldGet2(_skipped_branches, this).has(effect)) && effect.fn !== null) {
|
|
1233
|
+
if (is_branch) effect.f ^= CLEAN;
|
|
1234
|
+
else if ((flags & 4) !== 0) effects.push(effect);
|
|
1235
|
+
else if (async_mode_flag && (flags & 16777224) !== 0) render_effects.push(effect);
|
|
1236
|
+
else if (is_dirty(effect)) {
|
|
1237
|
+
if ((flags & 16) !== 0) _classPrivateFieldGet2(_maybe_dirty_effects$1, this).add(effect);
|
|
1238
|
+
update_effect(effect);
|
|
1239
|
+
}
|
|
1240
|
+
var child = effect.first;
|
|
1241
|
+
if (child !== null) {
|
|
1242
|
+
effect = child;
|
|
1243
|
+
continue;
|
|
1244
|
+
}
|
|
1729
1245
|
}
|
|
1730
|
-
|
|
1246
|
+
while (effect !== null) {
|
|
1247
|
+
var next = effect.next;
|
|
1248
|
+
if (next !== null) {
|
|
1249
|
+
effect = next;
|
|
1250
|
+
break;
|
|
1251
|
+
}
|
|
1252
|
+
effect = effect.parent;
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1731
1255
|
}
|
|
1732
|
-
function
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1256
|
+
function _find_earlier_batch() {
|
|
1257
|
+
var batch = _classPrivateFieldGet2(_prev, this);
|
|
1258
|
+
while (batch !== null) {
|
|
1259
|
+
if (!batch.is_fork) {
|
|
1260
|
+
for (const [value, [, is_derived]] of this.current) if (batch.current.has(value) && !is_derived) return batch;
|
|
1261
|
+
}
|
|
1262
|
+
batch = _classPrivateFieldGet2(_prev, batch);
|
|
1263
|
+
}
|
|
1264
|
+
return null;
|
|
1737
1265
|
}
|
|
1738
1266
|
/**
|
|
1739
|
-
* @
|
|
1267
|
+
* @param {Batch} batch
|
|
1740
1268
|
*/
|
|
1741
|
-
function
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1269
|
+
function _merge(batch) {
|
|
1270
|
+
for (const [source, value] of batch.current) {
|
|
1271
|
+
if (!this.previous.has(source) && batch.previous.has(source)) this.previous.set(source, batch.previous.get(source));
|
|
1272
|
+
this.current.set(source, value);
|
|
1273
|
+
}
|
|
1274
|
+
for (const [effect, deferred] of batch.async_deriveds) {
|
|
1275
|
+
const d = this.async_deriveds.get(effect);
|
|
1276
|
+
if (d) deferred.promise.then(d.resolve).catch(d.reject);
|
|
1277
|
+
}
|
|
1278
|
+
batch.async_deriveds.clear();
|
|
1279
|
+
this.transfer_effects(_classPrivateFieldGet2(_dirty_effects$1, batch), _classPrivateFieldGet2(_maybe_dirty_effects$1, batch));
|
|
1280
|
+
/**
|
|
1281
|
+
* mark all effects that depend on `batch.current`, except the
|
|
1282
|
+
* async effects that we just resolved (TODO unless they depend
|
|
1283
|
+
* on values in this batch that are NOT in the later batch?).
|
|
1284
|
+
* Through this we also will populate the correct #skipped_branches,
|
|
1285
|
+
* oncommit callbacks etc, so we don't need to merge them separately.
|
|
1286
|
+
* @param {Value} value
|
|
1287
|
+
*/
|
|
1288
|
+
const mark = (value) => {
|
|
1289
|
+
var reactions = value.reactions;
|
|
1290
|
+
if (reactions === null) return;
|
|
1291
|
+
if ((value.f & 2) !== 0 && (value.f & 6144) === 0) return;
|
|
1292
|
+
for (const reaction of reactions) {
|
|
1293
|
+
var flags = reaction.f;
|
|
1294
|
+
if ((flags & 2) !== 0) mark(reaction);
|
|
1295
|
+
else {
|
|
1296
|
+
var effect = reaction;
|
|
1297
|
+
if (flags & 4194320 && !this.async_deriveds.has(effect)) {
|
|
1298
|
+
_classPrivateFieldGet2(_maybe_dirty_effects$1, this).delete(effect);
|
|
1299
|
+
set_signal_status(effect, DIRTY);
|
|
1300
|
+
this.schedule(effect);
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1751
1304
|
};
|
|
1305
|
+
for (const source of this.current.keys()) mark(source);
|
|
1306
|
+
this.oncommit(() => batch.discard());
|
|
1307
|
+
_assertClassBrand(_Batch_brand, batch, _unlink).call(batch);
|
|
1308
|
+
current_batch = this;
|
|
1309
|
+
_assertClassBrand(_Batch_brand, this, _process).call(this);
|
|
1752
1310
|
}
|
|
1753
1311
|
/**
|
|
1754
|
-
* @
|
|
1755
|
-
* @param {() => V} fn
|
|
1756
|
-
* @returns {Derived<V>}
|
|
1312
|
+
* @param {Effect[]} effects
|
|
1757
1313
|
*/
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
var flags = 2 | DIRTY;
|
|
1761
|
-
if (active_effect !== null) active_effect.f |= EFFECT_PRESERVED;
|
|
1762
|
-
return {
|
|
1763
|
-
ctx: component_context,
|
|
1764
|
-
deps: null,
|
|
1765
|
-
effects: null,
|
|
1766
|
-
equals,
|
|
1767
|
-
f: flags,
|
|
1768
|
-
fn,
|
|
1769
|
-
reactions: null,
|
|
1770
|
-
rv: 0,
|
|
1771
|
-
v: UNINITIALIZED,
|
|
1772
|
-
wv: 0,
|
|
1773
|
-
parent: active_effect,
|
|
1774
|
-
ac: null
|
|
1775
|
-
};
|
|
1314
|
+
function _defer_effects(effects) {
|
|
1315
|
+
for (var i = 0; i < effects.length; i += 1) defer_effect(effects[i], _classPrivateFieldGet2(_dirty_effects$1, this), _classPrivateFieldGet2(_maybe_dirty_effects$1, this));
|
|
1776
1316
|
}
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
var promise = void 0;
|
|
1790
|
-
var signal = source(UNINITIALIZED);
|
|
1791
|
-
var should_suspend = !active_reaction;
|
|
1792
|
-
/** @type {Set<ReturnType<typeof deferred<V>>>} */
|
|
1793
|
-
var deferreds = /* @__PURE__ */ new Set();
|
|
1794
|
-
async_effect(() => {
|
|
1795
|
-
var effect = active_effect;
|
|
1796
|
-
/** @type {ReturnType<typeof deferred<V>>} */
|
|
1797
|
-
var d = deferred();
|
|
1798
|
-
promise = d.promise;
|
|
1799
|
-
try {
|
|
1800
|
-
Promise.resolve(fn()).then(d.resolve, (e) => {
|
|
1801
|
-
if (e !== STALE_REACTION) d.reject(e);
|
|
1802
|
-
}).finally(unset_context);
|
|
1803
|
-
} catch (error) {
|
|
1804
|
-
d.reject(error);
|
|
1805
|
-
unset_context();
|
|
1317
|
+
function _commit$1() {
|
|
1318
|
+
for (let batch = first_batch; batch !== null; batch = _classPrivateFieldGet2(_next, batch)) {
|
|
1319
|
+
var is_earlier = batch.id < this.id;
|
|
1320
|
+
/** @type {Source[]} */
|
|
1321
|
+
var sources = [];
|
|
1322
|
+
for (const [source, [value, is_derived]] of this.current) {
|
|
1323
|
+
if (batch.current.has(source)) {
|
|
1324
|
+
var batch_value = batch.current.get(source)[0];
|
|
1325
|
+
if (is_earlier && value !== batch_value) batch.current.set(source, [value, is_derived]);
|
|
1326
|
+
else continue;
|
|
1327
|
+
}
|
|
1328
|
+
sources.push(source);
|
|
1806
1329
|
}
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
if ((
|
|
1810
|
-
if (parent.b?.is_rendered()) batch.async_deriveds.get(effect)?.reject(OBSOLETE);
|
|
1811
|
-
else for (const d of deferreds.values()) d.reject(OBSOLETE);
|
|
1812
|
-
deferreds.add(d);
|
|
1813
|
-
batch.async_deriveds.set(effect, d);
|
|
1330
|
+
if (is_earlier) for (const [effect, deferred] of this.async_deriveds) {
|
|
1331
|
+
const d = batch.async_deriveds.get(effect);
|
|
1332
|
+
if (d) deferred.promise.then(d.resolve).catch(d.reject);
|
|
1814
1333
|
}
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1334
|
+
var current = [...batch.current.keys()].filter((source) => !batch.current.get(source)[1]);
|
|
1335
|
+
if (!_classPrivateFieldGet2(_started, batch) || current.length === 0) continue;
|
|
1336
|
+
var others = current.filter((source) => !this.current.has(source));
|
|
1337
|
+
if (others.length === 0) {
|
|
1338
|
+
if (is_earlier) batch.discard();
|
|
1339
|
+
} else if (sources.length > 0) {
|
|
1340
|
+
if (is_earlier) for (const unskipped of _classPrivateFieldGet2(_unskipped_branches, this)) batch.unskip_effect(unskipped, (e) => {
|
|
1341
|
+
if ((e.f & 4194320) !== 0) batch.schedule(e);
|
|
1342
|
+
else _assertClassBrand(_Batch_brand, batch, _defer_effects).call(batch, [e]);
|
|
1343
|
+
});
|
|
1823
1344
|
batch.activate();
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1345
|
+
/** @type {Set<Value>} */
|
|
1346
|
+
var marked = /* @__PURE__ */ new Set();
|
|
1347
|
+
/** @type {Map<Reaction, boolean>} */
|
|
1348
|
+
var checked = /* @__PURE__ */ new Map();
|
|
1349
|
+
for (var source of sources) mark_effects(source, others, marked, checked);
|
|
1350
|
+
checked = /* @__PURE__ */ new Map();
|
|
1351
|
+
var current_unequal = [...batch.current].filter(([c, v1]) => {
|
|
1352
|
+
const v2 = this.current.get(c);
|
|
1353
|
+
if (!v2) return true;
|
|
1354
|
+
return v2[0] !== v1[0] || v2[1] !== v1[1];
|
|
1355
|
+
}).map(([c]) => c);
|
|
1356
|
+
if (current_unequal.length > 0) {
|
|
1357
|
+
for (const effect of _classPrivateFieldGet2(_new_effects, this)) if ((effect.f & 155648) === 0 && depends_on(effect, current_unequal, checked)) if ((effect.f & 4194320) !== 0) {
|
|
1358
|
+
set_signal_status(effect, DIRTY);
|
|
1359
|
+
batch.schedule(effect);
|
|
1360
|
+
} else _classPrivateFieldGet2(_dirty_effects$1, batch).add(effect);
|
|
1361
|
+
}
|
|
1362
|
+
if (_classPrivateFieldGet2(_roots, batch).length > 0 && !_classPrivateFieldGet2(_decrement_queued, batch)) {
|
|
1363
|
+
batch.apply();
|
|
1364
|
+
for (var root of _classPrivateFieldGet2(_roots, batch)) _assertClassBrand(_Batch_brand, batch, _traverse).call(batch, root, [], []);
|
|
1365
|
+
_classPrivateFieldSet2(_roots, batch, []);
|
|
1830
1366
|
}
|
|
1831
1367
|
batch.deactivate();
|
|
1832
|
-
};
|
|
1833
|
-
d.promise.then(handler, (e) => handler(null, e || "unknown"));
|
|
1834
|
-
});
|
|
1835
|
-
teardown(() => {
|
|
1836
|
-
for (const d of deferreds) d.reject(OBSOLETE);
|
|
1837
|
-
});
|
|
1838
|
-
return new Promise((fulfil) => {
|
|
1839
|
-
/** @param {Promise<V>} p */
|
|
1840
|
-
function next(p) {
|
|
1841
|
-
function go() {
|
|
1842
|
-
if (p === promise) fulfil(signal);
|
|
1843
|
-
else next(promise);
|
|
1844
|
-
}
|
|
1845
|
-
p.then(go, go);
|
|
1846
1368
|
}
|
|
1847
|
-
|
|
1848
|
-
});
|
|
1369
|
+
}
|
|
1849
1370
|
}
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
return d;
|
|
1371
|
+
function _unlink() {
|
|
1372
|
+
if (!this.linked) return;
|
|
1373
|
+
var prev = _classPrivateFieldGet2(_prev, this);
|
|
1374
|
+
var next = _classPrivateFieldGet2(_next, this);
|
|
1375
|
+
if (prev === null) first_batch = next;
|
|
1376
|
+
else _classPrivateFieldSet2(_next, prev, next);
|
|
1377
|
+
if (next === null) last_batch = prev;
|
|
1378
|
+
else _classPrivateFieldSet2(_prev, next, prev);
|
|
1379
|
+
this.linked = false;
|
|
1860
1380
|
}
|
|
1861
1381
|
/**
|
|
1862
|
-
*
|
|
1863
|
-
*
|
|
1864
|
-
* @
|
|
1382
|
+
* Synchronously flush any pending updates.
|
|
1383
|
+
* Returns void if no callback is provided, otherwise returns the result of calling the callback.
|
|
1384
|
+
* @template [T=void]
|
|
1385
|
+
* @param {(() => T) | undefined} [fn]
|
|
1386
|
+
* @returns {T}
|
|
1865
1387
|
*/
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1388
|
+
function flushSync(fn) {
|
|
1389
|
+
var was_flushing_sync = is_flushing_sync;
|
|
1390
|
+
is_flushing_sync = true;
|
|
1391
|
+
try {
|
|
1392
|
+
var result;
|
|
1393
|
+
if (fn) {
|
|
1394
|
+
if (current_batch !== null && !current_batch.is_fork) current_batch.flush();
|
|
1395
|
+
result = fn();
|
|
1396
|
+
}
|
|
1397
|
+
while (true) {
|
|
1398
|
+
flush_tasks();
|
|
1399
|
+
if (current_batch === null) return result;
|
|
1400
|
+
current_batch.flush();
|
|
1401
|
+
}
|
|
1402
|
+
} finally {
|
|
1403
|
+
is_flushing_sync = was_flushing_sync;
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
function infinite_loop_guard() {
|
|
1407
|
+
try {
|
|
1408
|
+
effect_update_depth_exceeded();
|
|
1409
|
+
} catch (error) {
|
|
1410
|
+
invoke_error_boundary(error, last_scheduled_effect);
|
|
1411
|
+
}
|
|
1871
1412
|
}
|
|
1413
|
+
/** @type {Set<Effect> | null} */
|
|
1414
|
+
var eager_block_effects = null;
|
|
1872
1415
|
/**
|
|
1873
|
-
* @param {
|
|
1416
|
+
* @param {Array<Effect>} effects
|
|
1874
1417
|
* @returns {void}
|
|
1875
1418
|
*/
|
|
1876
|
-
function
|
|
1877
|
-
var
|
|
1878
|
-
if (
|
|
1879
|
-
|
|
1880
|
-
|
|
1419
|
+
function flush_queued_effects(effects) {
|
|
1420
|
+
var length = effects.length;
|
|
1421
|
+
if (length === 0) return;
|
|
1422
|
+
var i = 0;
|
|
1423
|
+
while (i < length) {
|
|
1424
|
+
var effect = effects[i++];
|
|
1425
|
+
if ((effect.f & 24576) === 0 && is_dirty(effect)) {
|
|
1426
|
+
eager_block_effects = /* @__PURE__ */ new Set();
|
|
1427
|
+
update_effect(effect);
|
|
1428
|
+
if (effect.deps === null && effect.first === null && effect.nodes === null && effect.teardown === null && effect.ac === null) unlink_effect(effect);
|
|
1429
|
+
if (eager_block_effects?.size > 0) {
|
|
1430
|
+
old_values.clear();
|
|
1431
|
+
for (const e of eager_block_effects) {
|
|
1432
|
+
if ((e.f & 24576) !== 0) continue;
|
|
1433
|
+
/** @type {Effect[]} */
|
|
1434
|
+
const ordered_effects = [e];
|
|
1435
|
+
let ancestor = e.parent;
|
|
1436
|
+
while (ancestor !== null) {
|
|
1437
|
+
if (eager_block_effects.has(ancestor)) {
|
|
1438
|
+
eager_block_effects.delete(ancestor);
|
|
1439
|
+
ordered_effects.push(ancestor);
|
|
1440
|
+
}
|
|
1441
|
+
ancestor = ancestor.parent;
|
|
1442
|
+
}
|
|
1443
|
+
for (let j = ordered_effects.length - 1; j >= 0; j--) {
|
|
1444
|
+
const e = ordered_effects[j];
|
|
1445
|
+
if ((e.f & 24576) !== 0) continue;
|
|
1446
|
+
update_effect(e);
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
eager_block_effects.clear();
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1881
1452
|
}
|
|
1453
|
+
eager_block_effects = null;
|
|
1882
1454
|
}
|
|
1883
1455
|
/**
|
|
1884
|
-
*
|
|
1885
|
-
*
|
|
1886
|
-
*
|
|
1456
|
+
* This is similar to `mark_reactions`, but it only marks async/block effects
|
|
1457
|
+
* depending on `value` and at least one of the other `sources`, so that
|
|
1458
|
+
* these effects can re-run after another batch has been committed
|
|
1459
|
+
* @param {Value} value
|
|
1460
|
+
* @param {Source[]} sources
|
|
1461
|
+
* @param {Set<Value>} marked
|
|
1462
|
+
* @param {Map<Reaction, boolean>} checked
|
|
1887
1463
|
*/
|
|
1888
|
-
function
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
derived.f &= ~WAS_MARKED;
|
|
1899
|
-
destroy_derived_effects(derived);
|
|
1900
|
-
value = update_reaction(derived);
|
|
1901
|
-
} finally {
|
|
1902
|
-
set_active_effect(prev_active_effect);
|
|
1464
|
+
function mark_effects(value, sources, marked, checked) {
|
|
1465
|
+
if (marked.has(value)) return;
|
|
1466
|
+
marked.add(value);
|
|
1467
|
+
if (value.reactions !== null) for (const reaction of value.reactions) {
|
|
1468
|
+
const flags = reaction.f;
|
|
1469
|
+
if ((flags & 2) !== 0) mark_effects(reaction, sources, marked, checked);
|
|
1470
|
+
else if ((flags & 4194320) !== 0 && (flags & 2048) === 0 && depends_on(reaction, sources, checked)) {
|
|
1471
|
+
set_signal_status(reaction, DIRTY);
|
|
1472
|
+
schedule_effect(reaction);
|
|
1473
|
+
}
|
|
1903
1474
|
}
|
|
1904
|
-
return value;
|
|
1905
1475
|
}
|
|
1906
1476
|
/**
|
|
1907
|
-
* @param {
|
|
1908
|
-
* @
|
|
1477
|
+
* @param {Reaction} reaction
|
|
1478
|
+
* @param {Source[]} sources
|
|
1479
|
+
* @param {Map<Reaction, boolean>} checked
|
|
1909
1480
|
*/
|
|
1910
|
-
function
|
|
1911
|
-
|
|
1912
|
-
if (
|
|
1913
|
-
|
|
1914
|
-
if (
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
} else derived.v = value;
|
|
1919
|
-
if (derived.deps === null) {
|
|
1920
|
-
set_signal_status(derived, CLEAN);
|
|
1921
|
-
return;
|
|
1922
|
-
}
|
|
1481
|
+
function depends_on(reaction, sources, checked) {
|
|
1482
|
+
const depends = checked.get(reaction);
|
|
1483
|
+
if (depends !== void 0) return depends;
|
|
1484
|
+
if (reaction.deps !== null) for (const dep of reaction.deps) {
|
|
1485
|
+
if (includes.call(sources, dep)) return true;
|
|
1486
|
+
if ((dep.f & 2) !== 0 && depends_on(dep, sources, checked)) {
|
|
1487
|
+
checked.set(dep, true);
|
|
1488
|
+
return true;
|
|
1923
1489
|
}
|
|
1924
1490
|
}
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
if (effect_tracking() || current_batch?.is_fork) batch_values.set(derived, value);
|
|
1928
|
-
} else update_derived_status(derived);
|
|
1491
|
+
checked.set(reaction, false);
|
|
1492
|
+
return false;
|
|
1929
1493
|
}
|
|
1930
1494
|
/**
|
|
1931
|
-
* @param {
|
|
1495
|
+
* @param {Effect} effect
|
|
1496
|
+
* @returns {void}
|
|
1932
1497
|
*/
|
|
1933
|
-
function
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1498
|
+
function schedule_effect(effect) {
|
|
1499
|
+
/** @type {Batch} */ current_batch.schedule(effect);
|
|
1500
|
+
}
|
|
1501
|
+
/**
|
|
1502
|
+
* Mark all the effects inside a skipped branch CLEAN, so that
|
|
1503
|
+
* they can be correctly rescheduled later. Tracks dirty and maybe_dirty
|
|
1504
|
+
* effects so they can be rescheduled if the branch survives.
|
|
1505
|
+
* @param {Effect} effect
|
|
1506
|
+
* @param {{ d: Effect[], m: Effect[] }} tracked
|
|
1507
|
+
*/
|
|
1508
|
+
function reset_branch(effect, tracked) {
|
|
1509
|
+
if ((effect.f & 32) !== 0 && (effect.f & 1024) !== 0) return;
|
|
1510
|
+
if ((effect.f & 2048) !== 0) tracked.d.push(effect);
|
|
1511
|
+
else if ((effect.f & 4096) !== 0) tracked.m.push(effect);
|
|
1512
|
+
set_signal_status(effect, CLEAN);
|
|
1513
|
+
var e = effect.first;
|
|
1514
|
+
while (e !== null) {
|
|
1515
|
+
reset_branch(e, tracked);
|
|
1516
|
+
e = e.next;
|
|
1942
1517
|
}
|
|
1943
1518
|
}
|
|
1944
1519
|
/**
|
|
1945
|
-
*
|
|
1520
|
+
* Mark an entire effect tree clean following an error
|
|
1521
|
+
* @param {Effect} effect
|
|
1946
1522
|
*/
|
|
1947
|
-
function
|
|
1948
|
-
|
|
1949
|
-
|
|
1523
|
+
function reset_all(effect) {
|
|
1524
|
+
set_signal_status(effect, CLEAN);
|
|
1525
|
+
var e = effect.first;
|
|
1526
|
+
while (e !== null) {
|
|
1527
|
+
reset_all(e);
|
|
1528
|
+
e = e.next;
|
|
1529
|
+
}
|
|
1950
1530
|
}
|
|
1951
1531
|
//#endregion
|
|
1952
|
-
//#region ../../../node_modules/.bun/svelte@5.
|
|
1532
|
+
//#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/sources.js
|
|
1953
1533
|
/** @import { Derived, Effect, Source, Value } from '#client' */
|
|
1954
1534
|
/** @type {Set<Effect>} */
|
|
1955
1535
|
var eager_effects = /* @__PURE__ */ new Set();
|
|
@@ -2019,7 +1599,8 @@ function set(source, value, should_proxy = false) {
|
|
|
2019
1599
|
*/
|
|
2020
1600
|
function internal_set(source, value, updated_during_traversal = null) {
|
|
2021
1601
|
if (!source.equals(value)) {
|
|
2022
|
-
old_values.set(source,
|
|
1602
|
+
if (is_destroying_effect) old_values.set(source, value);
|
|
1603
|
+
else if (!old_values.has(source)) old_values.set(source, source.v);
|
|
2023
1604
|
var batch = Batch.ensure();
|
|
2024
1605
|
batch.capture(source, value);
|
|
2025
1606
|
if ((source.f & 2) !== 0) {
|
|
@@ -2095,7 +1676,7 @@ function mark_reactions(signal, status, updated_during_traversal) {
|
|
|
2095
1676
|
* @returns {T}
|
|
2096
1677
|
*/
|
|
2097
1678
|
function proxy(value) {
|
|
2098
|
-
if (typeof value !== "object" || value === null || STATE_SYMBOL in value) return value;
|
|
1679
|
+
if (typeof value !== "object" || value === null || STATE_SYMBOL in value || COMPONENT_SYMBOL in value) return value;
|
|
2099
1680
|
const prototype = get_prototype_of(value);
|
|
2100
1681
|
if (prototype !== object_prototype && prototype !== array_prototype) return value;
|
|
2101
1682
|
/** @type {Map<any, Source<any>>} */
|
|
@@ -2247,19 +1828,8 @@ function proxy(value) {
|
|
|
2247
1828
|
}
|
|
2248
1829
|
});
|
|
2249
1830
|
}
|
|
2250
|
-
new Set([
|
|
2251
|
-
"copyWithin",
|
|
2252
|
-
"fill",
|
|
2253
|
-
"pop",
|
|
2254
|
-
"push",
|
|
2255
|
-
"reverse",
|
|
2256
|
-
"shift",
|
|
2257
|
-
"sort",
|
|
2258
|
-
"splice",
|
|
2259
|
-
"unshift"
|
|
2260
|
-
]);
|
|
2261
1831
|
//#endregion
|
|
2262
|
-
//#region ../../../node_modules/.bun/svelte@5.
|
|
1832
|
+
//#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/operations.js
|
|
2263
1833
|
/** @import { Effect, TemplateNode } from '#client' */
|
|
2264
1834
|
/** @type {Window} */
|
|
2265
1835
|
var $window;
|
|
@@ -2336,6 +1906,21 @@ function child(node, is_text) {
|
|
|
2336
1906
|
return child;
|
|
2337
1907
|
}
|
|
2338
1908
|
/**
|
|
1909
|
+
* `child`, for the very common case of an element with exactly one child. Resetting the
|
|
1910
|
+
* hydration cursor is part of the same step, so the compiler doesn't have to emit a
|
|
1911
|
+
* separate `reset` call for every `<p>{text}</p>` in an app.
|
|
1912
|
+
* Don't mark this as side-effect-free, hydration needs to walk all nodes
|
|
1913
|
+
* @param {TemplateNode} node
|
|
1914
|
+
* @param {boolean} [is_text]
|
|
1915
|
+
* @returns {TemplateNode | null}
|
|
1916
|
+
*/
|
|
1917
|
+
function only_child(node, is_text = false) {
|
|
1918
|
+
if (!hydrating) return /* @__PURE__ */ get_first_child(node);
|
|
1919
|
+
var first = child(node, is_text);
|
|
1920
|
+
reset(node);
|
|
1921
|
+
return first;
|
|
1922
|
+
}
|
|
1923
|
+
/**
|
|
2339
1924
|
* Don't mark this as side-effect-free, hydration needs to walk all nodes
|
|
2340
1925
|
* @param {TemplateNode} node
|
|
2341
1926
|
* @param {number} count
|
|
@@ -2413,26 +1998,40 @@ function merge_text_nodes(text) {
|
|
|
2413
1998
|
next = text.nextSibling;
|
|
2414
1999
|
}
|
|
2415
2000
|
}
|
|
2416
|
-
//#endregion
|
|
2417
|
-
//#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js
|
|
2418
2001
|
/**
|
|
2419
|
-
* @
|
|
2420
|
-
* @param {() => T} fn
|
|
2002
|
+
* @param {unknown} error
|
|
2421
2003
|
*/
|
|
2422
|
-
function
|
|
2423
|
-
var
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2004
|
+
function handle_error(error) {
|
|
2005
|
+
var effect = active_effect;
|
|
2006
|
+
if (effect === null) {
|
|
2007
|
+
/** @type {Derived} */ active_reaction.f |= ERROR_VALUE;
|
|
2008
|
+
return error;
|
|
2009
|
+
}
|
|
2010
|
+
if ((effect.f & 32768) === 0 && (effect.f & 4) === 0) throw error;
|
|
2011
|
+
invoke_error_boundary(error, effect);
|
|
2012
|
+
}
|
|
2013
|
+
/**
|
|
2014
|
+
* @param {unknown} error
|
|
2015
|
+
* @param {Effect | null} effect
|
|
2016
|
+
*/
|
|
2017
|
+
function invoke_error_boundary(error, effect) {
|
|
2018
|
+
if (effect !== null && (effect.f & 16384) !== 0) return;
|
|
2019
|
+
while (effect !== null) {
|
|
2020
|
+
if ((effect.f & 128) !== 0 && (effect.f & 33570816) === 0) {
|
|
2021
|
+
if ((effect.f & 32768) === 0) throw error;
|
|
2022
|
+
try {
|
|
2023
|
+
/** @type {Boundary} */ effect.b.error(error);
|
|
2024
|
+
return;
|
|
2025
|
+
} catch (e) {
|
|
2026
|
+
error = e;
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
effect = effect.parent;
|
|
2432
2030
|
}
|
|
2031
|
+
throw error;
|
|
2433
2032
|
}
|
|
2434
2033
|
//#endregion
|
|
2435
|
-
//#region ../../../node_modules/.bun/svelte@5.
|
|
2034
|
+
//#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/reactivity/effects.js
|
|
2436
2035
|
/** @import { Blocker, ComponentContext, ComponentContextLegacy, Derived, Effect, TemplateNode, TransitionManager } from '#client' */
|
|
2437
2036
|
/**
|
|
2438
2037
|
* @param {'$effect' | '$effect.pre' | '$inspect'} rune
|
|
@@ -2635,6 +2234,8 @@ function execute_effect_teardown(effect) {
|
|
|
2635
2234
|
set_active_reaction(null);
|
|
2636
2235
|
try {
|
|
2637
2236
|
teardown.call(null);
|
|
2237
|
+
} catch (error) {
|
|
2238
|
+
invoke_error_boundary(error, effect.parent);
|
|
2638
2239
|
} finally {
|
|
2639
2240
|
set_is_destroying_effect(previously_destroying_effect);
|
|
2640
2241
|
set_active_reaction(previous_reaction);
|
|
@@ -2737,6 +2338,7 @@ function unlink_effect(effect) {
|
|
|
2737
2338
|
function pause_effect(effect, callback, destroy = true) {
|
|
2738
2339
|
/** @type {TransitionManager[]} */
|
|
2739
2340
|
var transitions = [];
|
|
2341
|
+
effect.f |= 256;
|
|
2740
2342
|
pause_children(effect, transitions, true);
|
|
2741
2343
|
var fn = () => {
|
|
2742
2344
|
if (destroy) destroy_effect(effect);
|
|
@@ -2767,655 +2369,1137 @@ function pause_children(effect, transitions, local) {
|
|
|
2767
2369
|
var transparent = (child.f & 65536) !== 0 || (child.f & 32) !== 0 && (effect.f & 16) !== 0;
|
|
2768
2370
|
pause_children(child, transitions, transparent ? local : false);
|
|
2769
2371
|
}
|
|
2770
|
-
child = sibling;
|
|
2372
|
+
child = sibling;
|
|
2373
|
+
}
|
|
2374
|
+
}
|
|
2375
|
+
/**
|
|
2376
|
+
* The opposite of `pause_effect`. We call this if (for example)
|
|
2377
|
+
* `x` becomes falsy then truthy: `{#if x}...{/if}`
|
|
2378
|
+
* @param {Effect} effect
|
|
2379
|
+
*/
|
|
2380
|
+
function resume_effect(effect) {
|
|
2381
|
+
effect.f &= -257;
|
|
2382
|
+
resume_children(effect, true);
|
|
2383
|
+
}
|
|
2384
|
+
/**
|
|
2385
|
+
* @param {Effect} effect
|
|
2386
|
+
* @param {boolean} local
|
|
2387
|
+
*/
|
|
2388
|
+
function resume_children(effect, local) {
|
|
2389
|
+
if ((effect.f & 256) !== 0) return;
|
|
2390
|
+
if ((effect.f & 8192) === 0) return;
|
|
2391
|
+
effect.f ^= INERT;
|
|
2392
|
+
if ((effect.f & 1024) === 0) {
|
|
2393
|
+
set_signal_status(effect, DIRTY);
|
|
2394
|
+
Batch.ensure().schedule(effect);
|
|
2395
|
+
}
|
|
2396
|
+
var child = effect.first;
|
|
2397
|
+
while (child !== null) {
|
|
2398
|
+
var sibling = child.next;
|
|
2399
|
+
var transparent = (child.f & 65536) !== 0 || (child.f & 32) !== 0;
|
|
2400
|
+
resume_children(child, transparent ? local : false);
|
|
2401
|
+
child = sibling;
|
|
2402
|
+
}
|
|
2403
|
+
var t = effect.nodes && effect.nodes.t;
|
|
2404
|
+
if (t !== null) {
|
|
2405
|
+
for (const transition of t) if (transition.is_global || local) transition.in();
|
|
2406
|
+
}
|
|
2407
|
+
}
|
|
2408
|
+
/**
|
|
2409
|
+
* @param {Effect} effect
|
|
2410
|
+
* @param {DocumentFragment} fragment
|
|
2411
|
+
*/
|
|
2412
|
+
function move_effect(effect, fragment) {
|
|
2413
|
+
if (!effect.nodes) return;
|
|
2414
|
+
/** @type {TemplateNode | null} */
|
|
2415
|
+
var node = effect.nodes.start;
|
|
2416
|
+
var end = effect.nodes.end;
|
|
2417
|
+
while (node !== null) {
|
|
2418
|
+
/** @type {TemplateNode | null} */
|
|
2419
|
+
var next = node === end ? null : /* @__PURE__ */ get_next_sibling(node);
|
|
2420
|
+
fragment.append(node);
|
|
2421
|
+
node = next;
|
|
2422
|
+
}
|
|
2423
|
+
}
|
|
2424
|
+
//#endregion
|
|
2425
|
+
//#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/legacy.js
|
|
2426
|
+
/**
|
|
2427
|
+
* @type {Set<Value> | null}
|
|
2428
|
+
* @deprecated
|
|
2429
|
+
*/
|
|
2430
|
+
var captured_signals = null;
|
|
2431
|
+
//#endregion
|
|
2432
|
+
//#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/runtime.js
|
|
2433
|
+
/** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
|
|
2434
|
+
/**
|
|
2435
|
+
* True if updating in an effect context that is reactive (i.e. not branch/root effects)
|
|
2436
|
+
*/
|
|
2437
|
+
var is_updating_effect = false;
|
|
2438
|
+
var is_destroying_effect = false;
|
|
2439
|
+
/** @param {boolean} value */
|
|
2440
|
+
function set_is_destroying_effect(value) {
|
|
2441
|
+
is_destroying_effect = value;
|
|
2442
|
+
}
|
|
2443
|
+
/** @type {null | Reaction} */
|
|
2444
|
+
var active_reaction = null;
|
|
2445
|
+
var untracking = false;
|
|
2446
|
+
/** @param {null | Reaction} reaction */
|
|
2447
|
+
function set_active_reaction(reaction) {
|
|
2448
|
+
active_reaction = reaction;
|
|
2449
|
+
}
|
|
2450
|
+
/** @type {null | Effect} */
|
|
2451
|
+
var active_effect = null;
|
|
2452
|
+
/** @param {null | Effect} effect */
|
|
2453
|
+
function set_active_effect(effect) {
|
|
2454
|
+
active_effect = effect;
|
|
2455
|
+
}
|
|
2456
|
+
/**
|
|
2457
|
+
* When sources are created within a reaction, reading and writing
|
|
2458
|
+
* them within that reaction should not cause a re-run
|
|
2459
|
+
* @type {null | Set<Source>}
|
|
2460
|
+
*/
|
|
2461
|
+
var current_sources = null;
|
|
2462
|
+
/** @param {Value} value */
|
|
2463
|
+
function push_reaction_value(value) {
|
|
2464
|
+
if (active_reaction !== null && (!async_mode_flag || (active_reaction.f & 2) !== 0)) (current_sources ?? (current_sources = /* @__PURE__ */ new Set())).add(value);
|
|
2465
|
+
}
|
|
2466
|
+
/**
|
|
2467
|
+
* The dependencies of the reaction that is currently being executed. In many cases,
|
|
2468
|
+
* the dependencies are unchanged between runs, and so this will be `null` unless
|
|
2469
|
+
* and until a new dependency is accessed — we track this via `skipped_deps`
|
|
2470
|
+
* @type {null | Value[]}
|
|
2471
|
+
*/
|
|
2472
|
+
var new_deps = null;
|
|
2473
|
+
var skipped_deps = 0;
|
|
2474
|
+
/**
|
|
2475
|
+
* Tracks writes that the effect it's executed in doesn't listen to yet,
|
|
2476
|
+
* so that the dependency can be added to the effect later on if it then reads it
|
|
2477
|
+
* @type {null | Source[]}
|
|
2478
|
+
*/
|
|
2479
|
+
var untracked_writes = null;
|
|
2480
|
+
/** @param {null | Source[]} value */
|
|
2481
|
+
function set_untracked_writes(value) {
|
|
2482
|
+
untracked_writes = value;
|
|
2483
|
+
}
|
|
2484
|
+
/**
|
|
2485
|
+
* @type {number} Used by sources and deriveds for handling updates.
|
|
2486
|
+
* Version starts from 1 so that unowned deriveds differentiate between a created effect and a run one for tracing
|
|
2487
|
+
**/
|
|
2488
|
+
var write_version = 1;
|
|
2489
|
+
/** @type {number} Used to version each read of a source of derived to avoid duplicating dependencies inside a reaction */
|
|
2490
|
+
var read_version = 0;
|
|
2491
|
+
var update_version = read_version;
|
|
2492
|
+
/** @param {number} value */
|
|
2493
|
+
function set_update_version(value) {
|
|
2494
|
+
update_version = value;
|
|
2495
|
+
}
|
|
2496
|
+
function increment_write_version() {
|
|
2497
|
+
return ++write_version;
|
|
2498
|
+
}
|
|
2499
|
+
/**
|
|
2500
|
+
* Determines whether a derived or effect is dirty.
|
|
2501
|
+
* If it is MAYBE_DIRTY, will set the status to CLEAN
|
|
2502
|
+
* @param {Reaction} reaction
|
|
2503
|
+
* @returns {boolean}
|
|
2504
|
+
*/
|
|
2505
|
+
function is_dirty(reaction) {
|
|
2506
|
+
var flags = reaction.f;
|
|
2507
|
+
if ((flags & 2048) !== 0) return true;
|
|
2508
|
+
if (flags & 2) reaction.f &= ~WAS_MARKED;
|
|
2509
|
+
if ((flags & 4096) !== 0) {
|
|
2510
|
+
var dependencies = reaction.deps;
|
|
2511
|
+
var length = dependencies.length;
|
|
2512
|
+
for (var i = 0; i < length; i++) {
|
|
2513
|
+
var dependency = dependencies[i];
|
|
2514
|
+
if (is_dirty(dependency)) update_derived(dependency);
|
|
2515
|
+
if (dependency.wv > reaction.wv) return true;
|
|
2516
|
+
}
|
|
2517
|
+
if ((flags & 512) !== 0 && batch_values === null) set_signal_status(reaction, CLEAN);
|
|
2518
|
+
}
|
|
2519
|
+
return false;
|
|
2520
|
+
}
|
|
2521
|
+
/**
|
|
2522
|
+
* @param {Value} signal
|
|
2523
|
+
* @param {Effect} effect
|
|
2524
|
+
* @param {boolean} [root]
|
|
2525
|
+
*/
|
|
2526
|
+
function schedule_possible_effect_self_invalidation(signal, effect, root = true) {
|
|
2527
|
+
var reactions = signal.reactions;
|
|
2528
|
+
if (reactions === null) return;
|
|
2529
|
+
if (!async_mode_flag && current_sources !== null && current_sources.has(signal)) return;
|
|
2530
|
+
for (var i = 0; i < reactions.length; i++) {
|
|
2531
|
+
var reaction = reactions[i];
|
|
2532
|
+
if ((reaction.f & 2) !== 0) schedule_possible_effect_self_invalidation(reaction, effect, false);
|
|
2533
|
+
else if (effect === reaction) {
|
|
2534
|
+
if (root) set_signal_status(reaction, DIRTY);
|
|
2535
|
+
else if ((reaction.f & 1024) !== 0) set_signal_status(reaction, MAYBE_DIRTY);
|
|
2536
|
+
schedule_effect(reaction);
|
|
2537
|
+
}
|
|
2538
|
+
}
|
|
2539
|
+
}
|
|
2540
|
+
/** @param {Reaction} reaction */
|
|
2541
|
+
function update_reaction(reaction) {
|
|
2542
|
+
var previous_deps = new_deps;
|
|
2543
|
+
var previous_skipped_deps = skipped_deps;
|
|
2544
|
+
var previous_untracked_writes = untracked_writes;
|
|
2545
|
+
var previous_reaction = active_reaction;
|
|
2546
|
+
var previous_sources = current_sources;
|
|
2547
|
+
var previous_component_context = component_context;
|
|
2548
|
+
var previous_untracking = untracking;
|
|
2549
|
+
var previous_update_version = update_version;
|
|
2550
|
+
var flags = reaction.f;
|
|
2551
|
+
new_deps = null;
|
|
2552
|
+
skipped_deps = 0;
|
|
2553
|
+
untracked_writes = null;
|
|
2554
|
+
active_reaction = (flags & 96) === 0 ? reaction : null;
|
|
2555
|
+
current_sources = null;
|
|
2556
|
+
set_component_context(reaction.ctx);
|
|
2557
|
+
untracking = false;
|
|
2558
|
+
update_version = ++read_version;
|
|
2559
|
+
if (reaction.ac !== null) {
|
|
2560
|
+
without_reactive_context(() => {
|
|
2561
|
+
/** @type {AbortController} */ reaction.ac.abort(STALE_REACTION);
|
|
2562
|
+
});
|
|
2563
|
+
reaction.ac = null;
|
|
2564
|
+
}
|
|
2565
|
+
try {
|
|
2566
|
+
reaction.f |= REACTION_IS_UPDATING;
|
|
2567
|
+
var fn = reaction.fn;
|
|
2568
|
+
var result = fn();
|
|
2569
|
+
reaction.f |= REACTION_RAN;
|
|
2570
|
+
var deps = update_dependencies(reaction);
|
|
2571
|
+
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);
|
|
2572
|
+
if (previous_reaction !== null && previous_reaction !== reaction) {
|
|
2573
|
+
read_version++;
|
|
2574
|
+
if (previous_reaction.deps !== null) for (let i = 0; i < previous_skipped_deps; i += 1) previous_reaction.deps[i].rv = read_version;
|
|
2575
|
+
if (previous_deps !== null) for (const dep of previous_deps) dep.rv = read_version;
|
|
2576
|
+
if (untracked_writes !== null) if (previous_untracked_writes === null) previous_untracked_writes = untracked_writes;
|
|
2577
|
+
else previous_untracked_writes.push(...untracked_writes);
|
|
2578
|
+
}
|
|
2579
|
+
if ((reaction.f & 8388608) !== 0) reaction.f ^= ERROR_VALUE;
|
|
2580
|
+
return result;
|
|
2581
|
+
} catch (error) {
|
|
2582
|
+
update_dependencies(reaction);
|
|
2583
|
+
return handle_error(error);
|
|
2584
|
+
} finally {
|
|
2585
|
+
reaction.f ^= REACTION_IS_UPDATING;
|
|
2586
|
+
new_deps = previous_deps;
|
|
2587
|
+
skipped_deps = previous_skipped_deps;
|
|
2588
|
+
untracked_writes = previous_untracked_writes;
|
|
2589
|
+
active_reaction = previous_reaction;
|
|
2590
|
+
current_sources = previous_sources;
|
|
2591
|
+
set_component_context(previous_component_context);
|
|
2592
|
+
untracking = previous_untracking;
|
|
2593
|
+
update_version = previous_update_version;
|
|
2594
|
+
}
|
|
2595
|
+
}
|
|
2596
|
+
/**
|
|
2597
|
+
* @param {Reaction} reaction
|
|
2598
|
+
*/
|
|
2599
|
+
function update_dependencies(reaction) {
|
|
2600
|
+
var deps = reaction.deps;
|
|
2601
|
+
var is_fork = current_batch?.is_fork;
|
|
2602
|
+
if (new_deps !== null) {
|
|
2603
|
+
var i;
|
|
2604
|
+
if (!is_fork) remove_reactions(reaction, skipped_deps);
|
|
2605
|
+
if (deps !== null && skipped_deps > 0) {
|
|
2606
|
+
deps.length = skipped_deps + new_deps.length;
|
|
2607
|
+
for (i = 0; i < new_deps.length; i++) deps[skipped_deps + i] = new_deps[i];
|
|
2608
|
+
} else reaction.deps = deps = new_deps;
|
|
2609
|
+
if (effect_tracking() && (reaction.f & 512) !== 0) for (i = skipped_deps; i < deps.length; i++) {
|
|
2610
|
+
var _deps$i;
|
|
2611
|
+
((_deps$i = deps[i]).reactions ?? (_deps$i.reactions = [])).push(reaction);
|
|
2612
|
+
}
|
|
2613
|
+
} else if (!is_fork && deps !== null && skipped_deps < deps.length) {
|
|
2614
|
+
remove_reactions(reaction, skipped_deps);
|
|
2615
|
+
deps.length = skipped_deps;
|
|
2616
|
+
}
|
|
2617
|
+
return deps;
|
|
2618
|
+
}
|
|
2619
|
+
/**
|
|
2620
|
+
* @template V
|
|
2621
|
+
* @param {Reaction} signal
|
|
2622
|
+
* @param {Value<V>} dependency
|
|
2623
|
+
* @returns {void}
|
|
2624
|
+
*/
|
|
2625
|
+
function remove_reaction(signal, dependency) {
|
|
2626
|
+
let reactions = dependency.reactions;
|
|
2627
|
+
if (reactions !== null) {
|
|
2628
|
+
var index = index_of.call(reactions, signal);
|
|
2629
|
+
if (index !== -1) {
|
|
2630
|
+
var new_length = reactions.length - 1;
|
|
2631
|
+
if (new_length === 0) reactions = dependency.reactions = null;
|
|
2632
|
+
else {
|
|
2633
|
+
reactions[index] = reactions[new_length];
|
|
2634
|
+
reactions.pop();
|
|
2635
|
+
}
|
|
2636
|
+
}
|
|
2637
|
+
}
|
|
2638
|
+
if (reactions === null && (dependency.f & 2) !== 0 && (new_deps === null || !includes.call(new_deps, dependency))) {
|
|
2639
|
+
var derived = dependency;
|
|
2640
|
+
if ((derived.f & 512) !== 0) {
|
|
2641
|
+
derived.f ^= 512;
|
|
2642
|
+
derived.f &= ~WAS_MARKED;
|
|
2643
|
+
}
|
|
2644
|
+
if (derived.v !== UNINITIALIZED) update_derived_status(derived);
|
|
2645
|
+
if (derived.ac !== null) without_reactive_context(() => {
|
|
2646
|
+
/** @type {AbortController} */ derived.ac.abort(STALE_REACTION);
|
|
2647
|
+
derived.ac = null;
|
|
2648
|
+
set_signal_status(derived, DIRTY);
|
|
2649
|
+
});
|
|
2650
|
+
freeze_derived_effects(derived);
|
|
2651
|
+
remove_reactions(derived, 0);
|
|
2771
2652
|
}
|
|
2772
2653
|
}
|
|
2773
2654
|
/**
|
|
2774
|
-
*
|
|
2775
|
-
*
|
|
2776
|
-
* @
|
|
2655
|
+
* @param {Reaction} signal
|
|
2656
|
+
* @param {number} start_index
|
|
2657
|
+
* @returns {void}
|
|
2777
2658
|
*/
|
|
2778
|
-
function
|
|
2779
|
-
|
|
2659
|
+
function remove_reactions(signal, start_index) {
|
|
2660
|
+
var dependencies = signal.deps;
|
|
2661
|
+
if (dependencies === null) return;
|
|
2662
|
+
for (var i = start_index; i < dependencies.length; i++) remove_reaction(signal, dependencies[i]);
|
|
2780
2663
|
}
|
|
2781
2664
|
/**
|
|
2782
2665
|
* @param {Effect} effect
|
|
2783
|
-
* @
|
|
2666
|
+
* @returns {void}
|
|
2784
2667
|
*/
|
|
2785
|
-
function
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2668
|
+
function update_effect(effect) {
|
|
2669
|
+
var flags = effect.f;
|
|
2670
|
+
if ((flags & 16384) !== 0) return;
|
|
2671
|
+
set_signal_status(effect, CLEAN);
|
|
2672
|
+
var previous_effect = active_effect;
|
|
2673
|
+
var was_updating_effect = is_updating_effect;
|
|
2674
|
+
active_effect = effect;
|
|
2675
|
+
is_updating_effect = (flags & 96) === 0;
|
|
2676
|
+
try {
|
|
2677
|
+
if ((flags & 16777232) !== 0) destroy_block_effect_children(effect);
|
|
2678
|
+
else destroy_effect_children(effect);
|
|
2679
|
+
execute_effect_teardown(effect);
|
|
2680
|
+
var teardown = update_reaction(effect);
|
|
2681
|
+
effect.teardown = typeof teardown === "function" ? teardown : null;
|
|
2682
|
+
effect.wv = write_version;
|
|
2683
|
+
} finally {
|
|
2684
|
+
is_updating_effect = was_updating_effect;
|
|
2685
|
+
active_effect = previous_effect;
|
|
2802
2686
|
}
|
|
2803
2687
|
}
|
|
2804
2688
|
/**
|
|
2805
|
-
* @
|
|
2806
|
-
* @param {
|
|
2689
|
+
* @template V
|
|
2690
|
+
* @param {Value<V>} signal
|
|
2691
|
+
* @returns {V}
|
|
2807
2692
|
*/
|
|
2808
|
-
function
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2693
|
+
function get(signal) {
|
|
2694
|
+
var is_derived = (signal.f & 2) !== 0;
|
|
2695
|
+
captured_signals?.add(signal);
|
|
2696
|
+
if (active_reaction !== null && !untracking) {
|
|
2697
|
+
if (!(active_effect !== null && (active_effect.f & 16384) !== 0) && (current_sources === null || !current_sources.has(signal))) {
|
|
2698
|
+
var deps = active_reaction.deps;
|
|
2699
|
+
if ((active_reaction.f & 2097152) !== 0) {
|
|
2700
|
+
if (signal.rv < read_version) {
|
|
2701
|
+
signal.rv = read_version;
|
|
2702
|
+
if (new_deps === null && deps !== null && deps[skipped_deps] === signal) skipped_deps++;
|
|
2703
|
+
else if (new_deps === null) new_deps = [signal];
|
|
2704
|
+
else new_deps.push(signal);
|
|
2705
|
+
}
|
|
2706
|
+
} else {
|
|
2707
|
+
var _active_reaction;
|
|
2708
|
+
(_active_reaction = active_reaction).deps ?? (_active_reaction.deps = []);
|
|
2709
|
+
if (!includes.call(active_reaction.deps, signal)) active_reaction.deps.push(signal);
|
|
2710
|
+
var reactions = signal.reactions;
|
|
2711
|
+
if (reactions === null) signal.reactions = [active_reaction];
|
|
2712
|
+
else if (!includes.call(reactions, active_reaction)) reactions.push(active_reaction);
|
|
2713
|
+
}
|
|
2714
|
+
}
|
|
2715
|
+
}
|
|
2716
|
+
if (is_destroying_effect && old_values.has(signal)) return old_values.get(signal);
|
|
2717
|
+
if (is_derived) {
|
|
2718
|
+
var derived = signal;
|
|
2719
|
+
if (is_destroying_effect) {
|
|
2720
|
+
var value = derived.v;
|
|
2721
|
+
if ((derived.f & 1024) === 0 && derived.reactions !== null || depends_on_old_values(derived)) value = execute_derived(derived);
|
|
2722
|
+
old_values.set(derived, value);
|
|
2723
|
+
return value;
|
|
2724
|
+
}
|
|
2725
|
+
var should_connect = (derived.f & 512) === 0 && !untracking && active_reaction !== null && (is_updating_effect || (active_reaction.f & 512) !== 0);
|
|
2726
|
+
var is_new = (derived.f & REACTION_RAN) === 0;
|
|
2727
|
+
if (is_dirty(derived)) {
|
|
2728
|
+
if (should_connect) derived.f |= 512;
|
|
2729
|
+
update_derived(derived);
|
|
2730
|
+
}
|
|
2731
|
+
if (should_connect && !is_new) {
|
|
2732
|
+
unfreeze_derived_effects(derived);
|
|
2733
|
+
reconnect(derived);
|
|
2734
|
+
}
|
|
2818
2735
|
}
|
|
2736
|
+
if (batch_values?.has(signal)) return batch_values.get(signal);
|
|
2737
|
+
if ((signal.f & 8388608) !== 0) throw signal.v;
|
|
2738
|
+
return signal.v;
|
|
2819
2739
|
}
|
|
2820
|
-
//#endregion
|
|
2821
|
-
//#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/legacy.js
|
|
2822
2740
|
/**
|
|
2823
|
-
*
|
|
2824
|
-
*
|
|
2741
|
+
* (Re)connect a disconnected derived, so that it is notified
|
|
2742
|
+
* of changes in `mark_reactions`
|
|
2743
|
+
* @param {Derived} derived
|
|
2825
2744
|
*/
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
}
|
|
2836
|
-
/** @type {null | Reaction} */
|
|
2837
|
-
var active_reaction = null;
|
|
2838
|
-
var untracking = false;
|
|
2839
|
-
/** @param {null | Reaction} reaction */
|
|
2840
|
-
function set_active_reaction(reaction) {
|
|
2841
|
-
active_reaction = reaction;
|
|
2745
|
+
function reconnect(derived) {
|
|
2746
|
+
derived.f |= 512;
|
|
2747
|
+
if (derived.deps === null) return;
|
|
2748
|
+
for (const dep of derived.deps) {
|
|
2749
|
+
(dep.reactions ?? (dep.reactions = [])).push(derived);
|
|
2750
|
+
if ((dep.f & 2) !== 0 && (dep.f & 512) === 0) {
|
|
2751
|
+
unfreeze_derived_effects(dep);
|
|
2752
|
+
reconnect(dep);
|
|
2753
|
+
}
|
|
2754
|
+
}
|
|
2842
2755
|
}
|
|
2843
|
-
/** @
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2756
|
+
/** @param {Derived} derived */
|
|
2757
|
+
function depends_on_old_values(derived) {
|
|
2758
|
+
if (derived.v === UNINITIALIZED) return true;
|
|
2759
|
+
if (derived.deps === null) return false;
|
|
2760
|
+
for (const dep of derived.deps) {
|
|
2761
|
+
if (old_values.has(dep)) return true;
|
|
2762
|
+
if ((dep.f & 2) !== 0 && depends_on_old_values(dep)) return true;
|
|
2763
|
+
}
|
|
2764
|
+
return false;
|
|
2848
2765
|
}
|
|
2849
2766
|
/**
|
|
2850
|
-
* When
|
|
2851
|
-
*
|
|
2852
|
-
*
|
|
2767
|
+
* When used inside a [`$derived`](https://svelte.dev/docs/svelte/$derived) or [`$effect`](https://svelte.dev/docs/svelte/$effect),
|
|
2768
|
+
* any state read inside `fn` will not be treated as a dependency.
|
|
2769
|
+
*
|
|
2770
|
+
* ```ts
|
|
2771
|
+
* $effect(() => {
|
|
2772
|
+
* // this will run when `data` changes, but not when `time` changes
|
|
2773
|
+
* save(data, {
|
|
2774
|
+
* timestamp: untrack(() => time)
|
|
2775
|
+
* });
|
|
2776
|
+
* });
|
|
2777
|
+
* ```
|
|
2778
|
+
* @template T
|
|
2779
|
+
* @param {() => T} fn
|
|
2780
|
+
* @returns {T}
|
|
2853
2781
|
*/
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2782
|
+
function untrack(fn) {
|
|
2783
|
+
var previous_untracking = untracking;
|
|
2784
|
+
try {
|
|
2785
|
+
untracking = true;
|
|
2786
|
+
return fn();
|
|
2787
|
+
} finally {
|
|
2788
|
+
untracking = previous_untracking;
|
|
2789
|
+
}
|
|
2858
2790
|
}
|
|
2791
|
+
//#endregion
|
|
2792
|
+
//#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/elements/events.js
|
|
2859
2793
|
/**
|
|
2860
|
-
*
|
|
2861
|
-
*
|
|
2862
|
-
* and until a new dependency is accessed — we track this via `skipped_deps`
|
|
2863
|
-
* @type {null | Value[]}
|
|
2794
|
+
* Used on elements, as a map of event type -> event handler,
|
|
2795
|
+
* and on events themselves to track which element handled an event
|
|
2864
2796
|
*/
|
|
2865
|
-
var
|
|
2866
|
-
|
|
2797
|
+
var event_symbol = Symbol("events");
|
|
2798
|
+
/** @type {Set<string>} */
|
|
2799
|
+
var all_registered_events = /* @__PURE__ */ new Set();
|
|
2800
|
+
/** @type {Set<(events: Array<string>) => void>} */
|
|
2801
|
+
var root_event_handles = /* @__PURE__ */ new Set();
|
|
2867
2802
|
/**
|
|
2868
|
-
*
|
|
2869
|
-
*
|
|
2870
|
-
* @
|
|
2803
|
+
* @param {string} event_name
|
|
2804
|
+
* @param {Element} element
|
|
2805
|
+
* @param {EventListener} [handler]
|
|
2806
|
+
* @returns {void}
|
|
2871
2807
|
*/
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
function set_untracked_writes(value) {
|
|
2875
|
-
untracked_writes = value;
|
|
2876
|
-
}
|
|
2877
|
-
/**
|
|
2878
|
-
* @type {number} Used by sources and deriveds for handling updates.
|
|
2879
|
-
* Version starts from 1 so that unowned deriveds differentiate between a created effect and a run one for tracing
|
|
2880
|
-
**/
|
|
2881
|
-
var write_version = 1;
|
|
2882
|
-
/** @type {number} Used to version each read of a source of derived to avoid duplicating depedencies inside a reaction */
|
|
2883
|
-
var read_version = 0;
|
|
2884
|
-
var update_version = read_version;
|
|
2885
|
-
/** @param {number} value */
|
|
2886
|
-
function set_update_version(value) {
|
|
2887
|
-
update_version = value;
|
|
2888
|
-
}
|
|
2889
|
-
function increment_write_version() {
|
|
2890
|
-
return ++write_version;
|
|
2808
|
+
function delegated(event_name, element, handler) {
|
|
2809
|
+
(element[event_symbol] ?? (element[event_symbol] = {}))[event_name] = handler;
|
|
2891
2810
|
}
|
|
2892
|
-
/**
|
|
2893
|
-
*
|
|
2894
|
-
*
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
var flags = reaction.f;
|
|
2900
|
-
if ((flags & 2048) !== 0) return true;
|
|
2901
|
-
if (flags & 2) reaction.f &= ~WAS_MARKED;
|
|
2902
|
-
if ((flags & 4096) !== 0) {
|
|
2903
|
-
var dependencies = reaction.deps;
|
|
2904
|
-
var length = dependencies.length;
|
|
2905
|
-
for (var i = 0; i < length; i++) {
|
|
2906
|
-
var dependency = dependencies[i];
|
|
2907
|
-
if (is_dirty(dependency)) update_derived(dependency);
|
|
2908
|
-
if (dependency.wv > reaction.wv) return true;
|
|
2909
|
-
}
|
|
2910
|
-
if ((flags & 512) !== 0 && batch_values === null) set_signal_status(reaction, CLEAN);
|
|
2911
|
-
}
|
|
2912
|
-
return false;
|
|
2811
|
+
/**
|
|
2812
|
+
* @param {Array<string>} events
|
|
2813
|
+
* @returns {void}
|
|
2814
|
+
*/
|
|
2815
|
+
function delegate(events) {
|
|
2816
|
+
for (var i = 0; i < events.length; i++) all_registered_events.add(events[i]);
|
|
2817
|
+
for (var fn of root_event_handles) fn(events);
|
|
2913
2818
|
}
|
|
2819
|
+
var last_propagated_event = null;
|
|
2820
|
+
var last_propagated_event_clear_scheduled = false;
|
|
2914
2821
|
/**
|
|
2915
|
-
* @
|
|
2916
|
-
* @param {
|
|
2917
|
-
* @
|
|
2822
|
+
* @this {EventTarget}
|
|
2823
|
+
* @param {Event} event
|
|
2824
|
+
* @returns {void}
|
|
2918
2825
|
*/
|
|
2919
|
-
function
|
|
2920
|
-
var
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2826
|
+
function handle_event_propagation(event) {
|
|
2827
|
+
var handler_element = this;
|
|
2828
|
+
var owner_document = handler_element.ownerDocument;
|
|
2829
|
+
var event_name = event.type;
|
|
2830
|
+
var path = event.composedPath?.() || [];
|
|
2831
|
+
var current_target = path[0] || event.target;
|
|
2832
|
+
last_propagated_event = event;
|
|
2833
|
+
if (!last_propagated_event_clear_scheduled) {
|
|
2834
|
+
last_propagated_event_clear_scheduled = true;
|
|
2835
|
+
setTimeout(() => {
|
|
2836
|
+
last_propagated_event_clear_scheduled = false;
|
|
2837
|
+
last_propagated_event = null;
|
|
2838
|
+
});
|
|
2839
|
+
}
|
|
2840
|
+
var path_idx = 0;
|
|
2841
|
+
var handled_at = last_propagated_event === event && event[event_symbol];
|
|
2842
|
+
if (handled_at) {
|
|
2843
|
+
var at_idx = path.indexOf(handled_at);
|
|
2844
|
+
if (at_idx !== -1 && (handler_element === document || handler_element === window)) {
|
|
2845
|
+
event[event_symbol] = handler_element;
|
|
2846
|
+
return;
|
|
2930
2847
|
}
|
|
2848
|
+
var handler_idx = path.indexOf(handler_element);
|
|
2849
|
+
if (handler_idx === -1) return;
|
|
2850
|
+
if (at_idx <= handler_idx) path_idx = at_idx;
|
|
2931
2851
|
}
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2852
|
+
current_target = path[path_idx] || event.target;
|
|
2853
|
+
if (current_target === handler_element) return;
|
|
2854
|
+
define_property(event, "currentTarget", {
|
|
2855
|
+
configurable: true,
|
|
2856
|
+
get() {
|
|
2857
|
+
return current_target || owner_document;
|
|
2858
|
+
}
|
|
2859
|
+
});
|
|
2938
2860
|
var previous_reaction = active_reaction;
|
|
2939
|
-
var
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
var previous_update_version = update_version;
|
|
2943
|
-
var flags = reaction.f;
|
|
2944
|
-
new_deps = null;
|
|
2945
|
-
skipped_deps = 0;
|
|
2946
|
-
untracked_writes = null;
|
|
2947
|
-
active_reaction = (flags & 96) === 0 ? reaction : null;
|
|
2948
|
-
current_sources = null;
|
|
2949
|
-
set_component_context(reaction.ctx);
|
|
2950
|
-
untracking = false;
|
|
2951
|
-
update_version = ++read_version;
|
|
2952
|
-
if (reaction.ac !== null) {
|
|
2953
|
-
without_reactive_context(() => {
|
|
2954
|
-
/** @type {AbortController} */ reaction.ac.abort(STALE_REACTION);
|
|
2955
|
-
});
|
|
2956
|
-
reaction.ac = null;
|
|
2957
|
-
}
|
|
2861
|
+
var previous_effect = active_effect;
|
|
2862
|
+
set_active_reaction(null);
|
|
2863
|
+
set_active_effect(null);
|
|
2958
2864
|
try {
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
if (
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2865
|
+
/**
|
|
2866
|
+
* @type {unknown}
|
|
2867
|
+
*/
|
|
2868
|
+
var throw_error;
|
|
2869
|
+
/**
|
|
2870
|
+
* @type {unknown[]}
|
|
2871
|
+
*/
|
|
2872
|
+
var other_errors = [];
|
|
2873
|
+
while (current_target !== null) {
|
|
2874
|
+
if (current_target === handler_element) break;
|
|
2875
|
+
try {
|
|
2876
|
+
var delegated = current_target[event_symbol]?.[event_name];
|
|
2877
|
+
if (delegated != null && (!current_target.disabled || event.target === current_target)) delegated.call(current_target, event);
|
|
2878
|
+
} catch (error) {
|
|
2879
|
+
if (throw_error) other_errors.push(error);
|
|
2880
|
+
else throw_error = error;
|
|
2975
2881
|
}
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2882
|
+
if (event.cancelBubble) break;
|
|
2883
|
+
path_idx++;
|
|
2884
|
+
current_target = path_idx < path.length ? path[path_idx] : null;
|
|
2979
2885
|
}
|
|
2980
|
-
if (
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
if (untracked_writes !== null) if (previous_untracked_writes === null) previous_untracked_writes = untracked_writes;
|
|
2986
|
-
else previous_untracked_writes.push(...untracked_writes);
|
|
2886
|
+
if (throw_error) {
|
|
2887
|
+
for (let error of other_errors) queueMicrotask(() => {
|
|
2888
|
+
throw error;
|
|
2889
|
+
});
|
|
2890
|
+
throw throw_error;
|
|
2987
2891
|
}
|
|
2988
|
-
if ((reaction.f & 8388608) !== 0) reaction.f ^= ERROR_VALUE;
|
|
2989
|
-
return result;
|
|
2990
|
-
} catch (error) {
|
|
2991
|
-
return handle_error(error);
|
|
2992
2892
|
} finally {
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
active_reaction = previous_reaction;
|
|
2998
|
-
current_sources = previous_sources;
|
|
2999
|
-
set_component_context(previous_component_context);
|
|
3000
|
-
untracking = previous_untracking;
|
|
3001
|
-
update_version = previous_update_version;
|
|
2893
|
+
event[event_symbol] = handler_element;
|
|
2894
|
+
delete event.currentTarget;
|
|
2895
|
+
set_active_reaction(previous_reaction);
|
|
2896
|
+
set_active_effect(previous_effect);
|
|
3002
2897
|
}
|
|
3003
2898
|
}
|
|
2899
|
+
//#endregion
|
|
2900
|
+
//#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/reconciler.js
|
|
2901
|
+
var policy = globalThis?.window?.trustedTypes && /* @__PURE__ */ globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", {
|
|
2902
|
+
/** @param {string} html */
|
|
2903
|
+
createHTML: (html) => {
|
|
2904
|
+
return html;
|
|
2905
|
+
} });
|
|
2906
|
+
/** @param {string} html */
|
|
2907
|
+
function create_trusted_html(html) {
|
|
2908
|
+
return policy?.createHTML(html) ?? html;
|
|
2909
|
+
}
|
|
3004
2910
|
/**
|
|
3005
|
-
* @
|
|
3006
|
-
* @param {Reaction} signal
|
|
3007
|
-
* @param {Value<V>} dependency
|
|
3008
|
-
* @returns {void}
|
|
2911
|
+
* @param {string} html
|
|
3009
2912
|
*/
|
|
3010
|
-
function
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
2913
|
+
function create_fragment_from_html(html) {
|
|
2914
|
+
var elem = create_element("template");
|
|
2915
|
+
elem.innerHTML = create_trusted_html(html.replaceAll("<!>", "<!---->"));
|
|
2916
|
+
return elem.content;
|
|
2917
|
+
}
|
|
2918
|
+
//#endregion
|
|
2919
|
+
//#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/template.js
|
|
2920
|
+
/** @import { Effect, EffectNodes, TemplateNode } from '#client' */
|
|
2921
|
+
/** @import { TemplateStructure } from './types' */
|
|
2922
|
+
/**
|
|
2923
|
+
* @param {TemplateNode} start
|
|
2924
|
+
* @param {TemplateNode | null} end
|
|
2925
|
+
*/
|
|
2926
|
+
function assign_nodes(start, end) {
|
|
2927
|
+
var effect = active_effect;
|
|
2928
|
+
if (effect.nodes === null) effect.nodes = {
|
|
2929
|
+
start,
|
|
2930
|
+
end,
|
|
2931
|
+
a: null,
|
|
2932
|
+
t: null
|
|
2933
|
+
};
|
|
2934
|
+
}
|
|
2935
|
+
/**
|
|
2936
|
+
* @param {string} content
|
|
2937
|
+
* @param {number} flags
|
|
2938
|
+
* @returns {() => Node | Node[]}
|
|
2939
|
+
*/
|
|
2940
|
+
/*#__NO_SIDE_EFFECTS__*/
|
|
2941
|
+
function from_html(content, flags) {
|
|
2942
|
+
var is_fragment = (flags & 1) !== 0;
|
|
2943
|
+
var use_import_node = (flags & 2) !== 0;
|
|
2944
|
+
/** @type {Node} */
|
|
2945
|
+
var node;
|
|
2946
|
+
/**
|
|
2947
|
+
* Whether or not the first item is a text/element node. If not, we need to
|
|
2948
|
+
* create an additional comment node to act as `effect.nodes.start`
|
|
2949
|
+
*/
|
|
2950
|
+
var has_start = !content.startsWith("<!>");
|
|
2951
|
+
return () => {
|
|
2952
|
+
if (hydrating) {
|
|
2953
|
+
assign_nodes(hydrate_node, null);
|
|
2954
|
+
return hydrate_node;
|
|
3021
2955
|
}
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
if ((derived.f & 512) !== 0) {
|
|
3026
|
-
derived.f ^= 512;
|
|
3027
|
-
derived.f &= ~WAS_MARKED;
|
|
2956
|
+
if (node === void 0) {
|
|
2957
|
+
node = create_fragment_from_html(has_start ? content : "<!>" + content);
|
|
2958
|
+
if (!is_fragment) node = /* @__PURE__ */ get_first_child(node);
|
|
3028
2959
|
}
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
2960
|
+
var clone = use_import_node || is_firefox ? document.importNode(node, true) : node.cloneNode(true);
|
|
2961
|
+
if (is_fragment) {
|
|
2962
|
+
var start = /* @__PURE__ */ get_first_child(clone);
|
|
2963
|
+
var end = clone.lastChild;
|
|
2964
|
+
assign_nodes(start, end);
|
|
2965
|
+
} else assign_nodes(clone, clone);
|
|
2966
|
+
return clone;
|
|
2967
|
+
};
|
|
2968
|
+
}
|
|
2969
|
+
/**
|
|
2970
|
+
* @param {string} content
|
|
2971
|
+
* @param {number} flags
|
|
2972
|
+
* @param {'svg' | 'math'} ns
|
|
2973
|
+
* @returns {() => Node | Node[]}
|
|
2974
|
+
*/
|
|
2975
|
+
/*#__NO_SIDE_EFFECTS__*/
|
|
2976
|
+
function from_namespace(content, flags, ns = "svg") {
|
|
2977
|
+
/**
|
|
2978
|
+
* Whether or not the first item is a text/element node. If not, we need to
|
|
2979
|
+
* create an additional comment node to act as `effect.nodes.start`
|
|
2980
|
+
*/
|
|
2981
|
+
var has_start = !content.startsWith("<!>");
|
|
2982
|
+
var is_fragment = (flags & 1) !== 0;
|
|
2983
|
+
var wrapped = `<${ns}>${has_start ? content : "<!>" + content}</${ns}>`;
|
|
2984
|
+
/** @type {Element | DocumentFragment} */
|
|
2985
|
+
var node;
|
|
2986
|
+
return () => {
|
|
2987
|
+
if (hydrating) {
|
|
2988
|
+
assign_nodes(hydrate_node, null);
|
|
2989
|
+
return hydrate_node;
|
|
2990
|
+
}
|
|
2991
|
+
if (!node) {
|
|
2992
|
+
var root = /* @__PURE__ */ get_first_child(create_fragment_from_html(wrapped));
|
|
2993
|
+
if (is_fragment) {
|
|
2994
|
+
node = document.createDocumentFragment();
|
|
2995
|
+
while (/* @__PURE__ */ get_first_child(root)) node.appendChild(/* @__PURE__ */ get_first_child(root));
|
|
2996
|
+
} else node = /* @__PURE__ */ get_first_child(root);
|
|
2997
|
+
}
|
|
2998
|
+
var clone = node.cloneNode(true);
|
|
2999
|
+
if (is_fragment) {
|
|
3000
|
+
var start = /* @__PURE__ */ get_first_child(clone);
|
|
3001
|
+
var end = clone.lastChild;
|
|
3002
|
+
assign_nodes(start, end);
|
|
3003
|
+
} else assign_nodes(clone, clone);
|
|
3004
|
+
return clone;
|
|
3005
|
+
};
|
|
3033
3006
|
}
|
|
3034
3007
|
/**
|
|
3035
|
-
* @param {
|
|
3036
|
-
* @param {number}
|
|
3037
|
-
* @returns {void}
|
|
3008
|
+
* @param {string} content
|
|
3009
|
+
* @param {number} flags
|
|
3038
3010
|
*/
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
for (var i = start_index; i < dependencies.length; i++) remove_reaction(signal, dependencies[i]);
|
|
3011
|
+
/*#__NO_SIDE_EFFECTS__*/
|
|
3012
|
+
function from_svg(content, flags) {
|
|
3013
|
+
return /* @__PURE__ */ from_namespace(content, flags, "svg");
|
|
3043
3014
|
}
|
|
3044
3015
|
/**
|
|
3045
|
-
*
|
|
3046
|
-
*
|
|
3016
|
+
* Assign the created (or in hydration mode, traversed) dom elements to the current block
|
|
3017
|
+
* and insert the elements into the dom (in client mode).
|
|
3018
|
+
* @param {Text | Comment | Element} anchor
|
|
3019
|
+
* @param {DocumentFragment | Element} dom
|
|
3047
3020
|
*/
|
|
3048
|
-
function
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
active_effect = effect;
|
|
3055
|
-
is_updating_effect = true;
|
|
3056
|
-
try {
|
|
3057
|
-
if ((flags & 16777232) !== 0) destroy_block_effect_children(effect);
|
|
3058
|
-
else destroy_effect_children(effect);
|
|
3059
|
-
execute_effect_teardown(effect);
|
|
3060
|
-
var teardown = update_reaction(effect);
|
|
3061
|
-
effect.teardown = typeof teardown === "function" ? teardown : null;
|
|
3062
|
-
effect.wv = write_version;
|
|
3063
|
-
} finally {
|
|
3064
|
-
is_updating_effect = was_updating_effect;
|
|
3065
|
-
active_effect = previous_effect;
|
|
3021
|
+
function append(anchor, dom) {
|
|
3022
|
+
if (hydrating) {
|
|
3023
|
+
var effect = active_effect;
|
|
3024
|
+
if ((effect.f & 32768) === 0 || effect.nodes.end === null) effect.nodes.end = hydrate_node;
|
|
3025
|
+
hydrate_next();
|
|
3026
|
+
return;
|
|
3066
3027
|
}
|
|
3028
|
+
if (anchor === null) return;
|
|
3029
|
+
anchor.before(dom);
|
|
3067
3030
|
}
|
|
3068
3031
|
/**
|
|
3069
|
-
*
|
|
3070
|
-
*
|
|
3071
|
-
*
|
|
3032
|
+
* Subset of delegated events which should be passive by default.
|
|
3033
|
+
* These two are already passive via browser defaults on window, document and body.
|
|
3034
|
+
* But since
|
|
3035
|
+
* - we're delegating them
|
|
3036
|
+
* - they happen often
|
|
3037
|
+
* - they apply to mobile which is generally less performant
|
|
3038
|
+
* we're marking them as passive by default for other elements, too.
|
|
3072
3039
|
*/
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3040
|
+
var PASSIVE_EVENTS = ["touchstart", "touchmove"];
|
|
3041
|
+
/**
|
|
3042
|
+
* Returns `true` if `name` is a passive event
|
|
3043
|
+
* @param {string} name
|
|
3044
|
+
*/
|
|
3045
|
+
function is_passive_event(name) {
|
|
3046
|
+
return PASSIVE_EVENTS.includes(name);
|
|
3047
|
+
}
|
|
3048
|
+
//#endregion
|
|
3049
|
+
//#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/reactivity/create-subscriber.js
|
|
3050
|
+
/**
|
|
3051
|
+
* Returns a `subscribe` function that integrates external event-based systems with Svelte's reactivity.
|
|
3052
|
+
* It's particularly useful for integrating with web APIs like `MediaQuery`, `IntersectionObserver`, or `WebSocket`.
|
|
3053
|
+
*
|
|
3054
|
+
* If `subscribe` is called inside an effect (including indirectly, for example inside a getter),
|
|
3055
|
+
* the `start` callback will be called with an `update` function. Whenever `update` is called, the effect re-runs.
|
|
3056
|
+
*
|
|
3057
|
+
* If `start` returns a cleanup function, it will be called when the effect is destroyed.
|
|
3058
|
+
*
|
|
3059
|
+
* If `subscribe` is called in multiple effects, `start` will only be called once as long as the effects
|
|
3060
|
+
* are active, and the returned teardown function will only be called when all effects are destroyed.
|
|
3061
|
+
*
|
|
3062
|
+
* It's best understood with an example. Here's an implementation of [`MediaQuery`](https://svelte.dev/docs/svelte/svelte-reactivity#MediaQuery):
|
|
3063
|
+
*
|
|
3064
|
+
* ```js
|
|
3065
|
+
* import { createSubscriber } from 'svelte/reactivity';
|
|
3066
|
+
* import { on } from 'svelte/events';
|
|
3067
|
+
*
|
|
3068
|
+
* export class MediaQuery {
|
|
3069
|
+
* #query;
|
|
3070
|
+
* #subscribe;
|
|
3071
|
+
*
|
|
3072
|
+
* constructor(query) {
|
|
3073
|
+
* this.#query = window.matchMedia(`(${query})`);
|
|
3074
|
+
*
|
|
3075
|
+
* this.#subscribe = createSubscriber((update) => {
|
|
3076
|
+
* // when the `change` event occurs, re-run any effects that read `this.current`
|
|
3077
|
+
* const off = on(this.#query, 'change', update);
|
|
3078
|
+
*
|
|
3079
|
+
* // stop listening when all the effects are destroyed
|
|
3080
|
+
* return () => off();
|
|
3081
|
+
* });
|
|
3082
|
+
* }
|
|
3083
|
+
*
|
|
3084
|
+
* get current() {
|
|
3085
|
+
* // This makes the getter reactive, if read in an effect
|
|
3086
|
+
* this.#subscribe();
|
|
3087
|
+
*
|
|
3088
|
+
* // Return the current state of the query, whether or not we're in an effect
|
|
3089
|
+
* return this.#query.matches;
|
|
3090
|
+
* }
|
|
3091
|
+
* }
|
|
3092
|
+
* ```
|
|
3093
|
+
* @param {(update: () => void) => (() => void) | void} start
|
|
3094
|
+
* @since 5.7.0
|
|
3095
|
+
*/
|
|
3096
|
+
function createSubscriber(start) {
|
|
3097
|
+
let subscribers = 0;
|
|
3098
|
+
let version = source(0);
|
|
3099
|
+
/** @type {(() => void) | void} */
|
|
3100
|
+
let stop;
|
|
3101
|
+
return () => {
|
|
3102
|
+
if (effect_tracking()) {
|
|
3103
|
+
get(version);
|
|
3104
|
+
render_effect(() => {
|
|
3105
|
+
if (subscribers === 0) stop = untrack(() => start(() => increment(version)));
|
|
3106
|
+
subscribers += 1;
|
|
3107
|
+
return () => {
|
|
3108
|
+
queue_micro_task(() => {
|
|
3109
|
+
subscribers -= 1;
|
|
3110
|
+
if (subscribers === 0) {
|
|
3111
|
+
stop?.();
|
|
3112
|
+
stop = void 0;
|
|
3113
|
+
increment(version);
|
|
3114
|
+
}
|
|
3115
|
+
});
|
|
3116
|
+
};
|
|
3117
|
+
});
|
|
3094
3118
|
}
|
|
3119
|
+
};
|
|
3120
|
+
}
|
|
3121
|
+
//#endregion
|
|
3122
|
+
//#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/blocks/boundary.js
|
|
3123
|
+
/** @import { Effect, Source, TemplateNode, } from '#client' */
|
|
3124
|
+
/**
|
|
3125
|
+
* @typedef {{
|
|
3126
|
+
* onerror?: ((error: unknown, reset: () => void) => void) | null;
|
|
3127
|
+
* failed?: ((anchor: Node, error: () => unknown, reset: () => () => void) => void) | null;
|
|
3128
|
+
* pending?: ((anchor: Node) => void) | null;
|
|
3129
|
+
* }} BoundaryProps
|
|
3130
|
+
*/
|
|
3131
|
+
var flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED;
|
|
3132
|
+
/**
|
|
3133
|
+
* @param {TemplateNode} node
|
|
3134
|
+
* @param {BoundaryProps} props
|
|
3135
|
+
* @param {((anchor: Node) => void)} children
|
|
3136
|
+
* @param {((error: unknown) => unknown) | undefined} [transform_error]
|
|
3137
|
+
* @returns {void}
|
|
3138
|
+
*/
|
|
3139
|
+
function boundary(node, props, children, transform_error) {
|
|
3140
|
+
new Boundary(node, props, children, transform_error);
|
|
3141
|
+
}
|
|
3142
|
+
var _anchor = /* @__PURE__ */ new WeakMap();
|
|
3143
|
+
var _hydrate_open = /* @__PURE__ */ new WeakMap();
|
|
3144
|
+
var _props = /* @__PURE__ */ new WeakMap();
|
|
3145
|
+
var _children = /* @__PURE__ */ new WeakMap();
|
|
3146
|
+
var _effect = /* @__PURE__ */ new WeakMap();
|
|
3147
|
+
var _main_effect = /* @__PURE__ */ new WeakMap();
|
|
3148
|
+
var _pending_effect = /* @__PURE__ */ new WeakMap();
|
|
3149
|
+
var _failed_effect = /* @__PURE__ */ new WeakMap();
|
|
3150
|
+
var _offscreen_fragment = /* @__PURE__ */ new WeakMap();
|
|
3151
|
+
var _local_pending_count = /* @__PURE__ */ new WeakMap();
|
|
3152
|
+
var _pending_count = /* @__PURE__ */ new WeakMap();
|
|
3153
|
+
var _pending_count_update_queued = /* @__PURE__ */ new WeakMap();
|
|
3154
|
+
var _dirty_effects = /* @__PURE__ */ new WeakMap();
|
|
3155
|
+
var _maybe_dirty_effects = /* @__PURE__ */ new WeakMap();
|
|
3156
|
+
var _effect_pending = /* @__PURE__ */ new WeakMap();
|
|
3157
|
+
var _effect_pending_subscriber = /* @__PURE__ */ new WeakMap();
|
|
3158
|
+
var _Boundary_brand = /* @__PURE__ */ new WeakSet();
|
|
3159
|
+
var Boundary = class {
|
|
3160
|
+
/**
|
|
3161
|
+
* @param {TemplateNode} node
|
|
3162
|
+
* @param {BoundaryProps} props
|
|
3163
|
+
* @param {((anchor: Node) => void)} children
|
|
3164
|
+
* @param {((error: unknown) => unknown) | undefined} [transform_error]
|
|
3165
|
+
*/
|
|
3166
|
+
constructor(node, props, children, transform_error) {
|
|
3167
|
+
_classPrivateMethodInitSpec(this, _Boundary_brand);
|
|
3168
|
+
_defineProperty(
|
|
3169
|
+
this,
|
|
3170
|
+
/** @type {Boundary | null} */
|
|
3171
|
+
"parent",
|
|
3172
|
+
void 0
|
|
3173
|
+
);
|
|
3174
|
+
_defineProperty(this, "is_pending", false);
|
|
3175
|
+
_defineProperty(
|
|
3176
|
+
this,
|
|
3177
|
+
/**
|
|
3178
|
+
* API-level transformError transform function. Transforms errors before they reach the `failed` snippet.
|
|
3179
|
+
* Inherited from parent boundary, or defaults to identity.
|
|
3180
|
+
* @type {(error: unknown) => unknown}
|
|
3181
|
+
*/
|
|
3182
|
+
"transform_error",
|
|
3183
|
+
void 0
|
|
3184
|
+
);
|
|
3185
|
+
_classPrivateFieldInitSpec(this, _anchor, void 0);
|
|
3186
|
+
_classPrivateFieldInitSpec(this, _hydrate_open, hydrating ? hydrate_node : null);
|
|
3187
|
+
_classPrivateFieldInitSpec(this, _props, void 0);
|
|
3188
|
+
_classPrivateFieldInitSpec(this, _children, void 0);
|
|
3189
|
+
_classPrivateFieldInitSpec(this, _effect, void 0);
|
|
3190
|
+
_classPrivateFieldInitSpec(this, _main_effect, null);
|
|
3191
|
+
_classPrivateFieldInitSpec(this, _pending_effect, null);
|
|
3192
|
+
_classPrivateFieldInitSpec(this, _failed_effect, null);
|
|
3193
|
+
_classPrivateFieldInitSpec(this, _offscreen_fragment, null);
|
|
3194
|
+
_classPrivateFieldInitSpec(this, _local_pending_count, 0);
|
|
3195
|
+
_classPrivateFieldInitSpec(this, _pending_count, 0);
|
|
3196
|
+
_classPrivateFieldInitSpec(this, _pending_count_update_queued, false);
|
|
3197
|
+
_classPrivateFieldInitSpec(this, _dirty_effects, /* @__PURE__ */ new Set());
|
|
3198
|
+
_classPrivateFieldInitSpec(this, _maybe_dirty_effects, /* @__PURE__ */ new Set());
|
|
3199
|
+
_classPrivateFieldInitSpec(this, _effect_pending, null);
|
|
3200
|
+
_classPrivateFieldInitSpec(this, _effect_pending_subscriber, createSubscriber(() => {
|
|
3201
|
+
_classPrivateFieldSet2(_effect_pending, this, source(_classPrivateFieldGet2(_local_pending_count, this)));
|
|
3202
|
+
return () => {
|
|
3203
|
+
_classPrivateFieldSet2(_effect_pending, this, null);
|
|
3204
|
+
};
|
|
3205
|
+
}));
|
|
3206
|
+
_classPrivateFieldSet2(_anchor, this, node);
|
|
3207
|
+
_classPrivateFieldSet2(_props, this, props);
|
|
3208
|
+
_classPrivateFieldSet2(_children, this, (anchor) => {
|
|
3209
|
+
var effect = active_effect;
|
|
3210
|
+
effect.b = this;
|
|
3211
|
+
effect.f |= 128;
|
|
3212
|
+
children(anchor);
|
|
3213
|
+
});
|
|
3214
|
+
this.parent = active_effect.b;
|
|
3215
|
+
this.transform_error = transform_error ?? this.parent?.transform_error ?? ((e) => e);
|
|
3216
|
+
_classPrivateFieldSet2(_effect, this, block(() => {
|
|
3217
|
+
if (hydrating) {
|
|
3218
|
+
const comment = _classPrivateFieldGet2(_hydrate_open, this);
|
|
3219
|
+
hydrate_next();
|
|
3220
|
+
const server_rendered_pending = comment.data === "[!";
|
|
3221
|
+
if (comment.data.startsWith("[?")) {
|
|
3222
|
+
const serialized_error = JSON.parse(comment.data.slice(2));
|
|
3223
|
+
_assertClassBrand(_Boundary_brand, this, _hydrate_failed_content).call(this, serialized_error);
|
|
3224
|
+
} else if (server_rendered_pending) _assertClassBrand(_Boundary_brand, this, _hydrate_pending_content).call(this);
|
|
3225
|
+
else _assertClassBrand(_Boundary_brand, this, _hydrate_resolved_content).call(this);
|
|
3226
|
+
} else _assertClassBrand(_Boundary_brand, this, _render).call(this);
|
|
3227
|
+
}, flags));
|
|
3228
|
+
if (hydrating) _classPrivateFieldSet2(_anchor, this, hydrate_node);
|
|
3095
3229
|
}
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
old_values.set(derived, value);
|
|
3103
|
-
return value;
|
|
3104
|
-
}
|
|
3105
|
-
var should_connect = (derived.f & 512) === 0 && !untracking && active_reaction !== null && (is_updating_effect || (active_reaction.f & 512) !== 0);
|
|
3106
|
-
var is_new = (derived.f & REACTION_RAN) === 0;
|
|
3107
|
-
if (is_dirty(derived)) {
|
|
3108
|
-
if (should_connect) derived.f |= 512;
|
|
3109
|
-
update_derived(derived);
|
|
3110
|
-
}
|
|
3111
|
-
if (should_connect && !is_new) {
|
|
3112
|
-
unfreeze_derived_effects(derived);
|
|
3113
|
-
reconnect(derived);
|
|
3114
|
-
}
|
|
3230
|
+
/**
|
|
3231
|
+
* Defer an effect inside a pending boundary until the boundary resolves
|
|
3232
|
+
* @param {Effect} effect
|
|
3233
|
+
*/
|
|
3234
|
+
defer_effect(effect) {
|
|
3235
|
+
defer_effect(effect, _classPrivateFieldGet2(_dirty_effects, this), _classPrivateFieldGet2(_maybe_dirty_effects, this));
|
|
3115
3236
|
}
|
|
3116
|
-
|
|
3117
|
-
if
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
* of changes in `mark_reactions`
|
|
3123
|
-
* @param {Derived} derived
|
|
3124
|
-
*/
|
|
3125
|
-
function reconnect(derived) {
|
|
3126
|
-
derived.f |= 512;
|
|
3127
|
-
if (derived.deps === null) return;
|
|
3128
|
-
for (const dep of derived.deps) {
|
|
3129
|
-
(dep.reactions ?? (dep.reactions = [])).push(derived);
|
|
3130
|
-
if ((dep.f & 2) !== 0 && (dep.f & 512) === 0) {
|
|
3131
|
-
unfreeze_derived_effects(dep);
|
|
3132
|
-
reconnect(dep);
|
|
3133
|
-
}
|
|
3237
|
+
/**
|
|
3238
|
+
* Returns `false` if the effect exists inside a boundary whose pending snippet is shown
|
|
3239
|
+
* @returns {boolean}
|
|
3240
|
+
*/
|
|
3241
|
+
is_rendered() {
|
|
3242
|
+
return !this.is_pending && (!this.parent || this.parent.is_rendered());
|
|
3134
3243
|
}
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
function depends_on_old_values(derived) {
|
|
3138
|
-
if (derived.v === UNINITIALIZED) return true;
|
|
3139
|
-
if (derived.deps === null) return false;
|
|
3140
|
-
for (const dep of derived.deps) {
|
|
3141
|
-
if (old_values.has(dep)) return true;
|
|
3142
|
-
if ((dep.f & 2) !== 0 && depends_on_old_values(dep)) return true;
|
|
3244
|
+
has_pending_snippet() {
|
|
3245
|
+
return !!_classPrivateFieldGet2(_props, this).pending;
|
|
3143
3246
|
}
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
*
|
|
3148
|
-
*
|
|
3149
|
-
*
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
* @returns {T}
|
|
3161
|
-
*/
|
|
3162
|
-
function untrack(fn) {
|
|
3163
|
-
var previous_untracking = untracking;
|
|
3164
|
-
try {
|
|
3165
|
-
untracking = true;
|
|
3166
|
-
return fn();
|
|
3167
|
-
} finally {
|
|
3168
|
-
untracking = previous_untracking;
|
|
3247
|
+
/**
|
|
3248
|
+
* Update the source that powers `$effect.pending()` inside this boundary,
|
|
3249
|
+
* and controls when the current `pending` snippet (if any) is removed.
|
|
3250
|
+
* Do not call from inside the class
|
|
3251
|
+
* @param {1 | -1} d
|
|
3252
|
+
* @param {Batch} batch
|
|
3253
|
+
*/
|
|
3254
|
+
update_pending_count(d, batch) {
|
|
3255
|
+
_assertClassBrand(_Boundary_brand, this, _update_pending_count).call(this, d, batch);
|
|
3256
|
+
_classPrivateFieldSet2(_local_pending_count, this, _classPrivateFieldGet2(_local_pending_count, this) + d);
|
|
3257
|
+
if (!_classPrivateFieldGet2(_effect_pending, this) || _classPrivateFieldGet2(_pending_count_update_queued, this)) return;
|
|
3258
|
+
_classPrivateFieldSet2(_pending_count_update_queued, this, true);
|
|
3259
|
+
queue_micro_task(() => {
|
|
3260
|
+
_classPrivateFieldSet2(_pending_count_update_queued, this, false);
|
|
3261
|
+
if (_classPrivateFieldGet2(_effect_pending, this)) internal_set(_classPrivateFieldGet2(_effect_pending, this), _classPrivateFieldGet2(_local_pending_count, this));
|
|
3262
|
+
});
|
|
3169
3263
|
}
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
/**
|
|
3174
|
-
* Used on elements, as a map of event type -> event handler,
|
|
3175
|
-
* and on events themselves to track which element handled an event
|
|
3176
|
-
*/
|
|
3177
|
-
var event_symbol = Symbol("events");
|
|
3178
|
-
/** @type {Set<string>} */
|
|
3179
|
-
var all_registered_events = /* @__PURE__ */ new Set();
|
|
3180
|
-
/** @type {Set<(events: Array<string>) => void>} */
|
|
3181
|
-
var root_event_handles = /* @__PURE__ */ new Set();
|
|
3182
|
-
/**
|
|
3183
|
-
* @param {string} event_name
|
|
3184
|
-
* @param {Element} element
|
|
3185
|
-
* @param {EventListener} [handler]
|
|
3186
|
-
* @returns {void}
|
|
3187
|
-
*/
|
|
3188
|
-
function delegated(event_name, element, handler) {
|
|
3189
|
-
(element[event_symbol] ?? (element[event_symbol] = {}))[event_name] = handler;
|
|
3190
|
-
}
|
|
3191
|
-
/**
|
|
3192
|
-
* @param {Array<string>} events
|
|
3193
|
-
* @returns {void}
|
|
3194
|
-
*/
|
|
3195
|
-
function delegate(events) {
|
|
3196
|
-
for (var i = 0; i < events.length; i++) all_registered_events.add(events[i]);
|
|
3197
|
-
for (var fn of root_event_handles) fn(events);
|
|
3198
|
-
}
|
|
3199
|
-
var last_propagated_event = null;
|
|
3200
|
-
/**
|
|
3201
|
-
* @this {EventTarget}
|
|
3202
|
-
* @param {Event} event
|
|
3203
|
-
* @returns {void}
|
|
3204
|
-
*/
|
|
3205
|
-
function handle_event_propagation(event) {
|
|
3206
|
-
var handler_element = this;
|
|
3207
|
-
var owner_document = handler_element.ownerDocument;
|
|
3208
|
-
var event_name = event.type;
|
|
3209
|
-
var path = event.composedPath?.() || [];
|
|
3210
|
-
var current_target = path[0] || event.target;
|
|
3211
|
-
last_propagated_event = event;
|
|
3212
|
-
var path_idx = 0;
|
|
3213
|
-
var handled_at = last_propagated_event === event && event[event_symbol];
|
|
3214
|
-
if (handled_at) {
|
|
3215
|
-
var at_idx = path.indexOf(handled_at);
|
|
3216
|
-
if (at_idx !== -1 && (handler_element === document || handler_element === window)) {
|
|
3217
|
-
event[event_symbol] = handler_element;
|
|
3218
|
-
return;
|
|
3219
|
-
}
|
|
3220
|
-
var handler_idx = path.indexOf(handler_element);
|
|
3221
|
-
if (handler_idx === -1) return;
|
|
3222
|
-
if (at_idx <= handler_idx) path_idx = at_idx;
|
|
3264
|
+
get_effect_pending() {
|
|
3265
|
+
_classPrivateFieldGet2(_effect_pending_subscriber, this).call(this);
|
|
3266
|
+
return get(_classPrivateFieldGet2(_effect_pending, this));
|
|
3223
3267
|
}
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
var previous_effect = active_effect;
|
|
3234
|
-
set_active_reaction(null);
|
|
3235
|
-
set_active_effect(null);
|
|
3236
|
-
try {
|
|
3237
|
-
/**
|
|
3238
|
-
* @type {unknown}
|
|
3239
|
-
*/
|
|
3240
|
-
var throw_error;
|
|
3241
|
-
/**
|
|
3242
|
-
* @type {unknown[]}
|
|
3243
|
-
*/
|
|
3244
|
-
var other_errors = [];
|
|
3245
|
-
while (current_target !== null) {
|
|
3246
|
-
if (current_target === handler_element) break;
|
|
3247
|
-
try {
|
|
3248
|
-
var delegated = current_target[event_symbol]?.[event_name];
|
|
3249
|
-
if (delegated != null && (!current_target.disabled || event.target === current_target)) delegated.call(current_target, event);
|
|
3250
|
-
} catch (error) {
|
|
3251
|
-
if (throw_error) other_errors.push(error);
|
|
3252
|
-
else throw_error = error;
|
|
3253
|
-
}
|
|
3254
|
-
if (event.cancelBubble) break;
|
|
3255
|
-
path_idx++;
|
|
3256
|
-
current_target = path_idx < path.length ? path[path_idx] : null;
|
|
3257
|
-
}
|
|
3258
|
-
if (throw_error) {
|
|
3259
|
-
for (let error of other_errors) queueMicrotask(() => {
|
|
3260
|
-
throw error;
|
|
3268
|
+
/** @param {unknown} error */
|
|
3269
|
+
error(error) {
|
|
3270
|
+
if (!_classPrivateFieldGet2(_props, this).onerror && !_classPrivateFieldGet2(_props, this).failed) throw error;
|
|
3271
|
+
if (current_batch?.is_fork) {
|
|
3272
|
+
if (_classPrivateFieldGet2(_main_effect, this)) current_batch.skip_effect(_classPrivateFieldGet2(_main_effect, this));
|
|
3273
|
+
if (_classPrivateFieldGet2(_pending_effect, this)) current_batch.skip_effect(_classPrivateFieldGet2(_pending_effect, this));
|
|
3274
|
+
if (_classPrivateFieldGet2(_failed_effect, this)) current_batch.skip_effect(_classPrivateFieldGet2(_failed_effect, this));
|
|
3275
|
+
current_batch.oncommit(() => {
|
|
3276
|
+
_assertClassBrand(_Boundary_brand, this, _handle_error).call(this, error);
|
|
3261
3277
|
});
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3278
|
+
} else _assertClassBrand(_Boundary_brand, this, _handle_error).call(this, error);
|
|
3279
|
+
}
|
|
3280
|
+
};
|
|
3281
|
+
function _hydrate_resolved_content() {
|
|
3282
|
+
try {
|
|
3283
|
+
_classPrivateFieldSet2(_main_effect, this, branch(() => _classPrivateFieldGet2(_children, this).call(this, _classPrivateFieldGet2(_anchor, this))));
|
|
3284
|
+
} catch (error) {
|
|
3285
|
+
this.error(error);
|
|
3269
3286
|
}
|
|
3270
3287
|
}
|
|
3271
|
-
//#endregion
|
|
3272
|
-
//#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/dom/reconciler.js
|
|
3273
|
-
var policy = globalThis?.window?.trustedTypes && /* @__PURE__ */ globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", {
|
|
3274
|
-
/** @param {string} html */
|
|
3275
|
-
createHTML: (html) => {
|
|
3276
|
-
return html;
|
|
3277
|
-
} });
|
|
3278
|
-
/** @param {string} html */
|
|
3279
|
-
function create_trusted_html(html) {
|
|
3280
|
-
return policy?.createHTML(html) ?? html;
|
|
3281
|
-
}
|
|
3282
|
-
/**
|
|
3283
|
-
* @param {string} html
|
|
3284
|
-
*/
|
|
3285
|
-
function create_fragment_from_html(html) {
|
|
3286
|
-
var elem = create_element("template");
|
|
3287
|
-
elem.innerHTML = create_trusted_html(html.replaceAll("<!>", "<!---->"));
|
|
3288
|
-
return elem.content;
|
|
3289
|
-
}
|
|
3290
|
-
//#endregion
|
|
3291
|
-
//#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/dom/template.js
|
|
3292
|
-
/** @import { Effect, EffectNodes, TemplateNode } from '#client' */
|
|
3293
|
-
/** @import { TemplateStructure } from './types' */
|
|
3294
3288
|
/**
|
|
3295
|
-
* @param {
|
|
3296
|
-
* @param {TemplateNode | null} end
|
|
3289
|
+
* @param {unknown} error The deserialized error from the server's hydration comment
|
|
3297
3290
|
*/
|
|
3298
|
-
function
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
};
|
|
3291
|
+
function _hydrate_failed_content(error) {
|
|
3292
|
+
const failed = _classPrivateFieldGet2(_props, this).failed;
|
|
3293
|
+
const { reset, invoke_onerror } = _assertClassBrand(_Boundary_brand, this, _create_reset).call(this, error);
|
|
3294
|
+
queue_micro_task(invoke_onerror);
|
|
3295
|
+
if (!failed) return;
|
|
3296
|
+
_classPrivateFieldSet2(_failed_effect, this, branch(() => {
|
|
3297
|
+
failed(_classPrivateFieldGet2(_anchor, this), () => error, () => reset);
|
|
3298
|
+
}));
|
|
3306
3299
|
}
|
|
3307
3300
|
/**
|
|
3308
|
-
*
|
|
3309
|
-
*
|
|
3310
|
-
* @
|
|
3301
|
+
* Creates the `reset` function for a failed boundary, along with a function
|
|
3302
|
+
* that invokes `onerror` with it (if provided)
|
|
3303
|
+
* @param {unknown} error
|
|
3304
|
+
* @returns {{ reset: () => void, invoke_onerror: () => void }}
|
|
3311
3305
|
*/
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
var
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
* Whether or not the first item is a text/element node. If not, we need to
|
|
3320
|
-
* create an additional comment node to act as `effect.nodes.start`
|
|
3321
|
-
*/
|
|
3322
|
-
var has_start = !content.startsWith("<!>");
|
|
3323
|
-
return () => {
|
|
3324
|
-
if (hydrating) {
|
|
3325
|
-
assign_nodes(hydrate_node, null);
|
|
3326
|
-
return hydrate_node;
|
|
3306
|
+
function _create_reset(error) {
|
|
3307
|
+
var did_reset = false;
|
|
3308
|
+
var calling_on_error = false;
|
|
3309
|
+
const reset = () => {
|
|
3310
|
+
if (did_reset) {
|
|
3311
|
+
svelte_boundary_reset_noop();
|
|
3312
|
+
return;
|
|
3327
3313
|
}
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3314
|
+
did_reset = true;
|
|
3315
|
+
if (calling_on_error) svelte_boundary_reset_onerror();
|
|
3316
|
+
if (_classPrivateFieldGet2(_failed_effect, this) !== null) pause_effect(_classPrivateFieldGet2(_failed_effect, this), () => {
|
|
3317
|
+
_classPrivateFieldSet2(_failed_effect, this, null);
|
|
3318
|
+
});
|
|
3319
|
+
_assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
|
|
3320
|
+
_assertClassBrand(_Boundary_brand, this, _render).call(this);
|
|
3321
|
+
});
|
|
3322
|
+
};
|
|
3323
|
+
const invoke_onerror = () => {
|
|
3324
|
+
try {
|
|
3325
|
+
calling_on_error = true;
|
|
3326
|
+
_classPrivateFieldGet2(_props, this).onerror?.(error, reset);
|
|
3327
|
+
calling_on_error = false;
|
|
3328
|
+
} catch (err) {
|
|
3329
|
+
invoke_error_boundary(err, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent);
|
|
3331
3330
|
}
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
assign_nodes(start, end);
|
|
3337
|
-
} else assign_nodes(clone, clone);
|
|
3338
|
-
return clone;
|
|
3331
|
+
};
|
|
3332
|
+
return {
|
|
3333
|
+
reset,
|
|
3334
|
+
invoke_onerror
|
|
3339
3335
|
};
|
|
3340
3336
|
}
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3337
|
+
function _hydrate_pending_content() {
|
|
3338
|
+
const pending = _classPrivateFieldGet2(_props, this).pending;
|
|
3339
|
+
if (!pending) return;
|
|
3340
|
+
this.is_pending = true;
|
|
3341
|
+
_classPrivateFieldSet2(_pending_effect, this, branch(() => pending(_classPrivateFieldGet2(_anchor, this))));
|
|
3342
|
+
queue_micro_task(() => {
|
|
3343
|
+
var fragment = _classPrivateFieldSet2(_offscreen_fragment, this, document.createDocumentFragment());
|
|
3344
|
+
var anchor = create_text();
|
|
3345
|
+
var handled = false;
|
|
3346
|
+
fragment.append(anchor);
|
|
3347
|
+
_classPrivateFieldSet2(_main_effect, this, _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
|
|
3348
|
+
try {
|
|
3349
|
+
return branch(() => _classPrivateFieldGet2(_children, this).call(this, anchor));
|
|
3350
|
+
} catch (error) {
|
|
3351
|
+
try {
|
|
3352
|
+
this.error(error);
|
|
3353
|
+
handled = true;
|
|
3354
|
+
} catch (error) {
|
|
3355
|
+
invoke_error_boundary(error, _classPrivateFieldGet2(_effect, this).parent);
|
|
3356
|
+
}
|
|
3357
|
+
return null;
|
|
3358
|
+
}
|
|
3359
|
+
}));
|
|
3360
|
+
if (_classPrivateFieldGet2(_main_effect, this) === null) {
|
|
3361
|
+
_classPrivateFieldSet2(_offscreen_fragment, this, null);
|
|
3362
|
+
if (handled) _assertClassBrand(_Boundary_brand, this, _resolve).call(this, current_batch);
|
|
3363
|
+
return;
|
|
3362
3364
|
}
|
|
3363
|
-
if (
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
}
|
|
3365
|
+
if (_classPrivateFieldGet2(_pending_count, this) === 0) {
|
|
3366
|
+
_classPrivateFieldGet2(_anchor, this).before(fragment);
|
|
3367
|
+
_classPrivateFieldSet2(_offscreen_fragment, this, null);
|
|
3368
|
+
pause_effect(_classPrivateFieldGet2(_pending_effect, this), () => {
|
|
3369
|
+
_classPrivateFieldSet2(_pending_effect, this, null);
|
|
3370
|
+
});
|
|
3371
|
+
_assertClassBrand(_Boundary_brand, this, _resolve).call(this, current_batch);
|
|
3369
3372
|
}
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3373
|
+
});
|
|
3374
|
+
}
|
|
3375
|
+
function _render() {
|
|
3376
|
+
try {
|
|
3377
|
+
this.is_pending = this.has_pending_snippet();
|
|
3378
|
+
_classPrivateFieldSet2(_pending_count, this, 0);
|
|
3379
|
+
_classPrivateFieldSet2(_local_pending_count, this, 0);
|
|
3380
|
+
_classPrivateFieldSet2(_main_effect, this, branch(() => {
|
|
3381
|
+
_classPrivateFieldGet2(_children, this).call(this, _classPrivateFieldGet2(_anchor, this));
|
|
3382
|
+
}));
|
|
3383
|
+
if (_classPrivateFieldGet2(_pending_count, this) > 0) {
|
|
3384
|
+
var fragment = _classPrivateFieldSet2(_offscreen_fragment, this, document.createDocumentFragment());
|
|
3385
|
+
move_effect(_classPrivateFieldGet2(_main_effect, this), fragment);
|
|
3386
|
+
const pending = _classPrivateFieldGet2(_props, this).pending;
|
|
3387
|
+
_classPrivateFieldSet2(_pending_effect, this, branch(() => pending(_classPrivateFieldGet2(_anchor, this))));
|
|
3388
|
+
} else _assertClassBrand(_Boundary_brand, this, _resolve).call(this, current_batch);
|
|
3389
|
+
} catch (error) {
|
|
3390
|
+
this.error(error);
|
|
3391
|
+
}
|
|
3378
3392
|
}
|
|
3379
3393
|
/**
|
|
3380
|
-
* @param {
|
|
3381
|
-
* @param {number} flags
|
|
3394
|
+
* @param {Batch} batch
|
|
3382
3395
|
*/
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3396
|
+
function _resolve(batch) {
|
|
3397
|
+
this.is_pending = false;
|
|
3398
|
+
batch.transfer_effects(_classPrivateFieldGet2(_dirty_effects, this), _classPrivateFieldGet2(_maybe_dirty_effects, this));
|
|
3386
3399
|
}
|
|
3387
3400
|
/**
|
|
3388
|
-
*
|
|
3389
|
-
*
|
|
3390
|
-
* @param {Text | Comment | Element} anchor
|
|
3391
|
-
* @param {DocumentFragment | Element} dom
|
|
3401
|
+
* @template T
|
|
3402
|
+
* @param {() => T} fn
|
|
3392
3403
|
*/
|
|
3393
|
-
function
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3404
|
+
function _run(fn) {
|
|
3405
|
+
var previous_effect = active_effect;
|
|
3406
|
+
var previous_reaction = active_reaction;
|
|
3407
|
+
var previous_ctx = component_context;
|
|
3408
|
+
set_active_effect(_classPrivateFieldGet2(_effect, this));
|
|
3409
|
+
set_active_reaction(_classPrivateFieldGet2(_effect, this));
|
|
3410
|
+
set_component_context(_classPrivateFieldGet2(_effect, this).ctx);
|
|
3411
|
+
try {
|
|
3412
|
+
Batch.ensure();
|
|
3413
|
+
return fn();
|
|
3414
|
+
} finally {
|
|
3415
|
+
set_active_effect(previous_effect);
|
|
3416
|
+
set_active_reaction(previous_reaction);
|
|
3417
|
+
set_component_context(previous_ctx);
|
|
3399
3418
|
}
|
|
3400
|
-
if (anchor === null) return;
|
|
3401
|
-
anchor.before(dom);
|
|
3402
3419
|
}
|
|
3403
3420
|
/**
|
|
3404
|
-
*
|
|
3405
|
-
*
|
|
3406
|
-
*
|
|
3407
|
-
*
|
|
3408
|
-
* - they happen often
|
|
3409
|
-
* - they apply to mobile which is generally less performant
|
|
3410
|
-
* we're marking them as passive by default for other elements, too.
|
|
3421
|
+
* Updates the pending count associated with the currently visible pending snippet,
|
|
3422
|
+
* if any, such that we can replace the snippet with content once work is done
|
|
3423
|
+
* @param {1 | -1} d
|
|
3424
|
+
* @param {Batch} batch
|
|
3411
3425
|
*/
|
|
3412
|
-
|
|
3426
|
+
function _update_pending_count(d, batch) {
|
|
3427
|
+
if (!this.has_pending_snippet()) {
|
|
3428
|
+
if (this.parent) {
|
|
3429
|
+
var _this$parent;
|
|
3430
|
+
_assertClassBrand(_Boundary_brand, _this$parent = this.parent, _update_pending_count).call(_this$parent, d, batch);
|
|
3431
|
+
}
|
|
3432
|
+
return;
|
|
3433
|
+
}
|
|
3434
|
+
_classPrivateFieldSet2(_pending_count, this, _classPrivateFieldGet2(_pending_count, this) + d);
|
|
3435
|
+
if (_classPrivateFieldGet2(_pending_count, this) === 0) {
|
|
3436
|
+
_assertClassBrand(_Boundary_brand, this, _resolve).call(this, batch);
|
|
3437
|
+
if (_classPrivateFieldGet2(_pending_effect, this)) pause_effect(_classPrivateFieldGet2(_pending_effect, this), () => {
|
|
3438
|
+
_classPrivateFieldSet2(_pending_effect, this, null);
|
|
3439
|
+
});
|
|
3440
|
+
if (_classPrivateFieldGet2(_offscreen_fragment, this)) {
|
|
3441
|
+
_classPrivateFieldGet2(_anchor, this).before(_classPrivateFieldGet2(_offscreen_fragment, this));
|
|
3442
|
+
_classPrivateFieldSet2(_offscreen_fragment, this, null);
|
|
3443
|
+
}
|
|
3444
|
+
}
|
|
3445
|
+
}
|
|
3413
3446
|
/**
|
|
3414
|
-
*
|
|
3415
|
-
* @param {string} name
|
|
3447
|
+
* @param {unknown} error
|
|
3416
3448
|
*/
|
|
3417
|
-
function
|
|
3418
|
-
|
|
3449
|
+
function _handle_error(error) {
|
|
3450
|
+
if (_classPrivateFieldGet2(_main_effect, this)) {
|
|
3451
|
+
destroy_effect(_classPrivateFieldGet2(_main_effect, this));
|
|
3452
|
+
_classPrivateFieldSet2(_main_effect, this, null);
|
|
3453
|
+
}
|
|
3454
|
+
if (_classPrivateFieldGet2(_pending_effect, this)) {
|
|
3455
|
+
destroy_effect(_classPrivateFieldGet2(_pending_effect, this));
|
|
3456
|
+
_classPrivateFieldSet2(_pending_effect, this, null);
|
|
3457
|
+
}
|
|
3458
|
+
if (_classPrivateFieldGet2(_failed_effect, this)) {
|
|
3459
|
+
destroy_effect(_classPrivateFieldGet2(_failed_effect, this));
|
|
3460
|
+
_classPrivateFieldSet2(_failed_effect, this, null);
|
|
3461
|
+
}
|
|
3462
|
+
if (hydrating) {
|
|
3463
|
+
set_hydrate_node(_classPrivateFieldGet2(_hydrate_open, this));
|
|
3464
|
+
next();
|
|
3465
|
+
set_hydrate_node(skip_nodes());
|
|
3466
|
+
}
|
|
3467
|
+
let failed = _classPrivateFieldGet2(_props, this).failed;
|
|
3468
|
+
/** @param {unknown} transformed_error */
|
|
3469
|
+
const handle_error_result = (transformed_error) => {
|
|
3470
|
+
const { reset, invoke_onerror } = _assertClassBrand(_Boundary_brand, this, _create_reset).call(this, transformed_error);
|
|
3471
|
+
invoke_onerror();
|
|
3472
|
+
if (failed) _classPrivateFieldSet2(_failed_effect, this, _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
|
|
3473
|
+
try {
|
|
3474
|
+
return branch(() => {
|
|
3475
|
+
var effect = active_effect;
|
|
3476
|
+
effect.b = this;
|
|
3477
|
+
effect.f |= 128;
|
|
3478
|
+
failed(_classPrivateFieldGet2(_anchor, this), () => transformed_error, () => reset);
|
|
3479
|
+
});
|
|
3480
|
+
} catch (error) {
|
|
3481
|
+
invoke_error_boundary(error, _classPrivateFieldGet2(_effect, this).parent);
|
|
3482
|
+
return null;
|
|
3483
|
+
}
|
|
3484
|
+
}));
|
|
3485
|
+
};
|
|
3486
|
+
queue_micro_task(() => {
|
|
3487
|
+
/** @type {unknown} */
|
|
3488
|
+
var result;
|
|
3489
|
+
try {
|
|
3490
|
+
result = this.transform_error(error);
|
|
3491
|
+
} catch (e) {
|
|
3492
|
+
invoke_error_boundary(e, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent);
|
|
3493
|
+
return;
|
|
3494
|
+
}
|
|
3495
|
+
if (result !== null && typeof result === "object" && typeof result.then === "function")
|
|
3496
|
+
/** @type {any} */ result.then(
|
|
3497
|
+
handle_error_result,
|
|
3498
|
+
/** @param {unknown} e */
|
|
3499
|
+
(e) => invoke_error_boundary(e, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent)
|
|
3500
|
+
);
|
|
3501
|
+
else handle_error_result(result);
|
|
3502
|
+
});
|
|
3419
3503
|
}
|
|
3420
3504
|
/**
|
|
3421
3505
|
* @param {Element} text
|
|
@@ -3423,9 +3507,8 @@ function is_passive_event(name) {
|
|
|
3423
3507
|
* @returns {void}
|
|
3424
3508
|
*/
|
|
3425
3509
|
function set_text(text, value) {
|
|
3426
|
-
var _text;
|
|
3427
3510
|
var str = value == null ? "" : typeof value === "object" ? `${value}` : value;
|
|
3428
|
-
if (str !== (
|
|
3511
|
+
if (str !== (text[TEXT_CACHE] ?? (text[TEXT_CACHE] = text.nodeValue))) {
|
|
3429
3512
|
/** @type {any} */ text[TEXT_CACHE] = str;
|
|
3430
3513
|
text.nodeValue = `${str}`;
|
|
3431
3514
|
}
|
|
@@ -3520,7 +3603,7 @@ function _mount(Component, { target, anchor, props = {}, events, context, intro
|
|
|
3520
3603
|
if (events)
|
|
3521
3604
|
/** @type {any} */ props.$$events = events;
|
|
3522
3605
|
if (hydrating) assign_nodes(anchor_node, null);
|
|
3523
|
-
component = Component(anchor_node, props) ||
|
|
3606
|
+
component = Component(anchor_node, props) || mark_as_component();
|
|
3524
3607
|
if (hydrating) {
|
|
3525
3608
|
/** @type {Effect & { nodes: EffectNodes }} */ active_effect.nodes.end = hydrate_node;
|
|
3526
3609
|
if (hydrate_node === null || hydrate_node.nodeType !== 8 || hydrate_node.data !== "]") {
|
|
@@ -3606,7 +3689,7 @@ function unmount(component, options) {
|
|
|
3606
3689
|
return Promise.resolve();
|
|
3607
3690
|
}
|
|
3608
3691
|
//#endregion
|
|
3609
|
-
//#region ../../../node_modules/.bun/svelte@5.
|
|
3692
|
+
//#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/blocks/branches.js
|
|
3610
3693
|
/** @import { Effect, TemplateNode } from '#client' */
|
|
3611
3694
|
var _batches = /* @__PURE__ */ new WeakMap();
|
|
3612
3695
|
var _onscreen = /* @__PURE__ */ new WeakMap();
|
|
@@ -3763,7 +3846,7 @@ function init_update_callbacks(context) {
|
|
|
3763
3846
|
});
|
|
3764
3847
|
}
|
|
3765
3848
|
//#endregion
|
|
3766
|
-
//#region ../../../node_modules/.bun/svelte@5.
|
|
3849
|
+
//#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/blocks/if.js
|
|
3767
3850
|
/** @import { TemplateNode } from '#client' */
|
|
3768
3851
|
/**
|
|
3769
3852
|
* @param {TemplateNode} node
|
|
@@ -3869,13 +3952,14 @@ function html(node, get_value, is_controlled = false, svg = false, mathml = fals
|
|
|
3869
3952
|
});
|
|
3870
3953
|
}
|
|
3871
3954
|
//#endregion
|
|
3872
|
-
//#region ../../../node_modules/.bun/svelte@5.
|
|
3955
|
+
//#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/css.js
|
|
3873
3956
|
/**
|
|
3874
3957
|
* @param {Node} anchor
|
|
3875
3958
|
* @param {{ hash: string, code: string }} css
|
|
3876
3959
|
*/
|
|
3877
3960
|
function append_styles$1(anchor, css) {
|
|
3878
3961
|
effect(() => {
|
|
3962
|
+
anchor = active_effect?.parent?.nodes?.start ?? anchor;
|
|
3879
3963
|
var root = anchor.getRootNode();
|
|
3880
3964
|
var target = root.host ? root : /** @type {Document} */ root.head ?? root.ownerDocument.head;
|
|
3881
3965
|
if (!target.querySelector("#" + css.hash)) {
|
|
@@ -3887,7 +3971,7 @@ function append_styles$1(anchor, css) {
|
|
|
3887
3971
|
});
|
|
3888
3972
|
}
|
|
3889
3973
|
//#endregion
|
|
3890
|
-
//#region ../../../node_modules/.bun/svelte@5.
|
|
3974
|
+
//#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/shared/attributes.js
|
|
3891
3975
|
/**
|
|
3892
3976
|
*
|
|
3893
3977
|
* @param {Record<string,any>} styles
|
|
@@ -3927,7 +4011,7 @@ function to_style(value, styles) {
|
|
|
3927
4011
|
important_styles = styles[1];
|
|
3928
4012
|
} else normal_styles = styles;
|
|
3929
4013
|
if (value) {
|
|
3930
|
-
value = String(value).replaceAll(
|
|
4014
|
+
value = String(value).replaceAll(/\/\*.*?\*\//g, "").trim();
|
|
3931
4015
|
/** @type {boolean | '"' | "'"} */
|
|
3932
4016
|
var in_str = false;
|
|
3933
4017
|
var in_apo = 0;
|
|
@@ -3973,7 +4057,7 @@ function to_style(value, styles) {
|
|
|
3973
4057
|
return value == null ? null : String(value);
|
|
3974
4058
|
}
|
|
3975
4059
|
//#endregion
|
|
3976
|
-
//#region ../../../node_modules/.bun/svelte@5.
|
|
4060
|
+
//#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/elements/style.js
|
|
3977
4061
|
/**
|
|
3978
4062
|
* @param {Element & ElementCSSInlineStyle} dom
|
|
3979
4063
|
* @param {Record<string, any>} prev
|
|
@@ -4007,7 +4091,7 @@ function set_style(dom, value, prev_styles, next_styles) {
|
|
|
4007
4091
|
return next_styles;
|
|
4008
4092
|
}
|
|
4009
4093
|
//#endregion
|
|
4010
|
-
//#region ../../../node_modules/.bun/svelte@5.
|
|
4094
|
+
//#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/elements/attributes.js
|
|
4011
4095
|
/** @import { Blocker, Effect } from '#client' */
|
|
4012
4096
|
var IS_CUSTOM_ELEMENT = Symbol("is custom element");
|
|
4013
4097
|
var IS_HTML = Symbol("is html");
|
|
@@ -4030,7 +4114,7 @@ function set_attribute(element, attribute, value, skip_warning) {
|
|
|
4030
4114
|
if (attributes[attribute] === (attributes[attribute] = value)) return;
|
|
4031
4115
|
if (attribute === "loading") element[LOADING_ATTR_SYMBOL] = value;
|
|
4032
4116
|
if (value == null) element.removeAttribute(attribute);
|
|
4033
|
-
else if (typeof value !== "string" && get_setters(element).
|
|
4117
|
+
else if (typeof value !== "string" && get_setters(element).has(attribute)) element[attribute] = value;
|
|
4034
4118
|
else element.setAttribute(attribute, value);
|
|
4035
4119
|
}
|
|
4036
4120
|
/**
|
|
@@ -4038,32 +4122,31 @@ function set_attribute(element, attribute, value, skip_warning) {
|
|
|
4038
4122
|
* @param {Element} element
|
|
4039
4123
|
*/
|
|
4040
4124
|
function get_attributes(element) {
|
|
4041
|
-
|
|
4042
|
-
return (_element = element)[ATTRIBUTES_CACHE] ?? (_element[ATTRIBUTES_CACHE] = {
|
|
4125
|
+
return element[ATTRIBUTES_CACHE] ?? (element[ATTRIBUTES_CACHE] = {
|
|
4043
4126
|
[IS_CUSTOM_ELEMENT]: element.nodeName.includes("-"),
|
|
4044
4127
|
[IS_HTML]: element.namespaceURI === "http://www.w3.org/1999/xhtml"
|
|
4045
4128
|
});
|
|
4046
4129
|
}
|
|
4047
|
-
/** @type {Map<string, string
|
|
4130
|
+
/** @type {Map<string, Set<string>>} */
|
|
4048
4131
|
var setters_cache = /* @__PURE__ */ new Map();
|
|
4049
4132
|
/** @param {Element} element */
|
|
4050
4133
|
function get_setters(element) {
|
|
4051
4134
|
var cache_key = element.getAttribute("is") || element.nodeName;
|
|
4052
4135
|
var setters = setters_cache.get(cache_key);
|
|
4053
4136
|
if (setters) return setters;
|
|
4054
|
-
setters_cache.set(cache_key, setters =
|
|
4137
|
+
setters_cache.set(cache_key, setters = /* @__PURE__ */ new Set());
|
|
4055
4138
|
var descriptors;
|
|
4056
4139
|
var proto = element;
|
|
4057
4140
|
var element_proto = Element.prototype;
|
|
4058
4141
|
while (element_proto !== proto) {
|
|
4059
4142
|
descriptors = get_descriptors(proto);
|
|
4060
|
-
for (var key in descriptors) if (descriptors[key].set && key !== "innerHTML" && key !== "textContent" && key !== "innerText") setters.
|
|
4143
|
+
for (var key in descriptors) if (descriptors[key].set && key !== "innerHTML" && key !== "textContent" && key !== "innerText") setters.add(key);
|
|
4061
4144
|
proto = get_prototype_of(proto);
|
|
4062
4145
|
}
|
|
4063
4146
|
return setters;
|
|
4064
4147
|
}
|
|
4065
4148
|
//#endregion
|
|
4066
|
-
//#region ../../../node_modules/.bun/svelte@5.
|
|
4149
|
+
//#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/elements/bindings/size.js
|
|
4067
4150
|
var _ResizeObserverSingleton;
|
|
4068
4151
|
var _listeners = /* @__PURE__ */ new WeakMap();
|
|
4069
4152
|
var _observer = /* @__PURE__ */ new WeakMap();
|
|
@@ -4115,7 +4198,7 @@ function _getObserver() {
|
|
|
4115
4198
|
}
|
|
4116
4199
|
_defineProperty(ResizeObserverSingleton, "entries", /* @__PURE__ */ new WeakMap());
|
|
4117
4200
|
//#endregion
|
|
4118
|
-
//#region ../../../node_modules/.bun/svelte@5.
|
|
4201
|
+
//#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/elements/bindings/this.js
|
|
4119
4202
|
/** @import { ComponentContext, Effect } from '#client' */
|
|
4120
4203
|
/**
|
|
4121
4204
|
* @param {any} bound_value
|
|
@@ -4133,7 +4216,7 @@ function is_bound_this(bound_value, element_or_component) {
|
|
|
4133
4216
|
* returns all the parts of the each block context that are used in the expression
|
|
4134
4217
|
* @returns {void}
|
|
4135
4218
|
*/
|
|
4136
|
-
function bind_this(element_or_component =
|
|
4219
|
+
function bind_this(element_or_component = mark_as_component(), update, get_value, get_parts) {
|
|
4137
4220
|
var component_effect = component_context.r;
|
|
4138
4221
|
var parent = active_effect;
|
|
4139
4222
|
effect(() => {
|
|
@@ -4167,7 +4250,7 @@ function bind_this(element_or_component = {}, update, get_value, get_parts) {
|
|
|
4167
4250
|
return element_or_component;
|
|
4168
4251
|
}
|
|
4169
4252
|
//#endregion
|
|
4170
|
-
//#region ../../../node_modules/.bun/svelte@5.
|
|
4253
|
+
//#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/legacy/legacy-client.js
|
|
4171
4254
|
/** @import { ComponentConstructorOptions, ComponentType, SvelteComponent, Component } from 'svelte' */
|
|
4172
4255
|
/**
|
|
4173
4256
|
* Takes the same options as a Svelte 4 component and the component function and returns a Svelte 4 compatible component.
|
|
@@ -4286,7 +4369,7 @@ var Svelte4Component = class {
|
|
|
4286
4369
|
}
|
|
4287
4370
|
};
|
|
4288
4371
|
//#endregion
|
|
4289
|
-
//#region ../../../node_modules/.bun/svelte@5.
|
|
4372
|
+
//#region ../../../node_modules/.bun/svelte@5.57.0/node_modules/svelte/src/internal/client/dom/elements/custom-element.js
|
|
4290
4373
|
/**
|
|
4291
4374
|
* @typedef {Object} CustomElementPropDefinition
|
|
4292
4375
|
* @property {string} [attribute]
|
|
@@ -4572,7 +4655,8 @@ function create_custom_element(Component, props_definition, slots, exports, shad
|
|
|
4572
4655
|
}
|
|
4573
4656
|
//#endregion
|
|
4574
4657
|
//#region ../../lib-svelte/delivery-events/dist/index2.js
|
|
4575
|
-
var _e
|
|
4658
|
+
var _e;
|
|
4659
|
+
var _e2;
|
|
4576
4660
|
var e = (_e = class e extends CustomEvent {
|
|
4577
4661
|
constructor(t, n, r) {
|
|
4578
4662
|
super(e.TYPE, {
|
|
@@ -4585,7 +4669,8 @@ var e = (_e = class e extends CustomEvent {
|
|
|
4585
4669
|
}
|
|
4586
4670
|
}), this.component = t, this.complete = n;
|
|
4587
4671
|
}
|
|
4588
|
-
}, _e.TYPE = "model-set", _e)
|
|
4672
|
+
}, _e.TYPE = "model-set", _e);
|
|
4673
|
+
var t$1 = (_e2 = class e extends CustomEvent {
|
|
4589
4674
|
constructor(t, n) {
|
|
4590
4675
|
super(e.TYPE, {
|
|
4591
4676
|
bubbles: !0,
|
|
@@ -4619,12 +4704,6 @@ function r({ sourceEl: t, fallbackSelector: r, component: i, complete: a, sessio
|
|
|
4619
4704
|
let s = n(t, { fallbackSelector: r });
|
|
4620
4705
|
return s ? typeof s.onSessionChange == "function" ? (s.onSessionChange(o), s) : (s.dispatchEvent(new t$1(i, a)), s) : null;
|
|
4621
4706
|
}
|
|
4622
|
-
new Set([
|
|
4623
|
-
"$$slots",
|
|
4624
|
-
"$$events",
|
|
4625
|
-
"$$legacy",
|
|
4626
|
-
"$$host"
|
|
4627
|
-
]);
|
|
4628
4707
|
var root = /* @__PURE__ */ from_html(`<div class="mb-4 prose"></div>`);
|
|
4629
4708
|
var root_1 = /* @__PURE__ */ from_svg(`<svg style="width: 25px; height: 25px;" preserveAspectRatio="xMinYMin meet" version="1.1" viewBox="-283 359 34 35"><circle cx="-266" cy="375.9" r="14" fill="#bce2ff"></circle><path d="M-280.5,375.9c0-8,6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5s-6.5,14.5-14.5,14.5S-280.5,383.9-280.5,375.9z M-279.5,375.9c0,7.4,6.1,13.5,13.5,13.5c7.4,0,13.5-6.1,13.5-13.5s-6.1-13.5-13.5-13.5C-273.4,362.4-279.5,368.5-279.5,375.9z" fill="#bce2ff"></path><polygon points="-265.4,383.1 -258.6,377.2 -261.2,374.2 -264.3,376.9 -268.9,368.7 -272.4,370.6" fill="#1a9cff"></polygon></svg>`);
|
|
4630
4709
|
var root_2 = /* @__PURE__ */ from_svg(`<svg style="width: 25px; height: 25px;" preserveAspectRatio="xMinYMin meet" version="1.1" viewBox="-129.5 127 34 35"><path style="fill: #D0CAC5; stroke: #E6E3E0; stroke-width: 0.75; stroke-miterlimit: 10;" d="M-112.9,160.4c-8.5,0-15.5-6.9-15.5-15.5c0-8.5,6.9-15.5,15.5-15.5s15.5,6.9,15.5,15.5 C-97.4,153.5-104.3,160.4-112.9,160.4z"></path><path style="fill: #B3ABA4; stroke: #CDC7C2; stroke-width: 0.5; stroke-miterlimit: 10;" d="M-113.2,159c-8,0-14.5-6.5-14.5-14.5s6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5S-105.2,159-113.2,159z"></path><circle cx="-114.2" cy="143.5" r="14" fill="white"></circle><path d="M-114.2,158c-8,0-14.5-6.5-14.5-14.5s6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5S-106.2,158-114.2,158z M-114.2,130c-7.4,0-13.5,6.1-13.5,13.5s6.1,13.5,13.5,13.5s13.5-6.1,13.5-13.5S-106.8,130-114.2,130z" fill="#bce2ff"></path><polygon points="-114.8,150.7 -121.6,144.8 -119,141.8 -115.9,144.5 -111.3,136.3 -107.8,138.2" fill="#1a9cff"></polygon></svg>`);
|
|
@@ -4708,9 +4787,7 @@ function SimpleCloze($$anchor, $$props) {
|
|
|
4708
4787
|
if (get(showCorrectAnswer)) $$render(consequent_1);
|
|
4709
4788
|
else $$render(alternate, -1);
|
|
4710
4789
|
});
|
|
4711
|
-
var
|
|
4712
|
-
var text = child(span);
|
|
4713
|
-
reset(span);
|
|
4790
|
+
var text = only_child(sibling(node_2, 2));
|
|
4714
4791
|
reset(button);
|
|
4715
4792
|
template_effect(() => {
|
|
4716
4793
|
set_attribute(button, "aria-pressed", get(showCorrectAnswer));
|