@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.
@@ -13,26 +13,6 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
13
13
  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);
14
14
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
15
15
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
16
- var _commit_callbacks;
17
- var _discard_callbacks;
18
- var _pending;
19
- var _blocking_pending;
20
- var _deferred;
21
- var _roots;
22
- var _new_effects;
23
- var _dirty_effects;
24
- var _maybe_dirty_effects;
25
- var _skipped_branches;
26
- var _unskipped_branches;
27
- var _decrement_queued;
28
- var _blockers;
29
- var _Batch_instances;
30
- var is_deferred_fn;
31
- var is_blocked_fn;
32
- var process_fn;
33
- var traverse_fn;
34
- var defer_effects_fn;
35
- var commit_fn;
36
16
  var _anchor;
37
17
  var _hydrate_open;
38
18
  var _props;
@@ -45,18 +25,44 @@ var _offscreen_fragment;
45
25
  var _local_pending_count;
46
26
  var _pending_count;
47
27
  var _pending_count_update_queued;
48
- var _dirty_effects2;
49
- var _maybe_dirty_effects2;
28
+ var _dirty_effects;
29
+ var _maybe_dirty_effects;
50
30
  var _effect_pending;
51
31
  var _effect_pending_subscriber;
52
32
  var _Boundary_instances;
53
33
  var hydrate_resolved_content_fn;
54
34
  var hydrate_failed_content_fn;
35
+ var create_reset_fn;
55
36
  var hydrate_pending_content_fn;
56
37
  var render_fn;
57
38
  var resolve_fn;
58
39
  var run_fn;
59
40
  var update_pending_count_fn;
41
+ var handle_error_fn;
42
+ var _started;
43
+ var _prev;
44
+ var _next;
45
+ var _commit_callbacks;
46
+ var _discard_callbacks;
47
+ var _pending;
48
+ var _blocking_pending;
49
+ var _deferred;
50
+ var _roots;
51
+ var _new_effects;
52
+ var _dirty_effects2;
53
+ var _maybe_dirty_effects2;
54
+ var _skipped_branches;
55
+ var _unskipped_branches;
56
+ var _decrement_queued;
57
+ var _Batch_instances;
58
+ var is_deferred_fn;
59
+ var process_fn;
60
+ var traverse_fn;
61
+ var find_earlier_batch_fn;
62
+ var merge_fn;
63
+ var defer_effects_fn;
64
+ var commit_fn;
65
+ var unlink_fn;
60
66
  var _events;
61
67
  var _instance;
62
68
  var _a2;
@@ -97,6 +103,11 @@ var ERROR_VALUE = 1 << 23;
97
103
  var STATE_SYMBOL = Symbol("$state");
98
104
  var LEGACY_PROPS = Symbol("legacy props");
99
105
  var LOADING_ATTR_SYMBOL = Symbol("");
