masks-server 0.14.1 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. checksums.yaml +4 -4
  2. data/app/graphql/masks/server/manage/types/query_type/activity.rb +124 -0
  3. data/app/graphql/masks/server/manage/types/query_type/actors.rb +125 -0
  4. data/app/graphql/masks/server/manage/types/query_type/clients.rb +159 -0
  5. data/app/graphql/masks/server/manage/types/query_type/directory.rb +54 -0
  6. data/app/graphql/masks/server/manage/types/query_type/messaging.rb +51 -0
  7. data/app/graphql/masks/server/manage/types/query_type/organizations.rb +47 -0
  8. data/app/graphql/masks/server/manage/types/query_type/providers.rb +68 -0
  9. data/app/graphql/masks/server/manage/types/query_type/status.rb +40 -0
  10. data/app/graphql/masks/server/manage/types/query_type.rb +11 -539
  11. data/app/jobs/masks/server/application_job.rb +2 -2
  12. data/app/jobs/masks/server/backchannel_logout_job.rb +1 -1
  13. data/app/jobs/masks/server/cleanup_job.rb +1 -1
  14. data/app/jobs/masks/server/event_stream_job.rb +1 -1
  15. data/app/jobs/masks/server/saml_logout_job.rb +1 -1
  16. data/app/jobs/masks/server/signal_job.rb +1 -1
  17. data/app/jobs/masks/server/text_job.rb +1 -1
  18. data/app/ldap/masks/server/ldap/connection.rb +1 -1
  19. data/app/ldap/masks/server/ldap/gate.rb +1 -1
  20. data/app/{models → logins}/masks/server/login.rb +1 -1
  21. data/app/logins/masks/server/login_states/{enrolment.rb → protection.rb} +25 -25
  22. data/app/models/masks/server/actor/claims.rb +95 -0
  23. data/app/models/masks/server/actor/notices.rb +21 -0
  24. data/app/models/masks/server/actor/password.rb +85 -0
  25. data/app/models/masks/server/actor/second_factors.rb +121 -0
  26. data/app/models/masks/server/actor/suspension.rb +77 -0
  27. data/app/models/masks/server/actor.rb +5 -332
  28. data/app/models/masks/server/client/approval.rb +91 -0
  29. data/app/models/masks/server/client/credentials.rb +104 -0
  30. data/app/models/masks/server/client/forward_auth.rb +56 -0
  31. data/app/models/masks/server/client/redirects.rb +135 -0
  32. data/app/models/masks/server/client/registration.rb +180 -0
  33. data/app/models/masks/server/client/saml_application.rb +53 -0
  34. data/app/models/masks/server/client.rb +18 -537
  35. data/app/models/masks/server/declared.rb +1 -1
  36. data/app/models/masks/server/issuer.rb +1 -1
  37. data/app/models/masks/server/locked_out.rb +1 -1
  38. data/app/models/masks/server/master_key.rb +2 -2
  39. data/app/models/masks/server/passkey.rb +6 -10
  40. data/app/models/masks/server/tenant.rb +5 -133
  41. data/app/{models → saml}/masks/server/saml_identity/metadata.rb +1 -1
  42. data/app/views/masks/server/account/_signing_in.html.erb +4 -4
  43. data/app/views/masks/server/logins/{_enrol.html.erb → _protect.html.erb} +19 -19
  44. data/app/views/masks/server/logins/{_enrol_code_form.html.erb → _protect_code_form.html.erb} +1 -1
  45. data/config/locales/de/logins.yml +1 -1
  46. data/config/locales/en/flashes.yml +1 -1
  47. data/config/locales/en/logins.yml +1 -1
  48. data/config/locales/es/logins.yml +1 -1
  49. data/config/locales/fr/logins.yml +1 -1
  50. data/config/recurring.yml +49 -0
  51. data/db/migrate/20260912000000_create_masks_schema.rb +1 -1
  52. data/db/migrate/20260913000000_create_adapters.rb +1 -1
  53. data/db/migrate/20260913010000_create_sign_in_policies.rb +1 -1
  54. data/db/migrate/20260913090000_create_delegations.rb +1 -1
  55. data/db/migrate/20260921000000_create_client_logos.rb +1 -1
  56. data/db/migrate/20260926020000_create_event_streams.rb +1 -1
  57. data/db/migrate/20260927020000_create_organizations.rb +1 -1
  58. data/db/migrate/20260927050000_create_domain_claims.rb +1 -1
  59. data/db/migrate/20260927110000_create_signal_streams.rb +1 -1
  60. data/db/migrate/20260927160000_add_invited_at_to_memberships.rb +1 -1
  61. data/db/migrate/20260927170000_grant_identities_to_actors_in_every_tenant.rb +1 -1
  62. data/db/migrate/20260927180000_move_directory_ids_to_memberships.rb +1 -1
  63. data/db/migrate/20261003130000_create_mail_templates.rb +1 -1
  64. data/db/migrate/20261010120000_add_root_to_tokens.rb +1 -1
  65. data/db/migrate/20261010140000_create_groups.rb +1 -1
  66. data/db/migrate/20261010160000_create_tenant_logos.rb +1 -1
  67. data/db/migrate/20261011170000_create_saml_participations.rb +1 -1
  68. data/db/migrate/20261011180000_rename_adapters_to_senders.rb +1 -1
  69. data/db/migrate/20261012100000_create_replays.rb +1 -1
  70. data/db/migrate/20261018100000_create_released_nicknames.rb +1 -1
  71. data/db/migrate/20261020100000_create_access_requests.rb +1 -1
  72. data/db/migrate/20261020140000_create_health_checks.rb +1 -1
  73. data/lib/generators/masks/server/install/install_generator.rb +21 -1
  74. data/lib/generators/masks/server/install/templates/recurring.yml.tt +10 -0
  75. data/lib/masks/server/database_grants.rb +47 -0
  76. data/lib/masks/server/engine.rb +5 -1
  77. data/lib/masks/server/recurring.rb +35 -0
  78. data/lib/masks/server/tenancy/job.rb +2 -2
  79. data/lib/masks/server/tenancy/middleware.rb +1 -1
  80. data/lib/masks/server/tenancy/migration.rb +34 -0
  81. data/lib/masks/server/tenancy.rb +166 -0
  82. data/lib/masks/server/well_known.rb +43 -0
  83. data/lib/masks/server.rb +6 -2
  84. data/lib/tasks/masks.rake +12 -0
  85. data/public/masks-assets/.vite/manifest.json +13 -13
  86. data/public/masks-assets/assets/account-zkggUuBn.js +2 -0
  87. data/public/masks-assets/assets/account-zkggUuBn.js.map +1 -0
  88. data/public/masks-assets/assets/app-gxHYFYe-.css +2 -0
  89. data/public/masks-assets/assets/{handshake-YQpRNMIs.js → handshake-CkbNi2-b.js} +1 -1
  90. data/public/masks-assets/assets/{handshake-YQpRNMIs.js.map → handshake-CkbNi2-b.js.map} +1 -1
  91. data/public/masks-assets/assets/initial-VBUM-c9X.js +3 -0
  92. data/public/masks-assets/assets/initial-VBUM-c9X.js.map +1 -0
  93. data/public/masks-assets/assets/login-DD3NrC2J.js +6 -0
  94. data/public/masks-assets/assets/login-DD3NrC2J.js.map +1 -0
  95. data/public/masks-assets/assets/manage-BP1Ys9S1.js +605 -0
  96. data/public/masks-assets/assets/manage-BP1Ys9S1.js.map +1 -0
  97. data/public/masks-assets/assets/{passkey-5UYPVD3c.js → passkey-363JNndi.js} +2 -2
  98. data/public/masks-assets/assets/passkey-363JNndi.js.map +1 -0
  99. data/version.txt +1 -1
  100. metadata +78 -53
  101. data/lib/masks/server/tenant_isolation.rb +0 -52
  102. data/public/masks-assets/assets/account-h7I6VUPR.js +0 -2
  103. data/public/masks-assets/assets/account-h7I6VUPR.js.map +0 -1
  104. data/public/masks-assets/assets/app-Cfbt-A5V.css +0 -2
  105. data/public/masks-assets/assets/initial-Cn-UuAsy.js +0 -3
  106. data/public/masks-assets/assets/initial-Cn-UuAsy.js.map +0 -1
  107. data/public/masks-assets/assets/login-BDggujiZ.js +0 -6
  108. data/public/masks-assets/assets/login-BDggujiZ.js.map +0 -1
  109. data/public/masks-assets/assets/manage-VgOqKj7N.js +0 -605
  110. data/public/masks-assets/assets/manage-VgOqKj7N.js.map +0 -1
  111. data/public/masks-assets/assets/passkey-5UYPVD3c.js.map +0 -1
  112. /data/app/{models → federation}/masks/server/federation/mcp.rb +0 -0
  113. /data/app/{models → federation}/masks/server/federation/oauth2.rb +0 -0
  114. /data/app/{models → federation}/masks/server/federation/oidc.rb +0 -0
  115. /data/app/{models → federation}/masks/server/federation/protocol.rb +0 -0
  116. /data/app/{models → federation}/masks/server/federation/saml.rb +0 -0
  117. /data/app/{models → saml}/masks/server/saml_identity/farewells.rb +0 -0
  118. /data/app/{models → saml}/masks/server/saml_identity/logout_reply.rb +0 -0
  119. /data/app/{models → saml}/masks/server/saml_identity/logout_request.rb +0 -0
  120. /data/app/{models → saml}/masks/server/saml_identity/message.rb +0 -0
  121. /data/app/{models → saml}/masks/server/saml_identity/request.rb +0 -0
  122. /data/app/{models → saml}/masks/server/saml_identity/response.rb +0 -0
  123. /data/app/{models → saml}/masks/server/saml_identity/sign_off.rb +0 -0
  124. /data/app/{models → saml}/masks/server/saml_identity.rb +0 -0
  125. /data/app/{models → scim}/masks/server/scim/directory.rb +0 -0
  126. /data/app/{models → scim}/masks/server/scim/filter.rb +0 -0
  127. /data/app/{models → scim}/masks/server/scim/group.rb +0 -0
  128. /data/app/{models → scim}/masks/server/scim/organization_directory.rb +0 -0
  129. /data/app/{models → scim}/masks/server/scim/user.rb +0 -0
  130. /data/app/{models → scim}/masks/server/scim.rb +0 -0
  131. /data/app/{models → senders}/masks/server/senders/click_send.rb +0 -0
  132. /data/app/{models → senders}/masks/server/senders/infobip.rb +0 -0
  133. /data/app/{models → senders}/masks/server/senders/mail.rb +0 -0
  134. /data/app/{models → senders}/masks/server/senders/message_bird.rb +0 -0
  135. /data/app/{models → senders}/masks/server/senders/plivo.rb +0 -0
  136. /data/app/{models → senders}/masks/server/senders/sinch.rb +0 -0
  137. /data/app/{models → senders}/masks/server/senders/sms.rb +0 -0
  138. /data/app/{models → senders}/masks/server/senders/sms_log.rb +0 -0
  139. /data/app/{models → senders}/masks/server/senders/smtp.rb +0 -0
  140. /data/app/{models → senders}/masks/server/senders/sns.rb +0 -0
  141. /data/app/{models → senders}/masks/server/senders/telnyx.rb +0 -0
  142. /data/app/{models → senders}/masks/server/senders/twilio.rb +0 -0
  143. /data/app/{models → senders}/masks/server/senders/vonage.rb +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"initial-VBUM-c9X.js","names":["w.hydration_mismatch","e.set_context_after_init","w.derived_inert","e.effect_update_depth_exceeded","e.state_unsafe_mutation","source","e.state_descriptors_fixed","e.state_prototype_fixed","set_attribute","e.custom_renderer_unsupported_operation","e.effect_orphan","e.effect_in_unowned_derived","e.effect_in_teardown","cache","w.await_reactivity_loss","w.svelte_boundary_reset_noop","e.svelte_boundary_reset_onerror","e.hydration_failed","w.hydration_mismatch","clsx","_clsx","e.each_key_volatile","e.each_key_duplicate","w.hydration_mismatch","set_attribute","set_attribute_op","w.select_multiple_invalid_value","set_attribute_op","w.hydration_attribute_changed","e.props_invalid_value","e.lifecycle_outside_component","is_array","index_of","includes","array_from","define_property","get_descriptor","get_descriptors","object_prototype","array_prototype","get_prototype_of","is_extensible","noop","run_all","arr","i","deferred","resolve","reject","res","rej","fallback","value","lazy","to_array","n","length","_","array","element","MANAGED_EFFECT","CLEAN","DIRTY","MAYBE_DIRTY","INERT","DESTROYED","REACTION_RAN","DESTROYING","EFFECT_TRANSPARENT","EFFECT_PRESERVED","USER_EFFECT","EFFECT_OFFSCREEN","REACTION_IS_UPDATING","ASYNC","ERROR_VALUE","HAS_ABORT_CONTROLLER","ASSIGNED","STATE_SYMBOL","COMPONENT_SYMBOL","LEGACY_PROPS","LOADING_ATTR_SYMBOL","ATTRIBUTES_CACHE","CLASS_CACHE","STYLE_CACHE","TEXT_CACHE","FORM_RESET_HANDLER","STALE_REACTION","IS_XHTML","HYDRATION_ERROR","UNINITIALIZED","NAMESPACE_SVG","NAMESPACE_MATHML","derived_inert","hydration_mismatch","location","select_multiple_invalid_value","svelte_boundary_reset_noop","hydrating","set_hydrating","hydrate_node","set_hydrate_node","node","hydrate_next","get_next_sibling","reset","next","count","skip_nodes","remove","depth","node_type","data","get_node_value","remove_node","read_hydration_instruction","equals","safe_not_equal","a","b","safe_equals","lifecycle_outside_component","name","each_key_duplicate","effect_in_teardown","rune","effect_in_unowned_derived","effect_orphan","effect_update_depth_exceeded","props_invalid_value","key","state_descriptors_fixed","state_prototype_fixed","state_unsafe_mutation","svelte_boundary_reset_onerror","empty","snapshot","skip_warning","no_tojson","clone","cloned","path","paths","original","unwrapped","copy","micro_tasks","run_micro_tasks","tasks","queue_micro_task","fn","is_flushing_sync","flush_tasks","STATUS_MASK","set_signal_status","signal","status","update_derived_status","derived","get_parent_context","context","parent","get_or_init_context_map","component_context","set_component_context","getContext","setContext","push","props","runes","active_effect","pop","component","effects","create_user_effect","mark_as_component","is_runes","current_renderer","flatten","blockers","sync","async","deriveds","derived_safe_equal","pending","restore","capture","decrement_pending","increment_pending","run","error","invoke_error_boundary","unset_context","signals","async_expression","effect","block","s","is_uninitialized","get","branch","current_batch","previous_effect","previous_reaction","active_reaction","previous_component_context","previous_batch","batch","set_active_effect","set_active_reaction","merge_target","deactivate_batch","current_runner","boundary","flags","OBSOLETE","label","onready","source","deferreds","runner","resolver","waiting","flush_waiting","continued","fns","async_effect","d","result","promise","abort_signal","abort_controller","handler","obsolete","same","teardown","batch_values","user_derived","push_reaction_value","destroy_derived_effects","destroy_effect","execute_derived","prev_active_effect","is_destroying_effect","update_reaction","update_derived","is_dirty","records","view_batch","record","is_current","promote_record","get_view","cache","view_cache","entry","written","held","assigned","changed_since","freeze_derived_effects","e","abort_all","remove_reactions","destroy_effect_children","unfreeze_derived_effects","update_effect","first_batch","last_batch","processing_batch","teardown_context","set_teardown_context","push_teardown_context","values","teardown_write","last_scheduled_effect","rebases","collected_effects","legacy_updates","flush_count","seen","count_deps","uid","last_processed","Batch","#commit_callbacks","#discard_callbacks","#pending","#deferred","#unprocessed","#scheduled","#skipped_branches","#unskipped_branches","#decrement_queued","#is_deferred","#skips","root","#resolve","roots","covered","#process","#process_step","#add","render_effects","revealed_boundaries","updates","#unlink","infinite_loop_guard","#traverse","reset_branch","sorted","#defer_effects","target","earlier","#merge","earlier_batch","#find_earlier_batch","#release_records","#run_callbacks","was_flushing_effects","is_flushing_effects","previous_captured_writes","captured_writes","flush_queued_effects","next_batch","#revalidate","sources","reactions","reaction","is_branch","child","#intersects","previous","replaced","abort_record","#add_dirty_effect","discard","updated_during_traversal","later","later_writer","increment_write_version","apply","eager_effects","eager_effects_deferred","flush_eager_effects","#commit","is_earlier","own","#move_to_front","eager_block_writes","callbacks","untrack","writes","write","not_dirty","eager_block_effects","commit","is_outdated","prune_edges","prev","first","flushSync","was_flushing_sync","previous_view_batch","defer_if_pending","earlier_writes","version","write_version","unlink_effect","previous_teardown_context","previous_eager_block_writes","ordered_effects","ancestor","j","in_real_world","previous_batch_values","previous_view_cache","force","v","stack","state","mutable_source","initial_value","immutable","trackable","check_mutation","untracking","current_sources","set","should_proxy","unchecked_set","internal_set","proxy","untracked_writes","set_untracked_writes","run_eager_effects","dirty","update","increment","unchecked_increment","prototype","is_proxied_array","parent_version","update_version","with_parent","set_update_version","prop","descriptor","receiver","exists","has","other_s","p","ls","own_keys","get_proxied_value","is","$window","is_firefox","first_child_getter","next_sibling_getter","init_operations","element_prototype","node_prototype","text_prototype","create_text","create_hydration_text","create_anchor","get_first_child","is_text","append_child","text","insert_before","merge_text_nodes","first_child","is_comment","only_child","sibling","next_sibling","last_sibling","insert_after","clear_text_content","should_defer_append","create_element","tag","namespace","create_fragment","create_comment","set_attribute$1","node_name","get_last_child","get_parent_node","ref_node","new_node","remove_child","set_node_value","set_element_value","set_element_checked","checked","set_element_default_value","existing_value","set_element_default_checked","get_attribute","remove_attribute","has_attribute","set_inner_html","clone_node","deep","import_node","add_event_listener","type","options","remove_event_listener","dispatch_event","event","style_set_property","property","priority","style_remove_property","set_css_text","class_list_toggle","handle_error","validate_effect","push_effect","parent_effect","parent_last","create_effect","effect_tracking","user_effect","user_pre_effect","component_root","fulfil","pause_effect","render_effect","template_effect","managed","execute_effect_teardown","previously_destroying_effect","previous_teardown_version","teardown_version","set_is_destroying_effect","remove_dom","destroy_block_effect_children","removed","remove_effect_dom","transitions","transition","end","callback","destroy","pause_children","remaining","check","previous_context","local","t","transparent","resume_effect","resume_children","move_effect","fragment","captured_signals","autofocus","dom","body","remove_textarea_child","listening_to_form_reset","add_form_reset_listener","evt","without_reactive_context","listen_to_event_and_reset_event","on_reset","teardown_run","new_deps","skipped_deps","read_version","version_of","deps","dv","wv","unchanged","dep","run_of","dependency","schedule_possible_effect_self_invalidation","controller","rerun","supersedes","abort_replaced","is_derived","real","set_global_signal","other","is_recorded_effect","previous_deps","previous_skipped_deps","previous_untracked_writes","previous_sources","previous_untracking","previous_update_version","previous_abort_controller","update_dependencies","teardown_version_of","keep_global_run","set_derived_value","update_record","should_record","read","seen_version","keep","has_batch_record","tracking","edges","remove_reaction","added","derived_version","ac","live","add_reaction","index","new_length","dependencies","tick","late_reader","teardown_view","view","should_connect","is_new","reconnect","record_late_read","holds","is_capture_event","DELEGATED_EVENTS","can_delegate_event","event_name","DOM_BOOLEAN_ATTRIBUTES","[\n\t\"allowfullscreen\",\n\t\"async\",\n\t\"autofocus\",\n\t\"autoplay\",\n\t\"checked\",\n\t\"controls\",\n\t\"default\",\n\t\"disabled\",\n\t\"formnovalidate\",\n\t\"indeterminate\",\n\t\"inert\",\n\t\"ismap\",\n\t\"loop\",\n\t\"multiple\",\n\t\"muted\",\n\t\"nomodule\",\n\t\"novalidate\",\n\t\"open\",\n\t\"playsinline\",\n\t\"readonly\",\n\t\"required\",\n\t\"reversed\",\n\t\"seamless\",\n\t\"selected\",\n\t\"webkitdirectory\",\n\t\"defer\",\n\t\"disablepictureinpicture\",\n\t\"disableremoteplayback\"\n]","ATTRIBUTE_ALIASES","normalize_attribute","PASSIVE_EVENTS","is_passive_event","event_symbol","propagation_stopped_at","all_registered_events","root_event_handles","replay_events","create_event","is_custom_renderer","target_handler","args","handle_event_propagation","passive","delegated","delegate","events","delegated_listeners","listen_to_delegated_events","registered_events","event_handle","counts","last_propagated_event","last_propagated_event_clear_scheduled","handler_element","was_stopped","owner_document","current_target","path_idx","handled_at","at_idx","handler_idx","throw_error","other_errors","policy","html","create_trusted_html","create_fragment_from_html","elem","assign_nodes","start","from_html","content","is_fragment","use_import_node","has_start","from_namespace","ns","wrapped","from_svg","comment","frag","anchor","append","props_id","node_value","id","createSubscriber","subscribers","stop","children","transform_error","Boundary","#anchor","#hydrate_open","#props","#children","#effect","#main_effect","#pending_effect","#failed_effect","#offscreen_fragment","#local_pending_count","#pending_count_update_queued","#effects","#effect_pending","#effect_pending_subscriber","comment_data","server_rendered_pending","serialized_error","#hydrate_failed_content","#hydrate_pending_content","#hydrate_resolved_content","#render","failed","invoke_onerror","#create_reset","did_reset","calling_on_error","#is_destroyed","#run","err","previous_ctx","owner","#handle_error","handle_error_result","transformed_error","set_text","str","mount","_mount","Component","_mount_inner","intro","transformError","renderer","unmount","anchor_node","ctx","stop_listening","mounted_components","BranchManager","#batches","#onscreen","#offscreen","#outroing","#transition","#renderer","onscreen","offscreen","#discard","k","on_destroy","keys","defer","if_block","elseif","marker","branches","update_branch","has_branch","NAN","get_key","render_fn","legacy","r","f","o","clsx$1","clsx","whitespace","to_class","hash","directives","classname","len","append_styles","styles","important","separator","css","to_css_name","to_style","new_style","normal_styles","important_styles","in_str","in_apo","in_comment","reserved_names","start_index","name_index","c","pause_effects","to_destroy","controlled_anchor","done","group","groups","destroy_effects","fast_path","parent_node","selected_effects","selected","preserved_effects","link","is_outroing","offscreen_anchors","dom_weak_key","get_offscreen_anchor","cached","offscreen_anchor","each","get_collection","fallback_fn","items","each_array","collection","first_run","reconcile","move","destroy_unselected","mismatch","item","create_item","skip_to_branch","is_animated","current","to_animate","matched","stashed","destroy_length","dest","next_node","get_value","is_controlled","svg","mathml","last","wrapper","snippet","get_snippet","get_component","hydration_start_node","attach","get_fn","set_class","is_html","prev_classes","next_classes","next_class_name","is_present","update_styles","set_style","prev_styles","next_styles","next_style_attr","set_selected","option","set_default_select_value","select","mounting","apply_default_select_value","preserve","multiple","option_value","get_option_value","was_selected","select_option","init_select","observer","entries","is_selectedcontent_mutation","bind_select_value","batches","is_reset","query","selected_option","nodes","CLASS","STYLE","IS_CUSTOM_ELEMENT","IS_HTML","LINK_TAG","INPUT_TAG","OPTION_TAG","SELECT_TAG","PROGRESS_TAG","remove_input_defaults","input","already_removed","remove_defaults","set_attribute","set_value","attributes","get_attributes","set_checked","attribute","get_setters","set_attributes","css_hash","should_remove_defaults","is_custom_element","preserve_attribute_case","is_hydrating_custom_element","is_option_element","is_select_element","setters","prev_value","prefix","opts","event_handle_key","is_delegated","handle","is_default","use_default","attribute_effect","is_select","inited","symbol","attrs","setters_cache","cache_key","descriptors","proto","element_proto","bind_value","is_numberlike_input","to_number","bind_group","inputs","group_index","is_checkbox","binding_group","get_binding_group_value","bind_checked","__value","is_bound_this","bound_value","element_or_component","bind_this","get_parts","component_effect","old_parts","parts","original_teardown","is_store_binding","capture_store_binding","previous_is_store_binding","rest_props_handler","rest_props","exclude","bindable","fallback_value","fallback_dirty","fallback_signal","get_fallback","setter","is_entry_props","is_store_sub","getter","legacy_parent","mutation","overridden","new_value","onMount","cleanup","initial","initials"],"sources":["../../../../server/node_modules/svelte/src/internal/shared/utils.js","../../../../server/node_modules/svelte/src/internal/client/constants.js","../../../../server/node_modules/svelte/src/constants.js","../../../../server/node_modules/svelte/src/internal/client/warnings.js","../../../../server/node_modules/svelte/src/internal/client/dom/hydration.js","../../../../server/node_modules/svelte/src/internal/client/reactivity/equality.js","../../../../server/node_modules/svelte/src/internal/shared/errors.js","../../../../server/node_modules/svelte/src/internal/client/errors.js","../../../../server/node_modules/svelte/src/internal/shared/clone.js","../../../../server/node_modules/svelte/src/internal/client/dom/task.js","../../../../server/node_modules/svelte/src/internal/client/reactivity/status.js","../../../../server/node_modules/svelte/src/internal/shared/dev.js","../../../../server/node_modules/svelte/src/internal/shared/context.js","../../../../server/node_modules/svelte/src/internal/client/context.js","../../../../server/node_modules/svelte/src/internal/client/custom-renderer/state.js","../../../../server/node_modules/svelte/src/internal/client/reactivity/async.js","../../../../server/node_modules/svelte/src/internal/client/reactivity/deriveds.js","../../../../server/node_modules/svelte/src/internal/client/reactivity/batch.js","../../../../server/node_modules/svelte/src/internal/client/dev/tracing.js","../../../../server/node_modules/svelte/src/internal/client/reactivity/sources.js","../../../../server/node_modules/svelte/src/internal/client/proxy.js","../../../../server/node_modules/svelte/src/internal/client/dom/operations.js","../../../../server/node_modules/svelte/src/internal/client/error-handling.js","../../../../server/node_modules/svelte/src/internal/client/reactivity/effects.js","../../../../server/node_modules/svelte/src/internal/client/legacy.js","../../../../server/node_modules/svelte/src/internal/client/dom/elements/misc.js","../../../../server/node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js","../../../../server/node_modules/svelte/src/internal/client/runtime.js","../../../../server/node_modules/svelte/src/utils.js","../../../../server/node_modules/svelte/src/internal/client/dom/elements/events.js","../../../../server/node_modules/svelte/src/internal/client/dom/reconciler.js","../../../../server/node_modules/svelte/src/internal/client/dom/template.js","../../../../server/node_modules/svelte/src/reactivity/create-subscriber.js","../../../../server/node_modules/svelte/src/internal/client/dom/blocks/boundary.js","../../../../server/node_modules/svelte/src/internal/client/render.js","../../../../server/node_modules/svelte/src/internal/client/dom/blocks/branches.js","../../../../server/node_modules/svelte/src/internal/client/dom/blocks/if.js","../../../../server/node_modules/svelte/src/internal/client/dom/blocks/key.js","../../../../server/node_modules/clsx/dist/clsx.mjs","../../../../server/node_modules/svelte/src/internal/shared/attributes.js","../../../../server/node_modules/svelte/src/internal/client/dom/blocks/each.js","../../../../server/node_modules/svelte/src/internal/client/dom/blocks/html.js","../../../../server/node_modules/svelte/src/internal/client/dom/blocks/snippet.js","../../../../server/node_modules/svelte/src/internal/client/dom/blocks/svelte-component.js","../../../../server/node_modules/svelte/src/internal/client/dom/elements/attachments.js","../../../../server/node_modules/svelte/src/internal/client/dom/elements/class.js","../../../../server/node_modules/svelte/src/internal/client/dom/elements/style.js","../../../../server/node_modules/svelte/src/internal/client/dom/elements/bindings/select.js","../../../../server/node_modules/svelte/src/internal/client/dom/elements/attributes.js","../../../../server/node_modules/svelte/src/internal/client/dom/elements/bindings/input.js","../../../../server/node_modules/svelte/src/internal/client/dom/elements/bindings/this.js","../../../../server/node_modules/svelte/src/internal/client/reactivity/store.js","../../../../server/node_modules/svelte/src/internal/client/reactivity/props.js","../../../../server/node_modules/svelte/src/legacy/legacy-client.js","../../../../server/node_modules/svelte/src/internal/client/dom/elements/custom-element.js","../../../../server/node_modules/svelte/src/index-client.js","../../../../server/node_modules/svelte/src/internal/init-operations.js","../../../../server/node_modules/svelte/src/internal/disclose-version.js","../../../../server/app/frontend/lib/initial.js"],"sourcesContent":["// Store the references to globals in case someone tries to monkey patch these, causing the below\n// to de-opt (this occurs often when using popular extensions).\nexport var is_array = Array.isArray;\nexport var index_of = Array.prototype.indexOf;\nexport var includes = Array.prototype.includes;\nexport var array_from = Array.from;\nexport var object_keys = Object.keys;\nexport var define_property = Object.defineProperty;\nexport var get_descriptor = Object.getOwnPropertyDescriptor;\nexport var get_descriptors = Object.getOwnPropertyDescriptors;\nexport var object_prototype = Object.prototype;\nexport var array_prototype = Array.prototype;\nexport var get_prototype_of = Object.getPrototypeOf;\nexport var is_extensible = Object.isExtensible;\nexport var has_own_property = Object.prototype.hasOwnProperty;\n\n/**\n * @param {any} thing\n * @returns {thing is Function}\n */\nexport function is_function(thing) {\n\treturn typeof thing === 'function';\n}\n\nexport const noop = () => {};\n\n// Adapted from https://github.com/then/is-promise/blob/master/index.js\n// Distributed under MIT License https://github.com/then/is-promise/blob/master/LICENSE\n\n/**\n * @template [T=any]\n * @param {any} value\n * @returns {value is PromiseLike<T>}\n */\nexport function is_promise(value) {\n\treturn typeof value?.then === 'function';\n}\n\n/** @param {Function} fn */\nexport function run(fn) {\n\treturn fn();\n}\n\n/** @param {Array<() => void>} arr */\nexport function run_all(arr) {\n\tfor (var i = 0; i < arr.length; i++) {\n\t\tarr[i]();\n\t}\n}\n\n/**\n * `array.push(...items)` overflows the stack for large `items`.\n * @template T\n * @param {T[]} array\n * @param {T[]} items\n */\nexport function push_array(array, items) {\n\tfor (var i = 0; i < items.length; i++) {\n\t\tarray.push(items[i]);\n\t}\n}\n\n/**\n * TODO replace with Promise.withResolvers once supported widely enough\n * @template [T=void]\n */\nexport function deferred() {\n\t/** @type {(value: T) => void} */\n\tvar resolve;\n\n\t/** @type {(reason: any) => void} */\n\tvar reject;\n\n\t/** @type {Promise<T>} */\n\tvar promise = new Promise((res, rej) => {\n\t\tresolve = res;\n\t\treject = rej;\n\t});\n\n\t// @ts-expect-error\n\treturn { promise, resolve, reject };\n}\n\n/**\n * @template V\n * @param {V} value\n * @param {V | (() => V)} fallback\n * @param {boolean} [lazy]\n * @returns {V}\n */\nexport function fallback(value, fallback, lazy = false) {\n\treturn value === undefined\n\t\t? lazy\n\t\t\t? /** @type {() => V} */ (fallback)()\n\t\t\t: /** @type {V} */ (fallback)\n\t\t: value;\n}\n\n/**\n * When encountering a situation like `let [a, b, c] = $derived(blah())`,\n * we need to stash an intermediate value that `a`, `b`, and `c` derive\n * from, in case it's an iterable\n * @template T\n * @param {ArrayLike<T> | Iterable<T>} value\n * @param {number} [n]\n * @returns {Array<T>}\n */\nexport function to_array(value, n) {\n\t// return arrays unchanged\n\tif (Array.isArray(value)) {\n\t\treturn value;\n\t}\n\n\t// if `n` is unspecified (indicates a rest element, which means\n\t// we're not concerned about unbounded iterables) convert to an\n\t// array with `Array.from`\n\tif (n === undefined) {\n\t\treturn Array.from(value);\n\t}\n\n\t// if value is array-like but not iterable, copy at most `n` values\n\tif (!(Symbol.iterator in value)) {\n\t\tconst length = Math.min(n, /** @type {ArrayLike<T>} */ (value).length);\n\t\treturn Array.from({ length }, (_, i) => /** @type {ArrayLike<T>} */ (value)[i]);\n\t}\n\n\t// otherwise, populate an array with `n` values\n\n\t/** @type {T[]} */\n\tconst array = [];\n\n\tfor (const element of value) {\n\t\tarray.push(element);\n\t\tif (array.length === n) break;\n\t}\n\n\treturn array;\n}\n\n/**\n * @param {Record<string | symbol, unknown>} obj\n * @param {Array<string | symbol>} keys\n * @returns {Record<string | symbol, unknown>}\n */\nexport function exclude_from_object(obj, keys) {\n\t/** @type {Record<string | symbol, unknown>} */\n\tvar result = {};\n\n\tfor (var key in obj) {\n\t\tif (!keys.includes(key)) {\n\t\t\tresult[key] = obj[key];\n\t\t}\n\t}\n\n\tfor (var symbol of Object.getOwnPropertySymbols(obj)) {\n\t\tif (Object.propertyIsEnumerable.call(obj, symbol) && !keys.includes(symbol)) {\n\t\t\tresult[symbol] = obj[symbol];\n\t\t}\n\t}\n\n\treturn result;\n}\n","// General flags\nexport const DERIVED = 1 << 1;\nexport const EFFECT = 1 << 2;\nexport const RENDER_EFFECT = 1 << 3;\n/**\n * An effect that does not destroy its child effects when it reruns.\n * Runs as part of render effects, i.e. not eagerly as part of tree traversal or effect flushing.\n */\nexport const MANAGED_EFFECT = 1 << 24;\n/**\n * An effect that does not destroy its child effects when it reruns (like MANAGED_EFFECT).\n * Runs eagerly as part of tree traversal or effect flushing.\n */\nexport const BLOCK_EFFECT = 1 << 4;\nexport const BRANCH_EFFECT = 1 << 5;\nexport const ROOT_EFFECT = 1 << 6;\nexport const BOUNDARY_EFFECT = 1 << 7;\n/**\n * Set on the effect that `pause_effect` was called on, i.e. the root of a paused subtree,\n * as opposed to its descendants which are merely `INERT`. This allows `resume_effect` on\n * an ancestor to skip subtrees that were paused for their own reasons (such as a block\n * whose condition is still false) rather than resurrecting them.\n */\nexport const PAUSED = 1 << 8;\n/**\n * Indicates that a reaction is connected to an effect root — either it is an effect,\n * or it is a derived that is depended on by at least one effect. If a derived has\n * no dependents, we can disconnect it from the graph, allowing it to either be\n * GC'd or reconnected later if an effect comes to depend on it again\n */\nexport const CONNECTED = 1 << 9;\nexport const CLEAN = 1 << 10;\nexport const DIRTY = 1 << 11;\nexport const MAYBE_DIRTY = 1 << 12;\nexport const INERT = 1 << 13;\nexport const DESTROYED = 1 << 14;\n/** Set once a reaction has run for the first time */\nexport const REACTION_RAN = 1 << 15;\n/** Effect is in the process of getting destroyed. Can be observed in child teardown functions */\nexport const DESTROYING = 1 << 25;\n\n// Flags exclusive to effects\n/**\n * 'Transparent' effects do not create a transition boundary.\n * This is on a block effect 99% of the time but may also be on a branch effect if its parent block effect was pruned\n */\nexport const EFFECT_TRANSPARENT = 1 << 16;\nexport const EAGER_EFFECT = 1 << 17;\nexport const HEAD_EFFECT = 1 << 18;\nexport const EFFECT_PRESERVED = 1 << 19;\nexport const USER_EFFECT = 1 << 20;\nexport const EFFECT_OFFSCREEN = 1 << 25;\n\n// Flags used for async\nexport const REACTION_IS_UPDATING = 1 << 21;\nexport const ASYNC = 1 << 22;\n\nexport const ERROR_VALUE = 1 << 23;\n\n/** A run of the reaction asked for an abort signal (see `getAbortSignal`) */\nexport const HAS_ABORT_CONTROLLER = 1 << 27;\n\n// Flags exclusive to deriveds\n/** The global state of the derived is a value that was assigned to it, rather than a run of it */\nexport const ASSIGNED = 1 << 26;\n\nexport const STATE_SYMBOL = Symbol('$state');\n/** Marks component export objects, so that `proxy(...)` leaves them untouched */\nexport const COMPONENT_SYMBOL = Symbol('component');\nexport const LEGACY_PROPS = Symbol('legacy props');\nexport const LOADING_ATTR_SYMBOL = Symbol('');\nexport const PROXY_PATH_SYMBOL = Symbol('proxy path');\nexport const ATTRIBUTES_CACHE = Symbol('attributes');\nexport const CLASS_CACHE = Symbol('class');\nexport const STYLE_CACHE = Symbol('style');\nexport const TEXT_CACHE = Symbol('text');\nexport const FORM_RESET_HANDLER = Symbol('form reset');\n/** An anchor might change, via this symbol on the original anchor we can tell HMR about the updated anchor */\nexport const HMR_ANCHOR = Symbol('hmr anchor');\n\n/** allow users to ignore aborted signal errors if `reason.name === 'StaleReactionError` */\nexport const STALE_REACTION = new (class StaleReactionError extends Error {\n\tname = 'StaleReactionError';\n\tmessage = 'The reaction that called `getAbortSignal()` was re-run or destroyed';\n})();\n\nexport const IS_XHTML =\n\t// We gotta write it like this because after downleveling the pure comment may end up in the wrong location\n\t!!globalThis.document?.contentType &&\n\t/* @__PURE__ */ globalThis.document.contentType.includes('xml');\nexport const ELEMENT_NODE = 1;\nexport const TEXT_NODE = 3;\nexport const COMMENT_NODE = 8;\nexport const DOCUMENT_FRAGMENT_NODE = 11;\n\nexport const CUSTOM_RENDERER_NODE_TYPE_MAP = /** @type {const} */ ({\n\tfragment: DOCUMENT_FRAGMENT_NODE,\n\telement: ELEMENT_NODE,\n\ttext: TEXT_NODE,\n\tcomment: COMMENT_NODE\n});\n","export const EACH_ITEM_REACTIVE = 1;\nexport const EACH_INDEX_REACTIVE = 1 << 1;\n/** See EachBlock interface metadata.is_controlled for an explanation what this is */\nexport const EACH_IS_CONTROLLED = 1 << 2;\nexport const EACH_IS_ANIMATED = 1 << 3;\nexport const EACH_ITEM_IMMUTABLE = 1 << 4;\n\nexport const PROPS_IS_IMMUTABLE = 1;\nexport const PROPS_IS_RUNES = 1 << 1;\nexport const PROPS_IS_UPDATED = 1 << 2;\nexport const PROPS_IS_BINDABLE = 1 << 3;\nexport const PROPS_IS_LAZY_INITIAL = 1 << 4;\n\nexport const TRANSITION_IN = 1;\nexport const TRANSITION_OUT = 1 << 1;\nexport const TRANSITION_GLOBAL = 1 << 2;\n\nexport const TEMPLATE_FRAGMENT = 1;\nexport const TEMPLATE_USE_IMPORT_NODE = 1 << 1;\nexport const TEMPLATE_USE_SVG = 1 << 2;\nexport const TEMPLATE_USE_MATHML = 1 << 3;\n\nexport const HYDRATION_START = '[';\n/** used to indicate that an `{:else}...` block was rendered */\nexport const HYDRATION_START_ELSE = '[!';\n/** used to indicate that a boundary's `failed` snippet was rendered on the server */\nexport const HYDRATION_START_FAILED = '[?';\nexport const HYDRATION_END = ']';\nexport const HYDRATION_ERROR = {};\n\nexport const ELEMENT_IS_NAMESPACED = 1;\nexport const ELEMENT_PRESERVE_ATTRIBUTE_CASE = 1 << 1;\nexport const ELEMENT_IS_INPUT = 1 << 2;\n\nexport const UNINITIALIZED = Symbol('uninitialized');\n\n// Dev-time component properties\nexport const FILENAME = Symbol('filename');\nexport const HMR = Symbol('hmr');\n\nexport const NAMESPACE_HTML = 'http://www.w3.org/1999/xhtml';\nexport const NAMESPACE_SVG = 'http://www.w3.org/2000/svg';\nexport const NAMESPACE_MATHML = 'http://www.w3.org/1998/Math/MathML';\n\n// we use a list of ignorable runtime warnings because not every runtime warning\n// can be ignored and we want to keep the validation for svelte-ignore in place\nexport const IGNORABLE_RUNTIME_WARNINGS = /** @type {const} */ ([\n\t'await_waterfall',\n\t'await_reactivity_loss',\n\t'state_snapshot_uncloneable',\n\t'binding_property_non_reactive',\n\t'hydration_attribute_changed',\n\t'hydration_html_changed',\n\t'ownership_invalid_binding',\n\t'ownership_invalid_mutation'\n]);\n\nexport const ATTACHMENT_KEY = '@attach';\n","/* This file is generated by scripts/process-messages/index.js. Do not edit! */\n\nimport { DEV } from 'esm-env';\n\nvar bold = 'font-weight: bold';\nvar normal = 'font-weight: normal';\n\n/**\n * Assignment to `%property%` property (%location%) will evaluate to the right-hand side, not the value of `%property%` following the assignment. This may result in unexpected behaviour.\n * @param {string} property\n * @param {string} location\n */\nexport function assignment_value_stale(property, location) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] assignment_value_stale\\n%cAssignment to \\`${property}\\` property (${location}) will evaluate to the right-hand side, not the value of \\`${property}\\` following the assignment. This may result in unexpected behaviour.\\nhttps://svelte.dev/e/assignment_value_stale`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/assignment_value_stale`);\n\t}\n}\n\n/**\n * Detected reactivity loss when reading `%name%`. This happens when state is read in an async function after an earlier `await`\n * @param {string} name\n */\nexport function await_reactivity_loss(name) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] await_reactivity_loss\\n%cDetected reactivity loss when reading \\`${name}\\`. This happens when state is read in an async function after an earlier \\`await\\`\\nhttps://svelte.dev/e/await_reactivity_loss`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/await_reactivity_loss`);\n\t}\n}\n\n/**\n * An async derived, `%name%` (%location%) was not read immediately after it resolved. This often indicates an unnecessary waterfall, which can slow down your app\n * @param {string} name\n * @param {string} location\n */\nexport function await_waterfall(name, location) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] await_waterfall\\n%cAn async derived, \\`${name}\\` (${location}) was not read immediately after it resolved. This often indicates an unnecessary waterfall, which can slow down your app\\nhttps://svelte.dev/e/await_waterfall`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/await_waterfall`);\n\t}\n}\n\n/**\n * `%binding%` (%location%) is binding to a non-reactive property\n * @param {string} binding\n * @param {string | undefined | null} [location]\n */\nexport function binding_property_non_reactive(binding, location) {\n\tif (DEV) {\n\t\tconsole.warn(\n\t\t\t`%c[svelte] binding_property_non_reactive\\n%c${location\n\t\t\t\t? `\\`${binding}\\` (${location}) is binding to a non-reactive property`\n\t\t\t\t: `\\`${binding}\\` is binding to a non-reactive property`}\\nhttps://svelte.dev/e/binding_property_non_reactive`,\n\t\t\tbold,\n\t\t\tnormal\n\t\t);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/binding_property_non_reactive`);\n\t}\n}\n\n/**\n * Your `console.%method%` contained `$state` proxies. Consider using `$inspect(...)` or `$state.snapshot(...)` instead\n * @param {string} method\n */\nexport function console_log_state(method) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] console_log_state\\n%cYour \\`console.${method}\\` contained \\`$state\\` proxies. Consider using \\`$inspect(...)\\` or \\`$state.snapshot(...)\\` instead\\nhttps://svelte.dev/e/console_log_state`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/console_log_state`);\n\t}\n}\n\n/**\n * Reading a derived belonging to a now-destroyed effect may result in stale values\n */\nexport function derived_inert() {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] derived_inert\\n%cReading a derived belonging to a now-destroyed effect may result in stale values\\nhttps://svelte.dev/e/derived_inert`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/derived_inert`);\n\t}\n}\n\n/**\n * %handler% should be a function. Did you mean to %suggestion%?\n * @param {string} handler\n * @param {string} suggestion\n */\nexport function event_handler_invalid(handler, suggestion) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] event_handler_invalid\\n%c${handler} should be a function. Did you mean to ${suggestion}?\\nhttps://svelte.dev/e/event_handler_invalid`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/event_handler_invalid`);\n\t}\n}\n\n/**\n * Expected to find a hydratable with key `%key%` during hydration, but did not.\n * @param {string} key\n */\nexport function hydratable_missing_but_expected(key) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] hydratable_missing_but_expected\\n%cExpected to find a hydratable with key \\`${key}\\` during hydration, but did not.\\nhttps://svelte.dev/e/hydratable_missing_but_expected`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/hydratable_missing_but_expected`);\n\t}\n}\n\n/**\n * The `%attribute%` attribute on `%html%` changed its value between server and client renders. The client value, `%value%`, will be ignored in favour of the server value\n * @param {string} attribute\n * @param {string} html\n * @param {string} value\n */\nexport function hydration_attribute_changed(attribute, html, value) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] hydration_attribute_changed\\n%cThe \\`${attribute}\\` attribute on \\`${html}\\` changed its value between server and client renders. The client value, \\`${value}\\`, will be ignored in favour of the server value\\nhttps://svelte.dev/e/hydration_attribute_changed`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/hydration_attribute_changed`);\n\t}\n}\n\n/**\n * The value of an `{@html ...}` block %location% changed between server and client renders. The client value will be ignored in favour of the server value\n * @param {string | undefined | null} [location]\n */\nexport function hydration_html_changed(location) {\n\tif (DEV) {\n\t\tconsole.warn(\n\t\t\t`%c[svelte] hydration_html_changed\\n%c${location\n\t\t\t\t? `The value of an \\`{@html ...}\\` block ${location} changed between server and client renders. The client value will be ignored in favour of the server value`\n\t\t\t\t: 'The value of an `{@html ...}` block changed between server and client renders. The client value will be ignored in favour of the server value'}\\nhttps://svelte.dev/e/hydration_html_changed`,\n\t\t\tbold,\n\t\t\tnormal\n\t\t);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/hydration_html_changed`);\n\t}\n}\n\n/**\n * Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near %location%\n * @param {string | undefined | null} [location]\n */\nexport function hydration_mismatch(location) {\n\tif (DEV) {\n\t\tconsole.warn(\n\t\t\t`%c[svelte] hydration_mismatch\\n%c${location\n\t\t\t\t? `Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near ${location}`\n\t\t\t\t: 'Hydration failed because the initial UI does not match what was rendered on the server'}\\nhttps://svelte.dev/e/hydration_mismatch`,\n\t\t\tbold,\n\t\t\tnormal\n\t\t);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/hydration_mismatch`);\n\t}\n}\n\n/**\n * The `render` function passed to `createRawSnippet` should return HTML for a single element\n */\nexport function invalid_raw_snippet_render() {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] invalid_raw_snippet_render\\n%cThe \\`render\\` function passed to \\`createRawSnippet\\` should return HTML for a single element\\nhttps://svelte.dev/e/invalid_raw_snippet_render`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/invalid_raw_snippet_render`);\n\t}\n}\n\n/**\n * Detected a migrated `$:` reactive block in `%filename%` that both accesses and updates the same reactive value. This may cause recursive updates when converted to an `$effect`.\n * @param {string} filename\n */\nexport function legacy_recursive_reactive_block(filename) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] legacy_recursive_reactive_block\\n%cDetected a migrated \\`$:\\` reactive block in \\`${filename}\\` that both accesses and updates the same reactive value. This may cause recursive updates when converted to an \\`$effect\\`.\\nhttps://svelte.dev/e/legacy_recursive_reactive_block`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/legacy_recursive_reactive_block`);\n\t}\n}\n\n/**\n * Tried to unmount a component that was not mounted\n */\nexport function lifecycle_double_unmount() {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] lifecycle_double_unmount\\n%cTried to unmount a component that was not mounted\\nhttps://svelte.dev/e/lifecycle_double_unmount`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/lifecycle_double_unmount`);\n\t}\n}\n\n/**\n * %parent% passed property `%prop%` to %child% with `bind:`, but its parent component %owner% did not declare `%prop%` as a binding. Consider creating a binding between %owner% and %parent% (e.g. `bind:%prop%={...}` instead of `%prop%={...}`)\n * @param {string} parent\n * @param {string} prop\n * @param {string} child\n * @param {string} owner\n */\nexport function ownership_invalid_binding(parent, prop, child, owner) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] ownership_invalid_binding\\n%c${parent} passed property \\`${prop}\\` to ${child} with \\`bind:\\`, but its parent component ${owner} did not declare \\`${prop}\\` as a binding. Consider creating a binding between ${owner} and ${parent} (e.g. \\`bind:${prop}={...}\\` instead of \\`${prop}={...}\\`)\\nhttps://svelte.dev/e/ownership_invalid_binding`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/ownership_invalid_binding`);\n\t}\n}\n\n/**\n * Mutating unbound props (`%name%`, at %location%) is strongly discouraged. Consider using `bind:%prop%={...}` in %parent% (or using a callback) instead\n * @param {string} name\n * @param {string} location\n * @param {string} prop\n * @param {string} parent\n */\nexport function ownership_invalid_mutation(name, location, prop, parent) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] ownership_invalid_mutation\\n%cMutating unbound props (\\`${name}\\`, at ${location}) is strongly discouraged. Consider using \\`bind:${prop}={...}\\` in ${parent} (or using a callback) instead\\nhttps://svelte.dev/e/ownership_invalid_mutation`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/ownership_invalid_mutation`);\n\t}\n}\n\n/**\n * The `value` property of a `<select multiple>` element should be an array, but it received a non-array value. The selection will be kept as is.\n */\nexport function select_multiple_invalid_value() {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] select_multiple_invalid_value\\n%cThe \\`value\\` property of a \\`<select multiple>\\` element should be an array, but it received a non-array value. The selection will be kept as is.\\nhttps://svelte.dev/e/select_multiple_invalid_value`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/select_multiple_invalid_value`);\n\t}\n}\n\n/**\n * Reactive `$state(...)` proxies and the values they proxy have different identities. Because of this, comparisons with `%operator%` will produce unexpected results\n * @param {string} operator\n */\nexport function state_proxy_equality_mismatch(operator) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] state_proxy_equality_mismatch\\n%cReactive \\`$state(...)\\` proxies and the values they proxy have different identities. Because of this, comparisons with \\`${operator}\\` will produce unexpected results\\nhttps://svelte.dev/e/state_proxy_equality_mismatch`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/state_proxy_equality_mismatch`);\n\t}\n}\n\n/**\n * A `<svelte:boundary>` `reset` function only resets the boundary the first time it is called\n */\nexport function svelte_boundary_reset_noop() {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] svelte_boundary_reset_noop\\n%cA \\`<svelte:boundary>\\` \\`reset\\` function only resets the boundary the first time it is called\\nhttps://svelte.dev/e/svelte_boundary_reset_noop`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`);\n\t}\n}\n\n/**\n * The `slide` transition does not work correctly for elements with `display: %value%`\n * @param {string} value\n */\nexport function transition_slide_display(value) {\n\tif (DEV) {\n\t\tconsole.warn(`%c[svelte] transition_slide_display\\n%cThe \\`slide\\` transition does not work correctly for elements with \\`display: ${value}\\`\\nhttps://svelte.dev/e/transition_slide_display`, bold, normal);\n\t} else {\n\t\tconsole.warn(`https://svelte.dev/e/transition_slide_display`);\n\t}\n}","/** @import { TemplateNode } from '#client' */\n\nimport { COMMENT_NODE } from '#client/constants';\nimport {\n\tHYDRATION_END,\n\tHYDRATION_ERROR,\n\tHYDRATION_START,\n\tHYDRATION_START_ELSE,\n\tHYDRATION_START_FAILED\n} from '../../../constants.js';\nimport * as w from '../warnings.js';\nimport { get_next_sibling, get_node_value, node_type, remove_node } from './operations.js';\n\n/**\n * Use this variable to guard everything related to hydration code so it can be treeshaken out\n * if the user doesn't use the `hydrate` method and these code paths are therefore not needed.\n */\nexport let hydrating = false;\n\n/** @param {boolean} value */\nexport function set_hydrating(value) {\n\thydrating = value;\n}\n\n/**\n * The node that is currently being hydrated. This starts out as the first node inside the opening\n * <!--[--> comment, and updates each time a component calls `$.child(...)` or `$.sibling(...)`.\n * When entering a block (e.g. `{#if ...}`), `hydrate_node` is the block opening comment; by the\n * time we leave the block it is the closing comment, which serves as the block's anchor.\n * @type {TemplateNode}\n */\nexport let hydrate_node;\n\n/** @param {TemplateNode | null} node */\nexport function set_hydrate_node(node) {\n\tif (node === null) {\n\t\tw.hydration_mismatch();\n\t\tthrow HYDRATION_ERROR;\n\t}\n\n\treturn (hydrate_node = node);\n}\n\nexport function hydrate_next() {\n\treturn set_hydrate_node(get_next_sibling(hydrate_node));\n}\n\n/** @param {TemplateNode} node */\nexport function reset(node) {\n\tif (!hydrating) return;\n\n\t// If the node has remaining siblings, something has gone wrong\n\tif (get_next_sibling(hydrate_node) !== null) {\n\t\tw.hydration_mismatch();\n\t\tthrow HYDRATION_ERROR;\n\t}\n\n\thydrate_node = node;\n}\n\n/**\n * @param {HTMLTemplateElement} template\n */\nexport function hydrate_template(template) {\n\tif (hydrating) {\n\t\t// @ts-expect-error TemplateNode doesn't include DocumentFragment, but it's actually fine\n\t\thydrate_node = template.content;\n\t}\n}\n\nexport function next(count = 1) {\n\tif (hydrating) {\n\t\tvar i = count;\n\t\tvar node = hydrate_node;\n\n\t\twhile (i--) {\n\t\t\tnode = /** @type {TemplateNode} */ (get_next_sibling(node));\n\t\t}\n\n\t\thydrate_node = node;\n\t}\n}\n\n/**\n * Skips or removes (depending on {@link remove}) all nodes starting at `hydrate_node` up until the next hydration end comment\n * @param {boolean} remove\n */\nexport function skip_nodes(remove = true) {\n\tvar depth = 0;\n\tvar node = hydrate_node;\n\n\twhile (true) {\n\t\tif (node_type(node) === COMMENT_NODE) {\n\t\t\tvar data = get_node_value(node) ?? '';\n\n\t\t\tif (data === HYDRATION_END) {\n\t\t\t\tif (depth === 0) return node;\n\t\t\t\tdepth -= 1;\n\t\t\t} else if (\n\t\t\t\tdata === HYDRATION_START ||\n\t\t\t\tdata === HYDRATION_START_ELSE ||\n\t\t\t\t// \"[?\" followed by the serialized error, for failed boundaries\n\t\t\t\tdata.startsWith(HYDRATION_START_FAILED) ||\n\t\t\t\t// \"[1\", \"[2\", etc. for if blocks\n\t\t\t\t(data[0] === '[' && !isNaN(Number(data.slice(1))))\n\t\t\t) {\n\t\t\t\tdepth += 1;\n\t\t\t}\n\t\t}\n\n\t\tvar next = /** @type {TemplateNode} */ (get_next_sibling(node));\n\t\tif (remove) remove_node(node);\n\t\tnode = next;\n\t}\n}\n\n/**\n *\n * @param {TemplateNode} node\n */\nexport function read_hydration_instruction(node) {\n\tif (!node || node_type(node) !== COMMENT_NODE) {\n\t\tw.hydration_mismatch();\n\t\tthrow HYDRATION_ERROR;\n\t}\n\n\treturn get_node_value(node) ?? '';\n}\n","/** @import { Equals } from '#client' */\n\n/** @type {Equals} */\nexport function equals(value) {\n\treturn value === this.v;\n}\n\n/**\n * @param {unknown} a\n * @param {unknown} b\n * @returns {boolean}\n */\nexport function safe_not_equal(a, b) {\n\treturn a != a\n\t\t? b == b\n\t\t: a !== b || (a !== null && typeof a === 'object') || typeof a === 'function';\n}\n\n/** @type {Equals} */\nexport function safe_equals(value) {\n\treturn !safe_not_equal(value, this.v);\n}\n","/* This file is generated by scripts/process-messages/index.js. Do not edit! */\n\nimport { DEV } from 'esm-env';\n\n/**\n * You need to specify a custom condition to use a custom renderer in a non-browser environment such as Node. Add the `svelte-custom-renderer` resolve condition (eg. run Node with `--conditions=svelte-custom-renderer`).\n * \n * If you're using a bundler, add `svelte-custom-renderer` to its list of resolve conditions instead.\n * @returns {never}\n */\nexport function custom_renderer_unavailable_on_server() {\n\tif (DEV) {\n\t\tconst error = new Error(`custom_renderer_unavailable_on_server\\nYou need to specify a custom condition to use a custom renderer in a non-browser environment such as Node. Add the \\`svelte-custom-renderer\\` resolve condition (eg. run Node with \\`--conditions=svelte-custom-renderer\\`).\n\nIf you're using a bundler, add \\`svelte-custom-renderer\\` to its list of resolve conditions instead.\\nhttps://svelte.dev/e/custom_renderer_unavailable_on_server`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/custom_renderer_unavailable_on_server`);\n\t}\n}\n\n/**\n * Cannot use `%name%(...)` unless the `experimental.async` compiler option is `true`\n * @param {string} name\n * @returns {never}\n */\nexport function experimental_async_required(name) {\n\tif (DEV) {\n\t\tconst error = new Error(`experimental_async_required\\nCannot use \\`${name}(...)\\` unless the \\`experimental.async\\` compiler option is \\`true\\`\\nhttps://svelte.dev/e/experimental_async_required`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/experimental_async_required`);\n\t}\n}\n\n/**\n * Cannot use `{@render children(...)}` if the parent component uses `let:` directives. Consider using a named snippet instead\n * @returns {never}\n */\nexport function invalid_default_snippet() {\n\tif (DEV) {\n\t\tconst error = new Error(`invalid_default_snippet\\nCannot use \\`{@render children(...)}\\` if the parent component uses \\`let:\\` directives. Consider using a named snippet instead\\nhttps://svelte.dev/e/invalid_default_snippet`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/invalid_default_snippet`);\n\t}\n}\n\n/**\n * A snippet function was passed invalid arguments. Snippets should only be instantiated via `{@render ...}`\n * @returns {never}\n */\nexport function invalid_snippet_arguments() {\n\tif (DEV) {\n\t\tconst error = new Error(`invalid_snippet_arguments\\nA snippet function was passed invalid arguments. Snippets should only be instantiated via \\`{@render ...}\\`\\nhttps://svelte.dev/e/invalid_snippet_arguments`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/invalid_snippet_arguments`);\n\t}\n}\n\n/**\n * An invariant violation occurred, meaning Svelte's internal assumptions were flawed. This is a bug in Svelte, not your app — please open an issue at https://github.com/sveltejs/svelte, citing the following message: \"%message%\"\n * @param {string} message\n * @returns {never}\n */\nexport function invariant_violation(message) {\n\tif (DEV) {\n\t\tconst error = new Error(`invariant_violation\\nAn invariant violation occurred, meaning Svelte's internal assumptions were flawed. This is a bug in Svelte, not your app — please open an issue at https://github.com/sveltejs/svelte, citing the following message: \"${message}\"\\nhttps://svelte.dev/e/invariant_violation`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/invariant_violation`);\n\t}\n}\n\n/**\n * `%name%(...)` can only be used during component initialisation\n * @param {string} name\n * @returns {never}\n */\nexport function lifecycle_outside_component(name) {\n\tif (DEV) {\n\t\tconst error = new Error(`lifecycle_outside_component\\n\\`${name}(...)\\` can only be used during component initialisation\\nhttps://svelte.dev/e/lifecycle_outside_component`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/lifecycle_outside_component`);\n\t}\n}\n\n/**\n * Context was not set in the current component or any of its ancestors\n * @returns {never}\n */\nexport function missing_context() {\n\tif (DEV) {\n\t\tconst error = new Error(`missing_context\\nContext was not set in the current component or any of its ancestors\\nhttps://svelte.dev/e/missing_context`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/missing_context`);\n\t}\n}\n\n/**\n * `setContext` must be called when a component first initializes, not in a subsequent effect or after an `await` expression\n * @returns {never}\n */\nexport function set_context_after_init() {\n\tif (DEV) {\n\t\tconst error = new Error(`set_context_after_init\\n\\`setContext\\` must be called when a component first initializes, not in a subsequent effect or after an \\`await\\` expression\\nhttps://svelte.dev/e/set_context_after_init`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/set_context_after_init`);\n\t}\n}\n\n/**\n * Attempted to render a snippet without a `{@render}` block. This would cause the snippet code to be stringified instead of its content being rendered to the DOM. To fix this, change `{snippet}` to `{@render snippet()}`.\n * @returns {never}\n */\nexport function snippet_without_render_tag() {\n\tif (DEV) {\n\t\tconst error = new Error(`snippet_without_render_tag\\nAttempted to render a snippet without a \\`{@render}\\` block. This would cause the snippet code to be stringified instead of its content being rendered to the DOM. To fix this, change \\`{snippet}\\` to \\`{@render snippet()}\\`.\\nhttps://svelte.dev/e/snippet_without_render_tag`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/snippet_without_render_tag`);\n\t}\n}\n\n/**\n * `%name%` is not a store with a `subscribe` method\n * @param {string} name\n * @returns {never}\n */\nexport function store_invalid_shape(name) {\n\tif (DEV) {\n\t\tconst error = new Error(`store_invalid_shape\\n\\`${name}\\` is not a store with a \\`subscribe\\` method\\nhttps://svelte.dev/e/store_invalid_shape`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/store_invalid_shape`);\n\t}\n}\n\n/**\n * The `this` prop on `<svelte:element>` must be a string, if defined\n * @returns {never}\n */\nexport function svelte_element_invalid_this_value() {\n\tif (DEV) {\n\t\tconst error = new Error(`svelte_element_invalid_this_value\\nThe \\`this\\` prop on \\`<svelte:element>\\` must be a string, if defined\\nhttps://svelte.dev/e/svelte_element_invalid_this_value`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/svelte_element_invalid_this_value`);\n\t}\n}","/* This file is generated by scripts/process-messages/index.js. Do not edit! */\n\nimport { DEV } from 'esm-env';\n\nexport * from '../shared/errors.js';\n\n/**\n * Can only create a `$derived(...)` with an `await` expression during component initialization or in a declaration tag\n * @returns {never}\n */\nexport function async_derived_orphan() {\n\tif (DEV) {\n\t\tconst error = new Error(`async_derived_orphan\\nCan only create a \\`$derived(...)\\` with an \\`await\\` expression during component initialization or in a declaration tag\\nhttps://svelte.dev/e/async_derived_orphan`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/async_derived_orphan`);\n\t}\n}\n\n/**\n * Using `bind:value` together with a checkbox input is not allowed. Use `bind:checked` instead\n * @returns {never}\n */\nexport function bind_invalid_checkbox_value() {\n\tif (DEV) {\n\t\tconst error = new Error(`bind_invalid_checkbox_value\\nUsing \\`bind:value\\` together with a checkbox input is not allowed. Use \\`bind:checked\\` instead\\nhttps://svelte.dev/e/bind_invalid_checkbox_value`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/bind_invalid_checkbox_value`);\n\t}\n}\n\n/**\n * Component %component% has an export named `%key%` that a consumer component is trying to access using `bind:%key%`, which is disallowed. Instead, use `bind:this` (e.g. `<%name% bind:this={component} />`) and then access the property on the bound component instance (e.g. `component.%key%`)\n * @param {string} component\n * @param {string} key\n * @param {string} name\n * @returns {never}\n */\nexport function bind_invalid_export(component, key, name) {\n\tif (DEV) {\n\t\tconst error = new Error(`bind_invalid_export\\nComponent ${component} has an export named \\`${key}\\` that a consumer component is trying to access using \\`bind:${key}\\`, which is disallowed. Instead, use \\`bind:this\\` (e.g. \\`<${name} bind:this={component} />\\`) and then access the property on the bound component instance (e.g. \\`component.${key}\\`)\\nhttps://svelte.dev/e/bind_invalid_export`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/bind_invalid_export`);\n\t}\n}\n\n/**\n * A component is attempting to bind to a non-bindable property `%key%` belonging to %component% (i.e. `<%name% bind:%key%={...}>`). To mark a property as bindable: `let { %key% = $bindable() } = $props()`\n * @param {string} key\n * @param {string} component\n * @param {string} name\n * @returns {never}\n */\nexport function bind_not_bindable(key, component, name) {\n\tif (DEV) {\n\t\tconst error = new Error(`bind_not_bindable\\nA component is attempting to bind to a non-bindable property \\`${key}\\` belonging to ${component} (i.e. \\`<${name} bind:${key}={...}>\\`). To mark a property as bindable: \\`let { ${key} = $bindable() } = $props()\\`\\nhttps://svelte.dev/e/bind_not_bindable`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/bind_not_bindable`);\n\t}\n}\n\n/**\n * Calling `%method%` on a component instance (of %component%) is no longer valid in Svelte 5\n * @param {string} method\n * @param {string} component\n * @returns {never}\n */\nexport function component_api_changed(method, component) {\n\tif (DEV) {\n\t\tconst error = new Error(`component_api_changed\\nCalling \\`${method}\\` on a component instance (of ${component}) is no longer valid in Svelte 5\\nhttps://svelte.dev/e/component_api_changed`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/component_api_changed`);\n\t}\n}\n\n/**\n * Attempted to instantiate %component% with `new %name%`, which is no longer valid in Svelte 5. If this component is not under your control, set the `compatibility.componentApi` compiler option to `4` to keep it working.\n * @param {string} component\n * @param {string} name\n * @returns {never}\n */\nexport function component_api_invalid_new(component, name) {\n\tif (DEV) {\n\t\tconst error = new Error(`component_api_invalid_new\\nAttempted to instantiate ${component} with \\`new ${name}\\`, which is no longer valid in Svelte 5. If this component is not under your control, set the \\`compatibility.componentApi\\` compiler option to \\`4\\` to keep it working.\\nhttps://svelte.dev/e/component_api_invalid_new`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/component_api_invalid_new`);\n\t}\n}\n\n/**\n * `%operation%` is not supported when rendering with a custom renderer\n * @param {string} operation\n * @returns {never}\n */\nexport function custom_renderer_unsupported_operation(operation) {\n\tif (DEV) {\n\t\tconst error = new Error(`custom_renderer_unsupported_operation\\n\\`${operation}\\` is not supported when rendering with a custom renderer\\nhttps://svelte.dev/e/custom_renderer_unsupported_operation`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/custom_renderer_unsupported_operation`);\n\t}\n}\n\n/**\n * A derived value cannot reference itself recursively\n * @returns {never}\n */\nexport function derived_references_self() {\n\tif (DEV) {\n\t\tconst error = new Error(`derived_references_self\\nA derived value cannot reference itself recursively\\nhttps://svelte.dev/e/derived_references_self`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/derived_references_self`);\n\t}\n}\n\n/**\n * Keyed each block has duplicate key `%value%` at indexes %a% and %b%\n * @param {string} a\n * @param {string} b\n * @param {string | undefined | null} [value]\n * @returns {never}\n */\nexport function each_key_duplicate(a, b, value) {\n\tif (DEV) {\n\t\tconst error = new Error(`each_key_duplicate\\n${value\n\t\t\t? `Keyed each block has duplicate key \\`${value}\\` at indexes ${a} and ${b}`\n\t\t\t: `Keyed each block has duplicate key at indexes ${a} and ${b}`}\\nhttps://svelte.dev/e/each_key_duplicate`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/each_key_duplicate`);\n\t}\n}\n\n/**\n * Keyed each block has key that is not idempotent — the key for item at index %index% was `%a%` but is now `%b%`. Keys must be the same each time for a given item\n * @param {string} index\n * @param {string} a\n * @param {string} b\n * @returns {never}\n */\nexport function each_key_volatile(index, a, b) {\n\tif (DEV) {\n\t\tconst error = new Error(`each_key_volatile\\nKeyed each block has key that is not idempotent — the key for item at index ${index} was \\`${a}\\` but is now \\`${b}\\`. Keys must be the same each time for a given item\\nhttps://svelte.dev/e/each_key_volatile`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/each_key_volatile`);\n\t}\n}\n\n/**\n * `%rune%` cannot be used inside an effect cleanup function\n * @param {string} rune\n * @returns {never}\n */\nexport function effect_in_teardown(rune) {\n\tif (DEV) {\n\t\tconst error = new Error(`effect_in_teardown\\n\\`${rune}\\` cannot be used inside an effect cleanup function\\nhttps://svelte.dev/e/effect_in_teardown`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/effect_in_teardown`);\n\t}\n}\n\n/**\n * Effect cannot be created inside a `$derived` value that was not itself created inside an effect\n * @returns {never}\n */\nexport function effect_in_unowned_derived() {\n\tif (DEV) {\n\t\tconst error = new Error(`effect_in_unowned_derived\\nEffect cannot be created inside a \\`$derived\\` value that was not itself created inside an effect\\nhttps://svelte.dev/e/effect_in_unowned_derived`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/effect_in_unowned_derived`);\n\t}\n}\n\n/**\n * `%rune%` can only be used inside an effect (e.g. during component initialisation)\n * @param {string} rune\n * @returns {never}\n */\nexport function effect_orphan(rune) {\n\tif (DEV) {\n\t\tconst error = new Error(`effect_orphan\\n\\`${rune}\\` can only be used inside an effect (e.g. during component initialisation)\\nhttps://svelte.dev/e/effect_orphan`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/effect_orphan`);\n\t}\n}\n\n/**\n * `$effect.pending()` can only be called inside an effect or derived\n * @returns {never}\n */\nexport function effect_pending_outside_reaction() {\n\tif (DEV) {\n\t\tconst error = new Error(`effect_pending_outside_reaction\\n\\`$effect.pending()\\` can only be called inside an effect or derived\\nhttps://svelte.dev/e/effect_pending_outside_reaction`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/effect_pending_outside_reaction`);\n\t}\n}\n\n/**\n * Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state\n * @returns {never}\n */\nexport function effect_update_depth_exceeded() {\n\tif (DEV) {\n\t\tconst error = new Error(`effect_update_depth_exceeded\\nMaximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state\\nhttps://svelte.dev/e/effect_update_depth_exceeded`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/effect_update_depth_exceeded`);\n\t}\n}\n\n/**\n * Cannot use `flushSync` inside an effect\n * @returns {never}\n */\nexport function flush_sync_in_effect() {\n\tif (DEV) {\n\t\tconst error = new Error(`flush_sync_in_effect\\nCannot use \\`flushSync\\` inside an effect\\nhttps://svelte.dev/e/flush_sync_in_effect`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/flush_sync_in_effect`);\n\t}\n}\n\n/**\n * Cannot commit a fork that was already discarded\n * @returns {never}\n */\nexport function fork_discarded() {\n\tif (DEV) {\n\t\tconst error = new Error(`fork_discarded\\nCannot commit a fork that was already discarded\\nhttps://svelte.dev/e/fork_discarded`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/fork_discarded`);\n\t}\n}\n\n/**\n * Cannot create a fork inside an effect or when state changes are pending\n * @returns {never}\n */\nexport function fork_timing() {\n\tif (DEV) {\n\t\tconst error = new Error(`fork_timing\\nCannot create a fork inside an effect or when state changes are pending\\nhttps://svelte.dev/e/fork_timing`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/fork_timing`);\n\t}\n}\n\n/**\n * `getAbortSignal()` cannot be called after an `await`\n * @returns {never}\n */\nexport function get_abort_signal_after_await() {\n\tif (DEV) {\n\t\tconst error = new Error(`get_abort_signal_after_await\\n\\`getAbortSignal()\\` cannot be called after an \\`await\\`\\nhttps://svelte.dev/e/get_abort_signal_after_await`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/get_abort_signal_after_await`);\n\t}\n}\n\n/**\n * `getAbortSignal()` can only be called inside an effect or derived\n * @returns {never}\n */\nexport function get_abort_signal_outside_reaction() {\n\tif (DEV) {\n\t\tconst error = new Error(`get_abort_signal_outside_reaction\\n\\`getAbortSignal()\\` can only be called inside an effect or derived\\nhttps://svelte.dev/e/get_abort_signal_outside_reaction`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/get_abort_signal_outside_reaction`);\n\t}\n}\n\n/**\n * Expected to find a hydratable with key `%key%` during hydration, but did not.\n * @param {string} key\n * @returns {never}\n */\nexport function hydratable_missing_but_required(key) {\n\tif (DEV) {\n\t\tconst error = new Error(`hydratable_missing_but_required\\nExpected to find a hydratable with key \\`${key}\\` during hydration, but did not.\\nhttps://svelte.dev/e/hydratable_missing_but_required`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/hydratable_missing_but_required`);\n\t}\n}\n\n/**\n * Failed to hydrate the application\n * @returns {never}\n */\nexport function hydration_failed() {\n\tif (DEV) {\n\t\tconst error = new Error(`hydration_failed\\nFailed to hydrate the application\\nhttps://svelte.dev/e/hydration_failed`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/hydration_failed`);\n\t}\n}\n\n/**\n * Could not `{@render}` snippet due to the expression being `null` or `undefined`. Consider using optional chaining `{@render snippet?.()}`\n * @returns {never}\n */\nexport function invalid_snippet() {\n\tif (DEV) {\n\t\tconst error = new Error(`invalid_snippet\\nCould not \\`{@render}\\` snippet due to the expression being \\`null\\` or \\`undefined\\`. Consider using optional chaining \\`{@render snippet?.()}\\`\\nhttps://svelte.dev/e/invalid_snippet`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/invalid_snippet`);\n\t}\n}\n\n/**\n * `createRawSnippet` cannot be used with a custom renderer\n * @returns {never}\n */\nexport function invalid_snippet_in_custom_renderer() {\n\tif (DEV) {\n\t\tconst error = new Error(`invalid_snippet_in_custom_renderer\\n\\`createRawSnippet\\` cannot be used with a custom renderer\\nhttps://svelte.dev/e/invalid_snippet_in_custom_renderer`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/invalid_snippet_in_custom_renderer`);\n\t}\n}\n\n/**\n * `%name%(...)` cannot be used in runes mode\n * @param {string} name\n * @returns {never}\n */\nexport function lifecycle_legacy_only(name) {\n\tif (DEV) {\n\t\tconst error = new Error(`lifecycle_legacy_only\\n\\`${name}(...)\\` cannot be used in runes mode\\nhttps://svelte.dev/e/lifecycle_legacy_only`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/lifecycle_legacy_only`);\n\t}\n}\n\n/**\n * Cannot do `bind:%key%={undefined}` when `%key%` has a fallback value\n * @param {string} key\n * @returns {never}\n */\nexport function props_invalid_value(key) {\n\tif (DEV) {\n\t\tconst error = new Error(`props_invalid_value\\nCannot do \\`bind:${key}={undefined}\\` when \\`${key}\\` has a fallback value\\nhttps://svelte.dev/e/props_invalid_value`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/props_invalid_value`);\n\t}\n}\n\n/**\n * Rest element properties of `$props()` such as `%property%` are readonly\n * @param {string} property\n * @returns {never}\n */\nexport function props_rest_readonly(property) {\n\tif (DEV) {\n\t\tconst error = new Error(`props_rest_readonly\\nRest element properties of \\`$props()\\` such as \\`${property}\\` are readonly\\nhttps://svelte.dev/e/props_rest_readonly`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/props_rest_readonly`);\n\t}\n}\n\n/**\n * Cannot render content belonging to %guest% inside %host%. A custom renderer must define `embed` or `host` to be combined with another renderer\n * @param {string} guest\n * @param {string} host\n * @returns {never}\n */\nexport function renderer_cannot_cross(guest, host) {\n\tif (DEV) {\n\t\tconst error = new Error(`renderer_cannot_cross\\nCannot render content belonging to ${guest} inside ${host}. A custom renderer must define \\`embed\\` or \\`host\\` to be combined with another renderer\\nhttps://svelte.dev/e/renderer_cannot_cross`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/renderer_cannot_cross`);\n\t}\n}\n\n/**\n * The `%rune%` rune is only available inside `.svelte` and `.svelte.js/ts` files\n * @param {string} rune\n * @returns {never}\n */\nexport function rune_outside_svelte(rune) {\n\tif (DEV) {\n\t\tconst error = new Error(`rune_outside_svelte\\nThe \\`${rune}\\` rune is only available inside \\`.svelte\\` and \\`.svelte.js/ts\\` files\\nhttps://svelte.dev/e/rune_outside_svelte`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/rune_outside_svelte`);\n\t}\n}\n\n/**\n * A snippet created in a component that was compiled without `experimental.customRenderer` cannot be rendered by a custom renderer\n * @returns {never}\n */\nexport function snippet_renderer_mismatch() {\n\tif (DEV) {\n\t\tconst error = new Error(`snippet_renderer_mismatch\\nA snippet created in a component that was compiled without \\`experimental.customRenderer\\` cannot be rendered by a custom renderer\\nhttps://svelte.dev/e/snippet_renderer_mismatch`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/snippet_renderer_mismatch`);\n\t}\n}\n\n/**\n * Property descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.\n * @returns {never}\n */\nexport function state_descriptors_fixed() {\n\tif (DEV) {\n\t\tconst error = new Error(`state_descriptors_fixed\\nProperty descriptors defined on \\`$state\\` objects must contain \\`value\\` and always be \\`enumerable\\`, \\`configurable\\` and \\`writable\\`.\\nhttps://svelte.dev/e/state_descriptors_fixed`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/state_descriptors_fixed`);\n\t}\n}\n\n/**\n * Cannot set prototype of `$state` object\n * @returns {never}\n */\nexport function state_prototype_fixed() {\n\tif (DEV) {\n\t\tconst error = new Error(`state_prototype_fixed\\nCannot set prototype of \\`$state\\` object\\nhttps://svelte.dev/e/state_prototype_fixed`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/state_prototype_fixed`);\n\t}\n}\n\n/**\n * Updating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\n * @returns {never}\n */\nexport function state_unsafe_mutation() {\n\tif (DEV) {\n\t\tconst error = new Error(`state_unsafe_mutation\\nUpdating state inside \\`$derived(...)\\`, \\`$inspect(...)\\` or a template expression is forbidden. If the value should not be reactive, declare it without \\`$state\\`\\nhttps://svelte.dev/e/state_unsafe_mutation`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/state_unsafe_mutation`);\n\t}\n}\n\n/**\n * A `<svelte:boundary>` `reset` function cannot be called while an error is still being handled\n * @returns {never}\n */\nexport function svelte_boundary_reset_onerror() {\n\tif (DEV) {\n\t\tconst error = new Error(`svelte_boundary_reset_onerror\\nA \\`<svelte:boundary>\\` \\`reset\\` function cannot be called while an error is still being handled\\nhttps://svelte.dev/e/svelte_boundary_reset_onerror`);\n\n\t\terror.name = 'Svelte error';\n\n\t\tthrow error;\n\t} else {\n\t\tthrow new Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`);\n\t}\n}","/** @import { Snapshot } from './types' */\nimport { DEV } from 'esm-env';\nimport * as w from './warnings.js';\nimport { get_prototype_of, is_array, object_prototype } from './utils.js';\n\n/**\n * In dev, we keep track of which properties could not be cloned. In prod\n * we don't bother, but we keep a dummy array around so that the\n * signature stays the same\n * @type {string[]}\n */\nconst empty = [];\n\n/**\n * @template T\n * @param {T} value\n * @param {boolean} [skip_warning]\n * @param {boolean} [no_tojson]\n * @returns {Snapshot<T>}\n */\nexport function snapshot(value, skip_warning = false, no_tojson = false) {\n\tif (DEV && !skip_warning) {\n\t\t/** @type {string[]} */\n\t\tconst paths = [];\n\n\t\tconst copy = clone(value, new Map(), '', paths, null, no_tojson);\n\t\tif (paths.length === 1 && paths[0] === '') {\n\t\t\t// value could not be cloned\n\t\t\tw.state_snapshot_uncloneable();\n\t\t} else if (paths.length > 0) {\n\t\t\t// some properties could not be cloned\n\t\t\tconst slice = paths.length > 10 ? paths.slice(0, 7) : paths.slice(0, 10);\n\t\t\tconst excess = paths.length - slice.length;\n\n\t\t\tlet uncloned = slice.map((path) => `- <value>${path}`).join('\\n');\n\t\t\tif (excess > 0) uncloned += `\\n- ...and ${excess} more`;\n\n\t\t\tw.state_snapshot_uncloneable(uncloned);\n\t\t}\n\n\t\treturn copy;\n\t}\n\n\treturn clone(value, new Map(), '', empty, null, no_tojson);\n}\n\n/**\n * @template T\n * @param {T} value\n * @param {Map<T, Snapshot<T>>} cloned\n * @param {string} path\n * @param {string[]} paths\n * @param {null | T} [original] The original value, if `value` was produced from a `toJSON` call\n * @param {boolean} [no_tojson]\n * @returns {Snapshot<T>}\n */\nfunction clone(value, cloned, path, paths, original = null, no_tojson = false) {\n\tif (typeof value === 'object' && value !== null) {\n\t\tvar unwrapped = cloned.get(value);\n\t\tif (unwrapped !== undefined) return unwrapped;\n\n\t\tif (value instanceof Map) return /** @type {Snapshot<T>} */ (new Map(value));\n\t\tif (value instanceof Set) return /** @type {Snapshot<T>} */ (new Set(value));\n\n\t\tif (is_array(value)) {\n\t\t\tvar copy = /** @type {Snapshot<any>} */ (Array(value.length));\n\t\t\tcloned.set(value, copy);\n\n\t\t\tif (original !== null) {\n\t\t\t\tcloned.set(original, copy);\n\t\t\t}\n\n\t\t\tfor (var i = 0; i < value.length; i += 1) {\n\t\t\t\tvar element = value[i];\n\t\t\t\tif (i in value) {\n\t\t\t\t\tcopy[i] = clone(element, cloned, DEV ? `${path}[${i}]` : path, paths, null, no_tojson);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn copy;\n\t\t}\n\n\t\tif (get_prototype_of(value) === object_prototype) {\n\t\t\t/** @type {Snapshot<any>} */\n\t\t\tcopy = {};\n\t\t\tcloned.set(value, copy);\n\n\t\t\tif (original !== null) {\n\t\t\t\tcloned.set(original, copy);\n\t\t\t}\n\n\t\t\tfor (var key of Object.keys(value)) {\n\t\t\t\tcopy[key] = clone(\n\t\t\t\t\t// @ts-expect-error\n\t\t\t\t\tvalue[key],\n\t\t\t\t\tcloned,\n\t\t\t\t\tDEV ? `${path}.${key}` : path,\n\t\t\t\t\tpaths,\n\t\t\t\t\tnull,\n\t\t\t\t\tno_tojson\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn copy;\n\t\t}\n\n\t\tif (value instanceof Date) {\n\t\t\t// Ensure SvelteDate snapshots are tracked\n\t\t\tvalue.getTime();\n\t\t\treturn /** @type {Snapshot<T>} */ (structuredClone(value));\n\t\t}\n\n\t\tif (typeof (/** @type {T & { toJSON?: any } } */ (value).toJSON) === 'function' && !no_tojson) {\n\t\t\treturn clone(\n\t\t\t\t/** @type {T & { toJSON(): any } } */ (value).toJSON(),\n\t\t\t\tcloned,\n\t\t\t\tDEV ? `${path}.toJSON()` : path,\n\t\t\t\tpaths,\n\t\t\t\t// Associate the instance with the toJSON clone\n\t\t\t\tvalue\n\t\t\t);\n\t\t}\n\t}\n\n\tif (value instanceof EventTarget) {\n\t\t// can't be cloned\n\t\treturn /** @type {Snapshot<T>} */ (value);\n\t}\n\n\ttry {\n\t\treturn /** @type {Snapshot<T>} */ (structuredClone(value));\n\t} catch (e) {\n\t\tif (DEV) {\n\t\t\tpaths.push(path);\n\t\t}\n\n\t\treturn /** @type {Snapshot<T>} */ (value);\n\t}\n}\n","import { run_all } from '../../shared/utils.js';\nimport { is_flushing_sync } from '../reactivity/batch.js';\n\n/** @type {Array<() => void>} */\nlet micro_tasks = [];\n\nfunction run_micro_tasks() {\n\tvar tasks = micro_tasks;\n\tmicro_tasks = [];\n\trun_all(tasks);\n}\n\n/**\n * @param {() => void} fn\n */\nexport function queue_micro_task(fn) {\n\tif (micro_tasks.length === 0 && !is_flushing_sync) {\n\t\tvar tasks = micro_tasks;\n\t\tqueueMicrotask(() => {\n\t\t\t// If this is false, a flushSync happened in the meantime. Do _not_ run new scheduled microtasks in that case\n\t\t\t// as the ordering of microtasks would be broken at that point - consider this case:\n\t\t\t// - queue_micro_task schedules microtask A to flush task X\n\t\t\t// - synchronously after, flushSync runs, processing task X\n\t\t\t// - synchronously after, some other microtask B is scheduled, but not through queue_micro_task but for example a Promise.resolve() in user code\n\t\t\t// - synchronously after, queue_micro_task schedules microtask C to flush task Y\n\t\t\t// - one tick later, microtask A now resolves, flushing task Y before microtask B, which is incorrect\n\t\t\t// This if check prevents that race condition (that realistically will only happen in tests)\n\t\t\tif (tasks === micro_tasks) run_micro_tasks();\n\t\t});\n\t}\n\n\tmicro_tasks.push(fn);\n}\n\n/**\n * Synchronously run any queued tasks.\n */\nexport function flush_tasks() {\n\twhile (micro_tasks.length > 0) {\n\t\trun_micro_tasks();\n\t}\n}\n","/** @import { Derived, Signal } from '#client' */\nimport { CLEAN, CONNECTED, DIRTY, MAYBE_DIRTY } from '#client/constants';\n\nconst STATUS_MASK = ~(DIRTY | MAYBE_DIRTY | CLEAN);\n\n/**\n * @param {Signal} signal\n * @param {number} status\n */\nexport function set_signal_status(signal, status) {\n\tsignal.f = (signal.f & STATUS_MASK) | status;\n}\n\n/**\n * Set a derived's status to CLEAN or MAYBE_DIRTY based on its connection state.\n * @param {Derived} derived\n */\nexport function update_derived_status(derived) {\n\t// Only mark as MAYBE_DIRTY if disconnected and has dependencies.\n\tif ((derived.f & CONNECTED) !== 0 || derived.edges === null) {\n\t\tset_signal_status(derived, CLEAN);\n\t} else {\n\t\tset_signal_status(derived, MAYBE_DIRTY);\n\t}\n}\n","import { DEV } from 'esm-env';\nimport { define_property } from './utils.js';\nimport * as e from './errors.js';\n\n/**\n * @param {string} label\n * @returns {Error & { stack: string } | null}\n */\nexport function get_error(label) {\n\tconst error = new Error();\n\tconst stack = get_stack();\n\n\tif (stack.length === 0) {\n\t\treturn null;\n\t}\n\n\tstack.unshift('\\n');\n\n\tdefine_property(error, 'stack', {\n\t\tvalue: stack.join('\\n')\n\t});\n\n\tdefine_property(error, 'name', {\n\t\tvalue: label\n\t});\n\n\treturn /** @type {Error & { stack: string }} */ (error);\n}\n\n/**\n * @returns {string[]}\n */\nexport function get_stack() {\n\t// @ts-ignore - doesn't exist everywhere\n\tconst limit = Error.stackTraceLimit;\n\t// @ts-ignore - doesn't exist everywhere\n\tError.stackTraceLimit = Infinity;\n\tconst stack = new Error().stack;\n\t// @ts-ignore - doesn't exist everywhere\n\tError.stackTraceLimit = limit;\n\n\tif (!stack) return [];\n\n\tconst lines = stack.split('\\n');\n\tconst new_lines = [];\n\n\tfor (let i = 0; i < lines.length; i++) {\n\t\tconst line = lines[i];\n\t\tconst posixified = line.replaceAll('\\\\', '/');\n\n\t\tif (line.trim() === 'Error') {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (line.includes('validate_each_keys')) {\n\t\t\treturn [];\n\t\t}\n\n\t\tif (posixified.includes('svelte/src/internal') || posixified.includes('node_modules/.vite')) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tnew_lines.push(line);\n\t}\n\n\treturn new_lines;\n}\n\n/**\n * @param {boolean} condition\n * @param {string} message\n */\nexport function invariant(condition, message) {\n\tif (!DEV) {\n\t\tthrow new Error('invariant(...) was not guarded by if (DEV)');\n\t}\n\n\tif (!condition) e.invariant_violation(message);\n}\n","import { lifecycle_outside_component, missing_context } from './errors.js';\n\n/**\n * @template T\n * @param {(key: object) => T} get_context\n * @param {(key: object, context: T) => T} set_context\n * @param {(key: object) => boolean} has_context\n * @returns {[() => T, (context: T) => T, () => boolean]}\n */\nexport function create_context(get_context, set_context, has_context) {\n\tconst key = {};\n\n\treturn [\n\t\t() => {\n\t\t\tif (!has_context(key)) {\n\t\t\t\tmissing_context();\n\t\t\t}\n\n\t\t\treturn get_context(key);\n\t\t},\n\t\t(context) => set_context(key, context),\n\t\t() => has_context(key)\n\t];\n}\n\n/**\n * @typedef {{ p: Context | null, c: Map<unknown, unknown> | null }} Context\n */\n\n/**\n * @param {Context} context\n * @returns {Map<unknown, unknown> | null}\n */\nfunction get_parent_context(context) {\n\tlet parent = context.p;\n\twhile (parent !== null && parent.c === null) {\n\t\tparent = parent.p;\n\t}\n\treturn parent?.c ?? null;\n}\n\n/**\n * @param {Context | null} context\n * @param {string} name\n * @returns {Map<unknown, unknown>}\n */\nexport function get_or_init_context_map(context, name) {\n\tif (context === null) {\n\t\tlifecycle_outside_component(name);\n\t}\n\n\treturn (context.c ??= new Map(get_parent_context(context) || undefined));\n}\n","/** @import { ComponentContext, DevStackEntry, Effect } from '#client' */\nimport { DEV } from 'esm-env';\nimport * as e from './errors.js';\nimport { active_effect, active_reaction } from './runtime.js';\nimport { create_user_effect } from './reactivity/effects.js';\nimport { async_mode_flag, legacy_mode_flag } from '../flags/index.js';\nimport { FILENAME } from '../../constants.js';\nimport { BRANCH_EFFECT, COMPONENT_SYMBOL } from './constants.js';\nimport { define_property } from '../shared/utils.js';\nimport { create_context, get_or_init_context_map } from '../shared/context.js';\n\n/** @type {ComponentContext | null} */\nexport let component_context = null;\n\n/** @param {ComponentContext | null} context */\nexport function set_component_context(context) {\n\tcomponent_context = context;\n}\n\n/** @type {DevStackEntry | null} */\nexport let dev_stack = null;\n\n/** @param {DevStackEntry | null} stack */\nexport function set_dev_stack(stack) {\n\tdev_stack = stack;\n}\n\n/**\n * Execute a callback with a new dev stack entry\n * @param {() => any} callback - Function to execute\n * @param {DevStackEntry['type']} type - Type of block/component\n * @param {any} component - Component function\n * @param {number} line - Line number\n * @param {number} column - Column number\n * @param {Record<string, any>} [additional] - Any additional properties to add to the dev stack entry\n * @returns {any}\n */\nexport function add_svelte_meta(callback, type, component, line, column, additional) {\n\tconst parent = dev_stack;\n\n\tdev_stack = {\n\t\ttype,\n\t\tfile: component[FILENAME],\n\t\tline,\n\t\tcolumn,\n\t\tparent,\n\t\t...additional\n\t};\n\n\ttry {\n\t\treturn callback();\n\t} finally {\n\t\tdev_stack = parent;\n\t}\n}\n\n/**\n * The current component function. Different from current component context:\n * ```html\n * <!-- App.svelte -->\n * <Foo>\n * <Bar /> <!-- context == Foo.svelte, function == App.svelte -->\n * </Foo>\n * ```\n * @type {ComponentContext['function']}\n */\nexport let dev_current_component_function = null;\n\n/** @param {ComponentContext['function']} fn */\nexport function set_dev_current_component_function(fn) {\n\tdev_current_component_function = fn;\n}\n\n/**\n * Returns a `[get, set, has]` triplet of functions for working with context in a type-safe way.\n *\n * `get` will throw an error if `set` has not yet been called in the current component or any of\n * its ancestors.\n *\n * @template T\n * @returns {[() => T, (context: T) => T, () => boolean]}\n * @since 5.40.0\n */\nexport function createContext() {\n\treturn /** @type {[() => T, (context: T) => T, () => boolean]} */ (\n\t\tcreate_context(getContext, setContext, hasContext)\n\t);\n}\n\n/**\n * Retrieves the context set with the specified `key` in the current component or any of its\n * ancestors. If multiple components set the same key, the value from the closest one is returned.\n * A `setContext` call in the current component is only visible to `getContext` calls that run after it.\n * Must be called during component initialisation.\n *\n * [`createContext`](https://svelte.dev/docs/svelte/svelte#createContext) is a type-safe alternative.\n *\n * @template T\n * @param {any} key\n * @returns {T}\n */\nexport function getContext(key) {\n\tconst context_map = get_or_init_context_map(component_context, 'getContext');\n\tconst result = /** @type {T} */ (context_map.get(key));\n\treturn result;\n}\n\n/**\n * Associates an arbitrary `context` object with the current component and the specified `key`\n * and returns that object. The context is then available to the component itself and all of its\n * descendants (including slotted content) with `getContext`.\n *\n * Like lifecycle functions, this must be called during component initialisation.\n *\n * [`createContext`](https://svelte.dev/docs/svelte/svelte#createContext) is a type-safe alternative.\n *\n * @template T\n * @param {any} key\n * @param {T} context\n * @returns {T}\n */\nexport function setContext(key, context) {\n\tconst context_map = get_or_init_context_map(component_context, 'setContext');\n\n\tif (async_mode_flag) {\n\t\tvar flags = /** @type {Effect} */ (active_effect).f;\n\t\tvar valid =\n\t\t\t!active_reaction &&\n\t\t\t(flags & BRANCH_EFFECT) !== 0 &&\n\t\t\t// pop() runs synchronously, so this indicates we're setting context after an await\n\t\t\t!(/** @type {ComponentContext} */ (component_context).i);\n\n\t\tif (!valid) {\n\t\t\te.set_context_after_init();\n\t\t}\n\t}\n\n\tcontext_map.set(key, context);\n\treturn context;\n}\n\n/**\n * Checks whether a given `key` has been set in the context of the current component or any of\n * its ancestors. Must be called during component initialisation.\n *\n * @param {any} key\n * @returns {boolean}\n */\nexport function hasContext(key) {\n\tconst context_map = get_or_init_context_map(component_context, 'hasContext');\n\treturn context_map.has(key);\n}\n\n/**\n * Retrieves the whole context map that belongs to the current component, including entries\n * inherited from its ancestors. Must be called during component initialisation. Useful, for\n * example, if you programmatically create a component and want to pass the existing context to it.\n *\n * @template {Map<any, any>} [T=Map<any, any>]\n * @returns {T}\n */\nexport function getAllContexts() {\n\tconst context_map = get_or_init_context_map(component_context, 'getAllContexts');\n\treturn /** @type {T} */ (context_map);\n}\n\n/**\n * @param {Record<string, unknown>} props\n * @param {any} runes\n * @param {Function} [fn]\n * @returns {void}\n */\nexport function push(props, runes = false, fn) {\n\tcomponent_context = {\n\t\tp: component_context,\n\t\ti: false,\n\t\tc: null,\n\t\te: null,\n\t\ts: props,\n\t\tx: null,\n\t\tr: /** @type {Effect} */ (active_effect),\n\t\tl: legacy_mode_flag && !runes ? { s: null, u: null, $: [] } : null\n\t};\n\n\tif (DEV) {\n\t\t// component function\n\t\tcomponent_context.function = fn;\n\t\tdev_current_component_function = fn;\n\t}\n}\n\n/**\n * @template {Record<string, any>} T\n * @param {T} [component]\n * @returns {T}\n */\nexport function pop(component) {\n\tvar context = /** @type {ComponentContext} */ (component_context);\n\tvar effects = context.e;\n\n\tif (effects !== null) {\n\t\tcontext.e = null;\n\n\t\tfor (var fn of effects) {\n\t\t\tcreate_user_effect(fn);\n\t\t}\n\t}\n\n\tif (component !== undefined) {\n\t\tcontext.x = component;\n\t}\n\n\tcontext.i = true;\n\n\tcomponent_context = context.p;\n\n\tif (DEV) {\n\t\tdev_current_component_function = component_context?.function ?? null;\n\t}\n\n\treturn mark_as_component(component);\n}\n\n/**\n * Add a symbol to the object (or create one if undefined) to mark it as a component so it isn't proxified.\n * @param {any} component\n */\nexport function mark_as_component(component = {}) {\n\tdefine_property(component, COMPONENT_SYMBOL, { value: true });\n\treturn component;\n}\n\n/** @returns {boolean} */\nexport function is_runes() {\n\treturn !legacy_mode_flag || (component_context !== null && component_context.l === null);\n}\n","/** @import { Renderer } from './types.js'; */\n\nimport { hydrating, set_hydrating } from '../dom/hydration.js';\n\n/**\n * @type {Renderer<any> | null}\n */\nexport let current_renderer = null;\n\n/**\n * @param {Renderer<any> | null} value\n */\nexport function set_renderer(value) {\n\tcurrent_renderer = value;\n}\n\n/** How many `push_renderer` calls haven't been matched by a `pop_renderer` yet */\nvar depth = 0;\n\n/** @type {number[]} Depths of pushes that suspended hydration, including nested hydrate calls */\nvar suspended_hydration_at = [];\n\n/**\n * Makes `value` the current renderer (`null` for the DOM), returning the previous one.\n * Every call must be matched by a call to `pop_renderer` with the returned value\n * (in a `finally` block, if anything in between can throw).\n *\n * Custom renderers never hydrate, so hydration is suspended while one is active.\n * This doesn't allocate, since it runs for every effect when custom renderers are used.\n * @param {Renderer<any> | null} value\n * @returns {Renderer<any> | null}\n */\nexport function push_renderer(value) {\n\tvar previous = current_renderer;\n\tcurrent_renderer = value;\n\tdepth += 1;\n\n\t// this is to allow hydration code to treeshake\n\tif (hydrating && value !== null) {\n\t\tset_hydrating(false);\n\t\tsuspended_hydration_at.push(depth);\n\t}\n\n\treturn previous;\n}\n\n/**\n * Restores the renderer that was current before the matching `push_renderer` call\n * @param {Renderer<any> | null} previous The value returned by `push_renderer`\n */\nexport function pop_renderer(previous) {\n\tif (suspended_hydration_at[suspended_hydration_at.length - 1] === depth) {\n\t\tsuspended_hydration_at.pop();\n\t\tset_hydrating(true);\n\t}\n\n\tdepth -= 1;\n\tcurrent_renderer = previous;\n}\n","/** @import { Effect, Source, Value } from '#client' */\n/** @import { Batch } from './batch.js' */\nimport { DESTROYED, EFFECT_TRANSPARENT, STALE_REACTION } from '#client/constants';\nimport { DEV } from 'esm-env';\nimport {\n\tcomponent_context,\n\tdev_stack,\n\tis_runes,\n\tset_component_context,\n\tset_dev_stack\n} from '../context.js';\nimport { current_renderer, set_renderer } from '../custom-renderer/state.js';\nimport { custom_renderers_flag } from '../../flags/index.js';\nimport { invoke_error_boundary } from '../error-handling.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tget,\n\tset_active_effect,\n\tset_active_reaction\n} from '../runtime.js';\nimport { current_batch } from './batch.js';\nimport {\n\treactivity_loss_tracker,\n\tderived,\n\tderived_safe_equal,\n\tset_reactivity_loss_tracker,\n\tasync_expression,\n\tis_uninitialized\n} from './deriveds.js';\nimport { async_effect, block, branch } from './effects.js';\n\n/**\n * @param {Blocker[]} blockers\n * @param {Array<() => any>} sync\n * @param {Array<() => Promise<any>>} async\n * @param {(values: Value[]) => any} fn\n */\nexport function flatten(blockers, sync, async, fn) {\n\tvar parent = /** @type {Effect} */ (active_effect);\n\tvar deriveds = sync.map(is_runes() ? derived : derived_safe_equal);\n\n\tif (DEV) {\n\t\tderiveds.forEach((d, i) => {\n\t\t\t// TODO this is kinda useful for debugging but a lousy implementation —\n\t\t\t// maybe the compiler could pass through the template string\n\t\t\td.label = sync[i]\n\t\t\t\t.toString()\n\t\t\t\t.replace('() => ', '')\n\t\t\t\t.replaceAll('$.eager(() => ', '$state.eager(')\n\t\t\t\t.replace(/\\$\\.get\\((.+?)\\)/g, (_, id) => id);\n\t\t});\n\t}\n\n\t// Filter out already-settled blockers - no need to wait for them\n\tvar pending = blockers.filter((b) => !b.settled);\n\n\tif (pending.length > 0) {\n\t\tvar restore = capture();\n\t\tvar decrement_pending = increment_pending();\n\t\tvar p = pending.length === 1 ? pending[0].promise : Promise.all(pending.map((b) => b.promise));\n\n\t\tp.then(() => {\n\t\t\tif ((parent.f & DESTROYED) !== 0) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Keep the caller's context, but use the script's batch to read its first values.\n\t\t\trestore(pending[0].run.get_batch());\n\n\t\t\ttry {\n\t\t\t\trun();\n\t\t\t} catch (error) {\n\t\t\t\tinvoke_error_boundary(error, parent);\n\t\t\t}\n\n\t\t\tunset_context();\n\t\t}).finally(decrement_pending);\n\t} else {\n\t\trun();\n\t}\n\n\tfunction run() {\n\t\tif (blockers.some((b) => b.failed)) return;\n\n\t\tif (async.length === 0) {\n\t\t\tfn(deriveds);\n\t\t\treturn;\n\t\t}\n\n\t\tvar signals = async.map((fn) => async_expression(fn));\n\n\t\t/** @type {Effect | null} */\n\t\tvar effect = null;\n\n\t\tblock(() => {\n\t\t\tfor (var s of signals) {\n\t\t\t\tif (is_uninitialized(s)) {\n\t\t\t\t\tget(s);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (effect !== null) {\n\t\t\t\t/** @type {Batch} */ (current_batch).revalidate_branch(effect);\n\t\t\t} else {\n\t\t\t\teffect = branch(() => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tfn([...deriveds, ...signals]);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tinvoke_error_boundary(error, parent);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}, EFFECT_TRANSPARENT);\n\t}\n}\n\n/**\n * @param {Blocker[]} blockers\n * @param {(values: Value[]) => any} fn\n */\nexport function run_after_blockers(blockers, fn) {\n\tflatten(blockers, [], [], fn);\n}\n\n/**\n * Captures the current effect context so that we can restore it after\n * some asynchronous work has happened (so that e.g. `await a + b`\n * causes `b` to be registered as a dependency).\n */\nexport function capture() {\n\tvar previous_effect = /** @type {Effect} */ (active_effect);\n\tvar previous_reaction = active_reaction;\n\tvar previous_component_context = component_context;\n\tvar previous_batch = /** @type {Batch} */ (current_batch);\n\tvar previous_renderer = custom_renderers_flag ? current_renderer : null;\n\n\tif (DEV) {\n\t\tvar previous_dev_stack = dev_stack;\n\t}\n\n\t/**\n\t * @param {Batch | null} [batch] the batch to continue in, if not the one that was active before\n\t */\n\treturn function restore(batch = previous_batch) {\n\t\tset_active_effect(previous_effect);\n\t\tset_active_reaction(previous_reaction);\n\t\tset_component_context(previous_component_context);\n\n\t\tif (custom_renderers_flag) {\n\t\t\tset_renderer(previous_renderer);\n\t\t}\n\n\t\tif (batch !== null && (previous_effect.f & DESTROYED) === 0) {\n\t\t\t// A batch that was merged into another one continues as that one.\n\t\t\t// TODO we only need the check here because `{#await ...}` blocks\n\t\t\t// are anomalous. Once we retire them we can get rid of it\n\t\t\tmerge_target(batch).activate();\n\t\t}\n\n\t\tif (DEV) {\n\t\t\tset_reactivity_loss_tracker(null);\n\t\t\tset_dev_stack(previous_dev_stack);\n\t\t}\n\t};\n}\n\n/** `true` between a `save` thunk restoring a context and the end of that synchronous segment */\nvar restored = false;\n\n/**\n * Wraps an `await` expression in such a way that the effect context that was\n * active before the expression evaluated can be reapplied afterwards —\n * `await a + b` becomes `(await $.save(a))() + b`\n * @template T\n * @param {Promise<T>} promise\n * @returns {Promise<() => T>}\n */\nexport async function save(promise) {\n\tvar restore = capture();\n\t// the context restored by an earlier `save` in this expression must not\n\t// outlive the synchronous segment that is about to end at this `await`\n\tunsave();\n\tvar value = await promise;\n\n\treturn () => {\n\t\trestore();\n\t\trestored = true;\n\t\treturn value;\n\t};\n}\n\n/**\n * Unset the context if a `save` thunk restored it in the current synchronous segment,\n * so that a foreign microtask can never run inside a restored reaction context.\n * Called at every suspension point, and at the end of async expression bodies —\n * `async () => (await $.save(a))().b` becomes `async () => { try { return (await $.save(a))().b; } finally { $.unsave(); } }`\n * @template T\n * @param {T} [value]\n * @returns {T}\n */\nexport function unsave(value) {\n\tif (restored) unset_context();\n\treturn /** @type {T} */ (value);\n}\n\n/**\n * Reset `current_async_effect` after the `promise` resolves, so\n * that we can emit `await_reactivity_loss` warnings\n * @template T\n * @param {Promise<T>} promise\n * @returns {Promise<() => T>}\n */\nexport async function track_reactivity_loss(promise) {\n\tunsave();\n\tvar previous_reactivity_loss_tracker = reactivity_loss_tracker;\n\t// Ensure that unrelated reads after an async operation is kicked off don't cause false positives\n\tqueueMicrotask(() => {\n\t\tif (reactivity_loss_tracker === previous_reactivity_loss_tracker) {\n\t\t\tset_reactivity_loss_tracker(null);\n\t\t}\n\t});\n\n\tvar value = await promise;\n\n\treturn () => {\n\t\tset_reactivity_loss_tracker(previous_reactivity_loss_tracker);\n\t\t// While this can result in false negatives it also guards against the more important\n\t\t// false positives that would occur if this is the last in a chain of async operations,\n\t\t// and the reactivity_loss_tracker would then stay around until the next async operation happens.\n\t\tqueueMicrotask(() => {\n\t\t\tif (reactivity_loss_tracker === previous_reactivity_loss_tracker) {\n\t\t\t\tset_reactivity_loss_tracker(null);\n\t\t\t}\n\t\t});\n\n\t\treturn value;\n\t};\n}\n\n/**\n * Used in `for await` loops in DEV, so\n * that we can emit `await_reactivity_loss` warnings\n * after each `async_iterator` result resolves and\n * after the `async_iterator` return resolves (if it runs)\n * @template T\n * @template TReturn\n * @param {Iterable<T> | AsyncIterable<T>} iterable\n * @returns {AsyncGenerator<T, TReturn | undefined>}\n */\nexport async function* for_await_track_reactivity_loss(iterable) {\n\t// This is based on the algorithms described in ECMA-262:\n\t// ForIn/OfBodyEvaluation\n\t// https://tc39.es/ecma262/multipage/ecmascript-language-statements-and-declarations.html#sec-runtime-semantics-forin-div-ofbodyevaluation-lhs-stmt-iterator-lhskind-labelset\n\t// AsyncIteratorClose\n\t// https://tc39.es/ecma262/multipage/abstract-operations.html#sec-asynciteratorclose\n\n\t/** @type {AsyncIterator<T, TReturn>} */\n\t// @ts-ignore\n\tconst iterator = iterable[Symbol.asyncIterator]?.() ?? iterable[Symbol.iterator]?.();\n\n\tif (iterator === undefined) {\n\t\tthrow new TypeError('value is not async iterable');\n\t}\n\n\t// eslint-disable-next-line no-useless-assignment\n\tlet invoke_return = true;\n\n\ttry {\n\t\twhile (true) {\n\t\t\tconst { done, value } = (await track_reactivity_loss(iterator.next()))();\n\t\t\tif (done) {\n\t\t\t\tinvoke_return = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tvar prev = reactivity_loss_tracker;\n\t\t\ttry {\n\t\t\t\tyield value;\n\t\t\t} catch (e) {\n\t\t\t\tset_reactivity_loss_tracker(prev);\n\t\t\t\t// If the yield throws, we need to call `return` but not return its value, instead rethrow\n\t\t\t\tif (iterator.return !== undefined) {\n\t\t\t\t\t(await track_reactivity_loss(iterator.return()))();\n\t\t\t\t}\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t\tset_reactivity_loss_tracker(prev);\n\t\t}\n\t} catch (error) {\n\t\tinvoke_return = false;\n\t\tthrow error;\n\t} finally {\n\t\t// If the iterator had an abrupt completion (break) and `return` is defined on the iterator, call it and return the value\n\t\tif (invoke_return && iterator.return !== undefined) {\n\t\t\t// eslint-disable-next-line no-unsafe-finally\n\t\t\treturn /** @type {TReturn} */ ((await track_reactivity_loss(iterator.return()))().value);\n\t\t}\n\t}\n}\n\nexport function unset_context(deactivate_batch = true) {\n\trestored = false;\n\tset_active_effect(null);\n\tset_active_reaction(null);\n\tset_component_context(null);\n\tif (custom_renderers_flag) {\n\t\tset_renderer(null);\n\t}\n\tif (deactivate_batch) current_batch?.deactivate();\n\n\tif (DEV) {\n\t\tset_reactivity_loss_tracker(null);\n\t\tset_dev_stack(null);\n\t}\n}\n\n/**\n * The script's state while a `run` step executes.\n * Async expressions set `batch` when they deliver their first value. `continued` holds callbacks\n * to run after the script resumes, and `signals` lists the expressions in creation order.\n * @type {Runner | null}\n */\nexport let current_runner = null;\n\nclass Runner {\n\t/** @type {ReturnType<typeof capture>} */\n\t#restore;\n\n\t/**\n\t * Other batches that share this run\n\t * @type {Set<Batch>}\n\t */\n\t#adopters = new Set();\n\n\t/** @type {Batch} */\n\t#batch;\n\n\t/** @type {Array<() => void>} */\n\tcontinued = [];\n\n\t/**\n\t * Async deriveds created during this run\n\t * @type {Source[]}\n\t */\n\tsignals = [];\n\n\t/** Whether the full initialization promise chain is still pending. */\n\trunning = true;\n\n\tconstructor() {\n\t\t// TODO this should be unnecessary! these should just be class initializers. but\n\t\t// something somewhere (vitest?) must be doing some transpilation that breaks classes\n\t\tthis.#batch = /** @type {Batch} */ (current_batch);\n\t\tthis.#restore = capture();\n\t}\n\n\t/** The batch to continue in, even if the original fork was discarded. */\n\tget_batch() {\n\t\tif (!merge_target(this.#batch).linked) {\n\t\t\tfor (const b of this.#adopters) {\n\t\t\t\tvar target = merge_target(b);\n\t\t\t\tif (target.linked) this.#batch = target;\n\t\t\t}\n\t\t}\n\n\t\treturn this.#batch;\n\t}\n\n\trestore() {\n\t\tthis.#restore(this.get_batch());\n\t}\n\n\t/**\n\t *\n\t * @param {Array<() => void | Promise<void>>} thunks\n\t */\n\trun(thunks) {\n\t\tvar active = /** @type {Effect} */ (active_effect);\n\n\t\tvar promise = Promise.resolve(this.#invoke(thunks[0]));\n\t\tvar blockers = [new Blocker(this, promise)];\n\n\t\tfor (const fn of thunks.slice(1)) {\n\t\t\tpromise = promise.then(() => {\n\t\t\t\tif ((active.f & DESTROYED) !== 0) {\n\t\t\t\t\tthrow STALE_REACTION;\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tthis.restore();\n\t\t\t\t\treturn this.#invoke(fn);\n\t\t\t\t} finally {\n\t\t\t\t\t// We gotta unset context directly in case the function returns a promise, in which case\n\t\t\t\t\t// unset_context in .finally() would be too late\n\t\t\t\t\tunset_context();\n\t\t\t\t\t// Release buffered results now that the script has used the previous step's first values.\n\t\t\t\t\tthis.#continue();\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tblockers.push(new Blocker(this, promise));\n\t\t}\n\n\t\tpromise = promise\n\t\t\t.catch((error) => {\n\t\t\t\tif ((active.f & DESTROYED) === 0) {\n\t\t\t\t\tthis.restore();\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tinvoke_error_boundary(error, active);\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tunset_context();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\t\t\t// The last step has no following step to release its buffered results.\n\t\t\t.finally(() => this.#continue());\n\n\t\tasync_effect(() => {\n\t\t\t// Inside an effect so later adopting branches can rerun this\n\t\t\tvar batch = /** @type {Batch} */ (current_batch);\n\t\t\tthis.#adopters.add(batch);\n\t\t\tvar decrement_pending = increment_pending();\n\n\t\t\tpromise.finally(() => {\n\t\t\t\t// An adopting batch must also run effects created after it adopted the script's branch.\n\t\t\t\tvar target = merge_target(batch);\n\n\t\t\t\tif (target.linked && (active.f & DESTROYED) === 0) {\n\t\t\t\t\ttarget.revalidate_branch(active);\n\t\t\t\t}\n\n\t\t\t\tdecrement_pending();\n\n\t\t\t\tthis.running = false;\n\t\t\t});\n\t\t});\n\n\t\treturn blockers;\n\t}\n\n\t/**\n\t * Switch away from the previous batch (which is now obsolete)\n\t * to another one\n\t * @param {Batch} batch\n\t */\n\tswitch(batch) {\n\t\tthis.#batch = batch;\n\t}\n\n\t#continue() {\n\t\tfor (const fn of this.continued.splice(0)) fn();\n\t}\n\n\t/**\n\t * @param {() => void | Promise<void>} fn\n\t */\n\t#invoke(fn) {\n\t\tvar previous_runner = current_runner;\n\t\tcurrent_runner = this;\n\n\t\ttry {\n\t\t\treturn fn();\n\t\t} finally {\n\t\t\tcurrent_runner = previous_runner;\n\t\t}\n\t}\n}\n\nexport class Blocker {\n\tsettled = false;\n\tfailed = false;\n\n\t/**\n\t * @param {Runner} run\n\t * @param {Promise<any>} promise\n\t */\n\tconstructor(run, promise) {\n\t\tthis.run = run;\n\t\tthis.promise = promise\n\t\t\t.catch(() => {\n\t\t\t\tthis.failed = true;\n\t\t\t})\n\t\t\t.finally(() => {\n\t\t\t\tthis.settled = true;\n\t\t\t\tunset_context();\n\t\t\t});\n\t}\n}\n\n/**\n * @param {Array<() => void | Promise<void>>} thunks\n */\nexport function run(thunks) {\n\treturn new Runner().run(thunks);\n}\n\n/**\n * @param {Blocker[]} blockers\n */\nexport function wait(blockers) {\n\treturn Promise.all(blockers.map((b) => b.promise));\n}\n\n/**\n * Adds pending work to the current batch, and to the boundary of the active effect. If the batch is merged\n * into another one before the work is done, it's that batch's from then on (see `Batch#merge`)\n * @returns {() => void}\n */\nexport function increment_pending() {\n\tvar effect = /** @type {Effect} */ (active_effect);\n\tvar boundary = effect.b; // undefined if called outside the render tree, e.g. a standalone $effect.root\n\tvar batch = merge_target(/** @type {Batch} */ (current_batch));\n\n\t/** The nearest boundary with a pending snippet, if there is one */\n\tvar pending = boundary;\n\n\twhile (pending && !pending.is_pending) {\n\t\tpending = pending.parent;\n\t}\n\n\tbatch.increment(effect);\n\tpending?.increment(effect, batch);\n\tboundary?.update_effect_pending(1);\n\n\treturn () => {\n\t\tmerge_target(batch).decrement(effect);\n\t\t// The boundary keeps counts under the originating batch, even if it was merged.\n\t\tpending?.decrement(effect, batch);\n\t\tboundary?.update_effect_pending(-1);\n\t};\n}\n\n/**\n * The batch that `batch` was merged into, if any (transitively), else `batch` itself\n * @param {Batch} batch\n */\nexport function merge_target(batch) {\n\twhile (batch.merged !== null) batch = batch.merged;\n\treturn batch;\n}\n","/** @import { BatchRecord, BatchValue, Derived, DerivedRecord, Effect, Reaction, Source, Value } from '#client' */\n/** @import { Batch } from './batch.js'; */\nimport { DEV } from 'esm-env';\nimport {\n\tDERIVED,\n\tDIRTY,\n\tEFFECT_PRESERVED,\n\tSTALE_REACTION,\n\tASYNC,\n\tDESTROYED,\n\tINERT,\n\tCONNECTED,\n\tASSIGNED,\n\tERROR_VALUE,\n\tHAS_ABORT_CONTROLLER\n} from '#client/constants';\nimport {\n\tactive_reaction,\n\tactive_effect,\n\tupdate_reaction,\n\tset_active_effect,\n\tpush_reaction_value,\n\tis_destroying_effect,\n\tupdate_effect,\n\tremove_reactions,\n\tskipped_deps,\n\tnew_deps,\n\tis_current,\n\tpromote_record,\n\tchanged_since,\n\tis_dirty,\n\tabort_all,\n\tabort_controller,\n\tget\n} from '../runtime.js';\nimport { equals, safe_equals } from './equality.js';\nimport * as e from '../errors.js';\nimport * as w from '../warnings.js';\nimport { async_effect, destroy_effect, destroy_effect_children, teardown } from './effects.js';\nimport { eager_effects, set_eager_effects, source } from './sources.js';\nimport { get_error, invariant } from '../../shared/dev.js';\nimport { async_mode_flag, tracing_mode_flag } from '../../flags/index.js';\nimport { component_context } from '../context.js';\nimport { UNINITIALIZED } from '../../../constants.js';\nimport { batch_values, current_batch, view_batch, view_cache } from './batch.js';\nimport { current_runner, increment_pending, merge_target, unset_context } from './async.js';\nimport { deferred, includes, noop } from '../../shared/utils.js';\nimport { update_derived_status } from './status.js';\nimport { stringify_derived } from '../dev/debug.js';\n\n/**\n * This allows us to track 'reactivity loss' that occurs when signals\n * are read after a non-context-restoring `await`. Dev-only\n * @type {{ effect: Effect, effect_deps: Set<Value>, warned: boolean } | null}\n */\nexport let reactivity_loss_tracker = null;\n\n/** @param {{ effect: Effect, effect_deps: Set<Value>, warned: boolean } | null} v */\nexport function set_reactivity_loss_tracker(v) {\n\treactivity_loss_tracker = v;\n}\n\nexport const recent_async_deriveds = new Set();\n\n/**\n * @template V\n * @param {() => V} fn\n * @returns {Derived<V>}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function derived(fn) {\n\tvar flags = DERIVED | DIRTY;\n\n\tif (active_effect !== null) {\n\t\t// Since deriveds are evaluated lazily, any effects created inside them are\n\t\t// created too late to ensure that the parent effect is added to the tree\n\t\tactive_effect.f |= EFFECT_PRESERVED;\n\t}\n\n\t/** @type {Derived<V>} */\n\tconst signal = {\n\t\tctx: component_context,\n\t\tdeps: null,\n\t\tdv: null,\n\t\tedges: null,\n\t\teffects: null,\n\t\tequals,\n\t\tf: flags,\n\t\tfn,\n\t\treactions: null,\n\t\trv: 0,\n\t\tv: /** @type {V} */ (UNINITIALIZED),\n\t\twv: 0,\n\t\tparent: active_effect,\n\t\tac: null\n\t};\n\n\tif (DEV && tracing_mode_flag) {\n\t\tsignal.created = get_error('created at');\n\t}\n\n\treturn signal;\n}\n\nexport const OBSOLETE = Symbol('obsolete');\n\n/**\n * @template V\n * @param {() => V | Promise<V>} fn\n * @param {string} [label]\n * @param {string} [location] If provided, print a warning if the value is not read immediately after update\n * @param {(error: unknown) => void} [onready] Called when the first result is captured; receives its error, if any\n * @returns {Source<V>}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function async_expression(fn, label, location, onready) {\n\tvar signal = source(/** @type {V} */ (UNINITIALIZED));\n\tsignal.f |= ASYNC;\n\n\tif (DEV) signal.label = label ?? stringify_derived(fn);\n\n\t/** @type {Set<ReturnType<typeof deferred<V>>>} */\n\tvar deferreds = new Set();\n\n\t// `run` continues in the creating batch's view; other batches' results wait until then.\n\t// A superseded or obsolete run lets another batch supply the first value.\n\tvar runner = current_runner;\n\n\t/**\n\t * The batch whose run delivers the first value (`null`: whichever comes first)\n\t * @type {Batch | null}\n\t */\n\tvar resolver = runner && current_batch;\n\n\t/**\n\t * Results buffered until the script continues; `null` disables buffering.\n\t * @type {Array<() => void> | null}\n\t */\n\tvar waiting = runner && [];\n\n\t/**\n\t * Retry buffered results, or release them once the script has continued.\n\t * @param {boolean} [continued]\n\t */\n\tfunction flush_waiting(continued = false) {\n\t\tvar fns = /** @type {Array<() => void>} */ (waiting);\n\t\twaiting = continued ? null : [];\n\t\tif (continued) resolver = null;\n\t\tfor (const fn of fns) fn();\n\t}\n\n\tasync_effect(() => {\n\t\tvar effect = /** @type {Effect} */ (active_effect);\n\n\t\tif (DEV) {\n\t\t\treactivity_loss_tracker = { effect, effect_deps: new Set(), warned: false };\n\t\t}\n\n\t\t/** @type {ReturnType<typeof deferred<V>>} */\n\t\tvar d = deferred();\n\n\t\ttry {\n\t\t\tvar result = fn();\n\t\t\tif (result === UNINITIALIZED) return;\n\n\t\t\t// If this code is changed at some point, make sure to still access the then property\n\t\t\t// of fn() to read any signals it might access, so that we track them as dependencies.\n\t\t\tvar promise = Promise.resolve(result);\n\t\t\t// The then getter may also call `getAbortSignal()`, so capture its signal afterwards.\n\t\t\tvar abort_signal = abort_controller?.signal;\n\n\t\t\t// We call `unset_context` to undo any `save` calls that happen inside `fn()`\n\t\t\tpromise\n\t\t\t\t.then(\n\t\t\t\t\t(value) => {\n\t\t\t\t\t\tif (!abort_signal?.aborted) d.resolve(value);\n\t\t\t\t\t},\n\t\t\t\t\t(e) => {\n\t\t\t\t\t\t// An aborted run waits for its replacement, even if the user catches the abort.\n\t\t\t\t\t\t// A script awaiting another reaction's aborted promise must release its resolver:\n\t\t\t\t\t\t// the eager merge includes the signal's owner, but not necessarily this waiter.\n\t\t\t\t\t\tif (abort_signal?.aborted || (e === STALE_REACTION && runner === null)) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\td.reject(e === STALE_REACTION ? OBSOLETE : e);\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\t\t.finally(unset_context);\n\t\t} catch (error) {\n\t\t\td.reject(error);\n\t\t}\n\n\t\tif (DEV) {\n\t\t\tif (reactivity_loss_tracker) {\n\t\t\t\t// Reused deps from previous run (indices 0 to skipped_deps-1)\n\t\t\t\t// We deliberately only track direct dependencies of the async expression to encourage\n\t\t\t\t// dependencies being directly visible at the point of the expression\n\t\t\t\tif (effect.deps !== null) {\n\t\t\t\t\tfor (let i = 0; i < skipped_deps; i += 1) {\n\t\t\t\t\t\treactivity_loss_tracker.effect_deps.add(effect.deps[i]);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// New deps discovered this run\n\t\t\t\tif (new_deps !== null) {\n\t\t\t\t\tfor (let i = 0; i < new_deps.length; i += 1) {\n\t\t\t\t\t\treactivity_loss_tracker.effect_deps.add(new_deps[i]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treactivity_loss_tracker = null;\n\t\t}\n\n\t\tvar batch = /** @type {Batch} */ (current_batch);\n\t\tvar decrement_pending = increment_pending();\n\n\t\tbatch.async_deriveds.get(effect)?.reject(OBSOLETE);\n\t\tdeferreds.add(d);\n\t\tbatch.async_deriveds.set(effect, d);\n\n\t\t/**\n\t\t * @param {any} value\n\t\t * @param {unknown} error\n\t\t */\n\t\tconst handler = (value, error = undefined) => {\n\t\t\tif (DEV) {\n\t\t\t\tinvariant(view_batch === null, 'Batch is currently active');\n\n\t\t\t\treactivity_loss_tracker = null;\n\t\t\t}\n\n\t\t\tif (waiting !== null && error !== OBSOLETE) {\n\t\t\t\tresolver ??= batch;\n\n\t\t\t\tif (merge_target(batch) !== merge_target(resolver)) {\n\t\t\t\t\t// Recheck staleness after waiting: the batch may have rerun or been discarded.\n\t\t\t\t\t// Merged batches remain valid while their merge target is linked.\n\t\t\t\t\twaiting.push(() => {\n\t\t\t\t\t\tvar obsolete =\n\t\t\t\t\t\t\t(effect.f & DESTROYED) !== 0 ||\n\t\t\t\t\t\t\t(batch.linked ? batch.async_deriveds.get(effect) !== d : !merge_target(batch).linked);\n\n\t\t\t\t\t\thandler(value, obsolete ? OBSOLETE : error);\n\t\t\t\t\t});\n\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tdecrement_pending();\n\t\t\tdeferreds.delete(d);\n\n\t\t\tif (error) {\n\t\t\t\t// If the resolver's run is obsolete, let the next result supply the first value.\n\t\t\t\t// Do the same on failure if other results are pending. Try buffered results first.\n\t\t\t\t// A rerun in the same batch keeps ownership.\n\t\t\t\tif (\n\t\t\t\t\twaiting !== null &&\n\t\t\t\t\tresolver !== null &&\n\t\t\t\t\t(deferreds.size > 0 || error === OBSOLETE) &&\n\t\t\t\t\tmerge_target(resolver) === merge_target(batch) &&\n\t\t\t\t\tmerge_target(batch).async_deriveds.get(effect) === d\n\t\t\t\t) {\n\t\t\t\t\tresolver = null;\n\t\t\t\t\tflush_waiting();\n\t\t\t\t\treturn;\n\t\t\t\t} else if (error === OBSOLETE) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar same = signal.equals(value) && !error && (signal.f & ERROR_VALUE) === 0;\n\t\t\tmerge_target(batch).capture(signal, error ?? value, same, !!error);\n\n\t\t\tif (runner !== null) {\n\t\t\t\t// Let the script consume the first value in this batch's view before releasing buffered results.\n\t\t\t\trunner.switch(batch);\n\n\t\t\t\trunner.continued.push(() => flush_waiting(true));\n\n\t\t\t\trunner = null;\n\t\t\t}\n\n\t\t\tonready?.(error);\n\t\t\tonready = undefined;\n\n\t\t\tif (DEV && location !== undefined && !signal.equals(value)) {\n\t\t\t\trecent_async_deriveds.add(signal);\n\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\tif (recent_async_deriveds.has(signal) && (effect.f & DESTROYED) === 0) {\n\t\t\t\t\t\tw.await_waterfall(/** @type {string} */ (signal.label), location);\n\t\t\t\t\t\trecent_async_deriveds.delete(signal);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\td.promise.then(handler, (e) => handler(null, e || 'unknown'));\n\t});\n\n\tteardown(() => {\n\t\tfor (const d of deferreds) {\n\t\t\td.reject(OBSOLETE);\n\t\t}\n\t});\n\n\treturn signal;\n}\n\n/**\n * @template V\n * @param {() => V | Promise<V>} fn\n * @param {string} [label]\n * @param {string} [location] If provided, print a warning if the value is not read immediately after update\n * @returns {Promise<Source<V>>}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function async_derived(fn, label, location) {\n\tif (!current_runner) {\n\t\te.async_derived_orphan();\n\t}\n\n\tconst runner = current_runner;\n\tconst batch = /** @type {Batch} */ (current_batch);\n\n\treturn new Promise((fulfil, reject) => {\n\t\tvar source = async_expression(\n\t\t\t() => {\n\t\t\t\tvar effect = /** @type {Effect} */ (active_effect);\n\t\t\t\tvar target = merge_target(/** @type {Batch} */ (current_batch));\n\n\t\t\t\tif (runner.running && target !== batch && is_uninitialized(source)) {\n\t\t\t\t\t// Check all earlier expressions: assignments can initialize them out of order.\n\t\t\t\t\tfor (var i = index - 1; i >= 0; i--) {\n\t\t\t\t\t\tvar s = runner.signals[i];\n\n\t\t\t\t\t\tif (is_uninitialized(s)) {\n\t\t\t\t\t\t\t// re-run until we have a value\n\t\t\t\t\t\t\tget(s);\n\n\t\t\t\t\t\t\tvar pending = /** @type {Batch} */ (current_batch).async_deriveds;\n\t\t\t\t\t\t\tpending.get(effect)?.reject(OBSOLETE);\n\t\t\t\t\t\t\tpending.delete(effect);\n\t\t\t\t\t\t\treturn UNINITIALIZED;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn fn();\n\t\t\t},\n\t\t\tlabel,\n\t\t\tlocation,\n\t\t\t(error) => {\n\t\t\t\tif (error === undefined) fulfil(/** @type {Source<V>} */ (source));\n\t\t\t\telse reject(error);\n\t\t\t}\n\t\t);\n\n\t\tvar index = runner.signals.push(source) - 1;\n\t});\n}\n\n/**\n * Whether the signal of an async expression has no value yet in the active view of the world\n * @param {Source} signal\n */\nexport function is_uninitialized(signal) {\n\treturn (batch_values?.get(signal) ?? signal).v === UNINITIALIZED;\n}\n\n/**\n * @template V\n * @param {() => V} fn\n * @returns {Derived<V>}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function user_derived(fn) {\n\tconst d = derived(fn);\n\n\tif (!async_mode_flag) push_reaction_value(d);\n\n\treturn d;\n}\n\n/**\n * @template V\n * @param {() => V} fn\n * @returns {Derived<V>}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function derived_safe_equal(fn) {\n\tconst signal = derived(fn);\n\tsignal.equals = safe_equals;\n\treturn signal;\n}\n\n/**\n * @param {Derived} derived\n * @returns {void}\n */\nexport function destroy_derived_effects(derived) {\n\tvar effects = derived.effects;\n\n\tif (effects !== null) {\n\t\tderived.effects = null;\n\n\t\tfor (var i = 0; i < effects.length; i += 1) {\n\t\t\tdestroy_effect(/** @type {Effect} */ (effects[i]));\n\t\t}\n\t}\n}\n\n/**\n * The currently updating deriveds, used to detect infinite recursion\n * in dev mode and provide a nicer error than 'too much recursion'\n * @type {Derived[]}\n */\nlet stack = [];\n\n/**\n * @template T\n * @param {Derived} derived\n * @returns {T}\n */\nexport function execute_derived(derived) {\n\tvar prev_active_effect = active_effect;\n\tvar parent = derived.parent;\n\n\tif (\n\t\t!is_destroying_effect &&\n\t\tparent !== null &&\n\t\tderived.v !== UNINITIALIZED && // if it was never evaluated before, it's guaranteed to fail downstream, so we try to execute instead\n\t\t(parent.f & (DESTROYED | INERT)) !== 0\n\t) {\n\t\tw.derived_inert();\n\n\t\t// (as if it ran — it can't change anymore)\n\t\tupdate_derived_status(derived);\n\n\t\treturn derived.v;\n\t}\n\n\t// Check before pushing, so that a recursive call doesn't remove the outer evaluation from the stack.\n\tif (DEV && includes.call(stack, derived)) {\n\t\te.derived_references_self();\n\t}\n\n\tset_active_effect(parent);\n\n\tvar prev_eager_effects = eager_effects;\n\n\tif (DEV) {\n\t\tset_eager_effects(new Set());\n\t\tstack.push(derived);\n\t}\n\n\ttry {\n\t\tdestroy_derived_effects(derived);\n\t\treturn update_reaction(derived);\n\t} finally {\n\t\tset_active_effect(prev_active_effect);\n\n\t\tif (DEV) {\n\t\t\tset_eager_effects(prev_eager_effects);\n\t\t\tstack.pop();\n\t\t}\n\t}\n}\n\n/**\n * Update the global state of a derived, adopting the active batch's run if its view has\n * become the real world (e.g. because a fork was committed), or re-evaluating it otherwise.\n * `signal` can be a source, too, which is cheaper than checking first (this is called for every dependency that\n * is checked): only reactions ever get a dirty status, so `is_dirty` returns `false` for a source right away\n * @param {Value} signal\n * @returns {void}\n */\nexport function update_derived(signal) {\n\tvar derived = /** @type {Derived} */ (signal);\n\n\tif (!is_dirty(derived)) return;\n\n\tvar records = view_batch?.records;\n\tvar record = records?.get(derived);\n\n\tif (record !== undefined && is_current(record.deps, record.dv)) {\n\t\t/** @type {Map<Reaction, BatchRecord>} */ (records).delete(derived);\n\t\tpromote_record(derived, record);\n\t} else {\n\t\t// (the result is stored by `update_dependencies`)\n\t\texecute_derived(derived);\n\t}\n}\n\n/**\n * The value of `derived` as the view of the world of the active batch sees it, with its version: an\n * assigned value that holds, or a run of it whose versions are what the view holds — a record in the\n * batch, or the derived itself (i.e. its global state) — or else a new run. Results are cached for the\n * lifetime of the view (see `view_cache`), unless the derived is disconnected, in which case nothing\n * would remove them from the cache when they become stale.\n * @param {Derived} derived\n * @returns {Derived | DerivedRecord | BatchValue}\n */\nexport function get_view(derived) {\n\tvar cache = /** @type {Map<Derived, Derived | DerivedRecord | BatchValue>} */ (view_cache);\n\tvar entry = cache.get(derived);\n\n\tif (entry !== undefined) return entry;\n\n\tvar batch = /** @type {Batch} */ (view_batch);\n\n\t// What the view holds for the derived is a write to it — an assignment (in this batch, or made while it commits),\n\t// or the value from before another batch's assignment that this view undoes — or else its global state. An assigned value\n\t// holds until one of the derived's dependencies — what its run in this view (its record in the batch, if\n\t// any, else its global run) read — is written after it (see `changed_since`). The value from before an\n\t// undone assignment is only used if it was assigned, too: a computed value was computed in some other\n\t// view of the world, and may depend on writes that this view undoes\n\tvar written = /** @type {Map<Value, BatchValue>} */ (batch_values).get(derived);\n\tvar held = written ?? derived;\n\tvar assigned = written === undefined ? (derived.f & ASSIGNED) !== 0 : written.assigned;\n\tvar record = /** @type {DerivedRecord | undefined} */ (batch.get_record(derived));\n\n\tif (assigned && !changed_since((record ?? derived).deps, held.wv)) {\n\t\tentry = held;\n\t} else if (record !== undefined && is_current(record.deps, record.dv)) {\n\t\tentry = record;\n\t} else if (\n\t\twritten === undefined &&\n\t\t!assigned &&\n\t\tderived.dv !== null &&\n\t\tis_current(derived.deps, derived.dv)\n\t) {\n\t\tentry = derived;\n\t} else {\n\t\texecute_derived(derived);\n\n\t\t// the run is stored in the batch, unless it is the real-world value (see `update_record`)\n\t\tentry = /** @type {DerivedRecord | undefined} */ (batch.records?.get(derived)) ?? derived;\n\t}\n\n\tif ((derived.f & CONNECTED) !== 0) {\n\t\tcache.set(derived, entry);\n\t}\n\n\treturn entry;\n}\n\n/**\n * @param {Derived} derived\n */\nexport function freeze_derived_effects(derived) {\n\tif (derived.effects === null) return;\n\n\tfor (const e of derived.effects) {\n\t\t// if the effect has a teardown function or abort signal, call it\n\t\tif (e.teardown || (e.f & HAS_ABORT_CONTROLLER) !== 0) {\n\t\t\te.teardown?.();\n\t\t\tabort_all(e);\n\n\t\t\t// make it a noop so it doesn't get called again if the derived\n\t\t\t// is unfrozen. we don't set it to `null`, because the existence\n\t\t\t// of a teardown function is what determines whether the\n\t\t\t// effect runs again during unfreezing (but not for teardown-only effects)\n\t\t\tif (e.fn !== null) e.teardown = noop;\n\n\t\t\tremove_reactions(e);\n\t\t\tdestroy_effect_children(e);\n\t\t}\n\t}\n}\n\n/**\n * @param {Derived} derived\n */\nexport function unfreeze_derived_effects(derived) {\n\tif (derived.effects === null) return;\n\n\tfor (const e of derived.effects) {\n\t\t// if the effect was previously frozen — indicated by the presence\n\t\t// of a teardown function — unfreeze it\n\t\tif (e.teardown && e.fn !== null) {\n\t\t\tupdate_effect(e);\n\t\t}\n\t}\n}\n","/** @import { Fork } from 'svelte' */\n/** @import { BatchRecord, BatchValue, Derived, DerivedRecord, Effect, Reaction, Source, Value } from '#client' */\n/** @import { Boundary } from '../dom/blocks/boundary.js' */\nimport {\n\tBLOCK_EFFECT,\n\tBRANCH_EFFECT,\n\tCLEAN,\n\tDESTROYED,\n\tDIRTY,\n\tEFFECT,\n\tINERT,\n\tRENDER_EFFECT,\n\tROOT_EFFECT,\n\tMAYBE_DIRTY,\n\tDERIVED,\n\tEAGER_EFFECT,\n\tERROR_VALUE,\n\tMANAGED_EFFECT,\n\tREACTION_RAN,\n\tDESTROYING,\n\tEFFECT_OFFSCREEN,\n\tASSIGNED,\n\tASYNC,\n\tREACTION_IS_UPDATING,\n\tBOUNDARY_EFFECT\n} from '#client/constants';\nimport { async_mode_flag, custom_renderers_flag } from '../../flags/index.js';\nimport { deferred, define_property } from '../../shared/utils.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tget,\n\tincrement_write_version,\n\tis_destroying_effect,\n\tis_dirty,\n\tis_outdated,\n\tpromote_record,\n\tprune_edges,\n\tuntrack,\n\tupdate_effect,\n\twrite_version,\n\tabort_record\n} from '../runtime.js';\nimport * as e from '../errors.js';\nimport { flush_tasks, queue_micro_task } from '../dom/task.js';\nimport { DEV } from 'esm-env';\nimport { invoke_error_boundary } from '../error-handling.js';\nimport {\n\teager_effects,\n\teager_effects_deferred,\n\tflush_eager_effects,\n\tsource,\n\tupdate\n} from './sources.js';\nimport { eager_effect, teardown, unlink_effect } from './effects.js';\nimport { UNINITIALIZED } from '../../../constants.js';\nimport { set_signal_status, update_derived_status } from './status.js';\nimport { invariant } from '../../shared/dev.js';\nimport { OBSOLETE } from './deriveds.js';\nimport { is_runes } from '../context.js';\nimport { merge_target } from './async.js';\n\n/** @type {Batch | null} */\nexport let first_batch = null;\n\n/** @type {Batch | null} */\nlet last_batch = null;\n\n/** @type {Batch | null} */\nexport let current_batch = null;\n\n/**\n * The batch currently being processed (see `#process`)\n * @type {Batch | null}\n */\nexport let processing_batch = null;\n\n/**\n * @typedef {Object} TeardownContext\n * @property {Map<Value, BatchValue>} reverted_values What teardowns see instead of the values sources hold: the values\n * from before the writes that caused the teardowns (the `previous` of the batch being processed, see `flush`). For\n * block effects that re-run right away because of a user effect's writes, also the writes of the effects that ran\n * before it in the same commit, which apply (see `flush_queued_effects`)\n * @property {Map<Derived, BatchValue>} derived_cache The values of deriveds in this view (see `runtime.js#teardown_view`),\n * until it changes\n * @property {TeardownContext | null} parent The context to restore after a nested flush or eager block\n */\n\n/**\n * Effect teardowns revert the writes that caused them (see `runtime.js#teardown_view`).\n * (A teardown outside of a flush reverts nothing, but gets a context to cache its deriveds in, for as long as it\n * runs — see `execute_effect_teardown`)\n * @type {TeardownContext | null}\n */\nexport let teardown_context = null;\n\n/** @param {TeardownContext | null} context */\nexport function set_teardown_context(context) {\n\tteardown_context = context;\n}\n\n/** @param {Map<Value, BatchValue>} [values] */\nexport function push_teardown_context(values) {\n\tvar context = (teardown_context = {\n\t\treverted_values: new Map(teardown_context?.reverted_values),\n\t\tderived_cache: new Map(),\n\t\tparent: teardown_context\n\t});\n\n\tfor (const [source, value] of values ?? []) context.reverted_values.set(source, value);\n\n\treturn context;\n}\n\n/**\n * A write in a teardown remains visible after returning to an enclosing teardown view,\n * and the deriveds that teardowns evaluated may depend on it\n * @param {Value} source\n */\nexport function teardown_write(source) {\n\tfor (var context = teardown_context; context !== null; context = context.parent) {\n\t\tcontext.reverted_values.delete(source);\n\t\tcontext.derived_cache.clear();\n\t}\n}\n\n/**\n * When time travelling (i.e. working in one batch, while other batches\n * still have ongoing work), we ignore the real values of affected\n * signals in favour of their values within the batch — along with their\n * versions: the batch's writes, and the values from before the writes of\n * other batches, which its view of the world undoes (see `activate`).\n * `null` means that the real world (i.e. the latest values) applies.\n * Doesn't contain computed deriveds, these are in {@link view_cache}.\n * @type {Map<Value, BatchValue> | null}\n */\nexport let batch_values = null;\n\n/**\n * The values of deriveds in the active view of the world, for as long as it is active (see `get_view`):\n * a record of a run (in which case `e` tells whether its value is an error), the derived itself if its\n * global state applies, or the write to it that holds (an assignment). Exists whenever `batch_values` does\n * @type {Map<Derived, Derived | DerivedRecord | BatchValue> | null}\n */\nexport let view_cache = null;\n\n/**\n * The batch whose view of the world is active (see `activate`). Block and async\n * effects that run while it is processed, and deriveds evaluated with values\n * that are not the latest, are recorded in this batch\n * @type {Batch | null}\n */\nexport let view_batch = null;\n\n/** @type {Effect | null} */\nlet last_scheduled_effect = null;\n\n/**\n * Batches whose view of the world changed because another batch committed, and that\n * therefore need to be processed again once the current flush is done (see `#commit`)\n * @type {Set<Batch>}\n */\nvar rebases = new Set();\n\nexport let is_flushing_sync = false;\n\n/**\n * During traversal, this is an array. Newly created effects are (if not immediately\n * executed) pushed to this array, rather than going through the scheduling\n * rigamarole that would cause another turn of the flush loop.\n * @type {Effect[] | null}\n */\nexport let collected_effects = null;\n\n/**\n * An array of effects that are marked during traversal as a result of a `set`\n * (not `internal_set`) call. These will be added to the next batch and\n * trigger another `batch.process()`\n * @type {Effect[] | null}\n * @deprecated when we get rid of legacy mode and stores, we can get rid of this\n */\nexport let legacy_updates = null;\n\nvar flush_count = 0;\n\n/** Sources whose DEV update counts and stack traces need resetting after the flush. @type {Set<Value>} */\nexport const source_stacks = new Set();\n\n/**\n * A set of signals we have already seen while traversing in `batch.mark`.\n * Not always set to balance the common case of sources only having a couple\n * of (transitive) dependencies (where always creating a Set would be bad for perf)\n * with the edge case of extremely deep or wide dependency arrays with cycles.\n * @type {Set<any> | null}\n */\nvar seen = null;\n/** Number of transitive dependencies, see {@link seen} for more info */\nvar count_deps = 0;\n\nlet uid = 1;\n\n/** @type {number | null} */\nlet last_processed = null;\n\nexport class Batch {\n\tid = uid++;\n\n\t/** True as soon as `#process` was called */\n\tstarted = false;\n\n\tlinked = true;\n\n\t/** @type {Batch | null} */\n\tprev = null;\n\n\t/** @type {Batch | null} */\n\tnext = null;\n\n\t/** @type {Map<Effect, ReturnType<typeof deferred<any>>>} */\n\tasync_deriveds = new Map();\n\n\t/**\n\t * The current values (and their versions) of any sources that are updated in this batch,\n\t * including deriveds that were overridden via assignment — until it commits them (see `#commit`).\n\t * Its keys are those of `this.previous`, plus the sources this batch gave their first value. `e` says whether\n\t * the value is an error\n\t * @type {Map<Value, BatchValue>}\n\t */\n\tcurrent = new Map();\n\n\t/**\n\t * The values (and their versions) of any sources that are updated in this batch _before_ those updates took place.\n\t * For a derived, `assigned` says whether its value before was assigned, too (otherwise it was computed).\n\t * A source that this batch gave its first value (e.g. an async expression that resolved for the first time) has\n\t * no entry: there's no value from before it, so other views can't undo the write, and teardowns don't revert it.\n\t * @type {Map<Value, BatchValue>}\n\t */\n\tprevious = new Map();\n\n\t/**\n\t * Results of reactions that belong to this batch rather than to the real world:\n\t * deriveds evaluated in this batch's view of the world with values that are not the\n\t * latest ones, and block/async effects that ran while this batch was processed.\n\t * Effect records become global state when the batch commits (see `promote_record`)\n\t * @type {Map<Reaction, BatchRecord> | null}\n\t */\n\trecords = null;\n\n\t/**\n\t * Earlier batches whose changes are part of this batch's view of the world, because\n\t * they intersect with it (this batch will be merged into them, see `#merge`)\n\t * @type {Batch[]}\n\t */\n\tfolded = [];\n\n\t/**\n\t * When the batch is committed (and the DOM is updated), we need to remove old branches\n\t * and append new ones by calling the functions added inside (if/each/key/etc) blocks.\n\t * Each callback maps to the writes that apply in the teardowns it causes, if it was added\n\t * while block effects re-ran eagerly (see `eager_block_writes`)\n\t * @type {Map<(batch: Batch) => void, Map<Value, BatchValue> | null>}\n\t */\n\t#commit_callbacks = new Map();\n\n\t/**\n\t * If a fork is discarded, we need to destroy any effects that are no longer needed\n\t * (see `#commit_callbacks`)\n\t * @type {Map<(batch: Batch) => void, Map<Value, BatchValue> | null>}\n\t */\n\t#discard_callbacks = new Map();\n\n\t/**\n\t * Async effects that are currently in flight\n\t * @type {Map<Effect, number>}\n\t */\n\t#pending = new Map();\n\n\t/**\n\t * A deferred that resolves when the batch is committed, used with `settled()`\n\t * TODO replace with Promise.withResolvers once supported widely enough\n\t * @type {{ promise: Promise<void>, resolve: (value?: any) => void, reject: (reason: unknown) => void } | null}\n\t */\n\t#deferred = null;\n\n\t/**\n\t * Effects to (re-)validate when this batch is processed next, and their status (DIRTY or MAYBE_DIRTY):\n\t * those that were scheduled while it wasn't being processed (see {@link schedule}), and those whose run\n\t * was deferred because it has pending work (see `#defer_effects`)\n\t * @type {Map<Effect, number>}\n\t */\n\t#unprocessed = new Map();\n\n\t/**\n\t * Effects that were scheduled in this batch but not yet 'resolved' into the\n\t * root effects that need to be flushed. Resolving — the upwards traversal that\n\t * marks the path to each effect on the shared effect tree (see #resolve) — is\n\t * deferred until the batch is processed, so that the markers are created and\n\t * consumed within a single traversal. Scheduling into other batches (which can\n\t * happen concurrently, e.g. while a batch is committed) can therefore never\n\t * observe (and be confused by) this batch's markers.\n\t * May contain duplicates — deduplication happens during resolving\n\t * @type {Effect[]}\n\t */\n\t#scheduled = [];\n\n\t/**\n\t * Branches that still exist, but will be destroyed when this batch\n\t * is committed — we skip over these during `#process`\n\t * @type {Set<Effect>}\n\t */\n\t#skipped_branches = new Set();\n\n\t/**\n\t * Branches that this batch selected (see `unskip_effect`). A branch that is offscreen until\n\t * it is committed (see `EFFECT_OFFSCREEN`) only exists in the views of the batches that selected it\n\t * @type {Set<Effect>}\n\t */\n\t#unskipped_branches = new Set();\n\n\tis_fork = false;\n\n\t/**\n\t * The batch that this one was merged into, if any (see `#merge`). Its async work that is still in flight\n\t * continues as part of that one\n\t * @type {Batch | null}\n\t */\n\tmerged = null;\n\n\t/**\n\t * Batches whose runs this batch aborted. Merge into them before waiting for pending work.\n\t * Requests belong to this batch because a synchronous derived can abort outside traversal,\n\t * before an unrelated batch is processed (e.g. a fork being committed).\n\t * @type {Set<Batch>}\n\t */\n\tmerge_requests = new Set();\n\n\t#decrement_queued = false;\n\n\tconstructor() {\n\t\tif (last_batch === null) {\n\t\t\tfirst_batch = last_batch = this;\n\t\t} else {\n\t\t\tlast_batch.next = this;\n\t\t\tthis.prev = last_batch;\n\t\t}\n\n\t\tlast_batch = this;\n\t}\n\n\t#is_deferred() {\n\t\tif (this.is_fork) return true;\n\n\t\tfor (const effect of this.#pending.keys()) {\n\t\t\tif (this.is_blocked_by(effect)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * Whether `effect` is a branch that this batch skips, or that only exists offscreen for other batches\n\t * @param {Effect} effect\n\t */\n\t#skips(effect) {\n\t\treturn (\n\t\t\tthis.#skipped_branches.has(effect) ||\n\t\t\t((effect.f & EFFECT_OFFSCREEN) !== 0 && !this.#unskipped_branches.has(effect))\n\t\t);\n\t}\n\n\t/**\n\t * Whether `effect` is inside a branch that this batch skips, i.e. doesn't exist in its view of the world\n\t * @param {Effect} effect\n\t */\n\tis_skipped(effect) {\n\t\tfor (var e = /** @type {Effect | null} */ (effect); e !== null; e = e.parent) {\n\t\t\tif (this.#skips(e)) return true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * Whether async work in `effect` holds up this batch — or, with `root`, the boundary whose content `root` is.\n\t * It doesn't if the effect is inside a branch that this batch skips (the branch is going to be destroyed),\n\t * or inside a boundary that is pending (which shows its pending snippet in the meantime).\n\t * Unlike a skipped branch, the content of a pending boundary does exist in the view of the batch: its\n\t * effects are still re-validated (see `#revalidate`), they just don't keep the batch from committing\n\t * @param {Effect} effect\n\t * @param {Effect | null} [root]\n\t */\n\tis_blocked_by(effect, root = null) {\n\t\tfor (var e = /** @type {Effect | null} */ (effect); e !== null && e !== root; e = e.parent) {\n\t\t\tif (this.#skips(e)) return false;\n\n\t\t\tif (\n\t\t\t\t(e.f & (BOUNDARY_EFFECT | DESTROYED)) === BOUNDARY_EFFECT &&\n\t\t\t\t/** @type {Boundary} */ (e.b).is_pending\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * @param {Effect} effect\n\t */\n\tskip_effect(effect) {\n\t\tthis.#skipped_branches.add(effect);\n\t\tthis.#unskipped_branches.delete(effect);\n\t}\n\n\t/**\n\t * @param {Effect} effect\n\t */\n\tunskip_effect(effect) {\n\t\tif (\n\t\t\tthis.#skipped_branches.delete(effect) ||\n\t\t\t(!this.#unskipped_branches.has(effect) &&\n\t\t\t\t((effect.f & EFFECT_OFFSCREEN) !== 0 ||\n\t\t\t\t\tthis.folded.some((batch) => batch.#skipped_branches.has(effect))))\n\t\t) {\n\t\t\t// This batch adopts a branch that it skipped (whose effects may have been reset, see `reset_branch`),\n\t\t\t// that so far only existed offscreen (possibly for another batch, whose view of the world its\n\t\t\t// effects ran in), or that a batch whose writes are part of its view skips (and so didn't run the\n\t\t\t// effects that its writes affect, or reset them) — re-validate its effects in this batch's view\n\t\t\tthis.revalidate_branch(effect);\n\t\t}\n\n\t\tthis.#unskipped_branches.add(effect);\n\t}\n\n\t/**\n\t * Like `unskip_effect`, for a branch that was just created offscreen while this batch is processed.\n\t * Its effects ran in this batch's view of the world when they were created, so there's nothing to re-validate\n\t * TODO can we skip revalidation in `unskip_effect` in more cases, by detecting whether things changed\n\t * inside a branch while it was skipped?\n\t * @param {Effect} effect\n\t */\n\tunskip_new_effect(effect) {\n\t\tthis.#unskipped_branches.add(effect);\n\t}\n\n\t/**\n\t * @param {Effect} effect\n\t */\n\trevalidate_branch(effect) {\n\t\tfor (var e = effect.first; e !== null; e = e.next) {\n\t\t\tvar flags = e.f;\n\n\t\t\t// (branches nested inside that exist offscreen for other batches only are not adopted)\n\t\t\tif ((flags & (DESTROYED | INERT)) === 0 && !this.#skips(e)) {\n\t\t\t\tif ((flags & (BRANCH_EFFECT | ROOT_EFFECT | EAGER_EFFECT)) === 0 && e.fn !== null) {\n\t\t\t\t\tthis.schedule(e, MAYBE_DIRTY);\n\t\t\t\t}\n\n\t\t\t\tthis.revalidate_branch(e);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Convert the effects that were scheduled in this batch into the root effects\n\t * that need to be traversed, marking the path to each effect (by clearing the\n\t * `CLEAN` flag on ancestor branches) so that the traversal can find them.\n\t * This happens right before traversal rather than at scheduling time, so that\n\t * the markers left on the (shared) effect tree are created and consumed within\n\t * a single traversal — scheduling into other batches can never observe them\n\t * @returns {Effect[]}\n\t */\n\t#resolve() {\n\t\t/** @type {Effect[]} */\n\t\tvar roots = [];\n\n\t\tfor (const effect of this.#scheduled) {\n\t\t\t// skip effects that are destroyed, or that already ran (e.g. because\n\t\t\t// they were reached by the traversal that preceded a drain iteration,\n\t\t\t// or because they were scheduled twice)\n\t\t\tif ((effect.f & DESTROYED) !== 0 || (effect.f & (DIRTY | MAYBE_DIRTY)) === 0) continue;\n\n\t\t\tvar e = effect;\n\t\t\tvar covered = false;\n\n\t\t\twhile (e.parent !== null) {\n\t\t\t\te = e.parent;\n\t\t\t\tvar flags = e.f;\n\n\t\t\t\tif ((flags & (ROOT_EFFECT | BRANCH_EFFECT)) !== 0) {\n\t\t\t\t\tif ((flags & CLEAN) === 0) {\n\t\t\t\t\t\t// the path to the root was already marked, meaning the\n\t\t\t\t\t\t// root was already collected — nothing left to do\n\t\t\t\t\t\tcovered = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\te.f ^= CLEAN;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!covered) {\n\t\t\t\troots.push(e);\n\t\t\t}\n\t\t}\n\n\t\tthis.#scheduled = [];\n\n\t\treturn roots;\n\t}\n\n\t#process() {\n\t\t// Processing a batch frequently hands over to another batch (the next one, an earlier one it\n\t\t// merged into, etc). Do that iteratively rather than recursively, so that the call stack doesn't\n\t\t// grow with each hand-over — deep stacks make DEV stack capture (see `get_stack`) quadratic\n\t\t/** @type {Batch | null} */\n\t\tvar batch = this;\n\n\t\twhile (batch !== null) {\n\t\t\tbatch = batch.#process_step();\n\t\t}\n\t}\n\n\t/**\n\t * Processes this batch and returns the batch that needs to be processed next, if any\n\t * @returns {Batch | null}\n\t */\n\t#process_step() {\n\t\tcurrent_batch = processing_batch = this;\n\n\t\t// A different batch view may apply, even when processing continues within the same flush.\n\t\tteardown_context?.derived_cache.clear();\n\n\t\tif (async_mode_flag && this.started && last_processed !== this.id) {\n\t\t\t// Since this batch last ran, reactions may have come to depend on its writes without it\n\t\t\t// knowing (e.g. effects created by other batches), or have run in the view of other batches.\n\t\t\t// Re-validate them in this batch's view — this only re-runs those that are out of date\n\t\t\tthis.#revalidate(this.current.keys());\n\t\t}\n\n\t\tthis.started = true;\n\t\tlast_processed = this.id;\n\n\t\t// Deferred effects are rescheduled even if the batch still has pending work, because traversing the\n\t\t// tree could make an if block that contains the last blocking pending effect falsy, causing the batch\n\t\t// to no longer be deferred. If it still is, they are deferred again\n\t\tif (this.#unprocessed.size > 0) {\n\t\t\tfor (const [e, status] of this.#unprocessed) this.#add(e, status);\n\t\t\tthis.#unprocessed.clear();\n\t\t}\n\n\t\tif (DEV) {\n\t\t\t// track all the values that were updated during this flush,\n\t\t\t// so that they can be reset afterwards\n\t\t\tfor (const value of this.current.keys()) {\n\t\t\t\tsource_stacks.add(value);\n\t\t\t}\n\t\t}\n\n\t\tthis.activate();\n\n\t\t/** @type {Effect[]} */\n\t\tvar effects = (collected_effects = []);\n\n\t\t/** @type {Effect[]} */\n\t\tvar render_effects = [];\n\n\t\t/** @type {Boundary[]} */\n\t\tvar revealed_boundaries = [];\n\n\t\t/**\n\t\t * @type {Effect[]}\n\t\t * @deprecated when we get rid of legacy mode and stores, we can get rid of this\n\t\t */\n\t\tvar updates = (legacy_updates = []);\n\n\t\t// Effects can be scheduled during traversal (e.g. because a parent each/await/etc\n\t\t// block updated an internal source, or because an effect invalidated itself)\n\t\t// hence we loop until there are no more scheduled effects.\n\t\twhile (this.#scheduled.length > 0) {\n\t\t\tif (flush_count++ > 1000) {\n\t\t\t\tthis.#unlink();\n\t\t\t\tinfinite_loop_guard(); // TODO try to reset the tree here?\n\t\t\t}\n\n\t\t\tfor (const root of this.#resolve()) {\n\t\t\t\ttry {\n\t\t\t\t\tthis.#traverse(root, effects, render_effects, revealed_boundaries);\n\t\t\t\t} catch (e) {\n\t\t\t\t\treset_branch(root, true);\n\t\t\t\t\t// If there's no async work left, this branch is now dead and needs\n\t\t\t\t\t// to be discarded to not become a zombie that is never cleaned up.\n\t\t\t\t\t// See https://github.com/sveltejs/svelte/issues/18221#issuecomment-4497918414\n\t\t\t\t\t// for a (non-minimal) reproduction that demonstrates a case where this is necessary\n\t\t\t\t\t// to not get follow-up false-positives via \"batch has scheduled roots\" invariant errors.\n\t\t\t\t\tif (!this.#is_deferred()) this.discard();\n\t\t\t\t\tthrow e;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.#scheduled.length > 0) {\n\t\t\t\t// A later traversal may discover effects before ones we already collected.\n\t\t\t\t// Recollect them together so they are flushed in tree order, rather than\n\t\t\t\t// appending earlier effects after their later siblings.\n\t\t\t\tfor (const effect of render_effects) this.#scheduled.push(effect);\n\t\t\t\tfor (const effect of effects) this.#scheduled.push(effect);\n\t\t\t\trender_effects.length = 0;\n\t\t\t\teffects.length = 0;\n\t\t\t}\n\t\t}\n\n\t\t// any writes should take effect in a subsequent batch\n\t\tcurrent_batch = null;\n\n\t\tif (updates.length > 0) {\n\t\t\tvar batch = Batch.ensure();\n\t\t\tfor (const e of updates) {\n\t\t\t\t// these were marked during traversal already (see `mark_reactions`), unless they ran since\n\t\t\t\tif ((e.f & CLEAN) === 0) batch.schedule(e, MAYBE_DIRTY);\n\t\t\t}\n\t\t}\n\n\t\tcollected_effects = null;\n\t\tlegacy_updates = null;\n\n\t\tif (this.merge_requests.size > 0) {\n\t\t\tconst sorted = Array.from(this.merge_requests, merge_target)\n\t\t\t\t.filter((batch) => batch !== this && batch.linked && !batch.is_fork)\n\t\t\t\t.sort((a, b) => a.id - b.id);\n\t\t\tthis.merge_requests.clear();\n\n\t\t\tif (sorted.length > 0) {\n\t\t\t\tthis.#defer_effects(render_effects);\n\t\t\t\tthis.#defer_effects(effects);\n\n\t\t\t\t/** @type {Batch} */\n\t\t\t\tvar target = this;\n\t\t\t\tvar i = sorted.length;\n\n\t\t\t\twhile (i--) {\n\t\t\t\t\tvar earlier = sorted[i];\n\t\t\t\t\tif (earlier === target) continue;\n\t\t\t\t\tearlier.#merge(target);\n\t\t\t\t\ttarget = earlier;\n\t\t\t\t}\n\n\t\t\t\t// Revalidate once all the writes and pending work belong to the same batch.\n\t\t\t\treturn target;\n\t\t\t}\n\t\t}\n\n\t\t// if the batch has outstanding pending work, stash effects and bail\n\t\tif (this.#is_deferred()) {\n\t\t\tthis.#defer_effects(render_effects);\n\t\t\tthis.#defer_effects(effects);\n\n\t\t\tfor (const e of this.#skipped_branches) {\n\t\t\t\treset_branch(e);\n\t\t\t}\n\n\t\t\tif (updates.length > 0) {\n\t\t\t\treturn /** @type {Batch} */ (/** @type {unknown} */ (current_batch));\n\t\t\t}\n\n\t\t\treturn null;\n\t\t}\n\n\t\tconst earlier_batch = this.#find_earlier_batch();\n\n\t\tif (earlier_batch) {\n\t\t\t// If this batch collected deferred effects during traversal, they still need\n\t\t\t// to run after being merged into the earlier batch.\n\t\t\tthis.#defer_effects(render_effects);\n\t\t\tthis.#defer_effects(effects);\n\t\t\tearlier_batch.#merge(this);\n\n\t\t\treturn earlier_batch;\n\t\t}\n\n\t\tfor (const boundary of revealed_boundaries) {\n\t\t\t// A later traversal may have restored an unresolved branch since this boundary was queued.\n\t\t\tif (boundary.is_pending && boundary.is_ready(this)) {\n\t\t\t\tboundary.reveal(effects);\n\t\t\t}\n\t\t}\n\n\t\t// The results of this batch are about to become the real-world state\n\t\tthis.#release_records(true);\n\n\t\t// append/remove branches\n\t\tthis.#run_callbacks(this.#commit_callbacks);\n\n\t\tvar was_flushing_effects = is_flushing_effects;\n\t\tvar previous_captured_writes = captured_writes;\n\n\t\ttry {\n\t\t\tis_flushing_effects = true;\n\t\t\tvar earlier_writes = flush_queued_effects(render_effects);\n\n\t\t\t// the content has been updated, and user effects are about to see it\n\t\t\tif (custom_renderers_flag && before_effects !== null) {\n\t\t\t\tbefore_effects();\n\t\t\t}\n\n\t\t\tflush_queued_effects(effects, earlier_writes);\n\t\t} finally {\n\t\t\tis_flushing_effects = was_flushing_effects;\n\t\t\tcaptured_writes = previous_captured_writes;\n\t\t}\n\n\t\tthis.#deferred?.resolve();\n\n\t\tvar next_batch = /** @type {Batch | null} */ (/** @type {unknown} */ (current_batch));\n\n\t\tif (this.#pending.size === 0 && (this.#scheduled.length === 0 || next_batch !== null)) {\n\t\t\tthis.#unlink();\n\t\t}\n\n\t\t// Order matters here - we need to commit and THEN continue flushing new batches, not the other way around,\n\t\t// else we could start flushing a new batch and then, if it has pending work, rebase it right afterwards, which is wrong.\n\t\t// In sync mode flushSync can cause #commit to wrongfully think that there needs to be a rebase, so we only do it in async mode\n\t\t// TODO fix the underlying cause, otherwise this will likely regress when non-async mode is removed\n\t\tif (async_mode_flag) {\n\t\t\tthis.commit_writes();\n\t\t}\n\n\t\tif (next_batch !== null) {\n\t\t\t// The next batch holds the writes made while this one committed, which cause the teardowns that run\n\t\t\t// when it's processed. So teardowns now revert those, and no longer this batch's: of the reverted\n\t\t\t// values, keep those that are the next batch's values from before its writes. (Writes made in teardowns\n\t\t\t// aren't among them, see `teardown_write`, so they stay visible)\n\t\t\tif (teardown_context !== null) {\n\t\t\t\tfor (const [source, snapshot] of teardown_context.reverted_values) {\n\t\t\t\t\tif (next_batch.previous.get(source)?.wv !== snapshot.wv) {\n\t\t\t\t\t\tteardown_context.reverted_values.delete(source);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn next_batch;\n\t}\n\n\t/**\n\t * Schedule the reactions that (transitively) depend on `sources` for re-validation in this batch.\n\t * They are marked MAYBE_DIRTY, which means that they are only re-run if the exact versions\n\t * of their dependencies differ from the ones they last saw (in this batch's view of the world)\n\t * @param {Iterable<Source>} sources\n\t */\n\t#revalidate(sources) {\n\t\t// deriveds added during iteration are visited too, so this doubles as a worklist\n\t\t/** @type {Set<Value>} */\n\t\tvar values = new Set(sources);\n\n\t\t/** @type {Set<Effect>} */\n\t\tvar effects = new Set();\n\n\t\tfor (const value of values) {\n\t\t\tvar reactions = value.reactions;\n\t\t\tif (reactions === null) continue;\n\n\t\t\tfor (const reaction of reactions) {\n\t\t\t\tvar flags = reaction.f;\n\n\t\t\t\tif ((flags & DERIVED) !== 0) {\n\t\t\t\t\tif ((flags & CLEAN) !== 0) set_signal_status(reaction, MAYBE_DIRTY);\n\t\t\t\t\tvalues.add(/** @type {Derived} */ (reaction));\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tvar effect = /** @type {Effect} */ (reaction);\n\t\t\t\tif (effects.has(effect)) continue;\n\t\t\t\teffects.add(effect);\n\n\t\t\t\tif (\n\t\t\t\t\t(flags & (EAGER_EFFECT | INERT | DESTROYED)) === 0 &&\n\t\t\t\t\t// branches that this batch skips don't exist in its view of the world\n\t\t\t\t\t!this.is_skipped(effect)\n\t\t\t\t) {\n\t\t\t\t\tthis.schedule(effect, MAYBE_DIRTY);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Traverse the effect tree, executing effects or stashing\n\t * them for later execution as appropriate\n\t * @param {Effect} root\n\t * @param {Effect[]} effects\n\t * @param {Effect[]} render_effects\n\t * @param {Boundary[]} revealed_boundaries\n\t */\n\t#traverse(root, effects, render_effects, revealed_boundaries) {\n\t\troot.f ^= CLEAN;\n\n\t\tvar effect = root.first;\n\n\t\twhile (effect !== null) {\n\t\t\tvar flags = effect.f;\n\t\t\tvar is_branch = (flags & (BRANCH_EFFECT | ROOT_EFFECT)) !== 0;\n\t\t\tvar is_skippable_branch = is_branch && (flags & CLEAN) !== 0;\n\n\t\t\t// (eager effects run in the real world, see `flush_eager_effects`, not in the view of the batch)\n\t\t\tvar skip =\n\t\t\t\tis_skippable_branch || (flags & (INERT | EAGER_EFFECT)) !== 0 || this.#skips(effect);\n\n\t\t\tif (!skip && effect.fn !== null) {\n\t\t\t\tif (is_branch) {\n\t\t\t\t\teffect.f ^= CLEAN;\n\t\t\t\t} else if ((flags & EFFECT) !== 0) {\n\t\t\t\t\teffects.push(effect);\n\t\t\t\t} else if (async_mode_flag && (flags & (RENDER_EFFECT | MANAGED_EFFECT)) !== 0) {\n\t\t\t\t\trender_effects.push(effect);\n\t\t\t\t} else if (is_dirty(effect)) {\n\t\t\t\t\tupdate_effect(effect);\n\t\t\t\t}\n\n\t\t\t\tvar child = effect.first;\n\n\t\t\t\tif (child !== null) {\n\t\t\t\t\teffect = child;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\twhile (effect !== null) {\n\t\t\t\t// if a pending boundary is now resolved, reveal it\n\t\t\t\tif ((effect.f & (BOUNDARY_EFFECT | DESTROYED)) === BOUNDARY_EFFECT) {\n\t\t\t\t\tvar boundary = /** @type {Boundary} */ (effect.b);\n\n\t\t\t\t\tif (boundary.is_pending && boundary.is_ready(this)) {\n\t\t\t\t\t\trevealed_boundaries.push(boundary);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tvar next = effect.next;\n\n\t\t\t\tif (next !== null) {\n\t\t\t\t\teffect = next;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\teffect = effect.parent;\n\t\t\t}\n\t\t}\n\t}\n\n\t#find_earlier_batch() {\n\t\tfor (var batch = this.prev; batch !== null; batch = batch.prev) {\n\t\t\tif (!batch.is_fork && this.#intersects(batch)) return batch;\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/** @param {Batch} batch */\n\t#intersects(batch) {\n\t\tfor (const source of this.current.keys()) {\n\t\t\tif (batch.current.has(source)) return true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * Take over the writes of a later batch that depends on this one, because it finished first\n\t * or aborted one of this batch's runs.\n\t * Values it produced (async results, deriveds) remain valid; block effects select their\n\t * branches again for this batch, if needed (their selections are keyed by batch)\n\t * @param {Batch} batch\n\t */\n\t#merge(batch) {\n\t\tfor (const target of batch.merge_requests) this.merge_requests.add(target);\n\t\tbatch.merge_requests.clear();\n\n\t\tfor (const [source, entry] of batch.current) {\n\t\t\tif (!this.previous.has(source)) {\n\t\t\t\tconst previous = batch.previous.get(source);\n\t\t\t\tif (previous) this.previous.set(source, previous);\n\t\t\t}\n\n\t\t\tthis.current.set(source, entry);\n\t\t}\n\n\t\tfor (const [effect, deferred] of batch.async_deriveds) {\n\t\t\tconst d = this.async_deriveds.get(effect);\n\t\t\tif (d && d !== deferred) deferred.promise.then(d.resolve, d.reject);\n\t\t\t// The incoming run can still be pending. A subsequent replacement must reach\n\t\t\t// this deferred too, not just the older waiters to which it forwards its result.\n\t\t\tthis.async_deriveds.set(effect, deferred);\n\t\t}\n\n\t\tfor (const [reaction, record] of batch.records ?? []) {\n\t\t\tif ((reaction.f & BLOCK_EFFECT) === 0) {\n\t\t\t\tvar replaced = this.records?.get(reaction);\n\t\t\t\t(this.records ??= new Map()).set(reaction, record);\n\n\t\t\t\t// the run moves to this batch\n\t\t\t\tbatch.records?.delete(reaction);\n\n\t\t\t\t// (once it's replaced, as both batches may hold the same record, see `keep_global_run`)\n\t\t\t\tabort_record(reaction, replaced);\n\t\t\t}\n\t\t}\n\n\t\t// Clear them or else those that are still pending might get rejected on discard (after merged-into batch is done).\n\t\t// This can happen when batch Y merged into X and Y has a pending boundary and therefore still-pending async deriveds inside.\n\t\tbatch.async_deriveds.clear();\n\n\t\t// That pending work is this batch's from now on: it decrements this batch's counts (see `increment_pending`),\n\t\t// so this batch stays linked until the work is done, and receives the effects that a boundary defers until then\n\t\tif (batch.#pending.size > 0) {\n\t\t\tfor (const [effect, count] of batch.#pending) {\n\t\t\t\tthis.#pending.set(effect, (this.#pending.get(effect) ?? 0) + count);\n\t\t\t}\n\n\t\t\tbatch.#pending.clear();\n\t\t}\n\n\t\tif (batch.#unprocessed.size > 0) {\n\t\t\tfor (const [effect, status] of batch.#unprocessed) {\n\t\t\t\tthis.#add_dirty_effect(effect, status);\n\t\t\t}\n\n\t\t\tbatch.#unprocessed.clear();\n\t\t}\n\n\t\t// What the merged batch did on its own (e.g. branches it selected) is obsolete once this batch is\n\t\t// done — whether it commits or is discarded (e.g. because of an error)\n\t\tconst discard = () => batch.discard();\n\t\tthis.oncommit(discard);\n\t\tthis.ondiscard(discard);\n\t\tbatch.merged = this;\n\t\tbatch.#unlink();\n\t}\n\n\t/**\n\t * Note that `effect` needs to be (re-)validated, without downgrading a DIRTY effect to MAYBE_DIRTY\n\t * @param {Effect} effect\n\t * @param {number} status DIRTY or MAYBE_DIRTY\n\t */\n\t#add_dirty_effect(effect, status) {\n\t\tif (status === DIRTY || this.#unprocessed.get(effect) !== DIRTY) {\n\t\t\tthis.#unprocessed.set(effect, status);\n\t\t}\n\t}\n\n\t/**\n\t * @param {Effect[]} effects\n\t */\n\t#defer_effects(effects) {\n\t\tfor (var i = 0; i < effects.length; i += 1) {\n\t\t\tvar effect = effects[i];\n\t\t\tvar status = effect.f & (DIRTY | MAYBE_DIRTY);\n\n\t\t\tif (status !== 0) {\n\t\t\t\tthis.#add_dirty_effect(effect, effect.dv === null ? MAYBE_DIRTY : status);\n\n\t\t\t\t// mark as clean so they get scheduled if they depend on pending async state\n\t\t\t\tset_signal_status(effect, CLEAN);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Associate a change to a given source with the current\n\t * batch, noting its previous and current values (and versions).\n\t * The source itself is only updated if this is its latest value, i.e. unless this\n\t * is a fork (whose writes only exist in its own view of the world) or a later batch\n\t * already wrote to it (e.g. because an async expression resolved in an earlier batch).\n\t * @param {Value} source\n\t * @param {any} value\n\t * @param {boolean} same whether the value equals the real one (it can, if this batch sees another one, see\n\t * `internal_set`) — in which case the source isn't updated, and the value gets the same version\n\t * @param {boolean} [error] whether the value is an error (thrown when read, see `runtime.js#get`)\n\t * @param {Effect[] | null} [updated_during_traversal]\n\t */\n\tcapture(source, value, same, error = false, updated_during_traversal = null) {\n\t\tvar previous = this.previous.get(source);\n\t\tvar later = later_writer(this, source);\n\n\t\tif (previous === undefined) {\n\t\t\t// the value before this batch's change is the one before the later batch's change, if any\n\t\t\tprevious = later?.previous.get(source);\n\n\t\t\t// (A first value has no value from before it, see `previous`. If the later batch's write is the first value,\n\t\t\t// the value before this batch's write is taken to be that one: in the views of other batches and in\n\t\t\t// teardowns, undoing this write then gives the real value, just like not undoing it would)\n\t\t\tif (previous === undefined && source.v !== UNINITIALIZED) {\n\t\t\t\tprevious = {\n\t\t\t\t\tv: source.v,\n\t\t\t\t\twv: source.wv,\n\t\t\t\t\te: (source.f & ERROR_VALUE) !== 0,\n\t\t\t\t\tassigned: (source.f & ASSIGNED) !== 0\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif (previous !== undefined) this.previous.set(source, previous);\n\t\t}\n\n\t\tif (is_destroying_effect) {\n\t\t\tteardown_write(source);\n\t\t} else if (previous !== undefined) {\n\t\t\tteardown_context?.reverted_values.set(source, previous);\n\t\t\tteardown_context?.derived_cache.clear();\n\t\t}\n\n\t\t/** @type {BatchValue} */\n\t\tvar entry = {\n\t\t\tv: value,\n\t\t\twv: same ? source.wv : increment_write_version(),\n\t\t\te: error,\n\t\t\t// a write to a derived is an assignment\n\t\t\tassigned: (source.f & DERIVED) !== 0,\n\t\t\tasync: (source.f & ASYNC) !== 0\n\t\t};\n\n\t\tthis.current.set(source, entry);\n\n\t\tif (is_flushing_effects) {\n\t\t\t(captured_writes ??= new Set()).add(source);\n\t\t}\n\n\t\t// The active view of the world sees writes made while it's active, even if they don't belong to the batch whose\n\t\t// view it is — e.g. those of effects that run while a batch commits, which go to a new batch. (Async results\n\t\t// are only captured while no view is active, see `async_derived`)\n\t\tbatch_values?.set(source, entry);\n\n\t\t// an assignment replaces the value of a derived that the active view of the world holds\n\t\tview_cache?.delete(/** @type {Derived} */ (source));\n\n\t\t// in order, this batch's change comes before that of the later batch, which replaces it (this happens when a\n\t\t// result arrives in a batch that committed while it was pending, see `#move_to_front`)\n\t\tif (!this.is_fork && later !== null) later.previous.set(source, entry);\n\n\t\tif (!this.is_fork && !same && later === null) {\n\t\t\tapply(source, entry);\n\t\t}\n\n\t\t// A value that equals the real one, with the same version, changes nothing that reactions\n\t\t// could read outside this batch's view — which is revalidated when the batch is processed\n\t\tif (!same) {\n\t\t\tseen = null;\n\t\t\tcount_deps = 0;\n\t\t\tthis.mark(source, DIRTY, updated_during_traversal);\n\t\t\tseen = null;\n\n\t\t\tif (eager_effects.size > 0 && !eager_effects_deferred) {\n\t\t\t\tflush_eager_effects();\n\t\t\t}\n\t\t}\n\t}\n\n\tdeactivate() {\n\t\tcurrent_batch = processing_batch = batch_values = view_cache = view_batch = null;\n\t}\n\n\tflush() {\n\t\t// flushes can be nested, e.g. if an effect calls `flushSync`\n\t\tvar context = push_teardown_context(this.previous);\n\n\t\ttry {\n\t\t\tthis.#process();\n\n\t\t\t// (the size check avoids allocating an iterator in the common case)\n\t\t\tif (rebases.size > 0) {\n\t\t\t\tfor (const batch of rebases) {\n\t\t\t\t\trebases.delete(batch);\n\n\t\t\t\t\t// the batch is processed again anyway if a flush is queued\n\t\t\t\t\tif (batch.linked && !batch.#decrement_queued) {\n\t\t\t\t\t\tbatch.#process();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} finally {\n\t\t\tflush_count = 0;\n\t\t\tlast_scheduled_effect = null;\n\t\t\tcollected_effects = null;\n\t\t\tlegacy_updates = null;\n\n\t\t\tteardown_context = context.parent;\n\t\t\tthis.deactivate();\n\n\t\t\tif (DEV) {\n\t\t\t\tfor (const source of source_stacks) {\n\t\t\t\t\tsource.updated = null;\n\t\t\t\t}\n\n\t\t\t\tsource_stacks.clear();\n\t\t\t}\n\t\t}\n\t}\n\n\tdiscard() {\n\t\tthis.#run_callbacks(this.#discard_callbacks);\n\n\t\tfor (const deferred of this.async_deriveds.values()) {\n\t\t\tdeferred.reject(OBSOLETE);\n\t\t}\n\n\t\tthis.#unlink();\n\t\tthis.#deferred?.resolve();\n\t}\n\n\t#commit() {\n\t\t// If there are other pending batches, they now need to be 'rebased' —\n\t\t// in other words, their view of the world now includes the newly committed\n\t\t// state (unless the batch in question has a more recent value for a given source),\n\t\t// so everything that depends on it needs to be re-validated in their view\n\t\tfor (let batch = first_batch; batch !== null; batch = batch.next) {\n\t\t\tif (batch === this) continue;\n\n\t\t\tvar is_earlier = batch.id < this.id;\n\n\t\t\t/** @type {Source[]} */\n\t\t\tvar sources = [];\n\n\t\t\tfor (const [source, entry] of this.current) {\n\t\t\t\tvar own = batch.current.get(source);\n\n\t\t\t\tif (own !== undefined) {\n\t\t\t\t\tif (is_earlier && entry.v !== own.v && !own.async) {\n\t\t\t\t\t\t// bring the value up to date\n\t\t\t\t\t\tbatch.current.set(source, entry);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// same value, later batch has more recent value, or the batch's own result\n\t\t\t\t\t\t// of an async expression — no need to re-run these effects\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tsources.push(source);\n\t\t\t}\n\n\t\t\t// If not started yet or no sources to update (which is e.g. possible for the very first batch) then bail\n\t\t\tif (!batch.started || batch.current.size === 0) continue;\n\n\t\t\tvar obsolete = true;\n\n\t\t\tfor (const source of batch.current.keys()) {\n\t\t\t\tif (!this.current.has(source)) {\n\t\t\t\t\tobsolete = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (obsolete && is_earlier) {\n\t\t\t\t// this batch is now obsolete and can be discarded\n\t\t\t\tbatch.discard();\n\t\t\t} else if (sources.length > 0) {\n\t\t\t\t// The microtask queue can contain the batch already scheduled to run right\n\t\t\t\t// after this one is finished, so throwing the invariant would be wrong here.\n\t\t\t\tif (DEV && !batch.#decrement_queued) {\n\t\t\t\t\tinvariant(batch.#scheduled.length === 0, 'Batch has scheduled effects');\n\t\t\t\t}\n\n\t\t\t\t// Everything that depends on the committed values needs to be re-validated in the\n\t\t\t\t// batch's view. The batch is processed again once the current flush is done (which\n\t\t\t\t// also re-validates what depends on its own writes, as the committed batch may have\n\t\t\t\t// created reactions that read them), so that block effects select their branches\n\t\t\t\t// and async work restarts in the new view right away\n\t\t\t\tbatch.#revalidate(sources);\n\t\t\t\trebases.add(batch);\n\t\t\t}\n\t\t}\n\n\t\t// The writes are part of the real world now. A batch that is still linked (because of pending work)\n\t\t// only has writes again once that work resolves, which it then commits\n\t\tthis.current.clear();\n\t\tthis.previous.clear();\n\t}\n\n\t/**\n\t * Make this batch's writes the real world, part of every other batch's view (see `#commit`).\n\t * If it has pending work it stays linked, coming first from now on (see `#move_to_front`)\n\t */\n\tcommit_writes() {\n\t\tthis.#commit();\n\t\tif (this.linked && this.prev !== null) this.#move_to_front();\n\t}\n\n\t/**\n\t * @param {Effect} effect\n\t */\n\tincrement(effect) {\n\t\tvar count = this.#pending.get(effect) ?? 0;\n\t\tthis.#pending.set(effect, count + 1);\n\t}\n\n\t/**\n\t * @param {Effect} effect\n\t */\n\tdecrement(effect) {\n\t\tvar count = this.#pending.get(effect) ?? 0;\n\n\t\tif (count === 1) {\n\t\t\tthis.#pending.delete(effect);\n\t\t} else {\n\t\t\tthis.#pending.set(effect, count - 1);\n\t\t}\n\n\t\tif (this.#decrement_queued) return;\n\t\tthis.#decrement_queued = true;\n\n\t\tqueue_micro_task(() => {\n\t\t\tthis.#decrement_queued = false;\n\n\t\t\tif (this.linked) {\n\t\t\t\tthis.flush();\n\t\t\t}\n\t\t});\n\t}\n\n\t/** @param {(batch: Batch) => void} fn */\n\toncommit(fn) {\n\t\tthis.#commit_callbacks.set(fn, eager_block_writes?.size ? eager_block_writes : null);\n\t}\n\n\t/** @param {(batch: Batch) => void} fn */\n\tondiscard(fn) {\n\t\tthis.#discard_callbacks.set(fn, eager_block_writes?.size ? eager_block_writes : null);\n\t}\n\n\t/**\n\t * Runs the commit/discard callbacks.\n\t * A callback that was added while block effects re-ran eagerly detaches the branches that such a run\n\t * deselected (see `flush_queued_effects`). The teardowns it causes see the writes that applied in the\n\t * run's view, like they would have during the run: of the values that the current teardown context\n\t * reverts, the writes of the effects that ran before the one whose writes caused the run are restored.\n\t * Callbacks run untracked, because a batch can commit while an effect runs (e.g. one that calls `flushSync`)\n\t * @param {Map<(batch: Batch) => void, Map<Value, BatchValue> | null>} callbacks\n\t */\n\t#run_callbacks(callbacks) {\n\t\tuntrack(() => {\n\t\t\tfor (const [fn, writes] of callbacks) {\n\t\t\t\tif (writes === null) {\n\t\t\t\t\tfn(this);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tvar context = push_teardown_context();\n\n\t\t\t\tfor (const [source, write] of writes) {\n\t\t\t\t\tif (context.reverted_values.has(source)) context.reverted_values.set(source, write);\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tfn(this);\n\t\t\t\t} finally {\n\t\t\t\t\tteardown_context = context.parent;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tcallbacks.clear();\n\t}\n\n\tsettled() {\n\t\treturn (this.#deferred ??= deferred()).promise;\n\t}\n\n\tstatic ensure() {\n\t\tif (current_batch === null) {\n\t\t\tconst batch = (current_batch = new Batch());\n\n\t\t\tif (processing_batch === null && !is_flushing_sync) {\n\t\t\t\tqueue_micro_task(() => {\n\t\t\t\t\tif (!batch.started) {\n\t\t\t\t\t\tbatch.flush();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\treturn current_batch;\n\t}\n\n\t/**\n\t * Make this the current batch, and its view of the world the active one\n\t */\n\tactivate() {\n\t\tcurrent_batch = this;\n\t\tview_batch = this;\n\n\t\t// Async continuations can create or run reactions in another batch's view without\n\t\t// processing it. The next flush must re-validate those reactions in its own view.\n\t\tif (last_processed !== this.id) last_processed = null;\n\n\t\tif (!async_mode_flag) {\n\t\t\tbatch_values = view_cache = null;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.folded = [];\n\n\t\tif (!this.is_fork && this.prev === null && this.next === null) {\n\t\t\t// this batch's view is the real world\n\t\t\tbatch_values = view_cache = null;\n\t\t\treturn;\n\t\t}\n\n\t\t// if there are multiple batches, we are 'time travelling' —\n\t\t// we need to override values with the ones in this batch...\n\t\tbatch_values = new Map(this.current);\n\t\tview_cache = new Map();\n\n\t\t// ...and undo changes belonging to other batches unless they intersect\n\t\tfor (let batch = first_batch; batch !== null; batch = batch.next) {\n\t\t\tif (batch === this || batch.is_fork) continue;\n\n\t\t\t// Since the latter batch merges into the earlier (if it resolves before the earlier one),\n\t\t\t// we treat the earlier values as \"already applied\". This way we don't need to rerun async\n\t\t\t// effects of the earlier batch in case they are merged.\n\t\t\t// As a result you can think of batch_values as having the latest values of all intersecting\n\t\t\t// batches up until this batch.\n\t\t\tif (batch.id < this.id && batch.#intersects(this)) {\n\t\t\t\tthis.folded.push(batch);\n\t\t\t} else {\n\t\t\t\tfor (const [source, previous] of batch.previous) {\n\t\t\t\t\t// (where the views agree on the value, the real one — and its version — applies. Not for an\n\t\t\t\t\t// assigned derived: its value before may have been computed in another view, see `get_view`)\n\t\t\t\t\tif (\n\t\t\t\t\t\t!batch_values.has(source) &&\n\t\t\t\t\t\t((source.f & DERIVED) !== 0 || !source.equals(previous.v))\n\t\t\t\t\t) {\n\t\t\t\t\t\tbatch_values.set(source, previous);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * The record of `reaction` in this batch's view of the world, i.e. that of this batch\n\t * or of the (earlier) batches whose changes it includes, if any\n\t * @param {Reaction} reaction\n\t * @returns {BatchRecord | undefined}\n\t */\n\tget_record(reaction) {\n\t\tvar record = this.records?.get(reaction);\n\t\tvar i = this.folded.length;\n\n\t\twhile (record === undefined && i--) {\n\t\t\trecord = this.folded[i].records?.get(reaction);\n\t\t}\n\n\t\treturn record;\n\t}\n\n\t/**\n\t * @param {Value} signal\n\t * @param {number} status should be DIRTY or MAYBE_DIRTY\n\t * @param {Effect[] | null} [updated_during_traversal]\n\t * @returns {void}\n\t */\n\tmark(signal, status, updated_during_traversal = null) {\n\t\tvar reactions = signal.reactions;\n\t\tif (reactions === null) return;\n\n\t\tvar runes = is_runes();\n\t\tvar length = reactions.length;\n\n\t\tcount_deps += length;\n\t\t// Activate the `seen` Set if we think from the unusually high number of deps that\n\t\t// there might be cycles in the graph, to avoid repeated lookups for reactions\n\t\t// Example: https://github.com/sveltejs/svelte/issues/16658 has a graph with one source\n\t\t// reaching ~10000 distinct deriveds/effects each, resulting in 65 million walks through repeated visits.\n\t\tif (count_deps > 100000 && seen === null) seen = new Set();\n\n\t\tif (seen !== null) {\n\t\t\tif (seen.has(signal)) return;\n\t\t\tseen.add(signal);\n\t\t}\n\n\t\tfor (var i = 0; i < length; i++) {\n\t\t\tvar reaction = reactions[i];\n\t\t\tvar flags = reaction.f;\n\n\t\t\t// In legacy mode, skip the current effect to prevent infinite loops\n\t\t\tif (!runes && reaction === active_effect) continue;\n\n\t\t\tvar not_dirty = (flags & DIRTY) === 0;\n\n\t\t\tif ((flags & EAGER_EFFECT) !== 0) {\n\t\t\t\tif (!this.is_fork) {\n\t\t\t\t\t// don't set a DIRTY reaction to MAYBE_DIRTY\n\t\t\t\t\tif (not_dirty) {\n\t\t\t\t\t\tset_signal_status(reaction, status);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Eager effects need to run immediately:\n\t\t\t\t\t// - for $inspect so that the stack trace makes sense\n\t\t\t\t\t// - for $state.eager because they might be without an effect parent\n\t\t\t\t\teager_effects.add(/** @type {Effect} */ (reaction));\n\t\t\t\t}\n\t\t\t} else if ((flags & DERIVED) !== 0) {\n\t\t\t\t// don't set a DIRTY reaction to MAYBE_DIRTY\n\t\t\t\tif (not_dirty) {\n\t\t\t\t\tset_signal_status(reaction, status);\n\t\t\t\t}\n\n\t\t\t\tvar derived = /** @type {Derived} */ (reaction);\n\n\t\t\t\tview_cache?.delete(derived);\n\t\t\t\tthis.mark(derived, MAYBE_DIRTY, updated_during_traversal);\n\t\t\t} else if (not_dirty) {\n\t\t\t\tvar effect = /** @type {Effect} */ (reaction);\n\n\t\t\t\tif ((flags & BLOCK_EFFECT) !== 0 && eager_block_effects !== null) {\n\t\t\t\t\t// these run right away to find out which branches the rest of the flush must skip\n\t\t\t\t\t// (see `flush_queued_effects`); the DOM changes when this batch commits\n\t\t\t\t\tset_signal_status(effect, status);\n\t\t\t\t\teager_block_effects.add(effect);\n\t\t\t\t}\n\n\t\t\t\tif (updated_during_traversal !== null) {\n\t\t\t\t\tset_signal_status(effect, status);\n\t\t\t\t\tupdated_during_traversal.push(effect);\n\t\t\t\t} else {\n\t\t\t\t\t// the status is applied when the batch is processed\n\t\t\t\t\tthis.schedule(effect, status);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Schedule `effect` to be (re-)validated when this batch is processed. Its status only applies right\n\t * away if this is the batch that the current flush processes (next), or if a reaction is running (which\n\t * may have read what changed). Otherwise, whether an effect is dirty depends on this batch's view of the\n\t * world, so other batches (which may be processed first) mustn't see it: it is kept with this batch until\n\t * it is processed, and then checked against the exact versions of its dependencies (i.e. MAYBE_DIRTY)\n\t * @param {Effect} effect\n\t * @param {number} status DIRTY or MAYBE_DIRTY\n\t */\n\tschedule(effect, status) {\n\t\tlast_scheduled_effect = effect;\n\n\t\t// While another batch is committed, effects that this batch's writes affect (other than the one\n\t\t// that is running, i.e. writing) wait for it to be processed, rather than running as part of that commit.\n\t\t// They may still run as part of it (for that batch's reasons) and see the write, so versions decide — unless\n\t\t// the effect is running, in which case it would record the version it didn't see (see `update_dependencies`)\n\t\tif (view_batch !== null && view_batch !== this && effect !== active_reaction) {\n\t\t\tthis.#add_dirty_effect(\n\t\t\t\teffect,\n\t\t\t\t(effect.f & REACTION_IS_UPDATING) !== 0 ? status : MAYBE_DIRTY\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tif (processing_batch !== this && active_reaction === null) {\n\t\t\tif (this.prev !== null || this.next !== null || this.is_fork) {\n\t\t\t\tthis.#add_dirty_effect(effect, MAYBE_DIRTY);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tstatus = MAYBE_DIRTY;\n\t\t}\n\n\t\tthis.#add(effect, status);\n\t}\n\n\t/**\n\t * @param {Effect} effect\n\t * @param {number} status\n\t */\n\t#add(effect, status) {\n\t\t// don't set a DIRTY effect to MAYBE_DIRTY\n\t\tif ((effect.f & DIRTY) === 0) {\n\t\t\tset_signal_status(effect, status);\n\t\t}\n\n\t\tthis.#scheduled.push(effect);\n\t}\n\n\t/** @param {boolean} commit whether the effects' runs become global state */\n\t#release_records(commit = false) {\n\t\tvar records = this.records;\n\t\tif (records === null) return;\n\n\t\t// Release ownership before pruning. Merged runs are retained by the receiving batch\n\t\tthis.records = null;\n\t\tfor (const [reaction, record] of records) {\n\t\t\t// A derived's record is a run in this batch's view: it is only the real-world value if its\n\t\t\t// dependencies still hold what it read, which is checked where a record is promoted on read\n\t\t\t// (see `update_derived`) and cannot be checked here. So it is dropped rather than promoted,\n\t\t\t// and its edges are left for its next global run to prune (see `prune_edges`). A destroyed\n\t\t\t// reaction has nothing left to update either\n\t\t\tif ((reaction.f & (DERIVED | DESTROYED)) === 0) {\n\t\t\t\t// Keep a newer committed async run instead of promoting an outdated record.\n\t\t\t\t// Otherwise, the effect would rerun and restart its async work in every batch.\n\t\t\t\tvar replaced = (reaction.f & ASYNC) !== 0 && is_outdated(record) && !is_outdated(reaction);\n\n\t\t\t\tif (commit && !replaced) {\n\t\t\t\t\tpromote_record(reaction, record);\n\n\t\t\t\t\t// The committed run is now what applies in the view of every batch without a run of the async\n\t\t\t\t\t// effect of its own (typically because the batch committed while its run was pending, inside a\n\t\t\t\t\t// pending boundary). Their in-flight runs are superseded: their results would overwrite this one\n\t\t\t\t\t// TODO feels pretty hacky and indication of an X-Y problem: This only works because !b.records?.has(reaction)\n\t\t\t\t\t// means \"this would re-use the real world result, i.e. the one we just committed, so we can reject this old run\".\n\t\t\t\t\t// This can reject runs too early in pending batches. The superseding batch eventually settles them,\n\t\t\t\t\t// but async/if blocks inside pending boundaries should be excluded.\n\t\t\t\t\tif ((reaction.f & ASYNC) !== 0) {\n\t\t\t\t\t\tfor (let b = first_batch; b !== null; b = b.next) {\n\t\t\t\t\t\t\tif (b !== this && !b.records?.has(reaction)) {\n\t\t\t\t\t\t\t\tb.async_deriveds.get(/** @type {Effect} */ (reaction))?.reject(OBSOLETE);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tprune_edges(reaction);\n\t\t\t}\n\n\t\t\t// abort this run - if it was promoted to global, or another batch holds it, too, this is a noop\n\t\t\tabort_record(reaction, record);\n\t\t}\n\t}\n\n\t/**\n\t * A batch that committed while work inside a pending boundary was in flight stays linked, so that the results\n\t * arrive in it. Its writes are the real world now, part of every other batch's view, so it comes first from now\n\t * on: This ensures logic about who sees what values in intersects/merge/etc work correctly.\n\t */\n\t#move_to_front() {\n\t\tvar prev = /** @type {Batch} */ (this.prev);\n\t\tvar first = /** @type {Batch} */ (first_batch);\n\n\t\tprev.next = this.next;\n\t\tif (this.next === null) last_batch = prev;\n\t\telse this.next.prev = prev;\n\n\t\tthis.prev = null;\n\t\tthis.next = first;\n\t\tfirst.prev = first_batch = this;\n\t\tthis.id = first.id - 1;\n\t}\n\n\t#unlink() {\n\t\t// #merge calls #unlink, discard later on does it again - prevent\n\t\t// running it multiple times to not corrupt the linked list\n\t\tif (!this.linked) return;\n\n\t\tvar prev = this.prev;\n\t\tvar next = this.next;\n\n\t\tif (prev === null) {\n\t\t\tfirst_batch = next;\n\t\t} else {\n\t\t\tprev.next = next;\n\t\t}\n\n\t\tif (next === null) {\n\t\t\tlast_batch = prev;\n\t\t} else {\n\t\t\tnext.prev = prev;\n\t\t}\n\n\t\tthis.linked = false;\n\t\tthis.#release_records();\n\t}\n}\n\n// TODO Svelte@6 think about removing the callback argument.\n/**\n * Called each time a batch has updated the content, before its user effects run, if set. Custom renderers\n * use this to keep the content of crossings that share a container in the order of their host nodes\n * (see `custom-renderer/containers.js`), so that effects never see them in a stale order\n * @type {(() => void) | null}\n */\nlet before_effects = null;\n\n/**\n * @param {(() => void) | null} fn\n */\nexport function set_before_effects(fn) {\n\tbefore_effects = fn;\n}\n\n/**\n * Synchronously flush any pending updates.\n * Returns void if no callback is provided, otherwise returns the result of calling the callback.\n * @template [T=void]\n * @param {(() => T) | undefined} [fn]\n * @returns {T}\n */\nexport function flushSync(fn) {\n\tvar was_flushing_sync = is_flushing_sync;\n\t// e.g. flushSync during effect flushing phase - we gotta restore the view_batch afterwards in that case\n\tvar previous_view_batch = view_batch !== current_batch ? view_batch : null;\n\tis_flushing_sync = true;\n\n\ttry {\n\t\tvar result;\n\n\t\tif (fn) {\n\t\t\tflushSync(); // flush anything pending through the while loop below\n\n\t\t\tresult = fn();\n\t\t}\n\n\t\twhile (true) {\n\t\t\tflush_tasks();\n\n\t\t\tif (current_batch === null) {\n\t\t\t\treturn /** @type {T} */ (result);\n\t\t\t}\n\n\t\t\tcurrent_batch.flush();\n\t\t}\n\t} finally {\n\t\tis_flushing_sync = was_flushing_sync;\n\t\tview_batch = previous_view_batch;\n\t}\n}\n\nfunction infinite_loop_guard() {\n\tif (DEV) {\n\t\tvar updates = new Map();\n\n\t\tfor (const source of /** @type {Batch} */ (current_batch).current.keys()) {\n\t\t\tfor (const [stack, update] of source.updated ?? []) {\n\t\t\t\tvar entry = updates.get(stack);\n\n\t\t\t\tif (!entry) {\n\t\t\t\t\tentry = { error: update.error, count: 0 };\n\t\t\t\t\tupdates.set(stack, entry);\n\t\t\t\t}\n\n\t\t\t\tentry.count += update.count;\n\t\t\t}\n\t\t}\n\n\t\tfor (const update of updates.values()) {\n\t\t\tif (update.error) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error(update.error);\n\t\t\t}\n\t\t}\n\t}\n\n\ttry {\n\t\te.effect_update_depth_exceeded();\n\t} catch (error) {\n\t\tif (DEV) {\n\t\t\t// stack contains no useful information, replace it\n\t\t\tdefine_property(error, 'stack', { value: '' });\n\t\t}\n\n\t\t// Best effort: invoke the boundary nearest the most recent\n\t\t// effect and hope that it's relevant to the infinite loop\n\t\tinvoke_error_boundary(error, last_scheduled_effect);\n\t}\n}\n\nvar is_flushing_effects = false;\n\n/**\n * Sources captured since the last effect in `flush_queued_effects` finished, including\n * writes by its eager block reruns. Nested flushes use their own collector.\n * @type {Set<Value> | null}\n */\nvar captured_writes = null;\n\n/** @type {Set<Effect> | null} */\nexport let eager_block_effects = null;\n\n/**\n * While block effects re-run eagerly (see `flush_queued_effects`), the writes of the effects that ran before the one\n * whose writes caused the re-runs, which apply in their view (possibly none). `null` otherwise. The branches that\n * these runs select/unskip are only appended (and those they skip detached) when the batch with the writes commits\n * (see `should_defer_append`), and the teardowns that this causes see these writes, too (see `#run_callbacks`)\n * @type {Map<Value, BatchValue> | null}\n */\nexport let eager_block_writes = null;\n\n/**\n * An effect (as opposed to a render effect, which keeps the offscreen content up to date) inside a boundary\n * that is still pending doesn't run when the batch commits. The boundary keeps it until it is revealed,\n * and hands it to the batch that reveals it (see `Boundary#reveal`)\n * TODO I feel like there's probably a less roundabout way to achieve this\n * @param {Effect} effect\n * @returns {boolean} whether the effect was deferred\n */\nfunction defer_if_pending(effect) {\n\t// A boundary is only pending while its content is new, so an effect that\n\t// has run before can't be inside one, and we can skip the lookup\n\tif ((effect.f & (EFFECT | REACTION_RAN)) !== EFFECT) return false;\n\n\tfor (var boundary = effect.b; boundary !== null; boundary = boundary.parent) {\n\t\tif (boundary.is_pending) {\n\t\t\tboundary.defer_effect(effect);\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * `earlier_writes` includes writes from the pre-effect phase. Eager block teardowns\n * revert the running effect's writes, but not these earlier writes.\n * @param {Array<Effect>} effects\n * @param {Map<Value, BatchValue> | null} [earlier_writes]\n * @returns {Map<Value, BatchValue> | null}\n */\nfunction flush_queued_effects(effects, earlier_writes = null) {\n\tvar length = effects.length;\n\tif (length === 0) return earlier_writes;\n\n\tvar i = 0;\n\n\twhile (i < length) {\n\t\tvar effect = effects[i++];\n\n\t\tif (\n\t\t\t(effect.f & (DESTROYED | INERT)) === 0 &&\n\t\t\t// don't run if already marked for destruction in the next batch\n\t\t\t// (this can happen if an effect writes a value which e.g. makes an if block falsy)\n\t\t\t!current_batch?.is_skipped(effect) &&\n\t\t\t!defer_if_pending(effect) &&\n\t\t\tis_dirty(effect)\n\t\t) {\n\t\t\teager_block_effects = new Set();\n\n\t\t\tvar version = write_version;\n\t\t\tupdate_effect(effect);\n\n\t\t\t// Effects with no dependencies or teardown do not get added to the effect tree.\n\t\t\t// Deferred effects (e.g. `$effect(...)`) _are_ added to the tree because we\n\t\t\t// don't know if we need to keep them until they are executed. Doing the check\n\t\t\t// here (rather than in `update_effect`) allows us to skip the work for\n\t\t\t// immediate effects.\n\t\t\tif (\n\t\t\t\teffect.edges === null &&\n\t\t\t\teffect.first === null &&\n\t\t\t\teffect.nodes === null &&\n\t\t\t\teffect.teardown === null &&\n\t\t\t\teffect.ac === null\n\t\t\t) {\n\t\t\t\t// remove this effect from the graph\n\t\t\t\tunlink_effect(effect);\n\t\t\t}\n\n\t\t\t// If update_effect() has a flushSync() in it, we may have flushed another flush_queued_effects(),\n\t\t\t// which already handled this logic and did set eager_block_effects to null.\n\t\t\tif (eager_block_effects?.size > 0) {\n\t\t\t\t// these run because of the writes of the effect, so their teardowns revert those\n\t\t\t\tvar previous_teardown_context = teardown_context;\n\n\t\t\t\t// if state was written by an effect before the one that caused the eager\n\t\t\t\t// block rerun, its writes apply in this view. Deriveds must be evaluated\n\t\t\t\t// afresh rather than reusing results cached before those writes.\n\t\t\t\tif (earlier_writes !== null) push_teardown_context(earlier_writes);\n\n\t\t\t\t// (a copy, as `earlier_writes` grows while the flush continues)\n\t\t\t\tvar previous_eager_block_writes = eager_block_writes;\n\t\t\t\teager_block_writes = new Map(earlier_writes);\n\n\t\t\t\ttry {\n\t\t\t\t\tfor (const e of eager_block_effects) {\n\t\t\t\t\t\t// Skip eager effects that have already been unmounted, or that are inside a\n\t\t\t\t\t\t// branch that an earlier eager run (e.g. of an ancestor block) skips\n\t\t\t\t\t\tif ((e.f & (DESTROYED | INERT)) !== 0 || current_batch?.is_skipped(e)) continue;\n\n\t\t\t\t\t\t// Run effects in order from ancestor to descendant, else we could run into nullpointers\n\t\t\t\t\t\t/** @type {Effect[]} */\n\t\t\t\t\t\tconst ordered_effects = [e];\n\t\t\t\t\t\tlet ancestor = e.parent;\n\t\t\t\t\t\twhile (ancestor !== null) {\n\t\t\t\t\t\t\tif (eager_block_effects.has(ancestor)) {\n\t\t\t\t\t\t\t\teager_block_effects.delete(ancestor);\n\t\t\t\t\t\t\t\tordered_effects.push(ancestor);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tancestor = ancestor.parent;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfor (let j = ordered_effects.length - 1; j >= 0; j--) {\n\t\t\t\t\t\t\tconst e = ordered_effects[j];\n\t\t\t\t\t\t\t// a block run may have skipped/destroyed the branch that a later one is in\n\t\t\t\t\t\t\tif ((e.f & (DESTROYED | INERT)) !== 0 || current_batch?.is_skipped(e)) continue;\n\t\t\t\t\t\t\tupdate_effect(e);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} finally {\n\t\t\t\t\teager_block_writes = previous_eager_block_writes;\n\t\t\t\t\teager_block_effects?.clear();\n\t\t\t\t\tteardown_context = previous_teardown_context;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Only visit sources captured by this effect or its eager block reruns.\n\t\t\t// A nested flush may have drained their batch, so use the current entry.\n\t\t\tif (write_version !== version && current_batch !== null && captured_writes !== null) {\n\t\t\t\tfor (const value of captured_writes) {\n\t\t\t\t\tvar write = current_batch.current.get(value);\n\t\t\t\t\tif (write !== undefined && write.wv > version) {\n\t\t\t\t\t\t(earlier_writes ??= new Map()).set(value, write);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tcaptured_writes?.clear();\n\t}\n\n\teager_block_effects = null;\n\treturn earlier_writes;\n}\n\n/**\n * The next batch after `batch` that wrote `source`, if any. Its write comes after one of `batch` in order, so\n * that one isn't the real-world value. Forks are skipped: their writes only exist in their own view of the world\n * @param {Batch} batch\n * @param {Value} source\n */\nfunction later_writer(batch, source) {\n\tvar later = batch.next;\n\n\twhile (later !== null && (later.is_fork || !later.current.has(source))) {\n\t\tlater = later.next;\n\t}\n\n\treturn later;\n}\n\n/**\n * Make a write the real-world value of `source`. A write to a derived is an assignment, whose\n * value holds until one of the derived's dependencies is written after it (see `changed_since`)\n * @param {Value} source\n * @param {BatchValue} entry\n */\nfunction apply(source, entry) {\n\tsource.v = entry.v;\n\tsource.wv = entry.wv;\n\tsource.f = entry.e ? source.f | ERROR_VALUE : source.f & ~ERROR_VALUE;\n\n\tif ((source.f & DERIVED) !== 0) {\n\t\tsource.f |= ASSIGNED;\n\t\tupdate_derived_status(/** @type {Derived} */ (source));\n\t}\n}\n\n/** @type {Source<number>[]} */\nlet eager_versions = [];\n\nfunction eager_flush() {\n\tflushSync(() => {\n\t\tconst eager = eager_versions;\n\t\teager_versions = [];\n\t\tfor (const version of eager) {\n\t\t\tupdate(version);\n\t\t}\n\t});\n}\n\n/** @type {Map<Reaction, Source<number>>} */\nvar version_map = new Map();\n\n/**\n * Implementation of `$state.eager(fn())`\n * @template T\n * @param {() => T} fn\n * @returns {T}\n */\nexport function eager(fn) {\n\tvar initial = true;\n\tvar value = /** @type {T} */ (undefined);\n\n\tif (active_reaction === null) {\n\t\treturn fn();\n\t}\n\n\tlet parent = active_reaction;\n\n\tlet version = version_map.get(parent) ?? source(0);\n\tversion_map.set(parent, version);\n\n\tif (DEV) {\n\t\tversion.label ??= '$state.eager version';\n\t}\n\n\tteardown(() => {\n\t\tif (parent.f & DESTROYING) version_map.delete(parent);\n\t});\n\n\tget(version);\n\n\t// evaluate in the real world — including recording the versions of the dependencies,\n\t// so that the eager effect is dirty-checked correctly later (see `flush_eager_effects`)\n\tin_real_world(() => {\n\t\teager_effect(() => {\n\t\t\tif (initial) {\n\t\t\t\t// the first time this runs, we create an eager effect\n\t\t\t\t// that will run eagerly whenever the expression changes\n\t\t\t\tvalue = fn();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// the second time this effect runs, it's to schedule a\n\t\t\t// `version` update. since this will recreate the effect,\n\t\t\t// we don't need to evaluate the expression here\n\t\t\tif (eager_versions.length === 0) {\n\t\t\t\tqueue_micro_task(eager_flush);\n\t\t\t}\n\n\t\t\teager_versions.push(version);\n\t\t});\n\t});\n\n\tinitial = false;\n\n\treturn value;\n}\n\n/**\n * Run `fn` with the real world (i.e. the latest values) as the active view, regardless of which batch is active\n * @param {() => void} fn\n */\nexport function in_real_world(fn) {\n\tvar previous_batch_values = batch_values;\n\tvar previous_view_cache = view_cache;\n\tvar previous_view_batch = view_batch;\n\n\t// the real world doesn't belong to a batch, so what runs in it doesn't touch the active batch's records\n\tbatch_values = view_cache = view_batch = null;\n\n\ttry {\n\t\tfn();\n\t} finally {\n\t\tbatch_values = previous_batch_values;\n\t\tview_cache = previous_view_cache;\n\t\tview_batch = previous_view_batch;\n\t}\n}\n\n/**\n * Mark all the effects inside a skipped branch CLEAN, so that they can be correctly\n * rescheduled later (if the branch survives, its effects are re-validated, see `unskip_effect`)\n * @param {Effect} effect\n * @param {boolean} force reset even clean branches following an error\n */\nfunction reset_branch(effect, force = false) {\n\t// clean branch = nothing dirty inside, no need to traverse further\n\tif (!force && (effect.f & BRANCH_EFFECT) !== 0 && (effect.f & CLEAN) !== 0) {\n\t\treturn;\n\t}\n\n\tset_signal_status(effect, CLEAN);\n\n\tvar e = effect.first;\n\twhile (e !== null) {\n\t\treset_branch(e, force);\n\t\te = e.next;\n\t}\n}\n\n/**\n * Creates a 'fork', in which state changes are evaluated but not applied to the DOM.\n * This is useful for speculatively loading data (for example) when you suspect that\n * the user is about to take some action.\n *\n * Frameworks like SvelteKit can use this to preload data when the user touches or\n * hovers over a link, making any subsequent navigation feel instantaneous.\n *\n * The `fn` parameter is a synchronous function that modifies some state. The\n * state changes will be reverted after the fork is initialised, then reapplied\n * if and when the fork is eventually committed.\n *\n * When it becomes clear that a fork will _not_ be committed (e.g. because the\n * user navigated elsewhere), it must be discarded to avoid leaking memory.\n *\n * @param {() => void} fn\n * @returns {Fork}\n * @since 5.42\n */\nexport function fork(fn) {\n\tif (!async_mode_flag) {\n\t\te.experimental_async_required('fork');\n\t}\n\n\tif (active_effect !== null || current_batch?.is_fork) {\n\t\te.fork_timing();\n\t}\n\n\tvar batch = flushSync(() => {\n\t\tvar batch = Batch.ensure();\n\t\tbatch.is_fork = true;\n\n\t\ttry {\n\t\t\tin_real_world(() => {\n\t\t\t\tbatch_values = new Map();\n\t\t\t\tview_cache = new Map();\n\t\t\t\tview_batch = batch;\n\n\t\t\t\tfn();\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tbatch.discard();\n\t\t\tbatch.deactivate();\n\t\t\tthrow error;\n\t\t}\n\n\t\treturn batch;\n\t});\n\n\tvar settled = batch.settled();\n\tvar committed = false;\n\tvar discarded = false;\n\n\treturn {\n\t\tcommit: async () => {\n\t\t\tif (committed) {\n\t\t\t\tawait settled;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (discarded) {\n\t\t\t\te.fork_discarded();\n\t\t\t}\n\n\t\t\tif (!batch.linked) {\n\t\t\t\t// batch was made obsolete by later changes\n\t\t\t\tcommitted = true;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tcommitted = true;\n\t\t\tbatch.is_fork = false;\n\n\t\t\t// Apply the changes to the real world. They keep the versions they had in the fork,\n\t\t\t// so that everything the fork computed remains valid (processing the batch\n\t\t\t// re-validates everything that depends on them, see `#process`)\n\t\t\tfor (const [source, entry] of batch.current) {\n\t\t\t\tconst later = later_writer(batch, source);\n\n\t\t\t\tif (later !== null) {\n\t\t\t\t\t// in order, the fork's write comes before the later batch's, which replaces it\n\t\t\t\t\tlater.previous.set(source, entry);\n\t\t\t\t} else {\n\t\t\t\t\tbatch.mark(source, MAYBE_DIRTY);\n\t\t\t\t\tapply(source, entry);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (eager_effects.size > 0) {\n\t\t\t\tflush_eager_effects();\n\t\t\t}\n\n\t\t\tbatch.flush();\n\t\t\tawait settled;\n\t\t},\n\t\tdiscard: () => {\n\t\t\tif (!committed && batch.linked) {\n\t\t\t\tbatch.discard();\n\t\t\t}\n\n\t\t\tdiscarded = true;\n\t\t}\n\t};\n}\n\n/**\n * Forcibly remove all current batches, to prevent cross-talk between tests\n */\nexport function clear() {\n\tfirst_batch = last_batch = null;\n}\n","/** @import { BatchRecord, BatchValue, Derived, DerivedRecord, Reaction, Value } from '#client' */\nimport { UNINITIALIZED } from '../../../constants.js';\nimport { snapshot } from '../../shared/clone.js';\nimport { DERIVED, ASYNC, PROXY_PATH_SYMBOL, STATE_SYMBOL } from '#client/constants';\nimport { effect_tracking } from '../reactivity/effects.js';\nimport { batch_values, view_batch } from '../reactivity/batch.js';\nimport { get_view } from '../reactivity/deriveds.js';\nimport { active_reaction, run_of, untrack, version_of } from '../runtime.js';\n\n/**\n * @typedef {{\n * traces: Error[];\n * }} TraceEntry\n */\n\n/** @type {{ reaction: Reaction | null, entries: Map<Value, TraceEntry> } | null} */\nexport let tracing_expressions = null;\n\n/**\n * The value of `signal`, with its version, as the active view of the world sees it (see `get`): for a\n * derived, the run of it that applies — a record in the batch, or the derived itself — or an assigned value\n * @param {Value} signal\n * @returns {Value | DerivedRecord | BatchValue}\n */\nfunction view_of(signal) {\n\tif (batch_values === null) return signal;\n\tif ((signal.f & DERIVED) !== 0) return get_view(/** @type {Derived} */ (signal));\n\treturn batch_values.get(signal) ?? signal;\n}\n\n/**\n * The run of `reaction` that applies in the active view of the world (see `run_of`), which for a derived\n * in the view of a batch is its record in the batch if it has one (see `get_view`). While the reaction\n * runs, that's its previous run\n * @param {Reaction} reaction\n * @returns {Reaction | BatchRecord}\n */\nfunction run_in_view(reaction) {\n\tif ((reaction.f & DERIVED) !== 0 && batch_values !== null) {\n\t\treturn view_batch?.get_record(reaction) ?? reaction;\n\t}\n\n\treturn run_of(reaction);\n}\n\n/**\n * Whether `signal` changed in the active view of the world since the traced reaction last ran. If its previous\n * run read it, that's whether the version it saw is no longer current. Otherwise (it's a dependency of a derived\n * the reaction read, or the reaction didn't read it before), whether it was written since `since`: the one place\n * where versions are compared by order, which is only a heuristic — a view can undo writes, which gives values\n * older versions again\n * @param {Value} signal\n * @param {Reaction | BatchRecord} run the previous run of the traced reaction (see `run_in_view`)\n * @param {number} since the version of the reaction's previous run (`0` if there's none)\n */\nfunction is_changed(signal, run, since) {\n\tvar i = run.deps?.indexOf(signal) ?? -1;\n\tvar seen = i === -1 ? undefined : run.dv?.[i];\n\n\tif (seen !== undefined) return version_of(signal) !== seen;\n\n\treturn since === 0 || version_of(signal) > since;\n}\n\n/**\n * @param {Value} signal\n * @param {TraceEntry | undefined} entry\n * @param {Reaction | BatchRecord} run the previous run of the traced reaction (see `run_in_view`)\n * @param {number} since the version of the reaction's previous run (`0` if there's none)\n */\nfunction log_entry(signal, entry, run, since) {\n\tconst view = view_of(signal);\n\tconst value = view.v;\n\n\tif (value === UNINITIALIZED) {\n\t\treturn;\n\t}\n\n\tconst type = get_type(signal);\n\tconst dirty = is_changed(signal, run, since);\n\tconst style = dirty\n\t\t? 'color: CornflowerBlue; font-weight: bold'\n\t\t: 'color: grey; font-weight: normal';\n\n\t// eslint-disable-next-line no-console\n\tconsole.groupCollapsed(\n\t\tsignal.label ? `%c${type}%c ${signal.label}` : `%c${type}%c`,\n\t\tstyle,\n\t\tdirty ? 'font-weight: normal' : style,\n\t\ttypeof value === 'object' && value !== null && STATE_SYMBOL in value\n\t\t\t? snapshot(value, true)\n\t\t\t: value\n\t);\n\n\tif ((signal.f & DERIVED) !== 0) {\n\t\tconst deps = new Set(\n\t\t\t('deps' in view ? view : run_in_view(/** @type {Derived} */ (signal))).deps\n\t\t);\n\n\t\tfor (const dep of deps) {\n\t\t\tlog_entry(dep, undefined, run, since);\n\t\t}\n\t}\n\n\tif (signal.created) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.log(signal.created);\n\t}\n\n\tif (dirty && signal.updated) {\n\t\tfor (const updated of signal.updated.values()) {\n\t\t\tif (updated.error) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.log(updated.error);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (entry) {\n\t\tfor (var trace of entry.traces) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.log(trace);\n\t\t}\n\t}\n\n\t// eslint-disable-next-line no-console\n\tconsole.groupEnd();\n}\n\n/**\n * @param {Value} signal\n * @returns {'$state' | '$derived' | 'store'}\n */\nfunction get_type(signal) {\n\tif ((signal.f & (DERIVED | ASYNC)) !== 0) return '$derived';\n\treturn signal.label?.startsWith('$') ? 'store' : '$state';\n}\n\n/**\n * @template T\n * @param {() => string} label\n * @param {() => T} fn\n */\nexport function trace(label, fn) {\n\tvar previously_tracing_expressions = tracing_expressions;\n\n\ttry {\n\t\ttracing_expressions = { entries: new Map(), reaction: active_reaction };\n\n\t\tvar start = performance.now();\n\t\tvar value = fn();\n\t\tvar time = (performance.now() - start).toFixed(2);\n\n\t\tvar prefix = untrack(label);\n\n\t\tif (!effect_tracking()) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.log(`${prefix} %cran outside of an effect (${time}ms)`, 'color: grey');\n\t\t} else if (tracing_expressions.entries.size === 0) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.log(`${prefix} %cno reactive dependencies (${time}ms)`, 'color: grey');\n\t\t} else {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.group(`${prefix} %c(${time}ms)`, 'color: grey');\n\n\t\t\tvar entries = tracing_expressions.entries;\n\t\t\tvar reaction = /** @type {Reaction} */ (active_reaction);\n\t\t\tvar run = run_in_view(reaction);\n\t\t\tvar since = run.wv ?? reaction.wv;\n\n\t\t\tuntrack(() => {\n\t\t\t\tfor (const [signal, traces] of entries) {\n\t\t\t\t\tlog_entry(signal, traces, run, since);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\ttracing_expressions = null;\n\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.groupEnd();\n\t\t}\n\n\t\treturn value;\n\t} finally {\n\t\ttracing_expressions = previously_tracing_expressions;\n\t}\n}\n\n/**\n * @template {Value} T\n * @param {T} source\n * @param {string} label\n * @returns {T}\n */\nexport function tag(source, label) {\n\tsource.label = label;\n\ttag_proxy(source.v, label);\n\n\treturn source;\n}\n\n/**\n * @param {unknown} value\n * @param {string} label\n */\nexport function tag_proxy(value, label) {\n\t// @ts-expect-error\n\tvalue?.[PROXY_PATH_SYMBOL]?.(label);\n\treturn value;\n}\n\n/**\n * @param {unknown} value\n */\nexport function label(value) {\n\tif (typeof value === 'symbol') return `Symbol(${value.description})`;\n\tif (typeof value === 'function') return '<function>';\n\tif (typeof value === 'object' && value) return '<object>';\n\treturn String(value);\n}\n","/** @import { Derived, Effect, Source, Value } from '#client' */\nimport { DEV } from 'esm-env';\nimport {\n\tactive_reaction,\n\tactive_effect,\n\tuntracked_writes,\n\tget,\n\tset_untracked_writes,\n\tuntrack,\n\tupdate_effect,\n\tcurrent_sources,\n\tis_dirty,\n\tuntracking,\n\tpush_reaction_value,\n\tis_destroying_effect\n} from '../runtime.js';\nimport { equals, safe_equals } from './equality.js';\nimport {\n\tCLEAN,\n\tDERIVED,\n\tDIRTY,\n\tBRANCH_EFFECT,\n\tEAGER_EFFECT,\n\tMAYBE_DIRTY,\n\tBLOCK_EFFECT,\n\tROOT_EFFECT,\n\tASYNC,\n\tASSIGNED,\n\tERROR_VALUE\n} from '#client/constants';\nimport * as e from '../errors.js';\nimport { legacy_mode_flag, tracing_mode_flag } from '../../flags/index.js';\nimport { tag_proxy } from '../dev/tracing.js';\nimport { get_error } from '../../shared/dev.js';\nimport { component_context, is_runes } from '../context.js';\nimport {\n\tBatch,\n\tbatch_values,\n\tlegacy_updates,\n\tin_real_world,\n\tteardown_write,\n\tsource_stacks\n} from './batch.js';\nimport { proxy } from '../proxy.js';\nimport { execute_derived } from './deriveds.js';\nimport { set_signal_status } from './status.js';\n\n/** @type {Set<Effect>} */\nexport let eager_effects = new Set();\n\n/**\n * @param {Set<any>} v\n */\nexport function set_eager_effects(v) {\n\teager_effects = v;\n}\n\nexport let eager_effects_deferred = false;\n\nexport function set_eager_effects_deferred() {\n\teager_effects_deferred = true;\n}\n\n/**\n * @template V\n * @param {V} v\n * @param {Error | null} [stack]\n * @returns {Source<V>}\n */\n// TODO rename this to `state` throughout the codebase\nexport function source(v, stack) {\n\t/** @type {Source<V>} */\n\tvar signal = {\n\t\tf: 0,\n\t\tv,\n\t\treactions: null,\n\t\tequals,\n\t\trv: 0,\n\t\twv: 0\n\t};\n\n\tif (DEV && tracing_mode_flag) {\n\t\tsignal.created = stack ?? get_error('created at');\n\t\tsignal.updated = null;\n\t\tsignal.set_during_effect = false;\n\t\tsignal.trace = null;\n\t}\n\n\treturn signal;\n}\n\n/**\n * @template V\n * @param {V} v\n * @param {Error | null} [stack]\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function state(v, stack) {\n\tconst s = source(v, stack);\n\n\tpush_reaction_value(s);\n\n\treturn s;\n}\n\n/**\n * @template V\n * @param {V} initial_value\n * @param {boolean} [immutable]\n * @returns {Source<V>}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function mutable_source(initial_value, immutable = false, trackable = true) {\n\tconst s = source(initial_value);\n\tif (!immutable) {\n\t\ts.equals = safe_equals;\n\t}\n\n\t// bind the signal to the component context, in case we need to\n\t// track updates to trigger beforeUpdate/afterUpdate callbacks\n\tif (legacy_mode_flag && trackable && component_context !== null && component_context.l !== null) {\n\t\t(component_context.l.s ??= []).push(s);\n\t}\n\n\treturn s;\n}\n\n/**\n * @template V\n * @param {Value<V>} source\n * @param {V} value\n */\nexport function mutate(source, value) {\n\tset(\n\t\tsource,\n\t\tuntrack(() => get(source))\n\t);\n\treturn value;\n}\n\n/**\n * Throws if `source` cannot be written to in the current reaction. Called by `set`, and by\n * objects like `SvelteMap` that must check before changing data of their own — those then\n * write the rest of their sources with `unchecked_set`, so that they either change\n * entirely or not at all\n * @param {Value} source\n */\nexport function check_mutation(source) {\n\tif (\n\t\tactive_reaction !== null &&\n\t\t// since we are untracking the function inside `$inspect.with` we need to add this check\n\t\t// to ensure we error if state is set inside an inspect effect\n\t\t(!untracking || (active_reaction.f & EAGER_EFFECT) !== 0) &&\n\t\tis_runes() &&\n\t\t(active_reaction.f & (DERIVED | BLOCK_EFFECT | ASYNC | EAGER_EFFECT)) !== 0 &&\n\t\t(current_sources === null || !current_sources.has(source))\n\t) {\n\t\te.state_unsafe_mutation();\n\t}\n}\n\n/**\n * @template V\n * @param {Value<V>} source\n * @param {V} value\n * @param {boolean} [should_proxy]\n * @returns {V}\n */\nexport function set(source, value, should_proxy = false) {\n\tcheck_mutation(source);\n\treturn unchecked_set(source, value, should_proxy);\n}\n\n/**\n * Like `set`, but without `check_mutation`. Only use this after checking a source that\n * belongs to the same object (such as its version)\n * TOOD 6.0 many calls to `unchecked_set` could be `internal_set`, once we\n * get rid of `legacy_updates`\n * @template V\n * @param {Value<V>} source\n * @param {V} value\n * @param {boolean} [should_proxy]\n * @returns {V}\n */\nexport function unchecked_set(source, value, should_proxy = false) {\n\tlet new_value = should_proxy ? proxy(value) : value;\n\n\tif (DEV) {\n\t\ttag_proxy(new_value, /** @type {string} */ (source.label));\n\t}\n\n\treturn internal_set(source, new_value, legacy_updates);\n}\n\n/**\n * @template V\n * @param {Value<V>} source\n * @param {V} value\n * @param {Effect[] | null} [updated_during_traversal]\n * @returns {V}\n */\nexport function internal_set(source, value, updated_during_traversal = null) {\n\tvar same = source.equals(value) && (source.f & ERROR_VALUE) === 0;\n\tvar entry = batch_values?.get(source);\n\n\t// A value that equals the real one may still overwrite a different value in the active view.\n\tif (!same || (entry !== undefined && (entry.e || !source.equals.call(entry, value)))) {\n\t\tvar batch = Batch.ensure();\n\n\t\t// If we are assigning to a dirty derived we eagerly execute it to track the dependencies. (Not if\n\t\t// it's assigned already: it tracks them, and its flags don't tell whether the assignment still holds,\n\t\t// which is what other views see when they undo this one — see `is_dirty`)\n\t\tif ((source.f & (DERIVED | DIRTY | ASSIGNED)) === (DERIVED | DIRTY)) {\n\t\t\texecute_derived(/** @type {Derived} */ (source));\n\t\t}\n\n\t\tbatch.capture(source, value, same, false, updated_during_traversal);\n\n\t\tif (DEV) {\n\t\t\tif (tracing_mode_flag || active_effect !== null) {\n\t\t\t\tsource.updated ??= new Map();\n\t\t\t\tsource_stacks.add(source);\n\n\t\t\t\t// For performance reasons, when not using $inspect.trace, we only start collecting stack traces\n\t\t\t\t// after the same source has been updated more than 5 times in the same flush cycle.\n\t\t\t\tconst count = (source.updated.get('')?.count ?? 0) + 1;\n\t\t\t\tsource.updated.set('', { error: /** @type {any} */ (null), count });\n\n\t\t\t\tif (tracing_mode_flag || count > 5) {\n\t\t\t\t\tconst error = get_error('updated at');\n\n\t\t\t\t\tif (error !== null) {\n\t\t\t\t\t\tlet entry = source.updated.get(error.stack);\n\n\t\t\t\t\t\tif (!entry) {\n\t\t\t\t\t\t\tentry = { error, count: 0 };\n\t\t\t\t\t\t\tsource.updated.set(error.stack, entry);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tentry.count++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (active_effect !== null) {\n\t\t\t\tsource.set_during_effect = true;\n\t\t\t}\n\t\t}\n\n\t\t// It's possible that the current reaction might not have up-to-date dependencies\n\t\t// whilst it's actively running. So in the case of ensuring it registers the reaction\n\t\t// properly for itself, we need to ensure the current effect actually gets\n\t\t// scheduled. i.e: `$effect(() => x++)`\n\t\tif (\n\t\t\tis_runes() &&\n\t\t\tactive_effect !== null &&\n\t\t\t(active_effect.f & CLEAN) !== 0 &&\n\t\t\t(active_effect.f & (BRANCH_EFFECT | ROOT_EFFECT)) === 0\n\t\t) {\n\t\t\tif (untracked_writes === null) {\n\t\t\t\tset_untracked_writes([source]);\n\t\t\t} else {\n\t\t\t\tuntracked_writes.push(source);\n\t\t\t}\n\t\t}\n\t} else if (is_destroying_effect) {\n\t\t// not a change, but the teardown no longer sees a reverted value\n\t\tteardown_write(source);\n\t}\n\n\treturn value;\n}\n\nexport function flush_eager_effects() {\n\teager_effects_deferred = false;\n\n\t// eager effects run in the real world, not in the view of a batch\n\tin_real_world(run_eager_effects);\n}\n\nfunction run_eager_effects() {\n\tfor (const effect of eager_effects) {\n\t\t// Mark clean inspect-effects as maybe dirty and then check their dirtiness\n\t\t// instead of just updating the effects - this way we avoid overfiring.\n\t\tif ((effect.f & CLEAN) !== 0) {\n\t\t\tset_signal_status(effect, MAYBE_DIRTY);\n\t\t}\n\n\t\tlet dirty;\n\n\t\ttry {\n\t\t\tdirty = is_dirty(effect);\n\t\t} catch {\n\t\t\t// Dirty-checking can evaluate derived dependencies and throw in cases where\n\t\t\t// parent effects are about to destroy this eager effect. Run the effect so\n\t\t\t// its own error handling can deal with transient failures.\n\t\t\tdirty = true;\n\t\t}\n\n\t\tif (dirty) {\n\t\t\tupdate_effect(effect);\n\t\t}\n\t}\n\n\teager_effects.clear();\n}\n\n/**\n * @template {number | bigint} T\n * @param {Source<T>} source\n * @param {1 | -1} [d]\n * @returns {T}\n */\nexport function update(source, d = 1) {\n\tvar value = get(source);\n\tvar result = d === 1 ? value++ : value--;\n\n\tset(source, value);\n\n\t// @ts-expect-error\n\treturn result;\n}\n\n/**\n * @template {number | bigint} T\n * @param {Source<T>} source\n * @param {1 | -1} [d]\n * @returns {T}\n */\nexport function update_pre(source, d = 1) {\n\tvar value = get(source);\n\n\t// @ts-expect-error\n\t// eslint-disable-next-line no-useless-assignment -- `++`/`--` used for return value, not side effect on `value`\n\treturn set(source, d === 1 ? ++value : --value);\n}\n\n/**\n * Silently (without using `get`) increment a source\n * @param {Source<number>} source\n */\nexport function increment(source) {\n\tset(source, source.v + 1);\n}\n\n/**\n * Like `increment`, but without `check_mutation` — see `unchecked_set`\n * @param {Source<number>} source\n */\nexport function unchecked_increment(source) {\n\tunchecked_set(source, source.v + 1);\n}\n","/** @import { Source } from '#client' */\nimport { DEV } from 'esm-env';\nimport {\n\tget,\n\tactive_effect,\n\tupdate_version,\n\tactive_reaction,\n\tset_update_version,\n\tset_active_reaction\n} from './runtime.js';\nimport {\n\tarray_prototype,\n\tget_descriptor,\n\tget_prototype_of,\n\tis_array,\n\tobject_prototype\n} from '../shared/utils.js';\nimport {\n\tstate as source,\n\tcheck_mutation,\n\tunchecked_set,\n\tunchecked_increment,\n\tflush_eager_effects,\n\tset_eager_effects_deferred\n} from './reactivity/sources.js';\nimport { COMPONENT_SYMBOL, PROXY_PATH_SYMBOL, STATE_SYMBOL } from '#client/constants';\nimport { UNINITIALIZED } from '../../constants.js';\nimport * as e from './errors.js';\nimport { tag } from './dev/tracing.js';\nimport { get_error } from '../shared/dev.js';\nimport { tracing_mode_flag } from '../flags/index.js';\n\n// TODO move all regexes into shared module?\nconst regex_is_valid_identifier = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;\n\n/**\n * @template T\n * @param {T} value\n * @returns {T}\n */\nexport function proxy(value) {\n\t// if non-proxyable, a component instance, or already a proxy, return `value`\n\tif (\n\t\ttypeof value !== 'object' ||\n\t\tvalue === null ||\n\t\tSTATE_SYMBOL in value ||\n\t\tCOMPONENT_SYMBOL in value\n\t) {\n\t\treturn value;\n\t}\n\n\tconst prototype = get_prototype_of(value);\n\n\tif (prototype !== object_prototype && prototype !== array_prototype) {\n\t\treturn value;\n\t}\n\n\t/** @type {Map<any, Source<any>>} */\n\tvar sources = new Map();\n\tvar is_proxied_array = is_array(value);\n\tvar version = source(0);\n\n\tvar stack = DEV && tracing_mode_flag ? get_error('created at') : null;\n\tvar parent_version = update_version;\n\n\t/**\n\t * Executes the proxy in the context of the reaction it was originally created in, if any\n\t * @template T\n\t * @param {() => T} fn\n\t */\n\tvar with_parent = (fn) => {\n\t\tif (update_version === parent_version) {\n\t\t\treturn fn();\n\t\t}\n\n\t\t// child source is being created after the initial proxy —\n\t\t// prevent it from being associated with the current reaction\n\t\tvar reaction = active_reaction;\n\t\tvar version = update_version;\n\n\t\tset_active_reaction(null);\n\t\tset_update_version(parent_version);\n\n\t\tvar result = fn();\n\n\t\tset_active_reaction(reaction);\n\t\tset_update_version(version);\n\n\t\treturn result;\n\t};\n\n\tif (is_proxied_array) {\n\t\t// We need to create the length source eagerly to ensure that\n\t\t// mutations to the array are properly synced with our proxy\n\t\tsources.set('length', source(/** @type {any[]} */ (value).length, stack));\n\t\tif (DEV) {\n\t\t\tvalue = /** @type {any} */ (inspectable_array(/** @type {any[]} */ (value)));\n\t\t}\n\t}\n\n\t/** Used in dev for $inspect.trace() */\n\tvar path = '';\n\tlet updating = false;\n\t/** @param {string} new_path */\n\tfunction update_path(new_path) {\n\t\tif (updating) return;\n\t\tupdating = true;\n\t\tpath = new_path;\n\n\t\ttag(version, `${path} version`);\n\n\t\t// rename all child sources and child proxies\n\t\tfor (const [prop, source] of sources) {\n\t\t\ttag(source, get_label(path, prop));\n\t\t}\n\t\tupdating = false;\n\t}\n\n\treturn new Proxy(/** @type {any} */ (value), {\n\t\tdefineProperty(_, prop, descriptor) {\n\t\t\tif (\n\t\t\t\t!('value' in descriptor) ||\n\t\t\t\tdescriptor.configurable === false ||\n\t\t\t\tdescriptor.enumerable === false ||\n\t\t\t\tdescriptor.writable === false\n\t\t\t) {\n\t\t\t\t// we disallow non-basic descriptors, because unless they are applied to the\n\t\t\t\t// target object — which we avoid, so that state can be forked — we will run\n\t\t\t\t// afoul of the various invariants\n\t\t\t\t// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/getOwnPropertyDescriptor#invariants\n\t\t\t\te.state_descriptors_fixed();\n\t\t\t}\n\n\t\t\tcheck_mutation(version);\n\n\t\t\tvar s = sources.get(prop);\n\t\t\tif (s === undefined) {\n\t\t\t\twith_parent(() => {\n\t\t\t\t\tvar s = source(descriptor.value, stack);\n\t\t\t\t\tsources.set(prop, s);\n\t\t\t\t\tif (DEV && typeof prop === 'string') {\n\t\t\t\t\t\ttag(s, get_label(path, prop));\n\t\t\t\t\t}\n\t\t\t\t\treturn s;\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tunchecked_set(s, descriptor.value, true);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t},\n\n\t\tdeleteProperty(target, prop) {\n\t\t\tcheck_mutation(version);\n\n\t\t\tvar s = sources.get(prop);\n\n\t\t\tif (s === undefined) {\n\t\t\t\tif (prop in target) {\n\t\t\t\t\tconst s = with_parent(() => source(UNINITIALIZED, stack));\n\t\t\t\t\tsources.set(prop, s);\n\t\t\t\t\tunchecked_increment(version);\n\n\t\t\t\t\tif (DEV) {\n\t\t\t\t\t\ttag(s, get_label(path, prop));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tunchecked_set(s, UNINITIALIZED);\n\t\t\t\tunchecked_increment(version);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t},\n\n\t\tget(target, prop, receiver) {\n\t\t\tif (prop === STATE_SYMBOL) {\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t\tif (DEV && prop === PROXY_PATH_SYMBOL) {\n\t\t\t\treturn update_path;\n\t\t\t}\n\n\t\t\tvar s = sources.get(prop);\n\t\t\tvar exists = prop in target;\n\n\t\t\t// create a source, but only if it's an own property and not a prototype property\n\t\t\tif (s === undefined && (!exists || get_descriptor(target, prop)?.writable)) {\n\t\t\t\ts = with_parent(() => {\n\t\t\t\t\tvar p = proxy(exists ? target[prop] : UNINITIALIZED);\n\t\t\t\t\tvar s = source(p, stack);\n\n\t\t\t\t\tif (DEV) {\n\t\t\t\t\t\ttag(s, get_label(path, prop));\n\t\t\t\t\t}\n\n\t\t\t\t\treturn s;\n\t\t\t\t});\n\n\t\t\t\tsources.set(prop, s);\n\t\t\t}\n\n\t\t\tif (s !== undefined) {\n\t\t\t\tvar v = get(s);\n\t\t\t\treturn v === UNINITIALIZED ? undefined : v;\n\t\t\t}\n\n\t\t\treturn Reflect.get(target, prop, receiver);\n\t\t},\n\n\t\tgetOwnPropertyDescriptor(target, prop) {\n\t\t\tthis.has?.(target, prop);\n\n\t\t\tvar descriptor = Reflect.getOwnPropertyDescriptor(target, prop);\n\t\t\tvar s = sources.get(prop);\n\n\t\t\tif (s !== undefined) {\n\t\t\t\tvar value = get(s);\n\n\t\t\t\tif (value === UNINITIALIZED) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\tif (descriptor && 'value' in descriptor) {\n\t\t\t\t\tdescriptor.value = value;\n\t\t\t\t} else {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tenumerable: true,\n\t\t\t\t\t\tconfigurable: true,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\twritable: true\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn descriptor;\n\t\t},\n\n\t\thas(target, prop) {\n\t\t\tif (prop === STATE_SYMBOL) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tvar s = sources.get(prop);\n\t\t\tvar has = (s !== undefined && s.v !== UNINITIALIZED) || Reflect.has(target, prop);\n\n\t\t\tif (\n\t\t\t\ts !== undefined ||\n\t\t\t\t((active_effect !== null || active_reaction !== null) &&\n\t\t\t\t\t(!has || get_descriptor(target, prop)?.writable))\n\t\t\t) {\n\t\t\t\tif (s === undefined) {\n\t\t\t\t\ts = with_parent(() => {\n\t\t\t\t\t\tvar p = has ? proxy(target[prop]) : UNINITIALIZED;\n\t\t\t\t\t\tvar s = source(p, stack);\n\n\t\t\t\t\t\tif (DEV) {\n\t\t\t\t\t\t\ttag(s, get_label(path, prop));\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn s;\n\t\t\t\t\t});\n\n\t\t\t\t\tsources.set(prop, s);\n\t\t\t\t}\n\n\t\t\t\tvar value = get(s);\n\t\t\t\tif (value === UNINITIALIZED) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn has;\n\t\t},\n\n\t\tset(target, prop, value, receiver) {\n\t\t\tcheck_mutation(version);\n\n\t\t\tvar s = sources.get(prop);\n\t\t\tvar has = prop in target;\n\n\t\t\t// variable.length = value -> clear all signals with index >= value\n\t\t\tif (is_proxied_array && prop === 'length') {\n\t\t\t\tfor (var i = value; i < /** @type {Source<number>} */ (s).v; i += 1) {\n\t\t\t\t\tvar other_s = sources.get(i + '');\n\t\t\t\t\tif (other_s !== undefined) {\n\t\t\t\t\t\tunchecked_set(other_s, UNINITIALIZED);\n\t\t\t\t\t} else if (i in target) {\n\t\t\t\t\t\t// If the item exists in the original, we need to create an uninitialized source,\n\t\t\t\t\t\t// else a later read of the property would result in a source being created with\n\t\t\t\t\t\t// the value of the original item at that index.\n\t\t\t\t\t\tother_s = with_parent(() => source(UNINITIALIZED, stack));\n\t\t\t\t\t\tsources.set(i + '', other_s);\n\n\t\t\t\t\t\tif (DEV) {\n\t\t\t\t\t\t\ttag(other_s, get_label(path, i));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If we haven't yet created a source for this property, we need to ensure\n\t\t\t// we do so otherwise if we read it later, then the write won't be tracked and\n\t\t\t// the heuristics of effects will be different vs if we had read the proxied\n\t\t\t// object property before writing to that property.\n\t\t\tif (s === undefined) {\n\t\t\t\tif (!has || get_descriptor(target, prop)?.writable) {\n\t\t\t\t\ts = with_parent(() => source(undefined, stack));\n\n\t\t\t\t\tif (DEV) {\n\t\t\t\t\t\ttag(s, get_label(path, prop));\n\t\t\t\t\t}\n\t\t\t\t\tunchecked_set(s, proxy(value));\n\n\t\t\t\t\tsources.set(prop, s);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thas = s.v !== UNINITIALIZED;\n\n\t\t\t\tvar p = with_parent(() => proxy(value));\n\t\t\t\tunchecked_set(s, p);\n\t\t\t}\n\n\t\t\tvar descriptor = Reflect.getOwnPropertyDescriptor(target, prop);\n\n\t\t\t// Set the new value before updating any signals so that any listeners get the new value\n\t\t\tif (descriptor?.set) {\n\t\t\t\tdescriptor.set.call(receiver, value);\n\t\t\t}\n\n\t\t\tif (!has) {\n\t\t\t\t// If we have mutated an array directly, we might need to\n\t\t\t\t// signal that length has also changed. Do it before updating metadata\n\t\t\t\t// to ensure that iterating over the array as a result of a metadata update\n\t\t\t\t// will not cause the length to be out of sync.\n\t\t\t\tif (is_proxied_array && typeof prop === 'string') {\n\t\t\t\t\tvar ls = /** @type {Source<number>} */ (sources.get('length'));\n\t\t\t\t\tvar n = Number(prop);\n\n\t\t\t\t\tif (Number.isInteger(n) && n >= ls.v) {\n\t\t\t\t\t\tunchecked_set(ls, n + 1);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tunchecked_increment(version);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t},\n\n\t\townKeys(target) {\n\t\t\tget(version);\n\n\t\t\tvar own_keys = Reflect.ownKeys(target).filter((key) => {\n\t\t\t\tvar source = sources.get(key);\n\t\t\t\treturn source === undefined || source.v !== UNINITIALIZED;\n\t\t\t});\n\n\t\t\tfor (var [key, source] of sources) {\n\t\t\t\tif (source.v !== UNINITIALIZED && !(key in target)) {\n\t\t\t\t\town_keys.push(key);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn own_keys;\n\t\t},\n\n\t\tsetPrototypeOf() {\n\t\t\te.state_prototype_fixed();\n\t\t}\n\t});\n}\n\n/**\n * @param {string} path\n * @param {string | symbol} prop\n */\nfunction get_label(path, prop) {\n\tif (typeof prop === 'symbol') return `${path}[Symbol(${prop.description ?? ''})]`;\n\tif (regex_is_valid_identifier.test(prop)) return `${path}.${prop}`;\n\treturn /^\\d+$/.test(prop) ? `${path}[${prop}]` : `${path}['${prop}']`;\n}\n\n/**\n * @param {any} value\n */\nexport function get_proxied_value(value) {\n\ttry {\n\t\tif (value !== null && typeof value === 'object' && STATE_SYMBOL in value) {\n\t\t\treturn value[STATE_SYMBOL];\n\t\t}\n\t} catch {\n\t\t// the above if check can throw an error if the value in question\n\t\t// is the contentWindow of an iframe on another domain, in which\n\t\t// case we want to just return the value (because it's definitely\n\t\t// not a proxied value) so we don't break any JavaScript interacting\n\t\t// with that iframe (such as various payment companies client side\n\t\t// JavaScript libraries interacting with their iframes on the same\n\t\t// domain)\n\t}\n\n\treturn value;\n}\n\n/**\n * @param {any} a\n * @param {any} b\n */\nexport function is(a, b) {\n\treturn Object.is(get_proxied_value(a), get_proxied_value(b));\n}\n\nconst ARRAY_MUTATING_METHODS = new Set([\n\t'copyWithin',\n\t'fill',\n\t'pop',\n\t'push',\n\t'reverse',\n\t'shift',\n\t'sort',\n\t'splice',\n\t'unshift'\n]);\n\n/**\n * Wrap array mutating methods so $inspect is triggered only once and\n * to prevent logging an array in intermediate state (e.g. with an empty slot)\n * @param {any[]} array\n */\nfunction inspectable_array(array) {\n\treturn new Proxy(array, {\n\t\tget(target, prop, receiver) {\n\t\t\tvar value = Reflect.get(target, prop, receiver);\n\t\t\tif (!ARRAY_MUTATING_METHODS.has(/** @type {string} */ (prop))) {\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * @this {any[]}\n\t\t\t * @param {any[]} args\n\t\t\t */\n\t\t\treturn function (...args) {\n\t\t\t\tset_eager_effects_deferred();\n\t\t\t\tvar result = value.apply(this, args);\n\t\t\t\tflush_eager_effects();\n\t\t\t\treturn result;\n\t\t\t};\n\t\t}\n\t});\n}\n","/** @import { Effect, TemplateNode } from '#client' */\nimport { hydrate_node, hydrating, reset, set_hydrate_node } from './hydration.js';\nimport { DEV } from 'esm-env';\nimport { init_array_prototype_warnings } from '../dev/equality.js';\nimport { define_property, get_descriptor, is_extensible } from '../../shared/utils.js';\nimport { active_effect } from '../runtime.js';\nimport { async_mode_flag } from '../../flags/index.js';\nimport {\n\tATTRIBUTES_CACHE,\n\tCLASS_CACHE,\n\tREACTION_RAN,\n\tSTYLE_CACHE,\n\tTEXT_CACHE,\n\tTEXT_NODE,\n\tCOMMENT_NODE,\n\tCUSTOM_RENDERER_NODE_TYPE_MAP\n} from '#client/constants';\nimport { eager_block_writes } from '../reactivity/batch.js';\nimport { NAMESPACE_HTML } from '../../../constants.js';\nimport { current_renderer } from '../custom-renderer/state.js';\nimport * as e from '../errors.js';\n\n// export these for reference in the compiled code, making global name deduplication unnecessary\n/** @type {Window} */\nexport var $window;\n\n/** @type {Document} */\nexport var $document;\n\n/** @type {boolean} */\nexport var is_firefox;\n\n/** @type {() => Node | null} */\nvar first_child_getter;\n/** @type {() => Node | null} */\nvar next_sibling_getter;\n\n/**\n * Initialize these lazily to avoid issues when using the runtime in a server context\n * where these globals are not available while avoiding a separate server entry point\n */\nexport function init_operations() {\n\tif ($window !== undefined) {\n\t\treturn;\n\t}\n\n\t$window = window;\n\t$document = document;\n\tis_firefox = /Firefox/.test(navigator.userAgent);\n\n\tvar element_prototype = Element.prototype;\n\tvar node_prototype = Node.prototype;\n\tvar text_prototype = Text.prototype;\n\n\t// @ts-ignore\n\tfirst_child_getter = get_descriptor(node_prototype, 'firstChild').get;\n\t// @ts-ignore\n\tnext_sibling_getter = get_descriptor(node_prototype, 'nextSibling').get;\n\n\tif (is_extensible(element_prototype)) {\n\t\t// the following assignments improve perf of lookups on DOM nodes\n\t\t/** @type {any} */ (element_prototype)[CLASS_CACHE] = undefined;\n\t\t/** @type {any} */ (element_prototype)[ATTRIBUTES_CACHE] = null;\n\t\t/** @type {any} */ (element_prototype)[STYLE_CACHE] = undefined;\n\t\t// @ts-expect-error\n\t\telement_prototype.__e = undefined;\n\t}\n\n\tif (is_extensible(text_prototype)) {\n\t\t/** @type {any} */ (text_prototype)[TEXT_CACHE] = undefined;\n\t}\n\n\tif (DEV) {\n\t\tdefine_property(element_prototype, '__svelte_meta', {\n\t\t\tvalue: null,\n\t\t\tenumerable: false,\n\t\t\twritable: true,\n\t\t\tconfigurable: true\n\t\t});\n\n\t\tinit_array_prototype_warnings();\n\t}\n}\n\n/**\n * Creates a text node with the given content. To mark a position, use `create_anchor` instead,\n * and to create an empty text node while hydrating, use `create_hydration_text`\n * @param {string} value\n * @returns {Text}\n */\nexport function create_text(value) {\n\tif (current_renderer) return /** @type {Text} */ (current_renderer.createText(value));\n\treturn document.createTextNode(value);\n}\n\n/**\n * Creates the text node of an `{expression}` that was empty during SSR, so there was no text\n * node to hydrate. Only use this while hydrating: elsewhere, an empty text node is an anchor,\n * which should be created with `create_anchor`\n * @returns {Text}\n */\nexport function create_hydration_text() {\n\tif (current_renderer) return /** @type {Text} */ (current_renderer.createText(''));\n\treturn document.createTextNode('');\n}\n\n/**\n * Creates a node that only marks a position. In the DOM this is an empty text node; with a\n * custom renderer it's an empty comment, so that renderers can treat every comment as\n * plumbing and every text node as content\n * @returns {Text}\n */\nexport function create_anchor() {\n\tif (current_renderer) return /** @type {Text} */ (current_renderer.createComment(''));\n\treturn document.createTextNode('');\n}\n\n/**\n * @template {Node} N\n * @param {N} node\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function get_first_child(node) {\n\tif (current_renderer)\n\t\treturn /** @type {TemplateNode | null} */ (current_renderer.getFirstChild(node));\n\treturn /** @type {TemplateNode | null} */ (first_child_getter.call(node));\n}\n\n/**\n * @template {Node} N\n * @param {N} node\n */\n/*@__NO_SIDE_EFFECTS__*/\nexport function get_next_sibling(node) {\n\tif (current_renderer)\n\t\treturn /** @type {TemplateNode | null} */ (current_renderer.getNextSibling(node));\n\treturn /** @type {TemplateNode | null} */ (next_sibling_getter.call(node));\n}\n\n/**\n * Don't mark this as side-effect-free, hydration needs to walk all nodes\n * @template {Node} N\n * @param {N} node\n * @param {boolean} is_text\n * @returns {TemplateNode | null}\n */\nexport function child(node, is_text) {\n\tif (!hydrating) {\n\t\treturn get_first_child(node);\n\t}\n\n\tvar child = get_first_child(hydrate_node);\n\n\t// Child can be null if we have an element with a single child, like `<p>{text}</p>`, where `text` is empty\n\tif (child === null) {\n\t\tchild = /** @type {TemplateNode} */ (append_child(hydrate_node, create_hydration_text()));\n\t} else if (is_text && node_type(child) !== TEXT_NODE) {\n\t\tvar text = create_hydration_text();\n\t\tinsert_before(child, text);\n\t\tset_hydrate_node(text);\n\t\treturn text;\n\t}\n\n\tif (is_text) {\n\t\tmerge_text_nodes(/** @type {Text} */ (child));\n\t}\n\n\tset_hydrate_node(child);\n\treturn child;\n}\n\n/**\n * Don't mark this as side-effect-free, hydration needs to walk all nodes\n * @param {TemplateNode} node\n * @param {boolean} [is_text]\n * @returns {TemplateNode | null}\n */\nexport function first_child(node, is_text = false) {\n\tif (!hydrating) {\n\t\tvar first = get_first_child(node);\n\n\t\t// TODO prevent user comments with the empty string when preserveComments is true\n\t\tif (is_comment(first) && get_node_value(first) === '') return get_next_sibling(first);\n\n\t\treturn first;\n\t}\n\n\tif (is_text) {\n\t\t// if an {expression} is empty during SSR, there might be no\n\t\t// text node to hydrate — we must therefore create one\n\t\tif (node_type(hydrate_node) !== TEXT_NODE) {\n\t\t\tvar text = create_hydration_text();\n\n\t\t\tif (hydrate_node) insert_before(hydrate_node, text);\n\t\t\tset_hydrate_node(text);\n\t\t\treturn text;\n\t\t}\n\n\t\tmerge_text_nodes(/** @type {Text} */ (hydrate_node));\n\t}\n\n\treturn hydrate_node;\n}\n\n/**\n * `child`, for the very common case of an element with exactly one child. Resetting the\n * hydration cursor is part of the same step, so the compiler doesn't have to emit a\n * separate `reset` call for every `<p>{text}</p>` in an app.\n * Don't mark this as side-effect-free, hydration needs to walk all nodes\n * @param {TemplateNode} node\n * @param {boolean} [is_text]\n * @returns {TemplateNode | null}\n */\nexport function only_child(node, is_text = false) {\n\tif (!hydrating) {\n\t\treturn get_first_child(node);\n\t}\n\n\tvar first = child(node, is_text);\n\treset(node);\n\n\treturn first;\n}\n\n/**\n * Don't mark this as side-effect-free, hydration needs to walk all nodes\n * @param {TemplateNode} node\n * @param {number} count\n * @param {boolean} is_text\n * @returns {TemplateNode | null}\n */\nexport function sibling(node, count = 1, is_text = false) {\n\tlet next_sibling = hydrating ? hydrate_node : node;\n\tvar last_sibling;\n\n\twhile (count--) {\n\t\tlast_sibling = next_sibling;\n\t\tnext_sibling = /** @type {TemplateNode} */ (get_next_sibling(next_sibling));\n\t}\n\n\tif (!hydrating) {\n\t\treturn next_sibling;\n\t}\n\n\tif (is_text) {\n\t\t// if a sibling {expression} is empty during SSR, there might be no\n\t\t// text node to hydrate — we must therefore create one\n\t\tif (node_type(next_sibling) !== TEXT_NODE) {\n\t\t\tvar text = create_hydration_text();\n\t\t\t// If the next sibling is `null` and we're handling text then it's because\n\t\t\t// the SSR content was empty for the text, so we need to generate a new text\n\t\t\t// node and insert it after the last sibling\n\t\t\tif (next_sibling === null) {\n\t\t\t\tif (last_sibling) insert_after(last_sibling, text);\n\t\t\t} else {\n\t\t\t\tinsert_before(next_sibling, text);\n\t\t\t}\n\t\t\tset_hydrate_node(text);\n\t\t\treturn text;\n\t\t}\n\n\t\tmerge_text_nodes(/** @type {Text} */ (next_sibling));\n\t}\n\n\tset_hydrate_node(next_sibling);\n\treturn next_sibling;\n}\n\n/**\n * @template {Node} N\n * @param {N} node\n * @returns {void}\n */\nexport function clear_text_content(node) {\n\tif (current_renderer) {\n\t\tvar child = current_renderer.getFirstChild(node);\n\t\twhile (child !== null) {\n\t\t\tvar next = current_renderer.getNextSibling(child);\n\t\t\tcurrent_renderer.remove(child);\n\t\t\tchild = next;\n\t\t}\n\t\treturn;\n\t}\n\tnode.textContent = '';\n}\n\n/**\n * Returns `true` if we're updating the current block, for example `condition` in\n * an `{#if condition}` block just changed. In this case, the branch should be\n * appended (or removed) at the same time as other updates within the\n * current `<svelte:boundary>`\n */\nexport function should_defer_append() {\n\tif (!async_mode_flag && eager_block_writes === null) return false;\n\n\tvar flags = /** @type {Effect} */ (active_effect).f;\n\treturn (flags & REACTION_RAN) !== 0;\n}\n\n/**\n * Branching here is intentional and load-bearing for perf. `createElement(tag)`\n * hits a fast path in Blink that `createElementNS(NAMESPACE_HTML, tag)` doesn't,\n * and passing an explicit `undefined` as the trailing options arg measurably\n * slows both APIs. Funnelling every case through a single `createElementNS(ns,\n * tag, options)` call would be smaller but slower on the HTML path.\n *\n * @template {keyof HTMLElementTagNameMap | string} T\n * @param {T} tag\n * @param {string} [namespace]\n * @param {string} [is]\n * @returns {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element}\n */\nexport function create_element(tag, namespace, is) {\n\tif (current_renderer) {\n\t\treturn current_renderer.createElement(tag);\n\t}\n\n\tif (namespace == null || namespace === NAMESPACE_HTML) {\n\t\treturn /** @type {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element} */ (\n\t\t\tis ? document.createElement(tag, { is }) : document.createElement(tag)\n\t\t);\n\t}\n\n\treturn /** @type {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element} */ (\n\t\tis ? document.createElementNS(namespace, tag, { is }) : document.createElementNS(namespace, tag)\n\t);\n}\n\nexport function create_fragment() {\n\tif (current_renderer) return /** @type {DocumentFragment} */ (current_renderer.createFragment());\n\treturn document.createDocumentFragment();\n}\n\n/**\n * @param {string} data\n * @returns\n */\nexport function create_comment(data = '') {\n\tif (current_renderer) return /** @type {Comment} */ (current_renderer.createComment(data));\n\treturn document.createComment(data);\n}\n\n/**\n * @param {Element} element\n * @param {string} key\n * @param {string} value\n * @returns\n */\nexport function set_attribute(element, key, value = '') {\n\tif (current_renderer) {\n\t\tcurrent_renderer.setAttribute(element, key, value);\n\t\treturn;\n\t}\n\tif (key.startsWith('xlink:')) {\n\t\telement.setAttributeNS('http://www.w3.org/1999/xlink', key, value);\n\t\treturn;\n\t}\n\treturn element.setAttribute(key, value);\n}\n\n/**\n * Browsers split text nodes larger than 65536 bytes when parsing.\n * For hydration to succeed, we need to stitch them back together\n * @param {Text} text\n */\nexport function merge_text_nodes(text) {\n\t// if we have a renderer we will not hydrate so we can skip this\n\tif (current_renderer) return;\n\n\tif (/** @type {string} */ (text.nodeValue).length < 65536) {\n\t\treturn;\n\t}\n\n\tlet next = text.nextSibling;\n\n\twhile (next !== null && node_type(next) === TEXT_NODE) {\n\t\tnext.remove();\n\n\t\t/** @type {string} */ (text.nodeValue) += /** @type {string} */ (next.nodeValue);\n\n\t\tnext = text.nextSibling;\n\t}\n}\n\n/**\n * @param {TemplateNode | null} node\n * @returns {node is Comment}\n */\nfunction is_comment(node) {\n\tif (current_renderer) return !!node && node_type(node) === COMMENT_NODE;\n\treturn node instanceof Comment;\n}\n\n/**\n * @param {Node | null | undefined} node\n */\nexport function node_type(node) {\n\tif (node == null) return undefined;\n\tif (current_renderer) {\n\t\tconst type = current_renderer.getNodeType(node);\n\t\treturn CUSTOM_RENDERER_NODE_TYPE_MAP[type];\n\t}\n\treturn node.nodeType;\n}\n\n/**\n * @param {Node} node\n * @returns {string}\n */\nexport function node_name(node) {\n\tif (current_renderer) {\n\t\t// for custom renderers we don't need to return the node name since all the\n\t\t// checks that we do on specific node names are meant to be for the HTML\n\t\treturn '';\n\t}\n\treturn node.nodeName;\n}\n\n/**\n * @param {Node} node\n * @returns {TemplateNode | null}\n */\nexport function get_last_child(node) {\n\tif (current_renderer)\n\t\treturn /** @type {TemplateNode | null} */ (current_renderer.getLastChild(node));\n\treturn /** @type {TemplateNode | null} */ (node.lastChild);\n}\n\n/**\n * @param {Node} node\n * @returns {TemplateNode | null}\n */\nexport function get_parent_node(node) {\n\tif (current_renderer)\n\t\treturn /** @type {TemplateNode | null} */ (current_renderer.getParent(node));\n\treturn /** @type {TemplateNode | null} */ (node.parentNode);\n}\n\n/**\n * @param {Node} parent\n * @param {Node} child\n * @returns {Node}\n */\nexport function append_child(parent, child) {\n\tif (current_renderer) {\n\t\tcurrent_renderer.insert(parent, child, null);\n\t\treturn child;\n\t}\n\treturn parent.appendChild(child);\n}\n\n/**\n * Insert `new_node` before `ref_node` (equivalent to `ref_node.before(new_node)`)\n * @param {ChildNode} ref_node\n * @param {Node} new_node\n */\nexport function insert_before(ref_node, new_node) {\n\tif (current_renderer) {\n\t\tvar parent = current_renderer.getParent(ref_node);\n\t\tcurrent_renderer.insert(parent, new_node, ref_node);\n\t\treturn;\n\t}\n\tref_node.before(new_node);\n}\n\n/**\n * Insert `new_node` after `ref_node` (equivalent to `ref_node.after(new_node)`)\n * @param {ChildNode} ref_node\n * @param {Node} new_node\n */\nexport function insert_after(ref_node, new_node) {\n\tif (current_renderer) {\n\t\tvar parent = current_renderer.getParent(ref_node);\n\t\tvar next = current_renderer.getNextSibling(ref_node);\n\t\tcurrent_renderer.insert(parent, new_node, next);\n\t\treturn;\n\t}\n\tref_node.after(new_node);\n}\n\n/**\n * @param {ChildNode} node\n */\nexport function remove_node(node) {\n\tif (current_renderer) {\n\t\tcurrent_renderer.remove(node);\n\t\treturn;\n\t}\n\tnode.remove();\n}\n\n/**\n * @param {Node} parent\n * @param {ChildNode} child\n * @returns {ChildNode}\n */\nexport function remove_child(parent, child) {\n\tif (current_renderer) {\n\t\tcurrent_renderer.remove(child);\n\t\treturn child;\n\t}\n\treturn /** @type {ChildNode} */ (parent.removeChild(child));\n}\n\n/**\n * @param {ChildNode} old_node\n * @param {Node} new_node\n */\nexport function replace_with(old_node, new_node) {\n\tif (current_renderer) {\n\t\tvar parent = current_renderer.getParent(old_node);\n\t\tcurrent_renderer.insert(parent, new_node, old_node);\n\t\tcurrent_renderer.remove(old_node);\n\t\treturn;\n\t}\n\told_node.replaceWith(new_node);\n}\n\n/**\n * @param {Node} node\n * @param {string} value\n */\nexport function set_text_content(node, value) {\n\tif (current_renderer) {\n\t\t// only used for DOM-only features (injected styles and `<script>` tags in `{@html ...}`)\n\t\te.custom_renderer_unsupported_operation('textContent');\n\t}\n\tnode.textContent = value;\n}\n\n/**\n * @param {Node} node\n * @param {string} value\n */\nexport function set_node_value(node, value) {\n\tif (current_renderer) {\n\t\tcurrent_renderer.setText(node, value);\n\t\treturn;\n\t}\n\tnode.nodeValue = value;\n}\n\n/**\n * @param {Node} node\n * @returns {string | null}\n */\nexport function get_node_value(node) {\n\tif (current_renderer) return current_renderer.getText(node);\n\treturn node.nodeValue;\n}\n\n/**\n * Sets the `value` property on an element. For custom renderers, uses `setAttribute`.\n * @param {Element} element\n * @param {any} value\n */\nexport function set_element_value(element, value) {\n\tif (current_renderer) {\n\t\tcurrent_renderer.setAttribute(element, 'value', value ?? '');\n\t\treturn;\n\t}\n\t// @ts-expect-error\n\telement.value = value ?? '';\n}\n\n/**\n * Sets the `checked` property on an element. For custom renderers, uses `setAttribute`.\n * @param {Element} element\n * @param {boolean} checked\n */\nexport function set_element_checked(element, checked) {\n\tif (current_renderer) {\n\t\tif (checked) {\n\t\t\tcurrent_renderer.setAttribute(element, 'checked', '');\n\t\t} else {\n\t\t\tcurrent_renderer.removeAttribute(element, 'checked');\n\t\t}\n\t\treturn;\n\t}\n\t// @ts-expect-error\n\telement.checked = checked;\n}\n\n/**\n * Sets the `defaultValue` property on an element without affecting the current `value`.\n * For custom renderers, uses `setAttribute` on `defaultvalue`.\n * @param {Element} element\n * @param {string} value\n */\nexport function set_element_default_value(element, value) {\n\tif (current_renderer) {\n\t\tcurrent_renderer.setAttribute(element, 'defaultValue', value);\n\t\treturn;\n\t}\n\t// @ts-expect-error\n\tconst existing_value = element.value;\n\t// @ts-expect-error\n\telement.defaultValue = value;\n\t// @ts-expect-error\n\telement.value = existing_value;\n}\n\n/**\n * Sets the `defaultChecked` property on an element without affecting the current `checked` state.\n * For custom renderers, uses `setAttribute` on `defaultchecked`.\n * @param {Element} element\n * @param {boolean} checked\n */\nexport function set_element_default_checked(element, checked) {\n\tif (current_renderer) {\n\t\tif (checked) {\n\t\t\tcurrent_renderer.setAttribute(element, 'defaultChecked', '');\n\t\t} else {\n\t\t\tcurrent_renderer.removeAttribute(element, 'defaultChecked');\n\t\t}\n\t\treturn;\n\t}\n\t// @ts-expect-error\n\tconst existing_value = element.checked;\n\t// @ts-expect-error\n\telement.defaultChecked = checked;\n\t// @ts-expect-error\n\telement.checked = existing_value;\n}\n\n/**\n * @param {Element} element\n * @param {string} name\n * @returns {string | null}\n */\nexport function get_attribute(element, name) {\n\tif (current_renderer) return current_renderer.getAttribute(element, name);\n\treturn element.getAttribute(name);\n}\n\n/**\n * @param {Element} element\n * @param {string} name\n */\nexport function remove_attribute(element, name) {\n\tif (current_renderer) {\n\t\tcurrent_renderer.removeAttribute(element, name);\n\t\treturn;\n\t}\n\telement.removeAttribute(name);\n}\n\n/**\n * @param {Element} element\n * @param {string} name\n * @returns {boolean}\n */\nexport function has_attribute(element, name) {\n\tif (current_renderer) return current_renderer.hasAttribute(element, name);\n\treturn element.hasAttribute(name);\n}\n\n/**\n * @param {Element} element\n * @param {string} value\n */\nexport function set_inner_html(element, value) {\n\tif (current_renderer) {\n\t\te.custom_renderer_unsupported_operation('innerHTML');\n\t}\n\telement.innerHTML = value;\n}\n\n/**\n * @param {Node} node\n * @param {boolean} deep\n * @returns {Node}\n */\nexport function clone_node(node, deep) {\n\tif (current_renderer) {\n\t\te.custom_renderer_unsupported_operation('cloneNode');\n\t}\n\treturn node.cloneNode(deep);\n}\n\n/**\n * @param {Node} node\n * @param {boolean} deep\n * @returns {Node}\n */\nexport function import_node(node, deep) {\n\tif (current_renderer) {\n\t\te.custom_renderer_unsupported_operation('importNode');\n\t}\n\treturn document.importNode(node, deep);\n}\n\n/**\n * @param {EventTarget} target\n * @param {string} type\n * @param {EventListenerOrEventListenerObject} handler\n * @param {boolean | AddEventListenerOptions} [options]\n */\nexport function add_event_listener(target, type, handler, options) {\n\tif (current_renderer) {\n\t\tcurrent_renderer.addEventListener(target, type, handler, options);\n\t\treturn;\n\t}\n\ttarget.addEventListener(type, handler, options);\n}\n\n/**\n * @param {EventTarget} target\n * @param {string} type\n * @param {EventListenerOrEventListenerObject} handler\n * @param {boolean | EventListenerOptions} [options]\n */\nexport function remove_event_listener(target, type, handler, options) {\n\tif (current_renderer) {\n\t\tcurrent_renderer.removeEventListener(target, type, handler, options);\n\t\treturn;\n\t}\n\ttarget.removeEventListener(type, handler, options);\n}\n\n/**\n * @param {EventTarget} target\n * @param {Event} event\n * @returns {boolean}\n */\nexport function dispatch_event(target, event) {\n\tif (current_renderer) {\n\t\te.custom_renderer_unsupported_operation('dispatchEvent');\n\t}\n\treturn target.dispatchEvent(event);\n}\n\n/**\n * @param {HTMLElement} element\n * @param {string} property\n * @param {string} value\n * @param {string} [priority]\n */\nexport function style_set_property(element, property, value, priority) {\n\t// custom renderers never get here: `set_style` and `css_props` set the whole attribute instead\n\telement.style.setProperty(property, value, priority);\n}\n\n/**\n * @param {HTMLElement} element\n * @param {string} property\n */\nexport function style_remove_property(element, property) {\n\t// custom renderers never get here: `set_style` and `css_props` set the whole attribute instead\n\telement.style.removeProperty(property);\n}\n\n/**\n * @param {HTMLElement} element\n * @param {string} value\n */\nexport function set_css_text(element, value) {\n\tif (current_renderer) {\n\t\tcurrent_renderer.setAttribute(element, 'style', value);\n\t\treturn;\n\t}\n\telement.style.cssText = value;\n}\n\n/**\n * @param {Element} element\n * @param {string} name\n * @param {boolean} force\n */\nexport function class_list_toggle(element, name, force) {\n\t// custom renderers never get here: `set_class` sets the whole attribute instead\n\telement.classList.toggle(name, force);\n}\n","/** @import { Effect } from '#client' */\n/** @import { Boundary } from './dom/blocks/boundary.js' */\nimport { DEV } from 'esm-env';\nimport { FILENAME, HYDRATION_ERROR } from '../../constants.js';\nimport { is_firefox } from './dom/operations.js';\nimport { BOUNDARY_EFFECT, REACTION_RAN, EFFECT, DESTROYED, DESTROYING } from './constants.js';\nimport { define_property, get_descriptor } from '../shared/utils.js';\nimport { active_effect } from './runtime.js';\n\nconst adjustments = new WeakMap();\n\n/**\n * @param {unknown} error\n */\nexport function handle_error(error) {\n\tvar effect = active_effect;\n\n\t// for unowned deriveds, don't throw until we read the value (the error becomes their value)\n\tif (effect === null) {\n\t\treturn error;\n\t}\n\n\tif (DEV && error instanceof Error && !adjustments.has(error)) {\n\t\tadjustments.set(error, get_adjustments(error, effect));\n\t}\n\n\t// if the error occurred while creating this subtree, we let it\n\t// bubble up until it hits a boundary that can handle it, unless\n\t// it's an $effect in which case it doesn't run immediately\n\tif ((effect.f & REACTION_RAN) === 0 && (effect.f & EFFECT) === 0) {\n\t\tif (DEV && !effect.parent && error instanceof Error) {\n\t\t\tapply_adjustments(error);\n\t\t}\n\n\t\tthrow error;\n\t}\n\n\t// otherwise we bubble up the effect tree ourselves\n\tinvoke_error_boundary(error, effect);\n}\n\n/**\n * @param {unknown} error\n * @param {Effect | null} effect\n */\nexport function invoke_error_boundary(error, effect) {\n\tif (error === HYDRATION_ERROR) {\n\t\tthrow error;\n\t}\n\n\tif (effect !== null && (effect.f & DESTROYED) !== 0) {\n\t\treturn;\n\t}\n\n\twhile (effect !== null) {\n\t\t// Skip boundaries that are destroyed/destroying and cannot meaningfully handle the error.\n\t\tif ((effect.f & BOUNDARY_EFFECT) !== 0 && (effect.f & (DESTROYED | DESTROYING)) === 0) {\n\t\t\tif ((effect.f & REACTION_RAN) === 0) {\n\t\t\t\t// we are still creating the boundary effect\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\t/** @type {Boundary} */ (effect.b).error(error);\n\t\t\t\treturn;\n\t\t\t} catch (e) {\n\t\t\t\terror = e;\n\t\t\t}\n\t\t}\n\n\t\teffect = effect.parent;\n\t}\n\n\tif (DEV && error instanceof Error) {\n\t\tapply_adjustments(error);\n\t}\n\n\tthrow error;\n}\n\n/**\n * Add useful information to the error message/stack in development\n * @param {Error} error\n * @param {Effect} effect\n */\nfunction get_adjustments(error, effect) {\n\tconst message_descriptor = get_descriptor(error, 'message');\n\n\t// if the message was already changed and it's not configurable we can't change it\n\t// or it will throw a different error swallowing the original error\n\tif (message_descriptor && !message_descriptor.configurable) return;\n\n\tvar indent = is_firefox ? ' ' : '\\t';\n\tvar component_stack = `\\n${indent}in ${effect.fn?.name || '<unknown>'}`;\n\tvar context = effect.ctx;\n\n\twhile (context !== null) {\n\t\tcomponent_stack += `\\n${indent}in ${context.function?.[FILENAME].split('/').pop()}`;\n\t\tcontext = context.p;\n\t}\n\n\treturn {\n\t\tmessage: error.message + `\\n${component_stack}\\n`,\n\t\tstack: error.stack\n\t\t\t?.split('\\n')\n\t\t\t.filter((line) => !line.includes('svelte/src/internal'))\n\t\t\t.join('\\n')\n\t};\n}\n\n/**\n * @param {Error} error\n */\nfunction apply_adjustments(error) {\n\tconst adjusted = adjustments.get(error);\n\n\tif (adjusted) {\n\t\tdefine_property(error, 'message', {\n\t\t\tvalue: adjusted.message\n\t\t});\n\n\t\tdefine_property(error, 'stack', {\n\t\t\tvalue: adjusted.stack\n\t\t});\n\t}\n}\n","/** @import { ComponentContext, ComponentContextLegacy, Derived, Effect, TemplateNode, TransitionManager } from '#client' */\n/** @import { Blocker } from './async.js' */\nimport {\n\tis_dirty,\n\tactive_effect,\n\tactive_reaction,\n\tupdate_effect,\n\tget,\n\tis_destroying_effect,\n\tremove_reactions,\n\tset_active_reaction,\n\tset_is_destroying_effect,\n\tteardown_version,\n\tuntrack,\n\tuntracking,\n\tset_active_effect,\n\tabort_all\n} from '../runtime.js';\nimport {\n\tDIRTY,\n\tBRANCH_EFFECT,\n\tRENDER_EFFECT,\n\tEFFECT,\n\tDESTROYED,\n\tINERT,\n\tBLOCK_EFFECT,\n\tROOT_EFFECT,\n\tEFFECT_TRANSPARENT,\n\tDERIVED,\n\tCLEAN,\n\tEAGER_EFFECT,\n\tHEAD_EFFECT,\n\tMAYBE_DIRTY,\n\tEFFECT_PRESERVED,\n\tUSER_EFFECT,\n\tASYNC,\n\tCONNECTED,\n\tMANAGED_EFFECT,\n\tDESTROYING,\n\tPAUSED\n} from '#client/constants';\nimport { invoke_error_boundary } from '../error-handling.js';\nimport * as e from '../errors.js';\nimport { DEV } from 'esm-env';\nimport { define_property } from '../../shared/utils.js';\nimport { get_next_sibling, remove_node, append_child } from '../dom/operations.js';\nimport { component_context, dev_current_component_function, dev_stack } from '../context.js';\nimport { Batch, collected_effects, set_teardown_context, teardown_context } from './batch.js';\nimport { flatten } from './async.js';\nimport { set_signal_status } from './status.js';\nimport { push_renderer, current_renderer, pop_renderer } from '../custom-renderer/state.js';\nimport { custom_renderers_flag } from '../../flags/index.js';\n\n/**\n * @param {'$effect' | '$effect.pre' | '$inspect'} rune\n */\nexport function validate_effect(rune) {\n\tif (active_effect === null) {\n\t\tif (active_reaction === null) {\n\t\t\te.effect_orphan(rune);\n\t\t}\n\n\t\te.effect_in_unowned_derived();\n\t}\n\n\tif (is_destroying_effect) {\n\t\te.effect_in_teardown(rune);\n\t}\n}\n\n/**\n * @param {Effect} effect\n * @param {Effect} parent_effect\n */\nfunction push_effect(effect, parent_effect) {\n\tvar parent_last = parent_effect.last;\n\tif (parent_last === null) {\n\t\tparent_effect.last = parent_effect.first = effect;\n\t} else {\n\t\tparent_last.next = effect;\n\t\teffect.prev = parent_last;\n\t\tparent_effect.last = effect;\n\t}\n}\n\n/**\n * @param {number} type\n * @param {null | (() => void | (() => void))} fn\n * @returns {Effect}\n */\nfunction create_effect(type, fn) {\n\tvar parent = active_effect;\n\n\tif (DEV) {\n\t\t// Ensure the parent is never an inspect effect\n\t\twhile (parent !== null && (parent.f & EAGER_EFFECT) !== 0) {\n\t\t\tparent = parent.parent;\n\t\t}\n\t}\n\n\tif (parent !== null && (parent.f & INERT) !== 0) {\n\t\ttype |= INERT;\n\t}\n\n\t/** @type {Effect} */\n\tvar effect = {\n\t\tctx: component_context,\n\t\tdeps: null,\n\t\tdv: null,\n\t\tedges: null,\n\t\tnodes: null,\n\t\tf: type | DIRTY | CONNECTED,\n\t\tfirst: null,\n\t\tfn,\n\t\tlast: null,\n\t\tnext: null,\n\t\tparent,\n\t\tb: parent && parent.b,\n\t\tprev: null,\n\t\tteardown: null,\n\t\twv: 0,\n\t\tac: null,\n\t\tr: current_renderer\n\t};\n\n\tif (DEV) {\n\t\teffect.component_function = dev_current_component_function;\n\t}\n\n\t/** @type {Effect | null} */\n\tvar e = effect;\n\n\tif ((type & EFFECT) !== 0) {\n\t\tif (collected_effects !== null) {\n\t\t\t// created during traversal — collect and run afterwards\n\t\t\tcollected_effects.push(effect);\n\t\t} else {\n\t\t\t// schedule for later\n\t\t\tBatch.ensure().schedule(effect, DIRTY);\n\t\t}\n\t} else if (fn !== null) {\n\t\ttry {\n\t\t\tupdate_effect(effect);\n\t\t} catch (e) {\n\t\t\tdestroy_effect(effect);\n\t\t\tthrow e;\n\t\t}\n\n\t\t// if an effect doesn't need to be kept in the tree (because it\n\t\t// won't re-run, has no DOM, and has no teardown etc)\n\t\t// then we skip it and go to its child (if any)\n\t\tif (\n\t\t\te.edges === null &&\n\t\t\te.teardown === null &&\n\t\t\te.nodes === null &&\n\t\t\te.first === e.last && // either `null`, or a singular child\n\t\t\t(e.f & EFFECT_PRESERVED) === 0\n\t\t) {\n\t\t\te = e.first;\n\t\t\tif ((type & BLOCK_EFFECT) !== 0 && (type & EFFECT_TRANSPARENT) !== 0 && e !== null) {\n\t\t\t\te.f |= EFFECT_TRANSPARENT;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (e !== null) {\n\t\te.parent = parent;\n\n\t\tif (parent !== null) {\n\t\t\tpush_effect(e, parent);\n\t\t}\n\n\t\t// if we're in a derived, add the effect there too\n\t\tif (\n\t\t\tactive_reaction !== null &&\n\t\t\t(active_reaction.f & DERIVED) !== 0 &&\n\t\t\t(type & ROOT_EFFECT) === 0\n\t\t) {\n\t\t\tvar derived = /** @type {Derived} */ (active_reaction);\n\t\t\t(derived.effects ??= []).push(e);\n\t\t}\n\t}\n\n\treturn effect;\n}\n\n/**\n * Internal representation of `$effect.tracking()`\n * @returns {boolean}\n */\nexport function effect_tracking() {\n\treturn active_reaction !== null && !untracking;\n}\n\n/**\n * @param {() => void} fn\n */\nexport function teardown(fn) {\n\tconst effect = create_effect(RENDER_EFFECT, null);\n\tset_signal_status(effect, CLEAN);\n\teffect.teardown = fn;\n\treturn effect;\n}\n\n/**\n * Internal representation of `$effect(...)`\n * @param {() => void | (() => void)} fn\n */\nexport function user_effect(fn) {\n\tvalidate_effect('$effect');\n\n\tif (DEV) {\n\t\tdefine_property(fn, 'name', {\n\t\t\tvalue: '$effect'\n\t\t});\n\t}\n\n\t// Non-nested `$effect(...)` in a component should be deferred\n\t// until the component is mounted\n\tvar flags = /** @type {Effect} */ (active_effect).f;\n\tvar defer =\n\t\t!active_reaction &&\n\t\t(flags & BRANCH_EFFECT) !== 0 &&\n\t\tcomponent_context !== null &&\n\t\t!component_context.i;\n\n\tif (defer) {\n\t\t// Top-level `$effect(...)` in an unmounted component — defer until mount\n\t\tvar context = /** @type {ComponentContext} */ (component_context);\n\t\t(context.e ??= []).push(fn);\n\t} else {\n\t\t// Everything else — create immediately\n\t\treturn create_user_effect(fn);\n\t}\n}\n\n/**\n * @param {() => void | (() => void)} fn\n */\nexport function create_user_effect(fn) {\n\treturn create_effect(EFFECT | USER_EFFECT, fn);\n}\n\n/**\n * Internal representation of `$effect.pre(...)`\n * @param {() => void | (() => void)} fn\n * @returns {Effect}\n */\nexport function user_pre_effect(fn) {\n\tvalidate_effect('$effect.pre');\n\tif (DEV) {\n\t\tdefine_property(fn, 'name', {\n\t\t\tvalue: '$effect.pre'\n\t\t});\n\t}\n\treturn create_effect(RENDER_EFFECT | USER_EFFECT, fn);\n}\n\n/** @param {() => void | (() => void)} fn */\nexport function eager_effect(fn) {\n\treturn create_effect(EAGER_EFFECT, fn);\n}\n\n/**\n * Internal representation of `$effect.root(...)`\n * @param {() => void | (() => void)} fn\n * @returns {() => void}\n */\nexport function effect_root(fn) {\n\tBatch.ensure();\n\tconst effect = create_effect(ROOT_EFFECT | EFFECT_PRESERVED, fn);\n\n\treturn () => {\n\t\tdestroy_effect(effect);\n\t};\n}\n\n/**\n * An effect root whose children can transition out\n * @param {() => void} fn\n * @returns {(options?: { outro?: boolean }) => Promise<void>}\n */\nexport function component_root(fn) {\n\tBatch.ensure();\n\tconst effect = create_effect(ROOT_EFFECT | EFFECT_PRESERVED, fn);\n\n\treturn (options = {}) => {\n\t\treturn new Promise((fulfil) => {\n\t\t\tif (options.outro) {\n\t\t\t\tpause_effect(effect, () => {\n\t\t\t\t\tdestroy_effect(effect);\n\t\t\t\t\tfulfil(undefined);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tdestroy_effect(effect);\n\t\t\t\tfulfil(undefined);\n\t\t\t}\n\t\t});\n\t};\n}\n\n/**\n * @param {() => void | (() => void)} fn\n * @returns {Effect}\n */\nexport function effect(fn) {\n\treturn create_effect(EFFECT, fn);\n}\n\n/**\n * Internal representation of `$: ..`\n * @param {() => any} deps\n * @param {() => void | (() => void)} fn\n */\nexport function legacy_pre_effect(deps, fn) {\n\tvar context = /** @type {ComponentContextLegacy} */ (component_context);\n\n\t/** @type {{ effect: null | Effect, ran: boolean, deps: () => any }} */\n\tvar token = { effect: null, ran: false, deps };\n\n\tcontext.l.$.push(token);\n\n\ttoken.effect = render_effect(() => {\n\t\tdeps();\n\n\t\t// If this legacy pre effect has already run before the end of the reset, then\n\t\t// bail out to emulate the same behavior.\n\t\tif (token.ran) return;\n\n\t\ttoken.ran = true;\n\n\t\tvar effect = /** @type {Effect} */ (active_effect);\n\n\t\t// here, we lie: by setting `active_effect` to be the parent branch, any writes\n\t\t// that happen inside `fn` will _not_ cause an unnecessary reschedule, because\n\t\t// the affected effects will be children of `active_effect`. this is safe\n\t\t// because these effects are known to run in the correct order\n\t\ttry {\n\t\t\tset_active_effect(effect.parent);\n\t\t\tuntrack(fn);\n\t\t} finally {\n\t\t\tset_active_effect(effect);\n\t\t}\n\t});\n}\n\nexport function legacy_pre_effect_reset() {\n\tvar context = /** @type {ComponentContextLegacy} */ (component_context);\n\n\trender_effect(() => {\n\t\t// Run dirty `$:` statements\n\t\tfor (var token of context.l.$) {\n\t\t\ttoken.deps();\n\n\t\t\tvar effect = token.effect;\n\n\t\t\t// If the effect is CLEAN, then make it MAYBE_DIRTY. This ensures we traverse through\n\t\t\t// the effects dependencies and correctly ensure each dependency is up-to-date.\n\t\t\tif ((effect.f & CLEAN) !== 0 && effect.edges !== null) {\n\t\t\t\tset_signal_status(effect, MAYBE_DIRTY);\n\t\t\t}\n\n\t\t\tif (is_dirty(effect)) {\n\t\t\t\tupdate_effect(effect);\n\t\t\t}\n\n\t\t\ttoken.ran = false;\n\t\t}\n\t});\n}\n\n/**\n * @param {() => void | (() => void)} fn\n * @returns {Effect}\n */\nexport function async_effect(fn) {\n\treturn create_effect(ASYNC | EFFECT_PRESERVED, fn);\n}\n\n/**\n * @param {() => void | (() => void)} fn\n * @returns {Effect}\n */\nexport function render_effect(fn, flags = 0) {\n\treturn create_effect(RENDER_EFFECT | flags, fn);\n}\n\n/**\n * @param {(...expressions: any) => void | (() => void)} fn\n * @param {Array<() => any>} sync\n * @param {Array<() => Promise<any>>} async\n * @param {Blocker[]} blockers\n */\nexport function template_effect(fn, sync = [], async = [], blockers = []) {\n\tflatten(blockers, sync, async, (values) => {\n\t\tcreate_effect(RENDER_EFFECT, () => {\n\t\t\tfn(...values.map(get));\n\t\t});\n\t});\n}\n\n/**\n * Like `template_effect`, but with an effect which is deferred until the batch commits\n * @param {(...expressions: any) => void | (() => void)} fn\n * @param {Array<() => any>} sync\n * @param {Array<() => Promise<any>>} async\n * @param {Blocker[]} blockers\n */\nexport function deferred_template_effect(fn, sync = [], async = [], blockers = []) {\n\tflatten(blockers, sync, async, (values) => {\n\t\tcreate_effect(EFFECT, () => fn(...values.map(get)));\n\t});\n}\n\n/**\n * @param {(() => void)} fn\n * @param {number} flags\n */\nexport function block(fn, flags = 0) {\n\tvar effect = create_effect(BLOCK_EFFECT | flags, fn);\n\tif (DEV) {\n\t\teffect.dev_stack = dev_stack;\n\t}\n\treturn effect;\n}\n\n/**\n * @param {(() => void)} fn\n * @param {number} flags\n */\nexport function managed(fn, flags = 0) {\n\tvar effect = create_effect(MANAGED_EFFECT | flags, fn);\n\tif (DEV) {\n\t\teffect.dev_stack = dev_stack;\n\t}\n\treturn effect;\n}\n\n/**\n * @param {(() => void)} fn\n */\nexport function branch(fn) {\n\treturn create_effect(BRANCH_EFFECT | EFFECT_PRESERVED, fn);\n}\n\n/**\n * @param {Effect} effect\n */\nexport function execute_effect_teardown(effect) {\n\tvar teardown = effect.teardown;\n\tif (teardown !== null) {\n\t\tconst previously_destroying_effect = is_destroying_effect;\n\t\tconst previous_teardown_version = teardown_version;\n\t\tconst previous_teardown_context = teardown_context;\n\t\tconst previous_reaction = active_reaction;\n\t\tset_is_destroying_effect(true);\n\t\tset_active_reaction(null);\n\t\ttry {\n\t\t\tteardown.call(null);\n\t\t} catch (error) {\n\t\t\t// Route teardown errors through the boundary system so that a live\n\t\t\t// ancestor <svelte:boundary> can handle them. Boundaries that are\n\t\t\t// themselves mid-teardown are skipped by invoke_error_boundary.\n\t\t\tinvoke_error_boundary(error, effect.parent);\n\t\t} finally {\n\t\t\tset_is_destroying_effect(previously_destroying_effect, previous_teardown_version);\n\t\t\tset_teardown_context(previous_teardown_context);\n\t\t\tset_active_reaction(previous_reaction);\n\t\t}\n\t}\n}\n\n/**\n * @param {Effect} signal\n * @param {boolean} remove_dom\n * @returns {void}\n */\nexport function destroy_effect_children(signal, remove_dom = false) {\n\tvar effect = signal.first;\n\tsignal.first = signal.last = null;\n\n\twhile (effect !== null) {\n\t\tabort_all(effect);\n\n\t\tvar next = effect.next;\n\n\t\tif ((effect.f & ROOT_EFFECT) !== 0) {\n\t\t\t// this is now an independent root\n\t\t\teffect.parent = null;\n\t\t} else {\n\t\t\tdestroy_effect(effect, remove_dom);\n\t\t}\n\n\t\teffect = next;\n\t}\n}\n\n/**\n * @param {Effect} signal\n * @returns {void}\n */\nexport function destroy_block_effect_children(signal) {\n\tvar effect = signal.first;\n\n\twhile (effect !== null) {\n\t\tvar next = effect.next;\n\t\tif ((effect.f & BRANCH_EFFECT) === 0) {\n\t\t\tdestroy_effect(effect);\n\t\t}\n\t\teffect = next;\n\t}\n}\n\n/**\n * @param {Effect} effect\n * @param {boolean} [remove_dom]\n * @returns {void}\n */\nexport function destroy_effect(effect, remove_dom = true) {\n\tvar removed = false;\n\n\tvar previous_renderer = custom_renderers_flag ? push_renderer(effect.r) : null;\n\n\ttry {\n\t\tif (\n\t\t\t(remove_dom || (effect.f & HEAD_EFFECT) !== 0) &&\n\t\t\teffect.nodes !== null &&\n\t\t\teffect.nodes.end !== null\n\t\t) {\n\t\t\tremove_effect_dom(effect.nodes.start, /** @type {TemplateNode} */ (effect.nodes.end));\n\t\t\tremoved = true;\n\t\t}\n\n\t\teffect.f |= DESTROYING;\n\t\tdestroy_effect_children(effect, remove_dom && !removed);\n\t\tremove_reactions(effect);\n\n\t\tvar transitions = effect.nodes && effect.nodes.t;\n\n\t\tif (transitions !== null) {\n\t\t\tfor (const transition of transitions) {\n\t\t\t\ttransition.stop();\n\t\t\t}\n\t\t}\n\n\t\texecute_effect_teardown(effect);\n\t} finally {\n\t\t// nothing below interacts with the renderer\n\t\tif (custom_renderers_flag) pop_renderer(previous_renderer);\n\t}\n\n\teffect.f ^= DESTROYING;\n\teffect.f |= DESTROYED;\n\n\tvar parent = effect.parent;\n\n\t// If the parent doesn't have any children, then skip this work altogether\n\tif (parent !== null && parent.first !== null) {\n\t\tunlink_effect(effect);\n\t}\n\n\tif (DEV) {\n\t\teffect.component_function = null;\n\t}\n\n\t// `first` and `child` are nulled out in destroy_effect_children\n\t// we don't null out `parent` so that error propagation can work correctly\n\teffect.next =\n\t\teffect.prev =\n\t\teffect.teardown =\n\t\teffect.ctx =\n\t\teffect.deps =\n\t\teffect.dv =\n\t\teffect.edges =\n\t\teffect.fn =\n\t\teffect.nodes =\n\t\teffect.ac =\n\t\teffect.b =\n\t\teffect.r =\n\t\t\tnull;\n}\n\n/**\n *\n * @param {TemplateNode | null} node\n * @param {TemplateNode} end\n */\nexport function remove_effect_dom(node, end) {\n\twhile (node !== null) {\n\t\t/** @type {TemplateNode | null} */\n\t\tvar next = node === end ? null : get_next_sibling(node);\n\n\t\tremove_node(/** @type {ChildNode} */ (node));\n\t\tnode = next;\n\t}\n}\n\n/**\n * Detach an effect from the effect tree, freeing up memory and\n * reducing the amount of work that happens on subsequent traversals\n * @param {Effect} effect\n */\nexport function unlink_effect(effect) {\n\tvar parent = effect.parent;\n\tvar prev = effect.prev;\n\tvar next = effect.next;\n\n\tif (prev !== null) prev.next = next;\n\tif (next !== null) next.prev = prev;\n\n\tif (parent !== null) {\n\t\tif (parent.first === effect) parent.first = next;\n\t\tif (parent.last === effect) parent.last = prev;\n\t}\n}\n\n/**\n * When a block effect is removed, we don't immediately destroy it or yank it\n * out of the DOM, because it might have transitions. Instead, we 'pause' it.\n * It stays around (in memory, and in the DOM) until outro transitions have\n * completed, and if the state change is reversed then we _resume_ it.\n * A paused effect does not update, and the DOM subtree becomes inert.\n * @param {Effect} effect\n * @param {() => void} [callback]\n * @param {boolean} [destroy]\n */\nexport function pause_effect(effect, callback, destroy = true) {\n\t/** @type {TransitionManager[]} */\n\tvar transitions = [];\n\n\teffect.f |= PAUSED;\n\tpause_children(effect, transitions, true);\n\n\tvar fn = () => {\n\t\tif (destroy) destroy_effect(effect);\n\t\tif (callback) callback();\n\t};\n\n\tvar remaining = transitions.length;\n\n\tif (remaining > 0) {\n\t\tvar context = teardown_context;\n\n\t\tvar check = () => {\n\t\t\tif (!--remaining) {\n\t\t\t\tvar previous_context = teardown_context;\n\n\t\t\t\ttry {\n\t\t\t\t\tif (context) {\n\t\t\t\t\t\t// Other outros can share this context, and state may have changed\n\t\t\t\t\t\t// since its derived values were cached.\n\t\t\t\t\t\tcontext.derived_cache.clear();\n\t\t\t\t\t\tset_teardown_context(context);\n\t\t\t\t\t}\n\t\t\t\t\tfn();\n\t\t\t\t} finally {\n\t\t\t\t\tif (context) set_teardown_context(previous_context);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tfor (var transition of transitions) {\n\t\t\ttransition.out(check);\n\t\t}\n\t} else {\n\t\tfn();\n\t}\n}\n\n/**\n * @param {Effect} effect\n * @param {TransitionManager[]} transitions\n * @param {boolean} local\n */\nfunction pause_children(effect, transitions, local) {\n\tif ((effect.f & INERT) !== 0) return;\n\teffect.f ^= INERT;\n\n\tvar t = effect.nodes && effect.nodes.t;\n\n\tif (t !== null) {\n\t\tfor (const transition of t) {\n\t\t\tif (transition.is_global || local) {\n\t\t\t\ttransitions.push(transition);\n\t\t\t}\n\t\t}\n\t}\n\n\tvar child = effect.first;\n\n\twhile (child !== null) {\n\t\tvar sibling = child.next;\n\n\t\t// If this child is a root effect, then it will become an independent root when its parent\n\t\t// is destroyed, it should therefore not become inert nor partake in transitions.\n\t\tif ((child.f & ROOT_EFFECT) === 0) {\n\t\t\tvar transparent =\n\t\t\t\t(child.f & EFFECT_TRANSPARENT) !== 0 ||\n\t\t\t\t// If this is a branch effect without a block effect parent,\n\t\t\t\t// it means the parent block effect was pruned. In that case,\n\t\t\t\t// transparency information was transferred to the branch effect.\n\t\t\t\t((child.f & BRANCH_EFFECT) !== 0 && (effect.f & BLOCK_EFFECT) !== 0);\n\t\t\t// TODO we don't need to call pause_children recursively with a linked list in place\n\t\t\t// it's slightly more involved though as we have to account for `transparent` changing\n\t\t\t// through the tree.\n\t\t\tpause_children(child, transitions, transparent ? local : false);\n\t\t}\n\n\t\tchild = sibling;\n\t}\n}\n\n/**\n * The opposite of `pause_effect`. We call this if (for example)\n * `x` becomes falsy then truthy: `{#if x}...{/if}`\n * @param {Effect} effect\n */\nexport function resume_effect(effect) {\n\teffect.f &= ~PAUSED;\n\tresume_children(effect, true);\n}\n\n/**\n * @param {Effect} effect\n * @param {boolean} local\n */\nfunction resume_children(effect, local) {\n\t// this subtree was paused for its own reasons (e.g. a block whose condition\n\t// is still false) — its controller will resume or destroy it\n\tif ((effect.f & PAUSED) !== 0) return;\n\n\tif ((effect.f & INERT) === 0) return;\n\teffect.f ^= INERT;\n\n\t// If a dependency of this effect may have changed while it was paused,\n\t// schedule the effect to update. we don't use `is_dirty`\n\t// here because we don't want to eagerly recompute a derived like\n\t// `{#if foo}{foo.bar()}{/if}` if `foo` is now `undefined`.\n\tif ((effect.f & CLEAN) === 0) {\n\t\t// Assumption: This happens during the commit phase of the batch, causing another flush, but it's safe\n\t\tBatch.ensure().schedule(effect, MAYBE_DIRTY);\n\t}\n\n\tvar child = effect.first;\n\n\twhile (child !== null) {\n\t\tvar sibling = child.next;\n\t\tvar transparent = (child.f & EFFECT_TRANSPARENT) !== 0 || (child.f & BRANCH_EFFECT) !== 0;\n\t\t// TODO we don't need to call resume_children recursively with a linked list in place\n\t\t// it's slightly more involved though as we have to account for `transparent` changing\n\t\t// through the tree.\n\t\tresume_children(child, transparent ? local : false);\n\t\tchild = sibling;\n\t}\n\n\tvar t = effect.nodes && effect.nodes.t;\n\n\tif (t !== null) {\n\t\tfor (const transition of t) {\n\t\t\tif (transition.is_global || local) {\n\t\t\t\ttransition.in();\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * @param {Effect} effect\n * @param {DocumentFragment} fragment\n */\nexport function move_effect(effect, fragment) {\n\tif (!effect.nodes) return;\n\n\tvar previous_renderer = custom_renderers_flag ? push_renderer(effect.r) : null;\n\n\ttry {\n\t\t/** @type {TemplateNode | null} */\n\t\tvar node = effect.nodes.start;\n\t\tvar end = effect.nodes.end;\n\n\t\twhile (node !== null) {\n\t\t\t/** @type {TemplateNode | null} */\n\t\t\tvar next = node === end ? null : get_next_sibling(node);\n\n\t\t\tappend_child(fragment, node);\n\t\t\tnode = next;\n\t\t}\n\t} finally {\n\t\tif (custom_renderers_flag) pop_renderer(previous_renderer);\n\t}\n}\n","/** @import { Value } from '#client' */\nimport { internal_set } from './reactivity/sources.js';\nimport { untrack } from './runtime.js';\n\n/**\n * @type {Set<Value> | null}\n * @deprecated\n */\nexport let captured_signals = null;\n\n/**\n * Capture an array of all the signals that are read when `fn` is called\n * @template T\n * @param {() => T} fn\n */\nfunction capture_signals(fn) {\n\tvar previous_captured_signals = captured_signals;\n\n\ttry {\n\t\tcaptured_signals = new Set();\n\n\t\tuntrack(fn);\n\n\t\tif (previous_captured_signals !== null) {\n\t\t\tfor (var signal of captured_signals) {\n\t\t\t\tprevious_captured_signals.add(signal);\n\t\t\t}\n\t\t}\n\n\t\treturn captured_signals;\n\t} finally {\n\t\tcaptured_signals = previous_captured_signals;\n\t}\n}\n\n/**\n * Invokes a function and captures all signals that are read during the invocation,\n * then invalidates them.\n * @param {() => any} fn\n * @deprecated\n */\nexport function invalidate_inner_signals(fn) {\n\tfor (var signal of capture_signals(fn)) {\n\t\tinternal_set(signal, signal.v);\n\t}\n}\n","import { hydrating } from '../hydration.js';\nimport { clear_text_content, get_first_child, add_event_listener } from '../operations.js';\nimport { queue_micro_task } from '../task.js';\nimport { FORM_RESET_HANDLER } from '../../constants.js';\n\n/**\n * @param {HTMLElement} dom\n * @param {boolean} value\n * @returns {void}\n */\nexport function autofocus(dom, value) {\n\tif (value) {\n\t\tconst body = document.body;\n\t\tdom.autofocus = true;\n\n\t\tqueue_micro_task(() => {\n\t\t\tif (document.activeElement === body) {\n\t\t\t\tdom.focus();\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * The child of a textarea actually corresponds to the defaultValue property, so we need\n * to remove it upon hydration to avoid a bug when someone resets the form value.\n * @param {HTMLTextAreaElement} dom\n * @returns {void}\n */\nexport function remove_textarea_child(dom) {\n\tif (hydrating && get_first_child(dom) !== null) {\n\t\tclear_text_content(dom);\n\t}\n}\n\nlet listening_to_form_reset = false;\n\nexport function add_form_reset_listener() {\n\tif (!listening_to_form_reset) {\n\t\tlistening_to_form_reset = true;\n\t\tadd_event_listener(\n\t\t\tdocument,\n\t\t\t'reset',\n\t\t\t(evt) => {\n\t\t\t\t// Needs to happen one tick later or else the dom properties of the form\n\t\t\t\t// elements have not updated to their reset values yet\n\t\t\t\tPromise.resolve().then(() => {\n\t\t\t\t\tif (!evt.defaultPrevented) {\n\t\t\t\t\t\tfor (const e of /**@type {HTMLFormElement} */ (evt.target).elements) {\n\t\t\t\t\t\t\t/** @type {any} */ (e)[FORM_RESET_HANDLER]?.();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t\t// In the capture phase to guarantee we get noticed of it (no possibility of stopPropagation)\n\t\t\t{ capture: true }\n\t\t);\n\t}\n}\n","import { teardown } from '../../../reactivity/effects.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tset_active_effect,\n\tset_active_reaction\n} from '../../../runtime.js';\nimport { FORM_RESET_HANDLER } from '../../../constants.js';\nimport { add_form_reset_listener } from '../misc.js';\n\n/**\n * Fires the handler once immediately (unless corresponding arg is set to `false`),\n * then listens to the given events until the render effect context is destroyed\n * @param {EventTarget} target\n * @param {Array<string>} events\n * @param {(event?: Event) => void} handler\n * @param {any} call_handler_immediately\n */\nexport function listen(target, events, handler, call_handler_immediately = true) {\n\tif (call_handler_immediately) {\n\t\thandler();\n\t}\n\n\tfor (var name of events) {\n\t\ttarget.addEventListener(name, handler);\n\t}\n\n\tteardown(() => {\n\t\tfor (var name of events) {\n\t\t\ttarget.removeEventListener(name, handler);\n\t\t}\n\t});\n}\n\n/**\n * @template T\n * @param {() => T} fn\n */\nexport function without_reactive_context(fn) {\n\tvar previous_reaction = active_reaction;\n\tvar previous_effect = active_effect;\n\tset_active_reaction(null);\n\tset_active_effect(null);\n\ttry {\n\t\treturn fn();\n\t} finally {\n\t\tset_active_reaction(previous_reaction);\n\t\tset_active_effect(previous_effect);\n\t}\n}\n\n/**\n * Listen to the given event, and then instantiate a global form reset listener if not already done,\n * to notify all bindings when the form is reset\n * @param {HTMLElement} element\n * @param {string} event\n * @param {(is_reset?: true) => void} handler\n * @param {(is_reset?: true) => void} [on_reset]\n */\nexport function listen_to_event_and_reset_event(element, event, handler, on_reset = handler) {\n\telement.addEventListener(event, () => without_reactive_context(handler));\n\tconst prev = /** @type {any} */ (element)[FORM_RESET_HANDLER];\n\tif (prev) {\n\t\t// special case for checkbox that can have multiple binds (group & checked)\n\t\t/** @type {any} */ (element)[FORM_RESET_HANDLER] = () => {\n\t\t\tprev();\n\t\t\ton_reset(true);\n\t\t};\n\t} else {\n\t\t/** @type {any} */ (element)[FORM_RESET_HANDLER] = () => on_reset(true);\n\t}\n\n\tadd_form_reset_listener();\n}\n","/** @import { BatchRecord, BatchValue, Derived, DerivedRecord, Effect, Reaction, Source, Value } from '#client' */\nimport { DEV } from 'esm-env';\nimport { get_descriptors, get_prototype_of, includes, index_of } from '../shared/utils.js';\nimport {\n\tdestroy_block_effect_children,\n\tdestroy_effect_children,\n\teffect_tracking,\n\texecute_effect_teardown\n} from './reactivity/effects.js';\nimport {\n\tDIRTY,\n\tMAYBE_DIRTY,\n\tCLEAN,\n\tDERIVED,\n\tDESTROYED,\n\tBRANCH_EFFECT,\n\tSTATE_SYMBOL,\n\tBLOCK_EFFECT,\n\tROOT_EFFECT,\n\tCONNECTED,\n\tREACTION_IS_UPDATING,\n\tSTALE_REACTION,\n\tERROR_VALUE,\n\tHAS_ABORT_CONTROLLER,\n\tMANAGED_EFFECT,\n\tREACTION_RAN,\n\tASYNC,\n\tASSIGNED\n} from './constants.js';\nimport {\n\treactivity_loss_tracker,\n\texecute_derived,\n\tfreeze_derived_effects,\n\trecent_async_deriveds,\n\tunfreeze_derived_effects,\n\tupdate_derived,\n\tget_view\n} from './reactivity/deriveds.js';\nimport { async_mode_flag, tracing_mode_flag, custom_renderers_flag } from '../flags/index.js';\nimport { tracing_expressions } from './dev/tracing.js';\nimport { get_error } from '../shared/dev.js';\nimport {\n\tcomponent_context,\n\tdev_current_component_function,\n\tdev_stack,\n\tis_runes,\n\tset_component_context,\n\tset_dev_current_component_function,\n\tset_dev_stack\n} from './context.js';\nimport {\n\tBatch,\n\tbatch_values,\n\tcurrent_batch,\n\tfirst_batch,\n\tflushSync,\n\tpush_teardown_context,\n\tteardown_context,\n\tview_batch,\n\tview_cache\n} from './reactivity/batch.js';\nimport { handle_error } from './error-handling.js';\nimport { UNINITIALIZED } from '../../constants.js';\nimport { captured_signals } from './legacy.js';\nimport { without_reactive_context } from './dom/elements/bindings/shared.js';\nimport { set_signal_status, update_derived_status } from './reactivity/status.js';\nimport { merge_target } from './reactivity/async.js';\nimport * as e from './errors.js';\nimport * as w from './warnings.js';\nimport { push_renderer, pop_renderer } from './custom-renderer/state.js';\n\nexport let is_destroying_effect = false;\n\n/** The write version when the running teardown started — later writes happened in it, and aren't reverted */\nexport let teardown_version = 0;\n\n/**\n * @param {boolean} value\n * @param {number} [version]\n */\nexport function set_is_destroying_effect(value, version = write_version) {\n\tis_destroying_effect = value;\n\tteardown_version = version;\n}\n\n/**\n * The result of the latest run of a derived in a teardown, which only the teardown sees: `update_dependencies` sets\n * it — that's where the run's dependencies, which determine its version, are known — instead of storing the run, and\n * `teardown_view` takes it right after `execute_derived`\n * @type {BatchValue}\n */\nlet teardown_run = { v: undefined, wv: 0, e: false, assigned: false };\n\n/** @type {null | Reaction} */\nexport let active_reaction = null;\n\nexport let untracking = false;\n\n/** @param {null | Reaction} reaction */\nexport function set_active_reaction(reaction) {\n\tactive_reaction = reaction;\n}\n\n/** @type {null | Effect} */\nexport let active_effect = null;\n\n/** @param {null | Effect} effect */\nexport function set_active_effect(effect) {\n\tactive_effect = effect;\n}\n\n/**\n * When sources are created within a reaction, reading and writing\n * them within that reaction should not cause a re-run\n * @type {null | Set<Value>}\n */\nexport let current_sources = null;\n\n/** @param {Value} value */\nexport function push_reaction_value(value) {\n\tif (\n\t\tactive_reaction !== null &&\n\t\t((!async_mode_flag && (active_reaction.f & REACTION_IS_UPDATING) !== 0) ||\n\t\t\t(active_reaction.f & DERIVED) !== 0)\n\t) {\n\t\t(current_sources ??= new Set()).add(value);\n\t}\n}\n\n/**\n * The dependencies of the reaction that is currently being executed. In many cases,\n * the dependencies are unchanged between runs, and so this will be `null` unless\n * and until a new dependency is accessed — we track this via `skipped_deps`\n * @type {null | Value[]}\n */\nexport let new_deps = null;\n\nexport let skipped_deps = 0;\n\n/**\n * Tracks writes that the effect it's executed in doesn't listen to yet,\n * so that the dependency can be added to the effect later on if it then reads it\n * @type {null | Value[]}\n */\nexport let untracked_writes = null;\n\n/** @param {null | Value[]} value */\nexport function set_untracked_writes(value) {\n\tuntracked_writes = value;\n}\n\n/**\n * @type {number} Used by sources and deriveds for handling updates: every new value — whether it is\n * the real-world (i.e. latest) one, or only exists within a batch — gets a new version. Versions\n * identify values, they are only ever compared for equality (except for `$inspect.trace`).\n * Version starts from 1 so that unowned deriveds differentiate between a created effect and a run one for tracing\n **/\nexport let write_version = 1;\n\n/** @type {number} Used to version each read of a source of derived to avoid duplicating dependencies inside a reaction */\nlet read_version = 0;\n\nexport let update_version = read_version;\n\n/** @param {number} value */\nexport function set_update_version(value) {\n\tupdate_version = value;\n}\n\nexport function increment_write_version() {\n\treturn ++write_version;\n}\n\n/**\n * The version `signal` has in the active view of the world, bringing deriveds up to date\n * @param {Value} signal\n */\nexport function version_of(signal) {\n\tif (batch_values === null) {\n\t\tupdate_derived(signal);\n\t\treturn signal.wv;\n\t}\n\n\tif ((signal.f & DERIVED) !== 0) {\n\t\treturn get_view(/** @type {Derived} */ (signal)).wv;\n\t}\n\n\treturn (batch_values.get(signal) ?? signal).wv;\n}\n\n/**\n * Whether the values with the given versions are (still) what `deps` hold in the active view of the world.\n * Dependencies are checked in order and deriveds are brought up to date along the way, so that we\n * don't evaluate a derived that the reaction would no longer read (e.g. `a ? b : c` where `a` changed)\n * @param {Value[] | null} deps\n * @param {number[]} dv\n */\nexport function is_current(deps, dv) {\n\tif (deps !== null) {\n\t\tfor (var i = 0; i < dv.length; i++) {\n\t\t\tif (version_of(deps[i]) !== dv[i]) return false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\n/**\n * Whether none of `deps` has been written since the version `wv` in the active view of the world, which is\n * how a value assigned to a derived (whose version is `wv`) holds: until one of the values read by the run\n * that applies in the view (see `get_view`) is written after it. Comparing versions with those the\n * dependencies had at the time of the assignment, like `is_current` does, wouldn't work: a view might undo\n * a write the assignment saw, and a committed fork might apply one it didn't see — but both writes happened\n * before the assignment, so they don't make it outdated.\n *\n * This (and its counterpart in `teardown_view`) is where versions are compared by order across views. That only works for versions of writes\n * (including assignments), which are allocated when the write happens. A derived's version is allocated when it is\n * evaluated, which can be after the assignment even if everything it read was written before it (e.g. because it is\n * evaluated lazily, or again in another view). So a derived only counts as changed if, in addition, one of the\n * values its run in the view read was written after the assignment\n * @param {Value[] | null} deps\n * @param {number} wv\n * @param {Set<Derived | DerivedRecord | BatchValue> | null} [unchanged] runs that this walk found unchanged,\n * to avoid walking a derived that is reachable by more than one path (e.g. a diamond) once per path. Only valid\n * within one top-level call: `wv` and the view are fixed, and the walk itself doesn't write anything\n */\nexport function changed_since(deps, wv, unchanged = null) {\n\tif (deps !== null) {\n\t\tfor (var i = 0; i < deps.length; i++) {\n\t\t\tvar dep = deps[i];\n\n\t\t\tif ((dep.f & DERIVED) === 0) {\n\t\t\t\tif (version_of(dep) > wv) return true;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// the run of the derived that applies in the view, brought up to date — or a value assigned to it\n\t\t\t/** @type {Derived | DerivedRecord | BatchValue} */\n\t\t\tvar run = /** @type {Derived} */ (dep);\n\n\t\t\tif (batch_values === null) {\n\t\t\t\tupdate_derived(/** @type {Derived} */ (dep));\n\t\t\t} else {\n\t\t\t\trun = get_view(/** @type {Derived} */ (dep));\n\t\t\t}\n\n\t\t\t// (an equal value keeps its version, so a derived whose value didn't change since doesn't count either)\n\t\t\tif (run.wv > wv) {\n\t\t\t\tvar assigned = run === dep ? (dep.f & ASSIGNED) !== 0 : !('dv' in run);\n\n\t\t\t\tif (assigned) return true;\n\n\t\t\t\t// this run was already found to have no writes after `wv` below it\n\t\t\t\tif (unchanged === null) {\n\t\t\t\t\tunchanged = new Set();\n\t\t\t\t} else if (unchanged.has(run)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (changed_since(/** @type {DerivedRecord} */ (run).deps, wv, unchanged)) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\tunchanged.add(run);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn false;\n}\n\n/**\n * For block/async effects returns the record of the {@link view_batch} (if any), else reaction itself.\n * @param {Reaction} reaction\n * @returns {Reaction | BatchRecord}\n */\nexport function run_of(reaction) {\n\treturn (\n\t\t((reaction.f & (BLOCK_EFFECT | ASYNC)) !== 0 && view_batch?.get_record(reaction)) || reaction\n\t);\n}\n\n/**\n * Determines whether a derived or effect is dirty.\n * If it is MAYBE_DIRTY (or an assigned derived) and isn't, will set the status to CLEAN.\n * Deriveds are only checked like this in the real world — within the view of a batch,\n * see {@link get_view}. Effects are checked against the run that applies (see `run_of`).\n * @param {Reaction} reaction\n * @returns {boolean}\n */\nexport function is_dirty(reaction) {\n\tvar flags = reaction.f;\n\n\tif ((flags & (DIRTY | MAYBE_DIRTY)) === 0) {\n\t\treturn false;\n\t}\n\n\tif ((flags & ASSIGNED) !== 0) {\n\t\t// A value assigned to a derived holds until one of its dependencies is written after it, which its flags\n\t\t// can't tell: writes that don't change the real world (e.g. those of a fork) mark the derived, too\n\t\tif (changed_since(reaction.deps, reaction.wv)) return true;\n\t} else if ((flags & DIRTY) !== 0) {\n\t\treturn true;\n\t} else {\n\t\tvar run = run_of(reaction);\n\t\tvar deps = run.deps;\n\t\tvar dv = run.dv;\n\n\t\tif (dv === null) return true;\n\n\t\tif (batch_values === null) {\n\t\t\tfor (var i = 0, length = dv.length; i < length; i++) {\n\t\t\t\tvar dependency = /** @type {Value[]} */ (deps)[i];\n\n\t\t\t\tupdate_derived(dependency);\n\n\t\t\t\tif (dependency.wv !== dv[i]) return true;\n\t\t\t}\n\t\t} else if (!is_current(deps, dv)) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\tif ((flags & CONNECTED) !== 0) {\n\t\tset_signal_status(reaction, CLEAN);\n\t}\n\n\treturn false;\n}\n\n/**\n * @param {Value} signal\n * @param {Effect} effect\n * @param {boolean} [root]\n */\nfunction schedule_possible_effect_self_invalidation(signal, effect, root = true) {\n\tvar reactions = signal.reactions;\n\tif (reactions === null) return;\n\n\tif (!async_mode_flag && current_sources !== null && current_sources.has(signal)) {\n\t\treturn;\n\t}\n\n\tfor (var i = 0; i < reactions.length; i++) {\n\t\tvar reaction = reactions[i];\n\n\t\tif ((reaction.f & DERIVED) !== 0) {\n\t\t\tschedule_possible_effect_self_invalidation(/** @type {Derived} */ (reaction), effect, false);\n\t\t} else if (effect === reaction) {\n\t\t\t/** @type {Batch} */ (current_batch).schedule(\n\t\t\t\t/** @type {Effect} */ (reaction),\n\t\t\t\troot ? DIRTY : MAYBE_DIRTY\n\t\t\t);\n\t\t}\n\t}\n}\n\n/**\n * The controller of the signal of the run in progress, if it asked for one (see `get_abort_signal`). Once the run is\n * done, it's stored with the run: on the reaction for its global run, or on the record a batch holds of it\n * @type {AbortController | null}\n */\nexport let abort_controller = null;\n\n/**\n * The signal of the run of `reaction` that is in progress. Its controller is stored with the run once it's done\n * (see `set_global_signal` and `update_record`) — `reaction.ac` is the previous global run's until then\n * @param {Reaction} reaction\n */\nexport function get_abort_signal(reaction) {\n\tif ((reaction.f & REACTION_IS_UPDATING) === 0) {\n\t\t// for now, disallow calling `getAbortSignal()` after an `await`. we could\n\t\t// potentially relax this restriction in future, but it adds complexity\n\t\te.get_abort_signal_after_await();\n\t}\n\n\treaction.f |= HAS_ABORT_CONTROLLER;\n\n\treturn (abort_controller ??= new AbortController()).signal;\n}\n\n/** @param {AbortController | null | undefined} controller */\nfunction abort_signal(controller) {\n\tif (controller) without_reactive_context(() => controller.abort(STALE_REACTION));\n}\n\n/**\n * Abort the signal of a record of `reaction` that a batch replaces or drops — unless another batch holds the\n * record, too (see `keep_global_run`), in which case it aborts once the last one lets go of it\n * @param {Reaction} reaction\n * @param {BatchRecord | undefined} record\n * @param {boolean} [rerun] whether `reaction` is about to run again (see `abort_replaced`). The active batch\n * and the batches that the new run supersedes still hold the record then, but don't count\n */\nexport function abort_record(reaction, record, rerun = false) {\n\tif (!record?.ac) return;\n\n\tfor (var b = first_batch; b !== null; b = b.next) {\n\t\tif (\n\t\t\tb.records?.get(reaction) === record &&\n\t\t\t!(rerun && (b === view_batch || supersedes(current_batch, b)))\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t}\n\n\tabort_signal(record.ac);\n\trecord.ac = null;\n}\n\n/**\n * Before `reaction` runs again, abort the signals of the runs it replaces: its run in the active batch (which the\n * new run replaces either way, see `update_record`), its global run if the new run is going to replace that one,\n * and the runs of earlier batches that a run in a real batch supersedes (see `supersedes`). (Forks stay\n * independent until they're committed or discarded.) Whether a derived's run in a view replaces the global run\n * is only known once it's done (see `set_global_signal`) — unless the global run is outdated in the real world\n * anyway\n * @param {Reaction} reaction\n * @param {number} flags\n */\nfunction abort_replaced(reaction, flags) {\n\tvar batch = current_batch;\n\tvar is_derived = (flags & DERIVED) !== 0;\n\n\t// a teardown's run of a derived doesn't replace anything (see `teardown_view`)\n\tif (is_derived && is_destroying_effect) return;\n\n\tvar real = batch === null || !batch.is_fork;\n\n\tabort_record(reaction, view_batch?.records?.get(reaction), true);\n\n\tif (is_derived ? batch_values === null || (real && is_outdated(reaction)) : real) {\n\t\t// (the controller stays referenced until the new run is stored, see `keep_global_run`)\n\t\tabort_signal(reaction.ac);\n\t}\n\n\tfor (var b = first_batch; b !== null; b = b.next) {\n\t\tif (supersedes(batch, b)) abort_record(reaction, b.records?.get(reaction), true);\n\t}\n}\n\n/**\n * The run that just ended is the global state of `reaction`: its signal replaces the global run's, which aborts —\n * unless other batches took that run over, along with its signal (see `keep_global_run`)\n * @param {Reaction} reaction\n */\nfunction set_global_signal(reaction) {\n\tabort_signal(reaction.ac);\n\treaction.ac = abort_controller;\n}\n\n/**\n * Whether a run is invalid or a dependency's real-world version has changed.\n * This does not evaluate derived dependencies, which may themselves be outdated.\n * @param {Reaction | BatchRecord} run\n */\nexport function is_outdated({ deps, dv }) {\n\treturn dv === null || dv.some((version, i) => /** @type {Value[]} */ (deps)[i].wv !== version);\n}\n\n/**\n * Whether a run in `batch` supersedes the runs of batch `other`, so that their signals abort (see `abort_replaced`):\n * a run in a real batch supersedes those of earlier batches whose writes it saw — because it ran in the real world,\n * or in a view that folds them, or undoes none of their writes (e.g. because they committed, see `Batch#activate`).\n * The runs of other earlier batches read their writes, which this run didn't see, so they still apply in their\n * views. Forks stay independent until they're committed or discarded\n * @param {Batch | null} batch\n * @param {Batch} other\n */\nfunction supersedes(batch, other) {\n\treturn (\n\t\tbatch !== null &&\n\t\t!batch.is_fork &&\n\t\t!other.is_fork &&\n\t\tother.id < batch.id &&\n\t\t(batch_values === null || other.previous.size === 0 || batch.folded.includes(other))\n\t);\n}\n\n/**\n * Abort all signals of `reaction` (see `getAbortSignal`), e.g. because it's destroyed.\n * Returns whether a run had requested a signal, even if it was already aborted\n * @param {Reaction} reaction\n */\nexport function abort_all(reaction) {\n\tif ((reaction.f & HAS_ABORT_CONTROLLER) === 0) return false;\n\treaction.f ^= HAS_ABORT_CONTROLLER;\n\n\tabort_signal(reaction.ac);\n\treaction.ac = null;\n\n\tfor (var b = first_batch; b !== null; b = b.next) {\n\t\tvar record = b.records?.get(reaction);\n\n\t\tif (record?.ac) {\n\t\t\tabort_signal(record.ac);\n\t\t\trecord.ac = null;\n\t\t}\n\t}\n\n\treturn true;\n}\n\n/**\n * Whether or not we should unconditionally record a reaction run within a batch, as opposed\n * to updating the signal directly. True for async effects, and previously-initialized\n * block effects (as long as they run during traversal, rather than on commit)\n * @param {number} flags\n */\nfunction is_recorded_effect(flags) {\n\tif (\n\t\t(flags & ASYNC) === 0 &&\n\t\t(flags & (BLOCK_EFFECT | REACTION_RAN)) !== (BLOCK_EFFECT | REACTION_RAN)\n\t) {\n\t\treturn false;\n\t}\n\n\treturn view_batch !== null && view_batch === current_batch;\n}\n\n/** @param {Reaction} reaction */\nexport function update_reaction(reaction) {\n\tconst batch = current_batch;\n\tvar previous_deps = new_deps;\n\tvar previous_skipped_deps = skipped_deps;\n\tvar previous_untracked_writes = untracked_writes;\n\tvar previous_reaction = active_reaction;\n\tvar previous_sources = current_sources;\n\tvar previous_component_context = component_context;\n\tvar previous_untracking = untracking;\n\tvar previous_update_version = update_version;\n\n\tvar flags = reaction.f;\n\n\tnew_deps = /** @type {null | Value[]} */ (null);\n\tskipped_deps = 0;\n\tuntracked_writes = null;\n\tactive_reaction = (flags & (BRANCH_EFFECT | ROOT_EFFECT)) === 0 ? reaction : null;\n\n\tcurrent_sources = null;\n\tset_component_context(reaction.ctx);\n\tuntracking = false;\n\tupdate_version = ++read_version;\n\n\tvar previous_abort_controller = abort_controller;\n\tabort_controller = null;\n\n\tif ((flags & HAS_ABORT_CONTROLLER) !== 0) {\n\t\tabort_replaced(reaction, flags);\n\t}\n\n\ttry {\n\t\treaction.f |= REACTION_IS_UPDATING;\n\t\tvar fn = /** @type {Function} */ (reaction.fn);\n\t\tvar result = fn();\n\t\treaction.f |= REACTION_RAN;\n\t\tupdate_dependencies(reaction, flags, result, false);\n\n\t\t// If we're inside an effect and we have untracked writes, then we need to\n\t\t// ensure that if any of those untracked writes result in re-invalidation\n\t\t// of the current effect, then that happens accordingly\n\t\tif (\n\t\t\tis_runes() &&\n\t\t\tuntracked_writes !== null &&\n\t\t\t!untracking &&\n\t\t\t// bail out if the effect didn't read anything\n\t\t\t(new_deps !== null || skipped_deps > 0) &&\n\t\t\t(reaction.f & (DERIVED | MAYBE_DIRTY | DIRTY)) === 0\n\t\t) {\n\t\t\tfor (var i = 0; i < /** @type {Source[]} */ (untracked_writes).length; i++) {\n\t\t\t\tschedule_possible_effect_self_invalidation(\n\t\t\t\t\tuntracked_writes[i],\n\t\t\t\t\t/** @type {Effect} */ (reaction)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// If we are returning to an previous reaction then\n\t\t// we need to increment the read version to ensure that\n\t\t// any dependencies in this reaction aren't marked with\n\t\t// the same version\n\t\tif (previous_reaction !== null && previous_reaction !== reaction) {\n\t\t\tread_version++;\n\n\t\t\t// update the `rv` of the previous reaction's deps — both existing and new —\n\t\t\t// so that they are not added again\n\t\t\tif (previous_reaction.deps !== null) {\n\t\t\t\tfor (let i = 0; i < previous_skipped_deps; i += 1) {\n\t\t\t\t\tprevious_reaction.deps[i].rv = read_version;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (previous_deps !== null) {\n\t\t\t\tfor (const dep of previous_deps) {\n\t\t\t\t\tdep.rv = read_version;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (untracked_writes !== null) {\n\t\t\t\tif (previous_untracked_writes === null) {\n\t\t\t\t\tprevious_untracked_writes = untracked_writes;\n\t\t\t\t} else {\n\t\t\t\t\tprevious_untracked_writes.push(.../** @type {Source[]} */ (untracked_writes));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t} catch (error) {\n\t\tvar value = error;\n\n\t\ttry {\n\t\t\tvalue = handle_error(error);\n\t\t} finally {\n\t\t\t// Still commit the deps read before the throw, otherwise deriveds connected by this run keep no reader\n\t\t\t// and the reaction never re-runs when they change. For a derived, the error is the value of the run\n\t\t\t// (`get` throws it) — unless an error boundary took care of it\n\t\t\tupdate_dependencies(reaction, flags, value, value === error);\n\t\t}\n\n\t\treturn value;\n\t} finally {\n\t\tvar signal = /** @type {AbortController | null} */ (abort_controller)?.signal;\n\n\t\tif (batch !== null && signal !== undefined) {\n\t\t\t// The reaction that requested the signal identifies the merge target, even if\n\t\t\t// another reaction awaits its result (e.g. `let promise = $derived(load(...))`).\n\t\t\tsignal.addEventListener('abort', () => {\n\t\t\t\tif (current_batch !== null) {\n\t\t\t\t\tconst target = merge_target(batch);\n\n\t\t\t\t\tif (target !== current_batch && target.linked && !target.is_fork) {\n\t\t\t\t\t\tcurrent_batch.merge_requests.add(target);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\treaction.f ^= REACTION_IS_UPDATING;\n\t\tnew_deps = previous_deps;\n\t\tskipped_deps = previous_skipped_deps;\n\t\tuntracked_writes = previous_untracked_writes;\n\t\tactive_reaction = previous_reaction;\n\t\tcurrent_sources = previous_sources;\n\t\tset_component_context(previous_component_context);\n\t\tuntracking = previous_untracking;\n\t\tupdate_version = previous_update_version;\n\t\tabort_controller = previous_abort_controller;\n\t}\n}\n\n/**\n * Store the result of the current run of `reaction` where it belongs — the versions of the\n * values it read and, for a derived, its value — and update the edges of the graph.\n *\n * A run belongs to the real world — and becomes the reaction's global state — unless\n * - it is a derived that read values which aren't the latest ones (it is then stored in the batch\n * whose view of the world it ran in, see {@link get_view})\n * - it is an effect run that belongs to a batch (see {@link update_record})\n * - it is a derived evaluated in a teardown, in which case only the teardown sees it (see `teardown_view`)\n *\n * The edges of the graph (`reaction.edges` and the `reactions` of its dependencies) are a\n * superset of the dependencies of every live record, so that changes to any of them reach\n * the reaction. They are only pruned when a global run happens and no batch holds a record.\n * @param {Reaction} reaction\n * @param {number} flags the flags of the reaction before the run\n * @param {any} value the value of the run (only relevant for deriveds)\n * @param {boolean} error whether the value is an error\n */\nfunction update_dependencies(reaction, flags, value, error) {\n\tvar deps = reaction.deps;\n\tvar length = skipped_deps + (new_deps === null ? 0 : new_deps.length);\n\tvar dv = reaction.dv;\n\n\t// an effect can be destroyed while it runs, e.g. by an error boundary\n\tif ((reaction.f & DESTROYED) !== 0) {\n\t\tabort_signal(abort_controller);\n\t\treturn;\n\t}\n\n\t// ...and so can the last reaction of a derived, which aborts the derived's signals, see `remove_reaction`.\n\t// `abort_all` removed the flag that the run in progress set, so its signal is still to be aborted\n\tif (abort_controller !== null && (reaction.f & HAS_ABORT_CONTROLLER) === 0) {\n\t\tabort_signal(abort_controller);\n\t\tabort_controller = null;\n\t}\n\n\tif ((flags & DERIVED) !== 0 && is_destroying_effect) {\n\t\t// The run belongs to the teardown's view of the world (see `teardown_view`).\n\t\t// Its value can't be more recent than what it read\n\t\tvar wv = 0;\n\n\t\tfor (var j = 0; j < length; j++) {\n\t\t\tvar dep =\n\t\t\t\tj < skipped_deps\n\t\t\t\t\t? /** @type {Value[]} */ (deps)[j]\n\t\t\t\t\t: /** @type {Value[]} */ (new_deps)[j - skipped_deps];\n\n\t\t\twv = Math.max(wv, teardown_version_of(dep));\n\t\t}\n\n\t\t// TODO: the run's signal (if any) is never aborted — should we abort when the teardown's view of the\n\t\t// world is done with the run?\n\t\tteardown_run = { v: value, wv, e: error, assigned: (flags & ASSIGNED) !== 0 };\n\t\treturn;\n\t}\n\n\t// A run of a derived in the real world is its new global state. Other batches may still see the current one\n\t// (in a view, whether a derived's run is a global one is decided by `update_record`)\n\tif (\n\t\t(flags & DERIVED) !== 0 &&\n\t\tbatch_values === null &&\n\t\tfirst_batch !== null &&\n\t\tfirst_batch.next !== null\n\t) {\n\t\tkeep_global_run(/** @type {Derived} */ (reaction), flags);\n\t}\n\n\t// Fast path: the reaction read the same values as before, in the real world, and has no other edges\n\tif (\n\t\tnew_deps === null &&\n\t\tbatch_values === null &&\n\t\tdv !== null &&\n\t\tlength === deps?.length &&\n\t\treaction.edges === deps &&\n\t\t(flags & (BLOCK_EFFECT | ASYNC)) === 0\n\t) {\n\t\t// The run saw what its dependencies hold now — a write during the run after it read\n\t\t// the value marks it dirty (see `Batch#schedule`), so it doesn't take effect here\n\t\tfor (var i = 0; i < length; i++) dv[i] = deps[i].wv;\n\t\tif (dv.length !== length) dv.length = length;\n\n\t\tif ((flags & DERIVED) !== 0) set_derived_value(/** @type {Derived} */ (reaction), value, error);\n\t\tif (reaction.ac || abort_controller) set_global_signal(reaction);\n\n\t\treturn;\n\t}\n\n\tupdate_record(reaction, flags, length, value, error);\n}\n\n/**\n * Make `value` the (real-world) value of `derived` — it keeps its version if it is the same value\n * @param {Derived} derived\n * @param {any} value\n * @param {boolean} error\n */\nfunction set_derived_value(derived, value, error) {\n\t// a run replaces a value that was assigned to the derived\n\tvar flags = derived.f & ~ASSIGNED;\n\n\tif (error || (flags & ERROR_VALUE) !== 0 || !derived.equals(value)) {\n\t\tderived.v = value;\n\t\tderived.wv = increment_write_version();\n\t\tflags = error ? flags | ERROR_VALUE : flags & ~ERROR_VALUE;\n\t}\n\n\tderived.f = flags;\n\tupdate_derived_status(derived);\n}\n\n/**\n * The general case of `update_dependencies`, which\n * 1. decides where the run belongs: to the batch whose view of the world is active (as a record, see\n * `Batch#records`), or to the real world (as the reaction's global state)\n * 2. records the versions of the values the run read (`dv`)\n * 3. updates the edges of the graph\n * 4. stores the run where it belongs\n * @param {Reaction} reaction\n * @param {number} flags the flags of the reaction before the run\n * @param {number} length the number of values the run read\n * @param {any} value the value of the run (only relevant for deriveds)\n * @param {boolean} error whether the value is an error\n */\nfunction update_record(reaction, flags, length, value, error) {\n\t// Block and async effects that run while a batch is processed produce a result for that batch (the\n\t// branch it selected, the value an async expression resolved to for it), which it keeps until it\n\t// commits. The first run of a block effect is the exception — it creates (and commits) its initial\n\t// branch. (Whether a derived's run belongs to a batch depends on what it read, see below)\n\tvar should_record = is_recorded_effect(flags);\n\n\t// A derived that has another version in the view than in the real world — because the view undoes an\n\t// assignment to it, or it was assigned in a fork — never runs for the real world (see `get_view`)\n\tif (batch_values !== null && (flags & DERIVED) !== 0) {\n\t\tvar written = batch_values.get(/** @type {Derived} */ (reaction));\n\n\t\tif (written !== undefined && written.wv !== /** @type {Derived} */ (reaction).wv) {\n\t\t\tshould_record = true;\n\t\t}\n\t}\n\n\tvar deps = reaction.deps;\n\tvar read = deps;\n\tif (new_deps !== null || skipped_deps !== deps?.length) {\n\t\tread =\n\t\t\tskipped_deps === 0\n\t\t\t\t? new_deps\n\t\t\t\t: /** @type {Value[]} */ (deps).slice(0, skipped_deps).concat(new_deps ?? []);\n\t}\n\n\t// A global run in the real world updates the versions in place. Anything else needs a new array:\n\t// a record must not share it with the global state, and a derived's run can turn out to belong\n\t// to the batch halfway through the loop\n\tvar dv = !should_record && batch_values === null && reaction.dv !== null ? reaction.dv : [];\n\n\tfor (var i = 0; i < length; i++) {\n\t\tvar dep = /** @type {Value[]} */ (read)[i];\n\t\tdv[i] = seen_version(dep);\n\n\t\t// Within a batch's view, a derived's run belongs to the batch unless everything it read is the latest\n\t\t// value: the version it saw is the real-world one, and — for a derived — that one is up to date\n\t\tif (\n\t\t\tbatch_values !== null &&\n\t\t\t(flags & DERIVED) !== 0 &&\n\t\t\t(dv[i] !== dep.wv || (dep.f & (DERIVED | CLEAN)) === DERIVED)\n\t\t) {\n\t\t\tshould_record = true;\n\t\t}\n\t}\n\n\tif (dv.length !== length) dv.length = length;\n\n\tif (!should_record && batch_values !== null && (flags & DERIVED) !== 0) {\n\t\tkeep_global_run(/** @type {Derived} */ (reaction), flags);\n\t}\n\n\t// The edges — `reaction.edges`, and `reaction` in the `reactions` of each of them — must cover what every\n\t// live run of the reaction read (its global run, and the records batches hold of it), so that a change to\n\t// any of those values reaches it. So unless this is a global run and no batch holds a record, edges are\n\t// only added (and pruned by a later global run). Their order is independent of the run's reads\n\tvar keep = should_record || has_batch_record(reaction);\n\tvar tracking = effect_tracking() && (reaction.f & CONNECTED) !== 0;\n\tvar edges = reaction.edges;\n\n\tif (keep && edges !== null) {\n\t\tif (new_deps !== null) {\n\t\t\t// the edges may be a run's `deps` as well, see `update_dependencies`\n\t\t\treaction.edges = edges = edges.slice();\n\t\t\tfor (dep of new_deps) {\n\t\t\t\tif (!includes.call(edges, dep)) {\n\t\t\t\t\tedges.push(dep);\n\t\t\t\t\tif (tracking) (dep.reactions ??= []).push(reaction);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif (edges === deps) {\n\t\t\t// The edges are exactly what the previous global run read (if anything), so — as on `main` —\n\t\t\t// the values this run read again, in the same order, stay connected, and the rest is replaced\n\t\t\tif (edges !== null) {\n\t\t\t\tfor (i = skipped_deps; i < edges.length; i++) remove_reaction(reaction, edges[i]);\n\t\t\t}\n\n\t\t\tif (tracking && new_deps !== null) {\n\t\t\t\tfor (dep of new_deps) (dep.reactions ??= []).push(reaction);\n\t\t\t}\n\t\t} else {\n\t\t\t// The edges can include some that were retained for runs no batch holds anymore\n\t\t\tvar added = new Set(read);\n\t\t\tfor (dep of /** @type {Value[]} */ (edges)) {\n\t\t\t\tif (!added.delete(dep)) remove_reaction(reaction, dep);\n\t\t\t}\n\n\t\t\tif (tracking) {\n\t\t\t\tfor (dep of added) (dep.reactions ??= []).push(reaction);\n\t\t\t}\n\t\t}\n\n\t\treaction.edges = read;\n\t}\n\n\tif (should_record) {\n\t\tvar batch = /** @type {Batch} */ (view_batch);\n\n\t\t(batch.records ??= new Map()).set(\n\t\t\treaction,\n\t\t\t(flags & DERIVED) !== 0\n\t\t\t\t? {\n\t\t\t\t\t\tdeps: read,\n\t\t\t\t\t\tdv,\n\t\t\t\t\t\tv: value,\n\t\t\t\t\t\te: error,\n\t\t\t\t\t\twv: derived_version(/** @type {Derived} */ (reaction), batch, value, error),\n\t\t\t\t\t\tac: abort_controller\n\t\t\t\t\t}\n\t\t\t\t: { deps: read, dv, ac: abort_controller }\n\t\t);\n\t} else {\n\t\treaction.deps = read;\n\t\treaction.dv = dv;\n\t\tif (reaction.ac || abort_controller) set_global_signal(reaction);\n\n\t\tif ((flags & DERIVED) !== 0) {\n\t\t\tset_derived_value(/** @type {Derived} */ (reaction), value, error);\n\n\t\t\t// A record of the derived in the active batch is outdated now. (Effects never have one at this point:\n\t\t\t// their runs only become global outside of processing, on their first run, or once the batch commits,\n\t\t\t// whose records are promoted by then)\n\t\t\tview_batch?.records?.delete(reaction);\n\t\t}\n\t}\n}\n\n/**\n * A run of `derived` that becomes its global state replaces the current one, which other batches may still see:\n * their views differ from the real world, and can undo the writes that made it outdated. It is kept as a record in\n * each of them that doesn't have one, so that they don't evaluate the derived again — which would give an equal value\n * a new version, and re-run what saw the current one (restarting async work, for example). That's also the case if\n * the new value is equal, and so keeps its version: the derived itself would still run again, with whatever side\n * effects it has (like asking for a new abort signal). (Like any record, it is only used where it `is_current`)\n *\n * If the derived uses an abort signal, the kept run's may have been aborted when the derived ran again. Only the batches\n * that the new run supersedes (see `supersedes`) keep it regardless — it stays aborted for them until something it read\n * changes in their view. The others (forks, later batches) evaluate the derived again.\n *\n * A fork's run supersedes nothing, though, so the run it replaces isn't aborted: a batch may still be waiting for it.\n * Every other batch keeps it then, and the record takes over its signal, which aborts once no batch holds the record\n * anymore (see `abort_record`)\n * @param {Derived} derived\n * @param {number} flags the flags of the derived before the run\n */\nfunction keep_global_run(derived, flags) {\n\tvar dv = derived.dv;\n\n\tif (\n\t\t// no valid run, or one that doesn't depend on anything — which is only run again if it was invalidated\n\t\tdv === null ||\n\t\tdv.length === 0 ||\n\t\t// an assigned value isn't a run, see `get_view`\n\t\t(flags & ASSIGNED) !== 0\n\t) {\n\t\treturn;\n\t}\n\n\t/** @type {DerivedRecord | undefined} */\n\tvar record;\n\n\tvar ac = derived.ac;\n\n\t// whether the run's signal stays live, because a fork's view ran the derived (it's only aborted before the\n\t// derived runs again if the run was in the real world, see `abort_replaced`)\n\tvar live = ac !== null && current_batch !== null && current_batch.is_fork && !ac.signal.aborted;\n\n\tfor (var batch = first_batch; batch !== null; batch = batch.next) {\n\t\tif (\n\t\t\tbatch !== view_batch &&\n\t\t\t!batch.records?.has(derived) &&\n\t\t\t// otherwise, the run's signal was aborted when the derived ran again, or is about to be (see `set_global_signal`)\n\t\t\t(ac === null || live || supersedes(current_batch, batch))\n\t\t) {\n\t\t\t// All batches that retain this run share one record. (Its versions are copied: the\n\t\t\t// derived's next global run in the real world updates its own in place)\n\t\t\trecord ??= {\n\t\t\t\tdeps: derived.deps,\n\t\t\t\tdv: dv.slice(),\n\t\t\t\tv: derived.v,\n\t\t\t\twv: derived.wv,\n\t\t\t\te: (flags & ERROR_VALUE) !== 0\n\t\t\t};\n\t\t\t(batch.records ??= new Map()).set(derived, record);\n\t\t}\n\t}\n\n\tif (live && record !== undefined) {\n\t\t// the signal belongs to the batches that kept the run now. (If none did, `set_global_signal` aborts it)\n\t\trecord.ac = ac;\n\t\tderived.ac = null;\n\t}\n}\n\n/**\n * The version of `signal` that the current run saw. Recording it never evaluates anything: a derived that\n * isn't in the view's cache (anymore) was invalidated by a write during the run, or can't be cached —\n * the run then doesn't count as having seen its current version, just like in the real world, where\n * a derived that changes during the run gets a new version only once it is evaluated again\n * @param {Value} signal\n */\nfunction seen_version(signal) {\n\tif (batch_values === null) return signal.wv;\n\n\tif ((signal.f & DERIVED) !== 0) {\n\t\tvar cache = /** @type {Map<Derived, Derived | DerivedRecord | BatchValue>} */ (view_cache);\n\t\treturn cache.get(/** @type {Derived} */ (signal))?.wv ?? -1;\n\t}\n\n\treturn (batch_values.get(signal) ?? signal).wv;\n}\n\n/**\n * Reuse the version of an equal value in the batch's previous run, then the global value,\n * or allocate a new one. Errors always get a new version\n * @param {Derived} derived\n * @param {Batch} batch\n * @param {any} value\n * @param {boolean} error\n */\nfunction derived_version(derived, batch, value, error) {\n\tif (!error) {\n\t\tvar previous = /** @type {DerivedRecord | undefined} */ (batch.get_record(derived));\n\t\tif (previous !== undefined && !previous.e && derived.equals.call(previous, value)) {\n\t\t\treturn previous.wv;\n\t\t}\n\n\t\tif ((derived.f & ERROR_VALUE) === 0 && derived.equals(value)) return derived.wv;\n\t}\n\n\treturn increment_write_version();\n}\n\n/**\n * Make the record a batch holds of `reaction` its global state, e.g. because the batch\n * committed, which makes its results the real-world ones (for a derived, that includes its value)\n * @param {Reaction} reaction\n * @param {BatchRecord} record\n */\nexport function promote_record(reaction, record) {\n\treaction.deps = record.deps;\n\t// The global run updates its versions in place. An effect's record is dropped when it is promoted, but\n\t// other batches can still hold a derived's (see `keep_global_run`), so that one keeps its own\n\treaction.dv = (reaction.f & DERIVED) !== 0 ? record.dv.slice() : record.dv;\n\n\tif ((reaction.f & DERIVED) !== 0) {\n\t\tvar derived = /** @type {Derived} */ (reaction);\n\n\t\tderived.v = record.v;\n\t\tderived.wv = /** @type {number} */ (record.wv);\n\t\tderived.f = (record.e ? derived.f | ERROR_VALUE : derived.f & ~ERROR_VALUE) & ~ASSIGNED;\n\t\tupdate_derived_status(derived);\n\t}\n\n\t// the run's signal replaces the global run's (so that dropping the record doesn't abort it, see `Batch#release_records`)\n\tabort_signal(reaction.ac);\n\treaction.ac = record.ac ?? null;\n\trecord.ac = null;\n}\n\n/** @param {Reaction} reaction */\nfunction has_batch_record(reaction) {\n\tfor (var batch = first_batch; batch !== null; batch = batch.next) {\n\t\tif (batch.records?.has(reaction)) return true;\n\t}\n\n\treturn false;\n}\n\n/**\n * Remove the edges of an effect that only runs no batch holds anymore needed (because the batch committed and\n * its record was promoted, or because it was dropped), once no batch holds a record of it, so that its edges are\n * what its global run read again. `update_record` only prunes edges in a global run that happens while no batch\n * holds a record, which block and async effects hardly ever have: they run in batches.\n * (Not for deriveds: their edges also notify the reactions that read the value of a record that was dropped. They\n * are pruned by their next global run)\n * @param {Reaction} effect\n */\nexport function prune_edges(effect) {\n\tvar edges = effect.edges;\n\tvar deps = effect.deps;\n\n\tif (edges === deps || has_batch_record(effect)) return;\n\n\t// (the edges are a superset of `deps`, so nothing needs to be connected)\n\tfor (var dep of /** @type {Value[]} */ (edges)) {\n\t\tif (deps === null || !includes.call(deps, dep)) remove_reaction(effect, dep);\n\t}\n\n\teffect.edges = deps;\n}\n\n/**\n * Connect a reaction outside its normal dependency update, without duplicating subscriptions\n * @param {Value} signal\n * @param {Reaction} reaction\n */\nfunction add_reaction(signal, reaction) {\n\tvar reactions = (signal.reactions ??= []);\n\tif (!includes.call(reactions, reaction)) reactions.push(reaction);\n}\n\n/**\n * @template V\n * @param {Reaction} signal\n * @param {Value<V>} dependency\n * @returns {void}\n */\nfunction remove_reaction(signal, dependency) {\n\tlet reactions = dependency.reactions;\n\tif (reactions !== null) {\n\t\tvar index = index_of.call(reactions, signal);\n\t\tif (index !== -1) {\n\t\t\tvar new_length = reactions.length - 1;\n\t\t\tif (new_length === 0) {\n\t\t\t\treactions = dependency.reactions = null;\n\t\t\t} else {\n\t\t\t\t// Swap with last element and then remove.\n\t\t\t\treactions[index] = reactions[new_length];\n\t\t\t\treactions.pop();\n\t\t\t}\n\t\t}\n\t}\n\n\t// If the derived has no reactions, then we can disconnect it from the graph,\n\t// allowing it to either reconnect in the future, or be GC'd by the VM.\n\tif (\n\t\treactions === null &&\n\t\t(dependency.f & DERIVED) !== 0 &&\n\t\t// Destroying a child effect while updating a parent effect can cause a dependency to appear\n\t\t// to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`\n\t\t// allows us to skip the expensive work of disconnecting and immediately reconnecting it\n\t\t(new_deps === null || !includes.call(new_deps, dependency))\n\t) {\n\t\tvar derived = /** @type {Derived} */ (dependency);\n\n\t\tif ((derived.f & CONNECTED) !== 0) {\n\t\t\tderived.f ^= CONNECTED;\n\n\t\t\t// `mark` no longer reaches the derived, so nothing would remove its view from the cache when it becomes stale\n\t\t\tview_cache?.delete(derived);\n\t\t}\n\n\t\t// In a fork it's possible that a derived is executed and gets reactions, then commits, but is\n\t\t// never re-executed. This is possible when the derived is only executed once in the context\n\t\t// of a new branch which happens before fork.commit() runs. In this case, the derived still has\n\t\t// UNINITIALIZED as its value, and then when it's losing its reactions we need to ensure it stays\n\t\t// DIRTY so it is reexecuted once someone wants its value again.\n\t\tif (derived.v !== UNINITIALIZED) {\n\t\t\tupdate_derived_status(derived);\n\t\t}\n\n\t\t// Call abort controller, noone's listening to this derived anymore: no live run of any reaction, in any batch,\n\t\t// read it (the edges cover them all, see `Reaction#edges`). That includes the runs of it that batches hold\n\t\tif (abort_all(derived)) {\n\t\t\t// ensure it reruns right away next time instead of potentially returning a rejected promise as its value —\n\t\t\t// in the real world, and in every batch's view (which would otherwise reuse its record of the derived)\n\t\t\tset_signal_status(derived, DIRTY);\n\t\t\tderived.dv = null;\n\t\t\tfor (var b = first_batch; b !== null; b = b.next) b.records?.delete(derived);\n\t\t\tview_cache?.delete(derived);\n\t\t}\n\n\t\t// freeze any effects inside this derived\n\t\tfreeze_derived_effects(derived);\n\n\t\t// Disconnect any reactions owned by this reaction\n\t\tremove_reactions(derived);\n\t}\n}\n\n/**\n * @param {Reaction} signal\n * @returns {void}\n */\nexport function remove_reactions(signal) {\n\tvar dependencies = signal.edges;\n\tif (dependencies === null) return;\n\n\tfor (var i = 0; i < dependencies.length; i++) {\n\t\tremove_reaction(signal, dependencies[i]);\n\t}\n}\n\n/**\n * @param {Effect} effect\n * @returns {void}\n */\nexport function update_effect(effect) {\n\tvar flags = effect.f;\n\n\tif ((flags & DESTROYED) !== 0) {\n\t\treturn;\n\t}\n\n\tset_signal_status(effect, CLEAN);\n\n\tvar previous_effect = active_effect;\n\n\tactive_effect = effect;\n\n\tvar previous_renderer = custom_renderers_flag ? push_renderer(effect.r) : null;\n\n\tif (DEV) {\n\t\tvar previous_component_fn = dev_current_component_function;\n\t\tset_dev_current_component_function(effect.component_function);\n\t\tvar previous_stack = /** @type {any} */ (dev_stack);\n\t\t// only block effects have a dev stack, keep the current one otherwise\n\t\tset_dev_stack(effect.dev_stack ?? dev_stack);\n\t}\n\n\ttry {\n\t\tif ((flags & (BLOCK_EFFECT | MANAGED_EFFECT)) !== 0) {\n\t\t\tdestroy_block_effect_children(effect);\n\t\t} else {\n\t\t\tdestroy_effect_children(effect);\n\t\t}\n\n\t\texecute_effect_teardown(effect);\n\t\tvar teardown = update_reaction(effect);\n\t\teffect.teardown = typeof teardown === 'function' ? teardown : null;\n\n\t\t// Whether an effect is dirty is determined by the exact versions of its dependencies (see\n\t\t// `update_dependencies`) — this only marks when it last ran, which `$inspect.trace` uses\n\t\teffect.wv = write_version;\n\n\t\t// In DEV, increment versions of any sources that were written to during the effect,\n\t\t// so that they are correctly marked as dirty when the effect re-runs\n\t\tif (DEV && tracing_mode_flag && (effect.f & DIRTY) !== 0 && effect.edges !== null) {\n\t\t\tfor (var dep of effect.edges) {\n\t\t\t\tif (dep.set_during_effect) {\n\t\t\t\t\tdep.wv = increment_write_version();\n\t\t\t\t\tdep.set_during_effect = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} finally {\n\t\tactive_effect = previous_effect;\n\n\t\tif (custom_renderers_flag) pop_renderer(previous_renderer);\n\n\t\tif (DEV) {\n\t\t\tset_dev_current_component_function(previous_component_fn);\n\t\t\tset_dev_stack(previous_stack);\n\t\t}\n\t}\n}\n\n/**\n * Returns a promise that resolves once any pending state changes have been applied.\n * @returns {Promise<void>}\n */\nexport async function tick() {\n\tif (async_mode_flag) {\n\t\treturn new Promise((f) => {\n\t\t\t// Race them against each other - in almost all cases requestAnimationFrame will fire first,\n\t\t\t// but e.g. in case the window is not focused or a view transition happens, requestAnimationFrame\n\t\t\t// will be delayed and setTimeout helps us resolve fast enough in that case\n\t\t\trequestAnimationFrame(() => f());\n\t\t\tsetTimeout(() => f());\n\t\t});\n\t}\n\n\tawait Promise.resolve();\n\n\t// By calling flushSync we guarantee that any pending state changes are applied after one tick.\n\t// TODO look into whether we can make flushing subsequent updates synchronously in the future.\n\tflushSync();\n}\n\n/**\n * Returns a promise that resolves once any state changes, and asynchronous work resulting from them,\n * have resolved and the DOM has been updated\n * @returns {Promise<void>}\n * @since 5.36\n */\nexport function settled() {\n\treturn Batch.ensure().settled();\n}\n\n/**\n * @template V\n * @param {Value<V>} signal\n * @returns {V}\n */\nexport function get(signal) {\n\tvar flags = signal.f;\n\tvar is_derived = (flags & DERIVED) !== 0;\n\n\tcaptured_signals?.add(signal);\n\n\t/** The reaction that reads `signal` after an `await`, if any */\n\tvar late_reader = null;\n\n\t// Register the dependency on the current reaction signal.\n\tif (active_reaction !== null && !untracking) {\n\t\t// if we're in a derived that is being read inside an _async_ derived,\n\t\t// it's possible that the effect was already destroyed. In this case,\n\t\t// we don't add the dependency, because that would create a memory leak\n\t\tvar destroyed = active_effect !== null && (active_effect.f & DESTROYED) !== 0;\n\n\t\tif (!destroyed && (current_sources === null || !current_sources.has(signal))) {\n\t\t\tvar deps = active_reaction.deps;\n\n\t\t\tif ((active_reaction.f & REACTION_IS_UPDATING) !== 0) {\n\t\t\t\t// we're in the effect init/update cycle\n\t\t\t\tif (signal.rv < read_version) {\n\t\t\t\t\tsignal.rv = read_version;\n\n\t\t\t\t\t// If the signal is accessing the same dependencies in the same\n\t\t\t\t\t// order as it did last time, increment `skipped_deps`\n\t\t\t\t\t// rather than updating `new_deps`, which creates GC cost\n\t\t\t\t\tif (new_deps === null && deps !== null && deps[skipped_deps] === signal) {\n\t\t\t\t\t\tskipped_deps++;\n\t\t\t\t\t} else if (new_deps === null) {\n\t\t\t\t\t\tnew_deps = [signal];\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnew_deps.push(signal);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlate_reader = active_reaction;\n\n\t\t\t\t// Late reads add an edge immediately, even if evaluating the value throws.\n\t\t\t\tvar edges = active_reaction.edges;\n\t\t\t\tif (edges === null || !includes.call(edges, signal)) {\n\t\t\t\t\tactive_reaction.edges = edges === null ? [signal] : [...edges, signal];\n\t\t\t\t}\n\n\t\t\t\tadd_reaction(signal, active_reaction);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (DEV) {\n\t\tif (\n\t\t\t!untracking &&\n\t\t\t// By checking that no batch is active we filter out false positives.\n\t\t\t// reactivity_loss_tracker is only reset after a microtask, so if a flush happens\n\t\t\t// before that, we get warnings for things we shouldn't warn on.\n\t\t\tview_batch === null &&\n\t\t\treactivity_loss_tracker &&\n\t\t\t!reactivity_loss_tracker.warned &&\n\t\t\t(reactivity_loss_tracker.effect.f & REACTION_IS_UPDATING) === 0 &&\n\t\t\t!reactivity_loss_tracker.effect_deps.has(signal)\n\t\t) {\n\t\t\treactivity_loss_tracker.warned = true;\n\n\t\t\tw.await_reactivity_loss(/** @type {string} */ (signal.label));\n\n\t\t\tvar trace = get_error('traced at');\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tif (trace) console.warn(trace);\n\t\t}\n\n\t\trecent_async_deriveds.delete(signal);\n\n\t\tif (\n\t\t\ttracing_mode_flag &&\n\t\t\t!untracking &&\n\t\t\ttracing_expressions !== null &&\n\t\t\tactive_reaction !== null &&\n\t\t\ttracing_expressions.reaction === active_reaction\n\t\t) {\n\t\t\t// Used when mapping state between special blocks like `each`\n\t\t\tif (signal.trace) {\n\t\t\t\tsignal.trace();\n\t\t\t} else {\n\t\t\t\ttrace = get_error('traced at');\n\n\t\t\t\tif (trace) {\n\t\t\t\t\tvar entry = tracing_expressions.entries.get(signal);\n\n\t\t\t\t\tif (entry === undefined) {\n\t\t\t\t\t\tentry = { traces: [] };\n\t\t\t\t\t\ttracing_expressions.entries.set(signal, entry);\n\t\t\t\t\t}\n\n\t\t\t\t\tvar last = entry.traces[entry.traces.length - 1];\n\n\t\t\t\t\t// traces can be duplicated, e.g. by `snapshot` invoking both\n\t\t\t\t\t// both `getOwnPropertyDescriptor` and `get` traps at once\n\t\t\t\t\tif (trace.stack !== last?.stack) {\n\t\t\t\t\t\tentry.traces.push(trace);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (is_destroying_effect) {\n\t\t// teardowns have their own view of the world; nothing read here is recorded\n\t\tvar held = teardown_view(signal);\n\n\t\tif (held !== undefined) {\n\t\t\tif (held.e) throw held.v;\n\t\t\treturn held.v;\n\t\t}\n\t}\n\n\t/**\n\t * The value (and version) as the active view of the world sees it, if it differs from the real\n\t * world — for a derived, this is the derived itself if its global state applies (see `get_view`)\n\t * @type {{ v: any, wv: number, e?: boolean } | undefined}\n\t */\n\tvar view;\n\n\tif (is_derived) {\n\t\tvar derived = /** @type {Derived} */ (signal);\n\n\t\t// connect disconnected deriveds when reading them inside a connected reaction\n\t\tvar should_connect =\n\t\t\t(derived.f & CONNECTED) === 0 &&\n\t\t\t!untracking &&\n\t\t\tactive_reaction !== null &&\n\t\t\t(active_reaction.f & CONNECTED) !== 0;\n\n\t\tvar is_new = (derived.f & REACTION_RAN) === 0;\n\n\t\tif (should_connect) {\n\t\t\t// set the flag before the derived is (re)evaluated, so that\n\t\t\t// it is added as a reaction to its dependencies\n\t\t\tderived.f |= CONNECTED;\n\t\t}\n\n\t\tif (batch_values !== null) {\n\t\t\tview = get_view(derived);\n\t\t} else {\n\t\t\tupdate_derived(derived);\n\t\t}\n\n\t\tif (should_connect && !is_new) {\n\t\t\tunfreeze_derived_effects(derived);\n\t\t\treconnect(derived);\n\t\t}\n\t} else if (batch_values !== null) {\n\t\tview = batch_values.get(signal);\n\t}\n\n\tif (late_reader !== null) {\n\t\trecord_late_read(late_reader, signal, view === undefined ? signal.wv : view.wv);\n\t}\n\n\tif (view !== undefined && view !== signal) {\n\t\tif (view.e) throw view.v;\n\t\treturn view.v;\n\t}\n\n\tif ((signal.f & ERROR_VALUE) !== 0) {\n\t\tthrow signal.v;\n\t}\n\n\treturn signal.v;\n}\n\n/**\n * Record that `reaction` read `signal` (with the given version) after an `await`, i.e. after\n * its run — as part of the record of that run\n * @param {Reaction} reaction\n * @param {Value} signal\n * @param {number} version\n */\nfunction record_late_read(reaction, signal, version) {\n\tvar run = run_of(reaction);\n\tvar deps = run.deps;\n\n\tif (run.dv !== null && (deps === null || !includes.call(deps, signal))) {\n\t\trun.deps = deps === null ? [signal] : [...deps, signal];\n\t\trun.dv.push(version);\n\t}\n}\n\n/**\n * (Re)connect a disconnected derived, so that it is notified\n * of changes in `mark_reactions`\n * @param {Derived} derived\n */\nfunction reconnect(derived) {\n\tderived.f |= CONNECTED;\n\n\tif (derived.edges === null) return;\n\n\tfor (const dep of derived.edges) {\n\t\tadd_reaction(dep, derived);\n\n\t\tif ((dep.f & DERIVED) !== 0 && (dep.f & CONNECTED) === 0) {\n\t\t\tunfreeze_derived_effects(/** @type {Derived} */ (dep));\n\t\t\treconnect(/** @type {Derived} */ (dep));\n\t\t}\n\t}\n}\n\n/**\n * The value of `signal` in the view of the world of the running teardown, if it differs from the active one:\n * teardowns revert the writes that caused them, apart from their own (see `TeardownContext`). Deriveds always\n * get one, since their runs in a teardown only belong to it, and it is cached until the view changes:\n * - a value written to the derived, while none of its dependencies is written after it (like in `get_view`)\n * - its global run, if its dependencies still have the versions that run read\n * - otherwise a new run (see `update_dependencies`), which keeps the version of the value it replaces if equal\n * @param {Value} signal\n * @returns {BatchValue | undefined}\n */\nfunction teardown_view(signal) {\n\tvar written =\n\t\tsignal.wv > teardown_version ? undefined : teardown_context?.reverted_values.get(signal);\n\n\tif ((signal.f & DERIVED) === 0) return written;\n\n\tvar derived = /** @type {Derived} */ (signal);\n\tvar cache = (teardown_context ?? push_teardown_context()).derived_cache;\n\tvar record = cache.get(derived);\n\n\tif (record !== undefined) return record;\n\n\t// A value written to the derived — reverted, or the active view's — holds if it was assigned, like in `get_view`:\n\t// the value from before an assignment may have been computed, with values that the teardown reverts\n\tvar held = written ?? batch_values?.get(derived);\n\tvar assigned = held === undefined ? (derived.f & ASSIGNED) !== 0 : held.assigned;\n\t// (the versions its global run read, if that can apply)\n\tvar dv = held === undefined && !assigned ? derived.dv : null;\n\tvar deps = derived.deps ?? [];\n\tvar holds = assigned || dv !== null;\n\tvar length = dv?.length ?? deps.length;\n\n\theld ??= {\n\t\tv: derived.v,\n\t\twv: derived.wv,\n\t\te: (derived.f & ERROR_VALUE) !== 0,\n\t\tassigned: (derived.f & ASSIGNED) !== 0\n\t};\n\n\tfor (var i = 0; holds && i < length; i++) {\n\t\tvar version = teardown_version_of(deps[i]);\n\t\tholds = dv === null ? version <= held.wv : version === dv[i];\n\t}\n\n\tif (holds) {\n\t\trecord = held;\n\t} else {\n\t\texecute_derived(derived);\n\t\trecord = teardown_run;\n\n\t\tif (held.wv < record.wv && !held.e && !record.e && derived.equals.call(held, record.v)) {\n\t\t\trecord.wv = held.wv;\n\t\t}\n\t}\n\n\tcache.set(derived, record);\n\treturn record;\n}\n\n/**\n * The version of `signal` in the view of the world of the running teardown\n * @param {Value} signal\n */\nfunction teardown_version_of(signal) {\n\treturn (teardown_view(signal) ?? batch_values?.get(signal) ?? signal).wv;\n}\n\n/**\n * Like `get`, but checks for `undefined`. Used for `var` declarations because they can be accessed before being declared\n * @template V\n * @param {Value<V> | undefined} signal\n * @returns {V | undefined}\n */\nexport function safe_get(signal) {\n\treturn signal && get(signal);\n}\n\n/**\n * When used inside a [`$derived`](https://svelte.dev/docs/svelte/$derived) or [`$effect`](https://svelte.dev/docs/svelte/$effect),\n * any state read inside `fn` will not be treated as a dependency.\n *\n * ```ts\n * $effect(() => {\n * // this will run when `data` changes, but not when `time` changes\n * save(data, {\n * timestamp: untrack(() => time)\n * });\n * });\n * ```\n * @template T\n * @param {() => T} fn\n * @returns {T}\n */\nexport function untrack(fn) {\n\tvar previous_untracking = untracking;\n\ttry {\n\t\tuntracking = true;\n\t\treturn fn();\n\t} finally {\n\t\tuntracking = previous_untracking;\n\t}\n}\n\n/**\n * Possibly traverse an object and read all its properties so that they're all reactive in case this is `$state`.\n * Does only check first level of an object for performance reasons (heuristic should be good for 99% of all cases).\n * @param {any} value\n * @returns {void}\n */\nexport function deep_read_state(value) {\n\tif (typeof value !== 'object' || !value || value instanceof EventTarget) {\n\t\treturn;\n\t}\n\n\tif (STATE_SYMBOL in value) {\n\t\tdeep_read(value);\n\t} else if (!Array.isArray(value)) {\n\t\tfor (let key in value) {\n\t\t\tconst prop = value[key];\n\t\t\tif (typeof prop === 'object' && prop && STATE_SYMBOL in prop) {\n\t\t\t\tdeep_read(prop);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Deeply traverse an object and read all its properties\n * so that they're all reactive in case this is `$state`\n * @param {any} value\n * @param {Set<any>} visited\n * @returns {void}\n */\nexport function deep_read(value, visited = new Set()) {\n\tif (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\t// We don't want to traverse DOM elements\n\t\t!(value instanceof EventTarget) &&\n\t\t!visited.has(value)\n\t) {\n\t\tvisited.add(value);\n\t\t// When working with a possible SvelteDate, this\n\t\t// will ensure we capture changes to it.\n\t\tif (value instanceof Date) {\n\t\t\tvalue.getTime();\n\t\t}\n\t\tfor (let key in value) {\n\t\t\ttry {\n\t\t\t\tdeep_read(value[key], visited);\n\t\t\t} catch (e) {\n\t\t\t\t// continue\n\t\t\t}\n\t\t}\n\t\tconst proto = get_prototype_of(value);\n\t\tif (\n\t\t\tproto !== Object.prototype &&\n\t\t\tproto !== Array.prototype &&\n\t\t\tproto !== Map.prototype &&\n\t\t\tproto !== Set.prototype &&\n\t\t\tproto !== Date.prototype\n\t\t) {\n\t\t\tconst descriptors = get_descriptors(proto);\n\t\t\tfor (let key in descriptors) {\n\t\t\t\tconst get = descriptors[key].get;\n\t\t\t\tif (get) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tget.call(value);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t// continue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","const regex_return_characters = /\\r/g;\n\n/**\n * @param {string} str\n * @returns {string}\n */\nexport function hash(str) {\n\tstr = str.replace(regex_return_characters, '');\n\tlet hash = 5381;\n\tlet i = str.length;\n\n\twhile (i--) hash = ((hash << 5) - hash) ^ str.charCodeAt(i);\n\treturn (hash >>> 0).toString(36);\n}\n\nconst VOID_ELEMENT_NAMES = [\n\t'area',\n\t'base',\n\t'br',\n\t'col',\n\t'command',\n\t'embed',\n\t'hr',\n\t'img',\n\t'input',\n\t'keygen',\n\t'link',\n\t'meta',\n\t'param',\n\t'source',\n\t'track',\n\t'wbr'\n];\n\n/**\n * Returns `true` if `name` is of a void element\n * @param {string} name\n */\nexport function is_void(name) {\n\treturn VOID_ELEMENT_NAMES.includes(name) || name.toLowerCase() === '!doctype';\n}\n\nconst RESERVED_WORDS = [\n\t'arguments',\n\t'await',\n\t'break',\n\t'case',\n\t'catch',\n\t'class',\n\t'const',\n\t'continue',\n\t'debugger',\n\t'default',\n\t'delete',\n\t'do',\n\t'else',\n\t'enum',\n\t'eval',\n\t'export',\n\t'extends',\n\t'false',\n\t'finally',\n\t'for',\n\t'function',\n\t'if',\n\t'implements',\n\t'import',\n\t'in',\n\t'instanceof',\n\t'interface',\n\t'let',\n\t'new',\n\t'null',\n\t'package',\n\t'private',\n\t'protected',\n\t'public',\n\t'return',\n\t'static',\n\t'super',\n\t'switch',\n\t'this',\n\t'throw',\n\t'true',\n\t'try',\n\t'typeof',\n\t'var',\n\t'void',\n\t'while',\n\t'with',\n\t'yield'\n];\n\n/**\n * Returns `true` if `word` is a reserved JavaScript keyword\n * @param {string} word\n */\nexport function is_reserved(word) {\n\treturn RESERVED_WORDS.includes(word);\n}\n\n/**\n * @param {string} name\n */\nexport function is_capture_event(name) {\n\treturn name.endsWith('capture') && name !== 'gotpointercapture' && name !== 'lostpointercapture';\n}\n\n/** List of Element events that will be delegated */\nconst DELEGATED_EVENTS = [\n\t'beforeinput',\n\t'click',\n\t'change',\n\t'dblclick',\n\t'contextmenu',\n\t'focusin',\n\t'focusout',\n\t'input',\n\t'keydown',\n\t'keyup',\n\t'mousedown',\n\t'mousemove',\n\t'mouseout',\n\t'mouseover',\n\t'mouseup',\n\t'pointerdown',\n\t'pointermove',\n\t'pointerout',\n\t'pointerover',\n\t'pointerup',\n\t'touchend',\n\t'touchmove',\n\t'touchstart'\n];\n\n/**\n * Returns `true` if `event_name` is a delegated event\n * @param {string} event_name\n */\nexport function can_delegate_event(event_name) {\n\treturn DELEGATED_EVENTS.includes(event_name);\n}\n\n/**\n * Attributes that are boolean, i.e. they are present or not present.\n */\nconst DOM_BOOLEAN_ATTRIBUTES = [\n\t'allowfullscreen',\n\t'async',\n\t'autofocus',\n\t'autoplay',\n\t'checked',\n\t'controls',\n\t'default',\n\t'disabled',\n\t'formnovalidate',\n\t'indeterminate',\n\t'inert',\n\t'ismap',\n\t'loop',\n\t'multiple',\n\t'muted',\n\t'nomodule',\n\t'novalidate',\n\t'open',\n\t'playsinline',\n\t'readonly',\n\t'required',\n\t'reversed',\n\t'seamless',\n\t'selected',\n\t'webkitdirectory',\n\t'defer',\n\t'disablepictureinpicture',\n\t'disableremoteplayback'\n];\n\n/**\n * Returns `true` if `name` is a boolean attribute\n * @param {string} name\n */\nexport function is_boolean_attribute(name) {\n\treturn DOM_BOOLEAN_ATTRIBUTES.includes(name);\n}\n\n/**\n * @type {Record<string, string>}\n * List of attribute names that should be aliased to their property names\n * because they behave differently between setting them as an attribute and\n * setting them as a property.\n */\nconst ATTRIBUTE_ALIASES = {\n\t// no `class: 'className'` because we handle that separately\n\tformnovalidate: 'formNoValidate',\n\tismap: 'isMap',\n\tnomodule: 'noModule',\n\tplaysinline: 'playsInline',\n\treadonly: 'readOnly',\n\tdefaultvalue: 'defaultValue',\n\tdefaultchecked: 'defaultChecked',\n\tsrcobject: 'srcObject',\n\tnovalidate: 'noValidate',\n\tallowfullscreen: 'allowFullscreen',\n\tdisablepictureinpicture: 'disablePictureInPicture',\n\tdisableremoteplayback: 'disableRemotePlayback'\n};\n\n/**\n * @param {string} name\n */\nexport function normalize_attribute(name) {\n\tname = name.toLowerCase();\n\treturn ATTRIBUTE_ALIASES[name] ?? name;\n}\n\nconst DOM_PROPERTIES = [\n\t...DOM_BOOLEAN_ATTRIBUTES,\n\t'formNoValidate',\n\t'isMap',\n\t'noModule',\n\t'playsInline',\n\t'readOnly',\n\t'value',\n\t'volume',\n\t'defaultValue',\n\t'defaultChecked',\n\t'srcObject',\n\t'noValidate',\n\t'allowFullscreen',\n\t'disablePictureInPicture',\n\t'disableRemotePlayback'\n];\n\n/**\n * @param {string} name\n */\nexport function is_dom_property(name) {\n\treturn DOM_PROPERTIES.includes(name);\n}\n\nconst NON_STATIC_PROPERTIES = ['autofocus', 'muted', 'defaultValue', 'defaultChecked'];\n\n/**\n * Returns `true` if the given attribute cannot be set through the template\n * string, i.e. needs some kind of JavaScript handling to work.\n * @param {string} name\n */\nexport function cannot_be_set_statically(name) {\n\treturn NON_STATIC_PROPERTIES.includes(name);\n}\n\n/**\n * Subset of delegated events which should be passive by default.\n * These two are already passive via browser defaults on window, document and body.\n * But since\n * - we're delegating them\n * - they happen often\n * - they apply to mobile which is generally less performant\n * we're marking them as passive by default for other elements, too.\n */\nconst PASSIVE_EVENTS = ['touchstart', 'touchmove'];\n\n/**\n * Returns `true` if `name` is a passive event\n * @param {string} name\n */\nexport function is_passive_event(name) {\n\treturn PASSIVE_EVENTS.includes(name);\n}\n\nconst CONTENT_EDITABLE_BINDINGS = ['textContent', 'innerHTML', 'innerText'];\n\n/** @param {string} name */\nexport function is_content_editable_binding(name) {\n\treturn CONTENT_EDITABLE_BINDINGS.includes(name);\n}\n\nconst LOAD_ERROR_ELEMENTS = [\n\t'body',\n\t'embed',\n\t'iframe',\n\t'img',\n\t'link',\n\t'object',\n\t'script',\n\t'style',\n\t'track'\n];\n\n/**\n * Returns `true` if the element emits `load` and `error` events\n * @param {string} name\n */\nexport function is_load_error_element(name) {\n\treturn LOAD_ERROR_ELEMENTS.includes(name);\n}\n\nconst SVG_ELEMENTS = [\n\t'altGlyph',\n\t'altGlyphDef',\n\t'altGlyphItem',\n\t'animate',\n\t'animateColor',\n\t'animateMotion',\n\t'animateTransform',\n\t'circle',\n\t'clipPath',\n\t'color-profile',\n\t'cursor',\n\t'defs',\n\t'desc',\n\t'discard',\n\t'ellipse',\n\t'feBlend',\n\t'feColorMatrix',\n\t'feComponentTransfer',\n\t'feComposite',\n\t'feConvolveMatrix',\n\t'feDiffuseLighting',\n\t'feDisplacementMap',\n\t'feDistantLight',\n\t'feDropShadow',\n\t'feFlood',\n\t'feFuncA',\n\t'feFuncB',\n\t'feFuncG',\n\t'feFuncR',\n\t'feGaussianBlur',\n\t'feImage',\n\t'feMerge',\n\t'feMergeNode',\n\t'feMorphology',\n\t'feOffset',\n\t'fePointLight',\n\t'feSpecularLighting',\n\t'feSpotLight',\n\t'feTile',\n\t'feTurbulence',\n\t'filter',\n\t'font',\n\t'font-face',\n\t'font-face-format',\n\t'font-face-name',\n\t'font-face-src',\n\t'font-face-uri',\n\t'foreignObject',\n\t'g',\n\t'glyph',\n\t'glyphRef',\n\t'hatch',\n\t'hatchpath',\n\t'hkern',\n\t'image',\n\t'line',\n\t'linearGradient',\n\t'marker',\n\t'mask',\n\t'mesh',\n\t'meshgradient',\n\t'meshpatch',\n\t'meshrow',\n\t'metadata',\n\t'missing-glyph',\n\t'mpath',\n\t'path',\n\t'pattern',\n\t'polygon',\n\t'polyline',\n\t'radialGradient',\n\t'rect',\n\t'set',\n\t'solidcolor',\n\t'stop',\n\t'svg',\n\t'switch',\n\t'symbol',\n\t'text',\n\t'textPath',\n\t'tref',\n\t'tspan',\n\t'unknown',\n\t'use',\n\t'view',\n\t'vkern'\n];\n\n/** @param {string} name */\nexport function is_svg(name) {\n\treturn SVG_ELEMENTS.includes(name);\n}\n\nconst MATHML_ELEMENTS = [\n\t'annotation',\n\t'annotation-xml',\n\t'maction',\n\t'math',\n\t'merror',\n\t'mfrac',\n\t'mi',\n\t'mmultiscripts',\n\t'mn',\n\t'mo',\n\t'mover',\n\t'mpadded',\n\t'mphantom',\n\t'mprescripts',\n\t'mroot',\n\t'mrow',\n\t'ms',\n\t'mspace',\n\t'msqrt',\n\t'mstyle',\n\t'msub',\n\t'msubsup',\n\t'msup',\n\t'mtable',\n\t'mtd',\n\t'mtext',\n\t'mtr',\n\t'munder',\n\t'munderover',\n\t'semantics'\n];\n\n/** @param {string} name */\nexport function is_mathml(name) {\n\treturn MATHML_ELEMENTS.includes(name);\n}\n\nconst STATE_CREATION_RUNES = /** @type {const} */ ([\n\t'$state',\n\t'$state.raw',\n\t'$derived',\n\t'$derived.by'\n]);\n\nexport const RUNES = /** @type {const} */ ([\n\t...STATE_CREATION_RUNES,\n\t'$state.eager',\n\t'$state.snapshot',\n\t'$props',\n\t'$props.id',\n\t'$bindable',\n\t'$effect',\n\t'$effect.pre',\n\t'$effect.tracking',\n\t'$effect.root',\n\t'$effect.pending',\n\t'$inspect',\n\t'$inspect().with',\n\t'$inspect.trace',\n\t'$host'\n]);\n\n/** @typedef {typeof RUNES[number]} RuneName */\n\n/**\n * @param {string} name\n * @returns {name is RuneName}\n */\nexport function is_rune(name) {\n\treturn RUNES.includes(/** @type {RuneName} */ (name));\n}\n\n/** @typedef {typeof STATE_CREATION_RUNES[number]} StateCreationRuneName */\n\n/**\n * @param {string} name\n * @returns {name is StateCreationRuneName}\n */\nexport function is_state_creation_rune(name) {\n\treturn STATE_CREATION_RUNES.includes(/** @type {StateCreationRuneName} */ (name));\n}\n\n/** List of elements that require raw contents and should not have SSR comments put in them */\nconst RAW_TEXT_ELEMENTS = /** @type {const} */ (['textarea', 'script', 'style', 'title']);\n\n/** @param {string} name */\nexport function is_raw_text_element(name) {\n\treturn RAW_TEXT_ELEMENTS.includes(/** @type {typeof RAW_TEXT_ELEMENTS[number]} */ (name));\n}\n\n// Matches valid HTML/SVG/MathML element names and custom element names.\n// https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name\n//\n// Standard elements: ASCII alpha start, followed by ASCII alphanumerics.\n// Custom elements: ASCII alpha start, followed by any mix of PCENChar (which\n// includes ASCII alphanumerics, `-`, `.`, `_`, and specified Unicode ranges),\n// with at least one hyphen required somewhere after the first character.\n//\n// Rejects strings containing whitespace, quotes, angle brackets, slashes, equals,\n// or other characters that could break out of a tag-name token and enable markup injection.\nexport const REGEX_VALID_TAG_NAME =\n\t/^[a-zA-Z][a-zA-Z0-9]*(-[a-zA-Z0-9.\\-_\\u00B7\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u203F-\\u2040\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\u{10000}-\\u{EFFFF}]*)?$/u;\n\n/**\n * Prevent devtools trying to make `location` a clickable link by inserting a zero-width space\n * @template {string | undefined} T\n * @param {T} location\n * @returns {T};\n */\nexport function sanitize_location(location) {\n\treturn /** @type {T} */ (location?.replace(/\\//g, '/\\u200b'));\n}\n","import { teardown } from '../../reactivity/effects.js';\nimport { array_from, define_property } from '../../../shared/utils.js';\nimport { is_passive_event } from '../../../../utils.js';\nimport { hydrating } from '../hydration.js';\nimport { queue_micro_task } from '../task.js';\nimport { FILENAME } from '../../../../constants.js';\nimport * as w from '../../warnings.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tset_active_effect,\n\tset_active_reaction\n} from '../../runtime.js';\nimport { without_reactive_context } from './bindings/shared.js';\nimport {\n\tremove_attribute,\n\tdispatch_event,\n\tadd_event_listener,\n\tremove_event_listener\n} from '../operations.js';\nimport { current_renderer } from '../../custom-renderer/state.js';\n\n/**\n * Used on elements, as a map of event type -> event handler,\n * and on events themselves to track which element handled an event\n */\nexport const event_symbol = Symbol('events');\n\n// The native listener boundary at which a delegated descendant stopped propagation.\nconst propagation_stopped_at = Symbol('propagation stopped at');\n\n/** @type {Set<string>} */\nexport const all_registered_events = new Set();\n\n/** @type {Set<(events: Array<string>) => void>} */\nexport const root_event_handles = new Set();\n\n/**\n * SSR adds onload and onerror attributes to catch those events before the hydration.\n * This function detects those cases, removes the attributes and replays the events.\n * @param {HTMLElement} dom\n */\nexport function replay_events(dom) {\n\t// custom renderers safe since it immediately returns if not hydrating\n\tif (!hydrating) return;\n\n\tremove_attribute(dom, 'onload');\n\tremove_attribute(dom, 'onerror');\n\t// @ts-expect-error\n\tconst event = dom.__e;\n\tif (event !== undefined) {\n\t\t// @ts-expect-error\n\t\tdom.__e = undefined;\n\t\tqueueMicrotask(() => {\n\t\t\tif (dom.isConnected) {\n\t\t\t\tdispatch_event(dom, event);\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * @param {string} event_name\n * @param {EventTarget} dom\n * @param {EventListener} [handler]\n * @param {AddEventListenerOptions} [options]\n */\nexport function create_event(event_name, dom, handler, options = {}) {\n\t// Capture whether a custom renderer is active at creation time (during mount),\n\t// since `renderer` will be null when the event actually fires\n\tvar is_custom_renderer = current_renderer != null;\n\n\t/**\n\t * @this {EventTarget}\n\t * @param {...any} args\n\t */\n\tfunction target_handler(...args) {\n\t\tif (is_custom_renderer) {\n\t\t\t// Custom renderers don't use DOM event propagation/delegation,\n\t\t\t// so just call the handler directly\n\t\t\treturn without_reactive_context(() => {\n\t\t\t\treturn handler?.apply(this, /** @type {any} */ (args));\n\t\t\t});\n\t\t}\n\t\tvar event = /** @type {Event} */ (args[0]);\n\t\tif (!options.capture) {\n\t\t\t// Only call in the bubble phase, else delegated events would be called before the capturing events\n\t\t\thandle_event_propagation.call(dom, event);\n\t\t}\n\t\t// Native stopPropagation() does not stop other listeners on the same element.\n\t\t// Only skip this callback if a delegated descendant stopped before reaching it.\n\t\t// @ts-expect-error\n\t\tif (options.capture || event[propagation_stopped_at] !== dom) {\n\t\t\treturn without_reactive_context(() => {\n\t\t\t\treturn handler?.call(this, event);\n\t\t\t});\n\t\t}\n\t}\n\n\t// Chrome has a bug where pointer events don't work when attached to a DOM element that has been cloned\n\t// with cloneNode() and the DOM element is disconnected from the document. To ensure the event works, we\n\t// defer the attachment till after it's been appended to the document. TODO: remove this once Chrome fixes\n\t// this bug. The same applies to wheel events and touch events.\n\tif (\n\t\t!is_custom_renderer &&\n\t\t(event_name.startsWith('pointer') || event_name.startsWith('touch') || event_name === 'wheel')\n\t) {\n\t\ttarget_handler.__removed = false;\n\t\tqueue_micro_task(() => {\n\t\t\tif (!target_handler.__removed) {\n\t\t\t\tadd_event_listener(dom, event_name, target_handler, options);\n\t\t\t}\n\t\t});\n\t} else {\n\t\tadd_event_listener(dom, event_name, target_handler, options);\n\t}\n\n\treturn target_handler;\n}\n\n/**\n * Attaches an event handler to an element and returns a function that removes the handler. Using this\n * rather than `addEventListener` will preserve the correct order relative to handlers added declaratively\n * (with attributes like `onclick`), which use event delegation for performance reasons\n *\n * @param {EventTarget} element\n * @param {string} type\n * @param {EventListener} handler\n * @param {AddEventListenerOptions} [options]\n */\nexport function on(element, type, handler, options = {}) {\n\tvar target_handler = create_event(type, element, handler, options);\n\n\treturn () => {\n\t\ttarget_handler.__removed = true;\n\t\tremove_event_listener(element, type, target_handler, options);\n\t};\n}\n\n/**\n * @param {string} event_name\n * @param {Element} dom\n * @param {EventListener} [handler]\n * @param {boolean} [capture]\n * @param {boolean} [passive]\n * @returns {void}\n */\nexport function event(event_name, dom, handler, capture, passive) {\n\tvar options = { capture, passive };\n\tvar target_handler = create_event(event_name, dom, handler, options);\n\n\tif (\n\t\t// if there's a renderer we will never add to body, window or document.\n\t\tcurrent_renderer == null &&\n\t\t(dom === document.body ||\n\t\t\t// @ts-ignore\n\t\t\tdom === window ||\n\t\t\t// @ts-ignore\n\t\t\tdom === document ||\n\t\t\t// Firefox has quirky behavior, it can happen that we still get \"canplay\" events when the element is already removed\n\t\t\tdom instanceof HTMLMediaElement)\n\t) {\n\t\tteardown(() => {\n\t\t\ttarget_handler.__removed = true;\n\t\t\tremove_event_listener(dom, event_name, target_handler, options);\n\t\t});\n\t}\n}\n\n/**\n * @param {string} event_name\n * @param {Element} element\n * @param {EventListener} [handler]\n * @returns {void}\n */\nexport function delegated(event_name, element, handler) {\n\t// @ts-expect-error\n\t(element[event_symbol] ??= {})[event_name] = handler;\n}\n\n/**\n * @param {Array<string>} events\n * @returns {void}\n */\nexport function delegate(events) {\n\tfor (var i = 0; i < events.length; i++) {\n\t\tall_registered_events.add(events[i]);\n\t}\n\n\tfor (var fn of root_event_handles) {\n\t\tfn(events);\n\t}\n}\n\n/**\n * How many delegation roots are listening to each event type on each node\n * @type {Map<EventTarget, Map<string, number>>}\n */\nconst delegated_listeners = new Map();\n\n/**\n * Makes `target` a root for delegated events: listens on `target` and on `document`\n * for every delegated event type, including types registered later, and dispatches\n * them to the handlers set with `delegated(...)`. Used for `mount`/`hydrate` targets,\n * and for DOM containers that DOM content is rendered into from a custom renderer.\n *\n * This always uses DOM methods directly (rather than renderer-aware operations),\n * since it may be torn down while a custom renderer is active.\n * @param {EventTarget} target\n * @returns {() => void} stops listening\n */\nexport function listen_to_delegated_events(target) {\n\t/** @type {Set<string>} */\n\tvar registered_events = new Set();\n\n\t/** @param {Array<string>} events */\n\tvar event_handle = (events) => {\n\t\tfor (var i = 0; i < events.length; i++) {\n\t\t\tvar event_name = events[i];\n\n\t\t\tif (registered_events.has(event_name)) continue;\n\t\t\tregistered_events.add(event_name);\n\n\t\t\tvar passive = is_passive_event(event_name);\n\n\t\t\t// Add the event listener to both the target and the document.\n\t\t\t// The target listener ensures we catch events from within in case\n\t\t\t// the outer content stops propagation of the event.\n\t\t\t//\n\t\t\t// The document listener ensures we catch events that originate from elements that were\n\t\t\t// manually moved outside of the target (e.g. via manual portals).\n\t\t\tfor (const node of [target, document]) {\n\t\t\t\tvar counts = delegated_listeners.get(node);\n\n\t\t\t\tif (counts === undefined) {\n\t\t\t\t\tcounts = new Map();\n\t\t\t\t\tdelegated_listeners.set(node, counts);\n\t\t\t\t}\n\n\t\t\t\tvar count = counts.get(event_name);\n\n\t\t\t\tif (count === undefined) {\n\t\t\t\t\tnode.addEventListener(event_name, handle_event_propagation, { passive });\n\t\t\t\t\tcounts.set(event_name, 1);\n\t\t\t\t} else {\n\t\t\t\t\tcounts.set(event_name, count + 1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n\n\tevent_handle(array_from(all_registered_events));\n\troot_event_handles.add(event_handle);\n\n\treturn () => {\n\t\tfor (var event_name of registered_events) {\n\t\t\tfor (const node of [target, document]) {\n\t\t\t\tvar counts = /** @type {Map<string, number>} */ (delegated_listeners.get(node));\n\t\t\t\tvar count = /** @type {number} */ (counts.get(event_name));\n\n\t\t\t\tif (--count == 0) {\n\t\t\t\t\tnode.removeEventListener(event_name, handle_event_propagation);\n\t\t\t\t\tcounts.delete(event_name);\n\n\t\t\t\t\tif (counts.size === 0) {\n\t\t\t\t\t\tdelegated_listeners.delete(node);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tcounts.set(event_name, count);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\troot_event_handles.delete(event_handle);\n\t};\n}\n\n// used to store the reference to the currently propagated event\n// to prevent garbage collection between microtasks in Firefox (<= 141)\n// If the event object is GCed too early, the expando __root property\n// set on the event object is lost, causing the event delegation\n// to process the event twice\nlet last_propagated_event = null;\n\n// whether a task is already queued to clear `last_propagated_event`\nlet last_propagated_event_clear_scheduled = false;\n\n/**\n * @this {EventTarget}\n * @param {Event} event\n * @returns {void}\n */\nexport function handle_event_propagation(event) {\n\t// this function is custom renderers safe since it's invoked in `mount`\n\tvar handler_element = this;\n\tvar was_stopped = event.cancelBubble;\n\n\t// Another listener at this boundary may already have dispatched the delegated\n\t// handler that stopped propagation. Do not dispatch it again.\n\t// @ts-expect-error\n\tif (was_stopped && event[propagation_stopped_at] === handler_element) return;\n\n\tif (!was_stopped) {\n\t\t// The same event object may be dispatched again.\n\t\t// @ts-expect-error\n\t\tdelete event[propagation_stopped_at];\n\t}\n\n\tvar owner_document = /** @type {Node} */ (handler_element).ownerDocument;\n\tvar event_name = event.type;\n\tvar path = event.composedPath?.() || [];\n\tvar current_target = /** @type {null | Element} */ (path[0] || event.target);\n\n\tlast_propagated_event = event;\n\n\t// The reference is only needed while the event can still reach another\n\t// delegated root, i.e. during the current (synchronous) dispatch and its\n\t// microtask checkpoints. Clearing it in a later task preserves the\n\t// Firefox workaround while making sure the slot doesn't retain the last\n\t// event forever — through `event.target` it would otherwise keep the\n\t// entire detached subtree of whatever the user last clicked in alive\n\t// until the next delegated event happens to arrive.\n\tif (!last_propagated_event_clear_scheduled) {\n\t\tlast_propagated_event_clear_scheduled = true;\n\t\tsetTimeout(() => {\n\t\t\tlast_propagated_event_clear_scheduled = false;\n\t\t\tlast_propagated_event = null;\n\t\t});\n\t}\n\n\t// composedPath contains list of nodes the event has propagated through.\n\t// We check `event_symbol` to skip all nodes below it in case this is a\n\t// parent of the `event_symbol` node, which indicates that there's nested\n\t// mounted apps. In this case we don't want to trigger events multiple times.\n\tvar path_idx = 0;\n\n\t// the `last_propagated_event === event` check is redundant, but\n\t// without it the variable will be DCE'd and things will\n\t// fail mysteriously in Firefox\n\t// @ts-expect-error is added below\n\tvar handled_at = last_propagated_event === event && event[event_symbol];\n\n\tif (handled_at) {\n\t\tvar at_idx = path.indexOf(handled_at);\n\t\tif (\n\t\t\tat_idx !== -1 &&\n\t\t\t(handler_element === document || handler_element === /** @type {any} */ (window))\n\t\t) {\n\t\t\t// This is the fallback document listener or a window listener, but the event was already handled\n\t\t\t// -> ignore, but set handle_at to document/window so that we're resetting the event\n\t\t\t// chain in case someone manually dispatches the same event object again.\n\t\t\t// @ts-expect-error\n\t\t\tevent[event_symbol] = handler_element;\n\t\t\treturn;\n\t\t}\n\n\t\t// We're deliberately not skipping if the index is higher, because\n\t\t// someone could create an event programmatically and emit it multiple times,\n\t\t// in which case we want to handle the whole propagation chain properly each time.\n\t\t// (this will only be a false negative if the event is dispatched multiple times and\n\t\t// the fallback document listener isn't reached in between, but that's super rare)\n\t\tvar handler_idx = path.indexOf(handler_element);\n\t\tif (handler_idx === -1) {\n\t\t\t// handle_idx can theoretically be -1 (happened in some JSDOM testing scenarios with an event listener on the window object)\n\t\t\t// so guard against that, too, and assume that everything was handled at this point.\n\t\t\treturn;\n\t\t}\n\n\t\tif (at_idx <= handler_idx) {\n\t\t\tpath_idx = at_idx;\n\t\t}\n\t}\n\n\tcurrent_target = /** @type {Element} */ (path[path_idx] || event.target);\n\t// there can only be one delegated event per element, and we either already handled the current target,\n\t// or this is the very first target in the chain which has a non-delegated listener, in which case it's safe\n\t// to handle a possible delegated event on it later (through the root delegation listener for example).\n\tif (current_target === handler_element) return;\n\n\t// Proxy currentTarget to correct target\n\tdefine_property(event, 'currentTarget', {\n\t\tconfigurable: true,\n\t\tget() {\n\t\t\treturn current_target || owner_document;\n\t\t}\n\t});\n\n\t// This started because of Chromium issue https://chromestatus.com/feature/5128696823545856,\n\t// where removal or moving of the DOM can cause sync `blur` events to fire, which can cause logic\n\t// to run inside the current `active_reaction`, which isn't what we want at all. However, on reflection,\n\t// it's probably best that all events handled by Svelte have this behaviour, as we don't really want\n\t// an event handler to run in the context of another reaction or effect.\n\tvar previous_reaction = active_reaction;\n\tvar previous_effect = active_effect;\n\tset_active_reaction(null);\n\tset_active_effect(null);\n\n\ttry {\n\t\t/**\n\t\t * @type {unknown}\n\t\t */\n\t\tvar throw_error;\n\t\t/**\n\t\t * @type {unknown[]}\n\t\t */\n\t\tvar other_errors = [];\n\n\t\twhile (current_target !== null) {\n\t\t\tif (current_target === handler_element) break;\n\n\t\t\ttry {\n\t\t\t\t// @ts-expect-error\n\t\t\t\tvar delegated = current_target[event_symbol]?.[event_name];\n\n\t\t\t\tif (\n\t\t\t\t\tdelegated != null &&\n\t\t\t\t\t(!(/** @type {any} */ (current_target).disabled) ||\n\t\t\t\t\t\t// DOM could've been updated already by the time this is reached, so we check this as well\n\t\t\t\t\t\t// -> the target could not have been disabled because it emits the event in the first place\n\t\t\t\t\t\tevent.target === current_target)\n\t\t\t\t) {\n\t\t\t\t\tdelegated.call(current_target, event);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tif (throw_error) {\n\t\t\t\t\tother_errors.push(error);\n\t\t\t\t} else {\n\t\t\t\t\tthrow_error = error;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (event.cancelBubble) {\n\t\t\t\tif (!was_stopped) {\n\t\t\t\t\t// @ts-expect-error\n\t\t\t\t\tevent[propagation_stopped_at] = handler_element;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tpath_idx++;\n\t\t\tcurrent_target = path_idx < path.length ? /** @type {Element} */ (path[path_idx]) : null;\n\t\t}\n\n\t\tif (throw_error) {\n\t\t\tfor (let error of other_errors) {\n\t\t\t\t// Throw the rest of the errors, one-by-one on a microtask\n\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\tthrow error;\n\t\t\t\t});\n\t\t\t}\n\t\t\tthrow throw_error;\n\t\t}\n\t} finally {\n\t\t// @ts-expect-error is used above\n\t\tevent[event_symbol] = handler_element;\n\t\t// @ts-ignore remove proxy on currentTarget\n\t\tdelete event.currentTarget;\n\t\tset_active_reaction(previous_reaction);\n\t\tset_active_effect(previous_effect);\n\t}\n}\n\n/**\n * In dev, warn if an event handler is not a function, as it means the\n * user probably called the handler or forgot to add a `() =>`\n * @param {() => (event: Event, ...args: any) => void} thunk\n * @param {EventTarget} element\n * @param {[Event, ...any]} args\n * @param {any} component\n * @param {[number, number]} [loc]\n * @param {boolean} [remove_parens]\n */\nexport function apply(\n\tthunk,\n\telement,\n\targs,\n\tcomponent,\n\tloc,\n\thas_side_effects = false,\n\tremove_parens = false\n) {\n\tlet handler;\n\tlet error;\n\n\ttry {\n\t\thandler = thunk();\n\t} catch (e) {\n\t\terror = e;\n\t}\n\n\tif (typeof handler !== 'function' && (has_side_effects || handler != null || error)) {\n\t\tconst filename = component?.[FILENAME];\n\t\tconst location = loc ? ` at ${filename}:${loc[0]}:${loc[1]}` : ` in ${filename}`;\n\t\tconst phase = args[0]?.eventPhase < Event.BUBBLING_PHASE ? 'capture' : '';\n\t\tconst event_name = args[0]?.type + phase;\n\t\tconst description = `\\`${event_name}\\` handler${location}`;\n\t\tconst suggestion = remove_parens ? 'remove the trailing `()`' : 'add a leading `() =>`';\n\n\t\tw.event_handler_invalid(description, suggestion);\n\n\t\tif (error) {\n\t\t\tthrow error;\n\t\t}\n\t}\n\thandler?.apply(element, args);\n}\n","import { create_element, set_inner_html } from './operations.js';\n\nconst policy =\n\t// We gotta write it like this because after downleveling the pure comment may end up in the wrong location\n\tglobalThis?.window?.trustedTypes &&\n\t/* @__PURE__ */ globalThis.window.trustedTypes.createPolicy('svelte-trusted-html', {\n\t\t/** @param {string} html */\n\t\tcreateHTML: (html) => {\n\t\t\treturn html;\n\t\t}\n\t});\n\n/** @param {string} html */\nexport function create_trusted_html(html) {\n\treturn /** @type {string} */ (policy?.createHTML(html) ?? html);\n}\n\n/**\n * @param {string} html\n */\nexport function create_fragment_from_html(html) {\n\tvar elem = create_element('template');\n\tset_inner_html(elem, create_trusted_html(html.replaceAll('<!>', '<!---->'))); // XHTML compliance\n\treturn elem.content;\n}\n","/** @import { Effect, EffectNodes, TemplateNode } from '#client' */\n/** @import { TemplateStructure } from './types' */\nimport {\n\tCOMMENT_NODE,\n\tDOCUMENT_FRAGMENT_NODE,\n\tIS_XHTML,\n\tREACTION_RAN,\n\tTEXT_NODE\n} from '#client/constants';\nimport {\n\tNAMESPACE_MATHML,\n\tNAMESPACE_SVG,\n\tTEMPLATE_FRAGMENT,\n\tTEMPLATE_USE_IMPORT_NODE,\n\tTEMPLATE_USE_MATHML,\n\tTEMPLATE_USE_SVG\n} from '../../../constants.js';\nimport { current_renderer } from '../custom-renderer/state.js';\nimport { active_effect } from '../runtime.js';\nimport { hydrate_next, hydrate_node, hydrating, set_hydrate_node } from './hydration.js';\nimport {\n\tappend_child,\n\tclone_node,\n\tcreate_comment,\n\tcreate_element,\n\tcreate_fragment,\n\tcreate_anchor,\n\tcreate_text,\n\tcreate_hydration_text,\n\tget_first_child,\n\tget_last_child,\n\tget_node_value,\n\timport_node,\n\tinsert_before,\n\tis_firefox,\n\tmerge_text_nodes,\n\tnode_name,\n\tnode_type,\n\treplace_with,\n\tset_attribute,\n\tset_text_content\n} from './operations.js';\nimport { create_fragment_from_html } from './reconciler.js';\n\nconst TEMPLATE_TAG = IS_XHTML ? 'template' : 'TEMPLATE';\nconst SCRIPT_TAG = IS_XHTML ? 'script' : 'SCRIPT';\n\n/**\n * @param {TemplateNode} start\n * @param {TemplateNode | null} end\n */\nexport function assign_nodes(start, end) {\n\tvar effect = /** @type {Effect} */ (active_effect);\n\tif (effect.nodes === null) {\n\t\teffect.nodes = { start, end, a: null, t: null };\n\t}\n}\n\n/**\n * @param {string} content\n * @param {number} flags\n * @returns {() => Node | Node[]}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function from_html(content, flags) {\n\tvar is_fragment = (flags & TEMPLATE_FRAGMENT) !== 0;\n\tvar use_import_node = (flags & TEMPLATE_USE_IMPORT_NODE) !== 0;\n\n\t/** @type {Node} */\n\tvar node;\n\n\t/**\n\t * Whether or not the first item is a text/element node. If not, we need to\n\t * create an additional comment node to act as `effect.nodes.start`\n\t */\n\tvar has_start = !content.startsWith('<!>');\n\n\treturn () => {\n\t\tif (hydrating) {\n\t\t\tassign_nodes(hydrate_node, null);\n\t\t\treturn hydrate_node;\n\t\t}\n\n\t\tif (node === undefined) {\n\t\t\tnode = create_fragment_from_html(has_start ? content : '<!>' + content);\n\t\t\tif (!is_fragment) node = /** @type {TemplateNode} */ (get_first_child(node));\n\t\t}\n\n\t\tvar clone = /** @type {TemplateNode} */ (\n\t\t\tuse_import_node || is_firefox ? import_node(node, true) : clone_node(node, true)\n\t\t);\n\n\t\tif (is_fragment) {\n\t\t\tvar start = /** @type {TemplateNode} */ (get_first_child(clone));\n\t\t\tvar end = /** @type {TemplateNode} */ (get_last_child(clone));\n\n\t\t\tassign_nodes(start, end);\n\t\t} else {\n\t\t\tassign_nodes(clone, clone);\n\t\t}\n\n\t\treturn clone;\n\t};\n}\n\n/**\n * @param {string} content\n * @param {number} flags\n * @param {'svg' | 'math'} ns\n * @returns {() => Node | Node[]}\n */\n/*#__NO_SIDE_EFFECTS__*/\nfunction from_namespace(content, flags, ns = 'svg') {\n\t/**\n\t * Whether or not the first item is a text/element node. If not, we need to\n\t * create an additional comment node to act as `effect.nodes.start`\n\t */\n\tvar has_start = !content.startsWith('<!>');\n\n\tvar is_fragment = (flags & TEMPLATE_FRAGMENT) !== 0;\n\tvar wrapped = `<${ns}>${has_start ? content : '<!>' + content}</${ns}>`;\n\n\t/** @type {Element | DocumentFragment} */\n\tvar node;\n\n\treturn () => {\n\t\tif (hydrating) {\n\t\t\tassign_nodes(hydrate_node, null);\n\t\t\treturn hydrate_node;\n\t\t}\n\n\t\tif (!node) {\n\t\t\tvar fragment = /** @type {DocumentFragment} */ (create_fragment_from_html(wrapped));\n\t\t\tvar root = /** @type {Element} */ (get_first_child(fragment));\n\n\t\t\tif (is_fragment) {\n\t\t\t\tnode = create_fragment();\n\t\t\t\twhile (get_first_child(root)) {\n\t\t\t\t\tappend_child(node, /** @type {TemplateNode} */ (get_first_child(root)));\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tnode = /** @type {Element} */ (get_first_child(root));\n\t\t\t}\n\t\t}\n\n\t\tvar clone = /** @type {TemplateNode} */ (clone_node(node, true));\n\n\t\tif (is_fragment) {\n\t\t\tvar start = /** @type {TemplateNode} */ (get_first_child(clone));\n\t\t\tvar end = /** @type {TemplateNode} */ (get_last_child(clone));\n\n\t\t\tassign_nodes(start, end);\n\t\t} else {\n\t\t\tassign_nodes(clone, clone);\n\t\t}\n\n\t\treturn clone;\n\t};\n}\n\n/**\n * @param {string} content\n * @param {number} flags\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function from_svg(content, flags) {\n\treturn from_namespace(content, flags, 'svg');\n}\n\n/**\n * @param {string} content\n * @param {number} flags\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function from_mathml(content, flags) {\n\treturn from_namespace(content, flags, 'math');\n}\n\n/**\n * @param {TemplateStructure[]} structure\n * @param {typeof NAMESPACE_SVG | typeof NAMESPACE_MATHML | undefined} [ns]\n */\nfunction fragment_from_tree(structure, ns) {\n\tvar fragment = create_fragment();\n\n\tfor (var item of structure) {\n\t\tif (typeof item === 'string') {\n\t\t\tappend_child(fragment, create_text(item));\n\t\t\tcontinue;\n\t\t}\n\n\t\t// if `preserveComments === true`, comments are represented as `['// <data>']`\n\t\tif (item === undefined || item[0][0] === '/') {\n\t\t\tappend_child(fragment, create_comment(item ? item[0].slice(3) : ''));\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst [name, attributes, ...children] = item;\n\n\t\tconst namespace = name === 'svg' ? NAMESPACE_SVG : name === 'math' ? NAMESPACE_MATHML : ns;\n\n\t\tvar element = create_element(name, namespace, attributes?.is);\n\n\t\tfor (var key in attributes) {\n\t\t\tset_attribute(element, key, attributes[key]);\n\t\t}\n\n\t\tif (children.length > 0) {\n\t\t\tvar target =\n\t\t\t\tnode_name(element) === TEMPLATE_TAG\n\t\t\t\t\t? // this is safe for custom renderers because the name will never be `template` due to how `node_name` works\n\t\t\t\t\t\t/** @type {HTMLTemplateElement} */ (element).content\n\t\t\t\t\t: element;\n\n\t\t\tappend_child(\n\t\t\t\ttarget,\n\t\t\t\tfragment_from_tree(children, node_name(element) === 'foreignObject' ? undefined : namespace)\n\t\t\t);\n\t\t}\n\n\t\tappend_child(fragment, element);\n\t}\n\n\treturn fragment;\n}\n\n/**\n * @param {TemplateStructure[]} structure\n * @param {number} flags\n * @returns {() => Node | Node[]}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function from_tree(structure, flags) {\n\tvar is_fragment = (flags & TEMPLATE_FRAGMENT) !== 0;\n\tvar use_import_node = (flags & TEMPLATE_USE_IMPORT_NODE) !== 0;\n\n\tconst ns =\n\t\t(flags & TEMPLATE_USE_SVG) !== 0\n\t\t\t? NAMESPACE_SVG\n\t\t\t: (flags & TEMPLATE_USE_MATHML) !== 0\n\t\t\t\t? NAMESPACE_MATHML\n\t\t\t\t: undefined;\n\n\t/** The DOM template that is cloned for each instance @type {Node | undefined} */\n\tvar node;\n\n\tfunction create() {\n\t\tvar fragment = fragment_from_tree(structure, ns);\n\t\treturn is_fragment ? fragment : /** @type {TemplateNode} */ (get_first_child(fragment));\n\t}\n\n\treturn () => {\n\t\tif (hydrating) {\n\t\t\tassign_nodes(hydrate_node, null);\n\t\t\treturn hydrate_node;\n\t\t}\n\n\t\t/** @type {TemplateNode} */\n\t\tvar clone;\n\n\t\tif (current_renderer !== null) {\n\t\t\t// for custom renderers we create new nodes every time rather than cloning a template.\n\t\t\t// It's a bit less efficient, but saves renderer authors from having to implement\n\t\t\t// `cloneNode`/`importNode`, which can be a pain. The nodes are not cached, since\n\t\t\t// that would keep the most recent instance alive after it is destroyed\n\t\t\tclone = /** @type {TemplateNode} */ (create());\n\t\t} else {\n\t\t\tnode ??= create();\n\t\t\tclone = /** @type {TemplateNode} */ (\n\t\t\t\tuse_import_node || is_firefox ? import_node(node, true) : clone_node(node, true)\n\t\t\t);\n\t\t}\n\n\t\tif (is_fragment) {\n\t\t\tvar start = /** @type {TemplateNode} */ (get_first_child(clone));\n\t\t\tvar end = /** @type {TemplateNode} */ (get_last_child(clone));\n\n\t\t\tassign_nodes(start, end);\n\t\t} else {\n\t\t\tassign_nodes(clone, clone);\n\t\t}\n\n\t\treturn clone;\n\t};\n}\n\n/**\n * @param {() => Element | DocumentFragment} fn\n */\nexport function with_script(fn) {\n\treturn () => run_scripts(fn());\n}\n\n/**\n * Creating a document fragment from HTML that contains script tags will not execute\n * the scripts. We need to replace the script tags with new ones so that they are executed.\n * @param {Element | DocumentFragment} node\n * @returns {Node | Node[]}\n */\nfunction run_scripts(node) {\n\t// this should be custom renderer safe since we never emit `with_script` in that case\n\t// scripts were SSR'd, in which case they will run\n\tif (hydrating) return node;\n\n\tconst is_fragment = node_type(node) === DOCUMENT_FRAGMENT_NODE;\n\tconst scripts =\n\t\tnode_name(node) === SCRIPT_TAG\n\t\t\t? [/** @type {HTMLScriptElement} */ (node)]\n\t\t\t: node.querySelectorAll('script');\n\n\tconst effect = /** @type {Effect & { nodes: EffectNodes }} */ (active_effect);\n\n\tfor (const script of scripts) {\n\t\tconst clone = create_element('script');\n\n\t\tfor (var attribute of script.attributes) {\n\t\t\tset_attribute(clone, attribute.name, attribute.value);\n\t\t}\n\n\t\tset_text_content(clone, script.textContent ?? '');\n\n\t\t// The script has changed - if it's at the edges, the effect now points at dead nodes\n\t\tif (is_fragment ? get_first_child(node) === script : node === script) {\n\t\t\teffect.nodes.start = clone;\n\t\t}\n\t\tif (is_fragment ? get_last_child(node) === script : node === script) {\n\t\t\teffect.nodes.end = clone;\n\t\t}\n\n\t\treplace_with(script, clone);\n\t}\n\treturn node;\n}\n\n/**\n * Don't mark this as side-effect-free, hydration needs to walk all nodes\n * @param {any} value\n */\nexport function text(value = '') {\n\tif (!hydrating) {\n\t\tvar t = create_text(value + '');\n\t\tassign_nodes(t, t);\n\t\treturn t;\n\t}\n\n\tvar node = hydrate_node;\n\n\tif (node_type(node) !== TEXT_NODE) {\n\t\t// if an {expression} is empty during SSR, we need to insert an empty text node\n\t\tinsert_before(node, (node = create_hydration_text()));\n\t\tset_hydrate_node(node);\n\t} else {\n\t\tmerge_text_nodes(/** @type {Text} */ (node));\n\t}\n\n\tassign_nodes(node, node);\n\treturn node;\n}\n\n/**\n * @returns {TemplateNode | DocumentFragment}\n */\nexport function comment() {\n\t// we're not delegating to `template` here for performance reasons\n\tif (hydrating) {\n\t\tassign_nodes(hydrate_node, null);\n\t\treturn hydrate_node;\n\t}\n\n\tvar frag = create_fragment();\n\tvar start = create_comment('');\n\tvar anchor = create_anchor();\n\tappend_child(frag, start);\n\tappend_child(frag, anchor);\n\n\tassign_nodes(start, anchor);\n\n\treturn frag;\n}\n\n/**\n * Assign the created (or in hydration mode, traversed) dom elements to the current block\n * and insert the elements into the dom (in client mode).\n * @param {Text | Comment | Element} anchor\n * @param {DocumentFragment | Element} dom\n */\nexport function append(anchor, dom) {\n\tif (hydrating) {\n\t\tvar effect = /** @type {Effect & { nodes: EffectNodes }} */ (active_effect);\n\n\t\t// When hydrating and outer component and an inner component is async, i.e. blocked on a promise,\n\t\t// then by the time the inner resolves we have already advanced to the end of the hydrated nodes\n\t\t// of the parent component. Check for defined for that reason to avoid rewinding the parent's end marker.\n\t\tif ((effect.f & REACTION_RAN) === 0 || effect.nodes.end === null) {\n\t\t\teffect.nodes.end = hydrate_node;\n\t\t}\n\n\t\thydrate_next();\n\t\treturn;\n\t}\n\n\tif (anchor === null) {\n\t\t// edge case — void `<svelte:element>` with content\n\t\treturn;\n\t}\n\n\tinsert_before(anchor, /** @type {Node} */ (dom));\n}\n\n/**\n * Create (or hydrate) an unique UID for the component instance.\n */\nexport function props_id() {\n\tlet node_value;\n\tif (\n\t\thydrating &&\n\t\thydrate_node &&\n\t\tnode_type(hydrate_node) === COMMENT_NODE &&\n\t\t(node_value = get_node_value(hydrate_node))?.startsWith(`$`)\n\t) {\n\t\tconst id = node_value.substring(1);\n\t\thydrate_next();\n\t\treturn id;\n\t}\n\t// @ts-expect-error This way we ensure the id is unique even across Svelte runtimes\n\t(globalThis.__svelte ??= {}).uid ??= 1;\n\n\t// @ts-expect-error\n\treturn `c${globalThis.__svelte.uid++}`;\n}\n","import { get, untrack } from '../internal/client/runtime.js';\nimport { effect_tracking, render_effect } from '../internal/client/reactivity/effects.js';\nimport { source, increment } from '../internal/client/reactivity/sources.js';\nimport { tag } from '../internal/client/dev/tracing.js';\nimport { DEV } from 'esm-env';\nimport { queue_micro_task } from '../internal/client/dom/task.js';\n\n/**\n * Returns a `subscribe` function that integrates external event-based systems with Svelte's reactivity.\n * It's particularly useful for integrating with web APIs like `MediaQuery`, `IntersectionObserver`, or `WebSocket`.\n *\n * If `subscribe` is called inside an effect (including indirectly, for example inside a getter),\n * the `start` callback will be called with an `update` function. Whenever `update` is called, the effect re-runs.\n *\n * If `start` returns a cleanup function, it will be called when the effect is destroyed.\n *\n * If `subscribe` is called in multiple effects, `start` will only be called once as long as the effects\n * are active, and the returned teardown function will only be called when all effects are destroyed.\n *\n * It's best understood with an example. Here's an implementation of [`MediaQuery`](https://svelte.dev/docs/svelte/svelte-reactivity#MediaQuery):\n *\n * ```js\n * import { createSubscriber } from 'svelte/reactivity';\n * import { on } from 'svelte/events';\n *\n * export class MediaQuery {\n * \t#query;\n * \t#subscribe;\n *\n * \tconstructor(query) {\n * \t\tthis.#query = window.matchMedia(`(${query})`);\n *\n * \t\tthis.#subscribe = createSubscriber((update) => {\n * \t\t\t// when the `change` event occurs, re-run any effects that read `this.current`\n * \t\t\tconst off = on(this.#query, 'change', update);\n *\n * \t\t\t// stop listening when all the effects are destroyed\n * \t\t\treturn () => off();\n * \t\t});\n * \t}\n *\n * \tget current() {\n * \t\t// This makes the getter reactive, if read in an effect\n * \t\tthis.#subscribe();\n *\n * \t\t// Return the current state of the query, whether or not we're in an effect\n * \t\treturn this.#query.matches;\n * \t}\n * }\n * ```\n * @param {(update: () => void) => (() => void) | void} start\n * @since 5.7.0\n */\nexport function createSubscriber(start) {\n\tlet subscribers = 0;\n\tlet version = source(0);\n\t/** @type {(() => void) | void} */\n\tlet stop;\n\n\tif (DEV) {\n\t\ttag(version, 'createSubscriber version');\n\t}\n\n\treturn () => {\n\t\tif (effect_tracking()) {\n\t\t\tget(version);\n\n\t\t\trender_effect(() => {\n\t\t\t\tif (subscribers === 0) {\n\t\t\t\t\tstop = untrack(() => start(() => increment(version)));\n\t\t\t\t}\n\n\t\t\t\tsubscribers += 1;\n\n\t\t\t\treturn () => {\n\t\t\t\t\tqueue_micro_task(() => {\n\t\t\t\t\t\t// Only count down after a microtask, else we would reach 0 before our own render effect reruns,\n\t\t\t\t\t\t// but reach 1 again when the tick callback of the prior teardown runs. That would mean we\n\t\t\t\t\t\t// re-subscribe unnecessarily and create a memory leak because the old subscription is never cleaned up.\n\t\t\t\t\t\tsubscribers -= 1;\n\n\t\t\t\t\t\tif (subscribers === 0) {\n\t\t\t\t\t\t\tstop?.();\n\t\t\t\t\t\t\tstop = undefined;\n\t\t\t\t\t\t\t// Increment the version to ensure any dependent deriveds are marked dirty when the subscription is picked up again later.\n\t\t\t\t\t\t\t// If we didn't do this then the comparison of write versions would determine that the derived has a later version than\n\t\t\t\t\t\t\t// the subscriber, and it would not be re-run.\n\t\t\t\t\t\t\tincrement(version);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t};\n\t\t\t});\n\t\t}\n\t};\n}\n","/** @import { Effect, Source, TemplateNode, } from '#client' */\nimport {\n\tBOUNDARY_EFFECT,\n\tDESTROYED,\n\tDESTROYING,\n\tDIRTY,\n\tEFFECT_PRESERVED,\n\tEFFECT_TRANSPARENT,\n\tMAYBE_DIRTY\n} from '#client/constants';\nimport {\n\tHYDRATION_ERROR,\n\tHYDRATION_START_ELSE,\n\tHYDRATION_START_FAILED\n} from '../../../../constants.js';\nimport { component_context, set_component_context } from '../../context.js';\nimport { invoke_error_boundary } from '../../error-handling.js';\nimport {\n\tblock,\n\tbranch,\n\tdestroy_effect,\n\tmove_effect,\n\tpause_effect\n} from '../../reactivity/effects.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tget,\n\tset_active_effect,\n\tset_active_reaction\n} from '../../runtime.js';\nimport {\n\thydrate_next,\n\thydrate_node,\n\thydrating,\n\tnext,\n\tread_hydration_instruction,\n\tskip_nodes,\n\tset_hydrate_node\n} from '../hydration.js';\nimport { queue_micro_task } from '../task.js';\nimport * as e from '../../errors.js';\nimport * as w from '../../warnings.js';\nimport { DEV } from 'esm-env';\nimport { Batch, current_batch } from '../../reactivity/batch.js';\nimport { internal_set, source } from '../../reactivity/sources.js';\nimport { tag } from '../../dev/tracing.js';\nimport { createSubscriber } from '../../../../reactivity/create-subscriber.js';\nimport { create_anchor, create_fragment, append_child, insert_before } from '../operations.js';\nimport { set_signal_status } from '../../reactivity/status.js';\nimport { push_renderer, pop_renderer } from '../../custom-renderer/state.js';\nimport { custom_renderers_flag } from '../../../flags/index.js';\n\n/**\n * @typedef {{\n * \t onerror?: ((error: unknown, reset: () => void) => void) | null;\n * failed?: ((anchor: Node, error: () => unknown, reset: () => () => void) => void) | null;\n * pending?: ((anchor: Node) => void) | null;\n * }} BoundaryProps\n */\n\nvar flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED;\n\n/**\n * @param {TemplateNode} node\n * @param {BoundaryProps} props\n * @param {((anchor: Node) => void)} children\n * @param {((error: unknown) => unknown) | undefined} [transform_error]\n * @returns {void}\n */\nexport function boundary(node, props, children, transform_error) {\n\tnew Boundary(node, props, children, transform_error);\n}\n\nexport class Boundary {\n\t/** @type {Boundary | null} */\n\tparent;\n\n\tis_pending = false;\n\n\t/**\n\t * API-level transformError transform function. Transforms errors before they reach the `failed` snippet.\n\t * Inherited from parent boundary, or defaults to identity.\n\t * @type {(error: unknown) => unknown}\n\t */\n\ttransform_error;\n\n\t/** @type {TemplateNode} */\n\t#anchor;\n\n\t/** @type {TemplateNode | null} */\n\t#hydrate_open = hydrating ? hydrate_node : null;\n\n\t/** @type {BoundaryProps} */\n\t#props;\n\n\t/** @type {((anchor: Node) => void)} */\n\t#children;\n\n\t/** @type {Effect} */\n\t#effect;\n\n\t/** @type {Effect | null} */\n\t#main_effect = null;\n\n\t/** @type {Effect | null} */\n\t#pending_effect = null;\n\n\t/** @type {Effect | null} */\n\t#failed_effect = null;\n\n\t/** @type {DocumentFragment | null} */\n\t#offscreen_fragment = null;\n\n\t#local_pending_count = 0;\n\t#pending_count_update_queued = false;\n\n\t/**\n\t * User effects created inside this boundary. They will run when the boundary is revealed\n\t * @type {Effect[]}\n\t */\n\t#effects = [];\n\n\t/**\n\t * Async effects that are currently in flight, grouped by the batch that started them.\n\t * A speculative fork's work must not hold up the real world's boundary.\n\t * @type {Map<Batch, Map<Effect, number>>}\n\t */\n\t#pending = new Map();\n\n\t/**\n\t * A source containing the number of pending async deriveds/expressions.\n\t * Only created if `$effect.pending()` is used inside the boundary,\n\t * otherwise updating the source results in needless `Batch.ensure()`\n\t * calls followed by no-op flushes\n\t * @type {Source<number> | null}\n\t */\n\t#effect_pending = null;\n\n\t#effect_pending_subscriber = createSubscriber(() => {\n\t\tthis.#effect_pending = source(this.#local_pending_count);\n\n\t\tif (DEV) {\n\t\t\ttag(this.#effect_pending, '$effect.pending()');\n\t\t}\n\n\t\treturn () => {\n\t\t\tthis.#effect_pending = null;\n\t\t};\n\t});\n\n\t/**\n\t * @param {TemplateNode} node\n\t * @param {BoundaryProps} props\n\t * @param {((anchor: Node) => void)} children\n\t * @param {((error: unknown) => unknown) | undefined} [transform_error]\n\t */\n\tconstructor(node, props, children, transform_error) {\n\t\tthis.#anchor = node;\n\t\tthis.#props = props;\n\n\t\tthis.#children = (anchor) => {\n\t\t\tvar effect = /** @type {Effect} */ (active_effect);\n\n\t\t\teffect.b = this;\n\t\t\teffect.f |= BOUNDARY_EFFECT;\n\n\t\t\tchildren(anchor);\n\t\t};\n\n\t\tthis.parent = /** @type {Effect} */ (active_effect).b;\n\n\t\t// Inherit transform_error from parent boundary, or use the provided one, or default to identity\n\t\tthis.transform_error = transform_error ?? this.parent?.transform_error ?? ((e) => e);\n\n\t\tthis.#effect = block(() => {\n\t\t\tif (hydrating) {\n\t\t\t\tconst comment_data = read_hydration_instruction(\n\t\t\t\t\t/** @type {TemplateNode} */ (this.#hydrate_open)\n\t\t\t\t);\n\t\t\t\thydrate_next();\n\n\t\t\t\tconst server_rendered_pending = comment_data === HYDRATION_START_ELSE;\n\t\t\t\tconst server_rendered_failed = comment_data.startsWith(HYDRATION_START_FAILED);\n\n\t\t\t\tif (server_rendered_failed) {\n\t\t\t\t\t// Server rendered the failed snippet - hydrate it.\n\t\t\t\t\t// The serialized error is embedded in the comment: <!--[?<json>-->\n\t\t\t\t\tconst serialized_error = JSON.parse(comment_data.slice(HYDRATION_START_FAILED.length));\n\t\t\t\t\tthis.#hydrate_failed_content(serialized_error);\n\t\t\t\t} else if (server_rendered_pending) {\n\t\t\t\t\tthis.#hydrate_pending_content();\n\t\t\t\t} else {\n\t\t\t\t\tthis.#hydrate_resolved_content();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.#render();\n\t\t\t}\n\t\t}, flags);\n\n\t\tif (hydrating) {\n\t\t\tthis.#anchor = hydrate_node;\n\t\t}\n\t}\n\n\t#hydrate_resolved_content() {\n\t\ttry {\n\t\t\tthis.#main_effect = branch(() => this.#children(this.#anchor));\n\t\t} catch (error) {\n\t\t\tthis.error(error);\n\t\t}\n\t}\n\n\t/**\n\t * @param {unknown} error The deserialized error from the server's hydration comment\n\t */\n\t#hydrate_failed_content(error) {\n\t\tconst failed = this.#props.failed;\n\t\tconst { reset, invoke_onerror } = this.#create_reset(error);\n\n\t\t// `onerror` may mutate state, which is disallowed while hydrating\n\t\tqueue_micro_task(invoke_onerror);\n\n\t\tif (!failed) return;\n\n\t\tthis.#failed_effect = branch(() => {\n\t\t\tfailed(\n\t\t\t\tthis.#anchor,\n\t\t\t\t() => error,\n\t\t\t\t() => reset\n\t\t\t);\n\t\t});\n\t}\n\n\t/**\n\t * Creates the `reset` function for a failed boundary, along with a function\n\t * that invokes `onerror` with it (if provided)\n\t * @param {unknown} error\n\t * @returns {{ reset: () => void, invoke_onerror: () => void }}\n\t */\n\t#create_reset(error) {\n\t\tvar did_reset = false;\n\t\tvar calling_on_error = false;\n\n\t\tconst reset = () => {\n\t\t\tif (this.#is_destroyed()) return;\n\n\t\t\tif (did_reset) {\n\t\t\t\tw.svelte_boundary_reset_noop();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tdid_reset = true;\n\n\t\t\tif (calling_on_error) {\n\t\t\t\te.svelte_boundary_reset_onerror();\n\t\t\t}\n\n\t\t\tif (this.#failed_effect !== null) {\n\t\t\t\tpause_effect(this.#failed_effect, () => {\n\t\t\t\t\tthis.#failed_effect = null;\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tthis.#run(() => {\n\t\t\t\tthis.#render();\n\t\t\t});\n\t\t};\n\n\t\tconst invoke_onerror = () => {\n\t\t\tif (this.#is_destroyed()) return;\n\n\t\t\ttry {\n\t\t\t\tcalling_on_error = true;\n\t\t\t\tthis.#props.onerror?.(error, reset);\n\t\t\t\tcalling_on_error = false;\n\t\t\t} catch (err) {\n\t\t\t\tinvoke_error_boundary(err, this.#effect && this.#effect.parent);\n\t\t\t}\n\t\t};\n\n\t\treturn { reset, invoke_onerror };\n\t}\n\n\t#is_destroyed() {\n\t\treturn (this.#effect.f & (DESTROYED | DESTROYING)) !== 0;\n\t}\n\n\t#hydrate_pending_content() {\n\t\tconst pending = this.#props.pending;\n\t\tif (!pending) return;\n\n\t\tthis.is_pending = true;\n\t\tthis.#pending_effect = branch(() => pending(this.#anchor));\n\n\t\tqueue_micro_task(() => {\n\t\t\tif (this.#is_destroyed()) return;\n\n\t\t\tvar previous_renderer = custom_renderers_flag ? push_renderer(this.#effect.r) : null;\n\n\t\t\ttry {\n\t\t\t\tvar fragment = (this.#offscreen_fragment = create_fragment());\n\t\t\t\tvar anchor = create_anchor();\n\n\t\t\t\tappend_child(fragment, anchor);\n\n\t\t\t\tthis.#main_effect = this.#run(() => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn branch(() => this.#children(anchor));\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tthis.error(error);\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\tinvoke_error_boundary(error, this.#effect.parent);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tif (this.#main_effect !== null && this.#pending.size === 0) {\n\t\t\t\t\tthis.is_pending = false;\n\t\t\t\t\tinsert_before(this.#anchor, fragment);\n\t\t\t\t\tthis.#offscreen_fragment = null;\n\n\t\t\t\t\tpause_effect(/** @type {Effect} */ (this.#pending_effect), () => {\n\t\t\t\t\t\tthis.#pending_effect = null;\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tif (custom_renderers_flag) pop_renderer(previous_renderer);\n\t\t\t}\n\t\t});\n\t}\n\n\t#render() {\n\t\ttry {\n\t\t\tthis.is_pending = this.has_pending_snippet();\n\t\t\tthis.#local_pending_count = 0;\n\n\t\t\tthis.#main_effect = branch(() => {\n\t\t\t\tthis.#children(this.#anchor);\n\t\t\t});\n\n\t\t\tif (this.#pending.size === 0) {\n\t\t\t\tthis.is_pending = false;\n\t\t\t} else {\n\t\t\t\tconst pending = this.#props.pending;\n\n\t\t\t\tif (pending) {\n\t\t\t\t\tvar fragment = (this.#offscreen_fragment = create_fragment());\n\t\t\t\t\tmove_effect(this.#main_effect, fragment);\n\n\t\t\t\t\tthis.#pending_effect = branch(() => pending(this.#anchor));\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tthis.error(error);\n\t\t}\n\t}\n\n\t/**\n\t * Defer an effect inside a pending boundary until the boundary resolves\n\t * @param {Effect} effect\n\t */\n\tdefer_effect(effect) {\n\t\tthis.#effects.push(effect);\n\t}\n\n\thas_pending_snippet() {\n\t\treturn !!this.#props.pending;\n\t}\n\n\t/**\n\t * @template T\n\t * @param {() => T} fn\n\t */\n\t#run(fn) {\n\t\tvar previous_effect = active_effect;\n\t\tvar previous_reaction = active_reaction;\n\t\tvar previous_ctx = component_context;\n\n\t\tset_active_effect(this.#effect);\n\t\tset_active_reaction(this.#effect);\n\t\tset_component_context(this.#effect.ctx);\n\n\t\tvar previous_renderer = custom_renderers_flag ? push_renderer(this.#effect.r) : null;\n\n\t\ttry {\n\t\t\tBatch.ensure();\n\t\t\treturn fn();\n\t\t} finally {\n\t\t\tset_active_effect(previous_effect);\n\t\t\tset_active_reaction(previous_reaction);\n\t\t\tset_component_context(previous_ctx);\n\t\t\tif (custom_renderers_flag) pop_renderer(previous_renderer);\n\t\t}\n\t}\n\n\t/**\n\t * @param {Batch} batch\n\t */\n\tis_ready(batch) {\n\t\tif (batch.is_fork && this.#pending.size > 0) {\n\t\t\treturn false;\n\t\t}\n\n\t\tfor (const [owner, pending] of this.#pending) {\n\t\t\tif (owner.is_fork) continue;\n\n\t\t\tfor (const effect of pending.keys()) {\n\t\t\t\tif (batch.is_blocked_by(effect, this.#main_effect)) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * @param {Effect[]} effects\n\t */\n\treveal(effects) {\n\t\tthis.is_pending = false;\n\n\t\t// Add any deferred effects to the batch's effect queue\n\t\tfor (const effect of this.#effects) {\n\t\t\tset_signal_status(effect, DIRTY);\n\t\t\teffects.push(effect);\n\t\t}\n\n\t\tthis.#effects.length = 0;\n\n\t\tif (this.#pending_effect) {\n\t\t\tpause_effect(this.#pending_effect, () => {\n\t\t\t\tthis.#pending_effect = null;\n\t\t\t});\n\t\t}\n\n\t\tif (this.#offscreen_fragment) {\n\t\t\tvar previous_renderer = custom_renderers_flag ? push_renderer(this.#effect.r) : null;\n\n\t\t\ttry {\n\t\t\t\tinsert_before(this.#anchor, this.#offscreen_fragment);\n\t\t\t\tthis.#offscreen_fragment = null;\n\t\t\t} finally {\n\t\t\t\tif (custom_renderers_flag) pop_renderer(previous_renderer);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @param {Effect} effect\n\t * @param {Batch} batch\n\t */\n\tincrement(effect, batch) {\n\t\tvar pending = this.#pending.get(batch);\n\n\t\tif (pending === undefined) {\n\t\t\tthis.#pending.set(batch, (pending = new Map()));\n\t\t}\n\n\t\tvar count = pending.get(effect) ?? 0;\n\t\tpending.set(effect, count + 1);\n\t}\n\n\t/**\n\t * @param {Effect} effect\n\t * @param {Batch} batch\n\t */\n\tdecrement(effect, batch) {\n\t\tvar pending = /** @type {Map<Effect, number>} */ (this.#pending.get(batch));\n\t\tvar count = /** @type {number} */ (pending.get(effect));\n\n\t\tif (count === 1) {\n\t\t\tpending.delete(effect);\n\n\t\t\tif (pending.size === 0) {\n\t\t\t\tthis.#pending.delete(batch);\n\t\t\t}\n\n\t\t\t// The remaining work may belong to speculative forks. Check again in a normal batch,\n\t\t\t// after the result's batch has flushed, so that we reveal committed content and run\n\t\t\t// deferred effects in the same view.\n\t\t\tqueue_micro_task(() => {\n\t\t\t\tif (this.is_pending && !this.#is_destroyed()) {\n\t\t\t\t\tBatch.ensure().schedule(this.#effect, MAYBE_DIRTY);\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\tpending.set(effect, count - 1);\n\t\t}\n\t}\n\n\t/**\n\t * Update the source that powers `$effect.pending()` inside this boundary.\n\t * Do not call from inside the class\n\t * @param {1 | -1} d\n\t */\n\tupdate_effect_pending(d) {\n\t\tthis.#local_pending_count += d;\n\n\t\tif (!this.#effect_pending || this.#pending_count_update_queued) return;\n\t\tthis.#pending_count_update_queued = true;\n\n\t\tqueue_micro_task(() => {\n\t\t\tthis.#pending_count_update_queued = false;\n\t\t\tif (this.#effect_pending) {\n\t\t\t\tinternal_set(this.#effect_pending, this.#local_pending_count);\n\t\t\t}\n\t\t});\n\t}\n\n\tget_effect_pending() {\n\t\tthis.#effect_pending_subscriber();\n\t\treturn get(/** @type {Source<number>} */ (this.#effect_pending));\n\t}\n\n\t/** @param {unknown} error */\n\terror(error) {\n\t\tif (error === HYDRATION_ERROR) {\n\t\t\tthrow error;\n\t\t}\n\n\t\t// If we have nothing to capture the error, or if we hit an error while\n\t\t// rendering the fallback, re-throw for another boundary to handle\n\t\tif (!this.#props.onerror && !this.#props.failed) {\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (current_batch?.is_fork) {\n\t\t\tif (this.#main_effect) current_batch.skip_effect(this.#main_effect);\n\t\t\tif (this.#pending_effect) current_batch.skip_effect(this.#pending_effect);\n\t\t\tif (this.#failed_effect) current_batch.skip_effect(this.#failed_effect);\n\n\t\t\tcurrent_batch.oncommit(() => {\n\t\t\t\tif (!this.#is_destroyed()) this.#handle_error(error);\n\t\t\t});\n\t\t} else {\n\t\t\tthis.#handle_error(error);\n\t\t}\n\t}\n\n\t/**\n\t * @param {unknown} error\n\t */\n\t#handle_error(error) {\n\t\tif (this.#main_effect) {\n\t\t\tdestroy_effect(this.#main_effect);\n\t\t\tthis.#main_effect = null;\n\t\t}\n\n\t\tif (this.#pending_effect) {\n\t\t\tdestroy_effect(this.#pending_effect);\n\t\t\tthis.#pending_effect = null;\n\t\t}\n\n\t\tif (this.#failed_effect) {\n\t\t\tdestroy_effect(this.#failed_effect);\n\t\t\tthis.#failed_effect = null;\n\t\t}\n\n\t\tif (hydrating) {\n\t\t\tset_hydrate_node(/** @type {TemplateNode} */ (this.#hydrate_open));\n\t\t\tnext();\n\t\t\tset_hydrate_node(skip_nodes());\n\t\t}\n\n\t\tlet failed = this.#props.failed;\n\n\t\t/** @param {unknown} transformed_error */\n\t\tconst handle_error_result = (transformed_error) => {\n\t\t\tif (this.#is_destroyed()) return;\n\n\t\t\tconst { reset, invoke_onerror } = this.#create_reset(transformed_error);\n\n\t\t\tinvoke_onerror();\n\n\t\t\tif (failed && !this.#is_destroyed()) {\n\t\t\t\tthis.#failed_effect = this.#run(() => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn branch(() => {\n\t\t\t\t\t\t\t// errors in `failed` snippets cause the boundary to error again\n\t\t\t\t\t\t\t// TODO Svelte 6: revisit this decision, most likely better to go to parent boundary instead\n\t\t\t\t\t\t\tvar effect = /** @type {Effect} */ (active_effect);\n\n\t\t\t\t\t\t\teffect.b = this;\n\t\t\t\t\t\t\teffect.f |= BOUNDARY_EFFECT;\n\n\t\t\t\t\t\t\tfailed(\n\t\t\t\t\t\t\t\tthis.#anchor,\n\t\t\t\t\t\t\t\t() => transformed_error,\n\t\t\t\t\t\t\t\t() => reset\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tinvoke_error_boundary(error, /** @type {Effect} */ (this.#effect.parent));\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\tqueue_micro_task(() => {\n\t\t\tif (this.#is_destroyed()) return;\n\n\t\t\t// Run the error through the API-level transformError transform (e.g. SvelteKit's handleError)\n\t\t\t/** @type {unknown} */\n\t\t\tvar result;\n\t\t\ttry {\n\t\t\t\tresult = this.transform_error(error);\n\t\t\t} catch (e) {\n\t\t\t\tinvoke_error_boundary(e, this.#effect && this.#effect.parent);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tresult !== null &&\n\t\t\t\ttypeof result === 'object' &&\n\t\t\t\ttypeof (/** @type {any} */ (result).then) === 'function'\n\t\t\t) {\n\t\t\t\t// transformError returned a Promise — wait for it\n\t\t\t\t/** @type {any} */ (result).then(\n\t\t\t\t\thandle_error_result,\n\t\t\t\t\t/** @param {unknown} e */\n\t\t\t\t\t(e) => invoke_error_boundary(e, this.#effect && this.#effect.parent)\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\t// Synchronous result — handle immediately\n\t\t\t\thandle_error_result(result);\n\t\t\t}\n\t\t});\n\t}\n}\n\nexport function pending() {\n\tif (active_effect === null) {\n\t\te.effect_pending_outside_reaction();\n\t}\n\n\tvar boundary = active_effect.b;\n\n\tif (boundary === null) {\n\t\treturn 0; // TODO eventually we will need this to be global\n\t}\n\n\treturn boundary.get_effect_pending();\n}\n","/** @import { ComponentContext, Effect, EffectNodes, TemplateNode } from '#client' */\n/** @import { Component, ComponentType, SvelteComponent, MountOptions } from '../../index.js' */\n/** @import { Renderer } from './custom-renderer/types.js' */\nimport { DEV } from 'esm-env';\nimport {\n\tclear_text_content,\n\tcreate_anchor,\n\tget_first_child,\n\tget_next_sibling,\n\tappend_child,\n\tget_parent_node,\n\tremove_child,\n\tset_node_value,\n\tget_node_value,\n\tnode_type\n} from './dom/operations.js';\nimport { HYDRATION_END, HYDRATION_ERROR, HYDRATION_START } from '../../constants.js';\nimport { active_effect } from './runtime.js';\nimport { push, pop, component_context, mark_as_component } from './context.js';\nimport { component_root } from './reactivity/effects.js';\nimport { hydrate_node, hydrating, set_hydrate_node, set_hydrating } from './dom/hydration.js';\nimport { listen_to_delegated_events } from './dom/elements/events.js';\nimport * as w from './warnings.js';\nimport * as e from './errors.js';\nimport { assign_nodes } from './dom/template.js';\nimport { COMMENT_NODE, TEXT_CACHE } from './constants.js';\nimport { boundary } from './dom/blocks/boundary.js';\nimport { push_renderer, pop_renderer } from './custom-renderer/state.js';\nimport { async_mode_flag, custom_renderers_flag } from '../flags/index.js';\nimport { current_batch } from './reactivity/batch.js';\n\n/**\n * This is normally true — block effects should run their intro transitions —\n * but is false during hydration (unless `options.intro` is `true`) and\n * when creating the children of a `<svelte:element>` that just changed tag\n */\nexport let should_intro = true;\n\n/** @param {boolean} value */\nexport function set_should_intro(value) {\n\tshould_intro = value;\n}\n\n/**\n * @param {Element} text\n * @param {string} value\n * @returns {void}\n */\nexport function set_text(text, value) {\n\t// For objects, we apply string coercion (which might make things like $state array references in the template reactive) before diffing\n\tvar str = value == null ? '' : typeof value === 'object' ? `${value}` : value;\n\t// prettier-ignore\n\tif (str !== (/** @type {any} */ (text)[TEXT_CACHE] ??= get_node_value(text))) {\n\t\t/** @type {any} */ (text)[TEXT_CACHE] = str;\n\t\tset_node_value(text, `${str}`);\n\t}\n}\n\n/**\n * Mounts a component to the given target and returns the exports and potentially the props (if compiled with `accessors: true`) of the component.\n * Transitions will play during the initial render unless the `intro` option is set to `false`.\n *\n * @template {Record<string, any>} Props\n * @template {Record<string, any>} Exports\n * @template [Renderer=undefined]\n * @param {ComponentType<SvelteComponent<Props>> | Component<Props, Exports, any>} component\n * @param {MountOptions<Props, Renderer>} options\n * @returns {Exports}\n */\nexport function mount(component, options) {\n\treturn _mount(component, options);\n}\n\n/**\n * Hydrates a component on the given target and returns the exports and potentially the props (if compiled with `accessors: true`) of the component\n *\n * @template {Record<string, any>} Props\n * @template {Record<string, any>} Exports\n * @template [Renderer=undefined]\n * @param {ComponentType<SvelteComponent<Props>> | Component<Props, Exports, any>} component\n * @param {{} extends Props ? {\n * \t\ttarget: Document | Element | ShadowRoot;\n * \t\tprops?: Props;\n * \t\tevents?: Record<string, (e: any) => any>;\n * \tcontext?: Map<any, any>;\n * \t\tintro?: boolean;\n * \t\trecover?: boolean;\n *\t\ttransformError?: (error: unknown) => unknown;\n * \t} : {\n * \t\ttarget: Document | Element | ShadowRoot;\n * \t\tprops: Props;\n * \t\tevents?: Record<string, (e: any) => any>;\n * \tcontext?: Map<any, any>;\n * \t\tintro?: boolean;\n * \t\trecover?: boolean;\n *\t\ttransformError?: (error: unknown) => unknown;\n * \t}} options\n * @returns {Exports}\n */\n// `Renderer` is unused, but the type parameters need to match `mount`'s,\n// otherwise a `hydrate | mount` union isn't callable\nexport function hydrate(component, options) {\n\toptions.intro = options.intro ?? false;\n\tconst target = options.target;\n\tconst was_hydrating = hydrating;\n\tconst previous_hydrate_node = hydrate_node;\n\n\ttry {\n\t\tvar anchor = get_first_child(target);\n\n\t\twhile (\n\t\t\tanchor &&\n\t\t\t(node_type(anchor) !== COMMENT_NODE || get_node_value(anchor) !== HYDRATION_START)\n\t\t) {\n\t\t\tanchor = get_next_sibling(anchor);\n\t\t}\n\n\t\tif (!anchor) {\n\t\t\tthrow HYDRATION_ERROR;\n\t\t}\n\n\t\tset_hydrating(true);\n\t\tset_hydrate_node(/** @type {Comment} */ (anchor));\n\n\t\tconst instance = _mount(component, { ...options, anchor });\n\n\t\t// The server rendered the hydrated DOM with the state that hydration ran with (set before `hydrate()`,\n\t\t// or while hydrating, e.g. by lazily initialized state), so that state is the real world from now on.\n\t\t// This is what happens when mounting, too, where the batch commits right away because the root boundary\n\t\t// is pending. Otherwise, while the hydration batch waits for async work, other batches' views would undo\n\t\t// those writes — e.g. that of a pending boundary's content, which renders in a batch of its own\n\t\tif (async_mode_flag && current_batch !== null) {\n\t\t\tcurrent_batch.commit_writes();\n\t\t}\n\n\t\tset_hydrating(false);\n\n\t\treturn /** @type {Exports} */ (instance);\n\t} catch (error) {\n\t\t// re-throw Svelte errors - they are certainly not related to hydration\n\t\tif (\n\t\t\terror instanceof Error &&\n\t\t\terror.message.split('\\n').some((line) => line.startsWith('https://svelte.dev/e/'))\n\t\t) {\n\t\t\tthrow error;\n\t\t}\n\t\tif (error !== HYDRATION_ERROR) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.warn('Failed to hydrate: ', error);\n\t\t}\n\n\t\tif (options.recover === false) {\n\t\t\te.hydration_failed();\n\t\t}\n\n\t\tclear_text_content(target);\n\n\t\tset_hydrating(false);\n\t\treturn mount(component, options);\n\t} finally {\n\t\tset_hydrating(was_hydrating);\n\t\tset_hydrate_node(previous_hydrate_node);\n\t}\n}\n\n/**\n * @template {Record<string, any>} Exports\n * @param {ComponentType<SvelteComponent<any>> | Component<any>} Component\n * @param {MountOptions<any, any> & { renderer?: Renderer }} options\n * @returns {Exports}\n */\nfunction _mount(Component, options) {\n\tif (custom_renderers_flag && options.renderer) {\n\t\tvar previous_renderer = push_renderer(options.renderer);\n\n\t\ttry {\n\t\t\treturn _mount_inner(Component, options);\n\t\t} finally {\n\t\t\tpop_renderer(previous_renderer);\n\t\t}\n\t}\n\n\treturn _mount_inner(Component, options);\n}\n\n/**\n * @template {Record<string, any>} Exports\n * @param {ComponentType<SvelteComponent<any>> | Component<any>} Component\n * @param {MountOptions<any, any> & { renderer?: Renderer }} options\n * @returns {Exports}\n */\nfunction _mount_inner(\n\tComponent,\n\t{ target, anchor, props = {}, events, context, intro = true, transformError, renderer }\n) {\n\t/** @type {Exports} */\n\t// @ts-expect-error will be defined because the render effect runs synchronously\n\tvar component = undefined;\n\n\tvar unmount = component_root(() => {\n\t\tvar anchor_node =\n\t\t\tanchor ?? /** @type {Text} */ (append_child(/** @type {Node} */ (target), create_anchor()));\n\n\t\tboundary(\n\t\t\t/** @type {TemplateNode} */ (anchor_node),\n\t\t\t{\n\t\t\t\tpending: () => {}\n\t\t\t},\n\t\t\t(anchor_node) => {\n\t\t\t\tpush({});\n\t\t\t\tvar ctx = /** @type {ComponentContext} */ (component_context);\n\t\t\t\tif (context) ctx.c = context;\n\n\t\t\t\tif (events) {\n\t\t\t\t\t// We can't spread the object or else we'd lose the state proxy stuff, if it is one\n\t\t\t\t\t/** @type {any} */ (props).$$events = events;\n\t\t\t\t}\n\n\t\t\t\tif (hydrating) {\n\t\t\t\t\tassign_nodes(/** @type {TemplateNode} */ (anchor_node), null);\n\t\t\t\t}\n\n\t\t\t\tshould_intro = intro;\n\t\t\t\t// @ts-expect-error the public typings are not what the actual function looks like\n\t\t\t\tcomponent = Component(anchor_node, props) || mark_as_component();\n\t\t\t\tshould_intro = true;\n\n\t\t\t\tif (hydrating) {\n\t\t\t\t\t/** @type {Effect & { nodes: EffectNodes }} */ (active_effect).nodes.end = hydrate_node;\n\n\t\t\t\t\tif (\n\t\t\t\t\t\thydrate_node === null ||\n\t\t\t\t\t\tnode_type(hydrate_node) !== COMMENT_NODE ||\n\t\t\t\t\t\tget_node_value(hydrate_node) !== HYDRATION_END\n\t\t\t\t\t) {\n\t\t\t\t\t\tw.hydration_mismatch();\n\t\t\t\t\t\tthrow HYDRATION_ERROR;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tpop();\n\t\t\t},\n\t\t\ttransformError\n\t\t);\n\n\t\t// Setup event delegation _after_ component is mounted - if an error would happen during mount, it would otherwise not be cleaned up.\n\t\t// When mounting with a custom renderer the target isn't a DOM node; any DOM content inside it is rendered\n\t\t// into DOM containers that become delegation roots themselves (see `cross`)\n\t\tvar stop_listening = renderer\n\t\t\t? null\n\t\t\t: listen_to_delegated_events(/** @type {EventTarget} */ (target));\n\n\t\treturn () => {\n\t\t\tstop_listening?.();\n\n\t\t\tif (anchor_node !== anchor) {\n\t\t\t\tvar parent = get_parent_node(/** @type {Node} */ (anchor_node));\n\t\t\t\tif (parent) remove_child(parent, /** @type {ChildNode} */ (anchor_node));\n\t\t\t}\n\t\t};\n\t});\n\n\tmounted_components.set(component, unmount);\n\treturn component;\n}\n\n/**\n * References of the components that were mounted or hydrated.\n * Uses a `WeakMap` to avoid memory leaks.\n */\nlet mounted_components = new WeakMap();\n\n/**\n * Unmounts a component that was previously mounted using `mount` or `hydrate`.\n *\n * Since 5.13.0, if `options.outro` is `true`, [transitions](https://svelte.dev/docs/svelte/transition) will play before the component is removed from the DOM.\n *\n * Returns a `Promise` that resolves after transitions have completed if `options.outro` is true, or immediately otherwise (prior to 5.13.0, returns `void`).\n *\n * ```js\n * import { mount, unmount } from 'svelte';\n * import App from './App.svelte';\n *\n * const app = mount(App, { target: document.body });\n *\n * // later...\n * unmount(app, { outro: true });\n * ```\n * @param {Record<string, any>} component\n * @param {{ outro?: boolean }} [options]\n * @returns {Promise<void>}\n */\nexport function unmount(component, options) {\n\tconst fn = mounted_components.get(component);\n\n\tif (fn) {\n\t\tmounted_components.delete(component);\n\t\treturn fn(options);\n\t}\n\n\tif (DEV) {\n\t\tw.lifecycle_double_unmount();\n\t}\n\n\treturn Promise.resolve();\n}\n","/** @import { Effect, TemplateNode } from '#client' */\n/** @import { Renderer } from '../../custom-renderer/types.js' */\n/** @import { Batch } from '../../reactivity/batch.js' */\nimport { current_batch } from '../../reactivity/batch.js';\nimport {\n\tbranch,\n\tdestroy_effect,\n\tmove_effect,\n\tpause_effect,\n\tresume_effect\n} from '../../reactivity/effects.js';\nimport { HMR_ANCHOR } from '../../constants.js';\nimport { EFFECT_OFFSCREEN } from '#client/constants';\nimport { hydrate_node, hydrating } from '../hydration.js';\nimport {\n\tcreate_anchor,\n\tshould_defer_append,\n\tcreate_fragment,\n\tappend_child,\n\tinsert_before,\n\tremove_node,\n\tget_last_child\n} from '../operations.js';\nimport { DEV } from 'esm-env';\nimport { push_renderer, current_renderer, pop_renderer } from '../../custom-renderer/state.js';\nimport { custom_renderers_flag } from '../../../flags/index.js';\n\n/**\n * @typedef {{ effect: Effect, fragment: DocumentFragment }} Branch\n */\n\n/**\n * @template Key\n */\nexport class BranchManager {\n\t/** @type {TemplateNode} */\n\tanchor;\n\n\t/** @type {Map<Batch, Key>} */\n\t#batches = new Map();\n\n\t/**\n\t * Map of keys to effects that are currently rendered in the DOM.\n\t * These effects are visible and actively part of the document tree.\n\t * Example:\n\t * ```\n\t * {#if condition}\n\t * \tfoo\n\t * {:else}\n\t * \tbar\n\t * {/if}\n\t * ```\n\t * Can result in the entries `true->Effect` and `false->Effect`\n\t * @type {Map<Key, Effect>}\n\t */\n\t#onscreen = new Map();\n\n\t/**\n\t * Similar to #onscreen with respect to the keys, but contains branches that are not yet\n\t * in the DOM, because their insertion is deferred.\n\t * @type {Map<Key, Branch>}\n\t */\n\t#offscreen = new Map();\n\n\t/**\n\t * Keys of effects that are currently outroing\n\t * @type {Set<Key>}\n\t */\n\t#outroing = new Set();\n\n\t/**\n\t * Whether to pause (i.e. outro) on change, or destroy immediately.\n\t * This is necessary for `<svelte:element>`\n\t */\n\t#transition = true;\n\n\t/**\n\t * The renderer that was active when this BranchManager was created.\n\t * Needed so that #commit can push the correct renderer when doing DOM operations\n\t * outside of an effect context (e.g. as a batch commit callback).\n\t * @type {Renderer | null}\n\t */\n\t#renderer = null;\n\n\t/**\n\t * @param {TemplateNode} anchor\n\t * @param {boolean} transition\n\t */\n\tconstructor(anchor, transition = true) {\n\t\tthis.anchor = anchor;\n\t\tthis.#transition = transition;\n\t\tthis.#renderer = current_renderer;\n\t}\n\n\t/**\n\t * @param {Batch} batch\n\t */\n\t#commit = (batch) => {\n\t\t// if this batch was made obsolete, bail\n\t\tif (!this.#batches.has(batch)) return;\n\n\t\tvar previous_renderer = custom_renderers_flag ? push_renderer(this.#renderer) : null;\n\n\t\ttry {\n\t\t\tvar key = /** @type {Key} */ (this.#batches.get(batch));\n\n\t\t\tvar onscreen = this.#onscreen.get(key);\n\n\t\t\tif (onscreen) {\n\t\t\t\t// effect is already in the DOM — abort any current outro\n\t\t\t\tresume_effect(onscreen);\n\t\t\t\tthis.#outroing.delete(key);\n\t\t\t} else {\n\t\t\t\t// effect is currently offscreen. put it in the DOM\n\t\t\t\tvar offscreen = this.#offscreen.get(key);\n\n\t\t\t\tif (offscreen) {\n\t\t\t\t\t// effect could have been outro'ed before through a prior batch — resume if necessary\n\t\t\t\t\tresume_effect(offscreen.effect);\n\t\t\t\t\tthis.#onscreen.set(key, offscreen.effect);\n\t\t\t\t\tthis.#offscreen.delete(key);\n\n\t\t\t\t\tif (DEV) {\n\t\t\t\t\t\t// Tell hmr.js about the anchor it should use for updates,\n\t\t\t\t\t\t// since the initial one will be removed\n\t\t\t\t\t\t/** @type {any} */ (get_last_child(offscreen.fragment))[HMR_ANCHOR] = this.anchor;\n\t\t\t\t\t}\n\n\t\t\t\t\t// remove the anchor...\n\t\t\t\t\tremove_node(/** @type {ChildNode} */ (get_last_child(offscreen.fragment)));\n\n\t\t\t\t\t// ...and append the fragment\n\t\t\t\t\tinsert_before(this.anchor, offscreen.fragment);\n\t\t\t\t\tonscreen = offscreen.effect;\n\t\t\t\t\tonscreen.f &= ~EFFECT_OFFSCREEN;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// other batches can still commit (in any order), so their selections remain\n\t\t\tthis.#discard(batch);\n\n\t\t\t// outro/destroy all onscreen effects...\n\t\t\tfor (const [k, effect] of this.#onscreen) {\n\t\t\t\t// ...except the one that was just committed\n\t\t\t\t// or those that are already outroing (else the transition is aborted and the effect destroyed right away)\n\t\t\t\tif (k === key || this.#outroing.has(k)) continue;\n\n\t\t\t\tconst on_destroy = () => {\n\t\t\t\t\tconst keys = Array.from(this.#batches.values());\n\n\t\t\t\t\tif (keys.includes(k)) {\n\t\t\t\t\t\t// keep the effect offscreen, as another batch will need it\n\t\t\t\t\t\tvar fragment = create_fragment();\n\t\t\t\t\t\tmove_effect(effect, fragment);\n\n\t\t\t\t\t\tappend_child(fragment, create_anchor()); // TODO can we avoid this?\n\n\t\t\t\t\t\tthis.#offscreen.set(k, { effect, fragment });\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdestroy_effect(effect);\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.#outroing.delete(k);\n\t\t\t\t\tthis.#onscreen.delete(k);\n\t\t\t\t};\n\n\t\t\t\tif (this.#transition || !onscreen) {\n\t\t\t\t\tthis.#outroing.add(k);\n\t\t\t\t\tpause_effect(effect, on_destroy, false);\n\t\t\t\t} else {\n\t\t\t\t\ton_destroy();\n\t\t\t\t}\n\t\t\t}\n\t\t} finally {\n\t\t\tif (custom_renderers_flag) pop_renderer(previous_renderer);\n\t\t}\n\t};\n\n\t/**\n\t * @param {Batch} batch\n\t */\n\t#discard = (batch) => {\n\t\tfor (const b of this.#batches.keys()) {\n\t\t\t// (batches that were merged into another one don't select anything anymore)\n\t\t\tif (b === batch || !b.linked) this.#batches.delete(b);\n\t\t}\n\n\t\tconst keys = Array.from(this.#batches.values());\n\n\t\tfor (const [k, branch] of this.#offscreen) {\n\t\t\tif (!keys.includes(k)) {\n\t\t\t\tdestroy_effect(branch.effect);\n\t\t\t\tthis.#offscreen.delete(k);\n\t\t\t}\n\t\t}\n\t};\n\n\t/**\n\t *\n\t * @param {any} key\n\t * @param {null | ((target: TemplateNode) => void)} fn\n\t */\n\tensure(key, fn) {\n\t\tvar batch = /** @type {Batch} */ (current_batch);\n\t\tvar defer = should_defer_append();\n\n\t\tif (fn && !this.#onscreen.has(key) && !this.#offscreen.has(key)) {\n\t\t\tif (defer) {\n\t\t\t\tvar fragment = create_fragment();\n\t\t\t\tvar target = create_anchor();\n\n\t\t\t\tappend_child(fragment, target);\n\n\t\t\t\tvar effect = branch(() => fn(target));\n\n\t\t\t\t// until it is committed, the branch only exists for the batches that select it\n\t\t\t\teffect.f |= EFFECT_OFFSCREEN;\n\t\t\t\tbatch.unskip_new_effect(effect);\n\n\t\t\t\tthis.#offscreen.set(key, { effect, fragment });\n\t\t\t} else {\n\t\t\t\tthis.#onscreen.set(\n\t\t\t\t\tkey,\n\t\t\t\t\tbranch(() => fn(this.anchor))\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tthis.#batches.set(batch, key);\n\n\t\tif (defer) {\n\t\t\tfor (const [k, effect] of this.#onscreen) {\n\t\t\t\tif (k === key) {\n\t\t\t\t\tbatch.unskip_effect(effect);\n\t\t\t\t} else {\n\t\t\t\t\tbatch.skip_effect(effect);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const [k, branch] of this.#offscreen) {\n\t\t\t\tif (k === key) {\n\t\t\t\t\tbatch.unskip_effect(branch.effect);\n\t\t\t\t} else {\n\t\t\t\t\tbatch.skip_effect(branch.effect);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tbatch.oncommit(this.#commit);\n\t\t\tbatch.ondiscard(this.#discard);\n\t\t} else {\n\t\t\tif (hydrating) {\n\t\t\t\tthis.anchor = hydrate_node;\n\t\t\t}\n\n\t\t\tthis.#commit(batch);\n\t\t}\n\t}\n}\n","/** @import { TemplateNode } from '#client' */\nimport { EFFECT_TRANSPARENT } from '#client/constants';\nimport {\n\thydrate_next,\n\thydrating,\n\tread_hydration_instruction,\n\tskip_nodes,\n\tset_hydrate_node,\n\tset_hydrating,\n\thydrate_node\n} from '../hydration.js';\nimport { block } from '../../reactivity/effects.js';\nimport { BranchManager } from './branches.js';\n\n/**\n * @param {TemplateNode} node\n * @param {(branch: (fn: (anchor: Node) => void, key?: number | false) => void) => void} fn\n * @param {boolean} [elseif] True if this is an `{:else if ...}` block rather than an `{#if ...}`, as that affects which transitions are considered 'local'\n * @returns {void}\n */\nexport function if_block(node, fn, elseif = false) {\n\t/** @type {TemplateNode | undefined} */\n\tvar marker;\n\tif (hydrating) {\n\t\tmarker = hydrate_node;\n\t\thydrate_next();\n\t}\n\n\tvar branches = new BranchManager(node);\n\tvar flags = elseif ? EFFECT_TRANSPARENT : 0;\n\n\t/**\n\t * @param {number | false} key\n\t * @param {null | ((anchor: Node) => void)} fn\n\t */\n\tfunction update_branch(key, fn) {\n\t\tif (hydrating) {\n\t\t\tvar data = read_hydration_instruction(/** @type {TemplateNode} */ (marker));\n\n\t\t\t// \"[n\" = branch n, \"[-1\" = else\n\t\t\tif (key !== parseInt(data.substring(1))) {\n\t\t\t\t// Hydration mismatch: remove everything inside the anchor and start fresh.\n\t\t\t\t// This could happen with `{#if browser}...{/if}`, for example\n\t\t\t\tvar anchor = skip_nodes();\n\n\t\t\t\tset_hydrate_node(anchor);\n\t\t\t\tbranches.anchor = anchor;\n\n\t\t\t\tset_hydrating(false);\n\t\t\t\tbranches.ensure(key, fn);\n\t\t\t\tset_hydrating(true);\n\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tbranches.ensure(key, fn);\n\t}\n\n\tblock(() => {\n\t\tvar has_branch = false;\n\n\t\tfn((fn, key = 0) => {\n\t\t\thas_branch = true;\n\t\t\tupdate_branch(key, fn);\n\t\t});\n\n\t\tif (!has_branch) {\n\t\t\tupdate_branch(-1, null);\n\t\t}\n\t}, flags);\n}\n","/** @import { TemplateNode } from '#client' */\nimport { is_runes } from '../../context.js';\nimport { block } from '../../reactivity/effects.js';\nimport { hydrate_next, hydrating } from '../hydration.js';\nimport { BranchManager } from './branches.js';\n\nconst NAN = Symbol('NaN');\n\n/**\n * @template V\n * @param {TemplateNode} node\n * @param {() => V} get_key\n * @param {(anchor: Node) => TemplateNode | void} render_fn\n * @returns {void}\n */\nexport function key(node, get_key, render_fn) {\n\tif (hydrating) {\n\t\thydrate_next();\n\t}\n\n\tvar branches = new BranchManager(node);\n\n\tvar legacy = !is_runes();\n\n\tblock(() => {\n\t\tvar key = get_key();\n\n\t\t// NaN !== NaN, hence we do this workaround to not trigger remounts unnecessarily\n\t\tif (key !== key) {\n\t\t\tkey = /** @type {any} */ (NAN);\n\t\t}\n\n\t\t// key blocks in Svelte <5 had stupid semantics\n\t\tif (legacy && key !== null && typeof key === 'object') {\n\t\t\tkey = /** @type {V} */ ({});\n\t\t}\n\n\t\tbranches.ensure(key, render_fn);\n\t});\n}\n","function r(e){var t,f,n=\"\";if(\"string\"==typeof e||\"number\"==typeof e)n+=e;else if(\"object\"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=\" \"),n+=f)}else for(f in e)e[f]&&(n&&(n+=\" \"),n+=f);return n}export function clsx(){for(var e,t,f=0,n=\"\",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=\" \"),n+=t);return n}export default clsx;","import { escape_html } from '../../escaping.js';\nimport { clsx as _clsx } from 'clsx';\nimport { has_own_property } from './utils.js';\n\n/**\n * `<div translate={false}>` should be rendered as `<div translate=\"no\">` and _not_\n * `<div translate=\"false\">`, which is equivalent to `<div translate=\"yes\">`. There\n * may be other odd cases that need to be added to this list in future\n * @type {Record<string, Map<any, string>>}\n */\nconst replacements = {\n\ttranslate: new Map([\n\t\t[true, 'yes'],\n\t\t[false, 'no']\n\t])\n};\n\n/**\n * @template V\n * @param {string} name\n * @param {V} value\n * @param {boolean} [is_boolean]\n * @returns {string}\n */\nexport function attr(name, value, is_boolean = false) {\n\t// attribute hidden for values other than \"until-found\" behaves like a boolean attribute\n\tif (name === 'hidden' && value !== 'until-found') {\n\t\tis_boolean = true;\n\t}\n\t// `''` is a present boolean attribute, as it is in markup and on the client\n\tif (value == null || (is_boolean && !value && value !== '')) return '';\n\tconst normalized =\n\t\t(has_own_property.call(replacements, name) && replacements[name].get(value)) || value;\n\tconst assignment = is_boolean ? `=\"\"` : `=\"${escape_html(normalized, true)}\"`;\n\treturn ` ${name}${assignment}`;\n}\n\n/**\n * Small wrapper around clsx to preserve Svelte's (weird) handling of falsy values.\n * TODO Svelte 6 revisit this, and likely turn all falsy values into the empty string (what clsx also does)\n * @param {any} value\n */\nexport function clsx(value) {\n\tif (typeof value === 'object') {\n\t\treturn _clsx(value);\n\t} else {\n\t\treturn value ?? '';\n\t}\n}\n\nconst whitespace = [...' \\t\\n\\r\\f\\u00a0\\u000b\\ufeff'];\n\n/**\n * @param {any} value\n * @param {string | null} [hash]\n * @param {Record<string, boolean>} [directives]\n * @returns {string | null}\n */\nexport function to_class(value, hash, directives) {\n\tvar classname = value == null ? '' : '' + value;\n\n\tif (hash) {\n\t\tclassname = classname ? classname + ' ' + hash : hash;\n\t}\n\n\tif (directives) {\n\t\tfor (var key of Object.keys(directives)) {\n\t\t\tif (directives[key]) {\n\t\t\t\tclassname = classname ? classname + ' ' + key : key;\n\t\t\t} else if (classname.length) {\n\t\t\t\tvar len = key.length;\n\t\t\t\tvar a = 0;\n\n\t\t\t\twhile ((a = classname.indexOf(key, a)) >= 0) {\n\t\t\t\t\tvar b = a + len;\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t(a === 0 || whitespace.includes(classname[a - 1])) &&\n\t\t\t\t\t\t(b === classname.length || whitespace.includes(classname[b]))\n\t\t\t\t\t) {\n\t\t\t\t\t\tclassname = (a === 0 ? '' : classname.substring(0, a)) + classname.substring(b + 1);\n\t\t\t\t\t} else {\n\t\t\t\t\t\ta = b;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn classname === '' ? null : classname;\n}\n\n/**\n *\n * @param {Record<string,any>} styles\n * @param {boolean} important\n */\nfunction append_styles(styles, important = false) {\n\tvar separator = important ? ' !important;' : ';';\n\tvar css = '';\n\n\tfor (var key of Object.keys(styles)) {\n\t\tvar value = styles[key];\n\t\tif (value != null && value !== '') {\n\t\t\tcss += ' ' + key + ': ' + value + separator;\n\t\t}\n\t}\n\n\treturn css;\n}\n\n/**\n * @param {string} name\n * @returns {string}\n */\nfunction to_css_name(name) {\n\tif (name[0] !== '-' || name[1] !== '-') {\n\t\treturn name.toLowerCase();\n\t}\n\treturn name;\n}\n\n/**\n * @param {any} value\n * @param {Record<string, any> | [Record<string, any>, Record<string, any>]} [styles]\n * @returns {string | null}\n */\nexport function to_style(value, styles) {\n\tif (styles) {\n\t\tvar new_style = '';\n\n\t\t/** @type {Record<string,any> | undefined} */\n\t\tvar normal_styles;\n\n\t\t/** @type {Record<string,any> | undefined} */\n\t\tvar important_styles;\n\n\t\tif (Array.isArray(styles)) {\n\t\t\tnormal_styles = styles[0];\n\t\t\timportant_styles = styles[1];\n\t\t} else {\n\t\t\tnormal_styles = styles;\n\t\t}\n\n\t\tif (value) {\n\t\t\t// strip comments; surrounding whitespace is handled by the trims below (which is much faster than doing it through regex)\n\t\t\tvalue = String(value)\n\t\t\t\t.replaceAll(/\\/\\*.*?\\*\\//g, '')\n\t\t\t\t.trim();\n\n\t\t\t/** @type {boolean | '\"' | \"'\"} */\n\t\t\tvar in_str = false;\n\t\t\tvar in_apo = 0;\n\t\t\tvar in_comment = false;\n\n\t\t\tvar reserved_names = [];\n\n\t\t\tif (normal_styles) {\n\t\t\t\treserved_names.push(...Object.keys(normal_styles).map(to_css_name));\n\t\t\t}\n\t\t\tif (important_styles) {\n\t\t\t\treserved_names.push(...Object.keys(important_styles).map(to_css_name));\n\t\t\t}\n\n\t\t\tvar start_index = 0;\n\t\t\tvar name_index = -1;\n\n\t\t\tconst len = value.length;\n\t\t\tfor (var i = 0; i < len; i++) {\n\t\t\t\tvar c = value[i];\n\n\t\t\t\tif (in_comment) {\n\t\t\t\t\tif (c === '/' && value[i - 1] === '*') {\n\t\t\t\t\t\tin_comment = false;\n\t\t\t\t\t}\n\t\t\t\t} else if (in_str) {\n\t\t\t\t\tif (in_str === c) {\n\t\t\t\t\t\tin_str = false;\n\t\t\t\t\t}\n\t\t\t\t} else if (c === '/' && value[i + 1] === '*') {\n\t\t\t\t\tin_comment = true;\n\t\t\t\t} else if (c === '\"' || c === \"'\") {\n\t\t\t\t\tin_str = c;\n\t\t\t\t} else if (c === '(') {\n\t\t\t\t\tin_apo++;\n\t\t\t\t} else if (c === ')') {\n\t\t\t\t\tin_apo--;\n\t\t\t\t}\n\n\t\t\t\tif (!in_comment && in_str === false && in_apo === 0) {\n\t\t\t\t\tif (c === ':' && name_index === -1) {\n\t\t\t\t\t\tname_index = i;\n\t\t\t\t\t} else if (c === ';' || i === len - 1) {\n\t\t\t\t\t\tif (name_index !== -1) {\n\t\t\t\t\t\t\tvar name = to_css_name(value.substring(start_index, name_index).trim());\n\n\t\t\t\t\t\t\tif (!reserved_names.includes(name)) {\n\t\t\t\t\t\t\t\tif (c !== ';') {\n\t\t\t\t\t\t\t\t\ti++;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tvar property = value.substring(start_index, i).trim();\n\t\t\t\t\t\t\t\tnew_style += ' ' + property + ';';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tstart_index = i + 1;\n\t\t\t\t\t\tname_index = -1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (normal_styles) {\n\t\t\tnew_style += append_styles(normal_styles);\n\t\t}\n\n\t\tif (important_styles) {\n\t\t\tnew_style += append_styles(important_styles, true);\n\t\t}\n\n\t\tnew_style = new_style.trim();\n\t\treturn new_style === '' ? null : new_style;\n\t}\n\n\treturn value == null ? null : String(value);\n}\n","/** @import { EachItem, EachOutroGroup, EachState, Effect, EffectNodes, MaybeSource, TemplateNode } from '#client' */\n/** @import { Batch } from '../../reactivity/batch.js'; */\nimport {\n\tEACH_INDEX_REACTIVE,\n\tEACH_IS_ANIMATED,\n\tEACH_IS_CONTROLLED,\n\tEACH_ITEM_IMMUTABLE,\n\tEACH_ITEM_REACTIVE,\n\tHYDRATION_END,\n\tHYDRATION_START_ELSE\n} from '../../../../constants.js';\nimport {\n\thydrate_next,\n\thydrate_node,\n\thydrating,\n\tread_hydration_instruction,\n\tskip_nodes,\n\tset_hydrate_node,\n\tset_hydrating\n} from '../hydration.js';\nimport {\n\tclear_text_content,\n\tcreate_anchor,\n\tget_first_child,\n\tget_next_sibling,\n\tshould_defer_append,\n\tget_parent_node,\n\tappend_child,\n\tcreate_fragment,\n\tinsert_before,\n\tnode_type,\n\tget_node_value\n} from '../operations.js';\nimport {\n\tblock,\n\tbranch,\n\tdestroy_effect,\n\tmove_effect,\n\tpause_effect,\n\tresume_effect\n} from '../../reactivity/effects.js';\nimport { source, mutable_source, internal_set } from '../../reactivity/sources.js';\nimport { array_from, is_array } from '../../../shared/utils.js';\nimport { BRANCH_EFFECT, COMMENT_NODE, DESTROYED, EFFECT_OFFSCREEN, INERT } from '#client/constants';\nimport { queue_micro_task } from '../task.js';\nimport { get } from '../../runtime.js';\nimport { DEV } from 'esm-env';\nimport { derived_safe_equal } from '../../reactivity/deriveds.js';\nimport { current_batch } from '../../reactivity/batch.js';\nimport * as e from '../../errors.js';\nimport { tag } from '../../dev/tracing.js';\n\nimport { push_renderer, current_renderer, pop_renderer } from '../../custom-renderer/state.js';\nimport { custom_renderers_flag } from '../../../flags/index.js';\n\n// When making substantive changes to this file, validate them with the each block stress test:\n// https://svelte.dev/playground/1972b2cf46564476ad8c8c6405b23b7b\n// This test also exists in this repo, as `packages/svelte/tests/manual/each-stress-test`\n\n/**\n * @param {any} _\n * @param {number} i\n */\nexport function index(_, i) {\n\treturn i;\n}\n\n/**\n * Pause multiple effects simultaneously, and coordinate their\n * subsequent destruction. Used in each blocks\n * @param {EachState} state\n * @param {Effect[]} to_destroy\n * @param {null | Node} controlled_anchor\n */\nfunction pause_effects(state, to_destroy, controlled_anchor) {\n\t/** @type {Effect[]} */\n\tvar done = [];\n\tvar length = to_destroy.length;\n\n\t/** @type {EachOutroGroup} */\n\tvar group;\n\n\tfor (var i = 0; i < length; i++) {\n\t\tlet effect = to_destroy[i];\n\n\t\tpause_effect(\n\t\t\teffect,\n\t\t\t() => {\n\t\t\t\tif (group) {\n\t\t\t\t\tgroup.pending.delete(effect);\n\t\t\t\t\tgroup.done.add(effect);\n\n\t\t\t\t\tif (group.pending.size === 0) {\n\t\t\t\t\t\tvar groups = /** @type {Set<EachOutroGroup>} */ (state.outrogroups);\n\n\t\t\t\t\t\tdestroy_effects(state, array_from(group.done));\n\t\t\t\t\t\tgroups.delete(group);\n\n\t\t\t\t\t\tif (groups.size === 0) {\n\t\t\t\t\t\t\tstate.outrogroups = null;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tdone.push(effect);\n\t\t\t\t}\n\t\t\t},\n\t\t\tfalse\n\t\t);\n\t}\n\n\tif (done.length === length) {\n\t\t// If we're in a controlled each block (i.e. the block is the only child of an\n\t\t// element), and we are removing all items, _and_ all outros finished synchronously,\n\t\t// we can use the fast path — emptying the element and replacing the anchor.\n\t\t// Skip the fast path when another batch is still pending on this each block:\n\t\t// that batch's keys still reference EachItems in `state.items`, which\n\t\t// `destroy_effects` needs to preserve offscreen (see #18610).\n\t\tvar fast_path = controlled_anchor !== null && state.pending.size === 0;\n\n\t\tif (fast_path) {\n\t\t\tvar anchor = /** @type {Element} */ (controlled_anchor);\n\t\t\tvar parent_node = /** @type {Element} */ (get_parent_node(anchor));\n\n\t\t\tclear_text_content(parent_node);\n\t\t\tappend_child(parent_node, anchor);\n\n\t\t\tstate.items.clear();\n\t\t}\n\n\t\tdestroy_effects(state, to_destroy, !fast_path);\n\t} else {\n\t\tgroup = {\n\t\t\tpending: new Set(to_destroy),\n\t\t\tdone: new Set(done)\n\t\t};\n\n\t\t// Synchronous outros finished before the group existed.\n\t\tfor (const effect of done) {\n\t\t\tgroup.pending.delete(effect);\n\t\t}\n\n\t\t(state.outrogroups ??= new Set()).add(group);\n\t}\n}\n\n/**\n * @param {EachState} state\n * @returns {Set<Effect>}\n */\nfunction selected_effects(state) {\n\tvar selected = new Set();\n\t// The loop-in-a-loop isn't ideal, but we should only hit this in relatively rare cases\n\tfor (const keys of state.pending.values()) {\n\t\tfor (const key of keys) {\n\t\t\tselected.add(/** @type {EachItem} */ (state.items.get(key)).e);\n\t\t}\n\t}\n\treturn selected;\n}\n\n/**\n * @param {EachState} state\n * @param {Effect[]} to_destroy\n * @param {boolean} remove_dom\n */\nfunction destroy_effects(state, to_destroy, remove_dom = true) {\n\tvar preserved_effects = state.pending.size > 0 ? selected_effects(state) : undefined;\n\n\tfor (var i = 0; i < to_destroy.length; i++) {\n\t\tvar e = to_destroy[i];\n\n\t\tif (preserved_effects?.has(e)) {\n\t\t\te.f |= EFFECT_OFFSCREEN;\n\n\t\t\tconst fragment = create_fragment();\n\t\t\tmove_effect(e, fragment);\n\n\t\t\t// `reconcile` expects offscreen items to come after all onscreen items\n\t\t\tif (e !== state.effect.last) {\n\t\t\t\tlink(state, e.prev, e.next);\n\t\t\t\tlink(state, state.effect.last, e);\n\t\t\t\tlink(state, e, null);\n\t\t\t}\n\t\t} else {\n\t\t\tdestroy_effect(to_destroy[i], remove_dom);\n\t\t}\n\t}\n}\n\n/**\n * Whether the item is outroing, i.e. `pause_effects` destroys it (or keeps it offscreen) once its outro is done\n * @param {EachState} state\n * @param {Effect} effect\n */\nfunction is_outroing(state, effect) {\n\tif (state.outrogroups !== null) {\n\t\tfor (const group of state.outrogroups) {\n\t\t\tif (group.pending.has(effect) || group.done.has(effect)) return true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\n// we need to handle the case of multiple renderers so we need to use a WeakMap of offscreen anchors rather than a single variable.\n// we also need the dom_weak_key since `null` is not a viable WeakKey\n/** @type {WeakMap<WeakKey, TemplateNode>} */\nvar offscreen_anchors = new WeakMap();\nvar dom_weak_key = {};\n\n/**\n * Returns an anchor node suitable for offscreen rendering.\n * When a custom renderer is active, the anchor must have a parent\n * (so that `getParent()` works), so we place the text node inside\n * a fragment. The result is cached just like the non-renderer path.\n * @returns {TemplateNode}\n */\nfunction get_offscreen_anchor() {\n\t// not doing it inline to please typescript\n\tvar cached = offscreen_anchors.get(current_renderer ?? dom_weak_key);\n\tif (cached) return cached;\n\n\tvar offscreen_anchor = create_anchor();\n\n\tif (current_renderer) {\n\t\tvar fragment = create_fragment();\n\t\tappend_child(fragment, offscreen_anchor);\n\t}\n\n\toffscreen_anchors.set(current_renderer ?? dom_weak_key, offscreen_anchor);\n\treturn offscreen_anchor;\n}\n\n/**\n * @template V\n * @param {Element | Comment} node The next sibling node, or the parent node if this is a 'controlled' block\n * @param {number} flags\n * @param {() => V[]} get_collection\n * @param {(value: V, index: number) => any} get_key\n * @param {(anchor: Node, item: MaybeSource<V>, index: MaybeSource<number>) => void} render_fn\n * @param {null | ((anchor: Node) => void)} fallback_fn\n * @returns {void}\n */\nexport function each(node, flags, get_collection, get_key, render_fn, fallback_fn = null) {\n\tvar anchor = node;\n\n\t/** @type {Map<any, EachItem>} */\n\tvar items = new Map();\n\n\tvar is_controlled = (flags & EACH_IS_CONTROLLED) !== 0;\n\n\t// Capture the renderer that was active when this each block was created.\n\t// Needed so that the commit callback can push the correct renderer when doing\n\t// DOM operations outside of an effect context (e.g. as a batch commit callback).\n\tvar renderer = current_renderer;\n\n\tif (is_controlled) {\n\t\tvar parent_node = /** @type {Element} */ (node);\n\n\t\tanchor = hydrating\n\t\t\t? set_hydrate_node(get_first_child(parent_node))\n\t\t\t: /** @type {Text} */ (append_child(parent_node, create_anchor()));\n\t}\n\n\tif (hydrating) {\n\t\thydrate_next();\n\t}\n\n\t/** @type {Effect | null} */\n\tvar fallback = null;\n\n\t// TODO: ideally we could use derived for runes mode but because of the ability\n\t// to use a store which can be mutated, we can't do that here as mutating a store\n\t// will still result in the collection array being the same from the store\n\tvar each_array = derived_safe_equal(() => {\n\t\tvar collection = get_collection();\n\n\t\treturn /** @type {V[]} */ (\n\t\t\tis_array(collection) ? collection : collection == null ? [] : array_from(collection)\n\t\t);\n\t});\n\n\tif (DEV) {\n\t\ttag(each_array, '{#each ...}');\n\t}\n\n\t/** @type {Map<Batch, Set<any>>} */\n\tvar pending = new Map();\n\n\tvar first_run = true;\n\n\t/**\n\t * @param {Batch} batch\n\t */\n\tfunction commit(batch) {\n\t\tif ((state.effect.f & DESTROYED) !== 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar previous_renderer = custom_renderers_flag ? push_renderer(renderer) : null;\n\n\t\ttry {\n\t\t\tstate.pending.delete(batch);\n\n\t\t\t// The effect doesn't necessarily re-run in a batch right before that batch commits\n\t\t\t// (its view of the collection may not have changed), so we read the collection\n\t\t\t// as the committing batch sees it rather than using the most recent block run's result\n\t\t\tvar array = get(each_array);\n\n\t\t\tstate.fallback = fallback;\n\t\t\treconcile(state, array, anchor, flags, get_key);\n\n\t\t\tif (fallback !== null) {\n\t\t\t\tif (array.length === 0) {\n\t\t\t\t\tif ((fallback.f & EFFECT_OFFSCREEN) === 0) {\n\t\t\t\t\t\tresume_effect(fallback);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfallback.f ^= EFFECT_OFFSCREEN;\n\t\t\t\t\t\tmove(fallback, null, anchor);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tpause_effect(fallback, () => {\n\t\t\t\t\t\t// TODO only null out if no pending batch needs it,\n\t\t\t\t\t\t// otherwise re-add `fallback.fragment` and move the\n\t\t\t\t\t\t// effect into it\n\t\t\t\t\t\tfallback = null;\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t} finally {\n\t\t\tif (custom_renderers_flag) pop_renderer(previous_renderer);\n\t\t}\n\n\t\tdestroy_unselected();\n\t}\n\n\t/**\n\t * @param {Batch} batch\n\t */\n\tfunction discard(batch) {\n\t\tstate.pending.delete(batch);\n\n\t\tif ((state.effect.f & DESTROYED) === 0) {\n\t\t\tdestroy_unselected();\n\t\t}\n\t}\n\n\t/**\n\t * Destroys the offscreen items that no pending batch selects anymore. Offscreen items only exist\n\t * for the batches that select them: they were created in their view, or kept for them when a\n\t * commit removed them (see `destroy_effects`). A batch stops selecting an item when it's discarded,\n\t * or when its block runs again without it. `reconcile` doesn't destroy such an item if it was kept,\n\t * as kept items are paused, and it leaves paused items alone (taking them to be outroing)\n\t */\n\tfunction destroy_unselected() {\n\t\t/** @type {Set<Effect> | undefined} */\n\t\tvar selected;\n\t\tvar effect = state.effect.last;\n\n\t\t// offscreen items come after all onscreen items (see `destroy_effects`)\n\t\twhile (effect !== null) {\n\t\t\tvar prev = effect.prev;\n\n\t\t\t// (an offscreen fallback isn't paused, so the next commit shows it or destroys it, see above)\n\t\t\tif ((effect.f & BRANCH_EFFECT) !== 0 && effect !== fallback) {\n\t\t\t\tif ((effect.f & EFFECT_OFFSCREEN) === 0) break;\n\n\t\t\t\t// create lazily to save work in the common case\n\t\t\t\tselected ??= selected_effects(state);\n\n\t\t\t\tif (!selected.has(effect) && !is_outroing(state, effect)) {\n\t\t\t\t\tdestroy_effect(effect);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\teffect = prev;\n\t\t}\n\t}\n\n\tvar effect = block(() => {\n\t\tvar array = /** @type {V[]} */ (get(each_array));\n\t\tvar length = array.length;\n\n\t\t/** `true` if there was a hydration mismatch. Needs to be a `let` or else it isn't treeshaken out */\n\t\tlet mismatch = false;\n\n\t\tif (hydrating) {\n\t\t\tvar is_else = read_hydration_instruction(anchor) === HYDRATION_START_ELSE;\n\n\t\t\tif (is_else !== (length === 0)) {\n\t\t\t\t// hydration mismatch — remove the server-rendered DOM and start over\n\t\t\t\tanchor = skip_nodes();\n\n\t\t\t\tset_hydrate_node(anchor);\n\t\t\t\tset_hydrating(false);\n\t\t\t\tmismatch = true;\n\t\t\t}\n\t\t}\n\n\t\tvar keys = new Set();\n\t\tvar batch = /** @type {Batch} */ (current_batch);\n\t\tvar defer = should_defer_append();\n\n\t\tfor (var index = 0; index < length; index += 1) {\n\t\t\tif (\n\t\t\t\thydrating &&\n\t\t\t\tnode_type(hydrate_node) === COMMENT_NODE &&\n\t\t\t\tget_node_value(hydrate_node) === HYDRATION_END\n\t\t\t) {\n\t\t\t\t// The server rendered fewer items than expected,\n\t\t\t\t// so break out and continue appending non-hydrated items\n\t\t\t\tanchor = /** @type {Comment} */ (hydrate_node);\n\t\t\t\tmismatch = true;\n\t\t\t\tset_hydrating(false);\n\t\t\t}\n\n\t\t\tvar value = array[index];\n\t\t\tvar key = get_key(value, index);\n\n\t\t\tif (DEV) {\n\t\t\t\t// Check that the key function is idempotent (returns the same value when called twice)\n\t\t\t\tvar key_again = get_key(value, index);\n\t\t\t\tif (key !== key_again) {\n\t\t\t\t\te.each_key_volatile(String(index), String(key), String(key_again));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar item = first_run ? null : items.get(key);\n\n\t\t\tif (item) {\n\t\t\t\t// update before reconciliation, to trigger any async updates\n\t\t\t\tif (item.v) internal_set(item.v, value);\n\t\t\t\tif (item.i) internal_set(item.i, index);\n\n\t\t\t\tif (defer) {\n\t\t\t\t\tbatch.unskip_effect(item.e);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\titem = create_item(\n\t\t\t\t\titems,\n\t\t\t\t\tfirst_run ? anchor : get_offscreen_anchor(),\n\t\t\t\t\tvalue,\n\t\t\t\t\tkey,\n\t\t\t\t\tindex,\n\t\t\t\t\trender_fn,\n\t\t\t\t\tflags,\n\t\t\t\t\tget_collection\n\t\t\t\t);\n\n\t\t\t\tif (!first_run) {\n\t\t\t\t\t// until it is committed, the item only exists for the batches that select it\n\t\t\t\t\titem.e.f |= EFFECT_OFFSCREEN;\n\t\t\t\t\tif (defer) batch.unskip_new_effect(item.e);\n\t\t\t\t}\n\n\t\t\t\titems.set(key, item);\n\t\t\t}\n\n\t\t\tkeys.add(key);\n\t\t}\n\n\t\tif (length === 0 && fallback_fn && !fallback) {\n\t\t\tif (first_run) {\n\t\t\t\tfallback = branch(() => fallback_fn(anchor));\n\t\t\t} else {\n\t\t\t\tfallback = branch(() => fallback_fn(get_offscreen_anchor()));\n\t\t\t\t// until it is committed, the fallback only exists for the batches that select it\n\t\t\t\tfallback.f |= EFFECT_OFFSCREEN;\n\t\t\t\tif (defer) batch.unskip_new_effect(fallback);\n\t\t\t}\n\t\t}\n\n\t\tif (defer && fallback !== null) {\n\t\t\tif (length === 0) {\n\t\t\t\tbatch.unskip_effect(fallback);\n\t\t\t} else {\n\t\t\t\tbatch.skip_effect(fallback);\n\t\t\t}\n\t\t}\n\n\t\tif (length > keys.size) {\n\t\t\tif (DEV) {\n\t\t\t\tvalidate_each_keys(array, get_key);\n\t\t\t} else {\n\t\t\t\t// in prod, the additional information isn't printed, so don't bother computing it\n\t\t\t\te.each_key_duplicate('', '', '');\n\t\t\t}\n\t\t}\n\n\t\t// remove excess nodes\n\t\tif (hydrating && length > 0) {\n\t\t\tset_hydrate_node(skip_nodes());\n\t\t}\n\n\t\tif (!first_run) {\n\t\t\tpending.set(batch, keys);\n\n\t\t\tif (defer) {\n\t\t\t\tfor (const [key, item] of items) {\n\t\t\t\t\tif (!keys.has(key)) {\n\t\t\t\t\t\tbatch.skip_effect(item.e);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tbatch.oncommit(commit);\n\t\t\t\tbatch.ondiscard(discard);\n\t\t\t} else {\n\t\t\t\tcommit(batch);\n\t\t\t}\n\t\t}\n\n\t\tif (mismatch) {\n\t\t\t// continue in hydration mode\n\t\t\tset_hydrating(true);\n\t\t}\n\n\t\t// When we mount the each block for the first time, the collection won't be\n\t\t// connected to this effect as the effect hasn't finished running yet and its deps\n\t\t// won't be assigned. However, it's possible that when reconciling the each block\n\t\t// that a mutation occurred and it's made the collection MAYBE_DIRTY, so reading the\n\t\t// collection again can provide consistency to the reactive graph again as the deriveds\n\t\t// will now be `CLEAN`.\n\t\tget(each_array);\n\t});\n\n\t/** @type {EachState} */\n\tvar state = { effect, flags, items, pending, outrogroups: null, fallback };\n\n\tfirst_run = false;\n\n\tif (hydrating) {\n\t\tanchor = hydrate_node;\n\t}\n}\n\n/**\n * Skip past any non-branch effects (which could be created with `createSubscriber`, for example) to find the next branch effect\n * @param {Effect | null} effect\n * @returns {Effect | null}\n */\nfunction skip_to_branch(effect) {\n\twhile (effect !== null && (effect.f & BRANCH_EFFECT) === 0) {\n\t\teffect = effect.next;\n\t}\n\treturn effect;\n}\n\n/**\n * Add, remove, or reorder items output by an each block as its input changes\n * @template V\n * @param {EachState} state\n * @param {Array<V>} array\n * @param {Element | Comment | Text} anchor\n * @param {number} flags\n * @param {(value: V, index: number) => any} get_key\n * @returns {void}\n */\nfunction reconcile(state, array, anchor, flags, get_key) {\n\tvar is_animated = (flags & EACH_IS_ANIMATED) !== 0;\n\n\tvar length = array.length;\n\tvar items = state.items;\n\tvar current = skip_to_branch(state.effect.first);\n\n\t/** @type {undefined | Set<Effect>} */\n\tvar seen;\n\n\t/** @type {Effect | null} */\n\tvar prev = null;\n\n\t/** @type {undefined | Set<Effect>} */\n\tvar to_animate;\n\n\t/** @type {Effect[]} */\n\tvar matched = [];\n\n\t/** @type {Effect[]} */\n\tvar stashed = [];\n\n\t/** @type {V} */\n\tvar value;\n\n\t/** @type {any} */\n\tvar key;\n\n\t/** @type {Effect | undefined} */\n\tvar effect;\n\n\t/** @type {number} */\n\tvar i;\n\n\tif (is_animated) {\n\t\tfor (i = 0; i < length; i += 1) {\n\t\t\tvalue = array[i];\n\t\t\tkey = get_key(value, i);\n\t\t\teffect = /** @type {EachItem} */ (items.get(key)).e;\n\n\t\t\t// offscreen == coming in now, no animation in that case,\n\t\t\t// else this would happen https://github.com/sveltejs/svelte/issues/17181\n\t\t\tif ((effect.f & EFFECT_OFFSCREEN) === 0) {\n\t\t\t\teffect.nodes?.a?.measure();\n\t\t\t\t(to_animate ??= new Set()).add(effect);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (i = 0; i < length; i += 1) {\n\t\tvalue = array[i];\n\t\tkey = get_key(value, i);\n\n\t\teffect = /** @type {EachItem} */ (items.get(key)).e;\n\n\t\tif (state.outrogroups !== null) {\n\t\t\tfor (const group of state.outrogroups) {\n\t\t\t\tgroup.pending.delete(effect);\n\t\t\t\tgroup.done.delete(effect);\n\t\t\t}\n\t\t}\n\n\t\tif ((effect.f & INERT) !== 0) {\n\t\t\tresume_effect(effect);\n\t\t\tif (is_animated) {\n\t\t\t\teffect.nodes?.a?.unfix();\n\t\t\t\t(to_animate ??= new Set()).delete(effect);\n\t\t\t}\n\t\t}\n\n\t\tif ((effect.f & EFFECT_OFFSCREEN) !== 0) {\n\t\t\teffect.f ^= EFFECT_OFFSCREEN;\n\n\t\t\tif (effect === current) {\n\t\t\t\tmove(effect, null, anchor);\n\t\t\t} else {\n\t\t\t\tvar next = prev ? prev.next : current;\n\n\t\t\t\tif (effect === state.effect.last) {\n\t\t\t\t\tstate.effect.last = effect.prev;\n\t\t\t\t}\n\n\t\t\t\tif (effect.prev) effect.prev.next = effect.next;\n\t\t\t\tif (effect.next) effect.next.prev = effect.prev;\n\t\t\t\tlink(state, prev, effect);\n\t\t\t\tlink(state, effect, next);\n\n\t\t\t\tmove(effect, next, anchor);\n\t\t\t\tprev = effect;\n\n\t\t\t\tmatched = [];\n\t\t\t\tstashed = [];\n\n\t\t\t\tcurrent = skip_to_branch(prev.next);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tif (effect !== current) {\n\t\t\tif (seen !== undefined && seen.has(effect)) {\n\t\t\t\tif (matched.length < stashed.length) {\n\t\t\t\t\t// more efficient to move later items to the front\n\t\t\t\t\tvar start = stashed[0];\n\t\t\t\t\tvar j;\n\n\t\t\t\t\tprev = start.prev;\n\n\t\t\t\t\tvar a = matched[0];\n\t\t\t\t\tvar b = matched[matched.length - 1];\n\n\t\t\t\t\tfor (j = 0; j < matched.length; j += 1) {\n\t\t\t\t\t\tmove(matched[j], start, anchor);\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (j = 0; j < stashed.length; j += 1) {\n\t\t\t\t\t\tseen.delete(stashed[j]);\n\t\t\t\t\t}\n\n\t\t\t\t\tlink(state, a.prev, b.next);\n\t\t\t\t\tlink(state, prev, a);\n\t\t\t\t\tlink(state, b, start);\n\n\t\t\t\t\tcurrent = start;\n\t\t\t\t\tprev = b;\n\t\t\t\t\ti -= 1;\n\n\t\t\t\t\tmatched = [];\n\t\t\t\t\tstashed = [];\n\t\t\t\t} else {\n\t\t\t\t\t// more efficient to move earlier items to the back\n\t\t\t\t\tseen.delete(effect);\n\t\t\t\t\tmove(effect, current, anchor);\n\n\t\t\t\t\tlink(state, effect.prev, effect.next);\n\t\t\t\t\tlink(state, effect, prev === null ? state.effect.first : prev.next);\n\t\t\t\t\tlink(state, prev, effect);\n\n\t\t\t\t\tprev = effect;\n\t\t\t\t}\n\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tmatched = [];\n\t\t\tstashed = [];\n\n\t\t\twhile (current !== null && current !== effect) {\n\t\t\t\t(seen ??= new Set()).add(current);\n\t\t\t\tstashed.push(current);\n\t\t\t\tcurrent = skip_to_branch(current.next);\n\t\t\t}\n\n\t\t\tif (current === null) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tif ((effect.f & EFFECT_OFFSCREEN) === 0) {\n\t\t\tmatched.push(effect);\n\t\t}\n\n\t\tprev = effect;\n\t\tcurrent = skip_to_branch(effect.next);\n\t}\n\n\tif (state.outrogroups !== null) {\n\t\tfor (const group of state.outrogroups) {\n\t\t\tif (group.pending.size === 0) {\n\t\t\t\tdestroy_effects(state, array_from(group.done));\n\t\t\t\tstate.outrogroups?.delete(group);\n\t\t\t}\n\t\t}\n\n\t\tif (state.outrogroups.size === 0) {\n\t\t\tstate.outrogroups = null;\n\t\t}\n\t}\n\n\tif (current !== null || seen !== undefined) {\n\t\t/** @type {Effect[]} */\n\t\tvar to_destroy = [];\n\n\t\tif (seen !== undefined) {\n\t\t\tfor (effect of seen) {\n\t\t\t\tif ((effect.f & INERT) === 0) {\n\t\t\t\t\tto_destroy.push(effect);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\twhile (current !== null) {\n\t\t\t// If the each block isn't inert, then inert effects are currently outroing and will be removed once the transition is finished\n\t\t\tif ((current.f & INERT) === 0 && current !== state.fallback) {\n\t\t\t\tto_destroy.push(current);\n\t\t\t}\n\n\t\t\tcurrent = skip_to_branch(current.next);\n\t\t}\n\n\t\tvar destroy_length = to_destroy.length;\n\n\t\tif (destroy_length > 0) {\n\t\t\tvar controlled_anchor = (flags & EACH_IS_CONTROLLED) !== 0 && length === 0 ? anchor : null;\n\n\t\t\tif (is_animated) {\n\t\t\t\tfor (i = 0; i < destroy_length; i += 1) {\n\t\t\t\t\tto_destroy[i].nodes?.a?.measure();\n\t\t\t\t}\n\n\t\t\t\tfor (i = 0; i < destroy_length; i += 1) {\n\t\t\t\t\tto_destroy[i].nodes?.a?.fix();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpause_effects(state, to_destroy, controlled_anchor);\n\t\t}\n\t}\n\n\tif (is_animated) {\n\t\tqueue_micro_task(() => {\n\t\t\tif (to_animate === undefined) return;\n\t\t\tfor (effect of to_animate) {\n\t\t\t\teffect.nodes?.a?.apply();\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * @template V\n * @param {Map<any, EachItem>} items\n * @param {Node} anchor\n * @param {V} value\n * @param {unknown} key\n * @param {number} index\n * @param {(anchor: Node, item: MaybeSource<V>, index: MaybeSource<number>, collection: () => V[]) => void} render_fn\n * @param {number} flags\n * @param {() => V[]} get_collection\n * @returns {EachItem}\n */\nfunction create_item(items, anchor, value, key, index, render_fn, flags, get_collection) {\n\tvar v =\n\t\t(flags & EACH_ITEM_REACTIVE) !== 0\n\t\t\t? (flags & EACH_ITEM_IMMUTABLE) === 0\n\t\t\t\t? mutable_source(value, false, false)\n\t\t\t\t: source(value)\n\t\t\t: null;\n\n\tvar i = (flags & EACH_INDEX_REACTIVE) !== 0 ? source(index) : null;\n\n\tif (DEV && v) {\n\t\t// For tracing purposes, we need to link the source signal we create with the\n\t\t// collection + index so that tracing works as intended\n\t\tv.trace = () => {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unused-expressions\n\t\t\tget_collection()[i?.v ?? index];\n\t\t};\n\t}\n\n\treturn {\n\t\tv,\n\t\ti,\n\t\te: branch(() => {\n\t\t\trender_fn(anchor, v ?? value, i ?? index, get_collection);\n\n\t\t\treturn () => {\n\t\t\t\titems.delete(key);\n\t\t\t};\n\t\t})\n\t};\n}\n\n/**\n * @param {Effect} effect\n * @param {Effect | null} next\n * @param {Text | Element | Comment} anchor\n */\nfunction move(effect, next, anchor) {\n\tif (!effect.nodes) return;\n\n\tvar node = effect.nodes.start;\n\tvar end = effect.nodes.end;\n\n\tvar dest =\n\t\tnext && (next.f & EFFECT_OFFSCREEN) === 0\n\t\t\t? /** @type {EffectNodes} */ (next.nodes).start\n\t\t\t: anchor;\n\n\twhile (node !== null) {\n\t\tvar next_node = /** @type {TemplateNode} */ (get_next_sibling(node));\n\t\tinsert_before(dest, node);\n\n\t\tif (node === end) {\n\t\t\treturn;\n\t\t}\n\n\t\tnode = next_node;\n\t}\n}\n\n/**\n * @param {EachState} state\n * @param {Effect | null} prev\n * @param {Effect | null} next\n */\nfunction link(state, prev, next) {\n\tif (prev === null) {\n\t\tstate.effect.first = next;\n\t} else {\n\t\tprev.next = next;\n\t}\n\n\tif (next === null) {\n\t\tstate.effect.last = prev;\n\t} else {\n\t\tnext.prev = prev;\n\t}\n}\n\n/**\n * @param {Array<any>} array\n * @param {(item: any, index: number) => string} key_fn\n * @returns {void}\n */\nfunction validate_each_keys(array, key_fn) {\n\tconst keys = new Map();\n\tconst length = array.length;\n\n\tfor (let i = 0; i < length; i++) {\n\t\tconst key = key_fn(array[i], i);\n\n\t\tif (keys.has(key)) {\n\t\t\tconst a = String(keys.get(key));\n\t\t\tconst b = String(i);\n\n\t\t\t/** @type {string | null} */\n\t\t\tlet k = String(key);\n\t\t\tif (k.startsWith('[object ')) k = null;\n\n\t\t\te.each_key_duplicate(a, b, k);\n\t\t}\n\n\t\tkeys.set(key, i);\n\t}\n}\n","/** @import { DevStackEntry, Effect, TemplateNode } from '#client' */\n/** @import {} from 'trusted-types' */\nimport {\n\tFILENAME,\n\tHYDRATION_ERROR,\n\tNAMESPACE_SVG,\n\tNAMESPACE_MATHML\n} from '../../../../constants.js';\nimport { remove_effect_dom, template_effect } from '../../reactivity/effects.js';\nimport { hydrate_next, hydrate_node, hydrating, set_hydrate_node } from '../hydration.js';\n\nimport { assign_nodes } from '../template.js';\nimport * as w from '../../warnings.js';\nimport { hash, sanitize_location } from '../../../../utils.js';\nimport { DEV } from 'esm-env';\nimport { dev_current_component_function, dev_stack } from '../../context.js';\nimport {\n\tcreate_element,\n\tget_first_child,\n\tget_next_sibling,\n\tget_last_child,\n\tset_inner_html,\n\tinsert_before,\n\tnode_type,\n\tget_node_value\n} from '../operations.js';\nimport { active_effect } from '../../runtime.js';\nimport { COMMENT_NODE, ELEMENT_NODE } from '#client/constants';\nimport { set_dev_metadata } from '../../dev/elements.js';\n\n/**\n * @param {string | null} server_hash\n * @param {string | TrustedHTML} value\n * @param {[string, number, number] | undefined} loc\n */\nfunction check_hash(server_hash, value, loc) {\n\tif (!server_hash || server_hash === hash(String(value ?? ''))) return;\n\n\tlet location;\n\n\tif (loc) {\n\t\tlocation = `near ${loc[0]}:${loc[1]}:${loc[2]}`;\n\t} else if (dev_current_component_function?.[FILENAME]) {\n\t\tlocation = `in ${dev_current_component_function[FILENAME]}`;\n\t}\n\n\tw.hydration_html_changed(sanitize_location(location));\n}\n\n/**\n * Assigns the location of the `{@html ...}` tag to the top-level elements it created,\n * which also prevents the surrounding template from assigning its locations to them\n * @param {Effect} effect\n * @param {DevStackEntry | null} parent\n * @param {[string, number, number]} loc\n */\nfunction assign_locations(effect, parent, loc) {\n\tif (effect.nodes === null) return;\n\n\t/** @type {TemplateNode | null} */\n\tvar node = effect.nodes.start;\n\n\twhile (node !== null) {\n\t\tif (node.nodeType === ELEMENT_NODE) {\n\t\t\tset_dev_metadata(\n\t\t\t\t/** @type {Element} */ (node),\n\t\t\t\t{ file: loc[0], line: loc[1], column: loc[2] },\n\t\t\t\tparent\n\t\t\t);\n\t\t}\n\n\t\tif (node === effect.nodes.end) break;\n\t\tnode = get_next_sibling(node);\n\t}\n}\n\n/**\n * @param {Element | Text | Comment} node\n * @param {() => string | TrustedHTML} get_value\n * @param {boolean} [is_controlled]\n * @param {boolean} [svg]\n * @param {boolean} [mathml]\n * @param {boolean} [skip_warning]\n * @param {[string, number, number]} [location] the filename, line and column of the tag\n * @returns {void}\n */\nexport function html(\n\tnode,\n\tget_value,\n\tis_controlled = false,\n\tsvg = false,\n\tmathml = false,\n\tskip_warning = false,\n\tlocation\n) {\n\tvar anchor = node;\n\tvar parent = DEV ? dev_stack : null;\n\n\t/** @type {string | TrustedHTML} */\n\tvar value = '';\n\n\tif (is_controlled) {\n\t\tvar parent_node = /** @type {Element} */ (node);\n\n\t\tif (hydrating) {\n\t\t\tanchor = set_hydrate_node(get_first_child(parent_node));\n\t\t}\n\t}\n\n\ttemplate_effect(() => {\n\t\tvar effect = /** @type {Effect} */ (active_effect);\n\n\t\tif (value === (value = get_value() ?? '')) {\n\t\t\tif (hydrating) hydrate_next();\n\t\t\treturn;\n\t\t}\n\n\t\tif (is_controlled && !hydrating) {\n\t\t\t// When @html is the only child, use innerHTML directly.\n\t\t\t// This also handles contenteditable, where the user may delete the anchor comment.\n\t\t\teffect.nodes = null;\n\t\t\tset_inner_html(parent_node, /** @type {string} */ (value));\n\n\t\t\tif (value !== '') {\n\t\t\t\tassign_nodes(\n\t\t\t\t\t/** @type {TemplateNode} */ (get_first_child(parent_node)),\n\t\t\t\t\t/** @type {TemplateNode} */ (get_last_child(parent_node))\n\t\t\t\t);\n\n\t\t\t\tif (DEV && location) assign_locations(effect, parent, location);\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (effect.nodes !== null) {\n\t\t\tremove_effect_dom(effect.nodes.start, /** @type {TemplateNode} */ (effect.nodes.end));\n\t\t\teffect.nodes = null;\n\t\t}\n\n\t\tif (value === '') return;\n\n\t\tif (hydrating) {\n\t\t\t// We're deliberately not trying to repair mismatches between server and client,\n\t\t\t// as it's costly and error-prone (and it's an edge case to have a mismatch anyway)\n\t\t\tvar hash = get_node_value(hydrate_node);\n\n\t\t\t/** @type {TemplateNode | null} */\n\t\t\tvar next = hydrate_next();\n\t\t\tvar last = next;\n\n\t\t\twhile (next !== null && (node_type(next) !== COMMENT_NODE || get_node_value(next) !== '')) {\n\t\t\t\tlast = next;\n\t\t\t\tnext = get_next_sibling(next);\n\t\t\t}\n\n\t\t\tif (next === null) {\n\t\t\t\tw.hydration_mismatch();\n\t\t\t\tthrow HYDRATION_ERROR;\n\t\t\t}\n\n\t\t\tif (DEV && !skip_warning) {\n\t\t\t\tcheck_hash(hash, value, location);\n\t\t\t}\n\n\t\t\tassign_nodes(hydrate_node, last);\n\t\t\tif (DEV && location) assign_locations(effect, parent, location);\n\t\t\tanchor = set_hydrate_node(next);\n\t\t\treturn;\n\t\t}\n\n\t\t// Don't use create_fragment_with_script_from_html here because that would mean script tags are executed.\n\t\t// @html is basically `.innerHTML = ...` and that doesn't execute scripts either due to security reasons.\n\t\t// Use a <template>, <svg>, or <math> wrapper depending on context. If value is a TrustedHTML object,\n\t\t// it will be assigned directly to innerHTML without coercion — this allows {@html policy.createHTML(...)} to work.\n\t\tvar ns = svg ? NAMESPACE_SVG : mathml ? NAMESPACE_MATHML : undefined;\n\t\tvar wrapper = /** @type {HTMLTemplateElement | SVGElement | MathMLElement} */ (\n\t\t\tcreate_element(svg ? 'svg' : mathml ? 'math' : 'template', ns)\n\t\t);\n\t\tset_inner_html(wrapper, /** @type {any} */ (value));\n\n\t\t/** @type {DocumentFragment | Element} */\n\t\tvar node = svg || mathml ? wrapper : /** @type {HTMLTemplateElement} */ (wrapper).content;\n\n\t\tassign_nodes(\n\t\t\t/** @type {TemplateNode} */ (get_first_child(node)),\n\t\t\t/** @type {TemplateNode} */ (get_last_child(node))\n\t\t);\n\n\t\tif (DEV && location) assign_locations(effect, parent, location);\n\n\t\tif (svg || mathml) {\n\t\t\twhile (get_first_child(node)) {\n\t\t\t\tinsert_before(anchor, /** @type {TemplateNode} */ (get_first_child(node)));\n\t\t\t}\n\t\t} else {\n\t\t\tinsert_before(anchor, node);\n\t\t}\n\t});\n}\n","/** @import { Renderer } from '../../custom-renderer/types.js' */\n/** @import { Snippet } from 'svelte' */\n/** @import { TemplateNode } from '#client' */\n/** @import { Getters } from '#shared' */\nimport { EFFECT_TRANSPARENT, ELEMENT_NODE } from '#client/constants';\nimport { block, teardown } from '../../reactivity/effects.js';\nimport {\n\tdev_current_component_function,\n\tdev_stack,\n\tset_dev_current_component_function\n} from '../../context.js';\nimport { hydrate_next, hydrate_node, hydrating } from '../hydration.js';\nimport { create_fragment_from_html } from '../reconciler.js';\nimport { assign_nodes } from '../template.js';\nimport * as w from '../../warnings.js';\nimport * as e from '../../errors.js';\nimport { DEV } from 'esm-env';\nimport { get_first_child, get_next_sibling, insert_before, node_type } from '../operations.js';\nimport { prevent_snippet_stringification } from '../../../shared/validate.js';\nimport { BranchManager } from './branches.js';\nimport { set_dev_metadata } from '../../dev/elements.js';\nimport { current_renderer } from '../../custom-renderer/state.js';\nimport { cross, is_crossing } from '../../custom-renderer/cross.js';\nimport { has_own_property } from '../../../shared/utils.js';\n\n/**\n * @template {(node: TemplateNode, ...args: any[]) => void} SnippetFn\n * @param {TemplateNode} node\n * @param {() => SnippetFn | null | undefined} get_snippet\n * @param {(() => any)[]} args\n * @returns {void}\n */\nexport function snippet(node, get_snippet, ...args) {\n\tvar branches = new BranchManager(node);\n\n\tblock(() => {\n\t\tconst snippet = get_snippet() ?? null;\n\n\t\tif (DEV && snippet == null) {\n\t\t\te.invalid_snippet();\n\t\t}\n\n\t\tbranches.ensure(snippet, snippet && ((anchor) => snippet(anchor, ...args)));\n\t}, EFFECT_TRANSPARENT);\n}\n\n/**\n * In development, wrap the snippet function so that it passes validation, and so that the\n * correct component context is set for ownership checks\n * @param {any} component\n * @param {(node: TemplateNode, ...args: any[]) => void} fn\n */\nexport function wrap_snippet(component, fn) {\n\tconst snippet = (/** @type {TemplateNode} */ node, /** @type {any[]} */ ...args) => {\n\t\tvar previous_component_function = dev_current_component_function;\n\t\tset_dev_current_component_function(component);\n\n\t\ttry {\n\t\t\treturn fn(node, ...args);\n\t\t} finally {\n\t\t\tset_dev_current_component_function(previous_component_function);\n\t\t}\n\t};\n\n\tprevent_snippet_stringification(snippet);\n\n\treturn snippet;\n}\n\n/**\n * Wraps a snippet function so that it remembers which renderer it was compiled for\n * (`null` for DOM). If it is rendered by a different renderer, the snippet content\n * is rendered across a renderer boundary (see `cross`).\n * @template {(...args: any[]) => any} T\n * @param {Renderer | null} renderer\n * @param {T} fn\n * @returns {T}\n */\nexport function renderer_snippet(renderer, fn) {\n\tvar wrapped = /** @type {T} */ (\n\t\t(/** @type {TemplateNode} */ anchor, /** @type {any[]} */ ...args) => {\n\t\t\tif (is_crossing(renderer)) {\n\t\t\t\treturn cross(renderer, anchor, (anchor) => fn(anchor, ...args));\n\t\t\t}\n\n\t\t\treturn fn(anchor, ...args);\n\t\t}\n\t);\n\n\t/** @type {any} */ (wrapped).__renderer = renderer;\n\n\treturn wrapped;\n}\n\n/**\n * Validates that a snippet can be rendered by a custom renderer. Snippets compiled with\n * custom renderer support know which renderer they belong to and can cross renderer\n * boundaries; anything else (e.g. snippets from components compiled without the\n * `experimental.customRenderer` option) can only be rendered by the DOM.\n * @template {((...args: any[]) => void) | null | undefined} T\n * @param {T} fn\n * @returns {T}\n */\nexport function validate_snippet_renderer(fn) {\n\tif (fn != null && !has_own_property.call(fn, '__renderer')) {\n\t\te.snippet_renderer_mismatch();\n\t}\n\n\treturn fn;\n}\n\n/**\n * Create a snippet programmatically\n * @template {unknown[]} Params\n * @param {(...params: Getters<Params>) => {\n * render: () => string\n * setup?: (element: Element) => void | (() => void)\n * }} fn\n * @returns {Snippet<Params>}\n */\nexport function createRawSnippet(fn) {\n\t// @ts-expect-error the types are a lie\n\treturn (/** @type {TemplateNode} */ anchor, /** @type {Getters<Params>} */ ...params) => {\n\t\tif (current_renderer != null) {\n\t\t\te.invalid_snippet_in_custom_renderer();\n\t\t}\n\t\tvar snippet = fn(...params);\n\n\t\t/** @type {Element} */\n\t\tvar element;\n\n\t\tif (hydrating) {\n\t\t\telement = /** @type {Element} */ (hydrate_node);\n\t\t\thydrate_next();\n\t\t} else {\n\t\t\tvar html = snippet.render().trim();\n\t\t\tvar fragment = create_fragment_from_html(html);\n\t\t\telement = /** @type {Element} */ (get_first_child(fragment));\n\n\t\t\tif (DEV && (get_next_sibling(element) !== null || node_type(element) !== ELEMENT_NODE)) {\n\t\t\t\tw.invalid_raw_snippet_render();\n\t\t\t}\n\n\t\t\tinsert_before(anchor, element);\n\t\t}\n\n\t\tif (DEV && dev_stack !== null) {\n\t\t\t// Raw snippets have no template locations, so use the render callsite.\n\t\t\t// This also keeps the surrounding template from claiming their root.\n\t\t\tset_dev_metadata(element, {\n\t\t\t\tfile: dev_stack.file,\n\t\t\t\tline: dev_stack.line,\n\t\t\t\tcolumn: dev_stack.column\n\t\t\t});\n\t\t}\n\n\t\tconst result = snippet.setup?.(element);\n\t\tassign_nodes(element, element);\n\n\t\tif (typeof result === 'function') {\n\t\t\tteardown(result);\n\t\t}\n\t};\n}\n","/** @import { TemplateNode, Dom } from '#client' */\nimport { EFFECT_TRANSPARENT } from '#client/constants';\nimport { block } from '../../reactivity/effects.js';\nimport {\n\thydrate_next,\n\thydrate_node,\n\thydrating,\n\tread_hydration_instruction,\n\tset_hydrate_node,\n\tset_hydrating,\n\tskip_nodes\n} from '../hydration.js';\nimport { BranchManager } from './branches.js';\nimport { HYDRATION_START } from '../../../../constants.js';\n\n/**\n * @template P\n * @template {(props: P) => void} C\n * @param {TemplateNode} node\n * @param {() => C} get_component\n * @param {(anchor: TemplateNode, component: C) => Dom | void} render_fn\n * @returns {void}\n */\nexport function component(node, get_component, render_fn) {\n\t/** @type {TemplateNode | undefined} */\n\tvar hydration_start_node;\n\n\tif (hydrating) {\n\t\thydration_start_node = hydrate_node;\n\t\thydrate_next();\n\t}\n\n\tvar branches = new BranchManager(node);\n\n\tblock(() => {\n\t\tvar component = get_component() ?? null;\n\n\t\tif (hydrating) {\n\t\t\tvar data = read_hydration_instruction(/** @type {TemplateNode} */ (hydration_start_node));\n\n\t\t\tvar server_had_component = data === HYDRATION_START;\n\t\t\tvar client_has_component = component !== null;\n\n\t\t\tif (server_had_component !== client_has_component) {\n\t\t\t\t// Hydration mismatch: skip the server-rendered nodes and render fresh\n\t\t\t\tvar anchor = skip_nodes();\n\n\t\t\t\tset_hydrate_node(anchor);\n\t\t\t\tbranches.anchor = anchor;\n\n\t\t\t\tset_hydrating(false);\n\t\t\t\tbranches.ensure(component, component && ((target) => render_fn(target, component)));\n\t\t\t\tset_hydrating(true);\n\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tbranches.ensure(component, component && ((target) => render_fn(target, component)));\n\t}, EFFECT_TRANSPARENT);\n}\n","/** @import { Effect } from '#client' */\nimport { branch, effect, destroy_effect, managed } from '../../reactivity/effects.js';\n\n// TODO in 6.0 or 7.0, when we remove legacy mode, we can simplify this by\n// getting rid of the block/branch stuff and just letting the effect rip.\n// see https://github.com/sveltejs/svelte/pull/15962\n\n/**\n * @param {Element} node\n * @param {() => (node: Element) => void} get_fn\n */\nexport function attach(node, get_fn) {\n\t/** @type {false | undefined | ((node: Element) => void)} */\n\tvar fn = undefined;\n\n\t/** @type {Effect | null} */\n\tvar e;\n\n\tmanaged(() => {\n\t\tif (fn !== (fn = get_fn())) {\n\t\t\tif (e) {\n\t\t\t\tdestroy_effect(e);\n\t\t\t\te = null;\n\t\t\t}\n\n\t\t\tif (fn) {\n\t\t\t\te = branch(() => {\n\t\t\t\t\teffect(() => /** @type {(node: Element) => void} */ (fn)(node));\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t});\n}\n","import { to_class } from '../../../shared/attributes.js';\nimport { custom_renderers_flag } from '../../../flags/index.js';\nimport { current_renderer } from '../../custom-renderer/state.js';\nimport { CLASS_CACHE } from '../../constants.js';\nimport { hydrating } from '../hydration.js';\nimport {\n\tclass_list_toggle,\n\tget_attribute,\n\tremove_attribute,\n\tset_attribute\n} from '../operations.js';\n\n/**\n * @param {Element} dom\n * @param {boolean | number} is_html\n * @param {string | null} value\n * @param {string} [hash]\n * @param {Record<string, any>} [prev_classes]\n * @param {Record<string, any>} [next_classes]\n * @returns {Record<string, boolean> | undefined}\n */\nexport function set_class(dom, is_html, value, hash, prev_classes, next_classes) {\n\tvar prev = /** @type {any} */ (dom)[CLASS_CACHE];\n\n\tif (\n\t\thydrating ||\n\t\tprev !== value ||\n\t\tprev === undefined || // for edge case of `class={undefined}`\n\t\t// custom renderers only deal in attributes, so rather than toggling individual classes\n\t\t// (which would mean editing the `class` attribute), always set the whole thing\n\t\t(custom_renderers_flag && current_renderer !== null)\n\t) {\n\t\tvar next_class_name = to_class(value, hash, next_classes);\n\n\t\tif (!hydrating || next_class_name !== get_attribute(dom, 'class')) {\n\t\t\t// Removing the attribute when the value is only an empty string causes\n\t\t\t// performance issues vs simply making the className an empty string. So\n\t\t\t// we should only remove the class if the value is nullish\n\t\t\t// and there no hash/directives :\n\t\t\tif (next_class_name == null) {\n\t\t\t\tremove_attribute(dom, 'class');\n\t\t\t} else if (is_html) {\n\t\t\t\tdom.className = next_class_name;\n\t\t\t} else {\n\t\t\t\tset_attribute(dom, 'class', next_class_name);\n\t\t\t}\n\t\t}\n\n\t\t/** @type {any} */ (dom)[CLASS_CACHE] = value;\n\t} else if (next_classes && prev_classes !== next_classes) {\n\t\tfor (var key in next_classes) {\n\t\t\tvar is_present = !!next_classes[key];\n\n\t\t\tif (prev_classes == null || is_present !== !!prev_classes[key]) {\n\t\t\t\tclass_list_toggle(/** @type {HTMLElement} */ (dom), key, is_present);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn next_classes;\n}\n","import { to_style } from '../../../shared/attributes.js';\nimport { custom_renderers_flag } from '../../../flags/index.js';\nimport { current_renderer } from '../../custom-renderer/state.js';\nimport { STYLE_CACHE } from '../../constants.js';\nimport { hydrating } from '../hydration.js';\nimport {\n\tstyle_remove_property,\n\tstyle_set_property,\n\tget_attribute,\n\tremove_attribute,\n\tset_css_text\n} from '../operations.js';\n\n/**\n * @param {Element & ElementCSSInlineStyle} dom\n * @param {Record<string, any>} prev\n * @param {Record<string, any>} next\n * @param {string} [priority]\n */\nfunction update_styles(dom, prev = {}, next, priority) {\n\tfor (var key in next) {\n\t\tvar value = next[key];\n\n\t\tif (prev[key] !== value) {\n\t\t\tif (next[key] == null) {\n\t\t\t\tstyle_remove_property(/** @type {HTMLElement} */ (dom), key);\n\t\t\t} else {\n\t\t\t\tstyle_set_property(/** @type {HTMLElement} */ (dom), key, value, priority);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * @param {Element & ElementCSSInlineStyle} dom\n * @param {string | null} value\n * @param {Record<string, any> | [Record<string, any>, Record<string, any>]} [prev_styles]\n * @param {Record<string, any> | [Record<string, any>, Record<string, any>]} [next_styles]\n */\nexport function set_style(dom, value, prev_styles, next_styles) {\n\tvar prev = /** @type {any} */ (dom)[STYLE_CACHE];\n\n\t// Custom renderers only deal in attributes, so rather than updating individual properties\n\t// (which would mean parsing and editing the `style` attribute), always set the whole thing\n\tif (hydrating || prev !== value || (custom_renderers_flag && current_renderer !== null)) {\n\t\tvar next_style_attr = to_style(value, next_styles);\n\n\t\tif (!hydrating || next_style_attr !== get_attribute(dom, 'style')) {\n\t\t\tif (next_style_attr == null) {\n\t\t\t\tremove_attribute(dom, 'style');\n\t\t\t} else {\n\t\t\t\tset_css_text(/** @type {HTMLElement} */ (dom), next_style_attr);\n\t\t\t}\n\t\t}\n\n\t\t/** @type {any} */ (dom)[STYLE_CACHE] = value;\n\t} else if (next_styles) {\n\t\tif (Array.isArray(next_styles)) {\n\t\t\tupdate_styles(dom, prev_styles?.[0], next_styles[0]);\n\t\t\tupdate_styles(dom, prev_styles?.[1], next_styles[1], 'important');\n\t\t} else {\n\t\t\tupdate_styles(dom, prev_styles, next_styles);\n\t\t}\n\t}\n\n\treturn next_styles;\n}\n","/** @import { Batch } from '../../../reactivity/batch.js' */\nimport { effect, teardown } from '../../../reactivity/effects.js';\nimport { listen_to_event_and_reset_event } from './shared.js';\nimport { is } from '../../../proxy.js';\nimport { is_array } from '../../../../shared/utils.js';\nimport * as w from '../../../warnings.js';\nimport { current_batch, view_batch } from '../../../reactivity/batch.js';\nimport {\n\thas_attribute,\n\tremove_attribute,\n\tset_attribute as set_attribute_op\n} from '../../operations.js';\n\n/**\n * Sets the `selected` attribute on an option so form reset can restore it.\n * @param {HTMLOptionElement} option\n * @param {boolean} selected\n */\nexport function set_selected(option, selected) {\n\tif (selected) {\n\t\t// The selected option could've changed via user selection, and\n\t\t// setting the value without this check would set it back.\n\t\tif (!has_attribute(option, 'selected')) {\n\t\t\tset_attribute_op(option, 'selected', '');\n\t\t}\n\t} else {\n\t\tremove_attribute(option, 'selected');\n\t}\n}\n\n/**\n * Sets the options a form reset should restore. The first call selects\n * them if nothing has set a value, later calls leave the current selection alone.\n * @param {HTMLSelectElement} select\n * @param {any} value\n */\nexport function set_default_select_value(select, value) {\n\tvar mounting = !('__defaultValue' in select);\n\t// @ts-expect-error\n\tif (!mounting && select.__defaultValue === value) return;\n\t// @ts-expect-error\n\tselect.__defaultValue = value;\n\tapply_default_select_value(select, !mounting || '__value' in select);\n}\n\n/**\n * Marks the options matching `__defaultValue` as selected. Without `preserve`\n * a newly matching option gets selected, as an inserted `<option selected>` would.\n * @param {HTMLSelectElement} select\n * @param {boolean} preserve\n */\nfunction apply_default_select_value(select, preserve) {\n\t// @ts-expect-error\n\tvar value = select.__defaultValue;\n\tvar multiple = select.multiple;\n\tvar values = multiple ? (value ?? []) : null;\n\n\tif (multiple && !is_array(values)) return;\n\n\tvar index = select.selectedIndex;\n\tvar selected = preserve && multiple ? new Set(select.selectedOptions) : null;\n\n\tfor (var option of select.options) {\n\t\tvar option_value = get_option_value(option);\n\t\tset_selected(\n\t\t\toption,\n\t\t\tmultiple ? /** @type {any[]} */ (values).includes(option_value) : is(option_value, value)\n\t\t);\n\t}\n\n\tif (!preserve) return;\n\n\tif (selected !== null) {\n\t\tfor (option of select.options) {\n\t\t\tvar was_selected = selected.has(option);\n\t\t\tif (option.selected !== was_selected) option.selected = was_selected;\n\t\t}\n\t} else if (select.selectedIndex !== index) {\n\t\tselect.selectedIndex = index;\n\t}\n}\n\n/**\n * Selects the correct option(s) (depending on whether this is a multiple select)\n * @template V\n * @param {HTMLSelectElement} select\n * @param {V} value\n * @param {boolean} mounting\n */\nexport function select_option(select, value, mounting = false) {\n\tif (select.multiple) {\n\t\t// If value is null or undefined, keep the selection as is\n\t\tif (value == undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\t// If not an array, warn and keep the selection as is\n\t\tif (!is_array(value)) {\n\t\t\treturn w.select_multiple_invalid_value();\n\t\t}\n\n\t\t// Otherwise, update the selection\n\t\tfor (var option of select.options) {\n\t\t\toption.selected = value.includes(get_option_value(option));\n\t\t}\n\n\t\treturn;\n\t}\n\n\tfor (option of select.options) {\n\t\tvar option_value = get_option_value(option);\n\t\tif (is(option_value, value)) {\n\t\t\toption.selected = true;\n\t\t\treturn;\n\t\t}\n\t}\n\n\tif (!mounting || value !== undefined) {\n\t\tselect.selectedIndex = -1; // no option should be selected\n\t}\n}\n\n/**\n * Sets up a mutation observer to sync the current selection\n * and default to the dom when the options change, for example\n * when they are inside an `#each` block. Called once per `<select>`,\n * by the compiled output or by `attribute_effect` for spreads.\n * @param {HTMLSelectElement} select\n */\nexport function init_select(select) {\n\tvar observer = new MutationObserver((entries) => {\n\t\t// Mutations related to `<selectedcontent>` can never affect the option list.\n\t\t// Reacting to them could revert a user-initiated selection change, because the\n\t\t// records are delivered as soon as any listener returns (e.g. a delegated `input`\n\t\t// handler), which can happen before the `change` handler has updated `__value`\n\t\tif (entries.every(is_selectedcontent_mutation)) return;\n\n\t\tif ('__defaultValue' in select) {\n\t\t\tapply_default_select_value(select, false);\n\t\t}\n\n\t\tif ('__value' in select) {\n\t\t\tselect_option(select, select.__value);\n\t\t}\n\t\t// Deliberately don't update the potential binding value,\n\t\t// the model should be preserved unless explicitly changed\n\t});\n\n\tobserver.observe(select, {\n\t\t// Listen to option element changes\n\t\tchildList: true,\n\t\tsubtree: true, // because of <optgroup>\n\t\t// Listen to option element value attribute changes\n\t\t// (doesn't get notified of select value changes,\n\t\t// because that property is not reflected as an attribute)\n\t\tattributes: true,\n\t\tattributeFilter: ['value']\n\t});\n\n\tteardown(() => {\n\t\tobserver.disconnect();\n\t});\n}\n\n/**\n * @param {HTMLSelectElement} select\n * @param {() => unknown} get\n * @param {(value: unknown) => void} set\n * @returns {void}\n */\nexport function bind_select_value(select, get, set = get) {\n\tvar batches = new WeakSet();\n\tvar mounting = true;\n\n\tlisten_to_event_and_reset_event(select, 'change', (is_reset) => {\n\t\tvar query = is_reset ? '[selected]' : ':checked';\n\t\t/** @type {unknown} */\n\t\tvar value;\n\n\t\tif (select.multiple) {\n\t\t\tvalue = [].map.call(select.querySelectorAll(query), get_option_value);\n\t\t} else {\n\t\t\t/** @type {HTMLOptionElement | null} */\n\t\t\tvar selected_option =\n\t\t\t\tselect.querySelector(query) ??\n\t\t\t\t// will fall back to first non-disabled option if no option is selected\n\t\t\t\tselect.querySelector('option:not([disabled])');\n\t\t\tvalue = selected_option && get_option_value(selected_option);\n\t\t}\n\n\t\tset(value);\n\n\t\t// @ts-ignore\n\t\tselect.__value = value;\n\n\t\tif (current_batch !== null) {\n\t\t\tbatches.add(current_batch);\n\t\t}\n\t});\n\n\t// Needs to be an effect, not a render_effect, so that in case of each loops the logic runs after the each block has updated\n\teffect(() => {\n\t\tvar value = get();\n\n\t\tif (select === document.activeElement) {\n\t\t\t// Don't update the <select> if it is focused. We can get here if, for example,\n\t\t\t// an update is deferred because of async work depending on the select:\n\t\t\t//\n\t\t\t// <select bind:value={selected}>...</select>\n\t\t\t// <p>{await find(selected)}</p>\n\t\t\tif (batches.has(/** @type {Batch} */ (view_batch))) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tselect_option(select, value, mounting);\n\n\t\t// Mounting and value undefined -> take selection from dom\n\t\tif (mounting && value === undefined) {\n\t\t\t/** @type {HTMLOptionElement | null} */\n\t\t\tvar selected_option = select.querySelector(':checked');\n\t\t\tif (selected_option !== null) {\n\t\t\t\tvalue = get_option_value(selected_option);\n\t\t\t\tset(value);\n\t\t\t}\n\t\t}\n\n\t\t// @ts-ignore\n\t\tselect.__value = value;\n\t\tmounting = false;\n\t});\n}\n\n/** @param {HTMLOptionElement} option */\nfunction get_option_value(option) {\n\t// __value only exists if the <option> has a value attribute\n\tif ('__value' in option) {\n\t\treturn option.__value;\n\t} else {\n\t\treturn option.value;\n\t}\n}\n\n/**\n * Returns `true` if the mutation stems from the browser mirroring the selected\n * option's content into `<selectedcontent>`, or from us replacing the\n * `<selectedcontent>` element with a clone of itself\n * @param {MutationRecord} entry\n */\nfunction is_selectedcontent_mutation(entry) {\n\tif (/** @type {Element} */ (entry.target).closest('selectedcontent') !== null) {\n\t\treturn true;\n\t}\n\n\tif (entry.type === 'childList') {\n\t\tvar nodes = [...entry.addedNodes, ...entry.removedNodes];\n\t\treturn nodes.length > 0 && nodes.every((node) => node.nodeName === 'SELECTEDCONTENT');\n\t}\n\n\treturn false;\n}\n","/** @import { Effect } from '#client' */\n/** @import { Blocker } from '../../reactivity/async.js' */\nimport { DEV } from 'esm-env';\nimport { hydrating, set_hydrating } from '../hydration.js';\nimport { get_descriptors, get_prototype_of } from '../../../shared/utils.js';\nimport { create_event, delegate, delegated } from './events.js';\nimport { add_form_reset_listener, autofocus } from './misc.js';\nimport * as w from '../../warnings.js';\nimport {\n\tATTRIBUTES_CACHE,\n\tFORM_RESET_HANDLER,\n\tIS_XHTML,\n\tLOADING_ATTR_SYMBOL\n} from '#client/constants';\nimport { queue_micro_task } from '../task.js';\nimport { is_capture_event, can_delegate_event, normalize_attribute } from '../../../../utils.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tget,\n\tset_active_effect,\n\tset_active_reaction\n} from '../../runtime.js';\nimport { attach } from './attachments.js';\nimport { clsx } from '../../../shared/attributes.js';\nimport { set_class } from './class.js';\nimport { set_style } from './style.js';\nimport { ATTACHMENT_KEY, NAMESPACE_HTML, UNINITIALIZED } from '../../../../constants.js';\nimport { branch, destroy_effect, effect, managed } from '../../reactivity/effects.js';\nimport {\n\tinit_select,\n\tselect_option,\n\tset_default_select_value,\n\tset_selected\n} from './bindings/select.js';\nimport { flatten } from '../../reactivity/async.js';\nimport {\n\thas_attribute,\n\tget_attribute,\n\tremove_attribute,\n\tset_attribute as set_attribute_op,\n\tremove_event_listener,\n\tnode_name,\n\tset_element_value,\n\tset_element_checked,\n\tset_element_default_value,\n\tset_element_default_checked\n} from '../operations.js';\nimport { current_renderer } from '../../custom-renderer/state.js';\n\nexport const CLASS = Symbol('class');\nexport const STYLE = Symbol('style');\n\nconst IS_CUSTOM_ELEMENT = Symbol('is custom element');\nconst IS_HTML = Symbol('is html');\n\nconst LINK_TAG = IS_XHTML ? 'link' : 'LINK';\nconst INPUT_TAG = IS_XHTML ? 'input' : 'INPUT';\nconst OPTION_TAG = IS_XHTML ? 'option' : 'OPTION';\nconst SELECT_TAG = IS_XHTML ? 'select' : 'SELECT';\nconst PROGRESS_TAG = IS_XHTML ? 'progress' : 'PROGRESS';\n\n/**\n * The value/checked attribute in the template actually corresponds to the defaultValue property, so we need\n * to remove it upon hydration to avoid a bug when someone resets the form value.\n * @param {HTMLInputElement} input\n * @returns {void}\n */\nexport function remove_input_defaults(input) {\n\tif (!hydrating) return;\n\n\t// we should be safe here from custom renderers as this only run during hydration\n\n\tvar already_removed = false;\n\n\t// We try and remove the default attributes later, rather than sync during hydration.\n\t// Doing it sync during hydration has a negative impact on performance, but deferring the\n\t// work in an idle task alleviates this greatly. If a form reset event comes in before\n\t// the idle callback, then we ensure the input defaults are cleared just before.\n\tvar remove_defaults = () => {\n\t\tif (already_removed) return;\n\t\talready_removed = true;\n\n\t\t// Remove the attributes but preserve the values\n\t\tif (has_attribute(input, 'value')) {\n\t\t\tvar value = input.value;\n\t\t\tset_attribute(input, 'value', null);\n\t\t\tinput.value = value;\n\t\t}\n\n\t\tif (has_attribute(input, 'checked')) {\n\t\t\tvar checked = input.checked;\n\t\t\tset_attribute(input, 'checked', null);\n\t\t\tinput.checked = checked;\n\t\t}\n\t};\n\n\t/** @type {any} */ (input)[FORM_RESET_HANDLER] = remove_defaults;\n\tqueue_micro_task(remove_defaults);\n\tadd_form_reset_listener();\n}\n\n/**\n * @param {Element} element\n * @param {any} value\n */\nexport function set_value(element, value) {\n\tvar attributes = get_attributes(element);\n\n\tif (\n\t\tattributes.value ===\n\t\t\t(attributes.value =\n\t\t\t\t// treat null and undefined the same for the initial value\n\t\t\t\tvalue ?? undefined) ||\n\t\t// `progress` elements always need their value set when it's `0`\n\t\t(current_renderer == null &&\n\t\t\t/** @type {any} */ (element).value === value &&\n\t\t\t(value !== 0 || node_name(element) !== PROGRESS_TAG))\n\t) {\n\t\treturn;\n\t}\n\n\tset_element_value(element, value);\n}\n\n/**\n * @param {Element} element\n * @param {boolean} checked\n */\nexport function set_checked(element, checked) {\n\tvar attributes = get_attributes(element);\n\n\tif (\n\t\tattributes.checked ===\n\t\t(attributes.checked =\n\t\t\t// treat null and undefined the same for the initial value\n\t\t\tchecked ?? undefined)\n\t) {\n\t\treturn;\n\t}\n\n\tset_element_checked(element, checked);\n}\n\n/**\n * Applies the default checked property without influencing the current checked property.\n * @param {HTMLInputElement} element\n * @param {boolean} checked\n */\nexport function set_default_checked(element, checked) {\n\tset_element_default_checked(element, checked);\n}\n\n/**\n * Applies the default value property without influencing the current value property.\n * @param {HTMLInputElement | HTMLTextAreaElement} element\n * @param {string} value\n */\nexport function set_default_value(element, value) {\n\tset_element_default_value(element, value);\n}\n\n/**\n * @param {Element} element\n * @param {string} attribute\n * @param {string | null} value\n * @param {boolean} [skip_warning]\n */\nexport function set_attribute(element, attribute, value, skip_warning) {\n\tvar attributes = get_attributes(element);\n\n\tif (hydrating) {\n\t\tattributes[attribute] = get_attribute(element, attribute);\n\n\t\tif (\n\t\t\tattribute === 'src' ||\n\t\t\tattribute === 'srcset' ||\n\t\t\t(attribute === 'href' && node_name(element) === LINK_TAG)\n\t\t) {\n\t\t\tif (!skip_warning) {\n\t\t\t\tcheck_src_in_dev_hydration(element, attribute, value ?? '');\n\t\t\t}\n\n\t\t\t// If we reset these attributes, they would result in another network request, which we want to avoid.\n\t\t\t// We assume they are the same between client and server as checking if they are equal is expensive\n\t\t\t// (we can't just compare the strings as they can be different between client and server but result in the\n\t\t\t// same url, so we would need to create hidden anchor elements to compare them)\n\t\t\treturn;\n\t\t}\n\t}\n\n\tvar previous = attributes[attribute];\n\tif (previous === (attributes[attribute] = value)) return;\n\n\tif (attribute === 'loading') {\n\t\t// @ts-expect-error\n\t\telement[LOADING_ATTR_SYMBOL] = value;\n\t}\n\n\tif (value == null) {\n\t\tremove_attribute(element, attribute);\n\t} else if (typeof value !== 'string' && get_setters(element).has(attribute)) {\n\t\t// @ts-ignore\n\t\telement[attribute] = value;\n\t} else if (\n\t\t// while hydrating, skip a number or boolean whose string the server already rendered\n\t\t!(\n\t\t\thydrating &&\n\t\t\t(typeof value === 'number' || typeof value === 'boolean') &&\n\t\t\tprevious === String(value)\n\t\t)\n\t) {\n\t\tset_attribute_op(element, attribute, value);\n\t}\n}\n\n/**\n * @param {Element} dom\n * @param {string} attribute\n * @param {string} value\n */\nexport function set_xlink_attribute(dom, attribute, value) {\n\t// custom renderer safe since we never emit this\n\tdom.setAttributeNS('http://www.w3.org/1999/xlink', attribute, value);\n}\n\n/**\n * @param {HTMLElement} node\n * @param {string} prop\n * @param {any} value\n */\nexport function set_custom_element_data(node, prop, value) {\n\t// custom renderer safe since we never emit this\n\t// We need to ensure that setting custom element props, which can\n\t// invoke lifecycle methods on other custom elements, does not also\n\t// associate those lifecycle methods with the current active reaction\n\t// or effect\n\tvar previous_reaction = active_reaction;\n\tvar previous_effect = active_effect;\n\n\t// If we're hydrating but the custom element is from Svelte, and it already scaffolded,\n\t// then it might run block logic in hydration mode, which we have to prevent.\n\tlet was_hydrating = hydrating;\n\tif (hydrating) {\n\t\tset_hydrating(false);\n\t}\n\n\tset_active_reaction(null);\n\tset_active_effect(null);\n\n\ttry {\n\t\tif (\n\t\t\t// `style` should use `set_attribute` rather than the setter\n\t\t\tprop !== 'style' &&\n\t\t\t// Don't compute setters for custom elements while they aren't registered yet,\n\t\t\t// because during their upgrade/instantiation they might add more setters.\n\t\t\t// Instead, fall back to a simple \"an object, then set as property\" heuristic.\n\t\t\t(setters_cache.has(get_attribute(node, 'is') || node_name(node)) ||\n\t\t\t// customElements may not be available in browser extension contexts\n\t\t\t!customElements ||\n\t\t\tcustomElements.get(get_attribute(node, 'is') || node_name(node).toLowerCase())\n\t\t\t\t? get_setters(node).has(prop)\n\t\t\t\t: value && typeof value === 'object')\n\t\t) {\n\t\t\t// @ts-expect-error\n\t\t\tnode[prop] = value;\n\t\t} else {\n\t\t\t// We did getters etc checks already, stringify before passing to set_attribute\n\t\t\t// to ensure it doesn't invoke the same logic again, and potentially populating\n\t\t\t// the setters cache too early.\n\t\t\tset_attribute(node, prop, value == null ? value : String(value));\n\t\t}\n\t} finally {\n\t\tset_active_reaction(previous_reaction);\n\t\tset_active_effect(previous_effect);\n\t\tif (was_hydrating) {\n\t\t\tset_hydrating(true);\n\t\t}\n\t}\n}\n\n/**\n * Spreads attributes onto a DOM element, taking into account the currently set attributes\n * @param {Element & ElementCSSInlineStyle} element\n * @param {Record<string | symbol, any> | undefined} prev\n * @param {Record<string | symbol, any>} next New attributes - this function mutates this object\n * @param {string} [css_hash]\n * @param {boolean} [should_remove_defaults]\n * @param {boolean} [skip_warning]\n * @returns {Record<string, any>}\n */\nfunction set_attributes(\n\telement,\n\tprev,\n\tnext,\n\tcss_hash,\n\tshould_remove_defaults = false,\n\tskip_warning = false\n) {\n\tif (hydrating && should_remove_defaults && node_name(element) === INPUT_TAG) {\n\t\tif (!('defaultValue' in next || 'defaultChecked' in next)) {\n\t\t\tremove_input_defaults(/** @type {HTMLInputElement} */ (element));\n\t\t}\n\t}\n\n\tvar attributes = get_attributes(element);\n\n\tvar is_custom_element = attributes[IS_CUSTOM_ELEMENT];\n\tvar preserve_attribute_case = !attributes[IS_HTML];\n\n\t// If we're hydrating but the custom element is from Svelte, and it already scaffolded,\n\t// then it might run block logic in hydration mode, which we have to prevent.\n\tlet is_hydrating_custom_element = hydrating && is_custom_element;\n\tif (is_hydrating_custom_element) {\n\t\tset_hydrating(false);\n\t}\n\n\tvar current = prev || {};\n\tvar is_option_element = node_name(element) === OPTION_TAG;\n\tvar is_select_element = node_name(element) === SELECT_TAG;\n\n\ttry {\n\t\tfor (var key in prev) {\n\t\t\t// don't null our internal $$onX listeners\n\t\t\tif (!(key in next) && key[0] + key[1] !== '$$') {\n\t\t\t\tnext[key] = null;\n\t\t\t}\n\t\t}\n\n\t\tif (next.class) {\n\t\t\tnext.class = clsx(next.class);\n\t\t} else if (css_hash || next[CLASS]) {\n\t\t\tnext.class = null; /* force call to set_class() */\n\t\t}\n\n\t\tif (next[STYLE]) {\n\t\t\tnext.style ??= null; /* force call to set_style() */\n\t\t}\n\n\t\tvar setters = get_setters(element);\n\n\t\tif (\n\t\t\t// the following logic only makes sense in a DOM environment\n\t\t\tcurrent_renderer == null &&\n\t\t\tnode_name(element) === INPUT_TAG &&\n\t\t\t'type' in next &&\n\t\t\t('value' in next || '__value' in next)\n\t\t) {\n\t\t\tvar type = next.type;\n\n\t\t\tif (type !== current.type || (type === undefined && element.hasAttribute('type'))) {\n\t\t\t\tcurrent.type = type;\n\t\t\t\tset_attribute(element, 'type', type, skip_warning);\n\t\t\t}\n\t\t}\n\n\t\t// since key is captured we use const\n\t\tfor (const key in next) {\n\t\t\t// let instead of var because referenced in a closure\n\t\t\tlet value = next[key];\n\n\t\t\t// Up here because we want to do this for the initial value, too, even if it's undefined,\n\t\t\t// and this wouldn't be reached in case of undefined because of the equality check below\n\t\t\tif (is_option_element && key === 'value' && value == null) {\n\t\t\t\t// The <option> element is a special case because removing the value attribute means\n\t\t\t\t// the value is set to the text content of the option element, and setting the value\n\t\t\t\t// to null or undefined means the value is set to the string \"null\" or \"undefined\".\n\t\t\t\t// To align with how we handle this case in non-spread-scenarios, this logic is needed.\n\t\t\t\t// There's a super-edge-case bug here that is left in favor of smaller code size:\n\t\t\t\t// Because of the \"set missing props to null\" logic above, we can't differentiate\n\t\t\t\t// between a missing value and an explicitly set value of null or undefined. That means\n\t\t\t\t// that once set, the value attribute of an <option> element can't be removed. This is\n\t\t\t\t// a very rare edge case, and removing the attribute altogether isn't possible either\n\t\t\t\t// for the <option value={undefined}> case, so we're not losing any functionality here.\n\t\t\t\t// @ts-ignore\n\t\t\t\telement.value = element.__value = '';\n\t\t\t\tcurrent[key] = value;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (key === 'class') {\n\t\t\t\tvar is_html = current_renderer == null && element.namespaceURI === NAMESPACE_HTML;\n\t\t\t\tset_class(element, is_html, value, css_hash, prev?.[CLASS], next[CLASS]);\n\t\t\t\tcurrent[key] = value;\n\t\t\t\tcurrent[CLASS] = next[CLASS];\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (key === 'style') {\n\t\t\t\tset_style(element, value, prev?.[STYLE], next[STYLE]);\n\t\t\t\tcurrent[key] = value;\n\t\t\t\tcurrent[STYLE] = next[STYLE];\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tvar prev_value = current[key];\n\n\t\t\t// Skip if value is unchanged, unless it's `undefined` and the element still has the attribute\n\t\t\tif (value === prev_value && !(value === undefined && has_attribute(element, key))) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tcurrent[key] = value;\n\n\t\t\tvar prefix = key[0] + key[1]; // this is faster than key.slice(0, 2)\n\t\t\tif (prefix === '$$') continue;\n\n\t\t\t// omit event handler attributes regardless of casing, matching SSR\n\t\t\tif (prefix !== 'on' && key.length > 2 && prefix.toLowerCase() === 'on') continue;\n\n\t\t\tif (prefix === 'on') {\n\t\t\t\t/** @type {{ capture?: true }} */\n\t\t\t\tconst opts = {};\n\t\t\t\tconst event_handle_key = '$$' + key;\n\t\t\t\tlet event_name = key.slice(2);\n\t\t\t\tvar is_delegated = current_renderer == null && can_delegate_event(event_name);\n\n\t\t\t\tif (is_capture_event(event_name)) {\n\t\t\t\t\tevent_name = event_name.slice(0, -7);\n\t\t\t\t\topts.capture = true;\n\t\t\t\t}\n\n\t\t\t\tif (!is_delegated && prev_value) {\n\t\t\t\t\t// Listening to same event but different handler -> our handle function below takes care of this\n\t\t\t\t\t// If we were to remove and add listeners in this case, it could happen that the event is \"swallowed\"\n\t\t\t\t\t// (the browser seems to not know yet that a new one exists now) and doesn't reach the handler\n\t\t\t\t\t// https://github.com/sveltejs/svelte/issues/11903\n\t\t\t\t\tif (value != null) continue;\n\n\t\t\t\t\tremove_event_listener(element, event_name, current[event_handle_key], opts);\n\t\t\t\t\tcurrent[event_handle_key] = null;\n\t\t\t\t}\n\n\t\t\t\tif (is_delegated) {\n\t\t\t\t\tdelegated(event_name, element, value);\n\t\t\t\t\tdelegate([event_name]);\n\t\t\t\t} else if (value != null) {\n\t\t\t\t\t/**\n\t\t\t\t\t * @this {any}\n\t\t\t\t\t * @param {...any} args\n\t\t\t\t\t */\n\t\t\t\t\tfunction handle(...args) {\n\t\t\t\t\t\tcurrent[key].apply(this, args);\n\t\t\t\t\t}\n\n\t\t\t\t\tcurrent[event_handle_key] = create_event(event_name, element, handle, opts);\n\t\t\t\t}\n\t\t\t} else if (key === 'style') {\n\t\t\t\t// avoid using the setter\n\t\t\t\tset_attribute(element, key, value);\n\t\t\t} else if (key === 'autofocus') {\n\t\t\t\tif (current_renderer == null) {\n\t\t\t\t\tautofocus(/** @type {HTMLElement} */ (element), Boolean(value));\n\t\t\t\t} else {\n\t\t\t\t\t// In custom renderer mode, just set autofocus as a regular attribute\n\t\t\t\t\tif (value) {\n\t\t\t\t\t\tset_attribute_op(element, key, value);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tremove_attribute(element, key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (!is_custom_element && (key === '__value' || (key === 'value' && value != null))) {\n\t\t\t\t// @ts-ignore We're not running this for custom elements because __value is actually\n\t\t\t\t// how Lit stores the current value on the element, and messing with that would break things.\n\t\t\t\telement.__value = value;\n\t\t\t\t// we don't set the value if it hasn't changed. This supports invalid number inputs like `1e` because\n\t\t\t\t// 1. user types 1e\n\t\t\t\t// 2. the state is updated reading e.target.value which is ''\n\t\t\t\t// 3. the spreaded value is ''\n\t\t\t\t// 4. updating input.value would thus, clear the user value\n\t\t\t\tif (\n\t\t\t\t\tprev_value == null ||\n\t\t\t\t\t// @ts-ignore\n\t\t\t\t\telement.value !== value ||\n\t\t\t\t\t(value === 0 && element.nodeName === PROGRESS_TAG)\n\t\t\t\t) {\n\t\t\t\t\tset_element_value(element, value);\n\t\t\t\t}\n\t\t\t} else if (key === 'selected' && is_option_element) {\n\t\t\t\tset_selected(/** @type {HTMLOptionElement} */ (element), value);\n\t\t\t} else {\n\t\t\t\tvar name = key;\n\t\t\t\tif (!preserve_attribute_case) {\n\t\t\t\t\tname = normalize_attribute(name);\n\t\t\t\t}\n\n\t\t\t\tvar is_default = name === 'defaultValue' || name === 'defaultChecked';\n\n\t\t\t\t// A select's default value is represented by selected options, not a property.\n\t\t\t\tif (is_select_element && name === 'defaultValue') continue;\n\n\t\t\t\tif (value == null && !is_custom_element && !is_default) {\n\t\t\t\t\tattributes[key] = null;\n\t\t\t\t\tif ((name === 'value' || name === 'checked') && current_renderer == null) {\n\t\t\t\t\t\t// removing value/checked also removes defaultValue/defaultChecked — preserve\n\t\t\t\t\t\tlet input = /** @type {HTMLInputElement} */ (element);\n\t\t\t\t\t\tconst use_default = prev === undefined;\n\t\t\t\t\t\tif (name === 'value') {\n\t\t\t\t\t\t\tlet previous = input.defaultValue;\n\t\t\t\t\t\t\tremove_attribute(input, name);\n\t\t\t\t\t\t\tset_element_default_value(input, previous);\n\t\t\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t\t\tset_element_value(input, (input.__value = use_default ? previous : null));\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tlet previous = input.defaultChecked;\n\t\t\t\t\t\t\tremove_attribute(input, name);\n\t\t\t\t\t\t\tset_element_default_checked(input, previous);\n\t\t\t\t\t\t\tset_element_checked(input, use_default ? previous : false);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tremove_attribute(element, key);\n\t\t\t\t\t\tif (name === 'value') {\n\t\t\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t\t\telement.__value = null;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if (is_default && current_renderer != null) {\n\t\t\t\t\t// Route through the renderer-aware abstraction so custom renderers\n\t\t\t\t\t// see defaultValue/defaultChecked as proper attributes\n\t\t\t\t\tif (name === 'defaultValue') {\n\t\t\t\t\t\tset_element_default_value(element, value);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tset_element_default_checked(element, value);\n\t\t\t\t\t}\n\t\t\t\t\t// remove it from attributes's cache\n\t\t\t\t\tif (name in attributes) attributes[name] = UNINITIALIZED;\n\t\t\t\t} else if (\n\t\t\t\t\tis_default ||\n\t\t\t\t\t((is_custom_element || typeof value !== 'string') && setters.has(name))\n\t\t\t\t) {\n\t\t\t\t\t// @ts-ignore\n\t\t\t\t\telement[name] = value;\n\t\t\t\t\t// remove it from attributes's cache\n\t\t\t\t\tif (name in attributes) attributes[name] = UNINITIALIZED;\n\t\t\t\t} else if (typeof value !== 'function') {\n\t\t\t\t\tset_attribute(element, name, value, skip_warning);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} finally {\n\t\tif (is_hydrating_custom_element) {\n\t\t\tset_hydrating(true);\n\t\t}\n\t}\n\n\treturn current;\n}\n\n/**\n * @param {Element & ElementCSSInlineStyle} element\n * @param {(...expressions: any) => Record<string | symbol, any>} fn\n * @param {Array<() => any>} sync\n * @param {Array<() => Promise<any>>} async\n * @param {Blocker[]} blockers\n * @param {string} [css_hash]\n * @param {boolean} [should_remove_defaults]\n * @param {boolean} [skip_warning]\n */\nexport function attribute_effect(\n\telement,\n\tfn,\n\tsync = [],\n\tasync = [],\n\tblockers = [],\n\tcss_hash,\n\tshould_remove_defaults = false,\n\tskip_warning = false\n) {\n\tflatten(blockers, sync, async, (values) => {\n\t\t/** @type {Record<string | symbol, any> | undefined} */\n\t\tvar prev = undefined;\n\n\t\t/** @type {Record<symbol, Effect>} */\n\t\tvar effects = {};\n\n\t\tvar is_select = node_name(element) === SELECT_TAG;\n\t\tvar inited = false;\n\n\t\tmanaged(() => {\n\t\t\tvar next = fn(...values.map(get));\n\t\t\t/** @type {Record<string | symbol, any>} */\n\t\t\tvar current = set_attributes(\n\t\t\t\telement,\n\t\t\t\tprev,\n\t\t\t\tnext,\n\t\t\t\tcss_hash,\n\t\t\t\tshould_remove_defaults,\n\t\t\t\tskip_warning\n\t\t\t);\n\n\t\t\tif (inited && is_select) {\n\t\t\t\tvar select = /** @type {HTMLSelectElement} */ (element);\n\n\t\t\t\tif ('defaultValue' in next) {\n\t\t\t\t\tset_default_select_value(select, next.defaultValue);\n\t\t\t\t}\n\n\t\t\t\tif ('value' in next) {\n\t\t\t\t\tselect_option(select, next.value);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (let symbol of Object.getOwnPropertySymbols(effects)) {\n\t\t\t\tif (!next[symbol]) destroy_effect(effects[symbol]);\n\t\t\t}\n\n\t\t\tfor (let symbol of Object.getOwnPropertySymbols(next)) {\n\t\t\t\tvar n = next[symbol];\n\n\t\t\t\tif (symbol.description === ATTACHMENT_KEY && (!prev || n !== prev[symbol])) {\n\t\t\t\t\tif (effects[symbol]) destroy_effect(effects[symbol]);\n\t\t\t\t\teffects[symbol] = branch(() => attach(element, () => n));\n\t\t\t\t}\n\n\t\t\t\tcurrent[symbol] = n;\n\t\t\t}\n\n\t\t\tprev = current;\n\t\t});\n\n\t\tif (is_select) {\n\t\t\tvar select = /** @type {HTMLSelectElement} */ (element);\n\n\t\t\teffect(() => {\n\t\t\t\tvar attrs = /** @type {Record<string | symbol, any>} */ (prev);\n\n\t\t\t\tif ('defaultValue' in attrs) {\n\t\t\t\t\tset_default_select_value(select, attrs.defaultValue);\n\t\t\t\t}\n\n\t\t\t\tselect_option(select, attrs.value, true);\n\t\t\t\tinit_select(select);\n\t\t\t});\n\t\t}\n\n\t\tinited = true;\n\t});\n}\n\n/**\n *\n * @param {Element} element\n */\nfunction get_attributes(element) {\n\treturn /** @type {Record<string | symbol, unknown>} **/ (\n\t\t/** @type {any} */ (element)[ATTRIBUTES_CACHE] ??= {\n\t\t\t[IS_CUSTOM_ELEMENT]: node_name(element).includes('-'),\n\t\t\t[IS_HTML]: current_renderer == null && element.namespaceURI === NAMESPACE_HTML\n\t\t}\n\t);\n}\n\n/** @type {Map<string, Set<string>>} */\nvar setters_cache = new Map();\nvar empty_setters = new Set();\n\n/** @param {Element} element */\nfunction get_setters(element) {\n\t// if we have a custom renderer we just skip the check all together\n\tif (current_renderer) return empty_setters;\n\tvar is = get_attribute(element, 'is');\n\tvar cache_key = is || node_name(element);\n\tvar setters = setters_cache.get(cache_key);\n\tif (setters) return setters;\n\tsetters = new Set();\n\n\t// an unregistered custom element can gain setters when it upgrades\n\tif (\n\t\t!customElements ||\n\t\t!(is || cache_key.includes('-')) ||\n\t\tcustomElements.get(is || cache_key.toLowerCase())\n\t) {\n\t\tsetters_cache.set(cache_key, setters);\n\t}\n\n\tvar descriptors;\n\tvar proto = element; // In the case of custom elements there might be setters on the instance\n\tvar element_proto = Element.prototype;\n\n\t// Stop at Element, from there on there's only unnecessary (and dangerous, like innerHTML) setters we're not interested in\n\t// Do not use constructor.name here as that's unreliable in some browser environments\n\twhile (element_proto !== proto) {\n\t\tdescriptors = get_descriptors(proto);\n\n\t\tfor (var key in descriptors) {\n\t\t\tif (\n\t\t\t\tdescriptors[key].set &&\n\t\t\t\t// better safe than sorry, we don't want spread attributes to mess with HTML content\n\t\t\t\tkey !== 'innerHTML' &&\n\t\t\t\tkey !== 'textContent' &&\n\t\t\t\tkey !== 'innerText'\n\t\t\t) {\n\t\t\t\tsetters.add(key);\n\t\t\t}\n\t\t}\n\n\t\tproto = get_prototype_of(proto);\n\t}\n\n\treturn setters;\n}\n\n/**\n * @param {any} element\n * @param {string} attribute\n * @param {string} value\n */\nfunction check_src_in_dev_hydration(element, attribute, value) {\n\tif (!DEV || current_renderer != null) return;\n\tif (attribute === 'srcset' && srcset_url_equal(element, value)) return;\n\tif (src_url_equal(get_attribute(element, attribute) ?? '', value)) return;\n\n\tw.hydration_attribute_changed(\n\t\tattribute,\n\t\telement.outerHTML.replace(element.innerHTML, element.innerHTML && '...'),\n\t\tString(value)\n\t);\n}\n\n/**\n * @param {string} element_src\n * @param {string} url\n * @returns {boolean}\n */\nfunction src_url_equal(element_src, url) {\n\tif (element_src === url || current_renderer != null) return true;\n\treturn new URL(element_src, document.baseURI).href === new URL(url, document.baseURI).href;\n}\n\n/** @param {string} srcset */\nfunction split_srcset(srcset) {\n\treturn srcset.split(',').map((src) => src.trim().split(' ').filter(Boolean));\n}\n\n/**\n * @param {HTMLSourceElement | HTMLImageElement} element\n * @param {string} srcset\n * @returns {boolean}\n */\nfunction srcset_url_equal(element, srcset) {\n\tif (current_renderer != null) return true;\n\tvar element_urls = split_srcset(element.srcset);\n\tvar urls = split_srcset(srcset);\n\n\treturn (\n\t\turls.length === element_urls.length &&\n\t\turls.every(\n\t\t\t([url, width], i) =>\n\t\t\t\twidth === element_urls[i][1] &&\n\t\t\t\t// We need to test both ways because Vite will create an a full URL with\n\t\t\t\t// `new URL(asset, import.meta.url).href` for the client when `base: './'`, and the\n\t\t\t\t// relative URLs inside srcset are not automatically resolved to absolute URLs by\n\t\t\t\t// browsers (in contrast to img.src). This means both SSR and DOM code could\n\t\t\t\t// contain relative or absolute URLs.\n\t\t\t\t(src_url_equal(element_urls[i][0], url) || src_url_equal(url, element_urls[i][0]))\n\t\t)\n\t);\n}\n","/** @import { Batch } from '../../../reactivity/batch.js' */\nimport { DEV } from 'esm-env';\nimport { render_effect, teardown } from '../../../reactivity/effects.js';\nimport { listen_to_event_and_reset_event } from './shared.js';\nimport * as e from '../../../errors.js';\nimport { is } from '../../../proxy.js';\nimport { queue_micro_task } from '../../task.js';\nimport { hydrating } from '../../hydration.js';\nimport { tick, untrack } from '../../../runtime.js';\nimport { current_batch, view_batch } from '../../../reactivity/batch.js';\n\n/**\n * @param {HTMLInputElement} input\n * @param {() => unknown} get\n * @param {(value: unknown) => void} set\n * @returns {void}\n */\nexport function bind_value(input, get, set = get) {\n\tvar batches = new WeakSet();\n\n\tlisten_to_event_and_reset_event(input, 'input', async (is_reset) => {\n\t\tif (DEV && input.type === 'checkbox') {\n\t\t\t// TODO should this happen in prod too?\n\t\t\te.bind_invalid_checkbox_value();\n\t\t}\n\n\t\t/** @type {any} */\n\t\tvar value = is_reset ? input.defaultValue : input.value;\n\t\tvalue = is_numberlike_input(input) ? to_number(value) : value;\n\t\tset(value);\n\n\t\tif (current_batch !== null) {\n\t\t\tbatches.add(current_batch);\n\t\t}\n\n\t\t// Because `{#each ...}` blocks work by updating sources inside the flush,\n\t\t// we need to wait a tick before checking to see if we should forcibly\n\t\t// update the input and reset the selection state\n\t\tawait tick();\n\n\t\t// Respect any validation in accessors\n\t\tif (value !== (value = get())) {\n\t\t\tvar start = input.selectionStart;\n\t\t\tvar end = input.selectionEnd;\n\t\t\tvar length = input.value.length;\n\n\t\t\t// the value is coerced on assignment\n\t\t\tinput.value = value ?? '';\n\n\t\t\t// Restore selection\n\t\t\tif (end !== null) {\n\t\t\t\tvar new_length = input.value.length;\n\t\t\t\t// If cursor was at end and new input is longer, move cursor to new end\n\t\t\t\tif (start === end && end === length && new_length > length) {\n\t\t\t\t\tinput.selectionStart = new_length;\n\t\t\t\t\tinput.selectionEnd = new_length;\n\t\t\t\t} else {\n\t\t\t\t\tinput.selectionStart = start;\n\t\t\t\t\tinput.selectionEnd = Math.min(end, new_length);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\n\tif (\n\t\t// If we are hydrating and the value has since changed,\n\t\t// then use the updated value from the input instead.\n\t\t(hydrating && input.defaultValue !== input.value) ||\n\t\t// If defaultValue is set, then value == defaultValue\n\t\t// TODO Svelte 6: remove input.value check and set to empty string?\n\t\t(untrack(get) == null && input.value)\n\t) {\n\t\tset(is_numberlike_input(input) ? to_number(input.value) : input.value);\n\n\t\tif (current_batch !== null) {\n\t\t\tbatches.add(current_batch);\n\t\t}\n\t}\n\n\trender_effect(() => {\n\t\tif (DEV && input.type === 'checkbox') {\n\t\t\t// TODO should this happen in prod too?\n\t\t\te.bind_invalid_checkbox_value();\n\t\t}\n\n\t\tvar value = get();\n\n\t\tif (input === document.activeElement) {\n\t\t\t// Never rewrite the contents of a focused input. We can get here if, for example,\n\t\t\t// an update is deferred because of async work depending on the input:\n\t\t\t//\n\t\t\t// <input bind:value={query}>\n\t\t\t// <p>{await find(query)}</p>\n\t\t\tif (batches.has(/** @type {Batch} */ (view_batch))) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tif (is_numberlike_input(input) && value === to_number(input.value)) {\n\t\t\t// handles 0 vs 00 case (see https://github.com/sveltejs/svelte/issues/9959)\n\t\t\treturn;\n\t\t}\n\n\t\tif (input.type === 'date' && !value && !input.value) {\n\t\t\t// Handles the case where a temporarily invalid date is set (while typing, for example with a leading 0 for the day)\n\t\t\t// and prevents this state from clearing the other parts of the date input (see https://github.com/sveltejs/svelte/issues/7897)\n\t\t\treturn;\n\t\t}\n\n\t\t// don't set the value of the input if it's the same to allow\n\t\t// minlength to work properly\n\t\tif (value !== input.value) {\n\t\t\t// @ts-expect-error the value is coerced on assignment\n\t\t\tinput.value = value ?? '';\n\t\t}\n\t});\n}\n\n/** @type {Set<HTMLInputElement[]>} */\nconst pending = new Set();\n\n/**\n * @param {HTMLInputElement[]} inputs\n * @param {null | [number]} group_index\n * @param {HTMLInputElement} input\n * @param {() => unknown} get\n * @param {(value: unknown) => void} set\n * @returns {void}\n */\nexport function bind_group(inputs, group_index, input, get, set = get) {\n\tvar is_checkbox = input.getAttribute('type') === 'checkbox';\n\tvar binding_group = inputs;\n\n\t// needs to be let or related code isn't treeshaken out if it's always false\n\tlet hydration_mismatch = false;\n\n\tif (group_index !== null) {\n\t\tfor (var index of group_index) {\n\t\t\t// @ts-expect-error\n\t\t\tbinding_group = binding_group[index] ??= [];\n\t\t}\n\t}\n\n\tbinding_group.push(input);\n\n\tlisten_to_event_and_reset_event(\n\t\tinput,\n\t\t'change',\n\t\t() => {\n\t\t\t// @ts-ignore\n\t\t\tvar value = input.__value;\n\n\t\t\tif (is_checkbox) {\n\t\t\t\tvalue = get_binding_group_value(binding_group, value, input.checked);\n\t\t\t}\n\n\t\t\tset(value);\n\t\t},\n\t\t// TODO better default value handling\n\t\t() => set(is_checkbox ? [] : null)\n\t);\n\n\trender_effect(() => {\n\t\tvar value = get();\n\n\t\t// If we are hydrating and the value has since changed, then use the update value\n\t\t// from the input instead.\n\t\tif (hydrating && input.defaultChecked !== input.checked) {\n\t\t\thydration_mismatch = true;\n\t\t\treturn;\n\t\t}\n\n\t\tif (is_checkbox) {\n\t\t\tvalue = value || [];\n\t\t\t// @ts-ignore\n\t\t\tinput.checked = value.includes(input.__value);\n\t\t} else {\n\t\t\t// @ts-ignore\n\t\t\tinput.checked = is(input.__value, value);\n\t\t}\n\t});\n\n\tteardown(() => {\n\t\tvar index = binding_group.indexOf(input);\n\n\t\tif (index !== -1) {\n\t\t\tbinding_group.splice(index, 1);\n\t\t}\n\t});\n\n\tif (!pending.has(binding_group)) {\n\t\tpending.add(binding_group);\n\n\t\tqueue_micro_task(() => {\n\t\t\t// necessary to maintain binding group order in all insertion scenarios\n\t\t\tbinding_group.sort((a, b) => (a.compareDocumentPosition(b) === 4 ? -1 : 1));\n\t\t\tpending.delete(binding_group);\n\t\t});\n\t}\n\n\tqueue_micro_task(() => {\n\t\tif (hydration_mismatch) {\n\t\t\tvar value;\n\n\t\t\tif (is_checkbox) {\n\t\t\t\tvalue = get_binding_group_value(binding_group, value, input.checked);\n\t\t\t} else {\n\t\t\t\tvar hydration_input = binding_group.find((input) => input.checked);\n\t\t\t\t// @ts-ignore\n\t\t\t\tvalue = hydration_input?.__value;\n\t\t\t}\n\n\t\t\tset(value);\n\t\t}\n\t});\n}\n\n/**\n * @param {HTMLInputElement} input\n * @param {() => unknown} get\n * @param {(value: unknown) => void} set\n * @returns {void}\n */\nexport function bind_checked(input, get, set = get) {\n\tlisten_to_event_and_reset_event(input, 'change', (is_reset) => {\n\t\tvar value = is_reset ? input.defaultChecked : input.checked;\n\t\tset(value);\n\t});\n\n\tif (\n\t\t// If we are hydrating and the value has since changed,\n\t\t// then use the update value from the input instead.\n\t\t(hydrating && input.defaultChecked !== input.checked) ||\n\t\t// If defaultChecked is set, then checked == defaultChecked\n\t\tuntrack(get) == null\n\t) {\n\t\tset(input.checked);\n\t}\n\n\trender_effect(() => {\n\t\tvar value = get();\n\t\tinput.checked = Boolean(value);\n\t});\n}\n\n/**\n * @template V\n * @param {Array<HTMLInputElement>} group\n * @param {V} __value\n * @param {boolean} checked\n * @returns {V[]}\n */\nfunction get_binding_group_value(group, __value, checked) {\n\t/** @type {Set<V>} */\n\tvar value = new Set();\n\n\tfor (var i = 0; i < group.length; i += 1) {\n\t\tif (group[i].checked) {\n\t\t\t// @ts-ignore\n\t\t\tvalue.add(group[i].__value);\n\t\t}\n\t}\n\n\tif (!checked) {\n\t\tvalue.delete(__value);\n\t}\n\n\treturn Array.from(value);\n}\n\n/**\n * @param {HTMLInputElement} input\n */\nfunction is_numberlike_input(input) {\n\tvar type = input.type;\n\treturn type === 'number' || type === 'range';\n}\n\n/**\n * @param {string} value\n */\nfunction to_number(value) {\n\treturn value === '' ? null : +value;\n}\n\n/**\n * @param {HTMLInputElement} input\n * @param {() => FileList | null} get\n * @param {(value: FileList | null) => void} set\n */\nexport function bind_files(input, get, set = get) {\n\tlisten_to_event_and_reset_event(\n\t\tinput,\n\t\t'change',\n\t\t() => {\n\t\t\tset(input.files);\n\t\t},\n\t\t() => {\n\t\t\t// A form reset can empty the input's `FileList` in place, which is then the very\n\t\t\t// object the binding already holds and would not be seen as a change: give the\n\t\t\t// input a new, empty one instead\n\t\t\tif (typeof DataTransfer === 'function') {\n\t\t\t\tinput.files = new DataTransfer().files;\n\t\t\t}\n\n\t\t\tset(input.files);\n\t\t}\n\t);\n\n\tif (\n\t\t// If we are hydrating and the value has since changed,\n\t\t// then use the updated value from the input instead.\n\t\thydrating &&\n\t\tinput.files\n\t) {\n\t\tset(input.files);\n\t}\n\n\trender_effect(() => {\n\t\tinput.files = get();\n\t});\n}\n","/** @import { ComponentContext, Effect } from '#client' */\nimport { DESTROYING, STATE_SYMBOL } from '#client/constants';\nimport { component_context, mark_as_component } from '../../../context.js';\nimport { effect, render_effect } from '../../../reactivity/effects.js';\nimport { active_effect, untrack } from '../../../runtime.js';\n\n/**\n * @param {any} bound_value\n * @param {Element} element_or_component\n * @returns {boolean}\n */\nfunction is_bound_this(bound_value, element_or_component) {\n\treturn (\n\t\tbound_value === element_or_component || bound_value?.[STATE_SYMBOL] === element_or_component\n\t);\n}\n\n/**\n * @param {any} element_or_component\n * @param {(value: unknown, ...parts: unknown[]) => void} update\n * @param {(...parts: unknown[]) => unknown} get_value\n * @param {() => unknown[]} [get_parts] Set if the this binding is used inside an each block,\n * \t\t\t\t\t\t\t\t\t\treturns all the parts of the each block context that are used in the expression\n * @returns {void}\n */\nexport function bind_this(\n\telement_or_component = mark_as_component(),\n\tupdate,\n\tget_value,\n\tget_parts\n) {\n\tvar component_effect = /** @type {ComponentContext} */ (component_context).r;\n\tvar parent = /** @type {Effect} */ (active_effect);\n\n\teffect(() => {\n\t\t/** @type {unknown[]} */\n\t\tvar old_parts;\n\n\t\t/** @type {unknown[]} */\n\t\tvar parts;\n\n\t\trender_effect(() => {\n\t\t\told_parts = parts;\n\t\t\t// We only track changes to the parts, not the value itself to avoid unnecessary reruns.\n\t\t\tparts = get_parts?.() || [];\n\n\t\t\tuntrack(() => {\n\t\t\t\tif (!is_bound_this(get_value(...parts), element_or_component)) {\n\t\t\t\t\tupdate(element_or_component, ...parts);\n\t\t\t\t\t// If this is an effect rerun (cause: each block context changes), then nullify the binding at\n\t\t\t\t\t// the previous position if it isn't already taken over by a different effect.\n\t\t\t\t\tif (old_parts && is_bound_this(get_value(...old_parts), element_or_component)) {\n\t\t\t\t\t\tupdate(null, ...old_parts);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\n\t\treturn () => {\n\t\t\t// When the bind:this effect is destroyed, we go up the effect parent chain until we find the last parent effect that is destroyed,\n\t\t\t// or the effect containing the component bind:this is in (whichever comes first). That way we can time the nulling of the binding\n\t\t\t// as close to user/developer expectation as possible.\n\t\t\t// TODO Svelte 6: Decide if we want to keep this logic or just always null the binding in the component effect's teardown\n\t\t\t// (which would be simpler, but less intuitive in some cases, and breaks the `ondestroy-before-cleanup` test)\n\t\t\tlet p = parent;\n\t\t\twhile (p !== component_effect && p.parent !== null && p.parent.f & DESTROYING) {\n\t\t\t\tp = p.parent;\n\t\t\t}\n\t\t\tconst teardown = () => {\n\t\t\t\tif (parts && is_bound_this(get_value(...parts), element_or_component)) {\n\t\t\t\t\tupdate(null, ...parts);\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst original_teardown = p.teardown;\n\t\t\tp.teardown = () => {\n\t\t\t\tteardown();\n\t\t\t\toriginal_teardown?.();\n\t\t\t};\n\t\t};\n\t});\n\n\treturn element_or_component;\n}\n","/** @import { StoreReferencesContainer } from '#client' */\n/** @import { Store } from '#shared' */\nimport { subscribe_to_store } from '../../../store/utils.js';\nimport { get as get_store } from '../../../store/shared/index.js';\nimport { define_property, noop } from '../../shared/utils.js';\nimport { get } from '../runtime.js';\nimport { teardown } from './effects.js';\nimport { mutable_source, set } from './sources.js';\nimport { DEV } from 'esm-env';\n\n/**\n * We set this to `true` when updating a store so that we correctly\n * schedule effects if the update takes place inside a `$:` effect\n */\nexport let legacy_is_updating_store = false;\n\n/**\n * Whether or not the prop currently being read is a store binding, as in\n * `<Child bind:x={$y} />`. If it is, we treat the prop as mutable even in\n * runes mode, and skip `binding_property_non_reactive` validation\n */\nlet is_store_binding = false;\n\nlet IS_UNMOUNTED = Symbol('unmounted');\n\n/**\n * Gets the current value of a store. If the store isn't subscribed to yet, it will create a proxy\n * signal that will be updated when the store is. The store references container is needed to\n * track reassignments to stores and to track the correct component context.\n * @template V\n * @param {Store<V> | null | undefined} store\n * @param {string} store_name\n * @param {StoreReferencesContainer} stores\n * @returns {V}\n */\nexport function store_get(store, store_name, stores) {\n\tconst entry = (stores[store_name] ??= {\n\t\tstore: null,\n\t\tsource: mutable_source(undefined),\n\t\tunsubscribe: noop\n\t});\n\n\tif (DEV) {\n\t\tentry.source.label = store_name;\n\t}\n\n\t// if the component that setup this is already unmounted we don't want to register a subscription\n\tif (entry.store !== store && !(IS_UNMOUNTED in stores)) {\n\t\tentry.unsubscribe();\n\t\tentry.store = store ?? null;\n\n\t\tif (store == null) {\n\t\t\tentry.source.v = undefined; // see synchronous callback comment below\n\t\t\tentry.unsubscribe = noop;\n\t\t} else {\n\t\t\tvar is_synchronous_callback = true;\n\n\t\t\tentry.unsubscribe = subscribe_to_store(store, (v) => {\n\t\t\t\tif (is_synchronous_callback) {\n\t\t\t\t\t// If the first updates to the store value (possibly multiple of them) are synchronously\n\t\t\t\t\t// inside a derived, we will hit the `state_unsafe_mutation` error if we `set` the value\n\t\t\t\t\tentry.source.v = v;\n\t\t\t\t} else {\n\t\t\t\t\tset(entry.source, v);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tis_synchronous_callback = false;\n\t\t}\n\t}\n\n\t// if the component that setup this stores is already unmounted the source will be out of sync\n\t// so we just use the `get` for the stores, less performant but it avoids to create a memory leak\n\t// and it will keep the value consistent\n\tif (store && IS_UNMOUNTED in stores) {\n\t\treturn get_store(store);\n\t}\n\n\treturn get(entry.source);\n}\n\n/**\n * Unsubscribe from a store if it's not the same as the one in the store references container.\n * We need this in addition to `store_get` because someone could unsubscribe from a store but\n * then never subscribe to the new one (if any), causing the subscription to stay open wrongfully.\n * @param {Store<any> | null | undefined} store\n * @param {string} store_name\n * @param {StoreReferencesContainer} stores\n */\nexport function store_unsub(store, store_name, stores) {\n\t/** @type {StoreReferencesContainer[''] | undefined} */\n\tlet entry = stores[store_name];\n\n\tif (entry && entry.store !== store) {\n\t\t// Don't reset store yet, so that store_get above can resubscribe to new store if necessary\n\t\tentry.unsubscribe();\n\t\tentry.unsubscribe = noop;\n\t}\n\n\treturn store;\n}\n\n/**\n * Sets the new value of a store and returns that value.\n * @template V\n * @param {Store<V>} store\n * @param {V} value\n * @returns {V}\n */\nexport function store_set(store, value) {\n\tupdate_with_flag(store, value);\n\treturn value;\n}\n\n/**\n * @param {StoreReferencesContainer} stores\n * @param {string} store_name\n */\nexport function invalidate_store(stores, store_name) {\n\tvar entry = stores[store_name];\n\tif (entry.store !== null) {\n\t\tstore_set(entry.store, entry.source.v);\n\t}\n}\n\n/**\n * Unsubscribes from all auto-subscribed stores on destroy\n * @returns {[StoreReferencesContainer, ()=>void]}\n */\nexport function setup_stores() {\n\t/** @type {StoreReferencesContainer} */\n\tconst stores = {};\n\n\tfunction cleanup() {\n\t\tteardown(() => {\n\t\t\tfor (var store_name in stores) {\n\t\t\t\tconst ref = stores[store_name];\n\t\t\t\tref.unsubscribe();\n\t\t\t}\n\t\t\tdefine_property(stores, IS_UNMOUNTED, {\n\t\t\t\tenumerable: false,\n\t\t\t\tvalue: true\n\t\t\t});\n\t\t});\n\t}\n\n\treturn [stores, cleanup];\n}\n\n/**\n * @param {Store<V>} store\n * @param {V} value\n * @template V\n */\nfunction update_with_flag(store, value) {\n\tlegacy_is_updating_store = true;\n\n\ttry {\n\t\tstore.set(value);\n\t} finally {\n\t\tlegacy_is_updating_store = false;\n\t}\n}\n\n/**\n * Updates a store with a new value.\n * @param {Store<V>} store the store to update\n * @param {any} expression the expression that mutates the store\n * @param {V} new_value the new store value\n * @template V\n */\nexport function store_mutate(store, expression, new_value) {\n\tupdate_with_flag(store, new_value);\n\treturn expression;\n}\n\n/**\n * @param {Store<number>} store\n * @param {number} store_value\n * @param {1 | -1} [d]\n * @returns {number}\n */\nexport function update_store(store, store_value, d = 1) {\n\tupdate_with_flag(store, store_value + d);\n\treturn store_value;\n}\n\n/**\n * @param {Store<number>} store\n * @param {number} store_value\n * @param {1 | -1} [d]\n * @returns {number}\n */\nexport function update_pre_store(store, store_value, d = 1) {\n\tconst value = store_value + d;\n\tupdate_with_flag(store, value);\n\treturn value;\n}\n\n/**\n * Called inside prop getters to communicate that the prop is a store binding\n */\nexport function mark_store_binding() {\n\tis_store_binding = true;\n}\n\n/**\n * Returns a tuple that indicates whether `fn()` reads a prop that is a store binding.\n * Used to prevent `binding_property_non_reactive` validation false positives and\n * ensure that these props are treated as mutable even in runes mode\n * @template T\n * @param {() => T} fn\n * @returns {[T, boolean]}\n */\nexport function capture_store_binding(fn) {\n\tvar previous_is_store_binding = is_store_binding;\n\n\ttry {\n\t\tis_store_binding = false;\n\t\treturn [fn(), is_store_binding];\n\t} finally {\n\t\tis_store_binding = previous_is_store_binding;\n\t}\n}\n","/** @import { Derived, Effect, Source } from './types.js' */\nimport { DEV } from 'esm-env';\nimport {\n\tPROPS_IS_BINDABLE,\n\tPROPS_IS_IMMUTABLE,\n\tPROPS_IS_LAZY_INITIAL,\n\tPROPS_IS_RUNES,\n\tPROPS_IS_UPDATED\n} from '../../../constants.js';\nimport { get_descriptor, is_function } from '../../shared/utils.js';\nimport { set, source, update } from './sources.js';\nimport { derived, derived_safe_equal } from './deriveds.js';\nimport {\n\tactive_effect,\n\tget,\n\tis_destroying_effect,\n\tset_active_effect,\n\tuntrack\n} from '../runtime.js';\nimport * as e from '../errors.js';\nimport { DESTROYED, LEGACY_PROPS, STATE_SYMBOL } from '#client/constants';\nimport { proxy } from '../proxy.js';\nimport { capture_store_binding } from './store.js';\nimport { legacy_mode_flag } from '../../flags/index.js';\n\n/**\n * @param {((value?: number) => number)} fn\n * @param {1 | -1} [d]\n * @returns {number}\n */\nexport function update_prop(fn, d = 1) {\n\tconst value = fn();\n\tfn(value + d);\n\treturn value;\n}\n\n/**\n * @param {((value?: number) => number)} fn\n * @param {1 | -1} [d]\n * @returns {number}\n */\nexport function update_pre_prop(fn, d = 1) {\n\tconst value = fn() + d;\n\tfn(value);\n\treturn value;\n}\n\n/**\n * The proxy handler for rest props (i.e. `const { x, ...rest } = $props()`).\n * Is passed the full `$$props` object and excludes the named props.\n * @type {ProxyHandler<{ props: Record<string | symbol, unknown>, exclude: Set<string | symbol>, name?: string }>}}\n */\nconst rest_props_handler = {\n\tget(target, key) {\n\t\tif (target.exclude.has(key)) return;\n\t\treturn target.props[key];\n\t},\n\tset(target, key) {\n\t\tif (DEV) {\n\t\t\t// TODO should this happen in prod too?\n\t\t\te.props_rest_readonly(`${target.name}.${String(key)}`);\n\t\t}\n\n\t\treturn false;\n\t},\n\tgetOwnPropertyDescriptor(target, key) {\n\t\tif (target.exclude.has(key)) return;\n\t\tif (key in target.props) {\n\t\t\treturn {\n\t\t\t\tenumerable: true,\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: target.props[key]\n\t\t\t};\n\t\t}\n\t},\n\thas(target, key) {\n\t\tif (target.exclude.has(key)) return false;\n\t\treturn key in target.props;\n\t},\n\townKeys(target) {\n\t\treturn Reflect.ownKeys(target.props).filter((key) => !target.exclude.has(key));\n\t}\n};\n\n/**\n * @param {Record<string, unknown>} props\n * @param {Set<string>} exclude\n * @param {string} [name]\n * @returns {Record<string, unknown>}\n */\n/*#__NO_SIDE_EFFECTS__*/\nexport function rest_props(props, exclude, name) {\n\treturn new Proxy(DEV ? { props, exclude, name } : { props, exclude }, rest_props_handler);\n}\n\n/**\n * The proxy handler for legacy $$restProps and $$props\n * @type {ProxyHandler<{ props: Record<string | symbol, unknown>, exclude: Array<string | symbol>, special: Record<string | symbol, (v?: unknown) => unknown>, version: Source<number>, parent_effect: Effect }>}}\n */\nconst legacy_rest_props_handler = {\n\tget(target, key) {\n\t\tif (target.exclude.includes(key)) return;\n\t\tget(target.version);\n\t\treturn key in target.special ? target.special[key]() : target.props[key];\n\t},\n\tset(target, key, value) {\n\t\tif (!(key in target.special)) {\n\t\t\tvar previous_effect = active_effect;\n\n\t\t\ttry {\n\t\t\t\tset_active_effect(target.parent_effect);\n\n\t\t\t\t// Handle props that can temporarily get out of sync with the parent\n\t\t\t\t/** @type {Record<string, (v?: unknown) => unknown>} */\n\t\t\t\ttarget.special[key] = prop(\n\t\t\t\t\t{\n\t\t\t\t\t\tget [key]() {\n\t\t\t\t\t\t\treturn target.props[key];\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t/** @type {string} */ (key),\n\t\t\t\t\tPROPS_IS_UPDATED\n\t\t\t\t);\n\t\t\t} finally {\n\t\t\t\tset_active_effect(previous_effect);\n\t\t\t}\n\t\t}\n\n\t\ttarget.special[key](value);\n\t\tupdate(target.version); // $$props is coarse-grained: when $$props.x is updated, usages of $$props.y etc are also rerun\n\t\treturn true;\n\t},\n\tgetOwnPropertyDescriptor(target, key) {\n\t\tif (target.exclude.includes(key)) return;\n\t\tif (key in target.props) {\n\t\t\treturn {\n\t\t\t\tenumerable: true,\n\t\t\t\tconfigurable: true,\n\t\t\t\tvalue: target.props[key]\n\t\t\t};\n\t\t}\n\t},\n\tdeleteProperty(target, key) {\n\t\t// Svelte 4 allowed for deletions on $$restProps\n\t\tif (target.exclude.includes(key)) return true;\n\t\ttarget.exclude.push(key);\n\t\tupdate(target.version);\n\t\treturn true;\n\t},\n\thas(target, key) {\n\t\tif (target.exclude.includes(key)) return false;\n\t\treturn key in target.props;\n\t},\n\townKeys(target) {\n\t\treturn Reflect.ownKeys(target.props).filter((key) => !target.exclude.includes(key));\n\t}\n};\n\n/**\n * @param {Record<string, unknown>} props\n * @param {string[]} exclude\n * @returns {Record<string, unknown>}\n */\nexport function legacy_rest_props(props, exclude) {\n\treturn new Proxy(\n\t\t{\n\t\t\tprops,\n\t\t\texclude,\n\t\t\tspecial: {},\n\t\t\tversion: source(0),\n\t\t\t// TODO this is only necessary because we need to track component\n\t\t\t// destruction inside `prop`, because of `bind:this`, but it\n\t\t\t// seems likely that we can simplify `bind:this` instead\n\t\t\tparent_effect: /** @type {Effect} */ (active_effect)\n\t\t},\n\t\tlegacy_rest_props_handler\n\t);\n}\n\n/**\n * The proxy handler for spread props. Handles the incoming array of props\n * that looks like `() => { dynamic: props }, { static: prop }, ..` and wraps\n * them so that the whole thing is passed to the component as the `$$props` argument.\n * @type {ProxyHandler<{ props: Array<Record<string | symbol, unknown> | (() => Record<string | symbol, unknown>)> }>}}\n */\nconst spread_props_handler = {\n\tget(target, key) {\n\t\tlet i = target.props.length;\n\t\twhile (i--) {\n\t\t\tlet p = target.props[i];\n\t\t\tif (is_function(p)) p = p();\n\t\t\tif (typeof p === 'object' && p !== null && key in p) return p[key];\n\t\t}\n\t},\n\tset(target, key, value) {\n\t\tlet i = target.props.length;\n\t\twhile (i--) {\n\t\t\tlet p = target.props[i];\n\t\t\tif (is_function(p)) p = p();\n\t\t\tconst desc = get_descriptor(p, key);\n\t\t\tif (desc && desc.set) {\n\t\t\t\tdesc.set(value);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t},\n\tgetOwnPropertyDescriptor(target, key) {\n\t\tlet i = target.props.length;\n\t\twhile (i--) {\n\t\t\tlet p = target.props[i];\n\t\t\tif (is_function(p)) p = p();\n\t\t\tif (typeof p === 'object' && p !== null && key in p) {\n\t\t\t\tconst descriptor = get_descriptor(p, key);\n\t\t\t\tif (descriptor && !descriptor.configurable) {\n\t\t\t\t\t// Prevent a \"Non-configurability Report Error\": The target is an array, it does\n\t\t\t\t\t// not actually contain this property. If it is now described as non-configurable,\n\t\t\t\t\t// the proxy throws a validation error. Setting it to true avoids that.\n\t\t\t\t\tdescriptor.configurable = true;\n\t\t\t\t}\n\t\t\t\treturn descriptor;\n\t\t\t}\n\t\t}\n\t},\n\thas(target, key) {\n\t\t// To prevent a false positive `is_entry_props` in the `prop` function\n\t\tif (key === STATE_SYMBOL || key === LEGACY_PROPS) return false;\n\n\t\tfor (let p of target.props) {\n\t\t\tif (is_function(p)) p = p();\n\t\t\tif (p != null && key in p) return true;\n\t\t}\n\n\t\treturn false;\n\t},\n\townKeys(target) {\n\t\t/** @type {Array<string | symbol>} */\n\t\tconst keys = [];\n\n\t\tfor (let p of target.props) {\n\t\t\tif (is_function(p)) p = p();\n\t\t\tif (!p) continue;\n\n\t\t\tfor (const key in p) {\n\t\t\t\tif (!keys.includes(key)) keys.push(key);\n\t\t\t}\n\n\t\t\tfor (const key of Object.getOwnPropertySymbols(p)) {\n\t\t\t\tif (!keys.includes(key)) keys.push(key);\n\t\t\t}\n\t\t}\n\n\t\treturn keys;\n\t}\n};\n\n/**\n * @param {Array<Record<string, unknown> | (() => Record<string, unknown>)>} props\n * @returns {any}\n */\nexport function spread_props(...props) {\n\treturn new Proxy({ props }, spread_props_handler);\n}\n\n/**\n * This function is responsible for synchronizing a possibly bound prop with the inner component state.\n * It is used whenever the compiler sees that the component writes to the prop, or when it has a default prop_value.\n * @template V\n * @param {Record<string, unknown>} props\n * @param {string} key\n * @param {number} flags\n * @param {V | (() => V)} [fallback]\n * @returns {(() => V | ((arg: V) => V) | ((arg: V, mutation: boolean) => V))}\n */\nexport function prop(props, key, flags, fallback) {\n\tvar runes = !legacy_mode_flag || (flags & PROPS_IS_RUNES) !== 0;\n\tvar bindable = (flags & PROPS_IS_BINDABLE) !== 0;\n\tvar lazy = (flags & PROPS_IS_LAZY_INITIAL) !== 0;\n\n\tvar fallback_value = /** @type {V} */ (fallback);\n\tvar fallback_dirty = true;\n\tvar fallback_signal = /** @type {Derived<V> | undefined} */ (undefined);\n\n\tvar get_fallback = () => {\n\t\tif (lazy && runes) {\n\t\t\tfallback_signal ??= derived(/** @type {() => V} */ (fallback));\n\t\t\treturn get(fallback_signal);\n\t\t}\n\n\t\tif (fallback_dirty) {\n\t\t\tfallback_dirty = false;\n\n\t\t\tfallback_value = lazy\n\t\t\t\t? untrack(/** @type {() => V} */ (fallback))\n\t\t\t\t: /** @type {V} */ (fallback);\n\t\t}\n\n\t\treturn fallback_value;\n\t};\n\n\t/** @type {((v: V) => void) | undefined} */\n\tlet setter;\n\n\tif (bindable) {\n\t\t// Can be the case when someone does `mount(Component, props)` with `let props = $state({...})`\n\t\t// or `createClassComponent(Component, props)`\n\t\tvar is_entry_props = STATE_SYMBOL in props || LEGACY_PROPS in props;\n\n\t\tsetter =\n\t\t\tget_descriptor(props, key)?.set ??\n\t\t\t(is_entry_props && key in props ? (v) => (props[key] = v) : undefined);\n\t}\n\n\t/** @type {V} */\n\tvar initial_value;\n\tvar is_store_sub = false;\n\n\tif (bindable) {\n\t\t[initial_value, is_store_sub] = capture_store_binding(() => /** @type {V} */ (props[key]));\n\t} else {\n\t\tinitial_value = /** @type {V} */ (props[key]);\n\t}\n\n\tif (initial_value === undefined && fallback !== undefined) {\n\t\tinitial_value = get_fallback();\n\n\t\tif (setter) {\n\t\t\tif (runes) e.props_invalid_value(key);\n\t\t\tsetter(initial_value);\n\t\t}\n\t}\n\n\t/** @type {() => V} */\n\tvar getter;\n\n\tif (runes) {\n\t\tgetter = () => {\n\t\t\tvar value = /** @type {V} */ (props[key]);\n\t\t\tif (value === undefined) return get_fallback();\n\t\t\tfallback_dirty = true;\n\t\t\treturn value;\n\t\t};\n\t} else {\n\t\tgetter = () => {\n\t\t\tvar value = /** @type {V} */ (props[key]);\n\n\t\t\tif (value !== undefined) {\n\t\t\t\t// in legacy mode, we don't revert to the fallback value\n\t\t\t\t// if the prop goes from defined to undefined. The easiest\n\t\t\t\t// way to model this is to make the fallback undefined\n\t\t\t\t// as soon as the prop has a value\n\t\t\t\tfallback_value = /** @type {V} */ (undefined);\n\t\t\t}\n\n\t\t\treturn value === undefined ? fallback_value : value;\n\t\t};\n\t}\n\n\t// prop is never written to — we only need a getter\n\tif (runes && (flags & PROPS_IS_UPDATED) === 0) {\n\t\treturn getter;\n\t}\n\n\t// prop is written to, but the parent component had `bind:foo` which\n\t// means we can just call `$$props.foo = value` directly\n\tif (setter) {\n\t\tvar legacy_parent = props.$$legacy;\n\t\treturn /** @type {() => V} */ (\n\t\t\tfunction (/** @type {V} */ value, /** @type {boolean} */ mutation) {\n\t\t\t\tif (arguments.length > 0) {\n\t\t\t\t\t// We don't want to notify if the value was mutated and the parent is in runes mode.\n\t\t\t\t\t// In that case the state proxy (if it exists) should take care of the notification.\n\t\t\t\t\t// If the parent is not in runes mode, we need to notify on mutation, too, that the prop\n\t\t\t\t\t// has changed because the parent will not be able to detect the change otherwise.\n\t\t\t\t\tif (!runes || !mutation || legacy_parent || is_store_sub) {\n\t\t\t\t\t\t/** @type {Function} */ (setter)(mutation ? getter() : value);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn value;\n\t\t\t\t}\n\n\t\t\t\treturn getter();\n\t\t\t}\n\t\t);\n\t}\n\n\t// Either prop is written to, but there's no binding, which means we\n\t// create a derived that we can write to locally.\n\t// Or we are in legacy mode where we always create a derived to replicate that\n\t// Svelte 4 did not trigger updates when a primitive value was updated to the same value.\n\tvar overridden = false;\n\n\tvar d = ((flags & PROPS_IS_IMMUTABLE) !== 0 ? derived : derived_safe_equal)(() => {\n\t\toverridden = false;\n\t\treturn getter();\n\t});\n\n\tif (DEV) {\n\t\td.label = key;\n\t}\n\n\t// Capture the initial value if it's bindable\n\tif (bindable) get(d);\n\n\tvar parent_effect = /** @type {Effect} */ (active_effect);\n\n\treturn /** @type {() => V} */ (\n\t\tfunction (/** @type {any} */ value, /** @type {boolean} */ mutation) {\n\t\t\tif (arguments.length > 0) {\n\t\t\t\tconst new_value = mutation ? get(d) : runes && bindable ? proxy(value) : value;\n\n\t\t\t\tset(d, new_value);\n\t\t\t\toverridden = true;\n\n\t\t\t\tif (fallback_value !== undefined) {\n\t\t\t\t\tfallback_value = new_value;\n\t\t\t\t}\n\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t\t// special case — avoid recalculating the derived if we're in a\n\t\t\t// teardown function and the prop was overridden locally, or the\n\t\t\t// component was already destroyed (people could access props in a timeout)\n\t\t\tif ((is_destroying_effect && overridden) || (parent_effect.f & DESTROYED) !== 0) {\n\t\t\t\treturn d.v;\n\t\t\t}\n\n\t\t\treturn get(d);\n\t\t}\n\t);\n}\n","/** @import { ComponentConstructorOptions, ComponentType, SvelteComponent, Component } from 'svelte' */\nimport { DIRTY, LEGACY_PROPS, MAYBE_DIRTY } from '../internal/client/constants.js';\nimport { user_pre_effect } from '../internal/client/reactivity/effects.js';\nimport { mutable_source, set } from '../internal/client/reactivity/sources.js';\nimport { hydrate, mount, unmount } from '../internal/client/render.js';\nimport { active_effect, get } from '../internal/client/runtime.js';\nimport { flushSync } from '../internal/client/reactivity/batch.js';\nimport { define_property, is_array } from '../internal/shared/utils.js';\nimport * as e from '../internal/client/errors.js';\nimport * as w from '../internal/client/warnings.js';\nimport { DEV } from 'esm-env';\nimport { FILENAME } from '../constants.js';\nimport { component_context, dev_current_component_function } from '../internal/client/context.js';\nimport { async_mode_flag } from '../internal/flags/index.js';\nimport { set_signal_status } from '../internal/client/reactivity/status.js';\n\n/**\n * Takes the same options as a Svelte 4 component and the component function and returns a Svelte 4 compatible component.\n *\n * @deprecated Use this only as a temporary solution to migrate your imperative component code to Svelte 5.\n *\n * @template {Record<string, any>} Props\n * @template {Record<string, any>} Exports\n * @template {Record<string, any>} Events\n * @template {Record<string, any>} Slots\n *\n * @param {ComponentConstructorOptions<Props> & {\n * \tcomponent: ComponentType<SvelteComponent<Props, Events, Slots>> | Component<Props>;\n * }} options\n * @returns {SvelteComponent<Props, Events, Slots> & Exports}\n */\nexport function createClassComponent(options) {\n\t// @ts-expect-error $$prop_def etc are not actually defined\n\treturn new Svelte4Component(options);\n}\n\n/**\n * Takes the component function and returns a Svelte 4 compatible component constructor.\n *\n * @deprecated Use this only as a temporary solution to migrate your imperative component code to Svelte 5.\n *\n * @template {Record<string, any>} Props\n * @template {Record<string, any>} Exports\n * @template {Record<string, any>} Events\n * @template {Record<string, any>} Slots\n *\n * @param {SvelteComponent<Props, Events, Slots> | Component<Props>} component\n * @returns {ComponentType<SvelteComponent<Props, Events, Slots> & Exports>}\n */\nexport function asClassComponent(component) {\n\t// @ts-expect-error $$prop_def etc are not actually defined\n\treturn class extends Svelte4Component {\n\t\t/** @param {any} options */\n\t\tconstructor(options) {\n\t\t\tsuper({\n\t\t\t\tcomponent,\n\t\t\t\t...options\n\t\t\t});\n\t\t}\n\t};\n}\n\n/**\n * Support using the component as both a class and function during the transition period\n * @typedef {{new (o: ComponentConstructorOptions): SvelteComponent;(...args: Parameters<Component<Record<string, any>>>): ReturnType<Component<Record<string, any>, Record<string, any>>>;}} LegacyComponentType\n */\n\nclass Svelte4Component {\n\t/** @type {any} */\n\t#events;\n\n\t/** @type {Record<string, any>} */\n\t#instance;\n\n\t/**\n\t * @param {ComponentConstructorOptions & {\n\t * component: any;\n\t * }} options\n\t */\n\tconstructor(options) {\n\t\tvar sources = new Map();\n\n\t\t/**\n\t\t * @param {string | symbol} key\n\t\t * @param {unknown} value\n\t\t */\n\t\tvar add_source = (key, value) => {\n\t\t\tvar s = mutable_source(value, false, false);\n\t\t\tsources.set(key, s);\n\t\t\treturn s;\n\t\t};\n\n\t\t// Replicate coarse-grained props through a proxy that has a version source for\n\t\t// each property, which is incremented on updates to the property itself. Do not\n\t\t// use our $state proxy because that one has fine-grained reactivity.\n\t\tconst props = new Proxy(\n\t\t\t{ ...(options.props || {}), $$events: {} },\n\t\t\t{\n\t\t\t\tget(target, prop) {\n\t\t\t\t\treturn get(sources.get(prop) ?? add_source(prop, Reflect.get(target, prop)));\n\t\t\t\t},\n\t\t\t\thas(target, prop) {\n\t\t\t\t\t// Necessary to not throw \"invalid binding\" validation errors on the component side\n\t\t\t\t\tif (prop === LEGACY_PROPS) return true;\n\n\t\t\t\t\tget(sources.get(prop) ?? add_source(prop, Reflect.get(target, prop)));\n\t\t\t\t\treturn Reflect.has(target, prop);\n\t\t\t\t},\n\t\t\t\tset(target, prop, value) {\n\t\t\t\t\tset(sources.get(prop) ?? add_source(prop, value), value);\n\t\t\t\t\treturn Reflect.set(target, prop, value);\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\tconst render_options = {\n\t\t\ttarget: options.target,\n\t\t\tanchor: options.anchor,\n\t\t\tprops,\n\t\t\tcontext: options.context,\n\t\t\tintro: options.intro ?? false,\n\t\t\trecover: options.recover,\n\t\t\ttransformError: options.transformError\n\t\t};\n\n\t\tthis.#instance = options.hydrate\n\t\t\t? hydrate(options.component, render_options)\n\t\t\t: mount(options.component, render_options);\n\n\t\t// We don't flushSync for custom element wrappers or if the user doesn't want it,\n\t\t// or if we're in async mode since `flushSync()` will fail\n\t\tif (!async_mode_flag && (!options?.props?.$$host || options.sync === false)) {\n\t\t\tflushSync();\n\t\t}\n\n\t\tthis.#events = props.$$events;\n\n\t\tfor (const key of Object.keys(this.#instance)) {\n\t\t\tif (key === '$set' || key === '$destroy' || key === '$on') continue;\n\t\t\tdefine_property(this, key, {\n\t\t\t\tget() {\n\t\t\t\t\treturn this.#instance[key];\n\t\t\t\t},\n\t\t\t\t/** @param {any} value */\n\t\t\t\tset(value) {\n\t\t\t\t\tthis.#instance[key] = value;\n\t\t\t\t},\n\t\t\t\tenumerable: true\n\t\t\t});\n\t\t}\n\n\t\tthis.#instance.$set = /** @param {Record<string, any>} next */ (next) => {\n\t\t\tObject.assign(props, next);\n\t\t};\n\n\t\tthis.#instance.$destroy = () => {\n\t\t\tunmount(this.#instance);\n\t\t};\n\t}\n\n\t/** @param {Record<string, any>} props */\n\t$set(props) {\n\t\tthis.#instance.$set(props);\n\t}\n\n\t/**\n\t * @param {string} event\n\t * @param {(...args: any[]) => any} callback\n\t * @returns {any}\n\t */\n\t$on(event, callback) {\n\t\tthis.#events[event] = this.#events[event] || [];\n\n\t\t/** @param {any[]} args */\n\t\tconst cb = (...args) => callback.call(this, ...args);\n\t\tthis.#events[event].push(cb);\n\t\treturn () => {\n\t\t\tthis.#events[event] = this.#events[event].filter(/** @param {any} fn */ (fn) => fn !== cb);\n\t\t};\n\t}\n\n\t$destroy() {\n\t\tthis.#instance.$destroy();\n\t}\n}\n\n/**\n * Runs the given function once immediately on the server, and works like `$effect.pre` on the client.\n *\n * @deprecated Use this only as a temporary solution to migrate your component code to Svelte 5.\n * @param {() => void | (() => void)} fn\n * @returns {void}\n */\nexport function run(fn) {\n\tuser_pre_effect(() => {\n\t\tfn();\n\t\tvar effect = /** @type {import('#client').Effect} */ (active_effect);\n\t\t// If the effect is immediately made dirty again, mark it as maybe dirty to emulate legacy behaviour\n\t\tif ((effect.f & DIRTY) !== 0) {\n\t\t\tlet filename = \"a file (we can't know which one)\";\n\t\t\tif (DEV) {\n\t\t\t\t// @ts-ignore\n\t\t\t\tfilename = dev_current_component_function?.[FILENAME] ?? filename;\n\t\t\t}\n\t\t\tw.legacy_recursive_reactive_block(filename);\n\t\t\tset_signal_status(effect, MAYBE_DIRTY);\n\t\t}\n\t});\n}\n\n/**\n * Function to mimic the multiple listeners available in svelte 4\n * @deprecated\n * @param {EventListener[]} handlers\n * @returns {EventListener}\n */\nexport function handlers(...handlers) {\n\treturn function (event) {\n\t\tconst { stopImmediatePropagation } = event;\n\t\tlet stopped = false;\n\n\t\tevent.stopImmediatePropagation = () => {\n\t\t\tstopped = true;\n\t\t\tstopImmediatePropagation.call(event);\n\t\t};\n\n\t\tconst errors = [];\n\n\t\tfor (const handler of handlers) {\n\t\t\ttry {\n\t\t\t\t// @ts-expect-error `this` is not typed\n\t\t\t\thandler?.call(this, event);\n\t\t\t} catch (e) {\n\t\t\t\terrors.push(e);\n\t\t\t}\n\n\t\t\tif (stopped) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tfor (let error of errors) {\n\t\t\tqueueMicrotask(() => {\n\t\t\t\tthrow error;\n\t\t\t});\n\t\t}\n\t};\n}\n\n/**\n * Function to create a `bubble` function that mimic the behavior of `on:click` without handler available in svelte 4.\n * @deprecated Use this only as a temporary solution to migrate your automatically delegated events in Svelte 5.\n */\nexport function createBubbler() {\n\tconst active_component_context = component_context;\n\tif (active_component_context === null) {\n\t\te.lifecycle_outside_component('createBubbler');\n\t}\n\n\treturn (/**@type {string}*/ type) => (/**@type {Event}*/ event) => {\n\t\tconst events = /** @type {Record<string, Function | Function[]>} */ (\n\t\t\tactive_component_context.s.$$events\n\t\t)?.[/** @type {any} */ (type)];\n\n\t\tif (events) {\n\t\t\tconst callbacks = is_array(events) ? events.slice() : [events];\n\t\t\tfor (const fn of callbacks) {\n\t\t\t\tfn.call(active_component_context.x, event);\n\t\t\t}\n\t\t\treturn !event.defaultPrevented;\n\t\t}\n\t\treturn true;\n\t};\n}\n\nexport {\n\tonce,\n\tpreventDefault,\n\tself,\n\tstopImmediatePropagation,\n\tstopPropagation,\n\ttrusted,\n\tpassive,\n\tnonpassive\n} from '../internal/client/dom/legacy/event-modifiers.js';\n","import { createClassComponent } from '../../../../legacy/legacy-client.js';\nimport { effect_root, render_effect } from '../../reactivity/effects.js';\nimport { append } from '../template.js';\nimport { define_property, get_descriptor, object_keys } from '../../../shared/utils.js';\nimport { create_element } from '../operations.js';\n\n/**\n * @typedef {Object} CustomElementPropDefinition\n * @property {string} [attribute]\n * @property {boolean} [reflect]\n * @property {'String'|'Boolean'|'Number'|'Array'|'Object'} [type]\n */\n\n/** @type {any} */\nlet SvelteElement;\n\nif (typeof HTMLElement === 'function') {\n\tSvelteElement = class extends HTMLElement {\n\t\t/** The Svelte component constructor */\n\t\t$$ctor;\n\t\t/** Slots */\n\t\t$$s;\n\t\t/** @type {any} The Svelte component instance */\n\t\t$$c;\n\t\t/** Whether or not the custom element is connected */\n\t\t$$cn = false;\n\t\t/** @type {Record<string, any>} Component props data */\n\t\t$$d = {};\n\t\t/** `true` if currently in the process of reflecting component props back to attributes */\n\t\t$$r = false;\n\t\t/** @type {Record<string, CustomElementPropDefinition>} Props definition (name, reflected, type etc) */\n\t\t$$p_d = {};\n\t\t/** @type {Record<string, EventListenerOrEventListenerObject[]>} Event listeners */\n\t\t$$l = {};\n\t\t/** @type {Map<EventListenerOrEventListenerObject, Function>} Event listener unsubscribe functions */\n\t\t$$l_u = new Map();\n\t\t/** @type {any} The managed render effect for reflecting attributes */\n\t\t$$me;\n\t\t/** @type {ShadowRoot | null} The ShadowRoot of the custom element */\n\t\t$$shadowRoot = null;\n\n\t\t/**\n\t\t * @param {*} $$componentCtor\n\t\t * @param {*} $$slots\n\t\t * @param {ShadowRootInit | undefined} shadow_root_init\n\t\t */\n\t\tconstructor($$componentCtor, $$slots, shadow_root_init) {\n\t\t\tsuper();\n\t\t\tthis.$$ctor = $$componentCtor;\n\t\t\tthis.$$s = $$slots;\n\n\t\t\tif (shadow_root_init) {\n\t\t\t\t// We need to store the reference to shadow root, because `closed` shadow root cannot be\n\t\t\t\t// accessed with `this.shadowRoot`.\n\t\t\t\tthis.$$shadowRoot = this.attachShadow(shadow_root_init);\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * @param {string} type\n\t\t * @param {EventListenerOrEventListenerObject} listener\n\t\t * @param {boolean | AddEventListenerOptions} [options]\n\t\t */\n\t\taddEventListener(type, listener, options) {\n\t\t\t// We can't determine upfront if the event is a custom event or not, so we have to\n\t\t\t// listen to both. If someone uses a custom event with the same name as a regular\n\t\t\t// browser event, this fires twice - we can't avoid that.\n\t\t\tthis.$$l[type] = this.$$l[type] || [];\n\t\t\tthis.$$l[type].push(listener);\n\t\t\tif (this.$$c) {\n\t\t\t\tconst unsub = this.$$c.$on(type, listener);\n\t\t\t\tthis.$$l_u.set(listener, unsub);\n\t\t\t}\n\t\t\tsuper.addEventListener(type, listener, options);\n\t\t}\n\n\t\t/**\n\t\t * @param {string} type\n\t\t * @param {EventListenerOrEventListenerObject} listener\n\t\t * @param {boolean | AddEventListenerOptions} [options]\n\t\t */\n\t\tremoveEventListener(type, listener, options) {\n\t\t\tsuper.removeEventListener(type, listener, options);\n\t\t\tif (this.$$c) {\n\t\t\t\tconst unsub = this.$$l_u.get(listener);\n\t\t\t\tif (unsub) {\n\t\t\t\t\tunsub();\n\t\t\t\t\tthis.$$l_u.delete(listener);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tasync connectedCallback() {\n\t\t\tthis.$$cn = true;\n\t\t\tif (!this.$$c) {\n\t\t\t\t// We wait one tick to let possible child slot elements be created/mounted\n\t\t\t\tawait Promise.resolve();\n\t\t\t\tif (!this.$$cn || this.$$c) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t/** @param {string} name */\n\t\t\t\tfunction create_slot(name) {\n\t\t\t\t\t/**\n\t\t\t\t\t * @param {Element} anchor\n\t\t\t\t\t */\n\t\t\t\t\treturn (anchor) => {\n\t\t\t\t\t\tconst slot = create_element('slot');\n\t\t\t\t\t\tif (name !== 'default') slot.name = name;\n\n\t\t\t\t\t\tappend(anchor, slot);\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\t/** @type {Record<string, any>} */\n\t\t\t\tconst $$slots = {};\n\t\t\t\tconst existing_slots = get_custom_elements_slots(this);\n\t\t\t\tfor (const name of this.$$s) {\n\t\t\t\t\tif (name in existing_slots) {\n\t\t\t\t\t\tif (name === 'default' && !this.$$d.children) {\n\t\t\t\t\t\t\tthis.$$d.children = create_slot(name);\n\t\t\t\t\t\t\t$$slots.default = true;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$$slots[name] = create_slot(name);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (const attribute of this.attributes) {\n\t\t\t\t\t// this.$$data takes precedence over this.attributes\n\t\t\t\t\tconst name = this.$$g_p(attribute.name);\n\t\t\t\t\tif (!(name in this.$$d)) {\n\t\t\t\t\t\tthis.$$d[name] = get_custom_element_value(name, attribute.value, this.$$p_d, 'toProp');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Port over props that were set programmatically before ce was initialized\n\t\t\t\tfor (const key in this.$$p_d) {\n\t\t\t\t\t// @ts-expect-error\n\t\t\t\t\tif (!(key in this.$$d) && this[key] !== undefined) {\n\t\t\t\t\t\t// @ts-expect-error\n\t\t\t\t\t\tthis.$$d[key] = this[key]; // don't transform, these were set through JavaScript\n\t\t\t\t\t\t// @ts-expect-error\n\t\t\t\t\t\tdelete this[key]; // remove the property that shadows the getter/setter\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.$$c = createClassComponent({\n\t\t\t\t\tcomponent: this.$$ctor,\n\t\t\t\t\ttarget: this.$$shadowRoot || this,\n\t\t\t\t\tprops: {\n\t\t\t\t\t\t...this.$$d,\n\t\t\t\t\t\t$$slots,\n\t\t\t\t\t\t$$host: this\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\t// Reflect component props as attributes\n\t\t\t\tthis.$$me = effect_root(() => {\n\t\t\t\t\trender_effect(() => {\n\t\t\t\t\t\tthis.$$r = true;\n\t\t\t\t\t\tfor (const key of object_keys(this.$$c)) {\n\t\t\t\t\t\t\tif (!this.$$p_d[key]?.reflect) continue;\n\t\t\t\t\t\t\tthis.$$d[key] = this.$$c[key];\n\t\t\t\t\t\t\tconst attribute_value = get_custom_element_value(\n\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t\tthis.$$d[key],\n\t\t\t\t\t\t\t\tthis.$$p_d,\n\t\t\t\t\t\t\t\t'toAttribute'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tif (attribute_value == null) {\n\t\t\t\t\t\t\t\tthis.removeAttribute(this.$$p_d[key].attribute || key);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthis.setAttribute(this.$$p_d[key].attribute || key, attribute_value);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.$$r = false;\n\t\t\t\t\t});\n\t\t\t\t});\n\n\t\t\t\tfor (const type in this.$$l) {\n\t\t\t\t\tfor (const listener of this.$$l[type]) {\n\t\t\t\t\t\tconst unsub = this.$$c.$on(type, listener);\n\t\t\t\t\t\tthis.$$l_u.set(listener, unsub);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.$$l = {};\n\t\t\t}\n\t\t}\n\n\t\t// We don't need this when working within Svelte code, but for compatibility of people using this outside of Svelte\n\t\t// and setting attributes through setAttribute etc, this is helpful\n\n\t\t/**\n\t\t * @param {string} attr\n\t\t * @param {string} _oldValue\n\t\t * @param {string} newValue\n\t\t */\n\t\tattributeChangedCallback(attr, _oldValue, newValue) {\n\t\t\tif (this.$$r) return;\n\t\t\tattr = this.$$g_p(attr);\n\t\t\tthis.$$d[attr] = get_custom_element_value(attr, newValue, this.$$p_d, 'toProp');\n\t\t\tthis.$$c?.$set({ [attr]: this.$$d[attr] });\n\t\t}\n\n\t\tdisconnectedCallback() {\n\t\t\tthis.$$cn = false;\n\t\t\t// In a microtask, because this could be a move within the DOM\n\t\t\tPromise.resolve().then(() => {\n\t\t\t\tif (!this.$$cn && this.$$c) {\n\t\t\t\t\tthis.$$c.$destroy();\n\t\t\t\t\tthis.$$me();\n\t\t\t\t\tthis.$$c = undefined;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\t/**\n\t\t * @param {string} attribute_name\n\t\t */\n\t\t$$g_p(attribute_name) {\n\t\t\treturn (\n\t\t\t\tobject_keys(this.$$p_d).find(\n\t\t\t\t\t(key) =>\n\t\t\t\t\t\tthis.$$p_d[key].attribute === attribute_name ||\n\t\t\t\t\t\t(!this.$$p_d[key].attribute && key.toLowerCase() === attribute_name)\n\t\t\t\t) || attribute_name\n\t\t\t);\n\t\t}\n\t};\n}\n\n/**\n * @param {string} prop\n * @param {any} value\n * @param {Record<string, CustomElementPropDefinition>} props_definition\n * @param {'toAttribute' | 'toProp'} [transform]\n */\nfunction get_custom_element_value(prop, value, props_definition, transform) {\n\tconst type = props_definition[prop]?.type;\n\tvalue = type === 'Boolean' && typeof value !== 'boolean' ? value != null : value;\n\tif (!transform || !props_definition[prop]) {\n\t\treturn value;\n\t} else if (transform === 'toAttribute') {\n\t\tswitch (type) {\n\t\t\tcase 'Object':\n\t\t\tcase 'Array':\n\t\t\t\treturn value == null ? null : JSON.stringify(value);\n\t\t\tcase 'Boolean':\n\t\t\t\treturn value ? '' : null;\n\t\t\tcase 'Number':\n\t\t\t\treturn value == null ? null : value;\n\t\t\tdefault:\n\t\t\t\treturn value;\n\t\t}\n\t} else {\n\t\tswitch (type) {\n\t\t\tcase 'Object':\n\t\t\tcase 'Array':\n\t\t\t\treturn value && JSON.parse(value);\n\t\t\tcase 'Boolean':\n\t\t\t\treturn value; // conversion already handled above\n\t\t\tcase 'Number':\n\t\t\t\treturn value != null ? +value : value;\n\t\t\tdefault:\n\t\t\t\treturn value;\n\t\t}\n\t}\n}\n\n/**\n * @param {HTMLElement} element\n */\nfunction get_custom_elements_slots(element) {\n\t/** @type {Record<string, true>} */\n\tconst result = {};\n\telement.childNodes.forEach((node) => {\n\t\tresult[/** @type {Element} node */ (node).slot || 'default'] = true;\n\t});\n\treturn result;\n}\n\n/**\n * @internal\n *\n * Turn a Svelte component into a custom element.\n * @param {any} Component A Svelte component function\n * @param {Record<string, CustomElementPropDefinition>} props_definition The props to observe\n * @param {string[]} slots The slots to create\n * @param {string[]} exports Explicitly exported values, other than props\n * @param {ShadowRootInit | undefined} shadow_root_init Options passed to shadow DOM constructor\n * @param {(ce: new () => HTMLElement) => new () => HTMLElement} [extend]\n */\nexport function create_custom_element(\n\tComponent,\n\tprops_definition,\n\tslots,\n\texports,\n\tshadow_root_init,\n\textend\n) {\n\tlet Class = class extends SvelteElement {\n\t\tconstructor() {\n\t\t\tsuper(Component, slots, shadow_root_init);\n\t\t\tthis.$$p_d = props_definition;\n\t\t}\n\t\tstatic get observedAttributes() {\n\t\t\treturn object_keys(props_definition).map((key) =>\n\t\t\t\t(props_definition[key].attribute || key).toLowerCase()\n\t\t\t);\n\t\t}\n\t};\n\tobject_keys(props_definition).forEach((prop) => {\n\t\tdefine_property(Class.prototype, prop, {\n\t\t\tget() {\n\t\t\t\treturn this.$$c && prop in this.$$c ? this.$$c[prop] : this.$$d[prop];\n\t\t\t},\n\t\t\tset(value) {\n\t\t\t\tvalue = get_custom_element_value(prop, value, props_definition);\n\t\t\t\tthis.$$d[prop] = value;\n\t\t\t\tvar component = this.$$c;\n\n\t\t\t\tif (component) {\n\t\t\t\t\t// // If the instance has an accessor, use that instead\n\t\t\t\t\tvar setter = get_descriptor(component, prop)?.get;\n\n\t\t\t\t\tif (setter) {\n\t\t\t\t\t\tcomponent[prop] = value;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcomponent.$set({ [prop]: value });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t});\n\texports.forEach((property) => {\n\t\tdefine_property(Class.prototype, property, {\n\t\t\tget() {\n\t\t\t\treturn this.$$c?.[property];\n\t\t\t}\n\t\t});\n\t});\n\tif (extend) {\n\t\t// @ts-expect-error - assigning here is fine\n\t\tClass = extend(Class);\n\t}\n\tComponent.element = /** @type {any} */ Class;\n\treturn Class;\n}\n","/** @import { ComponentContext, ComponentContextLegacy } from '#client' */\n/** @import { EventDispatcher } from './index.js' */\n/** @import { NotFunction } from './internal/types.js' */\nimport { active_reaction, get_abort_signal, untrack } from './internal/client/runtime.js';\nimport { is_array } from './internal/shared/utils.js';\nimport { user_effect } from './internal/client/index.js';\nimport * as e from './internal/client/errors.js';\nimport { legacy_mode_flag } from './internal/flags/index.js';\nimport { component_context } from './internal/client/context.js';\nimport { DEV } from 'esm-env';\n\nif (DEV) {\n\t/**\n\t * @param {string} rune\n\t */\n\tfunction throw_rune_error(rune) {\n\t\tif (!(rune in globalThis)) {\n\t\t\t// TODO if people start adjusting the \"this can contain runes\" config through v-p-s more, adjust this message\n\t\t\t/** @type {any} */\n\t\t\tlet value; // let's hope no one modifies this global, but belts and braces\n\t\t\tObject.defineProperty(globalThis, rune, {\n\t\t\t\tconfigurable: true,\n\t\t\t\t// eslint-disable-next-line getter-return\n\t\t\t\tget: () => {\n\t\t\t\t\tif (value !== undefined) {\n\t\t\t\t\t\treturn value;\n\t\t\t\t\t}\n\n\t\t\t\t\te.rune_outside_svelte(rune);\n\t\t\t\t},\n\t\t\t\tset: (v) => {\n\t\t\t\t\tvalue = v;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tthrow_rune_error('$state');\n\tthrow_rune_error('$effect');\n\tthrow_rune_error('$derived');\n\tthrow_rune_error('$inspect');\n\tthrow_rune_error('$props');\n\tthrow_rune_error('$bindable');\n}\n\n/**\n * Returns an [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that aborts when the current [derived](https://svelte.dev/docs/svelte/$derived) or [effect](https://svelte.dev/docs/svelte/$effect) re-runs or is destroyed.\n *\n * Must be called while a derived or effect is running, before anything is awaited.\n *\n * ```svelte\n * <script>\n * \timport { getAbortSignal } from 'svelte';\n *\n * \tlet { id } = $props();\n *\n * \tasync function getData(id) {\n * \t\tconst response = await fetch(`/items/${id}`, {\n * \t\t\tsignal: getAbortSignal()\n * \t\t});\n *\n * \t\treturn await response.json();\n * \t}\n *\n * \tconst data = $derived(await getData(id));\n * </script>\n * ```\n */\nexport function getAbortSignal() {\n\tif (active_reaction === null) {\n\t\te.get_abort_signal_outside_reaction();\n\t}\n\n\treturn get_abort_signal(active_reaction);\n}\n\n/**\n * `onMount`, like [`$effect`](https://svelte.dev/docs/svelte/$effect), schedules a function to run as soon as the component has been mounted to the DOM.\n * Unlike `$effect`, the provided function only runs once.\n *\n * It must be called during the component's initialisation (but doesn't need to live _inside_ the component;\n * it can be called from an external module). If a function is returned _synchronously_ from `onMount`,\n * it will be called when the component is unmounted.\n *\n * `onMount` functions do not run during [server-side rendering](https://svelte.dev/docs/svelte/svelte-server#render).\n *\n * @template T\n * @param {() => NotFunction<T> | Promise<NotFunction<T>> | (() => any)} fn\n * @returns {void}\n */\nexport function onMount(fn) {\n\tif (component_context === null) {\n\t\te.lifecycle_outside_component('onMount');\n\t}\n\n\tif (legacy_mode_flag && component_context.l !== null) {\n\t\tinit_update_callbacks(component_context).m.push(fn);\n\t} else {\n\t\tuser_effect(() => {\n\t\t\tconst cleanup = untrack(fn);\n\t\t\tif (typeof cleanup === 'function') return /** @type {() => void} */ (cleanup);\n\t\t});\n\t}\n}\n\n/**\n * Schedules a callback to run immediately before the component is unmounted.\n *\n * Out of `onMount`, `beforeUpdate`, `afterUpdate` and `onDestroy`, this is the\n * only one that runs inside a server-side component.\n *\n * @param {() => any} fn\n * @returns {void}\n */\nexport function onDestroy(fn) {\n\tif (component_context === null) {\n\t\te.lifecycle_outside_component('onDestroy');\n\t}\n\n\tonMount(() => () => untrack(fn));\n}\n\n/**\n * @template [T=any]\n * @param {string} type\n * @param {T} [detail]\n * @param {any}params_0\n * @returns {CustomEvent<T>}\n */\nfunction create_custom_event(type, detail, { bubbles = false, cancelable = false } = {}) {\n\treturn new CustomEvent(type, { detail, bubbles, cancelable });\n}\n\n/**\n * Creates an event dispatcher that can be used to dispatch [component events](https://svelte.dev/docs/svelte/legacy-on#Component-events).\n * Event dispatchers are functions that can take two arguments: `name` and `detail`.\n *\n * Component events created with `createEventDispatcher` create a\n * [CustomEvent](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent).\n * These events do not [bubble](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Events#Event_bubbling_and_capture).\n * The `detail` argument corresponds to the [CustomEvent.detail](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/detail)\n * property and can contain any type of data.\n *\n * The event dispatcher can be typed to narrow the allowed event names and the type of the `detail` argument:\n * ```ts\n * const dispatch = createEventDispatcher<{\n * loaded: null; // does not take a detail argument\n * change: string; // takes a detail argument of type string, which is required\n * optional: number | null; // takes an optional detail argument of type number\n * }>();\n * ```\n *\n * @deprecated Use callback props and/or the `$host()` rune instead — see [migration guide](https://svelte.dev/docs/svelte/v5-migration-guide#Event-changes-Component-events)\n * @template {Record<string, any>} [EventMap = any]\n * @returns {EventDispatcher<EventMap>}\n */\nexport function createEventDispatcher() {\n\tconst active_component_context = component_context;\n\tif (active_component_context === null) {\n\t\te.lifecycle_outside_component('createEventDispatcher');\n\t}\n\n\t/**\n\t * @param [detail]\n\t * @param [options]\n\t */\n\treturn (type, detail, options) => {\n\t\tconst events = /** @type {Record<string, Function | Function[]>} */ (\n\t\t\tactive_component_context.s.$$events\n\t\t)?.[/** @type {string} */ (type)];\n\n\t\tif (events) {\n\t\t\tconst callbacks = is_array(events) ? events.slice() : [events];\n\t\t\t// TODO are there situations where events could be dispatched\n\t\t\t// in a server (non-DOM) environment?\n\t\t\tconst event = create_custom_event(/** @type {string} */ (type), detail, options);\n\t\t\tfor (const fn of callbacks) {\n\t\t\t\tfn.call(active_component_context.x, event);\n\t\t\t}\n\t\t\treturn !event.defaultPrevented;\n\t\t}\n\n\t\treturn true;\n\t};\n}\n\n// TODO mark beforeUpdate and afterUpdate as deprecated in Svelte 6\n\n/**\n * Schedules a callback to run immediately before the component is updated after any state change.\n *\n * The first time the callback runs will be before the initial `onMount`.\n *\n * In runes mode use `$effect.pre` instead.\n *\n * @deprecated Use [`$effect.pre`](https://svelte.dev/docs/svelte/$effect#$effect.pre) instead\n * @param {() => void} fn\n * @returns {void}\n */\nexport function beforeUpdate(fn) {\n\tif (component_context === null) {\n\t\te.lifecycle_outside_component('beforeUpdate');\n\t}\n\n\tif (component_context.l === null) {\n\t\te.lifecycle_legacy_only('beforeUpdate');\n\t}\n\n\tinit_update_callbacks(component_context).b.push(fn);\n}\n\n/**\n * Schedules a callback to run immediately after the component has been updated.\n *\n * The first time the callback runs will be after the initial `onMount`.\n *\n * In runes mode use `$effect` instead.\n *\n * @deprecated Use [`$effect`](https://svelte.dev/docs/svelte/$effect) instead\n * @param {() => void} fn\n * @returns {void}\n */\nexport function afterUpdate(fn) {\n\tif (component_context === null) {\n\t\te.lifecycle_outside_component('afterUpdate');\n\t}\n\n\tif (component_context.l === null) {\n\t\te.lifecycle_legacy_only('afterUpdate');\n\t}\n\n\tinit_update_callbacks(component_context).a.push(fn);\n}\n\n/**\n * Legacy-mode: Init callbacks object for onMount/beforeUpdate/afterUpdate\n * @param {ComponentContext} context\n */\nfunction init_update_callbacks(context) {\n\tvar l = /** @type {ComponentContextLegacy} */ (context).l;\n\treturn (l.u ??= { a: [], b: [], m: [] });\n}\n\nexport { flushSync, fork } from './internal/client/reactivity/batch.js';\nexport {\n\tcreateContext,\n\tgetContext,\n\tgetAllContexts,\n\thasContext,\n\tsetContext\n} from './internal/client/context.js';\nexport { hydratable } from './internal/client/hydratable.js';\nexport { hydrate, mount, unmount } from './internal/client/render.js';\nexport { tick, untrack, settled } from './internal/client/runtime.js';\nexport { createRawSnippet } from './internal/client/dom/blocks/snippet.js';\n","import { init_operations } from './client/dom/operations.js';\n\ninit_operations();\n","import { PUBLIC_VERSION } from '../version.js';\n\nif (typeof window !== 'undefined') {\n\t// @ts-expect-error\n\t((globalThis.__svelte ??= {}).v ??= new Set()).add(PUBLIC_VERSION);\n}\n","export const initial = (name) => (name ?? \"\").trim().slice(0, 1).toUpperCase();\n\nexport const initials = (name) =>\n (name ?? \"\").split(/\\s+/).filter(Boolean).slice(0, 2).map(initial).join(\"\");\n"],"ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57],"mappings":"AAEA,IAAW+B,EAAW,MAAM,QACjBC,EAAW,MAAM,UAAU,QAC3BC,EAAW,MAAM,UAAU,SAC3BC,EAAa,MAAM,KAEnBC,EAAkB,OAAO,eACzBC,EAAiB,OAAO,yBACxBC,EAAkB,OAAO,0BACzBC,EAAmB,OAAO,UAC1BC,EAAkB,MAAM,UACxBC,EAAmB,OAAO,eAC1BC,EAAgB,OAAO,aAWrBC,MAAa,CAAC,EAoB3B,SAAgBC,EAAQC,EAAK,CAC5B,IAAK,IAAIC,EAAI,EAAGA,EAAID,EAAI,OAAQC,IAC/BD,EAAIC,EAAE,CAAC,CAET,CAkBA,SAAgBC,GAAW,CAE1B,IAAIC,EAGAC,EASJ,MAAO,CAAE,QAAA,IANS,SAASC,EAAKC,IAAQ,CACvCH,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