codexLB-up 1.25.0b10__py3-none-any.whl

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 (827) hide show
  1. app/__init__.py +10 -0
  2. app/admin_cli.py +494 -0
  3. app/cli.py +339 -0
  4. app/codex_sessions_retag.py +487 -0
  5. app/core/__init__.py +0 -0
  6. app/core/audit/__init__.py +0 -0
  7. app/core/audit/service.py +216 -0
  8. app/core/audit/types.py +94 -0
  9. app/core/auth/__init__.py +236 -0
  10. app/core/auth/api_key_cache.py +65 -0
  11. app/core/auth/dashboard_access.py +429 -0
  12. app/core/auth/dashboard_mode.py +171 -0
  13. app/core/auth/dashboard_session_ttl.py +74 -0
  14. app/core/auth/dashboard_users_cache.py +120 -0
  15. app/core/auth/dependencies.py +710 -0
  16. app/core/auth/external_identity.py +78 -0
  17. app/core/auth/guardian.py +374 -0
  18. app/core/auth/models.py +49 -0
  19. app/core/auth/providers/__init__.py +129 -0
  20. app/core/auth/providers/oidc.py +838 -0
  21. app/core/auth/providers/registry.py +118 -0
  22. app/core/auth/refresh.py +394 -0
  23. app/core/auth/step_up.py +117 -0
  24. app/core/auth/totp.py +81 -0
  25. app/core/balancer/__init__.py +71 -0
  26. app/core/balancer/logic.py +1612 -0
  27. app/core/balancer/rendezvous_hash.py +21 -0
  28. app/core/balancer/types.py +21 -0
  29. app/core/bootstrap.py +172 -0
  30. app/core/cache/invalidation.py +426 -0
  31. app/core/clients/__init__.py +0 -0
  32. app/core/clients/codex.py +996 -0
  33. app/core/clients/codex_version.py +187 -0
  34. app/core/clients/codex_version_snapshot.py +2 -0
  35. app/core/clients/files.py +534 -0
  36. app/core/clients/headers.py +29 -0
  37. app/core/clients/http.py +511 -0
  38. app/core/clients/model_fetcher.py +276 -0
  39. app/core/clients/native_egress.py +1304 -0
  40. app/core/clients/oauth.py +477 -0
  41. app/core/clients/proxy.py +6089 -0
  42. app/core/clients/proxy_websocket.py +1411 -0
  43. app/core/clients/rate_limit_reset_credits.py +412 -0
  44. app/core/clients/stream_errors.py +12 -0
  45. app/core/clients/thread_cache_identity.py +347 -0
  46. app/core/clients/usage.py +467 -0
  47. app/core/clock.py +170 -0
  48. app/core/config/__init__.py +0 -0
  49. app/core/config/background_jobs.py +73 -0
  50. app/core/config/context_window_overrides.py +166 -0
  51. app/core/config/dashboard_overrides.py +145 -0
  52. app/core/config/inheritable.py +47 -0
  53. app/core/config/key_fingerprint.py +115 -0
  54. app/core/config/settings.py +872 -0
  55. app/core/config/settings_cache.py +100 -0
  56. app/core/config/spool_retention.py +217 -0
  57. app/core/config/tiers.py +174 -0
  58. app/core/conversation_archive.py +568 -0
  59. app/core/crypto.py +37 -0
  60. app/core/draining.py +11 -0
  61. app/core/errors.py +365 -0
  62. app/core/exceptions.py +155 -0
  63. app/core/handlers/__init__.py +3 -0
  64. app/core/handlers/exceptions.py +478 -0
  65. app/core/http_protocol.py +176 -0
  66. app/core/http_protocol_httptools.py +204 -0
  67. app/core/ingress_limits.py +17 -0
  68. app/core/metadata_store.py +18 -0
  69. app/core/metrics/__init__.py +0 -0
  70. app/core/metrics/middleware.py +74 -0
  71. app/core/metrics/prometheus.py +604 -0
  72. app/core/middleware/__init__.py +25 -0
  73. app/core/middleware/api_firewall.py +111 -0
  74. app/core/middleware/app_version.py +37 -0
  75. app/core/middleware/dashboard_auth_proxy.py +55 -0
  76. app/core/middleware/dashboard_csrf.py +177 -0
  77. app/core/middleware/dashboard_gzip.py +41 -0
  78. app/core/middleware/dashboard_overrides.py +59 -0
  79. app/core/middleware/firewall_cache.py +91 -0
  80. app/core/middleware/inflight.py +126 -0
  81. app/core/middleware/multipart_content_encoding.py +129 -0
  82. app/core/middleware/path_rewrite.py +148 -0
  83. app/core/middleware/request_body_limit.py +196 -0
  84. app/core/middleware/request_decompression.py +209 -0
  85. app/core/middleware/request_id.py +72 -0
  86. app/core/middleware/required_capability_http.py +116 -0
  87. app/core/middleware/trusted_proxy_headers.py +36 -0
  88. app/core/multipart.py +237 -0
  89. app/core/multipart_fields.py +91 -0
  90. app/core/openai/__init__.py +0 -0
  91. app/core/openai/chat_requests.py +493 -0
  92. app/core/openai/chat_responses.py +931 -0
  93. app/core/openai/contracts.py +46 -0
  94. app/core/openai/exceptions.py +24 -0
  95. app/core/openai/host_models.py +14 -0
  96. app/core/openai/images.py +413 -0
  97. app/core/openai/message_coercion.py +376 -0
  98. app/core/openai/model_refresh_scheduler.py +423 -0
  99. app/core/openai/model_registry.py +997 -0
  100. app/core/openai/model_registry_store.py +548 -0
  101. app/core/openai/models.py +172 -0
  102. app/core/openai/parsing.py +97 -0
  103. app/core/openai/requests.py +1980 -0
  104. app/core/openai/strict_schema.py +199 -0
  105. app/core/openai/tool_call_safety.py +99 -0
  106. app/core/openai/v1_requests.py +187 -0
  107. app/core/plan_types.py +90 -0
  108. app/core/prestop.py +202 -0
  109. app/core/rate_limiter/__init__.py +0 -0
  110. app/core/rate_limiter/db_rate_limiter.py +215 -0
  111. app/core/request_locality.py +473 -0
  112. app/core/resilience/__init__.py +0 -0
  113. app/core/resilience/backpressure.py +57 -0
  114. app/core/resilience/bulkhead.py +202 -0
  115. app/core/resilience/circuit_breaker.py +150 -0
  116. app/core/resilience/degradation.py +55 -0
  117. app/core/resilience/loop_lag_monitor.py +60 -0
  118. app/core/resilience/memory_monitor.py +137 -0
  119. app/core/resilience/network_recovery.py +256 -0
  120. app/core/resilience/overload.py +98 -0
  121. app/core/resilience/toggles.py +114 -0
  122. app/core/retention/__init__.py +0 -0
  123. app/core/retention/job.py +240 -0
  124. app/core/retention/scheduler.py +69 -0
  125. app/core/runtime_logging.py +601 -0
  126. app/core/scheduling/__init__.py +0 -0
  127. app/core/scheduling/leader_election.py +993 -0
  128. app/core/scheduling/leader_election_handle.py +25 -0
  129. app/core/server.py +140 -0
  130. app/core/shutdown.py +326 -0
  131. app/core/socket_peer.py +22 -0
  132. app/core/startup.py +41 -0
  133. app/core/timeout_invariants.py +347 -0
  134. app/core/tracing/__init__.py +0 -0
  135. app/core/tracing/otel.py +207 -0
  136. app/core/types.py +6 -0
  137. app/core/upstream_proxy/__init__.py +13 -0
  138. app/core/upstream_proxy/cache.py +130 -0
  139. app/core/upstream_proxy/resolver.py +189 -0
  140. app/core/upstream_proxy/types.py +104 -0
  141. app/core/usage/__init__.py +407 -0
  142. app/core/usage/depletion.py +109 -0
  143. app/core/usage/live_hub.py +41 -0
  144. app/core/usage/live_snapshots.py +174 -0
  145. app/core/usage/logs.py +212 -0
  146. app/core/usage/metadata_scheduler.py +118 -0
  147. app/core/usage/models.py +54 -0
  148. app/core/usage/pricing.py +576 -0
  149. app/core/usage/pricing_catalog.py +241 -0
  150. app/core/usage/pricing_snapshot.json +821 -0
  151. app/core/usage/quota.py +133 -0
  152. app/core/usage/refresh_policy.py +21 -0
  153. app/core/usage/refresh_scheduler.py +713 -0
  154. app/core/usage/reset_credits_refresh_scheduler.py +435 -0
  155. app/core/usage/types.py +168 -0
  156. app/core/utils/__init__.py +0 -0
  157. app/core/utils/json_guards.py +18 -0
  158. app/core/utils/locks.py +33 -0
  159. app/core/utils/masking.py +20 -0
  160. app/core/utils/proxy_env.py +104 -0
  161. app/core/utils/request_id.py +65 -0
  162. app/core/utils/retry.py +77 -0
  163. app/core/utils/shared_future.py +172 -0
  164. app/core/utils/sse.py +286 -0
  165. app/core/utils/time.py +24 -0
  166. app/db/__init__.py +0 -0
  167. app/db/account_identity_lock.py +56 -0
  168. app/db/alembic/__init__.py +1 -0
  169. app/db/alembic/env.py +70 -0
  170. app/db/alembic/revision_ids.py +43 -0
  171. app/db/alembic/versions/20260213_000000_base_schema.py +248 -0
  172. app/db/alembic/versions/20260213_000100_normalize_account_plan_types.py +45 -0
  173. app/db/alembic/versions/20260213_000200_add_request_logs_reasoning_effort.py +45 -0
  174. app/db/alembic/versions/20260213_000300_add_accounts_reset_at.py +45 -0
  175. app/db/alembic/versions/20260213_000400_add_accounts_chatgpt_account_id.py +45 -0
  176. app/db/alembic/versions/20260213_000500_add_dashboard_settings.py +70 -0
  177. app/db/alembic/versions/20260213_000600_add_dashboard_settings_totp.py +64 -0
  178. app/db/alembic/versions/20260213_000700_add_dashboard_settings_password.py +59 -0
  179. app/db/alembic/versions/20260213_000800_add_api_keys.py +87 -0
  180. app/db/alembic/versions/20260214_000000_add_api_key_limits.py +143 -0
  181. app/db/alembic/versions/20260215_000000_add_idx_logs_requested_at.py +38 -0
  182. app/db/alembic/versions/20260218_000000_add_api_key_usage_reservations.py +117 -0
  183. app/db/alembic/versions/20260218_000100_add_import_without_overwrite_and_drop_accounts_email_unique.py +198 -0
  184. app/db/alembic/versions/20260225_000000_add_dashboard_settings_routing_strategy.py +53 -0
  185. app/db/alembic/versions/20260228_020000_align_api_key_limit_enum_types.py +104 -0
  186. app/db/alembic/versions/20260228_030000_add_api_firewall_allowlist.py +42 -0
  187. app/db/alembic/versions/20260306_000000_add_request_logs_service_tier.py +45 -0
  188. app/db/alembic/versions/20260307_000000_add_api_key_enforcement_fields.py +56 -0
  189. app/db/alembic/versions/20260308_000000_add_sqlite_performance_indexes.py +41 -0
  190. app/db/alembic/versions/20260309_000000_add_additional_usage_history.py +71 -0
  191. app/db/alembic/versions/20260309_000000_request_logs_nullable_account_id.py +28 -0
  192. app/db/alembic/versions/20260310_000000_add_request_logs_transport.py +45 -0
  193. app/db/alembic/versions/20260310_000000_fix_postgresql_enum_value_casing.py +79 -0
  194. app/db/alembic/versions/20260310_120000_add_sticky_session_kinds_and_affinity_ttl.py +110 -0
  195. app/db/alembic/versions/20260312_000000_add_additional_usage_quota_key.py +193 -0
  196. app/db/alembic/versions/20260312_000000_split_sticky_sessions_primary_key_by_kind.py +96 -0
  197. app/db/alembic/versions/20260312_010000_merge_additional_usage_and_sticky_session_heads.py +25 -0
  198. app/db/alembic/versions/20260312_020000_merge_request_logs_transport_and_feature_heads.py +25 -0
  199. app/db/alembic/versions/20260312_020000_merge_request_logs_transport_and_sticky_heads.py +25 -0
  200. app/db/alembic/versions/20260312_120000_add_dashboard_upstream_stream_transport.py +62 -0
  201. app/db/alembic/versions/20260313_024500_merge_request_log_transport_heads.py +27 -0
  202. app/db/alembic/versions/20260319_100937_increase_prompt_cache_ttl_to_1800s.py +73 -0
  203. app/db/alembic/versions/20260319_111500_merge_prompt_cache_ttl_and_upstream_transport_heads.py +25 -0
  204. app/db/alembic/versions/20260319_183000_normalize_sqlite_account_status_casing.py +48 -0
  205. app/db/alembic/versions/20260320_000000_add_request_log_requested_actual_tiers.py +51 -0
  206. app/db/alembic/versions/20260321_190000_tighten_dashboard_db_indexes.py +64 -0
  207. app/db/alembic/versions/20260321_210000_merge_request_log_tiers_and_dashboard_index_heads.py +25 -0
  208. app/db/alembic/versions/20260325_000000_add_request_log_cost.py +193 -0
  209. app/db/alembic/versions/20260328_000000_add_rate_limit_attempts.py +48 -0
  210. app/db/alembic/versions/20260328_120000_add_request_log_ttft.py +37 -0
  211. app/db/alembic/versions/20260328_130000_add_audit_logs_table.py +45 -0
  212. app/db/alembic/versions/20260328_140000_add_scheduler_leader_table.py +39 -0
  213. app/db/alembic/versions/20260330_000000_add_cache_locality_settings.py +69 -0
  214. app/db/alembic/versions/20260330_010000_merge_scheduler_leader_and_cache_locality_heads.py +25 -0
  215. app/db/alembic/versions/20260330_020000_add_bridge_ring_members.py +46 -0
  216. app/db/alembic/versions/20260401_000000_add_api_key_enforced_service_tier.py +52 -0
  217. app/db/alembic/versions/20260401_000000_add_cache_invalidation.py +41 -0
  218. app/db/alembic/versions/20260401_020000_merge_cache_invalidation_and_api_key_service_tier_heads.py +22 -0
  219. app/db/alembic/versions/20260402_000000_switch_dashboard_routing_default_to_capacity_weighted.py +66 -0
  220. app/db/alembic/versions/20260403_000000_add_credit_api_key_limit_values.py +44 -0
  221. app/db/alembic/versions/20260406_000000_add_api_key_account_assignments.py +57 -0
  222. app/db/alembic/versions/20260406_010000_add_api_key_assignment_scope_flag.py +75 -0
  223. app/db/alembic/versions/20260407_000000_add_bridge_gateway_safe_mode.py +51 -0
  224. app/db/alembic/versions/20260407_010000_merge_api_key_assignment_and_bridge_gateway_heads.py +25 -0
  225. app/db/alembic/versions/20260408_000000_switch_import_without_overwrite_default_to_true.py +73 -0
  226. app/db/alembic/versions/20260408_010000_merge_import_without_overwrite_and_assignment_heads.py +25 -0
  227. app/db/alembic/versions/20260409_000000_add_http_bridge_sessions.py +130 -0
  228. app/db/alembic/versions/20260409_000000_switch_sticky_threads_and_prefer_earlier_reset_defaults_to_true.py +89 -0
  229. app/db/alembic/versions/20260409_010000_add_dashboard_settings_bootstrap_token.py +57 -0
  230. app/db/alembic/versions/20260409_010000_merge_http_bridge_and_import_without_overwrite_heads.py +25 -0
  231. app/db/alembic/versions/20260409_020000_fix_http_bridge_last_seen_index.py +46 -0
  232. app/db/alembic/versions/20260410_000000_backfill_pristine_dashboard_settings_defaults.py +77 -0
  233. app/db/alembic/versions/20260410_030000_restore_import_without_overwrite_default_true.py +73 -0
  234. app/db/alembic/versions/20260410_040000_merge_dashboard_defaults_and_import_default_heads.py +25 -0
  235. app/db/alembic/versions/20260413_000000_add_accounts_blocked_at.py +44 -0
  236. app/db/alembic/versions/20260415_160000_add_automations_tables.py +189 -0
  237. app/db/alembic/versions/20260415_160000_add_request_logs_response_lookup_index.py +67 -0
  238. app/db/alembic/versions/20260417_000000_add_request_log_plan_type.py +44 -0
  239. app/db/alembic/versions/20260418_190000_add_automation_runs_cycle_key.py +87 -0
  240. app/db/alembic/versions/20260419_000000_add_automation_run_cycle_metadata.py +56 -0
  241. app/db/alembic/versions/20260419_020000_add_automation_run_cycles_snapshot_tables.py +342 -0
  242. app/db/alembic/versions/20260421_000000_add_dashboard_session_ttl_setting.py +51 -0
  243. app/db/alembic/versions/20260421_120000_merge_request_log_lookup_and_plan_type_heads.py +25 -0
  244. app/db/alembic/versions/20260421_130000_merge_automation_and_request_log_heads.py +25 -0
  245. app/db/alembic/versions/20260422_103000_normalize_legacy_automation_run_cycle_keys.py +648 -0
  246. app/db/alembic/versions/20260423_120000_add_api_key_limit_reset_at_index.py +43 -0
  247. app/db/alembic/versions/20260424_000000_merge_dashboard_session_ttl_and_request_log_heads.py +25 -0
  248. app/db/alembic/versions/20260426_000000_add_dashboard_relative_availability_settings.py +68 -0
  249. app/db/alembic/versions/20260427_130000_add_warmup_model_and_request_kind.py +75 -0
  250. app/db/alembic/versions/20260506_000000_add_account_routing_policy.py +37 -0
  251. app/db/alembic/versions/20260509_000000_add_api_key_traffic_class.py +37 -0
  252. app/db/alembic/versions/20260509_010000_add_additional_quota_routing_policies.py +37 -0
  253. app/db/alembic/versions/20260513_000000_add_accounts_alias.py +44 -0
  254. app/db/alembic/versions/20260513_000000_add_api_key_apply_to_codex_model.py +59 -0
  255. app/db/alembic/versions/20260514_000000_add_request_logs_api_key_time_index.py +43 -0
  256. app/db/alembic/versions/20260515_000000_add_prefer_earlier_reset_window.py +47 -0
  257. app/db/alembic/versions/20260515_000000_soft_delete_request_logs_on_account_delete.py +83 -0
  258. app/db/alembic/versions/20260515_020000_add_split_sticky_budget_thresholds.py +62 -0
  259. app/db/alembic/versions/20260516_000000_add_sqlite_hot_path_indexes.py +75 -0
  260. app/db/alembic/versions/20260517_000000_merge_sqlite_hot_path_and_request_log_delete_heads.py +24 -0
  261. app/db/alembic/versions/20260518_000000_add_http_bridge_durable_input_prefix.py +44 -0
  262. app/db/alembic/versions/20260518_010000_merge_http_bridge_and_sqlite_recovery_heads.py +25 -0
  263. app/db/alembic/versions/20260518_120000_add_dashboard_guest_access.py +57 -0
  264. app/db/alembic/versions/20260520_000000_merge_api_key_and_http_bridge_heads.py +26 -0
  265. app/db/alembic/versions/20260520_010000_add_request_logs_api_key_account_index.py +45 -0
  266. app/db/alembic/versions/20260520_010000_merge_automation_and_api_key_heads.py +26 -0
  267. app/db/alembic/versions/20260520_030000_add_quota_planner.py +194 -0
  268. app/db/alembic/versions/20260520_040000_merge_quota_planner_and_request_log_index_heads.py +24 -0
  269. app/db/alembic/versions/20260521_000000_add_account_security_work_authorized.py +46 -0
  270. app/db/alembic/versions/20260521_000000_merge_dashboard_guest_and_api_key_heads.py +26 -0
  271. app/db/alembic/versions/20260521_000000_merge_prefer_reset_window_head.py +26 -0
  272. app/db/alembic/versions/20260521_000000_merge_warmup_and_request_log_index_heads.py +25 -0
  273. app/db/alembic/versions/20260522_000000_add_limit_warmup_trigger.py +195 -0
  274. app/db/alembic/versions/20260524_000000_merge_accounts_alias_and_reset_window_heads.py +24 -0
  275. app/db/alembic/versions/20260525_000000_add_usage_raw_window_latest_index.py +31 -0
  276. app/db/alembic/versions/20260526_000000_add_request_log_failure_metadata.py +100 -0
  277. app/db/alembic/versions/20260531_000000_add_account_workspace_identity.py +39 -0
  278. app/db/alembic/versions/20260531_000000_add_single_account_routing.py +42 -0
  279. app/db/alembic/versions/20260601_000000_merge_relative_availability_and_usage_raw_heads.py +24 -0
  280. app/db/alembic/versions/20260601_010000_add_api_key_usage_sections.py +58 -0
  281. app/db/alembic/versions/20260601_010000_add_routing_policy_persistence.py +67 -0
  282. app/db/alembic/versions/20260601_010000_merge_security_work_and_relative_availability_heads.py +25 -0
  283. app/db/alembic/versions/20260601_010000_merge_split_sticky_and_relative_usage_heads.py +25 -0
  284. app/db/alembic/versions/20260601_010000_merge_warmup_and_relative_availability_heads.py +25 -0
  285. app/db/alembic/versions/20260601_020000_merge_additional_quota_routing_and_relative_availability_heads.py +25 -0
  286. app/db/alembic/versions/20260601_020000_merge_quota_planner_and_relative_availability_heads.py +25 -0
  287. app/db/alembic/versions/20260601_020000_merge_reset_window_and_relative_availability_heads.py +25 -0
  288. app/db/alembic/versions/20260601_020000_merge_routing_policy_and_split_threshold_heads.py +24 -0
  289. app/db/alembic/versions/20260601_020000_merge_warmup_and_request_log_failure_heads.py +25 -0
  290. app/db/alembic/versions/20260601_030000_merge_single_account_and_routing_quota_heads.py +29 -0
  291. app/db/alembic/versions/20260601_040000_merge_security_work_and_routing_consolidation_heads.py +25 -0
  292. app/db/alembic/versions/20260601_050000_merge_quota_planner_and_routing_consolidation_heads.py +25 -0
  293. app/db/alembic/versions/20260602_050000_add_upstream_proxy_routing.py +164 -0
  294. app/db/alembic/versions/20260602_060000_merge_account_workspace_and_failure_heads.py +25 -0
  295. app/db/alembic/versions/20260602_070000_add_request_log_useragent_fields.py +86 -0
  296. app/db/alembic/versions/20260602_070000_merge_quota_planner_and_account_workspace_heads.py +25 -0
  297. app/db/alembic/versions/20260602_080000_merge_upstream_proxy_and_quota_planner_heads.py +25 -0
  298. app/db/alembic/versions/20260602_080000_merge_useragent_and_upstream_proxy_heads.py +24 -0
  299. app/db/alembic/versions/20260603_000000_add_weekly_pace_working_days.py +52 -0
  300. app/db/alembic/versions/20260603_000000_free_account_monthly_window.py +60 -0
  301. app/db/alembic/versions/20260604_000000_add_reauth_required_account_status.py +159 -0
  302. app/db/alembic/versions/20260604_010000_merge_automations_and_reauth_status_heads.py +25 -0
  303. app/db/alembic/versions/20260604_010000_merge_dashboard_guest_and_reauth_status_heads.py +25 -0
  304. app/db/alembic/versions/20260604_010000_merge_useragent_and_reauth_heads.py +24 -0
  305. app/db/alembic/versions/20260607_000000_merge_weekly_monthly_useragent_heads.py +28 -0
  306. app/db/alembic/versions/20260608_000000_add_hide_upstream_quota_from_api_keys.py +50 -0
  307. app/db/alembic/versions/20260611_000000_add_request_log_archive_request_id.py +47 -0
  308. app/db/alembic/versions/20260611_000000_merge_automations_and_weekly_monthly_useragent_heads.py +26 -0
  309. app/db/alembic/versions/20260611_000000_merge_dashboard_guest_and_weekly_useragent_heads.py +26 -0
  310. app/db/alembic/versions/20260611_010000_add_request_log_client_ip.py +57 -0
  311. app/db/alembic/versions/20260611_020000_merge_request_log_archive_and_client_ip_heads.py +26 -0
  312. app/db/alembic/versions/20260611_030000_merge_dashboard_guest_and_request_log_client_ip_heads.py +26 -0
  313. app/db/alembic/versions/20260613_000000_add_accounts_codex_installation_id.py +57 -0
  314. app/db/alembic/versions/20260613_010000_merge_installation_id_and_dashboard_weekly_heads.py +26 -0
  315. app/db/alembic/versions/20260615_000000_merge_automations_and_dashboard_guest_heads.py +26 -0
  316. app/db/alembic/versions/20260623_000000_add_limit_warmup_exhausted_threshold.py +51 -0
  317. app/db/alembic/versions/20260626_000000_add_http_downstream_transport_policy.py +46 -0
  318. app/db/alembic/versions/20260626_010000_add_request_logs_upstream_transport.py +31 -0
  319. app/db/alembic/versions/20260629_000000_add_dashboard_query_hot_path_indexes.py +53 -0
  320. app/db/alembic/versions/20260630_000000_add_limit_warmup_staggered_idle.py +47 -0
  321. app/db/alembic/versions/20260630_000000_merge_request_log_client_ip_and_dashboard_hot_path_heads.py +26 -0
  322. app/db/alembic/versions/20260630_010000_merge_warmup_and_request_log_dashboard_heads.py +26 -0
  323. app/db/alembic/versions/20260630_020000_merge_automations_and_main_heads.py +26 -0
  324. app/db/alembic/versions/20260630_020000_merge_warmup_threshold_and_main_heads.py +26 -0
  325. app/db/alembic/versions/20260630_030000_add_automation_run_model_snapshot.py +59 -0
  326. app/db/alembic/versions/20260630_040000_merge_automation_snapshot_and_warmup_threshold_heads.py +26 -0
  327. app/db/alembic/versions/20260630_050000_add_automation_run_prompt_snapshot.py +52 -0
  328. app/db/alembic/versions/20260701_000000_add_weekly_pace_smoothing_minutes.py +51 -0
  329. app/db/alembic/versions/20260702_000000_add_model_sources.py +176 -0
  330. app/db/alembic/versions/20260705_000000_add_model_source_audio_transcriptions.py +50 -0
  331. app/db/alembic/versions/20260705_000000_harden_dashboard_session_ttl.py +62 -0
  332. app/db/alembic/versions/20260706_000000_add_model_source_audio_per_minute.py +43 -0
  333. app/db/alembic/versions/20260707_000000_merge_model_sources_and_session_ttl.py +24 -0
  334. app/db/alembic/versions/20260707_010000_merge_automations_and_model_sources_heads.py +24 -0
  335. app/db/alembic/versions/20260707_020000_add_automation_job_account_scope.py +125 -0
  336. app/db/alembic/versions/20260709_000000_add_ttft_phase_observability.py +66 -0
  337. app/db/alembic/versions/20260711_000000_add_dashboard_prohibit_fast_mode.py +42 -0
  338. app/db/alembic/versions/20260711_010000_add_account_chatgpt_user_id.py +40 -0
  339. app/db/alembic/versions/20260711_020000_add_dashboard_account_concurrency_caps.py +71 -0
  340. app/db/alembic/versions/20260711_030000_add_limit_warmup_idle_threshold.py +51 -0
  341. app/db/alembic/versions/20260712_010000_add_account_usage_rollups.py +56 -0
  342. app/db/alembic/versions/20260712_020000_add_api_key_usage_rollups.py +53 -0
  343. app/db/alembic/versions/20260713_020000_add_model_registry_snapshot.py +42 -0
  344. app/db/alembic/versions/20260713_040000_add_account_refresh_claims.py +42 -0
  345. app/db/alembic/versions/20260713_040000_add_replica_guardrails.py +64 -0
  346. app/db/alembic/versions/20260713_070000_add_reset_credit_redeem_tables.py +58 -0
  347. app/db/alembic/versions/20260714_000000_add_oauth_flow_states.py +63 -0
  348. app/db/alembic/versions/20260715_000000_add_request_log_queue_latency.py +44 -0
  349. app/db/alembic/versions/20260716_000000_add_oauth_device_flow_slots.py +41 -0
  350. app/db/alembic/versions/20260716_010000_add_dashboard_retention_settings.py +48 -0
  351. app/db/alembic/versions/20260716_010000_add_reset_credit_display_settings.py +73 -0
  352. app/db/alembic/versions/20260717_000000_add_http_bridge_retry_circuits.py +47 -0
  353. app/db/alembic/versions/20260717_000000_merge_retention_and_reset_credit_display_heads.py +26 -0
  354. app/db/alembic/versions/20260717_000000_optimize_dashboard_hot_path_indexes.py +162 -0
  355. app/db/alembic/versions/20260717_000001_merge_retry_circuits_and_dashboard_indexes.py +22 -0
  356. app/db/alembic/versions/20260720_000000_add_request_log_conversation_id.py +57 -0
  357. app/db/alembic/versions/20260722_000000_backfill_request_log_useragent_families.py +40 -0
  358. app/db/alembic/versions/20260724_000000_add_request_usage_time_rollups.py +176 -0
  359. app/db/alembic/versions/20260724_000000_merge_request_log_schema_heads.py +33 -0
  360. app/db/alembic/versions/20260725_000000_add_http_bridge_pending_tool_calls.py +43 -0
  361. app/db/alembic/versions/20260726_000000_add_account_plan_downgrade_observations.py +44 -0
  362. app/db/alembic/versions/20260726_000000_repair_request_usage_rollups_after_merge.py +37 -0
  363. app/db/alembic/versions/20260727_000000_add_sticky_session_continuity_abandoned_at.py +45 -0
  364. app/db/alembic/versions/20260728_000000_merge_pending_tool_calls_and_rollup_repair_heads.py +31 -0
  365. app/db/alembic/versions/20260730_000000_add_api_key_fair_share_threshold.py +44 -0
  366. app/db/alembic/versions/20260730_000000_add_http_bridge_recovery_attempts.py +60 -0
  367. app/db/alembic/versions/20260731_000000_add_capability_lineage_markers.py +38 -0
  368. app/db/alembic/versions/20260803_000000_merge_http_bridge_recovery_and_capability_lineage_heads.py +30 -0
  369. app/db/alembic/versions/20260804_000000_add_http_bridge_operations.py +63 -0
  370. app/db/alembic/versions/20260804_000001_add_global_http_bridge_operation_fingerprint.py +53 -0
  371. app/db/alembic/versions/20260804_230000_add_request_log_connection_request_kind.py +43 -0
  372. app/db/alembic/versions/20260805_000000_add_http_bridge_operation_spool.py +75 -0
  373. app/db/alembic/versions/20260805_000001_finalize_http_bridge_operation_spool.py +65 -0
  374. app/db/alembic/versions/20260806_000000_add_additional_usage_alias_probe_indexes.py +84 -0
  375. app/db/alembic/versions/20260806_000000_add_anonymous_telemetry.py +49 -0
  376. app/db/alembic/versions/20260806_010000_add_conversation_presence_rollup.py +72 -0
  377. app/db/alembic/versions/20260806_020000_add_usage_history_bulk_covering_indexes.py +99 -0
  378. app/db/alembic/versions/20260806_030000_add_api_key_allowed_reasoning_efforts.py +65 -0
  379. app/db/alembic/versions/20260806_120000_add_http_bridge_owner_process_epoch.py +57 -0
  380. app/db/alembic/versions/20260807_000000_merge_http_bridge_operation_spool_and_latest_main.py +24 -0
  381. app/db/alembic/versions/20260808_000000_tune_usage_history_autovacuum.py +54 -0
  382. app/db/alembic/versions/20260810_000000_add_http_bridge_recovery_dispatch_count.py +44 -0
  383. app/db/alembic/versions/20260811_000000_add_hourly_rollup_cancelled_count.py +92 -0
  384. app/db/alembic/versions/20260812_000000_merge_recovery_dispatch_and_hourly_cancelled_heads.py +25 -0
  385. app/db/alembic/versions/20260812_120000_add_sticky_abandonment_scope.py +43 -0
  386. app/db/alembic/versions/20260813_000000_add_file_account_pins.py +40 -0
  387. app/db/alembic/versions/20260816_000000_add_account_pending_deletion.py +81 -0
  388. app/db/alembic/versions/20260816_000000_add_model_source_embeddings.py +50 -0
  389. app/db/alembic/versions/20260821_000000_add_retry_circuit_admission_generation.py +49 -0
  390. app/db/alembic/versions/20260826_000000_add_http_bridge_event_chunks.py +107 -0
  391. app/db/alembic/versions/20260828_000000_add_accounts_chatgpt_identity_index.py +55 -0
  392. app/db/alembic/versions/20260830_000000_add_quota_warmup_claim_expiry.py +83 -0
  393. app/db/alembic/versions/20260908_000000_add_guest_session_generation.py +37 -0
  394. app/db/alembic/versions/20260908_000000_add_subscription_overflow.py +140 -0
  395. app/db/alembic/versions/20260908_000000_replace_upstream_stream_transport_default_sentinel.py +50 -0
  396. app/db/alembic/versions/20260908_020000_merge_overflow_transport_heads.py +27 -0
  397. app/db/alembic/versions/20260909_000000_add_dashboard_roles.py +72 -0
  398. app/db/alembic/versions/20260909_010000_add_dashboard_users.py +183 -0
  399. app/db/alembic/versions/20260909_020000_reproject_compat_admin_credentials.py +105 -0
  400. app/db/alembic/versions/20260909_030000_add_audit_actor_columns.py +103 -0
  401. app/db/alembic/versions/20260909_030000_dashboard_resilience_toggle_settings.py +63 -0
  402. app/db/alembic/versions/20260909_040000_add_dashboard_user_invites.py +54 -0
  403. app/db/alembic/versions/20260909_040000_dashboard_timeout_settings.py +68 -0
  404. app/db/alembic/versions/20260909_050000_dashboard_routing_overload_settings.py +65 -0
  405. app/db/alembic/versions/20260909_060000_add_report_rollup.py +74 -0
  406. app/db/alembic/versions/20260909_070000_automation_run_claim_budget.py +50 -0
  407. app/db/alembic/versions/20260909_080000_dashboard_stream_bridge_budgets.py +62 -0
  408. app/db/alembic/versions/20260909_090000_dashboard_background_job_toggles.py +63 -0
  409. app/db/alembic/versions/20260909_100000_dashboard_codex_prewarm.py +49 -0
  410. app/db/alembic/versions/20260909_110000_model_context_window_overrides.py +45 -0
  411. app/db/alembic/versions/20260909_120000_dashboard_conversation_archive.py +48 -0
  412. app/db/alembic/versions/20260909_130000_add_request_logs_live_facet_indexes.py +96 -0
  413. app/db/alembic/versions/20260910_000000_add_totp_required_for_admin_role.py +44 -0
  414. app/db/alembic/versions/20260910_000000_request_logs_missing_cost_index.py +52 -0
  415. app/db/alembic/versions/20260910_010000_add_dashboard_auth_providers.py +134 -0
  416. app/db/alembic/versions/20260910_010000_dashboard_spool_retention.py +52 -0
  417. app/db/alembic/versions/20260910_020000_add_dashboard_role_mappings.py +74 -0
  418. app/db/alembic/versions/20260910_143000_request_log_affinity.py +28 -0
  419. app/db/alembic/versions/20260910_180000_merge_affinity_guest_heads.py +17 -0
  420. app/db/alembic/versions/20260910_200000_merge_affinity_identity_heads.py +17 -0
  421. app/db/alembic/versions/20260910_220000_merge_affinity_invite_heads.py +17 -0
  422. app/db/alembic/versions/20260911_000000_model_source_pins_kind_expires_index.py +43 -0
  423. app/db/alembic/versions/20260911_010000_merge_pin_index_and_affinity_heads.py +17 -0
  424. app/db/alembic/versions/20260911_020000_add_http_bridge_terminal_append_phase.py +54 -0
  425. app/db/alembic/versions/20260911_030000_add_local_login_policy.py +48 -0
  426. app/db/alembic/versions/20260911_040000_add_thread_cache_identity_mode.py +48 -0
  427. app/db/alembic/versions/20260911_060000_add_bridge_session_continuity_abandonment.py +40 -0
  428. app/db/alembic/versions/20260912_000000_merge_thread_cache_and_bridge_retirement_heads.py +22 -0
  429. app/db/alembic/versions/20260912_010000_drop_legacy_dashboard_credentials.py +140 -0
  430. app/db/alembic/versions/20260913_000000_add_oidc_provider_flow.py +134 -0
  431. app/db/alembic/versions/20260914_000000_add_scim_tokens.py +78 -0
  432. app/db/alembic/versions/20260914_000000_drop_subscription_overflow_schema.py +132 -0
  433. app/db/alembic/versions/20260918_000000_merge_scim_and_overflow_heads.py +17 -0
  434. app/db/alembic/versions/__init__.py +1 -0
  435. app/db/backup.py +64 -0
  436. app/db/migrate.py +1249 -0
  437. app/db/migration_lock.py +160 -0
  438. app/db/migration_url.py +18 -0
  439. app/db/models.py +3100 -0
  440. app/db/recover.py +244 -0
  441. app/db/session.py +1295 -0
  442. app/db/snapshot.py +46 -0
  443. app/db/sqlite_lock_retry.py +190 -0
  444. app/db/sqlite_utils.py +549 -0
  445. app/dependencies.py +462 -0
  446. app/main.py +1240 -0
  447. app/modules/__init__.py +0 -0
  448. app/modules/accounts/__init__.py +0 -0
  449. app/modules/accounts/api.py +426 -0
  450. app/modules/accounts/auth_manager.py +1439 -0
  451. app/modules/accounts/background_repository.py +160 -0
  452. app/modules/accounts/deletion.py +540 -0
  453. app/modules/accounts/mappers.py +654 -0
  454. app/modules/accounts/refresh_claims.py +352 -0
  455. app/modules/accounts/repository.py +1679 -0
  456. app/modules/accounts/schemas.py +308 -0
  457. app/modules/accounts/service.py +809 -0
  458. app/modules/accounts/usage_rollup.py +486 -0
  459. app/modules/accounts/usage_rollup_scheduler.py +75 -0
  460. app/modules/accounts/usage_time_rollup.py +1037 -0
  461. app/modules/accounts/usage_time_rollup_read.py +522 -0
  462. app/modules/api_keys/__init__.py +1 -0
  463. app/modules/api_keys/api.py +344 -0
  464. app/modules/api_keys/last_used_coalescer.py +216 -0
  465. app/modules/api_keys/limit_windows.py +41 -0
  466. app/modules/api_keys/repository.py +1200 -0
  467. app/modules/api_keys/reset_scheduler.py +85 -0
  468. app/modules/api_keys/schemas.py +135 -0
  469. app/modules/api_keys/service.py +2123 -0
  470. app/modules/audit/__init__.py +0 -0
  471. app/modules/audit/api.py +88 -0
  472. app/modules/audit/repository.py +74 -0
  473. app/modules/audit/schemas.py +33 -0
  474. app/modules/audit/service.py +71 -0
  475. app/modules/auth_providers/__init__.py +0 -0
  476. app/modules/auth_providers/api.py +127 -0
  477. app/modules/auth_providers/config.py +343 -0
  478. app/modules/auth_providers/repository.py +101 -0
  479. app/modules/auth_providers/schemas.py +88 -0
  480. app/modules/auth_providers/seed.py +105 -0
  481. app/modules/auth_providers/service.py +289 -0
  482. app/modules/automations/__init__.py +1 -0
  483. app/modules/automations/api.py +369 -0
  484. app/modules/automations/repository.py +1896 -0
  485. app/modules/automations/scheduler.py +107 -0
  486. app/modules/automations/schemas.py +158 -0
  487. app/modules/automations/service.py +2548 -0
  488. app/modules/cache_isolation_probe/__init__.py +0 -0
  489. app/modules/cache_isolation_probe/api.py +188 -0
  490. app/modules/cache_isolation_probe/prefix.py +144 -0
  491. app/modules/cache_isolation_probe/schemas.py +94 -0
  492. app/modules/cache_isolation_probe/sender.py +229 -0
  493. app/modules/cache_isolation_probe/service.py +525 -0
  494. app/modules/conversation_archive/__init__.py +1 -0
  495. app/modules/conversation_archive/api.py +101 -0
  496. app/modules/conversation_archive/schemas.py +28 -0
  497. app/modules/conversation_archive/service.py +165 -0
  498. app/modules/dashboard/__init__.py +1 -0
  499. app/modules/dashboard/api.py +106 -0
  500. app/modules/dashboard/builders.py +107 -0
  501. app/modules/dashboard/repository.py +304 -0
  502. app/modules/dashboard/schemas.py +148 -0
  503. app/modules/dashboard/service.py +534 -0
  504. app/modules/dashboard/timeframes.py +19 -0
  505. app/modules/dashboard/weekly_pace.py +617 -0
  506. app/modules/dashboard_auth/__init__.py +1 -0
  507. app/modules/dashboard_auth/api.py +1344 -0
  508. app/modules/dashboard_auth/oidc_api.py +753 -0
  509. app/modules/dashboard_auth/oidc_flows.py +330 -0
  510. app/modules/dashboard_auth/repository.py +452 -0
  511. app/modules/dashboard_auth/schemas.py +232 -0
  512. app/modules/dashboard_auth/service.py +1384 -0
  513. app/modules/dashboard_roles/__init__.py +0 -0
  514. app/modules/dashboard_roles/api.py +64 -0
  515. app/modules/dashboard_roles/repository.py +54 -0
  516. app/modules/dashboard_roles/schemas.py +29 -0
  517. app/modules/dashboard_roles/seed.py +80 -0
  518. app/modules/dashboard_roles/service.py +142 -0
  519. app/modules/dashboard_users/__init__.py +0 -0
  520. app/modules/dashboard_users/api.py +278 -0
  521. app/modules/dashboard_users/break_glass.py +169 -0
  522. app/modules/dashboard_users/credentials.py +18 -0
  523. app/modules/dashboard_users/identity_resolver.py +665 -0
  524. app/modules/dashboard_users/repository.py +725 -0
  525. app/modules/dashboard_users/schemas.py +117 -0
  526. app/modules/dashboard_users/service.py +1054 -0
  527. app/modules/firewall/__init__.py +1 -0
  528. app/modules/firewall/api.py +78 -0
  529. app/modules/firewall/repository.py +51 -0
  530. app/modules/firewall/schemas.py +28 -0
  531. app/modules/firewall/service.py +93 -0
  532. app/modules/fleet/__init__.py +1 -0
  533. app/modules/fleet/api.py +177 -0
  534. app/modules/fleet/mappers.py +56 -0
  535. app/modules/fleet/observability.py +372 -0
  536. app/modules/fleet/schemas.py +119 -0
  537. app/modules/health/__init__.py +0 -0
  538. app/modules/health/api.py +246 -0
  539. app/modules/health/schemas.py +27 -0
  540. app/modules/limit_warmup/__init__.py +1 -0
  541. app/modules/limit_warmup/repository.py +159 -0
  542. app/modules/limit_warmup/service.py +1001 -0
  543. app/modules/model_sources/__init__.py +1 -0
  544. app/modules/model_sources/api.py +99 -0
  545. app/modules/model_sources/catalog.py +307 -0
  546. app/modules/model_sources/forwarding.py +1435 -0
  547. app/modules/model_sources/projection.py +55 -0
  548. app/modules/model_sources/repository.py +201 -0
  549. app/modules/model_sources/schemas.py +79 -0
  550. app/modules/model_sources/selection.py +166 -0
  551. app/modules/model_sources/service.py +236 -0
  552. app/modules/oauth/__init__.py +0 -0
  553. app/modules/oauth/api.py +101 -0
  554. app/modules/oauth/repository.py +238 -0
  555. app/modules/oauth/schemas.py +49 -0
  556. app/modules/oauth/service.py +1196 -0
  557. app/modules/oauth/templates/oauth_success.html +122 -0
  558. app/modules/proxy/__init__.py +0 -0
  559. app/modules/proxy/_load_balancer/__init__.py +1 -0
  560. app/modules/proxy/_load_balancer/error_rate.py +116 -0
  561. app/modules/proxy/_load_balancer/latency_cohort.py +154 -0
  562. app/modules/proxy/_load_balancer/model_eligibility.py +250 -0
  563. app/modules/proxy/_load_balancer/opportunistic_admission.py +350 -0
  564. app/modules/proxy/_load_balancer/overload_backoff.py +394 -0
  565. app/modules/proxy/_load_balancer/sticky_selection.py +2417 -0
  566. app/modules/proxy/_load_balancer/throughput_cohort.py +233 -0
  567. app/modules/proxy/_load_balancer/ttft_cohort.py +214 -0
  568. app/modules/proxy/_load_balancer/tunables.py +97 -0
  569. app/modules/proxy/_load_balancer/types.py +96 -0
  570. app/modules/proxy/_load_balancer/unbound_selection.py +534 -0
  571. app/modules/proxy/_service/__init__.py +6 -0
  572. app/modules/proxy/_service/api_key_usage.py +745 -0
  573. app/modules/proxy/_service/clock_budget.py +38 -0
  574. app/modules/proxy/_service/codex_control.py +611 -0
  575. app/modules/proxy/_service/compact.py +2211 -0
  576. app/modules/proxy/_service/file_ops.py +749 -0
  577. app/modules/proxy/_service/http_bridge/__init__.py +3 -0
  578. app/modules/proxy/_service/http_bridge/accepted_replay.py +331 -0
  579. app/modules/proxy/_service/http_bridge/account_sessions.py +57 -0
  580. app/modules/proxy/_service/http_bridge/activity.py +178 -0
  581. app/modules/proxy/_service/http_bridge/helpers.py +3959 -0
  582. app/modules/proxy/_service/http_bridge/mixin.py +2435 -0
  583. app/modules/proxy/_service/http_bridge/owner_forwarding.py +609 -0
  584. app/modules/proxy/_service/http_bridge/protocol.py +167 -0
  585. app/modules/proxy/_service/http_bridge/proxy_failover.py +58 -0
  586. app/modules/proxy/_service/http_bridge/quarantine.py +443 -0
  587. app/modules/proxy/_service/http_bridge/request_submit.py +4582 -0
  588. app/modules/proxy/_service/http_bridge/retry_circuit.py +2442 -0
  589. app/modules/proxy/_service/http_bridge/service_stubs.py +492 -0
  590. app/modules/proxy/_service/http_bridge/session_registry.py +778 -0
  591. app/modules/proxy/_service/http_bridge/streaming.py +5328 -0
  592. app/modules/proxy/_service/http_bridge/upstream_events.py +4538 -0
  593. app/modules/proxy/_service/observability.py +410 -0
  594. app/modules/proxy/_service/rate_limit.py +361 -0
  595. app/modules/proxy/_service/realtime_live.py +655 -0
  596. app/modules/proxy/_service/refresh.py +154 -0
  597. app/modules/proxy/_service/request_log.py +585 -0
  598. app/modules/proxy/_service/response_create.py +930 -0
  599. app/modules/proxy/_service/streaming/__init__.py +3 -0
  600. app/modules/proxy/_service/streaming/helpers.py +1317 -0
  601. app/modules/proxy/_service/streaming/mixin.py +1100 -0
  602. app/modules/proxy/_service/streaming/protocol.py +32 -0
  603. app/modules/proxy/_service/streaming/retry.py +3762 -0
  604. app/modules/proxy/_service/support.py +2122 -0
  605. app/modules/proxy/_service/transcribe.py +434 -0
  606. app/modules/proxy/_service/warmup.py +483 -0
  607. app/modules/proxy/_service/websocket/__init__.py +3 -0
  608. app/modules/proxy/_service/websocket/helpers.py +2360 -0
  609. app/modules/proxy/_service/websocket/mixin.py +7285 -0
  610. app/modules/proxy/_service/websocket/protocol.py +74 -0
  611. app/modules/proxy/account_cache.py +229 -0
  612. app/modules/proxy/account_eligibility.py +87 -0
  613. app/modules/proxy/additional_model_limits.py +40 -0
  614. app/modules/proxy/affinity.py +830 -0
  615. app/modules/proxy/affinity_observation.py +101 -0
  616. app/modules/proxy/api.py +10254 -0
  617. app/modules/proxy/api_key_usage.py +113 -0
  618. app/modules/proxy/cap_partitioning.py +280 -0
  619. app/modules/proxy/capability_lineage.py +65 -0
  620. app/modules/proxy/capability_lineage_repository.py +82 -0
  621. app/modules/proxy/capability_routing.py +253 -0
  622. app/modules/proxy/continuity.py +112 -0
  623. app/modules/proxy/downstream_delivery.py +277 -0
  624. app/modules/proxy/durable_bridge_coordinator.py +1217 -0
  625. app/modules/proxy/durable_bridge_repository.py +4516 -0
  626. app/modules/proxy/durable_bridge_runtime.py +9 -0
  627. app/modules/proxy/durable_bridge_transcript_codec.py +122 -0
  628. app/modules/proxy/fair_share.py +131 -0
  629. app/modules/proxy/file_pin_repository.py +210 -0
  630. app/modules/proxy/helpers.py +439 -0
  631. app/modules/proxy/http_bridge_event_batcher.py +613 -0
  632. app/modules/proxy/http_bridge_forwarding.py +797 -0
  633. app/modules/proxy/http_continuation.py +76 -0
  634. app/modules/proxy/images_observability.py +62 -0
  635. app/modules/proxy/images_service.py +1054 -0
  636. app/modules/proxy/load_balancer.py +3016 -0
  637. app/modules/proxy/rate_limit_cache.py +46 -0
  638. app/modules/proxy/replay_safety.py +1063 -0
  639. app/modules/proxy/repo_bundle.py +31 -0
  640. app/modules/proxy/request_policy.py +1054 -0
  641. app/modules/proxy/ring_membership.py +251 -0
  642. app/modules/proxy/schemas.py +345 -0
  643. app/modules/proxy/selection_errors.py +41 -0
  644. app/modules/proxy/service.py +2600 -0
  645. app/modules/proxy/source_admission.py +125 -0
  646. app/modules/proxy/source_dispatch.py +999 -0
  647. app/modules/proxy/sticky_repository.py +831 -0
  648. app/modules/proxy/thread_anchors.py +491 -0
  649. app/modules/proxy/tool_call_dedupe.py +802 -0
  650. app/modules/proxy/types.py +54 -0
  651. app/modules/proxy/work_admission.py +121 -0
  652. app/modules/quota_planner/__init__.py +1 -0
  653. app/modules/quota_planner/api.py +276 -0
  654. app/modules/quota_planner/logic.py +743 -0
  655. app/modules/quota_planner/repository.py +722 -0
  656. app/modules/quota_planner/scheduler.py +212 -0
  657. app/modules/quota_planner/schemas.py +102 -0
  658. app/modules/quota_planner/warmup.py +693 -0
  659. app/modules/rate_limit_reset_credits/__init__.py +0 -0
  660. app/modules/rate_limit_reset_credits/api.py +601 -0
  661. app/modules/rate_limit_reset_credits/redeem_coordination.py +274 -0
  662. app/modules/rate_limit_reset_credits/store.py +114 -0
  663. app/modules/reports/__init__.py +1 -0
  664. app/modules/reports/api.py +134 -0
  665. app/modules/reports/cache.py +74 -0
  666. app/modules/reports/filters.py +27 -0
  667. app/modules/reports/repository.py +525 -0
  668. app/modules/reports/rollup.py +150 -0
  669. app/modules/reports/rollup_read.py +148 -0
  670. app/modules/reports/schemas.py +123 -0
  671. app/modules/reports/service.py +287 -0
  672. app/modules/reports/thread_identity.py +256 -0
  673. app/modules/request_logs/__init__.py +0 -0
  674. app/modules/request_logs/api.py +224 -0
  675. app/modules/request_logs/cost_backfill.py +154 -0
  676. app/modules/request_logs/mappers.py +97 -0
  677. app/modules/request_logs/repository.py +1765 -0
  678. app/modules/request_logs/schemas.py +145 -0
  679. app/modules/request_logs/service.py +348 -0
  680. app/modules/role_mappings/__init__.py +0 -0
  681. app/modules/role_mappings/api.py +206 -0
  682. app/modules/role_mappings/matching.py +55 -0
  683. app/modules/role_mappings/repository.py +106 -0
  684. app/modules/role_mappings/schemas.py +67 -0
  685. app/modules/role_mappings/service.py +334 -0
  686. app/modules/runtime/__init__.py +1 -0
  687. app/modules/runtime/api.py +18 -0
  688. app/modules/runtime/schemas.py +14 -0
  689. app/modules/runtime/service.py +218 -0
  690. app/modules/scim/__init__.py +1 -0
  691. app/modules/scim/api.py +194 -0
  692. app/modules/scim/dependencies.py +112 -0
  693. app/modules/scim/errors.py +77 -0
  694. app/modules/scim/management_api.py +156 -0
  695. app/modules/scim/repository.py +212 -0
  696. app/modules/scim/schemas.py +145 -0
  697. app/modules/scim/service.py +786 -0
  698. app/modules/scim/tokens.py +43 -0
  699. app/modules/settings/__init__.py +1 -0
  700. app/modules/settings/api.py +1677 -0
  701. app/modules/settings/repository.py +606 -0
  702. app/modules/settings/schemas.py +496 -0
  703. app/modules/settings/service.py +769 -0
  704. app/modules/shared/__init__.py +0 -0
  705. app/modules/shared/schemas.py +22 -0
  706. app/modules/sticky_sessions/__init__.py +1 -0
  707. app/modules/sticky_sessions/api.py +118 -0
  708. app/modules/sticky_sessions/cleanup_scheduler.py +487 -0
  709. app/modules/sticky_sessions/schemas.py +78 -0
  710. app/modules/sticky_sessions/service.py +196 -0
  711. app/modules/telemetry/__init__.py +5 -0
  712. app/modules/telemetry/api.py +115 -0
  713. app/modules/telemetry/clients.py +62 -0
  714. app/modules/telemetry/consent.py +115 -0
  715. app/modules/telemetry/scheduler.py +85 -0
  716. app/modules/telemetry/schemas.py +163 -0
  717. app/modules/telemetry/sender.py +221 -0
  718. app/modules/telemetry/snapshot.py +490 -0
  719. app/modules/usage/__init__.py +0 -0
  720. app/modules/usage/additional_quota_keys.py +379 -0
  721. app/modules/usage/api.py +45 -0
  722. app/modules/usage/background_repository.py +147 -0
  723. app/modules/usage/builders.py +559 -0
  724. app/modules/usage/depletion_service.py +277 -0
  725. app/modules/usage/live_ingest.py +356 -0
  726. app/modules/usage/mappers.py +29 -0
  727. app/modules/usage/plan_downgrade_observations.py +488 -0
  728. app/modules/usage/repository.py +1890 -0
  729. app/modules/usage/schemas.py +68 -0
  730. app/modules/usage/service.py +102 -0
  731. app/modules/usage/updater.py +1488 -0
  732. app/static/assets/Trans-Cj-J9mVA.js +1 -0
  733. app/static/assets/access-page-DHzZiXZi.js +1 -0
  734. app/static/assets/account-cost-donut-DGhfA4U8.js +1 -0
  735. app/static/assets/account-identifiers-CxbdLshZ.js +1 -0
  736. app/static/assets/account-status-DIsU5sUS.js +1 -0
  737. app/static/assets/account-trend-chart-BptlfwwQ.js +1 -0
  738. app/static/assets/accounts-page-Bbai8ift.js +3 -0
  739. app/static/assets/api-Dwa7XxPe.js +1 -0
  740. app/static/assets/api-client-dugX1Pti.js +55 -0
  741. app/static/assets/api-key-create-dialog-DnRm0oYN.js +1 -0
  742. app/static/assets/api-key-created-dialog-B6jkDG9f.js +1 -0
  743. app/static/assets/api-key-edit-dialog-Ck3Bnc3V.js +1 -0
  744. app/static/assets/api-trend-chart-BchCw7Hj.js +1 -0
  745. app/static/assets/apis-page-BvXz9c6i.js +2 -0
  746. app/static/assets/arrow-up-Dqh_KzJo.js +1 -0
  747. app/static/assets/arrow-up-down-LBRgVDGY.js +1 -0
  748. app/static/assets/automations-page-DQgNAJOR.js +3 -0
  749. app/static/assets/badge-DqMb9es0.js +1 -0
  750. app/static/assets/blur-email-HEvKagG2.js +1 -0
  751. app/static/assets/button-BjVmmiGW.js +1 -0
  752. app/static/assets/checkbox-apsl9vzk.js +1 -0
  753. app/static/assets/chevron-left-1d_pHVa5.js +1 -0
  754. app/static/assets/circle-alert-BS0xd_o1.js +1 -0
  755. app/static/assets/clsx-DB0hHKMi.js +1 -0
  756. app/static/assets/colors-BBy8GEtr.js +1 -0
  757. app/static/assets/copy-button-D7nAvOKR.js +1 -0
  758. app/static/assets/cost-per-day-chart-YdqlkZVM.js +1 -0
  759. app/static/assets/createLucideIcon-DBLzLNh2.js +1 -0
  760. app/static/assets/dashboard-page-CSdhBy0f.js +2 -0
  761. app/static/assets/distribution-metric-format-yZTy1ZEu.js +1 -0
  762. app/static/assets/donut-chart-Bxc69cra.js +1 -0
  763. app/static/assets/download-kQteIcsB.js +1 -0
  764. app/static/assets/ellipsis-B_5OgIre.js +1 -0
  765. app/static/assets/empty-state-JcA7tc8m.js +1 -0
  766. app/static/assets/es2015-bMH8YKZT.js +41 -0
  767. app/static/assets/es6-B264ni6W.js +69 -0
  768. app/static/assets/external-link-UVAOgMQ0.js +1 -0
  769. app/static/assets/i18n-BWqZ9Ua2.js +1 -0
  770. app/static/assets/inbox-B_RM2s1J.js +1 -0
  771. app/static/assets/index-DIpd264Z.js +23 -0
  772. app/static/assets/index-DMeLKRJx.css +2 -0
  773. app/static/assets/inherit-badge-QhTYVaU6.js +1 -0
  774. app/static/assets/invite-dialog-0CYh0GiQ.js +1 -0
  775. app/static/assets/iso-Bpe5Ihbb.js +1 -0
  776. app/static/assets/label-CGaLmLNf.js +1 -0
  777. app/static/assets/lazy-recharts-Pv8p9ArM.js +2 -0
  778. app/static/assets/loading-overlay-CzKQfHLI.js +1 -0
  779. app/static/assets/mini-quota-bar-cGT_t8Ae.js +1 -0
  780. app/static/assets/model-distribution-donut-BKjAfT48.js +1 -0
  781. app/static/assets/model-source-multi-select-D2d06Vc7.js +1 -0
  782. app/static/assets/multi-select-filter-KIA5qU6Z.js +1 -0
  783. app/static/assets/oauth-dialog-XeaGGDjS.js +1 -0
  784. app/static/assets/pagination-controls-D1Ypd0RU.js +1 -0
  785. app/static/assets/payload-CIYnGZz9.js +1 -0
  786. app/static/assets/queue-wait-chart-VoV7Yg9L.js +1 -0
  787. app/static/assets/report-chart-card-BXDliwcc.js +1 -0
  788. app/static/assets/reports-page-CGCJeMHG.js +3 -0
  789. app/static/assets/reset-credit-confirm-dialog-QOifTnVB.js +1 -0
  790. app/static/assets/rolldown-runtime-hePW80VL.js +1 -0
  791. app/static/assets/search-HfhqwERt.js +1 -0
  792. app/static/assets/select-Cl33bz-g.js +1 -0
  793. app/static/assets/settings-page-mZj01HYl.js +2 -0
  794. app/static/assets/shim-CZwyM4Q7.js +1 -0
  795. app/static/assets/skeleton-C_EUc4Rp.js +1 -0
  796. app/static/assets/sparkline-chart-DdNNsddM.js +1 -0
  797. app/static/assets/status-badge-CHHA5X6c.js +1 -0
  798. app/static/assets/switch-CzxgokcM.js +1 -0
  799. app/static/assets/table-DXaNSQ0G.js +1 -0
  800. app/static/assets/time-to-first-token-chart--68L0u_v.js +1 -0
  801. app/static/assets/tokens-per-day-chart-Cs82BFuE.js +1 -0
  802. app/static/assets/tokens-per-second-chart-AD2dfOn6.js +1 -0
  803. app/static/assets/totp-settings-CRHtxQ7j.js +1 -0
  804. app/static/assets/trash-D3KyWr1h.js +1 -0
  805. app/static/assets/use-account-quota-display-BPmrTBTC.js +1 -0
  806. app/static/assets/use-accounts-PWlVGw3z.js +1 -0
  807. app/static/assets/use-auth-CuDlW3iC.js +1 -0
  808. app/static/assets/use-chart-colors-DIu6tClI.js +1 -0
  809. app/static/assets/use-model-sources-Bul24JBu.js +1 -0
  810. app/static/assets/use-models-DUCPUuZg.js +1 -0
  811. app/static/assets/use-reduced-motion-hAm5r6_d.js +1 -0
  812. app/static/assets/useTranslation--56nHhlH.js +1 -0
  813. app/static/assets/useragent-distribution-donut-Dup6sf_n.js +1 -0
  814. app/static/assets/users-uIC3TIlE.js +1 -0
  815. app/static/assets/vendor-query-_bHZuxEx.js +1 -0
  816. app/static/assets/vendor-react-BVL0YZPW.js +9 -0
  817. app/static/favicon.svg +10 -0
  818. app/static/fonts/GeistSans-Variable.woff2 +0 -0
  819. app/static/fonts/jetbrains-mono-latin-ext.woff2 +0 -0
  820. app/static/fonts/jetbrains-mono-latin.woff2 +0 -0
  821. app/static/index.html +29 -0
  822. codexlb_up-1.25.0b10.dist-info/METADATA +124 -0
  823. codexlb_up-1.25.0b10.dist-info/RECORD +827 -0
  824. codexlb_up-1.25.0b10.dist-info/WHEEL +4 -0
  825. codexlb_up-1.25.0b10.dist-info/entry_points.txt +3 -0
  826. codexlb_up-1.25.0b10.dist-info/licenses/LICENSE +21 -0
  827. config/additional_quota_registry.json +11 -0
@@ -0,0 +1,23 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dashboard-page-CSdhBy0f.js","assets/rolldown-runtime-hePW80VL.js","assets/vendor-query-_bHZuxEx.js","assets/createLucideIcon-DBLzLNh2.js","assets/Trans-Cj-J9mVA.js","assets/i18n-BWqZ9Ua2.js","assets/useTranslation--56nHhlH.js","assets/shim-CZwyM4Q7.js","assets/arrow-up-Dqh_KzJo.js","assets/arrow-up-down-LBRgVDGY.js","assets/iso-Bpe5Ihbb.js","assets/vendor-react-BVL0YZPW.js","assets/es2015-bMH8YKZT.js","assets/button-BjVmmiGW.js","assets/clsx-DB0hHKMi.js","assets/api-client-dugX1Pti.js","assets/chevron-left-1d_pHVa5.js","assets/select-Cl33bz-g.js","assets/pagination-controls-D1Ypd0RU.js","assets/reset-credit-confirm-dialog-QOifTnVB.js","assets/use-reduced-motion-hAm5r6_d.js","assets/account-status-DIsU5sUS.js","assets/use-accounts-PWlVGw3z.js","assets/copy-button-D7nAvOKR.js","assets/external-link-UVAOgMQ0.js","assets/inbox-B_RM2s1J.js","assets/search-HfhqwERt.js","assets/account-identifiers-CxbdLshZ.js","assets/users-uIC3TIlE.js","assets/use-auth-CuDlW3iC.js","assets/colors-BBy8GEtr.js","assets/blur-email-HEvKagG2.js","assets/badge-DqMb9es0.js","assets/status-badge-CHHA5X6c.js","assets/skeleton-C_EUc4Rp.js","assets/empty-state-JcA7tc8m.js","assets/table-DXaNSQ0G.js","assets/multi-select-filter-KIA5qU6Z.js","assets/reports-page-CGCJeMHG.js","assets/download-kQteIcsB.js","assets/accounts-page-Bbai8ift.js","assets/use-account-quota-display-BPmrTBTC.js","assets/trash-D3KyWr1h.js","assets/checkbox-apsl9vzk.js","assets/label-CGaLmLNf.js","assets/switch-CzxgokcM.js","assets/loading-overlay-CzKQfHLI.js","assets/mini-quota-bar-cGT_t8Ae.js","assets/automations-page-DQgNAJOR.js","assets/use-models-DUCPUuZg.js","assets/api-Dwa7XxPe.js","assets/payload-CIYnGZz9.js","assets/inherit-badge-QhTYVaU6.js","assets/apis-page-BvXz9c6i.js","assets/ellipsis-B_5OgIre.js","assets/api-key-created-dialog-B6jkDG9f.js","assets/settings-page-mZj01HYl.js","assets/use-model-sources-Bul24JBu.js","assets/invite-dialog-0CYh0GiQ.js","assets/access-page-DHzZiXZi.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{C as t,S as n,_ as r,a as i,b as a,c as o,d as s,f as c,g as l,h as u,i as d,l as f,m as p,o as m,r as h,s as g,t as _,u as v,v as y,x as b,y as x}from"./vendor-query-_bHZuxEx.js";import{n as S,t as C}from"./vendor-react-BVL0YZPW.js";import{t as w}from"./createLucideIcon-DBLzLNh2.js";import{a as T,c as E,i as D,l as ee,n as O,o as te,r as ne,s as re,t as k}from"./iso-Bpe5Ihbb.js";import{t as ie}from"./circle-alert-BS0xd_o1.js";import{_ as ae,a as oe,b as se,c as ce,d as le,f as ue,g as A,h as de,i as fe,l as pe,m as me,n as he,o as ge,p as _e,r as ve,s as ye,t as be,u as xe,v as Se,y as Ce}from"./es2015-bMH8YKZT.js";import{i as we,n as Te,r as Ee,t as De}from"./i18n-BWqZ9Ua2.js";import{t as j}from"./useTranslation--56nHhlH.js";import{a as Oe,c as M,i as ke,o as Ae,s as je,t as N}from"./button-BjVmmiGW.js";import{_ as Me,a as Ne,d as P,f as F,g as Pe,h as I,i as Fe,m as L,n as Ie,o as Le,p as Re,r as ze,s as Be,t as Ve,u as R,v as z,x as He,y as Ue}from"./api-client-dugX1Pti.js";import{t as We}from"./label-CGaLmLNf.js";import{C as Ge,S as Ke,T as qe,_ as Je,a as Ye,b as Xe,d as Ze,g as Qe,h as $e,i as et,l as tt,m as nt,n as B,o as rt,p as it,r as at,s as ot,t as st,v as ct,w as lt,x as ut,y as dt}from"./use-auth-CuDlW3iC.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var ft=class extends f{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new d({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=pt(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=pt(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=pt(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=pt(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){g.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>p(t,e))}findAll(e={}){return this.getAll().filter(t=>p(e,t))}notify(e){g.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return g.batch(()=>Promise.all(e.map(e=>e.continue().catch(l))))}};function pt(e){return e.options.scope?.id}var mt=class extends f{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,a=t.queryHash??c(r,t),o=this.get(a);return o||(o=new i({client:e,queryKey:r,queryHash:a,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(o)),o}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){this.#e.get(e.queryHash)===e&&(e.destroy(),this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){g.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>u(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>u(e,t)):t}notify(e){g.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){g.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){g.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},ht=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new mt,this.#t=e.mutationCache||new ft,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=o.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=m.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(y(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=v(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return g.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;g.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return g.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=g.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(l).catch(l)}invalidateQueries(e,t={}){return g.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=g.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(l)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(l)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(y(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(y(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(l).catch(l)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(l).catch(l)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return m.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(s(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{r(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(s(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{r(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=c(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===x&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},V=e(t(),1),H=n(),gt=e(S(),1),_t=C(),vt=`modulepreload`,yt=function(e){return`/`+e},bt={},xt=function(e){return e.pathname.endsWith(`.css`)},St=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},Ct=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=yt(t,n);let r=s(t),i=xt(r);return St(bt,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:vt,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},wt=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Tt=/^[\\/]{2}/;function Et(e,t){return t+e.replace(/\\/g,`/`)}var Dt=(e=>(e.Pop=`POP`,e.Push=`PUSH`,e.Replace=`REPLACE`,e))(Dt||{}),Ot=`popstate`;function kt(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function At(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return Pt(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:Ft(t)}return Lt(t,n,null,e)}function U(e,t){if(e===!1||e==null)throw Error(t)}function jt(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function Mt(){return Math.random().toString(36).substring(2,10)}function Nt(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Pt(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?It(t):t,state:n,key:t&&t.key||r||Mt(),mask:i}}function Ft({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function It(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function Lt(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=kt(e)?e:Pt(h.location,e,t);n&&n(r,e),l=u()+1;let d=Nt(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=kt(e)?e:Pt(h.location,e,t);n&&n(r,e),l=u();let i=Nt(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return Rt(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(Ot,d),c=e,()=>{i.removeEventListener(Ot,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function Rt(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),U(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:Ft(t);return i=i.replace(/ $/,`%20`),!n&&Tt.test(i)&&(i=r+i),new URL(i,r)}function zt(e,t,n=`/`){return Bt(e,t,n,!1)}function Bt(e,t,n,r,i){let a=on((typeof t==`string`?It(t):t).pathname||`/`,n);if(a==null)return null;let o=i??Vt(e),s=null,c=an(a);for(let e=0;s==null&&e<o.length;++e)s=en(o[e],c,r);return s}function Vt(e){let t=Ht(e);return Wt(t),t}function Ht(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;U(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=mn([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(U(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),Ht(e.children,t,u,l,o)),(e.path!=null||e.index)&&t.push({path:l,score:Qt(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=rn(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of Ut(e.path))a(e,t,!0,n)}),t}function Ut(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=Ut(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function Wt(e){e.sort((e,t)=>e.score===t.score?$t(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var Gt=/^:[\w-]+$/,Kt=3,qt=2,Jt=1,Yt=10,Xt=-2,Zt=e=>e===`*`;function Qt(e,t){let n=e.split(`/`),r=n.length;return n.some(Zt)&&(r+=Xt),t&&(r+=qt),n.filter(e=>!Zt(e)).reduce((e,t)=>e+(Gt.test(t)?Kt:t===``?Jt:Yt),r)}function $t(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function en(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?nn(u,l,s.matcher,s.compiledParams):tn(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=tn({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:mn([a,d.pathname]),pathnameBase:gn(mn([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=mn([a,d.pathnameBase]))}return o}function tn(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=rn(e.path,e.caseSensitive,e.end);return nn(e,t,n,r)}function nn(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=hn(a,1),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=hn(a.slice(0,a.length-e.length),1)}let i=s[r];return e[t]=n&&!i?void 0:(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function rn(e,t=!1,n=!0){jt(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function an(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return jt(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function on(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function sn(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?It(e):e,a;return n?(n=pn(n),a=n.startsWith(`/`)||n.startsWith(`\\`)?cn(n.substring(1),`/`):cn(n,t)):a=t,{pathname:a,search:_n(r),hash:vn(i)}}function cn(e,t){let n=hn(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function ln(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function un(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function dn(e){let t=un(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function fn(e,t,n,r=!1){let i;typeof e==`string`?i=It(e):(i={...e},U(!i.pathname||!i.pathname.includes(`?`),ln(`?`,`pathname`,`search`,i)),U(!i.pathname||!i.pathname.includes(`#`),ln(`#`,`pathname`,`hash`,i)),U(!i.search||!i.search.includes(`#`),ln(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=sn(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var pn=e=>e.replace(/[\\/]{2,}/g,`/`),mn=e=>pn(e.join(`/`));function hn(e,t=0){let n=e.length;for(;n>t&&e.charCodeAt(n-1)===47;)n--;return n===e.length?e:e.slice(0,n)}var gn=e=>hn(e).replace(/^\/*/,`/`),_n=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,vn=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,yn=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function bn(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function xn(e){return mn(e.map(e=>e.route.path).filter(Boolean))||`/`}var Sn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Cn(e,t){let n=e;if(typeof n!=`string`||!wt.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(Sn)try{let e=new URL(window.location.href),r=Tt.test(n)?new URL(Et(n,e.protocol)):new URL(n),a=on(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{jt(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var wn=new URL(`http://localhost`);function Tn(e){if(e.createURL)return e.createURL(`/`);try{return new URL(e.createHref(`/`),wn)}catch{return wn}}function En(e,t){return e.origin===t.origin&&(e.origin!==`null`||e.protocol===t.protocol&&e.host===t.host)}function Dn(e,t){if(e.startsWith(`//`))return!0;let n=t.protocol.toLowerCase();return e.toLowerCase().startsWith(n)?t.host===``||e.slice(n.length).startsWith(`//`):!1}function On(e,t,n,r){let i=null;try{i=e==null?null:new URL(e,n)}catch{}let a=new URL(t,n),o=i!=null&&!En(i,n),s=!En(a,n);if(r===`reject`){if(o||s)throw Error(`External navigation is not allowed`)}else if(s&&(i==null||!Dn(e,i)||!En(i,a)))throw Error(`External navigation is not allowed`)}var kn=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(kn);var An=[`GET`,...kn];new Set(An);var jn=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function Mn(e){try{return jn.includes(new URL(e).protocol)}catch{return!1}}var Nn=V.createContext(null);Nn.displayName=`DataRouter`;var Pn=V.createContext(null);Pn.displayName=`DataRouterState`;var Fn=V.createContext(!1);function In(){return V.useContext(Fn)}var Ln=V.createContext({isTransitioning:!1});Ln.displayName=`ViewTransition`;var Rn=V.createContext(new Map);Rn.displayName=`Fetchers`;var zn=V.createContext(null);zn.displayName=`Await`;var Bn=V.createContext(null);Bn.displayName=`Navigation`;var Vn=V.createContext(null);Vn.displayName=`Location`;var Hn=V.createContext({outlet:null,matches:[],isDataRoute:!1});Hn.displayName=`Route`;var Un=V.createContext(null);Un.displayName=`RouteError`;var Wn=`REACT_ROUTER_ERROR`,Gn=`REDIRECT`,Kn=`ROUTE_ERROR_RESPONSE`;function qn(e){if(e.startsWith(`${Wn}:${Gn}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function Jn(e){if(e.startsWith(`${Wn}:${Kn}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new yn(t.status,t.statusText,t.data)}catch{}}function Yn(e,{relative:t}={}){U(Xn(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=V.useContext(Bn),{hash:i,pathname:a,search:o}=ar(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:mn([n,a])),r.createHref({pathname:s,search:o,hash:i})}function Xn(){return V.useContext(Vn)!=null}function Zn(){return U(Xn(),`useLocation() may be used only in the context of a <Router> component.`),V.useContext(Vn).location}function Qn(){return V.useContext(Vn).navigationType}var $n=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function er(e){V.useContext(Bn).static||V.useLayoutEffect(e)}function tr(){let{isDataRoute:e}=V.useContext(Hn);return e?Sr():nr()}function nr(){U(Xn(),`useNavigate() may be used only in the context of a <Router> component.`);let e=V.useContext(Nn),{basename:t,navigator:n}=V.useContext(Bn),{matches:r}=V.useContext(Hn),{pathname:i}=Zn(),a=JSON.stringify(dn(r)),o=V.useRef(!1);return er(()=>{o.current=!0}),V.useCallback((r,s={})=>{if(jt(o.current,$n),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=fn(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:mn([t,c.pathname])),On(typeof r==`string`?r:Ft(r),n.createHref(c),Tn(n),`reject`),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var rr=V.createContext(null);function ir(e){let t=V.useContext(Hn).outlet;return V.useMemo(()=>t&&V.createElement(rr.Provider,{value:e},t),[t,e])}function ar(e,{relative:t}={}){let{matches:n}=V.useContext(Hn),{pathname:r}=Zn(),i=JSON.stringify(dn(n));return V.useMemo(()=>fn(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function or(e,t){return sr(e,t)}function sr(e,t,n){U(Xn(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=V.useContext(Bn),{matches:i}=V.useContext(Hn),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;wr(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
3
+
4
+ Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=Zn(),d;if(t){let e=typeof t==`string`?It(t):t;U(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):zt(e,{pathname:p});jt(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),jt(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=mr(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:mn([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:mn([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?V.createElement(Vn.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function cr(){let e=xr(),t=bn(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=V.createElement(V.Fragment,null,V.createElement(`p`,null,`💿 Hey developer 👋`),V.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,V.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,V.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),V.createElement(V.Fragment,null,V.createElement(`h2`,null,`Unexpected Application Error!`),V.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?V.createElement(`pre`,{style:i},n):null,o)}var lr=V.createElement(cr,null),ur=class extends V.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=Jn(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:V.createElement(Hn.Provider,{value:this.props.routeContext},V.createElement(Un.Provider,{value:e,children:this.props.component}));return this.context?V.createElement(fr,{error:e},t):t}};ur.contextType=Fn;var dr=new WeakMap;function fr({children:e,error:t}){let{basename:n,navigator:r}=V.useContext(Bn);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=qn(t.digest);if(e){let i=dr.get(t);if(i)throw i;let a=Cn(e.location,n),o=a.absoluteURL||a.to;if(On(e.location,o,Tn(r),`allow-explicit`),Mn(o))throw Error(`Invalid redirect location`);if(Sn&&!dr.get(t)){if(a.isExternal||e.reloadDocument)window.location.href=o;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:e.replace}));throw dr.set(t,n),n}}return V.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${o}`})}}return e}function pr({routeContext:e,match:t,children:n}){let r=V.useContext(Nn);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),V.createElement(Hn.Provider,{value:e},n)}function mr(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);U(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:xn(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||lr,o&&(s<0&&c===0?(wr(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?V.createElement(n.route.Component,null):n.route.element?n.route.element:e,V.createElement(pr,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?V.createElement(ur,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function hr(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function gr(e){let t=V.useContext(Nn);return U(t,hr(e)),t}function _r(e){let t=V.useContext(Pn);return U(t,hr(e)),t}function vr(e){let t=V.useContext(Hn);return U(t,hr(e)),t}function yr(e){let t=vr(e),n=t.matches[t.matches.length-1];return U(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function br(){return yr(`useRouteId`)}function xr(){let e=V.useContext(Un),t=_r(`useRouteError`),n=yr(`useRouteError`);return e===void 0?t.errors?.[n]:e}function Sr(){let{router:e}=gr(`useNavigate`),t=yr(`useNavigate`),n=V.useRef(!1);return er(()=>{n.current=!0}),V.useCallback(async(r,i={})=>{jt(n.current,$n),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var Cr={};function wr(e,t,n){!t&&!Cr[e]&&(Cr[e]=!0,jt(!1,n))}V.memo(Tr);function Tr({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return sr(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function Er({to:e,replace:t,state:n,relative:r}){U(Xn(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i,navigator:a}=V.useContext(Bn);jt(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:o}=V.useContext(Hn),{pathname:s}=Zn(),c=tr(),l=fn(e,dn(o),s,r===`path`);On(typeof e==`string`?e:Ft(e),a.createHref(l),Tn(a),`reject`);let u=JSON.stringify(l);return V.useEffect(()=>{c(JSON.parse(u),{replace:t,state:n,relative:r})},[c,u,r,t,n]),null}function Dr(e){return ir(e.context)}function Or(e){U(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function kr({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){U(!Xn(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=V.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=It(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=V.useMemo(()=>{let e=on(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return jt(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:V.createElement(Bn.Provider,{value:c},V.createElement(Vn.Provider,{children:t,value:h}))}function Ar({children:e,location:t}){return or(jr(e),t)}V.Component;function jr(e,t=[]){let n=[];return V.Children.forEach(e,(e,r)=>{if(!V.isValidElement(e))return;let i=[...t,r];if(e.type===V.Fragment){n.push.apply(n,jr(e.props.children,i));return}U(e.type===Or,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),U(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=jr(e.props.children,i)),n.push(a)}),n}var Mr=`get`,Nr=`application/x-www-form-urlencoded`;function Pr(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Fr(e){return Pr(e)&&e.tagName.toLowerCase()===`button`}function Ir(e){return Pr(e)&&e.tagName.toLowerCase()===`form`}function Lr(e){return Pr(e)&&e.tagName.toLowerCase()===`input`}function Rr(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function zr(e,t){return e.button===0&&(!t||t===`_self`)&&!Rr(e)}function Br(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function Vr(e,t){let n=Br(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Hr=null;function Ur(){if(Hr===null)try{new FormData(document.createElement(`form`),0),Hr=!1}catch{Hr=!0}return Hr}var Wr=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Gr(e){return e!=null&&!Wr.has(e)?(jt(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Nr}"`),null):e}function Kr(e,t){let n,r,i,a,o;if(Ir(e)){let o=e.getAttribute(`action`);r=o?on(o,t):null,n=e.getAttribute(`method`)||Mr,i=Gr(e.getAttribute(`enctype`))||Nr,a=new FormData(e)}else if(Fr(e)||Lr(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?on(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||Mr,i=Gr(e.getAttribute(`formenctype`))||Gr(o.getAttribute(`enctype`))||Nr,a=new FormData(o,e),!Ur()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(Pr(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=Mr,r=null,i=Nr,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function qr(e,t){if(e===!1||e==null)throw Error(t)}function Jr(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return i.pathname=n?i.pathname.endsWith(`/`)?`${i.pathname}_.${r}`:`${i.pathname}.${r}`:i.pathname===`/`?`_root.${r}`:t&&on(i.pathname,t)===`/`?`${hn(t)}/_root.${r}`:`${hn(i.pathname)}.${r}`,i}async function Yr(e,t){if(e.id in t)return t[e.id];try{let n=await Ct(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Xr(e){return e!=null&&typeof e.page==`string`}function Zr(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function Qr(e,t,n){return ri((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Yr(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Zr).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function $r(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function ei(e,t,{includeHydrateFallback:n}={}){return ti(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function ti(e){return[...new Set(e)]}function ni(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function ri(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Xr(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(ni(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function ii(){let e=V.useContext(Nn);return qr(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function ai(){let e=V.useContext(Pn);return qr(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var oi=V.createContext(void 0);oi.displayName=`FrameworkContext`;function si(){let e=V.useContext(oi);return qr(e,`You must render this element inside a <HydratedRouter> element`),e}function ci(e,t){let n=V.useContext(oi),[r,i]=V.useState(!1),[a,o]=V.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=V.useRef(null);V.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),V.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:li(s,p),onBlur:li(c,m),onMouseEnter:li(l,p),onMouseLeave:li(u,m),onTouchStart:li(d,p)}]:[a,f,{}]:[!1,f,{}]}function li(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function ui({page:e,...t}){let n=In(),{nonce:r}=si(),{router:i}=ii(),a=V.useMemo(()=>zt(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?V.createElement(fi,{page:e,matches:a,...t}):V.createElement(pi,{page:e,matches:a,...t})):null}function di(e){let{manifest:t,routeModules:n}=si(),[r,i]=V.useState([]);return V.useEffect(()=>{let r=!1;return Qr(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function fi({page:e,matches:t,...n}){let r=Zn(),{future:i}=si(),{basename:a}=ii(),o=V.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=Jr(e,a,i.v8_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.v8_trailingSlashAwareDataRequests,e,r,t]);return V.createElement(V.Fragment,null,o.map(e=>V.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function pi({page:e,matches:t,...n}){let r=Zn(),{future:i,manifest:a,routeModules:o}=si(),{basename:s}=ii(),{loaderData:c,matches:l}=ai(),u=V.useMemo(()=>$r(e,t,l,a,r,`data`),[e,t,l,a,r]),d=V.useMemo(()=>$r(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=V.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];t&&t.hasLoader&&(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=Jr(e,s,i.v8_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.v8_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=V.useMemo(()=>ei(d,a),[d,a]),m=di(d);return V.createElement(V.Fragment,null,f.map(e=>V.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>V.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>V.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function mi(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}V.Component;var hi=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{hi&&(window.__reactRouterVersion=`7.18.4`)}catch{}function gi({basename:e,children:t,useTransitions:n,window:r}){let i=V.useRef();i.current??=At({window:r,v5Compat:!0});let a=i.current,[o,s]=V.useState({action:a.action,location:a.location}),c=V.useCallback(e=>{n===!1?s(e):V.startTransition(()=>s(e))},[n]);return V.useLayoutEffect(()=>a.listen(c),[a,c]),V.createElement(kr,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}var _i=V.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:_}=V.useContext(Bn),v=typeof l==`string`&&wt.test(l),y=Cn(l,h);l=y.to;let b=Yn(l,{relative:r}),x=Zn(),S=null;if(o){let e=fn(o,[],x.mask?x.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:mn([h,e.pathname])),S=g.createHref(e)}let[C,w,T]=ci(n,p),E=Si(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function D(t){e&&e(t),t.defaultPrevented||E(t)}let ee=!(y.isExternal||i),O=V.createElement(`a`,{...p,...T,href:(ee?S:void 0)||y.absoluteURL||b,onClick:ee?D:e,ref:mi(m,w),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return C&&!v?V.createElement(V.Fragment,null,O,V.createElement(ui,{page:b})):O});_i.displayName=`Link`;var vi=V.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=ar(a,{relative:c.relative}),d=Zn(),f=V.useContext(Pn),{navigator:p,basename:m}=V.useContext(Bn),h=f!=null&&Oi(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=on(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),S={isActive:b,isPending:x,isTransitioning:h},C=b?e:void 0,w;w=typeof n==`function`?n(S):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let T=typeof i==`function`?i(S):i;return V.createElement(_i,{...c,"aria-current":C,className:w,ref:l,style:T,to:a,viewTransition:o},typeof s==`function`?s(S):s)});vi.displayName=`NavLink`;var yi=V.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=Mr,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=V.useContext(Bn),g=Ei(),_=Di(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&wt.test(s);return V.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?V.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});yi.displayName=`Form`;function bi(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function xi(e){let t=V.useContext(Nn);return U(t,bi(e)),t}function Si(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=tr(),d=Zn(),f=ar(e,{relative:o});return V.useCallback(p=>{if(zr(p,t)){p.preventDefault();let t=n===void 0?Ft(d)===Ft(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?V.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function Ci(e){jt(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=V.useRef(Br(e)),n=V.useRef(!1),r=Zn(),i=V.useMemo(()=>Vr(r.search,n.current?null:t.current),[r.search]),a=tr();return[i,V.useCallback((e,t)=>{let r=Br(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var wi=0,Ti=()=>`__${String(++wi)}__`;function Ei(){let{router:e}=xi(`useSubmit`),{basename:t}=V.useContext(Bn),n=br(),r=e.fetch,i=e.navigate;return V.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Kr(e,t);if(a.navigate===!1){let e=a.fetcherKey||Ti();await r(e,n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync})}else await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function Di(e,{relative:t}={}){let{basename:n}=V.useContext(Bn),r=V.useContext(Hn);U(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...ar(e||`.`,{relative:t})},o=Zn();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:mn([n,a.pathname])),Ft(a)}function Oi(e,{relative:t}={}){let n=V.useContext(Ln);U(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=xi(`useViewTransitionState`),i=ar(e,{relative:t});if(!n.isTransitioning)return!1;let a=on(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=on(n.nextLocation.pathname,r)||n.nextLocation.pathname;return tn(i.pathname,o)!=null||tn(i.pathname,a)!=null}var ki={name:`arrow-left`,size:24,node:[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]};ki.node;var Ai=w(ki),ji={name:`arrow-right-left`,size:24,node:[[`path`,{d:`m16 3 4 4-4 4`,key:`1x1c3m`}],[`path`,{d:`M20 7H4`,key:`zbl0bi`}],[`path`,{d:`m8 21-4-4 4-4`,key:`h9nckh`}],[`path`,{d:`M4 17h16`,key:`g4d7ey`}]]};ji.node;var Mi=w(ji),Ni={name:`building-complex`,size:24,node:[[`path`,{d:`M10 12h4`,key:`a56b0p`}],[`path`,{d:`M10 8h4`,key:`1sr2af`}],[`path`,{d:`M14 21v-3a2 2 0 0 0-4 0v3`,key:`1rgiei`}],[`path`,{d:`M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2`,key:`secmi2`}],[`path`,{d:`M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16`,key:`16ra0t`}]],aliases:[`building-2`]};Ni.node;var Pi=w(Ni),Fi={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};Fi.node;var Ii=w(Fi),Li={name:`circle-arrow-up`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]],aliases:[`arrow-up-circle`]};Li.node;var Ri=w(Li),zi={name:`circle-check`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]],aliases:[`check-circle-2`]};zi.node;var Bi=w(zi),Vi={name:`circle`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};Vi.node;var Hi=w(Vi),Ui={name:`eye-off`,size:24,node:[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};Ui.node;var Wi=w(Ui),Gi={name:`eye`,size:24,node:[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};Gi.node;var Ki=w(Gi),qi={name:`file-question-mark`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]],aliases:[`file-question`]};qi.node;var Ji=w(qi),Yi={name:`info`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]};Yi.node;var Xi=w(Yi),Zi={name:`key-round`,size:24,node:[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]};Zi.node;var Qi=w(Zi),$i={name:`languages`,size:24,node:[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]};$i.node;var ea=w($i),ta={name:`loader-circle`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]],aliases:[`loader-2`]};ta.node;var na=w(ta),ra={name:`lock`,size:24,node:[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]};ra.node;var ia=w(ra),aa={name:`log-in`,size:24,node:[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]};aa.node;var oa=w(aa),sa={name:`log-out`,size:24,node:[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]};sa.node;var ca=w(sa),la={name:`menu`,size:24,node:[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]};la.node;var ua=w(la),da={name:`octagon-x`,size:24,node:[[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z`,key:`2d38gg`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]],aliases:[`x-octagon`]};da.node;var fa=w(da),pa={name:`refresh-cw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]};pa.node;var ma=w(pa),ha={name:`shield-alert`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]};ha.node;var ga=w(ha),_a={name:`shield-check`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]};_a.node;var va=w(_a),ya={name:`tag`,size:24,node:[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]};ya.node;var ba=w(ya),xa={name:`triangle-alert`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`]};xa.node;var Sa=w(xa),Ca={name:`user-plus`,size:24,node:[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`19`,x2:`19`,y1:`8`,y2:`14`,key:`1bvyxn`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]};Ca.node;var wa=w(Ca),Ta={name:`user`,size:24,node:[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]};Ta.node;var Ea=w(Ta);function Da({className:e,size:t=32}){return(0,H.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:t,height:t,fill:`none`,viewBox:`0 0 32 32`,className:M(`shrink-0`,e),children:(0,H.jsx)(`path`,{stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`2.484`,d:`M22.356 19.797H17.17M9.662 12.29l1.979 3.576a.511.511 0 0 1-.005.504l-1.974 3.409M30.758 16c0 8.15-6.607 14.758-14.758 14.758-8.15 0-14.758-6.607-14.758-14.758C1.242 7.85 7.85 1.242 16 1.242c8.15 0 14.758 6.608 14.758 14.758Z`})})}var Oa=Object.defineProperty,ka=(e,t)=>Oa(e,`name`,{value:t,configurable:!0}),Aa=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),ja=V.forwardRef(ka(function(e,t){return(0,H.jsx)(Se.span,{...e,ref:t,style:{...Aa,...e.style}})},`VisuallyHidden`)),Ma=Object.defineProperty,Na=(e,t)=>Ma(e,`name`,{value:t,configurable:!0}),Pa=`Dialog`,[Fa,Ia]=ae(Pa),[La,Ra]=Fa(Pa),za=Na(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=V.useRef(null),c=V.useRef(null),{nodes:l,registry:u}=ce(),[d,f]=me({prop:r,defaultProp:i??!1,onChange:a,caller:Pa}),[p,m]=V.useState(0),[h,g]=V.useState(0);return(0,H.jsx)(La,{scope:t,triggerRef:s,contentRef:c,contentId:ue(),titleId:ue(),descriptionId:ue(),titlePresent:p>0,descriptionPresent:h>0,setTitleCount:m,setDescriptionCount:g,open:d,onOpenChange:f,onOpenToggle:V.useCallback(()=>f(e=>!e),[f]),modal:o,branchNodes:l,branchRegistry:u,children:n})},`Dialog`),Ba=`DialogTrigger`,Va=V.forwardRef(Na(function(e,t){let{__scopeDialog:n,...r}=e,i=Ra(Ba,n),a=je(t,i.triggerRef);return(0,H.jsx)(Se.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":oo(i.open),...r,ref:a,onClick:A(e.onClick,i.onOpenToggle)})},`DialogTrigger`)),Ha=`DialogPortal`,[Ua,Wa]=Fa(Ha,{forceMount:void 0}),Ga=Na(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Ra(Ha,t);return(0,H.jsx)(Ua,{scope:t,forceMount:n,children:V.Children.map(r,e=>(0,H.jsx)(_e,{present:n||a.open,children:(0,H.jsx)(fe,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),Ka=`DialogOverlay`,qa=V.forwardRef(Na(function(e,t){let n=Wa(Ka,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Ra(Ka,e.__scopeDialog);return a.modal?(0,H.jsx)(_e,{present:r||a.open,children:(0,H.jsx)(Ya,{...i,ref:t})}):null},`DialogOverlay`)),Ja=Oe(`DialogOverlay.RemoveScroll`),Ya=V.forwardRef(Na(function(e,t){let{__scopeDialog:n,...r}=e,i=Ra(Ka,n),a=xe(),o=je(t,a);return(0,H.jsx)(he,{as:Ja,allowPinchZoom:!0,shards:V.useMemo(()=>[i.contentRef,...i.branchNodes.map(e=>({current:e}))],[i.contentRef,i.branchNodes]),children:(0,H.jsx)(Se.div,{"data-state":oo(i.open),...r,ref:o,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),Xa=`DialogContent`,Za=V.forwardRef(Na(function(e,t){let n=Wa(Xa,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Ra(Xa,e.__scopeDialog);return(0,H.jsx)(_e,{present:r||a.open,children:a.modal?(0,H.jsx)(Qa,{...i,ref:t}):(0,H.jsx)($a,{...i,ref:t})})},`DialogContent`)),Qa=V.forwardRef(Na(function(e,t){let n=Ra(Xa,e.__scopeDialog),r=V.useRef(null),i=je(t,n.contentRef,r);return V.useEffect(()=>{let e=r.current;if(e)return be(e)},[]),(0,H.jsx)(eo,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:A(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:A(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:A(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),$a=V.forwardRef(Na(function(e,t){let n=Ra(Xa,e.__scopeDialog),r=V.useRef(!1),i=V.useRef(!1);return(0,H.jsx)(eo,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),eo=V.forwardRef(Na(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,"aria-describedby":o,children:s,...c}=e,l=Ra(Xa,n);return ve(),(0,H.jsx)(ge,{registry:l.branchRegistry,children:(0,H.jsx)(oe,{asChild:!0,loop:!0,trapped:r,branches:l.branchNodes,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,H.jsx)(pe,{role:`dialog`,id:l.contentId,"aria-labelledby":l.titlePresent?l.titleId:void 0,"aria-describedby":l.descriptionPresent?ao(o,l.descriptionId):o,"data-state":oo(l.open),...c,ref:t,deferPointerDownOutside:!0,onDismiss:()=>l.onOpenChange(!1),children:s})})})},`DialogContentImpl`)),to=V.forwardRef(Na(function(e,t){let{__scopeDialog:n,...r}=e,i=Ra(`DialogTitle`,n),{setTitleCount:a}=i;return de(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,H.jsx)(Se.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),no=V.forwardRef(Na(function(e,t){let{__scopeDialog:n,...r}=e,i=Ra(`DialogDescription`,n),{setDescriptionCount:a}=i;return de(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,H.jsx)(Se.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),ro=`DialogClose`,io=V.forwardRef(Na(function(e,t){let{__scopeDialog:n,...r}=e,i=Ra(ro,n);return(0,H.jsx)(Se.button,{type:`button`,...r,ref:t,onClick:A(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function ao(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}Na(ao,`concatAriaDescribedby`);function oo(e){return e?`open`:`closed`}Na(oo,`getState`);var so=Object.defineProperty,co=(e,t)=>so(e,`name`,{value:t,configurable:!0}),lo=!1;function uo(){let[e,t]=V.useState(lo);return V.useEffect(()=>{lo||(lo=!0,t(!0))},[]),e}co(uo,`useIsHydrated`);var fo=V.useSyncExternalStore;function po(){return()=>{}}co(po,`subscribe`);function mo(){return fo(po,()=>!0,()=>!1)}co(mo,`useIsHydratedModern`);var ho=typeof fo==`function`?mo:uo,go=Object.defineProperty,_o=(e,t)=>go(e,`name`,{value:t,configurable:!0}),vo=`rovingFocusGroup.onEntryFocus`,yo={bubbles:!1,cancelable:!0},bo=`RovingFocusGroup`,[xo,So,Co]=E(bo),[wo,To]=ae(bo,[Co]),Eo={Vertical:`vertical`,Horizontal:`horizontal`},Do={LTR:`ltr`,RTL:`rtl`},[Oo,ko]=wo(bo),Ao=V.forwardRef(_o(function(e,t){return(0,H.jsx)(xo.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,H.jsx)(xo.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,H.jsx)(jo,{...e,ref:t})})})},`RovingFocusGroup`)),jo=V.forwardRef(_o(function(e,t){let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=V.useRef(null),p=je(t,f),m=re(a),[h,g]=me({prop:o,defaultProp:s??null,onChange:c,caller:bo}),[_,v]=V.useState(!1),y=le(l),b=So(n),x=V.useRef(!1),[S,C]=V.useState(0);return V.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(vo,y),()=>e.removeEventListener(vo,y)},[y]),(0,H.jsx)(Oo,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:V.useCallback(e=>g(e),[g]),onItemShiftTab:V.useCallback(()=>v(!0),[]),onFocusableItemAdd:V.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:V.useCallback(()=>C(e=>e-1),[]),children:(0,H.jsx)(Se.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:A(e.onMouseDown,()=>{x.current=!0}),onFocus:A(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(vo,yo);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);Lo([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:A(e.onBlur,()=>v(!1))})})},`RovingFocusGroupImpl`)),Mo=`RovingFocusGroupItem`,No=V.forwardRef(_o(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=ue(),l=a||c,u=ko(Mo,n),d=u.currentTabStopId===l,f=So(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u,g=ho();return de(()=>{if(g&&r)return p(),()=>m()},[g,r,p,m]),V.useEffect(()=>{if(!g&&r)return p(),()=>m()},[g,r,p,m]),(0,H.jsx)(xo.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,H.jsx)(Se.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:A(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:A(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:A(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=Io(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?Ro(n,r+1):n.slice(r+1)}setTimeout(()=>Lo(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})},`RovingFocusGroupItem`)),Po={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Fo(e,t){return t===Do.RTL?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}_o(Fo,`getDirectionAwareKey`);function Io(e,t,n){let r=Fo(e.key,n);if(!(t===Eo.Vertical&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===Eo.Horizontal&&[`ArrowUp`,`ArrowDown`].includes(r)))return Po[r]}_o(Io,`getFocusIntent`);function Lo(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}_o(Lo,`focusFirst`);function Ro(e,t){return e.map((n,r)=>e[(t+r)%e.length])}_o(Ro,`wrapArray`);var zo=Object.defineProperty,W=(e,t)=>zo(e,`name`,{value:t,configurable:!0}),Bo=[`Enter`,` `],Vo=[`ArrowDown`,`PageUp`,`Home`],Ho=[`ArrowUp`,`PageDown`,`End`],Uo=[...Vo,...Ho];[...Bo],[...Bo];var Wo=`Menu`,[Go,Ko,qo]=E(Wo),[Jo,Yo]=ae(Wo,[qo,te,To]),Xo=te(),Zo=To(),[Qo,$o]=Jo(Wo),[es,ts]=Jo(Wo),ns=W(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=Xo(t),[c,l]=V.useState(null),u=V.useRef(!1),d=le(a),f=re(i);return V.useEffect(()=>{let e=W(()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=W(()=>u.current=!1,`handlePointer`);return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),V.useEffect(()=>{if(!n)return;let e=W(()=>d(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,H.jsx)(O,{...s,children:(0,H.jsx)(Qo,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,H.jsx)(es,{scope:t,onClose:V.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},`Menu`),rs=V.forwardRef(W(function(e,t){let{__scopeMenu:n,...r}=e,i=Xo(n);return(0,H.jsx)(ne,{...i,...r,ref:t})},`MenuAnchor`)),is=`MenuPortal`,[as,os]=Jo(is,{forceMount:void 0}),ss=W(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=$o(is,t);return(0,H.jsx)(as,{scope:t,forceMount:n,children:(0,H.jsx)(_e,{present:n||a.open,children:(0,H.jsx)(fe,{asChild:!0,container:i,children:r})})})},`MenuPortal`),cs=`MenuContent`,[ls,us]=Jo(cs),ds=V.forwardRef(W(function(e,t){let n=os(cs,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=$o(cs,e.__scopeMenu),o=ts(cs,e.__scopeMenu);return(0,H.jsx)(Go.Provider,{scope:e.__scopeMenu,children:(0,H.jsx)(_e,{present:r||a.open,children:(0,H.jsx)(Go.Slot,{scope:e.__scopeMenu,children:o.modal?(0,H.jsx)(fs,{...i,ref:t}):(0,H.jsx)(ps,{...i,ref:t})})})})},`MenuContent`)),fs=V.forwardRef(W(function(e,t){let n=$o(cs,e.__scopeMenu),r=V.useRef(null),i=je(t,r);return V.useEffect(()=>{let e=r.current;if(e)return be(e)},[]),(0,H.jsx)(hs,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:A(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),ps=V.forwardRef(W(function(e,t){let n=$o(cs,e.__scopeMenu);return(0,H.jsx)(hs,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),ms=Oe(`MenuContent.ScrollLock`),hs=V.forwardRef(W(function(e,t){let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=$o(cs,n),_=ts(cs,n),v=Xo(n),y=Zo(n),b=Ko(n),[x,S]=V.useState(null),C=V.useRef(null),[w,E]=V.useState(null);ye(w);let{nodes:D,registry:ee}=ce(),O=!!(i||m),te=je(t,C,g.onContentChange,E),ne=V.useRef(0),re=V.useRef(``),k=V.useRef(0),ie=V.useRef(null),ae=V.useRef(`right`),se=V.useRef(0),le=V.useMemo(()=>m?[C,...D.map(e=>({current:e}))]:[],[C,D,m]),ue=m?he:V.Fragment,de=m?{as:ms,allowPinchZoom:!0,shards:le}:void 0,fe=W(e=>{let t=re.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=Bs(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;W((function e(t){re.current=t,window.clearTimeout(ne.current),t!==``&&(ne.current=window.setTimeout(()=>e(``),1e3))}),`updateSearch`)(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);V.useEffect(()=>()=>window.clearTimeout(ne.current),[]),ve();let me=V.useCallback(e=>ae.current===ie.current?.side&&Hs(e,ie.current?.area),[]);return(0,H.jsx)(ls,{scope:n,searchRef:re,onItemEnter:V.useCallback(e=>{me(e)&&e.preventDefault()},[me]),onItemLeave:V.useCallback(e=>{me(e)||(C.current?.focus(),S(null))},[me]),onTriggerLeave:V.useCallback(e=>{me(e)&&e.preventDefault()},[me]),pointerGraceTimerRef:k,onPointerGraceIntentChange:V.useCallback(e=>{ie.current=e},[]),children:(0,H.jsx)(ge,{registry:O?ee:null,children:(0,H.jsx)(ue,{...de,children:(0,H.jsx)(oe,{asChild:!0,trapped:i,branches:D,onMountAutoFocus:A(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,H.jsx)(pe,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,H.jsx)(Ao,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:A(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,H.jsx)(T,{role:`menu`,"aria-orientation":`vertical`,"data-state":Fs(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:te,style:{outline:`none`,...h.style},onKeyDown:A(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&fe(e.key));let i=C.current;if(e.target!==i||!Uo.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);Ho.includes(e.key)&&a.reverse(),Rs(a)}),onBlur:A(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(ne.current),re.current=``)}),onPointerMove:A(e.onPointerMove,Us(e=>{let t=e.target,n=se.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>se.current?`right`:`left`;ae.current=t,se.current=e.clientX}}))})})})})})})})},`MenuContentImpl`)),gs=V.forwardRef(W(function(e,t){let{__scopeMenu:n,...r}=e;return(0,H.jsx)(Se.div,{role:`group`,...r,ref:t})},`MenuGroup`)),_s=V.forwardRef(W(function(e,t){let{__scopeMenu:n,...r}=e;return(0,H.jsx)(Se.div,{...r,ref:t})},`MenuLabel`)),vs=`MenuItem`,ys=`menu.itemSelect`,bs=V.forwardRef(W(function(e,t){let{disabled:n=!1,onSelect:r,...i}=e,a=V.useRef(null),o=ts(vs,e.__scopeMenu),s=us(vs,e.__scopeMenu),c=je(t,a),l=V.useRef(!1),u=W(()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(ys,{bubbles:!0,cancelable:!0});e.addEventListener(ys,e=>r?.(e),{once:!0}),Ce(e,t),t.defaultPrevented?l.current=!1:o.onClose()}},`handleSelect`);return(0,H.jsx)(xs,{...i,ref:c,disabled:n,onClick:A(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:A(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:A(e.onKeyDown,e=>{n||e.target!==e.currentTarget||(s.searchRef.current===``||e.key!==` `)&&Bo.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),xs=V.forwardRef(W(function(e,t){let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=us(vs,n),s=Zo(n),c=V.useRef(null),l=je(t,c),[u,d]=V.useState(!1),[f,p]=V.useState(``);return V.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,H.jsx)(Go.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,H.jsx)(No,{asChild:!0,...s,focusable:!r,children:(0,H.jsx)(Se.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:A(e.onPointerMove,Us(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:A(e.onPointerLeave,Us(e=>o.onItemLeave(e))),onFocus:A(e.onFocus,()=>d(!0)),onBlur:A(e.onBlur,()=>d(!1))})})})},`MenuItemImpl`)),Ss=V.forwardRef(W(function(e,t){let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,H.jsx)(ks,{scope:e.__scopeMenu,checked:n,children:(0,H.jsx)(bs,{role:`menuitemcheckbox`,"aria-checked":Is(n)?`mixed`:n,...i,ref:t,"data-state":Ls(n),onSelect:A(i.onSelect,()=>r?.(Is(n)?!0:!n),{checkForDefaultPrevented:!1})})})},`MenuCheckboxItem`)),[Cs,ws]=Jo(`MenuRadioGroup`,{value:void 0,onValueChange:W(()=>{},`onValueChange`)}),Ts=V.forwardRef(W(function(e,t){let{value:n,onValueChange:r,...i}=e,a=le(r);return(0,H.jsx)(Cs,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,H.jsx)(gs,{...i,ref:t})})},`MenuRadioGroup`)),Es=`MenuRadioItem`,Ds=V.forwardRef(W(function(e,t){let{value:n,...r}=e,i=ws(Es,e.__scopeMenu),a=n===i.value;return(0,H.jsx)(ks,{scope:e.__scopeMenu,checked:a,children:(0,H.jsx)(bs,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":Ls(a),onSelect:A(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})},`MenuRadioItem`)),Os=`MenuItemIndicator`,[ks,As]=Jo(Os,{checked:!1}),js=V.forwardRef(W(function(e,t){let{__scopeMenu:n,forceMount:r,...i}=e,a=As(Os,n);return(0,H.jsx)(_e,{present:r||Is(a.checked)||a.checked===!0,children:(0,H.jsx)(Se.span,{...i,ref:t,"data-state":Ls(a.checked)})})},`MenuItemIndicator`)),Ms=V.forwardRef(W(function(e,t){let{__scopeMenu:n,...r}=e;return(0,H.jsx)(Se.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})},`MenuSeparator`)),[Ns,Ps]=Jo(`MenuSub`);function Fs(e){return e?`open`:`closed`}W(Fs,`getOpenState`);function Is(e){return e===`indeterminate`}W(Is,`isIndeterminate`);function Ls(e){return Is(e)?`indeterminate`:e?`checked`:`unchecked`}W(Ls,`getCheckedState`);function Rs(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}W(Rs,`focusFirst`);function zs(e,t){return e.map((n,r)=>e[(t+r)%e.length])}W(zs,`wrapArray`);function Bs(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=zs(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}W(Bs,`getNextMatch`);function Vs(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}W(Vs,`isPointInPolygon`);function Hs(e,t){return t?Vs({x:e.clientX,y:e.clientY},t):!1}W(Hs,`isPointerInGraceArea`);function Us(e){return t=>t.pointerType===`mouse`?e(t):void 0}W(Us,`whenMouse`);var Ws=Object.defineProperty,Gs=(e,t)=>Ws(e,`name`,{value:t,configurable:!0}),Ks=`DropdownMenu`,[qs,Js]=ae(Ks,[Yo]),Ys=Yo(),[Xs,Zs]=qs(Ks),Qs=Gs(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=Ys(t),l=V.useRef(null),[u,d]=me({prop:i,defaultProp:a??!1,onChange:o,caller:Ks});return(0,H.jsx)(Xs,{scope:t,triggerId:ue(),triggerRef:l,contentId:ue(),open:u,onOpenChange:d,onOpenToggle:V.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,H.jsx)(ns,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})},`DropdownMenu`),$s=`DropdownMenuTrigger`,ec=V.forwardRef(Gs(function(e,t){let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=Zs($s,n),o=Ys(n),s=je(t,a.triggerRef);return(0,H.jsx)(rs,{asChild:!0,...o,children:(0,H.jsx)(Se.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:s,onPointerDown:A(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:A(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),tc=Gs(e=>{let{__scopeDropdownMenu:t,...n}=e,r=Ys(t);return(0,H.jsx)(ss,{...r,...n})},`DropdownMenuPortal`),nc=`DropdownMenuContent`,rc=V.forwardRef(Gs(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Zs(nc,n),a=Ys(n),o=V.useRef(!1);return(0,H.jsx)(ds,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:A(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:A(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuContent`)),ic=V.forwardRef(Gs(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Ys(n);return(0,H.jsx)(_s,{...i,...r,ref:t})},`DropdownMenuLabel`)),ac=V.forwardRef(Gs(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Ys(n);return(0,H.jsx)(bs,{...i,...r,ref:t})},`DropdownMenuItem`)),oc=V.forwardRef(Gs(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Ys(n);return(0,H.jsx)(Ss,{...i,...r,ref:t})},`DropdownMenuCheckboxItem`)),sc=V.forwardRef(Gs(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Ys(n);return(0,H.jsx)(Ts,{...i,...r,ref:t})},`DropdownMenuRadioGroup`)),cc=V.forwardRef(Gs(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Ys(n);return(0,H.jsx)(Ds,{...i,...r,ref:t})},`DropdownMenuRadioItem`)),lc=V.forwardRef(Gs(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Ys(n);return(0,H.jsx)(js,{...i,...r,ref:t})},`DropdownMenuItemIndicator`)),uc=V.forwardRef(Gs(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Ys(n);return(0,H.jsx)(Ms,{...i,...r,ref:t})},`DropdownMenuSeparator`)),dc=Object.defineProperty,fc=(e,t)=>dc(e,`name`,{value:t,configurable:!0}),[pc,mc]=ae(`Tooltip`,[te]),hc=te(),gc=`TooltipProvider`,_c=700,vc=`tooltip.open`,[yc,bc]=pc(gc),xc=fc(e=>{let{__scopeTooltip:t,delayDuration:n=_c,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=V.useRef(!0),s=V.useRef(!1),c=V.useRef(0);return V.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,H.jsx)(yc,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:V.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:V.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:V.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})},`TooltipProvider`),Sc=`Tooltip`,[Cc,wc]=pc(Sc),Tc=fc(e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=bc(Sc,e.__scopeTooltip),l=hc(t),[u,d]=V.useState(null),[f,p]=V.useState(void 0),m=ue(),h=V.useRef(0),g=o??c.disableHoverableContent,_=s??c.delayDuration,v=V.useRef(!1),[y,b]=me({prop:r,defaultProp:i??!1,onChange:fc(e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(vc))):c.onClose(),a?.(e)},`onChange`),caller:Sc}),x=V.useMemo(()=>y?v.current?`delayed-open`:`instant-open`:`closed`,[y]),S=V.useCallback(()=>{window.clearTimeout(h.current),h.current=0,v.current=!1,b(!0)},[b]),C=V.useCallback(()=>{window.clearTimeout(h.current),h.current=0,b(!1)},[b]),w=V.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{v.current=!0,b(!0),h.current=0},_)},[_,b]);V.useEffect(()=>()=>{h.current&&=(window.clearTimeout(h.current),0)},[]);let T=f??m;return(0,H.jsx)(O,{...l,children:(0,H.jsx)(Cc,{scope:t,contentId:T,setContentId:p,open:y,stateAttribute:x,trigger:u,onTriggerChange:d,onTriggerEnter:V.useCallback(()=>{c.isOpenDelayedRef.current?w():S()},[c.isOpenDelayedRef,w,S]),onTriggerLeave:V.useCallback(()=>{g?C():(window.clearTimeout(h.current),h.current=0)},[C,g]),onOpen:S,onClose:C,disableHoverableContent:g,children:n})})},`Tooltip`),Ec=`TooltipTrigger`,Dc=V.forwardRef(fc(function(e,t){let{__scopeTooltip:n,"aria-describedby":r,...i}=e,a=wc(Ec,n),o=bc(Ec,n),s=hc(n),c=V.useRef(null),l=je(t,c,a.onTriggerChange),u=V.useRef(!1),d=V.useRef(!1),f=V.useCallback(()=>u.current=!1,[]);return V.useEffect(()=>()=>document.removeEventListener(`pointerup`,f),[f]),(0,H.jsx)(ne,{asChild:!0,...s,children:(0,H.jsx)(Se.button,{"aria-describedby":a.open?Wc(r,a.contentId):r,"data-state":a.stateAttribute,...i,ref:l,onPointerMove:A(e.onPointerMove,e=>{e.pointerType!==`touch`&&!d.current&&!o.isPointerInTransitRef.current&&(a.onTriggerEnter(),d.current=!0)}),onPointerLeave:A(e.onPointerLeave,()=>{a.onTriggerLeave(),d.current=!1}),onPointerDown:A(e.onPointerDown,()=>{a.open&&a.onClose(),u.current=!0,document.addEventListener(`pointerup`,f,{once:!0})}),onFocus:A(e.onFocus,()=>{u.current||a.onOpen()}),onBlur:A(e.onBlur,a.onClose),onClick:A(e.onClick,a.onClose)})})},`TooltipTrigger`)),Oc=`TooltipPortal`,[kc,Ac]=pc(Oc,{forceMount:void 0}),jc=fc(e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=wc(Oc,t);return(0,H.jsx)(kc,{scope:t,forceMount:n,children:(0,H.jsx)(_e,{present:n||a.open,children:(0,H.jsx)(fe,{asChild:!0,container:i,children:r})})})},`TooltipPortal`),Mc=`TooltipContent`,Nc=V.forwardRef(fc(function(e,t){let n=Ac(Mc,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=wc(Mc,e.__scopeTooltip);return(0,H.jsx)(_e,{present:r||o.open,children:o.disableHoverableContent?(0,H.jsx)(Ic,{side:i,...a,ref:t}):(0,H.jsx)(Pc,{side:i,...a,ref:t})})},`TooltipContent`)),Pc=V.forwardRef(fc(function(e,t){let n=wc(Mc,e.__scopeTooltip),r=bc(Mc,e.__scopeTooltip),i=V.useRef(null),a=je(t,i),[o,s]=V.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=V.useCallback(()=>{s(null),d(!1)},[d]),p=V.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=zc(r,Rc(r,n.getBoundingClientRect())),a=Bc(t.getBoundingClientRect()),o=Hc([...i,...a]);s(o),d(!0)},[d]);return V.useEffect(()=>()=>f(),[f]),V.useEffect(()=>{if(c&&u){let e=fc(e=>p(e,u),`handleTriggerLeave`),t=fc(e=>p(e,c),`handleContentLeave`);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),V.useEffect(()=>{if(o){let e=fc(e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!Vc(n,o);r?f():i&&(f(),l())},`handleTrackPointerGrace`);return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,H.jsx)(Ic,{...e,ref:a})},`TooltipContentHoverable`)),Fc=Ae(`TooltipContent`),Ic=V.forwardRef(fc(function(e,t){let{__scopeTooltip:n,children:r,"aria-label":i,id:a,onEscapeKeyDown:o,onPointerDownOutside:s,...c}=e,l=wc(Mc,n),u=hc(n),{onClose:d}=l;V.useEffect(()=>(document.addEventListener(vc,d),()=>document.removeEventListener(vc,d)),[d]),V.useEffect(()=>{if(l.trigger){let e=fc(e=>{e.target instanceof Node&&e.target.contains(l.trigger)&&d()},`handleScroll`);return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[l.trigger,d]);let{setContentId:f}=l;return de(()=>(f(a),()=>{f(void 0)}),[a,f]),(0,H.jsx)(pe,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:d,children:(0,H.jsxs)(T,{"data-state":l.stateAttribute,role:i?void 0:`tooltip`,id:i?void 0:l.contentId,...u,...c,ref:t,style:{...c.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,H.jsx)(Fc,{children:r}),i?(0,H.jsx)(ja,{id:l.contentId,role:`tooltip`,children:i}):null]})})},`TooltipContentImpl`)),Lc=V.forwardRef(fc(function(e,t){let{__scopeTooltip:n,...r}=e,i=hc(n);return(0,H.jsx)(D,{...i,...r,ref:t})},`TooltipArrow`));function Rc(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}fc(Rc,`getExitSideFromRect`);function zc(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n})}return r}fc(zc,`getPaddedExitPoints`);function Bc(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}fc(Bc,`getPointsFromRect`);function Vc(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}fc(Vc,`isPointInPolygon`);function Hc(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),Uc(t)}fc(Hc,`getHull`);function Uc(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}fc(Uc,`getHullPresorted`);function Wc(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}fc(Wc,`concatAriaDescribedby`);function Gc({...e}){return(0,H.jsx)(Qs,{"data-slot":`dropdown-menu`,...e})}function Kc({...e}){return(0,H.jsx)(ec,{"data-slot":`dropdown-menu-trigger`,...e})}function qc({className:e,sideOffset:t=4,...n}){return(0,H.jsx)(tc,{children:(0,H.jsx)(rc,{"data-slot":`dropdown-menu-content`,sideOffset:t,className:M(`bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md`,e),...n})})}function Jc({className:e,inset:t,variant:n=`default`,...r}){return(0,H.jsx)(ac,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:M(`focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r})}function Yc({className:e,children:t,checked:n,...r}){return(0,H.jsxs)(oc,{"data-slot":`dropdown-menu-checkbox-item`,className:M(`focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),checked:n,...r,children:[(0,H.jsx)(`span`,{className:`pointer-events-none absolute left-2 flex size-3.5 items-center justify-center`,children:(0,H.jsx)(lc,{children:(0,H.jsx)(Ii,{className:`size-4`})})}),t]})}function Xc({...e}){return(0,H.jsx)(sc,{"data-slot":`dropdown-menu-radio-group`,...e})}function Zc({className:e,children:t,...n}){return(0,H.jsxs)(cc,{"data-slot":`dropdown-menu-radio-item`,className:M(`focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...n,children:[(0,H.jsx)(`span`,{className:`pointer-events-none absolute left-2 flex size-3.5 items-center justify-center`,children:(0,H.jsx)(lc,{children:(0,H.jsx)(Hi,{className:`size-2 fill-current`})})}),t]})}function Qc({className:e,inset:t,...n}){return(0,H.jsx)(ic,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:M(`px-2 py-1.5 text-sm font-medium data-[inset]:pl-8`,e),...n})}function $c({className:e,...t}){return(0,H.jsx)(uc,{"data-slot":`dropdown-menu-separator`,className:M(`bg-border -mx-1 my-1 h-px`,e),...t})}function el(e,t){let n=e.startsWith(`?`)?e.slice(1):e;return new URLSearchParams(n).get(`advanced`)===`1`||t===`#firewall`}var tl=`access`,nl=`#access-people`,rl=`#${tl}`,il=new Set([rl,`#totp`]);function al(e){return e===`#access-people`?`people`:il.has(e)?`my-sign-in`:null}var ol=`organisation`,sl=`#${ol}`,cl=`#organisation-refused`,ll=`organisation-login-policy`,ul=`#${ll}`,dl=`oidc`,fl=`#${dl}`,pl=`organisation-automatic-accounts`,ml=`#${pl}`,hl=`org`,gl=`/settings?${hl}=1${fl}`,_l=new Set([sl,cl,ul,fl,ml]);function vl(e,t){let n=e.startsWith(`?`)?e.slice(1):e;return new URLSearchParams(n).get(hl)===`1`||_l.has(t)}var yl=e=>e.type===`checkbox`,bl=e=>e.type===`file`,xl=e=>e instanceof Date,Sl=e=>e==null,Cl=e=>typeof e==`object`,G=e=>!Sl(e)&&!Array.isArray(e)&&Cl(e)&&!xl(e),wl=e=>G(e)&&e.target?yl(e.target)?e.target.checked:bl(e.target)?e.target.files:e.target.value:e,Tl=/[.[\]'"]/,El=e=>e.split(Tl).filter(Boolean);function Dl(e,t){let n=El(t),r=e._formValues,i=e._defaultValues;for(let e=0;e<n.length-1;e++){let t=n[e];if(r=r==null?r:r[t],i=i==null?i:i[t],r===null||i===null)return null}}var Ol=(e,t)=>t.split(`.`).some((t,n,r)=>!isNaN(Number(t))&&e.has(r.slice(0,n).join(`.`))),kl=typeof window<`u`&&window.HTMLElement!==void 0&&typeof document<`u`;function K(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e);let t=typeof Blob<`u`&&e instanceof Blob,n=typeof FileList<`u`&&e instanceof FileList;if(kl&&(t||n))return e;let r=Array.isArray(e);if(!r&&e.constructor!==Object)return e;let i=r?[]:Object.create(Object.getPrototypeOf(e));for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(i[t]=K(e[t]));return i}var Al={BLUR:`blur`,FOCUS_OUT:`focusout`,CHANGE:`change`,SUBMIT:`submit`,TRIGGER:`trigger`,VALID:`valid`},jl={onBlur:`onBlur`,onChange:`onChange`,onSubmit:`onSubmit`,onTouched:`onTouched`,all:`all`},Ml={max:`max`,min:`min`,maxLength:`maxLength`,minLength:`minLength`,pattern:`pattern`,required:`required`,validate:`validate`},Nl=[Ml.required,Ml.min,Ml.max,Ml.minLength,Ml.maxLength,Ml.pattern,Ml.validate],Pl=`form`,Fl=`root`,Il=[`__proto__`,`constructor`,`prototype`],Ll=/^\w*$/,Rl=e=>Ll.test(e),q=e=>e===void 0,J=(e,t,n)=>{if(!t||!G(e))return n;let r=Rl(t)?[t]:El(t);if(r.some(e=>Il.includes(e)))return n;let i=r.reduce((e,t)=>Sl(e)?void 0:e[t],e);return q(i)||i===e?q(e[t])?n:e[t]:i},zl=e=>typeof e==`boolean`,Bl=e=>typeof e==`function`,Y=(e,t,n)=>{let r=-1,i=Rl(t)?[t]:El(t),a=i.length,o=a-1;for(;++r<a;){let t=i[r],a=n;if(r!==o){let n=e[t];a=G(n)||Array.isArray(n)?n:isNaN(+i[r+1])?{}:[]}if(Il.includes(t))return;e[t]=a,e=e[t]}},Vl=V.createContext(null);Vl.displayName=`HookFormControlContext`;var Hl=()=>V.useContext(Vl),Ul=(e,t,n,r=!0)=>{let i={};for(let a in e)Object.defineProperty(i,a,{get:()=>{let i=a;return t._proxyFormState[i]!==jl.all&&(t._proxyFormState[i]=!r||jl.all),n&&(n[i]=!0),e[i]}});return i},Wl=kl?V.useLayoutEffect:V.useEffect,Gl=e=>{let t=e.constructor&&e.constructor.prototype;return G(t)&&t.hasOwnProperty(`isPrototypeOf`)},Kl=e=>Sl(e)||!Cl(e),ql=(e,t)=>t.length===0&&!Array.isArray(e)&&!Gl(e);function Jl(e,t,n=new WeakMap){if(e===t)return!0;if(Kl(e)||Kl(t))return Object.is(e,t);if(xl(e)&&xl(t))return Object.is(e.getTime(),t.getTime());let r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;if(ql(e,r)||ql(t,i))return Object.is(e,t);if(!r.length&&Array.isArray(e)!==Array.isArray(t))return!1;let a=n.get(e);if(a&&a.has(t))return!0;if(a)a.add(t);else{let r=new WeakSet;r.add(t),n.set(e,r)}for(let i of r){let r=e[i];if(!(i in t))return!1;if(i!==`ref`){let e=t[i];if(xl(r)&&xl(e)||(G(r)||Array.isArray(r))&&(G(e)||Array.isArray(e))?!Jl(r,e,n):!Object.is(r,e))return!1}}return!0}function Yl(e){let t=V.useRef(!1),n=V.useRef(!1),r=V.useRef(void 0),i=V.useRef(0);return i.current++,!n.current&&e&&(n.current=!0,r.current=K(e())),{resyncIfNeeded:V.useCallback((e,a,o)=>{if(e&&(t.current||n.current&&i.current>1)){let e=a();Jl(r.current,e)||o(e)}t.current=!0},[]),snapshot:V.useCallback((e,t)=>{e&&(r.current=K(t()))},[])}}function Xl(e){let t=Hl(),{control:n=t,disabled:r,name:i,exact:a}=e||{},o=()=>({...n._formState,defaultValues:n._defaultValues}),[s,c]=V.useState(o),l=V.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),{resyncIfNeeded:u,snapshot:d}=Yl(o);return Wl(()=>{u(!r,o,c);let e=n._subscribe({name:i,formState:l.current,exact:a,callback:e=>{!r&&c({...n._formState,...e,defaultValues:n._defaultValues})}});return()=>{e(),d(!r,o)}},[n,i,r,a,u,d]),V.useEffect(()=>{l.current.isValid&&n._setValid(!0)},[n]),V.useMemo(()=>Ul(s,n,l.current,!1),[s,n])}var Zl=e=>typeof e==`string`,Ql=(e,t,n,r,i)=>Zl(e)?(r&&t.watch.add(e),J(n,e,i)):Array.isArray(e)?e.map(e=>(r&&t.watch.add(e),J(n,e,J(i,e)))):(r&&(t.watchAll=!0),n);function $l(e){let t=Hl(),{control:n=t,name:r,defaultValue:i,disabled:a,exact:o,compute:s}=e||{},c=V.useRef(i),l=V.useRef(s),u=V.useRef(n),d=V.useRef(r);l.current=s;let f=()=>{let e=n._getWatch(r,c.current);return l.current?l.current(e):e},[p,m]=V.useState(f),h=V.useRef(p),g=V.useCallback(e=>{let t=Ql(r,n._names,e||n._formValues,!1,c.current);return l.current?l.current(t):t},[n._formValues,n._names,r]),_=V.useCallback(e=>{if(!a){let t=Ql(r,n._names,e||n._formValues,!1,c.current);if(l.current){let e=l.current(t);Jl(e,h.current)||(m(e),h.current=e)}else m(t)}},[n._formValues,n._names,a,r]),{resyncIfNeeded:v,snapshot:y}=Yl(f),b=V.useRef(_);b.current=_;let x=V.useRef(g);x.current=g,Wl(()=>{u.current!==n||!Jl(d.current,r)?(u.current=n,d.current=r,b.current()):v(!a,()=>x.current(),e=>{m(e),h.current=e});let e=n._subscribe({name:r,formState:{values:!0},exact:o,callback:e=>{b.current(e.values)}});return()=>{e(),y(!a,()=>x.current())}},[n,o,r,a,v,y]),V.useEffect(()=>n._removeUnmounted());let S=u.current!==n,C=d.current;return V.useMemo(()=>{if(a)return!1;let e=!S&&!Jl(C,r);return S||e},[a,S,r,C])?g():p}function eu(e){let t=Hl(),{name:n,disabled:r,control:i=t,shouldUnregister:a,defaultValue:o,exact:s=!0}=e,c=Ol(i._names.array,n),l=$l({control:i,name:n,defaultValue:V.useMemo(()=>{let e=J(i._formValues,n,J(i._defaultValues,n,o));return q(e)?Dl(i,n):e},[i,n,o]),exact:s}),u=Xl({control:i,name:n,exact:s}),d=V.useRef(e),f=V.useRef(null),p=V.useRef(i.register(n,{...e.rules,value:l,...zl(e.disabled)?{disabled:e.disabled}:{}}));d.current=e;let m=V.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!J(u.errors,n)},isDirty:{enumerable:!0,get:()=>!!J(u.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!J(u.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!J(u.validatingFields,n)},error:{enumerable:!0,get:()=>J(u.errors,n)}}),[u,n]),h=V.useCallback(e=>{let t=wl(e);return J(i._fields,n)||(p.current=i.register(n,{...d.current.rules,value:t})),p.current.onChange({target:{value:wl(e),name:n},type:Al.CHANGE})},[n,i]),g=V.useCallback(()=>p.current.onBlur({target:{value:J(i._formValues,n),name:n},type:Al.BLUR}),[n,i._formValues]),_=V.useCallback(e=>{e&&(f.current={focus:()=>Bl(e.focus)&&e.focus(),select:()=>Bl(e.select)&&e.select(),setCustomValidity:t=>Bl(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>Bl(e.reportValidity)&&e.reportValidity()});let t=J(i._fields,n);t&&t._f&&e&&(t._f.ref=f.current,t._f._c=!0)},[i._fields,n]),v=V.useMemo(()=>({name:n,value:l,...zl(r)||u.disabled?{disabled:u.disabled||r}:{},onChange:h,onBlur:g,ref:_}),[n,r,u.disabled,h,g,_,l]);return V.useEffect(()=>{let e=i._options.shouldUnregister||a;p.current=i.register(n,{...d.current.rules,...zl(d.current.disabled)?{disabled:d.current.disabled}:{}});let t=(e,t)=>{let n=J(i._fields,e);n&&n._f&&(n._f.mount=t,n._f._c=t)};if(t(n,!0),e){let e=K(J(a?i._defaultValues:i._options.values||i._defaultValues,n,J(i._options.defaultValues,n,d.current.defaultValue)));Y(i._defaultValues,n,e),q(J(i._formValues,n))&&Y(i._formValues,n,e)}if(!c&&i.register(n,{...d.current.rules,...zl(d.current.disabled)?{disabled:d.current.disabled}:{}}),f.current){let e=J(i._fields,n);e&&e._f&&(e._f.ref=f.current)}return()=>{(c?e&&!i._state.action:e)?i.unregister(n):t(n,!1)}},[n,i,c,a]),V.useEffect(()=>{i._setDisabledField({disabled:r,name:n})},[r,n,i]),V.useMemo(()=>({field:v,formState:u,fieldState:m}),[v,u,m])}var tu=e=>e.render(eu(e)),nu=e=>({isOnSubmit:!e||e===jl.onSubmit,isOnBlur:e===jl.onBlur,isOnChange:e===jl.onChange,isOnAll:e===jl.all,isOnTouch:e===jl.onTouched}),ru=(e,t,n)=>{if(n)return!1;if(t.watchAll||t.watch.has(e))return!0;for(let n of t.watch)if(e.startsWith(n)&&e.charAt(n.length)===`.`)return!0;return!1},iu=(e,t,n)=>{for(let r of n||Object.keys(e)){if(r===`_f`)continue;let i=n?J(e,r):e[r];if(i){let{_f:e}=i;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],e.name)||e.ref&&t(e.ref,e.name)||iu(i,t))return!0}else if((G(i)||Array.isArray(i))&&iu(i,t))return!0}}},au=(e,t,n)=>{let r=J(e,n),i=Array.isArray(r)?r:[];return Y(i,Fl,t[n]),Y(e,n,i),e},X=e=>G(e)&&!Object.keys(e).length,ou=e=>{if(!kl)return!1;let t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},su=e=>e.type===`radio`,cu=e=>e instanceof RegExp,lu=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},uu={value:!1,isValid:!1},du={value:!0,isValid:!0},fu=e=>{if(!Array.isArray(e))return uu;if(e.length>1){let t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}let t=e[0];return!t||!t.checked||t.disabled?uu:!t.attributes||!(`value`in t.attributes)||q(t.value)||t.value===``?du:{value:t.value,isValid:!0}},pu={isValid:!1,value:null},mu=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,pu):pu;function hu(e,t,n=`validate`){if(Zl(e)||Array.isArray(e)&&e.every(Zl)||zl(e)&&!e)return{type:n,message:Zl(e)?e:``,ref:t}}var gu=e=>G(e)&&!cu(e)?e:{value:e,message:``},_u=async(e,t,n,r,i,a)=>{let{ref:o,refs:s,required:c,maxLength:l,minLength:u,min:d,max:f,pattern:p,validate:m,name:h,valueAsNumber:g,mount:_,_c:v}=e._f,y=J(n,h);if(!_||t.has(h))return{};let b=s?s[0]:o,x=e=>{if(i&&b.reportValidity){let t=zl(e)?``:e||``;s?s.forEach(e=>Bl(e.setCustomValidity)&&e.setCustomValidity(t)):b.setCustomValidity(t),b.reportValidity()}},S={},C=su(o),w=yl(o),T=C||w,E=(g||bl(o))&&q(o.value)&&q(y)||ou(o)&&o.value===``&&!v||y===``||Array.isArray(y)&&!y.length,D=lu.bind(null,h,r,S),ee=(e,t,n,r=Ml.maxLength,i=Ml.minLength)=>{let a=e?t:n;S[h]={type:e?r:i,message:a,ref:o,...D(e?r:i,a)}};if(a?!Array.isArray(y)||!y.length:c&&(!T&&(E||Sl(y))||zl(y)&&!y||w&&!fu(s).isValid||C&&!mu(s).isValid)){let{value:e,message:t}=Zl(c)?{value:!!c,message:c}:gu(c);if(e&&(S[h]={type:Ml.required,message:t,ref:b,...D(Ml.required,t)},!r))return x(t),S}if(!E&&(!Sl(d)||!Sl(f))){let e,t,n=gu(f),i=gu(d);if(!Sl(y)&&!xl(y)&&!isNaN(y)){let r=o.valueAsNumber||y&&+y;Sl(n.value)||(e=r>n.value),Sl(i.value)||(t=r<i.value)}else{let r=o.valueAsDate||new Date(y),a=e=>new Date(new Date().toDateString()+` `+e),s=o.type==`time`,c=o.type==`week`;Zl(n.value)&&y&&(e=s?a(y)>a(n.value):c?y>n.value:r>new Date(n.value)),Zl(i.value)&&y&&(t=s?a(y)<a(i.value):c?y<i.value:r<new Date(i.value))}if((e||t)&&(ee(!!e,n.message,i.message,Ml.max,Ml.min),!r))return x(S[h].message),S}if((l||u)&&!E&&(Zl(y)||a&&Array.isArray(y))){let e=gu(l),t=gu(u),n=!Sl(e.value)&&y.length>+e.value,i=!Sl(t.value)&&y.length<+t.value;if((n||i)&&(ee(n,e.message,t.message),!r))return x(S[h].message),S}if(p&&!E&&Zl(y)){let{value:e,message:t}=gu(p);if(cu(e)&&!y.match(e)&&(S[h]={type:Ml.pattern,message:t,ref:o,...D(Ml.pattern,t)},!r))return x(t),S}if(m){if(Bl(m)){let e=hu(await m(y,n),b);if(e&&(S[h]={...e,...D(Ml.validate,e.message)},!r))return x(e.message),S}else if(G(m)){let e={};for(let t in m){if(!X(e)&&!r)break;let i=hu(await m[t](y,n),b,t);i&&(e={...i,...D(t,i.message)},r||x(i.message),r&&(S[h]=e))}if(!X(e)&&(S[h]={ref:b,...e},!r))return S}}let O=S[h];return x(!O||O.message),S},vu=e=>Array.isArray(e)?e:[e],yu=e=>Array.isArray(e)?e.filter(Boolean):[];function bu(e,t){let n=t.length-1,r=0;for(;r<n;){if(Sl(e)){e=void 0;break}e=e[t[r]],r++}return e}function xu(e){for(let t in e)if(e.hasOwnProperty(t)&&!q(e[t]))return!1;return!0}function Z(e,t){if(Zl(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;let n=Array.isArray(t)?t:Rl(t)?[t]:El(t);if(n.some(e=>Il.includes(String(e))))return e;let r=n.length===1?e:bu(e,n),i=n.length-1,a=n[i];return r&&delete r[a],i!==0&&(G(r)&&X(r)||Array.isArray(r)&&xu(r))&&Z(e,n.slice(0,-1)),e}var Su=V.createContext(null);Su.displayName=`HookFormContext`;var Cu=()=>V.useContext(Su),wu=({children:e,watch:t,getValues:n,getErrors:r,getFieldState:i,setError:a,clearErrors:o,setValue:s,setValues:c,trigger:l,formState:u,resetField:d,reset:f,resetDefaultValues:p,handleSubmit:m,unregister:h,control:g,register:_,setFocus:v,subscribe:y})=>{let b=V.useMemo(()=>({watch:t,getValues:n,getErrors:r,getFieldState:i,setError:a,clearErrors:o,setValue:s,setValues:c,trigger:l,formState:u,resetField:d,reset:f,resetDefaultValues:p,handleSubmit:m,unregister:h,control:g,register:_,setFocus:v,subscribe:y}),[o,g,u,r,i,n,m,_,f,p,d,a,v,s,c,y,l,h,t]);return V.createElement(Su.Provider,{value:b},V.createElement(Vl.Provider,{value:b.control},e))},Tu=()=>{let e=[];return{get observers(){return e},next:t=>{for(let n of e)n.next&&n.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}};function Eu(e,t){let n=Array.isArray(e)?[]:{};for(let r in e)if(e.hasOwnProperty(r)){let i=e[r],a=t[r];i&&(G(i)||Array.isArray(i))&&a?n[r]=Eu(i,a):e[r]&&(n[r]=a)}return n}var Du=(e,t)=>e!==null&&Cl(e)&&Object.prototype.hasOwnProperty.call(e,t),Ou=(e,t)=>{if(!t)return!1;let n=e;for(let r of Rl(t)?[t]:El(t)){if(!Du(n,r))return Du(e,t);n=n[r]}return!0},ku=e=>e.type===`select-multiple`,Au=e=>su(e)||yl(e),ju=e=>ou(e)&&e.isConnected;function Mu(e){return Array.isArray(e)||G(e)}function Nu(e,t,n=``,r=[]){for(let i in e){let a=n?`${n}.${i}`:i,o=e[i];Mu(o)&&Mu(J(t,a))?Nu(o,t,a,r):r.push(a)}return r}var Pu=e=>{for(let t in e)if(Bl(e[t]))return!0;return!1};function Fu(e){return Array.isArray(e)||G(e)&&!Pu(e)}function Iu(e){return!!(e&&`_f`in e)}function Lu(e){return Array.isArray(e)?!e.some(e=>!q(e)):!Object.keys(e).length}function Ru(e,t){Array.isArray(e)?e[t]=void 0:delete e[t]}function zu(e,t={},n){for(let r in e){let i=e[r],a=n&&n[r];Fu(i)&&(!Array.isArray(i)||!Iu(a))?(t[r]=Array.isArray(i)?[]:{},zu(i,t[r],a),Lu(t[r])&&Ru(t,r)):q(i)||(t[r]=!0)}return t}function Bu(e,t,n,r){n||=zu(t,{},r);for(let i in e){let a=e[i],o=r&&r[i];Fu(a)&&(!Array.isArray(a)||!Iu(o))?(q(t)||Kl(n[i])?n[i]=zu(a,Array.isArray(a)?[]:{},o):Bu(a,Sl(t)?{}:t[i],n[i],o),Lu(n[i])&&Ru(n,i)):Jl(a,t[i])?Ru(n,i):n[i]=!0}return n}var Vu=(e,t)=>{let n=t.split(`.`),r=[],i=n[0];for(let t=1;t<n.length;i+=`.`+n[t++])!isNaN(+n[t])&&e.has(i)&&r.push(`${i}.${n[t]}`);return r},Hu=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>q(e)?e:t?e===``?NaN:e&&+e:n&&Zl(e)?new Date(e):r?r(e):e;function Uu(e){let t=e.ref;return bl(t)?t.files:su(t)?mu(e.refs).value:ku(t)?[...t.selectedOptions].map(({value:e})=>e):yl(t)?fu(e.refs).value:Hu(t.value,e)}var Wu=(e,t,n,r)=>{let i={};for(let n of e){let e=J(t,n);e&&Y(i,n,e._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}},Gu=e=>q(e)?e:cu(e)?e.source:G(e)?cu(e.value)?e.value.source:e.value:e,Ku=`AsyncFunction`,qu=e=>{if(!e||!e.validate)return!1;if(Bl(e.validate))return e.validate.constructor.name===Ku;if(G(e.validate)){for(let t in e.validate)if(e.validate[t].constructor.name===Ku)return!0}return!1},Ju=e=>e.mount&&(e.required||!q(e.required)&&e.required!==!1||!q(e.min)||!q(e.max)||!q(e.maxLength)||!q(e.minLength)||e.pattern||e.validate);function Yu(e,t,n){let r=J(e,n);if(r?.type||r?.message||Array.isArray(r))return{error:r,name:n};let i=n.split(`.`);for(;i.length;){let r=i.join(`.`),a=J(t,r),o=J(e,r);if(a&&!Array.isArray(a)&&n!==r)return{name:n};if(o&&o.type)return{name:r,error:o};if(o&&o.root&&o.root.type)return{name:`${r}.root`,error:o.root};i.pop()}return{name:n}}var Xu=(e,t,n,r)=>{n(e);let i=Object.keys(e).filter(e=>e!==`name`);return!i.length||r&&i.length>=Object.keys(t).length||i.find(e=>t[e]===(!r||jl.all))},Zu=(e,t,n)=>!e||!t||e===t||vu(e).some(e=>e&&(n?e===t||e.startsWith(t+`.`):e.startsWith(t)||t.startsWith(e))),Qu=(e,t,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:!(n?r.isOnChange:i.isOnChange)||e,$u=(e,t)=>{let n=J(e,t);!yu(n).length&&!(n!=null&&n.root)&&Z(e,t)},ed={mode:jl.onSubmit,reValidateMode:jl.onChange,shouldFocusError:!0},td=(e,t)=>{for(let n in e)n in t||delete e[n];Object.assign(e,t)},nd={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function rd(e={}){let t={...ed,...e},n={...K(nd),isLoading:Bl(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},r={},i=(G(t.defaultValues)||G(t.values))&&K(t.defaultValues||t.values)||{},a=t.shouldUnregister?{}:K(i),o={action:!1,actionArrayLengths:new Map,mount:!1,watch:!1,keepIsValid:!1},s={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set},c={},l={},u=0,d=nu(t.mode),f=nu(t.reValidateMode),p={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},m={...p},h={...m},g=(...e)=>e.some(e=>m[e]||h[e]),_={array:Tu(),state:Tu()},v=0,y=0,b=t.criteriaMode===jl.all,x=(e,t)=>n=>{clearTimeout(l[e]),l[e]=setTimeout(t,n)},S=e=>{clearTimeout(l[e]),delete l[e],delete c[e]},C=e=>{S(e);let t=`${e}.`;for(let e of Object.keys(c))e.startsWith(t)&&S(e)},w=async e=>{if(!o.keepIsValid&&!t.disabled&&(g(`isValid`)||e)){let e=++v,i;t.resolver?(i=X((await ae()).errors),e===v&&T()):i=await ce({fields:r,onlyCheckValid:!0,eventType:Al.VALID}),e===v&&i!==n.isValid&&_.state.next({isValid:i})}},T=(e,r)=>{!t.disabled&&g(`isValidating`,`validatingFields`)&&((e||s.mount).forEach(e=>{e&&(r?Y(n.validatingFields,e,r):Z(n.validatingFields,e))}),_.state.next({validatingFields:n.validatingFields,isValidating:!X(n.validatingFields)}))},E=()=>{n.dirtyFields=Bu(i,a,void 0,r)},D=(e,i=[],s,c,l=!0,u=!0)=>{if(c&&s&&!t.disabled){o.action=!0;let t=J(r,e);if(o.actionArrayLengths.has(e)||o.actionArrayLengths.set(e,Array.isArray(t)?t.length:0),u&&Array.isArray(t)){let n=s(t,c.argA,c.argB);l&&Y(r,e,n)}let a=J(n.errors,e);if(u&&Array.isArray(a)){let t=a.root,r=s(a,c.argA,c.argB)||a;t&&(r.root=t),l&&Y(n.errors,e,r),$u(n.errors,e)}let d=J(n.touchedFields,e),f=u&&Array.isArray(d);if(f){let t=s(d,c.argA,c.argB);l&&Y(n.touchedFields,e,t)}let p=J(n.dirtyFields,e);if(u&&Array.isArray(p)){let t=s(p,c.argA,c.argB)||p;l&&Y(n.dirtyFields,e,t)}g(`dirtyFields`)&&E(),_.state.next({name:e,isDirty:ue(e,i),dirtyFields:n.dirtyFields,...f&&{touchedFields:n.touchedFields},errors:n.errors,isValid:n.isValid})}else Y(a,e,i)},ee=(e,t)=>{Y(n.errors,e,t),n.errors={...n.errors},_.state.next({errors:n.errors})},O=e=>{Object.keys(c).forEach(S);let t=!X(e);n.errors=e,_.state.next({errors:n.errors,...t?{isValid:!1}:{}}),!t&&o.mount&&w()},te=e=>{let t=Rl(e)?[e]:El(e),n=a,r=i;for(let e=0;e<t.length-1;e++){let i=t[e];if(n=Sl(n)?n:n[i],r=Sl(r)?r:r[i],n===null&&r!==null)return!0}return!1},ne=e=>{if(!o.actionArrayLengths.size)return!1;let t=Rl(e)?[e]:El(e),n=a,r=``,i=-1,s=0;for(let e=0;e<t.length;e++){if(Sl(n))return!1;let a=t[e];if(r=r?`${r}.${a}`:a,Array.isArray(n)&&+a>=n.length)return i===-1?!1:e!==i||+a<s;if(o.actionArrayLengths.has(r)&&(i=e+1,s=o.actionArrayLengths.get(r)),n=n[a],q(n)&&i!==-1&&e>i&&+t[i]<s)return!0}return!1},re=(c,l,u,d)=>{let f=J(r,c);if(f){if(te(c)||ne(c))return;let r=q(J(a,c)),p=J(a,c,q(u)?J(i,c):u);q(p)||d&&d.defaultChecked||l?Y(a,c,l?p:Uu(f._f)):fe(c,p),o.mount&&!o.action&&(t.resolver&&g(`isValidating`,`validatingFields`)?Promise.resolve().then(()=>w()):w(),r&&n.isDirty&&g(`isDirty`)&&(ue()||(n.isDirty=!1,_.state.next({...n}))),e.shouldUnregister&&r&&!q(J(a,c))&&ru(c,s)&&(o.watch=!0))}},k=(e,o,s,c,l)=>{let u=!1,d=!1,f={name:e};if(!t.disabled||c===!0){if(!s||c){let t=Jl(J(i,e),o);g(`isDirty`)&&(d=n.isDirty,n.isDirty=f.isDirty=!t||ue(),u=d!==f.isDirty),d=!!J(n.dirtyFields,e),t===n.isDirty?t?Z(n.dirtyFields,e):Y(n.dirtyFields,e,!0):td(n.dirtyFields,Bu(i,a,void 0,r)),f.dirtyFields=n.dirtyFields,u||=g(`dirtyFields`)&&d!==!t}if(s){let t=J(n.touchedFields,e);t||(Y(n.touchedFields,e,s),f.touchedFields=n.touchedFields,u||=g(`touchedFields`)&&t!==s)}u&&l&&_.state.next(f)}return u?f:{}},ie=(e,r,i,a)=>{let o=J(n.errors,e),s=g(`isValid`)&&zl(r)&&n.isValid!==r;if(t.delayError&&i?(c[e]=x(e,()=>ee(e,i)),c[e](t.delayError)):(S(e),i?Y(n.errors,e,i):Z(n.errors,e),n.errors={...n.errors}),(i?!Jl(o,i):o)||!X(a)||s){let t={...a,...s&&zl(r)?{isValid:r}:{},errors:n.errors,name:e};_.state.next(t)}},ae=async e=>(T(e,!0),await t.resolver(a,t.context,Wu(e||s.mount,r,t.criteriaMode,t.shouldUseNativeValidation))),oe=async e=>{let t=y,{errors:i}=await ae(e);if(t!==y)return i;if(T(e),e){for(let t of e){let e=J(i,t);C(t);let a=s.array.has(t)&&G(e)&&!Object.keys(e).some(e=>!Number.isNaN(Number(e))),o=J(r,t),c=G(o)&&Object.keys(o).some(e=>e!==`_f`);a?au(n.errors,{[t]:e},t):e?.type||e?.message||Array.isArray(e)||G(e)&&c?Y(n.errors,t,e):Z(n.errors,t)}n.errors={...n.errors}}else Object.keys(c).forEach(S),n.errors=i;return i},se=async({name:e,eventType:r})=>{if(t.validate){let i=y,o=await t.validate({formValues:a,formState:n,name:e,eventType:r});if(i!==y)return!0;if(G(o)){let e=!0;Ce(Pl);for(let t in o){let n=o[t];n&&(e=!1,we(`${Pl}.${t}`,{message:Zl(n.message)?n.message:``,type:n.type||Ml.validate}))}return e}return Zl(o)||!o?(we(Pl,{message:o||``,type:Ml.validate}),!1):(Ce(Pl),!0)}return!0},ce=async({fields:r,onlyCheckValid:i,name:o,eventType:c,context:l={valid:!0,runRootValidation:!1}})=>{let u=y;if(t.validate&&!l.runRootValidation&&(l.runRootValidation=!0,!await se({name:o,eventType:c})&&(l.valid=!1,i)))return l.valid;for(let o in r){let d=r[o];if(d){let{_f:r,...f}=d;if(r){let o=s.array.has(r.name),c=d._f&&qu(d._f),f=g(`isValidating`,`validatingFields`);c&&f&&T([r.name],!0);let p=await _u(d,s.disabled,a,b,t.shouldUseNativeValidation&&!i,o);if(u!==y)return l.valid;if(c&&f&&T([r.name]),p[r.name]&&(l.valid=!1,i)||(i||(S(r.name),J(p,r.name)?o?au(n.errors,p,r.name):Y(n.errors,r.name,p[r.name]):Z(n.errors,r.name)),e.shouldUseNativeValidation&&p[r.name]))break}!X(f)&&await ce({context:l,onlyCheckValid:i,fields:f,name:o,eventType:c})}}return l.valid},le=()=>{for(let e of s.unMount){let t=J(r,e);t&&(t._f.refs?t._f.refs.every(e=>!ju(e)):!ju(t._f.ref))&&j(e)}s.unMount=new Set},ue=(e,t)=>(e&&t&&Y(a,e,t),!Jl(o.mount?a:i,i)),A=(e,t,n)=>Ql(e,s,{...o.mount?a:q(t)||Zl(e)?i:t},n,t),de=e=>yu(J(o.mount?a:i,e,t.shouldUnregister?J(i,e,[]):[])),fe=(e,t,n={},i=!1,o=!1,s=!1)=>{let c=J(r,e),l=t;if(c){let n=c._f;n&&(!n.disabled&&Y(a,e,Hu(t,n)),l=ou(n.ref)&&Sl(t)?``:t,ku(n.ref)?[...n.ref.options].forEach(e=>e.selected=l.includes(e.value)):n.refs?yl(n.ref)?n.refs.forEach(e=>{(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(l)?!!l.find(t=>t===e.value):l===e.value||!!l)}):n.refs.forEach(e=>e.checked=e.value===l):bl(n.ref)?n.ref.value=``:(n.ref.value=l,!n.ref.type&&!o&&!s&&_.state.next({name:e,values:i?a:K(a)})))}(n.shouldDirty||n.shouldTouch)&&k(e,c&&c._f&&!c._f.disabled&&(c._f.valueAsNumber||c._f.valueAsDate||c._f.setValueAs)?Hu(t,c._f):l,n.shouldTouch,n.shouldDirty,!o),n.shouldValidate&&ye(e,{delayError:n.delayError}),n.shouldValidate&&c&&c._f&&c._f.deps&&(!Array.isArray(c._f.deps)||c._f.deps.length>0)&&ye(c._f.deps)},pe=(e,t,n,i=!1,o=!1,c=!1)=>{s.array.has(e)&&_.array.next({name:e,values:i?a:K(a)});for(let a in t){if(!t.hasOwnProperty(a))continue;let l=t[a],u=e+`.`+a,d=J(r,u);(s.array.has(e)||G(l)||d&&!d._f)&&!xl(l)?pe(u,l,n,i,o,c):fe(u,l,n,i,o,c)}},me=(e,t,i,c,l=!1)=>{let u=J(r,e),d=s.array.has(e),f=c?t:K(t),p=Jl(J(a,e),f);if(p||Y(a,e,f),d)_.array.next({name:e,values:c?a:K(a)}),g(`isDirty`,`dirtyFields`)&&i.shouldDirty&&(E(),l||_.state.next({name:e,dirtyFields:n.dirtyFields,isDirty:ue(e,f)})),i.shouldValidate&&ye(e,{delayError:i.delayError});else{let t=Array.isArray(f)&&!f.length||X(f),n=!p&&!l;!u||u._f||Sl(f)||t?fe(e,f,i,c,l,n):pe(e,f,i,c,l,n)}if(!p&&!l){let t=ru(e,s),r=c?a:K(a);if(_.state.next({...t&&n,name:o.mount||t?e:void 0,values:r}),!d)for(let t of Vu(s.array,e))_.state.next({name:t,values:r})}},he=(e,t,n={})=>me(e,t,n,!1),ge=(e,t={})=>{let r=Bl(e)?e(a):e;if(!Jl(a,r)){a={...a,...r};for(let e of s.mount)Ou(r,e)&&me(e,J(r,e),t,!0,!0);_.state.next({...n,name:void 0,type:void 0,...u?{values:a}:{}}),t.shouldValidate&&w()}},_e=async e=>{o.mount=!0;let i=e.target,l=i.name,p=!0,m=J(r,l),h=e=>{p=Number.isNaN(e)||xl(e)&&isNaN(e.getTime())||Jl(e,J(a,l,e))};if(m){let o,v,x=i.type?Uu(m._f):wl(e),S=e.type===Al.BLUR||e.type===Al.FOCUS_OUT,C=!Ju(m._f)&&!t.validate&&!t.resolver&&!J(n.errors,l)&&!m._f.deps,E=C||Qu(S,J(n.touchedFields,l),n.isSubmitted,f,d),D=ru(l,s,S);if(Y(a,l,K(x)),S){if(!i||!i.readOnly){m._f.onBlur&&m._f.onBlur(e);let t=c[l];t&&t(0)}}else m._f.onChange&&m._f.onChange(e);let ee=k(l,x,S),O=!X(ee)||D;if(!S&&_.state.next({name:l,type:e.type,...u?{values:K(a)}:{}}),E)return(!C||!n.isValid)&&g(`isValid`)&&(t.mode===`onBlur`?S&&w():S||w()),O&&_.state.next({name:l,...D?{}:ee});if(!t.resolver&&t.validate&&await se({name:l,eventType:e.type}),!S&&D&&_.state.next({...n}),t.resolver){let e=y,{errors:t}=await ae([l]);if(e!==y)return;if(T([l]),h(x),!p){!X(ee)&&_.state.next(ee);return}let i=Yu(n.errors,r,l),a=Yu(t,r,i.name||l);o=a.error,l=a.name,v=X(t)}else{let n=y;if(T([l],!0),o=(await _u(m,s.disabled,a,b,t.shouldUseNativeValidation))[l],n!==y)return;if(T([l]),h(x),p){if(o)v=!1;else if(g(`isValid`)&&(v=await ce({fields:r,onlyCheckValid:!0,name:l,eventType:e.type}),n!==y))return}}p&&(m._f.deps&&(!Array.isArray(m._f.deps)||m._f.deps.length>0)&&ye(m._f.deps),ie(l,v,o,ee))}},ve=(e,t)=>{if(J(n.errors,t)&&e.focus)return e.focus(),1},ye=async(e,i={})=>{let a,o,l=vu(e);if(t.resolver){let t=y,n=await oe(q(e)?e:l);if(a=X(n),o=e?!l.some(e=>J(n,e)):a,t!==y)return o}else e?(o=(await Promise.all(l.map(async e=>{let t=J(r,e);return await ce({fields:t&&t._f?{[e]:t}:t,eventType:Al.TRIGGER})}))).every(Boolean),(o||n.isValid)&&w()):o=a=await ce({fields:r,name:e,eventType:Al.TRIGGER});if(i.delayError&&t.delayError&&Zl(e)){let r=J(n.errors,e);r?(Z(n.errors,e),c[e]=x(e,()=>ee(e,r)),c[e](t.delayError)):S(e)}if(i.shouldTouch)for(let t of e?l:s.mount)!s.array.has(t)&&Y(n.touchedFields,t,!0);return _.state.next({...!Zl(e)||g(`isValid`)&&a!==n.isValid?{}:{name:e},...t.resolver||!e?{isValid:a}:{},...i.shouldTouch&&g(`touchedFields`)?{touchedFields:n.touchedFields}:{},errors:n.errors}),i.shouldFocus&&!o&&iu(r,ve,e?l:s.mount),o},be=(e,t)=>{let r={...o.mount?a:i};return t&&(r=Eu(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),q(e)?r:Zl(e)?J(r,e):e.map(e=>J(r,e))},xe=e=>q(e)?{...n.errors}:Zl(e)?J(n.errors,e):e.map(e=>J(n.errors,e)),Se=(e,t)=>{let r=t||n,i=J(r.errors,e);return{invalid:!!i,isDirty:!!J(r.dirtyFields,e),error:i,isValidating:!!J(r.validatingFields,e),isTouched:!!J(r.touchedFields,e)}},Ce=e=>{let t=e?vu(e):void 0;t?t.forEach(e=>{C(e),Z(n.errors,e),_.state.next({name:e,errors:n.errors})}):(Object.keys(c).forEach(S),n.errors={},_.state.next({errors:n.errors}))},we=(e,t,i)=>{C(e);let a=(J(r,e,{_f:{}})._f||{}).ref,{ref:o,message:s,type:c,types:l,...u}=J(n.errors,e)||{};Y(n.errors,e,{...u,...t,ref:a}),_.state.next({name:e,errors:n.errors,isValid:!1}),i&&i.shouldFocus&&a&&a.focus&&a.focus()},Te=(e,t)=>{if(Bl(e)){u++;let{unsubscribe:n}=_.state.subscribe({next:n=>`values`in n&&e(n.values||A(void 0,t),n)}),r=!1;return{unsubscribe:()=>{r||(r=!0,u--,n())}}}return A(e,t,!0)},Ee=e=>{let t=!!e.formState?.values;t&&u++;let{unsubscribe:r}=_.state.subscribe({next:t=>{if(Zu(e.name,t.name,e.exact)&&Xu(t,e.formState||m,F,e.reRenderRoot)){let r={...a};e.callback({values:r,...n,...t,defaultValues:i})}}});if(!t)return r;let o=!1;return()=>{o||(o=!0,u--,r())}},De=e=>(o.mount=!0,h={...h,...e.formState},Ee({...e,formState:{...p,...e.formState}})),j=(e,o={})=>{for(let c of e?vu(e):s.mount)s.mount.delete(c),s.array.delete(c),s.disabled.delete(c),o.keepValue||(Z(r,c),Z(a,c)),o.keepError||(C(c),Z(n.errors,c)),!o.keepDirty&&Z(n.dirtyFields,c),!o.keepTouched&&Z(n.touchedFields,c),!o.keepIsValidating&&Z(n.validatingFields,c),!t.shouldUnregister&&!o.keepDefaultValue&&Z(i,c);u&&_.state.next({values:K(a)}),_.state.next({...n,...o.keepDirty?{}:{isDirty:ue()},...o.keepIsValidating?{}:{isValidating:!X(n.validatingFields)}}),!o.keepIsValid&&w()},Oe=({disabled:e,name:t})=>{if(zl(e)&&o.mount||e||s.disabled.has(t)){let n=s.disabled.has(t)!==!!e;e?s.disabled.add(t):s.disabled.delete(t),n&&o.mount&&!o.action&&w()}},M=(e,n={})=>{let a=J(r,e),c=zl(n.disabled)||zl(t.disabled),l=!s.registerName.has(e)&&a&&a._f&&!a._f.mount;if(Y(r,e,{...a||{},_f:{...a&&a._f?a._f:{ref:{name:e}},name:e,mount:!0,...n}}),s.mount.add(e),a&&a._f){let t=J(r,e);for(let e of Nl)e in n||delete t._f[e]}return a&&!l?Oe({disabled:zl(n.disabled)?n.disabled:t.disabled,name:e}):re(e,!0,n.value),{...c?{disabled:n.disabled||t.disabled}:{},...t.progressive?{required:!!n.required,min:Gu(n.min),max:Gu(n.max),minLength:Gu(n.minLength),maxLength:Gu(n.maxLength),pattern:Gu(n.pattern)}:{},name:e,onChange:_e,onBlur:_e,ref:c=>{if(c){s.registerName.add(e),M(e,n),s.registerName.delete(e),a=J(r,e);let t=q(c.value)&&c.querySelectorAll&&c.querySelectorAll(`input,select,textarea`)[0]||c,o=Au(t),l=a._f.refs||[];if(o?l.find(e=>e===t):t===a._f.ref)return;let u={...a._f};o?(u.refs=[...l.filter(ju),t,...Array.isArray(J(i,e))?[{}]:[]],u.ref={type:t.type,name:e}):(u.ref=t,delete u.refs),Y(r,e,{_f:u}),re(e,!1,void 0,t)}else a=J(r,e,{}),a._f&&(a._f.mount=!1),(t.shouldUnregister||n.shouldUnregister)&&!(Ol(s.array,e)&&o.action)&&s.unMount.add(e)}}},ke=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&iu(r,ve,s.mount),Ae=e=>{zl(e)&&(_.state.next({disabled:e}),iu(r,(t,n)=>{let i=J(r,n);i&&(t.disabled=i._f.disabled||e,Array.isArray(i._f.refs)&&i._f.refs.forEach(t=>{t.disabled=i._f.disabled||e}))},0))},je=(e,i)=>async o=>{let l,u;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let d=K(a);if(_.state.next({isSubmitting:!0}),t.resolver){let e=y,{errors:t,values:r}=await ae();if(e!==y)return;T(),Object.keys(c).forEach(S),n.errors=t,d=K(r)}else{let e=y;if(await ce({fields:r,eventType:Al.SUBMIT}),e!==y)return;Z(n.errors,Fl)}if(s.disabled.size)for(let e of s.disabled)Z(d,e);if(X(n.errors)){_.state.next({errors:{}});try{l=await e(d,o)}catch(e){u=e}}else i&&await i({...n.errors},o),ke(),setTimeout(ke);if(_.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:X(n.errors)&&!u,submitCount:n.submitCount+1,errors:n.errors}),u)throw u;return l},N=(e,t={})=>{J(r,e)&&(Z(n.validatingFields,e),q(t.defaultValue)?he(e,K(J(i,e))):(he(e,t.defaultValue),Y(i,e,K(t.defaultValue))),t.keepTouched||Z(n.touchedFields,e),t.keepDirty||(Z(n.dirtyFields,e),n.isDirty=t.defaultValue?ue(e,K(J(i,e))):ue()),t.keepError||(C(e),Z(n.errors,e),w()),_.state.next({...n,isValidating:!X(n.validatingFields)}))},Me=(e,l={})=>{y++;let u=e?K(e):i,d=K(u),f=X(e),p=d,h=r;if(Object.keys(c).forEach(S),l.keepDefaultValues||(i=u),!l.keepValues){if(l.keepDirtyValues){let e=new Set([...s.mount,...Nu(Bu(i,a,void 0,h),n.dirtyFields)]);for(let t of e){let e=J(n.dirtyFields,t),r=J(a,t),i=J(p,t);e&&!q(r)?Y(p,t,r):!e&&!q(i)&&he(t,i)}}else{if(kl&&q(e))for(let e of s.mount){let t=J(r,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(ou(e)){let t=e.closest(`form`);if(t){t.reset();break}}}}if(l.keepFieldsRef)for(let e of s.mount)he(e,J(p,e));else r={}}if(t.shouldUnregister){if(a=l.keepDefaultValues?K(i):{},l.keepFieldsRef)for(let e of s.mount)Y(a,e,J(p,e))}else a=K(p);_.array.next({values:{...p}}),_.state.next({name:void 0,type:void 0,values:{...p}})}s={mount:l.keepDirtyValues?s.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:``},o.mount=!m.isValid||!!l.keepIsValid||!!l.keepDirtyValues||!t.shouldUnregister&&!X(p),o.watch=!!t.shouldUnregister,o.keepIsValid=!!l.keepIsValid,o.action=!1,o.actionArrayLengths.clear(),l.keepErrors||(n.errors={}),_.state.next({submitCount:l.keepSubmitCount?n.submitCount:0,isDirty:f?!1:l.keepDirty?n.isDirty:l.keepValues?ue():!(!l.keepDefaultValues||Jl(e,i)),isSubmitted:l.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:f?{}:l.keepDirtyValues?l.keepDefaultValues&&a?Bu(i,a,void 0,h):n.dirtyFields:l.keepDefaultValues&&e?Bu(i,e,void 0,h):l.keepDirty?n.dirtyFields:l.keepValues?Bu(i,a,void 0,h):{},touchedFields:l.keepTouched?n.touchedFields:{},...!l.keepIsValidating&&(n.isValidating||!X(n.validatingFields))?{validatingFields:{},isValidating:!1}:null,errors:l.keepErrors?n.errors:{},isSubmitSuccessful:l.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:i})},Ne=(e,n)=>Me(Bl(e)?e(a):e,{...t.resetOptions,...n}),P=(e,t={})=>{let n=J(r,e),i=n&&n._f;if(i){let e=i.refs?i.refs[0]:i.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&Bl(e.select)&&e.select()})}},F=e=>{let{name:t,type:r,values:i,...a}=e;n={...n,...a}};_.state.subscribe({next:F});let Pe={control:{register:M,unregister:j,getFieldState:Se,handleSubmit:je,setError:we,_subscribe:Ee,_runSchema:ae,_updateIsValidating:T,_focusError:ke,_getWatch:A,_getDirty:ue,_setValid:w,_setFieldArray:D,_setDisabledField:Oe,_setErrors:O,_getFieldArray:de,_reset:Me,_resetDefaultValues:()=>Bl(t.defaultValues)&&t.defaultValues().then(e=>{Ne(e,t.resetOptions),_.state.next({isLoading:!1})}),_removeUnmounted:le,_disableForm:Ae,_subjects:_,_proxyFormState:m,get _fields(){return r},get _formValues(){return a},get _state(){return o},set _state(e){o=e},get _defaultValues(){return i},get _names(){return s},set _names(e){s=e},get _formState(){return n},get _options(){return t},set _options(e){t={...t,...e},d=nu(t.mode),f=nu(t.reValidateMode),b=t.criteriaMode===jl.all}},subscribe:De,trigger:ye,register:M,handleSubmit:je,watch:Te,setValue:he,setValues:ge,getValues:be,getErrors:xe,reset:Ne,resetField:N,resetDefaultValues:(e,t={})=>{if(i=K(e),!t.keepDirty){let e=Bu(i,a,void 0,r);n.dirtyFields=e,n.isDirty=!X(e)}t.keepIsValid||w(),_.state.next({...n,defaultValues:i})},clearErrors:Ce,unregister:j,setError:we,setFocus:P,getFieldState:Se};return{...Pe,formControl:Pe}}function id(e={}){let t=V.useRef(void 0),n=V.useRef(void 0),r=V.useRef(e.formControl),i=V.useRef(!!e.validate),[a,o]=V.useState(()=>({...K(nd),isLoading:Bl(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:Bl(e.defaultValues)?void 0:e.defaultValues}));if(!t.current||e.formControl&&r.current!==e.formControl){if(r.current=e.formControl,e.formControl)t.current={...e.formControl,formState:a},e.defaultValues&&!Bl(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{let{formControl:n,...r}=rd(e);t.current={...r,formState:a}}}let s=t.current.control;s._options={...e,validate:e.validate};let c=()=>({...s._formState,defaultValues:s._defaultValues}),{resyncIfNeeded:l,snapshot:u}=Yl(c);return Wl(()=>{l(!0,c,o);let e=s._subscribe({formState:s._proxyFormState,callback:()=>o({...s._formState,defaultValues:s._defaultValues}),reRenderRoot:!0});return o(e=>({...e,isReady:!0})),s._formState.isReady=!0,()=>{e(),u(!0,c)}},[s,l,u]),V.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),V.useEffect(()=>{e.mode&&(s._options.mode=e.mode),e.reValidateMode&&(s._options.reValidateMode=e.reValidateMode)},[s,e.mode,e.reValidateMode]),V.useEffect(()=>{e.errors&&(s._setErrors(e.errors),s._focusError())},[s,e.errors]),V.useEffect(()=>{var n;i.current&&!e.validate&&((n=t.current)==null||n.clearErrors(Pl)),i.current=!!e.validate},[e.validate]),V.useEffect(()=>{e.shouldUnregister&&s._subjects.state.next({values:s._getWatch()})},[s,e.shouldUnregister]),V.useEffect(()=>{if(s._proxyFormState.isDirty){let e=s._getDirty();e!==a.isDirty&&s._subjects.state.next({isDirty:e})}},[s,a.isDirty]),V.useEffect(()=>{e.values&&!Jl(e.values,n.current)?(s._reset(e.values,{keepFieldsRef:!0,...s._options.resetOptions}),s._options.resetOptions?.keepIsValid||s._setValid(),n.current=e.values,o(e=>({...e}))):s._resetDefaultValues()},[s,e.values]),V.useEffect(()=>{s._state.mount||(s._setValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),t.current.formState=V.useMemo(()=>Ul(a,s),[s,a]),t.current}var ad=(e,t,n)=>{if(e&&`reportValidity`in e){let r=J(n,t);e.setCustomValidity(r&&r.message||``),e.reportValidity()}},od=(e,t)=>{for(let n in t.fields){let r=t.fields[n];r&&r.ref&&`reportValidity`in r.ref?ad(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>ad(t,n,e))}},sd=(e,t)=>{t.shouldUseNativeValidation&&od(e,t);let n={};for(let r in e){let i=J(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.refs?i.refs[0]:i&&i.ref});if(cd(t.names||Object.keys(e),r)){let e=Object.assign({},J(n,r));Y(e,`root`,a),Y(n,r,e)}else Y(n,r,a)}return n},cd=(e,t)=>{let n=ld(t).replace(/[.*+?^${}()|\\]/g,`\\$&`);return e.some(e=>ld(e).match(`^${n}\\.\\d+`))};function ld(e){return e.replace(/\[(\d+)]/g,`.$1`).replace(/[[\]]/g,``)}function ud(){return ud=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ud.apply(null,arguments)}function dd(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function fd(e,t){for(var n=Object.create(null);e.length;){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o]){if(`unionErrors`in r){var s=r.unionErrors.reduce(function(e,t){return t.errors.length<e.errors.length?t:e}).errors[0];n[o]={message:s?.message??a,type:s?.code??i}}else n[o]={message:a,type:i}}if(`unionErrors`in r&&r.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=lu(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n}function pd(e,t){for(var n=Object.create(null),r=function(){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o]){if(r.code===`invalid_union`&&r.errors.length>0){var s=r.errors.reduce(function(e,t){return t.length<e.length?t:e})[0];n[o]={message:s?.message??a,type:s?.code??i}}else n[o]={message:a,type:i}}if(r.code===`invalid_union`&&r.errors.forEach(function(t){return t.forEach(function(t){return e.push(ud({},t,{path:[].concat(r.path,t.path)}))})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=lu(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()};e.length;)r();return n}function md(e,t,n){if(n===void 0&&(n={}),function(e){return`_zod`in e&&typeof e._zod==`object`}(e))return function(r,i,a){try{return Promise.resolve(dd(function(){function i(e){return a.shouldUseNativeValidation&&od({},a),{errors:{},values:n.raw?Object.assign({},r):e}}var o=e;return n.mode===`sync`?i(o.parse(r,t)):Promise.resolve(o.parseAsync(r,t)).then(i)},function(e){if(function(e){var t;return!(e==null||(t=e._zod)==null||(t=t.traits)==null||!t.has(`$ZodError`))}(e))return{values:{},errors:sd(pd(e.issues,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};if(function(e){return`_def`in e&&typeof e._def==`object`}(e))return function(r,i,a){try{return Promise.resolve(dd(function(){return Promise.resolve(e[n.mode===`sync`?`parse`:`parseAsync`](r,t)).then(function(e){return a.shouldUseNativeValidation&&od({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return Array.isArray(e?.issues)}(e))return{values:{},errors:sd(fd(e.errors,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};throw Error(`Invalid input: not a Zod schema`)}function hd(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var gd=e=>{switch(e){case`success`:return yd;case`info`:return xd;case`warning`:return bd;case`error`:return Sd;default:return null}},_d=Array(12).fill(0),vd=({visible:e,className:t})=>V.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},V.createElement(`div`,{className:`sonner-spinner`},_d.map((e,t)=>V.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),yd=V.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},V.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),bd=V.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},V.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),xd=V.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},V.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),Sd=V.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`,"aria-hidden":`true`},V.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),Cd=V.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`},V.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),V.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),wd=()=>{let[e,t]=V.useState(document.hidden);return V.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]),e},Td=1,Ed=100,Dd=e=>typeof e?.id==`number`||e?.id?.length>0?e.id:Td++,Od=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),this.getActiveToasts().forEach(t=>e(t)),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e],this.trimHistory()},this.trimHistory=()=>{let e=this.toasts.length-Ed;e<=0||(this.toasts=this.toasts.filter(t=>e>0&&this.dismissedToasts.has(t.id)?(this.dismissedToasts.delete(t.id),e--,!1):!0))},this.create=e=>{let{message:t,...n}=e,r=Dd(e),i=this.pendingDismissals.get(r);i!==void 0&&(cancelAnimationFrame(i),this.pendingDismissals.delete(r),this.dismissedToasts.delete(r));let a=this.dismissedToasts.has(r),o=e.dismissible===void 0||e.dismissible;return a&&(this.dismissedToasts.delete(r),this.toasts=this.toasts.filter(e=>e.id!==r)),!a&&this.toasts.find(e=>e.id===r)?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:o,title:t}):n):this.addToast({title:t,...n,dismissible:o,id:r}),r},this.dismiss=e=>{if(e==null)return this.getActiveToasts().forEach(e=>{this.dismissedToasts.add(e.id),this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e;this.dismissedToasts.add(e);let t=this.pendingDismissals.get(e);return t!==void 0&&cancelAnimationFrame(t),this.pendingDismissals.set(e,requestAnimationFrame(()=>{this.pendingDismissals.delete(e),this.subscribers.forEach(t=>t({id:e,dismiss:!0}))})),e},this.message=(e,t)=>this.create({...t,message:e,type:void 0}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],V.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(Ad(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,o=typeof r==`object`&&!V.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!V.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!V.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:a,...o})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!V.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=Dd(t);return this.create({...t,jsx:e(n),id:n,type:void 0}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set,this.pendingDismissals=new Map}},kd=(e,t)=>Od.message(e,t),Ad=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,Q=Object.assign(kd,{success:Od.success,info:Od.info,warning:Od.warning,error:Od.error,custom:Od.custom,message:Od.message,promise:Od.promise,dismiss:Od.dismiss,loading:Od.loading},{getHistory:()=>Od.toasts,getToasts:()=>Od.getActiveToasts()});hd(`[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--normal-text);background:var(--normal-bg);border:1px solid var(--normal-border);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{-webkit-user-select:none;user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}`);function jd(e){return e.label!==void 0}var Md=3,Nd=`24px`,Pd=`16px`,Fd=4e3,Id=356,Ld=14,Rd=45,zd=200;function Bd(...e){return e.filter(Boolean).join(` `)}function Vd(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var Hd=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:c,toasts:l,expanded:u,removeToast:d,defaultRichColors:f,closeButton:p,style:m,cancelButtonStyle:h,actionButtonStyle:g,className:_=``,descriptionClassName:v=``,duration:y,position:b,gap:x,expandByDefault:S,classNames:C,icons:w,closeButtonAriaLabel:T=`Close toast`}=e,[E,D]=V.useState(null),[ee,O]=V.useState(null),[te,ne]=V.useState(!1),[re,k]=V.useState(!1),[ie,ae]=V.useState(!1),[oe,se]=V.useState(!1),[ce,le]=V.useState(!1),[ue,A]=V.useState(0),[de,fe]=V.useState(0),pe=V.useRef(n.duration||y||Fd),me=V.useRef(null),he=V.useRef(null),ge=c===0,_e=c+1<=o,ve=n.type,ye=ve??`default`,be=n.dismissible!==!1,xe=n.className||``,Se=n.descriptionClassName||``,Ce=V.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),we=V.useMemo(()=>n.closeButton??p,[n.closeButton,p]),Te=V.useMemo(()=>n.duration||y||Fd,[n.duration,y]),Ee=V.useRef(0),De=V.useRef(0),j=V.useRef(0),Oe=V.useRef(null),[M,ke]=b.split(`-`),Ae=V.useMemo(()=>s.reduce((e,t,n)=>n>=Ce?e:e+t.height,0),[s,Ce]),je=wd(),N=V.useMemo(()=>e.swipeDirections??Vd(b),[e.swipeDirections,b]),Me=n.invert||t,Ne=ve===`loading`;De.current=V.useMemo(()=>Ce*x+Ae,[Ce,Ae]),V.useEffect(()=>{pe.current=Te},[Te]),V.useEffect(()=>{ne(!0)},[]),V.useEffect(()=>{let e=he.current;if(e){let t=e.getBoundingClientRect().height;return fe(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),V.useLayoutEffect(()=>{if(!te)return;let e=he.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,fe(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[te,n.title,n.description,a,n.id,n.jsx,n.action,n.cancel]);let P=V.useCallback(()=>{k(!0),A(De.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},zd)},[n,d,a,De]);V.useEffect(()=>{if(n.promise&&ve===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||je?(()=>{if(j.current<Ee.current){let e=new Date().getTime()-Ee.current;pe.current-=e}j.current=new Date().getTime()})():pe.current!==1/0&&(Ee.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),P()},pe.current)),()=>clearTimeout(e)},[u,i,n,ve,je,P]),V.useEffect(()=>{n.delete&&(P(),n.onDismiss==null||n.onDismiss.call(n,n))},[P,n.delete]);function F(){return w?.loading?V.createElement(`div`,{className:Bd(C?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":ve===`loading`},w.loading):V.createElement(vd,{className:Bd(C?.loader,n?.classNames?.loader),visible:ve===`loading`})}let Pe=n.icon||w?.[ve]||gd(ve);return V.createElement(`li`,{tabIndex:0,ref:he,className:Bd(_,xe,C?.toast,n?.classNames?.toast,C?.[ye],n?.classNames?.[ye]),"data-sonner-toast":``,"data-rich-colors":n.richColors??f,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":te,"data-promise":!!n.promise,"data-swiped":ce,"data-removed":re,"data-visible":_e,"data-y-position":M,"data-x-position":ke,"data-index":c,"data-front":ge,"data-swiping":ie,"data-dismissible":be,"data-type":ve,"data-invert":Me,"data-swipe-out":oe,"data-swipe-direction":ee,"data-expanded":!!(u||S&&te),"data-testid":n.testId,style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${re?ue:De.current}px`,"--initial-height":S?`auto`:`${de}px`,...m,...n.style},onDragEnd:()=>{ae(!1),D(null),Oe.current=null},onPointerDown:e=>{e.button!==2&&!Ne&&be&&(me.current=new Date,A(De.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(ae(!0),Oe.current={x:e.clientX,y:e.clientY}))},onPointerUp:()=>{if(oe||!be)return;Oe.current=null;let e=Number(he.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(he.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-me.current?.getTime(),i=E===`x`?e:t,a=Math.abs(i)/r;if((E===`x`?N.includes(e>0?`right`:`left`):N.includes(t>0?`bottom`:`top`))&&(Math.abs(i)>=Rd||a>.11))A(De.current),n.onDismiss==null||n.onDismiss.call(n,n),O(E===`x`?e>0?`right`:`left`:t>0?`down`:`up`),P(),se(!0);else{var o,s;(o=he.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=he.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`),le(!1),ae(!1),D(null)}},onPointerMove:e=>{var t,n;if(!Oe.current||!be||window.getSelection()?.toString().length>0)return;let r=e.clientY-Oe.current.y,i=e.clientX-Oe.current.x;!E&&(Math.abs(i)>1||Math.abs(r)>1)&&D(Math.abs(i)>Math.abs(r)?`x`:`y`);let a={x:0,y:0},o=e=>1/(1.5+Math.abs(e)/20);if(E===`y`){if(N.includes(`top`)||N.includes(`bottom`)){if(N.includes(`top`)&&r<0||N.includes(`bottom`)&&r>0)a.y=r;else{let e=r*o(r);a.y=Math.abs(e)<Math.abs(r)?e:r}}}else if(E===`x`&&(N.includes(`left`)||N.includes(`right`))){if(N.includes(`left`)&&i<0||N.includes(`right`)&&i>0)a.x=i;else{let e=i*o(i);a.x=Math.abs(e)<Math.abs(i)?e:i}}(Math.abs(a.x)>0||Math.abs(a.y)>0)&&le(!0),(t=he.current)==null||t.style.setProperty(`--swipe-amount-x`,`${a.x}px`),(n=he.current)==null||n.style.setProperty(`--swipe-amount-y`,`${a.y}px`)}},we&&!n.jsx&&ve!==`loading`?V.createElement(`button`,{"aria-label":T,"data-disabled":Ne,"data-close-button":!0,onClick:Ne||!be?()=>{}:()=>{P(),n.onDismiss==null||n.onDismiss.call(n,n)},className:Bd(C?.closeButton,n?.classNames?.closeButton)},w?.close??Cd):null,(ve||n.icon||n.promise)&&n.icon!==null&&(w?.[ve]!==null||n.icon)?V.createElement(`div`,{"data-icon":``,className:Bd(C?.icon,n?.classNames?.icon)},ve===`loading`?n.icon||F():n.promise?F():null,ve===`loading`?null:Pe):null,V.createElement(`div`,{"data-content":``,className:Bd(C?.content,n?.classNames?.content)},V.createElement(`div`,{"data-title":``,className:Bd(C?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?V.createElement(`div`,{"data-description":``,className:Bd(v,Se,C?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),V.isValidElement(n.cancel)?n.cancel:n.cancel&&jd(n.cancel)?V.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||h,onClick:e=>{jd(n.cancel)&&be&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),P())},className:Bd(C?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,V.isValidElement(n.action)?n.action:n.action&&jd(n.action)?V.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||g,onClick:e=>{jd(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&P())},className:Bd(C?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function Ud(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function Wd(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?Pd:Nd;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}var Gd=V.forwardRef(function(e,t){let{id:n,invert:r,position:i=`bottom-right`,hotkey:a=[`altKey`,`KeyT`],expand:o,closeButton:s,className:c,offset:l,mobileOffset:u,theme:d=`light`,richColors:f,duration:p,style:m,visibleToasts:h=Md,toastOptions:g,dir:_=Ud(),gap:v=Ld,icons:y,customAriaLabel:b,containerAriaLabel:x=`Notifications`}=e,[S,C]=V.useState([]),w=V.useMemo(()=>n?S.filter(e=>e.toasterId===n):S.filter(e=>!e.toasterId),[S,n]),T=V.useMemo(()=>Array.from(new Set([i].concat(w.filter(e=>e.position).map(e=>e.position)))),[w,i]),[E,D]=V.useState([]),[ee,O]=V.useState(!1),[te,ne]=V.useState(!1),[re,k]=V.useState(d===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:d),ie=V.useRef(null),ae=a.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),oe=V.useRef(null),se=V.useRef(!1),ce=V.useCallback(e=>{C(t=>(t.find(t=>t.id===e.id)?.delete||Od.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return V.useEffect(()=>Od.subscribe(e=>{e.dismiss?requestAnimationFrame(()=>{C(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))}):setTimeout(()=>{gt.flushSync(()=>{C(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[]),V.useEffect(()=>{if(d!==`system`){k(d);return}if(d===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?k(`dark`):k(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{k(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{k(e?`dark`:`light`)}catch(e){console.error(e)}})}},[d]),V.useEffect(()=>{S.length<=1&&O(!1)},[S]),V.useEffect(()=>{let e=e=>{if(a.length>0&&a.every(t=>e[t]||e.code===t)){var t;O(!0),(t=ie.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===ie.current||ie.current?.contains(document.activeElement))&&O(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),V.useEffect(()=>{if(ie.current)return()=>{oe.current&&(oe.current.focus({preventScroll:!0}),oe.current=null,se.current=!1)}},[ie.current]),V.createElement(`section`,{ref:t,"aria-label":b??`${x} ${ae}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0,"data-react-aria-top-layer":!0},T.map((t,n)=>{let[i,a]=t.split(`-`);return w.length?V.createElement(`ol`,{key:t,dir:_===`auto`?Ud():_,tabIndex:-1,ref:ie,className:c,"data-sonner-toaster":!0,"data-sonner-theme":re,"data-y-position":i,"data-x-position":a,style:{"--front-toast-height":`${E[0]?.height||0}px`,"--width":`${Id}px`,"--gap":`${v}px`,...m,...Wd(l,u)},onBlur:e=>{se.current&&!e.currentTarget.contains(e.relatedTarget)&&(se.current=!1,oe.current&&=(oe.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||se.current||(se.current=!0,oe.current=e.relatedTarget)},onMouseEnter:()=>O(!0),onMouseMove:()=>O(!0),onMouseLeave:()=>{te||O(!1)},onDragEnd:()=>O(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||ne(!0)},onPointerUp:()=>ne(!1)},w.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>V.createElement(Hd,{key:n.id,icons:y,index:i,toast:n,defaultRichColors:f,duration:g?.duration??p,className:g?.className,descriptionClassName:g?.descriptionClassName,invert:r,visibleToasts:h,closeButton:g?.closeButton??s,interacting:te,position:t,style:g?.style,unstyled:g?.unstyled,classNames:g?.classNames,cancelButtonStyle:g?.cancelButtonStyle,actionButtonStyle:g?.actionButtonStyle,closeButtonAriaLabel:g?.closeButtonAriaLabel,removeToast:ce,toasts:w.filter(e=>e.position==n.position),heights:E.filter(e=>e.position==n.position),setHeights:D,expandByDefault:o,gap:v,expanded:ee,swipeDirections:e.swipeDirections}))):null}))}),Kd={error:`bg-destructive/10 text-destructive border border-destructive/20`,success:`bg-emerald-500/10 text-emerald-700 dark:text-emerald-400 border border-emerald-500/20`,warning:`border border-amber-500/20 bg-amber-500/10 text-amber-700 dark:text-amber-300`},qd={error:ie,success:Bi,warning:Sa};function Jd({variant:e,className:t,children:n}){let r=qd[e];return(0,H.jsxs)(`div`,{className:M(`flex items-start gap-2.5 rounded-lg px-3 py-2 text-xs font-medium`,Kd[e],t),children:[(0,H.jsx)(r,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,H.jsx)(`span`,{children:n})]})}var Yd=[`[data-slot='select-content']`,`[data-slot='dropdown-menu-content']`,`[data-slot='dropdown-menu-sub-content']`,`[data-slot='popover-content']`,`[data-radix-popper-content-wrapper]`].join(`, `),Xd=[`[data-slot='select-content'][data-state='open']`,`[data-slot='dropdown-menu-content'][data-state='open']`,`[data-slot='dropdown-menu-sub-content'][data-state='open']`,`[data-slot='popover-content'][data-state='open']`].join(`, `);function Zd(e){return e instanceof Element&&e.closest(Yd)!==null}function Qd(){return typeof document<`u`&&document.querySelector(Xd)!==null}function $d(){let e=V.useRef(!1);return V.useEffect(()=>{let t=()=>{e.current=Qd()};return document.addEventListener(`pointerdown`,t,!0),()=>document.removeEventListener(`pointerdown`,t,!0)},[]),V.useCallback(t=>{!t.defaultPrevented&&(Zd(t.target)||e.current||Qd())&&t.preventDefault()},[])}function ef({...e}){return(0,H.jsx)(za,{"data-slot":`dialog`,...e})}function tf({...e}){return(0,H.jsx)(Va,{"data-slot":`dialog-trigger`,...e})}function nf({...e}){return(0,H.jsx)(Ga,{"data-slot":`dialog-portal`,...e})}function rf({className:e,...t}){return(0,H.jsx)(qa,{"data-slot":`dialog-overlay`,className:M(`data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50`,e),...t})}function af({className:e,children:t,showCloseButton:n=!0,onFocusOutside:r,onInteractOutside:i,onPointerDownOutside:a,...o}){let s=$d(),{t:c}=j();return(0,H.jsxs)(nf,{"data-slot":`dialog-portal`,children:[(0,H.jsx)(rf,{}),(0,H.jsxs)(Za,{"data-slot":`dialog-content`,className:M(`bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 overflow-hidden rounded-lg border p-6 shadow-lg duration-200 outline-none overscroll-contain sm:max-w-lg`,e),onFocusOutside:e=>{r?.(e),s(e)},onInteractOutside:e=>{i?.(e),s(e)},onPointerDownOutside:e=>{a?.(e),s(e)},...o,children:[t,n&&(0,H.jsxs)(io,{"data-slot":`dialog-close`,className:`ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,H.jsx)(se,{}),(0,H.jsx)(`span`,{className:`sr-only`,children:c(`common.actions.close`)})]})]})]})}function of({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`dialog-header`,className:M(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function sf({className:e,showCloseButton:t=!1,children:n,...r}){let{t:i}=j();return(0,H.jsxs)(`div`,{"data-slot":`dialog-footer`,className:M(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,H.jsx)(io,{asChild:!0,children:(0,H.jsx)(N,{variant:`outline`,children:i(`common.actions.close`)})})]})}function cf({className:e,...t}){return(0,H.jsx)(to,{"data-slot":`dialog-title`,className:M(`text-lg leading-none font-semibold`,e),...t})}function lf({className:e,...t}){return(0,H.jsx)(no,{"data-slot":`dialog-description`,className:M(`text-muted-foreground text-sm`,e),...t})}var uf=wu,df=V.createContext({}),ff=({...e})=>(0,H.jsx)(df.Provider,{value:{name:e.name},children:(0,H.jsx)(tu,{...e})}),pf=()=>{let e=V.useContext(df),t=V.useContext(mf),{getFieldState:n}=Cu(),r=Xl({name:e.name}),i=n(e.name,r);if(!e)throw Error(`useFormField should be used within <FormField>`);let{id:a}=t;return{id:a,name:e.name,formItemId:`${a}-form-item`,formDescriptionId:`${a}-form-item-description`,formMessageId:`${a}-form-item-message`,...i}},mf=V.createContext({});function hf({className:e,...t}){let n=V.useId();return(0,H.jsx)(mf.Provider,{value:{id:n},children:(0,H.jsx)(`div`,{"data-slot":`form-item`,className:M(`grid gap-2`,e),...t})})}function gf({className:e,...t}){let{error:n,formItemId:r}=pf();return(0,H.jsx)(We,{"data-slot":`form-label`,"data-error":!!n,className:M(`data-[error=true]:text-destructive`,e),htmlFor:r,...t})}function _f({...e}){let{error:t,formItemId:n,formDescriptionId:r,formMessageId:i}=pf();return(0,H.jsx)(ke,{"data-slot":`form-control`,id:n,"aria-describedby":t?`${r} ${i}`:`${r}`,"aria-invalid":!!t,...e})}function vf({className:e,...t}){let{formDescriptionId:n}=pf();return(0,H.jsx)(`p`,{"data-slot":`form-description`,id:n,className:M(`text-muted-foreground text-sm`,e),...t})}function yf(e){if(!e)return``;let t=Ee(Te.resolvedLanguage??Te.language),n=Te.getFixedT(t)(e);if(n!==e)return n;let r=Te.getFixedT(`en`)(e);return r===e?Te.getFixedT(`zh-CN`)(e):r}function bf({className:e,...t}){let{error:n,formMessageId:r}=pf(),i=t.children??(n?yf(String(n?.message??``)):null);return i?(0,H.jsx)(`p`,{"data-slot":`form-message`,id:r,className:M(`text-destructive text-sm`,e),...t,children:i}):null}function xf({className:e,type:t,...n}){return(0,H.jsx)(`input`,{type:t,"data-slot":`input`,className:M(`file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,`focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]`,`aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive`,e),...n})}function Sf(e,t=`Request failed`){return e instanceof Error?e.message:t}function Cf(e,t=`Request failed`){return e?Sf(e,t):null}function wf({open:e,onOpenChange:t,disabled:n=!1}){let{t:r}=j(),i=B(e=>e.passwordManagementEnabled),a=e=>{if(!e)return;let t=r(e);return t===e?e:t},o=id({resolver:md(ut),defaultValues:{currentPassword:``,newPassword:``}}),s=o.formState.isSubmitting,c=s||n||!i;(0,V.useEffect)(()=>{e||(o.reset(),o.clearErrors())},[e,o]);let l=async e=>{o.clearErrors(`root`);try{await Ye(e),Q.success(r(`settings.password.toasts.changed`)),t(!1)}catch(e){o.setError(`root`,{message:Sf(e)})}},u=o.formState.errors.root?.message;return(0,H.jsx)(ef,{open:e,onOpenChange:t,children:(0,H.jsxs)(af,{className:`sm:max-w-md`,children:[(0,H.jsxs)(of,{children:[(0,H.jsx)(cf,{children:r(`settings.password.changeDialog.title`)}),(0,H.jsx)(lf,{children:r(`settings.password.changeDialog.description`)})]}),u?(0,H.jsx)(Jd,{variant:`error`,children:u}):null,(0,H.jsx)(uf,{...o,children:(0,H.jsxs)(`form`,{onSubmit:o.handleSubmit(l),className:`space-y-4`,children:[(0,H.jsx)(ff,{control:o.control,name:`currentPassword`,render:({field:e,fieldState:t})=>(0,H.jsxs)(hf,{children:[(0,H.jsx)(gf,{children:r(`settings.password.changeDialog.currentLabel`)}),(0,H.jsx)(_f,{children:(0,H.jsx)(xf,{...e,type:`password`,autoComplete:`current-password`})}),t.error?.message?(0,H.jsx)(bf,{children:a(t.error.message)}):(0,H.jsx)(bf,{})]})}),(0,H.jsx)(ff,{control:o.control,name:`newPassword`,render:({field:e,fieldState:t})=>(0,H.jsxs)(hf,{children:[(0,H.jsx)(gf,{children:r(`settings.password.changeDialog.newLabel`)}),(0,H.jsx)(_f,{children:(0,H.jsx)(xf,{...e,type:`password`,autoComplete:`new-password`,placeholder:r(`settings.password.changeDialog.newPlaceholder`)})}),t.error?.message?(0,H.jsx)(bf,{children:a(t.error.message)}):(0,H.jsx)(bf,{})]})}),(0,H.jsxs)(sf,{children:[(0,H.jsx)(N,{type:`button`,variant:`outline`,onClick:()=>t(!1),disabled:s,children:r(`common.cancel`)}),(0,H.jsx)(N,{type:`submit`,disabled:c,children:r(`settings.password.changeDialog.submit`)})]})]})})]})})}var Tf=`/settings${rl}`,Ef=`/settings${nl}`;function Df(e){let{t}=j(),n=tr(),r=B(e=>e.passwordManagementEnabled&&e.passwordSessionActive),i=at(`users:manage`),a=B(e=>e.logout),o=B(e=>e.logoutEverywhere),s=[{key:`password`,label:t(`nav.account.myPassword`),icon:Qi,onSelect:e}];return r&&s.push({key:`two-factor`,label:t(`nav.account.myTwoFactor`),icon:va,onSelect:()=>n(Tf)}),i&&s.push({key:`invite`,label:t(`nav.account.inviteTeammate`),icon:wa,onSelect:()=>n(Ef)}),s.push({key:`logout-everywhere`,label:t(`nav.account.logoutEverywhere`),icon:ca,onSelect:()=>void o(),destructive:!0},{key:`logout`,label:t(`common.logout`),icon:ca,onSelect:()=>void a(),destructive:!0}),s}function Of(e){return e.slice(0,2).toUpperCase()}function kf(){let e=B(e=>e.user),[t,n]=(0,V.useState)(!1),r=Df(()=>n(!0));return e?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(Gc,{children:[(0,H.jsx)(Kc,{asChild:!0,children:(0,H.jsxs)(N,{type:`button`,size:`sm`,variant:`ghost`,className:`press-scale hidden h-8 min-w-0 max-w-[14rem] shrink gap-2 rounded-lg pr-2.5 pl-1 text-xs text-muted-foreground hover:text-foreground sm:inline-flex`,children:[(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`grid h-6 w-6 place-items-center rounded-full bg-primary/10 text-[10px] font-semibold text-primary`,children:Of(e.username)}),(0,H.jsxs)(`span`,{className:`min-w-0 max-w-[12rem] truncate`,children:[e.username,` · `,(0,H.jsx)(`span`,{className:`text-muted-foreground/70`,children:e.role.name})]})]})}),(0,H.jsxs)(qc,{align:`end`,className:`min-w-52`,children:[(0,H.jsx)(Qc,{className:`truncate text-xs font-normal text-muted-foreground`,children:e.displayName??e.username}),(0,H.jsx)($c,{}),r.map(e=>(0,H.jsxs)(Jc,{onSelect:e.onSelect,className:M(`cursor-pointer gap-2`,e.destructive&&`text-destructive focus:text-destructive`),children:[(0,H.jsx)(e.icon,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),e.label]},e.key))]})]}),(0,H.jsx)(wf,{open:t,onOpenChange:n})]}):null}var Af={en:`common.english`,"zh-CN":`common.chinese`,ko:`common.korean`};function jf(){let{t:e,i18n:t}=j(),n=Ee(t.resolvedLanguage??t.language);return(0,H.jsxs)(Gc,{children:[(0,H.jsx)(Kc,{asChild:!0,children:(0,H.jsx)(N,{type:`button`,size:`sm`,variant:`ghost`,"aria-label":e(`common.language`),className:`press-scale hidden h-8 w-8 rounded-lg text-muted-foreground hover:text-foreground sm:inline-flex`,children:(0,H.jsx)(ea,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})})}),(0,H.jsx)(qc,{align:`end`,className:`min-w-[140px]`,children:De.map(r=>(0,H.jsx)(Jc,{onSelect:()=>{r!==n&&t.changeLanguage(r)},className:r===n?`font-semibold`:void 0,children:e(Af[r])},r))})]})}function Mf(){let{t:e,i18n:t}=j(),n=Ee(t.resolvedLanguage??t.language);return(0,H.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:De.map(r=>(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{r!==n&&t.changeLanguage(r)},className:`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-left text-sm transition-colors hover:bg-muted ${r===n?`font-semibold text-foreground`:`font-medium text-muted-foreground hover:text-foreground`}`,children:[(0,H.jsx)(ea,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),e(Af[r])]},r))})}var Nf=[{to:`/dashboard`,labelKey:`nav.dashboard`,requires:`dashboard:read`},{to:`/reports`,labelKey:`nav.reports`,requires:`dashboard:read`},{to:`/accounts`,labelKey:`nav.accounts`,requires:`accounts:read`},{to:`/apis`,labelKey:`nav.apis`,requires:`dashboard:read`},{to:`/settings`,labelKey:`nav.settings`,requires:`dashboard:read`}],Pf=[{to:`/automations`,labelKey:`nav.automations`,requires:`dashboard:read`}];function Ff(e){return[...Nf,...Pf].find(t=>e===t.to||e.startsWith(`${t.to}/`))?.requires??null}function If({...e}){return(0,H.jsx)(za,{"data-slot":`sheet`,...e})}function Lf({...e}){return(0,H.jsx)(Va,{"data-slot":`sheet-trigger`,...e})}function Rf({...e}){return(0,H.jsx)(Ga,{"data-slot":`sheet-portal`,...e})}function zf({className:e,...t}){return(0,H.jsx)(qa,{"data-slot":`sheet-overlay`,className:M(`data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50`,e),...t})}function Bf({className:e,children:t,side:n=`right`,showCloseButton:r=!0,onFocusOutside:i,onInteractOutside:a,onPointerDownOutside:o,...s}){let c=$d(),{t:l}=j();return(0,H.jsxs)(Rf,{children:[(0,H.jsx)(zf,{}),(0,H.jsxs)(Za,{"data-slot":`sheet-content`,onFocusOutside:e=>{i?.(e),c(e)},onInteractOutside:e=>{a?.(e),c(e)},onPointerDownOutside:e=>{o?.(e),c(e)},className:M(`bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out overscroll-contain data-[state=closed]:duration-300 data-[state=open]:duration-500`,n===`right`&&`data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm`,n===`left`&&`data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm`,n===`top`&&`data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b`,n===`bottom`&&`data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t`,e),...s,children:[t,r&&(0,H.jsxs)(io,{className:`ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none`,children:[(0,H.jsx)(se,{className:`size-4`}),(0,H.jsx)(`span`,{className:`sr-only`,children:l(`common.actions.close`)})]})]})]})}function Vf({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`sheet-header`,className:M(`flex flex-col gap-1.5 p-4`,e),...t})}function Hf({className:e,...t}){return(0,H.jsx)(to,{"data-slot":`sheet-title`,className:M(`text-foreground font-semibold`,e),...t})}function Uf({className:e,...t}){return(0,H.jsx)(no,{"data-slot":`sheet-description`,className:M(`text-muted-foreground text-sm`,e),...t})}var Wf=I({t:k({offset:!0}),v:L()}),Gf=I({primaryRemainingPercent:L().nullable(),secondaryRemainingPercent:L().nullable(),monthlyRemainingPercent:L().nullable().optional()}),Kf=I({requestCount:L().int().nonnegative(),totalTokens:L().int().nonnegative(),cachedInputTokens:L().int().nonnegative(),totalCostUsd:L().nonnegative()}),qf=I({availableCount:L().int().nonnegative()}),Jf=I({accountId:z(),rateLimitResetCredits:qf}),Yf=I({expiresAt:k({offset:!0}).nullable().optional(),state:z().nullable().optional()}),Xf=I({access:Yf.nullable().optional(),refresh:Yf.nullable().optional(),idToken:Yf.nullable().optional()}),Zf=I({window:R([`primary`,`secondary`]).or(z()),resetAt:L().int(),status:z(),model:z(),attemptedAt:k({offset:!0}),completedAt:k({offset:!0}).nullable().optional(),errorCode:z().nullable().optional(),errorMessage:z().nullable().optional()}),Qf=I({usedPercent:L(),resetAt:L().nullable().optional(),windowMinutes:L().nullable().optional()}),$f=I({quotaKey:z().nullable().optional(),limitName:z(),meteredFeature:z(),displayLabel:z().nullable().optional(),routingPolicy:R([`inherit`,`normal`,`burn_first`,`preserve`]).nullable().optional(),primaryWindow:Qf.nullable().optional(),secondaryWindow:Qf.nullable().optional()}),ep=I({accountId:z(),chatgptAccountId:z().nullable().optional(),email:z(),alias:z().nullable().optional(),displayName:z(),workspaceId:z().nullable().optional(),workspaceLabel:z().nullable().optional(),seatType:z().nullable().optional(),planType:z(),routingPolicy:R([`normal`,`burn_first`,`preserve`]).optional(),status:z(),securityWorkAuthorized:F().optional(),usage:Gf.nullable().optional(),resetAtPrimary:k({offset:!0}).nullable().optional(),resetAtSecondary:k({offset:!0}).nullable().optional(),resetAtMonthly:k({offset:!0}).nullable().optional(),windowMinutesPrimary:L().nullable().optional(),windowMinutesSecondary:L().nullable().optional(),windowMinutesMonthly:L().nullable().optional(),capacityCreditsPrimary:L().nullable().optional(),remainingCreditsPrimary:L().nullable().optional(),capacityCreditsSecondary:L().nullable().optional(),remainingCreditsSecondary:L().nullable().optional(),capacityCreditsMonthly:L().nullable().optional(),remainingCreditsMonthly:L().nullable().optional(),creditsHas:F().nullable().optional(),creditsUnlimited:F().nullable().optional(),creditsBalance:L().nullable().optional(),requestUsage:Kf.nullable().optional(),auth:Xf.nullable().optional(),additionalQuotas:P($f).default([]),limitWarmupEnabled:F().default(!1),limitWarmup:Zf.nullable().optional(),isEmailDuplicate:F().optional(),availableResetCredits:L().nullable().optional(),resetCreditNearestExpiresAt:k({offset:!0}).nullable().optional()}),tp=I({id:z(),status:z().nullable().optional(),resetType:z().nullable().optional(),grantedAt:k({offset:!0}).nullable().optional(),expiresAt:k({offset:!0}).nullable().optional(),title:z().nullable().optional(),description:z().nullable().optional(),redeemedAt:k({offset:!0}).nullable().optional(),redeemStartedAt:k({offset:!0}).nullable().optional()}),np=I({availableCount:L(),nearestExpiresAt:k({offset:!0}).nullable(),credits:P(tp)}),rp=I({code:z().nullable().optional(),windowsReset:L().nullable().optional(),redeemedAt:k({offset:!0}).nullable()}),ip=I({accountId:z(),primary:P(Wf),secondary:P(Wf),secondaryScheduled:P(Wf).default([])}),ap=I({accounts:P(ep)}),op=I({accountId:z(),email:z(),workspaceId:z().nullable().optional(),workspaceLabel:z().nullable().optional(),seatType:z().nullable().optional(),planType:z(),status:z()}),sp=I({type:Re(`oauth`),refresh:z(),access:z(),expires:L().int().nonnegative(),accountId:z().nullable().optional()}),cp=I({openai:sp}),lp=I({accountId:z(),chatgptAccountId:z().nullable().optional(),email:z()}),up=I({id_token:z(),access_token:z(),refresh_token:z(),account_id:z().nullable().optional()}),dp=I({auth_mode:z(),OPENAI_API_KEY:z().nullable().optional(),tokens:up,last_refresh:z()}),fp=I({idToken:z(),accessToken:z(),refreshToken:z(),expiresAtMs:L().int().nonnegative()}),pp=I({filename:z(),account:lp,tokens:fp,codexAuthJson:dp,opencodeAuthJson:cp}),mp=I({status:z()}),hp=I({model:z().min(1).optional()}),gp=I({status:z(),accountId:z(),probeStatusCode:L().int().nullable(),primaryUsedPercentBefore:L().nullable(),primaryUsedPercentAfter:L().nullable(),secondaryUsedPercentBefore:L().nullable(),secondaryUsedPercentAfter:L().nullable(),accountStatusBefore:z(),accountStatusAfter:z()}),_p=I({redeemRequestId:z().trim().min(1).optional()}),vp=I({status:z(),accountId:z(),code:z(),windowsReset:L().int().nonnegative(),usageWritten:F(),primaryUsedPercentBefore:L().nullable(),primaryUsedPercentAfter:L().nullable(),secondaryUsedPercentBefore:L().nullable(),secondaryUsedPercentAfter:L().nullable(),accountStatusBefore:z(),accountStatusAfter:z()}),yp=R([`normal`,`burn_first`,`preserve`]),bp=I({alias:z().max(255).nullable()}),xp=I({accountId:z(),alias:z().nullable()}),Sp=I({enabled:F()}),Cp=I({status:z(),enabled:F()}),wp=I({routingPolicy:yp}),Tp=I({accountId:z(),routingPolicy:yp}),Ep=I({securityWorkAuthorized:F().optional()}),Dp=I({forceMethod:z().optional(),accountId:z().optional()}),Op=I({flowId:z().nullable().optional(),method:z(),authorizationUrl:z().nullable(),callbackUrl:z().nullable(),verificationUrl:z().nullable(),userCode:z().nullable(),deviceAuthId:z().nullable(),intervalSeconds:L().nullable(),expiresInSeconds:L().nullable()}),kp=I({status:z(),errorMessage:z().nullable()}),Ap=I({flowId:z().optional(),deviceAuthId:z().optional(),userCode:z().optional()}),jp=I({status:z(),errorMessage:z().nullable().optional()}),Mp=I({callbackUrl:z(),flowId:z().optional()}),Np=I({status:z(),errorMessage:z().nullable()}),Pp=I({connectAddress:z()}),Fp=I({flowId:z().nullable().optional(),status:R([`idle`,`starting`,`pending`,`success`,`error`]),method:R([`browser`,`device`]).nullable(),authorizationUrl:z().nullable(),callbackUrl:z().nullable(),verificationUrl:z().nullable(),userCode:z().nullable(),deviceAuthId:z().nullable(),intervalSeconds:L().nullable(),expiresInSeconds:L().nullable(),errorMessage:z().nullable()});I({status:R([`idle`,`uploading`,`success`,`error`]),message:z().nullable()});var Ip=`/api/accounts`,Lp=`/api/oauth`;function Rp(){return ze(Ip,ap)}function zp(e){let t=new FormData;return t.append(`auth_json`,e),Ne(`${Ip}/import`,op,{body:t})}function Bp(e){return Ne(`${Ip}/${encodeURIComponent(e)}/pause`,mp)}function Vp(e){return Ne(`${Ip}/${encodeURIComponent(e)}/reactivate`,mp)}function Hp(e,t){let n=bp.parse({alias:t});return Le(`${Ip}/${encodeURIComponent(e)}/alias`,xp,{body:n})}function Up(e,t){let n=Ep.parse(t);return Fe(`${Ip}/${encodeURIComponent(e)}`,mp,{body:n})}function Wp(e,t){let n=Sp.parse({enabled:t});return Le(`${Ip}/${encodeURIComponent(e)}/limit-warmup`,Cp,{body:n})}function Gp(e,t){let n=wp.parse({routingPolicy:t});return Le(`${Ip}/${encodeURIComponent(e)}/routing-policy`,Tp,{body:n})}function Kp(e){return ze(`${Ip}/${encodeURIComponent(e)}/trends`,ip)}function qp(e){return ze(`${Ip}/${encodeURIComponent(e)}/usage-reset-credits`,Jf)}function Jp(e,t){let n=t===void 0?void 0:_p.parse(t);return Ne(`${Ip}/${encodeURIComponent(e)}/usage-reset-credits/consume`,vp,n?{body:n}:void 0)}function Yp(e,t){let n=t===void 0?void 0:hp.parse(t);return Ne(`${Ip}/${encodeURIComponent(e)}/probe`,gp,n?{body:n}:void 0)}function Xp(e){return Ne(`${Ip}/${encodeURIComponent(e)}/export/auth`,pp)}function Zp(e){return ze(`${Ip}/${encodeURIComponent(e)}/rate-limit-reset-credits`,np.nullable())}function Qp(e,t){let n=t===void 0?void 0:_p.parse(t);return Ne(`${Ip}/${encodeURIComponent(e)}/rate-limit-reset-credits/consume`,rp,n?{body:n}:void 0)}function $p(e,t=!1){return Ie(`${Ip}/${encodeURIComponent(e)}${t?`?delete_history=true`:``}`,mp)}function em(e){let t=Dp.parse(e);return Ne(`${Lp}/start`,Op,{body:t})}function tm(e){let t=e?`?flowId=${encodeURIComponent(e)}`:``;return ze(`${Lp}/status${t}`,kp)}function nm(e){let t=Ap.parse(e??{});return Ne(`${Lp}/complete`,jp,{body:t})}function rm(e){let t=Mp.parse(e);return Ne(`${Lp}/manual-callback`,Np,{body:t})}function im(){return ze(`/api/settings/runtime/connect-address`,Pp)}var am=R([`usage_weighted`,`round_robin`,`capacity_weighted`,`sequential_drain`,`reset_drain`,`single_account`,`relative_availability`,`fill_first`]),om=R([`auto`,`http`,`websocket`]),sm=R([`smart`,`always_http`,`always_websocket`,`pinned`]),cm=R([`primary`,`secondary`,`both`]),lm=R([`inherit`,`normal`,`burn_first`,`preserve`]),um=Ue([L(),z(),F()]),dm=I({source:R([`dashboard`,`env`,`default`]),envValue:um.nullable().optional().default(null),default:um.nullable().optional().default(null)}),fm=I({quotaKey:z(),displayLabel:z(),routingPolicy:lm,modelIds:P(z()).optional().default([])}),pm=z().min(1).max(128),mm=z().min(1).max(512),hm=z().regex(/^[0-6](,[0-6])*$/),gm=hm.default(`0,1,2,3,4,5,6`),_m=Ue([Re(15),Re(30),Re(60),Re(120),Re(240)]),vm=I({stickyThreadsEnabled:F(),upstreamStreamTransport:om.optional().default(`auto`),prohibitFastMode:F().optional().default(!1),httpDownstreamTransportPolicy:sm.optional().default(`smart`),upstreamProxyRoutingEnabled:F().optional().default(!1),upstreamProxyDefaultPoolId:z().nullable().optional().default(null),preferEarlierResetAccounts:F(),preferEarlierResetWindow:R([`primary`,`secondary`]).optional().default(`secondary`),showResetCreditBadges:F().optional().default(!0),autoRedeemResetCreditsBeforeExpiry:F().optional().default(!1),showResetCreditExpiryBadge:F().optional().default(!0),routingStrategy:am.optional().default(`usage_weighted`),relativeAvailabilityPower:L().positive().optional().default(2),relativeAvailabilityTopK:L().int().min(1).max(20).optional().default(5),singleAccountId:z().nullable().optional().default(null),proxyAccountResponseCreateLimit:L().int().min(0).optional().default(4),proxyAccountResponseCreateLimitEnvironmentValue:L().int().min(0).optional().default(4),proxyAccountResponseCreateLimitOverride:L().int().min(0).nullable().optional().default(null),proxyAccountStreamLimit:L().int().min(0).optional().default(8),proxyAccountStreamLimitEnvironmentValue:L().int().min(0).optional().default(8),proxyAccountStreamLimitOverride:L().int().min(0).nullable().optional().default(null),proxyAccountStreamRecoveryReserve:L().int().min(0).optional().default(1),proxyAccountStreamRecoveryReserveEnvironmentValue:L().int().min(0).optional().default(1),proxyAccountStreamRecoveryReserveOverride:L().int().min(0).nullable().optional().default(null),proxyApiKeyFairShareCongestionThresholdPct:L().int().min(0).max(100).optional().default(0),proxyApiKeyFairShareCongestionThresholdPctEnvironmentValue:L().int().min(0).max(100).optional().default(0),proxyApiKeyFairShareCongestionThresholdPctOverride:L().int().min(0).max(100).nullable().optional().default(null),proxyOverloadIsolationSeconds:L().int().min(0).optional().default(1800),proxyAccountErrorRateWeightingEnabled:F().optional().default(!0),proxyAccountInflightPenaltyPct:L().min(0).optional().default(2.5),proxyAccountLeaseTokenWeight:L().min(0).optional().default(1),proxyAccountLeaseTtlSeconds:L().positive().optional().default(900),openaiCacheAffinityMaxAgeSeconds:L().int().positive().optional().default(300),dashboardSessionTtlSeconds:L().int().min(3600).optional().default(31536e3),stickyReallocationBudgetThresholdPct:L().min(0).max(100).optional(),stickyReallocationPrimaryBudgetThresholdPct:L().min(0).max(100).optional(),stickyReallocationSecondaryBudgetThresholdPct:L().min(0).max(100).optional(),additionalQuotaRoutingPolicies:Pe(z(),lm).optional(),additionalQuotaPolicies:P(fm).optional().default([]),warmupModel:z().trim().min(1).optional().default(`gpt-5.4-mini`),importWithoutOverwrite:F(),totpRequiredOnLogin:F(),totpRequiredForAdminRole:F().optional().default(!1),localLoginPolicy:dt.optional().default(`enabled`),usersWithoutTotpCount:L().int().min(0).optional().default(0),adminsWithoutTotpCount:L().int().min(0).optional().default(0),apiKeyAuthEnabled:F(),hideUpstreamQuotaFromApiKeys:F().optional().default(!1),limitWarmupEnabled:F().optional().default(!1),limitWarmupWindows:cm.optional().default(`both`),limitWarmupModel:pm.optional().default(`auto`),limitWarmupPrompt:mm.optional().default(`Say OK.`),limitWarmupCooldownSeconds:L().int().min(60).optional().default(3600),limitWarmupExhaustedThresholdPercent:L().positive().max(100).optional().default(99),limitWarmupIdleThresholdPercent:L().positive().max(100).optional().default(1),limitWarmupMinAvailablePercent:L().positive().max(100).optional().default(100),weeklyPaceWorkingDays:gm,weeklyPaceSmoothingMinutes:_m.optional().default(30),guestAccessEnabled:F().optional().default(!1),guestPasswordConfigured:F().optional().default(!1),limitWarmupStaggeredIdleEnabled:F().optional().default(!1),requestLogRetentionDays:L().int().min(0).max(3650).optional().default(0),usageHistoryRetentionDays:L().int().min(0).max(3650).optional().default(0),requestLogRetentionOverrideDays:L().int().min(0).max(3650).nullable().optional().default(null),usageHistoryRetentionOverrideDays:L().int().min(0).max(3650).nullable().optional().default(null),upstreamConnectTimeoutSeconds:L().optional().default(8),proxyRequestBudgetSeconds:L().optional().default(600),compactRequestBudgetSeconds:L().optional().default(180),transcriptionRequestBudgetSeconds:L().optional().default(120),streamIdleTimeoutSeconds:L().optional().default(7200),proxyDownstreamWebsocketIdleTimeoutSeconds:L().optional().default(120),sseKeepaliveIntervalSeconds:L().optional().default(10),httpResponsesStreamRequestBudgetSeconds:L().optional().default(7200),httpResponsesSessionBridgeRequestBudgetSeconds:L().optional().default(7200),provenance:Pe(z(),dm).optional(),softDrainEnabled:F().optional().default(!0),deterministicFailoverEnabled:F().optional().default(!0),circuitBreakerEnabled:F().optional().default(!1),httpResponsesSessionBridgeCodexPrewarmEnabled:F().optional().default(!1),authGuardianEnabled:F().optional().default(!0),authGuardianBlockedByTopology:F().optional().default(!1),automationsSchedulerEnabled:F().optional().default(!0),rateLimitResetCreditsRefreshEnabled:F().optional().default(!0),conversationArchiveEnabled:F().optional().default(!1),conversationArchiveDir:z().nullable().optional().default(null),httpResponsesSessionBridgeOperationSpoolRetentionSeconds:L().optional().default(604800),httpResponsesSessionBridgeOperationSpoolRetentionFloorSeconds:L().optional().default(0),version:L().int().min(1).optional()}).transform(e=>{let t=e.stickyReallocationBudgetThresholdPct!==void 0,n=e.stickyReallocationPrimaryBudgetThresholdPct!==void 0,r=e.stickyReallocationSecondaryBudgetThresholdPct!==void 0,i=e.stickyReallocationPrimaryBudgetThresholdPct??e.stickyReallocationBudgetThresholdPct??95;return{...e,stickyReallocationBudgetThresholdPct:e.stickyReallocationBudgetThresholdPct??i,stickyReallocationPrimaryBudgetThresholdPct:i,stickyReallocationSecondaryBudgetThresholdPct:e.stickyReallocationSecondaryBudgetThresholdPct??e.stickyReallocationBudgetThresholdPct??100,__stickyReallocationBudgetThresholdPctProvided:t,__stickyReallocationPrimaryBudgetThresholdPctProvided:n,__stickyReallocationSecondaryBudgetThresholdPctProvided:r}}),ym=I({expectedVersion:L().int().min(1).optional(),stickyThreadsEnabled:F().optional(),upstreamStreamTransport:om.optional(),prohibitFastMode:F().optional(),httpDownstreamTransportPolicy:sm.optional(),upstreamProxyRoutingEnabled:F().optional(),upstreamProxyDefaultPoolId:z().nullable().optional(),preferEarlierResetAccounts:F().optional(),preferEarlierResetWindow:R([`primary`,`secondary`]).optional(),showResetCreditBadges:F().optional(),autoRedeemResetCreditsBeforeExpiry:F().optional(),showResetCreditExpiryBadge:F().optional(),routingStrategy:am.optional(),relativeAvailabilityPower:L().positive().optional(),relativeAvailabilityTopK:L().int().min(1).max(20).optional(),singleAccountId:z().nullable().optional(),proxyAccountResponseCreateLimit:L().int().min(0).nullable().optional(),proxyAccountStreamLimit:L().int().min(0).nullable().optional(),proxyAccountStreamRecoveryReserve:L().int().min(0).nullable().optional(),proxyApiKeyFairShareCongestionThresholdPct:L().int().min(0).max(100).nullable().optional(),proxyOverloadIsolationSeconds:L().int().min(0).nullable().optional(),proxyAccountErrorRateWeightingEnabled:F().nullable().optional(),proxyAccountInflightPenaltyPct:L().min(0).max(100).nullable().optional(),proxyAccountLeaseTokenWeight:L().min(0).nullable().optional(),proxyAccountLeaseTtlSeconds:L().positive().nullable().optional(),openaiCacheAffinityMaxAgeSeconds:L().int().positive().optional(),dashboardSessionTtlSeconds:L().int().min(3600).optional(),stickyReallocationBudgetThresholdPct:L().min(0).max(100).optional(),stickyReallocationPrimaryBudgetThresholdPct:L().min(0).max(100).optional(),stickyReallocationSecondaryBudgetThresholdPct:L().min(0).max(100).optional(),additionalQuotaRoutingPolicies:Pe(z(),lm).optional(),warmupModel:z().trim().min(1).optional(),importWithoutOverwrite:F().optional(),totpRequiredOnLogin:F().optional(),totpRequiredForAdminRole:F().optional(),localLoginPolicy:lt.optional(),apiKeyAuthEnabled:F().optional(),hideUpstreamQuotaFromApiKeys:F().optional(),limitWarmupEnabled:F().optional(),limitWarmupWindows:cm.optional(),limitWarmupModel:pm.optional(),limitWarmupPrompt:mm.optional(),limitWarmupCooldownSeconds:L().int().min(60).optional(),limitWarmupExhaustedThresholdPercent:L().positive().max(100).optional(),limitWarmupIdleThresholdPercent:L().positive().max(100).optional(),limitWarmupMinAvailablePercent:L().positive().max(100).optional(),weeklyPaceWorkingDays:hm.optional(),weeklyPaceSmoothingMinutes:_m.optional(),guestAccessEnabled:F().optional(),limitWarmupStaggeredIdleEnabled:F().optional(),requestLogRetentionOverrideDays:L().int().min(0).max(3650).nullable().optional(),usageHistoryRetentionOverrideDays:L().int().min(0).max(3650).nullable().optional(),softDrainEnabled:F().nullable().optional(),deterministicFailoverEnabled:F().nullable().optional(),circuitBreakerEnabled:F().nullable().optional(),httpResponsesSessionBridgeCodexPrewarmEnabled:F().nullable().optional(),authGuardianEnabled:F().nullable().optional(),automationsSchedulerEnabled:F().nullable().optional(),rateLimitResetCreditsRefreshEnabled:F().nullable().optional(),conversationArchiveEnabled:F().nullable().optional(),httpResponsesSessionBridgeOperationSpoolRetentionSeconds:L().positive().max(31536e4).nullable().optional(),upstreamConnectTimeoutSeconds:L().positive().max(86400).nullable().optional(),proxyRequestBudgetSeconds:L().positive().max(86400).nullable().optional(),compactRequestBudgetSeconds:L().positive().max(86400).nullable().optional(),transcriptionRequestBudgetSeconds:L().positive().max(86400).nullable().optional(),streamIdleTimeoutSeconds:L().positive().max(86400).nullable().optional(),proxyDownstreamWebsocketIdleTimeoutSeconds:L().positive().max(86400).nullable().optional(),sseKeepaliveIntervalSeconds:L().min(0).max(86400).nullable().optional(),httpResponsesStreamRequestBudgetSeconds:L().positive().max(86400).nullable().optional(),httpResponsesSessionBridgeRequestBudgetSeconds:L().positive().max(86400).nullable().optional()}).superRefine((e,t)=>{e.proxyAccountStreamLimit!==void 0&&e.proxyAccountStreamLimit!==null&&e.proxyAccountStreamLimit>0&&e.proxyAccountStreamRecoveryReserve!==void 0&&e.proxyAccountStreamRecoveryReserve!==null&&e.proxyAccountStreamRecoveryReserve>e.proxyAccountStreamLimit&&t.addIssue({code:`custom`,path:[`proxyAccountStreamRecoveryReserve`],message:`proxyAccountStreamRecoveryReserve must not exceed proxyAccountStreamLimit`}),e.requestLogRetentionOverrideDays!==void 0&&e.requestLogRetentionOverrideDays!==null&&e.requestLogRetentionOverrideDays!==0&&e.requestLogRetentionOverrideDays<30&&t.addIssue({code:`custom`,path:[`requestLogRetentionOverrideDays`],message:`request_log_retention_override_days must be 0 (disabled) or >= 30`}),e.usageHistoryRetentionOverrideDays!==void 0&&e.usageHistoryRetentionOverrideDays!==null&&e.usageHistoryRetentionOverrideDays!==0&&e.usageHistoryRetentionOverrideDays<45&&t.addIssue({code:`custom`,path:[`usageHistoryRetentionOverrideDays`],message:`usage_history_retention_override_days must be 0 (disabled) or >= 45`})}),bm=I({id:z(),name:z(),scheme:R([`http`,`https`,`socks5`,`socks5h`]),host:z(),port:L().int(),username:z().nullable().optional(),isActive:F(),plaintextCredentials:F().optional().default(!1)}),xm=I({name:z().trim().min(1).max(128),scheme:R([`http`,`https`,`socks5`,`socks5h`]),host:z().trim().min(1).max(255),port:L().int().min(1).max(65535),username:z().trim().max(255).nullable().optional(),password:z().max(1024).nullable().optional(),isActive:F().optional().default(!0)}),Sm=I({endpointId:z(),ok:F(),statusCode:L().int().nullable().optional(),elapsedMs:L().int().nullable().optional(),error:z().nullable().optional()}),Cm=I({id:z(),name:z(),isActive:F(),endpointIds:P(z())}),wm=I({name:z().trim().min(1).max(128),endpointIds:P(z()).default([]),isActive:F().optional().default(!0)}),Tm=I({endpointId:z().min(1),sortOrder:L().int().optional().default(0),weight:L().int().min(1).optional().default(1),isActive:F().optional().default(!0)}),Em=I({accountId:z(),poolId:z(),isActive:F()}),Dm=I({poolId:z().min(1),isActive:F().optional().default(!0)}),Om=I({routingEnabled:F(),defaultPoolId:z().nullable(),endpoints:P(bm),pools:P(Cm),bindings:P(Em)}),km=I({slug:z().min(1),contextWindow:L().int().positive(),source:R([`dashboard`,`env`]),envValue:L().int().positive().nullable().optional().default(null)}),Am=I({overrides:P(km)}),jm=I({contextWindow:L().int().positive()}),Mm=R([`undecided`,`enabled`,`disabled`]),Nm=R([`env`,`persisted`,`default`]),Pm=Me({method:R([`docker`,`k8s`,`pip`,`bare`]),db_backend:R([`sqlite`,`postgres`]),db_size_bucket:R([`unknown`,`<100MB`,`100MB-1GB`,`1-5GB`,`5-10GB`,`10-50GB`,`50GB+`]),replicas:L().int().min(1),reverse_proxy:F()}),Fm=Me({plus:z(),pro:z(),team:z(),free:z()}),Im=Me({pool_bucket:z(),plan_mix:Fm,workspace_accounts:F(),routing_policy:z(),limit_warmup_enabled:F(),egress_proxy_used:F()}),Lm=Me({responses:L(),chat:L(),images:L(),unknown:L()}),Rm=Me({ws:L(),http_bridge:L()}),zm=Me({default:L(),flex:L(),priority:L()}),Bm=Me({name:z(),share:L(),reasoning:Pe(z(),L()),avg_output_tokens_bucket:z()}),Vm=Me({requests:L().int().min(0),success_rate:L().min(0).max(1),tokens_input:L().int().min(0),tokens_output:L().int().min(0),tokens_cached_ratio:L().min(0).max(1),cost_usd_bucket:z(),request_kinds:Lm,transport_mix:Rm,service_tier_mix:zm,clients:Pe(z(),L()),clients_other_ratio:L().min(0).max(1),models:P(Bm),latency_ms_p50:L().int().min(0),ttft_ms_p50:L().int().min(0),ttft_ms_p95:L().int().min(0),rate_limit_429_ratio:L().min(0).max(1),top_upstream_errors:P(z()).max(5)}),Hm=Me({api_firewall:F(),quota_planner:F(),sticky_sessions:F(),conversation_archive:F(),automations:F(),fleet:F(),model_sources_count:L().int().min(0),api_keys_bucket:z(),prometheus:F(),otel:F(),dashboard_auth:F(),reset_credits:F(),image_api_used:F()}),Um=Me({schema_version:Re(1),consent:R([`undecided`,`enabled`]),instance_id:z(),version:z(),python:z(),os:z(),arch:z(),uptime_hours:L().int().min(0),deploy:Pm,accounts:Im,usage_7d:Vm,features:Hm}),Wm=Me({instance_id:z(),metrics:Um,timestamp:k({offset:!0})}),Gm=I({state:Mm,source:Nm,active:F(),preview:Wm.nullable()}),Km=I({enabled:F()}),qm=`/api/settings`,Jm=`${qm}/upstream-proxy`,Ym=`${qm}/telemetry`,Xm=`${qm}/model-context-window-overrides`;function Zm(){return ze(qm,vm)}function Qm(e){let t=ym.parse(e);return Le(qm,vm,{body:t})}function $m(e={}){let t=e.includePreview?`${Ym}?include_preview=true`:Ym;return ze(t,Gm)}function eh(e){let t=Km.parse(e);return Le(Ym,Gm,{body:t})}function th(){return ze(Jm,Om)}function nh(e){let t=xm.parse(e);return Ne(`${Jm}/endpoints`,bm,{body:t})}function rh(e){return Ne(`${Jm}/endpoints/${encodeURIComponent(e)}/test`,Sm)}function ih(e){let t=wm.parse(e);return Ne(`${Jm}/pools`,Cm,{body:t})}function ah(e,t){let n=Tm.parse(t);return Ne(`${Jm}/pools/${encodeURIComponent(e)}/members`,Cm,{body:n})}function oh(e,t){let n=Dm.parse(t);return Le(`${Jm}/accounts/${encodeURIComponent(e)}/binding`,Em,{body:n})}function sh(){return ze(Xm,Am)}function ch(e,t){let n=jm.parse(t);return Le(`${Xm}/${encodeURIComponent(e)}`,Am,{body:n})}function lh(e){return Ie(`${Xm}/${encodeURIComponent(e)}`,Am)}var uh=`codex-lb-privacy`;function dh(){if(typeof window>`u`)return!1;try{return window.localStorage.getItem(uh)===`1`}catch{return!1}}function fh(e){if(typeof window<`u`)try{window.localStorage.setItem(uh,e?`1`:`0`)}catch{}}var ph=we((e,t)=>({blurred:dh(),toggle:()=>{let n=!t().blurred;fh(n),e({blurred:n})}}));function mh({onLogout:e,onAdminLogin:t,showAdminLogin:n=!1,showLogout:r=!0,className:i}){let{t:a}=j(),{pathname:o}=Zn(),[s,c]=(0,V.useState)(!1),l=B(e=>e.permissions),u=B(e=>e.tier),d=B(e=>e.user),f=B(e=>e.breakGlassSession),p=Nf.filter(e=>st(l,e.requires)),m=Pf.filter(e=>st(l,e.requires)),g=u!==`individual`&&d!==null,_=m.some(e=>o===e.to||o.startsWith(`${e.to}/`)),v=ph(e=>e.blurred),y=ph(e=>e.toggle),b=v?Wi:Ki,{data:x=[]}=h({queryKey:[`accounts`,`list`],queryFn:Rp,select:e=>e.accounts,refetchInterval:3e4,refetchIntervalInBackground:!1,staleTime:3e4}),{data:S}=h({queryKey:[`settings`,`detail`],queryFn:Zm}),C=S?.showResetCreditBadges??!0,w=x.reduce((e,t)=>e+Math.max(0,t.availableResetCredits??0),0),T=C?w>99?`99+`:w>0?String(w):null:null,E=a(v?`nav.showEmails`:`nav.hideEmails`);return(0,H.jsx)(`header`,{className:M(`sticky top-0 z-20 border-b border-white/[0.08] bg-background/50 px-4 py-2.5 shadow-[0_1px_12px_rgba(0,0,0,0.06)] backdrop-blur-xl backdrop-saturate-[1.8] supports-[backdrop-filter]:bg-background/40 dark:shadow-[0_1px_12px_rgba(0,0,0,0.25)]`,i),children:(0,H.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[1500px] items-center justify-between gap-4`,children:[(0,H.jsxs)(_i,{to:`/dashboard`,className:`flex min-w-0 flex-1 items-center gap-2.5 rounded-lg no-underline transition-colors hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,H.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded-lg bg-gradient-to-br from-primary/15 to-primary/5`,children:(0,H.jsx)(Da,{size:20,className:`text-primary`})}),(0,H.jsx)(`div`,{className:`min-w-0`,children:(0,H.jsx)(`p`,{className:`truncate text-sm font-semibold tracking-tight`,children:`Codex LB`})})]}),(0,H.jsxs)(`nav`,{className:`hidden items-center rounded-lg border border-border/50 bg-muted/40 p-0.5 sm:flex`,children:[p.map(e=>(0,H.jsx)(vi,{to:e.to,className:({isActive:e})=>M(`relative inline-flex h-7 items-center rounded-md px-3.5 text-xs leading-none font-medium transition-colors duration-200`,e?`bg-background text-foreground shadow-[var(--shadow-xs)]`:`text-muted-foreground hover:text-foreground`),children:(0,H.jsxs)(`span`,{className:`relative inline-flex items-center`,children:[a(e.labelKey),e.to===`/accounts`&&T?(0,H.jsx)(`span`,{className:`absolute -top-2 -right-4 z-10 grid h-4 min-w-[1rem] place-items-center rounded-full bg-primary px-1 text-[10px] font-medium text-primary-foreground`,children:T}):null]})},e.to)),(0,H.jsxs)(Gc,{children:[(0,H.jsxs)(Kc,{"data-active":_,className:M(`relative inline-flex h-7 items-center gap-1 rounded-md px-3.5 text-xs leading-none font-medium transition-colors duration-200`,_?`bg-background text-foreground shadow-[var(--shadow-xs)]`:`text-muted-foreground hover:text-foreground`),children:[a(`nav.advanced`),(0,H.jsx)(ee,{className:`h-3 w-3`,"aria-hidden":`true`})]}),(0,H.jsx)(qc,{align:`end`,children:m.map(e=>(0,H.jsx)(Jc,{asChild:!0,children:(0,H.jsx)(vi,{to:e.to,className:`cursor-pointer`,children:a(e.labelKey)})},e.to))})]})]}),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center justify-end gap-1.5`,children:[(0,H.jsx)(jf,{}),(0,H.jsx)(N,{type:`button`,size:`sm`,variant:`ghost`,onClick:y,"aria-label":E,className:`press-scale hidden h-8 w-8 rounded-lg text-muted-foreground hover:text-foreground sm:inline-flex`,children:(0,H.jsx)(b,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})}),f?(0,H.jsxs)(`span`,{"data-testid":`emergency-session-pill`,title:a(`nav.emergencySession.description`),className:`hidden shrink-0 items-center gap-1 rounded-full border border-amber-500/40 bg-amber-500/10 px-2 py-0.5 text-[11px] font-medium text-amber-700 sm:inline-flex dark:text-amber-400`,children:[(0,H.jsx)(ga,{className:`h-3 w-3`,"aria-hidden":`true`}),a(`nav.emergencySession.label`)]}):null,g?(0,H.jsx)(kf,{}):null,r&&!g&&(0,H.jsxs)(N,{type:`button`,size:`sm`,variant:`ghost`,onClick:e,className:`press-scale hidden h-8 gap-1.5 rounded-lg text-xs text-muted-foreground hover:text-foreground sm:inline-flex`,children:[(0,H.jsx)(ca,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),a(`common.logout`)]}),n&&(0,H.jsxs)(N,{type:`button`,size:`sm`,variant:`outline`,onClick:t,className:`press-scale hidden h-8 gap-1.5 rounded-lg text-xs sm:inline-flex`,children:[(0,H.jsx)(oa,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),a(`nav.adminSignIn`)]}),(0,H.jsxs)(If,{open:s,onOpenChange:c,children:[(0,H.jsx)(Lf,{asChild:!0,children:(0,H.jsx)(N,{type:`button`,size:`icon`,variant:`ghost`,"aria-label":a(`nav.openMenu`),className:`h-8 w-8 rounded-lg sm:hidden`,children:(0,H.jsx)(ua,{className:`h-4 w-4`})})}),(0,H.jsxs)(Bf,{side:`right`,className:`w-72`,children:[(0,H.jsx)(Vf,{children:(0,H.jsxs)(Hf,{className:`flex items-center gap-2.5`,children:[(0,H.jsx)(`div`,{className:`flex h-7 w-7 items-center justify-center rounded-lg bg-primary/10`,children:(0,H.jsx)(Da,{size:16,className:`text-primary`})}),(0,H.jsx)(`span`,{className:`text-sm font-semibold`,children:`Codex LB`})]})}),(0,H.jsxs)(`nav`,{className:`flex flex-col gap-0.5 px-4 pt-2`,children:[f?(0,H.jsxs)(`span`,{"data-testid":`emergency-session-pill-mobile`,className:`mb-2 flex items-center gap-1.5 rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-xs font-medium text-amber-700 dark:text-amber-400`,children:[(0,H.jsx)(ga,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),a(`nav.emergencySession.label`)]}):null,p.map(e=>(0,H.jsx)(vi,{to:e.to,onClick:()=>c(!1),children:({isActive:t})=>(0,H.jsxs)(`span`,{className:M(`relative block w-full rounded-lg px-3 py-2 text-left text-sm font-medium transition-colors`,t?`bg-primary/10 text-primary`:`text-muted-foreground hover:bg-muted hover:text-foreground`),children:[a(e.labelKey),e.to===`/accounts`&&T?(0,H.jsx)(`span`,{className:`absolute right-2 top-1 z-10 grid h-5 min-w-[1.25rem] place-items-center rounded-full bg-primary px-1 text-[10px] font-medium text-primary-foreground`,children:T}):null]})},e.to)),(0,H.jsx)(`div`,{className:`my-2 h-px bg-border`}),(0,H.jsx)(`p`,{className:`px-3 pb-1 text-[11px] font-medium tracking-wider text-muted-foreground uppercase`,children:a(`nav.advanced`)}),m.map(e=>(0,H.jsx)(vi,{to:e.to,onClick:()=>c(!1),children:({isActive:t})=>(0,H.jsx)(`span`,{className:M(`relative block w-full rounded-lg px-3 py-2 text-left text-sm font-medium transition-colors`,t?`bg-primary/10 text-primary`:`text-muted-foreground hover:bg-muted hover:text-foreground`),children:a(e.labelKey)})},e.to)),(0,H.jsx)(`div`,{className:`my-2 h-px bg-border`}),(0,H.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-left text-sm font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,onClick:y,children:[(0,H.jsx)(b,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),E]}),(0,H.jsx)(`div`,{className:`my-2 h-px bg-border`}),(0,H.jsx)(Mf,{}),r&&(0,H.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-left text-sm font-medium text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive`,onClick:()=>{c(!1),e()},children:[(0,H.jsx)(ca,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),a(`common.logout`)]}),n&&(0,H.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-left text-sm font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,onClick:()=>{c(!1),t?.()},children:[(0,H.jsx)(oa,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),a(`nav.adminSignIn`)]})]})]})]})]})]})})}var hh={sm:`h-4 w-4`,md:`h-5 w-5`};function gh({size:e=`md`,className:t}){return(0,H.jsx)(na,{"aria-hidden":`true`,className:M(hh[e],`animate-spin text-primary`,t)})}function _h({label:e,className:t}){let{t:n}=j(),r=e??n(`common.loading`);return(0,H.jsxs)(`output`,{className:M(`flex flex-col items-center gap-3`,t),children:[(0,H.jsx)(gh,{}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r})]})}function vh(e){try{return decodeURI(e)}catch{return e}}function yh({actions:e,description:t,icon:n,role:r,testId:i,title:a}){let o=(0,V.useRef)(null);return(0,V.useEffect)(()=>{o.current?.focus()},[]),(0,H.jsxs)(`section`,{className:`flex flex-1 flex-col items-center justify-center gap-6 py-12 text-center`,"data-testid":i,role:r,children:[(0,H.jsx)(`div`,{className:`flex h-14 w-14 items-center justify-center rounded-2xl border bg-card text-primary shadow-sm`,children:n}),(0,H.jsxs)(`div`,{className:`max-w-md space-y-2`,children:[(0,H.jsx)(`h1`,{ref:o,className:`rounded-md px-1 text-2xl font-semibold tracking-tight outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,"data-testid":`route-recovery-heading`,tabIndex:-1,children:a}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t})]}),(0,H.jsx)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:e})]})}function bh(){let{t:e}=j();return(0,H.jsx)(yh,{actions:(0,H.jsx)(N,{asChild:!0,className:`press-scale`,children:(0,H.jsxs)(_i,{"data-testid":`route-dashboard-link`,to:`/dashboard`,children:[(0,H.jsx)(Ai,{"aria-hidden":`true`}),e(`routeRecovery.goToDashboard`)]})}),description:e(`routeRecovery.notFoundDescription`),icon:(0,H.jsx)(Ji,{"aria-hidden":`true`,className:`h-6 w-6`}),role:`status`,testId:`route-not-found`,title:e(`routeRecovery.notFoundTitle`)})}function xh({onRetry:e}={}){let{t}=j(),{pathname:n}=Zn(),r=vh(n).replace(/\/+$/,``).toLowerCase()===`/dashboard`,i=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Ai,{"aria-hidden":`true`}),t(`routeRecovery.goToDashboard`)]});return(0,H.jsx)(yh,{actions:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(N,{className:`press-scale`,"data-testid":`route-retry`,onClick:e??(()=>window.location.reload()),type:`button`,children:[(0,H.jsx)(ma,{"aria-hidden":`true`}),t(`routeRecovery.reload`)]}),(0,H.jsx)(N,{asChild:!0,className:`press-scale`,variant:`outline`,children:r?(0,H.jsx)(`a`,{"data-testid":`route-dashboard-link`,href:`/dashboard`,children:i}):(0,H.jsx)(_i,{"data-testid":`route-dashboard-link`,to:`/dashboard`,children:i})})]}),description:t(`routeRecovery.loadErrorDescription`),icon:(0,H.jsx)(Sa,{"aria-hidden":`true`,className:`h-6 w-6`}),role:`alert`,testId:`route-load-error`,title:t(`routeRecovery.loadErrorTitle`)})}function Sh(){return(0,H.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-12`,"data-testid":`route-loading`,children:(0,H.jsx)(_h,{})})}var Ch=class extends V.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidUpdate(e,t){t.failed&&this.state.failed&&e.resetKey!==this.props.resetKey&&this.setState({failed:!1})}render(){return this.state.failed?(0,H.jsx)(xh,{}):this.props.children}};function wh(){let{hash:e,pathname:t}=Zn(),n=Qn(),r=(0,V.useRef)(t),i=t===`/firewall`||t===`/firewall/`;return(0,V.useLayoutEffect)(()=>{let a=r.current!==t;r.current=t,a&&n!==Dt.Pop&&!e&&!i&&window.scrollTo({top:0,left:0,behavior:`auto`})},[e,n,t,i]),null}var Th=R([`1d`,`7d`,`30d`]);function Eh(e){let t=Th.safeParse(e);return t.success?t.data:`7d`}var Dh=R([`1d`,`7d`,`30d`]);function Oh(e){let t=Dh.safeParse(e);return t.success?t.data:`7d`}var kh=I({accountId:z(),remainingPercentAvg:L().nullable(),capacityCredits:L(),remainingCredits:L()}),Ah=I({windowKey:z(),windowMinutes:L().nullable(),accounts:P(kh)}),jh=I({remainingPercent:L(),capacityCredits:L(),remainingCredits:L(),resetAt:k({offset:!0}).nullable(),windowMinutes:L().nullable()}),Mh=I({key:Th,windowMinutes:L().int().positive(),bucketSeconds:L().int().positive(),bucketCount:L().int().positive()}),Nh=I({currency:z(),totalUsd:L()}),Ph=I({requests:L().nullable(),tokens:L().nullable(),cachedInputTokens:L().nullable(),errorRate:L().nullable(),errorCount:L().nullable(),cancelledCount:L().int().nonnegative().nullable().optional(),topError:z().nullable(),conversations:L().int().nullable().optional().default(null),conversationRequests:L().int().nonnegative().optional().default(0)}),Fh=I({requests:L(),tokens:L(),costUsd:L()}),Ih=I({canCompare:F(),previous:Fh}),Lh=I({t:k({offset:!0}),v:L()}),Rh=I({requests:P(Lh),tokens:P(Lh),cost:P(Lh),errorRate:P(Lh),conversations:P(Lh).optional().default([])}),zh=I({risk:L(),riskLevel:R([`safe`,`warning`,`danger`,`critical`]),burnRate:L(),safeUsagePercent:L(),projectedExhaustionAt:k({offset:!0}).nullable().optional(),secondsUntilExhaustion:L().nullable().optional()}),Bh=I({at:k({offset:!0}),creditsReturned:L()}),Vh=I({apiKeyId:z().nullable().optional(),name:z(),requests:L().int().nonnegative(),billableTokens:L().int().nonnegative(),cachedTokens:L().int().nonnegative(),dominantModel:z()}),Hh=R([`behind`,`on_track`,`ahead`,`danger`]),Uh=R([`safe`,`tight`,`runs_dry`]),Wh=I({totalFullCredits:L(),totalActualRemainingCredits:L(),totalExpectedRemainingCredits:L(),actualUsedPercent:L(),scheduledUsedPercent:L(),deltaPercent:L(),scheduleGapCredits:L(),smoothedDeltaPercent:L().optional(),smoothedScheduleGapCredits:L().optional(),paceGapSmoothingMinutes:L().int().positive().optional(),overPlanCredits:L(),projectedShortfallCredits:L(),pauseForBreakEvenHours:L().nullable(),paceMultiplier:L().nullable(),throttleToPercent:L().nullable(),reduceByPercent:L().nullable(),proAccountEquivalentToCoverOverPlan:L().nullable(),proAccountsToCoverOverPlan:L().int().nullable(),projectedDepletionHours:L().nullable(),projectedMinimumRemainingCredits:L().nullable(),forecastBurnRateCreditsPerHour:L().nullable(),scheduledBurnRateCreditsPerHour:L(),headroomPercent:L().optional(),headroomCredits:L().optional(),burnRateRecentCreditsPerHour:L().nullable().optional(),depletionEtaHours:L().nullable().optional(),nextReliefInHours:L().nullable().optional(),nextReliefCredits:L().nullable().optional(),resetEvents:P(Bh).optional(),runwayStatus:Uh.optional(),saturatedAccountCount:L().int().nonnegative().optional(),topApiKeys:P(Vh).optional(),addProAccounts:L().int().nullable().optional(),status:Hh,accountCount:L().int().nonnegative(),staleAccountCount:L().int().nonnegative(),inactiveAccountCount:L().int().nonnegative(),confidence:R([`high`,`medium`,`low`])}),Gh=I({lastSyncAt:k({offset:!0}).nullable(),timeframe:Mh,accounts:P(ep),summary:I({primaryWindow:jh,secondaryWindow:jh.nullable(),cost:Nh,metrics:Ph.nullable(),comparison:Ih.optional()}),windows:I({primary:Ah,secondary:Ah.nullable()}),trends:Rh,additionalQuotas:P($f).default([]),depletionPrimary:zh.nullable().optional(),depletionSecondary:zh.nullable().optional(),weeklyCreditPace:Wh.nullable().optional()}),Kh=I({depletionPrimary:zh.nullable().optional(),depletionSecondary:zh.nullable().optional(),weeklyCreditPace:Wh.nullable().optional()}),qh=I({inputUsd:L().nullable().optional().default(null),cachedInputUsd:L().nullable().optional().default(null),outputUsd:L().nullable().optional().default(null),totalUsd:L().nullable().optional().default(null)}),Jh=I({requestedAt:k({offset:!0}),accountId:z().nullable(),planType:z().nullable().optional().default(null),apiKeyName:z().nullable().optional().default(null),apiKeyId:z().nullable().optional().default(null),requestId:z(),archiveRequestId:z().nullable().optional(),requestKind:R([`normal`,`warmup`,`limit_warmup`,`prewarm`,`compaction`,`realtime_live`]).optional().default(`normal`),connectionRequestKind:R([`normal`,`prewarm`]).nullable().optional(),model:z(),source:z().nullable().optional().default(null),modelSourceId:z().nullable().optional(),modelSourceKind:z().nullable().optional(),transport:z().nullable().optional().default(null),upstreamTransport:z().nullable().optional(),upstreamProxyRouteMode:z().nullable().optional(),upstreamProxyPoolId:z().nullable().optional(),upstreamProxyEndpointId:z().nullable().optional(),upstreamProxyFallbackUsed:F().nullable().optional(),upstreamProxyFailClosedReason:z().nullable().optional(),useragent:z().nullable().optional().default(null),useragentGroup:z().nullable().optional().default(null),clientIp:z().nullable().optional().default(null),conversationId:z().nullable().optional().default(null),serviceTier:z().nullable().optional().default(null),requestedServiceTier:z().nullable().optional().default(null),actualServiceTier:z().nullable().optional().default(null),status:z(),errorCode:z().nullable(),errorMessage:z().nullable(),failurePhase:z().nullable().optional().default(null),failureDetail:z().nullable().optional().default(null),failureExceptionType:z().nullable().optional().default(null),upstreamStatusCode:L().int().nullable().optional().default(null),upstreamErrorCode:z().nullable().optional().default(null),bridgeStage:z().nullable().optional().default(null),tokens:L().nullable(),inputTokens:L().nullable().optional().default(null),outputTokens:L().nullable().optional().default(null),outputTokensRaw:L().nullable().optional().default(null),reasoningTokens:L().nullable().optional(),cachedInputTokens:L().nullable(),reasoningEffort:z().nullable(),costUsd:L().nullable(),costBreakdown:qh.nullable().optional().default(null),latencyMs:L().nullable(),latencyFirstTokenMs:L().nullable().optional().default(null),latencyQueueMs:L().nullable().optional().default(null)}),Yh=I({requests:P(Jh),total:L().int().nonnegative(),hasMore:F(),conversation:I({requestCount:L().int().nonnegative(),aggregatedCostUsd:L()}).nullable().optional().default(null)}),Xh=I({model:z(),reasoningEffort:z().nullable()}),Zh=I({id:z(),name:z(),keyPrefix:z().nullable().optional().default(null)}),Qh=I({accountIds:P(z()),modelOptions:P(Xh),apiKeys:P(Zh),statuses:P(z())}),$h=R([`all`,`1h`,`24h`,`7d`]),eg=I({search:z(),timeframe:$h,accountIds:P(z()),apiKeyIds:P(z()),modelOptions:P(z()),statuses:P(z()),conversationId:z().nullable().optional().default(null),limit:L().int().positive(),offset:L().int().nonnegative()}),tg=R([`request-logs`,`conversations`]),ng=`request-logs`;function rg(e){let t=tg.safeParse(e);return t.success?t.data:ng}var ig=I({model:z(),reasoningEffort:z().nullable().optional().default(null)}),ag=I({modelEffort:ig,reqs:L().int().nonnegative(),totalElapsedTime:L().int().nonnegative(),totalInputTokens:L().int().nonnegative(),cachedInputTokens:L().int().nonnegative().nullable(),totalOutputTokens:L().int().nonnegative(),totalCostUsd:L()}),og=I({conversationId:z(),firstRequest:k({offset:!0}),lastRequest:k({offset:!0}),requestCount:L().int().nonnegative(),representativeAccount:z().nullable().optional().default(null),remainingAccountCount:L().int().nonnegative(),apiKeyId:z().nullable().optional().default(null),apiKeyName:z().nullable().optional().default(null),representativeModel:z().nullable().optional().default(null),remainingModelCount:L().int().nonnegative(),totalTokens:L().int().nonnegative(),cachedInputTokens:L().int().nonnegative().nullable(),totalCostUsd:L()}),sg=I({conversations:P(og),total:L().int().nonnegative(),hasMore:F()}),cg=I({conversationId:z(),start:k({offset:!0}),latest:k({offset:!0}),accountCount:L().int().nonnegative(),totalElapsedTime:L().int().nonnegative(),dominantUseragentGroup:z().nullable().optional().default(null),modelStats:P(ag).default([])}),lg=I({search:z(),limit:L().int().positive(),offset:L().int().nonnegative(),timeframe:Dh}),ug=`/api/dashboard`,dg=`/api/request-logs`,fg=`/api/conversations`;function pg(e,t,n){if(n&&n.length!==0)for(let r of n)r&&e.append(t,r)}function mg(e={}){let t=new URLSearchParams;return t.set(`timeframe`,e.timeframe??`7d`),ze(`${ug}/overview?${t.toString()}`,Gh)}function hg(){return ze(`${ug}/projections`,Kh)}function gg(e={}){let t=new URLSearchParams;typeof e.limit==`number`&&t.set(`limit`,String(e.limit)),typeof e.offset==`number`&&t.set(`offset`,String(e.offset)),e.search&&t.set(`search`,e.search),pg(t,`accountId`,e.accountIds),pg(t,`apiKeyId`,e.apiKeyIds),pg(t,`status`,e.statuses),pg(t,`modelOption`,e.modelOptions),e.conversationId&&t.set(`conversation_id`,e.conversationId),e.timeframe&&t.set(`timeframe`,e.timeframe),e.since&&t.set(`since`,e.since),e.until&&t.set(`until`,e.until);let n=t.size>0?`?${t.toString()}`:``;return ze(`${dg}${n}`,Yh)}function _g(e={}){let t=new URLSearchParams;e.timeframe&&t.set(`timeframe`,e.timeframe),e.since&&t.set(`since`,e.since),e.until&&t.set(`until`,e.until),pg(t,`accountId`,e.accountIds),pg(t,`apiKeyId`,e.apiKeyIds),pg(t,`modelOption`,e.modelOptions);let n=t.size>0?`?${t.toString()}`:``;return ze(`${dg}/options${n}`,Qh)}function vg(e={}){let t=new URLSearchParams;typeof e.limit==`number`&&t.set(`limit`,String(e.limit)),typeof e.offset==`number`&&t.set(`offset`,String(e.offset)),e.search&&t.set(`search`,e.search),e.timeframe&&t.set(`timeframe`,e.timeframe),e.since&&t.set(`since`,e.since);let n=t.size>0?`?${t.toString()}`:``;return ze(`${fg}${n}`,sg)}function yg(e){let t=e===`.`||e===`..`?` ${e}`:e;return ze(`${fg}/${encodeURIComponent(t)}`,cg)}var bg=I({status:z()}),xg=`/health/ready`;function Sg(){return ze(xg,bg)}var Cg=I({currentVersion:z(),latestVersion:z().nullable().optional(),updateAvailable:F(),checkedAt:z(),source:z().nullable().optional(),releaseUrl:He()}),wg=`/api/runtime/version`;function Tg(){return ze(wg,Cg)}var Eg=`codex-lb-date-display-format`;function Dg(){if(typeof window>`u`)return`default`;try{return window.localStorage.getItem(`codex-lb-date-display-format`)===`iso8601`?`iso8601`:`default`}catch{return`default`}}function Og(e){if(typeof window<`u`)try{window.localStorage.setItem(Eg,e)}catch{}}function kg(){return Ag.getState().dateDisplayFormat}var Ag=we(e=>({dateDisplayFormat:Dg(),setDateDisplayFormat:t=>{Og(t),e({dateDisplayFormat:t})}})),jg=[`#3b82f6`,`#8b5cf6`,`#10b981`,`#f59e0b`,`#ec4899`,`#06b6d4`],Mg=[`#2563eb`,`#7c3aed`,`#059669`,`#d97706`,`#db2777`,`#0891b2`],Ng={ok:`OK`,cancelled:`Cancelled`,rate_limit:`Rate limit`,quota:`Quota`,error:`Error`},Pg=`codex-lb-time-format`;function Fg(){if(typeof window>`u`)return`12h`;try{return window.localStorage.getItem(Pg)===`24h`?`24h`:`12h`}catch{return`12h`}}function Ig(e){if(typeof window<`u`)try{window.localStorage.setItem(Pg,e)}catch{}}function Lg(){return Rg.getState().timeFormat}var Rg=we(e=>({timeFormat:Fg(),setTimeFormat:t=>{Ig(t),e({timeFormat:t})}}));function $(e,t){return Te.t(e,t)}function zg(){let e=(Te.resolvedLanguage??Te.language??`en`).toLowerCase();return e.startsWith(`ko`)?`ko-KR`:e.startsWith(`zh`)?`zh-CN`:`en-US`}var Bg=new Map,Vg=new Intl.NumberFormat(`en-US`,{notation:`compact`,maximumFractionDigits:2}),Hg=new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`,minimumFractionDigits:2,maximumFractionDigits:2}),Ug=new Map,Wg=new Map,Gg=new Map;function Kg(e,t,n){let r=e.get(t);if(r)return r;let i=n();return e.set(t,i),i}function qg(){let e=zg();return Kg(Bg,e,()=>new Intl.NumberFormat(e))}function Jg(){let e=zg();return Kg(Ug,e,()=>new Intl.DateTimeFormat(e,{year:`numeric`,month:`2-digit`,day:`2-digit`}))}function Yg(e,t){return new Intl.DateTimeFormat(e,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:t===`12h`?`h12`:`h23`})}function Xg(e,t){return new Intl.DateTimeFormat(e,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hourCycle:t===`12h`?`h12`:`h23`})}function Zg(){let e=zg(),t=Lg();return Kg(Wg,`${e}:${t}`,()=>Yg(e,t))}function Qg(){let e=zg(),t=Lg();return Kg(Gg,`${e}:${t}`,()=>Xg(e,t))}function $g(e){if(!e)return``;let t=e.split(`_`);return t[0]=t[0].charAt(0).toUpperCase()+t[0].slice(1),t.join(` `)}function e_(e){if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e==`string`&&e.trim().length>0){let t=Number(e);return Number.isFinite(t)?t:null}return null}function t_(e){if(!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t}function n_(e){let t=e_(e);return t===null?`--`:qg().format(t)}function r_(e){let t=e_(e);return t===null?`--`:Vg.format(t)}function i_(e){let t=e_(e);return t===null?`--`:Hg.format(t)}function a_(e,t=0){let n=e_(e);return n===null?`--`:t<=0?`${Math.round(n)}%`:`${n.toLocaleString(`en-US`,{maximumFractionDigits:t})}%`}function o_(e){let t=e_(e);return t===null?`--`:`${(t*100).toFixed(1)}%`}function s_(e){let t=e_(e);return t===null||t<=0?`--`:t%1440==0?`${t/1440}d`:t%60==0?`${t/60}h`:`${t}m`}function c_(e,t){let n=s_(t);return n===`--`?e===`secondary`?`7d`:e===`primary`?`5h`:`--`:n}function l_(e,t){let n=e_(e),r=e_(t);if(n===null||n<=0||r===null||r<=0)return $(`formatters.cachedTokensMetaEmpty`);let i=Math.min(100,Math.max(0,r/n*100));return $(`formatters.cachedTokensMeta`,{cached:r_(r),percent:Math.round(i)})}function u_(e,t,n){let r=(e||``).trim();if(!r)return`--`;let i=[(t||``).trim(),(n||``).trim()].filter(Boolean).join(`, `);return i?`${r} (${i})`:r}function d_(e,t=kg()){let n=t_(e);return n?t===`iso8601`?{time:g_(n),date:h_(n)}:{time:Zg().format(n),date:Jg().format(n)}:{time:`--`,date:`--`}}function f_(e,t){let n=t_(e),r=t_(t);if(!n||!r)return`—`;let i=Math.max(0,Math.floor((r.getTime()-n.getTime())/1e3));return i===0?$(`formatters.duration.seconds`,{count:0}):i<60?$(`formatters.duration.seconds`,{count:i}):i<3600?$(`formatters.duration.minutesSeconds`,{minutes:Math.floor(i/60),seconds:i%60}):i<86400?$(`formatters.duration.hoursMinutes`,{hours:Math.floor(i/3600),minutes:Math.floor(i%3600/60)}):$(`formatters.duration.daysHours`,{days:Math.floor(i/86400),hours:Math.floor(i%86400/3600)})}function p_(e,t=kg()){let n=m_(e,t);return n.primary===`--`?`--`:`${n.primary} ${n.secondary}`}function m_(e,t=kg()){let n=d_(e,t);return t===`iso8601`?{primary:n.date,secondary:n.time}:{primary:n.time,secondary:n.date}}function h_(e){return`${e.getFullYear()}-${__(e.getMonth()+1)}-${__(e.getDate())}`}function g_(e){return`${__(e.getHours())}:${__(e.getMinutes())}:${__(e.getSeconds())}`}function __(e){return String(e).padStart(2,`0`)}function v_(e){let t=t_(e);return t?Qg().format(t):`--`}function y_(e){return e==null?`—`:e<1e3?`${e} ms`:`${(e/1e3).toFixed(1)} s`}function b_(e){let t=Math.ceil(e/6e4);if(t<60)return $(`formatters.relative.minutes`,{count:t});let n=Math.ceil(t/60);return n<24?$(`formatters.relative.hours`,{count:n}):$(`formatters.relative.days`,{count:Math.ceil(n/24)})}function x_(e){let t=new Date(e).getTime()-Date.now();return t>0?b_(t):null}function S_(e){if(e<=6e4)return $(`formatters.relative.minutes`,{count:1});let t=Math.floor(e/6e4);if(t<60)return $(`formatters.relative.minutes`,{count:t});if(t<1440){let e=Math.floor(t/60),n=t%60;return n>0?$(`formatters.relative.hoursMinutes`,{hours:e,minutes:n}):$(`formatters.relative.hours`,{count:e})}let n=Math.floor(e/36e5),r=Math.floor(n/24),i=n%24;return i>0?$(`formatters.relative.daysHours`,{days:r,hours:i}):$(`formatters.relative.days`,{count:r})}function C_(e){let t=Math.max(0,Math.floor(e||0)),n=Math.floor(t/60),r=t%60;return`${n}:${String(r).padStart(2,`0`)}`}function w_(e){let t=t_(e);if(!t||t.getTime()<=0)return`--`;let n=t.getTime()-Date.now();return n<=0?$(`formatters.now`):S_(n)}var T_=864e5,E_=36e5,D_=6e4,O_=7*T_;function k_(e){let t=new Date(e).getTime()-Date.now();if(t<=0)return{label:$(`formatters.now`),expiringSoon:!0};let n=Math.floor(t/T_),r=Math.floor(t/E_),i=Math.floor(t/D_);return{label:n>=1?`${n}d`:r>=1?`${r}h`:i>=1?`${i}m`:$(`formatters.now`),expiringSoon:t<O_}}function A_(e){let t=e?.access?.expiresAt;if(!t)return $(`formatters.token.missing`);let n=t_(t);if(!n)return $(`formatters.token.unknown`);let r=n.getTime()-Date.now();return r<=0?$(`formatters.token.expired`):$(`formatters.token.valid`,{relative:b_(r)})}function j_(e){let t=e?.refresh?.state,n={stored:$(`formatters.token.stored`),missing:$(`formatters.token.missing`),expired:$(`formatters.token.expired`)};return t&&n[t]?n[t]:$(`formatters.token.unknown`)}function M_(e){let t=e?.idToken?.state,n={parsed:$(`formatters.token.parsed`),unknown:$(`formatters.token.unknown`)};return t&&n[t]?n[t]:$(`formatters.token.unknown`)}var N_=`https://github.com/soju06/codex-lb`,P_=6e4,F_=6e4,I_={usage_weighted:`settings.routing.strategy.usageWeighted`,round_robin:`settings.routing.strategy.roundRobin`,capacity_weighted:`settings.routing.strategy.capacityWeighted`,relative_availability:`settings.routing.strategy.relativeAvailability`,fill_first:`settings.routing.strategy.fillFirst`,single_account:`settings.routing.strategy.singleAccount`,sequential_drain:`settings.routing.strategy.sequentialDrain`,reset_drain:`settings.routing.strategy.resetDrain`},L_=new Set([`usage_weighted`,`capacity_weighted`,`fill_first`]);function R_(e,t,n,r,i){let a=e(I_[t]),o=e(`statusBar.routingLabels.stickyThreads`),s=e(`statusBar.routingLabels.sticky`),c=L_.has(t),l=r&&c;if(t===`single_account`)return a;let u=e(i===`secondary`?`statusBar.routingLabels.earlyWeeklyReset`:`statusBar.routingLabels.earlyFiveHourReset`);return n&&l?e(`statusBar.routingLabels.withStickyAndEarlyReset`,{strategy:a,sticky:s,reset:u}):n?e(`statusBar.routingLabels.withSticky`,{strategy:a,sticky:o}):l?e(`statusBar.routingLabels.withEarlyReset`,{strategy:a,reset:u}):a}function z_({onHeightChange:e}={}){let{t}=j(),n=(0,V.useRef)(null),r=h({queryKey:[`health`,`ready`],queryFn:Sg,refetchInterval:P_,refetchIntervalInBackground:!1,retry:!1}),{data:i=null}=h({queryKey:[`dashboard`,`overview`,`7d`],queryFn:()=>mg({timeframe:`7d`}),refetchInterval:P_,refetchIntervalInBackground:!1,select:e=>e.lastSyncAt}),{data:a}=h({queryKey:[`settings`,`detail`],queryFn:Zm}),{data:o}=h({queryKey:[`runtime`,`version`],queryFn:Tg,retry:!1,staleTime:216e5}),s=d_(i,Ag(e=>e.dateDisplayFormat)),[c,l]=(0,V.useState)(!1);(0,V.useEffect)(()=>{function e(){l(i?Date.now()-new Date(i).getTime()<F_:!1)}e();let t=setInterval(e,1e4);return()=>clearInterval(t)},[i]);let u=r.isPending?`checking`:!r.isError&&r.data?.status===`ok`?`ready`:`notReady`,d=t(`statusBar.${u}`),f=t(c?`statusBar.synced`:`statusBar.stale`),p=a?R_(t,a.routingStrategy,a.stickyThreadsEnabled,a.preferEarlierResetAccounts,a.preferEarlierResetWindow):`—`,m=o?.currentVersion??`1.25.0-beta.10`,g=o?.latestVersion??null,_=o?.updateAvailable===!0&&g,v=g?t(`statusBar.updateAvailableWithVersion`,{version:g}):t(`statusBar.updateAvailable`);return(0,V.useLayoutEffect)(()=>{let t=n.current;if(!t||!e)return;let r=()=>{e(Math.max(40,t.offsetHeight))};r();let i=new ResizeObserver(r);return i.observe(t),()=>i.disconnect()},[e]),(0,H.jsx)(`footer`,{ref:n,className:`fixed bottom-0 left-0 right-0 z-50 border-t border-white/[0.08] bg-background/50 px-4 py-2 shadow-[0_-1px_12px_rgba(0,0,0,0.06)] backdrop-blur-xl backdrop-saturate-[1.8] supports-[backdrop-filter]:bg-background/40 dark:shadow-[0_-1px_12px_rgba(0,0,0,0.25)]`,children:(0,H.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[1500px] items-center gap-4 text-xs text-muted-foreground`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-5 gap-y-1`,children:[(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`h-1.5 w-1.5 rounded-full ${u===`ready`?`bg-emerald-500`:u===`checking`?`bg-amber-500`:`bg-red-500`}`}),(0,H.jsx)(`span`,{className:`font-medium`,children:t(`statusBar.serviceReady`)}),` `,(0,H.jsx)(`span`,{children:d})]}),(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`h-1.5 w-1.5 rounded-full ${c?`bg-emerald-500`:`bg-amber-500`}`}),(0,H.jsx)(`span`,{className:`font-medium`,children:t(`statusBar.usageSynced`)}),` `,(0,H.jsx)(`span`,{children:f}),` · `,s.time]}),(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,H.jsx)(Mi,{className:`h-3 w-3`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`font-medium`,children:t(`statusBar.routing`)}),` `,p]}),(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,H.jsx)(ba,{className:`h-3 w-3`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`font-medium`,children:t(`statusBar.version`)}),` `,m,_?(0,H.jsx)(`a`,{"aria-label":v,className:`inline-flex h-4 w-4 items-center justify-center rounded-full text-amber-500 transition-colors hover:text-amber-400 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-amber-500/60 focus-visible:ring-offset-2`,href:o.releaseUrl,rel:`noreferrer`,target:`_blank`,title:v,children:(0,H.jsx)(Ri,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})}):null]})]}),(0,H.jsx)(`a`,{"aria-label":t(`statusBar.repositoryLabel`),className:`ml-auto inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full border border-border/70 bg-background/70 text-muted-foreground transition-colors hover:bg-muted/70 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,href:N_,rel:`noreferrer`,target:`_blank`,title:`GitHub`,children:(0,H.jsx)(`svg`,{className:`h-3.5 w-3.5`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,children:(0,H.jsx)(`path`,{d:`M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82A7.63 7.63 0 0 1 8 3.86c.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8Z`})})})]})})}var B_=`codex-lb-theme`;function V_(e){typeof document<`u`&&document.documentElement.classList.toggle(`dark`,e===`dark`)}function H_(){return typeof window<`u`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}function U_(e){return e===`auto`?H_():e}function W_(){if(typeof window>`u`)return null;let e=window.localStorage.getItem(B_);return e===`light`||e===`dark`||e===`auto`?e:null}var G_=null,K_=null;function q_(){J_(),typeof window<`u`&&(G_=window.matchMedia(`(prefers-color-scheme: dark)`),K_=()=>{if(Y_.getState().preference===`auto`){let e=H_();V_(e),Y_.setState({theme:e})}},G_.addEventListener(`change`,K_))}function J_(){G_&&K_&&G_.removeEventListener(`change`,K_),G_=null,K_=null}var Y_=we(e=>({preference:`auto`,theme:`light`,initialized:!1,initializeTheme:()=>{let t=W_()??`auto`,n=U_(t);V_(n),typeof window<`u`&&window.localStorage.setItem(B_,t),e({preference:t,theme:n,initialized:!0}),t===`auto`&&q_()},setTheme:t=>{let n=U_(t);V_(n),typeof window<`u`&&window.localStorage.setItem(B_,t),e({preference:t,theme:n,initialized:!0}),t===`auto`?q_():J_()}})),X_=({...e})=>{let t=Y_(e=>e.theme);return(0,H.jsx)(Gd,{theme:t,className:`toaster group`,icons:{success:(0,H.jsx)(Bi,{className:`size-4`}),info:(0,H.jsx)(Xi,{className:`size-4`}),warning:(0,H.jsx)(Sa,{className:`size-4`}),error:(0,H.jsx)(fa,{className:`size-4`}),loading:(0,H.jsx)(na,{className:`size-4 animate-spin`})},style:{"--normal-bg":`var(--popover)`,"--normal-text":`var(--popover-foreground)`,"--normal-border":`var(--border)`,"--border-radius":`0.75rem`},...e})};function Z_({delayDuration:e=0,...t}){return(0,H.jsx)(xc,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function Q_({...e}){return(0,H.jsx)(Tc,{"data-slot":`tooltip`,...e})}function $_({...e}){return(0,H.jsx)(Dc,{"data-slot":`tooltip-trigger`,...e})}function ev({className:e,sideOffset:t=0,children:n,...r}){return(0,H.jsx)(jc,{children:(0,H.jsxs)(Nc,{"data-slot":`tooltip-content`,sideOffset:t,className:M(`bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance`,e),...r,children:[n,(0,H.jsx)(Lc,{className:`bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]`})]})})}function tv({title:e,subtitle:t,className:n,children:r}){let{t:i}=j();return(0,H.jsxs)(`div`,{className:`relative flex min-h-screen items-center justify-center p-4`,children:[(0,H.jsxs)(`div`,{className:`pointer-events-none absolute inset-0 overflow-hidden`,children:[(0,H.jsx)(`div`,{className:`absolute -top-1/4 -right-1/4 h-[600px] w-[600px] rounded-full bg-primary/5 blur-3xl`}),(0,H.jsx)(`div`,{className:`absolute -bottom-1/4 -left-1/4 h-[500px] w-[500px] rounded-full bg-primary/3 blur-3xl`}),(0,H.jsx)(`div`,{className:`absolute bottom-0 left-1/2 h-[400px] w-[400px] -translate-x-1/2 rounded-full bg-primary/4 blur-3xl`})]}),(0,H.jsxs)(`div`,{className:M(`relative w-full max-w-sm animate-fade-in-up`,n),children:[(0,H.jsxs)(`div`,{className:`mb-8 flex flex-col items-center gap-3 text-center`,children:[(0,H.jsx)(`div`,{className:`flex h-14 w-14 items-center justify-center rounded-2xl bg-primary/10 shadow-sm ring-2 ring-primary/10 ring-offset-2 ring-offset-background`,children:(0,H.jsx)(Da,{size:28,className:`text-primary`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-xl font-semibold tracking-tight`,children:e??i(`auth.appTitle`)}),(0,H.jsx)(`p`,{className:`mt-0.5 text-sm text-muted-foreground`,children:t??i(`auth.appSubtitle`)})]})]}),r]})]})}function nv({open:e,onOpenChange:t,disabled:n=!1}){let{t:r}=j(),i=B(e=>e.passwordManagementEnabled),a=B(e=>e.refreshSession),o=e=>{if(!e)return;let t=r(e);return t===e?e:t},s=id({resolver:md(Ke),defaultValues:{password:``}}),c=s.formState.isSubmitting,l=c||n||!i;(0,V.useEffect)(()=>{e||(s.reset(),s.clearErrors())},[e,s]);let u=async e=>{s.clearErrors(`root`);try{await Ze(e),await a(),Q.success(r(`settings.password.toasts.removed`)),t(!1)}catch(e){s.setError(`root`,{message:Sf(e)})}},d=s.formState.errors.root?.message;return(0,H.jsx)(ef,{open:e,onOpenChange:t,children:(0,H.jsxs)(af,{className:`sm:max-w-md`,children:[(0,H.jsxs)(of,{children:[(0,H.jsx)(cf,{children:r(`settings.password.removeDialog.title`)}),(0,H.jsx)(lf,{children:r(`settings.password.removeDialog.description`)})]}),d?(0,H.jsx)(Jd,{variant:`error`,children:d}):null,(0,H.jsx)(uf,{...s,children:(0,H.jsxs)(`form`,{onSubmit:s.handleSubmit(u),className:`space-y-4`,children:[(0,H.jsx)(ff,{control:s.control,name:`password`,render:({field:e,fieldState:t})=>(0,H.jsxs)(hf,{children:[(0,H.jsx)(gf,{children:r(`settings.password.removeDialog.currentLabel`)}),(0,H.jsx)(_f,{children:(0,H.jsx)(xf,{...e,type:`password`,autoComplete:`current-password`,placeholder:r(`settings.password.removeDialog.currentPlaceholder`)})}),t.error?.message?(0,H.jsx)(bf,{children:o(t.error.message)}):(0,H.jsx)(bf,{})]})}),(0,H.jsxs)(sf,{children:[(0,H.jsx)(N,{type:`button`,variant:`outline`,onClick:()=>t(!1),disabled:c,children:r(`common.cancel`)}),(0,H.jsx)(N,{type:`submit`,variant:`destructive`,disabled:l,children:r(`settings.password.removeDialog.submit`)})]})]})})]})})}function rv({open:e,onOpenChange:t,disabled:n=!1,children:r}){let{t:i}=j(),a=B(e=>e.bootstrapRequired),o=B(e=>e.bootstrapTokenConfigured),s=B(e=>e.passwordManagementEnabled),c=B(e=>e.refreshSession),l=id({resolver:md(Ge),defaultValues:{password:``,bootstrapToken:``}}),u=l.formState.isSubmitting,d=u||n||!s,f=e=>{if(!e)return;let t=i(e);return t===e?e:t};(0,V.useEffect)(()=>{e||(l.reset(),l.clearErrors())},[e,l]);let p=async e=>{l.clearErrors(`root`);try{await it({password:e.password,bootstrapToken:e.bootstrapToken?.trim()?e.bootstrapToken.trim():void 0}),await c(),Q.success(i(`settings.password.toasts.configured`)),t(!1)}catch(e){l.setError(`root`,{message:Sf(e)})}},m=l.formState.errors.root?.message;return(0,H.jsxs)(ef,{open:e,onOpenChange:t,children:[(0,H.jsx)(tf,{asChild:!0,children:r}),(0,H.jsxs)(af,{className:`sm:max-w-md`,children:[(0,H.jsxs)(of,{children:[(0,H.jsx)(cf,{children:i(`settings.password.setupDialog.title`)}),(0,H.jsx)(lf,{children:i(`settings.password.setupDialog.description`)})]}),a?(0,H.jsx)(Jd,{variant:`error`,children:i(o?`settings.password.setupDialog.bootstrapTokenConfigured`:`settings.password.setupDialog.bootstrapTokenMissing`)}):null,m?(0,H.jsx)(Jd,{variant:`error`,children:m}):null,(0,H.jsx)(uf,{...l,children:(0,H.jsxs)(`form`,{onSubmit:l.handleSubmit(p),className:`space-y-4`,children:[(0,H.jsx)(ff,{control:l.control,name:`password`,render:({field:e,fieldState:t})=>(0,H.jsxs)(hf,{children:[(0,H.jsx)(gf,{children:i(`settings.password.setupDialog.passwordLabel`)}),(0,H.jsx)(_f,{children:(0,H.jsx)(xf,{...e,type:`password`,autoComplete:`new-password`,placeholder:i(`settings.password.setupDialog.passwordPlaceholder`)})}),t.error?.message?(0,H.jsx)(bf,{children:f(t.error.message)}):(0,H.jsx)(bf,{})]})}),a?(0,H.jsx)(ff,{control:l.control,name:`bootstrapToken`,render:({field:e})=>(0,H.jsxs)(hf,{children:[(0,H.jsx)(gf,{children:i(`settings.password.setupDialog.bootstrapTokenLabel`)}),(0,H.jsx)(_f,{children:(0,H.jsx)(xf,{...e,type:`password`,autoComplete:`one-time-code`,placeholder:i(`settings.password.setupDialog.bootstrapTokenPlaceholder`)})}),(0,H.jsx)(bf,{})]})}):null,(0,H.jsxs)(sf,{children:[(0,H.jsx)(N,{type:`button`,variant:`outline`,onClick:()=>t(!1),disabled:u,children:i(`common.cancel`)}),(0,H.jsx)(N,{type:`submit`,disabled:d,children:i(`settings.password.setupDialog.submit`)})]})]})})]})]})}function iv({open:e,onOpenChange:t,disabled:n=!1}){let{t:r}=j(),i=B(e=>e.refreshSession),[a,o]=(0,V.useState)(`password`),[s,c]=(0,V.useState)(null),l=e=>{if(!e)return;let t=r(e);return t===e?e:t},u=id({resolver:md(Ke),defaultValues:{password:``}}),d=id({resolver:md(qe),defaultValues:{code:``}}),f=u.formState.isSubmitting||d.formState.isSubmitting,p=(0,V.useCallback)(()=>{u.reset(),d.reset(),o(`password`),c(null)},[u,d]),m=(0,V.useCallback)(e=>{e||p(),t(e)},[t,p]);(0,V.useEffect)(()=>{e||(u.reset(),d.reset())},[e,u,d]);let h=async e=>{c(null);try{let t=await tt(e);if(t.totpRequiredOnLogin&&!t.passwordSessionActive){o(`totp`);return}await i(),Q.success(r(`settings.password.toasts.sessionEstablished`)),m(!1)}catch(e){c(Sf(e))}},g=async e=>{c(null);try{await Je(e),await i(),Q.success(r(`settings.password.toasts.sessionEstablished`)),m(!1)}catch(e){c(Sf(e))}};return(0,H.jsx)(ef,{open:e,onOpenChange:m,children:(0,H.jsxs)(af,{className:`sm:max-w-md`,children:[(0,H.jsxs)(of,{children:[(0,H.jsx)(cf,{children:r(a===`password`?`settings.password.verifyDialog.title`:`settings.password.verifyDialog.totpTitle`)}),(0,H.jsx)(lf,{children:r(a===`password`?`settings.password.verifyDialog.description`:`settings.password.verifyDialog.totpDescription`)})]}),s?(0,H.jsx)(Jd,{variant:`error`,children:s}):null,a===`password`?(0,H.jsx)(uf,{...u,children:(0,H.jsxs)(`form`,{onSubmit:u.handleSubmit(h),className:`space-y-4`,children:[(0,H.jsx)(ff,{control:u.control,name:`password`,render:({field:e,fieldState:t})=>(0,H.jsxs)(hf,{children:[(0,H.jsx)(gf,{children:r(`settings.password.verifyDialog.passwordLabel`)}),(0,H.jsx)(_f,{children:(0,H.jsx)(xf,{...e,type:`password`,autoComplete:`current-password`,placeholder:r(`settings.password.verifyDialog.passwordPlaceholder`)})}),t.error?.message?(0,H.jsx)(bf,{children:l(t.error.message)}):(0,H.jsx)(bf,{})]})}),(0,H.jsxs)(sf,{children:[(0,H.jsx)(N,{type:`button`,variant:`outline`,onClick:()=>m(!1),disabled:f,children:r(`common.cancel`)}),(0,H.jsx)(N,{type:`submit`,disabled:f||n,children:r(`settings.password.verifyDialog.submit`)})]})]})}):(0,H.jsx)(uf,{...d,children:(0,H.jsxs)(`form`,{onSubmit:d.handleSubmit(g),className:`space-y-4`,children:[(0,H.jsx)(ff,{control:d.control,name:`code`,render:({field:e,fieldState:t})=>(0,H.jsxs)(hf,{children:[(0,H.jsx)(gf,{children:r(`settings.password.verifyDialog.totpLabel`)}),(0,H.jsx)(_f,{children:(0,H.jsx)(xf,{...e,type:`text`,inputMode:`numeric`,autoComplete:`one-time-code`,placeholder:r(`settings.password.verifyDialog.totpPlaceholder`)})}),t.error?.message?(0,H.jsx)(bf,{children:l(t.error.message)}):(0,H.jsx)(bf,{})]})}),(0,H.jsxs)(sf,{children:[(0,H.jsx)(N,{type:`button`,variant:`outline`,onClick:()=>m(!1),disabled:f,children:r(`common.cancel`)}),(0,H.jsx)(N,{type:`submit`,disabled:f||n,children:r(`settings.password.verifyDialog.submit`)})]})]})})]})})}function av({disabled:e=!1}){let{t}=j(),n=B(e=>e.localPasswordConfigured),r=B(e=>e.authMode),i=B(e=>e.passwordManagementEnabled),a=B(e=>e.passwordSessionActive),o=B(e=>e.authenticated),[s,c]=(0,V.useState)(null),l=e||!i,u=e=>t=>{!t&&s===e&&c(null)},d=e=>{e?c(`setup`):s===`setup`&&c(null)},f=t(i?r===`trusted_header`?n?`settings.password.status.fallbackConfigured`:`settings.password.status.fallbackMissing`:n?`settings.password.status.configured`:`settings.password.status.notSet`:`settings.password.status.disabled`);return(0,H.jsxs)(`section`,{className:`rounded-xl border bg-card p-5`,children:[(0,H.jsx)(`div`,{className:`space-y-3`,children:(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,H.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded-lg bg-primary/10`,children:(0,H.jsx)(Qi,{className:`h-4 w-4 text-primary`,"aria-hidden":`true`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold`,children:t(`settings.password.title`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:f})]})]}),(0,H.jsx)(`div`,{className:`flex items-center gap-2`,children:i?n&&a?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(N,{type:`button`,size:`sm`,variant:`outline`,className:`h-8 text-xs`,disabled:l,onClick:()=>c(`change`),children:t(`settings.password.actions.change`)}),(0,H.jsx)(N,{type:`button`,size:`sm`,variant:`outline`,className:`h-8 text-xs text-destructive hover:text-destructive`,disabled:l,onClick:()=>c(`remove`),children:t(`settings.password.actions.remove`)})]}):n&&o&&!a?(0,H.jsx)(N,{type:`button`,size:`sm`,variant:`outline`,className:`h-8 text-xs`,disabled:e,onClick:()=>c(`verify`),children:t(`settings.password.actions.loginToManage`)}):n?null:(0,H.jsx)(rv,{open:s===`setup`,onOpenChange:d,disabled:e,children:(0,H.jsx)(N,{type:`button`,size:`sm`,className:`h-8 text-xs`,disabled:l,children:t(`settings.password.actions.set`)})}):null})]})}),(0,H.jsx)(wf,{open:s===`change`,onOpenChange:u(`change`),disabled:e}),(0,H.jsx)(nv,{open:s===`remove`,onOpenChange:u(`remove`),disabled:e}),(0,H.jsx)(iv,{open:s===`verify`,onOpenChange:u(`verify`),disabled:e})]})}function ov(){let{t:e}=j(),t=B(e=>e.bootstrapTokenConfigured);return(0,H.jsxs)(`div`,{className:`relative flex min-h-screen items-center justify-center p-4`,children:[(0,H.jsxs)(`div`,{className:`pointer-events-none absolute inset-0 overflow-hidden`,children:[(0,H.jsx)(`div`,{className:`absolute -top-1/4 -right-1/4 h-[600px] w-[600px] rounded-full bg-primary/5 blur-3xl`}),(0,H.jsx)(`div`,{className:`absolute -bottom-1/4 -left-1/4 h-[500px] w-[500px] rounded-full bg-primary/3 blur-3xl`}),(0,H.jsx)(`div`,{className:`absolute bottom-0 left-1/2 h-[400px] w-[400px] -translate-x-1/2 rounded-full bg-primary/4 blur-3xl`})]}),(0,H.jsxs)(`div`,{className:`relative w-full max-w-2xl space-y-6 animate-fade-in-up`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-3 text-center`,children:[(0,H.jsx)(`div`,{className:`flex h-14 w-14 items-center justify-center rounded-2xl bg-primary/10 shadow-sm ring-2 ring-primary/10 ring-offset-2 ring-offset-background`,children:(0,H.jsx)(Da,{size:28,className:`text-primary`})}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h1`,{className:`text-xl font-semibold tracking-tight`,children:e(`auth.bootstrap.title`)}),(0,H.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:e(`auth.bootstrap.subtitle`)})]})]}),(0,H.jsx)(`div`,{className:`rounded-2xl border bg-card p-6 shadow-[var(--shadow-md)]`,children:(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`auth.bootstrap.body`)}),(0,H.jsx)(Jd,{variant:`error`,children:e(t?`auth.bootstrap.tokenConfigured`:`auth.bootstrap.tokenMissing`)})]})}),(0,H.jsx)(av,{})]})]})}var sv=ct.omit({token:!0}).extend({confirmPassword:z()}).refine(e=>e.password===e.confirmPassword,{message:`auth.invite.validation.passwordMismatch`,path:[`confirmPassword`]});function cv({token:e}){let{t}=j(),n=tr(),r=B(e=>e.refreshSession),i=B(e=>e.logout),a=B(e=>e.loading),o=B(e=>e.user),[s,c]=(0,V.useState)({kind:`checking`}),[l,u]=(0,V.useState)(0),[d,f]=(0,V.useState)(!1);(0,V.useEffect)(()=>{let t=!1;return ot(e).then(e=>{t||c({kind:`form`,invite:e})}).catch(e=>{t||(e instanceof Ve&&e.status===404?c({kind:`expired`}):c({kind:`error`,message:Sf(e)}))}),()=>{t=!0}},[e,l]);let p=async()=>{B.getState().user||await r().catch(()=>void 0),f(!0)},m=s.kind===`form`&&(o!==null||d),h=s.kind===`form`?s.invite.inviterDisplayName?t(`auth.invite.invitedBy`,{inviter:s.invite.inviterDisplayName,role:s.invite.roleName}):t(`auth.invite.invitedAs`,{role:s.invite.roleName}):t(`auth.invite.subtitle`);return(0,H.jsx)(tv,{title:t(`auth.invite.title`),subtitle:h,children:(0,H.jsxs)(`div`,{className:`rounded-2xl border bg-card p-6 shadow-[var(--shadow-md)]`,children:[s.kind===`checking`?(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-4 text-sm text-muted-foreground`,children:[(0,H.jsx)(_h,{}),(0,H.jsx)(`p`,{children:t(`auth.invite.checking`)})]}):null,s.kind===`expired`?(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`auth.invite.expired`)}):null,s.kind===`error`?(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsx)(Jd,{variant:`error`,children:s.message}),(0,H.jsx)(N,{type:`button`,variant:`outline`,className:`w-full`,onClick:()=>{c({kind:`checking`}),u(e=>e+1)},children:t(`auth.invite.retry`)})]}):null,m?(0,H.jsxs)(`div`,{className:`space-y-4`,children:[(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t(`auth.invite.signedIn`,{username:o?.username??``})}),(0,H.jsx)(N,{type:`button`,variant:`outline`,className:`w-full`,disabled:a,onClick:()=>{f(!1),i()},children:t(`common.logout`)})]}):null,s.kind===`form`&&!m?(0,H.jsx)(lv,{token:e,invite:s.invite,onAccepted:()=>n(`/`,{replace:!0}),onAlreadySignedIn:p}):null]})})}function lv({token:e,invite:t,onAccepted:n,onAlreadySignedIn:r}){let{t:i}=j(),a=B(e=>e.acceptInvite),o=id({resolver:md(sv),defaultValues:{username:t.suggestedUsername,displayName:``,password:``,confirmPassword:``}}),s=o.formState.isSubmitting,c=o.formState.errors.root?.message,l=async s=>{o.clearErrors(`root`);try{await a({token:e,username:t.usernameLocked?t.suggestedUsername:s.username,password:s.password,displayName:s.displayName?.trim()?s.displayName.trim():void 0}),n()}catch(e){e instanceof Ve&&e.code===`already_signed_in`?await r():e instanceof Ve&&e.code===`username_taken`?o.setError(`username`,{message:i(`auth.invite.usernameTaken`)}):e instanceof Ve&&e.code===`username_locked`?o.setError(`username`,{message:Sf(e)}):e instanceof Ve&&e.status===404?o.setError(`root`,{message:i(`auth.invite.expired`)}):o.setError(`root`,{message:Sf(e)})}},u=(e,t,n,r)=>(0,H.jsx)(ff,{control:o.control,name:e,render:({field:e})=>(0,H.jsxs)(hf,{children:[(0,H.jsx)(gf,{className:`text-xs font-medium`,children:t}),(0,H.jsx)(_f,{children:(0,H.jsx)(xf,{...e,...n,disabled:s})}),r?(0,H.jsx)(vf,{children:r}):null,(0,H.jsx)(bf,{})]})});return(0,H.jsx)(uf,{...o,children:(0,H.jsxs)(`form`,{onSubmit:o.handleSubmit(l),className:`space-y-4`,children:[c?(0,H.jsx)(Jd,{variant:`error`,children:c}):null,u(`username`,i(`auth.invite.usernameLabel`),{type:`text`,autoComplete:`username`,autoCapitalize:`none`,spellCheck:!1,readOnly:t.usernameLocked},t.usernameLocked?i(`auth.invite.usernameLockedHint`):void 0),u(`displayName`,i(`auth.invite.displayNameLabel`),{type:`text`,autoComplete:`name`}),u(`password`,i(`auth.invite.passwordLabel`),{type:`password`,autoComplete:`new-password`,placeholder:i(`auth.invite.passwordPlaceholder`)}),u(`confirmPassword`,i(`auth.invite.confirmPasswordLabel`),{type:`password`,autoComplete:`new-password`}),(0,H.jsxs)(N,{type:`submit`,className:`press-scale mt-1 w-full`,disabled:s,children:[s?(0,H.jsx)(gh,{size:`sm`,className:`mr-2`}):null,i(`auth.invite.submit`)]})]})})}var uv=`/login`,dv=`${uv}?local=1`;function fv(e){return mv(e,`local`)===`1`}function pv(e){return mv(e,`sso`)===`failed`}function mv(e,t){let n=e.startsWith(`?`)?e.slice(1):e;return new URLSearchParams(n).get(t)}function hv(e,{localRequested:t=!1}={}){return e===`enabled`||t?`shown`:e===`admins_only`?`collapsed`:`hidden`}function gv(e){return e.filter(e=>e.kind!==`password`)}function _v({providers:e}){let{t}=j();return(0,H.jsx)(`div`,{className:`space-y-2`,"data-testid":`login-providers`,children:e.map(e=>e.loginUrl?(0,H.jsx)(N,{asChild:!0,className:`press-scale w-full`,children:(0,H.jsx)(`a`,{href:e.loginUrl,children:t(`auth.login.continueWith`,{provider:e.label})})},`${e.kind}:${e.providerKey}`):(0,H.jsxs)(`p`,{className:`flex items-start gap-2 rounded-lg border border-primary/20 bg-primary/5 px-3 py-2 text-xs text-foreground`,children:[(0,H.jsx)(Pi,{className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-primary`,"aria-hidden":`true`}),t(`auth.login.providerNoUrl`,{provider:e.label})]},`${e.kind}:${e.providerKey}`))})}function vv({localForm:e=`shown`,signInFailed:t=!1}={}){let{t:n}=j(),r=B(e=>e.login),i=B(e=>e.loginGuest),a=B(e=>e.loading),o=B(e=>e.error),s=B(e=>e.clearError),c=B(e=>e.passwordRequired),l=B(e=>e.loginHint.usernameField),u=B(e=>e.guestAccessEnabled),d=B(e=>e.guestPasswordRequired),f=gv(B(e=>e.loginHint.providers)),[p,m]=(0,V.useState)(!1),h=c&&(e===`shown`||e===`collapsed`&&p),g=c&&e===`collapsed`&&!p,_=!h&&!g&&f.length===0&&!u,[v]=(0,V.useState)(et),[y,b]=(0,V.useState)(!1),x=l===`shown`||v!==``||y,S=id({resolver:md(Xe),defaultValues:{username:v,password:``}}),C=id({defaultValues:{password:``}});(0,V.useEffect)(()=>{y&&S.setFocus(`username`)},[y,S]);let w=async e=>{s();let t=x?e.username?.trim():void 0;try{await(t?r(e.password,t):r(e.password))}catch(e){e instanceof Ve&&e.code===`username_required`&&(s(),b(!0),S.setError(`username`,{message:n(`auth.login.usernameRequired`)}))}},T=async e=>{s(),await i(e.password.trim()||void 0)};return(0,H.jsxs)(`div`,{className:`rounded-2xl border bg-card p-6 shadow-[var(--shadow-md)]`,children:[t?(0,H.jsx)(Jd,{variant:`warning`,className:`mb-5`,children:n(`auth.login.signInFailed`)}):null,f.length>0?(0,H.jsx)(`div`,{className:h||g?`mb-5 border-b pb-5`:``,children:(0,H.jsx)(_v,{providers:f})}):null,g?(0,H.jsx)(`button`,{type:`button`,className:`w-full text-center text-xs text-muted-foreground underline-offset-4 hover:text-foreground hover:underline`,onClick:()=>m(!0),children:n(`auth.login.useLocalPassword`)}):null,h?(0,H.jsx)(uf,{...S,children:(0,H.jsxs)(`form`,{onSubmit:S.handleSubmit(w),children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(`h2`,{className:`text-base font-semibold tracking-tight`,children:n(`auth.login.heading`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n(x?`auth.login.subheadingWithUsername`:`auth.login.subheading`)})]}),x?(0,H.jsx)(`div`,{className:`mt-5`,children:(0,H.jsx)(ff,{control:S.control,name:`username`,render:({field:e})=>(0,H.jsxs)(hf,{children:[(0,H.jsx)(gf,{className:`text-xs font-medium`,children:n(`auth.login.usernameLabel`)}),(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(Ea,{className:`pointer-events-none absolute top-1/2 left-3 h-4 w-4 -translate-y-1/2 text-muted-foreground/60`,"aria-hidden":`true`}),(0,H.jsx)(_f,{children:(0,H.jsx)(xf,{...e,type:`text`,autoComplete:`username`,autoCapitalize:`none`,spellCheck:!1,placeholder:n(`auth.login.usernamePlaceholder`),disabled:a,className:`pl-9`})})]}),(0,H.jsx)(bf,{})]})})}):null,(0,H.jsx)(`div`,{className:x?`mt-4`:`mt-5`,children:(0,H.jsx)(ff,{control:S.control,name:`password`,render:({field:e})=>(0,H.jsxs)(hf,{children:[(0,H.jsx)(gf,{className:`text-xs font-medium`,children:n(`auth.login.passwordLabel`)}),(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(ia,{className:`pointer-events-none absolute top-1/2 left-3 h-4 w-4 -translate-y-1/2 text-muted-foreground/60`,"aria-hidden":`true`}),(0,H.jsx)(_f,{children:(0,H.jsx)(xf,{...e,type:`password`,autoComplete:`current-password`,placeholder:n(`auth.login.passwordPlaceholder`),disabled:a,className:`pl-9`})})]}),(0,H.jsx)(bf,{})]})})}),(0,H.jsxs)(N,{type:`submit`,className:`press-scale mt-5 w-full`,disabled:a,children:[a?(0,H.jsx)(gh,{size:`sm`,className:`mr-2`}):null,n(`auth.login.submit`)]}),x?null:(0,H.jsx)(`button`,{type:`button`,className:`mt-3 w-full text-center text-xs text-muted-foreground underline-offset-4 hover:text-foreground hover:underline`,onClick:()=>b(!0),disabled:a,children:n(`auth.login.differentAccount`)})]})}):null,_?(0,H.jsx)(`p`,{className:`text-center text-sm text-muted-foreground`,children:n(`auth.login.localRestricted`)}):null,o?(0,H.jsx)(Jd,{variant:`error`,className:`mt-4`,children:o}):null,u?(0,H.jsx)(uf,{...C,children:(0,H.jsxs)(`form`,{onSubmit:C.handleSubmit(T),className:h||g||f.length>0?`mt-5 border-t pt-5`:``,children:[(0,H.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,H.jsx)(`h3`,{className:`text-sm font-semibold tracking-tight`,children:n(`auth.guest.heading`)}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`auth.guest.subheading`)})]}),d?(0,H.jsx)(`div`,{className:`mt-4`,children:(0,H.jsx)(ff,{control:C.control,name:`password`,render:({field:e})=>(0,H.jsxs)(hf,{children:[(0,H.jsx)(gf,{className:`text-xs font-medium`,children:n(`auth.guest.passwordLabel`)}),(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(Ki,{className:`pointer-events-none absolute top-1/2 left-3 h-4 w-4 -translate-y-1/2 text-muted-foreground/60`,"aria-hidden":`true`}),(0,H.jsx)(_f,{children:(0,H.jsx)(xf,{...e,type:`password`,autoComplete:`current-password`,placeholder:n(`auth.guest.passwordPlaceholder`),disabled:a,className:`pl-9`})})]}),(0,H.jsx)(bf,{})]})})}):null,(0,H.jsx)(N,{type:`submit`,variant:`outline`,className:`press-scale mt-4 w-full`,disabled:a,children:n(`auth.guest.submit`)})]})}):null]})}function yv({localForm:e=`shown`}){let{t}=j(),n=B(e=>e.refreshSession),r=B(e=>e.logout),i=B(e=>e.loginHint.pendingArrival),a=B(e=>e.localPasswordConfigured&&e.loginHint.providers.some(e=>e.kind===`password`));return(0,H.jsxs)(tv,{title:t(`auth.pending.title`),subtitle:i?t(`auth.pending.subtitleProvider`,{provider:i.provider}):t(`auth.pending.subtitle`),children:[(0,H.jsxs)(`div`,{className:`rounded-2xl border bg-card p-6 shadow-[var(--shadow-md)]`,"data-testid":`pending-identity`,children:[(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i?t(`auth.pending.bodyProvider`,{provider:i.provider}):t(`auth.pending.body`)}),i?(0,H.jsxs)(`div`,{className:`mt-4 rounded-lg border bg-muted/40 px-3 py-2`,children:[(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t(`auth.pending.referenceLabel`)}),(0,H.jsx)(`p`,{className:`mt-0.5 font-mono text-sm break-all select-all`,"data-testid":`pending-reference`,children:i.reference})]}):null,(0,H.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,H.jsx)(N,{type:`button`,className:`flex-1`,onClick:()=>void n().catch(()=>void 0),children:t(`auth.pending.retry`)}),(0,H.jsx)(N,{type:`button`,variant:`ghost`,onClick:()=>void r().catch(()=>void 0),children:t(`common.logout`)})]})]}),a&&e!==`hidden`?(0,H.jsxs)(`div`,{className:`mt-6 space-y-3`,"data-testid":`pending-local-login`,children:[(0,H.jsx)(`p`,{className:`text-center text-xs text-muted-foreground`,children:t(`auth.pending.localLogin`)}),(0,H.jsx)(vv,{localForm:e})]}):null,a&&e===`hidden`?(0,H.jsx)(`p`,{className:`mt-6 text-center text-xs text-muted-foreground`,children:(0,H.jsx)(_i,{to:dv,className:`underline underline-offset-4 hover:text-foreground`,children:t(`auth.pending.emergencyLink`)})}):null]})}var bv=Object.defineProperty,xv=Object.defineProperties,Sv=Object.getOwnPropertyDescriptors,Cv=Object.getOwnPropertySymbols,wv=Object.prototype.hasOwnProperty,Tv=Object.prototype.propertyIsEnumerable,Ev=(e,t,n)=>t in e?bv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Dv=(e,t)=>{for(var n in t||={})wv.call(t,n)&&Ev(e,n,t[n]);if(Cv)for(var n of Cv(t))Tv.call(t,n)&&Ev(e,n,t[n]);return e},Ov=(e,t)=>xv(e,Sv(t)),kv=(e,t)=>{var n={};for(var r in e)wv.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Cv)for(var r of Cv(e))t.indexOf(r)<0&&Tv.call(e,r)&&(n[r]=e[r]);return n};function Av(e){return[setTimeout(e,0),setTimeout(e,10),setTimeout(e,50)]}function jv(e){let t=V.useRef();return V.useEffect(()=>{t.current=e}),t.current}var Mv=18,Nv=40,Pv=`${Nv}px`;function Fv(e){let t=e.getBoundingClientRect().right,n=e;for(;n;){if(getComputedStyle(n).overflowX!==`visible`)return n.getBoundingClientRect().left+n.clientLeft+n.clientWidth-t;n=n.parentElement}return document.documentElement.clientWidth-t}var Iv=[`[data-lastpass-icon-root]`,`com-1password-button`,`[data-dashlanecreated]`,`[style$="2147483647 !important;"]`].join(`,`);function Lv({containerRef:e,inputRef:t,pushPasswordManagerStrategy:n,isFocused:r}){let[i,a]=V.useState(!1),[o,s]=V.useState(!1),[c,l]=V.useState(!1),u=V.useMemo(()=>n!==`none`&&(n===`increase-width`||n===`experimental-no-flickering`)&&i&&o,[i,o,n]),d=V.useCallback(()=>{let r=e.current,i=t.current;if(!r||!i||c||n===`none`)return;let o=r,u=o.getBoundingClientRect().left+o.offsetWidth,d=o.getBoundingClientRect().top+o.offsetHeight/2,f=u-Mv,p=d;document.querySelectorAll(Iv).length===0&&document.elementFromPoint(f,p)===r||(s(Fv(r)>=Nv),a(!0),l(!0))},[e,t,c,n]);return V.useEffect(()=>{let t=e.current;if(!t||n===`none`)return;function r(){s(Fv(t)>=Nv)}r();let i=setInterval(r,1e3);return()=>{clearInterval(i)}},[e,n]),V.useEffect(()=>{let e=r||document.activeElement===t.current;if(n===`none`||!e)return;let i=setTimeout(d,0),a=setTimeout(d,2e3),o=setTimeout(d,5e3),s=setTimeout(()=>{l(!0)},6e3);return()=>{clearTimeout(i),clearTimeout(a),clearTimeout(o),clearTimeout(s)}},[t,r,n,d]),{hasPWMBadge:i,willPushPWMBadge:u,PWM_BADGE_SPACE_WIDTH:Pv}}var Rv=V.createContext({}),zv=V.forwardRef((e,t)=>{var n=e,{value:r,onChange:i,maxLength:a,textAlign:o=`left`,pattern:s,placeholder:c,inputMode:l=`numeric`,onComplete:u,pushPasswordManagerStrategy:d=`increase-width`,pasteTransformer:f,containerClassName:p,noScriptCSSFallback:m=Vv,nonce:h,render:g,children:_}=n,v=kv(n,[`value`,`onChange`,`maxLength`,`textAlign`,`pattern`,`placeholder`,`inputMode`,`onComplete`,`pushPasswordManagerStrategy`,`pasteTransformer`,`containerClassName`,`noScriptCSSFallback`,`nonce`,`render`,`children`]),y;let[b,x]=V.useState(typeof v.defaultValue==`string`?v.defaultValue:``),S=r??b,C=jv(S),w=V.useCallback(e=>{i?.(e),x(e)},[i]),T=V.useMemo(()=>s?typeof s==`string`?new RegExp(s):s:null,[s]),E=V.useRef(null),D=V.useRef(null),ee=V.useRef({value:S,onChange:w,isIOS:typeof window<`u`&&((y=window==null?void 0:window.CSS)?.supports)?.call(y,`-webkit-touch-callout`,`none`)}),O=V.useRef({prev:[E.current?.selectionStart,E.current?.selectionEnd,E.current?.selectionDirection]});V.useImperativeHandle(t,()=>E.current,[]),V.useEffect(()=>{let e=E.current,t=D.current;if(!e||!t)return;ee.current.value!==e.value&&ee.current.onChange(e.value),O.current.prev=[e.selectionStart,e.selectionEnd,e.selectionDirection];function n(){if(document.activeElement!==e){ae(null),se(null);return}let t=e.selectionStart,n=e.selectionEnd,r=e.selectionDirection,i=e.maxLength,a=e.value,o=O.current.prev,s=-1,c=-1,l;if(a.length!==0&&t!==null&&n!==null){let r=t===n,u=t===a.length&&a.length<i;if(r&&!u){let e=t;if(e===0)s=0,c=1,l=`forward`;else if(e===i)s=e-1,c=e,l=`backward`;else if(i>1&&a.length>1){let t=0;if(o[0]!==null&&o[1]!==null){l=e<o[1]?`backward`:`forward`;let n=o[0]===o[1]&&o[0]<i;l===`backward`&&!n&&(t=-1)}s=t+e,c=t+e+1}}s!==-1&&c!==-1&&s!==c&&e.setSelectionRange(s,c,l)}let u=s===-1?t:s,d=c===-1?n:c,f=l??r;ae(u),se(d),O.current.prev=[u,d,f]}if(document.addEventListener(`selectionchange`,n,{capture:!0}),n(),document.activeElement===e&&k(!0),!document.getElementById(`input-otp-style`)){let e=document.createElement(`style`);if(e.id=`input-otp-style`,h&&e.setAttribute(`nonce`,h),document.head.appendChild(e),e.sheet){let t=`background: transparent !important; color: transparent !important; border-color: transparent !important; opacity: 0 !important; box-shadow: none !important; -webkit-box-shadow: none !important; -webkit-text-fill-color: transparent !important;`;Bv(e.sheet,`[data-input-otp]::selection { background: transparent !important; color: transparent !important; }`),Bv(e.sheet,`[data-input-otp]:autofill { ${t} }`),Bv(e.sheet,`[data-input-otp]:-webkit-autofill { ${t} }`),Bv(e.sheet,`@supports (-webkit-touch-callout: none) { [data-input-otp] { letter-spacing: -.6em !important; font-weight: 100 !important; font-stretch: ultra-condensed; font-optical-sizing: none !important; left: -1px !important; right: 1px !important; } }`),Bv(e.sheet,`[data-input-otp] + * { pointer-events: all !important; }`)}}let r=()=>{t&&t.style.setProperty(`--root-height`,`${e.clientHeight}px`)};r();let i=typeof ResizeObserver>`u`?null:new ResizeObserver(r);return i?.observe(e),()=>{document.removeEventListener(`selectionchange`,n,{capture:!0}),i?.disconnect()}},[]);let[te,ne]=V.useState(!1),[re,k]=V.useState(!1),[ie,ae]=V.useState(null),[oe,se]=V.useState(null);V.useEffect(()=>{let e=Av(()=>{var e;(e=E.current)==null||e.dispatchEvent(new Event(`input`));let t=E.current?.selectionStart,n=E.current?.selectionEnd,r=E.current?.selectionDirection;t!==null&&n!==null&&(ae(t),se(n),O.current.prev=[t,n,r])});return()=>{e.forEach(e=>clearTimeout(e))}},[S,re]),V.useEffect(()=>{C!==void 0&&S!==C&&C.length<a&&S.length===a&&u?.(S)},[a,u,C,S]);let ce=Lv({containerRef:D,inputRef:E,pushPasswordManagerStrategy:d,isFocused:re}),le=V.useCallback(e=>{let t=e.currentTarget.value.slice(0,a);t.length>0&&T&&!T.test(t)?e.preventDefault():(typeof C==`string`&&t.length<C.length&&document.dispatchEvent(new Event(`selectionchange`)),w(t))},[a,w,C,T]),ue=V.useCallback(()=>{var e;if(E.current){let t=Math.min(E.current.value.length,a-1),n=E.current.value.length;(e=E.current)==null||e.setSelectionRange(t,n),ae(t),se(n)}k(!0)},[a]),A=V.useCallback(e=>{let t=E.current;if(!f&&(!ee.current.isIOS||!e.clipboardData||!t))return;let n=e.clipboardData.getData(`text/plain`),r=f?f(n):n;e.preventDefault();let i=E.current?.selectionStart,o=E.current?.selectionEnd,s=(i===o?S.slice(0,i)+r+S.slice(i):S.slice(0,i)+r+S.slice(o)).slice(0,a);if(s.length>0&&T&&!T.test(s))return;t.value=s,w(s);let c=Math.min(s.length,a-1),l=s.length;t.setSelectionRange(c,l),ae(c),se(l)},[a,w,f,T,S]),de=V.useMemo(()=>({position:`relative`,cursor:v.disabled?`default`:`text`,userSelect:`none`,WebkitUserSelect:`none`,pointerEvents:`none`}),[v.disabled]),fe=V.useMemo(()=>({position:`absolute`,inset:0,width:ce.willPushPWMBadge?`calc(100% + ${ce.PWM_BADGE_SPACE_WIDTH})`:`100%`,clipPath:ce.willPushPWMBadge?`inset(0 ${ce.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:`100%`,display:`flex`,textAlign:o,opacity:`1`,color:`transparent`,pointerEvents:`all`,background:`transparent`,caretColor:`transparent`,border:`0 solid transparent`,outline:`0 solid transparent`,boxShadow:`none`,lineHeight:`1`,letterSpacing:`-.5em`,fontSize:`var(--root-height, 16px)`,fontFamily:`monospace`,fontVariantNumeric:`tabular-nums`}),[ce.PWM_BADGE_SPACE_WIDTH,ce.willPushPWMBadge,o]),pe=V.useMemo(()=>V.createElement(`input`,Ov(Dv({autoComplete:v.autoComplete||`one-time-code`},v),{"data-input-otp":!0,"data-input-otp-placeholder-shown":S.length===0||void 0,"data-input-otp-mss":ie,"data-input-otp-mse":oe,inputMode:l,pattern:T?.source,"aria-placeholder":c,style:fe,maxLength:a,value:S,ref:E,spellCheck:v.spellCheck??!1,onPaste:e=>{var t;A(e),(t=v.onPaste)==null||t.call(v,e)},onChange:le,onMouseOver:e=>{var t;ne(!0),(t=v.onMouseOver)==null||t.call(v,e)},onMouseLeave:e=>{var t;ne(!1),(t=v.onMouseLeave)==null||t.call(v,e)},onFocus:e=>{var t;ue(),(t=v.onFocus)==null||t.call(v,e)},onBlur:e=>{var t;k(!1),(t=v.onBlur)==null||t.call(v,e)}})),[le,ue,A,l,fe,a,oe,ie,c,v,T?.source,S]),me=V.useMemo(()=>({slots:Array.from({length:a}).map((e,t)=>{let n=re&&ie!==null&&oe!==null&&(ie===oe&&t===ie||t>=ie&&t<oe),r=S[t]===void 0?null:S[t];return{char:r,placeholderChar:S[0]===void 0?c?.[t]??null:null,isActive:n,hasFakeCaret:n&&r===null}}),isFocused:re,isHovering:!v.disabled&&te}),[re,te,a,oe,ie,c,v.disabled,S]),he=V.useMemo(()=>g?g(me):V.createElement(Rv.Provider,{value:me},_),[_,me,g]);return V.createElement(V.Fragment,null,m!==null&&V.createElement(`noscript`,null,V.createElement(`style`,null,m)),V.createElement(`div`,{ref:D,"data-input-otp-container":!0,translate:`no`,style:de,className:p},he,V.createElement(`div`,{style:{position:`absolute`,inset:0,pointerEvents:`none`}},pe)))});zv.displayName=`Input`;function Bv(e,t){try{e.insertRule(t)}catch{console.warn(`input-otp could not insert CSS rule:`,t)}}var Vv=`
5
+ [data-input-otp] {
6
+ --nojs-bg: white !important;
7
+ --nojs-fg: black !important;
8
+
9
+ background-color: var(--nojs-bg) !important;
10
+ color: var(--nojs-fg) !important;
11
+ caret-color: var(--nojs-fg) !important;
12
+ letter-spacing: .25em !important;
13
+ text-align: center !important;
14
+ border: 1px solid var(--nojs-fg) !important;
15
+ border-radius: 4px !important;
16
+ width: 100% !important;
17
+ }
18
+ @media (prefers-color-scheme: dark) {
19
+ [data-input-otp] {
20
+ --nojs-bg: black !important;
21
+ --nojs-fg: white !important;
22
+ }
23
+ }`;function Hv({className:e,containerClassName:t,...n}){return(0,H.jsx)(zv,{"data-slot":`input-otp`,containerClassName:M(`flex items-center justify-center gap-3 has-disabled:opacity-50`,t),className:M(`disabled:cursor-not-allowed`,e),...n})}function Uv({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`input-otp-group`,className:M(`flex items-center`,e),...t})}function Wv({index:e,className:t,...n}){let{char:r,hasFakeCaret:i,isActive:a}=V.use(Rv).slots[e];return(0,H.jsxs)(`div`,{"data-slot":`input-otp-slot`,"data-active":a,className:M(`border-input relative flex h-11 w-10 items-center justify-center border-y border-r text-lg font-medium shadow-xs transition-all first:rounded-l-md first:border-l last:rounded-r-md`,a&&`border-ring ring-ring/50 z-10 ring-[3px]`,t),...n,children:[r,i?(0,H.jsx)(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center`,children:(0,H.jsx)(`div`,{className:`animate-caret-blink bg-foreground h-4 w-[2px] duration-1000`})}):null]})}function Gv({className:e,...t}){return(0,H.jsx)(`hr`,{"data-slot":`input-otp-separator`,className:M(`h-px w-3 border-0 bg-border`,e),...t})}function Kv({open:e}){let{t}=j(),n=B(e=>e.loading),r=B(e=>e.error),i=B(e=>e.clearError),a=B(e=>e.verifyTotp),o=B(e=>e.logout),s=id({resolver:md(qe),defaultValues:{code:``}}),c=async e=>{i(),await a(e.code.trim()),s.reset()},l=()=>{s.reset(),i(),o()};return(0,H.jsx)(ef,{open:e,onOpenChange:e=>!e&&l(),children:(0,H.jsxs)(af,{className:`sm:max-w-sm`,onInteractOutside:e=>e.preventDefault(),children:[(0,H.jsxs)(of,{children:[(0,H.jsx)(cf,{children:t(`auth.totp.title`)}),(0,H.jsx)(lf,{children:t(`auth.totp.description`)})]}),(0,H.jsx)(uf,{...s,children:(0,H.jsxs)(`form`,{onSubmit:s.handleSubmit(c),className:`space-y-5`,children:[(0,H.jsx)(ff,{control:s.control,name:`code`,render:({field:e})=>(0,H.jsxs)(hf,{className:`flex flex-col items-center gap-2`,children:[(0,H.jsx)(gf,{className:`sr-only`,children:t(`auth.totp.codeLabel`)}),(0,H.jsx)(_f,{children:(0,H.jsxs)(Hv,{maxLength:6,autoFocus:!0,value:e.value,onChange:e.onChange,onComplete:()=>s.handleSubmit(c)(),children:[(0,H.jsxs)(Uv,{children:[(0,H.jsx)(Wv,{index:0}),(0,H.jsx)(Wv,{index:1}),(0,H.jsx)(Wv,{index:2})]}),(0,H.jsx)(Gv,{}),(0,H.jsxs)(Uv,{children:[(0,H.jsx)(Wv,{index:3}),(0,H.jsx)(Wv,{index:4}),(0,H.jsx)(Wv,{index:5})]})]})}),(0,H.jsx)(bf,{})]})}),r?(0,H.jsx)(Jd,{variant:`error`,children:r}):null,(0,H.jsxs)(N,{type:`submit`,className:`w-full`,disabled:n,children:[n?(0,H.jsx)(gh,{size:`sm`,className:`mr-2`}):null,t(`auth.totp.submit`)]})]})})]})})}function qv({onEnrolled:e,onCancel:t,cancelLabel:n,disabled:r=!1}){let{t:i}=j(),[a,o]=(0,V.useState)(null),[s,c]=(0,V.useState)(null),[l,u]=(0,V.useState)(!0),[d,f]=(0,V.useState)(null),p=id({resolver:md(qe),defaultValues:{code:``}});(0,V.useEffect)(()=>{let e=!1;return $e().then(t=>{e||(o(t.secret),c(t.qrSvgDataUri))}).catch(t=>{e||f(Sf(t))}).finally(()=>{e||u(!1)}),()=>{e=!0}},[]);let m=r||l||p.formState.isSubmitting,h=async t=>{if(a){f(null);try{let n=t.code.trim();await rt({secret:a,code:n}),await e(n)}catch(e){f(Sf(e))}}};return(0,H.jsxs)(`div`,{className:`space-y-4`,children:[d?(0,H.jsx)(Jd,{variant:`error`,children:d}):null,s?(0,H.jsx)(`div`,{className:`flex justify-center rounded-lg border bg-card p-4 dark:bg-white/95`,children:(0,H.jsx)(`img`,{src:s,alt:i(`settings.totp.setupDialog.qrAlt`),className:`h-40 w-40`})}):null,a?(0,H.jsxs)(`p`,{className:`rounded-lg border bg-muted/30 px-3 py-2 font-mono text-xs`,children:[i(`settings.totp.setupDialog.secretLabel`),` `,a]}):null,a?(0,H.jsx)(uf,{...p,children:(0,H.jsxs)(`form`,{onSubmit:p.handleSubmit(h),className:`space-y-4`,children:[(0,H.jsx)(ff,{control:p.control,name:`code`,render:({field:e})=>(0,H.jsxs)(hf,{className:`flex flex-col items-center gap-2`,children:[(0,H.jsx)(gf,{className:`sr-only`,children:i(`settings.totp.setupDialog.codeLabel`)}),(0,H.jsx)(_f,{children:(0,H.jsxs)(Hv,{maxLength:6,value:e.value,onChange:e.onChange,children:[(0,H.jsxs)(Uv,{children:[(0,H.jsx)(Wv,{index:0}),(0,H.jsx)(Wv,{index:1}),(0,H.jsx)(Wv,{index:2})]}),(0,H.jsx)(Gv,{}),(0,H.jsxs)(Uv,{children:[(0,H.jsx)(Wv,{index:3}),(0,H.jsx)(Wv,{index:4}),(0,H.jsx)(Wv,{index:5})]})]})}),(0,H.jsx)(bf,{})]})}),(0,H.jsxs)(sf,{children:[t?(0,H.jsx)(N,{type:`button`,variant:`outline`,onClick:t,disabled:l,children:n??i(`common.cancel`)}):null,(0,H.jsx)(N,{type:`submit`,disabled:m,children:i(`settings.totp.setupDialog.submit`)})]})]})}):null]})}var Jv=`/invite/:token`,Yv=`/auth/pending`,Xv=uv;function Zv(e){return e===`/auth/pending`||tn(`/invite/:token`,e)!==null||e===Xv||e.startsWith(`${Xv}/`)}function Qv(e,t){return e===`trusted_header`||t.some(e=>e.loginUrl!==null)}function $v({children:e}){let{t}=j(),{pathname:n,search:r}=Zn(),i=tr(),a=B(e=>e.refreshSession),o=B(e=>e.initialized),s=B(e=>e.passwordRequired),c=B(e=>e.authenticated),l=B(e=>e.bootstrapRequired),u=B(e=>e.totpRequiredOnLogin),d=B(e=>e.totpEnrollmentRequired),f=B(e=>e.authMode),p=B(e=>e.adminLoginRequested),m=B(e=>e.guestAccessEnabled),h=B(e=>e.guestPasswordRequired),g=B(e=>e.logout),_=B(e=>e.verifyTotp),v=B(e=>e.error),y=B(e=>e.loginHint.pendingIdentity),b=B(e=>e.loginHint.providers),x=hv(B(e=>e.loginHint.localLogin),{localRequested:fv(r)}),S=pv(r);(0,V.useEffect)(()=>{a()},[]);let C=Zv(n);if((0,V.useEffect)(()=>{o&&y&&!c&&!C&&i(Yv,{replace:!0})},[c,o,i,C,y]),!o)return(0,H.jsx)(`div`,{className:`flex min-h-screen items-center justify-center`,children:(0,H.jsx)(_h,{})});let w=tn(Jv,n);return w?.params.token?(0,H.jsx)(cv,{token:w.params.token},w.params.token):!c&&(y||n===`/auth/pending`&&Qv(f,b))?(0,H.jsx)(yv,{localForm:x}):l&&!s?(0,H.jsx)(ov,{}):(s||f===`standard`&&m&&h)&&(!c||p)?u?(0,H.jsx)(Kv,{open:!0}):(0,H.jsx)(tv,{children:(0,H.jsx)(vv,{localForm:x,signInFailed:S})}):f===`trusted_header`&&!c?(0,H.jsx)(`div`,{className:`relative flex min-h-screen items-center justify-center p-4`,children:(0,H.jsxs)(`div`,{className:`w-full max-w-lg rounded-2xl border bg-card p-6 shadow-sm`,children:[(0,H.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight`,children:t(`auth.trustedHeader.title`)}),(0,H.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:t(`auth.trustedHeader.body`)})]})}):c&&d?(0,H.jsx)(tv,{title:t(`auth.enroll.title`),subtitle:t(`auth.enroll.subtitle`),children:(0,H.jsxs)(`div`,{className:`rounded-2xl border bg-card p-6 shadow-[var(--shadow-md)]`,children:[(0,H.jsx)(`p`,{className:`mb-4 text-sm text-muted-foreground`,children:t(`auth.enroll.description`)}),(0,H.jsx)(qv,{onEnrolled:async e=>{try{await _(e)}catch{await a()}}}),(0,H.jsx)(N,{type:`button`,variant:`ghost`,className:`mt-4 w-full text-xs`,onClick:()=>void g(),children:t(`common.logout`)})]})}):v!==null&&!c?(0,H.jsx)(`div`,{className:`flex min-h-screen flex-col`,children:(0,H.jsx)(xh,{onRetry:()=>void a().catch(()=>void 0)})}):(0,H.jsx)(H.Fragment,{children:e})}function ey(){let{t:e}=j(),t=tr(),n=B(e=>e.refreshSession),[r,i]=(0,V.useState)(null),[a,o]=(0,V.useState)(``),[s,c]=(0,V.useState)(``),[l,u]=(0,V.useState)(null),[d,f]=(0,V.useState)(!1),p=(0,V.useRef)([]),m=(0,V.useCallback)(e=>{let t=p.current;p.current=[];for(let n of t)n(e);i(null),o(``),c(``),u(null)},[]);(0,V.useEffect)(()=>(Be({onRequired:e=>new Promise(t=>{p.current.push(t),i(n=>n??{methods:e,resolve:t})}),onUnavailable:()=>{Q.error(e(`auth.stepUp.unavailable.title`),{description:e(`auth.stepUp.unavailable.description`),action:{label:e(`auth.stepUp.unavailable.action`),onClick:()=>t(`/settings${rl}`)}})}}),()=>Be(null)),[t,e]);let h=r?.methods.includes(`password`)??!1,g=r?.methods.includes(`totp`)??!1,_=!h&&!g&&(r?.methods.includes(`oidc`)??!1),v=(!h||a.length>0)&&(!g||s.length===6),y=async()=>{if(r){f(!0),u(null);try{let{authorizationUrl:e}=await nt();m(!1),window.location.assign(e)}catch(e){u(Sf(e)),f(!1)}}},b=async()=>{if(r&&!_&&v){f(!0),u(null);try{await Qe({...h?{password:a}:{},...g?{code:s}:{}}),await n().catch(()=>void 0),m(!0)}catch(e){u(Sf(e)),c(``)}finally{f(!1)}}};return(0,H.jsx)(ef,{open:r!==null,onOpenChange:e=>!e&&m(!1),children:(0,H.jsxs)(af,{className:`sm:max-w-sm`,onInteractOutside:e=>e.preventDefault(),children:[(0,H.jsxs)(of,{children:[(0,H.jsx)(cf,{children:e(`auth.stepUp.title`)}),(0,H.jsx)(lf,{children:e(_?`auth.stepUp.provider.description`:`auth.stepUp.description`)})]}),(0,H.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e.preventDefault(),b()},children:[h?(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(We,{htmlFor:`step-up-password`,children:e(`auth.stepUp.passwordLabel`)}),(0,H.jsx)(xf,{id:`step-up-password`,type:`password`,autoComplete:`current-password`,autoFocus:!0,value:a,onChange:e=>o(e.target.value),disabled:d})]}):null,g?(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,H.jsx)(We,{htmlFor:`step-up-code`,children:e(`auth.stepUp.codeLabel`)}),(0,H.jsxs)(Hv,{id:`step-up-code`,maxLength:6,autoFocus:!h,value:s,onChange:c,disabled:d,children:[(0,H.jsxs)(Uv,{children:[(0,H.jsx)(Wv,{index:0}),(0,H.jsx)(Wv,{index:1}),(0,H.jsx)(Wv,{index:2})]}),(0,H.jsx)(Gv,{}),(0,H.jsxs)(Uv,{children:[(0,H.jsx)(Wv,{index:3}),(0,H.jsx)(Wv,{index:4}),(0,H.jsx)(Wv,{index:5})]})]})]}):null,l?(0,H.jsx)(Jd,{variant:`error`,children:l}):null,(0,H.jsxs)(sf,{children:[(0,H.jsx)(N,{type:`button`,variant:`outline`,onClick:()=>m(!1),disabled:d,children:e(`common.cancel`)}),_?(0,H.jsx)(N,{type:`button`,disabled:d,onClick:()=>void y(),children:e(`auth.stepUp.provider.submit`)}):(0,H.jsx)(N,{type:`submit`,disabled:d||!v,children:e(`auth.stepUp.submit`)})]})]})]})})}var ty=`codex-lb-oidc-flow`,ny=`codex-lb.oidc-flow-return`,ry=`codex-lb.oidc-flow-window`,iy=new Set([`/settings`,`/login`]),ay=`codex-lb.oidc-flow`,oy=500,sy=6e5,cy=`/dashboard`;function ly(){try{return window.open(``,ty,`popup,width=520,height=680`)}catch{return null}}var uy={go(e){window.location.assign(e)}};function dy(e){try{window.sessionStorage.setItem(ay,JSON.stringify(e))}catch{}}function fy(){try{return window.sessionStorage.getItem(ay)}catch{return null}}function py(){let e=fy();try{window.sessionStorage.removeItem(ay)}catch{}return e}function my(e){if(e===null)return null;try{let t=JSON.parse(e);if(typeof t!=`object`||!t)return null;let{providerId:n,purpose:r,verifiedAt:i}=t;return typeof n!=`string`||r!==`test-login`?null:{providerId:n,purpose:r,verifiedAt:typeof i==`string`?i:null}}catch{return null}}function hy(){return my(py())}function gy(){return my(fy())===null?cy:gl}function _y(){try{return typeof BroadcastChannel>`u`?null:new BroadcastChannel(ry)}catch{return null}}function vy(e,t){let n=!1,r=()=>{n=!0,window.clearInterval(s),window.clearTimeout(c),window.removeEventListener(`message`,a),l?.close()},i=e=>{n||(r(),t(e))},a=t=>{t.origin===window.location.origin&&t.source===e&&t.data?.type===`codex-lb.oidc-flow-return`&&i(`returned`)},o=e=>{e.data?.type===`codex-lb.oidc-flow-return`&&i(`returned`)},s=window.setInterval(()=>{e.closed&&(window.clearInterval(s),n||t(`closed`))},oy),c=window.setTimeout(()=>i(`expired`),sy),l=_y();return l!==null&&(l.onmessage=o),window.addEventListener(`message`,a),r}function yy(){if(typeof window>`u`||window.name!==`codex-lb-oidc-flow`||!iy.has(window.location.pathname))return!1;let e=_y();try{e?.postMessage({type:ny})}catch{}finally{e?.close()}let t=window.opener;if(t===null)return!1;try{t.postMessage({type:ny},window.location.origin)}catch{}return window.close(),!0}function by({preview:e}){return(0,H.jsx)(`pre`,{className:`max-h-64 overflow-auto whitespace-pre-wrap break-all rounded-lg border bg-muted/20 p-3 text-xs`,children:`${JSON.stringify(e,null,2)}\n`})}function xy(){let{t:e}=j(),t=b(),{data:n,error:r,isFetching:i,isLoading:a,isPending:o,isSuccess:s,refetch:c}=h({queryKey:[`settings`,`detail`],queryFn:Zm});return{settingsQuery:{data:n,error:r,isFetching:i,isLoading:a,isPending:o,isSuccess:s,refetch:c},updateSettingsMutation:_({mutationFn:e=>Qm(e),onSuccess:()=>{Q.success(e(`settings.toasts.saved`)),t.invalidateQueries({queryKey:[`settings`,`detail`]}),t.invalidateQueries({queryKey:[`settings`,`upstream-proxy`]})},onError:n=>{Q.error(n.message||e(`settings.toasts.saveFailed`)),n instanceof Ve&&n.code===`settings_conflict`&&t.invalidateQueries({queryKey:[`settings`,`detail`]})}})}}function Sy(e){let{t}=j(),n=b(),{data:r,error:i,isFetching:a,isLoading:o,isPending:s,isSuccess:c,refetch:l}=h({queryKey:[`settings`,`telemetry`],queryFn:()=>$m(),enabled:e?.enabled??!0});return{telemetryConsentQuery:{data:r,error:i,isFetching:a,isLoading:o,isPending:s,isSuccess:c,refetch:l},updateTelemetryConsentMutation:_({mutationFn:e=>eh(e),onSuccess:()=>{Q.success(t(`settings.telemetry.toasts.saved`)),n.invalidateQueries({queryKey:[`settings`,`telemetry`]})},onError:e=>{Q.error(e.message||t(`settings.telemetry.toasts.saveFailed`))}})}}function Cy(e){let{data:t,error:n,isFetching:r,isLoading:i,isPending:a,isSuccess:o,refetch:s}=h({queryKey:[`settings`,`telemetry`,`preview`],queryFn:()=>$m({includePreview:!0}),enabled:e});return{telemetryPreviewQuery:{data:t,error:n,isFetching:r,isLoading:i,isPending:a,isSuccess:o,refetch:s}}}function wy(e){let{t}=j(),n=b(),{data:r,error:i,isFetching:a,isLoading:o,isPending:s,isSuccess:c,refetch:l}=h({queryKey:[`settings`,`upstream-proxy`],queryFn:th,enabled:e?.enabled??!0});return{upstreamProxyQuery:{data:r,error:i,isFetching:a,isLoading:o,isPending:s,isSuccess:c,refetch:l},createEndpointMutation:_({mutationFn:e=>nh(e),onSuccess:()=>{Q.success(t(`upstreamProxy.toasts.endpointCreated`)),n.invalidateQueries({queryKey:[`settings`,`upstream-proxy`]}),n.invalidateQueries({queryKey:[`settings`,`detail`]})},onError:e=>{Q.error(e.message||t(`upstreamProxy.toasts.endpointCreateFailed`))}}),createPoolMutation:_({mutationFn:e=>ih(e),onSuccess:()=>{Q.success(t(`upstreamProxy.toasts.poolCreated`)),n.invalidateQueries({queryKey:[`settings`,`upstream-proxy`]}),n.invalidateQueries({queryKey:[`settings`,`detail`]})},onError:e=>{Q.error(e.message||t(`upstreamProxy.toasts.poolCreateFailed`))}}),addPoolMemberMutation:_({mutationFn:({poolId:e,payload:t})=>ah(e,t),onSuccess:()=>{Q.success(t(`upstreamProxy.toasts.memberAdded`)),n.invalidateQueries({queryKey:[`settings`,`upstream-proxy`]}),n.invalidateQueries({queryKey:[`settings`,`detail`]})},onError:e=>{Q.error(e.message||t(`upstreamProxy.toasts.poolUpdateFailed`))}}),testEndpointMutation:_({mutationFn:e=>rh(e),onSuccess:e=>{e.ok?Q.success(t(`upstreamProxy.toasts.endpointReachable`)):Q.error(e.error||t(`upstreamProxy.toasts.endpointTestFailed`))},onError:e=>{Q.error(e.message||t(`upstreamProxy.toasts.endpointTestFailed`))}}),accountBindingMutation:_({mutationFn:({accountId:e,payload:t})=>oh(e,t),onSuccess:()=>{Q.success(t(`upstreamProxy.toasts.accountBindingSaved`)),n.invalidateQueries({queryKey:[`settings`,`upstream-proxy`]}),n.invalidateQueries({queryKey:[`settings`,`detail`]})},onError:e=>{Q.error(e.message||t(`upstreamProxy.toasts.accountBindingFailed`))}})}}function Ty(){let{t:e}=j(),t=b(),n=[`settings`,`model-context-window-overrides`],{data:r,error:i,isFetching:a,isLoading:o,isPending:s,isSuccess:c,refetch:l}=h({queryKey:n,queryFn:sh});return{overridesQuery:{data:r,error:i,isFetching:a,isLoading:o,isPending:s,isSuccess:c,refetch:l},upsertMutation:_({mutationFn:({slug:e,contextWindow:t})=>ch(e,{contextWindow:t}),onSuccess:()=>{Q.success(e(`settings.modelCatalogue.toasts.saved`)),t.invalidateQueries({queryKey:n})},onError:t=>{Q.error(t.message||e(`settings.modelCatalogue.toasts.saveFailed`))}}),deleteMutation:_({mutationFn:e=>lh(e),onSuccess:()=>{Q.success(e(`settings.modelCatalogue.toasts.removed`)),t.invalidateQueries({queryKey:n})},onError:t=>{Q.error(t.message||e(`settings.modelCatalogue.toasts.removeFailed`))}})}}var Ey=`https://soju06.github.io/codex-lb/telemetry/`;function Dy(){let{t:e}=j(),t=B(e=>e.canWrite),[n,r]=(0,V.useState)(!1),{telemetryConsentQuery:i,updateTelemetryConsentMutation:a}=Sy({enabled:t}),o=i.data,s=o?.preview??null;if(!t||n||o===void 0||o.state!==`undecided`||o.source===`env`||s===null)return null;let c=a.isPending,l=e=>{a.mutate({enabled:e},{onSuccess:()=>r(!0)})};return(0,H.jsx)(ef,{open:!0,onOpenChange:e=>r(!e),children:(0,H.jsxs)(af,{className:`sm:max-w-2xl`,children:[(0,H.jsxs)(of,{children:[(0,H.jsx)(cf,{children:e(`settings.telemetry.consentDialog.title`)}),(0,H.jsx)(lf,{children:e(`settings.telemetry.consentDialog.description`)})]}),(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`settings.telemetry.consentDialog.categories`)}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`settings.telemetry.optOutNotice`)}),(0,H.jsx)(`p`,{className:`text-sm font-medium`,children:e(`settings.telemetry.consentDialog.payloadLabel`)}),(0,H.jsx)(by,{preview:s}),(0,H.jsx)(`p`,{className:`text-sm`,children:(0,H.jsx)(`a`,{href:Ey,target:`_blank`,rel:`noreferrer`,className:`text-primary underline underline-offset-2`,children:e(`settings.telemetry.consentDialog.docsLink`)})})]}),(0,H.jsxs)(sf,{children:[(0,H.jsx)(N,{type:`button`,variant:`outline`,disabled:c,onClick:()=>l(!1),children:e(`settings.telemetry.consentDialog.disable`)}),(0,H.jsx)(N,{type:`button`,variant:`outline`,disabled:c,onClick:()=>l(!0),children:e(`settings.telemetry.consentDialog.keepEnabled`)})]})]})})}var Oy=(0,V.lazy)(()=>Ct(()=>import(`./dashboard-page-CSdhBy0f.js`).then(e=>({default:e.DashboardPage})),__vite__mapDeps([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]))),ky=(0,V.lazy)(()=>Ct(()=>import(`./reports-page-CGCJeMHG.js`).then(e=>({default:e.ReportsPage})),__vite__mapDeps([38,1,2,8,3,9,39,6,7,13,14,15,12,11,37,10,32]))),Ay=(0,V.lazy)(()=>Ct(()=>import(`./accounts-page-Bbai8ift.js`).then(e=>({default:e.AccountsPage})),__vite__mapDeps([40,1,2,3,4,5,6,7,10,11,12,13,14,15,17,41,19,20,21,22,23,39,42,26,27,43,44,45,29,46,31,32,33,47,34]))),jy=(0,V.lazy)(()=>Ct(()=>import(`./automations-page-DQgNAJOR.js`).then(e=>({default:e.AutomationsPage})),__vite__mapDeps([48,1,2,3,17,11,10,12,13,14,15,18,16,6,7,49,21,5,22,32,33,50,25,42,26,27,44,45,29,31,35,36,51,52,37]))),My=(0,V.lazy)(()=>Ct(()=>import(`./apis-page-BvXz9c6i.js`).then(e=>({default:e.ApisPage})),__vite__mapDeps([53,1,2,10,11,3,12,13,14,15,17,54,42,26,6,7,45,29,5,21,46,32,47,34,50,55,23]))),Ny=(0,V.lazy)(()=>Ct(()=>import(`./settings-page-mZj01HYl.js`).then(e=>({default:e.SettingsPage})),__vite__mapDeps([56,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,41,23,54,42,27,28,43,44,45,29,21,46,22,32,34,50,57,55,35,36,51,52,58]))),Py=(0,V.lazy)(()=>Ct(()=>import(`./access-page-DHzZiXZi.js`).then(e=>({default:e.AccessPage})),__vite__mapDeps([59,1,2,28,3,6,7,29,5,15,12,11,13,14,58,17,10,23,54,43,44,45,32,36,51])));function Fy(){let{pathname:e}=Zn(),t=B(e=>e.permissions),n=Ff(e);return n!==null&&!st(t,n)?e===`/dashboard`?(0,H.jsx)(bh,{}):(0,H.jsx)(Er,{to:`/dashboard`,replace:!0}):(0,H.jsx)(Dr,{})}function Iy(){let{hash:e,key:t,pathname:n,search:r}=Zn(),i=B(e=>e.logout),a=B(e=>e.passwordRequired),o=B(e=>e.role),s=B(e=>e.guestPasswordRequired),c=B(e=>e.startAdminLogin),l=Rg(e=>e.timeFormat),u=o===`guest`,[d,f]=(0,V.useState)(40);return(0,H.jsxs)(`div`,{className:`flex min-h-screen flex-col bg-background`,"data-time-format":l,style:{paddingBottom:d},children:[(0,H.jsx)(wh,{}),(0,H.jsx)(mh,{onLogout:()=>{i()},onAdminLogin:c,showAdminLogin:u&&a,showLogout:o===`admin`&&a||u&&s}),(0,H.jsx)(`main`,{className:`mx-auto flex w-full max-w-[1500px] flex-1 flex-col px-4 py-8 sm:px-6`,children:(0,H.jsx)(Ch,{resetKey:`${t}:${n}${r}${e}`,children:(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(Sh,{}),children:(0,H.jsx)(Dr,{})})},n)}),(0,H.jsx)(z_,{onHeightChange:f}),(0,H.jsx)(Dy,{})]})}function Ly(){return(0,H.jsxs)(Z_,{children:[(0,H.jsx)(X_,{richColors:!0}),(0,H.jsx)(ey,{}),(0,H.jsx)($v,{children:(0,H.jsx)(Ar,{children:(0,H.jsxs)(Or,{element:(0,H.jsx)(Iy,{}),children:[(0,H.jsx)(Or,{path:`/`,element:(0,H.jsx)(Er,{to:`/dashboard`,replace:!0})}),(0,H.jsx)(Or,{path:`/auth/pending`,element:(0,H.jsx)(Er,{to:`/dashboard`,replace:!0})}),(0,H.jsx)(Or,{path:`/login`,element:(0,H.jsx)(Er,{to:gy(),replace:!0})}),(0,H.jsxs)(Or,{element:(0,H.jsx)(Fy,{}),children:[(0,H.jsx)(Or,{path:`/dashboard`,element:(0,H.jsx)(Oy,{})}),(0,H.jsx)(Or,{path:`/reports`,element:(0,H.jsx)(ky,{})}),(0,H.jsx)(Or,{path:`/accounts`,element:(0,H.jsx)(Ay,{})}),(0,H.jsx)(Or,{path:`/automations`,element:(0,H.jsx)(jy,{})}),(0,H.jsx)(Or,{path:`/apis`,element:(0,H.jsx)(My,{})}),(0,H.jsx)(Or,{path:`/settings`,element:(0,H.jsx)(Ny,{})}),(0,H.jsx)(Or,{path:`/settings/access`,element:(0,H.jsx)(Py,{})})]}),(0,H.jsx)(Or,{path:`/firewall`,element:(0,H.jsx)(Er,{to:`/settings?advanced=1#firewall`,replace:!0})}),(0,H.jsx)(Or,{path:`*`,element:(0,H.jsx)(bh,{})})]})})})]})}function Ry(){return new ht({defaultOptions:{queries:{staleTime:3e4,retry:1,refetchOnWindowFocus:!1},mutations:{retry:0}}})}var zy=Ry(),By=[[`settings`,`upstream-proxy`],[`api-keys`],[`sticky-sessions`]];function Vy(e=zy){for(let t of By)e.removeQueries({queryKey:[...t]})}var Hy=[[`dashboard-users`],[`dashboard-roles`]];function Uy(e=zy){for(let t of Hy)e.removeQueries({queryKey:[...t]})}function Wy(e=zy){return B.subscribe((t,n)=>{n.canWrite&&!t.canWrite&&Vy(e);let r=st(n.permissions,`users:manage`)&&!st(t.permissions,`users:manage`),i=(n.user?.id??null)!==(t.user?.id??null);(r||i)&&Uy(e)})}var Gy=`codex-lb-account-burnrate-enabled`,Ky=`codex-lb-dashboard-account-view-mode`,qy=`codex-lb-dashboard-account-list-sort`,Jy=`codex-lb-dashboard-refresh-seconds`,Yy=[`account`,`status`,`plan`,`quota`,`subscriptionCredits`,`purchasedCredits`,`warmup`];function Xy(e){return typeof e==`string`&&Yy.includes(e)}function Zy(){if(typeof window>`u`)return null;let e=window.localStorage.getItem(Gy);return e===`true`||e!==`false`&&null}function Qy(){if(typeof window>`u`)return null;let e=window.localStorage.getItem(Ky);return e===`cards`||e===`list`?e:null}function $y(){if(typeof window>`u`)return null;let e=window.localStorage.getItem(qy);if(!e)return null;try{let t=JSON.parse(e);if(t.key===`credits`&&(t.key=`purchasedCredits`),Xy(t.key)&&(t.direction===`asc`||t.direction===`desc`))return{key:t.key,direction:t.direction}}catch{return null}return null}function eb(){if(typeof window>`u`)return null;let e=Number(window.localStorage.getItem(Jy));return e===5||e===15||e===30||e===60?e:null}function tb(e){typeof window<`u`&&window.localStorage.setItem(Gy,String(e))}function nb(e){typeof window<`u`&&window.localStorage.setItem(Ky,e)}function rb(e){typeof window<`u`&&(e===null?window.localStorage.removeItem(qy):window.localStorage.setItem(qy,JSON.stringify(e)))}function ib(e){typeof window<`u`&&window.localStorage.setItem(Jy,String(e))}var ab=we(e=>({accountBurnrateEnabled:!0,accountViewMode:`cards`,accountListSort:null,refreshSeconds:15,initialized:!1,initializePreferences:()=>{let t=Zy()??!0,n=Qy()??`cards`,r=$y(),i=eb()??15;tb(t),nb(n),rb(r),ib(i),e({accountBurnrateEnabled:t,accountViewMode:n,accountListSort:r,refreshSeconds:i,initialized:!0})},setAccountBurnrateEnabled:t=>{tb(t),e({accountBurnrateEnabled:t,initialized:!0})},setAccountViewMode:t=>{nb(t),e({accountViewMode:t,initialized:!0})},setAccountListSort:t=>{rb(t),e({accountListSort:t,initialized:!0})},setRefreshSeconds:t=>{ib(t),e({refreshSeconds:t,initialized:!0})}})),ob=!1;function sb(){if(ob||typeof Node!=`function`||!Node.prototype)return;ob=!0;let e=Node.prototype.removeChild,t=Node.prototype.insertBefore;Node.prototype.removeChild=function(t){return t.parentNode===this?e.call(this,t):(console.error(`Ignoring external DOM mutation before removeChild`,t,this),t)},Node.prototype.insertBefore=function(e,n){return n&&n.parentNode!==this?(console.error(`Ignoring external DOM mutation before insertBefore`,n,this),e):t.call(this,e,n)}}yy()||(sb(),Wy(),Y_.getState().initializeTheme(),ab.getState().initializePreferences(),(0,_t.createRoot)(document.getElementById(`root`)).render((0,H.jsx)(V.StrictMode,{children:(0,H.jsx)(a,{client:zy,children:(0,H.jsx)(gi,{children:(0,H.jsx)(Ly,{})})})})));export{Ng as $,na as $n,bf as $t,C_ as A,Qc as An,Yp as At,w_ as B,Za as Bn,Bf as Bt,$_ as C,al as Cn,qp as Ct,v_ as D,Yc as Dn,zp as Dt,l_ as E,Gc as En,im as Et,x_ as F,Ao as Fn,Up as Ft,$g as G,Va as Gn,Cf as Gt,j_ as H,qa as Hn,Vf as Ht,M_ as I,No as In,Wp as It,s_ as J,Ea as Jn,_f as Jt,d_ as K,Ia as Kn,xf as Kt,u_ as L,To as Ln,Gp as Lt,p_ as M,Zc as Mn,Hp as Mt,m_ as N,$c as Nn,em as Nt,r_ as O,qc as On,Rp as Ot,y_ as P,Kc as Pn,rm as Pt,jg as Q,ia as Qn,gf as Qt,n_ as R,za as Rn,Fp as Rt,ev as S,pl as Sn,Kp as St,A_ as T,vl as Tn,Zp as Tt,S_ as U,Ga as Un,Hf as Ut,o_ as V,no as Vn,Uf as Vt,k_ as W,to as Wn,Sf as Wt,Rg as X,va as Xn,ff as Xt,t_ as Y,Sa as Yn,vf as Yt,Mg as Z,ma as Zn,hf as Zt,Wv as _,ll as _n,nm as _t,Cy as a,cf as an,Pi as ar,_g as at,rv as b,cl as bn,$p as bt,uy as c,Q as cn,Zn as cr,eg as ct,hy as d,$l as dn,Ct as dr,Eh as dt,ef as en,Qi as er,Ag as et,vy as f,tl as fn,gh as ft,Gv as g,ul as gn,Qm as gt,Uv as h,ol as hn,Zm as ht,Sy as i,of as in,Ii as ir,hg as it,i_ as j,Xc as jn,Vp as jt,f_ as k,Jc as kn,Bp as kt,ly as l,md as ln,tr as lr,Oh as lt,Hv as m,nl as mn,ph as mt,Ty as n,lf as nn,Ki as nr,vg as nt,wy as o,tf as on,_i as or,gg as ot,qv as p,rl as pn,_h as pt,c_ as q,Aa as qn,uf as qt,xy as r,sf as rn,Bi as rr,mg as rt,by as s,Jd as sn,Er as sr,lg as st,ab as t,af as tn,Xi as tr,yg as tt,dy as u,id as un,Ci as ur,rg as ut,dv as v,fl as vn,Jp as vt,Y_ as w,el as wn,tm as wt,Q_ as x,ml as xn,Xp as xt,av as y,dl as yn,Qp as yt,a_ as z,io as zn,If as zt};