106
+ var ATTRIBUTES_CACHE = Symbol("attributes");
107
+ var CLASS_CACHE = Symbol("class");
108
+ var STYLE_CACHE = Symbol("style");
109
+ var TEXT_CACHE = Symbol("text");
110
+ var FORM_RESET_HANDLER = Symbol("form reset");
100
111
  var STALE_REACTION = new class StaleReactionError extends Error {
101
112
  constructor() {
102
113
  super(...arguments);
@@ -226,7 +237,7 @@ var HYDRATION_START_ELSE = "[!";
226
237
  var HYDRATION_START_FAILED = "[?";
227
238
  var HYDRATION_END = "]";
228
239
  var HYDRATION_ERROR = {};
229
- var UNINITIALIZED = Symbol();
240
+ var UNINITIALIZED = Symbol("uninitialized");
230
241
  var NAMESPACE_HTML = "http://www.w3.org/1999/xhtml";
231
242
  var component_context = null;
232
243
  function set_component_context(context) {
@@ -290,6 +301,11 @@ function flush_tasks() {
290
301
  run_micro_tasks();
291
302
  }
292
303
  }
304
+ function derived_inert() {
305
+ {
306
+ console.warn(`https://svelte.dev/e/derived_inert`);
307
+ }
308
+ }
293
309
  function hydration_mismatch(location) {
294
310
  {
295
311
  console.warn(`https://svelte.dev/e/hydration_mismatch`);
@@ -575,14 +591,13 @@ function init_operations() {
575
591
  first_child_getter = get_descriptor(node_prototype, "firstChild").get;
576
592
  next_sibling_getter = get_descriptor(node_prototype, "nextSibling").get;
577
593
  if (is_extensible(element_prototype)) {
578
- element_prototype.__click = void 0;
579
- element_prototype.__className = void 0;
580
- element_prototype.__attributes = null;
581
- element_prototype.__style = void 0;
594
+ element_prototype[CLASS_CACHE] = void 0;
595
+ element_prototype[ATTRIBUTES_CACHE] = null;
596
+ element_prototype[STYLE_CACHE] = void 0;
582
597
  element_prototype.__e = void 0;
583
598
  }
584
599
  if (is_extensible(text_prototype)) {
585
- text_prototype.__t = void 0;
600
+ text_prototype[TEXT_CACHE] = void 0;
586
601
  }
587
602
  }
588
603
  function create_text(value = "") {
@@ -681,11 +696,12 @@ function should_defer_append() {
681
696
  return false;
682
697
  }
683
698
  function create_element(tag, namespace, is) {
684
- let options = void 0;
685
- return (
686
- /** @type {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element} */
687
- document.createElementNS(NAMESPACE_HTML, tag, options)
688
- );
699
+ {
700
+ return (
701
+ /** @type {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element} */
702
+ is ? document.createElement(tag, { is }) : document.createElement(tag)
703
+ );
704
+ }
689
705
  }
690
706
  function merge_text_nodes(text) {
691
707
  if (
@@ -714,6 +730,9 @@ function handle_error(error) {
714
730
  invoke_error_boundary(error, effect2);
715
731
  }
716
732
  function invoke_error_boundary(error, effect2) {
733
+ if (effect2 !== null && (effect2.f & DESTROYED) !== 0) {
734
+ return;
735
+ }
717
736
  while (effect2 !== null) {
718
737
  if ((effect2.f & BOUNDARY_EFFECT) !== 0) {
719
738
  if ((effect2.f & REACTION_RAN) === 0) {
@@ -773,1310 +792,1470 @@ function capture_store_binding(fn) {
773
792
  is_store_binding = previous_is_store_binding;
774
793
  }
775
794
  }
776
- var batches = /* @__PURE__ */ new Set();
777
- var current_batch = null;
778
- var batch_values = null;
779
- var last_scheduled_effect = null;
780
- var is_flushing_sync = false;
781
- var is_processing = false;
782
- var collected_effects = null;
783
- var legacy_updates = null;
784
- var flush_count = 0;
785
- var uid = 1;
786
- var _Batch = class _Batch2 {
787
- constructor() {
788
- __privateAdd(this, _Batch_instances);
789
- __publicField(this, "id", uid++);
790
- __publicField(this, "current", /* @__PURE__ */ new Map());
791
- __publicField(this, "previous", /* @__PURE__ */ new Map());
792
- __privateAdd(this, _commit_callbacks, /* @__PURE__ */ new Set());
793
- __privateAdd(this, _discard_callbacks, /* @__PURE__ */ new Set());
794
- __privateAdd(this, _pending, /* @__PURE__ */ new Map());
795
- __privateAdd(this, _blocking_pending, /* @__PURE__ */ new Map());
796
- __privateAdd(this, _deferred, null);
797
- __privateAdd(this, _roots, []);
798
- __privateAdd(this, _new_effects, []);
799
- __privateAdd(this, _dirty_effects, /* @__PURE__ */ new Set());
800
- __privateAdd(this, _maybe_dirty_effects, /* @__PURE__ */ new Set());
801
- __privateAdd(this, _skipped_branches, /* @__PURE__ */ new Map());
802
- __privateAdd(this, _unskipped_branches, /* @__PURE__ */ new Set());
803
- __publicField(this, "is_fork", false);
804
- __privateAdd(this, _decrement_queued, false);
805
- __privateAdd(this, _blockers, /* @__PURE__ */ new Set());
795
+ var listening_to_form_reset = false;
796
+ function add_form_reset_listener() {
797
+ if (!listening_to_form_reset) {
798
+ listening_to_form_reset = true;
799
+ document.addEventListener(
800
+ "reset",
801
+ (evt) => {
802
+ Promise.resolve().then(() => {
803
+ if (!evt.defaultPrevented) {
804
+ for (
805
+ const e2 of
806
+ /**@type {HTMLFormElement} */
807
+ evt.target.elements
808
+ ) {
809
+ e2[FORM_RESET_HANDLER]?.();
810
+ }
811
+ }
812
+ });
813
+ },
814
+ // In the capture phase to guarantee we get noticed of it (no possibility of stopPropagation)
815
+ { capture: true }
816
+ );
817
+ }
818
+ }
819
+ function without_reactive_context(fn) {
820
+ var previous_reaction = active_reaction;
821
+ var previous_effect = active_effect;
822
+ set_active_reaction(null);
823
+ set_active_effect(null);
824
+ try {
825
+ return fn();
826
+ } finally {
827
+ set_active_reaction(previous_reaction);
828
+ set_active_effect(previous_effect);
829
+ }
830
+ }
831
+ function listen_to_event_and_reset_event(element, event, handler, on_reset = handler) {
832
+ element.addEventListener(event, () => without_reactive_context(handler));
833
+ const prev = (
834
+ /** @type {any} */
835
+ element[FORM_RESET_HANDLER]
836
+ );
837
+ if (prev) {
838
+ element[FORM_RESET_HANDLER] = () => {
839
+ prev();
840
+ on_reset(true);
841
+ };
842
+ } else {
843
+ element[FORM_RESET_HANDLER] = () => on_reset(true);
806
844
  }
845
+ add_form_reset_listener();
846
+ }
847
+ function createSubscriber(start) {
848
+ let subscribers = 0;
849
+ let version = source(0);
850
+ let stop;
851
+ return () => {
852
+ if (effect_tracking()) {
853
+ get(version);
854
+ render_effect(() => {
855
+ if (subscribers === 0) {
856
+ stop = untrack(() => start(() => increment(version)));
857
+ }
858
+ subscribers += 1;
859
+ return () => {
860
+ queue_micro_task(() => {
861
+ subscribers -= 1;
862
+ if (subscribers === 0) {
863
+ stop?.();
864
+ stop = void 0;
865
+ increment(version);
866
+ }
867
+ });
868
+ };
869
+ });
870
+ }
871
+ };
872
+ }
873
+ var flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED;
874
+ function boundary(node, props, children, transform_error) {
875
+ new Boundary(node, props, children, transform_error);
876
+ }
877
+ var Boundary = class {
807
878
  /**
808
- * Add an effect to the #skipped_branches map and reset its children
809
- * @param {Effect} effect
879
+ * @param {TemplateNode} node
880
+ * @param {BoundaryProps} props
881
+ * @param {((anchor: Node) => void)} children
882
+ * @param {((error: unknown) => unknown) | undefined} [transform_error]
810
883
  */
811
- skip_effect(effect2) {
812
- if (!__privateGet(this, _skipped_branches).has(effect2)) {
813
- __privateGet(this, _skipped_branches).set(effect2, { d: [], m: [] });
884
+ constructor(node, props, children, transform_error) {
885
+ __privateAdd(this, _Boundary_instances);
886
+ __publicField(this, "parent");
887
+ __publicField(this, "is_pending", false);
888
+ __publicField(this, "transform_error");
889
+ __privateAdd(this, _anchor);
890
+ __privateAdd(this, _hydrate_open, hydrating ? hydrate_node : null);
891
+ __privateAdd(this, _props);
892
+ __privateAdd(this, _children);
893
+ __privateAdd(this, _effect);
894
+ __privateAdd(this, _main_effect, null);
895
+ __privateAdd(this, _pending_effect, null);
896
+ __privateAdd(this, _failed_effect, null);
897
+ __privateAdd(this, _offscreen_fragment, null);
898
+ __privateAdd(this, _local_pending_count, 0);
899
+ __privateAdd(this, _pending_count, 0);
900
+ __privateAdd(this, _pending_count_update_queued, false);
901
+ __privateAdd(this, _dirty_effects, /* @__PURE__ */ new Set());
902
+ __privateAdd(this, _maybe_dirty_effects, /* @__PURE__ */ new Set());
903
+ __privateAdd(this, _effect_pending, null);
904
+ __privateAdd(this, _effect_pending_subscriber, createSubscriber(() => {
905
+ __privateSet(this, _effect_pending, source(__privateGet(this, _local_pending_count)));
906
+ return () => {
907
+ __privateSet(this, _effect_pending, null);
908
+ };
909
+ }));
910
+ __privateSet(this, _anchor, node);
911
+ __privateSet(this, _props, props);
912
+ __privateSet(this, _children, (anchor) => {
913
+ var effect2 = (
914
+ /** @type {Effect} */
915
+ active_effect
916
+ );
917
+ effect2.b = this;
918
+ effect2.f |= BOUNDARY_EFFECT;
919
+ children(anchor);
920
+ });
921
+ this.parent = /** @type {Effect} */
922
+ active_effect.b;
923
+ this.transform_error = transform_error ?? this.parent?.transform_error ?? ((e2) => e2);
924
+ __privateSet(this, _effect, block(() => {
925
+ if (hydrating) {
926
+ const comment2 = (
927
+ /** @type {Comment} */
928
+ __privateGet(this, _hydrate_open)
929
+ );
930
+ hydrate_next();
931
+ const server_rendered_pending = comment2.data === HYDRATION_START_ELSE;
932
+ const server_rendered_failed = comment2.data.startsWith(HYDRATION_START_FAILED);
933
+ if (server_rendered_failed) {
934
+ const serialized_error = JSON.parse(comment2.data.slice(HYDRATION_START_FAILED.length));
935
+ __privateMethod(this, _Boundary_instances, hydrate_failed_content_fn).call(this, serialized_error);
936
+ } else if (server_rendered_pending) {
937
+ __privateMethod(this, _Boundary_instances, hydrate_pending_content_fn).call(this);
938
+ } else {
939
+ __privateMethod(this, _Boundary_instances, hydrate_resolved_content_fn).call(this);
940
+ }
941
+ } else {
942
+ __privateMethod(this, _Boundary_instances, render_fn).call(this);
943
+ }
944
+ }, flags));
945
+ if (hydrating) {
946
+ __privateSet(this, _anchor, hydrate_node);
814
947
  }
815
- __privateGet(this, _unskipped_branches).delete(effect2);
816
948
  }
817
949
  /**
818
- * Remove an effect from the #skipped_branches map and reschedule
819
- * any tracked dirty/maybe_dirty child effects
950
+ * Defer an effect inside a pending boundary until the boundary resolves
820
951
  * @param {Effect} effect
821
- * @param {(e: Effect) => void} callback
822
952
  */
823
- unskip_effect(effect2, callback = (e2) => this.schedule(e2)) {
824
- var tracked = __privateGet(this, _skipped_branches).get(effect2);
825
- if (tracked) {
826
- __privateGet(this, _skipped_branches).delete(effect2);
827
- for (var e2 of tracked.d) {
828
- set_signal_status(e2, DIRTY);
829
- callback(e2);
830
- }
831
- for (e2 of tracked.m) {
832
- set_signal_status(e2, MAYBE_DIRTY);
833
- callback(e2);
834
- }
835
- }
836
- __privateGet(this, _unskipped_branches).add(effect2);
953
+ defer_effect(effect2) {
954
+ defer_effect(effect2, __privateGet(this, _dirty_effects), __privateGet(this, _maybe_dirty_effects));
837
955
  }
838
956
  /**
839
- * Associate a change to a given source with the current
840
- * batch, noting its previous and current values
841
- * @param {Value} source
842
- * @param {any} value
843
- * @param {boolean} [is_derived]
957
+ * Returns `false` if the effect exists inside a boundary whose pending snippet is shown
958
+ * @returns {boolean}
844
959
  */
845
- capture(source2, value, is_derived = false) {
846
- if (source2.v !== UNINITIALIZED && !this.previous.has(source2)) {
847
- this.previous.set(source2, source2.v);
848
- }
849
- if ((source2.f & ERROR_VALUE) === 0) {
850
- this.current.set(source2, [value, is_derived]);
851
- batch_values?.set(source2, value);
852
- }
853
- if (!this.is_fork) {
854
- source2.v = value;
855
- }
856
- }
857
- activate() {
858
- current_batch = this;
859
- }
860
- deactivate() {
861
- current_batch = null;
862
- batch_values = null;
863
- }
864
- flush() {
865
- try {
866
- is_processing = true;
867
- current_batch = this;
868
- __privateMethod(this, _Batch_instances, process_fn).call(this);
869
- } finally {
870
- flush_count = 0;
871
- last_scheduled_effect = null;
872
- collected_effects = null;
873
- legacy_updates = null;
874
- is_processing = false;
875
- current_batch = null;
876
- batch_values = null;
877
- old_values.clear();
878
- }
879
- }
880
- discard() {
881
- for (const fn of __privateGet(this, _discard_callbacks)) fn(this);
882
- __privateGet(this, _discard_callbacks).clear();
883
- batches.delete(this);
884
- }
885
- /**
886
- * @param {Effect} effect
887
- */
888
- register_created_effect(effect2) {
889
- __privateGet(this, _new_effects).push(effect2);
960
+ is_rendered() {
961
+ return !this.is_pending && (!this.parent || this.parent.is_rendered());
890
962
  }
891
- /**
892
- * @param {boolean} blocking
893
- * @param {Effect} effect
894
- */
895
- increment(blocking, effect2) {
896
- let pending_count = __privateGet(this, _pending).get(effect2) ?? 0;
897
- __privateGet(this, _pending).set(effect2, pending_count + 1);
898
- if (blocking) {
899
- let blocking_pending_count = __privateGet(this, _blocking_pending).get(effect2) ?? 0;
900
- __privateGet(this, _blocking_pending).set(effect2, blocking_pending_count + 1);
901
- }
963
+ has_pending_snippet() {
964
+ return !!__privateGet(this, _props).pending;
902
965
  }
903
966
  /**
904
- * @param {boolean} blocking
905
- * @param {Effect} effect
906
- * @param {boolean} skip - whether to skip updates (because this is triggered by a stale reaction)
967
+ * Update the source that powers `$effect.pending()` inside this boundary,
968
+ * and controls when the current `pending` snippet (if any) is removed.
969
+ * Do not call from inside the class
970
+ * @param {1 | -1} d
971
+ * @param {Batch} batch
907
972
  */
908
- decrement(blocking, effect2, skip) {
909
- let pending_count = __privateGet(this, _pending).get(effect2) ?? 0;
910
- if (pending_count === 1) {
911
- __privateGet(this, _pending).delete(effect2);
912
- } else {
913
- __privateGet(this, _pending).set(effect2, pending_count - 1);
914
- }
915
- if (blocking) {
916
- let blocking_pending_count = __privateGet(this, _blocking_pending).get(effect2) ?? 0;
917
- if (blocking_pending_count === 1) {
918
- __privateGet(this, _blocking_pending).delete(effect2);
919
- } else {
920
- __privateGet(this, _blocking_pending).set(effect2, blocking_pending_count - 1);
921
- }
922
- }
923
- if (__privateGet(this, _decrement_queued) || skip) return;
924
- __privateSet(this, _decrement_queued, true);
973
+ update_pending_count(d, batch) {
974
+ __privateMethod(this, _Boundary_instances, update_pending_count_fn).call(this, d, batch);
975
+ __privateSet(this, _local_pending_count, __privateGet(this, _local_pending_count) + d);
976
+ if (!__privateGet(this, _effect_pending) || __privateGet(this, _pending_count_update_queued)) return;
977
+ __privateSet(this, _pending_count_update_queued, true);
925
978
  queue_micro_task(() => {
926
- __privateSet(this, _decrement_queued, false);
927
- this.flush();
928
- });
929
- }
930
- /**
931
- * @param {Set<Effect>} dirty_effects
932
- * @param {Set<Effect>} maybe_dirty_effects
933
- */
934
- transfer_effects(dirty_effects, maybe_dirty_effects) {
935
- for (const e2 of dirty_effects) {
936
- __privateGet(this, _dirty_effects).add(e2);
937
- }
938
- for (const e2 of maybe_dirty_effects) {
939
- __privateGet(this, _maybe_dirty_effects).add(e2);
940
- }
941
- dirty_effects.clear();
942
- maybe_dirty_effects.clear();
943
- }
944
- /** @param {(batch: Batch) => void} fn */
945
- oncommit(fn) {
946
- __privateGet(this, _commit_callbacks).add(fn);
947
- }
948
- /** @param {(batch: Batch) => void} fn */
949
- ondiscard(fn) {
950
- __privateGet(this, _discard_callbacks).add(fn);
951
- }
952
- settled() {
953
- return (__privateGet(this, _deferred) ?? __privateSet(this, _deferred, deferred())).promise;
954
- }
955
- static ensure() {
956
- if (current_batch === null) {
957
- const batch = current_batch = new _Batch2();
958
- if (!is_processing) {
959
- batches.add(current_batch);
960
- if (!is_flushing_sync) {
961
- queue_micro_task(() => {
962
- if (current_batch !== batch) {
963
- return;
964
- }
965
- batch.flush();
966
- });
967
- }
979
+ __privateSet(this, _pending_count_update_queued, false);
980
+ if (__privateGet(this, _effect_pending)) {
981
+ internal_set(__privateGet(this, _effect_pending), __privateGet(this, _local_pending_count));
968
982
  }
969
- }
970
- return current_batch;
983
+ });
971
984
  }
972
- apply() {
973
- {
974
- batch_values = null;
975
- return;
976
- }
985
+ get_effect_pending() {
986
+ __privateGet(this, _effect_pending_subscriber).call(this);
987
+ return get(
988
+ /** @type {Source<number>} */
989
+ __privateGet(this, _effect_pending)
990
+ );
977
991
  }
978
- /**
979
- *
980
- * @param {Effect} effect
981
- */
982
- schedule(effect2) {
983
- last_scheduled_effect = effect2;
984
- if (effect2.b?.is_pending && (effect2.f & (EFFECT | RENDER_EFFECT | MANAGED_EFFECT)) !== 0 && (effect2.f & REACTION_RAN) === 0) {
985
- effect2.b.defer_effect(effect2);
986
- return;
992
+ /** @param {unknown} error */
993
+ error(error) {
994
+ if (!__privateGet(this, _props).onerror && !__privateGet(this, _props).failed) {
995
+ throw error;
987
996
  }
988
- var e2 = effect2;
989
- while (e2.parent !== null) {
990
- e2 = e2.parent;
991
- var flags2 = e2.f;
992
- if (collected_effects !== null && e2 === active_effect) {
993
- if ((active_reaction === null || (active_reaction.f & DERIVED) === 0) && true) {
994
- return;
995
- }
996
- }
997
- if ((flags2 & (ROOT_EFFECT | BRANCH_EFFECT)) !== 0) {
998
- if ((flags2 & CLEAN) === 0) {
999
- return;
1000
- }
1001
- e2.f ^= CLEAN;
1002
- }
997
+ if (current_batch?.is_fork) {
998
+ if (__privateGet(this, _main_effect)) current_batch.skip_effect(__privateGet(this, _main_effect));
999
+ if (__privateGet(this, _pending_effect)) current_batch.skip_effect(__privateGet(this, _pending_effect));
1000
+ if (__privateGet(this, _failed_effect)) current_batch.skip_effect(__privateGet(this, _failed_effect));
1001
+ current_batch.oncommit(() => {
1002
+ __privateMethod(this, _Boundary_instances, handle_error_fn).call(this, error);
1003
+ });
1004
+ } else {
1005
+ __privateMethod(this, _Boundary_instances, handle_error_fn).call(this, error);
1003
1006
  }
1004
- __privateGet(this, _roots).push(e2);
1005
1007
  }
1006
1008
  };
1007
- _commit_callbacks = /* @__PURE__ */ new WeakMap();
1008
- _discard_callbacks = /* @__PURE__ */ new WeakMap();
1009
- _pending = /* @__PURE__ */ new WeakMap();
1010
- _blocking_pending = /* @__PURE__ */ new WeakMap();
1011
- _deferred = /* @__PURE__ */ new WeakMap();
1012
- _roots = /* @__PURE__ */ new WeakMap();
1013
- _new_effects = /* @__PURE__ */ new WeakMap();
1009
+ _anchor = /* @__PURE__ */ new WeakMap();
1010
+ _hydrate_open = /* @__PURE__ */ new WeakMap();
1011
+ _props = /* @__PURE__ */ new WeakMap();
1012
+ _children = /* @__PURE__ */ new WeakMap();
1013
+ _effect = /* @__PURE__ */ new WeakMap();
1014
+ _main_effect = /* @__PURE__ */ new WeakMap();
1015
+ _pending_effect = /* @__PURE__ */ new WeakMap();
1016
+ _failed_effect = /* @__PURE__ */ new WeakMap();
1017
+ _offscreen_fragment = /* @__PURE__ */ new WeakMap();
1018
+ _local_pending_count = /* @__PURE__ */ new WeakMap();
1019
+ _pending_count = /* @__PURE__ */ new WeakMap();
1020
+ _pending_count_update_queued = /* @__PURE__ */ new WeakMap();
1014
1021
  _dirty_effects = /* @__PURE__ */ new WeakMap();
1015
1022
  _maybe_dirty_effects = /* @__PURE__ */ new WeakMap();
1016
- _skipped_branches = /* @__PURE__ */ new WeakMap();
1017
- _unskipped_branches = /* @__PURE__ */ new WeakMap();
1018
- _decrement_queued = /* @__PURE__ */ new WeakMap();
1019
- _blockers = /* @__PURE__ */ new WeakMap();
1020
- _Batch_instances = /* @__PURE__ */ new WeakSet();
1021
- is_deferred_fn = function() {
1022
- return this.is_fork || __privateGet(this, _blocking_pending).size > 0;
1023
- };
1024
- is_blocked_fn = function() {
1025
- for (const batch of __privateGet(this, _blockers)) {
1026
- for (const effect2 of __privateGet(batch, _blocking_pending).keys()) {
1027
- var skipped = false;
1028
- var e2 = effect2;
1029
- while (e2.parent !== null) {
1030
- if (__privateGet(this, _skipped_branches).has(e2)) {
1031
- skipped = true;
1032
- break;
1033
- }
1034
- e2 = e2.parent;
1035
- }
1036
- if (!skipped) {
1037
- return true;
1038
- }
1039
- }
1023
+ _effect_pending = /* @__PURE__ */ new WeakMap();
1024
+ _effect_pending_subscriber = /* @__PURE__ */ new WeakMap();
1025
+ _Boundary_instances = /* @__PURE__ */ new WeakSet();
1026
+ hydrate_resolved_content_fn = function() {
1027
+ try {
1028
+ __privateSet(this, _main_effect, branch(() => __privateGet(this, _children).call(this, __privateGet(this, _anchor))));
1029
+ } catch (error) {
1030
+ this.error(error);
1040
1031
  }
1041
- return false;
1042
1032
  };
1043
- process_fn = function() {
1044
- var _a3;
1045
- if (flush_count++ > 1e3) {
1046
- batches.delete(this);
1047
- infinite_loop_guard();
1048
- }
1049
- if (!__privateMethod(this, _Batch_instances, is_deferred_fn).call(this)) {
1050
- for (const e2 of __privateGet(this, _dirty_effects)) {
1051
- __privateGet(this, _maybe_dirty_effects).delete(e2);
1052
- set_signal_status(e2, DIRTY);
1053
- this.schedule(e2);
1054
- }
1055
- for (const e2 of __privateGet(this, _maybe_dirty_effects)) {
1056
- set_signal_status(e2, MAYBE_DIRTY);
1057
- this.schedule(e2);
1033
+ hydrate_failed_content_fn = function(error) {
1034
+ const failed = __privateGet(this, _props).failed;
1035
+ const { reset: reset2, invoke_onerror } = __privateMethod(this, _Boundary_instances, create_reset_fn).call(this, error);
1036
+ queue_micro_task(invoke_onerror);
1037
+ if (!failed) return;
1038
+ __privateSet(this, _failed_effect, branch(() => {
1039
+ failed(
1040
+ __privateGet(this, _anchor),
1041
+ () => error,
1042
+ () => reset2
1043
+ );
1044
+ }));
1045
+ };
1046
+ create_reset_fn = function(error) {
1047
+ var did_reset = false;
1048
+ var calling_on_error = false;
1049
+ const reset2 = () => {
1050
+ if (did_reset) {
1051
+ svelte_boundary_reset_noop();
1052
+ return;
1058
1053
  }
1059
- }
1060
- const roots = __privateGet(this, _roots);
1061
- __privateSet(this, _roots, []);
1062
- this.apply();
1063
- var effects = collected_effects = [];
1064
- var render_effects = [];
1065
- var updates = legacy_updates = [];
1066
- for (const root2 of roots) {
1067
- try {
1068
- __privateMethod(this, _Batch_instances, traverse_fn).call(this, root2, effects, render_effects);
1069
- } catch (e2) {
1070
- reset_all(root2);
1071
- throw e2;
1054
+ did_reset = true;
1055
+ if (calling_on_error) {
1056
+ svelte_boundary_reset_onerror();
1072
1057
  }
1073
- }
1074
- current_batch = null;
1075
- if (updates.length > 0) {
1076
- var batch = _Batch.ensure();
1077
- for (const e2 of updates) {
1078
- batch.schedule(e2);
1058
+ if (__privateGet(this, _failed_effect) !== null) {
1059
+ pause_effect(__privateGet(this, _failed_effect), () => {
1060
+ __privateSet(this, _failed_effect, null);
1061
+ });
1079
1062
  }
1080
- }
1081
- collected_effects = null;
1082
- legacy_updates = null;
1083
- if (__privateMethod(this, _Batch_instances, is_deferred_fn).call(this) || __privateMethod(this, _Batch_instances, is_blocked_fn).call(this)) {
1084
- __privateMethod(this, _Batch_instances, defer_effects_fn).call(this, render_effects);
1085
- __privateMethod(this, _Batch_instances, defer_effects_fn).call(this, effects);
1086
- for (const [e2, t2] of __privateGet(this, _skipped_branches)) {
1087
- reset_branch(e2, t2);
1063
+ __privateMethod(this, _Boundary_instances, run_fn).call(this, () => {
1064
+ __privateMethod(this, _Boundary_instances, render_fn).call(this);
1065
+ });
1066
+ };
1067
+ const invoke_onerror = () => {
1068
+ try {
1069
+ calling_on_error = true;
1070
+ __privateGet(this, _props).onerror?.(error, reset2);
1071
+ calling_on_error = false;
1072
+ } catch (err) {
1073
+ invoke_error_boundary(err, __privateGet(this, _effect) && __privateGet(this, _effect).parent);
1088
1074
  }
1089
- } else {
1090
- if (__privateGet(this, _pending).size === 0) {
1091
- batches.delete(this);
1092
- }
1093
- __privateGet(this, _dirty_effects).clear();
1094
- __privateGet(this, _maybe_dirty_effects).clear();
1095
- for (const fn of __privateGet(this, _commit_callbacks)) fn(this);
1096
- __privateGet(this, _commit_callbacks).clear();
1097
- flush_queued_effects(render_effects);
1098
- flush_queued_effects(effects);
1099
- __privateGet(this, _deferred)?.resolve();
1100
- }
1101
- var next_batch = (
1102
- /** @type {Batch | null} */
1103
- /** @type {unknown} */
1104
- current_batch
1105
- );
1106
- if (__privateGet(this, _roots).length > 0) {
1107
- const batch2 = next_batch ?? (next_batch = this);
1108
- __privateGet(batch2, _roots).push(...__privateGet(this, _roots).filter((r2) => !__privateGet(batch2, _roots).includes(r2)));
1109
- }
1110
- if (next_batch !== null) {
1111
- batches.add(next_batch);
1112
- __privateMethod(_a3 = next_batch, _Batch_instances, process_fn).call(_a3);
1113
- }
1075
+ };
1076
+ return { reset: reset2, invoke_onerror };
1114
1077
  };
1115
- traverse_fn = function(root2, effects, render_effects) {
1116
- root2.f ^= CLEAN;
1117
- var effect2 = root2.first;
1118
- while (effect2 !== null) {
1119
- var flags2 = effect2.f;
1120
- var is_branch = (flags2 & (BRANCH_EFFECT | ROOT_EFFECT)) !== 0;
1121
- var is_skippable_branch = is_branch && (flags2 & CLEAN) !== 0;
1122
- var skip = is_skippable_branch || (flags2 & INERT) !== 0 || __privateGet(this, _skipped_branches).has(effect2);
1123
- if (!skip && effect2.fn !== null) {
1124
- if (is_branch) {
1125
- effect2.f ^= CLEAN;
1126
- } else if ((flags2 & EFFECT) !== 0) {
1127
- effects.push(effect2);
1128
- } else if (is_dirty(effect2)) {
1129
- if ((flags2 & BLOCK_EFFECT) !== 0) __privateGet(this, _maybe_dirty_effects).add(effect2);
1130
- update_effect(effect2);
1131
- }
1132
- var child2 = effect2.first;
1133
- if (child2 !== null) {
1134
- effect2 = child2;
1135
- continue;
1136
- }
1078
+ hydrate_pending_content_fn = function() {
1079
+ const pending = __privateGet(this, _props).pending;
1080
+ if (!pending) return;
1081
+ this.is_pending = true;
1082
+ __privateSet(this, _pending_effect, branch(() => pending(__privateGet(this, _anchor))));
1083
+ queue_micro_task(() => {
1084
+ var fragment = __privateSet(this, _offscreen_fragment, document.createDocumentFragment());
1085
+ var anchor = create_text();
1086
+ fragment.append(anchor);
1087
+ __privateSet(this, _main_effect, __privateMethod(this, _Boundary_instances, run_fn).call(this, () => {
1088
+ return branch(() => __privateGet(this, _children).call(this, anchor));
1089
+ }));
1090
+ if (__privateGet(this, _pending_count) === 0) {
1091
+ __privateGet(this, _anchor).before(fragment);
1092
+ __privateSet(this, _offscreen_fragment, null);
1093
+ pause_effect(
1094
+ /** @type {Effect} */
1095
+ __privateGet(this, _pending_effect),
1096
+ () => {
1097
+ __privateSet(this, _pending_effect, null);
1098
+ }
1099
+ );
1100
+ __privateMethod(this, _Boundary_instances, resolve_fn).call(
1101
+ this,
1102
+ /** @type {Batch} */
1103
+ current_batch
1104
+ );
1137
1105
  }
1138
- while (effect2 !== null) {
1139
- var next2 = effect2.next;
1140
- if (next2 !== null) {
1141
- effect2 = next2;
1142
- break;
1143
- }
1144
- effect2 = effect2.parent;
1106
+ });
1107
+ };
1108
+ render_fn = function() {
1109
+ try {
1110
+ this.is_pending = this.has_pending_snippet();
1111
+ __privateSet(this, _pending_count, 0);
1112
+ __privateSet(this, _local_pending_count, 0);
1113
+ __privateSet(this, _main_effect, branch(() => {
1114
+ __privateGet(this, _children).call(this, __privateGet(this, _anchor));
1115
+ }));
1116
+ if (__privateGet(this, _pending_count) > 0) {
1117
+ var fragment = __privateSet(this, _offscreen_fragment, document.createDocumentFragment());
1118
+ move_effect(__privateGet(this, _main_effect), fragment);
1119
+ const pending = (
1120
+ /** @type {(anchor: Node) => void} */
1121
+ __privateGet(this, _props).pending
1122
+ );
1123
+ __privateSet(this, _pending_effect, branch(() => pending(__privateGet(this, _anchor))));
1124
+ } else {
1125
+ __privateMethod(this, _Boundary_instances, resolve_fn).call(
1126
+ this,
1127
+ /** @type {Batch} */
1128
+ current_batch
1129
+ );
1145
1130
  }
1131
+ } catch (error) {
1132
+ this.error(error);
1146
1133
  }
1147
1134
  };
1148
- defer_effects_fn = function(effects) {
1149
- for (var i = 0; i < effects.length; i += 1) {
1150
- defer_effect(effects[i], __privateGet(this, _dirty_effects), __privateGet(this, _maybe_dirty_effects));
1135
+ resolve_fn = function(batch) {
1136
+ this.is_pending = false;
1137
+ batch.transfer_effects(__privateGet(this, _dirty_effects), __privateGet(this, _maybe_dirty_effects));
1138
+ };
1139
+ run_fn = function(fn) {
1140
+ var previous_effect = active_effect;
1141
+ var previous_reaction = active_reaction;
1142
+ var previous_ctx = component_context;
1143
+ set_active_effect(__privateGet(this, _effect));
1144
+ set_active_reaction(__privateGet(this, _effect));
1145
+ set_component_context(__privateGet(this, _effect).ctx);
1146
+ try {
1147
+ Batch.ensure();
1148
+ return fn();
1149
+ } catch (e2) {
1150
+ handle_error(e2);
1151
+ return null;
1152
+ } finally {
1153
+ set_active_effect(previous_effect);
1154
+ set_active_reaction(previous_reaction);
1155
+ set_component_context(previous_ctx);
1151
1156
  }
1152
1157
  };
1153
- commit_fn = function() {
1154
- var _a3, _b2, _c;
1155
- for (const batch of batches) {
1156
- var is_earlier = batch.id < this.id;
1157
- var sources = [];
1158
- for (const [source3, [value, is_derived]] of this.current) {
1159
- if (batch.current.has(source3)) {
1160
- var batch_value = (
1161
- /** @type {[any, boolean]} */
1162
- batch.current.get(source3)[0]
1163
- );
1164
- if (is_earlier && value !== batch_value) {
1165
- batch.current.set(source3, [value, is_derived]);
1166
- } else {
1167
- continue;
1168
- }
1169
- }
1170
- sources.push(source3);
1158
+ update_pending_count_fn = function(d, batch) {
1159
+ var _a3;
1160
+ if (!this.has_pending_snippet()) {
1161
+ if (this.parent) {
1162
+ __privateMethod(_a3 = this.parent, _Boundary_instances, update_pending_count_fn).call(_a3, d, batch);
1171
1163
  }
1172
- var others = [...batch.current.keys()].filter((s2) => !this.current.has(s2));
1173
- if (others.length === 0) {
1174
- if (is_earlier) {
1175
- batch.discard();
1176
- }
1177
- } else if (sources.length > 0) {
1178
- if (is_earlier) {
1179
- for (const unskipped of __privateGet(this, _unskipped_branches)) {
1180
- batch.unskip_effect(unskipped, (e2) => {
1181
- var _a4;
1182
- if ((e2.f & (BLOCK_EFFECT | ASYNC)) !== 0) {
1183
- batch.schedule(e2);
1184
- } else {
1185
- __privateMethod(_a4 = batch, _Batch_instances, defer_effects_fn).call(_a4, [e2]);
1186
- }
1164
+ return;
1165
+ }
1166
+ __privateSet(this, _pending_count, __privateGet(this, _pending_count) + d);
1167
+ if (__privateGet(this, _pending_count) === 0) {
1168
+ __privateMethod(this, _Boundary_instances, resolve_fn).call(this, batch);
1169
+ if (__privateGet(this, _pending_effect)) {
1170
+ pause_effect(__privateGet(this, _pending_effect), () => {
1171
+ __privateSet(this, _pending_effect, null);
1172
+ });
1173
+ }
1174
+ if (__privateGet(this, _offscreen_fragment)) {
1175
+ __privateGet(this, _anchor).before(__privateGet(this, _offscreen_fragment));
1176
+ __privateSet(this, _offscreen_fragment, null);
1177
+ }
1178
+ }
1179
+ };
1180
+ handle_error_fn = function(error) {
1181
+ if (__privateGet(this, _main_effect)) {
1182
+ destroy_effect(__privateGet(this, _main_effect));
1183
+ __privateSet(this, _main_effect, null);
1184
+ }
1185
+ if (__privateGet(this, _pending_effect)) {
1186
+ destroy_effect(__privateGet(this, _pending_effect));
1187
+ __privateSet(this, _pending_effect, null);
1188
+ }
1189
+ if (__privateGet(this, _failed_effect)) {
1190
+ destroy_effect(__privateGet(this, _failed_effect));
1191
+ __privateSet(this, _failed_effect, null);
1192
+ }
1193
+ if (hydrating) {
1194
+ set_hydrate_node(
1195
+ /** @type {TemplateNode} */
1196
+ __privateGet(this, _hydrate_open)
1197
+ );
1198
+ next();
1199
+ set_hydrate_node(skip_nodes());
1200
+ }
1201
+ let failed = __privateGet(this, _props).failed;
1202
+ const handle_error_result = (transformed_error) => {
1203
+ const { reset: reset2, invoke_onerror } = __privateMethod(this, _Boundary_instances, create_reset_fn).call(this, transformed_error);
1204
+ invoke_onerror();
1205
+ if (failed) {
1206
+ __privateSet(this, _failed_effect, __privateMethod(this, _Boundary_instances, run_fn).call(this, () => {
1207
+ try {
1208
+ return branch(() => {
1209
+ var effect2 = (
1210
+ /** @type {Effect} */
1211
+ active_effect
1212
+ );
1213
+ effect2.b = this;
1214
+ effect2.f |= BOUNDARY_EFFECT;
1215
+ failed(
1216
+ __privateGet(this, _anchor),
1217
+ () => transformed_error,
1218
+ () => reset2
1219
+ );
1187
1220
  });
1221
+ } catch (error2) {
1222
+ invoke_error_boundary(
1223
+ error2,
1224
+ /** @type {Effect} */
1225
+ __privateGet(this, _effect).parent
1226
+ );
1227
+ return null;
1188
1228
  }
1189
- }
1190
- batch.activate();
1191
- var marked = /* @__PURE__ */ new Set();
1192
- var checked = /* @__PURE__ */ new Map();
1193
- for (var source2 of sources) {
1194
- mark_effects(source2, others, marked, checked);
1195
- }
1196
- checked = /* @__PURE__ */ new Map();
1197
- var current_unequal = [...batch.current.keys()].filter(
1198
- (c2) => this.current.has(c2) ? (
1199
- /** @type {[any, boolean]} */
1200
- this.current.get(c2)[0] !== c2
1201
- ) : true
1229
+ }));
1230
+ }
1231
+ };
1232
+ queue_micro_task(() => {
1233
+ var result;
1234
+ try {
1235
+ result = this.transform_error(error);
1236
+ } catch (e2) {
1237
+ invoke_error_boundary(e2, __privateGet(this, _effect) && __privateGet(this, _effect).parent);
1238
+ return;
1239
+ }
1240
+ if (result !== null && typeof result === "object" && typeof /** @type {any} */
1241
+ result.then === "function") {
1242
+ result.then(
1243
+ handle_error_result,
1244
+ /** @param {unknown} e */
1245
+ (e2) => invoke_error_boundary(e2, __privateGet(this, _effect) && __privateGet(this, _effect).parent)
1202
1246
  );
1203
- for (const effect2 of __privateGet(this, _new_effects)) {
1204
- if ((effect2.f & (DESTROYED | INERT | EAGER_EFFECT)) === 0 && depends_on(effect2, current_unequal, checked)) {
1205
- if ((effect2.f & (ASYNC | BLOCK_EFFECT)) !== 0) {
1206
- set_signal_status(effect2, DIRTY);
1207
- batch.schedule(effect2);
1208
- } else {
1209
- __privateGet(batch, _dirty_effects).add(effect2);
1210
- }
1211
- }
1212
- }
1213
- if (__privateGet(batch, _roots).length > 0) {
1214
- batch.apply();
1215
- for (var root2 of __privateGet(batch, _roots)) {
1216
- __privateMethod(_a3 = batch, _Batch_instances, traverse_fn).call(_a3, root2, [], []);
1217
- }
1218
- __privateSet(batch, _roots, []);
1219
- }
1220
- batch.deactivate();
1247
+ } else {
1248
+ handle_error_result(result);
1221
1249
  }
1250
+ });
1251
+ };
1252
+ function flatten(blockers, sync, async, fn) {
1253
+ const d = derived;
1254
+ var pending = blockers.filter((b) => !b.settled);
1255
+ var deriveds = sync.map(d);
1256
+ if (async.length === 0 && pending.length === 0) {
1257
+ fn(deriveds);
1258
+ return;
1222
1259
  }
1223
- for (const batch of batches) {
1224
- if (__privateGet(batch, _blockers).has(this)) {
1225
- __privateGet(batch, _blockers).delete(this);
1226
- if (__privateGet(batch, _blockers).size === 0 && !__privateMethod(_b2 = batch, _Batch_instances, is_deferred_fn).call(_b2)) {
1227
- batch.activate();
1228
- __privateMethod(_c = batch, _Batch_instances, process_fn).call(_c);
1229
- }
1260
+ var parent = (
1261
+ /** @type {Effect} */
1262
+ active_effect
1263
+ );
1264
+ var restore = capture();
1265
+ var blocker_promise = pending.length === 1 ? pending[0].promise : pending.length > 1 ? Promise.all(pending.map((b) => b.promise)) : null;
1266
+ function finish(async2) {
1267
+ if ((parent.f & DESTROYED) !== 0) {
1268
+ return;
1230
1269
  }
1270
+ restore();
1271
+ try {
1272
+ fn([...deriveds, ...async2]);
1273
+ } catch (error) {
1274
+ invoke_error_boundary(error, parent);
1275
+ }
1276
+ unset_context();
1231
1277
  }
1232
- };
1233
- var Batch = _Batch;
1234
- function flushSync(fn) {
1235
- var was_flushing_sync = is_flushing_sync;
1236
- is_flushing_sync = true;
1237
- try {
1238
- var result;
1239
- if (fn) ;
1240
- while (true) {
1241
- flush_tasks();
1242
- if (current_batch === null) {
1243
- return (
1244
- /** @type {T} */
1245
- result
1246
- );
1278
+ var decrement_pending = increment_pending();
1279
+ if (async.length === 0) {
1280
+ blocker_promise.then(() => finish([])).finally(decrement_pending);
1281
+ return;
1282
+ }
1283
+ function run() {
1284
+ Promise.all(async.map((expression) => /* @__PURE__ */ async_derived(expression))).then(finish).catch((error) => invoke_error_boundary(error, parent)).finally(decrement_pending);
1285
+ }
1286
+ if (blocker_promise) {
1287
+ blocker_promise.then(() => {
1288
+ restore();
1289
+ run();
1290
+ unset_context();
1291
+ });
1292
+ } else {
1293
+ run();
1294
+ }
1295
+ }
1296
+ function capture() {
1297
+ var previous_effect = (
1298
+ /** @type {Effect} */
1299
+ active_effect
1300
+ );
1301
+ var previous_reaction = active_reaction;
1302
+ var previous_component_context = component_context;
1303
+ var previous_batch2 = (
1304
+ /** @type {Batch} */
1305
+ current_batch
1306
+ );
1307
+ return function restore(activate_batch = true) {
1308
+ set_active_effect(previous_effect);
1309
+ set_active_reaction(previous_reaction);
1310
+ set_component_context(previous_component_context);
1311
+ if (activate_batch && (previous_effect.f & DESTROYED) === 0) {
1312
+ previous_batch2?.activate();
1313
+ previous_batch2?.apply();
1314
+ }
1315
+ };
1316
+ }
1317
+ function unset_context(deactivate_batch = true) {
1318
+ set_active_effect(null);
1319
+ set_active_reaction(null);
1320
+ set_component_context(null);
1321
+ if (deactivate_batch) current_batch?.deactivate();
1322
+ }
1323
+ function increment_pending() {
1324
+ var effect2 = (
1325
+ /** @type {Effect} */
1326
+ active_effect
1327
+ );
1328
+ var boundary2 = effect2.b;
1329
+ var batch = (
1330
+ /** @type {Batch} */
1331
+ current_batch
1332
+ );
1333
+ var blocking = !!boundary2?.is_rendered();
1334
+ boundary2?.update_pending_count(1, batch);
1335
+ batch.increment(blocking, effect2);
1336
+ return () => {
1337
+ boundary2?.update_pending_count(-1, batch);
1338
+ batch.decrement(blocking, effect2);
1339
+ };
1340
+ }
1341
+ // @__NO_SIDE_EFFECTS__
1342
+ function derived(fn) {
1343
+ var flags2 = DERIVED | DIRTY;
1344
+ if (active_effect !== null) {
1345
+ active_effect.f |= EFFECT_PRESERVED;
1346
+ }
1347
+ const signal = {
1348
+ ctx: component_context,
1349
+ deps: null,
1350
+ effects: null,
1351
+ equals,
1352
+ f: flags2,
1353
+ fn,
1354
+ reactions: null,
1355
+ rv: 0,
1356
+ v: (
1357
+ /** @type {V} */
1358
+ UNINITIALIZED
1359
+ ),
1360
+ wv: 0,
1361
+ parent: active_effect,
1362
+ ac: null
1363
+ };
1364
+ return signal;
1365
+ }
1366
+ var OBSOLETE = Symbol("obsolete");
1367
+ // @__NO_SIDE_EFFECTS__
1368
+ function async_derived(fn, label, location) {
1369
+ let parent = (
1370
+ /** @type {Effect | null} */
1371
+ active_effect
1372
+ );
1373
+ if (parent === null) {
1374
+ async_derived_orphan();
1375
+ }
1376
+ var promise = (
1377
+ /** @type {Promise<V>} */
1378
+ /** @type {unknown} */
1379
+ void 0
1380
+ );
1381
+ var signal = source(
1382
+ /** @type {V} */
1383
+ UNINITIALIZED
1384
+ );
1385
+ var should_suspend = !active_reaction;
1386
+ var deferreds = /* @__PURE__ */ new Set();
1387
+ async_effect(() => {
1388
+ var effect2 = (
1389
+ /** @type {Effect} */
1390
+ active_effect
1391
+ );
1392
+ var d = deferred();
1393
+ promise = d.promise;
1394
+ try {
1395
+ Promise.resolve(fn()).then(d.resolve, (e2) => {
1396
+ if (e2 !== STALE_REACTION) d.reject(e2);
1397
+ }).finally(unset_context);
1398
+ } catch (error) {
1399
+ d.reject(error);
1400
+ unset_context();
1401
+ }
1402
+ var batch = (
1403
+ /** @type {Batch} */
1404
+ current_batch
1405
+ );
1406
+ if (should_suspend) {
1407
+ if ((effect2.f & REACTION_RAN) !== 0) {
1408
+ var decrement_pending = increment_pending();
1409
+ }
1410
+ if (
1411
+ // boundary can be null if the async derived is inside an $effect.root not connected to the component render tree
1412
+ parent.b?.is_rendered()
1413
+ ) {
1414
+ batch.async_deriveds.get(effect2)?.reject(OBSOLETE);
1415
+ } else {
1416
+ for (const d2 of deferreds.values()) {
1417
+ d2.reject(OBSOLETE);
1418
+ }
1247
1419
  }
1248
- current_batch.flush();
1420
+ deferreds.add(d);
1421
+ batch.async_deriveds.set(effect2, d);
1249
1422
  }
1250
- } finally {
1251
- is_flushing_sync = was_flushing_sync;
1252
- }
1253
- }
1254
- function infinite_loop_guard() {
1255
- try {
1256
- effect_update_depth_exceeded();
1257
- } catch (error) {
1258
- invoke_error_boundary(error, last_scheduled_effect);
1259
- }
1260
- }
1261
- var eager_block_effects = null;
1262
- function flush_queued_effects(effects) {
1263
- var length = effects.length;
1264
- if (length === 0) return;
1265
- var i = 0;
1266
- while (i < length) {
1267
- var effect2 = effects[i++];
1268
- if ((effect2.f & (DESTROYED | INERT)) === 0 && is_dirty(effect2)) {
1269
- eager_block_effects = /* @__PURE__ */ new Set();
1270
- update_effect(effect2);
1271
- if (effect2.deps === null && effect2.first === null && effect2.nodes === null && effect2.teardown === null && effect2.ac === null) {
1272
- unlink_effect(effect2);
1423
+ const handler = (value, error = void 0) => {
1424
+ decrement_pending?.();
1425
+ deferreds.delete(d);
1426
+ if (error === OBSOLETE) return;
1427
+ batch.activate();
1428
+ if (error) {
1429
+ signal.f |= ERROR_VALUE;
1430
+ internal_set(signal, error);
1431
+ } else {
1432
+ if ((signal.f & ERROR_VALUE) !== 0) {
1433
+ signal.f ^= ERROR_VALUE;
1434
+ }
1435
+ internal_set(signal, value);
1273
1436
  }
1274
- if (eager_block_effects?.size > 0) {
1275
- old_values.clear();
1276
- for (const e2 of eager_block_effects) {
1277
- if ((e2.f & (DESTROYED | INERT)) !== 0) continue;
1278
- const ordered_effects = [e2];
1279
- let ancestor = e2.parent;
1280
- while (ancestor !== null) {
1281
- if (eager_block_effects.has(ancestor)) {
1282
- eager_block_effects.delete(ancestor);
1283
- ordered_effects.push(ancestor);
1284
- }
1285
- ancestor = ancestor.parent;
1286
- }
1287
- for (let j = ordered_effects.length - 1; j >= 0; j--) {
1288
- const e3 = ordered_effects[j];
1289
- if ((e3.f & (DESTROYED | INERT)) !== 0) continue;
1290
- update_effect(e3);
1291
- }
1437
+ batch.deactivate();
1438
+ };
1439
+ d.promise.then(handler, (e2) => handler(null, e2 || "unknown"));
1440
+ });
1441
+ teardown(() => {
1442
+ for (const d of deferreds) {
1443
+ d.reject(OBSOLETE);
1444
+ }
1445
+ });
1446
+ return new Promise((fulfil) => {
1447
+ function next2(p) {
1448
+ function go() {
1449
+ if (p === promise) {
1450
+ fulfil(signal);
1451
+ } else {
1452
+ next2(promise);
1292
1453
  }
1293
- eager_block_effects.clear();
1294
1454
  }
1455
+ p.then(go, go);
1456
+ }
1457
+ next2(promise);
1458
+ });
1459
+ }
1460
+ // @__NO_SIDE_EFFECTS__
1461
+ function user_derived(fn) {
1462
+ const d = /* @__PURE__ */ derived(fn);
1463
+ push_reaction_value(d);
1464
+ return d;
1465
+ }
1466
+ // @__NO_SIDE_EFFECTS__
1467
+ function derived_safe_equal(fn) {
1468
+ const signal = /* @__PURE__ */ derived(fn);
1469
+ signal.equals = safe_equals;
1470
+ return signal;
1471
+ }
1472
+ function destroy_derived_effects(derived2) {
1473
+ var effects = derived2.effects;
1474
+ if (effects !== null) {
1475
+ derived2.effects = null;
1476
+ for (var i = 0; i < effects.length; i += 1) {
1477
+ destroy_effect(
1478
+ /** @type {Effect} */
1479
+ effects[i]
1480
+ );
1295
1481
  }
1296
1482
  }
1297
- eager_block_effects = null;
1298
1483
  }
1299
- function mark_effects(value, sources, marked, checked) {
1300
- if (marked.has(value)) return;
1301
- marked.add(value);
1302
- if (value.reactions !== null) {
1303
- for (const reaction of value.reactions) {
1304
- const flags2 = reaction.f;
1305
- if ((flags2 & DERIVED) !== 0) {
1306
- mark_effects(
1307
- /** @type {Derived} */
1308
- reaction,
1309
- sources,
1310
- marked,
1311
- checked
1312
- );
1313
- } else if ((flags2 & (ASYNC | BLOCK_EFFECT)) !== 0 && (flags2 & DIRTY) === 0 && depends_on(reaction, sources, checked)) {
1314
- set_signal_status(reaction, DIRTY);
1315
- schedule_effect(
1316
- /** @type {Effect} */
1317
- reaction
1318
- );
1319
- }
1484
+ function execute_derived(derived2) {
1485
+ var value;
1486
+ var prev_active_effect = active_effect;
1487
+ var parent = derived2.parent;
1488
+ 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
1489
+ (parent.f & (DESTROYED | INERT)) !== 0) {
1490
+ derived_inert();
1491
+ return derived2.v;
1492
+ }
1493
+ set_active_effect(parent);
1494
+ {
1495
+ try {
1496
+ derived2.f &= ~WAS_MARKED;
1497
+ destroy_derived_effects(derived2);
1498
+ value = update_reaction(derived2);
1499
+ } finally {
1500
+ set_active_effect(prev_active_effect);
1320
1501
  }
1321
1502
  }
1503
+ return value;
1322
1504
  }
1323
- function depends_on(reaction, sources, checked) {
1324
- const depends = checked.get(reaction);
1325
- if (depends !== void 0) return depends;
1326
- if (reaction.deps !== null) {
1327
- for (const dep of reaction.deps) {
1328
- if (includes.call(sources, dep)) {
1329
- return true;
1505
+ function update_derived(derived2) {
1506
+ var value = execute_derived(derived2);
1507
+ if (!derived2.equals(value)) {
1508
+ derived2.wv = increment_write_version();
1509
+ if (!current_batch?.is_fork || derived2.deps === null) {
1510
+ if (current_batch !== null) {
1511
+ current_batch.capture(derived2, value, true);
1512
+ previous_batch?.capture(derived2, value, true);
1513
+ } else {
1514
+ derived2.v = value;
1330
1515
  }
1331
- if ((dep.f & DERIVED) !== 0 && depends_on(
1332
- /** @type {Derived} */
1333
- dep,
1334
- sources,
1335
- checked
1336
- )) {
1337
- checked.set(
1338
- /** @type {Derived} */
1339
- dep,
1340
- true
1341
- );
1342
- return true;
1516
+ if (derived2.deps === null) {
1517
+ set_signal_status(derived2, CLEAN);
1518
+ return;
1343
1519
  }
1344
1520
  }
1345
1521
  }
1346
- checked.set(reaction, false);
1347
- return false;
1348
- }
1349
- function schedule_effect(effect2) {
1350
- current_batch.schedule(effect2);
1351
- }
1352
- function reset_branch(effect2, tracked) {
1353
- if ((effect2.f & BRANCH_EFFECT) !== 0 && (effect2.f & CLEAN) !== 0) {
1522
+ if (is_destroying_effect) {
1354
1523
  return;
1355
1524
  }
1356
- if ((effect2.f & DIRTY) !== 0) {
1357
- tracked.d.push(effect2);
1358
- } else if ((effect2.f & MAYBE_DIRTY) !== 0) {
1359
- tracked.m.push(effect2);
1525
+ if (batch_values !== null) {
1526
+ if (effect_tracking() || current_batch?.is_fork) {
1527
+ batch_values.set(derived2, value);
1528
+ }
1529
+ } else {
1530
+ update_derived_status(derived2);
1360
1531
  }
1361
- set_signal_status(effect2, CLEAN);
1362
- var e2 = effect2.first;
1363
- while (e2 !== null) {
1364
- reset_branch(e2, tracked);
1365
- e2 = e2.next;
1532
+ }
1533
+ function freeze_derived_effects(derived2) {
1534
+ if (derived2.effects === null) return;
1535
+ for (const e2 of derived2.effects) {
1536
+ if (e2.teardown || e2.ac) {
1537
+ e2.teardown?.();
1538
+ if (e2.ac !== null) {
1539
+ without_reactive_context(() => {
1540
+ e2.ac.abort(STALE_REACTION);
1541
+ e2.ac = null;
1542
+ });
1543
+ }
1544
+ if (e2.fn !== null) e2.teardown = noop;
1545
+ remove_reactions(e2, 0);
1546
+ destroy_effect_children(e2);
1547
+ }
1366
1548
  }
1367
1549
  }
1368
- function reset_all(effect2) {
1369
- set_signal_status(effect2, CLEAN);
1370
- var e2 = effect2.first;
1371
- while (e2 !== null) {
1372
- reset_all(e2);
1373
- e2 = e2.next;
1550
+ function unfreeze_derived_effects(derived2) {
1551
+ if (derived2.effects === null) return;
1552
+ for (const e2 of derived2.effects) {
1553
+ if (e2.teardown && e2.fn !== null) {
1554
+ update_effect(e2);
1555
+ }
1374
1556
  }
1375
1557
  }
1376
- function createSubscriber(start) {
1377
- let subscribers = 0;
1378
- let version = source(0);
1379
- let stop;
1380
- return () => {
1381
- if (effect_tracking()) {
1382
- get(version);
1383
- render_effect(() => {
1384
- if (subscribers === 0) {
1385
- stop = untrack(() => start(() => increment(version)));
1386
- }
1387
- subscribers += 1;
1388
- return () => {
1389
- queue_micro_task(() => {
1390
- subscribers -= 1;
1391
- if (subscribers === 0) {
1392
- stop?.();
1393
- stop = void 0;
1394
- increment(version);
1395
- }
1396
- });
1397
- };
1398
- });
1558
+ var first_batch = null;
1559
+ var last_batch = null;
1560
+ var current_batch = null;
1561
+ var previous_batch = null;
1562
+ var batch_values = null;
1563
+ var last_scheduled_effect = null;
1564
+ var is_flushing_sync = false;
1565
+ var is_processing = false;
1566
+ var collected_effects = null;
1567
+ var legacy_updates = null;
1568
+ var flush_count = 0;
1569
+ var uid = 1;
1570
+ var _Batch = class _Batch2 {
1571
+ constructor() {
1572
+ __privateAdd(this, _Batch_instances);
1573
+ __publicField(this, "id", uid++);
1574
+ __privateAdd(this, _started, false);
1575
+ __publicField(this, "linked", true);
1576
+ __privateAdd(this, _prev, null);
1577
+ __privateAdd(this, _next, null);
1578
+ __publicField(this, "async_deriveds", /* @__PURE__ */ new Map());
1579
+ __publicField(this, "current", /* @__PURE__ */ new Map());
1580
+ __publicField(this, "previous", /* @__PURE__ */ new Map());
1581
+ __privateAdd(this, _commit_callbacks, /* @__PURE__ */ new Set());
1582
+ __privateAdd(this, _discard_callbacks, /* @__PURE__ */ new Set());
1583
+ __privateAdd(this, _pending, 0);
1584
+ __privateAdd(this, _blocking_pending, /* @__PURE__ */ new Map());
1585
+ __privateAdd(this, _deferred, null);
1586
+ __privateAdd(this, _roots, []);
1587
+ __privateAdd(this, _new_effects, []);
1588
+ __privateAdd(this, _dirty_effects2, /* @__PURE__ */ new Set());
1589
+ __privateAdd(this, _maybe_dirty_effects2, /* @__PURE__ */ new Set());
1590
+ __privateAdd(this, _skipped_branches, /* @__PURE__ */ new Map());
1591
+ __privateAdd(this, _unskipped_branches, /* @__PURE__ */ new Set());
1592
+ __publicField(this, "is_fork", false);
1593
+ __privateAdd(this, _decrement_queued, false);
1594
+ if (last_batch === null) {
1595
+ first_batch = last_batch = this;
1596
+ } else {
1597
+ __privateSet(last_batch, _next, this);
1598
+ __privateSet(this, _prev, last_batch);
1399
1599
  }
1400
- };
1401
- }
1402
- var flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED;
1403
- function boundary(node, props, children, transform_error) {
1404
- new Boundary(node, props, children, transform_error);
1405
- }
1406
- var Boundary = class {
1600
+ last_batch = this;
1601
+ }
1407
1602
  /**
1408
- * @param {TemplateNode} node
1409
- * @param {BoundaryProps} props
1410
- * @param {((anchor: Node) => void)} children
1411
- * @param {((error: unknown) => unknown) | undefined} [transform_error]
1603
+ * Add an effect to the #skipped_branches map and reset its children
1604
+ * @param {Effect} effect
1412
1605
  */
1413
- constructor(node, props, children, transform_error) {
1414
- __privateAdd(this, _Boundary_instances);
1415
- __publicField(this, "parent");
1416
- __publicField(this, "is_pending", false);
1417
- __publicField(this, "transform_error");
1418
- __privateAdd(this, _anchor);
1419
- __privateAdd(this, _hydrate_open, hydrating ? hydrate_node : null);
1420
- __privateAdd(this, _props);
1421
- __privateAdd(this, _children);
1422
- __privateAdd(this, _effect);
1423
- __privateAdd(this, _main_effect, null);
1424
- __privateAdd(this, _pending_effect, null);
1425
- __privateAdd(this, _failed_effect, null);
1426
- __privateAdd(this, _offscreen_fragment, null);
1427
- __privateAdd(this, _local_pending_count, 0);
1428
- __privateAdd(this, _pending_count, 0);
1429
- __privateAdd(this, _pending_count_update_queued, false);
1430
- __privateAdd(this, _dirty_effects2, /* @__PURE__ */ new Set());
1431
- __privateAdd(this, _maybe_dirty_effects2, /* @__PURE__ */ new Set());
1432
- __privateAdd(this, _effect_pending, null);
1433
- __privateAdd(this, _effect_pending_subscriber, createSubscriber(() => {
1434
- __privateSet(this, _effect_pending, source(__privateGet(this, _local_pending_count)));
1435
- return () => {
1436
- __privateSet(this, _effect_pending, null);
1437
- };
1438
- }));
1439
- __privateSet(this, _anchor, node);
1440
- __privateSet(this, _props, props);
1441
- __privateSet(this, _children, (anchor) => {
1442
- var effect2 = (
1443
- /** @type {Effect} */
1444
- active_effect
1445
- );
1446
- effect2.b = this;
1447
- effect2.f |= BOUNDARY_EFFECT;
1448
- children(anchor);
1449
- });
1450
- this.parent = /** @type {Effect} */
1451
- active_effect.b;
1452
- this.transform_error = transform_error ?? this.parent?.transform_error ?? ((e2) => e2);
1453
- __privateSet(this, _effect, block(() => {
1454
- if (hydrating) {
1455
- const comment2 = (
1456
- /** @type {Comment} */
1457
- __privateGet(this, _hydrate_open)
1458
- );
1459
- hydrate_next();
1460
- const server_rendered_pending = comment2.data === HYDRATION_START_ELSE;
1461
- const server_rendered_failed = comment2.data.startsWith(HYDRATION_START_FAILED);
1462
- if (server_rendered_failed) {
1463
- const serialized_error = JSON.parse(comment2.data.slice(HYDRATION_START_FAILED.length));
1464
- __privateMethod(this, _Boundary_instances, hydrate_failed_content_fn).call(this, serialized_error);
1465
- } else if (server_rendered_pending) {
1466
- __privateMethod(this, _Boundary_instances, hydrate_pending_content_fn).call(this);
1467
- } else {
1468
- __privateMethod(this, _Boundary_instances, hydrate_resolved_content_fn).call(this);
1469
- }
1470
- } else {
1471
- __privateMethod(this, _Boundary_instances, render_fn).call(this);
1472
- }
1473
- }, flags));
1474
- if (hydrating) {
1475
- __privateSet(this, _anchor, hydrate_node);
1606
+ skip_effect(effect2) {
1607
+ if (!__privateGet(this, _skipped_branches).has(effect2)) {
1608
+ __privateGet(this, _skipped_branches).set(effect2, { d: [], m: [] });
1476
1609
  }
1610
+ __privateGet(this, _unskipped_branches).delete(effect2);
1477
1611
  }
1478
1612
  /**
1479
- * Defer an effect inside a pending boundary until the boundary resolves
1613
+ * Remove an effect from the #skipped_branches map and reschedule
1614
+ * any tracked dirty/maybe_dirty child effects
1480
1615
  * @param {Effect} effect
1616
+ * @param {(e: Effect) => void} callback
1481
1617
  */
1482
- defer_effect(effect2) {
1483
- defer_effect(effect2, __privateGet(this, _dirty_effects2), __privateGet(this, _maybe_dirty_effects2));
1618
+ unskip_effect(effect2, callback = (e2) => this.schedule(e2)) {
1619
+ var tracked = __privateGet(this, _skipped_branches).get(effect2);
1620
+ if (tracked) {
1621
+ __privateGet(this, _skipped_branches).delete(effect2);
1622
+ for (var e2 of tracked.d) {
1623
+ set_signal_status(e2, DIRTY);
1624
+ callback(e2);
1625
+ }
1626
+ for (e2 of tracked.m) {
1627
+ set_signal_status(e2, MAYBE_DIRTY);
1628
+ callback(e2);
1629
+ }
1630
+ }
1631
+ __privateGet(this, _unskipped_branches).add(effect2);
1484
1632
  }
1485
1633
  /**
1486
- * Returns `false` if the effect exists inside a boundary whose pending snippet is shown
1487
- * @returns {boolean}
1634
+ * Associate a change to a given source with the current
1635
+ * batch, noting its previous and current values
1636
+ * @param {Value} source
1637
+ * @param {any} value
1638
+ * @param {boolean} [is_derived]
1488
1639
  */
1489
- is_rendered() {
1490
- return !this.is_pending && (!this.parent || this.parent.is_rendered());
1640
+ capture(source2, value, is_derived = false) {
1641
+ if (source2.v !== UNINITIALIZED && !this.previous.has(source2)) {
1642
+ this.previous.set(source2, source2.v);
1643
+ }
1644
+ if ((source2.f & ERROR_VALUE) === 0) {
1645
+ this.current.set(source2, [value, is_derived]);
1646
+ batch_values?.set(source2, value);
1647
+ }
1648
+ if (!this.is_fork) {
1649
+ source2.v = value;
1650
+ }
1491
1651
  }
1492
- has_pending_snippet() {
1493
- return !!__privateGet(this, _props).pending;
1652
+ activate() {
1653
+ current_batch = this;
1654
+ }
1655
+ deactivate() {
1656
+ current_batch = null;
1657
+ batch_values = null;
1658
+ }
1659
+ flush() {
1660
+ try {
1661
+ if (DEV) ;
1662
+ is_processing = true;
1663
+ current_batch = this;
1664
+ __privateMethod(this, _Batch_instances, process_fn).call(this);
1665
+ } finally {
1666
+ flush_count = 0;
1667
+ last_scheduled_effect = null;
1668
+ collected_effects = null;
1669
+ legacy_updates = null;
1670
+ is_processing = false;
1671
+ current_batch = null;
1672
+ batch_values = null;
1673
+ old_values.clear();
1674
+ }
1675
+ }
1676
+ discard() {
1677
+ for (const fn of __privateGet(this, _discard_callbacks)) fn(this);
1678
+ __privateGet(this, _discard_callbacks).clear();
1679
+ for (const deferred2 of this.async_deriveds.values()) {
1680
+ deferred2.reject(OBSOLETE);
1681
+ }
1682
+ __privateMethod(this, _Batch_instances, unlink_fn).call(this);
1683
+ __privateGet(this, _deferred)?.resolve();
1494
1684
  }
1495
1685
  /**
1496
- * Update the source that powers `$effect.pending()` inside this boundary,
1497
- * and controls when the current `pending` snippet (if any) is removed.
1498
- * Do not call from inside the class
1499
- * @param {1 | -1} d
1500
- * @param {Batch} batch
1686
+ * @param {Effect} effect
1501
1687
  */
1502
- update_pending_count(d, batch) {
1503
- __privateMethod(this, _Boundary_instances, update_pending_count_fn).call(this, d, batch);
1504
- __privateSet(this, _local_pending_count, __privateGet(this, _local_pending_count) + d);
1505
- if (!__privateGet(this, _effect_pending) || __privateGet(this, _pending_count_update_queued)) return;
1506
- __privateSet(this, _pending_count_update_queued, true);
1688
+ register_created_effect(effect2) {
1689
+ __privateGet(this, _new_effects).push(effect2);
1690
+ }
1691
+ /**
1692
+ * @param {boolean} blocking
1693
+ * @param {Effect} effect
1694
+ */
1695
+ increment(blocking, effect2) {
1696
+ __privateSet(this, _pending, __privateGet(this, _pending) + 1);
1697
+ if (blocking) {
1698
+ let blocking_pending_count = __privateGet(this, _blocking_pending).get(effect2) ?? 0;
1699
+ __privateGet(this, _blocking_pending).set(effect2, blocking_pending_count + 1);
1700
+ }
1701
+ }
1702
+ /**
1703
+ * @param {boolean} blocking
1704
+ * @param {Effect} effect
1705
+ */
1706
+ decrement(blocking, effect2) {
1707
+ __privateSet(this, _pending, __privateGet(this, _pending) - 1);
1708
+ if (blocking) {
1709
+ let blocking_pending_count = __privateGet(this, _blocking_pending).get(effect2) ?? 0;
1710
+ if (blocking_pending_count === 1) {
1711
+ __privateGet(this, _blocking_pending).delete(effect2);
1712
+ } else {
1713
+ __privateGet(this, _blocking_pending).set(effect2, blocking_pending_count - 1);
1714
+ }
1715
+ }
1716
+ if (__privateGet(this, _decrement_queued)) return;
1717
+ __privateSet(this, _decrement_queued, true);
1507
1718
  queue_micro_task(() => {
1508
- __privateSet(this, _pending_count_update_queued, false);
1509
- if (__privateGet(this, _effect_pending)) {
1510
- internal_set(__privateGet(this, _effect_pending), __privateGet(this, _local_pending_count));
1719
+ __privateSet(this, _decrement_queued, false);
1720
+ if (this.linked) {
1721
+ this.flush();
1511
1722
  }
1512
1723
  });
1513
1724
  }
1514
- get_effect_pending() {
1515
- __privateGet(this, _effect_pending_subscriber).call(this);
1516
- return get(
1517
- /** @type {Source<number>} */
1518
- __privateGet(this, _effect_pending)
1519
- );
1520
- }
1521
- /** @param {unknown} error */
1522
- error(error) {
1523
- var onerror = __privateGet(this, _props).onerror;
1524
- let failed = __privateGet(this, _props).failed;
1525
- if (!onerror && !failed) {
1526
- throw error;
1527
- }
1528
- if (__privateGet(this, _main_effect)) {
1529
- destroy_effect(__privateGet(this, _main_effect));
1530
- __privateSet(this, _main_effect, null);
1531
- }
1532
- if (__privateGet(this, _pending_effect)) {
1533
- destroy_effect(__privateGet(this, _pending_effect));
1534
- __privateSet(this, _pending_effect, null);
1535
- }
1536
- if (__privateGet(this, _failed_effect)) {
1537
- destroy_effect(__privateGet(this, _failed_effect));
1538
- __privateSet(this, _failed_effect, null);
1725
+ /**
1726
+ * @param {Set<Effect>} dirty_effects
1727
+ * @param {Set<Effect>} maybe_dirty_effects
1728
+ */
1729
+ transfer_effects(dirty_effects, maybe_dirty_effects) {
1730
+ for (const e2 of dirty_effects) {
1731
+ __privateGet(this, _dirty_effects2).add(e2);
1539
1732
  }
1540
- if (hydrating) {
1541
- set_hydrate_node(
1542
- /** @type {TemplateNode} */
1543
- __privateGet(this, _hydrate_open)
1544
- );
1545
- next();
1546
- set_hydrate_node(skip_nodes());
1733
+ for (const e2 of maybe_dirty_effects) {
1734
+ __privateGet(this, _maybe_dirty_effects2).add(e2);
1547
1735
  }
1548
- var did_reset = false;
1549
- var calling_on_error = false;
1550
- const reset2 = () => {
1551
- if (did_reset) {
1552
- svelte_boundary_reset_noop();
1553
- return;
1554
- }
1555
- did_reset = true;
1556
- if (calling_on_error) {
1557
- svelte_boundary_reset_onerror();
1558
- }
1559
- if (__privateGet(this, _failed_effect) !== null) {
1560
- pause_effect(__privateGet(this, _failed_effect), () => {
1561
- __privateSet(this, _failed_effect, null);
1562
- });
1563
- }
1564
- __privateMethod(this, _Boundary_instances, run_fn).call(this, () => {
1565
- __privateMethod(this, _Boundary_instances, render_fn).call(this);
1566
- });
1567
- };
1568
- const handle_error_result = (transformed_error) => {
1569
- try {
1570
- calling_on_error = true;
1571
- onerror?.(transformed_error, reset2);
1572
- calling_on_error = false;
1573
- } catch (error2) {
1574
- invoke_error_boundary(error2, __privateGet(this, _effect) && __privateGet(this, _effect).parent);
1575
- }
1576
- if (failed) {
1577
- __privateSet(this, _failed_effect, __privateMethod(this, _Boundary_instances, run_fn).call(this, () => {
1578
- try {
1579
- return branch(() => {
1580
- var effect2 = (
1581
- /** @type {Effect} */
1582
- active_effect
1583
- );
1584
- effect2.b = this;
1585
- effect2.f |= BOUNDARY_EFFECT;
1586
- failed(
1587
- __privateGet(this, _anchor),
1588
- () => transformed_error,
1589
- () => reset2
1590
- );
1591
- });
1592
- } catch (error2) {
1593
- invoke_error_boundary(
1594
- error2,
1595
- /** @type {Effect} */
1596
- __privateGet(this, _effect).parent
1597
- );
1598
- return null;
1736
+ dirty_effects.clear();
1737
+ maybe_dirty_effects.clear();
1738
+ }
1739
+ /** @param {(batch: Batch) => void} fn */
1740
+ oncommit(fn) {
1741
+ __privateGet(this, _commit_callbacks).add(fn);
1742
+ }
1743
+ /** @param {(batch: Batch) => void} fn */
1744
+ ondiscard(fn) {
1745
+ __privateGet(this, _discard_callbacks).add(fn);
1746
+ }
1747
+ settled() {
1748
+ return (__privateGet(this, _deferred) ?? __privateSet(this, _deferred, deferred())).promise;
1749
+ }
1750
+ static ensure() {
1751
+ if (current_batch === null) {
1752
+ const batch = current_batch = new _Batch2();
1753
+ if (!is_processing && !is_flushing_sync) {
1754
+ queue_micro_task(() => {
1755
+ if (!__privateGet(batch, _started)) {
1756
+ batch.flush();
1599
1757
  }
1600
- }));
1601
- }
1602
- };
1603
- queue_micro_task(() => {
1604
- var result;
1605
- try {
1606
- result = this.transform_error(error);
1607
- } catch (e2) {
1608
- invoke_error_boundary(e2, __privateGet(this, _effect) && __privateGet(this, _effect).parent);
1609
- return;
1758
+ });
1610
1759
  }
1611
- if (result !== null && typeof result === "object" && typeof /** @type {any} */
1612
- result.then === "function") {
1613
- result.then(
1614
- handle_error_result,
1615
- /** @param {unknown} e */
1616
- (e2) => invoke_error_boundary(e2, __privateGet(this, _effect) && __privateGet(this, _effect).parent)
1617
- );
1618
- } else {
1619
- handle_error_result(result);
1760
+ }
1761
+ return current_batch;
1762
+ }
1763
+ apply() {
1764
+ {
1765
+ batch_values = null;
1766
+ return;
1767
+ }
1768
+ }
1769
+ /**
1770
+ *
1771
+ * @param {Effect} effect
1772
+ */
1773
+ schedule(effect2) {
1774
+ last_scheduled_effect = effect2;
1775
+ if (effect2.b?.is_pending && (effect2.f & (EFFECT | RENDER_EFFECT | MANAGED_EFFECT)) !== 0 && (effect2.f & REACTION_RAN) === 0) {
1776
+ effect2.b.defer_effect(effect2);
1777
+ return;
1778
+ }
1779
+ var e2 = effect2;
1780
+ while (e2.parent !== null) {
1781
+ e2 = e2.parent;
1782
+ var flags2 = e2.f;
1783
+ if (collected_effects !== null && e2 === active_effect) {
1784
+ if ((active_reaction === null || (active_reaction.f & DERIVED) === 0) && true) {
1785
+ return;
1786
+ }
1620
1787
  }
1621
- });
1788
+ if ((flags2 & (ROOT_EFFECT | BRANCH_EFFECT)) !== 0) {
1789
+ if ((flags2 & CLEAN) === 0) {
1790
+ return;
1791
+ }
1792
+ e2.f ^= CLEAN;
1793
+ }
1794
+ }
1795
+ __privateGet(this, _roots).push(e2);
1622
1796
  }
1623
1797
  };
1624
- _anchor = /* @__PURE__ */ new WeakMap();
1625
- _hydrate_open = /* @__PURE__ */ new WeakMap();
1626
- _props = /* @__PURE__ */ new WeakMap();
1627
- _children = /* @__PURE__ */ new WeakMap();
1628
- _effect = /* @__PURE__ */ new WeakMap();
1629
- _main_effect = /* @__PURE__ */ new WeakMap();
1630
- _pending_effect = /* @__PURE__ */ new WeakMap();
1631
- _failed_effect = /* @__PURE__ */ new WeakMap();
1632
- _offscreen_fragment = /* @__PURE__ */ new WeakMap();
1633
- _local_pending_count = /* @__PURE__ */ new WeakMap();
1634
- _pending_count = /* @__PURE__ */ new WeakMap();
1635
- _pending_count_update_queued = /* @__PURE__ */ new WeakMap();
1798
+ _started = /* @__PURE__ */ new WeakMap();
1799
+ _prev = /* @__PURE__ */ new WeakMap();
1800
+ _next = /* @__PURE__ */ new WeakMap();
1801
+ _commit_callbacks = /* @__PURE__ */ new WeakMap();
1802
+ _discard_callbacks = /* @__PURE__ */ new WeakMap();
1803
+ _pending = /* @__PURE__ */ new WeakMap();
1804
+ _blocking_pending = /* @__PURE__ */ new WeakMap();
1805
+ _deferred = /* @__PURE__ */ new WeakMap();
1806
+ _roots = /* @__PURE__ */ new WeakMap();
1807
+ _new_effects = /* @__PURE__ */ new WeakMap();
1636
1808
  _dirty_effects2 = /* @__PURE__ */ new WeakMap();
1637
1809
  _maybe_dirty_effects2 = /* @__PURE__ */ new WeakMap();
1638
- _effect_pending = /* @__PURE__ */ new WeakMap();
1639
- _effect_pending_subscriber = /* @__PURE__ */ new WeakMap();
1640
- _Boundary_instances = /* @__PURE__ */ new WeakSet();
1641
- hydrate_resolved_content_fn = function() {
1642
- try {
1643
- __privateSet(this, _main_effect, branch(() => __privateGet(this, _children).call(this, __privateGet(this, _anchor))));
1644
- } catch (error) {
1645
- this.error(error);
1646
- }
1647
- };
1648
- hydrate_failed_content_fn = function(error) {
1649
- const failed = __privateGet(this, _props).failed;
1650
- if (!failed) return;
1651
- __privateSet(this, _failed_effect, branch(() => {
1652
- failed(
1653
- __privateGet(this, _anchor),
1654
- () => error,
1655
- () => () => {
1810
+ _skipped_branches = /* @__PURE__ */ new WeakMap();
1811
+ _unskipped_branches = /* @__PURE__ */ new WeakMap();
1812
+ _decrement_queued = /* @__PURE__ */ new WeakMap();
1813
+ _Batch_instances = /* @__PURE__ */ new WeakSet();
1814
+ is_deferred_fn = function() {
1815
+ if (this.is_fork) return true;
1816
+ for (const effect2 of __privateGet(this, _blocking_pending).keys()) {
1817
+ var e2 = effect2;
1818
+ var skipped = false;
1819
+ while (e2.parent !== null) {
1820
+ if (__privateGet(this, _skipped_branches).has(e2)) {
1821
+ skipped = true;
1822
+ break;
1656
1823
  }
1657
- );
1658
- }));
1659
- };
1660
- hydrate_pending_content_fn = function() {
1661
- const pending = __privateGet(this, _props).pending;
1662
- if (!pending) return;
1663
- this.is_pending = true;
1664
- __privateSet(this, _pending_effect, branch(() => pending(__privateGet(this, _anchor))));
1665
- queue_micro_task(() => {
1666
- var fragment = __privateSet(this, _offscreen_fragment, document.createDocumentFragment());
1667
- var anchor = create_text();
1668
- fragment.append(anchor);
1669
- __privateSet(this, _main_effect, __privateMethod(this, _Boundary_instances, run_fn).call(this, () => {
1670
- return branch(() => __privateGet(this, _children).call(this, anchor));
1671
- }));
1672
- if (__privateGet(this, _pending_count) === 0) {
1673
- __privateGet(this, _anchor).before(fragment);
1674
- __privateSet(this, _offscreen_fragment, null);
1675
- pause_effect(
1676
- /** @type {Effect} */
1677
- __privateGet(this, _pending_effect),
1678
- () => {
1679
- __privateSet(this, _pending_effect, null);
1680
- }
1681
- );
1682
- __privateMethod(this, _Boundary_instances, resolve_fn).call(
1683
- this,
1684
- /** @type {Batch} */
1685
- current_batch
1686
- );
1824
+ e2 = e2.parent;
1687
1825
  }
1688
- });
1689
- };
1690
- render_fn = function() {
1691
- try {
1692
- this.is_pending = this.has_pending_snippet();
1693
- __privateSet(this, _pending_count, 0);
1694
- __privateSet(this, _local_pending_count, 0);
1695
- __privateSet(this, _main_effect, branch(() => {
1696
- __privateGet(this, _children).call(this, __privateGet(this, _anchor));
1697
- }));
1698
- if (__privateGet(this, _pending_count) > 0) {
1699
- var fragment = __privateSet(this, _offscreen_fragment, document.createDocumentFragment());
1700
- move_effect(__privateGet(this, _main_effect), fragment);
1701
- const pending = (
1702
- /** @type {(anchor: Node) => void} */
1703
- __privateGet(this, _props).pending
1704
- );
1705
- __privateSet(this, _pending_effect, branch(() => pending(__privateGet(this, _anchor))));
1706
- } else {
1707
- __privateMethod(this, _Boundary_instances, resolve_fn).call(
1708
- this,
1709
- /** @type {Batch} */
1710
- current_batch
1711
- );
1826
+ if (!skipped) {
1827
+ return true;
1712
1828
  }
1713
- } catch (error) {
1714
- this.error(error);
1715
- }
1716
- };
1717
- resolve_fn = function(batch) {
1718
- this.is_pending = false;
1719
- batch.transfer_effects(__privateGet(this, _dirty_effects2), __privateGet(this, _maybe_dirty_effects2));
1720
- };
1721
- run_fn = function(fn) {
1722
- var previous_effect = active_effect;
1723
- var previous_reaction = active_reaction;
1724
- var previous_ctx = component_context;
1725
- set_active_effect(__privateGet(this, _effect));
1726
- set_active_reaction(__privateGet(this, _effect));
1727
- set_component_context(__privateGet(this, _effect).ctx);
1728
- try {
1729
- Batch.ensure();
1730
- return fn();
1731
- } catch (e2) {
1732
- handle_error(e2);
1733
- return null;
1734
- } finally {
1735
- set_active_effect(previous_effect);
1736
- set_active_reaction(previous_reaction);
1737
- set_component_context(previous_ctx);
1738
1829
  }
1830
+ return false;
1739
1831
  };
1740
- update_pending_count_fn = function(d, batch) {
1741
- var _a3;
1742
- if (!this.has_pending_snippet()) {
1743
- if (this.parent) {
1744
- __privateMethod(_a3 = this.parent, _Boundary_instances, update_pending_count_fn).call(_a3, d, batch);
1745
- }
1746
- return;
1832
+ process_fn = function() {
1833
+ var _a3, _b2, _c;
1834
+ __privateSet(this, _started, true);
1835
+ if (flush_count++ > 1e3) {
1836
+ __privateMethod(this, _Batch_instances, unlink_fn).call(this);
1837
+ infinite_loop_guard();
1747
1838
  }
1748
- __privateSet(this, _pending_count, __privateGet(this, _pending_count) + d);
1749
- if (__privateGet(this, _pending_count) === 0) {
1750
- __privateMethod(this, _Boundary_instances, resolve_fn).call(this, batch);
1751
- if (__privateGet(this, _pending_effect)) {
1752
- pause_effect(__privateGet(this, _pending_effect), () => {
1753
- __privateSet(this, _pending_effect, null);
1754
- });
1755
- }
1756
- if (__privateGet(this, _offscreen_fragment)) {
1757
- __privateGet(this, _anchor).before(__privateGet(this, _offscreen_fragment));
1758
- __privateSet(this, _offscreen_fragment, null);
1759
- }
1839
+ for (const e2 of __privateGet(this, _dirty_effects2)) {
1840
+ __privateGet(this, _maybe_dirty_effects2).delete(e2);
1841
+ set_signal_status(e2, DIRTY);
1842
+ this.schedule(e2);
1760
1843
  }
1761
- };
1762
- function flatten(blockers, sync, async, fn) {
1763
- const d = derived;
1764
- var pending = blockers.filter((b) => !b.settled);
1765
- if (async.length === 0 && pending.length === 0) {
1766
- fn(sync.map(d));
1767
- return;
1844
+ for (const e2 of __privateGet(this, _maybe_dirty_effects2)) {
1845
+ set_signal_status(e2, MAYBE_DIRTY);
1846
+ this.schedule(e2);
1768
1847
  }
1769
- var parent = (
1770
- /** @type {Effect} */
1771
- active_effect
1772
- );
1773
- var restore = capture();
1774
- var blocker_promise = pending.length === 1 ? pending[0].promise : pending.length > 1 ? Promise.all(pending.map((b) => b.promise)) : null;
1775
- function finish(values) {
1776
- restore();
1848
+ const roots = __privateGet(this, _roots);
1849
+ __privateSet(this, _roots, []);
1850
+ this.apply();
1851
+ var effects = collected_effects = [];
1852
+ var render_effects = [];
1853
+ var updates = legacy_updates = [];
1854
+ for (const root2 of roots) {
1777
1855
  try {
1778
- fn(values);
1779
- } catch (error) {
1780
- if ((parent.f & DESTROYED) === 0) {
1781
- invoke_error_boundary(error, parent);
1782
- }
1856
+ __privateMethod(this, _Batch_instances, traverse_fn).call(this, root2, effects, render_effects);
1857
+ } catch (e2) {
1858
+ reset_all(root2);
1859
+ if (!__privateMethod(this, _Batch_instances, is_deferred_fn).call(this)) this.discard();
1860
+ throw e2;
1783
1861
  }
1784
- unset_context();
1785
1862
  }
1786
- if (async.length === 0) {
1787
- blocker_promise.then(() => finish(sync.map(d)));
1788
- return;
1863
+ current_batch = null;
1864
+ if (updates.length > 0) {
1865
+ var batch = _Batch.ensure();
1866
+ for (const e2 of updates) {
1867
+ batch.schedule(e2);
1868
+ }
1789
1869
  }
1790
- var decrement_pending = increment_pending();
1791
- function run() {
1792
- Promise.all(async.map((expression) => /* @__PURE__ */ async_derived(expression))).then((result) => finish([...sync.map(d), ...result])).catch((error) => invoke_error_boundary(error, parent)).finally(() => decrement_pending());
1870
+ collected_effects = null;
1871
+ legacy_updates = null;
1872
+ if (__privateMethod(this, _Batch_instances, is_deferred_fn).call(this)) {
1873
+ __privateMethod(this, _Batch_instances, defer_effects_fn).call(this, render_effects);
1874
+ __privateMethod(this, _Batch_instances, defer_effects_fn).call(this, effects);
1875
+ for (const [e2, t2] of __privateGet(this, _skipped_branches)) {
1876
+ reset_branch(e2, t2);
1877
+ }
1878
+ if (updates.length > 0) {
1879
+ __privateMethod(_a3 = current_batch, _Batch_instances, process_fn).call(_a3);
1880
+ }
1881
+ return;
1793
1882
  }
1794
- if (blocker_promise) {
1795
- blocker_promise.then(() => {
1796
- restore();
1797
- run();
1798
- unset_context();
1799
- });
1800
- } else {
1801
- run();
1883
+ const earlier_batch = __privateMethod(this, _Batch_instances, find_earlier_batch_fn).call(this);
1884
+ if (earlier_batch) {
1885
+ __privateMethod(this, _Batch_instances, defer_effects_fn).call(this, render_effects);
1886
+ __privateMethod(this, _Batch_instances, defer_effects_fn).call(this, effects);
1887
+ __privateMethod(_b2 = earlier_batch, _Batch_instances, merge_fn).call(_b2, this);
1888
+ return;
1802
1889
  }
1803
- }
1804
- function capture() {
1805
- var previous_effect = (
1806
- /** @type {Effect} */
1807
- active_effect
1808
- );
1809
- var previous_reaction = active_reaction;
1810
- var previous_component_context = component_context;
1811
- var previous_batch = (
1812
- /** @type {Batch} */
1890
+ __privateGet(this, _dirty_effects2).clear();
1891
+ __privateGet(this, _maybe_dirty_effects2).clear();
1892
+ for (const fn of __privateGet(this, _commit_callbacks)) fn(this);
1893
+ __privateGet(this, _commit_callbacks).clear();
1894
+ previous_batch = this;
1895
+ flush_queued_effects(render_effects);
1896
+ flush_queued_effects(effects);
1897
+ previous_batch = null;
1898
+ __privateGet(this, _deferred)?.resolve();
1899
+ var next_batch = (
1900
+ /** @type {Batch | null} */
1901
+ /** @type {unknown} */
1813
1902
  current_batch
1814
1903
  );
1815
- return function restore(activate_batch = true) {
1816
- set_active_effect(previous_effect);
1817
- set_active_reaction(previous_reaction);
1818
- set_component_context(previous_component_context);
1819
- if (activate_batch && (previous_effect.f & DESTROYED) === 0) {
1820
- previous_batch?.activate();
1821
- previous_batch?.apply();
1904
+ if (__privateGet(this, _pending) === 0 && (__privateGet(this, _roots).length === 0 || next_batch !== null)) {
1905
+ __privateMethod(this, _Batch_instances, unlink_fn).call(this);
1906
+ }
1907
+ if (__privateGet(this, _roots).length > 0) {
1908
+ if (next_batch !== null) {
1909
+ const batch2 = next_batch;
1910
+ __privateGet(batch2, _roots).push(...__privateGet(this, _roots).filter((r2) => !__privateGet(batch2, _roots).includes(r2)));
1911
+ } else {
1912
+ next_batch = this;
1822
1913
  }
1823
- };
1824
- }
1825
- function unset_context(deactivate_batch = true) {
1826
- set_active_effect(null);
1827
- set_active_reaction(null);
1828
- set_component_context(null);
1829
- if (deactivate_batch) current_batch?.deactivate();
1830
- }
1831
- function increment_pending() {
1832
- var effect2 = (
1833
- /** @type {Effect} */
1834
- active_effect
1835
- );
1836
- var boundary2 = (
1837
- /** @type {Boundary} */
1838
- effect2.b
1839
- );
1840
- var batch = (
1841
- /** @type {Batch} */
1842
- current_batch
1843
- );
1844
- var blocking = boundary2.is_rendered();
1845
- boundary2.update_pending_count(1, batch);
1846
- batch.increment(blocking, effect2);
1847
- return (skip = false) => {
1848
- boundary2.update_pending_count(-1, batch);
1849
- batch.decrement(blocking, effect2, skip);
1850
- };
1851
- }
1852
- // @__NO_SIDE_EFFECTS__
1853
- function derived(fn) {
1854
- var flags2 = DERIVED | DIRTY;
1855
- var parent_derived = active_reaction !== null && (active_reaction.f & DERIVED) !== 0 ? (
1856
- /** @type {Derived} */
1857
- active_reaction
1858
- ) : null;
1859
- if (active_effect !== null) {
1860
- active_effect.f |= EFFECT_PRESERVED;
1861
1914
  }
1862
- const signal = {
1863
- ctx: component_context,
1864
- deps: null,
1865
- effects: null,
1866
- equals,
1867
- f: flags2,
1868
- fn,
1869
- reactions: null,
1870
- rv: 0,
1871
- v: (
1872
- /** @type {V} */
1873
- UNINITIALIZED
1874
- ),
1875
- wv: 0,
1876
- parent: parent_derived ?? active_effect,
1877
- ac: null
1878
- };
1879
- return signal;
1880
- }
1881
- // @__NO_SIDE_EFFECTS__
1882
- function async_derived(fn, label, location) {
1883
- let parent = (
1884
- /** @type {Effect | null} */
1885
- active_effect
1886
- );
1887
- if (parent === null) {
1888
- async_derived_orphan();
1915
+ if (next_batch !== null) {
1916
+ __privateMethod(_c = next_batch, _Batch_instances, process_fn).call(_c);
1889
1917
  }
1890
- var promise = (
1891
- /** @type {Promise<V>} */
1892
- /** @type {unknown} */
1893
- void 0
1894
- );
1895
- var signal = source(
1896
- /** @type {V} */
1897
- UNINITIALIZED
1898
- );
1899
- var should_suspend = !active_reaction;
1900
- var deferreds = /* @__PURE__ */ new Map();
1901
- async_effect(() => {
1902
- var effect2 = (
1903
- /** @type {Effect} */
1904
- active_effect
1905
- );
1906
- var d = deferred();
1907
- promise = d.promise;
1908
- try {
1909
- Promise.resolve(fn()).then(d.resolve, d.reject).finally(unset_context);
1910
- } catch (error) {
1911
- d.reject(error);
1912
- unset_context();
1918
+ };
1919
+ traverse_fn = function(root2, effects, render_effects) {
1920
+ root2.f ^= CLEAN;
1921
+ var effect2 = root2.first;
1922
+ while (effect2 !== null) {
1923
+ var flags2 = effect2.f;
1924
+ var is_branch = (flags2 & (BRANCH_EFFECT | ROOT_EFFECT)) !== 0;
1925
+ var is_skippable_branch = is_branch && (flags2 & CLEAN) !== 0;
1926
+ var skip = is_skippable_branch || (flags2 & INERT) !== 0 || __privateGet(this, _skipped_branches).has(effect2);
1927
+ if (!skip && effect2.fn !== null) {
1928
+ if (is_branch) {
1929
+ effect2.f ^= CLEAN;
1930
+ } else if ((flags2 & EFFECT) !== 0) {
1931
+ effects.push(effect2);
1932
+ } else if (is_dirty(effect2)) {
1933
+ if ((flags2 & BLOCK_EFFECT) !== 0) __privateGet(this, _maybe_dirty_effects2).add(effect2);
1934
+ update_effect(effect2);
1935
+ }
1936
+ var child2 = effect2.first;
1937
+ if (child2 !== null) {
1938
+ effect2 = child2;
1939
+ continue;
1940
+ }
1913
1941
  }
1914
- var batch = (
1915
- /** @type {Batch} */
1916
- current_batch
1917
- );
1918
- if (should_suspend) {
1919
- if ((effect2.f & REACTION_RAN) !== 0) {
1920
- var decrement_pending = increment_pending();
1942
+ while (effect2 !== null) {
1943
+ var next2 = effect2.next;
1944
+ if (next2 !== null) {
1945
+ effect2 = next2;
1946
+ break;
1921
1947
  }
1922
- if (
1923
- /** @type {Boundary} */
1924
- parent.b.is_rendered()
1925
- ) {
1926
- deferreds.get(batch)?.reject(STALE_REACTION);
1927
- deferreds.delete(batch);
1948
+ effect2 = effect2.parent;
1949
+ }
1950
+ }
1951
+ };
1952
+ find_earlier_batch_fn = function() {
1953
+ var batch = __privateGet(this, _prev);
1954
+ while (batch !== null) {
1955
+ if (!batch.is_fork) {
1956
+ for (const [value, [, is_derived]] of this.current) {
1957
+ if (batch.current.has(value) && !is_derived) {
1958
+ return batch;
1959
+ }
1960
+ }
1961
+ }
1962
+ batch = __privateGet(batch, _prev);
1963
+ }
1964
+ return null;
1965
+ };
1966
+ merge_fn = function(batch) {
1967
+ var _a3;
1968
+ for (const [source2, value] of batch.current) {
1969
+ if (!this.previous.has(source2) && batch.previous.has(source2)) {
1970
+ this.previous.set(source2, batch.previous.get(source2));
1971
+ }
1972
+ this.current.set(source2, value);
1973
+ }
1974
+ for (const [effect2, deferred2] of batch.async_deriveds) {
1975
+ const d = this.async_deriveds.get(effect2);
1976
+ if (d) deferred2.promise.then(d.resolve).catch(d.reject);
1977
+ }
1978
+ batch.async_deriveds.clear();
1979
+ this.transfer_effects(__privateGet(batch, _dirty_effects2), __privateGet(batch, _maybe_dirty_effects2));
1980
+ const mark = (value) => {
1981
+ var reactions = value.reactions;
1982
+ if (reactions === null) return;
1983
+ if ((value.f & DERIVED) !== 0 && (value.f & (DIRTY | MAYBE_DIRTY)) === 0) {
1984
+ return;
1985
+ }
1986
+ for (const reaction of reactions) {
1987
+ var flags2 = reaction.f;
1988
+ if ((flags2 & DERIVED) !== 0) {
1989
+ mark(
1990
+ /** @type {Derived} */
1991
+ reaction
1992
+ );
1928
1993
  } else {
1929
- for (const d2 of deferreds.values()) {
1930
- d2.reject(STALE_REACTION);
1994
+ var effect2 = (
1995
+ /** @type {Effect} */
1996
+ reaction
1997
+ );
1998
+ if (flags2 & (ASYNC | BLOCK_EFFECT) && !this.async_deriveds.has(effect2)) {
1999
+ __privateGet(this, _maybe_dirty_effects2).delete(effect2);
2000
+ set_signal_status(effect2, DIRTY);
2001
+ this.schedule(effect2);
1931
2002
  }
1932
- deferreds.clear();
1933
2003
  }
1934
- deferreds.set(batch, d);
1935
2004
  }
1936
- const handler = (value, error = void 0) => {
1937
- if (decrement_pending) {
1938
- var skip = error === STALE_REACTION;
1939
- decrement_pending(skip);
2005
+ };
2006
+ for (const source2 of this.current.keys()) {
2007
+ mark(source2);
2008
+ }
2009
+ this.oncommit(() => batch.discard());
2010
+ __privateMethod(_a3 = batch, _Batch_instances, unlink_fn).call(_a3);
2011
+ current_batch = this;
2012
+ __privateMethod(this, _Batch_instances, process_fn).call(this);
2013
+ };
2014
+ defer_effects_fn = function(effects) {
2015
+ for (var i = 0; i < effects.length; i += 1) {
2016
+ defer_effect(effects[i], __privateGet(this, _dirty_effects2), __privateGet(this, _maybe_dirty_effects2));
2017
+ }
2018
+ };
2019
+ commit_fn = function() {
2020
+ var _a3;
2021
+ for (let batch = first_batch; batch !== null; batch = __privateGet(batch, _next)) {
2022
+ var is_earlier = batch.id < this.id;
2023
+ var sources = [];
2024
+ for (const [source3, [value, is_derived]] of this.current) {
2025
+ if (batch.current.has(source3)) {
2026
+ var batch_value = (
2027
+ /** @type {[any, boolean]} */
2028
+ batch.current.get(source3)[0]
2029
+ );
2030
+ if (is_earlier && value !== batch_value) {
2031
+ batch.current.set(source3, [value, is_derived]);
2032
+ } else {
2033
+ continue;
2034
+ }
1940
2035
  }
1941
- if (error === STALE_REACTION || (effect2.f & DESTROYED) !== 0) {
1942
- return;
2036
+ sources.push(source3);
2037
+ }
2038
+ if (is_earlier) {
2039
+ for (const [effect2, deferred2] of this.async_deriveds) {
2040
+ const d = batch.async_deriveds.get(effect2);
2041
+ if (d) deferred2.promise.then(d.resolve).catch(d.reject);
1943
2042
  }
1944
- batch.activate();
1945
- if (error) {
1946
- signal.f |= ERROR_VALUE;
1947
- internal_set(signal, error);
1948
- } else {
1949
- if ((signal.f & ERROR_VALUE) !== 0) {
1950
- signal.f ^= ERROR_VALUE;
2043
+ }
2044
+ var current = [...batch.current.keys()].filter(
2045
+ (source3) => !/** @type {[any, boolean]} */
2046
+ batch.current.get(source3)[1]
2047
+ );
2048
+ if (!__privateGet(batch, _started) || current.length === 0) continue;
2049
+ var others = current.filter((source3) => !this.current.has(source3));
2050
+ if (others.length === 0) {
2051
+ if (is_earlier) {
2052
+ batch.discard();
2053
+ }
2054
+ } else if (sources.length > 0) {
2055
+ if (is_earlier) {
2056
+ for (const unskipped of __privateGet(this, _unskipped_branches)) {
2057
+ batch.unskip_effect(unskipped, (e2) => {
2058
+ var _a4;
2059
+ if ((e2.f & (BLOCK_EFFECT | ASYNC)) !== 0) {
2060
+ batch.schedule(e2);
2061
+ } else {
2062
+ __privateMethod(_a4 = batch, _Batch_instances, defer_effects_fn).call(_a4, [e2]);
2063
+ }
2064
+ });
1951
2065
  }
1952
- internal_set(signal, value);
1953
- for (const [b, d2] of deferreds) {
1954
- deferreds.delete(b);
1955
- if (b === batch) break;
1956
- d2.reject(STALE_REACTION);
2066
+ }
2067
+ batch.activate();
2068
+ var marked = /* @__PURE__ */ new Set();
2069
+ var checked = /* @__PURE__ */ new Map();
2070
+ for (var source2 of sources) {
2071
+ mark_effects(source2, others, marked, checked);
2072
+ }
2073
+ checked = /* @__PURE__ */ new Map();
2074
+ var current_unequal = [...batch.current].filter(([c2, v1]) => {
2075
+ const v2 = this.current.get(c2);
2076
+ if (!v2) return true;
2077
+ return v2[0] !== v1[0] || v2[1] !== v1[1];
2078
+ }).map(([c2]) => c2);
2079
+ if (current_unequal.length > 0) {
2080
+ for (const effect2 of __privateGet(this, _new_effects)) {
2081
+ if ((effect2.f & (DESTROYED | INERT | EAGER_EFFECT)) === 0 && depends_on(effect2, current_unequal, checked)) {
2082
+ if ((effect2.f & (ASYNC | BLOCK_EFFECT)) !== 0) {
2083
+ set_signal_status(effect2, DIRTY);
2084
+ batch.schedule(effect2);
2085
+ } else {
2086
+ __privateGet(batch, _dirty_effects2).add(effect2);
2087
+ }
2088
+ }
1957
2089
  }
1958
2090
  }
1959
- batch.deactivate();
1960
- };
1961
- d.promise.then(handler, (e2) => handler(null, e2 || "unknown"));
1962
- });
1963
- teardown(() => {
1964
- for (const d of deferreds.values()) {
1965
- d.reject(STALE_REACTION);
1966
- }
1967
- });
1968
- return new Promise((fulfil) => {
1969
- function next2(p) {
1970
- function go() {
1971
- if (p === promise) {
1972
- fulfil(signal);
1973
- } else {
1974
- next2(promise);
2091
+ if (__privateGet(batch, _roots).length > 0 && !__privateGet(batch, _decrement_queued)) {
2092
+ batch.apply();
2093
+ for (var root2 of __privateGet(batch, _roots)) {
2094
+ __privateMethod(_a3 = batch, _Batch_instances, traverse_fn).call(_a3, root2, [], []);
1975
2095
  }
2096
+ __privateSet(batch, _roots, []);
1976
2097
  }
1977
- p.then(go, go);
2098
+ batch.deactivate();
1978
2099
  }
1979
- next2(promise);
1980
- });
1981
- }
1982
- // @__NO_SIDE_EFFECTS__
1983
- function user_derived(fn) {
1984
- const d = /* @__PURE__ */ derived(fn);
1985
- push_reaction_value(d);
1986
- return d;
1987
- }
1988
- // @__NO_SIDE_EFFECTS__
1989
- function derived_safe_equal(fn) {
1990
- const signal = /* @__PURE__ */ derived(fn);
1991
- signal.equals = safe_equals;
1992
- return signal;
1993
- }
1994
- function destroy_derived_effects(derived2) {
1995
- var effects = derived2.effects;
1996
- if (effects !== null) {
1997
- derived2.effects = null;
1998
- for (var i = 0; i < effects.length; i += 1) {
1999
- destroy_effect(
2000
- /** @type {Effect} */
2001
- effects[i]
2002
- );
2100
+ }
2101
+ };
2102
+ unlink_fn = function() {
2103
+ if (!this.linked) return;
2104
+ var prev = __privateGet(this, _prev);
2105
+ var next2 = __privateGet(this, _next);
2106
+ if (prev === null) {
2107
+ first_batch = next2;
2108
+ } else {
2109
+ __privateSet(prev, _next, next2);
2110
+ }
2111
+ if (next2 === null) {
2112
+ last_batch = prev;
2113
+ } else {
2114
+ __privateSet(next2, _prev, prev);
2115
+ }
2116
+ this.linked = false;
2117
+ };
2118
+ var Batch = _Batch;
2119
+ function flushSync(fn) {
2120
+ var was_flushing_sync = is_flushing_sync;
2121
+ is_flushing_sync = true;
2122
+ try {
2123
+ var result;
2124
+ if (fn) ;
2125
+ while (true) {
2126
+ flush_tasks();
2127
+ if (current_batch === null) {
2128
+ return (
2129
+ /** @type {T} */
2130
+ result
2131
+ );
2132
+ }
2133
+ current_batch.flush();
2003
2134
  }
2135
+ } finally {
2136
+ is_flushing_sync = was_flushing_sync;
2004
2137
  }
2005
2138
  }
2006
- function get_derived_parent_effect(derived2) {
2007
- var parent = derived2.parent;
2008
- while (parent !== null) {
2009
- if ((parent.f & DERIVED) === 0) {
2010
- return (parent.f & DESTROYED) === 0 ? (
2011
- /** @type {Effect} */
2012
- parent
2013
- ) : null;
2139
+ function infinite_loop_guard() {
2140
+ try {
2141
+ effect_update_depth_exceeded();
2142
+ } catch (error) {
2143
+ invoke_error_boundary(error, last_scheduled_effect);
2144
+ }
2145
+ }
2146
+ var eager_block_effects = null;
2147
+ function flush_queued_effects(effects) {
2148
+ var length = effects.length;
2149
+ if (length === 0) return;
2150
+ var i = 0;
2151
+ while (i < length) {
2152
+ var effect2 = effects[i++];
2153
+ if ((effect2.f & (DESTROYED | INERT)) === 0 && is_dirty(effect2)) {
2154
+ eager_block_effects = /* @__PURE__ */ new Set();
2155
+ update_effect(effect2);
2156
+ if (effect2.deps === null && effect2.first === null && effect2.nodes === null && effect2.teardown === null && effect2.ac === null) {
2157
+ unlink_effect(effect2);
2158
+ }
2159
+ if (eager_block_effects?.size > 0) {
2160
+ old_values.clear();
2161
+ for (const e2 of eager_block_effects) {
2162
+ if ((e2.f & (DESTROYED | INERT)) !== 0) continue;
2163
+ const ordered_effects = [e2];
2164
+ let ancestor = e2.parent;
2165
+ while (ancestor !== null) {
2166
+ if (eager_block_effects.has(ancestor)) {
2167
+ eager_block_effects.delete(ancestor);
2168
+ ordered_effects.push(ancestor);
2169
+ }
2170
+ ancestor = ancestor.parent;
2171
+ }
2172
+ for (let j = ordered_effects.length - 1; j >= 0; j--) {
2173
+ const e3 = ordered_effects[j];
2174
+ if ((e3.f & (DESTROYED | INERT)) !== 0) continue;
2175
+ update_effect(e3);
2176
+ }
2177
+ }
2178
+ eager_block_effects.clear();
2179
+ }
2014
2180
  }
2015
- parent = parent.parent;
2016
2181
  }
2017
- return null;
2182
+ eager_block_effects = null;
2018
2183
  }
2019
- function execute_derived(derived2) {
2020
- var value;
2021
- var prev_active_effect = active_effect;
2022
- set_active_effect(get_derived_parent_effect(derived2));
2023
- {
2024
- try {
2025
- derived2.f &= ~WAS_MARKED;
2026
- destroy_derived_effects(derived2);
2027
- value = update_reaction(derived2);
2028
- } finally {
2029
- set_active_effect(prev_active_effect);
2184
+ function mark_effects(value, sources, marked, checked) {
2185
+ if (marked.has(value)) return;
2186
+ marked.add(value);
2187
+ if (value.reactions !== null) {
2188
+ for (const reaction of value.reactions) {
2189
+ const flags2 = reaction.f;
2190
+ if ((flags2 & DERIVED) !== 0) {
2191
+ mark_effects(
2192
+ /** @type {Derived} */
2193
+ reaction,
2194
+ sources,
2195
+ marked,
2196
+ checked
2197
+ );
2198
+ } else if ((flags2 & (ASYNC | BLOCK_EFFECT)) !== 0 && (flags2 & DIRTY) === 0 && depends_on(reaction, sources, checked)) {
2199
+ set_signal_status(reaction, DIRTY);
2200
+ schedule_effect(
2201
+ /** @type {Effect} */
2202
+ reaction
2203
+ );
2204
+ }
2030
2205
  }
2031
2206
  }
2032
- return value;
2033
2207
  }
2034
- function update_derived(derived2) {
2035
- var value = execute_derived(derived2);
2036
- if (!derived2.equals(value)) {
2037
- derived2.wv = increment_write_version();
2038
- if (!current_batch?.is_fork || derived2.deps === null) {
2039
- if (current_batch !== null) {
2040
- current_batch.capture(derived2, value, true);
2041
- } else {
2042
- derived2.v = value;
2208
+ function depends_on(reaction, sources, checked) {
2209
+ const depends = checked.get(reaction);
2210
+ if (depends !== void 0) return depends;
2211
+ if (reaction.deps !== null) {
2212
+ for (const dep of reaction.deps) {
2213
+ if (includes.call(sources, dep)) {
2214
+ return true;
2043
2215
  }
2044
- if (derived2.deps === null) {
2045
- set_signal_status(derived2, CLEAN);
2046
- return;
2216
+ if ((dep.f & DERIVED) !== 0 && depends_on(
2217
+ /** @type {Derived} */
2218
+ dep,
2219
+ sources,
2220
+ checked
2221
+ )) {
2222
+ checked.set(
2223
+ /** @type {Derived} */
2224
+ dep,
2225
+ true
2226
+ );
2227
+ return true;
2047
2228
  }
2048
2229
  }
2049
2230
  }
2050
- if (is_destroying_effect) {
2231
+ checked.set(reaction, false);
2232
+ return false;
2233
+ }
2234
+ function schedule_effect(effect2) {
2235
+ current_batch.schedule(effect2);
2236
+ }
2237
+ function reset_branch(effect2, tracked) {
2238
+ if ((effect2.f & BRANCH_EFFECT) !== 0 && (effect2.f & CLEAN) !== 0) {
2051
2239
  return;
2052
2240
  }
2053
- if (batch_values !== null) {
2054
- if (effect_tracking() || current_batch?.is_fork) {
2055
- batch_values.set(derived2, value);
2056
- }
2057
- } else {
2058
- update_derived_status(derived2);
2241
+ if ((effect2.f & DIRTY) !== 0) {
2242
+ tracked.d.push(effect2);
2243
+ } else if ((effect2.f & MAYBE_DIRTY) !== 0) {
2244
+ tracked.m.push(effect2);
2059
2245
  }
2060
- }
2061
- function freeze_derived_effects(derived2) {
2062
- if (derived2.effects === null) return;
2063
- for (const e2 of derived2.effects) {
2064
- if (e2.teardown || e2.ac) {
2065
- e2.teardown?.();
2066
- e2.ac?.abort(STALE_REACTION);
2067
- e2.teardown = noop;
2068
- e2.ac = null;
2069
- remove_reactions(e2, 0);
2070
- destroy_effect_children(e2);
2071
- }
2246
+ set_signal_status(effect2, CLEAN);
2247
+ var e2 = effect2.first;
2248
+ while (e2 !== null) {
2249
+ reset_branch(e2, tracked);
2250
+ e2 = e2.next;
2072
2251
  }
2073
2252
  }
2074
- function unfreeze_derived_effects(derived2) {
2075
- if (derived2.effects === null) return;
2076
- for (const e2 of derived2.effects) {
2077
- if (e2.teardown) {
2078
- update_effect(e2);
2079
- }
2253
+ function reset_all(effect2) {
2254
+ set_signal_status(effect2, CLEAN);
2255
+ var e2 = effect2.first;
2256
+ while (e2 !== null) {
2257
+ reset_all(e2);
2258
+ e2 = e2.next;
2080
2259
  }
2081
2260
  }
2082
2261
  var eager_effects = /* @__PURE__ */ new Set();
@@ -2111,7 +2290,7 @@ function mutable_source(initial_value, immutable = false, trackable = true) {
2111
2290
  function set(source2, value, should_proxy = false) {
2112
2291
  if (active_reaction !== null && // since we are untracking the function inside `$inspect.with` we need to add this check
2113
2292
  // to ensure we error if state is set inside an inspect effect
2114
- (!untracking || (active_reaction.f & EAGER_EFFECT) !== 0) && is_runes() && (active_reaction.f & (DERIVED | BLOCK_EFFECT | ASYNC | EAGER_EFFECT)) !== 0 && (current_sources === null || !includes.call(current_sources, source2))) {
2293
+ (!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))) {
2115
2294
  state_unsafe_mutation();
2116
2295
  }
2117
2296
  let new_value = should_proxy ? proxy(value) : value;
@@ -2155,7 +2334,13 @@ function flush_eager_effects() {
2155
2334
  if ((effect2.f & CLEAN) !== 0) {
2156
2335
  set_signal_status(effect2, MAYBE_DIRTY);
2157
2336
  }
2158
- if (is_dirty(effect2)) {
2337
+ let dirty;
2338
+ try {
2339
+ dirty = is_dirty(effect2);
2340
+ } catch {
2341
+ dirty = true;
2342
+ }
2343
+ if (dirty) {
2159
2344
  update_effect(effect2);
2160
2345
  }
2161
2346
  }
@@ -2175,14 +2360,19 @@ function mark_reactions(signal, status, updated_during_traversal) {
2175
2360
  if (not_dirty) {
2176
2361
  set_signal_status(reaction, status);
2177
2362
  }
2178
- if ((flags2 & DERIVED) !== 0) {
2363
+ if ((flags2 & EAGER_EFFECT) !== 0) {
2364
+ eager_effects.add(
2365
+ /** @type {Effect} */
2366
+ reaction
2367
+ );
2368
+ } else if ((flags2 & DERIVED) !== 0) {
2179
2369
  var derived2 = (
2180
2370
  /** @type {Derived} */
2181
2371
  reaction
2182
2372
  );
2183
2373
  batch_values?.delete(derived2);
2184
2374
  if ((flags2 & WAS_MARKED) === 0) {
2185
- if (flags2 & CONNECTED) {
2375
+ if (flags2 & CONNECTED && (active_effect === null || (active_effect.f & REACTION_IS_UPDATING) === 0)) {
2186
2376
  reaction.f |= WAS_MARKED;
2187
2377
  }
2188
2378
  mark_reactions(derived2, MAYBE_DIRTY, updated_during_traversal);
@@ -2203,55 +2393,6 @@ function mark_reactions(signal, status, updated_during_traversal) {
2203
2393
  }
2204
2394
  }
2205
2395
  }
2206
- var listening_to_form_reset = false;
2207
- function add_form_reset_listener() {
2208
- if (!listening_to_form_reset) {
2209
- listening_to_form_reset = true;
2210
- document.addEventListener(
2211
- "reset",
2212
- (evt) => {
2213
- Promise.resolve().then(() => {
2214
- if (!evt.defaultPrevented) {
2215
- for (
2216
- const e2 of
2217
- /**@type {HTMLFormElement} */
2218
- evt.target.elements
2219
- ) {
2220
- e2.__on_r?.();
2221
- }
2222
- }
2223
- });
2224
- },
2225
- // In the capture phase to guarantee we get noticed of it (no possibility of stopPropagation)
2226
- { capture: true }
2227
- );
2228
- }
2229
- }
2230
- function without_reactive_context(fn) {
2231
- var previous_reaction = active_reaction;
2232
- var previous_effect = active_effect;
2233
- set_active_reaction(null);
2234
- set_active_effect(null);
2235
- try {
2236
- return fn();
2237
- } finally {
2238
- set_active_reaction(previous_reaction);
2239
- set_active_effect(previous_effect);
2240
- }
2241
- }
2242
- function listen_to_event_and_reset_event(element, event, handler, on_reset = handler) {
2243
- element.addEventListener(event, () => without_reactive_context(handler));
2244
- const prev = element.__on_r;
2245
- if (prev) {
2246
- element.__on_r = () => {
2247
- prev();
2248
- on_reset(true);
2249
- };
2250
- } else {
2251
- element.__on_r = () => on_reset(true);
2252
- }
2253
- add_form_reset_listener();
2254
- }
2255
2396
  var is_updating_effect = false;
2256
2397
  var is_destroying_effect = false;
2257
2398
  function set_is_destroying_effect(value) {
@@ -2269,11 +2410,7 @@ function set_active_effect(effect2) {
2269
2410
  var current_sources = null;
2270
2411
  function push_reaction_value(value) {
2271
2412
  if (active_reaction !== null && true) {
2272
- if (current_sources === null) {
2273
- current_sources = [value];
2274
- } else {
2275
- current_sources.push(value);
2276
- }
2413
+ (current_sources ?? (current_sources = /* @__PURE__ */ new Set())).add(value);
2277
2414
  }
2278
2415
  }
2279
2416
  var new_deps = null;
@@ -2331,7 +2468,7 @@ function is_dirty(reaction) {
2331
2468
  function schedule_possible_effect_self_invalidation(signal, effect2, root2 = true) {
2332
2469
  var reactions = signal.reactions;
2333
2470
  if (reactions === null) return;
2334
- if (current_sources !== null && includes.call(current_sources, signal)) {
2471
+ if (current_sources !== null && current_sources.has(signal)) {
2335
2472
  return;
2336
2473
  }
2337
2474
  for (var i = 0; i < reactions.length; i++) {
@@ -2492,6 +2629,13 @@ function remove_reaction(signal, dependency) {
2492
2629
  if (derived2.v !== UNINITIALIZED) {
2493
2630
  update_derived_status(derived2);
2494
2631
  }
2632
+ if (derived2.ac !== null) {
2633
+ without_reactive_context(() => {
2634
+ derived2.ac.abort(STALE_REACTION);
2635
+ derived2.ac = null;
2636
+ set_signal_status(derived2, DIRTY);
2637
+ });
2638
+ }
2495
2639
  freeze_derived_effects(derived2);
2496
2640
  remove_reactions(derived2, 0);
2497
2641
  }
@@ -2512,7 +2656,7 @@ function update_effect(effect2) {
2512
2656
  var previous_effect = active_effect;
2513
2657
  var was_updating_effect = is_updating_effect;
2514
2658
  active_effect = effect2;
2515
- is_updating_effect = true;
2659
+ is_updating_effect = (flags2 & (BRANCH_EFFECT | ROOT_EFFECT)) === 0;
2516
2660
  try {
2517
2661
  if ((flags2 & (BLOCK_EFFECT | MANAGED_EFFECT)) !== 0) {
2518
2662
  destroy_block_effect_children(effect2);
@@ -2535,7 +2679,7 @@ function get(signal) {
2535
2679
  var is_derived = (flags2 & DERIVED) !== 0;
2536
2680
  if (active_reaction !== null && !untracking) {
2537
2681
  var destroyed = active_effect !== null && (active_effect.f & DESTROYED) !== 0;
2538
- if (!destroyed && (current_sources === null || !includes.call(current_sources, signal))) {
2682
+ if (!destroyed && (current_sources === null || !current_sources.has(signal))) {
2539
2683
  var deps = active_reaction.deps;
2540
2684
  if ((active_reaction.f & REACTION_IS_UPDATING) !== 0) {
2541
2685
  if (signal.rv < read_version) {
@@ -2549,7 +2693,10 @@ function get(signal) {
2549
2693
  }
2550
2694
  }
2551
2695
  } else {
2552
- (active_reaction.deps ?? (active_reaction.deps = [])).push(signal);
2696
+ active_reaction.deps ?? (active_reaction.deps = []);
2697
+ if (!includes.call(active_reaction.deps, signal)) {
2698
+ active_reaction.deps.push(signal);
2699
+ }
2553
2700
  var reactions = signal.reactions;
2554
2701
  if (reactions === null) {
2555
2702
  signal.reactions = [active_reaction];
@@ -2733,7 +2880,7 @@ function user_effect(fn) {
2733
2880
  /** @type {Effect} */
2734
2881
  active_effect.f
2735
2882
  );
2736
- var defer = !active_reaction && (flags2 & BRANCH_EFFECT) !== 0 && (flags2 & REACTION_RAN) === 0;
2883
+ var defer = !active_reaction && (flags2 & BRANCH_EFFECT) !== 0 && component_context !== null && !component_context.i;
2737
2884
  if (defer) {
2738
2885
  var context = (
2739
2886
  /** @type {ComponentContext} */
@@ -2775,7 +2922,9 @@ function render_effect(fn, flags2 = 0) {
2775
2922
  }
2776
2923
  function template_effect(fn, sync = [], async = [], blockers = []) {
2777
2924
  flatten(blockers, sync, async, (values) => {
2778
- create_effect(RENDER_EFFECT, () => fn(...values.map(get)));
2925
+ create_effect(RENDER_EFFECT, () => {
2926
+ fn(...values.map(get));
2927
+ });
2779
2928
  });
2780
2929
  }
2781
2930
  function block(fn, flags2 = 0) {
@@ -2839,7 +2988,7 @@ function destroy_effect(effect2, remove_dom = true) {
2839
2988
  );
2840
2989
  removed = true;
2841
2990
  }
2842
- set_signal_status(effect2, DESTROYING);
2991
+ effect2.f |= DESTROYING;
2843
2992
  destroy_effect_children(effect2, remove_dom && !removed);
2844
2993
  remove_reactions(effect2, 0);
2845
2994
  var transitions = effect2.nodes && effect2.nodes.t;
@@ -2906,11 +3055,13 @@ function pause_children(effect2, transitions, local) {
2906
3055
  var child2 = effect2.first;
2907
3056
  while (child2 !== null) {
2908
3057
  var sibling2 = child2.next;
2909
- var transparent = (child2.f & EFFECT_TRANSPARENT) !== 0 || // If this is a branch effect without a block effect parent,
2910
- // it means the parent block effect was pruned. In that case,
2911
- // transparency information was transferred to the branch effect.
2912
- (child2.f & BRANCH_EFFECT) !== 0 && (effect2.f & BLOCK_EFFECT) !== 0;
2913
- pause_children(child2, transitions, transparent ? local : false);
3058
+ if ((child2.f & ROOT_EFFECT) === 0) {
3059
+ var transparent = (child2.f & EFFECT_TRANSPARENT) !== 0 || // If this is a branch effect without a block effect parent,
3060
+ // it means the parent block effect was pruned. In that case,
3061
+ // transparency information was transferred to the branch effect.
3062
+ (child2.f & BRANCH_EFFECT) !== 0 && (effect2.f & BLOCK_EFFECT) !== 0;
3063
+ pause_children(child2, transitions, transparent ? local : false);
3064
+ }
2914
3065
  child2 = sibling2;
2915
3066
  }
2916
3067
  }
@@ -3012,8 +3163,7 @@ function handle_event_propagation(event) {
3012
3163
  var throw_error;
3013
3164
  var other_errors = [];
3014
3165
  while (current_target !== null) {
3015
- var parent_element = current_target.assignedSlot || current_target.parentNode || /** @type {any} */
3016
- current_target.host || null;
3166
+ if (current_target === handler_element) break;
3017
3167
  try {
3018
3168
  var delegated2 = current_target[event_symbol]?.[event_name];
3019
3169
  if (delegated2 != null && (!/** @type {any} */
@@ -3029,10 +3179,12 @@ function handle_event_propagation(event) {
3029
3179
  throw_error = error;
3030
3180
  }
3031
3181
  }
3032
- if (event.cancelBubble || parent_element === handler_element || parent_element === null) {
3033
- break;
3034
- }
3035
- current_target = parent_element;
3182
+ if (event.cancelBubble) break;
3183
+ path_idx++;
3184
+ current_target = path_idx < path.length ? (
3185
+ /** @type {Element} */
3186
+ path[path_idx]
3187
+ ) : null;
3036
3188
  }
3037
3189
  if (throw_error) {
3038
3190
  for (let error of other_errors) {
@@ -3179,8 +3331,9 @@ function is_passive_event(name) {
3179
3331
  }
3180
3332
  function set_text(text, value) {
3181
3333
  var str = value == null ? "" : typeof value === "object" ? `${value}` : value;
3182
- if (str !== (text.__t ?? (text.__t = text.nodeValue))) {
3183
- text.__t = str;
3334
+ if (str !== /** @type {any} */
3335
+ (text[TEXT_CACHE] ?? (text[TEXT_CACHE] = text.nodeValue))) {
3336
+ text[TEXT_CACHE] = str;
3184
3337
  text.nodeValue = `${str}`;
3185
3338
  }
3186
3339
  }
@@ -3472,6 +3625,7 @@ var BranchManager = class {
3472
3625
  } else {
3473
3626
  var offscreen = __privateGet(this, _offscreen).get(key);
3474
3627
  if (offscreen) {
3628
+ resume_effect(offscreen.effect);
3475
3629
  __privateGet(this, _onscreen).set(key, offscreen.effect);
3476
3630
  __privateGet(this, _offscreen).delete(key);
3477
3631
  offscreen.fragment.lastChild.remove();
@@ -3735,7 +3889,10 @@ function each(node, flags2, get_collection, get_key, render_fn2, fallback_fn = n
3735
3889
  var fallback = null;
3736
3890
  var each_array = /* @__PURE__ */ derived_safe_equal(() => {
3737
3891
  var collection = get_collection();
3738
- return is_array(collection) ? collection : collection == null ? [] : array_from(collection);
3892
+ return (
3893
+ /** @type {V[]} */
3894
+ is_array(collection) ? collection : collection == null ? [] : array_from(collection)
3895
+ );
3739
3896
  });
3740
3897
  var array;
3741
3898
  var pending = /* @__PURE__ */ new Map();
@@ -4069,7 +4226,10 @@ function to_style(value, styles) {
4069
4226
  return value == null ? null : String(value);
4070
4227
  }
4071
4228
  function set_class(dom, is_html, value, hash, prev_classes, next_classes) {
4072
- var prev = dom.__className;
4229
+ var prev = (
4230
+ /** @type {any} */
4231
+ dom[CLASS_CACHE]
4232
+ );
4073
4233
  if (hydrating || prev !== value || prev === void 0) {
4074
4234
  var next_class_name = to_class(value, hash, next_classes);
4075
4235
  if (!hydrating || next_class_name !== dom.getAttribute("class")) {
@@ -4079,7 +4239,7 @@ function set_class(dom, is_html, value, hash, prev_classes, next_classes) {
4079
4239
  dom.className = next_class_name;
4080
4240
  }
4081
4241
  }
4082
- dom.__className = value;
4242
+ dom[CLASS_CACHE] = value;
4083
4243
  } else if (next_classes && prev_classes !== next_classes) {
4084
4244
  for (var key in next_classes) {
4085
4245
  var is_present = !!next_classes[key];
@@ -4091,7 +4251,10 @@ function set_class(dom, is_html, value, hash, prev_classes, next_classes) {
4091
4251
  return next_classes;
4092
4252
  }
4093
4253
  function set_style(dom, value, prev_styles, next_styles) {
4094
- var prev = dom.__style;
4254
+ var prev = (
4255
+ /** @type {any} */
4256
+ dom[STYLE_CACHE]
4257
+ );
4095
4258
  if (hydrating || prev !== value) {
4096
4259
  var next_style_attr = to_style(value);
4097
4260
  if (!hydrating || next_style_attr !== dom.getAttribute("style")) {
@@ -4101,7 +4264,7 @@ function set_style(dom, value, prev_styles, next_styles) {
4101
4264
  dom.style.cssText = next_style_attr;
4102
4265
  }
4103
4266
  }
4104
- dom.__style = value;
4267
+ dom[STYLE_CACHE] = value;
4105
4268
  }
4106
4269
  return next_styles;
4107
4270
  }
@@ -4125,7 +4288,7 @@ function remove_input_defaults(input) {
4125
4288
  input.checked = checked;
4126
4289
  }
4127
4290
  };
4128
- input.__on_r = remove_defaults;
4291
+ input[FORM_RESET_HANDLER] = remove_defaults;
4129
4292
  queue_micro_task(remove_defaults);
4130
4293
  add_form_reset_listener();
4131
4294
  }
@@ -4152,8 +4315,8 @@ function set_attribute(element, attribute, value, skip_warning) {
4152
4315
  function get_attributes(element) {
4153
4316
  return (
4154
4317
  /** @type {Record<string | symbol, unknown>} **/
4155
- // @ts-expect-error
4156
- element.__attributes ?? (element.__attributes = {
4318
+ /** @type {any} */
4319
+ element[ATTRIBUTES_CACHE] ?? (element[ATTRIBUTES_CACHE] = {
4157
4320
  [IS_CUSTOM_ELEMENT]: element.nodeName.includes("-"),
4158
4321
  [IS_HTML]: element.namespaceURI === NAMESPACE_HTML
4159
4322
  })
@@ -4171,7 +4334,8 @@ function get_setters(element) {
4171
4334
  while (element_proto !== proto) {
4172
4335
  descriptors = get_descriptors(proto);
4173
4336
  for (var key in descriptors) {
4174
- if (descriptors[key].set) {
4337
+ if (descriptors[key].set && // better safe than sorry, we don't want spread attributes to mess with HTML content
4338
+ key !== "innerHTML" && key !== "textContent" && key !== "innerText") {
4175
4339
  setters.push(key);
4176
4340
  }
4177
4341
  }
@@ -4216,7 +4380,7 @@ function bind_this(element_or_component = {}, update, get_value, get_parts) {
4216
4380
  old_parts = parts;
4217
4381
  parts = [];
4218
4382
  untrack(() => {
4219
- if (element_or_component !== get_value(...parts)) {
4383
+ if (!is_bound_this(get_value(...parts), element_or_component)) {
4220
4384
  update(element_or_component, ...parts);
4221
4385
  if (old_parts && is_bound_this(get_value(...old_parts), element_or_component)) {
4222
4386
  update(null, ...old_parts);
@@ -4245,14 +4409,14 @@ function bind_this(element_or_component = {}, update, get_value, get_parts) {
4245
4409
  }
4246
4410
  var rest_props_handler = {
4247
4411
  get(target, key) {
4248
- if (target.exclude.includes(key)) return;
4412
+ if (target.exclude.has(key)) return;
4249
4413
  return target.props[key];
4250
4414
  },
4251
4415
  set(target, key) {
4252
4416
  return false;
4253
4417
  },
4254
4418
  getOwnPropertyDescriptor(target, key) {
4255
- if (target.exclude.includes(key)) return;
4419
+ if (target.exclude.has(key)) return;
4256
4420
  if (key in target.props) {
4257
4421
  return {
4258
4422
  enumerable: true,
@@ -4262,21 +4426,19 @@ var rest_props_handler = {
4262
4426
  }
4263
4427
  },
4264
4428
  has(target, key) {
4265
- if (target.exclude.includes(key)) return false;
4429
+ if (target.exclude.has(key)) return false;
4266
4430
  return key in target.props;
4267
4431
  },
4268
4432
  ownKeys(target) {
4269
- return Reflect.ownKeys(target.props).filter((key) => !target.exclude.includes(key));
4433
+ return Reflect.ownKeys(target.props).filter((key) => !target.exclude.has(key));
4270
4434
  }
4271
4435
  };
4272
4436
  // @__NO_SIDE_EFFECTS__
4273
4437
  function rest_props(props, exclude, name) {
4274
- return new Proxy(
4275
- { props, exclude },
4276
- rest_props_handler
4277
- );
4438
+ return new Proxy({ props, exclude }, rest_props_handler);
4278
4439
  }
4279
4440
  function prop(props, key, flags2, fallback) {
4441
+ var runes = true;
4280
4442
  var bindable = (flags2 & PROPS_IS_BINDABLE) !== 0;
4281
4443
  var lazy = (flags2 & PROPS_IS_LAZY_INITIAL) !== 0;
4282
4444
  var fallback_value = (
@@ -4284,7 +4446,18 @@ function prop(props, key, flags2, fallback) {
4284
4446
  fallback
4285
4447
  );
4286
4448
  var fallback_dirty = true;
4449
+ var fallback_signal = (
4450
+ /** @type {Derived<V> | undefined} */
4451
+ void 0
4452
+ );
4287
4453
  var get_fallback = () => {
4454
+ if (lazy && runes) {
4455
+ fallback_signal ?? (fallback_signal = /* @__PURE__ */ derived(
4456
+ /** @type {() => V} */
4457
+ fallback
4458
+ ));
4459
+ return get(fallback_signal);
4460
+ }
4288
4461
  if (fallback_dirty) {
4289
4462
  fallback_dirty = false;
4290
4463
  fallback_value = lazy ? untrack(
@@ -4391,7 +4564,7 @@ var NodeType$2 = /* @__PURE__ */ ((NodeType2) => {
4391
4564
  NodeType2[NodeType2["Comment"] = 5] = "Comment";
4392
4565
  return NodeType2;
4393
4566
  })(NodeType$2 || {});
4394
- function isElement(n2) {
4567
+ function isElement$1(n2) {
4395
4568
  return n2.nodeType === n2.ELEMENT_NODE;
4396
4569
  }
4397
4570
  var Mirror = class {
@@ -4423,6 +4596,9 @@ var Mirror = class {
4423
4596
  (childNode) => this.removeNodeFromMap(childNode)
4424
4597
  );
4425
4598
  }
4599
+ if (isElement$1(n2) && n2.shadowRoot) {
4600
+ this.removeNodeFromMap(n2.shadowRoot);
4601
+ }
4426
4602
  }
4427
4603
  has(id) {
4428
4604
  return this.idNodeMap.has(id);
@@ -5256,7 +5432,7 @@ function buildNodeWithSN(n2, options) {
5256
5432
  console.warn("Failed to rebuild", childN);
5257
5433
  continue;
5258
5434
  }
5259
- if (childN.isShadow && isElement(node) && node.shadowRoot) {
5435
+ if (childN.isShadow && isElement$1(node) && node.shadowRoot) {
5260
5436
  node.shadowRoot.appendChild(childNode);
5261
5437
  } else if (n2.type === NodeType$2.Document && childN.type == NodeType$2.Element) {
5262
5438
  const htmlElement = childNode;
@@ -5531,8 +5707,9 @@ function getImplementation(name) {
5531
5707
  if (cached) {
5532
5708
  return cached;
5533
5709
  }
5710
+ const windowImpl = window[name].bind(window);
5711
+ let impl = windowImpl;
5534
5712
  const document2 = window.document;
5535
- let impl = window[name];
5536
5713
  if (document2 && typeof document2.createElement === "function") {
5537
5714
  try {
5538
5715
  const sandbox = document2.createElement("iframe");
@@ -5540,16 +5717,21 @@ function getImplementation(name) {
5540
5717
  document2.head.appendChild(sandbox);
5541
5718
  const contentWindow = sandbox.contentWindow;
5542
5719
  if (contentWindow && contentWindow[name]) {
5543
- impl = // eslint-disable-next-line @typescript-eslint/unbound-method
5544
- contentWindow[name];
5720
+ const sandboxImpl = contentWindow[name].bind(window);
5721
+ impl = (...args) => {
5722
+ try {
5723
+ return sandboxImpl(...args);
5724
+ } catch {
5725
+ cachedImplementations[name] = windowImpl;
5726
+ return windowImpl(...args);
5727
+ }
5728
+ };
5545
5729
  }
5546
5730
  document2.head.removeChild(sandbox);
5547
5731
  } catch (e2) {
5548
5732
  }
5549
5733
  }
5550
- return cachedImplementations[name] = impl.bind(
5551
- window
5552
- );
5734
+ return cachedImplementations[name] = impl;
5553
5735
  }
5554
5736
  function onRequestAnimationFrame(...rest) {
5555
5737
  return getImplementation("requestAnimationFrame")(...rest);
@@ -5679,6 +5861,9 @@ var NodeType$1 = /* @__PURE__ */ ((NodeType2) => {
5679
5861
  NodeType2[NodeType2["Comment"] = 5] = "Comment";
5680
5862
  return NodeType2;
5681
5863
  })(NodeType$1 || {});
5864
+ function isElement(n2) {
5865
+ return n2.nodeType === n2.ELEMENT_NODE;
5866
+ }
5682
5867
  var Mirror$1 = class Mirror2 {
5683
5868
  constructor() {
5684
5869
  __publicField22(this, "idNodeMap", /* @__PURE__ */ new Map());
@@ -5708,6 +5893,9 @@ var Mirror$1 = class Mirror2 {
5708
5893
  (childNode) => this.removeNodeFromMap(childNode)
5709
5894
  );
5710
5895
  }
5896
+ if (isElement(n2) && n2.shadowRoot) {
5897
+ this.removeNodeFromMap(n2.shadowRoot);
5898
+ }
5711
5899
  }
5712
5900
  has(id) {
5713
5901
  return this.idNodeMap.has(id);
@@ -10221,11 +10409,11 @@ function getInactivePeriods(events, inactivePeriodThreshold) {
10221
10409
  }
10222
10410
  return inactivePeriods;
10223
10411
  }
10224
- var root$1 = /* @__PURE__ */ from_html(`<div><input type="checkbox" class="svelte-184lr04"/> <label class="svelte-184lr04"></label> <span class="label svelte-184lr04"> </span></div>`);
10412
+ 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>`);
10225
10413
  function Switch($$anchor, $$props) {
10226
10414
  push($$props, true);
10227
10415
  let checked = prop($$props, "checked", 15);
10228
- var div = root$1();
10416
+ var div = root$2();
10229
10417
  let classes;
10230
10418
  var input = child(div);
10231
10419
  remove_input_defaults(input);
@@ -10245,9 +10433,8 @@ function Switch($$anchor, $$props) {
10245
10433
  append($$anchor, div);
10246
10434
  pop();
10247
10435
  }
10248
- var root_2 = /* @__PURE__ */ from_html(`<div></div>`);
10249
- var root_3 = /* @__PURE__ */ from_html(`<div></div>`);
10250
- 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
10436
+ var root$1 = /* @__PURE__ */ from_html(`<div></div>`);
10437
+ 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
10251
10438
  512q0 53.00224-37.49888 90.50112t-90.50112
10252
10439
  37.49888-90.50112-37.49888-37.49888-90.50112l0-512q0-53.00224
10253
10440
  37.49888-90.50112t90.50112-37.49888zM341.34016 128q53.00224 0
@@ -10261,10 +10448,10 @@ var root_4 = /* @__PURE__ */ from_svg(`<svg class="icon" viewBox="0 0 1024 1024"
10261
10448
  213.34016q-17.67424 0-30.16704 12.4928t-12.4928 30.16704l0 512q0
10262
10449
  17.67424 12.4928 30.16704t30.16704 12.4928 30.16704-12.4928
10263
10450
  12.4928-30.16704l0-512q0-17.67424-12.4928-30.16704t-30.16704-12.4928z"></path></svg>`);
10264
- var root_5 = /* @__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
10451
+ 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
10265
10452
  512l-388.66944-233.32864 0 466.65728z"></path></svg>`);
10266
- var root_6 = /* @__PURE__ */ from_html(`<button> </button>`);
10267
- var root_1 = /* @__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
10453
+ var root_3 = /* @__PURE__ */ from_html(`<button> </button>`);
10454
+ 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
10268
10455
  18.4-48.8 18.4-68 0-18.4-18.4-18.4-48.8 0-68L800 156 692 156c-26.4
10269
10456
  0-48-21.6-48-48 0-26.4 21.6-48 48-48l224 0c26.4 0 48 21.6 48 48l0
10270
10457
  224C964 358.4 942.4 380 916 380zM231.2 860l108.8 0c26.4 0 48 21.6 48
@@ -10517,7 +10704,7 @@ function Controller($$anchor, $$props) {
10517
10704
  var node = first_child(fragment);
10518
10705
  {
10519
10706
  var consequent_1 = ($$anchor2) => {
10520
- var div = root_1();
10707
+ var div = root_4();
10521
10708
  var div_1 = child(div);
10522
10709
  var span = child(div_1);
10523
10710
  var text = child(span, true);
@@ -10528,7 +10715,7 @@ function Controller($$anchor, $$props) {
10528
10715
  var div_3 = child(div_2);
10529
10716
  var node_1 = sibling(div_3, 2);
10530
10717
  each(node_1, 17, () => get(inactivePeriods), index, ($$anchor3, period) => {
10531
- var div_4 = root_2();
10718
+ var div_4 = root$1();
10532
10719
  template_effect(() => {
10533
10720
  set_attribute(div_4, "title", get(period).name);
10534
10721
  set_style(div_4, `width: ${get(period).width ?? ""};height: 4px;position: absolute;background: ${get(period).background ?? ""};left:
@@ -10538,7 +10725,7 @@ function Controller($$anchor, $$props) {
10538
10725
  });
10539
10726
  var node_2 = sibling(node_1, 2);
10540
10727
  each(node_2, 17, () => get(customEvents), index, ($$anchor3, event) => {
10541
- var div_5 = root_3();
10728
+ var div_5 = root$1();
10542
10729
  template_effect(() => {
10543
10730
  set_attribute(div_5, "title", get(event).name);
10544
10731
  set_style(div_5, `width: 10px;height: 5px;position: absolute;top:
@@ -10559,11 +10746,11 @@ function Controller($$anchor, $$props) {
10559
10746
  var node_3 = child(button);
10560
10747
  {
10561
10748
  var consequent = ($$anchor3) => {
10562
- var svg = root_4();
10749
+ var svg = root_1();
10563
10750
  append($$anchor3, svg);
10564
10751
  };
10565
10752
  var alternate = ($$anchor3) => {
10566
- var svg_1 = root_5();
10753
+ var svg_1 = root_2();
10567
10754
  append($$anchor3, svg_1);
10568
10755
  };
10569
10756
  if_block(node_3, ($$render) => {
@@ -10574,7 +10761,7 @@ function Controller($$anchor, $$props) {
10574
10761
  reset(button);
10575
10762
  var node_4 = sibling(button, 2);
10576
10763
  each(node_4, 17, () => $$props.speedOption, index, ($$anchor3, s2) => {
10577
- var button_1 = root_6();
10764
+ var button_1 = root_3();
10578
10765
  let classes_1;
10579
10766
  var text_2 = child(button_1);
10580
10767
  reset(button_1);
@@ -10637,25 +10824,26 @@ function Controller($$anchor, $$props) {
10637
10824
  return pop($$exports);
10638
10825
  }
10639
10826
  delegate(["click", "keydown"]);
10827
+ var rest_excludes = /* @__PURE__ */ new Set([
10828
+ "$$slots",
10829
+ "$$events",
10830
+ "$$legacy",
10831
+ "width",
10832
+ "height",
10833
+ "maxScale",
10834
+ "events",
10835
+ "skipInactive",
10836
+ "autoPlay",
10837
+ "speedOption",
10838
+ "speed",
10839
+ "showController",
10840
+ "tags",
10841
+ "inactiveColor"
10842
+ ]);
10640
10843
  var root = /* @__PURE__ */ from_html(`<div class="rr-player"><div class="rr-player__frame"></div> <!></div>`);
10641
10844
  function Player$1($$anchor, $$props) {
10642
10845
  push($$props, true);
10643
- 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, [
10644
- "$$slots",
10645
- "$$events",
10646
- "$$legacy",
10647
- "width",
10648
- "height",
10649
- "maxScale",
10650
- "events",
10651
- "skipInactive",
10652
- "autoPlay",
10653
- "speedOption",
10654
- "speed",
10655
- "showController",
10656
- "tags",
10657
- "inactiveColor"
10658
- ]);
10846
+ 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);
10659
10847
  let replayer = /* @__PURE__ */ state(void 0);
10660
10848
  const getMirror = () => get(replayer).getMirror();
10661
10849
  const controllerHeight = 80;