@sentry/rrweb-player 2.43.2 → 2.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/rrweb-player.cjs +1579 -1396
- package/dist/rrweb-player.cjs.map +1 -1
- package/dist/rrweb-player.js +1579 -1396
- package/dist/rrweb-player.js.map +1 -1
- package/dist/rrweb-player.umd.cjs +1487 -1314
- package/dist/rrweb-player.umd.cjs.map +4 -4
- package/dist/rrweb-player.umd.min.cjs +12 -12
- package/dist/rrweb-player.umd.min.cjs.map +4 -4
- package/dist/style.css +17 -11
- package/dist/style.min.css.map +2 -2
- package/package.json +5 -5
package/dist/rrweb-player.js
CHANGED
|
@@ -9,7 +9,7 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
|
|
|
9
9
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
10
10
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
11
11
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
12
|
-
var
|
|
12
|
+
var _anchor, _hydrate_open, _props, _children, _effect, _main_effect, _pending_effect, _failed_effect, _offscreen_fragment, _local_pending_count, _pending_count, _pending_count_update_queued, _dirty_effects, _maybe_dirty_effects, _effect_pending, _effect_pending_subscriber, _Boundary_instances, hydrate_resolved_content_fn, hydrate_failed_content_fn, create_reset_fn, hydrate_pending_content_fn, render_fn, resolve_fn, run_fn, update_pending_count_fn, handle_error_fn, _started, _prev, _next, _commit_callbacks, _discard_callbacks, _pending, _blocking_pending, _deferred, _roots, _new_effects, _dirty_effects2, _maybe_dirty_effects2, _skipped_branches, _unskipped_branches, _decrement_queued, _Batch_instances, is_deferred_fn, process_fn, traverse_fn, find_earlier_batch_fn, merge_fn, defer_effects_fn, commit_fn, unlink_fn, _events, _instance, _a2, _batches, _onscreen, _offscreen, _outroing, _transition, _commit, _discard;
|
|
13
13
|
const DERIVED = 1 << 1;
|
|
14
14
|
const EFFECT = 1 << 2;
|
|
15
15
|
const RENDER_EFFECT = 1 << 3;
|
|
@@ -39,6 +39,11 @@ const ERROR_VALUE = 1 << 23;
|
|
|
39
39
|
const STATE_SYMBOL = Symbol("$state");
|
|
40
40
|
const LEGACY_PROPS = Symbol("legacy props");
|
|
41
41
|
const LOADING_ATTR_SYMBOL = Symbol("");
|
|
42
|
+
const ATTRIBUTES_CACHE = Symbol("attributes");
|
|
43
|
+
const CLASS_CACHE = Symbol("class");
|
|
44
|
+
const STYLE_CACHE = Symbol("style");
|
|
45
|
+
const TEXT_CACHE = Symbol("text");
|
|
46
|
+
const FORM_RESET_HANDLER = Symbol("form reset");
|
|
42
47
|
const STALE_REACTION = new class StaleReactionError extends Error {
|
|
43
48
|
constructor() {
|
|
44
49
|
super(...arguments);
|
|
@@ -168,7 +173,7 @@ const HYDRATION_START_ELSE = "[!";
|
|
|
168
173
|
const HYDRATION_START_FAILED = "[?";
|
|
169
174
|
const HYDRATION_END = "]";
|
|
170
175
|
const HYDRATION_ERROR = {};
|
|
171
|
-
const UNINITIALIZED = Symbol();
|
|
176
|
+
const UNINITIALIZED = Symbol("uninitialized");
|
|
172
177
|
const NAMESPACE_HTML = "http://www.w3.org/1999/xhtml";
|
|
173
178
|
let component_context = null;
|
|
174
179
|
function set_component_context(context) {
|
|
@@ -232,6 +237,11 @@ function flush_tasks() {
|
|
|
232
237
|
run_micro_tasks();
|
|
233
238
|
}
|
|
234
239
|
}
|
|
240
|
+
function derived_inert() {
|
|
241
|
+
{
|
|
242
|
+
console.warn(`https://svelte.dev/e/derived_inert`);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
235
245
|
function hydration_mismatch(location) {
|
|
236
246
|
{
|
|
237
247
|
console.warn(`https://svelte.dev/e/hydration_mismatch`);
|
|
@@ -517,14 +527,13 @@ function init_operations() {
|
|
|
517
527
|
first_child_getter = get_descriptor(node_prototype, "firstChild").get;
|
|
518
528
|
next_sibling_getter = get_descriptor(node_prototype, "nextSibling").get;
|
|
519
529
|
if (is_extensible(element_prototype)) {
|
|
520
|
-
element_prototype
|
|
521
|
-
element_prototype
|
|
522
|
-
element_prototype
|
|
523
|
-
element_prototype.__style = void 0;
|
|
530
|
+
element_prototype[CLASS_CACHE] = void 0;
|
|
531
|
+
element_prototype[ATTRIBUTES_CACHE] = null;
|
|
532
|
+
element_prototype[STYLE_CACHE] = void 0;
|
|
524
533
|
element_prototype.__e = void 0;
|
|
525
534
|
}
|
|
526
535
|
if (is_extensible(text_prototype)) {
|
|
527
|
-
text_prototype
|
|
536
|
+
text_prototype[TEXT_CACHE] = void 0;
|
|
528
537
|
}
|
|
529
538
|
}
|
|
530
539
|
function create_text(value = "") {
|
|
@@ -623,11 +632,12 @@ function should_defer_append() {
|
|
|
623
632
|
return false;
|
|
624
633
|
}
|
|
625
634
|
function create_element(tag, namespace, is) {
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
635
|
+
{
|
|
636
|
+
return (
|
|
637
|
+
/** @type {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element} */
|
|
638
|
+
is ? document.createElement(tag, { is }) : document.createElement(tag)
|
|
639
|
+
);
|
|
640
|
+
}
|
|
631
641
|
}
|
|
632
642
|
function merge_text_nodes(text) {
|
|
633
643
|
if (
|
|
@@ -656,6 +666,9 @@ function handle_error(error) {
|
|
|
656
666
|
invoke_error_boundary(error, effect2);
|
|
657
667
|
}
|
|
658
668
|
function invoke_error_boundary(error, effect2) {
|
|
669
|
+
if (effect2 !== null && (effect2.f & DESTROYED) !== 0) {
|
|
670
|
+
return;
|
|
671
|
+
}
|
|
659
672
|
while (effect2 !== null) {
|
|
660
673
|
if ((effect2.f & BOUNDARY_EFFECT) !== 0) {
|
|
661
674
|
if ((effect2.f & REACTION_RAN) === 0) {
|
|
@@ -715,1421 +728,1597 @@ function capture_store_binding(fn) {
|
|
|
715
728
|
is_store_binding = previous_is_store_binding;
|
|
716
729
|
}
|
|
717
730
|
}
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
const
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
* The values of any signals (sources and deriveds) that are updated in this batch _before_ those updates took place.
|
|
741
|
-
* They keys of this map are identical to `this.#current`
|
|
742
|
-
* @type {Map<Value, any>}
|
|
743
|
-
*/
|
|
744
|
-
__publicField(this, "previous", /* @__PURE__ */ new Map());
|
|
745
|
-
/**
|
|
746
|
-
* When the batch is committed (and the DOM is updated), we need to remove old branches
|
|
747
|
-
* and append new ones by calling the functions added inside (if/each/key/etc) blocks
|
|
748
|
-
* @type {Set<(batch: Batch) => void>}
|
|
749
|
-
*/
|
|
750
|
-
__privateAdd(this, _commit_callbacks, /* @__PURE__ */ new Set());
|
|
751
|
-
/**
|
|
752
|
-
* If a fork is discarded, we need to destroy any effects that are no longer needed
|
|
753
|
-
* @type {Set<(batch: Batch) => void>}
|
|
754
|
-
*/
|
|
755
|
-
__privateAdd(this, _discard_callbacks, /* @__PURE__ */ new Set());
|
|
756
|
-
/**
|
|
757
|
-
* Async effects that are currently in flight
|
|
758
|
-
* @type {Map<Effect, number>}
|
|
759
|
-
*/
|
|
760
|
-
__privateAdd(this, _pending, /* @__PURE__ */ new Map());
|
|
761
|
-
/**
|
|
762
|
-
* Async effects that are currently in flight, _not_ inside a pending boundary
|
|
763
|
-
* @type {Map<Effect, number>}
|
|
764
|
-
*/
|
|
765
|
-
__privateAdd(this, _blocking_pending, /* @__PURE__ */ new Map());
|
|
766
|
-
/**
|
|
767
|
-
* A deferred that resolves when the batch is committed, used with `settled()`
|
|
768
|
-
* TODO replace with Promise.withResolvers once supported widely enough
|
|
769
|
-
* @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}
|
|
770
|
-
*/
|
|
771
|
-
__privateAdd(this, _deferred, null);
|
|
772
|
-
/**
|
|
773
|
-
* The root effects that need to be flushed
|
|
774
|
-
* @type {Effect[]}
|
|
775
|
-
*/
|
|
776
|
-
__privateAdd(this, _roots, []);
|
|
777
|
-
/**
|
|
778
|
-
* Effects created while this batch was active.
|
|
779
|
-
* @type {Effect[]}
|
|
780
|
-
*/
|
|
781
|
-
__privateAdd(this, _new_effects, []);
|
|
782
|
-
/**
|
|
783
|
-
* Deferred effects (which run after async work has completed) that are DIRTY
|
|
784
|
-
* @type {Set<Effect>}
|
|
785
|
-
*/
|
|
786
|
-
__privateAdd(this, _dirty_effects, /* @__PURE__ */ new Set());
|
|
787
|
-
/**
|
|
788
|
-
* Deferred effects that are MAYBE_DIRTY
|
|
789
|
-
* @type {Set<Effect>}
|
|
790
|
-
*/
|
|
791
|
-
__privateAdd(this, _maybe_dirty_effects, /* @__PURE__ */ new Set());
|
|
792
|
-
/**
|
|
793
|
-
* A map of branches that still exist, but will be destroyed when this batch
|
|
794
|
-
* is committed — we skip over these during `process`.
|
|
795
|
-
* The value contains child effects that were dirty/maybe_dirty before being reset,
|
|
796
|
-
* so they can be rescheduled if the branch survives.
|
|
797
|
-
* @type {Map<Effect, { d: Effect[], m: Effect[] }>}
|
|
798
|
-
*/
|
|
799
|
-
__privateAdd(this, _skipped_branches, /* @__PURE__ */ new Map());
|
|
800
|
-
/**
|
|
801
|
-
* Inverse of #skipped_branches which we need to tell prior batches to unskip them when committing
|
|
802
|
-
* @type {Set<Effect>}
|
|
803
|
-
*/
|
|
804
|
-
__privateAdd(this, _unskipped_branches, /* @__PURE__ */ new Set());
|
|
805
|
-
__publicField(this, "is_fork", false);
|
|
806
|
-
__privateAdd(this, _decrement_queued, false);
|
|
807
|
-
/** @type {Set<Batch>} */
|
|
808
|
-
__privateAdd(this, _blockers, /* @__PURE__ */ new Set());
|
|
809
|
-
}
|
|
810
|
-
/**
|
|
811
|
-
* Add an effect to the #skipped_branches map and reset its children
|
|
812
|
-
* @param {Effect} effect
|
|
813
|
-
*/
|
|
814
|
-
skip_effect(effect2) {
|
|
815
|
-
if (!__privateGet(this, _skipped_branches).has(effect2)) {
|
|
816
|
-
__privateGet(this, _skipped_branches).set(effect2, { d: [], m: [] });
|
|
817
|
-
}
|
|
818
|
-
__privateGet(this, _unskipped_branches).delete(effect2);
|
|
819
|
-
}
|
|
820
|
-
/**
|
|
821
|
-
* Remove an effect from the #skipped_branches map and reschedule
|
|
822
|
-
* any tracked dirty/maybe_dirty child effects
|
|
823
|
-
* @param {Effect} effect
|
|
824
|
-
* @param {(e: Effect) => void} callback
|
|
825
|
-
*/
|
|
826
|
-
unskip_effect(effect2, callback = (e2) => this.schedule(e2)) {
|
|
827
|
-
var tracked = __privateGet(this, _skipped_branches).get(effect2);
|
|
828
|
-
if (tracked) {
|
|
829
|
-
__privateGet(this, _skipped_branches).delete(effect2);
|
|
830
|
-
for (var e2 of tracked.d) {
|
|
831
|
-
set_signal_status(e2, DIRTY);
|
|
832
|
-
callback(e2);
|
|
833
|
-
}
|
|
834
|
-
for (e2 of tracked.m) {
|
|
835
|
-
set_signal_status(e2, MAYBE_DIRTY);
|
|
836
|
-
callback(e2);
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
|
-
__privateGet(this, _unskipped_branches).add(effect2);
|
|
840
|
-
}
|
|
841
|
-
/**
|
|
842
|
-
* Associate a change to a given source with the current
|
|
843
|
-
* batch, noting its previous and current values
|
|
844
|
-
* @param {Value} source
|
|
845
|
-
* @param {any} value
|
|
846
|
-
* @param {boolean} [is_derived]
|
|
847
|
-
*/
|
|
848
|
-
capture(source2, value, is_derived = false) {
|
|
849
|
-
if (source2.v !== UNINITIALIZED && !this.previous.has(source2)) {
|
|
850
|
-
this.previous.set(source2, source2.v);
|
|
851
|
-
}
|
|
852
|
-
if ((source2.f & ERROR_VALUE) === 0) {
|
|
853
|
-
this.current.set(source2, [value, is_derived]);
|
|
854
|
-
batch_values?.set(source2, value);
|
|
855
|
-
}
|
|
856
|
-
if (!this.is_fork) {
|
|
857
|
-
source2.v = value;
|
|
858
|
-
}
|
|
731
|
+
let listening_to_form_reset = false;
|
|
732
|
+
function add_form_reset_listener() {
|
|
733
|
+
if (!listening_to_form_reset) {
|
|
734
|
+
listening_to_form_reset = true;
|
|
735
|
+
document.addEventListener(
|
|
736
|
+
"reset",
|
|
737
|
+
(evt) => {
|
|
738
|
+
Promise.resolve().then(() => {
|
|
739
|
+
if (!evt.defaultPrevented) {
|
|
740
|
+
for (
|
|
741
|
+
const e2 of
|
|
742
|
+
/**@type {HTMLFormElement} */
|
|
743
|
+
evt.target.elements
|
|
744
|
+
) {
|
|
745
|
+
e2[FORM_RESET_HANDLER]?.();
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
});
|
|
749
|
+
},
|
|
750
|
+
// In the capture phase to guarantee we get noticed of it (no possibility of stopPropagation)
|
|
751
|
+
{ capture: true }
|
|
752
|
+
);
|
|
859
753
|
}
|
|
860
|
-
|
|
861
|
-
|
|
754
|
+
}
|
|
755
|
+
function without_reactive_context(fn) {
|
|
756
|
+
var previous_reaction = active_reaction;
|
|
757
|
+
var previous_effect = active_effect;
|
|
758
|
+
set_active_reaction(null);
|
|
759
|
+
set_active_effect(null);
|
|
760
|
+
try {
|
|
761
|
+
return fn();
|
|
762
|
+
} finally {
|
|
763
|
+
set_active_reaction(previous_reaction);
|
|
764
|
+
set_active_effect(previous_effect);
|
|
862
765
|
}
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
766
|
+
}
|
|
767
|
+
function listen_to_event_and_reset_event(element, event, handler, on_reset = handler) {
|
|
768
|
+
element.addEventListener(event, () => without_reactive_context(handler));
|
|
769
|
+
const prev = (
|
|
770
|
+
/** @type {any} */
|
|
771
|
+
element[FORM_RESET_HANDLER]
|
|
772
|
+
);
|
|
773
|
+
if (prev) {
|
|
774
|
+
element[FORM_RESET_HANDLER] = () => {
|
|
775
|
+
prev();
|
|
776
|
+
on_reset(true);
|
|
777
|
+
};
|
|
778
|
+
} else {
|
|
779
|
+
element[FORM_RESET_HANDLER] = () => on_reset(true);
|
|
866
780
|
}
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
781
|
+
add_form_reset_listener();
|
|
782
|
+
}
|
|
783
|
+
function createSubscriber(start) {
|
|
784
|
+
let subscribers = 0;
|
|
785
|
+
let version = source(0);
|
|
786
|
+
let stop;
|
|
787
|
+
return () => {
|
|
788
|
+
if (effect_tracking()) {
|
|
789
|
+
get(version);
|
|
790
|
+
render_effect(() => {
|
|
791
|
+
if (subscribers === 0) {
|
|
792
|
+
stop = untrack(() => start(() => increment(version)));
|
|
793
|
+
}
|
|
794
|
+
subscribers += 1;
|
|
795
|
+
return () => {
|
|
796
|
+
queue_micro_task(() => {
|
|
797
|
+
subscribers -= 1;
|
|
798
|
+
if (subscribers === 0) {
|
|
799
|
+
stop?.();
|
|
800
|
+
stop = void 0;
|
|
801
|
+
increment(version);
|
|
802
|
+
}
|
|
803
|
+
});
|
|
804
|
+
};
|
|
805
|
+
});
|
|
881
806
|
}
|
|
882
|
-
}
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
807
|
+
};
|
|
808
|
+
}
|
|
809
|
+
var flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED;
|
|
810
|
+
function boundary(node, props, children, transform_error) {
|
|
811
|
+
new Boundary(node, props, children, transform_error);
|
|
812
|
+
}
|
|
813
|
+
class Boundary {
|
|
888
814
|
/**
|
|
889
|
-
* @param {
|
|
815
|
+
* @param {TemplateNode} node
|
|
816
|
+
* @param {BoundaryProps} props
|
|
817
|
+
* @param {((anchor: Node) => void)} children
|
|
818
|
+
* @param {((error: unknown) => unknown) | undefined} [transform_error]
|
|
890
819
|
*/
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
820
|
+
constructor(node, props, children, transform_error) {
|
|
821
|
+
__privateAdd(this, _Boundary_instances);
|
|
822
|
+
/** @type {Boundary | null} */
|
|
823
|
+
__publicField(this, "parent");
|
|
824
|
+
__publicField(this, "is_pending", false);
|
|
825
|
+
/**
|
|
826
|
+
* API-level transformError transform function. Transforms errors before they reach the `failed` snippet.
|
|
827
|
+
* Inherited from parent boundary, or defaults to identity.
|
|
828
|
+
* @type {(error: unknown) => unknown}
|
|
829
|
+
*/
|
|
830
|
+
__publicField(this, "transform_error");
|
|
831
|
+
/** @type {TemplateNode} */
|
|
832
|
+
__privateAdd(this, _anchor);
|
|
833
|
+
/** @type {TemplateNode | null} */
|
|
834
|
+
__privateAdd(this, _hydrate_open, hydrating ? hydrate_node : null);
|
|
835
|
+
/** @type {BoundaryProps} */
|
|
836
|
+
__privateAdd(this, _props);
|
|
837
|
+
/** @type {((anchor: Node) => void)} */
|
|
838
|
+
__privateAdd(this, _children);
|
|
839
|
+
/** @type {Effect} */
|
|
840
|
+
__privateAdd(this, _effect);
|
|
841
|
+
/** @type {Effect | null} */
|
|
842
|
+
__privateAdd(this, _main_effect, null);
|
|
843
|
+
/** @type {Effect | null} */
|
|
844
|
+
__privateAdd(this, _pending_effect, null);
|
|
845
|
+
/** @type {Effect | null} */
|
|
846
|
+
__privateAdd(this, _failed_effect, null);
|
|
847
|
+
/** @type {DocumentFragment | null} */
|
|
848
|
+
__privateAdd(this, _offscreen_fragment, null);
|
|
849
|
+
__privateAdd(this, _local_pending_count, 0);
|
|
850
|
+
__privateAdd(this, _pending_count, 0);
|
|
851
|
+
__privateAdd(this, _pending_count_update_queued, false);
|
|
852
|
+
/** @type {Set<Effect>} */
|
|
853
|
+
__privateAdd(this, _dirty_effects, /* @__PURE__ */ new Set());
|
|
854
|
+
/** @type {Set<Effect>} */
|
|
855
|
+
__privateAdd(this, _maybe_dirty_effects, /* @__PURE__ */ new Set());
|
|
856
|
+
/**
|
|
857
|
+
* A source containing the number of pending async deriveds/expressions.
|
|
858
|
+
* Only created if `$effect.pending()` is used inside the boundary,
|
|
859
|
+
* otherwise updating the source results in needless `Batch.ensure()`
|
|
860
|
+
* calls followed by no-op flushes
|
|
861
|
+
* @type {Source<number> | null}
|
|
862
|
+
*/
|
|
863
|
+
__privateAdd(this, _effect_pending, null);
|
|
864
|
+
__privateAdd(this, _effect_pending_subscriber, createSubscriber(() => {
|
|
865
|
+
__privateSet(this, _effect_pending, source(__privateGet(this, _local_pending_count)));
|
|
866
|
+
return () => {
|
|
867
|
+
__privateSet(this, _effect_pending, null);
|
|
868
|
+
};
|
|
869
|
+
}));
|
|
870
|
+
__privateSet(this, _anchor, node);
|
|
871
|
+
__privateSet(this, _props, props);
|
|
872
|
+
__privateSet(this, _children, (anchor) => {
|
|
873
|
+
var effect2 = (
|
|
874
|
+
/** @type {Effect} */
|
|
875
|
+
active_effect
|
|
876
|
+
);
|
|
877
|
+
effect2.b = this;
|
|
878
|
+
effect2.f |= BOUNDARY_EFFECT;
|
|
879
|
+
children(anchor);
|
|
880
|
+
});
|
|
881
|
+
this.parent = /** @type {Effect} */
|
|
882
|
+
active_effect.b;
|
|
883
|
+
this.transform_error = transform_error ?? this.parent?.transform_error ?? ((e2) => e2);
|
|
884
|
+
__privateSet(this, _effect, block(() => {
|
|
885
|
+
if (hydrating) {
|
|
886
|
+
const comment2 = (
|
|
887
|
+
/** @type {Comment} */
|
|
888
|
+
__privateGet(this, _hydrate_open)
|
|
889
|
+
);
|
|
890
|
+
hydrate_next();
|
|
891
|
+
const server_rendered_pending = comment2.data === HYDRATION_START_ELSE;
|
|
892
|
+
const server_rendered_failed = comment2.data.startsWith(HYDRATION_START_FAILED);
|
|
893
|
+
if (server_rendered_failed) {
|
|
894
|
+
const serialized_error = JSON.parse(comment2.data.slice(HYDRATION_START_FAILED.length));
|
|
895
|
+
__privateMethod(this, _Boundary_instances, hydrate_failed_content_fn).call(this, serialized_error);
|
|
896
|
+
} else if (server_rendered_pending) {
|
|
897
|
+
__privateMethod(this, _Boundary_instances, hydrate_pending_content_fn).call(this);
|
|
898
|
+
} else {
|
|
899
|
+
__privateMethod(this, _Boundary_instances, hydrate_resolved_content_fn).call(this);
|
|
900
|
+
}
|
|
901
|
+
} else {
|
|
902
|
+
__privateMethod(this, _Boundary_instances, render_fn).call(this);
|
|
903
|
+
}
|
|
904
|
+
}, flags));
|
|
905
|
+
if (hydrating) {
|
|
906
|
+
__privateSet(this, _anchor, hydrate_node);
|
|
904
907
|
}
|
|
905
908
|
}
|
|
906
909
|
/**
|
|
907
|
-
*
|
|
910
|
+
* Defer an effect inside a pending boundary until the boundary resolves
|
|
908
911
|
* @param {Effect} effect
|
|
909
|
-
* @param {boolean} skip - whether to skip updates (because this is triggered by a stale reaction)
|
|
910
912
|
*/
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
if (pending_count === 1) {
|
|
914
|
-
__privateGet(this, _pending).delete(effect2);
|
|
915
|
-
} else {
|
|
916
|
-
__privateGet(this, _pending).set(effect2, pending_count - 1);
|
|
917
|
-
}
|
|
918
|
-
if (blocking) {
|
|
919
|
-
let blocking_pending_count = __privateGet(this, _blocking_pending).get(effect2) ?? 0;
|
|
920
|
-
if (blocking_pending_count === 1) {
|
|
921
|
-
__privateGet(this, _blocking_pending).delete(effect2);
|
|
922
|
-
} else {
|
|
923
|
-
__privateGet(this, _blocking_pending).set(effect2, blocking_pending_count - 1);
|
|
924
|
-
}
|
|
925
|
-
}
|
|
926
|
-
if (__privateGet(this, _decrement_queued) || skip) return;
|
|
927
|
-
__privateSet(this, _decrement_queued, true);
|
|
928
|
-
queue_micro_task(() => {
|
|
929
|
-
__privateSet(this, _decrement_queued, false);
|
|
930
|
-
this.flush();
|
|
931
|
-
});
|
|
913
|
+
defer_effect(effect2) {
|
|
914
|
+
defer_effect(effect2, __privateGet(this, _dirty_effects), __privateGet(this, _maybe_dirty_effects));
|
|
932
915
|
}
|
|
933
916
|
/**
|
|
934
|
-
*
|
|
935
|
-
* @
|
|
917
|
+
* Returns `false` if the effect exists inside a boundary whose pending snippet is shown
|
|
918
|
+
* @returns {boolean}
|
|
936
919
|
*/
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
__privateGet(this, _dirty_effects).add(e2);
|
|
940
|
-
}
|
|
941
|
-
for (const e2 of maybe_dirty_effects) {
|
|
942
|
-
__privateGet(this, _maybe_dirty_effects).add(e2);
|
|
943
|
-
}
|
|
944
|
-
dirty_effects.clear();
|
|
945
|
-
maybe_dirty_effects.clear();
|
|
946
|
-
}
|
|
947
|
-
/** @param {(batch: Batch) => void} fn */
|
|
948
|
-
oncommit(fn) {
|
|
949
|
-
__privateGet(this, _commit_callbacks).add(fn);
|
|
950
|
-
}
|
|
951
|
-
/** @param {(batch: Batch) => void} fn */
|
|
952
|
-
ondiscard(fn) {
|
|
953
|
-
__privateGet(this, _discard_callbacks).add(fn);
|
|
920
|
+
is_rendered() {
|
|
921
|
+
return !this.is_pending && (!this.parent || this.parent.is_rendered());
|
|
954
922
|
}
|
|
955
|
-
|
|
956
|
-
return
|
|
923
|
+
has_pending_snippet() {
|
|
924
|
+
return !!__privateGet(this, _props).pending;
|
|
957
925
|
}
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
926
|
+
/**
|
|
927
|
+
* Update the source that powers `$effect.pending()` inside this boundary,
|
|
928
|
+
* and controls when the current `pending` snippet (if any) is removed.
|
|
929
|
+
* Do not call from inside the class
|
|
930
|
+
* @param {1 | -1} d
|
|
931
|
+
* @param {Batch} batch
|
|
932
|
+
*/
|
|
933
|
+
update_pending_count(d, batch) {
|
|
934
|
+
__privateMethod(this, _Boundary_instances, update_pending_count_fn).call(this, d, batch);
|
|
935
|
+
__privateSet(this, _local_pending_count, __privateGet(this, _local_pending_count) + d);
|
|
936
|
+
if (!__privateGet(this, _effect_pending) || __privateGet(this, _pending_count_update_queued)) return;
|
|
937
|
+
__privateSet(this, _pending_count_update_queued, true);
|
|
938
|
+
queue_micro_task(() => {
|
|
939
|
+
__privateSet(this, _pending_count_update_queued, false);
|
|
940
|
+
if (__privateGet(this, _effect_pending)) {
|
|
941
|
+
internal_set(__privateGet(this, _effect_pending), __privateGet(this, _local_pending_count));
|
|
971
942
|
}
|
|
972
|
-
}
|
|
973
|
-
return current_batch;
|
|
943
|
+
});
|
|
974
944
|
}
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
945
|
+
get_effect_pending() {
|
|
946
|
+
__privateGet(this, _effect_pending_subscriber).call(this);
|
|
947
|
+
return get(
|
|
948
|
+
/** @type {Source<number>} */
|
|
949
|
+
__privateGet(this, _effect_pending)
|
|
950
|
+
);
|
|
980
951
|
}
|
|
981
|
-
/**
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
schedule(effect2) {
|
|
986
|
-
last_scheduled_effect = effect2;
|
|
987
|
-
if (effect2.b?.is_pending && (effect2.f & (EFFECT | RENDER_EFFECT | MANAGED_EFFECT)) !== 0 && (effect2.f & REACTION_RAN) === 0) {
|
|
988
|
-
effect2.b.defer_effect(effect2);
|
|
989
|
-
return;
|
|
952
|
+
/** @param {unknown} error */
|
|
953
|
+
error(error) {
|
|
954
|
+
if (!__privateGet(this, _props).onerror && !__privateGet(this, _props).failed) {
|
|
955
|
+
throw error;
|
|
990
956
|
}
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
if ((flags2 & (ROOT_EFFECT | BRANCH_EFFECT)) !== 0) {
|
|
1001
|
-
if ((flags2 & CLEAN) === 0) {
|
|
1002
|
-
return;
|
|
1003
|
-
}
|
|
1004
|
-
e2.f ^= CLEAN;
|
|
1005
|
-
}
|
|
957
|
+
if (current_batch?.is_fork) {
|
|
958
|
+
if (__privateGet(this, _main_effect)) current_batch.skip_effect(__privateGet(this, _main_effect));
|
|
959
|
+
if (__privateGet(this, _pending_effect)) current_batch.skip_effect(__privateGet(this, _pending_effect));
|
|
960
|
+
if (__privateGet(this, _failed_effect)) current_batch.skip_effect(__privateGet(this, _failed_effect));
|
|
961
|
+
current_batch.oncommit(() => {
|
|
962
|
+
__privateMethod(this, _Boundary_instances, handle_error_fn).call(this, error);
|
|
963
|
+
});
|
|
964
|
+
} else {
|
|
965
|
+
__privateMethod(this, _Boundary_instances, handle_error_fn).call(this, error);
|
|
1006
966
|
}
|
|
1007
|
-
__privateGet(this, _roots).push(e2);
|
|
1008
967
|
}
|
|
1009
|
-
}
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
968
|
+
}
|
|
969
|
+
_anchor = new WeakMap();
|
|
970
|
+
_hydrate_open = new WeakMap();
|
|
971
|
+
_props = new WeakMap();
|
|
972
|
+
_children = new WeakMap();
|
|
973
|
+
_effect = new WeakMap();
|
|
974
|
+
_main_effect = new WeakMap();
|
|
975
|
+
_pending_effect = new WeakMap();
|
|
976
|
+
_failed_effect = new WeakMap();
|
|
977
|
+
_offscreen_fragment = new WeakMap();
|
|
978
|
+
_local_pending_count = new WeakMap();
|
|
979
|
+
_pending_count = new WeakMap();
|
|
980
|
+
_pending_count_update_queued = new WeakMap();
|
|
1017
981
|
_dirty_effects = new WeakMap();
|
|
1018
982
|
_maybe_dirty_effects = new WeakMap();
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
is_blocked_fn = function() {
|
|
1028
|
-
for (const batch of __privateGet(this, _blockers)) {
|
|
1029
|
-
for (const effect2 of __privateGet(batch, _blocking_pending).keys()) {
|
|
1030
|
-
var skipped = false;
|
|
1031
|
-
var e2 = effect2;
|
|
1032
|
-
while (e2.parent !== null) {
|
|
1033
|
-
if (__privateGet(this, _skipped_branches).has(e2)) {
|
|
1034
|
-
skipped = true;
|
|
1035
|
-
break;
|
|
1036
|
-
}
|
|
1037
|
-
e2 = e2.parent;
|
|
1038
|
-
}
|
|
1039
|
-
if (!skipped) {
|
|
1040
|
-
return true;
|
|
1041
|
-
}
|
|
1042
|
-
}
|
|
983
|
+
_effect_pending = new WeakMap();
|
|
984
|
+
_effect_pending_subscriber = new WeakMap();
|
|
985
|
+
_Boundary_instances = new WeakSet();
|
|
986
|
+
hydrate_resolved_content_fn = function() {
|
|
987
|
+
try {
|
|
988
|
+
__privateSet(this, _main_effect, branch(() => __privateGet(this, _children).call(this, __privateGet(this, _anchor))));
|
|
989
|
+
} catch (error) {
|
|
990
|
+
this.error(error);
|
|
1043
991
|
}
|
|
1044
|
-
return false;
|
|
1045
992
|
};
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
}
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
this
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
993
|
+
/**
|
|
994
|
+
* @param {unknown} error The deserialized error from the server's hydration comment
|
|
995
|
+
*/
|
|
996
|
+
hydrate_failed_content_fn = function(error) {
|
|
997
|
+
const failed = __privateGet(this, _props).failed;
|
|
998
|
+
const { reset: reset2, invoke_onerror } = __privateMethod(this, _Boundary_instances, create_reset_fn).call(this, error);
|
|
999
|
+
queue_micro_task(invoke_onerror);
|
|
1000
|
+
if (!failed) return;
|
|
1001
|
+
__privateSet(this, _failed_effect, branch(() => {
|
|
1002
|
+
failed(
|
|
1003
|
+
__privateGet(this, _anchor),
|
|
1004
|
+
() => error,
|
|
1005
|
+
() => reset2
|
|
1006
|
+
);
|
|
1007
|
+
}));
|
|
1008
|
+
};
|
|
1009
|
+
/**
|
|
1010
|
+
* Creates the `reset` function for a failed boundary, along with a function
|
|
1011
|
+
* that invokes `onerror` with it (if provided)
|
|
1012
|
+
* @param {unknown} error
|
|
1013
|
+
* @returns {{ reset: () => void, invoke_onerror: () => void }}
|
|
1014
|
+
*/
|
|
1015
|
+
create_reset_fn = function(error) {
|
|
1016
|
+
var did_reset = false;
|
|
1017
|
+
var calling_on_error = false;
|
|
1018
|
+
const reset2 = () => {
|
|
1019
|
+
if (did_reset) {
|
|
1020
|
+
svelte_boundary_reset_noop();
|
|
1021
|
+
return;
|
|
1022
|
+
}
|
|
1023
|
+
did_reset = true;
|
|
1024
|
+
if (calling_on_error) {
|
|
1025
|
+
svelte_boundary_reset_onerror();
|
|
1026
|
+
}
|
|
1027
|
+
if (__privateGet(this, _failed_effect) !== null) {
|
|
1028
|
+
pause_effect(__privateGet(this, _failed_effect), () => {
|
|
1029
|
+
__privateSet(this, _failed_effect, null);
|
|
1030
|
+
});
|
|
1031
|
+
}
|
|
1032
|
+
__privateMethod(this, _Boundary_instances, run_fn).call(this, () => {
|
|
1033
|
+
__privateMethod(this, _Boundary_instances, render_fn).call(this);
|
|
1034
|
+
});
|
|
1035
|
+
};
|
|
1036
|
+
const invoke_onerror = () => {
|
|
1070
1037
|
try {
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1038
|
+
calling_on_error = true;
|
|
1039
|
+
__privateGet(this, _props).onerror?.(error, reset2);
|
|
1040
|
+
calling_on_error = false;
|
|
1041
|
+
} catch (err) {
|
|
1042
|
+
invoke_error_boundary(err, __privateGet(this, _effect) && __privateGet(this, _effect).parent);
|
|
1075
1043
|
}
|
|
1076
|
-
}
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1044
|
+
};
|
|
1045
|
+
return { reset: reset2, invoke_onerror };
|
|
1046
|
+
};
|
|
1047
|
+
hydrate_pending_content_fn = function() {
|
|
1048
|
+
const pending = __privateGet(this, _props).pending;
|
|
1049
|
+
if (!pending) return;
|
|
1050
|
+
this.is_pending = true;
|
|
1051
|
+
__privateSet(this, _pending_effect, branch(() => pending(__privateGet(this, _anchor))));
|
|
1052
|
+
queue_micro_task(() => {
|
|
1053
|
+
var fragment = __privateSet(this, _offscreen_fragment, document.createDocumentFragment());
|
|
1054
|
+
var anchor = create_text();
|
|
1055
|
+
fragment.append(anchor);
|
|
1056
|
+
__privateSet(this, _main_effect, __privateMethod(this, _Boundary_instances, run_fn).call(this, () => {
|
|
1057
|
+
return branch(() => __privateGet(this, _children).call(this, anchor));
|
|
1058
|
+
}));
|
|
1059
|
+
if (__privateGet(this, _pending_count) === 0) {
|
|
1060
|
+
__privateGet(this, _anchor).before(fragment);
|
|
1061
|
+
__privateSet(this, _offscreen_fragment, null);
|
|
1062
|
+
pause_effect(
|
|
1063
|
+
/** @type {Effect} */
|
|
1064
|
+
__privateGet(this, _pending_effect),
|
|
1065
|
+
() => {
|
|
1066
|
+
__privateSet(this, _pending_effect, null);
|
|
1067
|
+
}
|
|
1068
|
+
);
|
|
1069
|
+
__privateMethod(this, _Boundary_instances, resolve_fn).call(
|
|
1070
|
+
this,
|
|
1071
|
+
/** @type {Batch} */
|
|
1072
|
+
current_batch
|
|
1073
|
+
);
|
|
1082
1074
|
}
|
|
1083
|
-
}
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1075
|
+
});
|
|
1076
|
+
};
|
|
1077
|
+
render_fn = function() {
|
|
1078
|
+
try {
|
|
1079
|
+
this.is_pending = this.has_pending_snippet();
|
|
1080
|
+
__privateSet(this, _pending_count, 0);
|
|
1081
|
+
__privateSet(this, _local_pending_count, 0);
|
|
1082
|
+
__privateSet(this, _main_effect, branch(() => {
|
|
1083
|
+
__privateGet(this, _children).call(this, __privateGet(this, _anchor));
|
|
1084
|
+
}));
|
|
1085
|
+
if (__privateGet(this, _pending_count) > 0) {
|
|
1086
|
+
var fragment = __privateSet(this, _offscreen_fragment, document.createDocumentFragment());
|
|
1087
|
+
move_effect(__privateGet(this, _main_effect), fragment);
|
|
1088
|
+
const pending = (
|
|
1089
|
+
/** @type {(anchor: Node) => void} */
|
|
1090
|
+
__privateGet(this, _props).pending
|
|
1091
|
+
);
|
|
1092
|
+
__privateSet(this, _pending_effect, branch(() => pending(__privateGet(this, _anchor))));
|
|
1093
|
+
} else {
|
|
1094
|
+
__privateMethod(this, _Boundary_instances, resolve_fn).call(
|
|
1095
|
+
this,
|
|
1096
|
+
/** @type {Batch} */
|
|
1097
|
+
current_batch
|
|
1098
|
+
);
|
|
1091
1099
|
}
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
|
-
batches.delete(this);
|
|
1095
|
-
}
|
|
1096
|
-
__privateGet(this, _dirty_effects).clear();
|
|
1097
|
-
__privateGet(this, _maybe_dirty_effects).clear();
|
|
1098
|
-
for (const fn of __privateGet(this, _commit_callbacks)) fn(this);
|
|
1099
|
-
__privateGet(this, _commit_callbacks).clear();
|
|
1100
|
-
flush_queued_effects(render_effects);
|
|
1101
|
-
flush_queued_effects(effects);
|
|
1102
|
-
__privateGet(this, _deferred)?.resolve();
|
|
1103
|
-
}
|
|
1104
|
-
var next_batch = (
|
|
1105
|
-
/** @type {Batch | null} */
|
|
1106
|
-
/** @type {unknown} */
|
|
1107
|
-
current_batch
|
|
1108
|
-
);
|
|
1109
|
-
if (__privateGet(this, _roots).length > 0) {
|
|
1110
|
-
const batch2 = next_batch ?? (next_batch = this);
|
|
1111
|
-
__privateGet(batch2, _roots).push(...__privateGet(this, _roots).filter((r2) => !__privateGet(batch2, _roots).includes(r2)));
|
|
1100
|
+
} catch (error) {
|
|
1101
|
+
this.error(error);
|
|
1112
1102
|
}
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1103
|
+
};
|
|
1104
|
+
/**
|
|
1105
|
+
* @param {Batch} batch
|
|
1106
|
+
*/
|
|
1107
|
+
resolve_fn = function(batch) {
|
|
1108
|
+
this.is_pending = false;
|
|
1109
|
+
batch.transfer_effects(__privateGet(this, _dirty_effects), __privateGet(this, _maybe_dirty_effects));
|
|
1110
|
+
};
|
|
1111
|
+
/**
|
|
1112
|
+
* @template T
|
|
1113
|
+
* @param {() => T} fn
|
|
1114
|
+
*/
|
|
1115
|
+
run_fn = function(fn) {
|
|
1116
|
+
var previous_effect = active_effect;
|
|
1117
|
+
var previous_reaction = active_reaction;
|
|
1118
|
+
var previous_ctx = component_context;
|
|
1119
|
+
set_active_effect(__privateGet(this, _effect));
|
|
1120
|
+
set_active_reaction(__privateGet(this, _effect));
|
|
1121
|
+
set_component_context(__privateGet(this, _effect).ctx);
|
|
1122
|
+
try {
|
|
1123
|
+
Batch.ensure();
|
|
1124
|
+
return fn();
|
|
1125
|
+
} catch (e2) {
|
|
1126
|
+
handle_error(e2);
|
|
1127
|
+
return null;
|
|
1128
|
+
} finally {
|
|
1129
|
+
set_active_effect(previous_effect);
|
|
1130
|
+
set_active_reaction(previous_reaction);
|
|
1131
|
+
set_component_context(previous_ctx);
|
|
1116
1132
|
}
|
|
1117
1133
|
};
|
|
1118
1134
|
/**
|
|
1119
|
-
*
|
|
1120
|
-
*
|
|
1121
|
-
* @param {
|
|
1122
|
-
* @param {
|
|
1123
|
-
* @param {Effect[]} render_effects
|
|
1135
|
+
* Updates the pending count associated with the currently visible pending snippet,
|
|
1136
|
+
* if any, such that we can replace the snippet with content once work is done
|
|
1137
|
+
* @param {1 | -1} d
|
|
1138
|
+
* @param {Batch} batch
|
|
1124
1139
|
*/
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
var is_branch = (flags2 & (BRANCH_EFFECT | ROOT_EFFECT)) !== 0;
|
|
1131
|
-
var is_skippable_branch = is_branch && (flags2 & CLEAN) !== 0;
|
|
1132
|
-
var skip = is_skippable_branch || (flags2 & INERT) !== 0 || __privateGet(this, _skipped_branches).has(effect2);
|
|
1133
|
-
if (!skip && effect2.fn !== null) {
|
|
1134
|
-
if (is_branch) {
|
|
1135
|
-
effect2.f ^= CLEAN;
|
|
1136
|
-
} else if ((flags2 & EFFECT) !== 0) {
|
|
1137
|
-
effects.push(effect2);
|
|
1138
|
-
} else if (is_dirty(effect2)) {
|
|
1139
|
-
if ((flags2 & BLOCK_EFFECT) !== 0) __privateGet(this, _maybe_dirty_effects).add(effect2);
|
|
1140
|
-
update_effect(effect2);
|
|
1141
|
-
}
|
|
1142
|
-
var child2 = effect2.first;
|
|
1143
|
-
if (child2 !== null) {
|
|
1144
|
-
effect2 = child2;
|
|
1145
|
-
continue;
|
|
1146
|
-
}
|
|
1140
|
+
update_pending_count_fn = function(d, batch) {
|
|
1141
|
+
var _a3;
|
|
1142
|
+
if (!this.has_pending_snippet()) {
|
|
1143
|
+
if (this.parent) {
|
|
1144
|
+
__privateMethod(_a3 = this.parent, _Boundary_instances, update_pending_count_fn).call(_a3, d, batch);
|
|
1147
1145
|
}
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1146
|
+
return;
|
|
1147
|
+
}
|
|
1148
|
+
__privateSet(this, _pending_count, __privateGet(this, _pending_count) + d);
|
|
1149
|
+
if (__privateGet(this, _pending_count) === 0) {
|
|
1150
|
+
__privateMethod(this, _Boundary_instances, resolve_fn).call(this, batch);
|
|
1151
|
+
if (__privateGet(this, _pending_effect)) {
|
|
1152
|
+
pause_effect(__privateGet(this, _pending_effect), () => {
|
|
1153
|
+
__privateSet(this, _pending_effect, null);
|
|
1154
|
+
});
|
|
1155
|
+
}
|
|
1156
|
+
if (__privateGet(this, _offscreen_fragment)) {
|
|
1157
|
+
__privateGet(this, _anchor).before(__privateGet(this, _offscreen_fragment));
|
|
1158
|
+
__privateSet(this, _offscreen_fragment, null);
|
|
1155
1159
|
}
|
|
1156
1160
|
}
|
|
1157
1161
|
};
|
|
1158
1162
|
/**
|
|
1159
|
-
* @param {
|
|
1163
|
+
* @param {unknown} error
|
|
1160
1164
|
*/
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1165
|
+
handle_error_fn = function(error) {
|
|
1166
|
+
if (__privateGet(this, _main_effect)) {
|
|
1167
|
+
destroy_effect(__privateGet(this, _main_effect));
|
|
1168
|
+
__privateSet(this, _main_effect, null);
|
|
1164
1169
|
}
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1170
|
+
if (__privateGet(this, _pending_effect)) {
|
|
1171
|
+
destroy_effect(__privateGet(this, _pending_effect));
|
|
1172
|
+
__privateSet(this, _pending_effect, null);
|
|
1173
|
+
}
|
|
1174
|
+
if (__privateGet(this, _failed_effect)) {
|
|
1175
|
+
destroy_effect(__privateGet(this, _failed_effect));
|
|
1176
|
+
__privateSet(this, _failed_effect, null);
|
|
1177
|
+
}
|
|
1178
|
+
if (hydrating) {
|
|
1179
|
+
set_hydrate_node(
|
|
1180
|
+
/** @type {TemplateNode} */
|
|
1181
|
+
__privateGet(this, _hydrate_open)
|
|
1182
|
+
);
|
|
1183
|
+
next();
|
|
1184
|
+
set_hydrate_node(skip_nodes());
|
|
1185
|
+
}
|
|
1186
|
+
let failed = __privateGet(this, _props).failed;
|
|
1187
|
+
const handle_error_result = (transformed_error) => {
|
|
1188
|
+
const { reset: reset2, invoke_onerror } = __privateMethod(this, _Boundary_instances, create_reset_fn).call(this, transformed_error);
|
|
1189
|
+
invoke_onerror();
|
|
1190
|
+
if (failed) {
|
|
1191
|
+
__privateSet(this, _failed_effect, __privateMethod(this, _Boundary_instances, run_fn).call(this, () => {
|
|
1192
|
+
try {
|
|
1193
|
+
return branch(() => {
|
|
1194
|
+
var effect2 = (
|
|
1195
|
+
/** @type {Effect} */
|
|
1196
|
+
active_effect
|
|
1197
|
+
);
|
|
1198
|
+
effect2.b = this;
|
|
1199
|
+
effect2.f |= BOUNDARY_EFFECT;
|
|
1200
|
+
failed(
|
|
1201
|
+
__privateGet(this, _anchor),
|
|
1202
|
+
() => transformed_error,
|
|
1203
|
+
() => reset2
|
|
1204
|
+
);
|
|
1200
1205
|
});
|
|
1206
|
+
} catch (error2) {
|
|
1207
|
+
invoke_error_boundary(
|
|
1208
|
+
error2,
|
|
1209
|
+
/** @type {Effect} */
|
|
1210
|
+
__privateGet(this, _effect).parent
|
|
1211
|
+
);
|
|
1212
|
+
return null;
|
|
1201
1213
|
}
|
|
1202
|
-
}
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1214
|
+
}));
|
|
1215
|
+
}
|
|
1216
|
+
};
|
|
1217
|
+
queue_micro_task(() => {
|
|
1218
|
+
var result;
|
|
1219
|
+
try {
|
|
1220
|
+
result = this.transform_error(error);
|
|
1221
|
+
} catch (e2) {
|
|
1222
|
+
invoke_error_boundary(e2, __privateGet(this, _effect) && __privateGet(this, _effect).parent);
|
|
1223
|
+
return;
|
|
1224
|
+
}
|
|
1225
|
+
if (result !== null && typeof result === "object" && typeof /** @type {any} */
|
|
1226
|
+
result.then === "function") {
|
|
1227
|
+
result.then(
|
|
1228
|
+
handle_error_result,
|
|
1229
|
+
/** @param {unknown} e */
|
|
1230
|
+
(e2) => invoke_error_boundary(e2, __privateGet(this, _effect) && __privateGet(this, _effect).parent)
|
|
1215
1231
|
);
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
if ((effect2.f & (ASYNC | BLOCK_EFFECT)) !== 0) {
|
|
1219
|
-
set_signal_status(effect2, DIRTY);
|
|
1220
|
-
batch.schedule(effect2);
|
|
1221
|
-
} else {
|
|
1222
|
-
__privateGet(batch, _dirty_effects).add(effect2);
|
|
1223
|
-
}
|
|
1224
|
-
}
|
|
1225
|
-
}
|
|
1226
|
-
if (__privateGet(batch, _roots).length > 0) {
|
|
1227
|
-
batch.apply();
|
|
1228
|
-
for (var root2 of __privateGet(batch, _roots)) {
|
|
1229
|
-
__privateMethod(_a3 = batch, _Batch_instances, traverse_fn).call(_a3, root2, [], []);
|
|
1230
|
-
}
|
|
1231
|
-
__privateSet(batch, _roots, []);
|
|
1232
|
-
}
|
|
1233
|
-
batch.deactivate();
|
|
1232
|
+
} else {
|
|
1233
|
+
handle_error_result(result);
|
|
1234
1234
|
}
|
|
1235
|
+
});
|
|
1236
|
+
};
|
|
1237
|
+
function flatten(blockers, sync, async, fn) {
|
|
1238
|
+
const d = derived;
|
|
1239
|
+
var pending = blockers.filter((b) => !b.settled);
|
|
1240
|
+
var deriveds = sync.map(d);
|
|
1241
|
+
if (async.length === 0 && pending.length === 0) {
|
|
1242
|
+
fn(deriveds);
|
|
1243
|
+
return;
|
|
1235
1244
|
}
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1245
|
+
var parent = (
|
|
1246
|
+
/** @type {Effect} */
|
|
1247
|
+
active_effect
|
|
1248
|
+
);
|
|
1249
|
+
var restore = capture();
|
|
1250
|
+
var blocker_promise = pending.length === 1 ? pending[0].promise : pending.length > 1 ? Promise.all(pending.map((b) => b.promise)) : null;
|
|
1251
|
+
function finish(async2) {
|
|
1252
|
+
if ((parent.f & DESTROYED) !== 0) {
|
|
1253
|
+
return;
|
|
1243
1254
|
}
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
is_flushing_sync = true;
|
|
1250
|
-
try {
|
|
1251
|
-
var result;
|
|
1252
|
-
if (fn) ;
|
|
1253
|
-
while (true) {
|
|
1254
|
-
flush_tasks();
|
|
1255
|
-
if (current_batch === null) {
|
|
1256
|
-
return (
|
|
1257
|
-
/** @type {T} */
|
|
1258
|
-
result
|
|
1259
|
-
);
|
|
1260
|
-
}
|
|
1261
|
-
current_batch.flush();
|
|
1255
|
+
restore();
|
|
1256
|
+
try {
|
|
1257
|
+
fn([...deriveds, ...async2]);
|
|
1258
|
+
} catch (error) {
|
|
1259
|
+
invoke_error_boundary(error, parent);
|
|
1262
1260
|
}
|
|
1263
|
-
|
|
1264
|
-
|
|
1261
|
+
unset_context();
|
|
1262
|
+
}
|
|
1263
|
+
var decrement_pending = increment_pending();
|
|
1264
|
+
if (async.length === 0) {
|
|
1265
|
+
blocker_promise.then(() => finish([])).finally(decrement_pending);
|
|
1266
|
+
return;
|
|
1267
|
+
}
|
|
1268
|
+
function run() {
|
|
1269
|
+
Promise.all(async.map((expression) => /* @__PURE__ */ async_derived(expression))).then(finish).catch((error) => invoke_error_boundary(error, parent)).finally(decrement_pending);
|
|
1270
|
+
}
|
|
1271
|
+
if (blocker_promise) {
|
|
1272
|
+
blocker_promise.then(() => {
|
|
1273
|
+
restore();
|
|
1274
|
+
run();
|
|
1275
|
+
unset_context();
|
|
1276
|
+
});
|
|
1277
|
+
} else {
|
|
1278
|
+
run();
|
|
1265
1279
|
}
|
|
1266
1280
|
}
|
|
1267
|
-
function
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1281
|
+
function capture() {
|
|
1282
|
+
var previous_effect = (
|
|
1283
|
+
/** @type {Effect} */
|
|
1284
|
+
active_effect
|
|
1285
|
+
);
|
|
1286
|
+
var previous_reaction = active_reaction;
|
|
1287
|
+
var previous_component_context = component_context;
|
|
1288
|
+
var previous_batch2 = (
|
|
1289
|
+
/** @type {Batch} */
|
|
1290
|
+
current_batch
|
|
1291
|
+
);
|
|
1292
|
+
return function restore(activate_batch = true) {
|
|
1293
|
+
set_active_effect(previous_effect);
|
|
1294
|
+
set_active_reaction(previous_reaction);
|
|
1295
|
+
set_component_context(previous_component_context);
|
|
1296
|
+
if (activate_batch && (previous_effect.f & DESTROYED) === 0) {
|
|
1297
|
+
previous_batch2?.activate();
|
|
1298
|
+
previous_batch2?.apply();
|
|
1299
|
+
}
|
|
1300
|
+
};
|
|
1301
|
+
}
|
|
1302
|
+
function unset_context(deactivate_batch = true) {
|
|
1303
|
+
set_active_effect(null);
|
|
1304
|
+
set_active_reaction(null);
|
|
1305
|
+
set_component_context(null);
|
|
1306
|
+
if (deactivate_batch) current_batch?.deactivate();
|
|
1307
|
+
}
|
|
1308
|
+
function increment_pending() {
|
|
1309
|
+
var effect2 = (
|
|
1310
|
+
/** @type {Effect} */
|
|
1311
|
+
active_effect
|
|
1312
|
+
);
|
|
1313
|
+
var boundary2 = effect2.b;
|
|
1314
|
+
var batch = (
|
|
1315
|
+
/** @type {Batch} */
|
|
1316
|
+
current_batch
|
|
1317
|
+
);
|
|
1318
|
+
var blocking = !!boundary2?.is_rendered();
|
|
1319
|
+
boundary2?.update_pending_count(1, batch);
|
|
1320
|
+
batch.increment(blocking, effect2);
|
|
1321
|
+
return () => {
|
|
1322
|
+
boundary2?.update_pending_count(-1, batch);
|
|
1323
|
+
batch.decrement(blocking, effect2);
|
|
1324
|
+
};
|
|
1325
|
+
}
|
|
1326
|
+
// @__NO_SIDE_EFFECTS__
|
|
1327
|
+
function derived(fn) {
|
|
1328
|
+
var flags2 = DERIVED | DIRTY;
|
|
1329
|
+
if (active_effect !== null) {
|
|
1330
|
+
active_effect.f |= EFFECT_PRESERVED;
|
|
1272
1331
|
}
|
|
1332
|
+
const signal = {
|
|
1333
|
+
ctx: component_context,
|
|
1334
|
+
deps: null,
|
|
1335
|
+
effects: null,
|
|
1336
|
+
equals,
|
|
1337
|
+
f: flags2,
|
|
1338
|
+
fn,
|
|
1339
|
+
reactions: null,
|
|
1340
|
+
rv: 0,
|
|
1341
|
+
v: (
|
|
1342
|
+
/** @type {V} */
|
|
1343
|
+
UNINITIALIZED
|
|
1344
|
+
),
|
|
1345
|
+
wv: 0,
|
|
1346
|
+
parent: active_effect,
|
|
1347
|
+
ac: null
|
|
1348
|
+
};
|
|
1349
|
+
return signal;
|
|
1273
1350
|
}
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1351
|
+
const OBSOLETE = Symbol("obsolete");
|
|
1352
|
+
// @__NO_SIDE_EFFECTS__
|
|
1353
|
+
function async_derived(fn, label, location) {
|
|
1354
|
+
let parent = (
|
|
1355
|
+
/** @type {Effect | null} */
|
|
1356
|
+
active_effect
|
|
1357
|
+
);
|
|
1358
|
+
if (parent === null) {
|
|
1359
|
+
async_derived_orphan();
|
|
1360
|
+
}
|
|
1361
|
+
var promise = (
|
|
1362
|
+
/** @type {Promise<V>} */
|
|
1363
|
+
/** @type {unknown} */
|
|
1364
|
+
void 0
|
|
1365
|
+
);
|
|
1366
|
+
var signal = source(
|
|
1367
|
+
/** @type {V} */
|
|
1368
|
+
UNINITIALIZED
|
|
1369
|
+
);
|
|
1370
|
+
var should_suspend = !active_reaction;
|
|
1371
|
+
var deferreds = /* @__PURE__ */ new Set();
|
|
1372
|
+
async_effect(() => {
|
|
1373
|
+
var effect2 = (
|
|
1374
|
+
/** @type {Effect} */
|
|
1375
|
+
active_effect
|
|
1376
|
+
);
|
|
1377
|
+
var d = deferred();
|
|
1378
|
+
promise = d.promise;
|
|
1379
|
+
try {
|
|
1380
|
+
Promise.resolve(fn()).then(d.resolve, (e2) => {
|
|
1381
|
+
if (e2 !== STALE_REACTION) d.reject(e2);
|
|
1382
|
+
}).finally(unset_context);
|
|
1383
|
+
} catch (error) {
|
|
1384
|
+
d.reject(error);
|
|
1385
|
+
unset_context();
|
|
1386
|
+
}
|
|
1387
|
+
var batch = (
|
|
1388
|
+
/** @type {Batch} */
|
|
1389
|
+
current_batch
|
|
1390
|
+
);
|
|
1391
|
+
if (should_suspend) {
|
|
1392
|
+
if ((effect2.f & REACTION_RAN) !== 0) {
|
|
1393
|
+
var decrement_pending = increment_pending();
|
|
1286
1394
|
}
|
|
1287
|
-
if (
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1395
|
+
if (
|
|
1396
|
+
// boundary can be null if the async derived is inside an $effect.root not connected to the component render tree
|
|
1397
|
+
parent.b?.is_rendered()
|
|
1398
|
+
) {
|
|
1399
|
+
batch.async_deriveds.get(effect2)?.reject(OBSOLETE);
|
|
1400
|
+
} else {
|
|
1401
|
+
for (const d2 of deferreds.values()) {
|
|
1402
|
+
d2.reject(OBSOLETE);
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
deferreds.add(d);
|
|
1406
|
+
batch.async_deriveds.set(effect2, d);
|
|
1407
|
+
}
|
|
1408
|
+
const handler = (value, error = void 0) => {
|
|
1409
|
+
decrement_pending?.();
|
|
1410
|
+
deferreds.delete(d);
|
|
1411
|
+
if (error === OBSOLETE) return;
|
|
1412
|
+
batch.activate();
|
|
1413
|
+
if (error) {
|
|
1414
|
+
signal.f |= ERROR_VALUE;
|
|
1415
|
+
internal_set(signal, error);
|
|
1416
|
+
} else {
|
|
1417
|
+
if ((signal.f & ERROR_VALUE) !== 0) {
|
|
1418
|
+
signal.f ^= ERROR_VALUE;
|
|
1419
|
+
}
|
|
1420
|
+
internal_set(signal, value);
|
|
1421
|
+
}
|
|
1422
|
+
batch.deactivate();
|
|
1423
|
+
};
|
|
1424
|
+
d.promise.then(handler, (e2) => handler(null, e2 || "unknown"));
|
|
1425
|
+
});
|
|
1426
|
+
teardown(() => {
|
|
1427
|
+
for (const d of deferreds) {
|
|
1428
|
+
d.reject(OBSOLETE);
|
|
1429
|
+
}
|
|
1430
|
+
});
|
|
1431
|
+
return new Promise((fulfil) => {
|
|
1432
|
+
function next2(p) {
|
|
1433
|
+
function go() {
|
|
1434
|
+
if (p === promise) {
|
|
1435
|
+
fulfil(signal);
|
|
1436
|
+
} else {
|
|
1437
|
+
next2(promise);
|
|
1305
1438
|
}
|
|
1306
|
-
eager_block_effects.clear();
|
|
1307
1439
|
}
|
|
1440
|
+
p.then(go, go);
|
|
1441
|
+
}
|
|
1442
|
+
next2(promise);
|
|
1443
|
+
});
|
|
1444
|
+
}
|
|
1445
|
+
// @__NO_SIDE_EFFECTS__
|
|
1446
|
+
function user_derived(fn) {
|
|
1447
|
+
const d = /* @__PURE__ */ derived(fn);
|
|
1448
|
+
push_reaction_value(d);
|
|
1449
|
+
return d;
|
|
1450
|
+
}
|
|
1451
|
+
// @__NO_SIDE_EFFECTS__
|
|
1452
|
+
function derived_safe_equal(fn) {
|
|
1453
|
+
const signal = /* @__PURE__ */ derived(fn);
|
|
1454
|
+
signal.equals = safe_equals;
|
|
1455
|
+
return signal;
|
|
1456
|
+
}
|
|
1457
|
+
function destroy_derived_effects(derived2) {
|
|
1458
|
+
var effects = derived2.effects;
|
|
1459
|
+
if (effects !== null) {
|
|
1460
|
+
derived2.effects = null;
|
|
1461
|
+
for (var i = 0; i < effects.length; i += 1) {
|
|
1462
|
+
destroy_effect(
|
|
1463
|
+
/** @type {Effect} */
|
|
1464
|
+
effects[i]
|
|
1465
|
+
);
|
|
1308
1466
|
}
|
|
1309
1467
|
}
|
|
1310
|
-
eager_block_effects = null;
|
|
1311
1468
|
}
|
|
1312
|
-
function
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
/** @type {Effect} */
|
|
1330
|
-
reaction
|
|
1331
|
-
);
|
|
1332
|
-
}
|
|
1469
|
+
function execute_derived(derived2) {
|
|
1470
|
+
var value;
|
|
1471
|
+
var prev_active_effect = active_effect;
|
|
1472
|
+
var parent = derived2.parent;
|
|
1473
|
+
if (!is_destroying_effect && parent !== null && derived2.v !== UNINITIALIZED && // if it was never evaluated before, it's guaranteed to fail downstream, so we try to execute instead
|
|
1474
|
+
(parent.f & (DESTROYED | INERT)) !== 0) {
|
|
1475
|
+
derived_inert();
|
|
1476
|
+
return derived2.v;
|
|
1477
|
+
}
|
|
1478
|
+
set_active_effect(parent);
|
|
1479
|
+
{
|
|
1480
|
+
try {
|
|
1481
|
+
derived2.f &= ~WAS_MARKED;
|
|
1482
|
+
destroy_derived_effects(derived2);
|
|
1483
|
+
value = update_reaction(derived2);
|
|
1484
|
+
} finally {
|
|
1485
|
+
set_active_effect(prev_active_effect);
|
|
1333
1486
|
}
|
|
1334
1487
|
}
|
|
1488
|
+
return value;
|
|
1335
1489
|
}
|
|
1336
|
-
function
|
|
1337
|
-
|
|
1338
|
-
if (
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
if (
|
|
1342
|
-
|
|
1490
|
+
function update_derived(derived2) {
|
|
1491
|
+
var value = execute_derived(derived2);
|
|
1492
|
+
if (!derived2.equals(value)) {
|
|
1493
|
+
derived2.wv = increment_write_version();
|
|
1494
|
+
if (!current_batch?.is_fork || derived2.deps === null) {
|
|
1495
|
+
if (current_batch !== null) {
|
|
1496
|
+
current_batch.capture(derived2, value, true);
|
|
1497
|
+
previous_batch?.capture(derived2, value, true);
|
|
1498
|
+
} else {
|
|
1499
|
+
derived2.v = value;
|
|
1343
1500
|
}
|
|
1344
|
-
if (
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
sources,
|
|
1348
|
-
checked
|
|
1349
|
-
)) {
|
|
1350
|
-
checked.set(
|
|
1351
|
-
/** @type {Derived} */
|
|
1352
|
-
dep,
|
|
1353
|
-
true
|
|
1354
|
-
);
|
|
1355
|
-
return true;
|
|
1501
|
+
if (derived2.deps === null) {
|
|
1502
|
+
set_signal_status(derived2, CLEAN);
|
|
1503
|
+
return;
|
|
1356
1504
|
}
|
|
1357
1505
|
}
|
|
1358
1506
|
}
|
|
1359
|
-
|
|
1360
|
-
return false;
|
|
1361
|
-
}
|
|
1362
|
-
function schedule_effect(effect2) {
|
|
1363
|
-
current_batch.schedule(effect2);
|
|
1364
|
-
}
|
|
1365
|
-
function reset_branch(effect2, tracked) {
|
|
1366
|
-
if ((effect2.f & BRANCH_EFFECT) !== 0 && (effect2.f & CLEAN) !== 0) {
|
|
1507
|
+
if (is_destroying_effect) {
|
|
1367
1508
|
return;
|
|
1368
1509
|
}
|
|
1369
|
-
if (
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
}
|
|
1374
|
-
|
|
1375
|
-
var e2 = effect2.first;
|
|
1376
|
-
while (e2 !== null) {
|
|
1377
|
-
reset_branch(e2, tracked);
|
|
1378
|
-
e2 = e2.next;
|
|
1510
|
+
if (batch_values !== null) {
|
|
1511
|
+
if (effect_tracking() || current_batch?.is_fork) {
|
|
1512
|
+
batch_values.set(derived2, value);
|
|
1513
|
+
}
|
|
1514
|
+
} else {
|
|
1515
|
+
update_derived_status(derived2);
|
|
1379
1516
|
}
|
|
1380
1517
|
}
|
|
1381
|
-
function
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1518
|
+
function freeze_derived_effects(derived2) {
|
|
1519
|
+
if (derived2.effects === null) return;
|
|
1520
|
+
for (const e2 of derived2.effects) {
|
|
1521
|
+
if (e2.teardown || e2.ac) {
|
|
1522
|
+
e2.teardown?.();
|
|
1523
|
+
if (e2.ac !== null) {
|
|
1524
|
+
without_reactive_context(() => {
|
|
1525
|
+
e2.ac.abort(STALE_REACTION);
|
|
1526
|
+
e2.ac = null;
|
|
1527
|
+
});
|
|
1528
|
+
}
|
|
1529
|
+
if (e2.fn !== null) e2.teardown = noop;
|
|
1530
|
+
remove_reactions(e2, 0);
|
|
1531
|
+
destroy_effect_children(e2);
|
|
1532
|
+
}
|
|
1387
1533
|
}
|
|
1388
1534
|
}
|
|
1389
|
-
function
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
if (effect_tracking()) {
|
|
1395
|
-
get(version);
|
|
1396
|
-
render_effect(() => {
|
|
1397
|
-
if (subscribers === 0) {
|
|
1398
|
-
stop = untrack(() => start(() => increment(version)));
|
|
1399
|
-
}
|
|
1400
|
-
subscribers += 1;
|
|
1401
|
-
return () => {
|
|
1402
|
-
queue_micro_task(() => {
|
|
1403
|
-
subscribers -= 1;
|
|
1404
|
-
if (subscribers === 0) {
|
|
1405
|
-
stop?.();
|
|
1406
|
-
stop = void 0;
|
|
1407
|
-
increment(version);
|
|
1408
|
-
}
|
|
1409
|
-
});
|
|
1410
|
-
};
|
|
1411
|
-
});
|
|
1535
|
+
function unfreeze_derived_effects(derived2) {
|
|
1536
|
+
if (derived2.effects === null) return;
|
|
1537
|
+
for (const e2 of derived2.effects) {
|
|
1538
|
+
if (e2.teardown && e2.fn !== null) {
|
|
1539
|
+
update_effect(e2);
|
|
1412
1540
|
}
|
|
1413
|
-
}
|
|
1414
|
-
}
|
|
1415
|
-
var flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED;
|
|
1416
|
-
function boundary(node, props, children, transform_error) {
|
|
1417
|
-
new Boundary(node, props, children, transform_error);
|
|
1541
|
+
}
|
|
1418
1542
|
}
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1543
|
+
let first_batch = null;
|
|
1544
|
+
let last_batch = null;
|
|
1545
|
+
let current_batch = null;
|
|
1546
|
+
let previous_batch = null;
|
|
1547
|
+
let batch_values = null;
|
|
1548
|
+
let last_scheduled_effect = null;
|
|
1549
|
+
let is_flushing_sync = false;
|
|
1550
|
+
let is_processing = false;
|
|
1551
|
+
let collected_effects = null;
|
|
1552
|
+
let legacy_updates = null;
|
|
1553
|
+
var flush_count = 0;
|
|
1554
|
+
var source_stacks = /* @__PURE__ */ new Set();
|
|
1555
|
+
let uid = 1;
|
|
1556
|
+
const _Batch = class _Batch {
|
|
1557
|
+
constructor() {
|
|
1558
|
+
__privateAdd(this, _Batch_instances);
|
|
1559
|
+
__publicField(this, "id", uid++);
|
|
1560
|
+
/** True as soon as `#process` was called */
|
|
1561
|
+
__privateAdd(this, _started, false);
|
|
1562
|
+
__publicField(this, "linked", true);
|
|
1563
|
+
/** @type {Batch | null} */
|
|
1564
|
+
__privateAdd(this, _prev, null);
|
|
1565
|
+
/** @type {Batch | null} */
|
|
1566
|
+
__privateAdd(this, _next, null);
|
|
1567
|
+
/** @type {Map<Effect, ReturnType<typeof deferred<any>>>} */
|
|
1568
|
+
__publicField(this, "async_deriveds", /* @__PURE__ */ new Map());
|
|
1431
1569
|
/**
|
|
1432
|
-
*
|
|
1433
|
-
*
|
|
1434
|
-
*
|
|
1570
|
+
* The current values of any signals that are updated in this batch.
|
|
1571
|
+
* Tuple format: [value, is_derived] (note: is_derived is false for deriveds, too, if they were overridden via assignment)
|
|
1572
|
+
* They keys of this map are identical to `this.#previous`
|
|
1573
|
+
* @type {Map<Value, [any, boolean]>}
|
|
1574
|
+
*/
|
|
1575
|
+
__publicField(this, "current", /* @__PURE__ */ new Map());
|
|
1576
|
+
/**
|
|
1577
|
+
* The values of any signals (sources and deriveds) that are updated in this batch _before_ those updates took place.
|
|
1578
|
+
* They keys of this map are identical to `this.#current`
|
|
1579
|
+
* @type {Map<Value, any>}
|
|
1580
|
+
*/
|
|
1581
|
+
__publicField(this, "previous", /* @__PURE__ */ new Map());
|
|
1582
|
+
/**
|
|
1583
|
+
* When the batch is committed (and the DOM is updated), we need to remove old branches
|
|
1584
|
+
* and append new ones by calling the functions added inside (if/each/key/etc) blocks
|
|
1585
|
+
* @type {Set<(batch: Batch) => void>}
|
|
1586
|
+
*/
|
|
1587
|
+
__privateAdd(this, _commit_callbacks, /* @__PURE__ */ new Set());
|
|
1588
|
+
/**
|
|
1589
|
+
* If a fork is discarded, we need to destroy any effects that are no longer needed
|
|
1590
|
+
* @type {Set<(batch: Batch) => void>}
|
|
1591
|
+
*/
|
|
1592
|
+
__privateAdd(this, _discard_callbacks, /* @__PURE__ */ new Set());
|
|
1593
|
+
/**
|
|
1594
|
+
* The number of async effects that are currently in flight
|
|
1595
|
+
*/
|
|
1596
|
+
__privateAdd(this, _pending, 0);
|
|
1597
|
+
/**
|
|
1598
|
+
* Async effects that are currently in flight, _not_ inside a pending boundary
|
|
1599
|
+
* @type {Map<Effect, number>}
|
|
1600
|
+
*/
|
|
1601
|
+
__privateAdd(this, _blocking_pending, /* @__PURE__ */ new Map());
|
|
1602
|
+
/**
|
|
1603
|
+
* A deferred that resolves when the batch is committed, used with `settled()`
|
|
1604
|
+
* TODO replace with Promise.withResolvers once supported widely enough
|
|
1605
|
+
* @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}
|
|
1606
|
+
*/
|
|
1607
|
+
__privateAdd(this, _deferred, null);
|
|
1608
|
+
/**
|
|
1609
|
+
* The root effects that need to be flushed
|
|
1610
|
+
* @type {Effect[]}
|
|
1611
|
+
*/
|
|
1612
|
+
__privateAdd(this, _roots, []);
|
|
1613
|
+
/**
|
|
1614
|
+
* Effects created while this batch was active.
|
|
1615
|
+
* @type {Effect[]}
|
|
1616
|
+
*/
|
|
1617
|
+
__privateAdd(this, _new_effects, []);
|
|
1618
|
+
/**
|
|
1619
|
+
* Deferred effects (which run after async work has completed) that are DIRTY
|
|
1620
|
+
* @type {Set<Effect>}
|
|
1435
1621
|
*/
|
|
1436
|
-
__publicField(this, "transform_error");
|
|
1437
|
-
/** @type {TemplateNode} */
|
|
1438
|
-
__privateAdd(this, _anchor);
|
|
1439
|
-
/** @type {TemplateNode | null} */
|
|
1440
|
-
__privateAdd(this, _hydrate_open, hydrating ? hydrate_node : null);
|
|
1441
|
-
/** @type {BoundaryProps} */
|
|
1442
|
-
__privateAdd(this, _props);
|
|
1443
|
-
/** @type {((anchor: Node) => void)} */
|
|
1444
|
-
__privateAdd(this, _children);
|
|
1445
|
-
/** @type {Effect} */
|
|
1446
|
-
__privateAdd(this, _effect);
|
|
1447
|
-
/** @type {Effect | null} */
|
|
1448
|
-
__privateAdd(this, _main_effect, null);
|
|
1449
|
-
/** @type {Effect | null} */
|
|
1450
|
-
__privateAdd(this, _pending_effect, null);
|
|
1451
|
-
/** @type {Effect | null} */
|
|
1452
|
-
__privateAdd(this, _failed_effect, null);
|
|
1453
|
-
/** @type {DocumentFragment | null} */
|
|
1454
|
-
__privateAdd(this, _offscreen_fragment, null);
|
|
1455
|
-
__privateAdd(this, _local_pending_count, 0);
|
|
1456
|
-
__privateAdd(this, _pending_count, 0);
|
|
1457
|
-
__privateAdd(this, _pending_count_update_queued, false);
|
|
1458
|
-
/** @type {Set<Effect>} */
|
|
1459
1622
|
__privateAdd(this, _dirty_effects2, /* @__PURE__ */ new Set());
|
|
1460
|
-
/**
|
|
1623
|
+
/**
|
|
1624
|
+
* Deferred effects that are MAYBE_DIRTY
|
|
1625
|
+
* @type {Set<Effect>}
|
|
1626
|
+
*/
|
|
1461
1627
|
__privateAdd(this, _maybe_dirty_effects2, /* @__PURE__ */ new Set());
|
|
1462
1628
|
/**
|
|
1463
|
-
* A
|
|
1464
|
-
*
|
|
1465
|
-
*
|
|
1466
|
-
*
|
|
1467
|
-
* @type {
|
|
1629
|
+
* A map of branches that still exist, but will be destroyed when this batch
|
|
1630
|
+
* is committed — we skip over these during `process`.
|
|
1631
|
+
* The value contains child effects that were dirty/maybe_dirty before being reset,
|
|
1632
|
+
* so they can be rescheduled if the branch survives.
|
|
1633
|
+
* @type {Map<Effect, { d: Effect[], m: Effect[] }>}
|
|
1634
|
+
*/
|
|
1635
|
+
__privateAdd(this, _skipped_branches, /* @__PURE__ */ new Map());
|
|
1636
|
+
/**
|
|
1637
|
+
* Inverse of #skipped_branches which we need to tell prior batches to unskip them when committing
|
|
1638
|
+
* @type {Set<Effect>}
|
|
1468
1639
|
*/
|
|
1469
|
-
__privateAdd(this,
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
__privateSet(this, _props, props);
|
|
1478
|
-
__privateSet(this, _children, (anchor) => {
|
|
1479
|
-
var effect2 = (
|
|
1480
|
-
/** @type {Effect} */
|
|
1481
|
-
active_effect
|
|
1482
|
-
);
|
|
1483
|
-
effect2.b = this;
|
|
1484
|
-
effect2.f |= BOUNDARY_EFFECT;
|
|
1485
|
-
children(anchor);
|
|
1486
|
-
});
|
|
1487
|
-
this.parent = /** @type {Effect} */
|
|
1488
|
-
active_effect.b;
|
|
1489
|
-
this.transform_error = transform_error ?? this.parent?.transform_error ?? ((e2) => e2);
|
|
1490
|
-
__privateSet(this, _effect, block(() => {
|
|
1491
|
-
if (hydrating) {
|
|
1492
|
-
const comment2 = (
|
|
1493
|
-
/** @type {Comment} */
|
|
1494
|
-
__privateGet(this, _hydrate_open)
|
|
1495
|
-
);
|
|
1496
|
-
hydrate_next();
|
|
1497
|
-
const server_rendered_pending = comment2.data === HYDRATION_START_ELSE;
|
|
1498
|
-
const server_rendered_failed = comment2.data.startsWith(HYDRATION_START_FAILED);
|
|
1499
|
-
if (server_rendered_failed) {
|
|
1500
|
-
const serialized_error = JSON.parse(comment2.data.slice(HYDRATION_START_FAILED.length));
|
|
1501
|
-
__privateMethod(this, _Boundary_instances, hydrate_failed_content_fn).call(this, serialized_error);
|
|
1502
|
-
} else if (server_rendered_pending) {
|
|
1503
|
-
__privateMethod(this, _Boundary_instances, hydrate_pending_content_fn).call(this);
|
|
1504
|
-
} else {
|
|
1505
|
-
__privateMethod(this, _Boundary_instances, hydrate_resolved_content_fn).call(this);
|
|
1506
|
-
}
|
|
1507
|
-
} else {
|
|
1508
|
-
__privateMethod(this, _Boundary_instances, render_fn).call(this);
|
|
1509
|
-
}
|
|
1510
|
-
}, flags));
|
|
1511
|
-
if (hydrating) {
|
|
1512
|
-
__privateSet(this, _anchor, hydrate_node);
|
|
1640
|
+
__privateAdd(this, _unskipped_branches, /* @__PURE__ */ new Set());
|
|
1641
|
+
__publicField(this, "is_fork", false);
|
|
1642
|
+
__privateAdd(this, _decrement_queued, false);
|
|
1643
|
+
if (last_batch === null) {
|
|
1644
|
+
first_batch = last_batch = this;
|
|
1645
|
+
} else {
|
|
1646
|
+
__privateSet(last_batch, _next, this);
|
|
1647
|
+
__privateSet(this, _prev, last_batch);
|
|
1513
1648
|
}
|
|
1649
|
+
last_batch = this;
|
|
1514
1650
|
}
|
|
1515
1651
|
/**
|
|
1516
|
-
*
|
|
1652
|
+
* Add an effect to the #skipped_branches map and reset its children
|
|
1517
1653
|
* @param {Effect} effect
|
|
1518
1654
|
*/
|
|
1519
|
-
|
|
1520
|
-
|
|
1655
|
+
skip_effect(effect2) {
|
|
1656
|
+
if (!__privateGet(this, _skipped_branches).has(effect2)) {
|
|
1657
|
+
__privateGet(this, _skipped_branches).set(effect2, { d: [], m: [] });
|
|
1658
|
+
}
|
|
1659
|
+
__privateGet(this, _unskipped_branches).delete(effect2);
|
|
1521
1660
|
}
|
|
1522
1661
|
/**
|
|
1523
|
-
*
|
|
1524
|
-
*
|
|
1662
|
+
* Remove an effect from the #skipped_branches map and reschedule
|
|
1663
|
+
* any tracked dirty/maybe_dirty child effects
|
|
1664
|
+
* @param {Effect} effect
|
|
1665
|
+
* @param {(e: Effect) => void} callback
|
|
1525
1666
|
*/
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1667
|
+
unskip_effect(effect2, callback = (e2) => this.schedule(e2)) {
|
|
1668
|
+
var tracked = __privateGet(this, _skipped_branches).get(effect2);
|
|
1669
|
+
if (tracked) {
|
|
1670
|
+
__privateGet(this, _skipped_branches).delete(effect2);
|
|
1671
|
+
for (var e2 of tracked.d) {
|
|
1672
|
+
set_signal_status(e2, DIRTY);
|
|
1673
|
+
callback(e2);
|
|
1674
|
+
}
|
|
1675
|
+
for (e2 of tracked.m) {
|
|
1676
|
+
set_signal_status(e2, MAYBE_DIRTY);
|
|
1677
|
+
callback(e2);
|
|
1678
|
+
}
|
|
1679
|
+
}
|
|
1680
|
+
__privateGet(this, _unskipped_branches).add(effect2);
|
|
1531
1681
|
}
|
|
1532
1682
|
/**
|
|
1533
|
-
*
|
|
1534
|
-
*
|
|
1535
|
-
*
|
|
1536
|
-
* @param {
|
|
1537
|
-
* @param {
|
|
1683
|
+
* Associate a change to a given source with the current
|
|
1684
|
+
* batch, noting its previous and current values
|
|
1685
|
+
* @param {Value} source
|
|
1686
|
+
* @param {any} value
|
|
1687
|
+
* @param {boolean} [is_derived]
|
|
1538
1688
|
*/
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
if (!__privateGet(this, _effect_pending) || __privateGet(this, _pending_count_update_queued)) return;
|
|
1543
|
-
__privateSet(this, _pending_count_update_queued, true);
|
|
1544
|
-
queue_micro_task(() => {
|
|
1545
|
-
__privateSet(this, _pending_count_update_queued, false);
|
|
1546
|
-
if (__privateGet(this, _effect_pending)) {
|
|
1547
|
-
internal_set(__privateGet(this, _effect_pending), __privateGet(this, _local_pending_count));
|
|
1548
|
-
}
|
|
1549
|
-
});
|
|
1550
|
-
}
|
|
1551
|
-
get_effect_pending() {
|
|
1552
|
-
__privateGet(this, _effect_pending_subscriber).call(this);
|
|
1553
|
-
return get(
|
|
1554
|
-
/** @type {Source<number>} */
|
|
1555
|
-
__privateGet(this, _effect_pending)
|
|
1556
|
-
);
|
|
1557
|
-
}
|
|
1558
|
-
/** @param {unknown} error */
|
|
1559
|
-
error(error) {
|
|
1560
|
-
var onerror = __privateGet(this, _props).onerror;
|
|
1561
|
-
let failed = __privateGet(this, _props).failed;
|
|
1562
|
-
if (!onerror && !failed) {
|
|
1563
|
-
throw error;
|
|
1689
|
+
capture(source2, value, is_derived = false) {
|
|
1690
|
+
if (source2.v !== UNINITIALIZED && !this.previous.has(source2)) {
|
|
1691
|
+
this.previous.set(source2, source2.v);
|
|
1564
1692
|
}
|
|
1565
|
-
if (
|
|
1566
|
-
|
|
1567
|
-
|
|
1693
|
+
if ((source2.f & ERROR_VALUE) === 0) {
|
|
1694
|
+
this.current.set(source2, [value, is_derived]);
|
|
1695
|
+
batch_values?.set(source2, value);
|
|
1568
1696
|
}
|
|
1569
|
-
if (
|
|
1570
|
-
|
|
1571
|
-
__privateSet(this, _pending_effect, null);
|
|
1697
|
+
if (!this.is_fork) {
|
|
1698
|
+
source2.v = value;
|
|
1572
1699
|
}
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1700
|
+
}
|
|
1701
|
+
activate() {
|
|
1702
|
+
current_batch = this;
|
|
1703
|
+
}
|
|
1704
|
+
deactivate() {
|
|
1705
|
+
current_batch = null;
|
|
1706
|
+
batch_values = null;
|
|
1707
|
+
}
|
|
1708
|
+
flush() {
|
|
1709
|
+
try {
|
|
1710
|
+
if (DEV) ;
|
|
1711
|
+
is_processing = true;
|
|
1712
|
+
current_batch = this;
|
|
1713
|
+
__privateMethod(this, _Batch_instances, process_fn).call(this);
|
|
1714
|
+
} finally {
|
|
1715
|
+
flush_count = 0;
|
|
1716
|
+
last_scheduled_effect = null;
|
|
1717
|
+
collected_effects = null;
|
|
1718
|
+
legacy_updates = null;
|
|
1719
|
+
is_processing = false;
|
|
1720
|
+
current_batch = null;
|
|
1721
|
+
batch_values = null;
|
|
1722
|
+
old_values.clear();
|
|
1576
1723
|
}
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
set_hydrate_node(skip_nodes());
|
|
1724
|
+
}
|
|
1725
|
+
discard() {
|
|
1726
|
+
for (const fn of __privateGet(this, _discard_callbacks)) fn(this);
|
|
1727
|
+
__privateGet(this, _discard_callbacks).clear();
|
|
1728
|
+
for (const deferred2 of this.async_deriveds.values()) {
|
|
1729
|
+
deferred2.reject(OBSOLETE);
|
|
1584
1730
|
}
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1731
|
+
__privateMethod(this, _Batch_instances, unlink_fn).call(this);
|
|
1732
|
+
__privateGet(this, _deferred)?.resolve();
|
|
1733
|
+
}
|
|
1734
|
+
/**
|
|
1735
|
+
* @param {Effect} effect
|
|
1736
|
+
*/
|
|
1737
|
+
register_created_effect(effect2) {
|
|
1738
|
+
__privateGet(this, _new_effects).push(effect2);
|
|
1739
|
+
}
|
|
1740
|
+
/**
|
|
1741
|
+
* @param {boolean} blocking
|
|
1742
|
+
* @param {Effect} effect
|
|
1743
|
+
*/
|
|
1744
|
+
increment(blocking, effect2) {
|
|
1745
|
+
__privateSet(this, _pending, __privateGet(this, _pending) + 1);
|
|
1746
|
+
if (blocking) {
|
|
1747
|
+
let blocking_pending_count = __privateGet(this, _blocking_pending).get(effect2) ?? 0;
|
|
1748
|
+
__privateGet(this, _blocking_pending).set(effect2, blocking_pending_count + 1);
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
/**
|
|
1752
|
+
* @param {boolean} blocking
|
|
1753
|
+
* @param {Effect} effect
|
|
1754
|
+
*/
|
|
1755
|
+
decrement(blocking, effect2) {
|
|
1756
|
+
__privateSet(this, _pending, __privateGet(this, _pending) - 1);
|
|
1757
|
+
if (blocking) {
|
|
1758
|
+
let blocking_pending_count = __privateGet(this, _blocking_pending).get(effect2) ?? 0;
|
|
1759
|
+
if (blocking_pending_count === 1) {
|
|
1760
|
+
__privateGet(this, _blocking_pending).delete(effect2);
|
|
1761
|
+
} else {
|
|
1762
|
+
__privateGet(this, _blocking_pending).set(effect2, blocking_pending_count - 1);
|
|
1595
1763
|
}
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1764
|
+
}
|
|
1765
|
+
if (__privateGet(this, _decrement_queued)) return;
|
|
1766
|
+
__privateSet(this, _decrement_queued, true);
|
|
1767
|
+
queue_micro_task(() => {
|
|
1768
|
+
__privateSet(this, _decrement_queued, false);
|
|
1769
|
+
if (this.linked) {
|
|
1770
|
+
this.flush();
|
|
1600
1771
|
}
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
);
|
|
1635
|
-
return null;
|
|
1772
|
+
});
|
|
1773
|
+
}
|
|
1774
|
+
/**
|
|
1775
|
+
* @param {Set<Effect>} dirty_effects
|
|
1776
|
+
* @param {Set<Effect>} maybe_dirty_effects
|
|
1777
|
+
*/
|
|
1778
|
+
transfer_effects(dirty_effects, maybe_dirty_effects) {
|
|
1779
|
+
for (const e2 of dirty_effects) {
|
|
1780
|
+
__privateGet(this, _dirty_effects2).add(e2);
|
|
1781
|
+
}
|
|
1782
|
+
for (const e2 of maybe_dirty_effects) {
|
|
1783
|
+
__privateGet(this, _maybe_dirty_effects2).add(e2);
|
|
1784
|
+
}
|
|
1785
|
+
dirty_effects.clear();
|
|
1786
|
+
maybe_dirty_effects.clear();
|
|
1787
|
+
}
|
|
1788
|
+
/** @param {(batch: Batch) => void} fn */
|
|
1789
|
+
oncommit(fn) {
|
|
1790
|
+
__privateGet(this, _commit_callbacks).add(fn);
|
|
1791
|
+
}
|
|
1792
|
+
/** @param {(batch: Batch) => void} fn */
|
|
1793
|
+
ondiscard(fn) {
|
|
1794
|
+
__privateGet(this, _discard_callbacks).add(fn);
|
|
1795
|
+
}
|
|
1796
|
+
settled() {
|
|
1797
|
+
return (__privateGet(this, _deferred) ?? __privateSet(this, _deferred, deferred())).promise;
|
|
1798
|
+
}
|
|
1799
|
+
static ensure() {
|
|
1800
|
+
if (current_batch === null) {
|
|
1801
|
+
const batch = current_batch = new _Batch();
|
|
1802
|
+
if (!is_processing && !is_flushing_sync) {
|
|
1803
|
+
queue_micro_task(() => {
|
|
1804
|
+
if (!__privateGet(batch, _started)) {
|
|
1805
|
+
batch.flush();
|
|
1636
1806
|
}
|
|
1637
|
-
})
|
|
1807
|
+
});
|
|
1638
1808
|
}
|
|
1639
|
-
}
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1809
|
+
}
|
|
1810
|
+
return current_batch;
|
|
1811
|
+
}
|
|
1812
|
+
apply() {
|
|
1813
|
+
{
|
|
1814
|
+
batch_values = null;
|
|
1815
|
+
return;
|
|
1816
|
+
}
|
|
1817
|
+
}
|
|
1818
|
+
/**
|
|
1819
|
+
*
|
|
1820
|
+
* @param {Effect} effect
|
|
1821
|
+
*/
|
|
1822
|
+
schedule(effect2) {
|
|
1823
|
+
last_scheduled_effect = effect2;
|
|
1824
|
+
if (effect2.b?.is_pending && (effect2.f & (EFFECT | RENDER_EFFECT | MANAGED_EFFECT)) !== 0 && (effect2.f & REACTION_RAN) === 0) {
|
|
1825
|
+
effect2.b.defer_effect(effect2);
|
|
1826
|
+
return;
|
|
1827
|
+
}
|
|
1828
|
+
var e2 = effect2;
|
|
1829
|
+
while (e2.parent !== null) {
|
|
1830
|
+
e2 = e2.parent;
|
|
1831
|
+
var flags2 = e2.f;
|
|
1832
|
+
if (collected_effects !== null && e2 === active_effect) {
|
|
1833
|
+
if ((active_reaction === null || (active_reaction.f & DERIVED) === 0) && true) {
|
|
1834
|
+
return;
|
|
1835
|
+
}
|
|
1647
1836
|
}
|
|
1648
|
-
if (
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
(e2) => invoke_error_boundary(e2, __privateGet(this, _effect) && __privateGet(this, _effect).parent)
|
|
1654
|
-
);
|
|
1655
|
-
} else {
|
|
1656
|
-
handle_error_result(result);
|
|
1837
|
+
if ((flags2 & (ROOT_EFFECT | BRANCH_EFFECT)) !== 0) {
|
|
1838
|
+
if ((flags2 & CLEAN) === 0) {
|
|
1839
|
+
return;
|
|
1840
|
+
}
|
|
1841
|
+
e2.f ^= CLEAN;
|
|
1657
1842
|
}
|
|
1658
|
-
}
|
|
1843
|
+
}
|
|
1844
|
+
__privateGet(this, _roots).push(e2);
|
|
1659
1845
|
}
|
|
1660
|
-
}
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
_pending_count = new WeakMap();
|
|
1672
|
-
_pending_count_update_queued = new WeakMap();
|
|
1846
|
+
};
|
|
1847
|
+
_started = new WeakMap();
|
|
1848
|
+
_prev = new WeakMap();
|
|
1849
|
+
_next = new WeakMap();
|
|
1850
|
+
_commit_callbacks = new WeakMap();
|
|
1851
|
+
_discard_callbacks = new WeakMap();
|
|
1852
|
+
_pending = new WeakMap();
|
|
1853
|
+
_blocking_pending = new WeakMap();
|
|
1854
|
+
_deferred = new WeakMap();
|
|
1855
|
+
_roots = new WeakMap();
|
|
1856
|
+
_new_effects = new WeakMap();
|
|
1673
1857
|
_dirty_effects2 = new WeakMap();
|
|
1674
1858
|
_maybe_dirty_effects2 = new WeakMap();
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
hydrate_failed_content_fn = function(error) {
|
|
1689
|
-
const failed = __privateGet(this, _props).failed;
|
|
1690
|
-
if (!failed) return;
|
|
1691
|
-
__privateSet(this, _failed_effect, branch(() => {
|
|
1692
|
-
failed(
|
|
1693
|
-
__privateGet(this, _anchor),
|
|
1694
|
-
() => error,
|
|
1695
|
-
() => () => {
|
|
1859
|
+
_skipped_branches = new WeakMap();
|
|
1860
|
+
_unskipped_branches = new WeakMap();
|
|
1861
|
+
_decrement_queued = new WeakMap();
|
|
1862
|
+
_Batch_instances = new WeakSet();
|
|
1863
|
+
is_deferred_fn = function() {
|
|
1864
|
+
if (this.is_fork) return true;
|
|
1865
|
+
for (const effect2 of __privateGet(this, _blocking_pending).keys()) {
|
|
1866
|
+
var e2 = effect2;
|
|
1867
|
+
var skipped = false;
|
|
1868
|
+
while (e2.parent !== null) {
|
|
1869
|
+
if (__privateGet(this, _skipped_branches).has(e2)) {
|
|
1870
|
+
skipped = true;
|
|
1871
|
+
break;
|
|
1696
1872
|
}
|
|
1697
|
-
|
|
1698
|
-
}));
|
|
1699
|
-
};
|
|
1700
|
-
hydrate_pending_content_fn = function() {
|
|
1701
|
-
const pending = __privateGet(this, _props).pending;
|
|
1702
|
-
if (!pending) return;
|
|
1703
|
-
this.is_pending = true;
|
|
1704
|
-
__privateSet(this, _pending_effect, branch(() => pending(__privateGet(this, _anchor))));
|
|
1705
|
-
queue_micro_task(() => {
|
|
1706
|
-
var fragment = __privateSet(this, _offscreen_fragment, document.createDocumentFragment());
|
|
1707
|
-
var anchor = create_text();
|
|
1708
|
-
fragment.append(anchor);
|
|
1709
|
-
__privateSet(this, _main_effect, __privateMethod(this, _Boundary_instances, run_fn).call(this, () => {
|
|
1710
|
-
return branch(() => __privateGet(this, _children).call(this, anchor));
|
|
1711
|
-
}));
|
|
1712
|
-
if (__privateGet(this, _pending_count) === 0) {
|
|
1713
|
-
__privateGet(this, _anchor).before(fragment);
|
|
1714
|
-
__privateSet(this, _offscreen_fragment, null);
|
|
1715
|
-
pause_effect(
|
|
1716
|
-
/** @type {Effect} */
|
|
1717
|
-
__privateGet(this, _pending_effect),
|
|
1718
|
-
() => {
|
|
1719
|
-
__privateSet(this, _pending_effect, null);
|
|
1720
|
-
}
|
|
1721
|
-
);
|
|
1722
|
-
__privateMethod(this, _Boundary_instances, resolve_fn).call(
|
|
1723
|
-
this,
|
|
1724
|
-
/** @type {Batch} */
|
|
1725
|
-
current_batch
|
|
1726
|
-
);
|
|
1873
|
+
e2 = e2.parent;
|
|
1727
1874
|
}
|
|
1728
|
-
|
|
1875
|
+
if (!skipped) {
|
|
1876
|
+
return true;
|
|
1877
|
+
}
|
|
1878
|
+
}
|
|
1879
|
+
return false;
|
|
1729
1880
|
};
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1881
|
+
process_fn = function() {
|
|
1882
|
+
var _a3, _b2, _c;
|
|
1883
|
+
__privateSet(this, _started, true);
|
|
1884
|
+
if (flush_count++ > 1e3) {
|
|
1885
|
+
__privateMethod(this, _Batch_instances, unlink_fn).call(this);
|
|
1886
|
+
infinite_loop_guard();
|
|
1887
|
+
}
|
|
1888
|
+
for (const e2 of __privateGet(this, _dirty_effects2)) {
|
|
1889
|
+
__privateGet(this, _maybe_dirty_effects2).delete(e2);
|
|
1890
|
+
set_signal_status(e2, DIRTY);
|
|
1891
|
+
this.schedule(e2);
|
|
1892
|
+
}
|
|
1893
|
+
for (const e2 of __privateGet(this, _maybe_dirty_effects2)) {
|
|
1894
|
+
set_signal_status(e2, MAYBE_DIRTY);
|
|
1895
|
+
this.schedule(e2);
|
|
1896
|
+
}
|
|
1897
|
+
const roots = __privateGet(this, _roots);
|
|
1898
|
+
__privateSet(this, _roots, []);
|
|
1899
|
+
this.apply();
|
|
1900
|
+
var effects = collected_effects = [];
|
|
1901
|
+
var render_effects = [];
|
|
1902
|
+
var updates = legacy_updates = [];
|
|
1903
|
+
for (const root2 of roots) {
|
|
1904
|
+
try {
|
|
1905
|
+
__privateMethod(this, _Batch_instances, traverse_fn).call(this, root2, effects, render_effects);
|
|
1906
|
+
} catch (e2) {
|
|
1907
|
+
reset_all(root2);
|
|
1908
|
+
if (!__privateMethod(this, _Batch_instances, is_deferred_fn).call(this)) this.discard();
|
|
1909
|
+
throw e2;
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
current_batch = null;
|
|
1913
|
+
if (updates.length > 0) {
|
|
1914
|
+
var batch = _Batch.ensure();
|
|
1915
|
+
for (const e2 of updates) {
|
|
1916
|
+
batch.schedule(e2);
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
collected_effects = null;
|
|
1920
|
+
legacy_updates = null;
|
|
1921
|
+
if (__privateMethod(this, _Batch_instances, is_deferred_fn).call(this)) {
|
|
1922
|
+
__privateMethod(this, _Batch_instances, defer_effects_fn).call(this, render_effects);
|
|
1923
|
+
__privateMethod(this, _Batch_instances, defer_effects_fn).call(this, effects);
|
|
1924
|
+
for (const [e2, t2] of __privateGet(this, _skipped_branches)) {
|
|
1925
|
+
reset_branch(e2, t2);
|
|
1926
|
+
}
|
|
1927
|
+
if (updates.length > 0) {
|
|
1928
|
+
/** @type {unknown} */
|
|
1929
|
+
__privateMethod(_a3 = current_batch, _Batch_instances, process_fn).call(_a3);
|
|
1930
|
+
}
|
|
1931
|
+
return;
|
|
1932
|
+
}
|
|
1933
|
+
const earlier_batch = __privateMethod(this, _Batch_instances, find_earlier_batch_fn).call(this);
|
|
1934
|
+
if (earlier_batch) {
|
|
1935
|
+
__privateMethod(this, _Batch_instances, defer_effects_fn).call(this, render_effects);
|
|
1936
|
+
__privateMethod(this, _Batch_instances, defer_effects_fn).call(this, effects);
|
|
1937
|
+
__privateMethod(_b2 = earlier_batch, _Batch_instances, merge_fn).call(_b2, this);
|
|
1938
|
+
return;
|
|
1939
|
+
}
|
|
1940
|
+
__privateGet(this, _dirty_effects2).clear();
|
|
1941
|
+
__privateGet(this, _maybe_dirty_effects2).clear();
|
|
1942
|
+
for (const fn of __privateGet(this, _commit_callbacks)) fn(this);
|
|
1943
|
+
__privateGet(this, _commit_callbacks).clear();
|
|
1944
|
+
previous_batch = this;
|
|
1945
|
+
flush_queued_effects(render_effects);
|
|
1946
|
+
flush_queued_effects(effects);
|
|
1947
|
+
previous_batch = null;
|
|
1948
|
+
__privateGet(this, _deferred)?.resolve();
|
|
1949
|
+
var next_batch = (
|
|
1950
|
+
/** @type {Batch | null} */
|
|
1951
|
+
/** @type {unknown} */
|
|
1952
|
+
current_batch
|
|
1953
|
+
);
|
|
1954
|
+
if (__privateGet(this, _pending) === 0 && (__privateGet(this, _roots).length === 0 || next_batch !== null)) {
|
|
1955
|
+
__privateMethod(this, _Batch_instances, unlink_fn).call(this);
|
|
1956
|
+
}
|
|
1957
|
+
if (__privateGet(this, _roots).length > 0) {
|
|
1958
|
+
if (next_batch !== null) {
|
|
1959
|
+
const batch2 = next_batch;
|
|
1960
|
+
__privateGet(batch2, _roots).push(...__privateGet(this, _roots).filter((r2) => !__privateGet(batch2, _roots).includes(r2)));
|
|
1746
1961
|
} else {
|
|
1747
|
-
|
|
1748
|
-
this,
|
|
1749
|
-
/** @type {Batch} */
|
|
1750
|
-
current_batch
|
|
1751
|
-
);
|
|
1962
|
+
next_batch = this;
|
|
1752
1963
|
}
|
|
1753
|
-
} catch (error) {
|
|
1754
|
-
this.error(error);
|
|
1755
1964
|
}
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
* @param {Batch} batch
|
|
1759
|
-
*/
|
|
1760
|
-
resolve_fn = function(batch) {
|
|
1761
|
-
this.is_pending = false;
|
|
1762
|
-
batch.transfer_effects(__privateGet(this, _dirty_effects2), __privateGet(this, _maybe_dirty_effects2));
|
|
1763
|
-
};
|
|
1764
|
-
/**
|
|
1765
|
-
* @template T
|
|
1766
|
-
* @param {() => T} fn
|
|
1767
|
-
*/
|
|
1768
|
-
run_fn = function(fn) {
|
|
1769
|
-
var previous_effect = active_effect;
|
|
1770
|
-
var previous_reaction = active_reaction;
|
|
1771
|
-
var previous_ctx = component_context;
|
|
1772
|
-
set_active_effect(__privateGet(this, _effect));
|
|
1773
|
-
set_active_reaction(__privateGet(this, _effect));
|
|
1774
|
-
set_component_context(__privateGet(this, _effect).ctx);
|
|
1775
|
-
try {
|
|
1776
|
-
Batch.ensure();
|
|
1777
|
-
return fn();
|
|
1778
|
-
} catch (e2) {
|
|
1779
|
-
handle_error(e2);
|
|
1780
|
-
return null;
|
|
1781
|
-
} finally {
|
|
1782
|
-
set_active_effect(previous_effect);
|
|
1783
|
-
set_active_reaction(previous_reaction);
|
|
1784
|
-
set_component_context(previous_ctx);
|
|
1965
|
+
if (next_batch !== null) {
|
|
1966
|
+
__privateMethod(_c = next_batch, _Batch_instances, process_fn).call(_c);
|
|
1785
1967
|
}
|
|
1786
1968
|
};
|
|
1787
1969
|
/**
|
|
1788
|
-
*
|
|
1789
|
-
*
|
|
1790
|
-
* @param {
|
|
1791
|
-
* @param {
|
|
1970
|
+
* Traverse the effect tree, executing effects or stashing
|
|
1971
|
+
* them for later execution as appropriate
|
|
1972
|
+
* @param {Effect} root
|
|
1973
|
+
* @param {Effect[]} effects
|
|
1974
|
+
* @param {Effect[]} render_effects
|
|
1792
1975
|
*/
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1976
|
+
traverse_fn = function(root2, effects, render_effects) {
|
|
1977
|
+
root2.f ^= CLEAN;
|
|
1978
|
+
var effect2 = root2.first;
|
|
1979
|
+
while (effect2 !== null) {
|
|
1980
|
+
var flags2 = effect2.f;
|
|
1981
|
+
var is_branch = (flags2 & (BRANCH_EFFECT | ROOT_EFFECT)) !== 0;
|
|
1982
|
+
var is_skippable_branch = is_branch && (flags2 & CLEAN) !== 0;
|
|
1983
|
+
var skip = is_skippable_branch || (flags2 & INERT) !== 0 || __privateGet(this, _skipped_branches).has(effect2);
|
|
1984
|
+
if (!skip && effect2.fn !== null) {
|
|
1985
|
+
if (is_branch) {
|
|
1986
|
+
effect2.f ^= CLEAN;
|
|
1987
|
+
} else if ((flags2 & EFFECT) !== 0) {
|
|
1988
|
+
effects.push(effect2);
|
|
1989
|
+
} else if (is_dirty(effect2)) {
|
|
1990
|
+
if ((flags2 & BLOCK_EFFECT) !== 0) __privateGet(this, _maybe_dirty_effects2).add(effect2);
|
|
1991
|
+
update_effect(effect2);
|
|
1992
|
+
}
|
|
1993
|
+
var child2 = effect2.first;
|
|
1994
|
+
if (child2 !== null) {
|
|
1995
|
+
effect2 = child2;
|
|
1996
|
+
continue;
|
|
1997
|
+
}
|
|
1808
1998
|
}
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1999
|
+
while (effect2 !== null) {
|
|
2000
|
+
var next2 = effect2.next;
|
|
2001
|
+
if (next2 !== null) {
|
|
2002
|
+
effect2 = next2;
|
|
2003
|
+
break;
|
|
2004
|
+
}
|
|
2005
|
+
effect2 = effect2.parent;
|
|
1812
2006
|
}
|
|
1813
2007
|
}
|
|
1814
2008
|
};
|
|
1815
|
-
function
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
/** @type {Effect} */
|
|
1824
|
-
active_effect
|
|
1825
|
-
);
|
|
1826
|
-
var restore = capture();
|
|
1827
|
-
var blocker_promise = pending.length === 1 ? pending[0].promise : pending.length > 1 ? Promise.all(pending.map((b) => b.promise)) : null;
|
|
1828
|
-
function finish(values) {
|
|
1829
|
-
restore();
|
|
1830
|
-
try {
|
|
1831
|
-
fn(values);
|
|
1832
|
-
} catch (error) {
|
|
1833
|
-
if ((parent.f & DESTROYED) === 0) {
|
|
1834
|
-
invoke_error_boundary(error, parent);
|
|
2009
|
+
find_earlier_batch_fn = function() {
|
|
2010
|
+
var batch = __privateGet(this, _prev);
|
|
2011
|
+
while (batch !== null) {
|
|
2012
|
+
if (!batch.is_fork) {
|
|
2013
|
+
for (const [value, [, is_derived]] of this.current) {
|
|
2014
|
+
if (batch.current.has(value) && !is_derived) {
|
|
2015
|
+
return batch;
|
|
2016
|
+
}
|
|
1835
2017
|
}
|
|
1836
2018
|
}
|
|
1837
|
-
|
|
1838
|
-
}
|
|
1839
|
-
if (async.length === 0) {
|
|
1840
|
-
blocker_promise.then(() => finish(sync.map(d)));
|
|
1841
|
-
return;
|
|
1842
|
-
}
|
|
1843
|
-
var decrement_pending = increment_pending();
|
|
1844
|
-
function run() {
|
|
1845
|
-
Promise.all(async.map((expression) => /* @__PURE__ */ async_derived(expression))).then((result) => finish([...sync.map(d), ...result])).catch((error) => invoke_error_boundary(error, parent)).finally(() => decrement_pending());
|
|
1846
|
-
}
|
|
1847
|
-
if (blocker_promise) {
|
|
1848
|
-
blocker_promise.then(() => {
|
|
1849
|
-
restore();
|
|
1850
|
-
run();
|
|
1851
|
-
unset_context();
|
|
1852
|
-
});
|
|
1853
|
-
} else {
|
|
1854
|
-
run();
|
|
2019
|
+
batch = __privateGet(batch, _prev);
|
|
1855
2020
|
}
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
var
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
2021
|
+
return null;
|
|
2022
|
+
};
|
|
2023
|
+
/**
|
|
2024
|
+
* @param {Batch} batch
|
|
2025
|
+
*/
|
|
2026
|
+
merge_fn = function(batch) {
|
|
2027
|
+
var _a3;
|
|
2028
|
+
for (const [source2, value] of batch.current) {
|
|
2029
|
+
if (!this.previous.has(source2) && batch.previous.has(source2)) {
|
|
2030
|
+
this.previous.set(source2, batch.previous.get(source2));
|
|
2031
|
+
}
|
|
2032
|
+
this.current.set(source2, value);
|
|
2033
|
+
}
|
|
2034
|
+
for (const [effect2, deferred2] of batch.async_deriveds) {
|
|
2035
|
+
const d = this.async_deriveds.get(effect2);
|
|
2036
|
+
if (d) deferred2.promise.then(d.resolve).catch(d.reject);
|
|
2037
|
+
}
|
|
2038
|
+
batch.async_deriveds.clear();
|
|
2039
|
+
this.transfer_effects(__privateGet(batch, _dirty_effects2), __privateGet(batch, _maybe_dirty_effects2));
|
|
2040
|
+
const mark = (value) => {
|
|
2041
|
+
var reactions = value.reactions;
|
|
2042
|
+
if (reactions === null) return;
|
|
2043
|
+
if ((value.f & DERIVED) !== 0 && (value.f & (DIRTY | MAYBE_DIRTY)) === 0) {
|
|
2044
|
+
return;
|
|
2045
|
+
}
|
|
2046
|
+
for (const reaction of reactions) {
|
|
2047
|
+
var flags2 = reaction.f;
|
|
2048
|
+
if ((flags2 & DERIVED) !== 0) {
|
|
2049
|
+
mark(
|
|
2050
|
+
/** @type {Derived} */
|
|
2051
|
+
reaction
|
|
2052
|
+
);
|
|
2053
|
+
} else {
|
|
2054
|
+
var effect2 = (
|
|
2055
|
+
/** @type {Effect} */
|
|
2056
|
+
reaction
|
|
2057
|
+
);
|
|
2058
|
+
if (flags2 & (ASYNC | BLOCK_EFFECT) && !this.async_deriveds.has(effect2)) {
|
|
2059
|
+
__privateGet(this, _maybe_dirty_effects2).delete(effect2);
|
|
2060
|
+
set_signal_status(effect2, DIRTY);
|
|
2061
|
+
this.schedule(effect2);
|
|
2062
|
+
}
|
|
2063
|
+
}
|
|
1875
2064
|
}
|
|
1876
2065
|
};
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
set_active_effect(null);
|
|
1880
|
-
set_active_reaction(null);
|
|
1881
|
-
set_component_context(null);
|
|
1882
|
-
if (deactivate_batch) current_batch?.deactivate();
|
|
1883
|
-
}
|
|
1884
|
-
function increment_pending() {
|
|
1885
|
-
var effect2 = (
|
|
1886
|
-
/** @type {Effect} */
|
|
1887
|
-
active_effect
|
|
1888
|
-
);
|
|
1889
|
-
var boundary2 = (
|
|
1890
|
-
/** @type {Boundary} */
|
|
1891
|
-
effect2.b
|
|
1892
|
-
);
|
|
1893
|
-
var batch = (
|
|
1894
|
-
/** @type {Batch} */
|
|
1895
|
-
current_batch
|
|
1896
|
-
);
|
|
1897
|
-
var blocking = boundary2.is_rendered();
|
|
1898
|
-
boundary2.update_pending_count(1, batch);
|
|
1899
|
-
batch.increment(blocking, effect2);
|
|
1900
|
-
return (skip = false) => {
|
|
1901
|
-
boundary2.update_pending_count(-1, batch);
|
|
1902
|
-
batch.decrement(blocking, effect2, skip);
|
|
1903
|
-
};
|
|
1904
|
-
}
|
|
1905
|
-
// @__NO_SIDE_EFFECTS__
|
|
1906
|
-
function derived(fn) {
|
|
1907
|
-
var flags2 = DERIVED | DIRTY;
|
|
1908
|
-
var parent_derived = active_reaction !== null && (active_reaction.f & DERIVED) !== 0 ? (
|
|
1909
|
-
/** @type {Derived} */
|
|
1910
|
-
active_reaction
|
|
1911
|
-
) : null;
|
|
1912
|
-
if (active_effect !== null) {
|
|
1913
|
-
active_effect.f |= EFFECT_PRESERVED;
|
|
2066
|
+
for (const source2 of this.current.keys()) {
|
|
2067
|
+
mark(source2);
|
|
1914
2068
|
}
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
UNINITIALIZED
|
|
1927
|
-
),
|
|
1928
|
-
wv: 0,
|
|
1929
|
-
parent: parent_derived ?? active_effect,
|
|
1930
|
-
ac: null
|
|
1931
|
-
};
|
|
1932
|
-
return signal;
|
|
1933
|
-
}
|
|
1934
|
-
// @__NO_SIDE_EFFECTS__
|
|
1935
|
-
function async_derived(fn, label, location) {
|
|
1936
|
-
let parent = (
|
|
1937
|
-
/** @type {Effect | null} */
|
|
1938
|
-
active_effect
|
|
1939
|
-
);
|
|
1940
|
-
if (parent === null) {
|
|
1941
|
-
async_derived_orphan();
|
|
2069
|
+
this.oncommit(() => batch.discard());
|
|
2070
|
+
__privateMethod(_a3 = batch, _Batch_instances, unlink_fn).call(_a3);
|
|
2071
|
+
current_batch = this;
|
|
2072
|
+
__privateMethod(this, _Batch_instances, process_fn).call(this);
|
|
2073
|
+
};
|
|
2074
|
+
/**
|
|
2075
|
+
* @param {Effect[]} effects
|
|
2076
|
+
*/
|
|
2077
|
+
defer_effects_fn = function(effects) {
|
|
2078
|
+
for (var i = 0; i < effects.length; i += 1) {
|
|
2079
|
+
defer_effect(effects[i], __privateGet(this, _dirty_effects2), __privateGet(this, _maybe_dirty_effects2));
|
|
1942
2080
|
}
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
var d = deferred();
|
|
1960
|
-
promise = d.promise;
|
|
1961
|
-
try {
|
|
1962
|
-
Promise.resolve(fn()).then(d.resolve, d.reject).finally(unset_context);
|
|
1963
|
-
} catch (error) {
|
|
1964
|
-
d.reject(error);
|
|
1965
|
-
unset_context();
|
|
1966
|
-
}
|
|
1967
|
-
var batch = (
|
|
1968
|
-
/** @type {Batch} */
|
|
1969
|
-
current_batch
|
|
1970
|
-
);
|
|
1971
|
-
if (should_suspend) {
|
|
1972
|
-
if ((effect2.f & REACTION_RAN) !== 0) {
|
|
1973
|
-
var decrement_pending = increment_pending();
|
|
1974
|
-
}
|
|
1975
|
-
if (
|
|
1976
|
-
/** @type {Boundary} */
|
|
1977
|
-
parent.b.is_rendered()
|
|
1978
|
-
) {
|
|
1979
|
-
deferreds.get(batch)?.reject(STALE_REACTION);
|
|
1980
|
-
deferreds.delete(batch);
|
|
1981
|
-
} else {
|
|
1982
|
-
for (const d2 of deferreds.values()) {
|
|
1983
|
-
d2.reject(STALE_REACTION);
|
|
2081
|
+
};
|
|
2082
|
+
commit_fn = function() {
|
|
2083
|
+
var _a3;
|
|
2084
|
+
for (let batch = first_batch; batch !== null; batch = __privateGet(batch, _next)) {
|
|
2085
|
+
var is_earlier = batch.id < this.id;
|
|
2086
|
+
var sources = [];
|
|
2087
|
+
for (const [source3, [value, is_derived]] of this.current) {
|
|
2088
|
+
if (batch.current.has(source3)) {
|
|
2089
|
+
var batch_value = (
|
|
2090
|
+
/** @type {[any, boolean]} */
|
|
2091
|
+
batch.current.get(source3)[0]
|
|
2092
|
+
);
|
|
2093
|
+
if (is_earlier && value !== batch_value) {
|
|
2094
|
+
batch.current.set(source3, [value, is_derived]);
|
|
2095
|
+
} else {
|
|
2096
|
+
continue;
|
|
1984
2097
|
}
|
|
1985
|
-
deferreds.clear();
|
|
1986
2098
|
}
|
|
1987
|
-
|
|
2099
|
+
sources.push(source3);
|
|
1988
2100
|
}
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
2101
|
+
if (is_earlier) {
|
|
2102
|
+
for (const [effect2, deferred2] of this.async_deriveds) {
|
|
2103
|
+
const d = batch.async_deriveds.get(effect2);
|
|
2104
|
+
if (d) deferred2.promise.then(d.resolve).catch(d.reject);
|
|
1993
2105
|
}
|
|
1994
|
-
|
|
1995
|
-
|
|
2106
|
+
}
|
|
2107
|
+
var current = [...batch.current.keys()].filter(
|
|
2108
|
+
(source3) => !/** @type {[any, boolean]} */
|
|
2109
|
+
batch.current.get(source3)[1]
|
|
2110
|
+
);
|
|
2111
|
+
if (!__privateGet(batch, _started) || current.length === 0) continue;
|
|
2112
|
+
var others = current.filter((source3) => !this.current.has(source3));
|
|
2113
|
+
if (others.length === 0) {
|
|
2114
|
+
if (is_earlier) {
|
|
2115
|
+
batch.discard();
|
|
2116
|
+
}
|
|
2117
|
+
} else if (sources.length > 0) {
|
|
2118
|
+
if (is_earlier) {
|
|
2119
|
+
for (const unskipped of __privateGet(this, _unskipped_branches)) {
|
|
2120
|
+
batch.unskip_effect(unskipped, (e2) => {
|
|
2121
|
+
var _a4;
|
|
2122
|
+
if ((e2.f & (BLOCK_EFFECT | ASYNC)) !== 0) {
|
|
2123
|
+
batch.schedule(e2);
|
|
2124
|
+
} else {
|
|
2125
|
+
__privateMethod(_a4 = batch, _Batch_instances, defer_effects_fn).call(_a4, [e2]);
|
|
2126
|
+
}
|
|
2127
|
+
});
|
|
2128
|
+
}
|
|
1996
2129
|
}
|
|
1997
2130
|
batch.activate();
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2131
|
+
var marked = /* @__PURE__ */ new Set();
|
|
2132
|
+
var checked = /* @__PURE__ */ new Map();
|
|
2133
|
+
for (var source2 of sources) {
|
|
2134
|
+
mark_effects(source2, others, marked, checked);
|
|
2135
|
+
}
|
|
2136
|
+
checked = /* @__PURE__ */ new Map();
|
|
2137
|
+
var current_unequal = [...batch.current].filter(([c2, v1]) => {
|
|
2138
|
+
const v2 = this.current.get(c2);
|
|
2139
|
+
if (!v2) return true;
|
|
2140
|
+
return v2[0] !== v1[0] || v2[1] !== v1[1];
|
|
2141
|
+
}).map(([c2]) => c2);
|
|
2142
|
+
if (current_unequal.length > 0) {
|
|
2143
|
+
for (const effect2 of __privateGet(this, _new_effects)) {
|
|
2144
|
+
if ((effect2.f & (DESTROYED | INERT | EAGER_EFFECT)) === 0 && depends_on(effect2, current_unequal, checked)) {
|
|
2145
|
+
if ((effect2.f & (ASYNC | BLOCK_EFFECT)) !== 0) {
|
|
2146
|
+
set_signal_status(effect2, DIRTY);
|
|
2147
|
+
batch.schedule(effect2);
|
|
2148
|
+
} else {
|
|
2149
|
+
__privateGet(batch, _dirty_effects2).add(effect2);
|
|
2150
|
+
}
|
|
2151
|
+
}
|
|
2004
2152
|
}
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2153
|
+
}
|
|
2154
|
+
if (__privateGet(batch, _roots).length > 0 && !__privateGet(batch, _decrement_queued)) {
|
|
2155
|
+
batch.apply();
|
|
2156
|
+
for (var root2 of __privateGet(batch, _roots)) {
|
|
2157
|
+
__privateMethod(_a3 = batch, _Batch_instances, traverse_fn).call(_a3, root2, [], []);
|
|
2010
2158
|
}
|
|
2159
|
+
__privateSet(batch, _roots, []);
|
|
2011
2160
|
}
|
|
2012
2161
|
batch.deactivate();
|
|
2013
|
-
};
|
|
2014
|
-
d.promise.then(handler, (e2) => handler(null, e2 || "unknown"));
|
|
2015
|
-
});
|
|
2016
|
-
teardown(() => {
|
|
2017
|
-
for (const d of deferreds.values()) {
|
|
2018
|
-
d.reject(STALE_REACTION);
|
|
2019
2162
|
}
|
|
2020
|
-
}
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2163
|
+
}
|
|
2164
|
+
};
|
|
2165
|
+
unlink_fn = function() {
|
|
2166
|
+
if (!this.linked) return;
|
|
2167
|
+
var prev = __privateGet(this, _prev);
|
|
2168
|
+
var next2 = __privateGet(this, _next);
|
|
2169
|
+
if (prev === null) {
|
|
2170
|
+
first_batch = next2;
|
|
2171
|
+
} else {
|
|
2172
|
+
__privateSet(prev, _next, next2);
|
|
2173
|
+
}
|
|
2174
|
+
if (next2 === null) {
|
|
2175
|
+
last_batch = prev;
|
|
2176
|
+
} else {
|
|
2177
|
+
__privateSet(next2, _prev, prev);
|
|
2178
|
+
}
|
|
2179
|
+
this.linked = false;
|
|
2180
|
+
};
|
|
2181
|
+
let Batch = _Batch;
|
|
2182
|
+
function flushSync(fn) {
|
|
2183
|
+
var was_flushing_sync = is_flushing_sync;
|
|
2184
|
+
is_flushing_sync = true;
|
|
2185
|
+
try {
|
|
2186
|
+
var result;
|
|
2187
|
+
if (fn) ;
|
|
2188
|
+
while (true) {
|
|
2189
|
+
flush_tasks();
|
|
2190
|
+
if (current_batch === null) {
|
|
2191
|
+
return (
|
|
2192
|
+
/** @type {T} */
|
|
2193
|
+
result
|
|
2194
|
+
);
|
|
2029
2195
|
}
|
|
2030
|
-
|
|
2196
|
+
current_batch.flush();
|
|
2031
2197
|
}
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
}
|
|
2035
|
-
// @__NO_SIDE_EFFECTS__
|
|
2036
|
-
function user_derived(fn) {
|
|
2037
|
-
const d = /* @__PURE__ */ derived(fn);
|
|
2038
|
-
push_reaction_value(d);
|
|
2039
|
-
return d;
|
|
2040
|
-
}
|
|
2041
|
-
// @__NO_SIDE_EFFECTS__
|
|
2042
|
-
function derived_safe_equal(fn) {
|
|
2043
|
-
const signal = /* @__PURE__ */ derived(fn);
|
|
2044
|
-
signal.equals = safe_equals;
|
|
2045
|
-
return signal;
|
|
2198
|
+
} finally {
|
|
2199
|
+
is_flushing_sync = was_flushing_sync;
|
|
2200
|
+
}
|
|
2046
2201
|
}
|
|
2047
|
-
function
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
destroy_effect(
|
|
2053
|
-
/** @type {Effect} */
|
|
2054
|
-
effects[i]
|
|
2055
|
-
);
|
|
2056
|
-
}
|
|
2202
|
+
function infinite_loop_guard() {
|
|
2203
|
+
try {
|
|
2204
|
+
effect_update_depth_exceeded();
|
|
2205
|
+
} catch (error) {
|
|
2206
|
+
invoke_error_boundary(error, last_scheduled_effect);
|
|
2057
2207
|
}
|
|
2058
2208
|
}
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2209
|
+
let eager_block_effects = null;
|
|
2210
|
+
function flush_queued_effects(effects) {
|
|
2211
|
+
var length = effects.length;
|
|
2212
|
+
if (length === 0) return;
|
|
2213
|
+
var i = 0;
|
|
2214
|
+
while (i < length) {
|
|
2215
|
+
var effect2 = effects[i++];
|
|
2216
|
+
if ((effect2.f & (DESTROYED | INERT)) === 0 && is_dirty(effect2)) {
|
|
2217
|
+
eager_block_effects = /* @__PURE__ */ new Set();
|
|
2218
|
+
update_effect(effect2);
|
|
2219
|
+
if (effect2.deps === null && effect2.first === null && effect2.nodes === null && effect2.teardown === null && effect2.ac === null) {
|
|
2220
|
+
unlink_effect(effect2);
|
|
2221
|
+
}
|
|
2222
|
+
if (eager_block_effects?.size > 0) {
|
|
2223
|
+
old_values.clear();
|
|
2224
|
+
for (const e2 of eager_block_effects) {
|
|
2225
|
+
if ((e2.f & (DESTROYED | INERT)) !== 0) continue;
|
|
2226
|
+
const ordered_effects = [e2];
|
|
2227
|
+
let ancestor = e2.parent;
|
|
2228
|
+
while (ancestor !== null) {
|
|
2229
|
+
if (eager_block_effects.has(ancestor)) {
|
|
2230
|
+
eager_block_effects.delete(ancestor);
|
|
2231
|
+
ordered_effects.push(ancestor);
|
|
2232
|
+
}
|
|
2233
|
+
ancestor = ancestor.parent;
|
|
2234
|
+
}
|
|
2235
|
+
for (let j = ordered_effects.length - 1; j >= 0; j--) {
|
|
2236
|
+
const e3 = ordered_effects[j];
|
|
2237
|
+
if ((e3.f & (DESTROYED | INERT)) !== 0) continue;
|
|
2238
|
+
update_effect(e3);
|
|
2239
|
+
}
|
|
2240
|
+
}
|
|
2241
|
+
eager_block_effects.clear();
|
|
2242
|
+
}
|
|
2067
2243
|
}
|
|
2068
|
-
parent = parent.parent;
|
|
2069
2244
|
}
|
|
2070
|
-
|
|
2245
|
+
eager_block_effects = null;
|
|
2071
2246
|
}
|
|
2072
|
-
function
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2247
|
+
function mark_effects(value, sources, marked, checked) {
|
|
2248
|
+
if (marked.has(value)) return;
|
|
2249
|
+
marked.add(value);
|
|
2250
|
+
if (value.reactions !== null) {
|
|
2251
|
+
for (const reaction of value.reactions) {
|
|
2252
|
+
const flags2 = reaction.f;
|
|
2253
|
+
if ((flags2 & DERIVED) !== 0) {
|
|
2254
|
+
mark_effects(
|
|
2255
|
+
/** @type {Derived} */
|
|
2256
|
+
reaction,
|
|
2257
|
+
sources,
|
|
2258
|
+
marked,
|
|
2259
|
+
checked
|
|
2260
|
+
);
|
|
2261
|
+
} else if ((flags2 & (ASYNC | BLOCK_EFFECT)) !== 0 && (flags2 & DIRTY) === 0 && depends_on(reaction, sources, checked)) {
|
|
2262
|
+
set_signal_status(reaction, DIRTY);
|
|
2263
|
+
schedule_effect(
|
|
2264
|
+
/** @type {Effect} */
|
|
2265
|
+
reaction
|
|
2266
|
+
);
|
|
2267
|
+
}
|
|
2083
2268
|
}
|
|
2084
2269
|
}
|
|
2085
|
-
return value;
|
|
2086
2270
|
}
|
|
2087
|
-
function
|
|
2088
|
-
|
|
2089
|
-
if (
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
if (
|
|
2093
|
-
|
|
2094
|
-
} else {
|
|
2095
|
-
derived2.v = value;
|
|
2271
|
+
function depends_on(reaction, sources, checked) {
|
|
2272
|
+
const depends = checked.get(reaction);
|
|
2273
|
+
if (depends !== void 0) return depends;
|
|
2274
|
+
if (reaction.deps !== null) {
|
|
2275
|
+
for (const dep of reaction.deps) {
|
|
2276
|
+
if (includes.call(sources, dep)) {
|
|
2277
|
+
return true;
|
|
2096
2278
|
}
|
|
2097
|
-
if (
|
|
2098
|
-
|
|
2099
|
-
|
|
2279
|
+
if ((dep.f & DERIVED) !== 0 && depends_on(
|
|
2280
|
+
/** @type {Derived} */
|
|
2281
|
+
dep,
|
|
2282
|
+
sources,
|
|
2283
|
+
checked
|
|
2284
|
+
)) {
|
|
2285
|
+
checked.set(
|
|
2286
|
+
/** @type {Derived} */
|
|
2287
|
+
dep,
|
|
2288
|
+
true
|
|
2289
|
+
);
|
|
2290
|
+
return true;
|
|
2100
2291
|
}
|
|
2101
2292
|
}
|
|
2102
2293
|
}
|
|
2103
|
-
|
|
2294
|
+
checked.set(reaction, false);
|
|
2295
|
+
return false;
|
|
2296
|
+
}
|
|
2297
|
+
function schedule_effect(effect2) {
|
|
2298
|
+
current_batch.schedule(effect2);
|
|
2299
|
+
}
|
|
2300
|
+
function reset_branch(effect2, tracked) {
|
|
2301
|
+
if ((effect2.f & BRANCH_EFFECT) !== 0 && (effect2.f & CLEAN) !== 0) {
|
|
2104
2302
|
return;
|
|
2105
2303
|
}
|
|
2106
|
-
if (
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
} else {
|
|
2111
|
-
update_derived_status(derived2);
|
|
2304
|
+
if ((effect2.f & DIRTY) !== 0) {
|
|
2305
|
+
tracked.d.push(effect2);
|
|
2306
|
+
} else if ((effect2.f & MAYBE_DIRTY) !== 0) {
|
|
2307
|
+
tracked.m.push(effect2);
|
|
2112
2308
|
}
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
e2.teardown?.();
|
|
2119
|
-
e2.ac?.abort(STALE_REACTION);
|
|
2120
|
-
e2.teardown = noop;
|
|
2121
|
-
e2.ac = null;
|
|
2122
|
-
remove_reactions(e2, 0);
|
|
2123
|
-
destroy_effect_children(e2);
|
|
2124
|
-
}
|
|
2309
|
+
set_signal_status(effect2, CLEAN);
|
|
2310
|
+
var e2 = effect2.first;
|
|
2311
|
+
while (e2 !== null) {
|
|
2312
|
+
reset_branch(e2, tracked);
|
|
2313
|
+
e2 = e2.next;
|
|
2125
2314
|
}
|
|
2126
2315
|
}
|
|
2127
|
-
function
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2316
|
+
function reset_all(effect2) {
|
|
2317
|
+
set_signal_status(effect2, CLEAN);
|
|
2318
|
+
var e2 = effect2.first;
|
|
2319
|
+
while (e2 !== null) {
|
|
2320
|
+
reset_all(e2);
|
|
2321
|
+
e2 = e2.next;
|
|
2133
2322
|
}
|
|
2134
2323
|
}
|
|
2135
2324
|
let eager_effects = /* @__PURE__ */ new Set();
|
|
@@ -2164,7 +2353,7 @@ function mutable_source(initial_value, immutable = false, trackable = true) {
|
|
|
2164
2353
|
function set(source2, value, should_proxy = false) {
|
|
2165
2354
|
if (active_reaction !== null && // since we are untracking the function inside `$inspect.with` we need to add this check
|
|
2166
2355
|
// to ensure we error if state is set inside an inspect effect
|
|
2167
|
-
(!untracking || (active_reaction.f & EAGER_EFFECT) !== 0) && is_runes() && (active_reaction.f & (DERIVED | BLOCK_EFFECT | ASYNC | EAGER_EFFECT)) !== 0 && (current_sources === null || !
|
|
2356
|
+
(!untracking || (active_reaction.f & EAGER_EFFECT) !== 0) && is_runes() && (active_reaction.f & (DERIVED | BLOCK_EFFECT | ASYNC | EAGER_EFFECT)) !== 0 && (current_sources === null || !current_sources.has(source2))) {
|
|
2168
2357
|
state_unsafe_mutation();
|
|
2169
2358
|
}
|
|
2170
2359
|
let new_value = should_proxy ? proxy(value) : value;
|
|
@@ -2208,7 +2397,13 @@ function flush_eager_effects() {
|
|
|
2208
2397
|
if ((effect2.f & CLEAN) !== 0) {
|
|
2209
2398
|
set_signal_status(effect2, MAYBE_DIRTY);
|
|
2210
2399
|
}
|
|
2211
|
-
|
|
2400
|
+
let dirty;
|
|
2401
|
+
try {
|
|
2402
|
+
dirty = is_dirty(effect2);
|
|
2403
|
+
} catch {
|
|
2404
|
+
dirty = true;
|
|
2405
|
+
}
|
|
2406
|
+
if (dirty) {
|
|
2212
2407
|
update_effect(effect2);
|
|
2213
2408
|
}
|
|
2214
2409
|
}
|
|
@@ -2228,14 +2423,19 @@ function mark_reactions(signal, status, updated_during_traversal) {
|
|
|
2228
2423
|
if (not_dirty) {
|
|
2229
2424
|
set_signal_status(reaction, status);
|
|
2230
2425
|
}
|
|
2231
|
-
if ((flags2 &
|
|
2426
|
+
if ((flags2 & EAGER_EFFECT) !== 0) {
|
|
2427
|
+
eager_effects.add(
|
|
2428
|
+
/** @type {Effect} */
|
|
2429
|
+
reaction
|
|
2430
|
+
);
|
|
2431
|
+
} else if ((flags2 & DERIVED) !== 0) {
|
|
2232
2432
|
var derived2 = (
|
|
2233
2433
|
/** @type {Derived} */
|
|
2234
2434
|
reaction
|
|
2235
2435
|
);
|
|
2236
2436
|
batch_values?.delete(derived2);
|
|
2237
2437
|
if ((flags2 & WAS_MARKED) === 0) {
|
|
2238
|
-
if (flags2 & CONNECTED) {
|
|
2438
|
+
if (flags2 & CONNECTED && (active_effect === null || (active_effect.f & REACTION_IS_UPDATING) === 0)) {
|
|
2239
2439
|
reaction.f |= WAS_MARKED;
|
|
2240
2440
|
}
|
|
2241
2441
|
mark_reactions(derived2, MAYBE_DIRTY, updated_during_traversal);
|
|
@@ -2256,55 +2456,6 @@ function mark_reactions(signal, status, updated_during_traversal) {
|
|
|
2256
2456
|
}
|
|
2257
2457
|
}
|
|
2258
2458
|
}
|
|
2259
|
-
let listening_to_form_reset = false;
|
|
2260
|
-
function add_form_reset_listener() {
|
|
2261
|
-
if (!listening_to_form_reset) {
|
|
2262
|
-
listening_to_form_reset = true;
|
|
2263
|
-
document.addEventListener(
|
|
2264
|
-
"reset",
|
|
2265
|
-
(evt) => {
|
|
2266
|
-
Promise.resolve().then(() => {
|
|
2267
|
-
if (!evt.defaultPrevented) {
|
|
2268
|
-
for (
|
|
2269
|
-
const e2 of
|
|
2270
|
-
/**@type {HTMLFormElement} */
|
|
2271
|
-
evt.target.elements
|
|
2272
|
-
) {
|
|
2273
|
-
e2.__on_r?.();
|
|
2274
|
-
}
|
|
2275
|
-
}
|
|
2276
|
-
});
|
|
2277
|
-
},
|
|
2278
|
-
// In the capture phase to guarantee we get noticed of it (no possibility of stopPropagation)
|
|
2279
|
-
{ capture: true }
|
|
2280
|
-
);
|
|
2281
|
-
}
|
|
2282
|
-
}
|
|
2283
|
-
function without_reactive_context(fn) {
|
|
2284
|
-
var previous_reaction = active_reaction;
|
|
2285
|
-
var previous_effect = active_effect;
|
|
2286
|
-
set_active_reaction(null);
|
|
2287
|
-
set_active_effect(null);
|
|
2288
|
-
try {
|
|
2289
|
-
return fn();
|
|
2290
|
-
} finally {
|
|
2291
|
-
set_active_reaction(previous_reaction);
|
|
2292
|
-
set_active_effect(previous_effect);
|
|
2293
|
-
}
|
|
2294
|
-
}
|
|
2295
|
-
function listen_to_event_and_reset_event(element, event, handler, on_reset = handler) {
|
|
2296
|
-
element.addEventListener(event, () => without_reactive_context(handler));
|
|
2297
|
-
const prev = element.__on_r;
|
|
2298
|
-
if (prev) {
|
|
2299
|
-
element.__on_r = () => {
|
|
2300
|
-
prev();
|
|
2301
|
-
on_reset(true);
|
|
2302
|
-
};
|
|
2303
|
-
} else {
|
|
2304
|
-
element.__on_r = () => on_reset(true);
|
|
2305
|
-
}
|
|
2306
|
-
add_form_reset_listener();
|
|
2307
|
-
}
|
|
2308
2459
|
let is_updating_effect = false;
|
|
2309
2460
|
let is_destroying_effect = false;
|
|
2310
2461
|
function set_is_destroying_effect(value) {
|
|
@@ -2322,11 +2473,7 @@ function set_active_effect(effect2) {
|
|
|
2322
2473
|
let current_sources = null;
|
|
2323
2474
|
function push_reaction_value(value) {
|
|
2324
2475
|
if (active_reaction !== null && true) {
|
|
2325
|
-
|
|
2326
|
-
current_sources = [value];
|
|
2327
|
-
} else {
|
|
2328
|
-
current_sources.push(value);
|
|
2329
|
-
}
|
|
2476
|
+
(current_sources ?? (current_sources = /* @__PURE__ */ new Set())).add(value);
|
|
2330
2477
|
}
|
|
2331
2478
|
}
|
|
2332
2479
|
let new_deps = null;
|
|
@@ -2384,7 +2531,7 @@ function is_dirty(reaction) {
|
|
|
2384
2531
|
function schedule_possible_effect_self_invalidation(signal, effect2, root2 = true) {
|
|
2385
2532
|
var reactions = signal.reactions;
|
|
2386
2533
|
if (reactions === null) return;
|
|
2387
|
-
if (current_sources !== null &&
|
|
2534
|
+
if (current_sources !== null && current_sources.has(signal)) {
|
|
2388
2535
|
return;
|
|
2389
2536
|
}
|
|
2390
2537
|
for (var i = 0; i < reactions.length; i++) {
|
|
@@ -2545,6 +2692,13 @@ function remove_reaction(signal, dependency) {
|
|
|
2545
2692
|
if (derived2.v !== UNINITIALIZED) {
|
|
2546
2693
|
update_derived_status(derived2);
|
|
2547
2694
|
}
|
|
2695
|
+
if (derived2.ac !== null) {
|
|
2696
|
+
without_reactive_context(() => {
|
|
2697
|
+
derived2.ac.abort(STALE_REACTION);
|
|
2698
|
+
derived2.ac = null;
|
|
2699
|
+
set_signal_status(derived2, DIRTY);
|
|
2700
|
+
});
|
|
2701
|
+
}
|
|
2548
2702
|
freeze_derived_effects(derived2);
|
|
2549
2703
|
remove_reactions(derived2, 0);
|
|
2550
2704
|
}
|
|
@@ -2565,7 +2719,7 @@ function update_effect(effect2) {
|
|
|
2565
2719
|
var previous_effect = active_effect;
|
|
2566
2720
|
var was_updating_effect = is_updating_effect;
|
|
2567
2721
|
active_effect = effect2;
|
|
2568
|
-
is_updating_effect =
|
|
2722
|
+
is_updating_effect = (flags2 & (BRANCH_EFFECT | ROOT_EFFECT)) === 0;
|
|
2569
2723
|
try {
|
|
2570
2724
|
if ((flags2 & (BLOCK_EFFECT | MANAGED_EFFECT)) !== 0) {
|
|
2571
2725
|
destroy_block_effect_children(effect2);
|
|
@@ -2588,7 +2742,7 @@ function get(signal) {
|
|
|
2588
2742
|
var is_derived = (flags2 & DERIVED) !== 0;
|
|
2589
2743
|
if (active_reaction !== null && !untracking) {
|
|
2590
2744
|
var destroyed = active_effect !== null && (active_effect.f & DESTROYED) !== 0;
|
|
2591
|
-
if (!destroyed && (current_sources === null || !
|
|
2745
|
+
if (!destroyed && (current_sources === null || !current_sources.has(signal))) {
|
|
2592
2746
|
var deps = active_reaction.deps;
|
|
2593
2747
|
if ((active_reaction.f & REACTION_IS_UPDATING) !== 0) {
|
|
2594
2748
|
if (signal.rv < read_version) {
|
|
@@ -2602,7 +2756,10 @@ function get(signal) {
|
|
|
2602
2756
|
}
|
|
2603
2757
|
}
|
|
2604
2758
|
} else {
|
|
2605
|
-
|
|
2759
|
+
active_reaction.deps ?? (active_reaction.deps = []);
|
|
2760
|
+
if (!includes.call(active_reaction.deps, signal)) {
|
|
2761
|
+
active_reaction.deps.push(signal);
|
|
2762
|
+
}
|
|
2606
2763
|
var reactions = signal.reactions;
|
|
2607
2764
|
if (reactions === null) {
|
|
2608
2765
|
signal.reactions = [active_reaction];
|
|
@@ -2786,7 +2943,7 @@ function user_effect(fn) {
|
|
|
2786
2943
|
/** @type {Effect} */
|
|
2787
2944
|
active_effect.f
|
|
2788
2945
|
);
|
|
2789
|
-
var defer = !active_reaction && (flags2 & BRANCH_EFFECT) !== 0 &&
|
|
2946
|
+
var defer = !active_reaction && (flags2 & BRANCH_EFFECT) !== 0 && component_context !== null && !component_context.i;
|
|
2790
2947
|
if (defer) {
|
|
2791
2948
|
var context = (
|
|
2792
2949
|
/** @type {ComponentContext} */
|
|
@@ -2828,7 +2985,9 @@ function render_effect(fn, flags2 = 0) {
|
|
|
2828
2985
|
}
|
|
2829
2986
|
function template_effect(fn, sync = [], async = [], blockers = []) {
|
|
2830
2987
|
flatten(blockers, sync, async, (values) => {
|
|
2831
|
-
create_effect(RENDER_EFFECT, () =>
|
|
2988
|
+
create_effect(RENDER_EFFECT, () => {
|
|
2989
|
+
fn(...values.map(get));
|
|
2990
|
+
});
|
|
2832
2991
|
});
|
|
2833
2992
|
}
|
|
2834
2993
|
function block(fn, flags2 = 0) {
|
|
@@ -2892,7 +3051,7 @@ function destroy_effect(effect2, remove_dom = true) {
|
|
|
2892
3051
|
);
|
|
2893
3052
|
removed = true;
|
|
2894
3053
|
}
|
|
2895
|
-
|
|
3054
|
+
effect2.f |= DESTROYING;
|
|
2896
3055
|
destroy_effect_children(effect2, remove_dom && !removed);
|
|
2897
3056
|
remove_reactions(effect2, 0);
|
|
2898
3057
|
var transitions = effect2.nodes && effect2.nodes.t;
|
|
@@ -2959,11 +3118,13 @@ function pause_children(effect2, transitions, local) {
|
|
|
2959
3118
|
var child2 = effect2.first;
|
|
2960
3119
|
while (child2 !== null) {
|
|
2961
3120
|
var sibling2 = child2.next;
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
3121
|
+
if ((child2.f & ROOT_EFFECT) === 0) {
|
|
3122
|
+
var transparent = (child2.f & EFFECT_TRANSPARENT) !== 0 || // If this is a branch effect without a block effect parent,
|
|
3123
|
+
// it means the parent block effect was pruned. In that case,
|
|
3124
|
+
// transparency information was transferred to the branch effect.
|
|
3125
|
+
(child2.f & BRANCH_EFFECT) !== 0 && (effect2.f & BLOCK_EFFECT) !== 0;
|
|
3126
|
+
pause_children(child2, transitions, transparent ? local : false);
|
|
3127
|
+
}
|
|
2967
3128
|
child2 = sibling2;
|
|
2968
3129
|
}
|
|
2969
3130
|
}
|
|
@@ -3065,8 +3226,7 @@ function handle_event_propagation(event) {
|
|
|
3065
3226
|
var throw_error;
|
|
3066
3227
|
var other_errors = [];
|
|
3067
3228
|
while (current_target !== null) {
|
|
3068
|
-
|
|
3069
|
-
current_target.host || null;
|
|
3229
|
+
if (current_target === handler_element) break;
|
|
3070
3230
|
try {
|
|
3071
3231
|
var delegated2 = current_target[event_symbol]?.[event_name];
|
|
3072
3232
|
if (delegated2 != null && (!/** @type {any} */
|
|
@@ -3082,10 +3242,12 @@ function handle_event_propagation(event) {
|
|
|
3082
3242
|
throw_error = error;
|
|
3083
3243
|
}
|
|
3084
3244
|
}
|
|
3085
|
-
if (event.cancelBubble
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3245
|
+
if (event.cancelBubble) break;
|
|
3246
|
+
path_idx++;
|
|
3247
|
+
current_target = path_idx < path.length ? (
|
|
3248
|
+
/** @type {Element} */
|
|
3249
|
+
path[path_idx]
|
|
3250
|
+
) : null;
|
|
3089
3251
|
}
|
|
3090
3252
|
if (throw_error) {
|
|
3091
3253
|
for (let error of other_errors) {
|
|
@@ -3232,8 +3394,9 @@ function is_passive_event(name) {
|
|
|
3232
3394
|
}
|
|
3233
3395
|
function set_text(text, value) {
|
|
3234
3396
|
var str = value == null ? "" : typeof value === "object" ? `${value}` : value;
|
|
3235
|
-
if (str !==
|
|
3236
|
-
|
|
3397
|
+
if (str !== /** @type {any} */
|
|
3398
|
+
(text[TEXT_CACHE] ?? (text[TEXT_CACHE] = text.nodeValue))) {
|
|
3399
|
+
text[TEXT_CACHE] = str;
|
|
3237
3400
|
text.nodeValue = `${str}`;
|
|
3238
3401
|
}
|
|
3239
3402
|
}
|
|
@@ -3559,6 +3722,7 @@ class BranchManager {
|
|
|
3559
3722
|
} else {
|
|
3560
3723
|
var offscreen = __privateGet(this, _offscreen).get(key);
|
|
3561
3724
|
if (offscreen) {
|
|
3725
|
+
resume_effect(offscreen.effect);
|
|
3562
3726
|
__privateGet(this, _onscreen).set(key, offscreen.effect);
|
|
3563
3727
|
__privateGet(this, _offscreen).delete(key);
|
|
3564
3728
|
offscreen.fragment.lastChild.remove();
|
|
@@ -3825,7 +3989,10 @@ function each(node, flags2, get_collection, get_key, render_fn2, fallback_fn = n
|
|
|
3825
3989
|
var fallback = null;
|
|
3826
3990
|
var each_array = /* @__PURE__ */ derived_safe_equal(() => {
|
|
3827
3991
|
var collection = get_collection();
|
|
3828
|
-
return
|
|
3992
|
+
return (
|
|
3993
|
+
/** @type {V[]} */
|
|
3994
|
+
is_array(collection) ? collection : collection == null ? [] : array_from(collection)
|
|
3995
|
+
);
|
|
3829
3996
|
});
|
|
3830
3997
|
var array;
|
|
3831
3998
|
var pending = /* @__PURE__ */ new Map();
|
|
@@ -4159,7 +4326,10 @@ function to_style(value, styles) {
|
|
|
4159
4326
|
return value == null ? null : String(value);
|
|
4160
4327
|
}
|
|
4161
4328
|
function set_class(dom, is_html, value, hash, prev_classes, next_classes) {
|
|
4162
|
-
var prev =
|
|
4329
|
+
var prev = (
|
|
4330
|
+
/** @type {any} */
|
|
4331
|
+
dom[CLASS_CACHE]
|
|
4332
|
+
);
|
|
4163
4333
|
if (hydrating || prev !== value || prev === void 0) {
|
|
4164
4334
|
var next_class_name = to_class(value, hash, next_classes);
|
|
4165
4335
|
if (!hydrating || next_class_name !== dom.getAttribute("class")) {
|
|
@@ -4169,7 +4339,7 @@ function set_class(dom, is_html, value, hash, prev_classes, next_classes) {
|
|
|
4169
4339
|
dom.className = next_class_name;
|
|
4170
4340
|
}
|
|
4171
4341
|
}
|
|
4172
|
-
dom
|
|
4342
|
+
dom[CLASS_CACHE] = value;
|
|
4173
4343
|
} else if (next_classes && prev_classes !== next_classes) {
|
|
4174
4344
|
for (var key in next_classes) {
|
|
4175
4345
|
var is_present = !!next_classes[key];
|
|
@@ -4181,7 +4351,10 @@ function set_class(dom, is_html, value, hash, prev_classes, next_classes) {
|
|
|
4181
4351
|
return next_classes;
|
|
4182
4352
|
}
|
|
4183
4353
|
function set_style(dom, value, prev_styles, next_styles) {
|
|
4184
|
-
var prev =
|
|
4354
|
+
var prev = (
|
|
4355
|
+
/** @type {any} */
|
|
4356
|
+
dom[STYLE_CACHE]
|
|
4357
|
+
);
|
|
4185
4358
|
if (hydrating || prev !== value) {
|
|
4186
4359
|
var next_style_attr = to_style(value);
|
|
4187
4360
|
if (!hydrating || next_style_attr !== dom.getAttribute("style")) {
|
|
@@ -4191,7 +4364,7 @@ function set_style(dom, value, prev_styles, next_styles) {
|
|
|
4191
4364
|
dom.style.cssText = next_style_attr;
|
|
4192
4365
|
}
|
|
4193
4366
|
}
|
|
4194
|
-
dom
|
|
4367
|
+
dom[STYLE_CACHE] = value;
|
|
4195
4368
|
}
|
|
4196
4369
|
return next_styles;
|
|
4197
4370
|
}
|
|
@@ -4215,7 +4388,7 @@ function remove_input_defaults(input) {
|
|
|
4215
4388
|
input.checked = checked;
|
|
4216
4389
|
}
|
|
4217
4390
|
};
|
|
4218
|
-
input
|
|
4391
|
+
input[FORM_RESET_HANDLER] = remove_defaults;
|
|
4219
4392
|
queue_micro_task(remove_defaults);
|
|
4220
4393
|
add_form_reset_listener();
|
|
4221
4394
|
}
|
|
@@ -4242,8 +4415,8 @@ function set_attribute(element, attribute, value, skip_warning) {
|
|
|
4242
4415
|
function get_attributes(element) {
|
|
4243
4416
|
return (
|
|
4244
4417
|
/** @type {Record<string | symbol, unknown>} **/
|
|
4245
|
-
|
|
4246
|
-
element
|
|
4418
|
+
/** @type {any} */
|
|
4419
|
+
element[ATTRIBUTES_CACHE] ?? (element[ATTRIBUTES_CACHE] = {
|
|
4247
4420
|
[IS_CUSTOM_ELEMENT]: element.nodeName.includes("-"),
|
|
4248
4421
|
[IS_HTML]: element.namespaceURI === NAMESPACE_HTML
|
|
4249
4422
|
})
|
|
@@ -4261,7 +4434,8 @@ function get_setters(element) {
|
|
|
4261
4434
|
while (element_proto !== proto) {
|
|
4262
4435
|
descriptors = get_descriptors(proto);
|
|
4263
4436
|
for (var key in descriptors) {
|
|
4264
|
-
if (descriptors[key].set
|
|
4437
|
+
if (descriptors[key].set && // better safe than sorry, we don't want spread attributes to mess with HTML content
|
|
4438
|
+
key !== "innerHTML" && key !== "textContent" && key !== "innerText") {
|
|
4265
4439
|
setters.push(key);
|
|
4266
4440
|
}
|
|
4267
4441
|
}
|
|
@@ -4306,7 +4480,7 @@ function bind_this(element_or_component = {}, update, get_value, get_parts) {
|
|
|
4306
4480
|
old_parts = parts;
|
|
4307
4481
|
parts = [];
|
|
4308
4482
|
untrack(() => {
|
|
4309
|
-
if (
|
|
4483
|
+
if (!is_bound_this(get_value(...parts), element_or_component)) {
|
|
4310
4484
|
update(element_or_component, ...parts);
|
|
4311
4485
|
if (old_parts && is_bound_this(get_value(...old_parts), element_or_component)) {
|
|
4312
4486
|
update(null, ...old_parts);
|
|
@@ -4335,14 +4509,14 @@ function bind_this(element_or_component = {}, update, get_value, get_parts) {
|
|
|
4335
4509
|
}
|
|
4336
4510
|
const rest_props_handler = {
|
|
4337
4511
|
get(target, key) {
|
|
4338
|
-
if (target.exclude.
|
|
4512
|
+
if (target.exclude.has(key)) return;
|
|
4339
4513
|
return target.props[key];
|
|
4340
4514
|
},
|
|
4341
4515
|
set(target, key) {
|
|
4342
4516
|
return false;
|
|
4343
4517
|
},
|
|
4344
4518
|
getOwnPropertyDescriptor(target, key) {
|
|
4345
|
-
if (target.exclude.
|
|
4519
|
+
if (target.exclude.has(key)) return;
|
|
4346
4520
|
if (key in target.props) {
|
|
4347
4521
|
return {
|
|
4348
4522
|
enumerable: true,
|
|
@@ -4352,21 +4526,19 @@ const rest_props_handler = {
|
|
|
4352
4526
|
}
|
|
4353
4527
|
},
|
|
4354
4528
|
has(target, key) {
|
|
4355
|
-
if (target.exclude.
|
|
4529
|
+
if (target.exclude.has(key)) return false;
|
|
4356
4530
|
return key in target.props;
|
|
4357
4531
|
},
|
|
4358
4532
|
ownKeys(target) {
|
|
4359
|
-
return Reflect.ownKeys(target.props).filter((key) => !target.exclude.
|
|
4533
|
+
return Reflect.ownKeys(target.props).filter((key) => !target.exclude.has(key));
|
|
4360
4534
|
}
|
|
4361
4535
|
};
|
|
4362
4536
|
// @__NO_SIDE_EFFECTS__
|
|
4363
4537
|
function rest_props(props, exclude, name) {
|
|
4364
|
-
return new Proxy(
|
|
4365
|
-
{ props, exclude },
|
|
4366
|
-
rest_props_handler
|
|
4367
|
-
);
|
|
4538
|
+
return new Proxy({ props, exclude }, rest_props_handler);
|
|
4368
4539
|
}
|
|
4369
4540
|
function prop(props, key, flags2, fallback) {
|
|
4541
|
+
var runes = true;
|
|
4370
4542
|
var bindable = (flags2 & PROPS_IS_BINDABLE) !== 0;
|
|
4371
4543
|
var lazy = (flags2 & PROPS_IS_LAZY_INITIAL) !== 0;
|
|
4372
4544
|
var fallback_value = (
|
|
@@ -4374,7 +4546,18 @@ function prop(props, key, flags2, fallback) {
|
|
|
4374
4546
|
fallback
|
|
4375
4547
|
);
|
|
4376
4548
|
var fallback_dirty = true;
|
|
4549
|
+
var fallback_signal = (
|
|
4550
|
+
/** @type {Derived<V> | undefined} */
|
|
4551
|
+
void 0
|
|
4552
|
+
);
|
|
4377
4553
|
var get_fallback = () => {
|
|
4554
|
+
if (lazy && runes) {
|
|
4555
|
+
fallback_signal ?? (fallback_signal = /* @__PURE__ */ derived(
|
|
4556
|
+
/** @type {() => V} */
|
|
4557
|
+
fallback
|
|
4558
|
+
));
|
|
4559
|
+
return get(fallback_signal);
|
|
4560
|
+
}
|
|
4378
4561
|
if (fallback_dirty) {
|
|
4379
4562
|
fallback_dirty = false;
|
|
4380
4563
|
fallback_value = lazy ? untrack(
|
|
@@ -10312,11 +10495,11 @@ function getInactivePeriods(events, inactivePeriodThreshold) {
|
|
|
10312
10495
|
}
|
|
10313
10496
|
return inactivePeriods;
|
|
10314
10497
|
}
|
|
10315
|
-
var root$
|
|
10498
|
+
var root$2 = /* @__PURE__ */ from_html(`<div><input type="checkbox" class="svelte-184lr04"/> <label class="svelte-184lr04"></label> <span class="label svelte-184lr04"> </span></div>`);
|
|
10316
10499
|
function Switch($$anchor, $$props) {
|
|
10317
10500
|
push($$props, true);
|
|
10318
10501
|
let checked = prop($$props, "checked", 15);
|
|
10319
|
-
var div = root$
|
|
10502
|
+
var div = root$2();
|
|
10320
10503
|
let classes;
|
|
10321
10504
|
var input = child(div);
|
|
10322
10505
|
remove_input_defaults(input);
|
|
@@ -10336,9 +10519,8 @@ function Switch($$anchor, $$props) {
|
|
|
10336
10519
|
append($$anchor, div);
|
|
10337
10520
|
pop();
|
|
10338
10521
|
}
|
|
10339
|
-
var
|
|
10340
|
-
var
|
|
10341
|
-
var root_4 = /* @__PURE__ */ from_svg(`<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16"><path d="M682.65984 128q53.00224 0 90.50112 37.49888t37.49888 90.50112l0
|
|
10522
|
+
var root$1 = /* @__PURE__ */ from_html(`<div></div>`);
|
|
10523
|
+
var root_1 = /* @__PURE__ */ from_svg(`<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16"><path d="M682.65984 128q53.00224 0 90.50112 37.49888t37.49888 90.50112l0
|
|
10342
10524
|
512q0 53.00224-37.49888 90.50112t-90.50112
|
|
10343
10525
|
37.49888-90.50112-37.49888-37.49888-90.50112l0-512q0-53.00224
|
|
10344
10526
|
37.49888-90.50112t90.50112-37.49888zM341.34016 128q53.00224 0
|
|
@@ -10352,10 +10534,10 @@ var root_4 = /* @__PURE__ */ from_svg(`<svg class="icon" viewBox="0 0 1024 1024"
|
|
|
10352
10534
|
213.34016q-17.67424 0-30.16704 12.4928t-12.4928 30.16704l0 512q0
|
|
10353
10535
|
17.67424 12.4928 30.16704t30.16704 12.4928 30.16704-12.4928
|
|
10354
10536
|
12.4928-30.16704l0-512q0-17.67424-12.4928-30.16704t-30.16704-12.4928z"></path></svg>`);
|
|
10355
|
-
var
|
|
10537
|
+
var root_2 = /* @__PURE__ */ from_svg(`<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16"><path d="M170.65984 896l0-768 640 384zM644.66944
|
|
10356
10538
|
512l-388.66944-233.32864 0 466.65728z"></path></svg>`);
|
|
10357
|
-
var
|
|
10358
|
-
var
|
|
10539
|
+
var root_3 = /* @__PURE__ */ from_html(`<button> </button>`);
|
|
10540
|
+
var root_4 = /* @__PURE__ */ from_html(`<div class="rr-controller svelte-14v7dbr"><div class="rr-timeline svelte-14v7dbr"><span class="rr-timeline__time svelte-14v7dbr"> </span> <div role="slider" tabindex="0"><div class="rr-progress__step svelte-14v7dbr"></div> <!> <!> <div class="rr-progress__handler svelte-14v7dbr"></div></div> <span class="rr-timeline__time svelte-14v7dbr"> </span></div> <div class="rr-controller__btns svelte-14v7dbr"><button class="svelte-14v7dbr"><!></button> <!> <!> <button aria-label="fullscreen" class="svelte-14v7dbr"><svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16"><defs><style type="text/css"></style></defs><path d="M916 380c-26.4 0-48-21.6-48-48L868 223.2 613.6 477.6c-18.4
|
|
10359
10541
|
18.4-48.8 18.4-68 0-18.4-18.4-18.4-48.8 0-68L800 156 692 156c-26.4
|
|
10360
10542
|
0-48-21.6-48-48 0-26.4 21.6-48 48-48l224 0c26.4 0 48 21.6 48 48l0
|
|
10361
10543
|
224C964 358.4 942.4 380 916 380zM231.2 860l108.8 0c26.4 0 48 21.6 48
|
|
@@ -10608,7 +10790,7 @@ function Controller($$anchor, $$props) {
|
|
|
10608
10790
|
var node = first_child(fragment);
|
|
10609
10791
|
{
|
|
10610
10792
|
var consequent_1 = ($$anchor2) => {
|
|
10611
|
-
var div =
|
|
10793
|
+
var div = root_4();
|
|
10612
10794
|
var div_1 = child(div);
|
|
10613
10795
|
var span = child(div_1);
|
|
10614
10796
|
var text = child(span, true);
|
|
@@ -10619,7 +10801,7 @@ function Controller($$anchor, $$props) {
|
|
|
10619
10801
|
var div_3 = child(div_2);
|
|
10620
10802
|
var node_1 = sibling(div_3, 2);
|
|
10621
10803
|
each(node_1, 17, () => get(inactivePeriods), index, ($$anchor3, period) => {
|
|
10622
|
-
var div_4 =
|
|
10804
|
+
var div_4 = root$1();
|
|
10623
10805
|
template_effect(() => {
|
|
10624
10806
|
set_attribute(div_4, "title", get(period).name);
|
|
10625
10807
|
set_style(div_4, `width: ${get(period).width ?? ""};height: 4px;position: absolute;background: ${get(period).background ?? ""};left:
|
|
@@ -10629,7 +10811,7 @@ function Controller($$anchor, $$props) {
|
|
|
10629
10811
|
});
|
|
10630
10812
|
var node_2 = sibling(node_1, 2);
|
|
10631
10813
|
each(node_2, 17, () => get(customEvents), index, ($$anchor3, event) => {
|
|
10632
|
-
var div_5 =
|
|
10814
|
+
var div_5 = root$1();
|
|
10633
10815
|
template_effect(() => {
|
|
10634
10816
|
set_attribute(div_5, "title", get(event).name);
|
|
10635
10817
|
set_style(div_5, `width: 10px;height: 5px;position: absolute;top:
|
|
@@ -10650,11 +10832,11 @@ function Controller($$anchor, $$props) {
|
|
|
10650
10832
|
var node_3 = child(button);
|
|
10651
10833
|
{
|
|
10652
10834
|
var consequent = ($$anchor3) => {
|
|
10653
|
-
var svg =
|
|
10835
|
+
var svg = root_1();
|
|
10654
10836
|
append($$anchor3, svg);
|
|
10655
10837
|
};
|
|
10656
10838
|
var alternate = ($$anchor3) => {
|
|
10657
|
-
var svg_1 =
|
|
10839
|
+
var svg_1 = root_2();
|
|
10658
10840
|
append($$anchor3, svg_1);
|
|
10659
10841
|
};
|
|
10660
10842
|
if_block(node_3, ($$render) => {
|
|
@@ -10665,7 +10847,7 @@ function Controller($$anchor, $$props) {
|
|
|
10665
10847
|
reset(button);
|
|
10666
10848
|
var node_4 = sibling(button, 2);
|
|
10667
10849
|
each(node_4, 17, () => $$props.speedOption, index, ($$anchor3, s2) => {
|
|
10668
|
-
var button_1 =
|
|
10850
|
+
var button_1 = root_3();
|
|
10669
10851
|
let classes_1;
|
|
10670
10852
|
var text_2 = child(button_1);
|
|
10671
10853
|
reset(button_1);
|
|
@@ -10728,25 +10910,26 @@ function Controller($$anchor, $$props) {
|
|
|
10728
10910
|
return pop($$exports);
|
|
10729
10911
|
}
|
|
10730
10912
|
delegate(["click", "keydown"]);
|
|
10913
|
+
var rest_excludes = /* @__PURE__ */ new Set([
|
|
10914
|
+
"$$slots",
|
|
10915
|
+
"$$events",
|
|
10916
|
+
"$$legacy",
|
|
10917
|
+
"width",
|
|
10918
|
+
"height",
|
|
10919
|
+
"maxScale",
|
|
10920
|
+
"events",
|
|
10921
|
+
"skipInactive",
|
|
10922
|
+
"autoPlay",
|
|
10923
|
+
"speedOption",
|
|
10924
|
+
"speed",
|
|
10925
|
+
"showController",
|
|
10926
|
+
"tags",
|
|
10927
|
+
"inactiveColor"
|
|
10928
|
+
]);
|
|
10731
10929
|
var root = /* @__PURE__ */ from_html(`<div class="rr-player"><div class="rr-player__frame"></div> <!></div>`);
|
|
10732
10930
|
function Player$1($$anchor, $$props) {
|
|
10733
10931
|
push($$props, true);
|
|
10734
|
-
let width = prop($$props, "width", 15, 1024), height = prop($$props, "height", 15, 576), maxScale = prop($$props, "maxScale", 3, 1), skipInactive = prop($$props, "skipInactive", 7, true), autoPlay = prop($$props, "autoPlay", 3, true), speedOption = prop($$props, "speedOption", 19, () => [1, 2, 4, 8]), speed = prop($$props, "speed", 3, 1), showController = prop($$props, "showController", 3, true), tags = prop($$props, "tags", 19, () => ({})), inactiveColor = prop($$props, "inactiveColor", 3, "#D4D4D4"), restProps = /* @__PURE__ */ rest_props($$props,
|
|
10735
|
-
"$$slots",
|
|
10736
|
-
"$$events",
|
|
10737
|
-
"$$legacy",
|
|
10738
|
-
"width",
|
|
10739
|
-
"height",
|
|
10740
|
-
"maxScale",
|
|
10741
|
-
"events",
|
|
10742
|
-
"skipInactive",
|
|
10743
|
-
"autoPlay",
|
|
10744
|
-
"speedOption",
|
|
10745
|
-
"speed",
|
|
10746
|
-
"showController",
|
|
10747
|
-
"tags",
|
|
10748
|
-
"inactiveColor"
|
|
10749
|
-
]);
|
|
10932
|
+
let width = prop($$props, "width", 15, 1024), height = prop($$props, "height", 15, 576), maxScale = prop($$props, "maxScale", 3, 1), skipInactive = prop($$props, "skipInactive", 7, true), autoPlay = prop($$props, "autoPlay", 3, true), speedOption = prop($$props, "speedOption", 19, () => [1, 2, 4, 8]), speed = prop($$props, "speed", 3, 1), showController = prop($$props, "showController", 3, true), tags = prop($$props, "tags", 19, () => ({})), inactiveColor = prop($$props, "inactiveColor", 3, "#D4D4D4"), restProps = /* @__PURE__ */ rest_props($$props, rest_excludes);
|
|
10750
10933
|
let replayer = /* @__PURE__ */ state(void 0);
|
|
10751
10934
|
const getMirror = () => get(replayer).getMirror();
|
|
10752
10935
|
const controllerHeight = 80;
|