From 76a5d70004a2b538f0ff11b1753c920e2438ef54 Mon Sep 17 00:00:00 2001 From: I Luk Kim Date: Mon, 13 Apr 2026 10:20:37 -0700 Subject: [PATCH] =?UTF-8?q?Add=20"=EC=A7=80=EA=B8=88=20=EC=8B=9C=EC=9E=91"?= =?UTF-8?q?=20button=20for=20late-added=20ORB=20sessions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - GET /orb/sessions now returns ran_today boolean (true if daily_state.phase is set, meaning engine ran ORB detection for today) - POST /orb/sessions/{id}/run_today: fires ORB detection in background and injects remaining today-events (breakout, stop, EOD) into the live schedule - ORBAutoScheduler.run_session_now(): coroutine that runs detection then splices session's future events into self._today_schedule - Session card shows a cyan "지금 시작 (현재 가격 기준)" button when ran_today === false; hides it once detection has run Co-Authored-By: Claude Sonnet 4.6 --- apps/web/orb_trading_service.py | 53 ++ apps/web/routers/orb_trading.py | 403 +++++++++ apps/web/static/assets/index-C2901qKI.js | 131 --- apps/web/static/assets/index-CNWrJRnR.js | 133 +++ apps/web/static/index.html | 2 +- apps/web_frontend/src/api/client.ts | 338 ++++++++ apps/web_frontend/src/pages/OrbTrading.tsx | 913 +++++++++++++++++++++ 7 files changed, 1841 insertions(+), 132 deletions(-) create mode 100644 apps/web/routers/orb_trading.py delete mode 100644 apps/web/static/assets/index-C2901qKI.js create mode 100644 apps/web/static/assets/index-CNWrJRnR.js create mode 100644 apps/web_frontend/src/pages/OrbTrading.tsx diff --git a/apps/web/orb_trading_service.py b/apps/web/orb_trading_service.py index 92ad6e5..9352e4d 100644 --- a/apps/web/orb_trading_service.py +++ b/apps/web/orb_trading_service.py @@ -471,6 +471,59 @@ class ORBAutoScheduler: self._log(f" ERROR {session_name}: {exc}") log.error("ORB engine error: %s\n%s", exc, tb) + # ── Run-now: manually trigger detection for a late-added session ───────── + + async def run_session_now(self, session_name: str) -> dict[str, Any]: + """Run ORB detection immediately for a session that missed the morning window. + + After detection, injects the session's remaining today-events into the + active schedule so breakout checks, stop checks, and EOD exit still fire. + + Returns a summary dict or {"error": ""} on failure. + """ + from apps.orb_trader.state import ORBStateManager + + now_et = self._now_et() + today = now_et.date() + date_str = today.isoformat() + + state_mgr = ORBStateManager(self._db_path) + session = state_mgr.get_session(session_name) + if session is None: + return {"error": f"Session '{session_name}' not found"} + + # Already ran if daily_state.phase is set (engine wrote it during orb_detect) + daily = state_mgr.get_daily_state(session.session_id, date_str) + if daily.phase: + return {"error": f"Session '{session_name}' already ran today (phase={daily.phase})"} + + self._log(f"🔄 지금 시작: {session_name} — ORB 감지 실행 중 (현재 시세 기준)...") + + # Run detection now (blocking in thread so we don't stall the event loop) + await self._run_trading("orb_detect", [session_name], date_str) + + # Inject remaining future events into the live schedule + params = _load_session_params(self._db_path, session_name) + all_events = build_schedule(today, **params) + for ev in all_events: + ev["session"] = session_name + ev["name"] = f"{session_name}:{ev['name']}" + + existing_names = {e["name"] for e in self._today_schedule} + injected = 0 + for ev in all_events: + if ev["et_dt"] <= now_et: + # Past events: mark as completed so the loop skips them + self._completed.add(ev["name"]) + elif ev["name"] not in existing_names: + self._today_schedule.append(ev) + injected += 1 + + self._today_schedule.sort(key=lambda e: (e["et_dt"], e.get("session", ""))) + self._log(f"✓ {session_name}: {injected} 이벤트 추가됨 (오늘 남은 일정 포함)") + + return {"session": session_name, "injected": injected} + # ── Main scheduler loop ──────────────────────────────────────────────────── async def _run_loop(self) -> None: diff --git a/apps/web/routers/orb_trading.py b/apps/web/routers/orb_trading.py new file mode 100644 index 0000000..1183bb1 --- /dev/null +++ b/apps/web/routers/orb_trading.py @@ -0,0 +1,403 @@ +"""ORB Paper Trading API endpoints.""" +from __future__ import annotations + +import datetime as dt +import os +from typing import Any + +from fastapi import APIRouter, HTTPException +from pydantic import BaseModel + +router = APIRouter(prefix="/orb", tags=["orb-trading"]) + +# --------------------------------------------------------------------------- +# DB path resolution +# --------------------------------------------------------------------------- + +def _db_path() -> str: + from pathlib import Path + project_root = Path(__file__).parent.parent.parent.parent + env_path = os.environ.get("ORB_TRADER_DB", "data/paper/orb.db") + path = Path(env_path) if Path(env_path).is_absolute() else project_root / env_path + path.parent.mkdir(parents=True, exist_ok=True) + return str(path) + + +def _state() -> Any: + from apps.orb_trader.state import ORBStateManager + return ORBStateManager(_db_path()) + + +# --------------------------------------------------------------------------- +# Request/Response models +# --------------------------------------------------------------------------- + +class CreateSessionRequest(BaseModel): + name: str + config: str # config path (relative to project root) + capital: float = 10000.0 + + +class AutoStartRequest(BaseModel): + sessions: list[str] = [] + dry_run: bool = False + + +# --------------------------------------------------------------------------- +# Sessions +# --------------------------------------------------------------------------- + +@router.get("/sessions") +def list_sessions() -> dict[str, Any]: + state = _state() + sessions = state.list_sessions() + today = dt.date.today().isoformat() + results = [] + for s in sessions: + daily = state.get_daily_state(s.session_id, today) + ran_today = bool(daily.phase) # phase is set by engine on first run + results.append({ + "session_id": s.session_id, + "session_name": s.session_name, + "config_path": s.config_path, + "initial_equity": s.initial_equity, + "created_at": s.created_at, + "status": s.status, + "ran_today": ran_today, + }) + return {"sessions": results} + + +@router.post("/sessions") +def create_session(req: CreateSessionRequest) -> dict[str, Any]: + from pathlib import Path + import yaml + + project_root = Path(__file__).parent.parent.parent.parent + config_path = req.config if Path(req.config).is_absolute() else str(project_root / req.config) + + if not Path(config_path).exists(): + raise HTTPException(status_code=404, detail=f"Config not found: {config_path}") + + # Validate it's an ORB strategy config + try: + with open(config_path) as f: + raw = yaml.safe_load(f) + if raw.get("strategy_mode") != "orb": + raise HTTPException( + status_code=400, + detail=f"Config strategy_mode must be 'orb', got '{raw.get('strategy_mode')}'" + ) + except HTTPException: + raise + except Exception as e: + raise HTTPException(status_code=400, detail=f"Invalid config: {e}") + + state = _state() + # Check duplicate name + if state.get_session(req.name) is not None: + raise HTTPException(status_code=409, detail=f"Session '{req.name}' already exists") + + session_id = state.create_session(req.name, config_path, req.capital) + return { + "session_id": session_id, + "session_name": req.name, + "config_path": config_path, + "initial_equity": req.capital, + } + + +@router.get("/sessions/{session_id}") +def get_session(session_id: str) -> dict[str, Any]: + session = _state().get_session(session_id) + if session is None: + raise HTTPException(status_code=404, detail="Session not found") + equity = _state().get_equity(session.session_id) or session.initial_equity + return { + "session_id": session.session_id, + "session_name": session.session_name, + "config_path": session.config_path, + "initial_equity": session.initial_equity, + "current_equity": equity, + "total_return_pct": (equity - session.initial_equity) / session.initial_equity * 100, + "created_at": session.created_at, + "status": session.status, + } + + +@router.post("/sessions/{session_id}/pause") +def pause_session(session_id: str) -> dict[str, Any]: + state = _state() + session = state.get_session(session_id) + if session is None: + raise HTTPException(status_code=404, detail="Session not found") + state.set_session_status(session.session_id, "paused") + return {"session_id": session.session_id, "status": "paused"} + + +@router.post("/sessions/{session_id}/resume") +def resume_session(session_id: str) -> dict[str, Any]: + state = _state() + session = state.get_session(session_id) + if session is None: + raise HTTPException(status_code=404, detail="Session not found") + state.set_session_status(session.session_id, "active") + return {"session_id": session.session_id, "status": "active"} + + +@router.post("/sessions/{session_id}/run_today") +async def run_session_today(session_id: str) -> dict[str, Any]: + """Immediately run ORB detection for a session that missed the morning window. + + Requires the auto-scheduler to be running. After detection, the session's + remaining today-events (breakout checks, stop checks, EOD exit) are injected + into the live schedule automatically. + """ + import asyncio as _asyncio + from apps.web.orb_trading_service import orb_auto_scheduler + + state = _state() + session = state.get_session(session_id) + if session is None: + raise HTTPException(status_code=404, detail="Session not found") + + if not orb_auto_scheduler.running: + raise HTTPException( + status_code=400, + detail="스케줄러가 실행 중이 아닙니다. 먼저 자동 스케줄러를 시작하세요.", + ) + + # Fire-and-forget — detection takes ~1–2 min; we return immediately + _asyncio.create_task(orb_auto_scheduler.run_session_now(session.session_name)) + + return { + "session_id": session.session_id, + "session_name": session.session_name, + "status": "started", + "note": "ORB 감지가 백그라운드에서 시작되었습니다. 스케줄러 로그를 확인하세요.", + } + + +@router.delete("/sessions/{session_id}") +def close_session(session_id: str) -> dict[str, Any]: + state = _state() + session = state.get_session(session_id) + if session is None: + raise HTTPException(status_code=404, detail="Session not found") + + # Close all open Alpaca positions across all dates + positions_closed = 0 + close_errors: list[str] = [] + try: + from apps.paper_trader.alpaca_broker import AlpacaBroker + broker = AlpacaBroker.from_env() + open_pos = state.get_all_open_positions(session.session_id) + for pos in open_pos: + try: + # Always close only this session's shares (partial close if other + # sessions also hold the same ticker in the same Alpaca account) + broker.close_position(pos.ticker, qty=int(pos.shares)) + positions_closed += 1 + except Exception as e: + close_errors.append(f"{pos.ticker}: {e}") + except Exception as e: + # Broker init failed — refuse to delete so user can investigate + raise HTTPException(status_code=500, detail=f"Alpaca broker error: {e}") + + # Always delete the session; report any per-ticker failures in response + state.delete_session(session.session_id) + return { + "deleted": True, + "positions_closed": positions_closed, + "close_errors": close_errors, # empty list if all succeeded + } + + +# --------------------------------------------------------------------------- +# Data endpoints +# --------------------------------------------------------------------------- + +@router.get("/sessions/{session_id}/positions") +def get_positions(session_id: str) -> dict[str, Any]: + state = _state() + session = state.get_session(session_id) + if session is None: + raise HTTPException(status_code=404, detail="Session not found") + + today = dt.date.today().isoformat() + positions = state.get_open_positions(session.session_id, today) + + # Enrich with real-time prices from Oracle/Alpaca snapshot API + from libs.oracle_client.alpaca import get_snapshots, AlpacaSnapshot + snapshots: dict[str, AlpacaSnapshot] = {} + if positions: + tickers = [p.ticker for p in positions] + try: + snapshots = get_snapshots(tickers) + except Exception: + pass + + def _pos_to_dict(p: Any) -> dict[str, Any]: + snap = snapshots.get(p.ticker) + current_price = (snap.price if snap and snap.price else None) or p.entry_price + bid = snap.bid if snap else None + ask = snap.ask if snap else None + change_pct = snap.change_pct if snap else None + if p.direction == "long": + unrealized_pnl = (current_price - p.entry_price) * p.shares + r_multiple = (current_price - p.entry_price) / p.stop_distance if p.stop_distance > 0 else 0 + else: + unrealized_pnl = (p.entry_price - current_price) * p.shares + r_multiple = (p.entry_price - current_price) / p.stop_distance if p.stop_distance > 0 else 0 + return { + "ticker": p.ticker, + "direction": p.direction, + "entry_price": p.entry_price, + "entry_time": p.entry_time, + "shares": p.shares, + "current_stop": p.current_stop, + "peak_price": p.peak_price, + "trailing_active": p.trailing_active, + "atr_at_entry": p.atr_at_entry, + "stop_distance": p.stop_distance, + "rvol": p.rvol, + "composite_score": p.composite_score, + "current_price": current_price, + "bid": bid, + "ask": ask, + "change_pct": change_pct, + "unrealized_pnl": round(unrealized_pnl, 2), + "r_multiple": round(r_multiple, 3), + } + + return {"positions": [_pos_to_dict(p) for p in positions], "date": today} + + +@router.get("/sessions/{session_id}/trades") +def get_trades(session_id: str, last: int | None = None) -> dict[str, Any]: + state = _state() + session = state.get_session(session_id) + if session is None: + raise HTTPException(status_code=404, detail="Session not found") + trades = state.list_trades(session.session_id, limit=last) + return {"trades": trades, "total": len(trades)} + + +@router.get("/sessions/{session_id}/equity") +def get_equity(session_id: str) -> dict[str, Any]: + state = _state() + session = state.get_session(session_id) + if session is None: + raise HTTPException(status_code=404, detail="Session not found") + snapshots = state.list_snapshots(session.session_id) + return {"snapshots": snapshots, "initial_equity": session.initial_equity} + + +@router.get("/sessions/{session_id}/candidates") +def get_candidates(session_id: str) -> dict[str, Any]: + state = _state() + session = state.get_session(session_id) + if session is None: + raise HTTPException(status_code=404, detail="Session not found") + today = dt.date.today().isoformat() + candidates = state.list_candidates(session.session_id, today) + return {"candidates": candidates, "date": today} + + +# --------------------------------------------------------------------------- +# Auto scheduler +# --------------------------------------------------------------------------- + +@router.get("/auto") +def get_auto_status() -> dict[str, Any]: + from apps.web.orb_trading_service import orb_auto_scheduler + return orb_auto_scheduler.get_status() + + +@router.post("/auto/start") +async def start_auto(req: AutoStartRequest) -> dict[str, Any]: + from apps.web.orb_trading_service import orb_auto_scheduler + if orb_auto_scheduler.running: + raise HTTPException(status_code=409, detail="Scheduler already running") + try: + orb_auto_scheduler.start( + sessions=req.sessions, + db_path=_db_path(), + dry_run=req.dry_run, + ) + except Exception as e: + raise HTTPException(status_code=500, detail=str(e)) + return {"started": True, "dry_run": req.dry_run, "sessions": req.sessions} + + +@router.post("/auto/stop") +async def stop_auto() -> dict[str, Any]: + from apps.web.orb_trading_service import orb_auto_scheduler + orb_auto_scheduler.stop() + return {"stopped": True} + + +# --------------------------------------------------------------------------- +# Strategies — list ORB configs with config_path for session creation +# --------------------------------------------------------------------------- + +@router.get("/strategies") +def list_orb_strategies() -> dict[str, Any]: + """List all ORB strategy configs available for paper trading sessions. + + Returns both built-in presets and every *.yaml under + configs/intraday/strategies/ that has strategy_mode=orb. + Always includes config_path so the frontend can pass it to POST /sessions. + """ + from pathlib import Path + import yaml as _yaml + from apps.web.routers.intraday import _BUILTIN_STRATEGIES, get_project_root + + strategies: list[dict[str, Any]] = [] + + # 1. Built-in presets (always include, they are all ORB) + for strat in _BUILTIN_STRATEGIES.values(): + strategies.append({ + "slug": strat["slug"], + "name": strat["name"], + "description": strat.get("description", ""), + "builtin": True, + "config_path": strat["config_path"], + "orb_minutes": strat.get("orb_minutes"), + "sim_bar_minutes": strat.get("sim_bar_minutes"), + "entry_direction": strat.get("entry_direction", "long_only"), + "risk_per_trade_pct": strat.get("risk_per_trade_pct"), + "atr_stop_multiplier": strat.get("atr_stop_multiplier"), + }) + + # 2. YAMLs in configs/intraday/strategies/ not already listed as builtins + builtin_paths = {s["config_path"] for s in _BUILTIN_STRATEGIES.values()} + strategies_dir = Path(get_project_root()) / "configs" / "intraday" / "strategies" + if strategies_dir.exists(): + for yaml_file in sorted(strategies_dir.glob("*.yaml")): + rel_path = str(yaml_file.relative_to(get_project_root())) + if rel_path in builtin_paths: + continue + try: + raw = _yaml.safe_load(yaml_file.read_text()) or {} + if raw.get("strategy_mode") != "orb": + continue + meta = raw.get("_meta", {}) + orb = raw.get("orb_strategy", {}) + slug = yaml_file.stem + strategies.append({ + "slug": slug, + "name": meta.get("name", slug), + "description": meta.get("description", ""), + "builtin": False, + "config_path": rel_path, + "orb_minutes": orb.get("orb_minutes"), + "sim_bar_minutes": orb.get("sim_bar_minutes"), + "entry_direction": orb.get("entry_direction", "long_only"), + "risk_per_trade_pct": orb.get("risk_per_trade_pct"), + "atr_stop_multiplier": orb.get("atr_stop_multiplier"), + }) + except Exception: + continue + + return {"strategies": strategies} diff --git a/apps/web/static/assets/index-C2901qKI.js b/apps/web/static/assets/index-C2901qKI.js deleted file mode 100644 index 43e9324..0000000 --- a/apps/web/static/assets/index-C2901qKI.js +++ /dev/null @@ -1,131 +0,0 @@ -var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;li[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),u=(e=>typeof require<`u`?require:typeof Proxy<`u`?new Proxy(e,{get:(e,t)=>(typeof require<`u`?require:e)[t]}):e)(function(e){if(typeof require<`u`)return require.apply(this,arguments);throw Error('Calling `require` for "'+e+"\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.")});(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),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var d=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u{t.exports=d()})),p=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-Tt&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),m=o(((e,t)=>{t.exports=p()})),h=o((e=>{var t=f();function n(e){var t=`https://react.dev/errors/`+e;if(1{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=h()})),_=o((e=>{var t=m(),n=f(),r=g();function i(e){var t=`https://react.dev/errors/`+e;if(1R||(e.current=te[R],te[R]=null,R--)}function B(e,t){R++,te[R]=e.current,e.current=t}var re=ne(null),ie=ne(null),ae=ne(null),oe=ne(null);function se(e,t){switch(B(ae,t),B(ie,e),B(re,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?qd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=qd(t),e=Jd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}z(re),B(re,e)}function ce(){z(re),z(ie),z(ae)}function le(e){e.memoizedState!==null&&B(oe,e);var t=re.current,n=Jd(t,e.type);t!==n&&(B(ie,e),B(re,n))}function ue(e){ie.current===e&&(z(re),z(ie)),oe.current===e&&(z(oe),ip._currentValue=L)}var de,fe;function pe(e){if(de===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);de=t&&t[1]||``,fe=-1)`:-1i||c[r]!==l[i]){var u=` -`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(``)&&(u=u.replace(``,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{me=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?pe(n):``}function ge(e,t){switch(e.tag){case 26:case 27:case 5:return pe(e.type);case 16:return pe(`Lazy`);case 13:return e.child!==t&&t!==null?pe(`Suspense Fallback`):pe(`Suspense`);case 19:return pe(`SuspenseList`);case 0:case 15:return he(e.type,!1);case 11:return he(e.type.render,!1);case 1:return he(e.type,!0);case 31:return pe(`Activity`);default:return``}}function _e(e){try{var t=``,n=null;do t+=ge(e,n),n=e,e=e.return;while(e);return t}catch(e){return` -Error generating stack: `+e.message+` -`+e.stack}}var ve=Object.prototype.hasOwnProperty,ye=t.unstable_scheduleCallback,be=t.unstable_cancelCallback,xe=t.unstable_shouldYield,Se=t.unstable_requestPaint,Ce=t.unstable_now,we=t.unstable_getCurrentPriorityLevel,Te=t.unstable_ImmediatePriority,Ee=t.unstable_UserBlockingPriority,De=t.unstable_NormalPriority,Oe=t.unstable_LowPriority,ke=t.unstable_IdlePriority,Ae=t.log,je=t.unstable_setDisableYieldValue,Me=null,Ne=null;function Pe(e){if(typeof Ae==`function`&&je(e),Ne&&typeof Ne.setStrictMode==`function`)try{Ne.setStrictMode(Me,e)}catch{}}var Fe=Math.clz32?Math.clz32:Re,Ie=Math.log,Le=Math.LN2;function Re(e){return e>>>=0,e===0?32:31-(Ie(e)/Le|0)|0}var ze=256,Be=262144,Ve=4194304;function He(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ue(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=He(n))):i=He(o):i=He(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=He(n))):i=He(o)):i=He(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function We(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ge(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ke(){var e=Ve;return Ve<<=1,!(Ve&62914560)&&(Ve=4194304),e}function qe(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Je(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ye(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0`u`||window.document===void 0||window.document.createElement===void 0),cn=!1;if(sn)try{var ln={};Object.defineProperty(ln,`passive`,{get:function(){cn=!0}}),window.addEventListener(`test`,ln,ln),window.removeEventListener(`test`,ln,ln)}catch{cn=!1}var un=null,dn=null,fn=null;function pn(){if(fn)return fn;var e,t=dn,n=t.length,r,i=`value`in un?un.value:un.textContent,a=i.length;for(e=0;e=Gn),Jn=` `,Yn=!1;function Xn(e,t){switch(e){case`keyup`:return Un.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Zn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Qn=!1;function $n(e,t){switch(e){case`compositionend`:return Zn(t);case`keypress`:return t.which===32?(Yn=!0,Jn):null;case`textInput`:return e=t.data,e===Jn&&Yn?null:e;default:return null}}function er(e,t){if(Qn)return e===`compositionend`||!Wn&&Xn(e,t)?(e=pn(),fn=dn=un=null,Qn=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Sr(n)}}function wr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?wr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Tr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Pt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Pt(e.document)}return t}function Er(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Dr=sn&&`documentMode`in document&&11>=document.documentMode,Or=null,kr=null,Ar=null,jr=!1;function Mr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;jr||Or==null||Or!==Pt(r)||(r=Or,`selectionStart`in r&&Er(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Ar&&xr(Ar,r)||(Ar=r,r=jd(kr,`onSelect`),0>=o,i-=o,Si=1<<32-Fe(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),Ai&&wi(i,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),Ai&&wi(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return Ai&&wi(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),Ai&&wi(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===y&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case _:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===y){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&Ca(l)===r.type){n(e,r.sibling),c=a(r,o.props),Aa(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===y?(c=ui(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=li(o.type,o.key,o.props,null,e.mode,c),Aa(c,o),c.return=e,e=c)}return s(e);case v:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=pi(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=Ca(o),b(e,r,o,c)}if(ee(o))return h(e,r,o,c);if(M(o)){if(l=M(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,ka(o),c);if(o.$$typeof===C)return b(e,r,Qi(e,o),c);ja(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=di(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Oa=0;var i=b(e,t,n,r);return Da=null,i}catch(t){if(t===va||t===ba)throw t;var a=ai(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Na=Ma(!0),Pa=Ma(!1),Fa=!1;function Ia(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function La(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ra(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function za(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ll&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ni(e),ti(e,null,n),t}return Qr(e,r,t,n),ni(e)}function Ba(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ze(e,n)}}function Va(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ha=!1;function Ua(){if(Ha){var e=la;if(e!==null)throw e}}function Wa(e,t,n,r){Ha=!1;var i=e.updateQueue;Fa=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,m=f!==s.lane;if(m?(Bl&f)===f:(r&f)===f){f!==0&&f===ca&&(Ha=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,f);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,f=typeof h==`function`?h.call(_,d,f):h,f==null)break a;d=p({},d,f);break a;case 2:Fa=!0}}f=s.callback,f!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[f]:m.push(f))}else m={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=m,c=d):u=u.next=m,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;m=s,s=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Jl|=o,e.lanes=o,e.memoizedState=d}}function Ga(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function G(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ea?a:8;var o=F.T,s={};F.T=s,As(e,!1,t,n);try{var c=i(),l=F.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?ks(e,t,fa(c,r),gu(e)):ks(e,t,r,gu(e))}catch(n){ks(e,t,{then:function(){},status:`rejected`,reason:n},gu())}finally{I.p=a,o!==null&&s.types!==null&&(o.types=s.types),F.T=o}}function ys(){}function bs(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=xs(e).queue;vs(e,a,t,L,n===null?ys:function(){return Ss(e),n(r)})}function xs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:L,baseState:L,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:jo,lastRenderedState:L},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:jo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ss(e){var t=xs(e);t.next===null&&(t=e.alternate.memoizedState),ks(e,t.next.queue,{},gu())}function Cs(){return Zi(ip)}function ws(){return Eo().memoizedState}function Ts(){return Eo().memoizedState}function Es(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=gu();e=Ra(n);var r=za(t,e,n);r!==null&&(vu(r,t,n),Ba(r,t,n)),t={cache:ia()},e.payload=t;return}t=t.return}}function Ds(e,t,n){var r=gu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},js(e)?Ms(t,n):(n=$r(e,t,n,r),n!==null&&(vu(n,e,r),Ns(n,t,r)))}function Os(e,t,n){ks(e,t,n,gu())}function ks(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(js(e))Ms(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,br(s,o))return Qr(e,t,i,0),Rl===null&&V(),!1}catch{}if(n=$r(e,t,i,r),n!==null)return vu(n,e,r),Ns(n,t,r),!0}return!1}function As(e,t,n,r){if(r={lane:2,revertLane:hd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},js(e)){if(t)throw Error(i(479))}else t=$r(e,n,r,2),t!==null&&vu(t,e,2)}function js(e){var t=e.alternate;return e===q||t!==null&&t===q}function Ms(e,t){lo=co=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ns(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ze(e,n)}}var Ps={readContext:Zi,use:ko,useCallback:go,useContext:go,useEffect:go,useImperativeHandle:go,useLayoutEffect:go,useInsertionEffect:go,useMemo:go,useReducer:go,useRef:go,useState:go,useDebugValue:go,useDeferredValue:go,useTransition:go,useSyncExternalStore:go,useId:go,useHostTransitionStatus:go,useFormState:go,useActionState:go,useOptimistic:go,useMemoCache:go,useCacheRefresh:go};Ps.useEffectEvent=go;var Fs={readContext:Zi,use:ko,useCallback:function(e,t){return To().memoizedState=[e,t===void 0?null:t],e},useContext:Zi,useEffect:as,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),rs(4194308,4,ds.bind(null,t,e),n)},useLayoutEffect:function(e,t){return rs(4194308,4,e,t)},useInsertionEffect:function(e,t){rs(4,2,e,t)},useMemo:function(e,t){var n=To();t=t===void 0?null:t;var r=e();if(uo){Pe(!0);try{e()}finally{Pe(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=To();if(n!==void 0){var i=n(t);if(uo){Pe(!0);try{n(t)}finally{Pe(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Ds.bind(null,q,e),[r.memoizedState,e]},useRef:function(e){var t=To();return e={current:e},t.memoizedState=e},useState:function(e){e=Vo(e);var t=e.queue,n=Os.bind(null,q,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ps,useDeferredValue:function(e,t){return gs(To(),e,t)},useTransition:function(){var e=Vo(!1);return e=vs.bind(null,q,e.queue,!0,!1),To().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=q,a=To();if(Ai){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Rl===null)throw Error(i(349));Bl&127||Io(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,as(Ro.bind(null,r,o,e),[e]),r.flags|=2048,ts(9,{destroy:void 0},Lo.bind(null,r,o,n,t),null),n},useId:function(){var e=To(),t=Rl.identifierPrefix;if(Ai){var n=Ci,r=Si;n=(r&~(1<<32-Fe(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=fo++,0<\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[it]=t,o[at]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Bd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&kc(t)}}return Pc(t),Ac(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&kc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=ae.current,Li(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Oi,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[it]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Ld(e.nodeValue,n)),e||Pi(t,!0)}else e=Kd(e).createTextNode(r),e[it]=t,t.stateNode=e}return Pc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Li(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[it]=t}else Ri(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Pc(t),e=!1}else n=zi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(no(t),t):(no(t),null);if(t.flags&128)throw Error(i(558))}return Pc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Li(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[it]=t}else Ri(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Pc(t),a=!1}else a=zi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(no(t),t):(no(t),null)}return no(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Mc(t,t.updateQueue),Pc(t),null);case 4:return ce(),e===null&&Dd(t.stateNode.containerInfo),Pc(t),null;case 10:return Gi(t.type),Pc(t),null;case 19:if(z(ro),r=t.memoizedState,r===null)return Pc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Nc(r,!1);else{if(ql!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=io(e),o!==null){for(t.flags|=128,Nc(r,!1),e=o.updateQueue,t.updateQueue=e,Mc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ci(n,e),n=n.sibling;return B(ro,ro.current&1|2),Ai&&wi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ce()>iu&&(t.flags|=128,a=!0,Nc(r,!1),t.lanes=4194304)}else{if(!a)if(e=io(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Mc(t,e),Nc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Ai)return Pc(t),null}else 2*Ce()-r.renderingStartTime>iu&&n!==536870912&&(t.flags|=128,a=!0,Nc(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Pc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ce(),e.sibling=null,n=ro.current,B(ro,a?n&1|2:n&1),Ai&&wi(t,r.treeForkCount),e);case 22:case 23:return no(t),Ya(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Pc(t),t.subtreeFlags&6&&(t.flags|=8192)):Pc(t),n=t.updateQueue,n!==null&&Mc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&z(ma),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Gi(ra),Pc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Ic(e,t){switch(Ei(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Gi(ra),ce(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ue(t),null;case 31:if(t.memoizedState!==null){if(no(t),t.alternate===null)throw Error(i(340));Ri()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(no(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Ri()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return z(ro),null;case 4:return ce(),null;case 10:return Gi(t.type),null;case 22:case 23:return no(t),Ya(),e!==null&&z(ma),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Gi(ra),null;case 25:return null;default:return null}}function Lc(e,t){switch(Ei(t),t.tag){case 3:Gi(ra),ce();break;case 26:case 27:case 5:ue(t);break;case 4:ce();break;case 31:t.memoizedState!==null&&no(t);break;case 13:no(t);break;case 19:z(ro);break;case 10:Gi(t.type);break;case 22:case 23:no(t),Ya(),e!==null&&z(ma);break;case 24:Gi(ra)}}function Rc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Ju(t,t.return,e)}}function zc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Ju(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Ju(t,t.return,e)}}function Bc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{G(t,n)}catch(t){Ju(e,e.return,t)}}}function Vc(e,t,n){n.props=Hs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Ju(e,t,n)}}function Hc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Ju(e,t,n)}}function Uc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Ju(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Ju(e,t,n)}else n.current=null}function Wc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Ju(e,e.return,t)}}function Gc(e,t,n){try{var r=e.stateNode;Vd(r,e.type,n,t),r[at]=t}catch(t){Ju(e,e.return,t)}}function Kc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&rf(e.type)||e.tag===4}function qc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Kc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&rf(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Jc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Zt));else if(r!==4&&(r===27&&rf(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Jc(e,t,n),e=e.sibling;e!==null;)Jc(e,t,n),e=e.sibling}function Yc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&rf(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Yc(e,t,n),e=e.sibling;e!==null;)Yc(e,t,n),e=e.sibling}function Xc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Bd(t,r,n),t[it]=e,t[at]=n}catch(t){Ju(e,e.return,t)}}var Zc=!1,Qc=!1,$c=!1,el=typeof WeakSet==`function`?WeakSet:Set,tl=null;function nl(e,t){if(e=e.containerInfo,Wd=pp,e=Tr(e),Er(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Gd={focusedElem:e,selectionRange:n},pp=!1,tl=t;tl!==null;)if(t=tl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,tl=e;else for(;tl!==null;){switch(t=tl,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n title`))),Bd(o,r,n),o[it]=e,_t(o),r=o;break a;case`link`:var s=qf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;cg&&(o=g,g=h,h=o);var _=Cr(s,h),v=Cr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;sn?32:n,F.T=null,n=fu,fu=null;var o=cu,s=uu;if(su=0,lu=cu=null,uu=0,Ll&6)throw Error(i(331));var c=Ll;if(Ll|=4,Ml(o.current),wl(o,o.current,s,n),Ll=c,cd(0,!1),Ne&&typeof Ne.onPostCommitFiberRoot==`function`)try{Ne.onPostCommitFiberRoot(Me,o)}catch{}return!0}finally{I.p=a,F.T=r,Wu(e,t)}}function qu(e,t,n){t=H(n,t),t=Js(e.stateNode,t,2),e=za(e,t,2),e!==null&&(Je(e,2),sd(e))}function Ju(e,t,n){if(e.tag===3)qu(e,e,n);else for(;t!==null;){if(t.tag===3){qu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(ou===null||!ou.has(r))){e=H(n,e),n=Ys(2),r=za(t,n,2),r!==null&&(Xs(n,r,t,e),Je(r,2),sd(r));break}}t=t.return}}function Yu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Il;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Gl=!0,i.add(n),e=Xu.bind(null,e,t,n),t.then(e,e))}function Xu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Rl===e&&(Bl&n)===n&&(ql===4||ql===3&&(Bl&62914560)===Bl&&300>Ce()-nu?!(Ll&2)&&Tu(e,0):Xl|=n,Ql===Bl&&(Ql=0)),sd(e)}function Zu(e,t){t===0&&(t=Ke()),e=ei(e,t),e!==null&&(Je(e,t),sd(e))}function Qu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Zu(e,n)}function $u(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),Zu(e,n)}function ed(e,t){return ye(e,t)}var td=null,nd=null,rd=!1,id=!1,ad=!1,od=0;function sd(e){e!==nd&&e.next===null&&(nd===null?td=nd=e:nd=nd.next=e),id=!0,rd||(rd=!0,md())}function cd(e,t){if(!ad&&id){ad=!0;do for(var n=!1,r=td;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Fe(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,pd(r,a))}else a=Bl,a=Ue(r,r===Rl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||We(r,a)||(n=!0,pd(r,a));r=r.next}while(n);ad=!1}}function ld(){ud()}function ud(){id=rd=!1;var e=0;od!==0&&Zd()&&(e=od);for(var t=Ce(),n=null,r=td;r!==null;){var i=r.next,a=dd(r,t);a===0?(r.next=null,n===null?td=i:n.next=i,i===null&&(nd=n)):(n=r,(e!==0||a&3)&&(id=!0)),r=i}su!==0&&su!==5||cd(e,!1),od!==0&&(od=0)}function dd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0s)break;var u=c.transferSize,d=c.initiatorType;u&&Hd(d)&&(c=c.responseEnd,o+=u*(c`u`?null:document;function Df(e,t,n){var r=Ef;if(r&&typeof t==`string`&&t){var i=It(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),xf.has(i)||(xf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Bd(t,`link`,e),_t(t),r.head.appendChild(t)))}}function Of(e){Cf.D(e),Df(`dns-prefetch`,e,null)}function kf(e,t){Cf.C(e,t),Df(`preconnect`,e,t)}function Af(e,t,n){Cf.L(e,t,n);var r=Ef;if(r&&e&&t){var i=`link[rel="preload"][as="`+It(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+It(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+It(n.imageSizes)+`"]`)):i+=`[href="`+It(e)+`"]`;var a=i;switch(t){case`style`:a=If(e);break;case`script`:a=Bf(e)}bf.has(a)||(e=p({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),bf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Lf(a))||t===`script`&&r.querySelector(Vf(a))||(t=r.createElement(`link`),Bd(t,`link`,e),_t(t),r.head.appendChild(t)))}}function jf(e,t){Cf.m(e,t);var n=Ef;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+It(r)+`"][href="`+It(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Bf(e)}if(!bf.has(a)&&(e=p({rel:`modulepreload`,href:e},t),bf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Vf(a)))return}r=n.createElement(`link`),Bd(r,`link`,e),_t(r),n.head.appendChild(r)}}}function Mf(e,t,n){Cf.S(e,t,n);var r=Ef;if(r&&e){var i=gt(r).hoistableStyles,a=If(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Lf(a)))s.loading=5;else{e=p({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=bf.get(a))&&Wf(e,n);var c=o=r.createElement(`link`);_t(c),Bd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Uf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Nf(e,t){Cf.X(e,t);var n=Ef;if(n&&e){var r=gt(n).hoistableScripts,i=Bf(e),a=r.get(i);a||(a=n.querySelector(Vf(i)),a||(e=p({src:e,async:!0},t),(t=bf.get(i))&&Gf(e,t),a=n.createElement(`script`),_t(a),Bd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Pf(e,t){Cf.M(e,t);var n=Ef;if(n&&e){var r=gt(n).hoistableScripts,i=Bf(e),a=r.get(i);a||(a=n.querySelector(Vf(i)),a||(e=p({src:e,async:!0,type:`module`},t),(t=bf.get(i))&&Gf(e,t),a=n.createElement(`script`),_t(a),Bd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Ff(e,t,n,r){var a=(a=ae.current)?Sf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=If(n.href),n=gt(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=If(n.href);var o=gt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Lf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),bf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},bf.set(e,n),o||zf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Bf(n),n=gt(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function If(e){return`href="`+It(e)+`"`}function Lf(e){return`link[rel="stylesheet"][`+e+`]`}function Rf(e){return p({},e,{"data-precedence":e.precedence,precedence:null})}function zf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Bd(t,`link`,n),_t(t),e.head.appendChild(t))}function Bf(e){return`[src="`+It(e)+`"]`}function Vf(e){return`script[async]`+e}function Hf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+It(n.href)+`"]`);if(r)return t.instance=r,_t(r),r;var a=p({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),_t(r),Bd(r,`style`,a),Uf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=If(n.href);var o=e.querySelector(Lf(a));if(o)return t.state.loading|=4,t.instance=o,_t(o),o;r=Rf(n),(a=bf.get(a))&&Wf(r,a),o=(e.ownerDocument||e).createElement(`link`),_t(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Bd(o,`link`,r),t.state.loading|=4,Uf(o,n.precedence,e),t.instance=o;case`script`:return o=Bf(n.src),(a=e.querySelector(Vf(o)))?(t.instance=a,_t(a),a):(r=n,(a=bf.get(o))&&(r=p({},n),Gf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),_t(a),Bd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Uf(r,n.precedence,e));return t.instance}function Uf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o title`):null)}function Yf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Xf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Zf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=If(r.href),a=t.querySelector(Lf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=ep.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,_t(a);return}a=t.ownerDocument||t,r=Rf(r),(i=bf.get(i))&&Wf(r,i),a=a.createElement(`link`),_t(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Bd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=ep.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Qf=0;function $f(e,t){return e.stylesheets&&e.count===0&&np(e,e.stylesheets),0Qf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function ep(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)np(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var tp=null;function np(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,tp=new Map,t.forEach(rp,e),tp=null,ep.call(e))}function rp(e,t){if(!(t.state.loading&4)){var n=tp.get(e);if(n)var r=n.get(null);else{n=new Map,tp.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=_()})),y=l(f(),1),b=v(),x=`modulepreload`,S=function(e){return`/`+e},C={},w=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),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}))))}r=o(t.map(t=>{if(t=S(t,n),t in C)return;C[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:x,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}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)})},T=`popstate`;function E(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function D(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return M(``,{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:N(t)}return ee(t,n,null,e)}function O(e,t){if(e===!1||e==null)throw Error(t)}function k(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function A(){return Math.random().toString(36).substring(2,10)}function j(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function M(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?P(t):t,state:n,key:t&&t.key||r||A(),unstable_mask:i}}function N({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 P(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 ee(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=E(e)?e:M(h.location,e,t);n&&n(r,e),l=u()+1;let d=j(r,l),f=h.createHref(r.unstable_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=E(e)?e:M(h.location,e,t);n&&n(r,e),l=u();let i=j(r,l),d=h.createHref(r.unstable_mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return F(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(T,d),c=e,()=>{i.removeEventListener(T,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 F(e,t=!1){let n=`http://localhost`;typeof window<`u`&&(n=window.location.origin===`null`?window.location.href:window.location.origin),O(n,`No window.location.(origin|href) available to create URL`);let r=typeof e==`string`?e:N(e);return r=r.replace(/ $/,`%20`),!t&&r.startsWith(`//`)&&(r=n+r),new URL(r,n)}function I(e,t,n=`/`){return L(e,t,n,!1)}function L(e,t,n,r){let i=he((typeof t==`string`?P(t):t).pathname||`/`,n);if(i==null)return null;let a=R(e);z(a);let o=null;for(let e=0;o==null&&e{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;O(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=Ce([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(O(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),R(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:le(l,e.index),routesMeta:u})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of ne(e.path))a(e,t,!0,n)}),t}function ne(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=ne(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 z(e){e.sort((e,t)=>e.score===t.score?ue(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var B=/^:[\w-]+$/,re=3,ie=2,ae=1,oe=10,se=-2,ce=e=>e===`*`;function le(e,t){let n=e.split(`/`),r=n.length;return n.some(ce)&&(r+=se),t&&(r+=ie),n.filter(e=>!ce(e)).reduce((e,t)=>e+(B.test(t)?re:t===``?ae:oe),r)}function ue(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 de(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function pe(e,t=!1,n=!0){k(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 me(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return k(!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 he(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)||`/`}var ge=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function _e(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?P(e):e,a;return n?(n=n.replace(/\/\/+/g,`/`),a=n.startsWith(`/`)?ve(n.substring(1),`/`):ve(n,t)):a=t,{pathname:a,search:Te(r),hash:Ee(i)}}function ve(e,t){let n=t.replace(/\/+$/,``).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function ye(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 and the router will parse it for you.`}function be(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function xe(e){let t=be(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Se(e,t,n,r=!1){let i;typeof e==`string`?i=P(e):(i={...e},O(!i.pathname||!i.pathname.includes(`?`),ye(`?`,`pathname`,`search`,i)),O(!i.pathname||!i.pathname.includes(`#`),ye(`#`,`pathname`,`hash`,i)),O(!i.search||!i.search.includes(`#`),ye(`#`,`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=_e(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var Ce=e=>e.join(`/`).replace(/\/\/+/g,`/`),we=e=>e.replace(/\/+$/,``).replace(/^\/*/,`/`),Te=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Ee=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,De=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 Oe(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function ke(e){return e.map(e=>e.route.path).filter(Boolean).join(`/`).replace(/\/\/*/g,`/`)||`/`}var Ae=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function je(e,t){let n=e;if(typeof n!=`string`||!ge.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(Ae)try{let e=new URL(window.location.href),r=n.startsWith(`//`)?new URL(e.protocol+n):new URL(n),a=he(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{k(!1,` 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 Me=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(Me);var Ne=[`GET`,...Me];new Set(Ne);var Pe=y.createContext(null);Pe.displayName=`DataRouter`;var Fe=y.createContext(null);Fe.displayName=`DataRouterState`;var Ie=y.createContext(!1),Le=y.createContext({isTransitioning:!1});Le.displayName=`ViewTransition`;var Re=y.createContext(new Map);Re.displayName=`Fetchers`;var ze=y.createContext(null);ze.displayName=`Await`;var Be=y.createContext(null);Be.displayName=`Navigation`;var Ve=y.createContext(null);Ve.displayName=`Location`;var He=y.createContext({outlet:null,matches:[],isDataRoute:!1});He.displayName=`Route`;var Ue=y.createContext(null);Ue.displayName=`RouteError`;var We=`REACT_ROUTER_ERROR`,Ge=`REDIRECT`,Ke=`ROUTE_ERROR_RESPONSE`;function qe(e){if(e.startsWith(`${We}:${Ge}:{`))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 Je(e){if(e.startsWith(`${We}:${Ke}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new De(t.status,t.statusText,t.data)}catch{}}function Ye(e,{relative:t}={}){O(Xe(),`useHref() may be used only in the context of a component.`);let{basename:n,navigator:r}=y.useContext(Be),{hash:i,pathname:a,search:o}=rt(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:Ce([n,a])),r.createHref({pathname:s,search:o,hash:i})}function Xe(){return y.useContext(Ve)!=null}function Ze(){return O(Xe(),`useLocation() may be used only in the context of a component.`),y.useContext(Ve).location}var Qe=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function $e(e){y.useContext(Be).static||y.useLayoutEffect(e)}function et(){let{isDataRoute:e}=y.useContext(He);return e?St():tt()}function tt(){O(Xe(),`useNavigate() may be used only in the context of a component.`);let e=y.useContext(Pe),{basename:t,navigator:n}=y.useContext(Be),{matches:r}=y.useContext(He),{pathname:i}=Ze(),a=JSON.stringify(xe(r)),o=y.useRef(!1);return $e(()=>{o.current=!0}),y.useCallback((r,s={})=>{if(k(o.current,Qe),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=Se(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:Ce([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}y.createContext(null);function nt(){let{matches:e}=y.useContext(He),t=e[e.length-1];return t?t.params:{}}function rt(e,{relative:t}={}){let{matches:n}=y.useContext(He),{pathname:r}=Ze(),i=JSON.stringify(xe(n));return y.useMemo(()=>Se(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function it(e,t){return at(e,t)}function at(e,t,n){O(Xe(),`useRoutes() may be used only in the context of a component.`);let{navigator:r}=y.useContext(Be),{matches:i}=y.useContext(He),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||``;wt(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant (or called \`useRoutes()\`) at "${s}" (under ) 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. - -Please change the parent to .`)}let u=Ze(),d;if(t){let e=typeof t==`string`?P(t):t;O(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`\` 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=I(e,{pathname:p});k(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),k(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 with a null value by default resulting in an "empty" page.`);let h=ft(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:Ce([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:Ce([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?y.createElement(Ve.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,unstable_mask:void 0,...d},navigationType:`POP`}},h):h}function ot(){let e=xt(),t=Oe(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=y.createElement(y.Fragment,null,y.createElement(`p`,null,`💿 Hey developer 👋`),y.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,y.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,y.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),y.createElement(y.Fragment,null,y.createElement(`h2`,null,`Unexpected Application Error!`),y.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?y.createElement(`pre`,{style:i},n):null,o)}var st=y.createElement(ot,null),ct=class extends y.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=Je(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:y.createElement(He.Provider,{value:this.props.routeContext},y.createElement(Ue.Provider,{value:e,children:this.props.component}));return this.context?y.createElement(ut,{error:e},t):t}};ct.contextType=Ie;var lt=new WeakMap;function ut({children:e,error:t}){let{basename:n}=y.useContext(Be);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=qe(t.digest);if(e){let r=lt.get(t);if(r)throw r;let i=je(e.location,n);if(Ae&&!lt.get(t))if(i.isExternal||e.reloadDocument)window.location.href=i.absoluteURL||i.to;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw lt.set(t,n),n}return y.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${i.absoluteURL||i.to}`})}}return e}function dt({routeContext:e,match:t,children:n}){let r=y.useContext(Pe);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),y.createElement(He.Provider,{value:e},n)}function ft(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);O(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=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??{},unstable_pattern:ke(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||st,o&&(s<0&&c===0?(wt(`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?y.createElement(n.route.Component,null):n.route.element?n.route.element:e,y.createElement(dt,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?y.createElement(ct,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function pt(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function mt(e){let t=y.useContext(Pe);return O(t,pt(e)),t}function ht(e){let t=y.useContext(Fe);return O(t,pt(e)),t}function gt(e){let t=y.useContext(He);return O(t,pt(e)),t}function _t(e){let t=gt(e),n=t.matches[t.matches.length-1];return O(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function vt(){return _t(`useRouteId`)}function yt(){return ht(`useNavigation`).navigation}function bt(){let{matches:e,loaderData:t}=ht(`useMatches`);return y.useMemo(()=>e.map(e=>te(e,t)),[e,t])}function xt(){let e=y.useContext(Ue),t=ht(`useRouteError`),n=_t(`useRouteError`);return e===void 0?t.errors?.[n]:e}function St(){let{router:e}=mt(`useNavigate`),t=_t(`useNavigate`),n=y.useRef(!1);return $e(()=>{n.current=!0}),y.useCallback(async(r,i={})=>{k(n.current,Qe),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var Ct={};function wt(e,t,n){!t&&!Ct[e]&&(Ct[e]=!0,k(!1,n))}y.useOptimistic,y.memo(Tt);function Tt({routes:e,future:t,state:n,isStatic:r,onError:i}){return at(e,void 0,{state:n,isStatic:r,onError:i,future:t})}function Et(e){O(!1,`A is only ever to be used as the child of element, never rendered directly. Please wrap your in a .`)}function Dt({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,unstable_useTransitions:o}){O(!Xe(),`You cannot render a inside another . You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=y.useMemo(()=>({basename:s,navigator:i,static:a,unstable_useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=P(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,unstable_mask:m}=n,h=y.useMemo(()=>{let e=he(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,unstable_mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return k(h!=null,` is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the won't render anything.`),h==null?null:y.createElement(Be.Provider,{value:c},y.createElement(Ve.Provider,{children:t,value:h}))}function Ot({children:e,location:t}){return it(kt(e),t)}y.Component;function kt(e,t=[]){let n=[];return y.Children.forEach(e,(e,r)=>{if(!y.isValidElement(e))return;let i=[...t,r];if(e.type===y.Fragment){n.push.apply(n,kt(e.props.children,i));return}O(e.type===Et,`[${typeof e.type==`string`?e.type:e.type.name}] is not a component. All component children of must be a or `),O(!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=kt(e.props.children,i)),n.push(a)}),n}var At=`get`,jt=`application/x-www-form-urlencoded`;function Mt(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Nt(e){return Mt(e)&&e.tagName.toLowerCase()===`button`}function Pt(e){return Mt(e)&&e.tagName.toLowerCase()===`form`}function Ft(e){return Mt(e)&&e.tagName.toLowerCase()===`input`}function It(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Lt(e,t){return e.button===0&&(!t||t===`_self`)&&!It(e)}function Rt(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 zt(e,t){let n=Rt(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Bt=null;function Vt(){if(Bt===null)try{new FormData(document.createElement(`form`),0),Bt=!1}catch{Bt=!0}return Bt}var Ht=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Ut(e){return e!=null&&!Ht.has(e)?(k(!1,`"${e}" is not a valid \`encType\` for \`
\`/\`\` and will default to "${jt}"`),null):e}function Wt(e,t){let n,r,i,a,o;if(Pt(e)){let o=e.getAttribute(`action`);r=o?he(o,t):null,n=e.getAttribute(`method`)||At,i=Ut(e.getAttribute(`enctype`))||jt,a=new FormData(e)}else if(Nt(e)||Ft(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a + + + + {/* Schedule timeline — per-session rows */} +
+ {(() => { + // Group events by session + const sessionNames = Array.from(new Set(schedule.map((e: OrbScheduleEvent) => e.session))).filter(Boolean) as string[]; + + const renderSessionRow = (sessionName: string) => { + const sessionEvs = schedule.filter((e: OrbScheduleEvent) => e.session === sessionName); + const breakouts = sessionEvs.filter((e: OrbScheduleEvent) => e.kind === 'breakout'); + const displayed = sessionEvs.filter((ev: OrbScheduleEvent) => { + if (['orb_monitor', 'orb_detect', 'stop_check', 'eod_exit', 'post_close'].includes(ev.kind)) return true; + if (ev.kind === 'breakout') return ev === breakouts[0] || ev === breakouts[breakouts.length - 1]; + return false; + }); + const isNext = (ev: OrbScheduleEvent) => nextEvent && ev.name === nextEvent.name; + + return ( +
1 ? 8 : 0 }}> + {sessionNames.length > 1 && ( +
+ {sessionName} +
+ )} +
+ {displayed.map((ev: OrbScheduleEvent) => ( +
0 ? ` — ${fmtCountdown(ev.wait_secs)}` : ''}`} + style={{ + padding: '3px 7px', + borderRadius: 5, + fontSize: 10, + fontFamily: 'var(--font-mono)', + whiteSpace: 'nowrap', + background: ev.done + ? 'color-mix(in srgb, var(--green) 15%, transparent)' + : isNext(ev) + ? 'color-mix(in srgb, var(--cyan) 20%, transparent)' + : ev.kind === 'orb_monitor' + ? 'color-mix(in srgb, var(--yellow) 8%, transparent)' + : 'var(--bg2)', + color: ev.done ? 'var(--green)' : isNext(ev) ? 'var(--cyan)' : ev.kind === 'orb_monitor' ? 'color-mix(in srgb, var(--yellow) 70%, var(--text3))' : 'var(--text3)', + border: `1px solid ${ev.done ? 'var(--green)' : isNext(ev) ? 'var(--cyan)' : ev.kind === 'orb_monitor' ? 'color-mix(in srgb, var(--yellow) 30%, transparent)' : 'var(--border)'}`, + opacity: ev.kind === 'orb_monitor' && !ev.done && !isNext(ev) ? 0.65 : 1, + }} + > + {ev.et_time.replace(' ET', '')} + {ev.done && ' ✓'} + {ev.kind === 'breakout' && ev === breakouts[0] && breakouts.length > 1 && ( + + ~{breakouts[breakouts.length - 1]?.et_time?.replace(' ET', '')} + + )} +
+ ))} +
+
+ ); + }; + + return sessionNames.length > 0 ? sessionNames.map(renderSessionRow) : ( +
(스케줄 없음)
+ ); + })()} + {nextEvent && ( +
+ 다음: {nextEvent.label} + {' — '} +
+ )} +
+ + {/* Log */} +
+ + {showLog && ( +
+            {logLines.length > 0 ? logLines.join('\n') : '(로그 없음)'}
+          
+ )} +
+ + ); +} + +function fmtCountdown(seconds: number): string { + if (seconds <= 0) return 'now'; + const h = Math.floor(seconds / 3600); + const m = Math.floor((seconds % 3600) / 60); + const s = Math.floor(seconds % 60); + if (h > 0) return `${h}h ${String(m).padStart(2, '0')}m`; + if (m > 0) return `${m}m ${String(s).padStart(2, '0')}s`; + return `${s}s`; +} + +function Countdown({ seconds }: { seconds: number }) { + const [remaining, setRemaining] = useState(seconds); + useEffect(() => { + setRemaining(seconds); + const iv = setInterval(() => setRemaining(r => Math.max(0, r - 1)), 1000); + return () => clearInterval(iv); + }, [seconds]); + return {fmtCountdown(remaining)}; +} + +// ── Session Card ────────────────────────────────────────────────────────────── + +function SessionCard({ + session, + selected, + onSelect, + onDelete, + onPause, + onResume, + onRunToday, + runTodayPending, +}: { + session: OrbSession; + selected: boolean; + onSelect: () => void; + onDelete: () => void; + onPause: () => void; + onResume: () => void; + onRunToday: () => void; + runTodayPending: boolean; +}) { + const totalReturn = session.total_return_pct ?? 0; + const equity = session.current_equity ?? session.initial_equity; + + return ( +
+
+
+
+
+ {session.session_name} +
+
+ {session.status === 'active' ? '● active' : session.status === 'paused' ? '⏸ paused' : session.status} +
+
+
+
= 0 ? 'var(--green)' : 'var(--red)', fontFamily: 'var(--font-mono)' }}> + {fmtPct(totalReturn)} +
+
${fmt(equity)}
+
+
+ +
+ {session.config_path.split('/').pop()} +
+ + {/* "지금 시작" — only when this session hasn't run today */} + {session.ran_today === false && ( +
+ +
+ )} + +
e.stopPropagation()}> + {session.status === 'active' ? ( + + ) : ( + + )} + +
+
+
+ ); +} + +// ── Create Session Modal ────────────────────────────────────────────────────── + +function StrategyBadge({ label, value }: { label: string; value: string }) { + return ( + + {label}: {value} + + ); +} + +function CreateSessionModal({ onClose }: { onClose: () => void }) { + const qc = useQueryClient(); + const [name, setName] = useState(''); + const [selectedSlug, setSelectedSlug] = useState(''); + const [capital, setCapital] = useState('10000'); + + const { data: stratData, isLoading: straLoading } = useQuery({ + queryKey: ['orb-strategies'], + queryFn: orbTradingApi.strategies, + }); + + const strategies: OrbStrategyInfo[] = stratData?.strategies ?? []; + + // Auto-select first strategy when list loads + useEffect(() => { + if (!selectedSlug && strategies.length > 0) { + setSelectedSlug(strategies[0].slug); + } + }, [strategies, selectedSlug]); + + const selected = strategies.find(s => s.slug === selectedSlug) ?? null; + + const createMut = useMutation({ + mutationFn: () => { + if (!selected) throw new Error('전략을 선택하세요'); + return orbTradingApi.createSession(name, selected.config_path, parseFloat(capital)); + }, + onSuccess: () => { + qc.invalidateQueries({ queryKey: ['orb-sessions'] }); + onClose(); + }, + }); + + return ( +
+
e.stopPropagation()}> +

ORB 세션 생성

+ + {/* Session name */} +
+ + setName(e.target.value)} placeholder="예: v55_live" /> +
+ + {/* Strategy selector */} +
+ + {straLoading ? ( +
전략 목록 로딩 중...
+ ) : ( + + )} +
+ + {/* Strategy detail card */} + {selected && ( +
+ {selected.description && ( +
+ {selected.description} +
+ )} +
+ {selected.orb_minutes != null && ( + + )} + {selected.sim_bar_minutes != null && ( + + )} + {selected.entry_direction && ( + + )} + {selected.risk_per_trade_pct != null && ( + + )} + {selected.atr_stop_multiplier != null && ( + + )} +
+
+ {selected.config_path} +
+
+ )} + + {/* Capital */} +
+ + setCapital(e.target.value)} /> +
+ + {createMut.isError && ( +
+ {(createMut.error as Error).message} +
+ )} + +
+ + +
+
+
+ ); +} + +// ── Session Detail ──────────────────────────────────────────────────────────── + +function PositionsPanel({ sessionId }: { sessionId: string }) { + const { data, isLoading } = useQuery({ + queryKey: ['orb-positions', sessionId], + queryFn: () => orbTradingApi.positions(sessionId), + refetchInterval: 30000, + }); + + if (isLoading) return ; + const positions = data?.positions ?? []; + if (positions.length === 0) { + return ( +
+ 오늘 오픈 포지션 없음 ({data?.date ?? '—'}) +
+ ); + } + + return ( +
+ + + + {['티커', '방향', '진입가', '수량', '현재가', '변동%', '현재 스톱', 'R', '미실현 P&L', '트레일'].map(h => ( + + ))} + + + + {positions.map(pos => ( + + + + + + + + + + + + + ))} + +
{h}
{pos.ticker} + + {pos.direction === 'long' ? : } + {pos.direction.toUpperCase()} + + ${fmt(pos.entry_price)}{pos.shares}${fmt(pos.current_price)}= 0 ? 'var(--green)' : 'var(--red)' }}> + {pos.change_pct == null ? '—' : `${pos.change_pct >= 0 ? '+' : ''}${pos.change_pct.toFixed(2)}%`} + ${fmt(pos.current_stop)}= 0 ? 'var(--green)' : 'var(--red)' }}> + {pos.r_multiple >= 0 ? '+' : ''}{fmt(pos.r_multiple)}R + = 0 ? 'var(--green)' : 'var(--red)' }}> + {fmtDollars(pos.unrealized_pnl)} + + {pos.trailing_active ? '● 활성' : '—'} +
+
+ ); +} + +function CandidatesPanel({ sessionId }: { sessionId: string }) { + const { data } = useQuery({ + queryKey: ['orb-candidates', sessionId], + queryFn: () => orbTradingApi.candidates(sessionId), + refetchInterval: 60000, + }); + + const candidates = data?.candidates ?? []; + if (candidates.length === 0) { + return ( +
+ 오늘 ORB 후보 없음 +
+ ); + } + + return ( +
+ + + + {['티커', '방향', '돌파 레벨', 'ORB High', 'ORB Low', 'ATR', 'RVOL', 'Gap%', '점수', '상태'].map(h => ( + + ))} + + + + {candidates.map((c: any) => ( + + + + + + + + + + + + + ))} + +
{h}
{c.ticker} + + {c.direction === 'bullish' ? '▲ LONG' : '▼ SHORT'} + + ${fmt(c.breakout_level)}${fmt(c.orb_high)}${fmt(c.orb_low)}${fmt(c.atr, 3)}{fmt(c.rvol, 1)}x= 0 ? 'var(--green)' : 'var(--red)' }}> + {fmtPct(c.gap_pct * 100)} + {fmt(c.composite_score, 3)} + + {c.status} + +
+
+ ); +} + +function TradesPanel({ sessionId }: { sessionId: string }) { + const { data } = useQuery({ + queryKey: ['orb-trades', sessionId], + queryFn: () => orbTradingApi.trades(sessionId, 100), + refetchInterval: 60000, + }); + + const trades = data?.trades ?? []; + if (trades.length === 0) { + return
트레이드 이력 없음
; + } + + return ( +
+ + + + {['날짜', '티커', '방향', '진입가', '청산가', '수량', 'P&L', 'R', '사유'].map(h => ( + + ))} + + + + {trades.map((t: any) => ( + + + + + + + + + + + + ))} + +
{h}
{t.date}{t.ticker} + + {t.direction.toUpperCase()} + + ${fmt(t.entry_price)}${fmt(t.exit_price)}{t.shares}= 0 ? 'var(--green)' : 'var(--red)' }}> + {fmtDollars(t.pnl)} + = 0 ? 'var(--green)' : 'var(--red)' }}> + {t.r_multiple >= 0 ? '+' : ''}{fmt(t.r_multiple)}R + + + {t.exit_reason} + +
+
+ ); +} + +function EquityPanel({ sessionId, initialEquity }: { sessionId: string; initialEquity: number }) { + const { data } = useQuery({ + queryKey: ['orb-equity', sessionId], + queryFn: () => orbTradingApi.equity(sessionId), + refetchInterval: 60000, + }); + + const snapshots = data?.snapshots ?? []; + if (snapshots.length === 0) { + return
에쿼티 데이터 없음
; + } + + const chartData = [ + { date: '시작', equity: initialEquity }, + ...snapshots.map((s: any) => ({ date: s.date, equity: s.equity, pnl: s.daily_pnl })), + ]; + + const latest = snapshots[snapshots.length - 1]; + const totalReturn = ((latest.equity - initialEquity) / initialEquity) * 100; + + return ( +
+
+
+
총 수익률
+
= 0 ? 'var(--green)' : 'var(--red)' }}> + {fmtPct(totalReturn)} +
+
+
+
현재 자산
+
+ ${fmt(latest.equity)} +
+
+
+
최대 낙폭
+
+ {fmt(Math.min(...snapshots.map((s: any) => s.drawdown_pct)))}% +
+
+
+
총 트레이드
+
+ {snapshots.reduce((a: number, s: any) => a + s.trades_taken, 0)} +
+
+
+ + + + + + `$${v.toFixed(0)}`} /> + [`$${(v as number).toFixed(2)}`, '에쿼티']} + contentStyle={{ background: 'var(--bg1)', border: '1px solid var(--border)', borderRadius: 8, fontSize: 12 }} + /> + + + + +
+ ); +} + +// ── Main Page ───────────────────────────────────────────────────────────────── + +type TabKey = 'positions' | 'candidates' | 'trades' | 'equity'; + +export function OrbTradingPage() { + const qc = useQueryClient(); + const [selectedId, setSelectedId] = useState(null); + const [showCreate, setShowCreate] = useState(false); + const [activeTab, setActiveTab] = useState('positions'); + + const { data, isLoading, error } = useQuery({ + queryKey: ['orb-sessions'], + queryFn: orbTradingApi.sessions, + refetchInterval: 60000, + }); + + const pauseMut = useMutation({ + mutationFn: orbTradingApi.pauseSession, + onSuccess: () => qc.invalidateQueries({ queryKey: ['orb-sessions'] }), + }); + const resumeMut = useMutation({ + mutationFn: orbTradingApi.resumeSession, + onSuccess: () => qc.invalidateQueries({ queryKey: ['orb-sessions'] }), + }); + const runTodayMut = useMutation({ + mutationFn: orbTradingApi.runToday, + onSuccess: (result) => { + qc.invalidateQueries({ queryKey: ['orb-sessions'] }); + qc.invalidateQueries({ queryKey: ['orb-auto-status'] }); + alert(`${result.session_name}: ${result.note}`); + }, + onError: (e: Error) => alert(`지금 시작 실패: ${e.message}`), + }); + const deleteMut = useMutation({ + mutationFn: orbTradingApi.closeSession, + onSuccess: (result, id) => { + qc.invalidateQueries({ queryKey: ['orb-sessions'] }); + if (selectedId === id) setSelectedId(null); + if (result.close_errors && result.close_errors.length > 0) { + alert( + `세션 삭제 완료 (포지션 ${result.positions_closed}개 청산)\n\n` + + `청산 실패 (수동 처리 필요):\n${result.close_errors.join('\n')}` + ); + } + }, + onError: (e: Error) => alert(`세션 삭제 실패: ${e.message}`), + }); + + const sessions = data?.sessions ?? []; + const selectedSession = sessions.find(s => s.session_id === selectedId || s.session_name === selectedId); + + // Collect active session names for scheduler + const activeSessions = sessions.filter(s => s.status === 'active').map(s => s.session_name); + + if (isLoading) return
; + if (error) return
; + + const tabs: { key: TabKey; label: string }[] = [ + { key: 'positions', label: '포지션' }, + { key: 'candidates', label: 'ORB 후보' }, + { key: 'trades', label: '트레이드' }, + { key: 'equity', label: '에쿼티' }, + ]; + + return ( +
+ {/* Header */} +
+
+ +

+ ORB 인트라데이 트레이딩 +

+
+ +
+ + {/* Auto Scheduler */} + + + {/* Sessions grid */} +
+
+ 세션 ({sessions.length}) +
+ {sessions.length === 0 ? ( +
+ 세션이 없습니다. 위의 "세션 생성" 버튼으로 시작하세요. +
+ ) : ( +
+ {sessions.map(session => ( + setSelectedId(session.session_id)} + onDelete={() => { + if (window.confirm(`"${session.session_name}" 세션을 삭제하시겠습니까? 오픈 포지션이 청산됩니다.`)) { + deleteMut.mutate(session.session_id); + } + }} + onPause={() => pauseMut.mutate(session.session_id)} + onResume={() => resumeMut.mutate(session.session_id)} + onRunToday={() => { + if (window.confirm(`"${session.session_name}" 세션을 현재 가격 기준으로 지금 시작하시겠습니까?\n(스케줄러가 실행 중이어야 합니다)`)) { + runTodayMut.mutate(session.session_id); + } + }} + runTodayPending={runTodayMut.isPending && runTodayMut.variables === session.session_id} + /> + ))} +
+ )} +
+ + {/* Session detail */} + {selectedSession && ( +
+
+ + {selectedSession.session_name} + + + ${fmt(selectedSession.initial_equity)} → ${fmt(selectedSession.current_equity ?? selectedSession.initial_equity)} + +
+ + {/* Tabs */} +
+ {tabs.map(tab => ( + + ))} +
+ + {activeTab === 'positions' && } + {activeTab === 'candidates' && } + {activeTab === 'trades' && } + {activeTab === 'equity' && ( + + )} +
+ )} + + {showCreate && setShowCreate(false)} />} +
+ ); +}