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