From a934920d837ae6be4867b50468b6dbdd19199958 Mon Sep 17 00:00:00 2001 From: Jia Xie Date: Mon, 15 Jun 2026 16:20:36 -0700 Subject: [PATCH 01/14] feat(monitor): passive decode core (commands + feedback), store, listener - damiao_motor/monitor/decode.py: reverse MIT/POS_VEL/VEL/FORCE_POS commands and feedback frames; cmd-vs-feedback disambiguation via p16 offset + structural check; extended motor-type presets (incl. DM4310V/FLOW_WHEEL +/-pi variants). - store.py: auto-learned signal registry, per-signal ring buffers, cmd<->fb pairing, per-motor aggregate views. - listener.py: listen-only PassiveCanListener; best-effort CAN_RAW_LISTEN_ONLY; never calls bus.send (guaranteed structurally + by test). - tests/test_monitor.py: 10 round-trip + never-transmit tests (all green). - motor.py: fd defaults to False (non-breaking). - .gitignore: ship the built monitor SPA despite the build/ and dist/ rules. Co-Authored-By: Claude Opus 4.8 (1M context) --- .gitignore | 6 + damiao_motor/core/motor.py | 2 +- damiao_motor/monitor/__init__.py | 18 ++ damiao_motor/monitor/decode.py | 276 +++++++++++++++++++++++++++++++ damiao_motor/monitor/listener.py | 147 ++++++++++++++++ damiao_motor/monitor/store.py | 210 +++++++++++++++++++++++ tests/test_monitor.py | 197 ++++++++++++++++++++++ 7 files changed, 855 insertions(+), 1 deletion(-) create mode 100644 damiao_motor/monitor/__init__.py create mode 100644 damiao_motor/monitor/decode.py create mode 100644 damiao_motor/monitor/listener.py create mode 100644 damiao_motor/monitor/store.py create mode 100644 tests/test_monitor.py diff --git a/.gitignore b/.gitignore index 8e5c2ab..549c460 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,12 @@ dist/ *.egg damiao_motor/_version.py +# ...but DO ship the built monitor SPA (end users have no node toolchain). +# These negations override the unanchored build/ and dist/ rules above. +!damiao_motor/gui/webapp/dist/ +!damiao_motor/gui/webapp/dist/** +damiao_motor/gui/webapp/node_modules/ + # IDE / editor .vscode/ .idea/ diff --git a/damiao_motor/core/motor.py b/damiao_motor/core/motor.py index 40b9dcb..8e01e8f 100644 --- a/damiao_motor/core/motor.py +++ b/damiao_motor/core/motor.py @@ -279,7 +279,7 @@ def __init__( motor_id: int, feedback_id: int, bus: can.Bus, - fd: bool, + fd: bool = False, *, motor_type: str, p_min: Optional[float] = None, diff --git a/damiao_motor/monitor/__init__.py b/damiao_motor/monitor/__init__.py new file mode 100644 index 0000000..5dab150 --- /dev/null +++ b/damiao_motor/monitor/__init__.py @@ -0,0 +1,18 @@ +"""Passive (listen-only) monitoring for DaMiao motors. + +This subpackage decodes both command and feedback frames observed on a CAN bus while +another controller drives the motors, and never transmits anything itself. +""" + +from damiao_motor.monitor.decode import DecodedFrame, decode_frame, resolve_limits +from damiao_motor.monitor.listener import PassiveCanListener +from damiao_motor.monitor.store import SignalDescriptor, SignalStore + +__all__ = [ + "DecodedFrame", + "decode_frame", + "resolve_limits", + "PassiveCanListener", + "SignalStore", + "SignalDescriptor", +] diff --git a/damiao_motor/monitor/decode.py b/damiao_motor/monitor/decode.py new file mode 100644 index 0000000..13e05a5 --- /dev/null +++ b/damiao_motor/monitor/decode.py @@ -0,0 +1,276 @@ +"""Passive decode of DaMiao CAN frames — both commands and feedback. + +This module reverses the frame encoders in :mod:`damiao_motor.core.motor` so that a +listen-only observer can reconstruct what *another* controller is commanding on the +bus, alongside the motors' feedback. It never transmits anything. + +Frame layouts (little detail recap, see core/motor.py for the encoders): + +* MIT command arb = motor_id 16b pos | 12b vel | 12b kp | 12b kd | 12b torque +* POS_VEL command arb = 0x100 + motor_id (target_pos, vel_limit) +* VEL command arb = 0x200 + motor_id (target_vel) + 4 pad +* FORCE_POS command arb = 0x300 + motor_id (pos, vel*100, ratio*10000) +* special command arb = motor_id FF*7 + {FC enable, FD disable, FE zero, FB clear} +* feedback arb = motor_id + offset D0=(status<<4)|can_id, packed pos/vel/torque, D6/D7 temps +* register reply D1<=0x0F, D2==0x33, D3=rid + +Command and feedback share the low arbitration-id space, so they are disambiguated by +the feedback-id ``offset`` (e.g. the I2RT ``p16`` scheme uses ``motor_id + 16``) together +with the structural check ``data[0] & 0x0F == arb - offset``. +""" + +from __future__ import annotations + +import struct +from dataclasses import dataclass, field +from typing import Dict, Optional + +from damiao_motor.core.motor import ( + KD_MAX, + KD_MIN, + KP_MAX, + KP_MIN, + MOTOR_TYPE_PRESETS, + _STATE_NAME_MAP, + _decode_status_name, + is_register_reply, + uint_to_float, +) + +# Arbitration-id bases for the non-MIT control modes. +POS_VEL_BASE = 0x100 +VEL_BASE = 0x200 +FORCE_POS_BASE = 0x300 +REGISTER_ARB = 0x7FF + +# Default feedback-id offset: the I2RT "p16" receive mode (feedback arb = motor_id + 16), +# which is also the common DaMiao default. Configurable per listener. +DEFAULT_FEEDBACK_OFFSET = 16 + +# Valid DM status nibbles (used as a structural gate when classifying feedback frames). +KNOWN_STATUS = frozenset(_STATE_NAME_MAP.keys()) + +# Special single-byte command suffixes (data = FF*7 + suffix). +_SPECIAL_SUFFIX = { + 0xFC: "enable", + 0xFD: "disable", + 0xFE: "set_zero", + 0xFB: "clear_error", +} + +# Extended motor-type presets. We reuse the core presets (keyed "4310", "4340", ...) and +# add the "DM"-prefixed names plus the reduced-range variants used by third-party stacks +# (e.g. DM4310V / DM_FLOW_WHEEL use +/-pi rad position), so we can decode their traffic +# correctly without touching the core table. +_EXTRA_LIMIT_PARAM = { + # name: (pmax, vmax, tmax) -> symmetric +/- ranges + "DM4310": (12.5, 30, 10), + "DM4310V": (3.1415926, 30, 10), + "DM_FLOW_WHEEL": (3.1415926, 30, 10), + "DMH6215": (3.1415926, 30, 10), + "DMH6215MIT": (12.5, 45, 10), + "DM4340": (12.5, 10, 28), + "DM6248": (12.5, 20, 120), + "DM8009": (12.5, 45, 54), + "DM3507": (12.5, 50, 5), +} + + +def _preset_from_param(pmax: float, vmax: float, tmax: float) -> Dict[str, float]: + return { + "p_min": -pmax, + "p_max": pmax, + "v_min": -vmax, + "v_max": vmax, + "t_min": -tmax, + "t_max": tmax, + } + + +# Merged lookup: core presets first, then the extended/DM-prefixed names. +MONITOR_MOTOR_PRESETS: Dict[str, Dict[str, float]] = { + **MOTOR_TYPE_PRESETS, + **{name: _preset_from_param(*p) for name, p in _EXTRA_LIMIT_PARAM.items()}, +} + +DEFAULT_MOTOR_TYPE = "DM4310" + + +def resolve_limits(motor_type: str) -> Dict[str, float]: + """Resolve P/V/T limits for a motor type, tolerant of the ``DM`` name prefix. + + Falls back to :data:`DEFAULT_MOTOR_TYPE` for unknown names so a single unexpected + motor never breaks passive decoding of the rest of the bus. + """ + if motor_type in MONITOR_MOTOR_PRESETS: + return MONITOR_MOTOR_PRESETS[motor_type] + # tolerate "DM4310" <-> "4310" + alt = motor_type[2:] if motor_type.startswith("DM") else f"DM{motor_type}" + if alt in MONITOR_MOTOR_PRESETS: + return MONITOR_MOTOR_PRESETS[alt] + return MONITOR_MOTOR_PRESETS[DEFAULT_MOTOR_TYPE] + + +# Frame kinds. +KIND_COMMAND = "command" +KIND_FEEDBACK = "feedback" +KIND_SPECIAL = "special" +KIND_REGISTER = "register" +KIND_UNKNOWN = "unknown" + + +@dataclass +class DecodedFrame: + """A single passively-decoded CAN frame.""" + + t: float + arbitration_id: int + kind: str + motor_id: int + raw: bytes + mode: Optional[str] = None # MIT / POS_VEL / VEL / FORCE_POS for commands + fields: Dict[str, float] = field(default_factory=dict) + note: str = "" + + +def _u16_be(data: bytes, i: int) -> int: + return (data[i] << 8) | data[i + 1] + + +def _decode_mit(data: bytes, lim: Dict[str, float]) -> Dict[str, float]: + pos_u = (data[0] << 8) | data[1] + vel_u = (data[2] << 4) | (data[3] >> 4) + kp_u = ((data[3] & 0xF) << 8) | data[4] + kd_u = (data[5] << 4) | (data[6] >> 4) + torq_u = ((data[6] & 0xF) << 8) | data[7] + return { + "pos": uint_to_float(pos_u, lim["p_min"], lim["p_max"], 16), + "vel": uint_to_float(vel_u, lim["v_min"], lim["v_max"], 12), + "kp": uint_to_float(kp_u, KP_MIN, KP_MAX, 12), + "kd": uint_to_float(kd_u, KD_MIN, KD_MAX, 12), + "torque": uint_to_float(torq_u, lim["t_min"], lim["t_max"], 12), + } + + +def _decode_feedback(data: bytes, lim: Dict[str, float]) -> Dict[str, float]: + status = data[0] >> 4 + pos_int = (data[1] << 8) | data[2] + vel_int = (data[3] << 4) | (data[4] >> 4) + torq_int = ((data[4] & 0xF) << 8) | data[5] + return { + "status_code": float(status), + "pos": uint_to_float(pos_int, lim["p_min"], lim["p_max"], 16), + "vel": uint_to_float(vel_int, lim["v_min"], lim["v_max"], 12), + "torque": uint_to_float(torq_int, lim["t_min"], lim["t_max"], 12), + "t_mos": float(data[6]), + "t_rotor": float(data[7]), + } + + +def _looks_like_feedback(arb: int, data: bytes, offset: int) -> Optional[int]: + """Return the motor id if the frame looks like a feedback frame, else None.""" + mid = arb - offset + if 1 <= mid <= 15 and (data[0] & 0x0F) == mid and (data[0] >> 4) in KNOWN_STATUS: + return mid + return None + + +def decode_frame( + arbitration_id: int, + data: bytes, + t: float, + motor_types: Optional[Dict[int, str]] = None, + default_motor_type: str = DEFAULT_MOTOR_TYPE, + feedback_offset: int = DEFAULT_FEEDBACK_OFFSET, +) -> Optional[DecodedFrame]: + """Classify and decode one observed CAN frame. + + Args: + arbitration_id: 11-bit CAN id. + data: frame payload (must be 8 bytes to decode motor frames). + t: observation timestamp (seconds). + motor_types: optional per-motor-id motor type used to scale pos/vel/torque. + default_motor_type: fallback motor type when an id is not in ``motor_types``. + feedback_offset: feedback arb = motor_id + offset (16 for the I2RT p16 scheme). + + Returns: + A :class:`DecodedFrame`, or ``None`` if the frame can't be interpreted. + """ + motor_types = motor_types or {} + if len(data) != 8: + return None + + def lim_for(mid: int) -> Dict[str, float]: + return resolve_limits(motor_types.get(mid, default_motor_type)) + + # 1) Register reply (motor -> bus). Structural test, arb-independent. + if is_register_reply(data): + motor_id = data[0] | (data[1] << 8) + return DecodedFrame( + t=t, + arbitration_id=arbitration_id, + kind=KIND_REGISTER, + motor_id=motor_id, + raw=bytes(data), + fields={"rid": float(data[3])}, + note="register reply", + ) + + # 2) Special commands (FF*7 + suffix). + if data[:7] == b"\xff\xff\xff\xff\xff\xff\xff" and data[7] in _SPECIAL_SUFFIX: + return DecodedFrame( + t=t, + arbitration_id=arbitration_id, + kind=KIND_SPECIAL, + motor_id=arbitration_id, + raw=bytes(data), + note=_SPECIAL_SUFFIX[data[7]], + ) + + # 3) Non-MIT command modes by arbitration-id window. + if POS_VEL_BASE <= arbitration_id < POS_VEL_BASE + 0x100: + mid = arbitration_id - POS_VEL_BASE + pos, vel_limit = struct.unpack(" bus), via offset + structural check. + mid = _looks_like_feedback(arbitration_id, data, feedback_offset) + if mid is not None: + lim = lim_for(mid) + fb = _decode_feedback(data, lim) + status_name = _decode_status_name(int(fb["status_code"])) + return DecodedFrame(t, arbitration_id, KIND_FEEDBACK, mid, bytes(data), + fields=fb, note=status_name) + + # 5) Otherwise treat a low-id frame as an MIT command. + if 1 <= arbitration_id < POS_VEL_BASE: + lim = lim_for(arbitration_id) + return DecodedFrame(t, arbitration_id, KIND_COMMAND, arbitration_id, bytes(data), + mode="MIT", fields=_decode_mit(data, lim)) + + # 6) Register command space / anything else. + if arbitration_id == REGISTER_ARB: + return DecodedFrame(t, arbitration_id, KIND_REGISTER, + data[0] | (data[1] << 8), bytes(data), note="register cmd") + + return DecodedFrame(t, arbitration_id, KIND_UNKNOWN, arbitration_id, bytes(data)) diff --git a/damiao_motor/monitor/listener.py b/damiao_motor/monitor/listener.py new file mode 100644 index 0000000..0e59eb9 --- /dev/null +++ b/damiao_motor/monitor/listener.py @@ -0,0 +1,147 @@ +"""Listen-only CAN reader for passive monitoring. + +:class:`PassiveCanListener` opens its **own** ``can.Bus`` and decodes every frame it +sees, without ever transmitting. It is intended to run alongside another controller that +is actively driving the motors: + +* On ``socketcan`` every opened socket receives its own copy of the bus RX, so a second + listener does not steal frames from the running controller. +* ``receive_own_messages=False`` is requested, and ``CAN_RAW_LISTEN_ONLY`` is set on the + raw socket on a best-effort basis (python-can does not expose it) as defense-in-depth. + +The hard guarantee that we never perturb the bus is *structural*: this module imports +nothing that sends and never calls ``bus.send``. +""" + +from __future__ import annotations + +import threading +import time +from typing import Callable, Dict, Optional + +import can + +from damiao_motor.monitor.decode import ( + DEFAULT_FEEDBACK_OFFSET, + DEFAULT_MOTOR_TYPE, + DecodedFrame, + decode_frame, +) + +FrameCallback = Callable[[DecodedFrame], None] + + +def _try_set_listen_only(bus: "can.BusABC") -> bool: + """Best-effort: put the underlying socketcan raw socket into listen-only mode. + + Returns True if the option was applied. Never raises; on any failure the listener + still never transmits (it simply may ACK frames at the hardware level). + """ + sock = getattr(bus, "socket", None) + if sock is None: + return False + try: + import socket as _socket + + # CAN_RAW_LISTEN_ONLY is not always present in the socket module; fall back to + # the known constant value (6) used by the Linux SocketCAN raw protocol. + opt = getattr(_socket, "CAN_RAW_LISTEN_ONLY", 6) + level = getattr(_socket, "SOL_CAN_RAW", 101) + sock.setsockopt(level, opt, 1) + return True + except Exception: + return False + + +class PassiveCanListener: + def __init__( + self, + channel: str, + bustype: str = "socketcan", + bitrate: Optional[int] = None, + feedback_offset: int = DEFAULT_FEEDBACK_OFFSET, + motor_types: Optional[Dict[int, str]] = None, + default_motor_type: str = DEFAULT_MOTOR_TYPE, + on_frame: Optional[FrameCallback] = None, + ) -> None: + self.channel = channel + self.bustype = bustype + self.bitrate = bitrate + self.feedback_offset = feedback_offset + self.motor_types = dict(motor_types or {}) + self.default_motor_type = default_motor_type + self.on_frame = on_frame + + self.bus: Optional[can.BusABC] = None + self.listen_only_applied = False + self._thread: Optional[threading.Thread] = None + self._running = False + # diagnostics + self.frames_seen = 0 + self.decode_errors = 0 + + # ------------------------------------------------------------------- bus + def open(self) -> None: + bus_kwargs: Dict[str, object] = { + "channel": self.channel, + "interface": self.bustype, + "receive_own_messages": False, + } + if self.bitrate is not None: + bus_kwargs["bitrate"] = self.bitrate + self.bus = can.interface.Bus(**bus_kwargs) + self.listen_only_applied = _try_set_listen_only(self.bus) + + def start(self) -> None: + if self._running: + return + if self.bus is None: + self.open() + self._running = True + self._thread = threading.Thread( + target=self._loop, name=f"passive-listener-{self.channel}", daemon=True + ) + self._thread.start() + + def stop(self) -> None: + self._running = False + if self._thread is not None: + self._thread.join(timeout=0.5) + self._thread = None + if self.bus is not None: + try: + self.bus.shutdown() + except Exception: + pass + self.bus = None + + def set_motor_type(self, motor_id: int, motor_type: str) -> None: + self.motor_types[motor_id] = motor_type + + # ------------------------------------------------------------------ loop + def _loop(self) -> None: + assert self.bus is not None + while self._running: + try: + msg = self.bus.recv(timeout=0.1) + except Exception: + # bus closed / transient error; brief backoff then re-check _running + time.sleep(0.01) + continue + if msg is None: + continue + self.frames_seen += 1 + try: + frame = decode_frame( + msg.arbitration_id, + bytes(msg.data), + t=msg.timestamp or time.time(), + motor_types=self.motor_types, + default_motor_type=self.default_motor_type, + feedback_offset=self.feedback_offset, + ) + except Exception: + self.decode_errors += 1 + continue + if frame is not None and self.on_frame is not None: + self.on_frame(frame) diff --git a/damiao_motor/monitor/store.py b/damiao_motor/monitor/store.py new file mode 100644 index 0000000..5c4a32c --- /dev/null +++ b/damiao_motor/monitor/store.py @@ -0,0 +1,210 @@ +"""In-memory store for passively-observed signals. + +Ingests :class:`~damiao_motor.monitor.decode.DecodedFrame` objects and maintains: + +* an auto-learned **signal registry** (one entry per motor/source/field seen), +* a fixed-size **ring buffer** of ``(t, value)`` samples per signal, +* **cmd <-> feedback pairing** so the UI can overlay commanded vs. actual. + +Signal id format: ``"{bus}:m{motor_id}:{source}.{field}"`` e.g. ``"can_arm_l:m1:cmd.pos"``. +The ``pairKey`` ``"{bus}:m{motor_id}:{field}"`` links the cmd and feedback variants of the +same physical quantity. + +A single writer (the listener thread) calls :meth:`ingest`; readers (HTTP/WS handlers) +call the snapshot methods. All access is guarded by one lock. +""" + +from __future__ import annotations + +import threading +from collections import deque +from dataclasses import dataclass, field +from typing import Deque, Dict, List, Optional, Tuple + +from damiao_motor.monitor.decode import ( + DecodedFrame, + KIND_COMMAND, + KIND_FEEDBACK, +) + +# Per-source field whitelist -> the numeric channels worth plotting/tabulating. +_COMMAND_FIELDS = ("pos", "vel", "torque", "kp", "kd", "vel_limit", "torque_limit") +_FEEDBACK_FIELDS = ("pos", "vel", "torque", "t_mos", "t_rotor", "status_code") + +_UNITS = { + "pos": "rad", + "vel": "rad/s", + "torque": "Nm", + "kp": "", + "kd": "", + "vel_limit": "rad/s", + "torque_limit": "Nm", + "t_mos": "°C", + "t_rotor": "°C", + "status_code": "", +} + + +@dataclass +class SignalDescriptor: + """Metadata for one observable signal channel.""" + + id: str + bus: str + motor_id: int + source: str # "cmd" | "fb" + field: str + unit: str + pair_key: str + + def to_dict(self) -> Dict[str, object]: + return { + "id": self.id, + "bus": self.bus, + "motorId": self.motor_id, + "source": self.source, + "field": self.field, + "unit": self.unit, + "pairKey": self.pair_key, + } + + +@dataclass +class _Series: + desc: SignalDescriptor + buf: Deque[Tuple[float, float]] + last_value: float = 0.0 + last_t: float = 0.0 + count: int = 0 + + +@dataclass +class MotorView: + """Aggregated latest cmd + feedback for one motor, for the table/cards views.""" + + bus: str + motor_id: int + cmd: Dict[str, float] = field(default_factory=dict) + fb: Dict[str, float] = field(default_factory=dict) + mode: Optional[str] = None + status: str = "" + last_t: float = 0.0 + + +class SignalStore: + def __init__(self, bus_name: str, maxlen: int = 6000) -> None: + self.bus_name = bus_name + self._maxlen = maxlen + self._lock = threading.Lock() + self._series: Dict[str, _Series] = {} + self._motors: Dict[int, MotorView] = {} + # monotonically bumped whenever the registry (set of signals) changes, + # so clients can cheaply detect "new signals appeared". + self.registry_version = 0 + + # ------------------------------------------------------------------ ingest + def ingest(self, frame: DecodedFrame) -> None: + if frame.kind == KIND_COMMAND: + source, fields = "cmd", _COMMAND_FIELDS + elif frame.kind == KIND_FEEDBACK: + source, fields = "fb", _FEEDBACK_FIELDS + else: + return # special/register/unknown frames don't produce plottable signals + + with self._lock: + mv = self._motors.get(frame.motor_id) + if mv is None: + mv = MotorView(bus=self.bus_name, motor_id=frame.motor_id) + self._motors[frame.motor_id] = mv + mv.last_t = frame.t + if frame.kind == KIND_COMMAND: + mv.mode = frame.mode + mv.cmd = dict(frame.fields) + else: + mv.fb = dict(frame.fields) + mv.status = frame.note + + for fname in fields: + if fname not in frame.fields: + continue + value = float(frame.fields[fname]) + sid = f"{self.bus_name}:m{frame.motor_id}:{source}.{fname}" + series = self._series.get(sid) + if series is None: + series = _Series( + desc=SignalDescriptor( + id=sid, + bus=self.bus_name, + motor_id=frame.motor_id, + source=source, + field=fname, + unit=_UNITS.get(fname, ""), + pair_key=f"{self.bus_name}:m{frame.motor_id}:{fname}", + ), + buf=deque(maxlen=self._maxlen), + ) + self._series[sid] = series + self.registry_version += 1 + series.buf.append((frame.t, value)) + series.last_value = value + series.last_t = frame.t + series.count += 1 + + # --------------------------------------------------------------- snapshots + def list_signals(self) -> List[Dict[str, object]]: + with self._lock: + return [s.desc.to_dict() for s in self._series.values()] + + def pairs(self) -> List[Dict[str, object]]: + """Return cmd/feedback pairings that share a pairKey.""" + with self._lock: + by_pair: Dict[str, Dict[str, str]] = {} + for s in self._series.values(): + entry = by_pair.setdefault(s.desc.pair_key, {}) + entry[s.desc.source] = s.desc.id + return [ + {"pairKey": k, "cmd": v.get("cmd"), "fb": v.get("fb")} + for k, v in by_pair.items() + if "cmd" in v and "fb" in v + ] + + def series_since(self, signal_id: str, since_t: float) -> List[Tuple[float, float]]: + with self._lock: + s = self._series.get(signal_id) + if s is None: + return [] + return [pt for pt in s.buf if pt[0] > since_t] + + def series_last_n(self, signal_id: str, n: int) -> List[Tuple[float, float]]: + with self._lock: + s = self._series.get(signal_id) + if s is None: + return [] + if n <= 0 or n >= len(s.buf): + return list(s.buf) + return list(s.buf)[-n:] + + def latest(self, signal_ids: List[str]) -> Dict[str, Optional[float]]: + with self._lock: + return { + sid: (self._series[sid].last_value if sid in self._series else None) + for sid in signal_ids + } + + def motor_views(self) -> List[Dict[str, object]]: + with self._lock: + out = [] + for mid in sorted(self._motors): + mv = self._motors[mid] + out.append( + { + "bus": mv.bus, + "motorId": mv.motor_id, + "mode": mv.mode, + "status": mv.status, + "lastT": mv.last_t, + "cmd": mv.cmd, + "fb": mv.fb, + } + ) + return out diff --git a/tests/test_monitor.py b/tests/test_monitor.py new file mode 100644 index 0000000..10c41ad --- /dev/null +++ b/tests/test_monitor.py @@ -0,0 +1,197 @@ +"""Tests for the passive monitor: decode round-trips and the never-transmit guarantee.""" + +import struct +import time + +import can +import pytest + +from damiao_motor.core.motor import ( + DaMiaoMotor, + float_to_uint, +) +from damiao_motor.monitor.decode import ( + KIND_COMMAND, + KIND_FEEDBACK, + KIND_SPECIAL, + decode_frame, + resolve_limits, +) +from damiao_motor.monitor.listener import PassiveCanListener +from damiao_motor.monitor.store import SignalStore + +MOTOR_ID = 3 +MOTOR_TYPE = "4310" + + +def _motor(): + # bus is unused by the encode_* helpers, so None is fine here. + return DaMiaoMotor(motor_id=MOTOR_ID, feedback_id=MOTOR_ID + 16, bus=None, + motor_type=MOTOR_TYPE) + + +def _make_feedback_frame(motor_id, status, pos, vel, torq, t_mos, t_rotor, lim): + pos_u = float_to_uint(pos, lim["p_min"], lim["p_max"], 16) + vel_u = float_to_uint(vel, lim["v_min"], lim["v_max"], 12) + torq_u = float_to_uint(torq, lim["t_min"], lim["t_max"], 12) + return bytes([ + (status << 4) | (motor_id & 0x0F), + (pos_u >> 8) & 0xFF, + pos_u & 0xFF, + (vel_u >> 4) & 0xFF, + ((vel_u & 0xF) << 4) | ((torq_u >> 8) & 0xF), + torq_u & 0xFF, + t_mos & 0xFF, + t_rotor & 0xFF, + ]) + + +# --------------------------------------------------------------------- decode +def test_mit_command_roundtrip(): + m = _motor() + data = m.encode_cmd_msg(pos=1.25, vel=-2.0, torq=0.5, kp=40.0, kd=1.5) + frame = decode_frame(MOTOR_ID, data, t=0.0, motor_types={MOTOR_ID: MOTOR_TYPE}) + assert frame.kind == KIND_COMMAND and frame.mode == "MIT" + assert frame.motor_id == MOTOR_ID + assert frame.fields["pos"] == pytest.approx(1.25, abs=1e-3) + assert frame.fields["vel"] == pytest.approx(-2.0, abs=2e-2) + assert frame.fields["kp"] == pytest.approx(40.0, abs=0.2) + assert frame.fields["kd"] == pytest.approx(1.5, abs=1e-2) + assert frame.fields["torque"] == pytest.approx(0.5, abs=1e-2) + + +def test_pos_vel_command_roundtrip(): + data = struct.pack(" Date: Mon, 15 Jun 2026 16:25:03 -0700 Subject: [PATCH 02/14] feat(monitor): service + flask-sock WS transport + demo source - monitor/service.py: owns listener+store, raw-frame ring log, thread-safe snapshots, per-motor type override, optional demo source. - monitor/server.py: Flask REST (status/signals/snapshot/motor-types) + WS /stream (subscription-scoped, ~30Hz, per-signal decimation cap); serves built SPA with client-routing fallback + dev placeholder. - monitor/demo.py: synthetic cmd+feedback traffic (no CAN) for dev/screenshots/demo. - pyproject: add flask-sock dependency. Co-Authored-By: Claude Opus 4.8 (1M context) --- damiao_motor/monitor/demo.py | 82 ++++++++++++ damiao_motor/monitor/server.py | 223 ++++++++++++++++++++++++++++++++ damiao_motor/monitor/service.py | 151 +++++++++++++++++++++ pyproject.toml | 1 + 4 files changed, 457 insertions(+) create mode 100644 damiao_motor/monitor/demo.py create mode 100644 damiao_motor/monitor/server.py create mode 100644 damiao_motor/monitor/service.py diff --git a/damiao_motor/monitor/demo.py b/damiao_motor/monitor/demo.py new file mode 100644 index 0000000..558667f --- /dev/null +++ b/damiao_motor/monitor/demo.py @@ -0,0 +1,82 @@ +"""Synthetic traffic source for the passive monitor. + +Generates plausible command + feedback :class:`DecodedFrame` streams for a few motors +without any CAN hardware, so the dashboard can be developed, demoed, and screenshotted +anywhere. Feedback tracks the command with a small lag and noise, as a real motor would. +""" + +from __future__ import annotations + +import math +import threading +import time +from typing import Callable, List + +from damiao_motor.monitor.decode import ( + KIND_COMMAND, + KIND_FEEDBACK, + DecodedFrame, +) + +FrameCallback = Callable[[DecodedFrame], None] + + +class DemoSource: + def __init__(self, on_frame: FrameCallback, bus_name: str = "demo", + motor_ids: List[int] = (1, 2, 3), rate_hz: float = 100.0) -> None: + self.on_frame = on_frame + self.bus_name = bus_name + self.motor_ids = list(motor_ids) + self.rate_hz = rate_hz + self._running = False + self._thread = None + # crude per-motor first-order lag state for feedback + self._fb_pos = {m: 0.0 for m in self.motor_ids} + + def start(self) -> None: + if self._running: + return + self._running = True + self._thread = threading.Thread(target=self._loop, name="demo-source", daemon=True) + self._thread.start() + + def stop(self) -> None: + self._running = False + if self._thread is not None: + self._thread.join(timeout=0.5) + self._thread = None + + def _loop(self) -> None: + period = 1.0 / self.rate_hz + t0 = time.time() + while self._running: + now = time.time() + t = now - t0 + for i, mid in enumerate(self.motor_ids): + phase = i * 0.7 + freq = 0.25 + 0.15 * i + cmd_pos = 1.5 * math.sin(2 * math.pi * freq * t + phase) + cmd_vel = 1.5 * 2 * math.pi * freq * math.cos(2 * math.pi * freq * t + phase) + kp, kd = 60.0, 1.5 + # feedback lags the command and carries noise + load torque + lag = 0.15 + self._fb_pos[mid] += (cmd_pos - self._fb_pos[mid]) * lag + jitter = 0.01 * math.sin(37 * t + mid) + fb_pos = self._fb_pos[mid] + jitter + fb_vel = cmd_vel * 0.92 + 0.05 * math.sin(53 * t + mid) + fb_torq = kp * (cmd_pos - fb_pos) + 0.2 * math.sin(11 * t + mid) + t_mos = 32 + 3 * math.sin(0.1 * t + mid) + t_rotor = 35 + 4 * math.sin(0.08 * t + mid) + + self.on_frame(DecodedFrame( + t=now, arbitration_id=mid, kind=KIND_COMMAND, motor_id=mid, + raw=b"\x00" * 8, mode="MIT", + fields={"pos": cmd_pos, "vel": cmd_vel, "torque": 0.0, "kp": kp, "kd": kd}, + )) + self.on_frame(DecodedFrame( + t=now, arbitration_id=mid + 16, kind=KIND_FEEDBACK, motor_id=mid, + raw=b"\x00" * 8, note="ENABLED", + fields={"pos": fb_pos, "vel": fb_vel, "torque": fb_torq, + "t_mos": t_mos, "t_rotor": t_rotor, "status_code": 1.0}, + )) + time.sleep(period) diff --git a/damiao_motor/monitor/server.py b/damiao_motor/monitor/server.py new file mode 100644 index 0000000..d9e522d --- /dev/null +++ b/damiao_motor/monitor/server.py @@ -0,0 +1,223 @@ +"""Flask server for the passive monitor dashboard. + +Exposes a small REST surface plus a WebSocket stream (via ``flask-sock``) and serves the +built single-page app. The server is strictly passive — it only ever reads from the bus. + +Routes: + GET /api/monitor/status service + listener status + GET /api/monitor/signals registry: signals, cmd<->fb pairs, motor views + GET /api/monitor/snapshot?signals=&n= last-N samples (history backfill for a panel) + GET /api/monitor/motor-types known motor-type names + POST /api/monitor/motor-type {motorId, motorType} -> rescale decode for a motor + WS /api/monitor/stream realtime samples / motors / raw frames + GET / the SPA (built assets) or a dev placeholder +""" + +from __future__ import annotations + +import json +import logging +import os +import time +from typing import Optional + +from flask import Flask, jsonify, request, send_from_directory +from flask_sock import Sock + +from damiao_motor.monitor.service import MonitorService + +_WEBAPP_DIST = os.path.normpath( + os.path.join(os.path.dirname(__file__), "..", "gui", "webapp", "dist") +) + +# Per-tick safety cap on samples streamed per signal (decimation for very high rates). +_MAX_POINTS_PER_TICK = 240 + +_DEV_PLACEHOLDER = """ +DaMiao Monitor +

DaMiao Monitor

The dashboard bundle has not been built yet.

+

For development, run the Vite dev server:

+
cd damiao_motor/gui/webapp && npm install && npm run dev
+

and open the URL it prints (it proxies the API + WebSocket back here).

+

For a production bundle: npm run build, then reload this page.

+

The REST API is live now at /api/monitor/status.

""" + + +def create_app(service: MonitorService) -> Flask: + app = Flask(__name__) + sock = Sock(app) + app.config["service"] = service + + # ------------------------------------------------------------------ REST + @app.route("/api/monitor/status") + def status(): + return jsonify(service.status()) + + @app.route("/api/monitor/signals") + def signals(): + return jsonify(service.signals()) + + @app.route("/api/monitor/snapshot") + def snapshot(): + raw = request.args.get("signals", "") + ids = [s for s in raw.split(",") if s] + n = int(request.args.get("n", 600)) + return jsonify(service.snapshot(ids, n)) + + @app.route("/api/monitor/motor-types") + def motor_types(): + return jsonify({"types": service.available_motor_types()}) + + @app.route("/api/monitor/motor-type", methods=["POST"]) + def set_motor_type(): + data = request.get_json(force=True, silent=True) or {} + try: + motor_id = int(data["motorId"]) + motor_type = str(data["motorType"]) + except (KeyError, ValueError, TypeError): + return jsonify({"success": False, "error": "motorId and motorType required"}), 400 + service.set_motor_type(motor_id, motor_type) + return jsonify({"success": True}) + + # ------------------------------------------------------------- WebSocket + @sock.route("/api/monitor/stream") + def stream(ws): + subscribed: dict[str, float] = {} # signal id -> last-sent timestamp cursor + rate = 30.0 + raw_enabled = False + raw_cursor = 0 + last_version = -1 + period = 1.0 / rate + + def drain_control(): + nonlocal rate, raw_enabled, period + while True: + msg = ws.receive(timeout=0) + if msg is None: + break + try: + cmd = json.loads(msg) + except (ValueError, TypeError): + continue + ctype = cmd.get("type") + if ctype == "subscribe": + now = time.time() + new = {sid: now for sid in cmd.get("signals", [])} + # keep existing cursors for still-subscribed signals + for sid in list(new): + if sid in subscribed: + new[sid] = subscribed[sid] + subscribed.clear() + subscribed.update(new) + elif ctype == "rate": + try: + rate = max(1.0, min(120.0, float(cmd.get("value", 30)))) + period = 1.0 / rate + except (ValueError, TypeError): + pass + elif ctype == "raw": + raw_enabled = bool(cmd.get("enabled", False)) + + try: + while True: + drain_control() + + # registry / pairs only when it changes; motors every tick (cheap) + sig = service.signals() + if sig["version"] != last_version: + last_version = sig["version"] + ws.send(json.dumps({"type": "meta", **sig})) + ws.send(json.dumps({"type": "motors", "motors": sig["motors"], + "status": service.status()})) + + # sample batches for subscribed signals + batch = {} + for sid, cursor in list(subscribed.items()): + pts = service.store.series_since(sid, cursor) + if not pts: + continue + if len(pts) > _MAX_POINTS_PER_TICK: + stride = len(pts) // _MAX_POINTS_PER_TICK + 1 + pts = pts[::stride] + [pts[-1]] + batch[sid] = pts + subscribed[sid] = pts[-1][0] + if batch: + ws.send(json.dumps({"type": "samples", "data": batch})) + + if raw_enabled: + raw_cursor, items = service.raw_since(raw_cursor, limit=300) + if items: + ws.send(json.dumps({"type": "raw", "frames": items})) + + time.sleep(period) + except Exception: + # client disconnected or socket error: end the handler cleanly + return + + # ------------------------------------------------------------------- SPA + @app.route("/") + def index(): + idx = os.path.join(_WEBAPP_DIST, "index.html") + if os.path.exists(idx): + return send_from_directory(_WEBAPP_DIST, "index.html") + return _DEV_PLACEHOLDER + + @app.route("/") + def spa(path): + if path.startswith("api/"): + return jsonify({"error": "not found"}), 404 + full = os.path.join(_WEBAPP_DIST, path) + if os.path.exists(full) and os.path.isfile(full): + return send_from_directory(_WEBAPP_DIST, path) + # SPA client-side routing fallback + idx = os.path.join(_WEBAPP_DIST, "index.html") + if os.path.exists(idx): + return send_from_directory(_WEBAPP_DIST, "index.html") + return _DEV_PLACEHOLDER + + return app + + +def run_server( + host: str = "127.0.0.1", + port: int = 5001, + channel: str = "can0", + bustype: str = "socketcan", + bitrate: Optional[int] = None, + feedback_offset: int = 16, + default_motor_type: str = "DM4310", + debug: bool = False, + demo: bool = False, +) -> None: + """Start the passive monitor server (blocking).""" + service = MonitorService( + channel=channel, + bustype=bustype, + bitrate=bitrate, + feedback_offset=feedback_offset, + default_motor_type=default_motor_type, + demo=demo, + ) + service.start() + + app = create_app(service) + + print("Starting DaMiao Passive Monitor (listen-only)...") + if demo: + print(" DEMO mode: synthesizing motor traffic (no CAN bus opened)") + print(f" bus: {channel} ({bustype}) feedback offset: +{feedback_offset}") + if service.error: + print(f" WARNING: could not open bus: {service.error}") + elif not service.listener.listen_only_applied: + print(" note: hardware listen-only not applied (still never transmits)") + print(f" open http://{host}:{port} in your browser") + + if not debug: + logging.getLogger("werkzeug").setLevel(logging.ERROR) + try: + # threaded=True so the WS handler and HTTP requests run concurrently + app.run(host=host, port=port, debug=debug, threaded=True) + finally: + service.stop() diff --git a/damiao_motor/monitor/service.py b/damiao_motor/monitor/service.py new file mode 100644 index 0000000..981376a --- /dev/null +++ b/damiao_motor/monitor/service.py @@ -0,0 +1,151 @@ +"""Monitor service: wires a listen-only listener to a signal store + raw-frame log. + +Owns the lifecycle of a :class:`~damiao_motor.monitor.listener.PassiveCanListener` for a +single CAN bus and exposes thread-safe snapshots for the HTTP/WS layer in +:mod:`damiao_motor.monitor.server`. +""" + +from __future__ import annotations + +import threading +from collections import deque +from typing import Deque, Dict, List, Optional, Tuple + +from damiao_motor.monitor.decode import ( + DEFAULT_FEEDBACK_OFFSET, + DEFAULT_MOTOR_TYPE, + MONITOR_MOTOR_PRESETS, + DecodedFrame, +) +from damiao_motor.monitor.listener import PassiveCanListener +from damiao_motor.monitor.store import SignalStore + + +def _frame_to_log(seq: int, f: DecodedFrame) -> Dict[str, object]: + return { + "seq": seq, + "t": round(f.t, 6), + "arb": f.arbitration_id, + "kind": f.kind, + "mode": f.mode, + "motorId": f.motor_id, + "note": f.note, + "fields": {k: round(v, 4) for k, v in f.fields.items()}, + "raw": f.raw.hex(), + } + + +class MonitorService: + def __init__( + self, + channel: str, + bustype: str = "socketcan", + bitrate: Optional[int] = None, + feedback_offset: int = DEFAULT_FEEDBACK_OFFSET, + motor_types: Optional[Dict[int, str]] = None, + default_motor_type: str = DEFAULT_MOTOR_TYPE, + raw_log_size: int = 4000, + buffer_len: int = 6000, + demo: bool = False, + ) -> None: + self.channel = channel + self.bustype = bustype + self.bitrate = bitrate + self.default_motor_type = default_motor_type + self.demo = demo + self.store = SignalStore(bus_name=channel, maxlen=buffer_len) + + self._raw_lock = threading.Lock() + self._raw_log: Deque[Dict[str, object]] = deque(maxlen=raw_log_size) + self._raw_seq = 0 + + self.error: Optional[str] = None + self.started = False + + self.listener = PassiveCanListener( + channel=channel, + bustype=bustype, + bitrate=bitrate, + feedback_offset=feedback_offset, + motor_types=motor_types, + default_motor_type=default_motor_type, + on_frame=self._on_frame, + ) + self._demo_source = None + if demo: + from damiao_motor.monitor.demo import DemoSource + + self.store.bus_name = "demo" + self._demo_source = DemoSource(on_frame=self._on_frame, bus_name="demo") + + # ---------------------------------------------------------------- lifecycle + def start(self) -> None: + try: + if self._demo_source is not None: + self._demo_source.start() + else: + self.listener.start() + self.started = True + self.error = None + except Exception as exc: # surface to the UI rather than crashing the server + self.error = str(exc) + self.started = False + + def stop(self) -> None: + if self._demo_source is not None: + self._demo_source.stop() + else: + self.listener.stop() + self.started = False + + # ------------------------------------------------------------------ ingest + def _on_frame(self, frame: DecodedFrame) -> None: + self.store.ingest(frame) + with self._raw_lock: + self._raw_seq += 1 + self._raw_log.append(_frame_to_log(self._raw_seq, frame)) + + # --------------------------------------------------------------- accessors + def status(self) -> Dict[str, object]: + return { + "channel": self.channel, + "bustype": self.bustype, + "bitrate": self.bitrate, + "started": self.started, + "error": self.error, + "listenOnly": self.listener.listen_only_applied, + "feedbackOffset": self.listener.feedback_offset, + "framesSeen": self.listener.frames_seen, + "decodeErrors": self.listener.decode_errors, + "registryVersion": self.store.registry_version, + "defaultMotorType": self.default_motor_type, + "demo": self.demo, + } + + def signals(self) -> Dict[str, object]: + return { + "signals": self.store.list_signals(), + "pairs": self.store.pairs(), + "motors": self.store.motor_views(), + "version": self.store.registry_version, + } + + def snapshot(self, signal_ids: List[str], n: int) -> Dict[str, List[Tuple[float, float]]]: + return {sid: self.store.series_last_n(sid, n) for sid in signal_ids} + + def raw_since(self, since_seq: int, limit: int = 500) -> Tuple[int, List[Dict[str, object]]]: + with self._raw_lock: + if not self._raw_log: + return since_seq, [] + items = [r for r in self._raw_log if r["seq"] > since_seq] + if len(items) > limit: + items = items[-limit:] + new_seq = items[-1]["seq"] if items else since_seq + return new_seq, items + + def set_motor_type(self, motor_id: int, motor_type: str) -> None: + self.listener.set_motor_type(motor_id, motor_type) + + @staticmethod + def available_motor_types() -> List[str]: + return sorted(MONITOR_MOTOR_PRESETS.keys()) diff --git a/pyproject.toml b/pyproject.toml index 7ce9beb..085c001 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,6 +16,7 @@ keywords = ["damiao", "motor", "can", "robotics"] dependencies = [ "python-can>=4.3,<5.0", "flask>=3.0,<4.0", + "flask-sock>=0.7", "gs_usb>=0.3; sys_platform == 'darwin'", "pyusb>=1.2; sys_platform == 'darwin'", ] From 70459f8844e45f94af1fdcaabf9a5fa953eb7131 Mon Sep 17 00:00:00 2001 From: Jia Xie Date: Mon, 15 Jun 2026 16:42:24 -0700 Subject: [PATCH 03/14] feat(monitor): professional dockable realtime SPA (React/TS/Vite) Dashboard at damiao_motor/gui/webapp: - dockview (VS Code-style) panels: drag to dock/split/merge into tabs; layout persisted. - uPlot cmd-vs-actual plots: drag a signal chip onto a plot to add it; drop cmd onto fb to overlay (dashed=command, solid=feedback); per-plot time window; rAF render loop. - views: multi-motor table, per-motor cards/gauges (+motor-type override), virtualized raw decoded CAN log; toolbar adds more panels (user-expandable). - dnd-kit signal DnD kept disjoint from dockview tab DnD; Zustand registry + out-of-React ring buffers; WS client with auto-reconnect, subscription-scoped streaming, snapshot backfill on drop. - prebuilt bundle committed to dist/ (end users need no node toolchain). Fixes during bring-up: include series in uPlot options; hydrate plotConfigs synchronously (avoid TDZ on PLOT_KEY + effect-ordering race that wiped plot signals). Co-Authored-By: Claude Opus 4.8 (1M context) --- .../gui/webapp/dist/assets/index-BahOMQYE.css | 1 + .../gui/webapp/dist/assets/index-CStVIA4_.js | 46 + damiao_motor/gui/webapp/dist/index.html | 13 + damiao_motor/gui/webapp/index.html | 12 + damiao_motor/gui/webapp/package-lock.json | 2018 +++++++++++++++++ damiao_motor/gui/webapp/package.json | 30 + damiao_motor/gui/webapp/src/App.tsx | 63 + .../gui/webapp/src/components/Dock.tsx | 79 + .../gui/webapp/src/components/SignalChip.tsx | 29 + .../webapp/src/components/SignalSidebar.tsx | 67 + .../gui/webapp/src/components/Toolbar.tsx | 50 + damiao_motor/gui/webapp/src/index.css | 189 ++ damiao_motor/gui/webapp/src/lib/dataStore.ts | 156 ++ damiao_motor/gui/webapp/src/lib/dock.ts | 24 + damiao_motor/gui/webapp/src/lib/format.ts | 54 + damiao_motor/gui/webapp/src/lib/store.ts | 115 + damiao_motor/gui/webapp/src/lib/types.ts | 54 + damiao_motor/gui/webapp/src/lib/ws.ts | 117 + damiao_motor/gui/webapp/src/main.tsx | 10 + .../gui/webapp/src/panels/CardsPanel.tsx | 61 + .../gui/webapp/src/panels/PlotPanel.tsx | 198 ++ .../gui/webapp/src/panels/RawLogPanel.tsx | 88 + .../gui/webapp/src/panels/TablePanel.tsx | 67 + damiao_motor/gui/webapp/tsconfig.json | 20 + damiao_motor/gui/webapp/tsconfig.tsbuildinfo | 1 + damiao_motor/gui/webapp/vite.config.ts | 22 + 26 files changed, 3584 insertions(+) create mode 100644 damiao_motor/gui/webapp/dist/assets/index-BahOMQYE.css create mode 100644 damiao_motor/gui/webapp/dist/assets/index-CStVIA4_.js create mode 100644 damiao_motor/gui/webapp/dist/index.html create mode 100644 damiao_motor/gui/webapp/index.html create mode 100644 damiao_motor/gui/webapp/package-lock.json create mode 100644 damiao_motor/gui/webapp/package.json create mode 100644 damiao_motor/gui/webapp/src/App.tsx create mode 100644 damiao_motor/gui/webapp/src/components/Dock.tsx create mode 100644 damiao_motor/gui/webapp/src/components/SignalChip.tsx create mode 100644 damiao_motor/gui/webapp/src/components/SignalSidebar.tsx create mode 100644 damiao_motor/gui/webapp/src/components/Toolbar.tsx create mode 100644 damiao_motor/gui/webapp/src/index.css create mode 100644 damiao_motor/gui/webapp/src/lib/dataStore.ts create mode 100644 damiao_motor/gui/webapp/src/lib/dock.ts create mode 100644 damiao_motor/gui/webapp/src/lib/format.ts create mode 100644 damiao_motor/gui/webapp/src/lib/store.ts create mode 100644 damiao_motor/gui/webapp/src/lib/types.ts create mode 100644 damiao_motor/gui/webapp/src/lib/ws.ts create mode 100644 damiao_motor/gui/webapp/src/main.tsx create mode 100644 damiao_motor/gui/webapp/src/panels/CardsPanel.tsx create mode 100644 damiao_motor/gui/webapp/src/panels/PlotPanel.tsx create mode 100644 damiao_motor/gui/webapp/src/panels/RawLogPanel.tsx create mode 100644 damiao_motor/gui/webapp/src/panels/TablePanel.tsx create mode 100644 damiao_motor/gui/webapp/tsconfig.json create mode 100644 damiao_motor/gui/webapp/tsconfig.tsbuildinfo create mode 100644 damiao_motor/gui/webapp/vite.config.ts diff --git a/damiao_motor/gui/webapp/dist/assets/index-BahOMQYE.css b/damiao_motor/gui/webapp/dist/assets/index-BahOMQYE.css new file mode 100644 index 0000000..00a36d7 --- /dev/null +++ b/damiao_motor/gui/webapp/dist/assets/index-BahOMQYE.css @@ -0,0 +1 @@ +.dv-scrollable{position:relative;overflow:hidden}.dv-scrollable .dv-scrollbar-horizontal{position:absolute;bottom:0;left:0;height:4px;border-radius:2px;background-color:transparent;will-change:background-color,transform;transform:translateZ(0);backface-visibility:hidden;transition-property:background-color;transition-timing-function:ease-in-out;transition-duration:1s;transition-delay:0s}.dv-scrollable:hover .dv-scrollbar-horizontal,.dv-scrollable.dv-scrollable-resizing .dv-scrollbar-horizontal,.dv-scrollable.dv-scrollable-scrolling .dv-scrollbar-horizontal{background-color:var(--dv-scrollbar-background-color, rgba(255, 255, 255, .25))}.dv-svg{display:inline-block;fill:currentcolor;line-height:1;stroke:currentcolor;stroke-width:0}.dockview-theme-dark{--dv-paneview-active-outline-color: dodgerblue;--dv-tabs-and-actions-container-font-size: 13px;--dv-tabs-and-actions-container-height: 35px;--dv-drag-over-background-color: rgba(83, 89, 93, .5);--dv-drag-over-border-color: transparent;--dv-tabs-container-scrollbar-color: #888;--dv-icon-hover-background-color: rgba(90, 93, 94, .31);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, .5);--dv-overlay-z-index: 999;--dv-tab-font-size: inherit;--dv-border-radius: 0px;--dv-tab-margin: 0;--dv-sash-color: transparent;--dv-active-sash-color: transparent;--dv-active-sash-transition-duration: .1s;--dv-active-sash-transition-delay: .5s;--dv-group-view-background-color: #1e1e1e;--dv-tabs-and-actions-container-background-color: #252526;--dv-activegroup-visiblepanel-tab-background-color: #1e1e1e;--dv-activegroup-hiddenpanel-tab-background-color: #2d2d2d;--dv-inactivegroup-visiblepanel-tab-background-color: #1e1e1e;--dv-inactivegroup-hiddenpanel-tab-background-color: #2d2d2d;--dv-tab-divider-color: #1e1e1e;--dv-activegroup-visiblepanel-tab-color: white;--dv-activegroup-hiddenpanel-tab-color: #969696;--dv-inactivegroup-visiblepanel-tab-color: #8f8f8f;--dv-inactivegroup-hiddenpanel-tab-color: #626262;--dv-separator-border: rgb(68, 68, 68);--dv-paneview-header-border-color: rgba(204, 204, 204, .2)}.dockview-theme-dark .dv-drop-target-container .dv-drop-target-anchor.dv-drop-target-anchor-container-changed{opacity:0;transition:none}.dockview-theme-light{--dv-paneview-active-outline-color: dodgerblue;--dv-tabs-and-actions-container-font-size: 13px;--dv-tabs-and-actions-container-height: 35px;--dv-drag-over-background-color: rgba(83, 89, 93, .5);--dv-drag-over-border-color: transparent;--dv-tabs-container-scrollbar-color: #888;--dv-icon-hover-background-color: rgba(90, 93, 94, .31);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, .5);--dv-overlay-z-index: 999;--dv-tab-font-size: inherit;--dv-border-radius: 0px;--dv-tab-margin: 0;--dv-sash-color: transparent;--dv-active-sash-color: transparent;--dv-active-sash-transition-duration: .1s;--dv-active-sash-transition-delay: .5s;--dv-group-view-background-color: white;--dv-tabs-and-actions-container-background-color: #f3f3f3;--dv-activegroup-visiblepanel-tab-background-color: white;--dv-activegroup-hiddenpanel-tab-background-color: #ececec;--dv-inactivegroup-visiblepanel-tab-background-color: white;--dv-inactivegroup-hiddenpanel-tab-background-color: #ececec;--dv-tab-divider-color: white;--dv-activegroup-visiblepanel-tab-color: rgb(51, 51, 51);--dv-activegroup-hiddenpanel-tab-color: rgba(51, 51, 51, .7);--dv-inactivegroup-visiblepanel-tab-color: rgba(51, 51, 51, .7);--dv-inactivegroup-hiddenpanel-tab-color: rgba(51, 51, 51, .35);--dv-separator-border: rgba(128, 128, 128, .35);--dv-paneview-header-border-color: rgb(51, 51, 51);--dv-scrollbar-background-color: rgba(0, 0, 0, .25)}.dockview-theme-light .dv-drop-target-container .dv-drop-target-anchor.dv-drop-target-anchor-container-changed{opacity:0;transition:none}.dockview-theme-vs{--dv-paneview-active-outline-color: dodgerblue;--dv-tabs-and-actions-container-font-size: 13px;--dv-tabs-and-actions-container-height: 35px;--dv-drag-over-background-color: rgba(83, 89, 93, .5);--dv-drag-over-border-color: transparent;--dv-tabs-container-scrollbar-color: #888;--dv-icon-hover-background-color: rgba(90, 93, 94, .31);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, .5);--dv-overlay-z-index: 999;--dv-tab-font-size: inherit;--dv-border-radius: 0px;--dv-tab-margin: 0;--dv-sash-color: transparent;--dv-active-sash-color: transparent;--dv-active-sash-transition-duration: .1s;--dv-active-sash-transition-delay: .5s;--dv-group-view-background-color: #1e1e1e;--dv-tabs-and-actions-container-background-color: #252526;--dv-activegroup-visiblepanel-tab-background-color: #1e1e1e;--dv-activegroup-hiddenpanel-tab-background-color: #2d2d2d;--dv-inactivegroup-visiblepanel-tab-background-color: #1e1e1e;--dv-inactivegroup-hiddenpanel-tab-background-color: #2d2d2d;--dv-tab-divider-color: #1e1e1e;--dv-activegroup-hiddenpanel-tab-color: #969696;--dv-inactivegroup-visiblepanel-tab-color: #8f8f8f;--dv-inactivegroup-hiddenpanel-tab-color: #626262;--dv-separator-border: rgb(68, 68, 68);--dv-paneview-header-border-color: rgba(204, 204, 204, .2);--dv-tabs-and-actions-container-background-color: #2d2d30;--dv-tabs-and-actions-container-height: 20px;--dv-tabs-and-actions-container-font-size: 11px;--dv-activegroup-visiblepanel-tab-background-color: #007acc;--dv-inactivegroup-visiblepanel-tab-background-color: #3f3f46;--dv-activegroup-visiblepanel-tab-color: white;--dv-activegroup-hiddenpanel-tab-color: white;--dv-inactivegroup-visiblepanel-tab-color: white;--dv-inactivegroup-hiddenpanel-tab-color: white}.dockview-theme-vs .dv-drop-target-container .dv-drop-target-anchor.dv-drop-target-anchor-container-changed{opacity:0;transition:none}.dockview-theme-vs .dv-groupview.dv-active-group>.dv-tabs-and-actions-container{box-sizing:content-box;border-bottom:2px solid var(--dv-activegroup-visiblepanel-tab-background-color)}.dockview-theme-vs .dv-groupview.dv-active-group>.dv-tabs-and-actions-container .dv-tab.dv-active-tab{border-top:2px solid var(--dv-activegroup-visiblepanel-tab-background-color)}.dockview-theme-vs .dv-groupview.dv-active-group>.dv-tabs-and-actions-container .dv-tab.dv-inactive-tab{border-top:2px solid var(--dv-activegroup-hiddenpanel-tab-background-color)}.dockview-theme-vs .dv-groupview.dv-inactive-group>.dv-tabs-and-actions-container{box-sizing:content-box;border-bottom:2px solid var(--dv-inactivegroup-visiblepanel-tab-background-color)}.dockview-theme-vs .dv-groupview.dv-inactive-group>.dv-tabs-and-actions-container .dv-tab.dv-active-tab{border-top:2px solid var(--dv-inactivegroup-visiblepanel-tab-background-color)}.dockview-theme-vs .dv-groupview.dv-inactive-group>.dv-tabs-and-actions-container .dv-tab.dv-inactive-tab{border-top:2px solid var(--dv-inactivegroup-hiddenpanel-tab-background-color)}.dockview-theme-abyss{--dv-paneview-active-outline-color: dodgerblue;--dv-tabs-and-actions-container-font-size: 13px;--dv-tabs-and-actions-container-height: 35px;--dv-drag-over-background-color: rgba(83, 89, 93, .5);--dv-drag-over-border-color: transparent;--dv-tabs-container-scrollbar-color: #888;--dv-icon-hover-background-color: rgba(90, 93, 94, .31);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, .5);--dv-overlay-z-index: 999;--dv-tab-font-size: inherit;--dv-border-radius: 0px;--dv-tab-margin: 0;--dv-sash-color: transparent;--dv-active-sash-color: transparent;--dv-active-sash-transition-duration: .1s;--dv-active-sash-transition-delay: .5s;--dv-color-abyss-dark: #000c18;--dv-color-abyss: #10192c;--dv-color-abyss-light: #1c1c2a;--dv-color-abyss-lighter: #2b2b4a;--dv-color-abyss-accent: rgb(91, 30, 207);--dv-color-abyss-primary-text: white;--dv-color-abyss-secondary-text: rgb(148, 151, 169);--dv-group-view-background-color: var(--dv-color-abyss-dark);--dv-tabs-and-actions-container-background-color: var( --dv-color-abyss-light );--dv-activegroup-visiblepanel-tab-background-color: var( --dv-color-abyss-dark );--dv-activegroup-hiddenpanel-tab-background-color: var(--dv-color-abyss);--dv-inactivegroup-visiblepanel-tab-background-color: var( --dv-color-abyss-dark );--dv-inactivegroup-hiddenpanel-tab-background-color: var(--dv-color-abyss);--dv-tab-divider-color: var(--dv-color-abyss-lighter);--dv-activegroup-visiblepanel-tab-color: white;--dv-activegroup-hiddenpanel-tab-color: rgba(255, 255, 255, .5);--dv-inactivegroup-visiblepanel-tab-color: rgba(255, 255, 255, .5);--dv-inactivegroup-hiddenpanel-tab-color: rgba(255, 255, 255, .25);--dv-separator-border: var(--dv-color-abyss-lighter);--dv-paneview-header-border-color: var(--dv-color-abyss-lighter);--dv-paneview-active-outline-color: #596f99}.dockview-theme-abyss .dv-drop-target-container .dv-drop-target-anchor.dv-drop-target-anchor-container-changed{opacity:0;transition:none}.dockview-theme-dracula{--dv-paneview-active-outline-color: dodgerblue;--dv-tabs-and-actions-container-font-size: 13px;--dv-tabs-and-actions-container-height: 35px;--dv-drag-over-background-color: rgba(83, 89, 93, .5);--dv-drag-over-border-color: transparent;--dv-tabs-container-scrollbar-color: #888;--dv-icon-hover-background-color: rgba(90, 93, 94, .31);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, .5);--dv-overlay-z-index: 999;--dv-tab-font-size: inherit;--dv-border-radius: 0px;--dv-tab-margin: 0;--dv-sash-color: transparent;--dv-active-sash-color: transparent;--dv-active-sash-transition-duration: .1s;--dv-active-sash-transition-delay: .5s;--dv-group-view-background-color: #282a36;--dv-tabs-and-actions-container-background-color: #191a21;--dv-activegroup-visiblepanel-tab-background-color: #282a36;--dv-activegroup-hiddenpanel-tab-background-color: #21222c;--dv-inactivegroup-visiblepanel-tab-background-color: #282a36;--dv-inactivegroup-hiddenpanel-tab-background-color: #21222c;--dv-tab-divider-color: #191a21;--dv-activegroup-visiblepanel-tab-color: rgb(248, 248, 242);--dv-activegroup-hiddenpanel-tab-color: rgb(98, 114, 164);--dv-inactivegroup-visiblepanel-tab-color: rgba(248, 248, 242, .5);--dv-inactivegroup-hiddenpanel-tab-color: rgba(98, 114, 164, .5);--dv-separator-border: #bd93f9;--dv-paneview-header-border-color: #bd93f9;--dv-paneview-active-outline-color: #6272a4}.dockview-theme-dracula .dv-drop-target-container .dv-drop-target-anchor.dv-drop-target-anchor-container-changed{opacity:0;transition:none}.dockview-theme-dracula .dv-groupview.dv-active-group>.dv-tabs-and-actions-container .dv-tabs-container>.dv-tab.dv-active-tab{position:relative}.dockview-theme-dracula .dv-groupview.dv-active-group>.dv-tabs-and-actions-container .dv-tabs-container>.dv-tab.dv-active-tab:after{position:absolute;left:0;top:0;content:"";width:100%;height:1px;background-color:#94527e;z-index:999}.dockview-theme-dracula .dv-groupview.dv-inactive-group>.dv-tabs-and-actions-container .dv-tabs-container>.dv-tab.dv-active-tab{position:relative}.dockview-theme-dracula .dv-groupview.dv-inactive-group>.dv-tabs-and-actions-container .dv-tabs-container>.dv-tab.dv-active-tab:after{position:absolute;left:0;bottom:0;content:"";width:100%;height:1px;background-color:#5e3d5a;z-index:999}.dockview-theme-replit{--dv-paneview-active-outline-color: dodgerblue;--dv-tabs-and-actions-container-font-size: 13px;--dv-tabs-and-actions-container-height: 35px;--dv-drag-over-background-color: rgba(83, 89, 93, .5);--dv-drag-over-border-color: transparent;--dv-tabs-container-scrollbar-color: #888;--dv-icon-hover-background-color: rgba(90, 93, 94, .31);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, .5);--dv-overlay-z-index: 999;--dv-tab-font-size: inherit;--dv-border-radius: 0px;--dv-tab-margin: 0;--dv-sash-color: transparent;--dv-active-sash-color: transparent;--dv-active-sash-transition-duration: .1s;--dv-active-sash-transition-delay: .5s;box-sizing:border-box;padding:10px;background-color:#ebeced;--dv-group-view-background-color: #ebeced;--dv-tabs-and-actions-container-background-color: #fcfcfc;--dv-activegroup-visiblepanel-tab-background-color: #f0f1f2;--dv-activegroup-hiddenpanel-tab-background-color: #fcfcfc;--dv-inactivegroup-visiblepanel-tab-background-color: #f0f1f2;--dv-inactivegroup-hiddenpanel-tab-background-color: #fcfcfc;--dv-tab-divider-color: transparent;--dv-activegroup-visiblepanel-tab-color: rgb(51, 51, 51);--dv-activegroup-hiddenpanel-tab-color: rgb(51, 51, 51);--dv-inactivegroup-visiblepanel-tab-color: rgb(51, 51, 51);--dv-inactivegroup-hiddenpanel-tab-color: rgb(51, 51, 51);--dv-separator-border: transparent;--dv-paneview-header-border-color: rgb(51, 51, 51);--dv-sash-color: #cfd1d3;--dv-active-sash-color: #babbbb}.dockview-theme-replit .dv-drop-target-container .dv-drop-target-anchor.dv-drop-target-anchor-container-changed{opacity:0;transition:none}.dockview-theme-replit .dv-resize-container:has(>.dv-groupview){border-radius:8px}.dockview-theme-replit .dv-resize-container{border-radius:10px!important;border:none}.dockview-theme-replit .dv-groupview{overflow:hidden;border-radius:10px}.dockview-theme-replit .dv-groupview .dv-tabs-and-actions-container{border-bottom:1px solid rgba(128,128,128,.35)}.dockview-theme-replit .dv-groupview .dv-tabs-and-actions-container .dv-tab{margin:4px;border-radius:8px}.dockview-theme-replit .dv-groupview .dv-tabs-and-actions-container .dv-tab .dv-svg{height:8px;width:8px}.dockview-theme-replit .dv-groupview .dv-tabs-and-actions-container .dv-tab:hover{background-color:#e4e5e6!important}.dockview-theme-replit .dv-groupview .dv-content-container{background-color:#fcfcfc}.dockview-theme-replit .dv-groupview.dv-active-group{border:1px solid rgba(128,128,128,.35)}.dockview-theme-replit .dv-groupview.dv-inactive-group{border:1px solid transparent}.dockview-theme-replit .dv-vertical>.dv-sash-container>.dv-sash{background-color:transparent}.dockview-theme-replit .dv-vertical>.dv-sash-container>.dv-sash:not(.disabled):after{content:"";height:4px;width:40px;border-radius:2px;top:50%;left:50%;transform:translate(-50%,-50%);background-color:var(--dv-sash-color);position:absolute}.dockview-theme-replit .dv-vertical>.dv-sash-container>.dv-sash:not(.disabled):hover,.dockview-theme-replit .dv-vertical>.dv-sash-container>.dv-sash:not(.disabled):active{background-color:transparent}.dockview-theme-replit .dv-vertical>.dv-sash-container>.dv-sash:not(.disabled):hover:after,.dockview-theme-replit .dv-vertical>.dv-sash-container>.dv-sash:not(.disabled):active:after{background-color:var(--dv-active-sash-color)}.dockview-theme-replit .dv-horizontal>.dv-sash-container>.dv-sash{background-color:transparent}.dockview-theme-replit .dv-horizontal>.dv-sash-container>.dv-sash:not(.disabled):after{content:"";height:40px;width:4px;border-radius:2px;top:50%;left:50%;transform:translate(-50%,-50%);background-color:var(--dv-sash-color);position:absolute}.dockview-theme-replit .dv-horizontal>.dv-sash-container>.dv-sash:not(.disabled):hover,.dockview-theme-replit .dv-horizontal>.dv-sash-container>.dv-sash:not(.disabled):active{background-color:transparent}.dockview-theme-replit .dv-horizontal>.dv-sash-container>.dv-sash:not(.disabled):hover:after,.dockview-theme-replit .dv-horizontal>.dv-sash-container>.dv-sash:not(.disabled):active:after{background-color:var(--dv-active-sash-color)}.dockview-theme-abyss-spaced{--dv-paneview-active-outline-color: dodgerblue;--dv-tabs-and-actions-container-font-size: 13px;--dv-tabs-and-actions-container-height: 35px;--dv-drag-over-background-color: rgba(83, 89, 93, .5);--dv-drag-over-border-color: transparent;--dv-tabs-container-scrollbar-color: #888;--dv-icon-hover-background-color: rgba(90, 93, 94, .31);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, .5);--dv-overlay-z-index: 999;--dv-tab-font-size: inherit;--dv-border-radius: 0px;--dv-tab-margin: 0;--dv-sash-color: transparent;--dv-active-sash-color: transparent;--dv-active-sash-transition-duration: .1s;--dv-active-sash-transition-delay: .5s;--dv-tab-font-size: 12px;--dv-tab-margin: .5rem .25rem;--dv-tabs-and-actions-container-height: 44px;--dv-border-radius: 20px;box-sizing:border-box;--dv-color-abyss-dark: rgb(11, 6, 17);--dv-color-abyss: #16121f;--dv-color-abyss-light: #201d2b;--dv-color-abyss-lighter: #2a2837;--dv-color-abyss-accent: rgb(91, 30, 207);--dv-color-abyss-primary-text: white;--dv-color-abyss-secondary-text: rgb(148, 151, 169);--dv-drag-over-border: 2px solid var(--dv-color-abyss-accent);--dv-drag-over-background-color: "";--dv-group-view-background-color: var(--dv-color-abyss-dark);--dv-tabs-and-actions-container-background-color: var(--dv-color-abyss);--dv-activegroup-visiblepanel-tab-background-color: var( --dv-color-abyss-lighter );--dv-activegroup-hiddenpanel-tab-background-color: var( --dv-color-abyss-light );--dv-inactivegroup-visiblepanel-tab-background-color: var( --dv-color-abyss-lighter );--dv-inactivegroup-hiddenpanel-tab-background-color: var( --dv-color-abyss-light );--dv-tab-divider-color: transparent;--dv-activegroup-visiblepanel-tab-color: var(--dv-color-abyss-primary-text);--dv-activegroup-hiddenpanel-tab-color: var( --dv-color-abyss-secondary-text );--dv-inactivegroup-visiblepanel-tab-color: var( --dv-color-abyss-primary-text );--dv-inactivegroup-hiddenpanel-tab-color: var( --dv-color-abyss-secondary-text );--dv-separator-border: transparent;--dv-paneview-header-border-color: rgb(51, 51, 51);--dv-active-sash-color: var(--dv-color-abyss-accent);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(0, 0, 0, .5);padding:10px;background-color:var(--dv-color-abyss-dark)}.dockview-theme-abyss-spaced .dv-resize-container:has(>.dv-groupview){border-radius:8px}.dockview-theme-abyss-spaced .dv-sash{border-radius:4px}.dockview-theme-abyss-spaced .dv-drop-target-anchor{border-radius:calc(var(--dv-border-radius) / 4)}.dockview-theme-abyss-spaced .dv-drop-target-anchor.dv-drop-target-content{border-radius:var(--dv-border-radius)}.dockview-theme-abyss-spaced .dv-resize-container{border-radius:var(--dv-border-radius)!important;border:none}.dockview-theme-abyss-spaced .dv-tabs-overflow-container,.dockview-theme-abyss-spaced .dv-tabs-overflow-dropdown-default{border-radius:8px;height:unset!important}.dockview-theme-abyss-spaced .dv-tab{border-radius:8px}.dockview-theme-abyss-spaced .dv-tab .dv-svg{height:8px;width:8px}.dockview-theme-abyss-spaced .dv-groupview{border-radius:var(--dv-border-radius)}.dockview-theme-abyss-spaced .dv-groupview .dv-tabs-and-actions-container{padding:0px calc(var(--dv-border-radius) / 2)}.dockview-theme-abyss-spaced .dv-groupview .dv-content-container{background-color:var(--dv-tabs-and-actions-container-background-color)}.dockview-theme-abyss-spaced .dv-resize-container .dv-groupview{border:2px solid var(--dv-color-abyss-dark)}.dockview-theme-light-spaced{--dv-paneview-active-outline-color: dodgerblue;--dv-tabs-and-actions-container-font-size: 13px;--dv-tabs-and-actions-container-height: 35px;--dv-drag-over-background-color: rgba(83, 89, 93, .5);--dv-drag-over-border-color: transparent;--dv-tabs-container-scrollbar-color: #888;--dv-icon-hover-background-color: rgba(90, 93, 94, .31);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, .5);--dv-overlay-z-index: 999;--dv-tab-font-size: inherit;--dv-border-radius: 0px;--dv-tab-margin: 0;--dv-sash-color: transparent;--dv-active-sash-color: transparent;--dv-active-sash-transition-duration: .1s;--dv-active-sash-transition-delay: .5s;--dv-tab-font-size: 12px;--dv-tab-margin: .5rem .25rem;--dv-tabs-and-actions-container-height: 44px;--dv-border-radius: 20px;box-sizing:border-box;--dv-drag-over-border: 2px solid rgb(91, 30, 207);--dv-drag-over-background-color: "";--dv-group-view-background-color: #f6f5f9;--dv-tabs-and-actions-container-background-color: white;--dv-activegroup-visiblepanel-tab-background-color: #ededf0;--dv-activegroup-hiddenpanel-tab-background-color: #f9f9fa;--dv-inactivegroup-visiblepanel-tab-background-color: #ededf0;--dv-inactivegroup-hiddenpanel-tab-background-color: #f9f9fa;--dv-tab-divider-color: transparent;--dv-activegroup-visiblepanel-tab-color: rgb(104, 107, 130);--dv-activegroup-hiddenpanel-tab-color: rgb(148, 151, 169);--dv-inactivegroup-visiblepanel-tab-color: rgb(104, 107, 130);--dv-inactivegroup-hiddenpanel-tab-color: rgb(148, 151, 169);--dv-separator-border: transparent;--dv-paneview-header-border-color: rgb(51, 51, 51);--dv-active-sash-color: rgb(91, 30, 207);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(0, 0, 0, .1);padding:10px;background-color:#f6f5f9;--dv-scrollbar-background-color: rgba(0, 0, 0, .25)}.dockview-theme-light-spaced .dv-resize-container:has(>.dv-groupview){border-radius:8px}.dockview-theme-light-spaced .dv-sash{border-radius:4px}.dockview-theme-light-spaced .dv-drop-target-anchor{border-radius:calc(var(--dv-border-radius) / 4)}.dockview-theme-light-spaced .dv-drop-target-anchor.dv-drop-target-content{border-radius:var(--dv-border-radius)}.dockview-theme-light-spaced .dv-resize-container{border-radius:var(--dv-border-radius)!important;border:none}.dockview-theme-light-spaced .dv-tabs-overflow-container,.dockview-theme-light-spaced .dv-tabs-overflow-dropdown-default{border-radius:8px;height:unset!important}.dockview-theme-light-spaced .dv-tab{border-radius:8px}.dockview-theme-light-spaced .dv-tab .dv-svg{height:8px;width:8px}.dockview-theme-light-spaced .dv-groupview{border-radius:var(--dv-border-radius)}.dockview-theme-light-spaced .dv-groupview .dv-tabs-and-actions-container{padding:0px calc(var(--dv-border-radius) / 2)}.dockview-theme-light-spaced .dv-groupview .dv-content-container{background-color:var(--dv-tabs-and-actions-container-background-color)}.dockview-theme-light-spaced .dv-resize-container .dv-groupview{border:2px solid rgba(255,255,255,.1)}.dv-drop-target-container{position:absolute;z-index:9999;top:0;left:0;height:100%;width:100%;pointer-events:none;overflow:hidden;--dv-transition-duration: .3s}.dv-drop-target-container .dv-drop-target-anchor{position:relative;border:var(--dv-drag-over-border);background-color:var(--dv-drag-over-background-color);opacity:1;will-change:transform,opacity;transform:translateZ(0);backface-visibility:hidden;contain:layout paint;transition:opacity var(--dv-transition-duration) ease-in,transform var(--dv-transition-duration) ease-out}.dv-drop-target{position:relative;--dv-transition-duration: 70ms}.dv-drop-target>.dv-drop-target-dropzone{position:absolute;left:0;top:0;height:100%;width:100%;z-index:1000;pointer-events:none}.dv-drop-target>.dv-drop-target-dropzone>.dv-drop-target-selection{position:relative;box-sizing:border-box;height:100%;width:100%;border:var(--dv-drag-over-border);background-color:var(--dv-drag-over-background-color);transition:top var(--dv-transition-duration) ease-out,left var(--dv-transition-duration) ease-out,width var(--dv-transition-duration) ease-out,height var(--dv-transition-duration) ease-out,opacity var(--dv-transition-duration) ease-out;will-change:transform;pointer-events:none}.dv-drop-target>.dv-drop-target-dropzone>.dv-drop-target-selection.dv-drop-target-top.dv-drop-target-small-vertical{border-top:1px solid var(--dv-drag-over-border-color)}.dv-drop-target>.dv-drop-target-dropzone>.dv-drop-target-selection.dv-drop-target-bottom.dv-drop-target-small-vertical{border-bottom:1px solid var(--dv-drag-over-border-color)}.dv-drop-target>.dv-drop-target-dropzone>.dv-drop-target-selection.dv-drop-target-left.dv-drop-target-small-horizontal{border-left:1px solid var(--dv-drag-over-border-color)}.dv-drop-target>.dv-drop-target-dropzone>.dv-drop-target-selection.dv-drop-target-right.dv-drop-target-small-horizontal{border-right:1px solid var(--dv-drag-over-border-color)}.dv-dockview{position:relative;background-color:var(--dv-group-view-background-color);contain:layout}.dv-dockview .dv-watermark-container{position:absolute;top:0;left:0;height:100%;width:100%;z-index:1}.dv-dockview .dv-overlay-render-container{position:relative}.dv-groupview.dv-active-group>.dv-tabs-and-actions-container .dv-tabs-container>.dv-tab.dv-active-tab{background-color:var(--dv-activegroup-visiblepanel-tab-background-color);color:var(--dv-activegroup-visiblepanel-tab-color)}.dv-groupview.dv-active-group>.dv-tabs-and-actions-container .dv-tabs-container>.dv-tab.dv-inactive-tab{background-color:var(--dv-activegroup-hiddenpanel-tab-background-color);color:var(--dv-activegroup-hiddenpanel-tab-color)}.dv-groupview.dv-inactive-group>.dv-tabs-and-actions-container .dv-tabs-container>.dv-tab.dv-active-tab{background-color:var(--dv-inactivegroup-visiblepanel-tab-background-color);color:var(--dv-inactivegroup-visiblepanel-tab-color)}.dv-groupview.dv-inactive-group>.dv-tabs-and-actions-container .dv-tabs-container>.dv-tab.dv-inactive-tab{background-color:var(--dv-inactivegroup-hiddenpanel-tab-background-color);color:var(--dv-inactivegroup-hiddenpanel-tab-color)}.dv-tab.dv-tab-dragging{background-color:var(--dv-activegroup-visiblepanel-tab-background-color);color:var(--dv-activegroup-visiblepanel-tab-color)}.dv-groupview{display:flex;flex-direction:column;height:100%;background-color:var(--dv-group-view-background-color);overflow:hidden}.dv-groupview:focus{outline:none}.dv-groupview>.dv-content-container{flex-grow:1;min-height:0;outline:none}.dv-root-wrapper,.dv-grid-view,.dv-branch-node{height:100%;width:100%}.dv-debug .dv-resize-container .dv-resize-handle-top{background-color:red}.dv-debug .dv-resize-container .dv-resize-handle-bottom{background-color:green}.dv-debug .dv-resize-container .dv-resize-handle-left{background-color:#ff0}.dv-debug .dv-resize-container .dv-resize-handle-right{background-color:#00f}.dv-debug .dv-resize-container .dv-resize-handle-topleft,.dv-debug .dv-resize-container .dv-resize-handle-topright,.dv-debug .dv-resize-container .dv-resize-handle-bottomleft,.dv-debug .dv-resize-container .dv-resize-handle-bottomright{background-color:#0ff}.dv-resize-container{--dv-overlay-z-index: var(--dv-overlay-z-index, 999);position:absolute;z-index:calc(var(--dv-overlay-z-index) - 2);border:1px solid var(--dv-tab-divider-color);box-shadow:var(--dv-floating-box-shadow);will-change:transform,opacity;transform:translateZ(0);backface-visibility:hidden}.dv-resize-container.dv-hidden{display:none}.dv-resize-container.dv-resize-container-dragging{opacity:.5;will-change:transform,opacity}.dv-resize-container .dv-resize-handle-top{height:4px;width:calc(100% - 8px);left:4px;top:-2px;z-index:var(--dv-overlay-z-index);position:absolute;cursor:ns-resize}.dv-resize-container .dv-resize-handle-bottom{height:4px;width:calc(100% - 8px);left:4px;bottom:-2px;z-index:var(--dv-overlay-z-index);position:absolute;cursor:ns-resize}.dv-resize-container .dv-resize-handle-left{height:calc(100% - 8px);width:4px;left:-2px;top:4px;z-index:var(--dv-overlay-z-index);position:absolute;cursor:ew-resize}.dv-resize-container .dv-resize-handle-right{height:calc(100% - 8px);width:4px;right:-2px;top:4px;z-index:var(--dv-overlay-z-index);position:absolute;cursor:ew-resize}.dv-resize-container .dv-resize-handle-topleft{height:4px;width:4px;top:-2px;left:-2px;z-index:var(--dv-overlay-z-index);position:absolute;cursor:nw-resize}.dv-resize-container .dv-resize-handle-topright{height:4px;width:4px;right:-2px;top:-2px;z-index:var(--dv-overlay-z-index);position:absolute;cursor:ne-resize}.dv-resize-container .dv-resize-handle-bottomleft{height:4px;width:4px;left:-2px;bottom:-2px;z-index:var(--dv-overlay-z-index);position:absolute;cursor:sw-resize}.dv-resize-container .dv-resize-handle-bottomright{height:4px;width:4px;right:-2px;bottom:-2px;z-index:var(--dv-overlay-z-index);position:absolute;cursor:se-resize}.dv-render-overlay{--dv-overlay-z-index: var(--dv-overlay-z-index, 999);position:absolute;z-index:1;width:100%;height:100%;contain:layout paint;isolation:isolate;will-change:transform;transform:translateZ(0);backface-visibility:hidden}.dv-render-overlay.dv-render-overlay-float{z-index:calc(var(--dv-overlay-z-index) - 1)}.dv-debug .dv-render-overlay{outline:1px solid red;outline-offset:-1}.dv-pane-container{height:100%;width:100%}.dv-pane-container.dv-animated .dv-view{will-change:transform;transform:translateZ(0);backface-visibility:hidden;transition:transform .15s ease-out}.dv-pane-container .dv-view{overflow:hidden;display:flex;flex-direction:column;padding:0!important}.dv-pane-container .dv-view:not(:first-child):before{background-color:transparent!important}.dv-pane-container .dv-view:not(:first-child) .dv-pane>.dv-pane-header{border-top:1px solid var(--dv-paneview-header-border-color)}.dv-pane-container .dv-view .dv-default-header{background-color:var(--dv-group-view-background-color);color:var(--dv-activegroup-visiblepanel-tab-color);display:flex;padding:0 8px;cursor:pointer}.dv-pane-container .dv-view .dv-default-header .dv-pane-header-icon{display:flex;justify-content:center;align-items:center}.dv-pane-container .dv-view .dv-default-header>span{padding-left:8px;flex-grow:1}.dv-pane-container:first-of-type>.dv-pane>.dv-pane-header{border-top:none!important}.dv-pane-container .dv-pane{display:flex;flex-direction:column;overflow:hidden;height:100%}.dv-pane-container .dv-pane .dv-pane-header{box-sizing:border-box;-webkit-user-select:none;user-select:none;position:relative;outline:none}.dv-pane-container .dv-pane .dv-pane-header.dv-pane-draggable{cursor:pointer}.dv-pane-container .dv-pane .dv-pane-header:focus:before,.dv-pane-container .dv-pane .dv-pane-header:focus-within:before{position:absolute;top:0;left:0;width:100%;height:100%;z-index:5;content:"";pointer-events:none;outline:1px solid;outline-width:-1px;outline-style:solid;outline-offset:-1px;outline-color:var(--dv-paneview-active-outline-color)}.dv-pane-container .dv-pane .dv-pane-body{overflow-y:auto;overflow-x:hidden;flex-grow:1;position:relative;outline:none}.dv-pane-container .dv-pane .dv-pane-body:focus:before,.dv-pane-container .dv-pane .dv-pane-body:focus-within:before{position:absolute;top:0;left:0;width:100%;height:100%;z-index:5;content:"";pointer-events:none;outline:1px solid;outline-width:-1px;outline-style:solid;outline-offset:-1px;outline-color:var(--dv-paneview-active-outline-color)}.dv-debug .dv-split-view-container .dv-sash-container .dv-sash.dv-enabled{background-color:#000}.dv-debug .dv-split-view-container .dv-sash-container .dv-sash.dv-disabled{background-color:orange}.dv-debug .dv-split-view-container .dv-sash-container .dv-sash.dv-maximum{background-color:green}.dv-debug .dv-split-view-container .dv-sash-container .dv-sash.dv-minimum{background-color:red}.dv-split-view-container{position:relative;overflow:hidden;height:100%;width:100%}.dv-split-view-container.dv-splitview-disabled>.dv-sash-container>.dv-sash{pointer-events:none}.dv-split-view-container.dv-animation .dv-view,.dv-split-view-container.dv-animation .dv-sash{will-change:transform;transform:translateZ(0);backface-visibility:hidden;transition:transform .15s ease-out}.dv-split-view-container.dv-horizontal{height:100%}.dv-split-view-container.dv-horizontal>.dv-sash-container>.dv-sash{height:100%;width:4px}.dv-split-view-container.dv-horizontal>.dv-sash-container>.dv-sash.dv-enabled{cursor:ew-resize}.dv-split-view-container.dv-horizontal>.dv-sash-container>.dv-sash.dv-disabled{cursor:default}.dv-split-view-container.dv-horizontal>.dv-sash-container>.dv-sash.dv-maximum{cursor:w-resize}.dv-split-view-container.dv-horizontal>.dv-sash-container>.dv-sash.dv-minimum{cursor:e-resize}.dv-split-view-container.dv-horizontal>.dv-view-container>.dv-view:not(:first-child):before{height:100%;width:1px}.dv-split-view-container.dv-vertical{width:100%}.dv-split-view-container.dv-vertical>.dv-sash-container>.dv-sash{width:100%;height:4px}.dv-split-view-container.dv-vertical>.dv-sash-container>.dv-sash.dv-enabled{cursor:ns-resize}.dv-split-view-container.dv-vertical>.dv-sash-container>.dv-sash.dv-disabled{cursor:default}.dv-split-view-container.dv-vertical>.dv-sash-container>.dv-sash.dv-maximum{cursor:n-resize}.dv-split-view-container.dv-vertical>.dv-sash-container>.dv-sash.dv-minimum{cursor:s-resize}.dv-split-view-container.dv-vertical>.dv-view-container>.dv-view{width:100%}.dv-split-view-container.dv-vertical>.dv-view-container>.dv-view:not(:first-child):before{height:1px;width:100%}.dv-split-view-container .dv-sash-container{height:100%;width:100%;position:absolute}.dv-split-view-container .dv-sash-container .dv-sash{position:absolute;z-index:99;outline:none;user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;touch-action:none;background-color:var(--dv-sash-color, transparent)}.dv-split-view-container .dv-sash-container .dv-sash:not(.disabled):active,.dv-split-view-container .dv-sash-container .dv-sash:not(.disabled):hover{background-color:var(--dv-active-sash-color, transparent);transition-property:background-color;transition-timing-function:ease-in-out;transition-duration:var(--dv-active-sash-transition-duration, .1s);transition-delay:var(--dv-active-sash-transition-delay, .5s)}.dv-split-view-container .dv-view-container{position:relative;height:100%;width:100%}.dv-split-view-container .dv-view-container .dv-view{height:100%;box-sizing:border-box;overflow:auto;position:absolute}.dv-split-view-container.dv-separator-border .dv-view:not(:first-child):before{content:" ";position:absolute;top:0;left:0;z-index:5;pointer-events:none;background-color:var(--dv-separator-border)}.dv-dragged{transform:translateZ(0)}.dv-tab{flex-shrink:0}.dv-tab:focus-within,.dv-tab:focus{position:relative}.dv-tab:focus-within:after,.dv-tab:focus:after{position:absolute;content:"";height:100%;width:100%;top:0;left:0;pointer-events:none;outline:1px solid var(--dv-tab-divider-color)!important;outline-offset:-1px;z-index:5}.dv-tab.dv-tab-dragging .dv-default-tab-action{background-color:var(--dv-activegroup-visiblepanel-tab-color)}.dv-tab.dv-active-tab .dv-default-tab .dv-default-tab-action{visibility:visible}.dv-tab.dv-inactive-tab .dv-default-tab .dv-default-tab-action{visibility:hidden}.dv-tab.dv-inactive-tab .dv-default-tab:hover .dv-default-tab-action{visibility:visible}.dv-tab .dv-default-tab{position:relative;height:100%;display:flex;align-items:center;white-space:nowrap;text-overflow:ellipsis}.dv-tab .dv-default-tab .dv-default-tab-content{flex-grow:1;margin-right:4px}.dv-tab .dv-default-tab .dv-default-tab-action{padding:4px;display:flex;align-items:center;justify-content:center;box-sizing:border-box}.dv-tab .dv-default-tab .dv-default-tab-action:hover{border-radius:2px;background-color:var(--dv-icon-hover-background-color)}.dv-tabs-overflow-dropdown-default{height:100%;color:var(--dv-activegroup-hiddenpanel-tab-color);margin:var(--dv-tab-margin);display:flex;align-items:center;flex-shrink:0;padding:.25rem .5rem;cursor:pointer}.dv-tabs-overflow-dropdown-default>span{padding-left:.25rem}.dv-tabs-overflow-dropdown-default>svg{transform:rotate(90deg)}.dv-tabs-container{display:flex;height:100%;overflow:auto;scrollbar-width:thin;will-change:scroll-position;transform:translateZ(0)}.dv-tabs-container.dv-horizontal .dv-tab:not(:first-child):before{content:" ";position:absolute;top:0;left:0;z-index:5;pointer-events:none;background-color:var(--dv-tab-divider-color);width:1px;height:100%}.dv-tabs-container::-webkit-scrollbar{height:3px}.dv-tabs-container::-webkit-scrollbar-track{background:transparent}.dv-tabs-container::-webkit-scrollbar-thumb{background:var(--dv-tabs-container-scrollbar-color)}.dv-scrollable>.dv-tabs-container{overflow:hidden}.dv-tab{-webkit-user-drag:element;outline:none;padding:.25rem .5rem;cursor:pointer;position:relative;box-sizing:border-box;font-size:var(--dv-tab-font-size);margin:var(--dv-tab-margin)}.dv-tabs-overflow-container{flex-direction:column;height:unset;border:1px solid var(--dv-tab-divider-color);background-color:var(--dv-group-view-background-color)}.dv-tabs-overflow-container .dv-tab:not(:last-child){border-bottom:1px solid var(--dv-tab-divider-color)}.dv-tabs-overflow-container .dv-active-tab{background-color:var(--dv-activegroup-visiblepanel-tab-background-color);color:var(--dv-activegroup-visiblepanel-tab-color)}.dv-tabs-overflow-container .dv-inactive-tab{background-color:var(--dv-activegroup-hiddenpanel-tab-background-color);color:var(--dv-activegroup-hiddenpanel-tab-color)}.dv-tabs-and-actions-container{display:flex;background-color:var(--dv-tabs-and-actions-container-background-color);flex-shrink:0;box-sizing:border-box;height:var(--dv-tabs-and-actions-container-height);font-size:var(--dv-tabs-and-actions-container-font-size)}.dv-tabs-and-actions-container.dv-single-tab.dv-full-width-single-tab .dv-scrollable,.dv-tabs-and-actions-container.dv-single-tab.dv-full-width-single-tab .dv-tabs-container{flex-grow:1}.dv-tabs-and-actions-container.dv-single-tab.dv-full-width-single-tab .dv-tabs-container .dv-tab{flex-grow:1;padding:0}.dv-tabs-and-actions-container.dv-single-tab.dv-full-width-single-tab .dv-void-container{flex-grow:0}.dv-tabs-and-actions-container .dv-void-container{display:flex;flex-grow:1}.dv-tabs-and-actions-container .dv-void-container.dv-draggable{cursor:grab}.dv-tabs-and-actions-container .dv-right-actions-container{display:flex}.dv-watermark{display:flex;height:100%}.uplot,.uplot *,.uplot *:before,.uplot *:after{box-sizing:border-box}.uplot{font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";line-height:1.5;width:min-content}.u-title{text-align:center;font-size:18px;font-weight:700}.u-wrap{position:relative;-webkit-user-select:none;user-select:none}.u-over,.u-under{position:absolute}.u-under{overflow:hidden}.uplot canvas{display:block;position:relative;width:100%;height:100%}.u-axis{position:absolute}.u-legend{font-size:14px;margin:auto;text-align:center}.u-inline{display:block}.u-inline *{display:inline-block}.u-inline tr{margin-right:16px}.u-legend th{font-weight:600}.u-legend th>*{vertical-align:middle;display:inline-block}.u-legend .u-marker{width:1em;height:1em;margin-right:4px;background-clip:padding-box!important}.u-inline.u-live th:after{content:":";vertical-align:middle}.u-inline:not(.u-live) .u-value{display:none}.u-series>*{padding:4px}.u-series th{cursor:pointer}.u-legend .u-off>*{opacity:.3}.u-select{background:#00000012;position:absolute;pointer-events:none}.u-cursor-x,.u-cursor-y{position:absolute;left:0;top:0;pointer-events:none;will-change:transform}.u-hz .u-cursor-x,.u-vt .u-cursor-y{height:100%;border-right:1px dashed #607D8B}.u-hz .u-cursor-y,.u-vt .u-cursor-x{width:100%;border-bottom:1px dashed #607D8B}.u-cursor-pt{position:absolute;top:0;left:0;border-radius:50%;border:0 solid;pointer-events:none;will-change:transform;background-clip:padding-box!important}.u-axis.u-off,.u-select.u-off,.u-cursor-x.u-off,.u-cursor-y.u-off,.u-cursor-pt.u-off{display:none}:root{--bg: #0d1117;--bg-1: #11161d;--bg-2: #161b22;--bg-3: #1c232c;--border: #2a313c;--text: #c9d1d9;--muted: #8b949e;--accent: #58a6ff;--ok: #3fb950;--warn: #d29922;--err: #ff7b72;--font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;--mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace}*{box-sizing:border-box}html,body,#root{height:100%;margin:0}body{font-family:var(--font);background:var(--bg);color:var(--text);font-size:13px;-webkit-font-smoothing:antialiased}.mono{font-family:var(--mono)}.muted{color:var(--muted)}.small{font-size:11px}.center{text-align:center}.pad{padding:16px}.strong{font-weight:600}.dim{opacity:.55}.app{display:flex;flex-direction:column;height:100%}.body{flex:1;display:flex;min-height:0}.dock-host{flex:1;min-width:0;position:relative}.toolbar{display:flex;align-items:center;gap:16px;height:46px;padding:0 14px;background:linear-gradient(180deg,#11161d,#0d1117);border-bottom:1px solid var(--border)}.brand{font-weight:600;font-size:15px;letter-spacing:.2px;display:flex;align-items:center;gap:8px}.brand-sub{color:var(--muted);font-weight:500;font-size:12px}.brand-dot{width:9px;height:9px;border-radius:50%;background:var(--accent);box-shadow:0 0 10px var(--accent)}.conn{display:flex;align-items:center;gap:8px}.conn .dot{width:8px;height:8px;border-radius:50%}.dot.on{background:var(--ok);box-shadow:0 0 8px var(--ok)}.dot.off{background:var(--err)}.spacer{flex:1}.actions{display:flex;gap:6px}.badge{font-size:10.5px;padding:2px 7px;border-radius:10px;font-weight:600;border:1px solid transparent;text-transform:uppercase;letter-spacing:.3px}.badge.ok{color:var(--ok);border-color:#3fb95066;background:#3fb9501a}.badge.warn{color:var(--warn);border-color:#d2992266;background:#d299221a}.badge.err{color:var(--err);border-color:#ff7b7266;background:#ff7b721a}.btn{background:var(--bg-3);color:var(--text);border:1px solid var(--border);border-radius:6px;padding:5px 10px;font-size:12px;cursor:pointer;transition:background .15s,border-color .15s}.btn:hover{background:#232c37;border-color:#3a434f}.btn.ghost{background:transparent}.btn.small{padding:3px 8px;font-size:11px}.btn.active{border-color:var(--accent);color:var(--accent)}.sidebar{width:232px;flex-shrink:0;background:var(--bg-1);border-right:1px solid var(--border);display:flex;flex-direction:column}.sidebar-head{padding:10px 12px;border-bottom:1px solid var(--border)}.sidebar-title{font-weight:600;margin-bottom:8px}.filter,.type-select,select{width:100%;background:var(--bg-3);border:1px solid var(--border);color:var(--text);border-radius:6px;padding:5px 8px;font-size:12px}.sidebar-body{flex:1;overflow-y:auto;padding:8px}.sidebar-foot{padding:9px 12px;border-top:1px solid var(--border);font-size:11px;line-height:1.5}.motor-group{margin-bottom:12px}.motor-group-title{font-size:11px;text-transform:uppercase;letter-spacing:.5px;color:var(--muted);margin:0 2px 5px}.chips{display:flex;flex-direction:column;gap:4px}.sig-chip{display:flex;align-items:center;gap:7px;padding:5px 8px;background:var(--bg-2);border:1px solid var(--border);border-radius:6px;cursor:grab;-webkit-user-select:none;user-select:none;font-size:12px}.sig-chip:hover{background:var(--bg-3);border-color:#3a434f}.sig-chip.dragging{opacity:.4}.sig-swatch{width:10px;height:10px;border-radius:3px;border:2px solid;flex-shrink:0}.sig-name{flex:1;font-family:var(--mono)}.sig-unit{color:var(--muted);font-size:10.5px}.drag-ghost{background:var(--accent);color:#06223f;font-weight:600;font-size:12px;padding:6px 10px;border-radius:6px;font-family:var(--mono);box-shadow:0 8px 20px #00000080}.panel{height:100%;display:flex;flex-direction:column;background:var(--bg);overflow:hidden}.plot-toolbar{display:flex;align-items:center;gap:8px;padding:6px 10px;border-bottom:1px solid var(--border);flex-wrap:wrap}.legend{display:flex;gap:6px;flex-wrap:wrap}.legend-chip{display:inline-flex;align-items:center;gap:5px;font-size:11px;padding:2px 6px 2px 5px;border:1px solid var(--border);border-radius:10px;font-family:var(--mono)}.legend-swatch{width:9px;height:9px;border-radius:2px;border:1.5px solid}.legend-x{background:none;border:none;color:var(--muted);cursor:pointer;font-size:13px;padding:0 0 0 2px}.legend-x:hover{color:var(--err)}.plot-host{flex:1;min-height:0;position:relative;padding:4px}.plot-host.drop-over{outline:2px dashed var(--accent);outline-offset:-4px;background:#58a6ff0d}.drop-hint{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;color:var(--muted);font-size:12px;pointer-events:none;text-align:center;padding:20px}.uplot,.u-wrap{width:100%!important}.table-panel{overflow:auto}.motor-table{width:100%;border-collapse:collapse;font-size:12px}.motor-table th,.motor-table td{padding:5px 9px;text-align:right;border-bottom:1px solid var(--border);white-space:nowrap}.motor-table th:first-child,.motor-table td:first-child{text-align:left}.motor-table th{position:sticky;top:0;background:var(--bg-2);color:var(--muted);font-weight:600;font-size:11px;text-transform:uppercase;letter-spacing:.3px}.motor-table tr:hover td{background:var(--bg-1)}.cmd-col{color:var(--accent)}.status-pill{font-size:10px;padding:1px 6px;border-radius:8px;font-weight:600}.status-pill.ok{color:var(--ok);background:#3fb9501f}.status-pill.off{color:var(--muted);background:#8b949e1f}.status-pill.warn{color:var(--warn);background:#d299221f}.cards-panel{overflow:auto}.cards-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:10px;padding:12px}.motor-card{background:var(--bg-1);border:1px solid var(--border);border-radius:10px;padding:12px}.motor-card-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:4px}.motor-card-sub{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:10px}.type-select{width:auto;padding:2px 6px;font-size:11px}.metric{margin-bottom:8px}.metric-label{font-size:11px;color:var(--text);margin-bottom:2px}.metric-values{display:flex;align-items:baseline;gap:10px}.metric-act{font-family:var(--mono);font-size:19px;font-weight:600}.metric-cmd{font-family:var(--mono);font-size:12px;color:var(--accent)}.temp-row{display:flex;justify-content:space-between;font-size:11px;color:var(--muted);margin-top:6px;border-top:1px solid var(--border);padding-top:6px}.rawlog-panel{font-size:11.5px}.rawlog-toolbar{display:flex;align-items:center;gap:10px;padding:5px 10px;border-bottom:1px solid var(--border)}.rawlog-head,.rawlog-row{display:grid;grid-template-columns:70px 64px 50px 90px 1fr 180px;gap:8px;align-items:center}.rawlog-head{flex:1;color:var(--muted);font-size:10.5px;text-transform:uppercase;letter-spacing:.3px}.rawlog-body{flex:1;overflow:auto;padding:0 10px}.rawlog-row{position:absolute;left:10px;right:10px;height:22px;border-bottom:1px solid rgba(42,49,60,.5)}.rawlog-row .c-r{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rawlog-row.k-command .c-k{color:var(--accent)}.rawlog-row.k-feedback .c-k{color:var(--ok)}.rawlog-row.k-special .c-k{color:var(--warn)}.dockview-theme-abyss{--dv-background-color: var(--bg);--dv-paneview-active-outline-color: var(--accent);--dv-tabs-and-actions-container-background-color: var(--bg-1);--dv-activegroup-visiblepanel-tab-background-color: var(--bg);--dv-inactivegroup-visiblepanel-tab-background-color: var(--bg-1);--dv-tab-divider-color: var(--border);--dv-separator-border: var(--border);height:100%} diff --git a/damiao_motor/gui/webapp/dist/assets/index-CStVIA4_.js b/damiao_motor/gui/webapp/dist/assets/index-CStVIA4_.js new file mode 100644 index 0000000..21bf693 --- /dev/null +++ b/damiao_motor/gui/webapp/dist/assets/index-CStVIA4_.js @@ -0,0 +1,46 @@ +var c0=Object.defineProperty;var d0=(r,e,n)=>e in r?c0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[e]=n;var Tl=(r,e,n)=>d0(r,typeof e!="symbol"?e+"":e,n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))s(l);new MutationObserver(l=>{for(const a of l)if(a.type==="childList")for(const c of a.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function n(l){const a={};return l.integrity&&(a.integrity=l.integrity),l.referrerPolicy&&(a.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?a.credentials="include":l.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function s(l){if(l.ep)return;l.ep=!0;const a=n(l);fetch(l.href,a)}})();function zh(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Nd={exports:{}},Il={},Rd={exports:{}},Ue={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var tm;function h0(){if(tm)return Ue;tm=1;var r=Symbol.for("react.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),v=Symbol.iterator;function S(k){return k===null||typeof k!="object"?null:(k=v&&k[v]||k["@@iterator"],typeof k=="function"?k:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},A=Object.assign,D={};function P(k,F,q){this.props=k,this.context=F,this.refs=D,this.updater=q||E}P.prototype.isReactComponent={},P.prototype.setState=function(k,F){if(typeof k!="object"&&typeof k!="function"&&k!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,k,F,"setState")},P.prototype.forceUpdate=function(k){this.updater.enqueueForceUpdate(this,k,"forceUpdate")};function R(){}R.prototype=P.prototype;function O(k,F,q){this.props=k,this.context=F,this.refs=D,this.updater=q||E}var M=O.prototype=new R;M.constructor=O,A(M,P.prototype),M.isPureReactComponent=!0;var N=Array.isArray,Z=Object.prototype.hasOwnProperty,G={current:null},$={key:!0,ref:!0,__self:!0,__source:!0};function K(k,F,q){var xe,Ie={},Se=null,Ee=null;if(F!=null)for(xe in F.ref!==void 0&&(Ee=F.ref),F.key!==void 0&&(Se=""+F.key),F)Z.call(F,xe)&&!$.hasOwnProperty(xe)&&(Ie[xe]=F[xe]);var We=arguments.length-2;if(We===1)Ie.children=q;else if(1>>1,F=le[k];if(0>>1;kl(Ie,ne))Sel(Ee,Ie)?(le[k]=Ee,le[Se]=ne,k=Se):(le[k]=Ie,le[xe]=ne,k=xe);else if(Sel(Ee,ne))le[k]=Ee,le[Se]=ne,k=Se;else break e}}return fe}function l(le,fe){var ne=le.sortIndex-fe.sortIndex;return ne!==0?ne:le.id-fe.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;r.unstable_now=function(){return a.now()}}else{var c=Date,d=c.now();r.unstable_now=function(){return c.now()-d}}var h=[],m=[],w=1,v=null,S=3,E=!1,A=!1,D=!1,P=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function M(le){for(var fe=n(m);fe!==null;){if(fe.callback===null)s(m);else if(fe.startTime<=le)s(m),fe.sortIndex=fe.expirationTime,e(h,fe);else break;fe=n(m)}}function N(le){if(D=!1,M(le),!A)if(n(h)!==null)A=!0,te(Z);else{var fe=n(m);fe!==null&&X(N,fe.startTime-le)}}function Z(le,fe){A=!1,D&&(D=!1,R(K),K=-1),E=!0;var ne=S;try{for(M(fe),v=n(h);v!==null&&(!(v.expirationTime>fe)||le&&!Q());){var k=v.callback;if(typeof k=="function"){v.callback=null,S=v.priorityLevel;var F=k(v.expirationTime<=fe);fe=r.unstable_now(),typeof F=="function"?v.callback=F:v===n(h)&&s(h),M(fe)}else s(h);v=n(h)}if(v!==null)var q=!0;else{var xe=n(m);xe!==null&&X(N,xe.startTime-fe),q=!1}return q}finally{v=null,S=ne,E=!1}}var G=!1,$=null,K=-1,he=5,ue=-1;function Q(){return!(r.unstable_now()-uele||125k?(le.sortIndex=ne,e(m,le),n(h)===null&&le===n(m)&&(D?(R(K),K=-1):D=!0,X(N,ne-k))):(le.sortIndex=F,e(h,le),A||E||(A=!0,te(Z))),le},r.unstable_shouldYield=Q,r.unstable_wrapCallback=function(le){var fe=S;return function(){var ne=S;S=fe;try{return le.apply(this,arguments)}finally{S=ne}}}})(Vd)),Vd}var om;function g0(){return om||(om=1,Ld.exports=m0()),Ld.exports}/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var lm;function v0(){if(lm)return fi;lm=1;var r=kh(),e=g0();function n(t){for(var i="https://reactjs.org/docs/error-decoder.html?invariant="+t,o=1;o"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=Object.prototype.hasOwnProperty,m=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,w={},v={};function S(t){return h.call(v,t)?!0:h.call(w,t)?!1:m.test(t)?v[t]=!0:(w[t]=!0,!1)}function E(t,i,o,u){if(o!==null&&o.type===0)return!1;switch(typeof i){case"function":case"symbol":return!0;case"boolean":return u?!1:o!==null?!o.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function A(t,i,o,u){if(i===null||typeof i>"u"||E(t,i,o,u))return!0;if(u)return!1;if(o!==null)switch(o.type){case 3:return!i;case 4:return i===!1;case 5:return isNaN(i);case 6:return isNaN(i)||1>i}return!1}function D(t,i,o,u,f,p,_){this.acceptsBooleans=i===2||i===3||i===4,this.attributeName=u,this.attributeNamespace=f,this.mustUseProperty=o,this.propertyName=t,this.type=i,this.sanitizeURL=p,this.removeEmptyString=_}var P={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){P[t]=new D(t,0,!1,t,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var i=t[0];P[i]=new D(i,1,!1,t[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){P[t]=new D(t,2,!1,t.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){P[t]=new D(t,2,!1,t,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){P[t]=new D(t,3,!1,t.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(t){P[t]=new D(t,3,!0,t,null,!1,!1)}),["capture","download"].forEach(function(t){P[t]=new D(t,4,!1,t,null,!1,!1)}),["cols","rows","size","span"].forEach(function(t){P[t]=new D(t,6,!1,t,null,!1,!1)}),["rowSpan","start"].forEach(function(t){P[t]=new D(t,5,!1,t.toLowerCase(),null,!1,!1)});var R=/[\-:]([a-z])/g;function O(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var i=t.replace(R,O);P[i]=new D(i,1,!1,t,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var i=t.replace(R,O);P[i]=new D(i,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(t){var i=t.replace(R,O);P[i]=new D(i,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(t){P[t]=new D(t,1,!1,t.toLowerCase(),null,!1,!1)}),P.xlinkHref=new D("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(t){P[t]=new D(t,1,!1,t.toLowerCase(),null,!0,!0)});function M(t,i,o,u){var f=P.hasOwnProperty(i)?P[i]:null;(f!==null?f.type!==0:u||!(2b||f[_]!==p[b]){var z=` +`+f[_].replace(" at new "," at ");return t.displayName&&z.includes("")&&(z=z.replace("",t.displayName)),z}while(1<=_&&0<=b);break}}}finally{q=!1,Error.prepareStackTrace=o}return(t=t?t.displayName||t.name:"")?F(t):""}function Ie(t){switch(t.tag){case 5:return F(t.type);case 16:return F("Lazy");case 13:return F("Suspense");case 19:return F("SuspenseList");case 0:case 2:case 15:return t=xe(t.type,!1),t;case 11:return t=xe(t.type.render,!1),t;case 1:return t=xe(t.type,!0),t;default:return""}}function Se(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case $:return"Fragment";case G:return"Portal";case he:return"Profiler";case K:return"StrictMode";case ie:return"Suspense";case ce:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Q:return(t.displayName||"Context")+".Consumer";case ue:return(t._context.displayName||"Context")+".Provider";case ve:var i=t.render;return t=t.displayName,t||(t=i.displayName||i.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case j:return i=t.displayName||null,i!==null?i:Se(t.type)||"Memo";case te:i=t._payload,t=t._init;try{return Se(t(i))}catch{}}return null}function Ee(t){var i=t.type;switch(t.tag){case 24:return"Cache";case 9:return(i.displayName||"Context")+".Consumer";case 10:return(i._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=i.render,t=t.displayName||t.name||"",i.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return i;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Se(i);case 8:return i===K?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i}return null}function We(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Fe(t){var i=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function Me(t){var i=Fe(t)?"checked":"value",o=Object.getOwnPropertyDescriptor(t.constructor.prototype,i),u=""+t[i];if(!t.hasOwnProperty(i)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var f=o.get,p=o.set;return Object.defineProperty(t,i,{configurable:!0,get:function(){return f.call(this)},set:function(_){u=""+_,p.call(this,_)}}),Object.defineProperty(t,i,{enumerable:o.enumerable}),{getValue:function(){return u},setValue:function(_){u=""+_},stopTracking:function(){t._valueTracker=null,delete t[i]}}}}function Zt(t){t._valueTracker||(t._valueTracker=Me(t))}function Wt(t){if(!t)return!1;var i=t._valueTracker;if(!i)return!0;var o=i.getValue(),u="";return t&&(u=Fe(t)?t.checked?"true":"false":t.value),t=u,t!==o?(i.setValue(t),!0):!1}function Ft(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Ht(t,i){var o=i.checked;return ne({},i,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:o??t._wrapperState.initialChecked})}function ii(t,i){var o=i.defaultValue==null?"":i.defaultValue,u=i.checked!=null?i.checked:i.defaultChecked;o=We(i.value!=null?i.value:o),t._wrapperState={initialChecked:u,initialValue:o,controlled:i.type==="checkbox"||i.type==="radio"?i.checked!=null:i.value!=null}}function Tn(t,i){i=i.checked,i!=null&&M(t,"checked",i,!1)}function ki(t,i){Tn(t,i);var o=We(i.value),u=i.type;if(o!=null)u==="number"?(o===0&&t.value===""||t.value!=o)&&(t.value=""+o):t.value!==""+o&&(t.value=""+o);else if(u==="submit"||u==="reset"){t.removeAttribute("value");return}i.hasOwnProperty("value")?Un(t,i.type,o):i.hasOwnProperty("defaultValue")&&Un(t,i.type,We(i.defaultValue)),i.checked==null&&i.defaultChecked!=null&&(t.defaultChecked=!!i.defaultChecked)}function ls(t,i,o){if(i.hasOwnProperty("value")||i.hasOwnProperty("defaultValue")){var u=i.type;if(!(u!=="submit"&&u!=="reset"||i.value!==void 0&&i.value!==null))return;i=""+t._wrapperState.initialValue,o||i===t.value||(t.value=i),t.defaultValue=i}o=t.name,o!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,o!==""&&(t.name=o)}function Un(t,i,o){(i!=="number"||Ft(t.ownerDocument)!==t)&&(o==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+o&&(t.defaultValue=""+o))}var nt=Array.isArray;function cn(t,i,o,u){if(t=t.options,i){i={};for(var f=0;f"+i.valueOf().toString()+"",i=hn.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;i.firstChild;)t.appendChild(i.firstChild)}});function Xt(t,i){if(i){var o=t.firstChild;if(o&&o===t.lastChild&&o.nodeType===3){o.nodeValue=i;return}}t.textContent=i}var kt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},fn=["Webkit","ms","Moz","O"];Object.keys(kt).forEach(function(t){fn.forEach(function(i){i=i+t.charAt(0).toUpperCase()+t.substring(1),kt[i]=kt[t]})});function xn(t,i,o){return i==null||typeof i=="boolean"||i===""?"":o||typeof i!="number"||i===0||kt.hasOwnProperty(t)&&kt[t]?(""+i).trim():i+"px"}function qt(t,i){t=t.style;for(var o in i)if(i.hasOwnProperty(o)){var u=o.indexOf("--")===0,f=xn(o,i[o],u);o==="float"&&(o="cssFloat"),u?t.setProperty(o,f):t[o]=f}}var En=ne({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function as(t,i){if(i){if(En[t]&&(i.children!=null||i.dangerouslySetInnerHTML!=null))throw Error(n(137,t));if(i.dangerouslySetInnerHTML!=null){if(i.children!=null)throw Error(n(60));if(typeof i.dangerouslySetInnerHTML!="object"||!("__html"in i.dangerouslySetInnerHTML))throw Error(n(61))}if(i.style!=null&&typeof i.style!="object")throw Error(n(62))}}function us(t,i){if(t.indexOf("-")===-1)return typeof i.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var mi=null;function gi(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var cs=null,Rt=null,ut=null;function en(t){if(t=vl(t)){if(typeof cs!="function")throw Error(n(280));var i=t.stateNode;i&&(i=Oa(i),cs(t.stateNode,t.type,i))}}function pn(t){Rt?ut?ut.push(t):ut=[t]:Rt=t}function vi(){if(Rt){var t=Rt,i=ut;if(ut=Rt=null,en(t),i)for(t=0;t>>=0,t===0?32:31-(tl(t)/Rn|0)|0}var Cr=64,js=4194304;function Bs(t){switch(t&-t){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: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&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function io(t,i){var o=t.pendingLanes;if(o===0)return 0;var u=0,f=t.suspendedLanes,p=t.pingedLanes,_=o&268435455;if(_!==0){var b=_&~f;b!==0?u=Bs(b):(p&=_,p!==0&&(u=Bs(p)))}else _=o&~f,_!==0?u=Bs(_):p!==0&&(u=Bs(p));if(u===0)return 0;if(i!==0&&i!==u&&(i&f)===0&&(f=u&-u,p=i&-i,f>=p||f===16&&(p&4194240)!==0))return i;if((u&4)!==0&&(u|=o&16),i=t.entangledLanes,i!==0)for(t=t.entanglements,i&=u;0o;o++)i.push(t);return i}function Us(t,i,o){t.pendingLanes|=i,i!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,i=31-Yn(i),t[i]=o}function sl(t,i){var o=t.pendingLanes&~i;t.pendingLanes=i,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=i,t.mutableReadLanes&=i,t.entangledLanes&=i,i=t.entanglements;var u=t.eventTimes;for(t=t.expirationTimes;0=Ps),xa=" ",po=!1;function g(t,i){switch(t){case"keyup":return Tt.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function y(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var C=!1;function x(t,i){switch(t){case"compositionend":return y(i);case"keypress":return i.which!==32?null:(po=!0,xa);case"textInput":return t=i.data,t===xa&&po?null:t;default:return null}}function T(t,i){if(C)return t==="compositionend"||!fo&&g(t,i)?(t=Si(),yi=al=_i=null,C=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1=i)return{node:o,offset:i-t};t=u}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=li(o)}}function Ln(t,i){return t&&i?t===i?!0:t&&t.nodeType===3?!1:i&&i.nodeType===3?Ln(t,i.parentNode):"contains"in t?t.contains(i):t.compareDocumentPosition?!!(t.compareDocumentPosition(i)&16):!1:!1}function Zn(){for(var t=window,i=Ft();i instanceof t.HTMLIFrameElement;){try{var o=typeof i.contentWindow.location.href=="string"}catch{o=!1}if(o)t=i.contentWindow;else break;i=Ft(t.document)}return i}function Xn(t){var i=t&&t.nodeName&&t.nodeName.toLowerCase();return i&&(i==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||i==="textarea"||t.contentEditable==="true")}function Ri(t){var i=Zn(),o=t.focusedElem,u=t.selectionRange;if(i!==o&&o&&o.ownerDocument&&Ln(o.ownerDocument.documentElement,o)){if(u!==null&&Xn(o)){if(i=u.start,t=u.end,t===void 0&&(t=i),"selectionStart"in o)o.selectionStart=i,o.selectionEnd=Math.min(t,o.value.length);else if(t=(i=o.ownerDocument||document)&&i.defaultView||window,t.getSelection){t=t.getSelection();var f=o.textContent.length,p=Math.min(u.start,f);u=u.end===void 0?p:Math.min(u.end,f),!t.extend&&p>u&&(f=u,u=p,p=f),f=Ci(o,p);var _=Ci(o,u);f&&_&&(t.rangeCount!==1||t.anchorNode!==f.node||t.anchorOffset!==f.offset||t.focusNode!==_.node||t.focusOffset!==_.offset)&&(i=i.createRange(),i.setStart(f.node,f.offset),t.removeAllRanges(),p>u?(t.addRange(i),t.extend(_.node,_.offset)):(i.setEnd(_.node,_.offset),t.addRange(i)))}}for(i=[],t=o;t=t.parentNode;)t.nodeType===1&&i.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o=document.documentMode,Yt=null,Ji=null,Vt=null,mo=!1;function af(t,i,o){var u=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;mo||Yt==null||Yt!==Ft(u)||(u=Yt,"selectionStart"in u&&Xn(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),Vt&&vn(Vt,u)||(Vt=u,u=Aa(Ji,"onSelect"),0yo||(t.current=Oc[yo],Oc[yo]=null,yo--)}function mt(t,i){yo++,Oc[yo]=t.current,t.current=i}var rr={},Vn=sr(rr),ai=sr(!1),Nr=rr;function So(t,i){var o=t.type.contextTypes;if(!o)return rr;var u=t.stateNode;if(u&&u.__reactInternalMemoizedUnmaskedChildContext===i)return u.__reactInternalMemoizedMaskedChildContext;var f={},p;for(p in o)f[p]=i[p];return u&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=i,t.__reactInternalMemoizedMaskedChildContext=f),f}function ui(t){return t=t.childContextTypes,t!=null}function Ta(){vt(ai),vt(Vn)}function Cf(t,i,o){if(Vn.current!==rr)throw Error(n(168));mt(Vn,i),mt(ai,o)}function xf(t,i,o){var u=t.stateNode;if(i=i.childContextTypes,typeof u.getChildContext!="function")return o;u=u.getChildContext();for(var f in u)if(!(f in i))throw Error(n(108,Ee(t)||"Unknown",f));return ne({},o,u)}function Ia(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||rr,Nr=Vn.current,mt(Vn,t),mt(ai,ai.current),!0}function Ef(t,i,o){var u=t.stateNode;if(!u)throw Error(n(169));o?(t=xf(t,i,Nr),u.__reactInternalMemoizedMergedChildContext=t,vt(ai),vt(Vn),mt(Vn,t)):vt(ai),mt(ai,o)}var zs=null,Na=!1,Tc=!1;function bf(t){zs===null?zs=[t]:zs.push(t)}function zw(t){Na=!0,bf(t)}function or(){if(!Tc&&zs!==null){Tc=!0;var t=0,i=Ke;try{var o=zs;for(Ke=1;t>=_,f-=_,ks=1<<32-Yn(i)+f|o<Ge?(yn=Te,Te=null):yn=Te.sibling;var Xe=ee(L,Te,W[Ge],de);if(Xe===null){Te===null&&(Te=yn);break}t&&Te&&Xe.alternate===null&&i(L,Te),I=p(Xe,I,Ge),Oe===null?Ae=Xe:Oe.sibling=Xe,Oe=Xe,Te=yn}if(Ge===W.length)return o(L,Te),Ct&&Mr(L,Ge),Ae;if(Te===null){for(;GeGe?(yn=Te,Te=null):yn=Te.sibling;var mr=ee(L,Te,Xe.value,de);if(mr===null){Te===null&&(Te=yn);break}t&&Te&&mr.alternate===null&&i(L,Te),I=p(mr,I,Ge),Oe===null?Ae=mr:Oe.sibling=mr,Oe=mr,Te=yn}if(Xe.done)return o(L,Te),Ct&&Mr(L,Ge),Ae;if(Te===null){for(;!Xe.done;Ge++,Xe=W.next())Xe=oe(L,Xe.value,de),Xe!==null&&(I=p(Xe,I,Ge),Oe===null?Ae=Xe:Oe.sibling=Xe,Oe=Xe);return Ct&&Mr(L,Ge),Ae}for(Te=u(L,Te);!Xe.done;Ge++,Xe=W.next())Xe=ye(Te,L,Ge,Xe.value,de),Xe!==null&&(t&&Xe.alternate!==null&&Te.delete(Xe.key===null?Ge:Xe.key),I=p(Xe,I,Ge),Oe===null?Ae=Xe:Oe.sibling=Xe,Oe=Xe);return t&&Te.forEach(function(u0){return i(L,u0)}),Ct&&Mr(L,Ge),Ae}function Gt(L,I,W,de){if(typeof W=="object"&&W!==null&&W.type===$&&W.key===null&&(W=W.props.children),typeof W=="object"&&W!==null){switch(W.$$typeof){case Z:e:{for(var Ae=W.key,Oe=I;Oe!==null;){if(Oe.key===Ae){if(Ae=W.type,Ae===$){if(Oe.tag===7){o(L,Oe.sibling),I=f(Oe,W.props.children),I.return=L,L=I;break e}}else if(Oe.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===te&&Tf(Ae)===Oe.type){o(L,Oe.sibling),I=f(Oe,W.props),I.ref=wl(L,Oe,W),I.return=L,L=I;break e}o(L,Oe);break}else i(L,Oe);Oe=Oe.sibling}W.type===$?(I=Br(W.props.children,L.mode,de,W.key),I.return=L,L=I):(de=au(W.type,W.key,W.props,null,L.mode,de),de.ref=wl(L,I,W),de.return=L,L=de)}return _(L);case G:e:{for(Oe=W.key;I!==null;){if(I.key===Oe)if(I.tag===4&&I.stateNode.containerInfo===W.containerInfo&&I.stateNode.implementation===W.implementation){o(L,I.sibling),I=f(I,W.children||[]),I.return=L,L=I;break e}else{o(L,I);break}else i(L,I);I=I.sibling}I=zd(W,L.mode,de),I.return=L,L=I}return _(L);case te:return Oe=W._init,Gt(L,I,Oe(W._payload),de)}if(nt(W))return Ce(L,I,W,de);if(fe(W))return be(L,I,W,de);Va(L,W)}return typeof W=="string"&&W!==""||typeof W=="number"?(W=""+W,I!==null&&I.tag===6?(o(L,I.sibling),I=f(I,W),I.return=L,L=I):(o(L,I),I=Ad(W,L.mode,de),I.return=L,L=I),_(L)):o(L,I)}return Gt}var Eo=If(!0),Nf=If(!1),Ga=sr(null),Wa=null,bo=null,Vc=null;function Gc(){Vc=bo=Wa=null}function Wc(t){var i=Ga.current;vt(Ga),t._currentValue=i}function Fc(t,i,o){for(;t!==null;){var u=t.alternate;if((t.childLanes&i)!==i?(t.childLanes|=i,u!==null&&(u.childLanes|=i)):u!==null&&(u.childLanes&i)!==i&&(u.childLanes|=i),t===o)break;t=t.return}}function Po(t,i){Wa=t,Vc=bo=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&i)!==0&&(ci=!0),t.firstContext=null)}function Vi(t){var i=t._currentValue;if(Vc!==t)if(t={context:t,memoizedValue:i,next:null},bo===null){if(Wa===null)throw Error(n(308));bo=t,Wa.dependencies={lanes:0,firstContext:t}}else bo=bo.next=t;return i}var Lr=null;function Hc(t){Lr===null?Lr=[t]:Lr.push(t)}function Rf(t,i,o,u){var f=i.interleaved;return f===null?(o.next=o,Hc(i)):(o.next=f.next,f.next=o),i.interleaved=o,Ts(t,u)}function Ts(t,i){t.lanes|=i;var o=t.alternate;for(o!==null&&(o.lanes|=i),o=t,t=t.return;t!==null;)t.childLanes|=i,o=t.alternate,o!==null&&(o.childLanes|=i),o=t,t=t.return;return o.tag===3?o.stateNode:null}var lr=!1;function jc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Mf(t,i){t=t.updateQueue,i.updateQueue===t&&(i.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Is(t,i){return{eventTime:t,lane:i,tag:0,payload:null,callback:null,next:null}}function ar(t,i,o){var u=t.updateQueue;if(u===null)return null;if(u=u.shared,(Qe&2)!==0){var f=u.pending;return f===null?i.next=i:(i.next=f.next,f.next=i),u.pending=i,Ts(t,o)}return f=u.interleaved,f===null?(i.next=i,Hc(u)):(i.next=f.next,f.next=i),u.interleaved=i,Ts(t,o)}function Fa(t,i,o){if(i=i.updateQueue,i!==null&&(i=i.shared,(o&4194240)!==0)){var u=i.lanes;u&=t.pendingLanes,o|=u,i.lanes=o,$s(t,o)}}function Lf(t,i){var o=t.updateQueue,u=t.alternate;if(u!==null&&(u=u.updateQueue,o===u)){var f=null,p=null;if(o=o.firstBaseUpdate,o!==null){do{var _={eventTime:o.eventTime,lane:o.lane,tag:o.tag,payload:o.payload,callback:o.callback,next:null};p===null?f=p=_:p=p.next=_,o=o.next}while(o!==null);p===null?f=p=i:p=p.next=i}else f=p=i;o={baseState:u.baseState,firstBaseUpdate:f,lastBaseUpdate:p,shared:u.shared,effects:u.effects},t.updateQueue=o;return}t=o.lastBaseUpdate,t===null?o.firstBaseUpdate=i:t.next=i,o.lastBaseUpdate=i}function Ha(t,i,o,u){var f=t.updateQueue;lr=!1;var p=f.firstBaseUpdate,_=f.lastBaseUpdate,b=f.shared.pending;if(b!==null){f.shared.pending=null;var z=b,H=z.next;z.next=null,_===null?p=H:_.next=H,_=z;var re=t.alternate;re!==null&&(re=re.updateQueue,b=re.lastBaseUpdate,b!==_&&(b===null?re.firstBaseUpdate=H:b.next=H,re.lastBaseUpdate=z))}if(p!==null){var oe=f.baseState;_=0,re=H=z=null,b=p;do{var ee=b.lane,ye=b.eventTime;if((u&ee)===ee){re!==null&&(re=re.next={eventTime:ye,lane:0,tag:b.tag,payload:b.payload,callback:b.callback,next:null});e:{var Ce=t,be=b;switch(ee=i,ye=o,be.tag){case 1:if(Ce=be.payload,typeof Ce=="function"){oe=Ce.call(ye,oe,ee);break e}oe=Ce;break e;case 3:Ce.flags=Ce.flags&-65537|128;case 0:if(Ce=be.payload,ee=typeof Ce=="function"?Ce.call(ye,oe,ee):Ce,ee==null)break e;oe=ne({},oe,ee);break e;case 2:lr=!0}}b.callback!==null&&b.lane!==0&&(t.flags|=64,ee=f.effects,ee===null?f.effects=[b]:ee.push(b))}else ye={eventTime:ye,lane:ee,tag:b.tag,payload:b.payload,callback:b.callback,next:null},re===null?(H=re=ye,z=oe):re=re.next=ye,_|=ee;if(b=b.next,b===null){if(b=f.shared.pending,b===null)break;ee=b,b=ee.next,ee.next=null,f.lastBaseUpdate=ee,f.shared.pending=null}}while(!0);if(re===null&&(z=oe),f.baseState=z,f.firstBaseUpdate=H,f.lastBaseUpdate=re,i=f.shared.interleaved,i!==null){f=i;do _|=f.lane,f=f.next;while(f!==i)}else p===null&&(f.shared.lanes=0);Wr|=_,t.lanes=_,t.memoizedState=oe}}function Vf(t,i,o){if(t=i.effects,i.effects=null,t!==null)for(i=0;io?o:4,t(!0);var u=Kc.transition;Kc.transition={};try{t(!1),i()}finally{Ke=o,Kc.transition=u}}function ip(){return Gi().memoizedState}function Iw(t,i,o){var u=hr(t);if(o={lane:u,action:o,hasEagerState:!1,eagerState:null,next:null},sp(t))rp(i,o);else if(o=Rf(t,i,o,u),o!==null){var f=ei();es(o,t,u,f),op(o,i,u)}}function Nw(t,i,o){var u=hr(t),f={lane:u,action:o,hasEagerState:!1,eagerState:null,next:null};if(sp(t))rp(i,f);else{var p=t.alternate;if(t.lanes===0&&(p===null||p.lanes===0)&&(p=i.lastRenderedReducer,p!==null))try{var _=i.lastRenderedState,b=p(_,o);if(f.hasEagerState=!0,f.eagerState=b,dt(b,_)){var z=i.interleaved;z===null?(f.next=f,Hc(i)):(f.next=z.next,z.next=f),i.interleaved=f;return}}catch{}finally{}o=Rf(t,i,f,u),o!==null&&(f=ei(),es(o,t,u,f),op(o,i,u))}}function sp(t){var i=t.alternate;return t===At||i!==null&&i===At}function rp(t,i){Dl=Ua=!0;var o=t.pending;o===null?i.next=i:(i.next=o.next,o.next=i),t.pending=i}function op(t,i,o){if((o&4194240)!==0){var u=i.lanes;u&=t.pendingLanes,o|=u,i.lanes=o,$s(t,o)}}var Ka={readContext:Vi,useCallback:Gn,useContext:Gn,useEffect:Gn,useImperativeHandle:Gn,useInsertionEffect:Gn,useLayoutEffect:Gn,useMemo:Gn,useReducer:Gn,useRef:Gn,useState:Gn,useDebugValue:Gn,useDeferredValue:Gn,useTransition:Gn,useMutableSource:Gn,useSyncExternalStore:Gn,useId:Gn,unstable_isNewReconciler:!1},Rw={readContext:Vi,useCallback:function(t,i){return gs().memoizedState=[t,i===void 0?null:i],t},useContext:Vi,useEffect:Jf,useImperativeHandle:function(t,i,o){return o=o!=null?o.concat([t]):null,$a(4194308,4,Xf.bind(null,i,t),o)},useLayoutEffect:function(t,i){return $a(4194308,4,t,i)},useInsertionEffect:function(t,i){return $a(4,2,t,i)},useMemo:function(t,i){var o=gs();return i=i===void 0?null:i,t=t(),o.memoizedState=[t,i],t},useReducer:function(t,i,o){var u=gs();return i=o!==void 0?o(i):i,u.memoizedState=u.baseState=i,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:i},u.queue=t,t=t.dispatch=Iw.bind(null,At,t),[u.memoizedState,t]},useRef:function(t){var i=gs();return t={current:t},i.memoizedState=t},useState:Yf,useDebugValue:td,useDeferredValue:function(t){return gs().memoizedState=t},useTransition:function(){var t=Yf(!1),i=t[0];return t=Tw.bind(null,t[1]),gs().memoizedState=t,[i,t]},useMutableSource:function(){},useSyncExternalStore:function(t,i,o){var u=At,f=gs();if(Ct){if(o===void 0)throw Error(n(407));o=o()}else{if(o=i(),_n===null)throw Error(n(349));(Gr&30)!==0||Hf(u,i,o)}f.memoizedState=o;var p={value:o,getSnapshot:i};return f.queue=p,Jf(Bf.bind(null,u,p,t),[t]),u.flags|=2048,El(9,jf.bind(null,u,p,o,i),void 0,null),o},useId:function(){var t=gs(),i=_n.identifierPrefix;if(Ct){var o=Os,u=ks;o=(u&~(1<<32-Yn(u)-1)).toString(32)+o,i=":"+i+"R"+o,o=Cl++,0<\/script>",t=t.removeChild(t.firstChild)):typeof u.is=="string"?t=_.createElement(o,{is:u.is}):(t=_.createElement(o),o==="select"&&(_=t,u.multiple?_.multiple=!0:u.size&&(_.size=u.size))):t=_.createElementNS(t,o),t[ps]=i,t[gl]=u,bp(t,i,!1,!1),i.stateNode=t;e:{switch(_=us(o,u),o){case"dialog":gt("cancel",t),gt("close",t),f=u;break;case"iframe":case"object":case"embed":gt("load",t),f=u;break;case"video":case"audio":for(f=0;fTo&&(i.flags|=128,u=!0,bl(p,!1),i.lanes=4194304)}else{if(!u)if(t=ja(_),t!==null){if(i.flags|=128,u=!0,o=t.updateQueue,o!==null&&(i.updateQueue=o,i.flags|=4),bl(p,!0),p.tail===null&&p.tailMode==="hidden"&&!_.alternate&&!Ct)return Wn(i),null}else 2*ct()-p.renderingStartTime>To&&o!==1073741824&&(i.flags|=128,u=!0,bl(p,!1),i.lanes=4194304);p.isBackwards?(_.sibling=i.child,i.child=_):(o=p.last,o!==null?o.sibling=_:i.child=_,p.last=_)}return p.tail!==null?(i=p.tail,p.rendering=i,p.tail=i.sibling,p.renderingStartTime=ct(),i.sibling=null,o=Pt.current,mt(Pt,u?o&1|2:o&1),i):(Wn(i),null);case 22:case 23:return Ed(),u=i.memoizedState!==null,t!==null&&t.memoizedState!==null!==u&&(i.flags|=8192),u&&(i.mode&1)!==0?(bi&1073741824)!==0&&(Wn(i),i.subtreeFlags&6&&(i.flags|=8192)):Wn(i),null;case 24:return null;case 25:return null}throw Error(n(156,i.tag))}function jw(t,i){switch(Nc(i),i.tag){case 1:return ui(i.type)&&Ta(),t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 3:return Ao(),vt(ai),vt(Vn),Yc(),t=i.flags,(t&65536)!==0&&(t&128)===0?(i.flags=t&-65537|128,i):null;case 5:return Uc(i),null;case 13:if(vt(Pt),t=i.memoizedState,t!==null&&t.dehydrated!==null){if(i.alternate===null)throw Error(n(340));xo()}return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 19:return vt(Pt),null;case 4:return Ao(),null;case 10:return Wc(i.type._context),null;case 22:case 23:return Ed(),null;case 24:return null;default:return null}}var Xa=!1,Fn=!1,Bw=typeof WeakSet=="function"?WeakSet:Set,De=null;function ko(t,i){var o=t.ref;if(o!==null)if(typeof o=="function")try{o(null)}catch(u){It(t,i,u)}else o.current=null}function fd(t,i,o){try{o()}catch(u){It(t,i,u)}}var zp=!1;function Uw(t,i){if(Ec=ot,t=Zn(),Xn(t)){if("selectionStart"in t)var o={start:t.selectionStart,end:t.selectionEnd};else e:{o=(o=t.ownerDocument)&&o.defaultView||window;var u=o.getSelection&&o.getSelection();if(u&&u.rangeCount!==0){o=u.anchorNode;var f=u.anchorOffset,p=u.focusNode;u=u.focusOffset;try{o.nodeType,p.nodeType}catch{o=null;break e}var _=0,b=-1,z=-1,H=0,re=0,oe=t,ee=null;t:for(;;){for(var ye;oe!==o||f!==0&&oe.nodeType!==3||(b=_+f),oe!==p||u!==0&&oe.nodeType!==3||(z=_+u),oe.nodeType===3&&(_+=oe.nodeValue.length),(ye=oe.firstChild)!==null;)ee=oe,oe=ye;for(;;){if(oe===t)break t;if(ee===o&&++H===f&&(b=_),ee===p&&++re===u&&(z=_),(ye=oe.nextSibling)!==null)break;oe=ee,ee=oe.parentNode}oe=ye}o=b===-1||z===-1?null:{start:b,end:z}}else o=null}o=o||{start:0,end:0}}else o=null;for(bc={focusedElem:t,selectionRange:o},ot=!1,De=i;De!==null;)if(i=De,t=i.child,(i.subtreeFlags&1028)!==0&&t!==null)t.return=i,De=t;else for(;De!==null;){i=De;try{var Ce=i.alternate;if((i.flags&1024)!==0)switch(i.tag){case 0:case 11:case 15:break;case 1:if(Ce!==null){var be=Ce.memoizedProps,Gt=Ce.memoizedState,L=i.stateNode,I=L.getSnapshotBeforeUpdate(i.elementType===i.type?be:Zi(i.type,be),Gt);L.__reactInternalSnapshotBeforeUpdate=I}break;case 3:var W=i.stateNode.containerInfo;W.nodeType===1?W.textContent="":W.nodeType===9&&W.documentElement&&W.removeChild(W.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(de){It(i,i.return,de)}if(t=i.sibling,t!==null){t.return=i.return,De=t;break}De=i.return}return Ce=zp,zp=!1,Ce}function Pl(t,i,o){var u=i.updateQueue;if(u=u!==null?u.lastEffect:null,u!==null){var f=u=u.next;do{if((f.tag&t)===t){var p=f.destroy;f.destroy=void 0,p!==void 0&&fd(i,o,p)}f=f.next}while(f!==u)}}function qa(t,i){if(i=i.updateQueue,i=i!==null?i.lastEffect:null,i!==null){var o=i=i.next;do{if((o.tag&t)===t){var u=o.create;o.destroy=u()}o=o.next}while(o!==i)}}function pd(t){var i=t.ref;if(i!==null){var o=t.stateNode;switch(t.tag){case 5:t=o;break;default:t=o}typeof i=="function"?i(t):i.current=t}}function kp(t){var i=t.alternate;i!==null&&(t.alternate=null,kp(i)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(i=t.stateNode,i!==null&&(delete i[ps],delete i[gl],delete i[kc],delete i[Pw],delete i[Aw])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Op(t){return t.tag===5||t.tag===3||t.tag===4}function Tp(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Op(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function md(t,i,o){var u=t.tag;if(u===5||u===6)t=t.stateNode,i?o.nodeType===8?o.parentNode.insertBefore(t,i):o.insertBefore(t,i):(o.nodeType===8?(i=o.parentNode,i.insertBefore(t,o)):(i=o,i.appendChild(t)),o=o._reactRootContainer,o!=null||i.onclick!==null||(i.onclick=ka));else if(u!==4&&(t=t.child,t!==null))for(md(t,i,o),t=t.sibling;t!==null;)md(t,i,o),t=t.sibling}function gd(t,i,o){var u=t.tag;if(u===5||u===6)t=t.stateNode,i?o.insertBefore(t,i):o.appendChild(t);else if(u!==4&&(t=t.child,t!==null))for(gd(t,i,o),t=t.sibling;t!==null;)gd(t,i,o),t=t.sibling}var kn=null,Xi=!1;function ur(t,i,o){for(o=o.child;o!==null;)Ip(t,i,o),o=o.sibling}function Ip(t,i,o){if(si&&typeof si.onCommitFiberUnmount=="function")try{si.onCommitFiberUnmount(Hs,o)}catch{}switch(o.tag){case 5:Fn||ko(o,i);case 6:var u=kn,f=Xi;kn=null,ur(t,i,o),kn=u,Xi=f,kn!==null&&(Xi?(t=kn,o=o.stateNode,t.nodeType===8?t.parentNode.removeChild(o):t.removeChild(o)):kn.removeChild(o.stateNode));break;case 18:kn!==null&&(Xi?(t=kn,o=o.stateNode,t.nodeType===8?zc(t.parentNode,o):t.nodeType===1&&zc(t,o),qs(t)):zc(kn,o.stateNode));break;case 4:u=kn,f=Xi,kn=o.stateNode.containerInfo,Xi=!0,ur(t,i,o),kn=u,Xi=f;break;case 0:case 11:case 14:case 15:if(!Fn&&(u=o.updateQueue,u!==null&&(u=u.lastEffect,u!==null))){f=u=u.next;do{var p=f,_=p.destroy;p=p.tag,_!==void 0&&((p&2)!==0||(p&4)!==0)&&fd(o,i,_),f=f.next}while(f!==u)}ur(t,i,o);break;case 1:if(!Fn&&(ko(o,i),u=o.stateNode,typeof u.componentWillUnmount=="function"))try{u.props=o.memoizedProps,u.state=o.memoizedState,u.componentWillUnmount()}catch(b){It(o,i,b)}ur(t,i,o);break;case 21:ur(t,i,o);break;case 22:o.mode&1?(Fn=(u=Fn)||o.memoizedState!==null,ur(t,i,o),Fn=u):ur(t,i,o);break;default:ur(t,i,o)}}function Np(t){var i=t.updateQueue;if(i!==null){t.updateQueue=null;var o=t.stateNode;o===null&&(o=t.stateNode=new Bw),i.forEach(function(u){var f=e0.bind(null,t,u);o.has(u)||(o.add(u),u.then(f,f))})}}function qi(t,i){var o=i.deletions;if(o!==null)for(var u=0;uf&&(f=_),u&=~p}if(u=f,u=ct()-u,u=(120>u?120:480>u?480:1080>u?1080:1920>u?1920:3e3>u?3e3:4320>u?4320:1960*Yw(u/1960))-u,10t?16:t,dr===null)var u=!1;else{if(t=dr,dr=null,su=0,(Qe&6)!==0)throw Error(n(331));var f=Qe;for(Qe|=4,De=t.current;De!==null;){var p=De,_=p.child;if((De.flags&16)!==0){var b=p.deletions;if(b!==null){for(var z=0;zct()-_d?Hr(t,0):wd|=o),hi(t,i)}function Yp(t,i){i===0&&((t.mode&1)===0?i=1:(i=js,js<<=1,(js&130023424)===0&&(js=4194304)));var o=ei();t=Ts(t,i),t!==null&&(Us(t,i,o),hi(t,o))}function qw(t){var i=t.memoizedState,o=0;i!==null&&(o=i.retryLane),Yp(t,o)}function e0(t,i){var o=0;switch(t.tag){case 13:var u=t.stateNode,f=t.memoizedState;f!==null&&(o=f.retryLane);break;case 19:u=t.stateNode;break;default:throw Error(n(314))}u!==null&&u.delete(i),Yp(t,o)}var Kp;Kp=function(t,i,o){if(t!==null)if(t.memoizedProps!==i.pendingProps||ai.current)ci=!0;else{if((t.lanes&o)===0&&(i.flags&128)===0)return ci=!1,Fw(t,i,o);ci=(t.flags&131072)!==0}else ci=!1,Ct&&(i.flags&1048576)!==0&&Pf(i,Ma,i.index);switch(i.lanes=0,i.tag){case 2:var u=i.type;Za(t,i),t=i.pendingProps;var f=So(i,Vn.current);Po(i,o),f=Qc(null,i,u,t,f,o);var p=Zc();return i.flags|=1,typeof f=="object"&&f!==null&&typeof f.render=="function"&&f.$$typeof===void 0?(i.tag=1,i.memoizedState=null,i.updateQueue=null,ui(u)?(p=!0,Ia(i)):p=!1,i.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,jc(i),f.updater=Ja,i.stateNode=f,f._reactInternals=i,id(i,u,t,o),i=ld(null,i,u,!0,p,o)):(i.tag=0,Ct&&p&&Ic(i),qn(null,i,f,o),i=i.child),i;case 16:u=i.elementType;e:{switch(Za(t,i),t=i.pendingProps,f=u._init,u=f(u._payload),i.type=u,f=i.tag=n0(u),t=Zi(u,t),f){case 0:i=od(null,i,u,t,o);break e;case 1:i=yp(null,i,u,t,o);break e;case 11:i=mp(null,i,u,t,o);break e;case 14:i=gp(null,i,u,Zi(u.type,t),o);break e}throw Error(n(306,u,""))}return i;case 0:return u=i.type,f=i.pendingProps,f=i.elementType===u?f:Zi(u,f),od(t,i,u,f,o);case 1:return u=i.type,f=i.pendingProps,f=i.elementType===u?f:Zi(u,f),yp(t,i,u,f,o);case 3:e:{if(Sp(i),t===null)throw Error(n(387));u=i.pendingProps,p=i.memoizedState,f=p.element,Mf(t,i),Ha(i,u,null,o);var _=i.memoizedState;if(u=_.element,p.isDehydrated)if(p={element:u,isDehydrated:!1,cache:_.cache,pendingSuspenseBoundaries:_.pendingSuspenseBoundaries,transitions:_.transitions},i.updateQueue.baseState=p,i.memoizedState=p,i.flags&256){f=zo(Error(n(423)),i),i=Dp(t,i,u,o,f);break e}else if(u!==f){f=zo(Error(n(424)),i),i=Dp(t,i,u,o,f);break e}else for(Ei=ir(i.stateNode.containerInfo.firstChild),xi=i,Ct=!0,Qi=null,o=Nf(i,null,u,o),i.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(xo(),u===f){i=Ns(t,i,o);break e}qn(t,i,u,o)}i=i.child}return i;case 5:return Gf(i),t===null&&Mc(i),u=i.type,f=i.pendingProps,p=t!==null?t.memoizedProps:null,_=f.children,Pc(u,f)?_=null:p!==null&&Pc(u,p)&&(i.flags|=32),_p(t,i),qn(t,i,_,o),i.child;case 6:return t===null&&Mc(i),null;case 13:return Cp(t,i,o);case 4:return Bc(i,i.stateNode.containerInfo),u=i.pendingProps,t===null?i.child=Eo(i,null,u,o):qn(t,i,u,o),i.child;case 11:return u=i.type,f=i.pendingProps,f=i.elementType===u?f:Zi(u,f),mp(t,i,u,f,o);case 7:return qn(t,i,i.pendingProps,o),i.child;case 8:return qn(t,i,i.pendingProps.children,o),i.child;case 12:return qn(t,i,i.pendingProps.children,o),i.child;case 10:e:{if(u=i.type._context,f=i.pendingProps,p=i.memoizedProps,_=f.value,mt(Ga,u._currentValue),u._currentValue=_,p!==null)if(dt(p.value,_)){if(p.children===f.children&&!ai.current){i=Ns(t,i,o);break e}}else for(p=i.child,p!==null&&(p.return=i);p!==null;){var b=p.dependencies;if(b!==null){_=p.child;for(var z=b.firstContext;z!==null;){if(z.context===u){if(p.tag===1){z=Is(-1,o&-o),z.tag=2;var H=p.updateQueue;if(H!==null){H=H.shared;var re=H.pending;re===null?z.next=z:(z.next=re.next,re.next=z),H.pending=z}}p.lanes|=o,z=p.alternate,z!==null&&(z.lanes|=o),Fc(p.return,o,i),b.lanes|=o;break}z=z.next}}else if(p.tag===10)_=p.type===i.type?null:p.child;else if(p.tag===18){if(_=p.return,_===null)throw Error(n(341));_.lanes|=o,b=_.alternate,b!==null&&(b.lanes|=o),Fc(_,o,i),_=p.sibling}else _=p.child;if(_!==null)_.return=p;else for(_=p;_!==null;){if(_===i){_=null;break}if(p=_.sibling,p!==null){p.return=_.return,_=p;break}_=_.return}p=_}qn(t,i,f.children,o),i=i.child}return i;case 9:return f=i.type,u=i.pendingProps.children,Po(i,o),f=Vi(f),u=u(f),i.flags|=1,qn(t,i,u,o),i.child;case 14:return u=i.type,f=Zi(u,i.pendingProps),f=Zi(u.type,f),gp(t,i,u,f,o);case 15:return vp(t,i,i.type,i.pendingProps,o);case 17:return u=i.type,f=i.pendingProps,f=i.elementType===u?f:Zi(u,f),Za(t,i),i.tag=1,ui(u)?(t=!0,Ia(i)):t=!1,Po(i,o),ap(i,u,f),id(i,u,f,o),ld(null,i,u,!0,t,o);case 19:return Ep(t,i,o);case 22:return wp(t,i,o)}throw Error(n(156,i.tag))};function Jp(t,i){return Mt(t,i)}function t0(t,i,o,u){this.tag=t,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Fi(t,i,o,u){return new t0(t,i,o,u)}function Pd(t){return t=t.prototype,!(!t||!t.isReactComponent)}function n0(t){if(typeof t=="function")return Pd(t)?1:0;if(t!=null){if(t=t.$$typeof,t===ve)return 11;if(t===j)return 14}return 2}function pr(t,i){var o=t.alternate;return o===null?(o=Fi(t.tag,i,t.key,t.mode),o.elementType=t.elementType,o.type=t.type,o.stateNode=t.stateNode,o.alternate=t,t.alternate=o):(o.pendingProps=i,o.type=t.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=t.flags&14680064,o.childLanes=t.childLanes,o.lanes=t.lanes,o.child=t.child,o.memoizedProps=t.memoizedProps,o.memoizedState=t.memoizedState,o.updateQueue=t.updateQueue,i=t.dependencies,o.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},o.sibling=t.sibling,o.index=t.index,o.ref=t.ref,o}function au(t,i,o,u,f,p){var _=2;if(u=t,typeof t=="function")Pd(t)&&(_=1);else if(typeof t=="string")_=5;else e:switch(t){case $:return Br(o.children,f,p,i);case K:_=8,f|=8;break;case he:return t=Fi(12,o,i,f|2),t.elementType=he,t.lanes=p,t;case ie:return t=Fi(13,o,i,f),t.elementType=ie,t.lanes=p,t;case ce:return t=Fi(19,o,i,f),t.elementType=ce,t.lanes=p,t;case X:return uu(o,f,p,i);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case ue:_=10;break e;case Q:_=9;break e;case ve:_=11;break e;case j:_=14;break e;case te:_=16,u=null;break e}throw Error(n(130,t==null?t:typeof t,""))}return i=Fi(_,o,i,f),i.elementType=t,i.type=u,i.lanes=p,i}function Br(t,i,o,u){return t=Fi(7,t,u,i),t.lanes=o,t}function uu(t,i,o,u){return t=Fi(22,t,u,i),t.elementType=X,t.lanes=o,t.stateNode={isHidden:!1},t}function Ad(t,i,o){return t=Fi(6,t,null,i),t.lanes=o,t}function zd(t,i,o){return i=Fi(4,t.children!==null?t.children:[],t.key,i),i.lanes=o,i.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},i}function i0(t,i,o,u,f){this.tag=i,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=il(0),this.expirationTimes=il(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=il(0),this.identifierPrefix=u,this.onRecoverableError=f,this.mutableSourceEagerHydrationData=null}function kd(t,i,o,u,f,p,_,b,z){return t=new i0(t,i,o,b,z),i===1?(i=1,p===!0&&(i|=8)):i=0,p=Fi(3,null,null,i),t.current=p,p.stateNode=t,p.memoizedState={element:u,isDehydrated:o,cache:null,transitions:null,pendingSuspenseBoundaries:null},jc(p),t}function s0(t,i,o){var u=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(e){console.error(e)}}return r(),Md.exports=v0(),Md.exports}var um;function w0(){if(um)return gu;um=1;var r=Gg();return gu.createRoot=r.createRoot,gu.hydrateRoot=r.hydrateRoot,gu}var _0=w0();const y0=zh(_0);var Kr=Gg();const S0=zh(Kr),Ju=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ko(r){const e=Object.prototype.toString.call(r);return e==="[object Window]"||e==="[object global]"}function Oh(r){return"nodeType"in r}function ni(r){var e,n;return r?Ko(r)?r:Oh(r)&&(e=(n=r.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function Th(r){const{Document:e}=ni(r);return r instanceof e}function ta(r){return Ko(r)?!1:r instanceof ni(r).HTMLElement}function Wg(r){return r instanceof ni(r).SVGElement}function Jo(r){return r?Ko(r)?r.document:Oh(r)?Th(r)?r:ta(r)||Wg(r)?r.ownerDocument:document:document:document}const Gs=Ju?B.useLayoutEffect:B.useEffect;function Qu(r){const e=B.useRef(r);return Gs(()=>{e.current=r}),B.useCallback(function(){for(var n=arguments.length,s=new Array(n),l=0;l{r.current=setInterval(s,l)},[]),n=B.useCallback(()=>{r.current!==null&&(clearInterval(r.current),r.current=null)},[]);return[e,n]}function Kl(r,e){e===void 0&&(e=[r]);const n=B.useRef(r);return Gs(()=>{n.current!==r&&(n.current=r)},e),n}function na(r,e){const n=B.useRef();return B.useMemo(()=>{const s=r(n.current);return n.current=s,s},[...e])}function Ru(r){const e=Qu(r),n=B.useRef(null),s=B.useCallback(l=>{l!==n.current&&(e==null||e(l,n.current)),n.current=l},[]);return[n,s]}function Mu(r){const e=B.useRef();return B.useEffect(()=>{e.current=r},[r]),e.current}let Gd={};function Zu(r,e){return B.useMemo(()=>{if(e)return e;const n=Gd[r]==null?0:Gd[r]+1;return Gd[r]=n,r+"-"+n},[r,e])}function Fg(r){return function(e){for(var n=arguments.length,s=new Array(n>1?n-1:0),l=1;l{const d=Object.entries(c);for(const[h,m]of d){const w=a[h];w!=null&&(a[h]=w+r*m)}return a},{...e})}}const Wo=Fg(1),Lu=Fg(-1);function C0(r){return"clientX"in r&&"clientY"in r}function Ih(r){if(!r)return!1;const{KeyboardEvent:e}=ni(r.target);return e&&r instanceof e}function x0(r){if(!r)return!1;const{TouchEvent:e}=ni(r.target);return e&&r instanceof e}function Vu(r){if(x0(r)){if(r.touches&&r.touches.length){const{clientX:e,clientY:n}=r.touches[0];return{x:e,y:n}}else if(r.changedTouches&&r.changedTouches.length){const{clientX:e,clientY:n}=r.changedTouches[0];return{x:e,y:n}}}return C0(r)?{x:r.clientX,y:r.clientY}:null}const Jl=Object.freeze({Translate:{toString(r){if(!r)return;const{x:e,y:n}=r;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(r){if(!r)return;const{scaleX:e,scaleY:n}=r;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(r){if(r)return[Jl.Translate.toString(r),Jl.Scale.toString(r)].join(" ")}},Transition:{toString(r){let{property:e,duration:n,easing:s}=r;return e+" "+n+"ms "+s}}}),cm="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function E0(r){return r.matches(cm)?r:r.querySelector(cm)}const b0={display:"none"};function P0(r){let{id:e,value:n}=r;return pe.createElement("div",{id:e,style:b0},n)}function A0(r){let{id:e,announcement:n,ariaLiveType:s="assertive"}=r;const l={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return pe.createElement("div",{id:e,style:l,role:"status","aria-live":s,"aria-atomic":!0},n)}function z0(){const[r,e]=B.useState("");return{announce:B.useCallback(s=>{s!=null&&e(s)},[]),announcement:r}}const Hg=B.createContext(null);function k0(r){const e=B.useContext(Hg);B.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of ");return e(r)},[r,e])}function O0(){const[r]=B.useState(()=>new Set),e=B.useCallback(s=>(r.add(s),()=>r.delete(s)),[r]);return[B.useCallback(s=>{let{type:l,event:a}=s;r.forEach(c=>{var d;return(d=c[l])==null?void 0:d.call(c,a)})},[r]),e]}const T0={draggable:` + To pick up a draggable item, press the space bar. + While dragging, use the arrow keys to move the item. + Press space again to drop the item in its new position, or press escape to cancel. + `},I0={onDragStart(r){let{active:e}=r;return"Picked up draggable item "+e.id+"."},onDragOver(r){let{active:e,over:n}=r;return n?"Draggable item "+e.id+" was moved over droppable area "+n.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(r){let{active:e,over:n}=r;return n?"Draggable item "+e.id+" was dropped over droppable area "+n.id:"Draggable item "+e.id+" was dropped."},onDragCancel(r){let{active:e}=r;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function N0(r){let{announcements:e=I0,container:n,hiddenTextDescribedById:s,screenReaderInstructions:l=T0}=r;const{announce:a,announcement:c}=z0(),d=Zu("DndLiveRegion"),[h,m]=B.useState(!1);if(B.useEffect(()=>{m(!0)},[]),k0(B.useMemo(()=>({onDragStart(v){let{active:S}=v;a(e.onDragStart({active:S}))},onDragMove(v){let{active:S,over:E}=v;e.onDragMove&&a(e.onDragMove({active:S,over:E}))},onDragOver(v){let{active:S,over:E}=v;a(e.onDragOver({active:S,over:E}))},onDragEnd(v){let{active:S,over:E}=v;a(e.onDragEnd({active:S,over:E}))},onDragCancel(v){let{active:S,over:E}=v;a(e.onDragCancel({active:S,over:E}))}}),[a,e])),!h)return null;const w=pe.createElement(pe.Fragment,null,pe.createElement(P0,{id:s,value:l.draggable}),pe.createElement(A0,{id:d,announcement:c}));return n?Kr.createPortal(w,n):w}var an;(function(r){r.DragStart="dragStart",r.DragMove="dragMove",r.DragEnd="dragEnd",r.DragCancel="dragCancel",r.DragOver="dragOver",r.RegisterDroppable="registerDroppable",r.SetDroppableDisabled="setDroppableDisabled",r.UnregisterDroppable="unregisterDroppable"})(an||(an={}));function Gu(){}function R0(r,e){return B.useMemo(()=>({sensor:r,options:e??{}}),[r,e])}function M0(){for(var r=arguments.length,e=new Array(r),n=0;n[...e].filter(s=>s!=null),[...e])}const os=Object.freeze({x:0,y:0});function L0(r,e){const n=Vu(r);if(!n)return"0 0";const s={x:(n.x-e.left)/e.width*100,y:(n.y-e.top)/e.height*100};return s.x+"% "+s.y+"%"}function V0(r,e){let{data:{value:n}}=r,{data:{value:s}}=e;return s-n}function G0(r,e){if(!r||r.length===0)return null;const[n]=r;return n[e]}function W0(r,e){const n=Math.max(e.top,r.top),s=Math.max(e.left,r.left),l=Math.min(e.left+e.width,r.left+r.width),a=Math.min(e.top+e.height,r.top+r.height),c=l-s,d=a-n;if(s{let{collisionRect:e,droppableRects:n,droppableContainers:s}=r;const l=[];for(const a of s){const{id:c}=a,d=n.get(c);if(d){const h=W0(d,e);h>0&&l.push({id:c,data:{droppableContainer:a,value:h}})}}return l.sort(V0)};function H0(r,e,n){return{...r,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function jg(r,e){return r&&e?{x:r.left-e.left,y:r.top-e.top}:os}function j0(r){return function(n){for(var s=arguments.length,l=new Array(s>1?s-1:0),a=1;a({...c,top:c.top+r*d.y,bottom:c.bottom+r*d.y,left:c.left+r*d.x,right:c.right+r*d.x}),{...n})}}const B0=j0(1);function Bg(r){if(r.startsWith("matrix3d(")){const e=r.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(r.startsWith("matrix(")){const e=r.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function U0(r,e,n){const s=Bg(e);if(!s)return r;const{scaleX:l,scaleY:a,x:c,y:d}=s,h=r.left-c-(1-l)*parseFloat(n),m=r.top-d-(1-a)*parseFloat(n.slice(n.indexOf(" ")+1)),w=l?r.width/l:r.width,v=a?r.height/a:r.height;return{width:w,height:v,top:m,right:h+w,bottom:m+v,left:h}}const $0={ignoreTransform:!1};function ia(r,e){e===void 0&&(e=$0);let n=r.getBoundingClientRect();if(e.ignoreTransform){const{transform:m,transformOrigin:w}=ni(r).getComputedStyle(r);m&&(n=U0(n,m,w))}const{top:s,left:l,width:a,height:c,bottom:d,right:h}=n;return{top:s,left:l,width:a,height:c,bottom:d,right:h}}function dm(r){return ia(r,{ignoreTransform:!0})}function Y0(r){const e=r.innerWidth,n=r.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function K0(r,e){return e===void 0&&(e=ni(r).getComputedStyle(r)),e.position==="fixed"}function J0(r,e){e===void 0&&(e=ni(r).getComputedStyle(r));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(l=>{const a=e[l];return typeof a=="string"?n.test(a):!1})}function Nh(r,e){const n=[];function s(l){if(e!=null&&n.length>=e||!l)return n;if(Th(l)&&l.scrollingElement!=null&&!n.includes(l.scrollingElement))return n.push(l.scrollingElement),n;if(!ta(l)||Wg(l)||n.includes(l))return n;const a=ni(r).getComputedStyle(l);return l!==r&&J0(l,a)&&n.push(l),K0(l,a)?n:s(l.parentNode)}return r?s(r):n}function Ug(r){const[e]=Nh(r,1);return e??null}function Wd(r){return!Ju||!r?null:Ko(r)?r:Oh(r)?Th(r)||r===Jo(r).scrollingElement?window:ta(r)?r:null:null}function $g(r){return Ko(r)?r.scrollX:r.scrollLeft}function Yg(r){return Ko(r)?r.scrollY:r.scrollTop}function sh(r){return{x:$g(r),y:Yg(r)}}var Dn;(function(r){r[r.Forward=1]="Forward",r[r.Backward=-1]="Backward"})(Dn||(Dn={}));function Kg(r){return!Ju||!r?!1:r===document.scrollingElement}function Jg(r){const e={x:0,y:0},n=Kg(r)?{height:window.innerHeight,width:window.innerWidth}:{height:r.clientHeight,width:r.clientWidth},s={x:r.scrollWidth-n.width,y:r.scrollHeight-n.height},l=r.scrollTop<=e.y,a=r.scrollLeft<=e.x,c=r.scrollTop>=s.y,d=r.scrollLeft>=s.x;return{isTop:l,isLeft:a,isBottom:c,isRight:d,maxScroll:s,minScroll:e}}const Q0={x:.2,y:.2};function Z0(r,e,n,s,l){let{top:a,left:c,right:d,bottom:h}=n;s===void 0&&(s=10),l===void 0&&(l=Q0);const{isTop:m,isBottom:w,isLeft:v,isRight:S}=Jg(r),E={x:0,y:0},A={x:0,y:0},D={height:e.height*l.y,width:e.width*l.x};return!m&&a<=e.top+D.height?(E.y=Dn.Backward,A.y=s*Math.abs((e.top+D.height-a)/D.height)):!w&&h>=e.bottom-D.height&&(E.y=Dn.Forward,A.y=s*Math.abs((e.bottom-D.height-h)/D.height)),!S&&d>=e.right-D.width?(E.x=Dn.Forward,A.x=s*Math.abs((e.right-D.width-d)/D.width)):!v&&c<=e.left+D.width&&(E.x=Dn.Backward,A.x=s*Math.abs((e.left+D.width-c)/D.width)),{direction:E,speed:A}}function X0(r){if(r===document.scrollingElement){const{innerWidth:a,innerHeight:c}=window;return{top:0,left:0,right:a,bottom:c,width:a,height:c}}const{top:e,left:n,right:s,bottom:l}=r.getBoundingClientRect();return{top:e,left:n,right:s,bottom:l,width:r.clientWidth,height:r.clientHeight}}function Qg(r){return r.reduce((e,n)=>Wo(e,sh(n)),os)}function q0(r){return r.reduce((e,n)=>e+$g(n),0)}function e_(r){return r.reduce((e,n)=>e+Yg(n),0)}function Zg(r,e){if(e===void 0&&(e=ia),!r)return;const{top:n,left:s,bottom:l,right:a}=e(r);Ug(r)&&(l<=0||a<=0||n>=window.innerHeight||s>=window.innerWidth)&&r.scrollIntoView({block:"center",inline:"center"})}const t_=[["x",["left","right"],q0],["y",["top","bottom"],e_]];class Rh{constructor(e,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const s=Nh(n),l=Qg(s);this.rect={...e},this.width=e.width,this.height=e.height;for(const[a,c,d]of t_)for(const h of c)Object.defineProperty(this,h,{get:()=>{const m=d(s),w=l[a]-m;return this.rect[h]+w},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Hl{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var s;return(s=this.target)==null?void 0:s.removeEventListener(...n)})},this.target=e}add(e,n,s){var l;(l=this.target)==null||l.addEventListener(e,n,s),this.listeners.push([e,n,s])}}function n_(r){const{EventTarget:e}=ni(r);return r instanceof e?r:Jo(r)}function Fd(r,e){const n=Math.abs(r.x),s=Math.abs(r.y);return typeof e=="number"?Math.sqrt(n**2+s**2)>e:"x"in e&&"y"in e?n>e.x&&s>e.y:"x"in e?n>e.x:"y"in e?s>e.y:!1}var Bi;(function(r){r.Click="click",r.DragStart="dragstart",r.Keydown="keydown",r.ContextMenu="contextmenu",r.Resize="resize",r.SelectionChange="selectionchange",r.VisibilityChange="visibilitychange"})(Bi||(Bi={}));function hm(r){r.preventDefault()}function i_(r){r.stopPropagation()}var ht;(function(r){r.Space="Space",r.Down="ArrowDown",r.Right="ArrowRight",r.Left="ArrowLeft",r.Up="ArrowUp",r.Esc="Escape",r.Enter="Enter",r.Tab="Tab"})(ht||(ht={}));const Xg={start:[ht.Space,ht.Enter],cancel:[ht.Esc],end:[ht.Space,ht.Enter,ht.Tab]},s_=(r,e)=>{let{currentCoordinates:n}=e;switch(r.code){case ht.Right:return{...n,x:n.x+25};case ht.Left:return{...n,x:n.x-25};case ht.Down:return{...n,y:n.y+25};case ht.Up:return{...n,y:n.y-25}}};class qg{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new Hl(Jo(n)),this.windowListeners=new Hl(ni(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Bi.Resize,this.handleCancel),this.windowListeners.add(Bi.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Bi.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,s=e.node.current;s&&Zg(s),n(os)}handleKeyDown(e){if(Ih(e)){const{active:n,context:s,options:l}=this.props,{keyboardCodes:a=Xg,coordinateGetter:c=s_,scrollBehavior:d="smooth"}=l,{code:h}=e;if(a.end.includes(h)){this.handleEnd(e);return}if(a.cancel.includes(h)){this.handleCancel(e);return}const{collisionRect:m}=s.current,w=m?{x:m.left,y:m.top}:os;this.referenceCoordinates||(this.referenceCoordinates=w);const v=c(e,{active:n,context:s.current,currentCoordinates:w});if(v){const S=Lu(v,w),E={x:0,y:0},{scrollableAncestors:A}=s.current;for(const D of A){const P=e.code,{isTop:R,isRight:O,isLeft:M,isBottom:N,maxScroll:Z,minScroll:G}=Jg(D),$=X0(D),K={x:Math.min(P===ht.Right?$.right-$.width/2:$.right,Math.max(P===ht.Right?$.left:$.left+$.width/2,v.x)),y:Math.min(P===ht.Down?$.bottom-$.height/2:$.bottom,Math.max(P===ht.Down?$.top:$.top+$.height/2,v.y))},he=P===ht.Right&&!O||P===ht.Left&&!M,ue=P===ht.Down&&!N||P===ht.Up&&!R;if(he&&K.x!==v.x){const Q=D.scrollLeft+S.x,ve=P===ht.Right&&Q<=Z.x||P===ht.Left&&Q>=G.x;if(ve&&!S.y){D.scrollTo({left:Q,behavior:d});return}ve?E.x=D.scrollLeft-Q:E.x=P===ht.Right?D.scrollLeft-Z.x:D.scrollLeft-G.x,E.x&&D.scrollBy({left:-E.x,behavior:d});break}else if(ue&&K.y!==v.y){const Q=D.scrollTop+S.y,ve=P===ht.Down&&Q<=Z.y||P===ht.Up&&Q>=G.y;if(ve&&!S.x){D.scrollTo({top:Q,behavior:d});return}ve?E.y=D.scrollTop-Q:E.y=P===ht.Down?D.scrollTop-Z.y:D.scrollTop-G.y,E.y&&D.scrollBy({top:-E.y,behavior:d});break}}this.handleMove(e,Wo(Lu(v,this.referenceCoordinates),E))}}}handleMove(e,n){const{onMove:s}=this.props;e.preventDefault(),s(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}qg.activators=[{eventName:"onKeyDown",handler:(r,e,n)=>{let{keyboardCodes:s=Xg,onActivation:l}=e,{active:a}=n;const{code:c}=r.nativeEvent;if(s.start.includes(c)){const d=a.activatorNode.current;return d&&r.target!==d?!1:(r.preventDefault(),l==null||l({event:r.nativeEvent}),!0)}return!1}}];function fm(r){return!!(r&&"distance"in r)}function pm(r){return!!(r&&"delay"in r)}class Mh{constructor(e,n,s){var l;s===void 0&&(s=n_(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;const{event:a}=e,{target:c}=a;this.props=e,this.events=n,this.document=Jo(c),this.documentListeners=new Hl(this.document),this.listeners=new Hl(s),this.windowListeners=new Hl(ni(c)),this.initialCoordinates=(l=Vu(a))!=null?l:os,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:n,bypassActivationConstraint:s}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Bi.Resize,this.handleCancel),this.windowListeners.add(Bi.DragStart,hm),this.windowListeners.add(Bi.VisibilityChange,this.handleCancel),this.windowListeners.add(Bi.ContextMenu,hm),this.documentListeners.add(Bi.Keydown,this.handleKeydown),n){if(s!=null&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(pm(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(fm(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,n){const{active:s,onPending:l}=this.props;l(s,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(Bi.Click,i_,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Bi.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:s,initialCoordinates:l,props:a}=this,{onMove:c,options:{activationConstraint:d}}=a;if(!l)return;const h=(n=Vu(e))!=null?n:os,m=Lu(l,h);if(!s&&d){if(fm(d)){if(d.tolerance!=null&&Fd(m,d.tolerance))return this.handleCancel();if(Fd(m,d.distance))return this.handleStart()}if(pm(d)&&Fd(m,d.tolerance))return this.handleCancel();this.handlePending(d,m);return}e.cancelable&&e.preventDefault(),c(h)}handleEnd(){const{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){const{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===ht.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const r_={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Lh extends Mh{constructor(e){const{event:n}=e,s=Jo(n.target);super(e,r_,s)}}Lh.activators=[{eventName:"onPointerDown",handler:(r,e)=>{let{nativeEvent:n}=r,{onActivation:s}=e;return!n.isPrimary||n.button!==0?!1:(s==null||s({event:n}),!0)}}];const o_={move:{name:"mousemove"},end:{name:"mouseup"}};var rh;(function(r){r[r.RightClick=2]="RightClick"})(rh||(rh={}));class l_ extends Mh{constructor(e){super(e,o_,Jo(e.event.target))}}l_.activators=[{eventName:"onMouseDown",handler:(r,e)=>{let{nativeEvent:n}=r,{onActivation:s}=e;return n.button===rh.RightClick?!1:(s==null||s({event:n}),!0)}}];const Hd={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class a_ extends Mh{constructor(e){super(e,Hd)}static setup(){return window.addEventListener(Hd.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Hd.move.name,e)};function e(){}}}a_.activators=[{eventName:"onTouchStart",handler:(r,e)=>{let{nativeEvent:n}=r,{onActivation:s}=e;const{touches:l}=n;return l.length>1?!1:(s==null||s({event:n}),!0)}}];var jl;(function(r){r[r.Pointer=0]="Pointer",r[r.DraggableRect=1]="DraggableRect"})(jl||(jl={}));var Wu;(function(r){r[r.TreeOrder=0]="TreeOrder",r[r.ReversedTreeOrder=1]="ReversedTreeOrder"})(Wu||(Wu={}));function u_(r){let{acceleration:e,activator:n=jl.Pointer,canScroll:s,draggingRect:l,enabled:a,interval:c=5,order:d=Wu.TreeOrder,pointerCoordinates:h,scrollableAncestors:m,scrollableAncestorRects:w,delta:v,threshold:S}=r;const E=d_({delta:v,disabled:!a}),[A,D]=D0(),P=B.useRef({x:0,y:0}),R=B.useRef({x:0,y:0}),O=B.useMemo(()=>{switch(n){case jl.Pointer:return h?{top:h.y,bottom:h.y,left:h.x,right:h.x}:null;case jl.DraggableRect:return l}},[n,l,h]),M=B.useRef(null),N=B.useCallback(()=>{const G=M.current;if(!G)return;const $=P.current.x*R.current.x,K=P.current.y*R.current.y;G.scrollBy($,K)},[]),Z=B.useMemo(()=>d===Wu.TreeOrder?[...m].reverse():m,[d,m]);B.useEffect(()=>{if(!a||!m.length||!O){D();return}for(const G of Z){if((s==null?void 0:s(G))===!1)continue;const $=m.indexOf(G),K=w[$];if(!K)continue;const{direction:he,speed:ue}=Z0(G,K,O,e,S);for(const Q of["x","y"])E[Q][he[Q]]||(ue[Q]=0,he[Q]=0);if(ue.x>0||ue.y>0){D(),M.current=G,A(N,c),P.current=ue,R.current=he;return}}P.current={x:0,y:0},R.current={x:0,y:0},D()},[e,N,s,D,a,c,JSON.stringify(O),JSON.stringify(E),A,m,Z,w,JSON.stringify(S)])}const c_={x:{[Dn.Backward]:!1,[Dn.Forward]:!1},y:{[Dn.Backward]:!1,[Dn.Forward]:!1}};function d_(r){let{delta:e,disabled:n}=r;const s=Mu(e);return na(l=>{if(n||!s||!l)return c_;const a={x:Math.sign(e.x-s.x),y:Math.sign(e.y-s.y)};return{x:{[Dn.Backward]:l.x[Dn.Backward]||a.x===-1,[Dn.Forward]:l.x[Dn.Forward]||a.x===1},y:{[Dn.Backward]:l.y[Dn.Backward]||a.y===-1,[Dn.Forward]:l.y[Dn.Forward]||a.y===1}}},[n,e,s])}function h_(r,e){const n=e!=null?r.get(e):void 0,s=n?n.node.current:null;return na(l=>{var a;return e==null?null:(a=s??l)!=null?a:null},[s,e])}function f_(r,e){return B.useMemo(()=>r.reduce((n,s)=>{const{sensor:l}=s,a=l.activators.map(c=>({eventName:c.eventName,handler:e(c.handler,s)}));return[...n,...a]},[]),[r,e])}var Ql;(function(r){r[r.Always=0]="Always",r[r.BeforeDragging=1]="BeforeDragging",r[r.WhileDragging=2]="WhileDragging"})(Ql||(Ql={}));var oh;(function(r){r.Optimized="optimized"})(oh||(oh={}));const mm=new Map;function p_(r,e){let{dragging:n,dependencies:s,config:l}=e;const[a,c]=B.useState(null),{frequency:d,measure:h,strategy:m}=l,w=B.useRef(r),v=P(),S=Kl(v),E=B.useCallback(function(R){R===void 0&&(R=[]),!S.current&&c(O=>O===null?R:O.concat(R.filter(M=>!O.includes(M))))},[S]),A=B.useRef(null),D=na(R=>{if(v&&!n)return mm;if(!R||R===mm||w.current!==r||a!=null){const O=new Map;for(let M of r){if(!M)continue;if(a&&a.length>0&&!a.includes(M.id)&&M.rect.current){O.set(M.id,M.rect.current);continue}const N=M.node.current,Z=N?new Rh(h(N),N):null;M.rect.current=Z,Z&&O.set(M.id,Z)}return O}return R},[r,a,n,v,h]);return B.useEffect(()=>{w.current=r},[r]),B.useEffect(()=>{v||E()},[n,v]),B.useEffect(()=>{a&&a.length>0&&c(null)},[JSON.stringify(a)]),B.useEffect(()=>{v||typeof d!="number"||A.current!==null||(A.current=setTimeout(()=>{E(),A.current=null},d))},[d,v,E,...s]),{droppableRects:D,measureDroppableContainers:E,measuringScheduled:a!=null};function P(){switch(m){case Ql.Always:return!1;case Ql.BeforeDragging:return n;default:return!n}}}function Vh(r,e){return na(n=>r?n||(typeof e=="function"?e(r):r):null,[e,r])}function m_(r,e){return Vh(r,e)}function g_(r){let{callback:e,disabled:n}=r;const s=Qu(e),l=B.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(s)},[s,n]);return B.useEffect(()=>()=>l==null?void 0:l.disconnect(),[l]),l}function Xu(r){let{callback:e,disabled:n}=r;const s=Qu(e),l=B.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(s)},[n]);return B.useEffect(()=>()=>l==null?void 0:l.disconnect(),[l]),l}function v_(r){return new Rh(ia(r),r)}function gm(r,e,n){e===void 0&&(e=v_);const[s,l]=B.useState(null);function a(){l(h=>{if(!r)return null;if(r.isConnected===!1){var m;return(m=h??n)!=null?m:null}const w=e(r);return JSON.stringify(h)===JSON.stringify(w)?h:w})}const c=g_({callback(h){if(r)for(const m of h){const{type:w,target:v}=m;if(w==="childList"&&v instanceof HTMLElement&&v.contains(r)){a();break}}}}),d=Xu({callback:a});return Gs(()=>{a(),r?(d==null||d.observe(r),c==null||c.observe(document.body,{childList:!0,subtree:!0})):(d==null||d.disconnect(),c==null||c.disconnect())},[r]),s}function w_(r){const e=Vh(r);return jg(r,e)}const vm=[];function __(r){const e=B.useRef(r),n=na(s=>r?s&&s!==vm&&r&&e.current&&r.parentNode===e.current.parentNode?s:Nh(r):vm,[r]);return B.useEffect(()=>{e.current=r},[r]),n}function y_(r){const[e,n]=B.useState(null),s=B.useRef(r),l=B.useCallback(a=>{const c=Wd(a.target);c&&n(d=>d?(d.set(c,sh(c)),new Map(d)):null)},[]);return B.useEffect(()=>{const a=s.current;if(r!==a){c(a);const d=r.map(h=>{const m=Wd(h);return m?(m.addEventListener("scroll",l,{passive:!0}),[m,sh(m)]):null}).filter(h=>h!=null);n(d.length?new Map(d):null),s.current=r}return()=>{c(r),c(a)};function c(d){d.forEach(h=>{const m=Wd(h);m==null||m.removeEventListener("scroll",l)})}},[l,r]),B.useMemo(()=>r.length?e?Array.from(e.values()).reduce((a,c)=>Wo(a,c),os):Qg(r):os,[r,e])}function wm(r,e){e===void 0&&(e=[]);const n=B.useRef(null);return B.useEffect(()=>{n.current=null},e),B.useEffect(()=>{const s=r!==os;s&&!n.current&&(n.current=r),!s&&n.current&&(n.current=null)},[r]),n.current?Lu(r,n.current):os}function S_(r){B.useEffect(()=>{if(!Ju)return;const e=r.map(n=>{let{sensor:s}=n;return s.setup==null?void 0:s.setup()});return()=>{for(const n of e)n==null||n()}},r.map(e=>{let{sensor:n}=e;return n}))}function D_(r,e){return B.useMemo(()=>r.reduce((n,s)=>{let{eventName:l,handler:a}=s;return n[l]=c=>{a(c,e)},n},{}),[r,e])}function ev(r){return B.useMemo(()=>r?Y0(r):null,[r])}const _m=[];function C_(r,e){e===void 0&&(e=ia);const[n]=r,s=ev(n?ni(n):null),[l,a]=B.useState(_m);function c(){a(()=>r.length?r.map(h=>Kg(h)?s:new Rh(e(h),h)):_m)}const d=Xu({callback:c});return Gs(()=>{d==null||d.disconnect(),c(),r.forEach(h=>d==null?void 0:d.observe(h))},[r]),l}function tv(r){if(!r)return null;if(r.children.length>1)return r;const e=r.children[0];return ta(e)?e:r}function x_(r){let{measure:e}=r;const[n,s]=B.useState(null),l=B.useCallback(m=>{for(const{target:w}of m)if(ta(w)){s(v=>{const S=e(w);return v?{...v,width:S.width,height:S.height}:S});break}},[e]),a=Xu({callback:l}),c=B.useCallback(m=>{const w=tv(m);a==null||a.disconnect(),w&&(a==null||a.observe(w)),s(w?e(w):null)},[e,a]),[d,h]=Ru(c);return B.useMemo(()=>({nodeRef:d,rect:n,setRef:h}),[n,d,h])}const E_=[{sensor:Lh,options:{}},{sensor:qg,options:{}}],b_={current:{}},Au={draggable:{measure:dm},droppable:{measure:dm,strategy:Ql.WhileDragging,frequency:oh.Optimized},dragOverlay:{measure:ia}};class Bl extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,s;return(n=(s=this.get(e))==null?void 0:s.node.current)!=null?n:void 0}}const P_={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Bl,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Gu},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Au,measureDroppableContainers:Gu,windowRect:null,measuringScheduled:!1},nv={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Gu,draggableNodes:new Map,over:null,measureDroppableContainers:Gu},sa=B.createContext(nv),iv=B.createContext(P_);function A_(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Bl}}}function z_(r,e){switch(e.type){case an.DragStart:return{...r,draggable:{...r.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case an.DragMove:return r.draggable.active==null?r:{...r,draggable:{...r.draggable,translate:{x:e.coordinates.x-r.draggable.initialCoordinates.x,y:e.coordinates.y-r.draggable.initialCoordinates.y}}};case an.DragEnd:case an.DragCancel:return{...r,draggable:{...r.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case an.RegisterDroppable:{const{element:n}=e,{id:s}=n,l=new Bl(r.droppable.containers);return l.set(s,n),{...r,droppable:{...r.droppable,containers:l}}}case an.SetDroppableDisabled:{const{id:n,key:s,disabled:l}=e,a=r.droppable.containers.get(n);if(!a||s!==a.key)return r;const c=new Bl(r.droppable.containers);return c.set(n,{...a,disabled:l}),{...r,droppable:{...r.droppable,containers:c}}}case an.UnregisterDroppable:{const{id:n,key:s}=e,l=r.droppable.containers.get(n);if(!l||s!==l.key)return r;const a=new Bl(r.droppable.containers);return a.delete(n),{...r,droppable:{...r.droppable,containers:a}}}default:return r}}function k_(r){let{disabled:e}=r;const{active:n,activatorEvent:s,draggableNodes:l}=B.useContext(sa),a=Mu(s),c=Mu(n==null?void 0:n.id);return B.useEffect(()=>{if(!e&&!s&&a&&c!=null){if(!Ih(a)||document.activeElement===a.target)return;const d=l.get(c);if(!d)return;const{activatorNode:h,node:m}=d;if(!h.current&&!m.current)return;requestAnimationFrame(()=>{for(const w of[h.current,m.current]){if(!w)continue;const v=E0(w);if(v){v.focus();break}}})}},[s,e,l,c,a]),null}function sv(r,e){let{transform:n,...s}=e;return r!=null&&r.length?r.reduce((l,a)=>a({transform:l,...s}),n):n}function O_(r){return B.useMemo(()=>({draggable:{...Au.draggable,...r==null?void 0:r.draggable},droppable:{...Au.droppable,...r==null?void 0:r.droppable},dragOverlay:{...Au.dragOverlay,...r==null?void 0:r.dragOverlay}}),[r==null?void 0:r.draggable,r==null?void 0:r.droppable,r==null?void 0:r.dragOverlay])}function T_(r){let{activeNode:e,measure:n,initialRect:s,config:l=!0}=r;const a=B.useRef(!1),{x:c,y:d}=typeof l=="boolean"?{x:l,y:l}:l;Gs(()=>{if(!c&&!d||!e){a.current=!1;return}if(a.current||!s)return;const m=e==null?void 0:e.node.current;if(!m||m.isConnected===!1)return;const w=n(m),v=jg(w,s);if(c||(v.x=0),d||(v.y=0),a.current=!0,Math.abs(v.x)>0||Math.abs(v.y)>0){const S=Ug(m);S&&S.scrollBy({top:v.y,left:v.x})}},[e,c,d,s,n])}const qu=B.createContext({...os,scaleX:1,scaleY:1});var vr;(function(r){r[r.Uninitialized=0]="Uninitialized",r[r.Initializing=1]="Initializing",r[r.Initialized=2]="Initialized"})(vr||(vr={}));const I_=B.memo(function(e){var n,s,l,a;let{id:c,accessibility:d,autoScroll:h=!0,children:m,sensors:w=E_,collisionDetection:v=F0,measuring:S,modifiers:E,...A}=e;const D=B.useReducer(z_,void 0,A_),[P,R]=D,[O,M]=O0(),[N,Z]=B.useState(vr.Uninitialized),G=N===vr.Initialized,{draggable:{active:$,nodes:K,translate:he},droppable:{containers:ue}}=P,Q=$!=null?K.get($):null,ve=B.useRef({initial:null,translated:null}),ie=B.useMemo(()=>{var ut;return $!=null?{id:$,data:(ut=Q==null?void 0:Q.data)!=null?ut:b_,rect:ve}:null},[$,Q]),ce=B.useRef(null),[j,te]=B.useState(null),[X,le]=B.useState(null),fe=Kl(A,Object.values(A)),ne=Zu("DndDescribedBy",c),k=B.useMemo(()=>ue.getEnabled(),[ue]),F=O_(S),{droppableRects:q,measureDroppableContainers:xe,measuringScheduled:Ie}=p_(k,{dragging:G,dependencies:[he.x,he.y],config:F.droppable}),Se=h_(K,$),Ee=B.useMemo(()=>X?Vu(X):null,[X]),We=Rt(),Fe=m_(Se,F.draggable.measure);T_({activeNode:$!=null?K.get($):null,config:We.layoutShiftCompensation,initialRect:Fe,measure:F.draggable.measure});const Me=gm(Se,F.draggable.measure,Fe),Zt=gm(Se?Se.parentElement:null),Wt=B.useRef({activatorEvent:null,active:null,activeNode:Se,collisionRect:null,collisions:null,droppableRects:q,draggableNodes:K,draggingNode:null,draggingNodeRect:null,droppableContainers:ue,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ft=ue.getNodeFor((n=Wt.current.over)==null?void 0:n.id),Ht=x_({measure:F.dragOverlay.measure}),ii=(s=Ht.nodeRef.current)!=null?s:Se,Tn=G?(l=Ht.rect)!=null?l:Me:null,ki=!!(Ht.nodeRef.current&&Ht.rect),ls=w_(ki?null:Me),Un=ev(ii?ni(ii):null),nt=__(G?Ft??Se:null),cn=C_(nt),dn=sv(E,{transform:{x:he.x-ls.x,y:he.y-ls.y,scaleX:1,scaleY:1},activatorEvent:X,active:ie,activeNodeRect:Me,containerNodeRect:Zt,draggingNodeRect:Tn,over:Wt.current.over,overlayNodeRect:Ht.rect,scrollableAncestors:nt,scrollableAncestorRects:cn,windowRect:Un}),pi=Ee?Wo(Ee,he):null,Le=y_(nt),ge=wm(Le),et=wm(Le,[Me]),it=Wo(dn,ge),hn=Tn?B0(Tn,dn):null,In=ie&&hn?v({active:ie,collisionRect:hn,droppableRects:q,droppableContainers:k,pointerCoordinates:pi}):null,Xt=G0(In,"id"),[kt,fn]=B.useState(null),xn=ki?dn:Wo(dn,et),qt=H0(xn,(a=kt==null?void 0:kt.rect)!=null?a:null,Me),En=B.useRef(null),as=B.useCallback((ut,en)=>{let{sensor:pn,options:vi}=en;if(ce.current==null)return;const bn=K.get(ce.current);if(!bn)return;const mn=ut.nativeEvent,Nn=new pn({active:ce.current,activeNode:bn,event:mn,options:vi,context:Wt,onAbort(je){if(!K.get(je))return;const{onDragAbort:Et}=fe.current,gn={id:je};Et==null||Et(gn),O({type:"onDragAbort",event:gn})},onPending(je,xt,Et,gn){if(!K.get(je))return;const{onDragPending:An}=fe.current,jt={id:je,constraint:xt,initialCoordinates:Et,offset:gn};An==null||An(jt),O({type:"onDragPending",event:jt})},onStart(je){const xt=ce.current;if(xt==null)return;const Et=K.get(xt);if(!Et)return;const{onDragStart:gn}=fe.current,yt={activatorEvent:mn,active:{id:xt,data:Et.data,rect:ve}};Kr.unstable_batchedUpdates(()=>{gn==null||gn(yt),Z(vr.Initializing),R({type:an.DragStart,initialCoordinates:je,active:xt}),O({type:"onDragStart",event:yt}),te(En.current),le(mn)})},onMove(je){R({type:an.DragMove,coordinates:je})},onEnd:Pn(an.DragEnd),onCancel:Pn(an.DragCancel)});En.current=Nn;function Pn(je){return async function(){const{active:Et,collisions:gn,over:yt,scrollAdjustedTranslate:An}=Wt.current;let jt=null;if(Et&&An){const{cancelDrop:Oi}=fe.current;jt={activatorEvent:mn,active:Et,collisions:gn,delta:An,over:yt},je===an.DragEnd&&typeof Oi=="function"&&await Promise.resolve(Oi(jt))&&(je=an.DragCancel)}ce.current=null,Kr.unstable_batchedUpdates(()=>{R({type:je}),Z(vr.Uninitialized),fn(null),te(null),le(null),En.current=null;const Oi=je===an.DragEnd?"onDragEnd":"onDragCancel";if(jt){const Ws=fe.current[Oi];Ws==null||Ws(jt),O({type:Oi,event:jt})}})}}},[K]),us=B.useCallback((ut,en)=>(pn,vi)=>{const bn=pn.nativeEvent,mn=K.get(vi);if(ce.current!==null||!mn||bn.dndKit||bn.defaultPrevented)return;const Nn={active:mn};ut(pn,en.options,Nn)===!0&&(bn.dndKit={capturedBy:en.sensor},ce.current=vi,as(pn,en))},[K,as]),mi=f_(w,us);S_(w),Gs(()=>{Me&&N===vr.Initializing&&Z(vr.Initialized)},[Me,N]),B.useEffect(()=>{const{onDragMove:ut}=fe.current,{active:en,activatorEvent:pn,collisions:vi,over:bn}=Wt.current;if(!en||!pn)return;const mn={active:en,activatorEvent:pn,collisions:vi,delta:{x:it.x,y:it.y},over:bn};Kr.unstable_batchedUpdates(()=>{ut==null||ut(mn),O({type:"onDragMove",event:mn})})},[it.x,it.y]),B.useEffect(()=>{const{active:ut,activatorEvent:en,collisions:pn,droppableContainers:vi,scrollAdjustedTranslate:bn}=Wt.current;if(!ut||ce.current==null||!en||!bn)return;const{onDragOver:mn}=fe.current,Nn=vi.get(Xt),Pn=Nn&&Nn.rect.current?{id:Nn.id,rect:Nn.rect.current,data:Nn.data,disabled:Nn.disabled}:null,je={active:ut,activatorEvent:en,collisions:pn,delta:{x:bn.x,y:bn.y},over:Pn};Kr.unstable_batchedUpdates(()=>{fn(Pn),mn==null||mn(je),O({type:"onDragOver",event:je})})},[Xt]),Gs(()=>{Wt.current={activatorEvent:X,active:ie,activeNode:Se,collisionRect:hn,collisions:In,droppableRects:q,draggableNodes:K,draggingNode:ii,draggingNodeRect:Tn,droppableContainers:ue,over:kt,scrollableAncestors:nt,scrollAdjustedTranslate:it},ve.current={initial:Tn,translated:hn}},[ie,Se,In,hn,K,ii,Tn,q,ue,kt,nt,it]),u_({...We,delta:he,draggingRect:hn,pointerCoordinates:pi,scrollableAncestors:nt,scrollableAncestorRects:cn});const gi=B.useMemo(()=>({active:ie,activeNode:Se,activeNodeRect:Me,activatorEvent:X,collisions:In,containerNodeRect:Zt,dragOverlay:Ht,draggableNodes:K,droppableContainers:ue,droppableRects:q,over:kt,measureDroppableContainers:xe,scrollableAncestors:nt,scrollableAncestorRects:cn,measuringConfiguration:F,measuringScheduled:Ie,windowRect:Un}),[ie,Se,Me,X,In,Zt,Ht,K,ue,q,kt,xe,nt,cn,F,Ie,Un]),cs=B.useMemo(()=>({activatorEvent:X,activators:mi,active:ie,activeNodeRect:Me,ariaDescribedById:{draggable:ne},dispatch:R,draggableNodes:K,over:kt,measureDroppableContainers:xe}),[X,mi,ie,Me,R,ne,K,kt,xe]);return pe.createElement(Hg.Provider,{value:M},pe.createElement(sa.Provider,{value:cs},pe.createElement(iv.Provider,{value:gi},pe.createElement(qu.Provider,{value:qt},m)),pe.createElement(k_,{disabled:(d==null?void 0:d.restoreFocus)===!1})),pe.createElement(N0,{...d,hiddenTextDescribedById:ne}));function Rt(){const ut=(j==null?void 0:j.autoScrollEnabled)===!1,en=typeof h=="object"?h.enabled===!1:h===!1,pn=G&&!ut&&!en;return typeof h=="object"?{...h,enabled:pn}:{enabled:pn}}}),N_=B.createContext(null),ym="button",R_="Draggable";function M_(r){let{id:e,data:n,disabled:s=!1,attributes:l}=r;const a=Zu(R_),{activators:c,activatorEvent:d,active:h,activeNodeRect:m,ariaDescribedById:w,draggableNodes:v,over:S}=B.useContext(sa),{role:E=ym,roleDescription:A="draggable",tabIndex:D=0}=l??{},P=(h==null?void 0:h.id)===e,R=B.useContext(P?qu:N_),[O,M]=Ru(),[N,Z]=Ru(),G=D_(c,e),$=Kl(n);Gs(()=>(v.set(e,{id:e,key:a,node:O,activatorNode:N,data:$}),()=>{const he=v.get(e);he&&he.key===a&&v.delete(e)}),[v,e]);const K=B.useMemo(()=>({role:E,tabIndex:D,"aria-disabled":s,"aria-pressed":P&&E===ym?!0:void 0,"aria-roledescription":A,"aria-describedby":w.draggable}),[s,E,D,P,A,w.draggable]);return{active:h,activatorEvent:d,activeNodeRect:m,attributes:K,isDragging:P,listeners:s?void 0:G,node:O,over:S,setNodeRef:M,setActivatorNodeRef:Z,transform:R}}function L_(){return B.useContext(iv)}const V_="Droppable",G_={timeout:25};function W_(r){let{data:e,disabled:n=!1,id:s,resizeObserverConfig:l}=r;const a=Zu(V_),{active:c,dispatch:d,over:h,measureDroppableContainers:m}=B.useContext(sa),w=B.useRef({disabled:n}),v=B.useRef(!1),S=B.useRef(null),E=B.useRef(null),{disabled:A,updateMeasurementsFor:D,timeout:P}={...G_,...l},R=Kl(D??s),O=B.useCallback(()=>{if(!v.current){v.current=!0;return}E.current!=null&&clearTimeout(E.current),E.current=setTimeout(()=>{m(Array.isArray(R.current)?R.current:[R.current]),E.current=null},P)},[P]),M=Xu({callback:O,disabled:A||!c}),N=B.useCallback((K,he)=>{M&&(he&&(M.unobserve(he),v.current=!1),K&&M.observe(K))},[M]),[Z,G]=Ru(N),$=Kl(e);return B.useEffect(()=>{!M||!Z.current||(M.disconnect(),v.current=!1,M.observe(Z.current))},[Z,M]),B.useEffect(()=>(d({type:an.RegisterDroppable,element:{id:s,key:a,disabled:n,node:Z,rect:S,data:$}}),()=>d({type:an.UnregisterDroppable,key:a,id:s})),[s]),B.useEffect(()=>{n!==w.current.disabled&&(d({type:an.SetDroppableDisabled,id:s,key:a,disabled:n}),w.current.disabled=n)},[s,a,n,d]),{active:c,rect:S,isOver:(h==null?void 0:h.id)===s,node:Z,over:h,setNodeRef:G}}function F_(r){let{animation:e,children:n}=r;const[s,l]=B.useState(null),[a,c]=B.useState(null),d=Mu(n);return!n&&!s&&d&&l(d),Gs(()=>{if(!a)return;const h=s==null?void 0:s.key,m=s==null?void 0:s.props.id;if(h==null||m==null){l(null);return}Promise.resolve(e(m,a)).then(()=>{l(null)})},[e,s,a]),pe.createElement(pe.Fragment,null,n,s?B.cloneElement(s,{ref:c}):null)}const H_={x:0,y:0,scaleX:1,scaleY:1};function j_(r){let{children:e}=r;return pe.createElement(sa.Provider,{value:nv},pe.createElement(qu.Provider,{value:H_},e))}const B_={position:"fixed",touchAction:"none"},U_=r=>Ih(r)?"transform 250ms ease":void 0,$_=B.forwardRef((r,e)=>{let{as:n,activatorEvent:s,adjustScale:l,children:a,className:c,rect:d,style:h,transform:m,transition:w=U_}=r;if(!d)return null;const v=l?m:{...m,scaleX:1,scaleY:1},S={...B_,width:d.width,height:d.height,top:d.top,left:d.left,transform:Jl.Transform.toString(v),transformOrigin:l&&s?L0(s,d):void 0,transition:typeof w=="function"?w(s):w,...h};return pe.createElement(n,{className:c,style:S,ref:e},a)}),Y_=r=>e=>{let{active:n,dragOverlay:s}=e;const l={},{styles:a,className:c}=r;if(a!=null&&a.active)for(const[d,h]of Object.entries(a.active))h!==void 0&&(l[d]=n.node.style.getPropertyValue(d),n.node.style.setProperty(d,h));if(a!=null&&a.dragOverlay)for(const[d,h]of Object.entries(a.dragOverlay))h!==void 0&&s.node.style.setProperty(d,h);return c!=null&&c.active&&n.node.classList.add(c.active),c!=null&&c.dragOverlay&&s.node.classList.add(c.dragOverlay),function(){for(const[h,m]of Object.entries(l))n.node.style.setProperty(h,m);c!=null&&c.active&&n.node.classList.remove(c.active)}},K_=r=>{let{transform:{initial:e,final:n}}=r;return[{transform:Jl.Transform.toString(e)},{transform:Jl.Transform.toString(n)}]},J_={duration:250,easing:"ease",keyframes:K_,sideEffects:Y_({styles:{active:{opacity:"0"}}})};function Q_(r){let{config:e,draggableNodes:n,droppableContainers:s,measuringConfiguration:l}=r;return Qu((a,c)=>{if(e===null)return;const d=n.get(a);if(!d)return;const h=d.node.current;if(!h)return;const m=tv(c);if(!m)return;const{transform:w}=ni(c).getComputedStyle(c),v=Bg(w);if(!v)return;const S=typeof e=="function"?e:Z_(e);return Zg(h,l.draggable.measure),S({active:{id:a,data:d.data,node:h,rect:l.draggable.measure(h)},draggableNodes:n,dragOverlay:{node:c,rect:l.dragOverlay.measure(m)},droppableContainers:s,measuringConfiguration:l,transform:v})})}function Z_(r){const{duration:e,easing:n,sideEffects:s,keyframes:l}={...J_,...r};return a=>{let{active:c,dragOverlay:d,transform:h,...m}=a;if(!e)return;const w={x:d.rect.left-c.rect.left,y:d.rect.top-c.rect.top},v={scaleX:h.scaleX!==1?c.rect.width*h.scaleX/d.rect.width:1,scaleY:h.scaleY!==1?c.rect.height*h.scaleY/d.rect.height:1},S={x:h.x-w.x,y:h.y-w.y,...v},E=l({...m,active:c,dragOverlay:d,transform:{initial:h,final:S}}),[A]=E,D=E[E.length-1];if(JSON.stringify(A)===JSON.stringify(D))return;const P=s==null?void 0:s({active:c,dragOverlay:d,...m}),R=d.node.animate(E,{duration:e,easing:n,fill:"forwards"});return new Promise(O=>{R.onfinish=()=>{P==null||P(),O()}})}}let Sm=0;function X_(r){return B.useMemo(()=>{if(r!=null)return Sm++,Sm},[r])}const q_=pe.memo(r=>{let{adjustScale:e=!1,children:n,dropAnimation:s,style:l,transition:a,modifiers:c,wrapperElement:d="div",className:h,zIndex:m=999}=r;const{activatorEvent:w,active:v,activeNodeRect:S,containerNodeRect:E,draggableNodes:A,droppableContainers:D,dragOverlay:P,over:R,measuringConfiguration:O,scrollableAncestors:M,scrollableAncestorRects:N,windowRect:Z}=L_(),G=B.useContext(qu),$=X_(v==null?void 0:v.id),K=sv(c,{activatorEvent:w,active:v,activeNodeRect:S,containerNodeRect:E,draggingNodeRect:P.rect,over:R,overlayNodeRect:P.rect,scrollableAncestors:M,scrollableAncestorRects:N,transform:G,windowRect:Z}),he=Vh(S),ue=Q_({config:s,draggableNodes:A,droppableContainers:D,measuringConfiguration:O}),Q=he?P.setRef:void 0;return pe.createElement(j_,null,pe.createElement(F_,{animation:ue},v&&$?pe.createElement($_,{key:$,id:v.id,ref:Q,as:d,activatorEvent:w,adjustScale:e,className:h,transition:a,rect:he,style:{zIndex:m,...l},transform:K},n):null))}),Dm=r=>{let e;const n=new Set,s=(m,w)=>{const v=typeof m=="function"?m(e):m;if(!Object.is(v,e)){const S=e;e=w??(typeof v!="object"||v===null)?v:Object.assign({},e,v),n.forEach(E=>E(e,S))}},l=()=>e,d={setState:s,getState:l,getInitialState:()=>h,subscribe:m=>(n.add(m),()=>n.delete(m))},h=e=r(s,l,d);return d},ey=(r=>r?Dm(r):Dm),ty=r=>r;function ny(r,e=ty){const n=pe.useSyncExternalStore(r.subscribe,pe.useCallback(()=>e(r.getState()),[r,e]),pe.useCallback(()=>e(r.getInitialState()),[r,e]));return pe.useDebugValue(n),n}const Cm=r=>{const e=ey(r),n=s=>ny(e,s);return Object.assign(n,e),n},iy=(r=>r?Cm(r):Cm),rv="damiao.monitor.plotConfigs";function sy(){try{return JSON.parse(localStorage.getItem(rv)||"{}")}catch{return{}}}function ry(r){try{localStorage.setItem(rv,JSON.stringify(r))}catch{}}const Cn=iy((r,e)=>({connected:!1,status:null,signals:[],pairs:[],motors:[],motorTypes:[],plotConfigs:sy(),setConnected:n=>r({connected:n}),setStatus:n=>r({status:n}),setMeta:(n,s)=>r({signals:n,pairs:s}),setMotors:n=>r({motors:n}),setMotorTypes:n=>r({motorTypes:n}),ensurePlot:n=>r(s=>s.plotConfigs[n]?s:{plotConfigs:{...s.plotConfigs,[n]:{signals:[],duration:10}}}),setPlotConfig:(n,s)=>r(l=>({plotConfigs:{...l.plotConfigs,[n]:{...l.plotConfigs[n]||{signals:[],duration:10},...s}}})),addSignalToPlot:(n,s)=>r(l=>{const a=l.plotConfigs[n]||{signals:[],duration:10};return a.signals.includes(s)?l:{plotConfigs:{...l.plotConfigs,[n]:{...a,signals:[...a.signals,s]}}}}),removeSignalFromPlot:(n,s)=>r(l=>{const a=l.plotConfigs[n];return a?{plotConfigs:{...l.plotConfigs,[n]:{...a,signals:a.signals.filter(c=>c!==s)}}}:l}),dropPlot:n=>r(s=>{const l={...s.plotConfigs};return delete l[n],{plotConfigs:l}})}));Cn.subscribe(r=>ry(r.plotConfigs));const oy={plot:"Plot",table:"Motor Table",cards:"Motor Cards",rawlog:"Raw CAN Log"};let lh=null;const vu={};function ly(r){lh=r}function wu(r){if(!lh)return;vu[r]=(vu[r]||0)+1;const e=`${r}-${Date.now().toString(36)}-${vu[r]}`;lh.addPanel({id:e,component:r,title:`${oy[r]} ${vu[r]}`})}function ay(){const r=Cn(s=>s.connected),e=Cn(s=>s.status),n=()=>{localStorage.removeItem("damiao.monitor.layout"),localStorage.removeItem("damiao.monitor.plotConfigs"),location.reload()};return Y.jsxs("header",{className:"toolbar",children:[Y.jsxs("div",{className:"brand",children:[Y.jsx("span",{className:"brand-dot"}),"DaMiao ",Y.jsx("span",{className:"brand-sub",children:"Passive Monitor"})]}),Y.jsxs("div",{className:"conn",children:[Y.jsx("span",{className:"dot "+(r?"on":"off")}),Y.jsx("span",{className:"mono",children:e!=null&&e.demo?"demo":(e==null?void 0:e.channel)||"—"}),e&&!e.demo&&Y.jsx("span",{className:"badge "+(e.listenOnly?"ok":"warn"),title:"hardware listen-only",children:e.listenOnly?"listen-only":"rx (no TX)"}),(e==null?void 0:e.error)&&Y.jsx("span",{className:"badge err",title:e.error,children:"bus error"}),e&&Y.jsxs("span",{className:"muted small",children:[e.framesSeen.toLocaleString()," frames · +",e.feedbackOffset," fb"]})]}),Y.jsx("div",{className:"spacer"}),Y.jsxs("div",{className:"actions",children:[Y.jsx("button",{className:"btn",onClick:()=>wu("plot"),children:"+ Plot"}),Y.jsx("button",{className:"btn",onClick:()=>wu("table"),children:"+ Table"}),Y.jsx("button",{className:"btn",onClick:()=>wu("cards"),children:"+ Cards"}),Y.jsx("button",{className:"btn",onClick:()=>wu("rawlog"),children:"+ Raw Log"}),Y.jsx("button",{className:"btn ghost",onClick:n,children:"Reset"})]})]})}const uy={pos:"#58a6ff",vel:"#3fb950",torque:"#d29922",kp:"#bc8cff",kd:"#f778ba",vel_limit:"#56d4dd",torque_limit:"#e3b341",t_mos:"#ff7b72",t_rotor:"#ffa657",status_code:"#8b949e"};function cy(r){return uy[r]||"#8b949e"}function zu(r){const e=cy(r.field);return r.source==="cmd"?dy(e,.15):e}function ah(r){const e=r.split(":");return e.length>=3?`${e[1]} ${e[2]}`:r}function xm(r){return r.includes(":cmd.")}const Em=["pos","vel","torque","kp","kd","t_mos","t_rotor"];function dy(r,e){const n=r.replace("#",""),s=Math.min(255,Math.round(parseInt(n.slice(0,2),16)+255*e)),l=Math.min(255,Math.round(parseInt(n.slice(2,4),16)+255*e)),a=Math.min(255,Math.round(parseInt(n.slice(4,6),16)+255*e));return`rgb(${s},${l},${a})`}function jo(r,e=3){return r==null||Number.isNaN(r)?"—":r.toFixed(e)}function hy({sig:r}){const{attributes:e,listeners:n,setNodeRef:s,isDragging:l}=M_({id:`sig:${r.id}`,data:{signalId:r.id}}),a=zu(r);return Y.jsxs("div",{ref:s,className:"sig-chip"+(l?" dragging":""),...n,...e,title:r.id,children:[Y.jsx("span",{className:"sig-swatch",style:{background:a,borderStyle:r.source==="cmd"?"dashed":"solid"}}),Y.jsxs("span",{className:"sig-name",children:[r.source,".",r.field]}),r.unit&&Y.jsx("span",{className:"sig-unit",children:r.unit})]})}function fy(r){return[...r].sort((e,n)=>{if(e.source!==n.source)return e.source==="cmd"?-1:1;const s=Em.indexOf(e.field),l=Em.indexOf(n.field);return(s<0?99:s)-(l<0?99:l)})}function py(){const r=Cn(a=>a.signals),e=Cn(a=>a.status),[n,s]=B.useState(""),l=B.useMemo(()=>{const a=new Map;for(const c of r){if(n&&!c.id.toLowerCase().includes(n.toLowerCase()))continue;const d=a.get(c.motorId)||[];d.push(c),a.set(c.motorId,d)}return Array.from(a.entries()).sort((c,d)=>c[0]-d[0])},[r,n]);return Y.jsxs("aside",{className:"sidebar",children:[Y.jsxs("div",{className:"sidebar-head",children:[Y.jsx("div",{className:"sidebar-title",children:"Signals"}),Y.jsx("input",{className:"filter",placeholder:"filter…",value:n,onChange:a=>s(a.target.value)})]}),Y.jsxs("div",{className:"sidebar-body",children:[l.length===0&&Y.jsx("div",{className:"muted pad",children:e!=null&&e.error?"Bus error — see top bar.":"No signals yet. Start a controller on the bus (or run --demo)."}),l.map(([a,c])=>Y.jsxs("div",{className:"motor-group",children:[Y.jsxs("div",{className:"motor-group-title",children:["Motor ",a]}),Y.jsx("div",{className:"chips",children:fy(c).map(d=>Y.jsx(hy,{sig:d},d.id))})]},a))]}),Y.jsxs("div",{className:"sidebar-foot muted",children:["Drag a signal onto a plot. Drop ",Y.jsx("b",{children:"cmd"})," onto its ",Y.jsx("b",{children:"fb"})," plot to overlay."]})]})}class ov{}class _r extends ov{constructor(e,n,s){super(),this.viewId=e,this.groupId=n,this.panelId=s}}class Ul extends ov{constructor(e,n){super(),this.viewId=e,this.paneId=n}}class Ds{constructor(){}static getInstance(){return Ds.INSTANCE}hasData(e){return e&&e===this.proto}clearData(e){this.hasData(e)&&(this.proto=void 0,this.data=void 0)}getData(e){if(this.hasData(e))return this.data}setData(e,n){n&&(this.data=e,this.proto=n)}}Ds.INSTANCE=new Ds;function Hn(){const r=Ds.getInstance();if(r.hasData(_r.prototype))return r.getData(_r.prototype)[0]}function Nl(){const r=Ds.getInstance();if(r.hasData(Ul.prototype))return r.getData(Ul.prototype)[0]}var Jr;(function(r){r.any=(...e)=>n=>{const s=e.map(l=>l(n));return{dispose:()=>{s.forEach(l=>{l.dispose()})}}}})(Jr||(Jr={}));class Gh{constructor(){this._defaultPrevented=!1}get defaultPrevented(){return this._defaultPrevented}preventDefault(){this._defaultPrevented=!0}}class lv{constructor(){this._isAccepted=!1}get isAccepted(){return this._isAccepted}accept(){this._isAccepted=!0}}class my{constructor(){this.events=new Map}get size(){return this.events.size}add(e,n){this.events.set(e,n)}delete(e){this.events.delete(e)}clear(){this.events.clear()}}class Fu{static create(){var e;return new Fu((e=new Error().stack)!==null&&e!==void 0?e:"")}constructor(e){this.value=e}print(){console.warn("dockview: stacktrace",this.value)}}class gy{constructor(e,n){this.callback=e,this.stacktrace=n}}class U{static setLeakageMonitorEnabled(e){e!==U.ENABLE_TRACKING&&U.MEMORY_LEAK_WATCHER.clear(),U.ENABLE_TRACKING=e}get value(){return this._last}constructor(e){this.options=e,this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=e=>{var n;!((n=this.options)===null||n===void 0)&&n.replay&&this._last!==void 0&&e(this._last);const s=new gy(e,U.ENABLE_TRACKING?Fu.create():void 0);return this._listeners.push(s),{dispose:()=>{const l=this._listeners.indexOf(s);l>-1&&this._listeners.splice(l,1)}}},U.ENABLE_TRACKING&&U.MEMORY_LEAK_WATCHER.add(this._event,Fu.create())),this._event}fire(e){var n;!((n=this.options)===null||n===void 0)&&n.replay&&(this._last=e);for(const s of this._listeners)s.callback(e)}dispose(){this._disposed||(this._disposed=!0,this._listeners.length>0&&(U.ENABLE_TRACKING&&queueMicrotask(()=>{var e;for(const n of this._listeners)console.warn("dockview: stacktrace",(e=n.stacktrace)===null||e===void 0?void 0:e.print())}),this._listeners=[]),U.ENABLE_TRACKING&&this._event&&U.MEMORY_LEAK_WATCHER.delete(this._event))}}U.ENABLE_TRACKING=!1;U.MEMORY_LEAK_WATCHER=new my;function Be(r,e,n,s){return r.addEventListener(e,n,s),{dispose:()=>{r.removeEventListener(e,n,s)}}}class bm{constructor(){this._onFired=new U,this._currentFireCount=0,this._queued=!1,this.onEvent=e=>{const n=this._currentFireCount;return this._onFired.event(()=>{this._currentFireCount>n&&e()})}}fire(){this._currentFireCount++,!this._queued&&(this._queued=!0,queueMicrotask(()=>{this._queued=!1,this._onFired.fire()}))}dispose(){this._onFired.dispose()}}var Qt;(function(r){r.NONE={dispose:()=>{}};function e(n){return{dispose:()=>{n()}}}r.from=e})(Qt||(Qt={}));class Re{get isDisposed(){return this._isDisposed}constructor(...e){this._isDisposed=!1,this._disposables=e}addDisposables(...e){e.forEach(n=>this._disposables.push(n))}dispose(){this._isDisposed||(this._isDisposed=!0,this._disposables.forEach(e=>e.dispose()),this._disposables=[])}}class Bn{constructor(){this._disposable=Qt.NONE}set value(e){this._disposable&&this._disposable.dispose(),this._disposable=e}dispose(){this._disposable&&(this._disposable.dispose(),this._disposable=Qt.NONE)}}class vy extends Re{constructor(e){super(),this._onDidChange=new U,this.onDidChange=this._onDidChange.event,this._value=null,this.addDisposables(this._onDidChange,ec(e,n=>{const s=n.target.scrollWidth>n.target.clientWidth,l=n.target.scrollHeight>n.target.clientHeight;this._value={hasScrollX:s,hasScrollY:l},this._onDidChange.fire(this._value)}))}}function ec(r,e){const n=new ResizeObserver(s=>{requestAnimationFrame(()=>{const l=s[0];e(l)})});return n.observe(r),{dispose:()=>{n.unobserve(r),n.disconnect()}}}const Zl=(r,...e)=>{for(const n of e)r.classList.contains(n)&&r.classList.remove(n)},tc=(r,...e)=>{for(const n of e)r.classList.contains(n)||r.classList.add(n)},Ne=(r,e,n)=>{const s=r.classList.contains(e);n&&!s&&r.classList.add(e),!n&&s&&r.classList.remove(e)};function uh(r,e){for(;r;){if(r===e)return!0;r=r.parentNode}return!1}function av(r){return new wy(r)}class wy extends Re{constructor(e){super(),this._onDidFocus=new U,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new U,this.onDidBlur=this._onDidBlur.event,this.addDisposables(this._onDidFocus,this._onDidBlur);let n=uh(document.activeElement,e),s=!1;const l=()=>{s=!1,n||(n=!0,this._onDidFocus.fire())},a=()=>{n&&(s=!0,window.setTimeout(()=>{s&&(s=!1,n=!1,this._onDidBlur.fire())},0))};this._refreshStateHandler=()=>{uh(document.activeElement,e)!==n&&(n?a():l())},this.addDisposables(Be(e,"focus",l,!0)),this.addDisposables(Be(e,"blur",a,!0))}refreshState(){this._refreshStateHandler()}}const uv="dv-quasiPreventDefault";function _y(r){r[uv]=!0}function Pm(r){return r[uv]}function yy(r,e){const n=Array.from(e);for(const s of n){if(s.href){const a=r.createElement("link");a.href=s.href,a.type=s.type,a.rel="stylesheet",r.head.appendChild(a)}let l=[];try{s.cssRules&&(l=Array.from(s.cssRules).map(a=>a.cssText))}catch{}for(const a of l){const c=r.createElement("style");c.appendChild(r.createTextNode(a)),r.head.appendChild(c)}}}function ch(r){const{left:e,top:n,width:s,height:l}=r.getBoundingClientRect();return{left:e+window.scrollX,top:n+window.scrollY,width:s,height:l}}function Sy(r){let e=r;for(;e!=null&&e.parentNode;){if(e.parentNode===document)return!0;e.parentNode instanceof DocumentFragment?e=e.parentNode.host:e=e.parentNode}return!1}function Dy(r,e){r.setAttribute("data-testid",e)}function Cy(r){const e=[];function n(s){if(s.nodeType===Node.ELEMENT_NODE){r.includes(s.tagName)&&e.push(s),s.shadowRoot&&n(s.shadowRoot);for(const l of s.children)n(l)}}return n(document.documentElement),e}function Hu(r=document){const e=Cy(["IFRAME","WEBVIEW"]),n=new WeakMap;for(const s of e)n.set(s,s.style.pointerEvents),s.style.pointerEvents="none";return{release:()=>{var s;for(const l of e)l.style.pointerEvents=(s=n.get(l))!==null&&s!==void 0?s:"auto";e.splice(0,e.length)}}}function xy(r){function e(l){const a=[];for(let c=0;cl.startsWith("dockview-theme-")),typeof n!="string");)s=s.parentElement;return n}class nc{constructor(e){this.element=e,this._classNames=[]}setClassNames(e){for(const n of this._classNames)Ne(this.element,n,!1);this._classNames=e.split(" ").filter(n=>n.trim().length>0);for(const n of this._classNames)Ne(this.element,n,!0)}}const cv=100;function Ey(r,e){const n=ch(r),s=ch(e);return!(n.lefts.left+s.width)}function by(r){const e=new U;let n=r.screenX,s=r.screenY,l;const a=()=>{if(r.closed)return;const c=r.screenX,d=r.screenY;(c!==n||d!==s)&&(clearTimeout(l),l=setTimeout(()=>{e.fire()},cv),n=c,s=d),requestAnimationFrame(a)};return a(),e}function Py(r,e){let n;return new Re(Be(r,"resize",()=>{clearTimeout(n),n=setTimeout(()=>{e()},cv)}))}function Ay(r,e,n={buffer:10}){const s=n.buffer,l=r.getBoundingClientRect(),a=e.getBoundingClientRect();let c=0,d=0;const h=l.left-a.left,m=l.top-a.top,w=l.bottom-a.bottom,v=l.right-a.right;hs&&(c=-s-v),ms&&(d=-w-s),(c!==0||d!==0)&&(r.style.transform=`translate(${c}px, ${d}px)`)}function zy(r){let e=r;for(;e&&(e.style.zIndex==="auto"||e.style.zIndex==="");)e=e.parentElement;return e}function Ms(r){if(r.length===0)throw new Error("Invalid tail call");return[r.slice(0,r.length-1),r[r.length-1]]}function dv(r,e){if(r.length!==e.length)return!1;for(let n=0;n-1&&(r.splice(n,1),r.unshift(e))}function _u(r,e){const n=r.indexOf(e);n>-1&&(r.splice(n,1),r.push(e))}function ky(r,e){for(let n=0;ns===e);return n>-1?(r.splice(n,1),!0):!1}const _t=(r,e,n)=>e>n?e:Math.min(n,Math.max(r,e)),Wh=()=>{let r=1;return{next:()=>(r++).toString()}},ts=(r,e)=>{const n=[];if(typeof e!="number"&&(e=r,r=0),r<=e)for(let s=r;se;s--)n.push(s);return n};class Oy{set size(e){this._size=e}get size(){return this._size}get cachedVisibleSize(){return this._cachedVisibleSize}get visible(){return typeof this._cachedVisibleSize>"u"}get minimumSize(){return this.visible?this.view.minimumSize:0}get viewMinimumSize(){return this.view.minimumSize}get maximumSize(){return this.visible?this.view.maximumSize:0}get viewMaximumSize(){return this.view.maximumSize}get priority(){return this.view.priority}get snap(){return!!this.view.snap}set enabled(e){this.container.style.pointerEvents=e?"":"none"}constructor(e,n,s,l){this.container=e,this.view=n,this.disposable=l,this._cachedVisibleSize=void 0,typeof s=="number"?(this._size=s,this._cachedVisibleSize=void 0,e.classList.add("visible")):(this._size=0,this._cachedVisibleSize=s.cachedVisibleSize)}setVisible(e,n){var s;e!==this.visible&&(e?(this.size=_t((s=this._cachedVisibleSize)!==null&&s!==void 0?s:0,this.viewMinimumSize,this.viewMaximumSize),this._cachedVisibleSize=void 0):(this._cachedVisibleSize=typeof n=="number"?n:this.size,this.size=0),this.container.classList.toggle("visible",e),this.view.setVisible&&this.view.setVisible(e))}dispose(){return this.disposable.dispose(),this.view}}var ze;(function(r){r.HORIZONTAL="HORIZONTAL",r.VERTICAL="VERTICAL"})(ze||(ze={}));var ji;(function(r){r[r.MAXIMUM=0]="MAXIMUM",r[r.MINIMUM=1]="MINIMUM",r[r.DISABLED=2]="DISABLED",r[r.ENABLED=3]="ENABLED"})(ji||(ji={}));var on;(function(r){r.Low="low",r.High="high",r.Normal="normal"})(on||(on={}));var $i;(function(r){r.Distribute={type:"distribute"};function e(s){return{type:"split",index:s}}r.Split=e;function n(s){return{type:"invisible",cachedVisibleSize:s}}r.Invisible=n})($i||($i={}));class Xl{get contentSize(){return this._contentSize}get size(){return this._size}set size(e){this._size=e}get orthogonalSize(){return this._orthogonalSize}set orthogonalSize(e){this._orthogonalSize=e}get length(){return this.viewItems.length}get proportions(){return this._proportions?[...this._proportions]:void 0}get orientation(){return this._orientation}set orientation(e){this._orientation=e;const n=this.size;this.size=this.orthogonalSize,this.orthogonalSize=n,Zl(this.element,"dv-horizontal","dv-vertical"),this.element.classList.add(this.orientation==ze.HORIZONTAL?"dv-horizontal":"dv-vertical")}get minimumSize(){return this.viewItems.reduce((e,n)=>e+n.minimumSize,0)}get maximumSize(){return this.length===0?Number.POSITIVE_INFINITY:this.viewItems.reduce((e,n)=>e+n.maximumSize,0)}get startSnappingEnabled(){return this._startSnappingEnabled}set startSnappingEnabled(e){this._startSnappingEnabled!==e&&(this._startSnappingEnabled=e,this.updateSashEnablement())}get endSnappingEnabled(){return this._endSnappingEnabled}set endSnappingEnabled(e){this._endSnappingEnabled!==e&&(this._endSnappingEnabled=e,this.updateSashEnablement())}get disabled(){return this._disabled}set disabled(e){this._disabled=e,Ne(this.element,"dv-splitview-disabled",e)}get margin(){return this._margin}set margin(e){this._margin=e,Ne(this.element,"dv-splitview-has-margin",e!==0)}constructor(e,n){var s,l;this.container=e,this.viewItems=[],this.sashes=[],this._size=0,this._orthogonalSize=0,this._contentSize=0,this._proportions=void 0,this._startSnappingEnabled=!0,this._endSnappingEnabled=!0,this._disabled=!1,this._margin=0,this._onDidSashEnd=new U,this.onDidSashEnd=this._onDidSashEnd.event,this._onDidAddView=new U,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new U,this.onDidRemoveView=this._onDidRemoveView.event,this.resize=(a,c,d=this.viewItems.map(A=>A.size),h,m,w=Number.NEGATIVE_INFINITY,v=Number.POSITIVE_INFINITY,S,E)=>{if(a<0||a>this.viewItems.length)return 0;const A=ts(a,-1),D=ts(a+1,this.viewItems.length);if(m)for(const j of m)jd(A,j),jd(D,j);if(h)for(const j of h)_u(A,j),_u(D,j);const P=A.map(j=>this.viewItems[j]),R=A.map(j=>d[j]),O=D.map(j=>this.viewItems[j]),M=D.map(j=>d[j]),N=A.reduce((j,te)=>j+this.viewItems[te].minimumSize-d[te],0),Z=A.reduce((j,te)=>j+this.viewItems[te].maximumSize-d[te],0),G=D.length===0?Number.POSITIVE_INFINITY:D.reduce((j,te)=>j+d[te]-this.viewItems[te].minimumSize,0),$=D.length===0?Number.NEGATIVE_INFINITY:D.reduce((j,te)=>j+d[te]-this.viewItems[te].maximumSize,0),K=Math.max(N,$),he=Math.min(G,Z);let ue=!1;if(S){const j=this.viewItems[S.index],te=c>=S.limitDelta;ue=te!==j.visible,j.setVisible(te,S.size)}if(!ue&&E){const j=this.viewItems[E.index],te=c{const d=a.visible===void 0||a.visible?a.size:{type:"invisible",cachedVisibleSize:a.size},h=a.view;this.addView(h,d,c,!0)}),this._contentSize=this.viewItems.reduce((a,c)=>a+c.size,0),this.saveProportions())}style(e){(e==null?void 0:e.separatorBorder)==="transparent"?(Zl(this.element,"dv-separator-border"),this.element.style.removeProperty("--dv-separator-border")):(tc(this.element,"dv-separator-border"),e!=null&&e.separatorBorder&&this.element.style.setProperty("--dv-separator-border",e.separatorBorder))}isViewVisible(e){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");return this.viewItems[e].visible}setViewVisible(e,n){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");const s=this.viewItems[e];s.setVisible(n,s.size),this.distributeEmptySpace(e),this.layoutViews(),this.saveProportions()}getViewSize(e){return e<0||e>=this.viewItems.length?-1:this.viewItems[e].size}resizeView(e,n){if(e<0||e>=this.viewItems.length)return;const s=ts(this.viewItems.length).filter(d=>d!==e),l=[...s.filter(d=>this.viewItems[d].priority===on.Low),e],a=s.filter(d=>this.viewItems[d].priority===on.High),c=this.viewItems[e];n=Math.round(n),n=_t(n,c.minimumSize,Math.min(c.maximumSize,this._size)),c.size=n,this.relayout(l,a)}getViews(){return this.viewItems.map(e=>e.view)}onDidChange(e,n){const s=this.viewItems.indexOf(e);if(s<0||s>=this.viewItems.length)return;n=typeof n=="number"?n:e.size,n=_t(n,e.minimumSize,e.maximumSize),e.size=n;const l=ts(this.viewItems.length).filter(d=>d!==s),a=[...l.filter(d=>this.viewItems[d].priority===on.Low),s],c=l.filter(d=>this.viewItems[d].priority===on.High);this.relayout([...a,s],c)}addView(e,n={type:"distribute"},s=this.viewItems.length,l){const a=document.createElement("div");a.className="dv-view",a.appendChild(e.element);let c;typeof n=="number"?c=n:n.type==="split"?c=this.getViewSize(n.index)/2:n.type==="invisible"?c={cachedVisibleSize:n.cachedVisibleSize}:c=e.minimumSize;const d=e.onDidChange(m=>this.onDidChange(h,m.size)),h=new Oy(a,e,c,{dispose:()=>{d.dispose(),this.viewContainer.removeChild(a)}});if(s===this.viewItems.length?this.viewContainer.appendChild(a):this.viewContainer.insertBefore(a,this.viewContainer.children.item(s)),this.viewItems.splice(s,0,h),this.viewItems.length>1){const m=document.createElement("div");m.className="dv-sash";const w=S=>{for(const j of this.viewItems)j.enabled=!1;const E=Hu(),A=this._orientation===ze.HORIZONTAL?S.clientX:S.clientY,D=ky(this.sashes,j=>j.container===m),P=this.viewItems.map(j=>j.size);let R,O;const M=ts(D,-1),N=ts(D+1,this.viewItems.length),Z=M.reduce((j,te)=>j+(this.viewItems[te].minimumSize-P[te]),0),G=M.reduce((j,te)=>j+(this.viewItems[te].viewMaximumSize-P[te]),0),$=N.length===0?Number.POSITIVE_INFINITY:N.reduce((j,te)=>j+(P[te]-this.viewItems[te].minimumSize),0),K=N.length===0?Number.NEGATIVE_INFINITY:N.reduce((j,te)=>j+(P[te]-this.viewItems[te].viewMaximumSize),0),he=Math.max(Z,K),ue=Math.min($,G),Q=this.findFirstSnapIndex(M),ve=this.findFirstSnapIndex(N);if(typeof Q=="number"){const j=this.viewItems[Q],te=Math.floor(j.viewMinimumSize/2);R={index:Q,limitDelta:j.visible?he-te:he+te,size:j.size}}if(typeof ve=="number"){const j=this.viewItems[ve],te=Math.floor(j.viewMinimumSize/2);O={index:ve,limitDelta:j.visible?ue+te:ue-te,size:j.size}}const ie=j=>{const X=(this._orientation===ze.HORIZONTAL?j.clientX:j.clientY)-A;this.resize(D,X,P,void 0,void 0,he,ue,R,O),this.distributeEmptySpace(),this.layoutViews()},ce=()=>{for(const j of this.viewItems)j.enabled=!0;E.release(),this.saveProportions(),document.removeEventListener("pointermove",ie),document.removeEventListener("pointerup",ce),document.removeEventListener("pointercancel",ce),document.removeEventListener("contextmenu",ce),this._onDidSashEnd.fire(void 0)};document.addEventListener("pointermove",ie),document.addEventListener("pointerup",ce),document.addEventListener("pointercancel",ce),document.addEventListener("contextmenu",ce)};m.addEventListener("pointerdown",w);const v={container:m,disposable:()=>{m.removeEventListener("pointerdown",w),this.sashContainer.removeChild(m)}};this.sashContainer.appendChild(m),this.sashes.push(v)}l||this.relayout([s]),!l&&typeof n!="number"&&n.type==="distribute"&&this.distributeViewSizes(),this._onDidAddView.fire(e)}distributeViewSizes(){const e=[];let n=0;for(const d of this.viewItems)d.maximumSize-d.minimumSize>0&&(e.push(d),n+=d.size);const s=Math.floor(n/e.length);for(const d of e)d.size=_t(s,d.minimumSize,d.maximumSize);const l=ts(this.viewItems.length),a=l.filter(d=>this.viewItems[d].priority===on.Low),c=l.filter(d=>this.viewItems[d].priority===on.High);this.relayout(a,c)}removeView(e,n,s=!1){const l=this.viewItems.splice(e,1)[0];if(l.dispose(),this.viewItems.length>=1){const a=Math.max(e-1,0);this.sashes.splice(a,1)[0].disposable()}return s||this.relayout(),n&&n.type==="distribute"&&this.distributeViewSizes(),this._onDidRemoveView.fire(l.view),l.view}getViewCachedVisibleSize(e){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");return this.viewItems[e].cachedVisibleSize}moveView(e,n){const s=this.getViewCachedVisibleSize(e),l=typeof s>"u"?this.getViewSize(e):$i.Invisible(s),a=this.removeView(e,void 0,!0);this.addView(a,l,n)}layout(e,n){const s=Math.max(this.size,this._contentSize);if(this.size=e,this.orthogonalSize=n,this.proportions){let l=0;for(let a=0;a0&&(c.size=_t(Math.round(d*e/l),c.minimumSize,c.maximumSize))}}else{const l=ts(this.viewItems.length),a=l.filter(d=>this.viewItems[d].priority===on.Low),c=l.filter(d=>this.viewItems[d].priority===on.High);this.resize(this.viewItems.length-1,e-s,void 0,a,c)}this.distributeEmptySpace(),this.layoutViews()}relayout(e,n){const s=this.viewItems.reduce((l,a)=>l+a.size,0);this.resize(this.viewItems.length-1,this._size-s,void 0,e,n),this.distributeEmptySpace(),this.layoutViews(),this.saveProportions()}distributeEmptySpace(e){const n=this.viewItems.reduce((d,h)=>d+h.size,0);let s=this.size-n;const l=ts(this.viewItems.length-1,-1),a=l.filter(d=>this.viewItems[d].priority===on.Low),c=l.filter(d=>this.viewItems[d].priority===on.High);for(const d of c)jd(l,d);for(const d of a)_u(l,d);typeof e=="number"&&_u(l,e);for(let d=0;s!==0&&d0&&(this._proportions=this.viewItems.map(e=>e.visible?e.size/this._contentSize:void 0))}layoutViews(){if(this._contentSize=this.viewItems.reduce((h,m)=>h+m.size,0),this.updateSashEnablement(),this.viewItems.length===0)return;const e=this.viewItems.filter(h=>h.visible),n=Math.max(0,e.length-1),s=this.margin*n/Math.max(1,e.length);let l=0;const a=[],c=4,d=this.viewItems.reduce((h,m,w)=>{const v=m.visible?1:0;return w===0?h.push(v):h.push(h[w-1]+v),h},[]);this.viewItems.forEach((h,m)=>{l+=this.viewItems[m].size,a.push(l);const w=h.visible?h.size-s:0,v=Math.max(0,d[m]-1),S=m===0||v===0?0:a[m-1]+v/n*s;if(m0)return;if(!s.visible&&s.snap)return n}}updateSashEnablement(){let e=!1;const n=this.viewItems.map(h=>e=h.size-h.minimumSize>0||e);e=!1;const s=this.viewItems.map(h=>e=h.maximumSize-h.size>0||e),l=[...this.viewItems].reverse();e=!1;const a=l.map(h=>e=h.size-h.minimumSize>0||e).reverse();e=!1;const c=l.map(h=>e=h.maximumSize-h.size>0||e).reverse();let d=0;for(let h=0;h0||this.startSnappingEnabled)?this.updateSash(m,ji.MINIMUM):O&&n[h]&&(d{const a=new Re(l.onDidChangeExpansionState(()=>{this.setupAnimation(),this._onDidChange.fire(void 0)})),c={pane:l,disposable:{dispose:()=>{a.dispose()}}};this.paneItems.push(c),l.orthogonalSize=this.splitview.orthogonalSize}),this.addDisposables(this._onDidChange,this.splitview.onDidSashEnd(()=>{this._onDidChange.fire(void 0)}),this.splitview.onDidAddView(()=>{this._onDidChange.fire()}),this.splitview.onDidRemoveView(()=>{this._onDidChange.fire()}))}setViewVisible(e,n){this.splitview.setViewVisible(e,n)}addPane(e,n,s=this.splitview.length,l=!1){const a=e.onDidChangeExpansionState(()=>{this.setupAnimation(),this._onDidChange.fire(void 0)}),c={pane:e,disposable:{dispose:()=>{a.dispose()}}};this.paneItems.splice(s,0,c),e.orthogonalSize=this.splitview.orthogonalSize,this.splitview.addView(e,n,s,l)}getViewSize(e){return this.splitview.getViewSize(e)}getPanes(){return this.splitview.getViews()}removePane(e,n={skipDispose:!1}){const s=this.paneItems.splice(e,1)[0];return this.splitview.removeView(e),n.skipDispose||(s.disposable.dispose(),s.pane.dispose()),s}moveView(e,n){if(e===n)return;const s=this.removePane(e,{skipDispose:!0});this.skipAnimation=!0;try{this.addPane(s.pane,s.pane.size,n,!1)}finally{this.skipAnimation=!1}}layout(e,n){this.splitview.layout(e,n)}setupAnimation(){this.skipAnimation||(this.animationTimer&&(clearTimeout(this.animationTimer),this.animationTimer=void 0),tc(this.element,"dv-animated"),this.animationTimer=setTimeout(()=>{this.animationTimer=void 0,Zl(this.element,"dv-animated")},200))}dispose(){super.dispose(),this.animationTimer&&(clearTimeout(this.animationTimer),this.animationTimer=void 0),this.paneItems.forEach(e=>{e.disposable.dispose(),e.pane.dispose()}),this.paneItems=[],this.splitview.dispose(),this.element.remove()}}class Sn{get minimumWidth(){return this.view.minimumWidth}get maximumWidth(){return this.view.maximumWidth}get minimumHeight(){return this.view.minimumHeight}get maximumHeight(){return this.view.maximumHeight}get priority(){return this.view.priority}get snap(){return this.view.snap}get minimumSize(){return this.orientation===ze.HORIZONTAL?this.minimumHeight:this.minimumWidth}get maximumSize(){return this.orientation===ze.HORIZONTAL?this.maximumHeight:this.maximumWidth}get minimumOrthogonalSize(){return this.orientation===ze.HORIZONTAL?this.minimumWidth:this.minimumHeight}get maximumOrthogonalSize(){return this.orientation===ze.HORIZONTAL?this.maximumWidth:this.maximumHeight}get orthogonalSize(){return this._orthogonalSize}get size(){return this._size}get element(){return this.view.element}get width(){return this.orientation===ze.HORIZONTAL?this.orthogonalSize:this.size}get height(){return this.orientation===ze.HORIZONTAL?this.size:this.orthogonalSize}constructor(e,n,s,l=0){this.view=e,this.orientation=n,this._onDidChange=new U,this.onDidChange=this._onDidChange.event,this._orthogonalSize=s,this._size=l,this._disposable=this.view.onDidChange(a=>{a?this._onDidChange.fire({size:this.orientation===ze.VERTICAL?a.width:a.height,orthogonalSize:this.orientation===ze.VERTICAL?a.height:a.width}):this._onDidChange.fire({})})}setVisible(e){this.view.setVisible&&this.view.setVisible(e)}layout(e,n){this._size=e,this._orthogonalSize=n,this.view.layout(this.width,this.height)}dispose(){this._onDidChange.dispose(),this._disposable.dispose()}}class Nt extends Re{get width(){return this.orientation===ze.HORIZONTAL?this.size:this.orthogonalSize}get height(){return this.orientation===ze.HORIZONTAL?this.orthogonalSize:this.size}get minimumSize(){return this.children.length===0?0:Math.max(...this.children.map((e,n)=>this.splitview.isViewVisible(n)?e.minimumOrthogonalSize:0))}get maximumSize(){return Math.min(...this.children.map((e,n)=>this.splitview.isViewVisible(n)?e.maximumOrthogonalSize:Number.POSITIVE_INFINITY))}get minimumOrthogonalSize(){return this.splitview.minimumSize}get maximumOrthogonalSize(){return this.splitview.maximumSize}get orthogonalSize(){return this._orthogonalSize}get size(){return this._size}get minimumWidth(){return this.orientation===ze.HORIZONTAL?this.minimumOrthogonalSize:this.minimumSize}get minimumHeight(){return this.orientation===ze.HORIZONTAL?this.minimumSize:this.minimumOrthogonalSize}get maximumWidth(){return this.orientation===ze.HORIZONTAL?this.maximumOrthogonalSize:this.maximumSize}get maximumHeight(){return this.orientation===ze.HORIZONTAL?this.maximumSize:this.maximumOrthogonalSize}get priority(){if(this.children.length===0)return on.Normal;const e=this.children.map(n=>typeof n.priority>"u"?on.Normal:n.priority);return e.some(n=>n===on.High)?on.High:e.some(n=>n===on.Low)?on.Low:on.Normal}get disabled(){return this.splitview.disabled}set disabled(e){this.splitview.disabled=e}get margin(){return this.splitview.margin}set margin(e){this.splitview.margin=e,this.children.forEach(n=>{n instanceof Nt&&(n.margin=e)})}constructor(e,n,s,l,a,c,d,h){if(super(),this.orientation=e,this.proportionalLayout=n,this.styles=s,this._childrenDisposable=Qt.NONE,this.children=[],this._onDidChange=new U,this.onDidChange=this._onDidChange.event,this._onDidVisibilityChange=new U,this.onDidVisibilityChange=this._onDidVisibilityChange.event,this._orthogonalSize=a,this._size=l,this.element=document.createElement("div"),this.element.className="dv-branch-node",!h)this.splitview=new Xl(this.element,{orientation:this.orientation,proportionalLayout:n,styles:s,margin:d}),this.splitview.layout(this.size,this.orthogonalSize);else{const m={views:h.map(w=>({view:w.node,size:w.node.size,visible:w.node instanceof Sn&&w.visible!==void 0?w.visible:!0})),size:this.orthogonalSize};this.children=h.map(w=>w.node),this.splitview=new Xl(this.element,{orientation:this.orientation,descriptor:m,proportionalLayout:n,styles:s,margin:d})}this.disabled=c,this.addDisposables(this._onDidChange,this._onDidVisibilityChange,this.splitview.onDidSashEnd(()=>{this._onDidChange.fire({})})),this.setupChildrenEvents()}setVisible(e){}isChildVisible(e){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.isViewVisible(e)}setChildVisible(e,n){if(e<0||e>=this.children.length)throw new Error("Invalid index");if(this.splitview.isViewVisible(e)===n)return;const s=this.splitview.contentSize===0;this.splitview.setViewVisible(e,n);const l=this.splitview.contentSize===0;(n&&s||!n&&l)&&this._onDidVisibilityChange.fire({visible:n})}moveChild(e,n){if(e===n)return;if(e<0||e>=this.children.length)throw new Error("Invalid from index");e=this.children.length)throw new Error("Invalid index");return this.splitview.getViewSize(e)}resizeChild(e,n){if(e<0||e>=this.children.length)throw new Error("Invalid index");this.splitview.resizeView(e,n)}layout(e,n){this._size=n,this._orthogonalSize=e,this.splitview.layout(n,e)}addChild(e,n,s,l){if(s<0||s>this.children.length)throw new Error("Invalid index");this.splitview.addView(e,n,s,l),this._addChild(e,s)}getChildCachedVisibleSize(e){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.getViewCachedVisibleSize(e)}removeChild(e,n){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.removeView(e,n),this._removeChild(e)}_addChild(e,n){this.children.splice(n,0,e),this.setupChildrenEvents()}_removeChild(e){const[n]=this.children.splice(e,1);return this.setupChildrenEvents(),n}setupChildrenEvents(){this._childrenDisposable.dispose(),this._childrenDisposable=new Re(Jr.any(...this.children.map(e=>e.onDidChange))(e=>{this._onDidChange.fire({size:e.orthogonalSize})}),...this.children.map((e,n)=>e instanceof Nt?e.onDidVisibilityChange(({visible:s})=>{this.setChildVisible(n,s)}):Qt.NONE))}dispose(){this._childrenDisposable.dispose(),this.splitview.dispose(),this.children.forEach(e=>e.dispose()),super.dispose()}}function hh(r,e){if(r instanceof Sn)return r;if(r instanceof Nt)return hh(r.children[e?r.children.length-1:0],e);throw new Error("invalid node")}function hv(r,e,n){if(r instanceof Nt){const s=new Nt(r.orientation,r.proportionalLayout,r.styles,e,n,r.disabled,r.margin);for(let l=r.children.length-1;l>=0;l--){const a=r.children[l];s.addChild(hv(a,a.size,a.orthogonalSize),a.size,0,!0)}return s}else return new Sn(r.view,r.orientation,n)}function fh(r,e,n){if(r instanceof Nt){const s=new Nt(Ss(r.orientation),r.proportionalLayout,r.styles,e,n,r.disabled,r.margin);let l=0;for(let a=r.children.length-1;a>=0;a--){const c=r.children[a],d=c instanceof Nt?c.orthogonalSize:c.size;let h=r.size===0?0:Math.round(e*d/r.size);l+=h,a===0&&(h+=e-l),s.addChild(fh(c,n,h),h,0,!0)}return s}else return new Sn(r.view,Ss(r.orientation),n)}function Ty(r){const e=r.parentElement;if(!e)throw new Error("Invalid grid element");let n=e.firstElementChild,s=0;for(;n!==r&&n!==e.lastElementChild&&n;)n=n.nextElementSibling,s++;return s}function zt(r){const e=r.parentElement;if(!e)throw new Error("Invalid grid element");if(/\bdv-grid-view\b/.test(e.className))return[];const n=Ty(e),s=e.parentElement.parentElement.parentElement;return[...zt(s),n]}function _s(r,e,n){const s=Ny(r,e),l=Iy(n);if(s===l){const[a,c]=Ms(e);let d=c;return(n==="right"||n==="bottom")&&(d+=1),[...a,d]}else{const a=n==="right"||n==="bottom"?1:0;return[...e,a]}}function Iy(r){return r==="top"||r==="bottom"?ze.VERTICAL:ze.HORIZONTAL}function Ny(r,e){return e.length%2===0?Ss(r):r}const Ss=r=>r===ze.HORIZONTAL?ze.VERTICAL:ze.HORIZONTAL;function Ry(r){return!!r.children}const ph=(r,e)=>{const n=e===ze.VERTICAL?r.box.width:r.box.height;return Ry(r)?{type:"branch",data:r.children.map(s=>ph(s,Ss(e))),size:n}:typeof r.cachedVisibleSize=="number"?{type:"leaf",data:r.view.toJSON(),size:r.cachedVisibleSize,visible:!1}:{type:"leaf",data:r.view.toJSON(),size:n}};class My{get length(){return this._root?this._root.children.length:0}get orientation(){return this.root.orientation}set orientation(e){if(this.root.orientation===e)return;const{size:n,orthogonalSize:s}=this.root;this.root=fh(this.root,s,n),this.root.layout(n,s)}get width(){return this.root.width}get height(){return this.root.height}get minimumWidth(){return this.root.minimumWidth}get minimumHeight(){return this.root.minimumHeight}get maximumWidth(){return this.root.maximumHeight}get maximumHeight(){return this.root.maximumHeight}get locked(){return this._locked}set locked(e){this._locked=e;const n=[this.root];for(;n.length>0;){const s=n.pop();s instanceof Nt&&(s.disabled=e,n.push(...s.children))}}get margin(){return this._margin}set margin(e){this._margin=e,this.root.margin=e}maximizedView(){var e;return(e=this._maximizedNode)===null||e===void 0?void 0:e.leaf.view}hasMaximizedView(){return this._maximizedNode!==void 0}maximizeView(e){var n;const s=zt(e.element),[l,a]=this.getNode(s);if(!(a instanceof Sn)||((n=this._maximizedNode)===null||n===void 0?void 0:n.leaf)===a)return;this.hasMaximizedView()&&this.exitMaximizedView(),ph(this.getView(),this.orientation);const c=[];function d(h,m){for(let w=0;w=0;a--){const c=l.children[a];c instanceof Sn?e.includes(c)||l.setChildVisible(a,!0):n(c)}}n(this.root);const s=this._maximizedNode.leaf;this._maximizedNode=void 0,this._onDidMaximizedNodeChange.fire({view:s.view,isMaximized:!1})}serialize(){const e=this.maximizedView();let n;e&&(n=zt(e.element)),this.hasMaximizedView()&&this.exitMaximizedView();const l={root:ph(this.getView(),this.orientation),width:this.width,height:this.height,orientation:this.orientation};return n&&(l.maximizedNode={location:n}),e&&this.maximizeView(e),l}dispose(){this.disposable.dispose(),this._onDidChange.dispose(),this._onDidMaximizedNodeChange.dispose(),this._onDidViewVisibilityChange.dispose(),this.root.dispose(),this._maximizedNode=void 0,this.element.remove()}clear(){const e=this.root.orientation;this.root=new Nt(e,this.proportionalLayout,this.styles,this.root.size,this.root.orthogonalSize,this.locked,this.margin)}deserialize(e,n){const s=e.orientation,l=s===ze.VERTICAL?e.height:e.width;if(this._deserialize(e.root,s,n,l),this.layout(e.width,e.height),e.maximizedNode){const a=e.maximizedNode.location,[c,d]=this.getNode(a);if(!(d instanceof Sn))return;this.maximizeView(d.view)}}_deserialize(e,n,s,l){this.root=this._deserializeNode(e,n,s,l)}_deserializeNode(e,n,s,l){var a;let c;if(e.type==="branch"){const h=e.data.map(m=>({node:this._deserializeNode(m,Ss(n),s,e.size),visible:m.visible}));c=new Nt(n,this.proportionalLayout,this.styles,e.size,l,this.locked,this.margin,h)}else{const d=s.fromJSON(e);typeof e.visible=="boolean"&&((a=d.setVisible)===null||a===void 0||a.call(d,e.visible)),c=new Sn(d,n,l,e.size)}return c}get root(){return this._root}set root(e){const n=this._root;n&&(n.dispose(),this._maximizedNode=void 0,this.element.removeChild(n.element)),this._root=e,this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange(s=>{this._onDidChange.fire(s)})}normalize(){if(!this._root||this._root.children.length!==1)return;const e=this.root,n=e.children[0];if(n instanceof Sn)return;e.element.remove();const s=e.removeChild(0);e.dispose(),s.dispose(),this._root=hv(n,n.size,n.orthogonalSize),this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange(l=>{this._onDidChange.fire(l)})}insertOrthogonalSplitviewAtRoot(){if(!this._root)return;const e=this.root;if(e.element.remove(),this._root=new Nt(Ss(e.orientation),this.proportionalLayout,this.styles,this.root.orthogonalSize,this.root.size,this.locked,this.margin),e.children.length!==0)if(e.children.length===1){const n=e.children[0];e.removeChild(0).dispose(),e.dispose(),this._root.addChild(fh(n,n.orthogonalSize,n.size),$i.Distribute,0)}else this._root.addChild(e,$i.Distribute,0);this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange(n=>{this._onDidChange.fire(n)})}next(e){return this.progmaticSelect(e)}previous(e){return this.progmaticSelect(e,!0)}getView(e){const n=e?this.getNode(e)[1]:this.root;return this._getViews(n,this.orientation)}_getViews(e,n,s){const l={height:e.height,width:e.width};if(e instanceof Sn)return{box:l,view:e.view,cachedVisibleSize:s};const a=[];for(let c=0;c-1;a--){const c=s[a],d=e[a]||0;if(n?d-1>-1:d+1m.getChildSize(P));if(m.removeChild(v,n).dispose(),h instanceof Nt){A.splice(v,1,...h.children.map(D=>D.size));for(let D=0;D0;)h.removeChild(0)}else{const D=new Sn(h.view,Ss(h.orientation),h.size),P=E?h.orthogonalSize:$i.Invisible(h.orthogonalSize);m.addChild(D,P,v)}h.dispose();for(let D=0;D=n.children.length)throw new Error("Invalid location");const c=n.children[l];return s.push(n),this.getNode(a,c,s)}}const mh=Object.keys({disableAutoResizing:void 0,proportionalLayout:void 0,orientation:void 0,hideBorders:void 0,className:void 0});class Fh extends Re{get element(){return this._element}get disableResizing(){return this._disableResizing}set disableResizing(e){this._disableResizing=e}constructor(e,n=!1){super(),this._disableResizing=n,this._element=e,this.addDisposables(ec(this._element,s=>{if(this.isDisposed||this.disableResizing||!this._element.offsetParent||!Sy(this._element))return;const{width:l,height:a}=s.contentRect;this.layout(l,a)}))}}const Ly=Wh();function ju(r){switch(r){case"left":return"left";case"right":return"right";case"above":return"top";case"below":return"bottom";case"within":default:return"center"}}class fv extends Fh{get id(){return this._id}get size(){return this._groups.size}get groups(){return Array.from(this._groups.values()).map(e=>e.value)}get width(){return this.gridview.width}get height(){return this.gridview.height}get minimumHeight(){return this.gridview.minimumHeight}get maximumHeight(){return this.gridview.maximumHeight}get minimumWidth(){return this.gridview.minimumWidth}get maximumWidth(){return this.gridview.maximumWidth}get activeGroup(){return this._activeGroup}get locked(){return this.gridview.locked}set locked(e){this.gridview.locked=e}constructor(e,n){var s;super(document.createElement("div"),n.disableAutoResizing),this._id=Ly.next(),this._groups=new Map,this._onDidRemove=new U,this.onDidRemove=this._onDidRemove.event,this._onDidAdd=new U,this.onDidAdd=this._onDidAdd.event,this._onDidMaximizedChange=new U,this.onDidMaximizedChange=this._onDidMaximizedChange.event,this._onDidActiveChange=new U,this.onDidActiveChange=this._onDidActiveChange.event,this._bufferOnDidLayoutChange=new bm,this.onDidLayoutChange=this._bufferOnDidLayoutChange.onEvent,this._onDidViewVisibilityChangeMicroTaskQueue=new bm,this.onDidViewVisibilityChangeMicroTaskQueue=this._onDidViewVisibilityChangeMicroTaskQueue.onEvent,this.element.style.height="100%",this.element.style.width="100%",this._classNames=new nc(this.element),this._classNames.setClassNames((s=n.className)!==null&&s!==void 0?s:""),e.appendChild(this.element),this.gridview=new My(!!n.proportionalLayout,n.styles,n.orientation,n.locked,n.margin),this.gridview.locked=!!n.locked,this.element.appendChild(this.gridview.element),this.layout(0,0,!0),this.addDisposables(this.gridview.onDidMaximizedNodeChange(l=>{this._onDidMaximizedChange.fire({panel:l.view,isMaximized:l.isMaximized})}),this.gridview.onDidViewVisibilityChange(()=>this._onDidViewVisibilityChangeMicroTaskQueue.fire()),this.onDidViewVisibilityChangeMicroTaskQueue(()=>{this.layout(this.width,this.height,!0)}),Qt.from(()=>{var l;(l=this.element.parentElement)===null||l===void 0||l.removeChild(this.element)}),this.gridview.onDidChange(()=>{this._bufferOnDidLayoutChange.fire()}),Jr.any(this.onDidAdd,this.onDidRemove,this.onDidActiveChange)(()=>{this._bufferOnDidLayoutChange.fire()}),this._onDidMaximizedChange,this._onDidViewVisibilityChangeMicroTaskQueue,this._bufferOnDidLayoutChange)}setVisible(e,n){this.gridview.setViewVisible(zt(e.element),n),this._bufferOnDidLayoutChange.fire()}isVisible(e){return this.gridview.isViewVisible(zt(e.element))}updateOptions(e){var n,s,l,a;e.proportionalLayout,e.orientation&&(this.gridview.orientation=e.orientation),"disableResizing"in e&&(this.disableResizing=(n=e.disableAutoResizing)!==null&&n!==void 0?n:!1),"locked"in e&&(this.locked=(s=e.locked)!==null&&s!==void 0?s:!1),"margin"in e&&(this.gridview.margin=(l=e.margin)!==null&&l!==void 0?l:0),"className"in e&&this._classNames.setClassNames((a=e.className)!==null&&a!==void 0?a:"")}maximizeGroup(e){this.gridview.maximizeView(e),this.doSetGroupActive(e)}isMaximizedGroup(e){return this.gridview.maximizedView()===e}exitMaximizedGroup(){this.gridview.exitMaximizedView()}hasMaximizedGroup(){return this.gridview.hasMaximizedView()}doAddGroup(e,n=[0],s){this.gridview.addView(e,s??$i.Distribute,n),this._onDidAdd.fire(e)}doRemoveGroup(e,n){if(!this._groups.has(e.id))throw new Error("invalid operation");const s=this._groups.get(e.id),l=this.gridview.remove(e,$i.Distribute);if(s&&!(n!=null&&n.skipDispose)&&(s.disposable.dispose(),s.value.dispose(),this._groups.delete(e.id),this._onDidRemove.fire(e)),!(n!=null&&n.skipActive)&&this._activeGroup===e){const a=Array.from(this._groups.values());this.doSetGroupActive(a.length>0?a[0].value:void 0)}return l}getPanel(e){var n;return(n=this._groups.get(e))===null||n===void 0?void 0:n.value}doSetGroupActive(e){this._activeGroup!==e&&(this._activeGroup&&this._activeGroup.setActive(!1),e&&e.setActive(!0),this._activeGroup=e,this._onDidActiveChange.fire(e))}removeGroup(e){this.doRemoveGroup(e)}moveToNext(e){var n;if(e||(e={}),!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}const s=zt(e.group.element),l=(n=this.gridview.next(s))===null||n===void 0?void 0:n.view;this.doSetGroupActive(l)}moveToPrevious(e){var n;if(e||(e={}),!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}const s=zt(e.group.element),l=(n=this.gridview.previous(s))===null||n===void 0?void 0:n.view;this.doSetGroupActive(l)}layout(e,n,s){(s||e!==this.width||n!==this.height)&&(this.gridview.element.style.height=`${n}px`,this.gridview.element.style.width=`${e}px`,this.gridview.layout(e,n))}dispose(){this._onDidActiveChange.dispose(),this._onDidAdd.dispose(),this._onDidRemove.dispose();for(const e of this.groups)e.dispose();this.gridview.dispose(),super.dispose()}}class pv{get minimumSize(){return this.component.minimumSize}get maximumSize(){return this.component.maximumSize}get width(){return this.component.width}get height(){return this.component.height}get length(){return this.component.length}get orientation(){return this.component.orientation}get panels(){return this.component.panels}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidAddView(){return this.component.onDidAddView}get onDidRemoveView(){return this.component.onDidRemoveView}constructor(e){this.component=e}removePanel(e,n){this.component.removePanel(e,n)}focus(){this.component.focus()}getPanel(e){return this.component.getPanel(e)}layout(e,n){return this.component.layout(e,n)}addPanel(e){return this.component.addPanel(e)}movePanel(e,n){this.component.movePanel(e,n)}fromJSON(e){this.component.fromJSON(e)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}}class ql{get minimumSize(){return this.component.minimumSize}get maximumSize(){return this.component.maximumSize}get width(){return this.component.width}get height(){return this.component.height}get panels(){return this.component.panels}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get onDidAddView(){return this.component.onDidAddView}get onDidRemoveView(){return this.component.onDidRemoveView}get onDidDrop(){return this.component.onDidDrop}get onUnhandledDragOverEvent(){return this.component.onUnhandledDragOverEvent}constructor(e){this.component=e}removePanel(e){this.component.removePanel(e)}getPanel(e){return this.component.getPanel(e)}movePanel(e,n){this.component.movePanel(e,n)}focus(){this.component.focus()}layout(e,n){this.component.layout(e,n)}addPanel(e){return this.component.addPanel(e)}fromJSON(e){this.component.fromJSON(e)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}}class mv{get width(){return this.component.width}get height(){return this.component.height}get minimumHeight(){return this.component.minimumHeight}get maximumHeight(){return this.component.maximumHeight}get minimumWidth(){return this.component.minimumWidth}get maximumWidth(){return this.component.maximumWidth}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidAddPanel(){return this.component.onDidAddGroup}get onDidRemovePanel(){return this.component.onDidRemoveGroup}get onDidActivePanelChange(){return this.component.onDidActiveGroupChange}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get panels(){return this.component.groups}get orientation(){return this.component.orientation}set orientation(e){this.component.updateOptions({orientation:e})}constructor(e){this.component=e}focus(){this.component.focus()}layout(e,n,s=!1){this.component.layout(e,n,s)}addPanel(e){return this.component.addPanel(e)}removePanel(e,n){this.component.removePanel(e,n)}movePanel(e,n){this.component.movePanel(e,n)}getPanel(e){return this.component.getPanel(e)}fromJSON(e){return this.component.fromJSON(e)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}}class Bu{get id(){return this.component.id}get width(){return this.component.width}get height(){return this.component.height}get minimumHeight(){return this.component.minimumHeight}get maximumHeight(){return this.component.maximumHeight}get minimumWidth(){return this.component.minimumWidth}get maximumWidth(){return this.component.maximumWidth}get size(){return this.component.size}get totalPanels(){return this.component.totalPanels}get onDidActiveGroupChange(){return this.component.onDidActiveGroupChange}get onDidAddGroup(){return this.component.onDidAddGroup}get onDidRemoveGroup(){return this.component.onDidRemoveGroup}get onDidActivePanelChange(){return this.component.onDidActivePanelChange}get onDidAddPanel(){return this.component.onDidAddPanel}get onDidRemovePanel(){return this.component.onDidRemovePanel}get onDidMovePanel(){return this.component.onDidMovePanel}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidDrop(){return this.component.onDidDrop}get onWillDrop(){return this.component.onWillDrop}get onWillShowOverlay(){return this.component.onWillShowOverlay}get onWillDragGroup(){return this.component.onWillDragGroup}get onWillDragPanel(){return this.component.onWillDragPanel}get onUnhandledDragOverEvent(){return this.component.onUnhandledDragOverEvent}get onDidPopoutGroupSizeChange(){return this.component.onDidPopoutGroupSizeChange}get onDidPopoutGroupPositionChange(){return this.component.onDidPopoutGroupPositionChange}get onDidOpenPopoutWindowFail(){return this.component.onDidOpenPopoutWindowFail}get panels(){return this.component.panels}get groups(){return this.component.groups}get activePanel(){return this.component.activePanel}get activeGroup(){return this.component.activeGroup}constructor(e){this.component=e}focus(){this.component.focus()}getPanel(e){return this.component.getGroupPanel(e)}layout(e,n,s=!1){this.component.layout(e,n,s)}addPanel(e){return this.component.addPanel(e)}removePanel(e){this.component.removePanel(e)}addGroup(e){return this.component.addGroup(e)}closeAllGroups(){return this.component.closeAllGroups()}removeGroup(e){this.component.removeGroup(e)}getGroup(e){return this.component.getPanel(e)}addFloatingGroup(e,n){return this.component.addFloatingGroup(e,n)}fromJSON(e,n){this.component.fromJSON(e,n)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}moveToNext(e){this.component.moveToNext(e)}moveToPrevious(e){this.component.moveToPrevious(e)}maximizeGroup(e){this.component.maximizeGroup(e.group)}hasMaximizedGroup(){return this.component.hasMaximizedGroup()}exitMaximizedGroup(){this.component.exitMaximizedGroup()}get onDidMaximizedGroupChange(){return this.component.onDidMaximizedGroupChange}addPopoutGroup(e,n){return this.component.addPopoutGroup(e,n)}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}}class Hh extends Re{constructor(e,n){super(),this.el=e,this.disabled=n,this.dataDisposable=new Bn,this.pointerEventsDisposable=new Bn,this._onDragStart=new U,this.onDragStart=this._onDragStart.event,this.addDisposables(this._onDragStart,this.dataDisposable,this.pointerEventsDisposable),this.configure()}setDisabled(e){this.disabled=e}isCancelled(e){return!1}configure(){this.addDisposables(this._onDragStart,Be(this.el,"dragstart",e=>{if(e.defaultPrevented||this.isCancelled(e)||this.disabled){e.preventDefault();return}const n=Hu();this.pointerEventsDisposable.value={dispose:()=>{n.release()}},this.el.classList.add("dv-dragged"),setTimeout(()=>this.el.classList.remove("dv-dragged"),0),this.dataDisposable.value=this.getData(e),this._onDragStart.fire(e),e.dataTransfer&&(e.dataTransfer.effectAllowed="move",e.dataTransfer.items.length>0||e.dataTransfer.setData("text/plain",""))}),Be(this.el,"dragend",()=>{this.pointerEventsDisposable.dispose(),setTimeout(()=>{this.dataDisposable.dispose()},0)}))}}class gv extends Re{constructor(e,n){super(),this.element=e,this.callbacks=n,this.target=null,this.registerListeners()}onDragEnter(e){this.target=e.target,this.callbacks.onDragEnter(e)}onDragOver(e){e.preventDefault(),this.callbacks.onDragOver&&this.callbacks.onDragOver(e)}onDragLeave(e){this.target===e.target&&(this.target=null,this.callbacks.onDragLeave(e))}onDragEnd(e){this.target=null,this.callbacks.onDragEnd(e)}onDrop(e){this.callbacks.onDrop(e)}registerListeners(){this.addDisposables(Be(this.element,"dragenter",e=>{this.onDragEnter(e)},!0)),this.addDisposables(Be(this.element,"dragover",e=>{this.onDragOver(e)},!0)),this.addDisposables(Be(this.element,"dragleave",e=>{this.onDragLeave(e)})),this.addDisposables(Be(this.element,"dragend",e=>{this.onDragEnd(e)})),this.addDisposables(Be(this.element,"drop",e=>{this.onDrop(e)}))}}function Vy(r,e){const{top:n,left:s,width:l,height:a}=e,c=`${Math.round(n)}px`,d=`${Math.round(s)}px`,h=`${Math.round(l)}px`,m=`${Math.round(a)}px`;r.style.top=c,r.style.left=d,r.style.width=h,r.style.height=m,r.style.visibility="visible",(!r.style.transform||r.style.transform==="")&&(r.style.transform="translate3d(0, 0, 0)")}function Gy(r,e){const{top:n,left:s,width:l,height:a}=e;r.style.top=n,r.style.left=s,r.style.width=l,r.style.height=a,r.style.visibility="visible",(!r.style.transform||r.style.transform==="")&&(r.style.transform="translate3d(0, 0, 0)")}function Wy(r,e){const{top:n,left:s,width:l,height:a}=e,c=`${Math.round(n)}px`,d=`${Math.round(s)}px`,h=`${Math.round(l)}px`,m=`${Math.round(a)}px`;return r.style.top!==c||r.style.left!==d||r.style.width!==h||r.style.height!==m}class Fy extends Gh{get nativeEvent(){return this.options.nativeEvent}get position(){return this.options.position}constructor(e){super(),this.options=e}}function zm(r){switch(r){case"above":return"top";case"below":return"bottom";case"left":return"left";case"right":return"right";case"within":return"center";default:throw new Error(`invalid direction '${r}'`)}}function Hy(r){switch(r){case"top":return"above";case"bottom":return"below";case"left":return"left";case"right":return"right";case"center":return"within";default:throw new Error(`invalid position '${r}'`)}}const jy={value:20,type:"percentage"},By={value:50,type:"percentage"},Uy=100,$y=100;class rs extends Re{get disabled(){return this._disabled}set disabled(e){this._disabled=e}get state(){return this._state}constructor(e,n){super(),this.element=e,this.options=n,this._onDrop=new U,this.onDrop=this._onDrop.event,this._onWillShowOverlay=new U,this.onWillShowOverlay=this._onWillShowOverlay.event,this._disabled=!1,this._acceptedTargetZonesSet=new Set(this.options.acceptedTargetZones),this.dnd=new gv(this.element,{onDragEnter:()=>{var s,l,a;(a=(l=(s=this.options).getOverrideTarget)===null||l===void 0?void 0:l.call(s))===null||a===void 0||a.getElements()},onDragOver:s=>{var l,a,c,d,h,m,w;rs.ACTUAL_TARGET=this;const v=(a=(l=this.options).getOverrideTarget)===null||a===void 0?void 0:a.call(l);if(this._acceptedTargetZonesSet.size===0){if(v)return;this.removeDropTarget();return}const S=(h=(d=(c=this.options).getOverlayOutline)===null||d===void 0?void 0:d.call(c))!==null&&h!==void 0?h:this.element,E=S.offsetWidth,A=S.offsetHeight;if(E===0||A===0)return;const D=s.currentTarget.getBoundingClientRect(),P=((m=s.clientX)!==null&&m!==void 0?m:0)-D.left,R=((w=s.clientY)!==null&&w!==void 0?w:0)-D.top,O=this.calculateQuadrant(this._acceptedTargetZonesSet,P,R,E,A);if(this.isAlreadyUsed(s)||O===null){this.removeDropTarget();return}if(!this.options.canDisplayOverlay(s,O)){if(v)return;this.removeDropTarget();return}const M=new Fy({nativeEvent:s,position:O});if(this._onWillShowOverlay.fire(M),M.defaultPrevented){this.removeDropTarget();return}this.markAsUsed(s),v||this.targetElement||(this.targetElement=document.createElement("div"),this.targetElement.className="dv-drop-target-dropzone",this.overlayElement=document.createElement("div"),this.overlayElement.className="dv-drop-target-selection",this._state="center",this.targetElement.appendChild(this.overlayElement),S.classList.add("dv-drop-target"),S.append(this.targetElement)),this.toggleClasses(O,E,A),this._state=O},onDragLeave:()=>{var s,l;!((l=(s=this.options).getOverrideTarget)===null||l===void 0)&&l.call(s)||this.removeDropTarget()},onDragEnd:s=>{var l,a;const c=(a=(l=this.options).getOverrideTarget)===null||a===void 0?void 0:a.call(l);c&&rs.ACTUAL_TARGET===this&&this._state&&(s.stopPropagation(),this._onDrop.fire({position:this._state,nativeEvent:s})),this.removeDropTarget(),c==null||c.clear()},onDrop:s=>{var l,a,c;s.preventDefault();const d=this._state;this.removeDropTarget(),(c=(a=(l=this.options).getOverrideTarget)===null||a===void 0?void 0:a.call(l))===null||c===void 0||c.clear(),d&&(s.stopPropagation(),this._onDrop.fire({position:d,nativeEvent:s}))}}),this.addDisposables(this._onDrop,this._onWillShowOverlay,this.dnd)}setTargetZones(e){this._acceptedTargetZonesSet=new Set(e)}setOverlayModel(e){this.options.overlayModel=e}dispose(){this.removeDropTarget(),super.dispose()}markAsUsed(e){e[rs.USED_EVENT_ID]=!0}isAlreadyUsed(e){const n=e[rs.USED_EVENT_ID];return typeof n=="boolean"&&n}toggleClasses(e,n,s){var l,a,c,d,h,m,w;const v=(a=(l=this.options).getOverrideTarget)===null||a===void 0?void 0:a.call(l);if(!v&&!this.overlayElement)return;const S=n{Ne(ie,"dv-drop-target-anchor-container-changed",!1)},10));return}if(!this.overlayElement)return;const K={top:"0px",left:"0px",width:"100%",height:"100%"};O?(K.left=`${100*(1-G)}%`,K.width=`${100*G}%`):M?K.width=`${100*G}%`:N?K.height=`${100*G}%`:Z&&(K.top=`${100*(1-G)}%`,K.height=`${100*G}%`),Gy(this.overlayElement,K),Ne(this.overlayElement,"dv-drop-target-small-vertical",E),Ne(this.overlayElement,"dv-drop-target-small-horizontal",S),Ne(this.overlayElement,"dv-drop-target-left",A),Ne(this.overlayElement,"dv-drop-target-right",D),Ne(this.overlayElement,"dv-drop-target-top",P),Ne(this.overlayElement,"dv-drop-target-bottom",R),Ne(this.overlayElement,"dv-drop-target-center",e==="center")}calculateQuadrant(e,n,s,l,a){var c,d;const h=(d=(c=this.options.overlayModel)===null||c===void 0?void 0:c.activationSize)!==null&&d!==void 0?d:jy;return h.type==="percentage"?Yy(e,n,s,l,a,h.value):Ky(e,n,s,l,a,h.value)}removeDropTarget(){var e;this.targetElement&&(this._state=void 0,(e=this.targetElement.parentElement)===null||e===void 0||e.classList.remove("dv-drop-target"),this.targetElement.remove(),this.targetElement=void 0,this.overlayElement=void 0)}}rs.USED_EVENT_ID="__dockview_droptarget_event_is_used__";function Yy(r,e,n,s,l,a){const c=100*e/s,d=100*n/l;return r.has("left")&&c100-a?"right":r.has("top")&&d100-a?"bottom":r.has("center")?"center":null}function Ky(r,e,n,s,l,a){return r.has("left")&&es-a?"right":r.has("top")&&nl-a?"bottom":r.has("center")?"center":null}const gh=Object.keys({disableAutoResizing:void 0,disableDnd:void 0,className:void 0});class Jy extends lv{constructor(e,n,s,l){super(),this.nativeEvent=e,this.position=n,this.getData=s,this.panel=l}}class vv extends Gh{constructor(){super()}}class wv extends Re{get isFocused(){return this._isFocused}get isActive(){return this._isActive}get isVisible(){return this._isVisible}get width(){return this._width}get height(){return this._height}constructor(e,n){super(),this.id=e,this.component=n,this._isFocused=!1,this._isActive=!1,this._isVisible=!0,this._width=0,this._height=0,this._parameters={},this.panelUpdatesDisposable=new Bn,this._onDidDimensionChange=new U,this.onDidDimensionsChange=this._onDidDimensionChange.event,this._onDidChangeFocus=new U,this.onDidFocusChange=this._onDidChangeFocus.event,this._onWillFocus=new U,this.onWillFocus=this._onWillFocus.event,this._onDidVisibilityChange=new U,this.onDidVisibilityChange=this._onDidVisibilityChange.event,this._onWillVisibilityChange=new U,this.onWillVisibilityChange=this._onWillVisibilityChange.event,this._onDidActiveChange=new U,this.onDidActiveChange=this._onDidActiveChange.event,this._onActiveChange=new U,this.onActiveChange=this._onActiveChange.event,this._onDidParametersChange=new U,this.onDidParametersChange=this._onDidParametersChange.event,this.addDisposables(this.onDidFocusChange(s=>{this._isFocused=s.isFocused}),this.onDidActiveChange(s=>{this._isActive=s.isActive}),this.onDidVisibilityChange(s=>{this._isVisible=s.isVisible}),this.onDidDimensionsChange(s=>{this._width=s.width,this._height=s.height}),this.panelUpdatesDisposable,this._onDidDimensionChange,this._onDidChangeFocus,this._onDidVisibilityChange,this._onDidActiveChange,this._onWillFocus,this._onActiveChange,this._onWillFocus,this._onWillVisibilityChange,this._onDidParametersChange)}getParameters(){return this._parameters}initialize(e){this.panelUpdatesDisposable.value=this._onDidParametersChange.event(n=>{this._parameters=n,e.update({params:n})})}setVisible(e){this._onWillVisibilityChange.fire({isVisible:e})}setActive(){this._onActiveChange.fire()}updateParameters(e){this._onDidParametersChange.fire(e)}}class _v extends wv{constructor(e,n){super(e,n),this._onDidConstraintsChangeInternal=new U,this.onDidConstraintsChangeInternal=this._onDidConstraintsChangeInternal.event,this._onDidConstraintsChange=new U({replay:!0}),this.onDidConstraintsChange=this._onDidConstraintsChange.event,this._onDidSizeChange=new U,this.onDidSizeChange=this._onDidSizeChange.event,this.addDisposables(this._onDidConstraintsChangeInternal,this._onDidConstraintsChange,this._onDidSizeChange)}setConstraints(e){this._onDidConstraintsChangeInternal.fire(e)}setSize(e){this._onDidSizeChange.fire(e)}}class Qy extends _v{set pane(e){this._pane=e}constructor(e,n){super(e,n),this._onDidExpansionChange=new U({replay:!0}),this.onDidExpansionChange=this._onDidExpansionChange.event,this._onMouseEnter=new U({}),this.onMouseEnter=this._onMouseEnter.event,this._onMouseLeave=new U({}),this.onMouseLeave=this._onMouseLeave.event,this.addDisposables(this._onDidExpansionChange,this._onMouseEnter,this._onMouseLeave)}setExpanded(e){var n;(n=this._pane)===null||n===void 0||n.setExpanded(e)}get isExpanded(){var e;return!!(!((e=this._pane)===null||e===void 0)&&e.isExpanded())}}class jh extends Re{get element(){return this._element}get width(){return this._width}get height(){return this._height}get params(){var e;return(e=this._params)===null||e===void 0?void 0:e.params}constructor(e,n,s){super(),this.id=e,this.component=n,this.api=s,this._height=0,this._width=0,this._element=document.createElement("div"),this._element.tabIndex=-1,this._element.style.outline="none",this._element.style.height="100%",this._element.style.width="100%",this._element.style.overflow="hidden";const l=av(this._element);this.addDisposables(this.api,l.onDidFocus(()=>{this.api._onDidChangeFocus.fire({isFocused:!0})}),l.onDidBlur(()=>{this.api._onDidChangeFocus.fire({isFocused:!1})}),l)}focus(){const e=new vv;this.api._onWillFocus.fire(e),!e.defaultPrevented&&this._element.focus()}layout(e,n){this._width=e,this._height=n,this.api._onDidDimensionChange.fire({width:e,height:n}),this.part&&this._params&&this.part.update(this._params.params)}init(e){this._params=e,this.part=this.getComponent()}update(e){var n,s;this._params=Object.assign(Object.assign({},this._params),{params:Object.assign(Object.assign({},(n=this._params)===null||n===void 0?void 0:n.params),e.params)});for(const l of Object.keys(e.params))e.params[l]===void 0&&delete this._params.params[l];(s=this.part)===null||s===void 0||s.update({params:this._params.params})}toJSON(){var e,n;const s=(n=(e=this._params)===null||e===void 0?void 0:e.params)!==null&&n!==void 0?n:{};return{id:this.id,component:this.component,params:Object.keys(s).length>0?s:void 0}}dispose(){var e;this.api.dispose(),(e=this.part)===null||e===void 0||e.dispose(),super.dispose()}}class Zy extends jh{set orientation(e){this._orientation=e}get orientation(){return this._orientation}get minimumSize(){const e=this.headerSize,s=this.isExpanded()?this._minimumBodySize:0;return e+s}get maximumSize(){const e=this.headerSize,s=this.isExpanded()?this._maximumBodySize:0;return e+s}get size(){return this._size}get orthogonalSize(){return this._orthogonalSize}set orthogonalSize(e){this._orthogonalSize=e}get minimumBodySize(){return this._minimumBodySize}set minimumBodySize(e){this._minimumBodySize=typeof e=="number"?e:0}get maximumBodySize(){return this._maximumBodySize}set maximumBodySize(e){this._maximumBodySize=typeof e=="number"?e:Number.POSITIVE_INFINITY}get headerVisible(){return this._headerVisible}set headerVisible(e){this._headerVisible=e,this.header.style.display=e?"":"none"}constructor(e){super(e.id,e.component,new Qy(e.id,e.component)),this._onDidChangeExpansionState=new U({replay:!0}),this.onDidChangeExpansionState=this._onDidChangeExpansionState.event,this._onDidChange=new U,this.onDidChange=this._onDidChange.event,this._orthogonalSize=0,this._size=0,this._isExpanded=!1,this.api.pane=this,this.api.initialize(this),this.headerSize=e.headerSize,this.headerComponent=e.headerComponent,this._minimumBodySize=e.minimumBodySize,this._maximumBodySize=e.maximumBodySize,this._isExpanded=e.isExpanded,this._headerVisible=e.isHeaderVisible,this._onDidChangeExpansionState.fire(this.isExpanded()),this._orientation=e.orientation,this.element.classList.add("dv-pane"),this.addDisposables(this.api.onWillVisibilityChange(n=>{const{isVisible:s}=n,{accessor:l}=this._params;l.setVisible(this,s)}),this.api.onDidSizeChange(n=>{this._onDidChange.fire({size:n.size})}),Be(this.element,"mouseenter",n=>{this.api._onMouseEnter.fire(n)}),Be(this.element,"mouseleave",n=>{this.api._onMouseLeave.fire(n)})),this.addDisposables(this._onDidChangeExpansionState,this.onDidChangeExpansionState(n=>{this.api._onDidExpansionChange.fire({isExpanded:n})}),this.api.onDidFocusChange(n=>{this.header&&(n.isFocused?tc(this.header,"focused"):Zl(this.header,"focused"))})),this.renderOnce()}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}isExpanded(){return this._isExpanded}setExpanded(e){this._isExpanded!==e&&(this._isExpanded=e,e?(this.animationTimer&&clearTimeout(this.animationTimer),this.body&&this.element.appendChild(this.body)):this.animationTimer=setTimeout(()=>{var n;(n=this.body)===null||n===void 0||n.remove()},200),this._onDidChange.fire(e?{size:this.width}:{}),this._onDidChangeExpansionState.fire(e))}layout(e,n){this._size=e,this._orthogonalSize=n;const[s,l]=this.orientation===ze.HORIZONTAL?[e,n]:[n,e];super.layout(s,l)}init(e){var n,s;super.init(e),typeof e.minimumBodySize=="number"&&(this.minimumBodySize=e.minimumBodySize),typeof e.maximumBodySize=="number"&&(this.maximumBodySize=e.maximumBodySize),this.bodyPart=this.getBodyComponent(),this.headerPart=this.getHeaderComponent(),this.bodyPart.init(Object.assign(Object.assign({},e),{api:this.api})),this.headerPart.init(Object.assign(Object.assign({},e),{api:this.api})),(n=this.body)===null||n===void 0||n.append(this.bodyPart.element),(s=this.header)===null||s===void 0||s.append(this.headerPart.element),typeof e.isExpanded=="boolean"&&this.setExpanded(e.isExpanded)}toJSON(){const e=this._params;return Object.assign(Object.assign({},super.toJSON()),{headerComponent:this.headerComponent,title:e.title})}renderOnce(){this.header=document.createElement("div"),this.header.tabIndex=0,this.header.className="dv-pane-header",this.header.style.height=`${this.headerSize}px`,this.header.style.lineHeight=`${this.headerSize}px`,this.header.style.minHeight=`${this.headerSize}px`,this.header.style.maxHeight=`${this.headerSize}px`,this.element.appendChild(this.header),this.body=document.createElement("div"),this.body.className="dv-pane-body",this.element.appendChild(this.body)}getComponent(){return{update:e=>{var n,s;(n=this.bodyPart)===null||n===void 0||n.update({params:e}),(s=this.headerPart)===null||s===void 0||s.update({params:e})},dispose:()=>{var e,n;(e=this.bodyPart)===null||e===void 0||e.dispose(),(n=this.headerPart)===null||n===void 0||n.dispose()}}}}class Xy extends Zy{constructor(e){super({id:e.id,component:e.component,headerComponent:e.headerComponent,orientation:e.orientation,isExpanded:e.isExpanded,isHeaderVisible:!0,headerSize:e.headerSize,minimumBodySize:e.minimumBodySize,maximumBodySize:e.maximumBodySize}),this._onDidDrop=new U,this.onDidDrop=this._onDidDrop.event,this._onUnhandledDragOverEvent=new U,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,this.accessor=e.accessor,this.addDisposables(this._onDidDrop,this._onUnhandledDragOverEvent),e.disableDnd||this.initDragFeatures()}initDragFeatures(){if(!this.header)return;const e=this.id,n=this.accessor.id;this.header.draggable=!0,this.handler=new class extends Hh{getData(){return Ds.getInstance().setData([new Ul(n,e)],Ul.prototype),{dispose:()=>{Ds.getInstance().clearData(Ul.prototype)}}}}(this.header),this.target=new rs(this.element,{acceptedTargetZones:["top","bottom"],overlayModel:{activationSize:{type:"percentage",value:50}},canDisplayOverlay:(s,l)=>{const a=Nl();if(a&&a.paneId!==this.id&&a.viewId===this.accessor.id)return!0;const c=new Jy(s,l,Nl,this);return this._onUnhandledDragOverEvent.fire(c),c.isAccepted}}),this.addDisposables(this._onDidDrop,this.handler,this.target,this.target.onDrop(s=>{this.onDrop(s)}))}onDrop(e){const n=Nl();if(!n||n.viewId!==this.accessor.id){this._onDidDrop.fire(Object.assign(Object.assign({},e),{panel:this,api:new ql(this.accessor),getData:Nl}));return}const s=this._params.containerApi,l=n.paneId,a=s.getPanel(l);if(!a){this._onDidDrop.fire(Object.assign(Object.assign({},e),{panel:this,getData:Nl,api:new ql(this.accessor)}));return}const c=s.panels,d=c.indexOf(a);let h=s.panels.indexOf(this);(e.position==="left"||e.position==="top")&&(h=Math.max(0,h-1)),(e.position==="right"||e.position==="bottom")&&(d>h&&h++,h=Math.min(c.length-1,h)),s.movePanel(d,h)}}class qy extends Re{get element(){return this._element}constructor(e,n){super(),this.accessor=e,this.group=n,this.disposable=new Bn,this._onDidFocus=new U,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new U,this.onDidBlur=this._onDidBlur.event,this._element=document.createElement("div"),this._element.className="dv-content-container",this._element.tabIndex=-1,this.addDisposables(this._onDidFocus,this._onDidBlur);const s=n.dropTargetContainer;this.dropTarget=new rs(this.element,{getOverlayOutline:()=>{var l;return((l=e.options.theme)===null||l===void 0?void 0:l.dndPanelOverlay)==="group"?this.element.parentElement:null},className:"dv-drop-target-content",acceptedTargetZones:["top","bottom","left","right","center"],canDisplayOverlay:(l,a)=>{if(this.group.locked==="no-drop-target"||this.group.locked&&a==="center")return!1;const c=Hn();return!c&&l.shiftKey&&this.group.location.type!=="floating"?!1:c&&c.viewId===this.accessor.id?!0:this.group.canDisplayOverlay(l,a,"content")},getOverrideTarget:s?()=>s.model:void 0}),this.addDisposables(this.dropTarget)}show(){this.element.style.display=""}hide(){this.element.style.display="none"}renderPanel(e,n={asActive:!0}){const s=n.asActive||this.panel&&this.group.isPanelActive(this.panel);this.panel&&this.panel.view.content.element.parentElement===this._element&&this._element.removeChild(this.panel.view.content.element),this.panel=e;let l;switch(e.api.renderer){case"onlyWhenVisible":this.group.renderContainer.detatch(e),this.panel&&s&&this._element.appendChild(this.panel.view.content.element),l=this._element;break;case"always":e.view.content.element.parentElement===this._element&&this._element.removeChild(e.view.content.element),l=this.group.renderContainer.attach({panel:e,referenceContainer:this});break;default:throw new Error(`dockview: invalid renderer type '${e.api.renderer}'`)}if(s){const a=av(l);this.focusTracker=a;const c=new Re;c.addDisposables(a,a.onDidFocus(()=>this._onDidFocus.fire()),a.onDidBlur(()=>this._onDidBlur.fire())),this.disposable.value=c}}openPanel(e){this.panel!==e&&this.renderPanel(e)}layout(e,n){}closePanel(){var e;this.panel&&this.panel.api.renderer==="onlyWhenVisible"&&((e=this.panel.view.content.element.parentElement)===null||e===void 0||e.removeChild(this.panel.view.content.element)),this.panel=void 0}dispose(){this.disposable.dispose(),super.dispose()}refreshFocusState(){var e;!((e=this.focusTracker)===null||e===void 0)&&e.refreshState&&this.focusTracker.refreshState()}}function yv(r,e,n){var s,l;tc(e,"dv-dragged"),e.style.top="-9999px",document.body.appendChild(e),r.setDragImage(e,(s=n==null?void 0:n.x)!==null&&s!==void 0?s:0,(l=n==null?void 0:n.y)!==null&&l!==void 0?l:0),setTimeout(()=>{Zl(e,"dv-dragged"),e.remove()},0)}class eS extends Hh{constructor(e,n,s,l,a){super(e,a),this.accessor=n,this.group=s,this.panel=l,this.panelTransfer=Ds.getInstance()}getData(e){return this.panelTransfer.setData([new _r(this.accessor.id,this.group.id,this.panel.id)],_r.prototype),{dispose:()=>{this.panelTransfer.clearData(_r.prototype)}}}}class tS extends Re{get element(){return this._element}constructor(e,n,s){super(),this.panel=e,this.accessor=n,this.group=s,this.content=void 0,this._onPointDown=new U,this.onPointerDown=this._onPointDown.event,this._onDropped=new U,this.onDrop=this._onDropped.event,this._onDragStart=new U,this.onDragStart=this._onDragStart.event,this._element=document.createElement("div"),this._element.className="dv-tab",this._element.tabIndex=0,this._element.draggable=!this.accessor.options.disableDnd,Ne(this.element,"dv-inactive-tab",!0),this.dragHandler=new eS(this._element,this.accessor,this.group,this.panel,!!this.accessor.options.disableDnd),this.dropTarget=new rs(this._element,{acceptedTargetZones:["left","right"],overlayModel:{activationSize:{value:50,type:"percentage"}},canDisplayOverlay:(l,a)=>{if(this.group.locked)return!1;const c=Hn();return c&&this.accessor.id===c.viewId?!0:this.group.model.canDisplayOverlay(l,a,"tab")},getOverrideTarget:()=>{var l;return(l=s.model.dropTargetContainer)===null||l===void 0?void 0:l.model}}),this.onWillShowOverlay=this.dropTarget.onWillShowOverlay,this.addDisposables(this._onPointDown,this._onDropped,this._onDragStart,this.dragHandler.onDragStart(l=>{if(l.dataTransfer){const a=getComputedStyle(this.element),c=this.element.cloneNode(!0);Array.from(a).forEach(d=>c.style.setProperty(d,a.getPropertyValue(d),a.getPropertyPriority(d))),c.style.position="absolute",yv(l.dataTransfer,c,{y:-10,x:30})}this._onDragStart.fire(l)}),this.dragHandler,Be(this._element,"pointerdown",l=>{this._onPointDown.fire(l)}),this.dropTarget.onDrop(l=>{this._onDropped.fire(l)}),this.dropTarget)}setActive(e){Ne(this.element,"dv-active-tab",e),Ne(this.element,"dv-inactive-tab",!e)}setContent(e){this.content&&this._element.removeChild(this.content.element),this.content=e,this._element.appendChild(this.content.element)}updateDragAndDropState(){this._element.draggable=!this.accessor.options.disableDnd,this.dragHandler.setDisabled(!!this.accessor.options.disableDnd)}dispose(){super.dispose()}}class ic{get kind(){return this.options.kind}get nativeEvent(){return this.event.nativeEvent}get position(){return this.event.position}get defaultPrevented(){return this.event.defaultPrevented}get panel(){return this.options.panel}get api(){return this.options.api}get group(){return this.options.group}preventDefault(){this.event.preventDefault()}getData(){return this.options.getData()}constructor(e,n){this.event=e,this.options=n}}class nS extends Hh{constructor(e,n,s,l){super(e,l),this.accessor=n,this.group=s,this.panelTransfer=Ds.getInstance(),this.addDisposables(Be(e,"pointerdown",a=>{a.shiftKey&&_y(a)},!0))}isCancelled(e){return this.group.api.location.type==="floating"&&!e.shiftKey}getData(e){const n=e.dataTransfer;this.panelTransfer.setData([new _r(this.accessor.id,this.group.id,null)],_r.prototype);const s=window.getComputedStyle(this.el),l=s.getPropertyValue("--dv-activegroup-visiblepanel-tab-background-color"),a=s.getPropertyValue("--dv-activegroup-visiblepanel-tab-color");if(n){const c=document.createElement("div");c.style.backgroundColor=l,c.style.color=a,c.style.padding="2px 8px",c.style.height="24px",c.style.fontSize="11px",c.style.lineHeight="20px",c.style.borderRadius="12px",c.style.position="absolute",c.style.pointerEvents="none",c.style.top="-9999px",c.textContent=`Multiple Panels (${this.group.size})`,yv(n,c,{y:-10,x:30})}return{dispose:()=>{this.panelTransfer.clearData(_r.prototype)}}}}class iS extends Re{get element(){return this._element}constructor(e,n){super(),this.accessor=e,this.group=n,this._onDrop=new U,this.onDrop=this._onDrop.event,this._onDragStart=new U,this.onDragStart=this._onDragStart.event,this._element=document.createElement("div"),this._element.className="dv-void-container",this._element.draggable=!this.accessor.options.disableDnd,Ne(this._element,"dv-draggable",!this.accessor.options.disableDnd),this.addDisposables(this._onDrop,this._onDragStart,Be(this._element,"pointerdown",()=>{this.accessor.doSetGroupActive(this.group)})),this.handler=new nS(this._element,e,n,!!this.accessor.options.disableDnd),this.dropTarget=new rs(this._element,{acceptedTargetZones:["center"],canDisplayOverlay:(s,l)=>{const a=Hn();return a&&this.accessor.id===a.viewId?!0:n.model.canDisplayOverlay(s,l,"header_space")},getOverrideTarget:()=>{var s;return(s=n.model.dropTargetContainer)===null||s===void 0?void 0:s.model}}),this.onWillShowOverlay=this.dropTarget.onWillShowOverlay,this.addDisposables(this.handler,this.handler.onDragStart(s=>{this._onDragStart.fire(s)}),this.dropTarget.onDrop(s=>{this._onDrop.fire(s)}),this.dropTarget)}updateDragAndDropState(){this._element.draggable=!this.accessor.options.disableDnd,Ne(this._element,"dv-draggable",!this.accessor.options.disableDnd),this.handler.setDisabled(!!this.accessor.options.disableDnd)}}class sc extends Re{get element(){return this._element}constructor(e){super(),this.scrollableElement=e,this._scrollLeft=0,this._element=document.createElement("div"),this._element.className="dv-scrollable",this._horizontalScrollbar=document.createElement("div"),this._horizontalScrollbar.className="dv-scrollbar-horizontal",this.element.appendChild(e),this.element.appendChild(this._horizontalScrollbar),this.addDisposables(Be(this.element,"wheel",n=>{this._scrollLeft+=n.deltaY*sc.MouseWheelSpeed,this.calculateScrollbarStyles()}),Be(this._horizontalScrollbar,"pointerdown",n=>{n.preventDefault(),Ne(this.element,"dv-scrollable-scrolling",!0);const s=n.clientX,l=this._scrollLeft,a=d=>{const h=d.clientX-s,{clientWidth:m}=this.element,{scrollWidth:w}=this.scrollableElement,v=m/w;this._scrollLeft=l+h/v,this.calculateScrollbarStyles()},c=()=>{Ne(this.element,"dv-scrollable-scrolling",!1),document.removeEventListener("pointermove",a),document.removeEventListener("pointerup",c),document.removeEventListener("pointercancel",c)};document.addEventListener("pointermove",a),document.addEventListener("pointerup",c),document.addEventListener("pointercancel",c)}),Be(this.element,"scroll",()=>{this.calculateScrollbarStyles()}),Be(this.scrollableElement,"scroll",()=>{this._scrollLeft=this.scrollableElement.scrollLeft,this.calculateScrollbarStyles()}),ec(this.element,()=>{Ne(this.element,"dv-scrollable-resizing",!0),this._animationTimer&&clearTimeout(this._animationTimer),this._animationTimer=setTimeout(()=>{clearTimeout(this._animationTimer),Ne(this.element,"dv-scrollable-resizing",!1)},500),this.calculateScrollbarStyles()}))}calculateScrollbarStyles(){const{clientWidth:e}=this.element,{scrollWidth:n}=this.scrollableElement;if(n>e){const l=e*(e/n);this._horizontalScrollbar.style.width=`${l}px`,this._scrollLeft=_t(this._scrollLeft,0,this.scrollableElement.scrollWidth-e),this.scrollableElement.scrollLeft=this._scrollLeft;const a=this._scrollLeft/(n-e);this._horizontalScrollbar.style.left=`${(e-l)*a}px`}else this._horizontalScrollbar.style.width="0px",this._horizontalScrollbar.style.left="0px",this._scrollLeft=0}}sc.MouseWheelSpeed=1;class sS extends Re{get showTabsOverflowControl(){return this._showTabsOverflowControl}set showTabsOverflowControl(e){if(this._showTabsOverflowControl!=e&&(this._showTabsOverflowControl=e,e)){const n=new vy(this._tabsList);this._observerDisposable.value=new Re(n,n.onDidChange(s=>{const l=s.hasScrollX||s.hasScrollY;this.toggleDropdown({reset:!l})}),Be(this._tabsList,"scroll",()=>{this.toggleDropdown({reset:!1})}))}}get element(){return this._element}get panels(){return this._tabs.map(e=>e.value.panel.id)}get size(){return this._tabs.length}get tabs(){return this._tabs.map(e=>e.value)}constructor(e,n,s){if(super(),this.group=e,this.accessor=n,this._observerDisposable=new Bn,this._tabs=[],this.selectedIndex=-1,this._showTabsOverflowControl=!1,this._onTabDragStart=new U,this.onTabDragStart=this._onTabDragStart.event,this._onDrop=new U,this.onDrop=this._onDrop.event,this._onWillShowOverlay=new U,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onOverflowTabsChange=new U,this.onOverflowTabsChange=this._onOverflowTabsChange.event,this._tabsList=document.createElement("div"),this._tabsList.className="dv-tabs-container dv-horizontal",this.showTabsOverflowControl=s.showTabsOverflowControl,n.options.scrollbars==="native")this._element=this._tabsList;else{const l=new sc(this._tabsList);this._element=l.element,this.addDisposables(l)}this.addDisposables(this._onOverflowTabsChange,this._observerDisposable,this._onWillShowOverlay,this._onDrop,this._onTabDragStart,Be(this.element,"pointerdown",l=>{if(l.defaultPrevented)return;l.button===0&&this.accessor.doSetGroupActive(this.group)}),Qt.from(()=>{for(const{value:l,disposable:a}of this._tabs)a.dispose(),l.dispose();this._tabs=[]}))}indexOf(e){return this._tabs.findIndex(n=>n.value.panel.id===e)}isActive(e){return this.selectedIndex>-1&&this._tabs[this.selectedIndex].value===e}setActivePanel(e){let n=0;for(const s of this._tabs){const l=e.id===s.value.panel.id;if(s.value.setActive(l),l){const a=s.value.element,c=a.parentElement;(nc.scrollLeft+c.clientWidth)&&(c.scrollLeft=n)}n+=s.value.element.clientWidth}}openPanel(e,n=this._tabs.length){if(this._tabs.find(c=>c.value.panel.id===e.id))return;const s=new tS(e,this.accessor,this.group);s.setContent(e.view.tab);const l=new Re(s.onDragStart(c=>{this._onTabDragStart.fire({nativeEvent:c,panel:e})}),s.onPointerDown(c=>{if(c.defaultPrevented)return;const d=!this.accessor.options.disableFloatingGroups,h=this.group.api.location.type==="floating"&&this.size===1;if(d&&!h&&c.shiftKey){c.preventDefault();const m=this.accessor.getGroupPanel(s.panel.id),{top:w,left:v}=s.element.getBoundingClientRect(),{top:S,left:E}=this.accessor.element.getBoundingClientRect();this.accessor.addFloatingGroup(m,{x:v-E,y:w-S,inDragMode:!0});return}switch(c.button){case 0:this.group.activePanel!==e&&this.group.model.openPanel(e);break}}),s.onDrop(c=>{this._onDrop.fire({event:c.nativeEvent,index:this._tabs.findIndex(d=>d.value===s)})}),s.onWillShowOverlay(c=>{this._onWillShowOverlay.fire(new ic(c,{kind:"tab",panel:this.group.activePanel,api:this.accessor.api,group:this.group,getData:Hn}))})),a={value:s,disposable:l};this.addTab(a,n)}delete(e){const n=this.indexOf(e),s=this._tabs.splice(n,1)[0],{value:l,disposable:a}=s;a.dispose(),l.dispose(),l.element.remove()}addTab(e,n=this._tabs.length){if(n<0||n>this._tabs.length)throw new Error("invalid location");this._tabsList.insertBefore(e.value.element,this._tabsList.children[n]),this._tabs=[...this._tabs.slice(0,n),e,...this._tabs.slice(n)],this.selectedIndex<0&&(this.selectedIndex=n)}toggleDropdown(e){const n=e.reset?[]:this._tabs.filter(s=>!Ey(s.value.element,this._tabsList)).map(s=>s.value.panel.id);this._onOverflowTabsChange.fire({tabs:n,reset:e.reset})}updateDragAndDropState(){for(const e of this._tabs)e.value.updateDragAndDropState()}}const Bh=r=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttributeNS(null,"height",r.height),e.setAttributeNS(null,"width",r.width),e.setAttributeNS(null,"viewBox",r.viewbox),e.setAttributeNS(null,"aria-hidden","false"),e.setAttributeNS(null,"focusable","false"),e.classList.add("dv-svg");const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttributeNS(null,"d",r.path),e.appendChild(n),e},rS=()=>Bh({width:"11",height:"11",viewbox:"0 0 28 28",path:"M2.1 27.3L0 25.2L11.55 13.65L0 2.1L2.1 0L13.65 11.55L25.2 0L27.3 2.1L15.75 13.65L27.3 25.2L25.2 27.3L13.65 15.75L2.1 27.3Z"}),oS=()=>Bh({width:"11",height:"11",viewbox:"0 0 24 15",path:"M12 14.15L0 2.15L2.15 0L12 9.9L21.85 0.0499992L24 2.2L12 14.15Z"}),Sv=()=>Bh({width:"11",height:"11",viewbox:"0 0 15 25",path:"M2.15 24.1L0 21.95L9.9 12.05L0 2.15L2.15 0L14.2 12.05L2.15 24.1Z"});function lS(){const r=document.createElement("div");r.className="dv-tabs-overflow-dropdown-default";const e=document.createElement("span");e.textContent="";const n=Sv();return r.appendChild(n),r.appendChild(e),{element:r,update:s=>{e.textContent=`${s.tabs}`}}}class aS extends Re{get onTabDragStart(){return this.tabs.onTabDragStart}get panels(){return this.tabs.panels}get size(){return this.tabs.size}get hidden(){return this._hidden}set hidden(e){this._hidden=e,this.element.style.display=e?"none":""}get element(){return this._element}constructor(e,n){super(),this.accessor=e,this.group=n,this._hidden=!1,this.dropdownPart=null,this._overflowTabs=[],this._dropdownDisposable=new Bn,this._onDrop=new U,this.onDrop=this._onDrop.event,this._onGroupDragStart=new U,this.onGroupDragStart=this._onGroupDragStart.event,this._onWillShowOverlay=new U,this.onWillShowOverlay=this._onWillShowOverlay.event,this._element=document.createElement("div"),this._element.className="dv-tabs-and-actions-container",Ne(this._element,"dv-full-width-single-tab",this.accessor.options.singleTabMode==="fullwidth"),this.rightActionsContainer=document.createElement("div"),this.rightActionsContainer.className="dv-right-actions-container",this.leftActionsContainer=document.createElement("div"),this.leftActionsContainer.className="dv-left-actions-container",this.preActionsContainer=document.createElement("div"),this.preActionsContainer.className="dv-pre-actions-container",this.tabs=new sS(n,e,{showTabsOverflowControl:!e.options.disableTabsOverflowList}),this.voidContainer=new iS(this.accessor,this.group),this._element.appendChild(this.preActionsContainer),this._element.appendChild(this.tabs.element),this._element.appendChild(this.leftActionsContainer),this._element.appendChild(this.voidContainer.element),this._element.appendChild(this.rightActionsContainer),this.addDisposables(this.tabs.onDrop(s=>this._onDrop.fire(s)),this.tabs.onWillShowOverlay(s=>this._onWillShowOverlay.fire(s)),e.onDidOptionsChange(()=>{this.tabs.showTabsOverflowControl=!e.options.disableTabsOverflowList}),this.tabs.onOverflowTabsChange(s=>{this.toggleDropdown(s)}),this.tabs,this._onWillShowOverlay,this._onDrop,this._onGroupDragStart,this.voidContainer,this.voidContainer.onDragStart(s=>{this._onGroupDragStart.fire({nativeEvent:s,group:this.group})}),this.voidContainer.onDrop(s=>{this._onDrop.fire({event:s.nativeEvent,index:this.tabs.size})}),this.voidContainer.onWillShowOverlay(s=>{this._onWillShowOverlay.fire(new ic(s,{kind:"header_space",panel:this.group.activePanel,api:this.accessor.api,group:this.group,getData:Hn}))}),Be(this.voidContainer.element,"pointerdown",s=>{if(s.defaultPrevented)return;if(!this.accessor.options.disableFloatingGroups&&s.shiftKey&&this.group.api.location.type!=="floating"){s.preventDefault();const{top:a,left:c}=this.element.getBoundingClientRect(),{top:d,left:h}=this.accessor.element.getBoundingClientRect();this.accessor.addFloatingGroup(this.group,{x:c-h+20,y:a-d+20,inDragMode:!0})}}))}show(){this.hidden||(this.element.style.display="")}hide(){this._element.style.display="none"}setRightActionsElement(e){this.rightActions!==e&&(this.rightActions&&(this.rightActions.remove(),this.rightActions=void 0),e&&(this.rightActionsContainer.appendChild(e),this.rightActions=e))}setLeftActionsElement(e){this.leftActions!==e&&(this.leftActions&&(this.leftActions.remove(),this.leftActions=void 0),e&&(this.leftActionsContainer.appendChild(e),this.leftActions=e))}setPrefixActionsElement(e){this.preActions!==e&&(this.preActions&&(this.preActions.remove(),this.preActions=void 0),e&&(this.preActionsContainer.appendChild(e),this.preActions=e))}isActive(e){return this.tabs.isActive(e)}indexOf(e){return this.tabs.indexOf(e)}setActive(e){}delete(e){this.tabs.delete(e),this.updateClassnames()}setActivePanel(e){this.tabs.setActivePanel(e)}openPanel(e,n=this.tabs.size){this.tabs.openPanel(e,n),this.updateClassnames()}closePanel(e){this.delete(e.id)}updateClassnames(){Ne(this._element,"dv-single-tab",this.size===1)}toggleDropdown(e){const n=e.reset?[]:e.tabs;if(this._overflowTabs=n,this._overflowTabs.length>0&&this.dropdownPart){this.dropdownPart.update({tabs:n.length});return}if(this._overflowTabs.length===0){this._dropdownDisposable.dispose();return}const s=document.createElement("div");s.className="dv-tabs-overflow-dropdown-root";const l=lS();l.update({tabs:n.length}),this.dropdownPart=l,s.appendChild(l.element),this.rightActionsContainer.prepend(s),this._dropdownDisposable.value=new Re(Qt.from(()=>{var a,c;s.remove(),(c=(a=this.dropdownPart)===null||a===void 0?void 0:a.dispose)===null||c===void 0||c.call(a),this.dropdownPart=null}),Be(s,"pointerdown",a=>{a.preventDefault()},{capture:!0}),Be(s,"click",a=>{const c=document.createElement("div");c.style.overflow="auto",c.className="dv-tabs-overflow-container";for(const h of this.tabs.tabs.filter(m=>this._overflowTabs.includes(m.panel.id))){const m=this.group.panels.find(E=>E===h.panel),v=m.view.createTabRenderer("headerOverflow").element,S=document.createElement("div");Ne(S,"dv-tab",!0),Ne(S,"dv-active-tab",m.api.isActive),Ne(S,"dv-inactive-tab",!m.api.isActive),S.addEventListener("click",E=>{this.accessor.popupService.close(),!E.defaultPrevented&&(h.element.scrollIntoView(),h.panel.api.setActive())}),S.appendChild(v),c.appendChild(S)}const d=zy(s);this.accessor.popupService.openPopover(c,{x:a.clientX,y:a.clientY,zIndex:d!=null&&d.style.zIndex?`calc(${d.style.zIndex} * 2)`:void 0})}))}updateDragAndDropState(){this.tabs.updateDragAndDropState(),this.voidContainer.updateDragAndDropState()}}class Dv extends lv{constructor(e,n,s,l,a){super(),this.nativeEvent=e,this.target=n,this.position=s,this.getData=l,this.group=a}}const vh=Object.keys({disableAutoResizing:void 0,hideBorders:void 0,singleTabMode:void 0,disableFloatingGroups:void 0,floatingGroupBounds:void 0,popoutUrl:void 0,defaultRenderer:void 0,debug:void 0,rootOverlayModel:void 0,locked:void 0,disableDnd:void 0,className:void 0,noPanelsOverlay:void 0,dndEdges:void 0,theme:void 0,disableTabsOverflowList:void 0,scrollbars:void 0});function uS(r){return!!r.referencePanel}function cS(r){return!!r.referenceGroup}function dS(r){return!!r.referencePanel}function hS(r){return!!r.referenceGroup}class Uh extends Gh{get nativeEvent(){return this.options.nativeEvent}get position(){return this.options.position}get panel(){return this.options.panel}get group(){return this.options.group}get api(){return this.options.api}constructor(e){super(),this.options=e}getData(){return this.options.getData()}}class Cv extends Uh{get kind(){return this._kind}constructor(e){super(e),this._kind=e.kind}}class fS extends Re{get element(){throw new Error("dockview: not supported")}get activePanel(){return this._activePanel}get locked(){return this._locked}set locked(e){this._locked=e,Ne(this.container,"dv-locked-groupview",e==="no-drop-target"||e)}get isActive(){return this._isGroupActive}get panels(){return this._panels}get size(){return this._panels.length}get isEmpty(){return this._panels.length===0}get hasWatermark(){return!!(this.watermark&&this.container.contains(this.watermark.element))}get header(){return this.tabsContainer}get isContentFocused(){return document.activeElement?uh(document.activeElement,this.contentContainer.element):!1}get location(){return this._location}set location(e){switch(this._location=e,Ne(this.container,"dv-groupview-floating",!1),Ne(this.container,"dv-groupview-popout",!1),e.type){case"grid":this.contentContainer.dropTarget.setTargetZones(["top","bottom","left","right","center"]);break;case"floating":this.contentContainer.dropTarget.setTargetZones(["center"]),this.contentContainer.dropTarget.setTargetZones(e?["center"]:["top","bottom","left","right","center"]),Ne(this.container,"dv-groupview-floating",!0);break;case"popout":this.contentContainer.dropTarget.setTargetZones(["center"]),Ne(this.container,"dv-groupview-popout",!0);break}this.groupPanel.api._onDidLocationChange.fire({location:this.location})}constructor(e,n,s,l,a){var c;super(),this.container=e,this.accessor=n,this.id=s,this.options=l,this.groupPanel=a,this._isGroupActive=!1,this._locked=!1,this._location={type:"grid"},this.mostRecentlyUsed=[],this._overwriteRenderContainer=null,this._overwriteDropTargetContainer=null,this._onDidChange=new U,this.onDidChange=this._onDidChange.event,this._width=0,this._height=0,this._panels=[],this._panelDisposables=new Map,this._onMove=new U,this.onMove=this._onMove.event,this._onDidDrop=new U,this.onDidDrop=this._onDidDrop.event,this._onWillDrop=new U,this.onWillDrop=this._onWillDrop.event,this._onWillShowOverlay=new U,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onTabDragStart=new U,this.onTabDragStart=this._onTabDragStart.event,this._onGroupDragStart=new U,this.onGroupDragStart=this._onGroupDragStart.event,this._onDidAddPanel=new U,this.onDidAddPanel=this._onDidAddPanel.event,this._onDidPanelTitleChange=new U,this.onDidPanelTitleChange=this._onDidPanelTitleChange.event,this._onDidPanelParametersChange=new U,this.onDidPanelParametersChange=this._onDidPanelParametersChange.event,this._onDidRemovePanel=new U,this.onDidRemovePanel=this._onDidRemovePanel.event,this._onDidActivePanelChange=new U,this.onDidActivePanelChange=this._onDidActivePanelChange.event,this._onUnhandledDragOverEvent=new U,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,Ne(this.container,"dv-groupview",!0),this._api=new Bu(this.accessor),this.tabsContainer=new aS(this.accessor,this.groupPanel),this.contentContainer=new qy(this.accessor,this),e.append(this.tabsContainer.element,this.contentContainer.element),this.header.hidden=!!l.hideHeader,this.locked=(c=l.locked)!==null&&c!==void 0?c:!1,this.addDisposables(this._onTabDragStart,this._onGroupDragStart,this._onWillShowOverlay,this.tabsContainer.onTabDragStart(d=>{this._onTabDragStart.fire(d)}),this.tabsContainer.onGroupDragStart(d=>{this._onGroupDragStart.fire(d)}),this.tabsContainer.onDrop(d=>{this.handleDropEvent("header",d.event,"center",d.index)}),this.contentContainer.onDidFocus(()=>{this.accessor.doSetGroupActive(this.groupPanel)}),this.contentContainer.onDidBlur(()=>{}),this.contentContainer.dropTarget.onDrop(d=>{this.handleDropEvent("content",d.nativeEvent,d.position)}),this.tabsContainer.onWillShowOverlay(d=>{this._onWillShowOverlay.fire(d)}),this.contentContainer.dropTarget.onWillShowOverlay(d=>{this._onWillShowOverlay.fire(new ic(d,{kind:"content",panel:this.activePanel,api:this._api,group:this.groupPanel,getData:Hn}))}),this._onMove,this._onDidChange,this._onDidDrop,this._onWillDrop,this._onDidAddPanel,this._onDidRemovePanel,this._onDidActivePanelChange,this._onUnhandledDragOverEvent,this._onDidPanelTitleChange,this._onDidPanelParametersChange)}focusContent(){this.contentContainer.element.focus()}set renderContainer(e){this.panels.forEach(n=>{this.renderContainer.detatch(n)}),this._overwriteRenderContainer=e,this.panels.forEach(n=>{this.rerender(n)})}get renderContainer(){var e;return(e=this._overwriteRenderContainer)!==null&&e!==void 0?e:this.accessor.overlayRenderContainer}set dropTargetContainer(e){this._overwriteDropTargetContainer=e}get dropTargetContainer(){var e;return(e=this._overwriteDropTargetContainer)!==null&&e!==void 0?e:this.accessor.rootDropTargetContainer}initialize(){this.options.panels&&this.options.panels.forEach(e=>{this.doAddPanel(e)}),this.options.activePanel&&this.openPanel(this.options.activePanel),this.setActive(this.isActive,!0),this.updateContainer(),this.accessor.options.createRightHeaderActionComponent&&(this._rightHeaderActions=this.accessor.options.createRightHeaderActionComponent(this.groupPanel),this.addDisposables(this._rightHeaderActions),this._rightHeaderActions.init({containerApi:this._api,api:this.groupPanel.api,group:this.groupPanel}),this.tabsContainer.setRightActionsElement(this._rightHeaderActions.element)),this.accessor.options.createLeftHeaderActionComponent&&(this._leftHeaderActions=this.accessor.options.createLeftHeaderActionComponent(this.groupPanel),this.addDisposables(this._leftHeaderActions),this._leftHeaderActions.init({containerApi:this._api,api:this.groupPanel.api,group:this.groupPanel}),this.tabsContainer.setLeftActionsElement(this._leftHeaderActions.element)),this.accessor.options.createPrefixHeaderActionComponent&&(this._prefixHeaderActions=this.accessor.options.createPrefixHeaderActionComponent(this.groupPanel),this.addDisposables(this._prefixHeaderActions),this._prefixHeaderActions.init({containerApi:this._api,api:this.groupPanel.api,group:this.groupPanel}),this.tabsContainer.setPrefixActionsElement(this._prefixHeaderActions.element))}rerender(e){this.contentContainer.renderPanel(e,{asActive:!1})}indexOf(e){return this.tabsContainer.indexOf(e.id)}toJSON(){var e;const n={views:this.tabsContainer.panels,activeView:(e=this._activePanel)===null||e===void 0?void 0:e.id,id:this.id};return this.locked!==!1&&(n.locked=this.locked),this.header.hidden&&(n.hideHeader=!0),n}moveToNext(e){e||(e={}),e.panel||(e.panel=this.activePanel);const n=e.panel?this.panels.indexOf(e.panel):-1;let s;if(n0)s=n-1;else if(!e.suppressRoll)s=this.panels.length-1;else return;this.openPanel(this.panels[s])}containsPanel(e){return this.panels.includes(e)}init(e){}update(e){}focus(){var e;(e=this._activePanel)===null||e===void 0||e.focus()}openPanel(e,n={}){(typeof n.index!="number"||n.index>this.panels.length)&&(n.index=this.panels.length);const s=!!n.skipSetActive;if(e.updateParentGroup(this.groupPanel,{skipSetActive:n.skipSetActive}),this.doAddPanel(e,n.index,{skipSetActive:s}),this._activePanel===e){this.contentContainer.renderPanel(e,{asActive:!0});return}s||this.doSetActivePanel(e),n.skipSetGroupActive||this.accessor.doSetGroupActive(this.groupPanel),n.skipSetActive||this.updateContainer()}removePanel(e,n={skipSetActive:!1}){const s=typeof e=="string"?e:e.id,l=this._panels.find(a=>a.id===s);if(!l)throw new Error("invalid operation");return this._removePanel(l,n)}closeAllPanels(){if(this.panels.length>0){const e=[...this.panels];for(const n of e)this.doClose(n)}else this.accessor.removeGroup(this.groupPanel)}closePanel(e){this.doClose(e)}doClose(e){const n=this.panels.length===1&&this.accessor.groups.length===1;this.accessor.removePanel(e,n&&this.accessor.options.noPanelsOverlay==="emptyGroup"?{removeEmptyGroup:!1}:void 0)}isPanelActive(e){return this._activePanel===e}updateActions(e){this.tabsContainer.setRightActionsElement(e)}setActive(e,n=!1){!n&&this.isActive===e||(this._isGroupActive=e,Ne(this.container,"dv-active-group",e),Ne(this.container,"dv-inactive-group",!e),this.tabsContainer.setActive(this.isActive),!this._activePanel&&this.panels.length>0&&this.doSetActivePanel(this.panels[0]),this.updateContainer())}layout(e,n){var s;this._width=e,this._height=n,this.contentContainer.layout(this._width,this._height),!((s=this._activePanel)===null||s===void 0)&&s.layout&&this._activePanel.layout(this._width,this._height)}_removePanel(e,n){const s=this._activePanel===e;if(this.doRemovePanel(e),s&&this.panels.length>0){const l=this.mostRecentlyUsed[0];this.openPanel(l,{skipSetActive:n.skipSetActive,skipSetGroupActive:n.skipSetActiveGroup})}return this._activePanel&&this.panels.length===0&&this.doSetActivePanel(void 0),n.skipSetActive||this.updateContainer(),e}doRemovePanel(e){const n=this.panels.indexOf(e);if(this._activePanel===e&&this.contentContainer.closePanel(),this.tabsContainer.delete(e.id),this._panels.splice(n,1),this.mostRecentlyUsed.includes(e)){const l=this.mostRecentlyUsed.indexOf(e);this.mostRecentlyUsed.splice(l,1)}const s=this._panelDisposables.get(e.id);s&&(s.dispose(),this._panelDisposables.delete(e.id)),this._onDidRemovePanel.fire({panel:e})}doAddPanel(e,n=this.panels.length,s={skipSetActive:!1}){const a=this._panels.indexOf(e)>-1;this.tabsContainer.show(),this.contentContainer.show(),this.tabsContainer.openPanel(e,n),s.skipSetActive||this.contentContainer.openPanel(e),!a&&(this.updateMru(e),this.panels.splice(n,0,e),this._panelDisposables.set(e.id,new Re(e.api.onDidTitleChange(c=>this._onDidPanelTitleChange.fire(c)),e.api.onDidParametersChange(c=>this._onDidPanelParametersChange.fire(c)))),this._onDidAddPanel.fire({panel:e}))}doSetActivePanel(e){this._activePanel!==e&&(this._activePanel=e,e&&(this.tabsContainer.setActivePanel(e),this.contentContainer.openPanel(e),e.layout(this._width,this._height),this.updateMru(e),this.contentContainer.refreshFocusState(),this._onDidActivePanelChange.fire({panel:e})))}updateMru(e){this.mostRecentlyUsed.includes(e)&&this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(e),1),this.mostRecentlyUsed=[e,...this.mostRecentlyUsed]}updateContainer(){var e,n;if(this.panels.forEach(s=>s.runEvents()),this.isEmpty&&!this.watermark){const s=this.accessor.createWatermarkComponent();s.init({containerApi:this._api,group:this.groupPanel}),this.watermark=s,Be(this.watermark.element,"pointerdown",()=>{this.isActive||this.accessor.doSetGroupActive(this.groupPanel)}),this.contentContainer.element.appendChild(this.watermark.element)}!this.isEmpty&&this.watermark&&(this.watermark.element.remove(),(n=(e=this.watermark).dispose)===null||n===void 0||n.call(e),this.watermark=void 0)}canDisplayOverlay(e,n,s){const l=new Dv(e,s,n,Hn,this.accessor.getPanel(this.id));return this._onUnhandledDragOverEvent.fire(l),l.isAccepted}handleDropEvent(e,n,s,l){if(this.locked==="no-drop-target")return;function a(){switch(e){case"header":return typeof l=="number"?"tab":"header_space";case"content":return"content"}}const c=typeof l=="number"?this.panels[l]:void 0,d=new Cv({nativeEvent:n,position:s,panel:c,getData:()=>Hn(),kind:a(),group:this.groupPanel,api:this._api});if(this._onWillDrop.fire(d),d.defaultPrevented)return;const h=Hn();if(h&&h.viewId===this.accessor.id){if(e==="content"&&h.groupId===this.id&&(s==="center"||h.panelId===null)||e==="header"&&h.groupId===this.id&&h.panelId===null)return;if(h.panelId===null){const{groupId:E}=h;this._onMove.fire({target:s,groupId:E,index:l});return}if(this.tabsContainer.indexOf(h.panelId)!==-1&&this.tabsContainer.size===1)return;const{groupId:w,panelId:v}=h;if(this.id===w&&!s&&this.tabsContainer.indexOf(v)===l)return;this._onMove.fire({target:s,groupId:h.groupId,itemId:h.panelId,index:l})}else this._onDidDrop.fire(new Uh({nativeEvent:n,position:s,panel:c,getData:()=>Hn(),group:this.groupPanel,api:this._api}))}updateDragAndDropState(){this.tabsContainer.updateDragAndDropState()}dispose(){var e,n,s;super.dispose(),(e=this.watermark)===null||e===void 0||e.element.remove(),(s=(n=this.watermark)===null||n===void 0?void 0:n.dispose)===null||s===void 0||s.call(n),this.watermark=void 0;for(const l of this.panels)l.dispose();this.tabsContainer.dispose(),this.contentContainer.dispose()}}class $h extends wv{constructor(e,n,s){super(e,n),this._onDidConstraintsChangeInternal=new U,this.onDidConstraintsChangeInternal=this._onDidConstraintsChangeInternal.event,this._onDidConstraintsChange=new U,this.onDidConstraintsChange=this._onDidConstraintsChange.event,this._onDidSizeChange=new U,this.onDidSizeChange=this._onDidSizeChange.event,this.addDisposables(this._onDidConstraintsChangeInternal,this._onDidConstraintsChange,this._onDidSizeChange),s&&this.initialize(s)}setConstraints(e){this._onDidConstraintsChangeInternal.fire(e)}setSize(e){this._onDidSizeChange.fire(e)}}class xv extends jh{get priority(){return this._priority}get snap(){return this._snap}get minimumWidth(){return this.__minimumWidth()}get minimumHeight(){return this.__minimumHeight()}get maximumHeight(){return this.__maximumHeight()}get maximumWidth(){return this.__maximumWidth()}__minimumWidth(){const e=typeof this._minimumWidth=="function"?this._minimumWidth():this._minimumWidth;return e!==this._evaluatedMinimumWidth&&(this._evaluatedMinimumWidth=e,this.updateConstraints()),e}__maximumWidth(){const e=typeof this._maximumWidth=="function"?this._maximumWidth():this._maximumWidth;return e!==this._evaluatedMaximumWidth&&(this._evaluatedMaximumWidth=e,this.updateConstraints()),e}__minimumHeight(){const e=typeof this._minimumHeight=="function"?this._minimumHeight():this._minimumHeight;return e!==this._evaluatedMinimumHeight&&(this._evaluatedMinimumHeight=e,this.updateConstraints()),e}__maximumHeight(){const e=typeof this._maximumHeight=="function"?this._maximumHeight():this._maximumHeight;return e!==this._evaluatedMaximumHeight&&(this._evaluatedMaximumHeight=e,this.updateConstraints()),e}get isActive(){return this.api.isActive}get isVisible(){return this.api.isVisible}constructor(e,n,s,l){super(e,n,l??new $h(e,n)),this._evaluatedMinimumWidth=0,this._evaluatedMaximumWidth=Number.MAX_SAFE_INTEGER,this._evaluatedMinimumHeight=0,this._evaluatedMaximumHeight=Number.MAX_SAFE_INTEGER,this._minimumWidth=0,this._minimumHeight=0,this._maximumWidth=Number.MAX_SAFE_INTEGER,this._maximumHeight=Number.MAX_SAFE_INTEGER,this._snap=!1,this._onDidChange=new U,this.onDidChange=this._onDidChange.event,typeof(s==null?void 0:s.minimumWidth)=="number"&&(this._minimumWidth=s.minimumWidth),typeof(s==null?void 0:s.maximumWidth)=="number"&&(this._maximumWidth=s.maximumWidth),typeof(s==null?void 0:s.minimumHeight)=="number"&&(this._minimumHeight=s.minimumHeight),typeof(s==null?void 0:s.maximumHeight)=="number"&&(this._maximumHeight=s.maximumHeight),this.api.initialize(this),this.addDisposables(this.api.onWillVisibilityChange(a=>{const{isVisible:c}=a,{accessor:d}=this._params;d.setVisible(this,c)}),this.api.onActiveChange(()=>{const{accessor:a}=this._params;a.doSetGroupActive(this)}),this.api.onDidConstraintsChangeInternal(a=>{(typeof a.minimumWidth=="number"||typeof a.minimumWidth=="function")&&(this._minimumWidth=a.minimumWidth),(typeof a.minimumHeight=="number"||typeof a.minimumHeight=="function")&&(this._minimumHeight=a.minimumHeight),(typeof a.maximumWidth=="number"||typeof a.maximumWidth=="function")&&(this._maximumWidth=a.maximumWidth),(typeof a.maximumHeight=="number"||typeof a.maximumHeight=="function")&&(this._maximumHeight=a.maximumHeight)}),this.api.onDidSizeChange(a=>{this._onDidChange.fire({height:a.height,width:a.width})}),this._onDidChange)}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}init(e){e.maximumHeight&&(this._maximumHeight=e.maximumHeight),e.minimumHeight&&(this._minimumHeight=e.minimumHeight),e.maximumWidth&&(this._maximumWidth=e.maximumWidth),e.minimumWidth&&(this._minimumWidth=e.minimumWidth),this._priority=e.priority,this._snap=!!e.snap,super.init(e),typeof e.isVisible=="boolean"&&this.setVisible(e.isVisible)}updateConstraints(){this.api._onDidConstraintsChange.fire({minimumWidth:this._evaluatedMinimumWidth,maximumWidth:this._evaluatedMaximumWidth,minimumHeight:this._evaluatedMinimumHeight,maximumHeight:this._evaluatedMaximumHeight})}toJSON(){const e=super.toJSON(),n=l=>l===Number.MAX_SAFE_INTEGER?void 0:l,s=l=>l<=0?void 0:l;return Object.assign(Object.assign({},e),{minimumHeight:s(this.minimumHeight),maximumHeight:n(this.maximumHeight),minimumWidth:s(this.minimumWidth),maximumWidth:n(this.maximumWidth),snap:this.snap,priority:this.priority})}}const Rl="dockview: DockviewGroupPanelApiImpl not initialized";class pS extends $h{get location(){if(!this._group)throw new Error(Rl);return this._group.model.location}constructor(e,n){super(e,"__dockviewgroup__"),this.accessor=n,this._onDidLocationChange=new U,this.onDidLocationChange=this._onDidLocationChange.event,this._onDidActivePanelChange=new U,this.onDidActivePanelChange=this._onDidActivePanelChange.event,this.addDisposables(this._onDidLocationChange,this._onDidActivePanelChange,this._onDidVisibilityChange.event(s=>{s.isVisible&&this._pendingSize&&(super.setSize(this._pendingSize),this._pendingSize=void 0)}))}setSize(e){this._pendingSize=Object.assign({},e),super.setSize(e)}close(){if(this._group)return this.accessor.removeGroup(this._group)}getWindow(){return this.location.type==="popout"?this.location.getWindow():window}moveTo(e){var n,s,l,a;if(!this._group)throw new Error(Rl);const c=(n=e.group)!==null&&n!==void 0?n:this.accessor.addGroup({direction:Hy((s=e.position)!==null&&s!==void 0?s:"right"),skipSetActive:(l=e.skipSetActive)!==null&&l!==void 0?l:!1});this.accessor.moveGroupOrPanel({from:{groupId:this._group.id},to:{group:c,position:e.group&&(a=e.position)!==null&&a!==void 0?a:"center",index:e.index},skipSetActive:e.skipSetActive})}maximize(){if(!this._group)throw new Error(Rl);this.location.type==="grid"&&this.accessor.maximizeGroup(this._group)}isMaximized(){if(!this._group)throw new Error(Rl);return this.accessor.isMaximizedGroup(this._group)}exitMaximized(){if(!this._group)throw new Error(Rl);this.isMaximized()&&this.accessor.exitMaximizedGroup()}initialize(e){this._group=e}}const mS=100,gS=100;class km extends xv{get minimumWidth(){var e;if(typeof this._explicitConstraints.minimumWidth=="number")return this._explicitConstraints.minimumWidth;const n=(e=this.activePanel)===null||e===void 0?void 0:e.minimumWidth;return typeof n=="number"?n:super.__minimumWidth()}get minimumHeight(){var e;if(typeof this._explicitConstraints.minimumHeight=="number")return this._explicitConstraints.minimumHeight;const n=(e=this.activePanel)===null||e===void 0?void 0:e.minimumHeight;return typeof n=="number"?n:super.__minimumHeight()}get maximumWidth(){var e;if(typeof this._explicitConstraints.maximumWidth=="number")return this._explicitConstraints.maximumWidth;const n=(e=this.activePanel)===null||e===void 0?void 0:e.maximumWidth;return typeof n=="number"?n:super.__maximumWidth()}get maximumHeight(){var e;if(typeof this._explicitConstraints.maximumHeight=="number")return this._explicitConstraints.maximumHeight;const n=(e=this.activePanel)===null||e===void 0?void 0:e.maximumHeight;return typeof n=="number"?n:super.__maximumHeight()}get panels(){return this._model.panels}get activePanel(){return this._model.activePanel}get size(){return this._model.size}get model(){return this._model}get locked(){return this._model.locked}set locked(e){this._model.locked=e}get header(){return this._model.header}constructor(e,n,s){var l,a,c,d,h,m;super(n,"groupview_default",{minimumHeight:(a=(l=s.constraints)===null||l===void 0?void 0:l.minimumHeight)!==null&&a!==void 0?a:gS,minimumWidth:(d=(c=s.constraints)===null||c===void 0?void 0:c.minimumWidth)!==null&&d!==void 0?d:mS,maximumHeight:(h=s.constraints)===null||h===void 0?void 0:h.maximumHeight,maximumWidth:(m=s.constraints)===null||m===void 0?void 0:m.maximumWidth},new pS(n,e)),this._explicitConstraints={},this.api.initialize(this),this._model=new fS(this.element,e,n,s,this),this.addDisposables(this.model.onDidActivePanelChange(w=>{this.api._onDidActivePanelChange.fire(w)}),this.api.onDidConstraintsChangeInternal(w=>{w.minimumWidth!==void 0&&(this._explicitConstraints.minimumWidth=typeof w.minimumWidth=="function"?w.minimumWidth():w.minimumWidth),w.minimumHeight!==void 0&&(this._explicitConstraints.minimumHeight=typeof w.minimumHeight=="function"?w.minimumHeight():w.minimumHeight),w.maximumWidth!==void 0&&(this._explicitConstraints.maximumWidth=typeof w.maximumWidth=="function"?w.maximumWidth():w.maximumWidth),w.maximumHeight!==void 0&&(this._explicitConstraints.maximumHeight=typeof w.maximumHeight=="function"?w.maximumHeight():w.maximumHeight)}))}focus(){this.api.isActive||this.api.setActive(),super.focus()}initialize(){this._model.initialize()}setActive(e){super.setActive(e),this.model.setActive(e)}layout(e,n){super.layout(e,n),this.model.layout(e,n)}getComponent(){return this._model}toJSON(){return this.model.toJSON()}}const vS={className:"dockview-theme-abyss"};class wS extends $h{get location(){return this.group.api.location}get title(){return this.panel.title}get isGroupActive(){return this.group.isActive}get renderer(){return this.panel.renderer}set group(e){const n=this._group;this._group!==e&&(this._group=e,this._onDidGroupChange.fire({}),this.setupGroupEventListeners(n),this._onDidLocationChange.fire({location:this.group.api.location}))}get group(){return this._group}get tabComponent(){return this._tabComponent}constructor(e,n,s,l,a){super(e.id,l),this.panel=e,this.accessor=s,this._onDidTitleChange=new U,this.onDidTitleChange=this._onDidTitleChange.event,this._onDidActiveGroupChange=new U,this.onDidActiveGroupChange=this._onDidActiveGroupChange.event,this._onDidGroupChange=new U,this.onDidGroupChange=this._onDidGroupChange.event,this._onDidRendererChange=new U,this.onDidRendererChange=this._onDidRendererChange.event,this._onDidLocationChange=new U,this.onDidLocationChange=this._onDidLocationChange.event,this.groupEventsDisposable=new Bn,this._tabComponent=a,this.initialize(e),this._group=n,this.setupGroupEventListeners(),this.addDisposables(this.groupEventsDisposable,this._onDidRendererChange,this._onDidTitleChange,this._onDidGroupChange,this._onDidActiveGroupChange,this._onDidLocationChange)}getWindow(){return this.group.api.getWindow()}moveTo(e){var n,s;this.accessor.moveGroupOrPanel({from:{groupId:this._group.id,panelId:this.panel.id},to:{group:(n=e.group)!==null&&n!==void 0?n:this._group,position:e.group&&(s=e.position)!==null&&s!==void 0?s:"center",index:e.index},skipSetActive:e.skipSetActive})}setTitle(e){this.panel.setTitle(e)}setRenderer(e){this.panel.setRenderer(e)}close(){this.group.model.closePanel(this.panel)}maximize(){this.group.api.maximize()}isMaximized(){return this.group.api.isMaximized()}exitMaximized(){this.group.api.exitMaximized()}setupGroupEventListeners(e){var n;let s=(n=e==null?void 0:e.isActive)!==null&&n!==void 0?n:!1;this.groupEventsDisposable.value=new Re(this.group.api.onDidVisibilityChange(l=>{const a=!l.isVisible&&this.isVisible,c=l.isVisible&&!this.isVisible,d=this.group.model.isPanelActive(this.panel);(a||c&&d)&&this._onDidVisibilityChange.fire(l)}),this.group.api.onDidLocationChange(l=>{this.group===this.panel.group&&this._onDidLocationChange.fire(l)}),this.group.api.onDidActiveChange(()=>{this.group===this.panel.group&&s!==this.isGroupActive&&(s=this.isGroupActive,this._onDidActiveGroupChange.fire({isActive:this.isGroupActive}))}))}}class Lo extends Re{get params(){return this._params}get title(){return this._title}get group(){return this._group}get renderer(){var e;return(e=this._renderer)!==null&&e!==void 0?e:this.accessor.renderer}get minimumWidth(){return this._minimumWidth}get minimumHeight(){return this._minimumHeight}get maximumWidth(){return this._maximumWidth}get maximumHeight(){return this._maximumHeight}constructor(e,n,s,l,a,c,d,h){super(),this.id=e,this.accessor=l,this.containerApi=a,this.view=d,this._renderer=h.renderer,this._group=c,this._minimumWidth=h.minimumWidth,this._minimumHeight=h.minimumHeight,this._maximumWidth=h.maximumWidth,this._maximumHeight=h.maximumHeight,this.api=new wS(this,this._group,l,n,s),this.addDisposables(this.api.onActiveChange(()=>{l.setActivePanel(this)}),this.api.onDidSizeChange(m=>{this.group.api.setSize(m)}),this.api.onDidRendererChange(()=>{this.group.model.rerender(this)}))}init(e){this._params=e.params,this.view.init(Object.assign(Object.assign({},e),{api:this.api,containerApi:this.containerApi})),this.setTitle(e.title)}focus(){const e=new vv;this.api._onWillFocus.fire(e),!e.defaultPrevented&&(this.api.isActive||this.api.setActive())}toJSON(){return{id:this.id,contentComponent:this.view.contentComponent,tabComponent:this.view.tabComponent,params:Object.keys(this._params||{}).length>0?this._params:void 0,title:this.title,renderer:this._renderer,minimumHeight:this._minimumHeight,maximumHeight:this._maximumHeight,minimumWidth:this._minimumWidth,maximumWidth:this._maximumWidth}}setTitle(e){e!==this.title&&(this._title=e,this.api._onDidTitleChange.fire({title:e}))}setRenderer(e){e!==this.renderer&&(this._renderer=e,this.api._onDidRendererChange.fire({renderer:e}))}update(e){var n;this._params=Object.assign(Object.assign({},(n=this._params)!==null&&n!==void 0?n:{}),e.params);for(const s of Object.keys(e.params))e.params[s]===void 0&&delete this._params[s];this.view.update({params:this._params})}updateFromStateModel(e){var n,s,l;this._maximumHeight=e.maximumHeight,this._minimumHeight=e.minimumHeight,this._maximumWidth=e.maximumWidth,this._minimumWidth=e.minimumWidth,this.update({params:(n=e.params)!==null&&n!==void 0?n:{}}),this.setTitle((s=e.title)!==null&&s!==void 0?s:this.id),this.setRenderer((l=e.renderer)!==null&&l!==void 0?l:this.accessor.renderer)}updateParentGroup(e,n){this._group=e,this.api.group=this._group;const s=this._group.model.isPanelActive(this),l=this.group.api.isActive&&s;n!=null&&n.skipSetActive||this.api.isActive!==l&&this.api._onDidActiveChange.fire({isActive:this.group.api.isActive&&s}),this.api.isVisible!==s&&this.api._onDidVisibilityChange.fire({isVisible:s})}runEvents(){const e=this._group.model.isPanelActive(this),n=this.group.api.isActive&&e;this.api.isActive!==n&&this.api._onDidActiveChange.fire({isActive:this.group.api.isActive&&e}),this.api.isVisible!==e&&this.api._onDidVisibilityChange.fire({isVisible:e})}layout(e,n){this.api._onDidDimensionChange.fire({width:e,height:n}),this.view.layout(e,n)}dispose(){this.api.dispose(),this.view.dispose()}}class Om extends Re{get element(){return this._element}constructor(){super(),this._element=document.createElement("div"),this._element.className="dv-default-tab",this._content=document.createElement("div"),this._content.className="dv-default-tab-content",this.action=document.createElement("div"),this.action.className="dv-default-tab-action",this.action.appendChild(rS()),this._element.appendChild(this._content),this._element.appendChild(this.action),this.render()}init(e){this._title=e.title,this.addDisposables(e.api.onDidTitleChange(n=>{this._title=n.title,this.render()}),Be(this.action,"pointerdown",n=>{n.preventDefault()}),Be(this.action,"click",n=>{n.defaultPrevented||(n.preventDefault(),e.api.close())})),this.render()}render(){var e;this._content.textContent!==this._title&&(this._content.textContent=(e=this._title)!==null&&e!==void 0?e:"")}}class Ev{get content(){return this._content}get tab(){return this._tab}constructor(e,n,s,l){this.accessor=e,this.id=n,this.contentComponent=s,this.tabComponent=l,this._content=this.createContentComponent(this.id,s),this._tab=this.createTabComponent(this.id,l)}createTabRenderer(e){var n;const s=this.createTabComponent(this.id,this.tabComponent);return this._params&&s.init(Object.assign(Object.assign({},this._params),{tabLocation:e})),this._updateEvent&&((n=s.update)===null||n===void 0||n.call(s,this._updateEvent)),s}init(e){this._params=e,this.content.init(e),this.tab.init(Object.assign(Object.assign({},e),{tabLocation:"header"}))}layout(e,n){var s,l;(l=(s=this.content).layout)===null||l===void 0||l.call(s,e,n)}update(e){var n,s,l,a;this._updateEvent=e,(s=(n=this.content).update)===null||s===void 0||s.call(n,e),(a=(l=this.tab).update)===null||a===void 0||a.call(l,e)}dispose(){var e,n,s,l;(n=(e=this.content).dispose)===null||n===void 0||n.call(e),(l=(s=this.tab).dispose)===null||l===void 0||l.call(s)}createContentComponent(e,n){return this.accessor.options.createComponent({id:e,name:n})}createTabComponent(e,n){const s=n??this.accessor.options.defaultTabComponent;if(s){if(this.accessor.options.createTabComponent){const l=this.accessor.options.createTabComponent({id:e,name:s});return l||new Om}console.warn(`dockview: tabComponent '${n}' was not found. falling back to the default tab.`)}return new Om}}class _S{constructor(e){this.accessor=e}fromJSON(e,n){var s,l;const a=e.id,c=e.params,d=e.title,h=e.view,m=h?h.content.id:(s=e.contentComponent)!==null&&s!==void 0?s:"unknown",w=h?(l=h.tab)===null||l===void 0?void 0:l.id:e.tabComponent,v=new Ev(this.accessor,a,m,w),S=new Lo(a,m,w,this.accessor,new Bu(this.accessor),n,v,{renderer:e.renderer,minimumWidth:e.minimumWidth,minimumHeight:e.minimumHeight,maximumWidth:e.maximumWidth,maximumHeight:e.maximumHeight});return S.init({title:d??a,params:c??{}}),S}}class yS extends Re{get element(){return this._element}constructor(){super(),this._element=document.createElement("div"),this._element.className="dv-watermark"}init(e){}}class SS{constructor(){this._orderedList=[]}push(e){this._orderedList=[...this._orderedList.filter(n=>n!==e),e],this.update()}destroy(e){this._orderedList=this._orderedList.filter(n=>n!==e),this.update()}update(){for(let e=0;e{let a=null;const c=Hu();s.value=new Re({dispose:()=>{c.release()}},Be(window,"pointermove",d=>{const h=this.options.container.getBoundingClientRect(),m=d.clientX-h.left,w=d.clientY-h.top;Ne(this._element,"dv-resize-container-dragging",!0);const v=this._element.getBoundingClientRect();a===null&&(a={x:d.clientX-v.left,y:d.clientY-v.top});const S=Math.max(0,this.getMinimumWidth(v.width)),E=Math.max(0,this.getMinimumHeight(v.height)),A=_t(w-a.y,-E,Math.max(0,h.height-v.height+E)),D=_t(a.y-w+h.height-v.height,-E,Math.max(0,h.height-v.height+E)),P=_t(m-a.x,-S,Math.max(0,h.width-v.width+S)),R=_t(a.x-m+h.width-v.width,-S,Math.max(0,h.width-v.width+S)),O={};A<=D?O.top=A:O.bottom=D,P<=R?O.left=P:O.right=R,this.setBounds(O)}),Be(window,"pointerup",()=>{Ne(this._element,"dv-resize-container-dragging",!1),s.dispose(),this._onDidChangeEnd.fire()}))};this.addDisposables(s,Be(e,"pointerdown",a=>{if(a.defaultPrevented){a.preventDefault();return}Pm(a)||l()}),Be(this.options.content,"pointerdown",a=>{a.defaultPrevented||Pm(a)||a.shiftKey&&l()}),Be(this.options.content,"pointerdown",()=>{yu.push(this._element)},!0)),n.inDragMode&&l()}setupResize(e){const n=document.createElement("div");n.className=`dv-resize-handle-${e}`,this._element.appendChild(n);const s=new Bn;this.addDisposables(s,Be(n,"pointerdown",l=>{l.preventDefault();let a=null;const c=Hu();s.value=new Re(Be(window,"pointermove",d=>{const h=this.options.container.getBoundingClientRect(),m=this._element.getBoundingClientRect(),w=d.clientY-h.top,v=d.clientX-h.left;a===null&&(a={originalY:w,originalHeight:m.height,originalX:v,originalWidth:m.width});let S,E,A,D,P,R;const O=()=>{const $=a.originalY+a.originalHeight>h.height?Math.max(0,h.height-ys.MINIMUM_HEIGHT):Math.max(0,a.originalY+a.originalHeight-ys.MINIMUM_HEIGHT);S=_t(w,0,$),A=a.originalY+a.originalHeight-S,E=h.height-S-A},M=()=>{S=a.originalY-a.originalHeight;const $=S<0&&typeof this.options.minimumInViewportHeight=="number"?-S+this.options.minimumInViewportHeight:ys.MINIMUM_HEIGHT,K=h.height-Math.max(0,S);A=_t(w-S,$,K),E=h.height-S-A},N=()=>{const $=a.originalX+a.originalWidth>h.width?Math.max(0,h.width-ys.MINIMUM_WIDTH):Math.max(0,a.originalX+a.originalWidth-ys.MINIMUM_WIDTH);D=_t(v,0,$),R=a.originalX+a.originalWidth-D,P=h.width-D-R},Z=()=>{D=a.originalX-a.originalWidth;const $=D<0&&typeof this.options.minimumInViewportWidth=="number"?-D+this.options.minimumInViewportWidth:ys.MINIMUM_WIDTH,K=h.width-Math.max(0,D);R=_t(v-D,$,K),P=h.width-D-R};switch(e){case"top":O();break;case"bottom":M();break;case"left":N();break;case"right":Z();break;case"topleft":O(),N();break;case"topright":O(),Z();break;case"bottomleft":M(),N();break;case"bottomright":M(),Z();break}const G={};S<=E?G.top=S:G.bottom=E,D<=P?G.left=D:G.right=P,G.height=A,G.width=R,this.setBounds(G)}),{dispose:()=>{c.release()}},Be(window,"pointerup",()=>{s.dispose(),this._onDidChangeEnd.fire()}))}))}getMinimumWidth(e){return typeof this.options.minimumInViewportWidth=="number"?e-this.options.minimumInViewportWidth:0}getMinimumHeight(e){return typeof this.options.minimumInViewportHeight=="number"?e-this.options.minimumInViewportHeight:0}dispose(){yu.destroy(this._element),this._element.remove(),super.dispose()}}ys.MINIMUM_HEIGHT=20;ys.MINIMUM_WIDTH=20;class DS extends Re{constructor(e,n){super(),this.group=e,this.overlay=n,this.addDisposables(n)}position(e){this.overlay.setBounds(e)}}const Su=100,gr={left:100,top:100,width:300,height:300},CS=100;class xS{constructor(){this.cache=new Map,this.currentFrameId=0,this.rafId=null}getPosition(e){const n=this.cache.get(e);if(n&&n.frameId===this.currentFrameId)return n.rect;this.scheduleFrameUpdate();const s=ch(e);return this.cache.set(e,{rect:s,frameId:this.currentFrameId}),s}invalidate(){this.currentFrameId++}scheduleFrameUpdate(){this.rafId||(this.rafId=requestAnimationFrame(()=>{this.currentFrameId++,this.rafId=null}))}}function ES(){const r=document.createElement("div");return r.tabIndex=-1,r}class Tm extends Re{constructor(e,n){super(),this.element=e,this.accessor=n,this.map={},this._disposed=!1,this.positionCache=new xS,this.pendingUpdates=new Set,this.addDisposables(Qt.from(()=>{for(const s of Object.values(this.map))s.disposable.dispose(),s.destroy.dispose();this._disposed=!0}))}updateAllPositions(){if(!this._disposed){this.positionCache.invalidate();for(const e of Object.values(this.map))e.panel.api.isVisible&&e.resize&&e.resize()}}detatch(e){if(this.map[e.api.id]){const{disposable:n,destroy:s}=this.map[e.api.id];return n.dispose(),s.dispose(),delete this.map[e.api.id],!0}return!1}attach(e){const{panel:n,referenceContainer:s}=e;if(!this.map[n.api.id]){const w=ES();w.className="dv-render-overlay",this.map[n.api.id]={panel:n,disposable:Qt.NONE,destroy:Qt.NONE,element:w}}const l=this.map[n.api.id].element;n.view.content.element.parentElement!==l&&l.appendChild(n.view.content.element),l.parentElement!==this.element&&this.element.appendChild(l);const a=()=>{const w=n.api.id;this.pendingUpdates.has(w)||(this.pendingUpdates.add(w),requestAnimationFrame(()=>{if(this.pendingUpdates.delete(w),this.isDisposed||!this.map[w])return;const v=this.positionCache.getPosition(s.element),S=this.positionCache.getPosition(this.element),E=v.left-S.left,A=v.top-S.top,D=v.width,P=v.height;l.style.left=`${E}px`,l.style.top=`${A}px`,l.style.width=`${D}px`,l.style.height=`${P}px`,Ne(l,"dv-render-overlay-float",n.group.api.location.type==="floating")}))},c=()=>{n.api.isVisible&&(this.positionCache.invalidate(),a()),l.style.display=n.api.isVisible?"":"none"},d=new Bn,h=()=>{n.api.location.type==="floating"?queueMicrotask(()=>{const w=this.accessor.floatingGroups.find(A=>A.group===n.api.group);if(!w)return;const v=w.overlay.element,S=()=>{const A=Number(v.getAttribute("aria-level"));l.style.zIndex=`calc(var(--dv-overlay-z-index, 999) + ${A*2+1})`},E=new MutationObserver(()=>{S()});d.value=Qt.from(()=>E.disconnect()),E.observe(v,{attributeFilter:["aria-level"],attributes:!0}),S()}):l.style.zIndex=""},m=new Re(d,new gv(l,{onDragEnd:w=>{s.dropTarget.dnd.onDragEnd(w)},onDragEnter:w=>{s.dropTarget.dnd.onDragEnter(w)},onDragLeave:w=>{s.dropTarget.dnd.onDragLeave(w)},onDrop:w=>{s.dropTarget.dnd.onDrop(w)},onDragOver:w=>{s.dropTarget.dnd.onDragOver(w)}}),n.api.onDidVisibilityChange(()=>{c()}),n.api.onDidDimensionsChange(()=>{n.api.isVisible&&a()}),n.api.onDidLocationChange(()=>{h()}));return this.map[n.api.id].destroy=Qt.from(()=>{var w;n.view.content.element.parentElement===l&&l.removeChild(n.view.content.element),(w=l.parentElement)===null||w===void 0||w.removeChild(l)}),h(),queueMicrotask(()=>{this.isDisposed||c()}),this.map[n.api.id].disposable.dispose(),this.map[n.api.id].disposable=m,this.map[n.api.id].resize=a,l}}var bS=function(r,e,n,s){function l(a){return a instanceof n?a:new n(function(c){c(a)})}return new(n||(n=Promise))(function(a,c){function d(w){try{m(s.next(w))}catch(v){c(v)}}function h(w){try{m(s.throw(w))}catch(v){c(v)}}function m(w){w.done?a(w.value):l(w.value).then(d,h)}m((s=s.apply(r,e||[])).next())})};class PS extends Re{get window(){var e,n;return(n=(e=this._window)===null||e===void 0?void 0:e.value)!==null&&n!==void 0?n:null}constructor(e,n,s){super(),this.target=e,this.className=n,this.options=s,this._onWillClose=new U,this.onWillClose=this._onWillClose.event,this._onDidClose=new U,this.onDidClose=this._onDidClose.event,this._window=null,this.addDisposables(this._onWillClose,this._onDidClose,{dispose:()=>{this.close()}})}dimensions(){if(!this._window)return null;const e=this._window.value.screenX,n=this._window.value.screenY,s=this._window.value.innerWidth,l=this._window.value.innerHeight;return{top:n,left:e,width:s,height:l}}close(){var e,n;this._window&&(this._onWillClose.fire(),(n=(e=this.options).onWillClose)===null||n===void 0||n.call(e,{id:this.target,window:this._window.value}),this._window.disposable.dispose(),this._window=null,this._onDidClose.fire())}open(){var e,n;return bS(this,void 0,void 0,function*(){if(this._window)throw new Error("instance of popout window is already open");const s=`${this.options.url}`,l=Object.entries({top:this.options.top,left:this.options.left,width:this.options.width,height:this.options.height}).map(([h,m])=>`${h}=${m}`).join(","),a=window.open(s,this.target,l);if(!a)return null;const c=new Re;this._window={value:a,disposable:c},c.addDisposables(Qt.from(()=>{a.close()}),Be(window,"beforeunload",()=>{this.close()}));const d=this.createPopoutWindowContainer();return this.className&&d.classList.add(this.className),(n=(e=this.options).onDidOpen)===null||n===void 0||n.call(e,{id:this.target,window:a}),new Promise((h,m)=>{a.addEventListener("unload",w=>{}),a.addEventListener("load",()=>{try{const w=a.document;w.title=document.title,w.body.appendChild(d),yy(w,window.document.styleSheets),Be(a,"beforeunload",()=>{this.close()}),h(d)}catch(w){m(w)}})})})}createPopoutWindowContainer(){const e=document.createElement("div");return e.classList.add("dv-popout-window"),e.id="dv-popout-window",e.style.position="absolute",e.style.width="100%",e.style.height="100%",e.style.top="0px",e.style.left="0px",e}}class AS extends Re{constructor(e){super(),this.accessor=e,this.init()}init(){const e=new Set,n=new Set;this.addDisposables(this.accessor.onDidAddPanel(s=>{if(e.has(s.api.id))throw new Error(`dockview: Invalid event sequence. [onDidAddPanel] called for panel ${s.api.id} but panel already exists`);e.add(s.api.id)}),this.accessor.onDidRemovePanel(s=>{if(e.has(s.api.id))e.delete(s.api.id);else throw new Error(`dockview: Invalid event sequence. [onDidRemovePanel] called for panel ${s.api.id} but panel does not exists`)}),this.accessor.onDidAddGroup(s=>{if(n.has(s.api.id))throw new Error(`dockview: Invalid event sequence. [onDidAddGroup] called for group ${s.api.id} but group already exists`);n.add(s.api.id)}),this.accessor.onDidRemoveGroup(s=>{if(n.has(s.api.id))n.delete(s.api.id);else throw new Error(`dockview: Invalid event sequence. [onDidRemoveGroup] called for group ${s.api.id} but group does not exists`)}))}}class zS extends Re{constructor(e){super(),this.root=e,this._active=null,this._activeDisposable=new Bn,this._element=document.createElement("div"),this._element.className="dv-popover-anchor",this._element.style.position="relative",this.root.prepend(this._element),this.addDisposables(Qt.from(()=>{this.close()}),this._activeDisposable)}openPopover(e,n){var s;this.close();const l=document.createElement("div");l.style.position="absolute",l.style.zIndex=(s=n.zIndex)!==null&&s!==void 0?s:"var(--dv-overlay-z-index)",l.appendChild(e);const a=this._element.getBoundingClientRect(),c=a.left,d=a.top;l.style.top=`${n.y-d}px`,l.style.left=`${n.x-c}px`,this._element.appendChild(l),this._active=l,this._activeDisposable.value=new Re(Be(window,"pointerdown",h=>{var m;const w=h.target;if(!(w instanceof HTMLElement))return;let v=w;for(;v&&v!==l;)v=(m=v==null?void 0:v.parentElement)!==null&&m!==void 0?m:null;v||this.close()})),requestAnimationFrame(()=>{Ay(l,this.root)})}close(){this._active&&(this._active.remove(),this._activeDisposable.dispose(),this._active=null)}}class Im extends Re{get disabled(){return this._disabled}set disabled(e){var n;this.disabled!==e&&(this._disabled=e,e&&((n=this.model)===null||n===void 0||n.clear()))}get model(){if(!this.disabled)return{clear:()=>{var e;this._model&&((e=this._model.root.parentElement)===null||e===void 0||e.removeChild(this._model.root)),this._model=void 0},exists:()=>!!this._model,getElements:(e,n)=>{const s=this._outline!==n;if(this._outline=n,this._model)return this._model.changed=s,this._model;const l=this.createContainer(),a=this.createAnchor();if(this._model={root:l,overlay:a,changed:s},l.appendChild(a),this.element.appendChild(l),(e==null?void 0:e.target)instanceof HTMLElement){const c=e.target.getBoundingClientRect(),d=this.element.getBoundingClientRect();a.style.left=`${c.left-d.left}px`,a.style.top=`${c.top-d.top}px`}return this._model}}}constructor(e,n){super(),this.element=e,this._disabled=!1,this._disabled=n.disabled,this.addDisposables(Qt.from(()=>{var s;(s=this.model)===null||s===void 0||s.clear()}))}createContainer(){const e=document.createElement("div");return e.className="dv-drop-target-container",e}createAnchor(){const e=document.createElement("div");return e.className="dv-drop-target-anchor",e.style.visibility="hidden",e}}const Nm={activationSize:{type:"pixels",value:10},size:{type:"pixels",value:20}};function Du(r){const e=r.from.activePanel;[...r.from.panels].map(s=>{const l=r.from.model.removePanel(s);return r.from.model.renderContainer.detatch(s),l}).forEach(s=>{r.to.model.openPanel(s,{skipSetActive:e!==s,skipSetGroupActive:!0})})}class kS extends fv{get orientation(){return this.gridview.orientation}get totalPanels(){return this.panels.length}get panels(){return this.groups.flatMap(e=>e.panels)}get options(){return this._options}get activePanel(){const e=this.activeGroup;if(e)return e.activePanel}get renderer(){var e;return(e=this.options.defaultRenderer)!==null&&e!==void 0?e:"onlyWhenVisible"}get api(){return this._api}get floatingGroups(){return this._floatingGroups}get popoutRestorationPromise(){return this._popoutRestorationPromise}constructor(e,n){var s,l,a;super(e,{proportionalLayout:!0,orientation:ze.HORIZONTAL,styles:n.hideBorders?{separatorBorder:"transparent"}:void 0,disableAutoResizing:n.disableAutoResizing,locked:n.locked,margin:(l=(s=n.theme)===null||s===void 0?void 0:s.gap)!==null&&l!==void 0?l:0,className:n.className}),this.nextGroupId=Wh(),this._deserializer=new _S(this),this._watermark=null,this._onWillDragPanel=new U,this.onWillDragPanel=this._onWillDragPanel.event,this._onWillDragGroup=new U,this.onWillDragGroup=this._onWillDragGroup.event,this._onDidDrop=new U,this.onDidDrop=this._onDidDrop.event,this._onWillDrop=new U,this.onWillDrop=this._onWillDrop.event,this._onWillShowOverlay=new U,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onUnhandledDragOverEvent=new U,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,this._onDidRemovePanel=new U,this.onDidRemovePanel=this._onDidRemovePanel.event,this._onDidAddPanel=new U,this.onDidAddPanel=this._onDidAddPanel.event,this._onDidPopoutGroupSizeChange=new U,this.onDidPopoutGroupSizeChange=this._onDidPopoutGroupSizeChange.event,this._onDidPopoutGroupPositionChange=new U,this.onDidPopoutGroupPositionChange=this._onDidPopoutGroupPositionChange.event,this._onDidOpenPopoutWindowFail=new U,this.onDidOpenPopoutWindowFail=this._onDidOpenPopoutWindowFail.event,this._onDidLayoutFromJSON=new U,this.onDidLayoutFromJSON=this._onDidLayoutFromJSON.event,this._onDidActivePanelChange=new U({replay:!0}),this.onDidActivePanelChange=this._onDidActivePanelChange.event,this._onDidMovePanel=new U,this.onDidMovePanel=this._onDidMovePanel.event,this._onDidMaximizedGroupChange=new U,this.onDidMaximizedGroupChange=this._onDidMaximizedGroupChange.event,this._floatingGroups=[],this._popoutGroups=[],this._popoutRestorationPromise=Promise.resolve(),this._onDidRemoveGroup=new U,this.onDidRemoveGroup=this._onDidRemoveGroup.event,this._onDidAddGroup=new U,this.onDidAddGroup=this._onDidAddGroup.event,this._onDidOptionsChange=new U,this.onDidOptionsChange=this._onDidOptionsChange.event,this._onDidActiveGroupChange=new U,this.onDidActiveGroupChange=this._onDidActiveGroupChange.event,this._moving=!1,this._options=n,this.popupService=new zS(this.element),this._themeClassnames=new nc(this.element),this._api=new Bu(this),this.rootDropTargetContainer=new Im(this.element,{disabled:!0}),this.overlayRenderContainer=new Tm(this.gridview.element,this),this._rootDropTarget=new rs(this.element,{className:"dv-drop-target-edge",canDisplayOverlay:(c,d)=>{const h=Hn();if(h)return h.viewId!==this.id?!1:d==="center"?this.gridview.length===0:!0;if(d==="center"&&this.gridview.length!==0)return!1;const m=new Dv(c,"edge",d,Hn);return this._onUnhandledDragOverEvent.fire(m),m.isAccepted},acceptedTargetZones:["top","bottom","left","right","center"],overlayModel:(a=n.rootOverlayModel)!==null&&a!==void 0?a:Nm,getOverrideTarget:()=>{var c;return(c=this.rootDropTargetContainer)===null||c===void 0?void 0:c.model}}),this.updateDropTargetModel(n),Ne(this.gridview.element,"dv-dockview",!0),Ne(this.element,"dv-debug",!!n.debug),this.updateTheme(),this.updateWatermark(),n.debug&&this.addDisposables(new AS(this)),this.addDisposables(this.rootDropTargetContainer,this.overlayRenderContainer,this._onWillDragPanel,this._onWillDragGroup,this._onWillShowOverlay,this._onDidActivePanelChange,this._onDidAddPanel,this._onDidRemovePanel,this._onDidLayoutFromJSON,this._onDidDrop,this._onWillDrop,this._onDidMovePanel,this._onDidMovePanel.event(()=>{this.debouncedUpdateAllPositions()}),this._onDidAddGroup,this._onDidRemoveGroup,this._onDidActiveGroupChange,this._onUnhandledDragOverEvent,this._onDidMaximizedGroupChange,this._onDidOptionsChange,this._onDidPopoutGroupSizeChange,this._onDidPopoutGroupPositionChange,this._onDidOpenPopoutWindowFail,this.onDidViewVisibilityChangeMicroTaskQueue(()=>{this.updateWatermark()}),this.onDidAdd(c=>{this._moving||this._onDidAddGroup.fire(c)}),this.onDidRemove(c=>{this._moving||this._onDidRemoveGroup.fire(c)}),this.onDidActiveChange(c=>{this._moving||this._onDidActiveGroupChange.fire(c)}),this.onDidMaximizedChange(c=>{this._onDidMaximizedGroupChange.fire({group:c.panel,isMaximized:c.isMaximized})}),Jr.any(this.onDidAdd,this.onDidRemove)(()=>{this.updateWatermark()}),Jr.any(this.onDidAddPanel,this.onDidRemovePanel,this.onDidAddGroup,this.onDidRemove,this.onDidMovePanel,this.onDidActivePanelChange,this.onDidPopoutGroupPositionChange,this.onDidPopoutGroupSizeChange)(()=>{this._bufferOnDidLayoutChange.fire()}),Qt.from(()=>{for(const c of[...this._floatingGroups])c.dispose();for(const c of[...this._popoutGroups])c.disposable.dispose()}),this._rootDropTarget,this._rootDropTarget.onWillShowOverlay(c=>{this.gridview.length>0&&c.position==="center"||this._onWillShowOverlay.fire(new ic(c,{kind:"edge",panel:void 0,api:this._api,group:void 0,getData:Hn}))}),this._rootDropTarget.onDrop(c=>{var d;const h=new Cv({nativeEvent:c.nativeEvent,position:c.position,panel:void 0,api:this._api,group:void 0,getData:Hn,kind:"edge"});if(this._onWillDrop.fire(h),h.defaultPrevented)return;const m=Hn();m?this.moveGroupOrPanel({from:{groupId:m.groupId,panelId:(d=m.panelId)!==null&&d!==void 0?d:void 0},to:{group:this.orthogonalize(c.position),position:"center"}}):this._onDidDrop.fire(new Uh({nativeEvent:c.nativeEvent,position:c.position,panel:void 0,api:this._api,group:void 0,getData:Hn}))}),this._rootDropTarget)}setVisible(e,n){switch(e.api.location.type){case"grid":super.setVisible(e,n);break;case"floating":{const s=this.floatingGroups.find(l=>l.group===e);s&&(s.overlay.setVisible(n),e.api._onDidVisibilityChange.fire({isVisible:n}));break}case"popout":console.warn("dockview: You cannot hide a group that is in a popout window");break}}addPopoutGroup(e,n){var s,l,a,c,d;if(e instanceof Lo&&e.group.size===1)return this.addPopoutGroup(e.group,n);const h=xy(this.gridview.element),m=this.element;function w(){return n!=null&&n.position?n.position:e instanceof km?e.element.getBoundingClientRect():e.group?e.group.element.getBoundingClientRect():m.getBoundingClientRect()}const v=w(),S=(l=(s=n==null?void 0:n.overridePopoutGroup)===null||s===void 0?void 0:s.id)!==null&&l!==void 0?l:this.getNextGroupId(),E=new PS(`${this.id}-${S}`,h??"",{url:(d=(a=n==null?void 0:n.popoutUrl)!==null&&a!==void 0?a:(c=this.options)===null||c===void 0?void 0:c.popoutUrl)!==null&&d!==void 0?d:"/popout.html",left:window.screenX+v.left,top:window.screenY+v.top,width:v.width,height:v.height,onDidOpen:n==null?void 0:n.onDidOpen,onWillClose:n==null?void 0:n.onWillClose}),A=new Re(E,E.onDidClose(()=>{A.dispose()}));return E.open().then(D=>{var P;if(E.isDisposed)return!1;const R=n!=null&&n.referenceGroup?n.referenceGroup:e instanceof Lo?e.group:e,O=e.api.location.type,M=R.element.parentElement!==null;let N;if(M?n!=null&&n.overridePopoutGroup?N=n.overridePopoutGroup:(N=this.createGroup({id:S}),D&&this._onDidAddGroup.fire(N)):N=R,D===null)return console.error("dockview: failed to create popout. perhaps you need to allow pop-ups for this website"),A.dispose(),this._onDidOpenPopoutWindowFail.fire(),this.movingLock(()=>Du({from:N,to:R})),R.api.isVisible||R.api.setVisible(!0),!1;const Z=document.createElement("div");Z.className="dv-overlay-render-container";const G=new Tm(Z,this);N.model.renderContainer=G,N.layout(E.window.innerWidth,E.window.innerHeight);let $;if(!(n!=null&&n.overridePopoutGroup)&&M)if(e instanceof Lo)this.movingLock(()=>{const ce=R.model.removePanel(e);N.model.openPanel(ce)});else switch(this.movingLock(()=>Du({from:R,to:N})),O){case"grid":R.api.setVisible(!1);break;case"floating":case"popout":$=(P=this._floatingGroups.find(ce=>ce.group.api.id===e.api.id))===null||P===void 0?void 0:P.overlay.toJSON(),this.removeGroup(R);break}D.classList.add("dv-dockview"),D.style.overflow="hidden",D.appendChild(Z),D.appendChild(N.element);const K=document.createElement("div"),he=new Im(K,{disabled:this.rootDropTargetContainer.disabled});D.appendChild(K),N.model.dropTargetContainer=he,N.model.location={type:"popout",getWindow:()=>E.window,popoutUrl:n==null?void 0:n.popoutUrl},M&&e.api.location.type==="grid"&&e.api.setVisible(!1),this.doSetGroupAndPanelActive(N),A.addDisposables(N.api.onDidActiveChange(ce=>{var j;ce.isActive&&((j=E.window)===null||j===void 0||j.focus())}),N.api.onWillFocus(()=>{var ce;(ce=E.window)===null||ce===void 0||ce.focus()}));let ue;const Q=M&&R&&this.getPanel(R.id),ve={window:E,popoutGroup:N,referenceGroup:Q?R.id:void 0,disposable:{dispose:()=>(A.dispose(),ue)}},ie=by(E.window);return A.addDisposables(ie,Py(E.window,()=>{this._onDidPopoutGroupSizeChange.fire({width:E.window.innerWidth,height:E.window.innerHeight,group:N})}),ie.event(()=>{this._onDidPopoutGroupPositionChange.fire({screenX:E.window.screenX,screenY:E.window.screenX,group:N})}),Be(E.window,"resize",()=>{N.layout(E.window.innerWidth,E.window.innerHeight)}),G,Qt.from(()=>{if(!this.isDisposed){if(M&&this.getPanel(R.id))this.movingLock(()=>Du({from:N,to:R})),R.api.isVisible||R.api.setVisible(!0),this.getPanel(N.id)&&this.doRemoveGroup(N,{skipPopoutAssociated:!0});else if(this.getPanel(N.id)){if(N.model.renderContainer=this.overlayRenderContainer,N.model.dropTargetContainer=this.rootDropTargetContainer,ue=N,!this._popoutGroups.find(j=>j.popoutGroup===N))return;$?this.addFloatingGroup(N,{height:$.height,width:$.width,position:$}):(this.doRemoveGroup(N,{skipDispose:!0,skipActive:!0,skipPopoutReturn:!0}),N.model.location={type:"grid"},this.movingLock(()=>{this.doAddGroup(N,[0])})),this.doSetGroupAndPanelActive(N)}}})),this._popoutGroups.push(ve),this.updateWatermark(),!0}).catch(D=>(console.error("dockview: failed to create popout.",D),!1))}addFloatingGroup(e,n){var s,l,a,c,d;let h;if(e instanceof Lo)h=this.createGroup(),this._onDidAddGroup.fire(h),this.movingLock(()=>this.removePanel(e,{removeEmptyGroup:!0,skipDispose:!0,skipSetActiveGroup:!0})),this.movingLock(()=>h.model.openPanel(e,{skipSetGroupActive:!0}));else{h=e;const D=(s=this._popoutGroups.find(O=>O.popoutGroup===h))===null||s===void 0?void 0:s.referenceGroup,P=D?this.getPanel(D):void 0;typeof(n==null?void 0:n.skipRemoveGroup)=="boolean"&&n.skipRemoveGroup||(P?(this.movingLock(()=>Du({from:e,to:P})),this.doRemoveGroup(e,{skipPopoutReturn:!0,skipPopoutAssociated:!0}),this.doRemoveGroup(P,{skipDispose:!0}),h=P):this.doRemoveGroup(e,{skipDispose:!0,skipPopoutReturn:!0,skipPopoutAssociated:!1}))}function m(){if(n!=null&&n.position){const D={};return"left"in n.position?D.left=Math.max(n.position.left,0):"right"in n.position?D.right=Math.max(n.position.right,0):D.left=gr.left,"top"in n.position?D.top=Math.max(n.position.top,0):"bottom"in n.position?D.bottom=Math.max(n.position.bottom,0):D.top=gr.top,typeof n.width=="number"?D.width=Math.max(n.width,0):D.width=gr.width,typeof n.height=="number"?D.height=Math.max(n.height,0):D.height=gr.height,D}return{left:typeof(n==null?void 0:n.x)=="number"?Math.max(n.x,0):gr.left,top:typeof(n==null?void 0:n.y)=="number"?Math.max(n.y,0):gr.top,width:typeof(n==null?void 0:n.width)=="number"?Math.max(n.width,0):gr.width,height:typeof(n==null?void 0:n.height)=="number"?Math.max(n.height,0):gr.height}}const w=m(),v=new ys(Object.assign(Object.assign({container:this.gridview.element,content:h.element},w),{minimumInViewportWidth:this.options.floatingGroupBounds==="boundedWithinViewport"?void 0:(a=(l=this.options.floatingGroupBounds)===null||l===void 0?void 0:l.minimumWidthWithinViewport)!==null&&a!==void 0?a:Su,minimumInViewportHeight:this.options.floatingGroupBounds==="boundedWithinViewport"?void 0:(d=(c=this.options.floatingGroupBounds)===null||c===void 0?void 0:c.minimumHeightWithinViewport)!==null&&d!==void 0?d:Su})),S=h.element.querySelector(".dv-void-container");if(!S)throw new Error("dockview: failed to find drag handle");v.setupDrag(S,{inDragMode:typeof(n==null?void 0:n.inDragMode)=="boolean"?n.inDragMode:!1});const E=new DS(h,v),A=new Re(h.api.onDidActiveChange(D=>{D.isActive&&v.bringToFront()}),ec(h.element,D=>{const{width:P,height:R}=D.contentRect;h.layout(P,R)}));E.addDisposables(v.onDidChange(()=>{h.layout(h.width,h.height)}),v.onDidChangeEnd(()=>{this._bufferOnDidLayoutChange.fire()}),h.onDidChange(D=>{v.setBounds({height:D==null?void 0:D.height,width:D==null?void 0:D.width})}),{dispose:()=>{A.dispose(),Bd(this._floatingGroups,E),h.model.location={type:"grid"},this.updateWatermark()}}),this._floatingGroups.push(E),h.model.location={type:"floating"},n!=null&&n.skipActiveGroup||this.doSetGroupAndPanelActive(h),this.updateWatermark()}orthogonalize(e,n){switch(this.gridview.normalize(),e){case"top":case"bottom":this.gridview.orientation===ze.HORIZONTAL&&this.gridview.insertOrthogonalSplitviewAtRoot();break;case"left":case"right":this.gridview.orientation===ze.VERTICAL&&this.gridview.insertOrthogonalSplitviewAtRoot();break}switch(e){case"top":case"left":case"center":return this.createGroupAtLocation([0],void 0,n);case"bottom":case"right":return this.createGroupAtLocation([this.gridview.length],void 0,n);default:throw new Error(`dockview: unsupported position ${e}`)}}updateOptions(e){var n,s;if(super.updateOptions(e),"floatingGroupBounds"in e)for(const c of this._floatingGroups){switch(e.floatingGroupBounds){case"boundedWithinViewport":c.overlay.minimumInViewportHeight=void 0,c.overlay.minimumInViewportWidth=void 0;break;case void 0:c.overlay.minimumInViewportHeight=Su,c.overlay.minimumInViewportWidth=Su;break;default:c.overlay.minimumInViewportHeight=(n=e.floatingGroupBounds)===null||n===void 0?void 0:n.minimumHeightWithinViewport,c.overlay.minimumInViewportWidth=(s=e.floatingGroupBounds)===null||s===void 0?void 0:s.minimumWidthWithinViewport}c.overlay.setBounds()}this.updateDropTargetModel(e);const l=this.options.disableDnd;this._options=Object.assign(Object.assign({},this.options),e);const a=this.options.disableDnd;l!==a&&this.updateDragAndDropState(),"theme"in e&&this.updateTheme(),this.layout(this.gridview.width,this.gridview.height,!0)}layout(e,n,s){if(super.layout(e,n,s),this._floatingGroups)for(const l of this._floatingGroups)l.overlay.setBounds()}updateDragAndDropState(){for(const e of this.groups)e.model.updateDragAndDropState()}focus(){var e;(e=this.activeGroup)===null||e===void 0||e.focus()}getGroupPanel(e){return this.panels.find(n=>n.id===e)}setActivePanel(e){e.group.model.openPanel(e),this.doSetGroupAndPanelActive(e.group)}moveToNext(e={}){var n;if(!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}if(e.includePanel&&e.group&&e.group.activePanel!==e.group.panels[e.group.panels.length-1]){e.group.model.moveToNext({suppressRoll:!0});return}const s=zt(e.group.element),l=(n=this.gridview.next(s))===null||n===void 0?void 0:n.view;this.doSetGroupAndPanelActive(l)}moveToPrevious(e={}){var n;if(!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}if(e.includePanel&&e.group&&e.group.activePanel!==e.group.panels[0]){e.group.model.moveToPrevious({suppressRoll:!0});return}const s=zt(e.group.element),l=(n=this.gridview.previous(s))===null||n===void 0?void 0:n.view;l&&this.doSetGroupAndPanelActive(l)}toJSON(){var e;const n=this.gridview.serialize(),s=this.panels.reduce((d,h)=>(d[h.id]=h.toJSON(),d),{}),l=this._floatingGroups.map(d=>({data:d.group.toJSON(),position:d.overlay.toJSON()})),a=this._popoutGroups.map(d=>({data:d.popoutGroup.toJSON(),gridReferenceGroup:d.referenceGroup,position:d.window.dimensions(),url:d.popoutGroup.api.location.type==="popout"?d.popoutGroup.api.location.popoutUrl:void 0})),c={grid:n,panels:s,activeGroup:(e=this.activeGroup)===null||e===void 0?void 0:e.id};return l.length>0&&(c.floatingGroups=l),a.length>0&&(c.popoutGroups=a),c}fromJSON(e,n){var s,l;const a=new Map;let c;if(n!=null&&n.reuseExistingPanels){c=this.createGroup(),this._groups.delete(c.api.id);const w=Object.keys(e.panels);for(const v of this.panels)w.includes(v.api.id)&&a.set(v.api.id,v);this.movingLock(()=>{Array.from(a.values()).forEach(v=>{this.moveGroupOrPanel({from:{groupId:v.api.group.api.id,panelId:v.api.id},to:{group:c,position:"center"},keepEmptyGroups:!0})})})}if(this.clear(),typeof e!="object"||e===null)throw new Error("dockview: serialized layout must be a non-null object");const{grid:d,panels:h,activeGroup:m}=e;if(d.root.type!=="branch"||!Array.isArray(d.root.data))throw new Error("dockview: root must be of type branch");try{const w=this.width,v=this.height,S=P=>{const{id:R,locked:O,hideHeader:M,views:N,activeView:Z}=P;if(typeof R!="string")throw new Error("dockview: group id must be of type string");const G=this.createGroup({id:R,locked:!!O,hideHeader:!!M});this._onDidAddGroup.fire(G);const $=[];for(const K of N){const he=a.get(K);if(c&&he)this.movingLock(()=>{c.model.removePanel(he)}),$.push(he),he.updateFromStateModel(h[K]);else{const ue=this._deserializer.fromJSON(h[K],G);$.push(ue)}}for(let K=0;K{G.model.openPanel(he,{skipSetActive:!ue,skipSetGroupActive:!0})}):G.model.openPanel(he,{skipSetActive:!ue,skipSetGroupActive:!0})}return!G.activePanel&&G.panels.length>0&&G.model.openPanel(G.panels[G.panels.length-1],{skipSetGroupActive:!0}),G};this.gridview.deserialize(d,{fromJSON:P=>S(P.data)}),this.layout(w,v,!0);const E=(s=e.floatingGroups)!==null&&s!==void 0?s:[];for(const P of E){const{data:R,position:O}=P,M=S(R);this.addFloatingGroup(M,{position:O,width:O.width,height:O.height,skipRemoveGroup:!0,inDragMode:!1})}const A=(l=e.popoutGroups)!==null&&l!==void 0?l:[],D=[];A.forEach((P,R)=>{const{data:O,position:M,gridReferenceGroup:N,url:Z}=P,G=S(O),$=new Promise(K=>{setTimeout(()=>{this.addPopoutGroup(G,{position:M??void 0,overridePopoutGroup:N?G:void 0,referenceGroup:N?this.getPanel(N):void 0,popoutUrl:Z}),K()},R*CS)});D.push($)}),this._popoutRestorationPromise=Promise.all(D).then(()=>{});for(const P of this._floatingGroups)P.overlay.setBounds();if(typeof m=="string"){const P=this.getPanel(m);P&&this.doSetGroupAndPanelActive(P)}}catch(w){console.error("dockview: failed to deserialize layout. Reverting changes",w);for(const v of this.groups)for(const S of v.panels)this.removePanel(S,{removeEmptyGroup:!1,skipDispose:!1});for(const v of this.groups)v.dispose(),this._groups.delete(v.id),this._onDidRemoveGroup.fire(v);for(const v of[...this._floatingGroups])v.dispose();throw this.clear(),w}this.updateWatermark(),this.debouncedUpdateAllPositions(),this._onDidLayoutFromJSON.fire()}clear(){const e=Array.from(this._groups.values()).map(s=>s.value),n=!!this.activeGroup;for(const s of e)this.removeGroup(s,{skipActive:!0});n&&this.doSetGroupAndPanelActive(void 0),this.gridview.clear()}closeAllGroups(){for(const e of this._groups.entries()){const[n,s]=e;s.value.model.closeAllPanels()}}addPanel(e){var n,s;if(this.panels.find(h=>h.id===e.id))throw new Error(`dockview: panel with id ${e.id} already exists`);let l;if(e.position&&e.floating)throw new Error("dockview: you can only provide one of: position, floating as arguments to .addPanel(...)");const a={width:e.initialWidth,height:e.initialHeight};let c;if(e.position)if(uS(e.position)){const h=typeof e.position.referencePanel=="string"?this.getGroupPanel(e.position.referencePanel):e.position.referencePanel;if(c=e.position.index,!h)throw new Error(`dockview: referencePanel '${e.position.referencePanel}' does not exist`);l=this.findGroup(h)}else if(cS(e.position)){if(l=typeof e.position.referenceGroup=="string"?(n=this._groups.get(e.position.referenceGroup))===null||n===void 0?void 0:n.value:e.position.referenceGroup,c=e.position.index,!l)throw new Error(`dockview: referenceGroup '${e.position.referenceGroup}' does not exist`)}else{const h=this.orthogonalize(zm(e.position.direction)),m=this.createPanel(e,h);return h.model.openPanel(m,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:c}),e.inactive||this.doSetGroupAndPanelActive(h),h.api.setSize({height:a==null?void 0:a.height,width:a==null?void 0:a.width}),m}else l=this.activeGroup;let d;if(l){const h=ju(((s=e.position)===null||s===void 0?void 0:s.direction)||"within");if(e.floating){const m=this.createGroup();this._onDidAddGroup.fire(m);const w=typeof e.floating=="object"&&e.floating!==null?e.floating:{};this.addFloatingGroup(m,Object.assign(Object.assign({},w),{inDragMode:!1,skipRemoveGroup:!0,skipActiveGroup:!0})),d=this.createPanel(e,m),m.model.openPanel(d,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:c})}else if(l.api.location.type==="floating"||h==="center")d=this.createPanel(e,l),l.model.openPanel(d,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:c}),l.api.setSize({width:a==null?void 0:a.width,height:a==null?void 0:a.height}),e.inactive||this.doSetGroupAndPanelActive(l);else{const m=zt(l.element),w=_s(this.gridview.orientation,m,h),v=this.createGroupAtLocation(w,this.orientationAtLocation(w)===ze.VERTICAL?a==null?void 0:a.height:a==null?void 0:a.width);d=this.createPanel(e,v),v.model.openPanel(d,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:c}),e.inactive||this.doSetGroupAndPanelActive(v)}}else if(e.floating){const h=this.createGroup();this._onDidAddGroup.fire(h);const m=typeof e.floating=="object"&&e.floating!==null?e.floating:{};this.addFloatingGroup(h,Object.assign(Object.assign({},m),{inDragMode:!1,skipRemoveGroup:!0,skipActiveGroup:!0})),d=this.createPanel(e,h),h.model.openPanel(d,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:c})}else{const h=this.createGroupAtLocation([0],this.gridview.orientation===ze.VERTICAL?a==null?void 0:a.height:a==null?void 0:a.width);d=this.createPanel(e,h),h.model.openPanel(d,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:c}),e.inactive||this.doSetGroupAndPanelActive(h)}return d}removePanel(e,n={removeEmptyGroup:!0}){const s=e.group;if(!s)throw new Error(`dockview: cannot remove panel ${e.id}. it's missing a group.`);s.model.removePanel(e,{skipSetActiveGroup:n.skipSetActiveGroup}),n.skipDispose||(e.group.model.renderContainer.detatch(e),e.dispose()),s.size===0&&n.removeEmptyGroup&&this.removeGroup(s,{skipActive:n.skipSetActiveGroup})}createWatermarkComponent(){return this.options.createWatermarkComponent?this.options.createWatermarkComponent():new yS}updateWatermark(){var e,n;if(this.groups.filter(s=>s.api.location.type==="grid"&&s.api.isVisible).length===0){if(!this._watermark){this._watermark=this.createWatermarkComponent(),this._watermark.init({containerApi:new Bu(this)});const s=document.createElement("div");s.className="dv-watermark-container",Dy(s,"watermark-component"),s.appendChild(this._watermark.element),this.gridview.element.appendChild(s)}}else this._watermark&&(this._watermark.element.parentElement.remove(),(n=(e=this._watermark).dispose)===null||n===void 0||n.call(e),this._watermark=null)}addGroup(e){var n;if(e){let s;if(dS(e)){const m=typeof e.referencePanel=="string"?this.panels.find(w=>w.id===e.referencePanel):e.referencePanel;if(!m)throw new Error(`dockview: reference panel ${e.referencePanel} does not exist`);if(s=this.findGroup(m),!s)throw new Error(`dockview: reference group for reference panel ${e.referencePanel} does not exist`)}else if(hS(e)){if(s=typeof e.referenceGroup=="string"?(n=this._groups.get(e.referenceGroup))===null||n===void 0?void 0:n.value:e.referenceGroup,!s)throw new Error(`dockview: reference group ${e.referenceGroup} does not exist`)}else{const m=this.orthogonalize(zm(e.direction),e);return e.skipSetActive||this.doSetGroupAndPanelActive(m),m}const l=ju(e.direction||"within"),a=zt(s.element),c=_s(this.gridview.orientation,a,l),d=this.createGroup(e),h=this.getLocationOrientation(c)===ze.VERTICAL?e.initialHeight:e.initialWidth;return this.doAddGroup(d,c,h),e.skipSetActive||this.doSetGroupAndPanelActive(d),d}else{const s=this.createGroup(e);return this.doAddGroup(s),this.doSetGroupAndPanelActive(s),s}}getLocationOrientation(e){return e.length%2==0&&this.gridview.orientation===ze.HORIZONTAL?ze.HORIZONTAL:ze.VERTICAL}removeGroup(e,n){this.doRemoveGroup(e,n)}doRemoveGroup(e,n){var s;const l=[...e.panels];if(!(n!=null&&n.skipDispose))for(const d of l)this.removePanel(d,{removeEmptyGroup:!1,skipDispose:(s=n==null?void 0:n.skipDispose)!==null&&s!==void 0?s:!1});const a=this.activePanel;if(e.api.location.type==="floating"){const d=this._floatingGroups.find(h=>h.group===e);if(d){if(n!=null&&n.skipDispose||(d.group.dispose(),this._groups.delete(e.id),this._onDidRemoveGroup.fire(e)),Bd(this._floatingGroups,d),d.dispose(),!(n!=null&&n.skipActive)&&this._activeGroup===e){const h=Array.from(this._groups.values());this.doSetGroupAndPanelActive(h.length>0?h[0].value:void 0)}return d.group}throw new Error("dockview: failed to find floating group")}if(e.api.location.type==="popout"){const d=this._popoutGroups.find(h=>h.popoutGroup===e);if(d){if(!(n!=null&&n.skipDispose)){if(!(n!=null&&n.skipPopoutAssociated)){const m=d.referenceGroup?this.getPanel(d.referenceGroup):void 0;m&&m.panels.length===0&&this.removeGroup(m)}d.popoutGroup.dispose(),this._groups.delete(e.id),this._onDidRemoveGroup.fire(e)}Bd(this._popoutGroups,d);const h=d.disposable.dispose();if(!(n!=null&&n.skipPopoutReturn)&&h&&(this.doAddGroup(h,[0]),this.doSetGroupAndPanelActive(h)),!(n!=null&&n.skipActive)&&this._activeGroup===e){const m=Array.from(this._groups.values());this.doSetGroupAndPanelActive(m.length>0?m[0].value:void 0)}return this.updateWatermark(),d.popoutGroup}throw new Error("dockview: failed to find popout group")}const c=super.doRemoveGroup(e,n);return n!=null&&n.skipActive||this.activePanel!==a&&this._onDidActivePanelChange.fire(this.activePanel),c}debouncedUpdateAllPositions(){this._updatePositionsFrameId!==void 0&&cancelAnimationFrame(this._updatePositionsFrameId),this._updatePositionsFrameId=requestAnimationFrame(()=>{this._updatePositionsFrameId=void 0,this.overlayRenderContainer.updateAllPositions()})}movingLock(e){const n=this._moving;try{return this._moving=!0,e()}finally{this._moving=n}}moveGroupOrPanel(e){var n;const s=e.to.group,l=e.from.groupId,a=e.from.panelId,c=e.to.position,d=e.to.index,h=l?(n=this._groups.get(l))===null||n===void 0?void 0:n.value:void 0;if(!h)throw new Error(`dockview: Failed to find group id ${l}`);if(a===void 0){this.moveGroup({from:{group:h},to:{group:s,position:c},skipSetActive:e.skipSetActive});return}if(!c||c==="center"){const m=this.movingLock(()=>h.model.removePanel(a,{skipSetActive:!1,skipSetActiveGroup:!0}));if(!m)throw new Error(`dockview: No panel with id ${a}`);!e.keepEmptyGroups&&h.model.size===0&&this.doRemoveGroup(h,{skipActive:!0});const w=s.model.size===0;this.movingLock(()=>{var v;return s.model.openPanel(m,{index:d,skipSetActive:((v=e.skipSetActive)!==null&&v!==void 0?v:!1)&&!w,skipSetGroupActive:!0})}),e.skipSetActive||this.doSetGroupAndPanelActive(s),this._onDidMovePanel.fire({panel:m,from:h})}else{const m=zt(s.element),w=_s(this.gridview.orientation,m,c);if(h.size<2){const[v,S]=Ms(w);if(h.api.location.type==="grid"){const P=zt(h.element),[R,O]=Ms(P);if(dv(R,v)){this.gridview.moveView(R,O,S),this._onDidMovePanel.fire({panel:this.getGroupPanel(a),from:h});return}}if(h.api.location.type==="popout"){const P=this._popoutGroups.find(M=>M.popoutGroup===h),R=this.movingLock(()=>P.popoutGroup.model.removePanel(P.popoutGroup.panels[0],{skipSetActive:!0,skipSetActiveGroup:!0}));this.doRemoveGroup(h,{skipActive:!0});const O=this.createGroupAtLocation(w);this.movingLock(()=>O.model.openPanel(R,{skipSetActive:!0})),this.doSetGroupAndPanelActive(O),this._onDidMovePanel.fire({panel:this.getGroupPanel(a),from:h});return}const E=this.movingLock(()=>this.doRemoveGroup(h,{skipActive:!0,skipDispose:!0})),A=zt(s.element),D=_s(this.gridview.orientation,A,c);this.movingLock(()=>this.doAddGroup(E,D)),this.doSetGroupAndPanelActive(E),this._onDidMovePanel.fire({panel:this.getGroupPanel(a),from:h})}else{const v=this.movingLock(()=>h.model.removePanel(a,{skipSetActive:!1,skipSetActiveGroup:!0}));if(!v)throw new Error(`dockview: No panel with id ${a}`);const S=_s(this.gridview.orientation,m,c),E=this.createGroupAtLocation(S);this.movingLock(()=>E.model.openPanel(v,{skipSetGroupActive:!0})),this.doSetGroupAndPanelActive(E),this._onDidMovePanel.fire({panel:v,from:h})}}}moveGroup(e){const n=e.from.group,s=e.to.group,l=e.to.position;if(l==="center"){const a=n.activePanel,c=this.movingLock(()=>[...n.panels].map(d=>n.model.removePanel(d.id,{skipSetActive:!0})));(n==null?void 0:n.model.size)===0&&this.doRemoveGroup(n,{skipActive:!0}),this.movingLock(()=>{for(const d of c)s.model.openPanel(d,{skipSetActive:d!==a,skipSetGroupActive:!0})}),e.skipSetActive!==!0?this.doSetGroupAndPanelActive(s):this.activePanel||this.doSetGroupAndPanelActive(s)}else{switch(n.api.location.type){case"grid":this.gridview.removeView(zt(n.element));break;case"floating":{const a=this._floatingGroups.find(c=>c.group===n);if(!a)throw new Error("dockview: failed to find floating group");a.dispose();break}case"popout":{const a=this._popoutGroups.find(d=>d.popoutGroup===n);if(!a)throw new Error("dockview: failed to find popout group");const c=this._popoutGroups.indexOf(a);if(c>=0&&this._popoutGroups.splice(c,1),a.referenceGroup){const d=this.getPanel(a.referenceGroup);d&&!d.api.isVisible&&this.doRemoveGroup(d,{skipActive:!0})}a.window.dispose(),s.api.location.type==="grid"?(n.model.renderContainer=this.overlayRenderContainer,n.model.dropTargetContainer=this.rootDropTargetContainer,n.model.location={type:"grid"}):s.api.location.type==="floating"&&(n.model.renderContainer=this.overlayRenderContainer,n.model.dropTargetContainer=this.rootDropTargetContainer,n.model.location={type:"floating"});break}}if(s.api.location.type==="grid"){const a=zt(s.element),c=_s(this.gridview.orientation,a,l);let d;switch(this.gridview.orientation){case ze.VERTICAL:d=a.length%2==0?n.api.width:n.api.height;break;case ze.HORIZONTAL:d=a.length%2==0?n.api.height:n.api.width;break}this.gridview.addView(n,d,c)}else if(s.api.location.type==="floating"){const a=this._floatingGroups.find(c=>c.group===s);if(a){const c=a.overlay.toJSON();let d,h;"left"in c?d=c.left+50:"right"in c?d=Math.max(0,c.right-c.width-50):d=50,"top"in c?h=c.top+50:"bottom"in c?h=Math.max(0,c.bottom-c.height-50):h=50,this.addFloatingGroup(n,{height:c.height,width:c.width,position:{left:d,top:h}})}}}if(n.panels.forEach(a=>{this._onDidMovePanel.fire({panel:a,from:n})}),this.debouncedUpdateAllPositions(),e.skipSetActive===!1){const a=s??n;this.doSetGroupAndPanelActive(a)}}doSetGroupActive(e){super.doSetGroupActive(e);const n=this.activePanel;!this._moving&&n!==this._onDidActivePanelChange.value&&this._onDidActivePanelChange.fire(n)}doSetGroupAndPanelActive(e){super.doSetGroupActive(e);const n=this.activePanel;e&&this.hasMaximizedGroup()&&!this.isMaximizedGroup(e)&&this.exitMaximizedGroup(),!this._moving&&n!==this._onDidActivePanelChange.value&&this._onDidActivePanelChange.fire(n)}getNextGroupId(){let e=this.nextGroupId.next();for(;this._groups.has(e);)e=this.nextGroupId.next();return e}createGroup(e){e||(e={});let n=e==null?void 0:e.id;if(n&&this._groups.has(e.id)&&(console.warn(`dockview: Duplicate group id ${e==null?void 0:e.id}. reassigning group id to avoid errors`),n=void 0),!n)for(n=this.nextGroupId.next();this._groups.has(n);)n=this.nextGroupId.next();const s=new km(this,n,e);if(s.init({params:{},accessor:this}),!this._groups.has(s.id)){const l=new Re(s.model.onTabDragStart(a=>{this._onWillDragPanel.fire(a)}),s.model.onGroupDragStart(a=>{this._onWillDragGroup.fire(a)}),s.model.onMove(a=>{const{groupId:c,itemId:d,target:h,index:m}=a;this.moveGroupOrPanel({from:{groupId:c,panelId:d},to:{group:s,position:h,index:m}})}),s.model.onDidDrop(a=>{this._onDidDrop.fire(a)}),s.model.onWillDrop(a=>{this._onWillDrop.fire(a)}),s.model.onWillShowOverlay(a=>{if(this.options.disableDnd){a.preventDefault();return}this._onWillShowOverlay.fire(a)}),s.model.onUnhandledDragOverEvent(a=>{this._onUnhandledDragOverEvent.fire(a)}),s.model.onDidAddPanel(a=>{this._moving||this._onDidAddPanel.fire(a.panel)}),s.model.onDidRemovePanel(a=>{this._moving||this._onDidRemovePanel.fire(a.panel)}),s.model.onDidActivePanelChange(a=>{this._moving||a.panel===this.activePanel&&this._onDidActivePanelChange.value!==a.panel&&this._onDidActivePanelChange.fire(a.panel)}),Jr.any(s.model.onDidPanelTitleChange,s.model.onDidPanelParametersChange)(()=>{this._bufferOnDidLayoutChange.fire()}));this._groups.set(s.id,{value:s,disposable:l})}return s.initialize(),s}createPanel(e,n){var s,l,a;const c=e.component,d=(s=e.tabComponent)!==null&&s!==void 0?s:this.options.defaultTabComponent,h=new Ev(this,e.id,c,d),m=new Lo(e.id,c,d,this,this._api,n,h,{renderer:e.renderer,minimumWidth:e.minimumWidth,minimumHeight:e.minimumHeight,maximumWidth:e.maximumWidth,maximumHeight:e.maximumHeight});return m.init({title:(l=e.title)!==null&&l!==void 0?l:e.id,params:(a=e==null?void 0:e.params)!==null&&a!==void 0?a:{}}),m}createGroupAtLocation(e,n,s){const l=this.createGroup(s);return this.doAddGroup(l,e,n),l}findGroup(e){var n;return(n=Array.from(this._groups.values()).find(s=>s.value.model.containsPanel(e)))===null||n===void 0?void 0:n.value}orientationAtLocation(e){const n=this.gridview.orientation;return e.length%2==1?n:Ss(n)}updateDropTargetModel(e){"dndEdges"in e&&(this._rootDropTarget.disabled=typeof e.dndEdges=="boolean"&&e.dndEdges===!1,typeof e.dndEdges=="object"&&e.dndEdges!==null?this._rootDropTarget.setOverlayModel(e.dndEdges):this._rootDropTarget.setOverlayModel(Nm)),"rootOverlayModel"in e&&this.updateDropTargetModel({dndEdges:e.dndEdges})}updateTheme(){var e,n;const s=(e=this._options.theme)!==null&&e!==void 0?e:vS;switch(this._themeClassnames.setClassNames(s.className),this.gridview.margin=(n=s.gap)!==null&&n!==void 0?n:0,s.dndOverlayMounting){case"absolute":this.rootDropTargetContainer.disabled=!1;break;case"relative":default:this.rootDropTargetContainer.disabled=!0;break}}}class OS extends fv{get orientation(){return this.gridview.orientation}set orientation(e){this.gridview.orientation=e}get options(){return this._options}get deserializer(){return this._deserializer}set deserializer(e){this._deserializer=e}constructor(e,n){var s;super(e,{proportionalLayout:(s=n.proportionalLayout)!==null&&s!==void 0?s:!0,orientation:n.orientation,styles:n.hideBorders?{separatorBorder:"transparent"}:void 0,disableAutoResizing:n.disableAutoResizing,className:n.className}),this._onDidLayoutfromJSON=new U,this.onDidLayoutFromJSON=this._onDidLayoutfromJSON.event,this._onDidRemoveGroup=new U,this.onDidRemoveGroup=this._onDidRemoveGroup.event,this._onDidAddGroup=new U,this.onDidAddGroup=this._onDidAddGroup.event,this._onDidActiveGroupChange=new U,this.onDidActiveGroupChange=this._onDidActiveGroupChange.event,this._options=n,this.addDisposables(this._onDidAddGroup,this._onDidRemoveGroup,this._onDidActiveGroupChange,this.onDidAdd(l=>{this._onDidAddGroup.fire(l)}),this.onDidRemove(l=>{this._onDidRemoveGroup.fire(l)}),this.onDidActiveChange(l=>{this._onDidActiveGroupChange.fire(l)}))}updateOptions(e){super.updateOptions(e);const n=typeof e.orientation=="string"&&this.gridview.orientation!==e.orientation;this._options=Object.assign(Object.assign({},this.options),e),n&&(this.gridview.orientation=e.orientation),this.layout(this.gridview.width,this.gridview.height,!0)}removePanel(e){this.removeGroup(e)}toJSON(){var e;return{grid:this.gridview.serialize(),activePanel:(e=this.activeGroup)===null||e===void 0?void 0:e.id}}setVisible(e,n){this.gridview.setViewVisible(zt(e.element),n)}setActive(e){this._groups.forEach((n,s)=>{n.value.setActive(e===n.value)})}focus(){var e;(e=this.activeGroup)===null||e===void 0||e.focus()}fromJSON(e){this.clear();const{grid:n,activePanel:s}=e;try{const l=[],a=this.width,c=this.height;if(this.gridview.deserialize(n,{fromJSON:d=>{const{data:h}=d,m=this.options.createComponent({id:h.id,name:h.component});return l.push(()=>m.init({params:h.params,minimumWidth:h.minimumWidth,maximumWidth:h.maximumWidth,minimumHeight:h.minimumHeight,maximumHeight:h.maximumHeight,priority:h.priority,snap:!!h.snap,accessor:this,isVisible:d.visible})),this._onDidAddGroup.fire(m),this.registerPanel(m),m}}),this.layout(a,c,!0),l.forEach(d=>d()),typeof s=="string"){const d=this.getPanel(s);d&&this.doSetGroupActive(d)}}catch(l){for(const a of this.groups)a.dispose(),this._groups.delete(a.id),this._onDidRemoveGroup.fire(a);throw this.clear(),l}this._onDidLayoutfromJSON.fire()}clear(){const e=this.activeGroup,n=Array.from(this._groups.values());for(const s of n)s.disposable.dispose(),this.doRemoveGroup(s.value,{skipActive:!0});e&&this.doSetGroupActive(void 0),this.gridview.clear()}movePanel(e,n){var s;let l;const a=this.gridview.remove(e),c=(s=this._groups.get(n.reference))===null||s===void 0?void 0:s.value;if(!c)throw new Error(`reference group ${n.reference} does not exist`);const d=ju(n.direction);if(d==="center")throw new Error(`${d} not supported as an option`);{const h=zt(c.element);l=_s(this.gridview.orientation,h,d)}this.doAddGroup(a,l,n.size)}addPanel(e){var n,s,l,a;let c=(n=e.location)!==null&&n!==void 0?n:[0];if(!((s=e.position)===null||s===void 0)&&s.referencePanel){const h=(l=this._groups.get(e.position.referencePanel))===null||l===void 0?void 0:l.value;if(!h)throw new Error(`reference group ${e.position.referencePanel} does not exist`);const m=ju(e.position.direction);if(m==="center")throw new Error(`${m} not supported as an option`);{const w=zt(h.element);c=_s(this.gridview.orientation,w,m)}}const d=this.options.createComponent({id:e.id,name:e.component});return d.init({params:(a=e.params)!==null&&a!==void 0?a:{},minimumWidth:e.minimumWidth,maximumWidth:e.maximumWidth,minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight,priority:e.priority,snap:!!e.snap,accessor:this,isVisible:!0}),this.doAddGroup(d,c,e.size),this.registerPanel(d),this.doSetGroupActive(d),d}registerPanel(e){const n=new Re(e.api.onDidFocusChange(s=>{s.isFocused&&this._groups.forEach(l=>{const a=l.value;a!==e?a.setActive(!1):a.setActive(!0)})}));this._groups.set(e.id,{value:e,disposable:n})}moveGroup(e,n,s){const l=this.getPanel(n);if(!l)throw new Error("invalid operation");const a=zt(e.element),c=_s(this.gridview.orientation,a,s),[d,h]=Ms(c),m=zt(l.element),[w,v]=Ms(m);if(dv(w,d)){this.gridview.moveView(w,v,h);return}const S=this.doRemoveGroup(l,{skipActive:!0,skipDispose:!0}),E=zt(e.element),A=_s(this.gridview.orientation,E,s);this.doAddGroup(S,A)}removeGroup(e){super.removeGroup(e)}dispose(){super.dispose(),this._onDidLayoutfromJSON.dispose()}}class TS extends Fh{get panels(){return this.splitview.getViews()}get options(){return this._options}get length(){return this._panels.size}get orientation(){return this.splitview.orientation}get splitview(){return this._splitview}set splitview(e){this._splitview&&this._splitview.dispose(),this._splitview=e,this._splitviewChangeDisposable.value=new Re(this._splitview.onDidSashEnd(()=>{this._onDidLayoutChange.fire(void 0)}),this._splitview.onDidAddView(n=>this._onDidAddView.fire(n)),this._splitview.onDidRemoveView(n=>this._onDidRemoveView.fire(n)))}get minimumSize(){return this.splitview.minimumSize}get maximumSize(){return this.splitview.maximumSize}get height(){return this.splitview.orientation===ze.HORIZONTAL?this.splitview.orthogonalSize:this.splitview.size}get width(){return this.splitview.orientation===ze.HORIZONTAL?this.splitview.size:this.splitview.orthogonalSize}constructor(e,n){var s;super(document.createElement("div"),n.disableAutoResizing),this._splitviewChangeDisposable=new Bn,this._panels=new Map,this._onDidLayoutfromJSON=new U,this.onDidLayoutFromJSON=this._onDidLayoutfromJSON.event,this._onDidAddView=new U,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new U,this.onDidRemoveView=this._onDidRemoveView.event,this._onDidLayoutChange=new U,this.onDidLayoutChange=this._onDidLayoutChange.event,this.element.style.height="100%",this.element.style.width="100%",this._classNames=new nc(this.element),this._classNames.setClassNames((s=n.className)!==null&&s!==void 0?s:""),e.appendChild(this.element),this._options=n,this.splitview=new Xl(this.element,n),this.addDisposables(this._onDidAddView,this._onDidLayoutfromJSON,this._onDidRemoveView,this._onDidLayoutChange)}updateOptions(e){var n,s;"className"in e&&this._classNames.setClassNames((n=e.className)!==null&&n!==void 0?n:""),"disableResizing"in e&&(this.disableResizing=(s=e.disableAutoResizing)!==null&&s!==void 0?s:!1),typeof e.orientation=="string"&&(this.splitview.orientation=e.orientation),this._options=Object.assign(Object.assign({},this.options),e),this.splitview.layout(this.splitview.size,this.splitview.orthogonalSize)}focus(){var e;(e=this._activePanel)===null||e===void 0||e.focus()}movePanel(e,n){this.splitview.moveView(e,n)}setVisible(e,n){const s=this.panels.indexOf(e);this.splitview.setViewVisible(s,n)}setActive(e,n){this._activePanel=e,this.panels.filter(s=>s!==e).forEach(s=>{s.api._onDidActiveChange.fire({isActive:!1}),n||s.focus()}),e.api._onDidActiveChange.fire({isActive:!0}),n||e.focus()}removePanel(e,n){const s=this._panels.get(e.id);if(!s)throw new Error(`unknown splitview panel ${e.id}`);s.dispose(),this._panels.delete(e.id);const l=this.panels.findIndex(d=>d===e);this.splitview.removeView(l,n).dispose();const c=this.panels;c.length>0&&this.setActive(c[c.length-1])}getPanel(e){return this.panels.find(n=>n.id===e)}addPanel(e){var n;if(this._panels.has(e.id))throw new Error(`panel ${e.id} already exists`);const s=this.options.createComponent({id:e.id,name:e.component});s.orientation=this.splitview.orientation,s.init({params:(n=e.params)!==null&&n!==void 0?n:{},minimumSize:e.minimumSize,maximumSize:e.maximumSize,snap:e.snap,priority:e.priority,accessor:this});const l=typeof e.size=="number"?e.size:$i.Distribute,a=typeof e.index=="number"?e.index:void 0;return this.splitview.addView(s,l,a),this.doAddView(s),this.setActive(s),s}layout(e,n){const[s,l]=this.splitview.orientation===ze.HORIZONTAL?[e,n]:[n,e];this.splitview.layout(s,l)}doAddView(e){const n=e.api.onDidFocusChange(s=>{s.isFocused&&this.setActive(e,!0)});this._panels.set(e.id,n)}toJSON(){var e;return{views:this.splitview.getViews().map((s,l)=>({size:this.splitview.getViewSize(l),data:s.toJSON(),snap:!!s.snap,priority:s.priority})),activeView:(e=this._activePanel)===null||e===void 0?void 0:e.id,size:this.splitview.size,orientation:this.splitview.orientation}}fromJSON(e){this.clear();const{views:n,orientation:s,size:l,activeView:a}=e,c=[],d=this.width,h=this.height;if(this.splitview=new Xl(this.element,{orientation:s,proportionalLayout:this.options.proportionalLayout,descriptor:{size:l,views:n.map(m=>{const w=m.data;if(this._panels.has(w.id))throw new Error(`panel ${w.id} already exists`);const v=this.options.createComponent({id:w.id,name:w.component});return c.push(()=>{var S;v.init({params:(S=w.params)!==null&&S!==void 0?S:{},minimumSize:w.minimumSize,maximumSize:w.maximumSize,snap:m.snap,priority:m.priority,accessor:this})}),v.orientation=s,this.doAddView(v),setTimeout(()=>{this._onDidAddView.fire(v)},0),{size:m.size,view:v}})}}),this.layout(d,h),c.forEach(m=>m()),typeof a=="string"){const m=this.getPanel(a);m&&this.setActive(m)}this._onDidLayoutfromJSON.fire()}clear(){for(const e of this._panels.values())e.dispose();for(this._panels.clear();this.splitview.length>0;)this.splitview.removeView(0,$i.Distribute,!0).dispose()}dispose(){for(const n of this._panels.values())n.dispose();this._panels.clear();const e=this.splitview.getViews();this._splitviewChangeDisposable.dispose(),this.splitview.dispose();for(const n of e)n.dispose();this.element.remove(),super.dispose()}}class Rm extends Re{get element(){return this._element}constructor(){super(),this._expandedIcon=oS(),this._collapsedIcon=Sv(),this.disposable=new Bn,this.apiRef={api:null},this._element=document.createElement("div"),this.element.className="dv-default-header",this._content=document.createElement("span"),this._expander=document.createElement("div"),this._expander.className="dv-pane-header-icon",this.element.appendChild(this._expander),this.element.appendChild(this._content),this.addDisposables(Be(this._element,"click",()=>{var e;(e=this.apiRef.api)===null||e===void 0||e.setExpanded(!this.apiRef.api.isExpanded)}))}init(e){this.apiRef.api=e.api,this._content.textContent=e.title,this.updateIcon(),this.disposable.value=e.api.onDidExpansionChange(()=>{this.updateIcon()})}updateIcon(){var e;const n=!!(!((e=this.apiRef.api)===null||e===void 0)&&e.isExpanded);Ne(this._expander,"collapsed",!n),n?(this._expander.contains(this._collapsedIcon)&&this._collapsedIcon.remove(),this._expander.contains(this._expandedIcon)||this._expander.appendChild(this._expandedIcon)):(this._expander.contains(this._expandedIcon)&&this._expandedIcon.remove(),this._expander.contains(this._collapsedIcon)||this._expander.appendChild(this._collapsedIcon))}update(e){}dispose(){this.disposable.dispose(),super.dispose()}}const IS=Wh(),Mm=22,Lm=0,Vm=Number.MAX_SAFE_INTEGER;class Gm extends Xy{constructor(e){super({accessor:e.accessor,id:e.id,component:e.component,headerComponent:e.headerComponent,orientation:e.orientation,isExpanded:e.isExpanded,disableDnd:e.disableDnd,headerSize:e.headerSize,minimumBodySize:e.minimumBodySize,maximumBodySize:e.maximumBodySize}),this.options=e}getBodyComponent(){return this.options.body}getHeaderComponent(){return this.options.header}}class NS extends Fh{get id(){return this._id}get panels(){return this.paneview.getPanes()}set paneview(e){this._paneview=e,this._disposable.value=new Re(this._paneview.onDidChange(()=>{this._onDidLayoutChange.fire(void 0)}),this._paneview.onDidAddView(n=>this._onDidAddView.fire(n)),this._paneview.onDidRemoveView(n=>this._onDidRemoveView.fire(n)))}get paneview(){return this._paneview}get minimumSize(){return this.paneview.minimumSize}get maximumSize(){return this.paneview.maximumSize}get height(){return this.paneview.orientation===ze.HORIZONTAL?this.paneview.orthogonalSize:this.paneview.size}get width(){return this.paneview.orientation===ze.HORIZONTAL?this.paneview.size:this.paneview.orthogonalSize}get options(){return this._options}constructor(e,n){var s;super(document.createElement("div"),n.disableAutoResizing),this._id=IS.next(),this._disposable=new Bn,this._viewDisposables=new Map,this._onDidLayoutfromJSON=new U,this.onDidLayoutFromJSON=this._onDidLayoutfromJSON.event,this._onDidLayoutChange=new U,this.onDidLayoutChange=this._onDidLayoutChange.event,this._onDidDrop=new U,this.onDidDrop=this._onDidDrop.event,this._onDidAddView=new U,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new U,this.onDidRemoveView=this._onDidRemoveView.event,this._onUnhandledDragOverEvent=new U,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,this.element.style.height="100%",this.element.style.width="100%",this.addDisposables(this._onDidLayoutChange,this._onDidLayoutfromJSON,this._onDidDrop,this._onDidAddView,this._onDidRemoveView,this._onUnhandledDragOverEvent),this._classNames=new nc(this.element),this._classNames.setClassNames((s=n.className)!==null&&s!==void 0?s:""),e.appendChild(this.element),this._options=n,this.paneview=new Am(this.element,{orientation:ze.VERTICAL}),this.addDisposables(this._disposable)}setVisible(e,n){const s=this.panels.indexOf(e);this.paneview.setViewVisible(s,n)}focus(){}updateOptions(e){var n,s;"className"in e&&this._classNames.setClassNames((n=e.className)!==null&&n!==void 0?n:""),"disableResizing"in e&&(this.disableResizing=(s=e.disableAutoResizing)!==null&&s!==void 0?s:!1),this._options=Object.assign(Object.assign({},this.options),e)}addPanel(e){var n,s;const l=this.options.createComponent({id:e.id,name:e.component});let a;e.headerComponent&&this.options.createHeaderComponent&&(a=this.options.createHeaderComponent({id:e.id,name:e.headerComponent})),a||(a=new Rm);const c=new Gm({id:e.id,component:e.component,headerComponent:e.headerComponent,header:a,body:l,orientation:ze.VERTICAL,isExpanded:!!e.isExpanded,disableDnd:!!this.options.disableDnd,accessor:this,headerSize:(n=e.headerSize)!==null&&n!==void 0?n:Mm,minimumBodySize:Lm,maximumBodySize:Vm});this.doAddPanel(c);const d=typeof e.size=="number"?e.size:$i.Distribute,h=typeof e.index=="number"?e.index:void 0;return c.init({params:(s=e.params)!==null&&s!==void 0?s:{},minimumBodySize:e.minimumBodySize,maximumBodySize:e.maximumBodySize,isExpanded:e.isExpanded,title:e.title,containerApi:new ql(this),accessor:this}),this.paneview.addPane(c,d,h),c.orientation=this.paneview.orientation,c}removePanel(e){const s=this.panels.findIndex(l=>l===e);this.paneview.removePane(s),this.doRemovePanel(e)}movePanel(e,n){this.paneview.moveView(e,n)}getPanel(e){return this.panels.find(n=>n.id===e)}layout(e,n){const[s,l]=this.paneview.orientation===ze.HORIZONTAL?[e,n]:[n,e];this.paneview.layout(s,l)}toJSON(){const e=l=>l===Number.MAX_SAFE_INTEGER||l===Number.POSITIVE_INFINITY?void 0:l,n=l=>l<=0?void 0:l;return{views:this.paneview.getPanes().map((l,a)=>({size:this.paneview.getViewSize(a),data:l.toJSON(),minimumSize:n(l.minimumBodySize),maximumSize:e(l.maximumBodySize),headerSize:l.headerSize,expanded:l.isExpanded()})),size:this.paneview.size}}fromJSON(e){this.clear();const{views:n,size:s}=e,l=[],a=this.width,c=this.height;this.paneview=new Am(this.element,{orientation:ze.VERTICAL,descriptor:{size:s,views:n.map(d=>{var h,m,w;const v=d.data,S=this.options.createComponent({id:v.id,name:v.component});let E;v.headerComponent&&this.options.createHeaderComponent&&(E=this.options.createHeaderComponent({id:v.id,name:v.headerComponent})),E||(E=new Rm);const A=new Gm({id:v.id,component:v.component,headerComponent:v.headerComponent,header:E,body:S,orientation:ze.VERTICAL,isExpanded:!!d.expanded,disableDnd:!!this.options.disableDnd,accessor:this,headerSize:(h=d.headerSize)!==null&&h!==void 0?h:Mm,minimumBodySize:(m=d.minimumSize)!==null&&m!==void 0?m:Lm,maximumBodySize:(w=d.maximumSize)!==null&&w!==void 0?w:Vm});return this.doAddPanel(A),l.push(()=>{var D;A.init({params:(D=v.params)!==null&&D!==void 0?D:{},minimumBodySize:d.minimumSize,maximumBodySize:d.maximumSize,title:v.title,isExpanded:!!d.expanded,containerApi:new ql(this),accessor:this}),A.orientation=this.paneview.orientation}),setTimeout(()=>{this._onDidAddView.fire(A)},0),{size:d.size,view:A}})}}),this.layout(a,c),l.forEach(d=>d()),this._onDidLayoutfromJSON.fire()}clear(){for(const[e,n]of this._viewDisposables.entries())n.dispose();this._viewDisposables.clear(),this.paneview.dispose()}doAddPanel(e){const n=new Re(e.onDidDrop(s=>{this._onDidDrop.fire(s)}),e.onUnhandledDragOverEvent(s=>{this._onUnhandledDragOverEvent.fire(s)}));this._viewDisposables.set(e.id,n)}doRemovePanel(e){const n=this._viewDisposables.get(e.id);n&&(n.dispose(),this._viewDisposables.delete(e.id))}dispose(){super.dispose();for(const[e,n]of this._viewDisposables.entries())n.dispose();this._viewDisposables.clear(),this.element.remove(),this.paneview.dispose()}}class RS extends jh{get priority(){return this._priority}set orientation(e){this._orientation=e}get orientation(){return this._orientation}get minimumSize(){const e=typeof this._minimumSize=="function"?this._minimumSize():this._minimumSize;return e!==this._evaluatedMinimumSize&&(this._evaluatedMinimumSize=e,this.updateConstraints()),e}get maximumSize(){const e=typeof this._maximumSize=="function"?this._maximumSize():this._maximumSize;return e!==this._evaluatedMaximumSize&&(this._evaluatedMaximumSize=e,this.updateConstraints()),e}get snap(){return this._snap}constructor(e,n){super(e,n,new _v(e,n)),this._evaluatedMinimumSize=0,this._evaluatedMaximumSize=Number.POSITIVE_INFINITY,this._minimumSize=0,this._maximumSize=Number.POSITIVE_INFINITY,this._snap=!1,this._onDidChange=new U,this.onDidChange=this._onDidChange.event,this.api.initialize(this),this.addDisposables(this._onDidChange,this.api.onWillVisibilityChange(s=>{const{isVisible:l}=s,{accessor:a}=this._params;a.setVisible(this,l)}),this.api.onActiveChange(()=>{const{accessor:s}=this._params;s.setActive(this)}),this.api.onDidConstraintsChangeInternal(s=>{(typeof s.minimumSize=="number"||typeof s.minimumSize=="function")&&(this._minimumSize=s.minimumSize),(typeof s.maximumSize=="number"||typeof s.maximumSize=="function")&&(this._maximumSize=s.maximumSize),this.updateConstraints()}),this.api.onDidSizeChange(s=>{this._onDidChange.fire({size:s.size})}))}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}layout(e,n){const[s,l]=this.orientation===ze.HORIZONTAL?[e,n]:[n,e];super.layout(s,l)}init(e){super.init(e),this._priority=e.priority,e.minimumSize&&(this._minimumSize=e.minimumSize),e.maximumSize&&(this._maximumSize=e.maximumSize),e.snap&&(this._snap=e.snap)}toJSON(){const e=s=>s===Number.MAX_SAFE_INTEGER||s===Number.POSITIVE_INFINITY?void 0:s,n=s=>s<=0?void 0:s;return Object.assign(Object.assign({},super.toJSON()),{minimumSize:n(this.minimumSize),maximumSize:e(this.maximumSize)})}updateConstraints(){this.api._onDidConstraintsChange.fire({maximumSize:this._evaluatedMaximumSize,minimumSize:this._evaluatedMinimumSize})}}function MS(r,e){return new kS(r,e).api}function LS(r,e){const n=new TS(r,e);return new pv(n)}function VS(r,e){const n=new OS(r,e);return new mv(n)}function GS(r,e){const n=new NS(r,e);return new ql(n)}const bv=(r,e)=>{const[n,s]=pe.useState(),l=pe.useRef(r.componentProps);return pe.useImperativeHandle(e,()=>({update:a=>{l.current=Object.assign(Object.assign({},l.current),a),s(Date.now())}}),[]),pe.createElement(r.component,l.current)};bv.displayName="DockviewReactJsBridge";const WS=(()=>{let r=1;return{next:()=>`dockview_react_portal_key_${(r++).toString()}`}})(),FS=pe.createContext({});class qr{constructor(e,n,s,l,a){this.parent=e,this.portalStore=n,this.component=s,this.parameters=l,this.context=a,this._initialProps={},this.disposed=!1,this.createPortal()}update(e){if(this.disposed)throw new Error("invalid operation: resource is already disposed");this.componentInstance?this.componentInstance.update(e):this._initialProps=Object.assign(Object.assign({},this._initialProps),e)}createPortal(){if(this.disposed)throw new Error("invalid operation: resource is already disposed");if(!HS(this.component))throw new Error("Dockview: Only React.memo(...), React.ForwardRef(...) and functional components are accepted as components");const e=pe.createElement(pe.forwardRef(bv),{component:this.component,componentProps:this.parameters,ref:l=>{this.componentInstance=l,Object.keys(this._initialProps).length>0&&(this.componentInstance.update(this._initialProps),this._initialProps={})}}),n=this.context?pe.createElement(FS.Provider,{value:this.context},e):e,s=S0.createPortal(n,this.parent,WS.next());this.ref={portal:s,disposable:this.portalStore.addPortal(s)}}dispose(){var e;(e=this.ref)===null||e===void 0||e.disposable.dispose(),this.disposed=!0}}const rc=()=>{const[r,e]=pe.useState([]);pe.useDebugValue(`Portal count: ${r.length}`);const n=pe.useCallback(s=>{e(a=>[...a,s]);let l=!1;return Qt.from(()=>{if(l)throw new Error("invalid operation: resource already disposed");l=!0,e(a=>a.filter(c=>c!==s))})},[]);return[r,n]};function HS(r){return typeof r=="function"||!!(r!=null&&r.$$typeof)}class Wm{get element(){return this._element}constructor(e,n,s){this.id=e,this.component=n,this.reactPortalStore=s,this._onDidFocus=new U,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new U,this.onDidBlur=this._onDidBlur.event,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}focus(){}init(e){this.part=new qr(this.element,this.reactPortalStore,this.component,{params:e.params,api:e.api,containerApi:e.containerApi})}update(e){var n;(n=this.part)===null||n===void 0||n.update({params:e.params})}layout(e,n){}dispose(){var e;this._onDidFocus.dispose(),this._onDidBlur.dispose(),(e=this.part)===null||e===void 0||e.dispose()}}class Fm{get element(){return this._element}constructor(e,n,s){this.id=e,this.component=n,this.reactPortalStore=s,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}focus(){}init(e){this.part=new qr(this.element,this.reactPortalStore,this.component,{params:e.params,api:e.api,containerApi:e.containerApi,tabLocation:e.tabLocation})}update(e){var n;(n=this.part)===null||n===void 0||n.update({params:e.params})}layout(e,n){}dispose(){var e;(e=this.part)===null||e===void 0||e.dispose()}}class Hm{get element(){return this._element}constructor(e,n,s){this.id=e,this.component=n,this.reactPortalStore=s,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}init(e){this.part=new qr(this.element,this.reactPortalStore,this.component,{group:e.group,containerApi:e.containerApi})}focus(){}update(e){var n,s,l;this.parameters&&(this.parameters.params=e.params),(n=this.part)===null||n===void 0||n.update({params:(l=(s=this.parameters)===null||s===void 0?void 0:s.params)!==null&&l!==void 0?l:{}})}layout(e,n){}dispose(){var e;(e=this.part)===null||e===void 0||e.dispose()}}class jS{get element(){return this._element}get part(){return this._part}constructor(e,n,s){this.component=e,this.reactPortalStore=n,this._group=s,this.mutableDisposable=new Bn,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}init(e){this.mutableDisposable.value=new Re(this._group.model.onDidAddPanel(()=>{this.updatePanels()}),this._group.model.onDidRemovePanel(()=>{this.updatePanels()}),this._group.model.onDidActivePanelChange(()=>{this.updateActivePanel()}),e.api.onDidActiveChange(()=>{this.updateGroupActive()})),this._part=new qr(this.element,this.reactPortalStore,this.component,{api:e.api,containerApi:e.containerApi,panels:this._group.model.panels,activePanel:this._group.model.activePanel,isGroupActive:this._group.api.isActive,group:this._group})}dispose(){var e;this.mutableDisposable.dispose(),(e=this._part)===null||e===void 0||e.dispose()}update(e){var n;(n=this._part)===null||n===void 0||n.update(e.params)}updatePanels(){this.update({params:{panels:this._group.model.panels}})}updateActivePanel(){this.update({params:{activePanel:this._group.model.activePanel}})}updateGroupActive(){this.update({params:{isGroupActive:this._group.api.isActive}})}}function No(r,e){return r?n=>new jS(r,e,n):void 0}const Cu="props.defaultTabComponent";function BS(r){return vh.reduce((n,s)=>(s in r&&(n[s]=r[s]),n),{})}const Pv=pe.forwardRef((r,e)=>{const n=pe.useRef(null),s=pe.useRef(),[l,a]=rc();pe.useImperativeHandle(e,()=>n.current,[]);const c=pe.useRef({});return pe.useEffect(()=>{const d={};vh.forEach(h=>{const m=h,w=r[m];m in r&&w!==c.current[m]&&(d[m]=w)}),s.current&&s.current.updateOptions(d),c.current=r},vh.map(d=>r[d])),pe.useEffect(()=>{var d;if(!n.current)return;const h=(d=r.tabComponents)!==null&&d!==void 0?d:{};r.defaultTabComponent&&(h[Cu]=r.defaultTabComponent);const m={createLeftHeaderActionComponent:No(r.leftHeaderActionsComponent,{addPortal:a}),createRightHeaderActionComponent:No(r.rightHeaderActionsComponent,{addPortal:a}),createPrefixHeaderActionComponent:No(r.prefixHeaderActionsComponent,{addPortal:a}),createComponent:E=>new Wm(E.id,r.components[E.name],{addPortal:a}),createTabComponent(E){return new Fm(E.id,h[E.name],{addPortal:a})},createWatermarkComponent:r.watermarkComponent?()=>new Hm("watermark",r.watermarkComponent,{addPortal:a}):void 0,defaultTabComponent:r.defaultTabComponent?Cu:void 0},w=MS(n.current,Object.assign(Object.assign({},BS(r)),m)),{clientWidth:v,clientHeight:S}=n.current;return w.layout(v,S),r.onReady&&r.onReady({api:w}),s.current=w,()=>{s.current=void 0,w.dispose()}},[]),pe.useEffect(()=>{if(!s.current)return()=>{};const d=s.current.onDidDrop(h=>{r.onDidDrop&&r.onDidDrop(h)});return()=>{d.dispose()}},[r.onDidDrop]),pe.useEffect(()=>{if(!s.current)return()=>{};const d=s.current.onWillDrop(h=>{r.onWillDrop&&r.onWillDrop(h)});return()=>{d.dispose()}},[r.onWillDrop]),pe.useEffect(()=>{s.current&&s.current.updateOptions({createComponent:d=>new Wm(d.id,r.components[d.name],{addPortal:a})})},[r.components]),pe.useEffect(()=>{var d;if(!s.current)return;const h=(d=r.tabComponents)!==null&&d!==void 0?d:{};r.defaultTabComponent&&(h[Cu]=r.defaultTabComponent),s.current.updateOptions({defaultTabComponent:r.defaultTabComponent?Cu:void 0,createTabComponent(m){return new Fm(m.id,h[m.name],{addPortal:a})}})},[r.tabComponents,r.defaultTabComponent]),pe.useEffect(()=>{s.current&&s.current.updateOptions({createWatermarkComponent:r.watermarkComponent?()=>new Hm("watermark",r.watermarkComponent,{addPortal:a}):void 0})},[r.watermarkComponent]),pe.useEffect(()=>{s.current&&s.current.updateOptions({createRightHeaderActionComponent:No(r.rightHeaderActionsComponent,{addPortal:a})})},[r.rightHeaderActionsComponent]),pe.useEffect(()=>{s.current&&s.current.updateOptions({createLeftHeaderActionComponent:No(r.leftHeaderActionsComponent,{addPortal:a})})},[r.leftHeaderActionsComponent]),pe.useEffect(()=>{s.current&&s.current.updateOptions({createPrefixHeaderActionComponent:No(r.prefixHeaderActionsComponent,{addPortal:a})})},[r.prefixHeaderActionsComponent]),pe.createElement("div",{style:{height:"100%",width:"100%"},ref:n},l)});Pv.displayName="DockviewComponent";class jm extends RS{constructor(e,n,s,l){super(e,n),this.reactComponent=s,this.reactPortalStore=l}getComponent(){var e,n;return new qr(this.element,this.reactPortalStore,this.reactComponent,{params:(n=(e=this._params)===null||e===void 0?void 0:e.params)!==null&&n!==void 0?n:{},api:this.api,containerApi:new pv(this._params.accessor)})}}function US(r){return dh.reduce((n,s)=>(s in r&&(n[s]=r[s]),n),{})}const $S=pe.forwardRef((r,e)=>{const n=pe.useRef(null),s=pe.useRef(),[l,a]=rc();pe.useImperativeHandle(e,()=>n.current,[]);const c=pe.useRef({});return pe.useEffect(()=>{const d={};dh.forEach(h=>{const m=h,w=r[m];m in r&&w!==c.current[m]&&(d[m]=w)}),s.current&&s.current.updateOptions(d),c.current=r},dh.map(d=>r[d])),pe.useEffect(()=>{if(!n.current)return()=>{};const d={createComponent:v=>new jm(v.id,v.name,r.components[v.name],{addPortal:a})},h=LS(n.current,Object.assign(Object.assign({},US(r)),d)),{clientWidth:m,clientHeight:w}=n.current;return h.layout(m,w),r.onReady&&r.onReady({api:h}),s.current=h,()=>{s.current=void 0,h.dispose()}},[]),pe.useEffect(()=>{s.current&&s.current.updateOptions({createComponent:d=>new jm(d.id,d.name,r.components[d.name],{addPortal:a})})},[r.components]),pe.createElement("div",{style:{height:"100%",width:"100%"},ref:n},l)});$S.displayName="SplitviewComponent";class Bm extends xv{constructor(e,n,s,l){super(e,n),this.reactComponent=s,this.reactPortalStore=l}getComponent(){var e,n;return new qr(this.element,this.reactPortalStore,this.reactComponent,{params:(n=(e=this._params)===null||e===void 0?void 0:e.params)!==null&&n!==void 0?n:{},api:this.api,containerApi:new mv(this._params.accessor)})}}function YS(r){return mh.reduce((n,s)=>(s in r&&(n[s]=r[s]),n),{})}const KS=pe.forwardRef((r,e)=>{const n=pe.useRef(null),s=pe.useRef(),[l,a]=rc();pe.useImperativeHandle(e,()=>n.current,[]);const c=pe.useRef({});return pe.useEffect(()=>{const d={};mh.forEach(h=>{const m=h,w=r[m];m in r&&w!==c.current[m]&&(d[m]=w)}),s.current&&s.current.updateOptions(d),c.current=r},mh.map(d=>r[d])),pe.useEffect(()=>{if(!n.current)return()=>{};const d={createComponent:v=>new Bm(v.id,v.name,r.components[v.name],{addPortal:a})},h=VS(n.current,Object.assign(Object.assign({},YS(r)),d)),{clientWidth:m,clientHeight:w}=n.current;return h.layout(m,w),r.onReady&&r.onReady({api:h}),s.current=h,()=>{s.current=void 0,h.dispose()}},[]),pe.useEffect(()=>{s.current&&s.current.updateOptions({createComponent:d=>new Bm(d.id,d.name,r.components[d.name],{addPortal:a})})},[r.components]),pe.createElement("div",{style:{height:"100%",width:"100%"},ref:n},l)});KS.displayName="GridviewComponent";class xu{get element(){return this._element}constructor(e,n,s){this.id=e,this.component=n,this.reactPortalStore=s,this._element=document.createElement("div"),this._element.style.height="100%",this._element.style.width="100%"}init(e){this.part=new qr(this.element,this.reactPortalStore,this.component,{params:e.params,api:e.api,title:e.title,containerApi:e.containerApi})}toJSON(){return{id:this.id}}update(e){var n;(n=this.part)===null||n===void 0||n.update(e.params)}dispose(){var e;(e=this.part)===null||e===void 0||e.dispose()}}function JS(r){return gh.reduce((n,s)=>(s in r&&(n[s]=r[s]),n),{})}const QS=pe.forwardRef((r,e)=>{const n=pe.useRef(null),s=pe.useRef(),[l,a]=rc();pe.useImperativeHandle(e,()=>n.current,[]);const c=pe.useRef({});return pe.useEffect(()=>{const d={};gh.forEach(h=>{const m=h,w=r[m];m in r&&w!==c.current[m]&&(d[m]=w)}),s.current&&s.current.updateOptions(d),c.current=r},gh.map(d=>r[d])),pe.useEffect(()=>{var d;if(!n.current)return()=>{};const h=(d=r.headerComponents)!==null&&d!==void 0?d:{},m={createComponent:E=>new xu(E.id,r.components[E.name],{addPortal:a}),createHeaderComponent:E=>new xu(E.id,h[E.name],{addPortal:a})},w=GS(n.current,Object.assign(Object.assign({},JS(r)),m)),{clientWidth:v,clientHeight:S}=n.current;return w.layout(v,S),r.onReady&&r.onReady({api:w}),s.current=w,()=>{s.current=void 0,w.dispose()}},[]),pe.useEffect(()=>{s.current&&s.current.updateOptions({createComponent:d=>new xu(d.id,r.components[d.name],{addPortal:a})})},[r.components]),pe.useEffect(()=>{var d;if(!s.current)return;const h=(d=r.headerComponents)!==null&&d!==void 0?d:{};s.current.updateOptions({createHeaderComponent:m=>new xu(m.id,h[m.name],{addPortal:a})})},[r.headerComponents]),pe.useEffect(()=>{if(!s.current)return()=>{};const d=s.current.onDidDrop(h=>{r.onDidDrop&&r.onDidDrop(h)});return()=>{d.dispose()}},[r.onDidDrop]),pe.createElement("div",{style:{height:"100%",width:"100%"},ref:n},l)});QS.displayName="PaneviewComponent";const ZS=!0,un="u-",XS="uplot",qS=un+"hz",eD=un+"vt",tD=un+"title",nD=un+"wrap",iD=un+"under",sD=un+"over",rD=un+"axis",Yr=un+"off",oD=un+"select",lD=un+"cursor-x",aD=un+"cursor-y",uD=un+"cursor-pt",cD=un+"legend",dD=un+"live",hD=un+"inline",fD=un+"series",pD=un+"marker",Um=un+"label",mD=un+"value",Gl="width",Wl="height",Ml="top",$m="bottom",Ro="left",Ud="right",Yh="#000",Ym=Yh+"0",$d="mousemove",Km="mousedown",Yd="mouseup",Jm="mouseenter",Qm="mouseleave",Zm="dblclick",gD="resize",vD="scroll",Xm="change",Uu="dppxchange",Kh="--",Qo=typeof window<"u",wh=Qo?document:null,Fo=Qo?window:null,wD=Qo?navigator:null;let tt,Eu;function _h(){let r=devicePixelRatio;tt!=r&&(tt=r,Eu&&Sh(Xm,Eu,_h),Eu=matchMedia(`(min-resolution: ${tt-.001}dppx) and (max-resolution: ${tt+.001}dppx)`),Qr(Xm,Eu,_h),Fo.dispatchEvent(new CustomEvent(Uu)))}function Pi(r,e){if(e!=null){let n=r.classList;!n.contains(e)&&n.add(e)}}function yh(r,e){let n=r.classList;n.contains(e)&&n.remove(e)}function wt(r,e,n){r.style[e]=n+"px"}function ns(r,e,n,s){let l=wh.createElement(r);return e!=null&&Pi(l,e),n!=null&&n.insertBefore(l,s),l}function Hi(r,e){return ns("div",r,e)}const qm=new WeakMap;function ws(r,e,n,s,l){let a="translate("+e+"px,"+n+"px)",c=qm.get(r);a!=c&&(r.style.transform=a,qm.set(r,a),e<0||n<0||e>s||n>l?Pi(r,Yr):yh(r,Yr))}const eg=new WeakMap;function tg(r,e,n){let s=e+n,l=eg.get(r);s!=l&&(eg.set(r,s),r.style.background=e,r.style.borderColor=n)}const ng=new WeakMap;function ig(r,e,n,s){let l=e+""+n,a=ng.get(r);l!=a&&(ng.set(r,l),r.style.height=n+"px",r.style.width=e+"px",r.style.marginLeft=s?-e/2+"px":0,r.style.marginTop=s?-n/2+"px":0)}const Jh={passive:!0},_D={...Jh,capture:!0};function Qr(r,e,n,s){e.addEventListener(r,n,s?_D:Jh)}function Sh(r,e,n,s){e.removeEventListener(r,n,Jh)}Qo&&_h();function is(r,e,n,s){let l;n=n||0,s=s||e.length-1;let a=s<=2147483647;for(;s-n>1;)l=a?n+s>>1:Ai((n+s)/2),e[l]{let a=-1,c=-1;for(let d=s;d<=l;d++)if(r(n[d])){a=d;break}for(let d=l;d>=s;d--)if(r(n[d])){c=d;break}return[a,c]}}const zv=r=>r!=null,kv=r=>r!=null&&r>0,oc=Av(zv),yD=Av(kv);function SD(r,e,n,s=0,l=!1){let a=l?yD:oc,c=l?kv:zv;[e,n]=a(r,e,n);let d=r[e],h=r[e];if(e>-1)if(s==1)d=r[e],h=r[n];else if(s==-1)d=r[n],h=r[e];else for(let m=e;m<=n;m++){let w=r[m];c(w)&&(wh&&(h=w))}return[d??ft,h??-ft]}function lc(r,e,n,s){let l=og(r),a=og(e);r==e&&(l==-1?(r*=n,e/=n):(r/=n,e*=n));let c=n==10?Ls:Ov,d=l==1?Ai:Ui,h=a==1?Ui:Ai,m=d(c(ln(r))),w=h(c(ln(e))),v=Bo(n,m),S=Bo(n,w);return n==10&&(m<0&&(v=pt(v,-m)),w<0&&(S=pt(S,-w))),s||n==2?(r=v*l,e=S*a):(r=Rv(r,v),e=ac(e,S)),[r,e]}function Qh(r,e,n,s){let l=lc(r,e,n,s);return r==0&&(l[0]=0),e==0&&(l[1]=0),l}const Zh=.1,sg={mode:3,pad:Zh},$l={pad:0,soft:null,mode:0},DD={min:$l,max:$l};function $u(r,e,n,s){return uc(n)?rg(r,e,n):($l.pad=n,$l.soft=s?0:null,$l.mode=s?3:0,rg(r,e,DD))}function qe(r,e){return r??e}function CD(r,e,n){for(e=qe(e,0),n=qe(n,r.length-1);e<=n;){if(r[e]!=null)return!0;e++}return!1}function rg(r,e,n){let s=n.min,l=n.max,a=qe(s.pad,0),c=qe(l.pad,0),d=qe(s.hard,-ft),h=qe(l.hard,ft),m=qe(s.soft,ft),w=qe(l.soft,-ft),v=qe(s.mode,0),S=qe(l.mode,0),E=e-r,A=Ls(E),D=ti(ln(r),ln(e)),P=Ls(D),R=ln(P-A);(E<1e-24||R>10)&&(E=0,(r==0||e==0)&&(E=1e-24,v==2&&m!=ft&&(a=0),S==2&&w!=-ft&&(c=0)));let O=E||D||1e3,M=Ls(O),N=Bo(10,Ai(M)),Z=O*(E==0?r==0?.1:1:a),G=pt(Rv(r-Z,N/10),24),$=r>=m&&(v==1||v==3&&G<=m||v==2&&G>=m)?m:ft,K=ti(d,G<$&&r>=$?$:ss($,G)),he=O*(E==0?e==0?.1:1:c),ue=pt(ac(e+he,N/10),24),Q=e<=w&&(S==1||S==3&&ue>=w||S==2&&ue<=w)?w:-ft,ve=ss(h,ue>Q&&e<=Q?Q:ti(Q,ue));return K==ve&&K==0&&(ve=100),[K,ve]}const xD=new Intl.NumberFormat(Qo?wD.language:"en-US"),Xh=r=>xD.format(r),zi=Math,ku=zi.PI,ln=zi.abs,Ai=zi.floor,rn=zi.round,Ui=zi.ceil,ss=zi.min,ti=zi.max,Bo=zi.pow,og=zi.sign,Ls=zi.log10,Ov=zi.log2,ED=(r,e=1)=>zi.sinh(r)*e,Kd=(r,e=1)=>zi.asinh(r/e),ft=1/0;function lg(r){return(Ls((r^r>>31)-(r>>31))|0)+1}function Dh(r,e,n){return ss(ti(r,e),n)}function Tv(r){return typeof r=="function"}function Ye(r){return Tv(r)?r:()=>r}const bD=()=>{},Iv=r=>r,Nv=(r,e)=>e,PD=r=>null,ag=r=>!0,ug=(r,e)=>r==e,AD=/\.\d*?(?=9{6,}|0{6,})/gm,Xr=r=>{if(Lv(r)||yr.has(r))return r;const e=`${r}`,n=e.match(AD);if(n==null)return r;let s=n[0].length-1;if(e.indexOf("e-")!=-1){let[l,a]=e.split("e");return+`${Xr(l)}e${a}`}return pt(r,s)};function Ur(r,e){return Xr(pt(Xr(r/e))*e)}function ac(r,e){return Xr(Ui(Xr(r/e))*e)}function Rv(r,e){return Xr(Ai(Xr(r/e))*e)}function pt(r,e=0){if(Lv(r))return r;let n=10**e,s=r*n*(1+Number.EPSILON);return rn(s)/n}const yr=new Map;function Mv(r){return((""+r).split(".")[1]||"").length}function ea(r,e,n,s){let l=[],a=s.map(Mv);for(let c=e;c=0?0:d)+(c>=a[m]?0:a[m]),S=r==10?w:pt(w,v);l.push(S),yr.set(S,v)}}return l}const Yl={},qh=[],Uo=[null,null],wr=Array.isArray,Lv=Number.isInteger,zD=r=>r===void 0;function cg(r){return typeof r=="string"}function uc(r){let e=!1;if(r!=null){let n=r.constructor;e=n==null||n==Object}return e}function kD(r){return r!=null&&typeof r=="object"}const OD=Object.getPrototypeOf(Uint8Array),Vv="__proto__";function $o(r,e=uc){let n;if(wr(r)){let s=r.find(l=>l!=null);if(wr(s)||e(s)){n=Array(r.length);for(let l=0;la){for(l=c-1;l>=0&&r[l]==null;)r[l--]=null;for(l=c+1;lc-d)],l=s[0].length,a=new Map;for(let c=0;c"u"?r=>Promise.resolve().then(r):queueMicrotask;function VD(r){let e=r[0],n=e.length,s=Array(n);for(let a=0;ae[a]-e[c]);let l=[];for(let a=0;a=s&&r[l]==null;)l--;if(l<=s)return!0;const a=ti(1,Ai((l-s+1)/e));for(let c=r[s],d=s+a;d<=l;d+=a){const h=r[d];if(h!=null){if(h<=c)return!1;c=h}}return!0}const Gv=["January","February","March","April","May","June","July","August","September","October","November","December"],Wv=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function Fv(r){return r.slice(0,3)}const FD=Wv.map(Fv),HD=Gv.map(Fv),jD={MMMM:Gv,MMM:HD,WWWW:Wv,WWW:FD};function Ll(r){return(r<10?"0":"")+r}function BD(r){return(r<10?"00":r<100?"0":"")+r}const UD={YYYY:r=>r.getFullYear(),YY:r=>(r.getFullYear()+"").slice(2),MMMM:(r,e)=>e.MMMM[r.getMonth()],MMM:(r,e)=>e.MMM[r.getMonth()],MM:r=>Ll(r.getMonth()+1),M:r=>r.getMonth()+1,DD:r=>Ll(r.getDate()),D:r=>r.getDate(),WWWW:(r,e)=>e.WWWW[r.getDay()],WWW:(r,e)=>e.WWW[r.getDay()],HH:r=>Ll(r.getHours()),H:r=>r.getHours(),h:r=>{let e=r.getHours();return e==0?12:e>12?e-12:e},AA:r=>r.getHours()>=12?"PM":"AM",aa:r=>r.getHours()>=12?"pm":"am",a:r=>r.getHours()>=12?"p":"a",mm:r=>Ll(r.getMinutes()),m:r=>r.getMinutes(),ss:r=>Ll(r.getSeconds()),s:r=>r.getSeconds(),fff:r=>BD(r.getMilliseconds())};function ef(r,e){e=e||jD;let n=[],s=/\{([a-z]+)\}|[^{]+/gi,l;for(;l=s.exec(r);)n.push(l[0][0]=="{"?UD[l[1]]:l[0]);return a=>{let c="";for(let d=0;dr%1==0,Yu=[1,2,2.5,5],KD=ea(10,-32,0,Yu),jv=ea(10,0,32,Yu),JD=jv.filter(Hv),$r=KD.concat(jv),tf=` +`,Bv="{YYYY}",dg=tf+Bv,Uv="{M}/{D}",Fl=tf+Uv,bu=Fl+"/{YY}",$v="{aa}",QD="{h}:{mm}",Vo=QD+$v,hg=tf+Vo,fg=":{ss}",rt=null;function Yv(r){let e=r*1e3,n=e*60,s=n*60,l=s*24,a=l*30,c=l*365,h=(r==1?ea(10,0,3,Yu).filter(Hv):ea(10,-3,0,Yu)).concat([e,e*5,e*10,e*15,e*30,n,n*5,n*10,n*15,n*30,s,s*2,s*3,s*4,s*6,s*8,s*12,l,l*2,l*3,l*4,l*5,l*6,l*7,l*8,l*9,l*10,l*15,a,a*2,a*3,a*4,a*6,c,c*2,c*5,c*10,c*25,c*50,c*100]);const m=[[c,Bv,rt,rt,rt,rt,rt,rt,1],[l*28,"{MMM}",dg,rt,rt,rt,rt,rt,1],[l,Uv,dg,rt,rt,rt,rt,rt,1],[s,"{h}"+$v,bu,rt,Fl,rt,rt,rt,1],[n,Vo,bu,rt,Fl,rt,rt,rt,1],[e,fg,bu+" "+Vo,rt,Fl+" "+Vo,rt,hg,rt,1],[r,fg+".{fff}",bu+" "+Vo,rt,Fl+" "+Vo,rt,hg,rt,1]];function w(v){return(S,E,A,D,P,R)=>{let O=[],M=P>=c,N=P>=a&&P=l?l:P,ue=Ai(A)-Ai(G),Q=K+ue+ac(G-K,he);O.push(Q);let ve=v(Q),ie=ve.getHours()+ve.getMinutes()/n+ve.getSeconds()/s,ce=P/s,j=S.axes[E]._space,te=R/j;for(;Q=pt(Q+P,r==1?0:3),!(Q>D);)if(ce>1){let X=Ai(pt(ie+ce,6))%24,ne=v(Q).getHours()-X;ne>1&&(ne=-1),Q-=ne*s,ie=(ie+ce)%24;let k=O[O.length-1];pt((Q-k)/P,3)*te>=.7&&O.push(Q)}else O.push(Q)}return O}}return[h,m,w]}const[ZD,XD,qD]=Yv(1),[eC,tC,nC]=Yv(.001);ea(2,-53,53,[1]);function pg(r,e){return r.map(n=>n.map((s,l)=>l==0||l==8||s==null?s:e(l==1||n[8]==0?s:n[1]+s)))}function mg(r,e){return(n,s,l,a,c)=>{let d=e.find(A=>c>=A[0])||e[e.length-1],h,m,w,v,S,E;return s.map(A=>{let D=r(A),P=D.getFullYear(),R=D.getMonth(),O=D.getDate(),M=D.getHours(),N=D.getMinutes(),Z=D.getSeconds(),G=P!=h&&d[2]||R!=m&&d[3]||O!=w&&d[4]||M!=v&&d[5]||N!=S&&d[6]||Z!=E&&d[7]||d[1];return h=P,m=R,w=O,v=M,S=N,E=Z,G(D)})}}function iC(r,e){let n=ef(e);return(s,l,a,c,d)=>l.map(h=>n(r(h)))}function Jd(r,e,n){return new Date(r,e,n)}function gg(r,e){return e(r)}const sC="{YYYY}-{MM}-{DD} {h}:{mm}{aa}";function vg(r,e){return(n,s,l,a)=>a==null?Kh:e(r(s))}function rC(r,e){let n=r.series[e];return n.width?n.stroke(r,e):n.points.width?n.points.stroke(r,e):null}function oC(r,e){return r.series[e].fill(r,e)}const lC={show:!0,live:!0,isolate:!1,mount:bD,markers:{show:!0,width:2,stroke:rC,fill:oC,dash:"solid"},idx:null,idxs:null,values:[]};function aC(r,e){let n=r.cursor.points,s=Hi(),l=n.size(r,e);wt(s,Gl,l),wt(s,Wl,l);let a=l/-2;wt(s,"marginLeft",a),wt(s,"marginTop",a);let c=n.width(r,e,l);return c&&wt(s,"borderWidth",c),s}function uC(r,e){let n=r.series[e].points;return n._fill||n._stroke}function cC(r,e){let n=r.series[e].points;return n._stroke||n._fill}function dC(r,e){return r.series[e].points.size}const Qd=[0,0];function hC(r,e,n){return Qd[0]=e,Qd[1]=n,Qd}function Pu(r,e,n,s=!0){return l=>{l.button==0&&(!s||l.target==e)&&n(l)}}function Zd(r,e,n,s=!0){return l=>{(!s||l.target==e)&&n(l)}}const fC={show:!0,x:!0,y:!0,lock:!1,move:hC,points:{one:!1,show:aC,size:dC,width:0,stroke:cC,fill:uC},bind:{mousedown:Pu,mouseup:Pu,click:Pu,dblclick:Pu,mousemove:Zd,mouseleave:Zd,mouseenter:Zd},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,click:(r,e)=>{e.stopPropagation(),e.stopImmediatePropagation()},_x:!1,_y:!1},focus:{dist:(r,e,n,s,l)=>s-l,prox:-1,bias:0},hover:{skip:[void 0],prox:null,bias:0},left:-10,top:-10,idx:null,dataIdx:null,idxs:null,event:null},Kv={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},nf=Jt({},Kv,{filter:Nv}),Jv=Jt({},nf,{size:10}),Qv=Jt({},Kv,{show:!1}),sf='12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',Zv="bold "+sf,Xv=1.5,wg={show:!0,scale:"x",stroke:Yh,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:Zv,side:2,grid:nf,ticks:Jv,border:Qv,font:sf,lineGap:Xv,rotate:0},pC="Value",mC="Time",_g={show:!0,scale:"x",auto:!1,sorted:1,min:ft,max:-ft,idxs:[]};function gC(r,e,n,s,l){return e.map(a=>a==null?"":Xh(a))}function vC(r,e,n,s,l,a,c){let d=[],h=yr.get(l)||0;n=c?n:pt(ac(n,l),h);for(let m=n;m<=s;m=pt(m+l,h))d.push(Object.is(m,-0)?0:m);return d}function Ch(r,e,n,s,l,a,c){const d=[],h=r.scales[r.axes[e].scale].log,m=h==10?Ls:Ov,w=Ai(m(n));l=Bo(h,w),h==10&&(l=$r[is(l,$r)]);let v=n,S=l*h;h==10&&(S=$r[is(S,$r)]);do d.push(v),v=v+l,h==10&&!yr.has(v)&&(v=pt(v,yr.get(l))),v>=S&&(l=v,S=l*h,h==10&&(S=$r[is(S,$r)]));while(v<=s);return d}function wC(r,e,n,s,l,a,c){let h=r.scales[r.axes[e].scale].asinh,m=s>h?Ch(r,e,ti(h,n),s,l):[h],w=s>=0&&n<=0?[0]:[];return(n<-h?Ch(r,e,ti(h,-s),-n,l):[h]).reverse().map(S=>-S).concat(w,m)}const qv=/./,_C=/[12357]/,yC=/[125]/,yg=/1/,xh=(r,e,n,s)=>r.map((l,a)=>e==4&&l==0||a%s==0&&n.test(l.toExponential()[l<0?1:0])?l:null);function SC(r,e,n,s,l){let a=r.axes[n],c=a.scale,d=r.scales[c],h=r.valToPos,m=a._space,w=h(10,c),v=h(9,c)-w>=m?qv:h(7,c)-w>=m?_C:h(5,c)-w>=m?yC:yg;if(v==yg){let S=ln(h(1,c)-w);if(Sl,Cg={show:!0,auto:!0,sorted:0,gaps:ew,alpha:1,facets:[Jt({},Dg,{scale:"x"}),Jt({},Dg,{scale:"y"})]},xg={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:ew,alpha:1,points:{show:EC,filter:null},values:null,min:ft,max:-ft,idxs:[],path:null,clip:null};function bC(r,e,n,s,l){return n/10}const tw={time:ZS,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},PC=Jt({},tw,{time:!1,ori:1}),Eg={};function nw(r,e){let n=Eg[r];return n||(n={key:r,plots:[],sub(s){n.plots.push(s)},unsub(s){n.plots=n.plots.filter(l=>l!=s)},pub(s,l,a,c,d,h,m){for(let w=0;w{let R=c.pxRound;const O=m.dir*(m.ori==0?1:-1),M=m.ori==0?Zo:Xo;let N,Z;O==1?(N=n,Z=s):(N=s,Z=n);let G=R(v(d[N],m,D,E)),$=R(S(h[N],w,P,A)),K=R(v(d[Z],m,D,E)),he=R(S(a==1?w.max:w.min,w,P,A)),ue=new Path2D(l);return M(ue,K,he),M(ue,G,he),M(ue,G,$),ue})}function cc(r,e,n,s,l,a){let c=null;if(r.length>0){c=new Path2D;const d=e==0?fc:lf;let h=n;for(let v=0;vS[0]){let E=S[0]-h;E>0&&d(c,h,s,E,s+a),h=S[1]}}let m=n+l-h,w=10;m>0&&d(c,h,s-w/2,m,s+a+w)}return c}function zC(r,e,n){let s=r[r.length-1];s&&s[0]==e?s[1]=n:r.push([e,n])}function of(r,e,n,s,l,a,c){let d=[],h=r.length;for(let m=l==1?n:s;m>=n&&m<=s;m+=l)if(e[m]===null){let v=m,S=m;if(l==1)for(;++m<=s&&e[m]===null;)S=m;else for(;--m>=n&&e[m]===null;)S=m;let E=a(r[v]),A=S==v?E:a(r[S]),D=v-l;E=c<=0&&D>=0&&D=0&&R>=0&&R=E&&d.push([E,A])}return d}function bg(r){return r==0?Iv:r==1?rn:e=>Ur(e,r)}function iw(r){let e=r==0?dc:hc,n=r==0?(l,a,c,d,h,m)=>{l.arcTo(a,c,d,h,m)}:(l,a,c,d,h,m)=>{l.arcTo(c,a,h,d,m)},s=r==0?(l,a,c,d,h)=>{l.rect(a,c,d,h)}:(l,a,c,d,h)=>{l.rect(c,a,h,d)};return(l,a,c,d,h,m=0,w=0)=>{m==0&&w==0?s(l,a,c,d,h):(m=ss(m,d/2,h/2),w=ss(w,d/2,h/2),e(l,a+m,c),n(l,a+d,c,a+d,c+h,m),n(l,a+d,c+h,a,c+h,w),n(l,a,c+h,a,c,w),n(l,a,c,a+d,c,m),l.closePath())}}const dc=(r,e,n)=>{r.moveTo(e,n)},hc=(r,e,n)=>{r.moveTo(n,e)},Zo=(r,e,n)=>{r.lineTo(e,n)},Xo=(r,e,n)=>{r.lineTo(n,e)},fc=iw(0),lf=iw(1),sw=(r,e,n,s,l,a)=>{r.arc(e,n,s,l,a)},rw=(r,e,n,s,l,a)=>{r.arc(n,e,s,l,a)},ow=(r,e,n,s,l,a,c)=>{r.bezierCurveTo(e,n,s,l,a,c)},lw=(r,e,n,s,l,a,c)=>{r.bezierCurveTo(n,e,l,s,c,a)};function aw(r){return(e,n,s,l,a)=>eo(e,n,(c,d,h,m,w,v,S,E,A,D,P)=>{let{pxRound:R,points:O}=c,M,N;m.ori==0?(M=dc,N=sw):(M=hc,N=rw);const Z=pt(O.width*tt,3);let G=(O.size-O.width)/2*tt,$=pt(G*2,3),K=new Path2D,he=new Path2D,{left:ue,top:Q,width:ve,height:ie}=e.bbox;fc(he,ue-$,Q-$,ve+$*2,ie+$*2);const ce=j=>{if(h[j]!=null){let te=R(v(d[j],m,D,E)),X=R(S(h[j],w,P,A));M(K,te+G,X),N(K,te,X,G,0,ku*2)}};if(a)a.forEach(ce);else for(let j=s;j<=l;j++)ce(j);return{stroke:Z>0?K:null,fill:K,clip:he,flags:Yo|Eh}})}function uw(r){return(e,n,s,l,a,c)=>{s!=l&&(a!=s&&c!=s&&r(e,n,s),a!=l&&c!=l&&r(e,n,l),r(e,n,c))}}const kC=uw(Zo),OC=uw(Xo);function cw(r){const e=qe(r==null?void 0:r.alignGaps,0);return(n,s,l,a)=>eo(n,s,(c,d,h,m,w,v,S,E,A,D,P)=>{[l,a]=oc(h,l,a);let R=c.pxRound,O=ie=>R(v(ie,m,D,E)),M=ie=>R(S(ie,w,P,A)),N,Z;m.ori==0?(N=Zo,Z=kC):(N=Xo,Z=OC);const G=m.dir*(m.ori==0?1:-1),$={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:Yo},K=$.stroke;let he=!1;if(a-l>=D*4){let ie=q=>n.posToVal(q,m.key,!0),ce=null,j=null,te,X,le,fe=O(d[G==1?l:a]),ne=O(d[l]),k=O(d[a]),F=ie(G==1?ne+1:k-1);for(let q=G==1?l:a;q>=l&&q<=a;q+=G){let xe=d[q],Se=(G==1?xeF)?fe:O(xe),Ee=h[q];Se==fe?Ee!=null?(X=Ee,ce==null?(N(K,Se,M(X)),te=ce=j=X):Xj&&(j=X)):Ee===null&&(he=!0):(ce!=null&&Z(K,fe,M(ce),M(j),M(te),M(X)),Ee!=null?(X=Ee,N(K,Se,M(X)),ce=j=te=X):(ce=j=null,Ee===null&&(he=!0)),fe=Se,F=ie(fe+G))}ce!=null&&ce!=j&&le!=fe&&Z(K,fe,M(ce),M(j),M(te),M(X))}else for(let ie=G==1?l:a;ie>=l&&ie<=a;ie+=G){let ce=h[ie];ce===null?he=!0:ce!=null&&N(K,O(d[ie]),M(ce))}let[Q,ve]=rf(n,s);if(c.fill!=null||Q!=0){let ie=$.fill=new Path2D(K),ce=c.fillTo(n,s,c.min,c.max,Q),j=M(ce),te=O(d[l]),X=O(d[a]);G==-1&&([X,te]=[te,X]),N(ie,X,j),N(ie,te,j)}if(!c.spanGaps){let ie=[];he&&ie.push(...of(d,h,l,a,G,O,e)),$.gaps=ie=c.gaps(n,s,l,a,ie),$.clip=cc(ie,m.ori,E,A,D,P)}return ve!=0&&($.band=ve==2?[Vs(n,s,l,a,K,-1),Vs(n,s,l,a,K,1)]:Vs(n,s,l,a,K,ve)),$})}function TC(r){const e=qe(r.align,1),n=qe(r.ascDesc,!1),s=qe(r.alignGaps,0),l=qe(r.extend,!1);return(a,c,d,h)=>eo(a,c,(m,w,v,S,E,A,D,P,R,O,M)=>{[d,h]=oc(v,d,h);let N=m.pxRound,{left:Z,width:G}=a.bbox,$=ne=>N(A(ne,S,O,P)),K=ne=>N(D(ne,E,M,R)),he=S.ori==0?Zo:Xo;const ue={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:Yo},Q=ue.stroke,ve=S.dir*(S.ori==0?1:-1);let ie=K(v[ve==1?d:h]),ce=$(w[ve==1?d:h]),j=ce,te=ce;l&&e==-1&&(te=Z,he(Q,te,ie)),he(Q,ce,ie);for(let ne=ve==1?d:h;ne>=d&&ne<=h;ne+=ve){let k=v[ne];if(k==null)continue;let F=$(w[ne]),q=K(k);e==1?he(Q,F,ie):he(Q,j,q),he(Q,F,q),ie=q,j=F}let X=j;l&&e==1&&(X=Z+G,he(Q,X,ie));let[le,fe]=rf(a,c);if(m.fill!=null||le!=0){let ne=ue.fill=new Path2D(Q),k=m.fillTo(a,c,m.min,m.max,le),F=K(k);he(ne,X,F),he(ne,te,F)}if(!m.spanGaps){let ne=[];ne.push(...of(w,v,d,h,ve,$,s));let k=m.width*tt/2,F=n||e==1?k:-k,q=n||e==-1?-k:k;ne.forEach(xe=>{xe[0]+=F,xe[1]+=q}),ue.gaps=ne=m.gaps(a,c,d,h,ne),ue.clip=cc(ne,S.ori,P,R,O,M)}return fe!=0&&(ue.band=fe==2?[Vs(a,c,d,h,Q,-1),Vs(a,c,d,h,Q,1)]:Vs(a,c,d,h,Q,fe)),ue})}function Pg(r,e,n,s,l,a,c=ft){if(r.length>1){let d=null;for(let h=0,m=1/0;h{}),{fill:v,stroke:S}=m;return(E,A,D,P)=>eo(E,A,(R,O,M,N,Z,G,$,K,he,ue,Q)=>{let ve=R.pxRound,ie=n,ce=s*tt,j=d*tt,te=h*tt,X,le;N.ori==0?[X,le]=a(E,A):[le,X]=a(E,A);const fe=N.dir*(N.ori==0?1:-1);let ne=N.ori==0?fc:lf,k=N.ori==0?w:(ge,et,it,hn,In,Xt,kt)=>{w(ge,et,it,In,hn,kt,Xt)},F=qe(E.bands,qh).find(ge=>ge.series[0]==A),q=F!=null?F.dir:0,xe=R.fillTo(E,A,R.min,R.max,q),Ie=ve($(xe,Z,Q,he)),Se,Ee,We,Fe=ue,Me=ve(R.width*tt),Zt=!1,Wt=null,Ft=null,Ht=null,ii=null;v!=null&&(Me==0||S!=null)&&(Zt=!0,Wt=v.values(E,A,D,P),Ft=new Map,new Set(Wt).forEach(ge=>{ge!=null&&Ft.set(ge,new Path2D)}),Me>0&&(Ht=S.values(E,A,D,P),ii=new Map,new Set(Ht).forEach(ge=>{ge!=null&&ii.set(ge,new Path2D)})));let{x0:Tn,size:ki}=m;if(Tn!=null&&ki!=null){ie=1,O=Tn.values(E,A,D,P),Tn.unit==2&&(O=O.map(it=>E.posToVal(K+it*ue,N.key,!0)));let ge=ki.values(E,A,D,P);ki.unit==2?Ee=ge[0]*ue:Ee=G(ge[0],N,ue,K)-G(0,N,ue,K),Fe=Pg(O,M,G,N,ue,K,Fe),We=Fe-Ee+ce}else Fe=Pg(O,M,G,N,ue,K,Fe),We=Fe*c+ce,Ee=Fe-We;We<1&&(We=0),Me>=Ee/2&&(Me=0),We<5&&(ve=Iv);let ls=We>0,Un=Fe-We-(ls?Me:0);Ee=ve(Dh(Un,te,j)),Se=(ie==0?Ee/2:ie==fe?0:Ee)-ie*fe*((ie==0?ce/2:0)+(ls?Me/2:0));const nt={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},cn=Zt?null:new Path2D;let dn=null;if(F!=null)dn=E.data[F.series[1]];else{let{y0:ge,y1:et}=m;ge!=null&&et!=null&&(M=et.values(E,A,D,P),dn=ge.values(E,A,D,P))}let pi=X*Ee,Le=le*Ee;for(let ge=fe==1?D:P;ge>=D&&ge<=P;ge+=fe){let et=M[ge];if(et==null)continue;if(dn!=null){let qt=dn[ge]??0;if(et-qt==0)continue;Ie=$(qt,Z,Q,he)}let it=N.distr!=2||m!=null?O[ge]:ge,hn=G(it,N,ue,K),In=$(qe(et,xe),Z,Q,he),Xt=ve(hn-Se),kt=ve(ti(In,Ie)),fn=ve(ss(In,Ie)),xn=kt-fn;if(et!=null){let qt=et<0?Le:pi,En=et<0?pi:Le;Zt?(Me>0&&Ht[ge]!=null&&ne(ii.get(Ht[ge]),Xt,fn+Ai(Me/2),Ee,ti(0,xn-Me),qt,En),Wt[ge]!=null&&ne(Ft.get(Wt[ge]),Xt,fn+Ai(Me/2),Ee,ti(0,xn-Me),qt,En)):ne(cn,Xt,fn+Ai(Me/2),Ee,ti(0,xn-Me),qt,En),k(E,A,ge,Xt-Me/2,fn,Ee+Me,xn)}}return Me>0?nt.stroke=Zt?ii:cn:Zt||(nt._fill=R.width==0?R._fill:R._stroke??R._fill,nt.width=0),nt.fill=Zt?Ft:cn,nt})}function NC(r,e){const n=qe(e==null?void 0:e.alignGaps,0);return(s,l,a,c)=>eo(s,l,(d,h,m,w,v,S,E,A,D,P,R)=>{[a,c]=oc(m,a,c);let O=d.pxRound,M=X=>O(S(X,w,P,A)),N=X=>O(E(X,v,R,D)),Z,G,$;w.ori==0?(Z=dc,$=Zo,G=ow):(Z=hc,$=Xo,G=lw);const K=w.dir*(w.ori==0?1:-1);let he=M(h[K==1?a:c]),ue=he,Q=[],ve=[];for(let X=K==1?a:c;X>=a&&X<=c;X+=K)if(m[X]!=null){let fe=h[X],ne=M(fe);Q.push(ue=ne),ve.push(N(m[X]))}const ie={stroke:r(Q,ve,Z,$,G,O),fill:null,clip:null,band:null,gaps:null,flags:Yo},ce=ie.stroke;let[j,te]=rf(s,l);if(d.fill!=null||j!=0){let X=ie.fill=new Path2D(ce),le=d.fillTo(s,l,d.min,d.max,j),fe=N(le);$(X,ue,fe),$(X,he,fe)}if(!d.spanGaps){let X=[];X.push(...of(h,m,a,c,K,M,n)),ie.gaps=X=d.gaps(s,l,a,c,X),ie.clip=cc(X,w.ori,A,D,P,R)}return te!=0&&(ie.band=te==2?[Vs(s,l,a,c,ce,-1),Vs(s,l,a,c,ce,1)]:Vs(s,l,a,c,ce,te)),ie})}function RC(r){return NC(MC,r)}function MC(r,e,n,s,l,a){const c=r.length;if(c<2)return null;const d=new Path2D;if(n(d,r[0],e[0]),c==2)s(d,r[1],e[1]);else{let h=Array(c),m=Array(c-1),w=Array(c-1),v=Array(c-1);for(let S=0;S0!=m[S]>0?h[S]=0:(h[S]=3*(v[S-1]+v[S])/((2*v[S]+v[S-1])/m[S-1]+(v[S]+2*v[S-1])/m[S]),isFinite(h[S])||(h[S]=0));h[c-1]=m[c-2];for(let S=0;S{jn.pxRatio=tt}));const LC=cw(),VC=aw();function zg(r,e,n,s){return(s?[r[0],r[1]].concat(r.slice(2)):[r[0]].concat(r.slice(1))).map((a,c)=>Ph(a,c,e,n))}function GC(r,e){return r.map((n,s)=>s==0?{}:Jt({},e,n))}function Ph(r,e,n,s){return Jt({},e==0?n:s,r)}function dw(r,e,n){return e==null?Uo:[e,n]}const WC=dw;function FC(r,e,n){return e==null?Uo:$u(e,n,Zh,!0)}function hw(r,e,n,s){return e==null?Uo:lc(e,n,r.scales[s].log,!1)}const HC=hw;function fw(r,e,n,s){return e==null?Uo:Qh(e,n,r.scales[s].log,!1)}const jC=fw;function BC(r,e,n,s,l){let a=ti(lg(r),lg(e)),c=e-r,d=is(l/s*c,n);do{let h=n[d],m=s*h/c;if(m>=l&&a+(h<5?yr.get(h):0)<=17)return[h,m]}while(++d(e=rn((n=+l)*tt))+"px"),[r,e,n]}function UC(r){r.show&&[r.font,r.labelFont].forEach(e=>{let n=pt(e[2]*tt,1);e[0]=e[0].replace(/[0-9.]+px/,n+"px"),e[1]=n})}function jn(r,e,n){const s={mode:qe(r.mode,1)},l=s.mode;function a(g,y,C,x){let T=y.valToPct(g);return x+C*(y.dir==-1?1-T:T)}function c(g,y,C,x){let T=y.valToPct(g);return x+C*(y.dir==-1?T:1-T)}function d(g,y,C,x){return y.ori==0?a(g,y,C,x):c(g,y,C,x)}s.valToPosH=a,s.valToPosV=c;let h=!1;s.status=0;const m=s.root=Hi(XS);if(r.id!=null&&(m.id=r.id),Pi(m,r.class),r.title){let g=Hi(tD,m);g.textContent=r.title}const w=ns("canvas"),v=s.ctx=w.getContext("2d"),S=Hi(nD,m);Qr("click",S,g=>{g.target===A&&(Ze!=xs||ot!=Zs)&&tn.click(s,g)},!0);const E=s.under=Hi(iD,S);S.appendChild(w);const A=s.over=Hi(sD,S);r=$o(r);const D=+qe(r.pxAlign,1),P=bg(D);(r.plugins||[]).forEach(g=>{g.opts&&(r=g.opts(s,r)||r)});const R=r.ms||.001,O=s.series=l==1?zg(r.series||[],_g,xg,!1):GC(r.series||[null],Cg),M=s.axes=zg(r.axes||[],wg,Sg,!0),N=s.scales={},Z=s.bands=r.bands||[];Z.forEach(g=>{g.fill=Ye(g.fill||null),g.dir=qe(g.dir,-1)});const G=l==2?O[1].facets[0].scale:O[0].scale,$={axes:da,series:vc},K=(r.drawOrder||["axes","series"]).map(g=>$[g]);function he(g){const y=g.distr==3?C=>Ls(C>0?C:g.clamp(s,C,g.min,g.max,g.key)):g.distr==4?C=>Kd(C,g.asinh):g.distr==100?C=>g.fwd(C):C=>C;return C=>{let x=y(C),{_min:T,_max:V}=g,J=V-T;return(x-T)/J}}function ue(g){let y=N[g];if(y==null){let C=(r.scales||Yl)[g]||Yl;if(C.from!=null){ue(C.from);let x=Jt({},N[C.from],C,{key:g});x.valToPct=he(x),N[g]=x}else{y=N[g]=Jt({},g==G?tw:PC,C),y.key=g;let x=y.time,T=y.range,V=wr(T);if((g!=G||l==2&&!x)&&(V&&(T[0]==null||T[1]==null)&&(T={min:T[0]==null?sg:{mode:1,hard:T[0],soft:T[0]},max:T[1]==null?sg:{mode:1,hard:T[1],soft:T[1]}},V=!1),!V&&uc(T))){let J=T;T=(se,ae,me)=>ae==null?Uo:$u(ae,me,J)}y.range=Ye(T||(x?WC:g==G?y.distr==3?HC:y.distr==4?jC:dw:y.distr==3?hw:y.distr==4?fw:FC)),y.auto=Ye(V?!1:y.auto),y.clamp=Ye(y.clamp||bC),y._min=y._max=null,y.valToPct=he(y)}}}ue("x"),ue("y"),l==1&&O.forEach(g=>{ue(g.scale)}),M.forEach(g=>{ue(g.scale)});for(let g in r.scales)ue(g);const Q=N[G],ve=Q.distr;let ie,ce;Q.ori==0?(Pi(m,qS),ie=a,ce=c):(Pi(m,eD),ie=c,ce=a);const j={};for(let g in N){let y=N[g];(y.min!=null||y.max!=null)&&(j[g]={min:y.min,max:y.max},y.min=y.max=null)}const te=r.tzDate||(g=>new Date(rn(g/R))),X=r.fmtDate||ef,le=R==1?qD(te):nC(te),fe=mg(te,pg(R==1?XD:tC,X)),ne=vg(te,gg(sC,X)),k=[],F=s.legend=Jt({},lC,r.legend),q=s.cursor=Jt({},fC,{drag:{y:l==2}},r.cursor),xe=F.show,Ie=q.show,Se=F.markers;F.idxs=k,Se.width=Ye(Se.width),Se.dash=Ye(Se.dash),Se.stroke=Ye(Se.stroke),Se.fill=Ye(Se.fill);let Ee,We,Fe,Me=[],Zt=[],Wt,Ft=!1,Ht={};if(F.live){const g=O[1]?O[1].values:null;Ft=g!=null,Wt=Ft?g(s,1,0):{_:0};for(let y in Wt)Ht[y]=Kh}if(xe)if(Ee=ns("table",cD,m),Fe=ns("tbody",null,Ee),F.mount(s,Ee),Ft){We=ns("thead",null,Ee,Fe);let g=ns("tr",null,We);ns("th",null,g);for(var ii in Wt)ns("th",Um,g).textContent=ii}else Pi(Ee,hD),F.live&&Pi(Ee,dD);const Tn={show:!0},ki={show:!1};function ls(g,y){if(y==0&&(Ft||!F.live||l==2))return Uo;let C=[],x=ns("tr",fD,Fe,Fe.childNodes[y]);Pi(x,g.class),g.show||Pi(x,Yr);let T=ns("th",null,x);if(Se.show){let se=Hi(pD,T);if(y>0){let ae=Se.width(s,y);ae&&(se.style.border=ae+"px "+Se.dash(s,y)+" "+Se.stroke(s,y)),se.style.background=Se.fill(s,y)}}let V=Hi(Um,T);g.label instanceof HTMLElement?V.appendChild(g.label):V.textContent=g.label,y>0&&(Se.show||(V.style.color=g.width>0?Se.stroke(s,y):Se.fill(s,y)),nt("click",T,se=>{if(q._lock)return;Pn(se);let ae=O.indexOf(g);if((se.ctrlKey||se.metaKey)!=F.isolate){let me=O.some((we,_e)=>_e>0&&_e!=ae&&we.show);O.forEach((we,_e)=>{_e>0&&Si(_e,me?_e==ae?Tn:ki:Tn,!0,Tt.setSeries)})}else Si(ae,{show:!g.show},!0,Tt.setSeries)},!1),Et&&nt(Jm,T,se=>{q._lock||(Pn(se),Si(O.indexOf(g),er,!0,Tt.setSeries))},!1));for(var J in Wt){let se=ns("td",mD,x);se.textContent="--",C.push(se)}return[x,C]}const Un=new Map;function nt(g,y,C,x=!0){const T=Un.get(y)||{},V=q.bind[g](s,y,C,x);V&&(Qr(g,y,T[g]=V),Un.set(y,T))}function cn(g,y,C){const x=Un.get(y)||{};for(let T in x)(g==null||T==g)&&(Sh(T,y,x[T]),delete x[T]);g==null&&Un.delete(y)}let dn=0,pi=0,Le=0,ge=0,et=0,it=0,hn=et,In=it,Xt=Le,kt=ge,fn=0,xn=0,qt=0,En=0;s.bbox={};let as=!1,us=!1,mi=!1,gi=!1,cs=!1,Rt=!1;function ut(g,y,C){(C||g!=s.width||y!=s.height)&&en(g,y),Cs(!1),mi=!0,us=!0,Kn()}function en(g,y){s.width=dn=Le=g,s.height=pi=ge=y,et=it=0,mn(),Nn();let C=s.bbox;fn=C.left=Ur(et*tt,.5),xn=C.top=Ur(it*tt,.5),qt=C.width=Ur(Le*tt,.5),En=C.height=Ur(ge*tt,.5)}const pn=3;function vi(){let g=!1,y=0;for(;!g;){y++;let C=rl(y),x=ca(y);g=y==pn||C&&x,g||(en(s.width,s.height),us=!0)}}function bn({width:g,height:y}){ut(g,y)}s.setSize=bn;function mn(){let g=!1,y=!1,C=!1,x=!1;M.forEach((T,V)=>{if(T.show&&T._show){let{side:J,_size:se}=T,ae=J%2,me=T.label!=null?T.labelSize:0,we=se+me;we>0&&(ae?(Le-=we,J==3?(et+=we,x=!0):C=!0):(ge-=we,J==0?(it+=we,g=!0):y=!0))}}),$n[0]=g,$n[1]=C,$n[2]=y,$n[3]=x,Le-=Yi[1]+Yi[3],et+=Yi[3],ge-=Yi[2]+Yi[0],it+=Yi[0]}function Nn(){let g=et+Le,y=it+ge,C=et,x=it;function T(V,J){switch(V){case 1:return g+=J,g-J;case 2:return y+=J,y-J;case 3:return C-=J,C+J;case 0:return x-=J,x+J}}M.forEach((V,J)=>{if(V.show&&V._show){let se=V.side;V._pos=T(se,V._size),V.label!=null&&(V._lpos=T(se,V.labelSize))}})}if(q.dataIdx==null){let g=q.hover,y=g.skip=new Set(g.skip??[]);y.add(void 0);let C=g.prox=Ye(g.prox),x=g.bias??(g.bias=0);q.dataIdx=(T,V,J,se)=>{if(V==0)return J;let ae=J,me=C(T,V,J,se)??ft,we=me>=0&&me0;)y.has($e[Pe])||(He=Pe);if(x==0||x==1)for(Pe=J;ke==null&&Pe++<$e.length;)y.has($e[Pe])||(ke=Pe);if(He!=null||ke!=null)if(we){let at=He==null?-1/0:ie(Je[He],Q,_e,0),St=ke==null?1/0:ie(Je[ke],Q,_e,0),$t=Ve-at,st=St-Ve;$t<=st?$t<=me&&(ae=He):st<=me&&(ae=ke)}else ae=ke==null?He:He==null?ke:J-He<=ke-J?He:ke}else we&&ln(Ve-ie(Je[J],Q,_e,0))>me&&(ae=null);return ae}}const Pn=g=>{q.event=g};q.idxs=k,q._lock=!1;let je=q.points;je.show=Ye(je.show),je.size=Ye(je.size),je.stroke=Ye(je.stroke),je.width=Ye(je.width),je.fill=Ye(je.fill);const xt=s.focus=Jt({},r.focus||{alpha:.3},q.focus),Et=xt.prox>=0,gn=Et&&je.one;let yt=[],An=[],jt=[];function Oi(g,y){let C=je.show(s,y);if(C instanceof HTMLElement)return Pi(C,uD),Pi(C,g.class),ws(C,-10,-10,Le,ge),A.insertBefore(C,yt[y]),C}function Ws(g,y){if(l==1||y>0){let C=l==1&&N[g.scale].time,x=g.value;g.value=C?cg(x)?vg(te,gg(x,X)):x||ne:x||CC,g.label=g.label||(C?mC:pC)}if(gn||y>0){g.width=g.width==null?1:g.width,g.paths=g.paths||LC||PD,g.fillTo=Ye(g.fillTo||AC),g.pxAlign=+qe(g.pxAlign,D),g.pxRound=bg(g.pxAlign),g.stroke=Ye(g.stroke||null),g.fill=Ye(g.fill||null),g._stroke=g._fill=g._paths=g._focus=null;let C=xC(ti(1,g.width),1),x=g.points=Jt({},{size:C,width:ti(1,C*.2),stroke:g.stroke,space:C*2,paths:VC,_stroke:null,_fill:null},g.points);x.show=Ye(x.show),x.filter=Ye(x.filter),x.fill=Ye(x.fill),x.stroke=Ye(x.stroke),x.paths=Ye(x.paths),x.pxAlign=g.pxAlign}if(xe){let C=ls(g,y);Me.splice(y,0,C[0]),Zt.splice(y,0,C[1]),F.values.push(null)}if(Ie){k.splice(y,0,null);let C=null;gn?y==0&&(C=Oi(g,y)):y>0&&(C=Oi(g,y)),yt.splice(y,0,C),An.splice(y,0,0),jt.splice(y,0,0)}Ut("addSeries",y)}function pc(g,y){y=y??O.length,g=l==1?Ph(g,y,_g,xg):Ph(g,y,{},Cg),O.splice(y,0,g),Ws(O[y],y)}s.addSeries=pc;function mc(g){if(O.splice(g,1),xe){F.values.splice(g,1),Zt.splice(g,1);let y=Me.splice(g,1)[0];cn(null,y.firstChild),y.remove()}Ie&&(k.splice(g,1),yt.splice(g,1)[0].remove(),An.splice(g,1),jt.splice(g,1)),Ut("delSeries",g)}s.delSeries=mc;const $n=[!1,!1,!1,!1];function ra(g,y){if(g._show=g.show,g.show){let C=g.side%2,x=N[g.scale];x==null&&(g.scale=C?O[1].scale:G,x=N[g.scale]);let T=x.time;g.size=Ye(g.size),g.space=Ye(g.space),g.rotate=Ye(g.rotate),wr(g.incrs)&&g.incrs.forEach(J=>{!yr.has(J)&&yr.set(J,Mv(J))}),g.incrs=Ye(g.incrs||(x.distr==2?JD:T?R==1?ZD:eC:$r)),g.splits=Ye(g.splits||(T&&x.distr==1?le:x.distr==3?Ch:x.distr==4?wC:vC)),g.stroke=Ye(g.stroke),g.grid.stroke=Ye(g.grid.stroke),g.ticks.stroke=Ye(g.ticks.stroke),g.border.stroke=Ye(g.border.stroke);let V=g.values;g.values=wr(V)&&!wr(V[0])?Ye(V):T?wr(V)?mg(te,pg(V,X)):cg(V)?iC(te,V):V||fe:V||gC,g.filter=Ye(g.filter||(x.distr>=3&&x.log==10?SC:x.distr==3&&x.log==2?DC:Nv)),g.font=kg(g.font),g.labelFont=kg(g.labelFont),g._size=g.size(s,null,y,0),g._space=g._rotate=g._incrs=g._found=g._splits=g._values=null,g._size>0&&($n[y]=!0,g._el=Hi(rD,S))}}function Fs(g,y,C,x){let[T,V,J,se]=C,ae=y%2,me=0;return ae==0&&(se||V)&&(me=y==0&&!T||y==2&&!J?rn(wg.size/3):0),ae==1&&(T||J)&&(me=y==1&&!V||y==3&&!se?rn(Sg.size/2):0),me}const oa=s.padding=(r.padding||[Fs,Fs,Fs,Fs]).map(g=>Ye(qe(g,Fs))),Yi=s._padding=oa.map((g,y)=>g(s,y,$n,0));let Bt,Mt=null,Lt=null;const to=l==1?O[0].idxs:null;let wi=null,ct=!1;function la(g,y){if(e=g??[],s.data=s._data=e,l==2){Bt=0;for(let C=1;C=0,Rt=!0,Kn()}}s.setData=la;function Sr(){ct=!0;let g,y;l==1&&(Bt>0?(Mt=to[0]=0,Lt=to[1]=Bt-1,g=e[0][Mt],y=e[0][Lt],ve==2?(g=Mt,y=Lt):g==y&&(ve==3?[g,y]=lc(g,g,Q.log,!1):ve==4?[g,y]=Qh(g,g,Q.log,!1):Q.time?y=g+rn(86400/R):[g,y]=$u(g,y,Zh,!0))):(Mt=to[0]=g=null,Lt=to[1]=y=null)),yi(G,g,y)}let Dr,Ki,qo,no,Hs,si,el,Yn,tl,Rn;function aa(g,y,C,x,T,V){g??(g=Ym),C??(C=qh),x??(x="butt"),T??(T=Ym),V??(V="round"),g!=Dr&&(v.strokeStyle=Dr=g),T!=Ki&&(v.fillStyle=Ki=T),y!=qo&&(v.lineWidth=qo=y),V!=Hs&&(v.lineJoin=Hs=V),x!=si&&(v.lineCap=si=x),C!=no&&v.setLineDash(no=C)}function Cr(g,y,C,x){y!=Ki&&(v.fillStyle=Ki=y),g!=el&&(v.font=el=g),C!=Yn&&(v.textAlign=Yn=C),x!=tl&&(v.textBaseline=tl=x)}function js(g,y,C,x,T=0){if(x.length>0&&g.auto(s,ct)&&(y==null||y.min==null)){let V=qe(Mt,0),J=qe(Lt,x.length-1),se=C.min==null?SD(x,V,J,T,g.distr==3):[C.min,C.max];g.min=ss(g.min,C.min=se[0]),g.max=ti(g.max,C.max=se[1])}}const Bs={min:null,max:null};function io(){for(let x in N){let T=N[x];j[x]==null&&(T.min==null||j[G]!=null&&T.auto(s,ct))&&(j[x]=Bs)}for(let x in N){let T=N[x];j[x]==null&&T.from!=null&&j[T.from]!=null&&(j[x]=Bs)}j[G]!=null&&Cs(!0);let g={};for(let x in j){let T=j[x];if(T!=null){let V=g[x]=$o(N[x],kD);if(T.min!=null)Jt(V,T);else if(x!=G||l==2)if(Bt==0&&V.from==null){let J=V.range(s,null,null,x);V.min=J[0],V.max=J[1]}else V.min=ft,V.max=-ft}}if(Bt>0){O.forEach((x,T)=>{if(l==1){let V=x.scale,J=j[V];if(J==null)return;let se=g[V];if(T==0){let ae=se.range(s,se.min,se.max,V);se.min=ae[0],se.max=ae[1],Mt=is(se.min,e[0]),Lt=is(se.max,e[0]),Lt-Mt>1&&(e[0][Mt]se.max&&Lt--),x.min=wi[Mt],x.max=wi[Lt]}else x.show&&x.auto&&js(se,J,x,e[T],x.sorted);x.idxs[0]=Mt,x.idxs[1]=Lt}else if(T>0&&x.show&&x.auto){let[V,J]=x.facets,se=V.scale,ae=J.scale,[me,we]=e[T],_e=g[se],Ve=g[ae];_e!=null&&js(_e,j[se],V,me,V.sorted),Ve!=null&&js(Ve,j[ae],J,we,J.sorted),x.min=J.min,x.max=J.max}});for(let x in g){let T=g[x],V=j[x];if(T.from==null&&(V==null||V.min==null)){let J=T.range(s,T.min==ft?null:T.min,T.max==-ft?null:T.max,x);T.min=J[0],T.max=J[1]}}}for(let x in g){let T=g[x];if(T.from!=null){let V=g[T.from];if(V.min==null)T.min=T.max=null;else{let J=T.range(s,V.min,V.max,x);T.min=J[0],T.max=J[1]}}}let y={},C=!1;for(let x in g){let T=g[x],V=N[x];if(V.min!=T.min||V.max!=T.max){V.min=T.min,V.max=T.max;let J=V.distr;V._min=J==3?Ls(V.min):J==4?Kd(V.min,V.asinh):J==100?V.fwd(V.min):V.min,V._max=J==3?Ls(V.max):J==4?Kd(V.max,V.asinh):J==100?V.fwd(V.max):V.max,y[x]=C=!0}}if(C){O.forEach((x,T)=>{l==2?T>0&&y.y&&(x._paths=null):y[x.scale]&&(x._paths=null)});for(let x in y)mi=!0,Ut("setScale",x);Ie&&q.left>=0&&(gi=Rt=!0)}for(let x in j)j[x]=null}function gc(g){let y=Dh(Mt-1,0,Bt-1),C=Dh(Lt+1,0,Bt-1);for(;g[y]==null&&y>0;)y--;for(;g[C]==null&&C0){let g=O.some(y=>y._focus)&&Rn!=xt.alpha;g&&(v.globalAlpha=Rn=xt.alpha),O.forEach((y,C)=>{if(C>0&&y.show&&(so(C,!1),so(C,!0),y._paths==null)){let x=Rn;Rn!=y.alpha&&(v.globalAlpha=Rn=y.alpha);let T=l==2?[0,e[C][0].length-1]:gc(e[C]);y._paths=y.paths(s,C,T[0],T[1]),Rn!=x&&(v.globalAlpha=Rn=x)}}),O.forEach((y,C)=>{if(C>0&&y.show){let x=Rn;Rn!=y.alpha&&(v.globalAlpha=Rn=y.alpha),y._paths!=null&&nl(C,!1);{let T=y._paths!=null?y._paths.gaps:null,V=y.points.show(s,C,Mt,Lt,T),J=y.points.filter(s,C,V,T);(V||J)&&(y.points._paths=y.points.paths(s,C,Mt,Lt,J),nl(C,!0))}Rn!=x&&(v.globalAlpha=Rn=x),Ut("drawSeries",C)}}),g&&(v.globalAlpha=Rn=1)}}function so(g,y){let C=y?O[g].points:O[g];C._stroke=C.stroke(s,g),C._fill=C.fill(s,g)}function nl(g,y){let C=y?O[g].points:O[g],{stroke:x,fill:T,clip:V,flags:J,_stroke:se=C._stroke,_fill:ae=C._fill,_width:me=C.width}=C._paths;me=pt(me*tt,3);let we=null,_e=me%2/2;y&&ae==null&&(ae=me>0?"#fff":se);let Ve=C.pxAlign==1&&_e>0;if(Ve&&v.translate(_e,_e),!y){let Je=fn-me/2,$e=xn-me/2,He=qt+me,ke=En+me;we=new Path2D,we.rect(Je,$e,He,ke)}y?sl(se,me,C.dash,C.cap,ae,x,T,J,V):il(g,se,me,C.dash,C.cap,ae,x,T,J,we,V),Ve&&v.translate(-_e,-_e)}function il(g,y,C,x,T,V,J,se,ae,me,we){let _e=!1;ae!=0&&Z.forEach((Ve,Je)=>{if(Ve.series[0]==g){let $e=O[Ve.series[1]],He=e[Ve.series[1]],ke=($e._paths||Yl).band;wr(ke)&&(ke=Ve.dir==1?ke[0]:ke[1]);let Pe,at=null;$e.show&&ke&&CD(He,Mt,Lt)?(at=Ve.fill(s,Je)||V,Pe=$e._paths.clip):ke=null,sl(y,C,x,T,at,J,se,ae,me,we,Pe,ke),_e=!0}}),_e||sl(y,C,x,T,V,J,se,ae,me,we)}const Us=Yo|Eh;function sl(g,y,C,x,T,V,J,se,ae,me,we,_e){aa(g,y,C,x,T),(ae||me||_e)&&(v.save(),ae&&v.clip(ae),me&&v.clip(me)),_e?(se&Us)==Us?(v.clip(_e),we&&v.clip(we),Ke(T,J),$s(g,V,y)):se&Eh?(Ke(T,J),v.clip(_e),$s(g,V,y)):se&Yo&&(v.save(),v.clip(_e),we&&v.clip(we),Ke(T,J),v.restore(),$s(g,V,y)):(Ke(T,J),$s(g,V,y)),(ae||me||_e)&&v.restore()}function $s(g,y,C){C>0&&(y instanceof Map?y.forEach((x,T)=>{v.strokeStyle=Dr=T,v.stroke(x)}):y!=null&&g&&v.stroke(y))}function Ke(g,y){y instanceof Map?y.forEach((C,x)=>{v.fillStyle=Ki=x,v.fill(C)}):y!=null&&g&&v.fill(y)}function ua(g,y,C,x){let T=M[g],V;if(x<=0)V=[0,0];else{let J=T._space=T.space(s,g,y,C,x),se=T._incrs=T.incrs(s,g,y,C,x,J);V=BC(y,C,se,x,J)}return T._found=V}function ro(g,y,C,x,T,V,J,se,ae,me){let we=J%2/2;D==1&&v.translate(we,we),aa(se,J,ae,me,se),v.beginPath();let _e,Ve,Je,$e,He=T+(x==0||x==3?-V:V);C==0?(Ve=T,$e=He):(_e=T,Je=He);for(let ke=0;ke{if(!C.show)return;let T=N[C.scale];if(T.min==null){C._show&&(y=!1,C._show=!1,Cs(!1));return}else C._show||(y=!1,C._show=!0,Cs(!1));let V=C.side,J=V%2,{min:se,max:ae}=T,[me,we]=ua(x,se,ae,J==0?Le:ge);if(we==0)return;let _e=T.distr==2,Ve=C._splits=C.splits(s,x,se,ae,me,we,_e),Je=T.distr==2?Ve.map(Pe=>wi[Pe]):Ve,$e=T.distr==2?wi[Ve[1]]-wi[Ve[0]]:me,He=C._values=C.values(s,C.filter(s,Je,x,we,$e),x,we,$e);C._rotate=V==2?C.rotate(s,He,x,we):0;let ke=C._size;C._size=Ui(C.size(s,He,x,g)),ke!=null&&C._size!=ke&&(y=!1)}),y}function ca(g){let y=!0;return oa.forEach((C,x)=>{let T=C(s,x,$n,g);T!=Yi[x]&&(y=!1),Yi[x]=T}),y}function da(){for(let g=0;gwi[zn]):Je,He=we.distr==2?wi[Je[1]]-wi[Je[0]]:ae,ke=y.ticks,Pe=y.border,at=ke.show?ke.size:0,St=rn(at*tt),$t=rn((y.alignTo==2?y._size-at-y.gap:y.gap)*tt),st=y._rotate*-ku/180,Dt=P(y._pos*tt),Qn=(St+$t)*se,dt=Dt+Qn;V=x==0?dt:0,T=x==1?dt:0;let vn=y.font[0],li=y.align==1?Ro:y.align==2?Ud:st>0?Ro:st<0?Ud:x==0?"center":C==3?Ud:Ro,Ci=st||x==1?"middle":C==2?Ml:$m;Cr(vn,J,li,Ci);let Ln=y.font[1]*y.lineGap,Zn=Je.map(zn=>P(d(zn,we,_e,Ve))),Xn=y._values;for(let zn=0;zn{C>0&&(y._paths=null,g&&(l==1?(y.min=null,y.max=null):y.facets.forEach(x=>{x.min=null,x.max=null})))})}let Ys=!1,Ks=!1,ri=[];function ds(){Ks=!1;for(let g=0;g0&&queueMicrotask(ds)}s.batch=xr;function Js(){if(as&&(io(),as=!1),mi&&(vi(),mi=!1),us){if(wt(E,Ro,et),wt(E,Ml,it),wt(E,Gl,Le),wt(E,Wl,ge),wt(A,Ro,et),wt(A,Ml,it),wt(A,Gl,Le),wt(A,Wl,ge),wt(S,Gl,dn),wt(S,Wl,pi),w.width=rn(dn*tt),w.height=rn(pi*tt),M.forEach(({_el:g,_show:y,_size:C,_pos:x,side:T})=>{if(g!=null)if(y){let V=T===3||T===0?C:0,J=T%2==1;wt(g,J?"left":"top",x-V),wt(g,J?"width":"height",C),wt(g,J?"top":"left",J?it:et),wt(g,J?"height":"width",J?ge:Le),yh(g,Yr)}else Pi(g,Yr)}),Dr=Ki=qo=Hs=si=el=Yn=tl=no=null,Rn=1,Or(!0),et!=hn||it!=In||Le!=Xt||ge!=kt){Cs(!1);let g=Le/Xt,y=ge/kt;if(Ie&&!gi&&q.left>=0){q.left*=g,q.top*=y,Ii&&ws(Ii,rn(q.left),0,Le,ge),Qs&&ws(Qs,0,rn(q.top),Le,ge);for(let C=0;C=0&<.width>0){lt.left*=g,lt.width*=g,lt.top*=y,lt.height*=y;for(let C in dl)wt(Es,C,lt[C])}hn=et,In=it,Xt=Le,kt=ge}Ut("setSize"),us=!1}dn>0&&pi>0&&(v.clearRect(0,0,w.width,w.height),Ut("drawClear"),K.forEach(g=>g()),Ut("draw")),lt.show&&cs&&(_i(lt),cs=!1),Ie&&gi&&(bs(null,!0,!1),gi=!1),F.show&&F.live&&Rt&&(kr(),Rt=!1),h||(h=!0,s.status=1,Ut("ready")),ct=!1,Ys=!1}s.redraw=(g,y)=>{mi=y||!1,g!==!1?yi(G,Q.min,Q.max):Kn()};function Ti(g,y){let C=N[g];if(C.from==null){if(Bt==0){let x=C.range(s,y.min,y.max,g);y.min=x[0],y.max=x[1]}if(y.min>y.max){let x=y.min;y.min=y.max,y.max=x}if(Bt>1&&y.min!=null&&y.max!=null&&y.max-y.min<1e-16)return;g==G&&C.distr==2&&Bt>0&&(y.min=is(y.min,e[0]),y.max=is(y.max,e[0]),y.min==y.max&&y.max++),j[g]=y,as=!0,Kn()}}s.setScale=Ti;let ol,oo,Ii,Qs,ll,Er,xs,Zs,Xs,qs,Ze,ot,hs=!1;const tn=q.drag;let Ot=tn.x,bt=tn.y;Ie&&(q.x&&(ol=Hi(lD,A)),q.y&&(oo=Hi(aD,A)),Q.ori==0?(Ii=ol,Qs=oo):(Ii=oo,Qs=ol),Ze=q.left,ot=q.top);const lt=s.select=Jt({show:!0,over:!0,left:0,width:0,top:0,height:0},r.select),Es=lt.show?Hi(oD,lt.over?A:E):null;function _i(g,y){if(lt.show){for(let C in g)lt[C]=g[C],C in dl&&wt(Es,C,g[C]);y!==!1&&Ut("setSelect")}}s.setSelect=_i;function al(g){if(O[g].show)xe&&yh(Me[g],Yr);else if(xe&&Pi(Me[g],Yr),Ie){let C=gn?yt[0]:yt[g];C!=null&&ws(C,-10,-10,Le,ge)}}function yi(g,y,C){Ti(g,{min:y,max:C})}function Si(g,y,C,x){y.focus!=null&&ul(g),y.show!=null&&O.forEach((T,V)=>{V>0&&(g==V||g==null)&&(T.show=y.show,al(V),l==2?(yi(T.facets[0].scale,null,null),yi(T.facets[1].scale,null,null)):yi(T.scale,null,null),Kn())}),C!==!1&&Ut("setSeries",g,y),x&&Tr("setSeries",s,g,y)}s.setSeries=Si;function lo(g,y){Jt(Z[g],y)}function ao(g,y){g.fill=Ye(g.fill||null),g.dir=qe(g.dir,-1),y=y??Z.length,Z.splice(y,0,g)}function ha(g){g==null?Z.length=0:Z.splice(g,1)}s.addBand=ao,s.setBand=lo,s.delBand=ha;function Jn(g,y){O[g].alpha=y,Ie&&yt[g]!=null&&(yt[g].style.opacity=y),xe&&Me[g]&&(Me[g].style.opacity=y)}let Mn,Ni,Di;const er={focus:!0};function ul(g){if(g!=Di){let y=g==null,C=xt.alpha!=1;O.forEach((x,T)=>{if(l==1||T>0){let V=y||T==0||T==g;x._focus=y?null:V,C&&Jn(T,V?1:xt.alpha)}}),Di=g,C&&Kn()}}xe&&Et&&nt(Qm,Ee,g=>{q._lock||(Pn(g),Di!=null&&Si(null,er,!0,Tt.setSeries))});function oi(g,y,C){let x=N[y];C&&(g=g/tt-(x.ori==1?it:et));let T=Le;x.ori==1&&(T=ge,g=T-g),x.dir==-1&&(g=T-g);let V=x._min,J=x._max,se=g/T,ae=V+(J-V)*se,me=x.distr;return me==3?Bo(10,ae):me==4?ED(ae,x.asinh):me==100?x.bwd(ae):ae}function br(g,y){let C=oi(g,G,y);return is(C,e[0],Mt,Lt)}s.valToIdx=g=>is(g,e[0]),s.posToIdx=br,s.posToVal=oi,s.valToPos=(g,y,C)=>N[y].ori==0?a(g,N[y],C?qt:Le,C?fn:0):c(g,N[y],C?En:ge,C?xn:0),s.setCursor=(g,y,C)=>{Ze=g.left,ot=g.top,bs(null,y,C)};function Pr(g,y){wt(Es,Ro,lt.left=g),wt(Es,Gl,lt.width=y)}function cl(g,y){wt(Es,Ml,lt.top=g),wt(Es,Wl,lt.height=y)}let Ar=Q.ori==0?Pr:cl,zr=Q.ori==1?Pr:cl;function wc(){if(xe&&F.live)for(let g=l==2?1:0;g{k[x]=C}):zD(g.idx)||k.fill(g.idx),F.idx=k[0]),xe&&F.live){for(let C=0;C0||l==1&&!Ft)&&_c(C,k[C]);wc()}Rt=!1,y!==!1&&Ut("setLegend")}s.setLegend=kr;function _c(g,y){let C=O[g],x=g==0&&ve==2?wi:e[g],T;Ft?T=C.values(s,g,y)??Ht:(T=C.value(s,y==null?null:x[y],g,y),T=T==null?Ht:{_:T}),F.values[g]=T}function bs(g,y,C){Xs=Ze,qs=ot,[Ze,ot]=q.move(s,Ze,ot),q.left=Ze,q.top=ot,Ie&&(Ii&&ws(Ii,rn(Ze),0,Le,ge),Qs&&ws(Qs,0,rn(ot),Le,ge));let x,T=Mt>Lt;Mn=ft,Ni=null;let V=Q.ori==0?Le:ge,J=Q.ori==1?Le:ge;if(Ze<0||Bt==0||T){x=q.idx=null;for(let se=0;se0&&at.show){let Qn=st==null?-10:st==x?me:ie(l==1?e[0][st]:e[Pe][0][st],Q,V,0),dt=Dt==null?-10:ce(Dt,l==1?N[at.scale]:N[at.facets[1].scale],J,0);if(Et&&Dt!=null){let vn=Q.ori==1?Ze:ot,li=ln(xt.dist(s,Pe,st,dt,vn));if(li=0?1:-1,Xn=Ln>=0?1:-1;Xn==Zn&&(Xn==1?Ci==1?Dt>=Ln:Dt<=Ln:Ci==1?Dt<=Ln:Dt>=Ln)&&(Mn=li,Ni=Pe)}else Mn=li,Ni=Pe}}if(Rt||gn){let vn,li;Q.ori==0?(vn=Qn,li=dt):(vn=dt,li=Qn);let Ci,Ln,Zn,Xn,Ri,zn,Yt=!0,Ji=je.bbox;if(Ji!=null){Yt=!1;let Vt=Ji(s,Pe);Zn=Vt.left,Xn=Vt.top,Ci=Vt.width,Ln=Vt.height}else Zn=vn,Xn=li,Ci=Ln=je.size(s,Pe);if(zn=je.fill(s,Pe),Ri=je.stroke(s,Pe),gn)Pe==Ni&&Mn<=xt.prox&&(we=Zn,_e=Xn,Ve=Ci,Je=Ln,$e=Yt,He=zn,ke=Ri);else{let Vt=yt[Pe];Vt!=null&&(An[Pe]=Zn,jt[Pe]=Xn,ig(Vt,Ci,Ln,Yt),tg(Vt,zn,Ri),ws(Vt,Ui(Zn),Ui(Xn),Le,ge))}}}}if(gn){let Pe=xt.prox,at=Di==null?Mn<=Pe:Mn>Pe||Ni!=Di;if(Rt||at){let St=yt[0];St!=null&&(An[0]=we,jt[0]=_e,ig(St,Ve,Je,$e),tg(St,He,ke),ws(St,Ui(we),Ui(_e),Le,ge))}}}if(lt.show&&hs)if(g!=null){let[se,ae]=Tt.scales,[me,we]=Tt.match,[_e,Ve]=g.cursor.sync.scales,Je=g.cursor.drag;if(Ot=Je._x,bt=Je._y,Ot||bt){let{left:$e,top:He,width:ke,height:Pe}=g.select,at=g.scales[_e].ori,St=g.posToVal,$t,st,Dt,Qn,dt,vn=se!=null&&me(se,_e),li=ae!=null&&we(ae,Ve);vn&&Ot?(at==0?($t=$e,st=ke):($t=He,st=Pe),Dt=N[se],Qn=ie(St($t,_e),Dt,V,0),dt=ie(St($t+st,_e),Dt,V,0),Ar(ss(Qn,dt),ln(dt-Qn))):Ar(0,V),li&&bt?(at==1?($t=$e,st=ke):($t=He,st=Pe),Dt=N[ae],Qn=ce(St($t,Ve),Dt,J,0),dt=ce(St($t+st,Ve),Dt,J,0),zr(ss(Qn,dt),ln(dt-Qn))):zr(0,J)}else hl()}else{let se=ln(Xs-ll),ae=ln(qs-Er);if(Q.ori==1){let Ve=se;se=ae,ae=Ve}Ot=tn.x&&se>=tn.dist,bt=tn.y&&ae>=tn.dist;let me=tn.uni;me!=null?Ot&&bt&&(Ot=se>=me,bt=ae>=me,!Ot&&!bt&&(ae>se?bt=!0:Ot=!0)):tn.x&&tn.y&&(Ot||bt)&&(Ot=bt=!0);let we,_e;Ot&&(Q.ori==0?(we=xs,_e=Ze):(we=Zs,_e=ot),Ar(ss(we,_e),ln(_e-we)),bt||zr(0,J)),bt&&(Q.ori==1?(we=xs,_e=Ze):(we=Zs,_e=ot),zr(ss(we,_e),ln(_e-we)),Ot||Ar(0,V)),!Ot&&!bt&&(Ar(0,0),zr(0,0))}if(tn._x=Ot,tn._y=bt,g==null){if(C){if(fo!=null){let[se,ae]=Tt.scales;Tt.values[0]=se!=null?oi(Q.ori==0?Ze:ot,se):null,Tt.values[1]=ae!=null?oi(Q.ori==1?Ze:ot,ae):null}Tr($d,s,Ze,ot,Le,ge,x)}if(Et){let se=C&&Tt.setSeries,ae=xt.prox;Di==null?Mn<=ae&&Si(Ni,er,!0,se):Mn>ae?Si(null,er,!0,se):Ni!=Di&&Si(Ni,er,!0,se)}}Rt&&(F.idx=x,kr()),y!==!1&&Ut("setCursor")}let fs=null;Object.defineProperty(s,"rect",{get(){return fs==null&&Or(!1),fs}});function Or(g=!1){g?fs=null:(fs=A.getBoundingClientRect(),Ut("syncRect",fs))}function fa(g,y,C,x,T,V,J){q._lock||hs&&g!=null&&g.movementX==0&&g.movementY==0||(uo(g,y,C,x,T,V,J,!1,g!=null),g!=null?bs(null,!0,!0):bs(y,!0,!1))}function uo(g,y,C,x,T,V,J,se,ae){if(fs==null&&Or(!1),Pn(g),g!=null)C=g.clientX-fs.left,x=g.clientY-fs.top;else{if(C<0||x<0){Ze=-10,ot=-10;return}let[me,we]=Tt.scales,_e=y.cursor.sync,[Ve,Je]=_e.values,[$e,He]=_e.scales,[ke,Pe]=Tt.match,at=y.axes[0].side%2==1,St=Q.ori==0?Le:ge,$t=Q.ori==1?Le:ge,st=at?V:T,Dt=at?T:V,Qn=at?x:C,dt=at?C:x;if($e!=null?C=ke(me,$e)?d(Ve,N[me],St,0):-10:C=St*(Qn/st),He!=null?x=Pe(we,He)?d(Je,N[we],$t,0):-10:x=$t*(dt/Dt),Q.ori==1){let vn=C;C=x,x=vn}}ae&&(y==null||y.cursor.event.type==$d)&&((C<=1||C>=Le-1)&&(C=Ur(C,Le)),(x<=1||x>=ge-1)&&(x=Ur(x,ge))),se?(ll=C,Er=x,[xs,Zs]=q.move(s,C,x)):(Ze=C,ot=x)}const dl={width:0,height:0,left:0,top:0};function hl(){_i(dl,!1)}let pa,ma,co,ga;function va(g,y,C,x,T,V,J){hs=!0,Ot=bt=tn._x=tn._y=!1,uo(g,y,C,x,T,V,J,!0,!1),g!=null&&(nt(Yd,wh,wa,!1),Tr(Km,s,xs,Zs,Le,ge,null));let{left:se,top:ae,width:me,height:we}=lt;pa=se,ma=ae,co=me,ga=we}function wa(g,y,C,x,T,V,J){hs=tn._x=tn._y=!1,uo(g,y,C,x,T,V,J,!1,!0);let{left:se,top:ae,width:me,height:we}=lt,_e=me>0||we>0,Ve=pa!=se||ma!=ae||co!=me||ga!=we;if(_e&&Ve&&_i(lt),tn.setScale&&_e&&Ve){let Je=se,$e=me,He=ae,ke=we;if(Q.ori==1&&(Je=ae,$e=we,He=se,ke=me),Ot&&yi(G,oi(Je,G),oi(Je+$e,G)),bt)for(let Pe in N){let at=N[Pe];Pe!=G&&at.from==null&&at.min!=ft&&yi(Pe,oi(He+ke,Pe),oi(He,Pe))}hl()}else q.lock&&(q._lock=!q._lock,bs(y,!0,g!=null));g!=null&&(cn(Yd,wh),Tr(Yd,s,Ze,ot,Le,ge,null))}function _a(g,y,C,x,T,V,J){if(q._lock)return;Pn(g);let se=hs;if(hs){let ae=!0,me=!0,we=10,_e,Ve;Q.ori==0?(_e=Ot,Ve=bt):(_e=bt,Ve=Ot),_e&&Ve&&(ae=Ze<=we||Ze>=Le-we,me=ot<=we||ot>=ge-we),_e&&ae&&(Ze=Ze{let T=Tt.match[2];C=T(s,y,C),C!=-1&&Si(C,x,!0,!1)},Ie&&(nt(Km,A,va),nt($d,A,fa),nt(Jm,A,g=>{Pn(g),Or(!1)}),nt(Qm,A,_a),nt(Zm,A,ya),bh.add(s),s.syncRect=Or);const ho=s.hooks=r.hooks||{};function Ut(g,y,C){Ks?ri.push([g,y,C]):g in ho&&ho[g].forEach(x=>{x.call(null,s,y,C)})}(r.plugins||[]).forEach(g=>{for(let y in g.hooks)ho[y]=(ho[y]||[]).concat(g.hooks[y])});const Da=(g,y,C)=>C,Tt=Jt({key:null,setSeries:!1,filters:{pub:ag,sub:ag},scales:[G,O[1]?O[1].scale:null],match:[ug,ug,Da],values:[null,null]},q.sync);Tt.match.length==2&&Tt.match.push(Da),q.sync=Tt;const fo=Tt.key,Ps=nw(fo);function Tr(g,y,C,x,T,V,J){Tt.filters.pub(g,y,C,x,T,V,J)&&Ps.pub(g,y,C,x,T,V,J)}Ps.sub(s);function Ca(g,y,C,x,T,V,J){Tt.filters.sub(g,y,C,x,T,V,J)&&tr[g](null,y,C,x,T,V,J)}s.pub=Ca;function xa(){Ps.unsub(s),bh.delete(s),Un.clear(),Sh(Uu,Fo,Sa),m.remove(),Ee==null||Ee.remove(),Ut("destroy")}s.destroy=xa;function po(){Ut("init",r,e),la(e||r.data,!1),j[G]?Ti(G,j[G]):Sr(),cs=lt.show&&(lt.width>0||lt.height>0),gi=Rt=!0,ut(r.width,r.height)}return O.forEach(Ws),M.forEach(ra),n?n instanceof HTMLElement?(n.appendChild(m),po()):n(s,po):po(),s}jn.assign=Jt;jn.fmtNum=Xh;jn.rangeNum=$u;jn.rangeLog=lc;jn.rangeAsinh=Qh;jn.orient=eo;jn.pxRatio=tt;jn.join=MD;jn.fmtDate=ef,jn.tzDate=YD;jn.sync=nw;{jn.addGap=zC,jn.clipGaps=cc;let r=jn.paths={points:aw};r.linear=cw,r.stepped=TC,r.bars=IC,r.spline=RC}const $C=6e3;class YC{constructor(e=$C){Tl(this,"t");Tl(this,"v");Tl(this,"len",0);Tl(this,"head",0);this.t=new Float64Array(e),this.v=new Float64Array(e)}push(e,n){const s=this.t.length;this.t[this.head]=e,this.v[this.head]=n,this.head=(this.head+1)%s,this.len=e&&(a[d]=this.t[m],c[d]=this.v[m],d++)}return{t:a.subarray(0,d),v:c.subarray(0,d)}}last(){if(this.len===0)return null;const e=this.t.length;return this.v[(this.head-1+e)%e]}}const Ah=new Map;function KC(r){let e=Ah.get(r);return e||(e=new YC,Ah.set(r,e)),e}function pw(r,e){const n=KC(r);for(const[s,l]of e)n.push(s,l)}function mw(r,e=-1/0){const n=Ah.get(r);return n?n.read(e):{t:new Float64Array(0),v:new Float64Array(0)}}const Ho=new Map;let Ou=[];function gw(){Ou.forEach(r=>r())}function JC(r){Ho.set(r,(Ho.get(r)||0)+1),gw()}function QC(r){const e=(Ho.get(r)||0)-1;e<=0?Ho.delete(r):Ho.set(r,e),gw()}function ZC(){return Array.from(Ho.keys())}function XC(r){return Ou.push(r),()=>{Ou=Ou.filter(e=>e!==r)}}const Og=3e3;let Go=[],Tu=[];function qC(r){r.length&&(Go=Go.concat(r),Go.length>Og&&(Go=Go.slice(-Og)),Tu.forEach(e=>e()))}function ex(){return Go}function tx(r){return Tu.push(r),()=>{Tu=Tu.filter(e=>e!==r)}}let Iu=0,Nu=[];function Tg(r){Iu+=r?1:-1,Iu<0&&(Iu=0),Nu.forEach(e=>e())}function nx(){return Iu>0}function ix(r){return Nu.push(r),()=>{Nu=Nu.filter(e=>e!==r)}}let Zr=null,Xd=null;function sx(){return`${location.protocol==="https:"?"wss":"ws"}://${location.host}/api/monitor/stream`}function Ig(){Zr&&Zr.readyState===WebSocket.OPEN&&Zr.send(JSON.stringify({type:"subscribe",signals:ZC()}))}function Ng(){Zr&&Zr.readyState===WebSocket.OPEN&&Zr.send(JSON.stringify({type:"raw",enabled:nx()}))}function vw(){const r=new WebSocket(sx());Zr=r,r.onopen=()=>{Cn.getState().setConnected(!0),Ig(),Ng()},r.onclose=()=>{Cn.getState().setConnected(!1),Xd==null&&(Xd=window.setTimeout(()=>{Xd=null,vw()},1e3))},r.onerror=()=>r.close(),r.onmessage=n=>{let s;try{s=JSON.parse(n.data)}catch{return}const l=Cn.getState();switch(s.type){case"meta":l.setMeta(s.signals,s.pairs),l.setMotors(s.motors);break;case"motors":l.setMotors(s.motors),s.status&&l.setStatus(s.status);break;case"samples":for(const[a,c]of Object.entries(s.data))pw(a,c);break;case"raw":qC(s.frames);break}};let e=null;XC(()=>{e==null&&(e=window.setTimeout(()=>{e=null,Ig()},80))}),ix(Ng)}async function rx(r,e=600){return r.length?(await fetch(`/api/monitor/snapshot?signals=${r.join(",")}&n=${e}`)).json():{}}async function ox(){try{return(await(await fetch("/api/monitor/motor-types")).json()).types||[]}catch{return[]}}async function lx(r,e){await fetch("/api/monitor/motor-type",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({motorId:r,motorType:e})})}const Rg=2e3;function ax(r,e){const n=r.map(c=>mw(c,e)),s=new Set;for(const c of n)for(let d=0;dc-d);if(l.length>Rg){const c=Math.ceil(l.length/Rg);l=l.filter((d,h)=>h%c===0)}const a=[l];for(const c of n){const d=new Array(l.length).fill(null);let h=0,m=null;for(let w=0;wD.ensurePlot),n=Cn(D=>D.removeSignalFromPlot),s=Cn(D=>D.setPlotConfig),l=Cn(D=>D.plotConfigs[r]),a=Cn(D=>D.signals);B.useEffect(()=>{e(r)},[r,e]);const c=(l==null?void 0:l.signals)??[],d=(l==null?void 0:l.duration)??10,h=c.join("|"),{setNodeRef:m,isOver:w}=W_({id:`plot:${r}`,data:{panelId:r}}),v=B.useRef(null),S=B.useRef(null),E=B.useRef(0);B.useEffect(()=>{if(!v.current)return;const D=v.current,P=new Map(a.map(Z=>[Z.id,Z])),R=[{label:"t"},...c.map(Z=>{const G=P.get(Z),$=G?zu(G):"#8b949e";return{label:ah(Z),stroke:$,width:1.5,dash:xm(Z)?[6,4]:void 0,points:{show:!1}}})],O={width:D.clientWidth||400,height:D.clientHeight||220,legend:{show:!1},series:R,cursor:{y:!1,points:{show:!0}},scales:{x:{time:!1}},axes:[{stroke:"#8b949e",grid:{stroke:"rgba(139,148,158,0.12)"},ticks:{stroke:"rgba(139,148,158,0.2)"},values:(Z,G)=>G.map($=>($-E.current).toFixed(1)+"s")},{stroke:"#8b949e",grid:{stroke:"rgba(139,148,158,0.12)"},ticks:{stroke:"rgba(139,148,158,0.2)"}}]},M=new jn(O,[[],...c.map(()=>[])],D);S.current=M;const N=new ResizeObserver(()=>{M.setSize({width:D.clientWidth,height:D.clientHeight})});return N.observe(D),()=>{N.disconnect(),M.destroy(),S.current=null}},[h,a.length]),B.useEffect(()=>{if(!c.length)return;c.forEach(JC);let D=!1;return rx(c,1200).then(P=>{if(!D)for(const[R,O]of Object.entries(P))pw(R,O)}),()=>{D=!0,c.forEach(QC)}},[h]),B.useEffect(()=>{let D=0;const P=()=>{const R=S.current;if(R&&c.length){let O=0;for(const N of c){const Z=mw(N);Z.t.length&&(O=Math.max(O,Z.t[Z.t.length-1]))}E.current=O;const M=ax(c,O-d);R.setData(M,!1),R.setScale("x",{min:O-d,max:O})}D=requestAnimationFrame(P)};return D=requestAnimationFrame(P),()=>cancelAnimationFrame(D)},[h,d]);const A=B.useMemo(()=>new Map(a.map(D=>[D.id,D])),[a]);return Y.jsxs("div",{className:"panel plot-panel",ref:m,children:[Y.jsxs("div",{className:"plot-toolbar",children:[Y.jsx("span",{className:"muted",children:"window"}),Y.jsx("select",{value:d,onChange:D=>s(r,{duration:Number(D.target.value)}),children:[5,10,20,30,60].map(D=>Y.jsxs("option",{value:D,children:[D,"s"]},D))}),Y.jsx("div",{className:"legend",children:c.map(D=>{const P=A.get(D);return Y.jsxs("span",{className:"legend-chip",style:{borderColor:P?zu(P):"#555"},children:[Y.jsx("span",{className:"legend-swatch",style:{background:P?zu(P):"#555",borderStyle:xm(D)?"dashed":"solid"}}),ah(D),Y.jsx("button",{className:"legend-x",onClick:()=>n(r,D),children:"×"})]},D)})})]}),Y.jsx("div",{className:"plot-host"+(w?" drop-over":""),ref:v,children:c.length===0&&Y.jsx("div",{className:"drop-hint",children:"Drag signals here to plot — drop cmd onto fb to overlay"})})]})}const qd=[["pos","cmd p"],["vel","cmd v"],["kp","kp"],["kd","kd"],["torque","cmd τ"]],eh=[["pos","act p"],["vel","act v"],["torque","act τ"],["t_mos","Tmos"],["t_rotor","Trot"]];function cx(){const r=Cn(e=>e.motors);return Y.jsx("div",{className:"panel table-panel",children:Y.jsxs("table",{className:"motor-table",children:[Y.jsx("thead",{children:Y.jsxs("tr",{children:[Y.jsx("th",{children:"Motor"}),Y.jsx("th",{children:"Mode"}),Y.jsx("th",{children:"Status"}),qd.map(([e,n])=>Y.jsx("th",{className:"cmd-col",children:n},"c"+e)),eh.map(([e,n])=>Y.jsx("th",{children:n},"f"+e))]})}),Y.jsxs("tbody",{children:[r.length===0&&Y.jsx("tr",{children:Y.jsx("td",{colSpan:3+qd.length+eh.length,className:"muted center",children:"Waiting for traffic…"})}),r.map(e=>Y.jsxs("tr",{children:[Y.jsxs("td",{className:"mono",children:["m",e.motorId]}),Y.jsx("td",{className:"muted",children:e.mode||"—"}),Y.jsx("td",{children:Y.jsx("span",{className:"status-pill "+(e.status==="ENABLED"?"ok":e.status==="DISABLED"?"off":"warn"),children:e.status||"—"})}),qd.map(([n])=>Y.jsx("td",{className:"mono cmd-col",children:jo(e.cmd[n],n==="kp"?0:3)},"c"+n)),eh.map(([n])=>Y.jsx("td",{className:"mono",children:jo(e.fb[n],n.startsWith("t_")?1:3)},"f"+n))]},`${e.bus}:${e.motorId}`))]})]})})}function th({label:r,cmd:e,act:n,unit:s,digits:l=2}){return Y.jsxs("div",{className:"metric",children:[Y.jsxs("div",{className:"metric-label",children:[r," ",Y.jsx("span",{className:"muted",children:s})]}),Y.jsxs("div",{className:"metric-values",children:[Y.jsx("span",{className:"metric-act",children:jo(n,l)}),e!==void 0&&Y.jsxs("span",{className:"metric-cmd",children:["⌖ ",jo(e,l)]})]})]})}function dx(){const r=Cn(n=>n.motors),e=Cn(n=>n.motorTypes);return Y.jsxs("div",{className:"panel cards-panel",children:[r.length===0&&Y.jsx("div",{className:"muted center pad",children:"Waiting for traffic…"}),Y.jsx("div",{className:"cards-grid",children:r.map(n=>Y.jsxs("div",{className:"motor-card",children:[Y.jsxs("div",{className:"motor-card-head",children:[Y.jsxs("span",{className:"mono strong",children:["Motor ",n.motorId]}),Y.jsx("span",{className:"status-pill "+(n.status==="ENABLED"?"ok":n.status==="DISABLED"?"off":"warn"),children:n.status||"—"})]}),Y.jsxs("div",{className:"motor-card-sub",children:[Y.jsx("span",{className:"muted",children:n.mode||"—"}),e.length>0&&Y.jsxs("select",{className:"type-select",defaultValue:"",onChange:s=>s.target.value&&lx(n.motorId,s.target.value),title:"Override motor type used to scale this motor's values",children:[Y.jsx("option",{value:"",children:"set type…"}),e.map(s=>Y.jsx("option",{value:s,children:s},s))]})]}),Y.jsx(th,{label:"Position",unit:"rad",cmd:n.cmd.pos,act:n.fb.pos,digits:3}),Y.jsx(th,{label:"Velocity",unit:"rad/s",cmd:n.cmd.vel,act:n.fb.vel,digits:2}),Y.jsx(th,{label:"Torque",unit:"Nm",cmd:n.cmd.torque,act:n.fb.torque,digits:2}),Y.jsxs("div",{className:"temp-row",children:[Y.jsxs("span",{children:["MOS ",jo(n.fb.t_mos,1),"°"]}),Y.jsxs("span",{children:["Rotor ",jo(n.fb.t_rotor,1),"°"]})]})]},`${n.bus}:${n.motorId}`))})]})}function hx(r,e,n){const s=new Array(r);return new Proxy(s,{get(l,a,c){if(typeof a=="string"){const d=a.charCodeAt(0);if(d>=48&&d<=57){const h=+a;if(Number.isInteger(h)&&h>=0&&hs[w]!==m))&&(s=d,l=e(...d),n!=null&&n.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(l),a=!1),l}return c.updateDeps=d=>{s=d},c}function Mg(r,e){if(r===void 0)throw new Error("Unexpected undefined");return r}const fx=(r,e)=>Math.abs(r-e)<1.01,px=(r,e,n)=>{let s;return function(...l){r.clearTimeout(s),s=r.setTimeout(()=>e.apply(this,l),n)}};let Vl;const nh=()=>{if(Vl!==void 0)return Vl;if(typeof navigator>"u")return Vl=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Vl=!0;const r=navigator.maxTouchPoints;return Vl=navigator.platform==="MacIntel"&&r!==void 0&&r>0},Lg=r=>{const{offsetWidth:e,offsetHeight:n}=r;return{width:e,height:n}},mx=r=>r,gx=r=>{const e=Math.max(r.startIndex-r.overscan,0),s=Math.min(r.endIndex+r.overscan,r.count-1)-e+1,l=new Array(s);for(let a=0;a{const n=r.scrollElement;if(!n)return;const s=r.targetWindow;if(!s)return;const l=c=>{const{width:d,height:h}=c;e({width:Math.round(d),height:Math.round(h)})};if(l(Lg(n)),!s.ResizeObserver)return()=>{};const a=new s.ResizeObserver(c=>{const d=()=>{const h=c[0];if(h!=null&&h.borderBoxSize){const m=h.borderBoxSize[0];if(m){l({width:m.inlineSize,height:m.blockSize});return}}l(Lg(n))};r.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(d):d()});return a.observe(n,{box:"border-box"}),()=>{a.unobserve(n)}},Ku={passive:!0},wx=typeof window>"u"?!0:"onscrollend"in window,_x=(r,e,n)=>{const s=r.scrollElement;if(!s)return;const l=r.targetWindow;if(!l)return;const a=r.options.useScrollendEvent&&wx;let c=0;const d=a?null:px(l,()=>e(c,!1),r.options.isScrollingResetDelay),h=v=>()=>{c=n(s),d==null||d(),e(c,v)},m=h(!0),w=h(!1);return s.addEventListener("scroll",m,Ku),a&&s.addEventListener("scrollend",w,Ku),()=>{s.removeEventListener("scroll",m),a&&s.removeEventListener("scrollend",w)}},yx=(r,e)=>_x(r,e,n=>{const{horizontal:s,isRtl:l}=r.options;return s?n.scrollLeft*(l&&-1||1):n.scrollTop}),Sx=(r,e,n)=>{if(n.options.useCachedMeasurements){const s=n.indexFromElement(r),l=n.options.getItemKey(s);return n.itemSizeCache.get(l)??n.options.estimateSize(s)}if(e!=null&&e.borderBoxSize){const s=e.borderBoxSize[0];if(s)return Math.round(s[n.options.horizontal?"inlineSize":"blockSize"])}if(!e){const s=n.indexFromElement(r),l=n.options.getItemKey(s),a=n.itemSizeCache.get(l);if(a!==void 0)return a}return r[n.options.horizontal?"offsetWidth":"offsetHeight"]},Dx=(r,{adjustments:e=0,behavior:n},s)=>{var l,a;(a=(l=s.scrollElement)==null?void 0:l.scrollTo)==null||a.call(l,{[s.options.horizontal?"left":"top"]:r+e,behavior:n})},Cx=Dx;class xx{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var n,s,l;return((l=(s=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:s.now)==null?void 0:l.call(s))??Date.now()},this.observer=(()=>{let n=null;const s=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(l=>{l.forEach(a=>{const c=()=>{const d=a.target,h=this.indexFromElement(d);if(!d.isConnected){this.observer.unobserve(d);for(const[m,w]of this.elementsCache)if(w===d){this.elementsCache.delete(m);break}return}this.shouldMeasureDuringScroll(h)&&this.resizeItem(h,this.options.measureElement(d,a,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(c):c()})}));return{disconnect:()=>{var l;(l=s())==null||l.disconnect(),n=null},observe:l=>{var a;return(a=s())==null?void 0:a.observe(l,{box:"border-box"})},unobserve:l=>{var a;return(a=s())==null?void 0:a.unobserve(l)}}})(),this.range=null,this.setOptions=n=>{var s,l;const a={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:mx,rangeExtractor:gx,onChange:()=>{},measureElement:Sx,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const S in n){const E=n[S];E!==void 0&&(a[S]=E)}const c=this.options;let d=null,h=null,m=!1;if(c!==void 0&&c.enabled&&a.enabled&&a.anchorTo==="end"&&this.scrollElement!==null){const S=c.count,E=a.count,A=this.getMeasurements(),D=S>0?((s=A[0])==null?void 0:s.key)??c.getItemKey(0):null,P=S>0?((l=A[S-1])==null?void 0:l.key)??c.getItemKey(S-1):null;if(E!==S||S>0&&E>0&&(a.getItemKey(0)!==D||a.getItemKey(E-1)!==P)){m=!0;const M=S>0?this.getVirtualItemForOffset(this.getScrollOffset())??A[0]:null;M&&(d=[M.key,this.getScrollOffset()-M.start]);const N=a.followOnAppend===!0?"auto":a.followOnAppend||null;N&&E>S&&this.isAtEnd(c.scrollEndThreshold)&&(S===0||a.getItemKey(E-1)!==P)&&(h=N)}}this.options=a,m&&(this.pendingMin=0,this.itemSizeCacheVersion++);let w=!1,v=0;if(d&&this.scrollOffset!==null){const[S,E]=d,A=this.getMeasurements(),{count:D,getItemKey:P}=this.options;let R=0;for(;R{var s,l;(l=(s=this.options).onChange)==null||l.call(s,this,n)},this.maybeNotify=Mo(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}if(this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(a=>{this.observer.observe(a)}),this.unsubs.push(this.options.observeElementRect(this,a=>{this.scrollRect=a,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(a,c)=>{this._intendedScrollOffset!==null&&Math.abs(a-this._intendedScrollOffset)<1.5&&(a=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=c?this.getScrollOffset(){this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},d=()=>{this._iosTouching=!1,!(!nh()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};a.addEventListener("touchstart",c,Ku),a.addEventListener("touchend",d,Ku),this.unsubs.push(()=>{a.removeEventListener("touchstart",c),a.removeEventListener("touchend",d),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const l=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,l&&this.scrollElement&&this.options.enabled){const[a,c,d,h]=l;a!==null&&!d&&(nh()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?h!==0&&(this._iosDeferredAdjustment+=h):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),d&&this.scrollToEnd({behavior:d})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const n=this.getScrollOffset(),s=this.getMaxScrollOffset();if(n<0||n>s)return;const l=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(n,{adjustments:this.scrollAdjustments+=l,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,s)=>{const l=new Map,a=new Map;for(let c=s-1;c>=0;c--){const d=n[c];if(l.has(d.lane))continue;const h=a.get(d.lane);if(h==null||d.end>h.end?a.set(d.lane,d):d.endc.end===d.end?c.index-d.index:c.end-d.end)[0]:void 0},this.getMeasurementOptions=Mo(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(n,s,l,a,c,d,h)=>(this.prevLanes!==void 0&&this.prevLanes!==d&&(this.lanesChangedFlag=!0),this.prevLanes=d,this.pendingMin=null,{count:n,paddingStart:s,scrollMargin:l,getItemKey:a,enabled:c,lanes:d,laneAssignmentMode:h}),{key:!1}),this.getMeasurements=Mo(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:s,scrollMargin:l,getItemKey:a,enabled:c,lanes:d,laneAssignmentMode:h},m)=>{const w=this.itemSizeCache;if(!c)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const A of this.laneAssignments.keys())A>=n&&this.laneAssignments.delete(A);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(A=>{this.itemSizeCache.set(A.key,A.size)}));const v=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1),d===1){const A=this.options.gap,D=n*2;let P=this._flatMeasurements;if(!P||P.length0&&M.set(P.subarray(0,v*2)),P=M,this._flatMeasurements=P}let R;if(v===0)R=s+l;else{const M=v-1;R=P[M*2]+P[M*2+1]+A}for(let M=v;M1){R=P;const $=E[R],K=$!==void 0?S[$]:void 0;O=K?K.end+this.options.gap:s+l}else{const $=this.options.lanes===1?S[A-1]:this.getFurthestMeasurement(S,A);O=$?$.end+this.options.gap:s+l,R=$?$.lane:A%this.options.lanes,this.options.lanes>1&&M&&this.laneAssignments.set(A,R)}const N=w.get(D),Z=typeof N=="number"?N:this.options.estimateSize(A),G=O+Z;S[A]={index:A,start:O,size:Z,end:G,key:D,lane:R},E[R]=A}return this.measurementsCache=S,S},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Mo(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,s,l,a)=>this.range=n.length>0&&s>0?Ex({measurements:n,outerSize:s,scrollOffset:l,lanes:a,flat:a===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Mo(()=>{let n=null,s=null;const l=this.calculateRange();return l&&(n=l.startIndex,s=l.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,s]},(n,s,l,a,c)=>a===null||c===null?[]:n({startIndex:a,endIndex:c,overscan:s,count:l}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const s=this.options.indexAttribute,l=n.getAttribute(s);return l?parseInt(l,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var s;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const l=this.scrollState.index??((s=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:s.index);if(l!==void 0&&this.range){const a=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),c=Math.max(0,l-a),d=Math.min(this.options.count-1,l+a);return n>=c&&n<=d}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((c,d)=>{c.isConnected||(this.observer.unobserve(c),this.elementsCache.delete(d))});return}const s=this.indexFromElement(n),l=this.options.getItemKey(s),a=this.elementsCache.get(l);a!==n&&(a&&this.observer.unobserve(a),this.observer.observe(n),this.elementsCache.set(l,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(s)&&this.resizeItem(s,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,s)=>{var l,a;if(n<0||n>=this.options.count)return;let c,d,h;const m=this._flatMeasurements;if(this.options.lanes===1&&m!==null)h=this.options.getItemKey(n),d=m[n*2],c=m[n*2+1];else{const S=this.measurementsCache[n];if(!S)return;h=S.key,d=S.start,c=S.size}const w=this.itemSizeCache.get(h)??c,v=s-w;if(v!==0){const S=this.options.anchorTo==="end"&&((l=this.scrollState)==null?void 0:l.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,E=S?this.getTotalSize():0,A=((a=this.scrollState)==null?void 0:a.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[n]??{index:n,key:h,start:d,size:c,end:d+c,lane:0},v,this):d[this.getVirtualIndexes(),this.getMeasurements()],(n,s)=>{const l=[];for(let a=0,c=n.length;athis.options.debug}),this.getVirtualItemForOffset=n=>{const s=this.getMeasurements();if(s.length===0)return;const l=this._flatMeasurements,a=this.options.lanes===1&&l!=null,c=ww(0,s.length-1,a?d=>l[d*2]:d=>Mg(s[d]).start,n);return Mg(s[c])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(n=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=n,this.getOffsetForAlignment=(n,s,l=0)=>{if(!this.scrollElement)return 0;const a=this.getSize(),c=this.getScrollOffset();s==="auto"&&(s=n>=c+a?"end":"start"),s==="center"?n+=(l-a)/2:s==="end"&&(n-=a);const d=this.getMaxScrollOffset();return Math.max(Math.min(d,n),0)},this.getOffsetForIndex=(n,s="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const l=this.getSize(),a=this.getScrollOffset(),c=this.measurementsCache[n];if(!c)return;if(s==="auto")if(c.end>=a+l-this.options.scrollPaddingEnd)s="end";else if(c.start<=a+this.options.scrollPaddingStart)s="start";else return[a,s];if(s==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),s];const d=s==="end"?c.end+this.options.scrollPaddingEnd:c.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(d,s,c.size),s]},this.scrollToOffset=(n,{align:s="start",behavior:l="auto"}={})=>{const a=this.getOffsetForAlignment(n,s),c=this.now();this.scrollState={index:null,align:s,behavior:l,startedAt:c,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:l}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:s="auto",behavior:l="auto"}={})=>{n=Math.max(0,Math.min(n,this.options.count-1));const a=this.getOffsetForIndex(n,s);if(!a)return;const[c,d]=a,h=this.now();this.scrollState={index:n,align:d,behavior:l,startedAt:h,lastTargetOffset:c,stableFrames:0},this._scrollToOffset(c,{adjustments:void 0,behavior:l}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:s="auto"}={})=>{const l=this.getScrollOffset()+n,a=this.now();this.scrollState={index:null,align:"start",behavior:s,startedAt:a,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:n="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:n});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:n})},this.getTotalSize=()=>{var n;const s=this.getMeasurements();let l;if(s.length===0)l=this.options.paddingStart;else if(this.options.lanes===1){const a=s.length-1,c=this._flatMeasurements;c!=null?l=c[a*2]+c[a*2+1]:l=((n=s[a])==null?void 0:n.end)??0}else{const a=Array(this.options.lanes).fill(null);let c=s.length-1;for(;c>=0&&a.some(d=>d===null);){const d=s[c];a[d.lane]===null&&(a[d.lane]=d.end),c--}l=Math.max(...a.filter(d=>d!==null))}return Math.max(l-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const n=[];if(this.itemSizeCache.size===0)return n;const s=this.getMeasurements();for(const l of s)l&&this.itemSizeCache.has(l.key)&&n.push({index:l.index,key:l.key,start:l.start,size:l.size,end:l.end,lane:l.lane});return n},this._scrollToOffset=(n,{adjustments:s,behavior:l})=>{this._intendedScrollOffset=n+(s??0),this.options.scrollToFn(n,{behavior:l,adjustments:s},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,n){e!==0&&(nh()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=e:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:n}))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const s=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,l=s?s[0]:this.scrollState.lastTargetOffset,a=1,c=l!==this.scrollState.lastTargetOffset;if(!c&&fx(l,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=a){this.getScrollOffset()!==l&&this._scrollToOffset(l,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,c){const d=this.getSize()||600,h=Math.abs(l-this.getScrollOffset()),m=this.scrollState.behavior==="smooth"&&h>d;this.scrollState.lastTargetOffset=l,m||(this.scrollState.behavior="auto"),this._scrollToOffset(l,{adjustments:void 0,behavior:m?"smooth":"auto"})}this.scheduleScrollReconcile()}}const ww=(r,e,n,s)=>{for(;r<=e;){const l=(r+e)/2|0,a=n(l);if(as)e=l-1;else return l}return r>0?r-1:0};function Ex({measurements:r,outerSize:e,scrollOffset:n,lanes:s,flat:l}){const a=r.length-1,c=l?w=>l[w*2]:w=>r[w].start,d=l?w=>l[w*2]+l[w*2+1]:w=>r[w].end;if(r.length<=s)return{startIndex:0,endIndex:a};let h=ww(0,a,c,n),m=h;if(s===1)for(;m1){const w=Array(s).fill(0);for(;mS=0&&v.some(S=>S>=n);){const S=r[h];v[S.lane]=S.start,h--}h=Math.max(0,h-h%s),m=Math.min(a,m+(s-1-m%s))}return{startIndex:h,endIndex:m}}const ih=typeof document<"u"?B.useLayoutEffect:B.useEffect;function bx({useFlushSync:r=!0,directDomUpdates:e=!1,directDomUpdatesMode:n="transform",...s}){const l=B.useReducer(m=>m+1,0)[1],a=B.useRef({enabled:e,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});a.current.enabled=e,a.current.mode=n;const c=m=>{const w=a.current;if(!w.enabled||!w.container)return;const v=m.getTotalSize();if(v!==w.lastSize){w.lastSize=v;const R=m.options.horizontal?"width":"height";w.container.style[R]=`${v}px`}const S=!!m.options.horizontal,E=w.mode==="transform",A=S?"left":"top",D=m.options.scrollMargin,P=m.getVirtualItems();for(const R of P){const O=R.start-D,M=m.elementsCache.get(R.key);M&&w.lastPositions.get(M)!==O&&(w.lastPositions.set(M,O),E?M.style.transform=S?`translate3d(${O}px, 0, 0)`:`translate3d(0, ${O}px, 0)`:M.style[A]=`${O}px`)}},d={...s,onChange:(m,w)=>{var v;const S=a.current;let E=!0;if(S.enabled){c(m);const A=m.range,D=S.prevRange;E=!D||D.isScrolling!==m.isScrolling||D.startIndex!==(A==null?void 0:A.startIndex)||D.endIndex!==(A==null?void 0:A.endIndex),E&&(S.prevRange=A?{startIndex:A.startIndex,endIndex:A.endIndex,isScrolling:m.isScrolling}:null)}E&&(r&&w?Kr.flushSync(l):l()),(v=s.onChange)==null||v.call(s,m,w)}},[h]=B.useState(()=>{const m=new xx(d);return Object.assign(m,{containerRef:w=>{const v=a.current;if(v.container=w,v.lastSize=null,w&&v.enabled){const S=m.getTotalSize();v.lastSize=S;const E=m.options.horizontal?"width":"height";w.style[E]=`${S}px`}}})});return h.setOptions(d),ih(()=>h._didMount(),[]),ih(()=>h._willUpdate()),ih(()=>{c(h)}),h}function Px(r){return bx({observeElementRect:vx,observeElementOffset:yx,scrollToFn:Cx,...r})}function Ax(r){const e=Object.keys(r.fields);return e.length?e.slice(0,4).map(n=>`${n}=${r.fields[n]}`).join(" "):r.note||""}function zx(){const[,r]=B.useState(0),[e,n]=B.useState(!1),s=B.useRef(null),l=B.useRef([]);B.useEffect(()=>{Tg(!0);const d=tx(()=>{e||(l.current=ex(),r(h=>h+1))});return()=>{Tg(!1),d()}},[e]);const a=l.current,c=Px({count:a.length,getScrollElement:()=>s.current,estimateSize:()=>22,overscan:12});return B.useEffect(()=>{!e&&a.length&&c.scrollToIndex(a.length-1)},[a.length,e,c]),Y.jsxs("div",{className:"panel rawlog-panel",children:[Y.jsxs("div",{className:"rawlog-toolbar",children:[Y.jsx("button",{className:e?"btn small":"btn small active",onClick:()=>n(d=>!d),children:e?"Resume":"Pause"}),Y.jsxs("span",{className:"muted",children:[a.length," frames"]}),Y.jsxs("div",{className:"rawlog-head",children:[Y.jsx("span",{className:"c-t",children:"t"}),Y.jsx("span",{className:"c-arb",children:"arb"}),Y.jsx("span",{className:"c-m",children:"motor"}),Y.jsx("span",{className:"c-k",children:"kind"}),Y.jsx("span",{className:"c-f",children:"decoded"}),Y.jsx("span",{className:"c-r",children:"raw"})]})]}),Y.jsx("div",{className:"rawlog-body",ref:s,children:Y.jsx("div",{style:{height:c.getTotalSize(),position:"relative"},children:c.getVirtualItems().map(d=>{const h=a[d.index];return Y.jsxs("div",{className:"rawlog-row k-"+h.kind,style:{transform:`translateY(${d.start}px)`},children:[Y.jsx("span",{className:"c-t mono",children:h.t.toFixed(3)}),Y.jsxs("span",{className:"c-arb mono",children:["0x",h.arb.toString(16).toUpperCase()]}),Y.jsxs("span",{className:"c-m mono",children:["m",h.motorId]}),Y.jsx("span",{className:"c-k",children:h.mode||h.kind}),Y.jsx("span",{className:"c-f mono",children:Ax(h)}),Y.jsx("span",{className:"c-r mono dim",children:h.raw})]},h.seq)})})})]})}const Vg="damiao.monitor.layout",kx={plot:r=>Y.jsx(ux,{panelId:r.api.id}),table:()=>Y.jsx(cx,{}),cards:()=>Y.jsx(dx,{}),rawlog:()=>Y.jsx(zx,{})};function Ox(r){r.addPanel({id:"plot-1",component:"plot",title:"Plot 1"}),r.addPanel({id:"cards-1",component:"cards",title:"Motor Cards",position:{referencePanel:"plot-1",direction:"right"}}),r.addPanel({id:"table-1",component:"table",title:"Motor Table",position:{referencePanel:"plot-1",direction:"below"}}),r.addPanel({id:"raw-1",component:"rawlog",title:"Raw CAN Log",position:{referencePanel:"table-1",direction:"within"}})}function Tx(){const r=B.useCallback(e=>{const{api:n}=e;ly(n);const s=localStorage.getItem(Vg);let l=!1;if(s)try{n.fromJSON(JSON.parse(s)),l=!0}catch{l=!1}l||Ox(n),n.onDidLayoutChange(()=>{try{localStorage.setItem(Vg,JSON.stringify(n.toJSON()))}catch{}})},[]);return Y.jsx(Pv,{className:"dockview-theme-abyss",components:kx,onReady:r})}function Ix(){const r=Cn(d=>d.addSignalToPlot),e=Cn(d=>d.setMotorTypes),[n,s]=B.useState(null),l=M0(R0(Lh,{activationConstraint:{distance:4}}));B.useEffect(()=>{vw(),ox().then(e)},[e]);const a=d=>{var m;const h=(m=d.active.data.current)==null?void 0:m.signalId;s(h?ah(h):null)},c=d=>{var w,v,S,E;s(null);const h=(w=d.active.data.current)==null?void 0:w.signalId,m=((S=(v=d.over)==null?void 0:v.id)==null?void 0:S.toString())||"";if(h&&m.startsWith("plot:")){const A=(E=d.over.data.current)==null?void 0:E.panelId;r(A,h)}};return Y.jsxs(I_,{sensors:l,onDragStart:a,onDragEnd:c,children:[Y.jsxs("div",{className:"app",children:[Y.jsx(ay,{}),Y.jsxs("div",{className:"body",children:[Y.jsx(py,{}),Y.jsx("main",{className:"dock-host",children:Y.jsx(Tx,{})})]})]}),Y.jsx(q_,{dropAnimation:null,children:n?Y.jsx("div",{className:"drag-ghost",children:n}):null})]})}y0.createRoot(document.getElementById("root")).render(Y.jsx(pe.StrictMode,{children:Y.jsx(Ix,{})})); diff --git a/damiao_motor/gui/webapp/dist/index.html b/damiao_motor/gui/webapp/dist/index.html new file mode 100644 index 0000000..141ed17 --- /dev/null +++ b/damiao_motor/gui/webapp/dist/index.html @@ -0,0 +1,13 @@ + + + + + + DaMiao Monitor + + + + +
+ + diff --git a/damiao_motor/gui/webapp/index.html b/damiao_motor/gui/webapp/index.html new file mode 100644 index 0000000..6a08fc0 --- /dev/null +++ b/damiao_motor/gui/webapp/index.html @@ -0,0 +1,12 @@ + + + + + + DaMiao Monitor + + +
+ + + diff --git a/damiao_motor/gui/webapp/package-lock.json b/damiao_motor/gui/webapp/package-lock.json new file mode 100644 index 0000000..29f4fdb --- /dev/null +++ b/damiao_motor/gui/webapp/package-lock.json @@ -0,0 +1,2018 @@ +{ + "name": "damiao-monitor-webapp", + "version": "0.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "damiao-monitor-webapp", + "version": "0.0.0", + "dependencies": { + "@dnd-kit/core": "^6.1.0", + "@tanstack/react-virtual": "^3.10.8", + "dockview": "^4.2.0", + "react": "^18.3.1", + "react-dom": "^18.3.1", + "uplot": "^1.6.31", + "zustand": "^5.0.2" + }, + "devDependencies": { + "@types/react": "^18.3.12", + "@types/react-dom": "^18.3.1", + "@vitejs/plugin-react": "^4.3.4", + "typescript": "^5.6.3", + "vite": "^6.0.3" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz", + "integrity": "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.29.7", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.7.tgz", + "integrity": "sha512-locTkQyKvwIEgBzVrn8693ebc97F2U8ZHjbXwDXJ5Fn2TCpNwTlKcaKLkdHop5c/icOFE7qt7Q9JC5hnKNa6Gg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.7.tgz", + "integrity": "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.7", + "@babel/generator": "^7.29.7", + "@babel/helper-compilation-targets": "^7.29.7", + "@babel/helper-module-transforms": "^7.29.7", + "@babel/helpers": "^7.29.7", + "@babel/parser": "^7.29.7", + "@babel/template": "^7.29.7", + "@babel/traverse": "^7.29.7", + "@babel/types": "^7.29.7", + "@jridgewell/remapping": "^2.3.5", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/generator": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.7.tgz", + "integrity": "sha512-DkXD5OJQaAQIdZ1bt3UZdEnHAn9Imd3IVBdX03UFe+ony9Ojw5pzr9YVKGDY1jt+Gcn/FnGkNf8r+Vj5NOJWtQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.29.7", + "@babel/types": "^7.29.7", + "@jridgewell/gen-mapping": "^0.3.12", + "@jridgewell/trace-mapping": "^0.3.28", + "jsesc": "^3.0.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.29.7.tgz", + "integrity": "sha512-wem6WaBj4NaVYVdNhLPPVacES6ZJ+KBBfSkTMD3YZxbP3rm3Di85tJU5ljaUNhaOynt+Aj0xruhYuzQBt8n71g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.29.7", + "@babel/helper-validator-option": "^7.29.7", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-globals": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.29.7.tgz", + "integrity": "sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.29.7.tgz", + "integrity": "sha512-ejHwrQQYcm9xnTivShn2IDOlIzInN34AXskvq9QicvCtEzq1Vzclu/tKF8Jq1Cg8JG2GL6/EmjgsCT7lXepE3g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.29.7", + "@babel/types": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.29.7.tgz", + "integrity": "sha512-UPUVSyXbOh627KiCIGQSgwWzGeBKLkaJ9PJEdrngIwMSzxLR4jS4+f1f1jb7VzBbg8nFLaYotvVPFCTqdrmTAg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-module-imports": "^7.29.7", + "@babel/helper-validator-identifier": "^7.29.7", + "@babel/traverse": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.29.7.tgz", + "integrity": "sha512-G7sHYigPY17oO5SYWnfD/0MTBwVR781S/JI643e/JhUYgVgWE/61SoW3NH9KWUKyKq5LVh3npif99Wkt6j86Jw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz", + "integrity": "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz", + "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.29.7.tgz", + "integrity": "sha512-N9ZErrD+yW5geCDtBqnOoxmR8+tNKiGuxKlDpuJxfsqpa2dFcexaziGAE/qoHLiDDreVNMupxGmSoNlyvsA3gw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.7.tgz", + "integrity": "sha512-1k2lAGRMfHTcwuNYcCNUmaUffmQv8KWMfh2iJUUeRlwlwH4FdNG7mfPI10NPfLHJFThE4Tyr4mv7kTNZOiPuBg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/template": "^7.29.7", + "@babel/types": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.7.tgz", + "integrity": "sha512-hnORnjP/1P/zFEndoeX+n+t1RwWRJiJpM/jO7FW32Kn9r5+sJB2JWOdYo4L6k78j15eCwY3Gm/7364B1EMwtNg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.29.7" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/plugin-transform-react-jsx-self": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.29.7.tgz", + "integrity": "sha512-TL0hMc9xzy86VD31nUiwzd5otRAcyEPcsegCxolO0PvcXuH1v0kECe/UIznYFihpkvU5wg/jk4v0TTEFfm53fw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-react-jsx-source": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.29.7.tgz", + "integrity": "sha512-06IyK09H3wi4cGbhDBwp5gUGo0IKtnYa8tyTiephirPCK6fbobVGiXMMI5zLQ4aKEYP3wZ3ArU44o+8KMrSG/Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/template": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.29.7.tgz", + "integrity": "sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.7", + "@babel/parser": "^7.29.7", + "@babel/types": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.7.tgz", + "integrity": "sha512-EhlfNQtZ+NK22w5BM61ciuiq1m58ed33Wr1Xan//ZRTy6hgjnwyCffRYwzsGXdASJSUJ1guZILsErh1eQcl+zw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.7", + "@babel/generator": "^7.29.7", + "@babel/helper-globals": "^7.29.7", + "@babel/parser": "^7.29.7", + "@babel/template": "^7.29.7", + "@babel/types": "^7.29.7", + "debug": "^4.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.7.tgz", + "integrity": "sha512-4zBIxpPzowiZpusoFkyGVwakdRJUyuH5PxQ/PrqghfdFWWasvnCdPfQXHrenDai+gyLARulZjZowCOj6fjT4pA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.29.7", + "@babel/helper-validator-identifier": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@dnd-kit/accessibility": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@dnd-kit/accessibility/-/accessibility-3.1.1.tgz", + "integrity": "sha512-2P+YgaXF+gRsIihwwY1gCsQSYnu9Zyj2py8kY5fFvUM1qm2WA2u639R6YNVfU4GWr+ZM5mqEsfHZZLoRONbemw==", + "license": "MIT", + "dependencies": { + "tslib": "^2.0.0" + }, + "peerDependencies": { + "react": ">=16.8.0" + } + }, + "node_modules/@dnd-kit/core": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/@dnd-kit/core/-/core-6.3.1.tgz", + "integrity": "sha512-xkGBRQQab4RLwgXxoqETICr6S5JlogafbhNsidmrkVv2YRs5MLwpjoF2qpiGjQt8S9AoxtIV603s0GIUpY5eYQ==", + "license": "MIT", + "dependencies": { + "@dnd-kit/accessibility": "^3.1.1", + "@dnd-kit/utilities": "^3.2.2", + "tslib": "^2.0.0" + }, + "peerDependencies": { + "react": ">=16.8.0", + "react-dom": ">=16.8.0" + } + }, + "node_modules/@dnd-kit/utilities": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/@dnd-kit/utilities/-/utilities-3.2.2.tgz", + "integrity": "sha512-+MKAJEOfaBe5SmV6t34p80MMKhjvUz0vRrvVJbPT0WElzaOJ/1xs+D+KDv+tD/NE5ujfrChEcshd4fLn0wpiqg==", + "license": "MIT", + "dependencies": { + "tslib": "^2.0.0" + }, + "peerDependencies": { + "react": ">=16.8.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz", + "integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.12.tgz", + "integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.12.tgz", + "integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.12.tgz", + "integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz", + "integrity": "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.12.tgz", + "integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.12.tgz", + "integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.12.tgz", + "integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.12.tgz", + "integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.12.tgz", + "integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.12.tgz", + "integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.12.tgz", + "integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.12.tgz", + "integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.12.tgz", + "integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.12.tgz", + "integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.12.tgz", + "integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz", + "integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.12.tgz", + "integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.12.tgz", + "integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.12.tgz", + "integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.12.tgz", + "integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.12.tgz", + "integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.12.tgz", + "integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.12.tgz", + "integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.12.tgz", + "integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz", + "integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/remapping": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", + "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", + "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@rolldown/pluginutils": { + "version": "1.0.0-beta.27", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.27.tgz", + "integrity": "sha512-+d0F4MKMCbeVUJwG96uQ4SgAznZNSq93I3V+9NHA4OpvqG8mRCpGdKmK8l/dl02h2CCDHwW2FqilnTyDcAnqjA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.62.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.62.0.tgz", + "integrity": "sha512-IPIQ55ythEHkfEd9jMEi32OQ7SxURsGA43JI22lj01OLZNt2NUbJX8YUHxkVWyQ6daHPNn0truF5nSj3DQp6YQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.62.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.62.0.tgz", + "integrity": "sha512-M6s9cr10MibETyo8JsOkq+Lo1+lU6hcvb1MApnUql5qte/5hMEgzlN8/ReIKNfRV8rrqX50W1BX9zoUhC192RA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.62.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.62.0.tgz", + "integrity": "sha512-BqCoMoIbn0keKys+dEAdBa70EtOwV1bEsQCUgU9FdiZmmMge/Zk7LlkYGqbrdHR+Frnt0E1FOanly+rlwvvQzw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.62.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.62.0.tgz", + "integrity": "sha512-SIMzST3VFNXDAbeIWDWiFCNM5qncUBDWaEV7NfE7oZbDt2mgfW4MvbKdbYiGOLoM32gbTv608UMd0XktEYSD7w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.62.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.62.0.tgz", + "integrity": "sha512-ezjfSQMP7ArdUsbBwbQIfwAlhE84I2iVnzQNCFSveqV42q+BmKlzVpf7mxv5EchLcoWU4y6/heFzVg1F+hodUQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.62.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.62.0.tgz", + "integrity": "sha512-9+qTWGW9AZRhnUgwtTwzNwcPlL87ngkeN0LA+q1bADvmY9aNvWaF2TFW8BZgnQPYxpDI7+rMVLivcd4V737TAQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.62.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.62.0.tgz", + "integrity": "sha512-T1dMEQhXA/jkJ/jyMIw9IovK8bSUq7A8kLIlvZTb/6YIVsp2zLavr4F3oyllHWo7eIVJRyE5n3tUjQJEbE1IuQ==", + "cpu": [ + "arm" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.62.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.62.0.tgz", + "integrity": "sha512-2as0LgT7qQpyceQq6VUJYnumUMUrgGQCWIiDIN9DE0/tglsk6o66uCB4f3djRawAltvfCNLyZZrsqbPA6inCsA==", + "cpu": [ + "arm" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.62.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.62.0.tgz", + "integrity": "sha512-bVURMg+6eNN9C/yc0aVjooZcwTTtYF4YW3xta5pP0//r3o1V8gXEHXWCndj47w/HhwsFroZrFhR+6uQP5T0n0g==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.62.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.62.0.tgz", + "integrity": "sha512-Ful8pM/2yYI83PViWdFdpZhdI8HJ5qsXANe5atypbHDf+KIBBDsZsbyy8hbXnULVvW9NsTh5DHwbcBftyLTfiw==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-gnu": { + "version": "4.62.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.62.0.tgz", + "integrity": "sha512-9Gp/DgrkzfUBmNPVTyPTvay+4xEP7M/clXpj3efXBcm6uTIVIgDg4rqUpqKXvLEuFRVuEpSAOkhgNeecvaZ4Cg==", + "cpu": [ + "loong64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-musl": { + "version": "4.62.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.62.0.tgz", + "integrity": "sha512-m9tsJz54LUXkSYM8+8PG81B9IKK5r+2T0clMq4QrS16xFosufU7firBDAZEsDheDs7wTlP7h3++S7lMsU955HA==", + "cpu": [ + "loong64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-gnu": { + "version": "4.62.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.62.0.tgz", + "integrity": "sha512-3UvJ5PNVU16aJf6M3tFI24pWzAl2/ynfbyRN3ICyQajK1lSkrnVYNnLz3v04J32qKa0FczJc22zeToc0lr2A3w==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-musl": { + "version": "4.62.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.62.0.tgz", + "integrity": "sha512-vRWUAbYLGHBZS6Q8Msb2sfnf1fvJf+47t8l/TwOerM2qArzy+IeNMTHrYLHXh95h8MoatPHI5hhSZNs+mGXKPg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.62.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.62.0.tgz", + "integrity": "sha512-c00T5SYENHAt86cfW47URaP3Us5vLC/4QO7GYud1G5VNRffCwwCuBspwqYrriuJB+5m0WFzClCn9wed0FBjKvg==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.62.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.62.0.tgz", + "integrity": "sha512-krrCDilhXOwFkSkO3Wm9I/f9H0L92XHHwy2fwxjukxIbh0dem8gZqOW5Y8BsHrpJv5qwlRBV+Wl4ZFyRWhUpwg==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.62.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.62.0.tgz", + "integrity": "sha512-7pfYFSTc4/rUC/FtAI0Qp6QthDBCIi6/AuP1xYqFk5vanI6KnL5dWKP60OM/05LOsbwTmIcvr6eXC4CJuJ75IA==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.62.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.62.0.tgz", + "integrity": "sha512-7SDIalKeIpG0Ifogbbdn58HmSotYMlf23K3dCJEmiVd9Fg36Vmni82iPQec27N3wY4Bvbxftkxz6vSx9OcouTg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.62.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.62.0.tgz", + "integrity": "sha512-eRZevouTH2i1HeAVLqJuLnt256krQkGY0TN6WsTmsIhuzbh457HuWDMakKwmi0Cjadux983CoSr8Lim2QhUIFw==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-openbsd-x64": { + "version": "4.62.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.62.0.tgz", + "integrity": "sha512-3oVS7FLGa4U1qcvao9ylGxrjXZyUQqR8UwxEcnUEyPX53O/C/mKDZegNXTdHCP+h3e6ta/f1EN38Yif1mmZHYg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ] + }, + "node_modules/@rollup/rollup-openharmony-arm64": { + "version": "4.62.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.62.0.tgz", + "integrity": "sha512-yTB9TgfWj5wHe5QgktAgXTLLot1gvEjl1NiPPAUiCs4oPrIWFl5V4nC3GrkNdj9LaAU4s94nVrGbGOCqUpyWsg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.62.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.62.0.tgz", + "integrity": "sha512-5LOhoaesY3doG1c+ac/2JtgREpKoJr5bUHH8tKY0V8di7+uSV6BwLs2PlR0/yzefGOkR+wE7ZolZphHCsyG5Rw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.62.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.62.0.tgz", + "integrity": "sha512-yYkWHhmbhRTWTnWos5HC4GcPQfjlzzCNbM9e/+GXrLuaBXYA3qSDR9f0Vgufd5S8yX81U8jPKp7ZnAjZFMtRnw==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-gnu": { + "version": "4.62.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.62.0.tgz", + "integrity": "sha512-SoTb6lPg25xZlA2ibwQ++ahCCnH+FP0qmEuafMJ4gznZKOlXioKEAeJLgCrqjM98ACziXM9V1amFjICVL4IFoA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.62.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.62.0.tgz", + "integrity": "sha512-5L+T1fMX4RIEBoZzT0+sQ0PhTS36NULFmMXtl1TZo44TMAROIMHbZufSOjVWt/Y622BtxgxtaNOokbTDvfsrZA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@tanstack/react-virtual": { + "version": "3.14.3", + "resolved": "https://registry.npmjs.org/@tanstack/react-virtual/-/react-virtual-3.14.3.tgz", + "integrity": "sha512-k/cnHPVaOfn46hSbiY6n4Dzf4QjCGWSF40zR5QIIYUqPAjpA6TN7InfYmcMiDVQGP2iUn9xsRbAl8u1v3UmeVQ==", + "license": "MIT", + "dependencies": { + "@tanstack/virtual-core": "3.17.1" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/@tanstack/virtual-core": { + "version": "3.17.1", + "resolved": "https://registry.npmjs.org/@tanstack/virtual-core/-/virtual-core-3.17.1.tgz", + "integrity": "sha512-VZyW2Uiml5tmBZwPGrSD3Sz73OxzljQMCmzYHsUTPEuTsERf5xwa+uWb01xEzkz3ZSYTjj8NEb/mKHvgKxyZdA==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + } + }, + "node_modules/@types/babel__core": { + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", + "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "node_modules/@types/babel__generator": { + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.27.0.tgz", + "integrity": "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__template": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", + "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__traverse": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.28.0.tgz", + "integrity": "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.28.2" + } + }, + "node_modules/@types/estree": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/prop-types": { + "version": "15.7.15", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.15.tgz", + "integrity": "sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw==", + "devOptional": true, + "license": "MIT" + }, + "node_modules/@types/react": { + "version": "18.3.31", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.31.tgz", + "integrity": "sha512-vfEqpXTvwT91yhmwdfouStN2hSKwTvyRs8qpLfADyrq/kxDw0hZM7Wk9Ug1FELj8hIby+S/+kQCSRFF32nv2Qw==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "@types/prop-types": "*", + "csstype": "^3.2.2" + } + }, + "node_modules/@types/react-dom": { + "version": "18.3.7", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.7.tgz", + "integrity": "sha512-MEe3UeoENYVFXzoXEWsvcpg6ZvlrFNlOQ7EOsvhI3CfAXwzPfO8Qwuxd40nepsYKqyyVQnTdEfv68q91yLcKrQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "@types/react": "^18.0.0" + } + }, + "node_modules/@vitejs/plugin-react": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.7.0.tgz", + "integrity": "sha512-gUu9hwfWvvEDBBmgtAowQCojwZmJ5mcLn3aufeCsitijs3+f2NsrPtlAWIR6OPiqljl96GVCUbLe0HyqIpVaoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.28.0", + "@babel/plugin-transform-react-jsx-self": "^7.27.1", + "@babel/plugin-transform-react-jsx-source": "^7.27.1", + "@rolldown/pluginutils": "1.0.0-beta.27", + "@types/babel__core": "^7.20.5", + "react-refresh": "^0.17.0" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "peerDependencies": { + "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" + } + }, + "node_modules/baseline-browser-mapping": { + "version": "2.10.37", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.37.tgz", + "integrity": "sha512-girxaJ7WZssDOFhzCGZTDKoTa1gk6A1TbflaYTpykLJ4UU9Fz9kx1aREM8JCuoVHbL8X8T/mJg7w2oYSq72Oig==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "baseline-browser-mapping": "dist/cli.cjs" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/browserslist": { + "version": "4.28.2", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.2.tgz", + "integrity": "sha512-48xSriZYYg+8qXna9kwqjIVzuQxi+KYWp2+5nCYnYKPTr0LvD89Jqk2Or5ogxz0NUMfIjhh2lIUX/LyX9B4oIg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "baseline-browser-mapping": "^2.10.12", + "caniuse-lite": "^1.0.30001782", + "electron-to-chromium": "^1.5.328", + "node-releases": "^2.0.36", + "update-browserslist-db": "^1.2.3" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001799", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001799.tgz", + "integrity": "sha512-hG1bReV+OUU+MOqK4t/ZWI0tZOyz3rqS9XuhOUz1cIcbwBKjOyJEJuw9ER5JuNyqxNk8u/JUVbGibBOL1yrjFw==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "CC-BY-4.0" + }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true, + "license": "MIT" + }, + "node_modules/csstype": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", + "devOptional": true, + "license": "MIT" + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/dockview": { + "version": "4.13.1", + "resolved": "https://registry.npmjs.org/dockview/-/dockview-4.13.1.tgz", + "integrity": "sha512-K8xnYt3Rvkx8MYKHaEsb8aFaPyQclKRRkXS9JcpQPZUgqxumTLnSidgdd6uIfzEps6yJsXoZGQGJ9PtcaKyDcQ==", + "license": "MIT", + "dependencies": { + "dockview-core": "^4.13.1" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/dockview-core": { + "version": "4.13.1", + "resolved": "https://registry.npmjs.org/dockview-core/-/dockview-core-4.13.1.tgz", + "integrity": "sha512-+7vR0ZEoL8CNck6NqDVUMqBT22niwBu5CMMI137dZ3c8NDc7c5Si+3dGEqQgM4lNtHBLAtvypo1C4p21J2wkiQ==", + "license": "MIT" + }, + "node_modules/electron-to-chromium": { + "version": "1.5.372", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.372.tgz", + "integrity": "sha512-M3yhbAlilnwqC8D21t28UCDGHyitShTmmLRU/H+b74P6Ski16Nb9HONYEaVpMj/pwC7BEo5B95FpjODLCWbtfA==", + "dev": true, + "license": "ISC" + }, + "node_modules/esbuild": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz", + "integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.25.12", + "@esbuild/android-arm": "0.25.12", + "@esbuild/android-arm64": "0.25.12", + "@esbuild/android-x64": "0.25.12", + "@esbuild/darwin-arm64": "0.25.12", + "@esbuild/darwin-x64": "0.25.12", + "@esbuild/freebsd-arm64": "0.25.12", + "@esbuild/freebsd-x64": "0.25.12", + "@esbuild/linux-arm": "0.25.12", + "@esbuild/linux-arm64": "0.25.12", + "@esbuild/linux-ia32": "0.25.12", + "@esbuild/linux-loong64": "0.25.12", + "@esbuild/linux-mips64el": "0.25.12", + "@esbuild/linux-ppc64": "0.25.12", + "@esbuild/linux-riscv64": "0.25.12", + "@esbuild/linux-s390x": "0.25.12", + "@esbuild/linux-x64": "0.25.12", + "@esbuild/netbsd-arm64": "0.25.12", + "@esbuild/netbsd-x64": "0.25.12", + "@esbuild/openbsd-arm64": "0.25.12", + "@esbuild/openbsd-x64": "0.25.12", + "@esbuild/openharmony-arm64": "0.25.12", + "@esbuild/sunos-x64": "0.25.12", + "@esbuild/win32-arm64": "0.25.12", + "@esbuild/win32-ia32": "0.25.12", + "@esbuild/win32-x64": "0.25.12" + } + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "license": "MIT" + }, + "node_modules/jsesc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "dev": true, + "license": "MIT", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "license": "MIT", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "license": "MIT", + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } + }, + "node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/nanoid": { + "version": "3.3.12", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.12.tgz", + "integrity": "sha512-ZB9RH/39qpq5Vu6Y+NmUaFhQR6pp+M2Xt76XBnEwDaGcVAqhlvxrl3B2bKS5D3NH3QR76v3aSrKaF/Kiy7lEtQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/node-releases": { + "version": "2.0.47", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.47.tgz", + "integrity": "sha512-Uzmd6LXpouKo8EUK68IjH4+E01w/hXyV3R3g/geCJo+rXLNfh1xucB+LOzYEOQPSiUK3h/xZf0cQGcSsmyL2Og==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz", + "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/postcss": { + "version": "8.5.15", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.15.tgz", + "integrity": "sha512-FfR8sjd4em2T6fb3I2MwAJU7HWVMr9zba+enmQeeWFfCbm+UOC/0X4DS8XtpUTMwWMGbjKYP7xjfNekzyGmB3A==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.12", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/react": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", + "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", + "license": "MIT", + "dependencies": { + "loose-envify": "^1.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", + "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", + "license": "MIT", + "dependencies": { + "loose-envify": "^1.1.0", + "scheduler": "^0.23.2" + }, + "peerDependencies": { + "react": "^18.3.1" + } + }, + "node_modules/react-refresh": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.17.0.tgz", + "integrity": "sha512-z6F7K9bV85EfseRCp2bzrpyQ0Gkw1uLoCel9XBVWPg/TjRj94SkJzUTGfOa4bs7iJvBWtQG0Wq7wnI0syw3EBQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/rollup": { + "version": "4.62.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.62.0.tgz", + "integrity": "sha512-nc72Wgq62I7rtDV4izT5/aaS0zxy3kttkinf9586ApknY3jZO9NYsmtc24fUckA0X7Q2v+ML4a15pdUlV5V/jA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.9" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.62.0", + "@rollup/rollup-android-arm64": "4.62.0", + "@rollup/rollup-darwin-arm64": "4.62.0", + "@rollup/rollup-darwin-x64": "4.62.0", + "@rollup/rollup-freebsd-arm64": "4.62.0", + "@rollup/rollup-freebsd-x64": "4.62.0", + "@rollup/rollup-linux-arm-gnueabihf": "4.62.0", + "@rollup/rollup-linux-arm-musleabihf": "4.62.0", + "@rollup/rollup-linux-arm64-gnu": "4.62.0", + "@rollup/rollup-linux-arm64-musl": "4.62.0", + "@rollup/rollup-linux-loong64-gnu": "4.62.0", + "@rollup/rollup-linux-loong64-musl": "4.62.0", + "@rollup/rollup-linux-ppc64-gnu": "4.62.0", + "@rollup/rollup-linux-ppc64-musl": "4.62.0", + "@rollup/rollup-linux-riscv64-gnu": "4.62.0", + "@rollup/rollup-linux-riscv64-musl": "4.62.0", + "@rollup/rollup-linux-s390x-gnu": "4.62.0", + "@rollup/rollup-linux-x64-gnu": "4.62.0", + "@rollup/rollup-linux-x64-musl": "4.62.0", + "@rollup/rollup-openbsd-x64": "4.62.0", + "@rollup/rollup-openharmony-arm64": "4.62.0", + "@rollup/rollup-win32-arm64-msvc": "4.62.0", + "@rollup/rollup-win32-ia32-msvc": "4.62.0", + "@rollup/rollup-win32-x64-gnu": "4.62.0", + "@rollup/rollup-win32-x64-msvc": "4.62.0", + "fsevents": "~2.3.2" + } + }, + "node_modules/scheduler": { + "version": "0.23.2", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", + "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==", + "license": "MIT", + "dependencies": { + "loose-envify": "^1.1.0" + } + }, + "node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/update-browserslist-db": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz", + "integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "escalade": "^3.2.0", + "picocolors": "^1.1.1" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/uplot": { + "version": "1.6.32", + "resolved": "https://registry.npmjs.org/uplot/-/uplot-1.6.32.tgz", + "integrity": "sha512-KIMVnG68zvu5XXUbC4LQEPnhwOxBuLyW1AHtpm6IKTXImkbLgkMy+jabjLgSLMasNuGGzQm/ep3tOkyTxpiQIw==", + "license": "MIT" + }, + "node_modules/vite": { + "version": "6.4.3", + "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.3.tgz", + "integrity": "sha512-NTKlcQjlAK7MlQoyb6LgaqHc8sso/pVyUJYWMws3jg21uTJw/LddqIFPcPqP6PzpgbIcZyKI85sFE4HBrQDA8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "^0.25.0", + "fdir": "^6.4.4", + "picomatch": "^4.0.2", + "postcss": "^8.5.3", + "rollup": "^4.34.9", + "tinyglobby": "^0.2.13" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", + "jiti": ">=1.21.0", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "sass-embedded": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true, + "license": "ISC" + }, + "node_modules/zustand": { + "version": "5.0.14", + "resolved": "https://registry.npmjs.org/zustand/-/zustand-5.0.14.tgz", + "integrity": "sha512-/8tAspM5LMPr28b3fwLYrtdj77ECpfZviaP75CMTnwO8ISyaE4GDIG/9rDDYq/cH9D2Xw2A2RXglLInmVBQB/g==", + "license": "MIT", + "engines": { + "node": ">=12.20.0" + }, + "peerDependencies": { + "@types/react": ">=18.0.0", + "immer": ">=9.0.6", + "react": ">=18.0.0", + "use-sync-external-store": ">=1.2.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "immer": { + "optional": true + }, + "react": { + "optional": true + }, + "use-sync-external-store": { + "optional": true + } + } + } + } +} diff --git a/damiao_motor/gui/webapp/package.json b/damiao_motor/gui/webapp/package.json new file mode 100644 index 0000000..dda750a --- /dev/null +++ b/damiao_motor/gui/webapp/package.json @@ -0,0 +1,30 @@ +{ + "name": "damiao-monitor-webapp", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc -b && vite build", + "preview": "vite preview" + }, + "dependencies": { + "@dnd-kit/core": "^6.1.0", + "@tanstack/react-virtual": "^3.10.8", + "dockview": "^4.2.0", + "react": "^18.3.1", + "react-dom": "^18.3.1", + "uplot": "^1.6.31", + "zustand": "^5.0.2" + }, + "devDependencies": { + "@types/react": "^18.3.12", + "@types/react-dom": "^18.3.1", + "@vitejs/plugin-react": "^4.3.4", + "typescript": "^5.6.3", + "vite": "^6.0.3" + }, + "allowScripts": { + "esbuild@0.25.12": true + } +} diff --git a/damiao_motor/gui/webapp/src/App.tsx b/damiao_motor/gui/webapp/src/App.tsx new file mode 100644 index 0000000..23d5f8f --- /dev/null +++ b/damiao_motor/gui/webapp/src/App.tsx @@ -0,0 +1,63 @@ +import { useEffect, useState } from "react"; +import { + DndContext, + DragOverlay, + PointerSensor, + useSensor, + useSensors, + type DragEndEvent, + type DragStartEvent, +} from "@dnd-kit/core"; + +import Toolbar from "./components/Toolbar"; +import SignalSidebar from "./components/SignalSidebar"; +import Dock from "./components/Dock"; +import { useApp } from "./lib/store"; +import { connectWs, fetchMotorTypes } from "./lib/ws"; +import { shortSignal } from "./lib/format"; + +export default function App() { + const addSignalToPlot = useApp((s) => s.addSignalToPlot); + const setMotorTypes = useApp((s) => s.setMotorTypes); + const [dragLabel, setDragLabel] = useState(null); + + // a 4 px activation distance so clicks on chips don't accidentally start drags + const sensors = useSensors(useSensor(PointerSensor, { activationConstraint: { distance: 4 } })); + + useEffect(() => { + // store hydrates plot configs synchronously at creation; just connect + load types + connectWs(); + fetchMotorTypes().then(setMotorTypes); + }, [setMotorTypes]); + + const onDragStart = (e: DragStartEvent) => { + const sid = e.active.data.current?.signalId as string | undefined; + setDragLabel(sid ? shortSignal(sid) : null); + }; + const onDragEnd = (e: DragEndEvent) => { + setDragLabel(null); + const sid = e.active.data.current?.signalId as string | undefined; + const overId = e.over?.id?.toString() || ""; + if (sid && overId.startsWith("plot:")) { + const panelId = e.over!.data.current?.panelId as string; + addSignalToPlot(panelId, sid); + } + }; + + return ( + +
+ +
+ +
+ +
+
+
+ + {dragLabel ?
{dragLabel}
: null} +
+
+ ); +} diff --git a/damiao_motor/gui/webapp/src/components/Dock.tsx b/damiao_motor/gui/webapp/src/components/Dock.tsx new file mode 100644 index 0000000..975a39a --- /dev/null +++ b/damiao_motor/gui/webapp/src/components/Dock.tsx @@ -0,0 +1,79 @@ +import { useCallback } from "react"; +import { + DockviewReact, + type DockviewReadyEvent, + type IDockviewPanelProps, +} from "dockview"; +import "dockview/dist/styles/dockview.css"; + +import PlotPanel from "../panels/PlotPanel"; +import TablePanel from "../panels/TablePanel"; +import CardsPanel from "../panels/CardsPanel"; +import RawLogPanel from "../panels/RawLogPanel"; +import { setDockApi } from "../lib/dock"; + +const LAYOUT_KEY = "damiao.monitor.layout"; + +const components = { + plot: (props: IDockviewPanelProps) => , + table: () => , + cards: () => , + rawlog: () => , +}; + +function defaultLayout(api: DockviewReadyEvent["api"]) { + api.addPanel({ id: "plot-1", component: "plot", title: "Plot 1" }); + api.addPanel({ + id: "cards-1", + component: "cards", + title: "Motor Cards", + position: { referencePanel: "plot-1", direction: "right" }, + }); + api.addPanel({ + id: "table-1", + component: "table", + title: "Motor Table", + position: { referencePanel: "plot-1", direction: "below" }, + }); + api.addPanel({ + id: "raw-1", + component: "rawlog", + title: "Raw CAN Log", + position: { referencePanel: "table-1", direction: "within" }, + }); +} + +export default function Dock() { + const onReady = useCallback((event: DockviewReadyEvent) => { + const { api } = event; + setDockApi(api); + + const saved = localStorage.getItem(LAYOUT_KEY); + let restored = false; + if (saved) { + try { + api.fromJSON(JSON.parse(saved)); + restored = true; + } catch { + restored = false; + } + } + if (!restored) defaultLayout(api); + + api.onDidLayoutChange(() => { + try { + localStorage.setItem(LAYOUT_KEY, JSON.stringify(api.toJSON())); + } catch { + /* ignore quota */ + } + }); + }, []); + + return ( + + ); +} diff --git a/damiao_motor/gui/webapp/src/components/SignalChip.tsx b/damiao_motor/gui/webapp/src/components/SignalChip.tsx new file mode 100644 index 0000000..b8862ac --- /dev/null +++ b/damiao_motor/gui/webapp/src/components/SignalChip.tsx @@ -0,0 +1,29 @@ +import { useDraggable } from "@dnd-kit/core"; +import type { SignalDescriptor } from "../lib/types"; +import { signalColor } from "../lib/format"; + +export default function SignalChip({ sig }: { sig: SignalDescriptor }) { + const { attributes, listeners, setNodeRef, isDragging } = useDraggable({ + id: `sig:${sig.id}`, + data: { signalId: sig.id }, + }); + const color = signalColor(sig); + return ( +
+ + + {sig.source}.{sig.field} + + {sig.unit && {sig.unit}} +
+ ); +} diff --git a/damiao_motor/gui/webapp/src/components/SignalSidebar.tsx b/damiao_motor/gui/webapp/src/components/SignalSidebar.tsx new file mode 100644 index 0000000..091d7ab --- /dev/null +++ b/damiao_motor/gui/webapp/src/components/SignalSidebar.tsx @@ -0,0 +1,67 @@ +import { useMemo, useState } from "react"; +import { useApp } from "../lib/store"; +import { FIELD_ORDER } from "../lib/format"; +import SignalChip from "./SignalChip"; +import type { SignalDescriptor } from "../lib/types"; + +function sortSignals(sigs: SignalDescriptor[]): SignalDescriptor[] { + return [...sigs].sort((a, b) => { + if (a.source !== b.source) return a.source === "cmd" ? -1 : 1; + const ai = FIELD_ORDER.indexOf(a.field); + const bi = FIELD_ORDER.indexOf(b.field); + return (ai < 0 ? 99 : ai) - (bi < 0 ? 99 : bi); + }); +} + +export default function SignalSidebar() { + const signals = useApp((s) => s.signals); + const status = useApp((s) => s.status); + const [filter, setFilter] = useState(""); + + const byMotor = useMemo(() => { + const map = new Map(); + for (const s of signals) { + if (filter && !s.id.toLowerCase().includes(filter.toLowerCase())) continue; + const arr = map.get(s.motorId) || []; + arr.push(s); + map.set(s.motorId, arr); + } + return Array.from(map.entries()).sort((a, b) => a[0] - b[0]); + }, [signals, filter]); + + return ( + + ); +} diff --git a/damiao_motor/gui/webapp/src/components/Toolbar.tsx b/damiao_motor/gui/webapp/src/components/Toolbar.tsx new file mode 100644 index 0000000..06423f4 --- /dev/null +++ b/damiao_motor/gui/webapp/src/components/Toolbar.tsx @@ -0,0 +1,50 @@ +import { useApp } from "../lib/store"; +import { addPanelOfKind } from "../lib/dock"; + +export default function Toolbar() { + const connected = useApp((s) => s.connected); + const status = useApp((s) => s.status); + + const resetLayout = () => { + localStorage.removeItem("damiao.monitor.layout"); + localStorage.removeItem("damiao.monitor.plotConfigs"); + location.reload(); + }; + + return ( +
+
+ + DaMiao Passive Monitor +
+ +
+ + + {status?.demo ? "demo" : status?.channel || "—"} + + {status && !status.demo && ( + + {status.listenOnly ? "listen-only" : "rx (no TX)"} + + )} + {status?.error && bus error} + {status && ( + + {status.framesSeen.toLocaleString()} frames · +{status.feedbackOffset} fb + + )} +
+ +
+ +
+ + + + + +
+
+ ); +} diff --git a/damiao_motor/gui/webapp/src/index.css b/damiao_motor/gui/webapp/src/index.css new file mode 100644 index 0000000..70232da --- /dev/null +++ b/damiao_motor/gui/webapp/src/index.css @@ -0,0 +1,189 @@ +:root { + --bg: #0d1117; + --bg-1: #11161d; + --bg-2: #161b22; + --bg-3: #1c232c; + --border: #2a313c; + --text: #c9d1d9; + --muted: #8b949e; + --accent: #58a6ff; + --ok: #3fb950; + --warn: #d29922; + --err: #ff7b72; + --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; + --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; +} + +* { box-sizing: border-box; } +html, body, #root { height: 100%; margin: 0; } +body { + font-family: var(--font); + background: var(--bg); + color: var(--text); + font-size: 13px; + -webkit-font-smoothing: antialiased; +} +.mono { font-family: var(--mono); } +.muted { color: var(--muted); } +.small { font-size: 11px; } +.center { text-align: center; } +.pad { padding: 16px; } +.strong { font-weight: 600; } +.dim { opacity: 0.55; } + +.app { display: flex; flex-direction: column; height: 100%; } +.body { flex: 1; display: flex; min-height: 0; } +.dock-host { flex: 1; min-width: 0; position: relative; } + +/* ------------------------------------------------------------- toolbar */ +.toolbar { + display: flex; + align-items: center; + gap: 16px; + height: 46px; + padding: 0 14px; + background: linear-gradient(180deg, #11161d, #0d1117); + border-bottom: 1px solid var(--border); +} +.brand { font-weight: 600; font-size: 15px; letter-spacing: 0.2px; display: flex; align-items: center; gap: 8px; } +.brand-sub { color: var(--muted); font-weight: 500; font-size: 12px; } +.brand-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); } +.conn { display: flex; align-items: center; gap: 8px; } +.conn .dot { width: 8px; height: 8px; border-radius: 50%; } +.dot.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); } +.dot.off { background: var(--err); } +.spacer { flex: 1; } +.actions { display: flex; gap: 6px; } + +.badge { + font-size: 10.5px; padding: 2px 7px; border-radius: 10px; font-weight: 600; + border: 1px solid transparent; text-transform: uppercase; letter-spacing: 0.3px; +} +.badge.ok { color: var(--ok); border-color: rgba(63,185,80,0.4); background: rgba(63,185,80,0.1); } +.badge.warn { color: var(--warn); border-color: rgba(210,153,34,0.4); background: rgba(210,153,34,0.1); } +.badge.err { color: var(--err); border-color: rgba(255,123,114,0.4); background: rgba(255,123,114,0.1); } + +.btn { + background: var(--bg-3); color: var(--text); border: 1px solid var(--border); + border-radius: 6px; padding: 5px 10px; font-size: 12px; cursor: pointer; + transition: background 0.15s, border-color 0.15s; +} +.btn:hover { background: #232c37; border-color: #3a434f; } +.btn.ghost { background: transparent; } +.btn.small { padding: 3px 8px; font-size: 11px; } +.btn.active { border-color: var(--accent); color: var(--accent); } + +/* ------------------------------------------------------------- sidebar */ +.sidebar { + width: 232px; flex-shrink: 0; background: var(--bg-1); + border-right: 1px solid var(--border); display: flex; flex-direction: column; +} +.sidebar-head { padding: 10px 12px; border-bottom: 1px solid var(--border); } +.sidebar-title { font-weight: 600; margin-bottom: 8px; } +.filter, .type-select, select { + width: 100%; background: var(--bg-3); border: 1px solid var(--border); + color: var(--text); border-radius: 6px; padding: 5px 8px; font-size: 12px; +} +.sidebar-body { flex: 1; overflow-y: auto; padding: 8px; } +.sidebar-foot { padding: 9px 12px; border-top: 1px solid var(--border); font-size: 11px; line-height: 1.5; } +.motor-group { margin-bottom: 12px; } +.motor-group-title { + font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; + color: var(--muted); margin: 0 2px 5px; +} +.chips { display: flex; flex-direction: column; gap: 4px; } + +.sig-chip { + display: flex; align-items: center; gap: 7px; padding: 5px 8px; + background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px; + cursor: grab; user-select: none; font-size: 12px; +} +.sig-chip:hover { background: var(--bg-3); border-color: #3a434f; } +.sig-chip.dragging { opacity: 0.4; } +.sig-swatch { width: 10px; height: 10px; border-radius: 3px; border: 2px solid; flex-shrink: 0; } +.sig-name { flex: 1; font-family: var(--mono); } +.sig-unit { color: var(--muted); font-size: 10.5px; } + +.drag-ghost { + background: var(--accent); color: #06223f; font-weight: 600; font-size: 12px; + padding: 6px 10px; border-radius: 6px; font-family: var(--mono); + box-shadow: 0 8px 20px rgba(0,0,0,0.5); +} + +/* ------------------------------------------------------------- panels */ +.panel { height: 100%; display: flex; flex-direction: column; background: var(--bg); overflow: hidden; } + +.plot-toolbar { + display: flex; align-items: center; gap: 8px; padding: 6px 10px; + border-bottom: 1px solid var(--border); flex-wrap: wrap; +} +.legend { display: flex; gap: 6px; flex-wrap: wrap; } +.legend-chip { + display: inline-flex; align-items: center; gap: 5px; font-size: 11px; + padding: 2px 6px 2px 5px; border: 1px solid var(--border); border-radius: 10px; + font-family: var(--mono); +} +.legend-swatch { width: 9px; height: 9px; border-radius: 2px; border: 1.5px solid; } +.legend-x { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 0 0 0 2px; } +.legend-x:hover { color: var(--err); } +.plot-host { flex: 1; min-height: 0; position: relative; padding: 4px; } +.plot-host.drop-over { outline: 2px dashed var(--accent); outline-offset: -4px; background: rgba(88,166,255,0.05); } +.drop-hint { + position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; + color: var(--muted); font-size: 12px; pointer-events: none; text-align: center; padding: 20px; +} +.uplot, .u-wrap { width: 100% !important; } + +/* table */ +.table-panel { overflow: auto; } +.motor-table { width: 100%; border-collapse: collapse; font-size: 12px; } +.motor-table th, .motor-table td { padding: 5px 9px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; } +.motor-table th:first-child, .motor-table td:first-child { text-align: left; } +.motor-table th { + position: sticky; top: 0; background: var(--bg-2); color: var(--muted); + font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.3px; +} +.motor-table tr:hover td { background: var(--bg-1); } +.cmd-col { color: var(--accent); } +.status-pill { font-size: 10px; padding: 1px 6px; border-radius: 8px; font-weight: 600; } +.status-pill.ok { color: var(--ok); background: rgba(63,185,80,0.12); } +.status-pill.off { color: var(--muted); background: rgba(139,148,158,0.12); } +.status-pill.warn { color: var(--warn); background: rgba(210,153,34,0.12); } + +/* cards */ +.cards-panel { overflow: auto; } +.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; padding: 12px; } +.motor-card { background: var(--bg-1); border: 1px solid var(--border); border-radius: 10px; padding: 12px; } +.motor-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; } +.motor-card-sub { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; } +.type-select { width: auto; padding: 2px 6px; font-size: 11px; } +.metric { margin-bottom: 8px; } +.metric-label { font-size: 11px; color: var(--text); margin-bottom: 2px; } +.metric-values { display: flex; align-items: baseline; gap: 10px; } +.metric-act { font-family: var(--mono); font-size: 19px; font-weight: 600; } +.metric-cmd { font-family: var(--mono); font-size: 12px; color: var(--accent); } +.temp-row { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; border-top: 1px solid var(--border); padding-top: 6px; } + +/* raw log */ +.rawlog-panel { font-size: 11.5px; } +.rawlog-toolbar { display: flex; align-items: center; gap: 10px; padding: 5px 10px; border-bottom: 1px solid var(--border); } +.rawlog-head, .rawlog-row { display: grid; grid-template-columns: 70px 64px 50px 90px 1fr 180px; gap: 8px; align-items: center; } +.rawlog-head { flex: 1; color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.3px; } +.rawlog-body { flex: 1; overflow: auto; padding: 0 10px; } +.rawlog-row { position: absolute; left: 10px; right: 10px; height: 22px; border-bottom: 1px solid rgba(42,49,60,0.5); } +.rawlog-row .c-r { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } +.rawlog-row.k-command .c-k { color: var(--accent); } +.rawlog-row.k-feedback .c-k { color: var(--ok); } +.rawlog-row.k-special .c-k { color: var(--warn); } + +/* ---------------------------------------------------- dockview theming */ +.dockview-theme-abyss { + --dv-background-color: var(--bg); + --dv-paneview-active-outline-color: var(--accent); + --dv-tabs-and-actions-container-background-color: var(--bg-1); + --dv-activegroup-visiblepanel-tab-background-color: var(--bg); + --dv-inactivegroup-visiblepanel-tab-background-color: var(--bg-1); + --dv-tab-divider-color: var(--border); + --dv-separator-border: var(--border); + height: 100%; +} diff --git a/damiao_motor/gui/webapp/src/lib/dataStore.ts b/damiao_motor/gui/webapp/src/lib/dataStore.ts new file mode 100644 index 0000000..08bb8e0 --- /dev/null +++ b/damiao_motor/gui/webapp/src/lib/dataStore.ts @@ -0,0 +1,156 @@ +/** + * Out-of-React time-series store. + * + * Holds a fixed-capacity ring buffer of (t, value) per signal so that high-rate sample + * ingestion never triggers React re-renders. Plot panels read contiguous arrays from + * here on a requestAnimationFrame loop. Also tracks ref-counted subscriptions so the WS + * client can stream only the signals that some panel is currently displaying. + */ + +import type { RawFrame } from "./types"; + +const CAPACITY = 6000; // ~ up to 60 s at 100 Hz per signal + +class Ring { + t: Float64Array; + v: Float64Array; + len = 0; + head = 0; // index of next write + constructor(cap = CAPACITY) { + this.t = new Float64Array(cap); + this.v = new Float64Array(cap); + } + push(t: number, v: number) { + const cap = this.t.length; + this.t[this.head] = t; + this.v[this.head] = v; + this.head = (this.head + 1) % cap; + if (this.len < cap) this.len++; + } + /** Return chronological contiguous arrays for points with t >= sinceT. */ + read(sinceT = -Infinity): { t: Float64Array; v: Float64Array } { + const cap = this.t.length; + const n = this.len; + const start = (this.head - n + cap) % cap; + const ts = new Float64Array(n); + const vs = new Float64Array(n); + let k = 0; + for (let i = 0; i < n; i++) { + const idx = (start + i) % cap; + if (this.t[idx] >= sinceT) { + ts[k] = this.t[idx]; + vs[k] = this.v[idx]; + k++; + } + } + return { t: ts.subarray(0, k), v: vs.subarray(0, k) }; + } + last(): number | null { + if (this.len === 0) return null; + const cap = this.t.length; + return this.v[(this.head - 1 + cap) % cap]; + } +} + +const rings = new Map(); + +function ring(id: string): Ring { + let r = rings.get(id); + if (!r) { + r = new Ring(); + rings.set(id, r); + } + return r; +} + +export function appendSample(id: string, t: number, v: number) { + ring(id).push(t, v); +} + +export function appendBatch(id: string, points: [number, number][]) { + const r = ring(id); + for (const [t, v] of points) r.push(t, v); +} + +export function readSeries(id: string, sinceT = -Infinity) { + const r = rings.get(id); + if (!r) return { t: new Float64Array(0), v: new Float64Array(0) }; + return r.read(sinceT); +} + +export function lastValue(id: string): number | null { + const r = rings.get(id); + return r ? r.last() : null; +} + +// ---------------------------------------------------------------- subscriptions +const subCounts = new Map(); +let subListeners: (() => void)[] = []; + +function notifySubs() { + subListeners.forEach((fn) => fn()); +} + +export function subscribeSignal(id: string) { + subCounts.set(id, (subCounts.get(id) || 0) + 1); + notifySubs(); +} + +export function unsubscribeSignal(id: string) { + const c = (subCounts.get(id) || 0) - 1; + if (c <= 0) subCounts.delete(id); + else subCounts.set(id, c); + notifySubs(); +} + +export function currentSubscriptions(): string[] { + return Array.from(subCounts.keys()); +} + +export function onSubscriptionsChanged(fn: () => void): () => void { + subListeners.push(fn); + return () => { + subListeners = subListeners.filter((f) => f !== fn); + }; +} + +// ----------------------------------------------------------------- raw frames +const RAW_CAP = 3000; +let rawFrames: RawFrame[] = []; +let rawListeners: (() => void)[] = []; + +export function pushRawFrames(frames: RawFrame[]) { + if (!frames.length) return; + rawFrames = rawFrames.concat(frames); + if (rawFrames.length > RAW_CAP) rawFrames = rawFrames.slice(-RAW_CAP); + rawListeners.forEach((fn) => fn()); +} + +export function getRawFrames(): RawFrame[] { + return rawFrames; +} + +export function onRawFrames(fn: () => void): () => void { + rawListeners.push(fn); + return () => { + rawListeners = rawListeners.filter((f) => f !== fn); + }; +} + +// raw enable ref-count (so /stream only sends raw when a RawLog panel is open) +let rawWanted = 0; +let rawWantListeners: (() => void)[] = []; +export function wantRaw(on: boolean) { + rawWanted += on ? 1 : -1; + if (rawWanted < 0) rawWanted = 0; + rawWantListeners.forEach((fn) => fn()); +} +export function isRawWanted(): boolean { + return rawWanted > 0; +} +export function onRawWantChanged(fn: () => void): () => void { + rawWantListeners.push(fn); + return () => { + rawWantListeners = rawWantListeners.filter((f) => f !== fn); + }; +} diff --git a/damiao_motor/gui/webapp/src/lib/dock.ts b/damiao_motor/gui/webapp/src/lib/dock.ts new file mode 100644 index 0000000..edb5d43 --- /dev/null +++ b/damiao_motor/gui/webapp/src/lib/dock.ts @@ -0,0 +1,24 @@ +import type { DockviewApi } from "dockview"; +import type { PanelKind } from "./types"; +import { PANEL_TITLES } from "./store"; + +let api: DockviewApi | null = null; +const counters: Record = {}; + +export function setDockApi(a: DockviewApi | null) { + api = a; +} +export function getDockApi(): DockviewApi | null { + return api; +} + +export function addPanelOfKind(kind: PanelKind) { + if (!api) return; + counters[kind] = (counters[kind] || 0) + 1; + const id = `${kind}-${Date.now().toString(36)}-${counters[kind]}`; + api.addPanel({ + id, + component: kind, + title: `${PANEL_TITLES[kind]} ${counters[kind]}`, + }); +} diff --git a/damiao_motor/gui/webapp/src/lib/format.ts b/damiao_motor/gui/webapp/src/lib/format.ts new file mode 100644 index 0000000..c100813 --- /dev/null +++ b/damiao_motor/gui/webapp/src/lib/format.ts @@ -0,0 +1,54 @@ +import type { SignalDescriptor } from "./types"; + +// Color per physical field; cmd vs fb share a hue, distinguished by dash + brightness. +const FIELD_COLORS: Record = { + pos: "#58a6ff", + vel: "#3fb950", + torque: "#d29922", + kp: "#bc8cff", + kd: "#f778ba", + vel_limit: "#56d4dd", + torque_limit: "#e3b341", + t_mos: "#ff7b72", + t_rotor: "#ffa657", + status_code: "#8b949e", +}; + +export function fieldColor(field: string): string { + return FIELD_COLORS[field] || "#8b949e"; +} + +export function signalColor(sig: { field: string; source: string }): string { + const base = fieldColor(sig.field); + return sig.source === "cmd" ? lighten(base, 0.15) : base; +} + +export function signalLabel(sig: SignalDescriptor): string { + return `m${sig.motorId} ${sig.source}.${sig.field}`; +} + +export function shortSignal(id: string): string { + // "bus:m1:cmd.pos" -> "m1 cmd.pos" + const parts = id.split(":"); + if (parts.length >= 3) return `${parts[1]} ${parts[2]}`; + return id; +} + +export function isCmd(id: string): boolean { + return id.includes(":cmd."); +} + +export const FIELD_ORDER = ["pos", "vel", "torque", "kp", "kd", "t_mos", "t_rotor"]; + +function lighten(hex: string, amount: number): string { + const c = hex.replace("#", ""); + const r = Math.min(255, Math.round(parseInt(c.slice(0, 2), 16) + 255 * amount)); + const g = Math.min(255, Math.round(parseInt(c.slice(2, 4), 16) + 255 * amount)); + const b = Math.min(255, Math.round(parseInt(c.slice(4, 6), 16) + 255 * amount)); + return `rgb(${r},${g},${b})`; +} + +export function fmt(v: number | null | undefined, digits = 3): string { + if (v == null || Number.isNaN(v)) return "—"; + return v.toFixed(digits); +} diff --git a/damiao_motor/gui/webapp/src/lib/store.ts b/damiao_motor/gui/webapp/src/lib/store.ts new file mode 100644 index 0000000..bcced31 --- /dev/null +++ b/damiao_motor/gui/webapp/src/lib/store.ts @@ -0,0 +1,115 @@ +/** Low-frequency app state (registry, status, motor views, panel configs, layout). */ + +import { create } from "zustand"; +import type { MotorView, Pair, PanelKind, ServerStatus, SignalDescriptor } from "./types"; + +export interface PlotConfig { + signals: string[]; + duration: number; // seconds visible +} + +// Persistence helpers must be defined BEFORE the store, because the store initializer +// calls loadPlotConfigs() synchronously (a `const` declared later would be in the TDZ). +const PLOT_KEY = "damiao.monitor.plotConfigs"; +export function loadPlotConfigs(): Record { + try { + return JSON.parse(localStorage.getItem(PLOT_KEY) || "{}"); + } catch { + return {}; + } +} +export function persistPlotConfigs(cfgs: Record) { + try { + localStorage.setItem(PLOT_KEY, JSON.stringify(cfgs)); + } catch { + /* ignore quota */ + } +} + +interface AppState { + connected: boolean; + status: ServerStatus | null; + signals: SignalDescriptor[]; + pairs: Pair[]; + motors: MotorView[]; + motorTypes: string[]; + // per-panel plot configs (signals shown), persisted alongside the dock layout + plotConfigs: Record; + + setConnected: (c: boolean) => void; + setStatus: (s: ServerStatus) => void; + setMeta: (signals: SignalDescriptor[], pairs: Pair[]) => void; + setMotors: (m: MotorView[]) => void; + setMotorTypes: (t: string[]) => void; + + ensurePlot: (id: string) => void; + setPlotConfig: (id: string, cfg: Partial) => void; + addSignalToPlot: (id: string, signalId: string) => void; + removeSignalFromPlot: (id: string, signalId: string) => void; + dropPlot: (id: string) => void; +} + +export const useApp = create((set, get) => ({ + connected: false, + status: null, + signals: [], + pairs: [], + motors: [], + motorTypes: [], + plotConfigs: loadPlotConfigs(), // hydrate synchronously to avoid effect-ordering races + + setConnected: (c) => set({ connected: c }), + setStatus: (s) => set({ status: s }), + setMeta: (signals, pairs) => set({ signals, pairs }), + setMotors: (motors) => set({ motors }), + setMotorTypes: (motorTypes) => set({ motorTypes }), + + ensurePlot: (id) => + set((st) => + st.plotConfigs[id] + ? st + : { plotConfigs: { ...st.plotConfigs, [id]: { signals: [], duration: 10 } } } + ), + setPlotConfig: (id, cfg) => + set((st) => ({ + plotConfigs: { + ...st.plotConfigs, + [id]: { ...(st.plotConfigs[id] || { signals: [], duration: 10 }), ...cfg }, + }, + })), + addSignalToPlot: (id, signalId) => + set((st) => { + const cur = st.plotConfigs[id] || { signals: [], duration: 10 }; + if (cur.signals.includes(signalId)) return st; + return { + plotConfigs: { ...st.plotConfigs, [id]: { ...cur, signals: [...cur.signals, signalId] } }, + }; + }), + removeSignalFromPlot: (id, signalId) => + set((st) => { + const cur = st.plotConfigs[id]; + if (!cur) return st; + return { + plotConfigs: { + ...st.plotConfigs, + [id]: { ...cur, signals: cur.signals.filter((s) => s !== signalId) }, + }, + }; + }), + dropPlot: (id) => + set((st) => { + const next = { ...st.plotConfigs }; + delete next[id]; + return { plotConfigs: next }; + }), +})); + +// persist plot configs whenever they change (dock layout persisted by the Dock component) +useApp.subscribe((st) => persistPlotConfigs(st.plotConfigs)); + +export const PANEL_TITLES: Record = { + plot: "Plot", + table: "Motor Table", + cards: "Motor Cards", + rawlog: "Raw CAN Log", +}; diff --git a/damiao_motor/gui/webapp/src/lib/types.ts b/damiao_motor/gui/webapp/src/lib/types.ts new file mode 100644 index 0000000..5d6acca --- /dev/null +++ b/damiao_motor/gui/webapp/src/lib/types.ts @@ -0,0 +1,54 @@ +export interface SignalDescriptor { + id: string; + bus: string; + motorId: number; + source: "cmd" | "fb"; + field: string; + unit: string; + pairKey: string; +} + +export interface Pair { + pairKey: string; + cmd: string; + fb: string; +} + +export interface MotorView { + bus: string; + motorId: number; + mode: string | null; + status: string; + lastT: number; + cmd: Record; + fb: Record; +} + +export interface ServerStatus { + channel: string; + bustype: string; + bitrate: number | null; + started: boolean; + error: string | null; + listenOnly: boolean; + feedbackOffset: number; + framesSeen: number; + decodeErrors: number; + registryVersion: number; + defaultMotorType: string; + demo?: boolean; +} + +export interface RawFrame { + seq: number; + t: number; + arb: number; + kind: string; + mode: string | null; + motorId: number; + note: string; + fields: Record; + raw: string; +} + +export type PanelKind = "plot" | "table" | "cards" | "rawlog"; diff --git a/damiao_motor/gui/webapp/src/lib/ws.ts b/damiao_motor/gui/webapp/src/lib/ws.ts new file mode 100644 index 0000000..d3270b6 --- /dev/null +++ b/damiao_motor/gui/webapp/src/lib/ws.ts @@ -0,0 +1,117 @@ +/** WebSocket client: feeds the data store + zustand app state. Auto-reconnects. */ + +import { + appendBatch, + currentSubscriptions, + isRawWanted, + onRawWantChanged, + onSubscriptionsChanged, + pushRawFrames, +} from "./dataStore"; +import { useApp } from "./store"; +import type { MotorView, Pair, RawFrame, ServerStatus, SignalDescriptor } from "./types"; + +let ws: WebSocket | null = null; +let reconnectTimer: number | null = null; + +function wsUrl(): string { + const proto = location.protocol === "https:" ? "wss" : "ws"; + return `${proto}://${location.host}/api/monitor/stream`; +} + +function sendSubscribe() { + if (ws && ws.readyState === WebSocket.OPEN) { + ws.send(JSON.stringify({ type: "subscribe", signals: currentSubscriptions() })); + } +} +function sendRaw() { + if (ws && ws.readyState === WebSocket.OPEN) { + ws.send(JSON.stringify({ type: "raw", enabled: isRawWanted() })); + } +} + +export function connectWs() { + const sock = new WebSocket(wsUrl()); + ws = sock; + + sock.onopen = () => { + useApp.getState().setConnected(true); + sendSubscribe(); + sendRaw(); + }; + + sock.onclose = () => { + useApp.getState().setConnected(false); + if (reconnectTimer == null) { + reconnectTimer = window.setTimeout(() => { + reconnectTimer = null; + connectWs(); + }, 1000); + } + }; + + sock.onerror = () => sock.close(); + + sock.onmessage = (ev) => { + let msg: any; + try { + msg = JSON.parse(ev.data); + } catch { + return; + } + const app = useApp.getState(); + switch (msg.type) { + case "meta": + app.setMeta(msg.signals as SignalDescriptor[], msg.pairs as Pair[]); + app.setMotors(msg.motors as MotorView[]); + break; + case "motors": + app.setMotors(msg.motors as MotorView[]); + if (msg.status) app.setStatus(msg.status as ServerStatus); + break; + case "samples": + for (const [sid, pts] of Object.entries(msg.data as Record)) { + appendBatch(sid, pts); + } + break; + case "raw": + pushRawFrames(msg.frames as RawFrame[]); + break; + } + }; + + // re-send subscription set whenever panels change what they want (debounced) + let subTimer: number | null = null; + onSubscriptionsChanged(() => { + if (subTimer != null) return; + subTimer = window.setTimeout(() => { + subTimer = null; + sendSubscribe(); + }, 80); + }); + onRawWantChanged(sendRaw); +} + +export async function fetchSnapshot(ids: string[], n = 600): Promise> { + if (!ids.length) return {}; + const res = await fetch(`/api/monitor/snapshot?signals=${ids.join(",")}&n=${n}`); + return res.json(); +} + +export async function fetchMotorTypes(): Promise { + try { + const res = await fetch("/api/monitor/motor-types"); + const d = await res.json(); + return d.types || []; + } catch { + return []; + } +} + +export async function setMotorType(motorId: number, motorType: string) { + await fetch("/api/monitor/motor-type", { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ motorId, motorType }), + }); +} diff --git a/damiao_motor/gui/webapp/src/main.tsx b/damiao_motor/gui/webapp/src/main.tsx new file mode 100644 index 0000000..9b67590 --- /dev/null +++ b/damiao_motor/gui/webapp/src/main.tsx @@ -0,0 +1,10 @@ +import React from "react"; +import ReactDOM from "react-dom/client"; +import App from "./App"; +import "./index.css"; + +ReactDOM.createRoot(document.getElementById("root")!).render( + + + +); diff --git a/damiao_motor/gui/webapp/src/panels/CardsPanel.tsx b/damiao_motor/gui/webapp/src/panels/CardsPanel.tsx new file mode 100644 index 0000000..d6a3853 --- /dev/null +++ b/damiao_motor/gui/webapp/src/panels/CardsPanel.tsx @@ -0,0 +1,61 @@ +import { useApp } from "../lib/store"; +import { fmt } from "../lib/format"; +import { setMotorType } from "../lib/ws"; + +function Metric({ label, cmd, act, unit, digits = 2 }: { label: string; cmd?: number; act?: number; unit: string; digits?: number }) { + return ( +
+
{label} {unit}
+
+ {fmt(act, digits)} + {cmd !== undefined && ⌖ {fmt(cmd, digits)}} +
+
+ ); +} + +export default function CardsPanel() { + const motors = useApp((s) => s.motors); + const motorTypes = useApp((s) => s.motorTypes); + + return ( +
+ {motors.length === 0 &&
Waiting for traffic…
} +
+ {motors.map((m) => ( +
+
+ Motor {m.motorId} + + {m.status || "—"} + +
+
+ {m.mode || "—"} + {motorTypes.length > 0 && ( + + )} +
+ + + +
+ MOS {fmt(m.fb.t_mos, 1)}° + Rotor {fmt(m.fb.t_rotor, 1)}° +
+
+ ))} +
+
+ ); +} diff --git a/damiao_motor/gui/webapp/src/panels/PlotPanel.tsx b/damiao_motor/gui/webapp/src/panels/PlotPanel.tsx new file mode 100644 index 0000000..cf90c57 --- /dev/null +++ b/damiao_motor/gui/webapp/src/panels/PlotPanel.tsx @@ -0,0 +1,198 @@ +import { useEffect, useMemo, useRef } from "react"; +import { useDroppable } from "@dnd-kit/core"; +import uPlot from "uplot"; +import "uplot/dist/uPlot.min.css"; + +import { useApp } from "../lib/store"; +import { + appendBatch, + readSeries, + subscribeSignal, + unsubscribeSignal, +} from "../lib/dataStore"; +import { fetchSnapshot } from "../lib/ws"; +import { isCmd, shortSignal, signalColor } from "../lib/format"; + +const MAX_X = 2000; // cap aligned x points per frame + +/** Forward-fill align several signals onto the union of their timestamps. */ +function buildAligned(ids: string[], sinceT: number): uPlot.AlignedData { + const series = ids.map((id) => readSeries(id, sinceT)); + const tset = new Set(); + for (const s of series) for (let i = 0; i < s.t.length; i++) tset.add(s.t[i]); + let xs = Array.from(tset).sort((a, b) => a - b); + if (xs.length > MAX_X) { + const stride = Math.ceil(xs.length / MAX_X); + xs = xs.filter((_, i) => i % stride === 0); + } + const cols: (number | null)[][] = [xs]; + for (const s of series) { + const col: (number | null)[] = new Array(xs.length).fill(null); + let j = 0; + let last: number | null = null; + for (let i = 0; i < xs.length; i++) { + while (j < s.t.length && s.t[j] <= xs[i]) { + last = s.v[j]; + j++; + } + col[i] = last; + } + cols.push(col); + } + return cols as unknown as uPlot.AlignedData; +} + +export default function PlotPanel({ panelId }: { panelId: string }) { + const ensurePlot = useApp((s) => s.ensurePlot); + const removeSignalFromPlot = useApp((s) => s.removeSignalFromPlot); + const setPlotConfig = useApp((s) => s.setPlotConfig); + const cfg = useApp((s) => s.plotConfigs[panelId]); + const signalsMeta = useApp((s) => s.signals); + + useEffect(() => { + ensurePlot(panelId); + }, [panelId, ensurePlot]); + + const signals = cfg?.signals ?? []; + const duration = cfg?.duration ?? 10; + const sigKey = signals.join("|"); + + const { setNodeRef, isOver } = useDroppable({ id: `plot:${panelId}`, data: { panelId } }); + const hostRef = useRef(null); + const plotRef = useRef(null); + const maxTRef = useRef(0); + + // (re)create the uPlot instance whenever the set of signals changes + useEffect(() => { + if (!hostRef.current) return; + const el = hostRef.current; + + const descById = new Map(signalsMeta.map((s) => [s.id, s])); + const seriesCfg: uPlot.Series[] = [ + { label: "t" }, + ...signals.map((id) => { + const d = descById.get(id); + const color = d ? signalColor(d) : "#8b949e"; + return { + label: shortSignal(id), + stroke: color, + width: 1.5, + dash: isCmd(id) ? [6, 4] : undefined, + points: { show: false }, + } as uPlot.Series; + }), + ]; + + const opts: uPlot.Options = { + width: el.clientWidth || 400, + height: el.clientHeight || 220, + legend: { show: false }, + series: seriesCfg, + cursor: { y: false, points: { show: true } }, + scales: { x: { time: false } }, + axes: [ + { + stroke: "#8b949e", + grid: { stroke: "rgba(139,148,158,0.12)" }, + ticks: { stroke: "rgba(139,148,158,0.2)" }, + values: (_u, vals) => vals.map((v) => (v - maxTRef.current).toFixed(1) + "s"), + }, + { + stroke: "#8b949e", + grid: { stroke: "rgba(139,148,158,0.12)" }, + ticks: { stroke: "rgba(139,148,158,0.2)" }, + }, + ], + }; + + const plot = new uPlot(opts, [[], ...signals.map(() => [])] as unknown as uPlot.AlignedData, el); + plotRef.current = plot; + + const ro = new ResizeObserver(() => { + plot.setSize({ width: el.clientWidth, height: el.clientHeight }); + }); + ro.observe(el); + + return () => { + ro.disconnect(); + plot.destroy(); + plotRef.current = null; + }; + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [sigKey, signalsMeta.length]); + + // subscribe to streams + backfill history when the signal set changes + useEffect(() => { + if (!signals.length) return; + signals.forEach(subscribeSignal); + let cancelled = false; + fetchSnapshot(signals, 1200).then((snap) => { + if (cancelled) return; + for (const [id, pts] of Object.entries(snap)) appendBatch(id, pts); + }); + return () => { + cancelled = true; + signals.forEach(unsubscribeSignal); + }; + }, [sigKey]); + + // rAF render loop: pull from the ring buffers and push into uPlot + useEffect(() => { + let raf = 0; + const tick = () => { + const plot = plotRef.current; + if (plot && signals.length) { + // find latest t across signals to anchor the window + let maxT = 0; + for (const id of signals) { + const s = readSeries(id); + if (s.t.length) maxT = Math.max(maxT, s.t[s.t.length - 1]); + } + maxTRef.current = maxT; + const data = buildAligned(signals, maxT - duration); + plot.setData(data, false); + plot.setScale("x", { min: maxT - duration, max: maxT }); + } + raf = requestAnimationFrame(tick); + }; + raf = requestAnimationFrame(tick); + return () => cancelAnimationFrame(raf); + }, [sigKey, duration]); + + const descById = useMemo(() => new Map(signalsMeta.map((s) => [s.id, s])), [signalsMeta]); + + return ( +
+
+ window + +
+ {signals.map((id) => { + const d = descById.get(id); + return ( + + + {shortSignal(id)} + + + ); + })} +
+
+
+ {signals.length === 0 && ( +
Drag signals here to plot — drop cmd onto fb to overlay
+ )} +
+
+ ); +} diff --git a/damiao_motor/gui/webapp/src/panels/RawLogPanel.tsx b/damiao_motor/gui/webapp/src/panels/RawLogPanel.tsx new file mode 100644 index 0000000..46a8586 --- /dev/null +++ b/damiao_motor/gui/webapp/src/panels/RawLogPanel.tsx @@ -0,0 +1,88 @@ +import { useEffect, useRef, useState } from "react"; +import { useVirtualizer } from "@tanstack/react-virtual"; + +import { getRawFrames, onRawFrames, wantRaw } from "../lib/dataStore"; +import type { RawFrame } from "../lib/types"; + +function fieldsSummary(f: RawFrame): string { + const keys = Object.keys(f.fields); + if (!keys.length) return f.note || ""; + return keys + .slice(0, 4) + .map((k) => `${k}=${f.fields[k]}`) + .join(" "); +} + +export default function RawLogPanel() { + const [, force] = useState(0); + const [paused, setPaused] = useState(false); + const parentRef = useRef(null); + const framesRef = useRef([]); + + useEffect(() => { + wantRaw(true); + const off = onRawFrames(() => { + if (!paused) { + framesRef.current = getRawFrames(); + force((x) => x + 1); + } + }); + return () => { + wantRaw(false); + off(); + }; + }, [paused]); + + const frames = framesRef.current; + const rowVirt = useVirtualizer({ + count: frames.length, + getScrollElement: () => parentRef.current, + estimateSize: () => 22, + overscan: 12, + }); + + // auto-scroll to bottom unless paused + useEffect(() => { + if (!paused && frames.length) rowVirt.scrollToIndex(frames.length - 1); + }, [frames.length, paused, rowVirt]); + + return ( +
+
+ + {frames.length} frames +
+ t + arb + motor + kind + decoded + raw +
+
+
+
+ {rowVirt.getVirtualItems().map((vi) => { + const f = frames[vi.index]; + return ( +
+ {f.t.toFixed(3)} + 0x{f.arb.toString(16).toUpperCase()} + m{f.motorId} + {f.mode || f.kind} + {fieldsSummary(f)} + {f.raw} +
+ ); + })} +
+
+
+ ); +} diff --git a/damiao_motor/gui/webapp/src/panels/TablePanel.tsx b/damiao_motor/gui/webapp/src/panels/TablePanel.tsx new file mode 100644 index 0000000..8f6bdcc --- /dev/null +++ b/damiao_motor/gui/webapp/src/panels/TablePanel.tsx @@ -0,0 +1,67 @@ +import { useApp } from "../lib/store"; +import { fmt } from "../lib/format"; + +const CMD_COLS: [string, string][] = [ + ["pos", "cmd p"], + ["vel", "cmd v"], + ["kp", "kp"], + ["kd", "kd"], + ["torque", "cmd τ"], +]; +const FB_COLS: [string, string][] = [ + ["pos", "act p"], + ["vel", "act v"], + ["torque", "act τ"], + ["t_mos", "Tmos"], + ["t_rotor", "Trot"], +]; + +export default function TablePanel() { + const motors = useApp((s) => s.motors); + + return ( +
+ + + + + + + {CMD_COLS.map(([k, l]) => ( + + ))} + {FB_COLS.map(([k, l]) => ( + + ))} + + + + {motors.length === 0 && ( + + + + )} + {motors.map((m) => ( + + + + + {CMD_COLS.map(([k]) => ( + + ))} + {FB_COLS.map(([k]) => ( + + ))} + + ))} + +
MotorModeStatus{l}{l}
+ Waiting for traffic… +
m{m.motorId}{m.mode || "—"} + + {m.status || "—"} + + {fmt(m.cmd[k], k === "kp" ? 0 : 3)}{fmt(m.fb[k], k.startsWith("t_") ? 1 : 3)}
+
+ ); +} diff --git a/damiao_motor/gui/webapp/tsconfig.json b/damiao_motor/gui/webapp/tsconfig.json new file mode 100644 index 0000000..c1183c9 --- /dev/null +++ b/damiao_motor/gui/webapp/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "target": "ES2021", + "useDefineForClassFields": true, + "lib": ["ES2021", "DOM", "DOM.Iterable"], + "module": "ESNext", + "skipLibCheck": true, + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + "jsx": "react-jsx", + "strict": true, + "noUnusedLocals": false, + "noUnusedParameters": false, + "noFallthroughCasesInSwitch": true + }, + "include": ["src"] +} diff --git a/damiao_motor/gui/webapp/tsconfig.tsbuildinfo b/damiao_motor/gui/webapp/tsconfig.tsbuildinfo new file mode 100644 index 0000000..4e996cb --- /dev/null +++ b/damiao_motor/gui/webapp/tsconfig.tsbuildinfo @@ -0,0 +1 @@ +{"root":["./src/app.tsx","./src/main.tsx","./src/components/dock.tsx","./src/components/signalchip.tsx","./src/components/signalsidebar.tsx","./src/components/toolbar.tsx","./src/lib/datastore.ts","./src/lib/dock.ts","./src/lib/format.ts","./src/lib/store.ts","./src/lib/types.ts","./src/lib/ws.ts","./src/panels/cardspanel.tsx","./src/panels/plotpanel.tsx","./src/panels/rawlogpanel.tsx","./src/panels/tablepanel.tsx"],"version":"5.9.3"} \ No newline at end of file diff --git a/damiao_motor/gui/webapp/vite.config.ts b/damiao_motor/gui/webapp/vite.config.ts new file mode 100644 index 0000000..6c2d08f --- /dev/null +++ b/damiao_motor/gui/webapp/vite.config.ts @@ -0,0 +1,22 @@ +import { defineConfig } from "vite"; +import react from "@vitejs/plugin-react"; + +// Built assets use relative paths so Flask can serve them from any mount point. +// In dev, proxy the REST API and the WebSocket stream to the Python monitor server. +const API_TARGET = process.env.MONITOR_API || "http://127.0.0.1:5001"; + +export default defineConfig({ + plugins: [react()], + base: "./", + build: { + outDir: "dist", + emptyOutDir: true, + }, + server: { + port: 5173, + proxy: { + "/api/monitor/stream": { target: API_TARGET.replace("http", "ws"), ws: true }, + "/api": { target: API_TARGET, changeOrigin: true }, + }, + }, +}); From 62310af152d26969faac8646432349654373ae9c Mon Sep 17 00:00:00 2001 From: Jia Xie Date: Mon, 15 Jun 2026 16:45:27 -0700 Subject: [PATCH 04/14] feat(monitor): wire 'damiao monitor' CLI + package the SPA bundle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - cli: new 'damiao monitor' subcommand (passive dashboard) mirroring 'gui', with --channel/--bustype/--bitrate/--feedback-offset/--motor-type/--demo; cmd_monitor handler. - packaging: switch to setuptools packages.find (was packages=['damiao_motor'], which silently omitted core/cli/gui subpackages from the wheel — latent bug); ship gui/webapp/dist via package-data. - CI: build the SPA (npm ci && npm run build) before the wheel and assert the bundle + monitor package are present in the wheel. Verified: wheel contains monitor/*, gui/webapp/dist/*, and the previously-missing core/cli/gui subpackages. Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/release.yml | 21 ++++++++++++++++++ damiao_motor/cli/__init__.py | 41 +++++++++++++++++++++++++++++++++++ damiao_motor/cli/commands.py | 27 +++++++++++++++++++++++ pyproject.toml | 13 ++++++++--- 4 files changed, 99 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7ce61ec..f0bb3e6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,12 +21,33 @@ jobs: with: python-version: "3.11" + - uses: actions/setup-node@v4 + with: + node-version: "20" + + - name: Build monitor dashboard (SPA) + run: | + cd damiao_motor/gui/webapp + npm ci + npm run build + - name: Install build tools run: python -m pip install --upgrade build twine - name: Build package run: python -m build + - name: Verify SPA bundle is in the wheel + run: | + python - <<'PY' + import glob, zipfile, sys + whl = sorted(glob.glob("dist/*.whl"))[-1] + names = zipfile.ZipFile(whl).namelist() + assert any("gui/webapp/dist/index.html" in n for n in names), "SPA index.html missing from wheel" + assert any("monitor/server.py" in n for n in names), "monitor package missing from wheel" + print("OK: SPA + monitor present in", whl) + PY + - name: Upload to PyPI run: python -m twine upload dist/* env: diff --git a/damiao_motor/cli/__init__.py b/damiao_motor/cli/__init__.py index 47d77c2..8013de7 100644 --- a/damiao_motor/cli/__init__.py +++ b/damiao_motor/cli/__init__.py @@ -19,6 +19,7 @@ cmd_send_cmd_vel, cmd_send_cmd_force_pos, cmd_gui, + cmd_monitor, ) from .formatter import ColorizedHelpFormatter @@ -161,6 +162,46 @@ def unified_main() -> None: ) gui_parser.set_defaults(func=cmd_gui) + # monitor command (passive, listen-only dashboard) + monitor_parser = subparsers.add_parser( + "monitor", + help="Launch passive (listen-only) realtime monitoring dashboard", + description=( + "Launch a listen-only dashboard that decodes both the commands another " + "controller is sending and the motors' feedback, in realtime. Never transmits." + ), + formatter_class=argparse.RawDescriptionHelpFormatter, + epilog=""" +Examples: + # Monitor a socketcan bus while another controller drives the motors + damiao monitor --channel can0 + + # I2RT-style feedback id scheme is +16 (the default); override if needed + damiao monitor --channel can_arm_l --feedback-offset 16 + + # Try the dashboard with synthetic traffic (no CAN hardware needed) + damiao monitor --demo + """, + ) + monitor_parser.add_argument("--host", type=str, default="127.0.0.1", + help="Host to bind to (default: 127.0.0.1)") + monitor_parser.add_argument("--port", type=int, default=5001, + help="Port to bind to (default: 5001)") + monitor_parser.add_argument("--channel", type=str, default="can0", + help="CAN channel to listen on (default: can0)") + monitor_parser.add_argument("--bustype", type=str, default="socketcan", + help="CAN bus type (default: socketcan)") + monitor_parser.add_argument("--bitrate", type=int, default=None, + help="CAN bitrate (required for some interfaces, e.g. gs_usb)") + monitor_parser.add_argument("--feedback-offset", type=int, default=16, dest="feedback_offset", + help="feedback arb id = motor id + offset (default: 16, the p16 scheme)") + monitor_parser.add_argument("--motor-type", type=str, default="DM4310", dest="default_motor_type", + help="Default motor type for value scaling (default: DM4310)") + monitor_parser.add_argument("--demo", action="store_true", + help="Synthesize traffic instead of opening a CAN bus") + monitor_parser.add_argument("--debug", action="store_true", help="Enable debug mode") + monitor_parser.set_defaults(func=cmd_monitor) + # Helper function to add global arguments to subcommands def add_global_args(subparser, include_motor_type: bool = True): """Add global arguments to a subcommand parser.""" diff --git a/damiao_motor/cli/commands.py b/damiao_motor/cli/commands.py index 4a90e4b..6689c7b 100644 --- a/damiao_motor/cli/commands.py +++ b/damiao_motor/cli/commands.py @@ -723,6 +723,33 @@ def cmd_gui(args) -> None: ) +def cmd_monitor(args) -> None: + """ + Handle 'monitor' subcommand. + + Launches the passive (listen-only) realtime monitoring dashboard. It decodes both + the commands another controller is sending and the motors' feedback, and never + transmits on the bus. + + Args: + args: Parsed command-line arguments containing host, port, channel, bustype, + bitrate, feedback_offset, default_motor_type, demo, debug. + """ + from damiao_motor.monitor import server as monitor_server + + monitor_server.run_server( + host=args.host, + port=args.port, + channel=args.channel, + bustype=args.bustype, + bitrate=args.bitrate, + feedback_offset=args.feedback_offset, + default_motor_type=args.default_motor_type, + debug=args.debug, + demo=args.demo, + ) + + def cmd_set_feedback_id(args) -> None: """ Handle 'set-feedback-id' subcommand. diff --git a/pyproject.toml b/pyproject.toml index 085c001..160fb03 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,8 +25,8 @@ dependencies = [ Homepage = "https://github.com/jia-xie/python-damiao-driver" Repository = "https://github.com/jia-xie/python-damiao-driver" -[tool.setuptools] -packages = ["damiao_motor"] +[tool.setuptools.packages.find] +include = ["damiao_motor*"] [tool.setuptools_scm] write_to = "damiao_motor/_version.py" @@ -40,7 +40,14 @@ dev = [ ] [tool.setuptools.package-data] -damiao_motor = ["gui/templates/*.html", "gui/static/css/*.css", "gui/static/js/*.js"] +damiao_motor = [ + "gui/templates/*.html", + "gui/static/css/*.css", + "gui/static/js/*.js", + "gui/webapp/dist/*", + "gui/webapp/dist/**/*", + "gui/webapp/dist/assets/*", +] damiao_motor_docs = ["docs/assets/*.css"] [project.scripts] From 18fef5747d93294ce208026fb1d1db9c1acb800d Mon Sep 17 00:00:00 2001 From: Jia Xie Date: Mon, 15 Jun 2026 16:47:31 -0700 Subject: [PATCH 05/14] docs(monitor): usage, dev workflow, and hardware test checklist Co-Authored-By: Claude Opus 4.8 (1M context) --- damiao_motor/monitor/README.md | 89 ++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 damiao_motor/monitor/README.md diff --git a/damiao_motor/monitor/README.md b/damiao_motor/monitor/README.md new file mode 100644 index 0000000..dce9dd3 --- /dev/null +++ b/damiao_motor/monitor/README.md @@ -0,0 +1,89 @@ +# DaMiao Passive Monitor + +A **listen-only** realtime dashboard. While another controller drives the motors on a CAN +bus, the monitor decodes **both** the commands that controller is sending **and** the +motors' feedback, and plots/tables them live. It never transmits on the bus. + +## Run + +```bash +# Listen on a socketcan bus that another controller is already driving +damiao monitor --channel can_arm_l + +# Try it with synthetic traffic — no CAN hardware needed +damiao monitor --demo + +# then open http://127.0.0.1:5001 +``` + +Key options: `--channel`, `--bustype` (default `socketcan`), `--bitrate` (e.g. for gs_usb), +`--feedback-offset` (feedback arb id = motor id + offset; default **16** = the I2RT `p16` +scheme), `--motor-type` (default scaling, default `DM4310`), `--demo`, `--port`. + +## Using the dashboard + +- **Drag** a signal from the left sidebar onto a **Plot** panel to chart it. Drop a `cmd.*` + signal onto the plot already showing its `fb.*` to **overlay** them (dashed = command, + solid = feedback). +- **Dock / merge** panels VS-Code-style: drag a panel's tab to split or group into tabs. + Layout + plots persist across reloads. +- Add more panels from the toolbar: **Plot**, **Motor Table**, **Motor Cards**, **Raw CAN + Log**. Per-motor **motor-type** can be overridden in the cards (rescales decode). + +## How it stays passive + +- The `monitor` package never imports or calls anything that transmits; it only ever calls + `bus.recv`. (`tests/test_monitor.py` asserts this.) +- On socketcan it also sets `CAN_RAW_LISTEN_ONLY` on the socket (best-effort defense in + depth). On a separate socketcan socket it sees all bus traffic without stealing frames + from the running controller. + +## Dev workflow (changing the UI) + +The dashboard is a Vite/React/TS app in `gui/webapp`. The built bundle in +`gui/webapp/dist/` is committed so end users need no Node toolchain. To develop: + +```bash +cd damiao_motor/gui/webapp +npm install +npm run dev # Vite dev server on :5173, proxies /api + WS to the monitor +# in another shell: +damiao monitor --demo # or --channel +# open the Vite URL (http://localhost:5173) + +npm run build # rebuild dist/ before committing UI changes +``` + +## Test checklist + +### A. Offline (no hardware — runs anywhere) +1. `pytest tests/test_monitor.py` — command/feedback decode round-trips + the + never-transmit assertion (10 tests). +2. `python -m build` then confirm the wheel ships the UI + package: + `unzip -l dist/*.whl | grep -E "webapp/dist/index.html|monitor/server.py"`. +3. `damiao monitor --demo` → open the URL: signals appear, drag `cmd.pos`+`fb.pos` onto a + plot and see the overlay track; cards + table update; add a Raw CAN Log panel and watch + frames stream; reload and confirm layout/plots persist. + +### B. On xdof_linearbot (real CAN) +4. **Idle bus, no crash:** with no controller running, + `damiao monitor --channel can_arm_l --host 0.0.0.0` → dashboard loads, top bar shows + `listen-only`, signal list empty (idle bus invents nothing). +5. **Passivity (do this any time it runs):** in another shell + `watch -n1 'ip -s link show can_arm_l | sed -n 5,6p'` → TX packets stay **0** while the + monitor runs. (Verified during development: opened the bus, `listen_only_applied=True`, + TX stayed 0.) +6. **Live decode:** start the real controller (FlowBase / LinearRail desktop launcher) or + a benign sender → on the monitor: + - signals auto-appear per motor; `cmd`↔`fb` pairs link; + - drag `cmd.pos` onto the `fb.pos` plot → overlay tracks (dashed cmd vs solid actual); + - Motor Table shows live commanded + actual columns; Cards update; Raw CAN Log streams + decoded MIT/POS_VEL/feedback frames. +7. **Right scaling:** if a motor reads with the wrong range (e.g. a base `DM4310V` uses + ±π rad), set its type in the card dropdown and confirm values correct. +8. **Feedback scheme:** if no feedback signals appear but commands do, the bus may not use + the `p16` (+16) feedback-id scheme — rerun with the correct `--feedback-offset`. +9. **Smoothness:** with all arm motors streaming at control rate, plots stay smooth and the + time window scrolls without growing lag. +10. **Coexistence:** the active controller is unaffected (the monitor only reads), and + `damiao gui` still works as before on its own run. From 4515dde28fb40c7af225583c4d9f590f60e770ea Mon Sep 17 00:00:00 2001 From: Jia Xie Date: Mon, 15 Jun 2026 18:00:29 -0700 Subject: [PATCH 06/14] refactor(monitor ui): registry-driven panels + raw-log polish MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - panels/registry.tsx: single source of truth for panel types (kind/title/icon/ description/render). Dock component map, toolbar add-buttons, panel titling, and default layout all derive from it — a new view is now one entry. - raw CAN log: sticky header inside the scroll container sharing the exact grid + padding (columns now align); single-line cells with ellipsis; compact decoded fields; clock timestamp instead of raw epoch. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../gui/webapp/dist/assets/index-B8iZZsik.js | 46 +++++++++++++ .../gui/webapp/dist/assets/index-BahOMQYE.css | 1 - .../gui/webapp/dist/assets/index-COYw01IO.css | 1 + .../gui/webapp/dist/assets/index-CStVIA4_.js | 46 ------------- damiao_motor/gui/webapp/dist/index.html | 4 +- .../gui/webapp/src/components/Dock.tsx | 20 +----- .../gui/webapp/src/components/Toolbar.tsx | 15 +++-- damiao_motor/gui/webapp/src/index.css | 31 +++++++-- damiao_motor/gui/webapp/src/lib/dock.ts | 13 ++-- damiao_motor/gui/webapp/src/lib/store.ts | 9 +-- damiao_motor/gui/webapp/src/lib/types.ts | 2 +- .../gui/webapp/src/panels/RawLogPanel.tsx | 43 +++++++++--- .../gui/webapp/src/panels/registry.tsx | 65 +++++++++++++++++++ damiao_motor/gui/webapp/tsconfig.tsbuildinfo | 2 +- 14 files changed, 195 insertions(+), 103 deletions(-) create mode 100644 damiao_motor/gui/webapp/dist/assets/index-B8iZZsik.js delete mode 100644 damiao_motor/gui/webapp/dist/assets/index-BahOMQYE.css create mode 100644 damiao_motor/gui/webapp/dist/assets/index-COYw01IO.css delete mode 100644 damiao_motor/gui/webapp/dist/assets/index-CStVIA4_.js create mode 100644 damiao_motor/gui/webapp/src/panels/registry.tsx diff --git a/damiao_motor/gui/webapp/dist/assets/index-B8iZZsik.js b/damiao_motor/gui/webapp/dist/assets/index-B8iZZsik.js new file mode 100644 index 0000000..fb1641c --- /dev/null +++ b/damiao_motor/gui/webapp/dist/assets/index-B8iZZsik.js @@ -0,0 +1,46 @@ +var c0=Object.defineProperty;var d0=(r,e,n)=>e in r?c0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[e]=n;var Tl=(r,e,n)=>d0(r,typeof e!="symbol"?e+"":e,n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))s(l);new MutationObserver(l=>{for(const a of l)if(a.type==="childList")for(const c of a.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function n(l){const a={};return l.integrity&&(a.integrity=l.integrity),l.referrerPolicy&&(a.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?a.credentials="include":l.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function s(l){if(l.ep)return;l.ep=!0;const a=n(l);fetch(l.href,a)}})();function Ah(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Id={exports:{}},Il={},Rd={exports:{}},Ue={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var tm;function h0(){if(tm)return Ue;tm=1;var r=Symbol.for("react.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),v=Symbol.iterator;function S(z){return z===null||typeof z!="object"?null:(z=v&&z[v]||z["@@iterator"],typeof z=="function"?z:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},A=Object.assign,D={};function P(z,F,q){this.props=z,this.context=F,this.refs=D,this.updater=q||E}P.prototype.isReactComponent={},P.prototype.setState=function(z,F){if(typeof z!="object"&&typeof z!="function"&&z!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,z,F,"setState")},P.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function N(){}N.prototype=P.prototype;function O(z,F,q){this.props=z,this.context=F,this.refs=D,this.updater=q||E}var M=O.prototype=new N;M.constructor=O,A(M,P.prototype),M.isPureReactComponent=!0;var R=Array.isArray,Z=Object.prototype.hasOwnProperty,G={current:null},$={key:!0,ref:!0,__self:!0,__source:!0};function K(z,F,q){var xe,Ie={},Se=null,Ee=null;if(F!=null)for(xe in F.ref!==void 0&&(Ee=F.ref),F.key!==void 0&&(Se=""+F.key),F)Z.call(F,xe)&&!$.hasOwnProperty(xe)&&(Ie[xe]=F[xe]);var We=arguments.length-2;if(We===1)Ie.children=q;else if(1>>1,F=le[z];if(0>>1;zl(Ie,ne))Sel(Ee,Ie)?(le[z]=Ee,le[Se]=ne,z=Se):(le[z]=Ie,le[xe]=ne,z=xe);else if(Sel(Ee,ne))le[z]=Ee,le[Se]=ne,z=Se;else break e}}return fe}function l(le,fe){var ne=le.sortIndex-fe.sortIndex;return ne!==0?ne:le.id-fe.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;r.unstable_now=function(){return a.now()}}else{var c=Date,d=c.now();r.unstable_now=function(){return c.now()-d}}var h=[],m=[],w=1,v=null,S=3,E=!1,A=!1,D=!1,P=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function M(le){for(var fe=n(m);fe!==null;){if(fe.callback===null)s(m);else if(fe.startTime<=le)s(m),fe.sortIndex=fe.expirationTime,e(h,fe);else break;fe=n(m)}}function R(le){if(D=!1,M(le),!A)if(n(h)!==null)A=!0,te(Z);else{var fe=n(m);fe!==null&&X(R,fe.startTime-le)}}function Z(le,fe){A=!1,D&&(D=!1,N(K),K=-1),E=!0;var ne=S;try{for(M(fe),v=n(h);v!==null&&(!(v.expirationTime>fe)||le&&!Q());){var z=v.callback;if(typeof z=="function"){v.callback=null,S=v.priorityLevel;var F=z(v.expirationTime<=fe);fe=r.unstable_now(),typeof F=="function"?v.callback=F:v===n(h)&&s(h),M(fe)}else s(h);v=n(h)}if(v!==null)var q=!0;else{var xe=n(m);xe!==null&&X(R,xe.startTime-fe),q=!1}return q}finally{v=null,S=ne,E=!1}}var G=!1,$=null,K=-1,he=5,ue=-1;function Q(){return!(r.unstable_now()-uele||125z?(le.sortIndex=ne,e(m,le),n(h)===null&&le===n(m)&&(D?(N(K),K=-1):D=!0,X(R,ne-z))):(le.sortIndex=F,e(h,le),A||E||(A=!0,te(Z))),le},r.unstable_shouldYield=Q,r.unstable_wrapCallback=function(le){var fe=S;return function(){var ne=S;S=fe;try{return le.apply(this,arguments)}finally{S=ne}}}})(Ld)),Ld}var om;function g0(){return om||(om=1,Md.exports=m0()),Md.exports}/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var lm;function v0(){if(lm)return fi;lm=1;var r=kh(),e=g0();function n(t){for(var i="https://reactjs.org/docs/error-decoder.html?invariant="+t,o=1;o"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=Object.prototype.hasOwnProperty,m=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,w={},v={};function S(t){return h.call(v,t)?!0:h.call(w,t)?!1:m.test(t)?v[t]=!0:(w[t]=!0,!1)}function E(t,i,o,u){if(o!==null&&o.type===0)return!1;switch(typeof i){case"function":case"symbol":return!0;case"boolean":return u?!1:o!==null?!o.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function A(t,i,o,u){if(i===null||typeof i>"u"||E(t,i,o,u))return!0;if(u)return!1;if(o!==null)switch(o.type){case 3:return!i;case 4:return i===!1;case 5:return isNaN(i);case 6:return isNaN(i)||1>i}return!1}function D(t,i,o,u,f,p,_){this.acceptsBooleans=i===2||i===3||i===4,this.attributeName=u,this.attributeNamespace=f,this.mustUseProperty=o,this.propertyName=t,this.type=i,this.sanitizeURL=p,this.removeEmptyString=_}var P={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){P[t]=new D(t,0,!1,t,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var i=t[0];P[i]=new D(i,1,!1,t[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){P[t]=new D(t,2,!1,t.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){P[t]=new D(t,2,!1,t,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){P[t]=new D(t,3,!1,t.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(t){P[t]=new D(t,3,!0,t,null,!1,!1)}),["capture","download"].forEach(function(t){P[t]=new D(t,4,!1,t,null,!1,!1)}),["cols","rows","size","span"].forEach(function(t){P[t]=new D(t,6,!1,t,null,!1,!1)}),["rowSpan","start"].forEach(function(t){P[t]=new D(t,5,!1,t.toLowerCase(),null,!1,!1)});var N=/[\-:]([a-z])/g;function O(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var i=t.replace(N,O);P[i]=new D(i,1,!1,t,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var i=t.replace(N,O);P[i]=new D(i,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(t){var i=t.replace(N,O);P[i]=new D(i,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(t){P[t]=new D(t,1,!1,t.toLowerCase(),null,!1,!1)}),P.xlinkHref=new D("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(t){P[t]=new D(t,1,!1,t.toLowerCase(),null,!0,!0)});function M(t,i,o,u){var f=P.hasOwnProperty(i)?P[i]:null;(f!==null?f.type!==0:u||!(2b||f[_]!==p[b]){var k=` +`+f[_].replace(" at new "," at ");return t.displayName&&k.includes("")&&(k=k.replace("",t.displayName)),k}while(1<=_&&0<=b);break}}}finally{q=!1,Error.prepareStackTrace=o}return(t=t?t.displayName||t.name:"")?F(t):""}function Ie(t){switch(t.tag){case 5:return F(t.type);case 16:return F("Lazy");case 13:return F("Suspense");case 19:return F("SuspenseList");case 0:case 2:case 15:return t=xe(t.type,!1),t;case 11:return t=xe(t.type.render,!1),t;case 1:return t=xe(t.type,!0),t;default:return""}}function Se(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case $:return"Fragment";case G:return"Portal";case he:return"Profiler";case K:return"StrictMode";case ie:return"Suspense";case ce:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Q:return(t.displayName||"Context")+".Consumer";case ue:return(t._context.displayName||"Context")+".Provider";case ve:var i=t.render;return t=t.displayName,t||(t=i.displayName||i.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case j:return i=t.displayName||null,i!==null?i:Se(t.type)||"Memo";case te:i=t._payload,t=t._init;try{return Se(t(i))}catch{}}return null}function Ee(t){var i=t.type;switch(t.tag){case 24:return"Cache";case 9:return(i.displayName||"Context")+".Consumer";case 10:return(i._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=i.render,t=t.displayName||t.name||"",i.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return i;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Se(i);case 8:return i===K?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i}return null}function We(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Fe(t){var i=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function Me(t){var i=Fe(t)?"checked":"value",o=Object.getOwnPropertyDescriptor(t.constructor.prototype,i),u=""+t[i];if(!t.hasOwnProperty(i)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var f=o.get,p=o.set;return Object.defineProperty(t,i,{configurable:!0,get:function(){return f.call(this)},set:function(_){u=""+_,p.call(this,_)}}),Object.defineProperty(t,i,{enumerable:o.enumerable}),{getValue:function(){return u},setValue:function(_){u=""+_},stopTracking:function(){t._valueTracker=null,delete t[i]}}}}function Zt(t){t._valueTracker||(t._valueTracker=Me(t))}function Wt(t){if(!t)return!1;var i=t._valueTracker;if(!i)return!0;var o=i.getValue(),u="";return t&&(u=Fe(t)?t.checked?"true":"false":t.value),t=u,t!==o?(i.setValue(t),!0):!1}function Ft(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Ht(t,i){var o=i.checked;return ne({},i,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:o??t._wrapperState.initialChecked})}function ii(t,i){var o=i.defaultValue==null?"":i.defaultValue,u=i.checked!=null?i.checked:i.defaultChecked;o=We(i.value!=null?i.value:o),t._wrapperState={initialChecked:u,initialValue:o,controlled:i.type==="checkbox"||i.type==="radio"?i.checked!=null:i.value!=null}}function Tn(t,i){i=i.checked,i!=null&&M(t,"checked",i,!1)}function zi(t,i){Tn(t,i);var o=We(i.value),u=i.type;if(o!=null)u==="number"?(o===0&&t.value===""||t.value!=o)&&(t.value=""+o):t.value!==""+o&&(t.value=""+o);else if(u==="submit"||u==="reset"){t.removeAttribute("value");return}i.hasOwnProperty("value")?Un(t,i.type,o):i.hasOwnProperty("defaultValue")&&Un(t,i.type,We(i.defaultValue)),i.checked==null&&i.defaultChecked!=null&&(t.defaultChecked=!!i.defaultChecked)}function ls(t,i,o){if(i.hasOwnProperty("value")||i.hasOwnProperty("defaultValue")){var u=i.type;if(!(u!=="submit"&&u!=="reset"||i.value!==void 0&&i.value!==null))return;i=""+t._wrapperState.initialValue,o||i===t.value||(t.value=i),t.defaultValue=i}o=t.name,o!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,o!==""&&(t.name=o)}function Un(t,i,o){(i!=="number"||Ft(t.ownerDocument)!==t)&&(o==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+o&&(t.defaultValue=""+o))}var nt=Array.isArray;function cn(t,i,o,u){if(t=t.options,i){i={};for(var f=0;f"+i.valueOf().toString()+"",i=hn.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;i.firstChild;)t.appendChild(i.firstChild)}});function Xt(t,i){if(i){var o=t.firstChild;if(o&&o===t.lastChild&&o.nodeType===3){o.nodeValue=i;return}}t.textContent=i}var zt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},fn=["Webkit","ms","Moz","O"];Object.keys(zt).forEach(function(t){fn.forEach(function(i){i=i+t.charAt(0).toUpperCase()+t.substring(1),zt[i]=zt[t]})});function xn(t,i,o){return i==null||typeof i=="boolean"||i===""?"":o||typeof i!="number"||i===0||zt.hasOwnProperty(t)&&zt[t]?(""+i).trim():i+"px"}function qt(t,i){t=t.style;for(var o in i)if(i.hasOwnProperty(o)){var u=o.indexOf("--")===0,f=xn(o,i[o],u);o==="float"&&(o="cssFloat"),u?t.setProperty(o,f):t[o]=f}}var En=ne({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function as(t,i){if(i){if(En[t]&&(i.children!=null||i.dangerouslySetInnerHTML!=null))throw Error(n(137,t));if(i.dangerouslySetInnerHTML!=null){if(i.children!=null)throw Error(n(60));if(typeof i.dangerouslySetInnerHTML!="object"||!("__html"in i.dangerouslySetInnerHTML))throw Error(n(61))}if(i.style!=null&&typeof i.style!="object")throw Error(n(62))}}function us(t,i){if(t.indexOf("-")===-1)return typeof i.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var mi=null;function gi(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var cs=null,Nt=null,ut=null;function en(t){if(t=vl(t)){if(typeof cs!="function")throw Error(n(280));var i=t.stateNode;i&&(i=Oa(i),cs(t.stateNode,t.type,i))}}function pn(t){Nt?ut?ut.push(t):ut=[t]:Nt=t}function vi(){if(Nt){var t=Nt,i=ut;if(ut=Nt=null,en(t),i)for(t=0;t>>=0,t===0?32:31-(tl(t)/Nn|0)|0}var Cr=64,js=4194304;function Bs(t){switch(t&-t){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: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&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function io(t,i){var o=t.pendingLanes;if(o===0)return 0;var u=0,f=t.suspendedLanes,p=t.pingedLanes,_=o&268435455;if(_!==0){var b=_&~f;b!==0?u=Bs(b):(p&=_,p!==0&&(u=Bs(p)))}else _=o&~f,_!==0?u=Bs(_):p!==0&&(u=Bs(p));if(u===0)return 0;if(i!==0&&i!==u&&(i&f)===0&&(f=u&-u,p=i&-i,f>=p||f===16&&(p&4194240)!==0))return i;if((u&4)!==0&&(u|=o&16),i=t.entangledLanes,i!==0)for(t=t.entanglements,i&=u;0o;o++)i.push(t);return i}function Us(t,i,o){t.pendingLanes|=i,i!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,i=31-Yn(i),t[i]=o}function sl(t,i){var o=t.pendingLanes&~i;t.pendingLanes=i,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=i,t.mutableReadLanes&=i,t.entangledLanes&=i,i=t.entanglements;var u=t.eventTimes;for(t=t.expirationTimes;0=Ps),xa=" ",po=!1;function g(t,i){switch(t){case"keyup":return Tt.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function y(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var C=!1;function x(t,i){switch(t){case"compositionend":return y(i);case"keypress":return i.which!==32?null:(po=!0,xa);case"textInput":return t=i.data,t===xa&&po?null:t;default:return null}}function T(t,i){if(C)return t==="compositionend"||!fo&&g(t,i)?(t=Si(),yi=al=_i=null,C=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1=i)return{node:o,offset:i-t};t=u}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=li(o)}}function Ln(t,i){return t&&i?t===i?!0:t&&t.nodeType===3?!1:i&&i.nodeType===3?Ln(t,i.parentNode):"contains"in t?t.contains(i):t.compareDocumentPosition?!!(t.compareDocumentPosition(i)&16):!1:!1}function Zn(){for(var t=window,i=Ft();i instanceof t.HTMLIFrameElement;){try{var o=typeof i.contentWindow.location.href=="string"}catch{o=!1}if(o)t=i.contentWindow;else break;i=Ft(t.document)}return i}function Xn(t){var i=t&&t.nodeName&&t.nodeName.toLowerCase();return i&&(i==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||i==="textarea"||t.contentEditable==="true")}function Ni(t){var i=Zn(),o=t.focusedElem,u=t.selectionRange;if(i!==o&&o&&o.ownerDocument&&Ln(o.ownerDocument.documentElement,o)){if(u!==null&&Xn(o)){if(i=u.start,t=u.end,t===void 0&&(t=i),"selectionStart"in o)o.selectionStart=i,o.selectionEnd=Math.min(t,o.value.length);else if(t=(i=o.ownerDocument||document)&&i.defaultView||window,t.getSelection){t=t.getSelection();var f=o.textContent.length,p=Math.min(u.start,f);u=u.end===void 0?p:Math.min(u.end,f),!t.extend&&p>u&&(f=u,u=p,p=f),f=Ci(o,p);var _=Ci(o,u);f&&_&&(t.rangeCount!==1||t.anchorNode!==f.node||t.anchorOffset!==f.offset||t.focusNode!==_.node||t.focusOffset!==_.offset)&&(i=i.createRange(),i.setStart(f.node,f.offset),t.removeAllRanges(),p>u?(t.addRange(i),t.extend(_.node,_.offset)):(i.setEnd(_.node,_.offset),t.addRange(i)))}}for(i=[],t=o;t=t.parentNode;)t.nodeType===1&&i.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o=document.documentMode,Yt=null,Ji=null,Vt=null,mo=!1;function af(t,i,o){var u=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;mo||Yt==null||Yt!==Ft(u)||(u=Yt,"selectionStart"in u&&Xn(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),Vt&&vn(Vt,u)||(Vt=u,u=Aa(Ji,"onSelect"),0yo||(t.current=zc[yo],zc[yo]=null,yo--)}function mt(t,i){yo++,zc[yo]=t.current,t.current=i}var rr={},Vn=sr(rr),ai=sr(!1),Rr=rr;function So(t,i){var o=t.type.contextTypes;if(!o)return rr;var u=t.stateNode;if(u&&u.__reactInternalMemoizedUnmaskedChildContext===i)return u.__reactInternalMemoizedMaskedChildContext;var f={},p;for(p in o)f[p]=i[p];return u&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=i,t.__reactInternalMemoizedMaskedChildContext=f),f}function ui(t){return t=t.childContextTypes,t!=null}function Ta(){vt(ai),vt(Vn)}function Cf(t,i,o){if(Vn.current!==rr)throw Error(n(168));mt(Vn,i),mt(ai,o)}function xf(t,i,o){var u=t.stateNode;if(i=i.childContextTypes,typeof u.getChildContext!="function")return o;u=u.getChildContext();for(var f in u)if(!(f in i))throw Error(n(108,Ee(t)||"Unknown",f));return ne({},o,u)}function Ia(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||rr,Rr=Vn.current,mt(Vn,t),mt(ai,ai.current),!0}function Ef(t,i,o){var u=t.stateNode;if(!u)throw Error(n(169));o?(t=xf(t,i,Rr),u.__reactInternalMemoizedMergedChildContext=t,vt(ai),vt(Vn),mt(Vn,t)):vt(ai),mt(ai,o)}var ks=null,Ra=!1,Oc=!1;function bf(t){ks===null?ks=[t]:ks.push(t)}function kw(t){Ra=!0,bf(t)}function or(){if(!Oc&&ks!==null){Oc=!0;var t=0,i=Ke;try{var o=ks;for(Ke=1;t>=_,f-=_,zs=1<<32-Yn(i)+f|o<Ge?(yn=Te,Te=null):yn=Te.sibling;var Xe=ee(L,Te,W[Ge],de);if(Xe===null){Te===null&&(Te=yn);break}t&&Te&&Xe.alternate===null&&i(L,Te),I=p(Xe,I,Ge),Oe===null?Ae=Xe:Oe.sibling=Xe,Oe=Xe,Te=yn}if(Ge===W.length)return o(L,Te),Ct&&Mr(L,Ge),Ae;if(Te===null){for(;GeGe?(yn=Te,Te=null):yn=Te.sibling;var mr=ee(L,Te,Xe.value,de);if(mr===null){Te===null&&(Te=yn);break}t&&Te&&mr.alternate===null&&i(L,Te),I=p(mr,I,Ge),Oe===null?Ae=mr:Oe.sibling=mr,Oe=mr,Te=yn}if(Xe.done)return o(L,Te),Ct&&Mr(L,Ge),Ae;if(Te===null){for(;!Xe.done;Ge++,Xe=W.next())Xe=oe(L,Xe.value,de),Xe!==null&&(I=p(Xe,I,Ge),Oe===null?Ae=Xe:Oe.sibling=Xe,Oe=Xe);return Ct&&Mr(L,Ge),Ae}for(Te=u(L,Te);!Xe.done;Ge++,Xe=W.next())Xe=ye(Te,L,Ge,Xe.value,de),Xe!==null&&(t&&Xe.alternate!==null&&Te.delete(Xe.key===null?Ge:Xe.key),I=p(Xe,I,Ge),Oe===null?Ae=Xe:Oe.sibling=Xe,Oe=Xe);return t&&Te.forEach(function(u0){return i(L,u0)}),Ct&&Mr(L,Ge),Ae}function Gt(L,I,W,de){if(typeof W=="object"&&W!==null&&W.type===$&&W.key===null&&(W=W.props.children),typeof W=="object"&&W!==null){switch(W.$$typeof){case Z:e:{for(var Ae=W.key,Oe=I;Oe!==null;){if(Oe.key===Ae){if(Ae=W.type,Ae===$){if(Oe.tag===7){o(L,Oe.sibling),I=f(Oe,W.props.children),I.return=L,L=I;break e}}else if(Oe.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===te&&Tf(Ae)===Oe.type){o(L,Oe.sibling),I=f(Oe,W.props),I.ref=wl(L,Oe,W),I.return=L,L=I;break e}o(L,Oe);break}else i(L,Oe);Oe=Oe.sibling}W.type===$?(I=Br(W.props.children,L.mode,de,W.key),I.return=L,L=I):(de=au(W.type,W.key,W.props,null,L.mode,de),de.ref=wl(L,I,W),de.return=L,L=de)}return _(L);case G:e:{for(Oe=W.key;I!==null;){if(I.key===Oe)if(I.tag===4&&I.stateNode.containerInfo===W.containerInfo&&I.stateNode.implementation===W.implementation){o(L,I.sibling),I=f(I,W.children||[]),I.return=L,L=I;break e}else{o(L,I);break}else i(L,I);I=I.sibling}I=Ad(W,L.mode,de),I.return=L,L=I}return _(L);case te:return Oe=W._init,Gt(L,I,Oe(W._payload),de)}if(nt(W))return Ce(L,I,W,de);if(fe(W))return be(L,I,W,de);Va(L,W)}return typeof W=="string"&&W!==""||typeof W=="number"?(W=""+W,I!==null&&I.tag===6?(o(L,I.sibling),I=f(I,W),I.return=L,L=I):(o(L,I),I=Pd(W,L.mode,de),I.return=L,L=I),_(L)):o(L,I)}return Gt}var Eo=If(!0),Rf=If(!1),Ga=sr(null),Wa=null,bo=null,Lc=null;function Vc(){Lc=bo=Wa=null}function Gc(t){var i=Ga.current;vt(Ga),t._currentValue=i}function Wc(t,i,o){for(;t!==null;){var u=t.alternate;if((t.childLanes&i)!==i?(t.childLanes|=i,u!==null&&(u.childLanes|=i)):u!==null&&(u.childLanes&i)!==i&&(u.childLanes|=i),t===o)break;t=t.return}}function Po(t,i){Wa=t,Lc=bo=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&i)!==0&&(ci=!0),t.firstContext=null)}function Vi(t){var i=t._currentValue;if(Lc!==t)if(t={context:t,memoizedValue:i,next:null},bo===null){if(Wa===null)throw Error(n(308));bo=t,Wa.dependencies={lanes:0,firstContext:t}}else bo=bo.next=t;return i}var Lr=null;function Fc(t){Lr===null?Lr=[t]:Lr.push(t)}function Nf(t,i,o,u){var f=i.interleaved;return f===null?(o.next=o,Fc(i)):(o.next=f.next,f.next=o),i.interleaved=o,Ts(t,u)}function Ts(t,i){t.lanes|=i;var o=t.alternate;for(o!==null&&(o.lanes|=i),o=t,t=t.return;t!==null;)t.childLanes|=i,o=t.alternate,o!==null&&(o.childLanes|=i),o=t,t=t.return;return o.tag===3?o.stateNode:null}var lr=!1;function Hc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Mf(t,i){t=t.updateQueue,i.updateQueue===t&&(i.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Is(t,i){return{eventTime:t,lane:i,tag:0,payload:null,callback:null,next:null}}function ar(t,i,o){var u=t.updateQueue;if(u===null)return null;if(u=u.shared,(Qe&2)!==0){var f=u.pending;return f===null?i.next=i:(i.next=f.next,f.next=i),u.pending=i,Ts(t,o)}return f=u.interleaved,f===null?(i.next=i,Fc(u)):(i.next=f.next,f.next=i),u.interleaved=i,Ts(t,o)}function Fa(t,i,o){if(i=i.updateQueue,i!==null&&(i=i.shared,(o&4194240)!==0)){var u=i.lanes;u&=t.pendingLanes,o|=u,i.lanes=o,$s(t,o)}}function Lf(t,i){var o=t.updateQueue,u=t.alternate;if(u!==null&&(u=u.updateQueue,o===u)){var f=null,p=null;if(o=o.firstBaseUpdate,o!==null){do{var _={eventTime:o.eventTime,lane:o.lane,tag:o.tag,payload:o.payload,callback:o.callback,next:null};p===null?f=p=_:p=p.next=_,o=o.next}while(o!==null);p===null?f=p=i:p=p.next=i}else f=p=i;o={baseState:u.baseState,firstBaseUpdate:f,lastBaseUpdate:p,shared:u.shared,effects:u.effects},t.updateQueue=o;return}t=o.lastBaseUpdate,t===null?o.firstBaseUpdate=i:t.next=i,o.lastBaseUpdate=i}function Ha(t,i,o,u){var f=t.updateQueue;lr=!1;var p=f.firstBaseUpdate,_=f.lastBaseUpdate,b=f.shared.pending;if(b!==null){f.shared.pending=null;var k=b,H=k.next;k.next=null,_===null?p=H:_.next=H,_=k;var re=t.alternate;re!==null&&(re=re.updateQueue,b=re.lastBaseUpdate,b!==_&&(b===null?re.firstBaseUpdate=H:b.next=H,re.lastBaseUpdate=k))}if(p!==null){var oe=f.baseState;_=0,re=H=k=null,b=p;do{var ee=b.lane,ye=b.eventTime;if((u&ee)===ee){re!==null&&(re=re.next={eventTime:ye,lane:0,tag:b.tag,payload:b.payload,callback:b.callback,next:null});e:{var Ce=t,be=b;switch(ee=i,ye=o,be.tag){case 1:if(Ce=be.payload,typeof Ce=="function"){oe=Ce.call(ye,oe,ee);break e}oe=Ce;break e;case 3:Ce.flags=Ce.flags&-65537|128;case 0:if(Ce=be.payload,ee=typeof Ce=="function"?Ce.call(ye,oe,ee):Ce,ee==null)break e;oe=ne({},oe,ee);break e;case 2:lr=!0}}b.callback!==null&&b.lane!==0&&(t.flags|=64,ee=f.effects,ee===null?f.effects=[b]:ee.push(b))}else ye={eventTime:ye,lane:ee,tag:b.tag,payload:b.payload,callback:b.callback,next:null},re===null?(H=re=ye,k=oe):re=re.next=ye,_|=ee;if(b=b.next,b===null){if(b=f.shared.pending,b===null)break;ee=b,b=ee.next,ee.next=null,f.lastBaseUpdate=ee,f.shared.pending=null}}while(!0);if(re===null&&(k=oe),f.baseState=k,f.firstBaseUpdate=H,f.lastBaseUpdate=re,i=f.shared.interleaved,i!==null){f=i;do _|=f.lane,f=f.next;while(f!==i)}else p===null&&(f.shared.lanes=0);Wr|=_,t.lanes=_,t.memoizedState=oe}}function Vf(t,i,o){if(t=i.effects,i.effects=null,t!==null)for(i=0;io?o:4,t(!0);var u=Yc.transition;Yc.transition={};try{t(!1),i()}finally{Ke=o,Yc.transition=u}}function ip(){return Gi().memoizedState}function Iw(t,i,o){var u=hr(t);if(o={lane:u,action:o,hasEagerState:!1,eagerState:null,next:null},sp(t))rp(i,o);else if(o=Nf(t,i,o,u),o!==null){var f=ei();es(o,t,u,f),op(o,i,u)}}function Rw(t,i,o){var u=hr(t),f={lane:u,action:o,hasEagerState:!1,eagerState:null,next:null};if(sp(t))rp(i,f);else{var p=t.alternate;if(t.lanes===0&&(p===null||p.lanes===0)&&(p=i.lastRenderedReducer,p!==null))try{var _=i.lastRenderedState,b=p(_,o);if(f.hasEagerState=!0,f.eagerState=b,dt(b,_)){var k=i.interleaved;k===null?(f.next=f,Fc(i)):(f.next=k.next,k.next=f),i.interleaved=f;return}}catch{}finally{}o=Nf(t,i,f,u),o!==null&&(f=ei(),es(o,t,u,f),op(o,i,u))}}function sp(t){var i=t.alternate;return t===At||i!==null&&i===At}function rp(t,i){Dl=Ua=!0;var o=t.pending;o===null?i.next=i:(i.next=o.next,o.next=i),t.pending=i}function op(t,i,o){if((o&4194240)!==0){var u=i.lanes;u&=t.pendingLanes,o|=u,i.lanes=o,$s(t,o)}}var Ka={readContext:Vi,useCallback:Gn,useContext:Gn,useEffect:Gn,useImperativeHandle:Gn,useInsertionEffect:Gn,useLayoutEffect:Gn,useMemo:Gn,useReducer:Gn,useRef:Gn,useState:Gn,useDebugValue:Gn,useDeferredValue:Gn,useTransition:Gn,useMutableSource:Gn,useSyncExternalStore:Gn,useId:Gn,unstable_isNewReconciler:!1},Nw={readContext:Vi,useCallback:function(t,i){return gs().memoizedState=[t,i===void 0?null:i],t},useContext:Vi,useEffect:Jf,useImperativeHandle:function(t,i,o){return o=o!=null?o.concat([t]):null,$a(4194308,4,Xf.bind(null,i,t),o)},useLayoutEffect:function(t,i){return $a(4194308,4,t,i)},useInsertionEffect:function(t,i){return $a(4,2,t,i)},useMemo:function(t,i){var o=gs();return i=i===void 0?null:i,t=t(),o.memoizedState=[t,i],t},useReducer:function(t,i,o){var u=gs();return i=o!==void 0?o(i):i,u.memoizedState=u.baseState=i,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:i},u.queue=t,t=t.dispatch=Iw.bind(null,At,t),[u.memoizedState,t]},useRef:function(t){var i=gs();return t={current:t},i.memoizedState=t},useState:Yf,useDebugValue:ed,useDeferredValue:function(t){return gs().memoizedState=t},useTransition:function(){var t=Yf(!1),i=t[0];return t=Tw.bind(null,t[1]),gs().memoizedState=t,[i,t]},useMutableSource:function(){},useSyncExternalStore:function(t,i,o){var u=At,f=gs();if(Ct){if(o===void 0)throw Error(n(407));o=o()}else{if(o=i(),_n===null)throw Error(n(349));(Gr&30)!==0||Hf(u,i,o)}f.memoizedState=o;var p={value:o,getSnapshot:i};return f.queue=p,Jf(Bf.bind(null,u,p,t),[t]),u.flags|=2048,El(9,jf.bind(null,u,p,o,i),void 0,null),o},useId:function(){var t=gs(),i=_n.identifierPrefix;if(Ct){var o=Os,u=zs;o=(u&~(1<<32-Yn(u)-1)).toString(32)+o,i=":"+i+"R"+o,o=Cl++,0<\/script>",t=t.removeChild(t.firstChild)):typeof u.is=="string"?t=_.createElement(o,{is:u.is}):(t=_.createElement(o),o==="select"&&(_=t,u.multiple?_.multiple=!0:u.size&&(_.size=u.size))):t=_.createElementNS(t,o),t[ps]=i,t[gl]=u,bp(t,i,!1,!1),i.stateNode=t;e:{switch(_=us(o,u),o){case"dialog":gt("cancel",t),gt("close",t),f=u;break;case"iframe":case"object":case"embed":gt("load",t),f=u;break;case"video":case"audio":for(f=0;fTo&&(i.flags|=128,u=!0,bl(p,!1),i.lanes=4194304)}else{if(!u)if(t=ja(_),t!==null){if(i.flags|=128,u=!0,o=t.updateQueue,o!==null&&(i.updateQueue=o,i.flags|=4),bl(p,!0),p.tail===null&&p.tailMode==="hidden"&&!_.alternate&&!Ct)return Wn(i),null}else 2*ct()-p.renderingStartTime>To&&o!==1073741824&&(i.flags|=128,u=!0,bl(p,!1),i.lanes=4194304);p.isBackwards?(_.sibling=i.child,i.child=_):(o=p.last,o!==null?o.sibling=_:i.child=_,p.last=_)}return p.tail!==null?(i=p.tail,p.rendering=i,p.tail=i.sibling,p.renderingStartTime=ct(),i.sibling=null,o=Pt.current,mt(Pt,u?o&1|2:o&1),i):(Wn(i),null);case 22:case 23:return xd(),u=i.memoizedState!==null,t!==null&&t.memoizedState!==null!==u&&(i.flags|=8192),u&&(i.mode&1)!==0?(bi&1073741824)!==0&&(Wn(i),i.subtreeFlags&6&&(i.flags|=8192)):Wn(i),null;case 24:return null;case 25:return null}throw Error(n(156,i.tag))}function jw(t,i){switch(Ic(i),i.tag){case 1:return ui(i.type)&&Ta(),t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 3:return Ao(),vt(ai),vt(Vn),$c(),t=i.flags,(t&65536)!==0&&(t&128)===0?(i.flags=t&-65537|128,i):null;case 5:return Bc(i),null;case 13:if(vt(Pt),t=i.memoizedState,t!==null&&t.dehydrated!==null){if(i.alternate===null)throw Error(n(340));xo()}return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 19:return vt(Pt),null;case 4:return Ao(),null;case 10:return Gc(i.type._context),null;case 22:case 23:return xd(),null;case 24:return null;default:return null}}var Xa=!1,Fn=!1,Bw=typeof WeakSet=="function"?WeakSet:Set,De=null;function zo(t,i){var o=t.ref;if(o!==null)if(typeof o=="function")try{o(null)}catch(u){It(t,i,u)}else o.current=null}function hd(t,i,o){try{o()}catch(u){It(t,i,u)}}var kp=!1;function Uw(t,i){if(xc=ot,t=Zn(),Xn(t)){if("selectionStart"in t)var o={start:t.selectionStart,end:t.selectionEnd};else e:{o=(o=t.ownerDocument)&&o.defaultView||window;var u=o.getSelection&&o.getSelection();if(u&&u.rangeCount!==0){o=u.anchorNode;var f=u.anchorOffset,p=u.focusNode;u=u.focusOffset;try{o.nodeType,p.nodeType}catch{o=null;break e}var _=0,b=-1,k=-1,H=0,re=0,oe=t,ee=null;t:for(;;){for(var ye;oe!==o||f!==0&&oe.nodeType!==3||(b=_+f),oe!==p||u!==0&&oe.nodeType!==3||(k=_+u),oe.nodeType===3&&(_+=oe.nodeValue.length),(ye=oe.firstChild)!==null;)ee=oe,oe=ye;for(;;){if(oe===t)break t;if(ee===o&&++H===f&&(b=_),ee===p&&++re===u&&(k=_),(ye=oe.nextSibling)!==null)break;oe=ee,ee=oe.parentNode}oe=ye}o=b===-1||k===-1?null:{start:b,end:k}}else o=null}o=o||{start:0,end:0}}else o=null;for(Ec={focusedElem:t,selectionRange:o},ot=!1,De=i;De!==null;)if(i=De,t=i.child,(i.subtreeFlags&1028)!==0&&t!==null)t.return=i,De=t;else for(;De!==null;){i=De;try{var Ce=i.alternate;if((i.flags&1024)!==0)switch(i.tag){case 0:case 11:case 15:break;case 1:if(Ce!==null){var be=Ce.memoizedProps,Gt=Ce.memoizedState,L=i.stateNode,I=L.getSnapshotBeforeUpdate(i.elementType===i.type?be:Zi(i.type,be),Gt);L.__reactInternalSnapshotBeforeUpdate=I}break;case 3:var W=i.stateNode.containerInfo;W.nodeType===1?W.textContent="":W.nodeType===9&&W.documentElement&&W.removeChild(W.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(de){It(i,i.return,de)}if(t=i.sibling,t!==null){t.return=i.return,De=t;break}De=i.return}return Ce=kp,kp=!1,Ce}function Pl(t,i,o){var u=i.updateQueue;if(u=u!==null?u.lastEffect:null,u!==null){var f=u=u.next;do{if((f.tag&t)===t){var p=f.destroy;f.destroy=void 0,p!==void 0&&hd(i,o,p)}f=f.next}while(f!==u)}}function qa(t,i){if(i=i.updateQueue,i=i!==null?i.lastEffect:null,i!==null){var o=i=i.next;do{if((o.tag&t)===t){var u=o.create;o.destroy=u()}o=o.next}while(o!==i)}}function fd(t){var i=t.ref;if(i!==null){var o=t.stateNode;switch(t.tag){case 5:t=o;break;default:t=o}typeof i=="function"?i(t):i.current=t}}function zp(t){var i=t.alternate;i!==null&&(t.alternate=null,zp(i)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(i=t.stateNode,i!==null&&(delete i[ps],delete i[gl],delete i[kc],delete i[Pw],delete i[Aw])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Op(t){return t.tag===5||t.tag===3||t.tag===4}function Tp(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Op(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function pd(t,i,o){var u=t.tag;if(u===5||u===6)t=t.stateNode,i?o.nodeType===8?o.parentNode.insertBefore(t,i):o.insertBefore(t,i):(o.nodeType===8?(i=o.parentNode,i.insertBefore(t,o)):(i=o,i.appendChild(t)),o=o._reactRootContainer,o!=null||i.onclick!==null||(i.onclick=za));else if(u!==4&&(t=t.child,t!==null))for(pd(t,i,o),t=t.sibling;t!==null;)pd(t,i,o),t=t.sibling}function md(t,i,o){var u=t.tag;if(u===5||u===6)t=t.stateNode,i?o.insertBefore(t,i):o.appendChild(t);else if(u!==4&&(t=t.child,t!==null))for(md(t,i,o),t=t.sibling;t!==null;)md(t,i,o),t=t.sibling}var zn=null,Xi=!1;function ur(t,i,o){for(o=o.child;o!==null;)Ip(t,i,o),o=o.sibling}function Ip(t,i,o){if(si&&typeof si.onCommitFiberUnmount=="function")try{si.onCommitFiberUnmount(Hs,o)}catch{}switch(o.tag){case 5:Fn||zo(o,i);case 6:var u=zn,f=Xi;zn=null,ur(t,i,o),zn=u,Xi=f,zn!==null&&(Xi?(t=zn,o=o.stateNode,t.nodeType===8?t.parentNode.removeChild(o):t.removeChild(o)):zn.removeChild(o.stateNode));break;case 18:zn!==null&&(Xi?(t=zn,o=o.stateNode,t.nodeType===8?Ac(t.parentNode,o):t.nodeType===1&&Ac(t,o),qs(t)):Ac(zn,o.stateNode));break;case 4:u=zn,f=Xi,zn=o.stateNode.containerInfo,Xi=!0,ur(t,i,o),zn=u,Xi=f;break;case 0:case 11:case 14:case 15:if(!Fn&&(u=o.updateQueue,u!==null&&(u=u.lastEffect,u!==null))){f=u=u.next;do{var p=f,_=p.destroy;p=p.tag,_!==void 0&&((p&2)!==0||(p&4)!==0)&&hd(o,i,_),f=f.next}while(f!==u)}ur(t,i,o);break;case 1:if(!Fn&&(zo(o,i),u=o.stateNode,typeof u.componentWillUnmount=="function"))try{u.props=o.memoizedProps,u.state=o.memoizedState,u.componentWillUnmount()}catch(b){It(o,i,b)}ur(t,i,o);break;case 21:ur(t,i,o);break;case 22:o.mode&1?(Fn=(u=Fn)||o.memoizedState!==null,ur(t,i,o),Fn=u):ur(t,i,o);break;default:ur(t,i,o)}}function Rp(t){var i=t.updateQueue;if(i!==null){t.updateQueue=null;var o=t.stateNode;o===null&&(o=t.stateNode=new Bw),i.forEach(function(u){var f=e0.bind(null,t,u);o.has(u)||(o.add(u),u.then(f,f))})}}function qi(t,i){var o=i.deletions;if(o!==null)for(var u=0;uf&&(f=_),u&=~p}if(u=f,u=ct()-u,u=(120>u?120:480>u?480:1080>u?1080:1920>u?1920:3e3>u?3e3:4320>u?4320:1960*Yw(u/1960))-u,10t?16:t,dr===null)var u=!1;else{if(t=dr,dr=null,su=0,(Qe&6)!==0)throw Error(n(331));var f=Qe;for(Qe|=4,De=t.current;De!==null;){var p=De,_=p.child;if((De.flags&16)!==0){var b=p.deletions;if(b!==null){for(var k=0;kct()-wd?Hr(t,0):vd|=o),hi(t,i)}function Yp(t,i){i===0&&((t.mode&1)===0?i=1:(i=js,js<<=1,(js&130023424)===0&&(js=4194304)));var o=ei();t=Ts(t,i),t!==null&&(Us(t,i,o),hi(t,o))}function qw(t){var i=t.memoizedState,o=0;i!==null&&(o=i.retryLane),Yp(t,o)}function e0(t,i){var o=0;switch(t.tag){case 13:var u=t.stateNode,f=t.memoizedState;f!==null&&(o=f.retryLane);break;case 19:u=t.stateNode;break;default:throw Error(n(314))}u!==null&&u.delete(i),Yp(t,o)}var Kp;Kp=function(t,i,o){if(t!==null)if(t.memoizedProps!==i.pendingProps||ai.current)ci=!0;else{if((t.lanes&o)===0&&(i.flags&128)===0)return ci=!1,Fw(t,i,o);ci=(t.flags&131072)!==0}else ci=!1,Ct&&(i.flags&1048576)!==0&&Pf(i,Ma,i.index);switch(i.lanes=0,i.tag){case 2:var u=i.type;Za(t,i),t=i.pendingProps;var f=So(i,Vn.current);Po(i,o),f=Jc(null,i,u,t,f,o);var p=Qc();return i.flags|=1,typeof f=="object"&&f!==null&&typeof f.render=="function"&&f.$$typeof===void 0?(i.tag=1,i.memoizedState=null,i.updateQueue=null,ui(u)?(p=!0,Ia(i)):p=!1,i.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,Hc(i),f.updater=Ja,i.stateNode=f,f._reactInternals=i,nd(i,u,t,o),i=od(null,i,u,!0,p,o)):(i.tag=0,Ct&&p&&Tc(i),qn(null,i,f,o),i=i.child),i;case 16:u=i.elementType;e:{switch(Za(t,i),t=i.pendingProps,f=u._init,u=f(u._payload),i.type=u,f=i.tag=n0(u),t=Zi(u,t),f){case 0:i=rd(null,i,u,t,o);break e;case 1:i=yp(null,i,u,t,o);break e;case 11:i=mp(null,i,u,t,o);break e;case 14:i=gp(null,i,u,Zi(u.type,t),o);break e}throw Error(n(306,u,""))}return i;case 0:return u=i.type,f=i.pendingProps,f=i.elementType===u?f:Zi(u,f),rd(t,i,u,f,o);case 1:return u=i.type,f=i.pendingProps,f=i.elementType===u?f:Zi(u,f),yp(t,i,u,f,o);case 3:e:{if(Sp(i),t===null)throw Error(n(387));u=i.pendingProps,p=i.memoizedState,f=p.element,Mf(t,i),Ha(i,u,null,o);var _=i.memoizedState;if(u=_.element,p.isDehydrated)if(p={element:u,isDehydrated:!1,cache:_.cache,pendingSuspenseBoundaries:_.pendingSuspenseBoundaries,transitions:_.transitions},i.updateQueue.baseState=p,i.memoizedState=p,i.flags&256){f=ko(Error(n(423)),i),i=Dp(t,i,u,o,f);break e}else if(u!==f){f=ko(Error(n(424)),i),i=Dp(t,i,u,o,f);break e}else for(Ei=ir(i.stateNode.containerInfo.firstChild),xi=i,Ct=!0,Qi=null,o=Rf(i,null,u,o),i.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(xo(),u===f){i=Rs(t,i,o);break e}qn(t,i,u,o)}i=i.child}return i;case 5:return Gf(i),t===null&&Nc(i),u=i.type,f=i.pendingProps,p=t!==null?t.memoizedProps:null,_=f.children,bc(u,f)?_=null:p!==null&&bc(u,p)&&(i.flags|=32),_p(t,i),qn(t,i,_,o),i.child;case 6:return t===null&&Nc(i),null;case 13:return Cp(t,i,o);case 4:return jc(i,i.stateNode.containerInfo),u=i.pendingProps,t===null?i.child=Eo(i,null,u,o):qn(t,i,u,o),i.child;case 11:return u=i.type,f=i.pendingProps,f=i.elementType===u?f:Zi(u,f),mp(t,i,u,f,o);case 7:return qn(t,i,i.pendingProps,o),i.child;case 8:return qn(t,i,i.pendingProps.children,o),i.child;case 12:return qn(t,i,i.pendingProps.children,o),i.child;case 10:e:{if(u=i.type._context,f=i.pendingProps,p=i.memoizedProps,_=f.value,mt(Ga,u._currentValue),u._currentValue=_,p!==null)if(dt(p.value,_)){if(p.children===f.children&&!ai.current){i=Rs(t,i,o);break e}}else for(p=i.child,p!==null&&(p.return=i);p!==null;){var b=p.dependencies;if(b!==null){_=p.child;for(var k=b.firstContext;k!==null;){if(k.context===u){if(p.tag===1){k=Is(-1,o&-o),k.tag=2;var H=p.updateQueue;if(H!==null){H=H.shared;var re=H.pending;re===null?k.next=k:(k.next=re.next,re.next=k),H.pending=k}}p.lanes|=o,k=p.alternate,k!==null&&(k.lanes|=o),Wc(p.return,o,i),b.lanes|=o;break}k=k.next}}else if(p.tag===10)_=p.type===i.type?null:p.child;else if(p.tag===18){if(_=p.return,_===null)throw Error(n(341));_.lanes|=o,b=_.alternate,b!==null&&(b.lanes|=o),Wc(_,o,i),_=p.sibling}else _=p.child;if(_!==null)_.return=p;else for(_=p;_!==null;){if(_===i){_=null;break}if(p=_.sibling,p!==null){p.return=_.return,_=p;break}_=_.return}p=_}qn(t,i,f.children,o),i=i.child}return i;case 9:return f=i.type,u=i.pendingProps.children,Po(i,o),f=Vi(f),u=u(f),i.flags|=1,qn(t,i,u,o),i.child;case 14:return u=i.type,f=Zi(u,i.pendingProps),f=Zi(u.type,f),gp(t,i,u,f,o);case 15:return vp(t,i,i.type,i.pendingProps,o);case 17:return u=i.type,f=i.pendingProps,f=i.elementType===u?f:Zi(u,f),Za(t,i),i.tag=1,ui(u)?(t=!0,Ia(i)):t=!1,Po(i,o),ap(i,u,f),nd(i,u,f,o),od(null,i,u,!0,t,o);case 19:return Ep(t,i,o);case 22:return wp(t,i,o)}throw Error(n(156,i.tag))};function Jp(t,i){return Mt(t,i)}function t0(t,i,o,u){this.tag=t,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Fi(t,i,o,u){return new t0(t,i,o,u)}function bd(t){return t=t.prototype,!(!t||!t.isReactComponent)}function n0(t){if(typeof t=="function")return bd(t)?1:0;if(t!=null){if(t=t.$$typeof,t===ve)return 11;if(t===j)return 14}return 2}function pr(t,i){var o=t.alternate;return o===null?(o=Fi(t.tag,i,t.key,t.mode),o.elementType=t.elementType,o.type=t.type,o.stateNode=t.stateNode,o.alternate=t,t.alternate=o):(o.pendingProps=i,o.type=t.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=t.flags&14680064,o.childLanes=t.childLanes,o.lanes=t.lanes,o.child=t.child,o.memoizedProps=t.memoizedProps,o.memoizedState=t.memoizedState,o.updateQueue=t.updateQueue,i=t.dependencies,o.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},o.sibling=t.sibling,o.index=t.index,o.ref=t.ref,o}function au(t,i,o,u,f,p){var _=2;if(u=t,typeof t=="function")bd(t)&&(_=1);else if(typeof t=="string")_=5;else e:switch(t){case $:return Br(o.children,f,p,i);case K:_=8,f|=8;break;case he:return t=Fi(12,o,i,f|2),t.elementType=he,t.lanes=p,t;case ie:return t=Fi(13,o,i,f),t.elementType=ie,t.lanes=p,t;case ce:return t=Fi(19,o,i,f),t.elementType=ce,t.lanes=p,t;case X:return uu(o,f,p,i);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case ue:_=10;break e;case Q:_=9;break e;case ve:_=11;break e;case j:_=14;break e;case te:_=16,u=null;break e}throw Error(n(130,t==null?t:typeof t,""))}return i=Fi(_,o,i,f),i.elementType=t,i.type=u,i.lanes=p,i}function Br(t,i,o,u){return t=Fi(7,t,u,i),t.lanes=o,t}function uu(t,i,o,u){return t=Fi(22,t,u,i),t.elementType=X,t.lanes=o,t.stateNode={isHidden:!1},t}function Pd(t,i,o){return t=Fi(6,t,null,i),t.lanes=o,t}function Ad(t,i,o){return i=Fi(4,t.children!==null?t.children:[],t.key,i),i.lanes=o,i.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},i}function i0(t,i,o,u,f){this.tag=i,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=il(0),this.expirationTimes=il(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=il(0),this.identifierPrefix=u,this.onRecoverableError=f,this.mutableSourceEagerHydrationData=null}function kd(t,i,o,u,f,p,_,b,k){return t=new i0(t,i,o,b,k),i===1?(i=1,p===!0&&(i|=8)):i=0,p=Fi(3,null,null,i),t.current=p,p.stateNode=t,p.memoizedState={element:u,isDehydrated:o,cache:null,transitions:null,pendingSuspenseBoundaries:null},Hc(p),t}function s0(t,i,o){var u=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(e){console.error(e)}}return r(),Nd.exports=v0(),Nd.exports}var um;function w0(){if(um)return gu;um=1;var r=Gg();return gu.createRoot=r.createRoot,gu.hydrateRoot=r.hydrateRoot,gu}var _0=w0();const y0=Ah(_0);var Kr=Gg();const S0=Ah(Kr),Ku=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ko(r){const e=Object.prototype.toString.call(r);return e==="[object Window]"||e==="[object global]"}function zh(r){return"nodeType"in r}function ni(r){var e,n;return r?Ko(r)?r:zh(r)&&(e=(n=r.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function Oh(r){const{Document:e}=ni(r);return r instanceof e}function ta(r){return Ko(r)?!1:r instanceof ni(r).HTMLElement}function Wg(r){return r instanceof ni(r).SVGElement}function Jo(r){return r?Ko(r)?r.document:zh(r)?Oh(r)?r:ta(r)||Wg(r)?r.ownerDocument:document:document:document}const Gs=Ku?B.useLayoutEffect:B.useEffect;function Ju(r){const e=B.useRef(r);return Gs(()=>{e.current=r}),B.useCallback(function(){for(var n=arguments.length,s=new Array(n),l=0;l{r.current=setInterval(s,l)},[]),n=B.useCallback(()=>{r.current!==null&&(clearInterval(r.current),r.current=null)},[]);return[e,n]}function Kl(r,e){e===void 0&&(e=[r]);const n=B.useRef(r);return Gs(()=>{n.current!==r&&(n.current=r)},e),n}function na(r,e){const n=B.useRef();return B.useMemo(()=>{const s=r(n.current);return n.current=s,s},[...e])}function Ru(r){const e=Ju(r),n=B.useRef(null),s=B.useCallback(l=>{l!==n.current&&(e==null||e(l,n.current)),n.current=l},[]);return[n,s]}function Nu(r){const e=B.useRef();return B.useEffect(()=>{e.current=r},[r]),e.current}let Vd={};function Qu(r,e){return B.useMemo(()=>{if(e)return e;const n=Vd[r]==null?0:Vd[r]+1;return Vd[r]=n,r+"-"+n},[r,e])}function Fg(r){return function(e){for(var n=arguments.length,s=new Array(n>1?n-1:0),l=1;l{const d=Object.entries(c);for(const[h,m]of d){const w=a[h];w!=null&&(a[h]=w+r*m)}return a},{...e})}}const Wo=Fg(1),Mu=Fg(-1);function C0(r){return"clientX"in r&&"clientY"in r}function Th(r){if(!r)return!1;const{KeyboardEvent:e}=ni(r.target);return e&&r instanceof e}function x0(r){if(!r)return!1;const{TouchEvent:e}=ni(r.target);return e&&r instanceof e}function Lu(r){if(x0(r)){if(r.touches&&r.touches.length){const{clientX:e,clientY:n}=r.touches[0];return{x:e,y:n}}else if(r.changedTouches&&r.changedTouches.length){const{clientX:e,clientY:n}=r.changedTouches[0];return{x:e,y:n}}}return C0(r)?{x:r.clientX,y:r.clientY}:null}const Jl=Object.freeze({Translate:{toString(r){if(!r)return;const{x:e,y:n}=r;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(r){if(!r)return;const{scaleX:e,scaleY:n}=r;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(r){if(r)return[Jl.Translate.toString(r),Jl.Scale.toString(r)].join(" ")}},Transition:{toString(r){let{property:e,duration:n,easing:s}=r;return e+" "+n+"ms "+s}}}),cm="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function E0(r){return r.matches(cm)?r:r.querySelector(cm)}const b0={display:"none"};function P0(r){let{id:e,value:n}=r;return pe.createElement("div",{id:e,style:b0},n)}function A0(r){let{id:e,announcement:n,ariaLiveType:s="assertive"}=r;const l={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return pe.createElement("div",{id:e,style:l,role:"status","aria-live":s,"aria-atomic":!0},n)}function k0(){const[r,e]=B.useState("");return{announce:B.useCallback(s=>{s!=null&&e(s)},[]),announcement:r}}const Hg=B.createContext(null);function z0(r){const e=B.useContext(Hg);B.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of ");return e(r)},[r,e])}function O0(){const[r]=B.useState(()=>new Set),e=B.useCallback(s=>(r.add(s),()=>r.delete(s)),[r]);return[B.useCallback(s=>{let{type:l,event:a}=s;r.forEach(c=>{var d;return(d=c[l])==null?void 0:d.call(c,a)})},[r]),e]}const T0={draggable:` + To pick up a draggable item, press the space bar. + While dragging, use the arrow keys to move the item. + Press space again to drop the item in its new position, or press escape to cancel. + `},I0={onDragStart(r){let{active:e}=r;return"Picked up draggable item "+e.id+"."},onDragOver(r){let{active:e,over:n}=r;return n?"Draggable item "+e.id+" was moved over droppable area "+n.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(r){let{active:e,over:n}=r;return n?"Draggable item "+e.id+" was dropped over droppable area "+n.id:"Draggable item "+e.id+" was dropped."},onDragCancel(r){let{active:e}=r;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function R0(r){let{announcements:e=I0,container:n,hiddenTextDescribedById:s,screenReaderInstructions:l=T0}=r;const{announce:a,announcement:c}=k0(),d=Qu("DndLiveRegion"),[h,m]=B.useState(!1);if(B.useEffect(()=>{m(!0)},[]),z0(B.useMemo(()=>({onDragStart(v){let{active:S}=v;a(e.onDragStart({active:S}))},onDragMove(v){let{active:S,over:E}=v;e.onDragMove&&a(e.onDragMove({active:S,over:E}))},onDragOver(v){let{active:S,over:E}=v;a(e.onDragOver({active:S,over:E}))},onDragEnd(v){let{active:S,over:E}=v;a(e.onDragEnd({active:S,over:E}))},onDragCancel(v){let{active:S,over:E}=v;a(e.onDragCancel({active:S,over:E}))}}),[a,e])),!h)return null;const w=pe.createElement(pe.Fragment,null,pe.createElement(P0,{id:s,value:l.draggable}),pe.createElement(A0,{id:d,announcement:c}));return n?Kr.createPortal(w,n):w}var an;(function(r){r.DragStart="dragStart",r.DragMove="dragMove",r.DragEnd="dragEnd",r.DragCancel="dragCancel",r.DragOver="dragOver",r.RegisterDroppable="registerDroppable",r.SetDroppableDisabled="setDroppableDisabled",r.UnregisterDroppable="unregisterDroppable"})(an||(an={}));function Vu(){}function N0(r,e){return B.useMemo(()=>({sensor:r,options:e??{}}),[r,e])}function M0(){for(var r=arguments.length,e=new Array(r),n=0;n[...e].filter(s=>s!=null),[...e])}const os=Object.freeze({x:0,y:0});function L0(r,e){const n=Lu(r);if(!n)return"0 0";const s={x:(n.x-e.left)/e.width*100,y:(n.y-e.top)/e.height*100};return s.x+"% "+s.y+"%"}function V0(r,e){let{data:{value:n}}=r,{data:{value:s}}=e;return s-n}function G0(r,e){if(!r||r.length===0)return null;const[n]=r;return n[e]}function W0(r,e){const n=Math.max(e.top,r.top),s=Math.max(e.left,r.left),l=Math.min(e.left+e.width,r.left+r.width),a=Math.min(e.top+e.height,r.top+r.height),c=l-s,d=a-n;if(s{let{collisionRect:e,droppableRects:n,droppableContainers:s}=r;const l=[];for(const a of s){const{id:c}=a,d=n.get(c);if(d){const h=W0(d,e);h>0&&l.push({id:c,data:{droppableContainer:a,value:h}})}}return l.sort(V0)};function H0(r,e,n){return{...r,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function jg(r,e){return r&&e?{x:r.left-e.left,y:r.top-e.top}:os}function j0(r){return function(n){for(var s=arguments.length,l=new Array(s>1?s-1:0),a=1;a({...c,top:c.top+r*d.y,bottom:c.bottom+r*d.y,left:c.left+r*d.x,right:c.right+r*d.x}),{...n})}}const B0=j0(1);function Bg(r){if(r.startsWith("matrix3d(")){const e=r.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(r.startsWith("matrix(")){const e=r.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function U0(r,e,n){const s=Bg(e);if(!s)return r;const{scaleX:l,scaleY:a,x:c,y:d}=s,h=r.left-c-(1-l)*parseFloat(n),m=r.top-d-(1-a)*parseFloat(n.slice(n.indexOf(" ")+1)),w=l?r.width/l:r.width,v=a?r.height/a:r.height;return{width:w,height:v,top:m,right:h+w,bottom:m+v,left:h}}const $0={ignoreTransform:!1};function ia(r,e){e===void 0&&(e=$0);let n=r.getBoundingClientRect();if(e.ignoreTransform){const{transform:m,transformOrigin:w}=ni(r).getComputedStyle(r);m&&(n=U0(n,m,w))}const{top:s,left:l,width:a,height:c,bottom:d,right:h}=n;return{top:s,left:l,width:a,height:c,bottom:d,right:h}}function dm(r){return ia(r,{ignoreTransform:!0})}function Y0(r){const e=r.innerWidth,n=r.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function K0(r,e){return e===void 0&&(e=ni(r).getComputedStyle(r)),e.position==="fixed"}function J0(r,e){e===void 0&&(e=ni(r).getComputedStyle(r));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(l=>{const a=e[l];return typeof a=="string"?n.test(a):!1})}function Ih(r,e){const n=[];function s(l){if(e!=null&&n.length>=e||!l)return n;if(Oh(l)&&l.scrollingElement!=null&&!n.includes(l.scrollingElement))return n.push(l.scrollingElement),n;if(!ta(l)||Wg(l)||n.includes(l))return n;const a=ni(r).getComputedStyle(l);return l!==r&&J0(l,a)&&n.push(l),K0(l,a)?n:s(l.parentNode)}return r?s(r):n}function Ug(r){const[e]=Ih(r,1);return e??null}function Gd(r){return!Ku||!r?null:Ko(r)?r:zh(r)?Oh(r)||r===Jo(r).scrollingElement?window:ta(r)?r:null:null}function $g(r){return Ko(r)?r.scrollX:r.scrollLeft}function Yg(r){return Ko(r)?r.scrollY:r.scrollTop}function ih(r){return{x:$g(r),y:Yg(r)}}var Dn;(function(r){r[r.Forward=1]="Forward",r[r.Backward=-1]="Backward"})(Dn||(Dn={}));function Kg(r){return!Ku||!r?!1:r===document.scrollingElement}function Jg(r){const e={x:0,y:0},n=Kg(r)?{height:window.innerHeight,width:window.innerWidth}:{height:r.clientHeight,width:r.clientWidth},s={x:r.scrollWidth-n.width,y:r.scrollHeight-n.height},l=r.scrollTop<=e.y,a=r.scrollLeft<=e.x,c=r.scrollTop>=s.y,d=r.scrollLeft>=s.x;return{isTop:l,isLeft:a,isBottom:c,isRight:d,maxScroll:s,minScroll:e}}const Q0={x:.2,y:.2};function Z0(r,e,n,s,l){let{top:a,left:c,right:d,bottom:h}=n;s===void 0&&(s=10),l===void 0&&(l=Q0);const{isTop:m,isBottom:w,isLeft:v,isRight:S}=Jg(r),E={x:0,y:0},A={x:0,y:0},D={height:e.height*l.y,width:e.width*l.x};return!m&&a<=e.top+D.height?(E.y=Dn.Backward,A.y=s*Math.abs((e.top+D.height-a)/D.height)):!w&&h>=e.bottom-D.height&&(E.y=Dn.Forward,A.y=s*Math.abs((e.bottom-D.height-h)/D.height)),!S&&d>=e.right-D.width?(E.x=Dn.Forward,A.x=s*Math.abs((e.right-D.width-d)/D.width)):!v&&c<=e.left+D.width&&(E.x=Dn.Backward,A.x=s*Math.abs((e.left+D.width-c)/D.width)),{direction:E,speed:A}}function X0(r){if(r===document.scrollingElement){const{innerWidth:a,innerHeight:c}=window;return{top:0,left:0,right:a,bottom:c,width:a,height:c}}const{top:e,left:n,right:s,bottom:l}=r.getBoundingClientRect();return{top:e,left:n,right:s,bottom:l,width:r.clientWidth,height:r.clientHeight}}function Qg(r){return r.reduce((e,n)=>Wo(e,ih(n)),os)}function q0(r){return r.reduce((e,n)=>e+$g(n),0)}function e_(r){return r.reduce((e,n)=>e+Yg(n),0)}function Zg(r,e){if(e===void 0&&(e=ia),!r)return;const{top:n,left:s,bottom:l,right:a}=e(r);Ug(r)&&(l<=0||a<=0||n>=window.innerHeight||s>=window.innerWidth)&&r.scrollIntoView({block:"center",inline:"center"})}const t_=[["x",["left","right"],q0],["y",["top","bottom"],e_]];class Rh{constructor(e,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const s=Ih(n),l=Qg(s);this.rect={...e},this.width=e.width,this.height=e.height;for(const[a,c,d]of t_)for(const h of c)Object.defineProperty(this,h,{get:()=>{const m=d(s),w=l[a]-m;return this.rect[h]+w},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Hl{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var s;return(s=this.target)==null?void 0:s.removeEventListener(...n)})},this.target=e}add(e,n,s){var l;(l=this.target)==null||l.addEventListener(e,n,s),this.listeners.push([e,n,s])}}function n_(r){const{EventTarget:e}=ni(r);return r instanceof e?r:Jo(r)}function Wd(r,e){const n=Math.abs(r.x),s=Math.abs(r.y);return typeof e=="number"?Math.sqrt(n**2+s**2)>e:"x"in e&&"y"in e?n>e.x&&s>e.y:"x"in e?n>e.x:"y"in e?s>e.y:!1}var Bi;(function(r){r.Click="click",r.DragStart="dragstart",r.Keydown="keydown",r.ContextMenu="contextmenu",r.Resize="resize",r.SelectionChange="selectionchange",r.VisibilityChange="visibilitychange"})(Bi||(Bi={}));function hm(r){r.preventDefault()}function i_(r){r.stopPropagation()}var ht;(function(r){r.Space="Space",r.Down="ArrowDown",r.Right="ArrowRight",r.Left="ArrowLeft",r.Up="ArrowUp",r.Esc="Escape",r.Enter="Enter",r.Tab="Tab"})(ht||(ht={}));const Xg={start:[ht.Space,ht.Enter],cancel:[ht.Esc],end:[ht.Space,ht.Enter,ht.Tab]},s_=(r,e)=>{let{currentCoordinates:n}=e;switch(r.code){case ht.Right:return{...n,x:n.x+25};case ht.Left:return{...n,x:n.x-25};case ht.Down:return{...n,y:n.y+25};case ht.Up:return{...n,y:n.y-25}}};class qg{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new Hl(Jo(n)),this.windowListeners=new Hl(ni(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Bi.Resize,this.handleCancel),this.windowListeners.add(Bi.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Bi.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,s=e.node.current;s&&Zg(s),n(os)}handleKeyDown(e){if(Th(e)){const{active:n,context:s,options:l}=this.props,{keyboardCodes:a=Xg,coordinateGetter:c=s_,scrollBehavior:d="smooth"}=l,{code:h}=e;if(a.end.includes(h)){this.handleEnd(e);return}if(a.cancel.includes(h)){this.handleCancel(e);return}const{collisionRect:m}=s.current,w=m?{x:m.left,y:m.top}:os;this.referenceCoordinates||(this.referenceCoordinates=w);const v=c(e,{active:n,context:s.current,currentCoordinates:w});if(v){const S=Mu(v,w),E={x:0,y:0},{scrollableAncestors:A}=s.current;for(const D of A){const P=e.code,{isTop:N,isRight:O,isLeft:M,isBottom:R,maxScroll:Z,minScroll:G}=Jg(D),$=X0(D),K={x:Math.min(P===ht.Right?$.right-$.width/2:$.right,Math.max(P===ht.Right?$.left:$.left+$.width/2,v.x)),y:Math.min(P===ht.Down?$.bottom-$.height/2:$.bottom,Math.max(P===ht.Down?$.top:$.top+$.height/2,v.y))},he=P===ht.Right&&!O||P===ht.Left&&!M,ue=P===ht.Down&&!R||P===ht.Up&&!N;if(he&&K.x!==v.x){const Q=D.scrollLeft+S.x,ve=P===ht.Right&&Q<=Z.x||P===ht.Left&&Q>=G.x;if(ve&&!S.y){D.scrollTo({left:Q,behavior:d});return}ve?E.x=D.scrollLeft-Q:E.x=P===ht.Right?D.scrollLeft-Z.x:D.scrollLeft-G.x,E.x&&D.scrollBy({left:-E.x,behavior:d});break}else if(ue&&K.y!==v.y){const Q=D.scrollTop+S.y,ve=P===ht.Down&&Q<=Z.y||P===ht.Up&&Q>=G.y;if(ve&&!S.x){D.scrollTo({top:Q,behavior:d});return}ve?E.y=D.scrollTop-Q:E.y=P===ht.Down?D.scrollTop-Z.y:D.scrollTop-G.y,E.y&&D.scrollBy({top:-E.y,behavior:d});break}}this.handleMove(e,Wo(Mu(v,this.referenceCoordinates),E))}}}handleMove(e,n){const{onMove:s}=this.props;e.preventDefault(),s(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}qg.activators=[{eventName:"onKeyDown",handler:(r,e,n)=>{let{keyboardCodes:s=Xg,onActivation:l}=e,{active:a}=n;const{code:c}=r.nativeEvent;if(s.start.includes(c)){const d=a.activatorNode.current;return d&&r.target!==d?!1:(r.preventDefault(),l==null||l({event:r.nativeEvent}),!0)}return!1}}];function fm(r){return!!(r&&"distance"in r)}function pm(r){return!!(r&&"delay"in r)}class Nh{constructor(e,n,s){var l;s===void 0&&(s=n_(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;const{event:a}=e,{target:c}=a;this.props=e,this.events=n,this.document=Jo(c),this.documentListeners=new Hl(this.document),this.listeners=new Hl(s),this.windowListeners=new Hl(ni(c)),this.initialCoordinates=(l=Lu(a))!=null?l:os,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:n,bypassActivationConstraint:s}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Bi.Resize,this.handleCancel),this.windowListeners.add(Bi.DragStart,hm),this.windowListeners.add(Bi.VisibilityChange,this.handleCancel),this.windowListeners.add(Bi.ContextMenu,hm),this.documentListeners.add(Bi.Keydown,this.handleKeydown),n){if(s!=null&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(pm(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(fm(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,n){const{active:s,onPending:l}=this.props;l(s,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(Bi.Click,i_,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Bi.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:s,initialCoordinates:l,props:a}=this,{onMove:c,options:{activationConstraint:d}}=a;if(!l)return;const h=(n=Lu(e))!=null?n:os,m=Mu(l,h);if(!s&&d){if(fm(d)){if(d.tolerance!=null&&Wd(m,d.tolerance))return this.handleCancel();if(Wd(m,d.distance))return this.handleStart()}if(pm(d)&&Wd(m,d.tolerance))return this.handleCancel();this.handlePending(d,m);return}e.cancelable&&e.preventDefault(),c(h)}handleEnd(){const{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){const{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===ht.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const r_={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Mh extends Nh{constructor(e){const{event:n}=e,s=Jo(n.target);super(e,r_,s)}}Mh.activators=[{eventName:"onPointerDown",handler:(r,e)=>{let{nativeEvent:n}=r,{onActivation:s}=e;return!n.isPrimary||n.button!==0?!1:(s==null||s({event:n}),!0)}}];const o_={move:{name:"mousemove"},end:{name:"mouseup"}};var sh;(function(r){r[r.RightClick=2]="RightClick"})(sh||(sh={}));class l_ extends Nh{constructor(e){super(e,o_,Jo(e.event.target))}}l_.activators=[{eventName:"onMouseDown",handler:(r,e)=>{let{nativeEvent:n}=r,{onActivation:s}=e;return n.button===sh.RightClick?!1:(s==null||s({event:n}),!0)}}];const Fd={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class a_ extends Nh{constructor(e){super(e,Fd)}static setup(){return window.addEventListener(Fd.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Fd.move.name,e)};function e(){}}}a_.activators=[{eventName:"onTouchStart",handler:(r,e)=>{let{nativeEvent:n}=r,{onActivation:s}=e;const{touches:l}=n;return l.length>1?!1:(s==null||s({event:n}),!0)}}];var jl;(function(r){r[r.Pointer=0]="Pointer",r[r.DraggableRect=1]="DraggableRect"})(jl||(jl={}));var Gu;(function(r){r[r.TreeOrder=0]="TreeOrder",r[r.ReversedTreeOrder=1]="ReversedTreeOrder"})(Gu||(Gu={}));function u_(r){let{acceleration:e,activator:n=jl.Pointer,canScroll:s,draggingRect:l,enabled:a,interval:c=5,order:d=Gu.TreeOrder,pointerCoordinates:h,scrollableAncestors:m,scrollableAncestorRects:w,delta:v,threshold:S}=r;const E=d_({delta:v,disabled:!a}),[A,D]=D0(),P=B.useRef({x:0,y:0}),N=B.useRef({x:0,y:0}),O=B.useMemo(()=>{switch(n){case jl.Pointer:return h?{top:h.y,bottom:h.y,left:h.x,right:h.x}:null;case jl.DraggableRect:return l}},[n,l,h]),M=B.useRef(null),R=B.useCallback(()=>{const G=M.current;if(!G)return;const $=P.current.x*N.current.x,K=P.current.y*N.current.y;G.scrollBy($,K)},[]),Z=B.useMemo(()=>d===Gu.TreeOrder?[...m].reverse():m,[d,m]);B.useEffect(()=>{if(!a||!m.length||!O){D();return}for(const G of Z){if((s==null?void 0:s(G))===!1)continue;const $=m.indexOf(G),K=w[$];if(!K)continue;const{direction:he,speed:ue}=Z0(G,K,O,e,S);for(const Q of["x","y"])E[Q][he[Q]]||(ue[Q]=0,he[Q]=0);if(ue.x>0||ue.y>0){D(),M.current=G,A(R,c),P.current=ue,N.current=he;return}}P.current={x:0,y:0},N.current={x:0,y:0},D()},[e,R,s,D,a,c,JSON.stringify(O),JSON.stringify(E),A,m,Z,w,JSON.stringify(S)])}const c_={x:{[Dn.Backward]:!1,[Dn.Forward]:!1},y:{[Dn.Backward]:!1,[Dn.Forward]:!1}};function d_(r){let{delta:e,disabled:n}=r;const s=Nu(e);return na(l=>{if(n||!s||!l)return c_;const a={x:Math.sign(e.x-s.x),y:Math.sign(e.y-s.y)};return{x:{[Dn.Backward]:l.x[Dn.Backward]||a.x===-1,[Dn.Forward]:l.x[Dn.Forward]||a.x===1},y:{[Dn.Backward]:l.y[Dn.Backward]||a.y===-1,[Dn.Forward]:l.y[Dn.Forward]||a.y===1}}},[n,e,s])}function h_(r,e){const n=e!=null?r.get(e):void 0,s=n?n.node.current:null;return na(l=>{var a;return e==null?null:(a=s??l)!=null?a:null},[s,e])}function f_(r,e){return B.useMemo(()=>r.reduce((n,s)=>{const{sensor:l}=s,a=l.activators.map(c=>({eventName:c.eventName,handler:e(c.handler,s)}));return[...n,...a]},[]),[r,e])}var Ql;(function(r){r[r.Always=0]="Always",r[r.BeforeDragging=1]="BeforeDragging",r[r.WhileDragging=2]="WhileDragging"})(Ql||(Ql={}));var rh;(function(r){r.Optimized="optimized"})(rh||(rh={}));const mm=new Map;function p_(r,e){let{dragging:n,dependencies:s,config:l}=e;const[a,c]=B.useState(null),{frequency:d,measure:h,strategy:m}=l,w=B.useRef(r),v=P(),S=Kl(v),E=B.useCallback(function(N){N===void 0&&(N=[]),!S.current&&c(O=>O===null?N:O.concat(N.filter(M=>!O.includes(M))))},[S]),A=B.useRef(null),D=na(N=>{if(v&&!n)return mm;if(!N||N===mm||w.current!==r||a!=null){const O=new Map;for(let M of r){if(!M)continue;if(a&&a.length>0&&!a.includes(M.id)&&M.rect.current){O.set(M.id,M.rect.current);continue}const R=M.node.current,Z=R?new Rh(h(R),R):null;M.rect.current=Z,Z&&O.set(M.id,Z)}return O}return N},[r,a,n,v,h]);return B.useEffect(()=>{w.current=r},[r]),B.useEffect(()=>{v||E()},[n,v]),B.useEffect(()=>{a&&a.length>0&&c(null)},[JSON.stringify(a)]),B.useEffect(()=>{v||typeof d!="number"||A.current!==null||(A.current=setTimeout(()=>{E(),A.current=null},d))},[d,v,E,...s]),{droppableRects:D,measureDroppableContainers:E,measuringScheduled:a!=null};function P(){switch(m){case Ql.Always:return!1;case Ql.BeforeDragging:return n;default:return!n}}}function Lh(r,e){return na(n=>r?n||(typeof e=="function"?e(r):r):null,[e,r])}function m_(r,e){return Lh(r,e)}function g_(r){let{callback:e,disabled:n}=r;const s=Ju(e),l=B.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(s)},[s,n]);return B.useEffect(()=>()=>l==null?void 0:l.disconnect(),[l]),l}function Zu(r){let{callback:e,disabled:n}=r;const s=Ju(e),l=B.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(s)},[n]);return B.useEffect(()=>()=>l==null?void 0:l.disconnect(),[l]),l}function v_(r){return new Rh(ia(r),r)}function gm(r,e,n){e===void 0&&(e=v_);const[s,l]=B.useState(null);function a(){l(h=>{if(!r)return null;if(r.isConnected===!1){var m;return(m=h??n)!=null?m:null}const w=e(r);return JSON.stringify(h)===JSON.stringify(w)?h:w})}const c=g_({callback(h){if(r)for(const m of h){const{type:w,target:v}=m;if(w==="childList"&&v instanceof HTMLElement&&v.contains(r)){a();break}}}}),d=Zu({callback:a});return Gs(()=>{a(),r?(d==null||d.observe(r),c==null||c.observe(document.body,{childList:!0,subtree:!0})):(d==null||d.disconnect(),c==null||c.disconnect())},[r]),s}function w_(r){const e=Lh(r);return jg(r,e)}const vm=[];function __(r){const e=B.useRef(r),n=na(s=>r?s&&s!==vm&&r&&e.current&&r.parentNode===e.current.parentNode?s:Ih(r):vm,[r]);return B.useEffect(()=>{e.current=r},[r]),n}function y_(r){const[e,n]=B.useState(null),s=B.useRef(r),l=B.useCallback(a=>{const c=Gd(a.target);c&&n(d=>d?(d.set(c,ih(c)),new Map(d)):null)},[]);return B.useEffect(()=>{const a=s.current;if(r!==a){c(a);const d=r.map(h=>{const m=Gd(h);return m?(m.addEventListener("scroll",l,{passive:!0}),[m,ih(m)]):null}).filter(h=>h!=null);n(d.length?new Map(d):null),s.current=r}return()=>{c(r),c(a)};function c(d){d.forEach(h=>{const m=Gd(h);m==null||m.removeEventListener("scroll",l)})}},[l,r]),B.useMemo(()=>r.length?e?Array.from(e.values()).reduce((a,c)=>Wo(a,c),os):Qg(r):os,[r,e])}function wm(r,e){e===void 0&&(e=[]);const n=B.useRef(null);return B.useEffect(()=>{n.current=null},e),B.useEffect(()=>{const s=r!==os;s&&!n.current&&(n.current=r),!s&&n.current&&(n.current=null)},[r]),n.current?Mu(r,n.current):os}function S_(r){B.useEffect(()=>{if(!Ku)return;const e=r.map(n=>{let{sensor:s}=n;return s.setup==null?void 0:s.setup()});return()=>{for(const n of e)n==null||n()}},r.map(e=>{let{sensor:n}=e;return n}))}function D_(r,e){return B.useMemo(()=>r.reduce((n,s)=>{let{eventName:l,handler:a}=s;return n[l]=c=>{a(c,e)},n},{}),[r,e])}function ev(r){return B.useMemo(()=>r?Y0(r):null,[r])}const _m=[];function C_(r,e){e===void 0&&(e=ia);const[n]=r,s=ev(n?ni(n):null),[l,a]=B.useState(_m);function c(){a(()=>r.length?r.map(h=>Kg(h)?s:new Rh(e(h),h)):_m)}const d=Zu({callback:c});return Gs(()=>{d==null||d.disconnect(),c(),r.forEach(h=>d==null?void 0:d.observe(h))},[r]),l}function tv(r){if(!r)return null;if(r.children.length>1)return r;const e=r.children[0];return ta(e)?e:r}function x_(r){let{measure:e}=r;const[n,s]=B.useState(null),l=B.useCallback(m=>{for(const{target:w}of m)if(ta(w)){s(v=>{const S=e(w);return v?{...v,width:S.width,height:S.height}:S});break}},[e]),a=Zu({callback:l}),c=B.useCallback(m=>{const w=tv(m);a==null||a.disconnect(),w&&(a==null||a.observe(w)),s(w?e(w):null)},[e,a]),[d,h]=Ru(c);return B.useMemo(()=>({nodeRef:d,rect:n,setRef:h}),[n,d,h])}const E_=[{sensor:Mh,options:{}},{sensor:qg,options:{}}],b_={current:{}},Pu={draggable:{measure:dm},droppable:{measure:dm,strategy:Ql.WhileDragging,frequency:rh.Optimized},dragOverlay:{measure:ia}};class Bl extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,s;return(n=(s=this.get(e))==null?void 0:s.node.current)!=null?n:void 0}}const P_={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Bl,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Vu},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Pu,measureDroppableContainers:Vu,windowRect:null,measuringScheduled:!1},nv={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Vu,draggableNodes:new Map,over:null,measureDroppableContainers:Vu},sa=B.createContext(nv),iv=B.createContext(P_);function A_(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Bl}}}function k_(r,e){switch(e.type){case an.DragStart:return{...r,draggable:{...r.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case an.DragMove:return r.draggable.active==null?r:{...r,draggable:{...r.draggable,translate:{x:e.coordinates.x-r.draggable.initialCoordinates.x,y:e.coordinates.y-r.draggable.initialCoordinates.y}}};case an.DragEnd:case an.DragCancel:return{...r,draggable:{...r.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case an.RegisterDroppable:{const{element:n}=e,{id:s}=n,l=new Bl(r.droppable.containers);return l.set(s,n),{...r,droppable:{...r.droppable,containers:l}}}case an.SetDroppableDisabled:{const{id:n,key:s,disabled:l}=e,a=r.droppable.containers.get(n);if(!a||s!==a.key)return r;const c=new Bl(r.droppable.containers);return c.set(n,{...a,disabled:l}),{...r,droppable:{...r.droppable,containers:c}}}case an.UnregisterDroppable:{const{id:n,key:s}=e,l=r.droppable.containers.get(n);if(!l||s!==l.key)return r;const a=new Bl(r.droppable.containers);return a.delete(n),{...r,droppable:{...r.droppable,containers:a}}}default:return r}}function z_(r){let{disabled:e}=r;const{active:n,activatorEvent:s,draggableNodes:l}=B.useContext(sa),a=Nu(s),c=Nu(n==null?void 0:n.id);return B.useEffect(()=>{if(!e&&!s&&a&&c!=null){if(!Th(a)||document.activeElement===a.target)return;const d=l.get(c);if(!d)return;const{activatorNode:h,node:m}=d;if(!h.current&&!m.current)return;requestAnimationFrame(()=>{for(const w of[h.current,m.current]){if(!w)continue;const v=E0(w);if(v){v.focus();break}}})}},[s,e,l,c,a]),null}function sv(r,e){let{transform:n,...s}=e;return r!=null&&r.length?r.reduce((l,a)=>a({transform:l,...s}),n):n}function O_(r){return B.useMemo(()=>({draggable:{...Pu.draggable,...r==null?void 0:r.draggable},droppable:{...Pu.droppable,...r==null?void 0:r.droppable},dragOverlay:{...Pu.dragOverlay,...r==null?void 0:r.dragOverlay}}),[r==null?void 0:r.draggable,r==null?void 0:r.droppable,r==null?void 0:r.dragOverlay])}function T_(r){let{activeNode:e,measure:n,initialRect:s,config:l=!0}=r;const a=B.useRef(!1),{x:c,y:d}=typeof l=="boolean"?{x:l,y:l}:l;Gs(()=>{if(!c&&!d||!e){a.current=!1;return}if(a.current||!s)return;const m=e==null?void 0:e.node.current;if(!m||m.isConnected===!1)return;const w=n(m),v=jg(w,s);if(c||(v.x=0),d||(v.y=0),a.current=!0,Math.abs(v.x)>0||Math.abs(v.y)>0){const S=Ug(m);S&&S.scrollBy({top:v.y,left:v.x})}},[e,c,d,s,n])}const Xu=B.createContext({...os,scaleX:1,scaleY:1});var vr;(function(r){r[r.Uninitialized=0]="Uninitialized",r[r.Initializing=1]="Initializing",r[r.Initialized=2]="Initialized"})(vr||(vr={}));const I_=B.memo(function(e){var n,s,l,a;let{id:c,accessibility:d,autoScroll:h=!0,children:m,sensors:w=E_,collisionDetection:v=F0,measuring:S,modifiers:E,...A}=e;const D=B.useReducer(k_,void 0,A_),[P,N]=D,[O,M]=O0(),[R,Z]=B.useState(vr.Uninitialized),G=R===vr.Initialized,{draggable:{active:$,nodes:K,translate:he},droppable:{containers:ue}}=P,Q=$!=null?K.get($):null,ve=B.useRef({initial:null,translated:null}),ie=B.useMemo(()=>{var ut;return $!=null?{id:$,data:(ut=Q==null?void 0:Q.data)!=null?ut:b_,rect:ve}:null},[$,Q]),ce=B.useRef(null),[j,te]=B.useState(null),[X,le]=B.useState(null),fe=Kl(A,Object.values(A)),ne=Qu("DndDescribedBy",c),z=B.useMemo(()=>ue.getEnabled(),[ue]),F=O_(S),{droppableRects:q,measureDroppableContainers:xe,measuringScheduled:Ie}=p_(z,{dragging:G,dependencies:[he.x,he.y],config:F.droppable}),Se=h_(K,$),Ee=B.useMemo(()=>X?Lu(X):null,[X]),We=Nt(),Fe=m_(Se,F.draggable.measure);T_({activeNode:$!=null?K.get($):null,config:We.layoutShiftCompensation,initialRect:Fe,measure:F.draggable.measure});const Me=gm(Se,F.draggable.measure,Fe),Zt=gm(Se?Se.parentElement:null),Wt=B.useRef({activatorEvent:null,active:null,activeNode:Se,collisionRect:null,collisions:null,droppableRects:q,draggableNodes:K,draggingNode:null,draggingNodeRect:null,droppableContainers:ue,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ft=ue.getNodeFor((n=Wt.current.over)==null?void 0:n.id),Ht=x_({measure:F.dragOverlay.measure}),ii=(s=Ht.nodeRef.current)!=null?s:Se,Tn=G?(l=Ht.rect)!=null?l:Me:null,zi=!!(Ht.nodeRef.current&&Ht.rect),ls=w_(zi?null:Me),Un=ev(ii?ni(ii):null),nt=__(G?Ft??Se:null),cn=C_(nt),dn=sv(E,{transform:{x:he.x-ls.x,y:he.y-ls.y,scaleX:1,scaleY:1},activatorEvent:X,active:ie,activeNodeRect:Me,containerNodeRect:Zt,draggingNodeRect:Tn,over:Wt.current.over,overlayNodeRect:Ht.rect,scrollableAncestors:nt,scrollableAncestorRects:cn,windowRect:Un}),pi=Ee?Wo(Ee,he):null,Le=y_(nt),ge=wm(Le),et=wm(Le,[Me]),it=Wo(dn,ge),hn=Tn?B0(Tn,dn):null,In=ie&&hn?v({active:ie,collisionRect:hn,droppableRects:q,droppableContainers:z,pointerCoordinates:pi}):null,Xt=G0(In,"id"),[zt,fn]=B.useState(null),xn=zi?dn:Wo(dn,et),qt=H0(xn,(a=zt==null?void 0:zt.rect)!=null?a:null,Me),En=B.useRef(null),as=B.useCallback((ut,en)=>{let{sensor:pn,options:vi}=en;if(ce.current==null)return;const bn=K.get(ce.current);if(!bn)return;const mn=ut.nativeEvent,Rn=new pn({active:ce.current,activeNode:bn,event:mn,options:vi,context:Wt,onAbort(je){if(!K.get(je))return;const{onDragAbort:Et}=fe.current,gn={id:je};Et==null||Et(gn),O({type:"onDragAbort",event:gn})},onPending(je,xt,Et,gn){if(!K.get(je))return;const{onDragPending:An}=fe.current,jt={id:je,constraint:xt,initialCoordinates:Et,offset:gn};An==null||An(jt),O({type:"onDragPending",event:jt})},onStart(je){const xt=ce.current;if(xt==null)return;const Et=K.get(xt);if(!Et)return;const{onDragStart:gn}=fe.current,yt={activatorEvent:mn,active:{id:xt,data:Et.data,rect:ve}};Kr.unstable_batchedUpdates(()=>{gn==null||gn(yt),Z(vr.Initializing),N({type:an.DragStart,initialCoordinates:je,active:xt}),O({type:"onDragStart",event:yt}),te(En.current),le(mn)})},onMove(je){N({type:an.DragMove,coordinates:je})},onEnd:Pn(an.DragEnd),onCancel:Pn(an.DragCancel)});En.current=Rn;function Pn(je){return async function(){const{active:Et,collisions:gn,over:yt,scrollAdjustedTranslate:An}=Wt.current;let jt=null;if(Et&&An){const{cancelDrop:Oi}=fe.current;jt={activatorEvent:mn,active:Et,collisions:gn,delta:An,over:yt},je===an.DragEnd&&typeof Oi=="function"&&await Promise.resolve(Oi(jt))&&(je=an.DragCancel)}ce.current=null,Kr.unstable_batchedUpdates(()=>{N({type:je}),Z(vr.Uninitialized),fn(null),te(null),le(null),En.current=null;const Oi=je===an.DragEnd?"onDragEnd":"onDragCancel";if(jt){const Ws=fe.current[Oi];Ws==null||Ws(jt),O({type:Oi,event:jt})}})}}},[K]),us=B.useCallback((ut,en)=>(pn,vi)=>{const bn=pn.nativeEvent,mn=K.get(vi);if(ce.current!==null||!mn||bn.dndKit||bn.defaultPrevented)return;const Rn={active:mn};ut(pn,en.options,Rn)===!0&&(bn.dndKit={capturedBy:en.sensor},ce.current=vi,as(pn,en))},[K,as]),mi=f_(w,us);S_(w),Gs(()=>{Me&&R===vr.Initializing&&Z(vr.Initialized)},[Me,R]),B.useEffect(()=>{const{onDragMove:ut}=fe.current,{active:en,activatorEvent:pn,collisions:vi,over:bn}=Wt.current;if(!en||!pn)return;const mn={active:en,activatorEvent:pn,collisions:vi,delta:{x:it.x,y:it.y},over:bn};Kr.unstable_batchedUpdates(()=>{ut==null||ut(mn),O({type:"onDragMove",event:mn})})},[it.x,it.y]),B.useEffect(()=>{const{active:ut,activatorEvent:en,collisions:pn,droppableContainers:vi,scrollAdjustedTranslate:bn}=Wt.current;if(!ut||ce.current==null||!en||!bn)return;const{onDragOver:mn}=fe.current,Rn=vi.get(Xt),Pn=Rn&&Rn.rect.current?{id:Rn.id,rect:Rn.rect.current,data:Rn.data,disabled:Rn.disabled}:null,je={active:ut,activatorEvent:en,collisions:pn,delta:{x:bn.x,y:bn.y},over:Pn};Kr.unstable_batchedUpdates(()=>{fn(Pn),mn==null||mn(je),O({type:"onDragOver",event:je})})},[Xt]),Gs(()=>{Wt.current={activatorEvent:X,active:ie,activeNode:Se,collisionRect:hn,collisions:In,droppableRects:q,draggableNodes:K,draggingNode:ii,draggingNodeRect:Tn,droppableContainers:ue,over:zt,scrollableAncestors:nt,scrollAdjustedTranslate:it},ve.current={initial:Tn,translated:hn}},[ie,Se,In,hn,K,ii,Tn,q,ue,zt,nt,it]),u_({...We,delta:he,draggingRect:hn,pointerCoordinates:pi,scrollableAncestors:nt,scrollableAncestorRects:cn});const gi=B.useMemo(()=>({active:ie,activeNode:Se,activeNodeRect:Me,activatorEvent:X,collisions:In,containerNodeRect:Zt,dragOverlay:Ht,draggableNodes:K,droppableContainers:ue,droppableRects:q,over:zt,measureDroppableContainers:xe,scrollableAncestors:nt,scrollableAncestorRects:cn,measuringConfiguration:F,measuringScheduled:Ie,windowRect:Un}),[ie,Se,Me,X,In,Zt,Ht,K,ue,q,zt,xe,nt,cn,F,Ie,Un]),cs=B.useMemo(()=>({activatorEvent:X,activators:mi,active:ie,activeNodeRect:Me,ariaDescribedById:{draggable:ne},dispatch:N,draggableNodes:K,over:zt,measureDroppableContainers:xe}),[X,mi,ie,Me,N,ne,K,zt,xe]);return pe.createElement(Hg.Provider,{value:M},pe.createElement(sa.Provider,{value:cs},pe.createElement(iv.Provider,{value:gi},pe.createElement(Xu.Provider,{value:qt},m)),pe.createElement(z_,{disabled:(d==null?void 0:d.restoreFocus)===!1})),pe.createElement(R0,{...d,hiddenTextDescribedById:ne}));function Nt(){const ut=(j==null?void 0:j.autoScrollEnabled)===!1,en=typeof h=="object"?h.enabled===!1:h===!1,pn=G&&!ut&&!en;return typeof h=="object"?{...h,enabled:pn}:{enabled:pn}}}),R_=B.createContext(null),ym="button",N_="Draggable";function M_(r){let{id:e,data:n,disabled:s=!1,attributes:l}=r;const a=Qu(N_),{activators:c,activatorEvent:d,active:h,activeNodeRect:m,ariaDescribedById:w,draggableNodes:v,over:S}=B.useContext(sa),{role:E=ym,roleDescription:A="draggable",tabIndex:D=0}=l??{},P=(h==null?void 0:h.id)===e,N=B.useContext(P?Xu:R_),[O,M]=Ru(),[R,Z]=Ru(),G=D_(c,e),$=Kl(n);Gs(()=>(v.set(e,{id:e,key:a,node:O,activatorNode:R,data:$}),()=>{const he=v.get(e);he&&he.key===a&&v.delete(e)}),[v,e]);const K=B.useMemo(()=>({role:E,tabIndex:D,"aria-disabled":s,"aria-pressed":P&&E===ym?!0:void 0,"aria-roledescription":A,"aria-describedby":w.draggable}),[s,E,D,P,A,w.draggable]);return{active:h,activatorEvent:d,activeNodeRect:m,attributes:K,isDragging:P,listeners:s?void 0:G,node:O,over:S,setNodeRef:M,setActivatorNodeRef:Z,transform:N}}function L_(){return B.useContext(iv)}const V_="Droppable",G_={timeout:25};function W_(r){let{data:e,disabled:n=!1,id:s,resizeObserverConfig:l}=r;const a=Qu(V_),{active:c,dispatch:d,over:h,measureDroppableContainers:m}=B.useContext(sa),w=B.useRef({disabled:n}),v=B.useRef(!1),S=B.useRef(null),E=B.useRef(null),{disabled:A,updateMeasurementsFor:D,timeout:P}={...G_,...l},N=Kl(D??s),O=B.useCallback(()=>{if(!v.current){v.current=!0;return}E.current!=null&&clearTimeout(E.current),E.current=setTimeout(()=>{m(Array.isArray(N.current)?N.current:[N.current]),E.current=null},P)},[P]),M=Zu({callback:O,disabled:A||!c}),R=B.useCallback((K,he)=>{M&&(he&&(M.unobserve(he),v.current=!1),K&&M.observe(K))},[M]),[Z,G]=Ru(R),$=Kl(e);return B.useEffect(()=>{!M||!Z.current||(M.disconnect(),v.current=!1,M.observe(Z.current))},[Z,M]),B.useEffect(()=>(d({type:an.RegisterDroppable,element:{id:s,key:a,disabled:n,node:Z,rect:S,data:$}}),()=>d({type:an.UnregisterDroppable,key:a,id:s})),[s]),B.useEffect(()=>{n!==w.current.disabled&&(d({type:an.SetDroppableDisabled,id:s,key:a,disabled:n}),w.current.disabled=n)},[s,a,n,d]),{active:c,rect:S,isOver:(h==null?void 0:h.id)===s,node:Z,over:h,setNodeRef:G}}function F_(r){let{animation:e,children:n}=r;const[s,l]=B.useState(null),[a,c]=B.useState(null),d=Nu(n);return!n&&!s&&d&&l(d),Gs(()=>{if(!a)return;const h=s==null?void 0:s.key,m=s==null?void 0:s.props.id;if(h==null||m==null){l(null);return}Promise.resolve(e(m,a)).then(()=>{l(null)})},[e,s,a]),pe.createElement(pe.Fragment,null,n,s?B.cloneElement(s,{ref:c}):null)}const H_={x:0,y:0,scaleX:1,scaleY:1};function j_(r){let{children:e}=r;return pe.createElement(sa.Provider,{value:nv},pe.createElement(Xu.Provider,{value:H_},e))}const B_={position:"fixed",touchAction:"none"},U_=r=>Th(r)?"transform 250ms ease":void 0,$_=B.forwardRef((r,e)=>{let{as:n,activatorEvent:s,adjustScale:l,children:a,className:c,rect:d,style:h,transform:m,transition:w=U_}=r;if(!d)return null;const v=l?m:{...m,scaleX:1,scaleY:1},S={...B_,width:d.width,height:d.height,top:d.top,left:d.left,transform:Jl.Transform.toString(v),transformOrigin:l&&s?L0(s,d):void 0,transition:typeof w=="function"?w(s):w,...h};return pe.createElement(n,{className:c,style:S,ref:e},a)}),Y_=r=>e=>{let{active:n,dragOverlay:s}=e;const l={},{styles:a,className:c}=r;if(a!=null&&a.active)for(const[d,h]of Object.entries(a.active))h!==void 0&&(l[d]=n.node.style.getPropertyValue(d),n.node.style.setProperty(d,h));if(a!=null&&a.dragOverlay)for(const[d,h]of Object.entries(a.dragOverlay))h!==void 0&&s.node.style.setProperty(d,h);return c!=null&&c.active&&n.node.classList.add(c.active),c!=null&&c.dragOverlay&&s.node.classList.add(c.dragOverlay),function(){for(const[h,m]of Object.entries(l))n.node.style.setProperty(h,m);c!=null&&c.active&&n.node.classList.remove(c.active)}},K_=r=>{let{transform:{initial:e,final:n}}=r;return[{transform:Jl.Transform.toString(e)},{transform:Jl.Transform.toString(n)}]},J_={duration:250,easing:"ease",keyframes:K_,sideEffects:Y_({styles:{active:{opacity:"0"}}})};function Q_(r){let{config:e,draggableNodes:n,droppableContainers:s,measuringConfiguration:l}=r;return Ju((a,c)=>{if(e===null)return;const d=n.get(a);if(!d)return;const h=d.node.current;if(!h)return;const m=tv(c);if(!m)return;const{transform:w}=ni(c).getComputedStyle(c),v=Bg(w);if(!v)return;const S=typeof e=="function"?e:Z_(e);return Zg(h,l.draggable.measure),S({active:{id:a,data:d.data,node:h,rect:l.draggable.measure(h)},draggableNodes:n,dragOverlay:{node:c,rect:l.dragOverlay.measure(m)},droppableContainers:s,measuringConfiguration:l,transform:v})})}function Z_(r){const{duration:e,easing:n,sideEffects:s,keyframes:l}={...J_,...r};return a=>{let{active:c,dragOverlay:d,transform:h,...m}=a;if(!e)return;const w={x:d.rect.left-c.rect.left,y:d.rect.top-c.rect.top},v={scaleX:h.scaleX!==1?c.rect.width*h.scaleX/d.rect.width:1,scaleY:h.scaleY!==1?c.rect.height*h.scaleY/d.rect.height:1},S={x:h.x-w.x,y:h.y-w.y,...v},E=l({...m,active:c,dragOverlay:d,transform:{initial:h,final:S}}),[A]=E,D=E[E.length-1];if(JSON.stringify(A)===JSON.stringify(D))return;const P=s==null?void 0:s({active:c,dragOverlay:d,...m}),N=d.node.animate(E,{duration:e,easing:n,fill:"forwards"});return new Promise(O=>{N.onfinish=()=>{P==null||P(),O()}})}}let Sm=0;function X_(r){return B.useMemo(()=>{if(r!=null)return Sm++,Sm},[r])}const q_=pe.memo(r=>{let{adjustScale:e=!1,children:n,dropAnimation:s,style:l,transition:a,modifiers:c,wrapperElement:d="div",className:h,zIndex:m=999}=r;const{activatorEvent:w,active:v,activeNodeRect:S,containerNodeRect:E,draggableNodes:A,droppableContainers:D,dragOverlay:P,over:N,measuringConfiguration:O,scrollableAncestors:M,scrollableAncestorRects:R,windowRect:Z}=L_(),G=B.useContext(Xu),$=X_(v==null?void 0:v.id),K=sv(c,{activatorEvent:w,active:v,activeNodeRect:S,containerNodeRect:E,draggingNodeRect:P.rect,over:N,overlayNodeRect:P.rect,scrollableAncestors:M,scrollableAncestorRects:R,transform:G,windowRect:Z}),he=Lh(S),ue=Q_({config:s,draggableNodes:A,droppableContainers:D,measuringConfiguration:O}),Q=he?P.setRef:void 0;return pe.createElement(j_,null,pe.createElement(F_,{animation:ue},v&&$?pe.createElement($_,{key:$,id:v.id,ref:Q,as:d,activatorEvent:w,adjustScale:e,className:h,transition:a,rect:he,style:{zIndex:m,...l},transform:K},n):null))}),Dm=r=>{let e;const n=new Set,s=(m,w)=>{const v=typeof m=="function"?m(e):m;if(!Object.is(v,e)){const S=e;e=w??(typeof v!="object"||v===null)?v:Object.assign({},e,v),n.forEach(E=>E(e,S))}},l=()=>e,d={setState:s,getState:l,getInitialState:()=>h,subscribe:m=>(n.add(m),()=>n.delete(m))},h=e=r(s,l,d);return d},ey=(r=>r?Dm(r):Dm),ty=r=>r;function ny(r,e=ty){const n=pe.useSyncExternalStore(r.subscribe,pe.useCallback(()=>e(r.getState()),[r,e]),pe.useCallback(()=>e(r.getInitialState()),[r,e]));return pe.useDebugValue(n),n}const Cm=r=>{const e=ey(r),n=s=>ny(e,s);return Object.assign(n,e),n},iy=(r=>r?Cm(r):Cm),rv="damiao.monitor.plotConfigs";function sy(){try{return JSON.parse(localStorage.getItem(rv)||"{}")}catch{return{}}}function ry(r){try{localStorage.setItem(rv,JSON.stringify(r))}catch{}}const Cn=iy((r,e)=>({connected:!1,status:null,signals:[],pairs:[],motors:[],motorTypes:[],plotConfigs:sy(),setConnected:n=>r({connected:n}),setStatus:n=>r({status:n}),setMeta:(n,s)=>r({signals:n,pairs:s}),setMotors:n=>r({motors:n}),setMotorTypes:n=>r({motorTypes:n}),ensurePlot:n=>r(s=>s.plotConfigs[n]?s:{plotConfigs:{...s.plotConfigs,[n]:{signals:[],duration:10}}}),setPlotConfig:(n,s)=>r(l=>({plotConfigs:{...l.plotConfigs,[n]:{...l.plotConfigs[n]||{signals:[],duration:10},...s}}})),addSignalToPlot:(n,s)=>r(l=>{const a=l.plotConfigs[n]||{signals:[],duration:10};return a.signals.includes(s)?l:{plotConfigs:{...l.plotConfigs,[n]:{...a,signals:[...a.signals,s]}}}}),removeSignalFromPlot:(n,s)=>r(l=>{const a=l.plotConfigs[n];return a?{plotConfigs:{...l.plotConfigs,[n]:{...a,signals:a.signals.filter(c=>c!==s)}}}:l}),dropPlot:n=>r(s=>{const l={...s.plotConfigs};return delete l[n],{plotConfigs:l}})}));Cn.subscribe(r=>ry(r.plotConfigs));const oy=!0,un="u-",ly="uplot",ay=un+"hz",uy=un+"vt",cy=un+"title",dy=un+"wrap",hy=un+"under",fy=un+"over",py=un+"axis",Yr=un+"off",my=un+"select",gy=un+"cursor-x",vy=un+"cursor-y",wy=un+"cursor-pt",_y=un+"legend",yy=un+"live",Sy=un+"inline",Dy=un+"series",Cy=un+"marker",xm=un+"label",xy=un+"value",Gl="width",Wl="height",Rl="top",Em="bottom",Ro="left",Hd="right",Vh="#000",bm=Vh+"0",jd="mousemove",Pm="mousedown",Bd="mouseup",Am="mouseenter",km="mouseleave",zm="dblclick",Ey="resize",by="scroll",Om="change",Wu="dppxchange",Gh="--",Qo=typeof window<"u",oh=Qo?document:null,Fo=Qo?window:null,Py=Qo?navigator:null;let tt,vu;function lh(){let r=devicePixelRatio;tt!=r&&(tt=r,vu&&uh(Om,vu,lh),vu=matchMedia(`(min-resolution: ${tt-.001}dppx) and (max-resolution: ${tt+.001}dppx)`),Jr(Om,vu,lh),Fo.dispatchEvent(new CustomEvent(Wu)))}function Pi(r,e){if(e!=null){let n=r.classList;!n.contains(e)&&n.add(e)}}function ah(r,e){let n=r.classList;n.contains(e)&&n.remove(e)}function wt(r,e,n){r.style[e]=n+"px"}function ns(r,e,n,s){let l=oh.createElement(r);return e!=null&&Pi(l,e),n!=null&&n.insertBefore(l,s),l}function Hi(r,e){return ns("div",r,e)}const Tm=new WeakMap;function ws(r,e,n,s,l){let a="translate("+e+"px,"+n+"px)",c=Tm.get(r);a!=c&&(r.style.transform=a,Tm.set(r,a),e<0||n<0||e>s||n>l?Pi(r,Yr):ah(r,Yr))}const Im=new WeakMap;function Rm(r,e,n){let s=e+n,l=Im.get(r);s!=l&&(Im.set(r,s),r.style.background=e,r.style.borderColor=n)}const Nm=new WeakMap;function Mm(r,e,n,s){let l=e+""+n,a=Nm.get(r);l!=a&&(Nm.set(r,l),r.style.height=n+"px",r.style.width=e+"px",r.style.marginLeft=s?-e/2+"px":0,r.style.marginTop=s?-n/2+"px":0)}const Wh={passive:!0},Ay={...Wh,capture:!0};function Jr(r,e,n,s){e.addEventListener(r,n,s?Ay:Wh)}function uh(r,e,n,s){e.removeEventListener(r,n,Wh)}Qo&&lh();function is(r,e,n,s){let l;n=n||0,s=s||e.length-1;let a=s<=2147483647;for(;s-n>1;)l=a?n+s>>1:Ai((n+s)/2),e[l]{let a=-1,c=-1;for(let d=s;d<=l;d++)if(r(n[d])){a=d;break}for(let d=l;d>=s;d--)if(r(n[d])){c=d;break}return[a,c]}}const lv=r=>r!=null,av=r=>r!=null&&r>0,qu=ov(lv),ky=ov(av);function zy(r,e,n,s=0,l=!1){let a=l?ky:qu,c=l?av:lv;[e,n]=a(r,e,n);let d=r[e],h=r[e];if(e>-1)if(s==1)d=r[e],h=r[n];else if(s==-1)d=r[n],h=r[e];else for(let m=e;m<=n;m++){let w=r[m];c(w)&&(wh&&(h=w))}return[d??ft,h??-ft]}function ec(r,e,n,s){let l=Gm(r),a=Gm(e);r==e&&(l==-1?(r*=n,e/=n):(r/=n,e*=n));let c=n==10?Ls:uv,d=l==1?Ai:Ui,h=a==1?Ui:Ai,m=d(c(ln(r))),w=h(c(ln(e))),v=jo(n,m),S=jo(n,w);return n==10&&(m<0&&(v=pt(v,-m)),w<0&&(S=pt(S,-w))),s||n==2?(r=v*l,e=S*a):(r=fv(r,v),e=tc(e,S)),[r,e]}function Fh(r,e,n,s){let l=ec(r,e,n,s);return r==0&&(l[0]=0),e==0&&(l[1]=0),l}const Hh=.1,Lm={mode:3,pad:Hh},Ul={pad:0,soft:null,mode:0},Oy={min:Ul,max:Ul};function Fu(r,e,n,s){return nc(n)?Vm(r,e,n):(Ul.pad=n,Ul.soft=s?0:null,Ul.mode=s?3:0,Vm(r,e,Oy))}function qe(r,e){return r??e}function Ty(r,e,n){for(e=qe(e,0),n=qe(n,r.length-1);e<=n;){if(r[e]!=null)return!0;e++}return!1}function Vm(r,e,n){let s=n.min,l=n.max,a=qe(s.pad,0),c=qe(l.pad,0),d=qe(s.hard,-ft),h=qe(l.hard,ft),m=qe(s.soft,ft),w=qe(l.soft,-ft),v=qe(s.mode,0),S=qe(l.mode,0),E=e-r,A=Ls(E),D=ti(ln(r),ln(e)),P=Ls(D),N=ln(P-A);(E<1e-24||N>10)&&(E=0,(r==0||e==0)&&(E=1e-24,v==2&&m!=ft&&(a=0),S==2&&w!=-ft&&(c=0)));let O=E||D||1e3,M=Ls(O),R=jo(10,Ai(M)),Z=O*(E==0?r==0?.1:1:a),G=pt(fv(r-Z,R/10),24),$=r>=m&&(v==1||v==3&&G<=m||v==2&&G>=m)?m:ft,K=ti(d,G<$&&r>=$?$:ss($,G)),he=O*(E==0?e==0?.1:1:c),ue=pt(tc(e+he,R/10),24),Q=e<=w&&(S==1||S==3&&ue>=w||S==2&&ue<=w)?w:-ft,ve=ss(h,ue>Q&&e<=Q?Q:ti(Q,ue));return K==ve&&K==0&&(ve=100),[K,ve]}const Iy=new Intl.NumberFormat(Qo?Py.language:"en-US"),jh=r=>Iy.format(r),ki=Math,Au=ki.PI,ln=ki.abs,Ai=ki.floor,rn=ki.round,Ui=ki.ceil,ss=ki.min,ti=ki.max,jo=ki.pow,Gm=ki.sign,Ls=ki.log10,uv=ki.log2,Ry=(r,e=1)=>ki.sinh(r)*e,Ud=(r,e=1)=>ki.asinh(r/e),ft=1/0;function Wm(r){return(Ls((r^r>>31)-(r>>31))|0)+1}function ch(r,e,n){return ss(ti(r,e),n)}function cv(r){return typeof r=="function"}function Ye(r){return cv(r)?r:()=>r}const Ny=()=>{},dv=r=>r,hv=(r,e)=>e,My=r=>null,Fm=r=>!0,Hm=(r,e)=>r==e,Ly=/\.\d*?(?=9{6,}|0{6,})/gm,Xr=r=>{if(mv(r)||yr.has(r))return r;const e=`${r}`,n=e.match(Ly);if(n==null)return r;let s=n[0].length-1;if(e.indexOf("e-")!=-1){let[l,a]=e.split("e");return+`${Xr(l)}e${a}`}return pt(r,s)};function Ur(r,e){return Xr(pt(Xr(r/e))*e)}function tc(r,e){return Xr(Ui(Xr(r/e))*e)}function fv(r,e){return Xr(Ai(Xr(r/e))*e)}function pt(r,e=0){if(mv(r))return r;let n=10**e,s=r*n*(1+Number.EPSILON);return rn(s)/n}const yr=new Map;function pv(r){return((""+r).split(".")[1]||"").length}function Zl(r,e,n,s){let l=[],a=s.map(pv);for(let c=e;c=0?0:d)+(c>=a[m]?0:a[m]),S=r==10?w:pt(w,v);l.push(S),yr.set(S,v)}}return l}const $l={},Bh=[],Bo=[null,null],wr=Array.isArray,mv=Number.isInteger,Vy=r=>r===void 0;function jm(r){return typeof r=="string"}function nc(r){let e=!1;if(r!=null){let n=r.constructor;e=n==null||n==Object}return e}function Gy(r){return r!=null&&typeof r=="object"}const Wy=Object.getPrototypeOf(Uint8Array),gv="__proto__";function Uo(r,e=nc){let n;if(wr(r)){let s=r.find(l=>l!=null);if(wr(s)||e(s)){n=Array(r.length);for(let l=0;la){for(l=c-1;l>=0&&r[l]==null;)r[l--]=null;for(l=c+1;lc-d)],l=s[0].length,a=new Map;for(let c=0;c"u"?r=>Promise.resolve().then(r):queueMicrotask;function Yy(r){let e=r[0],n=e.length,s=Array(n);for(let a=0;ae[a]-e[c]);let l=[];for(let a=0;a=s&&r[l]==null;)l--;if(l<=s)return!0;const a=ti(1,Ai((l-s+1)/e));for(let c=r[s],d=s+a;d<=l;d+=a){const h=r[d];if(h!=null){if(h<=c)return!1;c=h}}return!0}const vv=["January","February","March","April","May","June","July","August","September","October","November","December"],wv=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function _v(r){return r.slice(0,3)}const Qy=wv.map(_v),Zy=vv.map(_v),Xy={MMMM:vv,MMM:Zy,WWWW:wv,WWW:Qy};function Nl(r){return(r<10?"0":"")+r}function qy(r){return(r<10?"00":r<100?"0":"")+r}const eS={YYYY:r=>r.getFullYear(),YY:r=>(r.getFullYear()+"").slice(2),MMMM:(r,e)=>e.MMMM[r.getMonth()],MMM:(r,e)=>e.MMM[r.getMonth()],MM:r=>Nl(r.getMonth()+1),M:r=>r.getMonth()+1,DD:r=>Nl(r.getDate()),D:r=>r.getDate(),WWWW:(r,e)=>e.WWWW[r.getDay()],WWW:(r,e)=>e.WWW[r.getDay()],HH:r=>Nl(r.getHours()),H:r=>r.getHours(),h:r=>{let e=r.getHours();return e==0?12:e>12?e-12:e},AA:r=>r.getHours()>=12?"PM":"AM",aa:r=>r.getHours()>=12?"pm":"am",a:r=>r.getHours()>=12?"p":"a",mm:r=>Nl(r.getMinutes()),m:r=>r.getMinutes(),ss:r=>Nl(r.getSeconds()),s:r=>r.getSeconds(),fff:r=>qy(r.getMilliseconds())};function Uh(r,e){e=e||Xy;let n=[],s=/\{([a-z]+)\}|[^{]+/gi,l;for(;l=s.exec(r);)n.push(l[0][0]=="{"?eS[l[1]]:l[0]);return a=>{let c="";for(let d=0;dr%1==0,Hu=[1,2,2.5,5],iS=Zl(10,-32,0,Hu),Sv=Zl(10,0,32,Hu),sS=Sv.filter(yv),$r=iS.concat(Sv),$h=` +`,Dv="{YYYY}",Bm=$h+Dv,Cv="{M}/{D}",Fl=$h+Cv,wu=Fl+"/{YY}",xv="{aa}",rS="{h}:{mm}",Lo=rS+xv,Um=$h+Lo,$m=":{ss}",rt=null;function Ev(r){let e=r*1e3,n=e*60,s=n*60,l=s*24,a=l*30,c=l*365,h=(r==1?Zl(10,0,3,Hu).filter(yv):Zl(10,-3,0,Hu)).concat([e,e*5,e*10,e*15,e*30,n,n*5,n*10,n*15,n*30,s,s*2,s*3,s*4,s*6,s*8,s*12,l,l*2,l*3,l*4,l*5,l*6,l*7,l*8,l*9,l*10,l*15,a,a*2,a*3,a*4,a*6,c,c*2,c*5,c*10,c*25,c*50,c*100]);const m=[[c,Dv,rt,rt,rt,rt,rt,rt,1],[l*28,"{MMM}",Bm,rt,rt,rt,rt,rt,1],[l,Cv,Bm,rt,rt,rt,rt,rt,1],[s,"{h}"+xv,wu,rt,Fl,rt,rt,rt,1],[n,Lo,wu,rt,Fl,rt,rt,rt,1],[e,$m,wu+" "+Lo,rt,Fl+" "+Lo,rt,Um,rt,1],[r,$m+".{fff}",wu+" "+Lo,rt,Fl+" "+Lo,rt,Um,rt,1]];function w(v){return(S,E,A,D,P,N)=>{let O=[],M=P>=c,R=P>=a&&P=l?l:P,ue=Ai(A)-Ai(G),Q=K+ue+tc(G-K,he);O.push(Q);let ve=v(Q),ie=ve.getHours()+ve.getMinutes()/n+ve.getSeconds()/s,ce=P/s,j=S.axes[E]._space,te=N/j;for(;Q=pt(Q+P,r==1?0:3),!(Q>D);)if(ce>1){let X=Ai(pt(ie+ce,6))%24,ne=v(Q).getHours()-X;ne>1&&(ne=-1),Q-=ne*s,ie=(ie+ce)%24;let z=O[O.length-1];pt((Q-z)/P,3)*te>=.7&&O.push(Q)}else O.push(Q)}return O}}return[h,m,w]}const[oS,lS,aS]=Ev(1),[uS,cS,dS]=Ev(.001);Zl(2,-53,53,[1]);function Ym(r,e){return r.map(n=>n.map((s,l)=>l==0||l==8||s==null?s:e(l==1||n[8]==0?s:n[1]+s)))}function Km(r,e){return(n,s,l,a,c)=>{let d=e.find(A=>c>=A[0])||e[e.length-1],h,m,w,v,S,E;return s.map(A=>{let D=r(A),P=D.getFullYear(),N=D.getMonth(),O=D.getDate(),M=D.getHours(),R=D.getMinutes(),Z=D.getSeconds(),G=P!=h&&d[2]||N!=m&&d[3]||O!=w&&d[4]||M!=v&&d[5]||R!=S&&d[6]||Z!=E&&d[7]||d[1];return h=P,m=N,w=O,v=M,S=R,E=Z,G(D)})}}function hS(r,e){let n=Uh(e);return(s,l,a,c,d)=>l.map(h=>n(r(h)))}function $d(r,e,n){return new Date(r,e,n)}function Jm(r,e){return e(r)}const fS="{YYYY}-{MM}-{DD} {h}:{mm}{aa}";function Qm(r,e){return(n,s,l,a)=>a==null?Gh:e(r(s))}function pS(r,e){let n=r.series[e];return n.width?n.stroke(r,e):n.points.width?n.points.stroke(r,e):null}function mS(r,e){return r.series[e].fill(r,e)}const gS={show:!0,live:!0,isolate:!1,mount:Ny,markers:{show:!0,width:2,stroke:pS,fill:mS,dash:"solid"},idx:null,idxs:null,values:[]};function vS(r,e){let n=r.cursor.points,s=Hi(),l=n.size(r,e);wt(s,Gl,l),wt(s,Wl,l);let a=l/-2;wt(s,"marginLeft",a),wt(s,"marginTop",a);let c=n.width(r,e,l);return c&&wt(s,"borderWidth",c),s}function wS(r,e){let n=r.series[e].points;return n._fill||n._stroke}function _S(r,e){let n=r.series[e].points;return n._stroke||n._fill}function yS(r,e){return r.series[e].points.size}const Yd=[0,0];function SS(r,e,n){return Yd[0]=e,Yd[1]=n,Yd}function _u(r,e,n,s=!0){return l=>{l.button==0&&(!s||l.target==e)&&n(l)}}function Kd(r,e,n,s=!0){return l=>{(!s||l.target==e)&&n(l)}}const DS={show:!0,x:!0,y:!0,lock:!1,move:SS,points:{one:!1,show:vS,size:yS,width:0,stroke:_S,fill:wS},bind:{mousedown:_u,mouseup:_u,click:_u,dblclick:_u,mousemove:Kd,mouseleave:Kd,mouseenter:Kd},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,click:(r,e)=>{e.stopPropagation(),e.stopImmediatePropagation()},_x:!1,_y:!1},focus:{dist:(r,e,n,s,l)=>s-l,prox:-1,bias:0},hover:{skip:[void 0],prox:null,bias:0},left:-10,top:-10,idx:null,dataIdx:null,idxs:null,event:null},bv={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},Yh=Jt({},bv,{filter:hv}),Pv=Jt({},Yh,{size:10}),Av=Jt({},bv,{show:!1}),Kh='12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',kv="bold "+Kh,zv=1.5,Zm={show:!0,scale:"x",stroke:Vh,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:kv,side:2,grid:Yh,ticks:Pv,border:Av,font:Kh,lineGap:zv,rotate:0},CS="Value",xS="Time",Xm={show:!0,scale:"x",auto:!1,sorted:1,min:ft,max:-ft,idxs:[]};function ES(r,e,n,s,l){return e.map(a=>a==null?"":jh(a))}function bS(r,e,n,s,l,a,c){let d=[],h=yr.get(l)||0;n=c?n:pt(tc(n,l),h);for(let m=n;m<=s;m=pt(m+l,h))d.push(Object.is(m,-0)?0:m);return d}function dh(r,e,n,s,l,a,c){const d=[],h=r.scales[r.axes[e].scale].log,m=h==10?Ls:uv,w=Ai(m(n));l=jo(h,w),h==10&&(l=$r[is(l,$r)]);let v=n,S=l*h;h==10&&(S=$r[is(S,$r)]);do d.push(v),v=v+l,h==10&&!yr.has(v)&&(v=pt(v,yr.get(l))),v>=S&&(l=v,S=l*h,h==10&&(S=$r[is(S,$r)]));while(v<=s);return d}function PS(r,e,n,s,l,a,c){let h=r.scales[r.axes[e].scale].asinh,m=s>h?dh(r,e,ti(h,n),s,l):[h],w=s>=0&&n<=0?[0]:[];return(n<-h?dh(r,e,ti(h,-s),-n,l):[h]).reverse().map(S=>-S).concat(w,m)}const Ov=/./,AS=/[12357]/,kS=/[125]/,qm=/1/,hh=(r,e,n,s)=>r.map((l,a)=>e==4&&l==0||a%s==0&&n.test(l.toExponential()[l<0?1:0])?l:null);function zS(r,e,n,s,l){let a=r.axes[n],c=a.scale,d=r.scales[c],h=r.valToPos,m=a._space,w=h(10,c),v=h(9,c)-w>=m?Ov:h(7,c)-w>=m?AS:h(5,c)-w>=m?kS:qm;if(v==qm){let S=ln(h(1,c)-w);if(Sl,ng={show:!0,auto:!0,sorted:0,gaps:Tv,alpha:1,facets:[Jt({},tg,{scale:"x"}),Jt({},tg,{scale:"y"})]},ig={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:Tv,alpha:1,points:{show:RS,filter:null},values:null,min:ft,max:-ft,idxs:[],path:null,clip:null};function NS(r,e,n,s,l){return n/10}const Iv={time:oy,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},MS=Jt({},Iv,{time:!1,ori:1}),sg={};function Rv(r,e){let n=sg[r];return n||(n={key:r,plots:[],sub(s){n.plots.push(s)},unsub(s){n.plots=n.plots.filter(l=>l!=s)},pub(s,l,a,c,d,h,m){for(let w=0;w{let N=c.pxRound;const O=m.dir*(m.ori==0?1:-1),M=m.ori==0?Zo:Xo;let R,Z;O==1?(R=n,Z=s):(R=s,Z=n);let G=N(v(d[R],m,D,E)),$=N(S(h[R],w,P,A)),K=N(v(d[Z],m,D,E)),he=N(S(a==1?w.max:w.min,w,P,A)),ue=new Path2D(l);return M(ue,K,he),M(ue,G,he),M(ue,G,$),ue})}function ic(r,e,n,s,l,a){let c=null;if(r.length>0){c=new Path2D;const d=e==0?oc:Zh;let h=n;for(let v=0;vS[0]){let E=S[0]-h;E>0&&d(c,h,s,E,s+a),h=S[1]}}let m=n+l-h,w=10;m>0&&d(c,h,s-w/2,m,s+a+w)}return c}function VS(r,e,n){let s=r[r.length-1];s&&s[0]==e?s[1]=n:r.push([e,n])}function Qh(r,e,n,s,l,a,c){let d=[],h=r.length;for(let m=l==1?n:s;m>=n&&m<=s;m+=l)if(e[m]===null){let v=m,S=m;if(l==1)for(;++m<=s&&e[m]===null;)S=m;else for(;--m>=n&&e[m]===null;)S=m;let E=a(r[v]),A=S==v?E:a(r[S]),D=v-l;E=c<=0&&D>=0&&D=0&&N>=0&&N=E&&d.push([E,A])}return d}function rg(r){return r==0?dv:r==1?rn:e=>Ur(e,r)}function Nv(r){let e=r==0?sc:rc,n=r==0?(l,a,c,d,h,m)=>{l.arcTo(a,c,d,h,m)}:(l,a,c,d,h,m)=>{l.arcTo(c,a,h,d,m)},s=r==0?(l,a,c,d,h)=>{l.rect(a,c,d,h)}:(l,a,c,d,h)=>{l.rect(c,a,h,d)};return(l,a,c,d,h,m=0,w=0)=>{m==0&&w==0?s(l,a,c,d,h):(m=ss(m,d/2,h/2),w=ss(w,d/2,h/2),e(l,a+m,c),n(l,a+d,c,a+d,c+h,m),n(l,a+d,c+h,a,c+h,w),n(l,a,c+h,a,c,w),n(l,a,c,a+d,c,m),l.closePath())}}const sc=(r,e,n)=>{r.moveTo(e,n)},rc=(r,e,n)=>{r.moveTo(n,e)},Zo=(r,e,n)=>{r.lineTo(e,n)},Xo=(r,e,n)=>{r.lineTo(n,e)},oc=Nv(0),Zh=Nv(1),Mv=(r,e,n,s,l,a)=>{r.arc(e,n,s,l,a)},Lv=(r,e,n,s,l,a)=>{r.arc(n,e,s,l,a)},Vv=(r,e,n,s,l,a,c)=>{r.bezierCurveTo(e,n,s,l,a,c)},Gv=(r,e,n,s,l,a,c)=>{r.bezierCurveTo(n,e,l,s,c,a)};function Wv(r){return(e,n,s,l,a)=>qr(e,n,(c,d,h,m,w,v,S,E,A,D,P)=>{let{pxRound:N,points:O}=c,M,R;m.ori==0?(M=sc,R=Mv):(M=rc,R=Lv);const Z=pt(O.width*tt,3);let G=(O.size-O.width)/2*tt,$=pt(G*2,3),K=new Path2D,he=new Path2D,{left:ue,top:Q,width:ve,height:ie}=e.bbox;oc(he,ue-$,Q-$,ve+$*2,ie+$*2);const ce=j=>{if(h[j]!=null){let te=N(v(d[j],m,D,E)),X=N(S(h[j],w,P,A));M(K,te+G,X),R(K,te,X,G,0,Au*2)}};if(a)a.forEach(ce);else for(let j=s;j<=l;j++)ce(j);return{stroke:Z>0?K:null,fill:K,clip:he,flags:$o|fh}})}function Fv(r){return(e,n,s,l,a,c)=>{s!=l&&(a!=s&&c!=s&&r(e,n,s),a!=l&&c!=l&&r(e,n,l),r(e,n,c))}}const GS=Fv(Zo),WS=Fv(Xo);function Hv(r){const e=qe(r==null?void 0:r.alignGaps,0);return(n,s,l,a)=>qr(n,s,(c,d,h,m,w,v,S,E,A,D,P)=>{[l,a]=qu(h,l,a);let N=c.pxRound,O=ie=>N(v(ie,m,D,E)),M=ie=>N(S(ie,w,P,A)),R,Z;m.ori==0?(R=Zo,Z=GS):(R=Xo,Z=WS);const G=m.dir*(m.ori==0?1:-1),$={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:$o},K=$.stroke;let he=!1;if(a-l>=D*4){let ie=q=>n.posToVal(q,m.key,!0),ce=null,j=null,te,X,le,fe=O(d[G==1?l:a]),ne=O(d[l]),z=O(d[a]),F=ie(G==1?ne+1:z-1);for(let q=G==1?l:a;q>=l&&q<=a;q+=G){let xe=d[q],Se=(G==1?xeF)?fe:O(xe),Ee=h[q];Se==fe?Ee!=null?(X=Ee,ce==null?(R(K,Se,M(X)),te=ce=j=X):Xj&&(j=X)):Ee===null&&(he=!0):(ce!=null&&Z(K,fe,M(ce),M(j),M(te),M(X)),Ee!=null?(X=Ee,R(K,Se,M(X)),ce=j=te=X):(ce=j=null,Ee===null&&(he=!0)),fe=Se,F=ie(fe+G))}ce!=null&&ce!=j&&le!=fe&&Z(K,fe,M(ce),M(j),M(te),M(X))}else for(let ie=G==1?l:a;ie>=l&&ie<=a;ie+=G){let ce=h[ie];ce===null?he=!0:ce!=null&&R(K,O(d[ie]),M(ce))}let[Q,ve]=Jh(n,s);if(c.fill!=null||Q!=0){let ie=$.fill=new Path2D(K),ce=c.fillTo(n,s,c.min,c.max,Q),j=M(ce),te=O(d[l]),X=O(d[a]);G==-1&&([X,te]=[te,X]),R(ie,X,j),R(ie,te,j)}if(!c.spanGaps){let ie=[];he&&ie.push(...Qh(d,h,l,a,G,O,e)),$.gaps=ie=c.gaps(n,s,l,a,ie),$.clip=ic(ie,m.ori,E,A,D,P)}return ve!=0&&($.band=ve==2?[Vs(n,s,l,a,K,-1),Vs(n,s,l,a,K,1)]:Vs(n,s,l,a,K,ve)),$})}function FS(r){const e=qe(r.align,1),n=qe(r.ascDesc,!1),s=qe(r.alignGaps,0),l=qe(r.extend,!1);return(a,c,d,h)=>qr(a,c,(m,w,v,S,E,A,D,P,N,O,M)=>{[d,h]=qu(v,d,h);let R=m.pxRound,{left:Z,width:G}=a.bbox,$=ne=>R(A(ne,S,O,P)),K=ne=>R(D(ne,E,M,N)),he=S.ori==0?Zo:Xo;const ue={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:$o},Q=ue.stroke,ve=S.dir*(S.ori==0?1:-1);let ie=K(v[ve==1?d:h]),ce=$(w[ve==1?d:h]),j=ce,te=ce;l&&e==-1&&(te=Z,he(Q,te,ie)),he(Q,ce,ie);for(let ne=ve==1?d:h;ne>=d&&ne<=h;ne+=ve){let z=v[ne];if(z==null)continue;let F=$(w[ne]),q=K(z);e==1?he(Q,F,ie):he(Q,j,q),he(Q,F,q),ie=q,j=F}let X=j;l&&e==1&&(X=Z+G,he(Q,X,ie));let[le,fe]=Jh(a,c);if(m.fill!=null||le!=0){let ne=ue.fill=new Path2D(Q),z=m.fillTo(a,c,m.min,m.max,le),F=K(z);he(ne,X,F),he(ne,te,F)}if(!m.spanGaps){let ne=[];ne.push(...Qh(w,v,d,h,ve,$,s));let z=m.width*tt/2,F=n||e==1?z:-z,q=n||e==-1?-z:z;ne.forEach(xe=>{xe[0]+=F,xe[1]+=q}),ue.gaps=ne=m.gaps(a,c,d,h,ne),ue.clip=ic(ne,S.ori,P,N,O,M)}return fe!=0&&(ue.band=fe==2?[Vs(a,c,d,h,Q,-1),Vs(a,c,d,h,Q,1)]:Vs(a,c,d,h,Q,fe)),ue})}function og(r,e,n,s,l,a,c=ft){if(r.length>1){let d=null;for(let h=0,m=1/0;h{}),{fill:v,stroke:S}=m;return(E,A,D,P)=>qr(E,A,(N,O,M,R,Z,G,$,K,he,ue,Q)=>{let ve=N.pxRound,ie=n,ce=s*tt,j=d*tt,te=h*tt,X,le;R.ori==0?[X,le]=a(E,A):[le,X]=a(E,A);const fe=R.dir*(R.ori==0?1:-1);let ne=R.ori==0?oc:Zh,z=R.ori==0?w:(ge,et,it,hn,In,Xt,zt)=>{w(ge,et,it,In,hn,zt,Xt)},F=qe(E.bands,Bh).find(ge=>ge.series[0]==A),q=F!=null?F.dir:0,xe=N.fillTo(E,A,N.min,N.max,q),Ie=ve($(xe,Z,Q,he)),Se,Ee,We,Fe=ue,Me=ve(N.width*tt),Zt=!1,Wt=null,Ft=null,Ht=null,ii=null;v!=null&&(Me==0||S!=null)&&(Zt=!0,Wt=v.values(E,A,D,P),Ft=new Map,new Set(Wt).forEach(ge=>{ge!=null&&Ft.set(ge,new Path2D)}),Me>0&&(Ht=S.values(E,A,D,P),ii=new Map,new Set(Ht).forEach(ge=>{ge!=null&&ii.set(ge,new Path2D)})));let{x0:Tn,size:zi}=m;if(Tn!=null&&zi!=null){ie=1,O=Tn.values(E,A,D,P),Tn.unit==2&&(O=O.map(it=>E.posToVal(K+it*ue,R.key,!0)));let ge=zi.values(E,A,D,P);zi.unit==2?Ee=ge[0]*ue:Ee=G(ge[0],R,ue,K)-G(0,R,ue,K),Fe=og(O,M,G,R,ue,K,Fe),We=Fe-Ee+ce}else Fe=og(O,M,G,R,ue,K,Fe),We=Fe*c+ce,Ee=Fe-We;We<1&&(We=0),Me>=Ee/2&&(Me=0),We<5&&(ve=dv);let ls=We>0,Un=Fe-We-(ls?Me:0);Ee=ve(ch(Un,te,j)),Se=(ie==0?Ee/2:ie==fe?0:Ee)-ie*fe*((ie==0?ce/2:0)+(ls?Me/2:0));const nt={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},cn=Zt?null:new Path2D;let dn=null;if(F!=null)dn=E.data[F.series[1]];else{let{y0:ge,y1:et}=m;ge!=null&&et!=null&&(M=et.values(E,A,D,P),dn=ge.values(E,A,D,P))}let pi=X*Ee,Le=le*Ee;for(let ge=fe==1?D:P;ge>=D&&ge<=P;ge+=fe){let et=M[ge];if(et==null)continue;if(dn!=null){let qt=dn[ge]??0;if(et-qt==0)continue;Ie=$(qt,Z,Q,he)}let it=R.distr!=2||m!=null?O[ge]:ge,hn=G(it,R,ue,K),In=$(qe(et,xe),Z,Q,he),Xt=ve(hn-Se),zt=ve(ti(In,Ie)),fn=ve(ss(In,Ie)),xn=zt-fn;if(et!=null){let qt=et<0?Le:pi,En=et<0?pi:Le;Zt?(Me>0&&Ht[ge]!=null&&ne(ii.get(Ht[ge]),Xt,fn+Ai(Me/2),Ee,ti(0,xn-Me),qt,En),Wt[ge]!=null&&ne(Ft.get(Wt[ge]),Xt,fn+Ai(Me/2),Ee,ti(0,xn-Me),qt,En)):ne(cn,Xt,fn+Ai(Me/2),Ee,ti(0,xn-Me),qt,En),z(E,A,ge,Xt-Me/2,fn,Ee+Me,xn)}}return Me>0?nt.stroke=Zt?ii:cn:Zt||(nt._fill=N.width==0?N._fill:N._stroke??N._fill,nt.width=0),nt.fill=Zt?Ft:cn,nt})}function jS(r,e){const n=qe(e==null?void 0:e.alignGaps,0);return(s,l,a,c)=>qr(s,l,(d,h,m,w,v,S,E,A,D,P,N)=>{[a,c]=qu(m,a,c);let O=d.pxRound,M=X=>O(S(X,w,P,A)),R=X=>O(E(X,v,N,D)),Z,G,$;w.ori==0?(Z=sc,$=Zo,G=Vv):(Z=rc,$=Xo,G=Gv);const K=w.dir*(w.ori==0?1:-1);let he=M(h[K==1?a:c]),ue=he,Q=[],ve=[];for(let X=K==1?a:c;X>=a&&X<=c;X+=K)if(m[X]!=null){let fe=h[X],ne=M(fe);Q.push(ue=ne),ve.push(R(m[X]))}const ie={stroke:r(Q,ve,Z,$,G,O),fill:null,clip:null,band:null,gaps:null,flags:$o},ce=ie.stroke;let[j,te]=Jh(s,l);if(d.fill!=null||j!=0){let X=ie.fill=new Path2D(ce),le=d.fillTo(s,l,d.min,d.max,j),fe=R(le);$(X,ue,fe),$(X,he,fe)}if(!d.spanGaps){let X=[];X.push(...Qh(h,m,a,c,K,M,n)),ie.gaps=X=d.gaps(s,l,a,c,X),ie.clip=ic(X,w.ori,A,D,P,N)}return te!=0&&(ie.band=te==2?[Vs(s,l,a,c,ce,-1),Vs(s,l,a,c,ce,1)]:Vs(s,l,a,c,ce,te)),ie})}function BS(r){return jS(US,r)}function US(r,e,n,s,l,a){const c=r.length;if(c<2)return null;const d=new Path2D;if(n(d,r[0],e[0]),c==2)s(d,r[1],e[1]);else{let h=Array(c),m=Array(c-1),w=Array(c-1),v=Array(c-1);for(let S=0;S0!=m[S]>0?h[S]=0:(h[S]=3*(v[S-1]+v[S])/((2*v[S]+v[S-1])/m[S-1]+(v[S]+2*v[S-1])/m[S]),isFinite(h[S])||(h[S]=0));h[c-1]=m[c-2];for(let S=0;S{jn.pxRatio=tt}));const $S=Hv(),YS=Wv();function ag(r,e,n,s){return(s?[r[0],r[1]].concat(r.slice(2)):[r[0]].concat(r.slice(1))).map((a,c)=>mh(a,c,e,n))}function KS(r,e){return r.map((n,s)=>s==0?{}:Jt({},e,n))}function mh(r,e,n,s){return Jt({},e==0?n:s,r)}function jv(r,e,n){return e==null?Bo:[e,n]}const JS=jv;function QS(r,e,n){return e==null?Bo:Fu(e,n,Hh,!0)}function Bv(r,e,n,s){return e==null?Bo:ec(e,n,r.scales[s].log,!1)}const ZS=Bv;function Uv(r,e,n,s){return e==null?Bo:Fh(e,n,r.scales[s].log,!1)}const XS=Uv;function qS(r,e,n,s,l){let a=ti(Wm(r),Wm(e)),c=e-r,d=is(l/s*c,n);do{let h=n[d],m=s*h/c;if(m>=l&&a+(h<5?yr.get(h):0)<=17)return[h,m]}while(++d(e=rn((n=+l)*tt))+"px"),[r,e,n]}function eD(r){r.show&&[r.font,r.labelFont].forEach(e=>{let n=pt(e[2]*tt,1);e[0]=e[0].replace(/[0-9.]+px/,n+"px"),e[1]=n})}function jn(r,e,n){const s={mode:qe(r.mode,1)},l=s.mode;function a(g,y,C,x){let T=y.valToPct(g);return x+C*(y.dir==-1?1-T:T)}function c(g,y,C,x){let T=y.valToPct(g);return x+C*(y.dir==-1?T:1-T)}function d(g,y,C,x){return y.ori==0?a(g,y,C,x):c(g,y,C,x)}s.valToPosH=a,s.valToPosV=c;let h=!1;s.status=0;const m=s.root=Hi(ly);if(r.id!=null&&(m.id=r.id),Pi(m,r.class),r.title){let g=Hi(cy,m);g.textContent=r.title}const w=ns("canvas"),v=s.ctx=w.getContext("2d"),S=Hi(dy,m);Jr("click",S,g=>{g.target===A&&(Ze!=xs||ot!=Zs)&&tn.click(s,g)},!0);const E=s.under=Hi(hy,S);S.appendChild(w);const A=s.over=Hi(fy,S);r=Uo(r);const D=+qe(r.pxAlign,1),P=rg(D);(r.plugins||[]).forEach(g=>{g.opts&&(r=g.opts(s,r)||r)});const N=r.ms||.001,O=s.series=l==1?ag(r.series||[],Xm,ig,!1):KS(r.series||[null],ng),M=s.axes=ag(r.axes||[],Zm,eg,!0),R=s.scales={},Z=s.bands=r.bands||[];Z.forEach(g=>{g.fill=Ye(g.fill||null),g.dir=qe(g.dir,-1)});const G=l==2?O[1].facets[0].scale:O[0].scale,$={axes:da,series:gc},K=(r.drawOrder||["axes","series"]).map(g=>$[g]);function he(g){const y=g.distr==3?C=>Ls(C>0?C:g.clamp(s,C,g.min,g.max,g.key)):g.distr==4?C=>Ud(C,g.asinh):g.distr==100?C=>g.fwd(C):C=>C;return C=>{let x=y(C),{_min:T,_max:V}=g,J=V-T;return(x-T)/J}}function ue(g){let y=R[g];if(y==null){let C=(r.scales||$l)[g]||$l;if(C.from!=null){ue(C.from);let x=Jt({},R[C.from],C,{key:g});x.valToPct=he(x),R[g]=x}else{y=R[g]=Jt({},g==G?Iv:MS,C),y.key=g;let x=y.time,T=y.range,V=wr(T);if((g!=G||l==2&&!x)&&(V&&(T[0]==null||T[1]==null)&&(T={min:T[0]==null?Lm:{mode:1,hard:T[0],soft:T[0]},max:T[1]==null?Lm:{mode:1,hard:T[1],soft:T[1]}},V=!1),!V&&nc(T))){let J=T;T=(se,ae,me)=>ae==null?Bo:Fu(ae,me,J)}y.range=Ye(T||(x?JS:g==G?y.distr==3?ZS:y.distr==4?XS:jv:y.distr==3?Bv:y.distr==4?Uv:QS)),y.auto=Ye(V?!1:y.auto),y.clamp=Ye(y.clamp||NS),y._min=y._max=null,y.valToPct=he(y)}}}ue("x"),ue("y"),l==1&&O.forEach(g=>{ue(g.scale)}),M.forEach(g=>{ue(g.scale)});for(let g in r.scales)ue(g);const Q=R[G],ve=Q.distr;let ie,ce;Q.ori==0?(Pi(m,ay),ie=a,ce=c):(Pi(m,uy),ie=c,ce=a);const j={};for(let g in R){let y=R[g];(y.min!=null||y.max!=null)&&(j[g]={min:y.min,max:y.max},y.min=y.max=null)}const te=r.tzDate||(g=>new Date(rn(g/N))),X=r.fmtDate||Uh,le=N==1?aS(te):dS(te),fe=Km(te,Ym(N==1?lS:cS,X)),ne=Qm(te,Jm(fS,X)),z=[],F=s.legend=Jt({},gS,r.legend),q=s.cursor=Jt({},DS,{drag:{y:l==2}},r.cursor),xe=F.show,Ie=q.show,Se=F.markers;F.idxs=z,Se.width=Ye(Se.width),Se.dash=Ye(Se.dash),Se.stroke=Ye(Se.stroke),Se.fill=Ye(Se.fill);let Ee,We,Fe,Me=[],Zt=[],Wt,Ft=!1,Ht={};if(F.live){const g=O[1]?O[1].values:null;Ft=g!=null,Wt=Ft?g(s,1,0):{_:0};for(let y in Wt)Ht[y]=Gh}if(xe)if(Ee=ns("table",_y,m),Fe=ns("tbody",null,Ee),F.mount(s,Ee),Ft){We=ns("thead",null,Ee,Fe);let g=ns("tr",null,We);ns("th",null,g);for(var ii in Wt)ns("th",xm,g).textContent=ii}else Pi(Ee,Sy),F.live&&Pi(Ee,yy);const Tn={show:!0},zi={show:!1};function ls(g,y){if(y==0&&(Ft||!F.live||l==2))return Bo;let C=[],x=ns("tr",Dy,Fe,Fe.childNodes[y]);Pi(x,g.class),g.show||Pi(x,Yr);let T=ns("th",null,x);if(Se.show){let se=Hi(Cy,T);if(y>0){let ae=Se.width(s,y);ae&&(se.style.border=ae+"px "+Se.dash(s,y)+" "+Se.stroke(s,y)),se.style.background=Se.fill(s,y)}}let V=Hi(xm,T);g.label instanceof HTMLElement?V.appendChild(g.label):V.textContent=g.label,y>0&&(Se.show||(V.style.color=g.width>0?Se.stroke(s,y):Se.fill(s,y)),nt("click",T,se=>{if(q._lock)return;Pn(se);let ae=O.indexOf(g);if((se.ctrlKey||se.metaKey)!=F.isolate){let me=O.some((we,_e)=>_e>0&&_e!=ae&&we.show);O.forEach((we,_e)=>{_e>0&&Si(_e,me?_e==ae?Tn:zi:Tn,!0,Tt.setSeries)})}else Si(ae,{show:!g.show},!0,Tt.setSeries)},!1),Et&&nt(Am,T,se=>{q._lock||(Pn(se),Si(O.indexOf(g),er,!0,Tt.setSeries))},!1));for(var J in Wt){let se=ns("td",xy,x);se.textContent="--",C.push(se)}return[x,C]}const Un=new Map;function nt(g,y,C,x=!0){const T=Un.get(y)||{},V=q.bind[g](s,y,C,x);V&&(Jr(g,y,T[g]=V),Un.set(y,T))}function cn(g,y,C){const x=Un.get(y)||{};for(let T in x)(g==null||T==g)&&(uh(T,y,x[T]),delete x[T]);g==null&&Un.delete(y)}let dn=0,pi=0,Le=0,ge=0,et=0,it=0,hn=et,In=it,Xt=Le,zt=ge,fn=0,xn=0,qt=0,En=0;s.bbox={};let as=!1,us=!1,mi=!1,gi=!1,cs=!1,Nt=!1;function ut(g,y,C){(C||g!=s.width||y!=s.height)&&en(g,y),Cs(!1),mi=!0,us=!0,Kn()}function en(g,y){s.width=dn=Le=g,s.height=pi=ge=y,et=it=0,mn(),Rn();let C=s.bbox;fn=C.left=Ur(et*tt,.5),xn=C.top=Ur(it*tt,.5),qt=C.width=Ur(Le*tt,.5),En=C.height=Ur(ge*tt,.5)}const pn=3;function vi(){let g=!1,y=0;for(;!g;){y++;let C=rl(y),x=ca(y);g=y==pn||C&&x,g||(en(s.width,s.height),us=!0)}}function bn({width:g,height:y}){ut(g,y)}s.setSize=bn;function mn(){let g=!1,y=!1,C=!1,x=!1;M.forEach((T,V)=>{if(T.show&&T._show){let{side:J,_size:se}=T,ae=J%2,me=T.label!=null?T.labelSize:0,we=se+me;we>0&&(ae?(Le-=we,J==3?(et+=we,x=!0):C=!0):(ge-=we,J==0?(it+=we,g=!0):y=!0))}}),$n[0]=g,$n[1]=C,$n[2]=y,$n[3]=x,Le-=Yi[1]+Yi[3],et+=Yi[3],ge-=Yi[2]+Yi[0],it+=Yi[0]}function Rn(){let g=et+Le,y=it+ge,C=et,x=it;function T(V,J){switch(V){case 1:return g+=J,g-J;case 2:return y+=J,y-J;case 3:return C-=J,C+J;case 0:return x-=J,x+J}}M.forEach((V,J)=>{if(V.show&&V._show){let se=V.side;V._pos=T(se,V._size),V.label!=null&&(V._lpos=T(se,V.labelSize))}})}if(q.dataIdx==null){let g=q.hover,y=g.skip=new Set(g.skip??[]);y.add(void 0);let C=g.prox=Ye(g.prox),x=g.bias??(g.bias=0);q.dataIdx=(T,V,J,se)=>{if(V==0)return J;let ae=J,me=C(T,V,J,se)??ft,we=me>=0&&me0;)y.has($e[Pe])||(He=Pe);if(x==0||x==1)for(Pe=J;ze==null&&Pe++<$e.length;)y.has($e[Pe])||(ze=Pe);if(He!=null||ze!=null)if(we){let at=He==null?-1/0:ie(Je[He],Q,_e,0),St=ze==null?1/0:ie(Je[ze],Q,_e,0),$t=Ve-at,st=St-Ve;$t<=st?$t<=me&&(ae=He):st<=me&&(ae=ze)}else ae=ze==null?He:He==null?ze:J-He<=ze-J?He:ze}else we&&ln(Ve-ie(Je[J],Q,_e,0))>me&&(ae=null);return ae}}const Pn=g=>{q.event=g};q.idxs=z,q._lock=!1;let je=q.points;je.show=Ye(je.show),je.size=Ye(je.size),je.stroke=Ye(je.stroke),je.width=Ye(je.width),je.fill=Ye(je.fill);const xt=s.focus=Jt({},r.focus||{alpha:.3},q.focus),Et=xt.prox>=0,gn=Et&&je.one;let yt=[],An=[],jt=[];function Oi(g,y){let C=je.show(s,y);if(C instanceof HTMLElement)return Pi(C,wy),Pi(C,g.class),ws(C,-10,-10,Le,ge),A.insertBefore(C,yt[y]),C}function Ws(g,y){if(l==1||y>0){let C=l==1&&R[g.scale].time,x=g.value;g.value=C?jm(x)?Qm(te,Jm(x,X)):x||ne:x||TS,g.label=g.label||(C?xS:CS)}if(gn||y>0){g.width=g.width==null?1:g.width,g.paths=g.paths||$S||My,g.fillTo=Ye(g.fillTo||LS),g.pxAlign=+qe(g.pxAlign,D),g.pxRound=rg(g.pxAlign),g.stroke=Ye(g.stroke||null),g.fill=Ye(g.fill||null),g._stroke=g._fill=g._paths=g._focus=null;let C=IS(ti(1,g.width),1),x=g.points=Jt({},{size:C,width:ti(1,C*.2),stroke:g.stroke,space:C*2,paths:YS,_stroke:null,_fill:null},g.points);x.show=Ye(x.show),x.filter=Ye(x.filter),x.fill=Ye(x.fill),x.stroke=Ye(x.stroke),x.paths=Ye(x.paths),x.pxAlign=g.pxAlign}if(xe){let C=ls(g,y);Me.splice(y,0,C[0]),Zt.splice(y,0,C[1]),F.values.push(null)}if(Ie){z.splice(y,0,null);let C=null;gn?y==0&&(C=Oi(g,y)):y>0&&(C=Oi(g,y)),yt.splice(y,0,C),An.splice(y,0,0),jt.splice(y,0,0)}Ut("addSeries",y)}function fc(g,y){y=y??O.length,g=l==1?mh(g,y,Xm,ig):mh(g,y,{},ng),O.splice(y,0,g),Ws(O[y],y)}s.addSeries=fc;function pc(g){if(O.splice(g,1),xe){F.values.splice(g,1),Zt.splice(g,1);let y=Me.splice(g,1)[0];cn(null,y.firstChild),y.remove()}Ie&&(z.splice(g,1),yt.splice(g,1)[0].remove(),An.splice(g,1),jt.splice(g,1)),Ut("delSeries",g)}s.delSeries=pc;const $n=[!1,!1,!1,!1];function ra(g,y){if(g._show=g.show,g.show){let C=g.side%2,x=R[g.scale];x==null&&(g.scale=C?O[1].scale:G,x=R[g.scale]);let T=x.time;g.size=Ye(g.size),g.space=Ye(g.space),g.rotate=Ye(g.rotate),wr(g.incrs)&&g.incrs.forEach(J=>{!yr.has(J)&&yr.set(J,pv(J))}),g.incrs=Ye(g.incrs||(x.distr==2?sS:T?N==1?oS:uS:$r)),g.splits=Ye(g.splits||(T&&x.distr==1?le:x.distr==3?dh:x.distr==4?PS:bS)),g.stroke=Ye(g.stroke),g.grid.stroke=Ye(g.grid.stroke),g.ticks.stroke=Ye(g.ticks.stroke),g.border.stroke=Ye(g.border.stroke);let V=g.values;g.values=wr(V)&&!wr(V[0])?Ye(V):T?wr(V)?Km(te,Ym(V,X)):jm(V)?hS(te,V):V||fe:V||ES,g.filter=Ye(g.filter||(x.distr>=3&&x.log==10?zS:x.distr==3&&x.log==2?OS:hv)),g.font=ug(g.font),g.labelFont=ug(g.labelFont),g._size=g.size(s,null,y,0),g._space=g._rotate=g._incrs=g._found=g._splits=g._values=null,g._size>0&&($n[y]=!0,g._el=Hi(py,S))}}function Fs(g,y,C,x){let[T,V,J,se]=C,ae=y%2,me=0;return ae==0&&(se||V)&&(me=y==0&&!T||y==2&&!J?rn(Zm.size/3):0),ae==1&&(T||J)&&(me=y==1&&!V||y==3&&!se?rn(eg.size/2):0),me}const oa=s.padding=(r.padding||[Fs,Fs,Fs,Fs]).map(g=>Ye(qe(g,Fs))),Yi=s._padding=oa.map((g,y)=>g(s,y,$n,0));let Bt,Mt=null,Lt=null;const to=l==1?O[0].idxs:null;let wi=null,ct=!1;function la(g,y){if(e=g??[],s.data=s._data=e,l==2){Bt=0;for(let C=1;C=0,Nt=!0,Kn()}}s.setData=la;function Sr(){ct=!0;let g,y;l==1&&(Bt>0?(Mt=to[0]=0,Lt=to[1]=Bt-1,g=e[0][Mt],y=e[0][Lt],ve==2?(g=Mt,y=Lt):g==y&&(ve==3?[g,y]=ec(g,g,Q.log,!1):ve==4?[g,y]=Fh(g,g,Q.log,!1):Q.time?y=g+rn(86400/N):[g,y]=Fu(g,y,Hh,!0))):(Mt=to[0]=g=null,Lt=to[1]=y=null)),yi(G,g,y)}let Dr,Ki,qo,no,Hs,si,el,Yn,tl,Nn;function aa(g,y,C,x,T,V){g??(g=bm),C??(C=Bh),x??(x="butt"),T??(T=bm),V??(V="round"),g!=Dr&&(v.strokeStyle=Dr=g),T!=Ki&&(v.fillStyle=Ki=T),y!=qo&&(v.lineWidth=qo=y),V!=Hs&&(v.lineJoin=Hs=V),x!=si&&(v.lineCap=si=x),C!=no&&v.setLineDash(no=C)}function Cr(g,y,C,x){y!=Ki&&(v.fillStyle=Ki=y),g!=el&&(v.font=el=g),C!=Yn&&(v.textAlign=Yn=C),x!=tl&&(v.textBaseline=tl=x)}function js(g,y,C,x,T=0){if(x.length>0&&g.auto(s,ct)&&(y==null||y.min==null)){let V=qe(Mt,0),J=qe(Lt,x.length-1),se=C.min==null?zy(x,V,J,T,g.distr==3):[C.min,C.max];g.min=ss(g.min,C.min=se[0]),g.max=ti(g.max,C.max=se[1])}}const Bs={min:null,max:null};function io(){for(let x in R){let T=R[x];j[x]==null&&(T.min==null||j[G]!=null&&T.auto(s,ct))&&(j[x]=Bs)}for(let x in R){let T=R[x];j[x]==null&&T.from!=null&&j[T.from]!=null&&(j[x]=Bs)}j[G]!=null&&Cs(!0);let g={};for(let x in j){let T=j[x];if(T!=null){let V=g[x]=Uo(R[x],Gy);if(T.min!=null)Jt(V,T);else if(x!=G||l==2)if(Bt==0&&V.from==null){let J=V.range(s,null,null,x);V.min=J[0],V.max=J[1]}else V.min=ft,V.max=-ft}}if(Bt>0){O.forEach((x,T)=>{if(l==1){let V=x.scale,J=j[V];if(J==null)return;let se=g[V];if(T==0){let ae=se.range(s,se.min,se.max,V);se.min=ae[0],se.max=ae[1],Mt=is(se.min,e[0]),Lt=is(se.max,e[0]),Lt-Mt>1&&(e[0][Mt]se.max&&Lt--),x.min=wi[Mt],x.max=wi[Lt]}else x.show&&x.auto&&js(se,J,x,e[T],x.sorted);x.idxs[0]=Mt,x.idxs[1]=Lt}else if(T>0&&x.show&&x.auto){let[V,J]=x.facets,se=V.scale,ae=J.scale,[me,we]=e[T],_e=g[se],Ve=g[ae];_e!=null&&js(_e,j[se],V,me,V.sorted),Ve!=null&&js(Ve,j[ae],J,we,J.sorted),x.min=J.min,x.max=J.max}});for(let x in g){let T=g[x],V=j[x];if(T.from==null&&(V==null||V.min==null)){let J=T.range(s,T.min==ft?null:T.min,T.max==-ft?null:T.max,x);T.min=J[0],T.max=J[1]}}}for(let x in g){let T=g[x];if(T.from!=null){let V=g[T.from];if(V.min==null)T.min=T.max=null;else{let J=T.range(s,V.min,V.max,x);T.min=J[0],T.max=J[1]}}}let y={},C=!1;for(let x in g){let T=g[x],V=R[x];if(V.min!=T.min||V.max!=T.max){V.min=T.min,V.max=T.max;let J=V.distr;V._min=J==3?Ls(V.min):J==4?Ud(V.min,V.asinh):J==100?V.fwd(V.min):V.min,V._max=J==3?Ls(V.max):J==4?Ud(V.max,V.asinh):J==100?V.fwd(V.max):V.max,y[x]=C=!0}}if(C){O.forEach((x,T)=>{l==2?T>0&&y.y&&(x._paths=null):y[x.scale]&&(x._paths=null)});for(let x in y)mi=!0,Ut("setScale",x);Ie&&q.left>=0&&(gi=Nt=!0)}for(let x in j)j[x]=null}function mc(g){let y=ch(Mt-1,0,Bt-1),C=ch(Lt+1,0,Bt-1);for(;g[y]==null&&y>0;)y--;for(;g[C]==null&&C0){let g=O.some(y=>y._focus)&&Nn!=xt.alpha;g&&(v.globalAlpha=Nn=xt.alpha),O.forEach((y,C)=>{if(C>0&&y.show&&(so(C,!1),so(C,!0),y._paths==null)){let x=Nn;Nn!=y.alpha&&(v.globalAlpha=Nn=y.alpha);let T=l==2?[0,e[C][0].length-1]:mc(e[C]);y._paths=y.paths(s,C,T[0],T[1]),Nn!=x&&(v.globalAlpha=Nn=x)}}),O.forEach((y,C)=>{if(C>0&&y.show){let x=Nn;Nn!=y.alpha&&(v.globalAlpha=Nn=y.alpha),y._paths!=null&&nl(C,!1);{let T=y._paths!=null?y._paths.gaps:null,V=y.points.show(s,C,Mt,Lt,T),J=y.points.filter(s,C,V,T);(V||J)&&(y.points._paths=y.points.paths(s,C,Mt,Lt,J),nl(C,!0))}Nn!=x&&(v.globalAlpha=Nn=x),Ut("drawSeries",C)}}),g&&(v.globalAlpha=Nn=1)}}function so(g,y){let C=y?O[g].points:O[g];C._stroke=C.stroke(s,g),C._fill=C.fill(s,g)}function nl(g,y){let C=y?O[g].points:O[g],{stroke:x,fill:T,clip:V,flags:J,_stroke:se=C._stroke,_fill:ae=C._fill,_width:me=C.width}=C._paths;me=pt(me*tt,3);let we=null,_e=me%2/2;y&&ae==null&&(ae=me>0?"#fff":se);let Ve=C.pxAlign==1&&_e>0;if(Ve&&v.translate(_e,_e),!y){let Je=fn-me/2,$e=xn-me/2,He=qt+me,ze=En+me;we=new Path2D,we.rect(Je,$e,He,ze)}y?sl(se,me,C.dash,C.cap,ae,x,T,J,V):il(g,se,me,C.dash,C.cap,ae,x,T,J,we,V),Ve&&v.translate(-_e,-_e)}function il(g,y,C,x,T,V,J,se,ae,me,we){let _e=!1;ae!=0&&Z.forEach((Ve,Je)=>{if(Ve.series[0]==g){let $e=O[Ve.series[1]],He=e[Ve.series[1]],ze=($e._paths||$l).band;wr(ze)&&(ze=Ve.dir==1?ze[0]:ze[1]);let Pe,at=null;$e.show&&ze&&Ty(He,Mt,Lt)?(at=Ve.fill(s,Je)||V,Pe=$e._paths.clip):ze=null,sl(y,C,x,T,at,J,se,ae,me,we,Pe,ze),_e=!0}}),_e||sl(y,C,x,T,V,J,se,ae,me,we)}const Us=$o|fh;function sl(g,y,C,x,T,V,J,se,ae,me,we,_e){aa(g,y,C,x,T),(ae||me||_e)&&(v.save(),ae&&v.clip(ae),me&&v.clip(me)),_e?(se&Us)==Us?(v.clip(_e),we&&v.clip(we),Ke(T,J),$s(g,V,y)):se&fh?(Ke(T,J),v.clip(_e),$s(g,V,y)):se&$o&&(v.save(),v.clip(_e),we&&v.clip(we),Ke(T,J),v.restore(),$s(g,V,y)):(Ke(T,J),$s(g,V,y)),(ae||me||_e)&&v.restore()}function $s(g,y,C){C>0&&(y instanceof Map?y.forEach((x,T)=>{v.strokeStyle=Dr=T,v.stroke(x)}):y!=null&&g&&v.stroke(y))}function Ke(g,y){y instanceof Map?y.forEach((C,x)=>{v.fillStyle=Ki=x,v.fill(C)}):y!=null&&g&&v.fill(y)}function ua(g,y,C,x){let T=M[g],V;if(x<=0)V=[0,0];else{let J=T._space=T.space(s,g,y,C,x),se=T._incrs=T.incrs(s,g,y,C,x,J);V=qS(y,C,se,x,J)}return T._found=V}function ro(g,y,C,x,T,V,J,se,ae,me){let we=J%2/2;D==1&&v.translate(we,we),aa(se,J,ae,me,se),v.beginPath();let _e,Ve,Je,$e,He=T+(x==0||x==3?-V:V);C==0?(Ve=T,$e=He):(_e=T,Je=He);for(let ze=0;ze{if(!C.show)return;let T=R[C.scale];if(T.min==null){C._show&&(y=!1,C._show=!1,Cs(!1));return}else C._show||(y=!1,C._show=!0,Cs(!1));let V=C.side,J=V%2,{min:se,max:ae}=T,[me,we]=ua(x,se,ae,J==0?Le:ge);if(we==0)return;let _e=T.distr==2,Ve=C._splits=C.splits(s,x,se,ae,me,we,_e),Je=T.distr==2?Ve.map(Pe=>wi[Pe]):Ve,$e=T.distr==2?wi[Ve[1]]-wi[Ve[0]]:me,He=C._values=C.values(s,C.filter(s,Je,x,we,$e),x,we,$e);C._rotate=V==2?C.rotate(s,He,x,we):0;let ze=C._size;C._size=Ui(C.size(s,He,x,g)),ze!=null&&C._size!=ze&&(y=!1)}),y}function ca(g){let y=!0;return oa.forEach((C,x)=>{let T=C(s,x,$n,g);T!=Yi[x]&&(y=!1),Yi[x]=T}),y}function da(){for(let g=0;gwi[kn]):Je,He=we.distr==2?wi[Je[1]]-wi[Je[0]]:ae,ze=y.ticks,Pe=y.border,at=ze.show?ze.size:0,St=rn(at*tt),$t=rn((y.alignTo==2?y._size-at-y.gap:y.gap)*tt),st=y._rotate*-Au/180,Dt=P(y._pos*tt),Qn=(St+$t)*se,dt=Dt+Qn;V=x==0?dt:0,T=x==1?dt:0;let vn=y.font[0],li=y.align==1?Ro:y.align==2?Hd:st>0?Ro:st<0?Hd:x==0?"center":C==3?Hd:Ro,Ci=st||x==1?"middle":C==2?Rl:Em;Cr(vn,J,li,Ci);let Ln=y.font[1]*y.lineGap,Zn=Je.map(kn=>P(d(kn,we,_e,Ve))),Xn=y._values;for(let kn=0;kn{C>0&&(y._paths=null,g&&(l==1?(y.min=null,y.max=null):y.facets.forEach(x=>{x.min=null,x.max=null})))})}let Ys=!1,Ks=!1,ri=[];function ds(){Ks=!1;for(let g=0;g0&&queueMicrotask(ds)}s.batch=xr;function Js(){if(as&&(io(),as=!1),mi&&(vi(),mi=!1),us){if(wt(E,Ro,et),wt(E,Rl,it),wt(E,Gl,Le),wt(E,Wl,ge),wt(A,Ro,et),wt(A,Rl,it),wt(A,Gl,Le),wt(A,Wl,ge),wt(S,Gl,dn),wt(S,Wl,pi),w.width=rn(dn*tt),w.height=rn(pi*tt),M.forEach(({_el:g,_show:y,_size:C,_pos:x,side:T})=>{if(g!=null)if(y){let V=T===3||T===0?C:0,J=T%2==1;wt(g,J?"left":"top",x-V),wt(g,J?"width":"height",C),wt(g,J?"top":"left",J?it:et),wt(g,J?"height":"width",J?ge:Le),ah(g,Yr)}else Pi(g,Yr)}),Dr=Ki=qo=Hs=si=el=Yn=tl=no=null,Nn=1,Or(!0),et!=hn||it!=In||Le!=Xt||ge!=zt){Cs(!1);let g=Le/Xt,y=ge/zt;if(Ie&&!gi&&q.left>=0){q.left*=g,q.top*=y,Ii&&ws(Ii,rn(q.left),0,Le,ge),Qs&&ws(Qs,0,rn(q.top),Le,ge);for(let C=0;C=0&<.width>0){lt.left*=g,lt.width*=g,lt.top*=y,lt.height*=y;for(let C in dl)wt(Es,C,lt[C])}hn=et,In=it,Xt=Le,zt=ge}Ut("setSize"),us=!1}dn>0&&pi>0&&(v.clearRect(0,0,w.width,w.height),Ut("drawClear"),K.forEach(g=>g()),Ut("draw")),lt.show&&cs&&(_i(lt),cs=!1),Ie&&gi&&(bs(null,!0,!1),gi=!1),F.show&&F.live&&Nt&&(zr(),Nt=!1),h||(h=!0,s.status=1,Ut("ready")),ct=!1,Ys=!1}s.redraw=(g,y)=>{mi=y||!1,g!==!1?yi(G,Q.min,Q.max):Kn()};function Ti(g,y){let C=R[g];if(C.from==null){if(Bt==0){let x=C.range(s,y.min,y.max,g);y.min=x[0],y.max=x[1]}if(y.min>y.max){let x=y.min;y.min=y.max,y.max=x}if(Bt>1&&y.min!=null&&y.max!=null&&y.max-y.min<1e-16)return;g==G&&C.distr==2&&Bt>0&&(y.min=is(y.min,e[0]),y.max=is(y.max,e[0]),y.min==y.max&&y.max++),j[g]=y,as=!0,Kn()}}s.setScale=Ti;let ol,oo,Ii,Qs,ll,Er,xs,Zs,Xs,qs,Ze,ot,hs=!1;const tn=q.drag;let Ot=tn.x,bt=tn.y;Ie&&(q.x&&(ol=Hi(gy,A)),q.y&&(oo=Hi(vy,A)),Q.ori==0?(Ii=ol,Qs=oo):(Ii=oo,Qs=ol),Ze=q.left,ot=q.top);const lt=s.select=Jt({show:!0,over:!0,left:0,width:0,top:0,height:0},r.select),Es=lt.show?Hi(my,lt.over?A:E):null;function _i(g,y){if(lt.show){for(let C in g)lt[C]=g[C],C in dl&&wt(Es,C,g[C]);y!==!1&&Ut("setSelect")}}s.setSelect=_i;function al(g){if(O[g].show)xe&&ah(Me[g],Yr);else if(xe&&Pi(Me[g],Yr),Ie){let C=gn?yt[0]:yt[g];C!=null&&ws(C,-10,-10,Le,ge)}}function yi(g,y,C){Ti(g,{min:y,max:C})}function Si(g,y,C,x){y.focus!=null&&ul(g),y.show!=null&&O.forEach((T,V)=>{V>0&&(g==V||g==null)&&(T.show=y.show,al(V),l==2?(yi(T.facets[0].scale,null,null),yi(T.facets[1].scale,null,null)):yi(T.scale,null,null),Kn())}),C!==!1&&Ut("setSeries",g,y),x&&Tr("setSeries",s,g,y)}s.setSeries=Si;function lo(g,y){Jt(Z[g],y)}function ao(g,y){g.fill=Ye(g.fill||null),g.dir=qe(g.dir,-1),y=y??Z.length,Z.splice(y,0,g)}function ha(g){g==null?Z.length=0:Z.splice(g,1)}s.addBand=ao,s.setBand=lo,s.delBand=ha;function Jn(g,y){O[g].alpha=y,Ie&&yt[g]!=null&&(yt[g].style.opacity=y),xe&&Me[g]&&(Me[g].style.opacity=y)}let Mn,Ri,Di;const er={focus:!0};function ul(g){if(g!=Di){let y=g==null,C=xt.alpha!=1;O.forEach((x,T)=>{if(l==1||T>0){let V=y||T==0||T==g;x._focus=y?null:V,C&&Jn(T,V?1:xt.alpha)}}),Di=g,C&&Kn()}}xe&&Et&&nt(km,Ee,g=>{q._lock||(Pn(g),Di!=null&&Si(null,er,!0,Tt.setSeries))});function oi(g,y,C){let x=R[y];C&&(g=g/tt-(x.ori==1?it:et));let T=Le;x.ori==1&&(T=ge,g=T-g),x.dir==-1&&(g=T-g);let V=x._min,J=x._max,se=g/T,ae=V+(J-V)*se,me=x.distr;return me==3?jo(10,ae):me==4?Ry(ae,x.asinh):me==100?x.bwd(ae):ae}function br(g,y){let C=oi(g,G,y);return is(C,e[0],Mt,Lt)}s.valToIdx=g=>is(g,e[0]),s.posToIdx=br,s.posToVal=oi,s.valToPos=(g,y,C)=>R[y].ori==0?a(g,R[y],C?qt:Le,C?fn:0):c(g,R[y],C?En:ge,C?xn:0),s.setCursor=(g,y,C)=>{Ze=g.left,ot=g.top,bs(null,y,C)};function Pr(g,y){wt(Es,Ro,lt.left=g),wt(Es,Gl,lt.width=y)}function cl(g,y){wt(Es,Rl,lt.top=g),wt(Es,Wl,lt.height=y)}let Ar=Q.ori==0?Pr:cl,kr=Q.ori==1?Pr:cl;function vc(){if(xe&&F.live)for(let g=l==2?1:0;g{z[x]=C}):Vy(g.idx)||z.fill(g.idx),F.idx=z[0]),xe&&F.live){for(let C=0;C0||l==1&&!Ft)&&wc(C,z[C]);vc()}Nt=!1,y!==!1&&Ut("setLegend")}s.setLegend=zr;function wc(g,y){let C=O[g],x=g==0&&ve==2?wi:e[g],T;Ft?T=C.values(s,g,y)??Ht:(T=C.value(s,y==null?null:x[y],g,y),T=T==null?Ht:{_:T}),F.values[g]=T}function bs(g,y,C){Xs=Ze,qs=ot,[Ze,ot]=q.move(s,Ze,ot),q.left=Ze,q.top=ot,Ie&&(Ii&&ws(Ii,rn(Ze),0,Le,ge),Qs&&ws(Qs,0,rn(ot),Le,ge));let x,T=Mt>Lt;Mn=ft,Ri=null;let V=Q.ori==0?Le:ge,J=Q.ori==1?Le:ge;if(Ze<0||Bt==0||T){x=q.idx=null;for(let se=0;se0&&at.show){let Qn=st==null?-10:st==x?me:ie(l==1?e[0][st]:e[Pe][0][st],Q,V,0),dt=Dt==null?-10:ce(Dt,l==1?R[at.scale]:R[at.facets[1].scale],J,0);if(Et&&Dt!=null){let vn=Q.ori==1?Ze:ot,li=ln(xt.dist(s,Pe,st,dt,vn));if(li=0?1:-1,Xn=Ln>=0?1:-1;Xn==Zn&&(Xn==1?Ci==1?Dt>=Ln:Dt<=Ln:Ci==1?Dt<=Ln:Dt>=Ln)&&(Mn=li,Ri=Pe)}else Mn=li,Ri=Pe}}if(Nt||gn){let vn,li;Q.ori==0?(vn=Qn,li=dt):(vn=dt,li=Qn);let Ci,Ln,Zn,Xn,Ni,kn,Yt=!0,Ji=je.bbox;if(Ji!=null){Yt=!1;let Vt=Ji(s,Pe);Zn=Vt.left,Xn=Vt.top,Ci=Vt.width,Ln=Vt.height}else Zn=vn,Xn=li,Ci=Ln=je.size(s,Pe);if(kn=je.fill(s,Pe),Ni=je.stroke(s,Pe),gn)Pe==Ri&&Mn<=xt.prox&&(we=Zn,_e=Xn,Ve=Ci,Je=Ln,$e=Yt,He=kn,ze=Ni);else{let Vt=yt[Pe];Vt!=null&&(An[Pe]=Zn,jt[Pe]=Xn,Mm(Vt,Ci,Ln,Yt),Rm(Vt,kn,Ni),ws(Vt,Ui(Zn),Ui(Xn),Le,ge))}}}}if(gn){let Pe=xt.prox,at=Di==null?Mn<=Pe:Mn>Pe||Ri!=Di;if(Nt||at){let St=yt[0];St!=null&&(An[0]=we,jt[0]=_e,Mm(St,Ve,Je,$e),Rm(St,He,ze),ws(St,Ui(we),Ui(_e),Le,ge))}}}if(lt.show&&hs)if(g!=null){let[se,ae]=Tt.scales,[me,we]=Tt.match,[_e,Ve]=g.cursor.sync.scales,Je=g.cursor.drag;if(Ot=Je._x,bt=Je._y,Ot||bt){let{left:$e,top:He,width:ze,height:Pe}=g.select,at=g.scales[_e].ori,St=g.posToVal,$t,st,Dt,Qn,dt,vn=se!=null&&me(se,_e),li=ae!=null&&we(ae,Ve);vn&&Ot?(at==0?($t=$e,st=ze):($t=He,st=Pe),Dt=R[se],Qn=ie(St($t,_e),Dt,V,0),dt=ie(St($t+st,_e),Dt,V,0),Ar(ss(Qn,dt),ln(dt-Qn))):Ar(0,V),li&&bt?(at==1?($t=$e,st=ze):($t=He,st=Pe),Dt=R[ae],Qn=ce(St($t,Ve),Dt,J,0),dt=ce(St($t+st,Ve),Dt,J,0),kr(ss(Qn,dt),ln(dt-Qn))):kr(0,J)}else hl()}else{let se=ln(Xs-ll),ae=ln(qs-Er);if(Q.ori==1){let Ve=se;se=ae,ae=Ve}Ot=tn.x&&se>=tn.dist,bt=tn.y&&ae>=tn.dist;let me=tn.uni;me!=null?Ot&&bt&&(Ot=se>=me,bt=ae>=me,!Ot&&!bt&&(ae>se?bt=!0:Ot=!0)):tn.x&&tn.y&&(Ot||bt)&&(Ot=bt=!0);let we,_e;Ot&&(Q.ori==0?(we=xs,_e=Ze):(we=Zs,_e=ot),Ar(ss(we,_e),ln(_e-we)),bt||kr(0,J)),bt&&(Q.ori==1?(we=xs,_e=Ze):(we=Zs,_e=ot),kr(ss(we,_e),ln(_e-we)),Ot||Ar(0,V)),!Ot&&!bt&&(Ar(0,0),kr(0,0))}if(tn._x=Ot,tn._y=bt,g==null){if(C){if(fo!=null){let[se,ae]=Tt.scales;Tt.values[0]=se!=null?oi(Q.ori==0?Ze:ot,se):null,Tt.values[1]=ae!=null?oi(Q.ori==1?Ze:ot,ae):null}Tr(jd,s,Ze,ot,Le,ge,x)}if(Et){let se=C&&Tt.setSeries,ae=xt.prox;Di==null?Mn<=ae&&Si(Ri,er,!0,se):Mn>ae?Si(null,er,!0,se):Ri!=Di&&Si(Ri,er,!0,se)}}Nt&&(F.idx=x,zr()),y!==!1&&Ut("setCursor")}let fs=null;Object.defineProperty(s,"rect",{get(){return fs==null&&Or(!1),fs}});function Or(g=!1){g?fs=null:(fs=A.getBoundingClientRect(),Ut("syncRect",fs))}function fa(g,y,C,x,T,V,J){q._lock||hs&&g!=null&&g.movementX==0&&g.movementY==0||(uo(g,y,C,x,T,V,J,!1,g!=null),g!=null?bs(null,!0,!0):bs(y,!0,!1))}function uo(g,y,C,x,T,V,J,se,ae){if(fs==null&&Or(!1),Pn(g),g!=null)C=g.clientX-fs.left,x=g.clientY-fs.top;else{if(C<0||x<0){Ze=-10,ot=-10;return}let[me,we]=Tt.scales,_e=y.cursor.sync,[Ve,Je]=_e.values,[$e,He]=_e.scales,[ze,Pe]=Tt.match,at=y.axes[0].side%2==1,St=Q.ori==0?Le:ge,$t=Q.ori==1?Le:ge,st=at?V:T,Dt=at?T:V,Qn=at?x:C,dt=at?C:x;if($e!=null?C=ze(me,$e)?d(Ve,R[me],St,0):-10:C=St*(Qn/st),He!=null?x=Pe(we,He)?d(Je,R[we],$t,0):-10:x=$t*(dt/Dt),Q.ori==1){let vn=C;C=x,x=vn}}ae&&(y==null||y.cursor.event.type==jd)&&((C<=1||C>=Le-1)&&(C=Ur(C,Le)),(x<=1||x>=ge-1)&&(x=Ur(x,ge))),se?(ll=C,Er=x,[xs,Zs]=q.move(s,C,x)):(Ze=C,ot=x)}const dl={width:0,height:0,left:0,top:0};function hl(){_i(dl,!1)}let pa,ma,co,ga;function va(g,y,C,x,T,V,J){hs=!0,Ot=bt=tn._x=tn._y=!1,uo(g,y,C,x,T,V,J,!0,!1),g!=null&&(nt(Bd,oh,wa,!1),Tr(Pm,s,xs,Zs,Le,ge,null));let{left:se,top:ae,width:me,height:we}=lt;pa=se,ma=ae,co=me,ga=we}function wa(g,y,C,x,T,V,J){hs=tn._x=tn._y=!1,uo(g,y,C,x,T,V,J,!1,!0);let{left:se,top:ae,width:me,height:we}=lt,_e=me>0||we>0,Ve=pa!=se||ma!=ae||co!=me||ga!=we;if(_e&&Ve&&_i(lt),tn.setScale&&_e&&Ve){let Je=se,$e=me,He=ae,ze=we;if(Q.ori==1&&(Je=ae,$e=we,He=se,ze=me),Ot&&yi(G,oi(Je,G),oi(Je+$e,G)),bt)for(let Pe in R){let at=R[Pe];Pe!=G&&at.from==null&&at.min!=ft&&yi(Pe,oi(He+ze,Pe),oi(He,Pe))}hl()}else q.lock&&(q._lock=!q._lock,bs(y,!0,g!=null));g!=null&&(cn(Bd,oh),Tr(Bd,s,Ze,ot,Le,ge,null))}function _a(g,y,C,x,T,V,J){if(q._lock)return;Pn(g);let se=hs;if(hs){let ae=!0,me=!0,we=10,_e,Ve;Q.ori==0?(_e=Ot,Ve=bt):(_e=bt,Ve=Ot),_e&&Ve&&(ae=Ze<=we||Ze>=Le-we,me=ot<=we||ot>=ge-we),_e&&ae&&(Ze=Ze{let T=Tt.match[2];C=T(s,y,C),C!=-1&&Si(C,x,!0,!1)},Ie&&(nt(Pm,A,va),nt(jd,A,fa),nt(Am,A,g=>{Pn(g),Or(!1)}),nt(km,A,_a),nt(zm,A,ya),ph.add(s),s.syncRect=Or);const ho=s.hooks=r.hooks||{};function Ut(g,y,C){Ks?ri.push([g,y,C]):g in ho&&ho[g].forEach(x=>{x.call(null,s,y,C)})}(r.plugins||[]).forEach(g=>{for(let y in g.hooks)ho[y]=(ho[y]||[]).concat(g.hooks[y])});const Da=(g,y,C)=>C,Tt=Jt({key:null,setSeries:!1,filters:{pub:Fm,sub:Fm},scales:[G,O[1]?O[1].scale:null],match:[Hm,Hm,Da],values:[null,null]},q.sync);Tt.match.length==2&&Tt.match.push(Da),q.sync=Tt;const fo=Tt.key,Ps=Rv(fo);function Tr(g,y,C,x,T,V,J){Tt.filters.pub(g,y,C,x,T,V,J)&&Ps.pub(g,y,C,x,T,V,J)}Ps.sub(s);function Ca(g,y,C,x,T,V,J){Tt.filters.sub(g,y,C,x,T,V,J)&&tr[g](null,y,C,x,T,V,J)}s.pub=Ca;function xa(){Ps.unsub(s),ph.delete(s),Un.clear(),uh(Wu,Fo,Sa),m.remove(),Ee==null||Ee.remove(),Ut("destroy")}s.destroy=xa;function po(){Ut("init",r,e),la(e||r.data,!1),j[G]?Ti(G,j[G]):Sr(),cs=lt.show&&(lt.width>0||lt.height>0),gi=Nt=!0,ut(r.width,r.height)}return O.forEach(Ws),M.forEach(ra),n?n instanceof HTMLElement?(n.appendChild(m),po()):n(s,po):po(),s}jn.assign=Jt;jn.fmtNum=jh;jn.rangeNum=Fu;jn.rangeLog=ec;jn.rangeAsinh=Fh;jn.orient=qr;jn.pxRatio=tt;jn.join=Uy;jn.fmtDate=Uh,jn.tzDate=nS;jn.sync=Rv;{jn.addGap=VS,jn.clipGaps=ic;let r=jn.paths={points:Wv};r.linear=Hv,r.stepped=FS,r.bars=HS,r.spline=BS}const tD=6e3;class nD{constructor(e=tD){Tl(this,"t");Tl(this,"v");Tl(this,"len",0);Tl(this,"head",0);this.t=new Float64Array(e),this.v=new Float64Array(e)}push(e,n){const s=this.t.length;this.t[this.head]=e,this.v[this.head]=n,this.head=(this.head+1)%s,this.len=e&&(a[d]=this.t[m],c[d]=this.v[m],d++)}return{t:a.subarray(0,d),v:c.subarray(0,d)}}last(){if(this.len===0)return null;const e=this.t.length;return this.v[(this.head-1+e)%e]}}const gh=new Map;function iD(r){let e=gh.get(r);return e||(e=new nD,gh.set(r,e)),e}function $v(r,e){const n=iD(r);for(const[s,l]of e)n.push(s,l)}function Yv(r,e=-1/0){const n=gh.get(r);return n?n.read(e):{t:new Float64Array(0),v:new Float64Array(0)}}const Ho=new Map;let ku=[];function Kv(){ku.forEach(r=>r())}function sD(r){Ho.set(r,(Ho.get(r)||0)+1),Kv()}function rD(r){const e=(Ho.get(r)||0)-1;e<=0?Ho.delete(r):Ho.set(r,e),Kv()}function oD(){return Array.from(Ho.keys())}function lD(r){return ku.push(r),()=>{ku=ku.filter(e=>e!==r)}}const cg=3e3;let Vo=[],zu=[];function aD(r){r.length&&(Vo=Vo.concat(r),Vo.length>cg&&(Vo=Vo.slice(-cg)),zu.forEach(e=>e()))}function uD(){return Vo}function cD(r){return zu.push(r),()=>{zu=zu.filter(e=>e!==r)}}let Ou=0,Tu=[];function dg(r){Ou+=r?1:-1,Ou<0&&(Ou=0),Tu.forEach(e=>e())}function dD(){return Ou>0}function hD(r){return Tu.push(r),()=>{Tu=Tu.filter(e=>e!==r)}}let Qr=null,Jd=null;function fD(){return`${location.protocol==="https:"?"wss":"ws"}://${location.host}/api/monitor/stream`}function hg(){Qr&&Qr.readyState===WebSocket.OPEN&&Qr.send(JSON.stringify({type:"subscribe",signals:oD()}))}function fg(){Qr&&Qr.readyState===WebSocket.OPEN&&Qr.send(JSON.stringify({type:"raw",enabled:dD()}))}function Jv(){const r=new WebSocket(fD());Qr=r,r.onopen=()=>{Cn.getState().setConnected(!0),hg(),fg()},r.onclose=()=>{Cn.getState().setConnected(!1),Jd==null&&(Jd=window.setTimeout(()=>{Jd=null,Jv()},1e3))},r.onerror=()=>r.close(),r.onmessage=n=>{let s;try{s=JSON.parse(n.data)}catch{return}const l=Cn.getState();switch(s.type){case"meta":l.setMeta(s.signals,s.pairs),l.setMotors(s.motors);break;case"motors":l.setMotors(s.motors),s.status&&l.setStatus(s.status);break;case"samples":for(const[a,c]of Object.entries(s.data))$v(a,c);break;case"raw":aD(s.frames);break}};let e=null;lD(()=>{e==null&&(e=window.setTimeout(()=>{e=null,hg()},80))}),hD(fg)}async function pD(r,e=600){return r.length?(await fetch(`/api/monitor/snapshot?signals=${r.join(",")}&n=${e}`)).json():{}}async function mD(){try{return(await(await fetch("/api/monitor/motor-types")).json()).types||[]}catch{return[]}}async function gD(r,e){await fetch("/api/monitor/motor-type",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({motorId:r,motorType:e})})}const vD={pos:"#58a6ff",vel:"#3fb950",torque:"#d29922",kp:"#bc8cff",kd:"#f778ba",vel_limit:"#56d4dd",torque_limit:"#e3b341",t_mos:"#ff7b72",t_rotor:"#ffa657",status_code:"#8b949e"};function wD(r){return vD[r]||"#8b949e"}function Iu(r){const e=wD(r.field);return r.source==="cmd"?_D(e,.15):e}function vh(r){const e=r.split(":");return e.length>=3?`${e[1]} ${e[2]}`:r}function pg(r){return r.includes(":cmd.")}const mg=["pos","vel","torque","kp","kd","t_mos","t_rotor"];function _D(r,e){const n=r.replace("#",""),s=Math.min(255,Math.round(parseInt(n.slice(0,2),16)+255*e)),l=Math.min(255,Math.round(parseInt(n.slice(2,4),16)+255*e)),a=Math.min(255,Math.round(parseInt(n.slice(4,6),16)+255*e));return`rgb(${s},${l},${a})`}function Yo(r,e=3){return r==null||Number.isNaN(r)?"—":r.toFixed(e)}const gg=2e3;function yD(r,e){const n=r.map(c=>Yv(c,e)),s=new Set;for(const c of n)for(let d=0;dc-d);if(l.length>gg){const c=Math.ceil(l.length/gg);l=l.filter((d,h)=>h%c===0)}const a=[l];for(const c of n){const d=new Array(l.length).fill(null);let h=0,m=null;for(let w=0;wD.ensurePlot),n=Cn(D=>D.removeSignalFromPlot),s=Cn(D=>D.setPlotConfig),l=Cn(D=>D.plotConfigs[r]),a=Cn(D=>D.signals);B.useEffect(()=>{e(r)},[r,e]);const c=(l==null?void 0:l.signals)??[],d=(l==null?void 0:l.duration)??10,h=c.join("|"),{setNodeRef:m,isOver:w}=W_({id:`plot:${r}`,data:{panelId:r}}),v=B.useRef(null),S=B.useRef(null),E=B.useRef(0);B.useEffect(()=>{if(!v.current)return;const D=v.current,P=new Map(a.map(Z=>[Z.id,Z])),N=[{label:"t"},...c.map(Z=>{const G=P.get(Z),$=G?Iu(G):"#8b949e";return{label:vh(Z),stroke:$,width:1.5,dash:pg(Z)?[6,4]:void 0,points:{show:!1}}})],O={width:D.clientWidth||400,height:D.clientHeight||220,legend:{show:!1},series:N,cursor:{y:!1,points:{show:!0}},scales:{x:{time:!1}},axes:[{stroke:"#8b949e",grid:{stroke:"rgba(139,148,158,0.12)"},ticks:{stroke:"rgba(139,148,158,0.2)"},values:(Z,G)=>G.map($=>($-E.current).toFixed(1)+"s")},{stroke:"#8b949e",grid:{stroke:"rgba(139,148,158,0.12)"},ticks:{stroke:"rgba(139,148,158,0.2)"}}]},M=new jn(O,[[],...c.map(()=>[])],D);S.current=M;const R=new ResizeObserver(()=>{M.setSize({width:D.clientWidth,height:D.clientHeight})});return R.observe(D),()=>{R.disconnect(),M.destroy(),S.current=null}},[h,a.length]),B.useEffect(()=>{if(!c.length)return;c.forEach(sD);let D=!1;return pD(c,1200).then(P=>{if(!D)for(const[N,O]of Object.entries(P))$v(N,O)}),()=>{D=!0,c.forEach(rD)}},[h]),B.useEffect(()=>{let D=0;const P=()=>{const N=S.current;if(N&&c.length){let O=0;for(const R of c){const Z=Yv(R);Z.t.length&&(O=Math.max(O,Z.t[Z.t.length-1]))}E.current=O;const M=yD(c,O-d);N.setData(M,!1),N.setScale("x",{min:O-d,max:O})}D=requestAnimationFrame(P)};return D=requestAnimationFrame(P),()=>cancelAnimationFrame(D)},[h,d]);const A=B.useMemo(()=>new Map(a.map(D=>[D.id,D])),[a]);return Y.jsxs("div",{className:"panel plot-panel",ref:m,children:[Y.jsxs("div",{className:"plot-toolbar",children:[Y.jsx("span",{className:"muted",children:"window"}),Y.jsx("select",{value:d,onChange:D=>s(r,{duration:Number(D.target.value)}),children:[5,10,20,30,60].map(D=>Y.jsxs("option",{value:D,children:[D,"s"]},D))}),Y.jsx("div",{className:"legend",children:c.map(D=>{const P=A.get(D);return Y.jsxs("span",{className:"legend-chip",style:{borderColor:P?Iu(P):"#555"},children:[Y.jsx("span",{className:"legend-swatch",style:{background:P?Iu(P):"#555",borderStyle:pg(D)?"dashed":"solid"}}),vh(D),Y.jsx("button",{className:"legend-x",onClick:()=>n(r,D),children:"×"})]},D)})})]}),Y.jsx("div",{className:"plot-host"+(w?" drop-over":""),ref:v,children:c.length===0&&Y.jsx("div",{className:"drop-hint",children:"Drag signals here to plot — drop cmd onto fb to overlay"})})]})}const Qd=[["pos","cmd p"],["vel","cmd v"],["kp","kp"],["kd","kd"],["torque","cmd τ"]],Zd=[["pos","act p"],["vel","act v"],["torque","act τ"],["t_mos","Tmos"],["t_rotor","Trot"]];function DD(){const r=Cn(e=>e.motors);return Y.jsx("div",{className:"panel table-panel",children:Y.jsxs("table",{className:"motor-table",children:[Y.jsx("thead",{children:Y.jsxs("tr",{children:[Y.jsx("th",{children:"Motor"}),Y.jsx("th",{children:"Mode"}),Y.jsx("th",{children:"Status"}),Qd.map(([e,n])=>Y.jsx("th",{className:"cmd-col",children:n},"c"+e)),Zd.map(([e,n])=>Y.jsx("th",{children:n},"f"+e))]})}),Y.jsxs("tbody",{children:[r.length===0&&Y.jsx("tr",{children:Y.jsx("td",{colSpan:3+Qd.length+Zd.length,className:"muted center",children:"Waiting for traffic…"})}),r.map(e=>Y.jsxs("tr",{children:[Y.jsxs("td",{className:"mono",children:["m",e.motorId]}),Y.jsx("td",{className:"muted",children:e.mode||"—"}),Y.jsx("td",{children:Y.jsx("span",{className:"status-pill "+(e.status==="ENABLED"?"ok":e.status==="DISABLED"?"off":"warn"),children:e.status||"—"})}),Qd.map(([n])=>Y.jsx("td",{className:"mono cmd-col",children:Yo(e.cmd[n],n==="kp"?0:3)},"c"+n)),Zd.map(([n])=>Y.jsx("td",{className:"mono",children:Yo(e.fb[n],n.startsWith("t_")?1:3)},"f"+n))]},`${e.bus}:${e.motorId}`))]})]})})}function Xd({label:r,cmd:e,act:n,unit:s,digits:l=2}){return Y.jsxs("div",{className:"metric",children:[Y.jsxs("div",{className:"metric-label",children:[r," ",Y.jsx("span",{className:"muted",children:s})]}),Y.jsxs("div",{className:"metric-values",children:[Y.jsx("span",{className:"metric-act",children:Yo(n,l)}),e!==void 0&&Y.jsxs("span",{className:"metric-cmd",children:["⌖ ",Yo(e,l)]})]})]})}function CD(){const r=Cn(n=>n.motors),e=Cn(n=>n.motorTypes);return Y.jsxs("div",{className:"panel cards-panel",children:[r.length===0&&Y.jsx("div",{className:"muted center pad",children:"Waiting for traffic…"}),Y.jsx("div",{className:"cards-grid",children:r.map(n=>Y.jsxs("div",{className:"motor-card",children:[Y.jsxs("div",{className:"motor-card-head",children:[Y.jsxs("span",{className:"mono strong",children:["Motor ",n.motorId]}),Y.jsx("span",{className:"status-pill "+(n.status==="ENABLED"?"ok":n.status==="DISABLED"?"off":"warn"),children:n.status||"—"})]}),Y.jsxs("div",{className:"motor-card-sub",children:[Y.jsx("span",{className:"muted",children:n.mode||"—"}),e.length>0&&Y.jsxs("select",{className:"type-select",defaultValue:"",onChange:s=>s.target.value&&gD(n.motorId,s.target.value),title:"Override motor type used to scale this motor's values",children:[Y.jsx("option",{value:"",children:"set type…"}),e.map(s=>Y.jsx("option",{value:s,children:s},s))]})]}),Y.jsx(Xd,{label:"Position",unit:"rad",cmd:n.cmd.pos,act:n.fb.pos,digits:3}),Y.jsx(Xd,{label:"Velocity",unit:"rad/s",cmd:n.cmd.vel,act:n.fb.vel,digits:2}),Y.jsx(Xd,{label:"Torque",unit:"Nm",cmd:n.cmd.torque,act:n.fb.torque,digits:2}),Y.jsxs("div",{className:"temp-row",children:[Y.jsxs("span",{children:["MOS ",Yo(n.fb.t_mos,1),"°"]}),Y.jsxs("span",{children:["Rotor ",Yo(n.fb.t_rotor,1),"°"]})]})]},`${n.bus}:${n.motorId}`))})]})}function xD(r,e,n){const s=new Array(r);return new Proxy(s,{get(l,a,c){if(typeof a=="string"){const d=a.charCodeAt(0);if(d>=48&&d<=57){const h=+a;if(Number.isInteger(h)&&h>=0&&hs[w]!==m))&&(s=d,l=e(...d),n!=null&&n.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(l),a=!1),l}return c.updateDeps=d=>{s=d},c}function vg(r,e){if(r===void 0)throw new Error("Unexpected undefined");return r}const ED=(r,e)=>Math.abs(r-e)<1.01,bD=(r,e,n)=>{let s;return function(...l){r.clearTimeout(s),s=r.setTimeout(()=>e.apply(this,l),n)}};let Ml;const qd=()=>{if(Ml!==void 0)return Ml;if(typeof navigator>"u")return Ml=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Ml=!0;const r=navigator.maxTouchPoints;return Ml=navigator.platform==="MacIntel"&&r!==void 0&&r>0},wg=r=>{const{offsetWidth:e,offsetHeight:n}=r;return{width:e,height:n}},PD=r=>r,AD=r=>{const e=Math.max(r.startIndex-r.overscan,0),s=Math.min(r.endIndex+r.overscan,r.count-1)-e+1,l=new Array(s);for(let a=0;a{const n=r.scrollElement;if(!n)return;const s=r.targetWindow;if(!s)return;const l=c=>{const{width:d,height:h}=c;e({width:Math.round(d),height:Math.round(h)})};if(l(wg(n)),!s.ResizeObserver)return()=>{};const a=new s.ResizeObserver(c=>{const d=()=>{const h=c[0];if(h!=null&&h.borderBoxSize){const m=h.borderBoxSize[0];if(m){l({width:m.inlineSize,height:m.blockSize});return}}l(wg(n))};r.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(d):d()});return a.observe(n,{box:"border-box"}),()=>{a.unobserve(n)}},ju={passive:!0},zD=typeof window>"u"?!0:"onscrollend"in window,OD=(r,e,n)=>{const s=r.scrollElement;if(!s)return;const l=r.targetWindow;if(!l)return;const a=r.options.useScrollendEvent&&zD;let c=0;const d=a?null:bD(l,()=>e(c,!1),r.options.isScrollingResetDelay),h=v=>()=>{c=n(s),d==null||d(),e(c,v)},m=h(!0),w=h(!1);return s.addEventListener("scroll",m,ju),a&&s.addEventListener("scrollend",w,ju),()=>{s.removeEventListener("scroll",m),a&&s.removeEventListener("scrollend",w)}},TD=(r,e)=>OD(r,e,n=>{const{horizontal:s,isRtl:l}=r.options;return s?n.scrollLeft*(l&&-1||1):n.scrollTop}),ID=(r,e,n)=>{if(n.options.useCachedMeasurements){const s=n.indexFromElement(r),l=n.options.getItemKey(s);return n.itemSizeCache.get(l)??n.options.estimateSize(s)}if(e!=null&&e.borderBoxSize){const s=e.borderBoxSize[0];if(s)return Math.round(s[n.options.horizontal?"inlineSize":"blockSize"])}if(!e){const s=n.indexFromElement(r),l=n.options.getItemKey(s),a=n.itemSizeCache.get(l);if(a!==void 0)return a}return r[n.options.horizontal?"offsetWidth":"offsetHeight"]},RD=(r,{adjustments:e=0,behavior:n},s)=>{var l,a;(a=(l=s.scrollElement)==null?void 0:l.scrollTo)==null||a.call(l,{[s.options.horizontal?"left":"top"]:r+e,behavior:n})},ND=RD;class MD{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var n,s,l;return((l=(s=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:s.now)==null?void 0:l.call(s))??Date.now()},this.observer=(()=>{let n=null;const s=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(l=>{l.forEach(a=>{const c=()=>{const d=a.target,h=this.indexFromElement(d);if(!d.isConnected){this.observer.unobserve(d);for(const[m,w]of this.elementsCache)if(w===d){this.elementsCache.delete(m);break}return}this.shouldMeasureDuringScroll(h)&&this.resizeItem(h,this.options.measureElement(d,a,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(c):c()})}));return{disconnect:()=>{var l;(l=s())==null||l.disconnect(),n=null},observe:l=>{var a;return(a=s())==null?void 0:a.observe(l,{box:"border-box"})},unobserve:l=>{var a;return(a=s())==null?void 0:a.unobserve(l)}}})(),this.range=null,this.setOptions=n=>{var s,l;const a={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:PD,rangeExtractor:AD,onChange:()=>{},measureElement:ID,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const S in n){const E=n[S];E!==void 0&&(a[S]=E)}const c=this.options;let d=null,h=null,m=!1;if(c!==void 0&&c.enabled&&a.enabled&&a.anchorTo==="end"&&this.scrollElement!==null){const S=c.count,E=a.count,A=this.getMeasurements(),D=S>0?((s=A[0])==null?void 0:s.key)??c.getItemKey(0):null,P=S>0?((l=A[S-1])==null?void 0:l.key)??c.getItemKey(S-1):null;if(E!==S||S>0&&E>0&&(a.getItemKey(0)!==D||a.getItemKey(E-1)!==P)){m=!0;const M=S>0?this.getVirtualItemForOffset(this.getScrollOffset())??A[0]:null;M&&(d=[M.key,this.getScrollOffset()-M.start]);const R=a.followOnAppend===!0?"auto":a.followOnAppend||null;R&&E>S&&this.isAtEnd(c.scrollEndThreshold)&&(S===0||a.getItemKey(E-1)!==P)&&(h=R)}}this.options=a,m&&(this.pendingMin=0,this.itemSizeCacheVersion++);let w=!1,v=0;if(d&&this.scrollOffset!==null){const[S,E]=d,A=this.getMeasurements(),{count:D,getItemKey:P}=this.options;let N=0;for(;N{var s,l;(l=(s=this.options).onChange)==null||l.call(s,this,n)},this.maybeNotify=No(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}if(this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(a=>{this.observer.observe(a)}),this.unsubs.push(this.options.observeElementRect(this,a=>{this.scrollRect=a,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(a,c)=>{this._intendedScrollOffset!==null&&Math.abs(a-this._intendedScrollOffset)<1.5&&(a=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=c?this.getScrollOffset(){this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},d=()=>{this._iosTouching=!1,!(!qd()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};a.addEventListener("touchstart",c,ju),a.addEventListener("touchend",d,ju),this.unsubs.push(()=>{a.removeEventListener("touchstart",c),a.removeEventListener("touchend",d),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const l=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,l&&this.scrollElement&&this.options.enabled){const[a,c,d,h]=l;a!==null&&!d&&(qd()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?h!==0&&(this._iosDeferredAdjustment+=h):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),d&&this.scrollToEnd({behavior:d})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const n=this.getScrollOffset(),s=this.getMaxScrollOffset();if(n<0||n>s)return;const l=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(n,{adjustments:this.scrollAdjustments+=l,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,s)=>{const l=new Map,a=new Map;for(let c=s-1;c>=0;c--){const d=n[c];if(l.has(d.lane))continue;const h=a.get(d.lane);if(h==null||d.end>h.end?a.set(d.lane,d):d.endc.end===d.end?c.index-d.index:c.end-d.end)[0]:void 0},this.getMeasurementOptions=No(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(n,s,l,a,c,d,h)=>(this.prevLanes!==void 0&&this.prevLanes!==d&&(this.lanesChangedFlag=!0),this.prevLanes=d,this.pendingMin=null,{count:n,paddingStart:s,scrollMargin:l,getItemKey:a,enabled:c,lanes:d,laneAssignmentMode:h}),{key:!1}),this.getMeasurements=No(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:s,scrollMargin:l,getItemKey:a,enabled:c,lanes:d,laneAssignmentMode:h},m)=>{const w=this.itemSizeCache;if(!c)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const A of this.laneAssignments.keys())A>=n&&this.laneAssignments.delete(A);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(A=>{this.itemSizeCache.set(A.key,A.size)}));const v=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1),d===1){const A=this.options.gap,D=n*2;let P=this._flatMeasurements;if(!P||P.length0&&M.set(P.subarray(0,v*2)),P=M,this._flatMeasurements=P}let N;if(v===0)N=s+l;else{const M=v-1;N=P[M*2]+P[M*2+1]+A}for(let M=v;M1){N=P;const $=E[N],K=$!==void 0?S[$]:void 0;O=K?K.end+this.options.gap:s+l}else{const $=this.options.lanes===1?S[A-1]:this.getFurthestMeasurement(S,A);O=$?$.end+this.options.gap:s+l,N=$?$.lane:A%this.options.lanes,this.options.lanes>1&&M&&this.laneAssignments.set(A,N)}const R=w.get(D),Z=typeof R=="number"?R:this.options.estimateSize(A),G=O+Z;S[A]={index:A,start:O,size:Z,end:G,key:D,lane:N},E[N]=A}return this.measurementsCache=S,S},{key:!1,debug:()=>this.options.debug}),this.calculateRange=No(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,s,l,a)=>this.range=n.length>0&&s>0?LD({measurements:n,outerSize:s,scrollOffset:l,lanes:a,flat:a===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=No(()=>{let n=null,s=null;const l=this.calculateRange();return l&&(n=l.startIndex,s=l.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,s]},(n,s,l,a,c)=>a===null||c===null?[]:n({startIndex:a,endIndex:c,overscan:s,count:l}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const s=this.options.indexAttribute,l=n.getAttribute(s);return l?parseInt(l,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var s;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const l=this.scrollState.index??((s=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:s.index);if(l!==void 0&&this.range){const a=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),c=Math.max(0,l-a),d=Math.min(this.options.count-1,l+a);return n>=c&&n<=d}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((c,d)=>{c.isConnected||(this.observer.unobserve(c),this.elementsCache.delete(d))});return}const s=this.indexFromElement(n),l=this.options.getItemKey(s),a=this.elementsCache.get(l);a!==n&&(a&&this.observer.unobserve(a),this.observer.observe(n),this.elementsCache.set(l,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(s)&&this.resizeItem(s,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,s)=>{var l,a;if(n<0||n>=this.options.count)return;let c,d,h;const m=this._flatMeasurements;if(this.options.lanes===1&&m!==null)h=this.options.getItemKey(n),d=m[n*2],c=m[n*2+1];else{const S=this.measurementsCache[n];if(!S)return;h=S.key,d=S.start,c=S.size}const w=this.itemSizeCache.get(h)??c,v=s-w;if(v!==0){const S=this.options.anchorTo==="end"&&((l=this.scrollState)==null?void 0:l.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,E=S?this.getTotalSize():0,A=((a=this.scrollState)==null?void 0:a.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[n]??{index:n,key:h,start:d,size:c,end:d+c,lane:0},v,this):d[this.getVirtualIndexes(),this.getMeasurements()],(n,s)=>{const l=[];for(let a=0,c=n.length;athis.options.debug}),this.getVirtualItemForOffset=n=>{const s=this.getMeasurements();if(s.length===0)return;const l=this._flatMeasurements,a=this.options.lanes===1&&l!=null,c=Qv(0,s.length-1,a?d=>l[d*2]:d=>vg(s[d]).start,n);return vg(s[c])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(n=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=n,this.getOffsetForAlignment=(n,s,l=0)=>{if(!this.scrollElement)return 0;const a=this.getSize(),c=this.getScrollOffset();s==="auto"&&(s=n>=c+a?"end":"start"),s==="center"?n+=(l-a)/2:s==="end"&&(n-=a);const d=this.getMaxScrollOffset();return Math.max(Math.min(d,n),0)},this.getOffsetForIndex=(n,s="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const l=this.getSize(),a=this.getScrollOffset(),c=this.measurementsCache[n];if(!c)return;if(s==="auto")if(c.end>=a+l-this.options.scrollPaddingEnd)s="end";else if(c.start<=a+this.options.scrollPaddingStart)s="start";else return[a,s];if(s==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),s];const d=s==="end"?c.end+this.options.scrollPaddingEnd:c.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(d,s,c.size),s]},this.scrollToOffset=(n,{align:s="start",behavior:l="auto"}={})=>{const a=this.getOffsetForAlignment(n,s),c=this.now();this.scrollState={index:null,align:s,behavior:l,startedAt:c,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:l}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:s="auto",behavior:l="auto"}={})=>{n=Math.max(0,Math.min(n,this.options.count-1));const a=this.getOffsetForIndex(n,s);if(!a)return;const[c,d]=a,h=this.now();this.scrollState={index:n,align:d,behavior:l,startedAt:h,lastTargetOffset:c,stableFrames:0},this._scrollToOffset(c,{adjustments:void 0,behavior:l}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:s="auto"}={})=>{const l=this.getScrollOffset()+n,a=this.now();this.scrollState={index:null,align:"start",behavior:s,startedAt:a,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:n="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:n});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:n})},this.getTotalSize=()=>{var n;const s=this.getMeasurements();let l;if(s.length===0)l=this.options.paddingStart;else if(this.options.lanes===1){const a=s.length-1,c=this._flatMeasurements;c!=null?l=c[a*2]+c[a*2+1]:l=((n=s[a])==null?void 0:n.end)??0}else{const a=Array(this.options.lanes).fill(null);let c=s.length-1;for(;c>=0&&a.some(d=>d===null);){const d=s[c];a[d.lane]===null&&(a[d.lane]=d.end),c--}l=Math.max(...a.filter(d=>d!==null))}return Math.max(l-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const n=[];if(this.itemSizeCache.size===0)return n;const s=this.getMeasurements();for(const l of s)l&&this.itemSizeCache.has(l.key)&&n.push({index:l.index,key:l.key,start:l.start,size:l.size,end:l.end,lane:l.lane});return n},this._scrollToOffset=(n,{adjustments:s,behavior:l})=>{this._intendedScrollOffset=n+(s??0),this.options.scrollToFn(n,{behavior:l,adjustments:s},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,n){e!==0&&(qd()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=e:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:n}))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const s=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,l=s?s[0]:this.scrollState.lastTargetOffset,a=1,c=l!==this.scrollState.lastTargetOffset;if(!c&&ED(l,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=a){this.getScrollOffset()!==l&&this._scrollToOffset(l,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,c){const d=this.getSize()||600,h=Math.abs(l-this.getScrollOffset()),m=this.scrollState.behavior==="smooth"&&h>d;this.scrollState.lastTargetOffset=l,m||(this.scrollState.behavior="auto"),this._scrollToOffset(l,{adjustments:void 0,behavior:m?"smooth":"auto"})}this.scheduleScrollReconcile()}}const Qv=(r,e,n,s)=>{for(;r<=e;){const l=(r+e)/2|0,a=n(l);if(as)e=l-1;else return l}return r>0?r-1:0};function LD({measurements:r,outerSize:e,scrollOffset:n,lanes:s,flat:l}){const a=r.length-1,c=l?w=>l[w*2]:w=>r[w].start,d=l?w=>l[w*2]+l[w*2+1]:w=>r[w].end;if(r.length<=s)return{startIndex:0,endIndex:a};let h=Qv(0,a,c,n),m=h;if(s===1)for(;m1){const w=Array(s).fill(0);for(;mS=0&&v.some(S=>S>=n);){const S=r[h];v[S.lane]=S.start,h--}h=Math.max(0,h-h%s),m=Math.min(a,m+(s-1-m%s))}return{startIndex:h,endIndex:m}}const eh=typeof document<"u"?B.useLayoutEffect:B.useEffect;function VD({useFlushSync:r=!0,directDomUpdates:e=!1,directDomUpdatesMode:n="transform",...s}){const l=B.useReducer(m=>m+1,0)[1],a=B.useRef({enabled:e,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});a.current.enabled=e,a.current.mode=n;const c=m=>{const w=a.current;if(!w.enabled||!w.container)return;const v=m.getTotalSize();if(v!==w.lastSize){w.lastSize=v;const N=m.options.horizontal?"width":"height";w.container.style[N]=`${v}px`}const S=!!m.options.horizontal,E=w.mode==="transform",A=S?"left":"top",D=m.options.scrollMargin,P=m.getVirtualItems();for(const N of P){const O=N.start-D,M=m.elementsCache.get(N.key);M&&w.lastPositions.get(M)!==O&&(w.lastPositions.set(M,O),E?M.style.transform=S?`translate3d(${O}px, 0, 0)`:`translate3d(0, ${O}px, 0)`:M.style[A]=`${O}px`)}},d={...s,onChange:(m,w)=>{var v;const S=a.current;let E=!0;if(S.enabled){c(m);const A=m.range,D=S.prevRange;E=!D||D.isScrolling!==m.isScrolling||D.startIndex!==(A==null?void 0:A.startIndex)||D.endIndex!==(A==null?void 0:A.endIndex),E&&(S.prevRange=A?{startIndex:A.startIndex,endIndex:A.endIndex,isScrolling:m.isScrolling}:null)}E&&(r&&w?Kr.flushSync(l):l()),(v=s.onChange)==null||v.call(s,m,w)}},[h]=B.useState(()=>{const m=new MD(d);return Object.assign(m,{containerRef:w=>{const v=a.current;if(v.container=w,v.lastSize=null,w&&v.enabled){const S=m.getTotalSize();v.lastSize=S;const E=m.options.horizontal?"width":"height";w.style[E]=`${S}px`}}})});return h.setOptions(d),eh(()=>h._didMount(),[]),eh(()=>h._willUpdate()),eh(()=>{c(h)}),h}function GD(r){return VD({observeElementRect:kD,observeElementOffset:TD,scrollToFn:ND,...r})}const WD={pos:"p",vel:"v",torque:"τ",kp:"kp",kd:"kd",vel_limit:"vlim",torque_limit:"τlim",t_mos:"Tm",t_rotor:"Tr"},FD=["pos","vel","torque","kp","kd","t_mos","t_rotor"];function HD(r){const e=[];for(const n of FD)n in r.fields&&e.push(`${WD[n]||n} ${r.fields[n].toFixed(2)}`);return e.join(" ")||r.note||""}function jD(r){const e=new Date(r*1e3),n=String(e.getHours()).padStart(2,"0"),s=String(e.getMinutes()).padStart(2,"0"),l=String(e.getSeconds()).padStart(2,"0"),a=String(Math.floor(r%1*1e3)).padStart(3,"0");return`${n}:${s}:${l}.${a}`}function BD(){const[,r]=B.useState(0),[e,n]=B.useState(!1),s=B.useRef(null),l=B.useRef([]);B.useEffect(()=>{dg(!0);const d=cD(()=>{e||(l.current=uD(),r(h=>h+1))});return()=>{dg(!1),d()}},[e]);const a=l.current,c=GD({count:a.length,getScrollElement:()=>s.current,estimateSize:()=>22,overscan:12});return B.useEffect(()=>{!e&&a.length&&c.scrollToIndex(a.length-1)},[a.length,e,c]),Y.jsxs("div",{className:"panel rawlog-panel",children:[Y.jsxs("div",{className:"rawlog-toolbar",children:[Y.jsx("button",{className:e?"btn small":"btn small active",onClick:()=>n(d=>!d),children:e?"Resume":"Pause"}),Y.jsxs("span",{className:"muted",children:[a.length," frames"]})]}),Y.jsxs("div",{className:"rawlog-body",ref:s,children:[Y.jsxs("div",{className:"rawlog-head",children:[Y.jsx("span",{className:"c-t",children:"time"}),Y.jsx("span",{className:"c-arb",children:"arb"}),Y.jsx("span",{className:"c-m",children:"motor"}),Y.jsx("span",{className:"c-k",children:"kind"}),Y.jsx("span",{className:"c-f",children:"decoded"}),Y.jsx("span",{className:"c-r",children:"raw"})]}),Y.jsx("div",{style:{height:c.getTotalSize(),position:"relative"},children:c.getVirtualItems().map(d=>{const h=a[d.index];return Y.jsxs("div",{className:"rawlog-row k-"+h.kind,style:{transform:`translateY(${d.start}px)`},children:[Y.jsx("span",{className:"c-t mono",children:jD(h.t)}),Y.jsxs("span",{className:"c-arb mono",children:["0x",h.arb.toString(16).toUpperCase()]}),Y.jsxs("span",{className:"c-m mono",children:["m",h.motorId]}),Y.jsx("span",{className:"c-k",children:h.mode||h.kind}),Y.jsx("span",{className:"c-f mono",children:HD(h)}),Y.jsx("span",{className:"c-r mono dim",children:h.raw})]},h.seq)})})]})]})}const Xh=[{kind:"plot",title:"Plot",icon:"〜",description:"Time-series chart; drag signals onto it (cmd over fb to overlay).",render:r=>Y.jsx(SD,{panelId:r})},{kind:"table",title:"Motor Table",icon:"▦",description:"One row per motor: commanded vs actual.",render:()=>Y.jsx(DD,{})},{kind:"cards",title:"Motor Cards",icon:"▢",description:"Per-motor cards/gauges with big readouts.",render:()=>Y.jsx(CD,{})},{kind:"rawlog",title:"Raw CAN Log",icon:"≣",description:"Scrolling decoded frame log.",render:()=>Y.jsx(BD,{})}],UD=Object.fromEntries(Xh.map(r=>[r.kind,r])),$D=Object.fromEntries(Xh.map(r=>[r.kind,e=>r.render(e.api.id)]));let wh=null;const yu={};function YD(r){wh=r}function KD(r){if(!wh)return;const e=UD[r];if(!e)return;yu[r]=(yu[r]||0)+1;const n=`${r}-${Date.now().toString(36)}-${yu[r]}`;wh.addPanel({id:n,component:r,title:`${e.title} ${yu[r]}`})}function JD(){const r=Cn(s=>s.connected),e=Cn(s=>s.status),n=()=>{localStorage.removeItem("damiao.monitor.layout"),localStorage.removeItem("damiao.monitor.plotConfigs"),location.reload()};return Y.jsxs("header",{className:"toolbar",children:[Y.jsxs("div",{className:"brand",children:[Y.jsx("span",{className:"brand-dot"}),"DaMiao ",Y.jsx("span",{className:"brand-sub",children:"Passive Monitor"})]}),Y.jsxs("div",{className:"conn",children:[Y.jsx("span",{className:"dot "+(r?"on":"off")}),Y.jsx("span",{className:"mono",children:e!=null&&e.demo?"demo":(e==null?void 0:e.channel)||"—"}),e&&!e.demo&&Y.jsx("span",{className:"badge "+(e.listenOnly?"ok":"warn"),title:"hardware listen-only",children:e.listenOnly?"listen-only":"rx (no TX)"}),(e==null?void 0:e.error)&&Y.jsx("span",{className:"badge err",title:e.error,children:"bus error"}),e&&Y.jsxs("span",{className:"muted small",children:[e.framesSeen.toLocaleString()," frames · +",e.feedbackOffset," fb"]})]}),Y.jsx("div",{className:"spacer"}),Y.jsxs("div",{className:"actions",children:[Xh.map(s=>Y.jsxs("button",{className:"btn",title:s.description,onClick:()=>KD(s.kind),children:[Y.jsx("span",{className:"btn-icon",children:s.icon})," ",s.title]},s.kind)),Y.jsx("button",{className:"btn ghost",onClick:n,children:"Reset"})]})]})}function QD({sig:r}){const{attributes:e,listeners:n,setNodeRef:s,isDragging:l}=M_({id:`sig:${r.id}`,data:{signalId:r.id}}),a=Iu(r);return Y.jsxs("div",{ref:s,className:"sig-chip"+(l?" dragging":""),...n,...e,title:r.id,children:[Y.jsx("span",{className:"sig-swatch",style:{background:a,borderStyle:r.source==="cmd"?"dashed":"solid"}}),Y.jsxs("span",{className:"sig-name",children:[r.source,".",r.field]}),r.unit&&Y.jsx("span",{className:"sig-unit",children:r.unit})]})}function ZD(r){return[...r].sort((e,n)=>{if(e.source!==n.source)return e.source==="cmd"?-1:1;const s=mg.indexOf(e.field),l=mg.indexOf(n.field);return(s<0?99:s)-(l<0?99:l)})}function XD(){const r=Cn(a=>a.signals),e=Cn(a=>a.status),[n,s]=B.useState(""),l=B.useMemo(()=>{const a=new Map;for(const c of r){if(n&&!c.id.toLowerCase().includes(n.toLowerCase()))continue;const d=a.get(c.motorId)||[];d.push(c),a.set(c.motorId,d)}return Array.from(a.entries()).sort((c,d)=>c[0]-d[0])},[r,n]);return Y.jsxs("aside",{className:"sidebar",children:[Y.jsxs("div",{className:"sidebar-head",children:[Y.jsx("div",{className:"sidebar-title",children:"Signals"}),Y.jsx("input",{className:"filter",placeholder:"filter…",value:n,onChange:a=>s(a.target.value)})]}),Y.jsxs("div",{className:"sidebar-body",children:[l.length===0&&Y.jsx("div",{className:"muted pad",children:e!=null&&e.error?"Bus error — see top bar.":"No signals yet. Start a controller on the bus (or run --demo)."}),l.map(([a,c])=>Y.jsxs("div",{className:"motor-group",children:[Y.jsxs("div",{className:"motor-group-title",children:["Motor ",a]}),Y.jsx("div",{className:"chips",children:ZD(c).map(d=>Y.jsx(QD,{sig:d},d.id))})]},a))]}),Y.jsxs("div",{className:"sidebar-foot muted",children:["Drag a signal onto a plot. Drop ",Y.jsx("b",{children:"cmd"})," onto its ",Y.jsx("b",{children:"fb"})," plot to overlay."]})]})}class Zv{}class _r extends Zv{constructor(e,n,s){super(),this.viewId=e,this.groupId=n,this.panelId=s}}class Yl extends Zv{constructor(e,n){super(),this.viewId=e,this.paneId=n}}class Ds{constructor(){}static getInstance(){return Ds.INSTANCE}hasData(e){return e&&e===this.proto}clearData(e){this.hasData(e)&&(this.proto=void 0,this.data=void 0)}getData(e){if(this.hasData(e))return this.data}setData(e,n){n&&(this.data=e,this.proto=n)}}Ds.INSTANCE=new Ds;function Hn(){const r=Ds.getInstance();if(r.hasData(_r.prototype))return r.getData(_r.prototype)[0]}function Ll(){const r=Ds.getInstance();if(r.hasData(Yl.prototype))return r.getData(Yl.prototype)[0]}var Zr;(function(r){r.any=(...e)=>n=>{const s=e.map(l=>l(n));return{dispose:()=>{s.forEach(l=>{l.dispose()})}}}})(Zr||(Zr={}));class qh{constructor(){this._defaultPrevented=!1}get defaultPrevented(){return this._defaultPrevented}preventDefault(){this._defaultPrevented=!0}}class Xv{constructor(){this._isAccepted=!1}get isAccepted(){return this._isAccepted}accept(){this._isAccepted=!0}}class qD{constructor(){this.events=new Map}get size(){return this.events.size}add(e,n){this.events.set(e,n)}delete(e){this.events.delete(e)}clear(){this.events.clear()}}class Bu{static create(){var e;return new Bu((e=new Error().stack)!==null&&e!==void 0?e:"")}constructor(e){this.value=e}print(){console.warn("dockview: stacktrace",this.value)}}class eC{constructor(e,n){this.callback=e,this.stacktrace=n}}class U{static setLeakageMonitorEnabled(e){e!==U.ENABLE_TRACKING&&U.MEMORY_LEAK_WATCHER.clear(),U.ENABLE_TRACKING=e}get value(){return this._last}constructor(e){this.options=e,this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=e=>{var n;!((n=this.options)===null||n===void 0)&&n.replay&&this._last!==void 0&&e(this._last);const s=new eC(e,U.ENABLE_TRACKING?Bu.create():void 0);return this._listeners.push(s),{dispose:()=>{const l=this._listeners.indexOf(s);l>-1&&this._listeners.splice(l,1)}}},U.ENABLE_TRACKING&&U.MEMORY_LEAK_WATCHER.add(this._event,Bu.create())),this._event}fire(e){var n;!((n=this.options)===null||n===void 0)&&n.replay&&(this._last=e);for(const s of this._listeners)s.callback(e)}dispose(){this._disposed||(this._disposed=!0,this._listeners.length>0&&(U.ENABLE_TRACKING&&queueMicrotask(()=>{var e;for(const n of this._listeners)console.warn("dockview: stacktrace",(e=n.stacktrace)===null||e===void 0?void 0:e.print())}),this._listeners=[]),U.ENABLE_TRACKING&&this._event&&U.MEMORY_LEAK_WATCHER.delete(this._event))}}U.ENABLE_TRACKING=!1;U.MEMORY_LEAK_WATCHER=new qD;function Be(r,e,n,s){return r.addEventListener(e,n,s),{dispose:()=>{r.removeEventListener(e,n,s)}}}class _g{constructor(){this._onFired=new U,this._currentFireCount=0,this._queued=!1,this.onEvent=e=>{const n=this._currentFireCount;return this._onFired.event(()=>{this._currentFireCount>n&&e()})}}fire(){this._currentFireCount++,!this._queued&&(this._queued=!0,queueMicrotask(()=>{this._queued=!1,this._onFired.fire()}))}dispose(){this._onFired.dispose()}}var Qt;(function(r){r.NONE={dispose:()=>{}};function e(n){return{dispose:()=>{n()}}}r.from=e})(Qt||(Qt={}));class Ne{get isDisposed(){return this._isDisposed}constructor(...e){this._isDisposed=!1,this._disposables=e}addDisposables(...e){e.forEach(n=>this._disposables.push(n))}dispose(){this._isDisposed||(this._isDisposed=!0,this._disposables.forEach(e=>e.dispose()),this._disposables=[])}}class Bn{constructor(){this._disposable=Qt.NONE}set value(e){this._disposable&&this._disposable.dispose(),this._disposable=e}dispose(){this._disposable&&(this._disposable.dispose(),this._disposable=Qt.NONE)}}class tC extends Ne{constructor(e){super(),this._onDidChange=new U,this.onDidChange=this._onDidChange.event,this._value=null,this.addDisposables(this._onDidChange,lc(e,n=>{const s=n.target.scrollWidth>n.target.clientWidth,l=n.target.scrollHeight>n.target.clientHeight;this._value={hasScrollX:s,hasScrollY:l},this._onDidChange.fire(this._value)}))}}function lc(r,e){const n=new ResizeObserver(s=>{requestAnimationFrame(()=>{const l=s[0];e(l)})});return n.observe(r),{dispose:()=>{n.unobserve(r),n.disconnect()}}}const Xl=(r,...e)=>{for(const n of e)r.classList.contains(n)&&r.classList.remove(n)},ac=(r,...e)=>{for(const n of e)r.classList.contains(n)||r.classList.add(n)},Re=(r,e,n)=>{const s=r.classList.contains(e);n&&!s&&r.classList.add(e),!n&&s&&r.classList.remove(e)};function _h(r,e){for(;r;){if(r===e)return!0;r=r.parentNode}return!1}function qv(r){return new nC(r)}class nC extends Ne{constructor(e){super(),this._onDidFocus=new U,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new U,this.onDidBlur=this._onDidBlur.event,this.addDisposables(this._onDidFocus,this._onDidBlur);let n=_h(document.activeElement,e),s=!1;const l=()=>{s=!1,n||(n=!0,this._onDidFocus.fire())},a=()=>{n&&(s=!0,window.setTimeout(()=>{s&&(s=!1,n=!1,this._onDidBlur.fire())},0))};this._refreshStateHandler=()=>{_h(document.activeElement,e)!==n&&(n?a():l())},this.addDisposables(Be(e,"focus",l,!0)),this.addDisposables(Be(e,"blur",a,!0))}refreshState(){this._refreshStateHandler()}}const ew="dv-quasiPreventDefault";function iC(r){r[ew]=!0}function yg(r){return r[ew]}function sC(r,e){const n=Array.from(e);for(const s of n){if(s.href){const a=r.createElement("link");a.href=s.href,a.type=s.type,a.rel="stylesheet",r.head.appendChild(a)}let l=[];try{s.cssRules&&(l=Array.from(s.cssRules).map(a=>a.cssText))}catch{}for(const a of l){const c=r.createElement("style");c.appendChild(r.createTextNode(a)),r.head.appendChild(c)}}}function yh(r){const{left:e,top:n,width:s,height:l}=r.getBoundingClientRect();return{left:e+window.scrollX,top:n+window.scrollY,width:s,height:l}}function rC(r){let e=r;for(;e!=null&&e.parentNode;){if(e.parentNode===document)return!0;e.parentNode instanceof DocumentFragment?e=e.parentNode.host:e=e.parentNode}return!1}function oC(r,e){r.setAttribute("data-testid",e)}function lC(r){const e=[];function n(s){if(s.nodeType===Node.ELEMENT_NODE){r.includes(s.tagName)&&e.push(s),s.shadowRoot&&n(s.shadowRoot);for(const l of s.children)n(l)}}return n(document.documentElement),e}function Uu(r=document){const e=lC(["IFRAME","WEBVIEW"]),n=new WeakMap;for(const s of e)n.set(s,s.style.pointerEvents),s.style.pointerEvents="none";return{release:()=>{var s;for(const l of e)l.style.pointerEvents=(s=n.get(l))!==null&&s!==void 0?s:"auto";e.splice(0,e.length)}}}function aC(r){function e(l){const a=[];for(let c=0;cl.startsWith("dockview-theme-")),typeof n!="string");)s=s.parentElement;return n}class uc{constructor(e){this.element=e,this._classNames=[]}setClassNames(e){for(const n of this._classNames)Re(this.element,n,!1);this._classNames=e.split(" ").filter(n=>n.trim().length>0);for(const n of this._classNames)Re(this.element,n,!0)}}const tw=100;function uC(r,e){const n=yh(r),s=yh(e);return!(n.lefts.left+s.width)}function cC(r){const e=new U;let n=r.screenX,s=r.screenY,l;const a=()=>{if(r.closed)return;const c=r.screenX,d=r.screenY;(c!==n||d!==s)&&(clearTimeout(l),l=setTimeout(()=>{e.fire()},tw),n=c,s=d),requestAnimationFrame(a)};return a(),e}function dC(r,e){let n;return new Ne(Be(r,"resize",()=>{clearTimeout(n),n=setTimeout(()=>{e()},tw)}))}function hC(r,e,n={buffer:10}){const s=n.buffer,l=r.getBoundingClientRect(),a=e.getBoundingClientRect();let c=0,d=0;const h=l.left-a.left,m=l.top-a.top,w=l.bottom-a.bottom,v=l.right-a.right;hs&&(c=-s-v),ms&&(d=-w-s),(c!==0||d!==0)&&(r.style.transform=`translate(${c}px, ${d}px)`)}function fC(r){let e=r;for(;e&&(e.style.zIndex==="auto"||e.style.zIndex==="");)e=e.parentElement;return e}function Ms(r){if(r.length===0)throw new Error("Invalid tail call");return[r.slice(0,r.length-1),r[r.length-1]]}function nw(r,e){if(r.length!==e.length)return!1;for(let n=0;n-1&&(r.splice(n,1),r.unshift(e))}function Su(r,e){const n=r.indexOf(e);n>-1&&(r.splice(n,1),r.push(e))}function pC(r,e){for(let n=0;ns===e);return n>-1?(r.splice(n,1),!0):!1}const _t=(r,e,n)=>e>n?e:Math.min(n,Math.max(r,e)),ef=()=>{let r=1;return{next:()=>(r++).toString()}},ts=(r,e)=>{const n=[];if(typeof e!="number"&&(e=r,r=0),r<=e)for(let s=r;se;s--)n.push(s);return n};class mC{set size(e){this._size=e}get size(){return this._size}get cachedVisibleSize(){return this._cachedVisibleSize}get visible(){return typeof this._cachedVisibleSize>"u"}get minimumSize(){return this.visible?this.view.minimumSize:0}get viewMinimumSize(){return this.view.minimumSize}get maximumSize(){return this.visible?this.view.maximumSize:0}get viewMaximumSize(){return this.view.maximumSize}get priority(){return this.view.priority}get snap(){return!!this.view.snap}set enabled(e){this.container.style.pointerEvents=e?"":"none"}constructor(e,n,s,l){this.container=e,this.view=n,this.disposable=l,this._cachedVisibleSize=void 0,typeof s=="number"?(this._size=s,this._cachedVisibleSize=void 0,e.classList.add("visible")):(this._size=0,this._cachedVisibleSize=s.cachedVisibleSize)}setVisible(e,n){var s;e!==this.visible&&(e?(this.size=_t((s=this._cachedVisibleSize)!==null&&s!==void 0?s:0,this.viewMinimumSize,this.viewMaximumSize),this._cachedVisibleSize=void 0):(this._cachedVisibleSize=typeof n=="number"?n:this.size,this.size=0),this.container.classList.toggle("visible",e),this.view.setVisible&&this.view.setVisible(e))}dispose(){return this.disposable.dispose(),this.view}}var ke;(function(r){r.HORIZONTAL="HORIZONTAL",r.VERTICAL="VERTICAL"})(ke||(ke={}));var ji;(function(r){r[r.MAXIMUM=0]="MAXIMUM",r[r.MINIMUM=1]="MINIMUM",r[r.DISABLED=2]="DISABLED",r[r.ENABLED=3]="ENABLED"})(ji||(ji={}));var on;(function(r){r.Low="low",r.High="high",r.Normal="normal"})(on||(on={}));var $i;(function(r){r.Distribute={type:"distribute"};function e(s){return{type:"split",index:s}}r.Split=e;function n(s){return{type:"invisible",cachedVisibleSize:s}}r.Invisible=n})($i||($i={}));class ql{get contentSize(){return this._contentSize}get size(){return this._size}set size(e){this._size=e}get orthogonalSize(){return this._orthogonalSize}set orthogonalSize(e){this._orthogonalSize=e}get length(){return this.viewItems.length}get proportions(){return this._proportions?[...this._proportions]:void 0}get orientation(){return this._orientation}set orientation(e){this._orientation=e;const n=this.size;this.size=this.orthogonalSize,this.orthogonalSize=n,Xl(this.element,"dv-horizontal","dv-vertical"),this.element.classList.add(this.orientation==ke.HORIZONTAL?"dv-horizontal":"dv-vertical")}get minimumSize(){return this.viewItems.reduce((e,n)=>e+n.minimumSize,0)}get maximumSize(){return this.length===0?Number.POSITIVE_INFINITY:this.viewItems.reduce((e,n)=>e+n.maximumSize,0)}get startSnappingEnabled(){return this._startSnappingEnabled}set startSnappingEnabled(e){this._startSnappingEnabled!==e&&(this._startSnappingEnabled=e,this.updateSashEnablement())}get endSnappingEnabled(){return this._endSnappingEnabled}set endSnappingEnabled(e){this._endSnappingEnabled!==e&&(this._endSnappingEnabled=e,this.updateSashEnablement())}get disabled(){return this._disabled}set disabled(e){this._disabled=e,Re(this.element,"dv-splitview-disabled",e)}get margin(){return this._margin}set margin(e){this._margin=e,Re(this.element,"dv-splitview-has-margin",e!==0)}constructor(e,n){var s,l;this.container=e,this.viewItems=[],this.sashes=[],this._size=0,this._orthogonalSize=0,this._contentSize=0,this._proportions=void 0,this._startSnappingEnabled=!0,this._endSnappingEnabled=!0,this._disabled=!1,this._margin=0,this._onDidSashEnd=new U,this.onDidSashEnd=this._onDidSashEnd.event,this._onDidAddView=new U,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new U,this.onDidRemoveView=this._onDidRemoveView.event,this.resize=(a,c,d=this.viewItems.map(A=>A.size),h,m,w=Number.NEGATIVE_INFINITY,v=Number.POSITIVE_INFINITY,S,E)=>{if(a<0||a>this.viewItems.length)return 0;const A=ts(a,-1),D=ts(a+1,this.viewItems.length);if(m)for(const j of m)th(A,j),th(D,j);if(h)for(const j of h)Su(A,j),Su(D,j);const P=A.map(j=>this.viewItems[j]),N=A.map(j=>d[j]),O=D.map(j=>this.viewItems[j]),M=D.map(j=>d[j]),R=A.reduce((j,te)=>j+this.viewItems[te].minimumSize-d[te],0),Z=A.reduce((j,te)=>j+this.viewItems[te].maximumSize-d[te],0),G=D.length===0?Number.POSITIVE_INFINITY:D.reduce((j,te)=>j+d[te]-this.viewItems[te].minimumSize,0),$=D.length===0?Number.NEGATIVE_INFINITY:D.reduce((j,te)=>j+d[te]-this.viewItems[te].maximumSize,0),K=Math.max(R,$),he=Math.min(G,Z);let ue=!1;if(S){const j=this.viewItems[S.index],te=c>=S.limitDelta;ue=te!==j.visible,j.setVisible(te,S.size)}if(!ue&&E){const j=this.viewItems[E.index],te=c{const d=a.visible===void 0||a.visible?a.size:{type:"invisible",cachedVisibleSize:a.size},h=a.view;this.addView(h,d,c,!0)}),this._contentSize=this.viewItems.reduce((a,c)=>a+c.size,0),this.saveProportions())}style(e){(e==null?void 0:e.separatorBorder)==="transparent"?(Xl(this.element,"dv-separator-border"),this.element.style.removeProperty("--dv-separator-border")):(ac(this.element,"dv-separator-border"),e!=null&&e.separatorBorder&&this.element.style.setProperty("--dv-separator-border",e.separatorBorder))}isViewVisible(e){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");return this.viewItems[e].visible}setViewVisible(e,n){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");const s=this.viewItems[e];s.setVisible(n,s.size),this.distributeEmptySpace(e),this.layoutViews(),this.saveProportions()}getViewSize(e){return e<0||e>=this.viewItems.length?-1:this.viewItems[e].size}resizeView(e,n){if(e<0||e>=this.viewItems.length)return;const s=ts(this.viewItems.length).filter(d=>d!==e),l=[...s.filter(d=>this.viewItems[d].priority===on.Low),e],a=s.filter(d=>this.viewItems[d].priority===on.High),c=this.viewItems[e];n=Math.round(n),n=_t(n,c.minimumSize,Math.min(c.maximumSize,this._size)),c.size=n,this.relayout(l,a)}getViews(){return this.viewItems.map(e=>e.view)}onDidChange(e,n){const s=this.viewItems.indexOf(e);if(s<0||s>=this.viewItems.length)return;n=typeof n=="number"?n:e.size,n=_t(n,e.minimumSize,e.maximumSize),e.size=n;const l=ts(this.viewItems.length).filter(d=>d!==s),a=[...l.filter(d=>this.viewItems[d].priority===on.Low),s],c=l.filter(d=>this.viewItems[d].priority===on.High);this.relayout([...a,s],c)}addView(e,n={type:"distribute"},s=this.viewItems.length,l){const a=document.createElement("div");a.className="dv-view",a.appendChild(e.element);let c;typeof n=="number"?c=n:n.type==="split"?c=this.getViewSize(n.index)/2:n.type==="invisible"?c={cachedVisibleSize:n.cachedVisibleSize}:c=e.minimumSize;const d=e.onDidChange(m=>this.onDidChange(h,m.size)),h=new mC(a,e,c,{dispose:()=>{d.dispose(),this.viewContainer.removeChild(a)}});if(s===this.viewItems.length?this.viewContainer.appendChild(a):this.viewContainer.insertBefore(a,this.viewContainer.children.item(s)),this.viewItems.splice(s,0,h),this.viewItems.length>1){const m=document.createElement("div");m.className="dv-sash";const w=S=>{for(const j of this.viewItems)j.enabled=!1;const E=Uu(),A=this._orientation===ke.HORIZONTAL?S.clientX:S.clientY,D=pC(this.sashes,j=>j.container===m),P=this.viewItems.map(j=>j.size);let N,O;const M=ts(D,-1),R=ts(D+1,this.viewItems.length),Z=M.reduce((j,te)=>j+(this.viewItems[te].minimumSize-P[te]),0),G=M.reduce((j,te)=>j+(this.viewItems[te].viewMaximumSize-P[te]),0),$=R.length===0?Number.POSITIVE_INFINITY:R.reduce((j,te)=>j+(P[te]-this.viewItems[te].minimumSize),0),K=R.length===0?Number.NEGATIVE_INFINITY:R.reduce((j,te)=>j+(P[te]-this.viewItems[te].viewMaximumSize),0),he=Math.max(Z,K),ue=Math.min($,G),Q=this.findFirstSnapIndex(M),ve=this.findFirstSnapIndex(R);if(typeof Q=="number"){const j=this.viewItems[Q],te=Math.floor(j.viewMinimumSize/2);N={index:Q,limitDelta:j.visible?he-te:he+te,size:j.size}}if(typeof ve=="number"){const j=this.viewItems[ve],te=Math.floor(j.viewMinimumSize/2);O={index:ve,limitDelta:j.visible?ue+te:ue-te,size:j.size}}const ie=j=>{const X=(this._orientation===ke.HORIZONTAL?j.clientX:j.clientY)-A;this.resize(D,X,P,void 0,void 0,he,ue,N,O),this.distributeEmptySpace(),this.layoutViews()},ce=()=>{for(const j of this.viewItems)j.enabled=!0;E.release(),this.saveProportions(),document.removeEventListener("pointermove",ie),document.removeEventListener("pointerup",ce),document.removeEventListener("pointercancel",ce),document.removeEventListener("contextmenu",ce),this._onDidSashEnd.fire(void 0)};document.addEventListener("pointermove",ie),document.addEventListener("pointerup",ce),document.addEventListener("pointercancel",ce),document.addEventListener("contextmenu",ce)};m.addEventListener("pointerdown",w);const v={container:m,disposable:()=>{m.removeEventListener("pointerdown",w),this.sashContainer.removeChild(m)}};this.sashContainer.appendChild(m),this.sashes.push(v)}l||this.relayout([s]),!l&&typeof n!="number"&&n.type==="distribute"&&this.distributeViewSizes(),this._onDidAddView.fire(e)}distributeViewSizes(){const e=[];let n=0;for(const d of this.viewItems)d.maximumSize-d.minimumSize>0&&(e.push(d),n+=d.size);const s=Math.floor(n/e.length);for(const d of e)d.size=_t(s,d.minimumSize,d.maximumSize);const l=ts(this.viewItems.length),a=l.filter(d=>this.viewItems[d].priority===on.Low),c=l.filter(d=>this.viewItems[d].priority===on.High);this.relayout(a,c)}removeView(e,n,s=!1){const l=this.viewItems.splice(e,1)[0];if(l.dispose(),this.viewItems.length>=1){const a=Math.max(e-1,0);this.sashes.splice(a,1)[0].disposable()}return s||this.relayout(),n&&n.type==="distribute"&&this.distributeViewSizes(),this._onDidRemoveView.fire(l.view),l.view}getViewCachedVisibleSize(e){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");return this.viewItems[e].cachedVisibleSize}moveView(e,n){const s=this.getViewCachedVisibleSize(e),l=typeof s>"u"?this.getViewSize(e):$i.Invisible(s),a=this.removeView(e,void 0,!0);this.addView(a,l,n)}layout(e,n){const s=Math.max(this.size,this._contentSize);if(this.size=e,this.orthogonalSize=n,this.proportions){let l=0;for(let a=0;a0&&(c.size=_t(Math.round(d*e/l),c.minimumSize,c.maximumSize))}}else{const l=ts(this.viewItems.length),a=l.filter(d=>this.viewItems[d].priority===on.Low),c=l.filter(d=>this.viewItems[d].priority===on.High);this.resize(this.viewItems.length-1,e-s,void 0,a,c)}this.distributeEmptySpace(),this.layoutViews()}relayout(e,n){const s=this.viewItems.reduce((l,a)=>l+a.size,0);this.resize(this.viewItems.length-1,this._size-s,void 0,e,n),this.distributeEmptySpace(),this.layoutViews(),this.saveProportions()}distributeEmptySpace(e){const n=this.viewItems.reduce((d,h)=>d+h.size,0);let s=this.size-n;const l=ts(this.viewItems.length-1,-1),a=l.filter(d=>this.viewItems[d].priority===on.Low),c=l.filter(d=>this.viewItems[d].priority===on.High);for(const d of c)th(l,d);for(const d of a)Su(l,d);typeof e=="number"&&Su(l,e);for(let d=0;s!==0&&d0&&(this._proportions=this.viewItems.map(e=>e.visible?e.size/this._contentSize:void 0))}layoutViews(){if(this._contentSize=this.viewItems.reduce((h,m)=>h+m.size,0),this.updateSashEnablement(),this.viewItems.length===0)return;const e=this.viewItems.filter(h=>h.visible),n=Math.max(0,e.length-1),s=this.margin*n/Math.max(1,e.length);let l=0;const a=[],c=4,d=this.viewItems.reduce((h,m,w)=>{const v=m.visible?1:0;return w===0?h.push(v):h.push(h[w-1]+v),h},[]);this.viewItems.forEach((h,m)=>{l+=this.viewItems[m].size,a.push(l);const w=h.visible?h.size-s:0,v=Math.max(0,d[m]-1),S=m===0||v===0?0:a[m-1]+v/n*s;if(m0)return;if(!s.visible&&s.snap)return n}}updateSashEnablement(){let e=!1;const n=this.viewItems.map(h=>e=h.size-h.minimumSize>0||e);e=!1;const s=this.viewItems.map(h=>e=h.maximumSize-h.size>0||e),l=[...this.viewItems].reverse();e=!1;const a=l.map(h=>e=h.size-h.minimumSize>0||e).reverse();e=!1;const c=l.map(h=>e=h.maximumSize-h.size>0||e).reverse();let d=0;for(let h=0;h0||this.startSnappingEnabled)?this.updateSash(m,ji.MINIMUM):O&&n[h]&&(d{const a=new Ne(l.onDidChangeExpansionState(()=>{this.setupAnimation(),this._onDidChange.fire(void 0)})),c={pane:l,disposable:{dispose:()=>{a.dispose()}}};this.paneItems.push(c),l.orthogonalSize=this.splitview.orthogonalSize}),this.addDisposables(this._onDidChange,this.splitview.onDidSashEnd(()=>{this._onDidChange.fire(void 0)}),this.splitview.onDidAddView(()=>{this._onDidChange.fire()}),this.splitview.onDidRemoveView(()=>{this._onDidChange.fire()}))}setViewVisible(e,n){this.splitview.setViewVisible(e,n)}addPane(e,n,s=this.splitview.length,l=!1){const a=e.onDidChangeExpansionState(()=>{this.setupAnimation(),this._onDidChange.fire(void 0)}),c={pane:e,disposable:{dispose:()=>{a.dispose()}}};this.paneItems.splice(s,0,c),e.orthogonalSize=this.splitview.orthogonalSize,this.splitview.addView(e,n,s,l)}getViewSize(e){return this.splitview.getViewSize(e)}getPanes(){return this.splitview.getViews()}removePane(e,n={skipDispose:!1}){const s=this.paneItems.splice(e,1)[0];return this.splitview.removeView(e),n.skipDispose||(s.disposable.dispose(),s.pane.dispose()),s}moveView(e,n){if(e===n)return;const s=this.removePane(e,{skipDispose:!0});this.skipAnimation=!0;try{this.addPane(s.pane,s.pane.size,n,!1)}finally{this.skipAnimation=!1}}layout(e,n){this.splitview.layout(e,n)}setupAnimation(){this.skipAnimation||(this.animationTimer&&(clearTimeout(this.animationTimer),this.animationTimer=void 0),ac(this.element,"dv-animated"),this.animationTimer=setTimeout(()=>{this.animationTimer=void 0,Xl(this.element,"dv-animated")},200))}dispose(){super.dispose(),this.animationTimer&&(clearTimeout(this.animationTimer),this.animationTimer=void 0),this.paneItems.forEach(e=>{e.disposable.dispose(),e.pane.dispose()}),this.paneItems=[],this.splitview.dispose(),this.element.remove()}}class Sn{get minimumWidth(){return this.view.minimumWidth}get maximumWidth(){return this.view.maximumWidth}get minimumHeight(){return this.view.minimumHeight}get maximumHeight(){return this.view.maximumHeight}get priority(){return this.view.priority}get snap(){return this.view.snap}get minimumSize(){return this.orientation===ke.HORIZONTAL?this.minimumHeight:this.minimumWidth}get maximumSize(){return this.orientation===ke.HORIZONTAL?this.maximumHeight:this.maximumWidth}get minimumOrthogonalSize(){return this.orientation===ke.HORIZONTAL?this.minimumWidth:this.minimumHeight}get maximumOrthogonalSize(){return this.orientation===ke.HORIZONTAL?this.maximumWidth:this.maximumHeight}get orthogonalSize(){return this._orthogonalSize}get size(){return this._size}get element(){return this.view.element}get width(){return this.orientation===ke.HORIZONTAL?this.orthogonalSize:this.size}get height(){return this.orientation===ke.HORIZONTAL?this.size:this.orthogonalSize}constructor(e,n,s,l=0){this.view=e,this.orientation=n,this._onDidChange=new U,this.onDidChange=this._onDidChange.event,this._orthogonalSize=s,this._size=l,this._disposable=this.view.onDidChange(a=>{a?this._onDidChange.fire({size:this.orientation===ke.VERTICAL?a.width:a.height,orthogonalSize:this.orientation===ke.VERTICAL?a.height:a.width}):this._onDidChange.fire({})})}setVisible(e){this.view.setVisible&&this.view.setVisible(e)}layout(e,n){this._size=e,this._orthogonalSize=n,this.view.layout(this.width,this.height)}dispose(){this._onDidChange.dispose(),this._disposable.dispose()}}class Rt extends Ne{get width(){return this.orientation===ke.HORIZONTAL?this.size:this.orthogonalSize}get height(){return this.orientation===ke.HORIZONTAL?this.orthogonalSize:this.size}get minimumSize(){return this.children.length===0?0:Math.max(...this.children.map((e,n)=>this.splitview.isViewVisible(n)?e.minimumOrthogonalSize:0))}get maximumSize(){return Math.min(...this.children.map((e,n)=>this.splitview.isViewVisible(n)?e.maximumOrthogonalSize:Number.POSITIVE_INFINITY))}get minimumOrthogonalSize(){return this.splitview.minimumSize}get maximumOrthogonalSize(){return this.splitview.maximumSize}get orthogonalSize(){return this._orthogonalSize}get size(){return this._size}get minimumWidth(){return this.orientation===ke.HORIZONTAL?this.minimumOrthogonalSize:this.minimumSize}get minimumHeight(){return this.orientation===ke.HORIZONTAL?this.minimumSize:this.minimumOrthogonalSize}get maximumWidth(){return this.orientation===ke.HORIZONTAL?this.maximumOrthogonalSize:this.maximumSize}get maximumHeight(){return this.orientation===ke.HORIZONTAL?this.maximumSize:this.maximumOrthogonalSize}get priority(){if(this.children.length===0)return on.Normal;const e=this.children.map(n=>typeof n.priority>"u"?on.Normal:n.priority);return e.some(n=>n===on.High)?on.High:e.some(n=>n===on.Low)?on.Low:on.Normal}get disabled(){return this.splitview.disabled}set disabled(e){this.splitview.disabled=e}get margin(){return this.splitview.margin}set margin(e){this.splitview.margin=e,this.children.forEach(n=>{n instanceof Rt&&(n.margin=e)})}constructor(e,n,s,l,a,c,d,h){if(super(),this.orientation=e,this.proportionalLayout=n,this.styles=s,this._childrenDisposable=Qt.NONE,this.children=[],this._onDidChange=new U,this.onDidChange=this._onDidChange.event,this._onDidVisibilityChange=new U,this.onDidVisibilityChange=this._onDidVisibilityChange.event,this._orthogonalSize=a,this._size=l,this.element=document.createElement("div"),this.element.className="dv-branch-node",!h)this.splitview=new ql(this.element,{orientation:this.orientation,proportionalLayout:n,styles:s,margin:d}),this.splitview.layout(this.size,this.orthogonalSize);else{const m={views:h.map(w=>({view:w.node,size:w.node.size,visible:w.node instanceof Sn&&w.visible!==void 0?w.visible:!0})),size:this.orthogonalSize};this.children=h.map(w=>w.node),this.splitview=new ql(this.element,{orientation:this.orientation,descriptor:m,proportionalLayout:n,styles:s,margin:d})}this.disabled=c,this.addDisposables(this._onDidChange,this._onDidVisibilityChange,this.splitview.onDidSashEnd(()=>{this._onDidChange.fire({})})),this.setupChildrenEvents()}setVisible(e){}isChildVisible(e){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.isViewVisible(e)}setChildVisible(e,n){if(e<0||e>=this.children.length)throw new Error("Invalid index");if(this.splitview.isViewVisible(e)===n)return;const s=this.splitview.contentSize===0;this.splitview.setViewVisible(e,n);const l=this.splitview.contentSize===0;(n&&s||!n&&l)&&this._onDidVisibilityChange.fire({visible:n})}moveChild(e,n){if(e===n)return;if(e<0||e>=this.children.length)throw new Error("Invalid from index");e=this.children.length)throw new Error("Invalid index");return this.splitview.getViewSize(e)}resizeChild(e,n){if(e<0||e>=this.children.length)throw new Error("Invalid index");this.splitview.resizeView(e,n)}layout(e,n){this._size=n,this._orthogonalSize=e,this.splitview.layout(n,e)}addChild(e,n,s,l){if(s<0||s>this.children.length)throw new Error("Invalid index");this.splitview.addView(e,n,s,l),this._addChild(e,s)}getChildCachedVisibleSize(e){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.getViewCachedVisibleSize(e)}removeChild(e,n){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.removeView(e,n),this._removeChild(e)}_addChild(e,n){this.children.splice(n,0,e),this.setupChildrenEvents()}_removeChild(e){const[n]=this.children.splice(e,1);return this.setupChildrenEvents(),n}setupChildrenEvents(){this._childrenDisposable.dispose(),this._childrenDisposable=new Ne(Zr.any(...this.children.map(e=>e.onDidChange))(e=>{this._onDidChange.fire({size:e.orthogonalSize})}),...this.children.map((e,n)=>e instanceof Rt?e.onDidVisibilityChange(({visible:s})=>{this.setChildVisible(n,s)}):Qt.NONE))}dispose(){this._childrenDisposable.dispose(),this.splitview.dispose(),this.children.forEach(e=>e.dispose()),super.dispose()}}function Dh(r,e){if(r instanceof Sn)return r;if(r instanceof Rt)return Dh(r.children[e?r.children.length-1:0],e);throw new Error("invalid node")}function iw(r,e,n){if(r instanceof Rt){const s=new Rt(r.orientation,r.proportionalLayout,r.styles,e,n,r.disabled,r.margin);for(let l=r.children.length-1;l>=0;l--){const a=r.children[l];s.addChild(iw(a,a.size,a.orthogonalSize),a.size,0,!0)}return s}else return new Sn(r.view,r.orientation,n)}function Ch(r,e,n){if(r instanceof Rt){const s=new Rt(Ss(r.orientation),r.proportionalLayout,r.styles,e,n,r.disabled,r.margin);let l=0;for(let a=r.children.length-1;a>=0;a--){const c=r.children[a],d=c instanceof Rt?c.orthogonalSize:c.size;let h=r.size===0?0:Math.round(e*d/r.size);l+=h,a===0&&(h+=e-l),s.addChild(Ch(c,n,h),h,0,!0)}return s}else return new Sn(r.view,Ss(r.orientation),n)}function gC(r){const e=r.parentElement;if(!e)throw new Error("Invalid grid element");let n=e.firstElementChild,s=0;for(;n!==r&&n!==e.lastElementChild&&n;)n=n.nextElementSibling,s++;return s}function kt(r){const e=r.parentElement;if(!e)throw new Error("Invalid grid element");if(/\bdv-grid-view\b/.test(e.className))return[];const n=gC(e),s=e.parentElement.parentElement.parentElement;return[...kt(s),n]}function _s(r,e,n){const s=wC(r,e),l=vC(n);if(s===l){const[a,c]=Ms(e);let d=c;return(n==="right"||n==="bottom")&&(d+=1),[...a,d]}else{const a=n==="right"||n==="bottom"?1:0;return[...e,a]}}function vC(r){return r==="top"||r==="bottom"?ke.VERTICAL:ke.HORIZONTAL}function wC(r,e){return e.length%2===0?Ss(r):r}const Ss=r=>r===ke.HORIZONTAL?ke.VERTICAL:ke.HORIZONTAL;function _C(r){return!!r.children}const xh=(r,e)=>{const n=e===ke.VERTICAL?r.box.width:r.box.height;return _C(r)?{type:"branch",data:r.children.map(s=>xh(s,Ss(e))),size:n}:typeof r.cachedVisibleSize=="number"?{type:"leaf",data:r.view.toJSON(),size:r.cachedVisibleSize,visible:!1}:{type:"leaf",data:r.view.toJSON(),size:n}};class yC{get length(){return this._root?this._root.children.length:0}get orientation(){return this.root.orientation}set orientation(e){if(this.root.orientation===e)return;const{size:n,orthogonalSize:s}=this.root;this.root=Ch(this.root,s,n),this.root.layout(n,s)}get width(){return this.root.width}get height(){return this.root.height}get minimumWidth(){return this.root.minimumWidth}get minimumHeight(){return this.root.minimumHeight}get maximumWidth(){return this.root.maximumHeight}get maximumHeight(){return this.root.maximumHeight}get locked(){return this._locked}set locked(e){this._locked=e;const n=[this.root];for(;n.length>0;){const s=n.pop();s instanceof Rt&&(s.disabled=e,n.push(...s.children))}}get margin(){return this._margin}set margin(e){this._margin=e,this.root.margin=e}maximizedView(){var e;return(e=this._maximizedNode)===null||e===void 0?void 0:e.leaf.view}hasMaximizedView(){return this._maximizedNode!==void 0}maximizeView(e){var n;const s=kt(e.element),[l,a]=this.getNode(s);if(!(a instanceof Sn)||((n=this._maximizedNode)===null||n===void 0?void 0:n.leaf)===a)return;this.hasMaximizedView()&&this.exitMaximizedView(),xh(this.getView(),this.orientation);const c=[];function d(h,m){for(let w=0;w=0;a--){const c=l.children[a];c instanceof Sn?e.includes(c)||l.setChildVisible(a,!0):n(c)}}n(this.root);const s=this._maximizedNode.leaf;this._maximizedNode=void 0,this._onDidMaximizedNodeChange.fire({view:s.view,isMaximized:!1})}serialize(){const e=this.maximizedView();let n;e&&(n=kt(e.element)),this.hasMaximizedView()&&this.exitMaximizedView();const l={root:xh(this.getView(),this.orientation),width:this.width,height:this.height,orientation:this.orientation};return n&&(l.maximizedNode={location:n}),e&&this.maximizeView(e),l}dispose(){this.disposable.dispose(),this._onDidChange.dispose(),this._onDidMaximizedNodeChange.dispose(),this._onDidViewVisibilityChange.dispose(),this.root.dispose(),this._maximizedNode=void 0,this.element.remove()}clear(){const e=this.root.orientation;this.root=new Rt(e,this.proportionalLayout,this.styles,this.root.size,this.root.orthogonalSize,this.locked,this.margin)}deserialize(e,n){const s=e.orientation,l=s===ke.VERTICAL?e.height:e.width;if(this._deserialize(e.root,s,n,l),this.layout(e.width,e.height),e.maximizedNode){const a=e.maximizedNode.location,[c,d]=this.getNode(a);if(!(d instanceof Sn))return;this.maximizeView(d.view)}}_deserialize(e,n,s,l){this.root=this._deserializeNode(e,n,s,l)}_deserializeNode(e,n,s,l){var a;let c;if(e.type==="branch"){const h=e.data.map(m=>({node:this._deserializeNode(m,Ss(n),s,e.size),visible:m.visible}));c=new Rt(n,this.proportionalLayout,this.styles,e.size,l,this.locked,this.margin,h)}else{const d=s.fromJSON(e);typeof e.visible=="boolean"&&((a=d.setVisible)===null||a===void 0||a.call(d,e.visible)),c=new Sn(d,n,l,e.size)}return c}get root(){return this._root}set root(e){const n=this._root;n&&(n.dispose(),this._maximizedNode=void 0,this.element.removeChild(n.element)),this._root=e,this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange(s=>{this._onDidChange.fire(s)})}normalize(){if(!this._root||this._root.children.length!==1)return;const e=this.root,n=e.children[0];if(n instanceof Sn)return;e.element.remove();const s=e.removeChild(0);e.dispose(),s.dispose(),this._root=iw(n,n.size,n.orthogonalSize),this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange(l=>{this._onDidChange.fire(l)})}insertOrthogonalSplitviewAtRoot(){if(!this._root)return;const e=this.root;if(e.element.remove(),this._root=new Rt(Ss(e.orientation),this.proportionalLayout,this.styles,this.root.orthogonalSize,this.root.size,this.locked,this.margin),e.children.length!==0)if(e.children.length===1){const n=e.children[0];e.removeChild(0).dispose(),e.dispose(),this._root.addChild(Ch(n,n.orthogonalSize,n.size),$i.Distribute,0)}else this._root.addChild(e,$i.Distribute,0);this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange(n=>{this._onDidChange.fire(n)})}next(e){return this.progmaticSelect(e)}previous(e){return this.progmaticSelect(e,!0)}getView(e){const n=e?this.getNode(e)[1]:this.root;return this._getViews(n,this.orientation)}_getViews(e,n,s){const l={height:e.height,width:e.width};if(e instanceof Sn)return{box:l,view:e.view,cachedVisibleSize:s};const a=[];for(let c=0;c-1;a--){const c=s[a],d=e[a]||0;if(n?d-1>-1:d+1m.getChildSize(P));if(m.removeChild(v,n).dispose(),h instanceof Rt){A.splice(v,1,...h.children.map(D=>D.size));for(let D=0;D0;)h.removeChild(0)}else{const D=new Sn(h.view,Ss(h.orientation),h.size),P=E?h.orthogonalSize:$i.Invisible(h.orthogonalSize);m.addChild(D,P,v)}h.dispose();for(let D=0;D=n.children.length)throw new Error("Invalid location");const c=n.children[l];return s.push(n),this.getNode(a,c,s)}}const Eh=Object.keys({disableAutoResizing:void 0,proportionalLayout:void 0,orientation:void 0,hideBorders:void 0,className:void 0});class tf extends Ne{get element(){return this._element}get disableResizing(){return this._disableResizing}set disableResizing(e){this._disableResizing=e}constructor(e,n=!1){super(),this._disableResizing=n,this._element=e,this.addDisposables(lc(this._element,s=>{if(this.isDisposed||this.disableResizing||!this._element.offsetParent||!rC(this._element))return;const{width:l,height:a}=s.contentRect;this.layout(l,a)}))}}const SC=ef();function $u(r){switch(r){case"left":return"left";case"right":return"right";case"above":return"top";case"below":return"bottom";case"within":default:return"center"}}class sw extends tf{get id(){return this._id}get size(){return this._groups.size}get groups(){return Array.from(this._groups.values()).map(e=>e.value)}get width(){return this.gridview.width}get height(){return this.gridview.height}get minimumHeight(){return this.gridview.minimumHeight}get maximumHeight(){return this.gridview.maximumHeight}get minimumWidth(){return this.gridview.minimumWidth}get maximumWidth(){return this.gridview.maximumWidth}get activeGroup(){return this._activeGroup}get locked(){return this.gridview.locked}set locked(e){this.gridview.locked=e}constructor(e,n){var s;super(document.createElement("div"),n.disableAutoResizing),this._id=SC.next(),this._groups=new Map,this._onDidRemove=new U,this.onDidRemove=this._onDidRemove.event,this._onDidAdd=new U,this.onDidAdd=this._onDidAdd.event,this._onDidMaximizedChange=new U,this.onDidMaximizedChange=this._onDidMaximizedChange.event,this._onDidActiveChange=new U,this.onDidActiveChange=this._onDidActiveChange.event,this._bufferOnDidLayoutChange=new _g,this.onDidLayoutChange=this._bufferOnDidLayoutChange.onEvent,this._onDidViewVisibilityChangeMicroTaskQueue=new _g,this.onDidViewVisibilityChangeMicroTaskQueue=this._onDidViewVisibilityChangeMicroTaskQueue.onEvent,this.element.style.height="100%",this.element.style.width="100%",this._classNames=new uc(this.element),this._classNames.setClassNames((s=n.className)!==null&&s!==void 0?s:""),e.appendChild(this.element),this.gridview=new yC(!!n.proportionalLayout,n.styles,n.orientation,n.locked,n.margin),this.gridview.locked=!!n.locked,this.element.appendChild(this.gridview.element),this.layout(0,0,!0),this.addDisposables(this.gridview.onDidMaximizedNodeChange(l=>{this._onDidMaximizedChange.fire({panel:l.view,isMaximized:l.isMaximized})}),this.gridview.onDidViewVisibilityChange(()=>this._onDidViewVisibilityChangeMicroTaskQueue.fire()),this.onDidViewVisibilityChangeMicroTaskQueue(()=>{this.layout(this.width,this.height,!0)}),Qt.from(()=>{var l;(l=this.element.parentElement)===null||l===void 0||l.removeChild(this.element)}),this.gridview.onDidChange(()=>{this._bufferOnDidLayoutChange.fire()}),Zr.any(this.onDidAdd,this.onDidRemove,this.onDidActiveChange)(()=>{this._bufferOnDidLayoutChange.fire()}),this._onDidMaximizedChange,this._onDidViewVisibilityChangeMicroTaskQueue,this._bufferOnDidLayoutChange)}setVisible(e,n){this.gridview.setViewVisible(kt(e.element),n),this._bufferOnDidLayoutChange.fire()}isVisible(e){return this.gridview.isViewVisible(kt(e.element))}updateOptions(e){var n,s,l,a;e.proportionalLayout,e.orientation&&(this.gridview.orientation=e.orientation),"disableResizing"in e&&(this.disableResizing=(n=e.disableAutoResizing)!==null&&n!==void 0?n:!1),"locked"in e&&(this.locked=(s=e.locked)!==null&&s!==void 0?s:!1),"margin"in e&&(this.gridview.margin=(l=e.margin)!==null&&l!==void 0?l:0),"className"in e&&this._classNames.setClassNames((a=e.className)!==null&&a!==void 0?a:"")}maximizeGroup(e){this.gridview.maximizeView(e),this.doSetGroupActive(e)}isMaximizedGroup(e){return this.gridview.maximizedView()===e}exitMaximizedGroup(){this.gridview.exitMaximizedView()}hasMaximizedGroup(){return this.gridview.hasMaximizedView()}doAddGroup(e,n=[0],s){this.gridview.addView(e,s??$i.Distribute,n),this._onDidAdd.fire(e)}doRemoveGroup(e,n){if(!this._groups.has(e.id))throw new Error("invalid operation");const s=this._groups.get(e.id),l=this.gridview.remove(e,$i.Distribute);if(s&&!(n!=null&&n.skipDispose)&&(s.disposable.dispose(),s.value.dispose(),this._groups.delete(e.id),this._onDidRemove.fire(e)),!(n!=null&&n.skipActive)&&this._activeGroup===e){const a=Array.from(this._groups.values());this.doSetGroupActive(a.length>0?a[0].value:void 0)}return l}getPanel(e){var n;return(n=this._groups.get(e))===null||n===void 0?void 0:n.value}doSetGroupActive(e){this._activeGroup!==e&&(this._activeGroup&&this._activeGroup.setActive(!1),e&&e.setActive(!0),this._activeGroup=e,this._onDidActiveChange.fire(e))}removeGroup(e){this.doRemoveGroup(e)}moveToNext(e){var n;if(e||(e={}),!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}const s=kt(e.group.element),l=(n=this.gridview.next(s))===null||n===void 0?void 0:n.view;this.doSetGroupActive(l)}moveToPrevious(e){var n;if(e||(e={}),!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}const s=kt(e.group.element),l=(n=this.gridview.previous(s))===null||n===void 0?void 0:n.view;this.doSetGroupActive(l)}layout(e,n,s){(s||e!==this.width||n!==this.height)&&(this.gridview.element.style.height=`${n}px`,this.gridview.element.style.width=`${e}px`,this.gridview.layout(e,n))}dispose(){this._onDidActiveChange.dispose(),this._onDidAdd.dispose(),this._onDidRemove.dispose();for(const e of this.groups)e.dispose();this.gridview.dispose(),super.dispose()}}class rw{get minimumSize(){return this.component.minimumSize}get maximumSize(){return this.component.maximumSize}get width(){return this.component.width}get height(){return this.component.height}get length(){return this.component.length}get orientation(){return this.component.orientation}get panels(){return this.component.panels}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidAddView(){return this.component.onDidAddView}get onDidRemoveView(){return this.component.onDidRemoveView}constructor(e){this.component=e}removePanel(e,n){this.component.removePanel(e,n)}focus(){this.component.focus()}getPanel(e){return this.component.getPanel(e)}layout(e,n){return this.component.layout(e,n)}addPanel(e){return this.component.addPanel(e)}movePanel(e,n){this.component.movePanel(e,n)}fromJSON(e){this.component.fromJSON(e)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}}class ea{get minimumSize(){return this.component.minimumSize}get maximumSize(){return this.component.maximumSize}get width(){return this.component.width}get height(){return this.component.height}get panels(){return this.component.panels}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get onDidAddView(){return this.component.onDidAddView}get onDidRemoveView(){return this.component.onDidRemoveView}get onDidDrop(){return this.component.onDidDrop}get onUnhandledDragOverEvent(){return this.component.onUnhandledDragOverEvent}constructor(e){this.component=e}removePanel(e){this.component.removePanel(e)}getPanel(e){return this.component.getPanel(e)}movePanel(e,n){this.component.movePanel(e,n)}focus(){this.component.focus()}layout(e,n){this.component.layout(e,n)}addPanel(e){return this.component.addPanel(e)}fromJSON(e){this.component.fromJSON(e)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}}class ow{get width(){return this.component.width}get height(){return this.component.height}get minimumHeight(){return this.component.minimumHeight}get maximumHeight(){return this.component.maximumHeight}get minimumWidth(){return this.component.minimumWidth}get maximumWidth(){return this.component.maximumWidth}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidAddPanel(){return this.component.onDidAddGroup}get onDidRemovePanel(){return this.component.onDidRemoveGroup}get onDidActivePanelChange(){return this.component.onDidActiveGroupChange}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get panels(){return this.component.groups}get orientation(){return this.component.orientation}set orientation(e){this.component.updateOptions({orientation:e})}constructor(e){this.component=e}focus(){this.component.focus()}layout(e,n,s=!1){this.component.layout(e,n,s)}addPanel(e){return this.component.addPanel(e)}removePanel(e,n){this.component.removePanel(e,n)}movePanel(e,n){this.component.movePanel(e,n)}getPanel(e){return this.component.getPanel(e)}fromJSON(e){return this.component.fromJSON(e)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}}class Yu{get id(){return this.component.id}get width(){return this.component.width}get height(){return this.component.height}get minimumHeight(){return this.component.minimumHeight}get maximumHeight(){return this.component.maximumHeight}get minimumWidth(){return this.component.minimumWidth}get maximumWidth(){return this.component.maximumWidth}get size(){return this.component.size}get totalPanels(){return this.component.totalPanels}get onDidActiveGroupChange(){return this.component.onDidActiveGroupChange}get onDidAddGroup(){return this.component.onDidAddGroup}get onDidRemoveGroup(){return this.component.onDidRemoveGroup}get onDidActivePanelChange(){return this.component.onDidActivePanelChange}get onDidAddPanel(){return this.component.onDidAddPanel}get onDidRemovePanel(){return this.component.onDidRemovePanel}get onDidMovePanel(){return this.component.onDidMovePanel}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidDrop(){return this.component.onDidDrop}get onWillDrop(){return this.component.onWillDrop}get onWillShowOverlay(){return this.component.onWillShowOverlay}get onWillDragGroup(){return this.component.onWillDragGroup}get onWillDragPanel(){return this.component.onWillDragPanel}get onUnhandledDragOverEvent(){return this.component.onUnhandledDragOverEvent}get onDidPopoutGroupSizeChange(){return this.component.onDidPopoutGroupSizeChange}get onDidPopoutGroupPositionChange(){return this.component.onDidPopoutGroupPositionChange}get onDidOpenPopoutWindowFail(){return this.component.onDidOpenPopoutWindowFail}get panels(){return this.component.panels}get groups(){return this.component.groups}get activePanel(){return this.component.activePanel}get activeGroup(){return this.component.activeGroup}constructor(e){this.component=e}focus(){this.component.focus()}getPanel(e){return this.component.getGroupPanel(e)}layout(e,n,s=!1){this.component.layout(e,n,s)}addPanel(e){return this.component.addPanel(e)}removePanel(e){this.component.removePanel(e)}addGroup(e){return this.component.addGroup(e)}closeAllGroups(){return this.component.closeAllGroups()}removeGroup(e){this.component.removeGroup(e)}getGroup(e){return this.component.getPanel(e)}addFloatingGroup(e,n){return this.component.addFloatingGroup(e,n)}fromJSON(e,n){this.component.fromJSON(e,n)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}moveToNext(e){this.component.moveToNext(e)}moveToPrevious(e){this.component.moveToPrevious(e)}maximizeGroup(e){this.component.maximizeGroup(e.group)}hasMaximizedGroup(){return this.component.hasMaximizedGroup()}exitMaximizedGroup(){this.component.exitMaximizedGroup()}get onDidMaximizedGroupChange(){return this.component.onDidMaximizedGroupChange}addPopoutGroup(e,n){return this.component.addPopoutGroup(e,n)}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}}class nf extends Ne{constructor(e,n){super(),this.el=e,this.disabled=n,this.dataDisposable=new Bn,this.pointerEventsDisposable=new Bn,this._onDragStart=new U,this.onDragStart=this._onDragStart.event,this.addDisposables(this._onDragStart,this.dataDisposable,this.pointerEventsDisposable),this.configure()}setDisabled(e){this.disabled=e}isCancelled(e){return!1}configure(){this.addDisposables(this._onDragStart,Be(this.el,"dragstart",e=>{if(e.defaultPrevented||this.isCancelled(e)||this.disabled){e.preventDefault();return}const n=Uu();this.pointerEventsDisposable.value={dispose:()=>{n.release()}},this.el.classList.add("dv-dragged"),setTimeout(()=>this.el.classList.remove("dv-dragged"),0),this.dataDisposable.value=this.getData(e),this._onDragStart.fire(e),e.dataTransfer&&(e.dataTransfer.effectAllowed="move",e.dataTransfer.items.length>0||e.dataTransfer.setData("text/plain",""))}),Be(this.el,"dragend",()=>{this.pointerEventsDisposable.dispose(),setTimeout(()=>{this.dataDisposable.dispose()},0)}))}}class lw extends Ne{constructor(e,n){super(),this.element=e,this.callbacks=n,this.target=null,this.registerListeners()}onDragEnter(e){this.target=e.target,this.callbacks.onDragEnter(e)}onDragOver(e){e.preventDefault(),this.callbacks.onDragOver&&this.callbacks.onDragOver(e)}onDragLeave(e){this.target===e.target&&(this.target=null,this.callbacks.onDragLeave(e))}onDragEnd(e){this.target=null,this.callbacks.onDragEnd(e)}onDrop(e){this.callbacks.onDrop(e)}registerListeners(){this.addDisposables(Be(this.element,"dragenter",e=>{this.onDragEnter(e)},!0)),this.addDisposables(Be(this.element,"dragover",e=>{this.onDragOver(e)},!0)),this.addDisposables(Be(this.element,"dragleave",e=>{this.onDragLeave(e)})),this.addDisposables(Be(this.element,"dragend",e=>{this.onDragEnd(e)})),this.addDisposables(Be(this.element,"drop",e=>{this.onDrop(e)}))}}function DC(r,e){const{top:n,left:s,width:l,height:a}=e,c=`${Math.round(n)}px`,d=`${Math.round(s)}px`,h=`${Math.round(l)}px`,m=`${Math.round(a)}px`;r.style.top=c,r.style.left=d,r.style.width=h,r.style.height=m,r.style.visibility="visible",(!r.style.transform||r.style.transform==="")&&(r.style.transform="translate3d(0, 0, 0)")}function CC(r,e){const{top:n,left:s,width:l,height:a}=e;r.style.top=n,r.style.left=s,r.style.width=l,r.style.height=a,r.style.visibility="visible",(!r.style.transform||r.style.transform==="")&&(r.style.transform="translate3d(0, 0, 0)")}function xC(r,e){const{top:n,left:s,width:l,height:a}=e,c=`${Math.round(n)}px`,d=`${Math.round(s)}px`,h=`${Math.round(l)}px`,m=`${Math.round(a)}px`;return r.style.top!==c||r.style.left!==d||r.style.width!==h||r.style.height!==m}class EC extends qh{get nativeEvent(){return this.options.nativeEvent}get position(){return this.options.position}constructor(e){super(),this.options=e}}function Dg(r){switch(r){case"above":return"top";case"below":return"bottom";case"left":return"left";case"right":return"right";case"within":return"center";default:throw new Error(`invalid direction '${r}'`)}}function bC(r){switch(r){case"top":return"above";case"bottom":return"below";case"left":return"left";case"right":return"right";case"center":return"within";default:throw new Error(`invalid position '${r}'`)}}const PC={value:20,type:"percentage"},AC={value:50,type:"percentage"},kC=100,zC=100;class rs extends Ne{get disabled(){return this._disabled}set disabled(e){this._disabled=e}get state(){return this._state}constructor(e,n){super(),this.element=e,this.options=n,this._onDrop=new U,this.onDrop=this._onDrop.event,this._onWillShowOverlay=new U,this.onWillShowOverlay=this._onWillShowOverlay.event,this._disabled=!1,this._acceptedTargetZonesSet=new Set(this.options.acceptedTargetZones),this.dnd=new lw(this.element,{onDragEnter:()=>{var s,l,a;(a=(l=(s=this.options).getOverrideTarget)===null||l===void 0?void 0:l.call(s))===null||a===void 0||a.getElements()},onDragOver:s=>{var l,a,c,d,h,m,w;rs.ACTUAL_TARGET=this;const v=(a=(l=this.options).getOverrideTarget)===null||a===void 0?void 0:a.call(l);if(this._acceptedTargetZonesSet.size===0){if(v)return;this.removeDropTarget();return}const S=(h=(d=(c=this.options).getOverlayOutline)===null||d===void 0?void 0:d.call(c))!==null&&h!==void 0?h:this.element,E=S.offsetWidth,A=S.offsetHeight;if(E===0||A===0)return;const D=s.currentTarget.getBoundingClientRect(),P=((m=s.clientX)!==null&&m!==void 0?m:0)-D.left,N=((w=s.clientY)!==null&&w!==void 0?w:0)-D.top,O=this.calculateQuadrant(this._acceptedTargetZonesSet,P,N,E,A);if(this.isAlreadyUsed(s)||O===null){this.removeDropTarget();return}if(!this.options.canDisplayOverlay(s,O)){if(v)return;this.removeDropTarget();return}const M=new EC({nativeEvent:s,position:O});if(this._onWillShowOverlay.fire(M),M.defaultPrevented){this.removeDropTarget();return}this.markAsUsed(s),v||this.targetElement||(this.targetElement=document.createElement("div"),this.targetElement.className="dv-drop-target-dropzone",this.overlayElement=document.createElement("div"),this.overlayElement.className="dv-drop-target-selection",this._state="center",this.targetElement.appendChild(this.overlayElement),S.classList.add("dv-drop-target"),S.append(this.targetElement)),this.toggleClasses(O,E,A),this._state=O},onDragLeave:()=>{var s,l;!((l=(s=this.options).getOverrideTarget)===null||l===void 0)&&l.call(s)||this.removeDropTarget()},onDragEnd:s=>{var l,a;const c=(a=(l=this.options).getOverrideTarget)===null||a===void 0?void 0:a.call(l);c&&rs.ACTUAL_TARGET===this&&this._state&&(s.stopPropagation(),this._onDrop.fire({position:this._state,nativeEvent:s})),this.removeDropTarget(),c==null||c.clear()},onDrop:s=>{var l,a,c;s.preventDefault();const d=this._state;this.removeDropTarget(),(c=(a=(l=this.options).getOverrideTarget)===null||a===void 0?void 0:a.call(l))===null||c===void 0||c.clear(),d&&(s.stopPropagation(),this._onDrop.fire({position:d,nativeEvent:s}))}}),this.addDisposables(this._onDrop,this._onWillShowOverlay,this.dnd)}setTargetZones(e){this._acceptedTargetZonesSet=new Set(e)}setOverlayModel(e){this.options.overlayModel=e}dispose(){this.removeDropTarget(),super.dispose()}markAsUsed(e){e[rs.USED_EVENT_ID]=!0}isAlreadyUsed(e){const n=e[rs.USED_EVENT_ID];return typeof n=="boolean"&&n}toggleClasses(e,n,s){var l,a,c,d,h,m,w;const v=(a=(l=this.options).getOverrideTarget)===null||a===void 0?void 0:a.call(l);if(!v&&!this.overlayElement)return;const S=n{Re(ie,"dv-drop-target-anchor-container-changed",!1)},10));return}if(!this.overlayElement)return;const K={top:"0px",left:"0px",width:"100%",height:"100%"};O?(K.left=`${100*(1-G)}%`,K.width=`${100*G}%`):M?K.width=`${100*G}%`:R?K.height=`${100*G}%`:Z&&(K.top=`${100*(1-G)}%`,K.height=`${100*G}%`),CC(this.overlayElement,K),Re(this.overlayElement,"dv-drop-target-small-vertical",E),Re(this.overlayElement,"dv-drop-target-small-horizontal",S),Re(this.overlayElement,"dv-drop-target-left",A),Re(this.overlayElement,"dv-drop-target-right",D),Re(this.overlayElement,"dv-drop-target-top",P),Re(this.overlayElement,"dv-drop-target-bottom",N),Re(this.overlayElement,"dv-drop-target-center",e==="center")}calculateQuadrant(e,n,s,l,a){var c,d;const h=(d=(c=this.options.overlayModel)===null||c===void 0?void 0:c.activationSize)!==null&&d!==void 0?d:PC;return h.type==="percentage"?OC(e,n,s,l,a,h.value):TC(e,n,s,l,a,h.value)}removeDropTarget(){var e;this.targetElement&&(this._state=void 0,(e=this.targetElement.parentElement)===null||e===void 0||e.classList.remove("dv-drop-target"),this.targetElement.remove(),this.targetElement=void 0,this.overlayElement=void 0)}}rs.USED_EVENT_ID="__dockview_droptarget_event_is_used__";function OC(r,e,n,s,l,a){const c=100*e/s,d=100*n/l;return r.has("left")&&c100-a?"right":r.has("top")&&d100-a?"bottom":r.has("center")?"center":null}function TC(r,e,n,s,l,a){return r.has("left")&&es-a?"right":r.has("top")&&nl-a?"bottom":r.has("center")?"center":null}const bh=Object.keys({disableAutoResizing:void 0,disableDnd:void 0,className:void 0});class IC extends Xv{constructor(e,n,s,l){super(),this.nativeEvent=e,this.position=n,this.getData=s,this.panel=l}}class aw extends qh{constructor(){super()}}class uw extends Ne{get isFocused(){return this._isFocused}get isActive(){return this._isActive}get isVisible(){return this._isVisible}get width(){return this._width}get height(){return this._height}constructor(e,n){super(),this.id=e,this.component=n,this._isFocused=!1,this._isActive=!1,this._isVisible=!0,this._width=0,this._height=0,this._parameters={},this.panelUpdatesDisposable=new Bn,this._onDidDimensionChange=new U,this.onDidDimensionsChange=this._onDidDimensionChange.event,this._onDidChangeFocus=new U,this.onDidFocusChange=this._onDidChangeFocus.event,this._onWillFocus=new U,this.onWillFocus=this._onWillFocus.event,this._onDidVisibilityChange=new U,this.onDidVisibilityChange=this._onDidVisibilityChange.event,this._onWillVisibilityChange=new U,this.onWillVisibilityChange=this._onWillVisibilityChange.event,this._onDidActiveChange=new U,this.onDidActiveChange=this._onDidActiveChange.event,this._onActiveChange=new U,this.onActiveChange=this._onActiveChange.event,this._onDidParametersChange=new U,this.onDidParametersChange=this._onDidParametersChange.event,this.addDisposables(this.onDidFocusChange(s=>{this._isFocused=s.isFocused}),this.onDidActiveChange(s=>{this._isActive=s.isActive}),this.onDidVisibilityChange(s=>{this._isVisible=s.isVisible}),this.onDidDimensionsChange(s=>{this._width=s.width,this._height=s.height}),this.panelUpdatesDisposable,this._onDidDimensionChange,this._onDidChangeFocus,this._onDidVisibilityChange,this._onDidActiveChange,this._onWillFocus,this._onActiveChange,this._onWillFocus,this._onWillVisibilityChange,this._onDidParametersChange)}getParameters(){return this._parameters}initialize(e){this.panelUpdatesDisposable.value=this._onDidParametersChange.event(n=>{this._parameters=n,e.update({params:n})})}setVisible(e){this._onWillVisibilityChange.fire({isVisible:e})}setActive(){this._onActiveChange.fire()}updateParameters(e){this._onDidParametersChange.fire(e)}}class cw extends uw{constructor(e,n){super(e,n),this._onDidConstraintsChangeInternal=new U,this.onDidConstraintsChangeInternal=this._onDidConstraintsChangeInternal.event,this._onDidConstraintsChange=new U({replay:!0}),this.onDidConstraintsChange=this._onDidConstraintsChange.event,this._onDidSizeChange=new U,this.onDidSizeChange=this._onDidSizeChange.event,this.addDisposables(this._onDidConstraintsChangeInternal,this._onDidConstraintsChange,this._onDidSizeChange)}setConstraints(e){this._onDidConstraintsChangeInternal.fire(e)}setSize(e){this._onDidSizeChange.fire(e)}}class RC extends cw{set pane(e){this._pane=e}constructor(e,n){super(e,n),this._onDidExpansionChange=new U({replay:!0}),this.onDidExpansionChange=this._onDidExpansionChange.event,this._onMouseEnter=new U({}),this.onMouseEnter=this._onMouseEnter.event,this._onMouseLeave=new U({}),this.onMouseLeave=this._onMouseLeave.event,this.addDisposables(this._onDidExpansionChange,this._onMouseEnter,this._onMouseLeave)}setExpanded(e){var n;(n=this._pane)===null||n===void 0||n.setExpanded(e)}get isExpanded(){var e;return!!(!((e=this._pane)===null||e===void 0)&&e.isExpanded())}}class sf extends Ne{get element(){return this._element}get width(){return this._width}get height(){return this._height}get params(){var e;return(e=this._params)===null||e===void 0?void 0:e.params}constructor(e,n,s){super(),this.id=e,this.component=n,this.api=s,this._height=0,this._width=0,this._element=document.createElement("div"),this._element.tabIndex=-1,this._element.style.outline="none",this._element.style.height="100%",this._element.style.width="100%",this._element.style.overflow="hidden";const l=qv(this._element);this.addDisposables(this.api,l.onDidFocus(()=>{this.api._onDidChangeFocus.fire({isFocused:!0})}),l.onDidBlur(()=>{this.api._onDidChangeFocus.fire({isFocused:!1})}),l)}focus(){const e=new aw;this.api._onWillFocus.fire(e),!e.defaultPrevented&&this._element.focus()}layout(e,n){this._width=e,this._height=n,this.api._onDidDimensionChange.fire({width:e,height:n}),this.part&&this._params&&this.part.update(this._params.params)}init(e){this._params=e,this.part=this.getComponent()}update(e){var n,s;this._params=Object.assign(Object.assign({},this._params),{params:Object.assign(Object.assign({},(n=this._params)===null||n===void 0?void 0:n.params),e.params)});for(const l of Object.keys(e.params))e.params[l]===void 0&&delete this._params.params[l];(s=this.part)===null||s===void 0||s.update({params:this._params.params})}toJSON(){var e,n;const s=(n=(e=this._params)===null||e===void 0?void 0:e.params)!==null&&n!==void 0?n:{};return{id:this.id,component:this.component,params:Object.keys(s).length>0?s:void 0}}dispose(){var e;this.api.dispose(),(e=this.part)===null||e===void 0||e.dispose(),super.dispose()}}class NC extends sf{set orientation(e){this._orientation=e}get orientation(){return this._orientation}get minimumSize(){const e=this.headerSize,s=this.isExpanded()?this._minimumBodySize:0;return e+s}get maximumSize(){const e=this.headerSize,s=this.isExpanded()?this._maximumBodySize:0;return e+s}get size(){return this._size}get orthogonalSize(){return this._orthogonalSize}set orthogonalSize(e){this._orthogonalSize=e}get minimumBodySize(){return this._minimumBodySize}set minimumBodySize(e){this._minimumBodySize=typeof e=="number"?e:0}get maximumBodySize(){return this._maximumBodySize}set maximumBodySize(e){this._maximumBodySize=typeof e=="number"?e:Number.POSITIVE_INFINITY}get headerVisible(){return this._headerVisible}set headerVisible(e){this._headerVisible=e,this.header.style.display=e?"":"none"}constructor(e){super(e.id,e.component,new RC(e.id,e.component)),this._onDidChangeExpansionState=new U({replay:!0}),this.onDidChangeExpansionState=this._onDidChangeExpansionState.event,this._onDidChange=new U,this.onDidChange=this._onDidChange.event,this._orthogonalSize=0,this._size=0,this._isExpanded=!1,this.api.pane=this,this.api.initialize(this),this.headerSize=e.headerSize,this.headerComponent=e.headerComponent,this._minimumBodySize=e.minimumBodySize,this._maximumBodySize=e.maximumBodySize,this._isExpanded=e.isExpanded,this._headerVisible=e.isHeaderVisible,this._onDidChangeExpansionState.fire(this.isExpanded()),this._orientation=e.orientation,this.element.classList.add("dv-pane"),this.addDisposables(this.api.onWillVisibilityChange(n=>{const{isVisible:s}=n,{accessor:l}=this._params;l.setVisible(this,s)}),this.api.onDidSizeChange(n=>{this._onDidChange.fire({size:n.size})}),Be(this.element,"mouseenter",n=>{this.api._onMouseEnter.fire(n)}),Be(this.element,"mouseleave",n=>{this.api._onMouseLeave.fire(n)})),this.addDisposables(this._onDidChangeExpansionState,this.onDidChangeExpansionState(n=>{this.api._onDidExpansionChange.fire({isExpanded:n})}),this.api.onDidFocusChange(n=>{this.header&&(n.isFocused?ac(this.header,"focused"):Xl(this.header,"focused"))})),this.renderOnce()}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}isExpanded(){return this._isExpanded}setExpanded(e){this._isExpanded!==e&&(this._isExpanded=e,e?(this.animationTimer&&clearTimeout(this.animationTimer),this.body&&this.element.appendChild(this.body)):this.animationTimer=setTimeout(()=>{var n;(n=this.body)===null||n===void 0||n.remove()},200),this._onDidChange.fire(e?{size:this.width}:{}),this._onDidChangeExpansionState.fire(e))}layout(e,n){this._size=e,this._orthogonalSize=n;const[s,l]=this.orientation===ke.HORIZONTAL?[e,n]:[n,e];super.layout(s,l)}init(e){var n,s;super.init(e),typeof e.minimumBodySize=="number"&&(this.minimumBodySize=e.minimumBodySize),typeof e.maximumBodySize=="number"&&(this.maximumBodySize=e.maximumBodySize),this.bodyPart=this.getBodyComponent(),this.headerPart=this.getHeaderComponent(),this.bodyPart.init(Object.assign(Object.assign({},e),{api:this.api})),this.headerPart.init(Object.assign(Object.assign({},e),{api:this.api})),(n=this.body)===null||n===void 0||n.append(this.bodyPart.element),(s=this.header)===null||s===void 0||s.append(this.headerPart.element),typeof e.isExpanded=="boolean"&&this.setExpanded(e.isExpanded)}toJSON(){const e=this._params;return Object.assign(Object.assign({},super.toJSON()),{headerComponent:this.headerComponent,title:e.title})}renderOnce(){this.header=document.createElement("div"),this.header.tabIndex=0,this.header.className="dv-pane-header",this.header.style.height=`${this.headerSize}px`,this.header.style.lineHeight=`${this.headerSize}px`,this.header.style.minHeight=`${this.headerSize}px`,this.header.style.maxHeight=`${this.headerSize}px`,this.element.appendChild(this.header),this.body=document.createElement("div"),this.body.className="dv-pane-body",this.element.appendChild(this.body)}getComponent(){return{update:e=>{var n,s;(n=this.bodyPart)===null||n===void 0||n.update({params:e}),(s=this.headerPart)===null||s===void 0||s.update({params:e})},dispose:()=>{var e,n;(e=this.bodyPart)===null||e===void 0||e.dispose(),(n=this.headerPart)===null||n===void 0||n.dispose()}}}}class MC extends NC{constructor(e){super({id:e.id,component:e.component,headerComponent:e.headerComponent,orientation:e.orientation,isExpanded:e.isExpanded,isHeaderVisible:!0,headerSize:e.headerSize,minimumBodySize:e.minimumBodySize,maximumBodySize:e.maximumBodySize}),this._onDidDrop=new U,this.onDidDrop=this._onDidDrop.event,this._onUnhandledDragOverEvent=new U,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,this.accessor=e.accessor,this.addDisposables(this._onDidDrop,this._onUnhandledDragOverEvent),e.disableDnd||this.initDragFeatures()}initDragFeatures(){if(!this.header)return;const e=this.id,n=this.accessor.id;this.header.draggable=!0,this.handler=new class extends nf{getData(){return Ds.getInstance().setData([new Yl(n,e)],Yl.prototype),{dispose:()=>{Ds.getInstance().clearData(Yl.prototype)}}}}(this.header),this.target=new rs(this.element,{acceptedTargetZones:["top","bottom"],overlayModel:{activationSize:{type:"percentage",value:50}},canDisplayOverlay:(s,l)=>{const a=Ll();if(a&&a.paneId!==this.id&&a.viewId===this.accessor.id)return!0;const c=new IC(s,l,Ll,this);return this._onUnhandledDragOverEvent.fire(c),c.isAccepted}}),this.addDisposables(this._onDidDrop,this.handler,this.target,this.target.onDrop(s=>{this.onDrop(s)}))}onDrop(e){const n=Ll();if(!n||n.viewId!==this.accessor.id){this._onDidDrop.fire(Object.assign(Object.assign({},e),{panel:this,api:new ea(this.accessor),getData:Ll}));return}const s=this._params.containerApi,l=n.paneId,a=s.getPanel(l);if(!a){this._onDidDrop.fire(Object.assign(Object.assign({},e),{panel:this,getData:Ll,api:new ea(this.accessor)}));return}const c=s.panels,d=c.indexOf(a);let h=s.panels.indexOf(this);(e.position==="left"||e.position==="top")&&(h=Math.max(0,h-1)),(e.position==="right"||e.position==="bottom")&&(d>h&&h++,h=Math.min(c.length-1,h)),s.movePanel(d,h)}}class LC extends Ne{get element(){return this._element}constructor(e,n){super(),this.accessor=e,this.group=n,this.disposable=new Bn,this._onDidFocus=new U,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new U,this.onDidBlur=this._onDidBlur.event,this._element=document.createElement("div"),this._element.className="dv-content-container",this._element.tabIndex=-1,this.addDisposables(this._onDidFocus,this._onDidBlur);const s=n.dropTargetContainer;this.dropTarget=new rs(this.element,{getOverlayOutline:()=>{var l;return((l=e.options.theme)===null||l===void 0?void 0:l.dndPanelOverlay)==="group"?this.element.parentElement:null},className:"dv-drop-target-content",acceptedTargetZones:["top","bottom","left","right","center"],canDisplayOverlay:(l,a)=>{if(this.group.locked==="no-drop-target"||this.group.locked&&a==="center")return!1;const c=Hn();return!c&&l.shiftKey&&this.group.location.type!=="floating"?!1:c&&c.viewId===this.accessor.id?!0:this.group.canDisplayOverlay(l,a,"content")},getOverrideTarget:s?()=>s.model:void 0}),this.addDisposables(this.dropTarget)}show(){this.element.style.display=""}hide(){this.element.style.display="none"}renderPanel(e,n={asActive:!0}){const s=n.asActive||this.panel&&this.group.isPanelActive(this.panel);this.panel&&this.panel.view.content.element.parentElement===this._element&&this._element.removeChild(this.panel.view.content.element),this.panel=e;let l;switch(e.api.renderer){case"onlyWhenVisible":this.group.renderContainer.detatch(e),this.panel&&s&&this._element.appendChild(this.panel.view.content.element),l=this._element;break;case"always":e.view.content.element.parentElement===this._element&&this._element.removeChild(e.view.content.element),l=this.group.renderContainer.attach({panel:e,referenceContainer:this});break;default:throw new Error(`dockview: invalid renderer type '${e.api.renderer}'`)}if(s){const a=qv(l);this.focusTracker=a;const c=new Ne;c.addDisposables(a,a.onDidFocus(()=>this._onDidFocus.fire()),a.onDidBlur(()=>this._onDidBlur.fire())),this.disposable.value=c}}openPanel(e){this.panel!==e&&this.renderPanel(e)}layout(e,n){}closePanel(){var e;this.panel&&this.panel.api.renderer==="onlyWhenVisible"&&((e=this.panel.view.content.element.parentElement)===null||e===void 0||e.removeChild(this.panel.view.content.element)),this.panel=void 0}dispose(){this.disposable.dispose(),super.dispose()}refreshFocusState(){var e;!((e=this.focusTracker)===null||e===void 0)&&e.refreshState&&this.focusTracker.refreshState()}}function dw(r,e,n){var s,l;ac(e,"dv-dragged"),e.style.top="-9999px",document.body.appendChild(e),r.setDragImage(e,(s=n==null?void 0:n.x)!==null&&s!==void 0?s:0,(l=n==null?void 0:n.y)!==null&&l!==void 0?l:0),setTimeout(()=>{Xl(e,"dv-dragged"),e.remove()},0)}class VC extends nf{constructor(e,n,s,l,a){super(e,a),this.accessor=n,this.group=s,this.panel=l,this.panelTransfer=Ds.getInstance()}getData(e){return this.panelTransfer.setData([new _r(this.accessor.id,this.group.id,this.panel.id)],_r.prototype),{dispose:()=>{this.panelTransfer.clearData(_r.prototype)}}}}class GC extends Ne{get element(){return this._element}constructor(e,n,s){super(),this.panel=e,this.accessor=n,this.group=s,this.content=void 0,this._onPointDown=new U,this.onPointerDown=this._onPointDown.event,this._onDropped=new U,this.onDrop=this._onDropped.event,this._onDragStart=new U,this.onDragStart=this._onDragStart.event,this._element=document.createElement("div"),this._element.className="dv-tab",this._element.tabIndex=0,this._element.draggable=!this.accessor.options.disableDnd,Re(this.element,"dv-inactive-tab",!0),this.dragHandler=new VC(this._element,this.accessor,this.group,this.panel,!!this.accessor.options.disableDnd),this.dropTarget=new rs(this._element,{acceptedTargetZones:["left","right"],overlayModel:{activationSize:{value:50,type:"percentage"}},canDisplayOverlay:(l,a)=>{if(this.group.locked)return!1;const c=Hn();return c&&this.accessor.id===c.viewId?!0:this.group.model.canDisplayOverlay(l,a,"tab")},getOverrideTarget:()=>{var l;return(l=s.model.dropTargetContainer)===null||l===void 0?void 0:l.model}}),this.onWillShowOverlay=this.dropTarget.onWillShowOverlay,this.addDisposables(this._onPointDown,this._onDropped,this._onDragStart,this.dragHandler.onDragStart(l=>{if(l.dataTransfer){const a=getComputedStyle(this.element),c=this.element.cloneNode(!0);Array.from(a).forEach(d=>c.style.setProperty(d,a.getPropertyValue(d),a.getPropertyPriority(d))),c.style.position="absolute",dw(l.dataTransfer,c,{y:-10,x:30})}this._onDragStart.fire(l)}),this.dragHandler,Be(this._element,"pointerdown",l=>{this._onPointDown.fire(l)}),this.dropTarget.onDrop(l=>{this._onDropped.fire(l)}),this.dropTarget)}setActive(e){Re(this.element,"dv-active-tab",e),Re(this.element,"dv-inactive-tab",!e)}setContent(e){this.content&&this._element.removeChild(this.content.element),this.content=e,this._element.appendChild(this.content.element)}updateDragAndDropState(){this._element.draggable=!this.accessor.options.disableDnd,this.dragHandler.setDisabled(!!this.accessor.options.disableDnd)}dispose(){super.dispose()}}class cc{get kind(){return this.options.kind}get nativeEvent(){return this.event.nativeEvent}get position(){return this.event.position}get defaultPrevented(){return this.event.defaultPrevented}get panel(){return this.options.panel}get api(){return this.options.api}get group(){return this.options.group}preventDefault(){this.event.preventDefault()}getData(){return this.options.getData()}constructor(e,n){this.event=e,this.options=n}}class WC extends nf{constructor(e,n,s,l){super(e,l),this.accessor=n,this.group=s,this.panelTransfer=Ds.getInstance(),this.addDisposables(Be(e,"pointerdown",a=>{a.shiftKey&&iC(a)},!0))}isCancelled(e){return this.group.api.location.type==="floating"&&!e.shiftKey}getData(e){const n=e.dataTransfer;this.panelTransfer.setData([new _r(this.accessor.id,this.group.id,null)],_r.prototype);const s=window.getComputedStyle(this.el),l=s.getPropertyValue("--dv-activegroup-visiblepanel-tab-background-color"),a=s.getPropertyValue("--dv-activegroup-visiblepanel-tab-color");if(n){const c=document.createElement("div");c.style.backgroundColor=l,c.style.color=a,c.style.padding="2px 8px",c.style.height="24px",c.style.fontSize="11px",c.style.lineHeight="20px",c.style.borderRadius="12px",c.style.position="absolute",c.style.pointerEvents="none",c.style.top="-9999px",c.textContent=`Multiple Panels (${this.group.size})`,dw(n,c,{y:-10,x:30})}return{dispose:()=>{this.panelTransfer.clearData(_r.prototype)}}}}class FC extends Ne{get element(){return this._element}constructor(e,n){super(),this.accessor=e,this.group=n,this._onDrop=new U,this.onDrop=this._onDrop.event,this._onDragStart=new U,this.onDragStart=this._onDragStart.event,this._element=document.createElement("div"),this._element.className="dv-void-container",this._element.draggable=!this.accessor.options.disableDnd,Re(this._element,"dv-draggable",!this.accessor.options.disableDnd),this.addDisposables(this._onDrop,this._onDragStart,Be(this._element,"pointerdown",()=>{this.accessor.doSetGroupActive(this.group)})),this.handler=new WC(this._element,e,n,!!this.accessor.options.disableDnd),this.dropTarget=new rs(this._element,{acceptedTargetZones:["center"],canDisplayOverlay:(s,l)=>{const a=Hn();return a&&this.accessor.id===a.viewId?!0:n.model.canDisplayOverlay(s,l,"header_space")},getOverrideTarget:()=>{var s;return(s=n.model.dropTargetContainer)===null||s===void 0?void 0:s.model}}),this.onWillShowOverlay=this.dropTarget.onWillShowOverlay,this.addDisposables(this.handler,this.handler.onDragStart(s=>{this._onDragStart.fire(s)}),this.dropTarget.onDrop(s=>{this._onDrop.fire(s)}),this.dropTarget)}updateDragAndDropState(){this._element.draggable=!this.accessor.options.disableDnd,Re(this._element,"dv-draggable",!this.accessor.options.disableDnd),this.handler.setDisabled(!!this.accessor.options.disableDnd)}}class dc extends Ne{get element(){return this._element}constructor(e){super(),this.scrollableElement=e,this._scrollLeft=0,this._element=document.createElement("div"),this._element.className="dv-scrollable",this._horizontalScrollbar=document.createElement("div"),this._horizontalScrollbar.className="dv-scrollbar-horizontal",this.element.appendChild(e),this.element.appendChild(this._horizontalScrollbar),this.addDisposables(Be(this.element,"wheel",n=>{this._scrollLeft+=n.deltaY*dc.MouseWheelSpeed,this.calculateScrollbarStyles()}),Be(this._horizontalScrollbar,"pointerdown",n=>{n.preventDefault(),Re(this.element,"dv-scrollable-scrolling",!0);const s=n.clientX,l=this._scrollLeft,a=d=>{const h=d.clientX-s,{clientWidth:m}=this.element,{scrollWidth:w}=this.scrollableElement,v=m/w;this._scrollLeft=l+h/v,this.calculateScrollbarStyles()},c=()=>{Re(this.element,"dv-scrollable-scrolling",!1),document.removeEventListener("pointermove",a),document.removeEventListener("pointerup",c),document.removeEventListener("pointercancel",c)};document.addEventListener("pointermove",a),document.addEventListener("pointerup",c),document.addEventListener("pointercancel",c)}),Be(this.element,"scroll",()=>{this.calculateScrollbarStyles()}),Be(this.scrollableElement,"scroll",()=>{this._scrollLeft=this.scrollableElement.scrollLeft,this.calculateScrollbarStyles()}),lc(this.element,()=>{Re(this.element,"dv-scrollable-resizing",!0),this._animationTimer&&clearTimeout(this._animationTimer),this._animationTimer=setTimeout(()=>{clearTimeout(this._animationTimer),Re(this.element,"dv-scrollable-resizing",!1)},500),this.calculateScrollbarStyles()}))}calculateScrollbarStyles(){const{clientWidth:e}=this.element,{scrollWidth:n}=this.scrollableElement;if(n>e){const l=e*(e/n);this._horizontalScrollbar.style.width=`${l}px`,this._scrollLeft=_t(this._scrollLeft,0,this.scrollableElement.scrollWidth-e),this.scrollableElement.scrollLeft=this._scrollLeft;const a=this._scrollLeft/(n-e);this._horizontalScrollbar.style.left=`${(e-l)*a}px`}else this._horizontalScrollbar.style.width="0px",this._horizontalScrollbar.style.left="0px",this._scrollLeft=0}}dc.MouseWheelSpeed=1;class HC extends Ne{get showTabsOverflowControl(){return this._showTabsOverflowControl}set showTabsOverflowControl(e){if(this._showTabsOverflowControl!=e&&(this._showTabsOverflowControl=e,e)){const n=new tC(this._tabsList);this._observerDisposable.value=new Ne(n,n.onDidChange(s=>{const l=s.hasScrollX||s.hasScrollY;this.toggleDropdown({reset:!l})}),Be(this._tabsList,"scroll",()=>{this.toggleDropdown({reset:!1})}))}}get element(){return this._element}get panels(){return this._tabs.map(e=>e.value.panel.id)}get size(){return this._tabs.length}get tabs(){return this._tabs.map(e=>e.value)}constructor(e,n,s){if(super(),this.group=e,this.accessor=n,this._observerDisposable=new Bn,this._tabs=[],this.selectedIndex=-1,this._showTabsOverflowControl=!1,this._onTabDragStart=new U,this.onTabDragStart=this._onTabDragStart.event,this._onDrop=new U,this.onDrop=this._onDrop.event,this._onWillShowOverlay=new U,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onOverflowTabsChange=new U,this.onOverflowTabsChange=this._onOverflowTabsChange.event,this._tabsList=document.createElement("div"),this._tabsList.className="dv-tabs-container dv-horizontal",this.showTabsOverflowControl=s.showTabsOverflowControl,n.options.scrollbars==="native")this._element=this._tabsList;else{const l=new dc(this._tabsList);this._element=l.element,this.addDisposables(l)}this.addDisposables(this._onOverflowTabsChange,this._observerDisposable,this._onWillShowOverlay,this._onDrop,this._onTabDragStart,Be(this.element,"pointerdown",l=>{if(l.defaultPrevented)return;l.button===0&&this.accessor.doSetGroupActive(this.group)}),Qt.from(()=>{for(const{value:l,disposable:a}of this._tabs)a.dispose(),l.dispose();this._tabs=[]}))}indexOf(e){return this._tabs.findIndex(n=>n.value.panel.id===e)}isActive(e){return this.selectedIndex>-1&&this._tabs[this.selectedIndex].value===e}setActivePanel(e){let n=0;for(const s of this._tabs){const l=e.id===s.value.panel.id;if(s.value.setActive(l),l){const a=s.value.element,c=a.parentElement;(nc.scrollLeft+c.clientWidth)&&(c.scrollLeft=n)}n+=s.value.element.clientWidth}}openPanel(e,n=this._tabs.length){if(this._tabs.find(c=>c.value.panel.id===e.id))return;const s=new GC(e,this.accessor,this.group);s.setContent(e.view.tab);const l=new Ne(s.onDragStart(c=>{this._onTabDragStart.fire({nativeEvent:c,panel:e})}),s.onPointerDown(c=>{if(c.defaultPrevented)return;const d=!this.accessor.options.disableFloatingGroups,h=this.group.api.location.type==="floating"&&this.size===1;if(d&&!h&&c.shiftKey){c.preventDefault();const m=this.accessor.getGroupPanel(s.panel.id),{top:w,left:v}=s.element.getBoundingClientRect(),{top:S,left:E}=this.accessor.element.getBoundingClientRect();this.accessor.addFloatingGroup(m,{x:v-E,y:w-S,inDragMode:!0});return}switch(c.button){case 0:this.group.activePanel!==e&&this.group.model.openPanel(e);break}}),s.onDrop(c=>{this._onDrop.fire({event:c.nativeEvent,index:this._tabs.findIndex(d=>d.value===s)})}),s.onWillShowOverlay(c=>{this._onWillShowOverlay.fire(new cc(c,{kind:"tab",panel:this.group.activePanel,api:this.accessor.api,group:this.group,getData:Hn}))})),a={value:s,disposable:l};this.addTab(a,n)}delete(e){const n=this.indexOf(e),s=this._tabs.splice(n,1)[0],{value:l,disposable:a}=s;a.dispose(),l.dispose(),l.element.remove()}addTab(e,n=this._tabs.length){if(n<0||n>this._tabs.length)throw new Error("invalid location");this._tabsList.insertBefore(e.value.element,this._tabsList.children[n]),this._tabs=[...this._tabs.slice(0,n),e,...this._tabs.slice(n)],this.selectedIndex<0&&(this.selectedIndex=n)}toggleDropdown(e){const n=e.reset?[]:this._tabs.filter(s=>!uC(s.value.element,this._tabsList)).map(s=>s.value.panel.id);this._onOverflowTabsChange.fire({tabs:n,reset:e.reset})}updateDragAndDropState(){for(const e of this._tabs)e.value.updateDragAndDropState()}}const rf=r=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttributeNS(null,"height",r.height),e.setAttributeNS(null,"width",r.width),e.setAttributeNS(null,"viewBox",r.viewbox),e.setAttributeNS(null,"aria-hidden","false"),e.setAttributeNS(null,"focusable","false"),e.classList.add("dv-svg");const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttributeNS(null,"d",r.path),e.appendChild(n),e},jC=()=>rf({width:"11",height:"11",viewbox:"0 0 28 28",path:"M2.1 27.3L0 25.2L11.55 13.65L0 2.1L2.1 0L13.65 11.55L25.2 0L27.3 2.1L15.75 13.65L27.3 25.2L25.2 27.3L13.65 15.75L2.1 27.3Z"}),BC=()=>rf({width:"11",height:"11",viewbox:"0 0 24 15",path:"M12 14.15L0 2.15L2.15 0L12 9.9L21.85 0.0499992L24 2.2L12 14.15Z"}),hw=()=>rf({width:"11",height:"11",viewbox:"0 0 15 25",path:"M2.15 24.1L0 21.95L9.9 12.05L0 2.15L2.15 0L14.2 12.05L2.15 24.1Z"});function UC(){const r=document.createElement("div");r.className="dv-tabs-overflow-dropdown-default";const e=document.createElement("span");e.textContent="";const n=hw();return r.appendChild(n),r.appendChild(e),{element:r,update:s=>{e.textContent=`${s.tabs}`}}}class $C extends Ne{get onTabDragStart(){return this.tabs.onTabDragStart}get panels(){return this.tabs.panels}get size(){return this.tabs.size}get hidden(){return this._hidden}set hidden(e){this._hidden=e,this.element.style.display=e?"none":""}get element(){return this._element}constructor(e,n){super(),this.accessor=e,this.group=n,this._hidden=!1,this.dropdownPart=null,this._overflowTabs=[],this._dropdownDisposable=new Bn,this._onDrop=new U,this.onDrop=this._onDrop.event,this._onGroupDragStart=new U,this.onGroupDragStart=this._onGroupDragStart.event,this._onWillShowOverlay=new U,this.onWillShowOverlay=this._onWillShowOverlay.event,this._element=document.createElement("div"),this._element.className="dv-tabs-and-actions-container",Re(this._element,"dv-full-width-single-tab",this.accessor.options.singleTabMode==="fullwidth"),this.rightActionsContainer=document.createElement("div"),this.rightActionsContainer.className="dv-right-actions-container",this.leftActionsContainer=document.createElement("div"),this.leftActionsContainer.className="dv-left-actions-container",this.preActionsContainer=document.createElement("div"),this.preActionsContainer.className="dv-pre-actions-container",this.tabs=new HC(n,e,{showTabsOverflowControl:!e.options.disableTabsOverflowList}),this.voidContainer=new FC(this.accessor,this.group),this._element.appendChild(this.preActionsContainer),this._element.appendChild(this.tabs.element),this._element.appendChild(this.leftActionsContainer),this._element.appendChild(this.voidContainer.element),this._element.appendChild(this.rightActionsContainer),this.addDisposables(this.tabs.onDrop(s=>this._onDrop.fire(s)),this.tabs.onWillShowOverlay(s=>this._onWillShowOverlay.fire(s)),e.onDidOptionsChange(()=>{this.tabs.showTabsOverflowControl=!e.options.disableTabsOverflowList}),this.tabs.onOverflowTabsChange(s=>{this.toggleDropdown(s)}),this.tabs,this._onWillShowOverlay,this._onDrop,this._onGroupDragStart,this.voidContainer,this.voidContainer.onDragStart(s=>{this._onGroupDragStart.fire({nativeEvent:s,group:this.group})}),this.voidContainer.onDrop(s=>{this._onDrop.fire({event:s.nativeEvent,index:this.tabs.size})}),this.voidContainer.onWillShowOverlay(s=>{this._onWillShowOverlay.fire(new cc(s,{kind:"header_space",panel:this.group.activePanel,api:this.accessor.api,group:this.group,getData:Hn}))}),Be(this.voidContainer.element,"pointerdown",s=>{if(s.defaultPrevented)return;if(!this.accessor.options.disableFloatingGroups&&s.shiftKey&&this.group.api.location.type!=="floating"){s.preventDefault();const{top:a,left:c}=this.element.getBoundingClientRect(),{top:d,left:h}=this.accessor.element.getBoundingClientRect();this.accessor.addFloatingGroup(this.group,{x:c-h+20,y:a-d+20,inDragMode:!0})}}))}show(){this.hidden||(this.element.style.display="")}hide(){this._element.style.display="none"}setRightActionsElement(e){this.rightActions!==e&&(this.rightActions&&(this.rightActions.remove(),this.rightActions=void 0),e&&(this.rightActionsContainer.appendChild(e),this.rightActions=e))}setLeftActionsElement(e){this.leftActions!==e&&(this.leftActions&&(this.leftActions.remove(),this.leftActions=void 0),e&&(this.leftActionsContainer.appendChild(e),this.leftActions=e))}setPrefixActionsElement(e){this.preActions!==e&&(this.preActions&&(this.preActions.remove(),this.preActions=void 0),e&&(this.preActionsContainer.appendChild(e),this.preActions=e))}isActive(e){return this.tabs.isActive(e)}indexOf(e){return this.tabs.indexOf(e)}setActive(e){}delete(e){this.tabs.delete(e),this.updateClassnames()}setActivePanel(e){this.tabs.setActivePanel(e)}openPanel(e,n=this.tabs.size){this.tabs.openPanel(e,n),this.updateClassnames()}closePanel(e){this.delete(e.id)}updateClassnames(){Re(this._element,"dv-single-tab",this.size===1)}toggleDropdown(e){const n=e.reset?[]:e.tabs;if(this._overflowTabs=n,this._overflowTabs.length>0&&this.dropdownPart){this.dropdownPart.update({tabs:n.length});return}if(this._overflowTabs.length===0){this._dropdownDisposable.dispose();return}const s=document.createElement("div");s.className="dv-tabs-overflow-dropdown-root";const l=UC();l.update({tabs:n.length}),this.dropdownPart=l,s.appendChild(l.element),this.rightActionsContainer.prepend(s),this._dropdownDisposable.value=new Ne(Qt.from(()=>{var a,c;s.remove(),(c=(a=this.dropdownPart)===null||a===void 0?void 0:a.dispose)===null||c===void 0||c.call(a),this.dropdownPart=null}),Be(s,"pointerdown",a=>{a.preventDefault()},{capture:!0}),Be(s,"click",a=>{const c=document.createElement("div");c.style.overflow="auto",c.className="dv-tabs-overflow-container";for(const h of this.tabs.tabs.filter(m=>this._overflowTabs.includes(m.panel.id))){const m=this.group.panels.find(E=>E===h.panel),v=m.view.createTabRenderer("headerOverflow").element,S=document.createElement("div");Re(S,"dv-tab",!0),Re(S,"dv-active-tab",m.api.isActive),Re(S,"dv-inactive-tab",!m.api.isActive),S.addEventListener("click",E=>{this.accessor.popupService.close(),!E.defaultPrevented&&(h.element.scrollIntoView(),h.panel.api.setActive())}),S.appendChild(v),c.appendChild(S)}const d=fC(s);this.accessor.popupService.openPopover(c,{x:a.clientX,y:a.clientY,zIndex:d!=null&&d.style.zIndex?`calc(${d.style.zIndex} * 2)`:void 0})}))}updateDragAndDropState(){this.tabs.updateDragAndDropState(),this.voidContainer.updateDragAndDropState()}}class fw extends Xv{constructor(e,n,s,l,a){super(),this.nativeEvent=e,this.target=n,this.position=s,this.getData=l,this.group=a}}const Ph=Object.keys({disableAutoResizing:void 0,hideBorders:void 0,singleTabMode:void 0,disableFloatingGroups:void 0,floatingGroupBounds:void 0,popoutUrl:void 0,defaultRenderer:void 0,debug:void 0,rootOverlayModel:void 0,locked:void 0,disableDnd:void 0,className:void 0,noPanelsOverlay:void 0,dndEdges:void 0,theme:void 0,disableTabsOverflowList:void 0,scrollbars:void 0});function YC(r){return!!r.referencePanel}function KC(r){return!!r.referenceGroup}function JC(r){return!!r.referencePanel}function QC(r){return!!r.referenceGroup}class of extends qh{get nativeEvent(){return this.options.nativeEvent}get position(){return this.options.position}get panel(){return this.options.panel}get group(){return this.options.group}get api(){return this.options.api}constructor(e){super(),this.options=e}getData(){return this.options.getData()}}class pw extends of{get kind(){return this._kind}constructor(e){super(e),this._kind=e.kind}}class ZC extends Ne{get element(){throw new Error("dockview: not supported")}get activePanel(){return this._activePanel}get locked(){return this._locked}set locked(e){this._locked=e,Re(this.container,"dv-locked-groupview",e==="no-drop-target"||e)}get isActive(){return this._isGroupActive}get panels(){return this._panels}get size(){return this._panels.length}get isEmpty(){return this._panels.length===0}get hasWatermark(){return!!(this.watermark&&this.container.contains(this.watermark.element))}get header(){return this.tabsContainer}get isContentFocused(){return document.activeElement?_h(document.activeElement,this.contentContainer.element):!1}get location(){return this._location}set location(e){switch(this._location=e,Re(this.container,"dv-groupview-floating",!1),Re(this.container,"dv-groupview-popout",!1),e.type){case"grid":this.contentContainer.dropTarget.setTargetZones(["top","bottom","left","right","center"]);break;case"floating":this.contentContainer.dropTarget.setTargetZones(["center"]),this.contentContainer.dropTarget.setTargetZones(e?["center"]:["top","bottom","left","right","center"]),Re(this.container,"dv-groupview-floating",!0);break;case"popout":this.contentContainer.dropTarget.setTargetZones(["center"]),Re(this.container,"dv-groupview-popout",!0);break}this.groupPanel.api._onDidLocationChange.fire({location:this.location})}constructor(e,n,s,l,a){var c;super(),this.container=e,this.accessor=n,this.id=s,this.options=l,this.groupPanel=a,this._isGroupActive=!1,this._locked=!1,this._location={type:"grid"},this.mostRecentlyUsed=[],this._overwriteRenderContainer=null,this._overwriteDropTargetContainer=null,this._onDidChange=new U,this.onDidChange=this._onDidChange.event,this._width=0,this._height=0,this._panels=[],this._panelDisposables=new Map,this._onMove=new U,this.onMove=this._onMove.event,this._onDidDrop=new U,this.onDidDrop=this._onDidDrop.event,this._onWillDrop=new U,this.onWillDrop=this._onWillDrop.event,this._onWillShowOverlay=new U,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onTabDragStart=new U,this.onTabDragStart=this._onTabDragStart.event,this._onGroupDragStart=new U,this.onGroupDragStart=this._onGroupDragStart.event,this._onDidAddPanel=new U,this.onDidAddPanel=this._onDidAddPanel.event,this._onDidPanelTitleChange=new U,this.onDidPanelTitleChange=this._onDidPanelTitleChange.event,this._onDidPanelParametersChange=new U,this.onDidPanelParametersChange=this._onDidPanelParametersChange.event,this._onDidRemovePanel=new U,this.onDidRemovePanel=this._onDidRemovePanel.event,this._onDidActivePanelChange=new U,this.onDidActivePanelChange=this._onDidActivePanelChange.event,this._onUnhandledDragOverEvent=new U,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,Re(this.container,"dv-groupview",!0),this._api=new Yu(this.accessor),this.tabsContainer=new $C(this.accessor,this.groupPanel),this.contentContainer=new LC(this.accessor,this),e.append(this.tabsContainer.element,this.contentContainer.element),this.header.hidden=!!l.hideHeader,this.locked=(c=l.locked)!==null&&c!==void 0?c:!1,this.addDisposables(this._onTabDragStart,this._onGroupDragStart,this._onWillShowOverlay,this.tabsContainer.onTabDragStart(d=>{this._onTabDragStart.fire(d)}),this.tabsContainer.onGroupDragStart(d=>{this._onGroupDragStart.fire(d)}),this.tabsContainer.onDrop(d=>{this.handleDropEvent("header",d.event,"center",d.index)}),this.contentContainer.onDidFocus(()=>{this.accessor.doSetGroupActive(this.groupPanel)}),this.contentContainer.onDidBlur(()=>{}),this.contentContainer.dropTarget.onDrop(d=>{this.handleDropEvent("content",d.nativeEvent,d.position)}),this.tabsContainer.onWillShowOverlay(d=>{this._onWillShowOverlay.fire(d)}),this.contentContainer.dropTarget.onWillShowOverlay(d=>{this._onWillShowOverlay.fire(new cc(d,{kind:"content",panel:this.activePanel,api:this._api,group:this.groupPanel,getData:Hn}))}),this._onMove,this._onDidChange,this._onDidDrop,this._onWillDrop,this._onDidAddPanel,this._onDidRemovePanel,this._onDidActivePanelChange,this._onUnhandledDragOverEvent,this._onDidPanelTitleChange,this._onDidPanelParametersChange)}focusContent(){this.contentContainer.element.focus()}set renderContainer(e){this.panels.forEach(n=>{this.renderContainer.detatch(n)}),this._overwriteRenderContainer=e,this.panels.forEach(n=>{this.rerender(n)})}get renderContainer(){var e;return(e=this._overwriteRenderContainer)!==null&&e!==void 0?e:this.accessor.overlayRenderContainer}set dropTargetContainer(e){this._overwriteDropTargetContainer=e}get dropTargetContainer(){var e;return(e=this._overwriteDropTargetContainer)!==null&&e!==void 0?e:this.accessor.rootDropTargetContainer}initialize(){this.options.panels&&this.options.panels.forEach(e=>{this.doAddPanel(e)}),this.options.activePanel&&this.openPanel(this.options.activePanel),this.setActive(this.isActive,!0),this.updateContainer(),this.accessor.options.createRightHeaderActionComponent&&(this._rightHeaderActions=this.accessor.options.createRightHeaderActionComponent(this.groupPanel),this.addDisposables(this._rightHeaderActions),this._rightHeaderActions.init({containerApi:this._api,api:this.groupPanel.api,group:this.groupPanel}),this.tabsContainer.setRightActionsElement(this._rightHeaderActions.element)),this.accessor.options.createLeftHeaderActionComponent&&(this._leftHeaderActions=this.accessor.options.createLeftHeaderActionComponent(this.groupPanel),this.addDisposables(this._leftHeaderActions),this._leftHeaderActions.init({containerApi:this._api,api:this.groupPanel.api,group:this.groupPanel}),this.tabsContainer.setLeftActionsElement(this._leftHeaderActions.element)),this.accessor.options.createPrefixHeaderActionComponent&&(this._prefixHeaderActions=this.accessor.options.createPrefixHeaderActionComponent(this.groupPanel),this.addDisposables(this._prefixHeaderActions),this._prefixHeaderActions.init({containerApi:this._api,api:this.groupPanel.api,group:this.groupPanel}),this.tabsContainer.setPrefixActionsElement(this._prefixHeaderActions.element))}rerender(e){this.contentContainer.renderPanel(e,{asActive:!1})}indexOf(e){return this.tabsContainer.indexOf(e.id)}toJSON(){var e;const n={views:this.tabsContainer.panels,activeView:(e=this._activePanel)===null||e===void 0?void 0:e.id,id:this.id};return this.locked!==!1&&(n.locked=this.locked),this.header.hidden&&(n.hideHeader=!0),n}moveToNext(e){e||(e={}),e.panel||(e.panel=this.activePanel);const n=e.panel?this.panels.indexOf(e.panel):-1;let s;if(n0)s=n-1;else if(!e.suppressRoll)s=this.panels.length-1;else return;this.openPanel(this.panels[s])}containsPanel(e){return this.panels.includes(e)}init(e){}update(e){}focus(){var e;(e=this._activePanel)===null||e===void 0||e.focus()}openPanel(e,n={}){(typeof n.index!="number"||n.index>this.panels.length)&&(n.index=this.panels.length);const s=!!n.skipSetActive;if(e.updateParentGroup(this.groupPanel,{skipSetActive:n.skipSetActive}),this.doAddPanel(e,n.index,{skipSetActive:s}),this._activePanel===e){this.contentContainer.renderPanel(e,{asActive:!0});return}s||this.doSetActivePanel(e),n.skipSetGroupActive||this.accessor.doSetGroupActive(this.groupPanel),n.skipSetActive||this.updateContainer()}removePanel(e,n={skipSetActive:!1}){const s=typeof e=="string"?e:e.id,l=this._panels.find(a=>a.id===s);if(!l)throw new Error("invalid operation");return this._removePanel(l,n)}closeAllPanels(){if(this.panels.length>0){const e=[...this.panels];for(const n of e)this.doClose(n)}else this.accessor.removeGroup(this.groupPanel)}closePanel(e){this.doClose(e)}doClose(e){const n=this.panels.length===1&&this.accessor.groups.length===1;this.accessor.removePanel(e,n&&this.accessor.options.noPanelsOverlay==="emptyGroup"?{removeEmptyGroup:!1}:void 0)}isPanelActive(e){return this._activePanel===e}updateActions(e){this.tabsContainer.setRightActionsElement(e)}setActive(e,n=!1){!n&&this.isActive===e||(this._isGroupActive=e,Re(this.container,"dv-active-group",e),Re(this.container,"dv-inactive-group",!e),this.tabsContainer.setActive(this.isActive),!this._activePanel&&this.panels.length>0&&this.doSetActivePanel(this.panels[0]),this.updateContainer())}layout(e,n){var s;this._width=e,this._height=n,this.contentContainer.layout(this._width,this._height),!((s=this._activePanel)===null||s===void 0)&&s.layout&&this._activePanel.layout(this._width,this._height)}_removePanel(e,n){const s=this._activePanel===e;if(this.doRemovePanel(e),s&&this.panels.length>0){const l=this.mostRecentlyUsed[0];this.openPanel(l,{skipSetActive:n.skipSetActive,skipSetGroupActive:n.skipSetActiveGroup})}return this._activePanel&&this.panels.length===0&&this.doSetActivePanel(void 0),n.skipSetActive||this.updateContainer(),e}doRemovePanel(e){const n=this.panels.indexOf(e);if(this._activePanel===e&&this.contentContainer.closePanel(),this.tabsContainer.delete(e.id),this._panels.splice(n,1),this.mostRecentlyUsed.includes(e)){const l=this.mostRecentlyUsed.indexOf(e);this.mostRecentlyUsed.splice(l,1)}const s=this._panelDisposables.get(e.id);s&&(s.dispose(),this._panelDisposables.delete(e.id)),this._onDidRemovePanel.fire({panel:e})}doAddPanel(e,n=this.panels.length,s={skipSetActive:!1}){const a=this._panels.indexOf(e)>-1;this.tabsContainer.show(),this.contentContainer.show(),this.tabsContainer.openPanel(e,n),s.skipSetActive||this.contentContainer.openPanel(e),!a&&(this.updateMru(e),this.panels.splice(n,0,e),this._panelDisposables.set(e.id,new Ne(e.api.onDidTitleChange(c=>this._onDidPanelTitleChange.fire(c)),e.api.onDidParametersChange(c=>this._onDidPanelParametersChange.fire(c)))),this._onDidAddPanel.fire({panel:e}))}doSetActivePanel(e){this._activePanel!==e&&(this._activePanel=e,e&&(this.tabsContainer.setActivePanel(e),this.contentContainer.openPanel(e),e.layout(this._width,this._height),this.updateMru(e),this.contentContainer.refreshFocusState(),this._onDidActivePanelChange.fire({panel:e})))}updateMru(e){this.mostRecentlyUsed.includes(e)&&this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(e),1),this.mostRecentlyUsed=[e,...this.mostRecentlyUsed]}updateContainer(){var e,n;if(this.panels.forEach(s=>s.runEvents()),this.isEmpty&&!this.watermark){const s=this.accessor.createWatermarkComponent();s.init({containerApi:this._api,group:this.groupPanel}),this.watermark=s,Be(this.watermark.element,"pointerdown",()=>{this.isActive||this.accessor.doSetGroupActive(this.groupPanel)}),this.contentContainer.element.appendChild(this.watermark.element)}!this.isEmpty&&this.watermark&&(this.watermark.element.remove(),(n=(e=this.watermark).dispose)===null||n===void 0||n.call(e),this.watermark=void 0)}canDisplayOverlay(e,n,s){const l=new fw(e,s,n,Hn,this.accessor.getPanel(this.id));return this._onUnhandledDragOverEvent.fire(l),l.isAccepted}handleDropEvent(e,n,s,l){if(this.locked==="no-drop-target")return;function a(){switch(e){case"header":return typeof l=="number"?"tab":"header_space";case"content":return"content"}}const c=typeof l=="number"?this.panels[l]:void 0,d=new pw({nativeEvent:n,position:s,panel:c,getData:()=>Hn(),kind:a(),group:this.groupPanel,api:this._api});if(this._onWillDrop.fire(d),d.defaultPrevented)return;const h=Hn();if(h&&h.viewId===this.accessor.id){if(e==="content"&&h.groupId===this.id&&(s==="center"||h.panelId===null)||e==="header"&&h.groupId===this.id&&h.panelId===null)return;if(h.panelId===null){const{groupId:E}=h;this._onMove.fire({target:s,groupId:E,index:l});return}if(this.tabsContainer.indexOf(h.panelId)!==-1&&this.tabsContainer.size===1)return;const{groupId:w,panelId:v}=h;if(this.id===w&&!s&&this.tabsContainer.indexOf(v)===l)return;this._onMove.fire({target:s,groupId:h.groupId,itemId:h.panelId,index:l})}else this._onDidDrop.fire(new of({nativeEvent:n,position:s,panel:c,getData:()=>Hn(),group:this.groupPanel,api:this._api}))}updateDragAndDropState(){this.tabsContainer.updateDragAndDropState()}dispose(){var e,n,s;super.dispose(),(e=this.watermark)===null||e===void 0||e.element.remove(),(s=(n=this.watermark)===null||n===void 0?void 0:n.dispose)===null||s===void 0||s.call(n),this.watermark=void 0;for(const l of this.panels)l.dispose();this.tabsContainer.dispose(),this.contentContainer.dispose()}}class lf extends uw{constructor(e,n,s){super(e,n),this._onDidConstraintsChangeInternal=new U,this.onDidConstraintsChangeInternal=this._onDidConstraintsChangeInternal.event,this._onDidConstraintsChange=new U,this.onDidConstraintsChange=this._onDidConstraintsChange.event,this._onDidSizeChange=new U,this.onDidSizeChange=this._onDidSizeChange.event,this.addDisposables(this._onDidConstraintsChangeInternal,this._onDidConstraintsChange,this._onDidSizeChange),s&&this.initialize(s)}setConstraints(e){this._onDidConstraintsChangeInternal.fire(e)}setSize(e){this._onDidSizeChange.fire(e)}}class mw extends sf{get priority(){return this._priority}get snap(){return this._snap}get minimumWidth(){return this.__minimumWidth()}get minimumHeight(){return this.__minimumHeight()}get maximumHeight(){return this.__maximumHeight()}get maximumWidth(){return this.__maximumWidth()}__minimumWidth(){const e=typeof this._minimumWidth=="function"?this._minimumWidth():this._minimumWidth;return e!==this._evaluatedMinimumWidth&&(this._evaluatedMinimumWidth=e,this.updateConstraints()),e}__maximumWidth(){const e=typeof this._maximumWidth=="function"?this._maximumWidth():this._maximumWidth;return e!==this._evaluatedMaximumWidth&&(this._evaluatedMaximumWidth=e,this.updateConstraints()),e}__minimumHeight(){const e=typeof this._minimumHeight=="function"?this._minimumHeight():this._minimumHeight;return e!==this._evaluatedMinimumHeight&&(this._evaluatedMinimumHeight=e,this.updateConstraints()),e}__maximumHeight(){const e=typeof this._maximumHeight=="function"?this._maximumHeight():this._maximumHeight;return e!==this._evaluatedMaximumHeight&&(this._evaluatedMaximumHeight=e,this.updateConstraints()),e}get isActive(){return this.api.isActive}get isVisible(){return this.api.isVisible}constructor(e,n,s,l){super(e,n,l??new lf(e,n)),this._evaluatedMinimumWidth=0,this._evaluatedMaximumWidth=Number.MAX_SAFE_INTEGER,this._evaluatedMinimumHeight=0,this._evaluatedMaximumHeight=Number.MAX_SAFE_INTEGER,this._minimumWidth=0,this._minimumHeight=0,this._maximumWidth=Number.MAX_SAFE_INTEGER,this._maximumHeight=Number.MAX_SAFE_INTEGER,this._snap=!1,this._onDidChange=new U,this.onDidChange=this._onDidChange.event,typeof(s==null?void 0:s.minimumWidth)=="number"&&(this._minimumWidth=s.minimumWidth),typeof(s==null?void 0:s.maximumWidth)=="number"&&(this._maximumWidth=s.maximumWidth),typeof(s==null?void 0:s.minimumHeight)=="number"&&(this._minimumHeight=s.minimumHeight),typeof(s==null?void 0:s.maximumHeight)=="number"&&(this._maximumHeight=s.maximumHeight),this.api.initialize(this),this.addDisposables(this.api.onWillVisibilityChange(a=>{const{isVisible:c}=a,{accessor:d}=this._params;d.setVisible(this,c)}),this.api.onActiveChange(()=>{const{accessor:a}=this._params;a.doSetGroupActive(this)}),this.api.onDidConstraintsChangeInternal(a=>{(typeof a.minimumWidth=="number"||typeof a.minimumWidth=="function")&&(this._minimumWidth=a.minimumWidth),(typeof a.minimumHeight=="number"||typeof a.minimumHeight=="function")&&(this._minimumHeight=a.minimumHeight),(typeof a.maximumWidth=="number"||typeof a.maximumWidth=="function")&&(this._maximumWidth=a.maximumWidth),(typeof a.maximumHeight=="number"||typeof a.maximumHeight=="function")&&(this._maximumHeight=a.maximumHeight)}),this.api.onDidSizeChange(a=>{this._onDidChange.fire({height:a.height,width:a.width})}),this._onDidChange)}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}init(e){e.maximumHeight&&(this._maximumHeight=e.maximumHeight),e.minimumHeight&&(this._minimumHeight=e.minimumHeight),e.maximumWidth&&(this._maximumWidth=e.maximumWidth),e.minimumWidth&&(this._minimumWidth=e.minimumWidth),this._priority=e.priority,this._snap=!!e.snap,super.init(e),typeof e.isVisible=="boolean"&&this.setVisible(e.isVisible)}updateConstraints(){this.api._onDidConstraintsChange.fire({minimumWidth:this._evaluatedMinimumWidth,maximumWidth:this._evaluatedMaximumWidth,minimumHeight:this._evaluatedMinimumHeight,maximumHeight:this._evaluatedMaximumHeight})}toJSON(){const e=super.toJSON(),n=l=>l===Number.MAX_SAFE_INTEGER?void 0:l,s=l=>l<=0?void 0:l;return Object.assign(Object.assign({},e),{minimumHeight:s(this.minimumHeight),maximumHeight:n(this.maximumHeight),minimumWidth:s(this.minimumWidth),maximumWidth:n(this.maximumWidth),snap:this.snap,priority:this.priority})}}const Vl="dockview: DockviewGroupPanelApiImpl not initialized";class XC extends lf{get location(){if(!this._group)throw new Error(Vl);return this._group.model.location}constructor(e,n){super(e,"__dockviewgroup__"),this.accessor=n,this._onDidLocationChange=new U,this.onDidLocationChange=this._onDidLocationChange.event,this._onDidActivePanelChange=new U,this.onDidActivePanelChange=this._onDidActivePanelChange.event,this.addDisposables(this._onDidLocationChange,this._onDidActivePanelChange,this._onDidVisibilityChange.event(s=>{s.isVisible&&this._pendingSize&&(super.setSize(this._pendingSize),this._pendingSize=void 0)}))}setSize(e){this._pendingSize=Object.assign({},e),super.setSize(e)}close(){if(this._group)return this.accessor.removeGroup(this._group)}getWindow(){return this.location.type==="popout"?this.location.getWindow():window}moveTo(e){var n,s,l,a;if(!this._group)throw new Error(Vl);const c=(n=e.group)!==null&&n!==void 0?n:this.accessor.addGroup({direction:bC((s=e.position)!==null&&s!==void 0?s:"right"),skipSetActive:(l=e.skipSetActive)!==null&&l!==void 0?l:!1});this.accessor.moveGroupOrPanel({from:{groupId:this._group.id},to:{group:c,position:e.group&&(a=e.position)!==null&&a!==void 0?a:"center",index:e.index},skipSetActive:e.skipSetActive})}maximize(){if(!this._group)throw new Error(Vl);this.location.type==="grid"&&this.accessor.maximizeGroup(this._group)}isMaximized(){if(!this._group)throw new Error(Vl);return this.accessor.isMaximizedGroup(this._group)}exitMaximized(){if(!this._group)throw new Error(Vl);this.isMaximized()&&this.accessor.exitMaximizedGroup()}initialize(e){this._group=e}}const qC=100,ex=100;class Cg extends mw{get minimumWidth(){var e;if(typeof this._explicitConstraints.minimumWidth=="number")return this._explicitConstraints.minimumWidth;const n=(e=this.activePanel)===null||e===void 0?void 0:e.minimumWidth;return typeof n=="number"?n:super.__minimumWidth()}get minimumHeight(){var e;if(typeof this._explicitConstraints.minimumHeight=="number")return this._explicitConstraints.minimumHeight;const n=(e=this.activePanel)===null||e===void 0?void 0:e.minimumHeight;return typeof n=="number"?n:super.__minimumHeight()}get maximumWidth(){var e;if(typeof this._explicitConstraints.maximumWidth=="number")return this._explicitConstraints.maximumWidth;const n=(e=this.activePanel)===null||e===void 0?void 0:e.maximumWidth;return typeof n=="number"?n:super.__maximumWidth()}get maximumHeight(){var e;if(typeof this._explicitConstraints.maximumHeight=="number")return this._explicitConstraints.maximumHeight;const n=(e=this.activePanel)===null||e===void 0?void 0:e.maximumHeight;return typeof n=="number"?n:super.__maximumHeight()}get panels(){return this._model.panels}get activePanel(){return this._model.activePanel}get size(){return this._model.size}get model(){return this._model}get locked(){return this._model.locked}set locked(e){this._model.locked=e}get header(){return this._model.header}constructor(e,n,s){var l,a,c,d,h,m;super(n,"groupview_default",{minimumHeight:(a=(l=s.constraints)===null||l===void 0?void 0:l.minimumHeight)!==null&&a!==void 0?a:ex,minimumWidth:(d=(c=s.constraints)===null||c===void 0?void 0:c.minimumWidth)!==null&&d!==void 0?d:qC,maximumHeight:(h=s.constraints)===null||h===void 0?void 0:h.maximumHeight,maximumWidth:(m=s.constraints)===null||m===void 0?void 0:m.maximumWidth},new XC(n,e)),this._explicitConstraints={},this.api.initialize(this),this._model=new ZC(this.element,e,n,s,this),this.addDisposables(this.model.onDidActivePanelChange(w=>{this.api._onDidActivePanelChange.fire(w)}),this.api.onDidConstraintsChangeInternal(w=>{w.minimumWidth!==void 0&&(this._explicitConstraints.minimumWidth=typeof w.minimumWidth=="function"?w.minimumWidth():w.minimumWidth),w.minimumHeight!==void 0&&(this._explicitConstraints.minimumHeight=typeof w.minimumHeight=="function"?w.minimumHeight():w.minimumHeight),w.maximumWidth!==void 0&&(this._explicitConstraints.maximumWidth=typeof w.maximumWidth=="function"?w.maximumWidth():w.maximumWidth),w.maximumHeight!==void 0&&(this._explicitConstraints.maximumHeight=typeof w.maximumHeight=="function"?w.maximumHeight():w.maximumHeight)}))}focus(){this.api.isActive||this.api.setActive(),super.focus()}initialize(){this._model.initialize()}setActive(e){super.setActive(e),this.model.setActive(e)}layout(e,n){super.layout(e,n),this.model.layout(e,n)}getComponent(){return this._model}toJSON(){return this.model.toJSON()}}const tx={className:"dockview-theme-abyss"};class nx extends lf{get location(){return this.group.api.location}get title(){return this.panel.title}get isGroupActive(){return this.group.isActive}get renderer(){return this.panel.renderer}set group(e){const n=this._group;this._group!==e&&(this._group=e,this._onDidGroupChange.fire({}),this.setupGroupEventListeners(n),this._onDidLocationChange.fire({location:this.group.api.location}))}get group(){return this._group}get tabComponent(){return this._tabComponent}constructor(e,n,s,l,a){super(e.id,l),this.panel=e,this.accessor=s,this._onDidTitleChange=new U,this.onDidTitleChange=this._onDidTitleChange.event,this._onDidActiveGroupChange=new U,this.onDidActiveGroupChange=this._onDidActiveGroupChange.event,this._onDidGroupChange=new U,this.onDidGroupChange=this._onDidGroupChange.event,this._onDidRendererChange=new U,this.onDidRendererChange=this._onDidRendererChange.event,this._onDidLocationChange=new U,this.onDidLocationChange=this._onDidLocationChange.event,this.groupEventsDisposable=new Bn,this._tabComponent=a,this.initialize(e),this._group=n,this.setupGroupEventListeners(),this.addDisposables(this.groupEventsDisposable,this._onDidRendererChange,this._onDidTitleChange,this._onDidGroupChange,this._onDidActiveGroupChange,this._onDidLocationChange)}getWindow(){return this.group.api.getWindow()}moveTo(e){var n,s;this.accessor.moveGroupOrPanel({from:{groupId:this._group.id,panelId:this.panel.id},to:{group:(n=e.group)!==null&&n!==void 0?n:this._group,position:e.group&&(s=e.position)!==null&&s!==void 0?s:"center",index:e.index},skipSetActive:e.skipSetActive})}setTitle(e){this.panel.setTitle(e)}setRenderer(e){this.panel.setRenderer(e)}close(){this.group.model.closePanel(this.panel)}maximize(){this.group.api.maximize()}isMaximized(){return this.group.api.isMaximized()}exitMaximized(){this.group.api.exitMaximized()}setupGroupEventListeners(e){var n;let s=(n=e==null?void 0:e.isActive)!==null&&n!==void 0?n:!1;this.groupEventsDisposable.value=new Ne(this.group.api.onDidVisibilityChange(l=>{const a=!l.isVisible&&this.isVisible,c=l.isVisible&&!this.isVisible,d=this.group.model.isPanelActive(this.panel);(a||c&&d)&&this._onDidVisibilityChange.fire(l)}),this.group.api.onDidLocationChange(l=>{this.group===this.panel.group&&this._onDidLocationChange.fire(l)}),this.group.api.onDidActiveChange(()=>{this.group===this.panel.group&&s!==this.isGroupActive&&(s=this.isGroupActive,this._onDidActiveGroupChange.fire({isActive:this.isGroupActive}))}))}}class Go extends Ne{get params(){return this._params}get title(){return this._title}get group(){return this._group}get renderer(){var e;return(e=this._renderer)!==null&&e!==void 0?e:this.accessor.renderer}get minimumWidth(){return this._minimumWidth}get minimumHeight(){return this._minimumHeight}get maximumWidth(){return this._maximumWidth}get maximumHeight(){return this._maximumHeight}constructor(e,n,s,l,a,c,d,h){super(),this.id=e,this.accessor=l,this.containerApi=a,this.view=d,this._renderer=h.renderer,this._group=c,this._minimumWidth=h.minimumWidth,this._minimumHeight=h.minimumHeight,this._maximumWidth=h.maximumWidth,this._maximumHeight=h.maximumHeight,this.api=new nx(this,this._group,l,n,s),this.addDisposables(this.api.onActiveChange(()=>{l.setActivePanel(this)}),this.api.onDidSizeChange(m=>{this.group.api.setSize(m)}),this.api.onDidRendererChange(()=>{this.group.model.rerender(this)}))}init(e){this._params=e.params,this.view.init(Object.assign(Object.assign({},e),{api:this.api,containerApi:this.containerApi})),this.setTitle(e.title)}focus(){const e=new aw;this.api._onWillFocus.fire(e),!e.defaultPrevented&&(this.api.isActive||this.api.setActive())}toJSON(){return{id:this.id,contentComponent:this.view.contentComponent,tabComponent:this.view.tabComponent,params:Object.keys(this._params||{}).length>0?this._params:void 0,title:this.title,renderer:this._renderer,minimumHeight:this._minimumHeight,maximumHeight:this._maximumHeight,minimumWidth:this._minimumWidth,maximumWidth:this._maximumWidth}}setTitle(e){e!==this.title&&(this._title=e,this.api._onDidTitleChange.fire({title:e}))}setRenderer(e){e!==this.renderer&&(this._renderer=e,this.api._onDidRendererChange.fire({renderer:e}))}update(e){var n;this._params=Object.assign(Object.assign({},(n=this._params)!==null&&n!==void 0?n:{}),e.params);for(const s of Object.keys(e.params))e.params[s]===void 0&&delete this._params[s];this.view.update({params:this._params})}updateFromStateModel(e){var n,s,l;this._maximumHeight=e.maximumHeight,this._minimumHeight=e.minimumHeight,this._maximumWidth=e.maximumWidth,this._minimumWidth=e.minimumWidth,this.update({params:(n=e.params)!==null&&n!==void 0?n:{}}),this.setTitle((s=e.title)!==null&&s!==void 0?s:this.id),this.setRenderer((l=e.renderer)!==null&&l!==void 0?l:this.accessor.renderer)}updateParentGroup(e,n){this._group=e,this.api.group=this._group;const s=this._group.model.isPanelActive(this),l=this.group.api.isActive&&s;n!=null&&n.skipSetActive||this.api.isActive!==l&&this.api._onDidActiveChange.fire({isActive:this.group.api.isActive&&s}),this.api.isVisible!==s&&this.api._onDidVisibilityChange.fire({isVisible:s})}runEvents(){const e=this._group.model.isPanelActive(this),n=this.group.api.isActive&&e;this.api.isActive!==n&&this.api._onDidActiveChange.fire({isActive:this.group.api.isActive&&e}),this.api.isVisible!==e&&this.api._onDidVisibilityChange.fire({isVisible:e})}layout(e,n){this.api._onDidDimensionChange.fire({width:e,height:n}),this.view.layout(e,n)}dispose(){this.api.dispose(),this.view.dispose()}}class xg extends Ne{get element(){return this._element}constructor(){super(),this._element=document.createElement("div"),this._element.className="dv-default-tab",this._content=document.createElement("div"),this._content.className="dv-default-tab-content",this.action=document.createElement("div"),this.action.className="dv-default-tab-action",this.action.appendChild(jC()),this._element.appendChild(this._content),this._element.appendChild(this.action),this.render()}init(e){this._title=e.title,this.addDisposables(e.api.onDidTitleChange(n=>{this._title=n.title,this.render()}),Be(this.action,"pointerdown",n=>{n.preventDefault()}),Be(this.action,"click",n=>{n.defaultPrevented||(n.preventDefault(),e.api.close())})),this.render()}render(){var e;this._content.textContent!==this._title&&(this._content.textContent=(e=this._title)!==null&&e!==void 0?e:"")}}class gw{get content(){return this._content}get tab(){return this._tab}constructor(e,n,s,l){this.accessor=e,this.id=n,this.contentComponent=s,this.tabComponent=l,this._content=this.createContentComponent(this.id,s),this._tab=this.createTabComponent(this.id,l)}createTabRenderer(e){var n;const s=this.createTabComponent(this.id,this.tabComponent);return this._params&&s.init(Object.assign(Object.assign({},this._params),{tabLocation:e})),this._updateEvent&&((n=s.update)===null||n===void 0||n.call(s,this._updateEvent)),s}init(e){this._params=e,this.content.init(e),this.tab.init(Object.assign(Object.assign({},e),{tabLocation:"header"}))}layout(e,n){var s,l;(l=(s=this.content).layout)===null||l===void 0||l.call(s,e,n)}update(e){var n,s,l,a;this._updateEvent=e,(s=(n=this.content).update)===null||s===void 0||s.call(n,e),(a=(l=this.tab).update)===null||a===void 0||a.call(l,e)}dispose(){var e,n,s,l;(n=(e=this.content).dispose)===null||n===void 0||n.call(e),(l=(s=this.tab).dispose)===null||l===void 0||l.call(s)}createContentComponent(e,n){return this.accessor.options.createComponent({id:e,name:n})}createTabComponent(e,n){const s=n??this.accessor.options.defaultTabComponent;if(s){if(this.accessor.options.createTabComponent){const l=this.accessor.options.createTabComponent({id:e,name:s});return l||new xg}console.warn(`dockview: tabComponent '${n}' was not found. falling back to the default tab.`)}return new xg}}class ix{constructor(e){this.accessor=e}fromJSON(e,n){var s,l;const a=e.id,c=e.params,d=e.title,h=e.view,m=h?h.content.id:(s=e.contentComponent)!==null&&s!==void 0?s:"unknown",w=h?(l=h.tab)===null||l===void 0?void 0:l.id:e.tabComponent,v=new gw(this.accessor,a,m,w),S=new Go(a,m,w,this.accessor,new Yu(this.accessor),n,v,{renderer:e.renderer,minimumWidth:e.minimumWidth,minimumHeight:e.minimumHeight,maximumWidth:e.maximumWidth,maximumHeight:e.maximumHeight});return S.init({title:d??a,params:c??{}}),S}}class sx extends Ne{get element(){return this._element}constructor(){super(),this._element=document.createElement("div"),this._element.className="dv-watermark"}init(e){}}class rx{constructor(){this._orderedList=[]}push(e){this._orderedList=[...this._orderedList.filter(n=>n!==e),e],this.update()}destroy(e){this._orderedList=this._orderedList.filter(n=>n!==e),this.update()}update(){for(let e=0;e{let a=null;const c=Uu();s.value=new Ne({dispose:()=>{c.release()}},Be(window,"pointermove",d=>{const h=this.options.container.getBoundingClientRect(),m=d.clientX-h.left,w=d.clientY-h.top;Re(this._element,"dv-resize-container-dragging",!0);const v=this._element.getBoundingClientRect();a===null&&(a={x:d.clientX-v.left,y:d.clientY-v.top});const S=Math.max(0,this.getMinimumWidth(v.width)),E=Math.max(0,this.getMinimumHeight(v.height)),A=_t(w-a.y,-E,Math.max(0,h.height-v.height+E)),D=_t(a.y-w+h.height-v.height,-E,Math.max(0,h.height-v.height+E)),P=_t(m-a.x,-S,Math.max(0,h.width-v.width+S)),N=_t(a.x-m+h.width-v.width,-S,Math.max(0,h.width-v.width+S)),O={};A<=D?O.top=A:O.bottom=D,P<=N?O.left=P:O.right=N,this.setBounds(O)}),Be(window,"pointerup",()=>{Re(this._element,"dv-resize-container-dragging",!1),s.dispose(),this._onDidChangeEnd.fire()}))};this.addDisposables(s,Be(e,"pointerdown",a=>{if(a.defaultPrevented){a.preventDefault();return}yg(a)||l()}),Be(this.options.content,"pointerdown",a=>{a.defaultPrevented||yg(a)||a.shiftKey&&l()}),Be(this.options.content,"pointerdown",()=>{Du.push(this._element)},!0)),n.inDragMode&&l()}setupResize(e){const n=document.createElement("div");n.className=`dv-resize-handle-${e}`,this._element.appendChild(n);const s=new Bn;this.addDisposables(s,Be(n,"pointerdown",l=>{l.preventDefault();let a=null;const c=Uu();s.value=new Ne(Be(window,"pointermove",d=>{const h=this.options.container.getBoundingClientRect(),m=this._element.getBoundingClientRect(),w=d.clientY-h.top,v=d.clientX-h.left;a===null&&(a={originalY:w,originalHeight:m.height,originalX:v,originalWidth:m.width});let S,E,A,D,P,N;const O=()=>{const $=a.originalY+a.originalHeight>h.height?Math.max(0,h.height-ys.MINIMUM_HEIGHT):Math.max(0,a.originalY+a.originalHeight-ys.MINIMUM_HEIGHT);S=_t(w,0,$),A=a.originalY+a.originalHeight-S,E=h.height-S-A},M=()=>{S=a.originalY-a.originalHeight;const $=S<0&&typeof this.options.minimumInViewportHeight=="number"?-S+this.options.minimumInViewportHeight:ys.MINIMUM_HEIGHT,K=h.height-Math.max(0,S);A=_t(w-S,$,K),E=h.height-S-A},R=()=>{const $=a.originalX+a.originalWidth>h.width?Math.max(0,h.width-ys.MINIMUM_WIDTH):Math.max(0,a.originalX+a.originalWidth-ys.MINIMUM_WIDTH);D=_t(v,0,$),N=a.originalX+a.originalWidth-D,P=h.width-D-N},Z=()=>{D=a.originalX-a.originalWidth;const $=D<0&&typeof this.options.minimumInViewportWidth=="number"?-D+this.options.minimumInViewportWidth:ys.MINIMUM_WIDTH,K=h.width-Math.max(0,D);N=_t(v-D,$,K),P=h.width-D-N};switch(e){case"top":O();break;case"bottom":M();break;case"left":R();break;case"right":Z();break;case"topleft":O(),R();break;case"topright":O(),Z();break;case"bottomleft":M(),R();break;case"bottomright":M(),Z();break}const G={};S<=E?G.top=S:G.bottom=E,D<=P?G.left=D:G.right=P,G.height=A,G.width=N,this.setBounds(G)}),{dispose:()=>{c.release()}},Be(window,"pointerup",()=>{s.dispose(),this._onDidChangeEnd.fire()}))}))}getMinimumWidth(e){return typeof this.options.minimumInViewportWidth=="number"?e-this.options.minimumInViewportWidth:0}getMinimumHeight(e){return typeof this.options.minimumInViewportHeight=="number"?e-this.options.minimumInViewportHeight:0}dispose(){Du.destroy(this._element),this._element.remove(),super.dispose()}}ys.MINIMUM_HEIGHT=20;ys.MINIMUM_WIDTH=20;class ox extends Ne{constructor(e,n){super(),this.group=e,this.overlay=n,this.addDisposables(n)}position(e){this.overlay.setBounds(e)}}const Cu=100,gr={left:100,top:100,width:300,height:300},lx=100;class ax{constructor(){this.cache=new Map,this.currentFrameId=0,this.rafId=null}getPosition(e){const n=this.cache.get(e);if(n&&n.frameId===this.currentFrameId)return n.rect;this.scheduleFrameUpdate();const s=yh(e);return this.cache.set(e,{rect:s,frameId:this.currentFrameId}),s}invalidate(){this.currentFrameId++}scheduleFrameUpdate(){this.rafId||(this.rafId=requestAnimationFrame(()=>{this.currentFrameId++,this.rafId=null}))}}function ux(){const r=document.createElement("div");return r.tabIndex=-1,r}class Eg extends Ne{constructor(e,n){super(),this.element=e,this.accessor=n,this.map={},this._disposed=!1,this.positionCache=new ax,this.pendingUpdates=new Set,this.addDisposables(Qt.from(()=>{for(const s of Object.values(this.map))s.disposable.dispose(),s.destroy.dispose();this._disposed=!0}))}updateAllPositions(){if(!this._disposed){this.positionCache.invalidate();for(const e of Object.values(this.map))e.panel.api.isVisible&&e.resize&&e.resize()}}detatch(e){if(this.map[e.api.id]){const{disposable:n,destroy:s}=this.map[e.api.id];return n.dispose(),s.dispose(),delete this.map[e.api.id],!0}return!1}attach(e){const{panel:n,referenceContainer:s}=e;if(!this.map[n.api.id]){const w=ux();w.className="dv-render-overlay",this.map[n.api.id]={panel:n,disposable:Qt.NONE,destroy:Qt.NONE,element:w}}const l=this.map[n.api.id].element;n.view.content.element.parentElement!==l&&l.appendChild(n.view.content.element),l.parentElement!==this.element&&this.element.appendChild(l);const a=()=>{const w=n.api.id;this.pendingUpdates.has(w)||(this.pendingUpdates.add(w),requestAnimationFrame(()=>{if(this.pendingUpdates.delete(w),this.isDisposed||!this.map[w])return;const v=this.positionCache.getPosition(s.element),S=this.positionCache.getPosition(this.element),E=v.left-S.left,A=v.top-S.top,D=v.width,P=v.height;l.style.left=`${E}px`,l.style.top=`${A}px`,l.style.width=`${D}px`,l.style.height=`${P}px`,Re(l,"dv-render-overlay-float",n.group.api.location.type==="floating")}))},c=()=>{n.api.isVisible&&(this.positionCache.invalidate(),a()),l.style.display=n.api.isVisible?"":"none"},d=new Bn,h=()=>{n.api.location.type==="floating"?queueMicrotask(()=>{const w=this.accessor.floatingGroups.find(A=>A.group===n.api.group);if(!w)return;const v=w.overlay.element,S=()=>{const A=Number(v.getAttribute("aria-level"));l.style.zIndex=`calc(var(--dv-overlay-z-index, 999) + ${A*2+1})`},E=new MutationObserver(()=>{S()});d.value=Qt.from(()=>E.disconnect()),E.observe(v,{attributeFilter:["aria-level"],attributes:!0}),S()}):l.style.zIndex=""},m=new Ne(d,new lw(l,{onDragEnd:w=>{s.dropTarget.dnd.onDragEnd(w)},onDragEnter:w=>{s.dropTarget.dnd.onDragEnter(w)},onDragLeave:w=>{s.dropTarget.dnd.onDragLeave(w)},onDrop:w=>{s.dropTarget.dnd.onDrop(w)},onDragOver:w=>{s.dropTarget.dnd.onDragOver(w)}}),n.api.onDidVisibilityChange(()=>{c()}),n.api.onDidDimensionsChange(()=>{n.api.isVisible&&a()}),n.api.onDidLocationChange(()=>{h()}));return this.map[n.api.id].destroy=Qt.from(()=>{var w;n.view.content.element.parentElement===l&&l.removeChild(n.view.content.element),(w=l.parentElement)===null||w===void 0||w.removeChild(l)}),h(),queueMicrotask(()=>{this.isDisposed||c()}),this.map[n.api.id].disposable.dispose(),this.map[n.api.id].disposable=m,this.map[n.api.id].resize=a,l}}var cx=function(r,e,n,s){function l(a){return a instanceof n?a:new n(function(c){c(a)})}return new(n||(n=Promise))(function(a,c){function d(w){try{m(s.next(w))}catch(v){c(v)}}function h(w){try{m(s.throw(w))}catch(v){c(v)}}function m(w){w.done?a(w.value):l(w.value).then(d,h)}m((s=s.apply(r,e||[])).next())})};class dx extends Ne{get window(){var e,n;return(n=(e=this._window)===null||e===void 0?void 0:e.value)!==null&&n!==void 0?n:null}constructor(e,n,s){super(),this.target=e,this.className=n,this.options=s,this._onWillClose=new U,this.onWillClose=this._onWillClose.event,this._onDidClose=new U,this.onDidClose=this._onDidClose.event,this._window=null,this.addDisposables(this._onWillClose,this._onDidClose,{dispose:()=>{this.close()}})}dimensions(){if(!this._window)return null;const e=this._window.value.screenX,n=this._window.value.screenY,s=this._window.value.innerWidth,l=this._window.value.innerHeight;return{top:n,left:e,width:s,height:l}}close(){var e,n;this._window&&(this._onWillClose.fire(),(n=(e=this.options).onWillClose)===null||n===void 0||n.call(e,{id:this.target,window:this._window.value}),this._window.disposable.dispose(),this._window=null,this._onDidClose.fire())}open(){var e,n;return cx(this,void 0,void 0,function*(){if(this._window)throw new Error("instance of popout window is already open");const s=`${this.options.url}`,l=Object.entries({top:this.options.top,left:this.options.left,width:this.options.width,height:this.options.height}).map(([h,m])=>`${h}=${m}`).join(","),a=window.open(s,this.target,l);if(!a)return null;const c=new Ne;this._window={value:a,disposable:c},c.addDisposables(Qt.from(()=>{a.close()}),Be(window,"beforeunload",()=>{this.close()}));const d=this.createPopoutWindowContainer();return this.className&&d.classList.add(this.className),(n=(e=this.options).onDidOpen)===null||n===void 0||n.call(e,{id:this.target,window:a}),new Promise((h,m)=>{a.addEventListener("unload",w=>{}),a.addEventListener("load",()=>{try{const w=a.document;w.title=document.title,w.body.appendChild(d),sC(w,window.document.styleSheets),Be(a,"beforeunload",()=>{this.close()}),h(d)}catch(w){m(w)}})})})}createPopoutWindowContainer(){const e=document.createElement("div");return e.classList.add("dv-popout-window"),e.id="dv-popout-window",e.style.position="absolute",e.style.width="100%",e.style.height="100%",e.style.top="0px",e.style.left="0px",e}}class hx extends Ne{constructor(e){super(),this.accessor=e,this.init()}init(){const e=new Set,n=new Set;this.addDisposables(this.accessor.onDidAddPanel(s=>{if(e.has(s.api.id))throw new Error(`dockview: Invalid event sequence. [onDidAddPanel] called for panel ${s.api.id} but panel already exists`);e.add(s.api.id)}),this.accessor.onDidRemovePanel(s=>{if(e.has(s.api.id))e.delete(s.api.id);else throw new Error(`dockview: Invalid event sequence. [onDidRemovePanel] called for panel ${s.api.id} but panel does not exists`)}),this.accessor.onDidAddGroup(s=>{if(n.has(s.api.id))throw new Error(`dockview: Invalid event sequence. [onDidAddGroup] called for group ${s.api.id} but group already exists`);n.add(s.api.id)}),this.accessor.onDidRemoveGroup(s=>{if(n.has(s.api.id))n.delete(s.api.id);else throw new Error(`dockview: Invalid event sequence. [onDidRemoveGroup] called for group ${s.api.id} but group does not exists`)}))}}class fx extends Ne{constructor(e){super(),this.root=e,this._active=null,this._activeDisposable=new Bn,this._element=document.createElement("div"),this._element.className="dv-popover-anchor",this._element.style.position="relative",this.root.prepend(this._element),this.addDisposables(Qt.from(()=>{this.close()}),this._activeDisposable)}openPopover(e,n){var s;this.close();const l=document.createElement("div");l.style.position="absolute",l.style.zIndex=(s=n.zIndex)!==null&&s!==void 0?s:"var(--dv-overlay-z-index)",l.appendChild(e);const a=this._element.getBoundingClientRect(),c=a.left,d=a.top;l.style.top=`${n.y-d}px`,l.style.left=`${n.x-c}px`,this._element.appendChild(l),this._active=l,this._activeDisposable.value=new Ne(Be(window,"pointerdown",h=>{var m;const w=h.target;if(!(w instanceof HTMLElement))return;let v=w;for(;v&&v!==l;)v=(m=v==null?void 0:v.parentElement)!==null&&m!==void 0?m:null;v||this.close()})),requestAnimationFrame(()=>{hC(l,this.root)})}close(){this._active&&(this._active.remove(),this._activeDisposable.dispose(),this._active=null)}}class bg extends Ne{get disabled(){return this._disabled}set disabled(e){var n;this.disabled!==e&&(this._disabled=e,e&&((n=this.model)===null||n===void 0||n.clear()))}get model(){if(!this.disabled)return{clear:()=>{var e;this._model&&((e=this._model.root.parentElement)===null||e===void 0||e.removeChild(this._model.root)),this._model=void 0},exists:()=>!!this._model,getElements:(e,n)=>{const s=this._outline!==n;if(this._outline=n,this._model)return this._model.changed=s,this._model;const l=this.createContainer(),a=this.createAnchor();if(this._model={root:l,overlay:a,changed:s},l.appendChild(a),this.element.appendChild(l),(e==null?void 0:e.target)instanceof HTMLElement){const c=e.target.getBoundingClientRect(),d=this.element.getBoundingClientRect();a.style.left=`${c.left-d.left}px`,a.style.top=`${c.top-d.top}px`}return this._model}}}constructor(e,n){super(),this.element=e,this._disabled=!1,this._disabled=n.disabled,this.addDisposables(Qt.from(()=>{var s;(s=this.model)===null||s===void 0||s.clear()}))}createContainer(){const e=document.createElement("div");return e.className="dv-drop-target-container",e}createAnchor(){const e=document.createElement("div");return e.className="dv-drop-target-anchor",e.style.visibility="hidden",e}}const Pg={activationSize:{type:"pixels",value:10},size:{type:"pixels",value:20}};function xu(r){const e=r.from.activePanel;[...r.from.panels].map(s=>{const l=r.from.model.removePanel(s);return r.from.model.renderContainer.detatch(s),l}).forEach(s=>{r.to.model.openPanel(s,{skipSetActive:e!==s,skipSetGroupActive:!0})})}class px extends sw{get orientation(){return this.gridview.orientation}get totalPanels(){return this.panels.length}get panels(){return this.groups.flatMap(e=>e.panels)}get options(){return this._options}get activePanel(){const e=this.activeGroup;if(e)return e.activePanel}get renderer(){var e;return(e=this.options.defaultRenderer)!==null&&e!==void 0?e:"onlyWhenVisible"}get api(){return this._api}get floatingGroups(){return this._floatingGroups}get popoutRestorationPromise(){return this._popoutRestorationPromise}constructor(e,n){var s,l,a;super(e,{proportionalLayout:!0,orientation:ke.HORIZONTAL,styles:n.hideBorders?{separatorBorder:"transparent"}:void 0,disableAutoResizing:n.disableAutoResizing,locked:n.locked,margin:(l=(s=n.theme)===null||s===void 0?void 0:s.gap)!==null&&l!==void 0?l:0,className:n.className}),this.nextGroupId=ef(),this._deserializer=new ix(this),this._watermark=null,this._onWillDragPanel=new U,this.onWillDragPanel=this._onWillDragPanel.event,this._onWillDragGroup=new U,this.onWillDragGroup=this._onWillDragGroup.event,this._onDidDrop=new U,this.onDidDrop=this._onDidDrop.event,this._onWillDrop=new U,this.onWillDrop=this._onWillDrop.event,this._onWillShowOverlay=new U,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onUnhandledDragOverEvent=new U,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,this._onDidRemovePanel=new U,this.onDidRemovePanel=this._onDidRemovePanel.event,this._onDidAddPanel=new U,this.onDidAddPanel=this._onDidAddPanel.event,this._onDidPopoutGroupSizeChange=new U,this.onDidPopoutGroupSizeChange=this._onDidPopoutGroupSizeChange.event,this._onDidPopoutGroupPositionChange=new U,this.onDidPopoutGroupPositionChange=this._onDidPopoutGroupPositionChange.event,this._onDidOpenPopoutWindowFail=new U,this.onDidOpenPopoutWindowFail=this._onDidOpenPopoutWindowFail.event,this._onDidLayoutFromJSON=new U,this.onDidLayoutFromJSON=this._onDidLayoutFromJSON.event,this._onDidActivePanelChange=new U({replay:!0}),this.onDidActivePanelChange=this._onDidActivePanelChange.event,this._onDidMovePanel=new U,this.onDidMovePanel=this._onDidMovePanel.event,this._onDidMaximizedGroupChange=new U,this.onDidMaximizedGroupChange=this._onDidMaximizedGroupChange.event,this._floatingGroups=[],this._popoutGroups=[],this._popoutRestorationPromise=Promise.resolve(),this._onDidRemoveGroup=new U,this.onDidRemoveGroup=this._onDidRemoveGroup.event,this._onDidAddGroup=new U,this.onDidAddGroup=this._onDidAddGroup.event,this._onDidOptionsChange=new U,this.onDidOptionsChange=this._onDidOptionsChange.event,this._onDidActiveGroupChange=new U,this.onDidActiveGroupChange=this._onDidActiveGroupChange.event,this._moving=!1,this._options=n,this.popupService=new fx(this.element),this._themeClassnames=new uc(this.element),this._api=new Yu(this),this.rootDropTargetContainer=new bg(this.element,{disabled:!0}),this.overlayRenderContainer=new Eg(this.gridview.element,this),this._rootDropTarget=new rs(this.element,{className:"dv-drop-target-edge",canDisplayOverlay:(c,d)=>{const h=Hn();if(h)return h.viewId!==this.id?!1:d==="center"?this.gridview.length===0:!0;if(d==="center"&&this.gridview.length!==0)return!1;const m=new fw(c,"edge",d,Hn);return this._onUnhandledDragOverEvent.fire(m),m.isAccepted},acceptedTargetZones:["top","bottom","left","right","center"],overlayModel:(a=n.rootOverlayModel)!==null&&a!==void 0?a:Pg,getOverrideTarget:()=>{var c;return(c=this.rootDropTargetContainer)===null||c===void 0?void 0:c.model}}),this.updateDropTargetModel(n),Re(this.gridview.element,"dv-dockview",!0),Re(this.element,"dv-debug",!!n.debug),this.updateTheme(),this.updateWatermark(),n.debug&&this.addDisposables(new hx(this)),this.addDisposables(this.rootDropTargetContainer,this.overlayRenderContainer,this._onWillDragPanel,this._onWillDragGroup,this._onWillShowOverlay,this._onDidActivePanelChange,this._onDidAddPanel,this._onDidRemovePanel,this._onDidLayoutFromJSON,this._onDidDrop,this._onWillDrop,this._onDidMovePanel,this._onDidMovePanel.event(()=>{this.debouncedUpdateAllPositions()}),this._onDidAddGroup,this._onDidRemoveGroup,this._onDidActiveGroupChange,this._onUnhandledDragOverEvent,this._onDidMaximizedGroupChange,this._onDidOptionsChange,this._onDidPopoutGroupSizeChange,this._onDidPopoutGroupPositionChange,this._onDidOpenPopoutWindowFail,this.onDidViewVisibilityChangeMicroTaskQueue(()=>{this.updateWatermark()}),this.onDidAdd(c=>{this._moving||this._onDidAddGroup.fire(c)}),this.onDidRemove(c=>{this._moving||this._onDidRemoveGroup.fire(c)}),this.onDidActiveChange(c=>{this._moving||this._onDidActiveGroupChange.fire(c)}),this.onDidMaximizedChange(c=>{this._onDidMaximizedGroupChange.fire({group:c.panel,isMaximized:c.isMaximized})}),Zr.any(this.onDidAdd,this.onDidRemove)(()=>{this.updateWatermark()}),Zr.any(this.onDidAddPanel,this.onDidRemovePanel,this.onDidAddGroup,this.onDidRemove,this.onDidMovePanel,this.onDidActivePanelChange,this.onDidPopoutGroupPositionChange,this.onDidPopoutGroupSizeChange)(()=>{this._bufferOnDidLayoutChange.fire()}),Qt.from(()=>{for(const c of[...this._floatingGroups])c.dispose();for(const c of[...this._popoutGroups])c.disposable.dispose()}),this._rootDropTarget,this._rootDropTarget.onWillShowOverlay(c=>{this.gridview.length>0&&c.position==="center"||this._onWillShowOverlay.fire(new cc(c,{kind:"edge",panel:void 0,api:this._api,group:void 0,getData:Hn}))}),this._rootDropTarget.onDrop(c=>{var d;const h=new pw({nativeEvent:c.nativeEvent,position:c.position,panel:void 0,api:this._api,group:void 0,getData:Hn,kind:"edge"});if(this._onWillDrop.fire(h),h.defaultPrevented)return;const m=Hn();m?this.moveGroupOrPanel({from:{groupId:m.groupId,panelId:(d=m.panelId)!==null&&d!==void 0?d:void 0},to:{group:this.orthogonalize(c.position),position:"center"}}):this._onDidDrop.fire(new of({nativeEvent:c.nativeEvent,position:c.position,panel:void 0,api:this._api,group:void 0,getData:Hn}))}),this._rootDropTarget)}setVisible(e,n){switch(e.api.location.type){case"grid":super.setVisible(e,n);break;case"floating":{const s=this.floatingGroups.find(l=>l.group===e);s&&(s.overlay.setVisible(n),e.api._onDidVisibilityChange.fire({isVisible:n}));break}case"popout":console.warn("dockview: You cannot hide a group that is in a popout window");break}}addPopoutGroup(e,n){var s,l,a,c,d;if(e instanceof Go&&e.group.size===1)return this.addPopoutGroup(e.group,n);const h=aC(this.gridview.element),m=this.element;function w(){return n!=null&&n.position?n.position:e instanceof Cg?e.element.getBoundingClientRect():e.group?e.group.element.getBoundingClientRect():m.getBoundingClientRect()}const v=w(),S=(l=(s=n==null?void 0:n.overridePopoutGroup)===null||s===void 0?void 0:s.id)!==null&&l!==void 0?l:this.getNextGroupId(),E=new dx(`${this.id}-${S}`,h??"",{url:(d=(a=n==null?void 0:n.popoutUrl)!==null&&a!==void 0?a:(c=this.options)===null||c===void 0?void 0:c.popoutUrl)!==null&&d!==void 0?d:"/popout.html",left:window.screenX+v.left,top:window.screenY+v.top,width:v.width,height:v.height,onDidOpen:n==null?void 0:n.onDidOpen,onWillClose:n==null?void 0:n.onWillClose}),A=new Ne(E,E.onDidClose(()=>{A.dispose()}));return E.open().then(D=>{var P;if(E.isDisposed)return!1;const N=n!=null&&n.referenceGroup?n.referenceGroup:e instanceof Go?e.group:e,O=e.api.location.type,M=N.element.parentElement!==null;let R;if(M?n!=null&&n.overridePopoutGroup?R=n.overridePopoutGroup:(R=this.createGroup({id:S}),D&&this._onDidAddGroup.fire(R)):R=N,D===null)return console.error("dockview: failed to create popout. perhaps you need to allow pop-ups for this website"),A.dispose(),this._onDidOpenPopoutWindowFail.fire(),this.movingLock(()=>xu({from:R,to:N})),N.api.isVisible||N.api.setVisible(!0),!1;const Z=document.createElement("div");Z.className="dv-overlay-render-container";const G=new Eg(Z,this);R.model.renderContainer=G,R.layout(E.window.innerWidth,E.window.innerHeight);let $;if(!(n!=null&&n.overridePopoutGroup)&&M)if(e instanceof Go)this.movingLock(()=>{const ce=N.model.removePanel(e);R.model.openPanel(ce)});else switch(this.movingLock(()=>xu({from:N,to:R})),O){case"grid":N.api.setVisible(!1);break;case"floating":case"popout":$=(P=this._floatingGroups.find(ce=>ce.group.api.id===e.api.id))===null||P===void 0?void 0:P.overlay.toJSON(),this.removeGroup(N);break}D.classList.add("dv-dockview"),D.style.overflow="hidden",D.appendChild(Z),D.appendChild(R.element);const K=document.createElement("div"),he=new bg(K,{disabled:this.rootDropTargetContainer.disabled});D.appendChild(K),R.model.dropTargetContainer=he,R.model.location={type:"popout",getWindow:()=>E.window,popoutUrl:n==null?void 0:n.popoutUrl},M&&e.api.location.type==="grid"&&e.api.setVisible(!1),this.doSetGroupAndPanelActive(R),A.addDisposables(R.api.onDidActiveChange(ce=>{var j;ce.isActive&&((j=E.window)===null||j===void 0||j.focus())}),R.api.onWillFocus(()=>{var ce;(ce=E.window)===null||ce===void 0||ce.focus()}));let ue;const Q=M&&N&&this.getPanel(N.id),ve={window:E,popoutGroup:R,referenceGroup:Q?N.id:void 0,disposable:{dispose:()=>(A.dispose(),ue)}},ie=cC(E.window);return A.addDisposables(ie,dC(E.window,()=>{this._onDidPopoutGroupSizeChange.fire({width:E.window.innerWidth,height:E.window.innerHeight,group:R})}),ie.event(()=>{this._onDidPopoutGroupPositionChange.fire({screenX:E.window.screenX,screenY:E.window.screenX,group:R})}),Be(E.window,"resize",()=>{R.layout(E.window.innerWidth,E.window.innerHeight)}),G,Qt.from(()=>{if(!this.isDisposed){if(M&&this.getPanel(N.id))this.movingLock(()=>xu({from:R,to:N})),N.api.isVisible||N.api.setVisible(!0),this.getPanel(R.id)&&this.doRemoveGroup(R,{skipPopoutAssociated:!0});else if(this.getPanel(R.id)){if(R.model.renderContainer=this.overlayRenderContainer,R.model.dropTargetContainer=this.rootDropTargetContainer,ue=R,!this._popoutGroups.find(j=>j.popoutGroup===R))return;$?this.addFloatingGroup(R,{height:$.height,width:$.width,position:$}):(this.doRemoveGroup(R,{skipDispose:!0,skipActive:!0,skipPopoutReturn:!0}),R.model.location={type:"grid"},this.movingLock(()=>{this.doAddGroup(R,[0])})),this.doSetGroupAndPanelActive(R)}}})),this._popoutGroups.push(ve),this.updateWatermark(),!0}).catch(D=>(console.error("dockview: failed to create popout.",D),!1))}addFloatingGroup(e,n){var s,l,a,c,d;let h;if(e instanceof Go)h=this.createGroup(),this._onDidAddGroup.fire(h),this.movingLock(()=>this.removePanel(e,{removeEmptyGroup:!0,skipDispose:!0,skipSetActiveGroup:!0})),this.movingLock(()=>h.model.openPanel(e,{skipSetGroupActive:!0}));else{h=e;const D=(s=this._popoutGroups.find(O=>O.popoutGroup===h))===null||s===void 0?void 0:s.referenceGroup,P=D?this.getPanel(D):void 0;typeof(n==null?void 0:n.skipRemoveGroup)=="boolean"&&n.skipRemoveGroup||(P?(this.movingLock(()=>xu({from:e,to:P})),this.doRemoveGroup(e,{skipPopoutReturn:!0,skipPopoutAssociated:!0}),this.doRemoveGroup(P,{skipDispose:!0}),h=P):this.doRemoveGroup(e,{skipDispose:!0,skipPopoutReturn:!0,skipPopoutAssociated:!1}))}function m(){if(n!=null&&n.position){const D={};return"left"in n.position?D.left=Math.max(n.position.left,0):"right"in n.position?D.right=Math.max(n.position.right,0):D.left=gr.left,"top"in n.position?D.top=Math.max(n.position.top,0):"bottom"in n.position?D.bottom=Math.max(n.position.bottom,0):D.top=gr.top,typeof n.width=="number"?D.width=Math.max(n.width,0):D.width=gr.width,typeof n.height=="number"?D.height=Math.max(n.height,0):D.height=gr.height,D}return{left:typeof(n==null?void 0:n.x)=="number"?Math.max(n.x,0):gr.left,top:typeof(n==null?void 0:n.y)=="number"?Math.max(n.y,0):gr.top,width:typeof(n==null?void 0:n.width)=="number"?Math.max(n.width,0):gr.width,height:typeof(n==null?void 0:n.height)=="number"?Math.max(n.height,0):gr.height}}const w=m(),v=new ys(Object.assign(Object.assign({container:this.gridview.element,content:h.element},w),{minimumInViewportWidth:this.options.floatingGroupBounds==="boundedWithinViewport"?void 0:(a=(l=this.options.floatingGroupBounds)===null||l===void 0?void 0:l.minimumWidthWithinViewport)!==null&&a!==void 0?a:Cu,minimumInViewportHeight:this.options.floatingGroupBounds==="boundedWithinViewport"?void 0:(d=(c=this.options.floatingGroupBounds)===null||c===void 0?void 0:c.minimumHeightWithinViewport)!==null&&d!==void 0?d:Cu})),S=h.element.querySelector(".dv-void-container");if(!S)throw new Error("dockview: failed to find drag handle");v.setupDrag(S,{inDragMode:typeof(n==null?void 0:n.inDragMode)=="boolean"?n.inDragMode:!1});const E=new ox(h,v),A=new Ne(h.api.onDidActiveChange(D=>{D.isActive&&v.bringToFront()}),lc(h.element,D=>{const{width:P,height:N}=D.contentRect;h.layout(P,N)}));E.addDisposables(v.onDidChange(()=>{h.layout(h.width,h.height)}),v.onDidChangeEnd(()=>{this._bufferOnDidLayoutChange.fire()}),h.onDidChange(D=>{v.setBounds({height:D==null?void 0:D.height,width:D==null?void 0:D.width})}),{dispose:()=>{A.dispose(),nh(this._floatingGroups,E),h.model.location={type:"grid"},this.updateWatermark()}}),this._floatingGroups.push(E),h.model.location={type:"floating"},n!=null&&n.skipActiveGroup||this.doSetGroupAndPanelActive(h),this.updateWatermark()}orthogonalize(e,n){switch(this.gridview.normalize(),e){case"top":case"bottom":this.gridview.orientation===ke.HORIZONTAL&&this.gridview.insertOrthogonalSplitviewAtRoot();break;case"left":case"right":this.gridview.orientation===ke.VERTICAL&&this.gridview.insertOrthogonalSplitviewAtRoot();break}switch(e){case"top":case"left":case"center":return this.createGroupAtLocation([0],void 0,n);case"bottom":case"right":return this.createGroupAtLocation([this.gridview.length],void 0,n);default:throw new Error(`dockview: unsupported position ${e}`)}}updateOptions(e){var n,s;if(super.updateOptions(e),"floatingGroupBounds"in e)for(const c of this._floatingGroups){switch(e.floatingGroupBounds){case"boundedWithinViewport":c.overlay.minimumInViewportHeight=void 0,c.overlay.minimumInViewportWidth=void 0;break;case void 0:c.overlay.minimumInViewportHeight=Cu,c.overlay.minimumInViewportWidth=Cu;break;default:c.overlay.minimumInViewportHeight=(n=e.floatingGroupBounds)===null||n===void 0?void 0:n.minimumHeightWithinViewport,c.overlay.minimumInViewportWidth=(s=e.floatingGroupBounds)===null||s===void 0?void 0:s.minimumWidthWithinViewport}c.overlay.setBounds()}this.updateDropTargetModel(e);const l=this.options.disableDnd;this._options=Object.assign(Object.assign({},this.options),e);const a=this.options.disableDnd;l!==a&&this.updateDragAndDropState(),"theme"in e&&this.updateTheme(),this.layout(this.gridview.width,this.gridview.height,!0)}layout(e,n,s){if(super.layout(e,n,s),this._floatingGroups)for(const l of this._floatingGroups)l.overlay.setBounds()}updateDragAndDropState(){for(const e of this.groups)e.model.updateDragAndDropState()}focus(){var e;(e=this.activeGroup)===null||e===void 0||e.focus()}getGroupPanel(e){return this.panels.find(n=>n.id===e)}setActivePanel(e){e.group.model.openPanel(e),this.doSetGroupAndPanelActive(e.group)}moveToNext(e={}){var n;if(!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}if(e.includePanel&&e.group&&e.group.activePanel!==e.group.panels[e.group.panels.length-1]){e.group.model.moveToNext({suppressRoll:!0});return}const s=kt(e.group.element),l=(n=this.gridview.next(s))===null||n===void 0?void 0:n.view;this.doSetGroupAndPanelActive(l)}moveToPrevious(e={}){var n;if(!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}if(e.includePanel&&e.group&&e.group.activePanel!==e.group.panels[0]){e.group.model.moveToPrevious({suppressRoll:!0});return}const s=kt(e.group.element),l=(n=this.gridview.previous(s))===null||n===void 0?void 0:n.view;l&&this.doSetGroupAndPanelActive(l)}toJSON(){var e;const n=this.gridview.serialize(),s=this.panels.reduce((d,h)=>(d[h.id]=h.toJSON(),d),{}),l=this._floatingGroups.map(d=>({data:d.group.toJSON(),position:d.overlay.toJSON()})),a=this._popoutGroups.map(d=>({data:d.popoutGroup.toJSON(),gridReferenceGroup:d.referenceGroup,position:d.window.dimensions(),url:d.popoutGroup.api.location.type==="popout"?d.popoutGroup.api.location.popoutUrl:void 0})),c={grid:n,panels:s,activeGroup:(e=this.activeGroup)===null||e===void 0?void 0:e.id};return l.length>0&&(c.floatingGroups=l),a.length>0&&(c.popoutGroups=a),c}fromJSON(e,n){var s,l;const a=new Map;let c;if(n!=null&&n.reuseExistingPanels){c=this.createGroup(),this._groups.delete(c.api.id);const w=Object.keys(e.panels);for(const v of this.panels)w.includes(v.api.id)&&a.set(v.api.id,v);this.movingLock(()=>{Array.from(a.values()).forEach(v=>{this.moveGroupOrPanel({from:{groupId:v.api.group.api.id,panelId:v.api.id},to:{group:c,position:"center"},keepEmptyGroups:!0})})})}if(this.clear(),typeof e!="object"||e===null)throw new Error("dockview: serialized layout must be a non-null object");const{grid:d,panels:h,activeGroup:m}=e;if(d.root.type!=="branch"||!Array.isArray(d.root.data))throw new Error("dockview: root must be of type branch");try{const w=this.width,v=this.height,S=P=>{const{id:N,locked:O,hideHeader:M,views:R,activeView:Z}=P;if(typeof N!="string")throw new Error("dockview: group id must be of type string");const G=this.createGroup({id:N,locked:!!O,hideHeader:!!M});this._onDidAddGroup.fire(G);const $=[];for(const K of R){const he=a.get(K);if(c&&he)this.movingLock(()=>{c.model.removePanel(he)}),$.push(he),he.updateFromStateModel(h[K]);else{const ue=this._deserializer.fromJSON(h[K],G);$.push(ue)}}for(let K=0;K{G.model.openPanel(he,{skipSetActive:!ue,skipSetGroupActive:!0})}):G.model.openPanel(he,{skipSetActive:!ue,skipSetGroupActive:!0})}return!G.activePanel&&G.panels.length>0&&G.model.openPanel(G.panels[G.panels.length-1],{skipSetGroupActive:!0}),G};this.gridview.deserialize(d,{fromJSON:P=>S(P.data)}),this.layout(w,v,!0);const E=(s=e.floatingGroups)!==null&&s!==void 0?s:[];for(const P of E){const{data:N,position:O}=P,M=S(N);this.addFloatingGroup(M,{position:O,width:O.width,height:O.height,skipRemoveGroup:!0,inDragMode:!1})}const A=(l=e.popoutGroups)!==null&&l!==void 0?l:[],D=[];A.forEach((P,N)=>{const{data:O,position:M,gridReferenceGroup:R,url:Z}=P,G=S(O),$=new Promise(K=>{setTimeout(()=>{this.addPopoutGroup(G,{position:M??void 0,overridePopoutGroup:R?G:void 0,referenceGroup:R?this.getPanel(R):void 0,popoutUrl:Z}),K()},N*lx)});D.push($)}),this._popoutRestorationPromise=Promise.all(D).then(()=>{});for(const P of this._floatingGroups)P.overlay.setBounds();if(typeof m=="string"){const P=this.getPanel(m);P&&this.doSetGroupAndPanelActive(P)}}catch(w){console.error("dockview: failed to deserialize layout. Reverting changes",w);for(const v of this.groups)for(const S of v.panels)this.removePanel(S,{removeEmptyGroup:!1,skipDispose:!1});for(const v of this.groups)v.dispose(),this._groups.delete(v.id),this._onDidRemoveGroup.fire(v);for(const v of[...this._floatingGroups])v.dispose();throw this.clear(),w}this.updateWatermark(),this.debouncedUpdateAllPositions(),this._onDidLayoutFromJSON.fire()}clear(){const e=Array.from(this._groups.values()).map(s=>s.value),n=!!this.activeGroup;for(const s of e)this.removeGroup(s,{skipActive:!0});n&&this.doSetGroupAndPanelActive(void 0),this.gridview.clear()}closeAllGroups(){for(const e of this._groups.entries()){const[n,s]=e;s.value.model.closeAllPanels()}}addPanel(e){var n,s;if(this.panels.find(h=>h.id===e.id))throw new Error(`dockview: panel with id ${e.id} already exists`);let l;if(e.position&&e.floating)throw new Error("dockview: you can only provide one of: position, floating as arguments to .addPanel(...)");const a={width:e.initialWidth,height:e.initialHeight};let c;if(e.position)if(YC(e.position)){const h=typeof e.position.referencePanel=="string"?this.getGroupPanel(e.position.referencePanel):e.position.referencePanel;if(c=e.position.index,!h)throw new Error(`dockview: referencePanel '${e.position.referencePanel}' does not exist`);l=this.findGroup(h)}else if(KC(e.position)){if(l=typeof e.position.referenceGroup=="string"?(n=this._groups.get(e.position.referenceGroup))===null||n===void 0?void 0:n.value:e.position.referenceGroup,c=e.position.index,!l)throw new Error(`dockview: referenceGroup '${e.position.referenceGroup}' does not exist`)}else{const h=this.orthogonalize(Dg(e.position.direction)),m=this.createPanel(e,h);return h.model.openPanel(m,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:c}),e.inactive||this.doSetGroupAndPanelActive(h),h.api.setSize({height:a==null?void 0:a.height,width:a==null?void 0:a.width}),m}else l=this.activeGroup;let d;if(l){const h=$u(((s=e.position)===null||s===void 0?void 0:s.direction)||"within");if(e.floating){const m=this.createGroup();this._onDidAddGroup.fire(m);const w=typeof e.floating=="object"&&e.floating!==null?e.floating:{};this.addFloatingGroup(m,Object.assign(Object.assign({},w),{inDragMode:!1,skipRemoveGroup:!0,skipActiveGroup:!0})),d=this.createPanel(e,m),m.model.openPanel(d,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:c})}else if(l.api.location.type==="floating"||h==="center")d=this.createPanel(e,l),l.model.openPanel(d,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:c}),l.api.setSize({width:a==null?void 0:a.width,height:a==null?void 0:a.height}),e.inactive||this.doSetGroupAndPanelActive(l);else{const m=kt(l.element),w=_s(this.gridview.orientation,m,h),v=this.createGroupAtLocation(w,this.orientationAtLocation(w)===ke.VERTICAL?a==null?void 0:a.height:a==null?void 0:a.width);d=this.createPanel(e,v),v.model.openPanel(d,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:c}),e.inactive||this.doSetGroupAndPanelActive(v)}}else if(e.floating){const h=this.createGroup();this._onDidAddGroup.fire(h);const m=typeof e.floating=="object"&&e.floating!==null?e.floating:{};this.addFloatingGroup(h,Object.assign(Object.assign({},m),{inDragMode:!1,skipRemoveGroup:!0,skipActiveGroup:!0})),d=this.createPanel(e,h),h.model.openPanel(d,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:c})}else{const h=this.createGroupAtLocation([0],this.gridview.orientation===ke.VERTICAL?a==null?void 0:a.height:a==null?void 0:a.width);d=this.createPanel(e,h),h.model.openPanel(d,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:c}),e.inactive||this.doSetGroupAndPanelActive(h)}return d}removePanel(e,n={removeEmptyGroup:!0}){const s=e.group;if(!s)throw new Error(`dockview: cannot remove panel ${e.id}. it's missing a group.`);s.model.removePanel(e,{skipSetActiveGroup:n.skipSetActiveGroup}),n.skipDispose||(e.group.model.renderContainer.detatch(e),e.dispose()),s.size===0&&n.removeEmptyGroup&&this.removeGroup(s,{skipActive:n.skipSetActiveGroup})}createWatermarkComponent(){return this.options.createWatermarkComponent?this.options.createWatermarkComponent():new sx}updateWatermark(){var e,n;if(this.groups.filter(s=>s.api.location.type==="grid"&&s.api.isVisible).length===0){if(!this._watermark){this._watermark=this.createWatermarkComponent(),this._watermark.init({containerApi:new Yu(this)});const s=document.createElement("div");s.className="dv-watermark-container",oC(s,"watermark-component"),s.appendChild(this._watermark.element),this.gridview.element.appendChild(s)}}else this._watermark&&(this._watermark.element.parentElement.remove(),(n=(e=this._watermark).dispose)===null||n===void 0||n.call(e),this._watermark=null)}addGroup(e){var n;if(e){let s;if(JC(e)){const m=typeof e.referencePanel=="string"?this.panels.find(w=>w.id===e.referencePanel):e.referencePanel;if(!m)throw new Error(`dockview: reference panel ${e.referencePanel} does not exist`);if(s=this.findGroup(m),!s)throw new Error(`dockview: reference group for reference panel ${e.referencePanel} does not exist`)}else if(QC(e)){if(s=typeof e.referenceGroup=="string"?(n=this._groups.get(e.referenceGroup))===null||n===void 0?void 0:n.value:e.referenceGroup,!s)throw new Error(`dockview: reference group ${e.referenceGroup} does not exist`)}else{const m=this.orthogonalize(Dg(e.direction),e);return e.skipSetActive||this.doSetGroupAndPanelActive(m),m}const l=$u(e.direction||"within"),a=kt(s.element),c=_s(this.gridview.orientation,a,l),d=this.createGroup(e),h=this.getLocationOrientation(c)===ke.VERTICAL?e.initialHeight:e.initialWidth;return this.doAddGroup(d,c,h),e.skipSetActive||this.doSetGroupAndPanelActive(d),d}else{const s=this.createGroup(e);return this.doAddGroup(s),this.doSetGroupAndPanelActive(s),s}}getLocationOrientation(e){return e.length%2==0&&this.gridview.orientation===ke.HORIZONTAL?ke.HORIZONTAL:ke.VERTICAL}removeGroup(e,n){this.doRemoveGroup(e,n)}doRemoveGroup(e,n){var s;const l=[...e.panels];if(!(n!=null&&n.skipDispose))for(const d of l)this.removePanel(d,{removeEmptyGroup:!1,skipDispose:(s=n==null?void 0:n.skipDispose)!==null&&s!==void 0?s:!1});const a=this.activePanel;if(e.api.location.type==="floating"){const d=this._floatingGroups.find(h=>h.group===e);if(d){if(n!=null&&n.skipDispose||(d.group.dispose(),this._groups.delete(e.id),this._onDidRemoveGroup.fire(e)),nh(this._floatingGroups,d),d.dispose(),!(n!=null&&n.skipActive)&&this._activeGroup===e){const h=Array.from(this._groups.values());this.doSetGroupAndPanelActive(h.length>0?h[0].value:void 0)}return d.group}throw new Error("dockview: failed to find floating group")}if(e.api.location.type==="popout"){const d=this._popoutGroups.find(h=>h.popoutGroup===e);if(d){if(!(n!=null&&n.skipDispose)){if(!(n!=null&&n.skipPopoutAssociated)){const m=d.referenceGroup?this.getPanel(d.referenceGroup):void 0;m&&m.panels.length===0&&this.removeGroup(m)}d.popoutGroup.dispose(),this._groups.delete(e.id),this._onDidRemoveGroup.fire(e)}nh(this._popoutGroups,d);const h=d.disposable.dispose();if(!(n!=null&&n.skipPopoutReturn)&&h&&(this.doAddGroup(h,[0]),this.doSetGroupAndPanelActive(h)),!(n!=null&&n.skipActive)&&this._activeGroup===e){const m=Array.from(this._groups.values());this.doSetGroupAndPanelActive(m.length>0?m[0].value:void 0)}return this.updateWatermark(),d.popoutGroup}throw new Error("dockview: failed to find popout group")}const c=super.doRemoveGroup(e,n);return n!=null&&n.skipActive||this.activePanel!==a&&this._onDidActivePanelChange.fire(this.activePanel),c}debouncedUpdateAllPositions(){this._updatePositionsFrameId!==void 0&&cancelAnimationFrame(this._updatePositionsFrameId),this._updatePositionsFrameId=requestAnimationFrame(()=>{this._updatePositionsFrameId=void 0,this.overlayRenderContainer.updateAllPositions()})}movingLock(e){const n=this._moving;try{return this._moving=!0,e()}finally{this._moving=n}}moveGroupOrPanel(e){var n;const s=e.to.group,l=e.from.groupId,a=e.from.panelId,c=e.to.position,d=e.to.index,h=l?(n=this._groups.get(l))===null||n===void 0?void 0:n.value:void 0;if(!h)throw new Error(`dockview: Failed to find group id ${l}`);if(a===void 0){this.moveGroup({from:{group:h},to:{group:s,position:c},skipSetActive:e.skipSetActive});return}if(!c||c==="center"){const m=this.movingLock(()=>h.model.removePanel(a,{skipSetActive:!1,skipSetActiveGroup:!0}));if(!m)throw new Error(`dockview: No panel with id ${a}`);!e.keepEmptyGroups&&h.model.size===0&&this.doRemoveGroup(h,{skipActive:!0});const w=s.model.size===0;this.movingLock(()=>{var v;return s.model.openPanel(m,{index:d,skipSetActive:((v=e.skipSetActive)!==null&&v!==void 0?v:!1)&&!w,skipSetGroupActive:!0})}),e.skipSetActive||this.doSetGroupAndPanelActive(s),this._onDidMovePanel.fire({panel:m,from:h})}else{const m=kt(s.element),w=_s(this.gridview.orientation,m,c);if(h.size<2){const[v,S]=Ms(w);if(h.api.location.type==="grid"){const P=kt(h.element),[N,O]=Ms(P);if(nw(N,v)){this.gridview.moveView(N,O,S),this._onDidMovePanel.fire({panel:this.getGroupPanel(a),from:h});return}}if(h.api.location.type==="popout"){const P=this._popoutGroups.find(M=>M.popoutGroup===h),N=this.movingLock(()=>P.popoutGroup.model.removePanel(P.popoutGroup.panels[0],{skipSetActive:!0,skipSetActiveGroup:!0}));this.doRemoveGroup(h,{skipActive:!0});const O=this.createGroupAtLocation(w);this.movingLock(()=>O.model.openPanel(N,{skipSetActive:!0})),this.doSetGroupAndPanelActive(O),this._onDidMovePanel.fire({panel:this.getGroupPanel(a),from:h});return}const E=this.movingLock(()=>this.doRemoveGroup(h,{skipActive:!0,skipDispose:!0})),A=kt(s.element),D=_s(this.gridview.orientation,A,c);this.movingLock(()=>this.doAddGroup(E,D)),this.doSetGroupAndPanelActive(E),this._onDidMovePanel.fire({panel:this.getGroupPanel(a),from:h})}else{const v=this.movingLock(()=>h.model.removePanel(a,{skipSetActive:!1,skipSetActiveGroup:!0}));if(!v)throw new Error(`dockview: No panel with id ${a}`);const S=_s(this.gridview.orientation,m,c),E=this.createGroupAtLocation(S);this.movingLock(()=>E.model.openPanel(v,{skipSetGroupActive:!0})),this.doSetGroupAndPanelActive(E),this._onDidMovePanel.fire({panel:v,from:h})}}}moveGroup(e){const n=e.from.group,s=e.to.group,l=e.to.position;if(l==="center"){const a=n.activePanel,c=this.movingLock(()=>[...n.panels].map(d=>n.model.removePanel(d.id,{skipSetActive:!0})));(n==null?void 0:n.model.size)===0&&this.doRemoveGroup(n,{skipActive:!0}),this.movingLock(()=>{for(const d of c)s.model.openPanel(d,{skipSetActive:d!==a,skipSetGroupActive:!0})}),e.skipSetActive!==!0?this.doSetGroupAndPanelActive(s):this.activePanel||this.doSetGroupAndPanelActive(s)}else{switch(n.api.location.type){case"grid":this.gridview.removeView(kt(n.element));break;case"floating":{const a=this._floatingGroups.find(c=>c.group===n);if(!a)throw new Error("dockview: failed to find floating group");a.dispose();break}case"popout":{const a=this._popoutGroups.find(d=>d.popoutGroup===n);if(!a)throw new Error("dockview: failed to find popout group");const c=this._popoutGroups.indexOf(a);if(c>=0&&this._popoutGroups.splice(c,1),a.referenceGroup){const d=this.getPanel(a.referenceGroup);d&&!d.api.isVisible&&this.doRemoveGroup(d,{skipActive:!0})}a.window.dispose(),s.api.location.type==="grid"?(n.model.renderContainer=this.overlayRenderContainer,n.model.dropTargetContainer=this.rootDropTargetContainer,n.model.location={type:"grid"}):s.api.location.type==="floating"&&(n.model.renderContainer=this.overlayRenderContainer,n.model.dropTargetContainer=this.rootDropTargetContainer,n.model.location={type:"floating"});break}}if(s.api.location.type==="grid"){const a=kt(s.element),c=_s(this.gridview.orientation,a,l);let d;switch(this.gridview.orientation){case ke.VERTICAL:d=a.length%2==0?n.api.width:n.api.height;break;case ke.HORIZONTAL:d=a.length%2==0?n.api.height:n.api.width;break}this.gridview.addView(n,d,c)}else if(s.api.location.type==="floating"){const a=this._floatingGroups.find(c=>c.group===s);if(a){const c=a.overlay.toJSON();let d,h;"left"in c?d=c.left+50:"right"in c?d=Math.max(0,c.right-c.width-50):d=50,"top"in c?h=c.top+50:"bottom"in c?h=Math.max(0,c.bottom-c.height-50):h=50,this.addFloatingGroup(n,{height:c.height,width:c.width,position:{left:d,top:h}})}}}if(n.panels.forEach(a=>{this._onDidMovePanel.fire({panel:a,from:n})}),this.debouncedUpdateAllPositions(),e.skipSetActive===!1){const a=s??n;this.doSetGroupAndPanelActive(a)}}doSetGroupActive(e){super.doSetGroupActive(e);const n=this.activePanel;!this._moving&&n!==this._onDidActivePanelChange.value&&this._onDidActivePanelChange.fire(n)}doSetGroupAndPanelActive(e){super.doSetGroupActive(e);const n=this.activePanel;e&&this.hasMaximizedGroup()&&!this.isMaximizedGroup(e)&&this.exitMaximizedGroup(),!this._moving&&n!==this._onDidActivePanelChange.value&&this._onDidActivePanelChange.fire(n)}getNextGroupId(){let e=this.nextGroupId.next();for(;this._groups.has(e);)e=this.nextGroupId.next();return e}createGroup(e){e||(e={});let n=e==null?void 0:e.id;if(n&&this._groups.has(e.id)&&(console.warn(`dockview: Duplicate group id ${e==null?void 0:e.id}. reassigning group id to avoid errors`),n=void 0),!n)for(n=this.nextGroupId.next();this._groups.has(n);)n=this.nextGroupId.next();const s=new Cg(this,n,e);if(s.init({params:{},accessor:this}),!this._groups.has(s.id)){const l=new Ne(s.model.onTabDragStart(a=>{this._onWillDragPanel.fire(a)}),s.model.onGroupDragStart(a=>{this._onWillDragGroup.fire(a)}),s.model.onMove(a=>{const{groupId:c,itemId:d,target:h,index:m}=a;this.moveGroupOrPanel({from:{groupId:c,panelId:d},to:{group:s,position:h,index:m}})}),s.model.onDidDrop(a=>{this._onDidDrop.fire(a)}),s.model.onWillDrop(a=>{this._onWillDrop.fire(a)}),s.model.onWillShowOverlay(a=>{if(this.options.disableDnd){a.preventDefault();return}this._onWillShowOverlay.fire(a)}),s.model.onUnhandledDragOverEvent(a=>{this._onUnhandledDragOverEvent.fire(a)}),s.model.onDidAddPanel(a=>{this._moving||this._onDidAddPanel.fire(a.panel)}),s.model.onDidRemovePanel(a=>{this._moving||this._onDidRemovePanel.fire(a.panel)}),s.model.onDidActivePanelChange(a=>{this._moving||a.panel===this.activePanel&&this._onDidActivePanelChange.value!==a.panel&&this._onDidActivePanelChange.fire(a.panel)}),Zr.any(s.model.onDidPanelTitleChange,s.model.onDidPanelParametersChange)(()=>{this._bufferOnDidLayoutChange.fire()}));this._groups.set(s.id,{value:s,disposable:l})}return s.initialize(),s}createPanel(e,n){var s,l,a;const c=e.component,d=(s=e.tabComponent)!==null&&s!==void 0?s:this.options.defaultTabComponent,h=new gw(this,e.id,c,d),m=new Go(e.id,c,d,this,this._api,n,h,{renderer:e.renderer,minimumWidth:e.minimumWidth,minimumHeight:e.minimumHeight,maximumWidth:e.maximumWidth,maximumHeight:e.maximumHeight});return m.init({title:(l=e.title)!==null&&l!==void 0?l:e.id,params:(a=e==null?void 0:e.params)!==null&&a!==void 0?a:{}}),m}createGroupAtLocation(e,n,s){const l=this.createGroup(s);return this.doAddGroup(l,e,n),l}findGroup(e){var n;return(n=Array.from(this._groups.values()).find(s=>s.value.model.containsPanel(e)))===null||n===void 0?void 0:n.value}orientationAtLocation(e){const n=this.gridview.orientation;return e.length%2==1?n:Ss(n)}updateDropTargetModel(e){"dndEdges"in e&&(this._rootDropTarget.disabled=typeof e.dndEdges=="boolean"&&e.dndEdges===!1,typeof e.dndEdges=="object"&&e.dndEdges!==null?this._rootDropTarget.setOverlayModel(e.dndEdges):this._rootDropTarget.setOverlayModel(Pg)),"rootOverlayModel"in e&&this.updateDropTargetModel({dndEdges:e.dndEdges})}updateTheme(){var e,n;const s=(e=this._options.theme)!==null&&e!==void 0?e:tx;switch(this._themeClassnames.setClassNames(s.className),this.gridview.margin=(n=s.gap)!==null&&n!==void 0?n:0,s.dndOverlayMounting){case"absolute":this.rootDropTargetContainer.disabled=!1;break;case"relative":default:this.rootDropTargetContainer.disabled=!0;break}}}class mx extends sw{get orientation(){return this.gridview.orientation}set orientation(e){this.gridview.orientation=e}get options(){return this._options}get deserializer(){return this._deserializer}set deserializer(e){this._deserializer=e}constructor(e,n){var s;super(e,{proportionalLayout:(s=n.proportionalLayout)!==null&&s!==void 0?s:!0,orientation:n.orientation,styles:n.hideBorders?{separatorBorder:"transparent"}:void 0,disableAutoResizing:n.disableAutoResizing,className:n.className}),this._onDidLayoutfromJSON=new U,this.onDidLayoutFromJSON=this._onDidLayoutfromJSON.event,this._onDidRemoveGroup=new U,this.onDidRemoveGroup=this._onDidRemoveGroup.event,this._onDidAddGroup=new U,this.onDidAddGroup=this._onDidAddGroup.event,this._onDidActiveGroupChange=new U,this.onDidActiveGroupChange=this._onDidActiveGroupChange.event,this._options=n,this.addDisposables(this._onDidAddGroup,this._onDidRemoveGroup,this._onDidActiveGroupChange,this.onDidAdd(l=>{this._onDidAddGroup.fire(l)}),this.onDidRemove(l=>{this._onDidRemoveGroup.fire(l)}),this.onDidActiveChange(l=>{this._onDidActiveGroupChange.fire(l)}))}updateOptions(e){super.updateOptions(e);const n=typeof e.orientation=="string"&&this.gridview.orientation!==e.orientation;this._options=Object.assign(Object.assign({},this.options),e),n&&(this.gridview.orientation=e.orientation),this.layout(this.gridview.width,this.gridview.height,!0)}removePanel(e){this.removeGroup(e)}toJSON(){var e;return{grid:this.gridview.serialize(),activePanel:(e=this.activeGroup)===null||e===void 0?void 0:e.id}}setVisible(e,n){this.gridview.setViewVisible(kt(e.element),n)}setActive(e){this._groups.forEach((n,s)=>{n.value.setActive(e===n.value)})}focus(){var e;(e=this.activeGroup)===null||e===void 0||e.focus()}fromJSON(e){this.clear();const{grid:n,activePanel:s}=e;try{const l=[],a=this.width,c=this.height;if(this.gridview.deserialize(n,{fromJSON:d=>{const{data:h}=d,m=this.options.createComponent({id:h.id,name:h.component});return l.push(()=>m.init({params:h.params,minimumWidth:h.minimumWidth,maximumWidth:h.maximumWidth,minimumHeight:h.minimumHeight,maximumHeight:h.maximumHeight,priority:h.priority,snap:!!h.snap,accessor:this,isVisible:d.visible})),this._onDidAddGroup.fire(m),this.registerPanel(m),m}}),this.layout(a,c,!0),l.forEach(d=>d()),typeof s=="string"){const d=this.getPanel(s);d&&this.doSetGroupActive(d)}}catch(l){for(const a of this.groups)a.dispose(),this._groups.delete(a.id),this._onDidRemoveGroup.fire(a);throw this.clear(),l}this._onDidLayoutfromJSON.fire()}clear(){const e=this.activeGroup,n=Array.from(this._groups.values());for(const s of n)s.disposable.dispose(),this.doRemoveGroup(s.value,{skipActive:!0});e&&this.doSetGroupActive(void 0),this.gridview.clear()}movePanel(e,n){var s;let l;const a=this.gridview.remove(e),c=(s=this._groups.get(n.reference))===null||s===void 0?void 0:s.value;if(!c)throw new Error(`reference group ${n.reference} does not exist`);const d=$u(n.direction);if(d==="center")throw new Error(`${d} not supported as an option`);{const h=kt(c.element);l=_s(this.gridview.orientation,h,d)}this.doAddGroup(a,l,n.size)}addPanel(e){var n,s,l,a;let c=(n=e.location)!==null&&n!==void 0?n:[0];if(!((s=e.position)===null||s===void 0)&&s.referencePanel){const h=(l=this._groups.get(e.position.referencePanel))===null||l===void 0?void 0:l.value;if(!h)throw new Error(`reference group ${e.position.referencePanel} does not exist`);const m=$u(e.position.direction);if(m==="center")throw new Error(`${m} not supported as an option`);{const w=kt(h.element);c=_s(this.gridview.orientation,w,m)}}const d=this.options.createComponent({id:e.id,name:e.component});return d.init({params:(a=e.params)!==null&&a!==void 0?a:{},minimumWidth:e.minimumWidth,maximumWidth:e.maximumWidth,minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight,priority:e.priority,snap:!!e.snap,accessor:this,isVisible:!0}),this.doAddGroup(d,c,e.size),this.registerPanel(d),this.doSetGroupActive(d),d}registerPanel(e){const n=new Ne(e.api.onDidFocusChange(s=>{s.isFocused&&this._groups.forEach(l=>{const a=l.value;a!==e?a.setActive(!1):a.setActive(!0)})}));this._groups.set(e.id,{value:e,disposable:n})}moveGroup(e,n,s){const l=this.getPanel(n);if(!l)throw new Error("invalid operation");const a=kt(e.element),c=_s(this.gridview.orientation,a,s),[d,h]=Ms(c),m=kt(l.element),[w,v]=Ms(m);if(nw(w,d)){this.gridview.moveView(w,v,h);return}const S=this.doRemoveGroup(l,{skipActive:!0,skipDispose:!0}),E=kt(e.element),A=_s(this.gridview.orientation,E,s);this.doAddGroup(S,A)}removeGroup(e){super.removeGroup(e)}dispose(){super.dispose(),this._onDidLayoutfromJSON.dispose()}}class gx extends tf{get panels(){return this.splitview.getViews()}get options(){return this._options}get length(){return this._panels.size}get orientation(){return this.splitview.orientation}get splitview(){return this._splitview}set splitview(e){this._splitview&&this._splitview.dispose(),this._splitview=e,this._splitviewChangeDisposable.value=new Ne(this._splitview.onDidSashEnd(()=>{this._onDidLayoutChange.fire(void 0)}),this._splitview.onDidAddView(n=>this._onDidAddView.fire(n)),this._splitview.onDidRemoveView(n=>this._onDidRemoveView.fire(n)))}get minimumSize(){return this.splitview.minimumSize}get maximumSize(){return this.splitview.maximumSize}get height(){return this.splitview.orientation===ke.HORIZONTAL?this.splitview.orthogonalSize:this.splitview.size}get width(){return this.splitview.orientation===ke.HORIZONTAL?this.splitview.size:this.splitview.orthogonalSize}constructor(e,n){var s;super(document.createElement("div"),n.disableAutoResizing),this._splitviewChangeDisposable=new Bn,this._panels=new Map,this._onDidLayoutfromJSON=new U,this.onDidLayoutFromJSON=this._onDidLayoutfromJSON.event,this._onDidAddView=new U,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new U,this.onDidRemoveView=this._onDidRemoveView.event,this._onDidLayoutChange=new U,this.onDidLayoutChange=this._onDidLayoutChange.event,this.element.style.height="100%",this.element.style.width="100%",this._classNames=new uc(this.element),this._classNames.setClassNames((s=n.className)!==null&&s!==void 0?s:""),e.appendChild(this.element),this._options=n,this.splitview=new ql(this.element,n),this.addDisposables(this._onDidAddView,this._onDidLayoutfromJSON,this._onDidRemoveView,this._onDidLayoutChange)}updateOptions(e){var n,s;"className"in e&&this._classNames.setClassNames((n=e.className)!==null&&n!==void 0?n:""),"disableResizing"in e&&(this.disableResizing=(s=e.disableAutoResizing)!==null&&s!==void 0?s:!1),typeof e.orientation=="string"&&(this.splitview.orientation=e.orientation),this._options=Object.assign(Object.assign({},this.options),e),this.splitview.layout(this.splitview.size,this.splitview.orthogonalSize)}focus(){var e;(e=this._activePanel)===null||e===void 0||e.focus()}movePanel(e,n){this.splitview.moveView(e,n)}setVisible(e,n){const s=this.panels.indexOf(e);this.splitview.setViewVisible(s,n)}setActive(e,n){this._activePanel=e,this.panels.filter(s=>s!==e).forEach(s=>{s.api._onDidActiveChange.fire({isActive:!1}),n||s.focus()}),e.api._onDidActiveChange.fire({isActive:!0}),n||e.focus()}removePanel(e,n){const s=this._panels.get(e.id);if(!s)throw new Error(`unknown splitview panel ${e.id}`);s.dispose(),this._panels.delete(e.id);const l=this.panels.findIndex(d=>d===e);this.splitview.removeView(l,n).dispose();const c=this.panels;c.length>0&&this.setActive(c[c.length-1])}getPanel(e){return this.panels.find(n=>n.id===e)}addPanel(e){var n;if(this._panels.has(e.id))throw new Error(`panel ${e.id} already exists`);const s=this.options.createComponent({id:e.id,name:e.component});s.orientation=this.splitview.orientation,s.init({params:(n=e.params)!==null&&n!==void 0?n:{},minimumSize:e.minimumSize,maximumSize:e.maximumSize,snap:e.snap,priority:e.priority,accessor:this});const l=typeof e.size=="number"?e.size:$i.Distribute,a=typeof e.index=="number"?e.index:void 0;return this.splitview.addView(s,l,a),this.doAddView(s),this.setActive(s),s}layout(e,n){const[s,l]=this.splitview.orientation===ke.HORIZONTAL?[e,n]:[n,e];this.splitview.layout(s,l)}doAddView(e){const n=e.api.onDidFocusChange(s=>{s.isFocused&&this.setActive(e,!0)});this._panels.set(e.id,n)}toJSON(){var e;return{views:this.splitview.getViews().map((s,l)=>({size:this.splitview.getViewSize(l),data:s.toJSON(),snap:!!s.snap,priority:s.priority})),activeView:(e=this._activePanel)===null||e===void 0?void 0:e.id,size:this.splitview.size,orientation:this.splitview.orientation}}fromJSON(e){this.clear();const{views:n,orientation:s,size:l,activeView:a}=e,c=[],d=this.width,h=this.height;if(this.splitview=new ql(this.element,{orientation:s,proportionalLayout:this.options.proportionalLayout,descriptor:{size:l,views:n.map(m=>{const w=m.data;if(this._panels.has(w.id))throw new Error(`panel ${w.id} already exists`);const v=this.options.createComponent({id:w.id,name:w.component});return c.push(()=>{var S;v.init({params:(S=w.params)!==null&&S!==void 0?S:{},minimumSize:w.minimumSize,maximumSize:w.maximumSize,snap:m.snap,priority:m.priority,accessor:this})}),v.orientation=s,this.doAddView(v),setTimeout(()=>{this._onDidAddView.fire(v)},0),{size:m.size,view:v}})}}),this.layout(d,h),c.forEach(m=>m()),typeof a=="string"){const m=this.getPanel(a);m&&this.setActive(m)}this._onDidLayoutfromJSON.fire()}clear(){for(const e of this._panels.values())e.dispose();for(this._panels.clear();this.splitview.length>0;)this.splitview.removeView(0,$i.Distribute,!0).dispose()}dispose(){for(const n of this._panels.values())n.dispose();this._panels.clear();const e=this.splitview.getViews();this._splitviewChangeDisposable.dispose(),this.splitview.dispose();for(const n of e)n.dispose();this.element.remove(),super.dispose()}}class Ag extends Ne{get element(){return this._element}constructor(){super(),this._expandedIcon=BC(),this._collapsedIcon=hw(),this.disposable=new Bn,this.apiRef={api:null},this._element=document.createElement("div"),this.element.className="dv-default-header",this._content=document.createElement("span"),this._expander=document.createElement("div"),this._expander.className="dv-pane-header-icon",this.element.appendChild(this._expander),this.element.appendChild(this._content),this.addDisposables(Be(this._element,"click",()=>{var e;(e=this.apiRef.api)===null||e===void 0||e.setExpanded(!this.apiRef.api.isExpanded)}))}init(e){this.apiRef.api=e.api,this._content.textContent=e.title,this.updateIcon(),this.disposable.value=e.api.onDidExpansionChange(()=>{this.updateIcon()})}updateIcon(){var e;const n=!!(!((e=this.apiRef.api)===null||e===void 0)&&e.isExpanded);Re(this._expander,"collapsed",!n),n?(this._expander.contains(this._collapsedIcon)&&this._collapsedIcon.remove(),this._expander.contains(this._expandedIcon)||this._expander.appendChild(this._expandedIcon)):(this._expander.contains(this._expandedIcon)&&this._expandedIcon.remove(),this._expander.contains(this._collapsedIcon)||this._expander.appendChild(this._collapsedIcon))}update(e){}dispose(){this.disposable.dispose(),super.dispose()}}const vx=ef(),kg=22,zg=0,Og=Number.MAX_SAFE_INTEGER;class Tg extends MC{constructor(e){super({accessor:e.accessor,id:e.id,component:e.component,headerComponent:e.headerComponent,orientation:e.orientation,isExpanded:e.isExpanded,disableDnd:e.disableDnd,headerSize:e.headerSize,minimumBodySize:e.minimumBodySize,maximumBodySize:e.maximumBodySize}),this.options=e}getBodyComponent(){return this.options.body}getHeaderComponent(){return this.options.header}}class wx extends tf{get id(){return this._id}get panels(){return this.paneview.getPanes()}set paneview(e){this._paneview=e,this._disposable.value=new Ne(this._paneview.onDidChange(()=>{this._onDidLayoutChange.fire(void 0)}),this._paneview.onDidAddView(n=>this._onDidAddView.fire(n)),this._paneview.onDidRemoveView(n=>this._onDidRemoveView.fire(n)))}get paneview(){return this._paneview}get minimumSize(){return this.paneview.minimumSize}get maximumSize(){return this.paneview.maximumSize}get height(){return this.paneview.orientation===ke.HORIZONTAL?this.paneview.orthogonalSize:this.paneview.size}get width(){return this.paneview.orientation===ke.HORIZONTAL?this.paneview.size:this.paneview.orthogonalSize}get options(){return this._options}constructor(e,n){var s;super(document.createElement("div"),n.disableAutoResizing),this._id=vx.next(),this._disposable=new Bn,this._viewDisposables=new Map,this._onDidLayoutfromJSON=new U,this.onDidLayoutFromJSON=this._onDidLayoutfromJSON.event,this._onDidLayoutChange=new U,this.onDidLayoutChange=this._onDidLayoutChange.event,this._onDidDrop=new U,this.onDidDrop=this._onDidDrop.event,this._onDidAddView=new U,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new U,this.onDidRemoveView=this._onDidRemoveView.event,this._onUnhandledDragOverEvent=new U,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,this.element.style.height="100%",this.element.style.width="100%",this.addDisposables(this._onDidLayoutChange,this._onDidLayoutfromJSON,this._onDidDrop,this._onDidAddView,this._onDidRemoveView,this._onUnhandledDragOverEvent),this._classNames=new uc(this.element),this._classNames.setClassNames((s=n.className)!==null&&s!==void 0?s:""),e.appendChild(this.element),this._options=n,this.paneview=new Sg(this.element,{orientation:ke.VERTICAL}),this.addDisposables(this._disposable)}setVisible(e,n){const s=this.panels.indexOf(e);this.paneview.setViewVisible(s,n)}focus(){}updateOptions(e){var n,s;"className"in e&&this._classNames.setClassNames((n=e.className)!==null&&n!==void 0?n:""),"disableResizing"in e&&(this.disableResizing=(s=e.disableAutoResizing)!==null&&s!==void 0?s:!1),this._options=Object.assign(Object.assign({},this.options),e)}addPanel(e){var n,s;const l=this.options.createComponent({id:e.id,name:e.component});let a;e.headerComponent&&this.options.createHeaderComponent&&(a=this.options.createHeaderComponent({id:e.id,name:e.headerComponent})),a||(a=new Ag);const c=new Tg({id:e.id,component:e.component,headerComponent:e.headerComponent,header:a,body:l,orientation:ke.VERTICAL,isExpanded:!!e.isExpanded,disableDnd:!!this.options.disableDnd,accessor:this,headerSize:(n=e.headerSize)!==null&&n!==void 0?n:kg,minimumBodySize:zg,maximumBodySize:Og});this.doAddPanel(c);const d=typeof e.size=="number"?e.size:$i.Distribute,h=typeof e.index=="number"?e.index:void 0;return c.init({params:(s=e.params)!==null&&s!==void 0?s:{},minimumBodySize:e.minimumBodySize,maximumBodySize:e.maximumBodySize,isExpanded:e.isExpanded,title:e.title,containerApi:new ea(this),accessor:this}),this.paneview.addPane(c,d,h),c.orientation=this.paneview.orientation,c}removePanel(e){const s=this.panels.findIndex(l=>l===e);this.paneview.removePane(s),this.doRemovePanel(e)}movePanel(e,n){this.paneview.moveView(e,n)}getPanel(e){return this.panels.find(n=>n.id===e)}layout(e,n){const[s,l]=this.paneview.orientation===ke.HORIZONTAL?[e,n]:[n,e];this.paneview.layout(s,l)}toJSON(){const e=l=>l===Number.MAX_SAFE_INTEGER||l===Number.POSITIVE_INFINITY?void 0:l,n=l=>l<=0?void 0:l;return{views:this.paneview.getPanes().map((l,a)=>({size:this.paneview.getViewSize(a),data:l.toJSON(),minimumSize:n(l.minimumBodySize),maximumSize:e(l.maximumBodySize),headerSize:l.headerSize,expanded:l.isExpanded()})),size:this.paneview.size}}fromJSON(e){this.clear();const{views:n,size:s}=e,l=[],a=this.width,c=this.height;this.paneview=new Sg(this.element,{orientation:ke.VERTICAL,descriptor:{size:s,views:n.map(d=>{var h,m,w;const v=d.data,S=this.options.createComponent({id:v.id,name:v.component});let E;v.headerComponent&&this.options.createHeaderComponent&&(E=this.options.createHeaderComponent({id:v.id,name:v.headerComponent})),E||(E=new Ag);const A=new Tg({id:v.id,component:v.component,headerComponent:v.headerComponent,header:E,body:S,orientation:ke.VERTICAL,isExpanded:!!d.expanded,disableDnd:!!this.options.disableDnd,accessor:this,headerSize:(h=d.headerSize)!==null&&h!==void 0?h:kg,minimumBodySize:(m=d.minimumSize)!==null&&m!==void 0?m:zg,maximumBodySize:(w=d.maximumSize)!==null&&w!==void 0?w:Og});return this.doAddPanel(A),l.push(()=>{var D;A.init({params:(D=v.params)!==null&&D!==void 0?D:{},minimumBodySize:d.minimumSize,maximumBodySize:d.maximumSize,title:v.title,isExpanded:!!d.expanded,containerApi:new ea(this),accessor:this}),A.orientation=this.paneview.orientation}),setTimeout(()=>{this._onDidAddView.fire(A)},0),{size:d.size,view:A}})}}),this.layout(a,c),l.forEach(d=>d()),this._onDidLayoutfromJSON.fire()}clear(){for(const[e,n]of this._viewDisposables.entries())n.dispose();this._viewDisposables.clear(),this.paneview.dispose()}doAddPanel(e){const n=new Ne(e.onDidDrop(s=>{this._onDidDrop.fire(s)}),e.onUnhandledDragOverEvent(s=>{this._onUnhandledDragOverEvent.fire(s)}));this._viewDisposables.set(e.id,n)}doRemovePanel(e){const n=this._viewDisposables.get(e.id);n&&(n.dispose(),this._viewDisposables.delete(e.id))}dispose(){super.dispose();for(const[e,n]of this._viewDisposables.entries())n.dispose();this._viewDisposables.clear(),this.element.remove(),this.paneview.dispose()}}class _x extends sf{get priority(){return this._priority}set orientation(e){this._orientation=e}get orientation(){return this._orientation}get minimumSize(){const e=typeof this._minimumSize=="function"?this._minimumSize():this._minimumSize;return e!==this._evaluatedMinimumSize&&(this._evaluatedMinimumSize=e,this.updateConstraints()),e}get maximumSize(){const e=typeof this._maximumSize=="function"?this._maximumSize():this._maximumSize;return e!==this._evaluatedMaximumSize&&(this._evaluatedMaximumSize=e,this.updateConstraints()),e}get snap(){return this._snap}constructor(e,n){super(e,n,new cw(e,n)),this._evaluatedMinimumSize=0,this._evaluatedMaximumSize=Number.POSITIVE_INFINITY,this._minimumSize=0,this._maximumSize=Number.POSITIVE_INFINITY,this._snap=!1,this._onDidChange=new U,this.onDidChange=this._onDidChange.event,this.api.initialize(this),this.addDisposables(this._onDidChange,this.api.onWillVisibilityChange(s=>{const{isVisible:l}=s,{accessor:a}=this._params;a.setVisible(this,l)}),this.api.onActiveChange(()=>{const{accessor:s}=this._params;s.setActive(this)}),this.api.onDidConstraintsChangeInternal(s=>{(typeof s.minimumSize=="number"||typeof s.minimumSize=="function")&&(this._minimumSize=s.minimumSize),(typeof s.maximumSize=="number"||typeof s.maximumSize=="function")&&(this._maximumSize=s.maximumSize),this.updateConstraints()}),this.api.onDidSizeChange(s=>{this._onDidChange.fire({size:s.size})}))}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}layout(e,n){const[s,l]=this.orientation===ke.HORIZONTAL?[e,n]:[n,e];super.layout(s,l)}init(e){super.init(e),this._priority=e.priority,e.minimumSize&&(this._minimumSize=e.minimumSize),e.maximumSize&&(this._maximumSize=e.maximumSize),e.snap&&(this._snap=e.snap)}toJSON(){const e=s=>s===Number.MAX_SAFE_INTEGER||s===Number.POSITIVE_INFINITY?void 0:s,n=s=>s<=0?void 0:s;return Object.assign(Object.assign({},super.toJSON()),{minimumSize:n(this.minimumSize),maximumSize:e(this.maximumSize)})}updateConstraints(){this.api._onDidConstraintsChange.fire({maximumSize:this._evaluatedMaximumSize,minimumSize:this._evaluatedMinimumSize})}}function yx(r,e){return new px(r,e).api}function Sx(r,e){const n=new gx(r,e);return new rw(n)}function Dx(r,e){const n=new mx(r,e);return new ow(n)}function Cx(r,e){const n=new wx(r,e);return new ea(n)}const vw=(r,e)=>{const[n,s]=pe.useState(),l=pe.useRef(r.componentProps);return pe.useImperativeHandle(e,()=>({update:a=>{l.current=Object.assign(Object.assign({},l.current),a),s(Date.now())}}),[]),pe.createElement(r.component,l.current)};vw.displayName="DockviewReactJsBridge";const xx=(()=>{let r=1;return{next:()=>`dockview_react_portal_key_${(r++).toString()}`}})(),Ex=pe.createContext({});class eo{constructor(e,n,s,l,a){this.parent=e,this.portalStore=n,this.component=s,this.parameters=l,this.context=a,this._initialProps={},this.disposed=!1,this.createPortal()}update(e){if(this.disposed)throw new Error("invalid operation: resource is already disposed");this.componentInstance?this.componentInstance.update(e):this._initialProps=Object.assign(Object.assign({},this._initialProps),e)}createPortal(){if(this.disposed)throw new Error("invalid operation: resource is already disposed");if(!bx(this.component))throw new Error("Dockview: Only React.memo(...), React.ForwardRef(...) and functional components are accepted as components");const e=pe.createElement(pe.forwardRef(vw),{component:this.component,componentProps:this.parameters,ref:l=>{this.componentInstance=l,Object.keys(this._initialProps).length>0&&(this.componentInstance.update(this._initialProps),this._initialProps={})}}),n=this.context?pe.createElement(Ex.Provider,{value:this.context},e):e,s=S0.createPortal(n,this.parent,xx.next());this.ref={portal:s,disposable:this.portalStore.addPortal(s)}}dispose(){var e;(e=this.ref)===null||e===void 0||e.disposable.dispose(),this.disposed=!0}}const hc=()=>{const[r,e]=pe.useState([]);pe.useDebugValue(`Portal count: ${r.length}`);const n=pe.useCallback(s=>{e(a=>[...a,s]);let l=!1;return Qt.from(()=>{if(l)throw new Error("invalid operation: resource already disposed");l=!0,e(a=>a.filter(c=>c!==s))})},[]);return[r,n]};function bx(r){return typeof r=="function"||!!(r!=null&&r.$$typeof)}class Ig{get element(){return this._element}constructor(e,n,s){this.id=e,this.component=n,this.reactPortalStore=s,this._onDidFocus=new U,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new U,this.onDidBlur=this._onDidBlur.event,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}focus(){}init(e){this.part=new eo(this.element,this.reactPortalStore,this.component,{params:e.params,api:e.api,containerApi:e.containerApi})}update(e){var n;(n=this.part)===null||n===void 0||n.update({params:e.params})}layout(e,n){}dispose(){var e;this._onDidFocus.dispose(),this._onDidBlur.dispose(),(e=this.part)===null||e===void 0||e.dispose()}}class Rg{get element(){return this._element}constructor(e,n,s){this.id=e,this.component=n,this.reactPortalStore=s,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}focus(){}init(e){this.part=new eo(this.element,this.reactPortalStore,this.component,{params:e.params,api:e.api,containerApi:e.containerApi,tabLocation:e.tabLocation})}update(e){var n;(n=this.part)===null||n===void 0||n.update({params:e.params})}layout(e,n){}dispose(){var e;(e=this.part)===null||e===void 0||e.dispose()}}class Ng{get element(){return this._element}constructor(e,n,s){this.id=e,this.component=n,this.reactPortalStore=s,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}init(e){this.part=new eo(this.element,this.reactPortalStore,this.component,{group:e.group,containerApi:e.containerApi})}focus(){}update(e){var n,s,l;this.parameters&&(this.parameters.params=e.params),(n=this.part)===null||n===void 0||n.update({params:(l=(s=this.parameters)===null||s===void 0?void 0:s.params)!==null&&l!==void 0?l:{}})}layout(e,n){}dispose(){var e;(e=this.part)===null||e===void 0||e.dispose()}}class Px{get element(){return this._element}get part(){return this._part}constructor(e,n,s){this.component=e,this.reactPortalStore=n,this._group=s,this.mutableDisposable=new Bn,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}init(e){this.mutableDisposable.value=new Ne(this._group.model.onDidAddPanel(()=>{this.updatePanels()}),this._group.model.onDidRemovePanel(()=>{this.updatePanels()}),this._group.model.onDidActivePanelChange(()=>{this.updateActivePanel()}),e.api.onDidActiveChange(()=>{this.updateGroupActive()})),this._part=new eo(this.element,this.reactPortalStore,this.component,{api:e.api,containerApi:e.containerApi,panels:this._group.model.panels,activePanel:this._group.model.activePanel,isGroupActive:this._group.api.isActive,group:this._group})}dispose(){var e;this.mutableDisposable.dispose(),(e=this._part)===null||e===void 0||e.dispose()}update(e){var n;(n=this._part)===null||n===void 0||n.update(e.params)}updatePanels(){this.update({params:{panels:this._group.model.panels}})}updateActivePanel(){this.update({params:{activePanel:this._group.model.activePanel}})}updateGroupActive(){this.update({params:{isGroupActive:this._group.api.isActive}})}}function Mo(r,e){return r?n=>new Px(r,e,n):void 0}const Eu="props.defaultTabComponent";function Ax(r){return Ph.reduce((n,s)=>(s in r&&(n[s]=r[s]),n),{})}const ww=pe.forwardRef((r,e)=>{const n=pe.useRef(null),s=pe.useRef(),[l,a]=hc();pe.useImperativeHandle(e,()=>n.current,[]);const c=pe.useRef({});return pe.useEffect(()=>{const d={};Ph.forEach(h=>{const m=h,w=r[m];m in r&&w!==c.current[m]&&(d[m]=w)}),s.current&&s.current.updateOptions(d),c.current=r},Ph.map(d=>r[d])),pe.useEffect(()=>{var d;if(!n.current)return;const h=(d=r.tabComponents)!==null&&d!==void 0?d:{};r.defaultTabComponent&&(h[Eu]=r.defaultTabComponent);const m={createLeftHeaderActionComponent:Mo(r.leftHeaderActionsComponent,{addPortal:a}),createRightHeaderActionComponent:Mo(r.rightHeaderActionsComponent,{addPortal:a}),createPrefixHeaderActionComponent:Mo(r.prefixHeaderActionsComponent,{addPortal:a}),createComponent:E=>new Ig(E.id,r.components[E.name],{addPortal:a}),createTabComponent(E){return new Rg(E.id,h[E.name],{addPortal:a})},createWatermarkComponent:r.watermarkComponent?()=>new Ng("watermark",r.watermarkComponent,{addPortal:a}):void 0,defaultTabComponent:r.defaultTabComponent?Eu:void 0},w=yx(n.current,Object.assign(Object.assign({},Ax(r)),m)),{clientWidth:v,clientHeight:S}=n.current;return w.layout(v,S),r.onReady&&r.onReady({api:w}),s.current=w,()=>{s.current=void 0,w.dispose()}},[]),pe.useEffect(()=>{if(!s.current)return()=>{};const d=s.current.onDidDrop(h=>{r.onDidDrop&&r.onDidDrop(h)});return()=>{d.dispose()}},[r.onDidDrop]),pe.useEffect(()=>{if(!s.current)return()=>{};const d=s.current.onWillDrop(h=>{r.onWillDrop&&r.onWillDrop(h)});return()=>{d.dispose()}},[r.onWillDrop]),pe.useEffect(()=>{s.current&&s.current.updateOptions({createComponent:d=>new Ig(d.id,r.components[d.name],{addPortal:a})})},[r.components]),pe.useEffect(()=>{var d;if(!s.current)return;const h=(d=r.tabComponents)!==null&&d!==void 0?d:{};r.defaultTabComponent&&(h[Eu]=r.defaultTabComponent),s.current.updateOptions({defaultTabComponent:r.defaultTabComponent?Eu:void 0,createTabComponent(m){return new Rg(m.id,h[m.name],{addPortal:a})}})},[r.tabComponents,r.defaultTabComponent]),pe.useEffect(()=>{s.current&&s.current.updateOptions({createWatermarkComponent:r.watermarkComponent?()=>new Ng("watermark",r.watermarkComponent,{addPortal:a}):void 0})},[r.watermarkComponent]),pe.useEffect(()=>{s.current&&s.current.updateOptions({createRightHeaderActionComponent:Mo(r.rightHeaderActionsComponent,{addPortal:a})})},[r.rightHeaderActionsComponent]),pe.useEffect(()=>{s.current&&s.current.updateOptions({createLeftHeaderActionComponent:Mo(r.leftHeaderActionsComponent,{addPortal:a})})},[r.leftHeaderActionsComponent]),pe.useEffect(()=>{s.current&&s.current.updateOptions({createPrefixHeaderActionComponent:Mo(r.prefixHeaderActionsComponent,{addPortal:a})})},[r.prefixHeaderActionsComponent]),pe.createElement("div",{style:{height:"100%",width:"100%"},ref:n},l)});ww.displayName="DockviewComponent";class Mg extends _x{constructor(e,n,s,l){super(e,n),this.reactComponent=s,this.reactPortalStore=l}getComponent(){var e,n;return new eo(this.element,this.reactPortalStore,this.reactComponent,{params:(n=(e=this._params)===null||e===void 0?void 0:e.params)!==null&&n!==void 0?n:{},api:this.api,containerApi:new rw(this._params.accessor)})}}function kx(r){return Sh.reduce((n,s)=>(s in r&&(n[s]=r[s]),n),{})}const zx=pe.forwardRef((r,e)=>{const n=pe.useRef(null),s=pe.useRef(),[l,a]=hc();pe.useImperativeHandle(e,()=>n.current,[]);const c=pe.useRef({});return pe.useEffect(()=>{const d={};Sh.forEach(h=>{const m=h,w=r[m];m in r&&w!==c.current[m]&&(d[m]=w)}),s.current&&s.current.updateOptions(d),c.current=r},Sh.map(d=>r[d])),pe.useEffect(()=>{if(!n.current)return()=>{};const d={createComponent:v=>new Mg(v.id,v.name,r.components[v.name],{addPortal:a})},h=Sx(n.current,Object.assign(Object.assign({},kx(r)),d)),{clientWidth:m,clientHeight:w}=n.current;return h.layout(m,w),r.onReady&&r.onReady({api:h}),s.current=h,()=>{s.current=void 0,h.dispose()}},[]),pe.useEffect(()=>{s.current&&s.current.updateOptions({createComponent:d=>new Mg(d.id,d.name,r.components[d.name],{addPortal:a})})},[r.components]),pe.createElement("div",{style:{height:"100%",width:"100%"},ref:n},l)});zx.displayName="SplitviewComponent";class Lg extends mw{constructor(e,n,s,l){super(e,n),this.reactComponent=s,this.reactPortalStore=l}getComponent(){var e,n;return new eo(this.element,this.reactPortalStore,this.reactComponent,{params:(n=(e=this._params)===null||e===void 0?void 0:e.params)!==null&&n!==void 0?n:{},api:this.api,containerApi:new ow(this._params.accessor)})}}function Ox(r){return Eh.reduce((n,s)=>(s in r&&(n[s]=r[s]),n),{})}const Tx=pe.forwardRef((r,e)=>{const n=pe.useRef(null),s=pe.useRef(),[l,a]=hc();pe.useImperativeHandle(e,()=>n.current,[]);const c=pe.useRef({});return pe.useEffect(()=>{const d={};Eh.forEach(h=>{const m=h,w=r[m];m in r&&w!==c.current[m]&&(d[m]=w)}),s.current&&s.current.updateOptions(d),c.current=r},Eh.map(d=>r[d])),pe.useEffect(()=>{if(!n.current)return()=>{};const d={createComponent:v=>new Lg(v.id,v.name,r.components[v.name],{addPortal:a})},h=Dx(n.current,Object.assign(Object.assign({},Ox(r)),d)),{clientWidth:m,clientHeight:w}=n.current;return h.layout(m,w),r.onReady&&r.onReady({api:h}),s.current=h,()=>{s.current=void 0,h.dispose()}},[]),pe.useEffect(()=>{s.current&&s.current.updateOptions({createComponent:d=>new Lg(d.id,d.name,r.components[d.name],{addPortal:a})})},[r.components]),pe.createElement("div",{style:{height:"100%",width:"100%"},ref:n},l)});Tx.displayName="GridviewComponent";class bu{get element(){return this._element}constructor(e,n,s){this.id=e,this.component=n,this.reactPortalStore=s,this._element=document.createElement("div"),this._element.style.height="100%",this._element.style.width="100%"}init(e){this.part=new eo(this.element,this.reactPortalStore,this.component,{params:e.params,api:e.api,title:e.title,containerApi:e.containerApi})}toJSON(){return{id:this.id}}update(e){var n;(n=this.part)===null||n===void 0||n.update(e.params)}dispose(){var e;(e=this.part)===null||e===void 0||e.dispose()}}function Ix(r){return bh.reduce((n,s)=>(s in r&&(n[s]=r[s]),n),{})}const Rx=pe.forwardRef((r,e)=>{const n=pe.useRef(null),s=pe.useRef(),[l,a]=hc();pe.useImperativeHandle(e,()=>n.current,[]);const c=pe.useRef({});return pe.useEffect(()=>{const d={};bh.forEach(h=>{const m=h,w=r[m];m in r&&w!==c.current[m]&&(d[m]=w)}),s.current&&s.current.updateOptions(d),c.current=r},bh.map(d=>r[d])),pe.useEffect(()=>{var d;if(!n.current)return()=>{};const h=(d=r.headerComponents)!==null&&d!==void 0?d:{},m={createComponent:E=>new bu(E.id,r.components[E.name],{addPortal:a}),createHeaderComponent:E=>new bu(E.id,h[E.name],{addPortal:a})},w=Cx(n.current,Object.assign(Object.assign({},Ix(r)),m)),{clientWidth:v,clientHeight:S}=n.current;return w.layout(v,S),r.onReady&&r.onReady({api:w}),s.current=w,()=>{s.current=void 0,w.dispose()}},[]),pe.useEffect(()=>{s.current&&s.current.updateOptions({createComponent:d=>new bu(d.id,r.components[d.name],{addPortal:a})})},[r.components]),pe.useEffect(()=>{var d;if(!s.current)return;const h=(d=r.headerComponents)!==null&&d!==void 0?d:{};s.current.updateOptions({createHeaderComponent:m=>new bu(m.id,h[m.name],{addPortal:a})})},[r.headerComponents]),pe.useEffect(()=>{if(!s.current)return()=>{};const d=s.current.onDidDrop(h=>{r.onDidDrop&&r.onDidDrop(h)});return()=>{d.dispose()}},[r.onDidDrop]),pe.createElement("div",{style:{height:"100%",width:"100%"},ref:n},l)});Rx.displayName="PaneviewComponent";const Vg="damiao.monitor.layout";function Nx(r){r.addPanel({id:"plot-1",component:"plot",title:"Plot 1"}),r.addPanel({id:"cards-1",component:"cards",title:"Motor Cards",position:{referencePanel:"plot-1",direction:"right"}}),r.addPanel({id:"table-1",component:"table",title:"Motor Table",position:{referencePanel:"plot-1",direction:"below"}}),r.addPanel({id:"raw-1",component:"rawlog",title:"Raw CAN Log",position:{referencePanel:"table-1",direction:"within"}})}function Mx(){const r=B.useCallback(e=>{const{api:n}=e;YD(n);const s=localStorage.getItem(Vg);let l=!1;if(s)try{n.fromJSON(JSON.parse(s)),l=!0}catch{l=!1}l||Nx(n),n.onDidLayoutChange(()=>{try{localStorage.setItem(Vg,JSON.stringify(n.toJSON()))}catch{}})},[]);return Y.jsx(ww,{className:"dockview-theme-abyss",components:$D,onReady:r})}function Lx(){const r=Cn(d=>d.addSignalToPlot),e=Cn(d=>d.setMotorTypes),[n,s]=B.useState(null),l=M0(N0(Mh,{activationConstraint:{distance:4}}));B.useEffect(()=>{Jv(),mD().then(e)},[e]);const a=d=>{var m;const h=(m=d.active.data.current)==null?void 0:m.signalId;s(h?vh(h):null)},c=d=>{var w,v,S,E;s(null);const h=(w=d.active.data.current)==null?void 0:w.signalId,m=((S=(v=d.over)==null?void 0:v.id)==null?void 0:S.toString())||"";if(h&&m.startsWith("plot:")){const A=(E=d.over.data.current)==null?void 0:E.panelId;r(A,h)}};return Y.jsxs(I_,{sensors:l,onDragStart:a,onDragEnd:c,children:[Y.jsxs("div",{className:"app",children:[Y.jsx(JD,{}),Y.jsxs("div",{className:"body",children:[Y.jsx(XD,{}),Y.jsx("main",{className:"dock-host",children:Y.jsx(Mx,{})})]})]}),Y.jsx(q_,{dropAnimation:null,children:n?Y.jsx("div",{className:"drag-ghost",children:n}):null})]})}y0.createRoot(document.getElementById("root")).render(Y.jsx(pe.StrictMode,{children:Y.jsx(Lx,{})})); diff --git a/damiao_motor/gui/webapp/dist/assets/index-BahOMQYE.css b/damiao_motor/gui/webapp/dist/assets/index-BahOMQYE.css deleted file mode 100644 index 00a36d7..0000000 --- a/damiao_motor/gui/webapp/dist/assets/index-BahOMQYE.css +++ /dev/null @@ -1 +0,0 @@ -.dv-scrollable{position:relative;overflow:hidden}.dv-scrollable .dv-scrollbar-horizontal{position:absolute;bottom:0;left:0;height:4px;border-radius:2px;background-color:transparent;will-change:background-color,transform;transform:translateZ(0);backface-visibility:hidden;transition-property:background-color;transition-timing-function:ease-in-out;transition-duration:1s;transition-delay:0s}.dv-scrollable:hover .dv-scrollbar-horizontal,.dv-scrollable.dv-scrollable-resizing .dv-scrollbar-horizontal,.dv-scrollable.dv-scrollable-scrolling .dv-scrollbar-horizontal{background-color:var(--dv-scrollbar-background-color, rgba(255, 255, 255, .25))}.dv-svg{display:inline-block;fill:currentcolor;line-height:1;stroke:currentcolor;stroke-width:0}.dockview-theme-dark{--dv-paneview-active-outline-color: dodgerblue;--dv-tabs-and-actions-container-font-size: 13px;--dv-tabs-and-actions-container-height: 35px;--dv-drag-over-background-color: rgba(83, 89, 93, .5);--dv-drag-over-border-color: transparent;--dv-tabs-container-scrollbar-color: #888;--dv-icon-hover-background-color: rgba(90, 93, 94, .31);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, .5);--dv-overlay-z-index: 999;--dv-tab-font-size: inherit;--dv-border-radius: 0px;--dv-tab-margin: 0;--dv-sash-color: transparent;--dv-active-sash-color: transparent;--dv-active-sash-transition-duration: .1s;--dv-active-sash-transition-delay: .5s;--dv-group-view-background-color: #1e1e1e;--dv-tabs-and-actions-container-background-color: #252526;--dv-activegroup-visiblepanel-tab-background-color: #1e1e1e;--dv-activegroup-hiddenpanel-tab-background-color: #2d2d2d;--dv-inactivegroup-visiblepanel-tab-background-color: #1e1e1e;--dv-inactivegroup-hiddenpanel-tab-background-color: #2d2d2d;--dv-tab-divider-color: #1e1e1e;--dv-activegroup-visiblepanel-tab-color: white;--dv-activegroup-hiddenpanel-tab-color: #969696;--dv-inactivegroup-visiblepanel-tab-color: #8f8f8f;--dv-inactivegroup-hiddenpanel-tab-color: #626262;--dv-separator-border: rgb(68, 68, 68);--dv-paneview-header-border-color: rgba(204, 204, 204, .2)}.dockview-theme-dark .dv-drop-target-container .dv-drop-target-anchor.dv-drop-target-anchor-container-changed{opacity:0;transition:none}.dockview-theme-light{--dv-paneview-active-outline-color: dodgerblue;--dv-tabs-and-actions-container-font-size: 13px;--dv-tabs-and-actions-container-height: 35px;--dv-drag-over-background-color: rgba(83, 89, 93, .5);--dv-drag-over-border-color: transparent;--dv-tabs-container-scrollbar-color: #888;--dv-icon-hover-background-color: rgba(90, 93, 94, .31);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, .5);--dv-overlay-z-index: 999;--dv-tab-font-size: inherit;--dv-border-radius: 0px;--dv-tab-margin: 0;--dv-sash-color: transparent;--dv-active-sash-color: transparent;--dv-active-sash-transition-duration: .1s;--dv-active-sash-transition-delay: .5s;--dv-group-view-background-color: white;--dv-tabs-and-actions-container-background-color: #f3f3f3;--dv-activegroup-visiblepanel-tab-background-color: white;--dv-activegroup-hiddenpanel-tab-background-color: #ececec;--dv-inactivegroup-visiblepanel-tab-background-color: white;--dv-inactivegroup-hiddenpanel-tab-background-color: #ececec;--dv-tab-divider-color: white;--dv-activegroup-visiblepanel-tab-color: rgb(51, 51, 51);--dv-activegroup-hiddenpanel-tab-color: rgba(51, 51, 51, .7);--dv-inactivegroup-visiblepanel-tab-color: rgba(51, 51, 51, .7);--dv-inactivegroup-hiddenpanel-tab-color: rgba(51, 51, 51, .35);--dv-separator-border: rgba(128, 128, 128, .35);--dv-paneview-header-border-color: rgb(51, 51, 51);--dv-scrollbar-background-color: rgba(0, 0, 0, .25)}.dockview-theme-light .dv-drop-target-container .dv-drop-target-anchor.dv-drop-target-anchor-container-changed{opacity:0;transition:none}.dockview-theme-vs{--dv-paneview-active-outline-color: dodgerblue;--dv-tabs-and-actions-container-font-size: 13px;--dv-tabs-and-actions-container-height: 35px;--dv-drag-over-background-color: rgba(83, 89, 93, .5);--dv-drag-over-border-color: transparent;--dv-tabs-container-scrollbar-color: #888;--dv-icon-hover-background-color: rgba(90, 93, 94, .31);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, .5);--dv-overlay-z-index: 999;--dv-tab-font-size: inherit;--dv-border-radius: 0px;--dv-tab-margin: 0;--dv-sash-color: transparent;--dv-active-sash-color: transparent;--dv-active-sash-transition-duration: .1s;--dv-active-sash-transition-delay: .5s;--dv-group-view-background-color: #1e1e1e;--dv-tabs-and-actions-container-background-color: #252526;--dv-activegroup-visiblepanel-tab-background-color: #1e1e1e;--dv-activegroup-hiddenpanel-tab-background-color: #2d2d2d;--dv-inactivegroup-visiblepanel-tab-background-color: #1e1e1e;--dv-inactivegroup-hiddenpanel-tab-background-color: #2d2d2d;--dv-tab-divider-color: #1e1e1e;--dv-activegroup-hiddenpanel-tab-color: #969696;--dv-inactivegroup-visiblepanel-tab-color: #8f8f8f;--dv-inactivegroup-hiddenpanel-tab-color: #626262;--dv-separator-border: rgb(68, 68, 68);--dv-paneview-header-border-color: rgba(204, 204, 204, .2);--dv-tabs-and-actions-container-background-color: #2d2d30;--dv-tabs-and-actions-container-height: 20px;--dv-tabs-and-actions-container-font-size: 11px;--dv-activegroup-visiblepanel-tab-background-color: #007acc;--dv-inactivegroup-visiblepanel-tab-background-color: #3f3f46;--dv-activegroup-visiblepanel-tab-color: white;--dv-activegroup-hiddenpanel-tab-color: white;--dv-inactivegroup-visiblepanel-tab-color: white;--dv-inactivegroup-hiddenpanel-tab-color: white}.dockview-theme-vs .dv-drop-target-container .dv-drop-target-anchor.dv-drop-target-anchor-container-changed{opacity:0;transition:none}.dockview-theme-vs .dv-groupview.dv-active-group>.dv-tabs-and-actions-container{box-sizing:content-box;border-bottom:2px solid var(--dv-activegroup-visiblepanel-tab-background-color)}.dockview-theme-vs .dv-groupview.dv-active-group>.dv-tabs-and-actions-container .dv-tab.dv-active-tab{border-top:2px solid var(--dv-activegroup-visiblepanel-tab-background-color)}.dockview-theme-vs .dv-groupview.dv-active-group>.dv-tabs-and-actions-container .dv-tab.dv-inactive-tab{border-top:2px solid var(--dv-activegroup-hiddenpanel-tab-background-color)}.dockview-theme-vs .dv-groupview.dv-inactive-group>.dv-tabs-and-actions-container{box-sizing:content-box;border-bottom:2px solid var(--dv-inactivegroup-visiblepanel-tab-background-color)}.dockview-theme-vs .dv-groupview.dv-inactive-group>.dv-tabs-and-actions-container .dv-tab.dv-active-tab{border-top:2px solid var(--dv-inactivegroup-visiblepanel-tab-background-color)}.dockview-theme-vs .dv-groupview.dv-inactive-group>.dv-tabs-and-actions-container .dv-tab.dv-inactive-tab{border-top:2px solid var(--dv-inactivegroup-hiddenpanel-tab-background-color)}.dockview-theme-abyss{--dv-paneview-active-outline-color: dodgerblue;--dv-tabs-and-actions-container-font-size: 13px;--dv-tabs-and-actions-container-height: 35px;--dv-drag-over-background-color: rgba(83, 89, 93, .5);--dv-drag-over-border-color: transparent;--dv-tabs-container-scrollbar-color: #888;--dv-icon-hover-background-color: rgba(90, 93, 94, .31);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, .5);--dv-overlay-z-index: 999;--dv-tab-font-size: inherit;--dv-border-radius: 0px;--dv-tab-margin: 0;--dv-sash-color: transparent;--dv-active-sash-color: transparent;--dv-active-sash-transition-duration: .1s;--dv-active-sash-transition-delay: .5s;--dv-color-abyss-dark: #000c18;--dv-color-abyss: #10192c;--dv-color-abyss-light: #1c1c2a;--dv-color-abyss-lighter: #2b2b4a;--dv-color-abyss-accent: rgb(91, 30, 207);--dv-color-abyss-primary-text: white;--dv-color-abyss-secondary-text: rgb(148, 151, 169);--dv-group-view-background-color: var(--dv-color-abyss-dark);--dv-tabs-and-actions-container-background-color: var( --dv-color-abyss-light );--dv-activegroup-visiblepanel-tab-background-color: var( --dv-color-abyss-dark );--dv-activegroup-hiddenpanel-tab-background-color: var(--dv-color-abyss);--dv-inactivegroup-visiblepanel-tab-background-color: var( --dv-color-abyss-dark );--dv-inactivegroup-hiddenpanel-tab-background-color: var(--dv-color-abyss);--dv-tab-divider-color: var(--dv-color-abyss-lighter);--dv-activegroup-visiblepanel-tab-color: white;--dv-activegroup-hiddenpanel-tab-color: rgba(255, 255, 255, .5);--dv-inactivegroup-visiblepanel-tab-color: rgba(255, 255, 255, .5);--dv-inactivegroup-hiddenpanel-tab-color: rgba(255, 255, 255, .25);--dv-separator-border: var(--dv-color-abyss-lighter);--dv-paneview-header-border-color: var(--dv-color-abyss-lighter);--dv-paneview-active-outline-color: #596f99}.dockview-theme-abyss .dv-drop-target-container .dv-drop-target-anchor.dv-drop-target-anchor-container-changed{opacity:0;transition:none}.dockview-theme-dracula{--dv-paneview-active-outline-color: dodgerblue;--dv-tabs-and-actions-container-font-size: 13px;--dv-tabs-and-actions-container-height: 35px;--dv-drag-over-background-color: rgba(83, 89, 93, .5);--dv-drag-over-border-color: transparent;--dv-tabs-container-scrollbar-color: #888;--dv-icon-hover-background-color: rgba(90, 93, 94, .31);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, .5);--dv-overlay-z-index: 999;--dv-tab-font-size: inherit;--dv-border-radius: 0px;--dv-tab-margin: 0;--dv-sash-color: transparent;--dv-active-sash-color: transparent;--dv-active-sash-transition-duration: .1s;--dv-active-sash-transition-delay: .5s;--dv-group-view-background-color: #282a36;--dv-tabs-and-actions-container-background-color: #191a21;--dv-activegroup-visiblepanel-tab-background-color: #282a36;--dv-activegroup-hiddenpanel-tab-background-color: #21222c;--dv-inactivegroup-visiblepanel-tab-background-color: #282a36;--dv-inactivegroup-hiddenpanel-tab-background-color: #21222c;--dv-tab-divider-color: #191a21;--dv-activegroup-visiblepanel-tab-color: rgb(248, 248, 242);--dv-activegroup-hiddenpanel-tab-color: rgb(98, 114, 164);--dv-inactivegroup-visiblepanel-tab-color: rgba(248, 248, 242, .5);--dv-inactivegroup-hiddenpanel-tab-color: rgba(98, 114, 164, .5);--dv-separator-border: #bd93f9;--dv-paneview-header-border-color: #bd93f9;--dv-paneview-active-outline-color: #6272a4}.dockview-theme-dracula .dv-drop-target-container .dv-drop-target-anchor.dv-drop-target-anchor-container-changed{opacity:0;transition:none}.dockview-theme-dracula .dv-groupview.dv-active-group>.dv-tabs-and-actions-container .dv-tabs-container>.dv-tab.dv-active-tab{position:relative}.dockview-theme-dracula .dv-groupview.dv-active-group>.dv-tabs-and-actions-container .dv-tabs-container>.dv-tab.dv-active-tab:after{position:absolute;left:0;top:0;content:"";width:100%;height:1px;background-color:#94527e;z-index:999}.dockview-theme-dracula .dv-groupview.dv-inactive-group>.dv-tabs-and-actions-container .dv-tabs-container>.dv-tab.dv-active-tab{position:relative}.dockview-theme-dracula .dv-groupview.dv-inactive-group>.dv-tabs-and-actions-container .dv-tabs-container>.dv-tab.dv-active-tab:after{position:absolute;left:0;bottom:0;content:"";width:100%;height:1px;background-color:#5e3d5a;z-index:999}.dockview-theme-replit{--dv-paneview-active-outline-color: dodgerblue;--dv-tabs-and-actions-container-font-size: 13px;--dv-tabs-and-actions-container-height: 35px;--dv-drag-over-background-color: rgba(83, 89, 93, .5);--dv-drag-over-border-color: transparent;--dv-tabs-container-scrollbar-color: #888;--dv-icon-hover-background-color: rgba(90, 93, 94, .31);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, .5);--dv-overlay-z-index: 999;--dv-tab-font-size: inherit;--dv-border-radius: 0px;--dv-tab-margin: 0;--dv-sash-color: transparent;--dv-active-sash-color: transparent;--dv-active-sash-transition-duration: .1s;--dv-active-sash-transition-delay: .5s;box-sizing:border-box;padding:10px;background-color:#ebeced;--dv-group-view-background-color: #ebeced;--dv-tabs-and-actions-container-background-color: #fcfcfc;--dv-activegroup-visiblepanel-tab-background-color: #f0f1f2;--dv-activegroup-hiddenpanel-tab-background-color: #fcfcfc;--dv-inactivegroup-visiblepanel-tab-background-color: #f0f1f2;--dv-inactivegroup-hiddenpanel-tab-background-color: #fcfcfc;--dv-tab-divider-color: transparent;--dv-activegroup-visiblepanel-tab-color: rgb(51, 51, 51);--dv-activegroup-hiddenpanel-tab-color: rgb(51, 51, 51);--dv-inactivegroup-visiblepanel-tab-color: rgb(51, 51, 51);--dv-inactivegroup-hiddenpanel-tab-color: rgb(51, 51, 51);--dv-separator-border: transparent;--dv-paneview-header-border-color: rgb(51, 51, 51);--dv-sash-color: #cfd1d3;--dv-active-sash-color: #babbbb}.dockview-theme-replit .dv-drop-target-container .dv-drop-target-anchor.dv-drop-target-anchor-container-changed{opacity:0;transition:none}.dockview-theme-replit .dv-resize-container:has(>.dv-groupview){border-radius:8px}.dockview-theme-replit .dv-resize-container{border-radius:10px!important;border:none}.dockview-theme-replit .dv-groupview{overflow:hidden;border-radius:10px}.dockview-theme-replit .dv-groupview .dv-tabs-and-actions-container{border-bottom:1px solid rgba(128,128,128,.35)}.dockview-theme-replit .dv-groupview .dv-tabs-and-actions-container .dv-tab{margin:4px;border-radius:8px}.dockview-theme-replit .dv-groupview .dv-tabs-and-actions-container .dv-tab .dv-svg{height:8px;width:8px}.dockview-theme-replit .dv-groupview .dv-tabs-and-actions-container .dv-tab:hover{background-color:#e4e5e6!important}.dockview-theme-replit .dv-groupview .dv-content-container{background-color:#fcfcfc}.dockview-theme-replit .dv-groupview.dv-active-group{border:1px solid rgba(128,128,128,.35)}.dockview-theme-replit .dv-groupview.dv-inactive-group{border:1px solid transparent}.dockview-theme-replit .dv-vertical>.dv-sash-container>.dv-sash{background-color:transparent}.dockview-theme-replit .dv-vertical>.dv-sash-container>.dv-sash:not(.disabled):after{content:"";height:4px;width:40px;border-radius:2px;top:50%;left:50%;transform:translate(-50%,-50%);background-color:var(--dv-sash-color);position:absolute}.dockview-theme-replit .dv-vertical>.dv-sash-container>.dv-sash:not(.disabled):hover,.dockview-theme-replit .dv-vertical>.dv-sash-container>.dv-sash:not(.disabled):active{background-color:transparent}.dockview-theme-replit .dv-vertical>.dv-sash-container>.dv-sash:not(.disabled):hover:after,.dockview-theme-replit .dv-vertical>.dv-sash-container>.dv-sash:not(.disabled):active:after{background-color:var(--dv-active-sash-color)}.dockview-theme-replit .dv-horizontal>.dv-sash-container>.dv-sash{background-color:transparent}.dockview-theme-replit .dv-horizontal>.dv-sash-container>.dv-sash:not(.disabled):after{content:"";height:40px;width:4px;border-radius:2px;top:50%;left:50%;transform:translate(-50%,-50%);background-color:var(--dv-sash-color);position:absolute}.dockview-theme-replit .dv-horizontal>.dv-sash-container>.dv-sash:not(.disabled):hover,.dockview-theme-replit .dv-horizontal>.dv-sash-container>.dv-sash:not(.disabled):active{background-color:transparent}.dockview-theme-replit .dv-horizontal>.dv-sash-container>.dv-sash:not(.disabled):hover:after,.dockview-theme-replit .dv-horizontal>.dv-sash-container>.dv-sash:not(.disabled):active:after{background-color:var(--dv-active-sash-color)}.dockview-theme-abyss-spaced{--dv-paneview-active-outline-color: dodgerblue;--dv-tabs-and-actions-container-font-size: 13px;--dv-tabs-and-actions-container-height: 35px;--dv-drag-over-background-color: rgba(83, 89, 93, .5);--dv-drag-over-border-color: transparent;--dv-tabs-container-scrollbar-color: #888;--dv-icon-hover-background-color: rgba(90, 93, 94, .31);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, .5);--dv-overlay-z-index: 999;--dv-tab-font-size: inherit;--dv-border-radius: 0px;--dv-tab-margin: 0;--dv-sash-color: transparent;--dv-active-sash-color: transparent;--dv-active-sash-transition-duration: .1s;--dv-active-sash-transition-delay: .5s;--dv-tab-font-size: 12px;--dv-tab-margin: .5rem .25rem;--dv-tabs-and-actions-container-height: 44px;--dv-border-radius: 20px;box-sizing:border-box;--dv-color-abyss-dark: rgb(11, 6, 17);--dv-color-abyss: #16121f;--dv-color-abyss-light: #201d2b;--dv-color-abyss-lighter: #2a2837;--dv-color-abyss-accent: rgb(91, 30, 207);--dv-color-abyss-primary-text: white;--dv-color-abyss-secondary-text: rgb(148, 151, 169);--dv-drag-over-border: 2px solid var(--dv-color-abyss-accent);--dv-drag-over-background-color: "";--dv-group-view-background-color: var(--dv-color-abyss-dark);--dv-tabs-and-actions-container-background-color: var(--dv-color-abyss);--dv-activegroup-visiblepanel-tab-background-color: var( --dv-color-abyss-lighter );--dv-activegroup-hiddenpanel-tab-background-color: var( --dv-color-abyss-light );--dv-inactivegroup-visiblepanel-tab-background-color: var( --dv-color-abyss-lighter );--dv-inactivegroup-hiddenpanel-tab-background-color: var( --dv-color-abyss-light );--dv-tab-divider-color: transparent;--dv-activegroup-visiblepanel-tab-color: var(--dv-color-abyss-primary-text);--dv-activegroup-hiddenpanel-tab-color: var( --dv-color-abyss-secondary-text );--dv-inactivegroup-visiblepanel-tab-color: var( --dv-color-abyss-primary-text );--dv-inactivegroup-hiddenpanel-tab-color: var( --dv-color-abyss-secondary-text );--dv-separator-border: transparent;--dv-paneview-header-border-color: rgb(51, 51, 51);--dv-active-sash-color: var(--dv-color-abyss-accent);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(0, 0, 0, .5);padding:10px;background-color:var(--dv-color-abyss-dark)}.dockview-theme-abyss-spaced .dv-resize-container:has(>.dv-groupview){border-radius:8px}.dockview-theme-abyss-spaced .dv-sash{border-radius:4px}.dockview-theme-abyss-spaced .dv-drop-target-anchor{border-radius:calc(var(--dv-border-radius) / 4)}.dockview-theme-abyss-spaced .dv-drop-target-anchor.dv-drop-target-content{border-radius:var(--dv-border-radius)}.dockview-theme-abyss-spaced .dv-resize-container{border-radius:var(--dv-border-radius)!important;border:none}.dockview-theme-abyss-spaced .dv-tabs-overflow-container,.dockview-theme-abyss-spaced .dv-tabs-overflow-dropdown-default{border-radius:8px;height:unset!important}.dockview-theme-abyss-spaced .dv-tab{border-radius:8px}.dockview-theme-abyss-spaced .dv-tab .dv-svg{height:8px;width:8px}.dockview-theme-abyss-spaced .dv-groupview{border-radius:var(--dv-border-radius)}.dockview-theme-abyss-spaced .dv-groupview .dv-tabs-and-actions-container{padding:0px calc(var(--dv-border-radius) / 2)}.dockview-theme-abyss-spaced .dv-groupview .dv-content-container{background-color:var(--dv-tabs-and-actions-container-background-color)}.dockview-theme-abyss-spaced .dv-resize-container .dv-groupview{border:2px solid var(--dv-color-abyss-dark)}.dockview-theme-light-spaced{--dv-paneview-active-outline-color: dodgerblue;--dv-tabs-and-actions-container-font-size: 13px;--dv-tabs-and-actions-container-height: 35px;--dv-drag-over-background-color: rgba(83, 89, 93, .5);--dv-drag-over-border-color: transparent;--dv-tabs-container-scrollbar-color: #888;--dv-icon-hover-background-color: rgba(90, 93, 94, .31);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, .5);--dv-overlay-z-index: 999;--dv-tab-font-size: inherit;--dv-border-radius: 0px;--dv-tab-margin: 0;--dv-sash-color: transparent;--dv-active-sash-color: transparent;--dv-active-sash-transition-duration: .1s;--dv-active-sash-transition-delay: .5s;--dv-tab-font-size: 12px;--dv-tab-margin: .5rem .25rem;--dv-tabs-and-actions-container-height: 44px;--dv-border-radius: 20px;box-sizing:border-box;--dv-drag-over-border: 2px solid rgb(91, 30, 207);--dv-drag-over-background-color: "";--dv-group-view-background-color: #f6f5f9;--dv-tabs-and-actions-container-background-color: white;--dv-activegroup-visiblepanel-tab-background-color: #ededf0;--dv-activegroup-hiddenpanel-tab-background-color: #f9f9fa;--dv-inactivegroup-visiblepanel-tab-background-color: #ededf0;--dv-inactivegroup-hiddenpanel-tab-background-color: #f9f9fa;--dv-tab-divider-color: transparent;--dv-activegroup-visiblepanel-tab-color: rgb(104, 107, 130);--dv-activegroup-hiddenpanel-tab-color: rgb(148, 151, 169);--dv-inactivegroup-visiblepanel-tab-color: rgb(104, 107, 130);--dv-inactivegroup-hiddenpanel-tab-color: rgb(148, 151, 169);--dv-separator-border: transparent;--dv-paneview-header-border-color: rgb(51, 51, 51);--dv-active-sash-color: rgb(91, 30, 207);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(0, 0, 0, .1);padding:10px;background-color:#f6f5f9;--dv-scrollbar-background-color: rgba(0, 0, 0, .25)}.dockview-theme-light-spaced .dv-resize-container:has(>.dv-groupview){border-radius:8px}.dockview-theme-light-spaced .dv-sash{border-radius:4px}.dockview-theme-light-spaced .dv-drop-target-anchor{border-radius:calc(var(--dv-border-radius) / 4)}.dockview-theme-light-spaced .dv-drop-target-anchor.dv-drop-target-content{border-radius:var(--dv-border-radius)}.dockview-theme-light-spaced .dv-resize-container{border-radius:var(--dv-border-radius)!important;border:none}.dockview-theme-light-spaced .dv-tabs-overflow-container,.dockview-theme-light-spaced .dv-tabs-overflow-dropdown-default{border-radius:8px;height:unset!important}.dockview-theme-light-spaced .dv-tab{border-radius:8px}.dockview-theme-light-spaced .dv-tab .dv-svg{height:8px;width:8px}.dockview-theme-light-spaced .dv-groupview{border-radius:var(--dv-border-radius)}.dockview-theme-light-spaced .dv-groupview .dv-tabs-and-actions-container{padding:0px calc(var(--dv-border-radius) / 2)}.dockview-theme-light-spaced .dv-groupview .dv-content-container{background-color:var(--dv-tabs-and-actions-container-background-color)}.dockview-theme-light-spaced .dv-resize-container .dv-groupview{border:2px solid rgba(255,255,255,.1)}.dv-drop-target-container{position:absolute;z-index:9999;top:0;left:0;height:100%;width:100%;pointer-events:none;overflow:hidden;--dv-transition-duration: .3s}.dv-drop-target-container .dv-drop-target-anchor{position:relative;border:var(--dv-drag-over-border);background-color:var(--dv-drag-over-background-color);opacity:1;will-change:transform,opacity;transform:translateZ(0);backface-visibility:hidden;contain:layout paint;transition:opacity var(--dv-transition-duration) ease-in,transform var(--dv-transition-duration) ease-out}.dv-drop-target{position:relative;--dv-transition-duration: 70ms}.dv-drop-target>.dv-drop-target-dropzone{position:absolute;left:0;top:0;height:100%;width:100%;z-index:1000;pointer-events:none}.dv-drop-target>.dv-drop-target-dropzone>.dv-drop-target-selection{position:relative;box-sizing:border-box;height:100%;width:100%;border:var(--dv-drag-over-border);background-color:var(--dv-drag-over-background-color);transition:top var(--dv-transition-duration) ease-out,left var(--dv-transition-duration) ease-out,width var(--dv-transition-duration) ease-out,height var(--dv-transition-duration) ease-out,opacity var(--dv-transition-duration) ease-out;will-change:transform;pointer-events:none}.dv-drop-target>.dv-drop-target-dropzone>.dv-drop-target-selection.dv-drop-target-top.dv-drop-target-small-vertical{border-top:1px solid var(--dv-drag-over-border-color)}.dv-drop-target>.dv-drop-target-dropzone>.dv-drop-target-selection.dv-drop-target-bottom.dv-drop-target-small-vertical{border-bottom:1px solid var(--dv-drag-over-border-color)}.dv-drop-target>.dv-drop-target-dropzone>.dv-drop-target-selection.dv-drop-target-left.dv-drop-target-small-horizontal{border-left:1px solid var(--dv-drag-over-border-color)}.dv-drop-target>.dv-drop-target-dropzone>.dv-drop-target-selection.dv-drop-target-right.dv-drop-target-small-horizontal{border-right:1px solid var(--dv-drag-over-border-color)}.dv-dockview{position:relative;background-color:var(--dv-group-view-background-color);contain:layout}.dv-dockview .dv-watermark-container{position:absolute;top:0;left:0;height:100%;width:100%;z-index:1}.dv-dockview .dv-overlay-render-container{position:relative}.dv-groupview.dv-active-group>.dv-tabs-and-actions-container .dv-tabs-container>.dv-tab.dv-active-tab{background-color:var(--dv-activegroup-visiblepanel-tab-background-color);color:var(--dv-activegroup-visiblepanel-tab-color)}.dv-groupview.dv-active-group>.dv-tabs-and-actions-container .dv-tabs-container>.dv-tab.dv-inactive-tab{background-color:var(--dv-activegroup-hiddenpanel-tab-background-color);color:var(--dv-activegroup-hiddenpanel-tab-color)}.dv-groupview.dv-inactive-group>.dv-tabs-and-actions-container .dv-tabs-container>.dv-tab.dv-active-tab{background-color:var(--dv-inactivegroup-visiblepanel-tab-background-color);color:var(--dv-inactivegroup-visiblepanel-tab-color)}.dv-groupview.dv-inactive-group>.dv-tabs-and-actions-container .dv-tabs-container>.dv-tab.dv-inactive-tab{background-color:var(--dv-inactivegroup-hiddenpanel-tab-background-color);color:var(--dv-inactivegroup-hiddenpanel-tab-color)}.dv-tab.dv-tab-dragging{background-color:var(--dv-activegroup-visiblepanel-tab-background-color);color:var(--dv-activegroup-visiblepanel-tab-color)}.dv-groupview{display:flex;flex-direction:column;height:100%;background-color:var(--dv-group-view-background-color);overflow:hidden}.dv-groupview:focus{outline:none}.dv-groupview>.dv-content-container{flex-grow:1;min-height:0;outline:none}.dv-root-wrapper,.dv-grid-view,.dv-branch-node{height:100%;width:100%}.dv-debug .dv-resize-container .dv-resize-handle-top{background-color:red}.dv-debug .dv-resize-container .dv-resize-handle-bottom{background-color:green}.dv-debug .dv-resize-container .dv-resize-handle-left{background-color:#ff0}.dv-debug .dv-resize-container .dv-resize-handle-right{background-color:#00f}.dv-debug .dv-resize-container .dv-resize-handle-topleft,.dv-debug .dv-resize-container .dv-resize-handle-topright,.dv-debug .dv-resize-container .dv-resize-handle-bottomleft,.dv-debug .dv-resize-container .dv-resize-handle-bottomright{background-color:#0ff}.dv-resize-container{--dv-overlay-z-index: var(--dv-overlay-z-index, 999);position:absolute;z-index:calc(var(--dv-overlay-z-index) - 2);border:1px solid var(--dv-tab-divider-color);box-shadow:var(--dv-floating-box-shadow);will-change:transform,opacity;transform:translateZ(0);backface-visibility:hidden}.dv-resize-container.dv-hidden{display:none}.dv-resize-container.dv-resize-container-dragging{opacity:.5;will-change:transform,opacity}.dv-resize-container .dv-resize-handle-top{height:4px;width:calc(100% - 8px);left:4px;top:-2px;z-index:var(--dv-overlay-z-index);position:absolute;cursor:ns-resize}.dv-resize-container .dv-resize-handle-bottom{height:4px;width:calc(100% - 8px);left:4px;bottom:-2px;z-index:var(--dv-overlay-z-index);position:absolute;cursor:ns-resize}.dv-resize-container .dv-resize-handle-left{height:calc(100% - 8px);width:4px;left:-2px;top:4px;z-index:var(--dv-overlay-z-index);position:absolute;cursor:ew-resize}.dv-resize-container .dv-resize-handle-right{height:calc(100% - 8px);width:4px;right:-2px;top:4px;z-index:var(--dv-overlay-z-index);position:absolute;cursor:ew-resize}.dv-resize-container .dv-resize-handle-topleft{height:4px;width:4px;top:-2px;left:-2px;z-index:var(--dv-overlay-z-index);position:absolute;cursor:nw-resize}.dv-resize-container .dv-resize-handle-topright{height:4px;width:4px;right:-2px;top:-2px;z-index:var(--dv-overlay-z-index);position:absolute;cursor:ne-resize}.dv-resize-container .dv-resize-handle-bottomleft{height:4px;width:4px;left:-2px;bottom:-2px;z-index:var(--dv-overlay-z-index);position:absolute;cursor:sw-resize}.dv-resize-container .dv-resize-handle-bottomright{height:4px;width:4px;right:-2px;bottom:-2px;z-index:var(--dv-overlay-z-index);position:absolute;cursor:se-resize}.dv-render-overlay{--dv-overlay-z-index: var(--dv-overlay-z-index, 999);position:absolute;z-index:1;width:100%;height:100%;contain:layout paint;isolation:isolate;will-change:transform;transform:translateZ(0);backface-visibility:hidden}.dv-render-overlay.dv-render-overlay-float{z-index:calc(var(--dv-overlay-z-index) - 1)}.dv-debug .dv-render-overlay{outline:1px solid red;outline-offset:-1}.dv-pane-container{height:100%;width:100%}.dv-pane-container.dv-animated .dv-view{will-change:transform;transform:translateZ(0);backface-visibility:hidden;transition:transform .15s ease-out}.dv-pane-container .dv-view{overflow:hidden;display:flex;flex-direction:column;padding:0!important}.dv-pane-container .dv-view:not(:first-child):before{background-color:transparent!important}.dv-pane-container .dv-view:not(:first-child) .dv-pane>.dv-pane-header{border-top:1px solid var(--dv-paneview-header-border-color)}.dv-pane-container .dv-view .dv-default-header{background-color:var(--dv-group-view-background-color);color:var(--dv-activegroup-visiblepanel-tab-color);display:flex;padding:0 8px;cursor:pointer}.dv-pane-container .dv-view .dv-default-header .dv-pane-header-icon{display:flex;justify-content:center;align-items:center}.dv-pane-container .dv-view .dv-default-header>span{padding-left:8px;flex-grow:1}.dv-pane-container:first-of-type>.dv-pane>.dv-pane-header{border-top:none!important}.dv-pane-container .dv-pane{display:flex;flex-direction:column;overflow:hidden;height:100%}.dv-pane-container .dv-pane .dv-pane-header{box-sizing:border-box;-webkit-user-select:none;user-select:none;position:relative;outline:none}.dv-pane-container .dv-pane .dv-pane-header.dv-pane-draggable{cursor:pointer}.dv-pane-container .dv-pane .dv-pane-header:focus:before,.dv-pane-container .dv-pane .dv-pane-header:focus-within:before{position:absolute;top:0;left:0;width:100%;height:100%;z-index:5;content:"";pointer-events:none;outline:1px solid;outline-width:-1px;outline-style:solid;outline-offset:-1px;outline-color:var(--dv-paneview-active-outline-color)}.dv-pane-container .dv-pane .dv-pane-body{overflow-y:auto;overflow-x:hidden;flex-grow:1;position:relative;outline:none}.dv-pane-container .dv-pane .dv-pane-body:focus:before,.dv-pane-container .dv-pane .dv-pane-body:focus-within:before{position:absolute;top:0;left:0;width:100%;height:100%;z-index:5;content:"";pointer-events:none;outline:1px solid;outline-width:-1px;outline-style:solid;outline-offset:-1px;outline-color:var(--dv-paneview-active-outline-color)}.dv-debug .dv-split-view-container .dv-sash-container .dv-sash.dv-enabled{background-color:#000}.dv-debug .dv-split-view-container .dv-sash-container .dv-sash.dv-disabled{background-color:orange}.dv-debug .dv-split-view-container .dv-sash-container .dv-sash.dv-maximum{background-color:green}.dv-debug .dv-split-view-container .dv-sash-container .dv-sash.dv-minimum{background-color:red}.dv-split-view-container{position:relative;overflow:hidden;height:100%;width:100%}.dv-split-view-container.dv-splitview-disabled>.dv-sash-container>.dv-sash{pointer-events:none}.dv-split-view-container.dv-animation .dv-view,.dv-split-view-container.dv-animation .dv-sash{will-change:transform;transform:translateZ(0);backface-visibility:hidden;transition:transform .15s ease-out}.dv-split-view-container.dv-horizontal{height:100%}.dv-split-view-container.dv-horizontal>.dv-sash-container>.dv-sash{height:100%;width:4px}.dv-split-view-container.dv-horizontal>.dv-sash-container>.dv-sash.dv-enabled{cursor:ew-resize}.dv-split-view-container.dv-horizontal>.dv-sash-container>.dv-sash.dv-disabled{cursor:default}.dv-split-view-container.dv-horizontal>.dv-sash-container>.dv-sash.dv-maximum{cursor:w-resize}.dv-split-view-container.dv-horizontal>.dv-sash-container>.dv-sash.dv-minimum{cursor:e-resize}.dv-split-view-container.dv-horizontal>.dv-view-container>.dv-view:not(:first-child):before{height:100%;width:1px}.dv-split-view-container.dv-vertical{width:100%}.dv-split-view-container.dv-vertical>.dv-sash-container>.dv-sash{width:100%;height:4px}.dv-split-view-container.dv-vertical>.dv-sash-container>.dv-sash.dv-enabled{cursor:ns-resize}.dv-split-view-container.dv-vertical>.dv-sash-container>.dv-sash.dv-disabled{cursor:default}.dv-split-view-container.dv-vertical>.dv-sash-container>.dv-sash.dv-maximum{cursor:n-resize}.dv-split-view-container.dv-vertical>.dv-sash-container>.dv-sash.dv-minimum{cursor:s-resize}.dv-split-view-container.dv-vertical>.dv-view-container>.dv-view{width:100%}.dv-split-view-container.dv-vertical>.dv-view-container>.dv-view:not(:first-child):before{height:1px;width:100%}.dv-split-view-container .dv-sash-container{height:100%;width:100%;position:absolute}.dv-split-view-container .dv-sash-container .dv-sash{position:absolute;z-index:99;outline:none;user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;touch-action:none;background-color:var(--dv-sash-color, transparent)}.dv-split-view-container .dv-sash-container .dv-sash:not(.disabled):active,.dv-split-view-container .dv-sash-container .dv-sash:not(.disabled):hover{background-color:var(--dv-active-sash-color, transparent);transition-property:background-color;transition-timing-function:ease-in-out;transition-duration:var(--dv-active-sash-transition-duration, .1s);transition-delay:var(--dv-active-sash-transition-delay, .5s)}.dv-split-view-container .dv-view-container{position:relative;height:100%;width:100%}.dv-split-view-container .dv-view-container .dv-view{height:100%;box-sizing:border-box;overflow:auto;position:absolute}.dv-split-view-container.dv-separator-border .dv-view:not(:first-child):before{content:" ";position:absolute;top:0;left:0;z-index:5;pointer-events:none;background-color:var(--dv-separator-border)}.dv-dragged{transform:translateZ(0)}.dv-tab{flex-shrink:0}.dv-tab:focus-within,.dv-tab:focus{position:relative}.dv-tab:focus-within:after,.dv-tab:focus:after{position:absolute;content:"";height:100%;width:100%;top:0;left:0;pointer-events:none;outline:1px solid var(--dv-tab-divider-color)!important;outline-offset:-1px;z-index:5}.dv-tab.dv-tab-dragging .dv-default-tab-action{background-color:var(--dv-activegroup-visiblepanel-tab-color)}.dv-tab.dv-active-tab .dv-default-tab .dv-default-tab-action{visibility:visible}.dv-tab.dv-inactive-tab .dv-default-tab .dv-default-tab-action{visibility:hidden}.dv-tab.dv-inactive-tab .dv-default-tab:hover .dv-default-tab-action{visibility:visible}.dv-tab .dv-default-tab{position:relative;height:100%;display:flex;align-items:center;white-space:nowrap;text-overflow:ellipsis}.dv-tab .dv-default-tab .dv-default-tab-content{flex-grow:1;margin-right:4px}.dv-tab .dv-default-tab .dv-default-tab-action{padding:4px;display:flex;align-items:center;justify-content:center;box-sizing:border-box}.dv-tab .dv-default-tab .dv-default-tab-action:hover{border-radius:2px;background-color:var(--dv-icon-hover-background-color)}.dv-tabs-overflow-dropdown-default{height:100%;color:var(--dv-activegroup-hiddenpanel-tab-color);margin:var(--dv-tab-margin);display:flex;align-items:center;flex-shrink:0;padding:.25rem .5rem;cursor:pointer}.dv-tabs-overflow-dropdown-default>span{padding-left:.25rem}.dv-tabs-overflow-dropdown-default>svg{transform:rotate(90deg)}.dv-tabs-container{display:flex;height:100%;overflow:auto;scrollbar-width:thin;will-change:scroll-position;transform:translateZ(0)}.dv-tabs-container.dv-horizontal .dv-tab:not(:first-child):before{content:" ";position:absolute;top:0;left:0;z-index:5;pointer-events:none;background-color:var(--dv-tab-divider-color);width:1px;height:100%}.dv-tabs-container::-webkit-scrollbar{height:3px}.dv-tabs-container::-webkit-scrollbar-track{background:transparent}.dv-tabs-container::-webkit-scrollbar-thumb{background:var(--dv-tabs-container-scrollbar-color)}.dv-scrollable>.dv-tabs-container{overflow:hidden}.dv-tab{-webkit-user-drag:element;outline:none;padding:.25rem .5rem;cursor:pointer;position:relative;box-sizing:border-box;font-size:var(--dv-tab-font-size);margin:var(--dv-tab-margin)}.dv-tabs-overflow-container{flex-direction:column;height:unset;border:1px solid var(--dv-tab-divider-color);background-color:var(--dv-group-view-background-color)}.dv-tabs-overflow-container .dv-tab:not(:last-child){border-bottom:1px solid var(--dv-tab-divider-color)}.dv-tabs-overflow-container .dv-active-tab{background-color:var(--dv-activegroup-visiblepanel-tab-background-color);color:var(--dv-activegroup-visiblepanel-tab-color)}.dv-tabs-overflow-container .dv-inactive-tab{background-color:var(--dv-activegroup-hiddenpanel-tab-background-color);color:var(--dv-activegroup-hiddenpanel-tab-color)}.dv-tabs-and-actions-container{display:flex;background-color:var(--dv-tabs-and-actions-container-background-color);flex-shrink:0;box-sizing:border-box;height:var(--dv-tabs-and-actions-container-height);font-size:var(--dv-tabs-and-actions-container-font-size)}.dv-tabs-and-actions-container.dv-single-tab.dv-full-width-single-tab .dv-scrollable,.dv-tabs-and-actions-container.dv-single-tab.dv-full-width-single-tab .dv-tabs-container{flex-grow:1}.dv-tabs-and-actions-container.dv-single-tab.dv-full-width-single-tab .dv-tabs-container .dv-tab{flex-grow:1;padding:0}.dv-tabs-and-actions-container.dv-single-tab.dv-full-width-single-tab .dv-void-container{flex-grow:0}.dv-tabs-and-actions-container .dv-void-container{display:flex;flex-grow:1}.dv-tabs-and-actions-container .dv-void-container.dv-draggable{cursor:grab}.dv-tabs-and-actions-container .dv-right-actions-container{display:flex}.dv-watermark{display:flex;height:100%}.uplot,.uplot *,.uplot *:before,.uplot *:after{box-sizing:border-box}.uplot{font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";line-height:1.5;width:min-content}.u-title{text-align:center;font-size:18px;font-weight:700}.u-wrap{position:relative;-webkit-user-select:none;user-select:none}.u-over,.u-under{position:absolute}.u-under{overflow:hidden}.uplot canvas{display:block;position:relative;width:100%;height:100%}.u-axis{position:absolute}.u-legend{font-size:14px;margin:auto;text-align:center}.u-inline{display:block}.u-inline *{display:inline-block}.u-inline tr{margin-right:16px}.u-legend th{font-weight:600}.u-legend th>*{vertical-align:middle;display:inline-block}.u-legend .u-marker{width:1em;height:1em;margin-right:4px;background-clip:padding-box!important}.u-inline.u-live th:after{content:":";vertical-align:middle}.u-inline:not(.u-live) .u-value{display:none}.u-series>*{padding:4px}.u-series th{cursor:pointer}.u-legend .u-off>*{opacity:.3}.u-select{background:#00000012;position:absolute;pointer-events:none}.u-cursor-x,.u-cursor-y{position:absolute;left:0;top:0;pointer-events:none;will-change:transform}.u-hz .u-cursor-x,.u-vt .u-cursor-y{height:100%;border-right:1px dashed #607D8B}.u-hz .u-cursor-y,.u-vt .u-cursor-x{width:100%;border-bottom:1px dashed #607D8B}.u-cursor-pt{position:absolute;top:0;left:0;border-radius:50%;border:0 solid;pointer-events:none;will-change:transform;background-clip:padding-box!important}.u-axis.u-off,.u-select.u-off,.u-cursor-x.u-off,.u-cursor-y.u-off,.u-cursor-pt.u-off{display:none}:root{--bg: #0d1117;--bg-1: #11161d;--bg-2: #161b22;--bg-3: #1c232c;--border: #2a313c;--text: #c9d1d9;--muted: #8b949e;--accent: #58a6ff;--ok: #3fb950;--warn: #d29922;--err: #ff7b72;--font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;--mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace}*{box-sizing:border-box}html,body,#root{height:100%;margin:0}body{font-family:var(--font);background:var(--bg);color:var(--text);font-size:13px;-webkit-font-smoothing:antialiased}.mono{font-family:var(--mono)}.muted{color:var(--muted)}.small{font-size:11px}.center{text-align:center}.pad{padding:16px}.strong{font-weight:600}.dim{opacity:.55}.app{display:flex;flex-direction:column;height:100%}.body{flex:1;display:flex;min-height:0}.dock-host{flex:1;min-width:0;position:relative}.toolbar{display:flex;align-items:center;gap:16px;height:46px;padding:0 14px;background:linear-gradient(180deg,#11161d,#0d1117);border-bottom:1px solid var(--border)}.brand{font-weight:600;font-size:15px;letter-spacing:.2px;display:flex;align-items:center;gap:8px}.brand-sub{color:var(--muted);font-weight:500;font-size:12px}.brand-dot{width:9px;height:9px;border-radius:50%;background:var(--accent);box-shadow:0 0 10px var(--accent)}.conn{display:flex;align-items:center;gap:8px}.conn .dot{width:8px;height:8px;border-radius:50%}.dot.on{background:var(--ok);box-shadow:0 0 8px var(--ok)}.dot.off{background:var(--err)}.spacer{flex:1}.actions{display:flex;gap:6px}.badge{font-size:10.5px;padding:2px 7px;border-radius:10px;font-weight:600;border:1px solid transparent;text-transform:uppercase;letter-spacing:.3px}.badge.ok{color:var(--ok);border-color:#3fb95066;background:#3fb9501a}.badge.warn{color:var(--warn);border-color:#d2992266;background:#d299221a}.badge.err{color:var(--err);border-color:#ff7b7266;background:#ff7b721a}.btn{background:var(--bg-3);color:var(--text);border:1px solid var(--border);border-radius:6px;padding:5px 10px;font-size:12px;cursor:pointer;transition:background .15s,border-color .15s}.btn:hover{background:#232c37;border-color:#3a434f}.btn.ghost{background:transparent}.btn.small{padding:3px 8px;font-size:11px}.btn.active{border-color:var(--accent);color:var(--accent)}.sidebar{width:232px;flex-shrink:0;background:var(--bg-1);border-right:1px solid var(--border);display:flex;flex-direction:column}.sidebar-head{padding:10px 12px;border-bottom:1px solid var(--border)}.sidebar-title{font-weight:600;margin-bottom:8px}.filter,.type-select,select{width:100%;background:var(--bg-3);border:1px solid var(--border);color:var(--text);border-radius:6px;padding:5px 8px;font-size:12px}.sidebar-body{flex:1;overflow-y:auto;padding:8px}.sidebar-foot{padding:9px 12px;border-top:1px solid var(--border);font-size:11px;line-height:1.5}.motor-group{margin-bottom:12px}.motor-group-title{font-size:11px;text-transform:uppercase;letter-spacing:.5px;color:var(--muted);margin:0 2px 5px}.chips{display:flex;flex-direction:column;gap:4px}.sig-chip{display:flex;align-items:center;gap:7px;padding:5px 8px;background:var(--bg-2);border:1px solid var(--border);border-radius:6px;cursor:grab;-webkit-user-select:none;user-select:none;font-size:12px}.sig-chip:hover{background:var(--bg-3);border-color:#3a434f}.sig-chip.dragging{opacity:.4}.sig-swatch{width:10px;height:10px;border-radius:3px;border:2px solid;flex-shrink:0}.sig-name{flex:1;font-family:var(--mono)}.sig-unit{color:var(--muted);font-size:10.5px}.drag-ghost{background:var(--accent);color:#06223f;font-weight:600;font-size:12px;padding:6px 10px;border-radius:6px;font-family:var(--mono);box-shadow:0 8px 20px #00000080}.panel{height:100%;display:flex;flex-direction:column;background:var(--bg);overflow:hidden}.plot-toolbar{display:flex;align-items:center;gap:8px;padding:6px 10px;border-bottom:1px solid var(--border);flex-wrap:wrap}.legend{display:flex;gap:6px;flex-wrap:wrap}.legend-chip{display:inline-flex;align-items:center;gap:5px;font-size:11px;padding:2px 6px 2px 5px;border:1px solid var(--border);border-radius:10px;font-family:var(--mono)}.legend-swatch{width:9px;height:9px;border-radius:2px;border:1.5px solid}.legend-x{background:none;border:none;color:var(--muted);cursor:pointer;font-size:13px;padding:0 0 0 2px}.legend-x:hover{color:var(--err)}.plot-host{flex:1;min-height:0;position:relative;padding:4px}.plot-host.drop-over{outline:2px dashed var(--accent);outline-offset:-4px;background:#58a6ff0d}.drop-hint{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;color:var(--muted);font-size:12px;pointer-events:none;text-align:center;padding:20px}.uplot,.u-wrap{width:100%!important}.table-panel{overflow:auto}.motor-table{width:100%;border-collapse:collapse;font-size:12px}.motor-table th,.motor-table td{padding:5px 9px;text-align:right;border-bottom:1px solid var(--border);white-space:nowrap}.motor-table th:first-child,.motor-table td:first-child{text-align:left}.motor-table th{position:sticky;top:0;background:var(--bg-2);color:var(--muted);font-weight:600;font-size:11px;text-transform:uppercase;letter-spacing:.3px}.motor-table tr:hover td{background:var(--bg-1)}.cmd-col{color:var(--accent)}.status-pill{font-size:10px;padding:1px 6px;border-radius:8px;font-weight:600}.status-pill.ok{color:var(--ok);background:#3fb9501f}.status-pill.off{color:var(--muted);background:#8b949e1f}.status-pill.warn{color:var(--warn);background:#d299221f}.cards-panel{overflow:auto}.cards-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:10px;padding:12px}.motor-card{background:var(--bg-1);border:1px solid var(--border);border-radius:10px;padding:12px}.motor-card-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:4px}.motor-card-sub{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:10px}.type-select{width:auto;padding:2px 6px;font-size:11px}.metric{margin-bottom:8px}.metric-label{font-size:11px;color:var(--text);margin-bottom:2px}.metric-values{display:flex;align-items:baseline;gap:10px}.metric-act{font-family:var(--mono);font-size:19px;font-weight:600}.metric-cmd{font-family:var(--mono);font-size:12px;color:var(--accent)}.temp-row{display:flex;justify-content:space-between;font-size:11px;color:var(--muted);margin-top:6px;border-top:1px solid var(--border);padding-top:6px}.rawlog-panel{font-size:11.5px}.rawlog-toolbar{display:flex;align-items:center;gap:10px;padding:5px 10px;border-bottom:1px solid var(--border)}.rawlog-head,.rawlog-row{display:grid;grid-template-columns:70px 64px 50px 90px 1fr 180px;gap:8px;align-items:center}.rawlog-head{flex:1;color:var(--muted);font-size:10.5px;text-transform:uppercase;letter-spacing:.3px}.rawlog-body{flex:1;overflow:auto;padding:0 10px}.rawlog-row{position:absolute;left:10px;right:10px;height:22px;border-bottom:1px solid rgba(42,49,60,.5)}.rawlog-row .c-r{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rawlog-row.k-command .c-k{color:var(--accent)}.rawlog-row.k-feedback .c-k{color:var(--ok)}.rawlog-row.k-special .c-k{color:var(--warn)}.dockview-theme-abyss{--dv-background-color: var(--bg);--dv-paneview-active-outline-color: var(--accent);--dv-tabs-and-actions-container-background-color: var(--bg-1);--dv-activegroup-visiblepanel-tab-background-color: var(--bg);--dv-inactivegroup-visiblepanel-tab-background-color: var(--bg-1);--dv-tab-divider-color: var(--border);--dv-separator-border: var(--border);height:100%} diff --git a/damiao_motor/gui/webapp/dist/assets/index-COYw01IO.css b/damiao_motor/gui/webapp/dist/assets/index-COYw01IO.css new file mode 100644 index 0000000..59f5598 --- /dev/null +++ b/damiao_motor/gui/webapp/dist/assets/index-COYw01IO.css @@ -0,0 +1 @@ +.uplot,.uplot *,.uplot *:before,.uplot *:after{box-sizing:border-box}.uplot{font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";line-height:1.5;width:min-content}.u-title{text-align:center;font-size:18px;font-weight:700}.u-wrap{position:relative;-webkit-user-select:none;user-select:none}.u-over,.u-under{position:absolute}.u-under{overflow:hidden}.uplot canvas{display:block;position:relative;width:100%;height:100%}.u-axis{position:absolute}.u-legend{font-size:14px;margin:auto;text-align:center}.u-inline{display:block}.u-inline *{display:inline-block}.u-inline tr{margin-right:16px}.u-legend th{font-weight:600}.u-legend th>*{vertical-align:middle;display:inline-block}.u-legend .u-marker{width:1em;height:1em;margin-right:4px;background-clip:padding-box!important}.u-inline.u-live th:after{content:":";vertical-align:middle}.u-inline:not(.u-live) .u-value{display:none}.u-series>*{padding:4px}.u-series th{cursor:pointer}.u-legend .u-off>*{opacity:.3}.u-select{background:#00000012;position:absolute;pointer-events:none}.u-cursor-x,.u-cursor-y{position:absolute;left:0;top:0;pointer-events:none;will-change:transform}.u-hz .u-cursor-x,.u-vt .u-cursor-y{height:100%;border-right:1px dashed #607D8B}.u-hz .u-cursor-y,.u-vt .u-cursor-x{width:100%;border-bottom:1px dashed #607D8B}.u-cursor-pt{position:absolute;top:0;left:0;border-radius:50%;border:0 solid;pointer-events:none;will-change:transform;background-clip:padding-box!important}.u-axis.u-off,.u-select.u-off,.u-cursor-x.u-off,.u-cursor-y.u-off,.u-cursor-pt.u-off{display:none}.dv-scrollable{position:relative;overflow:hidden}.dv-scrollable .dv-scrollbar-horizontal{position:absolute;bottom:0;left:0;height:4px;border-radius:2px;background-color:transparent;will-change:background-color,transform;transform:translateZ(0);backface-visibility:hidden;transition-property:background-color;transition-timing-function:ease-in-out;transition-duration:1s;transition-delay:0s}.dv-scrollable:hover .dv-scrollbar-horizontal,.dv-scrollable.dv-scrollable-resizing .dv-scrollbar-horizontal,.dv-scrollable.dv-scrollable-scrolling .dv-scrollbar-horizontal{background-color:var(--dv-scrollbar-background-color, rgba(255, 255, 255, .25))}.dv-svg{display:inline-block;fill:currentcolor;line-height:1;stroke:currentcolor;stroke-width:0}.dockview-theme-dark{--dv-paneview-active-outline-color: dodgerblue;--dv-tabs-and-actions-container-font-size: 13px;--dv-tabs-and-actions-container-height: 35px;--dv-drag-over-background-color: rgba(83, 89, 93, .5);--dv-drag-over-border-color: transparent;--dv-tabs-container-scrollbar-color: #888;--dv-icon-hover-background-color: rgba(90, 93, 94, .31);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, .5);--dv-overlay-z-index: 999;--dv-tab-font-size: inherit;--dv-border-radius: 0px;--dv-tab-margin: 0;--dv-sash-color: transparent;--dv-active-sash-color: transparent;--dv-active-sash-transition-duration: .1s;--dv-active-sash-transition-delay: .5s;--dv-group-view-background-color: #1e1e1e;--dv-tabs-and-actions-container-background-color: #252526;--dv-activegroup-visiblepanel-tab-background-color: #1e1e1e;--dv-activegroup-hiddenpanel-tab-background-color: #2d2d2d;--dv-inactivegroup-visiblepanel-tab-background-color: #1e1e1e;--dv-inactivegroup-hiddenpanel-tab-background-color: #2d2d2d;--dv-tab-divider-color: #1e1e1e;--dv-activegroup-visiblepanel-tab-color: white;--dv-activegroup-hiddenpanel-tab-color: #969696;--dv-inactivegroup-visiblepanel-tab-color: #8f8f8f;--dv-inactivegroup-hiddenpanel-tab-color: #626262;--dv-separator-border: rgb(68, 68, 68);--dv-paneview-header-border-color: rgba(204, 204, 204, .2)}.dockview-theme-dark .dv-drop-target-container .dv-drop-target-anchor.dv-drop-target-anchor-container-changed{opacity:0;transition:none}.dockview-theme-light{--dv-paneview-active-outline-color: dodgerblue;--dv-tabs-and-actions-container-font-size: 13px;--dv-tabs-and-actions-container-height: 35px;--dv-drag-over-background-color: rgba(83, 89, 93, .5);--dv-drag-over-border-color: transparent;--dv-tabs-container-scrollbar-color: #888;--dv-icon-hover-background-color: rgba(90, 93, 94, .31);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, .5);--dv-overlay-z-index: 999;--dv-tab-font-size: inherit;--dv-border-radius: 0px;--dv-tab-margin: 0;--dv-sash-color: transparent;--dv-active-sash-color: transparent;--dv-active-sash-transition-duration: .1s;--dv-active-sash-transition-delay: .5s;--dv-group-view-background-color: white;--dv-tabs-and-actions-container-background-color: #f3f3f3;--dv-activegroup-visiblepanel-tab-background-color: white;--dv-activegroup-hiddenpanel-tab-background-color: #ececec;--dv-inactivegroup-visiblepanel-tab-background-color: white;--dv-inactivegroup-hiddenpanel-tab-background-color: #ececec;--dv-tab-divider-color: white;--dv-activegroup-visiblepanel-tab-color: rgb(51, 51, 51);--dv-activegroup-hiddenpanel-tab-color: rgba(51, 51, 51, .7);--dv-inactivegroup-visiblepanel-tab-color: rgba(51, 51, 51, .7);--dv-inactivegroup-hiddenpanel-tab-color: rgba(51, 51, 51, .35);--dv-separator-border: rgba(128, 128, 128, .35);--dv-paneview-header-border-color: rgb(51, 51, 51);--dv-scrollbar-background-color: rgba(0, 0, 0, .25)}.dockview-theme-light .dv-drop-target-container .dv-drop-target-anchor.dv-drop-target-anchor-container-changed{opacity:0;transition:none}.dockview-theme-vs{--dv-paneview-active-outline-color: dodgerblue;--dv-tabs-and-actions-container-font-size: 13px;--dv-tabs-and-actions-container-height: 35px;--dv-drag-over-background-color: rgba(83, 89, 93, .5);--dv-drag-over-border-color: transparent;--dv-tabs-container-scrollbar-color: #888;--dv-icon-hover-background-color: rgba(90, 93, 94, .31);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, .5);--dv-overlay-z-index: 999;--dv-tab-font-size: inherit;--dv-border-radius: 0px;--dv-tab-margin: 0;--dv-sash-color: transparent;--dv-active-sash-color: transparent;--dv-active-sash-transition-duration: .1s;--dv-active-sash-transition-delay: .5s;--dv-group-view-background-color: #1e1e1e;--dv-tabs-and-actions-container-background-color: #252526;--dv-activegroup-visiblepanel-tab-background-color: #1e1e1e;--dv-activegroup-hiddenpanel-tab-background-color: #2d2d2d;--dv-inactivegroup-visiblepanel-tab-background-color: #1e1e1e;--dv-inactivegroup-hiddenpanel-tab-background-color: #2d2d2d;--dv-tab-divider-color: #1e1e1e;--dv-activegroup-hiddenpanel-tab-color: #969696;--dv-inactivegroup-visiblepanel-tab-color: #8f8f8f;--dv-inactivegroup-hiddenpanel-tab-color: #626262;--dv-separator-border: rgb(68, 68, 68);--dv-paneview-header-border-color: rgba(204, 204, 204, .2);--dv-tabs-and-actions-container-background-color: #2d2d30;--dv-tabs-and-actions-container-height: 20px;--dv-tabs-and-actions-container-font-size: 11px;--dv-activegroup-visiblepanel-tab-background-color: #007acc;--dv-inactivegroup-visiblepanel-tab-background-color: #3f3f46;--dv-activegroup-visiblepanel-tab-color: white;--dv-activegroup-hiddenpanel-tab-color: white;--dv-inactivegroup-visiblepanel-tab-color: white;--dv-inactivegroup-hiddenpanel-tab-color: white}.dockview-theme-vs .dv-drop-target-container .dv-drop-target-anchor.dv-drop-target-anchor-container-changed{opacity:0;transition:none}.dockview-theme-vs .dv-groupview.dv-active-group>.dv-tabs-and-actions-container{box-sizing:content-box;border-bottom:2px solid var(--dv-activegroup-visiblepanel-tab-background-color)}.dockview-theme-vs .dv-groupview.dv-active-group>.dv-tabs-and-actions-container .dv-tab.dv-active-tab{border-top:2px solid var(--dv-activegroup-visiblepanel-tab-background-color)}.dockview-theme-vs .dv-groupview.dv-active-group>.dv-tabs-and-actions-container .dv-tab.dv-inactive-tab{border-top:2px solid var(--dv-activegroup-hiddenpanel-tab-background-color)}.dockview-theme-vs .dv-groupview.dv-inactive-group>.dv-tabs-and-actions-container{box-sizing:content-box;border-bottom:2px solid var(--dv-inactivegroup-visiblepanel-tab-background-color)}.dockview-theme-vs .dv-groupview.dv-inactive-group>.dv-tabs-and-actions-container .dv-tab.dv-active-tab{border-top:2px solid var(--dv-inactivegroup-visiblepanel-tab-background-color)}.dockview-theme-vs .dv-groupview.dv-inactive-group>.dv-tabs-and-actions-container .dv-tab.dv-inactive-tab{border-top:2px solid var(--dv-inactivegroup-hiddenpanel-tab-background-color)}.dockview-theme-abyss{--dv-paneview-active-outline-color: dodgerblue;--dv-tabs-and-actions-container-font-size: 13px;--dv-tabs-and-actions-container-height: 35px;--dv-drag-over-background-color: rgba(83, 89, 93, .5);--dv-drag-over-border-color: transparent;--dv-tabs-container-scrollbar-color: #888;--dv-icon-hover-background-color: rgba(90, 93, 94, .31);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, .5);--dv-overlay-z-index: 999;--dv-tab-font-size: inherit;--dv-border-radius: 0px;--dv-tab-margin: 0;--dv-sash-color: transparent;--dv-active-sash-color: transparent;--dv-active-sash-transition-duration: .1s;--dv-active-sash-transition-delay: .5s;--dv-color-abyss-dark: #000c18;--dv-color-abyss: #10192c;--dv-color-abyss-light: #1c1c2a;--dv-color-abyss-lighter: #2b2b4a;--dv-color-abyss-accent: rgb(91, 30, 207);--dv-color-abyss-primary-text: white;--dv-color-abyss-secondary-text: rgb(148, 151, 169);--dv-group-view-background-color: var(--dv-color-abyss-dark);--dv-tabs-and-actions-container-background-color: var( --dv-color-abyss-light );--dv-activegroup-visiblepanel-tab-background-color: var( --dv-color-abyss-dark );--dv-activegroup-hiddenpanel-tab-background-color: var(--dv-color-abyss);--dv-inactivegroup-visiblepanel-tab-background-color: var( --dv-color-abyss-dark );--dv-inactivegroup-hiddenpanel-tab-background-color: var(--dv-color-abyss);--dv-tab-divider-color: var(--dv-color-abyss-lighter);--dv-activegroup-visiblepanel-tab-color: white;--dv-activegroup-hiddenpanel-tab-color: rgba(255, 255, 255, .5);--dv-inactivegroup-visiblepanel-tab-color: rgba(255, 255, 255, .5);--dv-inactivegroup-hiddenpanel-tab-color: rgba(255, 255, 255, .25);--dv-separator-border: var(--dv-color-abyss-lighter);--dv-paneview-header-border-color: var(--dv-color-abyss-lighter);--dv-paneview-active-outline-color: #596f99}.dockview-theme-abyss .dv-drop-target-container .dv-drop-target-anchor.dv-drop-target-anchor-container-changed{opacity:0;transition:none}.dockview-theme-dracula{--dv-paneview-active-outline-color: dodgerblue;--dv-tabs-and-actions-container-font-size: 13px;--dv-tabs-and-actions-container-height: 35px;--dv-drag-over-background-color: rgba(83, 89, 93, .5);--dv-drag-over-border-color: transparent;--dv-tabs-container-scrollbar-color: #888;--dv-icon-hover-background-color: rgba(90, 93, 94, .31);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, .5);--dv-overlay-z-index: 999;--dv-tab-font-size: inherit;--dv-border-radius: 0px;--dv-tab-margin: 0;--dv-sash-color: transparent;--dv-active-sash-color: transparent;--dv-active-sash-transition-duration: .1s;--dv-active-sash-transition-delay: .5s;--dv-group-view-background-color: #282a36;--dv-tabs-and-actions-container-background-color: #191a21;--dv-activegroup-visiblepanel-tab-background-color: #282a36;--dv-activegroup-hiddenpanel-tab-background-color: #21222c;--dv-inactivegroup-visiblepanel-tab-background-color: #282a36;--dv-inactivegroup-hiddenpanel-tab-background-color: #21222c;--dv-tab-divider-color: #191a21;--dv-activegroup-visiblepanel-tab-color: rgb(248, 248, 242);--dv-activegroup-hiddenpanel-tab-color: rgb(98, 114, 164);--dv-inactivegroup-visiblepanel-tab-color: rgba(248, 248, 242, .5);--dv-inactivegroup-hiddenpanel-tab-color: rgba(98, 114, 164, .5);--dv-separator-border: #bd93f9;--dv-paneview-header-border-color: #bd93f9;--dv-paneview-active-outline-color: #6272a4}.dockview-theme-dracula .dv-drop-target-container .dv-drop-target-anchor.dv-drop-target-anchor-container-changed{opacity:0;transition:none}.dockview-theme-dracula .dv-groupview.dv-active-group>.dv-tabs-and-actions-container .dv-tabs-container>.dv-tab.dv-active-tab{position:relative}.dockview-theme-dracula .dv-groupview.dv-active-group>.dv-tabs-and-actions-container .dv-tabs-container>.dv-tab.dv-active-tab:after{position:absolute;left:0;top:0;content:"";width:100%;height:1px;background-color:#94527e;z-index:999}.dockview-theme-dracula .dv-groupview.dv-inactive-group>.dv-tabs-and-actions-container .dv-tabs-container>.dv-tab.dv-active-tab{position:relative}.dockview-theme-dracula .dv-groupview.dv-inactive-group>.dv-tabs-and-actions-container .dv-tabs-container>.dv-tab.dv-active-tab:after{position:absolute;left:0;bottom:0;content:"";width:100%;height:1px;background-color:#5e3d5a;z-index:999}.dockview-theme-replit{--dv-paneview-active-outline-color: dodgerblue;--dv-tabs-and-actions-container-font-size: 13px;--dv-tabs-and-actions-container-height: 35px;--dv-drag-over-background-color: rgba(83, 89, 93, .5);--dv-drag-over-border-color: transparent;--dv-tabs-container-scrollbar-color: #888;--dv-icon-hover-background-color: rgba(90, 93, 94, .31);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, .5);--dv-overlay-z-index: 999;--dv-tab-font-size: inherit;--dv-border-radius: 0px;--dv-tab-margin: 0;--dv-sash-color: transparent;--dv-active-sash-color: transparent;--dv-active-sash-transition-duration: .1s;--dv-active-sash-transition-delay: .5s;box-sizing:border-box;padding:10px;background-color:#ebeced;--dv-group-view-background-color: #ebeced;--dv-tabs-and-actions-container-background-color: #fcfcfc;--dv-activegroup-visiblepanel-tab-background-color: #f0f1f2;--dv-activegroup-hiddenpanel-tab-background-color: #fcfcfc;--dv-inactivegroup-visiblepanel-tab-background-color: #f0f1f2;--dv-inactivegroup-hiddenpanel-tab-background-color: #fcfcfc;--dv-tab-divider-color: transparent;--dv-activegroup-visiblepanel-tab-color: rgb(51, 51, 51);--dv-activegroup-hiddenpanel-tab-color: rgb(51, 51, 51);--dv-inactivegroup-visiblepanel-tab-color: rgb(51, 51, 51);--dv-inactivegroup-hiddenpanel-tab-color: rgb(51, 51, 51);--dv-separator-border: transparent;--dv-paneview-header-border-color: rgb(51, 51, 51);--dv-sash-color: #cfd1d3;--dv-active-sash-color: #babbbb}.dockview-theme-replit .dv-drop-target-container .dv-drop-target-anchor.dv-drop-target-anchor-container-changed{opacity:0;transition:none}.dockview-theme-replit .dv-resize-container:has(>.dv-groupview){border-radius:8px}.dockview-theme-replit .dv-resize-container{border-radius:10px!important;border:none}.dockview-theme-replit .dv-groupview{overflow:hidden;border-radius:10px}.dockview-theme-replit .dv-groupview .dv-tabs-and-actions-container{border-bottom:1px solid rgba(128,128,128,.35)}.dockview-theme-replit .dv-groupview .dv-tabs-and-actions-container .dv-tab{margin:4px;border-radius:8px}.dockview-theme-replit .dv-groupview .dv-tabs-and-actions-container .dv-tab .dv-svg{height:8px;width:8px}.dockview-theme-replit .dv-groupview .dv-tabs-and-actions-container .dv-tab:hover{background-color:#e4e5e6!important}.dockview-theme-replit .dv-groupview .dv-content-container{background-color:#fcfcfc}.dockview-theme-replit .dv-groupview.dv-active-group{border:1px solid rgba(128,128,128,.35)}.dockview-theme-replit .dv-groupview.dv-inactive-group{border:1px solid transparent}.dockview-theme-replit .dv-vertical>.dv-sash-container>.dv-sash{background-color:transparent}.dockview-theme-replit .dv-vertical>.dv-sash-container>.dv-sash:not(.disabled):after{content:"";height:4px;width:40px;border-radius:2px;top:50%;left:50%;transform:translate(-50%,-50%);background-color:var(--dv-sash-color);position:absolute}.dockview-theme-replit .dv-vertical>.dv-sash-container>.dv-sash:not(.disabled):hover,.dockview-theme-replit .dv-vertical>.dv-sash-container>.dv-sash:not(.disabled):active{background-color:transparent}.dockview-theme-replit .dv-vertical>.dv-sash-container>.dv-sash:not(.disabled):hover:after,.dockview-theme-replit .dv-vertical>.dv-sash-container>.dv-sash:not(.disabled):active:after{background-color:var(--dv-active-sash-color)}.dockview-theme-replit .dv-horizontal>.dv-sash-container>.dv-sash{background-color:transparent}.dockview-theme-replit .dv-horizontal>.dv-sash-container>.dv-sash:not(.disabled):after{content:"";height:40px;width:4px;border-radius:2px;top:50%;left:50%;transform:translate(-50%,-50%);background-color:var(--dv-sash-color);position:absolute}.dockview-theme-replit .dv-horizontal>.dv-sash-container>.dv-sash:not(.disabled):hover,.dockview-theme-replit .dv-horizontal>.dv-sash-container>.dv-sash:not(.disabled):active{background-color:transparent}.dockview-theme-replit .dv-horizontal>.dv-sash-container>.dv-sash:not(.disabled):hover:after,.dockview-theme-replit .dv-horizontal>.dv-sash-container>.dv-sash:not(.disabled):active:after{background-color:var(--dv-active-sash-color)}.dockview-theme-abyss-spaced{--dv-paneview-active-outline-color: dodgerblue;--dv-tabs-and-actions-container-font-size: 13px;--dv-tabs-and-actions-container-height: 35px;--dv-drag-over-background-color: rgba(83, 89, 93, .5);--dv-drag-over-border-color: transparent;--dv-tabs-container-scrollbar-color: #888;--dv-icon-hover-background-color: rgba(90, 93, 94, .31);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, .5);--dv-overlay-z-index: 999;--dv-tab-font-size: inherit;--dv-border-radius: 0px;--dv-tab-margin: 0;--dv-sash-color: transparent;--dv-active-sash-color: transparent;--dv-active-sash-transition-duration: .1s;--dv-active-sash-transition-delay: .5s;--dv-tab-font-size: 12px;--dv-tab-margin: .5rem .25rem;--dv-tabs-and-actions-container-height: 44px;--dv-border-radius: 20px;box-sizing:border-box;--dv-color-abyss-dark: rgb(11, 6, 17);--dv-color-abyss: #16121f;--dv-color-abyss-light: #201d2b;--dv-color-abyss-lighter: #2a2837;--dv-color-abyss-accent: rgb(91, 30, 207);--dv-color-abyss-primary-text: white;--dv-color-abyss-secondary-text: rgb(148, 151, 169);--dv-drag-over-border: 2px solid var(--dv-color-abyss-accent);--dv-drag-over-background-color: "";--dv-group-view-background-color: var(--dv-color-abyss-dark);--dv-tabs-and-actions-container-background-color: var(--dv-color-abyss);--dv-activegroup-visiblepanel-tab-background-color: var( --dv-color-abyss-lighter );--dv-activegroup-hiddenpanel-tab-background-color: var( --dv-color-abyss-light );--dv-inactivegroup-visiblepanel-tab-background-color: var( --dv-color-abyss-lighter );--dv-inactivegroup-hiddenpanel-tab-background-color: var( --dv-color-abyss-light );--dv-tab-divider-color: transparent;--dv-activegroup-visiblepanel-tab-color: var(--dv-color-abyss-primary-text);--dv-activegroup-hiddenpanel-tab-color: var( --dv-color-abyss-secondary-text );--dv-inactivegroup-visiblepanel-tab-color: var( --dv-color-abyss-primary-text );--dv-inactivegroup-hiddenpanel-tab-color: var( --dv-color-abyss-secondary-text );--dv-separator-border: transparent;--dv-paneview-header-border-color: rgb(51, 51, 51);--dv-active-sash-color: var(--dv-color-abyss-accent);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(0, 0, 0, .5);padding:10px;background-color:var(--dv-color-abyss-dark)}.dockview-theme-abyss-spaced .dv-resize-container:has(>.dv-groupview){border-radius:8px}.dockview-theme-abyss-spaced .dv-sash{border-radius:4px}.dockview-theme-abyss-spaced .dv-drop-target-anchor{border-radius:calc(var(--dv-border-radius) / 4)}.dockview-theme-abyss-spaced .dv-drop-target-anchor.dv-drop-target-content{border-radius:var(--dv-border-radius)}.dockview-theme-abyss-spaced .dv-resize-container{border-radius:var(--dv-border-radius)!important;border:none}.dockview-theme-abyss-spaced .dv-tabs-overflow-container,.dockview-theme-abyss-spaced .dv-tabs-overflow-dropdown-default{border-radius:8px;height:unset!important}.dockview-theme-abyss-spaced .dv-tab{border-radius:8px}.dockview-theme-abyss-spaced .dv-tab .dv-svg{height:8px;width:8px}.dockview-theme-abyss-spaced .dv-groupview{border-radius:var(--dv-border-radius)}.dockview-theme-abyss-spaced .dv-groupview .dv-tabs-and-actions-container{padding:0px calc(var(--dv-border-radius) / 2)}.dockview-theme-abyss-spaced .dv-groupview .dv-content-container{background-color:var(--dv-tabs-and-actions-container-background-color)}.dockview-theme-abyss-spaced .dv-resize-container .dv-groupview{border:2px solid var(--dv-color-abyss-dark)}.dockview-theme-light-spaced{--dv-paneview-active-outline-color: dodgerblue;--dv-tabs-and-actions-container-font-size: 13px;--dv-tabs-and-actions-container-height: 35px;--dv-drag-over-background-color: rgba(83, 89, 93, .5);--dv-drag-over-border-color: transparent;--dv-tabs-container-scrollbar-color: #888;--dv-icon-hover-background-color: rgba(90, 93, 94, .31);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, .5);--dv-overlay-z-index: 999;--dv-tab-font-size: inherit;--dv-border-radius: 0px;--dv-tab-margin: 0;--dv-sash-color: transparent;--dv-active-sash-color: transparent;--dv-active-sash-transition-duration: .1s;--dv-active-sash-transition-delay: .5s;--dv-tab-font-size: 12px;--dv-tab-margin: .5rem .25rem;--dv-tabs-and-actions-container-height: 44px;--dv-border-radius: 20px;box-sizing:border-box;--dv-drag-over-border: 2px solid rgb(91, 30, 207);--dv-drag-over-background-color: "";--dv-group-view-background-color: #f6f5f9;--dv-tabs-and-actions-container-background-color: white;--dv-activegroup-visiblepanel-tab-background-color: #ededf0;--dv-activegroup-hiddenpanel-tab-background-color: #f9f9fa;--dv-inactivegroup-visiblepanel-tab-background-color: #ededf0;--dv-inactivegroup-hiddenpanel-tab-background-color: #f9f9fa;--dv-tab-divider-color: transparent;--dv-activegroup-visiblepanel-tab-color: rgb(104, 107, 130);--dv-activegroup-hiddenpanel-tab-color: rgb(148, 151, 169);--dv-inactivegroup-visiblepanel-tab-color: rgb(104, 107, 130);--dv-inactivegroup-hiddenpanel-tab-color: rgb(148, 151, 169);--dv-separator-border: transparent;--dv-paneview-header-border-color: rgb(51, 51, 51);--dv-active-sash-color: rgb(91, 30, 207);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(0, 0, 0, .1);padding:10px;background-color:#f6f5f9;--dv-scrollbar-background-color: rgba(0, 0, 0, .25)}.dockview-theme-light-spaced .dv-resize-container:has(>.dv-groupview){border-radius:8px}.dockview-theme-light-spaced .dv-sash{border-radius:4px}.dockview-theme-light-spaced .dv-drop-target-anchor{border-radius:calc(var(--dv-border-radius) / 4)}.dockview-theme-light-spaced .dv-drop-target-anchor.dv-drop-target-content{border-radius:var(--dv-border-radius)}.dockview-theme-light-spaced .dv-resize-container{border-radius:var(--dv-border-radius)!important;border:none}.dockview-theme-light-spaced .dv-tabs-overflow-container,.dockview-theme-light-spaced .dv-tabs-overflow-dropdown-default{border-radius:8px;height:unset!important}.dockview-theme-light-spaced .dv-tab{border-radius:8px}.dockview-theme-light-spaced .dv-tab .dv-svg{height:8px;width:8px}.dockview-theme-light-spaced .dv-groupview{border-radius:var(--dv-border-radius)}.dockview-theme-light-spaced .dv-groupview .dv-tabs-and-actions-container{padding:0px calc(var(--dv-border-radius) / 2)}.dockview-theme-light-spaced .dv-groupview .dv-content-container{background-color:var(--dv-tabs-and-actions-container-background-color)}.dockview-theme-light-spaced .dv-resize-container .dv-groupview{border:2px solid rgba(255,255,255,.1)}.dv-drop-target-container{position:absolute;z-index:9999;top:0;left:0;height:100%;width:100%;pointer-events:none;overflow:hidden;--dv-transition-duration: .3s}.dv-drop-target-container .dv-drop-target-anchor{position:relative;border:var(--dv-drag-over-border);background-color:var(--dv-drag-over-background-color);opacity:1;will-change:transform,opacity;transform:translateZ(0);backface-visibility:hidden;contain:layout paint;transition:opacity var(--dv-transition-duration) ease-in,transform var(--dv-transition-duration) ease-out}.dv-drop-target{position:relative;--dv-transition-duration: 70ms}.dv-drop-target>.dv-drop-target-dropzone{position:absolute;left:0;top:0;height:100%;width:100%;z-index:1000;pointer-events:none}.dv-drop-target>.dv-drop-target-dropzone>.dv-drop-target-selection{position:relative;box-sizing:border-box;height:100%;width:100%;border:var(--dv-drag-over-border);background-color:var(--dv-drag-over-background-color);transition:top var(--dv-transition-duration) ease-out,left var(--dv-transition-duration) ease-out,width var(--dv-transition-duration) ease-out,height var(--dv-transition-duration) ease-out,opacity var(--dv-transition-duration) ease-out;will-change:transform;pointer-events:none}.dv-drop-target>.dv-drop-target-dropzone>.dv-drop-target-selection.dv-drop-target-top.dv-drop-target-small-vertical{border-top:1px solid var(--dv-drag-over-border-color)}.dv-drop-target>.dv-drop-target-dropzone>.dv-drop-target-selection.dv-drop-target-bottom.dv-drop-target-small-vertical{border-bottom:1px solid var(--dv-drag-over-border-color)}.dv-drop-target>.dv-drop-target-dropzone>.dv-drop-target-selection.dv-drop-target-left.dv-drop-target-small-horizontal{border-left:1px solid var(--dv-drag-over-border-color)}.dv-drop-target>.dv-drop-target-dropzone>.dv-drop-target-selection.dv-drop-target-right.dv-drop-target-small-horizontal{border-right:1px solid var(--dv-drag-over-border-color)}.dv-dockview{position:relative;background-color:var(--dv-group-view-background-color);contain:layout}.dv-dockview .dv-watermark-container{position:absolute;top:0;left:0;height:100%;width:100%;z-index:1}.dv-dockview .dv-overlay-render-container{position:relative}.dv-groupview.dv-active-group>.dv-tabs-and-actions-container .dv-tabs-container>.dv-tab.dv-active-tab{background-color:var(--dv-activegroup-visiblepanel-tab-background-color);color:var(--dv-activegroup-visiblepanel-tab-color)}.dv-groupview.dv-active-group>.dv-tabs-and-actions-container .dv-tabs-container>.dv-tab.dv-inactive-tab{background-color:var(--dv-activegroup-hiddenpanel-tab-background-color);color:var(--dv-activegroup-hiddenpanel-tab-color)}.dv-groupview.dv-inactive-group>.dv-tabs-and-actions-container .dv-tabs-container>.dv-tab.dv-active-tab{background-color:var(--dv-inactivegroup-visiblepanel-tab-background-color);color:var(--dv-inactivegroup-visiblepanel-tab-color)}.dv-groupview.dv-inactive-group>.dv-tabs-and-actions-container .dv-tabs-container>.dv-tab.dv-inactive-tab{background-color:var(--dv-inactivegroup-hiddenpanel-tab-background-color);color:var(--dv-inactivegroup-hiddenpanel-tab-color)}.dv-tab.dv-tab-dragging{background-color:var(--dv-activegroup-visiblepanel-tab-background-color);color:var(--dv-activegroup-visiblepanel-tab-color)}.dv-groupview{display:flex;flex-direction:column;height:100%;background-color:var(--dv-group-view-background-color);overflow:hidden}.dv-groupview:focus{outline:none}.dv-groupview>.dv-content-container{flex-grow:1;min-height:0;outline:none}.dv-root-wrapper,.dv-grid-view,.dv-branch-node{height:100%;width:100%}.dv-debug .dv-resize-container .dv-resize-handle-top{background-color:red}.dv-debug .dv-resize-container .dv-resize-handle-bottom{background-color:green}.dv-debug .dv-resize-container .dv-resize-handle-left{background-color:#ff0}.dv-debug .dv-resize-container .dv-resize-handle-right{background-color:#00f}.dv-debug .dv-resize-container .dv-resize-handle-topleft,.dv-debug .dv-resize-container .dv-resize-handle-topright,.dv-debug .dv-resize-container .dv-resize-handle-bottomleft,.dv-debug .dv-resize-container .dv-resize-handle-bottomright{background-color:#0ff}.dv-resize-container{--dv-overlay-z-index: var(--dv-overlay-z-index, 999);position:absolute;z-index:calc(var(--dv-overlay-z-index) - 2);border:1px solid var(--dv-tab-divider-color);box-shadow:var(--dv-floating-box-shadow);will-change:transform,opacity;transform:translateZ(0);backface-visibility:hidden}.dv-resize-container.dv-hidden{display:none}.dv-resize-container.dv-resize-container-dragging{opacity:.5;will-change:transform,opacity}.dv-resize-container .dv-resize-handle-top{height:4px;width:calc(100% - 8px);left:4px;top:-2px;z-index:var(--dv-overlay-z-index);position:absolute;cursor:ns-resize}.dv-resize-container .dv-resize-handle-bottom{height:4px;width:calc(100% - 8px);left:4px;bottom:-2px;z-index:var(--dv-overlay-z-index);position:absolute;cursor:ns-resize}.dv-resize-container .dv-resize-handle-left{height:calc(100% - 8px);width:4px;left:-2px;top:4px;z-index:var(--dv-overlay-z-index);position:absolute;cursor:ew-resize}.dv-resize-container .dv-resize-handle-right{height:calc(100% - 8px);width:4px;right:-2px;top:4px;z-index:var(--dv-overlay-z-index);position:absolute;cursor:ew-resize}.dv-resize-container .dv-resize-handle-topleft{height:4px;width:4px;top:-2px;left:-2px;z-index:var(--dv-overlay-z-index);position:absolute;cursor:nw-resize}.dv-resize-container .dv-resize-handle-topright{height:4px;width:4px;right:-2px;top:-2px;z-index:var(--dv-overlay-z-index);position:absolute;cursor:ne-resize}.dv-resize-container .dv-resize-handle-bottomleft{height:4px;width:4px;left:-2px;bottom:-2px;z-index:var(--dv-overlay-z-index);position:absolute;cursor:sw-resize}.dv-resize-container .dv-resize-handle-bottomright{height:4px;width:4px;right:-2px;bottom:-2px;z-index:var(--dv-overlay-z-index);position:absolute;cursor:se-resize}.dv-render-overlay{--dv-overlay-z-index: var(--dv-overlay-z-index, 999);position:absolute;z-index:1;width:100%;height:100%;contain:layout paint;isolation:isolate;will-change:transform;transform:translateZ(0);backface-visibility:hidden}.dv-render-overlay.dv-render-overlay-float{z-index:calc(var(--dv-overlay-z-index) - 1)}.dv-debug .dv-render-overlay{outline:1px solid red;outline-offset:-1}.dv-pane-container{height:100%;width:100%}.dv-pane-container.dv-animated .dv-view{will-change:transform;transform:translateZ(0);backface-visibility:hidden;transition:transform .15s ease-out}.dv-pane-container .dv-view{overflow:hidden;display:flex;flex-direction:column;padding:0!important}.dv-pane-container .dv-view:not(:first-child):before{background-color:transparent!important}.dv-pane-container .dv-view:not(:first-child) .dv-pane>.dv-pane-header{border-top:1px solid var(--dv-paneview-header-border-color)}.dv-pane-container .dv-view .dv-default-header{background-color:var(--dv-group-view-background-color);color:var(--dv-activegroup-visiblepanel-tab-color);display:flex;padding:0 8px;cursor:pointer}.dv-pane-container .dv-view .dv-default-header .dv-pane-header-icon{display:flex;justify-content:center;align-items:center}.dv-pane-container .dv-view .dv-default-header>span{padding-left:8px;flex-grow:1}.dv-pane-container:first-of-type>.dv-pane>.dv-pane-header{border-top:none!important}.dv-pane-container .dv-pane{display:flex;flex-direction:column;overflow:hidden;height:100%}.dv-pane-container .dv-pane .dv-pane-header{box-sizing:border-box;-webkit-user-select:none;user-select:none;position:relative;outline:none}.dv-pane-container .dv-pane .dv-pane-header.dv-pane-draggable{cursor:pointer}.dv-pane-container .dv-pane .dv-pane-header:focus:before,.dv-pane-container .dv-pane .dv-pane-header:focus-within:before{position:absolute;top:0;left:0;width:100%;height:100%;z-index:5;content:"";pointer-events:none;outline:1px solid;outline-width:-1px;outline-style:solid;outline-offset:-1px;outline-color:var(--dv-paneview-active-outline-color)}.dv-pane-container .dv-pane .dv-pane-body{overflow-y:auto;overflow-x:hidden;flex-grow:1;position:relative;outline:none}.dv-pane-container .dv-pane .dv-pane-body:focus:before,.dv-pane-container .dv-pane .dv-pane-body:focus-within:before{position:absolute;top:0;left:0;width:100%;height:100%;z-index:5;content:"";pointer-events:none;outline:1px solid;outline-width:-1px;outline-style:solid;outline-offset:-1px;outline-color:var(--dv-paneview-active-outline-color)}.dv-debug .dv-split-view-container .dv-sash-container .dv-sash.dv-enabled{background-color:#000}.dv-debug .dv-split-view-container .dv-sash-container .dv-sash.dv-disabled{background-color:orange}.dv-debug .dv-split-view-container .dv-sash-container .dv-sash.dv-maximum{background-color:green}.dv-debug .dv-split-view-container .dv-sash-container .dv-sash.dv-minimum{background-color:red}.dv-split-view-container{position:relative;overflow:hidden;height:100%;width:100%}.dv-split-view-container.dv-splitview-disabled>.dv-sash-container>.dv-sash{pointer-events:none}.dv-split-view-container.dv-animation .dv-view,.dv-split-view-container.dv-animation .dv-sash{will-change:transform;transform:translateZ(0);backface-visibility:hidden;transition:transform .15s ease-out}.dv-split-view-container.dv-horizontal{height:100%}.dv-split-view-container.dv-horizontal>.dv-sash-container>.dv-sash{height:100%;width:4px}.dv-split-view-container.dv-horizontal>.dv-sash-container>.dv-sash.dv-enabled{cursor:ew-resize}.dv-split-view-container.dv-horizontal>.dv-sash-container>.dv-sash.dv-disabled{cursor:default}.dv-split-view-container.dv-horizontal>.dv-sash-container>.dv-sash.dv-maximum{cursor:w-resize}.dv-split-view-container.dv-horizontal>.dv-sash-container>.dv-sash.dv-minimum{cursor:e-resize}.dv-split-view-container.dv-horizontal>.dv-view-container>.dv-view:not(:first-child):before{height:100%;width:1px}.dv-split-view-container.dv-vertical{width:100%}.dv-split-view-container.dv-vertical>.dv-sash-container>.dv-sash{width:100%;height:4px}.dv-split-view-container.dv-vertical>.dv-sash-container>.dv-sash.dv-enabled{cursor:ns-resize}.dv-split-view-container.dv-vertical>.dv-sash-container>.dv-sash.dv-disabled{cursor:default}.dv-split-view-container.dv-vertical>.dv-sash-container>.dv-sash.dv-maximum{cursor:n-resize}.dv-split-view-container.dv-vertical>.dv-sash-container>.dv-sash.dv-minimum{cursor:s-resize}.dv-split-view-container.dv-vertical>.dv-view-container>.dv-view{width:100%}.dv-split-view-container.dv-vertical>.dv-view-container>.dv-view:not(:first-child):before{height:1px;width:100%}.dv-split-view-container .dv-sash-container{height:100%;width:100%;position:absolute}.dv-split-view-container .dv-sash-container .dv-sash{position:absolute;z-index:99;outline:none;user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;touch-action:none;background-color:var(--dv-sash-color, transparent)}.dv-split-view-container .dv-sash-container .dv-sash:not(.disabled):active,.dv-split-view-container .dv-sash-container .dv-sash:not(.disabled):hover{background-color:var(--dv-active-sash-color, transparent);transition-property:background-color;transition-timing-function:ease-in-out;transition-duration:var(--dv-active-sash-transition-duration, .1s);transition-delay:var(--dv-active-sash-transition-delay, .5s)}.dv-split-view-container .dv-view-container{position:relative;height:100%;width:100%}.dv-split-view-container .dv-view-container .dv-view{height:100%;box-sizing:border-box;overflow:auto;position:absolute}.dv-split-view-container.dv-separator-border .dv-view:not(:first-child):before{content:" ";position:absolute;top:0;left:0;z-index:5;pointer-events:none;background-color:var(--dv-separator-border)}.dv-dragged{transform:translateZ(0)}.dv-tab{flex-shrink:0}.dv-tab:focus-within,.dv-tab:focus{position:relative}.dv-tab:focus-within:after,.dv-tab:focus:after{position:absolute;content:"";height:100%;width:100%;top:0;left:0;pointer-events:none;outline:1px solid var(--dv-tab-divider-color)!important;outline-offset:-1px;z-index:5}.dv-tab.dv-tab-dragging .dv-default-tab-action{background-color:var(--dv-activegroup-visiblepanel-tab-color)}.dv-tab.dv-active-tab .dv-default-tab .dv-default-tab-action{visibility:visible}.dv-tab.dv-inactive-tab .dv-default-tab .dv-default-tab-action{visibility:hidden}.dv-tab.dv-inactive-tab .dv-default-tab:hover .dv-default-tab-action{visibility:visible}.dv-tab .dv-default-tab{position:relative;height:100%;display:flex;align-items:center;white-space:nowrap;text-overflow:ellipsis}.dv-tab .dv-default-tab .dv-default-tab-content{flex-grow:1;margin-right:4px}.dv-tab .dv-default-tab .dv-default-tab-action{padding:4px;display:flex;align-items:center;justify-content:center;box-sizing:border-box}.dv-tab .dv-default-tab .dv-default-tab-action:hover{border-radius:2px;background-color:var(--dv-icon-hover-background-color)}.dv-tabs-overflow-dropdown-default{height:100%;color:var(--dv-activegroup-hiddenpanel-tab-color);margin:var(--dv-tab-margin);display:flex;align-items:center;flex-shrink:0;padding:.25rem .5rem;cursor:pointer}.dv-tabs-overflow-dropdown-default>span{padding-left:.25rem}.dv-tabs-overflow-dropdown-default>svg{transform:rotate(90deg)}.dv-tabs-container{display:flex;height:100%;overflow:auto;scrollbar-width:thin;will-change:scroll-position;transform:translateZ(0)}.dv-tabs-container.dv-horizontal .dv-tab:not(:first-child):before{content:" ";position:absolute;top:0;left:0;z-index:5;pointer-events:none;background-color:var(--dv-tab-divider-color);width:1px;height:100%}.dv-tabs-container::-webkit-scrollbar{height:3px}.dv-tabs-container::-webkit-scrollbar-track{background:transparent}.dv-tabs-container::-webkit-scrollbar-thumb{background:var(--dv-tabs-container-scrollbar-color)}.dv-scrollable>.dv-tabs-container{overflow:hidden}.dv-tab{-webkit-user-drag:element;outline:none;padding:.25rem .5rem;cursor:pointer;position:relative;box-sizing:border-box;font-size:var(--dv-tab-font-size);margin:var(--dv-tab-margin)}.dv-tabs-overflow-container{flex-direction:column;height:unset;border:1px solid var(--dv-tab-divider-color);background-color:var(--dv-group-view-background-color)}.dv-tabs-overflow-container .dv-tab:not(:last-child){border-bottom:1px solid var(--dv-tab-divider-color)}.dv-tabs-overflow-container .dv-active-tab{background-color:var(--dv-activegroup-visiblepanel-tab-background-color);color:var(--dv-activegroup-visiblepanel-tab-color)}.dv-tabs-overflow-container .dv-inactive-tab{background-color:var(--dv-activegroup-hiddenpanel-tab-background-color);color:var(--dv-activegroup-hiddenpanel-tab-color)}.dv-tabs-and-actions-container{display:flex;background-color:var(--dv-tabs-and-actions-container-background-color);flex-shrink:0;box-sizing:border-box;height:var(--dv-tabs-and-actions-container-height);font-size:var(--dv-tabs-and-actions-container-font-size)}.dv-tabs-and-actions-container.dv-single-tab.dv-full-width-single-tab .dv-scrollable,.dv-tabs-and-actions-container.dv-single-tab.dv-full-width-single-tab .dv-tabs-container{flex-grow:1}.dv-tabs-and-actions-container.dv-single-tab.dv-full-width-single-tab .dv-tabs-container .dv-tab{flex-grow:1;padding:0}.dv-tabs-and-actions-container.dv-single-tab.dv-full-width-single-tab .dv-void-container{flex-grow:0}.dv-tabs-and-actions-container .dv-void-container{display:flex;flex-grow:1}.dv-tabs-and-actions-container .dv-void-container.dv-draggable{cursor:grab}.dv-tabs-and-actions-container .dv-right-actions-container{display:flex}.dv-watermark{display:flex;height:100%}:root{--bg: #0d1117;--bg-1: #11161d;--bg-2: #161b22;--bg-3: #1c232c;--border: #2a313c;--text: #c9d1d9;--muted: #8b949e;--accent: #58a6ff;--ok: #3fb950;--warn: #d29922;--err: #ff7b72;--font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;--mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace}*{box-sizing:border-box}html,body,#root{height:100%;margin:0}body{font-family:var(--font);background:var(--bg);color:var(--text);font-size:13px;-webkit-font-smoothing:antialiased}.mono{font-family:var(--mono)}.muted{color:var(--muted)}.small{font-size:11px}.center{text-align:center}.pad{padding:16px}.strong{font-weight:600}.dim{opacity:.55}.app{display:flex;flex-direction:column;height:100%}.body{flex:1;display:flex;min-height:0}.dock-host{flex:1;min-width:0;position:relative}.toolbar{display:flex;align-items:center;gap:16px;height:46px;padding:0 14px;background:linear-gradient(180deg,#11161d,#0d1117);border-bottom:1px solid var(--border)}.brand{font-weight:600;font-size:15px;letter-spacing:.2px;display:flex;align-items:center;gap:8px}.brand-sub{color:var(--muted);font-weight:500;font-size:12px}.brand-dot{width:9px;height:9px;border-radius:50%;background:var(--accent);box-shadow:0 0 10px var(--accent)}.conn{display:flex;align-items:center;gap:8px}.conn .dot{width:8px;height:8px;border-radius:50%}.dot.on{background:var(--ok);box-shadow:0 0 8px var(--ok)}.dot.off{background:var(--err)}.spacer{flex:1}.actions{display:flex;gap:6px}.badge{font-size:10.5px;padding:2px 7px;border-radius:10px;font-weight:600;border:1px solid transparent;text-transform:uppercase;letter-spacing:.3px}.badge.ok{color:var(--ok);border-color:#3fb95066;background:#3fb9501a}.badge.warn{color:var(--warn);border-color:#d2992266;background:#d299221a}.badge.err{color:var(--err);border-color:#ff7b7266;background:#ff7b721a}.btn{background:var(--bg-3);color:var(--text);border:1px solid var(--border);border-radius:6px;padding:5px 10px;font-size:12px;cursor:pointer;transition:background .15s,border-color .15s}.btn:hover{background:#232c37;border-color:#3a434f}.btn.ghost{background:transparent}.btn.small{padding:3px 8px;font-size:11px}.btn.active{border-color:var(--accent);color:var(--accent)}.btn-icon{color:var(--accent);margin-right:1px;font-size:12px}.sidebar{width:232px;flex-shrink:0;background:var(--bg-1);border-right:1px solid var(--border);display:flex;flex-direction:column}.sidebar-head{padding:10px 12px;border-bottom:1px solid var(--border)}.sidebar-title{font-weight:600;margin-bottom:8px}.filter,.type-select,select{width:100%;background:var(--bg-3);border:1px solid var(--border);color:var(--text);border-radius:6px;padding:5px 8px;font-size:12px}.sidebar-body{flex:1;overflow-y:auto;padding:8px}.sidebar-foot{padding:9px 12px;border-top:1px solid var(--border);font-size:11px;line-height:1.5}.motor-group{margin-bottom:12px}.motor-group-title{font-size:11px;text-transform:uppercase;letter-spacing:.5px;color:var(--muted);margin:0 2px 5px}.chips{display:flex;flex-direction:column;gap:4px}.sig-chip{display:flex;align-items:center;gap:7px;padding:5px 8px;background:var(--bg-2);border:1px solid var(--border);border-radius:6px;cursor:grab;-webkit-user-select:none;user-select:none;font-size:12px}.sig-chip:hover{background:var(--bg-3);border-color:#3a434f}.sig-chip.dragging{opacity:.4}.sig-swatch{width:10px;height:10px;border-radius:3px;border:2px solid;flex-shrink:0}.sig-name{flex:1;font-family:var(--mono)}.sig-unit{color:var(--muted);font-size:10.5px}.drag-ghost{background:var(--accent);color:#06223f;font-weight:600;font-size:12px;padding:6px 10px;border-radius:6px;font-family:var(--mono);box-shadow:0 8px 20px #00000080}.panel{height:100%;display:flex;flex-direction:column;background:var(--bg);overflow:hidden}.plot-toolbar{display:flex;align-items:center;gap:8px;padding:6px 10px;border-bottom:1px solid var(--border);flex-wrap:wrap}.legend{display:flex;gap:6px;flex-wrap:wrap}.legend-chip{display:inline-flex;align-items:center;gap:5px;font-size:11px;padding:2px 6px 2px 5px;border:1px solid var(--border);border-radius:10px;font-family:var(--mono)}.legend-swatch{width:9px;height:9px;border-radius:2px;border:1.5px solid}.legend-x{background:none;border:none;color:var(--muted);cursor:pointer;font-size:13px;padding:0 0 0 2px}.legend-x:hover{color:var(--err)}.plot-host{flex:1;min-height:0;position:relative;padding:4px}.plot-host.drop-over{outline:2px dashed var(--accent);outline-offset:-4px;background:#58a6ff0d}.drop-hint{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;color:var(--muted);font-size:12px;pointer-events:none;text-align:center;padding:20px}.uplot,.u-wrap{width:100%!important}.table-panel{overflow:auto}.motor-table{width:100%;border-collapse:collapse;font-size:12px}.motor-table th,.motor-table td{padding:5px 9px;text-align:right;border-bottom:1px solid var(--border);white-space:nowrap}.motor-table th:first-child,.motor-table td:first-child{text-align:left}.motor-table th{position:sticky;top:0;background:var(--bg-2);color:var(--muted);font-weight:600;font-size:11px;text-transform:uppercase;letter-spacing:.3px}.motor-table tr:hover td{background:var(--bg-1)}.cmd-col{color:var(--accent)}.status-pill{font-size:10px;padding:1px 6px;border-radius:8px;font-weight:600}.status-pill.ok{color:var(--ok);background:#3fb9501f}.status-pill.off{color:var(--muted);background:#8b949e1f}.status-pill.warn{color:var(--warn);background:#d299221f}.cards-panel{overflow:auto}.cards-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:10px;padding:12px}.motor-card{background:var(--bg-1);border:1px solid var(--border);border-radius:10px;padding:12px}.motor-card-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:4px}.motor-card-sub{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:10px}.type-select{width:auto;padding:2px 6px;font-size:11px}.metric{margin-bottom:8px}.metric-label{font-size:11px;color:var(--text);margin-bottom:2px}.metric-values{display:flex;align-items:baseline;gap:10px}.metric-act{font-family:var(--mono);font-size:19px;font-weight:600}.metric-cmd{font-family:var(--mono);font-size:12px;color:var(--accent)}.temp-row{display:flex;justify-content:space-between;font-size:11px;color:var(--muted);margin-top:6px;border-top:1px solid var(--border);padding-top:6px}.rawlog-panel{font-size:11.5px}.rawlog-toolbar{display:flex;align-items:center;gap:10px;padding:5px 10px;border-bottom:1px solid var(--border)}.rawlog-body{flex:1;overflow:auto}.rawlog-head,.rawlog-row{display:grid;grid-template-columns:96px 60px 46px 76px minmax(0,1fr) 150px;gap:10px;align-items:center;padding:0 10px}.rawlog-head{position:sticky;top:0;z-index:2;height:26px;background:var(--bg-2);border-bottom:1px solid var(--border);color:var(--muted);font-size:10.5px;text-transform:uppercase;letter-spacing:.3px}.rawlog-row{position:absolute;left:0;right:0;height:22px;line-height:22px;border-bottom:1px solid rgba(42,49,60,.5)}.rawlog-head>span,.rawlog-row>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.rawlog-row .c-f{color:var(--text)}.rawlog-row.k-command .c-k{color:var(--accent)}.rawlog-row.k-feedback .c-k{color:var(--ok)}.rawlog-row.k-special .c-k{color:var(--warn)}.dockview-theme-abyss{--dv-background-color: var(--bg);--dv-paneview-active-outline-color: var(--accent);--dv-tabs-and-actions-container-background-color: var(--bg-1);--dv-activegroup-visiblepanel-tab-background-color: var(--bg);--dv-inactivegroup-visiblepanel-tab-background-color: var(--bg-1);--dv-tab-divider-color: var(--border);--dv-separator-border: var(--border);height:100%} diff --git a/damiao_motor/gui/webapp/dist/assets/index-CStVIA4_.js b/damiao_motor/gui/webapp/dist/assets/index-CStVIA4_.js deleted file mode 100644 index 21bf693..0000000 --- a/damiao_motor/gui/webapp/dist/assets/index-CStVIA4_.js +++ /dev/null @@ -1,46 +0,0 @@ -var c0=Object.defineProperty;var d0=(r,e,n)=>e in r?c0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[e]=n;var Tl=(r,e,n)=>d0(r,typeof e!="symbol"?e+"":e,n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))s(l);new MutationObserver(l=>{for(const a of l)if(a.type==="childList")for(const c of a.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function n(l){const a={};return l.integrity&&(a.integrity=l.integrity),l.referrerPolicy&&(a.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?a.credentials="include":l.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function s(l){if(l.ep)return;l.ep=!0;const a=n(l);fetch(l.href,a)}})();function zh(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Nd={exports:{}},Il={},Rd={exports:{}},Ue={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var tm;function h0(){if(tm)return Ue;tm=1;var r=Symbol.for("react.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),v=Symbol.iterator;function S(k){return k===null||typeof k!="object"?null:(k=v&&k[v]||k["@@iterator"],typeof k=="function"?k:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},A=Object.assign,D={};function P(k,F,q){this.props=k,this.context=F,this.refs=D,this.updater=q||E}P.prototype.isReactComponent={},P.prototype.setState=function(k,F){if(typeof k!="object"&&typeof k!="function"&&k!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,k,F,"setState")},P.prototype.forceUpdate=function(k){this.updater.enqueueForceUpdate(this,k,"forceUpdate")};function R(){}R.prototype=P.prototype;function O(k,F,q){this.props=k,this.context=F,this.refs=D,this.updater=q||E}var M=O.prototype=new R;M.constructor=O,A(M,P.prototype),M.isPureReactComponent=!0;var N=Array.isArray,Z=Object.prototype.hasOwnProperty,G={current:null},$={key:!0,ref:!0,__self:!0,__source:!0};function K(k,F,q){var xe,Ie={},Se=null,Ee=null;if(F!=null)for(xe in F.ref!==void 0&&(Ee=F.ref),F.key!==void 0&&(Se=""+F.key),F)Z.call(F,xe)&&!$.hasOwnProperty(xe)&&(Ie[xe]=F[xe]);var We=arguments.length-2;if(We===1)Ie.children=q;else if(1>>1,F=le[k];if(0>>1;kl(Ie,ne))Sel(Ee,Ie)?(le[k]=Ee,le[Se]=ne,k=Se):(le[k]=Ie,le[xe]=ne,k=xe);else if(Sel(Ee,ne))le[k]=Ee,le[Se]=ne,k=Se;else break e}}return fe}function l(le,fe){var ne=le.sortIndex-fe.sortIndex;return ne!==0?ne:le.id-fe.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;r.unstable_now=function(){return a.now()}}else{var c=Date,d=c.now();r.unstable_now=function(){return c.now()-d}}var h=[],m=[],w=1,v=null,S=3,E=!1,A=!1,D=!1,P=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function M(le){for(var fe=n(m);fe!==null;){if(fe.callback===null)s(m);else if(fe.startTime<=le)s(m),fe.sortIndex=fe.expirationTime,e(h,fe);else break;fe=n(m)}}function N(le){if(D=!1,M(le),!A)if(n(h)!==null)A=!0,te(Z);else{var fe=n(m);fe!==null&&X(N,fe.startTime-le)}}function Z(le,fe){A=!1,D&&(D=!1,R(K),K=-1),E=!0;var ne=S;try{for(M(fe),v=n(h);v!==null&&(!(v.expirationTime>fe)||le&&!Q());){var k=v.callback;if(typeof k=="function"){v.callback=null,S=v.priorityLevel;var F=k(v.expirationTime<=fe);fe=r.unstable_now(),typeof F=="function"?v.callback=F:v===n(h)&&s(h),M(fe)}else s(h);v=n(h)}if(v!==null)var q=!0;else{var xe=n(m);xe!==null&&X(N,xe.startTime-fe),q=!1}return q}finally{v=null,S=ne,E=!1}}var G=!1,$=null,K=-1,he=5,ue=-1;function Q(){return!(r.unstable_now()-uele||125k?(le.sortIndex=ne,e(m,le),n(h)===null&&le===n(m)&&(D?(R(K),K=-1):D=!0,X(N,ne-k))):(le.sortIndex=F,e(h,le),A||E||(A=!0,te(Z))),le},r.unstable_shouldYield=Q,r.unstable_wrapCallback=function(le){var fe=S;return function(){var ne=S;S=fe;try{return le.apply(this,arguments)}finally{S=ne}}}})(Vd)),Vd}var om;function g0(){return om||(om=1,Ld.exports=m0()),Ld.exports}/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var lm;function v0(){if(lm)return fi;lm=1;var r=kh(),e=g0();function n(t){for(var i="https://reactjs.org/docs/error-decoder.html?invariant="+t,o=1;o"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=Object.prototype.hasOwnProperty,m=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,w={},v={};function S(t){return h.call(v,t)?!0:h.call(w,t)?!1:m.test(t)?v[t]=!0:(w[t]=!0,!1)}function E(t,i,o,u){if(o!==null&&o.type===0)return!1;switch(typeof i){case"function":case"symbol":return!0;case"boolean":return u?!1:o!==null?!o.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function A(t,i,o,u){if(i===null||typeof i>"u"||E(t,i,o,u))return!0;if(u)return!1;if(o!==null)switch(o.type){case 3:return!i;case 4:return i===!1;case 5:return isNaN(i);case 6:return isNaN(i)||1>i}return!1}function D(t,i,o,u,f,p,_){this.acceptsBooleans=i===2||i===3||i===4,this.attributeName=u,this.attributeNamespace=f,this.mustUseProperty=o,this.propertyName=t,this.type=i,this.sanitizeURL=p,this.removeEmptyString=_}var P={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){P[t]=new D(t,0,!1,t,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var i=t[0];P[i]=new D(i,1,!1,t[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){P[t]=new D(t,2,!1,t.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){P[t]=new D(t,2,!1,t,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){P[t]=new D(t,3,!1,t.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(t){P[t]=new D(t,3,!0,t,null,!1,!1)}),["capture","download"].forEach(function(t){P[t]=new D(t,4,!1,t,null,!1,!1)}),["cols","rows","size","span"].forEach(function(t){P[t]=new D(t,6,!1,t,null,!1,!1)}),["rowSpan","start"].forEach(function(t){P[t]=new D(t,5,!1,t.toLowerCase(),null,!1,!1)});var R=/[\-:]([a-z])/g;function O(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var i=t.replace(R,O);P[i]=new D(i,1,!1,t,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var i=t.replace(R,O);P[i]=new D(i,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(t){var i=t.replace(R,O);P[i]=new D(i,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(t){P[t]=new D(t,1,!1,t.toLowerCase(),null,!1,!1)}),P.xlinkHref=new D("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(t){P[t]=new D(t,1,!1,t.toLowerCase(),null,!0,!0)});function M(t,i,o,u){var f=P.hasOwnProperty(i)?P[i]:null;(f!==null?f.type!==0:u||!(2b||f[_]!==p[b]){var z=` -`+f[_].replace(" at new "," at ");return t.displayName&&z.includes("")&&(z=z.replace("",t.displayName)),z}while(1<=_&&0<=b);break}}}finally{q=!1,Error.prepareStackTrace=o}return(t=t?t.displayName||t.name:"")?F(t):""}function Ie(t){switch(t.tag){case 5:return F(t.type);case 16:return F("Lazy");case 13:return F("Suspense");case 19:return F("SuspenseList");case 0:case 2:case 15:return t=xe(t.type,!1),t;case 11:return t=xe(t.type.render,!1),t;case 1:return t=xe(t.type,!0),t;default:return""}}function Se(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case $:return"Fragment";case G:return"Portal";case he:return"Profiler";case K:return"StrictMode";case ie:return"Suspense";case ce:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Q:return(t.displayName||"Context")+".Consumer";case ue:return(t._context.displayName||"Context")+".Provider";case ve:var i=t.render;return t=t.displayName,t||(t=i.displayName||i.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case j:return i=t.displayName||null,i!==null?i:Se(t.type)||"Memo";case te:i=t._payload,t=t._init;try{return Se(t(i))}catch{}}return null}function Ee(t){var i=t.type;switch(t.tag){case 24:return"Cache";case 9:return(i.displayName||"Context")+".Consumer";case 10:return(i._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=i.render,t=t.displayName||t.name||"",i.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return i;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Se(i);case 8:return i===K?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i}return null}function We(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Fe(t){var i=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function Me(t){var i=Fe(t)?"checked":"value",o=Object.getOwnPropertyDescriptor(t.constructor.prototype,i),u=""+t[i];if(!t.hasOwnProperty(i)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var f=o.get,p=o.set;return Object.defineProperty(t,i,{configurable:!0,get:function(){return f.call(this)},set:function(_){u=""+_,p.call(this,_)}}),Object.defineProperty(t,i,{enumerable:o.enumerable}),{getValue:function(){return u},setValue:function(_){u=""+_},stopTracking:function(){t._valueTracker=null,delete t[i]}}}}function Zt(t){t._valueTracker||(t._valueTracker=Me(t))}function Wt(t){if(!t)return!1;var i=t._valueTracker;if(!i)return!0;var o=i.getValue(),u="";return t&&(u=Fe(t)?t.checked?"true":"false":t.value),t=u,t!==o?(i.setValue(t),!0):!1}function Ft(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Ht(t,i){var o=i.checked;return ne({},i,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:o??t._wrapperState.initialChecked})}function ii(t,i){var o=i.defaultValue==null?"":i.defaultValue,u=i.checked!=null?i.checked:i.defaultChecked;o=We(i.value!=null?i.value:o),t._wrapperState={initialChecked:u,initialValue:o,controlled:i.type==="checkbox"||i.type==="radio"?i.checked!=null:i.value!=null}}function Tn(t,i){i=i.checked,i!=null&&M(t,"checked",i,!1)}function ki(t,i){Tn(t,i);var o=We(i.value),u=i.type;if(o!=null)u==="number"?(o===0&&t.value===""||t.value!=o)&&(t.value=""+o):t.value!==""+o&&(t.value=""+o);else if(u==="submit"||u==="reset"){t.removeAttribute("value");return}i.hasOwnProperty("value")?Un(t,i.type,o):i.hasOwnProperty("defaultValue")&&Un(t,i.type,We(i.defaultValue)),i.checked==null&&i.defaultChecked!=null&&(t.defaultChecked=!!i.defaultChecked)}function ls(t,i,o){if(i.hasOwnProperty("value")||i.hasOwnProperty("defaultValue")){var u=i.type;if(!(u!=="submit"&&u!=="reset"||i.value!==void 0&&i.value!==null))return;i=""+t._wrapperState.initialValue,o||i===t.value||(t.value=i),t.defaultValue=i}o=t.name,o!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,o!==""&&(t.name=o)}function Un(t,i,o){(i!=="number"||Ft(t.ownerDocument)!==t)&&(o==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+o&&(t.defaultValue=""+o))}var nt=Array.isArray;function cn(t,i,o,u){if(t=t.options,i){i={};for(var f=0;f"+i.valueOf().toString()+"",i=hn.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;i.firstChild;)t.appendChild(i.firstChild)}});function Xt(t,i){if(i){var o=t.firstChild;if(o&&o===t.lastChild&&o.nodeType===3){o.nodeValue=i;return}}t.textContent=i}var kt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},fn=["Webkit","ms","Moz","O"];Object.keys(kt).forEach(function(t){fn.forEach(function(i){i=i+t.charAt(0).toUpperCase()+t.substring(1),kt[i]=kt[t]})});function xn(t,i,o){return i==null||typeof i=="boolean"||i===""?"":o||typeof i!="number"||i===0||kt.hasOwnProperty(t)&&kt[t]?(""+i).trim():i+"px"}function qt(t,i){t=t.style;for(var o in i)if(i.hasOwnProperty(o)){var u=o.indexOf("--")===0,f=xn(o,i[o],u);o==="float"&&(o="cssFloat"),u?t.setProperty(o,f):t[o]=f}}var En=ne({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function as(t,i){if(i){if(En[t]&&(i.children!=null||i.dangerouslySetInnerHTML!=null))throw Error(n(137,t));if(i.dangerouslySetInnerHTML!=null){if(i.children!=null)throw Error(n(60));if(typeof i.dangerouslySetInnerHTML!="object"||!("__html"in i.dangerouslySetInnerHTML))throw Error(n(61))}if(i.style!=null&&typeof i.style!="object")throw Error(n(62))}}function us(t,i){if(t.indexOf("-")===-1)return typeof i.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var mi=null;function gi(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var cs=null,Rt=null,ut=null;function en(t){if(t=vl(t)){if(typeof cs!="function")throw Error(n(280));var i=t.stateNode;i&&(i=Oa(i),cs(t.stateNode,t.type,i))}}function pn(t){Rt?ut?ut.push(t):ut=[t]:Rt=t}function vi(){if(Rt){var t=Rt,i=ut;if(ut=Rt=null,en(t),i)for(t=0;t>>=0,t===0?32:31-(tl(t)/Rn|0)|0}var Cr=64,js=4194304;function Bs(t){switch(t&-t){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: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&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function io(t,i){var o=t.pendingLanes;if(o===0)return 0;var u=0,f=t.suspendedLanes,p=t.pingedLanes,_=o&268435455;if(_!==0){var b=_&~f;b!==0?u=Bs(b):(p&=_,p!==0&&(u=Bs(p)))}else _=o&~f,_!==0?u=Bs(_):p!==0&&(u=Bs(p));if(u===0)return 0;if(i!==0&&i!==u&&(i&f)===0&&(f=u&-u,p=i&-i,f>=p||f===16&&(p&4194240)!==0))return i;if((u&4)!==0&&(u|=o&16),i=t.entangledLanes,i!==0)for(t=t.entanglements,i&=u;0o;o++)i.push(t);return i}function Us(t,i,o){t.pendingLanes|=i,i!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,i=31-Yn(i),t[i]=o}function sl(t,i){var o=t.pendingLanes&~i;t.pendingLanes=i,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=i,t.mutableReadLanes&=i,t.entangledLanes&=i,i=t.entanglements;var u=t.eventTimes;for(t=t.expirationTimes;0=Ps),xa=" ",po=!1;function g(t,i){switch(t){case"keyup":return Tt.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function y(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var C=!1;function x(t,i){switch(t){case"compositionend":return y(i);case"keypress":return i.which!==32?null:(po=!0,xa);case"textInput":return t=i.data,t===xa&&po?null:t;default:return null}}function T(t,i){if(C)return t==="compositionend"||!fo&&g(t,i)?(t=Si(),yi=al=_i=null,C=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1=i)return{node:o,offset:i-t};t=u}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=li(o)}}function Ln(t,i){return t&&i?t===i?!0:t&&t.nodeType===3?!1:i&&i.nodeType===3?Ln(t,i.parentNode):"contains"in t?t.contains(i):t.compareDocumentPosition?!!(t.compareDocumentPosition(i)&16):!1:!1}function Zn(){for(var t=window,i=Ft();i instanceof t.HTMLIFrameElement;){try{var o=typeof i.contentWindow.location.href=="string"}catch{o=!1}if(o)t=i.contentWindow;else break;i=Ft(t.document)}return i}function Xn(t){var i=t&&t.nodeName&&t.nodeName.toLowerCase();return i&&(i==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||i==="textarea"||t.contentEditable==="true")}function Ri(t){var i=Zn(),o=t.focusedElem,u=t.selectionRange;if(i!==o&&o&&o.ownerDocument&&Ln(o.ownerDocument.documentElement,o)){if(u!==null&&Xn(o)){if(i=u.start,t=u.end,t===void 0&&(t=i),"selectionStart"in o)o.selectionStart=i,o.selectionEnd=Math.min(t,o.value.length);else if(t=(i=o.ownerDocument||document)&&i.defaultView||window,t.getSelection){t=t.getSelection();var f=o.textContent.length,p=Math.min(u.start,f);u=u.end===void 0?p:Math.min(u.end,f),!t.extend&&p>u&&(f=u,u=p,p=f),f=Ci(o,p);var _=Ci(o,u);f&&_&&(t.rangeCount!==1||t.anchorNode!==f.node||t.anchorOffset!==f.offset||t.focusNode!==_.node||t.focusOffset!==_.offset)&&(i=i.createRange(),i.setStart(f.node,f.offset),t.removeAllRanges(),p>u?(t.addRange(i),t.extend(_.node,_.offset)):(i.setEnd(_.node,_.offset),t.addRange(i)))}}for(i=[],t=o;t=t.parentNode;)t.nodeType===1&&i.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o=document.documentMode,Yt=null,Ji=null,Vt=null,mo=!1;function af(t,i,o){var u=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;mo||Yt==null||Yt!==Ft(u)||(u=Yt,"selectionStart"in u&&Xn(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),Vt&&vn(Vt,u)||(Vt=u,u=Aa(Ji,"onSelect"),0yo||(t.current=Oc[yo],Oc[yo]=null,yo--)}function mt(t,i){yo++,Oc[yo]=t.current,t.current=i}var rr={},Vn=sr(rr),ai=sr(!1),Nr=rr;function So(t,i){var o=t.type.contextTypes;if(!o)return rr;var u=t.stateNode;if(u&&u.__reactInternalMemoizedUnmaskedChildContext===i)return u.__reactInternalMemoizedMaskedChildContext;var f={},p;for(p in o)f[p]=i[p];return u&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=i,t.__reactInternalMemoizedMaskedChildContext=f),f}function ui(t){return t=t.childContextTypes,t!=null}function Ta(){vt(ai),vt(Vn)}function Cf(t,i,o){if(Vn.current!==rr)throw Error(n(168));mt(Vn,i),mt(ai,o)}function xf(t,i,o){var u=t.stateNode;if(i=i.childContextTypes,typeof u.getChildContext!="function")return o;u=u.getChildContext();for(var f in u)if(!(f in i))throw Error(n(108,Ee(t)||"Unknown",f));return ne({},o,u)}function Ia(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||rr,Nr=Vn.current,mt(Vn,t),mt(ai,ai.current),!0}function Ef(t,i,o){var u=t.stateNode;if(!u)throw Error(n(169));o?(t=xf(t,i,Nr),u.__reactInternalMemoizedMergedChildContext=t,vt(ai),vt(Vn),mt(Vn,t)):vt(ai),mt(ai,o)}var zs=null,Na=!1,Tc=!1;function bf(t){zs===null?zs=[t]:zs.push(t)}function zw(t){Na=!0,bf(t)}function or(){if(!Tc&&zs!==null){Tc=!0;var t=0,i=Ke;try{var o=zs;for(Ke=1;t>=_,f-=_,ks=1<<32-Yn(i)+f|o<Ge?(yn=Te,Te=null):yn=Te.sibling;var Xe=ee(L,Te,W[Ge],de);if(Xe===null){Te===null&&(Te=yn);break}t&&Te&&Xe.alternate===null&&i(L,Te),I=p(Xe,I,Ge),Oe===null?Ae=Xe:Oe.sibling=Xe,Oe=Xe,Te=yn}if(Ge===W.length)return o(L,Te),Ct&&Mr(L,Ge),Ae;if(Te===null){for(;GeGe?(yn=Te,Te=null):yn=Te.sibling;var mr=ee(L,Te,Xe.value,de);if(mr===null){Te===null&&(Te=yn);break}t&&Te&&mr.alternate===null&&i(L,Te),I=p(mr,I,Ge),Oe===null?Ae=mr:Oe.sibling=mr,Oe=mr,Te=yn}if(Xe.done)return o(L,Te),Ct&&Mr(L,Ge),Ae;if(Te===null){for(;!Xe.done;Ge++,Xe=W.next())Xe=oe(L,Xe.value,de),Xe!==null&&(I=p(Xe,I,Ge),Oe===null?Ae=Xe:Oe.sibling=Xe,Oe=Xe);return Ct&&Mr(L,Ge),Ae}for(Te=u(L,Te);!Xe.done;Ge++,Xe=W.next())Xe=ye(Te,L,Ge,Xe.value,de),Xe!==null&&(t&&Xe.alternate!==null&&Te.delete(Xe.key===null?Ge:Xe.key),I=p(Xe,I,Ge),Oe===null?Ae=Xe:Oe.sibling=Xe,Oe=Xe);return t&&Te.forEach(function(u0){return i(L,u0)}),Ct&&Mr(L,Ge),Ae}function Gt(L,I,W,de){if(typeof W=="object"&&W!==null&&W.type===$&&W.key===null&&(W=W.props.children),typeof W=="object"&&W!==null){switch(W.$$typeof){case Z:e:{for(var Ae=W.key,Oe=I;Oe!==null;){if(Oe.key===Ae){if(Ae=W.type,Ae===$){if(Oe.tag===7){o(L,Oe.sibling),I=f(Oe,W.props.children),I.return=L,L=I;break e}}else if(Oe.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===te&&Tf(Ae)===Oe.type){o(L,Oe.sibling),I=f(Oe,W.props),I.ref=wl(L,Oe,W),I.return=L,L=I;break e}o(L,Oe);break}else i(L,Oe);Oe=Oe.sibling}W.type===$?(I=Br(W.props.children,L.mode,de,W.key),I.return=L,L=I):(de=au(W.type,W.key,W.props,null,L.mode,de),de.ref=wl(L,I,W),de.return=L,L=de)}return _(L);case G:e:{for(Oe=W.key;I!==null;){if(I.key===Oe)if(I.tag===4&&I.stateNode.containerInfo===W.containerInfo&&I.stateNode.implementation===W.implementation){o(L,I.sibling),I=f(I,W.children||[]),I.return=L,L=I;break e}else{o(L,I);break}else i(L,I);I=I.sibling}I=zd(W,L.mode,de),I.return=L,L=I}return _(L);case te:return Oe=W._init,Gt(L,I,Oe(W._payload),de)}if(nt(W))return Ce(L,I,W,de);if(fe(W))return be(L,I,W,de);Va(L,W)}return typeof W=="string"&&W!==""||typeof W=="number"?(W=""+W,I!==null&&I.tag===6?(o(L,I.sibling),I=f(I,W),I.return=L,L=I):(o(L,I),I=Ad(W,L.mode,de),I.return=L,L=I),_(L)):o(L,I)}return Gt}var Eo=If(!0),Nf=If(!1),Ga=sr(null),Wa=null,bo=null,Vc=null;function Gc(){Vc=bo=Wa=null}function Wc(t){var i=Ga.current;vt(Ga),t._currentValue=i}function Fc(t,i,o){for(;t!==null;){var u=t.alternate;if((t.childLanes&i)!==i?(t.childLanes|=i,u!==null&&(u.childLanes|=i)):u!==null&&(u.childLanes&i)!==i&&(u.childLanes|=i),t===o)break;t=t.return}}function Po(t,i){Wa=t,Vc=bo=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&i)!==0&&(ci=!0),t.firstContext=null)}function Vi(t){var i=t._currentValue;if(Vc!==t)if(t={context:t,memoizedValue:i,next:null},bo===null){if(Wa===null)throw Error(n(308));bo=t,Wa.dependencies={lanes:0,firstContext:t}}else bo=bo.next=t;return i}var Lr=null;function Hc(t){Lr===null?Lr=[t]:Lr.push(t)}function Rf(t,i,o,u){var f=i.interleaved;return f===null?(o.next=o,Hc(i)):(o.next=f.next,f.next=o),i.interleaved=o,Ts(t,u)}function Ts(t,i){t.lanes|=i;var o=t.alternate;for(o!==null&&(o.lanes|=i),o=t,t=t.return;t!==null;)t.childLanes|=i,o=t.alternate,o!==null&&(o.childLanes|=i),o=t,t=t.return;return o.tag===3?o.stateNode:null}var lr=!1;function jc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Mf(t,i){t=t.updateQueue,i.updateQueue===t&&(i.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Is(t,i){return{eventTime:t,lane:i,tag:0,payload:null,callback:null,next:null}}function ar(t,i,o){var u=t.updateQueue;if(u===null)return null;if(u=u.shared,(Qe&2)!==0){var f=u.pending;return f===null?i.next=i:(i.next=f.next,f.next=i),u.pending=i,Ts(t,o)}return f=u.interleaved,f===null?(i.next=i,Hc(u)):(i.next=f.next,f.next=i),u.interleaved=i,Ts(t,o)}function Fa(t,i,o){if(i=i.updateQueue,i!==null&&(i=i.shared,(o&4194240)!==0)){var u=i.lanes;u&=t.pendingLanes,o|=u,i.lanes=o,$s(t,o)}}function Lf(t,i){var o=t.updateQueue,u=t.alternate;if(u!==null&&(u=u.updateQueue,o===u)){var f=null,p=null;if(o=o.firstBaseUpdate,o!==null){do{var _={eventTime:o.eventTime,lane:o.lane,tag:o.tag,payload:o.payload,callback:o.callback,next:null};p===null?f=p=_:p=p.next=_,o=o.next}while(o!==null);p===null?f=p=i:p=p.next=i}else f=p=i;o={baseState:u.baseState,firstBaseUpdate:f,lastBaseUpdate:p,shared:u.shared,effects:u.effects},t.updateQueue=o;return}t=o.lastBaseUpdate,t===null?o.firstBaseUpdate=i:t.next=i,o.lastBaseUpdate=i}function Ha(t,i,o,u){var f=t.updateQueue;lr=!1;var p=f.firstBaseUpdate,_=f.lastBaseUpdate,b=f.shared.pending;if(b!==null){f.shared.pending=null;var z=b,H=z.next;z.next=null,_===null?p=H:_.next=H,_=z;var re=t.alternate;re!==null&&(re=re.updateQueue,b=re.lastBaseUpdate,b!==_&&(b===null?re.firstBaseUpdate=H:b.next=H,re.lastBaseUpdate=z))}if(p!==null){var oe=f.baseState;_=0,re=H=z=null,b=p;do{var ee=b.lane,ye=b.eventTime;if((u&ee)===ee){re!==null&&(re=re.next={eventTime:ye,lane:0,tag:b.tag,payload:b.payload,callback:b.callback,next:null});e:{var Ce=t,be=b;switch(ee=i,ye=o,be.tag){case 1:if(Ce=be.payload,typeof Ce=="function"){oe=Ce.call(ye,oe,ee);break e}oe=Ce;break e;case 3:Ce.flags=Ce.flags&-65537|128;case 0:if(Ce=be.payload,ee=typeof Ce=="function"?Ce.call(ye,oe,ee):Ce,ee==null)break e;oe=ne({},oe,ee);break e;case 2:lr=!0}}b.callback!==null&&b.lane!==0&&(t.flags|=64,ee=f.effects,ee===null?f.effects=[b]:ee.push(b))}else ye={eventTime:ye,lane:ee,tag:b.tag,payload:b.payload,callback:b.callback,next:null},re===null?(H=re=ye,z=oe):re=re.next=ye,_|=ee;if(b=b.next,b===null){if(b=f.shared.pending,b===null)break;ee=b,b=ee.next,ee.next=null,f.lastBaseUpdate=ee,f.shared.pending=null}}while(!0);if(re===null&&(z=oe),f.baseState=z,f.firstBaseUpdate=H,f.lastBaseUpdate=re,i=f.shared.interleaved,i!==null){f=i;do _|=f.lane,f=f.next;while(f!==i)}else p===null&&(f.shared.lanes=0);Wr|=_,t.lanes=_,t.memoizedState=oe}}function Vf(t,i,o){if(t=i.effects,i.effects=null,t!==null)for(i=0;io?o:4,t(!0);var u=Kc.transition;Kc.transition={};try{t(!1),i()}finally{Ke=o,Kc.transition=u}}function ip(){return Gi().memoizedState}function Iw(t,i,o){var u=hr(t);if(o={lane:u,action:o,hasEagerState:!1,eagerState:null,next:null},sp(t))rp(i,o);else if(o=Rf(t,i,o,u),o!==null){var f=ei();es(o,t,u,f),op(o,i,u)}}function Nw(t,i,o){var u=hr(t),f={lane:u,action:o,hasEagerState:!1,eagerState:null,next:null};if(sp(t))rp(i,f);else{var p=t.alternate;if(t.lanes===0&&(p===null||p.lanes===0)&&(p=i.lastRenderedReducer,p!==null))try{var _=i.lastRenderedState,b=p(_,o);if(f.hasEagerState=!0,f.eagerState=b,dt(b,_)){var z=i.interleaved;z===null?(f.next=f,Hc(i)):(f.next=z.next,z.next=f),i.interleaved=f;return}}catch{}finally{}o=Rf(t,i,f,u),o!==null&&(f=ei(),es(o,t,u,f),op(o,i,u))}}function sp(t){var i=t.alternate;return t===At||i!==null&&i===At}function rp(t,i){Dl=Ua=!0;var o=t.pending;o===null?i.next=i:(i.next=o.next,o.next=i),t.pending=i}function op(t,i,o){if((o&4194240)!==0){var u=i.lanes;u&=t.pendingLanes,o|=u,i.lanes=o,$s(t,o)}}var Ka={readContext:Vi,useCallback:Gn,useContext:Gn,useEffect:Gn,useImperativeHandle:Gn,useInsertionEffect:Gn,useLayoutEffect:Gn,useMemo:Gn,useReducer:Gn,useRef:Gn,useState:Gn,useDebugValue:Gn,useDeferredValue:Gn,useTransition:Gn,useMutableSource:Gn,useSyncExternalStore:Gn,useId:Gn,unstable_isNewReconciler:!1},Rw={readContext:Vi,useCallback:function(t,i){return gs().memoizedState=[t,i===void 0?null:i],t},useContext:Vi,useEffect:Jf,useImperativeHandle:function(t,i,o){return o=o!=null?o.concat([t]):null,$a(4194308,4,Xf.bind(null,i,t),o)},useLayoutEffect:function(t,i){return $a(4194308,4,t,i)},useInsertionEffect:function(t,i){return $a(4,2,t,i)},useMemo:function(t,i){var o=gs();return i=i===void 0?null:i,t=t(),o.memoizedState=[t,i],t},useReducer:function(t,i,o){var u=gs();return i=o!==void 0?o(i):i,u.memoizedState=u.baseState=i,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:i},u.queue=t,t=t.dispatch=Iw.bind(null,At,t),[u.memoizedState,t]},useRef:function(t){var i=gs();return t={current:t},i.memoizedState=t},useState:Yf,useDebugValue:td,useDeferredValue:function(t){return gs().memoizedState=t},useTransition:function(){var t=Yf(!1),i=t[0];return t=Tw.bind(null,t[1]),gs().memoizedState=t,[i,t]},useMutableSource:function(){},useSyncExternalStore:function(t,i,o){var u=At,f=gs();if(Ct){if(o===void 0)throw Error(n(407));o=o()}else{if(o=i(),_n===null)throw Error(n(349));(Gr&30)!==0||Hf(u,i,o)}f.memoizedState=o;var p={value:o,getSnapshot:i};return f.queue=p,Jf(Bf.bind(null,u,p,t),[t]),u.flags|=2048,El(9,jf.bind(null,u,p,o,i),void 0,null),o},useId:function(){var t=gs(),i=_n.identifierPrefix;if(Ct){var o=Os,u=ks;o=(u&~(1<<32-Yn(u)-1)).toString(32)+o,i=":"+i+"R"+o,o=Cl++,0<\/script>",t=t.removeChild(t.firstChild)):typeof u.is=="string"?t=_.createElement(o,{is:u.is}):(t=_.createElement(o),o==="select"&&(_=t,u.multiple?_.multiple=!0:u.size&&(_.size=u.size))):t=_.createElementNS(t,o),t[ps]=i,t[gl]=u,bp(t,i,!1,!1),i.stateNode=t;e:{switch(_=us(o,u),o){case"dialog":gt("cancel",t),gt("close",t),f=u;break;case"iframe":case"object":case"embed":gt("load",t),f=u;break;case"video":case"audio":for(f=0;fTo&&(i.flags|=128,u=!0,bl(p,!1),i.lanes=4194304)}else{if(!u)if(t=ja(_),t!==null){if(i.flags|=128,u=!0,o=t.updateQueue,o!==null&&(i.updateQueue=o,i.flags|=4),bl(p,!0),p.tail===null&&p.tailMode==="hidden"&&!_.alternate&&!Ct)return Wn(i),null}else 2*ct()-p.renderingStartTime>To&&o!==1073741824&&(i.flags|=128,u=!0,bl(p,!1),i.lanes=4194304);p.isBackwards?(_.sibling=i.child,i.child=_):(o=p.last,o!==null?o.sibling=_:i.child=_,p.last=_)}return p.tail!==null?(i=p.tail,p.rendering=i,p.tail=i.sibling,p.renderingStartTime=ct(),i.sibling=null,o=Pt.current,mt(Pt,u?o&1|2:o&1),i):(Wn(i),null);case 22:case 23:return Ed(),u=i.memoizedState!==null,t!==null&&t.memoizedState!==null!==u&&(i.flags|=8192),u&&(i.mode&1)!==0?(bi&1073741824)!==0&&(Wn(i),i.subtreeFlags&6&&(i.flags|=8192)):Wn(i),null;case 24:return null;case 25:return null}throw Error(n(156,i.tag))}function jw(t,i){switch(Nc(i),i.tag){case 1:return ui(i.type)&&Ta(),t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 3:return Ao(),vt(ai),vt(Vn),Yc(),t=i.flags,(t&65536)!==0&&(t&128)===0?(i.flags=t&-65537|128,i):null;case 5:return Uc(i),null;case 13:if(vt(Pt),t=i.memoizedState,t!==null&&t.dehydrated!==null){if(i.alternate===null)throw Error(n(340));xo()}return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 19:return vt(Pt),null;case 4:return Ao(),null;case 10:return Wc(i.type._context),null;case 22:case 23:return Ed(),null;case 24:return null;default:return null}}var Xa=!1,Fn=!1,Bw=typeof WeakSet=="function"?WeakSet:Set,De=null;function ko(t,i){var o=t.ref;if(o!==null)if(typeof o=="function")try{o(null)}catch(u){It(t,i,u)}else o.current=null}function fd(t,i,o){try{o()}catch(u){It(t,i,u)}}var zp=!1;function Uw(t,i){if(Ec=ot,t=Zn(),Xn(t)){if("selectionStart"in t)var o={start:t.selectionStart,end:t.selectionEnd};else e:{o=(o=t.ownerDocument)&&o.defaultView||window;var u=o.getSelection&&o.getSelection();if(u&&u.rangeCount!==0){o=u.anchorNode;var f=u.anchorOffset,p=u.focusNode;u=u.focusOffset;try{o.nodeType,p.nodeType}catch{o=null;break e}var _=0,b=-1,z=-1,H=0,re=0,oe=t,ee=null;t:for(;;){for(var ye;oe!==o||f!==0&&oe.nodeType!==3||(b=_+f),oe!==p||u!==0&&oe.nodeType!==3||(z=_+u),oe.nodeType===3&&(_+=oe.nodeValue.length),(ye=oe.firstChild)!==null;)ee=oe,oe=ye;for(;;){if(oe===t)break t;if(ee===o&&++H===f&&(b=_),ee===p&&++re===u&&(z=_),(ye=oe.nextSibling)!==null)break;oe=ee,ee=oe.parentNode}oe=ye}o=b===-1||z===-1?null:{start:b,end:z}}else o=null}o=o||{start:0,end:0}}else o=null;for(bc={focusedElem:t,selectionRange:o},ot=!1,De=i;De!==null;)if(i=De,t=i.child,(i.subtreeFlags&1028)!==0&&t!==null)t.return=i,De=t;else for(;De!==null;){i=De;try{var Ce=i.alternate;if((i.flags&1024)!==0)switch(i.tag){case 0:case 11:case 15:break;case 1:if(Ce!==null){var be=Ce.memoizedProps,Gt=Ce.memoizedState,L=i.stateNode,I=L.getSnapshotBeforeUpdate(i.elementType===i.type?be:Zi(i.type,be),Gt);L.__reactInternalSnapshotBeforeUpdate=I}break;case 3:var W=i.stateNode.containerInfo;W.nodeType===1?W.textContent="":W.nodeType===9&&W.documentElement&&W.removeChild(W.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(de){It(i,i.return,de)}if(t=i.sibling,t!==null){t.return=i.return,De=t;break}De=i.return}return Ce=zp,zp=!1,Ce}function Pl(t,i,o){var u=i.updateQueue;if(u=u!==null?u.lastEffect:null,u!==null){var f=u=u.next;do{if((f.tag&t)===t){var p=f.destroy;f.destroy=void 0,p!==void 0&&fd(i,o,p)}f=f.next}while(f!==u)}}function qa(t,i){if(i=i.updateQueue,i=i!==null?i.lastEffect:null,i!==null){var o=i=i.next;do{if((o.tag&t)===t){var u=o.create;o.destroy=u()}o=o.next}while(o!==i)}}function pd(t){var i=t.ref;if(i!==null){var o=t.stateNode;switch(t.tag){case 5:t=o;break;default:t=o}typeof i=="function"?i(t):i.current=t}}function kp(t){var i=t.alternate;i!==null&&(t.alternate=null,kp(i)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(i=t.stateNode,i!==null&&(delete i[ps],delete i[gl],delete i[kc],delete i[Pw],delete i[Aw])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Op(t){return t.tag===5||t.tag===3||t.tag===4}function Tp(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Op(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function md(t,i,o){var u=t.tag;if(u===5||u===6)t=t.stateNode,i?o.nodeType===8?o.parentNode.insertBefore(t,i):o.insertBefore(t,i):(o.nodeType===8?(i=o.parentNode,i.insertBefore(t,o)):(i=o,i.appendChild(t)),o=o._reactRootContainer,o!=null||i.onclick!==null||(i.onclick=ka));else if(u!==4&&(t=t.child,t!==null))for(md(t,i,o),t=t.sibling;t!==null;)md(t,i,o),t=t.sibling}function gd(t,i,o){var u=t.tag;if(u===5||u===6)t=t.stateNode,i?o.insertBefore(t,i):o.appendChild(t);else if(u!==4&&(t=t.child,t!==null))for(gd(t,i,o),t=t.sibling;t!==null;)gd(t,i,o),t=t.sibling}var kn=null,Xi=!1;function ur(t,i,o){for(o=o.child;o!==null;)Ip(t,i,o),o=o.sibling}function Ip(t,i,o){if(si&&typeof si.onCommitFiberUnmount=="function")try{si.onCommitFiberUnmount(Hs,o)}catch{}switch(o.tag){case 5:Fn||ko(o,i);case 6:var u=kn,f=Xi;kn=null,ur(t,i,o),kn=u,Xi=f,kn!==null&&(Xi?(t=kn,o=o.stateNode,t.nodeType===8?t.parentNode.removeChild(o):t.removeChild(o)):kn.removeChild(o.stateNode));break;case 18:kn!==null&&(Xi?(t=kn,o=o.stateNode,t.nodeType===8?zc(t.parentNode,o):t.nodeType===1&&zc(t,o),qs(t)):zc(kn,o.stateNode));break;case 4:u=kn,f=Xi,kn=o.stateNode.containerInfo,Xi=!0,ur(t,i,o),kn=u,Xi=f;break;case 0:case 11:case 14:case 15:if(!Fn&&(u=o.updateQueue,u!==null&&(u=u.lastEffect,u!==null))){f=u=u.next;do{var p=f,_=p.destroy;p=p.tag,_!==void 0&&((p&2)!==0||(p&4)!==0)&&fd(o,i,_),f=f.next}while(f!==u)}ur(t,i,o);break;case 1:if(!Fn&&(ko(o,i),u=o.stateNode,typeof u.componentWillUnmount=="function"))try{u.props=o.memoizedProps,u.state=o.memoizedState,u.componentWillUnmount()}catch(b){It(o,i,b)}ur(t,i,o);break;case 21:ur(t,i,o);break;case 22:o.mode&1?(Fn=(u=Fn)||o.memoizedState!==null,ur(t,i,o),Fn=u):ur(t,i,o);break;default:ur(t,i,o)}}function Np(t){var i=t.updateQueue;if(i!==null){t.updateQueue=null;var o=t.stateNode;o===null&&(o=t.stateNode=new Bw),i.forEach(function(u){var f=e0.bind(null,t,u);o.has(u)||(o.add(u),u.then(f,f))})}}function qi(t,i){var o=i.deletions;if(o!==null)for(var u=0;uf&&(f=_),u&=~p}if(u=f,u=ct()-u,u=(120>u?120:480>u?480:1080>u?1080:1920>u?1920:3e3>u?3e3:4320>u?4320:1960*Yw(u/1960))-u,10t?16:t,dr===null)var u=!1;else{if(t=dr,dr=null,su=0,(Qe&6)!==0)throw Error(n(331));var f=Qe;for(Qe|=4,De=t.current;De!==null;){var p=De,_=p.child;if((De.flags&16)!==0){var b=p.deletions;if(b!==null){for(var z=0;zct()-_d?Hr(t,0):wd|=o),hi(t,i)}function Yp(t,i){i===0&&((t.mode&1)===0?i=1:(i=js,js<<=1,(js&130023424)===0&&(js=4194304)));var o=ei();t=Ts(t,i),t!==null&&(Us(t,i,o),hi(t,o))}function qw(t){var i=t.memoizedState,o=0;i!==null&&(o=i.retryLane),Yp(t,o)}function e0(t,i){var o=0;switch(t.tag){case 13:var u=t.stateNode,f=t.memoizedState;f!==null&&(o=f.retryLane);break;case 19:u=t.stateNode;break;default:throw Error(n(314))}u!==null&&u.delete(i),Yp(t,o)}var Kp;Kp=function(t,i,o){if(t!==null)if(t.memoizedProps!==i.pendingProps||ai.current)ci=!0;else{if((t.lanes&o)===0&&(i.flags&128)===0)return ci=!1,Fw(t,i,o);ci=(t.flags&131072)!==0}else ci=!1,Ct&&(i.flags&1048576)!==0&&Pf(i,Ma,i.index);switch(i.lanes=0,i.tag){case 2:var u=i.type;Za(t,i),t=i.pendingProps;var f=So(i,Vn.current);Po(i,o),f=Qc(null,i,u,t,f,o);var p=Zc();return i.flags|=1,typeof f=="object"&&f!==null&&typeof f.render=="function"&&f.$$typeof===void 0?(i.tag=1,i.memoizedState=null,i.updateQueue=null,ui(u)?(p=!0,Ia(i)):p=!1,i.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,jc(i),f.updater=Ja,i.stateNode=f,f._reactInternals=i,id(i,u,t,o),i=ld(null,i,u,!0,p,o)):(i.tag=0,Ct&&p&&Ic(i),qn(null,i,f,o),i=i.child),i;case 16:u=i.elementType;e:{switch(Za(t,i),t=i.pendingProps,f=u._init,u=f(u._payload),i.type=u,f=i.tag=n0(u),t=Zi(u,t),f){case 0:i=od(null,i,u,t,o);break e;case 1:i=yp(null,i,u,t,o);break e;case 11:i=mp(null,i,u,t,o);break e;case 14:i=gp(null,i,u,Zi(u.type,t),o);break e}throw Error(n(306,u,""))}return i;case 0:return u=i.type,f=i.pendingProps,f=i.elementType===u?f:Zi(u,f),od(t,i,u,f,o);case 1:return u=i.type,f=i.pendingProps,f=i.elementType===u?f:Zi(u,f),yp(t,i,u,f,o);case 3:e:{if(Sp(i),t===null)throw Error(n(387));u=i.pendingProps,p=i.memoizedState,f=p.element,Mf(t,i),Ha(i,u,null,o);var _=i.memoizedState;if(u=_.element,p.isDehydrated)if(p={element:u,isDehydrated:!1,cache:_.cache,pendingSuspenseBoundaries:_.pendingSuspenseBoundaries,transitions:_.transitions},i.updateQueue.baseState=p,i.memoizedState=p,i.flags&256){f=zo(Error(n(423)),i),i=Dp(t,i,u,o,f);break e}else if(u!==f){f=zo(Error(n(424)),i),i=Dp(t,i,u,o,f);break e}else for(Ei=ir(i.stateNode.containerInfo.firstChild),xi=i,Ct=!0,Qi=null,o=Nf(i,null,u,o),i.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(xo(),u===f){i=Ns(t,i,o);break e}qn(t,i,u,o)}i=i.child}return i;case 5:return Gf(i),t===null&&Mc(i),u=i.type,f=i.pendingProps,p=t!==null?t.memoizedProps:null,_=f.children,Pc(u,f)?_=null:p!==null&&Pc(u,p)&&(i.flags|=32),_p(t,i),qn(t,i,_,o),i.child;case 6:return t===null&&Mc(i),null;case 13:return Cp(t,i,o);case 4:return Bc(i,i.stateNode.containerInfo),u=i.pendingProps,t===null?i.child=Eo(i,null,u,o):qn(t,i,u,o),i.child;case 11:return u=i.type,f=i.pendingProps,f=i.elementType===u?f:Zi(u,f),mp(t,i,u,f,o);case 7:return qn(t,i,i.pendingProps,o),i.child;case 8:return qn(t,i,i.pendingProps.children,o),i.child;case 12:return qn(t,i,i.pendingProps.children,o),i.child;case 10:e:{if(u=i.type._context,f=i.pendingProps,p=i.memoizedProps,_=f.value,mt(Ga,u._currentValue),u._currentValue=_,p!==null)if(dt(p.value,_)){if(p.children===f.children&&!ai.current){i=Ns(t,i,o);break e}}else for(p=i.child,p!==null&&(p.return=i);p!==null;){var b=p.dependencies;if(b!==null){_=p.child;for(var z=b.firstContext;z!==null;){if(z.context===u){if(p.tag===1){z=Is(-1,o&-o),z.tag=2;var H=p.updateQueue;if(H!==null){H=H.shared;var re=H.pending;re===null?z.next=z:(z.next=re.next,re.next=z),H.pending=z}}p.lanes|=o,z=p.alternate,z!==null&&(z.lanes|=o),Fc(p.return,o,i),b.lanes|=o;break}z=z.next}}else if(p.tag===10)_=p.type===i.type?null:p.child;else if(p.tag===18){if(_=p.return,_===null)throw Error(n(341));_.lanes|=o,b=_.alternate,b!==null&&(b.lanes|=o),Fc(_,o,i),_=p.sibling}else _=p.child;if(_!==null)_.return=p;else for(_=p;_!==null;){if(_===i){_=null;break}if(p=_.sibling,p!==null){p.return=_.return,_=p;break}_=_.return}p=_}qn(t,i,f.children,o),i=i.child}return i;case 9:return f=i.type,u=i.pendingProps.children,Po(i,o),f=Vi(f),u=u(f),i.flags|=1,qn(t,i,u,o),i.child;case 14:return u=i.type,f=Zi(u,i.pendingProps),f=Zi(u.type,f),gp(t,i,u,f,o);case 15:return vp(t,i,i.type,i.pendingProps,o);case 17:return u=i.type,f=i.pendingProps,f=i.elementType===u?f:Zi(u,f),Za(t,i),i.tag=1,ui(u)?(t=!0,Ia(i)):t=!1,Po(i,o),ap(i,u,f),id(i,u,f,o),ld(null,i,u,!0,t,o);case 19:return Ep(t,i,o);case 22:return wp(t,i,o)}throw Error(n(156,i.tag))};function Jp(t,i){return Mt(t,i)}function t0(t,i,o,u){this.tag=t,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Fi(t,i,o,u){return new t0(t,i,o,u)}function Pd(t){return t=t.prototype,!(!t||!t.isReactComponent)}function n0(t){if(typeof t=="function")return Pd(t)?1:0;if(t!=null){if(t=t.$$typeof,t===ve)return 11;if(t===j)return 14}return 2}function pr(t,i){var o=t.alternate;return o===null?(o=Fi(t.tag,i,t.key,t.mode),o.elementType=t.elementType,o.type=t.type,o.stateNode=t.stateNode,o.alternate=t,t.alternate=o):(o.pendingProps=i,o.type=t.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=t.flags&14680064,o.childLanes=t.childLanes,o.lanes=t.lanes,o.child=t.child,o.memoizedProps=t.memoizedProps,o.memoizedState=t.memoizedState,o.updateQueue=t.updateQueue,i=t.dependencies,o.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},o.sibling=t.sibling,o.index=t.index,o.ref=t.ref,o}function au(t,i,o,u,f,p){var _=2;if(u=t,typeof t=="function")Pd(t)&&(_=1);else if(typeof t=="string")_=5;else e:switch(t){case $:return Br(o.children,f,p,i);case K:_=8,f|=8;break;case he:return t=Fi(12,o,i,f|2),t.elementType=he,t.lanes=p,t;case ie:return t=Fi(13,o,i,f),t.elementType=ie,t.lanes=p,t;case ce:return t=Fi(19,o,i,f),t.elementType=ce,t.lanes=p,t;case X:return uu(o,f,p,i);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case ue:_=10;break e;case Q:_=9;break e;case ve:_=11;break e;case j:_=14;break e;case te:_=16,u=null;break e}throw Error(n(130,t==null?t:typeof t,""))}return i=Fi(_,o,i,f),i.elementType=t,i.type=u,i.lanes=p,i}function Br(t,i,o,u){return t=Fi(7,t,u,i),t.lanes=o,t}function uu(t,i,o,u){return t=Fi(22,t,u,i),t.elementType=X,t.lanes=o,t.stateNode={isHidden:!1},t}function Ad(t,i,o){return t=Fi(6,t,null,i),t.lanes=o,t}function zd(t,i,o){return i=Fi(4,t.children!==null?t.children:[],t.key,i),i.lanes=o,i.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},i}function i0(t,i,o,u,f){this.tag=i,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=il(0),this.expirationTimes=il(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=il(0),this.identifierPrefix=u,this.onRecoverableError=f,this.mutableSourceEagerHydrationData=null}function kd(t,i,o,u,f,p,_,b,z){return t=new i0(t,i,o,b,z),i===1?(i=1,p===!0&&(i|=8)):i=0,p=Fi(3,null,null,i),t.current=p,p.stateNode=t,p.memoizedState={element:u,isDehydrated:o,cache:null,transitions:null,pendingSuspenseBoundaries:null},jc(p),t}function s0(t,i,o){var u=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(e){console.error(e)}}return r(),Md.exports=v0(),Md.exports}var um;function w0(){if(um)return gu;um=1;var r=Gg();return gu.createRoot=r.createRoot,gu.hydrateRoot=r.hydrateRoot,gu}var _0=w0();const y0=zh(_0);var Kr=Gg();const S0=zh(Kr),Ju=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ko(r){const e=Object.prototype.toString.call(r);return e==="[object Window]"||e==="[object global]"}function Oh(r){return"nodeType"in r}function ni(r){var e,n;return r?Ko(r)?r:Oh(r)&&(e=(n=r.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function Th(r){const{Document:e}=ni(r);return r instanceof e}function ta(r){return Ko(r)?!1:r instanceof ni(r).HTMLElement}function Wg(r){return r instanceof ni(r).SVGElement}function Jo(r){return r?Ko(r)?r.document:Oh(r)?Th(r)?r:ta(r)||Wg(r)?r.ownerDocument:document:document:document}const Gs=Ju?B.useLayoutEffect:B.useEffect;function Qu(r){const e=B.useRef(r);return Gs(()=>{e.current=r}),B.useCallback(function(){for(var n=arguments.length,s=new Array(n),l=0;l{r.current=setInterval(s,l)},[]),n=B.useCallback(()=>{r.current!==null&&(clearInterval(r.current),r.current=null)},[]);return[e,n]}function Kl(r,e){e===void 0&&(e=[r]);const n=B.useRef(r);return Gs(()=>{n.current!==r&&(n.current=r)},e),n}function na(r,e){const n=B.useRef();return B.useMemo(()=>{const s=r(n.current);return n.current=s,s},[...e])}function Ru(r){const e=Qu(r),n=B.useRef(null),s=B.useCallback(l=>{l!==n.current&&(e==null||e(l,n.current)),n.current=l},[]);return[n,s]}function Mu(r){const e=B.useRef();return B.useEffect(()=>{e.current=r},[r]),e.current}let Gd={};function Zu(r,e){return B.useMemo(()=>{if(e)return e;const n=Gd[r]==null?0:Gd[r]+1;return Gd[r]=n,r+"-"+n},[r,e])}function Fg(r){return function(e){for(var n=arguments.length,s=new Array(n>1?n-1:0),l=1;l{const d=Object.entries(c);for(const[h,m]of d){const w=a[h];w!=null&&(a[h]=w+r*m)}return a},{...e})}}const Wo=Fg(1),Lu=Fg(-1);function C0(r){return"clientX"in r&&"clientY"in r}function Ih(r){if(!r)return!1;const{KeyboardEvent:e}=ni(r.target);return e&&r instanceof e}function x0(r){if(!r)return!1;const{TouchEvent:e}=ni(r.target);return e&&r instanceof e}function Vu(r){if(x0(r)){if(r.touches&&r.touches.length){const{clientX:e,clientY:n}=r.touches[0];return{x:e,y:n}}else if(r.changedTouches&&r.changedTouches.length){const{clientX:e,clientY:n}=r.changedTouches[0];return{x:e,y:n}}}return C0(r)?{x:r.clientX,y:r.clientY}:null}const Jl=Object.freeze({Translate:{toString(r){if(!r)return;const{x:e,y:n}=r;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(r){if(!r)return;const{scaleX:e,scaleY:n}=r;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(r){if(r)return[Jl.Translate.toString(r),Jl.Scale.toString(r)].join(" ")}},Transition:{toString(r){let{property:e,duration:n,easing:s}=r;return e+" "+n+"ms "+s}}}),cm="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function E0(r){return r.matches(cm)?r:r.querySelector(cm)}const b0={display:"none"};function P0(r){let{id:e,value:n}=r;return pe.createElement("div",{id:e,style:b0},n)}function A0(r){let{id:e,announcement:n,ariaLiveType:s="assertive"}=r;const l={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return pe.createElement("div",{id:e,style:l,role:"status","aria-live":s,"aria-atomic":!0},n)}function z0(){const[r,e]=B.useState("");return{announce:B.useCallback(s=>{s!=null&&e(s)},[]),announcement:r}}const Hg=B.createContext(null);function k0(r){const e=B.useContext(Hg);B.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of ");return e(r)},[r,e])}function O0(){const[r]=B.useState(()=>new Set),e=B.useCallback(s=>(r.add(s),()=>r.delete(s)),[r]);return[B.useCallback(s=>{let{type:l,event:a}=s;r.forEach(c=>{var d;return(d=c[l])==null?void 0:d.call(c,a)})},[r]),e]}const T0={draggable:` - To pick up a draggable item, press the space bar. - While dragging, use the arrow keys to move the item. - Press space again to drop the item in its new position, or press escape to cancel. - `},I0={onDragStart(r){let{active:e}=r;return"Picked up draggable item "+e.id+"."},onDragOver(r){let{active:e,over:n}=r;return n?"Draggable item "+e.id+" was moved over droppable area "+n.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(r){let{active:e,over:n}=r;return n?"Draggable item "+e.id+" was dropped over droppable area "+n.id:"Draggable item "+e.id+" was dropped."},onDragCancel(r){let{active:e}=r;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function N0(r){let{announcements:e=I0,container:n,hiddenTextDescribedById:s,screenReaderInstructions:l=T0}=r;const{announce:a,announcement:c}=z0(),d=Zu("DndLiveRegion"),[h,m]=B.useState(!1);if(B.useEffect(()=>{m(!0)},[]),k0(B.useMemo(()=>({onDragStart(v){let{active:S}=v;a(e.onDragStart({active:S}))},onDragMove(v){let{active:S,over:E}=v;e.onDragMove&&a(e.onDragMove({active:S,over:E}))},onDragOver(v){let{active:S,over:E}=v;a(e.onDragOver({active:S,over:E}))},onDragEnd(v){let{active:S,over:E}=v;a(e.onDragEnd({active:S,over:E}))},onDragCancel(v){let{active:S,over:E}=v;a(e.onDragCancel({active:S,over:E}))}}),[a,e])),!h)return null;const w=pe.createElement(pe.Fragment,null,pe.createElement(P0,{id:s,value:l.draggable}),pe.createElement(A0,{id:d,announcement:c}));return n?Kr.createPortal(w,n):w}var an;(function(r){r.DragStart="dragStart",r.DragMove="dragMove",r.DragEnd="dragEnd",r.DragCancel="dragCancel",r.DragOver="dragOver",r.RegisterDroppable="registerDroppable",r.SetDroppableDisabled="setDroppableDisabled",r.UnregisterDroppable="unregisterDroppable"})(an||(an={}));function Gu(){}function R0(r,e){return B.useMemo(()=>({sensor:r,options:e??{}}),[r,e])}function M0(){for(var r=arguments.length,e=new Array(r),n=0;n[...e].filter(s=>s!=null),[...e])}const os=Object.freeze({x:0,y:0});function L0(r,e){const n=Vu(r);if(!n)return"0 0";const s={x:(n.x-e.left)/e.width*100,y:(n.y-e.top)/e.height*100};return s.x+"% "+s.y+"%"}function V0(r,e){let{data:{value:n}}=r,{data:{value:s}}=e;return s-n}function G0(r,e){if(!r||r.length===0)return null;const[n]=r;return n[e]}function W0(r,e){const n=Math.max(e.top,r.top),s=Math.max(e.left,r.left),l=Math.min(e.left+e.width,r.left+r.width),a=Math.min(e.top+e.height,r.top+r.height),c=l-s,d=a-n;if(s{let{collisionRect:e,droppableRects:n,droppableContainers:s}=r;const l=[];for(const a of s){const{id:c}=a,d=n.get(c);if(d){const h=W0(d,e);h>0&&l.push({id:c,data:{droppableContainer:a,value:h}})}}return l.sort(V0)};function H0(r,e,n){return{...r,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function jg(r,e){return r&&e?{x:r.left-e.left,y:r.top-e.top}:os}function j0(r){return function(n){for(var s=arguments.length,l=new Array(s>1?s-1:0),a=1;a({...c,top:c.top+r*d.y,bottom:c.bottom+r*d.y,left:c.left+r*d.x,right:c.right+r*d.x}),{...n})}}const B0=j0(1);function Bg(r){if(r.startsWith("matrix3d(")){const e=r.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(r.startsWith("matrix(")){const e=r.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function U0(r,e,n){const s=Bg(e);if(!s)return r;const{scaleX:l,scaleY:a,x:c,y:d}=s,h=r.left-c-(1-l)*parseFloat(n),m=r.top-d-(1-a)*parseFloat(n.slice(n.indexOf(" ")+1)),w=l?r.width/l:r.width,v=a?r.height/a:r.height;return{width:w,height:v,top:m,right:h+w,bottom:m+v,left:h}}const $0={ignoreTransform:!1};function ia(r,e){e===void 0&&(e=$0);let n=r.getBoundingClientRect();if(e.ignoreTransform){const{transform:m,transformOrigin:w}=ni(r).getComputedStyle(r);m&&(n=U0(n,m,w))}const{top:s,left:l,width:a,height:c,bottom:d,right:h}=n;return{top:s,left:l,width:a,height:c,bottom:d,right:h}}function dm(r){return ia(r,{ignoreTransform:!0})}function Y0(r){const e=r.innerWidth,n=r.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function K0(r,e){return e===void 0&&(e=ni(r).getComputedStyle(r)),e.position==="fixed"}function J0(r,e){e===void 0&&(e=ni(r).getComputedStyle(r));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(l=>{const a=e[l];return typeof a=="string"?n.test(a):!1})}function Nh(r,e){const n=[];function s(l){if(e!=null&&n.length>=e||!l)return n;if(Th(l)&&l.scrollingElement!=null&&!n.includes(l.scrollingElement))return n.push(l.scrollingElement),n;if(!ta(l)||Wg(l)||n.includes(l))return n;const a=ni(r).getComputedStyle(l);return l!==r&&J0(l,a)&&n.push(l),K0(l,a)?n:s(l.parentNode)}return r?s(r):n}function Ug(r){const[e]=Nh(r,1);return e??null}function Wd(r){return!Ju||!r?null:Ko(r)?r:Oh(r)?Th(r)||r===Jo(r).scrollingElement?window:ta(r)?r:null:null}function $g(r){return Ko(r)?r.scrollX:r.scrollLeft}function Yg(r){return Ko(r)?r.scrollY:r.scrollTop}function sh(r){return{x:$g(r),y:Yg(r)}}var Dn;(function(r){r[r.Forward=1]="Forward",r[r.Backward=-1]="Backward"})(Dn||(Dn={}));function Kg(r){return!Ju||!r?!1:r===document.scrollingElement}function Jg(r){const e={x:0,y:0},n=Kg(r)?{height:window.innerHeight,width:window.innerWidth}:{height:r.clientHeight,width:r.clientWidth},s={x:r.scrollWidth-n.width,y:r.scrollHeight-n.height},l=r.scrollTop<=e.y,a=r.scrollLeft<=e.x,c=r.scrollTop>=s.y,d=r.scrollLeft>=s.x;return{isTop:l,isLeft:a,isBottom:c,isRight:d,maxScroll:s,minScroll:e}}const Q0={x:.2,y:.2};function Z0(r,e,n,s,l){let{top:a,left:c,right:d,bottom:h}=n;s===void 0&&(s=10),l===void 0&&(l=Q0);const{isTop:m,isBottom:w,isLeft:v,isRight:S}=Jg(r),E={x:0,y:0},A={x:0,y:0},D={height:e.height*l.y,width:e.width*l.x};return!m&&a<=e.top+D.height?(E.y=Dn.Backward,A.y=s*Math.abs((e.top+D.height-a)/D.height)):!w&&h>=e.bottom-D.height&&(E.y=Dn.Forward,A.y=s*Math.abs((e.bottom-D.height-h)/D.height)),!S&&d>=e.right-D.width?(E.x=Dn.Forward,A.x=s*Math.abs((e.right-D.width-d)/D.width)):!v&&c<=e.left+D.width&&(E.x=Dn.Backward,A.x=s*Math.abs((e.left+D.width-c)/D.width)),{direction:E,speed:A}}function X0(r){if(r===document.scrollingElement){const{innerWidth:a,innerHeight:c}=window;return{top:0,left:0,right:a,bottom:c,width:a,height:c}}const{top:e,left:n,right:s,bottom:l}=r.getBoundingClientRect();return{top:e,left:n,right:s,bottom:l,width:r.clientWidth,height:r.clientHeight}}function Qg(r){return r.reduce((e,n)=>Wo(e,sh(n)),os)}function q0(r){return r.reduce((e,n)=>e+$g(n),0)}function e_(r){return r.reduce((e,n)=>e+Yg(n),0)}function Zg(r,e){if(e===void 0&&(e=ia),!r)return;const{top:n,left:s,bottom:l,right:a}=e(r);Ug(r)&&(l<=0||a<=0||n>=window.innerHeight||s>=window.innerWidth)&&r.scrollIntoView({block:"center",inline:"center"})}const t_=[["x",["left","right"],q0],["y",["top","bottom"],e_]];class Rh{constructor(e,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const s=Nh(n),l=Qg(s);this.rect={...e},this.width=e.width,this.height=e.height;for(const[a,c,d]of t_)for(const h of c)Object.defineProperty(this,h,{get:()=>{const m=d(s),w=l[a]-m;return this.rect[h]+w},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Hl{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var s;return(s=this.target)==null?void 0:s.removeEventListener(...n)})},this.target=e}add(e,n,s){var l;(l=this.target)==null||l.addEventListener(e,n,s),this.listeners.push([e,n,s])}}function n_(r){const{EventTarget:e}=ni(r);return r instanceof e?r:Jo(r)}function Fd(r,e){const n=Math.abs(r.x),s=Math.abs(r.y);return typeof e=="number"?Math.sqrt(n**2+s**2)>e:"x"in e&&"y"in e?n>e.x&&s>e.y:"x"in e?n>e.x:"y"in e?s>e.y:!1}var Bi;(function(r){r.Click="click",r.DragStart="dragstart",r.Keydown="keydown",r.ContextMenu="contextmenu",r.Resize="resize",r.SelectionChange="selectionchange",r.VisibilityChange="visibilitychange"})(Bi||(Bi={}));function hm(r){r.preventDefault()}function i_(r){r.stopPropagation()}var ht;(function(r){r.Space="Space",r.Down="ArrowDown",r.Right="ArrowRight",r.Left="ArrowLeft",r.Up="ArrowUp",r.Esc="Escape",r.Enter="Enter",r.Tab="Tab"})(ht||(ht={}));const Xg={start:[ht.Space,ht.Enter],cancel:[ht.Esc],end:[ht.Space,ht.Enter,ht.Tab]},s_=(r,e)=>{let{currentCoordinates:n}=e;switch(r.code){case ht.Right:return{...n,x:n.x+25};case ht.Left:return{...n,x:n.x-25};case ht.Down:return{...n,y:n.y+25};case ht.Up:return{...n,y:n.y-25}}};class qg{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new Hl(Jo(n)),this.windowListeners=new Hl(ni(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Bi.Resize,this.handleCancel),this.windowListeners.add(Bi.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Bi.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,s=e.node.current;s&&Zg(s),n(os)}handleKeyDown(e){if(Ih(e)){const{active:n,context:s,options:l}=this.props,{keyboardCodes:a=Xg,coordinateGetter:c=s_,scrollBehavior:d="smooth"}=l,{code:h}=e;if(a.end.includes(h)){this.handleEnd(e);return}if(a.cancel.includes(h)){this.handleCancel(e);return}const{collisionRect:m}=s.current,w=m?{x:m.left,y:m.top}:os;this.referenceCoordinates||(this.referenceCoordinates=w);const v=c(e,{active:n,context:s.current,currentCoordinates:w});if(v){const S=Lu(v,w),E={x:0,y:0},{scrollableAncestors:A}=s.current;for(const D of A){const P=e.code,{isTop:R,isRight:O,isLeft:M,isBottom:N,maxScroll:Z,minScroll:G}=Jg(D),$=X0(D),K={x:Math.min(P===ht.Right?$.right-$.width/2:$.right,Math.max(P===ht.Right?$.left:$.left+$.width/2,v.x)),y:Math.min(P===ht.Down?$.bottom-$.height/2:$.bottom,Math.max(P===ht.Down?$.top:$.top+$.height/2,v.y))},he=P===ht.Right&&!O||P===ht.Left&&!M,ue=P===ht.Down&&!N||P===ht.Up&&!R;if(he&&K.x!==v.x){const Q=D.scrollLeft+S.x,ve=P===ht.Right&&Q<=Z.x||P===ht.Left&&Q>=G.x;if(ve&&!S.y){D.scrollTo({left:Q,behavior:d});return}ve?E.x=D.scrollLeft-Q:E.x=P===ht.Right?D.scrollLeft-Z.x:D.scrollLeft-G.x,E.x&&D.scrollBy({left:-E.x,behavior:d});break}else if(ue&&K.y!==v.y){const Q=D.scrollTop+S.y,ve=P===ht.Down&&Q<=Z.y||P===ht.Up&&Q>=G.y;if(ve&&!S.x){D.scrollTo({top:Q,behavior:d});return}ve?E.y=D.scrollTop-Q:E.y=P===ht.Down?D.scrollTop-Z.y:D.scrollTop-G.y,E.y&&D.scrollBy({top:-E.y,behavior:d});break}}this.handleMove(e,Wo(Lu(v,this.referenceCoordinates),E))}}}handleMove(e,n){const{onMove:s}=this.props;e.preventDefault(),s(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}qg.activators=[{eventName:"onKeyDown",handler:(r,e,n)=>{let{keyboardCodes:s=Xg,onActivation:l}=e,{active:a}=n;const{code:c}=r.nativeEvent;if(s.start.includes(c)){const d=a.activatorNode.current;return d&&r.target!==d?!1:(r.preventDefault(),l==null||l({event:r.nativeEvent}),!0)}return!1}}];function fm(r){return!!(r&&"distance"in r)}function pm(r){return!!(r&&"delay"in r)}class Mh{constructor(e,n,s){var l;s===void 0&&(s=n_(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;const{event:a}=e,{target:c}=a;this.props=e,this.events=n,this.document=Jo(c),this.documentListeners=new Hl(this.document),this.listeners=new Hl(s),this.windowListeners=new Hl(ni(c)),this.initialCoordinates=(l=Vu(a))!=null?l:os,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:n,bypassActivationConstraint:s}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Bi.Resize,this.handleCancel),this.windowListeners.add(Bi.DragStart,hm),this.windowListeners.add(Bi.VisibilityChange,this.handleCancel),this.windowListeners.add(Bi.ContextMenu,hm),this.documentListeners.add(Bi.Keydown,this.handleKeydown),n){if(s!=null&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(pm(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(fm(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,n){const{active:s,onPending:l}=this.props;l(s,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(Bi.Click,i_,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Bi.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:s,initialCoordinates:l,props:a}=this,{onMove:c,options:{activationConstraint:d}}=a;if(!l)return;const h=(n=Vu(e))!=null?n:os,m=Lu(l,h);if(!s&&d){if(fm(d)){if(d.tolerance!=null&&Fd(m,d.tolerance))return this.handleCancel();if(Fd(m,d.distance))return this.handleStart()}if(pm(d)&&Fd(m,d.tolerance))return this.handleCancel();this.handlePending(d,m);return}e.cancelable&&e.preventDefault(),c(h)}handleEnd(){const{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){const{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===ht.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const r_={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Lh extends Mh{constructor(e){const{event:n}=e,s=Jo(n.target);super(e,r_,s)}}Lh.activators=[{eventName:"onPointerDown",handler:(r,e)=>{let{nativeEvent:n}=r,{onActivation:s}=e;return!n.isPrimary||n.button!==0?!1:(s==null||s({event:n}),!0)}}];const o_={move:{name:"mousemove"},end:{name:"mouseup"}};var rh;(function(r){r[r.RightClick=2]="RightClick"})(rh||(rh={}));class l_ extends Mh{constructor(e){super(e,o_,Jo(e.event.target))}}l_.activators=[{eventName:"onMouseDown",handler:(r,e)=>{let{nativeEvent:n}=r,{onActivation:s}=e;return n.button===rh.RightClick?!1:(s==null||s({event:n}),!0)}}];const Hd={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class a_ extends Mh{constructor(e){super(e,Hd)}static setup(){return window.addEventListener(Hd.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Hd.move.name,e)};function e(){}}}a_.activators=[{eventName:"onTouchStart",handler:(r,e)=>{let{nativeEvent:n}=r,{onActivation:s}=e;const{touches:l}=n;return l.length>1?!1:(s==null||s({event:n}),!0)}}];var jl;(function(r){r[r.Pointer=0]="Pointer",r[r.DraggableRect=1]="DraggableRect"})(jl||(jl={}));var Wu;(function(r){r[r.TreeOrder=0]="TreeOrder",r[r.ReversedTreeOrder=1]="ReversedTreeOrder"})(Wu||(Wu={}));function u_(r){let{acceleration:e,activator:n=jl.Pointer,canScroll:s,draggingRect:l,enabled:a,interval:c=5,order:d=Wu.TreeOrder,pointerCoordinates:h,scrollableAncestors:m,scrollableAncestorRects:w,delta:v,threshold:S}=r;const E=d_({delta:v,disabled:!a}),[A,D]=D0(),P=B.useRef({x:0,y:0}),R=B.useRef({x:0,y:0}),O=B.useMemo(()=>{switch(n){case jl.Pointer:return h?{top:h.y,bottom:h.y,left:h.x,right:h.x}:null;case jl.DraggableRect:return l}},[n,l,h]),M=B.useRef(null),N=B.useCallback(()=>{const G=M.current;if(!G)return;const $=P.current.x*R.current.x,K=P.current.y*R.current.y;G.scrollBy($,K)},[]),Z=B.useMemo(()=>d===Wu.TreeOrder?[...m].reverse():m,[d,m]);B.useEffect(()=>{if(!a||!m.length||!O){D();return}for(const G of Z){if((s==null?void 0:s(G))===!1)continue;const $=m.indexOf(G),K=w[$];if(!K)continue;const{direction:he,speed:ue}=Z0(G,K,O,e,S);for(const Q of["x","y"])E[Q][he[Q]]||(ue[Q]=0,he[Q]=0);if(ue.x>0||ue.y>0){D(),M.current=G,A(N,c),P.current=ue,R.current=he;return}}P.current={x:0,y:0},R.current={x:0,y:0},D()},[e,N,s,D,a,c,JSON.stringify(O),JSON.stringify(E),A,m,Z,w,JSON.stringify(S)])}const c_={x:{[Dn.Backward]:!1,[Dn.Forward]:!1},y:{[Dn.Backward]:!1,[Dn.Forward]:!1}};function d_(r){let{delta:e,disabled:n}=r;const s=Mu(e);return na(l=>{if(n||!s||!l)return c_;const a={x:Math.sign(e.x-s.x),y:Math.sign(e.y-s.y)};return{x:{[Dn.Backward]:l.x[Dn.Backward]||a.x===-1,[Dn.Forward]:l.x[Dn.Forward]||a.x===1},y:{[Dn.Backward]:l.y[Dn.Backward]||a.y===-1,[Dn.Forward]:l.y[Dn.Forward]||a.y===1}}},[n,e,s])}function h_(r,e){const n=e!=null?r.get(e):void 0,s=n?n.node.current:null;return na(l=>{var a;return e==null?null:(a=s??l)!=null?a:null},[s,e])}function f_(r,e){return B.useMemo(()=>r.reduce((n,s)=>{const{sensor:l}=s,a=l.activators.map(c=>({eventName:c.eventName,handler:e(c.handler,s)}));return[...n,...a]},[]),[r,e])}var Ql;(function(r){r[r.Always=0]="Always",r[r.BeforeDragging=1]="BeforeDragging",r[r.WhileDragging=2]="WhileDragging"})(Ql||(Ql={}));var oh;(function(r){r.Optimized="optimized"})(oh||(oh={}));const mm=new Map;function p_(r,e){let{dragging:n,dependencies:s,config:l}=e;const[a,c]=B.useState(null),{frequency:d,measure:h,strategy:m}=l,w=B.useRef(r),v=P(),S=Kl(v),E=B.useCallback(function(R){R===void 0&&(R=[]),!S.current&&c(O=>O===null?R:O.concat(R.filter(M=>!O.includes(M))))},[S]),A=B.useRef(null),D=na(R=>{if(v&&!n)return mm;if(!R||R===mm||w.current!==r||a!=null){const O=new Map;for(let M of r){if(!M)continue;if(a&&a.length>0&&!a.includes(M.id)&&M.rect.current){O.set(M.id,M.rect.current);continue}const N=M.node.current,Z=N?new Rh(h(N),N):null;M.rect.current=Z,Z&&O.set(M.id,Z)}return O}return R},[r,a,n,v,h]);return B.useEffect(()=>{w.current=r},[r]),B.useEffect(()=>{v||E()},[n,v]),B.useEffect(()=>{a&&a.length>0&&c(null)},[JSON.stringify(a)]),B.useEffect(()=>{v||typeof d!="number"||A.current!==null||(A.current=setTimeout(()=>{E(),A.current=null},d))},[d,v,E,...s]),{droppableRects:D,measureDroppableContainers:E,measuringScheduled:a!=null};function P(){switch(m){case Ql.Always:return!1;case Ql.BeforeDragging:return n;default:return!n}}}function Vh(r,e){return na(n=>r?n||(typeof e=="function"?e(r):r):null,[e,r])}function m_(r,e){return Vh(r,e)}function g_(r){let{callback:e,disabled:n}=r;const s=Qu(e),l=B.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(s)},[s,n]);return B.useEffect(()=>()=>l==null?void 0:l.disconnect(),[l]),l}function Xu(r){let{callback:e,disabled:n}=r;const s=Qu(e),l=B.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(s)},[n]);return B.useEffect(()=>()=>l==null?void 0:l.disconnect(),[l]),l}function v_(r){return new Rh(ia(r),r)}function gm(r,e,n){e===void 0&&(e=v_);const[s,l]=B.useState(null);function a(){l(h=>{if(!r)return null;if(r.isConnected===!1){var m;return(m=h??n)!=null?m:null}const w=e(r);return JSON.stringify(h)===JSON.stringify(w)?h:w})}const c=g_({callback(h){if(r)for(const m of h){const{type:w,target:v}=m;if(w==="childList"&&v instanceof HTMLElement&&v.contains(r)){a();break}}}}),d=Xu({callback:a});return Gs(()=>{a(),r?(d==null||d.observe(r),c==null||c.observe(document.body,{childList:!0,subtree:!0})):(d==null||d.disconnect(),c==null||c.disconnect())},[r]),s}function w_(r){const e=Vh(r);return jg(r,e)}const vm=[];function __(r){const e=B.useRef(r),n=na(s=>r?s&&s!==vm&&r&&e.current&&r.parentNode===e.current.parentNode?s:Nh(r):vm,[r]);return B.useEffect(()=>{e.current=r},[r]),n}function y_(r){const[e,n]=B.useState(null),s=B.useRef(r),l=B.useCallback(a=>{const c=Wd(a.target);c&&n(d=>d?(d.set(c,sh(c)),new Map(d)):null)},[]);return B.useEffect(()=>{const a=s.current;if(r!==a){c(a);const d=r.map(h=>{const m=Wd(h);return m?(m.addEventListener("scroll",l,{passive:!0}),[m,sh(m)]):null}).filter(h=>h!=null);n(d.length?new Map(d):null),s.current=r}return()=>{c(r),c(a)};function c(d){d.forEach(h=>{const m=Wd(h);m==null||m.removeEventListener("scroll",l)})}},[l,r]),B.useMemo(()=>r.length?e?Array.from(e.values()).reduce((a,c)=>Wo(a,c),os):Qg(r):os,[r,e])}function wm(r,e){e===void 0&&(e=[]);const n=B.useRef(null);return B.useEffect(()=>{n.current=null},e),B.useEffect(()=>{const s=r!==os;s&&!n.current&&(n.current=r),!s&&n.current&&(n.current=null)},[r]),n.current?Lu(r,n.current):os}function S_(r){B.useEffect(()=>{if(!Ju)return;const e=r.map(n=>{let{sensor:s}=n;return s.setup==null?void 0:s.setup()});return()=>{for(const n of e)n==null||n()}},r.map(e=>{let{sensor:n}=e;return n}))}function D_(r,e){return B.useMemo(()=>r.reduce((n,s)=>{let{eventName:l,handler:a}=s;return n[l]=c=>{a(c,e)},n},{}),[r,e])}function ev(r){return B.useMemo(()=>r?Y0(r):null,[r])}const _m=[];function C_(r,e){e===void 0&&(e=ia);const[n]=r,s=ev(n?ni(n):null),[l,a]=B.useState(_m);function c(){a(()=>r.length?r.map(h=>Kg(h)?s:new Rh(e(h),h)):_m)}const d=Xu({callback:c});return Gs(()=>{d==null||d.disconnect(),c(),r.forEach(h=>d==null?void 0:d.observe(h))},[r]),l}function tv(r){if(!r)return null;if(r.children.length>1)return r;const e=r.children[0];return ta(e)?e:r}function x_(r){let{measure:e}=r;const[n,s]=B.useState(null),l=B.useCallback(m=>{for(const{target:w}of m)if(ta(w)){s(v=>{const S=e(w);return v?{...v,width:S.width,height:S.height}:S});break}},[e]),a=Xu({callback:l}),c=B.useCallback(m=>{const w=tv(m);a==null||a.disconnect(),w&&(a==null||a.observe(w)),s(w?e(w):null)},[e,a]),[d,h]=Ru(c);return B.useMemo(()=>({nodeRef:d,rect:n,setRef:h}),[n,d,h])}const E_=[{sensor:Lh,options:{}},{sensor:qg,options:{}}],b_={current:{}},Au={draggable:{measure:dm},droppable:{measure:dm,strategy:Ql.WhileDragging,frequency:oh.Optimized},dragOverlay:{measure:ia}};class Bl extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,s;return(n=(s=this.get(e))==null?void 0:s.node.current)!=null?n:void 0}}const P_={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Bl,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Gu},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Au,measureDroppableContainers:Gu,windowRect:null,measuringScheduled:!1},nv={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Gu,draggableNodes:new Map,over:null,measureDroppableContainers:Gu},sa=B.createContext(nv),iv=B.createContext(P_);function A_(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Bl}}}function z_(r,e){switch(e.type){case an.DragStart:return{...r,draggable:{...r.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case an.DragMove:return r.draggable.active==null?r:{...r,draggable:{...r.draggable,translate:{x:e.coordinates.x-r.draggable.initialCoordinates.x,y:e.coordinates.y-r.draggable.initialCoordinates.y}}};case an.DragEnd:case an.DragCancel:return{...r,draggable:{...r.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case an.RegisterDroppable:{const{element:n}=e,{id:s}=n,l=new Bl(r.droppable.containers);return l.set(s,n),{...r,droppable:{...r.droppable,containers:l}}}case an.SetDroppableDisabled:{const{id:n,key:s,disabled:l}=e,a=r.droppable.containers.get(n);if(!a||s!==a.key)return r;const c=new Bl(r.droppable.containers);return c.set(n,{...a,disabled:l}),{...r,droppable:{...r.droppable,containers:c}}}case an.UnregisterDroppable:{const{id:n,key:s}=e,l=r.droppable.containers.get(n);if(!l||s!==l.key)return r;const a=new Bl(r.droppable.containers);return a.delete(n),{...r,droppable:{...r.droppable,containers:a}}}default:return r}}function k_(r){let{disabled:e}=r;const{active:n,activatorEvent:s,draggableNodes:l}=B.useContext(sa),a=Mu(s),c=Mu(n==null?void 0:n.id);return B.useEffect(()=>{if(!e&&!s&&a&&c!=null){if(!Ih(a)||document.activeElement===a.target)return;const d=l.get(c);if(!d)return;const{activatorNode:h,node:m}=d;if(!h.current&&!m.current)return;requestAnimationFrame(()=>{for(const w of[h.current,m.current]){if(!w)continue;const v=E0(w);if(v){v.focus();break}}})}},[s,e,l,c,a]),null}function sv(r,e){let{transform:n,...s}=e;return r!=null&&r.length?r.reduce((l,a)=>a({transform:l,...s}),n):n}function O_(r){return B.useMemo(()=>({draggable:{...Au.draggable,...r==null?void 0:r.draggable},droppable:{...Au.droppable,...r==null?void 0:r.droppable},dragOverlay:{...Au.dragOverlay,...r==null?void 0:r.dragOverlay}}),[r==null?void 0:r.draggable,r==null?void 0:r.droppable,r==null?void 0:r.dragOverlay])}function T_(r){let{activeNode:e,measure:n,initialRect:s,config:l=!0}=r;const a=B.useRef(!1),{x:c,y:d}=typeof l=="boolean"?{x:l,y:l}:l;Gs(()=>{if(!c&&!d||!e){a.current=!1;return}if(a.current||!s)return;const m=e==null?void 0:e.node.current;if(!m||m.isConnected===!1)return;const w=n(m),v=jg(w,s);if(c||(v.x=0),d||(v.y=0),a.current=!0,Math.abs(v.x)>0||Math.abs(v.y)>0){const S=Ug(m);S&&S.scrollBy({top:v.y,left:v.x})}},[e,c,d,s,n])}const qu=B.createContext({...os,scaleX:1,scaleY:1});var vr;(function(r){r[r.Uninitialized=0]="Uninitialized",r[r.Initializing=1]="Initializing",r[r.Initialized=2]="Initialized"})(vr||(vr={}));const I_=B.memo(function(e){var n,s,l,a;let{id:c,accessibility:d,autoScroll:h=!0,children:m,sensors:w=E_,collisionDetection:v=F0,measuring:S,modifiers:E,...A}=e;const D=B.useReducer(z_,void 0,A_),[P,R]=D,[O,M]=O0(),[N,Z]=B.useState(vr.Uninitialized),G=N===vr.Initialized,{draggable:{active:$,nodes:K,translate:he},droppable:{containers:ue}}=P,Q=$!=null?K.get($):null,ve=B.useRef({initial:null,translated:null}),ie=B.useMemo(()=>{var ut;return $!=null?{id:$,data:(ut=Q==null?void 0:Q.data)!=null?ut:b_,rect:ve}:null},[$,Q]),ce=B.useRef(null),[j,te]=B.useState(null),[X,le]=B.useState(null),fe=Kl(A,Object.values(A)),ne=Zu("DndDescribedBy",c),k=B.useMemo(()=>ue.getEnabled(),[ue]),F=O_(S),{droppableRects:q,measureDroppableContainers:xe,measuringScheduled:Ie}=p_(k,{dragging:G,dependencies:[he.x,he.y],config:F.droppable}),Se=h_(K,$),Ee=B.useMemo(()=>X?Vu(X):null,[X]),We=Rt(),Fe=m_(Se,F.draggable.measure);T_({activeNode:$!=null?K.get($):null,config:We.layoutShiftCompensation,initialRect:Fe,measure:F.draggable.measure});const Me=gm(Se,F.draggable.measure,Fe),Zt=gm(Se?Se.parentElement:null),Wt=B.useRef({activatorEvent:null,active:null,activeNode:Se,collisionRect:null,collisions:null,droppableRects:q,draggableNodes:K,draggingNode:null,draggingNodeRect:null,droppableContainers:ue,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ft=ue.getNodeFor((n=Wt.current.over)==null?void 0:n.id),Ht=x_({measure:F.dragOverlay.measure}),ii=(s=Ht.nodeRef.current)!=null?s:Se,Tn=G?(l=Ht.rect)!=null?l:Me:null,ki=!!(Ht.nodeRef.current&&Ht.rect),ls=w_(ki?null:Me),Un=ev(ii?ni(ii):null),nt=__(G?Ft??Se:null),cn=C_(nt),dn=sv(E,{transform:{x:he.x-ls.x,y:he.y-ls.y,scaleX:1,scaleY:1},activatorEvent:X,active:ie,activeNodeRect:Me,containerNodeRect:Zt,draggingNodeRect:Tn,over:Wt.current.over,overlayNodeRect:Ht.rect,scrollableAncestors:nt,scrollableAncestorRects:cn,windowRect:Un}),pi=Ee?Wo(Ee,he):null,Le=y_(nt),ge=wm(Le),et=wm(Le,[Me]),it=Wo(dn,ge),hn=Tn?B0(Tn,dn):null,In=ie&&hn?v({active:ie,collisionRect:hn,droppableRects:q,droppableContainers:k,pointerCoordinates:pi}):null,Xt=G0(In,"id"),[kt,fn]=B.useState(null),xn=ki?dn:Wo(dn,et),qt=H0(xn,(a=kt==null?void 0:kt.rect)!=null?a:null,Me),En=B.useRef(null),as=B.useCallback((ut,en)=>{let{sensor:pn,options:vi}=en;if(ce.current==null)return;const bn=K.get(ce.current);if(!bn)return;const mn=ut.nativeEvent,Nn=new pn({active:ce.current,activeNode:bn,event:mn,options:vi,context:Wt,onAbort(je){if(!K.get(je))return;const{onDragAbort:Et}=fe.current,gn={id:je};Et==null||Et(gn),O({type:"onDragAbort",event:gn})},onPending(je,xt,Et,gn){if(!K.get(je))return;const{onDragPending:An}=fe.current,jt={id:je,constraint:xt,initialCoordinates:Et,offset:gn};An==null||An(jt),O({type:"onDragPending",event:jt})},onStart(je){const xt=ce.current;if(xt==null)return;const Et=K.get(xt);if(!Et)return;const{onDragStart:gn}=fe.current,yt={activatorEvent:mn,active:{id:xt,data:Et.data,rect:ve}};Kr.unstable_batchedUpdates(()=>{gn==null||gn(yt),Z(vr.Initializing),R({type:an.DragStart,initialCoordinates:je,active:xt}),O({type:"onDragStart",event:yt}),te(En.current),le(mn)})},onMove(je){R({type:an.DragMove,coordinates:je})},onEnd:Pn(an.DragEnd),onCancel:Pn(an.DragCancel)});En.current=Nn;function Pn(je){return async function(){const{active:Et,collisions:gn,over:yt,scrollAdjustedTranslate:An}=Wt.current;let jt=null;if(Et&&An){const{cancelDrop:Oi}=fe.current;jt={activatorEvent:mn,active:Et,collisions:gn,delta:An,over:yt},je===an.DragEnd&&typeof Oi=="function"&&await Promise.resolve(Oi(jt))&&(je=an.DragCancel)}ce.current=null,Kr.unstable_batchedUpdates(()=>{R({type:je}),Z(vr.Uninitialized),fn(null),te(null),le(null),En.current=null;const Oi=je===an.DragEnd?"onDragEnd":"onDragCancel";if(jt){const Ws=fe.current[Oi];Ws==null||Ws(jt),O({type:Oi,event:jt})}})}}},[K]),us=B.useCallback((ut,en)=>(pn,vi)=>{const bn=pn.nativeEvent,mn=K.get(vi);if(ce.current!==null||!mn||bn.dndKit||bn.defaultPrevented)return;const Nn={active:mn};ut(pn,en.options,Nn)===!0&&(bn.dndKit={capturedBy:en.sensor},ce.current=vi,as(pn,en))},[K,as]),mi=f_(w,us);S_(w),Gs(()=>{Me&&N===vr.Initializing&&Z(vr.Initialized)},[Me,N]),B.useEffect(()=>{const{onDragMove:ut}=fe.current,{active:en,activatorEvent:pn,collisions:vi,over:bn}=Wt.current;if(!en||!pn)return;const mn={active:en,activatorEvent:pn,collisions:vi,delta:{x:it.x,y:it.y},over:bn};Kr.unstable_batchedUpdates(()=>{ut==null||ut(mn),O({type:"onDragMove",event:mn})})},[it.x,it.y]),B.useEffect(()=>{const{active:ut,activatorEvent:en,collisions:pn,droppableContainers:vi,scrollAdjustedTranslate:bn}=Wt.current;if(!ut||ce.current==null||!en||!bn)return;const{onDragOver:mn}=fe.current,Nn=vi.get(Xt),Pn=Nn&&Nn.rect.current?{id:Nn.id,rect:Nn.rect.current,data:Nn.data,disabled:Nn.disabled}:null,je={active:ut,activatorEvent:en,collisions:pn,delta:{x:bn.x,y:bn.y},over:Pn};Kr.unstable_batchedUpdates(()=>{fn(Pn),mn==null||mn(je),O({type:"onDragOver",event:je})})},[Xt]),Gs(()=>{Wt.current={activatorEvent:X,active:ie,activeNode:Se,collisionRect:hn,collisions:In,droppableRects:q,draggableNodes:K,draggingNode:ii,draggingNodeRect:Tn,droppableContainers:ue,over:kt,scrollableAncestors:nt,scrollAdjustedTranslate:it},ve.current={initial:Tn,translated:hn}},[ie,Se,In,hn,K,ii,Tn,q,ue,kt,nt,it]),u_({...We,delta:he,draggingRect:hn,pointerCoordinates:pi,scrollableAncestors:nt,scrollableAncestorRects:cn});const gi=B.useMemo(()=>({active:ie,activeNode:Se,activeNodeRect:Me,activatorEvent:X,collisions:In,containerNodeRect:Zt,dragOverlay:Ht,draggableNodes:K,droppableContainers:ue,droppableRects:q,over:kt,measureDroppableContainers:xe,scrollableAncestors:nt,scrollableAncestorRects:cn,measuringConfiguration:F,measuringScheduled:Ie,windowRect:Un}),[ie,Se,Me,X,In,Zt,Ht,K,ue,q,kt,xe,nt,cn,F,Ie,Un]),cs=B.useMemo(()=>({activatorEvent:X,activators:mi,active:ie,activeNodeRect:Me,ariaDescribedById:{draggable:ne},dispatch:R,draggableNodes:K,over:kt,measureDroppableContainers:xe}),[X,mi,ie,Me,R,ne,K,kt,xe]);return pe.createElement(Hg.Provider,{value:M},pe.createElement(sa.Provider,{value:cs},pe.createElement(iv.Provider,{value:gi},pe.createElement(qu.Provider,{value:qt},m)),pe.createElement(k_,{disabled:(d==null?void 0:d.restoreFocus)===!1})),pe.createElement(N0,{...d,hiddenTextDescribedById:ne}));function Rt(){const ut=(j==null?void 0:j.autoScrollEnabled)===!1,en=typeof h=="object"?h.enabled===!1:h===!1,pn=G&&!ut&&!en;return typeof h=="object"?{...h,enabled:pn}:{enabled:pn}}}),N_=B.createContext(null),ym="button",R_="Draggable";function M_(r){let{id:e,data:n,disabled:s=!1,attributes:l}=r;const a=Zu(R_),{activators:c,activatorEvent:d,active:h,activeNodeRect:m,ariaDescribedById:w,draggableNodes:v,over:S}=B.useContext(sa),{role:E=ym,roleDescription:A="draggable",tabIndex:D=0}=l??{},P=(h==null?void 0:h.id)===e,R=B.useContext(P?qu:N_),[O,M]=Ru(),[N,Z]=Ru(),G=D_(c,e),$=Kl(n);Gs(()=>(v.set(e,{id:e,key:a,node:O,activatorNode:N,data:$}),()=>{const he=v.get(e);he&&he.key===a&&v.delete(e)}),[v,e]);const K=B.useMemo(()=>({role:E,tabIndex:D,"aria-disabled":s,"aria-pressed":P&&E===ym?!0:void 0,"aria-roledescription":A,"aria-describedby":w.draggable}),[s,E,D,P,A,w.draggable]);return{active:h,activatorEvent:d,activeNodeRect:m,attributes:K,isDragging:P,listeners:s?void 0:G,node:O,over:S,setNodeRef:M,setActivatorNodeRef:Z,transform:R}}function L_(){return B.useContext(iv)}const V_="Droppable",G_={timeout:25};function W_(r){let{data:e,disabled:n=!1,id:s,resizeObserverConfig:l}=r;const a=Zu(V_),{active:c,dispatch:d,over:h,measureDroppableContainers:m}=B.useContext(sa),w=B.useRef({disabled:n}),v=B.useRef(!1),S=B.useRef(null),E=B.useRef(null),{disabled:A,updateMeasurementsFor:D,timeout:P}={...G_,...l},R=Kl(D??s),O=B.useCallback(()=>{if(!v.current){v.current=!0;return}E.current!=null&&clearTimeout(E.current),E.current=setTimeout(()=>{m(Array.isArray(R.current)?R.current:[R.current]),E.current=null},P)},[P]),M=Xu({callback:O,disabled:A||!c}),N=B.useCallback((K,he)=>{M&&(he&&(M.unobserve(he),v.current=!1),K&&M.observe(K))},[M]),[Z,G]=Ru(N),$=Kl(e);return B.useEffect(()=>{!M||!Z.current||(M.disconnect(),v.current=!1,M.observe(Z.current))},[Z,M]),B.useEffect(()=>(d({type:an.RegisterDroppable,element:{id:s,key:a,disabled:n,node:Z,rect:S,data:$}}),()=>d({type:an.UnregisterDroppable,key:a,id:s})),[s]),B.useEffect(()=>{n!==w.current.disabled&&(d({type:an.SetDroppableDisabled,id:s,key:a,disabled:n}),w.current.disabled=n)},[s,a,n,d]),{active:c,rect:S,isOver:(h==null?void 0:h.id)===s,node:Z,over:h,setNodeRef:G}}function F_(r){let{animation:e,children:n}=r;const[s,l]=B.useState(null),[a,c]=B.useState(null),d=Mu(n);return!n&&!s&&d&&l(d),Gs(()=>{if(!a)return;const h=s==null?void 0:s.key,m=s==null?void 0:s.props.id;if(h==null||m==null){l(null);return}Promise.resolve(e(m,a)).then(()=>{l(null)})},[e,s,a]),pe.createElement(pe.Fragment,null,n,s?B.cloneElement(s,{ref:c}):null)}const H_={x:0,y:0,scaleX:1,scaleY:1};function j_(r){let{children:e}=r;return pe.createElement(sa.Provider,{value:nv},pe.createElement(qu.Provider,{value:H_},e))}const B_={position:"fixed",touchAction:"none"},U_=r=>Ih(r)?"transform 250ms ease":void 0,$_=B.forwardRef((r,e)=>{let{as:n,activatorEvent:s,adjustScale:l,children:a,className:c,rect:d,style:h,transform:m,transition:w=U_}=r;if(!d)return null;const v=l?m:{...m,scaleX:1,scaleY:1},S={...B_,width:d.width,height:d.height,top:d.top,left:d.left,transform:Jl.Transform.toString(v),transformOrigin:l&&s?L0(s,d):void 0,transition:typeof w=="function"?w(s):w,...h};return pe.createElement(n,{className:c,style:S,ref:e},a)}),Y_=r=>e=>{let{active:n,dragOverlay:s}=e;const l={},{styles:a,className:c}=r;if(a!=null&&a.active)for(const[d,h]of Object.entries(a.active))h!==void 0&&(l[d]=n.node.style.getPropertyValue(d),n.node.style.setProperty(d,h));if(a!=null&&a.dragOverlay)for(const[d,h]of Object.entries(a.dragOverlay))h!==void 0&&s.node.style.setProperty(d,h);return c!=null&&c.active&&n.node.classList.add(c.active),c!=null&&c.dragOverlay&&s.node.classList.add(c.dragOverlay),function(){for(const[h,m]of Object.entries(l))n.node.style.setProperty(h,m);c!=null&&c.active&&n.node.classList.remove(c.active)}},K_=r=>{let{transform:{initial:e,final:n}}=r;return[{transform:Jl.Transform.toString(e)},{transform:Jl.Transform.toString(n)}]},J_={duration:250,easing:"ease",keyframes:K_,sideEffects:Y_({styles:{active:{opacity:"0"}}})};function Q_(r){let{config:e,draggableNodes:n,droppableContainers:s,measuringConfiguration:l}=r;return Qu((a,c)=>{if(e===null)return;const d=n.get(a);if(!d)return;const h=d.node.current;if(!h)return;const m=tv(c);if(!m)return;const{transform:w}=ni(c).getComputedStyle(c),v=Bg(w);if(!v)return;const S=typeof e=="function"?e:Z_(e);return Zg(h,l.draggable.measure),S({active:{id:a,data:d.data,node:h,rect:l.draggable.measure(h)},draggableNodes:n,dragOverlay:{node:c,rect:l.dragOverlay.measure(m)},droppableContainers:s,measuringConfiguration:l,transform:v})})}function Z_(r){const{duration:e,easing:n,sideEffects:s,keyframes:l}={...J_,...r};return a=>{let{active:c,dragOverlay:d,transform:h,...m}=a;if(!e)return;const w={x:d.rect.left-c.rect.left,y:d.rect.top-c.rect.top},v={scaleX:h.scaleX!==1?c.rect.width*h.scaleX/d.rect.width:1,scaleY:h.scaleY!==1?c.rect.height*h.scaleY/d.rect.height:1},S={x:h.x-w.x,y:h.y-w.y,...v},E=l({...m,active:c,dragOverlay:d,transform:{initial:h,final:S}}),[A]=E,D=E[E.length-1];if(JSON.stringify(A)===JSON.stringify(D))return;const P=s==null?void 0:s({active:c,dragOverlay:d,...m}),R=d.node.animate(E,{duration:e,easing:n,fill:"forwards"});return new Promise(O=>{R.onfinish=()=>{P==null||P(),O()}})}}let Sm=0;function X_(r){return B.useMemo(()=>{if(r!=null)return Sm++,Sm},[r])}const q_=pe.memo(r=>{let{adjustScale:e=!1,children:n,dropAnimation:s,style:l,transition:a,modifiers:c,wrapperElement:d="div",className:h,zIndex:m=999}=r;const{activatorEvent:w,active:v,activeNodeRect:S,containerNodeRect:E,draggableNodes:A,droppableContainers:D,dragOverlay:P,over:R,measuringConfiguration:O,scrollableAncestors:M,scrollableAncestorRects:N,windowRect:Z}=L_(),G=B.useContext(qu),$=X_(v==null?void 0:v.id),K=sv(c,{activatorEvent:w,active:v,activeNodeRect:S,containerNodeRect:E,draggingNodeRect:P.rect,over:R,overlayNodeRect:P.rect,scrollableAncestors:M,scrollableAncestorRects:N,transform:G,windowRect:Z}),he=Vh(S),ue=Q_({config:s,draggableNodes:A,droppableContainers:D,measuringConfiguration:O}),Q=he?P.setRef:void 0;return pe.createElement(j_,null,pe.createElement(F_,{animation:ue},v&&$?pe.createElement($_,{key:$,id:v.id,ref:Q,as:d,activatorEvent:w,adjustScale:e,className:h,transition:a,rect:he,style:{zIndex:m,...l},transform:K},n):null))}),Dm=r=>{let e;const n=new Set,s=(m,w)=>{const v=typeof m=="function"?m(e):m;if(!Object.is(v,e)){const S=e;e=w??(typeof v!="object"||v===null)?v:Object.assign({},e,v),n.forEach(E=>E(e,S))}},l=()=>e,d={setState:s,getState:l,getInitialState:()=>h,subscribe:m=>(n.add(m),()=>n.delete(m))},h=e=r(s,l,d);return d},ey=(r=>r?Dm(r):Dm),ty=r=>r;function ny(r,e=ty){const n=pe.useSyncExternalStore(r.subscribe,pe.useCallback(()=>e(r.getState()),[r,e]),pe.useCallback(()=>e(r.getInitialState()),[r,e]));return pe.useDebugValue(n),n}const Cm=r=>{const e=ey(r),n=s=>ny(e,s);return Object.assign(n,e),n},iy=(r=>r?Cm(r):Cm),rv="damiao.monitor.plotConfigs";function sy(){try{return JSON.parse(localStorage.getItem(rv)||"{}")}catch{return{}}}function ry(r){try{localStorage.setItem(rv,JSON.stringify(r))}catch{}}const Cn=iy((r,e)=>({connected:!1,status:null,signals:[],pairs:[],motors:[],motorTypes:[],plotConfigs:sy(),setConnected:n=>r({connected:n}),setStatus:n=>r({status:n}),setMeta:(n,s)=>r({signals:n,pairs:s}),setMotors:n=>r({motors:n}),setMotorTypes:n=>r({motorTypes:n}),ensurePlot:n=>r(s=>s.plotConfigs[n]?s:{plotConfigs:{...s.plotConfigs,[n]:{signals:[],duration:10}}}),setPlotConfig:(n,s)=>r(l=>({plotConfigs:{...l.plotConfigs,[n]:{...l.plotConfigs[n]||{signals:[],duration:10},...s}}})),addSignalToPlot:(n,s)=>r(l=>{const a=l.plotConfigs[n]||{signals:[],duration:10};return a.signals.includes(s)?l:{plotConfigs:{...l.plotConfigs,[n]:{...a,signals:[...a.signals,s]}}}}),removeSignalFromPlot:(n,s)=>r(l=>{const a=l.plotConfigs[n];return a?{plotConfigs:{...l.plotConfigs,[n]:{...a,signals:a.signals.filter(c=>c!==s)}}}:l}),dropPlot:n=>r(s=>{const l={...s.plotConfigs};return delete l[n],{plotConfigs:l}})}));Cn.subscribe(r=>ry(r.plotConfigs));const oy={plot:"Plot",table:"Motor Table",cards:"Motor Cards",rawlog:"Raw CAN Log"};let lh=null;const vu={};function ly(r){lh=r}function wu(r){if(!lh)return;vu[r]=(vu[r]||0)+1;const e=`${r}-${Date.now().toString(36)}-${vu[r]}`;lh.addPanel({id:e,component:r,title:`${oy[r]} ${vu[r]}`})}function ay(){const r=Cn(s=>s.connected),e=Cn(s=>s.status),n=()=>{localStorage.removeItem("damiao.monitor.layout"),localStorage.removeItem("damiao.monitor.plotConfigs"),location.reload()};return Y.jsxs("header",{className:"toolbar",children:[Y.jsxs("div",{className:"brand",children:[Y.jsx("span",{className:"brand-dot"}),"DaMiao ",Y.jsx("span",{className:"brand-sub",children:"Passive Monitor"})]}),Y.jsxs("div",{className:"conn",children:[Y.jsx("span",{className:"dot "+(r?"on":"off")}),Y.jsx("span",{className:"mono",children:e!=null&&e.demo?"demo":(e==null?void 0:e.channel)||"—"}),e&&!e.demo&&Y.jsx("span",{className:"badge "+(e.listenOnly?"ok":"warn"),title:"hardware listen-only",children:e.listenOnly?"listen-only":"rx (no TX)"}),(e==null?void 0:e.error)&&Y.jsx("span",{className:"badge err",title:e.error,children:"bus error"}),e&&Y.jsxs("span",{className:"muted small",children:[e.framesSeen.toLocaleString()," frames · +",e.feedbackOffset," fb"]})]}),Y.jsx("div",{className:"spacer"}),Y.jsxs("div",{className:"actions",children:[Y.jsx("button",{className:"btn",onClick:()=>wu("plot"),children:"+ Plot"}),Y.jsx("button",{className:"btn",onClick:()=>wu("table"),children:"+ Table"}),Y.jsx("button",{className:"btn",onClick:()=>wu("cards"),children:"+ Cards"}),Y.jsx("button",{className:"btn",onClick:()=>wu("rawlog"),children:"+ Raw Log"}),Y.jsx("button",{className:"btn ghost",onClick:n,children:"Reset"})]})]})}const uy={pos:"#58a6ff",vel:"#3fb950",torque:"#d29922",kp:"#bc8cff",kd:"#f778ba",vel_limit:"#56d4dd",torque_limit:"#e3b341",t_mos:"#ff7b72",t_rotor:"#ffa657",status_code:"#8b949e"};function cy(r){return uy[r]||"#8b949e"}function zu(r){const e=cy(r.field);return r.source==="cmd"?dy(e,.15):e}function ah(r){const e=r.split(":");return e.length>=3?`${e[1]} ${e[2]}`:r}function xm(r){return r.includes(":cmd.")}const Em=["pos","vel","torque","kp","kd","t_mos","t_rotor"];function dy(r,e){const n=r.replace("#",""),s=Math.min(255,Math.round(parseInt(n.slice(0,2),16)+255*e)),l=Math.min(255,Math.round(parseInt(n.slice(2,4),16)+255*e)),a=Math.min(255,Math.round(parseInt(n.slice(4,6),16)+255*e));return`rgb(${s},${l},${a})`}function jo(r,e=3){return r==null||Number.isNaN(r)?"—":r.toFixed(e)}function hy({sig:r}){const{attributes:e,listeners:n,setNodeRef:s,isDragging:l}=M_({id:`sig:${r.id}`,data:{signalId:r.id}}),a=zu(r);return Y.jsxs("div",{ref:s,className:"sig-chip"+(l?" dragging":""),...n,...e,title:r.id,children:[Y.jsx("span",{className:"sig-swatch",style:{background:a,borderStyle:r.source==="cmd"?"dashed":"solid"}}),Y.jsxs("span",{className:"sig-name",children:[r.source,".",r.field]}),r.unit&&Y.jsx("span",{className:"sig-unit",children:r.unit})]})}function fy(r){return[...r].sort((e,n)=>{if(e.source!==n.source)return e.source==="cmd"?-1:1;const s=Em.indexOf(e.field),l=Em.indexOf(n.field);return(s<0?99:s)-(l<0?99:l)})}function py(){const r=Cn(a=>a.signals),e=Cn(a=>a.status),[n,s]=B.useState(""),l=B.useMemo(()=>{const a=new Map;for(const c of r){if(n&&!c.id.toLowerCase().includes(n.toLowerCase()))continue;const d=a.get(c.motorId)||[];d.push(c),a.set(c.motorId,d)}return Array.from(a.entries()).sort((c,d)=>c[0]-d[0])},[r,n]);return Y.jsxs("aside",{className:"sidebar",children:[Y.jsxs("div",{className:"sidebar-head",children:[Y.jsx("div",{className:"sidebar-title",children:"Signals"}),Y.jsx("input",{className:"filter",placeholder:"filter…",value:n,onChange:a=>s(a.target.value)})]}),Y.jsxs("div",{className:"sidebar-body",children:[l.length===0&&Y.jsx("div",{className:"muted pad",children:e!=null&&e.error?"Bus error — see top bar.":"No signals yet. Start a controller on the bus (or run --demo)."}),l.map(([a,c])=>Y.jsxs("div",{className:"motor-group",children:[Y.jsxs("div",{className:"motor-group-title",children:["Motor ",a]}),Y.jsx("div",{className:"chips",children:fy(c).map(d=>Y.jsx(hy,{sig:d},d.id))})]},a))]}),Y.jsxs("div",{className:"sidebar-foot muted",children:["Drag a signal onto a plot. Drop ",Y.jsx("b",{children:"cmd"})," onto its ",Y.jsx("b",{children:"fb"})," plot to overlay."]})]})}class ov{}class _r extends ov{constructor(e,n,s){super(),this.viewId=e,this.groupId=n,this.panelId=s}}class Ul extends ov{constructor(e,n){super(),this.viewId=e,this.paneId=n}}class Ds{constructor(){}static getInstance(){return Ds.INSTANCE}hasData(e){return e&&e===this.proto}clearData(e){this.hasData(e)&&(this.proto=void 0,this.data=void 0)}getData(e){if(this.hasData(e))return this.data}setData(e,n){n&&(this.data=e,this.proto=n)}}Ds.INSTANCE=new Ds;function Hn(){const r=Ds.getInstance();if(r.hasData(_r.prototype))return r.getData(_r.prototype)[0]}function Nl(){const r=Ds.getInstance();if(r.hasData(Ul.prototype))return r.getData(Ul.prototype)[0]}var Jr;(function(r){r.any=(...e)=>n=>{const s=e.map(l=>l(n));return{dispose:()=>{s.forEach(l=>{l.dispose()})}}}})(Jr||(Jr={}));class Gh{constructor(){this._defaultPrevented=!1}get defaultPrevented(){return this._defaultPrevented}preventDefault(){this._defaultPrevented=!0}}class lv{constructor(){this._isAccepted=!1}get isAccepted(){return this._isAccepted}accept(){this._isAccepted=!0}}class my{constructor(){this.events=new Map}get size(){return this.events.size}add(e,n){this.events.set(e,n)}delete(e){this.events.delete(e)}clear(){this.events.clear()}}class Fu{static create(){var e;return new Fu((e=new Error().stack)!==null&&e!==void 0?e:"")}constructor(e){this.value=e}print(){console.warn("dockview: stacktrace",this.value)}}class gy{constructor(e,n){this.callback=e,this.stacktrace=n}}class U{static setLeakageMonitorEnabled(e){e!==U.ENABLE_TRACKING&&U.MEMORY_LEAK_WATCHER.clear(),U.ENABLE_TRACKING=e}get value(){return this._last}constructor(e){this.options=e,this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=e=>{var n;!((n=this.options)===null||n===void 0)&&n.replay&&this._last!==void 0&&e(this._last);const s=new gy(e,U.ENABLE_TRACKING?Fu.create():void 0);return this._listeners.push(s),{dispose:()=>{const l=this._listeners.indexOf(s);l>-1&&this._listeners.splice(l,1)}}},U.ENABLE_TRACKING&&U.MEMORY_LEAK_WATCHER.add(this._event,Fu.create())),this._event}fire(e){var n;!((n=this.options)===null||n===void 0)&&n.replay&&(this._last=e);for(const s of this._listeners)s.callback(e)}dispose(){this._disposed||(this._disposed=!0,this._listeners.length>0&&(U.ENABLE_TRACKING&&queueMicrotask(()=>{var e;for(const n of this._listeners)console.warn("dockview: stacktrace",(e=n.stacktrace)===null||e===void 0?void 0:e.print())}),this._listeners=[]),U.ENABLE_TRACKING&&this._event&&U.MEMORY_LEAK_WATCHER.delete(this._event))}}U.ENABLE_TRACKING=!1;U.MEMORY_LEAK_WATCHER=new my;function Be(r,e,n,s){return r.addEventListener(e,n,s),{dispose:()=>{r.removeEventListener(e,n,s)}}}class bm{constructor(){this._onFired=new U,this._currentFireCount=0,this._queued=!1,this.onEvent=e=>{const n=this._currentFireCount;return this._onFired.event(()=>{this._currentFireCount>n&&e()})}}fire(){this._currentFireCount++,!this._queued&&(this._queued=!0,queueMicrotask(()=>{this._queued=!1,this._onFired.fire()}))}dispose(){this._onFired.dispose()}}var Qt;(function(r){r.NONE={dispose:()=>{}};function e(n){return{dispose:()=>{n()}}}r.from=e})(Qt||(Qt={}));class Re{get isDisposed(){return this._isDisposed}constructor(...e){this._isDisposed=!1,this._disposables=e}addDisposables(...e){e.forEach(n=>this._disposables.push(n))}dispose(){this._isDisposed||(this._isDisposed=!0,this._disposables.forEach(e=>e.dispose()),this._disposables=[])}}class Bn{constructor(){this._disposable=Qt.NONE}set value(e){this._disposable&&this._disposable.dispose(),this._disposable=e}dispose(){this._disposable&&(this._disposable.dispose(),this._disposable=Qt.NONE)}}class vy extends Re{constructor(e){super(),this._onDidChange=new U,this.onDidChange=this._onDidChange.event,this._value=null,this.addDisposables(this._onDidChange,ec(e,n=>{const s=n.target.scrollWidth>n.target.clientWidth,l=n.target.scrollHeight>n.target.clientHeight;this._value={hasScrollX:s,hasScrollY:l},this._onDidChange.fire(this._value)}))}}function ec(r,e){const n=new ResizeObserver(s=>{requestAnimationFrame(()=>{const l=s[0];e(l)})});return n.observe(r),{dispose:()=>{n.unobserve(r),n.disconnect()}}}const Zl=(r,...e)=>{for(const n of e)r.classList.contains(n)&&r.classList.remove(n)},tc=(r,...e)=>{for(const n of e)r.classList.contains(n)||r.classList.add(n)},Ne=(r,e,n)=>{const s=r.classList.contains(e);n&&!s&&r.classList.add(e),!n&&s&&r.classList.remove(e)};function uh(r,e){for(;r;){if(r===e)return!0;r=r.parentNode}return!1}function av(r){return new wy(r)}class wy extends Re{constructor(e){super(),this._onDidFocus=new U,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new U,this.onDidBlur=this._onDidBlur.event,this.addDisposables(this._onDidFocus,this._onDidBlur);let n=uh(document.activeElement,e),s=!1;const l=()=>{s=!1,n||(n=!0,this._onDidFocus.fire())},a=()=>{n&&(s=!0,window.setTimeout(()=>{s&&(s=!1,n=!1,this._onDidBlur.fire())},0))};this._refreshStateHandler=()=>{uh(document.activeElement,e)!==n&&(n?a():l())},this.addDisposables(Be(e,"focus",l,!0)),this.addDisposables(Be(e,"blur",a,!0))}refreshState(){this._refreshStateHandler()}}const uv="dv-quasiPreventDefault";function _y(r){r[uv]=!0}function Pm(r){return r[uv]}function yy(r,e){const n=Array.from(e);for(const s of n){if(s.href){const a=r.createElement("link");a.href=s.href,a.type=s.type,a.rel="stylesheet",r.head.appendChild(a)}let l=[];try{s.cssRules&&(l=Array.from(s.cssRules).map(a=>a.cssText))}catch{}for(const a of l){const c=r.createElement("style");c.appendChild(r.createTextNode(a)),r.head.appendChild(c)}}}function ch(r){const{left:e,top:n,width:s,height:l}=r.getBoundingClientRect();return{left:e+window.scrollX,top:n+window.scrollY,width:s,height:l}}function Sy(r){let e=r;for(;e!=null&&e.parentNode;){if(e.parentNode===document)return!0;e.parentNode instanceof DocumentFragment?e=e.parentNode.host:e=e.parentNode}return!1}function Dy(r,e){r.setAttribute("data-testid",e)}function Cy(r){const e=[];function n(s){if(s.nodeType===Node.ELEMENT_NODE){r.includes(s.tagName)&&e.push(s),s.shadowRoot&&n(s.shadowRoot);for(const l of s.children)n(l)}}return n(document.documentElement),e}function Hu(r=document){const e=Cy(["IFRAME","WEBVIEW"]),n=new WeakMap;for(const s of e)n.set(s,s.style.pointerEvents),s.style.pointerEvents="none";return{release:()=>{var s;for(const l of e)l.style.pointerEvents=(s=n.get(l))!==null&&s!==void 0?s:"auto";e.splice(0,e.length)}}}function xy(r){function e(l){const a=[];for(let c=0;cl.startsWith("dockview-theme-")),typeof n!="string");)s=s.parentElement;return n}class nc{constructor(e){this.element=e,this._classNames=[]}setClassNames(e){for(const n of this._classNames)Ne(this.element,n,!1);this._classNames=e.split(" ").filter(n=>n.trim().length>0);for(const n of this._classNames)Ne(this.element,n,!0)}}const cv=100;function Ey(r,e){const n=ch(r),s=ch(e);return!(n.lefts.left+s.width)}function by(r){const e=new U;let n=r.screenX,s=r.screenY,l;const a=()=>{if(r.closed)return;const c=r.screenX,d=r.screenY;(c!==n||d!==s)&&(clearTimeout(l),l=setTimeout(()=>{e.fire()},cv),n=c,s=d),requestAnimationFrame(a)};return a(),e}function Py(r,e){let n;return new Re(Be(r,"resize",()=>{clearTimeout(n),n=setTimeout(()=>{e()},cv)}))}function Ay(r,e,n={buffer:10}){const s=n.buffer,l=r.getBoundingClientRect(),a=e.getBoundingClientRect();let c=0,d=0;const h=l.left-a.left,m=l.top-a.top,w=l.bottom-a.bottom,v=l.right-a.right;hs&&(c=-s-v),ms&&(d=-w-s),(c!==0||d!==0)&&(r.style.transform=`translate(${c}px, ${d}px)`)}function zy(r){let e=r;for(;e&&(e.style.zIndex==="auto"||e.style.zIndex==="");)e=e.parentElement;return e}function Ms(r){if(r.length===0)throw new Error("Invalid tail call");return[r.slice(0,r.length-1),r[r.length-1]]}function dv(r,e){if(r.length!==e.length)return!1;for(let n=0;n-1&&(r.splice(n,1),r.unshift(e))}function _u(r,e){const n=r.indexOf(e);n>-1&&(r.splice(n,1),r.push(e))}function ky(r,e){for(let n=0;ns===e);return n>-1?(r.splice(n,1),!0):!1}const _t=(r,e,n)=>e>n?e:Math.min(n,Math.max(r,e)),Wh=()=>{let r=1;return{next:()=>(r++).toString()}},ts=(r,e)=>{const n=[];if(typeof e!="number"&&(e=r,r=0),r<=e)for(let s=r;se;s--)n.push(s);return n};class Oy{set size(e){this._size=e}get size(){return this._size}get cachedVisibleSize(){return this._cachedVisibleSize}get visible(){return typeof this._cachedVisibleSize>"u"}get minimumSize(){return this.visible?this.view.minimumSize:0}get viewMinimumSize(){return this.view.minimumSize}get maximumSize(){return this.visible?this.view.maximumSize:0}get viewMaximumSize(){return this.view.maximumSize}get priority(){return this.view.priority}get snap(){return!!this.view.snap}set enabled(e){this.container.style.pointerEvents=e?"":"none"}constructor(e,n,s,l){this.container=e,this.view=n,this.disposable=l,this._cachedVisibleSize=void 0,typeof s=="number"?(this._size=s,this._cachedVisibleSize=void 0,e.classList.add("visible")):(this._size=0,this._cachedVisibleSize=s.cachedVisibleSize)}setVisible(e,n){var s;e!==this.visible&&(e?(this.size=_t((s=this._cachedVisibleSize)!==null&&s!==void 0?s:0,this.viewMinimumSize,this.viewMaximumSize),this._cachedVisibleSize=void 0):(this._cachedVisibleSize=typeof n=="number"?n:this.size,this.size=0),this.container.classList.toggle("visible",e),this.view.setVisible&&this.view.setVisible(e))}dispose(){return this.disposable.dispose(),this.view}}var ze;(function(r){r.HORIZONTAL="HORIZONTAL",r.VERTICAL="VERTICAL"})(ze||(ze={}));var ji;(function(r){r[r.MAXIMUM=0]="MAXIMUM",r[r.MINIMUM=1]="MINIMUM",r[r.DISABLED=2]="DISABLED",r[r.ENABLED=3]="ENABLED"})(ji||(ji={}));var on;(function(r){r.Low="low",r.High="high",r.Normal="normal"})(on||(on={}));var $i;(function(r){r.Distribute={type:"distribute"};function e(s){return{type:"split",index:s}}r.Split=e;function n(s){return{type:"invisible",cachedVisibleSize:s}}r.Invisible=n})($i||($i={}));class Xl{get contentSize(){return this._contentSize}get size(){return this._size}set size(e){this._size=e}get orthogonalSize(){return this._orthogonalSize}set orthogonalSize(e){this._orthogonalSize=e}get length(){return this.viewItems.length}get proportions(){return this._proportions?[...this._proportions]:void 0}get orientation(){return this._orientation}set orientation(e){this._orientation=e;const n=this.size;this.size=this.orthogonalSize,this.orthogonalSize=n,Zl(this.element,"dv-horizontal","dv-vertical"),this.element.classList.add(this.orientation==ze.HORIZONTAL?"dv-horizontal":"dv-vertical")}get minimumSize(){return this.viewItems.reduce((e,n)=>e+n.minimumSize,0)}get maximumSize(){return this.length===0?Number.POSITIVE_INFINITY:this.viewItems.reduce((e,n)=>e+n.maximumSize,0)}get startSnappingEnabled(){return this._startSnappingEnabled}set startSnappingEnabled(e){this._startSnappingEnabled!==e&&(this._startSnappingEnabled=e,this.updateSashEnablement())}get endSnappingEnabled(){return this._endSnappingEnabled}set endSnappingEnabled(e){this._endSnappingEnabled!==e&&(this._endSnappingEnabled=e,this.updateSashEnablement())}get disabled(){return this._disabled}set disabled(e){this._disabled=e,Ne(this.element,"dv-splitview-disabled",e)}get margin(){return this._margin}set margin(e){this._margin=e,Ne(this.element,"dv-splitview-has-margin",e!==0)}constructor(e,n){var s,l;this.container=e,this.viewItems=[],this.sashes=[],this._size=0,this._orthogonalSize=0,this._contentSize=0,this._proportions=void 0,this._startSnappingEnabled=!0,this._endSnappingEnabled=!0,this._disabled=!1,this._margin=0,this._onDidSashEnd=new U,this.onDidSashEnd=this._onDidSashEnd.event,this._onDidAddView=new U,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new U,this.onDidRemoveView=this._onDidRemoveView.event,this.resize=(a,c,d=this.viewItems.map(A=>A.size),h,m,w=Number.NEGATIVE_INFINITY,v=Number.POSITIVE_INFINITY,S,E)=>{if(a<0||a>this.viewItems.length)return 0;const A=ts(a,-1),D=ts(a+1,this.viewItems.length);if(m)for(const j of m)jd(A,j),jd(D,j);if(h)for(const j of h)_u(A,j),_u(D,j);const P=A.map(j=>this.viewItems[j]),R=A.map(j=>d[j]),O=D.map(j=>this.viewItems[j]),M=D.map(j=>d[j]),N=A.reduce((j,te)=>j+this.viewItems[te].minimumSize-d[te],0),Z=A.reduce((j,te)=>j+this.viewItems[te].maximumSize-d[te],0),G=D.length===0?Number.POSITIVE_INFINITY:D.reduce((j,te)=>j+d[te]-this.viewItems[te].minimumSize,0),$=D.length===0?Number.NEGATIVE_INFINITY:D.reduce((j,te)=>j+d[te]-this.viewItems[te].maximumSize,0),K=Math.max(N,$),he=Math.min(G,Z);let ue=!1;if(S){const j=this.viewItems[S.index],te=c>=S.limitDelta;ue=te!==j.visible,j.setVisible(te,S.size)}if(!ue&&E){const j=this.viewItems[E.index],te=c{const d=a.visible===void 0||a.visible?a.size:{type:"invisible",cachedVisibleSize:a.size},h=a.view;this.addView(h,d,c,!0)}),this._contentSize=this.viewItems.reduce((a,c)=>a+c.size,0),this.saveProportions())}style(e){(e==null?void 0:e.separatorBorder)==="transparent"?(Zl(this.element,"dv-separator-border"),this.element.style.removeProperty("--dv-separator-border")):(tc(this.element,"dv-separator-border"),e!=null&&e.separatorBorder&&this.element.style.setProperty("--dv-separator-border",e.separatorBorder))}isViewVisible(e){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");return this.viewItems[e].visible}setViewVisible(e,n){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");const s=this.viewItems[e];s.setVisible(n,s.size),this.distributeEmptySpace(e),this.layoutViews(),this.saveProportions()}getViewSize(e){return e<0||e>=this.viewItems.length?-1:this.viewItems[e].size}resizeView(e,n){if(e<0||e>=this.viewItems.length)return;const s=ts(this.viewItems.length).filter(d=>d!==e),l=[...s.filter(d=>this.viewItems[d].priority===on.Low),e],a=s.filter(d=>this.viewItems[d].priority===on.High),c=this.viewItems[e];n=Math.round(n),n=_t(n,c.minimumSize,Math.min(c.maximumSize,this._size)),c.size=n,this.relayout(l,a)}getViews(){return this.viewItems.map(e=>e.view)}onDidChange(e,n){const s=this.viewItems.indexOf(e);if(s<0||s>=this.viewItems.length)return;n=typeof n=="number"?n:e.size,n=_t(n,e.minimumSize,e.maximumSize),e.size=n;const l=ts(this.viewItems.length).filter(d=>d!==s),a=[...l.filter(d=>this.viewItems[d].priority===on.Low),s],c=l.filter(d=>this.viewItems[d].priority===on.High);this.relayout([...a,s],c)}addView(e,n={type:"distribute"},s=this.viewItems.length,l){const a=document.createElement("div");a.className="dv-view",a.appendChild(e.element);let c;typeof n=="number"?c=n:n.type==="split"?c=this.getViewSize(n.index)/2:n.type==="invisible"?c={cachedVisibleSize:n.cachedVisibleSize}:c=e.minimumSize;const d=e.onDidChange(m=>this.onDidChange(h,m.size)),h=new Oy(a,e,c,{dispose:()=>{d.dispose(),this.viewContainer.removeChild(a)}});if(s===this.viewItems.length?this.viewContainer.appendChild(a):this.viewContainer.insertBefore(a,this.viewContainer.children.item(s)),this.viewItems.splice(s,0,h),this.viewItems.length>1){const m=document.createElement("div");m.className="dv-sash";const w=S=>{for(const j of this.viewItems)j.enabled=!1;const E=Hu(),A=this._orientation===ze.HORIZONTAL?S.clientX:S.clientY,D=ky(this.sashes,j=>j.container===m),P=this.viewItems.map(j=>j.size);let R,O;const M=ts(D,-1),N=ts(D+1,this.viewItems.length),Z=M.reduce((j,te)=>j+(this.viewItems[te].minimumSize-P[te]),0),G=M.reduce((j,te)=>j+(this.viewItems[te].viewMaximumSize-P[te]),0),$=N.length===0?Number.POSITIVE_INFINITY:N.reduce((j,te)=>j+(P[te]-this.viewItems[te].minimumSize),0),K=N.length===0?Number.NEGATIVE_INFINITY:N.reduce((j,te)=>j+(P[te]-this.viewItems[te].viewMaximumSize),0),he=Math.max(Z,K),ue=Math.min($,G),Q=this.findFirstSnapIndex(M),ve=this.findFirstSnapIndex(N);if(typeof Q=="number"){const j=this.viewItems[Q],te=Math.floor(j.viewMinimumSize/2);R={index:Q,limitDelta:j.visible?he-te:he+te,size:j.size}}if(typeof ve=="number"){const j=this.viewItems[ve],te=Math.floor(j.viewMinimumSize/2);O={index:ve,limitDelta:j.visible?ue+te:ue-te,size:j.size}}const ie=j=>{const X=(this._orientation===ze.HORIZONTAL?j.clientX:j.clientY)-A;this.resize(D,X,P,void 0,void 0,he,ue,R,O),this.distributeEmptySpace(),this.layoutViews()},ce=()=>{for(const j of this.viewItems)j.enabled=!0;E.release(),this.saveProportions(),document.removeEventListener("pointermove",ie),document.removeEventListener("pointerup",ce),document.removeEventListener("pointercancel",ce),document.removeEventListener("contextmenu",ce),this._onDidSashEnd.fire(void 0)};document.addEventListener("pointermove",ie),document.addEventListener("pointerup",ce),document.addEventListener("pointercancel",ce),document.addEventListener("contextmenu",ce)};m.addEventListener("pointerdown",w);const v={container:m,disposable:()=>{m.removeEventListener("pointerdown",w),this.sashContainer.removeChild(m)}};this.sashContainer.appendChild(m),this.sashes.push(v)}l||this.relayout([s]),!l&&typeof n!="number"&&n.type==="distribute"&&this.distributeViewSizes(),this._onDidAddView.fire(e)}distributeViewSizes(){const e=[];let n=0;for(const d of this.viewItems)d.maximumSize-d.minimumSize>0&&(e.push(d),n+=d.size);const s=Math.floor(n/e.length);for(const d of e)d.size=_t(s,d.minimumSize,d.maximumSize);const l=ts(this.viewItems.length),a=l.filter(d=>this.viewItems[d].priority===on.Low),c=l.filter(d=>this.viewItems[d].priority===on.High);this.relayout(a,c)}removeView(e,n,s=!1){const l=this.viewItems.splice(e,1)[0];if(l.dispose(),this.viewItems.length>=1){const a=Math.max(e-1,0);this.sashes.splice(a,1)[0].disposable()}return s||this.relayout(),n&&n.type==="distribute"&&this.distributeViewSizes(),this._onDidRemoveView.fire(l.view),l.view}getViewCachedVisibleSize(e){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");return this.viewItems[e].cachedVisibleSize}moveView(e,n){const s=this.getViewCachedVisibleSize(e),l=typeof s>"u"?this.getViewSize(e):$i.Invisible(s),a=this.removeView(e,void 0,!0);this.addView(a,l,n)}layout(e,n){const s=Math.max(this.size,this._contentSize);if(this.size=e,this.orthogonalSize=n,this.proportions){let l=0;for(let a=0;a0&&(c.size=_t(Math.round(d*e/l),c.minimumSize,c.maximumSize))}}else{const l=ts(this.viewItems.length),a=l.filter(d=>this.viewItems[d].priority===on.Low),c=l.filter(d=>this.viewItems[d].priority===on.High);this.resize(this.viewItems.length-1,e-s,void 0,a,c)}this.distributeEmptySpace(),this.layoutViews()}relayout(e,n){const s=this.viewItems.reduce((l,a)=>l+a.size,0);this.resize(this.viewItems.length-1,this._size-s,void 0,e,n),this.distributeEmptySpace(),this.layoutViews(),this.saveProportions()}distributeEmptySpace(e){const n=this.viewItems.reduce((d,h)=>d+h.size,0);let s=this.size-n;const l=ts(this.viewItems.length-1,-1),a=l.filter(d=>this.viewItems[d].priority===on.Low),c=l.filter(d=>this.viewItems[d].priority===on.High);for(const d of c)jd(l,d);for(const d of a)_u(l,d);typeof e=="number"&&_u(l,e);for(let d=0;s!==0&&d0&&(this._proportions=this.viewItems.map(e=>e.visible?e.size/this._contentSize:void 0))}layoutViews(){if(this._contentSize=this.viewItems.reduce((h,m)=>h+m.size,0),this.updateSashEnablement(),this.viewItems.length===0)return;const e=this.viewItems.filter(h=>h.visible),n=Math.max(0,e.length-1),s=this.margin*n/Math.max(1,e.length);let l=0;const a=[],c=4,d=this.viewItems.reduce((h,m,w)=>{const v=m.visible?1:0;return w===0?h.push(v):h.push(h[w-1]+v),h},[]);this.viewItems.forEach((h,m)=>{l+=this.viewItems[m].size,a.push(l);const w=h.visible?h.size-s:0,v=Math.max(0,d[m]-1),S=m===0||v===0?0:a[m-1]+v/n*s;if(m0)return;if(!s.visible&&s.snap)return n}}updateSashEnablement(){let e=!1;const n=this.viewItems.map(h=>e=h.size-h.minimumSize>0||e);e=!1;const s=this.viewItems.map(h=>e=h.maximumSize-h.size>0||e),l=[...this.viewItems].reverse();e=!1;const a=l.map(h=>e=h.size-h.minimumSize>0||e).reverse();e=!1;const c=l.map(h=>e=h.maximumSize-h.size>0||e).reverse();let d=0;for(let h=0;h0||this.startSnappingEnabled)?this.updateSash(m,ji.MINIMUM):O&&n[h]&&(d{const a=new Re(l.onDidChangeExpansionState(()=>{this.setupAnimation(),this._onDidChange.fire(void 0)})),c={pane:l,disposable:{dispose:()=>{a.dispose()}}};this.paneItems.push(c),l.orthogonalSize=this.splitview.orthogonalSize}),this.addDisposables(this._onDidChange,this.splitview.onDidSashEnd(()=>{this._onDidChange.fire(void 0)}),this.splitview.onDidAddView(()=>{this._onDidChange.fire()}),this.splitview.onDidRemoveView(()=>{this._onDidChange.fire()}))}setViewVisible(e,n){this.splitview.setViewVisible(e,n)}addPane(e,n,s=this.splitview.length,l=!1){const a=e.onDidChangeExpansionState(()=>{this.setupAnimation(),this._onDidChange.fire(void 0)}),c={pane:e,disposable:{dispose:()=>{a.dispose()}}};this.paneItems.splice(s,0,c),e.orthogonalSize=this.splitview.orthogonalSize,this.splitview.addView(e,n,s,l)}getViewSize(e){return this.splitview.getViewSize(e)}getPanes(){return this.splitview.getViews()}removePane(e,n={skipDispose:!1}){const s=this.paneItems.splice(e,1)[0];return this.splitview.removeView(e),n.skipDispose||(s.disposable.dispose(),s.pane.dispose()),s}moveView(e,n){if(e===n)return;const s=this.removePane(e,{skipDispose:!0});this.skipAnimation=!0;try{this.addPane(s.pane,s.pane.size,n,!1)}finally{this.skipAnimation=!1}}layout(e,n){this.splitview.layout(e,n)}setupAnimation(){this.skipAnimation||(this.animationTimer&&(clearTimeout(this.animationTimer),this.animationTimer=void 0),tc(this.element,"dv-animated"),this.animationTimer=setTimeout(()=>{this.animationTimer=void 0,Zl(this.element,"dv-animated")},200))}dispose(){super.dispose(),this.animationTimer&&(clearTimeout(this.animationTimer),this.animationTimer=void 0),this.paneItems.forEach(e=>{e.disposable.dispose(),e.pane.dispose()}),this.paneItems=[],this.splitview.dispose(),this.element.remove()}}class Sn{get minimumWidth(){return this.view.minimumWidth}get maximumWidth(){return this.view.maximumWidth}get minimumHeight(){return this.view.minimumHeight}get maximumHeight(){return this.view.maximumHeight}get priority(){return this.view.priority}get snap(){return this.view.snap}get minimumSize(){return this.orientation===ze.HORIZONTAL?this.minimumHeight:this.minimumWidth}get maximumSize(){return this.orientation===ze.HORIZONTAL?this.maximumHeight:this.maximumWidth}get minimumOrthogonalSize(){return this.orientation===ze.HORIZONTAL?this.minimumWidth:this.minimumHeight}get maximumOrthogonalSize(){return this.orientation===ze.HORIZONTAL?this.maximumWidth:this.maximumHeight}get orthogonalSize(){return this._orthogonalSize}get size(){return this._size}get element(){return this.view.element}get width(){return this.orientation===ze.HORIZONTAL?this.orthogonalSize:this.size}get height(){return this.orientation===ze.HORIZONTAL?this.size:this.orthogonalSize}constructor(e,n,s,l=0){this.view=e,this.orientation=n,this._onDidChange=new U,this.onDidChange=this._onDidChange.event,this._orthogonalSize=s,this._size=l,this._disposable=this.view.onDidChange(a=>{a?this._onDidChange.fire({size:this.orientation===ze.VERTICAL?a.width:a.height,orthogonalSize:this.orientation===ze.VERTICAL?a.height:a.width}):this._onDidChange.fire({})})}setVisible(e){this.view.setVisible&&this.view.setVisible(e)}layout(e,n){this._size=e,this._orthogonalSize=n,this.view.layout(this.width,this.height)}dispose(){this._onDidChange.dispose(),this._disposable.dispose()}}class Nt extends Re{get width(){return this.orientation===ze.HORIZONTAL?this.size:this.orthogonalSize}get height(){return this.orientation===ze.HORIZONTAL?this.orthogonalSize:this.size}get minimumSize(){return this.children.length===0?0:Math.max(...this.children.map((e,n)=>this.splitview.isViewVisible(n)?e.minimumOrthogonalSize:0))}get maximumSize(){return Math.min(...this.children.map((e,n)=>this.splitview.isViewVisible(n)?e.maximumOrthogonalSize:Number.POSITIVE_INFINITY))}get minimumOrthogonalSize(){return this.splitview.minimumSize}get maximumOrthogonalSize(){return this.splitview.maximumSize}get orthogonalSize(){return this._orthogonalSize}get size(){return this._size}get minimumWidth(){return this.orientation===ze.HORIZONTAL?this.minimumOrthogonalSize:this.minimumSize}get minimumHeight(){return this.orientation===ze.HORIZONTAL?this.minimumSize:this.minimumOrthogonalSize}get maximumWidth(){return this.orientation===ze.HORIZONTAL?this.maximumOrthogonalSize:this.maximumSize}get maximumHeight(){return this.orientation===ze.HORIZONTAL?this.maximumSize:this.maximumOrthogonalSize}get priority(){if(this.children.length===0)return on.Normal;const e=this.children.map(n=>typeof n.priority>"u"?on.Normal:n.priority);return e.some(n=>n===on.High)?on.High:e.some(n=>n===on.Low)?on.Low:on.Normal}get disabled(){return this.splitview.disabled}set disabled(e){this.splitview.disabled=e}get margin(){return this.splitview.margin}set margin(e){this.splitview.margin=e,this.children.forEach(n=>{n instanceof Nt&&(n.margin=e)})}constructor(e,n,s,l,a,c,d,h){if(super(),this.orientation=e,this.proportionalLayout=n,this.styles=s,this._childrenDisposable=Qt.NONE,this.children=[],this._onDidChange=new U,this.onDidChange=this._onDidChange.event,this._onDidVisibilityChange=new U,this.onDidVisibilityChange=this._onDidVisibilityChange.event,this._orthogonalSize=a,this._size=l,this.element=document.createElement("div"),this.element.className="dv-branch-node",!h)this.splitview=new Xl(this.element,{orientation:this.orientation,proportionalLayout:n,styles:s,margin:d}),this.splitview.layout(this.size,this.orthogonalSize);else{const m={views:h.map(w=>({view:w.node,size:w.node.size,visible:w.node instanceof Sn&&w.visible!==void 0?w.visible:!0})),size:this.orthogonalSize};this.children=h.map(w=>w.node),this.splitview=new Xl(this.element,{orientation:this.orientation,descriptor:m,proportionalLayout:n,styles:s,margin:d})}this.disabled=c,this.addDisposables(this._onDidChange,this._onDidVisibilityChange,this.splitview.onDidSashEnd(()=>{this._onDidChange.fire({})})),this.setupChildrenEvents()}setVisible(e){}isChildVisible(e){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.isViewVisible(e)}setChildVisible(e,n){if(e<0||e>=this.children.length)throw new Error("Invalid index");if(this.splitview.isViewVisible(e)===n)return;const s=this.splitview.contentSize===0;this.splitview.setViewVisible(e,n);const l=this.splitview.contentSize===0;(n&&s||!n&&l)&&this._onDidVisibilityChange.fire({visible:n})}moveChild(e,n){if(e===n)return;if(e<0||e>=this.children.length)throw new Error("Invalid from index");e=this.children.length)throw new Error("Invalid index");return this.splitview.getViewSize(e)}resizeChild(e,n){if(e<0||e>=this.children.length)throw new Error("Invalid index");this.splitview.resizeView(e,n)}layout(e,n){this._size=n,this._orthogonalSize=e,this.splitview.layout(n,e)}addChild(e,n,s,l){if(s<0||s>this.children.length)throw new Error("Invalid index");this.splitview.addView(e,n,s,l),this._addChild(e,s)}getChildCachedVisibleSize(e){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.getViewCachedVisibleSize(e)}removeChild(e,n){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.removeView(e,n),this._removeChild(e)}_addChild(e,n){this.children.splice(n,0,e),this.setupChildrenEvents()}_removeChild(e){const[n]=this.children.splice(e,1);return this.setupChildrenEvents(),n}setupChildrenEvents(){this._childrenDisposable.dispose(),this._childrenDisposable=new Re(Jr.any(...this.children.map(e=>e.onDidChange))(e=>{this._onDidChange.fire({size:e.orthogonalSize})}),...this.children.map((e,n)=>e instanceof Nt?e.onDidVisibilityChange(({visible:s})=>{this.setChildVisible(n,s)}):Qt.NONE))}dispose(){this._childrenDisposable.dispose(),this.splitview.dispose(),this.children.forEach(e=>e.dispose()),super.dispose()}}function hh(r,e){if(r instanceof Sn)return r;if(r instanceof Nt)return hh(r.children[e?r.children.length-1:0],e);throw new Error("invalid node")}function hv(r,e,n){if(r instanceof Nt){const s=new Nt(r.orientation,r.proportionalLayout,r.styles,e,n,r.disabled,r.margin);for(let l=r.children.length-1;l>=0;l--){const a=r.children[l];s.addChild(hv(a,a.size,a.orthogonalSize),a.size,0,!0)}return s}else return new Sn(r.view,r.orientation,n)}function fh(r,e,n){if(r instanceof Nt){const s=new Nt(Ss(r.orientation),r.proportionalLayout,r.styles,e,n,r.disabled,r.margin);let l=0;for(let a=r.children.length-1;a>=0;a--){const c=r.children[a],d=c instanceof Nt?c.orthogonalSize:c.size;let h=r.size===0?0:Math.round(e*d/r.size);l+=h,a===0&&(h+=e-l),s.addChild(fh(c,n,h),h,0,!0)}return s}else return new Sn(r.view,Ss(r.orientation),n)}function Ty(r){const e=r.parentElement;if(!e)throw new Error("Invalid grid element");let n=e.firstElementChild,s=0;for(;n!==r&&n!==e.lastElementChild&&n;)n=n.nextElementSibling,s++;return s}function zt(r){const e=r.parentElement;if(!e)throw new Error("Invalid grid element");if(/\bdv-grid-view\b/.test(e.className))return[];const n=Ty(e),s=e.parentElement.parentElement.parentElement;return[...zt(s),n]}function _s(r,e,n){const s=Ny(r,e),l=Iy(n);if(s===l){const[a,c]=Ms(e);let d=c;return(n==="right"||n==="bottom")&&(d+=1),[...a,d]}else{const a=n==="right"||n==="bottom"?1:0;return[...e,a]}}function Iy(r){return r==="top"||r==="bottom"?ze.VERTICAL:ze.HORIZONTAL}function Ny(r,e){return e.length%2===0?Ss(r):r}const Ss=r=>r===ze.HORIZONTAL?ze.VERTICAL:ze.HORIZONTAL;function Ry(r){return!!r.children}const ph=(r,e)=>{const n=e===ze.VERTICAL?r.box.width:r.box.height;return Ry(r)?{type:"branch",data:r.children.map(s=>ph(s,Ss(e))),size:n}:typeof r.cachedVisibleSize=="number"?{type:"leaf",data:r.view.toJSON(),size:r.cachedVisibleSize,visible:!1}:{type:"leaf",data:r.view.toJSON(),size:n}};class My{get length(){return this._root?this._root.children.length:0}get orientation(){return this.root.orientation}set orientation(e){if(this.root.orientation===e)return;const{size:n,orthogonalSize:s}=this.root;this.root=fh(this.root,s,n),this.root.layout(n,s)}get width(){return this.root.width}get height(){return this.root.height}get minimumWidth(){return this.root.minimumWidth}get minimumHeight(){return this.root.minimumHeight}get maximumWidth(){return this.root.maximumHeight}get maximumHeight(){return this.root.maximumHeight}get locked(){return this._locked}set locked(e){this._locked=e;const n=[this.root];for(;n.length>0;){const s=n.pop();s instanceof Nt&&(s.disabled=e,n.push(...s.children))}}get margin(){return this._margin}set margin(e){this._margin=e,this.root.margin=e}maximizedView(){var e;return(e=this._maximizedNode)===null||e===void 0?void 0:e.leaf.view}hasMaximizedView(){return this._maximizedNode!==void 0}maximizeView(e){var n;const s=zt(e.element),[l,a]=this.getNode(s);if(!(a instanceof Sn)||((n=this._maximizedNode)===null||n===void 0?void 0:n.leaf)===a)return;this.hasMaximizedView()&&this.exitMaximizedView(),ph(this.getView(),this.orientation);const c=[];function d(h,m){for(let w=0;w=0;a--){const c=l.children[a];c instanceof Sn?e.includes(c)||l.setChildVisible(a,!0):n(c)}}n(this.root);const s=this._maximizedNode.leaf;this._maximizedNode=void 0,this._onDidMaximizedNodeChange.fire({view:s.view,isMaximized:!1})}serialize(){const e=this.maximizedView();let n;e&&(n=zt(e.element)),this.hasMaximizedView()&&this.exitMaximizedView();const l={root:ph(this.getView(),this.orientation),width:this.width,height:this.height,orientation:this.orientation};return n&&(l.maximizedNode={location:n}),e&&this.maximizeView(e),l}dispose(){this.disposable.dispose(),this._onDidChange.dispose(),this._onDidMaximizedNodeChange.dispose(),this._onDidViewVisibilityChange.dispose(),this.root.dispose(),this._maximizedNode=void 0,this.element.remove()}clear(){const e=this.root.orientation;this.root=new Nt(e,this.proportionalLayout,this.styles,this.root.size,this.root.orthogonalSize,this.locked,this.margin)}deserialize(e,n){const s=e.orientation,l=s===ze.VERTICAL?e.height:e.width;if(this._deserialize(e.root,s,n,l),this.layout(e.width,e.height),e.maximizedNode){const a=e.maximizedNode.location,[c,d]=this.getNode(a);if(!(d instanceof Sn))return;this.maximizeView(d.view)}}_deserialize(e,n,s,l){this.root=this._deserializeNode(e,n,s,l)}_deserializeNode(e,n,s,l){var a;let c;if(e.type==="branch"){const h=e.data.map(m=>({node:this._deserializeNode(m,Ss(n),s,e.size),visible:m.visible}));c=new Nt(n,this.proportionalLayout,this.styles,e.size,l,this.locked,this.margin,h)}else{const d=s.fromJSON(e);typeof e.visible=="boolean"&&((a=d.setVisible)===null||a===void 0||a.call(d,e.visible)),c=new Sn(d,n,l,e.size)}return c}get root(){return this._root}set root(e){const n=this._root;n&&(n.dispose(),this._maximizedNode=void 0,this.element.removeChild(n.element)),this._root=e,this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange(s=>{this._onDidChange.fire(s)})}normalize(){if(!this._root||this._root.children.length!==1)return;const e=this.root,n=e.children[0];if(n instanceof Sn)return;e.element.remove();const s=e.removeChild(0);e.dispose(),s.dispose(),this._root=hv(n,n.size,n.orthogonalSize),this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange(l=>{this._onDidChange.fire(l)})}insertOrthogonalSplitviewAtRoot(){if(!this._root)return;const e=this.root;if(e.element.remove(),this._root=new Nt(Ss(e.orientation),this.proportionalLayout,this.styles,this.root.orthogonalSize,this.root.size,this.locked,this.margin),e.children.length!==0)if(e.children.length===1){const n=e.children[0];e.removeChild(0).dispose(),e.dispose(),this._root.addChild(fh(n,n.orthogonalSize,n.size),$i.Distribute,0)}else this._root.addChild(e,$i.Distribute,0);this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange(n=>{this._onDidChange.fire(n)})}next(e){return this.progmaticSelect(e)}previous(e){return this.progmaticSelect(e,!0)}getView(e){const n=e?this.getNode(e)[1]:this.root;return this._getViews(n,this.orientation)}_getViews(e,n,s){const l={height:e.height,width:e.width};if(e instanceof Sn)return{box:l,view:e.view,cachedVisibleSize:s};const a=[];for(let c=0;c-1;a--){const c=s[a],d=e[a]||0;if(n?d-1>-1:d+1m.getChildSize(P));if(m.removeChild(v,n).dispose(),h instanceof Nt){A.splice(v,1,...h.children.map(D=>D.size));for(let D=0;D0;)h.removeChild(0)}else{const D=new Sn(h.view,Ss(h.orientation),h.size),P=E?h.orthogonalSize:$i.Invisible(h.orthogonalSize);m.addChild(D,P,v)}h.dispose();for(let D=0;D=n.children.length)throw new Error("Invalid location");const c=n.children[l];return s.push(n),this.getNode(a,c,s)}}const mh=Object.keys({disableAutoResizing:void 0,proportionalLayout:void 0,orientation:void 0,hideBorders:void 0,className:void 0});class Fh extends Re{get element(){return this._element}get disableResizing(){return this._disableResizing}set disableResizing(e){this._disableResizing=e}constructor(e,n=!1){super(),this._disableResizing=n,this._element=e,this.addDisposables(ec(this._element,s=>{if(this.isDisposed||this.disableResizing||!this._element.offsetParent||!Sy(this._element))return;const{width:l,height:a}=s.contentRect;this.layout(l,a)}))}}const Ly=Wh();function ju(r){switch(r){case"left":return"left";case"right":return"right";case"above":return"top";case"below":return"bottom";case"within":default:return"center"}}class fv extends Fh{get id(){return this._id}get size(){return this._groups.size}get groups(){return Array.from(this._groups.values()).map(e=>e.value)}get width(){return this.gridview.width}get height(){return this.gridview.height}get minimumHeight(){return this.gridview.minimumHeight}get maximumHeight(){return this.gridview.maximumHeight}get minimumWidth(){return this.gridview.minimumWidth}get maximumWidth(){return this.gridview.maximumWidth}get activeGroup(){return this._activeGroup}get locked(){return this.gridview.locked}set locked(e){this.gridview.locked=e}constructor(e,n){var s;super(document.createElement("div"),n.disableAutoResizing),this._id=Ly.next(),this._groups=new Map,this._onDidRemove=new U,this.onDidRemove=this._onDidRemove.event,this._onDidAdd=new U,this.onDidAdd=this._onDidAdd.event,this._onDidMaximizedChange=new U,this.onDidMaximizedChange=this._onDidMaximizedChange.event,this._onDidActiveChange=new U,this.onDidActiveChange=this._onDidActiveChange.event,this._bufferOnDidLayoutChange=new bm,this.onDidLayoutChange=this._bufferOnDidLayoutChange.onEvent,this._onDidViewVisibilityChangeMicroTaskQueue=new bm,this.onDidViewVisibilityChangeMicroTaskQueue=this._onDidViewVisibilityChangeMicroTaskQueue.onEvent,this.element.style.height="100%",this.element.style.width="100%",this._classNames=new nc(this.element),this._classNames.setClassNames((s=n.className)!==null&&s!==void 0?s:""),e.appendChild(this.element),this.gridview=new My(!!n.proportionalLayout,n.styles,n.orientation,n.locked,n.margin),this.gridview.locked=!!n.locked,this.element.appendChild(this.gridview.element),this.layout(0,0,!0),this.addDisposables(this.gridview.onDidMaximizedNodeChange(l=>{this._onDidMaximizedChange.fire({panel:l.view,isMaximized:l.isMaximized})}),this.gridview.onDidViewVisibilityChange(()=>this._onDidViewVisibilityChangeMicroTaskQueue.fire()),this.onDidViewVisibilityChangeMicroTaskQueue(()=>{this.layout(this.width,this.height,!0)}),Qt.from(()=>{var l;(l=this.element.parentElement)===null||l===void 0||l.removeChild(this.element)}),this.gridview.onDidChange(()=>{this._bufferOnDidLayoutChange.fire()}),Jr.any(this.onDidAdd,this.onDidRemove,this.onDidActiveChange)(()=>{this._bufferOnDidLayoutChange.fire()}),this._onDidMaximizedChange,this._onDidViewVisibilityChangeMicroTaskQueue,this._bufferOnDidLayoutChange)}setVisible(e,n){this.gridview.setViewVisible(zt(e.element),n),this._bufferOnDidLayoutChange.fire()}isVisible(e){return this.gridview.isViewVisible(zt(e.element))}updateOptions(e){var n,s,l,a;e.proportionalLayout,e.orientation&&(this.gridview.orientation=e.orientation),"disableResizing"in e&&(this.disableResizing=(n=e.disableAutoResizing)!==null&&n!==void 0?n:!1),"locked"in e&&(this.locked=(s=e.locked)!==null&&s!==void 0?s:!1),"margin"in e&&(this.gridview.margin=(l=e.margin)!==null&&l!==void 0?l:0),"className"in e&&this._classNames.setClassNames((a=e.className)!==null&&a!==void 0?a:"")}maximizeGroup(e){this.gridview.maximizeView(e),this.doSetGroupActive(e)}isMaximizedGroup(e){return this.gridview.maximizedView()===e}exitMaximizedGroup(){this.gridview.exitMaximizedView()}hasMaximizedGroup(){return this.gridview.hasMaximizedView()}doAddGroup(e,n=[0],s){this.gridview.addView(e,s??$i.Distribute,n),this._onDidAdd.fire(e)}doRemoveGroup(e,n){if(!this._groups.has(e.id))throw new Error("invalid operation");const s=this._groups.get(e.id),l=this.gridview.remove(e,$i.Distribute);if(s&&!(n!=null&&n.skipDispose)&&(s.disposable.dispose(),s.value.dispose(),this._groups.delete(e.id),this._onDidRemove.fire(e)),!(n!=null&&n.skipActive)&&this._activeGroup===e){const a=Array.from(this._groups.values());this.doSetGroupActive(a.length>0?a[0].value:void 0)}return l}getPanel(e){var n;return(n=this._groups.get(e))===null||n===void 0?void 0:n.value}doSetGroupActive(e){this._activeGroup!==e&&(this._activeGroup&&this._activeGroup.setActive(!1),e&&e.setActive(!0),this._activeGroup=e,this._onDidActiveChange.fire(e))}removeGroup(e){this.doRemoveGroup(e)}moveToNext(e){var n;if(e||(e={}),!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}const s=zt(e.group.element),l=(n=this.gridview.next(s))===null||n===void 0?void 0:n.view;this.doSetGroupActive(l)}moveToPrevious(e){var n;if(e||(e={}),!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}const s=zt(e.group.element),l=(n=this.gridview.previous(s))===null||n===void 0?void 0:n.view;this.doSetGroupActive(l)}layout(e,n,s){(s||e!==this.width||n!==this.height)&&(this.gridview.element.style.height=`${n}px`,this.gridview.element.style.width=`${e}px`,this.gridview.layout(e,n))}dispose(){this._onDidActiveChange.dispose(),this._onDidAdd.dispose(),this._onDidRemove.dispose();for(const e of this.groups)e.dispose();this.gridview.dispose(),super.dispose()}}class pv{get minimumSize(){return this.component.minimumSize}get maximumSize(){return this.component.maximumSize}get width(){return this.component.width}get height(){return this.component.height}get length(){return this.component.length}get orientation(){return this.component.orientation}get panels(){return this.component.panels}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidAddView(){return this.component.onDidAddView}get onDidRemoveView(){return this.component.onDidRemoveView}constructor(e){this.component=e}removePanel(e,n){this.component.removePanel(e,n)}focus(){this.component.focus()}getPanel(e){return this.component.getPanel(e)}layout(e,n){return this.component.layout(e,n)}addPanel(e){return this.component.addPanel(e)}movePanel(e,n){this.component.movePanel(e,n)}fromJSON(e){this.component.fromJSON(e)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}}class ql{get minimumSize(){return this.component.minimumSize}get maximumSize(){return this.component.maximumSize}get width(){return this.component.width}get height(){return this.component.height}get panels(){return this.component.panels}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get onDidAddView(){return this.component.onDidAddView}get onDidRemoveView(){return this.component.onDidRemoveView}get onDidDrop(){return this.component.onDidDrop}get onUnhandledDragOverEvent(){return this.component.onUnhandledDragOverEvent}constructor(e){this.component=e}removePanel(e){this.component.removePanel(e)}getPanel(e){return this.component.getPanel(e)}movePanel(e,n){this.component.movePanel(e,n)}focus(){this.component.focus()}layout(e,n){this.component.layout(e,n)}addPanel(e){return this.component.addPanel(e)}fromJSON(e){this.component.fromJSON(e)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}}class mv{get width(){return this.component.width}get height(){return this.component.height}get minimumHeight(){return this.component.minimumHeight}get maximumHeight(){return this.component.maximumHeight}get minimumWidth(){return this.component.minimumWidth}get maximumWidth(){return this.component.maximumWidth}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidAddPanel(){return this.component.onDidAddGroup}get onDidRemovePanel(){return this.component.onDidRemoveGroup}get onDidActivePanelChange(){return this.component.onDidActiveGroupChange}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get panels(){return this.component.groups}get orientation(){return this.component.orientation}set orientation(e){this.component.updateOptions({orientation:e})}constructor(e){this.component=e}focus(){this.component.focus()}layout(e,n,s=!1){this.component.layout(e,n,s)}addPanel(e){return this.component.addPanel(e)}removePanel(e,n){this.component.removePanel(e,n)}movePanel(e,n){this.component.movePanel(e,n)}getPanel(e){return this.component.getPanel(e)}fromJSON(e){return this.component.fromJSON(e)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}}class Bu{get id(){return this.component.id}get width(){return this.component.width}get height(){return this.component.height}get minimumHeight(){return this.component.minimumHeight}get maximumHeight(){return this.component.maximumHeight}get minimumWidth(){return this.component.minimumWidth}get maximumWidth(){return this.component.maximumWidth}get size(){return this.component.size}get totalPanels(){return this.component.totalPanels}get onDidActiveGroupChange(){return this.component.onDidActiveGroupChange}get onDidAddGroup(){return this.component.onDidAddGroup}get onDidRemoveGroup(){return this.component.onDidRemoveGroup}get onDidActivePanelChange(){return this.component.onDidActivePanelChange}get onDidAddPanel(){return this.component.onDidAddPanel}get onDidRemovePanel(){return this.component.onDidRemovePanel}get onDidMovePanel(){return this.component.onDidMovePanel}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidDrop(){return this.component.onDidDrop}get onWillDrop(){return this.component.onWillDrop}get onWillShowOverlay(){return this.component.onWillShowOverlay}get onWillDragGroup(){return this.component.onWillDragGroup}get onWillDragPanel(){return this.component.onWillDragPanel}get onUnhandledDragOverEvent(){return this.component.onUnhandledDragOverEvent}get onDidPopoutGroupSizeChange(){return this.component.onDidPopoutGroupSizeChange}get onDidPopoutGroupPositionChange(){return this.component.onDidPopoutGroupPositionChange}get onDidOpenPopoutWindowFail(){return this.component.onDidOpenPopoutWindowFail}get panels(){return this.component.panels}get groups(){return this.component.groups}get activePanel(){return this.component.activePanel}get activeGroup(){return this.component.activeGroup}constructor(e){this.component=e}focus(){this.component.focus()}getPanel(e){return this.component.getGroupPanel(e)}layout(e,n,s=!1){this.component.layout(e,n,s)}addPanel(e){return this.component.addPanel(e)}removePanel(e){this.component.removePanel(e)}addGroup(e){return this.component.addGroup(e)}closeAllGroups(){return this.component.closeAllGroups()}removeGroup(e){this.component.removeGroup(e)}getGroup(e){return this.component.getPanel(e)}addFloatingGroup(e,n){return this.component.addFloatingGroup(e,n)}fromJSON(e,n){this.component.fromJSON(e,n)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}moveToNext(e){this.component.moveToNext(e)}moveToPrevious(e){this.component.moveToPrevious(e)}maximizeGroup(e){this.component.maximizeGroup(e.group)}hasMaximizedGroup(){return this.component.hasMaximizedGroup()}exitMaximizedGroup(){this.component.exitMaximizedGroup()}get onDidMaximizedGroupChange(){return this.component.onDidMaximizedGroupChange}addPopoutGroup(e,n){return this.component.addPopoutGroup(e,n)}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}}class Hh extends Re{constructor(e,n){super(),this.el=e,this.disabled=n,this.dataDisposable=new Bn,this.pointerEventsDisposable=new Bn,this._onDragStart=new U,this.onDragStart=this._onDragStart.event,this.addDisposables(this._onDragStart,this.dataDisposable,this.pointerEventsDisposable),this.configure()}setDisabled(e){this.disabled=e}isCancelled(e){return!1}configure(){this.addDisposables(this._onDragStart,Be(this.el,"dragstart",e=>{if(e.defaultPrevented||this.isCancelled(e)||this.disabled){e.preventDefault();return}const n=Hu();this.pointerEventsDisposable.value={dispose:()=>{n.release()}},this.el.classList.add("dv-dragged"),setTimeout(()=>this.el.classList.remove("dv-dragged"),0),this.dataDisposable.value=this.getData(e),this._onDragStart.fire(e),e.dataTransfer&&(e.dataTransfer.effectAllowed="move",e.dataTransfer.items.length>0||e.dataTransfer.setData("text/plain",""))}),Be(this.el,"dragend",()=>{this.pointerEventsDisposable.dispose(),setTimeout(()=>{this.dataDisposable.dispose()},0)}))}}class gv extends Re{constructor(e,n){super(),this.element=e,this.callbacks=n,this.target=null,this.registerListeners()}onDragEnter(e){this.target=e.target,this.callbacks.onDragEnter(e)}onDragOver(e){e.preventDefault(),this.callbacks.onDragOver&&this.callbacks.onDragOver(e)}onDragLeave(e){this.target===e.target&&(this.target=null,this.callbacks.onDragLeave(e))}onDragEnd(e){this.target=null,this.callbacks.onDragEnd(e)}onDrop(e){this.callbacks.onDrop(e)}registerListeners(){this.addDisposables(Be(this.element,"dragenter",e=>{this.onDragEnter(e)},!0)),this.addDisposables(Be(this.element,"dragover",e=>{this.onDragOver(e)},!0)),this.addDisposables(Be(this.element,"dragleave",e=>{this.onDragLeave(e)})),this.addDisposables(Be(this.element,"dragend",e=>{this.onDragEnd(e)})),this.addDisposables(Be(this.element,"drop",e=>{this.onDrop(e)}))}}function Vy(r,e){const{top:n,left:s,width:l,height:a}=e,c=`${Math.round(n)}px`,d=`${Math.round(s)}px`,h=`${Math.round(l)}px`,m=`${Math.round(a)}px`;r.style.top=c,r.style.left=d,r.style.width=h,r.style.height=m,r.style.visibility="visible",(!r.style.transform||r.style.transform==="")&&(r.style.transform="translate3d(0, 0, 0)")}function Gy(r,e){const{top:n,left:s,width:l,height:a}=e;r.style.top=n,r.style.left=s,r.style.width=l,r.style.height=a,r.style.visibility="visible",(!r.style.transform||r.style.transform==="")&&(r.style.transform="translate3d(0, 0, 0)")}function Wy(r,e){const{top:n,left:s,width:l,height:a}=e,c=`${Math.round(n)}px`,d=`${Math.round(s)}px`,h=`${Math.round(l)}px`,m=`${Math.round(a)}px`;return r.style.top!==c||r.style.left!==d||r.style.width!==h||r.style.height!==m}class Fy extends Gh{get nativeEvent(){return this.options.nativeEvent}get position(){return this.options.position}constructor(e){super(),this.options=e}}function zm(r){switch(r){case"above":return"top";case"below":return"bottom";case"left":return"left";case"right":return"right";case"within":return"center";default:throw new Error(`invalid direction '${r}'`)}}function Hy(r){switch(r){case"top":return"above";case"bottom":return"below";case"left":return"left";case"right":return"right";case"center":return"within";default:throw new Error(`invalid position '${r}'`)}}const jy={value:20,type:"percentage"},By={value:50,type:"percentage"},Uy=100,$y=100;class rs extends Re{get disabled(){return this._disabled}set disabled(e){this._disabled=e}get state(){return this._state}constructor(e,n){super(),this.element=e,this.options=n,this._onDrop=new U,this.onDrop=this._onDrop.event,this._onWillShowOverlay=new U,this.onWillShowOverlay=this._onWillShowOverlay.event,this._disabled=!1,this._acceptedTargetZonesSet=new Set(this.options.acceptedTargetZones),this.dnd=new gv(this.element,{onDragEnter:()=>{var s,l,a;(a=(l=(s=this.options).getOverrideTarget)===null||l===void 0?void 0:l.call(s))===null||a===void 0||a.getElements()},onDragOver:s=>{var l,a,c,d,h,m,w;rs.ACTUAL_TARGET=this;const v=(a=(l=this.options).getOverrideTarget)===null||a===void 0?void 0:a.call(l);if(this._acceptedTargetZonesSet.size===0){if(v)return;this.removeDropTarget();return}const S=(h=(d=(c=this.options).getOverlayOutline)===null||d===void 0?void 0:d.call(c))!==null&&h!==void 0?h:this.element,E=S.offsetWidth,A=S.offsetHeight;if(E===0||A===0)return;const D=s.currentTarget.getBoundingClientRect(),P=((m=s.clientX)!==null&&m!==void 0?m:0)-D.left,R=((w=s.clientY)!==null&&w!==void 0?w:0)-D.top,O=this.calculateQuadrant(this._acceptedTargetZonesSet,P,R,E,A);if(this.isAlreadyUsed(s)||O===null){this.removeDropTarget();return}if(!this.options.canDisplayOverlay(s,O)){if(v)return;this.removeDropTarget();return}const M=new Fy({nativeEvent:s,position:O});if(this._onWillShowOverlay.fire(M),M.defaultPrevented){this.removeDropTarget();return}this.markAsUsed(s),v||this.targetElement||(this.targetElement=document.createElement("div"),this.targetElement.className="dv-drop-target-dropzone",this.overlayElement=document.createElement("div"),this.overlayElement.className="dv-drop-target-selection",this._state="center",this.targetElement.appendChild(this.overlayElement),S.classList.add("dv-drop-target"),S.append(this.targetElement)),this.toggleClasses(O,E,A),this._state=O},onDragLeave:()=>{var s,l;!((l=(s=this.options).getOverrideTarget)===null||l===void 0)&&l.call(s)||this.removeDropTarget()},onDragEnd:s=>{var l,a;const c=(a=(l=this.options).getOverrideTarget)===null||a===void 0?void 0:a.call(l);c&&rs.ACTUAL_TARGET===this&&this._state&&(s.stopPropagation(),this._onDrop.fire({position:this._state,nativeEvent:s})),this.removeDropTarget(),c==null||c.clear()},onDrop:s=>{var l,a,c;s.preventDefault();const d=this._state;this.removeDropTarget(),(c=(a=(l=this.options).getOverrideTarget)===null||a===void 0?void 0:a.call(l))===null||c===void 0||c.clear(),d&&(s.stopPropagation(),this._onDrop.fire({position:d,nativeEvent:s}))}}),this.addDisposables(this._onDrop,this._onWillShowOverlay,this.dnd)}setTargetZones(e){this._acceptedTargetZonesSet=new Set(e)}setOverlayModel(e){this.options.overlayModel=e}dispose(){this.removeDropTarget(),super.dispose()}markAsUsed(e){e[rs.USED_EVENT_ID]=!0}isAlreadyUsed(e){const n=e[rs.USED_EVENT_ID];return typeof n=="boolean"&&n}toggleClasses(e,n,s){var l,a,c,d,h,m,w;const v=(a=(l=this.options).getOverrideTarget)===null||a===void 0?void 0:a.call(l);if(!v&&!this.overlayElement)return;const S=n{Ne(ie,"dv-drop-target-anchor-container-changed",!1)},10));return}if(!this.overlayElement)return;const K={top:"0px",left:"0px",width:"100%",height:"100%"};O?(K.left=`${100*(1-G)}%`,K.width=`${100*G}%`):M?K.width=`${100*G}%`:N?K.height=`${100*G}%`:Z&&(K.top=`${100*(1-G)}%`,K.height=`${100*G}%`),Gy(this.overlayElement,K),Ne(this.overlayElement,"dv-drop-target-small-vertical",E),Ne(this.overlayElement,"dv-drop-target-small-horizontal",S),Ne(this.overlayElement,"dv-drop-target-left",A),Ne(this.overlayElement,"dv-drop-target-right",D),Ne(this.overlayElement,"dv-drop-target-top",P),Ne(this.overlayElement,"dv-drop-target-bottom",R),Ne(this.overlayElement,"dv-drop-target-center",e==="center")}calculateQuadrant(e,n,s,l,a){var c,d;const h=(d=(c=this.options.overlayModel)===null||c===void 0?void 0:c.activationSize)!==null&&d!==void 0?d:jy;return h.type==="percentage"?Yy(e,n,s,l,a,h.value):Ky(e,n,s,l,a,h.value)}removeDropTarget(){var e;this.targetElement&&(this._state=void 0,(e=this.targetElement.parentElement)===null||e===void 0||e.classList.remove("dv-drop-target"),this.targetElement.remove(),this.targetElement=void 0,this.overlayElement=void 0)}}rs.USED_EVENT_ID="__dockview_droptarget_event_is_used__";function Yy(r,e,n,s,l,a){const c=100*e/s,d=100*n/l;return r.has("left")&&c100-a?"right":r.has("top")&&d100-a?"bottom":r.has("center")?"center":null}function Ky(r,e,n,s,l,a){return r.has("left")&&es-a?"right":r.has("top")&&nl-a?"bottom":r.has("center")?"center":null}const gh=Object.keys({disableAutoResizing:void 0,disableDnd:void 0,className:void 0});class Jy extends lv{constructor(e,n,s,l){super(),this.nativeEvent=e,this.position=n,this.getData=s,this.panel=l}}class vv extends Gh{constructor(){super()}}class wv extends Re{get isFocused(){return this._isFocused}get isActive(){return this._isActive}get isVisible(){return this._isVisible}get width(){return this._width}get height(){return this._height}constructor(e,n){super(),this.id=e,this.component=n,this._isFocused=!1,this._isActive=!1,this._isVisible=!0,this._width=0,this._height=0,this._parameters={},this.panelUpdatesDisposable=new Bn,this._onDidDimensionChange=new U,this.onDidDimensionsChange=this._onDidDimensionChange.event,this._onDidChangeFocus=new U,this.onDidFocusChange=this._onDidChangeFocus.event,this._onWillFocus=new U,this.onWillFocus=this._onWillFocus.event,this._onDidVisibilityChange=new U,this.onDidVisibilityChange=this._onDidVisibilityChange.event,this._onWillVisibilityChange=new U,this.onWillVisibilityChange=this._onWillVisibilityChange.event,this._onDidActiveChange=new U,this.onDidActiveChange=this._onDidActiveChange.event,this._onActiveChange=new U,this.onActiveChange=this._onActiveChange.event,this._onDidParametersChange=new U,this.onDidParametersChange=this._onDidParametersChange.event,this.addDisposables(this.onDidFocusChange(s=>{this._isFocused=s.isFocused}),this.onDidActiveChange(s=>{this._isActive=s.isActive}),this.onDidVisibilityChange(s=>{this._isVisible=s.isVisible}),this.onDidDimensionsChange(s=>{this._width=s.width,this._height=s.height}),this.panelUpdatesDisposable,this._onDidDimensionChange,this._onDidChangeFocus,this._onDidVisibilityChange,this._onDidActiveChange,this._onWillFocus,this._onActiveChange,this._onWillFocus,this._onWillVisibilityChange,this._onDidParametersChange)}getParameters(){return this._parameters}initialize(e){this.panelUpdatesDisposable.value=this._onDidParametersChange.event(n=>{this._parameters=n,e.update({params:n})})}setVisible(e){this._onWillVisibilityChange.fire({isVisible:e})}setActive(){this._onActiveChange.fire()}updateParameters(e){this._onDidParametersChange.fire(e)}}class _v extends wv{constructor(e,n){super(e,n),this._onDidConstraintsChangeInternal=new U,this.onDidConstraintsChangeInternal=this._onDidConstraintsChangeInternal.event,this._onDidConstraintsChange=new U({replay:!0}),this.onDidConstraintsChange=this._onDidConstraintsChange.event,this._onDidSizeChange=new U,this.onDidSizeChange=this._onDidSizeChange.event,this.addDisposables(this._onDidConstraintsChangeInternal,this._onDidConstraintsChange,this._onDidSizeChange)}setConstraints(e){this._onDidConstraintsChangeInternal.fire(e)}setSize(e){this._onDidSizeChange.fire(e)}}class Qy extends _v{set pane(e){this._pane=e}constructor(e,n){super(e,n),this._onDidExpansionChange=new U({replay:!0}),this.onDidExpansionChange=this._onDidExpansionChange.event,this._onMouseEnter=new U({}),this.onMouseEnter=this._onMouseEnter.event,this._onMouseLeave=new U({}),this.onMouseLeave=this._onMouseLeave.event,this.addDisposables(this._onDidExpansionChange,this._onMouseEnter,this._onMouseLeave)}setExpanded(e){var n;(n=this._pane)===null||n===void 0||n.setExpanded(e)}get isExpanded(){var e;return!!(!((e=this._pane)===null||e===void 0)&&e.isExpanded())}}class jh extends Re{get element(){return this._element}get width(){return this._width}get height(){return this._height}get params(){var e;return(e=this._params)===null||e===void 0?void 0:e.params}constructor(e,n,s){super(),this.id=e,this.component=n,this.api=s,this._height=0,this._width=0,this._element=document.createElement("div"),this._element.tabIndex=-1,this._element.style.outline="none",this._element.style.height="100%",this._element.style.width="100%",this._element.style.overflow="hidden";const l=av(this._element);this.addDisposables(this.api,l.onDidFocus(()=>{this.api._onDidChangeFocus.fire({isFocused:!0})}),l.onDidBlur(()=>{this.api._onDidChangeFocus.fire({isFocused:!1})}),l)}focus(){const e=new vv;this.api._onWillFocus.fire(e),!e.defaultPrevented&&this._element.focus()}layout(e,n){this._width=e,this._height=n,this.api._onDidDimensionChange.fire({width:e,height:n}),this.part&&this._params&&this.part.update(this._params.params)}init(e){this._params=e,this.part=this.getComponent()}update(e){var n,s;this._params=Object.assign(Object.assign({},this._params),{params:Object.assign(Object.assign({},(n=this._params)===null||n===void 0?void 0:n.params),e.params)});for(const l of Object.keys(e.params))e.params[l]===void 0&&delete this._params.params[l];(s=this.part)===null||s===void 0||s.update({params:this._params.params})}toJSON(){var e,n;const s=(n=(e=this._params)===null||e===void 0?void 0:e.params)!==null&&n!==void 0?n:{};return{id:this.id,component:this.component,params:Object.keys(s).length>0?s:void 0}}dispose(){var e;this.api.dispose(),(e=this.part)===null||e===void 0||e.dispose(),super.dispose()}}class Zy extends jh{set orientation(e){this._orientation=e}get orientation(){return this._orientation}get minimumSize(){const e=this.headerSize,s=this.isExpanded()?this._minimumBodySize:0;return e+s}get maximumSize(){const e=this.headerSize,s=this.isExpanded()?this._maximumBodySize:0;return e+s}get size(){return this._size}get orthogonalSize(){return this._orthogonalSize}set orthogonalSize(e){this._orthogonalSize=e}get minimumBodySize(){return this._minimumBodySize}set minimumBodySize(e){this._minimumBodySize=typeof e=="number"?e:0}get maximumBodySize(){return this._maximumBodySize}set maximumBodySize(e){this._maximumBodySize=typeof e=="number"?e:Number.POSITIVE_INFINITY}get headerVisible(){return this._headerVisible}set headerVisible(e){this._headerVisible=e,this.header.style.display=e?"":"none"}constructor(e){super(e.id,e.component,new Qy(e.id,e.component)),this._onDidChangeExpansionState=new U({replay:!0}),this.onDidChangeExpansionState=this._onDidChangeExpansionState.event,this._onDidChange=new U,this.onDidChange=this._onDidChange.event,this._orthogonalSize=0,this._size=0,this._isExpanded=!1,this.api.pane=this,this.api.initialize(this),this.headerSize=e.headerSize,this.headerComponent=e.headerComponent,this._minimumBodySize=e.minimumBodySize,this._maximumBodySize=e.maximumBodySize,this._isExpanded=e.isExpanded,this._headerVisible=e.isHeaderVisible,this._onDidChangeExpansionState.fire(this.isExpanded()),this._orientation=e.orientation,this.element.classList.add("dv-pane"),this.addDisposables(this.api.onWillVisibilityChange(n=>{const{isVisible:s}=n,{accessor:l}=this._params;l.setVisible(this,s)}),this.api.onDidSizeChange(n=>{this._onDidChange.fire({size:n.size})}),Be(this.element,"mouseenter",n=>{this.api._onMouseEnter.fire(n)}),Be(this.element,"mouseleave",n=>{this.api._onMouseLeave.fire(n)})),this.addDisposables(this._onDidChangeExpansionState,this.onDidChangeExpansionState(n=>{this.api._onDidExpansionChange.fire({isExpanded:n})}),this.api.onDidFocusChange(n=>{this.header&&(n.isFocused?tc(this.header,"focused"):Zl(this.header,"focused"))})),this.renderOnce()}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}isExpanded(){return this._isExpanded}setExpanded(e){this._isExpanded!==e&&(this._isExpanded=e,e?(this.animationTimer&&clearTimeout(this.animationTimer),this.body&&this.element.appendChild(this.body)):this.animationTimer=setTimeout(()=>{var n;(n=this.body)===null||n===void 0||n.remove()},200),this._onDidChange.fire(e?{size:this.width}:{}),this._onDidChangeExpansionState.fire(e))}layout(e,n){this._size=e,this._orthogonalSize=n;const[s,l]=this.orientation===ze.HORIZONTAL?[e,n]:[n,e];super.layout(s,l)}init(e){var n,s;super.init(e),typeof e.minimumBodySize=="number"&&(this.minimumBodySize=e.minimumBodySize),typeof e.maximumBodySize=="number"&&(this.maximumBodySize=e.maximumBodySize),this.bodyPart=this.getBodyComponent(),this.headerPart=this.getHeaderComponent(),this.bodyPart.init(Object.assign(Object.assign({},e),{api:this.api})),this.headerPart.init(Object.assign(Object.assign({},e),{api:this.api})),(n=this.body)===null||n===void 0||n.append(this.bodyPart.element),(s=this.header)===null||s===void 0||s.append(this.headerPart.element),typeof e.isExpanded=="boolean"&&this.setExpanded(e.isExpanded)}toJSON(){const e=this._params;return Object.assign(Object.assign({},super.toJSON()),{headerComponent:this.headerComponent,title:e.title})}renderOnce(){this.header=document.createElement("div"),this.header.tabIndex=0,this.header.className="dv-pane-header",this.header.style.height=`${this.headerSize}px`,this.header.style.lineHeight=`${this.headerSize}px`,this.header.style.minHeight=`${this.headerSize}px`,this.header.style.maxHeight=`${this.headerSize}px`,this.element.appendChild(this.header),this.body=document.createElement("div"),this.body.className="dv-pane-body",this.element.appendChild(this.body)}getComponent(){return{update:e=>{var n,s;(n=this.bodyPart)===null||n===void 0||n.update({params:e}),(s=this.headerPart)===null||s===void 0||s.update({params:e})},dispose:()=>{var e,n;(e=this.bodyPart)===null||e===void 0||e.dispose(),(n=this.headerPart)===null||n===void 0||n.dispose()}}}}class Xy extends Zy{constructor(e){super({id:e.id,component:e.component,headerComponent:e.headerComponent,orientation:e.orientation,isExpanded:e.isExpanded,isHeaderVisible:!0,headerSize:e.headerSize,minimumBodySize:e.minimumBodySize,maximumBodySize:e.maximumBodySize}),this._onDidDrop=new U,this.onDidDrop=this._onDidDrop.event,this._onUnhandledDragOverEvent=new U,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,this.accessor=e.accessor,this.addDisposables(this._onDidDrop,this._onUnhandledDragOverEvent),e.disableDnd||this.initDragFeatures()}initDragFeatures(){if(!this.header)return;const e=this.id,n=this.accessor.id;this.header.draggable=!0,this.handler=new class extends Hh{getData(){return Ds.getInstance().setData([new Ul(n,e)],Ul.prototype),{dispose:()=>{Ds.getInstance().clearData(Ul.prototype)}}}}(this.header),this.target=new rs(this.element,{acceptedTargetZones:["top","bottom"],overlayModel:{activationSize:{type:"percentage",value:50}},canDisplayOverlay:(s,l)=>{const a=Nl();if(a&&a.paneId!==this.id&&a.viewId===this.accessor.id)return!0;const c=new Jy(s,l,Nl,this);return this._onUnhandledDragOverEvent.fire(c),c.isAccepted}}),this.addDisposables(this._onDidDrop,this.handler,this.target,this.target.onDrop(s=>{this.onDrop(s)}))}onDrop(e){const n=Nl();if(!n||n.viewId!==this.accessor.id){this._onDidDrop.fire(Object.assign(Object.assign({},e),{panel:this,api:new ql(this.accessor),getData:Nl}));return}const s=this._params.containerApi,l=n.paneId,a=s.getPanel(l);if(!a){this._onDidDrop.fire(Object.assign(Object.assign({},e),{panel:this,getData:Nl,api:new ql(this.accessor)}));return}const c=s.panels,d=c.indexOf(a);let h=s.panels.indexOf(this);(e.position==="left"||e.position==="top")&&(h=Math.max(0,h-1)),(e.position==="right"||e.position==="bottom")&&(d>h&&h++,h=Math.min(c.length-1,h)),s.movePanel(d,h)}}class qy extends Re{get element(){return this._element}constructor(e,n){super(),this.accessor=e,this.group=n,this.disposable=new Bn,this._onDidFocus=new U,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new U,this.onDidBlur=this._onDidBlur.event,this._element=document.createElement("div"),this._element.className="dv-content-container",this._element.tabIndex=-1,this.addDisposables(this._onDidFocus,this._onDidBlur);const s=n.dropTargetContainer;this.dropTarget=new rs(this.element,{getOverlayOutline:()=>{var l;return((l=e.options.theme)===null||l===void 0?void 0:l.dndPanelOverlay)==="group"?this.element.parentElement:null},className:"dv-drop-target-content",acceptedTargetZones:["top","bottom","left","right","center"],canDisplayOverlay:(l,a)=>{if(this.group.locked==="no-drop-target"||this.group.locked&&a==="center")return!1;const c=Hn();return!c&&l.shiftKey&&this.group.location.type!=="floating"?!1:c&&c.viewId===this.accessor.id?!0:this.group.canDisplayOverlay(l,a,"content")},getOverrideTarget:s?()=>s.model:void 0}),this.addDisposables(this.dropTarget)}show(){this.element.style.display=""}hide(){this.element.style.display="none"}renderPanel(e,n={asActive:!0}){const s=n.asActive||this.panel&&this.group.isPanelActive(this.panel);this.panel&&this.panel.view.content.element.parentElement===this._element&&this._element.removeChild(this.panel.view.content.element),this.panel=e;let l;switch(e.api.renderer){case"onlyWhenVisible":this.group.renderContainer.detatch(e),this.panel&&s&&this._element.appendChild(this.panel.view.content.element),l=this._element;break;case"always":e.view.content.element.parentElement===this._element&&this._element.removeChild(e.view.content.element),l=this.group.renderContainer.attach({panel:e,referenceContainer:this});break;default:throw new Error(`dockview: invalid renderer type '${e.api.renderer}'`)}if(s){const a=av(l);this.focusTracker=a;const c=new Re;c.addDisposables(a,a.onDidFocus(()=>this._onDidFocus.fire()),a.onDidBlur(()=>this._onDidBlur.fire())),this.disposable.value=c}}openPanel(e){this.panel!==e&&this.renderPanel(e)}layout(e,n){}closePanel(){var e;this.panel&&this.panel.api.renderer==="onlyWhenVisible"&&((e=this.panel.view.content.element.parentElement)===null||e===void 0||e.removeChild(this.panel.view.content.element)),this.panel=void 0}dispose(){this.disposable.dispose(),super.dispose()}refreshFocusState(){var e;!((e=this.focusTracker)===null||e===void 0)&&e.refreshState&&this.focusTracker.refreshState()}}function yv(r,e,n){var s,l;tc(e,"dv-dragged"),e.style.top="-9999px",document.body.appendChild(e),r.setDragImage(e,(s=n==null?void 0:n.x)!==null&&s!==void 0?s:0,(l=n==null?void 0:n.y)!==null&&l!==void 0?l:0),setTimeout(()=>{Zl(e,"dv-dragged"),e.remove()},0)}class eS extends Hh{constructor(e,n,s,l,a){super(e,a),this.accessor=n,this.group=s,this.panel=l,this.panelTransfer=Ds.getInstance()}getData(e){return this.panelTransfer.setData([new _r(this.accessor.id,this.group.id,this.panel.id)],_r.prototype),{dispose:()=>{this.panelTransfer.clearData(_r.prototype)}}}}class tS extends Re{get element(){return this._element}constructor(e,n,s){super(),this.panel=e,this.accessor=n,this.group=s,this.content=void 0,this._onPointDown=new U,this.onPointerDown=this._onPointDown.event,this._onDropped=new U,this.onDrop=this._onDropped.event,this._onDragStart=new U,this.onDragStart=this._onDragStart.event,this._element=document.createElement("div"),this._element.className="dv-tab",this._element.tabIndex=0,this._element.draggable=!this.accessor.options.disableDnd,Ne(this.element,"dv-inactive-tab",!0),this.dragHandler=new eS(this._element,this.accessor,this.group,this.panel,!!this.accessor.options.disableDnd),this.dropTarget=new rs(this._element,{acceptedTargetZones:["left","right"],overlayModel:{activationSize:{value:50,type:"percentage"}},canDisplayOverlay:(l,a)=>{if(this.group.locked)return!1;const c=Hn();return c&&this.accessor.id===c.viewId?!0:this.group.model.canDisplayOverlay(l,a,"tab")},getOverrideTarget:()=>{var l;return(l=s.model.dropTargetContainer)===null||l===void 0?void 0:l.model}}),this.onWillShowOverlay=this.dropTarget.onWillShowOverlay,this.addDisposables(this._onPointDown,this._onDropped,this._onDragStart,this.dragHandler.onDragStart(l=>{if(l.dataTransfer){const a=getComputedStyle(this.element),c=this.element.cloneNode(!0);Array.from(a).forEach(d=>c.style.setProperty(d,a.getPropertyValue(d),a.getPropertyPriority(d))),c.style.position="absolute",yv(l.dataTransfer,c,{y:-10,x:30})}this._onDragStart.fire(l)}),this.dragHandler,Be(this._element,"pointerdown",l=>{this._onPointDown.fire(l)}),this.dropTarget.onDrop(l=>{this._onDropped.fire(l)}),this.dropTarget)}setActive(e){Ne(this.element,"dv-active-tab",e),Ne(this.element,"dv-inactive-tab",!e)}setContent(e){this.content&&this._element.removeChild(this.content.element),this.content=e,this._element.appendChild(this.content.element)}updateDragAndDropState(){this._element.draggable=!this.accessor.options.disableDnd,this.dragHandler.setDisabled(!!this.accessor.options.disableDnd)}dispose(){super.dispose()}}class ic{get kind(){return this.options.kind}get nativeEvent(){return this.event.nativeEvent}get position(){return this.event.position}get defaultPrevented(){return this.event.defaultPrevented}get panel(){return this.options.panel}get api(){return this.options.api}get group(){return this.options.group}preventDefault(){this.event.preventDefault()}getData(){return this.options.getData()}constructor(e,n){this.event=e,this.options=n}}class nS extends Hh{constructor(e,n,s,l){super(e,l),this.accessor=n,this.group=s,this.panelTransfer=Ds.getInstance(),this.addDisposables(Be(e,"pointerdown",a=>{a.shiftKey&&_y(a)},!0))}isCancelled(e){return this.group.api.location.type==="floating"&&!e.shiftKey}getData(e){const n=e.dataTransfer;this.panelTransfer.setData([new _r(this.accessor.id,this.group.id,null)],_r.prototype);const s=window.getComputedStyle(this.el),l=s.getPropertyValue("--dv-activegroup-visiblepanel-tab-background-color"),a=s.getPropertyValue("--dv-activegroup-visiblepanel-tab-color");if(n){const c=document.createElement("div");c.style.backgroundColor=l,c.style.color=a,c.style.padding="2px 8px",c.style.height="24px",c.style.fontSize="11px",c.style.lineHeight="20px",c.style.borderRadius="12px",c.style.position="absolute",c.style.pointerEvents="none",c.style.top="-9999px",c.textContent=`Multiple Panels (${this.group.size})`,yv(n,c,{y:-10,x:30})}return{dispose:()=>{this.panelTransfer.clearData(_r.prototype)}}}}class iS extends Re{get element(){return this._element}constructor(e,n){super(),this.accessor=e,this.group=n,this._onDrop=new U,this.onDrop=this._onDrop.event,this._onDragStart=new U,this.onDragStart=this._onDragStart.event,this._element=document.createElement("div"),this._element.className="dv-void-container",this._element.draggable=!this.accessor.options.disableDnd,Ne(this._element,"dv-draggable",!this.accessor.options.disableDnd),this.addDisposables(this._onDrop,this._onDragStart,Be(this._element,"pointerdown",()=>{this.accessor.doSetGroupActive(this.group)})),this.handler=new nS(this._element,e,n,!!this.accessor.options.disableDnd),this.dropTarget=new rs(this._element,{acceptedTargetZones:["center"],canDisplayOverlay:(s,l)=>{const a=Hn();return a&&this.accessor.id===a.viewId?!0:n.model.canDisplayOverlay(s,l,"header_space")},getOverrideTarget:()=>{var s;return(s=n.model.dropTargetContainer)===null||s===void 0?void 0:s.model}}),this.onWillShowOverlay=this.dropTarget.onWillShowOverlay,this.addDisposables(this.handler,this.handler.onDragStart(s=>{this._onDragStart.fire(s)}),this.dropTarget.onDrop(s=>{this._onDrop.fire(s)}),this.dropTarget)}updateDragAndDropState(){this._element.draggable=!this.accessor.options.disableDnd,Ne(this._element,"dv-draggable",!this.accessor.options.disableDnd),this.handler.setDisabled(!!this.accessor.options.disableDnd)}}class sc extends Re{get element(){return this._element}constructor(e){super(),this.scrollableElement=e,this._scrollLeft=0,this._element=document.createElement("div"),this._element.className="dv-scrollable",this._horizontalScrollbar=document.createElement("div"),this._horizontalScrollbar.className="dv-scrollbar-horizontal",this.element.appendChild(e),this.element.appendChild(this._horizontalScrollbar),this.addDisposables(Be(this.element,"wheel",n=>{this._scrollLeft+=n.deltaY*sc.MouseWheelSpeed,this.calculateScrollbarStyles()}),Be(this._horizontalScrollbar,"pointerdown",n=>{n.preventDefault(),Ne(this.element,"dv-scrollable-scrolling",!0);const s=n.clientX,l=this._scrollLeft,a=d=>{const h=d.clientX-s,{clientWidth:m}=this.element,{scrollWidth:w}=this.scrollableElement,v=m/w;this._scrollLeft=l+h/v,this.calculateScrollbarStyles()},c=()=>{Ne(this.element,"dv-scrollable-scrolling",!1),document.removeEventListener("pointermove",a),document.removeEventListener("pointerup",c),document.removeEventListener("pointercancel",c)};document.addEventListener("pointermove",a),document.addEventListener("pointerup",c),document.addEventListener("pointercancel",c)}),Be(this.element,"scroll",()=>{this.calculateScrollbarStyles()}),Be(this.scrollableElement,"scroll",()=>{this._scrollLeft=this.scrollableElement.scrollLeft,this.calculateScrollbarStyles()}),ec(this.element,()=>{Ne(this.element,"dv-scrollable-resizing",!0),this._animationTimer&&clearTimeout(this._animationTimer),this._animationTimer=setTimeout(()=>{clearTimeout(this._animationTimer),Ne(this.element,"dv-scrollable-resizing",!1)},500),this.calculateScrollbarStyles()}))}calculateScrollbarStyles(){const{clientWidth:e}=this.element,{scrollWidth:n}=this.scrollableElement;if(n>e){const l=e*(e/n);this._horizontalScrollbar.style.width=`${l}px`,this._scrollLeft=_t(this._scrollLeft,0,this.scrollableElement.scrollWidth-e),this.scrollableElement.scrollLeft=this._scrollLeft;const a=this._scrollLeft/(n-e);this._horizontalScrollbar.style.left=`${(e-l)*a}px`}else this._horizontalScrollbar.style.width="0px",this._horizontalScrollbar.style.left="0px",this._scrollLeft=0}}sc.MouseWheelSpeed=1;class sS extends Re{get showTabsOverflowControl(){return this._showTabsOverflowControl}set showTabsOverflowControl(e){if(this._showTabsOverflowControl!=e&&(this._showTabsOverflowControl=e,e)){const n=new vy(this._tabsList);this._observerDisposable.value=new Re(n,n.onDidChange(s=>{const l=s.hasScrollX||s.hasScrollY;this.toggleDropdown({reset:!l})}),Be(this._tabsList,"scroll",()=>{this.toggleDropdown({reset:!1})}))}}get element(){return this._element}get panels(){return this._tabs.map(e=>e.value.panel.id)}get size(){return this._tabs.length}get tabs(){return this._tabs.map(e=>e.value)}constructor(e,n,s){if(super(),this.group=e,this.accessor=n,this._observerDisposable=new Bn,this._tabs=[],this.selectedIndex=-1,this._showTabsOverflowControl=!1,this._onTabDragStart=new U,this.onTabDragStart=this._onTabDragStart.event,this._onDrop=new U,this.onDrop=this._onDrop.event,this._onWillShowOverlay=new U,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onOverflowTabsChange=new U,this.onOverflowTabsChange=this._onOverflowTabsChange.event,this._tabsList=document.createElement("div"),this._tabsList.className="dv-tabs-container dv-horizontal",this.showTabsOverflowControl=s.showTabsOverflowControl,n.options.scrollbars==="native")this._element=this._tabsList;else{const l=new sc(this._tabsList);this._element=l.element,this.addDisposables(l)}this.addDisposables(this._onOverflowTabsChange,this._observerDisposable,this._onWillShowOverlay,this._onDrop,this._onTabDragStart,Be(this.element,"pointerdown",l=>{if(l.defaultPrevented)return;l.button===0&&this.accessor.doSetGroupActive(this.group)}),Qt.from(()=>{for(const{value:l,disposable:a}of this._tabs)a.dispose(),l.dispose();this._tabs=[]}))}indexOf(e){return this._tabs.findIndex(n=>n.value.panel.id===e)}isActive(e){return this.selectedIndex>-1&&this._tabs[this.selectedIndex].value===e}setActivePanel(e){let n=0;for(const s of this._tabs){const l=e.id===s.value.panel.id;if(s.value.setActive(l),l){const a=s.value.element,c=a.parentElement;(nc.scrollLeft+c.clientWidth)&&(c.scrollLeft=n)}n+=s.value.element.clientWidth}}openPanel(e,n=this._tabs.length){if(this._tabs.find(c=>c.value.panel.id===e.id))return;const s=new tS(e,this.accessor,this.group);s.setContent(e.view.tab);const l=new Re(s.onDragStart(c=>{this._onTabDragStart.fire({nativeEvent:c,panel:e})}),s.onPointerDown(c=>{if(c.defaultPrevented)return;const d=!this.accessor.options.disableFloatingGroups,h=this.group.api.location.type==="floating"&&this.size===1;if(d&&!h&&c.shiftKey){c.preventDefault();const m=this.accessor.getGroupPanel(s.panel.id),{top:w,left:v}=s.element.getBoundingClientRect(),{top:S,left:E}=this.accessor.element.getBoundingClientRect();this.accessor.addFloatingGroup(m,{x:v-E,y:w-S,inDragMode:!0});return}switch(c.button){case 0:this.group.activePanel!==e&&this.group.model.openPanel(e);break}}),s.onDrop(c=>{this._onDrop.fire({event:c.nativeEvent,index:this._tabs.findIndex(d=>d.value===s)})}),s.onWillShowOverlay(c=>{this._onWillShowOverlay.fire(new ic(c,{kind:"tab",panel:this.group.activePanel,api:this.accessor.api,group:this.group,getData:Hn}))})),a={value:s,disposable:l};this.addTab(a,n)}delete(e){const n=this.indexOf(e),s=this._tabs.splice(n,1)[0],{value:l,disposable:a}=s;a.dispose(),l.dispose(),l.element.remove()}addTab(e,n=this._tabs.length){if(n<0||n>this._tabs.length)throw new Error("invalid location");this._tabsList.insertBefore(e.value.element,this._tabsList.children[n]),this._tabs=[...this._tabs.slice(0,n),e,...this._tabs.slice(n)],this.selectedIndex<0&&(this.selectedIndex=n)}toggleDropdown(e){const n=e.reset?[]:this._tabs.filter(s=>!Ey(s.value.element,this._tabsList)).map(s=>s.value.panel.id);this._onOverflowTabsChange.fire({tabs:n,reset:e.reset})}updateDragAndDropState(){for(const e of this._tabs)e.value.updateDragAndDropState()}}const Bh=r=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttributeNS(null,"height",r.height),e.setAttributeNS(null,"width",r.width),e.setAttributeNS(null,"viewBox",r.viewbox),e.setAttributeNS(null,"aria-hidden","false"),e.setAttributeNS(null,"focusable","false"),e.classList.add("dv-svg");const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttributeNS(null,"d",r.path),e.appendChild(n),e},rS=()=>Bh({width:"11",height:"11",viewbox:"0 0 28 28",path:"M2.1 27.3L0 25.2L11.55 13.65L0 2.1L2.1 0L13.65 11.55L25.2 0L27.3 2.1L15.75 13.65L27.3 25.2L25.2 27.3L13.65 15.75L2.1 27.3Z"}),oS=()=>Bh({width:"11",height:"11",viewbox:"0 0 24 15",path:"M12 14.15L0 2.15L2.15 0L12 9.9L21.85 0.0499992L24 2.2L12 14.15Z"}),Sv=()=>Bh({width:"11",height:"11",viewbox:"0 0 15 25",path:"M2.15 24.1L0 21.95L9.9 12.05L0 2.15L2.15 0L14.2 12.05L2.15 24.1Z"});function lS(){const r=document.createElement("div");r.className="dv-tabs-overflow-dropdown-default";const e=document.createElement("span");e.textContent="";const n=Sv();return r.appendChild(n),r.appendChild(e),{element:r,update:s=>{e.textContent=`${s.tabs}`}}}class aS extends Re{get onTabDragStart(){return this.tabs.onTabDragStart}get panels(){return this.tabs.panels}get size(){return this.tabs.size}get hidden(){return this._hidden}set hidden(e){this._hidden=e,this.element.style.display=e?"none":""}get element(){return this._element}constructor(e,n){super(),this.accessor=e,this.group=n,this._hidden=!1,this.dropdownPart=null,this._overflowTabs=[],this._dropdownDisposable=new Bn,this._onDrop=new U,this.onDrop=this._onDrop.event,this._onGroupDragStart=new U,this.onGroupDragStart=this._onGroupDragStart.event,this._onWillShowOverlay=new U,this.onWillShowOverlay=this._onWillShowOverlay.event,this._element=document.createElement("div"),this._element.className="dv-tabs-and-actions-container",Ne(this._element,"dv-full-width-single-tab",this.accessor.options.singleTabMode==="fullwidth"),this.rightActionsContainer=document.createElement("div"),this.rightActionsContainer.className="dv-right-actions-container",this.leftActionsContainer=document.createElement("div"),this.leftActionsContainer.className="dv-left-actions-container",this.preActionsContainer=document.createElement("div"),this.preActionsContainer.className="dv-pre-actions-container",this.tabs=new sS(n,e,{showTabsOverflowControl:!e.options.disableTabsOverflowList}),this.voidContainer=new iS(this.accessor,this.group),this._element.appendChild(this.preActionsContainer),this._element.appendChild(this.tabs.element),this._element.appendChild(this.leftActionsContainer),this._element.appendChild(this.voidContainer.element),this._element.appendChild(this.rightActionsContainer),this.addDisposables(this.tabs.onDrop(s=>this._onDrop.fire(s)),this.tabs.onWillShowOverlay(s=>this._onWillShowOverlay.fire(s)),e.onDidOptionsChange(()=>{this.tabs.showTabsOverflowControl=!e.options.disableTabsOverflowList}),this.tabs.onOverflowTabsChange(s=>{this.toggleDropdown(s)}),this.tabs,this._onWillShowOverlay,this._onDrop,this._onGroupDragStart,this.voidContainer,this.voidContainer.onDragStart(s=>{this._onGroupDragStart.fire({nativeEvent:s,group:this.group})}),this.voidContainer.onDrop(s=>{this._onDrop.fire({event:s.nativeEvent,index:this.tabs.size})}),this.voidContainer.onWillShowOverlay(s=>{this._onWillShowOverlay.fire(new ic(s,{kind:"header_space",panel:this.group.activePanel,api:this.accessor.api,group:this.group,getData:Hn}))}),Be(this.voidContainer.element,"pointerdown",s=>{if(s.defaultPrevented)return;if(!this.accessor.options.disableFloatingGroups&&s.shiftKey&&this.group.api.location.type!=="floating"){s.preventDefault();const{top:a,left:c}=this.element.getBoundingClientRect(),{top:d,left:h}=this.accessor.element.getBoundingClientRect();this.accessor.addFloatingGroup(this.group,{x:c-h+20,y:a-d+20,inDragMode:!0})}}))}show(){this.hidden||(this.element.style.display="")}hide(){this._element.style.display="none"}setRightActionsElement(e){this.rightActions!==e&&(this.rightActions&&(this.rightActions.remove(),this.rightActions=void 0),e&&(this.rightActionsContainer.appendChild(e),this.rightActions=e))}setLeftActionsElement(e){this.leftActions!==e&&(this.leftActions&&(this.leftActions.remove(),this.leftActions=void 0),e&&(this.leftActionsContainer.appendChild(e),this.leftActions=e))}setPrefixActionsElement(e){this.preActions!==e&&(this.preActions&&(this.preActions.remove(),this.preActions=void 0),e&&(this.preActionsContainer.appendChild(e),this.preActions=e))}isActive(e){return this.tabs.isActive(e)}indexOf(e){return this.tabs.indexOf(e)}setActive(e){}delete(e){this.tabs.delete(e),this.updateClassnames()}setActivePanel(e){this.tabs.setActivePanel(e)}openPanel(e,n=this.tabs.size){this.tabs.openPanel(e,n),this.updateClassnames()}closePanel(e){this.delete(e.id)}updateClassnames(){Ne(this._element,"dv-single-tab",this.size===1)}toggleDropdown(e){const n=e.reset?[]:e.tabs;if(this._overflowTabs=n,this._overflowTabs.length>0&&this.dropdownPart){this.dropdownPart.update({tabs:n.length});return}if(this._overflowTabs.length===0){this._dropdownDisposable.dispose();return}const s=document.createElement("div");s.className="dv-tabs-overflow-dropdown-root";const l=lS();l.update({tabs:n.length}),this.dropdownPart=l,s.appendChild(l.element),this.rightActionsContainer.prepend(s),this._dropdownDisposable.value=new Re(Qt.from(()=>{var a,c;s.remove(),(c=(a=this.dropdownPart)===null||a===void 0?void 0:a.dispose)===null||c===void 0||c.call(a),this.dropdownPart=null}),Be(s,"pointerdown",a=>{a.preventDefault()},{capture:!0}),Be(s,"click",a=>{const c=document.createElement("div");c.style.overflow="auto",c.className="dv-tabs-overflow-container";for(const h of this.tabs.tabs.filter(m=>this._overflowTabs.includes(m.panel.id))){const m=this.group.panels.find(E=>E===h.panel),v=m.view.createTabRenderer("headerOverflow").element,S=document.createElement("div");Ne(S,"dv-tab",!0),Ne(S,"dv-active-tab",m.api.isActive),Ne(S,"dv-inactive-tab",!m.api.isActive),S.addEventListener("click",E=>{this.accessor.popupService.close(),!E.defaultPrevented&&(h.element.scrollIntoView(),h.panel.api.setActive())}),S.appendChild(v),c.appendChild(S)}const d=zy(s);this.accessor.popupService.openPopover(c,{x:a.clientX,y:a.clientY,zIndex:d!=null&&d.style.zIndex?`calc(${d.style.zIndex} * 2)`:void 0})}))}updateDragAndDropState(){this.tabs.updateDragAndDropState(),this.voidContainer.updateDragAndDropState()}}class Dv extends lv{constructor(e,n,s,l,a){super(),this.nativeEvent=e,this.target=n,this.position=s,this.getData=l,this.group=a}}const vh=Object.keys({disableAutoResizing:void 0,hideBorders:void 0,singleTabMode:void 0,disableFloatingGroups:void 0,floatingGroupBounds:void 0,popoutUrl:void 0,defaultRenderer:void 0,debug:void 0,rootOverlayModel:void 0,locked:void 0,disableDnd:void 0,className:void 0,noPanelsOverlay:void 0,dndEdges:void 0,theme:void 0,disableTabsOverflowList:void 0,scrollbars:void 0});function uS(r){return!!r.referencePanel}function cS(r){return!!r.referenceGroup}function dS(r){return!!r.referencePanel}function hS(r){return!!r.referenceGroup}class Uh extends Gh{get nativeEvent(){return this.options.nativeEvent}get position(){return this.options.position}get panel(){return this.options.panel}get group(){return this.options.group}get api(){return this.options.api}constructor(e){super(),this.options=e}getData(){return this.options.getData()}}class Cv extends Uh{get kind(){return this._kind}constructor(e){super(e),this._kind=e.kind}}class fS extends Re{get element(){throw new Error("dockview: not supported")}get activePanel(){return this._activePanel}get locked(){return this._locked}set locked(e){this._locked=e,Ne(this.container,"dv-locked-groupview",e==="no-drop-target"||e)}get isActive(){return this._isGroupActive}get panels(){return this._panels}get size(){return this._panels.length}get isEmpty(){return this._panels.length===0}get hasWatermark(){return!!(this.watermark&&this.container.contains(this.watermark.element))}get header(){return this.tabsContainer}get isContentFocused(){return document.activeElement?uh(document.activeElement,this.contentContainer.element):!1}get location(){return this._location}set location(e){switch(this._location=e,Ne(this.container,"dv-groupview-floating",!1),Ne(this.container,"dv-groupview-popout",!1),e.type){case"grid":this.contentContainer.dropTarget.setTargetZones(["top","bottom","left","right","center"]);break;case"floating":this.contentContainer.dropTarget.setTargetZones(["center"]),this.contentContainer.dropTarget.setTargetZones(e?["center"]:["top","bottom","left","right","center"]),Ne(this.container,"dv-groupview-floating",!0);break;case"popout":this.contentContainer.dropTarget.setTargetZones(["center"]),Ne(this.container,"dv-groupview-popout",!0);break}this.groupPanel.api._onDidLocationChange.fire({location:this.location})}constructor(e,n,s,l,a){var c;super(),this.container=e,this.accessor=n,this.id=s,this.options=l,this.groupPanel=a,this._isGroupActive=!1,this._locked=!1,this._location={type:"grid"},this.mostRecentlyUsed=[],this._overwriteRenderContainer=null,this._overwriteDropTargetContainer=null,this._onDidChange=new U,this.onDidChange=this._onDidChange.event,this._width=0,this._height=0,this._panels=[],this._panelDisposables=new Map,this._onMove=new U,this.onMove=this._onMove.event,this._onDidDrop=new U,this.onDidDrop=this._onDidDrop.event,this._onWillDrop=new U,this.onWillDrop=this._onWillDrop.event,this._onWillShowOverlay=new U,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onTabDragStart=new U,this.onTabDragStart=this._onTabDragStart.event,this._onGroupDragStart=new U,this.onGroupDragStart=this._onGroupDragStart.event,this._onDidAddPanel=new U,this.onDidAddPanel=this._onDidAddPanel.event,this._onDidPanelTitleChange=new U,this.onDidPanelTitleChange=this._onDidPanelTitleChange.event,this._onDidPanelParametersChange=new U,this.onDidPanelParametersChange=this._onDidPanelParametersChange.event,this._onDidRemovePanel=new U,this.onDidRemovePanel=this._onDidRemovePanel.event,this._onDidActivePanelChange=new U,this.onDidActivePanelChange=this._onDidActivePanelChange.event,this._onUnhandledDragOverEvent=new U,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,Ne(this.container,"dv-groupview",!0),this._api=new Bu(this.accessor),this.tabsContainer=new aS(this.accessor,this.groupPanel),this.contentContainer=new qy(this.accessor,this),e.append(this.tabsContainer.element,this.contentContainer.element),this.header.hidden=!!l.hideHeader,this.locked=(c=l.locked)!==null&&c!==void 0?c:!1,this.addDisposables(this._onTabDragStart,this._onGroupDragStart,this._onWillShowOverlay,this.tabsContainer.onTabDragStart(d=>{this._onTabDragStart.fire(d)}),this.tabsContainer.onGroupDragStart(d=>{this._onGroupDragStart.fire(d)}),this.tabsContainer.onDrop(d=>{this.handleDropEvent("header",d.event,"center",d.index)}),this.contentContainer.onDidFocus(()=>{this.accessor.doSetGroupActive(this.groupPanel)}),this.contentContainer.onDidBlur(()=>{}),this.contentContainer.dropTarget.onDrop(d=>{this.handleDropEvent("content",d.nativeEvent,d.position)}),this.tabsContainer.onWillShowOverlay(d=>{this._onWillShowOverlay.fire(d)}),this.contentContainer.dropTarget.onWillShowOverlay(d=>{this._onWillShowOverlay.fire(new ic(d,{kind:"content",panel:this.activePanel,api:this._api,group:this.groupPanel,getData:Hn}))}),this._onMove,this._onDidChange,this._onDidDrop,this._onWillDrop,this._onDidAddPanel,this._onDidRemovePanel,this._onDidActivePanelChange,this._onUnhandledDragOverEvent,this._onDidPanelTitleChange,this._onDidPanelParametersChange)}focusContent(){this.contentContainer.element.focus()}set renderContainer(e){this.panels.forEach(n=>{this.renderContainer.detatch(n)}),this._overwriteRenderContainer=e,this.panels.forEach(n=>{this.rerender(n)})}get renderContainer(){var e;return(e=this._overwriteRenderContainer)!==null&&e!==void 0?e:this.accessor.overlayRenderContainer}set dropTargetContainer(e){this._overwriteDropTargetContainer=e}get dropTargetContainer(){var e;return(e=this._overwriteDropTargetContainer)!==null&&e!==void 0?e:this.accessor.rootDropTargetContainer}initialize(){this.options.panels&&this.options.panels.forEach(e=>{this.doAddPanel(e)}),this.options.activePanel&&this.openPanel(this.options.activePanel),this.setActive(this.isActive,!0),this.updateContainer(),this.accessor.options.createRightHeaderActionComponent&&(this._rightHeaderActions=this.accessor.options.createRightHeaderActionComponent(this.groupPanel),this.addDisposables(this._rightHeaderActions),this._rightHeaderActions.init({containerApi:this._api,api:this.groupPanel.api,group:this.groupPanel}),this.tabsContainer.setRightActionsElement(this._rightHeaderActions.element)),this.accessor.options.createLeftHeaderActionComponent&&(this._leftHeaderActions=this.accessor.options.createLeftHeaderActionComponent(this.groupPanel),this.addDisposables(this._leftHeaderActions),this._leftHeaderActions.init({containerApi:this._api,api:this.groupPanel.api,group:this.groupPanel}),this.tabsContainer.setLeftActionsElement(this._leftHeaderActions.element)),this.accessor.options.createPrefixHeaderActionComponent&&(this._prefixHeaderActions=this.accessor.options.createPrefixHeaderActionComponent(this.groupPanel),this.addDisposables(this._prefixHeaderActions),this._prefixHeaderActions.init({containerApi:this._api,api:this.groupPanel.api,group:this.groupPanel}),this.tabsContainer.setPrefixActionsElement(this._prefixHeaderActions.element))}rerender(e){this.contentContainer.renderPanel(e,{asActive:!1})}indexOf(e){return this.tabsContainer.indexOf(e.id)}toJSON(){var e;const n={views:this.tabsContainer.panels,activeView:(e=this._activePanel)===null||e===void 0?void 0:e.id,id:this.id};return this.locked!==!1&&(n.locked=this.locked),this.header.hidden&&(n.hideHeader=!0),n}moveToNext(e){e||(e={}),e.panel||(e.panel=this.activePanel);const n=e.panel?this.panels.indexOf(e.panel):-1;let s;if(n0)s=n-1;else if(!e.suppressRoll)s=this.panels.length-1;else return;this.openPanel(this.panels[s])}containsPanel(e){return this.panels.includes(e)}init(e){}update(e){}focus(){var e;(e=this._activePanel)===null||e===void 0||e.focus()}openPanel(e,n={}){(typeof n.index!="number"||n.index>this.panels.length)&&(n.index=this.panels.length);const s=!!n.skipSetActive;if(e.updateParentGroup(this.groupPanel,{skipSetActive:n.skipSetActive}),this.doAddPanel(e,n.index,{skipSetActive:s}),this._activePanel===e){this.contentContainer.renderPanel(e,{asActive:!0});return}s||this.doSetActivePanel(e),n.skipSetGroupActive||this.accessor.doSetGroupActive(this.groupPanel),n.skipSetActive||this.updateContainer()}removePanel(e,n={skipSetActive:!1}){const s=typeof e=="string"?e:e.id,l=this._panels.find(a=>a.id===s);if(!l)throw new Error("invalid operation");return this._removePanel(l,n)}closeAllPanels(){if(this.panels.length>0){const e=[...this.panels];for(const n of e)this.doClose(n)}else this.accessor.removeGroup(this.groupPanel)}closePanel(e){this.doClose(e)}doClose(e){const n=this.panels.length===1&&this.accessor.groups.length===1;this.accessor.removePanel(e,n&&this.accessor.options.noPanelsOverlay==="emptyGroup"?{removeEmptyGroup:!1}:void 0)}isPanelActive(e){return this._activePanel===e}updateActions(e){this.tabsContainer.setRightActionsElement(e)}setActive(e,n=!1){!n&&this.isActive===e||(this._isGroupActive=e,Ne(this.container,"dv-active-group",e),Ne(this.container,"dv-inactive-group",!e),this.tabsContainer.setActive(this.isActive),!this._activePanel&&this.panels.length>0&&this.doSetActivePanel(this.panels[0]),this.updateContainer())}layout(e,n){var s;this._width=e,this._height=n,this.contentContainer.layout(this._width,this._height),!((s=this._activePanel)===null||s===void 0)&&s.layout&&this._activePanel.layout(this._width,this._height)}_removePanel(e,n){const s=this._activePanel===e;if(this.doRemovePanel(e),s&&this.panels.length>0){const l=this.mostRecentlyUsed[0];this.openPanel(l,{skipSetActive:n.skipSetActive,skipSetGroupActive:n.skipSetActiveGroup})}return this._activePanel&&this.panels.length===0&&this.doSetActivePanel(void 0),n.skipSetActive||this.updateContainer(),e}doRemovePanel(e){const n=this.panels.indexOf(e);if(this._activePanel===e&&this.contentContainer.closePanel(),this.tabsContainer.delete(e.id),this._panels.splice(n,1),this.mostRecentlyUsed.includes(e)){const l=this.mostRecentlyUsed.indexOf(e);this.mostRecentlyUsed.splice(l,1)}const s=this._panelDisposables.get(e.id);s&&(s.dispose(),this._panelDisposables.delete(e.id)),this._onDidRemovePanel.fire({panel:e})}doAddPanel(e,n=this.panels.length,s={skipSetActive:!1}){const a=this._panels.indexOf(e)>-1;this.tabsContainer.show(),this.contentContainer.show(),this.tabsContainer.openPanel(e,n),s.skipSetActive||this.contentContainer.openPanel(e),!a&&(this.updateMru(e),this.panels.splice(n,0,e),this._panelDisposables.set(e.id,new Re(e.api.onDidTitleChange(c=>this._onDidPanelTitleChange.fire(c)),e.api.onDidParametersChange(c=>this._onDidPanelParametersChange.fire(c)))),this._onDidAddPanel.fire({panel:e}))}doSetActivePanel(e){this._activePanel!==e&&(this._activePanel=e,e&&(this.tabsContainer.setActivePanel(e),this.contentContainer.openPanel(e),e.layout(this._width,this._height),this.updateMru(e),this.contentContainer.refreshFocusState(),this._onDidActivePanelChange.fire({panel:e})))}updateMru(e){this.mostRecentlyUsed.includes(e)&&this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(e),1),this.mostRecentlyUsed=[e,...this.mostRecentlyUsed]}updateContainer(){var e,n;if(this.panels.forEach(s=>s.runEvents()),this.isEmpty&&!this.watermark){const s=this.accessor.createWatermarkComponent();s.init({containerApi:this._api,group:this.groupPanel}),this.watermark=s,Be(this.watermark.element,"pointerdown",()=>{this.isActive||this.accessor.doSetGroupActive(this.groupPanel)}),this.contentContainer.element.appendChild(this.watermark.element)}!this.isEmpty&&this.watermark&&(this.watermark.element.remove(),(n=(e=this.watermark).dispose)===null||n===void 0||n.call(e),this.watermark=void 0)}canDisplayOverlay(e,n,s){const l=new Dv(e,s,n,Hn,this.accessor.getPanel(this.id));return this._onUnhandledDragOverEvent.fire(l),l.isAccepted}handleDropEvent(e,n,s,l){if(this.locked==="no-drop-target")return;function a(){switch(e){case"header":return typeof l=="number"?"tab":"header_space";case"content":return"content"}}const c=typeof l=="number"?this.panels[l]:void 0,d=new Cv({nativeEvent:n,position:s,panel:c,getData:()=>Hn(),kind:a(),group:this.groupPanel,api:this._api});if(this._onWillDrop.fire(d),d.defaultPrevented)return;const h=Hn();if(h&&h.viewId===this.accessor.id){if(e==="content"&&h.groupId===this.id&&(s==="center"||h.panelId===null)||e==="header"&&h.groupId===this.id&&h.panelId===null)return;if(h.panelId===null){const{groupId:E}=h;this._onMove.fire({target:s,groupId:E,index:l});return}if(this.tabsContainer.indexOf(h.panelId)!==-1&&this.tabsContainer.size===1)return;const{groupId:w,panelId:v}=h;if(this.id===w&&!s&&this.tabsContainer.indexOf(v)===l)return;this._onMove.fire({target:s,groupId:h.groupId,itemId:h.panelId,index:l})}else this._onDidDrop.fire(new Uh({nativeEvent:n,position:s,panel:c,getData:()=>Hn(),group:this.groupPanel,api:this._api}))}updateDragAndDropState(){this.tabsContainer.updateDragAndDropState()}dispose(){var e,n,s;super.dispose(),(e=this.watermark)===null||e===void 0||e.element.remove(),(s=(n=this.watermark)===null||n===void 0?void 0:n.dispose)===null||s===void 0||s.call(n),this.watermark=void 0;for(const l of this.panels)l.dispose();this.tabsContainer.dispose(),this.contentContainer.dispose()}}class $h extends wv{constructor(e,n,s){super(e,n),this._onDidConstraintsChangeInternal=new U,this.onDidConstraintsChangeInternal=this._onDidConstraintsChangeInternal.event,this._onDidConstraintsChange=new U,this.onDidConstraintsChange=this._onDidConstraintsChange.event,this._onDidSizeChange=new U,this.onDidSizeChange=this._onDidSizeChange.event,this.addDisposables(this._onDidConstraintsChangeInternal,this._onDidConstraintsChange,this._onDidSizeChange),s&&this.initialize(s)}setConstraints(e){this._onDidConstraintsChangeInternal.fire(e)}setSize(e){this._onDidSizeChange.fire(e)}}class xv extends jh{get priority(){return this._priority}get snap(){return this._snap}get minimumWidth(){return this.__minimumWidth()}get minimumHeight(){return this.__minimumHeight()}get maximumHeight(){return this.__maximumHeight()}get maximumWidth(){return this.__maximumWidth()}__minimumWidth(){const e=typeof this._minimumWidth=="function"?this._minimumWidth():this._minimumWidth;return e!==this._evaluatedMinimumWidth&&(this._evaluatedMinimumWidth=e,this.updateConstraints()),e}__maximumWidth(){const e=typeof this._maximumWidth=="function"?this._maximumWidth():this._maximumWidth;return e!==this._evaluatedMaximumWidth&&(this._evaluatedMaximumWidth=e,this.updateConstraints()),e}__minimumHeight(){const e=typeof this._minimumHeight=="function"?this._minimumHeight():this._minimumHeight;return e!==this._evaluatedMinimumHeight&&(this._evaluatedMinimumHeight=e,this.updateConstraints()),e}__maximumHeight(){const e=typeof this._maximumHeight=="function"?this._maximumHeight():this._maximumHeight;return e!==this._evaluatedMaximumHeight&&(this._evaluatedMaximumHeight=e,this.updateConstraints()),e}get isActive(){return this.api.isActive}get isVisible(){return this.api.isVisible}constructor(e,n,s,l){super(e,n,l??new $h(e,n)),this._evaluatedMinimumWidth=0,this._evaluatedMaximumWidth=Number.MAX_SAFE_INTEGER,this._evaluatedMinimumHeight=0,this._evaluatedMaximumHeight=Number.MAX_SAFE_INTEGER,this._minimumWidth=0,this._minimumHeight=0,this._maximumWidth=Number.MAX_SAFE_INTEGER,this._maximumHeight=Number.MAX_SAFE_INTEGER,this._snap=!1,this._onDidChange=new U,this.onDidChange=this._onDidChange.event,typeof(s==null?void 0:s.minimumWidth)=="number"&&(this._minimumWidth=s.minimumWidth),typeof(s==null?void 0:s.maximumWidth)=="number"&&(this._maximumWidth=s.maximumWidth),typeof(s==null?void 0:s.minimumHeight)=="number"&&(this._minimumHeight=s.minimumHeight),typeof(s==null?void 0:s.maximumHeight)=="number"&&(this._maximumHeight=s.maximumHeight),this.api.initialize(this),this.addDisposables(this.api.onWillVisibilityChange(a=>{const{isVisible:c}=a,{accessor:d}=this._params;d.setVisible(this,c)}),this.api.onActiveChange(()=>{const{accessor:a}=this._params;a.doSetGroupActive(this)}),this.api.onDidConstraintsChangeInternal(a=>{(typeof a.minimumWidth=="number"||typeof a.minimumWidth=="function")&&(this._minimumWidth=a.minimumWidth),(typeof a.minimumHeight=="number"||typeof a.minimumHeight=="function")&&(this._minimumHeight=a.minimumHeight),(typeof a.maximumWidth=="number"||typeof a.maximumWidth=="function")&&(this._maximumWidth=a.maximumWidth),(typeof a.maximumHeight=="number"||typeof a.maximumHeight=="function")&&(this._maximumHeight=a.maximumHeight)}),this.api.onDidSizeChange(a=>{this._onDidChange.fire({height:a.height,width:a.width})}),this._onDidChange)}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}init(e){e.maximumHeight&&(this._maximumHeight=e.maximumHeight),e.minimumHeight&&(this._minimumHeight=e.minimumHeight),e.maximumWidth&&(this._maximumWidth=e.maximumWidth),e.minimumWidth&&(this._minimumWidth=e.minimumWidth),this._priority=e.priority,this._snap=!!e.snap,super.init(e),typeof e.isVisible=="boolean"&&this.setVisible(e.isVisible)}updateConstraints(){this.api._onDidConstraintsChange.fire({minimumWidth:this._evaluatedMinimumWidth,maximumWidth:this._evaluatedMaximumWidth,minimumHeight:this._evaluatedMinimumHeight,maximumHeight:this._evaluatedMaximumHeight})}toJSON(){const e=super.toJSON(),n=l=>l===Number.MAX_SAFE_INTEGER?void 0:l,s=l=>l<=0?void 0:l;return Object.assign(Object.assign({},e),{minimumHeight:s(this.minimumHeight),maximumHeight:n(this.maximumHeight),minimumWidth:s(this.minimumWidth),maximumWidth:n(this.maximumWidth),snap:this.snap,priority:this.priority})}}const Rl="dockview: DockviewGroupPanelApiImpl not initialized";class pS extends $h{get location(){if(!this._group)throw new Error(Rl);return this._group.model.location}constructor(e,n){super(e,"__dockviewgroup__"),this.accessor=n,this._onDidLocationChange=new U,this.onDidLocationChange=this._onDidLocationChange.event,this._onDidActivePanelChange=new U,this.onDidActivePanelChange=this._onDidActivePanelChange.event,this.addDisposables(this._onDidLocationChange,this._onDidActivePanelChange,this._onDidVisibilityChange.event(s=>{s.isVisible&&this._pendingSize&&(super.setSize(this._pendingSize),this._pendingSize=void 0)}))}setSize(e){this._pendingSize=Object.assign({},e),super.setSize(e)}close(){if(this._group)return this.accessor.removeGroup(this._group)}getWindow(){return this.location.type==="popout"?this.location.getWindow():window}moveTo(e){var n,s,l,a;if(!this._group)throw new Error(Rl);const c=(n=e.group)!==null&&n!==void 0?n:this.accessor.addGroup({direction:Hy((s=e.position)!==null&&s!==void 0?s:"right"),skipSetActive:(l=e.skipSetActive)!==null&&l!==void 0?l:!1});this.accessor.moveGroupOrPanel({from:{groupId:this._group.id},to:{group:c,position:e.group&&(a=e.position)!==null&&a!==void 0?a:"center",index:e.index},skipSetActive:e.skipSetActive})}maximize(){if(!this._group)throw new Error(Rl);this.location.type==="grid"&&this.accessor.maximizeGroup(this._group)}isMaximized(){if(!this._group)throw new Error(Rl);return this.accessor.isMaximizedGroup(this._group)}exitMaximized(){if(!this._group)throw new Error(Rl);this.isMaximized()&&this.accessor.exitMaximizedGroup()}initialize(e){this._group=e}}const mS=100,gS=100;class km extends xv{get minimumWidth(){var e;if(typeof this._explicitConstraints.minimumWidth=="number")return this._explicitConstraints.minimumWidth;const n=(e=this.activePanel)===null||e===void 0?void 0:e.minimumWidth;return typeof n=="number"?n:super.__minimumWidth()}get minimumHeight(){var e;if(typeof this._explicitConstraints.minimumHeight=="number")return this._explicitConstraints.minimumHeight;const n=(e=this.activePanel)===null||e===void 0?void 0:e.minimumHeight;return typeof n=="number"?n:super.__minimumHeight()}get maximumWidth(){var e;if(typeof this._explicitConstraints.maximumWidth=="number")return this._explicitConstraints.maximumWidth;const n=(e=this.activePanel)===null||e===void 0?void 0:e.maximumWidth;return typeof n=="number"?n:super.__maximumWidth()}get maximumHeight(){var e;if(typeof this._explicitConstraints.maximumHeight=="number")return this._explicitConstraints.maximumHeight;const n=(e=this.activePanel)===null||e===void 0?void 0:e.maximumHeight;return typeof n=="number"?n:super.__maximumHeight()}get panels(){return this._model.panels}get activePanel(){return this._model.activePanel}get size(){return this._model.size}get model(){return this._model}get locked(){return this._model.locked}set locked(e){this._model.locked=e}get header(){return this._model.header}constructor(e,n,s){var l,a,c,d,h,m;super(n,"groupview_default",{minimumHeight:(a=(l=s.constraints)===null||l===void 0?void 0:l.minimumHeight)!==null&&a!==void 0?a:gS,minimumWidth:(d=(c=s.constraints)===null||c===void 0?void 0:c.minimumWidth)!==null&&d!==void 0?d:mS,maximumHeight:(h=s.constraints)===null||h===void 0?void 0:h.maximumHeight,maximumWidth:(m=s.constraints)===null||m===void 0?void 0:m.maximumWidth},new pS(n,e)),this._explicitConstraints={},this.api.initialize(this),this._model=new fS(this.element,e,n,s,this),this.addDisposables(this.model.onDidActivePanelChange(w=>{this.api._onDidActivePanelChange.fire(w)}),this.api.onDidConstraintsChangeInternal(w=>{w.minimumWidth!==void 0&&(this._explicitConstraints.minimumWidth=typeof w.minimumWidth=="function"?w.minimumWidth():w.minimumWidth),w.minimumHeight!==void 0&&(this._explicitConstraints.minimumHeight=typeof w.minimumHeight=="function"?w.minimumHeight():w.minimumHeight),w.maximumWidth!==void 0&&(this._explicitConstraints.maximumWidth=typeof w.maximumWidth=="function"?w.maximumWidth():w.maximumWidth),w.maximumHeight!==void 0&&(this._explicitConstraints.maximumHeight=typeof w.maximumHeight=="function"?w.maximumHeight():w.maximumHeight)}))}focus(){this.api.isActive||this.api.setActive(),super.focus()}initialize(){this._model.initialize()}setActive(e){super.setActive(e),this.model.setActive(e)}layout(e,n){super.layout(e,n),this.model.layout(e,n)}getComponent(){return this._model}toJSON(){return this.model.toJSON()}}const vS={className:"dockview-theme-abyss"};class wS extends $h{get location(){return this.group.api.location}get title(){return this.panel.title}get isGroupActive(){return this.group.isActive}get renderer(){return this.panel.renderer}set group(e){const n=this._group;this._group!==e&&(this._group=e,this._onDidGroupChange.fire({}),this.setupGroupEventListeners(n),this._onDidLocationChange.fire({location:this.group.api.location}))}get group(){return this._group}get tabComponent(){return this._tabComponent}constructor(e,n,s,l,a){super(e.id,l),this.panel=e,this.accessor=s,this._onDidTitleChange=new U,this.onDidTitleChange=this._onDidTitleChange.event,this._onDidActiveGroupChange=new U,this.onDidActiveGroupChange=this._onDidActiveGroupChange.event,this._onDidGroupChange=new U,this.onDidGroupChange=this._onDidGroupChange.event,this._onDidRendererChange=new U,this.onDidRendererChange=this._onDidRendererChange.event,this._onDidLocationChange=new U,this.onDidLocationChange=this._onDidLocationChange.event,this.groupEventsDisposable=new Bn,this._tabComponent=a,this.initialize(e),this._group=n,this.setupGroupEventListeners(),this.addDisposables(this.groupEventsDisposable,this._onDidRendererChange,this._onDidTitleChange,this._onDidGroupChange,this._onDidActiveGroupChange,this._onDidLocationChange)}getWindow(){return this.group.api.getWindow()}moveTo(e){var n,s;this.accessor.moveGroupOrPanel({from:{groupId:this._group.id,panelId:this.panel.id},to:{group:(n=e.group)!==null&&n!==void 0?n:this._group,position:e.group&&(s=e.position)!==null&&s!==void 0?s:"center",index:e.index},skipSetActive:e.skipSetActive})}setTitle(e){this.panel.setTitle(e)}setRenderer(e){this.panel.setRenderer(e)}close(){this.group.model.closePanel(this.panel)}maximize(){this.group.api.maximize()}isMaximized(){return this.group.api.isMaximized()}exitMaximized(){this.group.api.exitMaximized()}setupGroupEventListeners(e){var n;let s=(n=e==null?void 0:e.isActive)!==null&&n!==void 0?n:!1;this.groupEventsDisposable.value=new Re(this.group.api.onDidVisibilityChange(l=>{const a=!l.isVisible&&this.isVisible,c=l.isVisible&&!this.isVisible,d=this.group.model.isPanelActive(this.panel);(a||c&&d)&&this._onDidVisibilityChange.fire(l)}),this.group.api.onDidLocationChange(l=>{this.group===this.panel.group&&this._onDidLocationChange.fire(l)}),this.group.api.onDidActiveChange(()=>{this.group===this.panel.group&&s!==this.isGroupActive&&(s=this.isGroupActive,this._onDidActiveGroupChange.fire({isActive:this.isGroupActive}))}))}}class Lo extends Re{get params(){return this._params}get title(){return this._title}get group(){return this._group}get renderer(){var e;return(e=this._renderer)!==null&&e!==void 0?e:this.accessor.renderer}get minimumWidth(){return this._minimumWidth}get minimumHeight(){return this._minimumHeight}get maximumWidth(){return this._maximumWidth}get maximumHeight(){return this._maximumHeight}constructor(e,n,s,l,a,c,d,h){super(),this.id=e,this.accessor=l,this.containerApi=a,this.view=d,this._renderer=h.renderer,this._group=c,this._minimumWidth=h.minimumWidth,this._minimumHeight=h.minimumHeight,this._maximumWidth=h.maximumWidth,this._maximumHeight=h.maximumHeight,this.api=new wS(this,this._group,l,n,s),this.addDisposables(this.api.onActiveChange(()=>{l.setActivePanel(this)}),this.api.onDidSizeChange(m=>{this.group.api.setSize(m)}),this.api.onDidRendererChange(()=>{this.group.model.rerender(this)}))}init(e){this._params=e.params,this.view.init(Object.assign(Object.assign({},e),{api:this.api,containerApi:this.containerApi})),this.setTitle(e.title)}focus(){const e=new vv;this.api._onWillFocus.fire(e),!e.defaultPrevented&&(this.api.isActive||this.api.setActive())}toJSON(){return{id:this.id,contentComponent:this.view.contentComponent,tabComponent:this.view.tabComponent,params:Object.keys(this._params||{}).length>0?this._params:void 0,title:this.title,renderer:this._renderer,minimumHeight:this._minimumHeight,maximumHeight:this._maximumHeight,minimumWidth:this._minimumWidth,maximumWidth:this._maximumWidth}}setTitle(e){e!==this.title&&(this._title=e,this.api._onDidTitleChange.fire({title:e}))}setRenderer(e){e!==this.renderer&&(this._renderer=e,this.api._onDidRendererChange.fire({renderer:e}))}update(e){var n;this._params=Object.assign(Object.assign({},(n=this._params)!==null&&n!==void 0?n:{}),e.params);for(const s of Object.keys(e.params))e.params[s]===void 0&&delete this._params[s];this.view.update({params:this._params})}updateFromStateModel(e){var n,s,l;this._maximumHeight=e.maximumHeight,this._minimumHeight=e.minimumHeight,this._maximumWidth=e.maximumWidth,this._minimumWidth=e.minimumWidth,this.update({params:(n=e.params)!==null&&n!==void 0?n:{}}),this.setTitle((s=e.title)!==null&&s!==void 0?s:this.id),this.setRenderer((l=e.renderer)!==null&&l!==void 0?l:this.accessor.renderer)}updateParentGroup(e,n){this._group=e,this.api.group=this._group;const s=this._group.model.isPanelActive(this),l=this.group.api.isActive&&s;n!=null&&n.skipSetActive||this.api.isActive!==l&&this.api._onDidActiveChange.fire({isActive:this.group.api.isActive&&s}),this.api.isVisible!==s&&this.api._onDidVisibilityChange.fire({isVisible:s})}runEvents(){const e=this._group.model.isPanelActive(this),n=this.group.api.isActive&&e;this.api.isActive!==n&&this.api._onDidActiveChange.fire({isActive:this.group.api.isActive&&e}),this.api.isVisible!==e&&this.api._onDidVisibilityChange.fire({isVisible:e})}layout(e,n){this.api._onDidDimensionChange.fire({width:e,height:n}),this.view.layout(e,n)}dispose(){this.api.dispose(),this.view.dispose()}}class Om extends Re{get element(){return this._element}constructor(){super(),this._element=document.createElement("div"),this._element.className="dv-default-tab",this._content=document.createElement("div"),this._content.className="dv-default-tab-content",this.action=document.createElement("div"),this.action.className="dv-default-tab-action",this.action.appendChild(rS()),this._element.appendChild(this._content),this._element.appendChild(this.action),this.render()}init(e){this._title=e.title,this.addDisposables(e.api.onDidTitleChange(n=>{this._title=n.title,this.render()}),Be(this.action,"pointerdown",n=>{n.preventDefault()}),Be(this.action,"click",n=>{n.defaultPrevented||(n.preventDefault(),e.api.close())})),this.render()}render(){var e;this._content.textContent!==this._title&&(this._content.textContent=(e=this._title)!==null&&e!==void 0?e:"")}}class Ev{get content(){return this._content}get tab(){return this._tab}constructor(e,n,s,l){this.accessor=e,this.id=n,this.contentComponent=s,this.tabComponent=l,this._content=this.createContentComponent(this.id,s),this._tab=this.createTabComponent(this.id,l)}createTabRenderer(e){var n;const s=this.createTabComponent(this.id,this.tabComponent);return this._params&&s.init(Object.assign(Object.assign({},this._params),{tabLocation:e})),this._updateEvent&&((n=s.update)===null||n===void 0||n.call(s,this._updateEvent)),s}init(e){this._params=e,this.content.init(e),this.tab.init(Object.assign(Object.assign({},e),{tabLocation:"header"}))}layout(e,n){var s,l;(l=(s=this.content).layout)===null||l===void 0||l.call(s,e,n)}update(e){var n,s,l,a;this._updateEvent=e,(s=(n=this.content).update)===null||s===void 0||s.call(n,e),(a=(l=this.tab).update)===null||a===void 0||a.call(l,e)}dispose(){var e,n,s,l;(n=(e=this.content).dispose)===null||n===void 0||n.call(e),(l=(s=this.tab).dispose)===null||l===void 0||l.call(s)}createContentComponent(e,n){return this.accessor.options.createComponent({id:e,name:n})}createTabComponent(e,n){const s=n??this.accessor.options.defaultTabComponent;if(s){if(this.accessor.options.createTabComponent){const l=this.accessor.options.createTabComponent({id:e,name:s});return l||new Om}console.warn(`dockview: tabComponent '${n}' was not found. falling back to the default tab.`)}return new Om}}class _S{constructor(e){this.accessor=e}fromJSON(e,n){var s,l;const a=e.id,c=e.params,d=e.title,h=e.view,m=h?h.content.id:(s=e.contentComponent)!==null&&s!==void 0?s:"unknown",w=h?(l=h.tab)===null||l===void 0?void 0:l.id:e.tabComponent,v=new Ev(this.accessor,a,m,w),S=new Lo(a,m,w,this.accessor,new Bu(this.accessor),n,v,{renderer:e.renderer,minimumWidth:e.minimumWidth,minimumHeight:e.minimumHeight,maximumWidth:e.maximumWidth,maximumHeight:e.maximumHeight});return S.init({title:d??a,params:c??{}}),S}}class yS extends Re{get element(){return this._element}constructor(){super(),this._element=document.createElement("div"),this._element.className="dv-watermark"}init(e){}}class SS{constructor(){this._orderedList=[]}push(e){this._orderedList=[...this._orderedList.filter(n=>n!==e),e],this.update()}destroy(e){this._orderedList=this._orderedList.filter(n=>n!==e),this.update()}update(){for(let e=0;e{let a=null;const c=Hu();s.value=new Re({dispose:()=>{c.release()}},Be(window,"pointermove",d=>{const h=this.options.container.getBoundingClientRect(),m=d.clientX-h.left,w=d.clientY-h.top;Ne(this._element,"dv-resize-container-dragging",!0);const v=this._element.getBoundingClientRect();a===null&&(a={x:d.clientX-v.left,y:d.clientY-v.top});const S=Math.max(0,this.getMinimumWidth(v.width)),E=Math.max(0,this.getMinimumHeight(v.height)),A=_t(w-a.y,-E,Math.max(0,h.height-v.height+E)),D=_t(a.y-w+h.height-v.height,-E,Math.max(0,h.height-v.height+E)),P=_t(m-a.x,-S,Math.max(0,h.width-v.width+S)),R=_t(a.x-m+h.width-v.width,-S,Math.max(0,h.width-v.width+S)),O={};A<=D?O.top=A:O.bottom=D,P<=R?O.left=P:O.right=R,this.setBounds(O)}),Be(window,"pointerup",()=>{Ne(this._element,"dv-resize-container-dragging",!1),s.dispose(),this._onDidChangeEnd.fire()}))};this.addDisposables(s,Be(e,"pointerdown",a=>{if(a.defaultPrevented){a.preventDefault();return}Pm(a)||l()}),Be(this.options.content,"pointerdown",a=>{a.defaultPrevented||Pm(a)||a.shiftKey&&l()}),Be(this.options.content,"pointerdown",()=>{yu.push(this._element)},!0)),n.inDragMode&&l()}setupResize(e){const n=document.createElement("div");n.className=`dv-resize-handle-${e}`,this._element.appendChild(n);const s=new Bn;this.addDisposables(s,Be(n,"pointerdown",l=>{l.preventDefault();let a=null;const c=Hu();s.value=new Re(Be(window,"pointermove",d=>{const h=this.options.container.getBoundingClientRect(),m=this._element.getBoundingClientRect(),w=d.clientY-h.top,v=d.clientX-h.left;a===null&&(a={originalY:w,originalHeight:m.height,originalX:v,originalWidth:m.width});let S,E,A,D,P,R;const O=()=>{const $=a.originalY+a.originalHeight>h.height?Math.max(0,h.height-ys.MINIMUM_HEIGHT):Math.max(0,a.originalY+a.originalHeight-ys.MINIMUM_HEIGHT);S=_t(w,0,$),A=a.originalY+a.originalHeight-S,E=h.height-S-A},M=()=>{S=a.originalY-a.originalHeight;const $=S<0&&typeof this.options.minimumInViewportHeight=="number"?-S+this.options.minimumInViewportHeight:ys.MINIMUM_HEIGHT,K=h.height-Math.max(0,S);A=_t(w-S,$,K),E=h.height-S-A},N=()=>{const $=a.originalX+a.originalWidth>h.width?Math.max(0,h.width-ys.MINIMUM_WIDTH):Math.max(0,a.originalX+a.originalWidth-ys.MINIMUM_WIDTH);D=_t(v,0,$),R=a.originalX+a.originalWidth-D,P=h.width-D-R},Z=()=>{D=a.originalX-a.originalWidth;const $=D<0&&typeof this.options.minimumInViewportWidth=="number"?-D+this.options.minimumInViewportWidth:ys.MINIMUM_WIDTH,K=h.width-Math.max(0,D);R=_t(v-D,$,K),P=h.width-D-R};switch(e){case"top":O();break;case"bottom":M();break;case"left":N();break;case"right":Z();break;case"topleft":O(),N();break;case"topright":O(),Z();break;case"bottomleft":M(),N();break;case"bottomright":M(),Z();break}const G={};S<=E?G.top=S:G.bottom=E,D<=P?G.left=D:G.right=P,G.height=A,G.width=R,this.setBounds(G)}),{dispose:()=>{c.release()}},Be(window,"pointerup",()=>{s.dispose(),this._onDidChangeEnd.fire()}))}))}getMinimumWidth(e){return typeof this.options.minimumInViewportWidth=="number"?e-this.options.minimumInViewportWidth:0}getMinimumHeight(e){return typeof this.options.minimumInViewportHeight=="number"?e-this.options.minimumInViewportHeight:0}dispose(){yu.destroy(this._element),this._element.remove(),super.dispose()}}ys.MINIMUM_HEIGHT=20;ys.MINIMUM_WIDTH=20;class DS extends Re{constructor(e,n){super(),this.group=e,this.overlay=n,this.addDisposables(n)}position(e){this.overlay.setBounds(e)}}const Su=100,gr={left:100,top:100,width:300,height:300},CS=100;class xS{constructor(){this.cache=new Map,this.currentFrameId=0,this.rafId=null}getPosition(e){const n=this.cache.get(e);if(n&&n.frameId===this.currentFrameId)return n.rect;this.scheduleFrameUpdate();const s=ch(e);return this.cache.set(e,{rect:s,frameId:this.currentFrameId}),s}invalidate(){this.currentFrameId++}scheduleFrameUpdate(){this.rafId||(this.rafId=requestAnimationFrame(()=>{this.currentFrameId++,this.rafId=null}))}}function ES(){const r=document.createElement("div");return r.tabIndex=-1,r}class Tm extends Re{constructor(e,n){super(),this.element=e,this.accessor=n,this.map={},this._disposed=!1,this.positionCache=new xS,this.pendingUpdates=new Set,this.addDisposables(Qt.from(()=>{for(const s of Object.values(this.map))s.disposable.dispose(),s.destroy.dispose();this._disposed=!0}))}updateAllPositions(){if(!this._disposed){this.positionCache.invalidate();for(const e of Object.values(this.map))e.panel.api.isVisible&&e.resize&&e.resize()}}detatch(e){if(this.map[e.api.id]){const{disposable:n,destroy:s}=this.map[e.api.id];return n.dispose(),s.dispose(),delete this.map[e.api.id],!0}return!1}attach(e){const{panel:n,referenceContainer:s}=e;if(!this.map[n.api.id]){const w=ES();w.className="dv-render-overlay",this.map[n.api.id]={panel:n,disposable:Qt.NONE,destroy:Qt.NONE,element:w}}const l=this.map[n.api.id].element;n.view.content.element.parentElement!==l&&l.appendChild(n.view.content.element),l.parentElement!==this.element&&this.element.appendChild(l);const a=()=>{const w=n.api.id;this.pendingUpdates.has(w)||(this.pendingUpdates.add(w),requestAnimationFrame(()=>{if(this.pendingUpdates.delete(w),this.isDisposed||!this.map[w])return;const v=this.positionCache.getPosition(s.element),S=this.positionCache.getPosition(this.element),E=v.left-S.left,A=v.top-S.top,D=v.width,P=v.height;l.style.left=`${E}px`,l.style.top=`${A}px`,l.style.width=`${D}px`,l.style.height=`${P}px`,Ne(l,"dv-render-overlay-float",n.group.api.location.type==="floating")}))},c=()=>{n.api.isVisible&&(this.positionCache.invalidate(),a()),l.style.display=n.api.isVisible?"":"none"},d=new Bn,h=()=>{n.api.location.type==="floating"?queueMicrotask(()=>{const w=this.accessor.floatingGroups.find(A=>A.group===n.api.group);if(!w)return;const v=w.overlay.element,S=()=>{const A=Number(v.getAttribute("aria-level"));l.style.zIndex=`calc(var(--dv-overlay-z-index, 999) + ${A*2+1})`},E=new MutationObserver(()=>{S()});d.value=Qt.from(()=>E.disconnect()),E.observe(v,{attributeFilter:["aria-level"],attributes:!0}),S()}):l.style.zIndex=""},m=new Re(d,new gv(l,{onDragEnd:w=>{s.dropTarget.dnd.onDragEnd(w)},onDragEnter:w=>{s.dropTarget.dnd.onDragEnter(w)},onDragLeave:w=>{s.dropTarget.dnd.onDragLeave(w)},onDrop:w=>{s.dropTarget.dnd.onDrop(w)},onDragOver:w=>{s.dropTarget.dnd.onDragOver(w)}}),n.api.onDidVisibilityChange(()=>{c()}),n.api.onDidDimensionsChange(()=>{n.api.isVisible&&a()}),n.api.onDidLocationChange(()=>{h()}));return this.map[n.api.id].destroy=Qt.from(()=>{var w;n.view.content.element.parentElement===l&&l.removeChild(n.view.content.element),(w=l.parentElement)===null||w===void 0||w.removeChild(l)}),h(),queueMicrotask(()=>{this.isDisposed||c()}),this.map[n.api.id].disposable.dispose(),this.map[n.api.id].disposable=m,this.map[n.api.id].resize=a,l}}var bS=function(r,e,n,s){function l(a){return a instanceof n?a:new n(function(c){c(a)})}return new(n||(n=Promise))(function(a,c){function d(w){try{m(s.next(w))}catch(v){c(v)}}function h(w){try{m(s.throw(w))}catch(v){c(v)}}function m(w){w.done?a(w.value):l(w.value).then(d,h)}m((s=s.apply(r,e||[])).next())})};class PS extends Re{get window(){var e,n;return(n=(e=this._window)===null||e===void 0?void 0:e.value)!==null&&n!==void 0?n:null}constructor(e,n,s){super(),this.target=e,this.className=n,this.options=s,this._onWillClose=new U,this.onWillClose=this._onWillClose.event,this._onDidClose=new U,this.onDidClose=this._onDidClose.event,this._window=null,this.addDisposables(this._onWillClose,this._onDidClose,{dispose:()=>{this.close()}})}dimensions(){if(!this._window)return null;const e=this._window.value.screenX,n=this._window.value.screenY,s=this._window.value.innerWidth,l=this._window.value.innerHeight;return{top:n,left:e,width:s,height:l}}close(){var e,n;this._window&&(this._onWillClose.fire(),(n=(e=this.options).onWillClose)===null||n===void 0||n.call(e,{id:this.target,window:this._window.value}),this._window.disposable.dispose(),this._window=null,this._onDidClose.fire())}open(){var e,n;return bS(this,void 0,void 0,function*(){if(this._window)throw new Error("instance of popout window is already open");const s=`${this.options.url}`,l=Object.entries({top:this.options.top,left:this.options.left,width:this.options.width,height:this.options.height}).map(([h,m])=>`${h}=${m}`).join(","),a=window.open(s,this.target,l);if(!a)return null;const c=new Re;this._window={value:a,disposable:c},c.addDisposables(Qt.from(()=>{a.close()}),Be(window,"beforeunload",()=>{this.close()}));const d=this.createPopoutWindowContainer();return this.className&&d.classList.add(this.className),(n=(e=this.options).onDidOpen)===null||n===void 0||n.call(e,{id:this.target,window:a}),new Promise((h,m)=>{a.addEventListener("unload",w=>{}),a.addEventListener("load",()=>{try{const w=a.document;w.title=document.title,w.body.appendChild(d),yy(w,window.document.styleSheets),Be(a,"beforeunload",()=>{this.close()}),h(d)}catch(w){m(w)}})})})}createPopoutWindowContainer(){const e=document.createElement("div");return e.classList.add("dv-popout-window"),e.id="dv-popout-window",e.style.position="absolute",e.style.width="100%",e.style.height="100%",e.style.top="0px",e.style.left="0px",e}}class AS extends Re{constructor(e){super(),this.accessor=e,this.init()}init(){const e=new Set,n=new Set;this.addDisposables(this.accessor.onDidAddPanel(s=>{if(e.has(s.api.id))throw new Error(`dockview: Invalid event sequence. [onDidAddPanel] called for panel ${s.api.id} but panel already exists`);e.add(s.api.id)}),this.accessor.onDidRemovePanel(s=>{if(e.has(s.api.id))e.delete(s.api.id);else throw new Error(`dockview: Invalid event sequence. [onDidRemovePanel] called for panel ${s.api.id} but panel does not exists`)}),this.accessor.onDidAddGroup(s=>{if(n.has(s.api.id))throw new Error(`dockview: Invalid event sequence. [onDidAddGroup] called for group ${s.api.id} but group already exists`);n.add(s.api.id)}),this.accessor.onDidRemoveGroup(s=>{if(n.has(s.api.id))n.delete(s.api.id);else throw new Error(`dockview: Invalid event sequence. [onDidRemoveGroup] called for group ${s.api.id} but group does not exists`)}))}}class zS extends Re{constructor(e){super(),this.root=e,this._active=null,this._activeDisposable=new Bn,this._element=document.createElement("div"),this._element.className="dv-popover-anchor",this._element.style.position="relative",this.root.prepend(this._element),this.addDisposables(Qt.from(()=>{this.close()}),this._activeDisposable)}openPopover(e,n){var s;this.close();const l=document.createElement("div");l.style.position="absolute",l.style.zIndex=(s=n.zIndex)!==null&&s!==void 0?s:"var(--dv-overlay-z-index)",l.appendChild(e);const a=this._element.getBoundingClientRect(),c=a.left,d=a.top;l.style.top=`${n.y-d}px`,l.style.left=`${n.x-c}px`,this._element.appendChild(l),this._active=l,this._activeDisposable.value=new Re(Be(window,"pointerdown",h=>{var m;const w=h.target;if(!(w instanceof HTMLElement))return;let v=w;for(;v&&v!==l;)v=(m=v==null?void 0:v.parentElement)!==null&&m!==void 0?m:null;v||this.close()})),requestAnimationFrame(()=>{Ay(l,this.root)})}close(){this._active&&(this._active.remove(),this._activeDisposable.dispose(),this._active=null)}}class Im extends Re{get disabled(){return this._disabled}set disabled(e){var n;this.disabled!==e&&(this._disabled=e,e&&((n=this.model)===null||n===void 0||n.clear()))}get model(){if(!this.disabled)return{clear:()=>{var e;this._model&&((e=this._model.root.parentElement)===null||e===void 0||e.removeChild(this._model.root)),this._model=void 0},exists:()=>!!this._model,getElements:(e,n)=>{const s=this._outline!==n;if(this._outline=n,this._model)return this._model.changed=s,this._model;const l=this.createContainer(),a=this.createAnchor();if(this._model={root:l,overlay:a,changed:s},l.appendChild(a),this.element.appendChild(l),(e==null?void 0:e.target)instanceof HTMLElement){const c=e.target.getBoundingClientRect(),d=this.element.getBoundingClientRect();a.style.left=`${c.left-d.left}px`,a.style.top=`${c.top-d.top}px`}return this._model}}}constructor(e,n){super(),this.element=e,this._disabled=!1,this._disabled=n.disabled,this.addDisposables(Qt.from(()=>{var s;(s=this.model)===null||s===void 0||s.clear()}))}createContainer(){const e=document.createElement("div");return e.className="dv-drop-target-container",e}createAnchor(){const e=document.createElement("div");return e.className="dv-drop-target-anchor",e.style.visibility="hidden",e}}const Nm={activationSize:{type:"pixels",value:10},size:{type:"pixels",value:20}};function Du(r){const e=r.from.activePanel;[...r.from.panels].map(s=>{const l=r.from.model.removePanel(s);return r.from.model.renderContainer.detatch(s),l}).forEach(s=>{r.to.model.openPanel(s,{skipSetActive:e!==s,skipSetGroupActive:!0})})}class kS extends fv{get orientation(){return this.gridview.orientation}get totalPanels(){return this.panels.length}get panels(){return this.groups.flatMap(e=>e.panels)}get options(){return this._options}get activePanel(){const e=this.activeGroup;if(e)return e.activePanel}get renderer(){var e;return(e=this.options.defaultRenderer)!==null&&e!==void 0?e:"onlyWhenVisible"}get api(){return this._api}get floatingGroups(){return this._floatingGroups}get popoutRestorationPromise(){return this._popoutRestorationPromise}constructor(e,n){var s,l,a;super(e,{proportionalLayout:!0,orientation:ze.HORIZONTAL,styles:n.hideBorders?{separatorBorder:"transparent"}:void 0,disableAutoResizing:n.disableAutoResizing,locked:n.locked,margin:(l=(s=n.theme)===null||s===void 0?void 0:s.gap)!==null&&l!==void 0?l:0,className:n.className}),this.nextGroupId=Wh(),this._deserializer=new _S(this),this._watermark=null,this._onWillDragPanel=new U,this.onWillDragPanel=this._onWillDragPanel.event,this._onWillDragGroup=new U,this.onWillDragGroup=this._onWillDragGroup.event,this._onDidDrop=new U,this.onDidDrop=this._onDidDrop.event,this._onWillDrop=new U,this.onWillDrop=this._onWillDrop.event,this._onWillShowOverlay=new U,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onUnhandledDragOverEvent=new U,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,this._onDidRemovePanel=new U,this.onDidRemovePanel=this._onDidRemovePanel.event,this._onDidAddPanel=new U,this.onDidAddPanel=this._onDidAddPanel.event,this._onDidPopoutGroupSizeChange=new U,this.onDidPopoutGroupSizeChange=this._onDidPopoutGroupSizeChange.event,this._onDidPopoutGroupPositionChange=new U,this.onDidPopoutGroupPositionChange=this._onDidPopoutGroupPositionChange.event,this._onDidOpenPopoutWindowFail=new U,this.onDidOpenPopoutWindowFail=this._onDidOpenPopoutWindowFail.event,this._onDidLayoutFromJSON=new U,this.onDidLayoutFromJSON=this._onDidLayoutFromJSON.event,this._onDidActivePanelChange=new U({replay:!0}),this.onDidActivePanelChange=this._onDidActivePanelChange.event,this._onDidMovePanel=new U,this.onDidMovePanel=this._onDidMovePanel.event,this._onDidMaximizedGroupChange=new U,this.onDidMaximizedGroupChange=this._onDidMaximizedGroupChange.event,this._floatingGroups=[],this._popoutGroups=[],this._popoutRestorationPromise=Promise.resolve(),this._onDidRemoveGroup=new U,this.onDidRemoveGroup=this._onDidRemoveGroup.event,this._onDidAddGroup=new U,this.onDidAddGroup=this._onDidAddGroup.event,this._onDidOptionsChange=new U,this.onDidOptionsChange=this._onDidOptionsChange.event,this._onDidActiveGroupChange=new U,this.onDidActiveGroupChange=this._onDidActiveGroupChange.event,this._moving=!1,this._options=n,this.popupService=new zS(this.element),this._themeClassnames=new nc(this.element),this._api=new Bu(this),this.rootDropTargetContainer=new Im(this.element,{disabled:!0}),this.overlayRenderContainer=new Tm(this.gridview.element,this),this._rootDropTarget=new rs(this.element,{className:"dv-drop-target-edge",canDisplayOverlay:(c,d)=>{const h=Hn();if(h)return h.viewId!==this.id?!1:d==="center"?this.gridview.length===0:!0;if(d==="center"&&this.gridview.length!==0)return!1;const m=new Dv(c,"edge",d,Hn);return this._onUnhandledDragOverEvent.fire(m),m.isAccepted},acceptedTargetZones:["top","bottom","left","right","center"],overlayModel:(a=n.rootOverlayModel)!==null&&a!==void 0?a:Nm,getOverrideTarget:()=>{var c;return(c=this.rootDropTargetContainer)===null||c===void 0?void 0:c.model}}),this.updateDropTargetModel(n),Ne(this.gridview.element,"dv-dockview",!0),Ne(this.element,"dv-debug",!!n.debug),this.updateTheme(),this.updateWatermark(),n.debug&&this.addDisposables(new AS(this)),this.addDisposables(this.rootDropTargetContainer,this.overlayRenderContainer,this._onWillDragPanel,this._onWillDragGroup,this._onWillShowOverlay,this._onDidActivePanelChange,this._onDidAddPanel,this._onDidRemovePanel,this._onDidLayoutFromJSON,this._onDidDrop,this._onWillDrop,this._onDidMovePanel,this._onDidMovePanel.event(()=>{this.debouncedUpdateAllPositions()}),this._onDidAddGroup,this._onDidRemoveGroup,this._onDidActiveGroupChange,this._onUnhandledDragOverEvent,this._onDidMaximizedGroupChange,this._onDidOptionsChange,this._onDidPopoutGroupSizeChange,this._onDidPopoutGroupPositionChange,this._onDidOpenPopoutWindowFail,this.onDidViewVisibilityChangeMicroTaskQueue(()=>{this.updateWatermark()}),this.onDidAdd(c=>{this._moving||this._onDidAddGroup.fire(c)}),this.onDidRemove(c=>{this._moving||this._onDidRemoveGroup.fire(c)}),this.onDidActiveChange(c=>{this._moving||this._onDidActiveGroupChange.fire(c)}),this.onDidMaximizedChange(c=>{this._onDidMaximizedGroupChange.fire({group:c.panel,isMaximized:c.isMaximized})}),Jr.any(this.onDidAdd,this.onDidRemove)(()=>{this.updateWatermark()}),Jr.any(this.onDidAddPanel,this.onDidRemovePanel,this.onDidAddGroup,this.onDidRemove,this.onDidMovePanel,this.onDidActivePanelChange,this.onDidPopoutGroupPositionChange,this.onDidPopoutGroupSizeChange)(()=>{this._bufferOnDidLayoutChange.fire()}),Qt.from(()=>{for(const c of[...this._floatingGroups])c.dispose();for(const c of[...this._popoutGroups])c.disposable.dispose()}),this._rootDropTarget,this._rootDropTarget.onWillShowOverlay(c=>{this.gridview.length>0&&c.position==="center"||this._onWillShowOverlay.fire(new ic(c,{kind:"edge",panel:void 0,api:this._api,group:void 0,getData:Hn}))}),this._rootDropTarget.onDrop(c=>{var d;const h=new Cv({nativeEvent:c.nativeEvent,position:c.position,panel:void 0,api:this._api,group:void 0,getData:Hn,kind:"edge"});if(this._onWillDrop.fire(h),h.defaultPrevented)return;const m=Hn();m?this.moveGroupOrPanel({from:{groupId:m.groupId,panelId:(d=m.panelId)!==null&&d!==void 0?d:void 0},to:{group:this.orthogonalize(c.position),position:"center"}}):this._onDidDrop.fire(new Uh({nativeEvent:c.nativeEvent,position:c.position,panel:void 0,api:this._api,group:void 0,getData:Hn}))}),this._rootDropTarget)}setVisible(e,n){switch(e.api.location.type){case"grid":super.setVisible(e,n);break;case"floating":{const s=this.floatingGroups.find(l=>l.group===e);s&&(s.overlay.setVisible(n),e.api._onDidVisibilityChange.fire({isVisible:n}));break}case"popout":console.warn("dockview: You cannot hide a group that is in a popout window");break}}addPopoutGroup(e,n){var s,l,a,c,d;if(e instanceof Lo&&e.group.size===1)return this.addPopoutGroup(e.group,n);const h=xy(this.gridview.element),m=this.element;function w(){return n!=null&&n.position?n.position:e instanceof km?e.element.getBoundingClientRect():e.group?e.group.element.getBoundingClientRect():m.getBoundingClientRect()}const v=w(),S=(l=(s=n==null?void 0:n.overridePopoutGroup)===null||s===void 0?void 0:s.id)!==null&&l!==void 0?l:this.getNextGroupId(),E=new PS(`${this.id}-${S}`,h??"",{url:(d=(a=n==null?void 0:n.popoutUrl)!==null&&a!==void 0?a:(c=this.options)===null||c===void 0?void 0:c.popoutUrl)!==null&&d!==void 0?d:"/popout.html",left:window.screenX+v.left,top:window.screenY+v.top,width:v.width,height:v.height,onDidOpen:n==null?void 0:n.onDidOpen,onWillClose:n==null?void 0:n.onWillClose}),A=new Re(E,E.onDidClose(()=>{A.dispose()}));return E.open().then(D=>{var P;if(E.isDisposed)return!1;const R=n!=null&&n.referenceGroup?n.referenceGroup:e instanceof Lo?e.group:e,O=e.api.location.type,M=R.element.parentElement!==null;let N;if(M?n!=null&&n.overridePopoutGroup?N=n.overridePopoutGroup:(N=this.createGroup({id:S}),D&&this._onDidAddGroup.fire(N)):N=R,D===null)return console.error("dockview: failed to create popout. perhaps you need to allow pop-ups for this website"),A.dispose(),this._onDidOpenPopoutWindowFail.fire(),this.movingLock(()=>Du({from:N,to:R})),R.api.isVisible||R.api.setVisible(!0),!1;const Z=document.createElement("div");Z.className="dv-overlay-render-container";const G=new Tm(Z,this);N.model.renderContainer=G,N.layout(E.window.innerWidth,E.window.innerHeight);let $;if(!(n!=null&&n.overridePopoutGroup)&&M)if(e instanceof Lo)this.movingLock(()=>{const ce=R.model.removePanel(e);N.model.openPanel(ce)});else switch(this.movingLock(()=>Du({from:R,to:N})),O){case"grid":R.api.setVisible(!1);break;case"floating":case"popout":$=(P=this._floatingGroups.find(ce=>ce.group.api.id===e.api.id))===null||P===void 0?void 0:P.overlay.toJSON(),this.removeGroup(R);break}D.classList.add("dv-dockview"),D.style.overflow="hidden",D.appendChild(Z),D.appendChild(N.element);const K=document.createElement("div"),he=new Im(K,{disabled:this.rootDropTargetContainer.disabled});D.appendChild(K),N.model.dropTargetContainer=he,N.model.location={type:"popout",getWindow:()=>E.window,popoutUrl:n==null?void 0:n.popoutUrl},M&&e.api.location.type==="grid"&&e.api.setVisible(!1),this.doSetGroupAndPanelActive(N),A.addDisposables(N.api.onDidActiveChange(ce=>{var j;ce.isActive&&((j=E.window)===null||j===void 0||j.focus())}),N.api.onWillFocus(()=>{var ce;(ce=E.window)===null||ce===void 0||ce.focus()}));let ue;const Q=M&&R&&this.getPanel(R.id),ve={window:E,popoutGroup:N,referenceGroup:Q?R.id:void 0,disposable:{dispose:()=>(A.dispose(),ue)}},ie=by(E.window);return A.addDisposables(ie,Py(E.window,()=>{this._onDidPopoutGroupSizeChange.fire({width:E.window.innerWidth,height:E.window.innerHeight,group:N})}),ie.event(()=>{this._onDidPopoutGroupPositionChange.fire({screenX:E.window.screenX,screenY:E.window.screenX,group:N})}),Be(E.window,"resize",()=>{N.layout(E.window.innerWidth,E.window.innerHeight)}),G,Qt.from(()=>{if(!this.isDisposed){if(M&&this.getPanel(R.id))this.movingLock(()=>Du({from:N,to:R})),R.api.isVisible||R.api.setVisible(!0),this.getPanel(N.id)&&this.doRemoveGroup(N,{skipPopoutAssociated:!0});else if(this.getPanel(N.id)){if(N.model.renderContainer=this.overlayRenderContainer,N.model.dropTargetContainer=this.rootDropTargetContainer,ue=N,!this._popoutGroups.find(j=>j.popoutGroup===N))return;$?this.addFloatingGroup(N,{height:$.height,width:$.width,position:$}):(this.doRemoveGroup(N,{skipDispose:!0,skipActive:!0,skipPopoutReturn:!0}),N.model.location={type:"grid"},this.movingLock(()=>{this.doAddGroup(N,[0])})),this.doSetGroupAndPanelActive(N)}}})),this._popoutGroups.push(ve),this.updateWatermark(),!0}).catch(D=>(console.error("dockview: failed to create popout.",D),!1))}addFloatingGroup(e,n){var s,l,a,c,d;let h;if(e instanceof Lo)h=this.createGroup(),this._onDidAddGroup.fire(h),this.movingLock(()=>this.removePanel(e,{removeEmptyGroup:!0,skipDispose:!0,skipSetActiveGroup:!0})),this.movingLock(()=>h.model.openPanel(e,{skipSetGroupActive:!0}));else{h=e;const D=(s=this._popoutGroups.find(O=>O.popoutGroup===h))===null||s===void 0?void 0:s.referenceGroup,P=D?this.getPanel(D):void 0;typeof(n==null?void 0:n.skipRemoveGroup)=="boolean"&&n.skipRemoveGroup||(P?(this.movingLock(()=>Du({from:e,to:P})),this.doRemoveGroup(e,{skipPopoutReturn:!0,skipPopoutAssociated:!0}),this.doRemoveGroup(P,{skipDispose:!0}),h=P):this.doRemoveGroup(e,{skipDispose:!0,skipPopoutReturn:!0,skipPopoutAssociated:!1}))}function m(){if(n!=null&&n.position){const D={};return"left"in n.position?D.left=Math.max(n.position.left,0):"right"in n.position?D.right=Math.max(n.position.right,0):D.left=gr.left,"top"in n.position?D.top=Math.max(n.position.top,0):"bottom"in n.position?D.bottom=Math.max(n.position.bottom,0):D.top=gr.top,typeof n.width=="number"?D.width=Math.max(n.width,0):D.width=gr.width,typeof n.height=="number"?D.height=Math.max(n.height,0):D.height=gr.height,D}return{left:typeof(n==null?void 0:n.x)=="number"?Math.max(n.x,0):gr.left,top:typeof(n==null?void 0:n.y)=="number"?Math.max(n.y,0):gr.top,width:typeof(n==null?void 0:n.width)=="number"?Math.max(n.width,0):gr.width,height:typeof(n==null?void 0:n.height)=="number"?Math.max(n.height,0):gr.height}}const w=m(),v=new ys(Object.assign(Object.assign({container:this.gridview.element,content:h.element},w),{minimumInViewportWidth:this.options.floatingGroupBounds==="boundedWithinViewport"?void 0:(a=(l=this.options.floatingGroupBounds)===null||l===void 0?void 0:l.minimumWidthWithinViewport)!==null&&a!==void 0?a:Su,minimumInViewportHeight:this.options.floatingGroupBounds==="boundedWithinViewport"?void 0:(d=(c=this.options.floatingGroupBounds)===null||c===void 0?void 0:c.minimumHeightWithinViewport)!==null&&d!==void 0?d:Su})),S=h.element.querySelector(".dv-void-container");if(!S)throw new Error("dockview: failed to find drag handle");v.setupDrag(S,{inDragMode:typeof(n==null?void 0:n.inDragMode)=="boolean"?n.inDragMode:!1});const E=new DS(h,v),A=new Re(h.api.onDidActiveChange(D=>{D.isActive&&v.bringToFront()}),ec(h.element,D=>{const{width:P,height:R}=D.contentRect;h.layout(P,R)}));E.addDisposables(v.onDidChange(()=>{h.layout(h.width,h.height)}),v.onDidChangeEnd(()=>{this._bufferOnDidLayoutChange.fire()}),h.onDidChange(D=>{v.setBounds({height:D==null?void 0:D.height,width:D==null?void 0:D.width})}),{dispose:()=>{A.dispose(),Bd(this._floatingGroups,E),h.model.location={type:"grid"},this.updateWatermark()}}),this._floatingGroups.push(E),h.model.location={type:"floating"},n!=null&&n.skipActiveGroup||this.doSetGroupAndPanelActive(h),this.updateWatermark()}orthogonalize(e,n){switch(this.gridview.normalize(),e){case"top":case"bottom":this.gridview.orientation===ze.HORIZONTAL&&this.gridview.insertOrthogonalSplitviewAtRoot();break;case"left":case"right":this.gridview.orientation===ze.VERTICAL&&this.gridview.insertOrthogonalSplitviewAtRoot();break}switch(e){case"top":case"left":case"center":return this.createGroupAtLocation([0],void 0,n);case"bottom":case"right":return this.createGroupAtLocation([this.gridview.length],void 0,n);default:throw new Error(`dockview: unsupported position ${e}`)}}updateOptions(e){var n,s;if(super.updateOptions(e),"floatingGroupBounds"in e)for(const c of this._floatingGroups){switch(e.floatingGroupBounds){case"boundedWithinViewport":c.overlay.minimumInViewportHeight=void 0,c.overlay.minimumInViewportWidth=void 0;break;case void 0:c.overlay.minimumInViewportHeight=Su,c.overlay.minimumInViewportWidth=Su;break;default:c.overlay.minimumInViewportHeight=(n=e.floatingGroupBounds)===null||n===void 0?void 0:n.minimumHeightWithinViewport,c.overlay.minimumInViewportWidth=(s=e.floatingGroupBounds)===null||s===void 0?void 0:s.minimumWidthWithinViewport}c.overlay.setBounds()}this.updateDropTargetModel(e);const l=this.options.disableDnd;this._options=Object.assign(Object.assign({},this.options),e);const a=this.options.disableDnd;l!==a&&this.updateDragAndDropState(),"theme"in e&&this.updateTheme(),this.layout(this.gridview.width,this.gridview.height,!0)}layout(e,n,s){if(super.layout(e,n,s),this._floatingGroups)for(const l of this._floatingGroups)l.overlay.setBounds()}updateDragAndDropState(){for(const e of this.groups)e.model.updateDragAndDropState()}focus(){var e;(e=this.activeGroup)===null||e===void 0||e.focus()}getGroupPanel(e){return this.panels.find(n=>n.id===e)}setActivePanel(e){e.group.model.openPanel(e),this.doSetGroupAndPanelActive(e.group)}moveToNext(e={}){var n;if(!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}if(e.includePanel&&e.group&&e.group.activePanel!==e.group.panels[e.group.panels.length-1]){e.group.model.moveToNext({suppressRoll:!0});return}const s=zt(e.group.element),l=(n=this.gridview.next(s))===null||n===void 0?void 0:n.view;this.doSetGroupAndPanelActive(l)}moveToPrevious(e={}){var n;if(!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}if(e.includePanel&&e.group&&e.group.activePanel!==e.group.panels[0]){e.group.model.moveToPrevious({suppressRoll:!0});return}const s=zt(e.group.element),l=(n=this.gridview.previous(s))===null||n===void 0?void 0:n.view;l&&this.doSetGroupAndPanelActive(l)}toJSON(){var e;const n=this.gridview.serialize(),s=this.panels.reduce((d,h)=>(d[h.id]=h.toJSON(),d),{}),l=this._floatingGroups.map(d=>({data:d.group.toJSON(),position:d.overlay.toJSON()})),a=this._popoutGroups.map(d=>({data:d.popoutGroup.toJSON(),gridReferenceGroup:d.referenceGroup,position:d.window.dimensions(),url:d.popoutGroup.api.location.type==="popout"?d.popoutGroup.api.location.popoutUrl:void 0})),c={grid:n,panels:s,activeGroup:(e=this.activeGroup)===null||e===void 0?void 0:e.id};return l.length>0&&(c.floatingGroups=l),a.length>0&&(c.popoutGroups=a),c}fromJSON(e,n){var s,l;const a=new Map;let c;if(n!=null&&n.reuseExistingPanels){c=this.createGroup(),this._groups.delete(c.api.id);const w=Object.keys(e.panels);for(const v of this.panels)w.includes(v.api.id)&&a.set(v.api.id,v);this.movingLock(()=>{Array.from(a.values()).forEach(v=>{this.moveGroupOrPanel({from:{groupId:v.api.group.api.id,panelId:v.api.id},to:{group:c,position:"center"},keepEmptyGroups:!0})})})}if(this.clear(),typeof e!="object"||e===null)throw new Error("dockview: serialized layout must be a non-null object");const{grid:d,panels:h,activeGroup:m}=e;if(d.root.type!=="branch"||!Array.isArray(d.root.data))throw new Error("dockview: root must be of type branch");try{const w=this.width,v=this.height,S=P=>{const{id:R,locked:O,hideHeader:M,views:N,activeView:Z}=P;if(typeof R!="string")throw new Error("dockview: group id must be of type string");const G=this.createGroup({id:R,locked:!!O,hideHeader:!!M});this._onDidAddGroup.fire(G);const $=[];for(const K of N){const he=a.get(K);if(c&&he)this.movingLock(()=>{c.model.removePanel(he)}),$.push(he),he.updateFromStateModel(h[K]);else{const ue=this._deserializer.fromJSON(h[K],G);$.push(ue)}}for(let K=0;K{G.model.openPanel(he,{skipSetActive:!ue,skipSetGroupActive:!0})}):G.model.openPanel(he,{skipSetActive:!ue,skipSetGroupActive:!0})}return!G.activePanel&&G.panels.length>0&&G.model.openPanel(G.panels[G.panels.length-1],{skipSetGroupActive:!0}),G};this.gridview.deserialize(d,{fromJSON:P=>S(P.data)}),this.layout(w,v,!0);const E=(s=e.floatingGroups)!==null&&s!==void 0?s:[];for(const P of E){const{data:R,position:O}=P,M=S(R);this.addFloatingGroup(M,{position:O,width:O.width,height:O.height,skipRemoveGroup:!0,inDragMode:!1})}const A=(l=e.popoutGroups)!==null&&l!==void 0?l:[],D=[];A.forEach((P,R)=>{const{data:O,position:M,gridReferenceGroup:N,url:Z}=P,G=S(O),$=new Promise(K=>{setTimeout(()=>{this.addPopoutGroup(G,{position:M??void 0,overridePopoutGroup:N?G:void 0,referenceGroup:N?this.getPanel(N):void 0,popoutUrl:Z}),K()},R*CS)});D.push($)}),this._popoutRestorationPromise=Promise.all(D).then(()=>{});for(const P of this._floatingGroups)P.overlay.setBounds();if(typeof m=="string"){const P=this.getPanel(m);P&&this.doSetGroupAndPanelActive(P)}}catch(w){console.error("dockview: failed to deserialize layout. Reverting changes",w);for(const v of this.groups)for(const S of v.panels)this.removePanel(S,{removeEmptyGroup:!1,skipDispose:!1});for(const v of this.groups)v.dispose(),this._groups.delete(v.id),this._onDidRemoveGroup.fire(v);for(const v of[...this._floatingGroups])v.dispose();throw this.clear(),w}this.updateWatermark(),this.debouncedUpdateAllPositions(),this._onDidLayoutFromJSON.fire()}clear(){const e=Array.from(this._groups.values()).map(s=>s.value),n=!!this.activeGroup;for(const s of e)this.removeGroup(s,{skipActive:!0});n&&this.doSetGroupAndPanelActive(void 0),this.gridview.clear()}closeAllGroups(){for(const e of this._groups.entries()){const[n,s]=e;s.value.model.closeAllPanels()}}addPanel(e){var n,s;if(this.panels.find(h=>h.id===e.id))throw new Error(`dockview: panel with id ${e.id} already exists`);let l;if(e.position&&e.floating)throw new Error("dockview: you can only provide one of: position, floating as arguments to .addPanel(...)");const a={width:e.initialWidth,height:e.initialHeight};let c;if(e.position)if(uS(e.position)){const h=typeof e.position.referencePanel=="string"?this.getGroupPanel(e.position.referencePanel):e.position.referencePanel;if(c=e.position.index,!h)throw new Error(`dockview: referencePanel '${e.position.referencePanel}' does not exist`);l=this.findGroup(h)}else if(cS(e.position)){if(l=typeof e.position.referenceGroup=="string"?(n=this._groups.get(e.position.referenceGroup))===null||n===void 0?void 0:n.value:e.position.referenceGroup,c=e.position.index,!l)throw new Error(`dockview: referenceGroup '${e.position.referenceGroup}' does not exist`)}else{const h=this.orthogonalize(zm(e.position.direction)),m=this.createPanel(e,h);return h.model.openPanel(m,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:c}),e.inactive||this.doSetGroupAndPanelActive(h),h.api.setSize({height:a==null?void 0:a.height,width:a==null?void 0:a.width}),m}else l=this.activeGroup;let d;if(l){const h=ju(((s=e.position)===null||s===void 0?void 0:s.direction)||"within");if(e.floating){const m=this.createGroup();this._onDidAddGroup.fire(m);const w=typeof e.floating=="object"&&e.floating!==null?e.floating:{};this.addFloatingGroup(m,Object.assign(Object.assign({},w),{inDragMode:!1,skipRemoveGroup:!0,skipActiveGroup:!0})),d=this.createPanel(e,m),m.model.openPanel(d,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:c})}else if(l.api.location.type==="floating"||h==="center")d=this.createPanel(e,l),l.model.openPanel(d,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:c}),l.api.setSize({width:a==null?void 0:a.width,height:a==null?void 0:a.height}),e.inactive||this.doSetGroupAndPanelActive(l);else{const m=zt(l.element),w=_s(this.gridview.orientation,m,h),v=this.createGroupAtLocation(w,this.orientationAtLocation(w)===ze.VERTICAL?a==null?void 0:a.height:a==null?void 0:a.width);d=this.createPanel(e,v),v.model.openPanel(d,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:c}),e.inactive||this.doSetGroupAndPanelActive(v)}}else if(e.floating){const h=this.createGroup();this._onDidAddGroup.fire(h);const m=typeof e.floating=="object"&&e.floating!==null?e.floating:{};this.addFloatingGroup(h,Object.assign(Object.assign({},m),{inDragMode:!1,skipRemoveGroup:!0,skipActiveGroup:!0})),d=this.createPanel(e,h),h.model.openPanel(d,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:c})}else{const h=this.createGroupAtLocation([0],this.gridview.orientation===ze.VERTICAL?a==null?void 0:a.height:a==null?void 0:a.width);d=this.createPanel(e,h),h.model.openPanel(d,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:c}),e.inactive||this.doSetGroupAndPanelActive(h)}return d}removePanel(e,n={removeEmptyGroup:!0}){const s=e.group;if(!s)throw new Error(`dockview: cannot remove panel ${e.id}. it's missing a group.`);s.model.removePanel(e,{skipSetActiveGroup:n.skipSetActiveGroup}),n.skipDispose||(e.group.model.renderContainer.detatch(e),e.dispose()),s.size===0&&n.removeEmptyGroup&&this.removeGroup(s,{skipActive:n.skipSetActiveGroup})}createWatermarkComponent(){return this.options.createWatermarkComponent?this.options.createWatermarkComponent():new yS}updateWatermark(){var e,n;if(this.groups.filter(s=>s.api.location.type==="grid"&&s.api.isVisible).length===0){if(!this._watermark){this._watermark=this.createWatermarkComponent(),this._watermark.init({containerApi:new Bu(this)});const s=document.createElement("div");s.className="dv-watermark-container",Dy(s,"watermark-component"),s.appendChild(this._watermark.element),this.gridview.element.appendChild(s)}}else this._watermark&&(this._watermark.element.parentElement.remove(),(n=(e=this._watermark).dispose)===null||n===void 0||n.call(e),this._watermark=null)}addGroup(e){var n;if(e){let s;if(dS(e)){const m=typeof e.referencePanel=="string"?this.panels.find(w=>w.id===e.referencePanel):e.referencePanel;if(!m)throw new Error(`dockview: reference panel ${e.referencePanel} does not exist`);if(s=this.findGroup(m),!s)throw new Error(`dockview: reference group for reference panel ${e.referencePanel} does not exist`)}else if(hS(e)){if(s=typeof e.referenceGroup=="string"?(n=this._groups.get(e.referenceGroup))===null||n===void 0?void 0:n.value:e.referenceGroup,!s)throw new Error(`dockview: reference group ${e.referenceGroup} does not exist`)}else{const m=this.orthogonalize(zm(e.direction),e);return e.skipSetActive||this.doSetGroupAndPanelActive(m),m}const l=ju(e.direction||"within"),a=zt(s.element),c=_s(this.gridview.orientation,a,l),d=this.createGroup(e),h=this.getLocationOrientation(c)===ze.VERTICAL?e.initialHeight:e.initialWidth;return this.doAddGroup(d,c,h),e.skipSetActive||this.doSetGroupAndPanelActive(d),d}else{const s=this.createGroup(e);return this.doAddGroup(s),this.doSetGroupAndPanelActive(s),s}}getLocationOrientation(e){return e.length%2==0&&this.gridview.orientation===ze.HORIZONTAL?ze.HORIZONTAL:ze.VERTICAL}removeGroup(e,n){this.doRemoveGroup(e,n)}doRemoveGroup(e,n){var s;const l=[...e.panels];if(!(n!=null&&n.skipDispose))for(const d of l)this.removePanel(d,{removeEmptyGroup:!1,skipDispose:(s=n==null?void 0:n.skipDispose)!==null&&s!==void 0?s:!1});const a=this.activePanel;if(e.api.location.type==="floating"){const d=this._floatingGroups.find(h=>h.group===e);if(d){if(n!=null&&n.skipDispose||(d.group.dispose(),this._groups.delete(e.id),this._onDidRemoveGroup.fire(e)),Bd(this._floatingGroups,d),d.dispose(),!(n!=null&&n.skipActive)&&this._activeGroup===e){const h=Array.from(this._groups.values());this.doSetGroupAndPanelActive(h.length>0?h[0].value:void 0)}return d.group}throw new Error("dockview: failed to find floating group")}if(e.api.location.type==="popout"){const d=this._popoutGroups.find(h=>h.popoutGroup===e);if(d){if(!(n!=null&&n.skipDispose)){if(!(n!=null&&n.skipPopoutAssociated)){const m=d.referenceGroup?this.getPanel(d.referenceGroup):void 0;m&&m.panels.length===0&&this.removeGroup(m)}d.popoutGroup.dispose(),this._groups.delete(e.id),this._onDidRemoveGroup.fire(e)}Bd(this._popoutGroups,d);const h=d.disposable.dispose();if(!(n!=null&&n.skipPopoutReturn)&&h&&(this.doAddGroup(h,[0]),this.doSetGroupAndPanelActive(h)),!(n!=null&&n.skipActive)&&this._activeGroup===e){const m=Array.from(this._groups.values());this.doSetGroupAndPanelActive(m.length>0?m[0].value:void 0)}return this.updateWatermark(),d.popoutGroup}throw new Error("dockview: failed to find popout group")}const c=super.doRemoveGroup(e,n);return n!=null&&n.skipActive||this.activePanel!==a&&this._onDidActivePanelChange.fire(this.activePanel),c}debouncedUpdateAllPositions(){this._updatePositionsFrameId!==void 0&&cancelAnimationFrame(this._updatePositionsFrameId),this._updatePositionsFrameId=requestAnimationFrame(()=>{this._updatePositionsFrameId=void 0,this.overlayRenderContainer.updateAllPositions()})}movingLock(e){const n=this._moving;try{return this._moving=!0,e()}finally{this._moving=n}}moveGroupOrPanel(e){var n;const s=e.to.group,l=e.from.groupId,a=e.from.panelId,c=e.to.position,d=e.to.index,h=l?(n=this._groups.get(l))===null||n===void 0?void 0:n.value:void 0;if(!h)throw new Error(`dockview: Failed to find group id ${l}`);if(a===void 0){this.moveGroup({from:{group:h},to:{group:s,position:c},skipSetActive:e.skipSetActive});return}if(!c||c==="center"){const m=this.movingLock(()=>h.model.removePanel(a,{skipSetActive:!1,skipSetActiveGroup:!0}));if(!m)throw new Error(`dockview: No panel with id ${a}`);!e.keepEmptyGroups&&h.model.size===0&&this.doRemoveGroup(h,{skipActive:!0});const w=s.model.size===0;this.movingLock(()=>{var v;return s.model.openPanel(m,{index:d,skipSetActive:((v=e.skipSetActive)!==null&&v!==void 0?v:!1)&&!w,skipSetGroupActive:!0})}),e.skipSetActive||this.doSetGroupAndPanelActive(s),this._onDidMovePanel.fire({panel:m,from:h})}else{const m=zt(s.element),w=_s(this.gridview.orientation,m,c);if(h.size<2){const[v,S]=Ms(w);if(h.api.location.type==="grid"){const P=zt(h.element),[R,O]=Ms(P);if(dv(R,v)){this.gridview.moveView(R,O,S),this._onDidMovePanel.fire({panel:this.getGroupPanel(a),from:h});return}}if(h.api.location.type==="popout"){const P=this._popoutGroups.find(M=>M.popoutGroup===h),R=this.movingLock(()=>P.popoutGroup.model.removePanel(P.popoutGroup.panels[0],{skipSetActive:!0,skipSetActiveGroup:!0}));this.doRemoveGroup(h,{skipActive:!0});const O=this.createGroupAtLocation(w);this.movingLock(()=>O.model.openPanel(R,{skipSetActive:!0})),this.doSetGroupAndPanelActive(O),this._onDidMovePanel.fire({panel:this.getGroupPanel(a),from:h});return}const E=this.movingLock(()=>this.doRemoveGroup(h,{skipActive:!0,skipDispose:!0})),A=zt(s.element),D=_s(this.gridview.orientation,A,c);this.movingLock(()=>this.doAddGroup(E,D)),this.doSetGroupAndPanelActive(E),this._onDidMovePanel.fire({panel:this.getGroupPanel(a),from:h})}else{const v=this.movingLock(()=>h.model.removePanel(a,{skipSetActive:!1,skipSetActiveGroup:!0}));if(!v)throw new Error(`dockview: No panel with id ${a}`);const S=_s(this.gridview.orientation,m,c),E=this.createGroupAtLocation(S);this.movingLock(()=>E.model.openPanel(v,{skipSetGroupActive:!0})),this.doSetGroupAndPanelActive(E),this._onDidMovePanel.fire({panel:v,from:h})}}}moveGroup(e){const n=e.from.group,s=e.to.group,l=e.to.position;if(l==="center"){const a=n.activePanel,c=this.movingLock(()=>[...n.panels].map(d=>n.model.removePanel(d.id,{skipSetActive:!0})));(n==null?void 0:n.model.size)===0&&this.doRemoveGroup(n,{skipActive:!0}),this.movingLock(()=>{for(const d of c)s.model.openPanel(d,{skipSetActive:d!==a,skipSetGroupActive:!0})}),e.skipSetActive!==!0?this.doSetGroupAndPanelActive(s):this.activePanel||this.doSetGroupAndPanelActive(s)}else{switch(n.api.location.type){case"grid":this.gridview.removeView(zt(n.element));break;case"floating":{const a=this._floatingGroups.find(c=>c.group===n);if(!a)throw new Error("dockview: failed to find floating group");a.dispose();break}case"popout":{const a=this._popoutGroups.find(d=>d.popoutGroup===n);if(!a)throw new Error("dockview: failed to find popout group");const c=this._popoutGroups.indexOf(a);if(c>=0&&this._popoutGroups.splice(c,1),a.referenceGroup){const d=this.getPanel(a.referenceGroup);d&&!d.api.isVisible&&this.doRemoveGroup(d,{skipActive:!0})}a.window.dispose(),s.api.location.type==="grid"?(n.model.renderContainer=this.overlayRenderContainer,n.model.dropTargetContainer=this.rootDropTargetContainer,n.model.location={type:"grid"}):s.api.location.type==="floating"&&(n.model.renderContainer=this.overlayRenderContainer,n.model.dropTargetContainer=this.rootDropTargetContainer,n.model.location={type:"floating"});break}}if(s.api.location.type==="grid"){const a=zt(s.element),c=_s(this.gridview.orientation,a,l);let d;switch(this.gridview.orientation){case ze.VERTICAL:d=a.length%2==0?n.api.width:n.api.height;break;case ze.HORIZONTAL:d=a.length%2==0?n.api.height:n.api.width;break}this.gridview.addView(n,d,c)}else if(s.api.location.type==="floating"){const a=this._floatingGroups.find(c=>c.group===s);if(a){const c=a.overlay.toJSON();let d,h;"left"in c?d=c.left+50:"right"in c?d=Math.max(0,c.right-c.width-50):d=50,"top"in c?h=c.top+50:"bottom"in c?h=Math.max(0,c.bottom-c.height-50):h=50,this.addFloatingGroup(n,{height:c.height,width:c.width,position:{left:d,top:h}})}}}if(n.panels.forEach(a=>{this._onDidMovePanel.fire({panel:a,from:n})}),this.debouncedUpdateAllPositions(),e.skipSetActive===!1){const a=s??n;this.doSetGroupAndPanelActive(a)}}doSetGroupActive(e){super.doSetGroupActive(e);const n=this.activePanel;!this._moving&&n!==this._onDidActivePanelChange.value&&this._onDidActivePanelChange.fire(n)}doSetGroupAndPanelActive(e){super.doSetGroupActive(e);const n=this.activePanel;e&&this.hasMaximizedGroup()&&!this.isMaximizedGroup(e)&&this.exitMaximizedGroup(),!this._moving&&n!==this._onDidActivePanelChange.value&&this._onDidActivePanelChange.fire(n)}getNextGroupId(){let e=this.nextGroupId.next();for(;this._groups.has(e);)e=this.nextGroupId.next();return e}createGroup(e){e||(e={});let n=e==null?void 0:e.id;if(n&&this._groups.has(e.id)&&(console.warn(`dockview: Duplicate group id ${e==null?void 0:e.id}. reassigning group id to avoid errors`),n=void 0),!n)for(n=this.nextGroupId.next();this._groups.has(n);)n=this.nextGroupId.next();const s=new km(this,n,e);if(s.init({params:{},accessor:this}),!this._groups.has(s.id)){const l=new Re(s.model.onTabDragStart(a=>{this._onWillDragPanel.fire(a)}),s.model.onGroupDragStart(a=>{this._onWillDragGroup.fire(a)}),s.model.onMove(a=>{const{groupId:c,itemId:d,target:h,index:m}=a;this.moveGroupOrPanel({from:{groupId:c,panelId:d},to:{group:s,position:h,index:m}})}),s.model.onDidDrop(a=>{this._onDidDrop.fire(a)}),s.model.onWillDrop(a=>{this._onWillDrop.fire(a)}),s.model.onWillShowOverlay(a=>{if(this.options.disableDnd){a.preventDefault();return}this._onWillShowOverlay.fire(a)}),s.model.onUnhandledDragOverEvent(a=>{this._onUnhandledDragOverEvent.fire(a)}),s.model.onDidAddPanel(a=>{this._moving||this._onDidAddPanel.fire(a.panel)}),s.model.onDidRemovePanel(a=>{this._moving||this._onDidRemovePanel.fire(a.panel)}),s.model.onDidActivePanelChange(a=>{this._moving||a.panel===this.activePanel&&this._onDidActivePanelChange.value!==a.panel&&this._onDidActivePanelChange.fire(a.panel)}),Jr.any(s.model.onDidPanelTitleChange,s.model.onDidPanelParametersChange)(()=>{this._bufferOnDidLayoutChange.fire()}));this._groups.set(s.id,{value:s,disposable:l})}return s.initialize(),s}createPanel(e,n){var s,l,a;const c=e.component,d=(s=e.tabComponent)!==null&&s!==void 0?s:this.options.defaultTabComponent,h=new Ev(this,e.id,c,d),m=new Lo(e.id,c,d,this,this._api,n,h,{renderer:e.renderer,minimumWidth:e.minimumWidth,minimumHeight:e.minimumHeight,maximumWidth:e.maximumWidth,maximumHeight:e.maximumHeight});return m.init({title:(l=e.title)!==null&&l!==void 0?l:e.id,params:(a=e==null?void 0:e.params)!==null&&a!==void 0?a:{}}),m}createGroupAtLocation(e,n,s){const l=this.createGroup(s);return this.doAddGroup(l,e,n),l}findGroup(e){var n;return(n=Array.from(this._groups.values()).find(s=>s.value.model.containsPanel(e)))===null||n===void 0?void 0:n.value}orientationAtLocation(e){const n=this.gridview.orientation;return e.length%2==1?n:Ss(n)}updateDropTargetModel(e){"dndEdges"in e&&(this._rootDropTarget.disabled=typeof e.dndEdges=="boolean"&&e.dndEdges===!1,typeof e.dndEdges=="object"&&e.dndEdges!==null?this._rootDropTarget.setOverlayModel(e.dndEdges):this._rootDropTarget.setOverlayModel(Nm)),"rootOverlayModel"in e&&this.updateDropTargetModel({dndEdges:e.dndEdges})}updateTheme(){var e,n;const s=(e=this._options.theme)!==null&&e!==void 0?e:vS;switch(this._themeClassnames.setClassNames(s.className),this.gridview.margin=(n=s.gap)!==null&&n!==void 0?n:0,s.dndOverlayMounting){case"absolute":this.rootDropTargetContainer.disabled=!1;break;case"relative":default:this.rootDropTargetContainer.disabled=!0;break}}}class OS extends fv{get orientation(){return this.gridview.orientation}set orientation(e){this.gridview.orientation=e}get options(){return this._options}get deserializer(){return this._deserializer}set deserializer(e){this._deserializer=e}constructor(e,n){var s;super(e,{proportionalLayout:(s=n.proportionalLayout)!==null&&s!==void 0?s:!0,orientation:n.orientation,styles:n.hideBorders?{separatorBorder:"transparent"}:void 0,disableAutoResizing:n.disableAutoResizing,className:n.className}),this._onDidLayoutfromJSON=new U,this.onDidLayoutFromJSON=this._onDidLayoutfromJSON.event,this._onDidRemoveGroup=new U,this.onDidRemoveGroup=this._onDidRemoveGroup.event,this._onDidAddGroup=new U,this.onDidAddGroup=this._onDidAddGroup.event,this._onDidActiveGroupChange=new U,this.onDidActiveGroupChange=this._onDidActiveGroupChange.event,this._options=n,this.addDisposables(this._onDidAddGroup,this._onDidRemoveGroup,this._onDidActiveGroupChange,this.onDidAdd(l=>{this._onDidAddGroup.fire(l)}),this.onDidRemove(l=>{this._onDidRemoveGroup.fire(l)}),this.onDidActiveChange(l=>{this._onDidActiveGroupChange.fire(l)}))}updateOptions(e){super.updateOptions(e);const n=typeof e.orientation=="string"&&this.gridview.orientation!==e.orientation;this._options=Object.assign(Object.assign({},this.options),e),n&&(this.gridview.orientation=e.orientation),this.layout(this.gridview.width,this.gridview.height,!0)}removePanel(e){this.removeGroup(e)}toJSON(){var e;return{grid:this.gridview.serialize(),activePanel:(e=this.activeGroup)===null||e===void 0?void 0:e.id}}setVisible(e,n){this.gridview.setViewVisible(zt(e.element),n)}setActive(e){this._groups.forEach((n,s)=>{n.value.setActive(e===n.value)})}focus(){var e;(e=this.activeGroup)===null||e===void 0||e.focus()}fromJSON(e){this.clear();const{grid:n,activePanel:s}=e;try{const l=[],a=this.width,c=this.height;if(this.gridview.deserialize(n,{fromJSON:d=>{const{data:h}=d,m=this.options.createComponent({id:h.id,name:h.component});return l.push(()=>m.init({params:h.params,minimumWidth:h.minimumWidth,maximumWidth:h.maximumWidth,minimumHeight:h.minimumHeight,maximumHeight:h.maximumHeight,priority:h.priority,snap:!!h.snap,accessor:this,isVisible:d.visible})),this._onDidAddGroup.fire(m),this.registerPanel(m),m}}),this.layout(a,c,!0),l.forEach(d=>d()),typeof s=="string"){const d=this.getPanel(s);d&&this.doSetGroupActive(d)}}catch(l){for(const a of this.groups)a.dispose(),this._groups.delete(a.id),this._onDidRemoveGroup.fire(a);throw this.clear(),l}this._onDidLayoutfromJSON.fire()}clear(){const e=this.activeGroup,n=Array.from(this._groups.values());for(const s of n)s.disposable.dispose(),this.doRemoveGroup(s.value,{skipActive:!0});e&&this.doSetGroupActive(void 0),this.gridview.clear()}movePanel(e,n){var s;let l;const a=this.gridview.remove(e),c=(s=this._groups.get(n.reference))===null||s===void 0?void 0:s.value;if(!c)throw new Error(`reference group ${n.reference} does not exist`);const d=ju(n.direction);if(d==="center")throw new Error(`${d} not supported as an option`);{const h=zt(c.element);l=_s(this.gridview.orientation,h,d)}this.doAddGroup(a,l,n.size)}addPanel(e){var n,s,l,a;let c=(n=e.location)!==null&&n!==void 0?n:[0];if(!((s=e.position)===null||s===void 0)&&s.referencePanel){const h=(l=this._groups.get(e.position.referencePanel))===null||l===void 0?void 0:l.value;if(!h)throw new Error(`reference group ${e.position.referencePanel} does not exist`);const m=ju(e.position.direction);if(m==="center")throw new Error(`${m} not supported as an option`);{const w=zt(h.element);c=_s(this.gridview.orientation,w,m)}}const d=this.options.createComponent({id:e.id,name:e.component});return d.init({params:(a=e.params)!==null&&a!==void 0?a:{},minimumWidth:e.minimumWidth,maximumWidth:e.maximumWidth,minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight,priority:e.priority,snap:!!e.snap,accessor:this,isVisible:!0}),this.doAddGroup(d,c,e.size),this.registerPanel(d),this.doSetGroupActive(d),d}registerPanel(e){const n=new Re(e.api.onDidFocusChange(s=>{s.isFocused&&this._groups.forEach(l=>{const a=l.value;a!==e?a.setActive(!1):a.setActive(!0)})}));this._groups.set(e.id,{value:e,disposable:n})}moveGroup(e,n,s){const l=this.getPanel(n);if(!l)throw new Error("invalid operation");const a=zt(e.element),c=_s(this.gridview.orientation,a,s),[d,h]=Ms(c),m=zt(l.element),[w,v]=Ms(m);if(dv(w,d)){this.gridview.moveView(w,v,h);return}const S=this.doRemoveGroup(l,{skipActive:!0,skipDispose:!0}),E=zt(e.element),A=_s(this.gridview.orientation,E,s);this.doAddGroup(S,A)}removeGroup(e){super.removeGroup(e)}dispose(){super.dispose(),this._onDidLayoutfromJSON.dispose()}}class TS extends Fh{get panels(){return this.splitview.getViews()}get options(){return this._options}get length(){return this._panels.size}get orientation(){return this.splitview.orientation}get splitview(){return this._splitview}set splitview(e){this._splitview&&this._splitview.dispose(),this._splitview=e,this._splitviewChangeDisposable.value=new Re(this._splitview.onDidSashEnd(()=>{this._onDidLayoutChange.fire(void 0)}),this._splitview.onDidAddView(n=>this._onDidAddView.fire(n)),this._splitview.onDidRemoveView(n=>this._onDidRemoveView.fire(n)))}get minimumSize(){return this.splitview.minimumSize}get maximumSize(){return this.splitview.maximumSize}get height(){return this.splitview.orientation===ze.HORIZONTAL?this.splitview.orthogonalSize:this.splitview.size}get width(){return this.splitview.orientation===ze.HORIZONTAL?this.splitview.size:this.splitview.orthogonalSize}constructor(e,n){var s;super(document.createElement("div"),n.disableAutoResizing),this._splitviewChangeDisposable=new Bn,this._panels=new Map,this._onDidLayoutfromJSON=new U,this.onDidLayoutFromJSON=this._onDidLayoutfromJSON.event,this._onDidAddView=new U,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new U,this.onDidRemoveView=this._onDidRemoveView.event,this._onDidLayoutChange=new U,this.onDidLayoutChange=this._onDidLayoutChange.event,this.element.style.height="100%",this.element.style.width="100%",this._classNames=new nc(this.element),this._classNames.setClassNames((s=n.className)!==null&&s!==void 0?s:""),e.appendChild(this.element),this._options=n,this.splitview=new Xl(this.element,n),this.addDisposables(this._onDidAddView,this._onDidLayoutfromJSON,this._onDidRemoveView,this._onDidLayoutChange)}updateOptions(e){var n,s;"className"in e&&this._classNames.setClassNames((n=e.className)!==null&&n!==void 0?n:""),"disableResizing"in e&&(this.disableResizing=(s=e.disableAutoResizing)!==null&&s!==void 0?s:!1),typeof e.orientation=="string"&&(this.splitview.orientation=e.orientation),this._options=Object.assign(Object.assign({},this.options),e),this.splitview.layout(this.splitview.size,this.splitview.orthogonalSize)}focus(){var e;(e=this._activePanel)===null||e===void 0||e.focus()}movePanel(e,n){this.splitview.moveView(e,n)}setVisible(e,n){const s=this.panels.indexOf(e);this.splitview.setViewVisible(s,n)}setActive(e,n){this._activePanel=e,this.panels.filter(s=>s!==e).forEach(s=>{s.api._onDidActiveChange.fire({isActive:!1}),n||s.focus()}),e.api._onDidActiveChange.fire({isActive:!0}),n||e.focus()}removePanel(e,n){const s=this._panels.get(e.id);if(!s)throw new Error(`unknown splitview panel ${e.id}`);s.dispose(),this._panels.delete(e.id);const l=this.panels.findIndex(d=>d===e);this.splitview.removeView(l,n).dispose();const c=this.panels;c.length>0&&this.setActive(c[c.length-1])}getPanel(e){return this.panels.find(n=>n.id===e)}addPanel(e){var n;if(this._panels.has(e.id))throw new Error(`panel ${e.id} already exists`);const s=this.options.createComponent({id:e.id,name:e.component});s.orientation=this.splitview.orientation,s.init({params:(n=e.params)!==null&&n!==void 0?n:{},minimumSize:e.minimumSize,maximumSize:e.maximumSize,snap:e.snap,priority:e.priority,accessor:this});const l=typeof e.size=="number"?e.size:$i.Distribute,a=typeof e.index=="number"?e.index:void 0;return this.splitview.addView(s,l,a),this.doAddView(s),this.setActive(s),s}layout(e,n){const[s,l]=this.splitview.orientation===ze.HORIZONTAL?[e,n]:[n,e];this.splitview.layout(s,l)}doAddView(e){const n=e.api.onDidFocusChange(s=>{s.isFocused&&this.setActive(e,!0)});this._panels.set(e.id,n)}toJSON(){var e;return{views:this.splitview.getViews().map((s,l)=>({size:this.splitview.getViewSize(l),data:s.toJSON(),snap:!!s.snap,priority:s.priority})),activeView:(e=this._activePanel)===null||e===void 0?void 0:e.id,size:this.splitview.size,orientation:this.splitview.orientation}}fromJSON(e){this.clear();const{views:n,orientation:s,size:l,activeView:a}=e,c=[],d=this.width,h=this.height;if(this.splitview=new Xl(this.element,{orientation:s,proportionalLayout:this.options.proportionalLayout,descriptor:{size:l,views:n.map(m=>{const w=m.data;if(this._panels.has(w.id))throw new Error(`panel ${w.id} already exists`);const v=this.options.createComponent({id:w.id,name:w.component});return c.push(()=>{var S;v.init({params:(S=w.params)!==null&&S!==void 0?S:{},minimumSize:w.minimumSize,maximumSize:w.maximumSize,snap:m.snap,priority:m.priority,accessor:this})}),v.orientation=s,this.doAddView(v),setTimeout(()=>{this._onDidAddView.fire(v)},0),{size:m.size,view:v}})}}),this.layout(d,h),c.forEach(m=>m()),typeof a=="string"){const m=this.getPanel(a);m&&this.setActive(m)}this._onDidLayoutfromJSON.fire()}clear(){for(const e of this._panels.values())e.dispose();for(this._panels.clear();this.splitview.length>0;)this.splitview.removeView(0,$i.Distribute,!0).dispose()}dispose(){for(const n of this._panels.values())n.dispose();this._panels.clear();const e=this.splitview.getViews();this._splitviewChangeDisposable.dispose(),this.splitview.dispose();for(const n of e)n.dispose();this.element.remove(),super.dispose()}}class Rm extends Re{get element(){return this._element}constructor(){super(),this._expandedIcon=oS(),this._collapsedIcon=Sv(),this.disposable=new Bn,this.apiRef={api:null},this._element=document.createElement("div"),this.element.className="dv-default-header",this._content=document.createElement("span"),this._expander=document.createElement("div"),this._expander.className="dv-pane-header-icon",this.element.appendChild(this._expander),this.element.appendChild(this._content),this.addDisposables(Be(this._element,"click",()=>{var e;(e=this.apiRef.api)===null||e===void 0||e.setExpanded(!this.apiRef.api.isExpanded)}))}init(e){this.apiRef.api=e.api,this._content.textContent=e.title,this.updateIcon(),this.disposable.value=e.api.onDidExpansionChange(()=>{this.updateIcon()})}updateIcon(){var e;const n=!!(!((e=this.apiRef.api)===null||e===void 0)&&e.isExpanded);Ne(this._expander,"collapsed",!n),n?(this._expander.contains(this._collapsedIcon)&&this._collapsedIcon.remove(),this._expander.contains(this._expandedIcon)||this._expander.appendChild(this._expandedIcon)):(this._expander.contains(this._expandedIcon)&&this._expandedIcon.remove(),this._expander.contains(this._collapsedIcon)||this._expander.appendChild(this._collapsedIcon))}update(e){}dispose(){this.disposable.dispose(),super.dispose()}}const IS=Wh(),Mm=22,Lm=0,Vm=Number.MAX_SAFE_INTEGER;class Gm extends Xy{constructor(e){super({accessor:e.accessor,id:e.id,component:e.component,headerComponent:e.headerComponent,orientation:e.orientation,isExpanded:e.isExpanded,disableDnd:e.disableDnd,headerSize:e.headerSize,minimumBodySize:e.minimumBodySize,maximumBodySize:e.maximumBodySize}),this.options=e}getBodyComponent(){return this.options.body}getHeaderComponent(){return this.options.header}}class NS extends Fh{get id(){return this._id}get panels(){return this.paneview.getPanes()}set paneview(e){this._paneview=e,this._disposable.value=new Re(this._paneview.onDidChange(()=>{this._onDidLayoutChange.fire(void 0)}),this._paneview.onDidAddView(n=>this._onDidAddView.fire(n)),this._paneview.onDidRemoveView(n=>this._onDidRemoveView.fire(n)))}get paneview(){return this._paneview}get minimumSize(){return this.paneview.minimumSize}get maximumSize(){return this.paneview.maximumSize}get height(){return this.paneview.orientation===ze.HORIZONTAL?this.paneview.orthogonalSize:this.paneview.size}get width(){return this.paneview.orientation===ze.HORIZONTAL?this.paneview.size:this.paneview.orthogonalSize}get options(){return this._options}constructor(e,n){var s;super(document.createElement("div"),n.disableAutoResizing),this._id=IS.next(),this._disposable=new Bn,this._viewDisposables=new Map,this._onDidLayoutfromJSON=new U,this.onDidLayoutFromJSON=this._onDidLayoutfromJSON.event,this._onDidLayoutChange=new U,this.onDidLayoutChange=this._onDidLayoutChange.event,this._onDidDrop=new U,this.onDidDrop=this._onDidDrop.event,this._onDidAddView=new U,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new U,this.onDidRemoveView=this._onDidRemoveView.event,this._onUnhandledDragOverEvent=new U,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,this.element.style.height="100%",this.element.style.width="100%",this.addDisposables(this._onDidLayoutChange,this._onDidLayoutfromJSON,this._onDidDrop,this._onDidAddView,this._onDidRemoveView,this._onUnhandledDragOverEvent),this._classNames=new nc(this.element),this._classNames.setClassNames((s=n.className)!==null&&s!==void 0?s:""),e.appendChild(this.element),this._options=n,this.paneview=new Am(this.element,{orientation:ze.VERTICAL}),this.addDisposables(this._disposable)}setVisible(e,n){const s=this.panels.indexOf(e);this.paneview.setViewVisible(s,n)}focus(){}updateOptions(e){var n,s;"className"in e&&this._classNames.setClassNames((n=e.className)!==null&&n!==void 0?n:""),"disableResizing"in e&&(this.disableResizing=(s=e.disableAutoResizing)!==null&&s!==void 0?s:!1),this._options=Object.assign(Object.assign({},this.options),e)}addPanel(e){var n,s;const l=this.options.createComponent({id:e.id,name:e.component});let a;e.headerComponent&&this.options.createHeaderComponent&&(a=this.options.createHeaderComponent({id:e.id,name:e.headerComponent})),a||(a=new Rm);const c=new Gm({id:e.id,component:e.component,headerComponent:e.headerComponent,header:a,body:l,orientation:ze.VERTICAL,isExpanded:!!e.isExpanded,disableDnd:!!this.options.disableDnd,accessor:this,headerSize:(n=e.headerSize)!==null&&n!==void 0?n:Mm,minimumBodySize:Lm,maximumBodySize:Vm});this.doAddPanel(c);const d=typeof e.size=="number"?e.size:$i.Distribute,h=typeof e.index=="number"?e.index:void 0;return c.init({params:(s=e.params)!==null&&s!==void 0?s:{},minimumBodySize:e.minimumBodySize,maximumBodySize:e.maximumBodySize,isExpanded:e.isExpanded,title:e.title,containerApi:new ql(this),accessor:this}),this.paneview.addPane(c,d,h),c.orientation=this.paneview.orientation,c}removePanel(e){const s=this.panels.findIndex(l=>l===e);this.paneview.removePane(s),this.doRemovePanel(e)}movePanel(e,n){this.paneview.moveView(e,n)}getPanel(e){return this.panels.find(n=>n.id===e)}layout(e,n){const[s,l]=this.paneview.orientation===ze.HORIZONTAL?[e,n]:[n,e];this.paneview.layout(s,l)}toJSON(){const e=l=>l===Number.MAX_SAFE_INTEGER||l===Number.POSITIVE_INFINITY?void 0:l,n=l=>l<=0?void 0:l;return{views:this.paneview.getPanes().map((l,a)=>({size:this.paneview.getViewSize(a),data:l.toJSON(),minimumSize:n(l.minimumBodySize),maximumSize:e(l.maximumBodySize),headerSize:l.headerSize,expanded:l.isExpanded()})),size:this.paneview.size}}fromJSON(e){this.clear();const{views:n,size:s}=e,l=[],a=this.width,c=this.height;this.paneview=new Am(this.element,{orientation:ze.VERTICAL,descriptor:{size:s,views:n.map(d=>{var h,m,w;const v=d.data,S=this.options.createComponent({id:v.id,name:v.component});let E;v.headerComponent&&this.options.createHeaderComponent&&(E=this.options.createHeaderComponent({id:v.id,name:v.headerComponent})),E||(E=new Rm);const A=new Gm({id:v.id,component:v.component,headerComponent:v.headerComponent,header:E,body:S,orientation:ze.VERTICAL,isExpanded:!!d.expanded,disableDnd:!!this.options.disableDnd,accessor:this,headerSize:(h=d.headerSize)!==null&&h!==void 0?h:Mm,minimumBodySize:(m=d.minimumSize)!==null&&m!==void 0?m:Lm,maximumBodySize:(w=d.maximumSize)!==null&&w!==void 0?w:Vm});return this.doAddPanel(A),l.push(()=>{var D;A.init({params:(D=v.params)!==null&&D!==void 0?D:{},minimumBodySize:d.minimumSize,maximumBodySize:d.maximumSize,title:v.title,isExpanded:!!d.expanded,containerApi:new ql(this),accessor:this}),A.orientation=this.paneview.orientation}),setTimeout(()=>{this._onDidAddView.fire(A)},0),{size:d.size,view:A}})}}),this.layout(a,c),l.forEach(d=>d()),this._onDidLayoutfromJSON.fire()}clear(){for(const[e,n]of this._viewDisposables.entries())n.dispose();this._viewDisposables.clear(),this.paneview.dispose()}doAddPanel(e){const n=new Re(e.onDidDrop(s=>{this._onDidDrop.fire(s)}),e.onUnhandledDragOverEvent(s=>{this._onUnhandledDragOverEvent.fire(s)}));this._viewDisposables.set(e.id,n)}doRemovePanel(e){const n=this._viewDisposables.get(e.id);n&&(n.dispose(),this._viewDisposables.delete(e.id))}dispose(){super.dispose();for(const[e,n]of this._viewDisposables.entries())n.dispose();this._viewDisposables.clear(),this.element.remove(),this.paneview.dispose()}}class RS extends jh{get priority(){return this._priority}set orientation(e){this._orientation=e}get orientation(){return this._orientation}get minimumSize(){const e=typeof this._minimumSize=="function"?this._minimumSize():this._minimumSize;return e!==this._evaluatedMinimumSize&&(this._evaluatedMinimumSize=e,this.updateConstraints()),e}get maximumSize(){const e=typeof this._maximumSize=="function"?this._maximumSize():this._maximumSize;return e!==this._evaluatedMaximumSize&&(this._evaluatedMaximumSize=e,this.updateConstraints()),e}get snap(){return this._snap}constructor(e,n){super(e,n,new _v(e,n)),this._evaluatedMinimumSize=0,this._evaluatedMaximumSize=Number.POSITIVE_INFINITY,this._minimumSize=0,this._maximumSize=Number.POSITIVE_INFINITY,this._snap=!1,this._onDidChange=new U,this.onDidChange=this._onDidChange.event,this.api.initialize(this),this.addDisposables(this._onDidChange,this.api.onWillVisibilityChange(s=>{const{isVisible:l}=s,{accessor:a}=this._params;a.setVisible(this,l)}),this.api.onActiveChange(()=>{const{accessor:s}=this._params;s.setActive(this)}),this.api.onDidConstraintsChangeInternal(s=>{(typeof s.minimumSize=="number"||typeof s.minimumSize=="function")&&(this._minimumSize=s.minimumSize),(typeof s.maximumSize=="number"||typeof s.maximumSize=="function")&&(this._maximumSize=s.maximumSize),this.updateConstraints()}),this.api.onDidSizeChange(s=>{this._onDidChange.fire({size:s.size})}))}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}layout(e,n){const[s,l]=this.orientation===ze.HORIZONTAL?[e,n]:[n,e];super.layout(s,l)}init(e){super.init(e),this._priority=e.priority,e.minimumSize&&(this._minimumSize=e.minimumSize),e.maximumSize&&(this._maximumSize=e.maximumSize),e.snap&&(this._snap=e.snap)}toJSON(){const e=s=>s===Number.MAX_SAFE_INTEGER||s===Number.POSITIVE_INFINITY?void 0:s,n=s=>s<=0?void 0:s;return Object.assign(Object.assign({},super.toJSON()),{minimumSize:n(this.minimumSize),maximumSize:e(this.maximumSize)})}updateConstraints(){this.api._onDidConstraintsChange.fire({maximumSize:this._evaluatedMaximumSize,minimumSize:this._evaluatedMinimumSize})}}function MS(r,e){return new kS(r,e).api}function LS(r,e){const n=new TS(r,e);return new pv(n)}function VS(r,e){const n=new OS(r,e);return new mv(n)}function GS(r,e){const n=new NS(r,e);return new ql(n)}const bv=(r,e)=>{const[n,s]=pe.useState(),l=pe.useRef(r.componentProps);return pe.useImperativeHandle(e,()=>({update:a=>{l.current=Object.assign(Object.assign({},l.current),a),s(Date.now())}}),[]),pe.createElement(r.component,l.current)};bv.displayName="DockviewReactJsBridge";const WS=(()=>{let r=1;return{next:()=>`dockview_react_portal_key_${(r++).toString()}`}})(),FS=pe.createContext({});class qr{constructor(e,n,s,l,a){this.parent=e,this.portalStore=n,this.component=s,this.parameters=l,this.context=a,this._initialProps={},this.disposed=!1,this.createPortal()}update(e){if(this.disposed)throw new Error("invalid operation: resource is already disposed");this.componentInstance?this.componentInstance.update(e):this._initialProps=Object.assign(Object.assign({},this._initialProps),e)}createPortal(){if(this.disposed)throw new Error("invalid operation: resource is already disposed");if(!HS(this.component))throw new Error("Dockview: Only React.memo(...), React.ForwardRef(...) and functional components are accepted as components");const e=pe.createElement(pe.forwardRef(bv),{component:this.component,componentProps:this.parameters,ref:l=>{this.componentInstance=l,Object.keys(this._initialProps).length>0&&(this.componentInstance.update(this._initialProps),this._initialProps={})}}),n=this.context?pe.createElement(FS.Provider,{value:this.context},e):e,s=S0.createPortal(n,this.parent,WS.next());this.ref={portal:s,disposable:this.portalStore.addPortal(s)}}dispose(){var e;(e=this.ref)===null||e===void 0||e.disposable.dispose(),this.disposed=!0}}const rc=()=>{const[r,e]=pe.useState([]);pe.useDebugValue(`Portal count: ${r.length}`);const n=pe.useCallback(s=>{e(a=>[...a,s]);let l=!1;return Qt.from(()=>{if(l)throw new Error("invalid operation: resource already disposed");l=!0,e(a=>a.filter(c=>c!==s))})},[]);return[r,n]};function HS(r){return typeof r=="function"||!!(r!=null&&r.$$typeof)}class Wm{get element(){return this._element}constructor(e,n,s){this.id=e,this.component=n,this.reactPortalStore=s,this._onDidFocus=new U,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new U,this.onDidBlur=this._onDidBlur.event,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}focus(){}init(e){this.part=new qr(this.element,this.reactPortalStore,this.component,{params:e.params,api:e.api,containerApi:e.containerApi})}update(e){var n;(n=this.part)===null||n===void 0||n.update({params:e.params})}layout(e,n){}dispose(){var e;this._onDidFocus.dispose(),this._onDidBlur.dispose(),(e=this.part)===null||e===void 0||e.dispose()}}class Fm{get element(){return this._element}constructor(e,n,s){this.id=e,this.component=n,this.reactPortalStore=s,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}focus(){}init(e){this.part=new qr(this.element,this.reactPortalStore,this.component,{params:e.params,api:e.api,containerApi:e.containerApi,tabLocation:e.tabLocation})}update(e){var n;(n=this.part)===null||n===void 0||n.update({params:e.params})}layout(e,n){}dispose(){var e;(e=this.part)===null||e===void 0||e.dispose()}}class Hm{get element(){return this._element}constructor(e,n,s){this.id=e,this.component=n,this.reactPortalStore=s,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}init(e){this.part=new qr(this.element,this.reactPortalStore,this.component,{group:e.group,containerApi:e.containerApi})}focus(){}update(e){var n,s,l;this.parameters&&(this.parameters.params=e.params),(n=this.part)===null||n===void 0||n.update({params:(l=(s=this.parameters)===null||s===void 0?void 0:s.params)!==null&&l!==void 0?l:{}})}layout(e,n){}dispose(){var e;(e=this.part)===null||e===void 0||e.dispose()}}class jS{get element(){return this._element}get part(){return this._part}constructor(e,n,s){this.component=e,this.reactPortalStore=n,this._group=s,this.mutableDisposable=new Bn,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}init(e){this.mutableDisposable.value=new Re(this._group.model.onDidAddPanel(()=>{this.updatePanels()}),this._group.model.onDidRemovePanel(()=>{this.updatePanels()}),this._group.model.onDidActivePanelChange(()=>{this.updateActivePanel()}),e.api.onDidActiveChange(()=>{this.updateGroupActive()})),this._part=new qr(this.element,this.reactPortalStore,this.component,{api:e.api,containerApi:e.containerApi,panels:this._group.model.panels,activePanel:this._group.model.activePanel,isGroupActive:this._group.api.isActive,group:this._group})}dispose(){var e;this.mutableDisposable.dispose(),(e=this._part)===null||e===void 0||e.dispose()}update(e){var n;(n=this._part)===null||n===void 0||n.update(e.params)}updatePanels(){this.update({params:{panels:this._group.model.panels}})}updateActivePanel(){this.update({params:{activePanel:this._group.model.activePanel}})}updateGroupActive(){this.update({params:{isGroupActive:this._group.api.isActive}})}}function No(r,e){return r?n=>new jS(r,e,n):void 0}const Cu="props.defaultTabComponent";function BS(r){return vh.reduce((n,s)=>(s in r&&(n[s]=r[s]),n),{})}const Pv=pe.forwardRef((r,e)=>{const n=pe.useRef(null),s=pe.useRef(),[l,a]=rc();pe.useImperativeHandle(e,()=>n.current,[]);const c=pe.useRef({});return pe.useEffect(()=>{const d={};vh.forEach(h=>{const m=h,w=r[m];m in r&&w!==c.current[m]&&(d[m]=w)}),s.current&&s.current.updateOptions(d),c.current=r},vh.map(d=>r[d])),pe.useEffect(()=>{var d;if(!n.current)return;const h=(d=r.tabComponents)!==null&&d!==void 0?d:{};r.defaultTabComponent&&(h[Cu]=r.defaultTabComponent);const m={createLeftHeaderActionComponent:No(r.leftHeaderActionsComponent,{addPortal:a}),createRightHeaderActionComponent:No(r.rightHeaderActionsComponent,{addPortal:a}),createPrefixHeaderActionComponent:No(r.prefixHeaderActionsComponent,{addPortal:a}),createComponent:E=>new Wm(E.id,r.components[E.name],{addPortal:a}),createTabComponent(E){return new Fm(E.id,h[E.name],{addPortal:a})},createWatermarkComponent:r.watermarkComponent?()=>new Hm("watermark",r.watermarkComponent,{addPortal:a}):void 0,defaultTabComponent:r.defaultTabComponent?Cu:void 0},w=MS(n.current,Object.assign(Object.assign({},BS(r)),m)),{clientWidth:v,clientHeight:S}=n.current;return w.layout(v,S),r.onReady&&r.onReady({api:w}),s.current=w,()=>{s.current=void 0,w.dispose()}},[]),pe.useEffect(()=>{if(!s.current)return()=>{};const d=s.current.onDidDrop(h=>{r.onDidDrop&&r.onDidDrop(h)});return()=>{d.dispose()}},[r.onDidDrop]),pe.useEffect(()=>{if(!s.current)return()=>{};const d=s.current.onWillDrop(h=>{r.onWillDrop&&r.onWillDrop(h)});return()=>{d.dispose()}},[r.onWillDrop]),pe.useEffect(()=>{s.current&&s.current.updateOptions({createComponent:d=>new Wm(d.id,r.components[d.name],{addPortal:a})})},[r.components]),pe.useEffect(()=>{var d;if(!s.current)return;const h=(d=r.tabComponents)!==null&&d!==void 0?d:{};r.defaultTabComponent&&(h[Cu]=r.defaultTabComponent),s.current.updateOptions({defaultTabComponent:r.defaultTabComponent?Cu:void 0,createTabComponent(m){return new Fm(m.id,h[m.name],{addPortal:a})}})},[r.tabComponents,r.defaultTabComponent]),pe.useEffect(()=>{s.current&&s.current.updateOptions({createWatermarkComponent:r.watermarkComponent?()=>new Hm("watermark",r.watermarkComponent,{addPortal:a}):void 0})},[r.watermarkComponent]),pe.useEffect(()=>{s.current&&s.current.updateOptions({createRightHeaderActionComponent:No(r.rightHeaderActionsComponent,{addPortal:a})})},[r.rightHeaderActionsComponent]),pe.useEffect(()=>{s.current&&s.current.updateOptions({createLeftHeaderActionComponent:No(r.leftHeaderActionsComponent,{addPortal:a})})},[r.leftHeaderActionsComponent]),pe.useEffect(()=>{s.current&&s.current.updateOptions({createPrefixHeaderActionComponent:No(r.prefixHeaderActionsComponent,{addPortal:a})})},[r.prefixHeaderActionsComponent]),pe.createElement("div",{style:{height:"100%",width:"100%"},ref:n},l)});Pv.displayName="DockviewComponent";class jm extends RS{constructor(e,n,s,l){super(e,n),this.reactComponent=s,this.reactPortalStore=l}getComponent(){var e,n;return new qr(this.element,this.reactPortalStore,this.reactComponent,{params:(n=(e=this._params)===null||e===void 0?void 0:e.params)!==null&&n!==void 0?n:{},api:this.api,containerApi:new pv(this._params.accessor)})}}function US(r){return dh.reduce((n,s)=>(s in r&&(n[s]=r[s]),n),{})}const $S=pe.forwardRef((r,e)=>{const n=pe.useRef(null),s=pe.useRef(),[l,a]=rc();pe.useImperativeHandle(e,()=>n.current,[]);const c=pe.useRef({});return pe.useEffect(()=>{const d={};dh.forEach(h=>{const m=h,w=r[m];m in r&&w!==c.current[m]&&(d[m]=w)}),s.current&&s.current.updateOptions(d),c.current=r},dh.map(d=>r[d])),pe.useEffect(()=>{if(!n.current)return()=>{};const d={createComponent:v=>new jm(v.id,v.name,r.components[v.name],{addPortal:a})},h=LS(n.current,Object.assign(Object.assign({},US(r)),d)),{clientWidth:m,clientHeight:w}=n.current;return h.layout(m,w),r.onReady&&r.onReady({api:h}),s.current=h,()=>{s.current=void 0,h.dispose()}},[]),pe.useEffect(()=>{s.current&&s.current.updateOptions({createComponent:d=>new jm(d.id,d.name,r.components[d.name],{addPortal:a})})},[r.components]),pe.createElement("div",{style:{height:"100%",width:"100%"},ref:n},l)});$S.displayName="SplitviewComponent";class Bm extends xv{constructor(e,n,s,l){super(e,n),this.reactComponent=s,this.reactPortalStore=l}getComponent(){var e,n;return new qr(this.element,this.reactPortalStore,this.reactComponent,{params:(n=(e=this._params)===null||e===void 0?void 0:e.params)!==null&&n!==void 0?n:{},api:this.api,containerApi:new mv(this._params.accessor)})}}function YS(r){return mh.reduce((n,s)=>(s in r&&(n[s]=r[s]),n),{})}const KS=pe.forwardRef((r,e)=>{const n=pe.useRef(null),s=pe.useRef(),[l,a]=rc();pe.useImperativeHandle(e,()=>n.current,[]);const c=pe.useRef({});return pe.useEffect(()=>{const d={};mh.forEach(h=>{const m=h,w=r[m];m in r&&w!==c.current[m]&&(d[m]=w)}),s.current&&s.current.updateOptions(d),c.current=r},mh.map(d=>r[d])),pe.useEffect(()=>{if(!n.current)return()=>{};const d={createComponent:v=>new Bm(v.id,v.name,r.components[v.name],{addPortal:a})},h=VS(n.current,Object.assign(Object.assign({},YS(r)),d)),{clientWidth:m,clientHeight:w}=n.current;return h.layout(m,w),r.onReady&&r.onReady({api:h}),s.current=h,()=>{s.current=void 0,h.dispose()}},[]),pe.useEffect(()=>{s.current&&s.current.updateOptions({createComponent:d=>new Bm(d.id,d.name,r.components[d.name],{addPortal:a})})},[r.components]),pe.createElement("div",{style:{height:"100%",width:"100%"},ref:n},l)});KS.displayName="GridviewComponent";class xu{get element(){return this._element}constructor(e,n,s){this.id=e,this.component=n,this.reactPortalStore=s,this._element=document.createElement("div"),this._element.style.height="100%",this._element.style.width="100%"}init(e){this.part=new qr(this.element,this.reactPortalStore,this.component,{params:e.params,api:e.api,title:e.title,containerApi:e.containerApi})}toJSON(){return{id:this.id}}update(e){var n;(n=this.part)===null||n===void 0||n.update(e.params)}dispose(){var e;(e=this.part)===null||e===void 0||e.dispose()}}function JS(r){return gh.reduce((n,s)=>(s in r&&(n[s]=r[s]),n),{})}const QS=pe.forwardRef((r,e)=>{const n=pe.useRef(null),s=pe.useRef(),[l,a]=rc();pe.useImperativeHandle(e,()=>n.current,[]);const c=pe.useRef({});return pe.useEffect(()=>{const d={};gh.forEach(h=>{const m=h,w=r[m];m in r&&w!==c.current[m]&&(d[m]=w)}),s.current&&s.current.updateOptions(d),c.current=r},gh.map(d=>r[d])),pe.useEffect(()=>{var d;if(!n.current)return()=>{};const h=(d=r.headerComponents)!==null&&d!==void 0?d:{},m={createComponent:E=>new xu(E.id,r.components[E.name],{addPortal:a}),createHeaderComponent:E=>new xu(E.id,h[E.name],{addPortal:a})},w=GS(n.current,Object.assign(Object.assign({},JS(r)),m)),{clientWidth:v,clientHeight:S}=n.current;return w.layout(v,S),r.onReady&&r.onReady({api:w}),s.current=w,()=>{s.current=void 0,w.dispose()}},[]),pe.useEffect(()=>{s.current&&s.current.updateOptions({createComponent:d=>new xu(d.id,r.components[d.name],{addPortal:a})})},[r.components]),pe.useEffect(()=>{var d;if(!s.current)return;const h=(d=r.headerComponents)!==null&&d!==void 0?d:{};s.current.updateOptions({createHeaderComponent:m=>new xu(m.id,h[m.name],{addPortal:a})})},[r.headerComponents]),pe.useEffect(()=>{if(!s.current)return()=>{};const d=s.current.onDidDrop(h=>{r.onDidDrop&&r.onDidDrop(h)});return()=>{d.dispose()}},[r.onDidDrop]),pe.createElement("div",{style:{height:"100%",width:"100%"},ref:n},l)});QS.displayName="PaneviewComponent";const ZS=!0,un="u-",XS="uplot",qS=un+"hz",eD=un+"vt",tD=un+"title",nD=un+"wrap",iD=un+"under",sD=un+"over",rD=un+"axis",Yr=un+"off",oD=un+"select",lD=un+"cursor-x",aD=un+"cursor-y",uD=un+"cursor-pt",cD=un+"legend",dD=un+"live",hD=un+"inline",fD=un+"series",pD=un+"marker",Um=un+"label",mD=un+"value",Gl="width",Wl="height",Ml="top",$m="bottom",Ro="left",Ud="right",Yh="#000",Ym=Yh+"0",$d="mousemove",Km="mousedown",Yd="mouseup",Jm="mouseenter",Qm="mouseleave",Zm="dblclick",gD="resize",vD="scroll",Xm="change",Uu="dppxchange",Kh="--",Qo=typeof window<"u",wh=Qo?document:null,Fo=Qo?window:null,wD=Qo?navigator:null;let tt,Eu;function _h(){let r=devicePixelRatio;tt!=r&&(tt=r,Eu&&Sh(Xm,Eu,_h),Eu=matchMedia(`(min-resolution: ${tt-.001}dppx) and (max-resolution: ${tt+.001}dppx)`),Qr(Xm,Eu,_h),Fo.dispatchEvent(new CustomEvent(Uu)))}function Pi(r,e){if(e!=null){let n=r.classList;!n.contains(e)&&n.add(e)}}function yh(r,e){let n=r.classList;n.contains(e)&&n.remove(e)}function wt(r,e,n){r.style[e]=n+"px"}function ns(r,e,n,s){let l=wh.createElement(r);return e!=null&&Pi(l,e),n!=null&&n.insertBefore(l,s),l}function Hi(r,e){return ns("div",r,e)}const qm=new WeakMap;function ws(r,e,n,s,l){let a="translate("+e+"px,"+n+"px)",c=qm.get(r);a!=c&&(r.style.transform=a,qm.set(r,a),e<0||n<0||e>s||n>l?Pi(r,Yr):yh(r,Yr))}const eg=new WeakMap;function tg(r,e,n){let s=e+n,l=eg.get(r);s!=l&&(eg.set(r,s),r.style.background=e,r.style.borderColor=n)}const ng=new WeakMap;function ig(r,e,n,s){let l=e+""+n,a=ng.get(r);l!=a&&(ng.set(r,l),r.style.height=n+"px",r.style.width=e+"px",r.style.marginLeft=s?-e/2+"px":0,r.style.marginTop=s?-n/2+"px":0)}const Jh={passive:!0},_D={...Jh,capture:!0};function Qr(r,e,n,s){e.addEventListener(r,n,s?_D:Jh)}function Sh(r,e,n,s){e.removeEventListener(r,n,Jh)}Qo&&_h();function is(r,e,n,s){let l;n=n||0,s=s||e.length-1;let a=s<=2147483647;for(;s-n>1;)l=a?n+s>>1:Ai((n+s)/2),e[l]{let a=-1,c=-1;for(let d=s;d<=l;d++)if(r(n[d])){a=d;break}for(let d=l;d>=s;d--)if(r(n[d])){c=d;break}return[a,c]}}const zv=r=>r!=null,kv=r=>r!=null&&r>0,oc=Av(zv),yD=Av(kv);function SD(r,e,n,s=0,l=!1){let a=l?yD:oc,c=l?kv:zv;[e,n]=a(r,e,n);let d=r[e],h=r[e];if(e>-1)if(s==1)d=r[e],h=r[n];else if(s==-1)d=r[n],h=r[e];else for(let m=e;m<=n;m++){let w=r[m];c(w)&&(wh&&(h=w))}return[d??ft,h??-ft]}function lc(r,e,n,s){let l=og(r),a=og(e);r==e&&(l==-1?(r*=n,e/=n):(r/=n,e*=n));let c=n==10?Ls:Ov,d=l==1?Ai:Ui,h=a==1?Ui:Ai,m=d(c(ln(r))),w=h(c(ln(e))),v=Bo(n,m),S=Bo(n,w);return n==10&&(m<0&&(v=pt(v,-m)),w<0&&(S=pt(S,-w))),s||n==2?(r=v*l,e=S*a):(r=Rv(r,v),e=ac(e,S)),[r,e]}function Qh(r,e,n,s){let l=lc(r,e,n,s);return r==0&&(l[0]=0),e==0&&(l[1]=0),l}const Zh=.1,sg={mode:3,pad:Zh},$l={pad:0,soft:null,mode:0},DD={min:$l,max:$l};function $u(r,e,n,s){return uc(n)?rg(r,e,n):($l.pad=n,$l.soft=s?0:null,$l.mode=s?3:0,rg(r,e,DD))}function qe(r,e){return r??e}function CD(r,e,n){for(e=qe(e,0),n=qe(n,r.length-1);e<=n;){if(r[e]!=null)return!0;e++}return!1}function rg(r,e,n){let s=n.min,l=n.max,a=qe(s.pad,0),c=qe(l.pad,0),d=qe(s.hard,-ft),h=qe(l.hard,ft),m=qe(s.soft,ft),w=qe(l.soft,-ft),v=qe(s.mode,0),S=qe(l.mode,0),E=e-r,A=Ls(E),D=ti(ln(r),ln(e)),P=Ls(D),R=ln(P-A);(E<1e-24||R>10)&&(E=0,(r==0||e==0)&&(E=1e-24,v==2&&m!=ft&&(a=0),S==2&&w!=-ft&&(c=0)));let O=E||D||1e3,M=Ls(O),N=Bo(10,Ai(M)),Z=O*(E==0?r==0?.1:1:a),G=pt(Rv(r-Z,N/10),24),$=r>=m&&(v==1||v==3&&G<=m||v==2&&G>=m)?m:ft,K=ti(d,G<$&&r>=$?$:ss($,G)),he=O*(E==0?e==0?.1:1:c),ue=pt(ac(e+he,N/10),24),Q=e<=w&&(S==1||S==3&&ue>=w||S==2&&ue<=w)?w:-ft,ve=ss(h,ue>Q&&e<=Q?Q:ti(Q,ue));return K==ve&&K==0&&(ve=100),[K,ve]}const xD=new Intl.NumberFormat(Qo?wD.language:"en-US"),Xh=r=>xD.format(r),zi=Math,ku=zi.PI,ln=zi.abs,Ai=zi.floor,rn=zi.round,Ui=zi.ceil,ss=zi.min,ti=zi.max,Bo=zi.pow,og=zi.sign,Ls=zi.log10,Ov=zi.log2,ED=(r,e=1)=>zi.sinh(r)*e,Kd=(r,e=1)=>zi.asinh(r/e),ft=1/0;function lg(r){return(Ls((r^r>>31)-(r>>31))|0)+1}function Dh(r,e,n){return ss(ti(r,e),n)}function Tv(r){return typeof r=="function"}function Ye(r){return Tv(r)?r:()=>r}const bD=()=>{},Iv=r=>r,Nv=(r,e)=>e,PD=r=>null,ag=r=>!0,ug=(r,e)=>r==e,AD=/\.\d*?(?=9{6,}|0{6,})/gm,Xr=r=>{if(Lv(r)||yr.has(r))return r;const e=`${r}`,n=e.match(AD);if(n==null)return r;let s=n[0].length-1;if(e.indexOf("e-")!=-1){let[l,a]=e.split("e");return+`${Xr(l)}e${a}`}return pt(r,s)};function Ur(r,e){return Xr(pt(Xr(r/e))*e)}function ac(r,e){return Xr(Ui(Xr(r/e))*e)}function Rv(r,e){return Xr(Ai(Xr(r/e))*e)}function pt(r,e=0){if(Lv(r))return r;let n=10**e,s=r*n*(1+Number.EPSILON);return rn(s)/n}const yr=new Map;function Mv(r){return((""+r).split(".")[1]||"").length}function ea(r,e,n,s){let l=[],a=s.map(Mv);for(let c=e;c=0?0:d)+(c>=a[m]?0:a[m]),S=r==10?w:pt(w,v);l.push(S),yr.set(S,v)}}return l}const Yl={},qh=[],Uo=[null,null],wr=Array.isArray,Lv=Number.isInteger,zD=r=>r===void 0;function cg(r){return typeof r=="string"}function uc(r){let e=!1;if(r!=null){let n=r.constructor;e=n==null||n==Object}return e}function kD(r){return r!=null&&typeof r=="object"}const OD=Object.getPrototypeOf(Uint8Array),Vv="__proto__";function $o(r,e=uc){let n;if(wr(r)){let s=r.find(l=>l!=null);if(wr(s)||e(s)){n=Array(r.length);for(let l=0;la){for(l=c-1;l>=0&&r[l]==null;)r[l--]=null;for(l=c+1;lc-d)],l=s[0].length,a=new Map;for(let c=0;c"u"?r=>Promise.resolve().then(r):queueMicrotask;function VD(r){let e=r[0],n=e.length,s=Array(n);for(let a=0;ae[a]-e[c]);let l=[];for(let a=0;a=s&&r[l]==null;)l--;if(l<=s)return!0;const a=ti(1,Ai((l-s+1)/e));for(let c=r[s],d=s+a;d<=l;d+=a){const h=r[d];if(h!=null){if(h<=c)return!1;c=h}}return!0}const Gv=["January","February","March","April","May","June","July","August","September","October","November","December"],Wv=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function Fv(r){return r.slice(0,3)}const FD=Wv.map(Fv),HD=Gv.map(Fv),jD={MMMM:Gv,MMM:HD,WWWW:Wv,WWW:FD};function Ll(r){return(r<10?"0":"")+r}function BD(r){return(r<10?"00":r<100?"0":"")+r}const UD={YYYY:r=>r.getFullYear(),YY:r=>(r.getFullYear()+"").slice(2),MMMM:(r,e)=>e.MMMM[r.getMonth()],MMM:(r,e)=>e.MMM[r.getMonth()],MM:r=>Ll(r.getMonth()+1),M:r=>r.getMonth()+1,DD:r=>Ll(r.getDate()),D:r=>r.getDate(),WWWW:(r,e)=>e.WWWW[r.getDay()],WWW:(r,e)=>e.WWW[r.getDay()],HH:r=>Ll(r.getHours()),H:r=>r.getHours(),h:r=>{let e=r.getHours();return e==0?12:e>12?e-12:e},AA:r=>r.getHours()>=12?"PM":"AM",aa:r=>r.getHours()>=12?"pm":"am",a:r=>r.getHours()>=12?"p":"a",mm:r=>Ll(r.getMinutes()),m:r=>r.getMinutes(),ss:r=>Ll(r.getSeconds()),s:r=>r.getSeconds(),fff:r=>BD(r.getMilliseconds())};function ef(r,e){e=e||jD;let n=[],s=/\{([a-z]+)\}|[^{]+/gi,l;for(;l=s.exec(r);)n.push(l[0][0]=="{"?UD[l[1]]:l[0]);return a=>{let c="";for(let d=0;dr%1==0,Yu=[1,2,2.5,5],KD=ea(10,-32,0,Yu),jv=ea(10,0,32,Yu),JD=jv.filter(Hv),$r=KD.concat(jv),tf=` -`,Bv="{YYYY}",dg=tf+Bv,Uv="{M}/{D}",Fl=tf+Uv,bu=Fl+"/{YY}",$v="{aa}",QD="{h}:{mm}",Vo=QD+$v,hg=tf+Vo,fg=":{ss}",rt=null;function Yv(r){let e=r*1e3,n=e*60,s=n*60,l=s*24,a=l*30,c=l*365,h=(r==1?ea(10,0,3,Yu).filter(Hv):ea(10,-3,0,Yu)).concat([e,e*5,e*10,e*15,e*30,n,n*5,n*10,n*15,n*30,s,s*2,s*3,s*4,s*6,s*8,s*12,l,l*2,l*3,l*4,l*5,l*6,l*7,l*8,l*9,l*10,l*15,a,a*2,a*3,a*4,a*6,c,c*2,c*5,c*10,c*25,c*50,c*100]);const m=[[c,Bv,rt,rt,rt,rt,rt,rt,1],[l*28,"{MMM}",dg,rt,rt,rt,rt,rt,1],[l,Uv,dg,rt,rt,rt,rt,rt,1],[s,"{h}"+$v,bu,rt,Fl,rt,rt,rt,1],[n,Vo,bu,rt,Fl,rt,rt,rt,1],[e,fg,bu+" "+Vo,rt,Fl+" "+Vo,rt,hg,rt,1],[r,fg+".{fff}",bu+" "+Vo,rt,Fl+" "+Vo,rt,hg,rt,1]];function w(v){return(S,E,A,D,P,R)=>{let O=[],M=P>=c,N=P>=a&&P=l?l:P,ue=Ai(A)-Ai(G),Q=K+ue+ac(G-K,he);O.push(Q);let ve=v(Q),ie=ve.getHours()+ve.getMinutes()/n+ve.getSeconds()/s,ce=P/s,j=S.axes[E]._space,te=R/j;for(;Q=pt(Q+P,r==1?0:3),!(Q>D);)if(ce>1){let X=Ai(pt(ie+ce,6))%24,ne=v(Q).getHours()-X;ne>1&&(ne=-1),Q-=ne*s,ie=(ie+ce)%24;let k=O[O.length-1];pt((Q-k)/P,3)*te>=.7&&O.push(Q)}else O.push(Q)}return O}}return[h,m,w]}const[ZD,XD,qD]=Yv(1),[eC,tC,nC]=Yv(.001);ea(2,-53,53,[1]);function pg(r,e){return r.map(n=>n.map((s,l)=>l==0||l==8||s==null?s:e(l==1||n[8]==0?s:n[1]+s)))}function mg(r,e){return(n,s,l,a,c)=>{let d=e.find(A=>c>=A[0])||e[e.length-1],h,m,w,v,S,E;return s.map(A=>{let D=r(A),P=D.getFullYear(),R=D.getMonth(),O=D.getDate(),M=D.getHours(),N=D.getMinutes(),Z=D.getSeconds(),G=P!=h&&d[2]||R!=m&&d[3]||O!=w&&d[4]||M!=v&&d[5]||N!=S&&d[6]||Z!=E&&d[7]||d[1];return h=P,m=R,w=O,v=M,S=N,E=Z,G(D)})}}function iC(r,e){let n=ef(e);return(s,l,a,c,d)=>l.map(h=>n(r(h)))}function Jd(r,e,n){return new Date(r,e,n)}function gg(r,e){return e(r)}const sC="{YYYY}-{MM}-{DD} {h}:{mm}{aa}";function vg(r,e){return(n,s,l,a)=>a==null?Kh:e(r(s))}function rC(r,e){let n=r.series[e];return n.width?n.stroke(r,e):n.points.width?n.points.stroke(r,e):null}function oC(r,e){return r.series[e].fill(r,e)}const lC={show:!0,live:!0,isolate:!1,mount:bD,markers:{show:!0,width:2,stroke:rC,fill:oC,dash:"solid"},idx:null,idxs:null,values:[]};function aC(r,e){let n=r.cursor.points,s=Hi(),l=n.size(r,e);wt(s,Gl,l),wt(s,Wl,l);let a=l/-2;wt(s,"marginLeft",a),wt(s,"marginTop",a);let c=n.width(r,e,l);return c&&wt(s,"borderWidth",c),s}function uC(r,e){let n=r.series[e].points;return n._fill||n._stroke}function cC(r,e){let n=r.series[e].points;return n._stroke||n._fill}function dC(r,e){return r.series[e].points.size}const Qd=[0,0];function hC(r,e,n){return Qd[0]=e,Qd[1]=n,Qd}function Pu(r,e,n,s=!0){return l=>{l.button==0&&(!s||l.target==e)&&n(l)}}function Zd(r,e,n,s=!0){return l=>{(!s||l.target==e)&&n(l)}}const fC={show:!0,x:!0,y:!0,lock:!1,move:hC,points:{one:!1,show:aC,size:dC,width:0,stroke:cC,fill:uC},bind:{mousedown:Pu,mouseup:Pu,click:Pu,dblclick:Pu,mousemove:Zd,mouseleave:Zd,mouseenter:Zd},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,click:(r,e)=>{e.stopPropagation(),e.stopImmediatePropagation()},_x:!1,_y:!1},focus:{dist:(r,e,n,s,l)=>s-l,prox:-1,bias:0},hover:{skip:[void 0],prox:null,bias:0},left:-10,top:-10,idx:null,dataIdx:null,idxs:null,event:null},Kv={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},nf=Jt({},Kv,{filter:Nv}),Jv=Jt({},nf,{size:10}),Qv=Jt({},Kv,{show:!1}),sf='12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',Zv="bold "+sf,Xv=1.5,wg={show:!0,scale:"x",stroke:Yh,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:Zv,side:2,grid:nf,ticks:Jv,border:Qv,font:sf,lineGap:Xv,rotate:0},pC="Value",mC="Time",_g={show:!0,scale:"x",auto:!1,sorted:1,min:ft,max:-ft,idxs:[]};function gC(r,e,n,s,l){return e.map(a=>a==null?"":Xh(a))}function vC(r,e,n,s,l,a,c){let d=[],h=yr.get(l)||0;n=c?n:pt(ac(n,l),h);for(let m=n;m<=s;m=pt(m+l,h))d.push(Object.is(m,-0)?0:m);return d}function Ch(r,e,n,s,l,a,c){const d=[],h=r.scales[r.axes[e].scale].log,m=h==10?Ls:Ov,w=Ai(m(n));l=Bo(h,w),h==10&&(l=$r[is(l,$r)]);let v=n,S=l*h;h==10&&(S=$r[is(S,$r)]);do d.push(v),v=v+l,h==10&&!yr.has(v)&&(v=pt(v,yr.get(l))),v>=S&&(l=v,S=l*h,h==10&&(S=$r[is(S,$r)]));while(v<=s);return d}function wC(r,e,n,s,l,a,c){let h=r.scales[r.axes[e].scale].asinh,m=s>h?Ch(r,e,ti(h,n),s,l):[h],w=s>=0&&n<=0?[0]:[];return(n<-h?Ch(r,e,ti(h,-s),-n,l):[h]).reverse().map(S=>-S).concat(w,m)}const qv=/./,_C=/[12357]/,yC=/[125]/,yg=/1/,xh=(r,e,n,s)=>r.map((l,a)=>e==4&&l==0||a%s==0&&n.test(l.toExponential()[l<0?1:0])?l:null);function SC(r,e,n,s,l){let a=r.axes[n],c=a.scale,d=r.scales[c],h=r.valToPos,m=a._space,w=h(10,c),v=h(9,c)-w>=m?qv:h(7,c)-w>=m?_C:h(5,c)-w>=m?yC:yg;if(v==yg){let S=ln(h(1,c)-w);if(Sl,Cg={show:!0,auto:!0,sorted:0,gaps:ew,alpha:1,facets:[Jt({},Dg,{scale:"x"}),Jt({},Dg,{scale:"y"})]},xg={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:ew,alpha:1,points:{show:EC,filter:null},values:null,min:ft,max:-ft,idxs:[],path:null,clip:null};function bC(r,e,n,s,l){return n/10}const tw={time:ZS,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},PC=Jt({},tw,{time:!1,ori:1}),Eg={};function nw(r,e){let n=Eg[r];return n||(n={key:r,plots:[],sub(s){n.plots.push(s)},unsub(s){n.plots=n.plots.filter(l=>l!=s)},pub(s,l,a,c,d,h,m){for(let w=0;w{let R=c.pxRound;const O=m.dir*(m.ori==0?1:-1),M=m.ori==0?Zo:Xo;let N,Z;O==1?(N=n,Z=s):(N=s,Z=n);let G=R(v(d[N],m,D,E)),$=R(S(h[N],w,P,A)),K=R(v(d[Z],m,D,E)),he=R(S(a==1?w.max:w.min,w,P,A)),ue=new Path2D(l);return M(ue,K,he),M(ue,G,he),M(ue,G,$),ue})}function cc(r,e,n,s,l,a){let c=null;if(r.length>0){c=new Path2D;const d=e==0?fc:lf;let h=n;for(let v=0;vS[0]){let E=S[0]-h;E>0&&d(c,h,s,E,s+a),h=S[1]}}let m=n+l-h,w=10;m>0&&d(c,h,s-w/2,m,s+a+w)}return c}function zC(r,e,n){let s=r[r.length-1];s&&s[0]==e?s[1]=n:r.push([e,n])}function of(r,e,n,s,l,a,c){let d=[],h=r.length;for(let m=l==1?n:s;m>=n&&m<=s;m+=l)if(e[m]===null){let v=m,S=m;if(l==1)for(;++m<=s&&e[m]===null;)S=m;else for(;--m>=n&&e[m]===null;)S=m;let E=a(r[v]),A=S==v?E:a(r[S]),D=v-l;E=c<=0&&D>=0&&D=0&&R>=0&&R=E&&d.push([E,A])}return d}function bg(r){return r==0?Iv:r==1?rn:e=>Ur(e,r)}function iw(r){let e=r==0?dc:hc,n=r==0?(l,a,c,d,h,m)=>{l.arcTo(a,c,d,h,m)}:(l,a,c,d,h,m)=>{l.arcTo(c,a,h,d,m)},s=r==0?(l,a,c,d,h)=>{l.rect(a,c,d,h)}:(l,a,c,d,h)=>{l.rect(c,a,h,d)};return(l,a,c,d,h,m=0,w=0)=>{m==0&&w==0?s(l,a,c,d,h):(m=ss(m,d/2,h/2),w=ss(w,d/2,h/2),e(l,a+m,c),n(l,a+d,c,a+d,c+h,m),n(l,a+d,c+h,a,c+h,w),n(l,a,c+h,a,c,w),n(l,a,c,a+d,c,m),l.closePath())}}const dc=(r,e,n)=>{r.moveTo(e,n)},hc=(r,e,n)=>{r.moveTo(n,e)},Zo=(r,e,n)=>{r.lineTo(e,n)},Xo=(r,e,n)=>{r.lineTo(n,e)},fc=iw(0),lf=iw(1),sw=(r,e,n,s,l,a)=>{r.arc(e,n,s,l,a)},rw=(r,e,n,s,l,a)=>{r.arc(n,e,s,l,a)},ow=(r,e,n,s,l,a,c)=>{r.bezierCurveTo(e,n,s,l,a,c)},lw=(r,e,n,s,l,a,c)=>{r.bezierCurveTo(n,e,l,s,c,a)};function aw(r){return(e,n,s,l,a)=>eo(e,n,(c,d,h,m,w,v,S,E,A,D,P)=>{let{pxRound:R,points:O}=c,M,N;m.ori==0?(M=dc,N=sw):(M=hc,N=rw);const Z=pt(O.width*tt,3);let G=(O.size-O.width)/2*tt,$=pt(G*2,3),K=new Path2D,he=new Path2D,{left:ue,top:Q,width:ve,height:ie}=e.bbox;fc(he,ue-$,Q-$,ve+$*2,ie+$*2);const ce=j=>{if(h[j]!=null){let te=R(v(d[j],m,D,E)),X=R(S(h[j],w,P,A));M(K,te+G,X),N(K,te,X,G,0,ku*2)}};if(a)a.forEach(ce);else for(let j=s;j<=l;j++)ce(j);return{stroke:Z>0?K:null,fill:K,clip:he,flags:Yo|Eh}})}function uw(r){return(e,n,s,l,a,c)=>{s!=l&&(a!=s&&c!=s&&r(e,n,s),a!=l&&c!=l&&r(e,n,l),r(e,n,c))}}const kC=uw(Zo),OC=uw(Xo);function cw(r){const e=qe(r==null?void 0:r.alignGaps,0);return(n,s,l,a)=>eo(n,s,(c,d,h,m,w,v,S,E,A,D,P)=>{[l,a]=oc(h,l,a);let R=c.pxRound,O=ie=>R(v(ie,m,D,E)),M=ie=>R(S(ie,w,P,A)),N,Z;m.ori==0?(N=Zo,Z=kC):(N=Xo,Z=OC);const G=m.dir*(m.ori==0?1:-1),$={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:Yo},K=$.stroke;let he=!1;if(a-l>=D*4){let ie=q=>n.posToVal(q,m.key,!0),ce=null,j=null,te,X,le,fe=O(d[G==1?l:a]),ne=O(d[l]),k=O(d[a]),F=ie(G==1?ne+1:k-1);for(let q=G==1?l:a;q>=l&&q<=a;q+=G){let xe=d[q],Se=(G==1?xeF)?fe:O(xe),Ee=h[q];Se==fe?Ee!=null?(X=Ee,ce==null?(N(K,Se,M(X)),te=ce=j=X):Xj&&(j=X)):Ee===null&&(he=!0):(ce!=null&&Z(K,fe,M(ce),M(j),M(te),M(X)),Ee!=null?(X=Ee,N(K,Se,M(X)),ce=j=te=X):(ce=j=null,Ee===null&&(he=!0)),fe=Se,F=ie(fe+G))}ce!=null&&ce!=j&&le!=fe&&Z(K,fe,M(ce),M(j),M(te),M(X))}else for(let ie=G==1?l:a;ie>=l&&ie<=a;ie+=G){let ce=h[ie];ce===null?he=!0:ce!=null&&N(K,O(d[ie]),M(ce))}let[Q,ve]=rf(n,s);if(c.fill!=null||Q!=0){let ie=$.fill=new Path2D(K),ce=c.fillTo(n,s,c.min,c.max,Q),j=M(ce),te=O(d[l]),X=O(d[a]);G==-1&&([X,te]=[te,X]),N(ie,X,j),N(ie,te,j)}if(!c.spanGaps){let ie=[];he&&ie.push(...of(d,h,l,a,G,O,e)),$.gaps=ie=c.gaps(n,s,l,a,ie),$.clip=cc(ie,m.ori,E,A,D,P)}return ve!=0&&($.band=ve==2?[Vs(n,s,l,a,K,-1),Vs(n,s,l,a,K,1)]:Vs(n,s,l,a,K,ve)),$})}function TC(r){const e=qe(r.align,1),n=qe(r.ascDesc,!1),s=qe(r.alignGaps,0),l=qe(r.extend,!1);return(a,c,d,h)=>eo(a,c,(m,w,v,S,E,A,D,P,R,O,M)=>{[d,h]=oc(v,d,h);let N=m.pxRound,{left:Z,width:G}=a.bbox,$=ne=>N(A(ne,S,O,P)),K=ne=>N(D(ne,E,M,R)),he=S.ori==0?Zo:Xo;const ue={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:Yo},Q=ue.stroke,ve=S.dir*(S.ori==0?1:-1);let ie=K(v[ve==1?d:h]),ce=$(w[ve==1?d:h]),j=ce,te=ce;l&&e==-1&&(te=Z,he(Q,te,ie)),he(Q,ce,ie);for(let ne=ve==1?d:h;ne>=d&&ne<=h;ne+=ve){let k=v[ne];if(k==null)continue;let F=$(w[ne]),q=K(k);e==1?he(Q,F,ie):he(Q,j,q),he(Q,F,q),ie=q,j=F}let X=j;l&&e==1&&(X=Z+G,he(Q,X,ie));let[le,fe]=rf(a,c);if(m.fill!=null||le!=0){let ne=ue.fill=new Path2D(Q),k=m.fillTo(a,c,m.min,m.max,le),F=K(k);he(ne,X,F),he(ne,te,F)}if(!m.spanGaps){let ne=[];ne.push(...of(w,v,d,h,ve,$,s));let k=m.width*tt/2,F=n||e==1?k:-k,q=n||e==-1?-k:k;ne.forEach(xe=>{xe[0]+=F,xe[1]+=q}),ue.gaps=ne=m.gaps(a,c,d,h,ne),ue.clip=cc(ne,S.ori,P,R,O,M)}return fe!=0&&(ue.band=fe==2?[Vs(a,c,d,h,Q,-1),Vs(a,c,d,h,Q,1)]:Vs(a,c,d,h,Q,fe)),ue})}function Pg(r,e,n,s,l,a,c=ft){if(r.length>1){let d=null;for(let h=0,m=1/0;h{}),{fill:v,stroke:S}=m;return(E,A,D,P)=>eo(E,A,(R,O,M,N,Z,G,$,K,he,ue,Q)=>{let ve=R.pxRound,ie=n,ce=s*tt,j=d*tt,te=h*tt,X,le;N.ori==0?[X,le]=a(E,A):[le,X]=a(E,A);const fe=N.dir*(N.ori==0?1:-1);let ne=N.ori==0?fc:lf,k=N.ori==0?w:(ge,et,it,hn,In,Xt,kt)=>{w(ge,et,it,In,hn,kt,Xt)},F=qe(E.bands,qh).find(ge=>ge.series[0]==A),q=F!=null?F.dir:0,xe=R.fillTo(E,A,R.min,R.max,q),Ie=ve($(xe,Z,Q,he)),Se,Ee,We,Fe=ue,Me=ve(R.width*tt),Zt=!1,Wt=null,Ft=null,Ht=null,ii=null;v!=null&&(Me==0||S!=null)&&(Zt=!0,Wt=v.values(E,A,D,P),Ft=new Map,new Set(Wt).forEach(ge=>{ge!=null&&Ft.set(ge,new Path2D)}),Me>0&&(Ht=S.values(E,A,D,P),ii=new Map,new Set(Ht).forEach(ge=>{ge!=null&&ii.set(ge,new Path2D)})));let{x0:Tn,size:ki}=m;if(Tn!=null&&ki!=null){ie=1,O=Tn.values(E,A,D,P),Tn.unit==2&&(O=O.map(it=>E.posToVal(K+it*ue,N.key,!0)));let ge=ki.values(E,A,D,P);ki.unit==2?Ee=ge[0]*ue:Ee=G(ge[0],N,ue,K)-G(0,N,ue,K),Fe=Pg(O,M,G,N,ue,K,Fe),We=Fe-Ee+ce}else Fe=Pg(O,M,G,N,ue,K,Fe),We=Fe*c+ce,Ee=Fe-We;We<1&&(We=0),Me>=Ee/2&&(Me=0),We<5&&(ve=Iv);let ls=We>0,Un=Fe-We-(ls?Me:0);Ee=ve(Dh(Un,te,j)),Se=(ie==0?Ee/2:ie==fe?0:Ee)-ie*fe*((ie==0?ce/2:0)+(ls?Me/2:0));const nt={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},cn=Zt?null:new Path2D;let dn=null;if(F!=null)dn=E.data[F.series[1]];else{let{y0:ge,y1:et}=m;ge!=null&&et!=null&&(M=et.values(E,A,D,P),dn=ge.values(E,A,D,P))}let pi=X*Ee,Le=le*Ee;for(let ge=fe==1?D:P;ge>=D&&ge<=P;ge+=fe){let et=M[ge];if(et==null)continue;if(dn!=null){let qt=dn[ge]??0;if(et-qt==0)continue;Ie=$(qt,Z,Q,he)}let it=N.distr!=2||m!=null?O[ge]:ge,hn=G(it,N,ue,K),In=$(qe(et,xe),Z,Q,he),Xt=ve(hn-Se),kt=ve(ti(In,Ie)),fn=ve(ss(In,Ie)),xn=kt-fn;if(et!=null){let qt=et<0?Le:pi,En=et<0?pi:Le;Zt?(Me>0&&Ht[ge]!=null&&ne(ii.get(Ht[ge]),Xt,fn+Ai(Me/2),Ee,ti(0,xn-Me),qt,En),Wt[ge]!=null&&ne(Ft.get(Wt[ge]),Xt,fn+Ai(Me/2),Ee,ti(0,xn-Me),qt,En)):ne(cn,Xt,fn+Ai(Me/2),Ee,ti(0,xn-Me),qt,En),k(E,A,ge,Xt-Me/2,fn,Ee+Me,xn)}}return Me>0?nt.stroke=Zt?ii:cn:Zt||(nt._fill=R.width==0?R._fill:R._stroke??R._fill,nt.width=0),nt.fill=Zt?Ft:cn,nt})}function NC(r,e){const n=qe(e==null?void 0:e.alignGaps,0);return(s,l,a,c)=>eo(s,l,(d,h,m,w,v,S,E,A,D,P,R)=>{[a,c]=oc(m,a,c);let O=d.pxRound,M=X=>O(S(X,w,P,A)),N=X=>O(E(X,v,R,D)),Z,G,$;w.ori==0?(Z=dc,$=Zo,G=ow):(Z=hc,$=Xo,G=lw);const K=w.dir*(w.ori==0?1:-1);let he=M(h[K==1?a:c]),ue=he,Q=[],ve=[];for(let X=K==1?a:c;X>=a&&X<=c;X+=K)if(m[X]!=null){let fe=h[X],ne=M(fe);Q.push(ue=ne),ve.push(N(m[X]))}const ie={stroke:r(Q,ve,Z,$,G,O),fill:null,clip:null,band:null,gaps:null,flags:Yo},ce=ie.stroke;let[j,te]=rf(s,l);if(d.fill!=null||j!=0){let X=ie.fill=new Path2D(ce),le=d.fillTo(s,l,d.min,d.max,j),fe=N(le);$(X,ue,fe),$(X,he,fe)}if(!d.spanGaps){let X=[];X.push(...of(h,m,a,c,K,M,n)),ie.gaps=X=d.gaps(s,l,a,c,X),ie.clip=cc(X,w.ori,A,D,P,R)}return te!=0&&(ie.band=te==2?[Vs(s,l,a,c,ce,-1),Vs(s,l,a,c,ce,1)]:Vs(s,l,a,c,ce,te)),ie})}function RC(r){return NC(MC,r)}function MC(r,e,n,s,l,a){const c=r.length;if(c<2)return null;const d=new Path2D;if(n(d,r[0],e[0]),c==2)s(d,r[1],e[1]);else{let h=Array(c),m=Array(c-1),w=Array(c-1),v=Array(c-1);for(let S=0;S0!=m[S]>0?h[S]=0:(h[S]=3*(v[S-1]+v[S])/((2*v[S]+v[S-1])/m[S-1]+(v[S]+2*v[S-1])/m[S]),isFinite(h[S])||(h[S]=0));h[c-1]=m[c-2];for(let S=0;S{jn.pxRatio=tt}));const LC=cw(),VC=aw();function zg(r,e,n,s){return(s?[r[0],r[1]].concat(r.slice(2)):[r[0]].concat(r.slice(1))).map((a,c)=>Ph(a,c,e,n))}function GC(r,e){return r.map((n,s)=>s==0?{}:Jt({},e,n))}function Ph(r,e,n,s){return Jt({},e==0?n:s,r)}function dw(r,e,n){return e==null?Uo:[e,n]}const WC=dw;function FC(r,e,n){return e==null?Uo:$u(e,n,Zh,!0)}function hw(r,e,n,s){return e==null?Uo:lc(e,n,r.scales[s].log,!1)}const HC=hw;function fw(r,e,n,s){return e==null?Uo:Qh(e,n,r.scales[s].log,!1)}const jC=fw;function BC(r,e,n,s,l){let a=ti(lg(r),lg(e)),c=e-r,d=is(l/s*c,n);do{let h=n[d],m=s*h/c;if(m>=l&&a+(h<5?yr.get(h):0)<=17)return[h,m]}while(++d(e=rn((n=+l)*tt))+"px"),[r,e,n]}function UC(r){r.show&&[r.font,r.labelFont].forEach(e=>{let n=pt(e[2]*tt,1);e[0]=e[0].replace(/[0-9.]+px/,n+"px"),e[1]=n})}function jn(r,e,n){const s={mode:qe(r.mode,1)},l=s.mode;function a(g,y,C,x){let T=y.valToPct(g);return x+C*(y.dir==-1?1-T:T)}function c(g,y,C,x){let T=y.valToPct(g);return x+C*(y.dir==-1?T:1-T)}function d(g,y,C,x){return y.ori==0?a(g,y,C,x):c(g,y,C,x)}s.valToPosH=a,s.valToPosV=c;let h=!1;s.status=0;const m=s.root=Hi(XS);if(r.id!=null&&(m.id=r.id),Pi(m,r.class),r.title){let g=Hi(tD,m);g.textContent=r.title}const w=ns("canvas"),v=s.ctx=w.getContext("2d"),S=Hi(nD,m);Qr("click",S,g=>{g.target===A&&(Ze!=xs||ot!=Zs)&&tn.click(s,g)},!0);const E=s.under=Hi(iD,S);S.appendChild(w);const A=s.over=Hi(sD,S);r=$o(r);const D=+qe(r.pxAlign,1),P=bg(D);(r.plugins||[]).forEach(g=>{g.opts&&(r=g.opts(s,r)||r)});const R=r.ms||.001,O=s.series=l==1?zg(r.series||[],_g,xg,!1):GC(r.series||[null],Cg),M=s.axes=zg(r.axes||[],wg,Sg,!0),N=s.scales={},Z=s.bands=r.bands||[];Z.forEach(g=>{g.fill=Ye(g.fill||null),g.dir=qe(g.dir,-1)});const G=l==2?O[1].facets[0].scale:O[0].scale,$={axes:da,series:vc},K=(r.drawOrder||["axes","series"]).map(g=>$[g]);function he(g){const y=g.distr==3?C=>Ls(C>0?C:g.clamp(s,C,g.min,g.max,g.key)):g.distr==4?C=>Kd(C,g.asinh):g.distr==100?C=>g.fwd(C):C=>C;return C=>{let x=y(C),{_min:T,_max:V}=g,J=V-T;return(x-T)/J}}function ue(g){let y=N[g];if(y==null){let C=(r.scales||Yl)[g]||Yl;if(C.from!=null){ue(C.from);let x=Jt({},N[C.from],C,{key:g});x.valToPct=he(x),N[g]=x}else{y=N[g]=Jt({},g==G?tw:PC,C),y.key=g;let x=y.time,T=y.range,V=wr(T);if((g!=G||l==2&&!x)&&(V&&(T[0]==null||T[1]==null)&&(T={min:T[0]==null?sg:{mode:1,hard:T[0],soft:T[0]},max:T[1]==null?sg:{mode:1,hard:T[1],soft:T[1]}},V=!1),!V&&uc(T))){let J=T;T=(se,ae,me)=>ae==null?Uo:$u(ae,me,J)}y.range=Ye(T||(x?WC:g==G?y.distr==3?HC:y.distr==4?jC:dw:y.distr==3?hw:y.distr==4?fw:FC)),y.auto=Ye(V?!1:y.auto),y.clamp=Ye(y.clamp||bC),y._min=y._max=null,y.valToPct=he(y)}}}ue("x"),ue("y"),l==1&&O.forEach(g=>{ue(g.scale)}),M.forEach(g=>{ue(g.scale)});for(let g in r.scales)ue(g);const Q=N[G],ve=Q.distr;let ie,ce;Q.ori==0?(Pi(m,qS),ie=a,ce=c):(Pi(m,eD),ie=c,ce=a);const j={};for(let g in N){let y=N[g];(y.min!=null||y.max!=null)&&(j[g]={min:y.min,max:y.max},y.min=y.max=null)}const te=r.tzDate||(g=>new Date(rn(g/R))),X=r.fmtDate||ef,le=R==1?qD(te):nC(te),fe=mg(te,pg(R==1?XD:tC,X)),ne=vg(te,gg(sC,X)),k=[],F=s.legend=Jt({},lC,r.legend),q=s.cursor=Jt({},fC,{drag:{y:l==2}},r.cursor),xe=F.show,Ie=q.show,Se=F.markers;F.idxs=k,Se.width=Ye(Se.width),Se.dash=Ye(Se.dash),Se.stroke=Ye(Se.stroke),Se.fill=Ye(Se.fill);let Ee,We,Fe,Me=[],Zt=[],Wt,Ft=!1,Ht={};if(F.live){const g=O[1]?O[1].values:null;Ft=g!=null,Wt=Ft?g(s,1,0):{_:0};for(let y in Wt)Ht[y]=Kh}if(xe)if(Ee=ns("table",cD,m),Fe=ns("tbody",null,Ee),F.mount(s,Ee),Ft){We=ns("thead",null,Ee,Fe);let g=ns("tr",null,We);ns("th",null,g);for(var ii in Wt)ns("th",Um,g).textContent=ii}else Pi(Ee,hD),F.live&&Pi(Ee,dD);const Tn={show:!0},ki={show:!1};function ls(g,y){if(y==0&&(Ft||!F.live||l==2))return Uo;let C=[],x=ns("tr",fD,Fe,Fe.childNodes[y]);Pi(x,g.class),g.show||Pi(x,Yr);let T=ns("th",null,x);if(Se.show){let se=Hi(pD,T);if(y>0){let ae=Se.width(s,y);ae&&(se.style.border=ae+"px "+Se.dash(s,y)+" "+Se.stroke(s,y)),se.style.background=Se.fill(s,y)}}let V=Hi(Um,T);g.label instanceof HTMLElement?V.appendChild(g.label):V.textContent=g.label,y>0&&(Se.show||(V.style.color=g.width>0?Se.stroke(s,y):Se.fill(s,y)),nt("click",T,se=>{if(q._lock)return;Pn(se);let ae=O.indexOf(g);if((se.ctrlKey||se.metaKey)!=F.isolate){let me=O.some((we,_e)=>_e>0&&_e!=ae&&we.show);O.forEach((we,_e)=>{_e>0&&Si(_e,me?_e==ae?Tn:ki:Tn,!0,Tt.setSeries)})}else Si(ae,{show:!g.show},!0,Tt.setSeries)},!1),Et&&nt(Jm,T,se=>{q._lock||(Pn(se),Si(O.indexOf(g),er,!0,Tt.setSeries))},!1));for(var J in Wt){let se=ns("td",mD,x);se.textContent="--",C.push(se)}return[x,C]}const Un=new Map;function nt(g,y,C,x=!0){const T=Un.get(y)||{},V=q.bind[g](s,y,C,x);V&&(Qr(g,y,T[g]=V),Un.set(y,T))}function cn(g,y,C){const x=Un.get(y)||{};for(let T in x)(g==null||T==g)&&(Sh(T,y,x[T]),delete x[T]);g==null&&Un.delete(y)}let dn=0,pi=0,Le=0,ge=0,et=0,it=0,hn=et,In=it,Xt=Le,kt=ge,fn=0,xn=0,qt=0,En=0;s.bbox={};let as=!1,us=!1,mi=!1,gi=!1,cs=!1,Rt=!1;function ut(g,y,C){(C||g!=s.width||y!=s.height)&&en(g,y),Cs(!1),mi=!0,us=!0,Kn()}function en(g,y){s.width=dn=Le=g,s.height=pi=ge=y,et=it=0,mn(),Nn();let C=s.bbox;fn=C.left=Ur(et*tt,.5),xn=C.top=Ur(it*tt,.5),qt=C.width=Ur(Le*tt,.5),En=C.height=Ur(ge*tt,.5)}const pn=3;function vi(){let g=!1,y=0;for(;!g;){y++;let C=rl(y),x=ca(y);g=y==pn||C&&x,g||(en(s.width,s.height),us=!0)}}function bn({width:g,height:y}){ut(g,y)}s.setSize=bn;function mn(){let g=!1,y=!1,C=!1,x=!1;M.forEach((T,V)=>{if(T.show&&T._show){let{side:J,_size:se}=T,ae=J%2,me=T.label!=null?T.labelSize:0,we=se+me;we>0&&(ae?(Le-=we,J==3?(et+=we,x=!0):C=!0):(ge-=we,J==0?(it+=we,g=!0):y=!0))}}),$n[0]=g,$n[1]=C,$n[2]=y,$n[3]=x,Le-=Yi[1]+Yi[3],et+=Yi[3],ge-=Yi[2]+Yi[0],it+=Yi[0]}function Nn(){let g=et+Le,y=it+ge,C=et,x=it;function T(V,J){switch(V){case 1:return g+=J,g-J;case 2:return y+=J,y-J;case 3:return C-=J,C+J;case 0:return x-=J,x+J}}M.forEach((V,J)=>{if(V.show&&V._show){let se=V.side;V._pos=T(se,V._size),V.label!=null&&(V._lpos=T(se,V.labelSize))}})}if(q.dataIdx==null){let g=q.hover,y=g.skip=new Set(g.skip??[]);y.add(void 0);let C=g.prox=Ye(g.prox),x=g.bias??(g.bias=0);q.dataIdx=(T,V,J,se)=>{if(V==0)return J;let ae=J,me=C(T,V,J,se)??ft,we=me>=0&&me0;)y.has($e[Pe])||(He=Pe);if(x==0||x==1)for(Pe=J;ke==null&&Pe++<$e.length;)y.has($e[Pe])||(ke=Pe);if(He!=null||ke!=null)if(we){let at=He==null?-1/0:ie(Je[He],Q,_e,0),St=ke==null?1/0:ie(Je[ke],Q,_e,0),$t=Ve-at,st=St-Ve;$t<=st?$t<=me&&(ae=He):st<=me&&(ae=ke)}else ae=ke==null?He:He==null?ke:J-He<=ke-J?He:ke}else we&&ln(Ve-ie(Je[J],Q,_e,0))>me&&(ae=null);return ae}}const Pn=g=>{q.event=g};q.idxs=k,q._lock=!1;let je=q.points;je.show=Ye(je.show),je.size=Ye(je.size),je.stroke=Ye(je.stroke),je.width=Ye(je.width),je.fill=Ye(je.fill);const xt=s.focus=Jt({},r.focus||{alpha:.3},q.focus),Et=xt.prox>=0,gn=Et&&je.one;let yt=[],An=[],jt=[];function Oi(g,y){let C=je.show(s,y);if(C instanceof HTMLElement)return Pi(C,uD),Pi(C,g.class),ws(C,-10,-10,Le,ge),A.insertBefore(C,yt[y]),C}function Ws(g,y){if(l==1||y>0){let C=l==1&&N[g.scale].time,x=g.value;g.value=C?cg(x)?vg(te,gg(x,X)):x||ne:x||CC,g.label=g.label||(C?mC:pC)}if(gn||y>0){g.width=g.width==null?1:g.width,g.paths=g.paths||LC||PD,g.fillTo=Ye(g.fillTo||AC),g.pxAlign=+qe(g.pxAlign,D),g.pxRound=bg(g.pxAlign),g.stroke=Ye(g.stroke||null),g.fill=Ye(g.fill||null),g._stroke=g._fill=g._paths=g._focus=null;let C=xC(ti(1,g.width),1),x=g.points=Jt({},{size:C,width:ti(1,C*.2),stroke:g.stroke,space:C*2,paths:VC,_stroke:null,_fill:null},g.points);x.show=Ye(x.show),x.filter=Ye(x.filter),x.fill=Ye(x.fill),x.stroke=Ye(x.stroke),x.paths=Ye(x.paths),x.pxAlign=g.pxAlign}if(xe){let C=ls(g,y);Me.splice(y,0,C[0]),Zt.splice(y,0,C[1]),F.values.push(null)}if(Ie){k.splice(y,0,null);let C=null;gn?y==0&&(C=Oi(g,y)):y>0&&(C=Oi(g,y)),yt.splice(y,0,C),An.splice(y,0,0),jt.splice(y,0,0)}Ut("addSeries",y)}function pc(g,y){y=y??O.length,g=l==1?Ph(g,y,_g,xg):Ph(g,y,{},Cg),O.splice(y,0,g),Ws(O[y],y)}s.addSeries=pc;function mc(g){if(O.splice(g,1),xe){F.values.splice(g,1),Zt.splice(g,1);let y=Me.splice(g,1)[0];cn(null,y.firstChild),y.remove()}Ie&&(k.splice(g,1),yt.splice(g,1)[0].remove(),An.splice(g,1),jt.splice(g,1)),Ut("delSeries",g)}s.delSeries=mc;const $n=[!1,!1,!1,!1];function ra(g,y){if(g._show=g.show,g.show){let C=g.side%2,x=N[g.scale];x==null&&(g.scale=C?O[1].scale:G,x=N[g.scale]);let T=x.time;g.size=Ye(g.size),g.space=Ye(g.space),g.rotate=Ye(g.rotate),wr(g.incrs)&&g.incrs.forEach(J=>{!yr.has(J)&&yr.set(J,Mv(J))}),g.incrs=Ye(g.incrs||(x.distr==2?JD:T?R==1?ZD:eC:$r)),g.splits=Ye(g.splits||(T&&x.distr==1?le:x.distr==3?Ch:x.distr==4?wC:vC)),g.stroke=Ye(g.stroke),g.grid.stroke=Ye(g.grid.stroke),g.ticks.stroke=Ye(g.ticks.stroke),g.border.stroke=Ye(g.border.stroke);let V=g.values;g.values=wr(V)&&!wr(V[0])?Ye(V):T?wr(V)?mg(te,pg(V,X)):cg(V)?iC(te,V):V||fe:V||gC,g.filter=Ye(g.filter||(x.distr>=3&&x.log==10?SC:x.distr==3&&x.log==2?DC:Nv)),g.font=kg(g.font),g.labelFont=kg(g.labelFont),g._size=g.size(s,null,y,0),g._space=g._rotate=g._incrs=g._found=g._splits=g._values=null,g._size>0&&($n[y]=!0,g._el=Hi(rD,S))}}function Fs(g,y,C,x){let[T,V,J,se]=C,ae=y%2,me=0;return ae==0&&(se||V)&&(me=y==0&&!T||y==2&&!J?rn(wg.size/3):0),ae==1&&(T||J)&&(me=y==1&&!V||y==3&&!se?rn(Sg.size/2):0),me}const oa=s.padding=(r.padding||[Fs,Fs,Fs,Fs]).map(g=>Ye(qe(g,Fs))),Yi=s._padding=oa.map((g,y)=>g(s,y,$n,0));let Bt,Mt=null,Lt=null;const to=l==1?O[0].idxs:null;let wi=null,ct=!1;function la(g,y){if(e=g??[],s.data=s._data=e,l==2){Bt=0;for(let C=1;C=0,Rt=!0,Kn()}}s.setData=la;function Sr(){ct=!0;let g,y;l==1&&(Bt>0?(Mt=to[0]=0,Lt=to[1]=Bt-1,g=e[0][Mt],y=e[0][Lt],ve==2?(g=Mt,y=Lt):g==y&&(ve==3?[g,y]=lc(g,g,Q.log,!1):ve==4?[g,y]=Qh(g,g,Q.log,!1):Q.time?y=g+rn(86400/R):[g,y]=$u(g,y,Zh,!0))):(Mt=to[0]=g=null,Lt=to[1]=y=null)),yi(G,g,y)}let Dr,Ki,qo,no,Hs,si,el,Yn,tl,Rn;function aa(g,y,C,x,T,V){g??(g=Ym),C??(C=qh),x??(x="butt"),T??(T=Ym),V??(V="round"),g!=Dr&&(v.strokeStyle=Dr=g),T!=Ki&&(v.fillStyle=Ki=T),y!=qo&&(v.lineWidth=qo=y),V!=Hs&&(v.lineJoin=Hs=V),x!=si&&(v.lineCap=si=x),C!=no&&v.setLineDash(no=C)}function Cr(g,y,C,x){y!=Ki&&(v.fillStyle=Ki=y),g!=el&&(v.font=el=g),C!=Yn&&(v.textAlign=Yn=C),x!=tl&&(v.textBaseline=tl=x)}function js(g,y,C,x,T=0){if(x.length>0&&g.auto(s,ct)&&(y==null||y.min==null)){let V=qe(Mt,0),J=qe(Lt,x.length-1),se=C.min==null?SD(x,V,J,T,g.distr==3):[C.min,C.max];g.min=ss(g.min,C.min=se[0]),g.max=ti(g.max,C.max=se[1])}}const Bs={min:null,max:null};function io(){for(let x in N){let T=N[x];j[x]==null&&(T.min==null||j[G]!=null&&T.auto(s,ct))&&(j[x]=Bs)}for(let x in N){let T=N[x];j[x]==null&&T.from!=null&&j[T.from]!=null&&(j[x]=Bs)}j[G]!=null&&Cs(!0);let g={};for(let x in j){let T=j[x];if(T!=null){let V=g[x]=$o(N[x],kD);if(T.min!=null)Jt(V,T);else if(x!=G||l==2)if(Bt==0&&V.from==null){let J=V.range(s,null,null,x);V.min=J[0],V.max=J[1]}else V.min=ft,V.max=-ft}}if(Bt>0){O.forEach((x,T)=>{if(l==1){let V=x.scale,J=j[V];if(J==null)return;let se=g[V];if(T==0){let ae=se.range(s,se.min,se.max,V);se.min=ae[0],se.max=ae[1],Mt=is(se.min,e[0]),Lt=is(se.max,e[0]),Lt-Mt>1&&(e[0][Mt]se.max&&Lt--),x.min=wi[Mt],x.max=wi[Lt]}else x.show&&x.auto&&js(se,J,x,e[T],x.sorted);x.idxs[0]=Mt,x.idxs[1]=Lt}else if(T>0&&x.show&&x.auto){let[V,J]=x.facets,se=V.scale,ae=J.scale,[me,we]=e[T],_e=g[se],Ve=g[ae];_e!=null&&js(_e,j[se],V,me,V.sorted),Ve!=null&&js(Ve,j[ae],J,we,J.sorted),x.min=J.min,x.max=J.max}});for(let x in g){let T=g[x],V=j[x];if(T.from==null&&(V==null||V.min==null)){let J=T.range(s,T.min==ft?null:T.min,T.max==-ft?null:T.max,x);T.min=J[0],T.max=J[1]}}}for(let x in g){let T=g[x];if(T.from!=null){let V=g[T.from];if(V.min==null)T.min=T.max=null;else{let J=T.range(s,V.min,V.max,x);T.min=J[0],T.max=J[1]}}}let y={},C=!1;for(let x in g){let T=g[x],V=N[x];if(V.min!=T.min||V.max!=T.max){V.min=T.min,V.max=T.max;let J=V.distr;V._min=J==3?Ls(V.min):J==4?Kd(V.min,V.asinh):J==100?V.fwd(V.min):V.min,V._max=J==3?Ls(V.max):J==4?Kd(V.max,V.asinh):J==100?V.fwd(V.max):V.max,y[x]=C=!0}}if(C){O.forEach((x,T)=>{l==2?T>0&&y.y&&(x._paths=null):y[x.scale]&&(x._paths=null)});for(let x in y)mi=!0,Ut("setScale",x);Ie&&q.left>=0&&(gi=Rt=!0)}for(let x in j)j[x]=null}function gc(g){let y=Dh(Mt-1,0,Bt-1),C=Dh(Lt+1,0,Bt-1);for(;g[y]==null&&y>0;)y--;for(;g[C]==null&&C0){let g=O.some(y=>y._focus)&&Rn!=xt.alpha;g&&(v.globalAlpha=Rn=xt.alpha),O.forEach((y,C)=>{if(C>0&&y.show&&(so(C,!1),so(C,!0),y._paths==null)){let x=Rn;Rn!=y.alpha&&(v.globalAlpha=Rn=y.alpha);let T=l==2?[0,e[C][0].length-1]:gc(e[C]);y._paths=y.paths(s,C,T[0],T[1]),Rn!=x&&(v.globalAlpha=Rn=x)}}),O.forEach((y,C)=>{if(C>0&&y.show){let x=Rn;Rn!=y.alpha&&(v.globalAlpha=Rn=y.alpha),y._paths!=null&&nl(C,!1);{let T=y._paths!=null?y._paths.gaps:null,V=y.points.show(s,C,Mt,Lt,T),J=y.points.filter(s,C,V,T);(V||J)&&(y.points._paths=y.points.paths(s,C,Mt,Lt,J),nl(C,!0))}Rn!=x&&(v.globalAlpha=Rn=x),Ut("drawSeries",C)}}),g&&(v.globalAlpha=Rn=1)}}function so(g,y){let C=y?O[g].points:O[g];C._stroke=C.stroke(s,g),C._fill=C.fill(s,g)}function nl(g,y){let C=y?O[g].points:O[g],{stroke:x,fill:T,clip:V,flags:J,_stroke:se=C._stroke,_fill:ae=C._fill,_width:me=C.width}=C._paths;me=pt(me*tt,3);let we=null,_e=me%2/2;y&&ae==null&&(ae=me>0?"#fff":se);let Ve=C.pxAlign==1&&_e>0;if(Ve&&v.translate(_e,_e),!y){let Je=fn-me/2,$e=xn-me/2,He=qt+me,ke=En+me;we=new Path2D,we.rect(Je,$e,He,ke)}y?sl(se,me,C.dash,C.cap,ae,x,T,J,V):il(g,se,me,C.dash,C.cap,ae,x,T,J,we,V),Ve&&v.translate(-_e,-_e)}function il(g,y,C,x,T,V,J,se,ae,me,we){let _e=!1;ae!=0&&Z.forEach((Ve,Je)=>{if(Ve.series[0]==g){let $e=O[Ve.series[1]],He=e[Ve.series[1]],ke=($e._paths||Yl).band;wr(ke)&&(ke=Ve.dir==1?ke[0]:ke[1]);let Pe,at=null;$e.show&&ke&&CD(He,Mt,Lt)?(at=Ve.fill(s,Je)||V,Pe=$e._paths.clip):ke=null,sl(y,C,x,T,at,J,se,ae,me,we,Pe,ke),_e=!0}}),_e||sl(y,C,x,T,V,J,se,ae,me,we)}const Us=Yo|Eh;function sl(g,y,C,x,T,V,J,se,ae,me,we,_e){aa(g,y,C,x,T),(ae||me||_e)&&(v.save(),ae&&v.clip(ae),me&&v.clip(me)),_e?(se&Us)==Us?(v.clip(_e),we&&v.clip(we),Ke(T,J),$s(g,V,y)):se&Eh?(Ke(T,J),v.clip(_e),$s(g,V,y)):se&Yo&&(v.save(),v.clip(_e),we&&v.clip(we),Ke(T,J),v.restore(),$s(g,V,y)):(Ke(T,J),$s(g,V,y)),(ae||me||_e)&&v.restore()}function $s(g,y,C){C>0&&(y instanceof Map?y.forEach((x,T)=>{v.strokeStyle=Dr=T,v.stroke(x)}):y!=null&&g&&v.stroke(y))}function Ke(g,y){y instanceof Map?y.forEach((C,x)=>{v.fillStyle=Ki=x,v.fill(C)}):y!=null&&g&&v.fill(y)}function ua(g,y,C,x){let T=M[g],V;if(x<=0)V=[0,0];else{let J=T._space=T.space(s,g,y,C,x),se=T._incrs=T.incrs(s,g,y,C,x,J);V=BC(y,C,se,x,J)}return T._found=V}function ro(g,y,C,x,T,V,J,se,ae,me){let we=J%2/2;D==1&&v.translate(we,we),aa(se,J,ae,me,se),v.beginPath();let _e,Ve,Je,$e,He=T+(x==0||x==3?-V:V);C==0?(Ve=T,$e=He):(_e=T,Je=He);for(let ke=0;ke{if(!C.show)return;let T=N[C.scale];if(T.min==null){C._show&&(y=!1,C._show=!1,Cs(!1));return}else C._show||(y=!1,C._show=!0,Cs(!1));let V=C.side,J=V%2,{min:se,max:ae}=T,[me,we]=ua(x,se,ae,J==0?Le:ge);if(we==0)return;let _e=T.distr==2,Ve=C._splits=C.splits(s,x,se,ae,me,we,_e),Je=T.distr==2?Ve.map(Pe=>wi[Pe]):Ve,$e=T.distr==2?wi[Ve[1]]-wi[Ve[0]]:me,He=C._values=C.values(s,C.filter(s,Je,x,we,$e),x,we,$e);C._rotate=V==2?C.rotate(s,He,x,we):0;let ke=C._size;C._size=Ui(C.size(s,He,x,g)),ke!=null&&C._size!=ke&&(y=!1)}),y}function ca(g){let y=!0;return oa.forEach((C,x)=>{let T=C(s,x,$n,g);T!=Yi[x]&&(y=!1),Yi[x]=T}),y}function da(){for(let g=0;gwi[zn]):Je,He=we.distr==2?wi[Je[1]]-wi[Je[0]]:ae,ke=y.ticks,Pe=y.border,at=ke.show?ke.size:0,St=rn(at*tt),$t=rn((y.alignTo==2?y._size-at-y.gap:y.gap)*tt),st=y._rotate*-ku/180,Dt=P(y._pos*tt),Qn=(St+$t)*se,dt=Dt+Qn;V=x==0?dt:0,T=x==1?dt:0;let vn=y.font[0],li=y.align==1?Ro:y.align==2?Ud:st>0?Ro:st<0?Ud:x==0?"center":C==3?Ud:Ro,Ci=st||x==1?"middle":C==2?Ml:$m;Cr(vn,J,li,Ci);let Ln=y.font[1]*y.lineGap,Zn=Je.map(zn=>P(d(zn,we,_e,Ve))),Xn=y._values;for(let zn=0;zn{C>0&&(y._paths=null,g&&(l==1?(y.min=null,y.max=null):y.facets.forEach(x=>{x.min=null,x.max=null})))})}let Ys=!1,Ks=!1,ri=[];function ds(){Ks=!1;for(let g=0;g0&&queueMicrotask(ds)}s.batch=xr;function Js(){if(as&&(io(),as=!1),mi&&(vi(),mi=!1),us){if(wt(E,Ro,et),wt(E,Ml,it),wt(E,Gl,Le),wt(E,Wl,ge),wt(A,Ro,et),wt(A,Ml,it),wt(A,Gl,Le),wt(A,Wl,ge),wt(S,Gl,dn),wt(S,Wl,pi),w.width=rn(dn*tt),w.height=rn(pi*tt),M.forEach(({_el:g,_show:y,_size:C,_pos:x,side:T})=>{if(g!=null)if(y){let V=T===3||T===0?C:0,J=T%2==1;wt(g,J?"left":"top",x-V),wt(g,J?"width":"height",C),wt(g,J?"top":"left",J?it:et),wt(g,J?"height":"width",J?ge:Le),yh(g,Yr)}else Pi(g,Yr)}),Dr=Ki=qo=Hs=si=el=Yn=tl=no=null,Rn=1,Or(!0),et!=hn||it!=In||Le!=Xt||ge!=kt){Cs(!1);let g=Le/Xt,y=ge/kt;if(Ie&&!gi&&q.left>=0){q.left*=g,q.top*=y,Ii&&ws(Ii,rn(q.left),0,Le,ge),Qs&&ws(Qs,0,rn(q.top),Le,ge);for(let C=0;C=0&<.width>0){lt.left*=g,lt.width*=g,lt.top*=y,lt.height*=y;for(let C in dl)wt(Es,C,lt[C])}hn=et,In=it,Xt=Le,kt=ge}Ut("setSize"),us=!1}dn>0&&pi>0&&(v.clearRect(0,0,w.width,w.height),Ut("drawClear"),K.forEach(g=>g()),Ut("draw")),lt.show&&cs&&(_i(lt),cs=!1),Ie&&gi&&(bs(null,!0,!1),gi=!1),F.show&&F.live&&Rt&&(kr(),Rt=!1),h||(h=!0,s.status=1,Ut("ready")),ct=!1,Ys=!1}s.redraw=(g,y)=>{mi=y||!1,g!==!1?yi(G,Q.min,Q.max):Kn()};function Ti(g,y){let C=N[g];if(C.from==null){if(Bt==0){let x=C.range(s,y.min,y.max,g);y.min=x[0],y.max=x[1]}if(y.min>y.max){let x=y.min;y.min=y.max,y.max=x}if(Bt>1&&y.min!=null&&y.max!=null&&y.max-y.min<1e-16)return;g==G&&C.distr==2&&Bt>0&&(y.min=is(y.min,e[0]),y.max=is(y.max,e[0]),y.min==y.max&&y.max++),j[g]=y,as=!0,Kn()}}s.setScale=Ti;let ol,oo,Ii,Qs,ll,Er,xs,Zs,Xs,qs,Ze,ot,hs=!1;const tn=q.drag;let Ot=tn.x,bt=tn.y;Ie&&(q.x&&(ol=Hi(lD,A)),q.y&&(oo=Hi(aD,A)),Q.ori==0?(Ii=ol,Qs=oo):(Ii=oo,Qs=ol),Ze=q.left,ot=q.top);const lt=s.select=Jt({show:!0,over:!0,left:0,width:0,top:0,height:0},r.select),Es=lt.show?Hi(oD,lt.over?A:E):null;function _i(g,y){if(lt.show){for(let C in g)lt[C]=g[C],C in dl&&wt(Es,C,g[C]);y!==!1&&Ut("setSelect")}}s.setSelect=_i;function al(g){if(O[g].show)xe&&yh(Me[g],Yr);else if(xe&&Pi(Me[g],Yr),Ie){let C=gn?yt[0]:yt[g];C!=null&&ws(C,-10,-10,Le,ge)}}function yi(g,y,C){Ti(g,{min:y,max:C})}function Si(g,y,C,x){y.focus!=null&&ul(g),y.show!=null&&O.forEach((T,V)=>{V>0&&(g==V||g==null)&&(T.show=y.show,al(V),l==2?(yi(T.facets[0].scale,null,null),yi(T.facets[1].scale,null,null)):yi(T.scale,null,null),Kn())}),C!==!1&&Ut("setSeries",g,y),x&&Tr("setSeries",s,g,y)}s.setSeries=Si;function lo(g,y){Jt(Z[g],y)}function ao(g,y){g.fill=Ye(g.fill||null),g.dir=qe(g.dir,-1),y=y??Z.length,Z.splice(y,0,g)}function ha(g){g==null?Z.length=0:Z.splice(g,1)}s.addBand=ao,s.setBand=lo,s.delBand=ha;function Jn(g,y){O[g].alpha=y,Ie&&yt[g]!=null&&(yt[g].style.opacity=y),xe&&Me[g]&&(Me[g].style.opacity=y)}let Mn,Ni,Di;const er={focus:!0};function ul(g){if(g!=Di){let y=g==null,C=xt.alpha!=1;O.forEach((x,T)=>{if(l==1||T>0){let V=y||T==0||T==g;x._focus=y?null:V,C&&Jn(T,V?1:xt.alpha)}}),Di=g,C&&Kn()}}xe&&Et&&nt(Qm,Ee,g=>{q._lock||(Pn(g),Di!=null&&Si(null,er,!0,Tt.setSeries))});function oi(g,y,C){let x=N[y];C&&(g=g/tt-(x.ori==1?it:et));let T=Le;x.ori==1&&(T=ge,g=T-g),x.dir==-1&&(g=T-g);let V=x._min,J=x._max,se=g/T,ae=V+(J-V)*se,me=x.distr;return me==3?Bo(10,ae):me==4?ED(ae,x.asinh):me==100?x.bwd(ae):ae}function br(g,y){let C=oi(g,G,y);return is(C,e[0],Mt,Lt)}s.valToIdx=g=>is(g,e[0]),s.posToIdx=br,s.posToVal=oi,s.valToPos=(g,y,C)=>N[y].ori==0?a(g,N[y],C?qt:Le,C?fn:0):c(g,N[y],C?En:ge,C?xn:0),s.setCursor=(g,y,C)=>{Ze=g.left,ot=g.top,bs(null,y,C)};function Pr(g,y){wt(Es,Ro,lt.left=g),wt(Es,Gl,lt.width=y)}function cl(g,y){wt(Es,Ml,lt.top=g),wt(Es,Wl,lt.height=y)}let Ar=Q.ori==0?Pr:cl,zr=Q.ori==1?Pr:cl;function wc(){if(xe&&F.live)for(let g=l==2?1:0;g{k[x]=C}):zD(g.idx)||k.fill(g.idx),F.idx=k[0]),xe&&F.live){for(let C=0;C0||l==1&&!Ft)&&_c(C,k[C]);wc()}Rt=!1,y!==!1&&Ut("setLegend")}s.setLegend=kr;function _c(g,y){let C=O[g],x=g==0&&ve==2?wi:e[g],T;Ft?T=C.values(s,g,y)??Ht:(T=C.value(s,y==null?null:x[y],g,y),T=T==null?Ht:{_:T}),F.values[g]=T}function bs(g,y,C){Xs=Ze,qs=ot,[Ze,ot]=q.move(s,Ze,ot),q.left=Ze,q.top=ot,Ie&&(Ii&&ws(Ii,rn(Ze),0,Le,ge),Qs&&ws(Qs,0,rn(ot),Le,ge));let x,T=Mt>Lt;Mn=ft,Ni=null;let V=Q.ori==0?Le:ge,J=Q.ori==1?Le:ge;if(Ze<0||Bt==0||T){x=q.idx=null;for(let se=0;se0&&at.show){let Qn=st==null?-10:st==x?me:ie(l==1?e[0][st]:e[Pe][0][st],Q,V,0),dt=Dt==null?-10:ce(Dt,l==1?N[at.scale]:N[at.facets[1].scale],J,0);if(Et&&Dt!=null){let vn=Q.ori==1?Ze:ot,li=ln(xt.dist(s,Pe,st,dt,vn));if(li=0?1:-1,Xn=Ln>=0?1:-1;Xn==Zn&&(Xn==1?Ci==1?Dt>=Ln:Dt<=Ln:Ci==1?Dt<=Ln:Dt>=Ln)&&(Mn=li,Ni=Pe)}else Mn=li,Ni=Pe}}if(Rt||gn){let vn,li;Q.ori==0?(vn=Qn,li=dt):(vn=dt,li=Qn);let Ci,Ln,Zn,Xn,Ri,zn,Yt=!0,Ji=je.bbox;if(Ji!=null){Yt=!1;let Vt=Ji(s,Pe);Zn=Vt.left,Xn=Vt.top,Ci=Vt.width,Ln=Vt.height}else Zn=vn,Xn=li,Ci=Ln=je.size(s,Pe);if(zn=je.fill(s,Pe),Ri=je.stroke(s,Pe),gn)Pe==Ni&&Mn<=xt.prox&&(we=Zn,_e=Xn,Ve=Ci,Je=Ln,$e=Yt,He=zn,ke=Ri);else{let Vt=yt[Pe];Vt!=null&&(An[Pe]=Zn,jt[Pe]=Xn,ig(Vt,Ci,Ln,Yt),tg(Vt,zn,Ri),ws(Vt,Ui(Zn),Ui(Xn),Le,ge))}}}}if(gn){let Pe=xt.prox,at=Di==null?Mn<=Pe:Mn>Pe||Ni!=Di;if(Rt||at){let St=yt[0];St!=null&&(An[0]=we,jt[0]=_e,ig(St,Ve,Je,$e),tg(St,He,ke),ws(St,Ui(we),Ui(_e),Le,ge))}}}if(lt.show&&hs)if(g!=null){let[se,ae]=Tt.scales,[me,we]=Tt.match,[_e,Ve]=g.cursor.sync.scales,Je=g.cursor.drag;if(Ot=Je._x,bt=Je._y,Ot||bt){let{left:$e,top:He,width:ke,height:Pe}=g.select,at=g.scales[_e].ori,St=g.posToVal,$t,st,Dt,Qn,dt,vn=se!=null&&me(se,_e),li=ae!=null&&we(ae,Ve);vn&&Ot?(at==0?($t=$e,st=ke):($t=He,st=Pe),Dt=N[se],Qn=ie(St($t,_e),Dt,V,0),dt=ie(St($t+st,_e),Dt,V,0),Ar(ss(Qn,dt),ln(dt-Qn))):Ar(0,V),li&&bt?(at==1?($t=$e,st=ke):($t=He,st=Pe),Dt=N[ae],Qn=ce(St($t,Ve),Dt,J,0),dt=ce(St($t+st,Ve),Dt,J,0),zr(ss(Qn,dt),ln(dt-Qn))):zr(0,J)}else hl()}else{let se=ln(Xs-ll),ae=ln(qs-Er);if(Q.ori==1){let Ve=se;se=ae,ae=Ve}Ot=tn.x&&se>=tn.dist,bt=tn.y&&ae>=tn.dist;let me=tn.uni;me!=null?Ot&&bt&&(Ot=se>=me,bt=ae>=me,!Ot&&!bt&&(ae>se?bt=!0:Ot=!0)):tn.x&&tn.y&&(Ot||bt)&&(Ot=bt=!0);let we,_e;Ot&&(Q.ori==0?(we=xs,_e=Ze):(we=Zs,_e=ot),Ar(ss(we,_e),ln(_e-we)),bt||zr(0,J)),bt&&(Q.ori==1?(we=xs,_e=Ze):(we=Zs,_e=ot),zr(ss(we,_e),ln(_e-we)),Ot||Ar(0,V)),!Ot&&!bt&&(Ar(0,0),zr(0,0))}if(tn._x=Ot,tn._y=bt,g==null){if(C){if(fo!=null){let[se,ae]=Tt.scales;Tt.values[0]=se!=null?oi(Q.ori==0?Ze:ot,se):null,Tt.values[1]=ae!=null?oi(Q.ori==1?Ze:ot,ae):null}Tr($d,s,Ze,ot,Le,ge,x)}if(Et){let se=C&&Tt.setSeries,ae=xt.prox;Di==null?Mn<=ae&&Si(Ni,er,!0,se):Mn>ae?Si(null,er,!0,se):Ni!=Di&&Si(Ni,er,!0,se)}}Rt&&(F.idx=x,kr()),y!==!1&&Ut("setCursor")}let fs=null;Object.defineProperty(s,"rect",{get(){return fs==null&&Or(!1),fs}});function Or(g=!1){g?fs=null:(fs=A.getBoundingClientRect(),Ut("syncRect",fs))}function fa(g,y,C,x,T,V,J){q._lock||hs&&g!=null&&g.movementX==0&&g.movementY==0||(uo(g,y,C,x,T,V,J,!1,g!=null),g!=null?bs(null,!0,!0):bs(y,!0,!1))}function uo(g,y,C,x,T,V,J,se,ae){if(fs==null&&Or(!1),Pn(g),g!=null)C=g.clientX-fs.left,x=g.clientY-fs.top;else{if(C<0||x<0){Ze=-10,ot=-10;return}let[me,we]=Tt.scales,_e=y.cursor.sync,[Ve,Je]=_e.values,[$e,He]=_e.scales,[ke,Pe]=Tt.match,at=y.axes[0].side%2==1,St=Q.ori==0?Le:ge,$t=Q.ori==1?Le:ge,st=at?V:T,Dt=at?T:V,Qn=at?x:C,dt=at?C:x;if($e!=null?C=ke(me,$e)?d(Ve,N[me],St,0):-10:C=St*(Qn/st),He!=null?x=Pe(we,He)?d(Je,N[we],$t,0):-10:x=$t*(dt/Dt),Q.ori==1){let vn=C;C=x,x=vn}}ae&&(y==null||y.cursor.event.type==$d)&&((C<=1||C>=Le-1)&&(C=Ur(C,Le)),(x<=1||x>=ge-1)&&(x=Ur(x,ge))),se?(ll=C,Er=x,[xs,Zs]=q.move(s,C,x)):(Ze=C,ot=x)}const dl={width:0,height:0,left:0,top:0};function hl(){_i(dl,!1)}let pa,ma,co,ga;function va(g,y,C,x,T,V,J){hs=!0,Ot=bt=tn._x=tn._y=!1,uo(g,y,C,x,T,V,J,!0,!1),g!=null&&(nt(Yd,wh,wa,!1),Tr(Km,s,xs,Zs,Le,ge,null));let{left:se,top:ae,width:me,height:we}=lt;pa=se,ma=ae,co=me,ga=we}function wa(g,y,C,x,T,V,J){hs=tn._x=tn._y=!1,uo(g,y,C,x,T,V,J,!1,!0);let{left:se,top:ae,width:me,height:we}=lt,_e=me>0||we>0,Ve=pa!=se||ma!=ae||co!=me||ga!=we;if(_e&&Ve&&_i(lt),tn.setScale&&_e&&Ve){let Je=se,$e=me,He=ae,ke=we;if(Q.ori==1&&(Je=ae,$e=we,He=se,ke=me),Ot&&yi(G,oi(Je,G),oi(Je+$e,G)),bt)for(let Pe in N){let at=N[Pe];Pe!=G&&at.from==null&&at.min!=ft&&yi(Pe,oi(He+ke,Pe),oi(He,Pe))}hl()}else q.lock&&(q._lock=!q._lock,bs(y,!0,g!=null));g!=null&&(cn(Yd,wh),Tr(Yd,s,Ze,ot,Le,ge,null))}function _a(g,y,C,x,T,V,J){if(q._lock)return;Pn(g);let se=hs;if(hs){let ae=!0,me=!0,we=10,_e,Ve;Q.ori==0?(_e=Ot,Ve=bt):(_e=bt,Ve=Ot),_e&&Ve&&(ae=Ze<=we||Ze>=Le-we,me=ot<=we||ot>=ge-we),_e&&ae&&(Ze=Ze{let T=Tt.match[2];C=T(s,y,C),C!=-1&&Si(C,x,!0,!1)},Ie&&(nt(Km,A,va),nt($d,A,fa),nt(Jm,A,g=>{Pn(g),Or(!1)}),nt(Qm,A,_a),nt(Zm,A,ya),bh.add(s),s.syncRect=Or);const ho=s.hooks=r.hooks||{};function Ut(g,y,C){Ks?ri.push([g,y,C]):g in ho&&ho[g].forEach(x=>{x.call(null,s,y,C)})}(r.plugins||[]).forEach(g=>{for(let y in g.hooks)ho[y]=(ho[y]||[]).concat(g.hooks[y])});const Da=(g,y,C)=>C,Tt=Jt({key:null,setSeries:!1,filters:{pub:ag,sub:ag},scales:[G,O[1]?O[1].scale:null],match:[ug,ug,Da],values:[null,null]},q.sync);Tt.match.length==2&&Tt.match.push(Da),q.sync=Tt;const fo=Tt.key,Ps=nw(fo);function Tr(g,y,C,x,T,V,J){Tt.filters.pub(g,y,C,x,T,V,J)&&Ps.pub(g,y,C,x,T,V,J)}Ps.sub(s);function Ca(g,y,C,x,T,V,J){Tt.filters.sub(g,y,C,x,T,V,J)&&tr[g](null,y,C,x,T,V,J)}s.pub=Ca;function xa(){Ps.unsub(s),bh.delete(s),Un.clear(),Sh(Uu,Fo,Sa),m.remove(),Ee==null||Ee.remove(),Ut("destroy")}s.destroy=xa;function po(){Ut("init",r,e),la(e||r.data,!1),j[G]?Ti(G,j[G]):Sr(),cs=lt.show&&(lt.width>0||lt.height>0),gi=Rt=!0,ut(r.width,r.height)}return O.forEach(Ws),M.forEach(ra),n?n instanceof HTMLElement?(n.appendChild(m),po()):n(s,po):po(),s}jn.assign=Jt;jn.fmtNum=Xh;jn.rangeNum=$u;jn.rangeLog=lc;jn.rangeAsinh=Qh;jn.orient=eo;jn.pxRatio=tt;jn.join=MD;jn.fmtDate=ef,jn.tzDate=YD;jn.sync=nw;{jn.addGap=zC,jn.clipGaps=cc;let r=jn.paths={points:aw};r.linear=cw,r.stepped=TC,r.bars=IC,r.spline=RC}const $C=6e3;class YC{constructor(e=$C){Tl(this,"t");Tl(this,"v");Tl(this,"len",0);Tl(this,"head",0);this.t=new Float64Array(e),this.v=new Float64Array(e)}push(e,n){const s=this.t.length;this.t[this.head]=e,this.v[this.head]=n,this.head=(this.head+1)%s,this.len=e&&(a[d]=this.t[m],c[d]=this.v[m],d++)}return{t:a.subarray(0,d),v:c.subarray(0,d)}}last(){if(this.len===0)return null;const e=this.t.length;return this.v[(this.head-1+e)%e]}}const Ah=new Map;function KC(r){let e=Ah.get(r);return e||(e=new YC,Ah.set(r,e)),e}function pw(r,e){const n=KC(r);for(const[s,l]of e)n.push(s,l)}function mw(r,e=-1/0){const n=Ah.get(r);return n?n.read(e):{t:new Float64Array(0),v:new Float64Array(0)}}const Ho=new Map;let Ou=[];function gw(){Ou.forEach(r=>r())}function JC(r){Ho.set(r,(Ho.get(r)||0)+1),gw()}function QC(r){const e=(Ho.get(r)||0)-1;e<=0?Ho.delete(r):Ho.set(r,e),gw()}function ZC(){return Array.from(Ho.keys())}function XC(r){return Ou.push(r),()=>{Ou=Ou.filter(e=>e!==r)}}const Og=3e3;let Go=[],Tu=[];function qC(r){r.length&&(Go=Go.concat(r),Go.length>Og&&(Go=Go.slice(-Og)),Tu.forEach(e=>e()))}function ex(){return Go}function tx(r){return Tu.push(r),()=>{Tu=Tu.filter(e=>e!==r)}}let Iu=0,Nu=[];function Tg(r){Iu+=r?1:-1,Iu<0&&(Iu=0),Nu.forEach(e=>e())}function nx(){return Iu>0}function ix(r){return Nu.push(r),()=>{Nu=Nu.filter(e=>e!==r)}}let Zr=null,Xd=null;function sx(){return`${location.protocol==="https:"?"wss":"ws"}://${location.host}/api/monitor/stream`}function Ig(){Zr&&Zr.readyState===WebSocket.OPEN&&Zr.send(JSON.stringify({type:"subscribe",signals:ZC()}))}function Ng(){Zr&&Zr.readyState===WebSocket.OPEN&&Zr.send(JSON.stringify({type:"raw",enabled:nx()}))}function vw(){const r=new WebSocket(sx());Zr=r,r.onopen=()=>{Cn.getState().setConnected(!0),Ig(),Ng()},r.onclose=()=>{Cn.getState().setConnected(!1),Xd==null&&(Xd=window.setTimeout(()=>{Xd=null,vw()},1e3))},r.onerror=()=>r.close(),r.onmessage=n=>{let s;try{s=JSON.parse(n.data)}catch{return}const l=Cn.getState();switch(s.type){case"meta":l.setMeta(s.signals,s.pairs),l.setMotors(s.motors);break;case"motors":l.setMotors(s.motors),s.status&&l.setStatus(s.status);break;case"samples":for(const[a,c]of Object.entries(s.data))pw(a,c);break;case"raw":qC(s.frames);break}};let e=null;XC(()=>{e==null&&(e=window.setTimeout(()=>{e=null,Ig()},80))}),ix(Ng)}async function rx(r,e=600){return r.length?(await fetch(`/api/monitor/snapshot?signals=${r.join(",")}&n=${e}`)).json():{}}async function ox(){try{return(await(await fetch("/api/monitor/motor-types")).json()).types||[]}catch{return[]}}async function lx(r,e){await fetch("/api/monitor/motor-type",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({motorId:r,motorType:e})})}const Rg=2e3;function ax(r,e){const n=r.map(c=>mw(c,e)),s=new Set;for(const c of n)for(let d=0;dc-d);if(l.length>Rg){const c=Math.ceil(l.length/Rg);l=l.filter((d,h)=>h%c===0)}const a=[l];for(const c of n){const d=new Array(l.length).fill(null);let h=0,m=null;for(let w=0;wD.ensurePlot),n=Cn(D=>D.removeSignalFromPlot),s=Cn(D=>D.setPlotConfig),l=Cn(D=>D.plotConfigs[r]),a=Cn(D=>D.signals);B.useEffect(()=>{e(r)},[r,e]);const c=(l==null?void 0:l.signals)??[],d=(l==null?void 0:l.duration)??10,h=c.join("|"),{setNodeRef:m,isOver:w}=W_({id:`plot:${r}`,data:{panelId:r}}),v=B.useRef(null),S=B.useRef(null),E=B.useRef(0);B.useEffect(()=>{if(!v.current)return;const D=v.current,P=new Map(a.map(Z=>[Z.id,Z])),R=[{label:"t"},...c.map(Z=>{const G=P.get(Z),$=G?zu(G):"#8b949e";return{label:ah(Z),stroke:$,width:1.5,dash:xm(Z)?[6,4]:void 0,points:{show:!1}}})],O={width:D.clientWidth||400,height:D.clientHeight||220,legend:{show:!1},series:R,cursor:{y:!1,points:{show:!0}},scales:{x:{time:!1}},axes:[{stroke:"#8b949e",grid:{stroke:"rgba(139,148,158,0.12)"},ticks:{stroke:"rgba(139,148,158,0.2)"},values:(Z,G)=>G.map($=>($-E.current).toFixed(1)+"s")},{stroke:"#8b949e",grid:{stroke:"rgba(139,148,158,0.12)"},ticks:{stroke:"rgba(139,148,158,0.2)"}}]},M=new jn(O,[[],...c.map(()=>[])],D);S.current=M;const N=new ResizeObserver(()=>{M.setSize({width:D.clientWidth,height:D.clientHeight})});return N.observe(D),()=>{N.disconnect(),M.destroy(),S.current=null}},[h,a.length]),B.useEffect(()=>{if(!c.length)return;c.forEach(JC);let D=!1;return rx(c,1200).then(P=>{if(!D)for(const[R,O]of Object.entries(P))pw(R,O)}),()=>{D=!0,c.forEach(QC)}},[h]),B.useEffect(()=>{let D=0;const P=()=>{const R=S.current;if(R&&c.length){let O=0;for(const N of c){const Z=mw(N);Z.t.length&&(O=Math.max(O,Z.t[Z.t.length-1]))}E.current=O;const M=ax(c,O-d);R.setData(M,!1),R.setScale("x",{min:O-d,max:O})}D=requestAnimationFrame(P)};return D=requestAnimationFrame(P),()=>cancelAnimationFrame(D)},[h,d]);const A=B.useMemo(()=>new Map(a.map(D=>[D.id,D])),[a]);return Y.jsxs("div",{className:"panel plot-panel",ref:m,children:[Y.jsxs("div",{className:"plot-toolbar",children:[Y.jsx("span",{className:"muted",children:"window"}),Y.jsx("select",{value:d,onChange:D=>s(r,{duration:Number(D.target.value)}),children:[5,10,20,30,60].map(D=>Y.jsxs("option",{value:D,children:[D,"s"]},D))}),Y.jsx("div",{className:"legend",children:c.map(D=>{const P=A.get(D);return Y.jsxs("span",{className:"legend-chip",style:{borderColor:P?zu(P):"#555"},children:[Y.jsx("span",{className:"legend-swatch",style:{background:P?zu(P):"#555",borderStyle:xm(D)?"dashed":"solid"}}),ah(D),Y.jsx("button",{className:"legend-x",onClick:()=>n(r,D),children:"×"})]},D)})})]}),Y.jsx("div",{className:"plot-host"+(w?" drop-over":""),ref:v,children:c.length===0&&Y.jsx("div",{className:"drop-hint",children:"Drag signals here to plot — drop cmd onto fb to overlay"})})]})}const qd=[["pos","cmd p"],["vel","cmd v"],["kp","kp"],["kd","kd"],["torque","cmd τ"]],eh=[["pos","act p"],["vel","act v"],["torque","act τ"],["t_mos","Tmos"],["t_rotor","Trot"]];function cx(){const r=Cn(e=>e.motors);return Y.jsx("div",{className:"panel table-panel",children:Y.jsxs("table",{className:"motor-table",children:[Y.jsx("thead",{children:Y.jsxs("tr",{children:[Y.jsx("th",{children:"Motor"}),Y.jsx("th",{children:"Mode"}),Y.jsx("th",{children:"Status"}),qd.map(([e,n])=>Y.jsx("th",{className:"cmd-col",children:n},"c"+e)),eh.map(([e,n])=>Y.jsx("th",{children:n},"f"+e))]})}),Y.jsxs("tbody",{children:[r.length===0&&Y.jsx("tr",{children:Y.jsx("td",{colSpan:3+qd.length+eh.length,className:"muted center",children:"Waiting for traffic…"})}),r.map(e=>Y.jsxs("tr",{children:[Y.jsxs("td",{className:"mono",children:["m",e.motorId]}),Y.jsx("td",{className:"muted",children:e.mode||"—"}),Y.jsx("td",{children:Y.jsx("span",{className:"status-pill "+(e.status==="ENABLED"?"ok":e.status==="DISABLED"?"off":"warn"),children:e.status||"—"})}),qd.map(([n])=>Y.jsx("td",{className:"mono cmd-col",children:jo(e.cmd[n],n==="kp"?0:3)},"c"+n)),eh.map(([n])=>Y.jsx("td",{className:"mono",children:jo(e.fb[n],n.startsWith("t_")?1:3)},"f"+n))]},`${e.bus}:${e.motorId}`))]})]})})}function th({label:r,cmd:e,act:n,unit:s,digits:l=2}){return Y.jsxs("div",{className:"metric",children:[Y.jsxs("div",{className:"metric-label",children:[r," ",Y.jsx("span",{className:"muted",children:s})]}),Y.jsxs("div",{className:"metric-values",children:[Y.jsx("span",{className:"metric-act",children:jo(n,l)}),e!==void 0&&Y.jsxs("span",{className:"metric-cmd",children:["⌖ ",jo(e,l)]})]})]})}function dx(){const r=Cn(n=>n.motors),e=Cn(n=>n.motorTypes);return Y.jsxs("div",{className:"panel cards-panel",children:[r.length===0&&Y.jsx("div",{className:"muted center pad",children:"Waiting for traffic…"}),Y.jsx("div",{className:"cards-grid",children:r.map(n=>Y.jsxs("div",{className:"motor-card",children:[Y.jsxs("div",{className:"motor-card-head",children:[Y.jsxs("span",{className:"mono strong",children:["Motor ",n.motorId]}),Y.jsx("span",{className:"status-pill "+(n.status==="ENABLED"?"ok":n.status==="DISABLED"?"off":"warn"),children:n.status||"—"})]}),Y.jsxs("div",{className:"motor-card-sub",children:[Y.jsx("span",{className:"muted",children:n.mode||"—"}),e.length>0&&Y.jsxs("select",{className:"type-select",defaultValue:"",onChange:s=>s.target.value&&lx(n.motorId,s.target.value),title:"Override motor type used to scale this motor's values",children:[Y.jsx("option",{value:"",children:"set type…"}),e.map(s=>Y.jsx("option",{value:s,children:s},s))]})]}),Y.jsx(th,{label:"Position",unit:"rad",cmd:n.cmd.pos,act:n.fb.pos,digits:3}),Y.jsx(th,{label:"Velocity",unit:"rad/s",cmd:n.cmd.vel,act:n.fb.vel,digits:2}),Y.jsx(th,{label:"Torque",unit:"Nm",cmd:n.cmd.torque,act:n.fb.torque,digits:2}),Y.jsxs("div",{className:"temp-row",children:[Y.jsxs("span",{children:["MOS ",jo(n.fb.t_mos,1),"°"]}),Y.jsxs("span",{children:["Rotor ",jo(n.fb.t_rotor,1),"°"]})]})]},`${n.bus}:${n.motorId}`))})]})}function hx(r,e,n){const s=new Array(r);return new Proxy(s,{get(l,a,c){if(typeof a=="string"){const d=a.charCodeAt(0);if(d>=48&&d<=57){const h=+a;if(Number.isInteger(h)&&h>=0&&hs[w]!==m))&&(s=d,l=e(...d),n!=null&&n.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(l),a=!1),l}return c.updateDeps=d=>{s=d},c}function Mg(r,e){if(r===void 0)throw new Error("Unexpected undefined");return r}const fx=(r,e)=>Math.abs(r-e)<1.01,px=(r,e,n)=>{let s;return function(...l){r.clearTimeout(s),s=r.setTimeout(()=>e.apply(this,l),n)}};let Vl;const nh=()=>{if(Vl!==void 0)return Vl;if(typeof navigator>"u")return Vl=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Vl=!0;const r=navigator.maxTouchPoints;return Vl=navigator.platform==="MacIntel"&&r!==void 0&&r>0},Lg=r=>{const{offsetWidth:e,offsetHeight:n}=r;return{width:e,height:n}},mx=r=>r,gx=r=>{const e=Math.max(r.startIndex-r.overscan,0),s=Math.min(r.endIndex+r.overscan,r.count-1)-e+1,l=new Array(s);for(let a=0;a{const n=r.scrollElement;if(!n)return;const s=r.targetWindow;if(!s)return;const l=c=>{const{width:d,height:h}=c;e({width:Math.round(d),height:Math.round(h)})};if(l(Lg(n)),!s.ResizeObserver)return()=>{};const a=new s.ResizeObserver(c=>{const d=()=>{const h=c[0];if(h!=null&&h.borderBoxSize){const m=h.borderBoxSize[0];if(m){l({width:m.inlineSize,height:m.blockSize});return}}l(Lg(n))};r.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(d):d()});return a.observe(n,{box:"border-box"}),()=>{a.unobserve(n)}},Ku={passive:!0},wx=typeof window>"u"?!0:"onscrollend"in window,_x=(r,e,n)=>{const s=r.scrollElement;if(!s)return;const l=r.targetWindow;if(!l)return;const a=r.options.useScrollendEvent&&wx;let c=0;const d=a?null:px(l,()=>e(c,!1),r.options.isScrollingResetDelay),h=v=>()=>{c=n(s),d==null||d(),e(c,v)},m=h(!0),w=h(!1);return s.addEventListener("scroll",m,Ku),a&&s.addEventListener("scrollend",w,Ku),()=>{s.removeEventListener("scroll",m),a&&s.removeEventListener("scrollend",w)}},yx=(r,e)=>_x(r,e,n=>{const{horizontal:s,isRtl:l}=r.options;return s?n.scrollLeft*(l&&-1||1):n.scrollTop}),Sx=(r,e,n)=>{if(n.options.useCachedMeasurements){const s=n.indexFromElement(r),l=n.options.getItemKey(s);return n.itemSizeCache.get(l)??n.options.estimateSize(s)}if(e!=null&&e.borderBoxSize){const s=e.borderBoxSize[0];if(s)return Math.round(s[n.options.horizontal?"inlineSize":"blockSize"])}if(!e){const s=n.indexFromElement(r),l=n.options.getItemKey(s),a=n.itemSizeCache.get(l);if(a!==void 0)return a}return r[n.options.horizontal?"offsetWidth":"offsetHeight"]},Dx=(r,{adjustments:e=0,behavior:n},s)=>{var l,a;(a=(l=s.scrollElement)==null?void 0:l.scrollTo)==null||a.call(l,{[s.options.horizontal?"left":"top"]:r+e,behavior:n})},Cx=Dx;class xx{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var n,s,l;return((l=(s=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:s.now)==null?void 0:l.call(s))??Date.now()},this.observer=(()=>{let n=null;const s=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(l=>{l.forEach(a=>{const c=()=>{const d=a.target,h=this.indexFromElement(d);if(!d.isConnected){this.observer.unobserve(d);for(const[m,w]of this.elementsCache)if(w===d){this.elementsCache.delete(m);break}return}this.shouldMeasureDuringScroll(h)&&this.resizeItem(h,this.options.measureElement(d,a,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(c):c()})}));return{disconnect:()=>{var l;(l=s())==null||l.disconnect(),n=null},observe:l=>{var a;return(a=s())==null?void 0:a.observe(l,{box:"border-box"})},unobserve:l=>{var a;return(a=s())==null?void 0:a.unobserve(l)}}})(),this.range=null,this.setOptions=n=>{var s,l;const a={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:mx,rangeExtractor:gx,onChange:()=>{},measureElement:Sx,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const S in n){const E=n[S];E!==void 0&&(a[S]=E)}const c=this.options;let d=null,h=null,m=!1;if(c!==void 0&&c.enabled&&a.enabled&&a.anchorTo==="end"&&this.scrollElement!==null){const S=c.count,E=a.count,A=this.getMeasurements(),D=S>0?((s=A[0])==null?void 0:s.key)??c.getItemKey(0):null,P=S>0?((l=A[S-1])==null?void 0:l.key)??c.getItemKey(S-1):null;if(E!==S||S>0&&E>0&&(a.getItemKey(0)!==D||a.getItemKey(E-1)!==P)){m=!0;const M=S>0?this.getVirtualItemForOffset(this.getScrollOffset())??A[0]:null;M&&(d=[M.key,this.getScrollOffset()-M.start]);const N=a.followOnAppend===!0?"auto":a.followOnAppend||null;N&&E>S&&this.isAtEnd(c.scrollEndThreshold)&&(S===0||a.getItemKey(E-1)!==P)&&(h=N)}}this.options=a,m&&(this.pendingMin=0,this.itemSizeCacheVersion++);let w=!1,v=0;if(d&&this.scrollOffset!==null){const[S,E]=d,A=this.getMeasurements(),{count:D,getItemKey:P}=this.options;let R=0;for(;R{var s,l;(l=(s=this.options).onChange)==null||l.call(s,this,n)},this.maybeNotify=Mo(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}if(this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(a=>{this.observer.observe(a)}),this.unsubs.push(this.options.observeElementRect(this,a=>{this.scrollRect=a,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(a,c)=>{this._intendedScrollOffset!==null&&Math.abs(a-this._intendedScrollOffset)<1.5&&(a=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=c?this.getScrollOffset(){this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},d=()=>{this._iosTouching=!1,!(!nh()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};a.addEventListener("touchstart",c,Ku),a.addEventListener("touchend",d,Ku),this.unsubs.push(()=>{a.removeEventListener("touchstart",c),a.removeEventListener("touchend",d),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const l=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,l&&this.scrollElement&&this.options.enabled){const[a,c,d,h]=l;a!==null&&!d&&(nh()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?h!==0&&(this._iosDeferredAdjustment+=h):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),d&&this.scrollToEnd({behavior:d})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const n=this.getScrollOffset(),s=this.getMaxScrollOffset();if(n<0||n>s)return;const l=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(n,{adjustments:this.scrollAdjustments+=l,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,s)=>{const l=new Map,a=new Map;for(let c=s-1;c>=0;c--){const d=n[c];if(l.has(d.lane))continue;const h=a.get(d.lane);if(h==null||d.end>h.end?a.set(d.lane,d):d.endc.end===d.end?c.index-d.index:c.end-d.end)[0]:void 0},this.getMeasurementOptions=Mo(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(n,s,l,a,c,d,h)=>(this.prevLanes!==void 0&&this.prevLanes!==d&&(this.lanesChangedFlag=!0),this.prevLanes=d,this.pendingMin=null,{count:n,paddingStart:s,scrollMargin:l,getItemKey:a,enabled:c,lanes:d,laneAssignmentMode:h}),{key:!1}),this.getMeasurements=Mo(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:s,scrollMargin:l,getItemKey:a,enabled:c,lanes:d,laneAssignmentMode:h},m)=>{const w=this.itemSizeCache;if(!c)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const A of this.laneAssignments.keys())A>=n&&this.laneAssignments.delete(A);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(A=>{this.itemSizeCache.set(A.key,A.size)}));const v=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1),d===1){const A=this.options.gap,D=n*2;let P=this._flatMeasurements;if(!P||P.length0&&M.set(P.subarray(0,v*2)),P=M,this._flatMeasurements=P}let R;if(v===0)R=s+l;else{const M=v-1;R=P[M*2]+P[M*2+1]+A}for(let M=v;M1){R=P;const $=E[R],K=$!==void 0?S[$]:void 0;O=K?K.end+this.options.gap:s+l}else{const $=this.options.lanes===1?S[A-1]:this.getFurthestMeasurement(S,A);O=$?$.end+this.options.gap:s+l,R=$?$.lane:A%this.options.lanes,this.options.lanes>1&&M&&this.laneAssignments.set(A,R)}const N=w.get(D),Z=typeof N=="number"?N:this.options.estimateSize(A),G=O+Z;S[A]={index:A,start:O,size:Z,end:G,key:D,lane:R},E[R]=A}return this.measurementsCache=S,S},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Mo(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,s,l,a)=>this.range=n.length>0&&s>0?Ex({measurements:n,outerSize:s,scrollOffset:l,lanes:a,flat:a===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Mo(()=>{let n=null,s=null;const l=this.calculateRange();return l&&(n=l.startIndex,s=l.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,s]},(n,s,l,a,c)=>a===null||c===null?[]:n({startIndex:a,endIndex:c,overscan:s,count:l}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const s=this.options.indexAttribute,l=n.getAttribute(s);return l?parseInt(l,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var s;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const l=this.scrollState.index??((s=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:s.index);if(l!==void 0&&this.range){const a=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),c=Math.max(0,l-a),d=Math.min(this.options.count-1,l+a);return n>=c&&n<=d}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((c,d)=>{c.isConnected||(this.observer.unobserve(c),this.elementsCache.delete(d))});return}const s=this.indexFromElement(n),l=this.options.getItemKey(s),a=this.elementsCache.get(l);a!==n&&(a&&this.observer.unobserve(a),this.observer.observe(n),this.elementsCache.set(l,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(s)&&this.resizeItem(s,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,s)=>{var l,a;if(n<0||n>=this.options.count)return;let c,d,h;const m=this._flatMeasurements;if(this.options.lanes===1&&m!==null)h=this.options.getItemKey(n),d=m[n*2],c=m[n*2+1];else{const S=this.measurementsCache[n];if(!S)return;h=S.key,d=S.start,c=S.size}const w=this.itemSizeCache.get(h)??c,v=s-w;if(v!==0){const S=this.options.anchorTo==="end"&&((l=this.scrollState)==null?void 0:l.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,E=S?this.getTotalSize():0,A=((a=this.scrollState)==null?void 0:a.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[n]??{index:n,key:h,start:d,size:c,end:d+c,lane:0},v,this):d[this.getVirtualIndexes(),this.getMeasurements()],(n,s)=>{const l=[];for(let a=0,c=n.length;athis.options.debug}),this.getVirtualItemForOffset=n=>{const s=this.getMeasurements();if(s.length===0)return;const l=this._flatMeasurements,a=this.options.lanes===1&&l!=null,c=ww(0,s.length-1,a?d=>l[d*2]:d=>Mg(s[d]).start,n);return Mg(s[c])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(n=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=n,this.getOffsetForAlignment=(n,s,l=0)=>{if(!this.scrollElement)return 0;const a=this.getSize(),c=this.getScrollOffset();s==="auto"&&(s=n>=c+a?"end":"start"),s==="center"?n+=(l-a)/2:s==="end"&&(n-=a);const d=this.getMaxScrollOffset();return Math.max(Math.min(d,n),0)},this.getOffsetForIndex=(n,s="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const l=this.getSize(),a=this.getScrollOffset(),c=this.measurementsCache[n];if(!c)return;if(s==="auto")if(c.end>=a+l-this.options.scrollPaddingEnd)s="end";else if(c.start<=a+this.options.scrollPaddingStart)s="start";else return[a,s];if(s==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),s];const d=s==="end"?c.end+this.options.scrollPaddingEnd:c.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(d,s,c.size),s]},this.scrollToOffset=(n,{align:s="start",behavior:l="auto"}={})=>{const a=this.getOffsetForAlignment(n,s),c=this.now();this.scrollState={index:null,align:s,behavior:l,startedAt:c,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:l}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:s="auto",behavior:l="auto"}={})=>{n=Math.max(0,Math.min(n,this.options.count-1));const a=this.getOffsetForIndex(n,s);if(!a)return;const[c,d]=a,h=this.now();this.scrollState={index:n,align:d,behavior:l,startedAt:h,lastTargetOffset:c,stableFrames:0},this._scrollToOffset(c,{adjustments:void 0,behavior:l}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:s="auto"}={})=>{const l=this.getScrollOffset()+n,a=this.now();this.scrollState={index:null,align:"start",behavior:s,startedAt:a,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:n="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:n});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:n})},this.getTotalSize=()=>{var n;const s=this.getMeasurements();let l;if(s.length===0)l=this.options.paddingStart;else if(this.options.lanes===1){const a=s.length-1,c=this._flatMeasurements;c!=null?l=c[a*2]+c[a*2+1]:l=((n=s[a])==null?void 0:n.end)??0}else{const a=Array(this.options.lanes).fill(null);let c=s.length-1;for(;c>=0&&a.some(d=>d===null);){const d=s[c];a[d.lane]===null&&(a[d.lane]=d.end),c--}l=Math.max(...a.filter(d=>d!==null))}return Math.max(l-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const n=[];if(this.itemSizeCache.size===0)return n;const s=this.getMeasurements();for(const l of s)l&&this.itemSizeCache.has(l.key)&&n.push({index:l.index,key:l.key,start:l.start,size:l.size,end:l.end,lane:l.lane});return n},this._scrollToOffset=(n,{adjustments:s,behavior:l})=>{this._intendedScrollOffset=n+(s??0),this.options.scrollToFn(n,{behavior:l,adjustments:s},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,n){e!==0&&(nh()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=e:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:n}))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const s=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,l=s?s[0]:this.scrollState.lastTargetOffset,a=1,c=l!==this.scrollState.lastTargetOffset;if(!c&&fx(l,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=a){this.getScrollOffset()!==l&&this._scrollToOffset(l,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,c){const d=this.getSize()||600,h=Math.abs(l-this.getScrollOffset()),m=this.scrollState.behavior==="smooth"&&h>d;this.scrollState.lastTargetOffset=l,m||(this.scrollState.behavior="auto"),this._scrollToOffset(l,{adjustments:void 0,behavior:m?"smooth":"auto"})}this.scheduleScrollReconcile()}}const ww=(r,e,n,s)=>{for(;r<=e;){const l=(r+e)/2|0,a=n(l);if(as)e=l-1;else return l}return r>0?r-1:0};function Ex({measurements:r,outerSize:e,scrollOffset:n,lanes:s,flat:l}){const a=r.length-1,c=l?w=>l[w*2]:w=>r[w].start,d=l?w=>l[w*2]+l[w*2+1]:w=>r[w].end;if(r.length<=s)return{startIndex:0,endIndex:a};let h=ww(0,a,c,n),m=h;if(s===1)for(;m1){const w=Array(s).fill(0);for(;mS=0&&v.some(S=>S>=n);){const S=r[h];v[S.lane]=S.start,h--}h=Math.max(0,h-h%s),m=Math.min(a,m+(s-1-m%s))}return{startIndex:h,endIndex:m}}const ih=typeof document<"u"?B.useLayoutEffect:B.useEffect;function bx({useFlushSync:r=!0,directDomUpdates:e=!1,directDomUpdatesMode:n="transform",...s}){const l=B.useReducer(m=>m+1,0)[1],a=B.useRef({enabled:e,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});a.current.enabled=e,a.current.mode=n;const c=m=>{const w=a.current;if(!w.enabled||!w.container)return;const v=m.getTotalSize();if(v!==w.lastSize){w.lastSize=v;const R=m.options.horizontal?"width":"height";w.container.style[R]=`${v}px`}const S=!!m.options.horizontal,E=w.mode==="transform",A=S?"left":"top",D=m.options.scrollMargin,P=m.getVirtualItems();for(const R of P){const O=R.start-D,M=m.elementsCache.get(R.key);M&&w.lastPositions.get(M)!==O&&(w.lastPositions.set(M,O),E?M.style.transform=S?`translate3d(${O}px, 0, 0)`:`translate3d(0, ${O}px, 0)`:M.style[A]=`${O}px`)}},d={...s,onChange:(m,w)=>{var v;const S=a.current;let E=!0;if(S.enabled){c(m);const A=m.range,D=S.prevRange;E=!D||D.isScrolling!==m.isScrolling||D.startIndex!==(A==null?void 0:A.startIndex)||D.endIndex!==(A==null?void 0:A.endIndex),E&&(S.prevRange=A?{startIndex:A.startIndex,endIndex:A.endIndex,isScrolling:m.isScrolling}:null)}E&&(r&&w?Kr.flushSync(l):l()),(v=s.onChange)==null||v.call(s,m,w)}},[h]=B.useState(()=>{const m=new xx(d);return Object.assign(m,{containerRef:w=>{const v=a.current;if(v.container=w,v.lastSize=null,w&&v.enabled){const S=m.getTotalSize();v.lastSize=S;const E=m.options.horizontal?"width":"height";w.style[E]=`${S}px`}}})});return h.setOptions(d),ih(()=>h._didMount(),[]),ih(()=>h._willUpdate()),ih(()=>{c(h)}),h}function Px(r){return bx({observeElementRect:vx,observeElementOffset:yx,scrollToFn:Cx,...r})}function Ax(r){const e=Object.keys(r.fields);return e.length?e.slice(0,4).map(n=>`${n}=${r.fields[n]}`).join(" "):r.note||""}function zx(){const[,r]=B.useState(0),[e,n]=B.useState(!1),s=B.useRef(null),l=B.useRef([]);B.useEffect(()=>{Tg(!0);const d=tx(()=>{e||(l.current=ex(),r(h=>h+1))});return()=>{Tg(!1),d()}},[e]);const a=l.current,c=Px({count:a.length,getScrollElement:()=>s.current,estimateSize:()=>22,overscan:12});return B.useEffect(()=>{!e&&a.length&&c.scrollToIndex(a.length-1)},[a.length,e,c]),Y.jsxs("div",{className:"panel rawlog-panel",children:[Y.jsxs("div",{className:"rawlog-toolbar",children:[Y.jsx("button",{className:e?"btn small":"btn small active",onClick:()=>n(d=>!d),children:e?"Resume":"Pause"}),Y.jsxs("span",{className:"muted",children:[a.length," frames"]}),Y.jsxs("div",{className:"rawlog-head",children:[Y.jsx("span",{className:"c-t",children:"t"}),Y.jsx("span",{className:"c-arb",children:"arb"}),Y.jsx("span",{className:"c-m",children:"motor"}),Y.jsx("span",{className:"c-k",children:"kind"}),Y.jsx("span",{className:"c-f",children:"decoded"}),Y.jsx("span",{className:"c-r",children:"raw"})]})]}),Y.jsx("div",{className:"rawlog-body",ref:s,children:Y.jsx("div",{style:{height:c.getTotalSize(),position:"relative"},children:c.getVirtualItems().map(d=>{const h=a[d.index];return Y.jsxs("div",{className:"rawlog-row k-"+h.kind,style:{transform:`translateY(${d.start}px)`},children:[Y.jsx("span",{className:"c-t mono",children:h.t.toFixed(3)}),Y.jsxs("span",{className:"c-arb mono",children:["0x",h.arb.toString(16).toUpperCase()]}),Y.jsxs("span",{className:"c-m mono",children:["m",h.motorId]}),Y.jsx("span",{className:"c-k",children:h.mode||h.kind}),Y.jsx("span",{className:"c-f mono",children:Ax(h)}),Y.jsx("span",{className:"c-r mono dim",children:h.raw})]},h.seq)})})})]})}const Vg="damiao.monitor.layout",kx={plot:r=>Y.jsx(ux,{panelId:r.api.id}),table:()=>Y.jsx(cx,{}),cards:()=>Y.jsx(dx,{}),rawlog:()=>Y.jsx(zx,{})};function Ox(r){r.addPanel({id:"plot-1",component:"plot",title:"Plot 1"}),r.addPanel({id:"cards-1",component:"cards",title:"Motor Cards",position:{referencePanel:"plot-1",direction:"right"}}),r.addPanel({id:"table-1",component:"table",title:"Motor Table",position:{referencePanel:"plot-1",direction:"below"}}),r.addPanel({id:"raw-1",component:"rawlog",title:"Raw CAN Log",position:{referencePanel:"table-1",direction:"within"}})}function Tx(){const r=B.useCallback(e=>{const{api:n}=e;ly(n);const s=localStorage.getItem(Vg);let l=!1;if(s)try{n.fromJSON(JSON.parse(s)),l=!0}catch{l=!1}l||Ox(n),n.onDidLayoutChange(()=>{try{localStorage.setItem(Vg,JSON.stringify(n.toJSON()))}catch{}})},[]);return Y.jsx(Pv,{className:"dockview-theme-abyss",components:kx,onReady:r})}function Ix(){const r=Cn(d=>d.addSignalToPlot),e=Cn(d=>d.setMotorTypes),[n,s]=B.useState(null),l=M0(R0(Lh,{activationConstraint:{distance:4}}));B.useEffect(()=>{vw(),ox().then(e)},[e]);const a=d=>{var m;const h=(m=d.active.data.current)==null?void 0:m.signalId;s(h?ah(h):null)},c=d=>{var w,v,S,E;s(null);const h=(w=d.active.data.current)==null?void 0:w.signalId,m=((S=(v=d.over)==null?void 0:v.id)==null?void 0:S.toString())||"";if(h&&m.startsWith("plot:")){const A=(E=d.over.data.current)==null?void 0:E.panelId;r(A,h)}};return Y.jsxs(I_,{sensors:l,onDragStart:a,onDragEnd:c,children:[Y.jsxs("div",{className:"app",children:[Y.jsx(ay,{}),Y.jsxs("div",{className:"body",children:[Y.jsx(py,{}),Y.jsx("main",{className:"dock-host",children:Y.jsx(Tx,{})})]})]}),Y.jsx(q_,{dropAnimation:null,children:n?Y.jsx("div",{className:"drag-ghost",children:n}):null})]})}y0.createRoot(document.getElementById("root")).render(Y.jsx(pe.StrictMode,{children:Y.jsx(Ix,{})})); diff --git a/damiao_motor/gui/webapp/dist/index.html b/damiao_motor/gui/webapp/dist/index.html index 141ed17..641e3e8 100644 --- a/damiao_motor/gui/webapp/dist/index.html +++ b/damiao_motor/gui/webapp/dist/index.html @@ -4,8 +4,8 @@ DaMiao Monitor - - + +
diff --git a/damiao_motor/gui/webapp/src/components/Dock.tsx b/damiao_motor/gui/webapp/src/components/Dock.tsx index 975a39a..51794ed 100644 --- a/damiao_motor/gui/webapp/src/components/Dock.tsx +++ b/damiao_motor/gui/webapp/src/components/Dock.tsx @@ -1,26 +1,12 @@ import { useCallback } from "react"; -import { - DockviewReact, - type DockviewReadyEvent, - type IDockviewPanelProps, -} from "dockview"; +import { DockviewReact, type DockviewReadyEvent } from "dockview"; import "dockview/dist/styles/dockview.css"; -import PlotPanel from "../panels/PlotPanel"; -import TablePanel from "../panels/TablePanel"; -import CardsPanel from "../panels/CardsPanel"; -import RawLogPanel from "../panels/RawLogPanel"; +import { dockComponents } from "../panels/registry"; import { setDockApi } from "../lib/dock"; const LAYOUT_KEY = "damiao.monitor.layout"; -const components = { - plot: (props: IDockviewPanelProps) => , - table: () => , - cards: () => , - rawlog: () => , -}; - function defaultLayout(api: DockviewReadyEvent["api"]) { api.addPanel({ id: "plot-1", component: "plot", title: "Plot 1" }); api.addPanel({ @@ -72,7 +58,7 @@ export default function Dock() { return ( ); diff --git a/damiao_motor/gui/webapp/src/components/Toolbar.tsx b/damiao_motor/gui/webapp/src/components/Toolbar.tsx index 06423f4..e93598b 100644 --- a/damiao_motor/gui/webapp/src/components/Toolbar.tsx +++ b/damiao_motor/gui/webapp/src/components/Toolbar.tsx @@ -1,5 +1,6 @@ import { useApp } from "../lib/store"; import { addPanelOfKind } from "../lib/dock"; +import { PANELS } from "../panels/registry"; export default function Toolbar() { const connected = useApp((s) => s.connected); @@ -39,10 +40,16 @@ export default function Toolbar() {
- - - - + {PANELS.map((p) => ( + + ))}
diff --git a/damiao_motor/gui/webapp/src/index.css b/damiao_motor/gui/webapp/src/index.css index 70232da..52a7907 100644 --- a/damiao_motor/gui/webapp/src/index.css +++ b/damiao_motor/gui/webapp/src/index.css @@ -72,6 +72,7 @@ body { .btn.ghost { background: transparent; } .btn.small { padding: 3px 8px; font-size: 11px; } .btn.active { border-color: var(--accent); color: var(--accent); } +.btn-icon { color: var(--accent); margin-right: 1px; font-size: 12px; } /* ------------------------------------------------------------- sidebar */ .sidebar { @@ -167,11 +168,31 @@ body { /* raw log */ .rawlog-panel { font-size: 11.5px; } .rawlog-toolbar { display: flex; align-items: center; gap: 10px; padding: 5px 10px; border-bottom: 1px solid var(--border); } -.rawlog-head, .rawlog-row { display: grid; grid-template-columns: 70px 64px 50px 90px 1fr 180px; gap: 8px; align-items: center; } -.rawlog-head { flex: 1; color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.3px; } -.rawlog-body { flex: 1; overflow: auto; padding: 0 10px; } -.rawlog-row { position: absolute; left: 10px; right: 10px; height: 22px; border-bottom: 1px solid rgba(42,49,60,0.5); } -.rawlog-row .c-r { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } +.rawlog-body { flex: 1; overflow: auto; } +/* header + rows share one grid template + padding so columns align exactly */ +.rawlog-head, .rawlog-row { + display: grid; + grid-template-columns: 96px 60px 46px 76px minmax(0, 1fr) 150px; + gap: 10px; + align-items: center; + padding: 0 10px; +} +.rawlog-head { + position: sticky; + top: 0; + z-index: 2; + height: 26px; + background: var(--bg-2); + border-bottom: 1px solid var(--border); + color: var(--muted); + font-size: 10.5px; + text-transform: uppercase; + letter-spacing: 0.3px; +} +.rawlog-row { position: absolute; left: 0; right: 0; height: 22px; line-height: 22px; border-bottom: 1px solid rgba(42,49,60,0.5); } +/* every cell stays on one line and clips with an ellipsis so rows never overlap */ +.rawlog-head > span, .rawlog-row > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; } +.rawlog-row .c-f { color: var(--text); } .rawlog-row.k-command .c-k { color: var(--accent); } .rawlog-row.k-feedback .c-k { color: var(--ok); } .rawlog-row.k-special .c-k { color: var(--warn); } diff --git a/damiao_motor/gui/webapp/src/lib/dock.ts b/damiao_motor/gui/webapp/src/lib/dock.ts index edb5d43..30473ae 100644 --- a/damiao_motor/gui/webapp/src/lib/dock.ts +++ b/damiao_motor/gui/webapp/src/lib/dock.ts @@ -1,6 +1,5 @@ import type { DockviewApi } from "dockview"; -import type { PanelKind } from "./types"; -import { PANEL_TITLES } from "./store"; +import { PANEL_BY_KIND } from "../panels/registry"; let api: DockviewApi | null = null; const counters: Record = {}; @@ -12,13 +11,11 @@ export function getDockApi(): DockviewApi | null { return api; } -export function addPanelOfKind(kind: PanelKind) { +export function addPanelOfKind(kind: string) { if (!api) return; + const def = PANEL_BY_KIND[kind]; + if (!def) return; counters[kind] = (counters[kind] || 0) + 1; const id = `${kind}-${Date.now().toString(36)}-${counters[kind]}`; - api.addPanel({ - id, - component: kind, - title: `${PANEL_TITLES[kind]} ${counters[kind]}`, - }); + api.addPanel({ id, component: kind, title: `${def.title} ${counters[kind]}` }); } diff --git a/damiao_motor/gui/webapp/src/lib/store.ts b/damiao_motor/gui/webapp/src/lib/store.ts index bcced31..c141ccd 100644 --- a/damiao_motor/gui/webapp/src/lib/store.ts +++ b/damiao_motor/gui/webapp/src/lib/store.ts @@ -1,7 +1,7 @@ /** Low-frequency app state (registry, status, motor views, panel configs, layout). */ import { create } from "zustand"; -import type { MotorView, Pair, PanelKind, ServerStatus, SignalDescriptor } from "./types"; +import type { MotorView, Pair, ServerStatus, SignalDescriptor } from "./types"; export interface PlotConfig { signals: string[]; @@ -106,10 +106,3 @@ export const useApp = create((set, get) => ({ // persist plot configs whenever they change (dock layout persisted by the Dock component) useApp.subscribe((st) => persistPlotConfigs(st.plotConfigs)); - -export const PANEL_TITLES: Record = { - plot: "Plot", - table: "Motor Table", - cards: "Motor Cards", - rawlog: "Raw CAN Log", -}; diff --git a/damiao_motor/gui/webapp/src/lib/types.ts b/damiao_motor/gui/webapp/src/lib/types.ts index 5d6acca..75e20b8 100644 --- a/damiao_motor/gui/webapp/src/lib/types.ts +++ b/damiao_motor/gui/webapp/src/lib/types.ts @@ -51,4 +51,4 @@ export interface RawFrame { raw: string; } -export type PanelKind = "plot" | "table" | "cards" | "rawlog"; +// Panel kinds are open-ended; see panels/registry.tsx for the registered set. diff --git a/damiao_motor/gui/webapp/src/panels/RawLogPanel.tsx b/damiao_motor/gui/webapp/src/panels/RawLogPanel.tsx index 46a8586..e5a1afb 100644 --- a/damiao_motor/gui/webapp/src/panels/RawLogPanel.tsx +++ b/damiao_motor/gui/webapp/src/panels/RawLogPanel.tsx @@ -4,13 +4,34 @@ import { useVirtualizer } from "@tanstack/react-virtual"; import { getRawFrames, onRawFrames, wantRaw } from "../lib/dataStore"; import type { RawFrame } from "../lib/types"; +const SHORT: Record = { + pos: "p", + vel: "v", + torque: "τ", + kp: "kp", + kd: "kd", + vel_limit: "vlim", + torque_limit: "τlim", + t_mos: "Tm", + t_rotor: "Tr", +}; +const SUMMARY_ORDER = ["pos", "vel", "torque", "kp", "kd", "t_mos", "t_rotor"]; + function fieldsSummary(f: RawFrame): string { - const keys = Object.keys(f.fields); - if (!keys.length) return f.note || ""; - return keys - .slice(0, 4) - .map((k) => `${k}=${f.fields[k]}`) - .join(" "); + const parts: string[] = []; + for (const k of SUMMARY_ORDER) { + if (k in f.fields) parts.push(`${SHORT[k] || k} ${f.fields[k].toFixed(2)}`); + } + return parts.join(" ") || f.note || ""; +} + +function fmtTime(t: number): string { + const d = new Date(t * 1000); + const hh = String(d.getHours()).padStart(2, "0"); + const mm = String(d.getMinutes()).padStart(2, "0"); + const ss = String(d.getSeconds()).padStart(2, "0"); + const ms = String(Math.floor((t % 1) * 1000)).padStart(3, "0"); + return `${hh}:${mm}:${ss}.${ms}`; } export default function RawLogPanel() { @@ -53,16 +74,18 @@ export default function RawLogPanel() { {paused ? "Resume" : "Pause"} {frames.length} frames +
+
+ {/* sticky header lives in the same scroll container as the rows, sharing the + exact grid + padding so columns line up perfectly */}
- t + time arb motor kind decoded raw
-
-
{rowVirt.getVirtualItems().map((vi) => { const f = frames[vi.index]; @@ -72,7 +95,7 @@ export default function RawLogPanel() { className={"rawlog-row k-" + f.kind} style={{ transform: `translateY(${vi.start}px)` }} > - {f.t.toFixed(3)} + {fmtTime(f.t)} 0x{f.arb.toString(16).toUpperCase()} m{f.motorId} {f.mode || f.kind} diff --git a/damiao_motor/gui/webapp/src/panels/registry.tsx b/damiao_motor/gui/webapp/src/panels/registry.tsx new file mode 100644 index 0000000..6011cc9 --- /dev/null +++ b/damiao_motor/gui/webapp/src/panels/registry.tsx @@ -0,0 +1,65 @@ +/** + * Panel registry — the single source of truth for panel types. + * + * To add a new view, add ONE entry here: its kind, title, icon, and how to render it. + * The dock component map, the toolbar "add panel" buttons, the default layout, and panel + * titling are all derived from this list, so nothing else needs editing. + */ + +import type { IDockviewPanelProps } from "dockview"; +import PlotPanel from "./PlotPanel"; +import TablePanel from "./TablePanel"; +import CardsPanel from "./CardsPanel"; +import RawLogPanel from "./RawLogPanel"; + +export interface PanelDef { + kind: string; + title: string; + icon: string; + description: string; + /** Render the panel body given its dockview panel id. */ + render: (panelId: string) => JSX.Element; +} + +export const PANELS: PanelDef[] = [ + { + kind: "plot", + title: "Plot", + icon: "〜", + description: "Time-series chart; drag signals onto it (cmd over fb to overlay).", + render: (id) => , + }, + { + kind: "table", + title: "Motor Table", + icon: "▦", + description: "One row per motor: commanded vs actual.", + render: () => , + }, + { + kind: "cards", + title: "Motor Cards", + icon: "▢", + description: "Per-motor cards/gauges with big readouts.", + render: () => , + }, + { + kind: "rawlog", + title: "Raw CAN Log", + icon: "≣", + description: "Scrolling decoded frame log.", + render: () => , + }, +]; + +export const PANEL_BY_KIND: Record = Object.fromEntries( + PANELS.map((p) => [p.kind, p]) +); + +/** dockview component map, derived from the registry. */ +export const dockComponents: Record< + string, + (props: IDockviewPanelProps) => JSX.Element +> = Object.fromEntries( + PANELS.map((p) => [p.kind, (props: IDockviewPanelProps) => p.render(props.api.id)]) +); diff --git a/damiao_motor/gui/webapp/tsconfig.tsbuildinfo b/damiao_motor/gui/webapp/tsconfig.tsbuildinfo index 4e996cb..8bd09a9 100644 --- a/damiao_motor/gui/webapp/tsconfig.tsbuildinfo +++ b/damiao_motor/gui/webapp/tsconfig.tsbuildinfo @@ -1 +1 @@ -{"root":["./src/app.tsx","./src/main.tsx","./src/components/dock.tsx","./src/components/signalchip.tsx","./src/components/signalsidebar.tsx","./src/components/toolbar.tsx","./src/lib/datastore.ts","./src/lib/dock.ts","./src/lib/format.ts","./src/lib/store.ts","./src/lib/types.ts","./src/lib/ws.ts","./src/panels/cardspanel.tsx","./src/panels/plotpanel.tsx","./src/panels/rawlogpanel.tsx","./src/panels/tablepanel.tsx"],"version":"5.9.3"} \ No newline at end of file +{"root":["./src/app.tsx","./src/main.tsx","./src/components/dock.tsx","./src/components/signalchip.tsx","./src/components/signalsidebar.tsx","./src/components/toolbar.tsx","./src/lib/datastore.ts","./src/lib/dock.ts","./src/lib/format.ts","./src/lib/store.ts","./src/lib/types.ts","./src/lib/ws.ts","./src/panels/cardspanel.tsx","./src/panels/plotpanel.tsx","./src/panels/rawlogpanel.tsx","./src/panels/tablepanel.tsx","./src/panels/registry.tsx"],"version":"5.9.3"} \ No newline at end of file From 83864abc90972198c5793ad44387d327a00708d0 Mon Sep 17 00:00:00 2001 From: Jia Xie Date: Mon, 15 Jun 2026 18:07:34 -0700 Subject: [PATCH 07/14] fix(monitor): don't require known status nibble to classify feedback Real linearbot arm joints 4-7 report an undocumented status nibble (3), which made the feedback detector fall through and misclassify their feedback as MIT commands (phantom m20-23 signals). The arb-range + can-id-nibble match already disambiguates feedback (ids offset+1..offset+15) from MIT commands (ids 1..15), so the status gate was both unnecessary and wrong. Status still surfaces (e.g. UNKNOWN(3)) for display. Validated live on can_arm_l and can_arm_r: all 7 joints decode (cmd+feedback), pairs link, values plausible, 0 decode errors, monitor stays listen-only. Co-Authored-By: Claude Opus 4.8 (1M context) --- damiao_motor/monitor/decode.py | 12 ++++++++++-- tests/test_monitor.py | 13 +++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/damiao_motor/monitor/decode.py b/damiao_motor/monitor/decode.py index 13e05a5..fe31625 100644 --- a/damiao_motor/monitor/decode.py +++ b/damiao_motor/monitor/decode.py @@ -168,9 +168,17 @@ def _decode_feedback(data: bytes, lim: Dict[str, float]) -> Dict[str, float]: def _looks_like_feedback(arb: int, data: bytes, offset: int) -> Optional[int]: - """Return the motor id if the frame looks like a feedback frame, else None.""" + """Return the motor id if the frame looks like a feedback frame, else None. + + Feedback arbitration id = motor_id + offset, with the motor's CAN id in the low + nibble of ``data[0]``. We deliberately do NOT require the status nibble to be a known + code: real motors report states outside the documented set (observed: status 3 on + linearbot joints 4-7), and the arb-range + can-id-nibble match is already unambiguous + for the standard schemes (feedback ids offset+1..offset+15 don't overlap MIT command + ids 1..15 for offset >= 16). + """ mid = arb - offset - if 1 <= mid <= 15 and (data[0] & 0x0F) == mid and (data[0] >> 4) in KNOWN_STATUS: + if 1 <= mid <= 15 and (data[0] & 0x0F) == mid: return mid return None diff --git a/tests/test_monitor.py b/tests/test_monitor.py index 10c41ad..48912be 100644 --- a/tests/test_monitor.py +++ b/tests/test_monitor.py @@ -99,6 +99,19 @@ def test_feedback_roundtrip_and_disambiguation(): assert frame.note == "ENABLED" +def test_feedback_with_undocumented_status_still_decodes(): + """Real linearbot joints 4-7 report status nibble 3 (not in the documented set); + such frames must still classify as feedback, not be misread as commands.""" + lim = resolve_limits(MOTOR_TYPE) + # motor id 4 -> feedback arb 20, status nibble 3 + data = _make_feedback_frame(4, 3, 1.0, 0.0, 0.0, 30, 30, lim) + frame = decode_frame(4 + 16, data, t=0.0, motor_types={4: MOTOR_TYPE}) + assert frame.kind == KIND_FEEDBACK + assert frame.motor_id == 4 + assert frame.fields["pos"] == pytest.approx(1.0, abs=1e-3) + assert "UNKNOWN" in frame.note # status 3 surfaced as UNKNOWN(3), not dropped + + def test_special_command(): frame = decode_frame(MOTOR_ID, bytes([0xFF] * 7 + [0xFC]), t=0.0) assert frame.kind == KIND_SPECIAL and frame.note == "enable" From 50caf09545a010cba492066862dbe343cfae9701 Mon Sep 17 00:00:00 2001 From: Jia Xie Date: Mon, 15 Jun 2026 19:38:57 -0700 Subject: [PATCH 08/14] redesign(monitor ui): free-form widget canvas (GridStack) + softer theme MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaces the rigid dockview tiling with a Grafana-style free-form canvas: every panel is a widget you drag (by header) and resize (any edge) anywhere on a 12-col grid; add from the toolbar, remove via the header ×, layout persists. Refreshed to a softer, more modern dark theme (rounded surfaces, gentler palette, more breathing room). - lib/widgets.ts: widget store (geometry + persistence, default layout, reset). - components/Canvas.tsx: GridStack init + React content via portals (no DOM fighting); geometry synced back to the store on drag/resize. - panels/registry.tsx: drop dockview component map; panels render unchanged. - remove components/Dock.tsx, lib/dock.ts, dockview dep (bundle -25%). - Toolbar adds widgets via the store; dnd-kit signal->plot drag still works. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../gui/webapp/dist/assets/index-B8iZZsik.js | 46 ---- .../gui/webapp/dist/assets/index-BV1u67uH.js | 54 ++++ .../gui/webapp/dist/assets/index-BsxMcYGb.css | 1 + .../gui/webapp/dist/assets/index-COYw01IO.css | 1 - damiao_motor/gui/webapp/dist/index.html | 4 +- damiao_motor/gui/webapp/package-lock.json | 36 ++- damiao_motor/gui/webapp/package.json | 2 +- damiao_motor/gui/webapp/src/App.tsx | 6 +- .../gui/webapp/src/components/Canvas.tsx | 121 +++++++++ .../gui/webapp/src/components/Dock.tsx | 65 ----- .../gui/webapp/src/components/Toolbar.tsx | 12 +- damiao_motor/gui/webapp/src/index.css | 255 ++++++++++-------- damiao_motor/gui/webapp/src/lib/dock.ts | 21 -- damiao_motor/gui/webapp/src/lib/widgets.ts | 92 +++++++ .../gui/webapp/src/panels/registry.tsx | 9 - damiao_motor/gui/webapp/tsconfig.tsbuildinfo | 2 +- damiao_motor/monitor/README.md | 12 +- 17 files changed, 448 insertions(+), 291 deletions(-) delete mode 100644 damiao_motor/gui/webapp/dist/assets/index-B8iZZsik.js create mode 100644 damiao_motor/gui/webapp/dist/assets/index-BV1u67uH.js create mode 100644 damiao_motor/gui/webapp/dist/assets/index-BsxMcYGb.css delete mode 100644 damiao_motor/gui/webapp/dist/assets/index-COYw01IO.css create mode 100644 damiao_motor/gui/webapp/src/components/Canvas.tsx delete mode 100644 damiao_motor/gui/webapp/src/components/Dock.tsx delete mode 100644 damiao_motor/gui/webapp/src/lib/dock.ts create mode 100644 damiao_motor/gui/webapp/src/lib/widgets.ts diff --git a/damiao_motor/gui/webapp/dist/assets/index-B8iZZsik.js b/damiao_motor/gui/webapp/dist/assets/index-B8iZZsik.js deleted file mode 100644 index fb1641c..0000000 --- a/damiao_motor/gui/webapp/dist/assets/index-B8iZZsik.js +++ /dev/null @@ -1,46 +0,0 @@ -var c0=Object.defineProperty;var d0=(r,e,n)=>e in r?c0(r,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[e]=n;var Tl=(r,e,n)=>d0(r,typeof e!="symbol"?e+"":e,n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))s(l);new MutationObserver(l=>{for(const a of l)if(a.type==="childList")for(const c of a.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function n(l){const a={};return l.integrity&&(a.integrity=l.integrity),l.referrerPolicy&&(a.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?a.credentials="include":l.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function s(l){if(l.ep)return;l.ep=!0;const a=n(l);fetch(l.href,a)}})();function Ah(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Id={exports:{}},Il={},Rd={exports:{}},Ue={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var tm;function h0(){if(tm)return Ue;tm=1;var r=Symbol.for("react.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),v=Symbol.iterator;function S(z){return z===null||typeof z!="object"?null:(z=v&&z[v]||z["@@iterator"],typeof z=="function"?z:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},A=Object.assign,D={};function P(z,F,q){this.props=z,this.context=F,this.refs=D,this.updater=q||E}P.prototype.isReactComponent={},P.prototype.setState=function(z,F){if(typeof z!="object"&&typeof z!="function"&&z!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,z,F,"setState")},P.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function N(){}N.prototype=P.prototype;function O(z,F,q){this.props=z,this.context=F,this.refs=D,this.updater=q||E}var M=O.prototype=new N;M.constructor=O,A(M,P.prototype),M.isPureReactComponent=!0;var R=Array.isArray,Z=Object.prototype.hasOwnProperty,G={current:null},$={key:!0,ref:!0,__self:!0,__source:!0};function K(z,F,q){var xe,Ie={},Se=null,Ee=null;if(F!=null)for(xe in F.ref!==void 0&&(Ee=F.ref),F.key!==void 0&&(Se=""+F.key),F)Z.call(F,xe)&&!$.hasOwnProperty(xe)&&(Ie[xe]=F[xe]);var We=arguments.length-2;if(We===1)Ie.children=q;else if(1>>1,F=le[z];if(0>>1;zl(Ie,ne))Sel(Ee,Ie)?(le[z]=Ee,le[Se]=ne,z=Se):(le[z]=Ie,le[xe]=ne,z=xe);else if(Sel(Ee,ne))le[z]=Ee,le[Se]=ne,z=Se;else break e}}return fe}function l(le,fe){var ne=le.sortIndex-fe.sortIndex;return ne!==0?ne:le.id-fe.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;r.unstable_now=function(){return a.now()}}else{var c=Date,d=c.now();r.unstable_now=function(){return c.now()-d}}var h=[],m=[],w=1,v=null,S=3,E=!1,A=!1,D=!1,P=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function M(le){for(var fe=n(m);fe!==null;){if(fe.callback===null)s(m);else if(fe.startTime<=le)s(m),fe.sortIndex=fe.expirationTime,e(h,fe);else break;fe=n(m)}}function R(le){if(D=!1,M(le),!A)if(n(h)!==null)A=!0,te(Z);else{var fe=n(m);fe!==null&&X(R,fe.startTime-le)}}function Z(le,fe){A=!1,D&&(D=!1,N(K),K=-1),E=!0;var ne=S;try{for(M(fe),v=n(h);v!==null&&(!(v.expirationTime>fe)||le&&!Q());){var z=v.callback;if(typeof z=="function"){v.callback=null,S=v.priorityLevel;var F=z(v.expirationTime<=fe);fe=r.unstable_now(),typeof F=="function"?v.callback=F:v===n(h)&&s(h),M(fe)}else s(h);v=n(h)}if(v!==null)var q=!0;else{var xe=n(m);xe!==null&&X(R,xe.startTime-fe),q=!1}return q}finally{v=null,S=ne,E=!1}}var G=!1,$=null,K=-1,he=5,ue=-1;function Q(){return!(r.unstable_now()-uele||125z?(le.sortIndex=ne,e(m,le),n(h)===null&&le===n(m)&&(D?(N(K),K=-1):D=!0,X(R,ne-z))):(le.sortIndex=F,e(h,le),A||E||(A=!0,te(Z))),le},r.unstable_shouldYield=Q,r.unstable_wrapCallback=function(le){var fe=S;return function(){var ne=S;S=fe;try{return le.apply(this,arguments)}finally{S=ne}}}})(Ld)),Ld}var om;function g0(){return om||(om=1,Md.exports=m0()),Md.exports}/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var lm;function v0(){if(lm)return fi;lm=1;var r=kh(),e=g0();function n(t){for(var i="https://reactjs.org/docs/error-decoder.html?invariant="+t,o=1;o"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),h=Object.prototype.hasOwnProperty,m=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,w={},v={};function S(t){return h.call(v,t)?!0:h.call(w,t)?!1:m.test(t)?v[t]=!0:(w[t]=!0,!1)}function E(t,i,o,u){if(o!==null&&o.type===0)return!1;switch(typeof i){case"function":case"symbol":return!0;case"boolean":return u?!1:o!==null?!o.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function A(t,i,o,u){if(i===null||typeof i>"u"||E(t,i,o,u))return!0;if(u)return!1;if(o!==null)switch(o.type){case 3:return!i;case 4:return i===!1;case 5:return isNaN(i);case 6:return isNaN(i)||1>i}return!1}function D(t,i,o,u,f,p,_){this.acceptsBooleans=i===2||i===3||i===4,this.attributeName=u,this.attributeNamespace=f,this.mustUseProperty=o,this.propertyName=t,this.type=i,this.sanitizeURL=p,this.removeEmptyString=_}var P={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){P[t]=new D(t,0,!1,t,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var i=t[0];P[i]=new D(i,1,!1,t[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){P[t]=new D(t,2,!1,t.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){P[t]=new D(t,2,!1,t,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){P[t]=new D(t,3,!1,t.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(t){P[t]=new D(t,3,!0,t,null,!1,!1)}),["capture","download"].forEach(function(t){P[t]=new D(t,4,!1,t,null,!1,!1)}),["cols","rows","size","span"].forEach(function(t){P[t]=new D(t,6,!1,t,null,!1,!1)}),["rowSpan","start"].forEach(function(t){P[t]=new D(t,5,!1,t.toLowerCase(),null,!1,!1)});var N=/[\-:]([a-z])/g;function O(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var i=t.replace(N,O);P[i]=new D(i,1,!1,t,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var i=t.replace(N,O);P[i]=new D(i,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(t){var i=t.replace(N,O);P[i]=new D(i,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(t){P[t]=new D(t,1,!1,t.toLowerCase(),null,!1,!1)}),P.xlinkHref=new D("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(t){P[t]=new D(t,1,!1,t.toLowerCase(),null,!0,!0)});function M(t,i,o,u){var f=P.hasOwnProperty(i)?P[i]:null;(f!==null?f.type!==0:u||!(2b||f[_]!==p[b]){var k=` -`+f[_].replace(" at new "," at ");return t.displayName&&k.includes("")&&(k=k.replace("",t.displayName)),k}while(1<=_&&0<=b);break}}}finally{q=!1,Error.prepareStackTrace=o}return(t=t?t.displayName||t.name:"")?F(t):""}function Ie(t){switch(t.tag){case 5:return F(t.type);case 16:return F("Lazy");case 13:return F("Suspense");case 19:return F("SuspenseList");case 0:case 2:case 15:return t=xe(t.type,!1),t;case 11:return t=xe(t.type.render,!1),t;case 1:return t=xe(t.type,!0),t;default:return""}}function Se(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case $:return"Fragment";case G:return"Portal";case he:return"Profiler";case K:return"StrictMode";case ie:return"Suspense";case ce:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Q:return(t.displayName||"Context")+".Consumer";case ue:return(t._context.displayName||"Context")+".Provider";case ve:var i=t.render;return t=t.displayName,t||(t=i.displayName||i.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case j:return i=t.displayName||null,i!==null?i:Se(t.type)||"Memo";case te:i=t._payload,t=t._init;try{return Se(t(i))}catch{}}return null}function Ee(t){var i=t.type;switch(t.tag){case 24:return"Cache";case 9:return(i.displayName||"Context")+".Consumer";case 10:return(i._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=i.render,t=t.displayName||t.name||"",i.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return i;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Se(i);case 8:return i===K?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i}return null}function We(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Fe(t){var i=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function Me(t){var i=Fe(t)?"checked":"value",o=Object.getOwnPropertyDescriptor(t.constructor.prototype,i),u=""+t[i];if(!t.hasOwnProperty(i)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var f=o.get,p=o.set;return Object.defineProperty(t,i,{configurable:!0,get:function(){return f.call(this)},set:function(_){u=""+_,p.call(this,_)}}),Object.defineProperty(t,i,{enumerable:o.enumerable}),{getValue:function(){return u},setValue:function(_){u=""+_},stopTracking:function(){t._valueTracker=null,delete t[i]}}}}function Zt(t){t._valueTracker||(t._valueTracker=Me(t))}function Wt(t){if(!t)return!1;var i=t._valueTracker;if(!i)return!0;var o=i.getValue(),u="";return t&&(u=Fe(t)?t.checked?"true":"false":t.value),t=u,t!==o?(i.setValue(t),!0):!1}function Ft(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Ht(t,i){var o=i.checked;return ne({},i,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:o??t._wrapperState.initialChecked})}function ii(t,i){var o=i.defaultValue==null?"":i.defaultValue,u=i.checked!=null?i.checked:i.defaultChecked;o=We(i.value!=null?i.value:o),t._wrapperState={initialChecked:u,initialValue:o,controlled:i.type==="checkbox"||i.type==="radio"?i.checked!=null:i.value!=null}}function Tn(t,i){i=i.checked,i!=null&&M(t,"checked",i,!1)}function zi(t,i){Tn(t,i);var o=We(i.value),u=i.type;if(o!=null)u==="number"?(o===0&&t.value===""||t.value!=o)&&(t.value=""+o):t.value!==""+o&&(t.value=""+o);else if(u==="submit"||u==="reset"){t.removeAttribute("value");return}i.hasOwnProperty("value")?Un(t,i.type,o):i.hasOwnProperty("defaultValue")&&Un(t,i.type,We(i.defaultValue)),i.checked==null&&i.defaultChecked!=null&&(t.defaultChecked=!!i.defaultChecked)}function ls(t,i,o){if(i.hasOwnProperty("value")||i.hasOwnProperty("defaultValue")){var u=i.type;if(!(u!=="submit"&&u!=="reset"||i.value!==void 0&&i.value!==null))return;i=""+t._wrapperState.initialValue,o||i===t.value||(t.value=i),t.defaultValue=i}o=t.name,o!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,o!==""&&(t.name=o)}function Un(t,i,o){(i!=="number"||Ft(t.ownerDocument)!==t)&&(o==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+o&&(t.defaultValue=""+o))}var nt=Array.isArray;function cn(t,i,o,u){if(t=t.options,i){i={};for(var f=0;f"+i.valueOf().toString()+"",i=hn.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;i.firstChild;)t.appendChild(i.firstChild)}});function Xt(t,i){if(i){var o=t.firstChild;if(o&&o===t.lastChild&&o.nodeType===3){o.nodeValue=i;return}}t.textContent=i}var zt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},fn=["Webkit","ms","Moz","O"];Object.keys(zt).forEach(function(t){fn.forEach(function(i){i=i+t.charAt(0).toUpperCase()+t.substring(1),zt[i]=zt[t]})});function xn(t,i,o){return i==null||typeof i=="boolean"||i===""?"":o||typeof i!="number"||i===0||zt.hasOwnProperty(t)&&zt[t]?(""+i).trim():i+"px"}function qt(t,i){t=t.style;for(var o in i)if(i.hasOwnProperty(o)){var u=o.indexOf("--")===0,f=xn(o,i[o],u);o==="float"&&(o="cssFloat"),u?t.setProperty(o,f):t[o]=f}}var En=ne({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function as(t,i){if(i){if(En[t]&&(i.children!=null||i.dangerouslySetInnerHTML!=null))throw Error(n(137,t));if(i.dangerouslySetInnerHTML!=null){if(i.children!=null)throw Error(n(60));if(typeof i.dangerouslySetInnerHTML!="object"||!("__html"in i.dangerouslySetInnerHTML))throw Error(n(61))}if(i.style!=null&&typeof i.style!="object")throw Error(n(62))}}function us(t,i){if(t.indexOf("-")===-1)return typeof i.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var mi=null;function gi(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var cs=null,Nt=null,ut=null;function en(t){if(t=vl(t)){if(typeof cs!="function")throw Error(n(280));var i=t.stateNode;i&&(i=Oa(i),cs(t.stateNode,t.type,i))}}function pn(t){Nt?ut?ut.push(t):ut=[t]:Nt=t}function vi(){if(Nt){var t=Nt,i=ut;if(ut=Nt=null,en(t),i)for(t=0;t>>=0,t===0?32:31-(tl(t)/Nn|0)|0}var Cr=64,js=4194304;function Bs(t){switch(t&-t){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: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&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function io(t,i){var o=t.pendingLanes;if(o===0)return 0;var u=0,f=t.suspendedLanes,p=t.pingedLanes,_=o&268435455;if(_!==0){var b=_&~f;b!==0?u=Bs(b):(p&=_,p!==0&&(u=Bs(p)))}else _=o&~f,_!==0?u=Bs(_):p!==0&&(u=Bs(p));if(u===0)return 0;if(i!==0&&i!==u&&(i&f)===0&&(f=u&-u,p=i&-i,f>=p||f===16&&(p&4194240)!==0))return i;if((u&4)!==0&&(u|=o&16),i=t.entangledLanes,i!==0)for(t=t.entanglements,i&=u;0o;o++)i.push(t);return i}function Us(t,i,o){t.pendingLanes|=i,i!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,i=31-Yn(i),t[i]=o}function sl(t,i){var o=t.pendingLanes&~i;t.pendingLanes=i,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=i,t.mutableReadLanes&=i,t.entangledLanes&=i,i=t.entanglements;var u=t.eventTimes;for(t=t.expirationTimes;0=Ps),xa=" ",po=!1;function g(t,i){switch(t){case"keyup":return Tt.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function y(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var C=!1;function x(t,i){switch(t){case"compositionend":return y(i);case"keypress":return i.which!==32?null:(po=!0,xa);case"textInput":return t=i.data,t===xa&&po?null:t;default:return null}}function T(t,i){if(C)return t==="compositionend"||!fo&&g(t,i)?(t=Si(),yi=al=_i=null,C=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1=i)return{node:o,offset:i-t};t=u}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=li(o)}}function Ln(t,i){return t&&i?t===i?!0:t&&t.nodeType===3?!1:i&&i.nodeType===3?Ln(t,i.parentNode):"contains"in t?t.contains(i):t.compareDocumentPosition?!!(t.compareDocumentPosition(i)&16):!1:!1}function Zn(){for(var t=window,i=Ft();i instanceof t.HTMLIFrameElement;){try{var o=typeof i.contentWindow.location.href=="string"}catch{o=!1}if(o)t=i.contentWindow;else break;i=Ft(t.document)}return i}function Xn(t){var i=t&&t.nodeName&&t.nodeName.toLowerCase();return i&&(i==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||i==="textarea"||t.contentEditable==="true")}function Ni(t){var i=Zn(),o=t.focusedElem,u=t.selectionRange;if(i!==o&&o&&o.ownerDocument&&Ln(o.ownerDocument.documentElement,o)){if(u!==null&&Xn(o)){if(i=u.start,t=u.end,t===void 0&&(t=i),"selectionStart"in o)o.selectionStart=i,o.selectionEnd=Math.min(t,o.value.length);else if(t=(i=o.ownerDocument||document)&&i.defaultView||window,t.getSelection){t=t.getSelection();var f=o.textContent.length,p=Math.min(u.start,f);u=u.end===void 0?p:Math.min(u.end,f),!t.extend&&p>u&&(f=u,u=p,p=f),f=Ci(o,p);var _=Ci(o,u);f&&_&&(t.rangeCount!==1||t.anchorNode!==f.node||t.anchorOffset!==f.offset||t.focusNode!==_.node||t.focusOffset!==_.offset)&&(i=i.createRange(),i.setStart(f.node,f.offset),t.removeAllRanges(),p>u?(t.addRange(i),t.extend(_.node,_.offset)):(i.setEnd(_.node,_.offset),t.addRange(i)))}}for(i=[],t=o;t=t.parentNode;)t.nodeType===1&&i.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o=document.documentMode,Yt=null,Ji=null,Vt=null,mo=!1;function af(t,i,o){var u=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;mo||Yt==null||Yt!==Ft(u)||(u=Yt,"selectionStart"in u&&Xn(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),Vt&&vn(Vt,u)||(Vt=u,u=Aa(Ji,"onSelect"),0yo||(t.current=zc[yo],zc[yo]=null,yo--)}function mt(t,i){yo++,zc[yo]=t.current,t.current=i}var rr={},Vn=sr(rr),ai=sr(!1),Rr=rr;function So(t,i){var o=t.type.contextTypes;if(!o)return rr;var u=t.stateNode;if(u&&u.__reactInternalMemoizedUnmaskedChildContext===i)return u.__reactInternalMemoizedMaskedChildContext;var f={},p;for(p in o)f[p]=i[p];return u&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=i,t.__reactInternalMemoizedMaskedChildContext=f),f}function ui(t){return t=t.childContextTypes,t!=null}function Ta(){vt(ai),vt(Vn)}function Cf(t,i,o){if(Vn.current!==rr)throw Error(n(168));mt(Vn,i),mt(ai,o)}function xf(t,i,o){var u=t.stateNode;if(i=i.childContextTypes,typeof u.getChildContext!="function")return o;u=u.getChildContext();for(var f in u)if(!(f in i))throw Error(n(108,Ee(t)||"Unknown",f));return ne({},o,u)}function Ia(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||rr,Rr=Vn.current,mt(Vn,t),mt(ai,ai.current),!0}function Ef(t,i,o){var u=t.stateNode;if(!u)throw Error(n(169));o?(t=xf(t,i,Rr),u.__reactInternalMemoizedMergedChildContext=t,vt(ai),vt(Vn),mt(Vn,t)):vt(ai),mt(ai,o)}var ks=null,Ra=!1,Oc=!1;function bf(t){ks===null?ks=[t]:ks.push(t)}function kw(t){Ra=!0,bf(t)}function or(){if(!Oc&&ks!==null){Oc=!0;var t=0,i=Ke;try{var o=ks;for(Ke=1;t>=_,f-=_,zs=1<<32-Yn(i)+f|o<Ge?(yn=Te,Te=null):yn=Te.sibling;var Xe=ee(L,Te,W[Ge],de);if(Xe===null){Te===null&&(Te=yn);break}t&&Te&&Xe.alternate===null&&i(L,Te),I=p(Xe,I,Ge),Oe===null?Ae=Xe:Oe.sibling=Xe,Oe=Xe,Te=yn}if(Ge===W.length)return o(L,Te),Ct&&Mr(L,Ge),Ae;if(Te===null){for(;GeGe?(yn=Te,Te=null):yn=Te.sibling;var mr=ee(L,Te,Xe.value,de);if(mr===null){Te===null&&(Te=yn);break}t&&Te&&mr.alternate===null&&i(L,Te),I=p(mr,I,Ge),Oe===null?Ae=mr:Oe.sibling=mr,Oe=mr,Te=yn}if(Xe.done)return o(L,Te),Ct&&Mr(L,Ge),Ae;if(Te===null){for(;!Xe.done;Ge++,Xe=W.next())Xe=oe(L,Xe.value,de),Xe!==null&&(I=p(Xe,I,Ge),Oe===null?Ae=Xe:Oe.sibling=Xe,Oe=Xe);return Ct&&Mr(L,Ge),Ae}for(Te=u(L,Te);!Xe.done;Ge++,Xe=W.next())Xe=ye(Te,L,Ge,Xe.value,de),Xe!==null&&(t&&Xe.alternate!==null&&Te.delete(Xe.key===null?Ge:Xe.key),I=p(Xe,I,Ge),Oe===null?Ae=Xe:Oe.sibling=Xe,Oe=Xe);return t&&Te.forEach(function(u0){return i(L,u0)}),Ct&&Mr(L,Ge),Ae}function Gt(L,I,W,de){if(typeof W=="object"&&W!==null&&W.type===$&&W.key===null&&(W=W.props.children),typeof W=="object"&&W!==null){switch(W.$$typeof){case Z:e:{for(var Ae=W.key,Oe=I;Oe!==null;){if(Oe.key===Ae){if(Ae=W.type,Ae===$){if(Oe.tag===7){o(L,Oe.sibling),I=f(Oe,W.props.children),I.return=L,L=I;break e}}else if(Oe.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===te&&Tf(Ae)===Oe.type){o(L,Oe.sibling),I=f(Oe,W.props),I.ref=wl(L,Oe,W),I.return=L,L=I;break e}o(L,Oe);break}else i(L,Oe);Oe=Oe.sibling}W.type===$?(I=Br(W.props.children,L.mode,de,W.key),I.return=L,L=I):(de=au(W.type,W.key,W.props,null,L.mode,de),de.ref=wl(L,I,W),de.return=L,L=de)}return _(L);case G:e:{for(Oe=W.key;I!==null;){if(I.key===Oe)if(I.tag===4&&I.stateNode.containerInfo===W.containerInfo&&I.stateNode.implementation===W.implementation){o(L,I.sibling),I=f(I,W.children||[]),I.return=L,L=I;break e}else{o(L,I);break}else i(L,I);I=I.sibling}I=Ad(W,L.mode,de),I.return=L,L=I}return _(L);case te:return Oe=W._init,Gt(L,I,Oe(W._payload),de)}if(nt(W))return Ce(L,I,W,de);if(fe(W))return be(L,I,W,de);Va(L,W)}return typeof W=="string"&&W!==""||typeof W=="number"?(W=""+W,I!==null&&I.tag===6?(o(L,I.sibling),I=f(I,W),I.return=L,L=I):(o(L,I),I=Pd(W,L.mode,de),I.return=L,L=I),_(L)):o(L,I)}return Gt}var Eo=If(!0),Rf=If(!1),Ga=sr(null),Wa=null,bo=null,Lc=null;function Vc(){Lc=bo=Wa=null}function Gc(t){var i=Ga.current;vt(Ga),t._currentValue=i}function Wc(t,i,o){for(;t!==null;){var u=t.alternate;if((t.childLanes&i)!==i?(t.childLanes|=i,u!==null&&(u.childLanes|=i)):u!==null&&(u.childLanes&i)!==i&&(u.childLanes|=i),t===o)break;t=t.return}}function Po(t,i){Wa=t,Lc=bo=null,t=t.dependencies,t!==null&&t.firstContext!==null&&((t.lanes&i)!==0&&(ci=!0),t.firstContext=null)}function Vi(t){var i=t._currentValue;if(Lc!==t)if(t={context:t,memoizedValue:i,next:null},bo===null){if(Wa===null)throw Error(n(308));bo=t,Wa.dependencies={lanes:0,firstContext:t}}else bo=bo.next=t;return i}var Lr=null;function Fc(t){Lr===null?Lr=[t]:Lr.push(t)}function Nf(t,i,o,u){var f=i.interleaved;return f===null?(o.next=o,Fc(i)):(o.next=f.next,f.next=o),i.interleaved=o,Ts(t,u)}function Ts(t,i){t.lanes|=i;var o=t.alternate;for(o!==null&&(o.lanes|=i),o=t,t=t.return;t!==null;)t.childLanes|=i,o=t.alternate,o!==null&&(o.childLanes|=i),o=t,t=t.return;return o.tag===3?o.stateNode:null}var lr=!1;function Hc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Mf(t,i){t=t.updateQueue,i.updateQueue===t&&(i.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Is(t,i){return{eventTime:t,lane:i,tag:0,payload:null,callback:null,next:null}}function ar(t,i,o){var u=t.updateQueue;if(u===null)return null;if(u=u.shared,(Qe&2)!==0){var f=u.pending;return f===null?i.next=i:(i.next=f.next,f.next=i),u.pending=i,Ts(t,o)}return f=u.interleaved,f===null?(i.next=i,Fc(u)):(i.next=f.next,f.next=i),u.interleaved=i,Ts(t,o)}function Fa(t,i,o){if(i=i.updateQueue,i!==null&&(i=i.shared,(o&4194240)!==0)){var u=i.lanes;u&=t.pendingLanes,o|=u,i.lanes=o,$s(t,o)}}function Lf(t,i){var o=t.updateQueue,u=t.alternate;if(u!==null&&(u=u.updateQueue,o===u)){var f=null,p=null;if(o=o.firstBaseUpdate,o!==null){do{var _={eventTime:o.eventTime,lane:o.lane,tag:o.tag,payload:o.payload,callback:o.callback,next:null};p===null?f=p=_:p=p.next=_,o=o.next}while(o!==null);p===null?f=p=i:p=p.next=i}else f=p=i;o={baseState:u.baseState,firstBaseUpdate:f,lastBaseUpdate:p,shared:u.shared,effects:u.effects},t.updateQueue=o;return}t=o.lastBaseUpdate,t===null?o.firstBaseUpdate=i:t.next=i,o.lastBaseUpdate=i}function Ha(t,i,o,u){var f=t.updateQueue;lr=!1;var p=f.firstBaseUpdate,_=f.lastBaseUpdate,b=f.shared.pending;if(b!==null){f.shared.pending=null;var k=b,H=k.next;k.next=null,_===null?p=H:_.next=H,_=k;var re=t.alternate;re!==null&&(re=re.updateQueue,b=re.lastBaseUpdate,b!==_&&(b===null?re.firstBaseUpdate=H:b.next=H,re.lastBaseUpdate=k))}if(p!==null){var oe=f.baseState;_=0,re=H=k=null,b=p;do{var ee=b.lane,ye=b.eventTime;if((u&ee)===ee){re!==null&&(re=re.next={eventTime:ye,lane:0,tag:b.tag,payload:b.payload,callback:b.callback,next:null});e:{var Ce=t,be=b;switch(ee=i,ye=o,be.tag){case 1:if(Ce=be.payload,typeof Ce=="function"){oe=Ce.call(ye,oe,ee);break e}oe=Ce;break e;case 3:Ce.flags=Ce.flags&-65537|128;case 0:if(Ce=be.payload,ee=typeof Ce=="function"?Ce.call(ye,oe,ee):Ce,ee==null)break e;oe=ne({},oe,ee);break e;case 2:lr=!0}}b.callback!==null&&b.lane!==0&&(t.flags|=64,ee=f.effects,ee===null?f.effects=[b]:ee.push(b))}else ye={eventTime:ye,lane:ee,tag:b.tag,payload:b.payload,callback:b.callback,next:null},re===null?(H=re=ye,k=oe):re=re.next=ye,_|=ee;if(b=b.next,b===null){if(b=f.shared.pending,b===null)break;ee=b,b=ee.next,ee.next=null,f.lastBaseUpdate=ee,f.shared.pending=null}}while(!0);if(re===null&&(k=oe),f.baseState=k,f.firstBaseUpdate=H,f.lastBaseUpdate=re,i=f.shared.interleaved,i!==null){f=i;do _|=f.lane,f=f.next;while(f!==i)}else p===null&&(f.shared.lanes=0);Wr|=_,t.lanes=_,t.memoizedState=oe}}function Vf(t,i,o){if(t=i.effects,i.effects=null,t!==null)for(i=0;io?o:4,t(!0);var u=Yc.transition;Yc.transition={};try{t(!1),i()}finally{Ke=o,Yc.transition=u}}function ip(){return Gi().memoizedState}function Iw(t,i,o){var u=hr(t);if(o={lane:u,action:o,hasEagerState:!1,eagerState:null,next:null},sp(t))rp(i,o);else if(o=Nf(t,i,o,u),o!==null){var f=ei();es(o,t,u,f),op(o,i,u)}}function Rw(t,i,o){var u=hr(t),f={lane:u,action:o,hasEagerState:!1,eagerState:null,next:null};if(sp(t))rp(i,f);else{var p=t.alternate;if(t.lanes===0&&(p===null||p.lanes===0)&&(p=i.lastRenderedReducer,p!==null))try{var _=i.lastRenderedState,b=p(_,o);if(f.hasEagerState=!0,f.eagerState=b,dt(b,_)){var k=i.interleaved;k===null?(f.next=f,Fc(i)):(f.next=k.next,k.next=f),i.interleaved=f;return}}catch{}finally{}o=Nf(t,i,f,u),o!==null&&(f=ei(),es(o,t,u,f),op(o,i,u))}}function sp(t){var i=t.alternate;return t===At||i!==null&&i===At}function rp(t,i){Dl=Ua=!0;var o=t.pending;o===null?i.next=i:(i.next=o.next,o.next=i),t.pending=i}function op(t,i,o){if((o&4194240)!==0){var u=i.lanes;u&=t.pendingLanes,o|=u,i.lanes=o,$s(t,o)}}var Ka={readContext:Vi,useCallback:Gn,useContext:Gn,useEffect:Gn,useImperativeHandle:Gn,useInsertionEffect:Gn,useLayoutEffect:Gn,useMemo:Gn,useReducer:Gn,useRef:Gn,useState:Gn,useDebugValue:Gn,useDeferredValue:Gn,useTransition:Gn,useMutableSource:Gn,useSyncExternalStore:Gn,useId:Gn,unstable_isNewReconciler:!1},Nw={readContext:Vi,useCallback:function(t,i){return gs().memoizedState=[t,i===void 0?null:i],t},useContext:Vi,useEffect:Jf,useImperativeHandle:function(t,i,o){return o=o!=null?o.concat([t]):null,$a(4194308,4,Xf.bind(null,i,t),o)},useLayoutEffect:function(t,i){return $a(4194308,4,t,i)},useInsertionEffect:function(t,i){return $a(4,2,t,i)},useMemo:function(t,i){var o=gs();return i=i===void 0?null:i,t=t(),o.memoizedState=[t,i],t},useReducer:function(t,i,o){var u=gs();return i=o!==void 0?o(i):i,u.memoizedState=u.baseState=i,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:i},u.queue=t,t=t.dispatch=Iw.bind(null,At,t),[u.memoizedState,t]},useRef:function(t){var i=gs();return t={current:t},i.memoizedState=t},useState:Yf,useDebugValue:ed,useDeferredValue:function(t){return gs().memoizedState=t},useTransition:function(){var t=Yf(!1),i=t[0];return t=Tw.bind(null,t[1]),gs().memoizedState=t,[i,t]},useMutableSource:function(){},useSyncExternalStore:function(t,i,o){var u=At,f=gs();if(Ct){if(o===void 0)throw Error(n(407));o=o()}else{if(o=i(),_n===null)throw Error(n(349));(Gr&30)!==0||Hf(u,i,o)}f.memoizedState=o;var p={value:o,getSnapshot:i};return f.queue=p,Jf(Bf.bind(null,u,p,t),[t]),u.flags|=2048,El(9,jf.bind(null,u,p,o,i),void 0,null),o},useId:function(){var t=gs(),i=_n.identifierPrefix;if(Ct){var o=Os,u=zs;o=(u&~(1<<32-Yn(u)-1)).toString(32)+o,i=":"+i+"R"+o,o=Cl++,0<\/script>",t=t.removeChild(t.firstChild)):typeof u.is=="string"?t=_.createElement(o,{is:u.is}):(t=_.createElement(o),o==="select"&&(_=t,u.multiple?_.multiple=!0:u.size&&(_.size=u.size))):t=_.createElementNS(t,o),t[ps]=i,t[gl]=u,bp(t,i,!1,!1),i.stateNode=t;e:{switch(_=us(o,u),o){case"dialog":gt("cancel",t),gt("close",t),f=u;break;case"iframe":case"object":case"embed":gt("load",t),f=u;break;case"video":case"audio":for(f=0;fTo&&(i.flags|=128,u=!0,bl(p,!1),i.lanes=4194304)}else{if(!u)if(t=ja(_),t!==null){if(i.flags|=128,u=!0,o=t.updateQueue,o!==null&&(i.updateQueue=o,i.flags|=4),bl(p,!0),p.tail===null&&p.tailMode==="hidden"&&!_.alternate&&!Ct)return Wn(i),null}else 2*ct()-p.renderingStartTime>To&&o!==1073741824&&(i.flags|=128,u=!0,bl(p,!1),i.lanes=4194304);p.isBackwards?(_.sibling=i.child,i.child=_):(o=p.last,o!==null?o.sibling=_:i.child=_,p.last=_)}return p.tail!==null?(i=p.tail,p.rendering=i,p.tail=i.sibling,p.renderingStartTime=ct(),i.sibling=null,o=Pt.current,mt(Pt,u?o&1|2:o&1),i):(Wn(i),null);case 22:case 23:return xd(),u=i.memoizedState!==null,t!==null&&t.memoizedState!==null!==u&&(i.flags|=8192),u&&(i.mode&1)!==0?(bi&1073741824)!==0&&(Wn(i),i.subtreeFlags&6&&(i.flags|=8192)):Wn(i),null;case 24:return null;case 25:return null}throw Error(n(156,i.tag))}function jw(t,i){switch(Ic(i),i.tag){case 1:return ui(i.type)&&Ta(),t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 3:return Ao(),vt(ai),vt(Vn),$c(),t=i.flags,(t&65536)!==0&&(t&128)===0?(i.flags=t&-65537|128,i):null;case 5:return Bc(i),null;case 13:if(vt(Pt),t=i.memoizedState,t!==null&&t.dehydrated!==null){if(i.alternate===null)throw Error(n(340));xo()}return t=i.flags,t&65536?(i.flags=t&-65537|128,i):null;case 19:return vt(Pt),null;case 4:return Ao(),null;case 10:return Gc(i.type._context),null;case 22:case 23:return xd(),null;case 24:return null;default:return null}}var Xa=!1,Fn=!1,Bw=typeof WeakSet=="function"?WeakSet:Set,De=null;function zo(t,i){var o=t.ref;if(o!==null)if(typeof o=="function")try{o(null)}catch(u){It(t,i,u)}else o.current=null}function hd(t,i,o){try{o()}catch(u){It(t,i,u)}}var kp=!1;function Uw(t,i){if(xc=ot,t=Zn(),Xn(t)){if("selectionStart"in t)var o={start:t.selectionStart,end:t.selectionEnd};else e:{o=(o=t.ownerDocument)&&o.defaultView||window;var u=o.getSelection&&o.getSelection();if(u&&u.rangeCount!==0){o=u.anchorNode;var f=u.anchorOffset,p=u.focusNode;u=u.focusOffset;try{o.nodeType,p.nodeType}catch{o=null;break e}var _=0,b=-1,k=-1,H=0,re=0,oe=t,ee=null;t:for(;;){for(var ye;oe!==o||f!==0&&oe.nodeType!==3||(b=_+f),oe!==p||u!==0&&oe.nodeType!==3||(k=_+u),oe.nodeType===3&&(_+=oe.nodeValue.length),(ye=oe.firstChild)!==null;)ee=oe,oe=ye;for(;;){if(oe===t)break t;if(ee===o&&++H===f&&(b=_),ee===p&&++re===u&&(k=_),(ye=oe.nextSibling)!==null)break;oe=ee,ee=oe.parentNode}oe=ye}o=b===-1||k===-1?null:{start:b,end:k}}else o=null}o=o||{start:0,end:0}}else o=null;for(Ec={focusedElem:t,selectionRange:o},ot=!1,De=i;De!==null;)if(i=De,t=i.child,(i.subtreeFlags&1028)!==0&&t!==null)t.return=i,De=t;else for(;De!==null;){i=De;try{var Ce=i.alternate;if((i.flags&1024)!==0)switch(i.tag){case 0:case 11:case 15:break;case 1:if(Ce!==null){var be=Ce.memoizedProps,Gt=Ce.memoizedState,L=i.stateNode,I=L.getSnapshotBeforeUpdate(i.elementType===i.type?be:Zi(i.type,be),Gt);L.__reactInternalSnapshotBeforeUpdate=I}break;case 3:var W=i.stateNode.containerInfo;W.nodeType===1?W.textContent="":W.nodeType===9&&W.documentElement&&W.removeChild(W.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(de){It(i,i.return,de)}if(t=i.sibling,t!==null){t.return=i.return,De=t;break}De=i.return}return Ce=kp,kp=!1,Ce}function Pl(t,i,o){var u=i.updateQueue;if(u=u!==null?u.lastEffect:null,u!==null){var f=u=u.next;do{if((f.tag&t)===t){var p=f.destroy;f.destroy=void 0,p!==void 0&&hd(i,o,p)}f=f.next}while(f!==u)}}function qa(t,i){if(i=i.updateQueue,i=i!==null?i.lastEffect:null,i!==null){var o=i=i.next;do{if((o.tag&t)===t){var u=o.create;o.destroy=u()}o=o.next}while(o!==i)}}function fd(t){var i=t.ref;if(i!==null){var o=t.stateNode;switch(t.tag){case 5:t=o;break;default:t=o}typeof i=="function"?i(t):i.current=t}}function zp(t){var i=t.alternate;i!==null&&(t.alternate=null,zp(i)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(i=t.stateNode,i!==null&&(delete i[ps],delete i[gl],delete i[kc],delete i[Pw],delete i[Aw])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Op(t){return t.tag===5||t.tag===3||t.tag===4}function Tp(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Op(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function pd(t,i,o){var u=t.tag;if(u===5||u===6)t=t.stateNode,i?o.nodeType===8?o.parentNode.insertBefore(t,i):o.insertBefore(t,i):(o.nodeType===8?(i=o.parentNode,i.insertBefore(t,o)):(i=o,i.appendChild(t)),o=o._reactRootContainer,o!=null||i.onclick!==null||(i.onclick=za));else if(u!==4&&(t=t.child,t!==null))for(pd(t,i,o),t=t.sibling;t!==null;)pd(t,i,o),t=t.sibling}function md(t,i,o){var u=t.tag;if(u===5||u===6)t=t.stateNode,i?o.insertBefore(t,i):o.appendChild(t);else if(u!==4&&(t=t.child,t!==null))for(md(t,i,o),t=t.sibling;t!==null;)md(t,i,o),t=t.sibling}var zn=null,Xi=!1;function ur(t,i,o){for(o=o.child;o!==null;)Ip(t,i,o),o=o.sibling}function Ip(t,i,o){if(si&&typeof si.onCommitFiberUnmount=="function")try{si.onCommitFiberUnmount(Hs,o)}catch{}switch(o.tag){case 5:Fn||zo(o,i);case 6:var u=zn,f=Xi;zn=null,ur(t,i,o),zn=u,Xi=f,zn!==null&&(Xi?(t=zn,o=o.stateNode,t.nodeType===8?t.parentNode.removeChild(o):t.removeChild(o)):zn.removeChild(o.stateNode));break;case 18:zn!==null&&(Xi?(t=zn,o=o.stateNode,t.nodeType===8?Ac(t.parentNode,o):t.nodeType===1&&Ac(t,o),qs(t)):Ac(zn,o.stateNode));break;case 4:u=zn,f=Xi,zn=o.stateNode.containerInfo,Xi=!0,ur(t,i,o),zn=u,Xi=f;break;case 0:case 11:case 14:case 15:if(!Fn&&(u=o.updateQueue,u!==null&&(u=u.lastEffect,u!==null))){f=u=u.next;do{var p=f,_=p.destroy;p=p.tag,_!==void 0&&((p&2)!==0||(p&4)!==0)&&hd(o,i,_),f=f.next}while(f!==u)}ur(t,i,o);break;case 1:if(!Fn&&(zo(o,i),u=o.stateNode,typeof u.componentWillUnmount=="function"))try{u.props=o.memoizedProps,u.state=o.memoizedState,u.componentWillUnmount()}catch(b){It(o,i,b)}ur(t,i,o);break;case 21:ur(t,i,o);break;case 22:o.mode&1?(Fn=(u=Fn)||o.memoizedState!==null,ur(t,i,o),Fn=u):ur(t,i,o);break;default:ur(t,i,o)}}function Rp(t){var i=t.updateQueue;if(i!==null){t.updateQueue=null;var o=t.stateNode;o===null&&(o=t.stateNode=new Bw),i.forEach(function(u){var f=e0.bind(null,t,u);o.has(u)||(o.add(u),u.then(f,f))})}}function qi(t,i){var o=i.deletions;if(o!==null)for(var u=0;uf&&(f=_),u&=~p}if(u=f,u=ct()-u,u=(120>u?120:480>u?480:1080>u?1080:1920>u?1920:3e3>u?3e3:4320>u?4320:1960*Yw(u/1960))-u,10t?16:t,dr===null)var u=!1;else{if(t=dr,dr=null,su=0,(Qe&6)!==0)throw Error(n(331));var f=Qe;for(Qe|=4,De=t.current;De!==null;){var p=De,_=p.child;if((De.flags&16)!==0){var b=p.deletions;if(b!==null){for(var k=0;kct()-wd?Hr(t,0):vd|=o),hi(t,i)}function Yp(t,i){i===0&&((t.mode&1)===0?i=1:(i=js,js<<=1,(js&130023424)===0&&(js=4194304)));var o=ei();t=Ts(t,i),t!==null&&(Us(t,i,o),hi(t,o))}function qw(t){var i=t.memoizedState,o=0;i!==null&&(o=i.retryLane),Yp(t,o)}function e0(t,i){var o=0;switch(t.tag){case 13:var u=t.stateNode,f=t.memoizedState;f!==null&&(o=f.retryLane);break;case 19:u=t.stateNode;break;default:throw Error(n(314))}u!==null&&u.delete(i),Yp(t,o)}var Kp;Kp=function(t,i,o){if(t!==null)if(t.memoizedProps!==i.pendingProps||ai.current)ci=!0;else{if((t.lanes&o)===0&&(i.flags&128)===0)return ci=!1,Fw(t,i,o);ci=(t.flags&131072)!==0}else ci=!1,Ct&&(i.flags&1048576)!==0&&Pf(i,Ma,i.index);switch(i.lanes=0,i.tag){case 2:var u=i.type;Za(t,i),t=i.pendingProps;var f=So(i,Vn.current);Po(i,o),f=Jc(null,i,u,t,f,o);var p=Qc();return i.flags|=1,typeof f=="object"&&f!==null&&typeof f.render=="function"&&f.$$typeof===void 0?(i.tag=1,i.memoizedState=null,i.updateQueue=null,ui(u)?(p=!0,Ia(i)):p=!1,i.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,Hc(i),f.updater=Ja,i.stateNode=f,f._reactInternals=i,nd(i,u,t,o),i=od(null,i,u,!0,p,o)):(i.tag=0,Ct&&p&&Tc(i),qn(null,i,f,o),i=i.child),i;case 16:u=i.elementType;e:{switch(Za(t,i),t=i.pendingProps,f=u._init,u=f(u._payload),i.type=u,f=i.tag=n0(u),t=Zi(u,t),f){case 0:i=rd(null,i,u,t,o);break e;case 1:i=yp(null,i,u,t,o);break e;case 11:i=mp(null,i,u,t,o);break e;case 14:i=gp(null,i,u,Zi(u.type,t),o);break e}throw Error(n(306,u,""))}return i;case 0:return u=i.type,f=i.pendingProps,f=i.elementType===u?f:Zi(u,f),rd(t,i,u,f,o);case 1:return u=i.type,f=i.pendingProps,f=i.elementType===u?f:Zi(u,f),yp(t,i,u,f,o);case 3:e:{if(Sp(i),t===null)throw Error(n(387));u=i.pendingProps,p=i.memoizedState,f=p.element,Mf(t,i),Ha(i,u,null,o);var _=i.memoizedState;if(u=_.element,p.isDehydrated)if(p={element:u,isDehydrated:!1,cache:_.cache,pendingSuspenseBoundaries:_.pendingSuspenseBoundaries,transitions:_.transitions},i.updateQueue.baseState=p,i.memoizedState=p,i.flags&256){f=ko(Error(n(423)),i),i=Dp(t,i,u,o,f);break e}else if(u!==f){f=ko(Error(n(424)),i),i=Dp(t,i,u,o,f);break e}else for(Ei=ir(i.stateNode.containerInfo.firstChild),xi=i,Ct=!0,Qi=null,o=Rf(i,null,u,o),i.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(xo(),u===f){i=Rs(t,i,o);break e}qn(t,i,u,o)}i=i.child}return i;case 5:return Gf(i),t===null&&Nc(i),u=i.type,f=i.pendingProps,p=t!==null?t.memoizedProps:null,_=f.children,bc(u,f)?_=null:p!==null&&bc(u,p)&&(i.flags|=32),_p(t,i),qn(t,i,_,o),i.child;case 6:return t===null&&Nc(i),null;case 13:return Cp(t,i,o);case 4:return jc(i,i.stateNode.containerInfo),u=i.pendingProps,t===null?i.child=Eo(i,null,u,o):qn(t,i,u,o),i.child;case 11:return u=i.type,f=i.pendingProps,f=i.elementType===u?f:Zi(u,f),mp(t,i,u,f,o);case 7:return qn(t,i,i.pendingProps,o),i.child;case 8:return qn(t,i,i.pendingProps.children,o),i.child;case 12:return qn(t,i,i.pendingProps.children,o),i.child;case 10:e:{if(u=i.type._context,f=i.pendingProps,p=i.memoizedProps,_=f.value,mt(Ga,u._currentValue),u._currentValue=_,p!==null)if(dt(p.value,_)){if(p.children===f.children&&!ai.current){i=Rs(t,i,o);break e}}else for(p=i.child,p!==null&&(p.return=i);p!==null;){var b=p.dependencies;if(b!==null){_=p.child;for(var k=b.firstContext;k!==null;){if(k.context===u){if(p.tag===1){k=Is(-1,o&-o),k.tag=2;var H=p.updateQueue;if(H!==null){H=H.shared;var re=H.pending;re===null?k.next=k:(k.next=re.next,re.next=k),H.pending=k}}p.lanes|=o,k=p.alternate,k!==null&&(k.lanes|=o),Wc(p.return,o,i),b.lanes|=o;break}k=k.next}}else if(p.tag===10)_=p.type===i.type?null:p.child;else if(p.tag===18){if(_=p.return,_===null)throw Error(n(341));_.lanes|=o,b=_.alternate,b!==null&&(b.lanes|=o),Wc(_,o,i),_=p.sibling}else _=p.child;if(_!==null)_.return=p;else for(_=p;_!==null;){if(_===i){_=null;break}if(p=_.sibling,p!==null){p.return=_.return,_=p;break}_=_.return}p=_}qn(t,i,f.children,o),i=i.child}return i;case 9:return f=i.type,u=i.pendingProps.children,Po(i,o),f=Vi(f),u=u(f),i.flags|=1,qn(t,i,u,o),i.child;case 14:return u=i.type,f=Zi(u,i.pendingProps),f=Zi(u.type,f),gp(t,i,u,f,o);case 15:return vp(t,i,i.type,i.pendingProps,o);case 17:return u=i.type,f=i.pendingProps,f=i.elementType===u?f:Zi(u,f),Za(t,i),i.tag=1,ui(u)?(t=!0,Ia(i)):t=!1,Po(i,o),ap(i,u,f),nd(i,u,f,o),od(null,i,u,!0,t,o);case 19:return Ep(t,i,o);case 22:return wp(t,i,o)}throw Error(n(156,i.tag))};function Jp(t,i){return Mt(t,i)}function t0(t,i,o,u){this.tag=t,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Fi(t,i,o,u){return new t0(t,i,o,u)}function bd(t){return t=t.prototype,!(!t||!t.isReactComponent)}function n0(t){if(typeof t=="function")return bd(t)?1:0;if(t!=null){if(t=t.$$typeof,t===ve)return 11;if(t===j)return 14}return 2}function pr(t,i){var o=t.alternate;return o===null?(o=Fi(t.tag,i,t.key,t.mode),o.elementType=t.elementType,o.type=t.type,o.stateNode=t.stateNode,o.alternate=t,t.alternate=o):(o.pendingProps=i,o.type=t.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=t.flags&14680064,o.childLanes=t.childLanes,o.lanes=t.lanes,o.child=t.child,o.memoizedProps=t.memoizedProps,o.memoizedState=t.memoizedState,o.updateQueue=t.updateQueue,i=t.dependencies,o.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},o.sibling=t.sibling,o.index=t.index,o.ref=t.ref,o}function au(t,i,o,u,f,p){var _=2;if(u=t,typeof t=="function")bd(t)&&(_=1);else if(typeof t=="string")_=5;else e:switch(t){case $:return Br(o.children,f,p,i);case K:_=8,f|=8;break;case he:return t=Fi(12,o,i,f|2),t.elementType=he,t.lanes=p,t;case ie:return t=Fi(13,o,i,f),t.elementType=ie,t.lanes=p,t;case ce:return t=Fi(19,o,i,f),t.elementType=ce,t.lanes=p,t;case X:return uu(o,f,p,i);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case ue:_=10;break e;case Q:_=9;break e;case ve:_=11;break e;case j:_=14;break e;case te:_=16,u=null;break e}throw Error(n(130,t==null?t:typeof t,""))}return i=Fi(_,o,i,f),i.elementType=t,i.type=u,i.lanes=p,i}function Br(t,i,o,u){return t=Fi(7,t,u,i),t.lanes=o,t}function uu(t,i,o,u){return t=Fi(22,t,u,i),t.elementType=X,t.lanes=o,t.stateNode={isHidden:!1},t}function Pd(t,i,o){return t=Fi(6,t,null,i),t.lanes=o,t}function Ad(t,i,o){return i=Fi(4,t.children!==null?t.children:[],t.key,i),i.lanes=o,i.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},i}function i0(t,i,o,u,f){this.tag=i,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=il(0),this.expirationTimes=il(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=il(0),this.identifierPrefix=u,this.onRecoverableError=f,this.mutableSourceEagerHydrationData=null}function kd(t,i,o,u,f,p,_,b,k){return t=new i0(t,i,o,b,k),i===1?(i=1,p===!0&&(i|=8)):i=0,p=Fi(3,null,null,i),t.current=p,p.stateNode=t,p.memoizedState={element:u,isDehydrated:o,cache:null,transitions:null,pendingSuspenseBoundaries:null},Hc(p),t}function s0(t,i,o){var u=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(e){console.error(e)}}return r(),Nd.exports=v0(),Nd.exports}var um;function w0(){if(um)return gu;um=1;var r=Gg();return gu.createRoot=r.createRoot,gu.hydrateRoot=r.hydrateRoot,gu}var _0=w0();const y0=Ah(_0);var Kr=Gg();const S0=Ah(Kr),Ku=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ko(r){const e=Object.prototype.toString.call(r);return e==="[object Window]"||e==="[object global]"}function zh(r){return"nodeType"in r}function ni(r){var e,n;return r?Ko(r)?r:zh(r)&&(e=(n=r.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function Oh(r){const{Document:e}=ni(r);return r instanceof e}function ta(r){return Ko(r)?!1:r instanceof ni(r).HTMLElement}function Wg(r){return r instanceof ni(r).SVGElement}function Jo(r){return r?Ko(r)?r.document:zh(r)?Oh(r)?r:ta(r)||Wg(r)?r.ownerDocument:document:document:document}const Gs=Ku?B.useLayoutEffect:B.useEffect;function Ju(r){const e=B.useRef(r);return Gs(()=>{e.current=r}),B.useCallback(function(){for(var n=arguments.length,s=new Array(n),l=0;l{r.current=setInterval(s,l)},[]),n=B.useCallback(()=>{r.current!==null&&(clearInterval(r.current),r.current=null)},[]);return[e,n]}function Kl(r,e){e===void 0&&(e=[r]);const n=B.useRef(r);return Gs(()=>{n.current!==r&&(n.current=r)},e),n}function na(r,e){const n=B.useRef();return B.useMemo(()=>{const s=r(n.current);return n.current=s,s},[...e])}function Ru(r){const e=Ju(r),n=B.useRef(null),s=B.useCallback(l=>{l!==n.current&&(e==null||e(l,n.current)),n.current=l},[]);return[n,s]}function Nu(r){const e=B.useRef();return B.useEffect(()=>{e.current=r},[r]),e.current}let Vd={};function Qu(r,e){return B.useMemo(()=>{if(e)return e;const n=Vd[r]==null?0:Vd[r]+1;return Vd[r]=n,r+"-"+n},[r,e])}function Fg(r){return function(e){for(var n=arguments.length,s=new Array(n>1?n-1:0),l=1;l{const d=Object.entries(c);for(const[h,m]of d){const w=a[h];w!=null&&(a[h]=w+r*m)}return a},{...e})}}const Wo=Fg(1),Mu=Fg(-1);function C0(r){return"clientX"in r&&"clientY"in r}function Th(r){if(!r)return!1;const{KeyboardEvent:e}=ni(r.target);return e&&r instanceof e}function x0(r){if(!r)return!1;const{TouchEvent:e}=ni(r.target);return e&&r instanceof e}function Lu(r){if(x0(r)){if(r.touches&&r.touches.length){const{clientX:e,clientY:n}=r.touches[0];return{x:e,y:n}}else if(r.changedTouches&&r.changedTouches.length){const{clientX:e,clientY:n}=r.changedTouches[0];return{x:e,y:n}}}return C0(r)?{x:r.clientX,y:r.clientY}:null}const Jl=Object.freeze({Translate:{toString(r){if(!r)return;const{x:e,y:n}=r;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(r){if(!r)return;const{scaleX:e,scaleY:n}=r;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(r){if(r)return[Jl.Translate.toString(r),Jl.Scale.toString(r)].join(" ")}},Transition:{toString(r){let{property:e,duration:n,easing:s}=r;return e+" "+n+"ms "+s}}}),cm="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function E0(r){return r.matches(cm)?r:r.querySelector(cm)}const b0={display:"none"};function P0(r){let{id:e,value:n}=r;return pe.createElement("div",{id:e,style:b0},n)}function A0(r){let{id:e,announcement:n,ariaLiveType:s="assertive"}=r;const l={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return pe.createElement("div",{id:e,style:l,role:"status","aria-live":s,"aria-atomic":!0},n)}function k0(){const[r,e]=B.useState("");return{announce:B.useCallback(s=>{s!=null&&e(s)},[]),announcement:r}}const Hg=B.createContext(null);function z0(r){const e=B.useContext(Hg);B.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of ");return e(r)},[r,e])}function O0(){const[r]=B.useState(()=>new Set),e=B.useCallback(s=>(r.add(s),()=>r.delete(s)),[r]);return[B.useCallback(s=>{let{type:l,event:a}=s;r.forEach(c=>{var d;return(d=c[l])==null?void 0:d.call(c,a)})},[r]),e]}const T0={draggable:` - To pick up a draggable item, press the space bar. - While dragging, use the arrow keys to move the item. - Press space again to drop the item in its new position, or press escape to cancel. - `},I0={onDragStart(r){let{active:e}=r;return"Picked up draggable item "+e.id+"."},onDragOver(r){let{active:e,over:n}=r;return n?"Draggable item "+e.id+" was moved over droppable area "+n.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(r){let{active:e,over:n}=r;return n?"Draggable item "+e.id+" was dropped over droppable area "+n.id:"Draggable item "+e.id+" was dropped."},onDragCancel(r){let{active:e}=r;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function R0(r){let{announcements:e=I0,container:n,hiddenTextDescribedById:s,screenReaderInstructions:l=T0}=r;const{announce:a,announcement:c}=k0(),d=Qu("DndLiveRegion"),[h,m]=B.useState(!1);if(B.useEffect(()=>{m(!0)},[]),z0(B.useMemo(()=>({onDragStart(v){let{active:S}=v;a(e.onDragStart({active:S}))},onDragMove(v){let{active:S,over:E}=v;e.onDragMove&&a(e.onDragMove({active:S,over:E}))},onDragOver(v){let{active:S,over:E}=v;a(e.onDragOver({active:S,over:E}))},onDragEnd(v){let{active:S,over:E}=v;a(e.onDragEnd({active:S,over:E}))},onDragCancel(v){let{active:S,over:E}=v;a(e.onDragCancel({active:S,over:E}))}}),[a,e])),!h)return null;const w=pe.createElement(pe.Fragment,null,pe.createElement(P0,{id:s,value:l.draggable}),pe.createElement(A0,{id:d,announcement:c}));return n?Kr.createPortal(w,n):w}var an;(function(r){r.DragStart="dragStart",r.DragMove="dragMove",r.DragEnd="dragEnd",r.DragCancel="dragCancel",r.DragOver="dragOver",r.RegisterDroppable="registerDroppable",r.SetDroppableDisabled="setDroppableDisabled",r.UnregisterDroppable="unregisterDroppable"})(an||(an={}));function Vu(){}function N0(r,e){return B.useMemo(()=>({sensor:r,options:e??{}}),[r,e])}function M0(){for(var r=arguments.length,e=new Array(r),n=0;n[...e].filter(s=>s!=null),[...e])}const os=Object.freeze({x:0,y:0});function L0(r,e){const n=Lu(r);if(!n)return"0 0";const s={x:(n.x-e.left)/e.width*100,y:(n.y-e.top)/e.height*100};return s.x+"% "+s.y+"%"}function V0(r,e){let{data:{value:n}}=r,{data:{value:s}}=e;return s-n}function G0(r,e){if(!r||r.length===0)return null;const[n]=r;return n[e]}function W0(r,e){const n=Math.max(e.top,r.top),s=Math.max(e.left,r.left),l=Math.min(e.left+e.width,r.left+r.width),a=Math.min(e.top+e.height,r.top+r.height),c=l-s,d=a-n;if(s{let{collisionRect:e,droppableRects:n,droppableContainers:s}=r;const l=[];for(const a of s){const{id:c}=a,d=n.get(c);if(d){const h=W0(d,e);h>0&&l.push({id:c,data:{droppableContainer:a,value:h}})}}return l.sort(V0)};function H0(r,e,n){return{...r,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function jg(r,e){return r&&e?{x:r.left-e.left,y:r.top-e.top}:os}function j0(r){return function(n){for(var s=arguments.length,l=new Array(s>1?s-1:0),a=1;a({...c,top:c.top+r*d.y,bottom:c.bottom+r*d.y,left:c.left+r*d.x,right:c.right+r*d.x}),{...n})}}const B0=j0(1);function Bg(r){if(r.startsWith("matrix3d(")){const e=r.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(r.startsWith("matrix(")){const e=r.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function U0(r,e,n){const s=Bg(e);if(!s)return r;const{scaleX:l,scaleY:a,x:c,y:d}=s,h=r.left-c-(1-l)*parseFloat(n),m=r.top-d-(1-a)*parseFloat(n.slice(n.indexOf(" ")+1)),w=l?r.width/l:r.width,v=a?r.height/a:r.height;return{width:w,height:v,top:m,right:h+w,bottom:m+v,left:h}}const $0={ignoreTransform:!1};function ia(r,e){e===void 0&&(e=$0);let n=r.getBoundingClientRect();if(e.ignoreTransform){const{transform:m,transformOrigin:w}=ni(r).getComputedStyle(r);m&&(n=U0(n,m,w))}const{top:s,left:l,width:a,height:c,bottom:d,right:h}=n;return{top:s,left:l,width:a,height:c,bottom:d,right:h}}function dm(r){return ia(r,{ignoreTransform:!0})}function Y0(r){const e=r.innerWidth,n=r.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function K0(r,e){return e===void 0&&(e=ni(r).getComputedStyle(r)),e.position==="fixed"}function J0(r,e){e===void 0&&(e=ni(r).getComputedStyle(r));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(l=>{const a=e[l];return typeof a=="string"?n.test(a):!1})}function Ih(r,e){const n=[];function s(l){if(e!=null&&n.length>=e||!l)return n;if(Oh(l)&&l.scrollingElement!=null&&!n.includes(l.scrollingElement))return n.push(l.scrollingElement),n;if(!ta(l)||Wg(l)||n.includes(l))return n;const a=ni(r).getComputedStyle(l);return l!==r&&J0(l,a)&&n.push(l),K0(l,a)?n:s(l.parentNode)}return r?s(r):n}function Ug(r){const[e]=Ih(r,1);return e??null}function Gd(r){return!Ku||!r?null:Ko(r)?r:zh(r)?Oh(r)||r===Jo(r).scrollingElement?window:ta(r)?r:null:null}function $g(r){return Ko(r)?r.scrollX:r.scrollLeft}function Yg(r){return Ko(r)?r.scrollY:r.scrollTop}function ih(r){return{x:$g(r),y:Yg(r)}}var Dn;(function(r){r[r.Forward=1]="Forward",r[r.Backward=-1]="Backward"})(Dn||(Dn={}));function Kg(r){return!Ku||!r?!1:r===document.scrollingElement}function Jg(r){const e={x:0,y:0},n=Kg(r)?{height:window.innerHeight,width:window.innerWidth}:{height:r.clientHeight,width:r.clientWidth},s={x:r.scrollWidth-n.width,y:r.scrollHeight-n.height},l=r.scrollTop<=e.y,a=r.scrollLeft<=e.x,c=r.scrollTop>=s.y,d=r.scrollLeft>=s.x;return{isTop:l,isLeft:a,isBottom:c,isRight:d,maxScroll:s,minScroll:e}}const Q0={x:.2,y:.2};function Z0(r,e,n,s,l){let{top:a,left:c,right:d,bottom:h}=n;s===void 0&&(s=10),l===void 0&&(l=Q0);const{isTop:m,isBottom:w,isLeft:v,isRight:S}=Jg(r),E={x:0,y:0},A={x:0,y:0},D={height:e.height*l.y,width:e.width*l.x};return!m&&a<=e.top+D.height?(E.y=Dn.Backward,A.y=s*Math.abs((e.top+D.height-a)/D.height)):!w&&h>=e.bottom-D.height&&(E.y=Dn.Forward,A.y=s*Math.abs((e.bottom-D.height-h)/D.height)),!S&&d>=e.right-D.width?(E.x=Dn.Forward,A.x=s*Math.abs((e.right-D.width-d)/D.width)):!v&&c<=e.left+D.width&&(E.x=Dn.Backward,A.x=s*Math.abs((e.left+D.width-c)/D.width)),{direction:E,speed:A}}function X0(r){if(r===document.scrollingElement){const{innerWidth:a,innerHeight:c}=window;return{top:0,left:0,right:a,bottom:c,width:a,height:c}}const{top:e,left:n,right:s,bottom:l}=r.getBoundingClientRect();return{top:e,left:n,right:s,bottom:l,width:r.clientWidth,height:r.clientHeight}}function Qg(r){return r.reduce((e,n)=>Wo(e,ih(n)),os)}function q0(r){return r.reduce((e,n)=>e+$g(n),0)}function e_(r){return r.reduce((e,n)=>e+Yg(n),0)}function Zg(r,e){if(e===void 0&&(e=ia),!r)return;const{top:n,left:s,bottom:l,right:a}=e(r);Ug(r)&&(l<=0||a<=0||n>=window.innerHeight||s>=window.innerWidth)&&r.scrollIntoView({block:"center",inline:"center"})}const t_=[["x",["left","right"],q0],["y",["top","bottom"],e_]];class Rh{constructor(e,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const s=Ih(n),l=Qg(s);this.rect={...e},this.width=e.width,this.height=e.height;for(const[a,c,d]of t_)for(const h of c)Object.defineProperty(this,h,{get:()=>{const m=d(s),w=l[a]-m;return this.rect[h]+w},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Hl{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var s;return(s=this.target)==null?void 0:s.removeEventListener(...n)})},this.target=e}add(e,n,s){var l;(l=this.target)==null||l.addEventListener(e,n,s),this.listeners.push([e,n,s])}}function n_(r){const{EventTarget:e}=ni(r);return r instanceof e?r:Jo(r)}function Wd(r,e){const n=Math.abs(r.x),s=Math.abs(r.y);return typeof e=="number"?Math.sqrt(n**2+s**2)>e:"x"in e&&"y"in e?n>e.x&&s>e.y:"x"in e?n>e.x:"y"in e?s>e.y:!1}var Bi;(function(r){r.Click="click",r.DragStart="dragstart",r.Keydown="keydown",r.ContextMenu="contextmenu",r.Resize="resize",r.SelectionChange="selectionchange",r.VisibilityChange="visibilitychange"})(Bi||(Bi={}));function hm(r){r.preventDefault()}function i_(r){r.stopPropagation()}var ht;(function(r){r.Space="Space",r.Down="ArrowDown",r.Right="ArrowRight",r.Left="ArrowLeft",r.Up="ArrowUp",r.Esc="Escape",r.Enter="Enter",r.Tab="Tab"})(ht||(ht={}));const Xg={start:[ht.Space,ht.Enter],cancel:[ht.Esc],end:[ht.Space,ht.Enter,ht.Tab]},s_=(r,e)=>{let{currentCoordinates:n}=e;switch(r.code){case ht.Right:return{...n,x:n.x+25};case ht.Left:return{...n,x:n.x-25};case ht.Down:return{...n,y:n.y+25};case ht.Up:return{...n,y:n.y-25}}};class qg{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new Hl(Jo(n)),this.windowListeners=new Hl(ni(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Bi.Resize,this.handleCancel),this.windowListeners.add(Bi.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Bi.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,s=e.node.current;s&&Zg(s),n(os)}handleKeyDown(e){if(Th(e)){const{active:n,context:s,options:l}=this.props,{keyboardCodes:a=Xg,coordinateGetter:c=s_,scrollBehavior:d="smooth"}=l,{code:h}=e;if(a.end.includes(h)){this.handleEnd(e);return}if(a.cancel.includes(h)){this.handleCancel(e);return}const{collisionRect:m}=s.current,w=m?{x:m.left,y:m.top}:os;this.referenceCoordinates||(this.referenceCoordinates=w);const v=c(e,{active:n,context:s.current,currentCoordinates:w});if(v){const S=Mu(v,w),E={x:0,y:0},{scrollableAncestors:A}=s.current;for(const D of A){const P=e.code,{isTop:N,isRight:O,isLeft:M,isBottom:R,maxScroll:Z,minScroll:G}=Jg(D),$=X0(D),K={x:Math.min(P===ht.Right?$.right-$.width/2:$.right,Math.max(P===ht.Right?$.left:$.left+$.width/2,v.x)),y:Math.min(P===ht.Down?$.bottom-$.height/2:$.bottom,Math.max(P===ht.Down?$.top:$.top+$.height/2,v.y))},he=P===ht.Right&&!O||P===ht.Left&&!M,ue=P===ht.Down&&!R||P===ht.Up&&!N;if(he&&K.x!==v.x){const Q=D.scrollLeft+S.x,ve=P===ht.Right&&Q<=Z.x||P===ht.Left&&Q>=G.x;if(ve&&!S.y){D.scrollTo({left:Q,behavior:d});return}ve?E.x=D.scrollLeft-Q:E.x=P===ht.Right?D.scrollLeft-Z.x:D.scrollLeft-G.x,E.x&&D.scrollBy({left:-E.x,behavior:d});break}else if(ue&&K.y!==v.y){const Q=D.scrollTop+S.y,ve=P===ht.Down&&Q<=Z.y||P===ht.Up&&Q>=G.y;if(ve&&!S.x){D.scrollTo({top:Q,behavior:d});return}ve?E.y=D.scrollTop-Q:E.y=P===ht.Down?D.scrollTop-Z.y:D.scrollTop-G.y,E.y&&D.scrollBy({top:-E.y,behavior:d});break}}this.handleMove(e,Wo(Mu(v,this.referenceCoordinates),E))}}}handleMove(e,n){const{onMove:s}=this.props;e.preventDefault(),s(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}qg.activators=[{eventName:"onKeyDown",handler:(r,e,n)=>{let{keyboardCodes:s=Xg,onActivation:l}=e,{active:a}=n;const{code:c}=r.nativeEvent;if(s.start.includes(c)){const d=a.activatorNode.current;return d&&r.target!==d?!1:(r.preventDefault(),l==null||l({event:r.nativeEvent}),!0)}return!1}}];function fm(r){return!!(r&&"distance"in r)}function pm(r){return!!(r&&"delay"in r)}class Nh{constructor(e,n,s){var l;s===void 0&&(s=n_(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;const{event:a}=e,{target:c}=a;this.props=e,this.events=n,this.document=Jo(c),this.documentListeners=new Hl(this.document),this.listeners=new Hl(s),this.windowListeners=new Hl(ni(c)),this.initialCoordinates=(l=Lu(a))!=null?l:os,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:n,bypassActivationConstraint:s}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Bi.Resize,this.handleCancel),this.windowListeners.add(Bi.DragStart,hm),this.windowListeners.add(Bi.VisibilityChange,this.handleCancel),this.windowListeners.add(Bi.ContextMenu,hm),this.documentListeners.add(Bi.Keydown,this.handleKeydown),n){if(s!=null&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(pm(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(fm(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,n){const{active:s,onPending:l}=this.props;l(s,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(Bi.Click,i_,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Bi.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:s,initialCoordinates:l,props:a}=this,{onMove:c,options:{activationConstraint:d}}=a;if(!l)return;const h=(n=Lu(e))!=null?n:os,m=Mu(l,h);if(!s&&d){if(fm(d)){if(d.tolerance!=null&&Wd(m,d.tolerance))return this.handleCancel();if(Wd(m,d.distance))return this.handleStart()}if(pm(d)&&Wd(m,d.tolerance))return this.handleCancel();this.handlePending(d,m);return}e.cancelable&&e.preventDefault(),c(h)}handleEnd(){const{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){const{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===ht.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const r_={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Mh extends Nh{constructor(e){const{event:n}=e,s=Jo(n.target);super(e,r_,s)}}Mh.activators=[{eventName:"onPointerDown",handler:(r,e)=>{let{nativeEvent:n}=r,{onActivation:s}=e;return!n.isPrimary||n.button!==0?!1:(s==null||s({event:n}),!0)}}];const o_={move:{name:"mousemove"},end:{name:"mouseup"}};var sh;(function(r){r[r.RightClick=2]="RightClick"})(sh||(sh={}));class l_ extends Nh{constructor(e){super(e,o_,Jo(e.event.target))}}l_.activators=[{eventName:"onMouseDown",handler:(r,e)=>{let{nativeEvent:n}=r,{onActivation:s}=e;return n.button===sh.RightClick?!1:(s==null||s({event:n}),!0)}}];const Fd={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class a_ extends Nh{constructor(e){super(e,Fd)}static setup(){return window.addEventListener(Fd.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Fd.move.name,e)};function e(){}}}a_.activators=[{eventName:"onTouchStart",handler:(r,e)=>{let{nativeEvent:n}=r,{onActivation:s}=e;const{touches:l}=n;return l.length>1?!1:(s==null||s({event:n}),!0)}}];var jl;(function(r){r[r.Pointer=0]="Pointer",r[r.DraggableRect=1]="DraggableRect"})(jl||(jl={}));var Gu;(function(r){r[r.TreeOrder=0]="TreeOrder",r[r.ReversedTreeOrder=1]="ReversedTreeOrder"})(Gu||(Gu={}));function u_(r){let{acceleration:e,activator:n=jl.Pointer,canScroll:s,draggingRect:l,enabled:a,interval:c=5,order:d=Gu.TreeOrder,pointerCoordinates:h,scrollableAncestors:m,scrollableAncestorRects:w,delta:v,threshold:S}=r;const E=d_({delta:v,disabled:!a}),[A,D]=D0(),P=B.useRef({x:0,y:0}),N=B.useRef({x:0,y:0}),O=B.useMemo(()=>{switch(n){case jl.Pointer:return h?{top:h.y,bottom:h.y,left:h.x,right:h.x}:null;case jl.DraggableRect:return l}},[n,l,h]),M=B.useRef(null),R=B.useCallback(()=>{const G=M.current;if(!G)return;const $=P.current.x*N.current.x,K=P.current.y*N.current.y;G.scrollBy($,K)},[]),Z=B.useMemo(()=>d===Gu.TreeOrder?[...m].reverse():m,[d,m]);B.useEffect(()=>{if(!a||!m.length||!O){D();return}for(const G of Z){if((s==null?void 0:s(G))===!1)continue;const $=m.indexOf(G),K=w[$];if(!K)continue;const{direction:he,speed:ue}=Z0(G,K,O,e,S);for(const Q of["x","y"])E[Q][he[Q]]||(ue[Q]=0,he[Q]=0);if(ue.x>0||ue.y>0){D(),M.current=G,A(R,c),P.current=ue,N.current=he;return}}P.current={x:0,y:0},N.current={x:0,y:0},D()},[e,R,s,D,a,c,JSON.stringify(O),JSON.stringify(E),A,m,Z,w,JSON.stringify(S)])}const c_={x:{[Dn.Backward]:!1,[Dn.Forward]:!1},y:{[Dn.Backward]:!1,[Dn.Forward]:!1}};function d_(r){let{delta:e,disabled:n}=r;const s=Nu(e);return na(l=>{if(n||!s||!l)return c_;const a={x:Math.sign(e.x-s.x),y:Math.sign(e.y-s.y)};return{x:{[Dn.Backward]:l.x[Dn.Backward]||a.x===-1,[Dn.Forward]:l.x[Dn.Forward]||a.x===1},y:{[Dn.Backward]:l.y[Dn.Backward]||a.y===-1,[Dn.Forward]:l.y[Dn.Forward]||a.y===1}}},[n,e,s])}function h_(r,e){const n=e!=null?r.get(e):void 0,s=n?n.node.current:null;return na(l=>{var a;return e==null?null:(a=s??l)!=null?a:null},[s,e])}function f_(r,e){return B.useMemo(()=>r.reduce((n,s)=>{const{sensor:l}=s,a=l.activators.map(c=>({eventName:c.eventName,handler:e(c.handler,s)}));return[...n,...a]},[]),[r,e])}var Ql;(function(r){r[r.Always=0]="Always",r[r.BeforeDragging=1]="BeforeDragging",r[r.WhileDragging=2]="WhileDragging"})(Ql||(Ql={}));var rh;(function(r){r.Optimized="optimized"})(rh||(rh={}));const mm=new Map;function p_(r,e){let{dragging:n,dependencies:s,config:l}=e;const[a,c]=B.useState(null),{frequency:d,measure:h,strategy:m}=l,w=B.useRef(r),v=P(),S=Kl(v),E=B.useCallback(function(N){N===void 0&&(N=[]),!S.current&&c(O=>O===null?N:O.concat(N.filter(M=>!O.includes(M))))},[S]),A=B.useRef(null),D=na(N=>{if(v&&!n)return mm;if(!N||N===mm||w.current!==r||a!=null){const O=new Map;for(let M of r){if(!M)continue;if(a&&a.length>0&&!a.includes(M.id)&&M.rect.current){O.set(M.id,M.rect.current);continue}const R=M.node.current,Z=R?new Rh(h(R),R):null;M.rect.current=Z,Z&&O.set(M.id,Z)}return O}return N},[r,a,n,v,h]);return B.useEffect(()=>{w.current=r},[r]),B.useEffect(()=>{v||E()},[n,v]),B.useEffect(()=>{a&&a.length>0&&c(null)},[JSON.stringify(a)]),B.useEffect(()=>{v||typeof d!="number"||A.current!==null||(A.current=setTimeout(()=>{E(),A.current=null},d))},[d,v,E,...s]),{droppableRects:D,measureDroppableContainers:E,measuringScheduled:a!=null};function P(){switch(m){case Ql.Always:return!1;case Ql.BeforeDragging:return n;default:return!n}}}function Lh(r,e){return na(n=>r?n||(typeof e=="function"?e(r):r):null,[e,r])}function m_(r,e){return Lh(r,e)}function g_(r){let{callback:e,disabled:n}=r;const s=Ju(e),l=B.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(s)},[s,n]);return B.useEffect(()=>()=>l==null?void 0:l.disconnect(),[l]),l}function Zu(r){let{callback:e,disabled:n}=r;const s=Ju(e),l=B.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(s)},[n]);return B.useEffect(()=>()=>l==null?void 0:l.disconnect(),[l]),l}function v_(r){return new Rh(ia(r),r)}function gm(r,e,n){e===void 0&&(e=v_);const[s,l]=B.useState(null);function a(){l(h=>{if(!r)return null;if(r.isConnected===!1){var m;return(m=h??n)!=null?m:null}const w=e(r);return JSON.stringify(h)===JSON.stringify(w)?h:w})}const c=g_({callback(h){if(r)for(const m of h){const{type:w,target:v}=m;if(w==="childList"&&v instanceof HTMLElement&&v.contains(r)){a();break}}}}),d=Zu({callback:a});return Gs(()=>{a(),r?(d==null||d.observe(r),c==null||c.observe(document.body,{childList:!0,subtree:!0})):(d==null||d.disconnect(),c==null||c.disconnect())},[r]),s}function w_(r){const e=Lh(r);return jg(r,e)}const vm=[];function __(r){const e=B.useRef(r),n=na(s=>r?s&&s!==vm&&r&&e.current&&r.parentNode===e.current.parentNode?s:Ih(r):vm,[r]);return B.useEffect(()=>{e.current=r},[r]),n}function y_(r){const[e,n]=B.useState(null),s=B.useRef(r),l=B.useCallback(a=>{const c=Gd(a.target);c&&n(d=>d?(d.set(c,ih(c)),new Map(d)):null)},[]);return B.useEffect(()=>{const a=s.current;if(r!==a){c(a);const d=r.map(h=>{const m=Gd(h);return m?(m.addEventListener("scroll",l,{passive:!0}),[m,ih(m)]):null}).filter(h=>h!=null);n(d.length?new Map(d):null),s.current=r}return()=>{c(r),c(a)};function c(d){d.forEach(h=>{const m=Gd(h);m==null||m.removeEventListener("scroll",l)})}},[l,r]),B.useMemo(()=>r.length?e?Array.from(e.values()).reduce((a,c)=>Wo(a,c),os):Qg(r):os,[r,e])}function wm(r,e){e===void 0&&(e=[]);const n=B.useRef(null);return B.useEffect(()=>{n.current=null},e),B.useEffect(()=>{const s=r!==os;s&&!n.current&&(n.current=r),!s&&n.current&&(n.current=null)},[r]),n.current?Mu(r,n.current):os}function S_(r){B.useEffect(()=>{if(!Ku)return;const e=r.map(n=>{let{sensor:s}=n;return s.setup==null?void 0:s.setup()});return()=>{for(const n of e)n==null||n()}},r.map(e=>{let{sensor:n}=e;return n}))}function D_(r,e){return B.useMemo(()=>r.reduce((n,s)=>{let{eventName:l,handler:a}=s;return n[l]=c=>{a(c,e)},n},{}),[r,e])}function ev(r){return B.useMemo(()=>r?Y0(r):null,[r])}const _m=[];function C_(r,e){e===void 0&&(e=ia);const[n]=r,s=ev(n?ni(n):null),[l,a]=B.useState(_m);function c(){a(()=>r.length?r.map(h=>Kg(h)?s:new Rh(e(h),h)):_m)}const d=Zu({callback:c});return Gs(()=>{d==null||d.disconnect(),c(),r.forEach(h=>d==null?void 0:d.observe(h))},[r]),l}function tv(r){if(!r)return null;if(r.children.length>1)return r;const e=r.children[0];return ta(e)?e:r}function x_(r){let{measure:e}=r;const[n,s]=B.useState(null),l=B.useCallback(m=>{for(const{target:w}of m)if(ta(w)){s(v=>{const S=e(w);return v?{...v,width:S.width,height:S.height}:S});break}},[e]),a=Zu({callback:l}),c=B.useCallback(m=>{const w=tv(m);a==null||a.disconnect(),w&&(a==null||a.observe(w)),s(w?e(w):null)},[e,a]),[d,h]=Ru(c);return B.useMemo(()=>({nodeRef:d,rect:n,setRef:h}),[n,d,h])}const E_=[{sensor:Mh,options:{}},{sensor:qg,options:{}}],b_={current:{}},Pu={draggable:{measure:dm},droppable:{measure:dm,strategy:Ql.WhileDragging,frequency:rh.Optimized},dragOverlay:{measure:ia}};class Bl extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,s;return(n=(s=this.get(e))==null?void 0:s.node.current)!=null?n:void 0}}const P_={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Bl,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Vu},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Pu,measureDroppableContainers:Vu,windowRect:null,measuringScheduled:!1},nv={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Vu,draggableNodes:new Map,over:null,measureDroppableContainers:Vu},sa=B.createContext(nv),iv=B.createContext(P_);function A_(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Bl}}}function k_(r,e){switch(e.type){case an.DragStart:return{...r,draggable:{...r.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case an.DragMove:return r.draggable.active==null?r:{...r,draggable:{...r.draggable,translate:{x:e.coordinates.x-r.draggable.initialCoordinates.x,y:e.coordinates.y-r.draggable.initialCoordinates.y}}};case an.DragEnd:case an.DragCancel:return{...r,draggable:{...r.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case an.RegisterDroppable:{const{element:n}=e,{id:s}=n,l=new Bl(r.droppable.containers);return l.set(s,n),{...r,droppable:{...r.droppable,containers:l}}}case an.SetDroppableDisabled:{const{id:n,key:s,disabled:l}=e,a=r.droppable.containers.get(n);if(!a||s!==a.key)return r;const c=new Bl(r.droppable.containers);return c.set(n,{...a,disabled:l}),{...r,droppable:{...r.droppable,containers:c}}}case an.UnregisterDroppable:{const{id:n,key:s}=e,l=r.droppable.containers.get(n);if(!l||s!==l.key)return r;const a=new Bl(r.droppable.containers);return a.delete(n),{...r,droppable:{...r.droppable,containers:a}}}default:return r}}function z_(r){let{disabled:e}=r;const{active:n,activatorEvent:s,draggableNodes:l}=B.useContext(sa),a=Nu(s),c=Nu(n==null?void 0:n.id);return B.useEffect(()=>{if(!e&&!s&&a&&c!=null){if(!Th(a)||document.activeElement===a.target)return;const d=l.get(c);if(!d)return;const{activatorNode:h,node:m}=d;if(!h.current&&!m.current)return;requestAnimationFrame(()=>{for(const w of[h.current,m.current]){if(!w)continue;const v=E0(w);if(v){v.focus();break}}})}},[s,e,l,c,a]),null}function sv(r,e){let{transform:n,...s}=e;return r!=null&&r.length?r.reduce((l,a)=>a({transform:l,...s}),n):n}function O_(r){return B.useMemo(()=>({draggable:{...Pu.draggable,...r==null?void 0:r.draggable},droppable:{...Pu.droppable,...r==null?void 0:r.droppable},dragOverlay:{...Pu.dragOverlay,...r==null?void 0:r.dragOverlay}}),[r==null?void 0:r.draggable,r==null?void 0:r.droppable,r==null?void 0:r.dragOverlay])}function T_(r){let{activeNode:e,measure:n,initialRect:s,config:l=!0}=r;const a=B.useRef(!1),{x:c,y:d}=typeof l=="boolean"?{x:l,y:l}:l;Gs(()=>{if(!c&&!d||!e){a.current=!1;return}if(a.current||!s)return;const m=e==null?void 0:e.node.current;if(!m||m.isConnected===!1)return;const w=n(m),v=jg(w,s);if(c||(v.x=0),d||(v.y=0),a.current=!0,Math.abs(v.x)>0||Math.abs(v.y)>0){const S=Ug(m);S&&S.scrollBy({top:v.y,left:v.x})}},[e,c,d,s,n])}const Xu=B.createContext({...os,scaleX:1,scaleY:1});var vr;(function(r){r[r.Uninitialized=0]="Uninitialized",r[r.Initializing=1]="Initializing",r[r.Initialized=2]="Initialized"})(vr||(vr={}));const I_=B.memo(function(e){var n,s,l,a;let{id:c,accessibility:d,autoScroll:h=!0,children:m,sensors:w=E_,collisionDetection:v=F0,measuring:S,modifiers:E,...A}=e;const D=B.useReducer(k_,void 0,A_),[P,N]=D,[O,M]=O0(),[R,Z]=B.useState(vr.Uninitialized),G=R===vr.Initialized,{draggable:{active:$,nodes:K,translate:he},droppable:{containers:ue}}=P,Q=$!=null?K.get($):null,ve=B.useRef({initial:null,translated:null}),ie=B.useMemo(()=>{var ut;return $!=null?{id:$,data:(ut=Q==null?void 0:Q.data)!=null?ut:b_,rect:ve}:null},[$,Q]),ce=B.useRef(null),[j,te]=B.useState(null),[X,le]=B.useState(null),fe=Kl(A,Object.values(A)),ne=Qu("DndDescribedBy",c),z=B.useMemo(()=>ue.getEnabled(),[ue]),F=O_(S),{droppableRects:q,measureDroppableContainers:xe,measuringScheduled:Ie}=p_(z,{dragging:G,dependencies:[he.x,he.y],config:F.droppable}),Se=h_(K,$),Ee=B.useMemo(()=>X?Lu(X):null,[X]),We=Nt(),Fe=m_(Se,F.draggable.measure);T_({activeNode:$!=null?K.get($):null,config:We.layoutShiftCompensation,initialRect:Fe,measure:F.draggable.measure});const Me=gm(Se,F.draggable.measure,Fe),Zt=gm(Se?Se.parentElement:null),Wt=B.useRef({activatorEvent:null,active:null,activeNode:Se,collisionRect:null,collisions:null,droppableRects:q,draggableNodes:K,draggingNode:null,draggingNodeRect:null,droppableContainers:ue,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ft=ue.getNodeFor((n=Wt.current.over)==null?void 0:n.id),Ht=x_({measure:F.dragOverlay.measure}),ii=(s=Ht.nodeRef.current)!=null?s:Se,Tn=G?(l=Ht.rect)!=null?l:Me:null,zi=!!(Ht.nodeRef.current&&Ht.rect),ls=w_(zi?null:Me),Un=ev(ii?ni(ii):null),nt=__(G?Ft??Se:null),cn=C_(nt),dn=sv(E,{transform:{x:he.x-ls.x,y:he.y-ls.y,scaleX:1,scaleY:1},activatorEvent:X,active:ie,activeNodeRect:Me,containerNodeRect:Zt,draggingNodeRect:Tn,over:Wt.current.over,overlayNodeRect:Ht.rect,scrollableAncestors:nt,scrollableAncestorRects:cn,windowRect:Un}),pi=Ee?Wo(Ee,he):null,Le=y_(nt),ge=wm(Le),et=wm(Le,[Me]),it=Wo(dn,ge),hn=Tn?B0(Tn,dn):null,In=ie&&hn?v({active:ie,collisionRect:hn,droppableRects:q,droppableContainers:z,pointerCoordinates:pi}):null,Xt=G0(In,"id"),[zt,fn]=B.useState(null),xn=zi?dn:Wo(dn,et),qt=H0(xn,(a=zt==null?void 0:zt.rect)!=null?a:null,Me),En=B.useRef(null),as=B.useCallback((ut,en)=>{let{sensor:pn,options:vi}=en;if(ce.current==null)return;const bn=K.get(ce.current);if(!bn)return;const mn=ut.nativeEvent,Rn=new pn({active:ce.current,activeNode:bn,event:mn,options:vi,context:Wt,onAbort(je){if(!K.get(je))return;const{onDragAbort:Et}=fe.current,gn={id:je};Et==null||Et(gn),O({type:"onDragAbort",event:gn})},onPending(je,xt,Et,gn){if(!K.get(je))return;const{onDragPending:An}=fe.current,jt={id:je,constraint:xt,initialCoordinates:Et,offset:gn};An==null||An(jt),O({type:"onDragPending",event:jt})},onStart(je){const xt=ce.current;if(xt==null)return;const Et=K.get(xt);if(!Et)return;const{onDragStart:gn}=fe.current,yt={activatorEvent:mn,active:{id:xt,data:Et.data,rect:ve}};Kr.unstable_batchedUpdates(()=>{gn==null||gn(yt),Z(vr.Initializing),N({type:an.DragStart,initialCoordinates:je,active:xt}),O({type:"onDragStart",event:yt}),te(En.current),le(mn)})},onMove(je){N({type:an.DragMove,coordinates:je})},onEnd:Pn(an.DragEnd),onCancel:Pn(an.DragCancel)});En.current=Rn;function Pn(je){return async function(){const{active:Et,collisions:gn,over:yt,scrollAdjustedTranslate:An}=Wt.current;let jt=null;if(Et&&An){const{cancelDrop:Oi}=fe.current;jt={activatorEvent:mn,active:Et,collisions:gn,delta:An,over:yt},je===an.DragEnd&&typeof Oi=="function"&&await Promise.resolve(Oi(jt))&&(je=an.DragCancel)}ce.current=null,Kr.unstable_batchedUpdates(()=>{N({type:je}),Z(vr.Uninitialized),fn(null),te(null),le(null),En.current=null;const Oi=je===an.DragEnd?"onDragEnd":"onDragCancel";if(jt){const Ws=fe.current[Oi];Ws==null||Ws(jt),O({type:Oi,event:jt})}})}}},[K]),us=B.useCallback((ut,en)=>(pn,vi)=>{const bn=pn.nativeEvent,mn=K.get(vi);if(ce.current!==null||!mn||bn.dndKit||bn.defaultPrevented)return;const Rn={active:mn};ut(pn,en.options,Rn)===!0&&(bn.dndKit={capturedBy:en.sensor},ce.current=vi,as(pn,en))},[K,as]),mi=f_(w,us);S_(w),Gs(()=>{Me&&R===vr.Initializing&&Z(vr.Initialized)},[Me,R]),B.useEffect(()=>{const{onDragMove:ut}=fe.current,{active:en,activatorEvent:pn,collisions:vi,over:bn}=Wt.current;if(!en||!pn)return;const mn={active:en,activatorEvent:pn,collisions:vi,delta:{x:it.x,y:it.y},over:bn};Kr.unstable_batchedUpdates(()=>{ut==null||ut(mn),O({type:"onDragMove",event:mn})})},[it.x,it.y]),B.useEffect(()=>{const{active:ut,activatorEvent:en,collisions:pn,droppableContainers:vi,scrollAdjustedTranslate:bn}=Wt.current;if(!ut||ce.current==null||!en||!bn)return;const{onDragOver:mn}=fe.current,Rn=vi.get(Xt),Pn=Rn&&Rn.rect.current?{id:Rn.id,rect:Rn.rect.current,data:Rn.data,disabled:Rn.disabled}:null,je={active:ut,activatorEvent:en,collisions:pn,delta:{x:bn.x,y:bn.y},over:Pn};Kr.unstable_batchedUpdates(()=>{fn(Pn),mn==null||mn(je),O({type:"onDragOver",event:je})})},[Xt]),Gs(()=>{Wt.current={activatorEvent:X,active:ie,activeNode:Se,collisionRect:hn,collisions:In,droppableRects:q,draggableNodes:K,draggingNode:ii,draggingNodeRect:Tn,droppableContainers:ue,over:zt,scrollableAncestors:nt,scrollAdjustedTranslate:it},ve.current={initial:Tn,translated:hn}},[ie,Se,In,hn,K,ii,Tn,q,ue,zt,nt,it]),u_({...We,delta:he,draggingRect:hn,pointerCoordinates:pi,scrollableAncestors:nt,scrollableAncestorRects:cn});const gi=B.useMemo(()=>({active:ie,activeNode:Se,activeNodeRect:Me,activatorEvent:X,collisions:In,containerNodeRect:Zt,dragOverlay:Ht,draggableNodes:K,droppableContainers:ue,droppableRects:q,over:zt,measureDroppableContainers:xe,scrollableAncestors:nt,scrollableAncestorRects:cn,measuringConfiguration:F,measuringScheduled:Ie,windowRect:Un}),[ie,Se,Me,X,In,Zt,Ht,K,ue,q,zt,xe,nt,cn,F,Ie,Un]),cs=B.useMemo(()=>({activatorEvent:X,activators:mi,active:ie,activeNodeRect:Me,ariaDescribedById:{draggable:ne},dispatch:N,draggableNodes:K,over:zt,measureDroppableContainers:xe}),[X,mi,ie,Me,N,ne,K,zt,xe]);return pe.createElement(Hg.Provider,{value:M},pe.createElement(sa.Provider,{value:cs},pe.createElement(iv.Provider,{value:gi},pe.createElement(Xu.Provider,{value:qt},m)),pe.createElement(z_,{disabled:(d==null?void 0:d.restoreFocus)===!1})),pe.createElement(R0,{...d,hiddenTextDescribedById:ne}));function Nt(){const ut=(j==null?void 0:j.autoScrollEnabled)===!1,en=typeof h=="object"?h.enabled===!1:h===!1,pn=G&&!ut&&!en;return typeof h=="object"?{...h,enabled:pn}:{enabled:pn}}}),R_=B.createContext(null),ym="button",N_="Draggable";function M_(r){let{id:e,data:n,disabled:s=!1,attributes:l}=r;const a=Qu(N_),{activators:c,activatorEvent:d,active:h,activeNodeRect:m,ariaDescribedById:w,draggableNodes:v,over:S}=B.useContext(sa),{role:E=ym,roleDescription:A="draggable",tabIndex:D=0}=l??{},P=(h==null?void 0:h.id)===e,N=B.useContext(P?Xu:R_),[O,M]=Ru(),[R,Z]=Ru(),G=D_(c,e),$=Kl(n);Gs(()=>(v.set(e,{id:e,key:a,node:O,activatorNode:R,data:$}),()=>{const he=v.get(e);he&&he.key===a&&v.delete(e)}),[v,e]);const K=B.useMemo(()=>({role:E,tabIndex:D,"aria-disabled":s,"aria-pressed":P&&E===ym?!0:void 0,"aria-roledescription":A,"aria-describedby":w.draggable}),[s,E,D,P,A,w.draggable]);return{active:h,activatorEvent:d,activeNodeRect:m,attributes:K,isDragging:P,listeners:s?void 0:G,node:O,over:S,setNodeRef:M,setActivatorNodeRef:Z,transform:N}}function L_(){return B.useContext(iv)}const V_="Droppable",G_={timeout:25};function W_(r){let{data:e,disabled:n=!1,id:s,resizeObserverConfig:l}=r;const a=Qu(V_),{active:c,dispatch:d,over:h,measureDroppableContainers:m}=B.useContext(sa),w=B.useRef({disabled:n}),v=B.useRef(!1),S=B.useRef(null),E=B.useRef(null),{disabled:A,updateMeasurementsFor:D,timeout:P}={...G_,...l},N=Kl(D??s),O=B.useCallback(()=>{if(!v.current){v.current=!0;return}E.current!=null&&clearTimeout(E.current),E.current=setTimeout(()=>{m(Array.isArray(N.current)?N.current:[N.current]),E.current=null},P)},[P]),M=Zu({callback:O,disabled:A||!c}),R=B.useCallback((K,he)=>{M&&(he&&(M.unobserve(he),v.current=!1),K&&M.observe(K))},[M]),[Z,G]=Ru(R),$=Kl(e);return B.useEffect(()=>{!M||!Z.current||(M.disconnect(),v.current=!1,M.observe(Z.current))},[Z,M]),B.useEffect(()=>(d({type:an.RegisterDroppable,element:{id:s,key:a,disabled:n,node:Z,rect:S,data:$}}),()=>d({type:an.UnregisterDroppable,key:a,id:s})),[s]),B.useEffect(()=>{n!==w.current.disabled&&(d({type:an.SetDroppableDisabled,id:s,key:a,disabled:n}),w.current.disabled=n)},[s,a,n,d]),{active:c,rect:S,isOver:(h==null?void 0:h.id)===s,node:Z,over:h,setNodeRef:G}}function F_(r){let{animation:e,children:n}=r;const[s,l]=B.useState(null),[a,c]=B.useState(null),d=Nu(n);return!n&&!s&&d&&l(d),Gs(()=>{if(!a)return;const h=s==null?void 0:s.key,m=s==null?void 0:s.props.id;if(h==null||m==null){l(null);return}Promise.resolve(e(m,a)).then(()=>{l(null)})},[e,s,a]),pe.createElement(pe.Fragment,null,n,s?B.cloneElement(s,{ref:c}):null)}const H_={x:0,y:0,scaleX:1,scaleY:1};function j_(r){let{children:e}=r;return pe.createElement(sa.Provider,{value:nv},pe.createElement(Xu.Provider,{value:H_},e))}const B_={position:"fixed",touchAction:"none"},U_=r=>Th(r)?"transform 250ms ease":void 0,$_=B.forwardRef((r,e)=>{let{as:n,activatorEvent:s,adjustScale:l,children:a,className:c,rect:d,style:h,transform:m,transition:w=U_}=r;if(!d)return null;const v=l?m:{...m,scaleX:1,scaleY:1},S={...B_,width:d.width,height:d.height,top:d.top,left:d.left,transform:Jl.Transform.toString(v),transformOrigin:l&&s?L0(s,d):void 0,transition:typeof w=="function"?w(s):w,...h};return pe.createElement(n,{className:c,style:S,ref:e},a)}),Y_=r=>e=>{let{active:n,dragOverlay:s}=e;const l={},{styles:a,className:c}=r;if(a!=null&&a.active)for(const[d,h]of Object.entries(a.active))h!==void 0&&(l[d]=n.node.style.getPropertyValue(d),n.node.style.setProperty(d,h));if(a!=null&&a.dragOverlay)for(const[d,h]of Object.entries(a.dragOverlay))h!==void 0&&s.node.style.setProperty(d,h);return c!=null&&c.active&&n.node.classList.add(c.active),c!=null&&c.dragOverlay&&s.node.classList.add(c.dragOverlay),function(){for(const[h,m]of Object.entries(l))n.node.style.setProperty(h,m);c!=null&&c.active&&n.node.classList.remove(c.active)}},K_=r=>{let{transform:{initial:e,final:n}}=r;return[{transform:Jl.Transform.toString(e)},{transform:Jl.Transform.toString(n)}]},J_={duration:250,easing:"ease",keyframes:K_,sideEffects:Y_({styles:{active:{opacity:"0"}}})};function Q_(r){let{config:e,draggableNodes:n,droppableContainers:s,measuringConfiguration:l}=r;return Ju((a,c)=>{if(e===null)return;const d=n.get(a);if(!d)return;const h=d.node.current;if(!h)return;const m=tv(c);if(!m)return;const{transform:w}=ni(c).getComputedStyle(c),v=Bg(w);if(!v)return;const S=typeof e=="function"?e:Z_(e);return Zg(h,l.draggable.measure),S({active:{id:a,data:d.data,node:h,rect:l.draggable.measure(h)},draggableNodes:n,dragOverlay:{node:c,rect:l.dragOverlay.measure(m)},droppableContainers:s,measuringConfiguration:l,transform:v})})}function Z_(r){const{duration:e,easing:n,sideEffects:s,keyframes:l}={...J_,...r};return a=>{let{active:c,dragOverlay:d,transform:h,...m}=a;if(!e)return;const w={x:d.rect.left-c.rect.left,y:d.rect.top-c.rect.top},v={scaleX:h.scaleX!==1?c.rect.width*h.scaleX/d.rect.width:1,scaleY:h.scaleY!==1?c.rect.height*h.scaleY/d.rect.height:1},S={x:h.x-w.x,y:h.y-w.y,...v},E=l({...m,active:c,dragOverlay:d,transform:{initial:h,final:S}}),[A]=E,D=E[E.length-1];if(JSON.stringify(A)===JSON.stringify(D))return;const P=s==null?void 0:s({active:c,dragOverlay:d,...m}),N=d.node.animate(E,{duration:e,easing:n,fill:"forwards"});return new Promise(O=>{N.onfinish=()=>{P==null||P(),O()}})}}let Sm=0;function X_(r){return B.useMemo(()=>{if(r!=null)return Sm++,Sm},[r])}const q_=pe.memo(r=>{let{adjustScale:e=!1,children:n,dropAnimation:s,style:l,transition:a,modifiers:c,wrapperElement:d="div",className:h,zIndex:m=999}=r;const{activatorEvent:w,active:v,activeNodeRect:S,containerNodeRect:E,draggableNodes:A,droppableContainers:D,dragOverlay:P,over:N,measuringConfiguration:O,scrollableAncestors:M,scrollableAncestorRects:R,windowRect:Z}=L_(),G=B.useContext(Xu),$=X_(v==null?void 0:v.id),K=sv(c,{activatorEvent:w,active:v,activeNodeRect:S,containerNodeRect:E,draggingNodeRect:P.rect,over:N,overlayNodeRect:P.rect,scrollableAncestors:M,scrollableAncestorRects:R,transform:G,windowRect:Z}),he=Lh(S),ue=Q_({config:s,draggableNodes:A,droppableContainers:D,measuringConfiguration:O}),Q=he?P.setRef:void 0;return pe.createElement(j_,null,pe.createElement(F_,{animation:ue},v&&$?pe.createElement($_,{key:$,id:v.id,ref:Q,as:d,activatorEvent:w,adjustScale:e,className:h,transition:a,rect:he,style:{zIndex:m,...l},transform:K},n):null))}),Dm=r=>{let e;const n=new Set,s=(m,w)=>{const v=typeof m=="function"?m(e):m;if(!Object.is(v,e)){const S=e;e=w??(typeof v!="object"||v===null)?v:Object.assign({},e,v),n.forEach(E=>E(e,S))}},l=()=>e,d={setState:s,getState:l,getInitialState:()=>h,subscribe:m=>(n.add(m),()=>n.delete(m))},h=e=r(s,l,d);return d},ey=(r=>r?Dm(r):Dm),ty=r=>r;function ny(r,e=ty){const n=pe.useSyncExternalStore(r.subscribe,pe.useCallback(()=>e(r.getState()),[r,e]),pe.useCallback(()=>e(r.getInitialState()),[r,e]));return pe.useDebugValue(n),n}const Cm=r=>{const e=ey(r),n=s=>ny(e,s);return Object.assign(n,e),n},iy=(r=>r?Cm(r):Cm),rv="damiao.monitor.plotConfigs";function sy(){try{return JSON.parse(localStorage.getItem(rv)||"{}")}catch{return{}}}function ry(r){try{localStorage.setItem(rv,JSON.stringify(r))}catch{}}const Cn=iy((r,e)=>({connected:!1,status:null,signals:[],pairs:[],motors:[],motorTypes:[],plotConfigs:sy(),setConnected:n=>r({connected:n}),setStatus:n=>r({status:n}),setMeta:(n,s)=>r({signals:n,pairs:s}),setMotors:n=>r({motors:n}),setMotorTypes:n=>r({motorTypes:n}),ensurePlot:n=>r(s=>s.plotConfigs[n]?s:{plotConfigs:{...s.plotConfigs,[n]:{signals:[],duration:10}}}),setPlotConfig:(n,s)=>r(l=>({plotConfigs:{...l.plotConfigs,[n]:{...l.plotConfigs[n]||{signals:[],duration:10},...s}}})),addSignalToPlot:(n,s)=>r(l=>{const a=l.plotConfigs[n]||{signals:[],duration:10};return a.signals.includes(s)?l:{plotConfigs:{...l.plotConfigs,[n]:{...a,signals:[...a.signals,s]}}}}),removeSignalFromPlot:(n,s)=>r(l=>{const a=l.plotConfigs[n];return a?{plotConfigs:{...l.plotConfigs,[n]:{...a,signals:a.signals.filter(c=>c!==s)}}}:l}),dropPlot:n=>r(s=>{const l={...s.plotConfigs};return delete l[n],{plotConfigs:l}})}));Cn.subscribe(r=>ry(r.plotConfigs));const oy=!0,un="u-",ly="uplot",ay=un+"hz",uy=un+"vt",cy=un+"title",dy=un+"wrap",hy=un+"under",fy=un+"over",py=un+"axis",Yr=un+"off",my=un+"select",gy=un+"cursor-x",vy=un+"cursor-y",wy=un+"cursor-pt",_y=un+"legend",yy=un+"live",Sy=un+"inline",Dy=un+"series",Cy=un+"marker",xm=un+"label",xy=un+"value",Gl="width",Wl="height",Rl="top",Em="bottom",Ro="left",Hd="right",Vh="#000",bm=Vh+"0",jd="mousemove",Pm="mousedown",Bd="mouseup",Am="mouseenter",km="mouseleave",zm="dblclick",Ey="resize",by="scroll",Om="change",Wu="dppxchange",Gh="--",Qo=typeof window<"u",oh=Qo?document:null,Fo=Qo?window:null,Py=Qo?navigator:null;let tt,vu;function lh(){let r=devicePixelRatio;tt!=r&&(tt=r,vu&&uh(Om,vu,lh),vu=matchMedia(`(min-resolution: ${tt-.001}dppx) and (max-resolution: ${tt+.001}dppx)`),Jr(Om,vu,lh),Fo.dispatchEvent(new CustomEvent(Wu)))}function Pi(r,e){if(e!=null){let n=r.classList;!n.contains(e)&&n.add(e)}}function ah(r,e){let n=r.classList;n.contains(e)&&n.remove(e)}function wt(r,e,n){r.style[e]=n+"px"}function ns(r,e,n,s){let l=oh.createElement(r);return e!=null&&Pi(l,e),n!=null&&n.insertBefore(l,s),l}function Hi(r,e){return ns("div",r,e)}const Tm=new WeakMap;function ws(r,e,n,s,l){let a="translate("+e+"px,"+n+"px)",c=Tm.get(r);a!=c&&(r.style.transform=a,Tm.set(r,a),e<0||n<0||e>s||n>l?Pi(r,Yr):ah(r,Yr))}const Im=new WeakMap;function Rm(r,e,n){let s=e+n,l=Im.get(r);s!=l&&(Im.set(r,s),r.style.background=e,r.style.borderColor=n)}const Nm=new WeakMap;function Mm(r,e,n,s){let l=e+""+n,a=Nm.get(r);l!=a&&(Nm.set(r,l),r.style.height=n+"px",r.style.width=e+"px",r.style.marginLeft=s?-e/2+"px":0,r.style.marginTop=s?-n/2+"px":0)}const Wh={passive:!0},Ay={...Wh,capture:!0};function Jr(r,e,n,s){e.addEventListener(r,n,s?Ay:Wh)}function uh(r,e,n,s){e.removeEventListener(r,n,Wh)}Qo&&lh();function is(r,e,n,s){let l;n=n||0,s=s||e.length-1;let a=s<=2147483647;for(;s-n>1;)l=a?n+s>>1:Ai((n+s)/2),e[l]{let a=-1,c=-1;for(let d=s;d<=l;d++)if(r(n[d])){a=d;break}for(let d=l;d>=s;d--)if(r(n[d])){c=d;break}return[a,c]}}const lv=r=>r!=null,av=r=>r!=null&&r>0,qu=ov(lv),ky=ov(av);function zy(r,e,n,s=0,l=!1){let a=l?ky:qu,c=l?av:lv;[e,n]=a(r,e,n);let d=r[e],h=r[e];if(e>-1)if(s==1)d=r[e],h=r[n];else if(s==-1)d=r[n],h=r[e];else for(let m=e;m<=n;m++){let w=r[m];c(w)&&(wh&&(h=w))}return[d??ft,h??-ft]}function ec(r,e,n,s){let l=Gm(r),a=Gm(e);r==e&&(l==-1?(r*=n,e/=n):(r/=n,e*=n));let c=n==10?Ls:uv,d=l==1?Ai:Ui,h=a==1?Ui:Ai,m=d(c(ln(r))),w=h(c(ln(e))),v=jo(n,m),S=jo(n,w);return n==10&&(m<0&&(v=pt(v,-m)),w<0&&(S=pt(S,-w))),s||n==2?(r=v*l,e=S*a):(r=fv(r,v),e=tc(e,S)),[r,e]}function Fh(r,e,n,s){let l=ec(r,e,n,s);return r==0&&(l[0]=0),e==0&&(l[1]=0),l}const Hh=.1,Lm={mode:3,pad:Hh},Ul={pad:0,soft:null,mode:0},Oy={min:Ul,max:Ul};function Fu(r,e,n,s){return nc(n)?Vm(r,e,n):(Ul.pad=n,Ul.soft=s?0:null,Ul.mode=s?3:0,Vm(r,e,Oy))}function qe(r,e){return r??e}function Ty(r,e,n){for(e=qe(e,0),n=qe(n,r.length-1);e<=n;){if(r[e]!=null)return!0;e++}return!1}function Vm(r,e,n){let s=n.min,l=n.max,a=qe(s.pad,0),c=qe(l.pad,0),d=qe(s.hard,-ft),h=qe(l.hard,ft),m=qe(s.soft,ft),w=qe(l.soft,-ft),v=qe(s.mode,0),S=qe(l.mode,0),E=e-r,A=Ls(E),D=ti(ln(r),ln(e)),P=Ls(D),N=ln(P-A);(E<1e-24||N>10)&&(E=0,(r==0||e==0)&&(E=1e-24,v==2&&m!=ft&&(a=0),S==2&&w!=-ft&&(c=0)));let O=E||D||1e3,M=Ls(O),R=jo(10,Ai(M)),Z=O*(E==0?r==0?.1:1:a),G=pt(fv(r-Z,R/10),24),$=r>=m&&(v==1||v==3&&G<=m||v==2&&G>=m)?m:ft,K=ti(d,G<$&&r>=$?$:ss($,G)),he=O*(E==0?e==0?.1:1:c),ue=pt(tc(e+he,R/10),24),Q=e<=w&&(S==1||S==3&&ue>=w||S==2&&ue<=w)?w:-ft,ve=ss(h,ue>Q&&e<=Q?Q:ti(Q,ue));return K==ve&&K==0&&(ve=100),[K,ve]}const Iy=new Intl.NumberFormat(Qo?Py.language:"en-US"),jh=r=>Iy.format(r),ki=Math,Au=ki.PI,ln=ki.abs,Ai=ki.floor,rn=ki.round,Ui=ki.ceil,ss=ki.min,ti=ki.max,jo=ki.pow,Gm=ki.sign,Ls=ki.log10,uv=ki.log2,Ry=(r,e=1)=>ki.sinh(r)*e,Ud=(r,e=1)=>ki.asinh(r/e),ft=1/0;function Wm(r){return(Ls((r^r>>31)-(r>>31))|0)+1}function ch(r,e,n){return ss(ti(r,e),n)}function cv(r){return typeof r=="function"}function Ye(r){return cv(r)?r:()=>r}const Ny=()=>{},dv=r=>r,hv=(r,e)=>e,My=r=>null,Fm=r=>!0,Hm=(r,e)=>r==e,Ly=/\.\d*?(?=9{6,}|0{6,})/gm,Xr=r=>{if(mv(r)||yr.has(r))return r;const e=`${r}`,n=e.match(Ly);if(n==null)return r;let s=n[0].length-1;if(e.indexOf("e-")!=-1){let[l,a]=e.split("e");return+`${Xr(l)}e${a}`}return pt(r,s)};function Ur(r,e){return Xr(pt(Xr(r/e))*e)}function tc(r,e){return Xr(Ui(Xr(r/e))*e)}function fv(r,e){return Xr(Ai(Xr(r/e))*e)}function pt(r,e=0){if(mv(r))return r;let n=10**e,s=r*n*(1+Number.EPSILON);return rn(s)/n}const yr=new Map;function pv(r){return((""+r).split(".")[1]||"").length}function Zl(r,e,n,s){let l=[],a=s.map(pv);for(let c=e;c=0?0:d)+(c>=a[m]?0:a[m]),S=r==10?w:pt(w,v);l.push(S),yr.set(S,v)}}return l}const $l={},Bh=[],Bo=[null,null],wr=Array.isArray,mv=Number.isInteger,Vy=r=>r===void 0;function jm(r){return typeof r=="string"}function nc(r){let e=!1;if(r!=null){let n=r.constructor;e=n==null||n==Object}return e}function Gy(r){return r!=null&&typeof r=="object"}const Wy=Object.getPrototypeOf(Uint8Array),gv="__proto__";function Uo(r,e=nc){let n;if(wr(r)){let s=r.find(l=>l!=null);if(wr(s)||e(s)){n=Array(r.length);for(let l=0;la){for(l=c-1;l>=0&&r[l]==null;)r[l--]=null;for(l=c+1;lc-d)],l=s[0].length,a=new Map;for(let c=0;c"u"?r=>Promise.resolve().then(r):queueMicrotask;function Yy(r){let e=r[0],n=e.length,s=Array(n);for(let a=0;ae[a]-e[c]);let l=[];for(let a=0;a=s&&r[l]==null;)l--;if(l<=s)return!0;const a=ti(1,Ai((l-s+1)/e));for(let c=r[s],d=s+a;d<=l;d+=a){const h=r[d];if(h!=null){if(h<=c)return!1;c=h}}return!0}const vv=["January","February","March","April","May","June","July","August","September","October","November","December"],wv=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function _v(r){return r.slice(0,3)}const Qy=wv.map(_v),Zy=vv.map(_v),Xy={MMMM:vv,MMM:Zy,WWWW:wv,WWW:Qy};function Nl(r){return(r<10?"0":"")+r}function qy(r){return(r<10?"00":r<100?"0":"")+r}const eS={YYYY:r=>r.getFullYear(),YY:r=>(r.getFullYear()+"").slice(2),MMMM:(r,e)=>e.MMMM[r.getMonth()],MMM:(r,e)=>e.MMM[r.getMonth()],MM:r=>Nl(r.getMonth()+1),M:r=>r.getMonth()+1,DD:r=>Nl(r.getDate()),D:r=>r.getDate(),WWWW:(r,e)=>e.WWWW[r.getDay()],WWW:(r,e)=>e.WWW[r.getDay()],HH:r=>Nl(r.getHours()),H:r=>r.getHours(),h:r=>{let e=r.getHours();return e==0?12:e>12?e-12:e},AA:r=>r.getHours()>=12?"PM":"AM",aa:r=>r.getHours()>=12?"pm":"am",a:r=>r.getHours()>=12?"p":"a",mm:r=>Nl(r.getMinutes()),m:r=>r.getMinutes(),ss:r=>Nl(r.getSeconds()),s:r=>r.getSeconds(),fff:r=>qy(r.getMilliseconds())};function Uh(r,e){e=e||Xy;let n=[],s=/\{([a-z]+)\}|[^{]+/gi,l;for(;l=s.exec(r);)n.push(l[0][0]=="{"?eS[l[1]]:l[0]);return a=>{let c="";for(let d=0;dr%1==0,Hu=[1,2,2.5,5],iS=Zl(10,-32,0,Hu),Sv=Zl(10,0,32,Hu),sS=Sv.filter(yv),$r=iS.concat(Sv),$h=` -`,Dv="{YYYY}",Bm=$h+Dv,Cv="{M}/{D}",Fl=$h+Cv,wu=Fl+"/{YY}",xv="{aa}",rS="{h}:{mm}",Lo=rS+xv,Um=$h+Lo,$m=":{ss}",rt=null;function Ev(r){let e=r*1e3,n=e*60,s=n*60,l=s*24,a=l*30,c=l*365,h=(r==1?Zl(10,0,3,Hu).filter(yv):Zl(10,-3,0,Hu)).concat([e,e*5,e*10,e*15,e*30,n,n*5,n*10,n*15,n*30,s,s*2,s*3,s*4,s*6,s*8,s*12,l,l*2,l*3,l*4,l*5,l*6,l*7,l*8,l*9,l*10,l*15,a,a*2,a*3,a*4,a*6,c,c*2,c*5,c*10,c*25,c*50,c*100]);const m=[[c,Dv,rt,rt,rt,rt,rt,rt,1],[l*28,"{MMM}",Bm,rt,rt,rt,rt,rt,1],[l,Cv,Bm,rt,rt,rt,rt,rt,1],[s,"{h}"+xv,wu,rt,Fl,rt,rt,rt,1],[n,Lo,wu,rt,Fl,rt,rt,rt,1],[e,$m,wu+" "+Lo,rt,Fl+" "+Lo,rt,Um,rt,1],[r,$m+".{fff}",wu+" "+Lo,rt,Fl+" "+Lo,rt,Um,rt,1]];function w(v){return(S,E,A,D,P,N)=>{let O=[],M=P>=c,R=P>=a&&P=l?l:P,ue=Ai(A)-Ai(G),Q=K+ue+tc(G-K,he);O.push(Q);let ve=v(Q),ie=ve.getHours()+ve.getMinutes()/n+ve.getSeconds()/s,ce=P/s,j=S.axes[E]._space,te=N/j;for(;Q=pt(Q+P,r==1?0:3),!(Q>D);)if(ce>1){let X=Ai(pt(ie+ce,6))%24,ne=v(Q).getHours()-X;ne>1&&(ne=-1),Q-=ne*s,ie=(ie+ce)%24;let z=O[O.length-1];pt((Q-z)/P,3)*te>=.7&&O.push(Q)}else O.push(Q)}return O}}return[h,m,w]}const[oS,lS,aS]=Ev(1),[uS,cS,dS]=Ev(.001);Zl(2,-53,53,[1]);function Ym(r,e){return r.map(n=>n.map((s,l)=>l==0||l==8||s==null?s:e(l==1||n[8]==0?s:n[1]+s)))}function Km(r,e){return(n,s,l,a,c)=>{let d=e.find(A=>c>=A[0])||e[e.length-1],h,m,w,v,S,E;return s.map(A=>{let D=r(A),P=D.getFullYear(),N=D.getMonth(),O=D.getDate(),M=D.getHours(),R=D.getMinutes(),Z=D.getSeconds(),G=P!=h&&d[2]||N!=m&&d[3]||O!=w&&d[4]||M!=v&&d[5]||R!=S&&d[6]||Z!=E&&d[7]||d[1];return h=P,m=N,w=O,v=M,S=R,E=Z,G(D)})}}function hS(r,e){let n=Uh(e);return(s,l,a,c,d)=>l.map(h=>n(r(h)))}function $d(r,e,n){return new Date(r,e,n)}function Jm(r,e){return e(r)}const fS="{YYYY}-{MM}-{DD} {h}:{mm}{aa}";function Qm(r,e){return(n,s,l,a)=>a==null?Gh:e(r(s))}function pS(r,e){let n=r.series[e];return n.width?n.stroke(r,e):n.points.width?n.points.stroke(r,e):null}function mS(r,e){return r.series[e].fill(r,e)}const gS={show:!0,live:!0,isolate:!1,mount:Ny,markers:{show:!0,width:2,stroke:pS,fill:mS,dash:"solid"},idx:null,idxs:null,values:[]};function vS(r,e){let n=r.cursor.points,s=Hi(),l=n.size(r,e);wt(s,Gl,l),wt(s,Wl,l);let a=l/-2;wt(s,"marginLeft",a),wt(s,"marginTop",a);let c=n.width(r,e,l);return c&&wt(s,"borderWidth",c),s}function wS(r,e){let n=r.series[e].points;return n._fill||n._stroke}function _S(r,e){let n=r.series[e].points;return n._stroke||n._fill}function yS(r,e){return r.series[e].points.size}const Yd=[0,0];function SS(r,e,n){return Yd[0]=e,Yd[1]=n,Yd}function _u(r,e,n,s=!0){return l=>{l.button==0&&(!s||l.target==e)&&n(l)}}function Kd(r,e,n,s=!0){return l=>{(!s||l.target==e)&&n(l)}}const DS={show:!0,x:!0,y:!0,lock:!1,move:SS,points:{one:!1,show:vS,size:yS,width:0,stroke:_S,fill:wS},bind:{mousedown:_u,mouseup:_u,click:_u,dblclick:_u,mousemove:Kd,mouseleave:Kd,mouseenter:Kd},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,click:(r,e)=>{e.stopPropagation(),e.stopImmediatePropagation()},_x:!1,_y:!1},focus:{dist:(r,e,n,s,l)=>s-l,prox:-1,bias:0},hover:{skip:[void 0],prox:null,bias:0},left:-10,top:-10,idx:null,dataIdx:null,idxs:null,event:null},bv={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},Yh=Jt({},bv,{filter:hv}),Pv=Jt({},Yh,{size:10}),Av=Jt({},bv,{show:!1}),Kh='12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',kv="bold "+Kh,zv=1.5,Zm={show:!0,scale:"x",stroke:Vh,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:kv,side:2,grid:Yh,ticks:Pv,border:Av,font:Kh,lineGap:zv,rotate:0},CS="Value",xS="Time",Xm={show:!0,scale:"x",auto:!1,sorted:1,min:ft,max:-ft,idxs:[]};function ES(r,e,n,s,l){return e.map(a=>a==null?"":jh(a))}function bS(r,e,n,s,l,a,c){let d=[],h=yr.get(l)||0;n=c?n:pt(tc(n,l),h);for(let m=n;m<=s;m=pt(m+l,h))d.push(Object.is(m,-0)?0:m);return d}function dh(r,e,n,s,l,a,c){const d=[],h=r.scales[r.axes[e].scale].log,m=h==10?Ls:uv,w=Ai(m(n));l=jo(h,w),h==10&&(l=$r[is(l,$r)]);let v=n,S=l*h;h==10&&(S=$r[is(S,$r)]);do d.push(v),v=v+l,h==10&&!yr.has(v)&&(v=pt(v,yr.get(l))),v>=S&&(l=v,S=l*h,h==10&&(S=$r[is(S,$r)]));while(v<=s);return d}function PS(r,e,n,s,l,a,c){let h=r.scales[r.axes[e].scale].asinh,m=s>h?dh(r,e,ti(h,n),s,l):[h],w=s>=0&&n<=0?[0]:[];return(n<-h?dh(r,e,ti(h,-s),-n,l):[h]).reverse().map(S=>-S).concat(w,m)}const Ov=/./,AS=/[12357]/,kS=/[125]/,qm=/1/,hh=(r,e,n,s)=>r.map((l,a)=>e==4&&l==0||a%s==0&&n.test(l.toExponential()[l<0?1:0])?l:null);function zS(r,e,n,s,l){let a=r.axes[n],c=a.scale,d=r.scales[c],h=r.valToPos,m=a._space,w=h(10,c),v=h(9,c)-w>=m?Ov:h(7,c)-w>=m?AS:h(5,c)-w>=m?kS:qm;if(v==qm){let S=ln(h(1,c)-w);if(Sl,ng={show:!0,auto:!0,sorted:0,gaps:Tv,alpha:1,facets:[Jt({},tg,{scale:"x"}),Jt({},tg,{scale:"y"})]},ig={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:Tv,alpha:1,points:{show:RS,filter:null},values:null,min:ft,max:-ft,idxs:[],path:null,clip:null};function NS(r,e,n,s,l){return n/10}const Iv={time:oy,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},MS=Jt({},Iv,{time:!1,ori:1}),sg={};function Rv(r,e){let n=sg[r];return n||(n={key:r,plots:[],sub(s){n.plots.push(s)},unsub(s){n.plots=n.plots.filter(l=>l!=s)},pub(s,l,a,c,d,h,m){for(let w=0;w{let N=c.pxRound;const O=m.dir*(m.ori==0?1:-1),M=m.ori==0?Zo:Xo;let R,Z;O==1?(R=n,Z=s):(R=s,Z=n);let G=N(v(d[R],m,D,E)),$=N(S(h[R],w,P,A)),K=N(v(d[Z],m,D,E)),he=N(S(a==1?w.max:w.min,w,P,A)),ue=new Path2D(l);return M(ue,K,he),M(ue,G,he),M(ue,G,$),ue})}function ic(r,e,n,s,l,a){let c=null;if(r.length>0){c=new Path2D;const d=e==0?oc:Zh;let h=n;for(let v=0;vS[0]){let E=S[0]-h;E>0&&d(c,h,s,E,s+a),h=S[1]}}let m=n+l-h,w=10;m>0&&d(c,h,s-w/2,m,s+a+w)}return c}function VS(r,e,n){let s=r[r.length-1];s&&s[0]==e?s[1]=n:r.push([e,n])}function Qh(r,e,n,s,l,a,c){let d=[],h=r.length;for(let m=l==1?n:s;m>=n&&m<=s;m+=l)if(e[m]===null){let v=m,S=m;if(l==1)for(;++m<=s&&e[m]===null;)S=m;else for(;--m>=n&&e[m]===null;)S=m;let E=a(r[v]),A=S==v?E:a(r[S]),D=v-l;E=c<=0&&D>=0&&D=0&&N>=0&&N=E&&d.push([E,A])}return d}function rg(r){return r==0?dv:r==1?rn:e=>Ur(e,r)}function Nv(r){let e=r==0?sc:rc,n=r==0?(l,a,c,d,h,m)=>{l.arcTo(a,c,d,h,m)}:(l,a,c,d,h,m)=>{l.arcTo(c,a,h,d,m)},s=r==0?(l,a,c,d,h)=>{l.rect(a,c,d,h)}:(l,a,c,d,h)=>{l.rect(c,a,h,d)};return(l,a,c,d,h,m=0,w=0)=>{m==0&&w==0?s(l,a,c,d,h):(m=ss(m,d/2,h/2),w=ss(w,d/2,h/2),e(l,a+m,c),n(l,a+d,c,a+d,c+h,m),n(l,a+d,c+h,a,c+h,w),n(l,a,c+h,a,c,w),n(l,a,c,a+d,c,m),l.closePath())}}const sc=(r,e,n)=>{r.moveTo(e,n)},rc=(r,e,n)=>{r.moveTo(n,e)},Zo=(r,e,n)=>{r.lineTo(e,n)},Xo=(r,e,n)=>{r.lineTo(n,e)},oc=Nv(0),Zh=Nv(1),Mv=(r,e,n,s,l,a)=>{r.arc(e,n,s,l,a)},Lv=(r,e,n,s,l,a)=>{r.arc(n,e,s,l,a)},Vv=(r,e,n,s,l,a,c)=>{r.bezierCurveTo(e,n,s,l,a,c)},Gv=(r,e,n,s,l,a,c)=>{r.bezierCurveTo(n,e,l,s,c,a)};function Wv(r){return(e,n,s,l,a)=>qr(e,n,(c,d,h,m,w,v,S,E,A,D,P)=>{let{pxRound:N,points:O}=c,M,R;m.ori==0?(M=sc,R=Mv):(M=rc,R=Lv);const Z=pt(O.width*tt,3);let G=(O.size-O.width)/2*tt,$=pt(G*2,3),K=new Path2D,he=new Path2D,{left:ue,top:Q,width:ve,height:ie}=e.bbox;oc(he,ue-$,Q-$,ve+$*2,ie+$*2);const ce=j=>{if(h[j]!=null){let te=N(v(d[j],m,D,E)),X=N(S(h[j],w,P,A));M(K,te+G,X),R(K,te,X,G,0,Au*2)}};if(a)a.forEach(ce);else for(let j=s;j<=l;j++)ce(j);return{stroke:Z>0?K:null,fill:K,clip:he,flags:$o|fh}})}function Fv(r){return(e,n,s,l,a,c)=>{s!=l&&(a!=s&&c!=s&&r(e,n,s),a!=l&&c!=l&&r(e,n,l),r(e,n,c))}}const GS=Fv(Zo),WS=Fv(Xo);function Hv(r){const e=qe(r==null?void 0:r.alignGaps,0);return(n,s,l,a)=>qr(n,s,(c,d,h,m,w,v,S,E,A,D,P)=>{[l,a]=qu(h,l,a);let N=c.pxRound,O=ie=>N(v(ie,m,D,E)),M=ie=>N(S(ie,w,P,A)),R,Z;m.ori==0?(R=Zo,Z=GS):(R=Xo,Z=WS);const G=m.dir*(m.ori==0?1:-1),$={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:$o},K=$.stroke;let he=!1;if(a-l>=D*4){let ie=q=>n.posToVal(q,m.key,!0),ce=null,j=null,te,X,le,fe=O(d[G==1?l:a]),ne=O(d[l]),z=O(d[a]),F=ie(G==1?ne+1:z-1);for(let q=G==1?l:a;q>=l&&q<=a;q+=G){let xe=d[q],Se=(G==1?xeF)?fe:O(xe),Ee=h[q];Se==fe?Ee!=null?(X=Ee,ce==null?(R(K,Se,M(X)),te=ce=j=X):Xj&&(j=X)):Ee===null&&(he=!0):(ce!=null&&Z(K,fe,M(ce),M(j),M(te),M(X)),Ee!=null?(X=Ee,R(K,Se,M(X)),ce=j=te=X):(ce=j=null,Ee===null&&(he=!0)),fe=Se,F=ie(fe+G))}ce!=null&&ce!=j&&le!=fe&&Z(K,fe,M(ce),M(j),M(te),M(X))}else for(let ie=G==1?l:a;ie>=l&&ie<=a;ie+=G){let ce=h[ie];ce===null?he=!0:ce!=null&&R(K,O(d[ie]),M(ce))}let[Q,ve]=Jh(n,s);if(c.fill!=null||Q!=0){let ie=$.fill=new Path2D(K),ce=c.fillTo(n,s,c.min,c.max,Q),j=M(ce),te=O(d[l]),X=O(d[a]);G==-1&&([X,te]=[te,X]),R(ie,X,j),R(ie,te,j)}if(!c.spanGaps){let ie=[];he&&ie.push(...Qh(d,h,l,a,G,O,e)),$.gaps=ie=c.gaps(n,s,l,a,ie),$.clip=ic(ie,m.ori,E,A,D,P)}return ve!=0&&($.band=ve==2?[Vs(n,s,l,a,K,-1),Vs(n,s,l,a,K,1)]:Vs(n,s,l,a,K,ve)),$})}function FS(r){const e=qe(r.align,1),n=qe(r.ascDesc,!1),s=qe(r.alignGaps,0),l=qe(r.extend,!1);return(a,c,d,h)=>qr(a,c,(m,w,v,S,E,A,D,P,N,O,M)=>{[d,h]=qu(v,d,h);let R=m.pxRound,{left:Z,width:G}=a.bbox,$=ne=>R(A(ne,S,O,P)),K=ne=>R(D(ne,E,M,N)),he=S.ori==0?Zo:Xo;const ue={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:$o},Q=ue.stroke,ve=S.dir*(S.ori==0?1:-1);let ie=K(v[ve==1?d:h]),ce=$(w[ve==1?d:h]),j=ce,te=ce;l&&e==-1&&(te=Z,he(Q,te,ie)),he(Q,ce,ie);for(let ne=ve==1?d:h;ne>=d&&ne<=h;ne+=ve){let z=v[ne];if(z==null)continue;let F=$(w[ne]),q=K(z);e==1?he(Q,F,ie):he(Q,j,q),he(Q,F,q),ie=q,j=F}let X=j;l&&e==1&&(X=Z+G,he(Q,X,ie));let[le,fe]=Jh(a,c);if(m.fill!=null||le!=0){let ne=ue.fill=new Path2D(Q),z=m.fillTo(a,c,m.min,m.max,le),F=K(z);he(ne,X,F),he(ne,te,F)}if(!m.spanGaps){let ne=[];ne.push(...Qh(w,v,d,h,ve,$,s));let z=m.width*tt/2,F=n||e==1?z:-z,q=n||e==-1?-z:z;ne.forEach(xe=>{xe[0]+=F,xe[1]+=q}),ue.gaps=ne=m.gaps(a,c,d,h,ne),ue.clip=ic(ne,S.ori,P,N,O,M)}return fe!=0&&(ue.band=fe==2?[Vs(a,c,d,h,Q,-1),Vs(a,c,d,h,Q,1)]:Vs(a,c,d,h,Q,fe)),ue})}function og(r,e,n,s,l,a,c=ft){if(r.length>1){let d=null;for(let h=0,m=1/0;h{}),{fill:v,stroke:S}=m;return(E,A,D,P)=>qr(E,A,(N,O,M,R,Z,G,$,K,he,ue,Q)=>{let ve=N.pxRound,ie=n,ce=s*tt,j=d*tt,te=h*tt,X,le;R.ori==0?[X,le]=a(E,A):[le,X]=a(E,A);const fe=R.dir*(R.ori==0?1:-1);let ne=R.ori==0?oc:Zh,z=R.ori==0?w:(ge,et,it,hn,In,Xt,zt)=>{w(ge,et,it,In,hn,zt,Xt)},F=qe(E.bands,Bh).find(ge=>ge.series[0]==A),q=F!=null?F.dir:0,xe=N.fillTo(E,A,N.min,N.max,q),Ie=ve($(xe,Z,Q,he)),Se,Ee,We,Fe=ue,Me=ve(N.width*tt),Zt=!1,Wt=null,Ft=null,Ht=null,ii=null;v!=null&&(Me==0||S!=null)&&(Zt=!0,Wt=v.values(E,A,D,P),Ft=new Map,new Set(Wt).forEach(ge=>{ge!=null&&Ft.set(ge,new Path2D)}),Me>0&&(Ht=S.values(E,A,D,P),ii=new Map,new Set(Ht).forEach(ge=>{ge!=null&&ii.set(ge,new Path2D)})));let{x0:Tn,size:zi}=m;if(Tn!=null&&zi!=null){ie=1,O=Tn.values(E,A,D,P),Tn.unit==2&&(O=O.map(it=>E.posToVal(K+it*ue,R.key,!0)));let ge=zi.values(E,A,D,P);zi.unit==2?Ee=ge[0]*ue:Ee=G(ge[0],R,ue,K)-G(0,R,ue,K),Fe=og(O,M,G,R,ue,K,Fe),We=Fe-Ee+ce}else Fe=og(O,M,G,R,ue,K,Fe),We=Fe*c+ce,Ee=Fe-We;We<1&&(We=0),Me>=Ee/2&&(Me=0),We<5&&(ve=dv);let ls=We>0,Un=Fe-We-(ls?Me:0);Ee=ve(ch(Un,te,j)),Se=(ie==0?Ee/2:ie==fe?0:Ee)-ie*fe*((ie==0?ce/2:0)+(ls?Me/2:0));const nt={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},cn=Zt?null:new Path2D;let dn=null;if(F!=null)dn=E.data[F.series[1]];else{let{y0:ge,y1:et}=m;ge!=null&&et!=null&&(M=et.values(E,A,D,P),dn=ge.values(E,A,D,P))}let pi=X*Ee,Le=le*Ee;for(let ge=fe==1?D:P;ge>=D&&ge<=P;ge+=fe){let et=M[ge];if(et==null)continue;if(dn!=null){let qt=dn[ge]??0;if(et-qt==0)continue;Ie=$(qt,Z,Q,he)}let it=R.distr!=2||m!=null?O[ge]:ge,hn=G(it,R,ue,K),In=$(qe(et,xe),Z,Q,he),Xt=ve(hn-Se),zt=ve(ti(In,Ie)),fn=ve(ss(In,Ie)),xn=zt-fn;if(et!=null){let qt=et<0?Le:pi,En=et<0?pi:Le;Zt?(Me>0&&Ht[ge]!=null&&ne(ii.get(Ht[ge]),Xt,fn+Ai(Me/2),Ee,ti(0,xn-Me),qt,En),Wt[ge]!=null&&ne(Ft.get(Wt[ge]),Xt,fn+Ai(Me/2),Ee,ti(0,xn-Me),qt,En)):ne(cn,Xt,fn+Ai(Me/2),Ee,ti(0,xn-Me),qt,En),z(E,A,ge,Xt-Me/2,fn,Ee+Me,xn)}}return Me>0?nt.stroke=Zt?ii:cn:Zt||(nt._fill=N.width==0?N._fill:N._stroke??N._fill,nt.width=0),nt.fill=Zt?Ft:cn,nt})}function jS(r,e){const n=qe(e==null?void 0:e.alignGaps,0);return(s,l,a,c)=>qr(s,l,(d,h,m,w,v,S,E,A,D,P,N)=>{[a,c]=qu(m,a,c);let O=d.pxRound,M=X=>O(S(X,w,P,A)),R=X=>O(E(X,v,N,D)),Z,G,$;w.ori==0?(Z=sc,$=Zo,G=Vv):(Z=rc,$=Xo,G=Gv);const K=w.dir*(w.ori==0?1:-1);let he=M(h[K==1?a:c]),ue=he,Q=[],ve=[];for(let X=K==1?a:c;X>=a&&X<=c;X+=K)if(m[X]!=null){let fe=h[X],ne=M(fe);Q.push(ue=ne),ve.push(R(m[X]))}const ie={stroke:r(Q,ve,Z,$,G,O),fill:null,clip:null,band:null,gaps:null,flags:$o},ce=ie.stroke;let[j,te]=Jh(s,l);if(d.fill!=null||j!=0){let X=ie.fill=new Path2D(ce),le=d.fillTo(s,l,d.min,d.max,j),fe=R(le);$(X,ue,fe),$(X,he,fe)}if(!d.spanGaps){let X=[];X.push(...Qh(h,m,a,c,K,M,n)),ie.gaps=X=d.gaps(s,l,a,c,X),ie.clip=ic(X,w.ori,A,D,P,N)}return te!=0&&(ie.band=te==2?[Vs(s,l,a,c,ce,-1),Vs(s,l,a,c,ce,1)]:Vs(s,l,a,c,ce,te)),ie})}function BS(r){return jS(US,r)}function US(r,e,n,s,l,a){const c=r.length;if(c<2)return null;const d=new Path2D;if(n(d,r[0],e[0]),c==2)s(d,r[1],e[1]);else{let h=Array(c),m=Array(c-1),w=Array(c-1),v=Array(c-1);for(let S=0;S0!=m[S]>0?h[S]=0:(h[S]=3*(v[S-1]+v[S])/((2*v[S]+v[S-1])/m[S-1]+(v[S]+2*v[S-1])/m[S]),isFinite(h[S])||(h[S]=0));h[c-1]=m[c-2];for(let S=0;S{jn.pxRatio=tt}));const $S=Hv(),YS=Wv();function ag(r,e,n,s){return(s?[r[0],r[1]].concat(r.slice(2)):[r[0]].concat(r.slice(1))).map((a,c)=>mh(a,c,e,n))}function KS(r,e){return r.map((n,s)=>s==0?{}:Jt({},e,n))}function mh(r,e,n,s){return Jt({},e==0?n:s,r)}function jv(r,e,n){return e==null?Bo:[e,n]}const JS=jv;function QS(r,e,n){return e==null?Bo:Fu(e,n,Hh,!0)}function Bv(r,e,n,s){return e==null?Bo:ec(e,n,r.scales[s].log,!1)}const ZS=Bv;function Uv(r,e,n,s){return e==null?Bo:Fh(e,n,r.scales[s].log,!1)}const XS=Uv;function qS(r,e,n,s,l){let a=ti(Wm(r),Wm(e)),c=e-r,d=is(l/s*c,n);do{let h=n[d],m=s*h/c;if(m>=l&&a+(h<5?yr.get(h):0)<=17)return[h,m]}while(++d(e=rn((n=+l)*tt))+"px"),[r,e,n]}function eD(r){r.show&&[r.font,r.labelFont].forEach(e=>{let n=pt(e[2]*tt,1);e[0]=e[0].replace(/[0-9.]+px/,n+"px"),e[1]=n})}function jn(r,e,n){const s={mode:qe(r.mode,1)},l=s.mode;function a(g,y,C,x){let T=y.valToPct(g);return x+C*(y.dir==-1?1-T:T)}function c(g,y,C,x){let T=y.valToPct(g);return x+C*(y.dir==-1?T:1-T)}function d(g,y,C,x){return y.ori==0?a(g,y,C,x):c(g,y,C,x)}s.valToPosH=a,s.valToPosV=c;let h=!1;s.status=0;const m=s.root=Hi(ly);if(r.id!=null&&(m.id=r.id),Pi(m,r.class),r.title){let g=Hi(cy,m);g.textContent=r.title}const w=ns("canvas"),v=s.ctx=w.getContext("2d"),S=Hi(dy,m);Jr("click",S,g=>{g.target===A&&(Ze!=xs||ot!=Zs)&&tn.click(s,g)},!0);const E=s.under=Hi(hy,S);S.appendChild(w);const A=s.over=Hi(fy,S);r=Uo(r);const D=+qe(r.pxAlign,1),P=rg(D);(r.plugins||[]).forEach(g=>{g.opts&&(r=g.opts(s,r)||r)});const N=r.ms||.001,O=s.series=l==1?ag(r.series||[],Xm,ig,!1):KS(r.series||[null],ng),M=s.axes=ag(r.axes||[],Zm,eg,!0),R=s.scales={},Z=s.bands=r.bands||[];Z.forEach(g=>{g.fill=Ye(g.fill||null),g.dir=qe(g.dir,-1)});const G=l==2?O[1].facets[0].scale:O[0].scale,$={axes:da,series:gc},K=(r.drawOrder||["axes","series"]).map(g=>$[g]);function he(g){const y=g.distr==3?C=>Ls(C>0?C:g.clamp(s,C,g.min,g.max,g.key)):g.distr==4?C=>Ud(C,g.asinh):g.distr==100?C=>g.fwd(C):C=>C;return C=>{let x=y(C),{_min:T,_max:V}=g,J=V-T;return(x-T)/J}}function ue(g){let y=R[g];if(y==null){let C=(r.scales||$l)[g]||$l;if(C.from!=null){ue(C.from);let x=Jt({},R[C.from],C,{key:g});x.valToPct=he(x),R[g]=x}else{y=R[g]=Jt({},g==G?Iv:MS,C),y.key=g;let x=y.time,T=y.range,V=wr(T);if((g!=G||l==2&&!x)&&(V&&(T[0]==null||T[1]==null)&&(T={min:T[0]==null?Lm:{mode:1,hard:T[0],soft:T[0]},max:T[1]==null?Lm:{mode:1,hard:T[1],soft:T[1]}},V=!1),!V&&nc(T))){let J=T;T=(se,ae,me)=>ae==null?Bo:Fu(ae,me,J)}y.range=Ye(T||(x?JS:g==G?y.distr==3?ZS:y.distr==4?XS:jv:y.distr==3?Bv:y.distr==4?Uv:QS)),y.auto=Ye(V?!1:y.auto),y.clamp=Ye(y.clamp||NS),y._min=y._max=null,y.valToPct=he(y)}}}ue("x"),ue("y"),l==1&&O.forEach(g=>{ue(g.scale)}),M.forEach(g=>{ue(g.scale)});for(let g in r.scales)ue(g);const Q=R[G],ve=Q.distr;let ie,ce;Q.ori==0?(Pi(m,ay),ie=a,ce=c):(Pi(m,uy),ie=c,ce=a);const j={};for(let g in R){let y=R[g];(y.min!=null||y.max!=null)&&(j[g]={min:y.min,max:y.max},y.min=y.max=null)}const te=r.tzDate||(g=>new Date(rn(g/N))),X=r.fmtDate||Uh,le=N==1?aS(te):dS(te),fe=Km(te,Ym(N==1?lS:cS,X)),ne=Qm(te,Jm(fS,X)),z=[],F=s.legend=Jt({},gS,r.legend),q=s.cursor=Jt({},DS,{drag:{y:l==2}},r.cursor),xe=F.show,Ie=q.show,Se=F.markers;F.idxs=z,Se.width=Ye(Se.width),Se.dash=Ye(Se.dash),Se.stroke=Ye(Se.stroke),Se.fill=Ye(Se.fill);let Ee,We,Fe,Me=[],Zt=[],Wt,Ft=!1,Ht={};if(F.live){const g=O[1]?O[1].values:null;Ft=g!=null,Wt=Ft?g(s,1,0):{_:0};for(let y in Wt)Ht[y]=Gh}if(xe)if(Ee=ns("table",_y,m),Fe=ns("tbody",null,Ee),F.mount(s,Ee),Ft){We=ns("thead",null,Ee,Fe);let g=ns("tr",null,We);ns("th",null,g);for(var ii in Wt)ns("th",xm,g).textContent=ii}else Pi(Ee,Sy),F.live&&Pi(Ee,yy);const Tn={show:!0},zi={show:!1};function ls(g,y){if(y==0&&(Ft||!F.live||l==2))return Bo;let C=[],x=ns("tr",Dy,Fe,Fe.childNodes[y]);Pi(x,g.class),g.show||Pi(x,Yr);let T=ns("th",null,x);if(Se.show){let se=Hi(Cy,T);if(y>0){let ae=Se.width(s,y);ae&&(se.style.border=ae+"px "+Se.dash(s,y)+" "+Se.stroke(s,y)),se.style.background=Se.fill(s,y)}}let V=Hi(xm,T);g.label instanceof HTMLElement?V.appendChild(g.label):V.textContent=g.label,y>0&&(Se.show||(V.style.color=g.width>0?Se.stroke(s,y):Se.fill(s,y)),nt("click",T,se=>{if(q._lock)return;Pn(se);let ae=O.indexOf(g);if((se.ctrlKey||se.metaKey)!=F.isolate){let me=O.some((we,_e)=>_e>0&&_e!=ae&&we.show);O.forEach((we,_e)=>{_e>0&&Si(_e,me?_e==ae?Tn:zi:Tn,!0,Tt.setSeries)})}else Si(ae,{show:!g.show},!0,Tt.setSeries)},!1),Et&&nt(Am,T,se=>{q._lock||(Pn(se),Si(O.indexOf(g),er,!0,Tt.setSeries))},!1));for(var J in Wt){let se=ns("td",xy,x);se.textContent="--",C.push(se)}return[x,C]}const Un=new Map;function nt(g,y,C,x=!0){const T=Un.get(y)||{},V=q.bind[g](s,y,C,x);V&&(Jr(g,y,T[g]=V),Un.set(y,T))}function cn(g,y,C){const x=Un.get(y)||{};for(let T in x)(g==null||T==g)&&(uh(T,y,x[T]),delete x[T]);g==null&&Un.delete(y)}let dn=0,pi=0,Le=0,ge=0,et=0,it=0,hn=et,In=it,Xt=Le,zt=ge,fn=0,xn=0,qt=0,En=0;s.bbox={};let as=!1,us=!1,mi=!1,gi=!1,cs=!1,Nt=!1;function ut(g,y,C){(C||g!=s.width||y!=s.height)&&en(g,y),Cs(!1),mi=!0,us=!0,Kn()}function en(g,y){s.width=dn=Le=g,s.height=pi=ge=y,et=it=0,mn(),Rn();let C=s.bbox;fn=C.left=Ur(et*tt,.5),xn=C.top=Ur(it*tt,.5),qt=C.width=Ur(Le*tt,.5),En=C.height=Ur(ge*tt,.5)}const pn=3;function vi(){let g=!1,y=0;for(;!g;){y++;let C=rl(y),x=ca(y);g=y==pn||C&&x,g||(en(s.width,s.height),us=!0)}}function bn({width:g,height:y}){ut(g,y)}s.setSize=bn;function mn(){let g=!1,y=!1,C=!1,x=!1;M.forEach((T,V)=>{if(T.show&&T._show){let{side:J,_size:se}=T,ae=J%2,me=T.label!=null?T.labelSize:0,we=se+me;we>0&&(ae?(Le-=we,J==3?(et+=we,x=!0):C=!0):(ge-=we,J==0?(it+=we,g=!0):y=!0))}}),$n[0]=g,$n[1]=C,$n[2]=y,$n[3]=x,Le-=Yi[1]+Yi[3],et+=Yi[3],ge-=Yi[2]+Yi[0],it+=Yi[0]}function Rn(){let g=et+Le,y=it+ge,C=et,x=it;function T(V,J){switch(V){case 1:return g+=J,g-J;case 2:return y+=J,y-J;case 3:return C-=J,C+J;case 0:return x-=J,x+J}}M.forEach((V,J)=>{if(V.show&&V._show){let se=V.side;V._pos=T(se,V._size),V.label!=null&&(V._lpos=T(se,V.labelSize))}})}if(q.dataIdx==null){let g=q.hover,y=g.skip=new Set(g.skip??[]);y.add(void 0);let C=g.prox=Ye(g.prox),x=g.bias??(g.bias=0);q.dataIdx=(T,V,J,se)=>{if(V==0)return J;let ae=J,me=C(T,V,J,se)??ft,we=me>=0&&me0;)y.has($e[Pe])||(He=Pe);if(x==0||x==1)for(Pe=J;ze==null&&Pe++<$e.length;)y.has($e[Pe])||(ze=Pe);if(He!=null||ze!=null)if(we){let at=He==null?-1/0:ie(Je[He],Q,_e,0),St=ze==null?1/0:ie(Je[ze],Q,_e,0),$t=Ve-at,st=St-Ve;$t<=st?$t<=me&&(ae=He):st<=me&&(ae=ze)}else ae=ze==null?He:He==null?ze:J-He<=ze-J?He:ze}else we&&ln(Ve-ie(Je[J],Q,_e,0))>me&&(ae=null);return ae}}const Pn=g=>{q.event=g};q.idxs=z,q._lock=!1;let je=q.points;je.show=Ye(je.show),je.size=Ye(je.size),je.stroke=Ye(je.stroke),je.width=Ye(je.width),je.fill=Ye(je.fill);const xt=s.focus=Jt({},r.focus||{alpha:.3},q.focus),Et=xt.prox>=0,gn=Et&&je.one;let yt=[],An=[],jt=[];function Oi(g,y){let C=je.show(s,y);if(C instanceof HTMLElement)return Pi(C,wy),Pi(C,g.class),ws(C,-10,-10,Le,ge),A.insertBefore(C,yt[y]),C}function Ws(g,y){if(l==1||y>0){let C=l==1&&R[g.scale].time,x=g.value;g.value=C?jm(x)?Qm(te,Jm(x,X)):x||ne:x||TS,g.label=g.label||(C?xS:CS)}if(gn||y>0){g.width=g.width==null?1:g.width,g.paths=g.paths||$S||My,g.fillTo=Ye(g.fillTo||LS),g.pxAlign=+qe(g.pxAlign,D),g.pxRound=rg(g.pxAlign),g.stroke=Ye(g.stroke||null),g.fill=Ye(g.fill||null),g._stroke=g._fill=g._paths=g._focus=null;let C=IS(ti(1,g.width),1),x=g.points=Jt({},{size:C,width:ti(1,C*.2),stroke:g.stroke,space:C*2,paths:YS,_stroke:null,_fill:null},g.points);x.show=Ye(x.show),x.filter=Ye(x.filter),x.fill=Ye(x.fill),x.stroke=Ye(x.stroke),x.paths=Ye(x.paths),x.pxAlign=g.pxAlign}if(xe){let C=ls(g,y);Me.splice(y,0,C[0]),Zt.splice(y,0,C[1]),F.values.push(null)}if(Ie){z.splice(y,0,null);let C=null;gn?y==0&&(C=Oi(g,y)):y>0&&(C=Oi(g,y)),yt.splice(y,0,C),An.splice(y,0,0),jt.splice(y,0,0)}Ut("addSeries",y)}function fc(g,y){y=y??O.length,g=l==1?mh(g,y,Xm,ig):mh(g,y,{},ng),O.splice(y,0,g),Ws(O[y],y)}s.addSeries=fc;function pc(g){if(O.splice(g,1),xe){F.values.splice(g,1),Zt.splice(g,1);let y=Me.splice(g,1)[0];cn(null,y.firstChild),y.remove()}Ie&&(z.splice(g,1),yt.splice(g,1)[0].remove(),An.splice(g,1),jt.splice(g,1)),Ut("delSeries",g)}s.delSeries=pc;const $n=[!1,!1,!1,!1];function ra(g,y){if(g._show=g.show,g.show){let C=g.side%2,x=R[g.scale];x==null&&(g.scale=C?O[1].scale:G,x=R[g.scale]);let T=x.time;g.size=Ye(g.size),g.space=Ye(g.space),g.rotate=Ye(g.rotate),wr(g.incrs)&&g.incrs.forEach(J=>{!yr.has(J)&&yr.set(J,pv(J))}),g.incrs=Ye(g.incrs||(x.distr==2?sS:T?N==1?oS:uS:$r)),g.splits=Ye(g.splits||(T&&x.distr==1?le:x.distr==3?dh:x.distr==4?PS:bS)),g.stroke=Ye(g.stroke),g.grid.stroke=Ye(g.grid.stroke),g.ticks.stroke=Ye(g.ticks.stroke),g.border.stroke=Ye(g.border.stroke);let V=g.values;g.values=wr(V)&&!wr(V[0])?Ye(V):T?wr(V)?Km(te,Ym(V,X)):jm(V)?hS(te,V):V||fe:V||ES,g.filter=Ye(g.filter||(x.distr>=3&&x.log==10?zS:x.distr==3&&x.log==2?OS:hv)),g.font=ug(g.font),g.labelFont=ug(g.labelFont),g._size=g.size(s,null,y,0),g._space=g._rotate=g._incrs=g._found=g._splits=g._values=null,g._size>0&&($n[y]=!0,g._el=Hi(py,S))}}function Fs(g,y,C,x){let[T,V,J,se]=C,ae=y%2,me=0;return ae==0&&(se||V)&&(me=y==0&&!T||y==2&&!J?rn(Zm.size/3):0),ae==1&&(T||J)&&(me=y==1&&!V||y==3&&!se?rn(eg.size/2):0),me}const oa=s.padding=(r.padding||[Fs,Fs,Fs,Fs]).map(g=>Ye(qe(g,Fs))),Yi=s._padding=oa.map((g,y)=>g(s,y,$n,0));let Bt,Mt=null,Lt=null;const to=l==1?O[0].idxs:null;let wi=null,ct=!1;function la(g,y){if(e=g??[],s.data=s._data=e,l==2){Bt=0;for(let C=1;C=0,Nt=!0,Kn()}}s.setData=la;function Sr(){ct=!0;let g,y;l==1&&(Bt>0?(Mt=to[0]=0,Lt=to[1]=Bt-1,g=e[0][Mt],y=e[0][Lt],ve==2?(g=Mt,y=Lt):g==y&&(ve==3?[g,y]=ec(g,g,Q.log,!1):ve==4?[g,y]=Fh(g,g,Q.log,!1):Q.time?y=g+rn(86400/N):[g,y]=Fu(g,y,Hh,!0))):(Mt=to[0]=g=null,Lt=to[1]=y=null)),yi(G,g,y)}let Dr,Ki,qo,no,Hs,si,el,Yn,tl,Nn;function aa(g,y,C,x,T,V){g??(g=bm),C??(C=Bh),x??(x="butt"),T??(T=bm),V??(V="round"),g!=Dr&&(v.strokeStyle=Dr=g),T!=Ki&&(v.fillStyle=Ki=T),y!=qo&&(v.lineWidth=qo=y),V!=Hs&&(v.lineJoin=Hs=V),x!=si&&(v.lineCap=si=x),C!=no&&v.setLineDash(no=C)}function Cr(g,y,C,x){y!=Ki&&(v.fillStyle=Ki=y),g!=el&&(v.font=el=g),C!=Yn&&(v.textAlign=Yn=C),x!=tl&&(v.textBaseline=tl=x)}function js(g,y,C,x,T=0){if(x.length>0&&g.auto(s,ct)&&(y==null||y.min==null)){let V=qe(Mt,0),J=qe(Lt,x.length-1),se=C.min==null?zy(x,V,J,T,g.distr==3):[C.min,C.max];g.min=ss(g.min,C.min=se[0]),g.max=ti(g.max,C.max=se[1])}}const Bs={min:null,max:null};function io(){for(let x in R){let T=R[x];j[x]==null&&(T.min==null||j[G]!=null&&T.auto(s,ct))&&(j[x]=Bs)}for(let x in R){let T=R[x];j[x]==null&&T.from!=null&&j[T.from]!=null&&(j[x]=Bs)}j[G]!=null&&Cs(!0);let g={};for(let x in j){let T=j[x];if(T!=null){let V=g[x]=Uo(R[x],Gy);if(T.min!=null)Jt(V,T);else if(x!=G||l==2)if(Bt==0&&V.from==null){let J=V.range(s,null,null,x);V.min=J[0],V.max=J[1]}else V.min=ft,V.max=-ft}}if(Bt>0){O.forEach((x,T)=>{if(l==1){let V=x.scale,J=j[V];if(J==null)return;let se=g[V];if(T==0){let ae=se.range(s,se.min,se.max,V);se.min=ae[0],se.max=ae[1],Mt=is(se.min,e[0]),Lt=is(se.max,e[0]),Lt-Mt>1&&(e[0][Mt]se.max&&Lt--),x.min=wi[Mt],x.max=wi[Lt]}else x.show&&x.auto&&js(se,J,x,e[T],x.sorted);x.idxs[0]=Mt,x.idxs[1]=Lt}else if(T>0&&x.show&&x.auto){let[V,J]=x.facets,se=V.scale,ae=J.scale,[me,we]=e[T],_e=g[se],Ve=g[ae];_e!=null&&js(_e,j[se],V,me,V.sorted),Ve!=null&&js(Ve,j[ae],J,we,J.sorted),x.min=J.min,x.max=J.max}});for(let x in g){let T=g[x],V=j[x];if(T.from==null&&(V==null||V.min==null)){let J=T.range(s,T.min==ft?null:T.min,T.max==-ft?null:T.max,x);T.min=J[0],T.max=J[1]}}}for(let x in g){let T=g[x];if(T.from!=null){let V=g[T.from];if(V.min==null)T.min=T.max=null;else{let J=T.range(s,V.min,V.max,x);T.min=J[0],T.max=J[1]}}}let y={},C=!1;for(let x in g){let T=g[x],V=R[x];if(V.min!=T.min||V.max!=T.max){V.min=T.min,V.max=T.max;let J=V.distr;V._min=J==3?Ls(V.min):J==4?Ud(V.min,V.asinh):J==100?V.fwd(V.min):V.min,V._max=J==3?Ls(V.max):J==4?Ud(V.max,V.asinh):J==100?V.fwd(V.max):V.max,y[x]=C=!0}}if(C){O.forEach((x,T)=>{l==2?T>0&&y.y&&(x._paths=null):y[x.scale]&&(x._paths=null)});for(let x in y)mi=!0,Ut("setScale",x);Ie&&q.left>=0&&(gi=Nt=!0)}for(let x in j)j[x]=null}function mc(g){let y=ch(Mt-1,0,Bt-1),C=ch(Lt+1,0,Bt-1);for(;g[y]==null&&y>0;)y--;for(;g[C]==null&&C0){let g=O.some(y=>y._focus)&&Nn!=xt.alpha;g&&(v.globalAlpha=Nn=xt.alpha),O.forEach((y,C)=>{if(C>0&&y.show&&(so(C,!1),so(C,!0),y._paths==null)){let x=Nn;Nn!=y.alpha&&(v.globalAlpha=Nn=y.alpha);let T=l==2?[0,e[C][0].length-1]:mc(e[C]);y._paths=y.paths(s,C,T[0],T[1]),Nn!=x&&(v.globalAlpha=Nn=x)}}),O.forEach((y,C)=>{if(C>0&&y.show){let x=Nn;Nn!=y.alpha&&(v.globalAlpha=Nn=y.alpha),y._paths!=null&&nl(C,!1);{let T=y._paths!=null?y._paths.gaps:null,V=y.points.show(s,C,Mt,Lt,T),J=y.points.filter(s,C,V,T);(V||J)&&(y.points._paths=y.points.paths(s,C,Mt,Lt,J),nl(C,!0))}Nn!=x&&(v.globalAlpha=Nn=x),Ut("drawSeries",C)}}),g&&(v.globalAlpha=Nn=1)}}function so(g,y){let C=y?O[g].points:O[g];C._stroke=C.stroke(s,g),C._fill=C.fill(s,g)}function nl(g,y){let C=y?O[g].points:O[g],{stroke:x,fill:T,clip:V,flags:J,_stroke:se=C._stroke,_fill:ae=C._fill,_width:me=C.width}=C._paths;me=pt(me*tt,3);let we=null,_e=me%2/2;y&&ae==null&&(ae=me>0?"#fff":se);let Ve=C.pxAlign==1&&_e>0;if(Ve&&v.translate(_e,_e),!y){let Je=fn-me/2,$e=xn-me/2,He=qt+me,ze=En+me;we=new Path2D,we.rect(Je,$e,He,ze)}y?sl(se,me,C.dash,C.cap,ae,x,T,J,V):il(g,se,me,C.dash,C.cap,ae,x,T,J,we,V),Ve&&v.translate(-_e,-_e)}function il(g,y,C,x,T,V,J,se,ae,me,we){let _e=!1;ae!=0&&Z.forEach((Ve,Je)=>{if(Ve.series[0]==g){let $e=O[Ve.series[1]],He=e[Ve.series[1]],ze=($e._paths||$l).band;wr(ze)&&(ze=Ve.dir==1?ze[0]:ze[1]);let Pe,at=null;$e.show&&ze&&Ty(He,Mt,Lt)?(at=Ve.fill(s,Je)||V,Pe=$e._paths.clip):ze=null,sl(y,C,x,T,at,J,se,ae,me,we,Pe,ze),_e=!0}}),_e||sl(y,C,x,T,V,J,se,ae,me,we)}const Us=$o|fh;function sl(g,y,C,x,T,V,J,se,ae,me,we,_e){aa(g,y,C,x,T),(ae||me||_e)&&(v.save(),ae&&v.clip(ae),me&&v.clip(me)),_e?(se&Us)==Us?(v.clip(_e),we&&v.clip(we),Ke(T,J),$s(g,V,y)):se&fh?(Ke(T,J),v.clip(_e),$s(g,V,y)):se&$o&&(v.save(),v.clip(_e),we&&v.clip(we),Ke(T,J),v.restore(),$s(g,V,y)):(Ke(T,J),$s(g,V,y)),(ae||me||_e)&&v.restore()}function $s(g,y,C){C>0&&(y instanceof Map?y.forEach((x,T)=>{v.strokeStyle=Dr=T,v.stroke(x)}):y!=null&&g&&v.stroke(y))}function Ke(g,y){y instanceof Map?y.forEach((C,x)=>{v.fillStyle=Ki=x,v.fill(C)}):y!=null&&g&&v.fill(y)}function ua(g,y,C,x){let T=M[g],V;if(x<=0)V=[0,0];else{let J=T._space=T.space(s,g,y,C,x),se=T._incrs=T.incrs(s,g,y,C,x,J);V=qS(y,C,se,x,J)}return T._found=V}function ro(g,y,C,x,T,V,J,se,ae,me){let we=J%2/2;D==1&&v.translate(we,we),aa(se,J,ae,me,se),v.beginPath();let _e,Ve,Je,$e,He=T+(x==0||x==3?-V:V);C==0?(Ve=T,$e=He):(_e=T,Je=He);for(let ze=0;ze{if(!C.show)return;let T=R[C.scale];if(T.min==null){C._show&&(y=!1,C._show=!1,Cs(!1));return}else C._show||(y=!1,C._show=!0,Cs(!1));let V=C.side,J=V%2,{min:se,max:ae}=T,[me,we]=ua(x,se,ae,J==0?Le:ge);if(we==0)return;let _e=T.distr==2,Ve=C._splits=C.splits(s,x,se,ae,me,we,_e),Je=T.distr==2?Ve.map(Pe=>wi[Pe]):Ve,$e=T.distr==2?wi[Ve[1]]-wi[Ve[0]]:me,He=C._values=C.values(s,C.filter(s,Je,x,we,$e),x,we,$e);C._rotate=V==2?C.rotate(s,He,x,we):0;let ze=C._size;C._size=Ui(C.size(s,He,x,g)),ze!=null&&C._size!=ze&&(y=!1)}),y}function ca(g){let y=!0;return oa.forEach((C,x)=>{let T=C(s,x,$n,g);T!=Yi[x]&&(y=!1),Yi[x]=T}),y}function da(){for(let g=0;gwi[kn]):Je,He=we.distr==2?wi[Je[1]]-wi[Je[0]]:ae,ze=y.ticks,Pe=y.border,at=ze.show?ze.size:0,St=rn(at*tt),$t=rn((y.alignTo==2?y._size-at-y.gap:y.gap)*tt),st=y._rotate*-Au/180,Dt=P(y._pos*tt),Qn=(St+$t)*se,dt=Dt+Qn;V=x==0?dt:0,T=x==1?dt:0;let vn=y.font[0],li=y.align==1?Ro:y.align==2?Hd:st>0?Ro:st<0?Hd:x==0?"center":C==3?Hd:Ro,Ci=st||x==1?"middle":C==2?Rl:Em;Cr(vn,J,li,Ci);let Ln=y.font[1]*y.lineGap,Zn=Je.map(kn=>P(d(kn,we,_e,Ve))),Xn=y._values;for(let kn=0;kn{C>0&&(y._paths=null,g&&(l==1?(y.min=null,y.max=null):y.facets.forEach(x=>{x.min=null,x.max=null})))})}let Ys=!1,Ks=!1,ri=[];function ds(){Ks=!1;for(let g=0;g0&&queueMicrotask(ds)}s.batch=xr;function Js(){if(as&&(io(),as=!1),mi&&(vi(),mi=!1),us){if(wt(E,Ro,et),wt(E,Rl,it),wt(E,Gl,Le),wt(E,Wl,ge),wt(A,Ro,et),wt(A,Rl,it),wt(A,Gl,Le),wt(A,Wl,ge),wt(S,Gl,dn),wt(S,Wl,pi),w.width=rn(dn*tt),w.height=rn(pi*tt),M.forEach(({_el:g,_show:y,_size:C,_pos:x,side:T})=>{if(g!=null)if(y){let V=T===3||T===0?C:0,J=T%2==1;wt(g,J?"left":"top",x-V),wt(g,J?"width":"height",C),wt(g,J?"top":"left",J?it:et),wt(g,J?"height":"width",J?ge:Le),ah(g,Yr)}else Pi(g,Yr)}),Dr=Ki=qo=Hs=si=el=Yn=tl=no=null,Nn=1,Or(!0),et!=hn||it!=In||Le!=Xt||ge!=zt){Cs(!1);let g=Le/Xt,y=ge/zt;if(Ie&&!gi&&q.left>=0){q.left*=g,q.top*=y,Ii&&ws(Ii,rn(q.left),0,Le,ge),Qs&&ws(Qs,0,rn(q.top),Le,ge);for(let C=0;C=0&<.width>0){lt.left*=g,lt.width*=g,lt.top*=y,lt.height*=y;for(let C in dl)wt(Es,C,lt[C])}hn=et,In=it,Xt=Le,zt=ge}Ut("setSize"),us=!1}dn>0&&pi>0&&(v.clearRect(0,0,w.width,w.height),Ut("drawClear"),K.forEach(g=>g()),Ut("draw")),lt.show&&cs&&(_i(lt),cs=!1),Ie&&gi&&(bs(null,!0,!1),gi=!1),F.show&&F.live&&Nt&&(zr(),Nt=!1),h||(h=!0,s.status=1,Ut("ready")),ct=!1,Ys=!1}s.redraw=(g,y)=>{mi=y||!1,g!==!1?yi(G,Q.min,Q.max):Kn()};function Ti(g,y){let C=R[g];if(C.from==null){if(Bt==0){let x=C.range(s,y.min,y.max,g);y.min=x[0],y.max=x[1]}if(y.min>y.max){let x=y.min;y.min=y.max,y.max=x}if(Bt>1&&y.min!=null&&y.max!=null&&y.max-y.min<1e-16)return;g==G&&C.distr==2&&Bt>0&&(y.min=is(y.min,e[0]),y.max=is(y.max,e[0]),y.min==y.max&&y.max++),j[g]=y,as=!0,Kn()}}s.setScale=Ti;let ol,oo,Ii,Qs,ll,Er,xs,Zs,Xs,qs,Ze,ot,hs=!1;const tn=q.drag;let Ot=tn.x,bt=tn.y;Ie&&(q.x&&(ol=Hi(gy,A)),q.y&&(oo=Hi(vy,A)),Q.ori==0?(Ii=ol,Qs=oo):(Ii=oo,Qs=ol),Ze=q.left,ot=q.top);const lt=s.select=Jt({show:!0,over:!0,left:0,width:0,top:0,height:0},r.select),Es=lt.show?Hi(my,lt.over?A:E):null;function _i(g,y){if(lt.show){for(let C in g)lt[C]=g[C],C in dl&&wt(Es,C,g[C]);y!==!1&&Ut("setSelect")}}s.setSelect=_i;function al(g){if(O[g].show)xe&&ah(Me[g],Yr);else if(xe&&Pi(Me[g],Yr),Ie){let C=gn?yt[0]:yt[g];C!=null&&ws(C,-10,-10,Le,ge)}}function yi(g,y,C){Ti(g,{min:y,max:C})}function Si(g,y,C,x){y.focus!=null&&ul(g),y.show!=null&&O.forEach((T,V)=>{V>0&&(g==V||g==null)&&(T.show=y.show,al(V),l==2?(yi(T.facets[0].scale,null,null),yi(T.facets[1].scale,null,null)):yi(T.scale,null,null),Kn())}),C!==!1&&Ut("setSeries",g,y),x&&Tr("setSeries",s,g,y)}s.setSeries=Si;function lo(g,y){Jt(Z[g],y)}function ao(g,y){g.fill=Ye(g.fill||null),g.dir=qe(g.dir,-1),y=y??Z.length,Z.splice(y,0,g)}function ha(g){g==null?Z.length=0:Z.splice(g,1)}s.addBand=ao,s.setBand=lo,s.delBand=ha;function Jn(g,y){O[g].alpha=y,Ie&&yt[g]!=null&&(yt[g].style.opacity=y),xe&&Me[g]&&(Me[g].style.opacity=y)}let Mn,Ri,Di;const er={focus:!0};function ul(g){if(g!=Di){let y=g==null,C=xt.alpha!=1;O.forEach((x,T)=>{if(l==1||T>0){let V=y||T==0||T==g;x._focus=y?null:V,C&&Jn(T,V?1:xt.alpha)}}),Di=g,C&&Kn()}}xe&&Et&&nt(km,Ee,g=>{q._lock||(Pn(g),Di!=null&&Si(null,er,!0,Tt.setSeries))});function oi(g,y,C){let x=R[y];C&&(g=g/tt-(x.ori==1?it:et));let T=Le;x.ori==1&&(T=ge,g=T-g),x.dir==-1&&(g=T-g);let V=x._min,J=x._max,se=g/T,ae=V+(J-V)*se,me=x.distr;return me==3?jo(10,ae):me==4?Ry(ae,x.asinh):me==100?x.bwd(ae):ae}function br(g,y){let C=oi(g,G,y);return is(C,e[0],Mt,Lt)}s.valToIdx=g=>is(g,e[0]),s.posToIdx=br,s.posToVal=oi,s.valToPos=(g,y,C)=>R[y].ori==0?a(g,R[y],C?qt:Le,C?fn:0):c(g,R[y],C?En:ge,C?xn:0),s.setCursor=(g,y,C)=>{Ze=g.left,ot=g.top,bs(null,y,C)};function Pr(g,y){wt(Es,Ro,lt.left=g),wt(Es,Gl,lt.width=y)}function cl(g,y){wt(Es,Rl,lt.top=g),wt(Es,Wl,lt.height=y)}let Ar=Q.ori==0?Pr:cl,kr=Q.ori==1?Pr:cl;function vc(){if(xe&&F.live)for(let g=l==2?1:0;g{z[x]=C}):Vy(g.idx)||z.fill(g.idx),F.idx=z[0]),xe&&F.live){for(let C=0;C0||l==1&&!Ft)&&wc(C,z[C]);vc()}Nt=!1,y!==!1&&Ut("setLegend")}s.setLegend=zr;function wc(g,y){let C=O[g],x=g==0&&ve==2?wi:e[g],T;Ft?T=C.values(s,g,y)??Ht:(T=C.value(s,y==null?null:x[y],g,y),T=T==null?Ht:{_:T}),F.values[g]=T}function bs(g,y,C){Xs=Ze,qs=ot,[Ze,ot]=q.move(s,Ze,ot),q.left=Ze,q.top=ot,Ie&&(Ii&&ws(Ii,rn(Ze),0,Le,ge),Qs&&ws(Qs,0,rn(ot),Le,ge));let x,T=Mt>Lt;Mn=ft,Ri=null;let V=Q.ori==0?Le:ge,J=Q.ori==1?Le:ge;if(Ze<0||Bt==0||T){x=q.idx=null;for(let se=0;se0&&at.show){let Qn=st==null?-10:st==x?me:ie(l==1?e[0][st]:e[Pe][0][st],Q,V,0),dt=Dt==null?-10:ce(Dt,l==1?R[at.scale]:R[at.facets[1].scale],J,0);if(Et&&Dt!=null){let vn=Q.ori==1?Ze:ot,li=ln(xt.dist(s,Pe,st,dt,vn));if(li=0?1:-1,Xn=Ln>=0?1:-1;Xn==Zn&&(Xn==1?Ci==1?Dt>=Ln:Dt<=Ln:Ci==1?Dt<=Ln:Dt>=Ln)&&(Mn=li,Ri=Pe)}else Mn=li,Ri=Pe}}if(Nt||gn){let vn,li;Q.ori==0?(vn=Qn,li=dt):(vn=dt,li=Qn);let Ci,Ln,Zn,Xn,Ni,kn,Yt=!0,Ji=je.bbox;if(Ji!=null){Yt=!1;let Vt=Ji(s,Pe);Zn=Vt.left,Xn=Vt.top,Ci=Vt.width,Ln=Vt.height}else Zn=vn,Xn=li,Ci=Ln=je.size(s,Pe);if(kn=je.fill(s,Pe),Ni=je.stroke(s,Pe),gn)Pe==Ri&&Mn<=xt.prox&&(we=Zn,_e=Xn,Ve=Ci,Je=Ln,$e=Yt,He=kn,ze=Ni);else{let Vt=yt[Pe];Vt!=null&&(An[Pe]=Zn,jt[Pe]=Xn,Mm(Vt,Ci,Ln,Yt),Rm(Vt,kn,Ni),ws(Vt,Ui(Zn),Ui(Xn),Le,ge))}}}}if(gn){let Pe=xt.prox,at=Di==null?Mn<=Pe:Mn>Pe||Ri!=Di;if(Nt||at){let St=yt[0];St!=null&&(An[0]=we,jt[0]=_e,Mm(St,Ve,Je,$e),Rm(St,He,ze),ws(St,Ui(we),Ui(_e),Le,ge))}}}if(lt.show&&hs)if(g!=null){let[se,ae]=Tt.scales,[me,we]=Tt.match,[_e,Ve]=g.cursor.sync.scales,Je=g.cursor.drag;if(Ot=Je._x,bt=Je._y,Ot||bt){let{left:$e,top:He,width:ze,height:Pe}=g.select,at=g.scales[_e].ori,St=g.posToVal,$t,st,Dt,Qn,dt,vn=se!=null&&me(se,_e),li=ae!=null&&we(ae,Ve);vn&&Ot?(at==0?($t=$e,st=ze):($t=He,st=Pe),Dt=R[se],Qn=ie(St($t,_e),Dt,V,0),dt=ie(St($t+st,_e),Dt,V,0),Ar(ss(Qn,dt),ln(dt-Qn))):Ar(0,V),li&&bt?(at==1?($t=$e,st=ze):($t=He,st=Pe),Dt=R[ae],Qn=ce(St($t,Ve),Dt,J,0),dt=ce(St($t+st,Ve),Dt,J,0),kr(ss(Qn,dt),ln(dt-Qn))):kr(0,J)}else hl()}else{let se=ln(Xs-ll),ae=ln(qs-Er);if(Q.ori==1){let Ve=se;se=ae,ae=Ve}Ot=tn.x&&se>=tn.dist,bt=tn.y&&ae>=tn.dist;let me=tn.uni;me!=null?Ot&&bt&&(Ot=se>=me,bt=ae>=me,!Ot&&!bt&&(ae>se?bt=!0:Ot=!0)):tn.x&&tn.y&&(Ot||bt)&&(Ot=bt=!0);let we,_e;Ot&&(Q.ori==0?(we=xs,_e=Ze):(we=Zs,_e=ot),Ar(ss(we,_e),ln(_e-we)),bt||kr(0,J)),bt&&(Q.ori==1?(we=xs,_e=Ze):(we=Zs,_e=ot),kr(ss(we,_e),ln(_e-we)),Ot||Ar(0,V)),!Ot&&!bt&&(Ar(0,0),kr(0,0))}if(tn._x=Ot,tn._y=bt,g==null){if(C){if(fo!=null){let[se,ae]=Tt.scales;Tt.values[0]=se!=null?oi(Q.ori==0?Ze:ot,se):null,Tt.values[1]=ae!=null?oi(Q.ori==1?Ze:ot,ae):null}Tr(jd,s,Ze,ot,Le,ge,x)}if(Et){let se=C&&Tt.setSeries,ae=xt.prox;Di==null?Mn<=ae&&Si(Ri,er,!0,se):Mn>ae?Si(null,er,!0,se):Ri!=Di&&Si(Ri,er,!0,se)}}Nt&&(F.idx=x,zr()),y!==!1&&Ut("setCursor")}let fs=null;Object.defineProperty(s,"rect",{get(){return fs==null&&Or(!1),fs}});function Or(g=!1){g?fs=null:(fs=A.getBoundingClientRect(),Ut("syncRect",fs))}function fa(g,y,C,x,T,V,J){q._lock||hs&&g!=null&&g.movementX==0&&g.movementY==0||(uo(g,y,C,x,T,V,J,!1,g!=null),g!=null?bs(null,!0,!0):bs(y,!0,!1))}function uo(g,y,C,x,T,V,J,se,ae){if(fs==null&&Or(!1),Pn(g),g!=null)C=g.clientX-fs.left,x=g.clientY-fs.top;else{if(C<0||x<0){Ze=-10,ot=-10;return}let[me,we]=Tt.scales,_e=y.cursor.sync,[Ve,Je]=_e.values,[$e,He]=_e.scales,[ze,Pe]=Tt.match,at=y.axes[0].side%2==1,St=Q.ori==0?Le:ge,$t=Q.ori==1?Le:ge,st=at?V:T,Dt=at?T:V,Qn=at?x:C,dt=at?C:x;if($e!=null?C=ze(me,$e)?d(Ve,R[me],St,0):-10:C=St*(Qn/st),He!=null?x=Pe(we,He)?d(Je,R[we],$t,0):-10:x=$t*(dt/Dt),Q.ori==1){let vn=C;C=x,x=vn}}ae&&(y==null||y.cursor.event.type==jd)&&((C<=1||C>=Le-1)&&(C=Ur(C,Le)),(x<=1||x>=ge-1)&&(x=Ur(x,ge))),se?(ll=C,Er=x,[xs,Zs]=q.move(s,C,x)):(Ze=C,ot=x)}const dl={width:0,height:0,left:0,top:0};function hl(){_i(dl,!1)}let pa,ma,co,ga;function va(g,y,C,x,T,V,J){hs=!0,Ot=bt=tn._x=tn._y=!1,uo(g,y,C,x,T,V,J,!0,!1),g!=null&&(nt(Bd,oh,wa,!1),Tr(Pm,s,xs,Zs,Le,ge,null));let{left:se,top:ae,width:me,height:we}=lt;pa=se,ma=ae,co=me,ga=we}function wa(g,y,C,x,T,V,J){hs=tn._x=tn._y=!1,uo(g,y,C,x,T,V,J,!1,!0);let{left:se,top:ae,width:me,height:we}=lt,_e=me>0||we>0,Ve=pa!=se||ma!=ae||co!=me||ga!=we;if(_e&&Ve&&_i(lt),tn.setScale&&_e&&Ve){let Je=se,$e=me,He=ae,ze=we;if(Q.ori==1&&(Je=ae,$e=we,He=se,ze=me),Ot&&yi(G,oi(Je,G),oi(Je+$e,G)),bt)for(let Pe in R){let at=R[Pe];Pe!=G&&at.from==null&&at.min!=ft&&yi(Pe,oi(He+ze,Pe),oi(He,Pe))}hl()}else q.lock&&(q._lock=!q._lock,bs(y,!0,g!=null));g!=null&&(cn(Bd,oh),Tr(Bd,s,Ze,ot,Le,ge,null))}function _a(g,y,C,x,T,V,J){if(q._lock)return;Pn(g);let se=hs;if(hs){let ae=!0,me=!0,we=10,_e,Ve;Q.ori==0?(_e=Ot,Ve=bt):(_e=bt,Ve=Ot),_e&&Ve&&(ae=Ze<=we||Ze>=Le-we,me=ot<=we||ot>=ge-we),_e&&ae&&(Ze=Ze{let T=Tt.match[2];C=T(s,y,C),C!=-1&&Si(C,x,!0,!1)},Ie&&(nt(Pm,A,va),nt(jd,A,fa),nt(Am,A,g=>{Pn(g),Or(!1)}),nt(km,A,_a),nt(zm,A,ya),ph.add(s),s.syncRect=Or);const ho=s.hooks=r.hooks||{};function Ut(g,y,C){Ks?ri.push([g,y,C]):g in ho&&ho[g].forEach(x=>{x.call(null,s,y,C)})}(r.plugins||[]).forEach(g=>{for(let y in g.hooks)ho[y]=(ho[y]||[]).concat(g.hooks[y])});const Da=(g,y,C)=>C,Tt=Jt({key:null,setSeries:!1,filters:{pub:Fm,sub:Fm},scales:[G,O[1]?O[1].scale:null],match:[Hm,Hm,Da],values:[null,null]},q.sync);Tt.match.length==2&&Tt.match.push(Da),q.sync=Tt;const fo=Tt.key,Ps=Rv(fo);function Tr(g,y,C,x,T,V,J){Tt.filters.pub(g,y,C,x,T,V,J)&&Ps.pub(g,y,C,x,T,V,J)}Ps.sub(s);function Ca(g,y,C,x,T,V,J){Tt.filters.sub(g,y,C,x,T,V,J)&&tr[g](null,y,C,x,T,V,J)}s.pub=Ca;function xa(){Ps.unsub(s),ph.delete(s),Un.clear(),uh(Wu,Fo,Sa),m.remove(),Ee==null||Ee.remove(),Ut("destroy")}s.destroy=xa;function po(){Ut("init",r,e),la(e||r.data,!1),j[G]?Ti(G,j[G]):Sr(),cs=lt.show&&(lt.width>0||lt.height>0),gi=Nt=!0,ut(r.width,r.height)}return O.forEach(Ws),M.forEach(ra),n?n instanceof HTMLElement?(n.appendChild(m),po()):n(s,po):po(),s}jn.assign=Jt;jn.fmtNum=jh;jn.rangeNum=Fu;jn.rangeLog=ec;jn.rangeAsinh=Fh;jn.orient=qr;jn.pxRatio=tt;jn.join=Uy;jn.fmtDate=Uh,jn.tzDate=nS;jn.sync=Rv;{jn.addGap=VS,jn.clipGaps=ic;let r=jn.paths={points:Wv};r.linear=Hv,r.stepped=FS,r.bars=HS,r.spline=BS}const tD=6e3;class nD{constructor(e=tD){Tl(this,"t");Tl(this,"v");Tl(this,"len",0);Tl(this,"head",0);this.t=new Float64Array(e),this.v=new Float64Array(e)}push(e,n){const s=this.t.length;this.t[this.head]=e,this.v[this.head]=n,this.head=(this.head+1)%s,this.len=e&&(a[d]=this.t[m],c[d]=this.v[m],d++)}return{t:a.subarray(0,d),v:c.subarray(0,d)}}last(){if(this.len===0)return null;const e=this.t.length;return this.v[(this.head-1+e)%e]}}const gh=new Map;function iD(r){let e=gh.get(r);return e||(e=new nD,gh.set(r,e)),e}function $v(r,e){const n=iD(r);for(const[s,l]of e)n.push(s,l)}function Yv(r,e=-1/0){const n=gh.get(r);return n?n.read(e):{t:new Float64Array(0),v:new Float64Array(0)}}const Ho=new Map;let ku=[];function Kv(){ku.forEach(r=>r())}function sD(r){Ho.set(r,(Ho.get(r)||0)+1),Kv()}function rD(r){const e=(Ho.get(r)||0)-1;e<=0?Ho.delete(r):Ho.set(r,e),Kv()}function oD(){return Array.from(Ho.keys())}function lD(r){return ku.push(r),()=>{ku=ku.filter(e=>e!==r)}}const cg=3e3;let Vo=[],zu=[];function aD(r){r.length&&(Vo=Vo.concat(r),Vo.length>cg&&(Vo=Vo.slice(-cg)),zu.forEach(e=>e()))}function uD(){return Vo}function cD(r){return zu.push(r),()=>{zu=zu.filter(e=>e!==r)}}let Ou=0,Tu=[];function dg(r){Ou+=r?1:-1,Ou<0&&(Ou=0),Tu.forEach(e=>e())}function dD(){return Ou>0}function hD(r){return Tu.push(r),()=>{Tu=Tu.filter(e=>e!==r)}}let Qr=null,Jd=null;function fD(){return`${location.protocol==="https:"?"wss":"ws"}://${location.host}/api/monitor/stream`}function hg(){Qr&&Qr.readyState===WebSocket.OPEN&&Qr.send(JSON.stringify({type:"subscribe",signals:oD()}))}function fg(){Qr&&Qr.readyState===WebSocket.OPEN&&Qr.send(JSON.stringify({type:"raw",enabled:dD()}))}function Jv(){const r=new WebSocket(fD());Qr=r,r.onopen=()=>{Cn.getState().setConnected(!0),hg(),fg()},r.onclose=()=>{Cn.getState().setConnected(!1),Jd==null&&(Jd=window.setTimeout(()=>{Jd=null,Jv()},1e3))},r.onerror=()=>r.close(),r.onmessage=n=>{let s;try{s=JSON.parse(n.data)}catch{return}const l=Cn.getState();switch(s.type){case"meta":l.setMeta(s.signals,s.pairs),l.setMotors(s.motors);break;case"motors":l.setMotors(s.motors),s.status&&l.setStatus(s.status);break;case"samples":for(const[a,c]of Object.entries(s.data))$v(a,c);break;case"raw":aD(s.frames);break}};let e=null;lD(()=>{e==null&&(e=window.setTimeout(()=>{e=null,hg()},80))}),hD(fg)}async function pD(r,e=600){return r.length?(await fetch(`/api/monitor/snapshot?signals=${r.join(",")}&n=${e}`)).json():{}}async function mD(){try{return(await(await fetch("/api/monitor/motor-types")).json()).types||[]}catch{return[]}}async function gD(r,e){await fetch("/api/monitor/motor-type",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({motorId:r,motorType:e})})}const vD={pos:"#58a6ff",vel:"#3fb950",torque:"#d29922",kp:"#bc8cff",kd:"#f778ba",vel_limit:"#56d4dd",torque_limit:"#e3b341",t_mos:"#ff7b72",t_rotor:"#ffa657",status_code:"#8b949e"};function wD(r){return vD[r]||"#8b949e"}function Iu(r){const e=wD(r.field);return r.source==="cmd"?_D(e,.15):e}function vh(r){const e=r.split(":");return e.length>=3?`${e[1]} ${e[2]}`:r}function pg(r){return r.includes(":cmd.")}const mg=["pos","vel","torque","kp","kd","t_mos","t_rotor"];function _D(r,e){const n=r.replace("#",""),s=Math.min(255,Math.round(parseInt(n.slice(0,2),16)+255*e)),l=Math.min(255,Math.round(parseInt(n.slice(2,4),16)+255*e)),a=Math.min(255,Math.round(parseInt(n.slice(4,6),16)+255*e));return`rgb(${s},${l},${a})`}function Yo(r,e=3){return r==null||Number.isNaN(r)?"—":r.toFixed(e)}const gg=2e3;function yD(r,e){const n=r.map(c=>Yv(c,e)),s=new Set;for(const c of n)for(let d=0;dc-d);if(l.length>gg){const c=Math.ceil(l.length/gg);l=l.filter((d,h)=>h%c===0)}const a=[l];for(const c of n){const d=new Array(l.length).fill(null);let h=0,m=null;for(let w=0;wD.ensurePlot),n=Cn(D=>D.removeSignalFromPlot),s=Cn(D=>D.setPlotConfig),l=Cn(D=>D.plotConfigs[r]),a=Cn(D=>D.signals);B.useEffect(()=>{e(r)},[r,e]);const c=(l==null?void 0:l.signals)??[],d=(l==null?void 0:l.duration)??10,h=c.join("|"),{setNodeRef:m,isOver:w}=W_({id:`plot:${r}`,data:{panelId:r}}),v=B.useRef(null),S=B.useRef(null),E=B.useRef(0);B.useEffect(()=>{if(!v.current)return;const D=v.current,P=new Map(a.map(Z=>[Z.id,Z])),N=[{label:"t"},...c.map(Z=>{const G=P.get(Z),$=G?Iu(G):"#8b949e";return{label:vh(Z),stroke:$,width:1.5,dash:pg(Z)?[6,4]:void 0,points:{show:!1}}})],O={width:D.clientWidth||400,height:D.clientHeight||220,legend:{show:!1},series:N,cursor:{y:!1,points:{show:!0}},scales:{x:{time:!1}},axes:[{stroke:"#8b949e",grid:{stroke:"rgba(139,148,158,0.12)"},ticks:{stroke:"rgba(139,148,158,0.2)"},values:(Z,G)=>G.map($=>($-E.current).toFixed(1)+"s")},{stroke:"#8b949e",grid:{stroke:"rgba(139,148,158,0.12)"},ticks:{stroke:"rgba(139,148,158,0.2)"}}]},M=new jn(O,[[],...c.map(()=>[])],D);S.current=M;const R=new ResizeObserver(()=>{M.setSize({width:D.clientWidth,height:D.clientHeight})});return R.observe(D),()=>{R.disconnect(),M.destroy(),S.current=null}},[h,a.length]),B.useEffect(()=>{if(!c.length)return;c.forEach(sD);let D=!1;return pD(c,1200).then(P=>{if(!D)for(const[N,O]of Object.entries(P))$v(N,O)}),()=>{D=!0,c.forEach(rD)}},[h]),B.useEffect(()=>{let D=0;const P=()=>{const N=S.current;if(N&&c.length){let O=0;for(const R of c){const Z=Yv(R);Z.t.length&&(O=Math.max(O,Z.t[Z.t.length-1]))}E.current=O;const M=yD(c,O-d);N.setData(M,!1),N.setScale("x",{min:O-d,max:O})}D=requestAnimationFrame(P)};return D=requestAnimationFrame(P),()=>cancelAnimationFrame(D)},[h,d]);const A=B.useMemo(()=>new Map(a.map(D=>[D.id,D])),[a]);return Y.jsxs("div",{className:"panel plot-panel",ref:m,children:[Y.jsxs("div",{className:"plot-toolbar",children:[Y.jsx("span",{className:"muted",children:"window"}),Y.jsx("select",{value:d,onChange:D=>s(r,{duration:Number(D.target.value)}),children:[5,10,20,30,60].map(D=>Y.jsxs("option",{value:D,children:[D,"s"]},D))}),Y.jsx("div",{className:"legend",children:c.map(D=>{const P=A.get(D);return Y.jsxs("span",{className:"legend-chip",style:{borderColor:P?Iu(P):"#555"},children:[Y.jsx("span",{className:"legend-swatch",style:{background:P?Iu(P):"#555",borderStyle:pg(D)?"dashed":"solid"}}),vh(D),Y.jsx("button",{className:"legend-x",onClick:()=>n(r,D),children:"×"})]},D)})})]}),Y.jsx("div",{className:"plot-host"+(w?" drop-over":""),ref:v,children:c.length===0&&Y.jsx("div",{className:"drop-hint",children:"Drag signals here to plot — drop cmd onto fb to overlay"})})]})}const Qd=[["pos","cmd p"],["vel","cmd v"],["kp","kp"],["kd","kd"],["torque","cmd τ"]],Zd=[["pos","act p"],["vel","act v"],["torque","act τ"],["t_mos","Tmos"],["t_rotor","Trot"]];function DD(){const r=Cn(e=>e.motors);return Y.jsx("div",{className:"panel table-panel",children:Y.jsxs("table",{className:"motor-table",children:[Y.jsx("thead",{children:Y.jsxs("tr",{children:[Y.jsx("th",{children:"Motor"}),Y.jsx("th",{children:"Mode"}),Y.jsx("th",{children:"Status"}),Qd.map(([e,n])=>Y.jsx("th",{className:"cmd-col",children:n},"c"+e)),Zd.map(([e,n])=>Y.jsx("th",{children:n},"f"+e))]})}),Y.jsxs("tbody",{children:[r.length===0&&Y.jsx("tr",{children:Y.jsx("td",{colSpan:3+Qd.length+Zd.length,className:"muted center",children:"Waiting for traffic…"})}),r.map(e=>Y.jsxs("tr",{children:[Y.jsxs("td",{className:"mono",children:["m",e.motorId]}),Y.jsx("td",{className:"muted",children:e.mode||"—"}),Y.jsx("td",{children:Y.jsx("span",{className:"status-pill "+(e.status==="ENABLED"?"ok":e.status==="DISABLED"?"off":"warn"),children:e.status||"—"})}),Qd.map(([n])=>Y.jsx("td",{className:"mono cmd-col",children:Yo(e.cmd[n],n==="kp"?0:3)},"c"+n)),Zd.map(([n])=>Y.jsx("td",{className:"mono",children:Yo(e.fb[n],n.startsWith("t_")?1:3)},"f"+n))]},`${e.bus}:${e.motorId}`))]})]})})}function Xd({label:r,cmd:e,act:n,unit:s,digits:l=2}){return Y.jsxs("div",{className:"metric",children:[Y.jsxs("div",{className:"metric-label",children:[r," ",Y.jsx("span",{className:"muted",children:s})]}),Y.jsxs("div",{className:"metric-values",children:[Y.jsx("span",{className:"metric-act",children:Yo(n,l)}),e!==void 0&&Y.jsxs("span",{className:"metric-cmd",children:["⌖ ",Yo(e,l)]})]})]})}function CD(){const r=Cn(n=>n.motors),e=Cn(n=>n.motorTypes);return Y.jsxs("div",{className:"panel cards-panel",children:[r.length===0&&Y.jsx("div",{className:"muted center pad",children:"Waiting for traffic…"}),Y.jsx("div",{className:"cards-grid",children:r.map(n=>Y.jsxs("div",{className:"motor-card",children:[Y.jsxs("div",{className:"motor-card-head",children:[Y.jsxs("span",{className:"mono strong",children:["Motor ",n.motorId]}),Y.jsx("span",{className:"status-pill "+(n.status==="ENABLED"?"ok":n.status==="DISABLED"?"off":"warn"),children:n.status||"—"})]}),Y.jsxs("div",{className:"motor-card-sub",children:[Y.jsx("span",{className:"muted",children:n.mode||"—"}),e.length>0&&Y.jsxs("select",{className:"type-select",defaultValue:"",onChange:s=>s.target.value&&gD(n.motorId,s.target.value),title:"Override motor type used to scale this motor's values",children:[Y.jsx("option",{value:"",children:"set type…"}),e.map(s=>Y.jsx("option",{value:s,children:s},s))]})]}),Y.jsx(Xd,{label:"Position",unit:"rad",cmd:n.cmd.pos,act:n.fb.pos,digits:3}),Y.jsx(Xd,{label:"Velocity",unit:"rad/s",cmd:n.cmd.vel,act:n.fb.vel,digits:2}),Y.jsx(Xd,{label:"Torque",unit:"Nm",cmd:n.cmd.torque,act:n.fb.torque,digits:2}),Y.jsxs("div",{className:"temp-row",children:[Y.jsxs("span",{children:["MOS ",Yo(n.fb.t_mos,1),"°"]}),Y.jsxs("span",{children:["Rotor ",Yo(n.fb.t_rotor,1),"°"]})]})]},`${n.bus}:${n.motorId}`))})]})}function xD(r,e,n){const s=new Array(r);return new Proxy(s,{get(l,a,c){if(typeof a=="string"){const d=a.charCodeAt(0);if(d>=48&&d<=57){const h=+a;if(Number.isInteger(h)&&h>=0&&hs[w]!==m))&&(s=d,l=e(...d),n!=null&&n.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(l),a=!1),l}return c.updateDeps=d=>{s=d},c}function vg(r,e){if(r===void 0)throw new Error("Unexpected undefined");return r}const ED=(r,e)=>Math.abs(r-e)<1.01,bD=(r,e,n)=>{let s;return function(...l){r.clearTimeout(s),s=r.setTimeout(()=>e.apply(this,l),n)}};let Ml;const qd=()=>{if(Ml!==void 0)return Ml;if(typeof navigator>"u")return Ml=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Ml=!0;const r=navigator.maxTouchPoints;return Ml=navigator.platform==="MacIntel"&&r!==void 0&&r>0},wg=r=>{const{offsetWidth:e,offsetHeight:n}=r;return{width:e,height:n}},PD=r=>r,AD=r=>{const e=Math.max(r.startIndex-r.overscan,0),s=Math.min(r.endIndex+r.overscan,r.count-1)-e+1,l=new Array(s);for(let a=0;a{const n=r.scrollElement;if(!n)return;const s=r.targetWindow;if(!s)return;const l=c=>{const{width:d,height:h}=c;e({width:Math.round(d),height:Math.round(h)})};if(l(wg(n)),!s.ResizeObserver)return()=>{};const a=new s.ResizeObserver(c=>{const d=()=>{const h=c[0];if(h!=null&&h.borderBoxSize){const m=h.borderBoxSize[0];if(m){l({width:m.inlineSize,height:m.blockSize});return}}l(wg(n))};r.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(d):d()});return a.observe(n,{box:"border-box"}),()=>{a.unobserve(n)}},ju={passive:!0},zD=typeof window>"u"?!0:"onscrollend"in window,OD=(r,e,n)=>{const s=r.scrollElement;if(!s)return;const l=r.targetWindow;if(!l)return;const a=r.options.useScrollendEvent&&zD;let c=0;const d=a?null:bD(l,()=>e(c,!1),r.options.isScrollingResetDelay),h=v=>()=>{c=n(s),d==null||d(),e(c,v)},m=h(!0),w=h(!1);return s.addEventListener("scroll",m,ju),a&&s.addEventListener("scrollend",w,ju),()=>{s.removeEventListener("scroll",m),a&&s.removeEventListener("scrollend",w)}},TD=(r,e)=>OD(r,e,n=>{const{horizontal:s,isRtl:l}=r.options;return s?n.scrollLeft*(l&&-1||1):n.scrollTop}),ID=(r,e,n)=>{if(n.options.useCachedMeasurements){const s=n.indexFromElement(r),l=n.options.getItemKey(s);return n.itemSizeCache.get(l)??n.options.estimateSize(s)}if(e!=null&&e.borderBoxSize){const s=e.borderBoxSize[0];if(s)return Math.round(s[n.options.horizontal?"inlineSize":"blockSize"])}if(!e){const s=n.indexFromElement(r),l=n.options.getItemKey(s),a=n.itemSizeCache.get(l);if(a!==void 0)return a}return r[n.options.horizontal?"offsetWidth":"offsetHeight"]},RD=(r,{adjustments:e=0,behavior:n},s)=>{var l,a;(a=(l=s.scrollElement)==null?void 0:l.scrollTo)==null||a.call(l,{[s.options.horizontal?"left":"top"]:r+e,behavior:n})},ND=RD;class MD{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var n,s,l;return((l=(s=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:s.now)==null?void 0:l.call(s))??Date.now()},this.observer=(()=>{let n=null;const s=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(l=>{l.forEach(a=>{const c=()=>{const d=a.target,h=this.indexFromElement(d);if(!d.isConnected){this.observer.unobserve(d);for(const[m,w]of this.elementsCache)if(w===d){this.elementsCache.delete(m);break}return}this.shouldMeasureDuringScroll(h)&&this.resizeItem(h,this.options.measureElement(d,a,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(c):c()})}));return{disconnect:()=>{var l;(l=s())==null||l.disconnect(),n=null},observe:l=>{var a;return(a=s())==null?void 0:a.observe(l,{box:"border-box"})},unobserve:l=>{var a;return(a=s())==null?void 0:a.unobserve(l)}}})(),this.range=null,this.setOptions=n=>{var s,l;const a={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:PD,rangeExtractor:AD,onChange:()=>{},measureElement:ID,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const S in n){const E=n[S];E!==void 0&&(a[S]=E)}const c=this.options;let d=null,h=null,m=!1;if(c!==void 0&&c.enabled&&a.enabled&&a.anchorTo==="end"&&this.scrollElement!==null){const S=c.count,E=a.count,A=this.getMeasurements(),D=S>0?((s=A[0])==null?void 0:s.key)??c.getItemKey(0):null,P=S>0?((l=A[S-1])==null?void 0:l.key)??c.getItemKey(S-1):null;if(E!==S||S>0&&E>0&&(a.getItemKey(0)!==D||a.getItemKey(E-1)!==P)){m=!0;const M=S>0?this.getVirtualItemForOffset(this.getScrollOffset())??A[0]:null;M&&(d=[M.key,this.getScrollOffset()-M.start]);const R=a.followOnAppend===!0?"auto":a.followOnAppend||null;R&&E>S&&this.isAtEnd(c.scrollEndThreshold)&&(S===0||a.getItemKey(E-1)!==P)&&(h=R)}}this.options=a,m&&(this.pendingMin=0,this.itemSizeCacheVersion++);let w=!1,v=0;if(d&&this.scrollOffset!==null){const[S,E]=d,A=this.getMeasurements(),{count:D,getItemKey:P}=this.options;let N=0;for(;N{var s,l;(l=(s=this.options).onChange)==null||l.call(s,this,n)},this.maybeNotify=No(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}if(this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(a=>{this.observer.observe(a)}),this.unsubs.push(this.options.observeElementRect(this,a=>{this.scrollRect=a,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(a,c)=>{this._intendedScrollOffset!==null&&Math.abs(a-this._intendedScrollOffset)<1.5&&(a=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=c?this.getScrollOffset(){this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},d=()=>{this._iosTouching=!1,!(!qd()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};a.addEventListener("touchstart",c,ju),a.addEventListener("touchend",d,ju),this.unsubs.push(()=>{a.removeEventListener("touchstart",c),a.removeEventListener("touchend",d),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const l=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,l&&this.scrollElement&&this.options.enabled){const[a,c,d,h]=l;a!==null&&!d&&(qd()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?h!==0&&(this._iosDeferredAdjustment+=h):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),d&&this.scrollToEnd({behavior:d})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const n=this.getScrollOffset(),s=this.getMaxScrollOffset();if(n<0||n>s)return;const l=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(n,{adjustments:this.scrollAdjustments+=l,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,s)=>{const l=new Map,a=new Map;for(let c=s-1;c>=0;c--){const d=n[c];if(l.has(d.lane))continue;const h=a.get(d.lane);if(h==null||d.end>h.end?a.set(d.lane,d):d.endc.end===d.end?c.index-d.index:c.end-d.end)[0]:void 0},this.getMeasurementOptions=No(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(n,s,l,a,c,d,h)=>(this.prevLanes!==void 0&&this.prevLanes!==d&&(this.lanesChangedFlag=!0),this.prevLanes=d,this.pendingMin=null,{count:n,paddingStart:s,scrollMargin:l,getItemKey:a,enabled:c,lanes:d,laneAssignmentMode:h}),{key:!1}),this.getMeasurements=No(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:s,scrollMargin:l,getItemKey:a,enabled:c,lanes:d,laneAssignmentMode:h},m)=>{const w=this.itemSizeCache;if(!c)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const A of this.laneAssignments.keys())A>=n&&this.laneAssignments.delete(A);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(A=>{this.itemSizeCache.set(A.key,A.size)}));const v=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1),d===1){const A=this.options.gap,D=n*2;let P=this._flatMeasurements;if(!P||P.length0&&M.set(P.subarray(0,v*2)),P=M,this._flatMeasurements=P}let N;if(v===0)N=s+l;else{const M=v-1;N=P[M*2]+P[M*2+1]+A}for(let M=v;M1){N=P;const $=E[N],K=$!==void 0?S[$]:void 0;O=K?K.end+this.options.gap:s+l}else{const $=this.options.lanes===1?S[A-1]:this.getFurthestMeasurement(S,A);O=$?$.end+this.options.gap:s+l,N=$?$.lane:A%this.options.lanes,this.options.lanes>1&&M&&this.laneAssignments.set(A,N)}const R=w.get(D),Z=typeof R=="number"?R:this.options.estimateSize(A),G=O+Z;S[A]={index:A,start:O,size:Z,end:G,key:D,lane:N},E[N]=A}return this.measurementsCache=S,S},{key:!1,debug:()=>this.options.debug}),this.calculateRange=No(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,s,l,a)=>this.range=n.length>0&&s>0?LD({measurements:n,outerSize:s,scrollOffset:l,lanes:a,flat:a===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=No(()=>{let n=null,s=null;const l=this.calculateRange();return l&&(n=l.startIndex,s=l.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,s]},(n,s,l,a,c)=>a===null||c===null?[]:n({startIndex:a,endIndex:c,overscan:s,count:l}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const s=this.options.indexAttribute,l=n.getAttribute(s);return l?parseInt(l,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var s;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const l=this.scrollState.index??((s=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:s.index);if(l!==void 0&&this.range){const a=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),c=Math.max(0,l-a),d=Math.min(this.options.count-1,l+a);return n>=c&&n<=d}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((c,d)=>{c.isConnected||(this.observer.unobserve(c),this.elementsCache.delete(d))});return}const s=this.indexFromElement(n),l=this.options.getItemKey(s),a=this.elementsCache.get(l);a!==n&&(a&&this.observer.unobserve(a),this.observer.observe(n),this.elementsCache.set(l,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(s)&&this.resizeItem(s,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,s)=>{var l,a;if(n<0||n>=this.options.count)return;let c,d,h;const m=this._flatMeasurements;if(this.options.lanes===1&&m!==null)h=this.options.getItemKey(n),d=m[n*2],c=m[n*2+1];else{const S=this.measurementsCache[n];if(!S)return;h=S.key,d=S.start,c=S.size}const w=this.itemSizeCache.get(h)??c,v=s-w;if(v!==0){const S=this.options.anchorTo==="end"&&((l=this.scrollState)==null?void 0:l.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,E=S?this.getTotalSize():0,A=((a=this.scrollState)==null?void 0:a.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[n]??{index:n,key:h,start:d,size:c,end:d+c,lane:0},v,this):d[this.getVirtualIndexes(),this.getMeasurements()],(n,s)=>{const l=[];for(let a=0,c=n.length;athis.options.debug}),this.getVirtualItemForOffset=n=>{const s=this.getMeasurements();if(s.length===0)return;const l=this._flatMeasurements,a=this.options.lanes===1&&l!=null,c=Qv(0,s.length-1,a?d=>l[d*2]:d=>vg(s[d]).start,n);return vg(s[c])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(n=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=n,this.getOffsetForAlignment=(n,s,l=0)=>{if(!this.scrollElement)return 0;const a=this.getSize(),c=this.getScrollOffset();s==="auto"&&(s=n>=c+a?"end":"start"),s==="center"?n+=(l-a)/2:s==="end"&&(n-=a);const d=this.getMaxScrollOffset();return Math.max(Math.min(d,n),0)},this.getOffsetForIndex=(n,s="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const l=this.getSize(),a=this.getScrollOffset(),c=this.measurementsCache[n];if(!c)return;if(s==="auto")if(c.end>=a+l-this.options.scrollPaddingEnd)s="end";else if(c.start<=a+this.options.scrollPaddingStart)s="start";else return[a,s];if(s==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),s];const d=s==="end"?c.end+this.options.scrollPaddingEnd:c.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(d,s,c.size),s]},this.scrollToOffset=(n,{align:s="start",behavior:l="auto"}={})=>{const a=this.getOffsetForAlignment(n,s),c=this.now();this.scrollState={index:null,align:s,behavior:l,startedAt:c,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:l}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:s="auto",behavior:l="auto"}={})=>{n=Math.max(0,Math.min(n,this.options.count-1));const a=this.getOffsetForIndex(n,s);if(!a)return;const[c,d]=a,h=this.now();this.scrollState={index:n,align:d,behavior:l,startedAt:h,lastTargetOffset:c,stableFrames:0},this._scrollToOffset(c,{adjustments:void 0,behavior:l}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:s="auto"}={})=>{const l=this.getScrollOffset()+n,a=this.now();this.scrollState={index:null,align:"start",behavior:s,startedAt:a,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:n="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:n});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:n})},this.getTotalSize=()=>{var n;const s=this.getMeasurements();let l;if(s.length===0)l=this.options.paddingStart;else if(this.options.lanes===1){const a=s.length-1,c=this._flatMeasurements;c!=null?l=c[a*2]+c[a*2+1]:l=((n=s[a])==null?void 0:n.end)??0}else{const a=Array(this.options.lanes).fill(null);let c=s.length-1;for(;c>=0&&a.some(d=>d===null);){const d=s[c];a[d.lane]===null&&(a[d.lane]=d.end),c--}l=Math.max(...a.filter(d=>d!==null))}return Math.max(l-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const n=[];if(this.itemSizeCache.size===0)return n;const s=this.getMeasurements();for(const l of s)l&&this.itemSizeCache.has(l.key)&&n.push({index:l.index,key:l.key,start:l.start,size:l.size,end:l.end,lane:l.lane});return n},this._scrollToOffset=(n,{adjustments:s,behavior:l})=>{this._intendedScrollOffset=n+(s??0),this.options.scrollToFn(n,{behavior:l,adjustments:s},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,n){e!==0&&(qd()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=e:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:n}))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const s=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,l=s?s[0]:this.scrollState.lastTargetOffset,a=1,c=l!==this.scrollState.lastTargetOffset;if(!c&&ED(l,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=a){this.getScrollOffset()!==l&&this._scrollToOffset(l,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,c){const d=this.getSize()||600,h=Math.abs(l-this.getScrollOffset()),m=this.scrollState.behavior==="smooth"&&h>d;this.scrollState.lastTargetOffset=l,m||(this.scrollState.behavior="auto"),this._scrollToOffset(l,{adjustments:void 0,behavior:m?"smooth":"auto"})}this.scheduleScrollReconcile()}}const Qv=(r,e,n,s)=>{for(;r<=e;){const l=(r+e)/2|0,a=n(l);if(as)e=l-1;else return l}return r>0?r-1:0};function LD({measurements:r,outerSize:e,scrollOffset:n,lanes:s,flat:l}){const a=r.length-1,c=l?w=>l[w*2]:w=>r[w].start,d=l?w=>l[w*2]+l[w*2+1]:w=>r[w].end;if(r.length<=s)return{startIndex:0,endIndex:a};let h=Qv(0,a,c,n),m=h;if(s===1)for(;m1){const w=Array(s).fill(0);for(;mS=0&&v.some(S=>S>=n);){const S=r[h];v[S.lane]=S.start,h--}h=Math.max(0,h-h%s),m=Math.min(a,m+(s-1-m%s))}return{startIndex:h,endIndex:m}}const eh=typeof document<"u"?B.useLayoutEffect:B.useEffect;function VD({useFlushSync:r=!0,directDomUpdates:e=!1,directDomUpdatesMode:n="transform",...s}){const l=B.useReducer(m=>m+1,0)[1],a=B.useRef({enabled:e,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});a.current.enabled=e,a.current.mode=n;const c=m=>{const w=a.current;if(!w.enabled||!w.container)return;const v=m.getTotalSize();if(v!==w.lastSize){w.lastSize=v;const N=m.options.horizontal?"width":"height";w.container.style[N]=`${v}px`}const S=!!m.options.horizontal,E=w.mode==="transform",A=S?"left":"top",D=m.options.scrollMargin,P=m.getVirtualItems();for(const N of P){const O=N.start-D,M=m.elementsCache.get(N.key);M&&w.lastPositions.get(M)!==O&&(w.lastPositions.set(M,O),E?M.style.transform=S?`translate3d(${O}px, 0, 0)`:`translate3d(0, ${O}px, 0)`:M.style[A]=`${O}px`)}},d={...s,onChange:(m,w)=>{var v;const S=a.current;let E=!0;if(S.enabled){c(m);const A=m.range,D=S.prevRange;E=!D||D.isScrolling!==m.isScrolling||D.startIndex!==(A==null?void 0:A.startIndex)||D.endIndex!==(A==null?void 0:A.endIndex),E&&(S.prevRange=A?{startIndex:A.startIndex,endIndex:A.endIndex,isScrolling:m.isScrolling}:null)}E&&(r&&w?Kr.flushSync(l):l()),(v=s.onChange)==null||v.call(s,m,w)}},[h]=B.useState(()=>{const m=new MD(d);return Object.assign(m,{containerRef:w=>{const v=a.current;if(v.container=w,v.lastSize=null,w&&v.enabled){const S=m.getTotalSize();v.lastSize=S;const E=m.options.horizontal?"width":"height";w.style[E]=`${S}px`}}})});return h.setOptions(d),eh(()=>h._didMount(),[]),eh(()=>h._willUpdate()),eh(()=>{c(h)}),h}function GD(r){return VD({observeElementRect:kD,observeElementOffset:TD,scrollToFn:ND,...r})}const WD={pos:"p",vel:"v",torque:"τ",kp:"kp",kd:"kd",vel_limit:"vlim",torque_limit:"τlim",t_mos:"Tm",t_rotor:"Tr"},FD=["pos","vel","torque","kp","kd","t_mos","t_rotor"];function HD(r){const e=[];for(const n of FD)n in r.fields&&e.push(`${WD[n]||n} ${r.fields[n].toFixed(2)}`);return e.join(" ")||r.note||""}function jD(r){const e=new Date(r*1e3),n=String(e.getHours()).padStart(2,"0"),s=String(e.getMinutes()).padStart(2,"0"),l=String(e.getSeconds()).padStart(2,"0"),a=String(Math.floor(r%1*1e3)).padStart(3,"0");return`${n}:${s}:${l}.${a}`}function BD(){const[,r]=B.useState(0),[e,n]=B.useState(!1),s=B.useRef(null),l=B.useRef([]);B.useEffect(()=>{dg(!0);const d=cD(()=>{e||(l.current=uD(),r(h=>h+1))});return()=>{dg(!1),d()}},[e]);const a=l.current,c=GD({count:a.length,getScrollElement:()=>s.current,estimateSize:()=>22,overscan:12});return B.useEffect(()=>{!e&&a.length&&c.scrollToIndex(a.length-1)},[a.length,e,c]),Y.jsxs("div",{className:"panel rawlog-panel",children:[Y.jsxs("div",{className:"rawlog-toolbar",children:[Y.jsx("button",{className:e?"btn small":"btn small active",onClick:()=>n(d=>!d),children:e?"Resume":"Pause"}),Y.jsxs("span",{className:"muted",children:[a.length," frames"]})]}),Y.jsxs("div",{className:"rawlog-body",ref:s,children:[Y.jsxs("div",{className:"rawlog-head",children:[Y.jsx("span",{className:"c-t",children:"time"}),Y.jsx("span",{className:"c-arb",children:"arb"}),Y.jsx("span",{className:"c-m",children:"motor"}),Y.jsx("span",{className:"c-k",children:"kind"}),Y.jsx("span",{className:"c-f",children:"decoded"}),Y.jsx("span",{className:"c-r",children:"raw"})]}),Y.jsx("div",{style:{height:c.getTotalSize(),position:"relative"},children:c.getVirtualItems().map(d=>{const h=a[d.index];return Y.jsxs("div",{className:"rawlog-row k-"+h.kind,style:{transform:`translateY(${d.start}px)`},children:[Y.jsx("span",{className:"c-t mono",children:jD(h.t)}),Y.jsxs("span",{className:"c-arb mono",children:["0x",h.arb.toString(16).toUpperCase()]}),Y.jsxs("span",{className:"c-m mono",children:["m",h.motorId]}),Y.jsx("span",{className:"c-k",children:h.mode||h.kind}),Y.jsx("span",{className:"c-f mono",children:HD(h)}),Y.jsx("span",{className:"c-r mono dim",children:h.raw})]},h.seq)})})]})]})}const Xh=[{kind:"plot",title:"Plot",icon:"〜",description:"Time-series chart; drag signals onto it (cmd over fb to overlay).",render:r=>Y.jsx(SD,{panelId:r})},{kind:"table",title:"Motor Table",icon:"▦",description:"One row per motor: commanded vs actual.",render:()=>Y.jsx(DD,{})},{kind:"cards",title:"Motor Cards",icon:"▢",description:"Per-motor cards/gauges with big readouts.",render:()=>Y.jsx(CD,{})},{kind:"rawlog",title:"Raw CAN Log",icon:"≣",description:"Scrolling decoded frame log.",render:()=>Y.jsx(BD,{})}],UD=Object.fromEntries(Xh.map(r=>[r.kind,r])),$D=Object.fromEntries(Xh.map(r=>[r.kind,e=>r.render(e.api.id)]));let wh=null;const yu={};function YD(r){wh=r}function KD(r){if(!wh)return;const e=UD[r];if(!e)return;yu[r]=(yu[r]||0)+1;const n=`${r}-${Date.now().toString(36)}-${yu[r]}`;wh.addPanel({id:n,component:r,title:`${e.title} ${yu[r]}`})}function JD(){const r=Cn(s=>s.connected),e=Cn(s=>s.status),n=()=>{localStorage.removeItem("damiao.monitor.layout"),localStorage.removeItem("damiao.monitor.plotConfigs"),location.reload()};return Y.jsxs("header",{className:"toolbar",children:[Y.jsxs("div",{className:"brand",children:[Y.jsx("span",{className:"brand-dot"}),"DaMiao ",Y.jsx("span",{className:"brand-sub",children:"Passive Monitor"})]}),Y.jsxs("div",{className:"conn",children:[Y.jsx("span",{className:"dot "+(r?"on":"off")}),Y.jsx("span",{className:"mono",children:e!=null&&e.demo?"demo":(e==null?void 0:e.channel)||"—"}),e&&!e.demo&&Y.jsx("span",{className:"badge "+(e.listenOnly?"ok":"warn"),title:"hardware listen-only",children:e.listenOnly?"listen-only":"rx (no TX)"}),(e==null?void 0:e.error)&&Y.jsx("span",{className:"badge err",title:e.error,children:"bus error"}),e&&Y.jsxs("span",{className:"muted small",children:[e.framesSeen.toLocaleString()," frames · +",e.feedbackOffset," fb"]})]}),Y.jsx("div",{className:"spacer"}),Y.jsxs("div",{className:"actions",children:[Xh.map(s=>Y.jsxs("button",{className:"btn",title:s.description,onClick:()=>KD(s.kind),children:[Y.jsx("span",{className:"btn-icon",children:s.icon})," ",s.title]},s.kind)),Y.jsx("button",{className:"btn ghost",onClick:n,children:"Reset"})]})]})}function QD({sig:r}){const{attributes:e,listeners:n,setNodeRef:s,isDragging:l}=M_({id:`sig:${r.id}`,data:{signalId:r.id}}),a=Iu(r);return Y.jsxs("div",{ref:s,className:"sig-chip"+(l?" dragging":""),...n,...e,title:r.id,children:[Y.jsx("span",{className:"sig-swatch",style:{background:a,borderStyle:r.source==="cmd"?"dashed":"solid"}}),Y.jsxs("span",{className:"sig-name",children:[r.source,".",r.field]}),r.unit&&Y.jsx("span",{className:"sig-unit",children:r.unit})]})}function ZD(r){return[...r].sort((e,n)=>{if(e.source!==n.source)return e.source==="cmd"?-1:1;const s=mg.indexOf(e.field),l=mg.indexOf(n.field);return(s<0?99:s)-(l<0?99:l)})}function XD(){const r=Cn(a=>a.signals),e=Cn(a=>a.status),[n,s]=B.useState(""),l=B.useMemo(()=>{const a=new Map;for(const c of r){if(n&&!c.id.toLowerCase().includes(n.toLowerCase()))continue;const d=a.get(c.motorId)||[];d.push(c),a.set(c.motorId,d)}return Array.from(a.entries()).sort((c,d)=>c[0]-d[0])},[r,n]);return Y.jsxs("aside",{className:"sidebar",children:[Y.jsxs("div",{className:"sidebar-head",children:[Y.jsx("div",{className:"sidebar-title",children:"Signals"}),Y.jsx("input",{className:"filter",placeholder:"filter…",value:n,onChange:a=>s(a.target.value)})]}),Y.jsxs("div",{className:"sidebar-body",children:[l.length===0&&Y.jsx("div",{className:"muted pad",children:e!=null&&e.error?"Bus error — see top bar.":"No signals yet. Start a controller on the bus (or run --demo)."}),l.map(([a,c])=>Y.jsxs("div",{className:"motor-group",children:[Y.jsxs("div",{className:"motor-group-title",children:["Motor ",a]}),Y.jsx("div",{className:"chips",children:ZD(c).map(d=>Y.jsx(QD,{sig:d},d.id))})]},a))]}),Y.jsxs("div",{className:"sidebar-foot muted",children:["Drag a signal onto a plot. Drop ",Y.jsx("b",{children:"cmd"})," onto its ",Y.jsx("b",{children:"fb"})," plot to overlay."]})]})}class Zv{}class _r extends Zv{constructor(e,n,s){super(),this.viewId=e,this.groupId=n,this.panelId=s}}class Yl extends Zv{constructor(e,n){super(),this.viewId=e,this.paneId=n}}class Ds{constructor(){}static getInstance(){return Ds.INSTANCE}hasData(e){return e&&e===this.proto}clearData(e){this.hasData(e)&&(this.proto=void 0,this.data=void 0)}getData(e){if(this.hasData(e))return this.data}setData(e,n){n&&(this.data=e,this.proto=n)}}Ds.INSTANCE=new Ds;function Hn(){const r=Ds.getInstance();if(r.hasData(_r.prototype))return r.getData(_r.prototype)[0]}function Ll(){const r=Ds.getInstance();if(r.hasData(Yl.prototype))return r.getData(Yl.prototype)[0]}var Zr;(function(r){r.any=(...e)=>n=>{const s=e.map(l=>l(n));return{dispose:()=>{s.forEach(l=>{l.dispose()})}}}})(Zr||(Zr={}));class qh{constructor(){this._defaultPrevented=!1}get defaultPrevented(){return this._defaultPrevented}preventDefault(){this._defaultPrevented=!0}}class Xv{constructor(){this._isAccepted=!1}get isAccepted(){return this._isAccepted}accept(){this._isAccepted=!0}}class qD{constructor(){this.events=new Map}get size(){return this.events.size}add(e,n){this.events.set(e,n)}delete(e){this.events.delete(e)}clear(){this.events.clear()}}class Bu{static create(){var e;return new Bu((e=new Error().stack)!==null&&e!==void 0?e:"")}constructor(e){this.value=e}print(){console.warn("dockview: stacktrace",this.value)}}class eC{constructor(e,n){this.callback=e,this.stacktrace=n}}class U{static setLeakageMonitorEnabled(e){e!==U.ENABLE_TRACKING&&U.MEMORY_LEAK_WATCHER.clear(),U.ENABLE_TRACKING=e}get value(){return this._last}constructor(e){this.options=e,this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=e=>{var n;!((n=this.options)===null||n===void 0)&&n.replay&&this._last!==void 0&&e(this._last);const s=new eC(e,U.ENABLE_TRACKING?Bu.create():void 0);return this._listeners.push(s),{dispose:()=>{const l=this._listeners.indexOf(s);l>-1&&this._listeners.splice(l,1)}}},U.ENABLE_TRACKING&&U.MEMORY_LEAK_WATCHER.add(this._event,Bu.create())),this._event}fire(e){var n;!((n=this.options)===null||n===void 0)&&n.replay&&(this._last=e);for(const s of this._listeners)s.callback(e)}dispose(){this._disposed||(this._disposed=!0,this._listeners.length>0&&(U.ENABLE_TRACKING&&queueMicrotask(()=>{var e;for(const n of this._listeners)console.warn("dockview: stacktrace",(e=n.stacktrace)===null||e===void 0?void 0:e.print())}),this._listeners=[]),U.ENABLE_TRACKING&&this._event&&U.MEMORY_LEAK_WATCHER.delete(this._event))}}U.ENABLE_TRACKING=!1;U.MEMORY_LEAK_WATCHER=new qD;function Be(r,e,n,s){return r.addEventListener(e,n,s),{dispose:()=>{r.removeEventListener(e,n,s)}}}class _g{constructor(){this._onFired=new U,this._currentFireCount=0,this._queued=!1,this.onEvent=e=>{const n=this._currentFireCount;return this._onFired.event(()=>{this._currentFireCount>n&&e()})}}fire(){this._currentFireCount++,!this._queued&&(this._queued=!0,queueMicrotask(()=>{this._queued=!1,this._onFired.fire()}))}dispose(){this._onFired.dispose()}}var Qt;(function(r){r.NONE={dispose:()=>{}};function e(n){return{dispose:()=>{n()}}}r.from=e})(Qt||(Qt={}));class Ne{get isDisposed(){return this._isDisposed}constructor(...e){this._isDisposed=!1,this._disposables=e}addDisposables(...e){e.forEach(n=>this._disposables.push(n))}dispose(){this._isDisposed||(this._isDisposed=!0,this._disposables.forEach(e=>e.dispose()),this._disposables=[])}}class Bn{constructor(){this._disposable=Qt.NONE}set value(e){this._disposable&&this._disposable.dispose(),this._disposable=e}dispose(){this._disposable&&(this._disposable.dispose(),this._disposable=Qt.NONE)}}class tC extends Ne{constructor(e){super(),this._onDidChange=new U,this.onDidChange=this._onDidChange.event,this._value=null,this.addDisposables(this._onDidChange,lc(e,n=>{const s=n.target.scrollWidth>n.target.clientWidth,l=n.target.scrollHeight>n.target.clientHeight;this._value={hasScrollX:s,hasScrollY:l},this._onDidChange.fire(this._value)}))}}function lc(r,e){const n=new ResizeObserver(s=>{requestAnimationFrame(()=>{const l=s[0];e(l)})});return n.observe(r),{dispose:()=>{n.unobserve(r),n.disconnect()}}}const Xl=(r,...e)=>{for(const n of e)r.classList.contains(n)&&r.classList.remove(n)},ac=(r,...e)=>{for(const n of e)r.classList.contains(n)||r.classList.add(n)},Re=(r,e,n)=>{const s=r.classList.contains(e);n&&!s&&r.classList.add(e),!n&&s&&r.classList.remove(e)};function _h(r,e){for(;r;){if(r===e)return!0;r=r.parentNode}return!1}function qv(r){return new nC(r)}class nC extends Ne{constructor(e){super(),this._onDidFocus=new U,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new U,this.onDidBlur=this._onDidBlur.event,this.addDisposables(this._onDidFocus,this._onDidBlur);let n=_h(document.activeElement,e),s=!1;const l=()=>{s=!1,n||(n=!0,this._onDidFocus.fire())},a=()=>{n&&(s=!0,window.setTimeout(()=>{s&&(s=!1,n=!1,this._onDidBlur.fire())},0))};this._refreshStateHandler=()=>{_h(document.activeElement,e)!==n&&(n?a():l())},this.addDisposables(Be(e,"focus",l,!0)),this.addDisposables(Be(e,"blur",a,!0))}refreshState(){this._refreshStateHandler()}}const ew="dv-quasiPreventDefault";function iC(r){r[ew]=!0}function yg(r){return r[ew]}function sC(r,e){const n=Array.from(e);for(const s of n){if(s.href){const a=r.createElement("link");a.href=s.href,a.type=s.type,a.rel="stylesheet",r.head.appendChild(a)}let l=[];try{s.cssRules&&(l=Array.from(s.cssRules).map(a=>a.cssText))}catch{}for(const a of l){const c=r.createElement("style");c.appendChild(r.createTextNode(a)),r.head.appendChild(c)}}}function yh(r){const{left:e,top:n,width:s,height:l}=r.getBoundingClientRect();return{left:e+window.scrollX,top:n+window.scrollY,width:s,height:l}}function rC(r){let e=r;for(;e!=null&&e.parentNode;){if(e.parentNode===document)return!0;e.parentNode instanceof DocumentFragment?e=e.parentNode.host:e=e.parentNode}return!1}function oC(r,e){r.setAttribute("data-testid",e)}function lC(r){const e=[];function n(s){if(s.nodeType===Node.ELEMENT_NODE){r.includes(s.tagName)&&e.push(s),s.shadowRoot&&n(s.shadowRoot);for(const l of s.children)n(l)}}return n(document.documentElement),e}function Uu(r=document){const e=lC(["IFRAME","WEBVIEW"]),n=new WeakMap;for(const s of e)n.set(s,s.style.pointerEvents),s.style.pointerEvents="none";return{release:()=>{var s;for(const l of e)l.style.pointerEvents=(s=n.get(l))!==null&&s!==void 0?s:"auto";e.splice(0,e.length)}}}function aC(r){function e(l){const a=[];for(let c=0;cl.startsWith("dockview-theme-")),typeof n!="string");)s=s.parentElement;return n}class uc{constructor(e){this.element=e,this._classNames=[]}setClassNames(e){for(const n of this._classNames)Re(this.element,n,!1);this._classNames=e.split(" ").filter(n=>n.trim().length>0);for(const n of this._classNames)Re(this.element,n,!0)}}const tw=100;function uC(r,e){const n=yh(r),s=yh(e);return!(n.lefts.left+s.width)}function cC(r){const e=new U;let n=r.screenX,s=r.screenY,l;const a=()=>{if(r.closed)return;const c=r.screenX,d=r.screenY;(c!==n||d!==s)&&(clearTimeout(l),l=setTimeout(()=>{e.fire()},tw),n=c,s=d),requestAnimationFrame(a)};return a(),e}function dC(r,e){let n;return new Ne(Be(r,"resize",()=>{clearTimeout(n),n=setTimeout(()=>{e()},tw)}))}function hC(r,e,n={buffer:10}){const s=n.buffer,l=r.getBoundingClientRect(),a=e.getBoundingClientRect();let c=0,d=0;const h=l.left-a.left,m=l.top-a.top,w=l.bottom-a.bottom,v=l.right-a.right;hs&&(c=-s-v),ms&&(d=-w-s),(c!==0||d!==0)&&(r.style.transform=`translate(${c}px, ${d}px)`)}function fC(r){let e=r;for(;e&&(e.style.zIndex==="auto"||e.style.zIndex==="");)e=e.parentElement;return e}function Ms(r){if(r.length===0)throw new Error("Invalid tail call");return[r.slice(0,r.length-1),r[r.length-1]]}function nw(r,e){if(r.length!==e.length)return!1;for(let n=0;n-1&&(r.splice(n,1),r.unshift(e))}function Su(r,e){const n=r.indexOf(e);n>-1&&(r.splice(n,1),r.push(e))}function pC(r,e){for(let n=0;ns===e);return n>-1?(r.splice(n,1),!0):!1}const _t=(r,e,n)=>e>n?e:Math.min(n,Math.max(r,e)),ef=()=>{let r=1;return{next:()=>(r++).toString()}},ts=(r,e)=>{const n=[];if(typeof e!="number"&&(e=r,r=0),r<=e)for(let s=r;se;s--)n.push(s);return n};class mC{set size(e){this._size=e}get size(){return this._size}get cachedVisibleSize(){return this._cachedVisibleSize}get visible(){return typeof this._cachedVisibleSize>"u"}get minimumSize(){return this.visible?this.view.minimumSize:0}get viewMinimumSize(){return this.view.minimumSize}get maximumSize(){return this.visible?this.view.maximumSize:0}get viewMaximumSize(){return this.view.maximumSize}get priority(){return this.view.priority}get snap(){return!!this.view.snap}set enabled(e){this.container.style.pointerEvents=e?"":"none"}constructor(e,n,s,l){this.container=e,this.view=n,this.disposable=l,this._cachedVisibleSize=void 0,typeof s=="number"?(this._size=s,this._cachedVisibleSize=void 0,e.classList.add("visible")):(this._size=0,this._cachedVisibleSize=s.cachedVisibleSize)}setVisible(e,n){var s;e!==this.visible&&(e?(this.size=_t((s=this._cachedVisibleSize)!==null&&s!==void 0?s:0,this.viewMinimumSize,this.viewMaximumSize),this._cachedVisibleSize=void 0):(this._cachedVisibleSize=typeof n=="number"?n:this.size,this.size=0),this.container.classList.toggle("visible",e),this.view.setVisible&&this.view.setVisible(e))}dispose(){return this.disposable.dispose(),this.view}}var ke;(function(r){r.HORIZONTAL="HORIZONTAL",r.VERTICAL="VERTICAL"})(ke||(ke={}));var ji;(function(r){r[r.MAXIMUM=0]="MAXIMUM",r[r.MINIMUM=1]="MINIMUM",r[r.DISABLED=2]="DISABLED",r[r.ENABLED=3]="ENABLED"})(ji||(ji={}));var on;(function(r){r.Low="low",r.High="high",r.Normal="normal"})(on||(on={}));var $i;(function(r){r.Distribute={type:"distribute"};function e(s){return{type:"split",index:s}}r.Split=e;function n(s){return{type:"invisible",cachedVisibleSize:s}}r.Invisible=n})($i||($i={}));class ql{get contentSize(){return this._contentSize}get size(){return this._size}set size(e){this._size=e}get orthogonalSize(){return this._orthogonalSize}set orthogonalSize(e){this._orthogonalSize=e}get length(){return this.viewItems.length}get proportions(){return this._proportions?[...this._proportions]:void 0}get orientation(){return this._orientation}set orientation(e){this._orientation=e;const n=this.size;this.size=this.orthogonalSize,this.orthogonalSize=n,Xl(this.element,"dv-horizontal","dv-vertical"),this.element.classList.add(this.orientation==ke.HORIZONTAL?"dv-horizontal":"dv-vertical")}get minimumSize(){return this.viewItems.reduce((e,n)=>e+n.minimumSize,0)}get maximumSize(){return this.length===0?Number.POSITIVE_INFINITY:this.viewItems.reduce((e,n)=>e+n.maximumSize,0)}get startSnappingEnabled(){return this._startSnappingEnabled}set startSnappingEnabled(e){this._startSnappingEnabled!==e&&(this._startSnappingEnabled=e,this.updateSashEnablement())}get endSnappingEnabled(){return this._endSnappingEnabled}set endSnappingEnabled(e){this._endSnappingEnabled!==e&&(this._endSnappingEnabled=e,this.updateSashEnablement())}get disabled(){return this._disabled}set disabled(e){this._disabled=e,Re(this.element,"dv-splitview-disabled",e)}get margin(){return this._margin}set margin(e){this._margin=e,Re(this.element,"dv-splitview-has-margin",e!==0)}constructor(e,n){var s,l;this.container=e,this.viewItems=[],this.sashes=[],this._size=0,this._orthogonalSize=0,this._contentSize=0,this._proportions=void 0,this._startSnappingEnabled=!0,this._endSnappingEnabled=!0,this._disabled=!1,this._margin=0,this._onDidSashEnd=new U,this.onDidSashEnd=this._onDidSashEnd.event,this._onDidAddView=new U,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new U,this.onDidRemoveView=this._onDidRemoveView.event,this.resize=(a,c,d=this.viewItems.map(A=>A.size),h,m,w=Number.NEGATIVE_INFINITY,v=Number.POSITIVE_INFINITY,S,E)=>{if(a<0||a>this.viewItems.length)return 0;const A=ts(a,-1),D=ts(a+1,this.viewItems.length);if(m)for(const j of m)th(A,j),th(D,j);if(h)for(const j of h)Su(A,j),Su(D,j);const P=A.map(j=>this.viewItems[j]),N=A.map(j=>d[j]),O=D.map(j=>this.viewItems[j]),M=D.map(j=>d[j]),R=A.reduce((j,te)=>j+this.viewItems[te].minimumSize-d[te],0),Z=A.reduce((j,te)=>j+this.viewItems[te].maximumSize-d[te],0),G=D.length===0?Number.POSITIVE_INFINITY:D.reduce((j,te)=>j+d[te]-this.viewItems[te].minimumSize,0),$=D.length===0?Number.NEGATIVE_INFINITY:D.reduce((j,te)=>j+d[te]-this.viewItems[te].maximumSize,0),K=Math.max(R,$),he=Math.min(G,Z);let ue=!1;if(S){const j=this.viewItems[S.index],te=c>=S.limitDelta;ue=te!==j.visible,j.setVisible(te,S.size)}if(!ue&&E){const j=this.viewItems[E.index],te=c{const d=a.visible===void 0||a.visible?a.size:{type:"invisible",cachedVisibleSize:a.size},h=a.view;this.addView(h,d,c,!0)}),this._contentSize=this.viewItems.reduce((a,c)=>a+c.size,0),this.saveProportions())}style(e){(e==null?void 0:e.separatorBorder)==="transparent"?(Xl(this.element,"dv-separator-border"),this.element.style.removeProperty("--dv-separator-border")):(ac(this.element,"dv-separator-border"),e!=null&&e.separatorBorder&&this.element.style.setProperty("--dv-separator-border",e.separatorBorder))}isViewVisible(e){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");return this.viewItems[e].visible}setViewVisible(e,n){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");const s=this.viewItems[e];s.setVisible(n,s.size),this.distributeEmptySpace(e),this.layoutViews(),this.saveProportions()}getViewSize(e){return e<0||e>=this.viewItems.length?-1:this.viewItems[e].size}resizeView(e,n){if(e<0||e>=this.viewItems.length)return;const s=ts(this.viewItems.length).filter(d=>d!==e),l=[...s.filter(d=>this.viewItems[d].priority===on.Low),e],a=s.filter(d=>this.viewItems[d].priority===on.High),c=this.viewItems[e];n=Math.round(n),n=_t(n,c.minimumSize,Math.min(c.maximumSize,this._size)),c.size=n,this.relayout(l,a)}getViews(){return this.viewItems.map(e=>e.view)}onDidChange(e,n){const s=this.viewItems.indexOf(e);if(s<0||s>=this.viewItems.length)return;n=typeof n=="number"?n:e.size,n=_t(n,e.minimumSize,e.maximumSize),e.size=n;const l=ts(this.viewItems.length).filter(d=>d!==s),a=[...l.filter(d=>this.viewItems[d].priority===on.Low),s],c=l.filter(d=>this.viewItems[d].priority===on.High);this.relayout([...a,s],c)}addView(e,n={type:"distribute"},s=this.viewItems.length,l){const a=document.createElement("div");a.className="dv-view",a.appendChild(e.element);let c;typeof n=="number"?c=n:n.type==="split"?c=this.getViewSize(n.index)/2:n.type==="invisible"?c={cachedVisibleSize:n.cachedVisibleSize}:c=e.minimumSize;const d=e.onDidChange(m=>this.onDidChange(h,m.size)),h=new mC(a,e,c,{dispose:()=>{d.dispose(),this.viewContainer.removeChild(a)}});if(s===this.viewItems.length?this.viewContainer.appendChild(a):this.viewContainer.insertBefore(a,this.viewContainer.children.item(s)),this.viewItems.splice(s,0,h),this.viewItems.length>1){const m=document.createElement("div");m.className="dv-sash";const w=S=>{for(const j of this.viewItems)j.enabled=!1;const E=Uu(),A=this._orientation===ke.HORIZONTAL?S.clientX:S.clientY,D=pC(this.sashes,j=>j.container===m),P=this.viewItems.map(j=>j.size);let N,O;const M=ts(D,-1),R=ts(D+1,this.viewItems.length),Z=M.reduce((j,te)=>j+(this.viewItems[te].minimumSize-P[te]),0),G=M.reduce((j,te)=>j+(this.viewItems[te].viewMaximumSize-P[te]),0),$=R.length===0?Number.POSITIVE_INFINITY:R.reduce((j,te)=>j+(P[te]-this.viewItems[te].minimumSize),0),K=R.length===0?Number.NEGATIVE_INFINITY:R.reduce((j,te)=>j+(P[te]-this.viewItems[te].viewMaximumSize),0),he=Math.max(Z,K),ue=Math.min($,G),Q=this.findFirstSnapIndex(M),ve=this.findFirstSnapIndex(R);if(typeof Q=="number"){const j=this.viewItems[Q],te=Math.floor(j.viewMinimumSize/2);N={index:Q,limitDelta:j.visible?he-te:he+te,size:j.size}}if(typeof ve=="number"){const j=this.viewItems[ve],te=Math.floor(j.viewMinimumSize/2);O={index:ve,limitDelta:j.visible?ue+te:ue-te,size:j.size}}const ie=j=>{const X=(this._orientation===ke.HORIZONTAL?j.clientX:j.clientY)-A;this.resize(D,X,P,void 0,void 0,he,ue,N,O),this.distributeEmptySpace(),this.layoutViews()},ce=()=>{for(const j of this.viewItems)j.enabled=!0;E.release(),this.saveProportions(),document.removeEventListener("pointermove",ie),document.removeEventListener("pointerup",ce),document.removeEventListener("pointercancel",ce),document.removeEventListener("contextmenu",ce),this._onDidSashEnd.fire(void 0)};document.addEventListener("pointermove",ie),document.addEventListener("pointerup",ce),document.addEventListener("pointercancel",ce),document.addEventListener("contextmenu",ce)};m.addEventListener("pointerdown",w);const v={container:m,disposable:()=>{m.removeEventListener("pointerdown",w),this.sashContainer.removeChild(m)}};this.sashContainer.appendChild(m),this.sashes.push(v)}l||this.relayout([s]),!l&&typeof n!="number"&&n.type==="distribute"&&this.distributeViewSizes(),this._onDidAddView.fire(e)}distributeViewSizes(){const e=[];let n=0;for(const d of this.viewItems)d.maximumSize-d.minimumSize>0&&(e.push(d),n+=d.size);const s=Math.floor(n/e.length);for(const d of e)d.size=_t(s,d.minimumSize,d.maximumSize);const l=ts(this.viewItems.length),a=l.filter(d=>this.viewItems[d].priority===on.Low),c=l.filter(d=>this.viewItems[d].priority===on.High);this.relayout(a,c)}removeView(e,n,s=!1){const l=this.viewItems.splice(e,1)[0];if(l.dispose(),this.viewItems.length>=1){const a=Math.max(e-1,0);this.sashes.splice(a,1)[0].disposable()}return s||this.relayout(),n&&n.type==="distribute"&&this.distributeViewSizes(),this._onDidRemoveView.fire(l.view),l.view}getViewCachedVisibleSize(e){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");return this.viewItems[e].cachedVisibleSize}moveView(e,n){const s=this.getViewCachedVisibleSize(e),l=typeof s>"u"?this.getViewSize(e):$i.Invisible(s),a=this.removeView(e,void 0,!0);this.addView(a,l,n)}layout(e,n){const s=Math.max(this.size,this._contentSize);if(this.size=e,this.orthogonalSize=n,this.proportions){let l=0;for(let a=0;a0&&(c.size=_t(Math.round(d*e/l),c.minimumSize,c.maximumSize))}}else{const l=ts(this.viewItems.length),a=l.filter(d=>this.viewItems[d].priority===on.Low),c=l.filter(d=>this.viewItems[d].priority===on.High);this.resize(this.viewItems.length-1,e-s,void 0,a,c)}this.distributeEmptySpace(),this.layoutViews()}relayout(e,n){const s=this.viewItems.reduce((l,a)=>l+a.size,0);this.resize(this.viewItems.length-1,this._size-s,void 0,e,n),this.distributeEmptySpace(),this.layoutViews(),this.saveProportions()}distributeEmptySpace(e){const n=this.viewItems.reduce((d,h)=>d+h.size,0);let s=this.size-n;const l=ts(this.viewItems.length-1,-1),a=l.filter(d=>this.viewItems[d].priority===on.Low),c=l.filter(d=>this.viewItems[d].priority===on.High);for(const d of c)th(l,d);for(const d of a)Su(l,d);typeof e=="number"&&Su(l,e);for(let d=0;s!==0&&d0&&(this._proportions=this.viewItems.map(e=>e.visible?e.size/this._contentSize:void 0))}layoutViews(){if(this._contentSize=this.viewItems.reduce((h,m)=>h+m.size,0),this.updateSashEnablement(),this.viewItems.length===0)return;const e=this.viewItems.filter(h=>h.visible),n=Math.max(0,e.length-1),s=this.margin*n/Math.max(1,e.length);let l=0;const a=[],c=4,d=this.viewItems.reduce((h,m,w)=>{const v=m.visible?1:0;return w===0?h.push(v):h.push(h[w-1]+v),h},[]);this.viewItems.forEach((h,m)=>{l+=this.viewItems[m].size,a.push(l);const w=h.visible?h.size-s:0,v=Math.max(0,d[m]-1),S=m===0||v===0?0:a[m-1]+v/n*s;if(m0)return;if(!s.visible&&s.snap)return n}}updateSashEnablement(){let e=!1;const n=this.viewItems.map(h=>e=h.size-h.minimumSize>0||e);e=!1;const s=this.viewItems.map(h=>e=h.maximumSize-h.size>0||e),l=[...this.viewItems].reverse();e=!1;const a=l.map(h=>e=h.size-h.minimumSize>0||e).reverse();e=!1;const c=l.map(h=>e=h.maximumSize-h.size>0||e).reverse();let d=0;for(let h=0;h0||this.startSnappingEnabled)?this.updateSash(m,ji.MINIMUM):O&&n[h]&&(d{const a=new Ne(l.onDidChangeExpansionState(()=>{this.setupAnimation(),this._onDidChange.fire(void 0)})),c={pane:l,disposable:{dispose:()=>{a.dispose()}}};this.paneItems.push(c),l.orthogonalSize=this.splitview.orthogonalSize}),this.addDisposables(this._onDidChange,this.splitview.onDidSashEnd(()=>{this._onDidChange.fire(void 0)}),this.splitview.onDidAddView(()=>{this._onDidChange.fire()}),this.splitview.onDidRemoveView(()=>{this._onDidChange.fire()}))}setViewVisible(e,n){this.splitview.setViewVisible(e,n)}addPane(e,n,s=this.splitview.length,l=!1){const a=e.onDidChangeExpansionState(()=>{this.setupAnimation(),this._onDidChange.fire(void 0)}),c={pane:e,disposable:{dispose:()=>{a.dispose()}}};this.paneItems.splice(s,0,c),e.orthogonalSize=this.splitview.orthogonalSize,this.splitview.addView(e,n,s,l)}getViewSize(e){return this.splitview.getViewSize(e)}getPanes(){return this.splitview.getViews()}removePane(e,n={skipDispose:!1}){const s=this.paneItems.splice(e,1)[0];return this.splitview.removeView(e),n.skipDispose||(s.disposable.dispose(),s.pane.dispose()),s}moveView(e,n){if(e===n)return;const s=this.removePane(e,{skipDispose:!0});this.skipAnimation=!0;try{this.addPane(s.pane,s.pane.size,n,!1)}finally{this.skipAnimation=!1}}layout(e,n){this.splitview.layout(e,n)}setupAnimation(){this.skipAnimation||(this.animationTimer&&(clearTimeout(this.animationTimer),this.animationTimer=void 0),ac(this.element,"dv-animated"),this.animationTimer=setTimeout(()=>{this.animationTimer=void 0,Xl(this.element,"dv-animated")},200))}dispose(){super.dispose(),this.animationTimer&&(clearTimeout(this.animationTimer),this.animationTimer=void 0),this.paneItems.forEach(e=>{e.disposable.dispose(),e.pane.dispose()}),this.paneItems=[],this.splitview.dispose(),this.element.remove()}}class Sn{get minimumWidth(){return this.view.minimumWidth}get maximumWidth(){return this.view.maximumWidth}get minimumHeight(){return this.view.minimumHeight}get maximumHeight(){return this.view.maximumHeight}get priority(){return this.view.priority}get snap(){return this.view.snap}get minimumSize(){return this.orientation===ke.HORIZONTAL?this.minimumHeight:this.minimumWidth}get maximumSize(){return this.orientation===ke.HORIZONTAL?this.maximumHeight:this.maximumWidth}get minimumOrthogonalSize(){return this.orientation===ke.HORIZONTAL?this.minimumWidth:this.minimumHeight}get maximumOrthogonalSize(){return this.orientation===ke.HORIZONTAL?this.maximumWidth:this.maximumHeight}get orthogonalSize(){return this._orthogonalSize}get size(){return this._size}get element(){return this.view.element}get width(){return this.orientation===ke.HORIZONTAL?this.orthogonalSize:this.size}get height(){return this.orientation===ke.HORIZONTAL?this.size:this.orthogonalSize}constructor(e,n,s,l=0){this.view=e,this.orientation=n,this._onDidChange=new U,this.onDidChange=this._onDidChange.event,this._orthogonalSize=s,this._size=l,this._disposable=this.view.onDidChange(a=>{a?this._onDidChange.fire({size:this.orientation===ke.VERTICAL?a.width:a.height,orthogonalSize:this.orientation===ke.VERTICAL?a.height:a.width}):this._onDidChange.fire({})})}setVisible(e){this.view.setVisible&&this.view.setVisible(e)}layout(e,n){this._size=e,this._orthogonalSize=n,this.view.layout(this.width,this.height)}dispose(){this._onDidChange.dispose(),this._disposable.dispose()}}class Rt extends Ne{get width(){return this.orientation===ke.HORIZONTAL?this.size:this.orthogonalSize}get height(){return this.orientation===ke.HORIZONTAL?this.orthogonalSize:this.size}get minimumSize(){return this.children.length===0?0:Math.max(...this.children.map((e,n)=>this.splitview.isViewVisible(n)?e.minimumOrthogonalSize:0))}get maximumSize(){return Math.min(...this.children.map((e,n)=>this.splitview.isViewVisible(n)?e.maximumOrthogonalSize:Number.POSITIVE_INFINITY))}get minimumOrthogonalSize(){return this.splitview.minimumSize}get maximumOrthogonalSize(){return this.splitview.maximumSize}get orthogonalSize(){return this._orthogonalSize}get size(){return this._size}get minimumWidth(){return this.orientation===ke.HORIZONTAL?this.minimumOrthogonalSize:this.minimumSize}get minimumHeight(){return this.orientation===ke.HORIZONTAL?this.minimumSize:this.minimumOrthogonalSize}get maximumWidth(){return this.orientation===ke.HORIZONTAL?this.maximumOrthogonalSize:this.maximumSize}get maximumHeight(){return this.orientation===ke.HORIZONTAL?this.maximumSize:this.maximumOrthogonalSize}get priority(){if(this.children.length===0)return on.Normal;const e=this.children.map(n=>typeof n.priority>"u"?on.Normal:n.priority);return e.some(n=>n===on.High)?on.High:e.some(n=>n===on.Low)?on.Low:on.Normal}get disabled(){return this.splitview.disabled}set disabled(e){this.splitview.disabled=e}get margin(){return this.splitview.margin}set margin(e){this.splitview.margin=e,this.children.forEach(n=>{n instanceof Rt&&(n.margin=e)})}constructor(e,n,s,l,a,c,d,h){if(super(),this.orientation=e,this.proportionalLayout=n,this.styles=s,this._childrenDisposable=Qt.NONE,this.children=[],this._onDidChange=new U,this.onDidChange=this._onDidChange.event,this._onDidVisibilityChange=new U,this.onDidVisibilityChange=this._onDidVisibilityChange.event,this._orthogonalSize=a,this._size=l,this.element=document.createElement("div"),this.element.className="dv-branch-node",!h)this.splitview=new ql(this.element,{orientation:this.orientation,proportionalLayout:n,styles:s,margin:d}),this.splitview.layout(this.size,this.orthogonalSize);else{const m={views:h.map(w=>({view:w.node,size:w.node.size,visible:w.node instanceof Sn&&w.visible!==void 0?w.visible:!0})),size:this.orthogonalSize};this.children=h.map(w=>w.node),this.splitview=new ql(this.element,{orientation:this.orientation,descriptor:m,proportionalLayout:n,styles:s,margin:d})}this.disabled=c,this.addDisposables(this._onDidChange,this._onDidVisibilityChange,this.splitview.onDidSashEnd(()=>{this._onDidChange.fire({})})),this.setupChildrenEvents()}setVisible(e){}isChildVisible(e){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.isViewVisible(e)}setChildVisible(e,n){if(e<0||e>=this.children.length)throw new Error("Invalid index");if(this.splitview.isViewVisible(e)===n)return;const s=this.splitview.contentSize===0;this.splitview.setViewVisible(e,n);const l=this.splitview.contentSize===0;(n&&s||!n&&l)&&this._onDidVisibilityChange.fire({visible:n})}moveChild(e,n){if(e===n)return;if(e<0||e>=this.children.length)throw new Error("Invalid from index");e=this.children.length)throw new Error("Invalid index");return this.splitview.getViewSize(e)}resizeChild(e,n){if(e<0||e>=this.children.length)throw new Error("Invalid index");this.splitview.resizeView(e,n)}layout(e,n){this._size=n,this._orthogonalSize=e,this.splitview.layout(n,e)}addChild(e,n,s,l){if(s<0||s>this.children.length)throw new Error("Invalid index");this.splitview.addView(e,n,s,l),this._addChild(e,s)}getChildCachedVisibleSize(e){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.getViewCachedVisibleSize(e)}removeChild(e,n){if(e<0||e>=this.children.length)throw new Error("Invalid index");return this.splitview.removeView(e,n),this._removeChild(e)}_addChild(e,n){this.children.splice(n,0,e),this.setupChildrenEvents()}_removeChild(e){const[n]=this.children.splice(e,1);return this.setupChildrenEvents(),n}setupChildrenEvents(){this._childrenDisposable.dispose(),this._childrenDisposable=new Ne(Zr.any(...this.children.map(e=>e.onDidChange))(e=>{this._onDidChange.fire({size:e.orthogonalSize})}),...this.children.map((e,n)=>e instanceof Rt?e.onDidVisibilityChange(({visible:s})=>{this.setChildVisible(n,s)}):Qt.NONE))}dispose(){this._childrenDisposable.dispose(),this.splitview.dispose(),this.children.forEach(e=>e.dispose()),super.dispose()}}function Dh(r,e){if(r instanceof Sn)return r;if(r instanceof Rt)return Dh(r.children[e?r.children.length-1:0],e);throw new Error("invalid node")}function iw(r,e,n){if(r instanceof Rt){const s=new Rt(r.orientation,r.proportionalLayout,r.styles,e,n,r.disabled,r.margin);for(let l=r.children.length-1;l>=0;l--){const a=r.children[l];s.addChild(iw(a,a.size,a.orthogonalSize),a.size,0,!0)}return s}else return new Sn(r.view,r.orientation,n)}function Ch(r,e,n){if(r instanceof Rt){const s=new Rt(Ss(r.orientation),r.proportionalLayout,r.styles,e,n,r.disabled,r.margin);let l=0;for(let a=r.children.length-1;a>=0;a--){const c=r.children[a],d=c instanceof Rt?c.orthogonalSize:c.size;let h=r.size===0?0:Math.round(e*d/r.size);l+=h,a===0&&(h+=e-l),s.addChild(Ch(c,n,h),h,0,!0)}return s}else return new Sn(r.view,Ss(r.orientation),n)}function gC(r){const e=r.parentElement;if(!e)throw new Error("Invalid grid element");let n=e.firstElementChild,s=0;for(;n!==r&&n!==e.lastElementChild&&n;)n=n.nextElementSibling,s++;return s}function kt(r){const e=r.parentElement;if(!e)throw new Error("Invalid grid element");if(/\bdv-grid-view\b/.test(e.className))return[];const n=gC(e),s=e.parentElement.parentElement.parentElement;return[...kt(s),n]}function _s(r,e,n){const s=wC(r,e),l=vC(n);if(s===l){const[a,c]=Ms(e);let d=c;return(n==="right"||n==="bottom")&&(d+=1),[...a,d]}else{const a=n==="right"||n==="bottom"?1:0;return[...e,a]}}function vC(r){return r==="top"||r==="bottom"?ke.VERTICAL:ke.HORIZONTAL}function wC(r,e){return e.length%2===0?Ss(r):r}const Ss=r=>r===ke.HORIZONTAL?ke.VERTICAL:ke.HORIZONTAL;function _C(r){return!!r.children}const xh=(r,e)=>{const n=e===ke.VERTICAL?r.box.width:r.box.height;return _C(r)?{type:"branch",data:r.children.map(s=>xh(s,Ss(e))),size:n}:typeof r.cachedVisibleSize=="number"?{type:"leaf",data:r.view.toJSON(),size:r.cachedVisibleSize,visible:!1}:{type:"leaf",data:r.view.toJSON(),size:n}};class yC{get length(){return this._root?this._root.children.length:0}get orientation(){return this.root.orientation}set orientation(e){if(this.root.orientation===e)return;const{size:n,orthogonalSize:s}=this.root;this.root=Ch(this.root,s,n),this.root.layout(n,s)}get width(){return this.root.width}get height(){return this.root.height}get minimumWidth(){return this.root.minimumWidth}get minimumHeight(){return this.root.minimumHeight}get maximumWidth(){return this.root.maximumHeight}get maximumHeight(){return this.root.maximumHeight}get locked(){return this._locked}set locked(e){this._locked=e;const n=[this.root];for(;n.length>0;){const s=n.pop();s instanceof Rt&&(s.disabled=e,n.push(...s.children))}}get margin(){return this._margin}set margin(e){this._margin=e,this.root.margin=e}maximizedView(){var e;return(e=this._maximizedNode)===null||e===void 0?void 0:e.leaf.view}hasMaximizedView(){return this._maximizedNode!==void 0}maximizeView(e){var n;const s=kt(e.element),[l,a]=this.getNode(s);if(!(a instanceof Sn)||((n=this._maximizedNode)===null||n===void 0?void 0:n.leaf)===a)return;this.hasMaximizedView()&&this.exitMaximizedView(),xh(this.getView(),this.orientation);const c=[];function d(h,m){for(let w=0;w=0;a--){const c=l.children[a];c instanceof Sn?e.includes(c)||l.setChildVisible(a,!0):n(c)}}n(this.root);const s=this._maximizedNode.leaf;this._maximizedNode=void 0,this._onDidMaximizedNodeChange.fire({view:s.view,isMaximized:!1})}serialize(){const e=this.maximizedView();let n;e&&(n=kt(e.element)),this.hasMaximizedView()&&this.exitMaximizedView();const l={root:xh(this.getView(),this.orientation),width:this.width,height:this.height,orientation:this.orientation};return n&&(l.maximizedNode={location:n}),e&&this.maximizeView(e),l}dispose(){this.disposable.dispose(),this._onDidChange.dispose(),this._onDidMaximizedNodeChange.dispose(),this._onDidViewVisibilityChange.dispose(),this.root.dispose(),this._maximizedNode=void 0,this.element.remove()}clear(){const e=this.root.orientation;this.root=new Rt(e,this.proportionalLayout,this.styles,this.root.size,this.root.orthogonalSize,this.locked,this.margin)}deserialize(e,n){const s=e.orientation,l=s===ke.VERTICAL?e.height:e.width;if(this._deserialize(e.root,s,n,l),this.layout(e.width,e.height),e.maximizedNode){const a=e.maximizedNode.location,[c,d]=this.getNode(a);if(!(d instanceof Sn))return;this.maximizeView(d.view)}}_deserialize(e,n,s,l){this.root=this._deserializeNode(e,n,s,l)}_deserializeNode(e,n,s,l){var a;let c;if(e.type==="branch"){const h=e.data.map(m=>({node:this._deserializeNode(m,Ss(n),s,e.size),visible:m.visible}));c=new Rt(n,this.proportionalLayout,this.styles,e.size,l,this.locked,this.margin,h)}else{const d=s.fromJSON(e);typeof e.visible=="boolean"&&((a=d.setVisible)===null||a===void 0||a.call(d,e.visible)),c=new Sn(d,n,l,e.size)}return c}get root(){return this._root}set root(e){const n=this._root;n&&(n.dispose(),this._maximizedNode=void 0,this.element.removeChild(n.element)),this._root=e,this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange(s=>{this._onDidChange.fire(s)})}normalize(){if(!this._root||this._root.children.length!==1)return;const e=this.root,n=e.children[0];if(n instanceof Sn)return;e.element.remove();const s=e.removeChild(0);e.dispose(),s.dispose(),this._root=iw(n,n.size,n.orthogonalSize),this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange(l=>{this._onDidChange.fire(l)})}insertOrthogonalSplitviewAtRoot(){if(!this._root)return;const e=this.root;if(e.element.remove(),this._root=new Rt(Ss(e.orientation),this.proportionalLayout,this.styles,this.root.orthogonalSize,this.root.size,this.locked,this.margin),e.children.length!==0)if(e.children.length===1){const n=e.children[0];e.removeChild(0).dispose(),e.dispose(),this._root.addChild(Ch(n,n.orthogonalSize,n.size),$i.Distribute,0)}else this._root.addChild(e,$i.Distribute,0);this.element.appendChild(this._root.element),this.disposable.value=this._root.onDidChange(n=>{this._onDidChange.fire(n)})}next(e){return this.progmaticSelect(e)}previous(e){return this.progmaticSelect(e,!0)}getView(e){const n=e?this.getNode(e)[1]:this.root;return this._getViews(n,this.orientation)}_getViews(e,n,s){const l={height:e.height,width:e.width};if(e instanceof Sn)return{box:l,view:e.view,cachedVisibleSize:s};const a=[];for(let c=0;c-1;a--){const c=s[a],d=e[a]||0;if(n?d-1>-1:d+1m.getChildSize(P));if(m.removeChild(v,n).dispose(),h instanceof Rt){A.splice(v,1,...h.children.map(D=>D.size));for(let D=0;D0;)h.removeChild(0)}else{const D=new Sn(h.view,Ss(h.orientation),h.size),P=E?h.orthogonalSize:$i.Invisible(h.orthogonalSize);m.addChild(D,P,v)}h.dispose();for(let D=0;D=n.children.length)throw new Error("Invalid location");const c=n.children[l];return s.push(n),this.getNode(a,c,s)}}const Eh=Object.keys({disableAutoResizing:void 0,proportionalLayout:void 0,orientation:void 0,hideBorders:void 0,className:void 0});class tf extends Ne{get element(){return this._element}get disableResizing(){return this._disableResizing}set disableResizing(e){this._disableResizing=e}constructor(e,n=!1){super(),this._disableResizing=n,this._element=e,this.addDisposables(lc(this._element,s=>{if(this.isDisposed||this.disableResizing||!this._element.offsetParent||!rC(this._element))return;const{width:l,height:a}=s.contentRect;this.layout(l,a)}))}}const SC=ef();function $u(r){switch(r){case"left":return"left";case"right":return"right";case"above":return"top";case"below":return"bottom";case"within":default:return"center"}}class sw extends tf{get id(){return this._id}get size(){return this._groups.size}get groups(){return Array.from(this._groups.values()).map(e=>e.value)}get width(){return this.gridview.width}get height(){return this.gridview.height}get minimumHeight(){return this.gridview.minimumHeight}get maximumHeight(){return this.gridview.maximumHeight}get minimumWidth(){return this.gridview.minimumWidth}get maximumWidth(){return this.gridview.maximumWidth}get activeGroup(){return this._activeGroup}get locked(){return this.gridview.locked}set locked(e){this.gridview.locked=e}constructor(e,n){var s;super(document.createElement("div"),n.disableAutoResizing),this._id=SC.next(),this._groups=new Map,this._onDidRemove=new U,this.onDidRemove=this._onDidRemove.event,this._onDidAdd=new U,this.onDidAdd=this._onDidAdd.event,this._onDidMaximizedChange=new U,this.onDidMaximizedChange=this._onDidMaximizedChange.event,this._onDidActiveChange=new U,this.onDidActiveChange=this._onDidActiveChange.event,this._bufferOnDidLayoutChange=new _g,this.onDidLayoutChange=this._bufferOnDidLayoutChange.onEvent,this._onDidViewVisibilityChangeMicroTaskQueue=new _g,this.onDidViewVisibilityChangeMicroTaskQueue=this._onDidViewVisibilityChangeMicroTaskQueue.onEvent,this.element.style.height="100%",this.element.style.width="100%",this._classNames=new uc(this.element),this._classNames.setClassNames((s=n.className)!==null&&s!==void 0?s:""),e.appendChild(this.element),this.gridview=new yC(!!n.proportionalLayout,n.styles,n.orientation,n.locked,n.margin),this.gridview.locked=!!n.locked,this.element.appendChild(this.gridview.element),this.layout(0,0,!0),this.addDisposables(this.gridview.onDidMaximizedNodeChange(l=>{this._onDidMaximizedChange.fire({panel:l.view,isMaximized:l.isMaximized})}),this.gridview.onDidViewVisibilityChange(()=>this._onDidViewVisibilityChangeMicroTaskQueue.fire()),this.onDidViewVisibilityChangeMicroTaskQueue(()=>{this.layout(this.width,this.height,!0)}),Qt.from(()=>{var l;(l=this.element.parentElement)===null||l===void 0||l.removeChild(this.element)}),this.gridview.onDidChange(()=>{this._bufferOnDidLayoutChange.fire()}),Zr.any(this.onDidAdd,this.onDidRemove,this.onDidActiveChange)(()=>{this._bufferOnDidLayoutChange.fire()}),this._onDidMaximizedChange,this._onDidViewVisibilityChangeMicroTaskQueue,this._bufferOnDidLayoutChange)}setVisible(e,n){this.gridview.setViewVisible(kt(e.element),n),this._bufferOnDidLayoutChange.fire()}isVisible(e){return this.gridview.isViewVisible(kt(e.element))}updateOptions(e){var n,s,l,a;e.proportionalLayout,e.orientation&&(this.gridview.orientation=e.orientation),"disableResizing"in e&&(this.disableResizing=(n=e.disableAutoResizing)!==null&&n!==void 0?n:!1),"locked"in e&&(this.locked=(s=e.locked)!==null&&s!==void 0?s:!1),"margin"in e&&(this.gridview.margin=(l=e.margin)!==null&&l!==void 0?l:0),"className"in e&&this._classNames.setClassNames((a=e.className)!==null&&a!==void 0?a:"")}maximizeGroup(e){this.gridview.maximizeView(e),this.doSetGroupActive(e)}isMaximizedGroup(e){return this.gridview.maximizedView()===e}exitMaximizedGroup(){this.gridview.exitMaximizedView()}hasMaximizedGroup(){return this.gridview.hasMaximizedView()}doAddGroup(e,n=[0],s){this.gridview.addView(e,s??$i.Distribute,n),this._onDidAdd.fire(e)}doRemoveGroup(e,n){if(!this._groups.has(e.id))throw new Error("invalid operation");const s=this._groups.get(e.id),l=this.gridview.remove(e,$i.Distribute);if(s&&!(n!=null&&n.skipDispose)&&(s.disposable.dispose(),s.value.dispose(),this._groups.delete(e.id),this._onDidRemove.fire(e)),!(n!=null&&n.skipActive)&&this._activeGroup===e){const a=Array.from(this._groups.values());this.doSetGroupActive(a.length>0?a[0].value:void 0)}return l}getPanel(e){var n;return(n=this._groups.get(e))===null||n===void 0?void 0:n.value}doSetGroupActive(e){this._activeGroup!==e&&(this._activeGroup&&this._activeGroup.setActive(!1),e&&e.setActive(!0),this._activeGroup=e,this._onDidActiveChange.fire(e))}removeGroup(e){this.doRemoveGroup(e)}moveToNext(e){var n;if(e||(e={}),!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}const s=kt(e.group.element),l=(n=this.gridview.next(s))===null||n===void 0?void 0:n.view;this.doSetGroupActive(l)}moveToPrevious(e){var n;if(e||(e={}),!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}const s=kt(e.group.element),l=(n=this.gridview.previous(s))===null||n===void 0?void 0:n.view;this.doSetGroupActive(l)}layout(e,n,s){(s||e!==this.width||n!==this.height)&&(this.gridview.element.style.height=`${n}px`,this.gridview.element.style.width=`${e}px`,this.gridview.layout(e,n))}dispose(){this._onDidActiveChange.dispose(),this._onDidAdd.dispose(),this._onDidRemove.dispose();for(const e of this.groups)e.dispose();this.gridview.dispose(),super.dispose()}}class rw{get minimumSize(){return this.component.minimumSize}get maximumSize(){return this.component.maximumSize}get width(){return this.component.width}get height(){return this.component.height}get length(){return this.component.length}get orientation(){return this.component.orientation}get panels(){return this.component.panels}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidAddView(){return this.component.onDidAddView}get onDidRemoveView(){return this.component.onDidRemoveView}constructor(e){this.component=e}removePanel(e,n){this.component.removePanel(e,n)}focus(){this.component.focus()}getPanel(e){return this.component.getPanel(e)}layout(e,n){return this.component.layout(e,n)}addPanel(e){return this.component.addPanel(e)}movePanel(e,n){this.component.movePanel(e,n)}fromJSON(e){this.component.fromJSON(e)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}}class ea{get minimumSize(){return this.component.minimumSize}get maximumSize(){return this.component.maximumSize}get width(){return this.component.width}get height(){return this.component.height}get panels(){return this.component.panels}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get onDidAddView(){return this.component.onDidAddView}get onDidRemoveView(){return this.component.onDidRemoveView}get onDidDrop(){return this.component.onDidDrop}get onUnhandledDragOverEvent(){return this.component.onUnhandledDragOverEvent}constructor(e){this.component=e}removePanel(e){this.component.removePanel(e)}getPanel(e){return this.component.getPanel(e)}movePanel(e,n){this.component.movePanel(e,n)}focus(){this.component.focus()}layout(e,n){this.component.layout(e,n)}addPanel(e){return this.component.addPanel(e)}fromJSON(e){this.component.fromJSON(e)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}}class ow{get width(){return this.component.width}get height(){return this.component.height}get minimumHeight(){return this.component.minimumHeight}get maximumHeight(){return this.component.maximumHeight}get minimumWidth(){return this.component.minimumWidth}get maximumWidth(){return this.component.maximumWidth}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidAddPanel(){return this.component.onDidAddGroup}get onDidRemovePanel(){return this.component.onDidRemoveGroup}get onDidActivePanelChange(){return this.component.onDidActiveGroupChange}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get panels(){return this.component.groups}get orientation(){return this.component.orientation}set orientation(e){this.component.updateOptions({orientation:e})}constructor(e){this.component=e}focus(){this.component.focus()}layout(e,n,s=!1){this.component.layout(e,n,s)}addPanel(e){return this.component.addPanel(e)}removePanel(e,n){this.component.removePanel(e,n)}movePanel(e,n){this.component.movePanel(e,n)}getPanel(e){return this.component.getPanel(e)}fromJSON(e){return this.component.fromJSON(e)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}}class Yu{get id(){return this.component.id}get width(){return this.component.width}get height(){return this.component.height}get minimumHeight(){return this.component.minimumHeight}get maximumHeight(){return this.component.maximumHeight}get minimumWidth(){return this.component.minimumWidth}get maximumWidth(){return this.component.maximumWidth}get size(){return this.component.size}get totalPanels(){return this.component.totalPanels}get onDidActiveGroupChange(){return this.component.onDidActiveGroupChange}get onDidAddGroup(){return this.component.onDidAddGroup}get onDidRemoveGroup(){return this.component.onDidRemoveGroup}get onDidActivePanelChange(){return this.component.onDidActivePanelChange}get onDidAddPanel(){return this.component.onDidAddPanel}get onDidRemovePanel(){return this.component.onDidRemovePanel}get onDidMovePanel(){return this.component.onDidMovePanel}get onDidLayoutFromJSON(){return this.component.onDidLayoutFromJSON}get onDidLayoutChange(){return this.component.onDidLayoutChange}get onDidDrop(){return this.component.onDidDrop}get onWillDrop(){return this.component.onWillDrop}get onWillShowOverlay(){return this.component.onWillShowOverlay}get onWillDragGroup(){return this.component.onWillDragGroup}get onWillDragPanel(){return this.component.onWillDragPanel}get onUnhandledDragOverEvent(){return this.component.onUnhandledDragOverEvent}get onDidPopoutGroupSizeChange(){return this.component.onDidPopoutGroupSizeChange}get onDidPopoutGroupPositionChange(){return this.component.onDidPopoutGroupPositionChange}get onDidOpenPopoutWindowFail(){return this.component.onDidOpenPopoutWindowFail}get panels(){return this.component.panels}get groups(){return this.component.groups}get activePanel(){return this.component.activePanel}get activeGroup(){return this.component.activeGroup}constructor(e){this.component=e}focus(){this.component.focus()}getPanel(e){return this.component.getGroupPanel(e)}layout(e,n,s=!1){this.component.layout(e,n,s)}addPanel(e){return this.component.addPanel(e)}removePanel(e){this.component.removePanel(e)}addGroup(e){return this.component.addGroup(e)}closeAllGroups(){return this.component.closeAllGroups()}removeGroup(e){this.component.removeGroup(e)}getGroup(e){return this.component.getPanel(e)}addFloatingGroup(e,n){return this.component.addFloatingGroup(e,n)}fromJSON(e,n){this.component.fromJSON(e,n)}toJSON(){return this.component.toJSON()}clear(){this.component.clear()}moveToNext(e){this.component.moveToNext(e)}moveToPrevious(e){this.component.moveToPrevious(e)}maximizeGroup(e){this.component.maximizeGroup(e.group)}hasMaximizedGroup(){return this.component.hasMaximizedGroup()}exitMaximizedGroup(){this.component.exitMaximizedGroup()}get onDidMaximizedGroupChange(){return this.component.onDidMaximizedGroupChange}addPopoutGroup(e,n){return this.component.addPopoutGroup(e,n)}updateOptions(e){this.component.updateOptions(e)}dispose(){this.component.dispose()}}class nf extends Ne{constructor(e,n){super(),this.el=e,this.disabled=n,this.dataDisposable=new Bn,this.pointerEventsDisposable=new Bn,this._onDragStart=new U,this.onDragStart=this._onDragStart.event,this.addDisposables(this._onDragStart,this.dataDisposable,this.pointerEventsDisposable),this.configure()}setDisabled(e){this.disabled=e}isCancelled(e){return!1}configure(){this.addDisposables(this._onDragStart,Be(this.el,"dragstart",e=>{if(e.defaultPrevented||this.isCancelled(e)||this.disabled){e.preventDefault();return}const n=Uu();this.pointerEventsDisposable.value={dispose:()=>{n.release()}},this.el.classList.add("dv-dragged"),setTimeout(()=>this.el.classList.remove("dv-dragged"),0),this.dataDisposable.value=this.getData(e),this._onDragStart.fire(e),e.dataTransfer&&(e.dataTransfer.effectAllowed="move",e.dataTransfer.items.length>0||e.dataTransfer.setData("text/plain",""))}),Be(this.el,"dragend",()=>{this.pointerEventsDisposable.dispose(),setTimeout(()=>{this.dataDisposable.dispose()},0)}))}}class lw extends Ne{constructor(e,n){super(),this.element=e,this.callbacks=n,this.target=null,this.registerListeners()}onDragEnter(e){this.target=e.target,this.callbacks.onDragEnter(e)}onDragOver(e){e.preventDefault(),this.callbacks.onDragOver&&this.callbacks.onDragOver(e)}onDragLeave(e){this.target===e.target&&(this.target=null,this.callbacks.onDragLeave(e))}onDragEnd(e){this.target=null,this.callbacks.onDragEnd(e)}onDrop(e){this.callbacks.onDrop(e)}registerListeners(){this.addDisposables(Be(this.element,"dragenter",e=>{this.onDragEnter(e)},!0)),this.addDisposables(Be(this.element,"dragover",e=>{this.onDragOver(e)},!0)),this.addDisposables(Be(this.element,"dragleave",e=>{this.onDragLeave(e)})),this.addDisposables(Be(this.element,"dragend",e=>{this.onDragEnd(e)})),this.addDisposables(Be(this.element,"drop",e=>{this.onDrop(e)}))}}function DC(r,e){const{top:n,left:s,width:l,height:a}=e,c=`${Math.round(n)}px`,d=`${Math.round(s)}px`,h=`${Math.round(l)}px`,m=`${Math.round(a)}px`;r.style.top=c,r.style.left=d,r.style.width=h,r.style.height=m,r.style.visibility="visible",(!r.style.transform||r.style.transform==="")&&(r.style.transform="translate3d(0, 0, 0)")}function CC(r,e){const{top:n,left:s,width:l,height:a}=e;r.style.top=n,r.style.left=s,r.style.width=l,r.style.height=a,r.style.visibility="visible",(!r.style.transform||r.style.transform==="")&&(r.style.transform="translate3d(0, 0, 0)")}function xC(r,e){const{top:n,left:s,width:l,height:a}=e,c=`${Math.round(n)}px`,d=`${Math.round(s)}px`,h=`${Math.round(l)}px`,m=`${Math.round(a)}px`;return r.style.top!==c||r.style.left!==d||r.style.width!==h||r.style.height!==m}class EC extends qh{get nativeEvent(){return this.options.nativeEvent}get position(){return this.options.position}constructor(e){super(),this.options=e}}function Dg(r){switch(r){case"above":return"top";case"below":return"bottom";case"left":return"left";case"right":return"right";case"within":return"center";default:throw new Error(`invalid direction '${r}'`)}}function bC(r){switch(r){case"top":return"above";case"bottom":return"below";case"left":return"left";case"right":return"right";case"center":return"within";default:throw new Error(`invalid position '${r}'`)}}const PC={value:20,type:"percentage"},AC={value:50,type:"percentage"},kC=100,zC=100;class rs extends Ne{get disabled(){return this._disabled}set disabled(e){this._disabled=e}get state(){return this._state}constructor(e,n){super(),this.element=e,this.options=n,this._onDrop=new U,this.onDrop=this._onDrop.event,this._onWillShowOverlay=new U,this.onWillShowOverlay=this._onWillShowOverlay.event,this._disabled=!1,this._acceptedTargetZonesSet=new Set(this.options.acceptedTargetZones),this.dnd=new lw(this.element,{onDragEnter:()=>{var s,l,a;(a=(l=(s=this.options).getOverrideTarget)===null||l===void 0?void 0:l.call(s))===null||a===void 0||a.getElements()},onDragOver:s=>{var l,a,c,d,h,m,w;rs.ACTUAL_TARGET=this;const v=(a=(l=this.options).getOverrideTarget)===null||a===void 0?void 0:a.call(l);if(this._acceptedTargetZonesSet.size===0){if(v)return;this.removeDropTarget();return}const S=(h=(d=(c=this.options).getOverlayOutline)===null||d===void 0?void 0:d.call(c))!==null&&h!==void 0?h:this.element,E=S.offsetWidth,A=S.offsetHeight;if(E===0||A===0)return;const D=s.currentTarget.getBoundingClientRect(),P=((m=s.clientX)!==null&&m!==void 0?m:0)-D.left,N=((w=s.clientY)!==null&&w!==void 0?w:0)-D.top,O=this.calculateQuadrant(this._acceptedTargetZonesSet,P,N,E,A);if(this.isAlreadyUsed(s)||O===null){this.removeDropTarget();return}if(!this.options.canDisplayOverlay(s,O)){if(v)return;this.removeDropTarget();return}const M=new EC({nativeEvent:s,position:O});if(this._onWillShowOverlay.fire(M),M.defaultPrevented){this.removeDropTarget();return}this.markAsUsed(s),v||this.targetElement||(this.targetElement=document.createElement("div"),this.targetElement.className="dv-drop-target-dropzone",this.overlayElement=document.createElement("div"),this.overlayElement.className="dv-drop-target-selection",this._state="center",this.targetElement.appendChild(this.overlayElement),S.classList.add("dv-drop-target"),S.append(this.targetElement)),this.toggleClasses(O,E,A),this._state=O},onDragLeave:()=>{var s,l;!((l=(s=this.options).getOverrideTarget)===null||l===void 0)&&l.call(s)||this.removeDropTarget()},onDragEnd:s=>{var l,a;const c=(a=(l=this.options).getOverrideTarget)===null||a===void 0?void 0:a.call(l);c&&rs.ACTUAL_TARGET===this&&this._state&&(s.stopPropagation(),this._onDrop.fire({position:this._state,nativeEvent:s})),this.removeDropTarget(),c==null||c.clear()},onDrop:s=>{var l,a,c;s.preventDefault();const d=this._state;this.removeDropTarget(),(c=(a=(l=this.options).getOverrideTarget)===null||a===void 0?void 0:a.call(l))===null||c===void 0||c.clear(),d&&(s.stopPropagation(),this._onDrop.fire({position:d,nativeEvent:s}))}}),this.addDisposables(this._onDrop,this._onWillShowOverlay,this.dnd)}setTargetZones(e){this._acceptedTargetZonesSet=new Set(e)}setOverlayModel(e){this.options.overlayModel=e}dispose(){this.removeDropTarget(),super.dispose()}markAsUsed(e){e[rs.USED_EVENT_ID]=!0}isAlreadyUsed(e){const n=e[rs.USED_EVENT_ID];return typeof n=="boolean"&&n}toggleClasses(e,n,s){var l,a,c,d,h,m,w;const v=(a=(l=this.options).getOverrideTarget)===null||a===void 0?void 0:a.call(l);if(!v&&!this.overlayElement)return;const S=n{Re(ie,"dv-drop-target-anchor-container-changed",!1)},10));return}if(!this.overlayElement)return;const K={top:"0px",left:"0px",width:"100%",height:"100%"};O?(K.left=`${100*(1-G)}%`,K.width=`${100*G}%`):M?K.width=`${100*G}%`:R?K.height=`${100*G}%`:Z&&(K.top=`${100*(1-G)}%`,K.height=`${100*G}%`),CC(this.overlayElement,K),Re(this.overlayElement,"dv-drop-target-small-vertical",E),Re(this.overlayElement,"dv-drop-target-small-horizontal",S),Re(this.overlayElement,"dv-drop-target-left",A),Re(this.overlayElement,"dv-drop-target-right",D),Re(this.overlayElement,"dv-drop-target-top",P),Re(this.overlayElement,"dv-drop-target-bottom",N),Re(this.overlayElement,"dv-drop-target-center",e==="center")}calculateQuadrant(e,n,s,l,a){var c,d;const h=(d=(c=this.options.overlayModel)===null||c===void 0?void 0:c.activationSize)!==null&&d!==void 0?d:PC;return h.type==="percentage"?OC(e,n,s,l,a,h.value):TC(e,n,s,l,a,h.value)}removeDropTarget(){var e;this.targetElement&&(this._state=void 0,(e=this.targetElement.parentElement)===null||e===void 0||e.classList.remove("dv-drop-target"),this.targetElement.remove(),this.targetElement=void 0,this.overlayElement=void 0)}}rs.USED_EVENT_ID="__dockview_droptarget_event_is_used__";function OC(r,e,n,s,l,a){const c=100*e/s,d=100*n/l;return r.has("left")&&c100-a?"right":r.has("top")&&d100-a?"bottom":r.has("center")?"center":null}function TC(r,e,n,s,l,a){return r.has("left")&&es-a?"right":r.has("top")&&nl-a?"bottom":r.has("center")?"center":null}const bh=Object.keys({disableAutoResizing:void 0,disableDnd:void 0,className:void 0});class IC extends Xv{constructor(e,n,s,l){super(),this.nativeEvent=e,this.position=n,this.getData=s,this.panel=l}}class aw extends qh{constructor(){super()}}class uw extends Ne{get isFocused(){return this._isFocused}get isActive(){return this._isActive}get isVisible(){return this._isVisible}get width(){return this._width}get height(){return this._height}constructor(e,n){super(),this.id=e,this.component=n,this._isFocused=!1,this._isActive=!1,this._isVisible=!0,this._width=0,this._height=0,this._parameters={},this.panelUpdatesDisposable=new Bn,this._onDidDimensionChange=new U,this.onDidDimensionsChange=this._onDidDimensionChange.event,this._onDidChangeFocus=new U,this.onDidFocusChange=this._onDidChangeFocus.event,this._onWillFocus=new U,this.onWillFocus=this._onWillFocus.event,this._onDidVisibilityChange=new U,this.onDidVisibilityChange=this._onDidVisibilityChange.event,this._onWillVisibilityChange=new U,this.onWillVisibilityChange=this._onWillVisibilityChange.event,this._onDidActiveChange=new U,this.onDidActiveChange=this._onDidActiveChange.event,this._onActiveChange=new U,this.onActiveChange=this._onActiveChange.event,this._onDidParametersChange=new U,this.onDidParametersChange=this._onDidParametersChange.event,this.addDisposables(this.onDidFocusChange(s=>{this._isFocused=s.isFocused}),this.onDidActiveChange(s=>{this._isActive=s.isActive}),this.onDidVisibilityChange(s=>{this._isVisible=s.isVisible}),this.onDidDimensionsChange(s=>{this._width=s.width,this._height=s.height}),this.panelUpdatesDisposable,this._onDidDimensionChange,this._onDidChangeFocus,this._onDidVisibilityChange,this._onDidActiveChange,this._onWillFocus,this._onActiveChange,this._onWillFocus,this._onWillVisibilityChange,this._onDidParametersChange)}getParameters(){return this._parameters}initialize(e){this.panelUpdatesDisposable.value=this._onDidParametersChange.event(n=>{this._parameters=n,e.update({params:n})})}setVisible(e){this._onWillVisibilityChange.fire({isVisible:e})}setActive(){this._onActiveChange.fire()}updateParameters(e){this._onDidParametersChange.fire(e)}}class cw extends uw{constructor(e,n){super(e,n),this._onDidConstraintsChangeInternal=new U,this.onDidConstraintsChangeInternal=this._onDidConstraintsChangeInternal.event,this._onDidConstraintsChange=new U({replay:!0}),this.onDidConstraintsChange=this._onDidConstraintsChange.event,this._onDidSizeChange=new U,this.onDidSizeChange=this._onDidSizeChange.event,this.addDisposables(this._onDidConstraintsChangeInternal,this._onDidConstraintsChange,this._onDidSizeChange)}setConstraints(e){this._onDidConstraintsChangeInternal.fire(e)}setSize(e){this._onDidSizeChange.fire(e)}}class RC extends cw{set pane(e){this._pane=e}constructor(e,n){super(e,n),this._onDidExpansionChange=new U({replay:!0}),this.onDidExpansionChange=this._onDidExpansionChange.event,this._onMouseEnter=new U({}),this.onMouseEnter=this._onMouseEnter.event,this._onMouseLeave=new U({}),this.onMouseLeave=this._onMouseLeave.event,this.addDisposables(this._onDidExpansionChange,this._onMouseEnter,this._onMouseLeave)}setExpanded(e){var n;(n=this._pane)===null||n===void 0||n.setExpanded(e)}get isExpanded(){var e;return!!(!((e=this._pane)===null||e===void 0)&&e.isExpanded())}}class sf extends Ne{get element(){return this._element}get width(){return this._width}get height(){return this._height}get params(){var e;return(e=this._params)===null||e===void 0?void 0:e.params}constructor(e,n,s){super(),this.id=e,this.component=n,this.api=s,this._height=0,this._width=0,this._element=document.createElement("div"),this._element.tabIndex=-1,this._element.style.outline="none",this._element.style.height="100%",this._element.style.width="100%",this._element.style.overflow="hidden";const l=qv(this._element);this.addDisposables(this.api,l.onDidFocus(()=>{this.api._onDidChangeFocus.fire({isFocused:!0})}),l.onDidBlur(()=>{this.api._onDidChangeFocus.fire({isFocused:!1})}),l)}focus(){const e=new aw;this.api._onWillFocus.fire(e),!e.defaultPrevented&&this._element.focus()}layout(e,n){this._width=e,this._height=n,this.api._onDidDimensionChange.fire({width:e,height:n}),this.part&&this._params&&this.part.update(this._params.params)}init(e){this._params=e,this.part=this.getComponent()}update(e){var n,s;this._params=Object.assign(Object.assign({},this._params),{params:Object.assign(Object.assign({},(n=this._params)===null||n===void 0?void 0:n.params),e.params)});for(const l of Object.keys(e.params))e.params[l]===void 0&&delete this._params.params[l];(s=this.part)===null||s===void 0||s.update({params:this._params.params})}toJSON(){var e,n;const s=(n=(e=this._params)===null||e===void 0?void 0:e.params)!==null&&n!==void 0?n:{};return{id:this.id,component:this.component,params:Object.keys(s).length>0?s:void 0}}dispose(){var e;this.api.dispose(),(e=this.part)===null||e===void 0||e.dispose(),super.dispose()}}class NC extends sf{set orientation(e){this._orientation=e}get orientation(){return this._orientation}get minimumSize(){const e=this.headerSize,s=this.isExpanded()?this._minimumBodySize:0;return e+s}get maximumSize(){const e=this.headerSize,s=this.isExpanded()?this._maximumBodySize:0;return e+s}get size(){return this._size}get orthogonalSize(){return this._orthogonalSize}set orthogonalSize(e){this._orthogonalSize=e}get minimumBodySize(){return this._minimumBodySize}set minimumBodySize(e){this._minimumBodySize=typeof e=="number"?e:0}get maximumBodySize(){return this._maximumBodySize}set maximumBodySize(e){this._maximumBodySize=typeof e=="number"?e:Number.POSITIVE_INFINITY}get headerVisible(){return this._headerVisible}set headerVisible(e){this._headerVisible=e,this.header.style.display=e?"":"none"}constructor(e){super(e.id,e.component,new RC(e.id,e.component)),this._onDidChangeExpansionState=new U({replay:!0}),this.onDidChangeExpansionState=this._onDidChangeExpansionState.event,this._onDidChange=new U,this.onDidChange=this._onDidChange.event,this._orthogonalSize=0,this._size=0,this._isExpanded=!1,this.api.pane=this,this.api.initialize(this),this.headerSize=e.headerSize,this.headerComponent=e.headerComponent,this._minimumBodySize=e.minimumBodySize,this._maximumBodySize=e.maximumBodySize,this._isExpanded=e.isExpanded,this._headerVisible=e.isHeaderVisible,this._onDidChangeExpansionState.fire(this.isExpanded()),this._orientation=e.orientation,this.element.classList.add("dv-pane"),this.addDisposables(this.api.onWillVisibilityChange(n=>{const{isVisible:s}=n,{accessor:l}=this._params;l.setVisible(this,s)}),this.api.onDidSizeChange(n=>{this._onDidChange.fire({size:n.size})}),Be(this.element,"mouseenter",n=>{this.api._onMouseEnter.fire(n)}),Be(this.element,"mouseleave",n=>{this.api._onMouseLeave.fire(n)})),this.addDisposables(this._onDidChangeExpansionState,this.onDidChangeExpansionState(n=>{this.api._onDidExpansionChange.fire({isExpanded:n})}),this.api.onDidFocusChange(n=>{this.header&&(n.isFocused?ac(this.header,"focused"):Xl(this.header,"focused"))})),this.renderOnce()}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}isExpanded(){return this._isExpanded}setExpanded(e){this._isExpanded!==e&&(this._isExpanded=e,e?(this.animationTimer&&clearTimeout(this.animationTimer),this.body&&this.element.appendChild(this.body)):this.animationTimer=setTimeout(()=>{var n;(n=this.body)===null||n===void 0||n.remove()},200),this._onDidChange.fire(e?{size:this.width}:{}),this._onDidChangeExpansionState.fire(e))}layout(e,n){this._size=e,this._orthogonalSize=n;const[s,l]=this.orientation===ke.HORIZONTAL?[e,n]:[n,e];super.layout(s,l)}init(e){var n,s;super.init(e),typeof e.minimumBodySize=="number"&&(this.minimumBodySize=e.minimumBodySize),typeof e.maximumBodySize=="number"&&(this.maximumBodySize=e.maximumBodySize),this.bodyPart=this.getBodyComponent(),this.headerPart=this.getHeaderComponent(),this.bodyPart.init(Object.assign(Object.assign({},e),{api:this.api})),this.headerPart.init(Object.assign(Object.assign({},e),{api:this.api})),(n=this.body)===null||n===void 0||n.append(this.bodyPart.element),(s=this.header)===null||s===void 0||s.append(this.headerPart.element),typeof e.isExpanded=="boolean"&&this.setExpanded(e.isExpanded)}toJSON(){const e=this._params;return Object.assign(Object.assign({},super.toJSON()),{headerComponent:this.headerComponent,title:e.title})}renderOnce(){this.header=document.createElement("div"),this.header.tabIndex=0,this.header.className="dv-pane-header",this.header.style.height=`${this.headerSize}px`,this.header.style.lineHeight=`${this.headerSize}px`,this.header.style.minHeight=`${this.headerSize}px`,this.header.style.maxHeight=`${this.headerSize}px`,this.element.appendChild(this.header),this.body=document.createElement("div"),this.body.className="dv-pane-body",this.element.appendChild(this.body)}getComponent(){return{update:e=>{var n,s;(n=this.bodyPart)===null||n===void 0||n.update({params:e}),(s=this.headerPart)===null||s===void 0||s.update({params:e})},dispose:()=>{var e,n;(e=this.bodyPart)===null||e===void 0||e.dispose(),(n=this.headerPart)===null||n===void 0||n.dispose()}}}}class MC extends NC{constructor(e){super({id:e.id,component:e.component,headerComponent:e.headerComponent,orientation:e.orientation,isExpanded:e.isExpanded,isHeaderVisible:!0,headerSize:e.headerSize,minimumBodySize:e.minimumBodySize,maximumBodySize:e.maximumBodySize}),this._onDidDrop=new U,this.onDidDrop=this._onDidDrop.event,this._onUnhandledDragOverEvent=new U,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,this.accessor=e.accessor,this.addDisposables(this._onDidDrop,this._onUnhandledDragOverEvent),e.disableDnd||this.initDragFeatures()}initDragFeatures(){if(!this.header)return;const e=this.id,n=this.accessor.id;this.header.draggable=!0,this.handler=new class extends nf{getData(){return Ds.getInstance().setData([new Yl(n,e)],Yl.prototype),{dispose:()=>{Ds.getInstance().clearData(Yl.prototype)}}}}(this.header),this.target=new rs(this.element,{acceptedTargetZones:["top","bottom"],overlayModel:{activationSize:{type:"percentage",value:50}},canDisplayOverlay:(s,l)=>{const a=Ll();if(a&&a.paneId!==this.id&&a.viewId===this.accessor.id)return!0;const c=new IC(s,l,Ll,this);return this._onUnhandledDragOverEvent.fire(c),c.isAccepted}}),this.addDisposables(this._onDidDrop,this.handler,this.target,this.target.onDrop(s=>{this.onDrop(s)}))}onDrop(e){const n=Ll();if(!n||n.viewId!==this.accessor.id){this._onDidDrop.fire(Object.assign(Object.assign({},e),{panel:this,api:new ea(this.accessor),getData:Ll}));return}const s=this._params.containerApi,l=n.paneId,a=s.getPanel(l);if(!a){this._onDidDrop.fire(Object.assign(Object.assign({},e),{panel:this,getData:Ll,api:new ea(this.accessor)}));return}const c=s.panels,d=c.indexOf(a);let h=s.panels.indexOf(this);(e.position==="left"||e.position==="top")&&(h=Math.max(0,h-1)),(e.position==="right"||e.position==="bottom")&&(d>h&&h++,h=Math.min(c.length-1,h)),s.movePanel(d,h)}}class LC extends Ne{get element(){return this._element}constructor(e,n){super(),this.accessor=e,this.group=n,this.disposable=new Bn,this._onDidFocus=new U,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new U,this.onDidBlur=this._onDidBlur.event,this._element=document.createElement("div"),this._element.className="dv-content-container",this._element.tabIndex=-1,this.addDisposables(this._onDidFocus,this._onDidBlur);const s=n.dropTargetContainer;this.dropTarget=new rs(this.element,{getOverlayOutline:()=>{var l;return((l=e.options.theme)===null||l===void 0?void 0:l.dndPanelOverlay)==="group"?this.element.parentElement:null},className:"dv-drop-target-content",acceptedTargetZones:["top","bottom","left","right","center"],canDisplayOverlay:(l,a)=>{if(this.group.locked==="no-drop-target"||this.group.locked&&a==="center")return!1;const c=Hn();return!c&&l.shiftKey&&this.group.location.type!=="floating"?!1:c&&c.viewId===this.accessor.id?!0:this.group.canDisplayOverlay(l,a,"content")},getOverrideTarget:s?()=>s.model:void 0}),this.addDisposables(this.dropTarget)}show(){this.element.style.display=""}hide(){this.element.style.display="none"}renderPanel(e,n={asActive:!0}){const s=n.asActive||this.panel&&this.group.isPanelActive(this.panel);this.panel&&this.panel.view.content.element.parentElement===this._element&&this._element.removeChild(this.panel.view.content.element),this.panel=e;let l;switch(e.api.renderer){case"onlyWhenVisible":this.group.renderContainer.detatch(e),this.panel&&s&&this._element.appendChild(this.panel.view.content.element),l=this._element;break;case"always":e.view.content.element.parentElement===this._element&&this._element.removeChild(e.view.content.element),l=this.group.renderContainer.attach({panel:e,referenceContainer:this});break;default:throw new Error(`dockview: invalid renderer type '${e.api.renderer}'`)}if(s){const a=qv(l);this.focusTracker=a;const c=new Ne;c.addDisposables(a,a.onDidFocus(()=>this._onDidFocus.fire()),a.onDidBlur(()=>this._onDidBlur.fire())),this.disposable.value=c}}openPanel(e){this.panel!==e&&this.renderPanel(e)}layout(e,n){}closePanel(){var e;this.panel&&this.panel.api.renderer==="onlyWhenVisible"&&((e=this.panel.view.content.element.parentElement)===null||e===void 0||e.removeChild(this.panel.view.content.element)),this.panel=void 0}dispose(){this.disposable.dispose(),super.dispose()}refreshFocusState(){var e;!((e=this.focusTracker)===null||e===void 0)&&e.refreshState&&this.focusTracker.refreshState()}}function dw(r,e,n){var s,l;ac(e,"dv-dragged"),e.style.top="-9999px",document.body.appendChild(e),r.setDragImage(e,(s=n==null?void 0:n.x)!==null&&s!==void 0?s:0,(l=n==null?void 0:n.y)!==null&&l!==void 0?l:0),setTimeout(()=>{Xl(e,"dv-dragged"),e.remove()},0)}class VC extends nf{constructor(e,n,s,l,a){super(e,a),this.accessor=n,this.group=s,this.panel=l,this.panelTransfer=Ds.getInstance()}getData(e){return this.panelTransfer.setData([new _r(this.accessor.id,this.group.id,this.panel.id)],_r.prototype),{dispose:()=>{this.panelTransfer.clearData(_r.prototype)}}}}class GC extends Ne{get element(){return this._element}constructor(e,n,s){super(),this.panel=e,this.accessor=n,this.group=s,this.content=void 0,this._onPointDown=new U,this.onPointerDown=this._onPointDown.event,this._onDropped=new U,this.onDrop=this._onDropped.event,this._onDragStart=new U,this.onDragStart=this._onDragStart.event,this._element=document.createElement("div"),this._element.className="dv-tab",this._element.tabIndex=0,this._element.draggable=!this.accessor.options.disableDnd,Re(this.element,"dv-inactive-tab",!0),this.dragHandler=new VC(this._element,this.accessor,this.group,this.panel,!!this.accessor.options.disableDnd),this.dropTarget=new rs(this._element,{acceptedTargetZones:["left","right"],overlayModel:{activationSize:{value:50,type:"percentage"}},canDisplayOverlay:(l,a)=>{if(this.group.locked)return!1;const c=Hn();return c&&this.accessor.id===c.viewId?!0:this.group.model.canDisplayOverlay(l,a,"tab")},getOverrideTarget:()=>{var l;return(l=s.model.dropTargetContainer)===null||l===void 0?void 0:l.model}}),this.onWillShowOverlay=this.dropTarget.onWillShowOverlay,this.addDisposables(this._onPointDown,this._onDropped,this._onDragStart,this.dragHandler.onDragStart(l=>{if(l.dataTransfer){const a=getComputedStyle(this.element),c=this.element.cloneNode(!0);Array.from(a).forEach(d=>c.style.setProperty(d,a.getPropertyValue(d),a.getPropertyPriority(d))),c.style.position="absolute",dw(l.dataTransfer,c,{y:-10,x:30})}this._onDragStart.fire(l)}),this.dragHandler,Be(this._element,"pointerdown",l=>{this._onPointDown.fire(l)}),this.dropTarget.onDrop(l=>{this._onDropped.fire(l)}),this.dropTarget)}setActive(e){Re(this.element,"dv-active-tab",e),Re(this.element,"dv-inactive-tab",!e)}setContent(e){this.content&&this._element.removeChild(this.content.element),this.content=e,this._element.appendChild(this.content.element)}updateDragAndDropState(){this._element.draggable=!this.accessor.options.disableDnd,this.dragHandler.setDisabled(!!this.accessor.options.disableDnd)}dispose(){super.dispose()}}class cc{get kind(){return this.options.kind}get nativeEvent(){return this.event.nativeEvent}get position(){return this.event.position}get defaultPrevented(){return this.event.defaultPrevented}get panel(){return this.options.panel}get api(){return this.options.api}get group(){return this.options.group}preventDefault(){this.event.preventDefault()}getData(){return this.options.getData()}constructor(e,n){this.event=e,this.options=n}}class WC extends nf{constructor(e,n,s,l){super(e,l),this.accessor=n,this.group=s,this.panelTransfer=Ds.getInstance(),this.addDisposables(Be(e,"pointerdown",a=>{a.shiftKey&&iC(a)},!0))}isCancelled(e){return this.group.api.location.type==="floating"&&!e.shiftKey}getData(e){const n=e.dataTransfer;this.panelTransfer.setData([new _r(this.accessor.id,this.group.id,null)],_r.prototype);const s=window.getComputedStyle(this.el),l=s.getPropertyValue("--dv-activegroup-visiblepanel-tab-background-color"),a=s.getPropertyValue("--dv-activegroup-visiblepanel-tab-color");if(n){const c=document.createElement("div");c.style.backgroundColor=l,c.style.color=a,c.style.padding="2px 8px",c.style.height="24px",c.style.fontSize="11px",c.style.lineHeight="20px",c.style.borderRadius="12px",c.style.position="absolute",c.style.pointerEvents="none",c.style.top="-9999px",c.textContent=`Multiple Panels (${this.group.size})`,dw(n,c,{y:-10,x:30})}return{dispose:()=>{this.panelTransfer.clearData(_r.prototype)}}}}class FC extends Ne{get element(){return this._element}constructor(e,n){super(),this.accessor=e,this.group=n,this._onDrop=new U,this.onDrop=this._onDrop.event,this._onDragStart=new U,this.onDragStart=this._onDragStart.event,this._element=document.createElement("div"),this._element.className="dv-void-container",this._element.draggable=!this.accessor.options.disableDnd,Re(this._element,"dv-draggable",!this.accessor.options.disableDnd),this.addDisposables(this._onDrop,this._onDragStart,Be(this._element,"pointerdown",()=>{this.accessor.doSetGroupActive(this.group)})),this.handler=new WC(this._element,e,n,!!this.accessor.options.disableDnd),this.dropTarget=new rs(this._element,{acceptedTargetZones:["center"],canDisplayOverlay:(s,l)=>{const a=Hn();return a&&this.accessor.id===a.viewId?!0:n.model.canDisplayOverlay(s,l,"header_space")},getOverrideTarget:()=>{var s;return(s=n.model.dropTargetContainer)===null||s===void 0?void 0:s.model}}),this.onWillShowOverlay=this.dropTarget.onWillShowOverlay,this.addDisposables(this.handler,this.handler.onDragStart(s=>{this._onDragStart.fire(s)}),this.dropTarget.onDrop(s=>{this._onDrop.fire(s)}),this.dropTarget)}updateDragAndDropState(){this._element.draggable=!this.accessor.options.disableDnd,Re(this._element,"dv-draggable",!this.accessor.options.disableDnd),this.handler.setDisabled(!!this.accessor.options.disableDnd)}}class dc extends Ne{get element(){return this._element}constructor(e){super(),this.scrollableElement=e,this._scrollLeft=0,this._element=document.createElement("div"),this._element.className="dv-scrollable",this._horizontalScrollbar=document.createElement("div"),this._horizontalScrollbar.className="dv-scrollbar-horizontal",this.element.appendChild(e),this.element.appendChild(this._horizontalScrollbar),this.addDisposables(Be(this.element,"wheel",n=>{this._scrollLeft+=n.deltaY*dc.MouseWheelSpeed,this.calculateScrollbarStyles()}),Be(this._horizontalScrollbar,"pointerdown",n=>{n.preventDefault(),Re(this.element,"dv-scrollable-scrolling",!0);const s=n.clientX,l=this._scrollLeft,a=d=>{const h=d.clientX-s,{clientWidth:m}=this.element,{scrollWidth:w}=this.scrollableElement,v=m/w;this._scrollLeft=l+h/v,this.calculateScrollbarStyles()},c=()=>{Re(this.element,"dv-scrollable-scrolling",!1),document.removeEventListener("pointermove",a),document.removeEventListener("pointerup",c),document.removeEventListener("pointercancel",c)};document.addEventListener("pointermove",a),document.addEventListener("pointerup",c),document.addEventListener("pointercancel",c)}),Be(this.element,"scroll",()=>{this.calculateScrollbarStyles()}),Be(this.scrollableElement,"scroll",()=>{this._scrollLeft=this.scrollableElement.scrollLeft,this.calculateScrollbarStyles()}),lc(this.element,()=>{Re(this.element,"dv-scrollable-resizing",!0),this._animationTimer&&clearTimeout(this._animationTimer),this._animationTimer=setTimeout(()=>{clearTimeout(this._animationTimer),Re(this.element,"dv-scrollable-resizing",!1)},500),this.calculateScrollbarStyles()}))}calculateScrollbarStyles(){const{clientWidth:e}=this.element,{scrollWidth:n}=this.scrollableElement;if(n>e){const l=e*(e/n);this._horizontalScrollbar.style.width=`${l}px`,this._scrollLeft=_t(this._scrollLeft,0,this.scrollableElement.scrollWidth-e),this.scrollableElement.scrollLeft=this._scrollLeft;const a=this._scrollLeft/(n-e);this._horizontalScrollbar.style.left=`${(e-l)*a}px`}else this._horizontalScrollbar.style.width="0px",this._horizontalScrollbar.style.left="0px",this._scrollLeft=0}}dc.MouseWheelSpeed=1;class HC extends Ne{get showTabsOverflowControl(){return this._showTabsOverflowControl}set showTabsOverflowControl(e){if(this._showTabsOverflowControl!=e&&(this._showTabsOverflowControl=e,e)){const n=new tC(this._tabsList);this._observerDisposable.value=new Ne(n,n.onDidChange(s=>{const l=s.hasScrollX||s.hasScrollY;this.toggleDropdown({reset:!l})}),Be(this._tabsList,"scroll",()=>{this.toggleDropdown({reset:!1})}))}}get element(){return this._element}get panels(){return this._tabs.map(e=>e.value.panel.id)}get size(){return this._tabs.length}get tabs(){return this._tabs.map(e=>e.value)}constructor(e,n,s){if(super(),this.group=e,this.accessor=n,this._observerDisposable=new Bn,this._tabs=[],this.selectedIndex=-1,this._showTabsOverflowControl=!1,this._onTabDragStart=new U,this.onTabDragStart=this._onTabDragStart.event,this._onDrop=new U,this.onDrop=this._onDrop.event,this._onWillShowOverlay=new U,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onOverflowTabsChange=new U,this.onOverflowTabsChange=this._onOverflowTabsChange.event,this._tabsList=document.createElement("div"),this._tabsList.className="dv-tabs-container dv-horizontal",this.showTabsOverflowControl=s.showTabsOverflowControl,n.options.scrollbars==="native")this._element=this._tabsList;else{const l=new dc(this._tabsList);this._element=l.element,this.addDisposables(l)}this.addDisposables(this._onOverflowTabsChange,this._observerDisposable,this._onWillShowOverlay,this._onDrop,this._onTabDragStart,Be(this.element,"pointerdown",l=>{if(l.defaultPrevented)return;l.button===0&&this.accessor.doSetGroupActive(this.group)}),Qt.from(()=>{for(const{value:l,disposable:a}of this._tabs)a.dispose(),l.dispose();this._tabs=[]}))}indexOf(e){return this._tabs.findIndex(n=>n.value.panel.id===e)}isActive(e){return this.selectedIndex>-1&&this._tabs[this.selectedIndex].value===e}setActivePanel(e){let n=0;for(const s of this._tabs){const l=e.id===s.value.panel.id;if(s.value.setActive(l),l){const a=s.value.element,c=a.parentElement;(nc.scrollLeft+c.clientWidth)&&(c.scrollLeft=n)}n+=s.value.element.clientWidth}}openPanel(e,n=this._tabs.length){if(this._tabs.find(c=>c.value.panel.id===e.id))return;const s=new GC(e,this.accessor,this.group);s.setContent(e.view.tab);const l=new Ne(s.onDragStart(c=>{this._onTabDragStart.fire({nativeEvent:c,panel:e})}),s.onPointerDown(c=>{if(c.defaultPrevented)return;const d=!this.accessor.options.disableFloatingGroups,h=this.group.api.location.type==="floating"&&this.size===1;if(d&&!h&&c.shiftKey){c.preventDefault();const m=this.accessor.getGroupPanel(s.panel.id),{top:w,left:v}=s.element.getBoundingClientRect(),{top:S,left:E}=this.accessor.element.getBoundingClientRect();this.accessor.addFloatingGroup(m,{x:v-E,y:w-S,inDragMode:!0});return}switch(c.button){case 0:this.group.activePanel!==e&&this.group.model.openPanel(e);break}}),s.onDrop(c=>{this._onDrop.fire({event:c.nativeEvent,index:this._tabs.findIndex(d=>d.value===s)})}),s.onWillShowOverlay(c=>{this._onWillShowOverlay.fire(new cc(c,{kind:"tab",panel:this.group.activePanel,api:this.accessor.api,group:this.group,getData:Hn}))})),a={value:s,disposable:l};this.addTab(a,n)}delete(e){const n=this.indexOf(e),s=this._tabs.splice(n,1)[0],{value:l,disposable:a}=s;a.dispose(),l.dispose(),l.element.remove()}addTab(e,n=this._tabs.length){if(n<0||n>this._tabs.length)throw new Error("invalid location");this._tabsList.insertBefore(e.value.element,this._tabsList.children[n]),this._tabs=[...this._tabs.slice(0,n),e,...this._tabs.slice(n)],this.selectedIndex<0&&(this.selectedIndex=n)}toggleDropdown(e){const n=e.reset?[]:this._tabs.filter(s=>!uC(s.value.element,this._tabsList)).map(s=>s.value.panel.id);this._onOverflowTabsChange.fire({tabs:n,reset:e.reset})}updateDragAndDropState(){for(const e of this._tabs)e.value.updateDragAndDropState()}}const rf=r=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttributeNS(null,"height",r.height),e.setAttributeNS(null,"width",r.width),e.setAttributeNS(null,"viewBox",r.viewbox),e.setAttributeNS(null,"aria-hidden","false"),e.setAttributeNS(null,"focusable","false"),e.classList.add("dv-svg");const n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttributeNS(null,"d",r.path),e.appendChild(n),e},jC=()=>rf({width:"11",height:"11",viewbox:"0 0 28 28",path:"M2.1 27.3L0 25.2L11.55 13.65L0 2.1L2.1 0L13.65 11.55L25.2 0L27.3 2.1L15.75 13.65L27.3 25.2L25.2 27.3L13.65 15.75L2.1 27.3Z"}),BC=()=>rf({width:"11",height:"11",viewbox:"0 0 24 15",path:"M12 14.15L0 2.15L2.15 0L12 9.9L21.85 0.0499992L24 2.2L12 14.15Z"}),hw=()=>rf({width:"11",height:"11",viewbox:"0 0 15 25",path:"M2.15 24.1L0 21.95L9.9 12.05L0 2.15L2.15 0L14.2 12.05L2.15 24.1Z"});function UC(){const r=document.createElement("div");r.className="dv-tabs-overflow-dropdown-default";const e=document.createElement("span");e.textContent="";const n=hw();return r.appendChild(n),r.appendChild(e),{element:r,update:s=>{e.textContent=`${s.tabs}`}}}class $C extends Ne{get onTabDragStart(){return this.tabs.onTabDragStart}get panels(){return this.tabs.panels}get size(){return this.tabs.size}get hidden(){return this._hidden}set hidden(e){this._hidden=e,this.element.style.display=e?"none":""}get element(){return this._element}constructor(e,n){super(),this.accessor=e,this.group=n,this._hidden=!1,this.dropdownPart=null,this._overflowTabs=[],this._dropdownDisposable=new Bn,this._onDrop=new U,this.onDrop=this._onDrop.event,this._onGroupDragStart=new U,this.onGroupDragStart=this._onGroupDragStart.event,this._onWillShowOverlay=new U,this.onWillShowOverlay=this._onWillShowOverlay.event,this._element=document.createElement("div"),this._element.className="dv-tabs-and-actions-container",Re(this._element,"dv-full-width-single-tab",this.accessor.options.singleTabMode==="fullwidth"),this.rightActionsContainer=document.createElement("div"),this.rightActionsContainer.className="dv-right-actions-container",this.leftActionsContainer=document.createElement("div"),this.leftActionsContainer.className="dv-left-actions-container",this.preActionsContainer=document.createElement("div"),this.preActionsContainer.className="dv-pre-actions-container",this.tabs=new HC(n,e,{showTabsOverflowControl:!e.options.disableTabsOverflowList}),this.voidContainer=new FC(this.accessor,this.group),this._element.appendChild(this.preActionsContainer),this._element.appendChild(this.tabs.element),this._element.appendChild(this.leftActionsContainer),this._element.appendChild(this.voidContainer.element),this._element.appendChild(this.rightActionsContainer),this.addDisposables(this.tabs.onDrop(s=>this._onDrop.fire(s)),this.tabs.onWillShowOverlay(s=>this._onWillShowOverlay.fire(s)),e.onDidOptionsChange(()=>{this.tabs.showTabsOverflowControl=!e.options.disableTabsOverflowList}),this.tabs.onOverflowTabsChange(s=>{this.toggleDropdown(s)}),this.tabs,this._onWillShowOverlay,this._onDrop,this._onGroupDragStart,this.voidContainer,this.voidContainer.onDragStart(s=>{this._onGroupDragStart.fire({nativeEvent:s,group:this.group})}),this.voidContainer.onDrop(s=>{this._onDrop.fire({event:s.nativeEvent,index:this.tabs.size})}),this.voidContainer.onWillShowOverlay(s=>{this._onWillShowOverlay.fire(new cc(s,{kind:"header_space",panel:this.group.activePanel,api:this.accessor.api,group:this.group,getData:Hn}))}),Be(this.voidContainer.element,"pointerdown",s=>{if(s.defaultPrevented)return;if(!this.accessor.options.disableFloatingGroups&&s.shiftKey&&this.group.api.location.type!=="floating"){s.preventDefault();const{top:a,left:c}=this.element.getBoundingClientRect(),{top:d,left:h}=this.accessor.element.getBoundingClientRect();this.accessor.addFloatingGroup(this.group,{x:c-h+20,y:a-d+20,inDragMode:!0})}}))}show(){this.hidden||(this.element.style.display="")}hide(){this._element.style.display="none"}setRightActionsElement(e){this.rightActions!==e&&(this.rightActions&&(this.rightActions.remove(),this.rightActions=void 0),e&&(this.rightActionsContainer.appendChild(e),this.rightActions=e))}setLeftActionsElement(e){this.leftActions!==e&&(this.leftActions&&(this.leftActions.remove(),this.leftActions=void 0),e&&(this.leftActionsContainer.appendChild(e),this.leftActions=e))}setPrefixActionsElement(e){this.preActions!==e&&(this.preActions&&(this.preActions.remove(),this.preActions=void 0),e&&(this.preActionsContainer.appendChild(e),this.preActions=e))}isActive(e){return this.tabs.isActive(e)}indexOf(e){return this.tabs.indexOf(e)}setActive(e){}delete(e){this.tabs.delete(e),this.updateClassnames()}setActivePanel(e){this.tabs.setActivePanel(e)}openPanel(e,n=this.tabs.size){this.tabs.openPanel(e,n),this.updateClassnames()}closePanel(e){this.delete(e.id)}updateClassnames(){Re(this._element,"dv-single-tab",this.size===1)}toggleDropdown(e){const n=e.reset?[]:e.tabs;if(this._overflowTabs=n,this._overflowTabs.length>0&&this.dropdownPart){this.dropdownPart.update({tabs:n.length});return}if(this._overflowTabs.length===0){this._dropdownDisposable.dispose();return}const s=document.createElement("div");s.className="dv-tabs-overflow-dropdown-root";const l=UC();l.update({tabs:n.length}),this.dropdownPart=l,s.appendChild(l.element),this.rightActionsContainer.prepend(s),this._dropdownDisposable.value=new Ne(Qt.from(()=>{var a,c;s.remove(),(c=(a=this.dropdownPart)===null||a===void 0?void 0:a.dispose)===null||c===void 0||c.call(a),this.dropdownPart=null}),Be(s,"pointerdown",a=>{a.preventDefault()},{capture:!0}),Be(s,"click",a=>{const c=document.createElement("div");c.style.overflow="auto",c.className="dv-tabs-overflow-container";for(const h of this.tabs.tabs.filter(m=>this._overflowTabs.includes(m.panel.id))){const m=this.group.panels.find(E=>E===h.panel),v=m.view.createTabRenderer("headerOverflow").element,S=document.createElement("div");Re(S,"dv-tab",!0),Re(S,"dv-active-tab",m.api.isActive),Re(S,"dv-inactive-tab",!m.api.isActive),S.addEventListener("click",E=>{this.accessor.popupService.close(),!E.defaultPrevented&&(h.element.scrollIntoView(),h.panel.api.setActive())}),S.appendChild(v),c.appendChild(S)}const d=fC(s);this.accessor.popupService.openPopover(c,{x:a.clientX,y:a.clientY,zIndex:d!=null&&d.style.zIndex?`calc(${d.style.zIndex} * 2)`:void 0})}))}updateDragAndDropState(){this.tabs.updateDragAndDropState(),this.voidContainer.updateDragAndDropState()}}class fw extends Xv{constructor(e,n,s,l,a){super(),this.nativeEvent=e,this.target=n,this.position=s,this.getData=l,this.group=a}}const Ph=Object.keys({disableAutoResizing:void 0,hideBorders:void 0,singleTabMode:void 0,disableFloatingGroups:void 0,floatingGroupBounds:void 0,popoutUrl:void 0,defaultRenderer:void 0,debug:void 0,rootOverlayModel:void 0,locked:void 0,disableDnd:void 0,className:void 0,noPanelsOverlay:void 0,dndEdges:void 0,theme:void 0,disableTabsOverflowList:void 0,scrollbars:void 0});function YC(r){return!!r.referencePanel}function KC(r){return!!r.referenceGroup}function JC(r){return!!r.referencePanel}function QC(r){return!!r.referenceGroup}class of extends qh{get nativeEvent(){return this.options.nativeEvent}get position(){return this.options.position}get panel(){return this.options.panel}get group(){return this.options.group}get api(){return this.options.api}constructor(e){super(),this.options=e}getData(){return this.options.getData()}}class pw extends of{get kind(){return this._kind}constructor(e){super(e),this._kind=e.kind}}class ZC extends Ne{get element(){throw new Error("dockview: not supported")}get activePanel(){return this._activePanel}get locked(){return this._locked}set locked(e){this._locked=e,Re(this.container,"dv-locked-groupview",e==="no-drop-target"||e)}get isActive(){return this._isGroupActive}get panels(){return this._panels}get size(){return this._panels.length}get isEmpty(){return this._panels.length===0}get hasWatermark(){return!!(this.watermark&&this.container.contains(this.watermark.element))}get header(){return this.tabsContainer}get isContentFocused(){return document.activeElement?_h(document.activeElement,this.contentContainer.element):!1}get location(){return this._location}set location(e){switch(this._location=e,Re(this.container,"dv-groupview-floating",!1),Re(this.container,"dv-groupview-popout",!1),e.type){case"grid":this.contentContainer.dropTarget.setTargetZones(["top","bottom","left","right","center"]);break;case"floating":this.contentContainer.dropTarget.setTargetZones(["center"]),this.contentContainer.dropTarget.setTargetZones(e?["center"]:["top","bottom","left","right","center"]),Re(this.container,"dv-groupview-floating",!0);break;case"popout":this.contentContainer.dropTarget.setTargetZones(["center"]),Re(this.container,"dv-groupview-popout",!0);break}this.groupPanel.api._onDidLocationChange.fire({location:this.location})}constructor(e,n,s,l,a){var c;super(),this.container=e,this.accessor=n,this.id=s,this.options=l,this.groupPanel=a,this._isGroupActive=!1,this._locked=!1,this._location={type:"grid"},this.mostRecentlyUsed=[],this._overwriteRenderContainer=null,this._overwriteDropTargetContainer=null,this._onDidChange=new U,this.onDidChange=this._onDidChange.event,this._width=0,this._height=0,this._panels=[],this._panelDisposables=new Map,this._onMove=new U,this.onMove=this._onMove.event,this._onDidDrop=new U,this.onDidDrop=this._onDidDrop.event,this._onWillDrop=new U,this.onWillDrop=this._onWillDrop.event,this._onWillShowOverlay=new U,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onTabDragStart=new U,this.onTabDragStart=this._onTabDragStart.event,this._onGroupDragStart=new U,this.onGroupDragStart=this._onGroupDragStart.event,this._onDidAddPanel=new U,this.onDidAddPanel=this._onDidAddPanel.event,this._onDidPanelTitleChange=new U,this.onDidPanelTitleChange=this._onDidPanelTitleChange.event,this._onDidPanelParametersChange=new U,this.onDidPanelParametersChange=this._onDidPanelParametersChange.event,this._onDidRemovePanel=new U,this.onDidRemovePanel=this._onDidRemovePanel.event,this._onDidActivePanelChange=new U,this.onDidActivePanelChange=this._onDidActivePanelChange.event,this._onUnhandledDragOverEvent=new U,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,Re(this.container,"dv-groupview",!0),this._api=new Yu(this.accessor),this.tabsContainer=new $C(this.accessor,this.groupPanel),this.contentContainer=new LC(this.accessor,this),e.append(this.tabsContainer.element,this.contentContainer.element),this.header.hidden=!!l.hideHeader,this.locked=(c=l.locked)!==null&&c!==void 0?c:!1,this.addDisposables(this._onTabDragStart,this._onGroupDragStart,this._onWillShowOverlay,this.tabsContainer.onTabDragStart(d=>{this._onTabDragStart.fire(d)}),this.tabsContainer.onGroupDragStart(d=>{this._onGroupDragStart.fire(d)}),this.tabsContainer.onDrop(d=>{this.handleDropEvent("header",d.event,"center",d.index)}),this.contentContainer.onDidFocus(()=>{this.accessor.doSetGroupActive(this.groupPanel)}),this.contentContainer.onDidBlur(()=>{}),this.contentContainer.dropTarget.onDrop(d=>{this.handleDropEvent("content",d.nativeEvent,d.position)}),this.tabsContainer.onWillShowOverlay(d=>{this._onWillShowOverlay.fire(d)}),this.contentContainer.dropTarget.onWillShowOverlay(d=>{this._onWillShowOverlay.fire(new cc(d,{kind:"content",panel:this.activePanel,api:this._api,group:this.groupPanel,getData:Hn}))}),this._onMove,this._onDidChange,this._onDidDrop,this._onWillDrop,this._onDidAddPanel,this._onDidRemovePanel,this._onDidActivePanelChange,this._onUnhandledDragOverEvent,this._onDidPanelTitleChange,this._onDidPanelParametersChange)}focusContent(){this.contentContainer.element.focus()}set renderContainer(e){this.panels.forEach(n=>{this.renderContainer.detatch(n)}),this._overwriteRenderContainer=e,this.panels.forEach(n=>{this.rerender(n)})}get renderContainer(){var e;return(e=this._overwriteRenderContainer)!==null&&e!==void 0?e:this.accessor.overlayRenderContainer}set dropTargetContainer(e){this._overwriteDropTargetContainer=e}get dropTargetContainer(){var e;return(e=this._overwriteDropTargetContainer)!==null&&e!==void 0?e:this.accessor.rootDropTargetContainer}initialize(){this.options.panels&&this.options.panels.forEach(e=>{this.doAddPanel(e)}),this.options.activePanel&&this.openPanel(this.options.activePanel),this.setActive(this.isActive,!0),this.updateContainer(),this.accessor.options.createRightHeaderActionComponent&&(this._rightHeaderActions=this.accessor.options.createRightHeaderActionComponent(this.groupPanel),this.addDisposables(this._rightHeaderActions),this._rightHeaderActions.init({containerApi:this._api,api:this.groupPanel.api,group:this.groupPanel}),this.tabsContainer.setRightActionsElement(this._rightHeaderActions.element)),this.accessor.options.createLeftHeaderActionComponent&&(this._leftHeaderActions=this.accessor.options.createLeftHeaderActionComponent(this.groupPanel),this.addDisposables(this._leftHeaderActions),this._leftHeaderActions.init({containerApi:this._api,api:this.groupPanel.api,group:this.groupPanel}),this.tabsContainer.setLeftActionsElement(this._leftHeaderActions.element)),this.accessor.options.createPrefixHeaderActionComponent&&(this._prefixHeaderActions=this.accessor.options.createPrefixHeaderActionComponent(this.groupPanel),this.addDisposables(this._prefixHeaderActions),this._prefixHeaderActions.init({containerApi:this._api,api:this.groupPanel.api,group:this.groupPanel}),this.tabsContainer.setPrefixActionsElement(this._prefixHeaderActions.element))}rerender(e){this.contentContainer.renderPanel(e,{asActive:!1})}indexOf(e){return this.tabsContainer.indexOf(e.id)}toJSON(){var e;const n={views:this.tabsContainer.panels,activeView:(e=this._activePanel)===null||e===void 0?void 0:e.id,id:this.id};return this.locked!==!1&&(n.locked=this.locked),this.header.hidden&&(n.hideHeader=!0),n}moveToNext(e){e||(e={}),e.panel||(e.panel=this.activePanel);const n=e.panel?this.panels.indexOf(e.panel):-1;let s;if(n0)s=n-1;else if(!e.suppressRoll)s=this.panels.length-1;else return;this.openPanel(this.panels[s])}containsPanel(e){return this.panels.includes(e)}init(e){}update(e){}focus(){var e;(e=this._activePanel)===null||e===void 0||e.focus()}openPanel(e,n={}){(typeof n.index!="number"||n.index>this.panels.length)&&(n.index=this.panels.length);const s=!!n.skipSetActive;if(e.updateParentGroup(this.groupPanel,{skipSetActive:n.skipSetActive}),this.doAddPanel(e,n.index,{skipSetActive:s}),this._activePanel===e){this.contentContainer.renderPanel(e,{asActive:!0});return}s||this.doSetActivePanel(e),n.skipSetGroupActive||this.accessor.doSetGroupActive(this.groupPanel),n.skipSetActive||this.updateContainer()}removePanel(e,n={skipSetActive:!1}){const s=typeof e=="string"?e:e.id,l=this._panels.find(a=>a.id===s);if(!l)throw new Error("invalid operation");return this._removePanel(l,n)}closeAllPanels(){if(this.panels.length>0){const e=[...this.panels];for(const n of e)this.doClose(n)}else this.accessor.removeGroup(this.groupPanel)}closePanel(e){this.doClose(e)}doClose(e){const n=this.panels.length===1&&this.accessor.groups.length===1;this.accessor.removePanel(e,n&&this.accessor.options.noPanelsOverlay==="emptyGroup"?{removeEmptyGroup:!1}:void 0)}isPanelActive(e){return this._activePanel===e}updateActions(e){this.tabsContainer.setRightActionsElement(e)}setActive(e,n=!1){!n&&this.isActive===e||(this._isGroupActive=e,Re(this.container,"dv-active-group",e),Re(this.container,"dv-inactive-group",!e),this.tabsContainer.setActive(this.isActive),!this._activePanel&&this.panels.length>0&&this.doSetActivePanel(this.panels[0]),this.updateContainer())}layout(e,n){var s;this._width=e,this._height=n,this.contentContainer.layout(this._width,this._height),!((s=this._activePanel)===null||s===void 0)&&s.layout&&this._activePanel.layout(this._width,this._height)}_removePanel(e,n){const s=this._activePanel===e;if(this.doRemovePanel(e),s&&this.panels.length>0){const l=this.mostRecentlyUsed[0];this.openPanel(l,{skipSetActive:n.skipSetActive,skipSetGroupActive:n.skipSetActiveGroup})}return this._activePanel&&this.panels.length===0&&this.doSetActivePanel(void 0),n.skipSetActive||this.updateContainer(),e}doRemovePanel(e){const n=this.panels.indexOf(e);if(this._activePanel===e&&this.contentContainer.closePanel(),this.tabsContainer.delete(e.id),this._panels.splice(n,1),this.mostRecentlyUsed.includes(e)){const l=this.mostRecentlyUsed.indexOf(e);this.mostRecentlyUsed.splice(l,1)}const s=this._panelDisposables.get(e.id);s&&(s.dispose(),this._panelDisposables.delete(e.id)),this._onDidRemovePanel.fire({panel:e})}doAddPanel(e,n=this.panels.length,s={skipSetActive:!1}){const a=this._panels.indexOf(e)>-1;this.tabsContainer.show(),this.contentContainer.show(),this.tabsContainer.openPanel(e,n),s.skipSetActive||this.contentContainer.openPanel(e),!a&&(this.updateMru(e),this.panels.splice(n,0,e),this._panelDisposables.set(e.id,new Ne(e.api.onDidTitleChange(c=>this._onDidPanelTitleChange.fire(c)),e.api.onDidParametersChange(c=>this._onDidPanelParametersChange.fire(c)))),this._onDidAddPanel.fire({panel:e}))}doSetActivePanel(e){this._activePanel!==e&&(this._activePanel=e,e&&(this.tabsContainer.setActivePanel(e),this.contentContainer.openPanel(e),e.layout(this._width,this._height),this.updateMru(e),this.contentContainer.refreshFocusState(),this._onDidActivePanelChange.fire({panel:e})))}updateMru(e){this.mostRecentlyUsed.includes(e)&&this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(e),1),this.mostRecentlyUsed=[e,...this.mostRecentlyUsed]}updateContainer(){var e,n;if(this.panels.forEach(s=>s.runEvents()),this.isEmpty&&!this.watermark){const s=this.accessor.createWatermarkComponent();s.init({containerApi:this._api,group:this.groupPanel}),this.watermark=s,Be(this.watermark.element,"pointerdown",()=>{this.isActive||this.accessor.doSetGroupActive(this.groupPanel)}),this.contentContainer.element.appendChild(this.watermark.element)}!this.isEmpty&&this.watermark&&(this.watermark.element.remove(),(n=(e=this.watermark).dispose)===null||n===void 0||n.call(e),this.watermark=void 0)}canDisplayOverlay(e,n,s){const l=new fw(e,s,n,Hn,this.accessor.getPanel(this.id));return this._onUnhandledDragOverEvent.fire(l),l.isAccepted}handleDropEvent(e,n,s,l){if(this.locked==="no-drop-target")return;function a(){switch(e){case"header":return typeof l=="number"?"tab":"header_space";case"content":return"content"}}const c=typeof l=="number"?this.panels[l]:void 0,d=new pw({nativeEvent:n,position:s,panel:c,getData:()=>Hn(),kind:a(),group:this.groupPanel,api:this._api});if(this._onWillDrop.fire(d),d.defaultPrevented)return;const h=Hn();if(h&&h.viewId===this.accessor.id){if(e==="content"&&h.groupId===this.id&&(s==="center"||h.panelId===null)||e==="header"&&h.groupId===this.id&&h.panelId===null)return;if(h.panelId===null){const{groupId:E}=h;this._onMove.fire({target:s,groupId:E,index:l});return}if(this.tabsContainer.indexOf(h.panelId)!==-1&&this.tabsContainer.size===1)return;const{groupId:w,panelId:v}=h;if(this.id===w&&!s&&this.tabsContainer.indexOf(v)===l)return;this._onMove.fire({target:s,groupId:h.groupId,itemId:h.panelId,index:l})}else this._onDidDrop.fire(new of({nativeEvent:n,position:s,panel:c,getData:()=>Hn(),group:this.groupPanel,api:this._api}))}updateDragAndDropState(){this.tabsContainer.updateDragAndDropState()}dispose(){var e,n,s;super.dispose(),(e=this.watermark)===null||e===void 0||e.element.remove(),(s=(n=this.watermark)===null||n===void 0?void 0:n.dispose)===null||s===void 0||s.call(n),this.watermark=void 0;for(const l of this.panels)l.dispose();this.tabsContainer.dispose(),this.contentContainer.dispose()}}class lf extends uw{constructor(e,n,s){super(e,n),this._onDidConstraintsChangeInternal=new U,this.onDidConstraintsChangeInternal=this._onDidConstraintsChangeInternal.event,this._onDidConstraintsChange=new U,this.onDidConstraintsChange=this._onDidConstraintsChange.event,this._onDidSizeChange=new U,this.onDidSizeChange=this._onDidSizeChange.event,this.addDisposables(this._onDidConstraintsChangeInternal,this._onDidConstraintsChange,this._onDidSizeChange),s&&this.initialize(s)}setConstraints(e){this._onDidConstraintsChangeInternal.fire(e)}setSize(e){this._onDidSizeChange.fire(e)}}class mw extends sf{get priority(){return this._priority}get snap(){return this._snap}get minimumWidth(){return this.__minimumWidth()}get minimumHeight(){return this.__minimumHeight()}get maximumHeight(){return this.__maximumHeight()}get maximumWidth(){return this.__maximumWidth()}__minimumWidth(){const e=typeof this._minimumWidth=="function"?this._minimumWidth():this._minimumWidth;return e!==this._evaluatedMinimumWidth&&(this._evaluatedMinimumWidth=e,this.updateConstraints()),e}__maximumWidth(){const e=typeof this._maximumWidth=="function"?this._maximumWidth():this._maximumWidth;return e!==this._evaluatedMaximumWidth&&(this._evaluatedMaximumWidth=e,this.updateConstraints()),e}__minimumHeight(){const e=typeof this._minimumHeight=="function"?this._minimumHeight():this._minimumHeight;return e!==this._evaluatedMinimumHeight&&(this._evaluatedMinimumHeight=e,this.updateConstraints()),e}__maximumHeight(){const e=typeof this._maximumHeight=="function"?this._maximumHeight():this._maximumHeight;return e!==this._evaluatedMaximumHeight&&(this._evaluatedMaximumHeight=e,this.updateConstraints()),e}get isActive(){return this.api.isActive}get isVisible(){return this.api.isVisible}constructor(e,n,s,l){super(e,n,l??new lf(e,n)),this._evaluatedMinimumWidth=0,this._evaluatedMaximumWidth=Number.MAX_SAFE_INTEGER,this._evaluatedMinimumHeight=0,this._evaluatedMaximumHeight=Number.MAX_SAFE_INTEGER,this._minimumWidth=0,this._minimumHeight=0,this._maximumWidth=Number.MAX_SAFE_INTEGER,this._maximumHeight=Number.MAX_SAFE_INTEGER,this._snap=!1,this._onDidChange=new U,this.onDidChange=this._onDidChange.event,typeof(s==null?void 0:s.minimumWidth)=="number"&&(this._minimumWidth=s.minimumWidth),typeof(s==null?void 0:s.maximumWidth)=="number"&&(this._maximumWidth=s.maximumWidth),typeof(s==null?void 0:s.minimumHeight)=="number"&&(this._minimumHeight=s.minimumHeight),typeof(s==null?void 0:s.maximumHeight)=="number"&&(this._maximumHeight=s.maximumHeight),this.api.initialize(this),this.addDisposables(this.api.onWillVisibilityChange(a=>{const{isVisible:c}=a,{accessor:d}=this._params;d.setVisible(this,c)}),this.api.onActiveChange(()=>{const{accessor:a}=this._params;a.doSetGroupActive(this)}),this.api.onDidConstraintsChangeInternal(a=>{(typeof a.minimumWidth=="number"||typeof a.minimumWidth=="function")&&(this._minimumWidth=a.minimumWidth),(typeof a.minimumHeight=="number"||typeof a.minimumHeight=="function")&&(this._minimumHeight=a.minimumHeight),(typeof a.maximumWidth=="number"||typeof a.maximumWidth=="function")&&(this._maximumWidth=a.maximumWidth),(typeof a.maximumHeight=="number"||typeof a.maximumHeight=="function")&&(this._maximumHeight=a.maximumHeight)}),this.api.onDidSizeChange(a=>{this._onDidChange.fire({height:a.height,width:a.width})}),this._onDidChange)}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}init(e){e.maximumHeight&&(this._maximumHeight=e.maximumHeight),e.minimumHeight&&(this._minimumHeight=e.minimumHeight),e.maximumWidth&&(this._maximumWidth=e.maximumWidth),e.minimumWidth&&(this._minimumWidth=e.minimumWidth),this._priority=e.priority,this._snap=!!e.snap,super.init(e),typeof e.isVisible=="boolean"&&this.setVisible(e.isVisible)}updateConstraints(){this.api._onDidConstraintsChange.fire({minimumWidth:this._evaluatedMinimumWidth,maximumWidth:this._evaluatedMaximumWidth,minimumHeight:this._evaluatedMinimumHeight,maximumHeight:this._evaluatedMaximumHeight})}toJSON(){const e=super.toJSON(),n=l=>l===Number.MAX_SAFE_INTEGER?void 0:l,s=l=>l<=0?void 0:l;return Object.assign(Object.assign({},e),{minimumHeight:s(this.minimumHeight),maximumHeight:n(this.maximumHeight),minimumWidth:s(this.minimumWidth),maximumWidth:n(this.maximumWidth),snap:this.snap,priority:this.priority})}}const Vl="dockview: DockviewGroupPanelApiImpl not initialized";class XC extends lf{get location(){if(!this._group)throw new Error(Vl);return this._group.model.location}constructor(e,n){super(e,"__dockviewgroup__"),this.accessor=n,this._onDidLocationChange=new U,this.onDidLocationChange=this._onDidLocationChange.event,this._onDidActivePanelChange=new U,this.onDidActivePanelChange=this._onDidActivePanelChange.event,this.addDisposables(this._onDidLocationChange,this._onDidActivePanelChange,this._onDidVisibilityChange.event(s=>{s.isVisible&&this._pendingSize&&(super.setSize(this._pendingSize),this._pendingSize=void 0)}))}setSize(e){this._pendingSize=Object.assign({},e),super.setSize(e)}close(){if(this._group)return this.accessor.removeGroup(this._group)}getWindow(){return this.location.type==="popout"?this.location.getWindow():window}moveTo(e){var n,s,l,a;if(!this._group)throw new Error(Vl);const c=(n=e.group)!==null&&n!==void 0?n:this.accessor.addGroup({direction:bC((s=e.position)!==null&&s!==void 0?s:"right"),skipSetActive:(l=e.skipSetActive)!==null&&l!==void 0?l:!1});this.accessor.moveGroupOrPanel({from:{groupId:this._group.id},to:{group:c,position:e.group&&(a=e.position)!==null&&a!==void 0?a:"center",index:e.index},skipSetActive:e.skipSetActive})}maximize(){if(!this._group)throw new Error(Vl);this.location.type==="grid"&&this.accessor.maximizeGroup(this._group)}isMaximized(){if(!this._group)throw new Error(Vl);return this.accessor.isMaximizedGroup(this._group)}exitMaximized(){if(!this._group)throw new Error(Vl);this.isMaximized()&&this.accessor.exitMaximizedGroup()}initialize(e){this._group=e}}const qC=100,ex=100;class Cg extends mw{get minimumWidth(){var e;if(typeof this._explicitConstraints.minimumWidth=="number")return this._explicitConstraints.minimumWidth;const n=(e=this.activePanel)===null||e===void 0?void 0:e.minimumWidth;return typeof n=="number"?n:super.__minimumWidth()}get minimumHeight(){var e;if(typeof this._explicitConstraints.minimumHeight=="number")return this._explicitConstraints.minimumHeight;const n=(e=this.activePanel)===null||e===void 0?void 0:e.minimumHeight;return typeof n=="number"?n:super.__minimumHeight()}get maximumWidth(){var e;if(typeof this._explicitConstraints.maximumWidth=="number")return this._explicitConstraints.maximumWidth;const n=(e=this.activePanel)===null||e===void 0?void 0:e.maximumWidth;return typeof n=="number"?n:super.__maximumWidth()}get maximumHeight(){var e;if(typeof this._explicitConstraints.maximumHeight=="number")return this._explicitConstraints.maximumHeight;const n=(e=this.activePanel)===null||e===void 0?void 0:e.maximumHeight;return typeof n=="number"?n:super.__maximumHeight()}get panels(){return this._model.panels}get activePanel(){return this._model.activePanel}get size(){return this._model.size}get model(){return this._model}get locked(){return this._model.locked}set locked(e){this._model.locked=e}get header(){return this._model.header}constructor(e,n,s){var l,a,c,d,h,m;super(n,"groupview_default",{minimumHeight:(a=(l=s.constraints)===null||l===void 0?void 0:l.minimumHeight)!==null&&a!==void 0?a:ex,minimumWidth:(d=(c=s.constraints)===null||c===void 0?void 0:c.minimumWidth)!==null&&d!==void 0?d:qC,maximumHeight:(h=s.constraints)===null||h===void 0?void 0:h.maximumHeight,maximumWidth:(m=s.constraints)===null||m===void 0?void 0:m.maximumWidth},new XC(n,e)),this._explicitConstraints={},this.api.initialize(this),this._model=new ZC(this.element,e,n,s,this),this.addDisposables(this.model.onDidActivePanelChange(w=>{this.api._onDidActivePanelChange.fire(w)}),this.api.onDidConstraintsChangeInternal(w=>{w.minimumWidth!==void 0&&(this._explicitConstraints.minimumWidth=typeof w.minimumWidth=="function"?w.minimumWidth():w.minimumWidth),w.minimumHeight!==void 0&&(this._explicitConstraints.minimumHeight=typeof w.minimumHeight=="function"?w.minimumHeight():w.minimumHeight),w.maximumWidth!==void 0&&(this._explicitConstraints.maximumWidth=typeof w.maximumWidth=="function"?w.maximumWidth():w.maximumWidth),w.maximumHeight!==void 0&&(this._explicitConstraints.maximumHeight=typeof w.maximumHeight=="function"?w.maximumHeight():w.maximumHeight)}))}focus(){this.api.isActive||this.api.setActive(),super.focus()}initialize(){this._model.initialize()}setActive(e){super.setActive(e),this.model.setActive(e)}layout(e,n){super.layout(e,n),this.model.layout(e,n)}getComponent(){return this._model}toJSON(){return this.model.toJSON()}}const tx={className:"dockview-theme-abyss"};class nx extends lf{get location(){return this.group.api.location}get title(){return this.panel.title}get isGroupActive(){return this.group.isActive}get renderer(){return this.panel.renderer}set group(e){const n=this._group;this._group!==e&&(this._group=e,this._onDidGroupChange.fire({}),this.setupGroupEventListeners(n),this._onDidLocationChange.fire({location:this.group.api.location}))}get group(){return this._group}get tabComponent(){return this._tabComponent}constructor(e,n,s,l,a){super(e.id,l),this.panel=e,this.accessor=s,this._onDidTitleChange=new U,this.onDidTitleChange=this._onDidTitleChange.event,this._onDidActiveGroupChange=new U,this.onDidActiveGroupChange=this._onDidActiveGroupChange.event,this._onDidGroupChange=new U,this.onDidGroupChange=this._onDidGroupChange.event,this._onDidRendererChange=new U,this.onDidRendererChange=this._onDidRendererChange.event,this._onDidLocationChange=new U,this.onDidLocationChange=this._onDidLocationChange.event,this.groupEventsDisposable=new Bn,this._tabComponent=a,this.initialize(e),this._group=n,this.setupGroupEventListeners(),this.addDisposables(this.groupEventsDisposable,this._onDidRendererChange,this._onDidTitleChange,this._onDidGroupChange,this._onDidActiveGroupChange,this._onDidLocationChange)}getWindow(){return this.group.api.getWindow()}moveTo(e){var n,s;this.accessor.moveGroupOrPanel({from:{groupId:this._group.id,panelId:this.panel.id},to:{group:(n=e.group)!==null&&n!==void 0?n:this._group,position:e.group&&(s=e.position)!==null&&s!==void 0?s:"center",index:e.index},skipSetActive:e.skipSetActive})}setTitle(e){this.panel.setTitle(e)}setRenderer(e){this.panel.setRenderer(e)}close(){this.group.model.closePanel(this.panel)}maximize(){this.group.api.maximize()}isMaximized(){return this.group.api.isMaximized()}exitMaximized(){this.group.api.exitMaximized()}setupGroupEventListeners(e){var n;let s=(n=e==null?void 0:e.isActive)!==null&&n!==void 0?n:!1;this.groupEventsDisposable.value=new Ne(this.group.api.onDidVisibilityChange(l=>{const a=!l.isVisible&&this.isVisible,c=l.isVisible&&!this.isVisible,d=this.group.model.isPanelActive(this.panel);(a||c&&d)&&this._onDidVisibilityChange.fire(l)}),this.group.api.onDidLocationChange(l=>{this.group===this.panel.group&&this._onDidLocationChange.fire(l)}),this.group.api.onDidActiveChange(()=>{this.group===this.panel.group&&s!==this.isGroupActive&&(s=this.isGroupActive,this._onDidActiveGroupChange.fire({isActive:this.isGroupActive}))}))}}class Go extends Ne{get params(){return this._params}get title(){return this._title}get group(){return this._group}get renderer(){var e;return(e=this._renderer)!==null&&e!==void 0?e:this.accessor.renderer}get minimumWidth(){return this._minimumWidth}get minimumHeight(){return this._minimumHeight}get maximumWidth(){return this._maximumWidth}get maximumHeight(){return this._maximumHeight}constructor(e,n,s,l,a,c,d,h){super(),this.id=e,this.accessor=l,this.containerApi=a,this.view=d,this._renderer=h.renderer,this._group=c,this._minimumWidth=h.minimumWidth,this._minimumHeight=h.minimumHeight,this._maximumWidth=h.maximumWidth,this._maximumHeight=h.maximumHeight,this.api=new nx(this,this._group,l,n,s),this.addDisposables(this.api.onActiveChange(()=>{l.setActivePanel(this)}),this.api.onDidSizeChange(m=>{this.group.api.setSize(m)}),this.api.onDidRendererChange(()=>{this.group.model.rerender(this)}))}init(e){this._params=e.params,this.view.init(Object.assign(Object.assign({},e),{api:this.api,containerApi:this.containerApi})),this.setTitle(e.title)}focus(){const e=new aw;this.api._onWillFocus.fire(e),!e.defaultPrevented&&(this.api.isActive||this.api.setActive())}toJSON(){return{id:this.id,contentComponent:this.view.contentComponent,tabComponent:this.view.tabComponent,params:Object.keys(this._params||{}).length>0?this._params:void 0,title:this.title,renderer:this._renderer,minimumHeight:this._minimumHeight,maximumHeight:this._maximumHeight,minimumWidth:this._minimumWidth,maximumWidth:this._maximumWidth}}setTitle(e){e!==this.title&&(this._title=e,this.api._onDidTitleChange.fire({title:e}))}setRenderer(e){e!==this.renderer&&(this._renderer=e,this.api._onDidRendererChange.fire({renderer:e}))}update(e){var n;this._params=Object.assign(Object.assign({},(n=this._params)!==null&&n!==void 0?n:{}),e.params);for(const s of Object.keys(e.params))e.params[s]===void 0&&delete this._params[s];this.view.update({params:this._params})}updateFromStateModel(e){var n,s,l;this._maximumHeight=e.maximumHeight,this._minimumHeight=e.minimumHeight,this._maximumWidth=e.maximumWidth,this._minimumWidth=e.minimumWidth,this.update({params:(n=e.params)!==null&&n!==void 0?n:{}}),this.setTitle((s=e.title)!==null&&s!==void 0?s:this.id),this.setRenderer((l=e.renderer)!==null&&l!==void 0?l:this.accessor.renderer)}updateParentGroup(e,n){this._group=e,this.api.group=this._group;const s=this._group.model.isPanelActive(this),l=this.group.api.isActive&&s;n!=null&&n.skipSetActive||this.api.isActive!==l&&this.api._onDidActiveChange.fire({isActive:this.group.api.isActive&&s}),this.api.isVisible!==s&&this.api._onDidVisibilityChange.fire({isVisible:s})}runEvents(){const e=this._group.model.isPanelActive(this),n=this.group.api.isActive&&e;this.api.isActive!==n&&this.api._onDidActiveChange.fire({isActive:this.group.api.isActive&&e}),this.api.isVisible!==e&&this.api._onDidVisibilityChange.fire({isVisible:e})}layout(e,n){this.api._onDidDimensionChange.fire({width:e,height:n}),this.view.layout(e,n)}dispose(){this.api.dispose(),this.view.dispose()}}class xg extends Ne{get element(){return this._element}constructor(){super(),this._element=document.createElement("div"),this._element.className="dv-default-tab",this._content=document.createElement("div"),this._content.className="dv-default-tab-content",this.action=document.createElement("div"),this.action.className="dv-default-tab-action",this.action.appendChild(jC()),this._element.appendChild(this._content),this._element.appendChild(this.action),this.render()}init(e){this._title=e.title,this.addDisposables(e.api.onDidTitleChange(n=>{this._title=n.title,this.render()}),Be(this.action,"pointerdown",n=>{n.preventDefault()}),Be(this.action,"click",n=>{n.defaultPrevented||(n.preventDefault(),e.api.close())})),this.render()}render(){var e;this._content.textContent!==this._title&&(this._content.textContent=(e=this._title)!==null&&e!==void 0?e:"")}}class gw{get content(){return this._content}get tab(){return this._tab}constructor(e,n,s,l){this.accessor=e,this.id=n,this.contentComponent=s,this.tabComponent=l,this._content=this.createContentComponent(this.id,s),this._tab=this.createTabComponent(this.id,l)}createTabRenderer(e){var n;const s=this.createTabComponent(this.id,this.tabComponent);return this._params&&s.init(Object.assign(Object.assign({},this._params),{tabLocation:e})),this._updateEvent&&((n=s.update)===null||n===void 0||n.call(s,this._updateEvent)),s}init(e){this._params=e,this.content.init(e),this.tab.init(Object.assign(Object.assign({},e),{tabLocation:"header"}))}layout(e,n){var s,l;(l=(s=this.content).layout)===null||l===void 0||l.call(s,e,n)}update(e){var n,s,l,a;this._updateEvent=e,(s=(n=this.content).update)===null||s===void 0||s.call(n,e),(a=(l=this.tab).update)===null||a===void 0||a.call(l,e)}dispose(){var e,n,s,l;(n=(e=this.content).dispose)===null||n===void 0||n.call(e),(l=(s=this.tab).dispose)===null||l===void 0||l.call(s)}createContentComponent(e,n){return this.accessor.options.createComponent({id:e,name:n})}createTabComponent(e,n){const s=n??this.accessor.options.defaultTabComponent;if(s){if(this.accessor.options.createTabComponent){const l=this.accessor.options.createTabComponent({id:e,name:s});return l||new xg}console.warn(`dockview: tabComponent '${n}' was not found. falling back to the default tab.`)}return new xg}}class ix{constructor(e){this.accessor=e}fromJSON(e,n){var s,l;const a=e.id,c=e.params,d=e.title,h=e.view,m=h?h.content.id:(s=e.contentComponent)!==null&&s!==void 0?s:"unknown",w=h?(l=h.tab)===null||l===void 0?void 0:l.id:e.tabComponent,v=new gw(this.accessor,a,m,w),S=new Go(a,m,w,this.accessor,new Yu(this.accessor),n,v,{renderer:e.renderer,minimumWidth:e.minimumWidth,minimumHeight:e.minimumHeight,maximumWidth:e.maximumWidth,maximumHeight:e.maximumHeight});return S.init({title:d??a,params:c??{}}),S}}class sx extends Ne{get element(){return this._element}constructor(){super(),this._element=document.createElement("div"),this._element.className="dv-watermark"}init(e){}}class rx{constructor(){this._orderedList=[]}push(e){this._orderedList=[...this._orderedList.filter(n=>n!==e),e],this.update()}destroy(e){this._orderedList=this._orderedList.filter(n=>n!==e),this.update()}update(){for(let e=0;e{let a=null;const c=Uu();s.value=new Ne({dispose:()=>{c.release()}},Be(window,"pointermove",d=>{const h=this.options.container.getBoundingClientRect(),m=d.clientX-h.left,w=d.clientY-h.top;Re(this._element,"dv-resize-container-dragging",!0);const v=this._element.getBoundingClientRect();a===null&&(a={x:d.clientX-v.left,y:d.clientY-v.top});const S=Math.max(0,this.getMinimumWidth(v.width)),E=Math.max(0,this.getMinimumHeight(v.height)),A=_t(w-a.y,-E,Math.max(0,h.height-v.height+E)),D=_t(a.y-w+h.height-v.height,-E,Math.max(0,h.height-v.height+E)),P=_t(m-a.x,-S,Math.max(0,h.width-v.width+S)),N=_t(a.x-m+h.width-v.width,-S,Math.max(0,h.width-v.width+S)),O={};A<=D?O.top=A:O.bottom=D,P<=N?O.left=P:O.right=N,this.setBounds(O)}),Be(window,"pointerup",()=>{Re(this._element,"dv-resize-container-dragging",!1),s.dispose(),this._onDidChangeEnd.fire()}))};this.addDisposables(s,Be(e,"pointerdown",a=>{if(a.defaultPrevented){a.preventDefault();return}yg(a)||l()}),Be(this.options.content,"pointerdown",a=>{a.defaultPrevented||yg(a)||a.shiftKey&&l()}),Be(this.options.content,"pointerdown",()=>{Du.push(this._element)},!0)),n.inDragMode&&l()}setupResize(e){const n=document.createElement("div");n.className=`dv-resize-handle-${e}`,this._element.appendChild(n);const s=new Bn;this.addDisposables(s,Be(n,"pointerdown",l=>{l.preventDefault();let a=null;const c=Uu();s.value=new Ne(Be(window,"pointermove",d=>{const h=this.options.container.getBoundingClientRect(),m=this._element.getBoundingClientRect(),w=d.clientY-h.top,v=d.clientX-h.left;a===null&&(a={originalY:w,originalHeight:m.height,originalX:v,originalWidth:m.width});let S,E,A,D,P,N;const O=()=>{const $=a.originalY+a.originalHeight>h.height?Math.max(0,h.height-ys.MINIMUM_HEIGHT):Math.max(0,a.originalY+a.originalHeight-ys.MINIMUM_HEIGHT);S=_t(w,0,$),A=a.originalY+a.originalHeight-S,E=h.height-S-A},M=()=>{S=a.originalY-a.originalHeight;const $=S<0&&typeof this.options.minimumInViewportHeight=="number"?-S+this.options.minimumInViewportHeight:ys.MINIMUM_HEIGHT,K=h.height-Math.max(0,S);A=_t(w-S,$,K),E=h.height-S-A},R=()=>{const $=a.originalX+a.originalWidth>h.width?Math.max(0,h.width-ys.MINIMUM_WIDTH):Math.max(0,a.originalX+a.originalWidth-ys.MINIMUM_WIDTH);D=_t(v,0,$),N=a.originalX+a.originalWidth-D,P=h.width-D-N},Z=()=>{D=a.originalX-a.originalWidth;const $=D<0&&typeof this.options.minimumInViewportWidth=="number"?-D+this.options.minimumInViewportWidth:ys.MINIMUM_WIDTH,K=h.width-Math.max(0,D);N=_t(v-D,$,K),P=h.width-D-N};switch(e){case"top":O();break;case"bottom":M();break;case"left":R();break;case"right":Z();break;case"topleft":O(),R();break;case"topright":O(),Z();break;case"bottomleft":M(),R();break;case"bottomright":M(),Z();break}const G={};S<=E?G.top=S:G.bottom=E,D<=P?G.left=D:G.right=P,G.height=A,G.width=N,this.setBounds(G)}),{dispose:()=>{c.release()}},Be(window,"pointerup",()=>{s.dispose(),this._onDidChangeEnd.fire()}))}))}getMinimumWidth(e){return typeof this.options.minimumInViewportWidth=="number"?e-this.options.minimumInViewportWidth:0}getMinimumHeight(e){return typeof this.options.minimumInViewportHeight=="number"?e-this.options.minimumInViewportHeight:0}dispose(){Du.destroy(this._element),this._element.remove(),super.dispose()}}ys.MINIMUM_HEIGHT=20;ys.MINIMUM_WIDTH=20;class ox extends Ne{constructor(e,n){super(),this.group=e,this.overlay=n,this.addDisposables(n)}position(e){this.overlay.setBounds(e)}}const Cu=100,gr={left:100,top:100,width:300,height:300},lx=100;class ax{constructor(){this.cache=new Map,this.currentFrameId=0,this.rafId=null}getPosition(e){const n=this.cache.get(e);if(n&&n.frameId===this.currentFrameId)return n.rect;this.scheduleFrameUpdate();const s=yh(e);return this.cache.set(e,{rect:s,frameId:this.currentFrameId}),s}invalidate(){this.currentFrameId++}scheduleFrameUpdate(){this.rafId||(this.rafId=requestAnimationFrame(()=>{this.currentFrameId++,this.rafId=null}))}}function ux(){const r=document.createElement("div");return r.tabIndex=-1,r}class Eg extends Ne{constructor(e,n){super(),this.element=e,this.accessor=n,this.map={},this._disposed=!1,this.positionCache=new ax,this.pendingUpdates=new Set,this.addDisposables(Qt.from(()=>{for(const s of Object.values(this.map))s.disposable.dispose(),s.destroy.dispose();this._disposed=!0}))}updateAllPositions(){if(!this._disposed){this.positionCache.invalidate();for(const e of Object.values(this.map))e.panel.api.isVisible&&e.resize&&e.resize()}}detatch(e){if(this.map[e.api.id]){const{disposable:n,destroy:s}=this.map[e.api.id];return n.dispose(),s.dispose(),delete this.map[e.api.id],!0}return!1}attach(e){const{panel:n,referenceContainer:s}=e;if(!this.map[n.api.id]){const w=ux();w.className="dv-render-overlay",this.map[n.api.id]={panel:n,disposable:Qt.NONE,destroy:Qt.NONE,element:w}}const l=this.map[n.api.id].element;n.view.content.element.parentElement!==l&&l.appendChild(n.view.content.element),l.parentElement!==this.element&&this.element.appendChild(l);const a=()=>{const w=n.api.id;this.pendingUpdates.has(w)||(this.pendingUpdates.add(w),requestAnimationFrame(()=>{if(this.pendingUpdates.delete(w),this.isDisposed||!this.map[w])return;const v=this.positionCache.getPosition(s.element),S=this.positionCache.getPosition(this.element),E=v.left-S.left,A=v.top-S.top,D=v.width,P=v.height;l.style.left=`${E}px`,l.style.top=`${A}px`,l.style.width=`${D}px`,l.style.height=`${P}px`,Re(l,"dv-render-overlay-float",n.group.api.location.type==="floating")}))},c=()=>{n.api.isVisible&&(this.positionCache.invalidate(),a()),l.style.display=n.api.isVisible?"":"none"},d=new Bn,h=()=>{n.api.location.type==="floating"?queueMicrotask(()=>{const w=this.accessor.floatingGroups.find(A=>A.group===n.api.group);if(!w)return;const v=w.overlay.element,S=()=>{const A=Number(v.getAttribute("aria-level"));l.style.zIndex=`calc(var(--dv-overlay-z-index, 999) + ${A*2+1})`},E=new MutationObserver(()=>{S()});d.value=Qt.from(()=>E.disconnect()),E.observe(v,{attributeFilter:["aria-level"],attributes:!0}),S()}):l.style.zIndex=""},m=new Ne(d,new lw(l,{onDragEnd:w=>{s.dropTarget.dnd.onDragEnd(w)},onDragEnter:w=>{s.dropTarget.dnd.onDragEnter(w)},onDragLeave:w=>{s.dropTarget.dnd.onDragLeave(w)},onDrop:w=>{s.dropTarget.dnd.onDrop(w)},onDragOver:w=>{s.dropTarget.dnd.onDragOver(w)}}),n.api.onDidVisibilityChange(()=>{c()}),n.api.onDidDimensionsChange(()=>{n.api.isVisible&&a()}),n.api.onDidLocationChange(()=>{h()}));return this.map[n.api.id].destroy=Qt.from(()=>{var w;n.view.content.element.parentElement===l&&l.removeChild(n.view.content.element),(w=l.parentElement)===null||w===void 0||w.removeChild(l)}),h(),queueMicrotask(()=>{this.isDisposed||c()}),this.map[n.api.id].disposable.dispose(),this.map[n.api.id].disposable=m,this.map[n.api.id].resize=a,l}}var cx=function(r,e,n,s){function l(a){return a instanceof n?a:new n(function(c){c(a)})}return new(n||(n=Promise))(function(a,c){function d(w){try{m(s.next(w))}catch(v){c(v)}}function h(w){try{m(s.throw(w))}catch(v){c(v)}}function m(w){w.done?a(w.value):l(w.value).then(d,h)}m((s=s.apply(r,e||[])).next())})};class dx extends Ne{get window(){var e,n;return(n=(e=this._window)===null||e===void 0?void 0:e.value)!==null&&n!==void 0?n:null}constructor(e,n,s){super(),this.target=e,this.className=n,this.options=s,this._onWillClose=new U,this.onWillClose=this._onWillClose.event,this._onDidClose=new U,this.onDidClose=this._onDidClose.event,this._window=null,this.addDisposables(this._onWillClose,this._onDidClose,{dispose:()=>{this.close()}})}dimensions(){if(!this._window)return null;const e=this._window.value.screenX,n=this._window.value.screenY,s=this._window.value.innerWidth,l=this._window.value.innerHeight;return{top:n,left:e,width:s,height:l}}close(){var e,n;this._window&&(this._onWillClose.fire(),(n=(e=this.options).onWillClose)===null||n===void 0||n.call(e,{id:this.target,window:this._window.value}),this._window.disposable.dispose(),this._window=null,this._onDidClose.fire())}open(){var e,n;return cx(this,void 0,void 0,function*(){if(this._window)throw new Error("instance of popout window is already open");const s=`${this.options.url}`,l=Object.entries({top:this.options.top,left:this.options.left,width:this.options.width,height:this.options.height}).map(([h,m])=>`${h}=${m}`).join(","),a=window.open(s,this.target,l);if(!a)return null;const c=new Ne;this._window={value:a,disposable:c},c.addDisposables(Qt.from(()=>{a.close()}),Be(window,"beforeunload",()=>{this.close()}));const d=this.createPopoutWindowContainer();return this.className&&d.classList.add(this.className),(n=(e=this.options).onDidOpen)===null||n===void 0||n.call(e,{id:this.target,window:a}),new Promise((h,m)=>{a.addEventListener("unload",w=>{}),a.addEventListener("load",()=>{try{const w=a.document;w.title=document.title,w.body.appendChild(d),sC(w,window.document.styleSheets),Be(a,"beforeunload",()=>{this.close()}),h(d)}catch(w){m(w)}})})})}createPopoutWindowContainer(){const e=document.createElement("div");return e.classList.add("dv-popout-window"),e.id="dv-popout-window",e.style.position="absolute",e.style.width="100%",e.style.height="100%",e.style.top="0px",e.style.left="0px",e}}class hx extends Ne{constructor(e){super(),this.accessor=e,this.init()}init(){const e=new Set,n=new Set;this.addDisposables(this.accessor.onDidAddPanel(s=>{if(e.has(s.api.id))throw new Error(`dockview: Invalid event sequence. [onDidAddPanel] called for panel ${s.api.id} but panel already exists`);e.add(s.api.id)}),this.accessor.onDidRemovePanel(s=>{if(e.has(s.api.id))e.delete(s.api.id);else throw new Error(`dockview: Invalid event sequence. [onDidRemovePanel] called for panel ${s.api.id} but panel does not exists`)}),this.accessor.onDidAddGroup(s=>{if(n.has(s.api.id))throw new Error(`dockview: Invalid event sequence. [onDidAddGroup] called for group ${s.api.id} but group already exists`);n.add(s.api.id)}),this.accessor.onDidRemoveGroup(s=>{if(n.has(s.api.id))n.delete(s.api.id);else throw new Error(`dockview: Invalid event sequence. [onDidRemoveGroup] called for group ${s.api.id} but group does not exists`)}))}}class fx extends Ne{constructor(e){super(),this.root=e,this._active=null,this._activeDisposable=new Bn,this._element=document.createElement("div"),this._element.className="dv-popover-anchor",this._element.style.position="relative",this.root.prepend(this._element),this.addDisposables(Qt.from(()=>{this.close()}),this._activeDisposable)}openPopover(e,n){var s;this.close();const l=document.createElement("div");l.style.position="absolute",l.style.zIndex=(s=n.zIndex)!==null&&s!==void 0?s:"var(--dv-overlay-z-index)",l.appendChild(e);const a=this._element.getBoundingClientRect(),c=a.left,d=a.top;l.style.top=`${n.y-d}px`,l.style.left=`${n.x-c}px`,this._element.appendChild(l),this._active=l,this._activeDisposable.value=new Ne(Be(window,"pointerdown",h=>{var m;const w=h.target;if(!(w instanceof HTMLElement))return;let v=w;for(;v&&v!==l;)v=(m=v==null?void 0:v.parentElement)!==null&&m!==void 0?m:null;v||this.close()})),requestAnimationFrame(()=>{hC(l,this.root)})}close(){this._active&&(this._active.remove(),this._activeDisposable.dispose(),this._active=null)}}class bg extends Ne{get disabled(){return this._disabled}set disabled(e){var n;this.disabled!==e&&(this._disabled=e,e&&((n=this.model)===null||n===void 0||n.clear()))}get model(){if(!this.disabled)return{clear:()=>{var e;this._model&&((e=this._model.root.parentElement)===null||e===void 0||e.removeChild(this._model.root)),this._model=void 0},exists:()=>!!this._model,getElements:(e,n)=>{const s=this._outline!==n;if(this._outline=n,this._model)return this._model.changed=s,this._model;const l=this.createContainer(),a=this.createAnchor();if(this._model={root:l,overlay:a,changed:s},l.appendChild(a),this.element.appendChild(l),(e==null?void 0:e.target)instanceof HTMLElement){const c=e.target.getBoundingClientRect(),d=this.element.getBoundingClientRect();a.style.left=`${c.left-d.left}px`,a.style.top=`${c.top-d.top}px`}return this._model}}}constructor(e,n){super(),this.element=e,this._disabled=!1,this._disabled=n.disabled,this.addDisposables(Qt.from(()=>{var s;(s=this.model)===null||s===void 0||s.clear()}))}createContainer(){const e=document.createElement("div");return e.className="dv-drop-target-container",e}createAnchor(){const e=document.createElement("div");return e.className="dv-drop-target-anchor",e.style.visibility="hidden",e}}const Pg={activationSize:{type:"pixels",value:10},size:{type:"pixels",value:20}};function xu(r){const e=r.from.activePanel;[...r.from.panels].map(s=>{const l=r.from.model.removePanel(s);return r.from.model.renderContainer.detatch(s),l}).forEach(s=>{r.to.model.openPanel(s,{skipSetActive:e!==s,skipSetGroupActive:!0})})}class px extends sw{get orientation(){return this.gridview.orientation}get totalPanels(){return this.panels.length}get panels(){return this.groups.flatMap(e=>e.panels)}get options(){return this._options}get activePanel(){const e=this.activeGroup;if(e)return e.activePanel}get renderer(){var e;return(e=this.options.defaultRenderer)!==null&&e!==void 0?e:"onlyWhenVisible"}get api(){return this._api}get floatingGroups(){return this._floatingGroups}get popoutRestorationPromise(){return this._popoutRestorationPromise}constructor(e,n){var s,l,a;super(e,{proportionalLayout:!0,orientation:ke.HORIZONTAL,styles:n.hideBorders?{separatorBorder:"transparent"}:void 0,disableAutoResizing:n.disableAutoResizing,locked:n.locked,margin:(l=(s=n.theme)===null||s===void 0?void 0:s.gap)!==null&&l!==void 0?l:0,className:n.className}),this.nextGroupId=ef(),this._deserializer=new ix(this),this._watermark=null,this._onWillDragPanel=new U,this.onWillDragPanel=this._onWillDragPanel.event,this._onWillDragGroup=new U,this.onWillDragGroup=this._onWillDragGroup.event,this._onDidDrop=new U,this.onDidDrop=this._onDidDrop.event,this._onWillDrop=new U,this.onWillDrop=this._onWillDrop.event,this._onWillShowOverlay=new U,this.onWillShowOverlay=this._onWillShowOverlay.event,this._onUnhandledDragOverEvent=new U,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,this._onDidRemovePanel=new U,this.onDidRemovePanel=this._onDidRemovePanel.event,this._onDidAddPanel=new U,this.onDidAddPanel=this._onDidAddPanel.event,this._onDidPopoutGroupSizeChange=new U,this.onDidPopoutGroupSizeChange=this._onDidPopoutGroupSizeChange.event,this._onDidPopoutGroupPositionChange=new U,this.onDidPopoutGroupPositionChange=this._onDidPopoutGroupPositionChange.event,this._onDidOpenPopoutWindowFail=new U,this.onDidOpenPopoutWindowFail=this._onDidOpenPopoutWindowFail.event,this._onDidLayoutFromJSON=new U,this.onDidLayoutFromJSON=this._onDidLayoutFromJSON.event,this._onDidActivePanelChange=new U({replay:!0}),this.onDidActivePanelChange=this._onDidActivePanelChange.event,this._onDidMovePanel=new U,this.onDidMovePanel=this._onDidMovePanel.event,this._onDidMaximizedGroupChange=new U,this.onDidMaximizedGroupChange=this._onDidMaximizedGroupChange.event,this._floatingGroups=[],this._popoutGroups=[],this._popoutRestorationPromise=Promise.resolve(),this._onDidRemoveGroup=new U,this.onDidRemoveGroup=this._onDidRemoveGroup.event,this._onDidAddGroup=new U,this.onDidAddGroup=this._onDidAddGroup.event,this._onDidOptionsChange=new U,this.onDidOptionsChange=this._onDidOptionsChange.event,this._onDidActiveGroupChange=new U,this.onDidActiveGroupChange=this._onDidActiveGroupChange.event,this._moving=!1,this._options=n,this.popupService=new fx(this.element),this._themeClassnames=new uc(this.element),this._api=new Yu(this),this.rootDropTargetContainer=new bg(this.element,{disabled:!0}),this.overlayRenderContainer=new Eg(this.gridview.element,this),this._rootDropTarget=new rs(this.element,{className:"dv-drop-target-edge",canDisplayOverlay:(c,d)=>{const h=Hn();if(h)return h.viewId!==this.id?!1:d==="center"?this.gridview.length===0:!0;if(d==="center"&&this.gridview.length!==0)return!1;const m=new fw(c,"edge",d,Hn);return this._onUnhandledDragOverEvent.fire(m),m.isAccepted},acceptedTargetZones:["top","bottom","left","right","center"],overlayModel:(a=n.rootOverlayModel)!==null&&a!==void 0?a:Pg,getOverrideTarget:()=>{var c;return(c=this.rootDropTargetContainer)===null||c===void 0?void 0:c.model}}),this.updateDropTargetModel(n),Re(this.gridview.element,"dv-dockview",!0),Re(this.element,"dv-debug",!!n.debug),this.updateTheme(),this.updateWatermark(),n.debug&&this.addDisposables(new hx(this)),this.addDisposables(this.rootDropTargetContainer,this.overlayRenderContainer,this._onWillDragPanel,this._onWillDragGroup,this._onWillShowOverlay,this._onDidActivePanelChange,this._onDidAddPanel,this._onDidRemovePanel,this._onDidLayoutFromJSON,this._onDidDrop,this._onWillDrop,this._onDidMovePanel,this._onDidMovePanel.event(()=>{this.debouncedUpdateAllPositions()}),this._onDidAddGroup,this._onDidRemoveGroup,this._onDidActiveGroupChange,this._onUnhandledDragOverEvent,this._onDidMaximizedGroupChange,this._onDidOptionsChange,this._onDidPopoutGroupSizeChange,this._onDidPopoutGroupPositionChange,this._onDidOpenPopoutWindowFail,this.onDidViewVisibilityChangeMicroTaskQueue(()=>{this.updateWatermark()}),this.onDidAdd(c=>{this._moving||this._onDidAddGroup.fire(c)}),this.onDidRemove(c=>{this._moving||this._onDidRemoveGroup.fire(c)}),this.onDidActiveChange(c=>{this._moving||this._onDidActiveGroupChange.fire(c)}),this.onDidMaximizedChange(c=>{this._onDidMaximizedGroupChange.fire({group:c.panel,isMaximized:c.isMaximized})}),Zr.any(this.onDidAdd,this.onDidRemove)(()=>{this.updateWatermark()}),Zr.any(this.onDidAddPanel,this.onDidRemovePanel,this.onDidAddGroup,this.onDidRemove,this.onDidMovePanel,this.onDidActivePanelChange,this.onDidPopoutGroupPositionChange,this.onDidPopoutGroupSizeChange)(()=>{this._bufferOnDidLayoutChange.fire()}),Qt.from(()=>{for(const c of[...this._floatingGroups])c.dispose();for(const c of[...this._popoutGroups])c.disposable.dispose()}),this._rootDropTarget,this._rootDropTarget.onWillShowOverlay(c=>{this.gridview.length>0&&c.position==="center"||this._onWillShowOverlay.fire(new cc(c,{kind:"edge",panel:void 0,api:this._api,group:void 0,getData:Hn}))}),this._rootDropTarget.onDrop(c=>{var d;const h=new pw({nativeEvent:c.nativeEvent,position:c.position,panel:void 0,api:this._api,group:void 0,getData:Hn,kind:"edge"});if(this._onWillDrop.fire(h),h.defaultPrevented)return;const m=Hn();m?this.moveGroupOrPanel({from:{groupId:m.groupId,panelId:(d=m.panelId)!==null&&d!==void 0?d:void 0},to:{group:this.orthogonalize(c.position),position:"center"}}):this._onDidDrop.fire(new of({nativeEvent:c.nativeEvent,position:c.position,panel:void 0,api:this._api,group:void 0,getData:Hn}))}),this._rootDropTarget)}setVisible(e,n){switch(e.api.location.type){case"grid":super.setVisible(e,n);break;case"floating":{const s=this.floatingGroups.find(l=>l.group===e);s&&(s.overlay.setVisible(n),e.api._onDidVisibilityChange.fire({isVisible:n}));break}case"popout":console.warn("dockview: You cannot hide a group that is in a popout window");break}}addPopoutGroup(e,n){var s,l,a,c,d;if(e instanceof Go&&e.group.size===1)return this.addPopoutGroup(e.group,n);const h=aC(this.gridview.element),m=this.element;function w(){return n!=null&&n.position?n.position:e instanceof Cg?e.element.getBoundingClientRect():e.group?e.group.element.getBoundingClientRect():m.getBoundingClientRect()}const v=w(),S=(l=(s=n==null?void 0:n.overridePopoutGroup)===null||s===void 0?void 0:s.id)!==null&&l!==void 0?l:this.getNextGroupId(),E=new dx(`${this.id}-${S}`,h??"",{url:(d=(a=n==null?void 0:n.popoutUrl)!==null&&a!==void 0?a:(c=this.options)===null||c===void 0?void 0:c.popoutUrl)!==null&&d!==void 0?d:"/popout.html",left:window.screenX+v.left,top:window.screenY+v.top,width:v.width,height:v.height,onDidOpen:n==null?void 0:n.onDidOpen,onWillClose:n==null?void 0:n.onWillClose}),A=new Ne(E,E.onDidClose(()=>{A.dispose()}));return E.open().then(D=>{var P;if(E.isDisposed)return!1;const N=n!=null&&n.referenceGroup?n.referenceGroup:e instanceof Go?e.group:e,O=e.api.location.type,M=N.element.parentElement!==null;let R;if(M?n!=null&&n.overridePopoutGroup?R=n.overridePopoutGroup:(R=this.createGroup({id:S}),D&&this._onDidAddGroup.fire(R)):R=N,D===null)return console.error("dockview: failed to create popout. perhaps you need to allow pop-ups for this website"),A.dispose(),this._onDidOpenPopoutWindowFail.fire(),this.movingLock(()=>xu({from:R,to:N})),N.api.isVisible||N.api.setVisible(!0),!1;const Z=document.createElement("div");Z.className="dv-overlay-render-container";const G=new Eg(Z,this);R.model.renderContainer=G,R.layout(E.window.innerWidth,E.window.innerHeight);let $;if(!(n!=null&&n.overridePopoutGroup)&&M)if(e instanceof Go)this.movingLock(()=>{const ce=N.model.removePanel(e);R.model.openPanel(ce)});else switch(this.movingLock(()=>xu({from:N,to:R})),O){case"grid":N.api.setVisible(!1);break;case"floating":case"popout":$=(P=this._floatingGroups.find(ce=>ce.group.api.id===e.api.id))===null||P===void 0?void 0:P.overlay.toJSON(),this.removeGroup(N);break}D.classList.add("dv-dockview"),D.style.overflow="hidden",D.appendChild(Z),D.appendChild(R.element);const K=document.createElement("div"),he=new bg(K,{disabled:this.rootDropTargetContainer.disabled});D.appendChild(K),R.model.dropTargetContainer=he,R.model.location={type:"popout",getWindow:()=>E.window,popoutUrl:n==null?void 0:n.popoutUrl},M&&e.api.location.type==="grid"&&e.api.setVisible(!1),this.doSetGroupAndPanelActive(R),A.addDisposables(R.api.onDidActiveChange(ce=>{var j;ce.isActive&&((j=E.window)===null||j===void 0||j.focus())}),R.api.onWillFocus(()=>{var ce;(ce=E.window)===null||ce===void 0||ce.focus()}));let ue;const Q=M&&N&&this.getPanel(N.id),ve={window:E,popoutGroup:R,referenceGroup:Q?N.id:void 0,disposable:{dispose:()=>(A.dispose(),ue)}},ie=cC(E.window);return A.addDisposables(ie,dC(E.window,()=>{this._onDidPopoutGroupSizeChange.fire({width:E.window.innerWidth,height:E.window.innerHeight,group:R})}),ie.event(()=>{this._onDidPopoutGroupPositionChange.fire({screenX:E.window.screenX,screenY:E.window.screenX,group:R})}),Be(E.window,"resize",()=>{R.layout(E.window.innerWidth,E.window.innerHeight)}),G,Qt.from(()=>{if(!this.isDisposed){if(M&&this.getPanel(N.id))this.movingLock(()=>xu({from:R,to:N})),N.api.isVisible||N.api.setVisible(!0),this.getPanel(R.id)&&this.doRemoveGroup(R,{skipPopoutAssociated:!0});else if(this.getPanel(R.id)){if(R.model.renderContainer=this.overlayRenderContainer,R.model.dropTargetContainer=this.rootDropTargetContainer,ue=R,!this._popoutGroups.find(j=>j.popoutGroup===R))return;$?this.addFloatingGroup(R,{height:$.height,width:$.width,position:$}):(this.doRemoveGroup(R,{skipDispose:!0,skipActive:!0,skipPopoutReturn:!0}),R.model.location={type:"grid"},this.movingLock(()=>{this.doAddGroup(R,[0])})),this.doSetGroupAndPanelActive(R)}}})),this._popoutGroups.push(ve),this.updateWatermark(),!0}).catch(D=>(console.error("dockview: failed to create popout.",D),!1))}addFloatingGroup(e,n){var s,l,a,c,d;let h;if(e instanceof Go)h=this.createGroup(),this._onDidAddGroup.fire(h),this.movingLock(()=>this.removePanel(e,{removeEmptyGroup:!0,skipDispose:!0,skipSetActiveGroup:!0})),this.movingLock(()=>h.model.openPanel(e,{skipSetGroupActive:!0}));else{h=e;const D=(s=this._popoutGroups.find(O=>O.popoutGroup===h))===null||s===void 0?void 0:s.referenceGroup,P=D?this.getPanel(D):void 0;typeof(n==null?void 0:n.skipRemoveGroup)=="boolean"&&n.skipRemoveGroup||(P?(this.movingLock(()=>xu({from:e,to:P})),this.doRemoveGroup(e,{skipPopoutReturn:!0,skipPopoutAssociated:!0}),this.doRemoveGroup(P,{skipDispose:!0}),h=P):this.doRemoveGroup(e,{skipDispose:!0,skipPopoutReturn:!0,skipPopoutAssociated:!1}))}function m(){if(n!=null&&n.position){const D={};return"left"in n.position?D.left=Math.max(n.position.left,0):"right"in n.position?D.right=Math.max(n.position.right,0):D.left=gr.left,"top"in n.position?D.top=Math.max(n.position.top,0):"bottom"in n.position?D.bottom=Math.max(n.position.bottom,0):D.top=gr.top,typeof n.width=="number"?D.width=Math.max(n.width,0):D.width=gr.width,typeof n.height=="number"?D.height=Math.max(n.height,0):D.height=gr.height,D}return{left:typeof(n==null?void 0:n.x)=="number"?Math.max(n.x,0):gr.left,top:typeof(n==null?void 0:n.y)=="number"?Math.max(n.y,0):gr.top,width:typeof(n==null?void 0:n.width)=="number"?Math.max(n.width,0):gr.width,height:typeof(n==null?void 0:n.height)=="number"?Math.max(n.height,0):gr.height}}const w=m(),v=new ys(Object.assign(Object.assign({container:this.gridview.element,content:h.element},w),{minimumInViewportWidth:this.options.floatingGroupBounds==="boundedWithinViewport"?void 0:(a=(l=this.options.floatingGroupBounds)===null||l===void 0?void 0:l.minimumWidthWithinViewport)!==null&&a!==void 0?a:Cu,minimumInViewportHeight:this.options.floatingGroupBounds==="boundedWithinViewport"?void 0:(d=(c=this.options.floatingGroupBounds)===null||c===void 0?void 0:c.minimumHeightWithinViewport)!==null&&d!==void 0?d:Cu})),S=h.element.querySelector(".dv-void-container");if(!S)throw new Error("dockview: failed to find drag handle");v.setupDrag(S,{inDragMode:typeof(n==null?void 0:n.inDragMode)=="boolean"?n.inDragMode:!1});const E=new ox(h,v),A=new Ne(h.api.onDidActiveChange(D=>{D.isActive&&v.bringToFront()}),lc(h.element,D=>{const{width:P,height:N}=D.contentRect;h.layout(P,N)}));E.addDisposables(v.onDidChange(()=>{h.layout(h.width,h.height)}),v.onDidChangeEnd(()=>{this._bufferOnDidLayoutChange.fire()}),h.onDidChange(D=>{v.setBounds({height:D==null?void 0:D.height,width:D==null?void 0:D.width})}),{dispose:()=>{A.dispose(),nh(this._floatingGroups,E),h.model.location={type:"grid"},this.updateWatermark()}}),this._floatingGroups.push(E),h.model.location={type:"floating"},n!=null&&n.skipActiveGroup||this.doSetGroupAndPanelActive(h),this.updateWatermark()}orthogonalize(e,n){switch(this.gridview.normalize(),e){case"top":case"bottom":this.gridview.orientation===ke.HORIZONTAL&&this.gridview.insertOrthogonalSplitviewAtRoot();break;case"left":case"right":this.gridview.orientation===ke.VERTICAL&&this.gridview.insertOrthogonalSplitviewAtRoot();break}switch(e){case"top":case"left":case"center":return this.createGroupAtLocation([0],void 0,n);case"bottom":case"right":return this.createGroupAtLocation([this.gridview.length],void 0,n);default:throw new Error(`dockview: unsupported position ${e}`)}}updateOptions(e){var n,s;if(super.updateOptions(e),"floatingGroupBounds"in e)for(const c of this._floatingGroups){switch(e.floatingGroupBounds){case"boundedWithinViewport":c.overlay.minimumInViewportHeight=void 0,c.overlay.minimumInViewportWidth=void 0;break;case void 0:c.overlay.minimumInViewportHeight=Cu,c.overlay.minimumInViewportWidth=Cu;break;default:c.overlay.minimumInViewportHeight=(n=e.floatingGroupBounds)===null||n===void 0?void 0:n.minimumHeightWithinViewport,c.overlay.minimumInViewportWidth=(s=e.floatingGroupBounds)===null||s===void 0?void 0:s.minimumWidthWithinViewport}c.overlay.setBounds()}this.updateDropTargetModel(e);const l=this.options.disableDnd;this._options=Object.assign(Object.assign({},this.options),e);const a=this.options.disableDnd;l!==a&&this.updateDragAndDropState(),"theme"in e&&this.updateTheme(),this.layout(this.gridview.width,this.gridview.height,!0)}layout(e,n,s){if(super.layout(e,n,s),this._floatingGroups)for(const l of this._floatingGroups)l.overlay.setBounds()}updateDragAndDropState(){for(const e of this.groups)e.model.updateDragAndDropState()}focus(){var e;(e=this.activeGroup)===null||e===void 0||e.focus()}getGroupPanel(e){return this.panels.find(n=>n.id===e)}setActivePanel(e){e.group.model.openPanel(e),this.doSetGroupAndPanelActive(e.group)}moveToNext(e={}){var n;if(!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}if(e.includePanel&&e.group&&e.group.activePanel!==e.group.panels[e.group.panels.length-1]){e.group.model.moveToNext({suppressRoll:!0});return}const s=kt(e.group.element),l=(n=this.gridview.next(s))===null||n===void 0?void 0:n.view;this.doSetGroupAndPanelActive(l)}moveToPrevious(e={}){var n;if(!e.group){if(!this.activeGroup)return;e.group=this.activeGroup}if(e.includePanel&&e.group&&e.group.activePanel!==e.group.panels[0]){e.group.model.moveToPrevious({suppressRoll:!0});return}const s=kt(e.group.element),l=(n=this.gridview.previous(s))===null||n===void 0?void 0:n.view;l&&this.doSetGroupAndPanelActive(l)}toJSON(){var e;const n=this.gridview.serialize(),s=this.panels.reduce((d,h)=>(d[h.id]=h.toJSON(),d),{}),l=this._floatingGroups.map(d=>({data:d.group.toJSON(),position:d.overlay.toJSON()})),a=this._popoutGroups.map(d=>({data:d.popoutGroup.toJSON(),gridReferenceGroup:d.referenceGroup,position:d.window.dimensions(),url:d.popoutGroup.api.location.type==="popout"?d.popoutGroup.api.location.popoutUrl:void 0})),c={grid:n,panels:s,activeGroup:(e=this.activeGroup)===null||e===void 0?void 0:e.id};return l.length>0&&(c.floatingGroups=l),a.length>0&&(c.popoutGroups=a),c}fromJSON(e,n){var s,l;const a=new Map;let c;if(n!=null&&n.reuseExistingPanels){c=this.createGroup(),this._groups.delete(c.api.id);const w=Object.keys(e.panels);for(const v of this.panels)w.includes(v.api.id)&&a.set(v.api.id,v);this.movingLock(()=>{Array.from(a.values()).forEach(v=>{this.moveGroupOrPanel({from:{groupId:v.api.group.api.id,panelId:v.api.id},to:{group:c,position:"center"},keepEmptyGroups:!0})})})}if(this.clear(),typeof e!="object"||e===null)throw new Error("dockview: serialized layout must be a non-null object");const{grid:d,panels:h,activeGroup:m}=e;if(d.root.type!=="branch"||!Array.isArray(d.root.data))throw new Error("dockview: root must be of type branch");try{const w=this.width,v=this.height,S=P=>{const{id:N,locked:O,hideHeader:M,views:R,activeView:Z}=P;if(typeof N!="string")throw new Error("dockview: group id must be of type string");const G=this.createGroup({id:N,locked:!!O,hideHeader:!!M});this._onDidAddGroup.fire(G);const $=[];for(const K of R){const he=a.get(K);if(c&&he)this.movingLock(()=>{c.model.removePanel(he)}),$.push(he),he.updateFromStateModel(h[K]);else{const ue=this._deserializer.fromJSON(h[K],G);$.push(ue)}}for(let K=0;K{G.model.openPanel(he,{skipSetActive:!ue,skipSetGroupActive:!0})}):G.model.openPanel(he,{skipSetActive:!ue,skipSetGroupActive:!0})}return!G.activePanel&&G.panels.length>0&&G.model.openPanel(G.panels[G.panels.length-1],{skipSetGroupActive:!0}),G};this.gridview.deserialize(d,{fromJSON:P=>S(P.data)}),this.layout(w,v,!0);const E=(s=e.floatingGroups)!==null&&s!==void 0?s:[];for(const P of E){const{data:N,position:O}=P,M=S(N);this.addFloatingGroup(M,{position:O,width:O.width,height:O.height,skipRemoveGroup:!0,inDragMode:!1})}const A=(l=e.popoutGroups)!==null&&l!==void 0?l:[],D=[];A.forEach((P,N)=>{const{data:O,position:M,gridReferenceGroup:R,url:Z}=P,G=S(O),$=new Promise(K=>{setTimeout(()=>{this.addPopoutGroup(G,{position:M??void 0,overridePopoutGroup:R?G:void 0,referenceGroup:R?this.getPanel(R):void 0,popoutUrl:Z}),K()},N*lx)});D.push($)}),this._popoutRestorationPromise=Promise.all(D).then(()=>{});for(const P of this._floatingGroups)P.overlay.setBounds();if(typeof m=="string"){const P=this.getPanel(m);P&&this.doSetGroupAndPanelActive(P)}}catch(w){console.error("dockview: failed to deserialize layout. Reverting changes",w);for(const v of this.groups)for(const S of v.panels)this.removePanel(S,{removeEmptyGroup:!1,skipDispose:!1});for(const v of this.groups)v.dispose(),this._groups.delete(v.id),this._onDidRemoveGroup.fire(v);for(const v of[...this._floatingGroups])v.dispose();throw this.clear(),w}this.updateWatermark(),this.debouncedUpdateAllPositions(),this._onDidLayoutFromJSON.fire()}clear(){const e=Array.from(this._groups.values()).map(s=>s.value),n=!!this.activeGroup;for(const s of e)this.removeGroup(s,{skipActive:!0});n&&this.doSetGroupAndPanelActive(void 0),this.gridview.clear()}closeAllGroups(){for(const e of this._groups.entries()){const[n,s]=e;s.value.model.closeAllPanels()}}addPanel(e){var n,s;if(this.panels.find(h=>h.id===e.id))throw new Error(`dockview: panel with id ${e.id} already exists`);let l;if(e.position&&e.floating)throw new Error("dockview: you can only provide one of: position, floating as arguments to .addPanel(...)");const a={width:e.initialWidth,height:e.initialHeight};let c;if(e.position)if(YC(e.position)){const h=typeof e.position.referencePanel=="string"?this.getGroupPanel(e.position.referencePanel):e.position.referencePanel;if(c=e.position.index,!h)throw new Error(`dockview: referencePanel '${e.position.referencePanel}' does not exist`);l=this.findGroup(h)}else if(KC(e.position)){if(l=typeof e.position.referenceGroup=="string"?(n=this._groups.get(e.position.referenceGroup))===null||n===void 0?void 0:n.value:e.position.referenceGroup,c=e.position.index,!l)throw new Error(`dockview: referenceGroup '${e.position.referenceGroup}' does not exist`)}else{const h=this.orthogonalize(Dg(e.position.direction)),m=this.createPanel(e,h);return h.model.openPanel(m,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:c}),e.inactive||this.doSetGroupAndPanelActive(h),h.api.setSize({height:a==null?void 0:a.height,width:a==null?void 0:a.width}),m}else l=this.activeGroup;let d;if(l){const h=$u(((s=e.position)===null||s===void 0?void 0:s.direction)||"within");if(e.floating){const m=this.createGroup();this._onDidAddGroup.fire(m);const w=typeof e.floating=="object"&&e.floating!==null?e.floating:{};this.addFloatingGroup(m,Object.assign(Object.assign({},w),{inDragMode:!1,skipRemoveGroup:!0,skipActiveGroup:!0})),d=this.createPanel(e,m),m.model.openPanel(d,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:c})}else if(l.api.location.type==="floating"||h==="center")d=this.createPanel(e,l),l.model.openPanel(d,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:c}),l.api.setSize({width:a==null?void 0:a.width,height:a==null?void 0:a.height}),e.inactive||this.doSetGroupAndPanelActive(l);else{const m=kt(l.element),w=_s(this.gridview.orientation,m,h),v=this.createGroupAtLocation(w,this.orientationAtLocation(w)===ke.VERTICAL?a==null?void 0:a.height:a==null?void 0:a.width);d=this.createPanel(e,v),v.model.openPanel(d,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:c}),e.inactive||this.doSetGroupAndPanelActive(v)}}else if(e.floating){const h=this.createGroup();this._onDidAddGroup.fire(h);const m=typeof e.floating=="object"&&e.floating!==null?e.floating:{};this.addFloatingGroup(h,Object.assign(Object.assign({},m),{inDragMode:!1,skipRemoveGroup:!0,skipActiveGroup:!0})),d=this.createPanel(e,h),h.model.openPanel(d,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:c})}else{const h=this.createGroupAtLocation([0],this.gridview.orientation===ke.VERTICAL?a==null?void 0:a.height:a==null?void 0:a.width);d=this.createPanel(e,h),h.model.openPanel(d,{skipSetActive:e.inactive,skipSetGroupActive:e.inactive,index:c}),e.inactive||this.doSetGroupAndPanelActive(h)}return d}removePanel(e,n={removeEmptyGroup:!0}){const s=e.group;if(!s)throw new Error(`dockview: cannot remove panel ${e.id}. it's missing a group.`);s.model.removePanel(e,{skipSetActiveGroup:n.skipSetActiveGroup}),n.skipDispose||(e.group.model.renderContainer.detatch(e),e.dispose()),s.size===0&&n.removeEmptyGroup&&this.removeGroup(s,{skipActive:n.skipSetActiveGroup})}createWatermarkComponent(){return this.options.createWatermarkComponent?this.options.createWatermarkComponent():new sx}updateWatermark(){var e,n;if(this.groups.filter(s=>s.api.location.type==="grid"&&s.api.isVisible).length===0){if(!this._watermark){this._watermark=this.createWatermarkComponent(),this._watermark.init({containerApi:new Yu(this)});const s=document.createElement("div");s.className="dv-watermark-container",oC(s,"watermark-component"),s.appendChild(this._watermark.element),this.gridview.element.appendChild(s)}}else this._watermark&&(this._watermark.element.parentElement.remove(),(n=(e=this._watermark).dispose)===null||n===void 0||n.call(e),this._watermark=null)}addGroup(e){var n;if(e){let s;if(JC(e)){const m=typeof e.referencePanel=="string"?this.panels.find(w=>w.id===e.referencePanel):e.referencePanel;if(!m)throw new Error(`dockview: reference panel ${e.referencePanel} does not exist`);if(s=this.findGroup(m),!s)throw new Error(`dockview: reference group for reference panel ${e.referencePanel} does not exist`)}else if(QC(e)){if(s=typeof e.referenceGroup=="string"?(n=this._groups.get(e.referenceGroup))===null||n===void 0?void 0:n.value:e.referenceGroup,!s)throw new Error(`dockview: reference group ${e.referenceGroup} does not exist`)}else{const m=this.orthogonalize(Dg(e.direction),e);return e.skipSetActive||this.doSetGroupAndPanelActive(m),m}const l=$u(e.direction||"within"),a=kt(s.element),c=_s(this.gridview.orientation,a,l),d=this.createGroup(e),h=this.getLocationOrientation(c)===ke.VERTICAL?e.initialHeight:e.initialWidth;return this.doAddGroup(d,c,h),e.skipSetActive||this.doSetGroupAndPanelActive(d),d}else{const s=this.createGroup(e);return this.doAddGroup(s),this.doSetGroupAndPanelActive(s),s}}getLocationOrientation(e){return e.length%2==0&&this.gridview.orientation===ke.HORIZONTAL?ke.HORIZONTAL:ke.VERTICAL}removeGroup(e,n){this.doRemoveGroup(e,n)}doRemoveGroup(e,n){var s;const l=[...e.panels];if(!(n!=null&&n.skipDispose))for(const d of l)this.removePanel(d,{removeEmptyGroup:!1,skipDispose:(s=n==null?void 0:n.skipDispose)!==null&&s!==void 0?s:!1});const a=this.activePanel;if(e.api.location.type==="floating"){const d=this._floatingGroups.find(h=>h.group===e);if(d){if(n!=null&&n.skipDispose||(d.group.dispose(),this._groups.delete(e.id),this._onDidRemoveGroup.fire(e)),nh(this._floatingGroups,d),d.dispose(),!(n!=null&&n.skipActive)&&this._activeGroup===e){const h=Array.from(this._groups.values());this.doSetGroupAndPanelActive(h.length>0?h[0].value:void 0)}return d.group}throw new Error("dockview: failed to find floating group")}if(e.api.location.type==="popout"){const d=this._popoutGroups.find(h=>h.popoutGroup===e);if(d){if(!(n!=null&&n.skipDispose)){if(!(n!=null&&n.skipPopoutAssociated)){const m=d.referenceGroup?this.getPanel(d.referenceGroup):void 0;m&&m.panels.length===0&&this.removeGroup(m)}d.popoutGroup.dispose(),this._groups.delete(e.id),this._onDidRemoveGroup.fire(e)}nh(this._popoutGroups,d);const h=d.disposable.dispose();if(!(n!=null&&n.skipPopoutReturn)&&h&&(this.doAddGroup(h,[0]),this.doSetGroupAndPanelActive(h)),!(n!=null&&n.skipActive)&&this._activeGroup===e){const m=Array.from(this._groups.values());this.doSetGroupAndPanelActive(m.length>0?m[0].value:void 0)}return this.updateWatermark(),d.popoutGroup}throw new Error("dockview: failed to find popout group")}const c=super.doRemoveGroup(e,n);return n!=null&&n.skipActive||this.activePanel!==a&&this._onDidActivePanelChange.fire(this.activePanel),c}debouncedUpdateAllPositions(){this._updatePositionsFrameId!==void 0&&cancelAnimationFrame(this._updatePositionsFrameId),this._updatePositionsFrameId=requestAnimationFrame(()=>{this._updatePositionsFrameId=void 0,this.overlayRenderContainer.updateAllPositions()})}movingLock(e){const n=this._moving;try{return this._moving=!0,e()}finally{this._moving=n}}moveGroupOrPanel(e){var n;const s=e.to.group,l=e.from.groupId,a=e.from.panelId,c=e.to.position,d=e.to.index,h=l?(n=this._groups.get(l))===null||n===void 0?void 0:n.value:void 0;if(!h)throw new Error(`dockview: Failed to find group id ${l}`);if(a===void 0){this.moveGroup({from:{group:h},to:{group:s,position:c},skipSetActive:e.skipSetActive});return}if(!c||c==="center"){const m=this.movingLock(()=>h.model.removePanel(a,{skipSetActive:!1,skipSetActiveGroup:!0}));if(!m)throw new Error(`dockview: No panel with id ${a}`);!e.keepEmptyGroups&&h.model.size===0&&this.doRemoveGroup(h,{skipActive:!0});const w=s.model.size===0;this.movingLock(()=>{var v;return s.model.openPanel(m,{index:d,skipSetActive:((v=e.skipSetActive)!==null&&v!==void 0?v:!1)&&!w,skipSetGroupActive:!0})}),e.skipSetActive||this.doSetGroupAndPanelActive(s),this._onDidMovePanel.fire({panel:m,from:h})}else{const m=kt(s.element),w=_s(this.gridview.orientation,m,c);if(h.size<2){const[v,S]=Ms(w);if(h.api.location.type==="grid"){const P=kt(h.element),[N,O]=Ms(P);if(nw(N,v)){this.gridview.moveView(N,O,S),this._onDidMovePanel.fire({panel:this.getGroupPanel(a),from:h});return}}if(h.api.location.type==="popout"){const P=this._popoutGroups.find(M=>M.popoutGroup===h),N=this.movingLock(()=>P.popoutGroup.model.removePanel(P.popoutGroup.panels[0],{skipSetActive:!0,skipSetActiveGroup:!0}));this.doRemoveGroup(h,{skipActive:!0});const O=this.createGroupAtLocation(w);this.movingLock(()=>O.model.openPanel(N,{skipSetActive:!0})),this.doSetGroupAndPanelActive(O),this._onDidMovePanel.fire({panel:this.getGroupPanel(a),from:h});return}const E=this.movingLock(()=>this.doRemoveGroup(h,{skipActive:!0,skipDispose:!0})),A=kt(s.element),D=_s(this.gridview.orientation,A,c);this.movingLock(()=>this.doAddGroup(E,D)),this.doSetGroupAndPanelActive(E),this._onDidMovePanel.fire({panel:this.getGroupPanel(a),from:h})}else{const v=this.movingLock(()=>h.model.removePanel(a,{skipSetActive:!1,skipSetActiveGroup:!0}));if(!v)throw new Error(`dockview: No panel with id ${a}`);const S=_s(this.gridview.orientation,m,c),E=this.createGroupAtLocation(S);this.movingLock(()=>E.model.openPanel(v,{skipSetGroupActive:!0})),this.doSetGroupAndPanelActive(E),this._onDidMovePanel.fire({panel:v,from:h})}}}moveGroup(e){const n=e.from.group,s=e.to.group,l=e.to.position;if(l==="center"){const a=n.activePanel,c=this.movingLock(()=>[...n.panels].map(d=>n.model.removePanel(d.id,{skipSetActive:!0})));(n==null?void 0:n.model.size)===0&&this.doRemoveGroup(n,{skipActive:!0}),this.movingLock(()=>{for(const d of c)s.model.openPanel(d,{skipSetActive:d!==a,skipSetGroupActive:!0})}),e.skipSetActive!==!0?this.doSetGroupAndPanelActive(s):this.activePanel||this.doSetGroupAndPanelActive(s)}else{switch(n.api.location.type){case"grid":this.gridview.removeView(kt(n.element));break;case"floating":{const a=this._floatingGroups.find(c=>c.group===n);if(!a)throw new Error("dockview: failed to find floating group");a.dispose();break}case"popout":{const a=this._popoutGroups.find(d=>d.popoutGroup===n);if(!a)throw new Error("dockview: failed to find popout group");const c=this._popoutGroups.indexOf(a);if(c>=0&&this._popoutGroups.splice(c,1),a.referenceGroup){const d=this.getPanel(a.referenceGroup);d&&!d.api.isVisible&&this.doRemoveGroup(d,{skipActive:!0})}a.window.dispose(),s.api.location.type==="grid"?(n.model.renderContainer=this.overlayRenderContainer,n.model.dropTargetContainer=this.rootDropTargetContainer,n.model.location={type:"grid"}):s.api.location.type==="floating"&&(n.model.renderContainer=this.overlayRenderContainer,n.model.dropTargetContainer=this.rootDropTargetContainer,n.model.location={type:"floating"});break}}if(s.api.location.type==="grid"){const a=kt(s.element),c=_s(this.gridview.orientation,a,l);let d;switch(this.gridview.orientation){case ke.VERTICAL:d=a.length%2==0?n.api.width:n.api.height;break;case ke.HORIZONTAL:d=a.length%2==0?n.api.height:n.api.width;break}this.gridview.addView(n,d,c)}else if(s.api.location.type==="floating"){const a=this._floatingGroups.find(c=>c.group===s);if(a){const c=a.overlay.toJSON();let d,h;"left"in c?d=c.left+50:"right"in c?d=Math.max(0,c.right-c.width-50):d=50,"top"in c?h=c.top+50:"bottom"in c?h=Math.max(0,c.bottom-c.height-50):h=50,this.addFloatingGroup(n,{height:c.height,width:c.width,position:{left:d,top:h}})}}}if(n.panels.forEach(a=>{this._onDidMovePanel.fire({panel:a,from:n})}),this.debouncedUpdateAllPositions(),e.skipSetActive===!1){const a=s??n;this.doSetGroupAndPanelActive(a)}}doSetGroupActive(e){super.doSetGroupActive(e);const n=this.activePanel;!this._moving&&n!==this._onDidActivePanelChange.value&&this._onDidActivePanelChange.fire(n)}doSetGroupAndPanelActive(e){super.doSetGroupActive(e);const n=this.activePanel;e&&this.hasMaximizedGroup()&&!this.isMaximizedGroup(e)&&this.exitMaximizedGroup(),!this._moving&&n!==this._onDidActivePanelChange.value&&this._onDidActivePanelChange.fire(n)}getNextGroupId(){let e=this.nextGroupId.next();for(;this._groups.has(e);)e=this.nextGroupId.next();return e}createGroup(e){e||(e={});let n=e==null?void 0:e.id;if(n&&this._groups.has(e.id)&&(console.warn(`dockview: Duplicate group id ${e==null?void 0:e.id}. reassigning group id to avoid errors`),n=void 0),!n)for(n=this.nextGroupId.next();this._groups.has(n);)n=this.nextGroupId.next();const s=new Cg(this,n,e);if(s.init({params:{},accessor:this}),!this._groups.has(s.id)){const l=new Ne(s.model.onTabDragStart(a=>{this._onWillDragPanel.fire(a)}),s.model.onGroupDragStart(a=>{this._onWillDragGroup.fire(a)}),s.model.onMove(a=>{const{groupId:c,itemId:d,target:h,index:m}=a;this.moveGroupOrPanel({from:{groupId:c,panelId:d},to:{group:s,position:h,index:m}})}),s.model.onDidDrop(a=>{this._onDidDrop.fire(a)}),s.model.onWillDrop(a=>{this._onWillDrop.fire(a)}),s.model.onWillShowOverlay(a=>{if(this.options.disableDnd){a.preventDefault();return}this._onWillShowOverlay.fire(a)}),s.model.onUnhandledDragOverEvent(a=>{this._onUnhandledDragOverEvent.fire(a)}),s.model.onDidAddPanel(a=>{this._moving||this._onDidAddPanel.fire(a.panel)}),s.model.onDidRemovePanel(a=>{this._moving||this._onDidRemovePanel.fire(a.panel)}),s.model.onDidActivePanelChange(a=>{this._moving||a.panel===this.activePanel&&this._onDidActivePanelChange.value!==a.panel&&this._onDidActivePanelChange.fire(a.panel)}),Zr.any(s.model.onDidPanelTitleChange,s.model.onDidPanelParametersChange)(()=>{this._bufferOnDidLayoutChange.fire()}));this._groups.set(s.id,{value:s,disposable:l})}return s.initialize(),s}createPanel(e,n){var s,l,a;const c=e.component,d=(s=e.tabComponent)!==null&&s!==void 0?s:this.options.defaultTabComponent,h=new gw(this,e.id,c,d),m=new Go(e.id,c,d,this,this._api,n,h,{renderer:e.renderer,minimumWidth:e.minimumWidth,minimumHeight:e.minimumHeight,maximumWidth:e.maximumWidth,maximumHeight:e.maximumHeight});return m.init({title:(l=e.title)!==null&&l!==void 0?l:e.id,params:(a=e==null?void 0:e.params)!==null&&a!==void 0?a:{}}),m}createGroupAtLocation(e,n,s){const l=this.createGroup(s);return this.doAddGroup(l,e,n),l}findGroup(e){var n;return(n=Array.from(this._groups.values()).find(s=>s.value.model.containsPanel(e)))===null||n===void 0?void 0:n.value}orientationAtLocation(e){const n=this.gridview.orientation;return e.length%2==1?n:Ss(n)}updateDropTargetModel(e){"dndEdges"in e&&(this._rootDropTarget.disabled=typeof e.dndEdges=="boolean"&&e.dndEdges===!1,typeof e.dndEdges=="object"&&e.dndEdges!==null?this._rootDropTarget.setOverlayModel(e.dndEdges):this._rootDropTarget.setOverlayModel(Pg)),"rootOverlayModel"in e&&this.updateDropTargetModel({dndEdges:e.dndEdges})}updateTheme(){var e,n;const s=(e=this._options.theme)!==null&&e!==void 0?e:tx;switch(this._themeClassnames.setClassNames(s.className),this.gridview.margin=(n=s.gap)!==null&&n!==void 0?n:0,s.dndOverlayMounting){case"absolute":this.rootDropTargetContainer.disabled=!1;break;case"relative":default:this.rootDropTargetContainer.disabled=!0;break}}}class mx extends sw{get orientation(){return this.gridview.orientation}set orientation(e){this.gridview.orientation=e}get options(){return this._options}get deserializer(){return this._deserializer}set deserializer(e){this._deserializer=e}constructor(e,n){var s;super(e,{proportionalLayout:(s=n.proportionalLayout)!==null&&s!==void 0?s:!0,orientation:n.orientation,styles:n.hideBorders?{separatorBorder:"transparent"}:void 0,disableAutoResizing:n.disableAutoResizing,className:n.className}),this._onDidLayoutfromJSON=new U,this.onDidLayoutFromJSON=this._onDidLayoutfromJSON.event,this._onDidRemoveGroup=new U,this.onDidRemoveGroup=this._onDidRemoveGroup.event,this._onDidAddGroup=new U,this.onDidAddGroup=this._onDidAddGroup.event,this._onDidActiveGroupChange=new U,this.onDidActiveGroupChange=this._onDidActiveGroupChange.event,this._options=n,this.addDisposables(this._onDidAddGroup,this._onDidRemoveGroup,this._onDidActiveGroupChange,this.onDidAdd(l=>{this._onDidAddGroup.fire(l)}),this.onDidRemove(l=>{this._onDidRemoveGroup.fire(l)}),this.onDidActiveChange(l=>{this._onDidActiveGroupChange.fire(l)}))}updateOptions(e){super.updateOptions(e);const n=typeof e.orientation=="string"&&this.gridview.orientation!==e.orientation;this._options=Object.assign(Object.assign({},this.options),e),n&&(this.gridview.orientation=e.orientation),this.layout(this.gridview.width,this.gridview.height,!0)}removePanel(e){this.removeGroup(e)}toJSON(){var e;return{grid:this.gridview.serialize(),activePanel:(e=this.activeGroup)===null||e===void 0?void 0:e.id}}setVisible(e,n){this.gridview.setViewVisible(kt(e.element),n)}setActive(e){this._groups.forEach((n,s)=>{n.value.setActive(e===n.value)})}focus(){var e;(e=this.activeGroup)===null||e===void 0||e.focus()}fromJSON(e){this.clear();const{grid:n,activePanel:s}=e;try{const l=[],a=this.width,c=this.height;if(this.gridview.deserialize(n,{fromJSON:d=>{const{data:h}=d,m=this.options.createComponent({id:h.id,name:h.component});return l.push(()=>m.init({params:h.params,minimumWidth:h.minimumWidth,maximumWidth:h.maximumWidth,minimumHeight:h.minimumHeight,maximumHeight:h.maximumHeight,priority:h.priority,snap:!!h.snap,accessor:this,isVisible:d.visible})),this._onDidAddGroup.fire(m),this.registerPanel(m),m}}),this.layout(a,c,!0),l.forEach(d=>d()),typeof s=="string"){const d=this.getPanel(s);d&&this.doSetGroupActive(d)}}catch(l){for(const a of this.groups)a.dispose(),this._groups.delete(a.id),this._onDidRemoveGroup.fire(a);throw this.clear(),l}this._onDidLayoutfromJSON.fire()}clear(){const e=this.activeGroup,n=Array.from(this._groups.values());for(const s of n)s.disposable.dispose(),this.doRemoveGroup(s.value,{skipActive:!0});e&&this.doSetGroupActive(void 0),this.gridview.clear()}movePanel(e,n){var s;let l;const a=this.gridview.remove(e),c=(s=this._groups.get(n.reference))===null||s===void 0?void 0:s.value;if(!c)throw new Error(`reference group ${n.reference} does not exist`);const d=$u(n.direction);if(d==="center")throw new Error(`${d} not supported as an option`);{const h=kt(c.element);l=_s(this.gridview.orientation,h,d)}this.doAddGroup(a,l,n.size)}addPanel(e){var n,s,l,a;let c=(n=e.location)!==null&&n!==void 0?n:[0];if(!((s=e.position)===null||s===void 0)&&s.referencePanel){const h=(l=this._groups.get(e.position.referencePanel))===null||l===void 0?void 0:l.value;if(!h)throw new Error(`reference group ${e.position.referencePanel} does not exist`);const m=$u(e.position.direction);if(m==="center")throw new Error(`${m} not supported as an option`);{const w=kt(h.element);c=_s(this.gridview.orientation,w,m)}}const d=this.options.createComponent({id:e.id,name:e.component});return d.init({params:(a=e.params)!==null&&a!==void 0?a:{},minimumWidth:e.minimumWidth,maximumWidth:e.maximumWidth,minimumHeight:e.minimumHeight,maximumHeight:e.maximumHeight,priority:e.priority,snap:!!e.snap,accessor:this,isVisible:!0}),this.doAddGroup(d,c,e.size),this.registerPanel(d),this.doSetGroupActive(d),d}registerPanel(e){const n=new Ne(e.api.onDidFocusChange(s=>{s.isFocused&&this._groups.forEach(l=>{const a=l.value;a!==e?a.setActive(!1):a.setActive(!0)})}));this._groups.set(e.id,{value:e,disposable:n})}moveGroup(e,n,s){const l=this.getPanel(n);if(!l)throw new Error("invalid operation");const a=kt(e.element),c=_s(this.gridview.orientation,a,s),[d,h]=Ms(c),m=kt(l.element),[w,v]=Ms(m);if(nw(w,d)){this.gridview.moveView(w,v,h);return}const S=this.doRemoveGroup(l,{skipActive:!0,skipDispose:!0}),E=kt(e.element),A=_s(this.gridview.orientation,E,s);this.doAddGroup(S,A)}removeGroup(e){super.removeGroup(e)}dispose(){super.dispose(),this._onDidLayoutfromJSON.dispose()}}class gx extends tf{get panels(){return this.splitview.getViews()}get options(){return this._options}get length(){return this._panels.size}get orientation(){return this.splitview.orientation}get splitview(){return this._splitview}set splitview(e){this._splitview&&this._splitview.dispose(),this._splitview=e,this._splitviewChangeDisposable.value=new Ne(this._splitview.onDidSashEnd(()=>{this._onDidLayoutChange.fire(void 0)}),this._splitview.onDidAddView(n=>this._onDidAddView.fire(n)),this._splitview.onDidRemoveView(n=>this._onDidRemoveView.fire(n)))}get minimumSize(){return this.splitview.minimumSize}get maximumSize(){return this.splitview.maximumSize}get height(){return this.splitview.orientation===ke.HORIZONTAL?this.splitview.orthogonalSize:this.splitview.size}get width(){return this.splitview.orientation===ke.HORIZONTAL?this.splitview.size:this.splitview.orthogonalSize}constructor(e,n){var s;super(document.createElement("div"),n.disableAutoResizing),this._splitviewChangeDisposable=new Bn,this._panels=new Map,this._onDidLayoutfromJSON=new U,this.onDidLayoutFromJSON=this._onDidLayoutfromJSON.event,this._onDidAddView=new U,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new U,this.onDidRemoveView=this._onDidRemoveView.event,this._onDidLayoutChange=new U,this.onDidLayoutChange=this._onDidLayoutChange.event,this.element.style.height="100%",this.element.style.width="100%",this._classNames=new uc(this.element),this._classNames.setClassNames((s=n.className)!==null&&s!==void 0?s:""),e.appendChild(this.element),this._options=n,this.splitview=new ql(this.element,n),this.addDisposables(this._onDidAddView,this._onDidLayoutfromJSON,this._onDidRemoveView,this._onDidLayoutChange)}updateOptions(e){var n,s;"className"in e&&this._classNames.setClassNames((n=e.className)!==null&&n!==void 0?n:""),"disableResizing"in e&&(this.disableResizing=(s=e.disableAutoResizing)!==null&&s!==void 0?s:!1),typeof e.orientation=="string"&&(this.splitview.orientation=e.orientation),this._options=Object.assign(Object.assign({},this.options),e),this.splitview.layout(this.splitview.size,this.splitview.orthogonalSize)}focus(){var e;(e=this._activePanel)===null||e===void 0||e.focus()}movePanel(e,n){this.splitview.moveView(e,n)}setVisible(e,n){const s=this.panels.indexOf(e);this.splitview.setViewVisible(s,n)}setActive(e,n){this._activePanel=e,this.panels.filter(s=>s!==e).forEach(s=>{s.api._onDidActiveChange.fire({isActive:!1}),n||s.focus()}),e.api._onDidActiveChange.fire({isActive:!0}),n||e.focus()}removePanel(e,n){const s=this._panels.get(e.id);if(!s)throw new Error(`unknown splitview panel ${e.id}`);s.dispose(),this._panels.delete(e.id);const l=this.panels.findIndex(d=>d===e);this.splitview.removeView(l,n).dispose();const c=this.panels;c.length>0&&this.setActive(c[c.length-1])}getPanel(e){return this.panels.find(n=>n.id===e)}addPanel(e){var n;if(this._panels.has(e.id))throw new Error(`panel ${e.id} already exists`);const s=this.options.createComponent({id:e.id,name:e.component});s.orientation=this.splitview.orientation,s.init({params:(n=e.params)!==null&&n!==void 0?n:{},minimumSize:e.minimumSize,maximumSize:e.maximumSize,snap:e.snap,priority:e.priority,accessor:this});const l=typeof e.size=="number"?e.size:$i.Distribute,a=typeof e.index=="number"?e.index:void 0;return this.splitview.addView(s,l,a),this.doAddView(s),this.setActive(s),s}layout(e,n){const[s,l]=this.splitview.orientation===ke.HORIZONTAL?[e,n]:[n,e];this.splitview.layout(s,l)}doAddView(e){const n=e.api.onDidFocusChange(s=>{s.isFocused&&this.setActive(e,!0)});this._panels.set(e.id,n)}toJSON(){var e;return{views:this.splitview.getViews().map((s,l)=>({size:this.splitview.getViewSize(l),data:s.toJSON(),snap:!!s.snap,priority:s.priority})),activeView:(e=this._activePanel)===null||e===void 0?void 0:e.id,size:this.splitview.size,orientation:this.splitview.orientation}}fromJSON(e){this.clear();const{views:n,orientation:s,size:l,activeView:a}=e,c=[],d=this.width,h=this.height;if(this.splitview=new ql(this.element,{orientation:s,proportionalLayout:this.options.proportionalLayout,descriptor:{size:l,views:n.map(m=>{const w=m.data;if(this._panels.has(w.id))throw new Error(`panel ${w.id} already exists`);const v=this.options.createComponent({id:w.id,name:w.component});return c.push(()=>{var S;v.init({params:(S=w.params)!==null&&S!==void 0?S:{},minimumSize:w.minimumSize,maximumSize:w.maximumSize,snap:m.snap,priority:m.priority,accessor:this})}),v.orientation=s,this.doAddView(v),setTimeout(()=>{this._onDidAddView.fire(v)},0),{size:m.size,view:v}})}}),this.layout(d,h),c.forEach(m=>m()),typeof a=="string"){const m=this.getPanel(a);m&&this.setActive(m)}this._onDidLayoutfromJSON.fire()}clear(){for(const e of this._panels.values())e.dispose();for(this._panels.clear();this.splitview.length>0;)this.splitview.removeView(0,$i.Distribute,!0).dispose()}dispose(){for(const n of this._panels.values())n.dispose();this._panels.clear();const e=this.splitview.getViews();this._splitviewChangeDisposable.dispose(),this.splitview.dispose();for(const n of e)n.dispose();this.element.remove(),super.dispose()}}class Ag extends Ne{get element(){return this._element}constructor(){super(),this._expandedIcon=BC(),this._collapsedIcon=hw(),this.disposable=new Bn,this.apiRef={api:null},this._element=document.createElement("div"),this.element.className="dv-default-header",this._content=document.createElement("span"),this._expander=document.createElement("div"),this._expander.className="dv-pane-header-icon",this.element.appendChild(this._expander),this.element.appendChild(this._content),this.addDisposables(Be(this._element,"click",()=>{var e;(e=this.apiRef.api)===null||e===void 0||e.setExpanded(!this.apiRef.api.isExpanded)}))}init(e){this.apiRef.api=e.api,this._content.textContent=e.title,this.updateIcon(),this.disposable.value=e.api.onDidExpansionChange(()=>{this.updateIcon()})}updateIcon(){var e;const n=!!(!((e=this.apiRef.api)===null||e===void 0)&&e.isExpanded);Re(this._expander,"collapsed",!n),n?(this._expander.contains(this._collapsedIcon)&&this._collapsedIcon.remove(),this._expander.contains(this._expandedIcon)||this._expander.appendChild(this._expandedIcon)):(this._expander.contains(this._expandedIcon)&&this._expandedIcon.remove(),this._expander.contains(this._collapsedIcon)||this._expander.appendChild(this._collapsedIcon))}update(e){}dispose(){this.disposable.dispose(),super.dispose()}}const vx=ef(),kg=22,zg=0,Og=Number.MAX_SAFE_INTEGER;class Tg extends MC{constructor(e){super({accessor:e.accessor,id:e.id,component:e.component,headerComponent:e.headerComponent,orientation:e.orientation,isExpanded:e.isExpanded,disableDnd:e.disableDnd,headerSize:e.headerSize,minimumBodySize:e.minimumBodySize,maximumBodySize:e.maximumBodySize}),this.options=e}getBodyComponent(){return this.options.body}getHeaderComponent(){return this.options.header}}class wx extends tf{get id(){return this._id}get panels(){return this.paneview.getPanes()}set paneview(e){this._paneview=e,this._disposable.value=new Ne(this._paneview.onDidChange(()=>{this._onDidLayoutChange.fire(void 0)}),this._paneview.onDidAddView(n=>this._onDidAddView.fire(n)),this._paneview.onDidRemoveView(n=>this._onDidRemoveView.fire(n)))}get paneview(){return this._paneview}get minimumSize(){return this.paneview.minimumSize}get maximumSize(){return this.paneview.maximumSize}get height(){return this.paneview.orientation===ke.HORIZONTAL?this.paneview.orthogonalSize:this.paneview.size}get width(){return this.paneview.orientation===ke.HORIZONTAL?this.paneview.size:this.paneview.orthogonalSize}get options(){return this._options}constructor(e,n){var s;super(document.createElement("div"),n.disableAutoResizing),this._id=vx.next(),this._disposable=new Bn,this._viewDisposables=new Map,this._onDidLayoutfromJSON=new U,this.onDidLayoutFromJSON=this._onDidLayoutfromJSON.event,this._onDidLayoutChange=new U,this.onDidLayoutChange=this._onDidLayoutChange.event,this._onDidDrop=new U,this.onDidDrop=this._onDidDrop.event,this._onDidAddView=new U,this.onDidAddView=this._onDidAddView.event,this._onDidRemoveView=new U,this.onDidRemoveView=this._onDidRemoveView.event,this._onUnhandledDragOverEvent=new U,this.onUnhandledDragOverEvent=this._onUnhandledDragOverEvent.event,this.element.style.height="100%",this.element.style.width="100%",this.addDisposables(this._onDidLayoutChange,this._onDidLayoutfromJSON,this._onDidDrop,this._onDidAddView,this._onDidRemoveView,this._onUnhandledDragOverEvent),this._classNames=new uc(this.element),this._classNames.setClassNames((s=n.className)!==null&&s!==void 0?s:""),e.appendChild(this.element),this._options=n,this.paneview=new Sg(this.element,{orientation:ke.VERTICAL}),this.addDisposables(this._disposable)}setVisible(e,n){const s=this.panels.indexOf(e);this.paneview.setViewVisible(s,n)}focus(){}updateOptions(e){var n,s;"className"in e&&this._classNames.setClassNames((n=e.className)!==null&&n!==void 0?n:""),"disableResizing"in e&&(this.disableResizing=(s=e.disableAutoResizing)!==null&&s!==void 0?s:!1),this._options=Object.assign(Object.assign({},this.options),e)}addPanel(e){var n,s;const l=this.options.createComponent({id:e.id,name:e.component});let a;e.headerComponent&&this.options.createHeaderComponent&&(a=this.options.createHeaderComponent({id:e.id,name:e.headerComponent})),a||(a=new Ag);const c=new Tg({id:e.id,component:e.component,headerComponent:e.headerComponent,header:a,body:l,orientation:ke.VERTICAL,isExpanded:!!e.isExpanded,disableDnd:!!this.options.disableDnd,accessor:this,headerSize:(n=e.headerSize)!==null&&n!==void 0?n:kg,minimumBodySize:zg,maximumBodySize:Og});this.doAddPanel(c);const d=typeof e.size=="number"?e.size:$i.Distribute,h=typeof e.index=="number"?e.index:void 0;return c.init({params:(s=e.params)!==null&&s!==void 0?s:{},minimumBodySize:e.minimumBodySize,maximumBodySize:e.maximumBodySize,isExpanded:e.isExpanded,title:e.title,containerApi:new ea(this),accessor:this}),this.paneview.addPane(c,d,h),c.orientation=this.paneview.orientation,c}removePanel(e){const s=this.panels.findIndex(l=>l===e);this.paneview.removePane(s),this.doRemovePanel(e)}movePanel(e,n){this.paneview.moveView(e,n)}getPanel(e){return this.panels.find(n=>n.id===e)}layout(e,n){const[s,l]=this.paneview.orientation===ke.HORIZONTAL?[e,n]:[n,e];this.paneview.layout(s,l)}toJSON(){const e=l=>l===Number.MAX_SAFE_INTEGER||l===Number.POSITIVE_INFINITY?void 0:l,n=l=>l<=0?void 0:l;return{views:this.paneview.getPanes().map((l,a)=>({size:this.paneview.getViewSize(a),data:l.toJSON(),minimumSize:n(l.minimumBodySize),maximumSize:e(l.maximumBodySize),headerSize:l.headerSize,expanded:l.isExpanded()})),size:this.paneview.size}}fromJSON(e){this.clear();const{views:n,size:s}=e,l=[],a=this.width,c=this.height;this.paneview=new Sg(this.element,{orientation:ke.VERTICAL,descriptor:{size:s,views:n.map(d=>{var h,m,w;const v=d.data,S=this.options.createComponent({id:v.id,name:v.component});let E;v.headerComponent&&this.options.createHeaderComponent&&(E=this.options.createHeaderComponent({id:v.id,name:v.headerComponent})),E||(E=new Ag);const A=new Tg({id:v.id,component:v.component,headerComponent:v.headerComponent,header:E,body:S,orientation:ke.VERTICAL,isExpanded:!!d.expanded,disableDnd:!!this.options.disableDnd,accessor:this,headerSize:(h=d.headerSize)!==null&&h!==void 0?h:kg,minimumBodySize:(m=d.minimumSize)!==null&&m!==void 0?m:zg,maximumBodySize:(w=d.maximumSize)!==null&&w!==void 0?w:Og});return this.doAddPanel(A),l.push(()=>{var D;A.init({params:(D=v.params)!==null&&D!==void 0?D:{},minimumBodySize:d.minimumSize,maximumBodySize:d.maximumSize,title:v.title,isExpanded:!!d.expanded,containerApi:new ea(this),accessor:this}),A.orientation=this.paneview.orientation}),setTimeout(()=>{this._onDidAddView.fire(A)},0),{size:d.size,view:A}})}}),this.layout(a,c),l.forEach(d=>d()),this._onDidLayoutfromJSON.fire()}clear(){for(const[e,n]of this._viewDisposables.entries())n.dispose();this._viewDisposables.clear(),this.paneview.dispose()}doAddPanel(e){const n=new Ne(e.onDidDrop(s=>{this._onDidDrop.fire(s)}),e.onUnhandledDragOverEvent(s=>{this._onUnhandledDragOverEvent.fire(s)}));this._viewDisposables.set(e.id,n)}doRemovePanel(e){const n=this._viewDisposables.get(e.id);n&&(n.dispose(),this._viewDisposables.delete(e.id))}dispose(){super.dispose();for(const[e,n]of this._viewDisposables.entries())n.dispose();this._viewDisposables.clear(),this.element.remove(),this.paneview.dispose()}}class _x extends sf{get priority(){return this._priority}set orientation(e){this._orientation=e}get orientation(){return this._orientation}get minimumSize(){const e=typeof this._minimumSize=="function"?this._minimumSize():this._minimumSize;return e!==this._evaluatedMinimumSize&&(this._evaluatedMinimumSize=e,this.updateConstraints()),e}get maximumSize(){const e=typeof this._maximumSize=="function"?this._maximumSize():this._maximumSize;return e!==this._evaluatedMaximumSize&&(this._evaluatedMaximumSize=e,this.updateConstraints()),e}get snap(){return this._snap}constructor(e,n){super(e,n,new cw(e,n)),this._evaluatedMinimumSize=0,this._evaluatedMaximumSize=Number.POSITIVE_INFINITY,this._minimumSize=0,this._maximumSize=Number.POSITIVE_INFINITY,this._snap=!1,this._onDidChange=new U,this.onDidChange=this._onDidChange.event,this.api.initialize(this),this.addDisposables(this._onDidChange,this.api.onWillVisibilityChange(s=>{const{isVisible:l}=s,{accessor:a}=this._params;a.setVisible(this,l)}),this.api.onActiveChange(()=>{const{accessor:s}=this._params;s.setActive(this)}),this.api.onDidConstraintsChangeInternal(s=>{(typeof s.minimumSize=="number"||typeof s.minimumSize=="function")&&(this._minimumSize=s.minimumSize),(typeof s.maximumSize=="number"||typeof s.maximumSize=="function")&&(this._maximumSize=s.maximumSize),this.updateConstraints()}),this.api.onDidSizeChange(s=>{this._onDidChange.fire({size:s.size})}))}setVisible(e){this.api._onDidVisibilityChange.fire({isVisible:e})}setActive(e){this.api._onDidActiveChange.fire({isActive:e})}layout(e,n){const[s,l]=this.orientation===ke.HORIZONTAL?[e,n]:[n,e];super.layout(s,l)}init(e){super.init(e),this._priority=e.priority,e.minimumSize&&(this._minimumSize=e.minimumSize),e.maximumSize&&(this._maximumSize=e.maximumSize),e.snap&&(this._snap=e.snap)}toJSON(){const e=s=>s===Number.MAX_SAFE_INTEGER||s===Number.POSITIVE_INFINITY?void 0:s,n=s=>s<=0?void 0:s;return Object.assign(Object.assign({},super.toJSON()),{minimumSize:n(this.minimumSize),maximumSize:e(this.maximumSize)})}updateConstraints(){this.api._onDidConstraintsChange.fire({maximumSize:this._evaluatedMaximumSize,minimumSize:this._evaluatedMinimumSize})}}function yx(r,e){return new px(r,e).api}function Sx(r,e){const n=new gx(r,e);return new rw(n)}function Dx(r,e){const n=new mx(r,e);return new ow(n)}function Cx(r,e){const n=new wx(r,e);return new ea(n)}const vw=(r,e)=>{const[n,s]=pe.useState(),l=pe.useRef(r.componentProps);return pe.useImperativeHandle(e,()=>({update:a=>{l.current=Object.assign(Object.assign({},l.current),a),s(Date.now())}}),[]),pe.createElement(r.component,l.current)};vw.displayName="DockviewReactJsBridge";const xx=(()=>{let r=1;return{next:()=>`dockview_react_portal_key_${(r++).toString()}`}})(),Ex=pe.createContext({});class eo{constructor(e,n,s,l,a){this.parent=e,this.portalStore=n,this.component=s,this.parameters=l,this.context=a,this._initialProps={},this.disposed=!1,this.createPortal()}update(e){if(this.disposed)throw new Error("invalid operation: resource is already disposed");this.componentInstance?this.componentInstance.update(e):this._initialProps=Object.assign(Object.assign({},this._initialProps),e)}createPortal(){if(this.disposed)throw new Error("invalid operation: resource is already disposed");if(!bx(this.component))throw new Error("Dockview: Only React.memo(...), React.ForwardRef(...) and functional components are accepted as components");const e=pe.createElement(pe.forwardRef(vw),{component:this.component,componentProps:this.parameters,ref:l=>{this.componentInstance=l,Object.keys(this._initialProps).length>0&&(this.componentInstance.update(this._initialProps),this._initialProps={})}}),n=this.context?pe.createElement(Ex.Provider,{value:this.context},e):e,s=S0.createPortal(n,this.parent,xx.next());this.ref={portal:s,disposable:this.portalStore.addPortal(s)}}dispose(){var e;(e=this.ref)===null||e===void 0||e.disposable.dispose(),this.disposed=!0}}const hc=()=>{const[r,e]=pe.useState([]);pe.useDebugValue(`Portal count: ${r.length}`);const n=pe.useCallback(s=>{e(a=>[...a,s]);let l=!1;return Qt.from(()=>{if(l)throw new Error("invalid operation: resource already disposed");l=!0,e(a=>a.filter(c=>c!==s))})},[]);return[r,n]};function bx(r){return typeof r=="function"||!!(r!=null&&r.$$typeof)}class Ig{get element(){return this._element}constructor(e,n,s){this.id=e,this.component=n,this.reactPortalStore=s,this._onDidFocus=new U,this.onDidFocus=this._onDidFocus.event,this._onDidBlur=new U,this.onDidBlur=this._onDidBlur.event,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}focus(){}init(e){this.part=new eo(this.element,this.reactPortalStore,this.component,{params:e.params,api:e.api,containerApi:e.containerApi})}update(e){var n;(n=this.part)===null||n===void 0||n.update({params:e.params})}layout(e,n){}dispose(){var e;this._onDidFocus.dispose(),this._onDidBlur.dispose(),(e=this.part)===null||e===void 0||e.dispose()}}class Rg{get element(){return this._element}constructor(e,n,s){this.id=e,this.component=n,this.reactPortalStore=s,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}focus(){}init(e){this.part=new eo(this.element,this.reactPortalStore,this.component,{params:e.params,api:e.api,containerApi:e.containerApi,tabLocation:e.tabLocation})}update(e){var n;(n=this.part)===null||n===void 0||n.update({params:e.params})}layout(e,n){}dispose(){var e;(e=this.part)===null||e===void 0||e.dispose()}}class Ng{get element(){return this._element}constructor(e,n,s){this.id=e,this.component=n,this.reactPortalStore=s,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}init(e){this.part=new eo(this.element,this.reactPortalStore,this.component,{group:e.group,containerApi:e.containerApi})}focus(){}update(e){var n,s,l;this.parameters&&(this.parameters.params=e.params),(n=this.part)===null||n===void 0||n.update({params:(l=(s=this.parameters)===null||s===void 0?void 0:s.params)!==null&&l!==void 0?l:{}})}layout(e,n){}dispose(){var e;(e=this.part)===null||e===void 0||e.dispose()}}class Px{get element(){return this._element}get part(){return this._part}constructor(e,n,s){this.component=e,this.reactPortalStore=n,this._group=s,this.mutableDisposable=new Bn,this._element=document.createElement("div"),this._element.className="dv-react-part",this._element.style.height="100%",this._element.style.width="100%"}init(e){this.mutableDisposable.value=new Ne(this._group.model.onDidAddPanel(()=>{this.updatePanels()}),this._group.model.onDidRemovePanel(()=>{this.updatePanels()}),this._group.model.onDidActivePanelChange(()=>{this.updateActivePanel()}),e.api.onDidActiveChange(()=>{this.updateGroupActive()})),this._part=new eo(this.element,this.reactPortalStore,this.component,{api:e.api,containerApi:e.containerApi,panels:this._group.model.panels,activePanel:this._group.model.activePanel,isGroupActive:this._group.api.isActive,group:this._group})}dispose(){var e;this.mutableDisposable.dispose(),(e=this._part)===null||e===void 0||e.dispose()}update(e){var n;(n=this._part)===null||n===void 0||n.update(e.params)}updatePanels(){this.update({params:{panels:this._group.model.panels}})}updateActivePanel(){this.update({params:{activePanel:this._group.model.activePanel}})}updateGroupActive(){this.update({params:{isGroupActive:this._group.api.isActive}})}}function Mo(r,e){return r?n=>new Px(r,e,n):void 0}const Eu="props.defaultTabComponent";function Ax(r){return Ph.reduce((n,s)=>(s in r&&(n[s]=r[s]),n),{})}const ww=pe.forwardRef((r,e)=>{const n=pe.useRef(null),s=pe.useRef(),[l,a]=hc();pe.useImperativeHandle(e,()=>n.current,[]);const c=pe.useRef({});return pe.useEffect(()=>{const d={};Ph.forEach(h=>{const m=h,w=r[m];m in r&&w!==c.current[m]&&(d[m]=w)}),s.current&&s.current.updateOptions(d),c.current=r},Ph.map(d=>r[d])),pe.useEffect(()=>{var d;if(!n.current)return;const h=(d=r.tabComponents)!==null&&d!==void 0?d:{};r.defaultTabComponent&&(h[Eu]=r.defaultTabComponent);const m={createLeftHeaderActionComponent:Mo(r.leftHeaderActionsComponent,{addPortal:a}),createRightHeaderActionComponent:Mo(r.rightHeaderActionsComponent,{addPortal:a}),createPrefixHeaderActionComponent:Mo(r.prefixHeaderActionsComponent,{addPortal:a}),createComponent:E=>new Ig(E.id,r.components[E.name],{addPortal:a}),createTabComponent(E){return new Rg(E.id,h[E.name],{addPortal:a})},createWatermarkComponent:r.watermarkComponent?()=>new Ng("watermark",r.watermarkComponent,{addPortal:a}):void 0,defaultTabComponent:r.defaultTabComponent?Eu:void 0},w=yx(n.current,Object.assign(Object.assign({},Ax(r)),m)),{clientWidth:v,clientHeight:S}=n.current;return w.layout(v,S),r.onReady&&r.onReady({api:w}),s.current=w,()=>{s.current=void 0,w.dispose()}},[]),pe.useEffect(()=>{if(!s.current)return()=>{};const d=s.current.onDidDrop(h=>{r.onDidDrop&&r.onDidDrop(h)});return()=>{d.dispose()}},[r.onDidDrop]),pe.useEffect(()=>{if(!s.current)return()=>{};const d=s.current.onWillDrop(h=>{r.onWillDrop&&r.onWillDrop(h)});return()=>{d.dispose()}},[r.onWillDrop]),pe.useEffect(()=>{s.current&&s.current.updateOptions({createComponent:d=>new Ig(d.id,r.components[d.name],{addPortal:a})})},[r.components]),pe.useEffect(()=>{var d;if(!s.current)return;const h=(d=r.tabComponents)!==null&&d!==void 0?d:{};r.defaultTabComponent&&(h[Eu]=r.defaultTabComponent),s.current.updateOptions({defaultTabComponent:r.defaultTabComponent?Eu:void 0,createTabComponent(m){return new Rg(m.id,h[m.name],{addPortal:a})}})},[r.tabComponents,r.defaultTabComponent]),pe.useEffect(()=>{s.current&&s.current.updateOptions({createWatermarkComponent:r.watermarkComponent?()=>new Ng("watermark",r.watermarkComponent,{addPortal:a}):void 0})},[r.watermarkComponent]),pe.useEffect(()=>{s.current&&s.current.updateOptions({createRightHeaderActionComponent:Mo(r.rightHeaderActionsComponent,{addPortal:a})})},[r.rightHeaderActionsComponent]),pe.useEffect(()=>{s.current&&s.current.updateOptions({createLeftHeaderActionComponent:Mo(r.leftHeaderActionsComponent,{addPortal:a})})},[r.leftHeaderActionsComponent]),pe.useEffect(()=>{s.current&&s.current.updateOptions({createPrefixHeaderActionComponent:Mo(r.prefixHeaderActionsComponent,{addPortal:a})})},[r.prefixHeaderActionsComponent]),pe.createElement("div",{style:{height:"100%",width:"100%"},ref:n},l)});ww.displayName="DockviewComponent";class Mg extends _x{constructor(e,n,s,l){super(e,n),this.reactComponent=s,this.reactPortalStore=l}getComponent(){var e,n;return new eo(this.element,this.reactPortalStore,this.reactComponent,{params:(n=(e=this._params)===null||e===void 0?void 0:e.params)!==null&&n!==void 0?n:{},api:this.api,containerApi:new rw(this._params.accessor)})}}function kx(r){return Sh.reduce((n,s)=>(s in r&&(n[s]=r[s]),n),{})}const zx=pe.forwardRef((r,e)=>{const n=pe.useRef(null),s=pe.useRef(),[l,a]=hc();pe.useImperativeHandle(e,()=>n.current,[]);const c=pe.useRef({});return pe.useEffect(()=>{const d={};Sh.forEach(h=>{const m=h,w=r[m];m in r&&w!==c.current[m]&&(d[m]=w)}),s.current&&s.current.updateOptions(d),c.current=r},Sh.map(d=>r[d])),pe.useEffect(()=>{if(!n.current)return()=>{};const d={createComponent:v=>new Mg(v.id,v.name,r.components[v.name],{addPortal:a})},h=Sx(n.current,Object.assign(Object.assign({},kx(r)),d)),{clientWidth:m,clientHeight:w}=n.current;return h.layout(m,w),r.onReady&&r.onReady({api:h}),s.current=h,()=>{s.current=void 0,h.dispose()}},[]),pe.useEffect(()=>{s.current&&s.current.updateOptions({createComponent:d=>new Mg(d.id,d.name,r.components[d.name],{addPortal:a})})},[r.components]),pe.createElement("div",{style:{height:"100%",width:"100%"},ref:n},l)});zx.displayName="SplitviewComponent";class Lg extends mw{constructor(e,n,s,l){super(e,n),this.reactComponent=s,this.reactPortalStore=l}getComponent(){var e,n;return new eo(this.element,this.reactPortalStore,this.reactComponent,{params:(n=(e=this._params)===null||e===void 0?void 0:e.params)!==null&&n!==void 0?n:{},api:this.api,containerApi:new ow(this._params.accessor)})}}function Ox(r){return Eh.reduce((n,s)=>(s in r&&(n[s]=r[s]),n),{})}const Tx=pe.forwardRef((r,e)=>{const n=pe.useRef(null),s=pe.useRef(),[l,a]=hc();pe.useImperativeHandle(e,()=>n.current,[]);const c=pe.useRef({});return pe.useEffect(()=>{const d={};Eh.forEach(h=>{const m=h,w=r[m];m in r&&w!==c.current[m]&&(d[m]=w)}),s.current&&s.current.updateOptions(d),c.current=r},Eh.map(d=>r[d])),pe.useEffect(()=>{if(!n.current)return()=>{};const d={createComponent:v=>new Lg(v.id,v.name,r.components[v.name],{addPortal:a})},h=Dx(n.current,Object.assign(Object.assign({},Ox(r)),d)),{clientWidth:m,clientHeight:w}=n.current;return h.layout(m,w),r.onReady&&r.onReady({api:h}),s.current=h,()=>{s.current=void 0,h.dispose()}},[]),pe.useEffect(()=>{s.current&&s.current.updateOptions({createComponent:d=>new Lg(d.id,d.name,r.components[d.name],{addPortal:a})})},[r.components]),pe.createElement("div",{style:{height:"100%",width:"100%"},ref:n},l)});Tx.displayName="GridviewComponent";class bu{get element(){return this._element}constructor(e,n,s){this.id=e,this.component=n,this.reactPortalStore=s,this._element=document.createElement("div"),this._element.style.height="100%",this._element.style.width="100%"}init(e){this.part=new eo(this.element,this.reactPortalStore,this.component,{params:e.params,api:e.api,title:e.title,containerApi:e.containerApi})}toJSON(){return{id:this.id}}update(e){var n;(n=this.part)===null||n===void 0||n.update(e.params)}dispose(){var e;(e=this.part)===null||e===void 0||e.dispose()}}function Ix(r){return bh.reduce((n,s)=>(s in r&&(n[s]=r[s]),n),{})}const Rx=pe.forwardRef((r,e)=>{const n=pe.useRef(null),s=pe.useRef(),[l,a]=hc();pe.useImperativeHandle(e,()=>n.current,[]);const c=pe.useRef({});return pe.useEffect(()=>{const d={};bh.forEach(h=>{const m=h,w=r[m];m in r&&w!==c.current[m]&&(d[m]=w)}),s.current&&s.current.updateOptions(d),c.current=r},bh.map(d=>r[d])),pe.useEffect(()=>{var d;if(!n.current)return()=>{};const h=(d=r.headerComponents)!==null&&d!==void 0?d:{},m={createComponent:E=>new bu(E.id,r.components[E.name],{addPortal:a}),createHeaderComponent:E=>new bu(E.id,h[E.name],{addPortal:a})},w=Cx(n.current,Object.assign(Object.assign({},Ix(r)),m)),{clientWidth:v,clientHeight:S}=n.current;return w.layout(v,S),r.onReady&&r.onReady({api:w}),s.current=w,()=>{s.current=void 0,w.dispose()}},[]),pe.useEffect(()=>{s.current&&s.current.updateOptions({createComponent:d=>new bu(d.id,r.components[d.name],{addPortal:a})})},[r.components]),pe.useEffect(()=>{var d;if(!s.current)return;const h=(d=r.headerComponents)!==null&&d!==void 0?d:{};s.current.updateOptions({createHeaderComponent:m=>new bu(m.id,h[m.name],{addPortal:a})})},[r.headerComponents]),pe.useEffect(()=>{if(!s.current)return()=>{};const d=s.current.onDidDrop(h=>{r.onDidDrop&&r.onDidDrop(h)});return()=>{d.dispose()}},[r.onDidDrop]),pe.createElement("div",{style:{height:"100%",width:"100%"},ref:n},l)});Rx.displayName="PaneviewComponent";const Vg="damiao.monitor.layout";function Nx(r){r.addPanel({id:"plot-1",component:"plot",title:"Plot 1"}),r.addPanel({id:"cards-1",component:"cards",title:"Motor Cards",position:{referencePanel:"plot-1",direction:"right"}}),r.addPanel({id:"table-1",component:"table",title:"Motor Table",position:{referencePanel:"plot-1",direction:"below"}}),r.addPanel({id:"raw-1",component:"rawlog",title:"Raw CAN Log",position:{referencePanel:"table-1",direction:"within"}})}function Mx(){const r=B.useCallback(e=>{const{api:n}=e;YD(n);const s=localStorage.getItem(Vg);let l=!1;if(s)try{n.fromJSON(JSON.parse(s)),l=!0}catch{l=!1}l||Nx(n),n.onDidLayoutChange(()=>{try{localStorage.setItem(Vg,JSON.stringify(n.toJSON()))}catch{}})},[]);return Y.jsx(ww,{className:"dockview-theme-abyss",components:$D,onReady:r})}function Lx(){const r=Cn(d=>d.addSignalToPlot),e=Cn(d=>d.setMotorTypes),[n,s]=B.useState(null),l=M0(N0(Mh,{activationConstraint:{distance:4}}));B.useEffect(()=>{Jv(),mD().then(e)},[e]);const a=d=>{var m;const h=(m=d.active.data.current)==null?void 0:m.signalId;s(h?vh(h):null)},c=d=>{var w,v,S,E;s(null);const h=(w=d.active.data.current)==null?void 0:w.signalId,m=((S=(v=d.over)==null?void 0:v.id)==null?void 0:S.toString())||"";if(h&&m.startsWith("plot:")){const A=(E=d.over.data.current)==null?void 0:E.panelId;r(A,h)}};return Y.jsxs(I_,{sensors:l,onDragStart:a,onDragEnd:c,children:[Y.jsxs("div",{className:"app",children:[Y.jsx(JD,{}),Y.jsxs("div",{className:"body",children:[Y.jsx(XD,{}),Y.jsx("main",{className:"dock-host",children:Y.jsx(Mx,{})})]})]}),Y.jsx(q_,{dropAnimation:null,children:n?Y.jsx("div",{className:"drag-ghost",children:n}):null})]})}y0.createRoot(document.getElementById("root")).render(Y.jsx(pe.StrictMode,{children:Y.jsx(Lx,{})})); diff --git a/damiao_motor/gui/webapp/dist/assets/index-BV1u67uH.js b/damiao_motor/gui/webapp/dist/assets/index-BV1u67uH.js new file mode 100644 index 0000000..31e3cdf --- /dev/null +++ b/damiao_motor/gui/webapp/dist/assets/index-BV1u67uH.js @@ -0,0 +1,54 @@ +var bv=Object.defineProperty;var Ov=(l,t,r)=>t in l?bv(l,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[t]=r;var fo=(l,t,r)=>Ov(l,typeof t!="symbol"?t+"":t,r);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const u of o)if(u.type==="childList")for(const f of u.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&i(f)}).observe(document,{childList:!0,subtree:!0});function r(o){const u={};return o.integrity&&(u.integrity=o.integrity),o.referrerPolicy&&(u.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?u.credentials="include":o.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function i(o){if(o.ep)return;o.ep=!0;const u=r(o);fetch(o.href,u)}})();function kg(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var Zc={exports:{}},ho={},ef={exports:{}},Be={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var rp;function Lv(){if(rp)return Be;rp=1;var l=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),f=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),v=Symbol.iterator;function x(D){return D===null||typeof D!="object"?null:(D=v&&D[v]||D["@@iterator"],typeof D=="function"?D:null)}var z={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},R=Object.assign,k={};function b(D,H,K){this.props=D,this.context=H,this.refs=k,this.updater=K||z}b.prototype.isReactComponent={},b.prototype.setState=function(D,H){if(typeof D!="object"&&typeof D!="function"&&D!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,D,H,"setState")},b.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function B(){}B.prototype=b.prototype;function P(D,H,K){this.props=D,this.context=H,this.refs=k,this.updater=K||z}var W=P.prototype=new B;W.constructor=P,R(W,b.prototype),W.isPureReactComponent=!0;var V=Array.isArray,Z=Object.prototype.hasOwnProperty,G={current:null},ee={key:!0,ref:!0,__self:!0,__source:!0};function re(D,H,K){var xe,be={},ge=null,_e=null;if(H!=null)for(xe in H.ref!==void 0&&(_e=H.ref),H.key!==void 0&&(ge=""+H.key),H)Z.call(H,xe)&&!ee.hasOwnProperty(xe)&&(be[xe]=H[xe]);var He=arguments.length-2;if(He===1)be.children=K;else if(1>>1,H=ie[D];if(0>>1;Do(be,X))geo(_e,be)?(ie[D]=_e,ie[ge]=X,D=ge):(ie[D]=be,ie[xe]=X,D=xe);else if(geo(_e,X))ie[D]=_e,ie[ge]=X,D=ge;else break e}}return oe}function o(ie,oe){var X=ie.sortIndex-oe.sortIndex;return X!==0?X:ie.id-oe.id}if(typeof performance=="object"&&typeof performance.now=="function"){var u=performance;l.unstable_now=function(){return u.now()}}else{var f=Date,d=f.now();l.unstable_now=function(){return f.now()-d}}var p=[],m=[],w=1,v=null,x=3,z=!1,R=!1,k=!1,b=typeof setTimeout=="function"?setTimeout:null,B=typeof clearTimeout=="function"?clearTimeout:null,P=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function W(ie){for(var oe=r(m);oe!==null;){if(oe.callback===null)i(m);else if(oe.startTime<=ie)i(m),oe.sortIndex=oe.expirationTime,t(p,oe);else break;oe=r(m)}}function V(ie){if(k=!1,W(ie),!R)if(r(p)!==null)R=!0,De(Z);else{var oe=r(m);oe!==null&&le(V,oe.startTime-ie)}}function Z(ie,oe){R=!1,k&&(k=!1,B(re),re=-1),z=!0;var X=x;try{for(W(oe),v=r(p);v!==null&&(!(v.expirationTime>oe)||ie&&!Y());){var D=v.callback;if(typeof D=="function"){v.callback=null,x=v.priorityLevel;var H=D(v.expirationTime<=oe);oe=l.unstable_now(),typeof H=="function"?v.callback=H:v===r(p)&&i(p),W(oe)}else i(p);v=r(p)}if(v!==null)var K=!0;else{var xe=r(m);xe!==null&&le(V,xe.startTime-oe),K=!1}return K}finally{v=null,x=X,z=!1}}var G=!1,ee=null,re=-1,ve=5,de=-1;function Y(){return!(l.unstable_now()-deie||125D?(ie.sortIndex=X,t(m,ie),r(p)===null&&ie===r(m)&&(k?(B(re),re=-1):k=!0,le(V,X-D))):(ie.sortIndex=H,t(p,ie),R||z||(R=!0,De(Z))),ie},l.unstable_shouldYield=Y,l.unstable_wrapCallback=function(ie){var oe=x;return function(){var X=x;x=oe;try{return ie.apply(this,arguments)}finally{x=X}}}})(rf)),rf}var ap;function Hv(){return ap||(ap=1,nf.exports=Iv()),nf.exports}/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var up;function Fv(){if(up)return ir;up=1;var l=Hf(),t=Hv();function r(e){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+e,s=1;s"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),p=Object.prototype.hasOwnProperty,m=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,w={},v={};function x(e){return p.call(v,e)?!0:p.call(w,e)?!1:m.test(e)?v[e]=!0:(w[e]=!0,!1)}function z(e,n,s,a){if(s!==null&&s.type===0)return!1;switch(typeof n){case"function":case"symbol":return!0;case"boolean":return a?!1:s!==null?!s.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function R(e,n,s,a){if(n===null||typeof n>"u"||z(e,n,s,a))return!0;if(a)return!1;if(s!==null)switch(s.type){case 3:return!n;case 4:return n===!1;case 5:return isNaN(n);case 6:return isNaN(n)||1>n}return!1}function k(e,n,s,a,c,h,y){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=a,this.attributeNamespace=c,this.mustUseProperty=s,this.propertyName=e,this.type=n,this.sanitizeURL=h,this.removeEmptyString=y}var b={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){b[e]=new k(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var n=e[0];b[n]=new k(n,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){b[e]=new k(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){b[e]=new k(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){b[e]=new k(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){b[e]=new k(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){b[e]=new k(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){b[e]=new k(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){b[e]=new k(e,5,!1,e.toLowerCase(),null,!1,!1)});var B=/[\-:]([a-z])/g;function P(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var n=e.replace(B,P);b[n]=new k(n,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var n=e.replace(B,P);b[n]=new k(n,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var n=e.replace(B,P);b[n]=new k(n,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){b[e]=new k(e,1,!1,e.toLowerCase(),null,!1,!1)}),b.xlinkHref=new k("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){b[e]=new k(e,1,!1,e.toLowerCase(),null,!0,!0)});function W(e,n,s,a){var c=b.hasOwnProperty(n)?b[n]:null;(c!==null?c.type!==0:a||!(2C||c[y]!==h[C]){var N=` +`+c[y].replace(" at new "," at ");return e.displayName&&N.includes("")&&(N=N.replace("",e.displayName)),N}while(1<=y&&0<=C);break}}}finally{K=!1,Error.prepareStackTrace=s}return(e=e?e.displayName||e.name:"")?H(e):""}function be(e){switch(e.tag){case 5:return H(e.type);case 16:return H("Lazy");case 13:return H("Suspense");case 19:return H("SuspenseList");case 0:case 2:case 15:return e=xe(e.type,!1),e;case 11:return e=xe(e.type.render,!1),e;case 1:return e=xe(e.type,!0),e;default:return""}}function ge(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ee:return"Fragment";case G:return"Portal";case ve:return"Profiler";case re:return"StrictMode";case ae:return"Suspense";case ye:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Y:return(e.displayName||"Context")+".Consumer";case de:return(e._context.displayName||"Context")+".Provider";case Ce:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case me:return n=e.displayName||null,n!==null?n:ge(e.type)||"Memo";case De:n=e._payload,e=e._init;try{return ge(e(n))}catch{}}return null}function _e(e){var n=e.type;switch(e.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=n.render,e=e.displayName||e.name||"",n.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ge(n);case 8:return n===re?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function He(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Fe(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Oe(e){var n=Fe(e)?"checked":"value",s=Object.getOwnPropertyDescriptor(e.constructor.prototype,n),a=""+e[n];if(!e.hasOwnProperty(n)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var c=s.get,h=s.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return c.call(this)},set:function(y){a=""+y,h.call(this,y)}}),Object.defineProperty(e,n,{enumerable:s.enumerable}),{getValue:function(){return a},setValue:function(y){a=""+y},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function $t(e){e._valueTracker||(e._valueTracker=Oe(e))}function Pt(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var s=n.getValue(),a="";return e&&(a=Fe(e)?e.checked?"true":"false":e.value),e=a,e!==s?(n.setValue(e),!0):!1}function At(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function It(e,n){var s=n.checked;return X({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:s??e._wrapperState.initialChecked})}function Kn(e,n){var s=n.defaultValue==null?"":n.defaultValue,a=n.checked!=null?n.checked:n.defaultChecked;s=He(n.value!=null?n.value:s),e._wrapperState={initialChecked:a,initialValue:s,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function Cn(e,n){n=n.checked,n!=null&&W(e,"checked",n,!1)}function _r(e,n){Cn(e,n);var s=He(n.value),a=n.type;if(s!=null)a==="number"?(s===0&&e.value===""||e.value!=s)&&(e.value=""+s):e.value!==""+s&&(e.value=""+s);else if(a==="submit"||a==="reset"){e.removeAttribute("value");return}n.hasOwnProperty("value")?Pn(e,n.type,s):n.hasOwnProperty("defaultValue")&&Pn(e,n.type,He(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(e.defaultChecked=!!n.defaultChecked)}function Xr(e,n,s){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var a=n.type;if(!(a!=="submit"&&a!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+e._wrapperState.initialValue,s||n===e.value||(e.value=n),e.defaultValue=n}s=e.name,s!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,s!==""&&(e.name=s)}function Pn(e,n,s){(n!=="number"||At(e.ownerDocument)!==e)&&(s==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+s&&(e.defaultValue=""+s))}var Ze=Array.isArray;function nn(e,n,s,a){if(e=e.options,n){n={};for(var c=0;c"+n.valueOf().toString()+"",n=sn.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;n.firstChild;)e.appendChild(n.firstChild)}});function Gt(e,n){if(n){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=n;return}}e.textContent=n}var Rt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ln=["Webkit","ms","Moz","O"];Object.keys(Rt).forEach(function(e){ln.forEach(function(n){n=n+e.charAt(0).toUpperCase()+e.substring(1),Rt[n]=Rt[e]})});function mn(e,n,s){return n==null||typeof n=="boolean"||n===""?"":s||typeof n!="number"||n===0||Rt.hasOwnProperty(e)&&Rt[e]?(""+n).trim():n+"px"}function Yt(e,n){e=e.style;for(var s in n)if(n.hasOwnProperty(s)){var a=s.indexOf("--")===0,c=mn(s,n[s],a);s==="float"&&(s="cssFloat"),a?e.setProperty(s,c):e[s]=c}}var vn=X({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function qr(e,n){if(n){if(vn[e]&&(n.children!=null||n.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(n.dangerouslySetInnerHTML!=null){if(n.children!=null)throw Error(r(60));if(typeof n.dangerouslySetInnerHTML!="object"||!("__html"in n.dangerouslySetInnerHTML))throw Error(r(61))}if(n.style!=null&&typeof n.style!="object")throw Error(r(62))}}function Jr(e,n){if(e.indexOf("-")===-1)return typeof n.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var lr=null;function or(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Zr=null,zt=null,lt=null;function Kt(e){if(e=Xl(e)){if(typeof Zr!="function")throw Error(r(280));var n=e.stateNode;n&&(n=aa(n),Zr(e.stateNode,e.type,n))}}function on(e){zt?lt?lt.push(e):lt=[e]:zt=e}function ar(){if(zt){var e=zt,n=lt;if(lt=zt=null,Kt(e),n)for(e=0;e>>=0,e===0?32:31-(Ll(e)/Nn|0)|0}var os=64,Ti=4194304;function zi(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Fs(e,n){var s=e.pendingLanes;if(s===0)return 0;var a=0,c=e.suspendedLanes,h=e.pingedLanes,y=s&268435455;if(y!==0){var C=y&~c;C!==0?a=zi(C):(h&=y,h!==0&&(a=zi(h)))}else y=s&~c,y!==0?a=zi(y):h!==0&&(a=zi(h));if(a===0)return 0;if(n!==0&&n!==a&&(n&c)===0&&(c=a&-a,h=n&-n,c>=h||c===16&&(h&4194240)!==0))return n;if((a&4)!==0&&(a|=s&16),n=e.entangledLanes,n!==0)for(e=e.entanglements,n&=a;0s;s++)n.push(e);return n}function Mi(e,n,s){e.pendingLanes|=n,n!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,n=31-In(n),e[n]=s}function Il(e,n){var s=e.pendingLanes&~n;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=n,e.mutableReadLanes&=n,e.entangledLanes&=n,n=e.entanglements;var a=e.eventTimes;for(e=e.expirationTimes;0=pi),ta=" ",Qs=!1;function g(e,n){switch(e){case"keyup":return Dt.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function S(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var _=!1;function E(e,n){switch(e){case"compositionend":return S(n);case"keypress":return n.which!==32?null:(Qs=!0,ta);case"textInput":return e=n.data,e===ta&&Qs?null:e;default:return null}}function T(e,n){if(_)return e==="compositionend"||!Ks&&g(e,n)?(e=dr(),fr=Wl=cr=null,_=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1=n)return{node:s,offset:n-e};e=a}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=Jn(s)}}function Tn(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Tn(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Wn(){for(var e=window,n=At();n instanceof e.HTMLIFrameElement;){try{var s=typeof n.contentWindow.location.href=="string"}catch{s=!1}if(s)e=n.contentWindow;else break;n=At(e.document)}return n}function Bn(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}function Nr(e){var n=Wn(),s=e.focusedElem,a=e.selectionRange;if(n!==s&&s&&s.ownerDocument&&Tn(s.ownerDocument.documentElement,s)){if(a!==null&&Bn(s)){if(n=a.start,e=a.end,e===void 0&&(e=n),"selectionStart"in s)s.selectionStart=n,s.selectionEnd=Math.min(e,s.value.length);else if(e=(n=s.ownerDocument||document)&&n.defaultView||window,e.getSelection){e=e.getSelection();var c=s.textContent.length,h=Math.min(a.start,c);a=a.end===void 0?h:Math.min(a.end,c),!e.extend&&h>a&&(c=a,a=h,h=c),c=pr(s,h);var y=pr(s,a);c&&y&&(e.rangeCount!==1||e.anchorNode!==c.node||e.anchorOffset!==c.offset||e.focusNode!==y.node||e.focusOffset!==y.offset)&&(n=n.createRange(),n.setStart(c.node,c.offset),e.removeAllRanges(),h>a?(e.addRange(n),e.extend(y.node,y.offset)):(n.setEnd(y.node,y.offset),e.addRange(n)))}}for(n=[],e=s;e=e.parentNode;)e.nodeType===1&&n.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s=document.documentMode,Bt=null,Fr=null,Ot=null,Xs=!1;function cd(e,n,s){var a=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;Xs||Bt==null||Bt!==At(a)||(a=Bt,"selectionStart"in a&&Bn(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),Ot&&cn(Ot,a)||(Ot=a,a=sa(Fr,"onSelect"),0tl||(e.current=Xu[tl],Xu[tl]=null,tl--)}function dt(e,n){tl++,Xu[tl]=e.current,e.current=n}var $i={},zn=Vi($i),Zn=Vi(!1),ys=$i;function nl(e,n){var s=e.type.contextTypes;if(!s)return $i;var a=e.stateNode;if(a&&a.__reactInternalMemoizedUnmaskedChildContext===n)return a.__reactInternalMemoizedMaskedChildContext;var c={},h;for(h in s)c[h]=n[h];return a&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=n,e.__reactInternalMemoizedMaskedChildContext=c),c}function er(e){return e=e.childContextTypes,e!=null}function ua(){gt(Zn),gt(zn)}function kd(e,n,s){if(zn.current!==$i)throw Error(r(168));dt(zn,n),dt(Zn,s)}function Rd(e,n,s){var a=e.stateNode;if(n=n.childContextTypes,typeof a.getChildContext!="function")return s;a=a.getChildContext();for(var c in a)if(!(c in n))throw Error(r(108,_e(e)||"Unknown",c));return X({},s,a)}function ca(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||$i,ys=zn.current,dt(zn,e),dt(Zn,Zn.current),!0}function Nd(e,n,s){var a=e.stateNode;if(!a)throw Error(r(169));s?(e=Rd(e,n,ys),a.__reactInternalMemoizedMergedChildContext=e,gt(Zn),gt(zn),dt(zn,e)):gt(Zn),dt(Zn,s)}var mi=null,fa=!1,qu=!1;function Dd(e){mi===null?mi=[e]:mi.push(e)}function qm(e){fa=!0,Dd(e)}function Gi(){if(!qu&&mi!==null){qu=!0;var e=0,n=$e;try{var s=mi;for($e=1;e>=y,c-=y,vi=1<<32-In(n)+c|s<Ie?(hn=Me,Me=null):hn=Me.sibling;var Qe=Q(O,Me,I[Ie],se);if(Qe===null){Me===null&&(Me=hn);break}e&&Me&&Qe.alternate===null&&n(O,Me),M=h(Qe,M,Ie),ze===null?Re=Qe:ze.sibling=Qe,ze=Qe,Me=hn}if(Ie===I.length)return s(O,Me),St&&Ss(O,Ie),Re;if(Me===null){for(;IeIe?(hn=Me,Me=null):hn=Me.sibling;var ts=Q(O,Me,Qe.value,se);if(ts===null){Me===null&&(Me=hn);break}e&&Me&&ts.alternate===null&&n(O,Me),M=h(ts,M,Ie),ze===null?Re=ts:ze.sibling=ts,ze=ts,Me=hn}if(Qe.done)return s(O,Me),St&&Ss(O,Ie),Re;if(Me===null){for(;!Qe.done;Ie++,Qe=I.next())Qe=te(O,Qe.value,se),Qe!==null&&(M=h(Qe,M,Ie),ze===null?Re=Qe:ze.sibling=Qe,ze=Qe);return St&&Ss(O,Ie),Re}for(Me=a(O,Me);!Qe.done;Ie++,Qe=I.next())Qe=pe(Me,O,Ie,Qe.value,se),Qe!==null&&(e&&Qe.alternate!==null&&Me.delete(Qe.key===null?Ie:Qe.key),M=h(Qe,M,Ie),ze===null?Re=Qe:ze.sibling=Qe,ze=Qe);return e&&Me.forEach(function(Mv){return n(O,Mv)}),St&&Ss(O,Ie),Re}function Lt(O,M,I,se){if(typeof I=="object"&&I!==null&&I.type===ee&&I.key===null&&(I=I.props.children),typeof I=="object"&&I!==null){switch(I.$$typeof){case Z:e:{for(var Re=I.key,ze=M;ze!==null;){if(ze.key===Re){if(Re=I.type,Re===ee){if(ze.tag===7){s(O,ze.sibling),M=c(ze,I.props.children),M.return=O,O=M;break e}}else if(ze.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===De&&Ld(Re)===ze.type){s(O,ze.sibling),M=c(ze,I.props),M.ref=ql(O,ze,I),M.return=O,O=M;break e}s(O,ze);break}else n(O,ze);ze=ze.sibling}I.type===ee?(M=Ds(I.props.children,O.mode,se,I.key),M.return=O,O=M):(se=Fa(I.type,I.key,I.props,null,O.mode,se),se.ref=ql(O,M,I),se.return=O,O=se)}return y(O);case G:e:{for(ze=I.key;M!==null;){if(M.key===ze)if(M.tag===4&&M.stateNode.containerInfo===I.containerInfo&&M.stateNode.implementation===I.implementation){s(O,M.sibling),M=c(M,I.children||[]),M.return=O,O=M;break e}else{s(O,M);break}else n(O,M);M=M.sibling}M=Kc(I,O.mode,se),M.return=O,O=M}return y(O);case De:return ze=I._init,Lt(O,M,ze(I._payload),se)}if(Ze(I))return Se(O,M,I,se);if(oe(I))return Ee(O,M,I,se);ga(O,I)}return typeof I=="string"&&I!==""||typeof I=="number"?(I=""+I,M!==null&&M.tag===6?(s(O,M.sibling),M=c(M,I),M.return=O,O=M):(s(O,M),M=Yc(I,O.mode,se),M.return=O,O=M),y(O)):s(O,M)}return Lt}var ll=Pd(!0),Ad=Pd(!1),ma=Vi(null),va=null,ol=null,rc=null;function ic(){rc=ol=va=null}function sc(e){var n=ma.current;gt(ma),e._currentValue=n}function lc(e,n,s){for(;e!==null;){var a=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,a!==null&&(a.childLanes|=n)):a!==null&&(a.childLanes&n)!==n&&(a.childLanes|=n),e===s)break;e=e.return}}function al(e,n){va=e,rc=ol=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&n)!==0&&(tr=!0),e.firstContext=null)}function zr(e){var n=e._currentValue;if(rc!==e)if(e={context:e,memoizedValue:n,next:null},ol===null){if(va===null)throw Error(r(308));ol=e,va.dependencies={lanes:0,firstContext:e}}else ol=ol.next=e;return n}var xs=null;function oc(e){xs===null?xs=[e]:xs.push(e)}function Id(e,n,s,a){var c=n.interleaved;return c===null?(s.next=s,oc(n)):(s.next=c.next,c.next=s),n.interleaved=s,wi(e,a)}function wi(e,n){e.lanes|=n;var s=e.alternate;for(s!==null&&(s.lanes|=n),s=e,e=e.return;e!==null;)e.childLanes|=n,s=e.alternate,s!==null&&(s.childLanes|=n),s=e,e=e.return;return s.tag===3?s.stateNode:null}var Yi=!1;function ac(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Hd(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Si(e,n){return{eventTime:e,lane:n,tag:0,payload:null,callback:null,next:null}}function Ki(e,n,s){var a=e.updateQueue;if(a===null)return null;if(a=a.shared,(Ye&2)!==0){var c=a.pending;return c===null?n.next=n:(n.next=c.next,c.next=n),a.pending=n,wi(e,s)}return c=a.interleaved,c===null?(n.next=n,oc(a)):(n.next=c.next,c.next=n),a.interleaved=n,wi(e,s)}function ya(e,n,s){if(n=n.updateQueue,n!==null&&(n=n.shared,(s&4194240)!==0)){var a=n.lanes;a&=e.pendingLanes,s|=a,n.lanes=s,bi(e,s)}}function Fd(e,n){var s=e.updateQueue,a=e.alternate;if(a!==null&&(a=a.updateQueue,s===a)){var c=null,h=null;if(s=s.firstBaseUpdate,s!==null){do{var y={eventTime:s.eventTime,lane:s.lane,tag:s.tag,payload:s.payload,callback:s.callback,next:null};h===null?c=h=y:h=h.next=y,s=s.next}while(s!==null);h===null?c=h=n:h=h.next=n}else c=h=n;s={baseState:a.baseState,firstBaseUpdate:c,lastBaseUpdate:h,shared:a.shared,effects:a.effects},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=n:e.next=n,s.lastBaseUpdate=n}function wa(e,n,s,a){var c=e.updateQueue;Yi=!1;var h=c.firstBaseUpdate,y=c.lastBaseUpdate,C=c.shared.pending;if(C!==null){c.shared.pending=null;var N=C,F=N.next;N.next=null,y===null?h=F:y.next=F,y=N;var J=e.alternate;J!==null&&(J=J.updateQueue,C=J.lastBaseUpdate,C!==y&&(C===null?J.firstBaseUpdate=F:C.next=F,J.lastBaseUpdate=N))}if(h!==null){var te=c.baseState;y=0,J=F=N=null,C=h;do{var Q=C.lane,pe=C.eventTime;if((a&Q)===Q){J!==null&&(J=J.next={eventTime:pe,lane:0,tag:C.tag,payload:C.payload,callback:C.callback,next:null});e:{var Se=e,Ee=C;switch(Q=n,pe=s,Ee.tag){case 1:if(Se=Ee.payload,typeof Se=="function"){te=Se.call(pe,te,Q);break e}te=Se;break e;case 3:Se.flags=Se.flags&-65537|128;case 0:if(Se=Ee.payload,Q=typeof Se=="function"?Se.call(pe,te,Q):Se,Q==null)break e;te=X({},te,Q);break e;case 2:Yi=!0}}C.callback!==null&&C.lane!==0&&(e.flags|=64,Q=c.effects,Q===null?c.effects=[C]:Q.push(C))}else pe={eventTime:pe,lane:Q,tag:C.tag,payload:C.payload,callback:C.callback,next:null},J===null?(F=J=pe,N=te):J=J.next=pe,y|=Q;if(C=C.next,C===null){if(C=c.shared.pending,C===null)break;Q=C,C=Q.next,Q.next=null,c.lastBaseUpdate=Q,c.shared.pending=null}}while(!0);if(J===null&&(N=te),c.baseState=N,c.firstBaseUpdate=F,c.lastBaseUpdate=J,n=c.shared.interleaved,n!==null){c=n;do y|=c.lane,c=c.next;while(c!==n)}else h===null&&(c.shared.lanes=0);Cs|=y,e.lanes=y,e.memoizedState=te}}function jd(e,n,s){if(e=n.effects,n.effects=null,e!==null)for(n=0;ns?s:4,e(!0);var a=hc.transition;hc.transition={};try{e(!1),n()}finally{$e=s,hc.transition=a}}function sh(){return Mr().memoizedState}function tv(e,n,s){var a=Ji(e);if(s={lane:a,action:s,hasEagerState:!1,eagerState:null,next:null},lh(e))oh(n,s);else if(s=Id(e,n,s,a),s!==null){var c=Vn();Vr(s,e,a,c),ah(s,n,a)}}function nv(e,n,s){var a=Ji(e),c={lane:a,action:s,hasEagerState:!1,eagerState:null,next:null};if(lh(e))oh(n,c);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var y=n.lastRenderedState,C=h(y,s);if(c.hasEagerState=!0,c.eagerState=C,at(C,y)){var N=n.interleaved;N===null?(c.next=c,oc(n)):(c.next=N.next,N.next=c),n.interleaved=c;return}}catch{}finally{}s=Id(e,n,c,a),s!==null&&(c=Vn(),Vr(s,e,a,c),ah(s,n,a))}}function lh(e){var n=e.alternate;return e===kt||n!==null&&n===kt}function oh(e,n){to=_a=!0;var s=e.pending;s===null?n.next=n:(n.next=s.next,s.next=n),e.pending=n}function ah(e,n,s){if((s&4194240)!==0){var a=n.lanes;a&=e.pendingLanes,s|=a,n.lanes=s,bi(e,s)}}var ka={readContext:zr,useCallback:Mn,useContext:Mn,useEffect:Mn,useImperativeHandle:Mn,useInsertionEffect:Mn,useLayoutEffect:Mn,useMemo:Mn,useReducer:Mn,useRef:Mn,useState:Mn,useDebugValue:Mn,useDeferredValue:Mn,useTransition:Mn,useMutableSource:Mn,useSyncExternalStore:Mn,useId:Mn,unstable_isNewReconciler:!1},rv={readContext:zr,useCallback:function(e,n){return si().memoizedState=[e,n===void 0?null:n],e},useContext:zr,useEffect:qd,useImperativeHandle:function(e,n,s){return s=s!=null?s.concat([e]):null,Ea(4194308,4,eh.bind(null,n,e),s)},useLayoutEffect:function(e,n){return Ea(4194308,4,e,n)},useInsertionEffect:function(e,n){return Ea(4,2,e,n)},useMemo:function(e,n){var s=si();return n=n===void 0?null:n,e=e(),s.memoizedState=[e,n],e},useReducer:function(e,n,s){var a=si();return n=s!==void 0?s(n):n,a.memoizedState=a.baseState=n,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:n},a.queue=e,e=e.dispatch=tv.bind(null,kt,e),[a.memoizedState,e]},useRef:function(e){var n=si();return e={current:e},n.memoizedState=e},useState:Qd,useDebugValue:Sc,useDeferredValue:function(e){return si().memoizedState=e},useTransition:function(){var e=Qd(!1),n=e[0];return e=ev.bind(null,e[1]),si().memoizedState=e,[n,e]},useMutableSource:function(){},useSyncExternalStore:function(e,n,s){var a=kt,c=si();if(St){if(s===void 0)throw Error(r(407));s=s()}else{if(s=n(),dn===null)throw Error(r(349));(Es&30)!==0||Vd(a,n,s)}c.memoizedState=s;var h={value:s,getSnapshot:n};return c.queue=h,qd(Gd.bind(null,a,h,e),[e]),a.flags|=2048,io(9,$d.bind(null,a,h,s,n),void 0,null),s},useId:function(){var e=si(),n=dn.identifierPrefix;if(St){var s=yi,a=vi;s=(a&~(1<<32-In(a)-1)).toString(32)+s,n=":"+n+"R"+s,s=no++,0<\/script>",e=e.removeChild(e.firstChild)):typeof a.is=="string"?e=y.createElement(s,{is:a.is}):(e=y.createElement(s),s==="select"&&(y=e,a.multiple?y.multiple=!0:a.size&&(y.size=a.size))):e=y.createElementNS(e,s),e[ri]=n,e[Ql]=a,Dh(e,n,!1,!1),n.stateNode=e;e:{switch(y=Jr(s,a),s){case"dialog":pt("cancel",e),pt("close",e),c=a;break;case"iframe":case"object":case"embed":pt("load",e),c=a;break;case"video":case"audio":for(c=0;chl&&(n.flags|=128,a=!0,so(h,!1),n.lanes=4194304)}else{if(!a)if(e=Sa(y),e!==null){if(n.flags|=128,a=!0,s=e.updateQueue,s!==null&&(n.updateQueue=s,n.flags|=4),so(h,!0),h.tail===null&&h.tailMode==="hidden"&&!y.alternate&&!St)return bn(n),null}else 2*ot()-h.renderingStartTime>hl&&s!==1073741824&&(n.flags|=128,a=!0,so(h,!1),n.lanes=4194304);h.isBackwards?(y.sibling=n.child,n.child=y):(s=h.last,s!==null?s.sibling=y:n.child=y,h.last=y)}return h.tail!==null?(n=h.tail,h.rendering=n,h.tail=n.sibling,h.renderingStartTime=ot(),n.sibling=null,s=Ct.current,dt(Ct,a?s&1|2:s&1),n):(bn(n),null);case 22:case 23:return Vc(),a=n.memoizedState!==null,e!==null&&e.memoizedState!==null!==a&&(n.flags|=8192),a&&(n.mode&1)!==0?(vr&1073741824)!==0&&(bn(n),n.subtreeFlags&6&&(n.flags|=8192)):bn(n),null;case 24:return null;case 25:return null}throw Error(r(156,n.tag))}function fv(e,n){switch(Zu(n),n.tag){case 1:return er(n.type)&&ua(),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return ul(),gt(Zn),gt(zn),dc(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 5:return cc(n),null;case 13:if(gt(Ct),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(r(340));sl()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return gt(Ct),null;case 4:return ul(),null;case 10:return sc(n.type._context),null;case 22:case 23:return Vc(),null;case 24:return null;default:return null}}var Ta=!1,On=!1,dv=typeof WeakSet=="function"?WeakSet:Set,we=null;function fl(e,n){var s=e.ref;if(s!==null)if(typeof s=="function")try{s(null)}catch(a){Tt(e,n,a)}else s.current=null}function bc(e,n,s){try{s()}catch(a){Tt(e,n,a)}}var Mh=!1;function hv(e,n){if(Vu=rt,e=Wn(),Bn(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{s=(s=e.ownerDocument)&&s.defaultView||window;var a=s.getSelection&&s.getSelection();if(a&&a.rangeCount!==0){s=a.anchorNode;var c=a.anchorOffset,h=a.focusNode;a=a.focusOffset;try{s.nodeType,h.nodeType}catch{s=null;break e}var y=0,C=-1,N=-1,F=0,J=0,te=e,Q=null;t:for(;;){for(var pe;te!==s||c!==0&&te.nodeType!==3||(C=y+c),te!==h||a!==0&&te.nodeType!==3||(N=y+a),te.nodeType===3&&(y+=te.nodeValue.length),(pe=te.firstChild)!==null;)Q=te,te=pe;for(;;){if(te===e)break t;if(Q===s&&++F===c&&(C=y),Q===h&&++J===a&&(N=y),(pe=te.nextSibling)!==null)break;te=Q,Q=te.parentNode}te=pe}s=C===-1||N===-1?null:{start:C,end:N}}else s=null}s=s||{start:0,end:0}}else s=null;for($u={focusedElem:e,selectionRange:s},rt=!1,we=n;we!==null;)if(n=we,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,we=e;else for(;we!==null;){n=we;try{var Se=n.alternate;if((n.flags&1024)!==0)switch(n.tag){case 0:case 11:case 15:break;case 1:if(Se!==null){var Ee=Se.memoizedProps,Lt=Se.memoizedState,O=n.stateNode,M=O.getSnapshotBeforeUpdate(n.elementType===n.type?Ee:Wr(n.type,Ee),Lt);O.__reactInternalSnapshotBeforeUpdate=M}break;case 3:var I=n.stateNode.containerInfo;I.nodeType===1?I.textContent="":I.nodeType===9&&I.documentElement&&I.removeChild(I.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(se){Tt(n,n.return,se)}if(e=n.sibling,e!==null){e.return=n.return,we=e;break}we=n.return}return Se=Mh,Mh=!1,Se}function lo(e,n,s){var a=n.updateQueue;if(a=a!==null?a.lastEffect:null,a!==null){var c=a=a.next;do{if((c.tag&e)===e){var h=c.destroy;c.destroy=void 0,h!==void 0&&bc(n,s,h)}c=c.next}while(c!==a)}}function za(e,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var s=n=n.next;do{if((s.tag&e)===e){var a=s.create;s.destroy=a()}s=s.next}while(s!==n)}}function Oc(e){var n=e.ref;if(n!==null){var s=e.stateNode;switch(e.tag){case 5:e=s;break;default:e=s}typeof n=="function"?n(e):n.current=e}}function bh(e){var n=e.alternate;n!==null&&(e.alternate=null,bh(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&(delete n[ri],delete n[Ql],delete n[Qu],delete n[Qm],delete n[Xm])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Oh(e){return e.tag===5||e.tag===3||e.tag===4}function Lh(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Oh(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.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Lc(e,n,s){var a=e.tag;if(a===5||a===6)e=e.stateNode,n?s.nodeType===8?s.parentNode.insertBefore(e,n):s.insertBefore(e,n):(s.nodeType===8?(n=s.parentNode,n.insertBefore(e,s)):(n=s,n.appendChild(e)),s=s._reactRootContainer,s!=null||n.onclick!==null||(n.onclick=oa));else if(a!==4&&(e=e.child,e!==null))for(Lc(e,n,s),e=e.sibling;e!==null;)Lc(e,n,s),e=e.sibling}function Pc(e,n,s){var a=e.tag;if(a===5||a===6)e=e.stateNode,n?s.insertBefore(e,n):s.appendChild(e);else if(a!==4&&(e=e.child,e!==null))for(Pc(e,n,s),e=e.sibling;e!==null;)Pc(e,n,s),e=e.sibling}var _n=null,Br=!1;function Qi(e,n,s){for(s=s.child;s!==null;)Ph(e,n,s),s=s.sibling}function Ph(e,n,s){if(Qn&&typeof Qn.onCommitFiberUnmount=="function")try{Qn.onCommitFiberUnmount(Di,s)}catch{}switch(s.tag){case 5:On||fl(s,n);case 6:var a=_n,c=Br;_n=null,Qi(e,n,s),_n=a,Br=c,_n!==null&&(Br?(e=_n,s=s.stateNode,e.nodeType===8?e.parentNode.removeChild(s):e.removeChild(s)):_n.removeChild(s.stateNode));break;case 18:_n!==null&&(Br?(e=_n,s=s.stateNode,e.nodeType===8?Ku(e.parentNode,s):e.nodeType===1&&Ku(e,s),Fi(e)):Ku(_n,s.stateNode));break;case 4:a=_n,c=Br,_n=s.stateNode.containerInfo,Br=!0,Qi(e,n,s),_n=a,Br=c;break;case 0:case 11:case 14:case 15:if(!On&&(a=s.updateQueue,a!==null&&(a=a.lastEffect,a!==null))){c=a=a.next;do{var h=c,y=h.destroy;h=h.tag,y!==void 0&&((h&2)!==0||(h&4)!==0)&&bc(s,n,y),c=c.next}while(c!==a)}Qi(e,n,s);break;case 1:if(!On&&(fl(s,n),a=s.stateNode,typeof a.componentWillUnmount=="function"))try{a.props=s.memoizedProps,a.state=s.memoizedState,a.componentWillUnmount()}catch(C){Tt(s,n,C)}Qi(e,n,s);break;case 21:Qi(e,n,s);break;case 22:s.mode&1?(On=(a=On)||s.memoizedState!==null,Qi(e,n,s),On=a):Qi(e,n,s);break;default:Qi(e,n,s)}}function Ah(e){var n=e.updateQueue;if(n!==null){e.updateQueue=null;var s=e.stateNode;s===null&&(s=e.stateNode=new dv),n.forEach(function(a){var c=_v.bind(null,e,a);s.has(a)||(s.add(a),a.then(c,c))})}}function Ur(e,n){var s=n.deletions;if(s!==null)for(var a=0;ac&&(c=y),a&=~h}if(a=c,a=ot()-a,a=(120>a?120:480>a?480:1080>a?1080:1920>a?1920:3e3>a?3e3:4320>a?4320:1960*gv(a/1960))-a,10e?16:e,qi===null)var a=!1;else{if(e=qi,qi=null,Pa=0,(Ye&6)!==0)throw Error(r(331));var c=Ye;for(Ye|=4,we=e.current;we!==null;){var h=we,y=h.child;if((we.flags&16)!==0){var C=h.deletions;if(C!==null){for(var N=0;Not()-Hc?Rs(e,0):Ic|=s),rr(e,n)}function Qh(e,n){n===0&&((e.mode&1)===0?n=1:(n=Ti,Ti<<=1,(Ti&130023424)===0&&(Ti=4194304)));var s=Vn();e=wi(e,n),e!==null&&(Mi(e,n,s),rr(e,s))}function xv(e){var n=e.memoizedState,s=0;n!==null&&(s=n.retryLane),Qh(e,s)}function _v(e,n){var s=0;switch(e.tag){case 13:var a=e.stateNode,c=e.memoizedState;c!==null&&(s=c.retryLane);break;case 19:a=e.stateNode;break;default:throw Error(r(314))}a!==null&&a.delete(n),Qh(e,s)}var Xh;Xh=function(e,n,s){if(e!==null)if(e.memoizedProps!==n.pendingProps||Zn.current)tr=!0;else{if((e.lanes&s)===0&&(n.flags&128)===0)return tr=!1,uv(e,n,s);tr=(e.flags&131072)!==0}else tr=!1,St&&(n.flags&1048576)!==0&&Td(n,ha,n.index);switch(n.lanes=0,n.tag){case 2:var a=n.type;Da(e,n),e=n.pendingProps;var c=nl(n,zn.current);al(n,s),c=gc(null,n,a,e,c,s);var h=mc();return n.flags|=1,typeof c=="object"&&c!==null&&typeof c.render=="function"&&c.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,er(a)?(h=!0,ca(n)):h=!1,n.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,ac(n),c.updater=Ra,n.stateNode=c,c._reactInternals=n,_c(n,a,e,s),n=Rc(null,n,a,!0,h,s)):(n.tag=0,St&&h&&Ju(n),Un(null,n,c,s),n=n.child),n;case 16:a=n.elementType;e:{switch(Da(e,n),e=n.pendingProps,c=a._init,a=c(a._payload),n.type=a,c=n.tag=Cv(a),e=Wr(a,e),c){case 0:n=kc(null,n,a,e,s);break e;case 1:n=_h(null,n,a,e,s);break e;case 11:n=vh(null,n,a,e,s);break e;case 14:n=yh(null,n,a,Wr(a.type,e),s);break e}throw Error(r(306,a,""))}return n;case 0:return a=n.type,c=n.pendingProps,c=n.elementType===a?c:Wr(a,c),kc(e,n,a,c,s);case 1:return a=n.type,c=n.pendingProps,c=n.elementType===a?c:Wr(a,c),_h(e,n,a,c,s);case 3:e:{if(Eh(n),e===null)throw Error(r(387));a=n.pendingProps,h=n.memoizedState,c=h.element,Hd(e,n),wa(n,a,null,s);var y=n.memoizedState;if(a=y.element,h.isDehydrated)if(h={element:a,isDehydrated:!1,cache:y.cache,pendingSuspenseBoundaries:y.pendingSuspenseBoundaries,transitions:y.transitions},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){c=cl(Error(r(423)),n),n=Ch(e,n,a,s,c);break e}else if(a!==c){c=cl(Error(r(424)),n),n=Ch(e,n,a,s,c);break e}else for(mr=Ui(n.stateNode.containerInfo.firstChild),gr=n,St=!0,jr=null,s=Ad(n,null,a,s),n.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(sl(),a===c){n=xi(e,n,s);break e}Un(e,n,a,s)}n=n.child}return n;case 5:return Wd(n),e===null&&tc(n),a=n.type,c=n.pendingProps,h=e!==null?e.memoizedProps:null,y=c.children,Gu(a,c)?y=null:h!==null&&Gu(a,h)&&(n.flags|=32),xh(e,n),Un(e,n,y,s),n.child;case 6:return e===null&&tc(n),null;case 13:return kh(e,n,s);case 4:return uc(n,n.stateNode.containerInfo),a=n.pendingProps,e===null?n.child=ll(n,null,a,s):Un(e,n,a,s),n.child;case 11:return a=n.type,c=n.pendingProps,c=n.elementType===a?c:Wr(a,c),vh(e,n,a,c,s);case 7:return Un(e,n,n.pendingProps,s),n.child;case 8:return Un(e,n,n.pendingProps.children,s),n.child;case 12:return Un(e,n,n.pendingProps.children,s),n.child;case 10:e:{if(a=n.type._context,c=n.pendingProps,h=n.memoizedProps,y=c.value,dt(ma,a._currentValue),a._currentValue=y,h!==null)if(at(h.value,y)){if(h.children===c.children&&!Zn.current){n=xi(e,n,s);break e}}else for(h=n.child,h!==null&&(h.return=n);h!==null;){var C=h.dependencies;if(C!==null){y=h.child;for(var N=C.firstContext;N!==null;){if(N.context===a){if(h.tag===1){N=Si(-1,s&-s),N.tag=2;var F=h.updateQueue;if(F!==null){F=F.shared;var J=F.pending;J===null?N.next=N:(N.next=J.next,J.next=N),F.pending=N}}h.lanes|=s,N=h.alternate,N!==null&&(N.lanes|=s),lc(h.return,s,n),C.lanes|=s;break}N=N.next}}else if(h.tag===10)y=h.type===n.type?null:h.child;else if(h.tag===18){if(y=h.return,y===null)throw Error(r(341));y.lanes|=s,C=y.alternate,C!==null&&(C.lanes|=s),lc(y,s,n),y=h.sibling}else y=h.child;if(y!==null)y.return=h;else for(y=h;y!==null;){if(y===n){y=null;break}if(h=y.sibling,h!==null){h.return=y.return,y=h;break}y=y.return}h=y}Un(e,n,c.children,s),n=n.child}return n;case 9:return c=n.type,a=n.pendingProps.children,al(n,s),c=zr(c),a=a(c),n.flags|=1,Un(e,n,a,s),n.child;case 14:return a=n.type,c=Wr(a,n.pendingProps),c=Wr(a.type,c),yh(e,n,a,c,s);case 15:return wh(e,n,n.type,n.pendingProps,s);case 17:return a=n.type,c=n.pendingProps,c=n.elementType===a?c:Wr(a,c),Da(e,n),n.tag=1,er(a)?(e=!0,ca(n)):e=!1,al(n,s),ch(n,a,c),_c(n,a,c,s),Rc(null,n,a,!0,e,s);case 19:return Nh(e,n,s);case 22:return Sh(e,n,s)}throw Error(r(156,n.tag))};function qh(e,n){return Mt(e,n)}function Ev(e,n,s,a){this.tag=e,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Or(e,n,s,a){return new Ev(e,n,s,a)}function Gc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Cv(e){if(typeof e=="function")return Gc(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ce)return 11;if(e===me)return 14}return 2}function es(e,n){var s=e.alternate;return s===null?(s=Or(e.tag,n,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=n,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=e.flags&14680064,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,n=e.dependencies,s.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s}function Fa(e,n,s,a,c,h){var y=2;if(a=e,typeof e=="function")Gc(e)&&(y=1);else if(typeof e=="string")y=5;else e:switch(e){case ee:return Ds(s.children,c,h,n);case re:y=8,c|=8;break;case ve:return e=Or(12,s,n,c|2),e.elementType=ve,e.lanes=h,e;case ae:return e=Or(13,s,n,c),e.elementType=ae,e.lanes=h,e;case ye:return e=Or(19,s,n,c),e.elementType=ye,e.lanes=h,e;case le:return ja(s,c,h,n);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case de:y=10;break e;case Y:y=9;break e;case Ce:y=11;break e;case me:y=14;break e;case De:y=16,a=null;break e}throw Error(r(130,e==null?e:typeof e,""))}return n=Or(y,s,n,c),n.elementType=e,n.type=a,n.lanes=h,n}function Ds(e,n,s,a){return e=Or(7,e,a,n),e.lanes=s,e}function ja(e,n,s,a){return e=Or(22,e,a,n),e.elementType=le,e.lanes=s,e.stateNode={isHidden:!1},e}function Yc(e,n,s){return e=Or(6,e,null,n),e.lanes=s,e}function Kc(e,n,s){return n=Or(4,e.children!==null?e.children:[],e.key,n),n.lanes=s,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function kv(e,n,s,a,c){this.tag=n,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Al(0),this.expirationTimes=Al(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Al(0),this.identifierPrefix=a,this.onRecoverableError=c,this.mutableSourceEagerHydrationData=null}function Qc(e,n,s,a,c,h,y,C,N){return e=new kv(e,n,s,C,N),n===1?(n=1,h===!0&&(n|=8)):n=0,h=Or(3,null,null,n),e.current=h,h.stateNode=e,h.memoizedState={element:a,isDehydrated:s,cache:null,transitions:null,pendingSuspenseBoundaries:null},ac(h),e}function Rv(e,n,s){var a=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l)}catch(t){console.error(t)}}return l(),tf.exports=Fv(),tf.exports}var fp;function jv(){if(fp)return Ya;fp=1;var l=Rg();return Ya.createRoot=l.createRoot,Ya.hydrateRoot=l.hydrateRoot,Ya}var Wv=jv();const Bv=kg(Wv);var bs=Rg();const wu=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Nl(l){const t=Object.prototype.toString.call(l);return t==="[object Window]"||t==="[object global]"}function Ff(l){return"nodeType"in l}function Yn(l){var t,r;return l?Nl(l)?l:Ff(l)&&(t=(r=l.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function jf(l){const{Document:t}=Yn(l);return l instanceof t}function bo(l){return Nl(l)?!1:l instanceof Yn(l).HTMLElement}function Ng(l){return l instanceof Yn(l).SVGElement}function Dl(l){return l?Nl(l)?l.document:Ff(l)?jf(l)?l:bo(l)||Ng(l)?l.ownerDocument:document:document:document}const ki=wu?j.useLayoutEffect:j.useEffect;function Su(l){const t=j.useRef(l);return ki(()=>{t.current=l}),j.useCallback(function(){for(var r=arguments.length,i=new Array(r),o=0;o{l.current=setInterval(i,o)},[]),r=j.useCallback(()=>{l.current!==null&&(clearInterval(l.current),l.current=null)},[]);return[t,r]}function Ro(l,t){t===void 0&&(t=[l]);const r=j.useRef(l);return ki(()=>{r.current!==l&&(r.current=l)},t),r}function Oo(l,t){const r=j.useRef();return j.useMemo(()=>{const i=l(r.current);return r.current=i,i},[...t])}function iu(l){const t=Su(l),r=j.useRef(null),i=j.useCallback(o=>{o!==r.current&&(t==null||t(o,r.current)),r.current=o},[]);return[r,i]}function su(l){const t=j.useRef();return j.useEffect(()=>{t.current=l},[l]),t.current}let sf={};function xu(l,t){return j.useMemo(()=>{if(t)return t;const r=sf[l]==null?0:sf[l]+1;return sf[l]=r,l+"-"+r},[l,t])}function Dg(l){return function(t){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o{const d=Object.entries(f);for(const[p,m]of d){const w=u[p];w!=null&&(u[p]=w+l*m)}return u},{...t})}}const wl=Dg(1),lu=Dg(-1);function Vv(l){return"clientX"in l&&"clientY"in l}function Wf(l){if(!l)return!1;const{KeyboardEvent:t}=Yn(l.target);return t&&l instanceof t}function $v(l){if(!l)return!1;const{TouchEvent:t}=Yn(l.target);return t&&l instanceof t}function ou(l){if($v(l)){if(l.touches&&l.touches.length){const{clientX:t,clientY:r}=l.touches[0];return{x:t,y:r}}else if(l.changedTouches&&l.changedTouches.length){const{clientX:t,clientY:r}=l.changedTouches[0];return{x:t,y:r}}}return Vv(l)?{x:l.clientX,y:l.clientY}:null}const No=Object.freeze({Translate:{toString(l){if(!l)return;const{x:t,y:r}=l;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(l){if(!l)return;const{scaleX:t,scaleY:r}=l;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(l){if(l)return[No.Translate.toString(l),No.Scale.toString(l)].join(" ")}},Transition:{toString(l){let{property:t,duration:r,easing:i}=l;return t+" "+r+"ms "+i}}}),dp="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Gv(l){return l.matches(dp)?l:l.querySelector(dp)}const Yv={display:"none"};function Kv(l){let{id:t,value:r}=l;return ht.createElement("div",{id:t,style:Yv},r)}function Qv(l){let{id:t,announcement:r,ariaLiveType:i="assertive"}=l;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return ht.createElement("div",{id:t,style:o,role:"status","aria-live":i,"aria-atomic":!0},r)}function Xv(){const[l,t]=j.useState("");return{announce:j.useCallback(i=>{i!=null&&t(i)},[]),announcement:l}}const Tg=j.createContext(null);function qv(l){const t=j.useContext(Tg);j.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(l)},[l,t])}function Jv(){const[l]=j.useState(()=>new Set),t=j.useCallback(i=>(l.add(i),()=>l.delete(i)),[l]);return[j.useCallback(i=>{let{type:o,event:u}=i;l.forEach(f=>{var d;return(d=f[o])==null?void 0:d.call(f,u)})},[l]),t]}const Zv={draggable:` + To pick up a draggable item, press the space bar. + While dragging, use the arrow keys to move the item. + Press space again to drop the item in its new position, or press escape to cancel. + `},ey={onDragStart(l){let{active:t}=l;return"Picked up draggable item "+t.id+"."},onDragOver(l){let{active:t,over:r}=l;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(l){let{active:t,over:r}=l;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(l){let{active:t}=l;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function ty(l){let{announcements:t=ey,container:r,hiddenTextDescribedById:i,screenReaderInstructions:o=Zv}=l;const{announce:u,announcement:f}=Xv(),d=xu("DndLiveRegion"),[p,m]=j.useState(!1);if(j.useEffect(()=>{m(!0)},[]),qv(j.useMemo(()=>({onDragStart(v){let{active:x}=v;u(t.onDragStart({active:x}))},onDragMove(v){let{active:x,over:z}=v;t.onDragMove&&u(t.onDragMove({active:x,over:z}))},onDragOver(v){let{active:x,over:z}=v;u(t.onDragOver({active:x,over:z}))},onDragEnd(v){let{active:x,over:z}=v;u(t.onDragEnd({active:x,over:z}))},onDragCancel(v){let{active:x,over:z}=v;u(t.onDragCancel({active:x,over:z}))}}),[u,t])),!p)return null;const w=ht.createElement(ht.Fragment,null,ht.createElement(Kv,{id:i,value:o.draggable}),ht.createElement(Qv,{id:d,announcement:f}));return r?bs.createPortal(w,r):w}var en;(function(l){l.DragStart="dragStart",l.DragMove="dragMove",l.DragEnd="dragEnd",l.DragCancel="dragCancel",l.DragOver="dragOver",l.RegisterDroppable="registerDroppable",l.SetDroppableDisabled="setDroppableDisabled",l.UnregisterDroppable="unregisterDroppable"})(en||(en={}));function au(){}function ny(l,t){return j.useMemo(()=>({sensor:l,options:t??{}}),[l,t])}function ry(){for(var l=arguments.length,t=new Array(l),r=0;r[...t].filter(i=>i!=null),[...t])}const Qr=Object.freeze({x:0,y:0});function iy(l,t){const r=ou(l);if(!r)return"0 0";const i={x:(r.x-t.left)/t.width*100,y:(r.y-t.top)/t.height*100};return i.x+"% "+i.y+"%"}function sy(l,t){let{data:{value:r}}=l,{data:{value:i}}=t;return i-r}function ly(l,t){if(!l||l.length===0)return null;const[r]=l;return r[t]}function oy(l,t){const r=Math.max(t.top,l.top),i=Math.max(t.left,l.left),o=Math.min(t.left+t.width,l.left+l.width),u=Math.min(t.top+t.height,l.top+l.height),f=o-i,d=u-r;if(i{let{collisionRect:t,droppableRects:r,droppableContainers:i}=l;const o=[];for(const u of i){const{id:f}=u,d=r.get(f);if(d){const p=oy(d,t);p>0&&o.push({id:f,data:{droppableContainer:u,value:p}})}}return o.sort(sy)};function uy(l,t,r){return{...l,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function zg(l,t){return l&&t?{x:l.left-t.left,y:l.top-t.top}:Qr}function cy(l){return function(r){for(var i=arguments.length,o=new Array(i>1?i-1:0),u=1;u({...f,top:f.top+l*d.y,bottom:f.bottom+l*d.y,left:f.left+l*d.x,right:f.right+l*d.x}),{...r})}}const fy=cy(1);function Mg(l){if(l.startsWith("matrix3d(")){const t=l.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(l.startsWith("matrix(")){const t=l.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function dy(l,t,r){const i=Mg(t);if(!i)return l;const{scaleX:o,scaleY:u,x:f,y:d}=i,p=l.left-f-(1-o)*parseFloat(r),m=l.top-d-(1-u)*parseFloat(r.slice(r.indexOf(" ")+1)),w=o?l.width/o:l.width,v=u?l.height/u:l.height;return{width:w,height:v,top:m,right:p+w,bottom:m+v,left:p}}const hy={ignoreTransform:!1};function Lo(l,t){t===void 0&&(t=hy);let r=l.getBoundingClientRect();if(t.ignoreTransform){const{transform:m,transformOrigin:w}=Yn(l).getComputedStyle(l);m&&(r=dy(r,m,w))}const{top:i,left:o,width:u,height:f,bottom:d,right:p}=r;return{top:i,left:o,width:u,height:f,bottom:d,right:p}}function hp(l){return Lo(l,{ignoreTransform:!0})}function py(l){const t=l.innerWidth,r=l.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function gy(l,t){return t===void 0&&(t=Yn(l).getComputedStyle(l)),t.position==="fixed"}function my(l,t){t===void 0&&(t=Yn(l).getComputedStyle(l));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const u=t[o];return typeof u=="string"?r.test(u):!1})}function Bf(l,t){const r=[];function i(o){if(t!=null&&r.length>=t||!o)return r;if(jf(o)&&o.scrollingElement!=null&&!r.includes(o.scrollingElement))return r.push(o.scrollingElement),r;if(!bo(o)||Ng(o)||r.includes(o))return r;const u=Yn(l).getComputedStyle(o);return o!==l&&my(o,u)&&r.push(o),gy(o,u)?r:i(o.parentNode)}return l?i(l):r}function bg(l){const[t]=Bf(l,1);return t??null}function lf(l){return!wu||!l?null:Nl(l)?l:Ff(l)?jf(l)||l===Dl(l).scrollingElement?window:bo(l)?l:null:null}function Og(l){return Nl(l)?l.scrollX:l.scrollLeft}function Lg(l){return Nl(l)?l.scrollY:l.scrollTop}function Ef(l){return{x:Og(l),y:Lg(l)}}var pn;(function(l){l[l.Forward=1]="Forward",l[l.Backward=-1]="Backward"})(pn||(pn={}));function Pg(l){return!wu||!l?!1:l===document.scrollingElement}function Ag(l){const t={x:0,y:0},r=Pg(l)?{height:window.innerHeight,width:window.innerWidth}:{height:l.clientHeight,width:l.clientWidth},i={x:l.scrollWidth-r.width,y:l.scrollHeight-r.height},o=l.scrollTop<=t.y,u=l.scrollLeft<=t.x,f=l.scrollTop>=i.y,d=l.scrollLeft>=i.x;return{isTop:o,isLeft:u,isBottom:f,isRight:d,maxScroll:i,minScroll:t}}const vy={x:.2,y:.2};function yy(l,t,r,i,o){let{top:u,left:f,right:d,bottom:p}=r;i===void 0&&(i=10),o===void 0&&(o=vy);const{isTop:m,isBottom:w,isLeft:v,isRight:x}=Ag(l),z={x:0,y:0},R={x:0,y:0},k={height:t.height*o.y,width:t.width*o.x};return!m&&u<=t.top+k.height?(z.y=pn.Backward,R.y=i*Math.abs((t.top+k.height-u)/k.height)):!w&&p>=t.bottom-k.height&&(z.y=pn.Forward,R.y=i*Math.abs((t.bottom-k.height-p)/k.height)),!x&&d>=t.right-k.width?(z.x=pn.Forward,R.x=i*Math.abs((t.right-k.width-d)/k.width)):!v&&f<=t.left+k.width&&(z.x=pn.Backward,R.x=i*Math.abs((t.left+k.width-f)/k.width)),{direction:z,speed:R}}function wy(l){if(l===document.scrollingElement){const{innerWidth:u,innerHeight:f}=window;return{top:0,left:0,right:u,bottom:f,width:u,height:f}}const{top:t,left:r,right:i,bottom:o}=l.getBoundingClientRect();return{top:t,left:r,right:i,bottom:o,width:l.clientWidth,height:l.clientHeight}}function Ig(l){return l.reduce((t,r)=>wl(t,Ef(r)),Qr)}function Sy(l){return l.reduce((t,r)=>t+Og(r),0)}function xy(l){return l.reduce((t,r)=>t+Lg(r),0)}function Hg(l,t){if(t===void 0&&(t=Lo),!l)return;const{top:r,left:i,bottom:o,right:u}=t(l);bg(l)&&(o<=0||u<=0||r>=window.innerHeight||i>=window.innerWidth)&&l.scrollIntoView({block:"center",inline:"center"})}const _y=[["x",["left","right"],Sy],["y",["top","bottom"],xy]];class Uf{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const i=Bf(r),o=Ig(i);this.rect={...t},this.width=t.width,this.height=t.height;for(const[u,f,d]of _y)for(const p of f)Object.defineProperty(this,p,{get:()=>{const m=d(i),w=o[u]-m;return this.rect[p]+w},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class So{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var i;return(i=this.target)==null?void 0:i.removeEventListener(...r)})},this.target=t}add(t,r,i){var o;(o=this.target)==null||o.addEventListener(t,r,i),this.listeners.push([t,r,i])}}function Ey(l){const{EventTarget:t}=Yn(l);return l instanceof t?l:Dl(l)}function of(l,t){const r=Math.abs(l.x),i=Math.abs(l.y);return typeof t=="number"?Math.sqrt(r**2+i**2)>t:"x"in t&&"y"in t?r>t.x&&i>t.y:"x"in t?r>t.x:"y"in t?i>t.y:!1}var Pr;(function(l){l.Click="click",l.DragStart="dragstart",l.Keydown="keydown",l.ContextMenu="contextmenu",l.Resize="resize",l.SelectionChange="selectionchange",l.VisibilityChange="visibilitychange"})(Pr||(Pr={}));function pp(l){l.preventDefault()}function Cy(l){l.stopPropagation()}var ut;(function(l){l.Space="Space",l.Down="ArrowDown",l.Right="ArrowRight",l.Left="ArrowLeft",l.Up="ArrowUp",l.Esc="Escape",l.Enter="Enter",l.Tab="Tab"})(ut||(ut={}));const Fg={start:[ut.Space,ut.Enter],cancel:[ut.Esc],end:[ut.Space,ut.Enter,ut.Tab]},ky=(l,t)=>{let{currentCoordinates:r}=t;switch(l.code){case ut.Right:return{...r,x:r.x+25};case ut.Left:return{...r,x:r.x-25};case ut.Down:return{...r,y:r.y+25};case ut.Up:return{...r,y:r.y-25}}};class jg{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:r}}=t;this.props=t,this.listeners=new So(Dl(r)),this.windowListeners=new So(Yn(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Pr.Resize,this.handleCancel),this.windowListeners.add(Pr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Pr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,i=t.node.current;i&&Hg(i),r(Qr)}handleKeyDown(t){if(Wf(t)){const{active:r,context:i,options:o}=this.props,{keyboardCodes:u=Fg,coordinateGetter:f=ky,scrollBehavior:d="smooth"}=o,{code:p}=t;if(u.end.includes(p)){this.handleEnd(t);return}if(u.cancel.includes(p)){this.handleCancel(t);return}const{collisionRect:m}=i.current,w=m?{x:m.left,y:m.top}:Qr;this.referenceCoordinates||(this.referenceCoordinates=w);const v=f(t,{active:r,context:i.current,currentCoordinates:w});if(v){const x=lu(v,w),z={x:0,y:0},{scrollableAncestors:R}=i.current;for(const k of R){const b=t.code,{isTop:B,isRight:P,isLeft:W,isBottom:V,maxScroll:Z,minScroll:G}=Ag(k),ee=wy(k),re={x:Math.min(b===ut.Right?ee.right-ee.width/2:ee.right,Math.max(b===ut.Right?ee.left:ee.left+ee.width/2,v.x)),y:Math.min(b===ut.Down?ee.bottom-ee.height/2:ee.bottom,Math.max(b===ut.Down?ee.top:ee.top+ee.height/2,v.y))},ve=b===ut.Right&&!P||b===ut.Left&&!W,de=b===ut.Down&&!V||b===ut.Up&&!B;if(ve&&re.x!==v.x){const Y=k.scrollLeft+x.x,Ce=b===ut.Right&&Y<=Z.x||b===ut.Left&&Y>=G.x;if(Ce&&!x.y){k.scrollTo({left:Y,behavior:d});return}Ce?z.x=k.scrollLeft-Y:z.x=b===ut.Right?k.scrollLeft-Z.x:k.scrollLeft-G.x,z.x&&k.scrollBy({left:-z.x,behavior:d});break}else if(de&&re.y!==v.y){const Y=k.scrollTop+x.y,Ce=b===ut.Down&&Y<=Z.y||b===ut.Up&&Y>=G.y;if(Ce&&!x.x){k.scrollTo({top:Y,behavior:d});return}Ce?z.y=k.scrollTop-Y:z.y=b===ut.Down?k.scrollTop-Z.y:k.scrollTop-G.y,z.y&&k.scrollBy({top:-z.y,behavior:d});break}}this.handleMove(t,wl(lu(v,this.referenceCoordinates),z))}}}handleMove(t,r){const{onMove:i}=this.props;t.preventDefault(),i(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}jg.activators=[{eventName:"onKeyDown",handler:(l,t,r)=>{let{keyboardCodes:i=Fg,onActivation:o}=t,{active:u}=r;const{code:f}=l.nativeEvent;if(i.start.includes(f)){const d=u.activatorNode.current;return d&&l.target!==d?!1:(l.preventDefault(),o==null||o({event:l.nativeEvent}),!0)}return!1}}];function gp(l){return!!(l&&"distance"in l)}function mp(l){return!!(l&&"delay"in l)}class Vf{constructor(t,r,i){var o;i===void 0&&(i=Ey(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;const{event:u}=t,{target:f}=u;this.props=t,this.events=r,this.document=Dl(f),this.documentListeners=new So(this.document),this.listeners=new So(i),this.windowListeners=new So(Yn(f)),this.initialCoordinates=(o=ou(u))!=null?o:Qr,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:i}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Pr.Resize,this.handleCancel),this.windowListeners.add(Pr.DragStart,pp),this.windowListeners.add(Pr.VisibilityChange,this.handleCancel),this.windowListeners.add(Pr.ContextMenu,pp),this.documentListeners.add(Pr.Keydown,this.handleKeydown),r){if(i!=null&&i({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(mp(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(gp(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,r){const{active:i,onPending:o}=this.props;o(i,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(Pr.Click,Cy,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Pr.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:i,initialCoordinates:o,props:u}=this,{onMove:f,options:{activationConstraint:d}}=u;if(!o)return;const p=(r=ou(t))!=null?r:Qr,m=lu(o,p);if(!i&&d){if(gp(d)){if(d.tolerance!=null&&of(m,d.tolerance))return this.handleCancel();if(of(m,d.distance))return this.handleStart()}if(mp(d)&&of(m,d.tolerance))return this.handleCancel();this.handlePending(d,m);return}t.cancelable&&t.preventDefault(),f(p)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===ut.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Ry={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class $f extends Vf{constructor(t){const{event:r}=t,i=Dl(r.target);super(t,Ry,i)}}$f.activators=[{eventName:"onPointerDown",handler:(l,t)=>{let{nativeEvent:r}=l,{onActivation:i}=t;return!r.isPrimary||r.button!==0?!1:(i==null||i({event:r}),!0)}}];const Ny={move:{name:"mousemove"},end:{name:"mouseup"}};var Cf;(function(l){l[l.RightClick=2]="RightClick"})(Cf||(Cf={}));class Dy extends Vf{constructor(t){super(t,Ny,Dl(t.event.target))}}Dy.activators=[{eventName:"onMouseDown",handler:(l,t)=>{let{nativeEvent:r}=l,{onActivation:i}=t;return r.button===Cf.RightClick?!1:(i==null||i({event:r}),!0)}}];const af={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Ty extends Vf{constructor(t){super(t,af)}static setup(){return window.addEventListener(af.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(af.move.name,t)};function t(){}}}Ty.activators=[{eventName:"onTouchStart",handler:(l,t)=>{let{nativeEvent:r}=l,{onActivation:i}=t;const{touches:o}=r;return o.length>1?!1:(i==null||i({event:r}),!0)}}];var xo;(function(l){l[l.Pointer=0]="Pointer",l[l.DraggableRect=1]="DraggableRect"})(xo||(xo={}));var uu;(function(l){l[l.TreeOrder=0]="TreeOrder",l[l.ReversedTreeOrder=1]="ReversedTreeOrder"})(uu||(uu={}));function zy(l){let{acceleration:t,activator:r=xo.Pointer,canScroll:i,draggingRect:o,enabled:u,interval:f=5,order:d=uu.TreeOrder,pointerCoordinates:p,scrollableAncestors:m,scrollableAncestorRects:w,delta:v,threshold:x}=l;const z=by({delta:v,disabled:!u}),[R,k]=Uv(),b=j.useRef({x:0,y:0}),B=j.useRef({x:0,y:0}),P=j.useMemo(()=>{switch(r){case xo.Pointer:return p?{top:p.y,bottom:p.y,left:p.x,right:p.x}:null;case xo.DraggableRect:return o}},[r,o,p]),W=j.useRef(null),V=j.useCallback(()=>{const G=W.current;if(!G)return;const ee=b.current.x*B.current.x,re=b.current.y*B.current.y;G.scrollBy(ee,re)},[]),Z=j.useMemo(()=>d===uu.TreeOrder?[...m].reverse():m,[d,m]);j.useEffect(()=>{if(!u||!m.length||!P){k();return}for(const G of Z){if((i==null?void 0:i(G))===!1)continue;const ee=m.indexOf(G),re=w[ee];if(!re)continue;const{direction:ve,speed:de}=yy(G,re,P,t,x);for(const Y of["x","y"])z[Y][ve[Y]]||(de[Y]=0,ve[Y]=0);if(de.x>0||de.y>0){k(),W.current=G,R(V,f),b.current=de,B.current=ve;return}}b.current={x:0,y:0},B.current={x:0,y:0},k()},[t,V,i,k,u,f,JSON.stringify(P),JSON.stringify(z),R,m,Z,w,JSON.stringify(x)])}const My={x:{[pn.Backward]:!1,[pn.Forward]:!1},y:{[pn.Backward]:!1,[pn.Forward]:!1}};function by(l){let{delta:t,disabled:r}=l;const i=su(t);return Oo(o=>{if(r||!i||!o)return My;const u={x:Math.sign(t.x-i.x),y:Math.sign(t.y-i.y)};return{x:{[pn.Backward]:o.x[pn.Backward]||u.x===-1,[pn.Forward]:o.x[pn.Forward]||u.x===1},y:{[pn.Backward]:o.y[pn.Backward]||u.y===-1,[pn.Forward]:o.y[pn.Forward]||u.y===1}}},[r,t,i])}function Oy(l,t){const r=t!=null?l.get(t):void 0,i=r?r.node.current:null;return Oo(o=>{var u;return t==null?null:(u=i??o)!=null?u:null},[i,t])}function Ly(l,t){return j.useMemo(()=>l.reduce((r,i)=>{const{sensor:o}=i,u=o.activators.map(f=>({eventName:f.eventName,handler:t(f.handler,i)}));return[...r,...u]},[]),[l,t])}var Do;(function(l){l[l.Always=0]="Always",l[l.BeforeDragging=1]="BeforeDragging",l[l.WhileDragging=2]="WhileDragging"})(Do||(Do={}));var kf;(function(l){l.Optimized="optimized"})(kf||(kf={}));const vp=new Map;function Py(l,t){let{dragging:r,dependencies:i,config:o}=t;const[u,f]=j.useState(null),{frequency:d,measure:p,strategy:m}=o,w=j.useRef(l),v=b(),x=Ro(v),z=j.useCallback(function(B){B===void 0&&(B=[]),!x.current&&f(P=>P===null?B:P.concat(B.filter(W=>!P.includes(W))))},[x]),R=j.useRef(null),k=Oo(B=>{if(v&&!r)return vp;if(!B||B===vp||w.current!==l||u!=null){const P=new Map;for(let W of l){if(!W)continue;if(u&&u.length>0&&!u.includes(W.id)&&W.rect.current){P.set(W.id,W.rect.current);continue}const V=W.node.current,Z=V?new Uf(p(V),V):null;W.rect.current=Z,Z&&P.set(W.id,Z)}return P}return B},[l,u,r,v,p]);return j.useEffect(()=>{w.current=l},[l]),j.useEffect(()=>{v||z()},[r,v]),j.useEffect(()=>{u&&u.length>0&&f(null)},[JSON.stringify(u)]),j.useEffect(()=>{v||typeof d!="number"||R.current!==null||(R.current=setTimeout(()=>{z(),R.current=null},d))},[d,v,z,...i]),{droppableRects:k,measureDroppableContainers:z,measuringScheduled:u!=null};function b(){switch(m){case Do.Always:return!1;case Do.BeforeDragging:return r;default:return!r}}}function Gf(l,t){return Oo(r=>l?r||(typeof t=="function"?t(l):l):null,[t,l])}function Ay(l,t){return Gf(l,t)}function Iy(l){let{callback:t,disabled:r}=l;const i=Su(t),o=j.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:u}=window;return new u(i)},[i,r]);return j.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function _u(l){let{callback:t,disabled:r}=l;const i=Su(t),o=j.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:u}=window;return new u(i)},[r]);return j.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function Hy(l){return new Uf(Lo(l),l)}function yp(l,t,r){t===void 0&&(t=Hy);const[i,o]=j.useState(null);function u(){o(p=>{if(!l)return null;if(l.isConnected===!1){var m;return(m=p??r)!=null?m:null}const w=t(l);return JSON.stringify(p)===JSON.stringify(w)?p:w})}const f=Iy({callback(p){if(l)for(const m of p){const{type:w,target:v}=m;if(w==="childList"&&v instanceof HTMLElement&&v.contains(l)){u();break}}}}),d=_u({callback:u});return ki(()=>{u(),l?(d==null||d.observe(l),f==null||f.observe(document.body,{childList:!0,subtree:!0})):(d==null||d.disconnect(),f==null||f.disconnect())},[l]),i}function Fy(l){const t=Gf(l);return zg(l,t)}const wp=[];function jy(l){const t=j.useRef(l),r=Oo(i=>l?i&&i!==wp&&l&&t.current&&l.parentNode===t.current.parentNode?i:Bf(l):wp,[l]);return j.useEffect(()=>{t.current=l},[l]),r}function Wy(l){const[t,r]=j.useState(null),i=j.useRef(l),o=j.useCallback(u=>{const f=lf(u.target);f&&r(d=>d?(d.set(f,Ef(f)),new Map(d)):null)},[]);return j.useEffect(()=>{const u=i.current;if(l!==u){f(u);const d=l.map(p=>{const m=lf(p);return m?(m.addEventListener("scroll",o,{passive:!0}),[m,Ef(m)]):null}).filter(p=>p!=null);r(d.length?new Map(d):null),i.current=l}return()=>{f(l),f(u)};function f(d){d.forEach(p=>{const m=lf(p);m==null||m.removeEventListener("scroll",o)})}},[o,l]),j.useMemo(()=>l.length?t?Array.from(t.values()).reduce((u,f)=>wl(u,f),Qr):Ig(l):Qr,[l,t])}function Sp(l,t){t===void 0&&(t=[]);const r=j.useRef(null);return j.useEffect(()=>{r.current=null},t),j.useEffect(()=>{const i=l!==Qr;i&&!r.current&&(r.current=l),!i&&r.current&&(r.current=null)},[l]),r.current?lu(l,r.current):Qr}function By(l){j.useEffect(()=>{if(!wu)return;const t=l.map(r=>{let{sensor:i}=r;return i.setup==null?void 0:i.setup()});return()=>{for(const r of t)r==null||r()}},l.map(t=>{let{sensor:r}=t;return r}))}function Uy(l,t){return j.useMemo(()=>l.reduce((r,i)=>{let{eventName:o,handler:u}=i;return r[o]=f=>{u(f,t)},r},{}),[l,t])}function Wg(l){return j.useMemo(()=>l?py(l):null,[l])}const xp=[];function Vy(l,t){t===void 0&&(t=Lo);const[r]=l,i=Wg(r?Yn(r):null),[o,u]=j.useState(xp);function f(){u(()=>l.length?l.map(p=>Pg(p)?i:new Uf(t(p),p)):xp)}const d=_u({callback:f});return ki(()=>{d==null||d.disconnect(),f(),l.forEach(p=>d==null?void 0:d.observe(p))},[l]),o}function Bg(l){if(!l)return null;if(l.children.length>1)return l;const t=l.children[0];return bo(t)?t:l}function $y(l){let{measure:t}=l;const[r,i]=j.useState(null),o=j.useCallback(m=>{for(const{target:w}of m)if(bo(w)){i(v=>{const x=t(w);return v?{...v,width:x.width,height:x.height}:x});break}},[t]),u=_u({callback:o}),f=j.useCallback(m=>{const w=Bg(m);u==null||u.disconnect(),w&&(u==null||u.observe(w)),i(w?t(w):null)},[t,u]),[d,p]=iu(f);return j.useMemo(()=>({nodeRef:d,rect:r,setRef:p}),[r,d,p])}const Gy=[{sensor:$f,options:{}},{sensor:jg,options:{}}],Yy={current:{}},qa={draggable:{measure:hp},droppable:{measure:hp,strategy:Do.WhileDragging,frequency:kf.Optimized},dragOverlay:{measure:Lo}};class _o extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,i;return(r=(i=this.get(t))==null?void 0:i.node.current)!=null?r:void 0}}const Ky={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new _o,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:au},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:qa,measureDroppableContainers:au,windowRect:null,measuringScheduled:!1},Ug={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:au,draggableNodes:new Map,over:null,measureDroppableContainers:au},Po=j.createContext(Ug),Vg=j.createContext(Ky);function Qy(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new _o}}}function Xy(l,t){switch(t.type){case en.DragStart:return{...l,draggable:{...l.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case en.DragMove:return l.draggable.active==null?l:{...l,draggable:{...l.draggable,translate:{x:t.coordinates.x-l.draggable.initialCoordinates.x,y:t.coordinates.y-l.draggable.initialCoordinates.y}}};case en.DragEnd:case en.DragCancel:return{...l,draggable:{...l.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case en.RegisterDroppable:{const{element:r}=t,{id:i}=r,o=new _o(l.droppable.containers);return o.set(i,r),{...l,droppable:{...l.droppable,containers:o}}}case en.SetDroppableDisabled:{const{id:r,key:i,disabled:o}=t,u=l.droppable.containers.get(r);if(!u||i!==u.key)return l;const f=new _o(l.droppable.containers);return f.set(r,{...u,disabled:o}),{...l,droppable:{...l.droppable,containers:f}}}case en.UnregisterDroppable:{const{id:r,key:i}=t,o=l.droppable.containers.get(r);if(!o||i!==o.key)return l;const u=new _o(l.droppable.containers);return u.delete(r),{...l,droppable:{...l.droppable,containers:u}}}default:return l}}function qy(l){let{disabled:t}=l;const{active:r,activatorEvent:i,draggableNodes:o}=j.useContext(Po),u=su(i),f=su(r==null?void 0:r.id);return j.useEffect(()=>{if(!t&&!i&&u&&f!=null){if(!Wf(u)||document.activeElement===u.target)return;const d=o.get(f);if(!d)return;const{activatorNode:p,node:m}=d;if(!p.current&&!m.current)return;requestAnimationFrame(()=>{for(const w of[p.current,m.current]){if(!w)continue;const v=Gv(w);if(v){v.focus();break}}})}},[i,t,o,f,u]),null}function $g(l,t){let{transform:r,...i}=t;return l!=null&&l.length?l.reduce((o,u)=>u({transform:o,...i}),r):r}function Jy(l){return j.useMemo(()=>({draggable:{...qa.draggable,...l==null?void 0:l.draggable},droppable:{...qa.droppable,...l==null?void 0:l.droppable},dragOverlay:{...qa.dragOverlay,...l==null?void 0:l.dragOverlay}}),[l==null?void 0:l.draggable,l==null?void 0:l.droppable,l==null?void 0:l.dragOverlay])}function Zy(l){let{activeNode:t,measure:r,initialRect:i,config:o=!0}=l;const u=j.useRef(!1),{x:f,y:d}=typeof o=="boolean"?{x:o,y:o}:o;ki(()=>{if(!f&&!d||!t){u.current=!1;return}if(u.current||!i)return;const m=t==null?void 0:t.node.current;if(!m||m.isConnected===!1)return;const w=r(m),v=zg(w,i);if(f||(v.x=0),d||(v.y=0),u.current=!0,Math.abs(v.x)>0||Math.abs(v.y)>0){const x=bg(m);x&&x.scrollBy({top:v.y,left:v.x})}},[t,f,d,i,r])}const Eu=j.createContext({...Qr,scaleX:1,scaleY:1});var ns;(function(l){l[l.Uninitialized=0]="Uninitialized",l[l.Initializing=1]="Initializing",l[l.Initialized=2]="Initialized"})(ns||(ns={}));const e0=j.memo(function(t){var r,i,o,u;let{id:f,accessibility:d,autoScroll:p=!0,children:m,sensors:w=Gy,collisionDetection:v=ay,measuring:x,modifiers:z,...R}=t;const k=j.useReducer(Xy,void 0,Qy),[b,B]=k,[P,W]=Jv(),[V,Z]=j.useState(ns.Uninitialized),G=V===ns.Initialized,{draggable:{active:ee,nodes:re,translate:ve},droppable:{containers:de}}=b,Y=ee!=null?re.get(ee):null,Ce=j.useRef({initial:null,translated:null}),ae=j.useMemo(()=>{var lt;return ee!=null?{id:ee,data:(lt=Y==null?void 0:Y.data)!=null?lt:Yy,rect:Ce}:null},[ee,Y]),ye=j.useRef(null),[me,De]=j.useState(null),[le,ie]=j.useState(null),oe=Ro(R,Object.values(R)),X=xu("DndDescribedBy",f),D=j.useMemo(()=>de.getEnabled(),[de]),H=Jy(x),{droppableRects:K,measureDroppableContainers:xe,measuringScheduled:be}=Py(D,{dragging:G,dependencies:[ve.x,ve.y],config:H.droppable}),ge=Oy(re,ee),_e=j.useMemo(()=>le?ou(le):null,[le]),He=zt(),Fe=Ay(ge,H.draggable.measure);Zy({activeNode:ee!=null?re.get(ee):null,config:He.layoutShiftCompensation,initialRect:Fe,measure:H.draggable.measure});const Oe=yp(ge,H.draggable.measure,Fe),$t=yp(ge?ge.parentElement:null),Pt=j.useRef({activatorEvent:null,active:null,activeNode:ge,collisionRect:null,collisions:null,droppableRects:K,draggableNodes:re,draggingNode:null,draggingNodeRect:null,droppableContainers:de,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),At=de.getNodeFor((r=Pt.current.over)==null?void 0:r.id),It=$y({measure:H.dragOverlay.measure}),Kn=(i=It.nodeRef.current)!=null?i:ge,Cn=G?(o=It.rect)!=null?o:Oe:null,_r=!!(It.nodeRef.current&&It.rect),Xr=Fy(_r?null:Oe),Pn=Wg(Kn?Yn(Kn):null),Ze=jy(G?At??ge:null),nn=Vy(Ze),rn=$g(z,{transform:{x:ve.x-Xr.x,y:ve.y-Xr.y,scaleX:1,scaleY:1},activatorEvent:le,active:ae,activeNodeRect:Oe,containerNodeRect:$t,draggingNodeRect:Cn,over:Pt.current.over,overlayNodeRect:It.rect,scrollableAncestors:Ze,scrollableAncestorRects:nn,windowRect:Pn}),sr=_e?wl(_e,ve):null,Pe=Wy(Ze),ce=Sp(Pe),qe=Sp(Pe,[Oe]),et=wl(rn,ce),sn=Cn?fy(Cn,rn):null,kn=ae&&sn?v({active:ae,collisionRect:sn,droppableRects:K,droppableContainers:D,pointerCoordinates:sr}):null,Gt=ly(kn,"id"),[Rt,ln]=j.useState(null),mn=_r?rn:wl(rn,qe),Yt=uy(mn,(u=Rt==null?void 0:Rt.rect)!=null?u:null,Oe),vn=j.useRef(null),qr=j.useCallback((lt,Kt)=>{let{sensor:on,options:ar}=Kt;if(ye.current==null)return;const yn=re.get(ye.current);if(!yn)return;const an=lt.nativeEvent,Rn=new on({active:ye.current,activeNode:yn,event:an,options:ar,context:Pt,onAbort(We){if(!re.get(We))return;const{onDragAbort:_t}=oe.current,un={id:We};_t==null||_t(un),P({type:"onDragAbort",event:un})},onPending(We,xt,_t,un){if(!re.get(We))return;const{onDragPending:Sn}=oe.current,Ht={id:We,constraint:xt,initialCoordinates:_t,offset:un};Sn==null||Sn(Ht),P({type:"onDragPending",event:Ht})},onStart(We){const xt=ye.current;if(xt==null)return;const _t=re.get(xt);if(!_t)return;const{onDragStart:un}=oe.current,vt={activatorEvent:an,active:{id:xt,data:_t.data,rect:Ce}};bs.unstable_batchedUpdates(()=>{un==null||un(vt),Z(ns.Initializing),B({type:en.DragStart,initialCoordinates:We,active:xt}),P({type:"onDragStart",event:vt}),De(vn.current),ie(an)})},onMove(We){B({type:en.DragMove,coordinates:We})},onEnd:wn(en.DragEnd),onCancel:wn(en.DragCancel)});vn.current=Rn;function wn(We){return async function(){const{active:_t,collisions:un,over:vt,scrollAdjustedTranslate:Sn}=Pt.current;let Ht=null;if(_t&&Sn){const{cancelDrop:Er}=oe.current;Ht={activatorEvent:an,active:_t,collisions:un,delta:Sn,over:vt},We===en.DragEnd&&typeof Er=="function"&&await Promise.resolve(Er(Ht))&&(We=en.DragCancel)}ye.current=null,bs.unstable_batchedUpdates(()=>{B({type:We}),Z(ns.Uninitialized),ln(null),De(null),ie(null),vn.current=null;const Er=We===en.DragEnd?"onDragEnd":"onDragCancel";if(Ht){const Ri=oe.current[Er];Ri==null||Ri(Ht),P({type:Er,event:Ht})}})}}},[re]),Jr=j.useCallback((lt,Kt)=>(on,ar)=>{const yn=on.nativeEvent,an=re.get(ar);if(ye.current!==null||!an||yn.dndKit||yn.defaultPrevented)return;const Rn={active:an};lt(on,Kt.options,Rn)===!0&&(yn.dndKit={capturedBy:Kt.sensor},ye.current=ar,qr(on,Kt))},[re,qr]),lr=Ly(w,Jr);By(w),ki(()=>{Oe&&V===ns.Initializing&&Z(ns.Initialized)},[Oe,V]),j.useEffect(()=>{const{onDragMove:lt}=oe.current,{active:Kt,activatorEvent:on,collisions:ar,over:yn}=Pt.current;if(!Kt||!on)return;const an={active:Kt,activatorEvent:on,collisions:ar,delta:{x:et.x,y:et.y},over:yn};bs.unstable_batchedUpdates(()=>{lt==null||lt(an),P({type:"onDragMove",event:an})})},[et.x,et.y]),j.useEffect(()=>{const{active:lt,activatorEvent:Kt,collisions:on,droppableContainers:ar,scrollAdjustedTranslate:yn}=Pt.current;if(!lt||ye.current==null||!Kt||!yn)return;const{onDragOver:an}=oe.current,Rn=ar.get(Gt),wn=Rn&&Rn.rect.current?{id:Rn.id,rect:Rn.rect.current,data:Rn.data,disabled:Rn.disabled}:null,We={active:lt,activatorEvent:Kt,collisions:on,delta:{x:yn.x,y:yn.y},over:wn};bs.unstable_batchedUpdates(()=>{ln(wn),an==null||an(We),P({type:"onDragOver",event:We})})},[Gt]),ki(()=>{Pt.current={activatorEvent:le,active:ae,activeNode:ge,collisionRect:sn,collisions:kn,droppableRects:K,draggableNodes:re,draggingNode:Kn,draggingNodeRect:Cn,droppableContainers:de,over:Rt,scrollableAncestors:Ze,scrollAdjustedTranslate:et},Ce.current={initial:Cn,translated:sn}},[ae,ge,kn,sn,re,Kn,Cn,K,de,Rt,Ze,et]),zy({...He,delta:ve,draggingRect:sn,pointerCoordinates:sr,scrollableAncestors:Ze,scrollableAncestorRects:nn});const or=j.useMemo(()=>({active:ae,activeNode:ge,activeNodeRect:Oe,activatorEvent:le,collisions:kn,containerNodeRect:$t,dragOverlay:It,draggableNodes:re,droppableContainers:de,droppableRects:K,over:Rt,measureDroppableContainers:xe,scrollableAncestors:Ze,scrollableAncestorRects:nn,measuringConfiguration:H,measuringScheduled:be,windowRect:Pn}),[ae,ge,Oe,le,kn,$t,It,re,de,K,Rt,xe,Ze,nn,H,be,Pn]),Zr=j.useMemo(()=>({activatorEvent:le,activators:lr,active:ae,activeNodeRect:Oe,ariaDescribedById:{draggable:X},dispatch:B,draggableNodes:re,over:Rt,measureDroppableContainers:xe}),[le,lr,ae,Oe,B,X,re,Rt,xe]);return ht.createElement(Tg.Provider,{value:W},ht.createElement(Po.Provider,{value:Zr},ht.createElement(Vg.Provider,{value:or},ht.createElement(Eu.Provider,{value:Yt},m)),ht.createElement(qy,{disabled:(d==null?void 0:d.restoreFocus)===!1})),ht.createElement(ty,{...d,hiddenTextDescribedById:X}));function zt(){const lt=(me==null?void 0:me.autoScrollEnabled)===!1,Kt=typeof p=="object"?p.enabled===!1:p===!1,on=G&&!lt&&!Kt;return typeof p=="object"?{...p,enabled:on}:{enabled:on}}}),t0=j.createContext(null),_p="button",n0="Draggable";function r0(l){let{id:t,data:r,disabled:i=!1,attributes:o}=l;const u=xu(n0),{activators:f,activatorEvent:d,active:p,activeNodeRect:m,ariaDescribedById:w,draggableNodes:v,over:x}=j.useContext(Po),{role:z=_p,roleDescription:R="draggable",tabIndex:k=0}=o??{},b=(p==null?void 0:p.id)===t,B=j.useContext(b?Eu:t0),[P,W]=iu(),[V,Z]=iu(),G=Uy(f,t),ee=Ro(r);ki(()=>(v.set(t,{id:t,key:u,node:P,activatorNode:V,data:ee}),()=>{const ve=v.get(t);ve&&ve.key===u&&v.delete(t)}),[v,t]);const re=j.useMemo(()=>({role:z,tabIndex:k,"aria-disabled":i,"aria-pressed":b&&z===_p?!0:void 0,"aria-roledescription":R,"aria-describedby":w.draggable}),[i,z,k,b,R,w.draggable]);return{active:p,activatorEvent:d,activeNodeRect:m,attributes:re,isDragging:b,listeners:i?void 0:G,node:P,over:x,setNodeRef:W,setActivatorNodeRef:Z,transform:B}}function i0(){return j.useContext(Vg)}const s0="Droppable",l0={timeout:25};function o0(l){let{data:t,disabled:r=!1,id:i,resizeObserverConfig:o}=l;const u=xu(s0),{active:f,dispatch:d,over:p,measureDroppableContainers:m}=j.useContext(Po),w=j.useRef({disabled:r}),v=j.useRef(!1),x=j.useRef(null),z=j.useRef(null),{disabled:R,updateMeasurementsFor:k,timeout:b}={...l0,...o},B=Ro(k??i),P=j.useCallback(()=>{if(!v.current){v.current=!0;return}z.current!=null&&clearTimeout(z.current),z.current=setTimeout(()=>{m(Array.isArray(B.current)?B.current:[B.current]),z.current=null},b)},[b]),W=_u({callback:P,disabled:R||!f}),V=j.useCallback((re,ve)=>{W&&(ve&&(W.unobserve(ve),v.current=!1),re&&W.observe(re))},[W]),[Z,G]=iu(V),ee=Ro(t);return j.useEffect(()=>{!W||!Z.current||(W.disconnect(),v.current=!1,W.observe(Z.current))},[Z,W]),j.useEffect(()=>(d({type:en.RegisterDroppable,element:{id:i,key:u,disabled:r,node:Z,rect:x,data:ee}}),()=>d({type:en.UnregisterDroppable,key:u,id:i})),[i]),j.useEffect(()=>{r!==w.current.disabled&&(d({type:en.SetDroppableDisabled,id:i,key:u,disabled:r}),w.current.disabled=r)},[i,u,r,d]),{active:f,rect:x,isOver:(p==null?void 0:p.id)===i,node:Z,over:p,setNodeRef:G}}function a0(l){let{animation:t,children:r}=l;const[i,o]=j.useState(null),[u,f]=j.useState(null),d=su(r);return!r&&!i&&d&&o(d),ki(()=>{if(!u)return;const p=i==null?void 0:i.key,m=i==null?void 0:i.props.id;if(p==null||m==null){o(null);return}Promise.resolve(t(m,u)).then(()=>{o(null)})},[t,i,u]),ht.createElement(ht.Fragment,null,r,i?j.cloneElement(i,{ref:f}):null)}const u0={x:0,y:0,scaleX:1,scaleY:1};function c0(l){let{children:t}=l;return ht.createElement(Po.Provider,{value:Ug},ht.createElement(Eu.Provider,{value:u0},t))}const f0={position:"fixed",touchAction:"none"},d0=l=>Wf(l)?"transform 250ms ease":void 0,h0=j.forwardRef((l,t)=>{let{as:r,activatorEvent:i,adjustScale:o,children:u,className:f,rect:d,style:p,transform:m,transition:w=d0}=l;if(!d)return null;const v=o?m:{...m,scaleX:1,scaleY:1},x={...f0,width:d.width,height:d.height,top:d.top,left:d.left,transform:No.Transform.toString(v),transformOrigin:o&&i?iy(i,d):void 0,transition:typeof w=="function"?w(i):w,...p};return ht.createElement(r,{className:f,style:x,ref:t},u)}),p0=l=>t=>{let{active:r,dragOverlay:i}=t;const o={},{styles:u,className:f}=l;if(u!=null&&u.active)for(const[d,p]of Object.entries(u.active))p!==void 0&&(o[d]=r.node.style.getPropertyValue(d),r.node.style.setProperty(d,p));if(u!=null&&u.dragOverlay)for(const[d,p]of Object.entries(u.dragOverlay))p!==void 0&&i.node.style.setProperty(d,p);return f!=null&&f.active&&r.node.classList.add(f.active),f!=null&&f.dragOverlay&&i.node.classList.add(f.dragOverlay),function(){for(const[p,m]of Object.entries(o))r.node.style.setProperty(p,m);f!=null&&f.active&&r.node.classList.remove(f.active)}},g0=l=>{let{transform:{initial:t,final:r}}=l;return[{transform:No.Transform.toString(t)},{transform:No.Transform.toString(r)}]},m0={duration:250,easing:"ease",keyframes:g0,sideEffects:p0({styles:{active:{opacity:"0"}}})};function v0(l){let{config:t,draggableNodes:r,droppableContainers:i,measuringConfiguration:o}=l;return Su((u,f)=>{if(t===null)return;const d=r.get(u);if(!d)return;const p=d.node.current;if(!p)return;const m=Bg(f);if(!m)return;const{transform:w}=Yn(f).getComputedStyle(f),v=Mg(w);if(!v)return;const x=typeof t=="function"?t:y0(t);return Hg(p,o.draggable.measure),x({active:{id:u,data:d.data,node:p,rect:o.draggable.measure(p)},draggableNodes:r,dragOverlay:{node:f,rect:o.dragOverlay.measure(m)},droppableContainers:i,measuringConfiguration:o,transform:v})})}function y0(l){const{duration:t,easing:r,sideEffects:i,keyframes:o}={...m0,...l};return u=>{let{active:f,dragOverlay:d,transform:p,...m}=u;if(!t)return;const w={x:d.rect.left-f.rect.left,y:d.rect.top-f.rect.top},v={scaleX:p.scaleX!==1?f.rect.width*p.scaleX/d.rect.width:1,scaleY:p.scaleY!==1?f.rect.height*p.scaleY/d.rect.height:1},x={x:p.x-w.x,y:p.y-w.y,...v},z=o({...m,active:f,dragOverlay:d,transform:{initial:p,final:x}}),[R]=z,k=z[z.length-1];if(JSON.stringify(R)===JSON.stringify(k))return;const b=i==null?void 0:i({active:f,dragOverlay:d,...m}),B=d.node.animate(z,{duration:t,easing:r,fill:"forwards"});return new Promise(P=>{B.onfinish=()=>{b==null||b(),P()}})}}let Ep=0;function w0(l){return j.useMemo(()=>{if(l!=null)return Ep++,Ep},[l])}const S0=ht.memo(l=>{let{adjustScale:t=!1,children:r,dropAnimation:i,style:o,transition:u,modifiers:f,wrapperElement:d="div",className:p,zIndex:m=999}=l;const{activatorEvent:w,active:v,activeNodeRect:x,containerNodeRect:z,draggableNodes:R,droppableContainers:k,dragOverlay:b,over:B,measuringConfiguration:P,scrollableAncestors:W,scrollableAncestorRects:V,windowRect:Z}=i0(),G=j.useContext(Eu),ee=w0(v==null?void 0:v.id),re=$g(f,{activatorEvent:w,active:v,activeNodeRect:x,containerNodeRect:z,draggingNodeRect:b.rect,over:B,overlayNodeRect:b.rect,scrollableAncestors:W,scrollableAncestorRects:V,transform:G,windowRect:Z}),ve=Gf(x),de=v0({config:i,draggableNodes:R,droppableContainers:k,measuringConfiguration:P}),Y=ve?b.setRef:void 0;return ht.createElement(c0,null,ht.createElement(a0,{animation:de},v&&ee?ht.createElement(h0,{key:ee,id:v.id,ref:Y,as:d,activatorEvent:w,adjustScale:t,className:p,transition:u,rect:ve,style:{zIndex:m,...o},transform:re},r):null))}),Cp=l=>{let t;const r=new Set,i=(m,w)=>{const v=typeof m=="function"?m(t):m;if(!Object.is(v,t)){const x=t;t=w??(typeof v!="object"||v===null)?v:Object.assign({},t,v),r.forEach(z=>z(t,x))}},o=()=>t,d={setState:i,getState:o,getInitialState:()=>p,subscribe:m=>(r.add(m),()=>r.delete(m))},p=t=l(i,o,d);return d},x0=(l=>l?Cp(l):Cp),_0=l=>l;function E0(l,t=_0){const r=ht.useSyncExternalStore(l.subscribe,ht.useCallback(()=>t(l.getState()),[l,t]),ht.useCallback(()=>t(l.getInitialState()),[l,t]));return ht.useDebugValue(r),r}const kp=l=>{const t=x0(l),r=i=>E0(t,i);return Object.assign(r,t),r},Gg=(l=>l?kp(l):kp),Yg="damiao.monitor.plotConfigs";function C0(){try{return JSON.parse(localStorage.getItem(Yg)||"{}")}catch{return{}}}function k0(l){try{localStorage.setItem(Yg,JSON.stringify(l))}catch{}}const gn=Gg((l,t)=>({connected:!1,status:null,signals:[],pairs:[],motors:[],motorTypes:[],plotConfigs:C0(),setConnected:r=>l({connected:r}),setStatus:r=>l({status:r}),setMeta:(r,i)=>l({signals:r,pairs:i}),setMotors:r=>l({motors:r}),setMotorTypes:r=>l({motorTypes:r}),ensurePlot:r=>l(i=>i.plotConfigs[r]?i:{plotConfigs:{...i.plotConfigs,[r]:{signals:[],duration:10}}}),setPlotConfig:(r,i)=>l(o=>({plotConfigs:{...o.plotConfigs,[r]:{...o.plotConfigs[r]||{signals:[],duration:10},...i}}})),addSignalToPlot:(r,i)=>l(o=>{const u=o.plotConfigs[r]||{signals:[],duration:10};return u.signals.includes(i)?o:{plotConfigs:{...o.plotConfigs,[r]:{...u,signals:[...u.signals,i]}}}}),removeSignalFromPlot:(r,i)=>l(o=>{const u=o.plotConfigs[r];return u?{plotConfigs:{...o.plotConfigs,[r]:{...u,signals:u.signals.filter(f=>f!==i)}}}:o}),dropPlot:r=>l(i=>{const o={...i.plotConfigs};return delete o[r],{plotConfigs:o}})}));gn.subscribe(l=>k0(l.plotConfigs));const Yf="damiao.monitor.widgets.v2";function R0(){try{const l=localStorage.getItem(Yf);if(!l)return null;const t=JSON.parse(l);return Array.isArray(t)&&t.length?t:null}catch{return null}}function uf(l){try{localStorage.setItem(Yf,JSON.stringify(l))}catch{}}const Rp=[{id:"plot-1",kind:"plot",x:0,y:0,w:7,h:6},{id:"cards-1",kind:"cards",x:7,y:0,w:5,h:6},{id:"table-1",kind:"table",x:0,y:6,w:7,h:5},{id:"rawlog-1",kind:"rawlog",x:7,y:6,w:5,h:5}];let Np=1;const Eo=Gg((l,t)=>({widgets:R0()||Rp,addWidget:r=>{Np+=1;const i=`${r}-${Date.now().toString(36)}-${Np}`,o=t().widgets.reduce((d,p)=>Math.max(d,p.y+p.h),0),u={id:i,kind:r,x:0,y:o,w:6,h:5},f=[...t().widgets,u];return uf(f),l({widgets:f}),i},removeWidget:r=>{const i=t().widgets.filter(o=>o.id!==r);uf(i),l({widgets:i})},updateGeom:r=>{const i=new Map(r.map(u=>[u.id,u])),o=t().widgets.map(u=>{const f=i.get(u.id);return f?{...u,x:f.x,y:f.y,w:f.w,h:f.h}:u});uf(o),l({widgets:o})},resetWidgets:()=>{try{localStorage.removeItem(Yf),localStorage.removeItem("damiao.monitor.plotConfigs")}catch{}l({widgets:Rp.map(r=>({...r}))})}})),N0=!0,tn="u-",D0="uplot",T0=tn+"hz",z0=tn+"vt",M0=tn+"title",b0=tn+"wrap",O0=tn+"under",L0=tn+"over",P0=tn+"axis",Ms=tn+"off",A0=tn+"select",I0=tn+"cursor-x",H0=tn+"cursor-y",F0=tn+"cursor-pt",j0=tn+"legend",W0=tn+"live",B0=tn+"inline",U0=tn+"series",V0=tn+"marker",Dp=tn+"label",$0=tn+"value",vo="width",yo="height",po="top",Tp="bottom",gl="left",cf="right",Kf="#000",zp=Kf+"0",ff="mousemove",Mp="mousedown",df="mouseup",bp="mouseenter",Op="mouseleave",Lp="dblclick",G0="resize",Y0="scroll",Pp="change",cu="dppxchange",Qf="--",Tl=typeof window<"u",Rf=Tl?document:null,Sl=Tl?window:null,K0=Tl?navigator:null;let Je,Ka;function Nf(){let l=devicePixelRatio;Je!=l&&(Je=l,Ka&&Tf(Pp,Ka,Nf),Ka=matchMedia(`(min-resolution: ${Je-.001}dppx) and (max-resolution: ${Je+.001}dppx)`),Os(Pp,Ka,Nf),Sl.dispatchEvent(new CustomEvent(cu)))}function wr(l,t){if(t!=null){let r=l.classList;!r.contains(t)&&r.add(t)}}function Df(l,t){let r=l.classList;r.contains(t)&&r.remove(t)}function mt(l,t,r){l.style[t]=r+"px"}function $r(l,t,r,i){let o=Rf.createElement(l);return t!=null&&wr(o,t),r!=null&&r.insertBefore(o,i),o}function Lr(l,t){return $r("div",l,t)}const Ap=new WeakMap;function oi(l,t,r,i,o){let u="translate("+t+"px,"+r+"px)",f=Ap.get(l);u!=f&&(l.style.transform=u,Ap.set(l,u),t<0||r<0||t>i||r>o?wr(l,Ms):Df(l,Ms))}const Ip=new WeakMap;function Hp(l,t,r){let i=t+r,o=Ip.get(l);i!=o&&(Ip.set(l,i),l.style.background=t,l.style.borderColor=r)}const Fp=new WeakMap;function jp(l,t,r,i){let o=t+""+r,u=Fp.get(l);o!=u&&(Fp.set(l,o),l.style.height=r+"px",l.style.width=t+"px",l.style.marginLeft=i?-t/2+"px":0,l.style.marginTop=i?-r/2+"px":0)}const Xf={passive:!0},Q0={...Xf,capture:!0};function Os(l,t,r,i){t.addEventListener(l,r,i?Q0:Xf)}function Tf(l,t,r,i){t.removeEventListener(l,r,Xf)}Tl&&Nf();function Gr(l,t,r,i){let o;r=r||0,i=i||t.length-1;let u=i<=2147483647;for(;i-r>1;)o=u?r+i>>1:Sr((r+i)/2),t[o]{let u=-1,f=-1;for(let d=i;d<=o;d++)if(l(r[d])){u=d;break}for(let d=o;d>=i;d--)if(l(r[d])){f=d;break}return[u,f]}}const Qg=l=>l!=null,Xg=l=>l!=null&&l>0,Cu=Kg(Qg),X0=Kg(Xg);function q0(l,t,r,i=0,o=!1){let u=o?X0:Cu,f=o?Xg:Qg;[t,r]=u(l,t,r);let d=l[t],p=l[t];if(t>-1)if(i==1)d=l[t],p=l[r];else if(i==-1)d=l[r],p=l[t];else for(let m=t;m<=r;m++){let w=l[m];f(w)&&(wp&&(p=w))}return[d??ct,p??-ct]}function ku(l,t,r,i){let o=Up(l),u=Up(t);l==t&&(o==-1?(l*=r,t/=r):(l/=r,t*=r));let f=r==10?Ei:qg,d=o==1?Sr:Ar,p=u==1?Ar:Sr,m=d(f(Zt(l))),w=p(f(Zt(t))),v=_l(r,m),x=_l(r,w);return r==10&&(m<0&&(v=ft(v,-m)),w<0&&(x=ft(x,-w))),i||r==2?(l=v*o,t=x*u):(l=tm(l,v),t=Ru(t,x)),[l,t]}function qf(l,t,r,i){let o=ku(l,t,r,i);return l==0&&(o[0]=0),t==0&&(o[1]=0),o}const Jf=.1,Wp={mode:3,pad:Jf},Co={pad:0,soft:null,mode:0},J0={min:Co,max:Co};function fu(l,t,r,i){return Nu(r)?Bp(l,t,r):(Co.pad=r,Co.soft=i?0:null,Co.mode=i?3:0,Bp(l,t,J0))}function Xe(l,t){return l??t}function Z0(l,t,r){for(t=Xe(t,0),r=Xe(r,l.length-1);t<=r;){if(l[t]!=null)return!0;t++}return!1}function Bp(l,t,r){let i=r.min,o=r.max,u=Xe(i.pad,0),f=Xe(o.pad,0),d=Xe(i.hard,-ct),p=Xe(o.hard,ct),m=Xe(i.soft,ct),w=Xe(o.soft,-ct),v=Xe(i.mode,0),x=Xe(o.mode,0),z=t-l,R=Ei(z),k=Gn(Zt(l),Zt(t)),b=Ei(k),B=Zt(b-R);(z<1e-24||B>10)&&(z=0,(l==0||t==0)&&(z=1e-24,v==2&&m!=ct&&(u=0),x==2&&w!=-ct&&(f=0)));let P=z||k||1e3,W=Ei(P),V=_l(10,Sr(W)),Z=P*(z==0?l==0?.1:1:u),G=ft(tm(l-Z,V/10),24),ee=l>=m&&(v==1||v==3&&G<=m||v==2&&G>=m)?m:ct,re=Gn(d,G=ee?ee:Yr(ee,G)),ve=P*(z==0?t==0?.1:1:f),de=ft(Ru(t+ve,V/10),24),Y=t<=w&&(x==1||x==3&&de>=w||x==2&&de<=w)?w:-ct,Ce=Yr(p,de>Y&&t<=Y?Y:Gn(Y,de));return re==Ce&&re==0&&(Ce=100),[re,Ce]}const ew=new Intl.NumberFormat(Tl?K0.language:"en-US"),Zf=l=>ew.format(l),xr=Math,Ja=xr.PI,Zt=xr.abs,Sr=xr.floor,Jt=xr.round,Ar=xr.ceil,Yr=xr.min,Gn=xr.max,_l=xr.pow,Up=xr.sign,Ei=xr.log10,qg=xr.log2,tw=(l,t=1)=>xr.sinh(l)*t,hf=(l,t=1)=>xr.asinh(l/t),ct=1/0;function Vp(l){return(Ei((l^l>>31)-(l>>31))|0)+1}function zf(l,t,r){return Yr(Gn(l,t),r)}function Jg(l){return typeof l=="function"}function Ve(l){return Jg(l)?l:()=>l}const nw=()=>{},Zg=l=>l,em=(l,t)=>t,rw=l=>null,$p=l=>!0,Gp=(l,t)=>l==t,iw=/\.\d*?(?=9{6,}|0{6,})/gm,Ps=l=>{if(rm(l)||is.has(l))return l;const t=`${l}`,r=t.match(iw);if(r==null)return l;let i=r[0].length-1;if(t.indexOf("e-")!=-1){let[o,u]=t.split("e");return+`${Ps(o)}e${u}`}return ft(l,i)};function Ts(l,t){return Ps(ft(Ps(l/t))*t)}function Ru(l,t){return Ps(Ar(Ps(l/t))*t)}function tm(l,t){return Ps(Sr(Ps(l/t))*t)}function ft(l,t=0){if(rm(l))return l;let r=10**t,i=l*r*(1+Number.EPSILON);return Jt(i)/r}const is=new Map;function nm(l){return((""+l).split(".")[1]||"").length}function To(l,t,r,i){let o=[],u=i.map(nm);for(let f=t;f=0?0:d)+(f>=u[m]?0:u[m]),x=l==10?w:ft(w,v);o.push(x),is.set(x,v)}}return o}const ko={},ed=[],El=[null,null],rs=Array.isArray,rm=Number.isInteger,sw=l=>l===void 0;function Yp(l){return typeof l=="string"}function Nu(l){let t=!1;if(l!=null){let r=l.constructor;t=r==null||r==Object}return t}function lw(l){return l!=null&&typeof l=="object"}const ow=Object.getPrototypeOf(Uint8Array),im="__proto__";function Cl(l,t=Nu){let r;if(rs(l)){let i=l.find(o=>o!=null);if(rs(i)||t(i)){r=Array(l.length);for(let o=0;ou){for(o=f-1;o>=0&&l[o]==null;)l[o--]=null;for(o=f+1;of-d)],o=i[0].length,u=new Map;for(let f=0;f"u"?l=>Promise.resolve().then(l):queueMicrotask;function pw(l){let t=l[0],r=t.length,i=Array(r);for(let u=0;ut[u]-t[f]);let o=[];for(let u=0;u=i&&l[o]==null;)o--;if(o<=i)return!0;const u=Gn(1,Sr((o-i+1)/t));for(let f=l[i],d=i+u;d<=o;d+=u){const p=l[d];if(p!=null){if(p<=f)return!1;f=p}}return!0}const sm=["January","February","March","April","May","June","July","August","September","October","November","December"],lm=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function om(l){return l.slice(0,3)}const vw=lm.map(om),yw=sm.map(om),ww={MMMM:sm,MMM:yw,WWWW:lm,WWW:vw};function go(l){return(l<10?"0":"")+l}function Sw(l){return(l<10?"00":l<100?"0":"")+l}const xw={YYYY:l=>l.getFullYear(),YY:l=>(l.getFullYear()+"").slice(2),MMMM:(l,t)=>t.MMMM[l.getMonth()],MMM:(l,t)=>t.MMM[l.getMonth()],MM:l=>go(l.getMonth()+1),M:l=>l.getMonth()+1,DD:l=>go(l.getDate()),D:l=>l.getDate(),WWWW:(l,t)=>t.WWWW[l.getDay()],WWW:(l,t)=>t.WWW[l.getDay()],HH:l=>go(l.getHours()),H:l=>l.getHours(),h:l=>{let t=l.getHours();return t==0?12:t>12?t-12:t},AA:l=>l.getHours()>=12?"PM":"AM",aa:l=>l.getHours()>=12?"pm":"am",a:l=>l.getHours()>=12?"p":"a",mm:l=>go(l.getMinutes()),m:l=>l.getMinutes(),ss:l=>go(l.getSeconds()),s:l=>l.getSeconds(),fff:l=>Sw(l.getMilliseconds())};function td(l,t){t=t||ww;let r=[],i=/\{([a-z]+)\}|[^{]+/gi,o;for(;o=i.exec(l);)r.push(o[0][0]=="{"?xw[o[1]]:o[0]);return u=>{let f="";for(let d=0;dl%1==0,du=[1,2,2.5,5],Cw=To(10,-32,0,du),um=To(10,0,32,du),kw=um.filter(am),zs=Cw.concat(um),nd=` +`,cm="{YYYY}",Kp=nd+cm,fm="{M}/{D}",wo=nd+fm,Qa=wo+"/{YY}",dm="{aa}",Rw="{h}:{mm}",vl=Rw+dm,Qp=nd+vl,Xp=":{ss}",nt=null;function hm(l){let t=l*1e3,r=t*60,i=r*60,o=i*24,u=o*30,f=o*365,p=(l==1?To(10,0,3,du).filter(am):To(10,-3,0,du)).concat([t,t*5,t*10,t*15,t*30,r,r*5,r*10,r*15,r*30,i,i*2,i*3,i*4,i*6,i*8,i*12,o,o*2,o*3,o*4,o*5,o*6,o*7,o*8,o*9,o*10,o*15,u,u*2,u*3,u*4,u*6,f,f*2,f*5,f*10,f*25,f*50,f*100]);const m=[[f,cm,nt,nt,nt,nt,nt,nt,1],[o*28,"{MMM}",Kp,nt,nt,nt,nt,nt,1],[o,fm,Kp,nt,nt,nt,nt,nt,1],[i,"{h}"+dm,Qa,nt,wo,nt,nt,nt,1],[r,vl,Qa,nt,wo,nt,nt,nt,1],[t,Xp,Qa+" "+vl,nt,wo+" "+vl,nt,Qp,nt,1],[l,Xp+".{fff}",Qa+" "+vl,nt,wo+" "+vl,nt,Qp,nt,1]];function w(v){return(x,z,R,k,b,B)=>{let P=[],W=b>=f,V=b>=u&&b=o?o:b,de=Sr(R)-Sr(G),Y=re+de+Ru(G-re,ve);P.push(Y);let Ce=v(Y),ae=Ce.getHours()+Ce.getMinutes()/r+Ce.getSeconds()/i,ye=b/i,me=x.axes[z]._space,De=B/me;for(;Y=ft(Y+b,l==1?0:3),!(Y>k);)if(ye>1){let le=Sr(ft(ae+ye,6))%24,X=v(Y).getHours()-le;X>1&&(X=-1),Y-=X*i,ae=(ae+ye)%24;let D=P[P.length-1];ft((Y-D)/b,3)*De>=.7&&P.push(Y)}else P.push(Y)}return P}}return[p,m,w]}const[Nw,Dw,Tw]=hm(1),[zw,Mw,bw]=hm(.001);To(2,-53,53,[1]);function qp(l,t){return l.map(r=>r.map((i,o)=>o==0||o==8||i==null?i:t(o==1||r[8]==0?i:r[1]+i)))}function Jp(l,t){return(r,i,o,u,f)=>{let d=t.find(R=>f>=R[0])||t[t.length-1],p,m,w,v,x,z;return i.map(R=>{let k=l(R),b=k.getFullYear(),B=k.getMonth(),P=k.getDate(),W=k.getHours(),V=k.getMinutes(),Z=k.getSeconds(),G=b!=p&&d[2]||B!=m&&d[3]||P!=w&&d[4]||W!=v&&d[5]||V!=x&&d[6]||Z!=z&&d[7]||d[1];return p=b,m=B,w=P,v=W,x=V,z=Z,G(k)})}}function Ow(l,t){let r=td(t);return(i,o,u,f,d)=>o.map(p=>r(l(p)))}function pf(l,t,r){return new Date(l,t,r)}function Zp(l,t){return t(l)}const Lw="{YYYY}-{MM}-{DD} {h}:{mm}{aa}";function eg(l,t){return(r,i,o,u)=>u==null?Qf:t(l(i))}function Pw(l,t){let r=l.series[t];return r.width?r.stroke(l,t):r.points.width?r.points.stroke(l,t):null}function Aw(l,t){return l.series[t].fill(l,t)}const Iw={show:!0,live:!0,isolate:!1,mount:nw,markers:{show:!0,width:2,stroke:Pw,fill:Aw,dash:"solid"},idx:null,idxs:null,values:[]};function Hw(l,t){let r=l.cursor.points,i=Lr(),o=r.size(l,t);mt(i,vo,o),mt(i,yo,o);let u=o/-2;mt(i,"marginLeft",u),mt(i,"marginTop",u);let f=r.width(l,t,o);return f&&mt(i,"borderWidth",f),i}function Fw(l,t){let r=l.series[t].points;return r._fill||r._stroke}function jw(l,t){let r=l.series[t].points;return r._stroke||r._fill}function Ww(l,t){return l.series[t].points.size}const gf=[0,0];function Bw(l,t,r){return gf[0]=t,gf[1]=r,gf}function Xa(l,t,r,i=!0){return o=>{o.button==0&&(!i||o.target==t)&&r(o)}}function mf(l,t,r,i=!0){return o=>{(!i||o.target==t)&&r(o)}}const Uw={show:!0,x:!0,y:!0,lock:!1,move:Bw,points:{one:!1,show:Hw,size:Ww,width:0,stroke:jw,fill:Fw},bind:{mousedown:Xa,mouseup:Xa,click:Xa,dblclick:Xa,mousemove:mf,mouseleave:mf,mouseenter:mf},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,click:(l,t)=>{t.stopPropagation(),t.stopImmediatePropagation()},_x:!1,_y:!1},focus:{dist:(l,t,r,i,o)=>i-o,prox:-1,bias:0},hover:{skip:[void 0],prox:null,bias:0},left:-10,top:-10,idx:null,dataIdx:null,idxs:null,event:null},pm={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},rd=Vt({},pm,{filter:em}),gm=Vt({},rd,{size:10}),mm=Vt({},pm,{show:!1}),id='12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',vm="bold "+id,ym=1.5,tg={show:!0,scale:"x",stroke:Kf,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:vm,side:2,grid:rd,ticks:gm,border:mm,font:id,lineGap:ym,rotate:0},Vw="Value",$w="Time",ng={show:!0,scale:"x",auto:!1,sorted:1,min:ct,max:-ct,idxs:[]};function Gw(l,t,r,i,o){return t.map(u=>u==null?"":Zf(u))}function Yw(l,t,r,i,o,u,f){let d=[],p=is.get(o)||0;r=f?r:ft(Ru(r,o),p);for(let m=r;m<=i;m=ft(m+o,p))d.push(Object.is(m,-0)?0:m);return d}function Mf(l,t,r,i,o,u,f){const d=[],p=l.scales[l.axes[t].scale].log,m=p==10?Ei:qg,w=Sr(m(r));o=_l(p,w),p==10&&(o=zs[Gr(o,zs)]);let v=r,x=o*p;p==10&&(x=zs[Gr(x,zs)]);do d.push(v),v=v+o,p==10&&!is.has(v)&&(v=ft(v,is.get(o))),v>=x&&(o=v,x=o*p,p==10&&(x=zs[Gr(x,zs)]));while(v<=i);return d}function Kw(l,t,r,i,o,u,f){let p=l.scales[l.axes[t].scale].asinh,m=i>p?Mf(l,t,Gn(p,r),i,o):[p],w=i>=0&&r<=0?[0]:[];return(r<-p?Mf(l,t,Gn(p,-i),-r,o):[p]).reverse().map(x=>-x).concat(w,m)}const wm=/./,Qw=/[12357]/,Xw=/[125]/,rg=/1/,bf=(l,t,r,i)=>l.map((o,u)=>t==4&&o==0||u%i==0&&r.test(o.toExponential()[o<0?1:0])?o:null);function qw(l,t,r,i,o){let u=l.axes[r],f=u.scale,d=l.scales[f],p=l.valToPos,m=u._space,w=p(10,f),v=p(9,f)-w>=m?wm:p(7,f)-w>=m?Qw:p(5,f)-w>=m?Xw:rg;if(v==rg){let x=Zt(p(1,f)-w);if(xo,lg={show:!0,auto:!0,sorted:0,gaps:Sm,alpha:1,facets:[Vt({},sg,{scale:"x"}),Vt({},sg,{scale:"y"})]},og={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:Sm,alpha:1,points:{show:t1,filter:null},values:null,min:ct,max:-ct,idxs:[],path:null,clip:null};function n1(l,t,r,i,o){return r/10}const xm={time:N0,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},r1=Vt({},xm,{time:!1,ori:1}),ag={};function _m(l,t){let r=ag[l];return r||(r={key:l,plots:[],sub(i){r.plots.push(i)},unsub(i){r.plots=r.plots.filter(o=>o!=i)},pub(i,o,u,f,d,p,m){for(let w=0;w{let B=f.pxRound;const P=m.dir*(m.ori==0?1:-1),W=m.ori==0?zl:Ml;let V,Z;P==1?(V=r,Z=i):(V=i,Z=r);let G=B(v(d[V],m,k,z)),ee=B(x(p[V],w,b,R)),re=B(v(d[Z],m,k,z)),ve=B(x(u==1?w.max:w.min,w,b,R)),de=new Path2D(o);return W(de,re,ve),W(de,G,ve),W(de,G,ee),de})}function Du(l,t,r,i,o,u){let f=null;if(l.length>0){f=new Path2D;const d=t==0?Mu:od;let p=r;for(let v=0;vx[0]){let z=x[0]-p;z>0&&d(f,p,i,z,i+u),p=x[1]}}let m=r+o-p,w=10;m>0&&d(f,p,i-w/2,m,i+u+w)}return f}function s1(l,t,r){let i=l[l.length-1];i&&i[0]==t?i[1]=r:l.push([t,r])}function ld(l,t,r,i,o,u,f){let d=[],p=l.length;for(let m=o==1?r:i;m>=r&&m<=i;m+=o)if(t[m]===null){let v=m,x=m;if(o==1)for(;++m<=i&&t[m]===null;)x=m;else for(;--m>=r&&t[m]===null;)x=m;let z=u(l[v]),R=x==v?z:u(l[x]),k=v-o;z=f<=0&&k>=0&&k=0&&B>=0&&B=z&&d.push([z,R])}return d}function ug(l){return l==0?Zg:l==1?Jt:t=>Ts(t,l)}function Em(l){let t=l==0?Tu:zu,r=l==0?(o,u,f,d,p,m)=>{o.arcTo(u,f,d,p,m)}:(o,u,f,d,p,m)=>{o.arcTo(f,u,p,d,m)},i=l==0?(o,u,f,d,p)=>{o.rect(u,f,d,p)}:(o,u,f,d,p)=>{o.rect(f,u,p,d)};return(o,u,f,d,p,m=0,w=0)=>{m==0&&w==0?i(o,u,f,d,p):(m=Yr(m,d/2,p/2),w=Yr(w,d/2,p/2),t(o,u+m,f),r(o,u+d,f,u+d,f+p,m),r(o,u+d,f+p,u,f+p,w),r(o,u,f+p,u,f,w),r(o,u,f,u+d,f,m),o.closePath())}}const Tu=(l,t,r)=>{l.moveTo(t,r)},zu=(l,t,r)=>{l.moveTo(r,t)},zl=(l,t,r)=>{l.lineTo(t,r)},Ml=(l,t,r)=>{l.lineTo(r,t)},Mu=Em(0),od=Em(1),Cm=(l,t,r,i,o,u)=>{l.arc(t,r,i,o,u)},km=(l,t,r,i,o,u)=>{l.arc(r,t,i,o,u)},Rm=(l,t,r,i,o,u,f)=>{l.bezierCurveTo(t,r,i,o,u,f)},Nm=(l,t,r,i,o,u,f)=>{l.bezierCurveTo(r,t,o,i,f,u)};function Dm(l){return(t,r,i,o,u)=>As(t,r,(f,d,p,m,w,v,x,z,R,k,b)=>{let{pxRound:B,points:P}=f,W,V;m.ori==0?(W=Tu,V=Cm):(W=zu,V=km);const Z=ft(P.width*Je,3);let G=(P.size-P.width)/2*Je,ee=ft(G*2,3),re=new Path2D,ve=new Path2D,{left:de,top:Y,width:Ce,height:ae}=t.bbox;Mu(ve,de-ee,Y-ee,Ce+ee*2,ae+ee*2);const ye=me=>{if(p[me]!=null){let De=B(v(d[me],m,k,z)),le=B(x(p[me],w,b,R));W(re,De+G,le),V(re,De,le,G,0,Ja*2)}};if(u)u.forEach(ye);else for(let me=i;me<=o;me++)ye(me);return{stroke:Z>0?re:null,fill:re,clip:ve,flags:kl|Of}})}function Tm(l){return(t,r,i,o,u,f)=>{i!=o&&(u!=i&&f!=i&&l(t,r,i),u!=o&&f!=o&&l(t,r,o),l(t,r,f))}}const l1=Tm(zl),o1=Tm(Ml);function zm(l){const t=Xe(l==null?void 0:l.alignGaps,0);return(r,i,o,u)=>As(r,i,(f,d,p,m,w,v,x,z,R,k,b)=>{[o,u]=Cu(p,o,u);let B=f.pxRound,P=ae=>B(v(ae,m,k,z)),W=ae=>B(x(ae,w,b,R)),V,Z;m.ori==0?(V=zl,Z=l1):(V=Ml,Z=o1);const G=m.dir*(m.ori==0?1:-1),ee={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:kl},re=ee.stroke;let ve=!1;if(u-o>=k*4){let ae=K=>r.posToVal(K,m.key,!0),ye=null,me=null,De,le,ie,oe=P(d[G==1?o:u]),X=P(d[o]),D=P(d[u]),H=ae(G==1?X+1:D-1);for(let K=G==1?o:u;K>=o&&K<=u;K+=G){let xe=d[K],ge=(G==1?xeH)?oe:P(xe),_e=p[K];ge==oe?_e!=null?(le=_e,ye==null?(V(re,ge,W(le)),De=ye=me=le):leme&&(me=le)):_e===null&&(ve=!0):(ye!=null&&Z(re,oe,W(ye),W(me),W(De),W(le)),_e!=null?(le=_e,V(re,ge,W(le)),ye=me=De=le):(ye=me=null,_e===null&&(ve=!0)),oe=ge,H=ae(oe+G))}ye!=null&&ye!=me&&ie!=oe&&Z(re,oe,W(ye),W(me),W(De),W(le))}else for(let ae=G==1?o:u;ae>=o&&ae<=u;ae+=G){let ye=p[ae];ye===null?ve=!0:ye!=null&&V(re,P(d[ae]),W(ye))}let[Y,Ce]=sd(r,i);if(f.fill!=null||Y!=0){let ae=ee.fill=new Path2D(re),ye=f.fillTo(r,i,f.min,f.max,Y),me=W(ye),De=P(d[o]),le=P(d[u]);G==-1&&([le,De]=[De,le]),V(ae,le,me),V(ae,De,me)}if(!f.spanGaps){let ae=[];ve&&ae.push(...ld(d,p,o,u,G,P,t)),ee.gaps=ae=f.gaps(r,i,o,u,ae),ee.clip=Du(ae,m.ori,z,R,k,b)}return Ce!=0&&(ee.band=Ce==2?[Ci(r,i,o,u,re,-1),Ci(r,i,o,u,re,1)]:Ci(r,i,o,u,re,Ce)),ee})}function a1(l){const t=Xe(l.align,1),r=Xe(l.ascDesc,!1),i=Xe(l.alignGaps,0),o=Xe(l.extend,!1);return(u,f,d,p)=>As(u,f,(m,w,v,x,z,R,k,b,B,P,W)=>{[d,p]=Cu(v,d,p);let V=m.pxRound,{left:Z,width:G}=u.bbox,ee=X=>V(R(X,x,P,b)),re=X=>V(k(X,z,W,B)),ve=x.ori==0?zl:Ml;const de={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:kl},Y=de.stroke,Ce=x.dir*(x.ori==0?1:-1);let ae=re(v[Ce==1?d:p]),ye=ee(w[Ce==1?d:p]),me=ye,De=ye;o&&t==-1&&(De=Z,ve(Y,De,ae)),ve(Y,ye,ae);for(let X=Ce==1?d:p;X>=d&&X<=p;X+=Ce){let D=v[X];if(D==null)continue;let H=ee(w[X]),K=re(D);t==1?ve(Y,H,ae):ve(Y,me,K),ve(Y,H,K),ae=K,me=H}let le=me;o&&t==1&&(le=Z+G,ve(Y,le,ae));let[ie,oe]=sd(u,f);if(m.fill!=null||ie!=0){let X=de.fill=new Path2D(Y),D=m.fillTo(u,f,m.min,m.max,ie),H=re(D);ve(X,le,H),ve(X,De,H)}if(!m.spanGaps){let X=[];X.push(...ld(w,v,d,p,Ce,ee,i));let D=m.width*Je/2,H=r||t==1?D:-D,K=r||t==-1?-D:D;X.forEach(xe=>{xe[0]+=H,xe[1]+=K}),de.gaps=X=m.gaps(u,f,d,p,X),de.clip=Du(X,x.ori,b,B,P,W)}return oe!=0&&(de.band=oe==2?[Ci(u,f,d,p,Y,-1),Ci(u,f,d,p,Y,1)]:Ci(u,f,d,p,Y,oe)),de})}function cg(l,t,r,i,o,u,f=ct){if(l.length>1){let d=null;for(let p=0,m=1/0;p{}),{fill:v,stroke:x}=m;return(z,R,k,b)=>As(z,R,(B,P,W,V,Z,G,ee,re,ve,de,Y)=>{let Ce=B.pxRound,ae=r,ye=i*Je,me=d*Je,De=p*Je,le,ie;V.ori==0?[le,ie]=u(z,R):[ie,le]=u(z,R);const oe=V.dir*(V.ori==0?1:-1);let X=V.ori==0?Mu:od,D=V.ori==0?w:(ce,qe,et,sn,kn,Gt,Rt)=>{w(ce,qe,et,kn,sn,Rt,Gt)},H=Xe(z.bands,ed).find(ce=>ce.series[0]==R),K=H!=null?H.dir:0,xe=B.fillTo(z,R,B.min,B.max,K),be=Ce(ee(xe,Z,Y,ve)),ge,_e,He,Fe=de,Oe=Ce(B.width*Je),$t=!1,Pt=null,At=null,It=null,Kn=null;v!=null&&(Oe==0||x!=null)&&($t=!0,Pt=v.values(z,R,k,b),At=new Map,new Set(Pt).forEach(ce=>{ce!=null&&At.set(ce,new Path2D)}),Oe>0&&(It=x.values(z,R,k,b),Kn=new Map,new Set(It).forEach(ce=>{ce!=null&&Kn.set(ce,new Path2D)})));let{x0:Cn,size:_r}=m;if(Cn!=null&&_r!=null){ae=1,P=Cn.values(z,R,k,b),Cn.unit==2&&(P=P.map(et=>z.posToVal(re+et*de,V.key,!0)));let ce=_r.values(z,R,k,b);_r.unit==2?_e=ce[0]*de:_e=G(ce[0],V,de,re)-G(0,V,de,re),Fe=cg(P,W,G,V,de,re,Fe),He=Fe-_e+ye}else Fe=cg(P,W,G,V,de,re,Fe),He=Fe*f+ye,_e=Fe-He;He<1&&(He=0),Oe>=_e/2&&(Oe=0),He<5&&(Ce=Zg);let Xr=He>0,Pn=Fe-He-(Xr?Oe:0);_e=Ce(zf(Pn,De,me)),ge=(ae==0?_e/2:ae==oe?0:_e)-ae*oe*((ae==0?ye/2:0)+(Xr?Oe/2:0));const Ze={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},nn=$t?null:new Path2D;let rn=null;if(H!=null)rn=z.data[H.series[1]];else{let{y0:ce,y1:qe}=m;ce!=null&&qe!=null&&(W=qe.values(z,R,k,b),rn=ce.values(z,R,k,b))}let sr=le*_e,Pe=ie*_e;for(let ce=oe==1?k:b;ce>=k&&ce<=b;ce+=oe){let qe=W[ce];if(qe==null)continue;if(rn!=null){let Yt=rn[ce]??0;if(qe-Yt==0)continue;be=ee(Yt,Z,Y,ve)}let et=V.distr!=2||m!=null?P[ce]:ce,sn=G(et,V,de,re),kn=ee(Xe(qe,xe),Z,Y,ve),Gt=Ce(sn-ge),Rt=Ce(Gn(kn,be)),ln=Ce(Yr(kn,be)),mn=Rt-ln;if(qe!=null){let Yt=qe<0?Pe:sr,vn=qe<0?sr:Pe;$t?(Oe>0&&It[ce]!=null&&X(Kn.get(It[ce]),Gt,ln+Sr(Oe/2),_e,Gn(0,mn-Oe),Yt,vn),Pt[ce]!=null&&X(At.get(Pt[ce]),Gt,ln+Sr(Oe/2),_e,Gn(0,mn-Oe),Yt,vn)):X(nn,Gt,ln+Sr(Oe/2),_e,Gn(0,mn-Oe),Yt,vn),D(z,R,ce,Gt-Oe/2,ln,_e+Oe,mn)}}return Oe>0?Ze.stroke=$t?Kn:nn:$t||(Ze._fill=B.width==0?B._fill:B._stroke??B._fill,Ze.width=0),Ze.fill=$t?At:nn,Ze})}function c1(l,t){const r=Xe(t==null?void 0:t.alignGaps,0);return(i,o,u,f)=>As(i,o,(d,p,m,w,v,x,z,R,k,b,B)=>{[u,f]=Cu(m,u,f);let P=d.pxRound,W=le=>P(x(le,w,b,R)),V=le=>P(z(le,v,B,k)),Z,G,ee;w.ori==0?(Z=Tu,ee=zl,G=Rm):(Z=zu,ee=Ml,G=Nm);const re=w.dir*(w.ori==0?1:-1);let ve=W(p[re==1?u:f]),de=ve,Y=[],Ce=[];for(let le=re==1?u:f;le>=u&&le<=f;le+=re)if(m[le]!=null){let oe=p[le],X=W(oe);Y.push(de=X),Ce.push(V(m[le]))}const ae={stroke:l(Y,Ce,Z,ee,G,P),fill:null,clip:null,band:null,gaps:null,flags:kl},ye=ae.stroke;let[me,De]=sd(i,o);if(d.fill!=null||me!=0){let le=ae.fill=new Path2D(ye),ie=d.fillTo(i,o,d.min,d.max,me),oe=V(ie);ee(le,de,oe),ee(le,ve,oe)}if(!d.spanGaps){let le=[];le.push(...ld(p,m,u,f,re,W,r)),ae.gaps=le=d.gaps(i,o,u,f,le),ae.clip=Du(le,w.ori,R,k,b,B)}return De!=0&&(ae.band=De==2?[Ci(i,o,u,f,ye,-1),Ci(i,o,u,f,ye,1)]:Ci(i,o,u,f,ye,De)),ae})}function f1(l){return c1(d1,l)}function d1(l,t,r,i,o,u){const f=l.length;if(f<2)return null;const d=new Path2D;if(r(d,l[0],t[0]),f==2)i(d,l[1],t[1]);else{let p=Array(f),m=Array(f-1),w=Array(f-1),v=Array(f-1);for(let x=0;x0!=m[x]>0?p[x]=0:(p[x]=3*(v[x-1]+v[x])/((2*v[x]+v[x-1])/m[x-1]+(v[x]+2*v[x-1])/m[x]),isFinite(p[x])||(p[x]=0));p[f-1]=m[f-2];for(let x=0;x{Ln.pxRatio=Je}));const h1=zm(),p1=Dm();function dg(l,t,r,i){return(i?[l[0],l[1]].concat(l.slice(2)):[l[0]].concat(l.slice(1))).map((u,f)=>Pf(u,f,t,r))}function g1(l,t){return l.map((r,i)=>i==0?{}:Vt({},t,r))}function Pf(l,t,r,i){return Vt({},t==0?r:i,l)}function Mm(l,t,r){return t==null?El:[t,r]}const m1=Mm;function v1(l,t,r){return t==null?El:fu(t,r,Jf,!0)}function bm(l,t,r,i){return t==null?El:ku(t,r,l.scales[i].log,!1)}const y1=bm;function Om(l,t,r,i){return t==null?El:qf(t,r,l.scales[i].log,!1)}const w1=Om;function S1(l,t,r,i,o){let u=Gn(Vp(l),Vp(t)),f=t-l,d=Gr(o/i*f,r);do{let p=r[d],m=i*p/f;if(m>=o&&u+(p<5?is.get(p):0)<=17)return[p,m]}while(++d(t=Jt((r=+o)*Je))+"px"),[l,t,r]}function x1(l){l.show&&[l.font,l.labelFont].forEach(t=>{let r=ft(t[2]*Je,1);t[0]=t[0].replace(/[0-9.]+px/,r+"px"),t[1]=r})}function Ln(l,t,r){const i={mode:Xe(l.mode,1)},o=i.mode;function u(g,S,_,E){let T=S.valToPct(g);return E+_*(S.dir==-1?1-T:T)}function f(g,S,_,E){let T=S.valToPct(g);return E+_*(S.dir==-1?T:1-T)}function d(g,S,_,E){return S.ori==0?u(g,S,_,E):f(g,S,_,E)}i.valToPosH=u,i.valToPosV=f;let p=!1;i.status=0;const m=i.root=Lr(D0);if(l.id!=null&&(m.id=l.id),wr(m,l.class),l.title){let g=Lr(M0,m);g.textContent=l.title}const w=$r("canvas"),v=i.ctx=w.getContext("2d"),x=Lr(b0,m);Os("click",x,g=>{g.target===R&&(Ke!=fi||rt!=Ii)&&Qt.click(i,g)},!0);const z=i.under=Lr(O0,x);x.appendChild(w);const R=i.over=Lr(L0,x);l=Cl(l);const k=+Xe(l.pxAlign,1),b=ug(k);(l.plugins||[]).forEach(g=>{g.opts&&(l=g.opts(i,l)||l)});const B=l.ms||.001,P=i.series=o==1?dg(l.series||[],ng,og,!1):g1(l.series||[null],lg),W=i.axes=dg(l.axes||[],tg,ig,!0),V=i.scales={},Z=i.bands=l.bands||[];Z.forEach(g=>{g.fill=Ve(g.fill||null),g.dir=Xe(g.dir,-1)});const G=o==2?P[1].facets[0].scale:P[0].scale,ee={axes:Bo,series:Au},re=(l.drawOrder||["axes","series"]).map(g=>ee[g]);function ve(g){const S=g.distr==3?_=>Ei(_>0?_:g.clamp(i,_,g.min,g.max,g.key)):g.distr==4?_=>hf(_,g.asinh):g.distr==100?_=>g.fwd(_):_=>_;return _=>{let E=S(_),{_min:T,_max:L}=g,$=L-T;return(E-T)/$}}function de(g){let S=V[g];if(S==null){let _=(l.scales||ko)[g]||ko;if(_.from!=null){de(_.from);let E=Vt({},V[_.from],_,{key:g});E.valToPct=ve(E),V[g]=E}else{S=V[g]=Vt({},g==G?xm:r1,_),S.key=g;let E=S.time,T=S.range,L=rs(T);if((g!=G||o==2&&!E)&&(L&&(T[0]==null||T[1]==null)&&(T={min:T[0]==null?Wp:{mode:1,hard:T[0],soft:T[0]},max:T[1]==null?Wp:{mode:1,hard:T[1],soft:T[1]}},L=!1),!L&&Nu(T))){let $=T;T=(q,ne,ue)=>ne==null?El:fu(ne,ue,$)}S.range=Ve(T||(E?m1:g==G?S.distr==3?y1:S.distr==4?w1:Mm:S.distr==3?bm:S.distr==4?Om:v1)),S.auto=Ve(L?!1:S.auto),S.clamp=Ve(S.clamp||n1),S._min=S._max=null,S.valToPct=ve(S)}}}de("x"),de("y"),o==1&&P.forEach(g=>{de(g.scale)}),W.forEach(g=>{de(g.scale)});for(let g in l.scales)de(g);const Y=V[G],Ce=Y.distr;let ae,ye;Y.ori==0?(wr(m,T0),ae=u,ye=f):(wr(m,z0),ae=f,ye=u);const me={};for(let g in V){let S=V[g];(S.min!=null||S.max!=null)&&(me[g]={min:S.min,max:S.max},S.min=S.max=null)}const De=l.tzDate||(g=>new Date(Jt(g/B))),le=l.fmtDate||td,ie=B==1?Tw(De):bw(De),oe=Jp(De,qp(B==1?Dw:Mw,le)),X=eg(De,Zp(Lw,le)),D=[],H=i.legend=Vt({},Iw,l.legend),K=i.cursor=Vt({},Uw,{drag:{y:o==2}},l.cursor),xe=H.show,be=K.show,ge=H.markers;H.idxs=D,ge.width=Ve(ge.width),ge.dash=Ve(ge.dash),ge.stroke=Ve(ge.stroke),ge.fill=Ve(ge.fill);let _e,He,Fe,Oe=[],$t=[],Pt,At=!1,It={};if(H.live){const g=P[1]?P[1].values:null;At=g!=null,Pt=At?g(i,1,0):{_:0};for(let S in Pt)It[S]=Qf}if(xe)if(_e=$r("table",j0,m),Fe=$r("tbody",null,_e),H.mount(i,_e),At){He=$r("thead",null,_e,Fe);let g=$r("tr",null,He);$r("th",null,g);for(var Kn in Pt)$r("th",Dp,g).textContent=Kn}else wr(_e,B0),H.live&&wr(_e,W0);const Cn={show:!0},_r={show:!1};function Xr(g,S){if(S==0&&(At||!H.live||o==2))return El;let _=[],E=$r("tr",U0,Fe,Fe.childNodes[S]);wr(E,g.class),g.show||wr(E,Ms);let T=$r("th",null,E);if(ge.show){let q=Lr(V0,T);if(S>0){let ne=ge.width(i,S);ne&&(q.style.border=ne+"px "+ge.dash(i,S)+" "+ge.stroke(i,S)),q.style.background=ge.fill(i,S)}}let L=Lr(Dp,T);g.label instanceof HTMLElement?L.appendChild(g.label):L.textContent=g.label,S>0&&(ge.show||(L.style.color=g.width>0?ge.stroke(i,S):ge.fill(i,S)),Ze("click",T,q=>{if(K._lock)return;wn(q);let ne=P.indexOf(g);if((q.ctrlKey||q.metaKey)!=H.isolate){let ue=P.some((fe,he)=>he>0&&he!=ne&&fe.show);P.forEach((fe,he)=>{he>0&&dr(he,ue?he==ne?Cn:_r:Cn,!0,Dt.setSeries)})}else dr(ne,{show:!g.show},!0,Dt.setSeries)},!1),_t&&Ze(bp,T,q=>{K._lock||(wn(q),dr(P.indexOf(g),ji,!0,Dt.setSeries))},!1));for(var $ in Pt){let q=$r("td",$0,E);q.textContent="--",_.push(q)}return[E,_]}const Pn=new Map;function Ze(g,S,_,E=!0){const T=Pn.get(S)||{},L=K.bind[g](i,S,_,E);L&&(Os(g,S,T[g]=L),Pn.set(S,T))}function nn(g,S,_){const E=Pn.get(S)||{};for(let T in E)(g==null||T==g)&&(Tf(T,S,E[T]),delete E[T]);g==null&&Pn.delete(S)}let rn=0,sr=0,Pe=0,ce=0,qe=0,et=0,sn=qe,kn=et,Gt=Pe,Rt=ce,ln=0,mn=0,Yt=0,vn=0;i.bbox={};let qr=!1,Jr=!1,lr=!1,or=!1,Zr=!1,zt=!1;function lt(g,S,_){(_||g!=i.width||S!=i.height)&&Kt(g,S),ci(!1),lr=!0,Jr=!0,Hn()}function Kt(g,S){i.width=rn=Pe=g,i.height=sr=ce=S,qe=et=0,an(),Rn();let _=i.bbox;ln=_.left=Ts(qe*Je,.5),mn=_.top=Ts(et*Je,.5),Yt=_.width=Ts(Pe*Je,.5),vn=_.height=Ts(ce*Je,.5)}const on=3;function ar(){let g=!1,S=0;for(;!g;){S++;let _=Hl(S),E=Wo(S);g=S==on||_&&E,g||(Kt(i.width,i.height),Jr=!0)}}function yn({width:g,height:S}){lt(g,S)}i.setSize=yn;function an(){let g=!1,S=!1,_=!1,E=!1;W.forEach((T,L)=>{if(T.show&&T._show){let{side:$,_size:q}=T,ne=$%2,ue=T.label!=null?T.labelSize:0,fe=q+ue;fe>0&&(ne?(Pe-=fe,$==3?(qe+=fe,E=!0):_=!0):(ce-=fe,$==0?(et+=fe,g=!0):S=!0))}}),An[0]=g,An[1]=_,An[2]=S,An[3]=E,Pe-=Ir[1]+Ir[3],qe+=Ir[3],ce-=Ir[2]+Ir[0],et+=Ir[0]}function Rn(){let g=qe+Pe,S=et+ce,_=qe,E=et;function T(L,$){switch(L){case 1:return g+=$,g-$;case 2:return S+=$,S-$;case 3:return _-=$,_+$;case 0:return E-=$,E+$}}W.forEach((L,$)=>{if(L.show&&L._show){let q=L.side;L._pos=T(q,L._size),L.label!=null&&(L._lpos=T(q,L.labelSize))}})}if(K.dataIdx==null){let g=K.hover,S=g.skip=new Set(g.skip??[]);S.add(void 0);let _=g.prox=Ve(g.prox),E=g.bias??(g.bias=0);K.dataIdx=(T,L,$,q)=>{if(L==0)return $;let ne=$,ue=_(T,L,$,q)??ct,fe=ue>=0&&ue0;)S.has(Ue[ke])||(je=ke);if(E==0||E==1)for(ke=$;Te==null&&ke++ue&&(ne=null);return ne}}const wn=g=>{K.event=g};K.idxs=D,K._lock=!1;let We=K.points;We.show=Ve(We.show),We.size=Ve(We.size),We.stroke=Ve(We.stroke),We.width=Ve(We.width),We.fill=Ve(We.fill);const xt=i.focus=Vt({},l.focus||{alpha:.3},K.focus),_t=xt.prox>=0,un=_t&&We.one;let vt=[],Sn=[],Ht=[];function Er(g,S){let _=We.show(i,S);if(_ instanceof HTMLElement)return wr(_,F0),wr(_,g.class),oi(_,-10,-10,Pe,ce),R.insertBefore(_,vt[S]),_}function Ri(g,S){if(o==1||S>0){let _=o==1&&V[g.scale].time,E=g.value;g.value=_?Yp(E)?eg(De,Zp(E,le)):E||X:E||Zw,g.label=g.label||(_?$w:Vw)}if(un||S>0){g.width=g.width==null?1:g.width,g.paths=g.paths||h1||rw,g.fillTo=Ve(g.fillTo||i1),g.pxAlign=+Xe(g.pxAlign,k),g.pxRound=ug(g.pxAlign),g.stroke=Ve(g.stroke||null),g.fill=Ve(g.fill||null),g._stroke=g._fill=g._paths=g._focus=null;let _=e1(Gn(1,g.width),1),E=g.points=Vt({},{size:_,width:Gn(1,_*.2),stroke:g.stroke,space:_*2,paths:p1,_stroke:null,_fill:null},g.points);E.show=Ve(E.show),E.filter=Ve(E.filter),E.fill=Ve(E.fill),E.stroke=Ve(E.stroke),E.paths=Ve(E.paths),E.pxAlign=g.pxAlign}if(xe){let _=Xr(g,S);Oe.splice(S,0,_[0]),$t.splice(S,0,_[1]),H.values.push(null)}if(be){D.splice(S,0,null);let _=null;un?S==0&&(_=Er(g,S)):S>0&&(_=Er(g,S)),vt.splice(S,0,_),Sn.splice(S,0,0),Ht.splice(S,0,0)}jt("addSeries",S)}function Ou(g,S){S=S??P.length,g=o==1?Pf(g,S,ng,og):Pf(g,S,{},lg),P.splice(S,0,g),Ri(P[S],S)}i.addSeries=Ou;function Lu(g){if(P.splice(g,1),xe){H.values.splice(g,1),$t.splice(g,1);let S=Oe.splice(g,1)[0];nn(null,S.firstChild),S.remove()}be&&(D.splice(g,1),vt.splice(g,1)[0].remove(),Sn.splice(g,1),Ht.splice(g,1)),jt("delSeries",g)}i.delSeries=Lu;const An=[!1,!1,!1,!1];function Ao(g,S){if(g._show=g.show,g.show){let _=g.side%2,E=V[g.scale];E==null&&(g.scale=_?P[1].scale:G,E=V[g.scale]);let T=E.time;g.size=Ve(g.size),g.space=Ve(g.space),g.rotate=Ve(g.rotate),rs(g.incrs)&&g.incrs.forEach($=>{!is.has($)&&is.set($,nm($))}),g.incrs=Ve(g.incrs||(E.distr==2?kw:T?B==1?Nw:zw:zs)),g.splits=Ve(g.splits||(T&&E.distr==1?ie:E.distr==3?Mf:E.distr==4?Kw:Yw)),g.stroke=Ve(g.stroke),g.grid.stroke=Ve(g.grid.stroke),g.ticks.stroke=Ve(g.ticks.stroke),g.border.stroke=Ve(g.border.stroke);let L=g.values;g.values=rs(L)&&!rs(L[0])?Ve(L):T?rs(L)?Jp(De,qp(L,le)):Yp(L)?Ow(De,L):L||oe:L||Gw,g.filter=Ve(g.filter||(E.distr>=3&&E.log==10?qw:E.distr==3&&E.log==2?Jw:em)),g.font=hg(g.font),g.labelFont=hg(g.labelFont),g._size=g.size(i,null,S,0),g._space=g._rotate=g._incrs=g._found=g._splits=g._values=null,g._size>0&&(An[S]=!0,g._el=Lr(P0,x))}}function Ni(g,S,_,E){let[T,L,$,q]=_,ne=S%2,ue=0;return ne==0&&(q||L)&&(ue=S==0&&!T||S==2&&!$?Jt(tg.size/3):0),ne==1&&(T||$)&&(ue=S==1&&!L||S==3&&!q?Jt(ig.size/2):0),ue}const Io=i.padding=(l.padding||[Ni,Ni,Ni,Ni]).map(g=>Ve(Xe(g,Ni))),Ir=i._padding=Io.map((g,S)=>g(i,S,An,0));let Ft,Mt=null,bt=null;const Is=o==1?P[0].idxs:null;let ur=null,ot=!1;function Ho(g,S){if(t=g??[],i.data=i._data=t,o==2){Ft=0;for(let _=1;_=0,zt=!0,Hn()}}i.setData=Ho;function ss(){ot=!0;let g,S;o==1&&(Ft>0?(Mt=Is[0]=0,bt=Is[1]=Ft-1,g=t[0][Mt],S=t[0][bt],Ce==2?(g=Mt,S=bt):g==S&&(Ce==3?[g,S]=ku(g,g,Y.log,!1):Ce==4?[g,S]=qf(g,g,Y.log,!1):Y.time?S=g+Jt(86400/B):[g,S]=fu(g,S,Jf,!0))):(Mt=Is[0]=g=null,bt=Is[1]=S=null)),fr(G,g,S)}let ls,Hr,bl,Hs,Di,Qn,Ol,In,Ll,Nn;function Fo(g,S,_,E,T,L){g??(g=zp),_??(_=ed),E??(E="butt"),T??(T=zp),L??(L="round"),g!=ls&&(v.strokeStyle=ls=g),T!=Hr&&(v.fillStyle=Hr=T),S!=bl&&(v.lineWidth=bl=S),L!=Di&&(v.lineJoin=Di=L),E!=Qn&&(v.lineCap=Qn=E),_!=Hs&&v.setLineDash(Hs=_)}function os(g,S,_,E){S!=Hr&&(v.fillStyle=Hr=S),g!=Ol&&(v.font=Ol=g),_!=In&&(v.textAlign=In=_),E!=Ll&&(v.textBaseline=Ll=E)}function Ti(g,S,_,E,T=0){if(E.length>0&&g.auto(i,ot)&&(S==null||S.min==null)){let L=Xe(Mt,0),$=Xe(bt,E.length-1),q=_.min==null?q0(E,L,$,T,g.distr==3):[_.min,_.max];g.min=Yr(g.min,_.min=q[0]),g.max=Gn(g.max,_.max=q[1])}}const zi={min:null,max:null};function Fs(){for(let E in V){let T=V[E];me[E]==null&&(T.min==null||me[G]!=null&&T.auto(i,ot))&&(me[E]=zi)}for(let E in V){let T=V[E];me[E]==null&&T.from!=null&&me[T.from]!=null&&(me[E]=zi)}me[G]!=null&&ci(!0);let g={};for(let E in me){let T=me[E];if(T!=null){let L=g[E]=Cl(V[E],lw);if(T.min!=null)Vt(L,T);else if(E!=G||o==2)if(Ft==0&&L.from==null){let $=L.range(i,null,null,E);L.min=$[0],L.max=$[1]}else L.min=ct,L.max=-ct}}if(Ft>0){P.forEach((E,T)=>{if(o==1){let L=E.scale,$=me[L];if($==null)return;let q=g[L];if(T==0){let ne=q.range(i,q.min,q.max,L);q.min=ne[0],q.max=ne[1],Mt=Gr(q.min,t[0]),bt=Gr(q.max,t[0]),bt-Mt>1&&(t[0][Mt]q.max&&bt--),E.min=ur[Mt],E.max=ur[bt]}else E.show&&E.auto&&Ti(q,$,E,t[T],E.sorted);E.idxs[0]=Mt,E.idxs[1]=bt}else if(T>0&&E.show&&E.auto){let[L,$]=E.facets,q=L.scale,ne=$.scale,[ue,fe]=t[T],he=g[q],Ae=g[ne];he!=null&&Ti(he,me[q],L,ue,L.sorted),Ae!=null&&Ti(Ae,me[ne],$,fe,$.sorted),E.min=$.min,E.max=$.max}});for(let E in g){let T=g[E],L=me[E];if(T.from==null&&(L==null||L.min==null)){let $=T.range(i,T.min==ct?null:T.min,T.max==-ct?null:T.max,E);T.min=$[0],T.max=$[1]}}}for(let E in g){let T=g[E];if(T.from!=null){let L=g[T.from];if(L.min==null)T.min=T.max=null;else{let $=T.range(i,L.min,L.max,E);T.min=$[0],T.max=$[1]}}}let S={},_=!1;for(let E in g){let T=g[E],L=V[E];if(L.min!=T.min||L.max!=T.max){L.min=T.min,L.max=T.max;let $=L.distr;L._min=$==3?Ei(L.min):$==4?hf(L.min,L.asinh):$==100?L.fwd(L.min):L.min,L._max=$==3?Ei(L.max):$==4?hf(L.max,L.asinh):$==100?L.fwd(L.max):L.max,S[E]=_=!0}}if(_){P.forEach((E,T)=>{o==2?T>0&&S.y&&(E._paths=null):S[E.scale]&&(E._paths=null)});for(let E in S)lr=!0,jt("setScale",E);be&&K.left>=0&&(or=zt=!0)}for(let E in me)me[E]=null}function Pu(g){let S=zf(Mt-1,0,Ft-1),_=zf(bt+1,0,Ft-1);for(;g[S]==null&&S>0;)S--;for(;g[_]==null&&_0){let g=P.some(S=>S._focus)&&Nn!=xt.alpha;g&&(v.globalAlpha=Nn=xt.alpha),P.forEach((S,_)=>{if(_>0&&S.show&&(js(_,!1),js(_,!0),S._paths==null)){let E=Nn;Nn!=S.alpha&&(v.globalAlpha=Nn=S.alpha);let T=o==2?[0,t[_][0].length-1]:Pu(t[_]);S._paths=S.paths(i,_,T[0],T[1]),Nn!=E&&(v.globalAlpha=Nn=E)}}),P.forEach((S,_)=>{if(_>0&&S.show){let E=Nn;Nn!=S.alpha&&(v.globalAlpha=Nn=S.alpha),S._paths!=null&&Pl(_,!1);{let T=S._paths!=null?S._paths.gaps:null,L=S.points.show(i,_,Mt,bt,T),$=S.points.filter(i,_,L,T);(L||$)&&(S.points._paths=S.points.paths(i,_,Mt,bt,$),Pl(_,!0))}Nn!=E&&(v.globalAlpha=Nn=E),jt("drawSeries",_)}}),g&&(v.globalAlpha=Nn=1)}}function js(g,S){let _=S?P[g].points:P[g];_._stroke=_.stroke(i,g),_._fill=_.fill(i,g)}function Pl(g,S){let _=S?P[g].points:P[g],{stroke:E,fill:T,clip:L,flags:$,_stroke:q=_._stroke,_fill:ne=_._fill,_width:ue=_.width}=_._paths;ue=ft(ue*Je,3);let fe=null,he=ue%2/2;S&&ne==null&&(ne=ue>0?"#fff":q);let Ae=_.pxAlign==1&&he>0;if(Ae&&v.translate(he,he),!S){let Ge=ln-ue/2,Ue=mn-ue/2,je=Yt+ue,Te=vn+ue;fe=new Path2D,fe.rect(Ge,Ue,je,Te)}S?Il(q,ue,_.dash,_.cap,ne,E,T,$,L):Al(g,q,ue,_.dash,_.cap,ne,E,T,$,fe,L),Ae&&v.translate(-he,-he)}function Al(g,S,_,E,T,L,$,q,ne,ue,fe){let he=!1;ne!=0&&Z.forEach((Ae,Ge)=>{if(Ae.series[0]==g){let Ue=P[Ae.series[1]],je=t[Ae.series[1]],Te=(Ue._paths||ko).band;rs(Te)&&(Te=Ae.dir==1?Te[0]:Te[1]);let ke,st=null;Ue.show&&Te&&Z0(je,Mt,bt)?(st=Ae.fill(i,Ge)||L,ke=Ue._paths.clip):Te=null,Il(S,_,E,T,st,$,q,ne,ue,fe,ke,Te),he=!0}}),he||Il(S,_,E,T,L,$,q,ne,ue,fe)}const Mi=kl|Of;function Il(g,S,_,E,T,L,$,q,ne,ue,fe,he){Fo(g,S,_,E,T),(ne||ue||he)&&(v.save(),ne&&v.clip(ne),ue&&v.clip(ue)),he?(q&Mi)==Mi?(v.clip(he),fe&&v.clip(fe),$e(T,$),bi(g,L,S)):q&Of?($e(T,$),v.clip(he),bi(g,L,S)):q&kl&&(v.save(),v.clip(he),fe&&v.clip(fe),$e(T,$),v.restore(),bi(g,L,S)):($e(T,$),bi(g,L,S)),(ne||ue||he)&&v.restore()}function bi(g,S,_){_>0&&(S instanceof Map?S.forEach((E,T)=>{v.strokeStyle=ls=T,v.stroke(E)}):S!=null&&g&&v.stroke(S))}function $e(g,S){S instanceof Map?S.forEach((_,E)=>{v.fillStyle=Hr=E,v.fill(_)}):S!=null&&g&&v.fill(S)}function jo(g,S,_,E){let T=W[g],L;if(E<=0)L=[0,0];else{let $=T._space=T.space(i,g,S,_,E),q=T._incrs=T.incrs(i,g,S,_,E,$);L=S1(S,_,q,E,$)}return T._found=L}function Ws(g,S,_,E,T,L,$,q,ne,ue){let fe=$%2/2;k==1&&v.translate(fe,fe),Fo(q,$,ne,ue,q),v.beginPath();let he,Ae,Ge,Ue,je=T+(E==0||E==3?-L:L);_==0?(Ae=T,Ue=je):(he=T,Ge=je);for(let Te=0;Te{if(!_.show)return;let T=V[_.scale];if(T.min==null){_._show&&(S=!1,_._show=!1,ci(!1));return}else _._show||(S=!1,_._show=!0,ci(!1));let L=_.side,$=L%2,{min:q,max:ne}=T,[ue,fe]=jo(E,q,ne,$==0?Pe:ce);if(fe==0)return;let he=T.distr==2,Ae=_._splits=_.splits(i,E,q,ne,ue,fe,he),Ge=T.distr==2?Ae.map(ke=>ur[ke]):Ae,Ue=T.distr==2?ur[Ae[1]]-ur[Ae[0]]:ue,je=_._values=_.values(i,_.filter(i,Ge,E,fe,Ue),E,fe,Ue);_._rotate=L==2?_.rotate(i,je,E,fe):0;let Te=_._size;_._size=Ar(_.size(i,je,E,g)),Te!=null&&_._size!=Te&&(S=!1)}),S}function Wo(g){let S=!0;return Io.forEach((_,E)=>{let T=_(i,E,An,g);T!=Ir[E]&&(S=!1),Ir[E]=T}),S}function Bo(){for(let g=0;gur[xn]):Ge,je=fe.distr==2?ur[Ge[1]]-ur[Ge[0]]:ne,Te=S.ticks,ke=S.border,st=Te.show?Te.size:0,yt=Jt(st*Je),Wt=Jt((S.alignTo==2?S._size-st-S.gap:S.gap)*Je),tt=S._rotate*-Ja/180,wt=b(S._pos*Je),jn=(yt+Wt)*q,at=wt+jn;L=E==0?at:0,T=E==1?at:0;let cn=S.font[0],Jn=S.align==1?gl:S.align==2?cf:tt>0?gl:tt<0?cf:E==0?"center":_==3?cf:gl,pr=tt||E==1?"middle":_==2?po:Tp;os(cn,$,Jn,pr);let Tn=S.font[1]*S.lineGap,Wn=Ge.map(xn=>b(d(xn,fe,he,Ae))),Bn=S._values;for(let xn=0;xn{_>0&&(S._paths=null,g&&(o==1?(S.min=null,S.max=null):S.facets.forEach(E=>{E.min=null,E.max=null})))})}let Oi=!1,Li=!1,Xn=[];function ei(){Li=!1;for(let g=0;g0&&queueMicrotask(ei)}i.batch=as;function Pi(){if(qr&&(Fs(),qr=!1),lr&&(ar(),lr=!1),Jr){if(mt(z,gl,qe),mt(z,po,et),mt(z,vo,Pe),mt(z,yo,ce),mt(R,gl,qe),mt(R,po,et),mt(R,vo,Pe),mt(R,yo,ce),mt(x,vo,rn),mt(x,yo,sr),w.width=Jt(rn*Je),w.height=Jt(sr*Je),W.forEach(({_el:g,_show:S,_size:_,_pos:E,side:T})=>{if(g!=null)if(S){let L=T===3||T===0?_:0,$=T%2==1;mt(g,$?"left":"top",E-L),mt(g,$?"width":"height",_),mt(g,$?"top":"left",$?et:qe),mt(g,$?"height":"width",$?ce:Pe),Df(g,Ms)}else wr(g,Ms)}),ls=Hr=bl=Di=Qn=Ol=In=Ll=Hs=null,Nn=1,gs(!0),qe!=sn||et!=kn||Pe!=Gt||ce!=Rt){ci(!1);let g=Pe/Gt,S=ce/Rt;if(be&&!or&&K.left>=0){K.left*=g,K.top*=S,kr&&oi(kr,Jt(K.left),0,Pe,ce),Ai&&oi(Ai,0,Jt(K.top),Pe,ce);for(let _=0;_=0&&it.width>0){it.left*=g,it.width*=g,it.top*=S,it.height*=S;for(let _ in Vl)mt(di,_,it[_])}sn=qe,kn=et,Gt=Pe,Rt=ce}jt("setSize"),Jr=!1}rn>0&&sr>0&&(v.clearRect(0,0,w.width,w.height),jt("drawClear"),re.forEach(g=>g()),jt("draw")),it.show&&Zr&&(cr(it),Zr=!1),be&&or&&(hi(null,!0,!1),or=!1),H.show&&H.live&&zt&&(ps(),zt=!1),p||(p=!0,i.status=1,jt("ready")),ot=!1,Oi=!1}i.redraw=(g,S)=>{lr=S||!1,g!==!1?fr(G,Y.min,Y.max):Hn()};function Cr(g,S){let _=V[g];if(_.from==null){if(Ft==0){let E=_.range(i,S.min,S.max,g);S.min=E[0],S.max=E[1]}if(S.min>S.max){let E=S.min;S.min=S.max,S.max=E}if(Ft>1&&S.min!=null&&S.max!=null&&S.max-S.min<1e-16)return;g==G&&_.distr==2&&Ft>0&&(S.min=Gr(S.min,t[0]),S.max=Gr(S.max,t[0]),S.min==S.max&&S.max++),me[g]=S,qr=!0,Hn()}}i.setScale=Cr;let Fl,Bs,kr,Ai,jl,us,fi,Ii,Hi,Fi,Ke,rt,ti=!1;const Qt=K.drag;let Nt=Qt.x,Et=Qt.y;be&&(K.x&&(Fl=Lr(I0,R)),K.y&&(Bs=Lr(H0,R)),Y.ori==0?(kr=Fl,Ai=Bs):(kr=Bs,Ai=Fl),Ke=K.left,rt=K.top);const it=i.select=Vt({show:!0,over:!0,left:0,width:0,top:0,height:0},l.select),di=it.show?Lr(A0,it.over?R:z):null;function cr(g,S){if(it.show){for(let _ in g)it[_]=g[_],_ in Vl&&mt(di,_,g[_]);S!==!1&&jt("setSelect")}}i.setSelect=cr;function Wl(g){if(P[g].show)xe&&Df(Oe[g],Ms);else if(xe&&wr(Oe[g],Ms),be){let _=un?vt[0]:vt[g];_!=null&&oi(_,-10,-10,Pe,ce)}}function fr(g,S,_){Cr(g,{min:S,max:_})}function dr(g,S,_,E){S.focus!=null&&Bl(g),S.show!=null&&P.forEach((T,L)=>{L>0&&(g==L||g==null)&&(T.show=S.show,Wl(L),o==2?(fr(T.facets[0].scale,null,null),fr(T.facets[1].scale,null,null)):fr(T.scale,null,null),Hn())}),_!==!1&&jt("setSeries",g,S),E&&ms("setSeries",i,g,S)}i.setSeries=dr;function Us(g,S){Vt(Z[g],S)}function Vs(g,S){g.fill=Ve(g.fill||null),g.dir=Xe(g.dir,-1),S=S??Z.length,Z.splice(S,0,g)}function Uo(g){g==null?Z.length=0:Z.splice(g,1)}i.addBand=Vs,i.setBand=Us,i.delBand=Uo;function Fn(g,S){P[g].alpha=S,be&&vt[g]!=null&&(vt[g].style.opacity=S),xe&&Oe[g]&&(Oe[g].style.opacity=S)}let Dn,Rr,hr;const ji={focus:!0};function Bl(g){if(g!=hr){let S=g==null,_=xt.alpha!=1;P.forEach((E,T)=>{if(o==1||T>0){let L=S||T==0||T==g;E._focus=S?null:L,_&&Fn(T,L?1:xt.alpha)}}),hr=g,_&&Hn()}}xe&&_t&&Ze(Op,_e,g=>{K._lock||(wn(g),hr!=null&&dr(null,ji,!0,Dt.setSeries))});function qn(g,S,_){let E=V[S];_&&(g=g/Je-(E.ori==1?et:qe));let T=Pe;E.ori==1&&(T=ce,g=T-g),E.dir==-1&&(g=T-g);let L=E._min,$=E._max,q=g/T,ne=L+($-L)*q,ue=E.distr;return ue==3?_l(10,ne):ue==4?tw(ne,E.asinh):ue==100?E.bwd(ne):ne}function cs(g,S){let _=qn(g,G,S);return Gr(_,t[0],Mt,bt)}i.valToIdx=g=>Gr(g,t[0]),i.posToIdx=cs,i.posToVal=qn,i.valToPos=(g,S,_)=>V[S].ori==0?u(g,V[S],_?Yt:Pe,_?ln:0):f(g,V[S],_?vn:ce,_?mn:0),i.setCursor=(g,S,_)=>{Ke=g.left,rt=g.top,hi(null,S,_)};function fs(g,S){mt(di,gl,it.left=g),mt(di,vo,it.width=S)}function Ul(g,S){mt(di,po,it.top=g),mt(di,yo,it.height=S)}let ds=Y.ori==0?fs:Ul,hs=Y.ori==1?fs:Ul;function Iu(){if(xe&&H.live)for(let g=o==2?1:0;g{D[E]=_}):sw(g.idx)||D.fill(g.idx),H.idx=D[0]),xe&&H.live){for(let _=0;_0||o==1&&!At)&&Hu(_,D[_]);Iu()}zt=!1,S!==!1&&jt("setLegend")}i.setLegend=ps;function Hu(g,S){let _=P[g],E=g==0&&Ce==2?ur:t[g],T;At?T=_.values(i,g,S)??It:(T=_.value(i,S==null?null:E[S],g,S),T=T==null?It:{_:T}),H.values[g]=T}function hi(g,S,_){Hi=Ke,Fi=rt,[Ke,rt]=K.move(i,Ke,rt),K.left=Ke,K.top=rt,be&&(kr&&oi(kr,Jt(Ke),0,Pe,ce),Ai&&oi(Ai,0,Jt(rt),Pe,ce));let E,T=Mt>bt;Dn=ct,Rr=null;let L=Y.ori==0?Pe:ce,$=Y.ori==1?Pe:ce;if(Ke<0||Ft==0||T){E=K.idx=null;for(let q=0;q0&&st.show){let jn=tt==null?-10:tt==E?ue:ae(o==1?t[0][tt]:t[ke][0][tt],Y,L,0),at=wt==null?-10:ye(wt,o==1?V[st.scale]:V[st.facets[1].scale],$,0);if(_t&&wt!=null){let cn=Y.ori==1?Ke:rt,Jn=Zt(xt.dist(i,ke,tt,at,cn));if(Jn=0?1:-1,Bn=Tn>=0?1:-1;Bn==Wn&&(Bn==1?pr==1?wt>=Tn:wt<=Tn:pr==1?wt<=Tn:wt>=Tn)&&(Dn=Jn,Rr=ke)}else Dn=Jn,Rr=ke}}if(zt||un){let cn,Jn;Y.ori==0?(cn=jn,Jn=at):(cn=at,Jn=jn);let pr,Tn,Wn,Bn,Nr,xn,Bt=!0,Fr=We.bbox;if(Fr!=null){Bt=!1;let Ot=Fr(i,ke);Wn=Ot.left,Bn=Ot.top,pr=Ot.width,Tn=Ot.height}else Wn=cn,Bn=Jn,pr=Tn=We.size(i,ke);if(xn=We.fill(i,ke),Nr=We.stroke(i,ke),un)ke==Rr&&Dn<=xt.prox&&(fe=Wn,he=Bn,Ae=pr,Ge=Tn,Ue=Bt,je=xn,Te=Nr);else{let Ot=vt[ke];Ot!=null&&(Sn[ke]=Wn,Ht[ke]=Bn,jp(Ot,pr,Tn,Bt),Hp(Ot,xn,Nr),oi(Ot,Ar(Wn),Ar(Bn),Pe,ce))}}}}if(un){let ke=xt.prox,st=hr==null?Dn<=ke:Dn>ke||Rr!=hr;if(zt||st){let yt=vt[0];yt!=null&&(Sn[0]=fe,Ht[0]=he,jp(yt,Ae,Ge,Ue),Hp(yt,je,Te),oi(yt,Ar(fe),Ar(he),Pe,ce))}}}if(it.show&&ti)if(g!=null){let[q,ne]=Dt.scales,[ue,fe]=Dt.match,[he,Ae]=g.cursor.sync.scales,Ge=g.cursor.drag;if(Nt=Ge._x,Et=Ge._y,Nt||Et){let{left:Ue,top:je,width:Te,height:ke}=g.select,st=g.scales[he].ori,yt=g.posToVal,Wt,tt,wt,jn,at,cn=q!=null&&ue(q,he),Jn=ne!=null&&fe(ne,Ae);cn&&Nt?(st==0?(Wt=Ue,tt=Te):(Wt=je,tt=ke),wt=V[q],jn=ae(yt(Wt,he),wt,L,0),at=ae(yt(Wt+tt,he),wt,L,0),ds(Yr(jn,at),Zt(at-jn))):ds(0,L),Jn&&Et?(st==1?(Wt=Ue,tt=Te):(Wt=je,tt=ke),wt=V[ne],jn=ye(yt(Wt,Ae),wt,$,0),at=ye(yt(Wt+tt,Ae),wt,$,0),hs(Yr(jn,at),Zt(at-jn))):hs(0,$)}else $l()}else{let q=Zt(Hi-jl),ne=Zt(Fi-us);if(Y.ori==1){let Ae=q;q=ne,ne=Ae}Nt=Qt.x&&q>=Qt.dist,Et=Qt.y&&ne>=Qt.dist;let ue=Qt.uni;ue!=null?Nt&&Et&&(Nt=q>=ue,Et=ne>=ue,!Nt&&!Et&&(ne>q?Et=!0:Nt=!0)):Qt.x&&Qt.y&&(Nt||Et)&&(Nt=Et=!0);let fe,he;Nt&&(Y.ori==0?(fe=fi,he=Ke):(fe=Ii,he=rt),ds(Yr(fe,he),Zt(he-fe)),Et||hs(0,$)),Et&&(Y.ori==1?(fe=fi,he=Ke):(fe=Ii,he=rt),hs(Yr(fe,he),Zt(he-fe)),Nt||ds(0,L)),!Nt&&!Et&&(ds(0,0),hs(0,0))}if(Qt._x=Nt,Qt._y=Et,g==null){if(_){if(Ks!=null){let[q,ne]=Dt.scales;Dt.values[0]=q!=null?qn(Y.ori==0?Ke:rt,q):null,Dt.values[1]=ne!=null?qn(Y.ori==1?Ke:rt,ne):null}ms(ff,i,Ke,rt,Pe,ce,E)}if(_t){let q=_&&Dt.setSeries,ne=xt.prox;hr==null?Dn<=ne&&dr(Rr,ji,!0,q):Dn>ne?dr(null,ji,!0,q):Rr!=hr&&dr(Rr,ji,!0,q)}}zt&&(H.idx=E,ps()),S!==!1&&jt("setCursor")}let ni=null;Object.defineProperty(i,"rect",{get(){return ni==null&&gs(!1),ni}});function gs(g=!1){g?ni=null:(ni=R.getBoundingClientRect(),jt("syncRect",ni))}function Vo(g,S,_,E,T,L,$){K._lock||ti&&g!=null&&g.movementX==0&&g.movementY==0||($s(g,S,_,E,T,L,$,!1,g!=null),g!=null?hi(null,!0,!0):hi(S,!0,!1))}function $s(g,S,_,E,T,L,$,q,ne){if(ni==null&&gs(!1),wn(g),g!=null)_=g.clientX-ni.left,E=g.clientY-ni.top;else{if(_<0||E<0){Ke=-10,rt=-10;return}let[ue,fe]=Dt.scales,he=S.cursor.sync,[Ae,Ge]=he.values,[Ue,je]=he.scales,[Te,ke]=Dt.match,st=S.axes[0].side%2==1,yt=Y.ori==0?Pe:ce,Wt=Y.ori==1?Pe:ce,tt=st?L:T,wt=st?T:L,jn=st?E:_,at=st?_:E;if(Ue!=null?_=Te(ue,Ue)?d(Ae,V[ue],yt,0):-10:_=yt*(jn/tt),je!=null?E=ke(fe,je)?d(Ge,V[fe],Wt,0):-10:E=Wt*(at/wt),Y.ori==1){let cn=_;_=E,E=cn}}ne&&(S==null||S.cursor.event.type==ff)&&((_<=1||_>=Pe-1)&&(_=Ts(_,Pe)),(E<=1||E>=ce-1)&&(E=Ts(E,ce))),q?(jl=_,us=E,[fi,Ii]=K.move(i,_,E)):(Ke=_,rt=E)}const Vl={width:0,height:0,left:0,top:0};function $l(){cr(Vl,!1)}let $o,Go,Gs,Yo;function Ko(g,S,_,E,T,L,$){ti=!0,Nt=Et=Qt._x=Qt._y=!1,$s(g,S,_,E,T,L,$,!0,!1),g!=null&&(Ze(df,Rf,Qo,!1),ms(Mp,i,fi,Ii,Pe,ce,null));let{left:q,top:ne,width:ue,height:fe}=it;$o=q,Go=ne,Gs=ue,Yo=fe}function Qo(g,S,_,E,T,L,$){ti=Qt._x=Qt._y=!1,$s(g,S,_,E,T,L,$,!1,!0);let{left:q,top:ne,width:ue,height:fe}=it,he=ue>0||fe>0,Ae=$o!=q||Go!=ne||Gs!=ue||Yo!=fe;if(he&&Ae&&cr(it),Qt.setScale&&he&&Ae){let Ge=q,Ue=ue,je=ne,Te=fe;if(Y.ori==1&&(Ge=ne,Ue=fe,je=q,Te=ue),Nt&&fr(G,qn(Ge,G),qn(Ge+Ue,G)),Et)for(let ke in V){let st=V[ke];ke!=G&&st.from==null&&st.min!=ct&&fr(ke,qn(je+Te,ke),qn(je,ke))}$l()}else K.lock&&(K._lock=!K._lock,hi(S,!0,g!=null));g!=null&&(nn(df,Rf),ms(df,i,Ke,rt,Pe,ce,null))}function Xo(g,S,_,E,T,L,$){if(K._lock)return;wn(g);let q=ti;if(ti){let ne=!0,ue=!0,fe=10,he,Ae;Y.ori==0?(he=Nt,Ae=Et):(he=Et,Ae=Nt),he&&Ae&&(ne=Ke<=fe||Ke>=Pe-fe,ue=rt<=fe||rt>=ce-fe),he&&ne&&(Ke=Ke{let T=Dt.match[2];_=T(i,S,_),_!=-1&&dr(_,E,!0,!1)},be&&(Ze(Mp,R,Ko),Ze(ff,R,Vo),Ze(bp,R,g=>{wn(g),gs(!1)}),Ze(Op,R,Xo),Ze(Lp,R,qo),Lf.add(i),i.syncRect=gs);const Ys=i.hooks=l.hooks||{};function jt(g,S,_){Li?Xn.push([g,S,_]):g in Ys&&Ys[g].forEach(E=>{E.call(null,i,S,_)})}(l.plugins||[]).forEach(g=>{for(let S in g.hooks)Ys[S]=(Ys[S]||[]).concat(g.hooks[S])});const Zo=(g,S,_)=>_,Dt=Vt({key:null,setSeries:!1,filters:{pub:$p,sub:$p},scales:[G,P[1]?P[1].scale:null],match:[Gp,Gp,Zo],values:[null,null]},K.sync);Dt.match.length==2&&Dt.match.push(Zo),K.sync=Dt;const Ks=Dt.key,pi=_m(Ks);function ms(g,S,_,E,T,L,$){Dt.filters.pub(g,S,_,E,T,L,$)&&pi.pub(g,S,_,E,T,L,$)}pi.sub(i);function ea(g,S,_,E,T,L,$){Dt.filters.sub(g,S,_,E,T,L,$)&&Wi[g](null,S,_,E,T,L,$)}i.pub=ea;function ta(){pi.unsub(i),Lf.delete(i),Pn.clear(),Tf(cu,Sl,Jo),m.remove(),_e==null||_e.remove(),jt("destroy")}i.destroy=ta;function Qs(){jt("init",l,t),Ho(t||l.data,!1),me[G]?Cr(G,me[G]):ss(),Zr=it.show&&(it.width>0||it.height>0),or=zt=!0,lt(l.width,l.height)}return P.forEach(Ri),W.forEach(Ao),r?r instanceof HTMLElement?(r.appendChild(m),Qs()):r(i,Qs):Qs(),i}Ln.assign=Vt;Ln.fmtNum=Zf;Ln.rangeNum=fu;Ln.rangeLog=ku;Ln.rangeAsinh=qf;Ln.orient=As;Ln.pxRatio=Je;Ln.join=dw;Ln.fmtDate=td,Ln.tzDate=Ew;Ln.sync=_m;{Ln.addGap=s1,Ln.clipGaps=Du;let l=Ln.paths={points:Dm};l.linear=zm,l.stepped=a1,l.bars=u1,l.spline=f1}const _1=6e3;class E1{constructor(t=_1){fo(this,"t");fo(this,"v");fo(this,"len",0);fo(this,"head",0);this.t=new Float64Array(t),this.v=new Float64Array(t)}push(t,r){const i=this.t.length;this.t[this.head]=t,this.v[this.head]=r,this.head=(this.head+1)%i,this.len=t&&(u[d]=this.t[m],f[d]=this.v[m],d++)}return{t:u.subarray(0,d),v:f.subarray(0,d)}}last(){if(this.len===0)return null;const t=this.t.length;return this.v[(this.head-1+t)%t]}}const Af=new Map;function C1(l){let t=Af.get(l);return t||(t=new E1,Af.set(l,t)),t}function Lm(l,t){const r=C1(l);for(const[i,o]of t)r.push(i,o)}function Pm(l,t=-1/0){const r=Af.get(l);return r?r.read(t):{t:new Float64Array(0),v:new Float64Array(0)}}const xl=new Map;let Za=[];function Am(){Za.forEach(l=>l())}function k1(l){xl.set(l,(xl.get(l)||0)+1),Am()}function R1(l){const t=(xl.get(l)||0)-1;t<=0?xl.delete(l):xl.set(l,t),Am()}function N1(){return Array.from(xl.keys())}function D1(l){return Za.push(l),()=>{Za=Za.filter(t=>t!==l)}}const pg=3e3;let yl=[],eu=[];function T1(l){l.length&&(yl=yl.concat(l),yl.length>pg&&(yl=yl.slice(-pg)),eu.forEach(t=>t()))}function z1(){return yl}function M1(l){return eu.push(l),()=>{eu=eu.filter(t=>t!==l)}}let tu=0,nu=[];function gg(l){tu+=l?1:-1,tu<0&&(tu=0),nu.forEach(t=>t())}function b1(){return tu>0}function O1(l){return nu.push(l),()=>{nu=nu.filter(t=>t!==l)}}let Ls=null,vf=null;function L1(){return`${location.protocol==="https:"?"wss":"ws"}://${location.host}/api/monitor/stream`}function mg(){Ls&&Ls.readyState===WebSocket.OPEN&&Ls.send(JSON.stringify({type:"subscribe",signals:N1()}))}function vg(){Ls&&Ls.readyState===WebSocket.OPEN&&Ls.send(JSON.stringify({type:"raw",enabled:b1()}))}function Im(){const l=new WebSocket(L1());Ls=l,l.onopen=()=>{gn.getState().setConnected(!0),mg(),vg()},l.onclose=()=>{gn.getState().setConnected(!1),vf==null&&(vf=window.setTimeout(()=>{vf=null,Im()},1e3))},l.onerror=()=>l.close(),l.onmessage=r=>{let i;try{i=JSON.parse(r.data)}catch{return}const o=gn.getState();switch(i.type){case"meta":o.setMeta(i.signals,i.pairs),o.setMotors(i.motors);break;case"motors":o.setMotors(i.motors),i.status&&o.setStatus(i.status);break;case"samples":for(const[u,f]of Object.entries(i.data))Lm(u,f);break;case"raw":T1(i.frames);break}};let t=null;D1(()=>{t==null&&(t=window.setTimeout(()=>{t=null,mg()},80))}),O1(vg)}async function P1(l,t=600){return l.length?(await fetch(`/api/monitor/snapshot?signals=${l.join(",")}&n=${t}`)).json():{}}async function A1(){try{return(await(await fetch("/api/monitor/motor-types")).json()).types||[]}catch{return[]}}async function I1(l,t){await fetch("/api/monitor/motor-type",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({motorId:l,motorType:t})})}const H1={pos:"#58a6ff",vel:"#3fb950",torque:"#d29922",kp:"#bc8cff",kd:"#f778ba",vel_limit:"#56d4dd",torque_limit:"#e3b341",t_mos:"#ff7b72",t_rotor:"#ffa657",status_code:"#8b949e"};function F1(l){return H1[l]||"#8b949e"}function ru(l){const t=F1(l.field);return l.source==="cmd"?j1(t,.15):t}function If(l){const t=l.split(":");return t.length>=3?`${t[1]} ${t[2]}`:l}function yg(l){return l.includes(":cmd.")}const wg=["pos","vel","torque","kp","kd","t_mos","t_rotor"];function j1(l,t){const r=l.replace("#",""),i=Math.min(255,Math.round(parseInt(r.slice(0,2),16)+255*t)),o=Math.min(255,Math.round(parseInt(r.slice(2,4),16)+255*t)),u=Math.min(255,Math.round(parseInt(r.slice(4,6),16)+255*t));return`rgb(${i},${o},${u})`}function Rl(l,t=3){return l==null||Number.isNaN(l)?"—":l.toFixed(t)}const Sg=2e3;function W1(l,t){const r=l.map(f=>Pm(f,t)),i=new Set;for(const f of r)for(let d=0;df-d);if(o.length>Sg){const f=Math.ceil(o.length/Sg);o=o.filter((d,p)=>p%f===0)}const u=[o];for(const f of r){const d=new Array(o.length).fill(null);let p=0,m=null;for(let w=0;wk.ensurePlot),r=gn(k=>k.removeSignalFromPlot),i=gn(k=>k.setPlotConfig),o=gn(k=>k.plotConfigs[l]),u=gn(k=>k.signals);j.useEffect(()=>{t(l)},[l,t]);const f=(o==null?void 0:o.signals)??[],d=(o==null?void 0:o.duration)??10,p=f.join("|"),{setNodeRef:m,isOver:w}=o0({id:`plot:${l}`,data:{panelId:l}}),v=j.useRef(null),x=j.useRef(null),z=j.useRef(0);j.useEffect(()=>{if(!v.current)return;const k=v.current,b=new Map(u.map(Z=>[Z.id,Z])),B=[{label:"t"},...f.map(Z=>{const G=b.get(Z),ee=G?ru(G):"#8b949e";return{label:If(Z),stroke:ee,width:1.5,dash:yg(Z)?[6,4]:void 0,points:{show:!1}}})],P={width:k.clientWidth||400,height:k.clientHeight||220,legend:{show:!1},series:B,cursor:{y:!1,points:{show:!0}},scales:{x:{time:!1}},axes:[{stroke:"#8b949e",grid:{stroke:"rgba(139,148,158,0.12)"},ticks:{stroke:"rgba(139,148,158,0.2)"},values:(Z,G)=>G.map(ee=>(ee-z.current).toFixed(1)+"s")},{stroke:"#8b949e",grid:{stroke:"rgba(139,148,158,0.12)"},ticks:{stroke:"rgba(139,148,158,0.2)"}}]},W=new Ln(P,[[],...f.map(()=>[])],k);x.current=W;const V=new ResizeObserver(()=>{W.setSize({width:k.clientWidth,height:k.clientHeight})});return V.observe(k),()=>{V.disconnect(),W.destroy(),x.current=null}},[p,u.length]),j.useEffect(()=>{if(!f.length)return;f.forEach(k1);let k=!1;return P1(f,1200).then(b=>{if(!k)for(const[B,P]of Object.entries(b))Lm(B,P)}),()=>{k=!0,f.forEach(R1)}},[p]),j.useEffect(()=>{let k=0;const b=()=>{const B=x.current;if(B&&f.length){let P=0;for(const V of f){const Z=Pm(V);Z.t.length&&(P=Math.max(P,Z.t[Z.t.length-1]))}z.current=P;const W=W1(f,P-d);B.setData(W,!1),B.setScale("x",{min:P-d,max:P})}k=requestAnimationFrame(b)};return k=requestAnimationFrame(b),()=>cancelAnimationFrame(k)},[p,d]);const R=j.useMemo(()=>new Map(u.map(k=>[k.id,k])),[u]);return U.jsxs("div",{className:"panel plot-panel",ref:m,children:[U.jsxs("div",{className:"plot-toolbar",children:[U.jsx("span",{className:"muted",children:"window"}),U.jsx("select",{value:d,onChange:k=>i(l,{duration:Number(k.target.value)}),children:[5,10,20,30,60].map(k=>U.jsxs("option",{value:k,children:[k,"s"]},k))}),U.jsx("div",{className:"legend",children:f.map(k=>{const b=R.get(k);return U.jsxs("span",{className:"legend-chip",style:{borderColor:b?ru(b):"#555"},children:[U.jsx("span",{className:"legend-swatch",style:{background:b?ru(b):"#555",borderStyle:yg(k)?"dashed":"solid"}}),If(k),U.jsx("button",{className:"legend-x",onClick:()=>r(l,k),children:"×"})]},k)})})]}),U.jsx("div",{className:"plot-host"+(w?" drop-over":""),ref:v,children:f.length===0&&U.jsx("div",{className:"drop-hint",children:"Drag signals here to plot — drop cmd onto fb to overlay"})})]})}const yf=[["pos","cmd p"],["vel","cmd v"],["kp","kp"],["kd","kd"],["torque","cmd τ"]],wf=[["pos","act p"],["vel","act v"],["torque","act τ"],["t_mos","Tmos"],["t_rotor","Trot"]];function U1(){const l=gn(t=>t.motors);return U.jsx("div",{className:"panel table-panel",children:U.jsxs("table",{className:"motor-table",children:[U.jsx("thead",{children:U.jsxs("tr",{children:[U.jsx("th",{children:"Motor"}),U.jsx("th",{children:"Mode"}),U.jsx("th",{children:"Status"}),yf.map(([t,r])=>U.jsx("th",{className:"cmd-col",children:r},"c"+t)),wf.map(([t,r])=>U.jsx("th",{children:r},"f"+t))]})}),U.jsxs("tbody",{children:[l.length===0&&U.jsx("tr",{children:U.jsx("td",{colSpan:3+yf.length+wf.length,className:"muted center",children:"Waiting for traffic…"})}),l.map(t=>U.jsxs("tr",{children:[U.jsxs("td",{className:"mono",children:["m",t.motorId]}),U.jsx("td",{className:"muted",children:t.mode||"—"}),U.jsx("td",{children:U.jsx("span",{className:"status-pill "+(t.status==="ENABLED"?"ok":t.status==="DISABLED"?"off":"warn"),children:t.status||"—"})}),yf.map(([r])=>U.jsx("td",{className:"mono cmd-col",children:Rl(t.cmd[r],r==="kp"?0:3)},"c"+r)),wf.map(([r])=>U.jsx("td",{className:"mono",children:Rl(t.fb[r],r.startsWith("t_")?1:3)},"f"+r))]},`${t.bus}:${t.motorId}`))]})]})})}function Sf({label:l,cmd:t,act:r,unit:i,digits:o=2}){return U.jsxs("div",{className:"metric",children:[U.jsxs("div",{className:"metric-label",children:[l," ",U.jsx("span",{className:"muted",children:i})]}),U.jsxs("div",{className:"metric-values",children:[U.jsx("span",{className:"metric-act",children:Rl(r,o)}),t!==void 0&&U.jsxs("span",{className:"metric-cmd",children:["⌖ ",Rl(t,o)]})]})]})}function V1(){const l=gn(r=>r.motors),t=gn(r=>r.motorTypes);return U.jsxs("div",{className:"panel cards-panel",children:[l.length===0&&U.jsx("div",{className:"muted center pad",children:"Waiting for traffic…"}),U.jsx("div",{className:"cards-grid",children:l.map(r=>U.jsxs("div",{className:"motor-card",children:[U.jsxs("div",{className:"motor-card-head",children:[U.jsxs("span",{className:"mono strong",children:["Motor ",r.motorId]}),U.jsx("span",{className:"status-pill "+(r.status==="ENABLED"?"ok":r.status==="DISABLED"?"off":"warn"),children:r.status||"—"})]}),U.jsxs("div",{className:"motor-card-sub",children:[U.jsx("span",{className:"muted",children:r.mode||"—"}),t.length>0&&U.jsxs("select",{className:"type-select",defaultValue:"",onChange:i=>i.target.value&&I1(r.motorId,i.target.value),title:"Override motor type used to scale this motor's values",children:[U.jsx("option",{value:"",children:"set type…"}),t.map(i=>U.jsx("option",{value:i,children:i},i))]})]}),U.jsx(Sf,{label:"Position",unit:"rad",cmd:r.cmd.pos,act:r.fb.pos,digits:3}),U.jsx(Sf,{label:"Velocity",unit:"rad/s",cmd:r.cmd.vel,act:r.fb.vel,digits:2}),U.jsx(Sf,{label:"Torque",unit:"Nm",cmd:r.cmd.torque,act:r.fb.torque,digits:2}),U.jsxs("div",{className:"temp-row",children:[U.jsxs("span",{children:["MOS ",Rl(r.fb.t_mos,1),"°"]}),U.jsxs("span",{children:["Rotor ",Rl(r.fb.t_rotor,1),"°"]})]})]},`${r.bus}:${r.motorId}`))})]})}function $1(l,t,r){const i=new Array(l);return new Proxy(i,{get(o,u,f){if(typeof u=="string"){const d=u.charCodeAt(0);if(d>=48&&d<=57){const p=+u;if(Number.isInteger(p)&&p>=0&&pi[w]!==m))&&(i=d,o=t(...d),r!=null&&r.onChange&&!(u&&r.skipInitialOnChange)&&r.onChange(o),u=!1),o}return f.updateDeps=d=>{i=d},f}function xg(l,t){if(l===void 0)throw new Error("Unexpected undefined");return l}const G1=(l,t)=>Math.abs(l-t)<1.01,Y1=(l,t,r)=>{let i;return function(...o){l.clearTimeout(i),i=l.setTimeout(()=>t.apply(this,o),r)}};let mo;const xf=()=>{if(mo!==void 0)return mo;if(typeof navigator>"u")return mo=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return mo=!0;const l=navigator.maxTouchPoints;return mo=navigator.platform==="MacIntel"&&l!==void 0&&l>0},_g=l=>{const{offsetWidth:t,offsetHeight:r}=l;return{width:t,height:r}},K1=l=>l,Q1=l=>{const t=Math.max(l.startIndex-l.overscan,0),i=Math.min(l.endIndex+l.overscan,l.count-1)-t+1,o=new Array(i);for(let u=0;u{const r=l.scrollElement;if(!r)return;const i=l.targetWindow;if(!i)return;const o=f=>{const{width:d,height:p}=f;t({width:Math.round(d),height:Math.round(p)})};if(o(_g(r)),!i.ResizeObserver)return()=>{};const u=new i.ResizeObserver(f=>{const d=()=>{const p=f[0];if(p!=null&&p.borderBoxSize){const m=p.borderBoxSize[0];if(m){o({width:m.inlineSize,height:m.blockSize});return}}o(_g(r))};l.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(d):d()});return u.observe(r,{box:"border-box"}),()=>{u.unobserve(r)}},hu={passive:!0},q1=typeof window>"u"?!0:"onscrollend"in window,J1=(l,t,r)=>{const i=l.scrollElement;if(!i)return;const o=l.targetWindow;if(!o)return;const u=l.options.useScrollendEvent&&q1;let f=0;const d=u?null:Y1(o,()=>t(f,!1),l.options.isScrollingResetDelay),p=v=>()=>{f=r(i),d==null||d(),t(f,v)},m=p(!0),w=p(!1);return i.addEventListener("scroll",m,hu),u&&i.addEventListener("scrollend",w,hu),()=>{i.removeEventListener("scroll",m),u&&i.removeEventListener("scrollend",w)}},Z1=(l,t)=>J1(l,t,r=>{const{horizontal:i,isRtl:o}=l.options;return i?r.scrollLeft*(o&&-1||1):r.scrollTop}),eS=(l,t,r)=>{if(r.options.useCachedMeasurements){const i=r.indexFromElement(l),o=r.options.getItemKey(i);return r.itemSizeCache.get(o)??r.options.estimateSize(i)}if(t!=null&&t.borderBoxSize){const i=t.borderBoxSize[0];if(i)return Math.round(i[r.options.horizontal?"inlineSize":"blockSize"])}if(!t){const i=r.indexFromElement(l),o=r.options.getItemKey(i),u=r.itemSizeCache.get(o);if(u!==void 0)return u}return l[r.options.horizontal?"offsetWidth":"offsetHeight"]},tS=(l,{adjustments:t=0,behavior:r},i)=>{var o,u;(u=(o=i.scrollElement)==null?void 0:o.scrollTo)==null||u.call(o,{[i.options.horizontal?"left":"top"]:l+t,behavior:r})},nS=tS;class rS{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var r,i,o;return((o=(i=(r=this.targetWindow)==null?void 0:r.performance)==null?void 0:i.now)==null?void 0:o.call(i))??Date.now()},this.observer=(()=>{let r=null;const i=()=>r||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:r=new this.targetWindow.ResizeObserver(o=>{o.forEach(u=>{const f=()=>{const d=u.target,p=this.indexFromElement(d);if(!d.isConnected){this.observer.unobserve(d);for(const[m,w]of this.elementsCache)if(w===d){this.elementsCache.delete(m);break}return}this.shouldMeasureDuringScroll(p)&&this.resizeItem(p,this.options.measureElement(d,u,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(f):f()})}));return{disconnect:()=>{var o;(o=i())==null||o.disconnect(),r=null},observe:o=>{var u;return(u=i())==null?void 0:u.observe(o,{box:"border-box"})},unobserve:o=>{var u;return(u=i())==null?void 0:u.unobserve(o)}}})(),this.range=null,this.setOptions=r=>{var i,o;const u={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:K1,rangeExtractor:Q1,onChange:()=>{},measureElement:eS,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const x in r){const z=r[x];z!==void 0&&(u[x]=z)}const f=this.options;let d=null,p=null,m=!1;if(f!==void 0&&f.enabled&&u.enabled&&u.anchorTo==="end"&&this.scrollElement!==null){const x=f.count,z=u.count,R=this.getMeasurements(),k=x>0?((i=R[0])==null?void 0:i.key)??f.getItemKey(0):null,b=x>0?((o=R[x-1])==null?void 0:o.key)??f.getItemKey(x-1):null;if(z!==x||x>0&&z>0&&(u.getItemKey(0)!==k||u.getItemKey(z-1)!==b)){m=!0;const W=x>0?this.getVirtualItemForOffset(this.getScrollOffset())??R[0]:null;W&&(d=[W.key,this.getScrollOffset()-W.start]);const V=u.followOnAppend===!0?"auto":u.followOnAppend||null;V&&z>x&&this.isAtEnd(f.scrollEndThreshold)&&(x===0||u.getItemKey(z-1)!==b)&&(p=V)}}this.options=u,m&&(this.pendingMin=0,this.itemSizeCacheVersion++);let w=!1,v=0;if(d&&this.scrollOffset!==null){const[x,z]=d,R=this.getMeasurements(),{count:k,getItemKey:b}=this.options;let B=0;for(;B{var i,o;(o=(i=this.options).onChange)==null||o.call(i,this,r)},this.maybeNotify=ml(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),r=>{this.notify(r)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(r=>r()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var r;const i=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==i){if(this.cleanup(),!i){this.maybeNotify();return}if(this.scrollElement=i,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((r=this.scrollElement)==null?void 0:r.window)??null,this.elementsCache.forEach(u=>{this.observer.observe(u)}),this.unsubs.push(this.options.observeElementRect(this,u=>{this.scrollRect=u,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(u,f)=>{this._intendedScrollOffset!==null&&Math.abs(u-this._intendedScrollOffset)<1.5&&(u=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=f?this.getScrollOffset(){this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},d=()=>{this._iosTouching=!1,!(!xf()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};u.addEventListener("touchstart",f,hu),u.addEventListener("touchend",d,hu),this.unsubs.push(()=>{u.removeEventListener("touchstart",f),u.removeEventListener("touchend",d),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const o=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,o&&this.scrollElement&&this.options.enabled){const[u,f,d,p]=o;u!==null&&!d&&(xf()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?p!==0&&(this._iosDeferredAdjustment+=p):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),d&&this.scrollToEnd({behavior:d})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const r=this.getScrollOffset(),i=this.getMaxScrollOffset();if(r<0||r>i)return;const o=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(r,{adjustments:this.scrollAdjustments+=o,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(r,i)=>{const o=new Map,u=new Map;for(let f=i-1;f>=0;f--){const d=r[f];if(o.has(d.lane))continue;const p=u.get(d.lane);if(p==null||d.end>p.end?u.set(d.lane,d):d.endf.end===d.end?f.index-d.index:f.end-d.end)[0]:void 0},this.getMeasurementOptions=ml(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(r,i,o,u,f,d,p)=>(this.prevLanes!==void 0&&this.prevLanes!==d&&(this.lanesChangedFlag=!0),this.prevLanes=d,this.pendingMin=null,{count:r,paddingStart:i,scrollMargin:o,getItemKey:u,enabled:f,lanes:d,laneAssignmentMode:p}),{key:!1}),this.getMeasurements=ml(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:r,paddingStart:i,scrollMargin:o,getItemKey:u,enabled:f,lanes:d,laneAssignmentMode:p},m)=>{const w=this.itemSizeCache;if(!f)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>r)for(const R of this.laneAssignments.keys())R>=r&&this.laneAssignments.delete(R);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(R=>{this.itemSizeCache.set(R.key,R.size)}));const v=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===r&&(this.lanesSettling=!1),d===1){const R=this.options.gap,k=r*2;let b=this._flatMeasurements;if(!b||b.length0&&W.set(b.subarray(0,v*2)),b=W,this._flatMeasurements=b}let B;if(v===0)B=i+o;else{const W=v-1;B=b[W*2]+b[W*2+1]+R}for(let W=v;W1){B=b;const ee=z[B],re=ee!==void 0?x[ee]:void 0;P=re?re.end+this.options.gap:i+o}else{const ee=this.options.lanes===1?x[R-1]:this.getFurthestMeasurement(x,R);P=ee?ee.end+this.options.gap:i+o,B=ee?ee.lane:R%this.options.lanes,this.options.lanes>1&&W&&this.laneAssignments.set(R,B)}const V=w.get(k),Z=typeof V=="number"?V:this.options.estimateSize(R),G=P+Z;x[R]={index:R,start:P,size:Z,end:G,key:k,lane:B},z[B]=R}return this.measurementsCache=x,x},{key:!1,debug:()=>this.options.debug}),this.calculateRange=ml(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(r,i,o,u)=>this.range=r.length>0&&i>0?iS({measurements:r,outerSize:i,scrollOffset:o,lanes:u,flat:u===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=ml(()=>{let r=null,i=null;const o=this.calculateRange();return o&&(r=o.startIndex,i=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,r,i]),[this.options.rangeExtractor,this.options.overscan,this.options.count,r,i]},(r,i,o,u,f)=>u===null||f===null?[]:r({startIndex:u,endIndex:f,overscan:i,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=r=>{const i=this.options.indexAttribute,o=r.getAttribute(i);return o?parseInt(o,10):(console.warn(`Missing attribute name '${i}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=r=>{var i;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const o=this.scrollState.index??((i=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:i.index);if(o!==void 0&&this.range){const u=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),f=Math.max(0,o-u),d=Math.min(this.options.count-1,o+u);return r>=f&&r<=d}return!0},this.measureElement=r=>{if(!r){this.elementsCache.forEach((f,d)=>{f.isConnected||(this.observer.unobserve(f),this.elementsCache.delete(d))});return}const i=this.indexFromElement(r),o=this.options.getItemKey(i),u=this.elementsCache.get(o);u!==r&&(u&&this.observer.unobserve(u),this.observer.observe(r),this.elementsCache.set(o,r)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(i)&&this.resizeItem(i,this.options.measureElement(r,void 0,this))},this.resizeItem=(r,i)=>{var o,u;if(r<0||r>=this.options.count)return;let f,d,p;const m=this._flatMeasurements;if(this.options.lanes===1&&m!==null)p=this.options.getItemKey(r),d=m[r*2],f=m[r*2+1];else{const x=this.measurementsCache[r];if(!x)return;p=x.key,d=x.start,f=x.size}const w=this.itemSizeCache.get(p)??f,v=i-w;if(v!==0){const x=this.options.anchorTo==="end"&&((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,z=x?this.getTotalSize():0,R=((u=this.scrollState)==null?void 0:u.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[r]??{index:r,key:p,start:d,size:f,end:d+f,lane:0},v,this):d[this.getVirtualIndexes(),this.getMeasurements()],(r,i)=>{const o=[];for(let u=0,f=r.length;uthis.options.debug}),this.getVirtualItemForOffset=r=>{const i=this.getMeasurements();if(i.length===0)return;const o=this._flatMeasurements,u=this.options.lanes===1&&o!=null,f=Hm(0,i.length-1,u?d=>o[d*2]:d=>xg(i[d]).start,r);return xg(i[f])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const r=this.scrollElement.document.documentElement;return this.options.horizontal?r.scrollWidth-this.scrollElement.innerWidth:r.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(r=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=r,this.getOffsetForAlignment=(r,i,o=0)=>{if(!this.scrollElement)return 0;const u=this.getSize(),f=this.getScrollOffset();i==="auto"&&(i=r>=f+u?"end":"start"),i==="center"?r+=(o-u)/2:i==="end"&&(r-=u);const d=this.getMaxScrollOffset();return Math.max(Math.min(d,r),0)},this.getOffsetForIndex=(r,i="auto")=>{r=Math.max(0,Math.min(r,this.options.count-1));const o=this.getSize(),u=this.getScrollOffset(),f=this.measurementsCache[r];if(!f)return;if(i==="auto")if(f.end>=u+o-this.options.scrollPaddingEnd)i="end";else if(f.start<=u+this.options.scrollPaddingStart)i="start";else return[u,i];if(i==="end"&&r===this.options.count-1)return[this.getMaxScrollOffset(),i];const d=i==="end"?f.end+this.options.scrollPaddingEnd:f.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(d,i,f.size),i]},this.scrollToOffset=(r,{align:i="start",behavior:o="auto"}={})=>{const u=this.getOffsetForAlignment(r,i),f=this.now();this.scrollState={index:null,align:i,behavior:o,startedAt:f,lastTargetOffset:u,stableFrames:0},this._scrollToOffset(u,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(r,{align:i="auto",behavior:o="auto"}={})=>{r=Math.max(0,Math.min(r,this.options.count-1));const u=this.getOffsetForIndex(r,i);if(!u)return;const[f,d]=u,p=this.now();this.scrollState={index:r,align:d,behavior:o,startedAt:p,lastTargetOffset:f,stableFrames:0},this._scrollToOffset(f,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(r,{behavior:i="auto"}={})=>{const o=this.getScrollOffset()+r,u=this.now();this.scrollState={index:null,align:"start",behavior:i,startedAt:u,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:r="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:r});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:r})},this.getTotalSize=()=>{var r;const i=this.getMeasurements();let o;if(i.length===0)o=this.options.paddingStart;else if(this.options.lanes===1){const u=i.length-1,f=this._flatMeasurements;f!=null?o=f[u*2]+f[u*2+1]:o=((r=i[u])==null?void 0:r.end)??0}else{const u=Array(this.options.lanes).fill(null);let f=i.length-1;for(;f>=0&&u.some(d=>d===null);){const d=i[f];u[d.lane]===null&&(u[d.lane]=d.end),f--}o=Math.max(...u.filter(d=>d!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const r=[];if(this.itemSizeCache.size===0)return r;const i=this.getMeasurements();for(const o of i)o&&this.itemSizeCache.has(o.key)&&r.push({index:o.index,key:o.key,start:o.start,size:o.size,end:o.end,lane:o.lane});return r},this._scrollToOffset=(r,{adjustments:i,behavior:o})=>{this._intendedScrollOffset=r+(i??0),this.options.scrollToFn(r,{behavior:o,adjustments:i},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}applyScrollAdjustment(t,r){t!==0&&(xf()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=t:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:r}))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const i=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,o=i?i[0]:this.scrollState.lastTargetOffset,u=1,f=o!==this.scrollState.lastTargetOffset;if(!f&&G1(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=u){this.getScrollOffset()!==o&&this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,f){const d=this.getSize()||600,p=Math.abs(o-this.getScrollOffset()),m=this.scrollState.behavior==="smooth"&&p>d;this.scrollState.lastTargetOffset=o,m||(this.scrollState.behavior="auto"),this._scrollToOffset(o,{adjustments:void 0,behavior:m?"smooth":"auto"})}this.scheduleScrollReconcile()}}const Hm=(l,t,r,i)=>{for(;l<=t;){const o=(l+t)/2|0,u=r(o);if(ui)t=o-1;else return o}return l>0?l-1:0};function iS({measurements:l,outerSize:t,scrollOffset:r,lanes:i,flat:o}){const u=l.length-1,f=o?w=>o[w*2]:w=>l[w].start,d=o?w=>o[w*2]+o[w*2+1]:w=>l[w].end;if(l.length<=i)return{startIndex:0,endIndex:u};let p=Hm(0,u,f,r),m=p;if(i===1)for(;m1){const w=Array(i).fill(0);for(;mx=0&&v.some(x=>x>=r);){const x=l[p];v[x.lane]=x.start,p--}p=Math.max(0,p-p%i),m=Math.min(u,m+(i-1-m%i))}return{startIndex:p,endIndex:m}}const _f=typeof document<"u"?j.useLayoutEffect:j.useEffect;function sS({useFlushSync:l=!0,directDomUpdates:t=!1,directDomUpdatesMode:r="transform",...i}){const o=j.useReducer(m=>m+1,0)[1],u=j.useRef({enabled:t,mode:r,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});u.current.enabled=t,u.current.mode=r;const f=m=>{const w=u.current;if(!w.enabled||!w.container)return;const v=m.getTotalSize();if(v!==w.lastSize){w.lastSize=v;const B=m.options.horizontal?"width":"height";w.container.style[B]=`${v}px`}const x=!!m.options.horizontal,z=w.mode==="transform",R=x?"left":"top",k=m.options.scrollMargin,b=m.getVirtualItems();for(const B of b){const P=B.start-k,W=m.elementsCache.get(B.key);W&&w.lastPositions.get(W)!==P&&(w.lastPositions.set(W,P),z?W.style.transform=x?`translate3d(${P}px, 0, 0)`:`translate3d(0, ${P}px, 0)`:W.style[R]=`${P}px`)}},d={...i,onChange:(m,w)=>{var v;const x=u.current;let z=!0;if(x.enabled){f(m);const R=m.range,k=x.prevRange;z=!k||k.isScrolling!==m.isScrolling||k.startIndex!==(R==null?void 0:R.startIndex)||k.endIndex!==(R==null?void 0:R.endIndex),z&&(x.prevRange=R?{startIndex:R.startIndex,endIndex:R.endIndex,isScrolling:m.isScrolling}:null)}z&&(l&&w?bs.flushSync(o):o()),(v=i.onChange)==null||v.call(i,m,w)}},[p]=j.useState(()=>{const m=new rS(d);return Object.assign(m,{containerRef:w=>{const v=u.current;if(v.container=w,v.lastSize=null,w&&v.enabled){const x=m.getTotalSize();v.lastSize=x;const z=m.options.horizontal?"width":"height";w.style[z]=`${x}px`}}})});return p.setOptions(d),_f(()=>p._didMount(),[]),_f(()=>p._willUpdate()),_f(()=>{f(p)}),p}function lS(l){return sS({observeElementRect:X1,observeElementOffset:Z1,scrollToFn:nS,...l})}const oS={pos:"p",vel:"v",torque:"τ",kp:"kp",kd:"kd",vel_limit:"vlim",torque_limit:"τlim",t_mos:"Tm",t_rotor:"Tr"},aS=["pos","vel","torque","kp","kd","t_mos","t_rotor"];function uS(l){const t=[];for(const r of aS)r in l.fields&&t.push(`${oS[r]||r} ${l.fields[r].toFixed(2)}`);return t.join(" ")||l.note||""}function cS(l){const t=new Date(l*1e3),r=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0"),o=String(t.getSeconds()).padStart(2,"0"),u=String(Math.floor(l%1*1e3)).padStart(3,"0");return`${r}:${i}:${o}.${u}`}function fS(){const[,l]=j.useState(0),[t,r]=j.useState(!1),i=j.useRef(null),o=j.useRef([]);j.useEffect(()=>{gg(!0);const d=M1(()=>{t||(o.current=z1(),l(p=>p+1))});return()=>{gg(!1),d()}},[t]);const u=o.current,f=lS({count:u.length,getScrollElement:()=>i.current,estimateSize:()=>22,overscan:12});return j.useEffect(()=>{!t&&u.length&&f.scrollToIndex(u.length-1)},[u.length,t,f]),U.jsxs("div",{className:"panel rawlog-panel",children:[U.jsxs("div",{className:"rawlog-toolbar",children:[U.jsx("button",{className:t?"btn small":"btn small active",onClick:()=>r(d=>!d),children:t?"Resume":"Pause"}),U.jsxs("span",{className:"muted",children:[u.length," frames"]})]}),U.jsxs("div",{className:"rawlog-body",ref:i,children:[U.jsxs("div",{className:"rawlog-head",children:[U.jsx("span",{className:"c-t",children:"time"}),U.jsx("span",{className:"c-arb",children:"arb"}),U.jsx("span",{className:"c-m",children:"motor"}),U.jsx("span",{className:"c-k",children:"kind"}),U.jsx("span",{className:"c-f",children:"decoded"}),U.jsx("span",{className:"c-r",children:"raw"})]}),U.jsx("div",{style:{height:f.getTotalSize(),position:"relative"},children:f.getVirtualItems().map(d=>{const p=u[d.index];return U.jsxs("div",{className:"rawlog-row k-"+p.kind,style:{transform:`translateY(${d.start}px)`},children:[U.jsx("span",{className:"c-t mono",children:cS(p.t)}),U.jsxs("span",{className:"c-arb mono",children:["0x",p.arb.toString(16).toUpperCase()]}),U.jsxs("span",{className:"c-m mono",children:["m",p.motorId]}),U.jsx("span",{className:"c-k",children:p.mode||p.kind}),U.jsx("span",{className:"c-f mono",children:uS(p)}),U.jsx("span",{className:"c-r mono dim",children:p.raw})]},p.seq)})})]})]})}const Fm=[{kind:"plot",title:"Plot",icon:"〜",description:"Time-series chart; drag signals onto it (cmd over fb to overlay).",render:l=>U.jsx(B1,{panelId:l})},{kind:"table",title:"Motor Table",icon:"▦",description:"One row per motor: commanded vs actual.",render:()=>U.jsx(U1,{})},{kind:"cards",title:"Motor Cards",icon:"▢",description:"Per-motor cards/gauges with big readouts.",render:()=>U.jsx(V1,{})},{kind:"rawlog",title:"Raw CAN Log",icon:"≣",description:"Scrolling decoded frame log.",render:()=>U.jsx(fS,{})}],dS=Object.fromEntries(Fm.map(l=>[l.kind,l]));function hS(){const l=gn(u=>u.connected),t=gn(u=>u.status),r=Eo(u=>u.addWidget),i=Eo(u=>u.resetWidgets),o=()=>i();return U.jsxs("header",{className:"toolbar",children:[U.jsxs("div",{className:"brand",children:[U.jsx("span",{className:"brand-dot"}),"DaMiao ",U.jsx("span",{className:"brand-sub",children:"Passive Monitor"})]}),U.jsxs("div",{className:"conn",children:[U.jsx("span",{className:"dot "+(l?"on":"off")}),U.jsx("span",{className:"mono",children:t!=null&&t.demo?"demo":(t==null?void 0:t.channel)||"—"}),t&&!t.demo&&U.jsx("span",{className:"badge "+(t.listenOnly?"ok":"warn"),title:"hardware listen-only",children:t.listenOnly?"listen-only":"rx (no TX)"}),(t==null?void 0:t.error)&&U.jsx("span",{className:"badge err",title:t.error,children:"bus error"}),t&&U.jsxs("span",{className:"muted small",children:[t.framesSeen.toLocaleString()," frames · +",t.feedbackOffset," fb"]})]}),U.jsx("div",{className:"spacer"}),U.jsxs("div",{className:"actions",children:[Fm.map(u=>U.jsxs("button",{className:"btn",title:u.description,onClick:()=>r(u.kind),children:[U.jsx("span",{className:"btn-icon",children:u.icon})," ",u.title]},u.kind)),U.jsx("button",{className:"btn ghost",onClick:o,children:"Reset"})]})]})}function pS({sig:l}){const{attributes:t,listeners:r,setNodeRef:i,isDragging:o}=r0({id:`sig:${l.id}`,data:{signalId:l.id}}),u=ru(l);return U.jsxs("div",{ref:i,className:"sig-chip"+(o?" dragging":""),...r,...t,title:l.id,children:[U.jsx("span",{className:"sig-swatch",style:{background:u,borderStyle:l.source==="cmd"?"dashed":"solid"}}),U.jsxs("span",{className:"sig-name",children:[l.source,".",l.field]}),l.unit&&U.jsx("span",{className:"sig-unit",children:l.unit})]})}function gS(l){return[...l].sort((t,r)=>{if(t.source!==r.source)return t.source==="cmd"?-1:1;const i=wg.indexOf(t.field),o=wg.indexOf(r.field);return(i<0?99:i)-(o<0?99:o)})}function mS(){const l=gn(u=>u.signals),t=gn(u=>u.status),[r,i]=j.useState(""),o=j.useMemo(()=>{const u=new Map;for(const f of l){if(r&&!f.id.toLowerCase().includes(r.toLowerCase()))continue;const d=u.get(f.motorId)||[];d.push(f),u.set(f.motorId,d)}return Array.from(u.entries()).sort((f,d)=>f[0]-d[0])},[l,r]);return U.jsxs("aside",{className:"sidebar",children:[U.jsxs("div",{className:"sidebar-head",children:[U.jsx("div",{className:"sidebar-title",children:"Signals"}),U.jsx("input",{className:"filter",placeholder:"filter…",value:r,onChange:u=>i(u.target.value)})]}),U.jsxs("div",{className:"sidebar-body",children:[o.length===0&&U.jsx("div",{className:"muted pad",children:t!=null&&t.error?"Bus error — see top bar.":"No signals yet. Start a controller on the bus (or run --demo)."}),o.map(([u,f])=>U.jsxs("div",{className:"motor-group",children:[U.jsxs("div",{className:"motor-group-title",children:["Motor ",u]}),U.jsx("div",{className:"chips",children:gS(f).map(d=>U.jsx(pS,{sig:d},d.id))})]},u))]}),U.jsxs("div",{className:"sidebar-foot muted",children:["Drag a signal onto a plot. Drop ",U.jsx("b",{children:"cmd"})," onto its ",U.jsx("b",{children:"fb"})," plot to overlay."]})]})}function vS(l,t,r,i,o){const u=(...f)=>(console.warn("gridstack.js: Function `"+r+"` is deprecated in "+o+" and has been replaced with `"+i+"`. It will be **removed** in a future release"),t.apply(l,f));return u.prototype=t.prototype,u}class A{static getElements(t,r=document){if(typeof t=="string"){const i="getElementById"in r?r:void 0;if(i&&!isNaN(+t[0])){const u=i.getElementById(t);return u?[u]:[]}let o=r.querySelectorAll(t);return!o.length&&t[0]!=="."&&t[0]!=="#"&&(o=r.querySelectorAll("."+t),o.length||(o=r.querySelectorAll("#"+t))),Array.from(o)}return[t]}static getElement(t,r=document){if(typeof t=="string"){const i="getElementById"in r?r:void 0;if(!t.length)return null;if(i&&t[0]==="#")return i.getElementById(t.substring(1));if(t[0]==="#"||t[0]==="."||t[0]==="[")return r.querySelector(t);if(i&&!isNaN(+t[0]))return i.getElementById(t);let o=r.querySelector(t);return i&&!o&&(o=i.getElementById(t)),o||(o=r.querySelector("."+t)),o}return t}static lazyLoad(t){var r,i;return t.lazyLoad||((i=(r=t.grid)==null?void 0:r.opts)==null?void 0:i.lazyLoad)&&t.lazyLoad!==!1}static createDiv(t,r){const i=document.createElement("div");return t.forEach(o=>{o&&i.classList.add(o)}),r==null||r.appendChild(i),i}static shouldSizeToContent(t,r=!1){return(t==null?void 0:t.grid)&&(r?t.sizeToContent===!0||t.grid.opts.sizeToContent===!0&&t.sizeToContent===void 0:!!t.sizeToContent||t.grid.opts.sizeToContent&&t.sizeToContent!==!1)}static isIntercepted(t,r){return!(t.y>=r.y+r.h||t.y+t.h<=r.y||t.x+t.w<=r.x||t.x>=r.x+r.w)}static isTouching(t,r){return A.isIntercepted(t,{x:r.x-.5,y:r.y-.5,w:r.w+1,h:r.h+1})}static areaIntercept(t,r){const i=t.x>r.x?t.x:r.x,o=t.x+t.wr.y?t.y:r.y,f=t.y+t.h{const f=r*((o.y??1e4)-(u.y??1e4));return f===0?r*((o.x??1e4)-(u.x??1e4)):f})}static find(t,r){return r?t.find(i=>i.id===r):void 0}static createStylesheet(t,r,i){const o=document.createElement("style"),u=i==null?void 0:i.nonce;return u&&(o.nonce=u),o.setAttribute("type","text/css"),o.setAttribute("gs-style-id",t),o.styleSheet?o.styleSheet.cssText="":o.appendChild(document.createTextNode("")),r?r.insertBefore(o,r.firstChild):(r=document.getElementsByTagName("head")[0],r.appendChild(o)),o}static removeStylesheet(t,r){const o=(r||document).querySelector("STYLE[gs-style-id="+t+"]");o&&o.parentNode&&o.remove()}static addCSSRule(t,r,i){t.textContent+=`${r} { ${i} } `}static toBool(t){return typeof t=="boolean"?t:typeof t=="string"?(t=t.toLowerCase(),!(t===""||t==="no"||t==="false"||t==="0")):!!t}static toNumber(t){return t===null||t.length===0?void 0:Number(t)}static parseHeight(t){let r,i="px";if(typeof t=="string")if(t==="auto"||t==="")r=0;else{const o=t.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!o)throw new Error(`Invalid height val = ${t}`);i=o[2]||"px",r=parseFloat(o[1])}else r=t;return{h:r,unit:i}}static defaults(t,...r){return r.forEach(i=>{for(const o in i){if(!i.hasOwnProperty(o))return;t[o]===null||t[o]===void 0?t[o]=i[o]:typeof i[o]=="object"&&typeof t[o]=="object"&&this.defaults(t[o],i[o])}}),t}static same(t,r){if(typeof t!="object")return t==r;if(typeof t!=typeof r||Object.keys(t).length!==Object.keys(r).length)return!1;for(const i in t)if(t[i]!==r[i])return!1;return!0}static copyPos(t,r,i=!1){return r.x!==void 0&&(t.x=r.x),r.y!==void 0&&(t.y=r.y),r.w!==void 0&&(t.w=r.w),r.h!==void 0&&(t.h=r.h),i&&(r.minW&&(t.minW=r.minW),r.minH&&(t.minH=r.minH),r.maxW&&(t.maxW=r.maxW),r.maxH&&(t.maxH=r.maxH)),t}static samePos(t,r){return t&&r&&t.x===r.x&&t.y===r.y&&(t.w||1)===(r.w||1)&&(t.h||1)===(r.h||1)}static sanitizeMinMax(t){t.minW||delete t.minW,t.minH||delete t.minH,t.maxW||delete t.maxW,t.maxH||delete t.maxH}static removeInternalAndSame(t,r){if(!(typeof t!="object"||typeof r!="object"))for(let i in t){const o=t[i],u=r[i];i[0]==="_"||o===u?delete t[i]:o&&typeof o=="object"&&u!==void 0&&(A.removeInternalAndSame(o,u),Object.keys(o).length||delete t[i])}}static removeInternalForSave(t,r=!0){for(let i in t)(i[0]==="_"||t[i]===null||t[i]===void 0)&&delete t[i];delete t.grid,r&&delete t.el,t.autoPosition||delete t.autoPosition,t.noResize||delete t.noResize,t.noMove||delete t.noMove,t.locked||delete t.locked,(t.w===1||t.w===t.minW)&&delete t.w,(t.h===1||t.h===t.minH)&&delete t.h}static throttle(t,r){let i=!1;return(...o)=>{i||(i=!0,setTimeout(()=>{t(...o),i=!1},r))}}static removePositioningStyles(t){const r=t.style;r.position&&r.removeProperty("position"),r.left&&r.removeProperty("left"),r.top&&r.removeProperty("top"),r.width&&r.removeProperty("width"),r.height&&r.removeProperty("height")}static getScrollElement(t){if(!t)return document.scrollingElement||document.documentElement;const r=getComputedStyle(t);return/(auto|scroll)/.test(r.overflow+r.overflowY)?t:this.getScrollElement(t.parentElement)}static updateScrollPosition(t,r,i){const o=t.getBoundingClientRect(),u=window.innerHeight||document.documentElement.clientHeight;if(o.top<0||o.bottom>u){const f=o.bottom-u,d=o.top,p=this.getScrollElement(t);if(p!==null){const m=p.scrollTop;o.top<0&&i<0?t.offsetHeight>u?p.scrollTop+=i:p.scrollTop+=Math.abs(d)>Math.abs(i)?i:d:i>0&&(t.offsetHeight>u?p.scrollTop+=i:p.scrollTop+=f>i?i:f),r.top+=p.scrollTop-m}}}static updateScrollResize(t,r,i){const o=this.getScrollElement(r),u=o.clientHeight,f=o===this.getScrollElement()?0:o.getBoundingClientRect().top,d=t.clientY-f,p=du-i;p?o.scrollBy({behavior:"smooth",top:d-i}):m&&o.scrollBy({behavior:"smooth",top:i-(u-d)})}static clone(t){return t==null||typeof t!="object"?t:t instanceof Array?[...t]:{...t}}static cloneDeep(t){const r=["parentGrid","el","grid","subGrid","engine"],i=A.clone(t);for(const o in i)i.hasOwnProperty(o)&&typeof i[o]=="object"&&o.substring(0,2)!=="__"&&!r.find(u=>u===o)&&(i[o]=A.cloneDeep(t[o]));return i}static cloneNode(t){const r=t.cloneNode(!0);return r.removeAttribute("id"),r}static appendTo(t,r){let i;typeof r=="string"?i=A.getElement(r):i=r,i&&i.appendChild(t)}static addElStyles(t,r){if(r instanceof Object)for(const i in r)r.hasOwnProperty(i)&&(Array.isArray(r[i])?r[i].forEach(o=>{t.style[i]=o}):t.style[i]=r[i])}static initEvent(t,r){const i={type:r.type},o={button:0,which:0,buttons:1,bubbles:!0,cancelable:!0,target:r.target?r.target:t.target};return["altKey","ctrlKey","metaKey","shiftKey"].forEach(u=>i[u]=t[u]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(u=>i[u]=t[u]),{...i,...o}}static simulateMouseEvent(t,r,i){const o=t,u=new MouseEvent(r,{bubbles:!0,composed:!0,cancelable:!0,view:window,detail:1,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY,ctrlKey:o.ctrlKey??!1,altKey:o.altKey??!1,shiftKey:o.shiftKey??!1,metaKey:o.metaKey??!1,button:0,relatedTarget:t.target});(i||t.target).dispatchEvent(u)}static getValuesFromTransformedElement(t){const r=document.createElement("div");A.addElStyles(r,{opacity:"0",position:"fixed",top:"0px",left:"0px",width:"1px",height:"1px",zIndex:"-999999"}),t.appendChild(r);const i=r.getBoundingClientRect();return t.removeChild(r),r.remove(),{xScale:1/i.width,yScale:1/i.height,xOffset:i.left,yOffset:i.top}}static swap(t,r,i){if(!t)return;const o=t[r];t[r]=t[i],t[i]=o}static canBeRotated(t){var r;return!(!t||t.w===t.h||t.locked||t.noResize||(r=t.grid)!=null&&r.opts.disableResize||t.minW&&t.minW===t.maxW||t.minH&&t.minH===t.maxH)}}class ai{constructor(t={}){this.addedNodes=[],this.removedNodes=[],this.defaultColumn=12,this.column=t.column||this.defaultColumn,this.column>this.defaultColumn&&(this.defaultColumn=this.column),this.maxRow=t.maxRow,this._float=t.float,this.nodes=t.nodes||[],this.onChange=t.onChange}batchUpdate(t=!0,r=!0){return!!this.batchMode===t?this:(this.batchMode=t,t?(this._prevFloat=this._float,this._float=!0,this.cleanNodes(),this.saveInitial()):(this._float=this._prevFloat,delete this._prevFloat,r&&this._packNodes(),this._notify()),this)}_useEntireRowArea(t,r){return(!this.float||this.batchMode&&!this._prevFloat)&&!this._hasLocked&&(!t._moving||t._skipDown||r.y<=t.y)}_fixCollisions(t,r=t,i,o={}){if(this.sortNodes(-1),i=i||this.collide(t,r),!i)return!1;if(t._moving&&!o.nested&&!this.float&&this.swap(t,i))return!0;let u=r;!this._loading&&this._useEntireRowArea(t,r)&&(u={x:0,w:this.column,y:r.y,h:r.h},i=this.collide(t,u,o.skip));let f=!1;const d={nested:!0,pack:!1};let p=0;for(;i=i||this.collide(t,u,o.skip);){if(p++>this.nodes.length*2)throw new Error("Infinite collide check");let m;if(i.locked||this._loading||t._moving&&!t._skipDown&&r.y>t.y&&!this.float&&(!this.collide(i,{...i,y:t.y},t)||!this.collide(i,{...i,y:r.y-i.h},t))){t._skipDown=t._skipDown||r.y>t.y;const w={...r,y:i.y+i.h,...d};m=this._loading&&A.samePos(t,w)?!0:this.moveNode(t,w),(i.locked||this._loading)&&m?A.copyPos(r,t):!i.locked&&m&&o.pack&&(this._packNodes(),r.y=i.y+i.h,A.copyPos(t,r)),f=f||m}else m=this.moveNode(i,{...i,y:r.y+r.h,skip:t,...d});if(!m)return f;i=void 0}return f}collide(t,r=t,i){const o=t._id,u=i==null?void 0:i._id;return this.nodes.find(f=>f._id!==o&&f._id!==u&&A.isIntercepted(f,r))}collideAll(t,r=t,i){const o=t._id,u=i==null?void 0:i._id;return this.nodes.filter(f=>f._id!==o&&f._id!==u&&A.isIntercepted(f,r))}directionCollideCoverage(t,r,i){if(!r.rect||!t._rect)return;const o=t._rect,u={...r.rect};u.y>o.y?(u.h+=u.y-o.y,u.y=o.y):u.h+=o.y-u.y,u.x>o.x?(u.w+=u.x-o.x,u.x=o.x):u.w+=o.x-u.x;let f,d=.5;for(let p of i){if(p.locked||!p._rect)break;const m=p._rect;let w=Number.MAX_VALUE,v=Number.MAX_VALUE;o.ym.y+m.h&&(w=(m.y+m.h-u.y)/m.h),o.xm.x+m.w&&(v=(m.x+m.w-u.x)/m.w);const x=Math.min(v,w);x>d&&(d=x,f=p)}return r.collide=f,f}cacheRects(t,r,i,o,u,f){return this.nodes.forEach(d=>d._rect={y:d.y*r+i,x:d.x*t+f,w:d.w*t-f-o,h:d.h*r-i-u}),this}swap(t,r){if(!r||r.locked||!t||t.locked)return!1;function i(){const u=r.x,f=r.y;return r.x=t.x,r.y=t.y,t.h!=r.h?(t.x=u,t.y=r.y+r.h):t.w!=r.w?(t.x=r.x+r.w,t.y=f):(t.x=u,t.y=f),t._dirty=r._dirty=!0,!0}let o;if(t.w===r.w&&t.h===r.h&&(t.x===r.x||t.y===r.y)&&(o=A.isTouching(t,r)))return i();if(o!==!1){if(t.w===r.w&&t.x===r.x&&(o||(o=A.isTouching(t,r)))){if(r.y{let m;f.locked||(f.autoPosition=!0,t==="list"&&d&&(m=p[d-1])),this.addNode(f,!1,m)}),o||delete this._inColumnResize,i||this.batchUpdate(!1),this}set float(t){this._float!==t&&(this._float=t||!1,t||this._packNodes()._notify())}get float(){return this._float||!1}sortNodes(t=1){return this.nodes=A.sort(this.nodes,t),this}_packNodes(){return this.batchMode?this:(this.sortNodes(),this.float?this.nodes.forEach(t=>{if(t._updating||t._orig===void 0||t.y===t._orig.y)return;let r=t.y;for(;r>t._orig.y;)--r,this.collide(t,{x:t.x,y:r,w:t.w,h:t.h})||(t._dirty=!0,t.y=r)}):this.nodes.forEach((t,r)=>{if(!t.locked)for(;t.y>0;){const i=r===0?0:t.y-1;if(!(r===0||!this.collide(t,{x:t.x,y:i,w:t.w,h:t.h})))break;t._dirty=t.y!==i,t.y=i}}),this)}prepareNode(t,r){t._id=t._id??ai._idSeq++;const i=t.id;if(i){let u=1;for(;this.nodes.find(f=>f.id===t.id&&f!==t);)t.id=i+"_"+u++}(t.x===void 0||t.y===void 0||t.x===null||t.y===null)&&(t.autoPosition=!0);const o={x:0,y:0,w:1,h:1};return A.defaults(t,o),t.autoPosition||delete t.autoPosition,t.noResize||delete t.noResize,t.noMove||delete t.noMove,A.sanitizeMinMax(t),typeof t.x=="string"&&(t.x=Number(t.x)),typeof t.y=="string"&&(t.y=Number(t.y)),typeof t.w=="string"&&(t.w=Number(t.w)),typeof t.h=="string"&&(t.h=Number(t.h)),isNaN(t.x)&&(t.x=o.x,t.autoPosition=!0),isNaN(t.y)&&(t.y=o.y,t.autoPosition=!0),isNaN(t.w)&&(t.w=o.w),isNaN(t.h)&&(t.h=o.h),this.nodeBoundFix(t,r),t}nodeBoundFix(t,r){const i=t._orig||A.copyPos({},t);if(t.maxW&&(t.w=Math.min(t.w||1,t.maxW)),t.maxH&&(t.h=Math.min(t.h||1,t.maxH)),t.minW&&(t.w=Math.max(t.w||1,t.minW)),t.minH&&(t.h=Math.max(t.h||1,t.minH)),(t.x||0)+(t.w||1)>this.column&&this.columnthis.column?t.w=this.column:t.w<1&&(t.w=1),this.maxRow&&t.h>this.maxRow?t.h=this.maxRow:t.h<1&&(t.h=1),t.x<0&&(t.x=0),t.y<0&&(t.y=0),t.x+t.w>this.column&&(r?t.w=this.column-t.x:t.x=this.column-t.w),this.maxRow&&t.y+t.h>this.maxRow&&(r?t.h=this.maxRow-t.y:t.y=this.maxRow-t.h),A.samePos(t,i)||(t._dirty=!0),this}getDirtyNodes(t){return t?this.nodes.filter(r=>r._dirty&&!A.samePos(r,r._orig)):this.nodes.filter(r=>r._dirty)}_notify(t){if(this.batchMode||!this.onChange)return this;const r=(t||[]).concat(this.getDirtyNodes());return this.onChange(r),this}cleanNodes(){return this.batchMode?this:(this.nodes.forEach(t=>{delete t._dirty,delete t._lastTried}),this)}saveInitial(){return this.nodes.forEach(t=>{t._orig=A.copyPos({},t),delete t._dirty}),this._hasLocked=this.nodes.some(t=>t.locked),this}restoreInitial(){return this.nodes.forEach(t=>{!t._orig||A.samePos(t,t._orig)||(A.copyPos(t,t._orig),t._dirty=!0)}),this._notify(),this}findEmptyPosition(t,r=this.nodes,i=this.column,o){const u=o?o.y*i+(o.x+o.w):0;let f=!1;for(let d=u;!f;++d){const p=d%i,m=Math.floor(d/i);if(p+t.w>i)continue;const w={x:p,y:m,w:t.w,h:t.h};r.find(v=>A.isIntercepted(w,v))||((t.x!==p||t.y!==m)&&(t._dirty=!0),t.x=p,t.y=m,delete t.autoPosition,f=!0)}return f}addNode(t,r=!1,i){const o=this.nodes.find(f=>f._id===t._id);if(o)return o;this._inColumnResize?this.nodeBoundFix(t):this.prepareNode(t),delete t._temporaryRemoved,delete t._removeDOM;let u;return t.autoPosition&&this.findEmptyPosition(t,this.nodes,this.column,i)&&(delete t.autoPosition,u=!0),this.nodes.push(t),r&&this.addedNodes.push(t),u||this._fixCollisions(t),this.batchMode||this._packNodes()._notify(),t}removeNode(t,r=!0,i=!1){return this.nodes.find(o=>o._id===t._id)?(i&&this.removedNodes.push(t),r&&(t._removeDOM=!0),this.nodes=this.nodes.filter(o=>o._id!==t._id),t._isAboutToRemove||this._packNodes(),this._notify([t]),this):this}removeAll(t=!0,r=!0){if(delete this._layouts,!this.nodes.length)return this;t&&this.nodes.forEach(o=>o._removeDOM=!0);const i=this.nodes;return this.removedNodes=r?i:[],this.nodes=[],this._notify(i)}moveNodeCheck(t,r){if(!this.changedPosConstrain(t,r))return!1;if(r.pack=!0,!this.maxRow)return this.moveNode(t,r);let i;const o=new ai({column:this.column,float:this.float,nodes:this.nodes.map(f=>f._id===t._id?(i={...f},i):{...f})});if(!i)return!1;const u=o.moveNode(i,r)&&o.getRow()<=Math.max(this.getRow(),this.maxRow);if(!u&&!r.resizing&&r.collide){const f=r.collide.el.gridstackNode;if(this.swap(t,f))return this._notify(),!0}return u?(o.nodes.filter(f=>f._dirty).forEach(f=>{const d=this.nodes.find(p=>p._id===f._id);d&&(A.copyPos(d,f),d._dirty=!0)}),this._notify(),!0):!1}willItFit(t){if(delete t._willFitPos,!this.maxRow)return!0;const r=new ai({column:this.column,float:this.float,nodes:this.nodes.map(o=>({...o}))}),i={...t};return this.cleanupNode(i),delete i.el,delete i._id,delete i.content,delete i.grid,r.addNode(i),r.getRow()<=this.maxRow?(t._willFitPos=A.copyPos({},i),!0):!1}changedPosConstrain(t,r){return r.w=r.w||t.w,r.h=r.h||t.h,t.x!==r.x||t.y!==r.y?!0:(t.maxW&&(r.w=Math.min(r.w,t.maxW)),t.maxH&&(r.h=Math.min(r.h,t.maxH)),t.minW&&(r.w=Math.max(r.w,t.minW)),t.minH&&(r.h=Math.max(r.h,t.minH)),t.w!==r.w||t.h!==r.h)}moveNode(t,r){var m,w;if(!t||!r)return!1;let i;r.pack===void 0&&!this.batchMode&&(i=r.pack=!0),typeof r.x!="number"&&(r.x=t.x),typeof r.y!="number"&&(r.y=t.y),typeof r.w!="number"&&(r.w=t.w),typeof r.h!="number"&&(r.h=t.h);const o=t.w!==r.w||t.h!==r.h,u=A.copyPos({},t,!0);if(A.copyPos(u,r),this.nodeBoundFix(u,o),A.copyPos(r,u),!r.forceCollide&&A.samePos(t,r))return!1;const f=A.copyPos({},t),d=this.collideAll(t,u,r.skip);let p=!0;if(d.length){const v=t._moving&&!r.nested;let x=v?this.directionCollideCoverage(t,r,d):d[0];if(v&&x&&((w=(m=t.grid)==null?void 0:m.opts)!=null&&w.subGridDynamic)&&!t.grid._isTemp){const z=A.areaIntercept(r.rect,x._rect),R=A.area(r.rect),k=A.area(x._rect);z/(R.8&&(x.grid.makeSubGrid(x.el,void 0,t),x=void 0)}x?p=!this._fixCollisions(t,u,x,r):(p=!1,i&&delete r.pack)}return p&&!A.samePos(t,u)&&(t._dirty=!0,A.copyPos(t,u)),r.pack&&this._packNodes()._notify(),!A.samePos(t,f)}getRow(){return this.nodes.reduce((t,r)=>Math.max(t,r.y+r.h),0)}beginUpdate(t){return t._updating||(t._updating=!0,delete t._skipDown,this.batchMode||this.saveInitial()),this}endUpdate(){const t=this.nodes.find(r=>r._updating);return t&&(delete t._updating,delete t._skipDown),this}save(t=!0,r){var f;const i=(f=this._layouts)==null?void 0:f.length,o=i&&this.column!==i-1?this._layouts[i-1]:null,u=[];return this.sortNodes(),this.nodes.forEach(d=>{const p=o==null?void 0:o.find(w=>w._id===d._id),m={...d,...p||{}};A.removeInternalForSave(m,!t),r&&r(d,m),u.push(m)}),u}layoutsNodesChange(t){return!this._layouts||this._inColumnResize?this:(this._layouts.forEach((r,i)=>{if(!r||i===this.column)return this;if(i{if(!u._orig)return;const f=r.find(d=>d._id===u._id);f&&(f.y>=0&&u.y!==u._orig.y&&(f.y+=u.y-u._orig.y),u.x!==u._orig.x&&(f.x=Math.round(u.x*o)),u.w!==u._orig.w&&(f.w=Math.round(u.w*o)))})}}),this)}columnChanged(t,r,i="moveScale"){var d;if(!this.nodes.length||!r||t===r)return this;const o=i==="compact"||i==="list";o&&this.sortNodes(1),rt&&this._layouts){const p=this._layouts[r]||[],m=this._layouts.length-1;!p.length&&t!==m&&((d=this._layouts[m])!=null&&d.length)&&(t=m,this._layouts[m].forEach(w=>{const v=f.find(x=>x._id===w._id);v&&(!o&&!w.autoPosition&&(v.x=w.x??v.x,v.y=w.y??v.y),v.w=w.w??v.w,(w.x==null||w.y===void 0)&&(v.autoPosition=!0))})),p.forEach(w=>{const v=f.findIndex(x=>x._id===w._id);if(v!==-1){const x=f[v];if(o){x.w=w.w;return}(w.autoPosition||isNaN(w.x)||isNaN(w.y))&&this.findEmptyPosition(w,u),w.autoPosition||(x.x=w.x??x.x,x.y=w.y??x.y,x.w=w.w??x.w,u.push(x)),f.splice(v,1)}})}if(o)this.compact(i,!1);else{if(f.length)if(typeof i=="function")i(r,t,u,f);else{const p=o||i==="none"?1:r/t,m=i==="move"||i==="moveScale",w=i==="scale"||i==="moveScale";f.forEach(v=>{v.x=r===1?0:m?Math.round(v.x*p):Math.min(v.x,r-1),v.w=r===1||t===1?1:w?Math.round(v.w*p)||1:Math.min(v.w,r),u.push(v)}),f=[]}u=A.sort(u,-1),this._inColumnResize=!0,this.nodes=[],u.forEach(p=>{this.addNode(p,!1),delete p._orig})}return this.nodes.forEach(p=>delete p._orig),this.batchUpdate(!1,!o),delete this._inColumnResize,this}cacheLayout(t,r,i=!1){const o=[];return t.forEach((u,f)=>{if(u._id===void 0){const d=u.id?this.nodes.find(p=>p.id===u.id):void 0;u._id=(d==null?void 0:d._id)??ai._idSeq++}o[f]={x:u.x,y:u.y,w:u.w,_id:u._id}}),this._layouts=i?[]:this._layouts||[],this._layouts[r]=o,this}cacheOneLayout(t,r){t._id=t._id??ai._idSeq++;const i={x:t.x,y:t.y,w:t.w,_id:t._id};(t.autoPosition||t.x===void 0)&&(delete i.x,delete i.y,t.autoPosition&&(i.autoPosition=!0)),this._layouts=this._layouts||[],this._layouts[r]=this._layouts[r]||[];const o=this.findCacheLayout(t,r);return o===-1?this._layouts[r].push(i):this._layouts[r][o]=i,this}findCacheLayout(t,r){var i,o;return((o=(i=this._layouts)==null?void 0:i[r])==null?void 0:o.findIndex(u=>u._id===t._id))??-1}removeNodeFromLayoutCache(t){if(this._layouts)for(let r=0;r0||navigator.msMaxTouchPoints>0);class ui{}function pu(l,t){l.touches.length>1||(l.cancelable&&l.preventDefault(),A.simulateMouseEvent(l.changedTouches[0],t))}function jm(l,t){l.cancelable&&l.preventDefault(),A.simulateMouseEvent(l,t)}function gu(l){ui.touchHandled||(ui.touchHandled=!0,pu(l,"mousedown"))}function mu(l){ui.touchHandled&&pu(l,"mousemove")}function vu(l){if(!ui.touchHandled)return;ui.pointerLeaveTimeout&&(window.clearTimeout(ui.pointerLeaveTimeout),delete ui.pointerLeaveTimeout);const t=!!Le.dragElement;pu(l,"mouseup"),t||pu(l,"click"),ui.touchHandled=!1}function yu(l){l.pointerType!=="mouse"&&l.target.releasePointerCapture(l.pointerId)}function Eg(l){Le.dragElement&&l.pointerType!=="mouse"&&jm(l,"mouseenter")}function Cg(l){Le.dragElement&&l.pointerType!=="mouse"&&(ui.pointerLeaveTimeout=window.setTimeout(()=>{delete ui.pointerLeaveTimeout,jm(l,"mouseleave")},10))}class bu{constructor(t,r,i){this.host=t,this.dir=r,this.option=i,this.moving=!1,this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this._init()}_init(){const t=this.el=document.createElement("div");return t.classList.add("ui-resizable-handle"),t.classList.add(`${bu.prefix}${this.dir}`),t.style.zIndex="100",t.style.userSelect="none",this.host.appendChild(this.el),this.el.addEventListener("mousedown",this._mouseDown),Kr&&(this.el.addEventListener("touchstart",gu),this.el.addEventListener("pointerdown",yu)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),Kr&&(this.el.removeEventListener("touchstart",gu),this.el.removeEventListener("pointerdown",yu)),this.host.removeChild(this.el),delete this.el,delete this.host,this}_mouseDown(t){this.mouseDownEvent=t,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),Kr&&(this.el.addEventListener("touchmove",mu),this.el.addEventListener("touchend",vu)),t.stopPropagation(),t.preventDefault()}_mouseMove(t){const r=this.mouseDownEvent;this.moving?this._triggerEvent("move",t):Math.abs(t.x-r.x)+Math.abs(t.y-r.y)>2&&(this.moving=!0,this._triggerEvent("start",this.mouseDownEvent),this._triggerEvent("move",t),document.addEventListener("keydown",this._keyEvent)),t.stopPropagation()}_mouseUp(t){this.moving&&(this._triggerEvent("stop",t),document.removeEventListener("keydown",this._keyEvent)),document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),Kr&&(this.el.removeEventListener("touchmove",mu),this.el.removeEventListener("touchend",vu)),delete this.moving,delete this.mouseDownEvent,t.stopPropagation(),t.preventDefault()}_keyEvent(t){var r,i;t.key==="Escape"&&((i=(r=this.host.gridstackNode)==null?void 0:r.grid)==null||i.engine.restoreInitial(),this._mouseUp(this.mouseDownEvent))}_triggerEvent(t,r){return this.option[t]&&this.option[t](r),this}}bu.prefix="ui-resizable-";class ad{constructor(){this._eventRegister={}}get disabled(){return this._disabled}on(t,r){this._eventRegister[t]=r}off(t){delete this._eventRegister[t]}enable(){this._disabled=!1}disable(){this._disabled=!0}destroy(){delete this._eventRegister}triggerEvent(t,r){if(!this.disabled&&this._eventRegister&&this._eventRegister[t])return this._eventRegister[t](r)}}class zo extends ad{constructor(t,r={}){super(),this.el=t,this.option=r,this.rectScale={x:1,y:1},this._ui=()=>{const o=this.el.parentElement.getBoundingClientRect(),u={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},f=this.temporalRect||u;return{position:{left:(f.left-o.left)*this.rectScale.x,top:(f.top-o.top)*this.rectScale.y},size:{width:f.width*this.rectScale.x,height:f.height*this.rectScale.y}}},this._mouseOver=this._mouseOver.bind(this),this._mouseOut=this._mouseOut.bind(this),this.enable(),this._setupAutoHide(this.option.autoHide),this._setupHandlers()}on(t,r){super.on(t,r)}off(t){super.off(t)}enable(){super.enable(),this.el.classList.remove("ui-resizable-disabled"),this._setupAutoHide(this.option.autoHide)}disable(){super.disable(),this.el.classList.add("ui-resizable-disabled"),this._setupAutoHide(!1)}destroy(){this._removeHandlers(),this._setupAutoHide(!1),delete this.el,super.destroy()}updateOption(t){const r=t.handles&&t.handles!==this.option.handles,i=t.autoHide&&t.autoHide!==this.option.autoHide;return Object.keys(t).forEach(o=>this.option[o]=t[o]),r&&(this._removeHandlers(),this._setupHandlers()),i&&this._setupAutoHide(this.option.autoHide),this}_setupAutoHide(t){return t?(this.el.classList.add("ui-resizable-autohide"),this.el.addEventListener("mouseover",this._mouseOver),this.el.addEventListener("mouseout",this._mouseOut)):(this.el.classList.remove("ui-resizable-autohide"),this.el.removeEventListener("mouseover",this._mouseOver),this.el.removeEventListener("mouseout",this._mouseOut),Le.overResizeElement===this&&delete Le.overResizeElement),this}_mouseOver(t){Le.overResizeElement||Le.dragElement||(Le.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(t){Le.overResizeElement===this&&(delete Le.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(t=>t.trim()).map(t=>new bu(this.el,t,{start:r=>{this._resizeStart(r)},stop:r=>{this._resizeStop(r)},move:r=>{this._resizing(r,t)}})),this}_resizeStart(t){this.sizeToContent=A.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=A.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=t,this._setupHelper(),this._applyChange();const r=A.initEvent(t,{type:"resizestart",target:this.el});return this.option.start&&this.option.start(r,this._ui()),this.el.classList.add("ui-resizable-resizing"),this.triggerEvent("resizestart",r),this}_resizing(t,r){this.scrolled=this.scrollEl.scrollTop-this.scrollY,this.temporalRect=this._getChange(t,r),this._applyChange();const i=A.initEvent(t,{type:"resize",target:this.el});return this.option.resize&&this.option.resize(i,this._ui()),this.triggerEvent("resize",i),this}_resizeStop(t){const r=A.initEvent(t,{type:"resizestop",target:this.el});return this.option.stop&&this.option.stop(r),this.el.classList.remove("ui-resizable-resizing"),this.triggerEvent("resizestop",r),this._cleanHelper(),delete this.startEvent,delete this.originalRect,delete this.temporalRect,delete this.scrollY,delete this.scrolled,this}_setupHelper(){this.elOriginStyleVal=zo._originStyleProp.map(i=>this.el.style[i]),this.parentOriginStylePosition=this.el.parentElement.style.position;const t=this.el.parentElement,r=A.getValuesFromTransformedElement(t);return this.rectScale={x:r.xScale,y:r.yScale},getComputedStyle(this.el.parentElement).position.match(/static/)&&(this.el.parentElement.style.position="relative"),this.el.style.position="absolute",this.el.style.opacity="0.8",this}_cleanHelper(){return zo._originStyleProp.forEach((t,r)=>{this.el.style[t]=this.elOriginStyleVal[r]||null}),this.el.parentElement.style.position=this.parentOriginStylePosition||null,this}_getChange(t,r){const i=this.startEvent,o={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},u=t.clientX-i.clientX,f=this.sizeToContent?0:t.clientY-i.clientY;let d,p;r.indexOf("e")>-1?o.width+=u:r.indexOf("w")>-1&&(o.width-=u,o.left+=u,d=!0),r.indexOf("s")>-1?o.height+=f:r.indexOf("n")>-1&&(o.height-=f,o.top+=f,p=!0);const m=this._constrainSize(o.width,o.height,d,p);return Math.round(o.width)!==Math.round(m.width)&&(r.indexOf("w")>-1&&(o.left+=o.width-m.width),o.width=m.width),Math.round(o.height)!==Math.round(m.height)&&(r.indexOf("n")>-1&&(o.top+=o.height-m.height),o.height=m.height),o}_constrainSize(t,r,i,o){const u=this.option,f=(i?u.maxWidthMoveLeft:u.maxWidth)||Number.MAX_SAFE_INTEGER,d=u.minWidth/this.rectScale.x||t,p=(o?u.maxHeightMoveUp:u.maxHeight)||Number.MAX_SAFE_INTEGER,m=u.minHeight/this.rectScale.y||r,w=Math.min(f,Math.max(d,t)),v=Math.min(p,Math.max(m,r));return{width:w,height:v}}_applyChange(){let t={left:0,top:0,width:0,height:0};if(this.el.style.position==="absolute"){const r=this.el.parentElement,{left:i,top:o}=r.getBoundingClientRect();t={left:i,top:o,width:0,height:0}}return this.temporalRect?(Object.keys(this.temporalRect).forEach(r=>{const i=this.temporalRect[r],o=r==="width"||r==="left"?this.rectScale.x:r==="height"||r==="top"?this.rectScale.y:1;this.el.style[r]=(i-t[r])*o+"px"}),this):this}_removeHandlers(){return this.handlers.forEach(t=>t.destroy()),delete this.handlers,this}}zo._originStyleProp=["width","height","position","left","top","opacity","zIndex"];const yS='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class Mo extends ad{constructor(t,r={}){var u;super(),this.el=t,this.option=r,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0};const i=(u=r==null?void 0:r.handle)==null?void 0:u.substring(1),o=t.gridstackNode;this.dragEls=!i||t.classList.contains(i)?[t]:o!=null&&o.subGrid?[t.querySelector(r.handle)||t]:Array.from(t.querySelectorAll(r.handle)),this.dragEls.length===0&&(this.dragEls=[t]),this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this.enable()}on(t,r){super.on(t,r)}off(t){super.off(t)}enable(){this.disabled!==!1&&(super.enable(),this.dragEls.forEach(t=>{t.addEventListener("mousedown",this._mouseDown),Kr&&(t.addEventListener("touchstart",gu),t.addEventListener("pointerdown",yu))}),this.el.classList.remove("ui-draggable-disabled"))}disable(t=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(r=>{r.removeEventListener("mousedown",this._mouseDown),Kr&&(r.removeEventListener("touchstart",gu),r.removeEventListener("pointerdown",yu))}),t||this.el.classList.add("ui-draggable-disabled"))}destroy(){this.dragTimeout&&window.clearTimeout(this.dragTimeout),delete this.dragTimeout,this.mouseDownEvent&&this._mouseUp(this.mouseDownEvent),this.disable(!0),delete this.el,delete this.helper,delete this.option,super.destroy()}updateOption(t){return Object.keys(t).forEach(r=>this.option[r]=t[r]),this}_mouseDown(t){if(!Le.mouseHandled)return t.button!==0||!this.dragEls.find(r=>r===t.target)&&t.target.closest(yS)||this.option.cancel&&t.target.closest(this.option.cancel)||(this.mouseDownEvent=t,delete this.dragging,delete Le.dragElement,delete Le.dropElement,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),Kr&&(t.currentTarget.addEventListener("touchmove",mu),t.currentTarget.addEventListener("touchend",vu)),t.preventDefault(),document.activeElement&&document.activeElement.blur(),Le.mouseHandled=!0),!0}_callDrag(t){if(!this.dragging)return;const r=A.initEvent(t,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(r,this.ui()),this.triggerEvent("drag",r)}_mouseMove(t){var i;const r=this.mouseDownEvent;if(this.lastDrag=t,this.dragging)if(this._dragFollow(t),Le.pauseDrag){const o=Number.isInteger(Le.pauseDrag)?Le.pauseDrag:100;this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>this._callDrag(t),o)}else this._callDrag(t);else if(Math.abs(t.x-r.x)+Math.abs(t.y-r.y)>3){this.dragging=!0,Le.dragElement=this;const o=(i=this.el.gridstackNode)==null?void 0:i.grid;o?Le.dropElement=o.el.ddElement.ddDroppable:delete Le.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=A.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(t,this.el,this.helperContainment),this._setupHelperStyle(t);const u=A.initEvent(t,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(u,this.ui()),this.triggerEvent("dragstart",u),document.addEventListener("keydown",this._keyEvent)}return!0}_mouseUp(t){var r,i;if(document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),Kr&&t.currentTarget&&(t.currentTarget.removeEventListener("touchmove",mu,!0),t.currentTarget.removeEventListener("touchend",vu,!0)),this.dragging){delete this.dragging,(r=this.el.gridstackNode)==null||delete r._origRotate,document.removeEventListener("keydown",this._keyEvent),((i=Le.dropElement)==null?void 0:i.el)===this.el.parentElement&&delete Le.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();const o=A.initEvent(t,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(o),this.triggerEvent("dragstop",o),Le.dropElement&&Le.dropElement.drop(t)}delete this.helper,delete this.mouseDownEvent,delete Le.dragElement,delete Le.dropElement,delete Le.mouseHandled,t.preventDefault()}_keyEvent(t){var o,u;const r=this.el.gridstackNode,i=(r==null?void 0:r.grid)||((u=(o=Le.dropElement)==null?void 0:o.el)==null?void 0:u.gridstack);if(t.key==="Escape")r&&r._origRotate&&(r._orig=r._origRotate,delete r._origRotate),i==null||i.cancelDrag(),this._mouseUp(this.mouseDownEvent);else if(r&&i&&(t.key==="r"||t.key==="R")){if(!A.canBeRotated(r))return;r._origRotate=r._origRotate||{...r._orig},delete r._moving,i.setAnimation(!1).rotate(r.el,{top:-this.dragOffset.offsetTop,left:-this.dragOffset.offsetLeft}).setAnimation(),r._moving=!0,this.dragOffset=this._getDragOffset(this.lastDrag,r.el,this.helperContainment),this.helper.style.width=this.dragOffset.width+"px",this.helper.style.height=this.dragOffset.height+"px",A.swap(r._orig,"w","h"),delete r._rect,this._mouseMove(this.lastDrag)}}_createHelper(){let t=this.el;return typeof this.option.helper=="function"?t=this.option.helper(this.el):this.option.helper==="clone"&&(t=A.cloneNode(this.el)),t.parentElement||A.appendTo(t,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=Mo.originStyleProp.map(r=>this.el.style[r]),t}_setupHelperStyle(t){this.helper.classList.add("ui-draggable-dragging");const r=this.helper.style;return r.pointerEvents="none",r.width=this.dragOffset.width+"px",r.height=this.dragOffset.height+"px",r.willChange="left, top",r.position="fixed",this._dragFollow(t),r.transition="none",setTimeout(()=>{this.helper&&(r.transition=null)},0),this}_removeHelperStyle(){var r;this.helper.classList.remove("ui-draggable-dragging");const t=(r=this.helper)==null?void 0:r.gridstackNode;if(!(t!=null&&t._isAboutToRemove)&&this.dragElementOriginStyle){const i=this.helper,o=this.dragElementOriginStyle.transition||null;i.style.transition=this.dragElementOriginStyle.transition="none",Mo.originStyleProp.forEach(u=>i.style[u]=this.dragElementOriginStyle[u]||null),setTimeout(()=>i.style.transition=o,50)}return delete this.dragElementOriginStyle,this}_dragFollow(t){const r={left:0,top:0},i=this.helper.style,o=this.dragOffset;i.left=(t.clientX+o.offsetLeft-r.left)*this.dragTransform.xScale+"px",i.top=(t.clientY+o.offsetTop-r.top)*this.dragTransform.yScale+"px"}_setupHelperContainmentStyle(){return this.helperContainment=this.helper.parentElement,this.helper.style.position!=="fixed"&&(this.parentOriginStylePosition=this.helperContainment.style.position,getComputedStyle(this.helperContainment).position.match(/static/)&&(this.helperContainment.style.position="relative")),this}_getDragOffset(t,r,i){let o=0,u=0;i&&(o=this.dragTransform.xOffset,u=this.dragTransform.yOffset);const f=r.getBoundingClientRect();return{left:f.left,top:f.top,offsetLeft:-t.clientX+f.left-o,offsetTop:-t.clientY+f.top-u,width:f.width*this.dragTransform.xScale,height:f.height*this.dragTransform.yScale}}ui(){const r=this.el.parentElement.getBoundingClientRect(),i=this.helper.getBoundingClientRect();return{position:{top:(i.top-r.top)*this.dragTransform.yScale,left:(i.left-r.left)*this.dragTransform.xScale}}}}Mo.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","top","minWidth","willChange"];class wS extends ad{constructor(t,r={}){super(),this.el=t,this.option=r,this._mouseEnter=this._mouseEnter.bind(this),this._mouseLeave=this._mouseLeave.bind(this),this.enable(),this._setupAccept()}on(t,r){super.on(t,r)}off(t){super.off(t)}enable(){this.disabled!==!1&&(super.enable(),this.el.classList.add("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),this.el.addEventListener("mouseenter",this._mouseEnter),this.el.addEventListener("mouseleave",this._mouseLeave),Kr&&(this.el.addEventListener("pointerenter",Eg),this.el.addEventListener("pointerleave",Cg)))}disable(t=!1){this.disabled!==!0&&(super.disable(),this.el.classList.remove("ui-droppable"),t||this.el.classList.add("ui-droppable-disabled"),this.el.removeEventListener("mouseenter",this._mouseEnter),this.el.removeEventListener("mouseleave",this._mouseLeave),Kr&&(this.el.removeEventListener("pointerenter",Eg),this.el.removeEventListener("pointerleave",Cg)))}destroy(){this.disable(!0),this.el.classList.remove("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),super.destroy()}updateOption(t){return Object.keys(t).forEach(r=>this.option[r]=t[r]),this._setupAccept(),this}_mouseEnter(t){if(!Le.dragElement||!this._canDrop(Le.dragElement.el))return;t.preventDefault(),t.stopPropagation(),Le.dropElement&&Le.dropElement!==this&&Le.dropElement._mouseLeave(t,!0),Le.dropElement=this;const r=A.initEvent(t,{target:this.el,type:"dropover"});this.option.over&&this.option.over(r,this._ui(Le.dragElement)),this.triggerEvent("dropover",r),this.el.classList.add("ui-droppable-over")}_mouseLeave(t,r=!1){var o;if(!Le.dragElement||Le.dropElement!==this)return;t.preventDefault(),t.stopPropagation();const i=A.initEvent(t,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(i,this._ui(Le.dragElement)),this.triggerEvent("dropout",i),Le.dropElement===this&&(delete Le.dropElement,!r)){let u,f=this.el.parentElement;for(;!u&&f;)u=(o=f.ddElement)==null?void 0:o.ddDroppable,f=f.parentElement;u&&u._mouseEnter(t)}}drop(t){t.preventDefault();const r=A.initEvent(t,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(r,this._ui(Le.dragElement)),this.triggerEvent("drop",r)}_canDrop(t){return t&&(!this.accept||this.accept(t))}_setupAccept(){return this.option.accept?(typeof this.option.accept=="string"?this.accept=t=>t.classList.contains(this.option.accept)||t.matches(this.option.accept):this.accept=this.option.accept,this):this}_ui(t){return{draggable:t.el,...t.ui()}}}class ud{static init(t){return t.ddElement||(t.ddElement=new ud(t)),t.ddElement}constructor(t){this.el=t}on(t,r){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(t)>-1?this.ddDraggable.on(t,r):this.ddDroppable&&["drop","dropover","dropout"].indexOf(t)>-1?this.ddDroppable.on(t,r):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(t)>-1&&this.ddResizable.on(t,r),this}off(t){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(t)>-1?this.ddDraggable.off(t):this.ddDroppable&&["drop","dropover","dropout"].indexOf(t)>-1?this.ddDroppable.off(t):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(t)>-1&&this.ddResizable.off(t),this}setupDraggable(t){return this.ddDraggable?this.ddDraggable.updateOption(t):this.ddDraggable=new Mo(this.el,t),this}cleanDraggable(){return this.ddDraggable&&(this.ddDraggable.destroy(),delete this.ddDraggable),this}setupResizable(t){return this.ddResizable?this.ddResizable.updateOption(t):this.ddResizable=new zo(this.el,t),this}cleanResizable(){return this.ddResizable&&(this.ddResizable.destroy(),delete this.ddResizable),this}setupDroppable(t){return this.ddDroppable?this.ddDroppable.updateOption(t):this.ddDroppable=new wS(this.el,t),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class SS{resizable(t,r,i,o){return this._getDDElements(t,r).forEach(u=>{if(r==="disable"||r==="enable")u.ddResizable&&u.ddResizable[r]();else if(r==="destroy")u.ddResizable&&u.cleanResizable();else if(r==="option")u.setupResizable({[i]:o});else{const d=u.el.gridstackNode.grid;let p=u.el.getAttribute("gs-resize-handles")||d.opts.resizable.handles||"e,s,se";p==="all"&&(p="n,e,s,w,se,sw,ne,nw");const m=!d.opts.alwaysShowResizeHandle;u.setupResizable({...d.opts.resizable,handles:p,autoHide:m,start:r.start,stop:r.stop,resize:r.resize})}}),this}draggable(t,r,i,o){return this._getDDElements(t,r).forEach(u=>{if(r==="disable"||r==="enable")u.ddDraggable&&u.ddDraggable[r]();else if(r==="destroy")u.ddDraggable&&u.cleanDraggable();else if(r==="option")u.setupDraggable({[i]:o});else{const f=u.el.gridstackNode.grid;u.setupDraggable({...f.opts.draggable,start:r.start,stop:r.stop,drag:r.drag})}}),this}dragIn(t,r){return this._getDDElements(t).forEach(i=>i.setupDraggable(r)),this}droppable(t,r,i,o){return typeof r.accept=="function"&&!r._accept&&(r._accept=r.accept,r.accept=u=>r._accept(u)),this._getDDElements(t,r).forEach(u=>{r==="disable"||r==="enable"?u.ddDroppable&&u.ddDroppable[r]():r==="destroy"?u.ddDroppable&&u.cleanDroppable():r==="option"?u.setupDroppable({[i]:o}):u.setupDroppable(r)}),this}isDroppable(t){var r;return!!((r=t==null?void 0:t.ddElement)!=null&&r.ddDroppable&&!t.ddElement.ddDroppable.disabled)}isDraggable(t){var r;return!!((r=t==null?void 0:t.ddElement)!=null&&r.ddDraggable&&!t.ddElement.ddDraggable.disabled)}isResizable(t){var r;return!!((r=t==null?void 0:t.ddElement)!=null&&r.ddResizable&&!t.ddElement.ddResizable.disabled)}on(t,r,i){return this._getDDElements(t).forEach(o=>o.on(r,u=>{i(u,Le.dragElement?Le.dragElement.el:u.target,Le.dragElement?Le.dragElement.helper:null)})),this}off(t,r){return this._getDDElements(t).forEach(i=>i.off(r)),this}_getDDElements(t,r){const i=t.gridstack||r!=="destroy"&&r!=="disable",o=A.getElements(t);return o.length?o.map(f=>f.ddElement||(i?ud.init(f):null)).filter(f=>f):[]}}/*! + * GridStack 11.5.1 + * https://gridstackjs.com/ + * + * Copyright (c) 2021-2024 Alain Dumesny + * see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE + */const $n=new SS;class Ne{static init(t={},r=".grid-stack"){if(typeof document>"u")return null;const i=Ne.getGridElement(r);return i?(i.gridstack||(i.gridstack=new Ne(i,A.cloneDeep(t))),i.gridstack):(console.error(typeof r=="string"?'GridStack.initAll() no grid was found with selector "'+r+`" - element missing or wrong selector ? +Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`:"GridStack.init() no grid element was passed."),null)}static initAll(t={},r=".grid-stack"){const i=[];return typeof document>"u"||(Ne.getGridElements(r).forEach(o=>{o.gridstack||(o.gridstack=new Ne(o,A.cloneDeep(t))),i.push(o.gridstack)}),i.length===0&&console.error('GridStack.initAll() no grid was found with selector "'+r+`" - element missing or wrong selector ? +Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`)),i}static addGrid(t,r={}){if(!t)return null;let i=t;if(i.gridstack){const f=i.gridstack;return r&&(f.opts={...f.opts,...r}),r.children!==void 0&&f.load(r.children),f}return(!t.classList.contains("grid-stack")||Ne.addRemoveCB)&&(Ne.addRemoveCB?i=Ne.addRemoveCB(t,r,!0,!0):i=A.createDiv(["grid-stack",r.class],t)),Ne.init(r,i)}static registerEngine(t){Ne.engineClass=t}get placeholder(){if(!this._placeholder){this._placeholder=A.createDiv([this.opts.placeholderClass,yr.itemClass,this.opts.itemClass]);const t=A.createDiv(["placeholder-content"],this._placeholder);this.opts.placeholderText&&(t.textContent=this.opts.placeholderText)}return this._placeholder}constructor(t,r={}){var v,x,z;this.el=t,this.opts=r,this.animationDelay=310,this._gsEventHandler={},this._extraDragRow=0,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0},t.gridstack=this,this.opts=r=r||{},t.classList.contains("grid-stack")||this.el.classList.add("grid-stack"),r.row&&(r.minRow=r.maxRow=r.row,delete r.row);const i=A.toNumber(t.getAttribute("gs-row"));r.column==="auto"&&delete r.column,r.alwaysShowResizeHandle!==void 0&&(r._alwaysShowResizeHandle=r.alwaysShowResizeHandle);let o=(v=r.columnOpts)==null?void 0:v.breakpoints;const u=r;if(u.oneColumnModeDomSort&&(delete u.oneColumnModeDomSort,console.log("warning: Gridstack oneColumnModeDomSort no longer supported. Use GridStackOptions.columnOpts instead.")),u.oneColumnSize||u.disableOneColumnMode===!1){const R=u.oneColumnSize||768;delete u.oneColumnSize,delete u.disableOneColumnMode,r.columnOpts=r.columnOpts||{},o=r.columnOpts.breakpoints=r.columnOpts.breakpoints||[];let k=o.find(b=>b.c===1);k?k.w=R:(k={c:1,w:R},o.push(k,{c:12,w:R+1}))}const f=r.columnOpts;f&&(!f.columnWidth&&!((x=f.breakpoints)!=null&&x.length)?(delete r.columnOpts,o=void 0):f.columnMax=f.columnMax||12),(o==null?void 0:o.length)>1&&o.sort((R,k)=>(k.w||0)-(R.w||0));const d={...A.cloneDeep(yr),column:A.toNumber(t.getAttribute("gs-column"))||yr.column,minRow:i||A.toNumber(t.getAttribute("gs-min-row"))||yr.minRow,maxRow:i||A.toNumber(t.getAttribute("gs-max-row"))||yr.maxRow,staticGrid:A.toBool(t.getAttribute("gs-static"))||yr.staticGrid,sizeToContent:A.toBool(t.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(r.handleClass?"."+r.handleClass:r.handle?r.handle:"")||yr.draggable.handle},removableOptions:{accept:r.itemClass||yr.removableOptions.accept,decline:yr.removableOptions.decline}};t.getAttribute("gs-animate")&&(d.animate=A.toBool(t.getAttribute("gs-animate"))),r=A.defaults(r,d),this._initMargin(),this.checkDynamicColumn(),this.el.classList.add("gs-"+r.column),r.rtl==="auto"&&(r.rtl=t.style.direction==="rtl"),r.rtl&&this.el.classList.add("grid-stack-rtl");const p=this.el.closest("."+yr.itemClass),m=p==null?void 0:p.gridstackNode;m&&(m.subGrid=this,this.parentGridNode=m,this.el.classList.add("grid-stack-nested"),m.el.classList.add("grid-stack-sub-grid")),this._isAutoCellHeight=r.cellHeight==="auto",this._isAutoCellHeight||r.cellHeight==="initial"?this.cellHeight(void 0,!1):(typeof r.cellHeight=="number"&&r.cellHeightUnit&&r.cellHeightUnit!==yr.cellHeightUnit&&(r.cellHeight=r.cellHeight+r.cellHeightUnit,delete r.cellHeightUnit),this.cellHeight(r.cellHeight,!1)),r.alwaysShowResizeHandle==="mobile"&&(r.alwaysShowResizeHandle=Kr),this._styleSheetClass="gs-id-"+ai._idSeq++,this.el.classList.add(this._styleSheetClass),this._setStaticClass();const w=r.engineClass||Ne.engineClass||ai;if(this.engine=new w({column:this.getColumn(),float:r.float,maxRow:r.maxRow,onChange:R=>{let k=0;this.engine.nodes.forEach(b=>{k=Math.max(k,b.y+b.h)}),R.forEach(b=>{const B=b.el;B&&(b._removeDOM?(B&&B.remove(),delete b._removeDOM):this._writePosAttr(B,b))}),this._updateStyles(!1,k)}}),this._updateStyles(!1,0),r.auto&&(this.batchUpdate(),this.engine._loading=!0,this.getGridItems().forEach(R=>this._prepareElement(R)),delete this.engine._loading,this.batchUpdate(!1)),r.children){const R=r.children;delete r.children,R.length&&this.load(R)}this.setAnimation(),r.subGridDynamic&&!Le.pauseDrag&&(Le.pauseDrag=!0),((z=r.draggable)==null?void 0:z.pause)!==void 0&&(Le.pauseDrag=r.draggable.pause),this._setupRemoveDrop(),this._setupAcceptWidget(),this._updateResizeEvent()}addWidget(t){if(typeof t=="string"){console.error("V11: GridStack.addWidget() does not support string anymore. see #2736");return}if(t.ELEMENT_NODE)return console.error("V11: GridStack.addWidget() does not support HTMLElement anymore. use makeWidget()"),this.makeWidget(t);let r,i=t;if(i.grid=this,i!=null&&i.el?r=i.el:Ne.addRemoveCB?r=Ne.addRemoveCB(this.el,t,!0,!1):r=this.createWidgetDivs(i),!r)return;if(i=r.gridstackNode,i&&r.parentElement===this.el&&this.engine.nodes.find(u=>u._id===i._id))return r;const o=this._readAttr(r);return A.defaults(t,o),this.engine.prepareNode(t),this.el.appendChild(r),this.makeWidget(r,t),r}createWidgetDivs(t){const r=A.createDiv(["grid-stack-item",this.opts.itemClass]),i=A.createDiv(["grid-stack-item-content"],r);return A.lazyLoad(t)?t.visibleObservable||(t.visibleObservable=new IntersectionObserver(([o])=>{var u,f;o.isIntersecting&&((u=t.visibleObservable)==null||u.disconnect(),delete t.visibleObservable,Ne.renderCB(i,t),(f=t.grid)==null||f.prepareDragDrop(t.el))}),window.setTimeout(()=>{var o;return(o=t.visibleObservable)==null?void 0:o.observe(r)})):Ne.renderCB(i,t),r}makeSubGrid(t,r,i,o=!0){var z,R,k;let u=t.gridstackNode;if(u||(u=this.makeWidget(t).gridstackNode),(z=u.subGrid)!=null&&z.el)return u.subGrid;let f,d=this;for(;d&&!f;)f=(R=d.opts)==null?void 0:R.subGridOpts,d=(k=d.parentGridNode)==null?void 0:k.grid;r=A.cloneDeep({...this.opts,id:void 0,children:void 0,column:"auto",columnOpts:void 0,layout:"list",subGridOpts:void 0,...f||{},...r||u.subGridOpts||{}}),u.subGridOpts=r;let p;r.column==="auto"&&(p=!0,r.column=Math.max(u.w||1,(i==null?void 0:i.w)||1),delete r.columnOpts);let m=u.el.querySelector(".grid-stack-item-content"),w,v;if(o&&(this._removeDD(u.el),v={...u,x:0,y:0},A.removeInternalForSave(v),delete v.subGridOpts,u.content&&(v.content=u.content,delete u.content),Ne.addRemoveCB?w=Ne.addRemoveCB(this.el,v,!0,!1):(w=A.createDiv(["grid-stack-item"]),w.appendChild(m),m=A.createDiv(["grid-stack-item-content"],u.el)),this.prepareDragDrop(u.el)),i){const b=p?r.column:u.w,B=u.h+i.h,P=u.el.style;P.transition="none",this.update(u.el,{w:b,h:B}),setTimeout(()=>P.transition=null)}const x=u.subGrid=Ne.addGrid(m,r);return i!=null&&i._moving&&(x._isTemp=!0),p&&(x._autoColumn=!0),o&&x.makeWidget(w,v),i&&(i._moving?window.setTimeout(()=>A.simulateMouseEvent(i._event,"mouseenter",x.el),0):x.makeWidget(u.el,u)),this.resizeToContentCheck(!1,u),x}removeAsSubGrid(t){var i;const r=(i=this.parentGridNode)==null?void 0:i.grid;r&&(r.batchUpdate(),r.removeWidget(this.parentGridNode.el,!0,!0),this.engine.nodes.forEach(o=>{o.x+=this.parentGridNode.x,o.y+=this.parentGridNode.y,r.makeWidget(o.el,o)}),r.batchUpdate(!1),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,t&&window.setTimeout(()=>A.simulateMouseEvent(t._event,"mouseenter",r.el),0))}save(t=!0,r=!1,i=Ne.saveCB){const o=this.engine.save(t,i);if(o.forEach(u=>{var f;if(t&&u.el&&!u.subGrid&&!i){const d=u.el.querySelector(".grid-stack-item-content");u.content=d==null?void 0:d.innerHTML,u.content||delete u.content}else if(!t&&!i&&delete u.content,(f=u.subGrid)!=null&&f.el){const d=u.subGrid.save(t,r,i);u.subGridOpts=r?d:{children:d},delete u.subGrid}delete u.el}),r){const u=A.cloneDeep(this.opts);u.marginBottom===u.marginTop&&u.marginRight===u.marginLeft&&u.marginTop===u.marginRight&&(u.margin=u.marginTop,delete u.marginTop,delete u.marginRight,delete u.marginBottom,delete u.marginLeft),u.rtl===(this.el.style.direction==="rtl")&&(u.rtl="auto"),this._isAutoCellHeight&&(u.cellHeight="auto"),this._autoColumn&&(u.column="auto");const f=u._alwaysShowResizeHandle;return delete u._alwaysShowResizeHandle,f!==void 0?u.alwaysShowResizeHandle=f:delete u.alwaysShowResizeHandle,A.removeInternalAndSame(u,yr),u.children=o,u}return o}load(t,r=Ne.addRemoveCB||!0){var m;t=A.cloneDeep(t);const i=this.getColumn();t.forEach(w=>{w.w=w.w||1,w.h=w.h||1}),t=A.sort(t),this.engine.skipCacheUpdate=this._ignoreLayoutsNodeChange=!0;let o=0;t.forEach(w=>{o=Math.max(o,(w.x||0)+w.w)}),o>this.engine.defaultColumn&&(this.engine.defaultColumn=o),o>i&&this.engine.cacheLayout(t,o,!0);const u=Ne.addRemoveCB;typeof r=="function"&&(Ne.addRemoveCB=r);const f=[];this.batchUpdate();const d=!this.engine.nodes.length;d&&this.setAnimation(!1),!d&&r&&[...this.engine.nodes].forEach(v=>{if(!v.id)return;A.find(t,v.id)||(Ne.addRemoveCB&&Ne.addRemoveCB(this.el,v,!1,!1),f.push(v),this.removeWidget(v.el,!0,!1))}),this.engine._loading=!0;const p=[];return this.engine.nodes=this.engine.nodes.filter(w=>A.find(t,w.id)?(p.push(w),!1):!0),t.forEach(w=>{var x;const v=A.find(p,w.id);if(v){if(A.shouldSizeToContent(v)&&(w.h=v.h),this.engine.nodeBoundFix(w),(w.autoPosition||w.x===void 0||w.y===void 0)&&(w.w=w.w||v.w,w.h=w.h||v.h,this.engine.findEmptyPosition(w)),this.engine.nodes.push(v),A.samePos(v,w)&&this.engine.nodes.length>1&&(this.moveNode(v,{...w,forceCollide:!0}),A.copyPos(w,v)),this.update(v.el,w),(x=w.subGridOpts)!=null&&x.children){const z=v.el.querySelector(".grid-stack");z&&z.gridstack&&z.gridstack.load(w.subGridOpts.children)}}else r&&this.addWidget(w)}),delete this.engine._loading,this.engine.removedNodes=f,this.batchUpdate(!1),delete this._ignoreLayoutsNodeChange,delete this.engine.skipCacheUpdate,u?Ne.addRemoveCB=u:delete Ne.addRemoveCB,d&&((m=this.opts)!=null&&m.animate)&&this.setAnimation(this.opts.animate,!0),this}batchUpdate(t=!0){return this.engine.batchUpdate(t),t||(this._updateContainerHeight(),this._triggerRemoveEvent(),this._triggerAddEvent(),this._triggerChangeEvent()),this}getCellHeight(t=!1){if(this.opts.cellHeight&&this.opts.cellHeight!=="auto"&&(!t||!this.opts.cellHeightUnit||this.opts.cellHeightUnit==="px"))return this.opts.cellHeight;if(this.opts.cellHeightUnit==="rem")return this.opts.cellHeight*parseFloat(getComputedStyle(document.documentElement).fontSize);if(this.opts.cellHeightUnit==="em")return this.opts.cellHeight*parseFloat(getComputedStyle(this.el).fontSize);if(this.opts.cellHeightUnit==="cm")return this.opts.cellHeight*(96/2.54);if(this.opts.cellHeightUnit==="mm")return this.opts.cellHeight*(96/2.54)/10;const r=this.el.querySelector("."+this.opts.itemClass);if(r){const o=A.toNumber(r.getAttribute("gs-h"))||1;return Math.round(r.offsetHeight/o)}const i=parseInt(this.el.getAttribute("gs-current-row"));return i?Math.round(this.el.getBoundingClientRect().height/i):this.opts.cellHeight}cellHeight(t,r=!0){if(r&&t!==void 0&&this._isAutoCellHeight!==(t==="auto")&&(this._isAutoCellHeight=t==="auto",this._updateResizeEvent()),(t==="initial"||t==="auto")&&(t=void 0),t===void 0){const o=-this.opts.marginRight-this.opts.marginLeft+this.opts.marginTop+this.opts.marginBottom;t=this.cellWidth()+o}const i=A.parseHeight(t);return this.opts.cellHeightUnit===i.unit&&this.opts.cellHeight===i.h?this:(this.opts.cellHeightUnit=i.unit,this.opts.cellHeight=i.h,this.resizeToContentCheck(),r&&this._updateStyles(!0),this)}cellWidth(){return this._widthOrContainer()/this.getColumn()}_widthOrContainer(t=!1){var r;return t&&((r=this.opts.columnOpts)!=null&&r.breakpointForWindow)?window.innerWidth:this.el.clientWidth||this.el.parentElement.clientWidth||window.innerWidth}checkDynamicColumn(){var u,f;const t=this.opts.columnOpts;if(!t||!t.columnWidth&&!((u=t.breakpoints)!=null&&u.length))return!1;const r=this.getColumn();let i=r;const o=this._widthOrContainer(!0);if(t.columnWidth)i=Math.min(Math.round(o/t.columnWidth)||1,t.columnMax);else{i=t.columnMax;let d=0;for(;dp.c===i);return this.column(i,(d==null?void 0:d.layout)||t.layout),!0}return!1}compact(t="compact",r=!0){return this.engine.compact(t,r),this._triggerChangeEvent(),this}column(t,r="moveScale"){if(!t||t<1||this.opts.column===t)return this;const i=this.getColumn();return this.opts.column=t,this.engine?(this.engine.column=t,this.el.classList.remove("gs-"+i),this.el.classList.add("gs-"+t),this.engine.columnChanged(i,t,r),this._isAutoCellHeight&&this.cellHeight(),this.resizeToContentCheck(!0),this._ignoreLayoutsNodeChange=!0,this._triggerChangeEvent(),delete this._ignoreLayoutsNodeChange,this):this}getColumn(){return this.opts.column}getGridItems(){return Array.from(this.el.children).filter(t=>t.matches("."+this.opts.itemClass)&&!t.matches("."+this.opts.placeholderClass))}isIgnoreChangeCB(){return this._ignoreLayoutsNodeChange}destroy(t=!0){var r,i;if(this.el)return this.offAll(),this._updateResizeEvent(!0),this.setStatic(!0,!1),this.setAnimation(!1),t?this.el.parentNode.removeChild(this.el):(this.removeAll(t),this.el.classList.remove(this._styleSheetClass),this.el.removeAttribute("gs-current-row")),this._removeStylesheet(),(r=this.parentGridNode)==null||delete r.subGrid,delete this.parentGridNode,delete this.opts,(i=this._placeholder)==null||delete i.gridstackNode,delete this._placeholder,delete this.engine,delete this.el.gridstack,delete this.el,this}float(t){return this.opts.float!==t&&(this.opts.float=this.engine.float=t,this._triggerChangeEvent()),this}getFloat(){return this.engine.float}getCellFromPixel(t,r=!1){const i=this.el.getBoundingClientRect();let o;r?o={top:i.top+document.documentElement.scrollTop,left:i.left}:o={top:this.el.offsetTop,left:this.el.offsetLeft};const u=t.left-o.left,f=t.top-o.top,d=i.width/this.getColumn(),p=i.height/parseInt(this.el.getAttribute("gs-current-row"));return{x:Math.floor(u/d),y:Math.floor(f/p)}}getRow(){return Math.max(this.engine.getRow(),this.opts.minRow)}isAreaEmpty(t,r,i,o){return this.engine.isAreaEmpty(t,r,i,o)}makeWidget(t,r){const i=Ne.getElement(t);if(!i)return;i.parentElement||this.el.appendChild(i),this._prepareElement(i,!0,r);const o=i.gridstackNode;this._updateContainerHeight(),o.subGridOpts&&this.makeSubGrid(i,o.subGridOpts,void 0,!1);let u;return this.opts.column===1&&!this._ignoreLayoutsNodeChange&&(u=this._ignoreLayoutsNodeChange=!0),this._triggerAddEvent(),this._triggerChangeEvent(),u&&delete this._ignoreLayoutsNodeChange,i}on(t,r){return t.indexOf(" ")!==-1?(t.split(" ").forEach(o=>this.on(o,r)),this):(t==="change"||t==="added"||t==="removed"||t==="enable"||t==="disable"?(t==="enable"||t==="disable"?this._gsEventHandler[t]=o=>r(o):this._gsEventHandler[t]=o=>{o.detail&&r(o,o.detail)},this.el.addEventListener(t,this._gsEventHandler[t])):t==="drag"||t==="dragstart"||t==="dragstop"||t==="resizestart"||t==="resize"||t==="resizestop"||t==="dropped"||t==="resizecontent"?this._gsEventHandler[t]=r:console.error("GridStack.on("+t+") event not supported"),this)}off(t){return t.indexOf(" ")!==-1?(t.split(" ").forEach(i=>this.off(i)),this):((t==="change"||t==="added"||t==="removed"||t==="enable"||t==="disable")&&this._gsEventHandler[t]&&this.el.removeEventListener(t,this._gsEventHandler[t]),delete this._gsEventHandler[t],this)}offAll(){return Object.keys(this._gsEventHandler).forEach(t=>this.off(t)),this}removeWidget(t,r=!0,i=!0){return t?(Ne.getElements(t).forEach(o=>{if(o.parentElement&&o.parentElement!==this.el)return;let u=o.gridstackNode;u||(u=this.engine.nodes.find(f=>o===f.el)),u&&(r&&Ne.addRemoveCB&&Ne.addRemoveCB(this.el,u,!1,!1),delete o.gridstackNode,this._removeDD(o),this.engine.removeNode(u,r,i),r&&o.parentElement&&o.remove())}),i&&(this._triggerRemoveEvent(),this._triggerChangeEvent()),this):(console.error("Error: GridStack.removeWidget(undefined) called"),this)}removeAll(t=!0,r=!0){return this.engine.nodes.forEach(i=>{t&&Ne.addRemoveCB&&Ne.addRemoveCB(this.el,i,!1,!1),delete i.el.gridstackNode,this.opts.staticGrid||this._removeDD(i.el)}),this.engine.removeAll(t,r),r&&this._triggerRemoveEvent(),this}setAnimation(t=this.opts.animate,r){return r?setTimeout(()=>{this.opts&&this.setAnimation(t)}):t?this.el.classList.add("grid-stack-animate"):this.el.classList.remove("grid-stack-animate"),this}hasAnimationCSS(){return this.el.classList.contains("grid-stack-animate")}setStatic(t,r=!0,i=!0){return!!this.opts.staticGrid===t?this:(t?this.opts.staticGrid=!0:delete this.opts.staticGrid,this._setupRemoveDrop(),this._setupAcceptWidget(),this.engine.nodes.forEach(o=>{this.prepareDragDrop(o.el),o.subGrid&&i&&o.subGrid.setStatic(t,r,i)}),r&&this._setStaticClass(),this)}updateOptions(t){var i;const r=this.opts;return t.acceptWidgets!==void 0&&this._setupAcceptWidget(),t.animate!==void 0&&this.setAnimation(),t.cellHeight&&(this.cellHeight(t.cellHeight,!0),delete t.cellHeight),t.class&&t.class!==r.class&&(r.class&&this.el.classList.remove(r.class),this.el.classList.add(t.class)),typeof t.column=="number"&&!t.columnOpts&&(this.column(t.column),delete t.column),t.margin!==void 0&&this.margin(t.margin),t.staticGrid!==void 0&&this.setStatic(t.staticGrid),t.disableDrag!==void 0&&!t.staticGrid&&this.enableMove(!t.disableDrag),t.disableResize!==void 0&&!t.staticGrid&&this.enableResize(!t.disableResize),t.float!==void 0&&this.float(t.float),t.row!==void 0&&(r.minRow=r.maxRow=t.row),(i=t.children)!=null&&i.length&&(this.load(t.children),delete t.children),this.opts={...this.opts,...t},this}update(t,r){return Ne.getElements(t).forEach(i=>{var w;const o=i==null?void 0:i.gridstackNode;if(!o)return;const u={...A.copyPos({},o),...A.cloneDeep(r)};this.engine.nodeBoundFix(u),delete u.autoPosition;const f=["x","y","w","h"];let d;if(f.some(v=>u[v]!==void 0&&u[v]!==o[v])&&(d={},f.forEach(v=>{d[v]=u[v]!==void 0?u[v]:o[v],delete u[v]})),!d&&(u.minW||u.minH||u.maxW||u.maxH)&&(d={}),u.content!==void 0){const v=i.querySelector(".grid-stack-item-content");v&&v.textContent!==u.content&&(o.content=u.content,Ne.renderCB(v,u),(w=o.subGrid)!=null&&w.el&&(v.appendChild(o.subGrid.el),o.subGrid.opts.styleInHead||o.subGrid._updateStyles(!0))),delete u.content}let p=!1,m=!1;for(const v in u)v[0]!=="_"&&o[v]!==u[v]&&(o[v]=u[v],p=!0,m=m||!this.opts.staticGrid&&(v==="noResize"||v==="noMove"||v==="locked"));if(A.sanitizeMinMax(o),d){const v=d.w!==void 0&&d.w!==o.w;this.moveNode(o,d),v&&o.subGrid?o.subGrid.onResize(this.hasAnimationCSS()?o.w:void 0):this.resizeToContentCheck(v,o),delete o._orig}(d||p)&&this._writeAttr(i,o),m&&this.prepareDragDrop(o.el)}),this}moveNode(t,r){const i=t._updating;i||this.engine.cleanNodes().beginUpdate(t),this.engine.moveNode(t,r),this._updateContainerHeight(),i||(this._triggerChangeEvent(),this.engine.endUpdate())}resizeToContent(t){var x,z;if(!t||(t.classList.remove("size-to-content-max"),!t.clientHeight))return;const r=t.gridstackNode;if(!r)return;const i=r.grid;if(!i||t.parentElement!==i.el)return;const o=i.getCellHeight(!0);if(!o)return;let u=r.h?r.h*o:t.clientHeight,f;if(r.resizeToContentParent&&(f=t.querySelector(r.resizeToContentParent)),f||(f=t.querySelector(Ne.resizeToContentParent)),!f)return;const d=t.clientHeight-f.clientHeight,p=r.h?r.h*o-d:f.clientHeight;let m;if(r.subGrid){m=r.subGrid.getRow()*r.subGrid.getCellHeight(!0);const R=r.subGrid.el.getBoundingClientRect(),k=r.subGrid.el.parentElement.getBoundingClientRect();m+=R.top-k.top}else{if((z=(x=r.subGridOpts)==null?void 0:x.children)!=null&&z.length)return;{const R=f.firstElementChild;if(!R){console.error(`Error: GridStack.resizeToContent() widget id:${r.id} '${Ne.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return}m=R.getBoundingClientRect().height||p}}if(p===m)return;u+=m-p;let w=Math.ceil(u/o);const v=Number.isInteger(r.sizeToContent)?r.sizeToContent:0;v&&w>v&&(w=v,t.classList.add("size-to-content-max")),r.minH&&wr.maxH&&(w=r.maxH),w!==r.h&&(i._ignoreLayoutsNodeChange=!0,i.moveNode(r,{h:w}),delete i._ignoreLayoutsNodeChange)}resizeToContentCBCheck(t){Ne.resizeToContentCB?Ne.resizeToContentCB(t):this.resizeToContent(t)}rotate(t,r){return Ne.getElements(t).forEach(i=>{const o=i.gridstackNode;if(!A.canBeRotated(o))return;const u={w:o.h,h:o.w,minH:o.minW,minW:o.minH,maxH:o.maxW,maxW:o.maxH};if(r){const d=r.left>0?Math.floor(r.left/this.cellWidth()):0,p=r.top>0?Math.floor(r.top/this.opts.cellHeight):0;u.x=o.x+d-(o.h-(p+1)),u.y=o.y+p-d}Object.keys(u).forEach(d=>{u[d]===void 0&&delete u[d]});const f=o._orig;this.update(i,u),o._orig=f}),this}margin(t){if(!(typeof t=="string"&&t.split(" ").length>1)){const i=A.parseHeight(t);if(this.opts.marginUnit===i.unit&&this.opts.margin===i.h)return}return this.opts.margin=t,this.opts.marginTop=this.opts.marginBottom=this.opts.marginLeft=this.opts.marginRight=void 0,this._initMargin(),this._updateStyles(!0),this}getMargin(){return this.opts.margin}willItFit(t){if(arguments.length>1){console.warn("gridstack.ts: `willItFit(x,y,w,h,autoPosition)` is deprecated. Use `willItFit({x, y,...})`. It will be removed soon");const r=arguments;let i=0,o={x:r[i++],y:r[i++],w:r[i++],h:r[i++],autoPosition:r[i++]};return this.willItFit(o)}return this.engine.willItFit(t)}_triggerChangeEvent(){if(this.engine.batchMode)return this;const t=this.engine.getDirtyNodes(!0);return t&&t.length&&(this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(t),this._triggerEvent("change",t)),this.engine.saveInitial(),this}_triggerAddEvent(){var t;if(this.engine.batchMode)return this;if((t=this.engine.addedNodes)!=null&&t.length){this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(this.engine.addedNodes),this.engine.addedNodes.forEach(i=>{delete i._dirty});const r=[...this.engine.addedNodes];this.engine.addedNodes=[],this._triggerEvent("added",r)}return this}_triggerRemoveEvent(){var t;if(this.engine.batchMode)return this;if((t=this.engine.removedNodes)!=null&&t.length){const r=[...this.engine.removedNodes];this.engine.removedNodes=[],this._triggerEvent("removed",r)}return this}_triggerEvent(t,r){const i=r?new CustomEvent(t,{bubbles:!1,detail:r}):new Event(t);return this.el.dispatchEvent(i),this}_removeStylesheet(){if(this._styles){const t=this.opts.styleInHead?void 0:this.el.parentNode;A.removeStylesheet(this._styleSheetClass,t),delete this._styles}return this}_updateStyles(t=!1,r){if(t&&this._removeStylesheet(),r===void 0&&(r=this.getRow()),this._updateContainerHeight(),this.opts.cellHeight===0)return this;const i=this.opts.cellHeight,o=this.opts.cellHeightUnit,u=`.${this._styleSheetClass} > .${this.opts.itemClass}`;if(!this._styles){const f=this.opts.styleInHead?void 0:this.el.parentNode;if(this._styles=A.createStylesheet(this._styleSheetClass,f,{nonce:this.opts.nonce}),!this._styles)return this;this._styles._max=0,A.addCSSRule(this._styles,u,`height: ${i}${o}`);const d=this.opts.marginTop+this.opts.marginUnit,p=this.opts.marginBottom+this.opts.marginUnit,m=this.opts.marginRight+this.opts.marginUnit,w=this.opts.marginLeft+this.opts.marginUnit,v=`${u} > .grid-stack-item-content`,x=`.${this._styleSheetClass} > .grid-stack-placeholder > .placeholder-content`;A.addCSSRule(this._styles,v,`top: ${d}; right: ${m}; bottom: ${p}; left: ${w};`),A.addCSSRule(this._styles,x,`top: ${d}; right: ${m}; bottom: ${p}; left: ${w};`),A.addCSSRule(this._styles,`${u} > .ui-resizable-n`,`top: ${d};`),A.addCSSRule(this._styles,`${u} > .ui-resizable-s`,`bottom: ${p}`),A.addCSSRule(this._styles,`${u} > .ui-resizable-ne`,`right: ${m}; top: ${d}`),A.addCSSRule(this._styles,`${u} > .ui-resizable-e`,`right: ${m}`),A.addCSSRule(this._styles,`${u} > .ui-resizable-se`,`right: ${m}; bottom: ${p}`),A.addCSSRule(this._styles,`${u} > .ui-resizable-nw`,`left: ${w}; top: ${d}`),A.addCSSRule(this._styles,`${u} > .ui-resizable-w`,`left: ${w}`),A.addCSSRule(this._styles,`${u} > .ui-resizable-sw`,`left: ${w}; bottom: ${p}`)}if(r=r||this._styles._max,r>this._styles._max){const f=d=>i*d+o;for(let d=this._styles._max+1;d<=r;d++)A.addCSSRule(this._styles,`${u}[gs-y="${d}"]`,`top: ${f(d)}`),A.addCSSRule(this._styles,`${u}[gs-h="${d+1}"]`,`height: ${f(d+1)}`);this._styles._max=r}return this}_updateContainerHeight(){if(!this.engine||this.engine.batchMode)return this;const t=this.parentGridNode;let r=this.getRow()+this._extraDragRow;const i=this.opts.cellHeight,o=this.opts.cellHeightUnit;if(!i)return this;if(!t){const u=A.parseHeight(getComputedStyle(this.el).minHeight);if(u.h>0&&u.unit===o){const f=Math.floor(u.h/i);r1?t.setAttribute("gs-w",String(r.w)):t.removeAttribute("gs-w"),r.h>1?t.setAttribute("gs-h",String(r.h)):t.removeAttribute("gs-h"),this}_writeAttr(t,r){if(!r)return this;this._writePosAttr(t,r);const i={noResize:"gs-no-resize",noMove:"gs-no-move",locked:"gs-locked",id:"gs-id",sizeToContent:"gs-size-to-content"};for(const o in i)r[o]?t.setAttribute(i[o],String(r[o])):t.removeAttribute(i[o]);return this}_readAttr(t,r=!0){const i={};i.x=A.toNumber(t.getAttribute("gs-x")),i.y=A.toNumber(t.getAttribute("gs-y")),i.w=A.toNumber(t.getAttribute("gs-w")),i.h=A.toNumber(t.getAttribute("gs-h")),i.autoPosition=A.toBool(t.getAttribute("gs-auto-position")),i.noResize=A.toBool(t.getAttribute("gs-no-resize")),i.noMove=A.toBool(t.getAttribute("gs-no-move")),i.locked=A.toBool(t.getAttribute("gs-locked"));const o=t.getAttribute("gs-size-to-content");o&&(o==="true"||o==="false"?i.sizeToContent=A.toBool(o):i.sizeToContent=parseInt(o,10)),i.id=t.getAttribute("gs-id"),i.maxW=A.toNumber(t.getAttribute("gs-max-w")),i.minW=A.toNumber(t.getAttribute("gs-min-w")),i.maxH=A.toNumber(t.getAttribute("gs-max-h")),i.minH=A.toNumber(t.getAttribute("gs-min-h")),r&&(i.w===1&&t.removeAttribute("gs-w"),i.h===1&&t.removeAttribute("gs-h"),i.maxW&&t.removeAttribute("gs-max-w"),i.minW&&t.removeAttribute("gs-min-w"),i.maxH&&t.removeAttribute("gs-max-h"),i.minH&&t.removeAttribute("gs-min-h"));for(const u in i){if(!i.hasOwnProperty(u))return;!i[u]&&i[u]!==0&&u!=="gs-size-to-content"&&delete i[u]}return i}_setStaticClass(){const t=["grid-stack-static"];return this.opts.staticGrid?(this.el.classList.add(...t),this.el.setAttribute("gs-static","true")):(this.el.classList.remove(...t),this.el.removeAttribute("gs-static")),this}onResize(t=(r=>(r=this.el)==null?void 0:r.clientWidth)()){if(!t||this.prevWidth===t)return;this.prevWidth=t,this.batchUpdate();let i=!1;return this._autoColumn&&this.parentGridNode?this.opts.column!==this.parentGridNode.w&&(this.column(this.parentGridNode.w,this.opts.layout||"list"),i=!0):i=this.checkDynamicColumn(),this._isAutoCellHeight&&this.cellHeight(),this.engine.nodes.forEach(o=>{o.subGrid&&o.subGrid.onResize()}),this._skipInitialResize||this.resizeToContentCheck(i),delete this._skipInitialResize,this.batchUpdate(!1),this}resizeToContentCheck(t=!1,r=void 0){if(this.engine){if(t&&this.hasAnimationCSS())return setTimeout(()=>this.resizeToContentCheck(!1,r),this.animationDelay);if(r)A.shouldSizeToContent(r)&&this.resizeToContentCBCheck(r.el);else if(this.engine.nodes.some(i=>A.shouldSizeToContent(i))){const i=[...this.engine.nodes];this.batchUpdate(),i.forEach(o=>{A.shouldSizeToContent(o)&&this.resizeToContentCBCheck(o.el)}),this.batchUpdate(!1)}this._gsEventHandler.resizecontent&&this._gsEventHandler.resizecontent(null,r?[r]:this.engine.nodes)}}_updateResizeEvent(t=!1){const r=!this.parentGridNode&&(this._isAutoCellHeight||this.opts.sizeToContent||this.opts.columnOpts||this.engine.nodes.find(i=>i.sizeToContent));return!t&&r&&!this.resizeObserver?(this._sizeThrottle=A.throttle(()=>this.onResize(),this.opts.cellHeightThrottle),this.resizeObserver=new ResizeObserver(()=>this._sizeThrottle()),this.resizeObserver.observe(this.el),this._skipInitialResize=!0):(t||!r)&&this.resizeObserver&&(this.resizeObserver.disconnect(),delete this.resizeObserver,delete this._sizeThrottle),this}static getElement(t=".grid-stack-item"){return A.getElement(t)}static getElements(t=".grid-stack-item"){return A.getElements(t)}static getGridElement(t){return Ne.getElement(t)}static getGridElements(t){return A.getElements(t)}_initMargin(){let t,r=0,i=[];return typeof this.opts.margin=="string"&&(i=this.opts.margin.split(" ")),i.length===2?(this.opts.marginTop=this.opts.marginBottom=i[0],this.opts.marginLeft=this.opts.marginRight=i[1]):i.length===4?(this.opts.marginTop=i[0],this.opts.marginRight=i[1],this.opts.marginBottom=i[2],this.opts.marginLeft=i[3]):(t=A.parseHeight(this.opts.margin),this.opts.marginUnit=t.unit,r=this.opts.margin=t.h),this.opts.marginTop===void 0?this.opts.marginTop=r:(t=A.parseHeight(this.opts.marginTop),this.opts.marginTop=t.h,delete this.opts.margin),this.opts.marginBottom===void 0?this.opts.marginBottom=r:(t=A.parseHeight(this.opts.marginBottom),this.opts.marginBottom=t.h,delete this.opts.margin),this.opts.marginRight===void 0?this.opts.marginRight=r:(t=A.parseHeight(this.opts.marginRight),this.opts.marginRight=t.h,delete this.opts.margin),this.opts.marginLeft===void 0?this.opts.marginLeft=r:(t=A.parseHeight(this.opts.marginLeft),this.opts.marginLeft=t.h,delete this.opts.margin),this.opts.marginUnit=t.unit,this.opts.marginTop===this.opts.marginBottom&&this.opts.marginLeft===this.opts.marginRight&&this.opts.marginTop===this.opts.marginRight&&(this.opts.margin=this.opts.marginTop),this}static getDD(){return $n}static setupDragIn(t,r,i,o=document){(r==null?void 0:r.pause)!==void 0&&(Le.pauseDrag=r.pause),r={appendTo:"body",helper:"clone",...r||{}},(typeof t=="string"?A.getElements(t,o):t).forEach((f,d)=>{$n.isDraggable(f)||$n.dragIn(f,r),i!=null&&i[d]&&(f.gridstackNode=i[d])})}movable(t,r){return this.opts.staticGrid?this:(Ne.getElements(t).forEach(i=>{const o=i.gridstackNode;o&&(r?delete o.noMove:o.noMove=!0,this.prepareDragDrop(o.el))}),this)}resizable(t,r){return this.opts.staticGrid?this:(Ne.getElements(t).forEach(i=>{const o=i.gridstackNode;o&&(r?delete o.noResize:o.noResize=!0,this.prepareDragDrop(o.el))}),this)}disable(t=!0){if(!this.opts.staticGrid)return this.enableMove(!1,t),this.enableResize(!1,t),this._triggerEvent("disable"),this}enable(t=!0){if(!this.opts.staticGrid)return this.enableMove(!0,t),this.enableResize(!0,t),this._triggerEvent("enable"),this}enableMove(t,r=!0){return this.opts.staticGrid?this:(t?delete this.opts.disableDrag:this.opts.disableDrag=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&r&&i.subGrid.enableMove(t,r)}),this)}enableResize(t,r=!0){return this.opts.staticGrid?this:(t?delete this.opts.disableResize:this.opts.disableResize=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&r&&i.subGrid.enableResize(t,r)}),this)}cancelDrag(){var r;const t=(r=this._placeholder)==null?void 0:r.gridstackNode;t&&(t._isExternal?(t._isAboutToRemove=!0,this.engine.removeNode(t)):t._isAboutToRemove&&Ne._itemRemoving(t.el,!1),this.engine.restoreInitial())}_removeDD(t){return $n.draggable(t,"destroy").resizable(t,"destroy"),t.gridstackNode&&delete t.gridstackNode._initDD,delete t.ddElement,this}_setupAcceptWidget(){if(this.opts.staticGrid||!this.opts.acceptWidgets&&!this.opts.removable)return $n.droppable(this.el,"destroy"),this;let t,r;const i=(o,u,f)=>{var x;f=f||u;const d=f.gridstackNode;if(!d)return;if(!((x=d.grid)!=null&&x.el)){f.style.transform=`scale(${1/this.dragTransform.xScale},${1/this.dragTransform.yScale})`;const z=f.getBoundingClientRect();f.style.left=z.x+(this.dragTransform.xScale-1)*(o.clientX-z.x)/this.dragTransform.xScale+"px",f.style.top=z.y+(this.dragTransform.yScale-1)*(o.clientY-z.y)/this.dragTransform.yScale+"px",f.style.transformOrigin="0px 0px"}let{top:p,left:m}=f.getBoundingClientRect();const w=this.el.getBoundingClientRect();m-=w.left,p-=w.top;const v={position:{top:p*this.dragTransform.xScale,left:m*this.dragTransform.yScale}};if(d._temporaryRemoved){if(d.x=Math.max(0,Math.round(m/r)),d.y=Math.max(0,Math.round(p/t)),delete d.autoPosition,this.engine.nodeBoundFix(d),!this.engine.willItFit(d)){if(d.autoPosition=!0,!this.engine.willItFit(d)){$n.off(u,"drag");return}d._willFitPos&&(A.copyPos(d,d._willFitPos),delete d._willFitPos)}this._onStartMoving(f,o,v,d,r,t)}else this._dragOrResize(f,o,v,d,r,t)};return $n.droppable(this.el,{accept:o=>{const u=o.gridstackNode||this._readAttr(o,!1);if((u==null?void 0:u.grid)===this)return!0;if(!this.opts.acceptWidgets)return!1;let f=!0;if(typeof this.opts.acceptWidgets=="function")f=this.opts.acceptWidgets(o);else{const d=this.opts.acceptWidgets===!0?".grid-stack-item":this.opts.acceptWidgets;f=o.matches(d)}if(f&&u&&this.opts.maxRow){const d={w:u.w,h:u.h,minW:u.minW,minH:u.minH};f=this.engine.willItFit(d)}return f}}).on(this.el,"dropover",(o,u,f)=>{let d=(f==null?void 0:f.gridstackNode)||u.gridstackNode;if((d==null?void 0:d.grid)===this&&!d._temporaryRemoved)return!1;if(d!=null&&d._sidebarOrig&&(d.w=d._sidebarOrig.w,d.h=d._sidebarOrig.h),d!=null&&d.grid&&d.grid!==this&&!d._temporaryRemoved&&d.grid._leave(u,f),f=f||u,r=this.cellWidth(),t=this.getCellHeight(!0),!d){const w=f.getAttribute("data-gs-widget")||f.getAttribute("gridstacknode");if(w){try{d=JSON.parse(w)}catch{console.error("Gridstack dropover: Bad JSON format: ",w)}f.removeAttribute("data-gs-widget"),f.removeAttribute("gridstacknode")}d||(d=this._readAttr(f)),d._sidebarOrig={w:d.w,h:d.h}}d.grid||(d.el||(d={...d}),d._isExternal=!0,f.gridstackNode=d);const p=d.w||Math.round(f.offsetWidth/r)||1,m=d.h||Math.round(f.offsetHeight/t)||1;return d.grid&&d.grid!==this?(u._gridstackNodeOrig||(u._gridstackNodeOrig=d),u.gridstackNode=d={...d,w:p,h:m,grid:this},delete d.x,delete d.y,this.engine.cleanupNode(d).nodeBoundFix(d),d._initDD=d._isExternal=d._temporaryRemoved=!0):(d.w=p,d.h=m,d._temporaryRemoved=!0),Ne._itemRemoving(d.el,!1),$n.on(u,"drag",i),i(o,u,f),!1}).on(this.el,"dropout",(o,u,f)=>{const d=(f==null?void 0:f.gridstackNode)||u.gridstackNode;return d&&(!d.grid||d.grid===this)&&(this._leave(u,f),this._isTemp&&this.removeAsSubGrid(d)),!1}).on(this.el,"drop",(o,u,f)=>{var z,R,k;const d=(f==null?void 0:f.gridstackNode)||u.gridstackNode;if((d==null?void 0:d.grid)===this&&!d._isExternal)return!1;const p=!!this.placeholder.parentElement,m=u!==f;this.placeholder.remove(),delete this.placeholder.gridstackNode;const w=p&&this.opts.animate;w&&this.setAnimation(!1);const v=u._gridstackNodeOrig;if(delete u._gridstackNodeOrig,p&&(v!=null&&v.grid)&&v.grid!==this){const b=v.grid;b.engine.removeNodeFromLayoutCache(v),b.engine.removedNodes.push(v),b._triggerRemoveEvent()._triggerChangeEvent(),b.parentGridNode&&!b.engine.nodes.length&&b.opts.subGridDynamic&&b.removeAsSubGrid()}if(!d||(p&&(this.engine.cleanupNode(d),d.grid=this),(z=d.grid)==null||delete z._isTemp,$n.off(u,"drag"),f!==u?(f.remove(),u=f):u.remove(),this._removeDD(u),!p))return!1;const x=(k=(R=d.subGrid)==null?void 0:R.el)==null?void 0:k.gridstack;return A.copyPos(d,this._readAttr(this.placeholder)),A.removePositioningStyles(u),m&&(d.content||d.subGridOpts||Ne.addRemoveCB)?(delete d.el,u=this.addWidget(d)):(this._prepareElement(u,!0,d),this.el.appendChild(u),this.resizeToContentCheck(!1,d),x&&(x.parentGridNode=d,x.opts.styleInHead||x._updateStyles(!0)),this._updateContainerHeight()),this.engine.addedNodes.push(d),this._triggerAddEvent(),this._triggerChangeEvent(),this.engine.endUpdate(),this._gsEventHandler.dropped&&this._gsEventHandler.dropped({...o,type:"dropped"},v&&v.grid?v:void 0,d),w&&this.setAnimation(this.opts.animate,!0),!1}),this}static _itemRemoving(t,r){if(!t)return;const i=t?t.gridstackNode:void 0;!(i!=null&&i.grid)||t.classList.contains(i.grid.opts.removableOptions.decline)||(r?i._isAboutToRemove=!0:delete i._isAboutToRemove,r?t.classList.add("grid-stack-item-removing"):t.classList.remove("grid-stack-item-removing"))}_setupRemoveDrop(){if(typeof this.opts.removable!="string")return this;const t=document.querySelector(this.opts.removable);return t?(!this.opts.staticGrid&&!$n.isDroppable(t)&&$n.droppable(t,this.opts.removableOptions).on(t,"dropover",(r,i)=>Ne._itemRemoving(i,!0)).on(t,"dropout",(r,i)=>Ne._itemRemoving(i,!1)),this):this}prepareDragDrop(t,r=!1){const i=t==null?void 0:t.gridstackNode;if(!i)return;const o=i.noMove||this.opts.disableDrag,u=i.noResize||this.opts.disableResize,f=this.opts.staticGrid||o&&u;if((r||f)&&(i._initDD&&(this._removeDD(t),delete i._initDD),f&&t.classList.add("ui-draggable-disabled","ui-resizable-disabled"),!r))return this;if(!i._initDD){let d,p;const m=(x,z)=>{this._gsEventHandler[x.type]&&this._gsEventHandler[x.type](x,x.target),d=this.cellWidth(),p=this.getCellHeight(!0),this._onStartMoving(t,x,z,i,d,p)},w=(x,z)=>{this._dragOrResize(t,x,z,i,d,p)},v=x=>{this.placeholder.remove(),delete this.placeholder.gridstackNode,delete i._moving,delete i._event,delete i._lastTried;const z=i.w!==i._orig.w,R=x.target;if(!(!R.gridstackNode||R.gridstackNode.grid!==this)){if(i.el=R,i._isAboutToRemove){const k=t.gridstackNode.grid;k._gsEventHandler[x.type]&&k._gsEventHandler[x.type](x,R),k.engine.nodes.push(i),k.removeWidget(t,!0,!0)}else A.removePositioningStyles(R),i._temporaryRemoved?(A.copyPos(i,i._orig),this._writePosAttr(R,i),this.engine.addNode(i)):this._writePosAttr(R,i),this._gsEventHandler[x.type]&&this._gsEventHandler[x.type](x,R);this._extraDragRow=0,this._updateContainerHeight(),this._triggerChangeEvent(),this.engine.endUpdate(),x.type==="resizestop"&&(Number.isInteger(i.sizeToContent)&&(i.sizeToContent=i.h),this.resizeToContentCheck(z,i))}};$n.draggable(t,{start:m,stop:v,drag:w}).resizable(t,{start:m,stop:v,resize:w}),i._initDD=!0}return $n.draggable(t,o?"disable":"enable").resizable(t,u?"disable":"enable"),this}_onStartMoving(t,r,i,o,u,f){var d;if(this.engine.cleanNodes().beginUpdate(o),this._writePosAttr(this.placeholder,o),this.el.appendChild(this.placeholder),this.placeholder.gridstackNode=o,(d=o.grid)!=null&&d.el)this.dragTransform=A.getValuesFromTransformedElement(t);else if(this.placeholder&&this.placeholder.closest(".grid-stack")){const p=this.placeholder.closest(".grid-stack");this.dragTransform=A.getValuesFromTransformedElement(p)}else this.dragTransform={xScale:1,xOffset:0,yScale:1,yOffset:0};if(o.el=this.placeholder,o._lastUiPosition=i.position,o._prevYPix=i.position.top,o._moving=r.type==="dragstart",delete o._lastTried,r.type==="dropover"&&o._temporaryRemoved&&(this.engine.addNode(o),o._moving=!0),this.engine.cacheRects(u,f,this.opts.marginTop,this.opts.marginRight,this.opts.marginBottom,this.opts.marginLeft),r.type==="resizestart"){const p=this.getColumn()-o.x,m=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-o.y;$n.resizable(t,"option","minWidth",u*Math.min(o.minW||1,p)).resizable(t,"option","minHeight",f*Math.min(o.minH||1,m)).resizable(t,"option","maxWidth",u*Math.min(o.maxW||Number.MAX_SAFE_INTEGER,p)).resizable(t,"option","maxWidthMoveLeft",u*Math.min(o.maxW||Number.MAX_SAFE_INTEGER,o.x+o.w)).resizable(t,"option","maxHeight",f*Math.min(o.maxH||Number.MAX_SAFE_INTEGER,m)).resizable(t,"option","maxHeightMoveUp",f*Math.min(o.maxH||Number.MAX_SAFE_INTEGER,o.y+o.h))}}_dragOrResize(t,r,i,o,u,f){const d={...o._orig};let p,m=this.opts.marginLeft,w=this.opts.marginRight,v=this.opts.marginTop,x=this.opts.marginBottom;const z=Math.round(f*.1),R=Math.round(u*.1);if(m=Math.min(m,R),w=Math.min(w,R),v=Math.min(v,z),x=Math.min(x,z),r.type==="drag"){if(o._temporaryRemoved)return;const b=i.position.top-o._prevYPix;o._prevYPix=i.position.top,this.opts.draggable.scroll!==!1&&A.updateScrollPosition(t,i.position,b);const B=i.position.left+(i.position.left>o._lastUiPosition.left?-w:m),P=i.position.top+(i.position.top>o._lastUiPosition.top?-x:v);d.x=Math.round(B/u),d.y=Math.round(P/f);const W=this._extraDragRow;if(this.engine.collide(o,d)){const V=this.getRow();let Z=Math.max(0,d.y+o.h-V);this.opts.maxRow&&V+Z>this.opts.maxRow&&(Z=Math.max(0,this.opts.maxRow-V)),this._extraDragRow=Z}else this._extraDragRow=0;if(this._extraDragRow!==W&&this._updateContainerHeight(),o.x===d.x&&o.y===d.y)return}else if(r.type==="resize"){if(d.x<0||(A.updateScrollResize(r,t,f),d.w=Math.round((i.size.width-m)/u),d.h=Math.round((i.size.height-v)/f),o.w===d.w&&o.h===d.h)||o._lastTried&&o._lastTried.w===d.w&&o._lastTried.h===d.h)return;const b=i.position.left+m,B=i.position.top+v;d.x=Math.round(b/u),d.y=Math.round(B/f),p=!0}o._event=r,o._lastTried=d;const k={x:i.position.left+m,y:i.position.top+v,w:(i.size?i.size.width:o.w*u)-m-w,h:(i.size?i.size.height:o.h*f)-v-x};if(this.engine.moveNodeCheck(o,{...d,cellWidth:u,cellHeight:f,rect:k,resizing:p})){o._lastUiPosition=i.position,this.engine.cacheRects(u,f,v,w,x,m),delete o._skipDown,p&&o.subGrid&&o.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();const b=r.target;o._sidebarOrig||this._writePosAttr(b,o),this._gsEventHandler[r.type]&&this._gsEventHandler[r.type](r,b)}}_leave(t,r){r=r||t;const i=r.gridstackNode;if(!i||(r.style.transform=r.style.transformOrigin=null,$n.off(t,"drag"),i._temporaryRemoved))return;i._temporaryRemoved=!0,this.engine.removeNode(i),i.el=i._isExternal&&r?r:t;const o=i._sidebarOrig;i._isExternal&&this.engine.cleanupNode(i),i._sidebarOrig=o,this.opts.removable===!0&&Ne._itemRemoving(t,!0),t._gridstackNodeOrig?(t.gridstackNode=t._gridstackNodeOrig,delete t._gridstackNodeOrig):i._isExternal&&this.engine.restoreInitial()}commit(){return vS(this,this.batchUpdate(!1),"commit","batchUpdate","5.2"),this}}Ne.renderCB=(l,t)=>{l&&(t!=null&&t.content)&&(l.textContent=t.content)};Ne.resizeToContentParent=".grid-stack-item-content";Ne.Utils=A;Ne.Engine=ai;Ne.GDRev="11.5.1";function xS({widget:l,onRemove:t}){const r=dS[l.kind];return U.jsxs("div",{className:"widget",children:[U.jsxs("div",{className:"widget-header",children:[U.jsx("span",{className:"widget-grip","aria-hidden":!0,children:"⠿"}),U.jsx("span",{className:"widget-icon",children:r==null?void 0:r.icon}),U.jsx("span",{className:"widget-title",children:(r==null?void 0:r.title)||l.kind}),U.jsx("button",{className:"widget-close",title:"Remove widget",onClick:t,children:"×"})]}),U.jsx("div",{className:"widget-body",children:r?r.render(l.id):null})]})}function _S(){const l=Eo(w=>w.widgets),t=Eo(w=>w.updateGeom),r=Eo(w=>w.removeWidget),i=j.useRef(null),o=j.useRef(null),u=j.useRef(new Map),[f,d]=j.useState(new Map),[p,m]=j.useState(!1);return j.useEffect(()=>{if(!i.current)return;const w=Ne.init({column:12,cellHeight:56,margin:8,float:!0,handle:".widget-header",resizable:{handles:"e, se, s, sw, w"},animate:!0},i.current);return o.current=w,w.on("change",(v,x)=>{const z=x.map(R=>({id:String(R.id),x:R.x??0,y:R.y??0,w:R.w??1,h:R.h??1}));z.length&&t(z)}),m(!0),()=>{w.destroy(!1),o.current=null}},[t]),j.useEffect(()=>{const w=o.current;if(!w||!p)return;const v=new Set(l.map(R=>R.id));let x=!1;const z=new Map(f);w.batchUpdate();for(const R of l){if(u.current.has(R.id))continue;const k=w.addWidget({x:R.x,y:R.y,w:R.w,h:R.h,id:R.id}),b=k.querySelector(".grid-stack-item-content");u.current.set(R.id,k),z.set(R.id,b),x=!0}for(const[R,k]of Array.from(u.current.entries()))v.has(R)||(w.removeWidget(k,!0),u.current.delete(R),z.delete(R),x=!0);w.commit(),x&&d(z)},[l,p]),U.jsxs("div",{className:"canvas",children:[U.jsx("div",{className:"grid-stack",ref:i}),l.map(w=>{const v=f.get(w.id);return v?bs.createPortal(U.jsx(xS,{widget:w,onRemove:()=>r(w.id)}),v,w.id):null})]})}function ES(){const l=gn(d=>d.addSignalToPlot),t=gn(d=>d.setMotorTypes),[r,i]=j.useState(null),o=ry(ny($f,{activationConstraint:{distance:4}}));j.useEffect(()=>{Im(),A1().then(t)},[t]);const u=d=>{var m;const p=(m=d.active.data.current)==null?void 0:m.signalId;i(p?If(p):null)},f=d=>{var w,v,x,z;i(null);const p=(w=d.active.data.current)==null?void 0:w.signalId,m=((x=(v=d.over)==null?void 0:v.id)==null?void 0:x.toString())||"";if(p&&m.startsWith("plot:")){const R=(z=d.over.data.current)==null?void 0:z.panelId;l(R,p)}};return U.jsxs(e0,{sensors:o,onDragStart:u,onDragEnd:f,children:[U.jsxs("div",{className:"app",children:[U.jsx(hS,{}),U.jsxs("div",{className:"body",children:[U.jsx(mS,{}),U.jsx("main",{className:"canvas-host",children:U.jsx(_S,{})})]})]}),U.jsx(S0,{dropAnimation:null,children:r?U.jsx("div",{className:"drag-ghost",children:r}):null})]})}Bv.createRoot(document.getElementById("root")).render(U.jsx(ht.StrictMode,{children:U.jsx(ES,{})})); diff --git a/damiao_motor/gui/webapp/dist/assets/index-BsxMcYGb.css b/damiao_motor/gui/webapp/dist/assets/index-BsxMcYGb.css new file mode 100644 index 0000000..2025722 --- /dev/null +++ b/damiao_motor/gui/webapp/dist/assets/index-BsxMcYGb.css @@ -0,0 +1 @@ +.uplot,.uplot *,.uplot *:before,.uplot *:after{box-sizing:border-box}.uplot{font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";line-height:1.5;width:min-content}.u-title{text-align:center;font-size:18px;font-weight:700}.u-wrap{position:relative;-webkit-user-select:none;user-select:none}.u-over,.u-under{position:absolute}.u-under{overflow:hidden}.uplot canvas{display:block;position:relative;width:100%;height:100%}.u-axis{position:absolute}.u-legend{font-size:14px;margin:auto;text-align:center}.u-inline{display:block}.u-inline *{display:inline-block}.u-inline tr{margin-right:16px}.u-legend th{font-weight:600}.u-legend th>*{vertical-align:middle;display:inline-block}.u-legend .u-marker{width:1em;height:1em;margin-right:4px;background-clip:padding-box!important}.u-inline.u-live th:after{content:":";vertical-align:middle}.u-inline:not(.u-live) .u-value{display:none}.u-series>*{padding:4px}.u-series th{cursor:pointer}.u-legend .u-off>*{opacity:.3}.u-select{background:#00000012;position:absolute;pointer-events:none}.u-cursor-x,.u-cursor-y{position:absolute;left:0;top:0;pointer-events:none;will-change:transform}.u-hz .u-cursor-x,.u-vt .u-cursor-y{height:100%;border-right:1px dashed #607D8B}.u-hz .u-cursor-y,.u-vt .u-cursor-x{width:100%;border-bottom:1px dashed #607D8B}.u-cursor-pt{position:absolute;top:0;left:0;border-radius:50%;border:0 solid;pointer-events:none;will-change:transform;background-clip:padding-box!important}.u-axis.u-off,.u-select.u-off,.u-cursor-x.u-off,.u-cursor-y.u-off,.u-cursor-pt.u-off{display:none}.grid-stack{position:relative}.grid-stack-rtl{direction:ltr}.grid-stack-rtl>.grid-stack-item{direction:rtl}.grid-stack-placeholder>.placeholder-content{background-color:#0000001a;margin:0;position:absolute;width:auto;z-index:0!important}.grid-stack>.grid-stack-item{position:absolute;padding:0}.grid-stack>.grid-stack-item>.grid-stack-item-content{margin:0;position:absolute;width:auto;overflow-x:hidden;overflow-y:auto}.grid-stack>.grid-stack-item.size-to-content:not(.size-to-content-max)>.grid-stack-item-content{overflow-y:hidden}.grid-stack-item>.ui-resizable-handle{position:absolute;font-size:.1px;display:block;-ms-touch-action:none;touch-action:none}.grid-stack-item.ui-resizable-autohide>.ui-resizable-handle,.grid-stack-item.ui-resizable-disabled>.ui-resizable-handle{display:none}.grid-stack-item>.ui-resizable-ne,.grid-stack-item>.ui-resizable-nw,.grid-stack-item>.ui-resizable-se,.grid-stack-item>.ui-resizable-sw{background-image:url('data:image/svg+xml;utf8,');background-repeat:no-repeat;background-position:center}.grid-stack-item>.ui-resizable-ne{transform:rotate(45deg)}.grid-stack-item>.ui-resizable-sw{transform:rotate(45deg)}.grid-stack-item>.ui-resizable-nw{transform:rotate(-45deg)}.grid-stack-item>.ui-resizable-se{transform:rotate(-45deg)}.grid-stack-item>.ui-resizable-nw{cursor:nw-resize;width:20px;height:20px;top:0}.grid-stack-item>.ui-resizable-n{cursor:n-resize;height:10px;top:0;left:25px;right:25px}.grid-stack-item>.ui-resizable-ne{cursor:ne-resize;width:20px;height:20px;top:0}.grid-stack-item>.ui-resizable-e{cursor:e-resize;width:10px;top:15px;bottom:15px}.grid-stack-item>.ui-resizable-se{cursor:se-resize;width:20px;height:20px}.grid-stack-item>.ui-resizable-s{cursor:s-resize;height:10px;left:25px;bottom:0;right:25px}.grid-stack-item>.ui-resizable-sw{cursor:sw-resize;width:20px;height:20px}.grid-stack-item>.ui-resizable-w{cursor:w-resize;width:10px;top:15px;bottom:15px}.grid-stack-item.ui-draggable-dragging>.ui-resizable-handle{display:none!important}.grid-stack-item.ui-draggable-dragging{will-change:left,top;cursor:move}.grid-stack-item.ui-resizable-resizing{will-change:width,height}.ui-draggable-dragging,.ui-resizable-resizing{z-index:10000}.ui-draggable-dragging>.grid-stack-item-content,.ui-resizable-resizing>.grid-stack-item-content{box-shadow:1px 4px 6px #0003;opacity:.8}.grid-stack-animate,.grid-stack-animate .grid-stack-item{transition:left .3s,top .3s,height .3s,width .3s}.grid-stack-animate .grid-stack-item.grid-stack-placeholder,.grid-stack-animate .grid-stack-item.ui-draggable-dragging,.grid-stack-animate .grid-stack-item.ui-resizable-resizing{transition:left 0s,top 0s,height 0s,width 0s}.grid-stack>.grid-stack-item[gs-y="0"]{top:0}.grid-stack>.grid-stack-item[gs-x="0"]{left:0}.gs-12>.grid-stack-item{width:8.333%}.gs-12>.grid-stack-item[gs-x="1"]{left:8.333%}.gs-12>.grid-stack-item[gs-w="2"]{width:16.667%}.gs-12>.grid-stack-item[gs-x="2"]{left:16.667%}.gs-12>.grid-stack-item[gs-w="3"]{width:25%}.gs-12>.grid-stack-item[gs-x="3"]{left:25%}.gs-12>.grid-stack-item[gs-w="4"]{width:33.333%}.gs-12>.grid-stack-item[gs-x="4"]{left:33.333%}.gs-12>.grid-stack-item[gs-w="5"]{width:41.667%}.gs-12>.grid-stack-item[gs-x="5"]{left:41.667%}.gs-12>.grid-stack-item[gs-w="6"]{width:50%}.gs-12>.grid-stack-item[gs-x="6"]{left:50%}.gs-12>.grid-stack-item[gs-w="7"]{width:58.333%}.gs-12>.grid-stack-item[gs-x="7"]{left:58.333%}.gs-12>.grid-stack-item[gs-w="8"]{width:66.667%}.gs-12>.grid-stack-item[gs-x="8"]{left:66.667%}.gs-12>.grid-stack-item[gs-w="9"]{width:75%}.gs-12>.grid-stack-item[gs-x="9"]{left:75%}.gs-12>.grid-stack-item[gs-w="10"]{width:83.333%}.gs-12>.grid-stack-item[gs-x="10"]{left:83.333%}.gs-12>.grid-stack-item[gs-w="11"]{width:91.667%}.gs-12>.grid-stack-item[gs-x="11"]{left:91.667%}.gs-12>.grid-stack-item[gs-w="12"]{width:100%}.gs-1>.grid-stack-item{width:100%}:root{--bg: #0f1216;--bg-1: #141a21;--surface: #171d25;--surface-2: #1d242e;--border: #262e3a;--border-soft: #1f2630;--text: #d7dde5;--muted: #8a94a3;--accent: #6aa3ff;--ok: #4ade80;--warn: #fbbf24;--err: #fb7185;--radius: 14px;--radius-sm: 9px;--shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px -16px rgba(0, 0, 0, .65);--font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;--mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace}*{box-sizing:border-box}html,body,#root{height:100%;margin:0}body{font-family:var(--font);background:var(--bg);color:var(--text);font-size:13px;-webkit-font-smoothing:antialiased}.mono{font-family:var(--mono);font-variant-numeric:tabular-nums}.muted{color:var(--muted)}.small{font-size:11px}.center{text-align:center}.pad{padding:16px}.strong{font-weight:650}.dim{opacity:.5}.app{display:flex;flex-direction:column;height:100%}.body{flex:1;display:flex;min-height:0}.canvas-host{flex:1;min-width:0;position:relative;overflow:auto}.canvas{min-height:100%;padding:6px}.toolbar{display:flex;align-items:center;gap:16px;height:52px;padding:0 16px;background:linear-gradient(180deg,#161c24,#0f1216);border-bottom:1px solid var(--border-soft)}.brand{font-weight:650;font-size:15px;letter-spacing:.2px;display:flex;align-items:center;gap:9px}.brand-sub{color:var(--muted);font-weight:500;font-size:12px}.brand-dot{width:9px;height:9px;border-radius:50%;background:var(--accent);box-shadow:0 0 12px var(--accent)}.conn{display:flex;align-items:center;gap:9px}.conn .dot{width:8px;height:8px;border-radius:50%}.dot.on{background:var(--ok);box-shadow:0 0 9px var(--ok)}.dot.off{background:var(--err)}.spacer{flex:1}.actions{display:flex;gap:7px}.badge{font-size:10.5px;padding:2px 8px;border-radius:999px;font-weight:650;border:1px solid transparent;text-transform:uppercase;letter-spacing:.4px}.badge.ok{color:var(--ok);border-color:#4ade8059;background:#4ade801a}.badge.warn{color:var(--warn);border-color:#fbbf2459;background:#fbbf241a}.badge.err{color:var(--err);border-color:#fb718559;background:#fb71851a}.btn{background:var(--surface-2);color:var(--text);border:1px solid var(--border);border-radius:var(--radius-sm);padding:6px 11px;font-size:12px;cursor:pointer;transition:background .15s,border-color .15s,transform .05s}.btn:hover{background:#232c38;border-color:#33404f}.btn:active{transform:translateY(1px)}.btn.ghost{background:transparent}.btn.small{padding:3px 9px;font-size:11px}.btn.active{border-color:var(--accent);color:var(--accent)}.btn-icon{color:var(--accent);margin-right:2px}.sidebar{width:236px;flex-shrink:0;background:var(--bg-1);border-right:1px solid var(--border-soft);display:flex;flex-direction:column}.sidebar-head{padding:12px 14px;border-bottom:1px solid var(--border-soft)}.sidebar-title{font-weight:650;margin-bottom:9px}.filter,.type-select,select,input[type=text],input[type=number]{width:100%;background:var(--surface-2);border:1px solid var(--border);color:var(--text);border-radius:var(--radius-sm);padding:6px 9px;font-size:12px;outline:none;transition:border-color .15s,box-shadow .15s}.filter:focus,select:focus,input:focus{border-color:var(--accent);box-shadow:0 0 0 3px #6aa3ff26}.sidebar-body{flex:1;overflow-y:auto;padding:10px}.sidebar-foot{padding:10px 14px;border-top:1px solid var(--border-soft);font-size:11px;line-height:1.55;color:var(--muted)}.motor-group{margin-bottom:14px}.motor-group-title{font-size:11px;text-transform:uppercase;letter-spacing:.6px;color:var(--muted);margin:0 2px 6px}.chips{display:flex;flex-direction:column;gap:5px}.sig-chip{display:flex;align-items:center;gap:8px;padding:6px 9px;background:var(--surface);border:1px solid var(--border-soft);border-radius:var(--radius-sm);cursor:grab;-webkit-user-select:none;user-select:none;font-size:12px;transition:background .12s,border-color .12s}.sig-chip:hover{background:var(--surface-2);border-color:var(--border)}.sig-chip.dragging{opacity:.4}.sig-swatch{width:10px;height:10px;border-radius:3px;border:2px solid;flex-shrink:0}.sig-name{flex:1;font-family:var(--mono)}.sig-unit{color:var(--muted);font-size:10.5px}.drag-ghost{background:var(--accent);color:#05203f;font-weight:650;font-size:12px;padding:6px 11px;border-radius:var(--radius-sm);font-family:var(--mono);box-shadow:0 10px 26px #0000008c}.grid-stack{background:transparent}.grid-stack-item-content{top:0;right:0;bottom:0;left:0;overflow:visible;background:transparent;border:none}.widget{height:100%;display:flex;flex-direction:column;background:var(--surface);border:1px solid var(--border-soft);border-radius:var(--radius);box-shadow:var(--shadow);overflow:hidden}.widget-header{display:flex;align-items:center;gap:8px;height:34px;padding:0 8px 0 10px;flex-shrink:0;border-bottom:1px solid var(--border-soft);background:linear-gradient(180deg,rgba(255,255,255,.02),transparent);cursor:move}.widget-grip{color:var(--muted);opacity:.5;font-size:12px;letter-spacing:-2px}.widget-icon{color:var(--accent);font-size:12px}.widget-title{flex:1;font-size:12.5px;font-weight:600;letter-spacing:.2px}.widget-close{width:22px;height:22px;border:none;background:transparent;color:var(--muted);border-radius:6px;cursor:pointer;font-size:16px;line-height:1;opacity:0;transition:opacity .12s,background .12s,color .12s}.widget:hover .widget-close{opacity:1}.widget-close:hover{background:#fb718526;color:var(--err)}.widget-body{flex:1;min-height:0;position:relative}.widget-body .panel{height:100%}.grid-stack-item>.ui-resizable-handle{filter:opacity(.45)}.grid-stack-item:hover>.ui-resizable-handle{filter:opacity(.9)}.grid-stack-placeholder>.placeholder-content{border:1px dashed var(--accent);border-radius:var(--radius);background:#6aa3ff0f}.panel{height:100%;display:flex;flex-direction:column;overflow:hidden}.plot-toolbar{display:flex;align-items:center;gap:8px;padding:6px 10px;border-bottom:1px solid var(--border-soft);flex-wrap:wrap}.plot-toolbar select{width:auto}.legend{display:flex;gap:6px;flex-wrap:wrap}.legend-chip{display:inline-flex;align-items:center;gap:5px;font-size:11px;padding:2px 7px 2px 6px;border:1px solid var(--border);border-radius:999px;font-family:var(--mono)}.legend-swatch{width:9px;height:9px;border-radius:2px;border:1.5px solid}.legend-x{background:none;border:none;color:var(--muted);cursor:pointer;font-size:13px;padding:0 0 0 2px}.legend-x:hover{color:var(--err)}.plot-host{flex:1;min-height:0;position:relative;padding:6px}.plot-host.drop-over{outline:2px dashed var(--accent);outline-offset:-5px;background:#6aa3ff0f;border-radius:10px}.drop-hint{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;color:var(--muted);font-size:12px;pointer-events:none;text-align:center;padding:22px}.table-panel{overflow:auto}.motor-table{width:100%;border-collapse:collapse;font-size:12px}.motor-table th,.motor-table td{padding:6px 10px;text-align:right;border-bottom:1px solid var(--border-soft);white-space:nowrap}.motor-table th:first-child,.motor-table td:first-child{text-align:left}.motor-table th{position:sticky;top:0;background:var(--surface-2);color:var(--muted);font-weight:600;font-size:11px;text-transform:uppercase;letter-spacing:.4px}.motor-table tr:hover td{background:var(--bg-1)}.cmd-col{color:var(--accent)}.status-pill{font-size:10px;padding:2px 8px;border-radius:999px;font-weight:650}.status-pill.ok{color:var(--ok);background:#4ade801f}.status-pill.off{color:var(--muted);background:#8a94a31f}.status-pill.warn{color:var(--warn);background:#fbbf241f}.cards-panel{overflow:auto}.cards-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:11px;padding:12px}.motor-card{background:var(--bg-1);border:1px solid var(--border-soft);border-radius:12px;padding:13px}.motor-card-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:5px}.motor-card-sub{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:11px}.type-select{width:auto;padding:3px 7px;font-size:11px}.metric{margin-bottom:9px}.metric-label{font-size:11px;color:var(--text);margin-bottom:3px}.metric-values{display:flex;align-items:baseline;gap:10px}.metric-act{font-family:var(--mono);font-size:20px;font-weight:650}.metric-cmd{font-family:var(--mono);font-size:12px;color:var(--accent)}.temp-row{display:flex;justify-content:space-between;font-size:11px;color:var(--muted);margin-top:7px;border-top:1px solid var(--border-soft);padding-top:7px}.rawlog-panel{font-size:11.5px}.rawlog-toolbar{display:flex;align-items:center;gap:10px;padding:6px 10px;border-bottom:1px solid var(--border-soft)}.rawlog-body{flex:1;overflow:auto}.rawlog-head,.rawlog-row{display:grid;grid-template-columns:96px 60px 46px 76px minmax(0,1fr) 150px;gap:10px;align-items:center;padding:0 10px}.rawlog-head{position:sticky;top:0;z-index:2;height:26px;background:var(--surface-2);border-bottom:1px solid var(--border-soft);color:var(--muted);font-size:10.5px;text-transform:uppercase;letter-spacing:.4px}.rawlog-row{position:absolute;left:0;right:0;height:22px;line-height:22px;border-bottom:1px solid var(--border-soft)}.rawlog-head>span,.rawlog-row>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.rawlog-row .c-f{color:var(--text)}.rawlog-row.k-command .c-k{color:var(--accent)}.rawlog-row.k-feedback .c-k{color:var(--ok)}.rawlog-row.k-special .c-k{color:var(--warn)}.message,.loading{color:var(--muted);text-align:center;padding:24px} diff --git a/damiao_motor/gui/webapp/dist/assets/index-COYw01IO.css b/damiao_motor/gui/webapp/dist/assets/index-COYw01IO.css deleted file mode 100644 index 59f5598..0000000 --- a/damiao_motor/gui/webapp/dist/assets/index-COYw01IO.css +++ /dev/null @@ -1 +0,0 @@ -.uplot,.uplot *,.uplot *:before,.uplot *:after{box-sizing:border-box}.uplot{font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";line-height:1.5;width:min-content}.u-title{text-align:center;font-size:18px;font-weight:700}.u-wrap{position:relative;-webkit-user-select:none;user-select:none}.u-over,.u-under{position:absolute}.u-under{overflow:hidden}.uplot canvas{display:block;position:relative;width:100%;height:100%}.u-axis{position:absolute}.u-legend{font-size:14px;margin:auto;text-align:center}.u-inline{display:block}.u-inline *{display:inline-block}.u-inline tr{margin-right:16px}.u-legend th{font-weight:600}.u-legend th>*{vertical-align:middle;display:inline-block}.u-legend .u-marker{width:1em;height:1em;margin-right:4px;background-clip:padding-box!important}.u-inline.u-live th:after{content:":";vertical-align:middle}.u-inline:not(.u-live) .u-value{display:none}.u-series>*{padding:4px}.u-series th{cursor:pointer}.u-legend .u-off>*{opacity:.3}.u-select{background:#00000012;position:absolute;pointer-events:none}.u-cursor-x,.u-cursor-y{position:absolute;left:0;top:0;pointer-events:none;will-change:transform}.u-hz .u-cursor-x,.u-vt .u-cursor-y{height:100%;border-right:1px dashed #607D8B}.u-hz .u-cursor-y,.u-vt .u-cursor-x{width:100%;border-bottom:1px dashed #607D8B}.u-cursor-pt{position:absolute;top:0;left:0;border-radius:50%;border:0 solid;pointer-events:none;will-change:transform;background-clip:padding-box!important}.u-axis.u-off,.u-select.u-off,.u-cursor-x.u-off,.u-cursor-y.u-off,.u-cursor-pt.u-off{display:none}.dv-scrollable{position:relative;overflow:hidden}.dv-scrollable .dv-scrollbar-horizontal{position:absolute;bottom:0;left:0;height:4px;border-radius:2px;background-color:transparent;will-change:background-color,transform;transform:translateZ(0);backface-visibility:hidden;transition-property:background-color;transition-timing-function:ease-in-out;transition-duration:1s;transition-delay:0s}.dv-scrollable:hover .dv-scrollbar-horizontal,.dv-scrollable.dv-scrollable-resizing .dv-scrollbar-horizontal,.dv-scrollable.dv-scrollable-scrolling .dv-scrollbar-horizontal{background-color:var(--dv-scrollbar-background-color, rgba(255, 255, 255, .25))}.dv-svg{display:inline-block;fill:currentcolor;line-height:1;stroke:currentcolor;stroke-width:0}.dockview-theme-dark{--dv-paneview-active-outline-color: dodgerblue;--dv-tabs-and-actions-container-font-size: 13px;--dv-tabs-and-actions-container-height: 35px;--dv-drag-over-background-color: rgba(83, 89, 93, .5);--dv-drag-over-border-color: transparent;--dv-tabs-container-scrollbar-color: #888;--dv-icon-hover-background-color: rgba(90, 93, 94, .31);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, .5);--dv-overlay-z-index: 999;--dv-tab-font-size: inherit;--dv-border-radius: 0px;--dv-tab-margin: 0;--dv-sash-color: transparent;--dv-active-sash-color: transparent;--dv-active-sash-transition-duration: .1s;--dv-active-sash-transition-delay: .5s;--dv-group-view-background-color: #1e1e1e;--dv-tabs-and-actions-container-background-color: #252526;--dv-activegroup-visiblepanel-tab-background-color: #1e1e1e;--dv-activegroup-hiddenpanel-tab-background-color: #2d2d2d;--dv-inactivegroup-visiblepanel-tab-background-color: #1e1e1e;--dv-inactivegroup-hiddenpanel-tab-background-color: #2d2d2d;--dv-tab-divider-color: #1e1e1e;--dv-activegroup-visiblepanel-tab-color: white;--dv-activegroup-hiddenpanel-tab-color: #969696;--dv-inactivegroup-visiblepanel-tab-color: #8f8f8f;--dv-inactivegroup-hiddenpanel-tab-color: #626262;--dv-separator-border: rgb(68, 68, 68);--dv-paneview-header-border-color: rgba(204, 204, 204, .2)}.dockview-theme-dark .dv-drop-target-container .dv-drop-target-anchor.dv-drop-target-anchor-container-changed{opacity:0;transition:none}.dockview-theme-light{--dv-paneview-active-outline-color: dodgerblue;--dv-tabs-and-actions-container-font-size: 13px;--dv-tabs-and-actions-container-height: 35px;--dv-drag-over-background-color: rgba(83, 89, 93, .5);--dv-drag-over-border-color: transparent;--dv-tabs-container-scrollbar-color: #888;--dv-icon-hover-background-color: rgba(90, 93, 94, .31);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, .5);--dv-overlay-z-index: 999;--dv-tab-font-size: inherit;--dv-border-radius: 0px;--dv-tab-margin: 0;--dv-sash-color: transparent;--dv-active-sash-color: transparent;--dv-active-sash-transition-duration: .1s;--dv-active-sash-transition-delay: .5s;--dv-group-view-background-color: white;--dv-tabs-and-actions-container-background-color: #f3f3f3;--dv-activegroup-visiblepanel-tab-background-color: white;--dv-activegroup-hiddenpanel-tab-background-color: #ececec;--dv-inactivegroup-visiblepanel-tab-background-color: white;--dv-inactivegroup-hiddenpanel-tab-background-color: #ececec;--dv-tab-divider-color: white;--dv-activegroup-visiblepanel-tab-color: rgb(51, 51, 51);--dv-activegroup-hiddenpanel-tab-color: rgba(51, 51, 51, .7);--dv-inactivegroup-visiblepanel-tab-color: rgba(51, 51, 51, .7);--dv-inactivegroup-hiddenpanel-tab-color: rgba(51, 51, 51, .35);--dv-separator-border: rgba(128, 128, 128, .35);--dv-paneview-header-border-color: rgb(51, 51, 51);--dv-scrollbar-background-color: rgba(0, 0, 0, .25)}.dockview-theme-light .dv-drop-target-container .dv-drop-target-anchor.dv-drop-target-anchor-container-changed{opacity:0;transition:none}.dockview-theme-vs{--dv-paneview-active-outline-color: dodgerblue;--dv-tabs-and-actions-container-font-size: 13px;--dv-tabs-and-actions-container-height: 35px;--dv-drag-over-background-color: rgba(83, 89, 93, .5);--dv-drag-over-border-color: transparent;--dv-tabs-container-scrollbar-color: #888;--dv-icon-hover-background-color: rgba(90, 93, 94, .31);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, .5);--dv-overlay-z-index: 999;--dv-tab-font-size: inherit;--dv-border-radius: 0px;--dv-tab-margin: 0;--dv-sash-color: transparent;--dv-active-sash-color: transparent;--dv-active-sash-transition-duration: .1s;--dv-active-sash-transition-delay: .5s;--dv-group-view-background-color: #1e1e1e;--dv-tabs-and-actions-container-background-color: #252526;--dv-activegroup-visiblepanel-tab-background-color: #1e1e1e;--dv-activegroup-hiddenpanel-tab-background-color: #2d2d2d;--dv-inactivegroup-visiblepanel-tab-background-color: #1e1e1e;--dv-inactivegroup-hiddenpanel-tab-background-color: #2d2d2d;--dv-tab-divider-color: #1e1e1e;--dv-activegroup-hiddenpanel-tab-color: #969696;--dv-inactivegroup-visiblepanel-tab-color: #8f8f8f;--dv-inactivegroup-hiddenpanel-tab-color: #626262;--dv-separator-border: rgb(68, 68, 68);--dv-paneview-header-border-color: rgba(204, 204, 204, .2);--dv-tabs-and-actions-container-background-color: #2d2d30;--dv-tabs-and-actions-container-height: 20px;--dv-tabs-and-actions-container-font-size: 11px;--dv-activegroup-visiblepanel-tab-background-color: #007acc;--dv-inactivegroup-visiblepanel-tab-background-color: #3f3f46;--dv-activegroup-visiblepanel-tab-color: white;--dv-activegroup-hiddenpanel-tab-color: white;--dv-inactivegroup-visiblepanel-tab-color: white;--dv-inactivegroup-hiddenpanel-tab-color: white}.dockview-theme-vs .dv-drop-target-container .dv-drop-target-anchor.dv-drop-target-anchor-container-changed{opacity:0;transition:none}.dockview-theme-vs .dv-groupview.dv-active-group>.dv-tabs-and-actions-container{box-sizing:content-box;border-bottom:2px solid var(--dv-activegroup-visiblepanel-tab-background-color)}.dockview-theme-vs .dv-groupview.dv-active-group>.dv-tabs-and-actions-container .dv-tab.dv-active-tab{border-top:2px solid var(--dv-activegroup-visiblepanel-tab-background-color)}.dockview-theme-vs .dv-groupview.dv-active-group>.dv-tabs-and-actions-container .dv-tab.dv-inactive-tab{border-top:2px solid var(--dv-activegroup-hiddenpanel-tab-background-color)}.dockview-theme-vs .dv-groupview.dv-inactive-group>.dv-tabs-and-actions-container{box-sizing:content-box;border-bottom:2px solid var(--dv-inactivegroup-visiblepanel-tab-background-color)}.dockview-theme-vs .dv-groupview.dv-inactive-group>.dv-tabs-and-actions-container .dv-tab.dv-active-tab{border-top:2px solid var(--dv-inactivegroup-visiblepanel-tab-background-color)}.dockview-theme-vs .dv-groupview.dv-inactive-group>.dv-tabs-and-actions-container .dv-tab.dv-inactive-tab{border-top:2px solid var(--dv-inactivegroup-hiddenpanel-tab-background-color)}.dockview-theme-abyss{--dv-paneview-active-outline-color: dodgerblue;--dv-tabs-and-actions-container-font-size: 13px;--dv-tabs-and-actions-container-height: 35px;--dv-drag-over-background-color: rgba(83, 89, 93, .5);--dv-drag-over-border-color: transparent;--dv-tabs-container-scrollbar-color: #888;--dv-icon-hover-background-color: rgba(90, 93, 94, .31);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, .5);--dv-overlay-z-index: 999;--dv-tab-font-size: inherit;--dv-border-radius: 0px;--dv-tab-margin: 0;--dv-sash-color: transparent;--dv-active-sash-color: transparent;--dv-active-sash-transition-duration: .1s;--dv-active-sash-transition-delay: .5s;--dv-color-abyss-dark: #000c18;--dv-color-abyss: #10192c;--dv-color-abyss-light: #1c1c2a;--dv-color-abyss-lighter: #2b2b4a;--dv-color-abyss-accent: rgb(91, 30, 207);--dv-color-abyss-primary-text: white;--dv-color-abyss-secondary-text: rgb(148, 151, 169);--dv-group-view-background-color: var(--dv-color-abyss-dark);--dv-tabs-and-actions-container-background-color: var( --dv-color-abyss-light );--dv-activegroup-visiblepanel-tab-background-color: var( --dv-color-abyss-dark );--dv-activegroup-hiddenpanel-tab-background-color: var(--dv-color-abyss);--dv-inactivegroup-visiblepanel-tab-background-color: var( --dv-color-abyss-dark );--dv-inactivegroup-hiddenpanel-tab-background-color: var(--dv-color-abyss);--dv-tab-divider-color: var(--dv-color-abyss-lighter);--dv-activegroup-visiblepanel-tab-color: white;--dv-activegroup-hiddenpanel-tab-color: rgba(255, 255, 255, .5);--dv-inactivegroup-visiblepanel-tab-color: rgba(255, 255, 255, .5);--dv-inactivegroup-hiddenpanel-tab-color: rgba(255, 255, 255, .25);--dv-separator-border: var(--dv-color-abyss-lighter);--dv-paneview-header-border-color: var(--dv-color-abyss-lighter);--dv-paneview-active-outline-color: #596f99}.dockview-theme-abyss .dv-drop-target-container .dv-drop-target-anchor.dv-drop-target-anchor-container-changed{opacity:0;transition:none}.dockview-theme-dracula{--dv-paneview-active-outline-color: dodgerblue;--dv-tabs-and-actions-container-font-size: 13px;--dv-tabs-and-actions-container-height: 35px;--dv-drag-over-background-color: rgba(83, 89, 93, .5);--dv-drag-over-border-color: transparent;--dv-tabs-container-scrollbar-color: #888;--dv-icon-hover-background-color: rgba(90, 93, 94, .31);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, .5);--dv-overlay-z-index: 999;--dv-tab-font-size: inherit;--dv-border-radius: 0px;--dv-tab-margin: 0;--dv-sash-color: transparent;--dv-active-sash-color: transparent;--dv-active-sash-transition-duration: .1s;--dv-active-sash-transition-delay: .5s;--dv-group-view-background-color: #282a36;--dv-tabs-and-actions-container-background-color: #191a21;--dv-activegroup-visiblepanel-tab-background-color: #282a36;--dv-activegroup-hiddenpanel-tab-background-color: #21222c;--dv-inactivegroup-visiblepanel-tab-background-color: #282a36;--dv-inactivegroup-hiddenpanel-tab-background-color: #21222c;--dv-tab-divider-color: #191a21;--dv-activegroup-visiblepanel-tab-color: rgb(248, 248, 242);--dv-activegroup-hiddenpanel-tab-color: rgb(98, 114, 164);--dv-inactivegroup-visiblepanel-tab-color: rgba(248, 248, 242, .5);--dv-inactivegroup-hiddenpanel-tab-color: rgba(98, 114, 164, .5);--dv-separator-border: #bd93f9;--dv-paneview-header-border-color: #bd93f9;--dv-paneview-active-outline-color: #6272a4}.dockview-theme-dracula .dv-drop-target-container .dv-drop-target-anchor.dv-drop-target-anchor-container-changed{opacity:0;transition:none}.dockview-theme-dracula .dv-groupview.dv-active-group>.dv-tabs-and-actions-container .dv-tabs-container>.dv-tab.dv-active-tab{position:relative}.dockview-theme-dracula .dv-groupview.dv-active-group>.dv-tabs-and-actions-container .dv-tabs-container>.dv-tab.dv-active-tab:after{position:absolute;left:0;top:0;content:"";width:100%;height:1px;background-color:#94527e;z-index:999}.dockview-theme-dracula .dv-groupview.dv-inactive-group>.dv-tabs-and-actions-container .dv-tabs-container>.dv-tab.dv-active-tab{position:relative}.dockview-theme-dracula .dv-groupview.dv-inactive-group>.dv-tabs-and-actions-container .dv-tabs-container>.dv-tab.dv-active-tab:after{position:absolute;left:0;bottom:0;content:"";width:100%;height:1px;background-color:#5e3d5a;z-index:999}.dockview-theme-replit{--dv-paneview-active-outline-color: dodgerblue;--dv-tabs-and-actions-container-font-size: 13px;--dv-tabs-and-actions-container-height: 35px;--dv-drag-over-background-color: rgba(83, 89, 93, .5);--dv-drag-over-border-color: transparent;--dv-tabs-container-scrollbar-color: #888;--dv-icon-hover-background-color: rgba(90, 93, 94, .31);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, .5);--dv-overlay-z-index: 999;--dv-tab-font-size: inherit;--dv-border-radius: 0px;--dv-tab-margin: 0;--dv-sash-color: transparent;--dv-active-sash-color: transparent;--dv-active-sash-transition-duration: .1s;--dv-active-sash-transition-delay: .5s;box-sizing:border-box;padding:10px;background-color:#ebeced;--dv-group-view-background-color: #ebeced;--dv-tabs-and-actions-container-background-color: #fcfcfc;--dv-activegroup-visiblepanel-tab-background-color: #f0f1f2;--dv-activegroup-hiddenpanel-tab-background-color: #fcfcfc;--dv-inactivegroup-visiblepanel-tab-background-color: #f0f1f2;--dv-inactivegroup-hiddenpanel-tab-background-color: #fcfcfc;--dv-tab-divider-color: transparent;--dv-activegroup-visiblepanel-tab-color: rgb(51, 51, 51);--dv-activegroup-hiddenpanel-tab-color: rgb(51, 51, 51);--dv-inactivegroup-visiblepanel-tab-color: rgb(51, 51, 51);--dv-inactivegroup-hiddenpanel-tab-color: rgb(51, 51, 51);--dv-separator-border: transparent;--dv-paneview-header-border-color: rgb(51, 51, 51);--dv-sash-color: #cfd1d3;--dv-active-sash-color: #babbbb}.dockview-theme-replit .dv-drop-target-container .dv-drop-target-anchor.dv-drop-target-anchor-container-changed{opacity:0;transition:none}.dockview-theme-replit .dv-resize-container:has(>.dv-groupview){border-radius:8px}.dockview-theme-replit .dv-resize-container{border-radius:10px!important;border:none}.dockview-theme-replit .dv-groupview{overflow:hidden;border-radius:10px}.dockview-theme-replit .dv-groupview .dv-tabs-and-actions-container{border-bottom:1px solid rgba(128,128,128,.35)}.dockview-theme-replit .dv-groupview .dv-tabs-and-actions-container .dv-tab{margin:4px;border-radius:8px}.dockview-theme-replit .dv-groupview .dv-tabs-and-actions-container .dv-tab .dv-svg{height:8px;width:8px}.dockview-theme-replit .dv-groupview .dv-tabs-and-actions-container .dv-tab:hover{background-color:#e4e5e6!important}.dockview-theme-replit .dv-groupview .dv-content-container{background-color:#fcfcfc}.dockview-theme-replit .dv-groupview.dv-active-group{border:1px solid rgba(128,128,128,.35)}.dockview-theme-replit .dv-groupview.dv-inactive-group{border:1px solid transparent}.dockview-theme-replit .dv-vertical>.dv-sash-container>.dv-sash{background-color:transparent}.dockview-theme-replit .dv-vertical>.dv-sash-container>.dv-sash:not(.disabled):after{content:"";height:4px;width:40px;border-radius:2px;top:50%;left:50%;transform:translate(-50%,-50%);background-color:var(--dv-sash-color);position:absolute}.dockview-theme-replit .dv-vertical>.dv-sash-container>.dv-sash:not(.disabled):hover,.dockview-theme-replit .dv-vertical>.dv-sash-container>.dv-sash:not(.disabled):active{background-color:transparent}.dockview-theme-replit .dv-vertical>.dv-sash-container>.dv-sash:not(.disabled):hover:after,.dockview-theme-replit .dv-vertical>.dv-sash-container>.dv-sash:not(.disabled):active:after{background-color:var(--dv-active-sash-color)}.dockview-theme-replit .dv-horizontal>.dv-sash-container>.dv-sash{background-color:transparent}.dockview-theme-replit .dv-horizontal>.dv-sash-container>.dv-sash:not(.disabled):after{content:"";height:40px;width:4px;border-radius:2px;top:50%;left:50%;transform:translate(-50%,-50%);background-color:var(--dv-sash-color);position:absolute}.dockview-theme-replit .dv-horizontal>.dv-sash-container>.dv-sash:not(.disabled):hover,.dockview-theme-replit .dv-horizontal>.dv-sash-container>.dv-sash:not(.disabled):active{background-color:transparent}.dockview-theme-replit .dv-horizontal>.dv-sash-container>.dv-sash:not(.disabled):hover:after,.dockview-theme-replit .dv-horizontal>.dv-sash-container>.dv-sash:not(.disabled):active:after{background-color:var(--dv-active-sash-color)}.dockview-theme-abyss-spaced{--dv-paneview-active-outline-color: dodgerblue;--dv-tabs-and-actions-container-font-size: 13px;--dv-tabs-and-actions-container-height: 35px;--dv-drag-over-background-color: rgba(83, 89, 93, .5);--dv-drag-over-border-color: transparent;--dv-tabs-container-scrollbar-color: #888;--dv-icon-hover-background-color: rgba(90, 93, 94, .31);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, .5);--dv-overlay-z-index: 999;--dv-tab-font-size: inherit;--dv-border-radius: 0px;--dv-tab-margin: 0;--dv-sash-color: transparent;--dv-active-sash-color: transparent;--dv-active-sash-transition-duration: .1s;--dv-active-sash-transition-delay: .5s;--dv-tab-font-size: 12px;--dv-tab-margin: .5rem .25rem;--dv-tabs-and-actions-container-height: 44px;--dv-border-radius: 20px;box-sizing:border-box;--dv-color-abyss-dark: rgb(11, 6, 17);--dv-color-abyss: #16121f;--dv-color-abyss-light: #201d2b;--dv-color-abyss-lighter: #2a2837;--dv-color-abyss-accent: rgb(91, 30, 207);--dv-color-abyss-primary-text: white;--dv-color-abyss-secondary-text: rgb(148, 151, 169);--dv-drag-over-border: 2px solid var(--dv-color-abyss-accent);--dv-drag-over-background-color: "";--dv-group-view-background-color: var(--dv-color-abyss-dark);--dv-tabs-and-actions-container-background-color: var(--dv-color-abyss);--dv-activegroup-visiblepanel-tab-background-color: var( --dv-color-abyss-lighter );--dv-activegroup-hiddenpanel-tab-background-color: var( --dv-color-abyss-light );--dv-inactivegroup-visiblepanel-tab-background-color: var( --dv-color-abyss-lighter );--dv-inactivegroup-hiddenpanel-tab-background-color: var( --dv-color-abyss-light );--dv-tab-divider-color: transparent;--dv-activegroup-visiblepanel-tab-color: var(--dv-color-abyss-primary-text);--dv-activegroup-hiddenpanel-tab-color: var( --dv-color-abyss-secondary-text );--dv-inactivegroup-visiblepanel-tab-color: var( --dv-color-abyss-primary-text );--dv-inactivegroup-hiddenpanel-tab-color: var( --dv-color-abyss-secondary-text );--dv-separator-border: transparent;--dv-paneview-header-border-color: rgb(51, 51, 51);--dv-active-sash-color: var(--dv-color-abyss-accent);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(0, 0, 0, .5);padding:10px;background-color:var(--dv-color-abyss-dark)}.dockview-theme-abyss-spaced .dv-resize-container:has(>.dv-groupview){border-radius:8px}.dockview-theme-abyss-spaced .dv-sash{border-radius:4px}.dockview-theme-abyss-spaced .dv-drop-target-anchor{border-radius:calc(var(--dv-border-radius) / 4)}.dockview-theme-abyss-spaced .dv-drop-target-anchor.dv-drop-target-content{border-radius:var(--dv-border-radius)}.dockview-theme-abyss-spaced .dv-resize-container{border-radius:var(--dv-border-radius)!important;border:none}.dockview-theme-abyss-spaced .dv-tabs-overflow-container,.dockview-theme-abyss-spaced .dv-tabs-overflow-dropdown-default{border-radius:8px;height:unset!important}.dockview-theme-abyss-spaced .dv-tab{border-radius:8px}.dockview-theme-abyss-spaced .dv-tab .dv-svg{height:8px;width:8px}.dockview-theme-abyss-spaced .dv-groupview{border-radius:var(--dv-border-radius)}.dockview-theme-abyss-spaced .dv-groupview .dv-tabs-and-actions-container{padding:0px calc(var(--dv-border-radius) / 2)}.dockview-theme-abyss-spaced .dv-groupview .dv-content-container{background-color:var(--dv-tabs-and-actions-container-background-color)}.dockview-theme-abyss-spaced .dv-resize-container .dv-groupview{border:2px solid var(--dv-color-abyss-dark)}.dockview-theme-light-spaced{--dv-paneview-active-outline-color: dodgerblue;--dv-tabs-and-actions-container-font-size: 13px;--dv-tabs-and-actions-container-height: 35px;--dv-drag-over-background-color: rgba(83, 89, 93, .5);--dv-drag-over-border-color: transparent;--dv-tabs-container-scrollbar-color: #888;--dv-icon-hover-background-color: rgba(90, 93, 94, .31);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(83, 89, 93, .5);--dv-overlay-z-index: 999;--dv-tab-font-size: inherit;--dv-border-radius: 0px;--dv-tab-margin: 0;--dv-sash-color: transparent;--dv-active-sash-color: transparent;--dv-active-sash-transition-duration: .1s;--dv-active-sash-transition-delay: .5s;--dv-tab-font-size: 12px;--dv-tab-margin: .5rem .25rem;--dv-tabs-and-actions-container-height: 44px;--dv-border-radius: 20px;box-sizing:border-box;--dv-drag-over-border: 2px solid rgb(91, 30, 207);--dv-drag-over-background-color: "";--dv-group-view-background-color: #f6f5f9;--dv-tabs-and-actions-container-background-color: white;--dv-activegroup-visiblepanel-tab-background-color: #ededf0;--dv-activegroup-hiddenpanel-tab-background-color: #f9f9fa;--dv-inactivegroup-visiblepanel-tab-background-color: #ededf0;--dv-inactivegroup-hiddenpanel-tab-background-color: #f9f9fa;--dv-tab-divider-color: transparent;--dv-activegroup-visiblepanel-tab-color: rgb(104, 107, 130);--dv-activegroup-hiddenpanel-tab-color: rgb(148, 151, 169);--dv-inactivegroup-visiblepanel-tab-color: rgb(104, 107, 130);--dv-inactivegroup-hiddenpanel-tab-color: rgb(148, 151, 169);--dv-separator-border: transparent;--dv-paneview-header-border-color: rgb(51, 51, 51);--dv-active-sash-color: rgb(91, 30, 207);--dv-floating-box-shadow: 8px 8px 8px 0px rgba(0, 0, 0, .1);padding:10px;background-color:#f6f5f9;--dv-scrollbar-background-color: rgba(0, 0, 0, .25)}.dockview-theme-light-spaced .dv-resize-container:has(>.dv-groupview){border-radius:8px}.dockview-theme-light-spaced .dv-sash{border-radius:4px}.dockview-theme-light-spaced .dv-drop-target-anchor{border-radius:calc(var(--dv-border-radius) / 4)}.dockview-theme-light-spaced .dv-drop-target-anchor.dv-drop-target-content{border-radius:var(--dv-border-radius)}.dockview-theme-light-spaced .dv-resize-container{border-radius:var(--dv-border-radius)!important;border:none}.dockview-theme-light-spaced .dv-tabs-overflow-container,.dockview-theme-light-spaced .dv-tabs-overflow-dropdown-default{border-radius:8px;height:unset!important}.dockview-theme-light-spaced .dv-tab{border-radius:8px}.dockview-theme-light-spaced .dv-tab .dv-svg{height:8px;width:8px}.dockview-theme-light-spaced .dv-groupview{border-radius:var(--dv-border-radius)}.dockview-theme-light-spaced .dv-groupview .dv-tabs-and-actions-container{padding:0px calc(var(--dv-border-radius) / 2)}.dockview-theme-light-spaced .dv-groupview .dv-content-container{background-color:var(--dv-tabs-and-actions-container-background-color)}.dockview-theme-light-spaced .dv-resize-container .dv-groupview{border:2px solid rgba(255,255,255,.1)}.dv-drop-target-container{position:absolute;z-index:9999;top:0;left:0;height:100%;width:100%;pointer-events:none;overflow:hidden;--dv-transition-duration: .3s}.dv-drop-target-container .dv-drop-target-anchor{position:relative;border:var(--dv-drag-over-border);background-color:var(--dv-drag-over-background-color);opacity:1;will-change:transform,opacity;transform:translateZ(0);backface-visibility:hidden;contain:layout paint;transition:opacity var(--dv-transition-duration) ease-in,transform var(--dv-transition-duration) ease-out}.dv-drop-target{position:relative;--dv-transition-duration: 70ms}.dv-drop-target>.dv-drop-target-dropzone{position:absolute;left:0;top:0;height:100%;width:100%;z-index:1000;pointer-events:none}.dv-drop-target>.dv-drop-target-dropzone>.dv-drop-target-selection{position:relative;box-sizing:border-box;height:100%;width:100%;border:var(--dv-drag-over-border);background-color:var(--dv-drag-over-background-color);transition:top var(--dv-transition-duration) ease-out,left var(--dv-transition-duration) ease-out,width var(--dv-transition-duration) ease-out,height var(--dv-transition-duration) ease-out,opacity var(--dv-transition-duration) ease-out;will-change:transform;pointer-events:none}.dv-drop-target>.dv-drop-target-dropzone>.dv-drop-target-selection.dv-drop-target-top.dv-drop-target-small-vertical{border-top:1px solid var(--dv-drag-over-border-color)}.dv-drop-target>.dv-drop-target-dropzone>.dv-drop-target-selection.dv-drop-target-bottom.dv-drop-target-small-vertical{border-bottom:1px solid var(--dv-drag-over-border-color)}.dv-drop-target>.dv-drop-target-dropzone>.dv-drop-target-selection.dv-drop-target-left.dv-drop-target-small-horizontal{border-left:1px solid var(--dv-drag-over-border-color)}.dv-drop-target>.dv-drop-target-dropzone>.dv-drop-target-selection.dv-drop-target-right.dv-drop-target-small-horizontal{border-right:1px solid var(--dv-drag-over-border-color)}.dv-dockview{position:relative;background-color:var(--dv-group-view-background-color);contain:layout}.dv-dockview .dv-watermark-container{position:absolute;top:0;left:0;height:100%;width:100%;z-index:1}.dv-dockview .dv-overlay-render-container{position:relative}.dv-groupview.dv-active-group>.dv-tabs-and-actions-container .dv-tabs-container>.dv-tab.dv-active-tab{background-color:var(--dv-activegroup-visiblepanel-tab-background-color);color:var(--dv-activegroup-visiblepanel-tab-color)}.dv-groupview.dv-active-group>.dv-tabs-and-actions-container .dv-tabs-container>.dv-tab.dv-inactive-tab{background-color:var(--dv-activegroup-hiddenpanel-tab-background-color);color:var(--dv-activegroup-hiddenpanel-tab-color)}.dv-groupview.dv-inactive-group>.dv-tabs-and-actions-container .dv-tabs-container>.dv-tab.dv-active-tab{background-color:var(--dv-inactivegroup-visiblepanel-tab-background-color);color:var(--dv-inactivegroup-visiblepanel-tab-color)}.dv-groupview.dv-inactive-group>.dv-tabs-and-actions-container .dv-tabs-container>.dv-tab.dv-inactive-tab{background-color:var(--dv-inactivegroup-hiddenpanel-tab-background-color);color:var(--dv-inactivegroup-hiddenpanel-tab-color)}.dv-tab.dv-tab-dragging{background-color:var(--dv-activegroup-visiblepanel-tab-background-color);color:var(--dv-activegroup-visiblepanel-tab-color)}.dv-groupview{display:flex;flex-direction:column;height:100%;background-color:var(--dv-group-view-background-color);overflow:hidden}.dv-groupview:focus{outline:none}.dv-groupview>.dv-content-container{flex-grow:1;min-height:0;outline:none}.dv-root-wrapper,.dv-grid-view,.dv-branch-node{height:100%;width:100%}.dv-debug .dv-resize-container .dv-resize-handle-top{background-color:red}.dv-debug .dv-resize-container .dv-resize-handle-bottom{background-color:green}.dv-debug .dv-resize-container .dv-resize-handle-left{background-color:#ff0}.dv-debug .dv-resize-container .dv-resize-handle-right{background-color:#00f}.dv-debug .dv-resize-container .dv-resize-handle-topleft,.dv-debug .dv-resize-container .dv-resize-handle-topright,.dv-debug .dv-resize-container .dv-resize-handle-bottomleft,.dv-debug .dv-resize-container .dv-resize-handle-bottomright{background-color:#0ff}.dv-resize-container{--dv-overlay-z-index: var(--dv-overlay-z-index, 999);position:absolute;z-index:calc(var(--dv-overlay-z-index) - 2);border:1px solid var(--dv-tab-divider-color);box-shadow:var(--dv-floating-box-shadow);will-change:transform,opacity;transform:translateZ(0);backface-visibility:hidden}.dv-resize-container.dv-hidden{display:none}.dv-resize-container.dv-resize-container-dragging{opacity:.5;will-change:transform,opacity}.dv-resize-container .dv-resize-handle-top{height:4px;width:calc(100% - 8px);left:4px;top:-2px;z-index:var(--dv-overlay-z-index);position:absolute;cursor:ns-resize}.dv-resize-container .dv-resize-handle-bottom{height:4px;width:calc(100% - 8px);left:4px;bottom:-2px;z-index:var(--dv-overlay-z-index);position:absolute;cursor:ns-resize}.dv-resize-container .dv-resize-handle-left{height:calc(100% - 8px);width:4px;left:-2px;top:4px;z-index:var(--dv-overlay-z-index);position:absolute;cursor:ew-resize}.dv-resize-container .dv-resize-handle-right{height:calc(100% - 8px);width:4px;right:-2px;top:4px;z-index:var(--dv-overlay-z-index);position:absolute;cursor:ew-resize}.dv-resize-container .dv-resize-handle-topleft{height:4px;width:4px;top:-2px;left:-2px;z-index:var(--dv-overlay-z-index);position:absolute;cursor:nw-resize}.dv-resize-container .dv-resize-handle-topright{height:4px;width:4px;right:-2px;top:-2px;z-index:var(--dv-overlay-z-index);position:absolute;cursor:ne-resize}.dv-resize-container .dv-resize-handle-bottomleft{height:4px;width:4px;left:-2px;bottom:-2px;z-index:var(--dv-overlay-z-index);position:absolute;cursor:sw-resize}.dv-resize-container .dv-resize-handle-bottomright{height:4px;width:4px;right:-2px;bottom:-2px;z-index:var(--dv-overlay-z-index);position:absolute;cursor:se-resize}.dv-render-overlay{--dv-overlay-z-index: var(--dv-overlay-z-index, 999);position:absolute;z-index:1;width:100%;height:100%;contain:layout paint;isolation:isolate;will-change:transform;transform:translateZ(0);backface-visibility:hidden}.dv-render-overlay.dv-render-overlay-float{z-index:calc(var(--dv-overlay-z-index) - 1)}.dv-debug .dv-render-overlay{outline:1px solid red;outline-offset:-1}.dv-pane-container{height:100%;width:100%}.dv-pane-container.dv-animated .dv-view{will-change:transform;transform:translateZ(0);backface-visibility:hidden;transition:transform .15s ease-out}.dv-pane-container .dv-view{overflow:hidden;display:flex;flex-direction:column;padding:0!important}.dv-pane-container .dv-view:not(:first-child):before{background-color:transparent!important}.dv-pane-container .dv-view:not(:first-child) .dv-pane>.dv-pane-header{border-top:1px solid var(--dv-paneview-header-border-color)}.dv-pane-container .dv-view .dv-default-header{background-color:var(--dv-group-view-background-color);color:var(--dv-activegroup-visiblepanel-tab-color);display:flex;padding:0 8px;cursor:pointer}.dv-pane-container .dv-view .dv-default-header .dv-pane-header-icon{display:flex;justify-content:center;align-items:center}.dv-pane-container .dv-view .dv-default-header>span{padding-left:8px;flex-grow:1}.dv-pane-container:first-of-type>.dv-pane>.dv-pane-header{border-top:none!important}.dv-pane-container .dv-pane{display:flex;flex-direction:column;overflow:hidden;height:100%}.dv-pane-container .dv-pane .dv-pane-header{box-sizing:border-box;-webkit-user-select:none;user-select:none;position:relative;outline:none}.dv-pane-container .dv-pane .dv-pane-header.dv-pane-draggable{cursor:pointer}.dv-pane-container .dv-pane .dv-pane-header:focus:before,.dv-pane-container .dv-pane .dv-pane-header:focus-within:before{position:absolute;top:0;left:0;width:100%;height:100%;z-index:5;content:"";pointer-events:none;outline:1px solid;outline-width:-1px;outline-style:solid;outline-offset:-1px;outline-color:var(--dv-paneview-active-outline-color)}.dv-pane-container .dv-pane .dv-pane-body{overflow-y:auto;overflow-x:hidden;flex-grow:1;position:relative;outline:none}.dv-pane-container .dv-pane .dv-pane-body:focus:before,.dv-pane-container .dv-pane .dv-pane-body:focus-within:before{position:absolute;top:0;left:0;width:100%;height:100%;z-index:5;content:"";pointer-events:none;outline:1px solid;outline-width:-1px;outline-style:solid;outline-offset:-1px;outline-color:var(--dv-paneview-active-outline-color)}.dv-debug .dv-split-view-container .dv-sash-container .dv-sash.dv-enabled{background-color:#000}.dv-debug .dv-split-view-container .dv-sash-container .dv-sash.dv-disabled{background-color:orange}.dv-debug .dv-split-view-container .dv-sash-container .dv-sash.dv-maximum{background-color:green}.dv-debug .dv-split-view-container .dv-sash-container .dv-sash.dv-minimum{background-color:red}.dv-split-view-container{position:relative;overflow:hidden;height:100%;width:100%}.dv-split-view-container.dv-splitview-disabled>.dv-sash-container>.dv-sash{pointer-events:none}.dv-split-view-container.dv-animation .dv-view,.dv-split-view-container.dv-animation .dv-sash{will-change:transform;transform:translateZ(0);backface-visibility:hidden;transition:transform .15s ease-out}.dv-split-view-container.dv-horizontal{height:100%}.dv-split-view-container.dv-horizontal>.dv-sash-container>.dv-sash{height:100%;width:4px}.dv-split-view-container.dv-horizontal>.dv-sash-container>.dv-sash.dv-enabled{cursor:ew-resize}.dv-split-view-container.dv-horizontal>.dv-sash-container>.dv-sash.dv-disabled{cursor:default}.dv-split-view-container.dv-horizontal>.dv-sash-container>.dv-sash.dv-maximum{cursor:w-resize}.dv-split-view-container.dv-horizontal>.dv-sash-container>.dv-sash.dv-minimum{cursor:e-resize}.dv-split-view-container.dv-horizontal>.dv-view-container>.dv-view:not(:first-child):before{height:100%;width:1px}.dv-split-view-container.dv-vertical{width:100%}.dv-split-view-container.dv-vertical>.dv-sash-container>.dv-sash{width:100%;height:4px}.dv-split-view-container.dv-vertical>.dv-sash-container>.dv-sash.dv-enabled{cursor:ns-resize}.dv-split-view-container.dv-vertical>.dv-sash-container>.dv-sash.dv-disabled{cursor:default}.dv-split-view-container.dv-vertical>.dv-sash-container>.dv-sash.dv-maximum{cursor:n-resize}.dv-split-view-container.dv-vertical>.dv-sash-container>.dv-sash.dv-minimum{cursor:s-resize}.dv-split-view-container.dv-vertical>.dv-view-container>.dv-view{width:100%}.dv-split-view-container.dv-vertical>.dv-view-container>.dv-view:not(:first-child):before{height:1px;width:100%}.dv-split-view-container .dv-sash-container{height:100%;width:100%;position:absolute}.dv-split-view-container .dv-sash-container .dv-sash{position:absolute;z-index:99;outline:none;user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;touch-action:none;background-color:var(--dv-sash-color, transparent)}.dv-split-view-container .dv-sash-container .dv-sash:not(.disabled):active,.dv-split-view-container .dv-sash-container .dv-sash:not(.disabled):hover{background-color:var(--dv-active-sash-color, transparent);transition-property:background-color;transition-timing-function:ease-in-out;transition-duration:var(--dv-active-sash-transition-duration, .1s);transition-delay:var(--dv-active-sash-transition-delay, .5s)}.dv-split-view-container .dv-view-container{position:relative;height:100%;width:100%}.dv-split-view-container .dv-view-container .dv-view{height:100%;box-sizing:border-box;overflow:auto;position:absolute}.dv-split-view-container.dv-separator-border .dv-view:not(:first-child):before{content:" ";position:absolute;top:0;left:0;z-index:5;pointer-events:none;background-color:var(--dv-separator-border)}.dv-dragged{transform:translateZ(0)}.dv-tab{flex-shrink:0}.dv-tab:focus-within,.dv-tab:focus{position:relative}.dv-tab:focus-within:after,.dv-tab:focus:after{position:absolute;content:"";height:100%;width:100%;top:0;left:0;pointer-events:none;outline:1px solid var(--dv-tab-divider-color)!important;outline-offset:-1px;z-index:5}.dv-tab.dv-tab-dragging .dv-default-tab-action{background-color:var(--dv-activegroup-visiblepanel-tab-color)}.dv-tab.dv-active-tab .dv-default-tab .dv-default-tab-action{visibility:visible}.dv-tab.dv-inactive-tab .dv-default-tab .dv-default-tab-action{visibility:hidden}.dv-tab.dv-inactive-tab .dv-default-tab:hover .dv-default-tab-action{visibility:visible}.dv-tab .dv-default-tab{position:relative;height:100%;display:flex;align-items:center;white-space:nowrap;text-overflow:ellipsis}.dv-tab .dv-default-tab .dv-default-tab-content{flex-grow:1;margin-right:4px}.dv-tab .dv-default-tab .dv-default-tab-action{padding:4px;display:flex;align-items:center;justify-content:center;box-sizing:border-box}.dv-tab .dv-default-tab .dv-default-tab-action:hover{border-radius:2px;background-color:var(--dv-icon-hover-background-color)}.dv-tabs-overflow-dropdown-default{height:100%;color:var(--dv-activegroup-hiddenpanel-tab-color);margin:var(--dv-tab-margin);display:flex;align-items:center;flex-shrink:0;padding:.25rem .5rem;cursor:pointer}.dv-tabs-overflow-dropdown-default>span{padding-left:.25rem}.dv-tabs-overflow-dropdown-default>svg{transform:rotate(90deg)}.dv-tabs-container{display:flex;height:100%;overflow:auto;scrollbar-width:thin;will-change:scroll-position;transform:translateZ(0)}.dv-tabs-container.dv-horizontal .dv-tab:not(:first-child):before{content:" ";position:absolute;top:0;left:0;z-index:5;pointer-events:none;background-color:var(--dv-tab-divider-color);width:1px;height:100%}.dv-tabs-container::-webkit-scrollbar{height:3px}.dv-tabs-container::-webkit-scrollbar-track{background:transparent}.dv-tabs-container::-webkit-scrollbar-thumb{background:var(--dv-tabs-container-scrollbar-color)}.dv-scrollable>.dv-tabs-container{overflow:hidden}.dv-tab{-webkit-user-drag:element;outline:none;padding:.25rem .5rem;cursor:pointer;position:relative;box-sizing:border-box;font-size:var(--dv-tab-font-size);margin:var(--dv-tab-margin)}.dv-tabs-overflow-container{flex-direction:column;height:unset;border:1px solid var(--dv-tab-divider-color);background-color:var(--dv-group-view-background-color)}.dv-tabs-overflow-container .dv-tab:not(:last-child){border-bottom:1px solid var(--dv-tab-divider-color)}.dv-tabs-overflow-container .dv-active-tab{background-color:var(--dv-activegroup-visiblepanel-tab-background-color);color:var(--dv-activegroup-visiblepanel-tab-color)}.dv-tabs-overflow-container .dv-inactive-tab{background-color:var(--dv-activegroup-hiddenpanel-tab-background-color);color:var(--dv-activegroup-hiddenpanel-tab-color)}.dv-tabs-and-actions-container{display:flex;background-color:var(--dv-tabs-and-actions-container-background-color);flex-shrink:0;box-sizing:border-box;height:var(--dv-tabs-and-actions-container-height);font-size:var(--dv-tabs-and-actions-container-font-size)}.dv-tabs-and-actions-container.dv-single-tab.dv-full-width-single-tab .dv-scrollable,.dv-tabs-and-actions-container.dv-single-tab.dv-full-width-single-tab .dv-tabs-container{flex-grow:1}.dv-tabs-and-actions-container.dv-single-tab.dv-full-width-single-tab .dv-tabs-container .dv-tab{flex-grow:1;padding:0}.dv-tabs-and-actions-container.dv-single-tab.dv-full-width-single-tab .dv-void-container{flex-grow:0}.dv-tabs-and-actions-container .dv-void-container{display:flex;flex-grow:1}.dv-tabs-and-actions-container .dv-void-container.dv-draggable{cursor:grab}.dv-tabs-and-actions-container .dv-right-actions-container{display:flex}.dv-watermark{display:flex;height:100%}:root{--bg: #0d1117;--bg-1: #11161d;--bg-2: #161b22;--bg-3: #1c232c;--border: #2a313c;--text: #c9d1d9;--muted: #8b949e;--accent: #58a6ff;--ok: #3fb950;--warn: #d29922;--err: #ff7b72;--font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;--mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace}*{box-sizing:border-box}html,body,#root{height:100%;margin:0}body{font-family:var(--font);background:var(--bg);color:var(--text);font-size:13px;-webkit-font-smoothing:antialiased}.mono{font-family:var(--mono)}.muted{color:var(--muted)}.small{font-size:11px}.center{text-align:center}.pad{padding:16px}.strong{font-weight:600}.dim{opacity:.55}.app{display:flex;flex-direction:column;height:100%}.body{flex:1;display:flex;min-height:0}.dock-host{flex:1;min-width:0;position:relative}.toolbar{display:flex;align-items:center;gap:16px;height:46px;padding:0 14px;background:linear-gradient(180deg,#11161d,#0d1117);border-bottom:1px solid var(--border)}.brand{font-weight:600;font-size:15px;letter-spacing:.2px;display:flex;align-items:center;gap:8px}.brand-sub{color:var(--muted);font-weight:500;font-size:12px}.brand-dot{width:9px;height:9px;border-radius:50%;background:var(--accent);box-shadow:0 0 10px var(--accent)}.conn{display:flex;align-items:center;gap:8px}.conn .dot{width:8px;height:8px;border-radius:50%}.dot.on{background:var(--ok);box-shadow:0 0 8px var(--ok)}.dot.off{background:var(--err)}.spacer{flex:1}.actions{display:flex;gap:6px}.badge{font-size:10.5px;padding:2px 7px;border-radius:10px;font-weight:600;border:1px solid transparent;text-transform:uppercase;letter-spacing:.3px}.badge.ok{color:var(--ok);border-color:#3fb95066;background:#3fb9501a}.badge.warn{color:var(--warn);border-color:#d2992266;background:#d299221a}.badge.err{color:var(--err);border-color:#ff7b7266;background:#ff7b721a}.btn{background:var(--bg-3);color:var(--text);border:1px solid var(--border);border-radius:6px;padding:5px 10px;font-size:12px;cursor:pointer;transition:background .15s,border-color .15s}.btn:hover{background:#232c37;border-color:#3a434f}.btn.ghost{background:transparent}.btn.small{padding:3px 8px;font-size:11px}.btn.active{border-color:var(--accent);color:var(--accent)}.btn-icon{color:var(--accent);margin-right:1px;font-size:12px}.sidebar{width:232px;flex-shrink:0;background:var(--bg-1);border-right:1px solid var(--border);display:flex;flex-direction:column}.sidebar-head{padding:10px 12px;border-bottom:1px solid var(--border)}.sidebar-title{font-weight:600;margin-bottom:8px}.filter,.type-select,select{width:100%;background:var(--bg-3);border:1px solid var(--border);color:var(--text);border-radius:6px;padding:5px 8px;font-size:12px}.sidebar-body{flex:1;overflow-y:auto;padding:8px}.sidebar-foot{padding:9px 12px;border-top:1px solid var(--border);font-size:11px;line-height:1.5}.motor-group{margin-bottom:12px}.motor-group-title{font-size:11px;text-transform:uppercase;letter-spacing:.5px;color:var(--muted);margin:0 2px 5px}.chips{display:flex;flex-direction:column;gap:4px}.sig-chip{display:flex;align-items:center;gap:7px;padding:5px 8px;background:var(--bg-2);border:1px solid var(--border);border-radius:6px;cursor:grab;-webkit-user-select:none;user-select:none;font-size:12px}.sig-chip:hover{background:var(--bg-3);border-color:#3a434f}.sig-chip.dragging{opacity:.4}.sig-swatch{width:10px;height:10px;border-radius:3px;border:2px solid;flex-shrink:0}.sig-name{flex:1;font-family:var(--mono)}.sig-unit{color:var(--muted);font-size:10.5px}.drag-ghost{background:var(--accent);color:#06223f;font-weight:600;font-size:12px;padding:6px 10px;border-radius:6px;font-family:var(--mono);box-shadow:0 8px 20px #00000080}.panel{height:100%;display:flex;flex-direction:column;background:var(--bg);overflow:hidden}.plot-toolbar{display:flex;align-items:center;gap:8px;padding:6px 10px;border-bottom:1px solid var(--border);flex-wrap:wrap}.legend{display:flex;gap:6px;flex-wrap:wrap}.legend-chip{display:inline-flex;align-items:center;gap:5px;font-size:11px;padding:2px 6px 2px 5px;border:1px solid var(--border);border-radius:10px;font-family:var(--mono)}.legend-swatch{width:9px;height:9px;border-radius:2px;border:1.5px solid}.legend-x{background:none;border:none;color:var(--muted);cursor:pointer;font-size:13px;padding:0 0 0 2px}.legend-x:hover{color:var(--err)}.plot-host{flex:1;min-height:0;position:relative;padding:4px}.plot-host.drop-over{outline:2px dashed var(--accent);outline-offset:-4px;background:#58a6ff0d}.drop-hint{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;color:var(--muted);font-size:12px;pointer-events:none;text-align:center;padding:20px}.uplot,.u-wrap{width:100%!important}.table-panel{overflow:auto}.motor-table{width:100%;border-collapse:collapse;font-size:12px}.motor-table th,.motor-table td{padding:5px 9px;text-align:right;border-bottom:1px solid var(--border);white-space:nowrap}.motor-table th:first-child,.motor-table td:first-child{text-align:left}.motor-table th{position:sticky;top:0;background:var(--bg-2);color:var(--muted);font-weight:600;font-size:11px;text-transform:uppercase;letter-spacing:.3px}.motor-table tr:hover td{background:var(--bg-1)}.cmd-col{color:var(--accent)}.status-pill{font-size:10px;padding:1px 6px;border-radius:8px;font-weight:600}.status-pill.ok{color:var(--ok);background:#3fb9501f}.status-pill.off{color:var(--muted);background:#8b949e1f}.status-pill.warn{color:var(--warn);background:#d299221f}.cards-panel{overflow:auto}.cards-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:10px;padding:12px}.motor-card{background:var(--bg-1);border:1px solid var(--border);border-radius:10px;padding:12px}.motor-card-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:4px}.motor-card-sub{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:10px}.type-select{width:auto;padding:2px 6px;font-size:11px}.metric{margin-bottom:8px}.metric-label{font-size:11px;color:var(--text);margin-bottom:2px}.metric-values{display:flex;align-items:baseline;gap:10px}.metric-act{font-family:var(--mono);font-size:19px;font-weight:600}.metric-cmd{font-family:var(--mono);font-size:12px;color:var(--accent)}.temp-row{display:flex;justify-content:space-between;font-size:11px;color:var(--muted);margin-top:6px;border-top:1px solid var(--border);padding-top:6px}.rawlog-panel{font-size:11.5px}.rawlog-toolbar{display:flex;align-items:center;gap:10px;padding:5px 10px;border-bottom:1px solid var(--border)}.rawlog-body{flex:1;overflow:auto}.rawlog-head,.rawlog-row{display:grid;grid-template-columns:96px 60px 46px 76px minmax(0,1fr) 150px;gap:10px;align-items:center;padding:0 10px}.rawlog-head{position:sticky;top:0;z-index:2;height:26px;background:var(--bg-2);border-bottom:1px solid var(--border);color:var(--muted);font-size:10.5px;text-transform:uppercase;letter-spacing:.3px}.rawlog-row{position:absolute;left:0;right:0;height:22px;line-height:22px;border-bottom:1px solid rgba(42,49,60,.5)}.rawlog-head>span,.rawlog-row>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.rawlog-row .c-f{color:var(--text)}.rawlog-row.k-command .c-k{color:var(--accent)}.rawlog-row.k-feedback .c-k{color:var(--ok)}.rawlog-row.k-special .c-k{color:var(--warn)}.dockview-theme-abyss{--dv-background-color: var(--bg);--dv-paneview-active-outline-color: var(--accent);--dv-tabs-and-actions-container-background-color: var(--bg-1);--dv-activegroup-visiblepanel-tab-background-color: var(--bg);--dv-inactivegroup-visiblepanel-tab-background-color: var(--bg-1);--dv-tab-divider-color: var(--border);--dv-separator-border: var(--border);height:100%} diff --git a/damiao_motor/gui/webapp/dist/index.html b/damiao_motor/gui/webapp/dist/index.html index 641e3e8..800f72a 100644 --- a/damiao_motor/gui/webapp/dist/index.html +++ b/damiao_motor/gui/webapp/dist/index.html @@ -4,8 +4,8 @@ DaMiao Monitor - - + +
diff --git a/damiao_motor/gui/webapp/package-lock.json b/damiao_motor/gui/webapp/package-lock.json index 29f4fdb..d54be4a 100644 --- a/damiao_motor/gui/webapp/package-lock.json +++ b/damiao_motor/gui/webapp/package-lock.json @@ -10,7 +10,7 @@ "dependencies": { "@dnd-kit/core": "^6.1.0", "@tanstack/react-virtual": "^3.10.8", - "dockview": "^4.2.0", + "gridstack": "^11.3.0", "react": "^18.3.1", "react-dom": "^18.3.1", "uplot": "^1.6.31", @@ -1461,24 +1461,6 @@ } } }, - "node_modules/dockview": { - "version": "4.13.1", - "resolved": "https://registry.npmjs.org/dockview/-/dockview-4.13.1.tgz", - "integrity": "sha512-K8xnYt3Rvkx8MYKHaEsb8aFaPyQclKRRkXS9JcpQPZUgqxumTLnSidgdd6uIfzEps6yJsXoZGQGJ9PtcaKyDcQ==", - "license": "MIT", - "dependencies": { - "dockview-core": "^4.13.1" - }, - "peerDependencies": { - "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" - } - }, - "node_modules/dockview-core": { - "version": "4.13.1", - "resolved": "https://registry.npmjs.org/dockview-core/-/dockview-core-4.13.1.tgz", - "integrity": "sha512-+7vR0ZEoL8CNck6NqDVUMqBT22niwBu5CMMI137dZ3c8NDc7c5Si+3dGEqQgM4lNtHBLAtvypo1C4p21J2wkiQ==", - "license": "MIT" - }, "node_modules/electron-to-chromium": { "version": "1.5.372", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.372.tgz", @@ -1581,6 +1563,22 @@ "node": ">=6.9.0" } }, + "node_modules/gridstack": { + "version": "11.5.1", + "resolved": "https://registry.npmjs.org/gridstack/-/gridstack-11.5.1.tgz", + "integrity": "sha512-qgbH65F6TtyKyi9t6fCkrxLhiobgYR3RBjnK0AzZl+YO7hreMVlsZ1MFbkPV0+7ZhjXdvcaRSZp3UA1yAJqYBQ==", + "funding": [ + { + "type": "paypal", + "url": "https://www.paypal.me/alaind831" + }, + { + "type": "venmo", + "url": "https://www.venmo.com/adumesny" + } + ], + "license": "MIT" + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", diff --git a/damiao_motor/gui/webapp/package.json b/damiao_motor/gui/webapp/package.json index dda750a..322c32c 100644 --- a/damiao_motor/gui/webapp/package.json +++ b/damiao_motor/gui/webapp/package.json @@ -11,7 +11,7 @@ "dependencies": { "@dnd-kit/core": "^6.1.0", "@tanstack/react-virtual": "^3.10.8", - "dockview": "^4.2.0", + "gridstack": "^11.3.0", "react": "^18.3.1", "react-dom": "^18.3.1", "uplot": "^1.6.31", diff --git a/damiao_motor/gui/webapp/src/App.tsx b/damiao_motor/gui/webapp/src/App.tsx index 23d5f8f..20edabb 100644 --- a/damiao_motor/gui/webapp/src/App.tsx +++ b/damiao_motor/gui/webapp/src/App.tsx @@ -11,7 +11,7 @@ import { import Toolbar from "./components/Toolbar"; import SignalSidebar from "./components/SignalSidebar"; -import Dock from "./components/Dock"; +import Canvas from "./components/Canvas"; import { useApp } from "./lib/store"; import { connectWs, fetchMotorTypes } from "./lib/ws"; import { shortSignal } from "./lib/format"; @@ -50,8 +50,8 @@ export default function App() {
-
- +
+
diff --git a/damiao_motor/gui/webapp/src/components/Canvas.tsx b/damiao_motor/gui/webapp/src/components/Canvas.tsx new file mode 100644 index 0000000..2df56df --- /dev/null +++ b/damiao_motor/gui/webapp/src/components/Canvas.tsx @@ -0,0 +1,121 @@ +import { useEffect, useRef, useState } from "react"; +import { createPortal } from "react-dom"; +import { GridStack, type GridStackNode } from "gridstack"; +import "gridstack/dist/gridstack.min.css"; + +import { useWidgets, type Widget } from "../lib/widgets"; +import { PANEL_BY_KIND } from "../panels/registry"; + +function WidgetFrame({ widget, onRemove }: { widget: Widget; onRemove: () => void }) { + const def = PANEL_BY_KIND[widget.kind]; + return ( +
+
+ + {def?.icon} + {def?.title || widget.kind} + +
+
{def ? def.render(widget.id) : null}
+
+ ); +} + +export default function Canvas() { + const widgets = useWidgets((s) => s.widgets); + const updateGeom = useWidgets((s) => s.updateGeom); + const removeWidget = useWidgets((s) => s.removeWidget); + + const rootRef = useRef(null); + const gridRef = useRef(null); + const itemEls = useRef>(new Map()); + const [contentEls, setContentEls] = useState>(new Map()); + const [ready, setReady] = useState(false); + + // init GridStack once + useEffect(() => { + if (!rootRef.current) return; + const grid = GridStack.init( + { + column: 12, + cellHeight: 56, + margin: 8, + float: true, + handle: ".widget-header", + resizable: { handles: "e, se, s, sw, w" }, + animate: true, + }, + rootRef.current + ); + gridRef.current = grid; + + grid.on("change", (_e, nodes) => { + const geoms = (nodes as GridStackNode[]).map((n) => ({ + id: String(n.id), + x: n.x ?? 0, + y: n.y ?? 0, + w: n.w ?? 1, + h: n.h ?? 1, + })); + if (geoms.length) updateGeom(geoms); + }); + + setReady(true); + return () => { + grid.destroy(false); + gridRef.current = null; + }; + }, [updateGeom]); + + // reconcile widget list -> gridstack items (add new, remove gone) + useEffect(() => { + const grid = gridRef.current; + if (!grid || !ready) return; + + const wanted = new Set(widgets.map((w) => w.id)); + let changed = false; + const nextContent = new Map(contentEls); + + // add new + grid.batchUpdate(); + for (const w of widgets) { + if (itemEls.current.has(w.id)) continue; + const el = grid.addWidget({ x: w.x, y: w.y, w: w.w, h: w.h, id: w.id }); + const content = el.querySelector(".grid-stack-item-content") as HTMLElement; + itemEls.current.set(w.id, el); + nextContent.set(w.id, content); + changed = true; + } + // remove gone + for (const [id, el] of Array.from(itemEls.current.entries())) { + if (!wanted.has(id)) { + grid.removeWidget(el, true); + itemEls.current.delete(id); + nextContent.delete(id); + changed = true; + } + } + grid.commit(); + + if (changed) setContentEls(nextContent); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [widgets, ready]); + + return ( +
+
+ {widgets.map((w) => { + const c = contentEls.get(w.id); + return c + ? createPortal( + removeWidget(w.id)} />, + c, + w.id + ) + : null; + })} +
+ ); +} diff --git a/damiao_motor/gui/webapp/src/components/Dock.tsx b/damiao_motor/gui/webapp/src/components/Dock.tsx deleted file mode 100644 index 51794ed..0000000 --- a/damiao_motor/gui/webapp/src/components/Dock.tsx +++ /dev/null @@ -1,65 +0,0 @@ -import { useCallback } from "react"; -import { DockviewReact, type DockviewReadyEvent } from "dockview"; -import "dockview/dist/styles/dockview.css"; - -import { dockComponents } from "../panels/registry"; -import { setDockApi } from "../lib/dock"; - -const LAYOUT_KEY = "damiao.monitor.layout"; - -function defaultLayout(api: DockviewReadyEvent["api"]) { - api.addPanel({ id: "plot-1", component: "plot", title: "Plot 1" }); - api.addPanel({ - id: "cards-1", - component: "cards", - title: "Motor Cards", - position: { referencePanel: "plot-1", direction: "right" }, - }); - api.addPanel({ - id: "table-1", - component: "table", - title: "Motor Table", - position: { referencePanel: "plot-1", direction: "below" }, - }); - api.addPanel({ - id: "raw-1", - component: "rawlog", - title: "Raw CAN Log", - position: { referencePanel: "table-1", direction: "within" }, - }); -} - -export default function Dock() { - const onReady = useCallback((event: DockviewReadyEvent) => { - const { api } = event; - setDockApi(api); - - const saved = localStorage.getItem(LAYOUT_KEY); - let restored = false; - if (saved) { - try { - api.fromJSON(JSON.parse(saved)); - restored = true; - } catch { - restored = false; - } - } - if (!restored) defaultLayout(api); - - api.onDidLayoutChange(() => { - try { - localStorage.setItem(LAYOUT_KEY, JSON.stringify(api.toJSON())); - } catch { - /* ignore quota */ - } - }); - }, []); - - return ( - - ); -} diff --git a/damiao_motor/gui/webapp/src/components/Toolbar.tsx b/damiao_motor/gui/webapp/src/components/Toolbar.tsx index e93598b..e29a45e 100644 --- a/damiao_motor/gui/webapp/src/components/Toolbar.tsx +++ b/damiao_motor/gui/webapp/src/components/Toolbar.tsx @@ -1,16 +1,14 @@ import { useApp } from "../lib/store"; -import { addPanelOfKind } from "../lib/dock"; +import { useWidgets } from "../lib/widgets"; import { PANELS } from "../panels/registry"; export default function Toolbar() { const connected = useApp((s) => s.connected); const status = useApp((s) => s.status); + const addWidget = useWidgets((s) => s.addWidget); + const resetWidgets = useWidgets((s) => s.resetWidgets); - const resetLayout = () => { - localStorage.removeItem("damiao.monitor.layout"); - localStorage.removeItem("damiao.monitor.plotConfigs"); - location.reload(); - }; + const resetLayout = () => resetWidgets(); return (
@@ -45,7 +43,7 @@ export default function Toolbar() { key={p.kind} className="btn" title={p.description} - onClick={() => addPanelOfKind(p.kind)} + onClick={() => addWidget(p.kind)} > {p.icon} {p.title} diff --git a/damiao_motor/gui/webapp/src/index.css b/damiao_motor/gui/webapp/src/index.css index 52a7907..f4947cf 100644 --- a/damiao_motor/gui/webapp/src/index.css +++ b/damiao_motor/gui/webapp/src/index.css @@ -1,15 +1,19 @@ :root { - --bg: #0d1117; - --bg-1: #11161d; - --bg-2: #161b22; - --bg-3: #1c232c; - --border: #2a313c; - --text: #c9d1d9; - --muted: #8b949e; - --accent: #58a6ff; - --ok: #3fb950; - --warn: #d29922; - --err: #ff7b72; + --bg: #0f1216; + --bg-1: #141a21; + --surface: #171d25; + --surface-2: #1d242e; + --border: #262e3a; + --border-soft: #1f2630; + --text: #d7dde5; + --muted: #8a94a3; + --accent: #6aa3ff; + --ok: #4ade80; + --warn: #fbbf24; + --err: #fb7185; + --radius: 14px; + --radius-sm: 9px; + --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px -16px rgba(0, 0, 0, 0.65); --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; } @@ -23,188 +27,217 @@ body { font-size: 13px; -webkit-font-smoothing: antialiased; } -.mono { font-family: var(--mono); } +.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; } .muted { color: var(--muted); } .small { font-size: 11px; } .center { text-align: center; } .pad { padding: 16px; } -.strong { font-weight: 600; } -.dim { opacity: 0.55; } +.strong { font-weight: 650; } +.dim { opacity: 0.5; } .app { display: flex; flex-direction: column; height: 100%; } .body { flex: 1; display: flex; min-height: 0; } -.dock-host { flex: 1; min-width: 0; position: relative; } +.canvas-host { flex: 1; min-width: 0; position: relative; overflow: auto; } +.canvas { min-height: 100%; padding: 6px; } -/* ------------------------------------------------------------- toolbar */ +/* --------------------------------------------------------------- toolbar */ .toolbar { display: flex; align-items: center; gap: 16px; - height: 46px; - padding: 0 14px; - background: linear-gradient(180deg, #11161d, #0d1117); - border-bottom: 1px solid var(--border); + height: 52px; + padding: 0 16px; + background: linear-gradient(180deg, #161c24, #0f1216); + border-bottom: 1px solid var(--border-soft); } -.brand { font-weight: 600; font-size: 15px; letter-spacing: 0.2px; display: flex; align-items: center; gap: 8px; } +.brand { font-weight: 650; font-size: 15px; letter-spacing: 0.2px; display: flex; align-items: center; gap: 9px; } .brand-sub { color: var(--muted); font-weight: 500; font-size: 12px; } -.brand-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); } -.conn { display: flex; align-items: center; gap: 8px; } +.brand-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); } +.conn { display: flex; align-items: center; gap: 9px; } .conn .dot { width: 8px; height: 8px; border-radius: 50%; } -.dot.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); } +.dot.on { background: var(--ok); box-shadow: 0 0 9px var(--ok); } .dot.off { background: var(--err); } .spacer { flex: 1; } -.actions { display: flex; gap: 6px; } +.actions { display: flex; gap: 7px; } .badge { - font-size: 10.5px; padding: 2px 7px; border-radius: 10px; font-weight: 600; - border: 1px solid transparent; text-transform: uppercase; letter-spacing: 0.3px; + font-size: 10.5px; padding: 2px 8px; border-radius: 999px; font-weight: 650; + border: 1px solid transparent; text-transform: uppercase; letter-spacing: 0.4px; } -.badge.ok { color: var(--ok); border-color: rgba(63,185,80,0.4); background: rgba(63,185,80,0.1); } -.badge.warn { color: var(--warn); border-color: rgba(210,153,34,0.4); background: rgba(210,153,34,0.1); } -.badge.err { color: var(--err); border-color: rgba(255,123,114,0.4); background: rgba(255,123,114,0.1); } +.badge.ok { color: var(--ok); border-color: rgba(74,222,128,0.35); background: rgba(74,222,128,0.1); } +.badge.warn { color: var(--warn); border-color: rgba(251,191,36,0.35); background: rgba(251,191,36,0.1); } +.badge.err { color: var(--err); border-color: rgba(251,113,133,0.35); background: rgba(251,113,133,0.1); } .btn { - background: var(--bg-3); color: var(--text); border: 1px solid var(--border); - border-radius: 6px; padding: 5px 10px; font-size: 12px; cursor: pointer; - transition: background 0.15s, border-color 0.15s; + background: var(--surface-2); color: var(--text); border: 1px solid var(--border); + border-radius: var(--radius-sm); padding: 6px 11px; font-size: 12px; cursor: pointer; + transition: background 0.15s, border-color 0.15s, transform 0.05s; } -.btn:hover { background: #232c37; border-color: #3a434f; } +.btn:hover { background: #232c38; border-color: #33404f; } +.btn:active { transform: translateY(1px); } .btn.ghost { background: transparent; } -.btn.small { padding: 3px 8px; font-size: 11px; } +.btn.small { padding: 3px 9px; font-size: 11px; } .btn.active { border-color: var(--accent); color: var(--accent); } -.btn-icon { color: var(--accent); margin-right: 1px; font-size: 12px; } +.btn-icon { color: var(--accent); margin-right: 2px; } -/* ------------------------------------------------------------- sidebar */ +/* --------------------------------------------------------------- sidebar */ .sidebar { - width: 232px; flex-shrink: 0; background: var(--bg-1); - border-right: 1px solid var(--border); display: flex; flex-direction: column; -} -.sidebar-head { padding: 10px 12px; border-bottom: 1px solid var(--border); } -.sidebar-title { font-weight: 600; margin-bottom: 8px; } -.filter, .type-select, select { - width: 100%; background: var(--bg-3); border: 1px solid var(--border); - color: var(--text); border-radius: 6px; padding: 5px 8px; font-size: 12px; -} -.sidebar-body { flex: 1; overflow-y: auto; padding: 8px; } -.sidebar-foot { padding: 9px 12px; border-top: 1px solid var(--border); font-size: 11px; line-height: 1.5; } -.motor-group { margin-bottom: 12px; } + width: 236px; flex-shrink: 0; background: var(--bg-1); + border-right: 1px solid var(--border-soft); display: flex; flex-direction: column; +} +.sidebar-head { padding: 12px 14px; border-bottom: 1px solid var(--border-soft); } +.sidebar-title { font-weight: 650; margin-bottom: 9px; } +.filter, .type-select, select, input[type="text"], input[type="number"] { + width: 100%; background: var(--surface-2); border: 1px solid var(--border); + color: var(--text); border-radius: var(--radius-sm); padding: 6px 9px; font-size: 12px; + outline: none; transition: border-color 0.15s, box-shadow 0.15s; +} +.filter:focus, select:focus, input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(106,163,255,0.15); } +.sidebar-body { flex: 1; overflow-y: auto; padding: 10px; } +.sidebar-foot { padding: 10px 14px; border-top: 1px solid var(--border-soft); font-size: 11px; line-height: 1.55; color: var(--muted); } +.motor-group { margin-bottom: 14px; } .motor-group-title { - font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; - color: var(--muted); margin: 0 2px 5px; + font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; + color: var(--muted); margin: 0 2px 6px; } -.chips { display: flex; flex-direction: column; gap: 4px; } +.chips { display: flex; flex-direction: column; gap: 5px; } .sig-chip { - display: flex; align-items: center; gap: 7px; padding: 5px 8px; - background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px; - cursor: grab; user-select: none; font-size: 12px; + display: flex; align-items: center; gap: 8px; padding: 6px 9px; + background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); + cursor: grab; user-select: none; font-size: 12px; transition: background 0.12s, border-color 0.12s; } -.sig-chip:hover { background: var(--bg-3); border-color: #3a434f; } +.sig-chip:hover { background: var(--surface-2); border-color: var(--border); } .sig-chip.dragging { opacity: 0.4; } .sig-swatch { width: 10px; height: 10px; border-radius: 3px; border: 2px solid; flex-shrink: 0; } .sig-name { flex: 1; font-family: var(--mono); } .sig-unit { color: var(--muted); font-size: 10.5px; } .drag-ghost { - background: var(--accent); color: #06223f; font-weight: 600; font-size: 12px; - padding: 6px 10px; border-radius: 6px; font-family: var(--mono); - box-shadow: 0 8px 20px rgba(0,0,0,0.5); + background: var(--accent); color: #05203f; font-weight: 650; font-size: 12px; + padding: 6px 11px; border-radius: var(--radius-sm); font-family: var(--mono); + box-shadow: 0 10px 26px rgba(0,0,0,0.55); +} + +/* ----------------------------------------------------- gridstack + widget */ +.grid-stack { background: transparent; } +.grid-stack-item-content { + inset: 0; + overflow: visible; + background: transparent; + border: none; +} +.widget { + height: 100%; + display: flex; + flex-direction: column; + background: var(--surface); + border: 1px solid var(--border-soft); + border-radius: var(--radius); + box-shadow: var(--shadow); + overflow: hidden; +} +.widget-header { + display: flex; align-items: center; gap: 8px; + height: 34px; padding: 0 8px 0 10px; flex-shrink: 0; + border-bottom: 1px solid var(--border-soft); + background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent); + cursor: move; +} +.widget-grip { color: var(--muted); opacity: 0.5; font-size: 12px; letter-spacing: -2px; } +.widget-icon { color: var(--accent); font-size: 12px; } +.widget-title { flex: 1; font-size: 12.5px; font-weight: 600; letter-spacing: 0.2px; } +.widget-close { + width: 22px; height: 22px; border: none; background: transparent; color: var(--muted); + border-radius: 6px; cursor: pointer; font-size: 16px; line-height: 1; opacity: 0; + transition: opacity 0.12s, background 0.12s, color 0.12s; +} +.widget:hover .widget-close { opacity: 1; } +.widget-close:hover { background: rgba(251,113,133,0.15); color: var(--err); } +.widget-body { flex: 1; min-height: 0; position: relative; } +.widget-body .panel { height: 100%; } + +/* gridstack resize handles: subtle */ +.grid-stack-item > .ui-resizable-handle { filter: opacity(0.45); } +.grid-stack-item:hover > .ui-resizable-handle { filter: opacity(0.9); } +.grid-stack-placeholder > .placeholder-content { + border: 1px dashed var(--accent); border-radius: var(--radius); + background: rgba(106,163,255,0.06); } /* ------------------------------------------------------------- panels */ -.panel { height: 100%; display: flex; flex-direction: column; background: var(--bg); overflow: hidden; } +.panel { height: 100%; display: flex; flex-direction: column; overflow: hidden; } .plot-toolbar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; - border-bottom: 1px solid var(--border); flex-wrap: wrap; + border-bottom: 1px solid var(--border-soft); flex-wrap: wrap; } +.plot-toolbar select { width: auto; } .legend { display: flex; gap: 6px; flex-wrap: wrap; } .legend-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; - padding: 2px 6px 2px 5px; border: 1px solid var(--border); border-radius: 10px; + padding: 2px 7px 2px 6px; border: 1px solid var(--border); border-radius: 999px; font-family: var(--mono); } .legend-swatch { width: 9px; height: 9px; border-radius: 2px; border: 1.5px solid; } .legend-x { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 0 0 0 2px; } .legend-x:hover { color: var(--err); } -.plot-host { flex: 1; min-height: 0; position: relative; padding: 4px; } -.plot-host.drop-over { outline: 2px dashed var(--accent); outline-offset: -4px; background: rgba(88,166,255,0.05); } +.plot-host { flex: 1; min-height: 0; position: relative; padding: 6px; } +.plot-host.drop-over { outline: 2px dashed var(--accent); outline-offset: -5px; background: rgba(106,163,255,0.06); border-radius: 10px; } .drop-hint { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; - color: var(--muted); font-size: 12px; pointer-events: none; text-align: center; padding: 20px; + color: var(--muted); font-size: 12px; pointer-events: none; text-align: center; padding: 22px; } -.uplot, .u-wrap { width: 100% !important; } /* table */ .table-panel { overflow: auto; } .motor-table { width: 100%; border-collapse: collapse; font-size: 12px; } -.motor-table th, .motor-table td { padding: 5px 9px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; } +.motor-table th, .motor-table td { padding: 6px 10px; text-align: right; border-bottom: 1px solid var(--border-soft); white-space: nowrap; } .motor-table th:first-child, .motor-table td:first-child { text-align: left; } .motor-table th { - position: sticky; top: 0; background: var(--bg-2); color: var(--muted); - font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.3px; + position: sticky; top: 0; background: var(--surface-2); color: var(--muted); + font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; } .motor-table tr:hover td { background: var(--bg-1); } .cmd-col { color: var(--accent); } -.status-pill { font-size: 10px; padding: 1px 6px; border-radius: 8px; font-weight: 600; } -.status-pill.ok { color: var(--ok); background: rgba(63,185,80,0.12); } -.status-pill.off { color: var(--muted); background: rgba(139,148,158,0.12); } -.status-pill.warn { color: var(--warn); background: rgba(210,153,34,0.12); } +.status-pill { font-size: 10px; padding: 2px 8px; border-radius: 999px; font-weight: 650; } +.status-pill.ok { color: var(--ok); background: rgba(74,222,128,0.12); } +.status-pill.off { color: var(--muted); background: rgba(138,148,163,0.12); } +.status-pill.warn { color: var(--warn); background: rgba(251,191,36,0.12); } /* cards */ .cards-panel { overflow: auto; } -.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; padding: 12px; } -.motor-card { background: var(--bg-1); border: 1px solid var(--border); border-radius: 10px; padding: 12px; } -.motor-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; } -.motor-card-sub { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; } -.type-select { width: auto; padding: 2px 6px; font-size: 11px; } -.metric { margin-bottom: 8px; } -.metric-label { font-size: 11px; color: var(--text); margin-bottom: 2px; } +.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 11px; padding: 12px; } +.motor-card { background: var(--bg-1); border: 1px solid var(--border-soft); border-radius: 12px; padding: 13px; } +.motor-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; } +.motor-card-sub { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 11px; } +.type-select { width: auto; padding: 3px 7px; font-size: 11px; } +.metric { margin-bottom: 9px; } +.metric-label { font-size: 11px; color: var(--text); margin-bottom: 3px; } .metric-values { display: flex; align-items: baseline; gap: 10px; } -.metric-act { font-family: var(--mono); font-size: 19px; font-weight: 600; } +.metric-act { font-family: var(--mono); font-size: 20px; font-weight: 650; } .metric-cmd { font-family: var(--mono); font-size: 12px; color: var(--accent); } -.temp-row { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; border-top: 1px solid var(--border); padding-top: 6px; } +.temp-row { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 7px; border-top: 1px solid var(--border-soft); padding-top: 7px; } /* raw log */ .rawlog-panel { font-size: 11.5px; } -.rawlog-toolbar { display: flex; align-items: center; gap: 10px; padding: 5px 10px; border-bottom: 1px solid var(--border); } +.rawlog-toolbar { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-bottom: 1px solid var(--border-soft); } .rawlog-body { flex: 1; overflow: auto; } -/* header + rows share one grid template + padding so columns align exactly */ .rawlog-head, .rawlog-row { display: grid; grid-template-columns: 96px 60px 46px 76px minmax(0, 1fr) 150px; - gap: 10px; - align-items: center; - padding: 0 10px; + gap: 10px; align-items: center; padding: 0 10px; } .rawlog-head { - position: sticky; - top: 0; - z-index: 2; - height: 26px; - background: var(--bg-2); - border-bottom: 1px solid var(--border); - color: var(--muted); - font-size: 10.5px; - text-transform: uppercase; - letter-spacing: 0.3px; -} -.rawlog-row { position: absolute; left: 0; right: 0; height: 22px; line-height: 22px; border-bottom: 1px solid rgba(42,49,60,0.5); } -/* every cell stays on one line and clips with an ellipsis so rows never overlap */ + position: sticky; top: 0; z-index: 2; height: 26px; + background: var(--surface-2); border-bottom: 1px solid var(--border-soft); + color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.4px; +} +.rawlog-row { position: absolute; left: 0; right: 0; height: 22px; line-height: 22px; border-bottom: 1px solid var(--border-soft); } .rawlog-head > span, .rawlog-row > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; } .rawlog-row .c-f { color: var(--text); } .rawlog-row.k-command .c-k { color: var(--accent); } .rawlog-row.k-feedback .c-k { color: var(--ok); } .rawlog-row.k-special .c-k { color: var(--warn); } -/* ---------------------------------------------------- dockview theming */ -.dockview-theme-abyss { - --dv-background-color: var(--bg); - --dv-paneview-active-outline-color: var(--accent); - --dv-tabs-and-actions-container-background-color: var(--bg-1); - --dv-activegroup-visiblepanel-tab-background-color: var(--bg); - --dv-inactivegroup-visiblepanel-tab-background-color: var(--bg-1); - --dv-tab-divider-color: var(--border); - --dv-separator-border: var(--border); - height: 100%; -} +.message, .loading { color: var(--muted); text-align: center; padding: 24px; } diff --git a/damiao_motor/gui/webapp/src/lib/dock.ts b/damiao_motor/gui/webapp/src/lib/dock.ts deleted file mode 100644 index 30473ae..0000000 --- a/damiao_motor/gui/webapp/src/lib/dock.ts +++ /dev/null @@ -1,21 +0,0 @@ -import type { DockviewApi } from "dockview"; -import { PANEL_BY_KIND } from "../panels/registry"; - -let api: DockviewApi | null = null; -const counters: Record = {}; - -export function setDockApi(a: DockviewApi | null) { - api = a; -} -export function getDockApi(): DockviewApi | null { - return api; -} - -export function addPanelOfKind(kind: string) { - if (!api) return; - const def = PANEL_BY_KIND[kind]; - if (!def) return; - counters[kind] = (counters[kind] || 0) + 1; - const id = `${kind}-${Date.now().toString(36)}-${counters[kind]}`; - api.addPanel({ id, component: kind, title: `${def.title} ${counters[kind]}` }); -} diff --git a/damiao_motor/gui/webapp/src/lib/widgets.ts b/damiao_motor/gui/webapp/src/lib/widgets.ts new file mode 100644 index 0000000..15e4925 --- /dev/null +++ b/damiao_motor/gui/webapp/src/lib/widgets.ts @@ -0,0 +1,92 @@ +/** Free-form widget canvas state: a list of widgets with grid geometry, persisted. */ + +import { create } from "zustand"; + +export interface Widget { + id: string; + kind: string; // panel kind from panels/registry + x: number; + y: number; + w: number; + h: number; +} + +const KEY = "damiao.monitor.widgets.v2"; + +function load(): Widget[] | null { + try { + const raw = localStorage.getItem(KEY); + if (!raw) return null; + const arr = JSON.parse(raw); + return Array.isArray(arr) && arr.length ? arr : null; + } catch { + return null; + } +} + +function persist(widgets: Widget[]) { + try { + localStorage.setItem(KEY, JSON.stringify(widgets)); + } catch { + /* ignore quota */ + } +} + +const DEFAULT_WIDGETS: Widget[] = [ + { id: "plot-1", kind: "plot", x: 0, y: 0, w: 7, h: 6 }, + { id: "cards-1", kind: "cards", x: 7, y: 0, w: 5, h: 6 }, + { id: "table-1", kind: "table", x: 0, y: 6, w: 7, h: 5 }, + { id: "rawlog-1", kind: "rawlog", x: 7, y: 6, w: 5, h: 5 }, +]; + +let counter = 1; + +interface WidgetState { + widgets: Widget[]; + addWidget: (kind: string) => string; + removeWidget: (id: string) => void; + updateGeom: (geoms: { id: string; x: number; y: number; w: number; h: number }[]) => void; + resetWidgets: () => void; +} + +export const useWidgets = create((set, get) => ({ + widgets: load() || DEFAULT_WIDGETS, + + addWidget: (kind) => { + counter += 1; + const id = `${kind}-${Date.now().toString(36)}-${counter}`; + // place new widget at the bottom; GridStack will reflow/auto-position + const maxY = get().widgets.reduce((m, w) => Math.max(m, w.y + w.h), 0); + const widget: Widget = { id, kind, x: 0, y: maxY, w: 6, h: 5 }; + const next = [...get().widgets, widget]; + persist(next); + set({ widgets: next }); + return id; + }, + + removeWidget: (id) => { + const next = get().widgets.filter((w) => w.id !== id); + persist(next); + set({ widgets: next }); + }, + + updateGeom: (geoms) => { + const byId = new Map(geoms.map((g) => [g.id, g])); + const next = get().widgets.map((w) => { + const g = byId.get(w.id); + return g ? { ...w, x: g.x, y: g.y, w: g.w, h: g.h } : w; + }); + persist(next); + set({ widgets: next }); + }, + + resetWidgets: () => { + try { + localStorage.removeItem(KEY); + localStorage.removeItem("damiao.monitor.plotConfigs"); + } catch { + /* ignore */ + } + set({ widgets: DEFAULT_WIDGETS.map((w) => ({ ...w })) }); + }, +})); diff --git a/damiao_motor/gui/webapp/src/panels/registry.tsx b/damiao_motor/gui/webapp/src/panels/registry.tsx index 6011cc9..131c46d 100644 --- a/damiao_motor/gui/webapp/src/panels/registry.tsx +++ b/damiao_motor/gui/webapp/src/panels/registry.tsx @@ -6,7 +6,6 @@ * titling are all derived from this list, so nothing else needs editing. */ -import type { IDockviewPanelProps } from "dockview"; import PlotPanel from "./PlotPanel"; import TablePanel from "./TablePanel"; import CardsPanel from "./CardsPanel"; @@ -55,11 +54,3 @@ export const PANELS: PanelDef[] = [ export const PANEL_BY_KIND: Record = Object.fromEntries( PANELS.map((p) => [p.kind, p]) ); - -/** dockview component map, derived from the registry. */ -export const dockComponents: Record< - string, - (props: IDockviewPanelProps) => JSX.Element -> = Object.fromEntries( - PANELS.map((p) => [p.kind, (props: IDockviewPanelProps) => p.render(props.api.id)]) -); diff --git a/damiao_motor/gui/webapp/tsconfig.tsbuildinfo b/damiao_motor/gui/webapp/tsconfig.tsbuildinfo index 8bd09a9..a76d453 100644 --- a/damiao_motor/gui/webapp/tsconfig.tsbuildinfo +++ b/damiao_motor/gui/webapp/tsconfig.tsbuildinfo @@ -1 +1 @@ -{"root":["./src/app.tsx","./src/main.tsx","./src/components/dock.tsx","./src/components/signalchip.tsx","./src/components/signalsidebar.tsx","./src/components/toolbar.tsx","./src/lib/datastore.ts","./src/lib/dock.ts","./src/lib/format.ts","./src/lib/store.ts","./src/lib/types.ts","./src/lib/ws.ts","./src/panels/cardspanel.tsx","./src/panels/plotpanel.tsx","./src/panels/rawlogpanel.tsx","./src/panels/tablepanel.tsx","./src/panels/registry.tsx"],"version":"5.9.3"} \ No newline at end of file +{"root":["./src/app.tsx","./src/main.tsx","./src/components/canvas.tsx","./src/components/signalchip.tsx","./src/components/signalsidebar.tsx","./src/components/toolbar.tsx","./src/lib/datastore.ts","./src/lib/format.ts","./src/lib/store.ts","./src/lib/types.ts","./src/lib/widgets.ts","./src/lib/ws.ts","./src/panels/cardspanel.tsx","./src/panels/plotpanel.tsx","./src/panels/rawlogpanel.tsx","./src/panels/tablepanel.tsx","./src/panels/registry.tsx"],"version":"5.9.3"} \ No newline at end of file diff --git a/damiao_motor/monitor/README.md b/damiao_motor/monitor/README.md index dce9dd3..05852f5 100644 --- a/damiao_motor/monitor/README.md +++ b/damiao_motor/monitor/README.md @@ -22,13 +22,15 @@ scheme), `--motor-type` (default scaling, default `DM4310`), `--demo`, `--port`. ## Using the dashboard -- **Drag** a signal from the left sidebar onto a **Plot** panel to chart it. Drop a `cmd.*` +- **Free-form widget canvas**: each panel is a widget you can **drag by its header** and + **resize from any edge/corner**, placed anywhere on the grid. Add widgets from the + toolbar (**Plot / Motor Table / Motor Cards / Raw CAN Log**), remove with the **×** on + the widget header. Layout + plot contents persist across reloads (**Reset** restores the + default layout). +- **Drag** a signal from the left sidebar onto a **Plot** widget to chart it. Drop a `cmd.*` signal onto the plot already showing its `fb.*` to **overlay** them (dashed = command, solid = feedback). -- **Dock / merge** panels VS-Code-style: drag a panel's tab to split or group into tabs. - Layout + plots persist across reloads. -- Add more panels from the toolbar: **Plot**, **Motor Table**, **Motor Cards**, **Raw CAN - Log**. Per-motor **motor-type** can be overridden in the cards (rescales decode). +- Per-motor **motor-type** can be overridden in the cards (rescales decode). ## How it stays passive From 57db391c3a1fb8538783ea996c5c8b0577a18c6d Mon Sep 17 00:00:00 2001 From: Jia Xie Date: Mon, 15 Jun 2026 19:44:00 -0700 Subject: [PATCH 09/14] feat(monitor ui): light/dark theme, default light MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - lib/theme.ts: persisted theme (default light), applied via data-theme on before first paint. - index.css: split palette into :root (light) + [data-theme=dark]; add --hover; replace hardcoded dark colors (toolbar, buttons, widget header, table hover) with variables. - Toolbar: ☾/☀ toggle. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../gui/webapp/dist/assets/index-BsxMcYGb.css | 1 - .../gui/webapp/dist/assets/index-BzaSkbtY.css | 1 + .../{index-BV1u67uH.js => index-UZFR7yIJ.js} | 30 +++++++-------- damiao_motor/gui/webapp/dist/index.html | 4 +- .../gui/webapp/src/components/Toolbar.tsx | 15 ++++++++ damiao_motor/gui/webapp/src/index.css | 37 ++++++++++++++----- damiao_motor/gui/webapp/src/lib/theme.ts | 26 +++++++++++++ damiao_motor/gui/webapp/src/main.tsx | 3 ++ damiao_motor/gui/webapp/tsconfig.tsbuildinfo | 2 +- 9 files changed, 91 insertions(+), 28 deletions(-) delete mode 100644 damiao_motor/gui/webapp/dist/assets/index-BsxMcYGb.css create mode 100644 damiao_motor/gui/webapp/dist/assets/index-BzaSkbtY.css rename damiao_motor/gui/webapp/dist/assets/{index-BV1u67uH.js => index-UZFR7yIJ.js} (64%) create mode 100644 damiao_motor/gui/webapp/src/lib/theme.ts diff --git a/damiao_motor/gui/webapp/dist/assets/index-BsxMcYGb.css b/damiao_motor/gui/webapp/dist/assets/index-BsxMcYGb.css deleted file mode 100644 index 2025722..0000000 --- a/damiao_motor/gui/webapp/dist/assets/index-BsxMcYGb.css +++ /dev/null @@ -1 +0,0 @@ -.uplot,.uplot *,.uplot *:before,.uplot *:after{box-sizing:border-box}.uplot{font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";line-height:1.5;width:min-content}.u-title{text-align:center;font-size:18px;font-weight:700}.u-wrap{position:relative;-webkit-user-select:none;user-select:none}.u-over,.u-under{position:absolute}.u-under{overflow:hidden}.uplot canvas{display:block;position:relative;width:100%;height:100%}.u-axis{position:absolute}.u-legend{font-size:14px;margin:auto;text-align:center}.u-inline{display:block}.u-inline *{display:inline-block}.u-inline tr{margin-right:16px}.u-legend th{font-weight:600}.u-legend th>*{vertical-align:middle;display:inline-block}.u-legend .u-marker{width:1em;height:1em;margin-right:4px;background-clip:padding-box!important}.u-inline.u-live th:after{content:":";vertical-align:middle}.u-inline:not(.u-live) .u-value{display:none}.u-series>*{padding:4px}.u-series th{cursor:pointer}.u-legend .u-off>*{opacity:.3}.u-select{background:#00000012;position:absolute;pointer-events:none}.u-cursor-x,.u-cursor-y{position:absolute;left:0;top:0;pointer-events:none;will-change:transform}.u-hz .u-cursor-x,.u-vt .u-cursor-y{height:100%;border-right:1px dashed #607D8B}.u-hz .u-cursor-y,.u-vt .u-cursor-x{width:100%;border-bottom:1px dashed #607D8B}.u-cursor-pt{position:absolute;top:0;left:0;border-radius:50%;border:0 solid;pointer-events:none;will-change:transform;background-clip:padding-box!important}.u-axis.u-off,.u-select.u-off,.u-cursor-x.u-off,.u-cursor-y.u-off,.u-cursor-pt.u-off{display:none}.grid-stack{position:relative}.grid-stack-rtl{direction:ltr}.grid-stack-rtl>.grid-stack-item{direction:rtl}.grid-stack-placeholder>.placeholder-content{background-color:#0000001a;margin:0;position:absolute;width:auto;z-index:0!important}.grid-stack>.grid-stack-item{position:absolute;padding:0}.grid-stack>.grid-stack-item>.grid-stack-item-content{margin:0;position:absolute;width:auto;overflow-x:hidden;overflow-y:auto}.grid-stack>.grid-stack-item.size-to-content:not(.size-to-content-max)>.grid-stack-item-content{overflow-y:hidden}.grid-stack-item>.ui-resizable-handle{position:absolute;font-size:.1px;display:block;-ms-touch-action:none;touch-action:none}.grid-stack-item.ui-resizable-autohide>.ui-resizable-handle,.grid-stack-item.ui-resizable-disabled>.ui-resizable-handle{display:none}.grid-stack-item>.ui-resizable-ne,.grid-stack-item>.ui-resizable-nw,.grid-stack-item>.ui-resizable-se,.grid-stack-item>.ui-resizable-sw{background-image:url('data:image/svg+xml;utf8,');background-repeat:no-repeat;background-position:center}.grid-stack-item>.ui-resizable-ne{transform:rotate(45deg)}.grid-stack-item>.ui-resizable-sw{transform:rotate(45deg)}.grid-stack-item>.ui-resizable-nw{transform:rotate(-45deg)}.grid-stack-item>.ui-resizable-se{transform:rotate(-45deg)}.grid-stack-item>.ui-resizable-nw{cursor:nw-resize;width:20px;height:20px;top:0}.grid-stack-item>.ui-resizable-n{cursor:n-resize;height:10px;top:0;left:25px;right:25px}.grid-stack-item>.ui-resizable-ne{cursor:ne-resize;width:20px;height:20px;top:0}.grid-stack-item>.ui-resizable-e{cursor:e-resize;width:10px;top:15px;bottom:15px}.grid-stack-item>.ui-resizable-se{cursor:se-resize;width:20px;height:20px}.grid-stack-item>.ui-resizable-s{cursor:s-resize;height:10px;left:25px;bottom:0;right:25px}.grid-stack-item>.ui-resizable-sw{cursor:sw-resize;width:20px;height:20px}.grid-stack-item>.ui-resizable-w{cursor:w-resize;width:10px;top:15px;bottom:15px}.grid-stack-item.ui-draggable-dragging>.ui-resizable-handle{display:none!important}.grid-stack-item.ui-draggable-dragging{will-change:left,top;cursor:move}.grid-stack-item.ui-resizable-resizing{will-change:width,height}.ui-draggable-dragging,.ui-resizable-resizing{z-index:10000}.ui-draggable-dragging>.grid-stack-item-content,.ui-resizable-resizing>.grid-stack-item-content{box-shadow:1px 4px 6px #0003;opacity:.8}.grid-stack-animate,.grid-stack-animate .grid-stack-item{transition:left .3s,top .3s,height .3s,width .3s}.grid-stack-animate .grid-stack-item.grid-stack-placeholder,.grid-stack-animate .grid-stack-item.ui-draggable-dragging,.grid-stack-animate .grid-stack-item.ui-resizable-resizing{transition:left 0s,top 0s,height 0s,width 0s}.grid-stack>.grid-stack-item[gs-y="0"]{top:0}.grid-stack>.grid-stack-item[gs-x="0"]{left:0}.gs-12>.grid-stack-item{width:8.333%}.gs-12>.grid-stack-item[gs-x="1"]{left:8.333%}.gs-12>.grid-stack-item[gs-w="2"]{width:16.667%}.gs-12>.grid-stack-item[gs-x="2"]{left:16.667%}.gs-12>.grid-stack-item[gs-w="3"]{width:25%}.gs-12>.grid-stack-item[gs-x="3"]{left:25%}.gs-12>.grid-stack-item[gs-w="4"]{width:33.333%}.gs-12>.grid-stack-item[gs-x="4"]{left:33.333%}.gs-12>.grid-stack-item[gs-w="5"]{width:41.667%}.gs-12>.grid-stack-item[gs-x="5"]{left:41.667%}.gs-12>.grid-stack-item[gs-w="6"]{width:50%}.gs-12>.grid-stack-item[gs-x="6"]{left:50%}.gs-12>.grid-stack-item[gs-w="7"]{width:58.333%}.gs-12>.grid-stack-item[gs-x="7"]{left:58.333%}.gs-12>.grid-stack-item[gs-w="8"]{width:66.667%}.gs-12>.grid-stack-item[gs-x="8"]{left:66.667%}.gs-12>.grid-stack-item[gs-w="9"]{width:75%}.gs-12>.grid-stack-item[gs-x="9"]{left:75%}.gs-12>.grid-stack-item[gs-w="10"]{width:83.333%}.gs-12>.grid-stack-item[gs-x="10"]{left:83.333%}.gs-12>.grid-stack-item[gs-w="11"]{width:91.667%}.gs-12>.grid-stack-item[gs-x="11"]{left:91.667%}.gs-12>.grid-stack-item[gs-w="12"]{width:100%}.gs-1>.grid-stack-item{width:100%}:root{--bg: #0f1216;--bg-1: #141a21;--surface: #171d25;--surface-2: #1d242e;--border: #262e3a;--border-soft: #1f2630;--text: #d7dde5;--muted: #8a94a3;--accent: #6aa3ff;--ok: #4ade80;--warn: #fbbf24;--err: #fb7185;--radius: 14px;--radius-sm: 9px;--shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px -16px rgba(0, 0, 0, .65);--font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;--mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace}*{box-sizing:border-box}html,body,#root{height:100%;margin:0}body{font-family:var(--font);background:var(--bg);color:var(--text);font-size:13px;-webkit-font-smoothing:antialiased}.mono{font-family:var(--mono);font-variant-numeric:tabular-nums}.muted{color:var(--muted)}.small{font-size:11px}.center{text-align:center}.pad{padding:16px}.strong{font-weight:650}.dim{opacity:.5}.app{display:flex;flex-direction:column;height:100%}.body{flex:1;display:flex;min-height:0}.canvas-host{flex:1;min-width:0;position:relative;overflow:auto}.canvas{min-height:100%;padding:6px}.toolbar{display:flex;align-items:center;gap:16px;height:52px;padding:0 16px;background:linear-gradient(180deg,#161c24,#0f1216);border-bottom:1px solid var(--border-soft)}.brand{font-weight:650;font-size:15px;letter-spacing:.2px;display:flex;align-items:center;gap:9px}.brand-sub{color:var(--muted);font-weight:500;font-size:12px}.brand-dot{width:9px;height:9px;border-radius:50%;background:var(--accent);box-shadow:0 0 12px var(--accent)}.conn{display:flex;align-items:center;gap:9px}.conn .dot{width:8px;height:8px;border-radius:50%}.dot.on{background:var(--ok);box-shadow:0 0 9px var(--ok)}.dot.off{background:var(--err)}.spacer{flex:1}.actions{display:flex;gap:7px}.badge{font-size:10.5px;padding:2px 8px;border-radius:999px;font-weight:650;border:1px solid transparent;text-transform:uppercase;letter-spacing:.4px}.badge.ok{color:var(--ok);border-color:#4ade8059;background:#4ade801a}.badge.warn{color:var(--warn);border-color:#fbbf2459;background:#fbbf241a}.badge.err{color:var(--err);border-color:#fb718559;background:#fb71851a}.btn{background:var(--surface-2);color:var(--text);border:1px solid var(--border);border-radius:var(--radius-sm);padding:6px 11px;font-size:12px;cursor:pointer;transition:background .15s,border-color .15s,transform .05s}.btn:hover{background:#232c38;border-color:#33404f}.btn:active{transform:translateY(1px)}.btn.ghost{background:transparent}.btn.small{padding:3px 9px;font-size:11px}.btn.active{border-color:var(--accent);color:var(--accent)}.btn-icon{color:var(--accent);margin-right:2px}.sidebar{width:236px;flex-shrink:0;background:var(--bg-1);border-right:1px solid var(--border-soft);display:flex;flex-direction:column}.sidebar-head{padding:12px 14px;border-bottom:1px solid var(--border-soft)}.sidebar-title{font-weight:650;margin-bottom:9px}.filter,.type-select,select,input[type=text],input[type=number]{width:100%;background:var(--surface-2);border:1px solid var(--border);color:var(--text);border-radius:var(--radius-sm);padding:6px 9px;font-size:12px;outline:none;transition:border-color .15s,box-shadow .15s}.filter:focus,select:focus,input:focus{border-color:var(--accent);box-shadow:0 0 0 3px #6aa3ff26}.sidebar-body{flex:1;overflow-y:auto;padding:10px}.sidebar-foot{padding:10px 14px;border-top:1px solid var(--border-soft);font-size:11px;line-height:1.55;color:var(--muted)}.motor-group{margin-bottom:14px}.motor-group-title{font-size:11px;text-transform:uppercase;letter-spacing:.6px;color:var(--muted);margin:0 2px 6px}.chips{display:flex;flex-direction:column;gap:5px}.sig-chip{display:flex;align-items:center;gap:8px;padding:6px 9px;background:var(--surface);border:1px solid var(--border-soft);border-radius:var(--radius-sm);cursor:grab;-webkit-user-select:none;user-select:none;font-size:12px;transition:background .12s,border-color .12s}.sig-chip:hover{background:var(--surface-2);border-color:var(--border)}.sig-chip.dragging{opacity:.4}.sig-swatch{width:10px;height:10px;border-radius:3px;border:2px solid;flex-shrink:0}.sig-name{flex:1;font-family:var(--mono)}.sig-unit{color:var(--muted);font-size:10.5px}.drag-ghost{background:var(--accent);color:#05203f;font-weight:650;font-size:12px;padding:6px 11px;border-radius:var(--radius-sm);font-family:var(--mono);box-shadow:0 10px 26px #0000008c}.grid-stack{background:transparent}.grid-stack-item-content{top:0;right:0;bottom:0;left:0;overflow:visible;background:transparent;border:none}.widget{height:100%;display:flex;flex-direction:column;background:var(--surface);border:1px solid var(--border-soft);border-radius:var(--radius);box-shadow:var(--shadow);overflow:hidden}.widget-header{display:flex;align-items:center;gap:8px;height:34px;padding:0 8px 0 10px;flex-shrink:0;border-bottom:1px solid var(--border-soft);background:linear-gradient(180deg,rgba(255,255,255,.02),transparent);cursor:move}.widget-grip{color:var(--muted);opacity:.5;font-size:12px;letter-spacing:-2px}.widget-icon{color:var(--accent);font-size:12px}.widget-title{flex:1;font-size:12.5px;font-weight:600;letter-spacing:.2px}.widget-close{width:22px;height:22px;border:none;background:transparent;color:var(--muted);border-radius:6px;cursor:pointer;font-size:16px;line-height:1;opacity:0;transition:opacity .12s,background .12s,color .12s}.widget:hover .widget-close{opacity:1}.widget-close:hover{background:#fb718526;color:var(--err)}.widget-body{flex:1;min-height:0;position:relative}.widget-body .panel{height:100%}.grid-stack-item>.ui-resizable-handle{filter:opacity(.45)}.grid-stack-item:hover>.ui-resizable-handle{filter:opacity(.9)}.grid-stack-placeholder>.placeholder-content{border:1px dashed var(--accent);border-radius:var(--radius);background:#6aa3ff0f}.panel{height:100%;display:flex;flex-direction:column;overflow:hidden}.plot-toolbar{display:flex;align-items:center;gap:8px;padding:6px 10px;border-bottom:1px solid var(--border-soft);flex-wrap:wrap}.plot-toolbar select{width:auto}.legend{display:flex;gap:6px;flex-wrap:wrap}.legend-chip{display:inline-flex;align-items:center;gap:5px;font-size:11px;padding:2px 7px 2px 6px;border:1px solid var(--border);border-radius:999px;font-family:var(--mono)}.legend-swatch{width:9px;height:9px;border-radius:2px;border:1.5px solid}.legend-x{background:none;border:none;color:var(--muted);cursor:pointer;font-size:13px;padding:0 0 0 2px}.legend-x:hover{color:var(--err)}.plot-host{flex:1;min-height:0;position:relative;padding:6px}.plot-host.drop-over{outline:2px dashed var(--accent);outline-offset:-5px;background:#6aa3ff0f;border-radius:10px}.drop-hint{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;color:var(--muted);font-size:12px;pointer-events:none;text-align:center;padding:22px}.table-panel{overflow:auto}.motor-table{width:100%;border-collapse:collapse;font-size:12px}.motor-table th,.motor-table td{padding:6px 10px;text-align:right;border-bottom:1px solid var(--border-soft);white-space:nowrap}.motor-table th:first-child,.motor-table td:first-child{text-align:left}.motor-table th{position:sticky;top:0;background:var(--surface-2);color:var(--muted);font-weight:600;font-size:11px;text-transform:uppercase;letter-spacing:.4px}.motor-table tr:hover td{background:var(--bg-1)}.cmd-col{color:var(--accent)}.status-pill{font-size:10px;padding:2px 8px;border-radius:999px;font-weight:650}.status-pill.ok{color:var(--ok);background:#4ade801f}.status-pill.off{color:var(--muted);background:#8a94a31f}.status-pill.warn{color:var(--warn);background:#fbbf241f}.cards-panel{overflow:auto}.cards-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:11px;padding:12px}.motor-card{background:var(--bg-1);border:1px solid var(--border-soft);border-radius:12px;padding:13px}.motor-card-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:5px}.motor-card-sub{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:11px}.type-select{width:auto;padding:3px 7px;font-size:11px}.metric{margin-bottom:9px}.metric-label{font-size:11px;color:var(--text);margin-bottom:3px}.metric-values{display:flex;align-items:baseline;gap:10px}.metric-act{font-family:var(--mono);font-size:20px;font-weight:650}.metric-cmd{font-family:var(--mono);font-size:12px;color:var(--accent)}.temp-row{display:flex;justify-content:space-between;font-size:11px;color:var(--muted);margin-top:7px;border-top:1px solid var(--border-soft);padding-top:7px}.rawlog-panel{font-size:11.5px}.rawlog-toolbar{display:flex;align-items:center;gap:10px;padding:6px 10px;border-bottom:1px solid var(--border-soft)}.rawlog-body{flex:1;overflow:auto}.rawlog-head,.rawlog-row{display:grid;grid-template-columns:96px 60px 46px 76px minmax(0,1fr) 150px;gap:10px;align-items:center;padding:0 10px}.rawlog-head{position:sticky;top:0;z-index:2;height:26px;background:var(--surface-2);border-bottom:1px solid var(--border-soft);color:var(--muted);font-size:10.5px;text-transform:uppercase;letter-spacing:.4px}.rawlog-row{position:absolute;left:0;right:0;height:22px;line-height:22px;border-bottom:1px solid var(--border-soft)}.rawlog-head>span,.rawlog-row>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.rawlog-row .c-f{color:var(--text)}.rawlog-row.k-command .c-k{color:var(--accent)}.rawlog-row.k-feedback .c-k{color:var(--ok)}.rawlog-row.k-special .c-k{color:var(--warn)}.message,.loading{color:var(--muted);text-align:center;padding:24px} diff --git a/damiao_motor/gui/webapp/dist/assets/index-BzaSkbtY.css b/damiao_motor/gui/webapp/dist/assets/index-BzaSkbtY.css new file mode 100644 index 0000000..4e988af --- /dev/null +++ b/damiao_motor/gui/webapp/dist/assets/index-BzaSkbtY.css @@ -0,0 +1 @@ +.uplot,.uplot *,.uplot *:before,.uplot *:after{box-sizing:border-box}.uplot{font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";line-height:1.5;width:min-content}.u-title{text-align:center;font-size:18px;font-weight:700}.u-wrap{position:relative;-webkit-user-select:none;user-select:none}.u-over,.u-under{position:absolute}.u-under{overflow:hidden}.uplot canvas{display:block;position:relative;width:100%;height:100%}.u-axis{position:absolute}.u-legend{font-size:14px;margin:auto;text-align:center}.u-inline{display:block}.u-inline *{display:inline-block}.u-inline tr{margin-right:16px}.u-legend th{font-weight:600}.u-legend th>*{vertical-align:middle;display:inline-block}.u-legend .u-marker{width:1em;height:1em;margin-right:4px;background-clip:padding-box!important}.u-inline.u-live th:after{content:":";vertical-align:middle}.u-inline:not(.u-live) .u-value{display:none}.u-series>*{padding:4px}.u-series th{cursor:pointer}.u-legend .u-off>*{opacity:.3}.u-select{background:#00000012;position:absolute;pointer-events:none}.u-cursor-x,.u-cursor-y{position:absolute;left:0;top:0;pointer-events:none;will-change:transform}.u-hz .u-cursor-x,.u-vt .u-cursor-y{height:100%;border-right:1px dashed #607D8B}.u-hz .u-cursor-y,.u-vt .u-cursor-x{width:100%;border-bottom:1px dashed #607D8B}.u-cursor-pt{position:absolute;top:0;left:0;border-radius:50%;border:0 solid;pointer-events:none;will-change:transform;background-clip:padding-box!important}.u-axis.u-off,.u-select.u-off,.u-cursor-x.u-off,.u-cursor-y.u-off,.u-cursor-pt.u-off{display:none}.grid-stack{position:relative}.grid-stack-rtl{direction:ltr}.grid-stack-rtl>.grid-stack-item{direction:rtl}.grid-stack-placeholder>.placeholder-content{background-color:#0000001a;margin:0;position:absolute;width:auto;z-index:0!important}.grid-stack>.grid-stack-item{position:absolute;padding:0}.grid-stack>.grid-stack-item>.grid-stack-item-content{margin:0;position:absolute;width:auto;overflow-x:hidden;overflow-y:auto}.grid-stack>.grid-stack-item.size-to-content:not(.size-to-content-max)>.grid-stack-item-content{overflow-y:hidden}.grid-stack-item>.ui-resizable-handle{position:absolute;font-size:.1px;display:block;-ms-touch-action:none;touch-action:none}.grid-stack-item.ui-resizable-autohide>.ui-resizable-handle,.grid-stack-item.ui-resizable-disabled>.ui-resizable-handle{display:none}.grid-stack-item>.ui-resizable-ne,.grid-stack-item>.ui-resizable-nw,.grid-stack-item>.ui-resizable-se,.grid-stack-item>.ui-resizable-sw{background-image:url('data:image/svg+xml;utf8,');background-repeat:no-repeat;background-position:center}.grid-stack-item>.ui-resizable-ne{transform:rotate(45deg)}.grid-stack-item>.ui-resizable-sw{transform:rotate(45deg)}.grid-stack-item>.ui-resizable-nw{transform:rotate(-45deg)}.grid-stack-item>.ui-resizable-se{transform:rotate(-45deg)}.grid-stack-item>.ui-resizable-nw{cursor:nw-resize;width:20px;height:20px;top:0}.grid-stack-item>.ui-resizable-n{cursor:n-resize;height:10px;top:0;left:25px;right:25px}.grid-stack-item>.ui-resizable-ne{cursor:ne-resize;width:20px;height:20px;top:0}.grid-stack-item>.ui-resizable-e{cursor:e-resize;width:10px;top:15px;bottom:15px}.grid-stack-item>.ui-resizable-se{cursor:se-resize;width:20px;height:20px}.grid-stack-item>.ui-resizable-s{cursor:s-resize;height:10px;left:25px;bottom:0;right:25px}.grid-stack-item>.ui-resizable-sw{cursor:sw-resize;width:20px;height:20px}.grid-stack-item>.ui-resizable-w{cursor:w-resize;width:10px;top:15px;bottom:15px}.grid-stack-item.ui-draggable-dragging>.ui-resizable-handle{display:none!important}.grid-stack-item.ui-draggable-dragging{will-change:left,top;cursor:move}.grid-stack-item.ui-resizable-resizing{will-change:width,height}.ui-draggable-dragging,.ui-resizable-resizing{z-index:10000}.ui-draggable-dragging>.grid-stack-item-content,.ui-resizable-resizing>.grid-stack-item-content{box-shadow:1px 4px 6px #0003;opacity:.8}.grid-stack-animate,.grid-stack-animate .grid-stack-item{transition:left .3s,top .3s,height .3s,width .3s}.grid-stack-animate .grid-stack-item.grid-stack-placeholder,.grid-stack-animate .grid-stack-item.ui-draggable-dragging,.grid-stack-animate .grid-stack-item.ui-resizable-resizing{transition:left 0s,top 0s,height 0s,width 0s}.grid-stack>.grid-stack-item[gs-y="0"]{top:0}.grid-stack>.grid-stack-item[gs-x="0"]{left:0}.gs-12>.grid-stack-item{width:8.333%}.gs-12>.grid-stack-item[gs-x="1"]{left:8.333%}.gs-12>.grid-stack-item[gs-w="2"]{width:16.667%}.gs-12>.grid-stack-item[gs-x="2"]{left:16.667%}.gs-12>.grid-stack-item[gs-w="3"]{width:25%}.gs-12>.grid-stack-item[gs-x="3"]{left:25%}.gs-12>.grid-stack-item[gs-w="4"]{width:33.333%}.gs-12>.grid-stack-item[gs-x="4"]{left:33.333%}.gs-12>.grid-stack-item[gs-w="5"]{width:41.667%}.gs-12>.grid-stack-item[gs-x="5"]{left:41.667%}.gs-12>.grid-stack-item[gs-w="6"]{width:50%}.gs-12>.grid-stack-item[gs-x="6"]{left:50%}.gs-12>.grid-stack-item[gs-w="7"]{width:58.333%}.gs-12>.grid-stack-item[gs-x="7"]{left:58.333%}.gs-12>.grid-stack-item[gs-w="8"]{width:66.667%}.gs-12>.grid-stack-item[gs-x="8"]{left:66.667%}.gs-12>.grid-stack-item[gs-w="9"]{width:75%}.gs-12>.grid-stack-item[gs-x="9"]{left:75%}.gs-12>.grid-stack-item[gs-w="10"]{width:83.333%}.gs-12>.grid-stack-item[gs-x="10"]{left:83.333%}.gs-12>.grid-stack-item[gs-w="11"]{width:91.667%}.gs-12>.grid-stack-item[gs-x="11"]{left:91.667%}.gs-12>.grid-stack-item[gs-w="12"]{width:100%}.gs-1>.grid-stack-item{width:100%}:root{--bg: #f4f6f9;--bg-1: #eef1f6;--surface: #ffffff;--surface-2: #eef2f7;--hover: #e6ecf3;--border: #d6dde7;--border-soft: #e7ecf2;--text: #1e2733;--muted: #5f6a78;--accent: #2f6fed;--ok: #16a34a;--warn: #d97706;--err: #e11d48;--radius: 14px;--radius-sm: 9px;--shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px -16px rgba(16, 24, 40, .28);--font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;--mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace}:root[data-theme=dark]{--bg: #0f1216;--bg-1: #141a21;--surface: #171d25;--surface-2: #1d242e;--hover: #232c38;--border: #262e3a;--border-soft: #1f2630;--text: #d7dde5;--muted: #8a94a3;--accent: #6aa3ff;--ok: #4ade80;--warn: #fbbf24;--err: #fb7185;--shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px -16px rgba(0, 0, 0, .65)}*{box-sizing:border-box}html,body,#root{height:100%;margin:0}body{font-family:var(--font);background:var(--bg);color:var(--text);font-size:13px;-webkit-font-smoothing:antialiased}.mono{font-family:var(--mono);font-variant-numeric:tabular-nums}.muted{color:var(--muted)}.small{font-size:11px}.center{text-align:center}.pad{padding:16px}.strong{font-weight:650}.dim{opacity:.5}.app{display:flex;flex-direction:column;height:100%}.body{flex:1;display:flex;min-height:0}.canvas-host{flex:1;min-width:0;position:relative;overflow:auto}.canvas{min-height:100%;padding:6px}.toolbar{display:flex;align-items:center;gap:16px;height:52px;padding:0 16px;background:var(--surface);border-bottom:1px solid var(--border)}.brand{font-weight:650;font-size:15px;letter-spacing:.2px;display:flex;align-items:center;gap:9px}.brand-sub{color:var(--muted);font-weight:500;font-size:12px}.brand-dot{width:9px;height:9px;border-radius:50%;background:var(--accent);box-shadow:0 0 12px var(--accent)}.conn{display:flex;align-items:center;gap:9px}.conn .dot{width:8px;height:8px;border-radius:50%}.dot.on{background:var(--ok);box-shadow:0 0 9px var(--ok)}.dot.off{background:var(--err)}.spacer{flex:1}.actions{display:flex;gap:7px}.badge{font-size:10.5px;padding:2px 8px;border-radius:999px;font-weight:650;border:1px solid transparent;text-transform:uppercase;letter-spacing:.4px}.badge.ok{color:var(--ok);border-color:#4ade8059;background:#4ade801a}.badge.warn{color:var(--warn);border-color:#fbbf2459;background:#fbbf241a}.badge.err{color:var(--err);border-color:#fb718559;background:#fb71851a}.btn{background:var(--surface-2);color:var(--text);border:1px solid var(--border);border-radius:var(--radius-sm);padding:6px 11px;font-size:12px;cursor:pointer;transition:background .15s,border-color .15s,transform .05s}.btn:hover{background:var(--hover);border-color:var(--border)}.btn:active{transform:translateY(1px)}.btn.ghost{background:transparent}.btn.small{padding:3px 9px;font-size:11px}.btn.active{border-color:var(--accent);color:var(--accent)}.btn-icon{color:var(--accent);margin-right:2px}.sidebar{width:236px;flex-shrink:0;background:var(--bg-1);border-right:1px solid var(--border-soft);display:flex;flex-direction:column}.sidebar-head{padding:12px 14px;border-bottom:1px solid var(--border-soft)}.sidebar-title{font-weight:650;margin-bottom:9px}.filter,.type-select,select,input[type=text],input[type=number]{width:100%;background:var(--surface-2);border:1px solid var(--border);color:var(--text);border-radius:var(--radius-sm);padding:6px 9px;font-size:12px;outline:none;transition:border-color .15s,box-shadow .15s}.filter:focus,select:focus,input:focus{border-color:var(--accent);box-shadow:0 0 0 3px #6aa3ff26}.sidebar-body{flex:1;overflow-y:auto;padding:10px}.sidebar-foot{padding:10px 14px;border-top:1px solid var(--border-soft);font-size:11px;line-height:1.55;color:var(--muted)}.motor-group{margin-bottom:14px}.motor-group-title{font-size:11px;text-transform:uppercase;letter-spacing:.6px;color:var(--muted);margin:0 2px 6px}.chips{display:flex;flex-direction:column;gap:5px}.sig-chip{display:flex;align-items:center;gap:8px;padding:6px 9px;background:var(--surface);border:1px solid var(--border-soft);border-radius:var(--radius-sm);cursor:grab;-webkit-user-select:none;user-select:none;font-size:12px;transition:background .12s,border-color .12s}.sig-chip:hover{background:var(--surface-2);border-color:var(--border)}.sig-chip.dragging{opacity:.4}.sig-swatch{width:10px;height:10px;border-radius:3px;border:2px solid;flex-shrink:0}.sig-name{flex:1;font-family:var(--mono)}.sig-unit{color:var(--muted);font-size:10.5px}.drag-ghost{background:var(--accent);color:#05203f;font-weight:650;font-size:12px;padding:6px 11px;border-radius:var(--radius-sm);font-family:var(--mono);box-shadow:0 10px 26px #0000008c}.grid-stack{background:transparent}.grid-stack-item-content{top:0;right:0;bottom:0;left:0;overflow:visible;background:transparent;border:none}.widget{height:100%;display:flex;flex-direction:column;background:var(--surface);border:1px solid var(--border-soft);border-radius:var(--radius);box-shadow:var(--shadow);overflow:hidden}.widget-header{display:flex;align-items:center;gap:8px;height:34px;padding:0 8px 0 10px;flex-shrink:0;border-bottom:1px solid var(--border-soft);background:var(--surface-2);cursor:move}.widget-grip{color:var(--muted);opacity:.5;font-size:12px;letter-spacing:-2px}.widget-icon{color:var(--accent);font-size:12px}.widget-title{flex:1;font-size:12.5px;font-weight:600;letter-spacing:.2px}.widget-close{width:22px;height:22px;border:none;background:transparent;color:var(--muted);border-radius:6px;cursor:pointer;font-size:16px;line-height:1;opacity:0;transition:opacity .12s,background .12s,color .12s}.widget:hover .widget-close{opacity:1}.widget-close:hover{background:#fb718526;color:var(--err)}.widget-body{flex:1;min-height:0;position:relative}.widget-body .panel{height:100%}.grid-stack-item>.ui-resizable-handle{filter:opacity(.45)}.grid-stack-item:hover>.ui-resizable-handle{filter:opacity(.9)}.grid-stack-placeholder>.placeholder-content{border:1px dashed var(--accent);border-radius:var(--radius);background:#6aa3ff0f}.panel{height:100%;display:flex;flex-direction:column;overflow:hidden}.plot-toolbar{display:flex;align-items:center;gap:8px;padding:6px 10px;border-bottom:1px solid var(--border-soft);flex-wrap:wrap}.plot-toolbar select{width:auto}.legend{display:flex;gap:6px;flex-wrap:wrap}.legend-chip{display:inline-flex;align-items:center;gap:5px;font-size:11px;padding:2px 7px 2px 6px;border:1px solid var(--border);border-radius:999px;font-family:var(--mono)}.legend-swatch{width:9px;height:9px;border-radius:2px;border:1.5px solid}.legend-x{background:none;border:none;color:var(--muted);cursor:pointer;font-size:13px;padding:0 0 0 2px}.legend-x:hover{color:var(--err)}.plot-host{flex:1;min-height:0;position:relative;padding:6px}.plot-host.drop-over{outline:2px dashed var(--accent);outline-offset:-5px;background:#6aa3ff0f;border-radius:10px}.drop-hint{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;color:var(--muted);font-size:12px;pointer-events:none;text-align:center;padding:22px}.table-panel{overflow:auto}.motor-table{width:100%;border-collapse:collapse;font-size:12px}.motor-table th,.motor-table td{padding:6px 10px;text-align:right;border-bottom:1px solid var(--border-soft);white-space:nowrap}.motor-table th:first-child,.motor-table td:first-child{text-align:left}.motor-table th{position:sticky;top:0;background:var(--surface-2);color:var(--muted);font-weight:600;font-size:11px;text-transform:uppercase;letter-spacing:.4px}.motor-table tr:hover td{background:var(--hover)}.cmd-col{color:var(--accent)}.status-pill{font-size:10px;padding:2px 8px;border-radius:999px;font-weight:650}.status-pill.ok{color:var(--ok);background:#4ade801f}.status-pill.off{color:var(--muted);background:#8a94a31f}.status-pill.warn{color:var(--warn);background:#fbbf241f}.cards-panel{overflow:auto}.cards-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:11px;padding:12px}.motor-card{background:var(--bg-1);border:1px solid var(--border-soft);border-radius:12px;padding:13px}.motor-card-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:5px}.motor-card-sub{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:11px}.type-select{width:auto;padding:3px 7px;font-size:11px}.metric{margin-bottom:9px}.metric-label{font-size:11px;color:var(--text);margin-bottom:3px}.metric-values{display:flex;align-items:baseline;gap:10px}.metric-act{font-family:var(--mono);font-size:20px;font-weight:650}.metric-cmd{font-family:var(--mono);font-size:12px;color:var(--accent)}.temp-row{display:flex;justify-content:space-between;font-size:11px;color:var(--muted);margin-top:7px;border-top:1px solid var(--border-soft);padding-top:7px}.rawlog-panel{font-size:11.5px}.rawlog-toolbar{display:flex;align-items:center;gap:10px;padding:6px 10px;border-bottom:1px solid var(--border-soft)}.rawlog-body{flex:1;overflow:auto}.rawlog-head,.rawlog-row{display:grid;grid-template-columns:96px 60px 46px 76px minmax(0,1fr) 150px;gap:10px;align-items:center;padding:0 10px}.rawlog-head{position:sticky;top:0;z-index:2;height:26px;background:var(--surface-2);border-bottom:1px solid var(--border-soft);color:var(--muted);font-size:10.5px;text-transform:uppercase;letter-spacing:.4px}.rawlog-row{position:absolute;left:0;right:0;height:22px;line-height:22px;border-bottom:1px solid var(--border-soft)}.rawlog-head>span,.rawlog-row>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.rawlog-row .c-f{color:var(--text)}.rawlog-row.k-command .c-k{color:var(--accent)}.rawlog-row.k-feedback .c-k{color:var(--ok)}.rawlog-row.k-special .c-k{color:var(--warn)}.message,.loading{color:var(--muted);text-align:center;padding:24px} diff --git a/damiao_motor/gui/webapp/dist/assets/index-BV1u67uH.js b/damiao_motor/gui/webapp/dist/assets/index-UZFR7yIJ.js similarity index 64% rename from damiao_motor/gui/webapp/dist/assets/index-BV1u67uH.js rename to damiao_motor/gui/webapp/dist/assets/index-UZFR7yIJ.js index 31e3cdf..9f116cf 100644 --- a/damiao_motor/gui/webapp/dist/assets/index-BV1u67uH.js +++ b/damiao_motor/gui/webapp/dist/assets/index-UZFR7yIJ.js @@ -1,4 +1,4 @@ -var bv=Object.defineProperty;var Ov=(l,t,r)=>t in l?bv(l,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[t]=r;var fo=(l,t,r)=>Ov(l,typeof t!="symbol"?t+"":t,r);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const u of o)if(u.type==="childList")for(const f of u.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&i(f)}).observe(document,{childList:!0,subtree:!0});function r(o){const u={};return o.integrity&&(u.integrity=o.integrity),o.referrerPolicy&&(u.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?u.credentials="include":o.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function i(o){if(o.ep)return;o.ep=!0;const u=r(o);fetch(o.href,u)}})();function kg(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var Zc={exports:{}},ho={},ef={exports:{}},Be={};/** +var Pv=Object.defineProperty;var Av=(l,t,r)=>t in l?Pv(l,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[t]=r;var fo=(l,t,r)=>Av(l,typeof t!="symbol"?t+"":t,r);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const u of o)if(u.type==="childList")for(const c of u.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&i(c)}).observe(document,{childList:!0,subtree:!0});function r(o){const u={};return o.integrity&&(u.integrity=o.integrity),o.referrerPolicy&&(u.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?u.credentials="include":o.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function i(o){if(o.ep)return;o.ep=!0;const u=r(o);fetch(o.href,u)}})();function kg(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var Zc={exports:{}},ho={},ef={exports:{}},Be={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ var bv=Object.defineProperty;var Ov=(l,t,r)=>t in l?bv(l,t,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var rp;function Lv(){if(rp)return Be;rp=1;var l=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),f=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),v=Symbol.iterator;function x(D){return D===null||typeof D!="object"?null:(D=v&&D[v]||D["@@iterator"],typeof D=="function"?D:null)}var z={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},R=Object.assign,k={};function b(D,H,K){this.props=D,this.context=H,this.refs=k,this.updater=K||z}b.prototype.isReactComponent={},b.prototype.setState=function(D,H){if(typeof D!="object"&&typeof D!="function"&&D!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,D,H,"setState")},b.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function B(){}B.prototype=b.prototype;function P(D,H,K){this.props=D,this.context=H,this.refs=k,this.updater=K||z}var W=P.prototype=new B;W.constructor=P,R(W,b.prototype),W.isPureReactComponent=!0;var V=Array.isArray,Z=Object.prototype.hasOwnProperty,G={current:null},ee={key:!0,ref:!0,__self:!0,__source:!0};function re(D,H,K){var xe,be={},ge=null,_e=null;if(H!=null)for(xe in H.ref!==void 0&&(_e=H.ref),H.key!==void 0&&(ge=""+H.key),H)Z.call(H,xe)&&!ee.hasOwnProperty(xe)&&(be[xe]=H[xe]);var He=arguments.length-2;if(He===1)be.children=K;else if(1t in l?bv(l,t,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var sp;function Pv(){if(sp)return ho;sp=1;var l=Hf(),t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,o=l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,u={key:!0,ref:!0,__self:!0,__source:!0};function f(d,p,m){var w,v={},x=null,z=null;m!==void 0&&(x=""+m),p.key!==void 0&&(x=""+p.key),p.ref!==void 0&&(z=p.ref);for(w in p)i.call(p,w)&&!u.hasOwnProperty(w)&&(v[w]=p[w]);if(d&&d.defaultProps)for(w in p=d.defaultProps,p)v[w]===void 0&&(v[w]=p[w]);return{$$typeof:t,type:d,key:x,ref:z,props:v,_owner:o.current}}return ho.Fragment=r,ho.jsx=f,ho.jsxs=f,ho}var lp;function Av(){return lp||(lp=1,Zc.exports=Pv()),Zc.exports}var U=Av(),j=Hf();const ht=kg(j);var Ya={},tf={exports:{}},ir={},nf={exports:{}},rf={};/** + */var sp;function Hv(){if(sp)return ho;sp=1;var l=Hf(),t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,o=l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,u={key:!0,ref:!0,__self:!0,__source:!0};function c(d,p,m){var w,v={},x=null,z=null;m!==void 0&&(x=""+m),p.key!==void 0&&(x=""+p.key),p.ref!==void 0&&(z=p.ref);for(w in p)i.call(p,w)&&!u.hasOwnProperty(w)&&(v[w]=p[w]);if(d&&d.defaultProps)for(w in p=d.defaultProps,p)v[w]===void 0&&(v[w]=p[w]);return{$$typeof:t,type:d,key:x,ref:z,props:v,_owner:o.current}}return ho.Fragment=r,ho.jsx=c,ho.jsxs=c,ho}var lp;function Fv(){return lp||(lp=1,Zc.exports=Hv()),Zc.exports}var B=Fv(),j=Hf();const ht=kg(j);var Ya={},tf={exports:{}},ir={},nf={exports:{}},rf={};/** * @license React * scheduler.production.min.js * @@ -22,7 +22,7 @@ var bv=Object.defineProperty;var Ov=(l,t,r)=>t in l?bv(l,t,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var op;function Iv(){return op||(op=1,(function(l){function t(ie,oe){var X=ie.length;ie.push(oe);e:for(;0>>1,H=ie[D];if(0>>1;Do(be,X))geo(_e,be)?(ie[D]=_e,ie[ge]=X,D=ge):(ie[D]=be,ie[xe]=X,D=xe);else if(geo(_e,X))ie[D]=_e,ie[ge]=X,D=ge;else break e}}return oe}function o(ie,oe){var X=ie.sortIndex-oe.sortIndex;return X!==0?X:ie.id-oe.id}if(typeof performance=="object"&&typeof performance.now=="function"){var u=performance;l.unstable_now=function(){return u.now()}}else{var f=Date,d=f.now();l.unstable_now=function(){return f.now()-d}}var p=[],m=[],w=1,v=null,x=3,z=!1,R=!1,k=!1,b=typeof setTimeout=="function"?setTimeout:null,B=typeof clearTimeout=="function"?clearTimeout:null,P=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function W(ie){for(var oe=r(m);oe!==null;){if(oe.callback===null)i(m);else if(oe.startTime<=ie)i(m),oe.sortIndex=oe.expirationTime,t(p,oe);else break;oe=r(m)}}function V(ie){if(k=!1,W(ie),!R)if(r(p)!==null)R=!0,De(Z);else{var oe=r(m);oe!==null&&le(V,oe.startTime-ie)}}function Z(ie,oe){R=!1,k&&(k=!1,B(re),re=-1),z=!0;var X=x;try{for(W(oe),v=r(p);v!==null&&(!(v.expirationTime>oe)||ie&&!Y());){var D=v.callback;if(typeof D=="function"){v.callback=null,x=v.priorityLevel;var H=D(v.expirationTime<=oe);oe=l.unstable_now(),typeof H=="function"?v.callback=H:v===r(p)&&i(p),W(oe)}else i(p);v=r(p)}if(v!==null)var K=!0;else{var xe=r(m);xe!==null&&le(V,xe.startTime-oe),K=!1}return K}finally{v=null,x=X,z=!1}}var G=!1,ee=null,re=-1,ve=5,de=-1;function Y(){return!(l.unstable_now()-deie||125D?(ie.sortIndex=X,t(m,ie),r(p)===null&&ie===r(m)&&(k?(B(re),re=-1):k=!0,le(V,X-D))):(ie.sortIndex=H,t(p,ie),R||z||(R=!0,De(Z))),ie},l.unstable_shouldYield=Y,l.unstable_wrapCallback=function(ie){var oe=x;return function(){var X=x;x=oe;try{return ie.apply(this,arguments)}finally{x=X}}}})(rf)),rf}var ap;function Hv(){return ap||(ap=1,nf.exports=Iv()),nf.exports}/** + */var op;function jv(){return op||(op=1,(function(l){function t(ie,oe){var X=ie.length;ie.push(oe);e:for(;0>>1,H=ie[D];if(0>>1;Do(be,X))geo(_e,be)?(ie[D]=_e,ie[ge]=X,D=ge):(ie[D]=be,ie[xe]=X,D=xe);else if(geo(_e,X))ie[D]=_e,ie[ge]=X,D=ge;else break e}}return oe}function o(ie,oe){var X=ie.sortIndex-oe.sortIndex;return X!==0?X:ie.id-oe.id}if(typeof performance=="object"&&typeof performance.now=="function"){var u=performance;l.unstable_now=function(){return u.now()}}else{var c=Date,d=c.now();l.unstable_now=function(){return c.now()-d}}var p=[],m=[],w=1,v=null,x=3,z=!1,R=!1,k=!1,b=typeof setTimeout=="function"?setTimeout:null,U=typeof clearTimeout=="function"?clearTimeout:null,P=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function W(ie){for(var oe=r(m);oe!==null;){if(oe.callback===null)i(m);else if(oe.startTime<=ie)i(m),oe.sortIndex=oe.expirationTime,t(p,oe);else break;oe=r(m)}}function V(ie){if(k=!1,W(ie),!R)if(r(p)!==null)R=!0,De(Z);else{var oe=r(m);oe!==null&&le(V,oe.startTime-ie)}}function Z(ie,oe){R=!1,k&&(k=!1,U(re),re=-1),z=!0;var X=x;try{for(W(oe),v=r(p);v!==null&&(!(v.expirationTime>oe)||ie&&!Y());){var D=v.callback;if(typeof D=="function"){v.callback=null,x=v.priorityLevel;var H=D(v.expirationTime<=oe);oe=l.unstable_now(),typeof H=="function"?v.callback=H:v===r(p)&&i(p),W(oe)}else i(p);v=r(p)}if(v!==null)var K=!0;else{var xe=r(m);xe!==null&&le(V,xe.startTime-oe),K=!1}return K}finally{v=null,x=X,z=!1}}var G=!1,ee=null,re=-1,ve=5,de=-1;function Y(){return!(l.unstable_now()-deie||125D?(ie.sortIndex=X,t(m,ie),r(p)===null&&ie===r(m)&&(k?(U(re),re=-1):k=!0,le(V,X-D))):(ie.sortIndex=H,t(p,ie),R||z||(R=!0,De(Z))),ie},l.unstable_shouldYield=Y,l.unstable_wrapCallback=function(ie){var oe=x;return function(){var X=x;x=oe;try{return ie.apply(this,arguments)}finally{x=X}}}})(rf)),rf}var ap;function Wv(){return ap||(ap=1,nf.exports=jv()),nf.exports}/** * @license React * react-dom.production.min.js * @@ -30,25 +30,25 @@ var bv=Object.defineProperty;var Ov=(l,t,r)=>t in l?bv(l,t,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var up;function Fv(){if(up)return ir;up=1;var l=Hf(),t=Hv();function r(e){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+e,s=1;s"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),p=Object.prototype.hasOwnProperty,m=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,w={},v={};function x(e){return p.call(v,e)?!0:p.call(w,e)?!1:m.test(e)?v[e]=!0:(w[e]=!0,!1)}function z(e,n,s,a){if(s!==null&&s.type===0)return!1;switch(typeof n){case"function":case"symbol":return!0;case"boolean":return a?!1:s!==null?!s.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function R(e,n,s,a){if(n===null||typeof n>"u"||z(e,n,s,a))return!0;if(a)return!1;if(s!==null)switch(s.type){case 3:return!n;case 4:return n===!1;case 5:return isNaN(n);case 6:return isNaN(n)||1>n}return!1}function k(e,n,s,a,c,h,y){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=a,this.attributeNamespace=c,this.mustUseProperty=s,this.propertyName=e,this.type=n,this.sanitizeURL=h,this.removeEmptyString=y}var b={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){b[e]=new k(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var n=e[0];b[n]=new k(n,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){b[e]=new k(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){b[e]=new k(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){b[e]=new k(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){b[e]=new k(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){b[e]=new k(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){b[e]=new k(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){b[e]=new k(e,5,!1,e.toLowerCase(),null,!1,!1)});var B=/[\-:]([a-z])/g;function P(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var n=e.replace(B,P);b[n]=new k(n,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var n=e.replace(B,P);b[n]=new k(n,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var n=e.replace(B,P);b[n]=new k(n,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){b[e]=new k(e,1,!1,e.toLowerCase(),null,!1,!1)}),b.xlinkHref=new k("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){b[e]=new k(e,1,!1,e.toLowerCase(),null,!0,!0)});function W(e,n,s,a){var c=b.hasOwnProperty(n)?b[n]:null;(c!==null?c.type!==0:a||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),p=Object.prototype.hasOwnProperty,m=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,w={},v={};function x(e){return p.call(v,e)?!0:p.call(w,e)?!1:m.test(e)?v[e]=!0:(w[e]=!0,!1)}function z(e,n,s,a){if(s!==null&&s.type===0)return!1;switch(typeof n){case"function":case"symbol":return!0;case"boolean":return a?!1:s!==null?!s.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function R(e,n,s,a){if(n===null||typeof n>"u"||z(e,n,s,a))return!0;if(a)return!1;if(s!==null)switch(s.type){case 3:return!n;case 4:return n===!1;case 5:return isNaN(n);case 6:return isNaN(n)||1>n}return!1}function k(e,n,s,a,f,h,y){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=a,this.attributeNamespace=f,this.mustUseProperty=s,this.propertyName=e,this.type=n,this.sanitizeURL=h,this.removeEmptyString=y}var b={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){b[e]=new k(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var n=e[0];b[n]=new k(n,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){b[e]=new k(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){b[e]=new k(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){b[e]=new k(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){b[e]=new k(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){b[e]=new k(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){b[e]=new k(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){b[e]=new k(e,5,!1,e.toLowerCase(),null,!1,!1)});var U=/[\-:]([a-z])/g;function P(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var n=e.replace(U,P);b[n]=new k(n,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var n=e.replace(U,P);b[n]=new k(n,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var n=e.replace(U,P);b[n]=new k(n,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){b[e]=new k(e,1,!1,e.toLowerCase(),null,!1,!1)}),b.xlinkHref=new k("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){b[e]=new k(e,1,!1,e.toLowerCase(),null,!0,!0)});function W(e,n,s,a){var f=b.hasOwnProperty(n)?b[n]:null;(f!==null?f.type!==0:a||!(2C||c[y]!==h[C]){var N=` -`+c[y].replace(" at new "," at ");return e.displayName&&N.includes("")&&(N=N.replace("",e.displayName)),N}while(1<=y&&0<=C);break}}}finally{K=!1,Error.prepareStackTrace=s}return(e=e?e.displayName||e.name:"")?H(e):""}function be(e){switch(e.tag){case 5:return H(e.type);case 16:return H("Lazy");case 13:return H("Suspense");case 19:return H("SuspenseList");case 0:case 2:case 15:return e=xe(e.type,!1),e;case 11:return e=xe(e.type.render,!1),e;case 1:return e=xe(e.type,!0),e;default:return""}}function ge(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ee:return"Fragment";case G:return"Portal";case ve:return"Profiler";case re:return"StrictMode";case ae:return"Suspense";case ye:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Y:return(e.displayName||"Context")+".Consumer";case de:return(e._context.displayName||"Context")+".Provider";case Ce:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case me:return n=e.displayName||null,n!==null?n:ge(e.type)||"Memo";case De:n=e._payload,e=e._init;try{return ge(e(n))}catch{}}return null}function _e(e){var n=e.type;switch(e.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=n.render,e=e.displayName||e.name||"",n.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ge(n);case 8:return n===re?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function He(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Fe(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Oe(e){var n=Fe(e)?"checked":"value",s=Object.getOwnPropertyDescriptor(e.constructor.prototype,n),a=""+e[n];if(!e.hasOwnProperty(n)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var c=s.get,h=s.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return c.call(this)},set:function(y){a=""+y,h.call(this,y)}}),Object.defineProperty(e,n,{enumerable:s.enumerable}),{getValue:function(){return a},setValue:function(y){a=""+y},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function $t(e){e._valueTracker||(e._valueTracker=Oe(e))}function Pt(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var s=n.getValue(),a="";return e&&(a=Fe(e)?e.checked?"true":"false":e.value),e=a,e!==s?(n.setValue(e),!0):!1}function At(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function It(e,n){var s=n.checked;return X({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:s??e._wrapperState.initialChecked})}function Kn(e,n){var s=n.defaultValue==null?"":n.defaultValue,a=n.checked!=null?n.checked:n.defaultChecked;s=He(n.value!=null?n.value:s),e._wrapperState={initialChecked:a,initialValue:s,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function Cn(e,n){n=n.checked,n!=null&&W(e,"checked",n,!1)}function _r(e,n){Cn(e,n);var s=He(n.value),a=n.type;if(s!=null)a==="number"?(s===0&&e.value===""||e.value!=s)&&(e.value=""+s):e.value!==""+s&&(e.value=""+s);else if(a==="submit"||a==="reset"){e.removeAttribute("value");return}n.hasOwnProperty("value")?Pn(e,n.type,s):n.hasOwnProperty("defaultValue")&&Pn(e,n.type,He(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(e.defaultChecked=!!n.defaultChecked)}function Xr(e,n,s){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var a=n.type;if(!(a!=="submit"&&a!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+e._wrapperState.initialValue,s||n===e.value||(e.value=n),e.defaultValue=n}s=e.name,s!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,s!==""&&(e.name=s)}function Pn(e,n,s){(n!=="number"||At(e.ownerDocument)!==e)&&(s==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+s&&(e.defaultValue=""+s))}var Ze=Array.isArray;function nn(e,n,s,a){if(e=e.options,n){n={};for(var c=0;c"+n.valueOf().toString()+"",n=sn.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;n.firstChild;)e.appendChild(n.firstChild)}});function Gt(e,n){if(n){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=n;return}}e.textContent=n}var Rt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ln=["Webkit","ms","Moz","O"];Object.keys(Rt).forEach(function(e){ln.forEach(function(n){n=n+e.charAt(0).toUpperCase()+e.substring(1),Rt[n]=Rt[e]})});function mn(e,n,s){return n==null||typeof n=="boolean"||n===""?"":s||typeof n!="number"||n===0||Rt.hasOwnProperty(e)&&Rt[e]?(""+n).trim():n+"px"}function Yt(e,n){e=e.style;for(var s in n)if(n.hasOwnProperty(s)){var a=s.indexOf("--")===0,c=mn(s,n[s],a);s==="float"&&(s="cssFloat"),a?e.setProperty(s,c):e[s]=c}}var vn=X({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function qr(e,n){if(n){if(vn[e]&&(n.children!=null||n.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(n.dangerouslySetInnerHTML!=null){if(n.children!=null)throw Error(r(60));if(typeof n.dangerouslySetInnerHTML!="object"||!("__html"in n.dangerouslySetInnerHTML))throw Error(r(61))}if(n.style!=null&&typeof n.style!="object")throw Error(r(62))}}function Jr(e,n){if(e.indexOf("-")===-1)return typeof n.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var lr=null;function or(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Zr=null,zt=null,lt=null;function Kt(e){if(e=Xl(e)){if(typeof Zr!="function")throw Error(r(280));var n=e.stateNode;n&&(n=aa(n),Zr(e.stateNode,e.type,n))}}function on(e){zt?lt?lt.push(e):lt=[e]:zt=e}function ar(){if(zt){var e=zt,n=lt;if(lt=zt=null,Kt(e),n)for(e=0;e>>=0,e===0?32:31-(Ll(e)/Nn|0)|0}var os=64,Ti=4194304;function zi(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Fs(e,n){var s=e.pendingLanes;if(s===0)return 0;var a=0,c=e.suspendedLanes,h=e.pingedLanes,y=s&268435455;if(y!==0){var C=y&~c;C!==0?a=zi(C):(h&=y,h!==0&&(a=zi(h)))}else y=s&~c,y!==0?a=zi(y):h!==0&&(a=zi(h));if(a===0)return 0;if(n!==0&&n!==a&&(n&c)===0&&(c=a&-a,h=n&-n,c>=h||c===16&&(h&4194240)!==0))return n;if((a&4)!==0&&(a|=s&16),n=e.entangledLanes,n!==0)for(e=e.entanglements,n&=a;0s;s++)n.push(e);return n}function Mi(e,n,s){e.pendingLanes|=n,n!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,n=31-In(n),e[n]=s}function Il(e,n){var s=e.pendingLanes&~n;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=n,e.mutableReadLanes&=n,e.entangledLanes&=n,n=e.entanglements;var a=e.eventTimes;for(e=e.expirationTimes;0=pi),ta=" ",Qs=!1;function g(e,n){switch(e){case"keyup":return Dt.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function S(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var _=!1;function E(e,n){switch(e){case"compositionend":return S(n);case"keypress":return n.which!==32?null:(Qs=!0,ta);case"textInput":return e=n.data,e===ta&&Qs?null:e;default:return null}}function T(e,n){if(_)return e==="compositionend"||!Ks&&g(e,n)?(e=dr(),fr=Wl=cr=null,_=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1=n)return{node:s,offset:n-e};e=a}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=Jn(s)}}function Tn(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Tn(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Wn(){for(var e=window,n=At();n instanceof e.HTMLIFrameElement;){try{var s=typeof n.contentWindow.location.href=="string"}catch{s=!1}if(s)e=n.contentWindow;else break;n=At(e.document)}return n}function Bn(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}function Nr(e){var n=Wn(),s=e.focusedElem,a=e.selectionRange;if(n!==s&&s&&s.ownerDocument&&Tn(s.ownerDocument.documentElement,s)){if(a!==null&&Bn(s)){if(n=a.start,e=a.end,e===void 0&&(e=n),"selectionStart"in s)s.selectionStart=n,s.selectionEnd=Math.min(e,s.value.length);else if(e=(n=s.ownerDocument||document)&&n.defaultView||window,e.getSelection){e=e.getSelection();var c=s.textContent.length,h=Math.min(a.start,c);a=a.end===void 0?h:Math.min(a.end,c),!e.extend&&h>a&&(c=a,a=h,h=c),c=pr(s,h);var y=pr(s,a);c&&y&&(e.rangeCount!==1||e.anchorNode!==c.node||e.anchorOffset!==c.offset||e.focusNode!==y.node||e.focusOffset!==y.offset)&&(n=n.createRange(),n.setStart(c.node,c.offset),e.removeAllRanges(),h>a?(e.addRange(n),e.extend(y.node,y.offset)):(n.setEnd(y.node,y.offset),e.addRange(n)))}}for(n=[],e=s;e=e.parentNode;)e.nodeType===1&&n.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s=document.documentMode,Bt=null,Fr=null,Ot=null,Xs=!1;function cd(e,n,s){var a=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;Xs||Bt==null||Bt!==At(a)||(a=Bt,"selectionStart"in a&&Bn(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),Ot&&cn(Ot,a)||(Ot=a,a=sa(Fr,"onSelect"),0tl||(e.current=Xu[tl],Xu[tl]=null,tl--)}function dt(e,n){tl++,Xu[tl]=e.current,e.current=n}var $i={},zn=Vi($i),Zn=Vi(!1),ys=$i;function nl(e,n){var s=e.type.contextTypes;if(!s)return $i;var a=e.stateNode;if(a&&a.__reactInternalMemoizedUnmaskedChildContext===n)return a.__reactInternalMemoizedMaskedChildContext;var c={},h;for(h in s)c[h]=n[h];return a&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=n,e.__reactInternalMemoizedMaskedChildContext=c),c}function er(e){return e=e.childContextTypes,e!=null}function ua(){gt(Zn),gt(zn)}function kd(e,n,s){if(zn.current!==$i)throw Error(r(168));dt(zn,n),dt(Zn,s)}function Rd(e,n,s){var a=e.stateNode;if(n=n.childContextTypes,typeof a.getChildContext!="function")return s;a=a.getChildContext();for(var c in a)if(!(c in n))throw Error(r(108,_e(e)||"Unknown",c));return X({},s,a)}function ca(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||$i,ys=zn.current,dt(zn,e),dt(Zn,Zn.current),!0}function Nd(e,n,s){var a=e.stateNode;if(!a)throw Error(r(169));s?(e=Rd(e,n,ys),a.__reactInternalMemoizedMergedChildContext=e,gt(Zn),gt(zn),dt(zn,e)):gt(Zn),dt(Zn,s)}var mi=null,fa=!1,qu=!1;function Dd(e){mi===null?mi=[e]:mi.push(e)}function qm(e){fa=!0,Dd(e)}function Gi(){if(!qu&&mi!==null){qu=!0;var e=0,n=$e;try{var s=mi;for($e=1;e>=y,c-=y,vi=1<<32-In(n)+c|s<Ie?(hn=Me,Me=null):hn=Me.sibling;var Qe=Q(O,Me,I[Ie],se);if(Qe===null){Me===null&&(Me=hn);break}e&&Me&&Qe.alternate===null&&n(O,Me),M=h(Qe,M,Ie),ze===null?Re=Qe:ze.sibling=Qe,ze=Qe,Me=hn}if(Ie===I.length)return s(O,Me),St&&Ss(O,Ie),Re;if(Me===null){for(;IeIe?(hn=Me,Me=null):hn=Me.sibling;var ts=Q(O,Me,Qe.value,se);if(ts===null){Me===null&&(Me=hn);break}e&&Me&&ts.alternate===null&&n(O,Me),M=h(ts,M,Ie),ze===null?Re=ts:ze.sibling=ts,ze=ts,Me=hn}if(Qe.done)return s(O,Me),St&&Ss(O,Ie),Re;if(Me===null){for(;!Qe.done;Ie++,Qe=I.next())Qe=te(O,Qe.value,se),Qe!==null&&(M=h(Qe,M,Ie),ze===null?Re=Qe:ze.sibling=Qe,ze=Qe);return St&&Ss(O,Ie),Re}for(Me=a(O,Me);!Qe.done;Ie++,Qe=I.next())Qe=pe(Me,O,Ie,Qe.value,se),Qe!==null&&(e&&Qe.alternate!==null&&Me.delete(Qe.key===null?Ie:Qe.key),M=h(Qe,M,Ie),ze===null?Re=Qe:ze.sibling=Qe,ze=Qe);return e&&Me.forEach(function(Mv){return n(O,Mv)}),St&&Ss(O,Ie),Re}function Lt(O,M,I,se){if(typeof I=="object"&&I!==null&&I.type===ee&&I.key===null&&(I=I.props.children),typeof I=="object"&&I!==null){switch(I.$$typeof){case Z:e:{for(var Re=I.key,ze=M;ze!==null;){if(ze.key===Re){if(Re=I.type,Re===ee){if(ze.tag===7){s(O,ze.sibling),M=c(ze,I.props.children),M.return=O,O=M;break e}}else if(ze.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===De&&Ld(Re)===ze.type){s(O,ze.sibling),M=c(ze,I.props),M.ref=ql(O,ze,I),M.return=O,O=M;break e}s(O,ze);break}else n(O,ze);ze=ze.sibling}I.type===ee?(M=Ds(I.props.children,O.mode,se,I.key),M.return=O,O=M):(se=Fa(I.type,I.key,I.props,null,O.mode,se),se.ref=ql(O,M,I),se.return=O,O=se)}return y(O);case G:e:{for(ze=I.key;M!==null;){if(M.key===ze)if(M.tag===4&&M.stateNode.containerInfo===I.containerInfo&&M.stateNode.implementation===I.implementation){s(O,M.sibling),M=c(M,I.children||[]),M.return=O,O=M;break e}else{s(O,M);break}else n(O,M);M=M.sibling}M=Kc(I,O.mode,se),M.return=O,O=M}return y(O);case De:return ze=I._init,Lt(O,M,ze(I._payload),se)}if(Ze(I))return Se(O,M,I,se);if(oe(I))return Ee(O,M,I,se);ga(O,I)}return typeof I=="string"&&I!==""||typeof I=="number"?(I=""+I,M!==null&&M.tag===6?(s(O,M.sibling),M=c(M,I),M.return=O,O=M):(s(O,M),M=Yc(I,O.mode,se),M.return=O,O=M),y(O)):s(O,M)}return Lt}var ll=Pd(!0),Ad=Pd(!1),ma=Vi(null),va=null,ol=null,rc=null;function ic(){rc=ol=va=null}function sc(e){var n=ma.current;gt(ma),e._currentValue=n}function lc(e,n,s){for(;e!==null;){var a=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,a!==null&&(a.childLanes|=n)):a!==null&&(a.childLanes&n)!==n&&(a.childLanes|=n),e===s)break;e=e.return}}function al(e,n){va=e,rc=ol=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&n)!==0&&(tr=!0),e.firstContext=null)}function zr(e){var n=e._currentValue;if(rc!==e)if(e={context:e,memoizedValue:n,next:null},ol===null){if(va===null)throw Error(r(308));ol=e,va.dependencies={lanes:0,firstContext:e}}else ol=ol.next=e;return n}var xs=null;function oc(e){xs===null?xs=[e]:xs.push(e)}function Id(e,n,s,a){var c=n.interleaved;return c===null?(s.next=s,oc(n)):(s.next=c.next,c.next=s),n.interleaved=s,wi(e,a)}function wi(e,n){e.lanes|=n;var s=e.alternate;for(s!==null&&(s.lanes|=n),s=e,e=e.return;e!==null;)e.childLanes|=n,s=e.alternate,s!==null&&(s.childLanes|=n),s=e,e=e.return;return s.tag===3?s.stateNode:null}var Yi=!1;function ac(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Hd(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Si(e,n){return{eventTime:e,lane:n,tag:0,payload:null,callback:null,next:null}}function Ki(e,n,s){var a=e.updateQueue;if(a===null)return null;if(a=a.shared,(Ye&2)!==0){var c=a.pending;return c===null?n.next=n:(n.next=c.next,c.next=n),a.pending=n,wi(e,s)}return c=a.interleaved,c===null?(n.next=n,oc(a)):(n.next=c.next,c.next=n),a.interleaved=n,wi(e,s)}function ya(e,n,s){if(n=n.updateQueue,n!==null&&(n=n.shared,(s&4194240)!==0)){var a=n.lanes;a&=e.pendingLanes,s|=a,n.lanes=s,bi(e,s)}}function Fd(e,n){var s=e.updateQueue,a=e.alternate;if(a!==null&&(a=a.updateQueue,s===a)){var c=null,h=null;if(s=s.firstBaseUpdate,s!==null){do{var y={eventTime:s.eventTime,lane:s.lane,tag:s.tag,payload:s.payload,callback:s.callback,next:null};h===null?c=h=y:h=h.next=y,s=s.next}while(s!==null);h===null?c=h=n:h=h.next=n}else c=h=n;s={baseState:a.baseState,firstBaseUpdate:c,lastBaseUpdate:h,shared:a.shared,effects:a.effects},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=n:e.next=n,s.lastBaseUpdate=n}function wa(e,n,s,a){var c=e.updateQueue;Yi=!1;var h=c.firstBaseUpdate,y=c.lastBaseUpdate,C=c.shared.pending;if(C!==null){c.shared.pending=null;var N=C,F=N.next;N.next=null,y===null?h=F:y.next=F,y=N;var J=e.alternate;J!==null&&(J=J.updateQueue,C=J.lastBaseUpdate,C!==y&&(C===null?J.firstBaseUpdate=F:C.next=F,J.lastBaseUpdate=N))}if(h!==null){var te=c.baseState;y=0,J=F=N=null,C=h;do{var Q=C.lane,pe=C.eventTime;if((a&Q)===Q){J!==null&&(J=J.next={eventTime:pe,lane:0,tag:C.tag,payload:C.payload,callback:C.callback,next:null});e:{var Se=e,Ee=C;switch(Q=n,pe=s,Ee.tag){case 1:if(Se=Ee.payload,typeof Se=="function"){te=Se.call(pe,te,Q);break e}te=Se;break e;case 3:Se.flags=Se.flags&-65537|128;case 0:if(Se=Ee.payload,Q=typeof Se=="function"?Se.call(pe,te,Q):Se,Q==null)break e;te=X({},te,Q);break e;case 2:Yi=!0}}C.callback!==null&&C.lane!==0&&(e.flags|=64,Q=c.effects,Q===null?c.effects=[C]:Q.push(C))}else pe={eventTime:pe,lane:Q,tag:C.tag,payload:C.payload,callback:C.callback,next:null},J===null?(F=J=pe,N=te):J=J.next=pe,y|=Q;if(C=C.next,C===null){if(C=c.shared.pending,C===null)break;Q=C,C=Q.next,Q.next=null,c.lastBaseUpdate=Q,c.shared.pending=null}}while(!0);if(J===null&&(N=te),c.baseState=N,c.firstBaseUpdate=F,c.lastBaseUpdate=J,n=c.shared.interleaved,n!==null){c=n;do y|=c.lane,c=c.next;while(c!==n)}else h===null&&(c.shared.lanes=0);Cs|=y,e.lanes=y,e.memoizedState=te}}function jd(e,n,s){if(e=n.effects,n.effects=null,e!==null)for(n=0;ns?s:4,e(!0);var a=hc.transition;hc.transition={};try{e(!1),n()}finally{$e=s,hc.transition=a}}function sh(){return Mr().memoizedState}function tv(e,n,s){var a=Ji(e);if(s={lane:a,action:s,hasEagerState:!1,eagerState:null,next:null},lh(e))oh(n,s);else if(s=Id(e,n,s,a),s!==null){var c=Vn();Vr(s,e,a,c),ah(s,n,a)}}function nv(e,n,s){var a=Ji(e),c={lane:a,action:s,hasEagerState:!1,eagerState:null,next:null};if(lh(e))oh(n,c);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var y=n.lastRenderedState,C=h(y,s);if(c.hasEagerState=!0,c.eagerState=C,at(C,y)){var N=n.interleaved;N===null?(c.next=c,oc(n)):(c.next=N.next,N.next=c),n.interleaved=c;return}}catch{}finally{}s=Id(e,n,c,a),s!==null&&(c=Vn(),Vr(s,e,a,c),ah(s,n,a))}}function lh(e){var n=e.alternate;return e===kt||n!==null&&n===kt}function oh(e,n){to=_a=!0;var s=e.pending;s===null?n.next=n:(n.next=s.next,s.next=n),e.pending=n}function ah(e,n,s){if((s&4194240)!==0){var a=n.lanes;a&=e.pendingLanes,s|=a,n.lanes=s,bi(e,s)}}var ka={readContext:zr,useCallback:Mn,useContext:Mn,useEffect:Mn,useImperativeHandle:Mn,useInsertionEffect:Mn,useLayoutEffect:Mn,useMemo:Mn,useReducer:Mn,useRef:Mn,useState:Mn,useDebugValue:Mn,useDeferredValue:Mn,useTransition:Mn,useMutableSource:Mn,useSyncExternalStore:Mn,useId:Mn,unstable_isNewReconciler:!1},rv={readContext:zr,useCallback:function(e,n){return si().memoizedState=[e,n===void 0?null:n],e},useContext:zr,useEffect:qd,useImperativeHandle:function(e,n,s){return s=s!=null?s.concat([e]):null,Ea(4194308,4,eh.bind(null,n,e),s)},useLayoutEffect:function(e,n){return Ea(4194308,4,e,n)},useInsertionEffect:function(e,n){return Ea(4,2,e,n)},useMemo:function(e,n){var s=si();return n=n===void 0?null:n,e=e(),s.memoizedState=[e,n],e},useReducer:function(e,n,s){var a=si();return n=s!==void 0?s(n):n,a.memoizedState=a.baseState=n,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:n},a.queue=e,e=e.dispatch=tv.bind(null,kt,e),[a.memoizedState,e]},useRef:function(e){var n=si();return e={current:e},n.memoizedState=e},useState:Qd,useDebugValue:Sc,useDeferredValue:function(e){return si().memoizedState=e},useTransition:function(){var e=Qd(!1),n=e[0];return e=ev.bind(null,e[1]),si().memoizedState=e,[n,e]},useMutableSource:function(){},useSyncExternalStore:function(e,n,s){var a=kt,c=si();if(St){if(s===void 0)throw Error(r(407));s=s()}else{if(s=n(),dn===null)throw Error(r(349));(Es&30)!==0||Vd(a,n,s)}c.memoizedState=s;var h={value:s,getSnapshot:n};return c.queue=h,qd(Gd.bind(null,a,h,e),[e]),a.flags|=2048,io(9,$d.bind(null,a,h,s,n),void 0,null),s},useId:function(){var e=si(),n=dn.identifierPrefix;if(St){var s=yi,a=vi;s=(a&~(1<<32-In(a)-1)).toString(32)+s,n=":"+n+"R"+s,s=no++,0C||f[y]!==h[C]){var N=` +`+f[y].replace(" at new "," at ");return e.displayName&&N.includes("")&&(N=N.replace("",e.displayName)),N}while(1<=y&&0<=C);break}}}finally{K=!1,Error.prepareStackTrace=s}return(e=e?e.displayName||e.name:"")?H(e):""}function be(e){switch(e.tag){case 5:return H(e.type);case 16:return H("Lazy");case 13:return H("Suspense");case 19:return H("SuspenseList");case 0:case 2:case 15:return e=xe(e.type,!1),e;case 11:return e=xe(e.type.render,!1),e;case 1:return e=xe(e.type,!0),e;default:return""}}function ge(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ee:return"Fragment";case G:return"Portal";case ve:return"Profiler";case re:return"StrictMode";case ae:return"Suspense";case ye:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Y:return(e.displayName||"Context")+".Consumer";case de:return(e._context.displayName||"Context")+".Provider";case Ce:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case me:return n=e.displayName||null,n!==null?n:ge(e.type)||"Memo";case De:n=e._payload,e=e._init;try{return ge(e(n))}catch{}}return null}function _e(e){var n=e.type;switch(e.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=n.render,e=e.displayName||e.name||"",n.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ge(n);case 8:return n===re?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function He(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Fe(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Oe(e){var n=Fe(e)?"checked":"value",s=Object.getOwnPropertyDescriptor(e.constructor.prototype,n),a=""+e[n];if(!e.hasOwnProperty(n)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var f=s.get,h=s.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return f.call(this)},set:function(y){a=""+y,h.call(this,y)}}),Object.defineProperty(e,n,{enumerable:s.enumerable}),{getValue:function(){return a},setValue:function(y){a=""+y},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function $t(e){e._valueTracker||(e._valueTracker=Oe(e))}function Pt(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var s=n.getValue(),a="";return e&&(a=Fe(e)?e.checked?"true":"false":e.value),e=a,e!==s?(n.setValue(e),!0):!1}function At(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function It(e,n){var s=n.checked;return X({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:s??e._wrapperState.initialChecked})}function Kn(e,n){var s=n.defaultValue==null?"":n.defaultValue,a=n.checked!=null?n.checked:n.defaultChecked;s=He(n.value!=null?n.value:s),e._wrapperState={initialChecked:a,initialValue:s,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function Cn(e,n){n=n.checked,n!=null&&W(e,"checked",n,!1)}function _r(e,n){Cn(e,n);var s=He(n.value),a=n.type;if(s!=null)a==="number"?(s===0&&e.value===""||e.value!=s)&&(e.value=""+s):e.value!==""+s&&(e.value=""+s);else if(a==="submit"||a==="reset"){e.removeAttribute("value");return}n.hasOwnProperty("value")?Pn(e,n.type,s):n.hasOwnProperty("defaultValue")&&Pn(e,n.type,He(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(e.defaultChecked=!!n.defaultChecked)}function Xr(e,n,s){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var a=n.type;if(!(a!=="submit"&&a!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+e._wrapperState.initialValue,s||n===e.value||(e.value=n),e.defaultValue=n}s=e.name,s!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,s!==""&&(e.name=s)}function Pn(e,n,s){(n!=="number"||At(e.ownerDocument)!==e)&&(s==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+s&&(e.defaultValue=""+s))}var Ze=Array.isArray;function nn(e,n,s,a){if(e=e.options,n){n={};for(var f=0;f"+n.valueOf().toString()+"",n=sn.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;n.firstChild;)e.appendChild(n.firstChild)}});function Gt(e,n){if(n){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=n;return}}e.textContent=n}var Rt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ln=["Webkit","ms","Moz","O"];Object.keys(Rt).forEach(function(e){ln.forEach(function(n){n=n+e.charAt(0).toUpperCase()+e.substring(1),Rt[n]=Rt[e]})});function mn(e,n,s){return n==null||typeof n=="boolean"||n===""?"":s||typeof n!="number"||n===0||Rt.hasOwnProperty(e)&&Rt[e]?(""+n).trim():n+"px"}function Yt(e,n){e=e.style;for(var s in n)if(n.hasOwnProperty(s)){var a=s.indexOf("--")===0,f=mn(s,n[s],a);s==="float"&&(s="cssFloat"),a?e.setProperty(s,f):e[s]=f}}var vn=X({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function qr(e,n){if(n){if(vn[e]&&(n.children!=null||n.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(n.dangerouslySetInnerHTML!=null){if(n.children!=null)throw Error(r(60));if(typeof n.dangerouslySetInnerHTML!="object"||!("__html"in n.dangerouslySetInnerHTML))throw Error(r(61))}if(n.style!=null&&typeof n.style!="object")throw Error(r(62))}}function Jr(e,n){if(e.indexOf("-")===-1)return typeof n.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var lr=null;function or(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Zr=null,zt=null,lt=null;function Kt(e){if(e=Xl(e)){if(typeof Zr!="function")throw Error(r(280));var n=e.stateNode;n&&(n=aa(n),Zr(e.stateNode,e.type,n))}}function on(e){zt?lt?lt.push(e):lt=[e]:zt=e}function ar(){if(zt){var e=zt,n=lt;if(lt=zt=null,Kt(e),n)for(e=0;e>>=0,e===0?32:31-(Ll(e)/Nn|0)|0}var os=64,Ti=4194304;function zi(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Fs(e,n){var s=e.pendingLanes;if(s===0)return 0;var a=0,f=e.suspendedLanes,h=e.pingedLanes,y=s&268435455;if(y!==0){var C=y&~f;C!==0?a=zi(C):(h&=y,h!==0&&(a=zi(h)))}else y=s&~f,y!==0?a=zi(y):h!==0&&(a=zi(h));if(a===0)return 0;if(n!==0&&n!==a&&(n&f)===0&&(f=a&-a,h=n&-n,f>=h||f===16&&(h&4194240)!==0))return n;if((a&4)!==0&&(a|=s&16),n=e.entangledLanes,n!==0)for(e=e.entanglements,n&=a;0s;s++)n.push(e);return n}function Mi(e,n,s){e.pendingLanes|=n,n!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,n=31-In(n),e[n]=s}function Il(e,n){var s=e.pendingLanes&~n;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=n,e.mutableReadLanes&=n,e.entangledLanes&=n,n=e.entanglements;var a=e.eventTimes;for(e=e.expirationTimes;0=pi),ta=" ",Qs=!1;function g(e,n){switch(e){case"keyup":return Dt.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function S(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var _=!1;function E(e,n){switch(e){case"compositionend":return S(n);case"keypress":return n.which!==32?null:(Qs=!0,ta);case"textInput":return e=n.data,e===ta&&Qs?null:e;default:return null}}function T(e,n){if(_)return e==="compositionend"||!Ks&&g(e,n)?(e=dr(),fr=Wl=cr=null,_=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1=n)return{node:s,offset:n-e};e=a}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=Jn(s)}}function Tn(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Tn(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Wn(){for(var e=window,n=At();n instanceof e.HTMLIFrameElement;){try{var s=typeof n.contentWindow.location.href=="string"}catch{s=!1}if(s)e=n.contentWindow;else break;n=At(e.document)}return n}function Bn(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}function Nr(e){var n=Wn(),s=e.focusedElem,a=e.selectionRange;if(n!==s&&s&&s.ownerDocument&&Tn(s.ownerDocument.documentElement,s)){if(a!==null&&Bn(s)){if(n=a.start,e=a.end,e===void 0&&(e=n),"selectionStart"in s)s.selectionStart=n,s.selectionEnd=Math.min(e,s.value.length);else if(e=(n=s.ownerDocument||document)&&n.defaultView||window,e.getSelection){e=e.getSelection();var f=s.textContent.length,h=Math.min(a.start,f);a=a.end===void 0?h:Math.min(a.end,f),!e.extend&&h>a&&(f=a,a=h,h=f),f=pr(s,h);var y=pr(s,a);f&&y&&(e.rangeCount!==1||e.anchorNode!==f.node||e.anchorOffset!==f.offset||e.focusNode!==y.node||e.focusOffset!==y.offset)&&(n=n.createRange(),n.setStart(f.node,f.offset),e.removeAllRanges(),h>a?(e.addRange(n),e.extend(y.node,y.offset)):(n.setEnd(y.node,y.offset),e.addRange(n)))}}for(n=[],e=s;e=e.parentNode;)e.nodeType===1&&n.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s=document.documentMode,Bt=null,Fr=null,Ot=null,Xs=!1;function cd(e,n,s){var a=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;Xs||Bt==null||Bt!==At(a)||(a=Bt,"selectionStart"in a&&Bn(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),Ot&&cn(Ot,a)||(Ot=a,a=sa(Fr,"onSelect"),0tl||(e.current=Xu[tl],Xu[tl]=null,tl--)}function dt(e,n){tl++,Xu[tl]=e.current,e.current=n}var $i={},zn=Vi($i),Zn=Vi(!1),ys=$i;function nl(e,n){var s=e.type.contextTypes;if(!s)return $i;var a=e.stateNode;if(a&&a.__reactInternalMemoizedUnmaskedChildContext===n)return a.__reactInternalMemoizedMaskedChildContext;var f={},h;for(h in s)f[h]=n[h];return a&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=n,e.__reactInternalMemoizedMaskedChildContext=f),f}function er(e){return e=e.childContextTypes,e!=null}function ua(){gt(Zn),gt(zn)}function kd(e,n,s){if(zn.current!==$i)throw Error(r(168));dt(zn,n),dt(Zn,s)}function Rd(e,n,s){var a=e.stateNode;if(n=n.childContextTypes,typeof a.getChildContext!="function")return s;a=a.getChildContext();for(var f in a)if(!(f in n))throw Error(r(108,_e(e)||"Unknown",f));return X({},s,a)}function ca(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||$i,ys=zn.current,dt(zn,e),dt(Zn,Zn.current),!0}function Nd(e,n,s){var a=e.stateNode;if(!a)throw Error(r(169));s?(e=Rd(e,n,ys),a.__reactInternalMemoizedMergedChildContext=e,gt(Zn),gt(zn),dt(zn,e)):gt(Zn),dt(Zn,s)}var mi=null,fa=!1,qu=!1;function Dd(e){mi===null?mi=[e]:mi.push(e)}function ev(e){fa=!0,Dd(e)}function Gi(){if(!qu&&mi!==null){qu=!0;var e=0,n=$e;try{var s=mi;for($e=1;e>=y,f-=y,vi=1<<32-In(n)+f|s<Ie?(hn=Me,Me=null):hn=Me.sibling;var Qe=Q(O,Me,I[Ie],se);if(Qe===null){Me===null&&(Me=hn);break}e&&Me&&Qe.alternate===null&&n(O,Me),M=h(Qe,M,Ie),ze===null?Re=Qe:ze.sibling=Qe,ze=Qe,Me=hn}if(Ie===I.length)return s(O,Me),St&&Ss(O,Ie),Re;if(Me===null){for(;IeIe?(hn=Me,Me=null):hn=Me.sibling;var ts=Q(O,Me,Qe.value,se);if(ts===null){Me===null&&(Me=hn);break}e&&Me&&ts.alternate===null&&n(O,Me),M=h(ts,M,Ie),ze===null?Re=ts:ze.sibling=ts,ze=ts,Me=hn}if(Qe.done)return s(O,Me),St&&Ss(O,Ie),Re;if(Me===null){for(;!Qe.done;Ie++,Qe=I.next())Qe=te(O,Qe.value,se),Qe!==null&&(M=h(Qe,M,Ie),ze===null?Re=Qe:ze.sibling=Qe,ze=Qe);return St&&Ss(O,Ie),Re}for(Me=a(O,Me);!Qe.done;Ie++,Qe=I.next())Qe=pe(Me,O,Ie,Qe.value,se),Qe!==null&&(e&&Qe.alternate!==null&&Me.delete(Qe.key===null?Ie:Qe.key),M=h(Qe,M,Ie),ze===null?Re=Qe:ze.sibling=Qe,ze=Qe);return e&&Me.forEach(function(Lv){return n(O,Lv)}),St&&Ss(O,Ie),Re}function Lt(O,M,I,se){if(typeof I=="object"&&I!==null&&I.type===ee&&I.key===null&&(I=I.props.children),typeof I=="object"&&I!==null){switch(I.$$typeof){case Z:e:{for(var Re=I.key,ze=M;ze!==null;){if(ze.key===Re){if(Re=I.type,Re===ee){if(ze.tag===7){s(O,ze.sibling),M=f(ze,I.props.children),M.return=O,O=M;break e}}else if(ze.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===De&&Ld(Re)===ze.type){s(O,ze.sibling),M=f(ze,I.props),M.ref=ql(O,ze,I),M.return=O,O=M;break e}s(O,ze);break}else n(O,ze);ze=ze.sibling}I.type===ee?(M=Ds(I.props.children,O.mode,se,I.key),M.return=O,O=M):(se=Fa(I.type,I.key,I.props,null,O.mode,se),se.ref=ql(O,M,I),se.return=O,O=se)}return y(O);case G:e:{for(ze=I.key;M!==null;){if(M.key===ze)if(M.tag===4&&M.stateNode.containerInfo===I.containerInfo&&M.stateNode.implementation===I.implementation){s(O,M.sibling),M=f(M,I.children||[]),M.return=O,O=M;break e}else{s(O,M);break}else n(O,M);M=M.sibling}M=Kc(I,O.mode,se),M.return=O,O=M}return y(O);case De:return ze=I._init,Lt(O,M,ze(I._payload),se)}if(Ze(I))return Se(O,M,I,se);if(oe(I))return Ee(O,M,I,se);ga(O,I)}return typeof I=="string"&&I!==""||typeof I=="number"?(I=""+I,M!==null&&M.tag===6?(s(O,M.sibling),M=f(M,I),M.return=O,O=M):(s(O,M),M=Yc(I,O.mode,se),M.return=O,O=M),y(O)):s(O,M)}return Lt}var ll=Pd(!0),Ad=Pd(!1),ma=Vi(null),va=null,ol=null,rc=null;function ic(){rc=ol=va=null}function sc(e){var n=ma.current;gt(ma),e._currentValue=n}function lc(e,n,s){for(;e!==null;){var a=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,a!==null&&(a.childLanes|=n)):a!==null&&(a.childLanes&n)!==n&&(a.childLanes|=n),e===s)break;e=e.return}}function al(e,n){va=e,rc=ol=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&n)!==0&&(tr=!0),e.firstContext=null)}function zr(e){var n=e._currentValue;if(rc!==e)if(e={context:e,memoizedValue:n,next:null},ol===null){if(va===null)throw Error(r(308));ol=e,va.dependencies={lanes:0,firstContext:e}}else ol=ol.next=e;return n}var xs=null;function oc(e){xs===null?xs=[e]:xs.push(e)}function Id(e,n,s,a){var f=n.interleaved;return f===null?(s.next=s,oc(n)):(s.next=f.next,f.next=s),n.interleaved=s,wi(e,a)}function wi(e,n){e.lanes|=n;var s=e.alternate;for(s!==null&&(s.lanes|=n),s=e,e=e.return;e!==null;)e.childLanes|=n,s=e.alternate,s!==null&&(s.childLanes|=n),s=e,e=e.return;return s.tag===3?s.stateNode:null}var Yi=!1;function ac(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Hd(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Si(e,n){return{eventTime:e,lane:n,tag:0,payload:null,callback:null,next:null}}function Ki(e,n,s){var a=e.updateQueue;if(a===null)return null;if(a=a.shared,(Ye&2)!==0){var f=a.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),a.pending=n,wi(e,s)}return f=a.interleaved,f===null?(n.next=n,oc(a)):(n.next=f.next,f.next=n),a.interleaved=n,wi(e,s)}function ya(e,n,s){if(n=n.updateQueue,n!==null&&(n=n.shared,(s&4194240)!==0)){var a=n.lanes;a&=e.pendingLanes,s|=a,n.lanes=s,bi(e,s)}}function Fd(e,n){var s=e.updateQueue,a=e.alternate;if(a!==null&&(a=a.updateQueue,s===a)){var f=null,h=null;if(s=s.firstBaseUpdate,s!==null){do{var y={eventTime:s.eventTime,lane:s.lane,tag:s.tag,payload:s.payload,callback:s.callback,next:null};h===null?f=h=y:h=h.next=y,s=s.next}while(s!==null);h===null?f=h=n:h=h.next=n}else f=h=n;s={baseState:a.baseState,firstBaseUpdate:f,lastBaseUpdate:h,shared:a.shared,effects:a.effects},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=n:e.next=n,s.lastBaseUpdate=n}function wa(e,n,s,a){var f=e.updateQueue;Yi=!1;var h=f.firstBaseUpdate,y=f.lastBaseUpdate,C=f.shared.pending;if(C!==null){f.shared.pending=null;var N=C,F=N.next;N.next=null,y===null?h=F:y.next=F,y=N;var J=e.alternate;J!==null&&(J=J.updateQueue,C=J.lastBaseUpdate,C!==y&&(C===null?J.firstBaseUpdate=F:C.next=F,J.lastBaseUpdate=N))}if(h!==null){var te=f.baseState;y=0,J=F=N=null,C=h;do{var Q=C.lane,pe=C.eventTime;if((a&Q)===Q){J!==null&&(J=J.next={eventTime:pe,lane:0,tag:C.tag,payload:C.payload,callback:C.callback,next:null});e:{var Se=e,Ee=C;switch(Q=n,pe=s,Ee.tag){case 1:if(Se=Ee.payload,typeof Se=="function"){te=Se.call(pe,te,Q);break e}te=Se;break e;case 3:Se.flags=Se.flags&-65537|128;case 0:if(Se=Ee.payload,Q=typeof Se=="function"?Se.call(pe,te,Q):Se,Q==null)break e;te=X({},te,Q);break e;case 2:Yi=!0}}C.callback!==null&&C.lane!==0&&(e.flags|=64,Q=f.effects,Q===null?f.effects=[C]:Q.push(C))}else pe={eventTime:pe,lane:Q,tag:C.tag,payload:C.payload,callback:C.callback,next:null},J===null?(F=J=pe,N=te):J=J.next=pe,y|=Q;if(C=C.next,C===null){if(C=f.shared.pending,C===null)break;Q=C,C=Q.next,Q.next=null,f.lastBaseUpdate=Q,f.shared.pending=null}}while(!0);if(J===null&&(N=te),f.baseState=N,f.firstBaseUpdate=F,f.lastBaseUpdate=J,n=f.shared.interleaved,n!==null){f=n;do y|=f.lane,f=f.next;while(f!==n)}else h===null&&(f.shared.lanes=0);Cs|=y,e.lanes=y,e.memoizedState=te}}function jd(e,n,s){if(e=n.effects,n.effects=null,e!==null)for(n=0;ns?s:4,e(!0);var a=hc.transition;hc.transition={};try{e(!1),n()}finally{$e=s,hc.transition=a}}function sh(){return Mr().memoizedState}function iv(e,n,s){var a=Ji(e);if(s={lane:a,action:s,hasEagerState:!1,eagerState:null,next:null},lh(e))oh(n,s);else if(s=Id(e,n,s,a),s!==null){var f=Vn();Vr(s,e,a,f),ah(s,n,a)}}function sv(e,n,s){var a=Ji(e),f={lane:a,action:s,hasEagerState:!1,eagerState:null,next:null};if(lh(e))oh(n,f);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var y=n.lastRenderedState,C=h(y,s);if(f.hasEagerState=!0,f.eagerState=C,at(C,y)){var N=n.interleaved;N===null?(f.next=f,oc(n)):(f.next=N.next,N.next=f),n.interleaved=f;return}}catch{}finally{}s=Id(e,n,f,a),s!==null&&(f=Vn(),Vr(s,e,a,f),ah(s,n,a))}}function lh(e){var n=e.alternate;return e===kt||n!==null&&n===kt}function oh(e,n){to=_a=!0;var s=e.pending;s===null?n.next=n:(n.next=s.next,s.next=n),e.pending=n}function ah(e,n,s){if((s&4194240)!==0){var a=n.lanes;a&=e.pendingLanes,s|=a,n.lanes=s,bi(e,s)}}var ka={readContext:zr,useCallback:Mn,useContext:Mn,useEffect:Mn,useImperativeHandle:Mn,useInsertionEffect:Mn,useLayoutEffect:Mn,useMemo:Mn,useReducer:Mn,useRef:Mn,useState:Mn,useDebugValue:Mn,useDeferredValue:Mn,useTransition:Mn,useMutableSource:Mn,useSyncExternalStore:Mn,useId:Mn,unstable_isNewReconciler:!1},lv={readContext:zr,useCallback:function(e,n){return si().memoizedState=[e,n===void 0?null:n],e},useContext:zr,useEffect:qd,useImperativeHandle:function(e,n,s){return s=s!=null?s.concat([e]):null,Ea(4194308,4,eh.bind(null,n,e),s)},useLayoutEffect:function(e,n){return Ea(4194308,4,e,n)},useInsertionEffect:function(e,n){return Ea(4,2,e,n)},useMemo:function(e,n){var s=si();return n=n===void 0?null:n,e=e(),s.memoizedState=[e,n],e},useReducer:function(e,n,s){var a=si();return n=s!==void 0?s(n):n,a.memoizedState=a.baseState=n,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:n},a.queue=e,e=e.dispatch=iv.bind(null,kt,e),[a.memoizedState,e]},useRef:function(e){var n=si();return e={current:e},n.memoizedState=e},useState:Qd,useDebugValue:Sc,useDeferredValue:function(e){return si().memoizedState=e},useTransition:function(){var e=Qd(!1),n=e[0];return e=rv.bind(null,e[1]),si().memoizedState=e,[n,e]},useMutableSource:function(){},useSyncExternalStore:function(e,n,s){var a=kt,f=si();if(St){if(s===void 0)throw Error(r(407));s=s()}else{if(s=n(),dn===null)throw Error(r(349));(Es&30)!==0||Vd(a,n,s)}f.memoizedState=s;var h={value:s,getSnapshot:n};return f.queue=h,qd(Gd.bind(null,a,h,e),[e]),a.flags|=2048,io(9,$d.bind(null,a,h,s,n),void 0,null),s},useId:function(){var e=si(),n=dn.identifierPrefix;if(St){var s=yi,a=vi;s=(a&~(1<<32-In(a)-1)).toString(32)+s,n=":"+n+"R"+s,s=no++,0<\/script>",e=e.removeChild(e.firstChild)):typeof a.is=="string"?e=y.createElement(s,{is:a.is}):(e=y.createElement(s),s==="select"&&(y=e,a.multiple?y.multiple=!0:a.size&&(y.size=a.size))):e=y.createElementNS(e,s),e[ri]=n,e[Ql]=a,Dh(e,n,!1,!1),n.stateNode=e;e:{switch(y=Jr(s,a),s){case"dialog":pt("cancel",e),pt("close",e),c=a;break;case"iframe":case"object":case"embed":pt("load",e),c=a;break;case"video":case"audio":for(c=0;chl&&(n.flags|=128,a=!0,so(h,!1),n.lanes=4194304)}else{if(!a)if(e=Sa(y),e!==null){if(n.flags|=128,a=!0,s=e.updateQueue,s!==null&&(n.updateQueue=s,n.flags|=4),so(h,!0),h.tail===null&&h.tailMode==="hidden"&&!y.alternate&&!St)return bn(n),null}else 2*ot()-h.renderingStartTime>hl&&s!==1073741824&&(n.flags|=128,a=!0,so(h,!1),n.lanes=4194304);h.isBackwards?(y.sibling=n.child,n.child=y):(s=h.last,s!==null?s.sibling=y:n.child=y,h.last=y)}return h.tail!==null?(n=h.tail,h.rendering=n,h.tail=n.sibling,h.renderingStartTime=ot(),n.sibling=null,s=Ct.current,dt(Ct,a?s&1|2:s&1),n):(bn(n),null);case 22:case 23:return Vc(),a=n.memoizedState!==null,e!==null&&e.memoizedState!==null!==a&&(n.flags|=8192),a&&(n.mode&1)!==0?(vr&1073741824)!==0&&(bn(n),n.subtreeFlags&6&&(n.flags|=8192)):bn(n),null;case 24:return null;case 25:return null}throw Error(r(156,n.tag))}function fv(e,n){switch(Zu(n),n.tag){case 1:return er(n.type)&&ua(),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return ul(),gt(Zn),gt(zn),dc(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 5:return cc(n),null;case 13:if(gt(Ct),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(r(340));sl()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return gt(Ct),null;case 4:return ul(),null;case 10:return sc(n.type._context),null;case 22:case 23:return Vc(),null;case 24:return null;default:return null}}var Ta=!1,On=!1,dv=typeof WeakSet=="function"?WeakSet:Set,we=null;function fl(e,n){var s=e.ref;if(s!==null)if(typeof s=="function")try{s(null)}catch(a){Tt(e,n,a)}else s.current=null}function bc(e,n,s){try{s()}catch(a){Tt(e,n,a)}}var Mh=!1;function hv(e,n){if(Vu=rt,e=Wn(),Bn(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{s=(s=e.ownerDocument)&&s.defaultView||window;var a=s.getSelection&&s.getSelection();if(a&&a.rangeCount!==0){s=a.anchorNode;var c=a.anchorOffset,h=a.focusNode;a=a.focusOffset;try{s.nodeType,h.nodeType}catch{s=null;break e}var y=0,C=-1,N=-1,F=0,J=0,te=e,Q=null;t:for(;;){for(var pe;te!==s||c!==0&&te.nodeType!==3||(C=y+c),te!==h||a!==0&&te.nodeType!==3||(N=y+a),te.nodeType===3&&(y+=te.nodeValue.length),(pe=te.firstChild)!==null;)Q=te,te=pe;for(;;){if(te===e)break t;if(Q===s&&++F===c&&(C=y),Q===h&&++J===a&&(N=y),(pe=te.nextSibling)!==null)break;te=Q,Q=te.parentNode}te=pe}s=C===-1||N===-1?null:{start:C,end:N}}else s=null}s=s||{start:0,end:0}}else s=null;for($u={focusedElem:e,selectionRange:s},rt=!1,we=n;we!==null;)if(n=we,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,we=e;else for(;we!==null;){n=we;try{var Se=n.alternate;if((n.flags&1024)!==0)switch(n.tag){case 0:case 11:case 15:break;case 1:if(Se!==null){var Ee=Se.memoizedProps,Lt=Se.memoizedState,O=n.stateNode,M=O.getSnapshotBeforeUpdate(n.elementType===n.type?Ee:Wr(n.type,Ee),Lt);O.__reactInternalSnapshotBeforeUpdate=M}break;case 3:var I=n.stateNode.containerInfo;I.nodeType===1?I.textContent="":I.nodeType===9&&I.documentElement&&I.removeChild(I.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(se){Tt(n,n.return,se)}if(e=n.sibling,e!==null){e.return=n.return,we=e;break}we=n.return}return Se=Mh,Mh=!1,Se}function lo(e,n,s){var a=n.updateQueue;if(a=a!==null?a.lastEffect:null,a!==null){var c=a=a.next;do{if((c.tag&e)===e){var h=c.destroy;c.destroy=void 0,h!==void 0&&bc(n,s,h)}c=c.next}while(c!==a)}}function za(e,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var s=n=n.next;do{if((s.tag&e)===e){var a=s.create;s.destroy=a()}s=s.next}while(s!==n)}}function Oc(e){var n=e.ref;if(n!==null){var s=e.stateNode;switch(e.tag){case 5:e=s;break;default:e=s}typeof n=="function"?n(e):n.current=e}}function bh(e){var n=e.alternate;n!==null&&(e.alternate=null,bh(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&(delete n[ri],delete n[Ql],delete n[Qu],delete n[Qm],delete n[Xm])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Oh(e){return e.tag===5||e.tag===3||e.tag===4}function Lh(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Oh(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.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Lc(e,n,s){var a=e.tag;if(a===5||a===6)e=e.stateNode,n?s.nodeType===8?s.parentNode.insertBefore(e,n):s.insertBefore(e,n):(s.nodeType===8?(n=s.parentNode,n.insertBefore(e,s)):(n=s,n.appendChild(e)),s=s._reactRootContainer,s!=null||n.onclick!==null||(n.onclick=oa));else if(a!==4&&(e=e.child,e!==null))for(Lc(e,n,s),e=e.sibling;e!==null;)Lc(e,n,s),e=e.sibling}function Pc(e,n,s){var a=e.tag;if(a===5||a===6)e=e.stateNode,n?s.insertBefore(e,n):s.appendChild(e);else if(a!==4&&(e=e.child,e!==null))for(Pc(e,n,s),e=e.sibling;e!==null;)Pc(e,n,s),e=e.sibling}var _n=null,Br=!1;function Qi(e,n,s){for(s=s.child;s!==null;)Ph(e,n,s),s=s.sibling}function Ph(e,n,s){if(Qn&&typeof Qn.onCommitFiberUnmount=="function")try{Qn.onCommitFiberUnmount(Di,s)}catch{}switch(s.tag){case 5:On||fl(s,n);case 6:var a=_n,c=Br;_n=null,Qi(e,n,s),_n=a,Br=c,_n!==null&&(Br?(e=_n,s=s.stateNode,e.nodeType===8?e.parentNode.removeChild(s):e.removeChild(s)):_n.removeChild(s.stateNode));break;case 18:_n!==null&&(Br?(e=_n,s=s.stateNode,e.nodeType===8?Ku(e.parentNode,s):e.nodeType===1&&Ku(e,s),Fi(e)):Ku(_n,s.stateNode));break;case 4:a=_n,c=Br,_n=s.stateNode.containerInfo,Br=!0,Qi(e,n,s),_n=a,Br=c;break;case 0:case 11:case 14:case 15:if(!On&&(a=s.updateQueue,a!==null&&(a=a.lastEffect,a!==null))){c=a=a.next;do{var h=c,y=h.destroy;h=h.tag,y!==void 0&&((h&2)!==0||(h&4)!==0)&&bc(s,n,y),c=c.next}while(c!==a)}Qi(e,n,s);break;case 1:if(!On&&(fl(s,n),a=s.stateNode,typeof a.componentWillUnmount=="function"))try{a.props=s.memoizedProps,a.state=s.memoizedState,a.componentWillUnmount()}catch(C){Tt(s,n,C)}Qi(e,n,s);break;case 21:Qi(e,n,s);break;case 22:s.mode&1?(On=(a=On)||s.memoizedState!==null,Qi(e,n,s),On=a):Qi(e,n,s);break;default:Qi(e,n,s)}}function Ah(e){var n=e.updateQueue;if(n!==null){e.updateQueue=null;var s=e.stateNode;s===null&&(s=e.stateNode=new dv),n.forEach(function(a){var c=_v.bind(null,e,a);s.has(a)||(s.add(a),a.then(c,c))})}}function Ur(e,n){var s=n.deletions;if(s!==null)for(var a=0;ac&&(c=y),a&=~h}if(a=c,a=ot()-a,a=(120>a?120:480>a?480:1080>a?1080:1920>a?1920:3e3>a?3e3:4320>a?4320:1960*gv(a/1960))-a,10e?16:e,qi===null)var a=!1;else{if(e=qi,qi=null,Pa=0,(Ye&6)!==0)throw Error(r(331));var c=Ye;for(Ye|=4,we=e.current;we!==null;){var h=we,y=h.child;if((we.flags&16)!==0){var C=h.deletions;if(C!==null){for(var N=0;Not()-Hc?Rs(e,0):Ic|=s),rr(e,n)}function Qh(e,n){n===0&&((e.mode&1)===0?n=1:(n=Ti,Ti<<=1,(Ti&130023424)===0&&(Ti=4194304)));var s=Vn();e=wi(e,n),e!==null&&(Mi(e,n,s),rr(e,s))}function xv(e){var n=e.memoizedState,s=0;n!==null&&(s=n.retryLane),Qh(e,s)}function _v(e,n){var s=0;switch(e.tag){case 13:var a=e.stateNode,c=e.memoizedState;c!==null&&(s=c.retryLane);break;case 19:a=e.stateNode;break;default:throw Error(r(314))}a!==null&&a.delete(n),Qh(e,s)}var Xh;Xh=function(e,n,s){if(e!==null)if(e.memoizedProps!==n.pendingProps||Zn.current)tr=!0;else{if((e.lanes&s)===0&&(n.flags&128)===0)return tr=!1,uv(e,n,s);tr=(e.flags&131072)!==0}else tr=!1,St&&(n.flags&1048576)!==0&&Td(n,ha,n.index);switch(n.lanes=0,n.tag){case 2:var a=n.type;Da(e,n),e=n.pendingProps;var c=nl(n,zn.current);al(n,s),c=gc(null,n,a,e,c,s);var h=mc();return n.flags|=1,typeof c=="object"&&c!==null&&typeof c.render=="function"&&c.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,er(a)?(h=!0,ca(n)):h=!1,n.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,ac(n),c.updater=Ra,n.stateNode=c,c._reactInternals=n,_c(n,a,e,s),n=Rc(null,n,a,!0,h,s)):(n.tag=0,St&&h&&Ju(n),Un(null,n,c,s),n=n.child),n;case 16:a=n.elementType;e:{switch(Da(e,n),e=n.pendingProps,c=a._init,a=c(a._payload),n.type=a,c=n.tag=Cv(a),e=Wr(a,e),c){case 0:n=kc(null,n,a,e,s);break e;case 1:n=_h(null,n,a,e,s);break e;case 11:n=vh(null,n,a,e,s);break e;case 14:n=yh(null,n,a,Wr(a.type,e),s);break e}throw Error(r(306,a,""))}return n;case 0:return a=n.type,c=n.pendingProps,c=n.elementType===a?c:Wr(a,c),kc(e,n,a,c,s);case 1:return a=n.type,c=n.pendingProps,c=n.elementType===a?c:Wr(a,c),_h(e,n,a,c,s);case 3:e:{if(Eh(n),e===null)throw Error(r(387));a=n.pendingProps,h=n.memoizedState,c=h.element,Hd(e,n),wa(n,a,null,s);var y=n.memoizedState;if(a=y.element,h.isDehydrated)if(h={element:a,isDehydrated:!1,cache:y.cache,pendingSuspenseBoundaries:y.pendingSuspenseBoundaries,transitions:y.transitions},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){c=cl(Error(r(423)),n),n=Ch(e,n,a,s,c);break e}else if(a!==c){c=cl(Error(r(424)),n),n=Ch(e,n,a,s,c);break e}else for(mr=Ui(n.stateNode.containerInfo.firstChild),gr=n,St=!0,jr=null,s=Ad(n,null,a,s),n.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(sl(),a===c){n=xi(e,n,s);break e}Un(e,n,a,s)}n=n.child}return n;case 5:return Wd(n),e===null&&tc(n),a=n.type,c=n.pendingProps,h=e!==null?e.memoizedProps:null,y=c.children,Gu(a,c)?y=null:h!==null&&Gu(a,h)&&(n.flags|=32),xh(e,n),Un(e,n,y,s),n.child;case 6:return e===null&&tc(n),null;case 13:return kh(e,n,s);case 4:return uc(n,n.stateNode.containerInfo),a=n.pendingProps,e===null?n.child=ll(n,null,a,s):Un(e,n,a,s),n.child;case 11:return a=n.type,c=n.pendingProps,c=n.elementType===a?c:Wr(a,c),vh(e,n,a,c,s);case 7:return Un(e,n,n.pendingProps,s),n.child;case 8:return Un(e,n,n.pendingProps.children,s),n.child;case 12:return Un(e,n,n.pendingProps.children,s),n.child;case 10:e:{if(a=n.type._context,c=n.pendingProps,h=n.memoizedProps,y=c.value,dt(ma,a._currentValue),a._currentValue=y,h!==null)if(at(h.value,y)){if(h.children===c.children&&!Zn.current){n=xi(e,n,s);break e}}else for(h=n.child,h!==null&&(h.return=n);h!==null;){var C=h.dependencies;if(C!==null){y=h.child;for(var N=C.firstContext;N!==null;){if(N.context===a){if(h.tag===1){N=Si(-1,s&-s),N.tag=2;var F=h.updateQueue;if(F!==null){F=F.shared;var J=F.pending;J===null?N.next=N:(N.next=J.next,J.next=N),F.pending=N}}h.lanes|=s,N=h.alternate,N!==null&&(N.lanes|=s),lc(h.return,s,n),C.lanes|=s;break}N=N.next}}else if(h.tag===10)y=h.type===n.type?null:h.child;else if(h.tag===18){if(y=h.return,y===null)throw Error(r(341));y.lanes|=s,C=y.alternate,C!==null&&(C.lanes|=s),lc(y,s,n),y=h.sibling}else y=h.child;if(y!==null)y.return=h;else for(y=h;y!==null;){if(y===n){y=null;break}if(h=y.sibling,h!==null){h.return=y.return,y=h;break}y=y.return}h=y}Un(e,n,c.children,s),n=n.child}return n;case 9:return c=n.type,a=n.pendingProps.children,al(n,s),c=zr(c),a=a(c),n.flags|=1,Un(e,n,a,s),n.child;case 14:return a=n.type,c=Wr(a,n.pendingProps),c=Wr(a.type,c),yh(e,n,a,c,s);case 15:return wh(e,n,n.type,n.pendingProps,s);case 17:return a=n.type,c=n.pendingProps,c=n.elementType===a?c:Wr(a,c),Da(e,n),n.tag=1,er(a)?(e=!0,ca(n)):e=!1,al(n,s),ch(n,a,c),_c(n,a,c,s),Rc(null,n,a,!0,e,s);case 19:return Nh(e,n,s);case 22:return Sh(e,n,s)}throw Error(r(156,n.tag))};function qh(e,n){return Mt(e,n)}function Ev(e,n,s,a){this.tag=e,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Or(e,n,s,a){return new Ev(e,n,s,a)}function Gc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Cv(e){if(typeof e=="function")return Gc(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ce)return 11;if(e===me)return 14}return 2}function es(e,n){var s=e.alternate;return s===null?(s=Or(e.tag,n,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=n,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=e.flags&14680064,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,n=e.dependencies,s.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s}function Fa(e,n,s,a,c,h){var y=2;if(a=e,typeof e=="function")Gc(e)&&(y=1);else if(typeof e=="string")y=5;else e:switch(e){case ee:return Ds(s.children,c,h,n);case re:y=8,c|=8;break;case ve:return e=Or(12,s,n,c|2),e.elementType=ve,e.lanes=h,e;case ae:return e=Or(13,s,n,c),e.elementType=ae,e.lanes=h,e;case ye:return e=Or(19,s,n,c),e.elementType=ye,e.lanes=h,e;case le:return ja(s,c,h,n);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case de:y=10;break e;case Y:y=9;break e;case Ce:y=11;break e;case me:y=14;break e;case De:y=16,a=null;break e}throw Error(r(130,e==null?e:typeof e,""))}return n=Or(y,s,n,c),n.elementType=e,n.type=a,n.lanes=h,n}function Ds(e,n,s,a){return e=Or(7,e,a,n),e.lanes=s,e}function ja(e,n,s,a){return e=Or(22,e,a,n),e.elementType=le,e.lanes=s,e.stateNode={isHidden:!1},e}function Yc(e,n,s){return e=Or(6,e,null,n),e.lanes=s,e}function Kc(e,n,s){return n=Or(4,e.children!==null?e.children:[],e.key,n),n.lanes=s,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function kv(e,n,s,a,c){this.tag=n,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Al(0),this.expirationTimes=Al(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Al(0),this.identifierPrefix=a,this.onRecoverableError=c,this.mutableSourceEagerHydrationData=null}function Qc(e,n,s,a,c,h,y,C,N){return e=new kv(e,n,s,C,N),n===1?(n=1,h===!0&&(n|=8)):n=0,h=Or(3,null,null,n),e.current=h,h.stateNode=e,h.memoizedState={element:a,isDehydrated:s,cache:null,transitions:null,pendingSuspenseBoundaries:null},ac(h),e}function Rv(e,n,s){var a=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l)}catch(t){console.error(t)}}return l(),tf.exports=Fv(),tf.exports}var fp;function jv(){if(fp)return Ya;fp=1;var l=Rg();return Ya.createRoot=l.createRoot,Ya.hydrateRoot=l.hydrateRoot,Ya}var Wv=jv();const Bv=kg(Wv);var bs=Rg();const wu=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Nl(l){const t=Object.prototype.toString.call(l);return t==="[object Window]"||t==="[object global]"}function Ff(l){return"nodeType"in l}function Yn(l){var t,r;return l?Nl(l)?l:Ff(l)&&(t=(r=l.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function jf(l){const{Document:t}=Yn(l);return l instanceof t}function bo(l){return Nl(l)?!1:l instanceof Yn(l).HTMLElement}function Ng(l){return l instanceof Yn(l).SVGElement}function Dl(l){return l?Nl(l)?l.document:Ff(l)?jf(l)?l:bo(l)||Ng(l)?l.ownerDocument:document:document:document}const ki=wu?j.useLayoutEffect:j.useEffect;function Su(l){const t=j.useRef(l);return ki(()=>{t.current=l}),j.useCallback(function(){for(var r=arguments.length,i=new Array(r),o=0;o{l.current=setInterval(i,o)},[]),r=j.useCallback(()=>{l.current!==null&&(clearInterval(l.current),l.current=null)},[]);return[t,r]}function Ro(l,t){t===void 0&&(t=[l]);const r=j.useRef(l);return ki(()=>{r.current!==l&&(r.current=l)},t),r}function Oo(l,t){const r=j.useRef();return j.useMemo(()=>{const i=l(r.current);return r.current=i,i},[...t])}function iu(l){const t=Su(l),r=j.useRef(null),i=j.useCallback(o=>{o!==r.current&&(t==null||t(o,r.current)),r.current=o},[]);return[r,i]}function su(l){const t=j.useRef();return j.useEffect(()=>{t.current=l},[l]),t.current}let sf={};function xu(l,t){return j.useMemo(()=>{if(t)return t;const r=sf[l]==null?0:sf[l]+1;return sf[l]=r,l+"-"+r},[l,t])}function Dg(l){return function(t){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o{const d=Object.entries(f);for(const[p,m]of d){const w=u[p];w!=null&&(u[p]=w+l*m)}return u},{...t})}}const wl=Dg(1),lu=Dg(-1);function Vv(l){return"clientX"in l&&"clientY"in l}function Wf(l){if(!l)return!1;const{KeyboardEvent:t}=Yn(l.target);return t&&l instanceof t}function $v(l){if(!l)return!1;const{TouchEvent:t}=Yn(l.target);return t&&l instanceof t}function ou(l){if($v(l)){if(l.touches&&l.touches.length){const{clientX:t,clientY:r}=l.touches[0];return{x:t,y:r}}else if(l.changedTouches&&l.changedTouches.length){const{clientX:t,clientY:r}=l.changedTouches[0];return{x:t,y:r}}}return Vv(l)?{x:l.clientX,y:l.clientY}:null}const No=Object.freeze({Translate:{toString(l){if(!l)return;const{x:t,y:r}=l;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(l){if(!l)return;const{scaleX:t,scaleY:r}=l;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(l){if(l)return[No.Translate.toString(l),No.Scale.toString(l)].join(" ")}},Transition:{toString(l){let{property:t,duration:r,easing:i}=l;return t+" "+r+"ms "+i}}}),dp="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Gv(l){return l.matches(dp)?l:l.querySelector(dp)}const Yv={display:"none"};function Kv(l){let{id:t,value:r}=l;return ht.createElement("div",{id:t,style:Yv},r)}function Qv(l){let{id:t,announcement:r,ariaLiveType:i="assertive"}=l;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return ht.createElement("div",{id:t,style:o,role:"status","aria-live":i,"aria-atomic":!0},r)}function Xv(){const[l,t]=j.useState("");return{announce:j.useCallback(i=>{i!=null&&t(i)},[]),announcement:l}}const Tg=j.createContext(null);function qv(l){const t=j.useContext(Tg);j.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(l)},[l,t])}function Jv(){const[l]=j.useState(()=>new Set),t=j.useCallback(i=>(l.add(i),()=>l.delete(i)),[l]);return[j.useCallback(i=>{let{type:o,event:u}=i;l.forEach(f=>{var d;return(d=f[o])==null?void 0:d.call(f,u)})},[l]),t]}const Zv={draggable:` +`+h.stack}return{value:e,source:n,stack:f,digest:null}}function Ec(e,n,s){return{value:e,source:null,stack:s??null,digest:n??null}}function Cc(e,n){try{console.error(n.value)}catch(s){setTimeout(function(){throw s})}}var uv=typeof WeakMap=="function"?WeakMap:Map;function dh(e,n,s){s=Si(-1,s),s.tag=3,s.payload={element:null};var a=n.value;return s.callback=function(){Oa||(Oa=!0,Fc=a),Cc(e,n)},s}function hh(e,n,s){s=Si(-1,s),s.tag=3;var a=e.type.getDerivedStateFromError;if(typeof a=="function"){var f=n.value;s.payload=function(){return a(f)},s.callback=function(){Cc(e,n)}}var h=e.stateNode;return h!==null&&typeof h.componentDidCatch=="function"&&(s.callback=function(){Cc(e,n),typeof a!="function"&&(Xi===null?Xi=new Set([this]):Xi.add(this));var y=n.stack;this.componentDidCatch(n.value,{componentStack:y!==null?y:""})}),s}function ph(e,n,s){var a=e.pingCache;if(a===null){a=e.pingCache=new uv;var f=new Set;a.set(n,f)}else f=a.get(n),f===void 0&&(f=new Set,a.set(n,f));f.has(s)||(f.add(s),e=Ev.bind(null,e,n,s),n.then(e,e))}function gh(e){do{var n;if((n=e.tag===13)&&(n=e.memoizedState,n=n!==null?n.dehydrated!==null:!0),n)return e;e=e.return}while(e!==null);return null}function mh(e,n,s,a,f){return(e.mode&1)===0?(e===n?e.flags|=65536:(e.flags|=128,s.flags|=131072,s.flags&=-52805,s.tag===1&&(s.alternate===null?s.tag=17:(n=Si(-1,1),n.tag=2,Ki(s,n,1))),s.lanes|=1),e):(e.flags|=65536,e.lanes=f,e)}var cv=V.ReactCurrentOwner,tr=!1;function Un(e,n,s,a){n.child=e===null?Ad(n,null,s,a):ll(n,e.child,s,a)}function vh(e,n,s,a,f){s=s.render;var h=n.ref;return al(n,f),a=gc(e,n,s,a,h,f),s=mc(),e!==null&&!tr?(n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~f,xi(e,n,f)):(St&&s&&Ju(n),n.flags|=1,Un(e,n,a,f),n.child)}function yh(e,n,s,a,f){if(e===null){var h=s.type;return typeof h=="function"&&!Gc(h)&&h.defaultProps===void 0&&s.compare===null&&s.defaultProps===void 0?(n.tag=15,n.type=h,wh(e,n,h,a,f)):(e=Fa(s.type,null,a,n,n.mode,f),e.ref=n.ref,e.return=n,n.child=e)}if(h=e.child,(e.lanes&f)===0){var y=h.memoizedProps;if(s=s.compare,s=s!==null?s:cn,s(y,a)&&e.ref===n.ref)return xi(e,n,f)}return n.flags|=1,e=es(h,a),e.ref=n.ref,e.return=n,n.child=e}function wh(e,n,s,a,f){if(e!==null){var h=e.memoizedProps;if(cn(h,a)&&e.ref===n.ref)if(tr=!1,n.pendingProps=a=h,(e.lanes&f)!==0)(e.flags&131072)!==0&&(tr=!0);else return n.lanes=e.lanes,xi(e,n,f)}return kc(e,n,s,a,f)}function Sh(e,n,s){var a=n.pendingProps,f=a.children,h=e!==null?e.memoizedState:null;if(a.mode==="hidden")if((n.mode&1)===0)n.memoizedState={baseLanes:0,cachePool:null,transitions:null},dt(dl,vr),vr|=s;else{if((s&1073741824)===0)return e=h!==null?h.baseLanes|s:s,n.lanes=n.childLanes=1073741824,n.memoizedState={baseLanes:e,cachePool:null,transitions:null},n.updateQueue=null,dt(dl,vr),vr|=e,null;n.memoizedState={baseLanes:0,cachePool:null,transitions:null},a=h!==null?h.baseLanes:s,dt(dl,vr),vr|=a}else h!==null?(a=h.baseLanes|s,n.memoizedState=null):a=s,dt(dl,vr),vr|=a;return Un(e,n,f,s),n.child}function xh(e,n){var s=n.ref;(e===null&&s!==null||e!==null&&e.ref!==s)&&(n.flags|=512,n.flags|=2097152)}function kc(e,n,s,a,f){var h=er(s)?ys:zn.current;return h=nl(n,h),al(n,f),s=gc(e,n,s,a,h,f),a=mc(),e!==null&&!tr?(n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~f,xi(e,n,f)):(St&&a&&Ju(n),n.flags|=1,Un(e,n,s,f),n.child)}function _h(e,n,s,a,f){if(er(s)){var h=!0;ca(n)}else h=!1;if(al(n,f),n.stateNode===null)Da(e,n),ch(n,s,a),_c(n,s,a,f),a=!0;else if(e===null){var y=n.stateNode,C=n.memoizedProps;y.props=C;var N=y.context,F=s.contextType;typeof F=="object"&&F!==null?F=zr(F):(F=er(s)?ys:zn.current,F=nl(n,F));var J=s.getDerivedStateFromProps,te=typeof J=="function"||typeof y.getSnapshotBeforeUpdate=="function";te||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(C!==a||N!==F)&&fh(n,y,a,F),Yi=!1;var Q=n.memoizedState;y.state=Q,wa(n,a,y,f),N=n.memoizedState,C!==a||Q!==N||Zn.current||Yi?(typeof J=="function"&&(xc(n,s,J,a),N=n.memoizedState),(C=Yi||uh(n,s,C,a,Q,N,F))?(te||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(n.flags|=4194308)):(typeof y.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=a,n.memoizedState=N),y.props=a,y.state=N,y.context=F,a=C):(typeof y.componentDidMount=="function"&&(n.flags|=4194308),a=!1)}else{y=n.stateNode,Hd(e,n),C=n.memoizedProps,F=n.type===n.elementType?C:Wr(n.type,C),y.props=F,te=n.pendingProps,Q=y.context,N=s.contextType,typeof N=="object"&&N!==null?N=zr(N):(N=er(s)?ys:zn.current,N=nl(n,N));var pe=s.getDerivedStateFromProps;(J=typeof pe=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(C!==te||Q!==N)&&fh(n,y,a,N),Yi=!1,Q=n.memoizedState,y.state=Q,wa(n,a,y,f);var Se=n.memoizedState;C!==te||Q!==Se||Zn.current||Yi?(typeof pe=="function"&&(xc(n,s,pe,a),Se=n.memoizedState),(F=Yi||uh(n,s,F,a,Q,Se,N)||!1)?(J||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(a,Se,N),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(a,Se,N)),typeof y.componentDidUpdate=="function"&&(n.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof y.componentDidUpdate!="function"||C===e.memoizedProps&&Q===e.memoizedState||(n.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||C===e.memoizedProps&&Q===e.memoizedState||(n.flags|=1024),n.memoizedProps=a,n.memoizedState=Se),y.props=a,y.state=Se,y.context=N,a=F):(typeof y.componentDidUpdate!="function"||C===e.memoizedProps&&Q===e.memoizedState||(n.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||C===e.memoizedProps&&Q===e.memoizedState||(n.flags|=1024),a=!1)}return Rc(e,n,s,a,h,f)}function Rc(e,n,s,a,f,h){xh(e,n);var y=(n.flags&128)!==0;if(!a&&!y)return f&&Nd(n,s,!1),xi(e,n,h);a=n.stateNode,cv.current=n;var C=y&&typeof s.getDerivedStateFromError!="function"?null:a.render();return n.flags|=1,e!==null&&y?(n.child=ll(n,e.child,null,h),n.child=ll(n,null,C,h)):Un(e,n,C,h),n.memoizedState=a.state,f&&Nd(n,s,!0),n.child}function Eh(e){var n=e.stateNode;n.pendingContext?kd(e,n.pendingContext,n.pendingContext!==n.context):n.context&&kd(e,n.context,!1),uc(e,n.containerInfo)}function Ch(e,n,s,a,f){return sl(),nc(f),n.flags|=256,Un(e,n,s,a),n.child}var Nc={dehydrated:null,treeContext:null,retryLane:0};function Dc(e){return{baseLanes:e,cachePool:null,transitions:null}}function kh(e,n,s){var a=n.pendingProps,f=Ct.current,h=!1,y=(n.flags&128)!==0,C;if((C=y)||(C=e!==null&&e.memoizedState===null?!1:(f&2)!==0),C?(h=!0,n.flags&=-129):(e===null||e.memoizedState!==null)&&(f|=1),dt(Ct,f&1),e===null)return tc(n),e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?((n.mode&1)===0?n.lanes=1:e.data==="$!"?n.lanes=8:n.lanes=1073741824,null):(y=a.children,e=a.fallback,h?(a=n.mode,h=n.child,y={mode:"hidden",children:y},(a&1)===0&&h!==null?(h.childLanes=0,h.pendingProps=y):h=ja(y,a,0,null),e=Ds(e,a,s,null),h.return=n,e.return=n,h.sibling=e,n.child=h,n.child.memoizedState=Dc(s),n.memoizedState=Nc,e):Tc(n,y));if(f=e.memoizedState,f!==null&&(C=f.dehydrated,C!==null))return fv(e,n,y,a,C,f,s);if(h){h=a.fallback,y=n.mode,f=e.child,C=f.sibling;var N={mode:"hidden",children:a.children};return(y&1)===0&&n.child!==f?(a=n.child,a.childLanes=0,a.pendingProps=N,n.deletions=null):(a=es(f,N),a.subtreeFlags=f.subtreeFlags&14680064),C!==null?h=es(C,h):(h=Ds(h,y,s,null),h.flags|=2),h.return=n,a.return=n,a.sibling=h,n.child=a,a=h,h=n.child,y=e.child.memoizedState,y=y===null?Dc(s):{baseLanes:y.baseLanes|s,cachePool:null,transitions:y.transitions},h.memoizedState=y,h.childLanes=e.childLanes&~s,n.memoizedState=Nc,a}return h=e.child,e=h.sibling,a=es(h,{mode:"visible",children:a.children}),(n.mode&1)===0&&(a.lanes=s),a.return=n,a.sibling=null,e!==null&&(s=n.deletions,s===null?(n.deletions=[e],n.flags|=16):s.push(e)),n.child=a,n.memoizedState=null,a}function Tc(e,n){return n=ja({mode:"visible",children:n},e.mode,0,null),n.return=e,e.child=n}function Na(e,n,s,a){return a!==null&&nc(a),ll(n,e.child,null,s),e=Tc(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function fv(e,n,s,a,f,h,y){if(s)return n.flags&256?(n.flags&=-257,a=Ec(Error(r(422))),Na(e,n,y,a)):n.memoizedState!==null?(n.child=e.child,n.flags|=128,null):(h=a.fallback,f=n.mode,a=ja({mode:"visible",children:a.children},f,0,null),h=Ds(h,f,y,null),h.flags|=2,a.return=n,h.return=n,a.sibling=h,n.child=a,(n.mode&1)!==0&&ll(n,e.child,null,y),n.child.memoizedState=Dc(y),n.memoizedState=Nc,h);if((n.mode&1)===0)return Na(e,n,y,null);if(f.data==="$!"){if(a=f.nextSibling&&f.nextSibling.dataset,a)var C=a.dgst;return a=C,h=Error(r(419)),a=Ec(h,a,void 0),Na(e,n,y,a)}if(C=(y&e.childLanes)!==0,tr||C){if(a=dn,a!==null){switch(y&-y){case 4:f=2;break;case 16:f=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:f=32;break;case 536870912:f=268435456;break;default:f=0}f=(f&(a.suspendedLanes|y))!==0?0:f,f!==0&&f!==h.retryLane&&(h.retryLane=f,wi(e,f),Vr(a,e,f,-1))}return $c(),a=Ec(Error(r(421))),Na(e,n,y,a)}return f.data==="$?"?(n.flags|=128,n.child=e.child,n=Cv.bind(null,e),f._reactRetry=n,null):(e=h.treeContext,mr=Ui(f.nextSibling),gr=n,St=!0,jr=null,e!==null&&(Dr[Tr++]=vi,Dr[Tr++]=yi,Dr[Tr++]=ws,vi=e.id,yi=e.overflow,ws=n),n=Tc(n,a.children),n.flags|=4096,n)}function Rh(e,n,s){e.lanes|=n;var a=e.alternate;a!==null&&(a.lanes|=n),lc(e.return,n,s)}function zc(e,n,s,a,f){var h=e.memoizedState;h===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:a,tail:s,tailMode:f}:(h.isBackwards=n,h.rendering=null,h.renderingStartTime=0,h.last=a,h.tail=s,h.tailMode=f)}function Nh(e,n,s){var a=n.pendingProps,f=a.revealOrder,h=a.tail;if(Un(e,n,a.children,s),a=Ct.current,(a&2)!==0)a=a&1|2,n.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Rh(e,s,n);else if(e.tag===19)Rh(e,s,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}a&=1}if(dt(Ct,a),(n.mode&1)===0)n.memoizedState=null;else switch(f){case"forwards":for(s=n.child,f=null;s!==null;)e=s.alternate,e!==null&&Sa(e)===null&&(f=s),s=s.sibling;s=f,s===null?(f=n.child,n.child=null):(f=s.sibling,s.sibling=null),zc(n,!1,f,s,h);break;case"backwards":for(s=null,f=n.child,n.child=null;f!==null;){if(e=f.alternate,e!==null&&Sa(e)===null){n.child=f;break}e=f.sibling,f.sibling=s,s=f,f=e}zc(n,!0,s,null,h);break;case"together":zc(n,!1,null,null,void 0);break;default:n.memoizedState=null}return n.child}function Da(e,n){(n.mode&1)===0&&e!==null&&(e.alternate=null,n.alternate=null,n.flags|=2)}function xi(e,n,s){if(e!==null&&(n.dependencies=e.dependencies),Cs|=n.lanes,(s&n.childLanes)===0)return null;if(e!==null&&n.child!==e.child)throw Error(r(153));if(n.child!==null){for(e=n.child,s=es(e,e.pendingProps),n.child=s,s.return=n;e.sibling!==null;)e=e.sibling,s=s.sibling=es(e,e.pendingProps),s.return=n;s.sibling=null}return n.child}function dv(e,n,s){switch(n.tag){case 3:Eh(n),sl();break;case 5:Wd(n);break;case 1:er(n.type)&&ca(n);break;case 4:uc(n,n.stateNode.containerInfo);break;case 10:var a=n.type._context,f=n.memoizedProps.value;dt(ma,a._currentValue),a._currentValue=f;break;case 13:if(a=n.memoizedState,a!==null)return a.dehydrated!==null?(dt(Ct,Ct.current&1),n.flags|=128,null):(s&n.child.childLanes)!==0?kh(e,n,s):(dt(Ct,Ct.current&1),e=xi(e,n,s),e!==null?e.sibling:null);dt(Ct,Ct.current&1);break;case 19:if(a=(s&n.childLanes)!==0,(e.flags&128)!==0){if(a)return Nh(e,n,s);n.flags|=128}if(f=n.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),dt(Ct,Ct.current),a)break;return null;case 22:case 23:return n.lanes=0,Sh(e,n,s)}return xi(e,n,s)}var Dh,Mc,Th,zh;Dh=function(e,n){for(var s=n.child;s!==null;){if(s.tag===5||s.tag===6)e.appendChild(s.stateNode);else if(s.tag!==4&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===n)break;for(;s.sibling===null;){if(s.return===null||s.return===n)return;s=s.return}s.sibling.return=s.return,s=s.sibling}},Mc=function(){},Th=function(e,n,s,a){var f=e.memoizedProps;if(f!==a){e=n.stateNode,_s(ii.current);var h=null;switch(s){case"input":f=It(e,f),a=It(e,a),h=[];break;case"select":f=X({},f,{value:void 0}),a=X({},a,{value:void 0}),h=[];break;case"textarea":f=rn(e,f),a=rn(e,a),h=[];break;default:typeof f.onClick!="function"&&typeof a.onClick=="function"&&(e.onclick=oa)}qr(s,a);var y;s=null;for(F in f)if(!a.hasOwnProperty(F)&&f.hasOwnProperty(F)&&f[F]!=null)if(F==="style"){var C=f[F];for(y in C)C.hasOwnProperty(y)&&(s||(s={}),s[y]="")}else F!=="dangerouslySetInnerHTML"&&F!=="children"&&F!=="suppressContentEditableWarning"&&F!=="suppressHydrationWarning"&&F!=="autoFocus"&&(o.hasOwnProperty(F)?h||(h=[]):(h=h||[]).push(F,null));for(F in a){var N=a[F];if(C=f!=null?f[F]:void 0,a.hasOwnProperty(F)&&N!==C&&(N!=null||C!=null))if(F==="style")if(C){for(y in C)!C.hasOwnProperty(y)||N&&N.hasOwnProperty(y)||(s||(s={}),s[y]="");for(y in N)N.hasOwnProperty(y)&&C[y]!==N[y]&&(s||(s={}),s[y]=N[y])}else s||(h||(h=[]),h.push(F,s)),s=N;else F==="dangerouslySetInnerHTML"?(N=N?N.__html:void 0,C=C?C.__html:void 0,N!=null&&C!==N&&(h=h||[]).push(F,N)):F==="children"?typeof N!="string"&&typeof N!="number"||(h=h||[]).push(F,""+N):F!=="suppressContentEditableWarning"&&F!=="suppressHydrationWarning"&&(o.hasOwnProperty(F)?(N!=null&&F==="onScroll"&&pt("scroll",e),h||C===N||(h=[])):(h=h||[]).push(F,N))}s&&(h=h||[]).push("style",s);var F=h;(n.updateQueue=F)&&(n.flags|=4)}},zh=function(e,n,s,a){s!==a&&(n.flags|=4)};function so(e,n){if(!St)switch(e.tailMode){case"hidden":n=e.tail;for(var s=null;n!==null;)n.alternate!==null&&(s=n),n=n.sibling;s===null?e.tail=null:s.sibling=null;break;case"collapsed":s=e.tail;for(var a=null;s!==null;)s.alternate!==null&&(a=s),s=s.sibling;a===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:a.sibling=null}}function bn(e){var n=e.alternate!==null&&e.alternate.child===e.child,s=0,a=0;if(n)for(var f=e.child;f!==null;)s|=f.lanes|f.childLanes,a|=f.subtreeFlags&14680064,a|=f.flags&14680064,f.return=e,f=f.sibling;else for(f=e.child;f!==null;)s|=f.lanes|f.childLanes,a|=f.subtreeFlags,a|=f.flags,f.return=e,f=f.sibling;return e.subtreeFlags|=a,e.childLanes=s,n}function hv(e,n,s){var a=n.pendingProps;switch(Zu(n),n.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return bn(n),null;case 1:return er(n.type)&&ua(),bn(n),null;case 3:return a=n.stateNode,ul(),gt(Zn),gt(zn),dc(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(pa(n)?n.flags|=4:e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,jr!==null&&(Bc(jr),jr=null))),Mc(e,n),bn(n),null;case 5:cc(n);var f=_s(eo.current);if(s=n.type,e!==null&&n.stateNode!=null)Th(e,n,s,a,f),e.ref!==n.ref&&(n.flags|=512,n.flags|=2097152);else{if(!a){if(n.stateNode===null)throw Error(r(166));return bn(n),null}if(e=_s(ii.current),pa(n)){a=n.stateNode,s=n.type;var h=n.memoizedProps;switch(a[ri]=n,a[Ql]=h,e=(n.mode&1)!==0,s){case"dialog":pt("cancel",a),pt("close",a);break;case"iframe":case"object":case"embed":pt("load",a);break;case"video":case"audio":for(f=0;f<\/script>",e=e.removeChild(e.firstChild)):typeof a.is=="string"?e=y.createElement(s,{is:a.is}):(e=y.createElement(s),s==="select"&&(y=e,a.multiple?y.multiple=!0:a.size&&(y.size=a.size))):e=y.createElementNS(e,s),e[ri]=n,e[Ql]=a,Dh(e,n,!1,!1),n.stateNode=e;e:{switch(y=Jr(s,a),s){case"dialog":pt("cancel",e),pt("close",e),f=a;break;case"iframe":case"object":case"embed":pt("load",e),f=a;break;case"video":case"audio":for(f=0;fhl&&(n.flags|=128,a=!0,so(h,!1),n.lanes=4194304)}else{if(!a)if(e=Sa(y),e!==null){if(n.flags|=128,a=!0,s=e.updateQueue,s!==null&&(n.updateQueue=s,n.flags|=4),so(h,!0),h.tail===null&&h.tailMode==="hidden"&&!y.alternate&&!St)return bn(n),null}else 2*ot()-h.renderingStartTime>hl&&s!==1073741824&&(n.flags|=128,a=!0,so(h,!1),n.lanes=4194304);h.isBackwards?(y.sibling=n.child,n.child=y):(s=h.last,s!==null?s.sibling=y:n.child=y,h.last=y)}return h.tail!==null?(n=h.tail,h.rendering=n,h.tail=n.sibling,h.renderingStartTime=ot(),n.sibling=null,s=Ct.current,dt(Ct,a?s&1|2:s&1),n):(bn(n),null);case 22:case 23:return Vc(),a=n.memoizedState!==null,e!==null&&e.memoizedState!==null!==a&&(n.flags|=8192),a&&(n.mode&1)!==0?(vr&1073741824)!==0&&(bn(n),n.subtreeFlags&6&&(n.flags|=8192)):bn(n),null;case 24:return null;case 25:return null}throw Error(r(156,n.tag))}function pv(e,n){switch(Zu(n),n.tag){case 1:return er(n.type)&&ua(),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return ul(),gt(Zn),gt(zn),dc(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 5:return cc(n),null;case 13:if(gt(Ct),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(r(340));sl()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return gt(Ct),null;case 4:return ul(),null;case 10:return sc(n.type._context),null;case 22:case 23:return Vc(),null;case 24:return null;default:return null}}var Ta=!1,On=!1,gv=typeof WeakSet=="function"?WeakSet:Set,we=null;function fl(e,n){var s=e.ref;if(s!==null)if(typeof s=="function")try{s(null)}catch(a){Tt(e,n,a)}else s.current=null}function bc(e,n,s){try{s()}catch(a){Tt(e,n,a)}}var Mh=!1;function mv(e,n){if(Vu=rt,e=Wn(),Bn(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{s=(s=e.ownerDocument)&&s.defaultView||window;var a=s.getSelection&&s.getSelection();if(a&&a.rangeCount!==0){s=a.anchorNode;var f=a.anchorOffset,h=a.focusNode;a=a.focusOffset;try{s.nodeType,h.nodeType}catch{s=null;break e}var y=0,C=-1,N=-1,F=0,J=0,te=e,Q=null;t:for(;;){for(var pe;te!==s||f!==0&&te.nodeType!==3||(C=y+f),te!==h||a!==0&&te.nodeType!==3||(N=y+a),te.nodeType===3&&(y+=te.nodeValue.length),(pe=te.firstChild)!==null;)Q=te,te=pe;for(;;){if(te===e)break t;if(Q===s&&++F===f&&(C=y),Q===h&&++J===a&&(N=y),(pe=te.nextSibling)!==null)break;te=Q,Q=te.parentNode}te=pe}s=C===-1||N===-1?null:{start:C,end:N}}else s=null}s=s||{start:0,end:0}}else s=null;for($u={focusedElem:e,selectionRange:s},rt=!1,we=n;we!==null;)if(n=we,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,we=e;else for(;we!==null;){n=we;try{var Se=n.alternate;if((n.flags&1024)!==0)switch(n.tag){case 0:case 11:case 15:break;case 1:if(Se!==null){var Ee=Se.memoizedProps,Lt=Se.memoizedState,O=n.stateNode,M=O.getSnapshotBeforeUpdate(n.elementType===n.type?Ee:Wr(n.type,Ee),Lt);O.__reactInternalSnapshotBeforeUpdate=M}break;case 3:var I=n.stateNode.containerInfo;I.nodeType===1?I.textContent="":I.nodeType===9&&I.documentElement&&I.removeChild(I.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(se){Tt(n,n.return,se)}if(e=n.sibling,e!==null){e.return=n.return,we=e;break}we=n.return}return Se=Mh,Mh=!1,Se}function lo(e,n,s){var a=n.updateQueue;if(a=a!==null?a.lastEffect:null,a!==null){var f=a=a.next;do{if((f.tag&e)===e){var h=f.destroy;f.destroy=void 0,h!==void 0&&bc(n,s,h)}f=f.next}while(f!==a)}}function za(e,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var s=n=n.next;do{if((s.tag&e)===e){var a=s.create;s.destroy=a()}s=s.next}while(s!==n)}}function Oc(e){var n=e.ref;if(n!==null){var s=e.stateNode;switch(e.tag){case 5:e=s;break;default:e=s}typeof n=="function"?n(e):n.current=e}}function bh(e){var n=e.alternate;n!==null&&(e.alternate=null,bh(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&(delete n[ri],delete n[Ql],delete n[Qu],delete n[Jm],delete n[Zm])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Oh(e){return e.tag===5||e.tag===3||e.tag===4}function Lh(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Oh(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.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Lc(e,n,s){var a=e.tag;if(a===5||a===6)e=e.stateNode,n?s.nodeType===8?s.parentNode.insertBefore(e,n):s.insertBefore(e,n):(s.nodeType===8?(n=s.parentNode,n.insertBefore(e,s)):(n=s,n.appendChild(e)),s=s._reactRootContainer,s!=null||n.onclick!==null||(n.onclick=oa));else if(a!==4&&(e=e.child,e!==null))for(Lc(e,n,s),e=e.sibling;e!==null;)Lc(e,n,s),e=e.sibling}function Pc(e,n,s){var a=e.tag;if(a===5||a===6)e=e.stateNode,n?s.insertBefore(e,n):s.appendChild(e);else if(a!==4&&(e=e.child,e!==null))for(Pc(e,n,s),e=e.sibling;e!==null;)Pc(e,n,s),e=e.sibling}var _n=null,Br=!1;function Qi(e,n,s){for(s=s.child;s!==null;)Ph(e,n,s),s=s.sibling}function Ph(e,n,s){if(Qn&&typeof Qn.onCommitFiberUnmount=="function")try{Qn.onCommitFiberUnmount(Di,s)}catch{}switch(s.tag){case 5:On||fl(s,n);case 6:var a=_n,f=Br;_n=null,Qi(e,n,s),_n=a,Br=f,_n!==null&&(Br?(e=_n,s=s.stateNode,e.nodeType===8?e.parentNode.removeChild(s):e.removeChild(s)):_n.removeChild(s.stateNode));break;case 18:_n!==null&&(Br?(e=_n,s=s.stateNode,e.nodeType===8?Ku(e.parentNode,s):e.nodeType===1&&Ku(e,s),Fi(e)):Ku(_n,s.stateNode));break;case 4:a=_n,f=Br,_n=s.stateNode.containerInfo,Br=!0,Qi(e,n,s),_n=a,Br=f;break;case 0:case 11:case 14:case 15:if(!On&&(a=s.updateQueue,a!==null&&(a=a.lastEffect,a!==null))){f=a=a.next;do{var h=f,y=h.destroy;h=h.tag,y!==void 0&&((h&2)!==0||(h&4)!==0)&&bc(s,n,y),f=f.next}while(f!==a)}Qi(e,n,s);break;case 1:if(!On&&(fl(s,n),a=s.stateNode,typeof a.componentWillUnmount=="function"))try{a.props=s.memoizedProps,a.state=s.memoizedState,a.componentWillUnmount()}catch(C){Tt(s,n,C)}Qi(e,n,s);break;case 21:Qi(e,n,s);break;case 22:s.mode&1?(On=(a=On)||s.memoizedState!==null,Qi(e,n,s),On=a):Qi(e,n,s);break;default:Qi(e,n,s)}}function Ah(e){var n=e.updateQueue;if(n!==null){e.updateQueue=null;var s=e.stateNode;s===null&&(s=e.stateNode=new gv),n.forEach(function(a){var f=kv.bind(null,e,a);s.has(a)||(s.add(a),a.then(f,f))})}}function Ur(e,n){var s=n.deletions;if(s!==null)for(var a=0;af&&(f=y),a&=~h}if(a=f,a=ot()-a,a=(120>a?120:480>a?480:1080>a?1080:1920>a?1920:3e3>a?3e3:4320>a?4320:1960*yv(a/1960))-a,10e?16:e,qi===null)var a=!1;else{if(e=qi,qi=null,Pa=0,(Ye&6)!==0)throw Error(r(331));var f=Ye;for(Ye|=4,we=e.current;we!==null;){var h=we,y=h.child;if((we.flags&16)!==0){var C=h.deletions;if(C!==null){for(var N=0;Not()-Hc?Rs(e,0):Ic|=s),rr(e,n)}function Qh(e,n){n===0&&((e.mode&1)===0?n=1:(n=Ti,Ti<<=1,(Ti&130023424)===0&&(Ti=4194304)));var s=Vn();e=wi(e,n),e!==null&&(Mi(e,n,s),rr(e,s))}function Cv(e){var n=e.memoizedState,s=0;n!==null&&(s=n.retryLane),Qh(e,s)}function kv(e,n){var s=0;switch(e.tag){case 13:var a=e.stateNode,f=e.memoizedState;f!==null&&(s=f.retryLane);break;case 19:a=e.stateNode;break;default:throw Error(r(314))}a!==null&&a.delete(n),Qh(e,s)}var Xh;Xh=function(e,n,s){if(e!==null)if(e.memoizedProps!==n.pendingProps||Zn.current)tr=!0;else{if((e.lanes&s)===0&&(n.flags&128)===0)return tr=!1,dv(e,n,s);tr=(e.flags&131072)!==0}else tr=!1,St&&(n.flags&1048576)!==0&&Td(n,ha,n.index);switch(n.lanes=0,n.tag){case 2:var a=n.type;Da(e,n),e=n.pendingProps;var f=nl(n,zn.current);al(n,s),f=gc(null,n,a,e,f,s);var h=mc();return n.flags|=1,typeof f=="object"&&f!==null&&typeof f.render=="function"&&f.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,er(a)?(h=!0,ca(n)):h=!1,n.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,ac(n),f.updater=Ra,n.stateNode=f,f._reactInternals=n,_c(n,a,e,s),n=Rc(null,n,a,!0,h,s)):(n.tag=0,St&&h&&Ju(n),Un(null,n,f,s),n=n.child),n;case 16:a=n.elementType;e:{switch(Da(e,n),e=n.pendingProps,f=a._init,a=f(a._payload),n.type=a,f=n.tag=Nv(a),e=Wr(a,e),f){case 0:n=kc(null,n,a,e,s);break e;case 1:n=_h(null,n,a,e,s);break e;case 11:n=vh(null,n,a,e,s);break e;case 14:n=yh(null,n,a,Wr(a.type,e),s);break e}throw Error(r(306,a,""))}return n;case 0:return a=n.type,f=n.pendingProps,f=n.elementType===a?f:Wr(a,f),kc(e,n,a,f,s);case 1:return a=n.type,f=n.pendingProps,f=n.elementType===a?f:Wr(a,f),_h(e,n,a,f,s);case 3:e:{if(Eh(n),e===null)throw Error(r(387));a=n.pendingProps,h=n.memoizedState,f=h.element,Hd(e,n),wa(n,a,null,s);var y=n.memoizedState;if(a=y.element,h.isDehydrated)if(h={element:a,isDehydrated:!1,cache:y.cache,pendingSuspenseBoundaries:y.pendingSuspenseBoundaries,transitions:y.transitions},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){f=cl(Error(r(423)),n),n=Ch(e,n,a,s,f);break e}else if(a!==f){f=cl(Error(r(424)),n),n=Ch(e,n,a,s,f);break e}else for(mr=Ui(n.stateNode.containerInfo.firstChild),gr=n,St=!0,jr=null,s=Ad(n,null,a,s),n.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(sl(),a===f){n=xi(e,n,s);break e}Un(e,n,a,s)}n=n.child}return n;case 5:return Wd(n),e===null&&tc(n),a=n.type,f=n.pendingProps,h=e!==null?e.memoizedProps:null,y=f.children,Gu(a,f)?y=null:h!==null&&Gu(a,h)&&(n.flags|=32),xh(e,n),Un(e,n,y,s),n.child;case 6:return e===null&&tc(n),null;case 13:return kh(e,n,s);case 4:return uc(n,n.stateNode.containerInfo),a=n.pendingProps,e===null?n.child=ll(n,null,a,s):Un(e,n,a,s),n.child;case 11:return a=n.type,f=n.pendingProps,f=n.elementType===a?f:Wr(a,f),vh(e,n,a,f,s);case 7:return Un(e,n,n.pendingProps,s),n.child;case 8:return Un(e,n,n.pendingProps.children,s),n.child;case 12:return Un(e,n,n.pendingProps.children,s),n.child;case 10:e:{if(a=n.type._context,f=n.pendingProps,h=n.memoizedProps,y=f.value,dt(ma,a._currentValue),a._currentValue=y,h!==null)if(at(h.value,y)){if(h.children===f.children&&!Zn.current){n=xi(e,n,s);break e}}else for(h=n.child,h!==null&&(h.return=n);h!==null;){var C=h.dependencies;if(C!==null){y=h.child;for(var N=C.firstContext;N!==null;){if(N.context===a){if(h.tag===1){N=Si(-1,s&-s),N.tag=2;var F=h.updateQueue;if(F!==null){F=F.shared;var J=F.pending;J===null?N.next=N:(N.next=J.next,J.next=N),F.pending=N}}h.lanes|=s,N=h.alternate,N!==null&&(N.lanes|=s),lc(h.return,s,n),C.lanes|=s;break}N=N.next}}else if(h.tag===10)y=h.type===n.type?null:h.child;else if(h.tag===18){if(y=h.return,y===null)throw Error(r(341));y.lanes|=s,C=y.alternate,C!==null&&(C.lanes|=s),lc(y,s,n),y=h.sibling}else y=h.child;if(y!==null)y.return=h;else for(y=h;y!==null;){if(y===n){y=null;break}if(h=y.sibling,h!==null){h.return=y.return,y=h;break}y=y.return}h=y}Un(e,n,f.children,s),n=n.child}return n;case 9:return f=n.type,a=n.pendingProps.children,al(n,s),f=zr(f),a=a(f),n.flags|=1,Un(e,n,a,s),n.child;case 14:return a=n.type,f=Wr(a,n.pendingProps),f=Wr(a.type,f),yh(e,n,a,f,s);case 15:return wh(e,n,n.type,n.pendingProps,s);case 17:return a=n.type,f=n.pendingProps,f=n.elementType===a?f:Wr(a,f),Da(e,n),n.tag=1,er(a)?(e=!0,ca(n)):e=!1,al(n,s),ch(n,a,f),_c(n,a,f,s),Rc(null,n,a,!0,e,s);case 19:return Nh(e,n,s);case 22:return Sh(e,n,s)}throw Error(r(156,n.tag))};function qh(e,n){return Mt(e,n)}function Rv(e,n,s,a){this.tag=e,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Or(e,n,s,a){return new Rv(e,n,s,a)}function Gc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Nv(e){if(typeof e=="function")return Gc(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ce)return 11;if(e===me)return 14}return 2}function es(e,n){var s=e.alternate;return s===null?(s=Or(e.tag,n,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=n,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=e.flags&14680064,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,n=e.dependencies,s.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s}function Fa(e,n,s,a,f,h){var y=2;if(a=e,typeof e=="function")Gc(e)&&(y=1);else if(typeof e=="string")y=5;else e:switch(e){case ee:return Ds(s.children,f,h,n);case re:y=8,f|=8;break;case ve:return e=Or(12,s,n,f|2),e.elementType=ve,e.lanes=h,e;case ae:return e=Or(13,s,n,f),e.elementType=ae,e.lanes=h,e;case ye:return e=Or(19,s,n,f),e.elementType=ye,e.lanes=h,e;case le:return ja(s,f,h,n);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case de:y=10;break e;case Y:y=9;break e;case Ce:y=11;break e;case me:y=14;break e;case De:y=16,a=null;break e}throw Error(r(130,e==null?e:typeof e,""))}return n=Or(y,s,n,f),n.elementType=e,n.type=a,n.lanes=h,n}function Ds(e,n,s,a){return e=Or(7,e,a,n),e.lanes=s,e}function ja(e,n,s,a){return e=Or(22,e,a,n),e.elementType=le,e.lanes=s,e.stateNode={isHidden:!1},e}function Yc(e,n,s){return e=Or(6,e,null,n),e.lanes=s,e}function Kc(e,n,s){return n=Or(4,e.children!==null?e.children:[],e.key,n),n.lanes=s,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function Dv(e,n,s,a,f){this.tag=n,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Al(0),this.expirationTimes=Al(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Al(0),this.identifierPrefix=a,this.onRecoverableError=f,this.mutableSourceEagerHydrationData=null}function Qc(e,n,s,a,f,h,y,C,N){return e=new Dv(e,n,s,C,N),n===1?(n=1,h===!0&&(n|=8)):n=0,h=Or(3,null,null,n),e.current=h,h.stateNode=e,h.memoizedState={element:a,isDehydrated:s,cache:null,transitions:null,pendingSuspenseBoundaries:null},ac(h),e}function Tv(e,n,s){var a=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l)}catch(t){console.error(t)}}return l(),tf.exports=Bv(),tf.exports}var fp;function Uv(){if(fp)return Ya;fp=1;var l=Rg();return Ya.createRoot=l.createRoot,Ya.hydrateRoot=l.hydrateRoot,Ya}var Vv=Uv();const $v=kg(Vv);var bs=Rg();const wu=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Nl(l){const t=Object.prototype.toString.call(l);return t==="[object Window]"||t==="[object global]"}function Ff(l){return"nodeType"in l}function Yn(l){var t,r;return l?Nl(l)?l:Ff(l)&&(t=(r=l.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function jf(l){const{Document:t}=Yn(l);return l instanceof t}function bo(l){return Nl(l)?!1:l instanceof Yn(l).HTMLElement}function Ng(l){return l instanceof Yn(l).SVGElement}function Dl(l){return l?Nl(l)?l.document:Ff(l)?jf(l)?l:bo(l)||Ng(l)?l.ownerDocument:document:document:document}const ki=wu?j.useLayoutEffect:j.useEffect;function Su(l){const t=j.useRef(l);return ki(()=>{t.current=l}),j.useCallback(function(){for(var r=arguments.length,i=new Array(r),o=0;o{l.current=setInterval(i,o)},[]),r=j.useCallback(()=>{l.current!==null&&(clearInterval(l.current),l.current=null)},[]);return[t,r]}function Ro(l,t){t===void 0&&(t=[l]);const r=j.useRef(l);return ki(()=>{r.current!==l&&(r.current=l)},t),r}function Oo(l,t){const r=j.useRef();return j.useMemo(()=>{const i=l(r.current);return r.current=i,i},[...t])}function iu(l){const t=Su(l),r=j.useRef(null),i=j.useCallback(o=>{o!==r.current&&(t==null||t(o,r.current)),r.current=o},[]);return[r,i]}function su(l){const t=j.useRef();return j.useEffect(()=>{t.current=l},[l]),t.current}let sf={};function xu(l,t){return j.useMemo(()=>{if(t)return t;const r=sf[l]==null?0:sf[l]+1;return sf[l]=r,l+"-"+r},[l,t])}function Dg(l){return function(t){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o{const d=Object.entries(c);for(const[p,m]of d){const w=u[p];w!=null&&(u[p]=w+l*m)}return u},{...t})}}const wl=Dg(1),lu=Dg(-1);function Yv(l){return"clientX"in l&&"clientY"in l}function Wf(l){if(!l)return!1;const{KeyboardEvent:t}=Yn(l.target);return t&&l instanceof t}function Kv(l){if(!l)return!1;const{TouchEvent:t}=Yn(l.target);return t&&l instanceof t}function ou(l){if(Kv(l)){if(l.touches&&l.touches.length){const{clientX:t,clientY:r}=l.touches[0];return{x:t,y:r}}else if(l.changedTouches&&l.changedTouches.length){const{clientX:t,clientY:r}=l.changedTouches[0];return{x:t,y:r}}}return Yv(l)?{x:l.clientX,y:l.clientY}:null}const No=Object.freeze({Translate:{toString(l){if(!l)return;const{x:t,y:r}=l;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(l){if(!l)return;const{scaleX:t,scaleY:r}=l;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(l){if(l)return[No.Translate.toString(l),No.Scale.toString(l)].join(" ")}},Transition:{toString(l){let{property:t,duration:r,easing:i}=l;return t+" "+r+"ms "+i}}}),dp="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Qv(l){return l.matches(dp)?l:l.querySelector(dp)}const Xv={display:"none"};function qv(l){let{id:t,value:r}=l;return ht.createElement("div",{id:t,style:Xv},r)}function Jv(l){let{id:t,announcement:r,ariaLiveType:i="assertive"}=l;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return ht.createElement("div",{id:t,style:o,role:"status","aria-live":i,"aria-atomic":!0},r)}function Zv(){const[l,t]=j.useState("");return{announce:j.useCallback(i=>{i!=null&&t(i)},[]),announcement:l}}const Tg=j.createContext(null);function ey(l){const t=j.useContext(Tg);j.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(l)},[l,t])}function ty(){const[l]=j.useState(()=>new Set),t=j.useCallback(i=>(l.add(i),()=>l.delete(i)),[l]);return[j.useCallback(i=>{let{type:o,event:u}=i;l.forEach(c=>{var d;return(d=c[o])==null?void 0:d.call(c,u)})},[l]),t]}const ny={draggable:` To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel. - `},ey={onDragStart(l){let{active:t}=l;return"Picked up draggable item "+t.id+"."},onDragOver(l){let{active:t,over:r}=l;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(l){let{active:t,over:r}=l;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(l){let{active:t}=l;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function ty(l){let{announcements:t=ey,container:r,hiddenTextDescribedById:i,screenReaderInstructions:o=Zv}=l;const{announce:u,announcement:f}=Xv(),d=xu("DndLiveRegion"),[p,m]=j.useState(!1);if(j.useEffect(()=>{m(!0)},[]),qv(j.useMemo(()=>({onDragStart(v){let{active:x}=v;u(t.onDragStart({active:x}))},onDragMove(v){let{active:x,over:z}=v;t.onDragMove&&u(t.onDragMove({active:x,over:z}))},onDragOver(v){let{active:x,over:z}=v;u(t.onDragOver({active:x,over:z}))},onDragEnd(v){let{active:x,over:z}=v;u(t.onDragEnd({active:x,over:z}))},onDragCancel(v){let{active:x,over:z}=v;u(t.onDragCancel({active:x,over:z}))}}),[u,t])),!p)return null;const w=ht.createElement(ht.Fragment,null,ht.createElement(Kv,{id:i,value:o.draggable}),ht.createElement(Qv,{id:d,announcement:f}));return r?bs.createPortal(w,r):w}var en;(function(l){l.DragStart="dragStart",l.DragMove="dragMove",l.DragEnd="dragEnd",l.DragCancel="dragCancel",l.DragOver="dragOver",l.RegisterDroppable="registerDroppable",l.SetDroppableDisabled="setDroppableDisabled",l.UnregisterDroppable="unregisterDroppable"})(en||(en={}));function au(){}function ny(l,t){return j.useMemo(()=>({sensor:l,options:t??{}}),[l,t])}function ry(){for(var l=arguments.length,t=new Array(l),r=0;r[...t].filter(i=>i!=null),[...t])}const Qr=Object.freeze({x:0,y:0});function iy(l,t){const r=ou(l);if(!r)return"0 0";const i={x:(r.x-t.left)/t.width*100,y:(r.y-t.top)/t.height*100};return i.x+"% "+i.y+"%"}function sy(l,t){let{data:{value:r}}=l,{data:{value:i}}=t;return i-r}function ly(l,t){if(!l||l.length===0)return null;const[r]=l;return r[t]}function oy(l,t){const r=Math.max(t.top,l.top),i=Math.max(t.left,l.left),o=Math.min(t.left+t.width,l.left+l.width),u=Math.min(t.top+t.height,l.top+l.height),f=o-i,d=u-r;if(i{let{collisionRect:t,droppableRects:r,droppableContainers:i}=l;const o=[];for(const u of i){const{id:f}=u,d=r.get(f);if(d){const p=oy(d,t);p>0&&o.push({id:f,data:{droppableContainer:u,value:p}})}}return o.sort(sy)};function uy(l,t,r){return{...l,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function zg(l,t){return l&&t?{x:l.left-t.left,y:l.top-t.top}:Qr}function cy(l){return function(r){for(var i=arguments.length,o=new Array(i>1?i-1:0),u=1;u({...f,top:f.top+l*d.y,bottom:f.bottom+l*d.y,left:f.left+l*d.x,right:f.right+l*d.x}),{...r})}}const fy=cy(1);function Mg(l){if(l.startsWith("matrix3d(")){const t=l.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(l.startsWith("matrix(")){const t=l.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function dy(l,t,r){const i=Mg(t);if(!i)return l;const{scaleX:o,scaleY:u,x:f,y:d}=i,p=l.left-f-(1-o)*parseFloat(r),m=l.top-d-(1-u)*parseFloat(r.slice(r.indexOf(" ")+1)),w=o?l.width/o:l.width,v=u?l.height/u:l.height;return{width:w,height:v,top:m,right:p+w,bottom:m+v,left:p}}const hy={ignoreTransform:!1};function Lo(l,t){t===void 0&&(t=hy);let r=l.getBoundingClientRect();if(t.ignoreTransform){const{transform:m,transformOrigin:w}=Yn(l).getComputedStyle(l);m&&(r=dy(r,m,w))}const{top:i,left:o,width:u,height:f,bottom:d,right:p}=r;return{top:i,left:o,width:u,height:f,bottom:d,right:p}}function hp(l){return Lo(l,{ignoreTransform:!0})}function py(l){const t=l.innerWidth,r=l.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function gy(l,t){return t===void 0&&(t=Yn(l).getComputedStyle(l)),t.position==="fixed"}function my(l,t){t===void 0&&(t=Yn(l).getComputedStyle(l));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const u=t[o];return typeof u=="string"?r.test(u):!1})}function Bf(l,t){const r=[];function i(o){if(t!=null&&r.length>=t||!o)return r;if(jf(o)&&o.scrollingElement!=null&&!r.includes(o.scrollingElement))return r.push(o.scrollingElement),r;if(!bo(o)||Ng(o)||r.includes(o))return r;const u=Yn(l).getComputedStyle(o);return o!==l&&my(o,u)&&r.push(o),gy(o,u)?r:i(o.parentNode)}return l?i(l):r}function bg(l){const[t]=Bf(l,1);return t??null}function lf(l){return!wu||!l?null:Nl(l)?l:Ff(l)?jf(l)||l===Dl(l).scrollingElement?window:bo(l)?l:null:null}function Og(l){return Nl(l)?l.scrollX:l.scrollLeft}function Lg(l){return Nl(l)?l.scrollY:l.scrollTop}function Ef(l){return{x:Og(l),y:Lg(l)}}var pn;(function(l){l[l.Forward=1]="Forward",l[l.Backward=-1]="Backward"})(pn||(pn={}));function Pg(l){return!wu||!l?!1:l===document.scrollingElement}function Ag(l){const t={x:0,y:0},r=Pg(l)?{height:window.innerHeight,width:window.innerWidth}:{height:l.clientHeight,width:l.clientWidth},i={x:l.scrollWidth-r.width,y:l.scrollHeight-r.height},o=l.scrollTop<=t.y,u=l.scrollLeft<=t.x,f=l.scrollTop>=i.y,d=l.scrollLeft>=i.x;return{isTop:o,isLeft:u,isBottom:f,isRight:d,maxScroll:i,minScroll:t}}const vy={x:.2,y:.2};function yy(l,t,r,i,o){let{top:u,left:f,right:d,bottom:p}=r;i===void 0&&(i=10),o===void 0&&(o=vy);const{isTop:m,isBottom:w,isLeft:v,isRight:x}=Ag(l),z={x:0,y:0},R={x:0,y:0},k={height:t.height*o.y,width:t.width*o.x};return!m&&u<=t.top+k.height?(z.y=pn.Backward,R.y=i*Math.abs((t.top+k.height-u)/k.height)):!w&&p>=t.bottom-k.height&&(z.y=pn.Forward,R.y=i*Math.abs((t.bottom-k.height-p)/k.height)),!x&&d>=t.right-k.width?(z.x=pn.Forward,R.x=i*Math.abs((t.right-k.width-d)/k.width)):!v&&f<=t.left+k.width&&(z.x=pn.Backward,R.x=i*Math.abs((t.left+k.width-f)/k.width)),{direction:z,speed:R}}function wy(l){if(l===document.scrollingElement){const{innerWidth:u,innerHeight:f}=window;return{top:0,left:0,right:u,bottom:f,width:u,height:f}}const{top:t,left:r,right:i,bottom:o}=l.getBoundingClientRect();return{top:t,left:r,right:i,bottom:o,width:l.clientWidth,height:l.clientHeight}}function Ig(l){return l.reduce((t,r)=>wl(t,Ef(r)),Qr)}function Sy(l){return l.reduce((t,r)=>t+Og(r),0)}function xy(l){return l.reduce((t,r)=>t+Lg(r),0)}function Hg(l,t){if(t===void 0&&(t=Lo),!l)return;const{top:r,left:i,bottom:o,right:u}=t(l);bg(l)&&(o<=0||u<=0||r>=window.innerHeight||i>=window.innerWidth)&&l.scrollIntoView({block:"center",inline:"center"})}const _y=[["x",["left","right"],Sy],["y",["top","bottom"],xy]];class Uf{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const i=Bf(r),o=Ig(i);this.rect={...t},this.width=t.width,this.height=t.height;for(const[u,f,d]of _y)for(const p of f)Object.defineProperty(this,p,{get:()=>{const m=d(i),w=o[u]-m;return this.rect[p]+w},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class So{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var i;return(i=this.target)==null?void 0:i.removeEventListener(...r)})},this.target=t}add(t,r,i){var o;(o=this.target)==null||o.addEventListener(t,r,i),this.listeners.push([t,r,i])}}function Ey(l){const{EventTarget:t}=Yn(l);return l instanceof t?l:Dl(l)}function of(l,t){const r=Math.abs(l.x),i=Math.abs(l.y);return typeof t=="number"?Math.sqrt(r**2+i**2)>t:"x"in t&&"y"in t?r>t.x&&i>t.y:"x"in t?r>t.x:"y"in t?i>t.y:!1}var Pr;(function(l){l.Click="click",l.DragStart="dragstart",l.Keydown="keydown",l.ContextMenu="contextmenu",l.Resize="resize",l.SelectionChange="selectionchange",l.VisibilityChange="visibilitychange"})(Pr||(Pr={}));function pp(l){l.preventDefault()}function Cy(l){l.stopPropagation()}var ut;(function(l){l.Space="Space",l.Down="ArrowDown",l.Right="ArrowRight",l.Left="ArrowLeft",l.Up="ArrowUp",l.Esc="Escape",l.Enter="Enter",l.Tab="Tab"})(ut||(ut={}));const Fg={start:[ut.Space,ut.Enter],cancel:[ut.Esc],end:[ut.Space,ut.Enter,ut.Tab]},ky=(l,t)=>{let{currentCoordinates:r}=t;switch(l.code){case ut.Right:return{...r,x:r.x+25};case ut.Left:return{...r,x:r.x-25};case ut.Down:return{...r,y:r.y+25};case ut.Up:return{...r,y:r.y-25}}};class jg{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:r}}=t;this.props=t,this.listeners=new So(Dl(r)),this.windowListeners=new So(Yn(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Pr.Resize,this.handleCancel),this.windowListeners.add(Pr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Pr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,i=t.node.current;i&&Hg(i),r(Qr)}handleKeyDown(t){if(Wf(t)){const{active:r,context:i,options:o}=this.props,{keyboardCodes:u=Fg,coordinateGetter:f=ky,scrollBehavior:d="smooth"}=o,{code:p}=t;if(u.end.includes(p)){this.handleEnd(t);return}if(u.cancel.includes(p)){this.handleCancel(t);return}const{collisionRect:m}=i.current,w=m?{x:m.left,y:m.top}:Qr;this.referenceCoordinates||(this.referenceCoordinates=w);const v=f(t,{active:r,context:i.current,currentCoordinates:w});if(v){const x=lu(v,w),z={x:0,y:0},{scrollableAncestors:R}=i.current;for(const k of R){const b=t.code,{isTop:B,isRight:P,isLeft:W,isBottom:V,maxScroll:Z,minScroll:G}=Ag(k),ee=wy(k),re={x:Math.min(b===ut.Right?ee.right-ee.width/2:ee.right,Math.max(b===ut.Right?ee.left:ee.left+ee.width/2,v.x)),y:Math.min(b===ut.Down?ee.bottom-ee.height/2:ee.bottom,Math.max(b===ut.Down?ee.top:ee.top+ee.height/2,v.y))},ve=b===ut.Right&&!P||b===ut.Left&&!W,de=b===ut.Down&&!V||b===ut.Up&&!B;if(ve&&re.x!==v.x){const Y=k.scrollLeft+x.x,Ce=b===ut.Right&&Y<=Z.x||b===ut.Left&&Y>=G.x;if(Ce&&!x.y){k.scrollTo({left:Y,behavior:d});return}Ce?z.x=k.scrollLeft-Y:z.x=b===ut.Right?k.scrollLeft-Z.x:k.scrollLeft-G.x,z.x&&k.scrollBy({left:-z.x,behavior:d});break}else if(de&&re.y!==v.y){const Y=k.scrollTop+x.y,Ce=b===ut.Down&&Y<=Z.y||b===ut.Up&&Y>=G.y;if(Ce&&!x.x){k.scrollTo({top:Y,behavior:d});return}Ce?z.y=k.scrollTop-Y:z.y=b===ut.Down?k.scrollTop-Z.y:k.scrollTop-G.y,z.y&&k.scrollBy({top:-z.y,behavior:d});break}}this.handleMove(t,wl(lu(v,this.referenceCoordinates),z))}}}handleMove(t,r){const{onMove:i}=this.props;t.preventDefault(),i(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}jg.activators=[{eventName:"onKeyDown",handler:(l,t,r)=>{let{keyboardCodes:i=Fg,onActivation:o}=t,{active:u}=r;const{code:f}=l.nativeEvent;if(i.start.includes(f)){const d=u.activatorNode.current;return d&&l.target!==d?!1:(l.preventDefault(),o==null||o({event:l.nativeEvent}),!0)}return!1}}];function gp(l){return!!(l&&"distance"in l)}function mp(l){return!!(l&&"delay"in l)}class Vf{constructor(t,r,i){var o;i===void 0&&(i=Ey(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;const{event:u}=t,{target:f}=u;this.props=t,this.events=r,this.document=Dl(f),this.documentListeners=new So(this.document),this.listeners=new So(i),this.windowListeners=new So(Yn(f)),this.initialCoordinates=(o=ou(u))!=null?o:Qr,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:i}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Pr.Resize,this.handleCancel),this.windowListeners.add(Pr.DragStart,pp),this.windowListeners.add(Pr.VisibilityChange,this.handleCancel),this.windowListeners.add(Pr.ContextMenu,pp),this.documentListeners.add(Pr.Keydown,this.handleKeydown),r){if(i!=null&&i({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(mp(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(gp(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,r){const{active:i,onPending:o}=this.props;o(i,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(Pr.Click,Cy,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Pr.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:i,initialCoordinates:o,props:u}=this,{onMove:f,options:{activationConstraint:d}}=u;if(!o)return;const p=(r=ou(t))!=null?r:Qr,m=lu(o,p);if(!i&&d){if(gp(d)){if(d.tolerance!=null&&of(m,d.tolerance))return this.handleCancel();if(of(m,d.distance))return this.handleStart()}if(mp(d)&&of(m,d.tolerance))return this.handleCancel();this.handlePending(d,m);return}t.cancelable&&t.preventDefault(),f(p)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===ut.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Ry={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class $f extends Vf{constructor(t){const{event:r}=t,i=Dl(r.target);super(t,Ry,i)}}$f.activators=[{eventName:"onPointerDown",handler:(l,t)=>{let{nativeEvent:r}=l,{onActivation:i}=t;return!r.isPrimary||r.button!==0?!1:(i==null||i({event:r}),!0)}}];const Ny={move:{name:"mousemove"},end:{name:"mouseup"}};var Cf;(function(l){l[l.RightClick=2]="RightClick"})(Cf||(Cf={}));class Dy extends Vf{constructor(t){super(t,Ny,Dl(t.event.target))}}Dy.activators=[{eventName:"onMouseDown",handler:(l,t)=>{let{nativeEvent:r}=l,{onActivation:i}=t;return r.button===Cf.RightClick?!1:(i==null||i({event:r}),!0)}}];const af={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Ty extends Vf{constructor(t){super(t,af)}static setup(){return window.addEventListener(af.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(af.move.name,t)};function t(){}}}Ty.activators=[{eventName:"onTouchStart",handler:(l,t)=>{let{nativeEvent:r}=l,{onActivation:i}=t;const{touches:o}=r;return o.length>1?!1:(i==null||i({event:r}),!0)}}];var xo;(function(l){l[l.Pointer=0]="Pointer",l[l.DraggableRect=1]="DraggableRect"})(xo||(xo={}));var uu;(function(l){l[l.TreeOrder=0]="TreeOrder",l[l.ReversedTreeOrder=1]="ReversedTreeOrder"})(uu||(uu={}));function zy(l){let{acceleration:t,activator:r=xo.Pointer,canScroll:i,draggingRect:o,enabled:u,interval:f=5,order:d=uu.TreeOrder,pointerCoordinates:p,scrollableAncestors:m,scrollableAncestorRects:w,delta:v,threshold:x}=l;const z=by({delta:v,disabled:!u}),[R,k]=Uv(),b=j.useRef({x:0,y:0}),B=j.useRef({x:0,y:0}),P=j.useMemo(()=>{switch(r){case xo.Pointer:return p?{top:p.y,bottom:p.y,left:p.x,right:p.x}:null;case xo.DraggableRect:return o}},[r,o,p]),W=j.useRef(null),V=j.useCallback(()=>{const G=W.current;if(!G)return;const ee=b.current.x*B.current.x,re=b.current.y*B.current.y;G.scrollBy(ee,re)},[]),Z=j.useMemo(()=>d===uu.TreeOrder?[...m].reverse():m,[d,m]);j.useEffect(()=>{if(!u||!m.length||!P){k();return}for(const G of Z){if((i==null?void 0:i(G))===!1)continue;const ee=m.indexOf(G),re=w[ee];if(!re)continue;const{direction:ve,speed:de}=yy(G,re,P,t,x);for(const Y of["x","y"])z[Y][ve[Y]]||(de[Y]=0,ve[Y]=0);if(de.x>0||de.y>0){k(),W.current=G,R(V,f),b.current=de,B.current=ve;return}}b.current={x:0,y:0},B.current={x:0,y:0},k()},[t,V,i,k,u,f,JSON.stringify(P),JSON.stringify(z),R,m,Z,w,JSON.stringify(x)])}const My={x:{[pn.Backward]:!1,[pn.Forward]:!1},y:{[pn.Backward]:!1,[pn.Forward]:!1}};function by(l){let{delta:t,disabled:r}=l;const i=su(t);return Oo(o=>{if(r||!i||!o)return My;const u={x:Math.sign(t.x-i.x),y:Math.sign(t.y-i.y)};return{x:{[pn.Backward]:o.x[pn.Backward]||u.x===-1,[pn.Forward]:o.x[pn.Forward]||u.x===1},y:{[pn.Backward]:o.y[pn.Backward]||u.y===-1,[pn.Forward]:o.y[pn.Forward]||u.y===1}}},[r,t,i])}function Oy(l,t){const r=t!=null?l.get(t):void 0,i=r?r.node.current:null;return Oo(o=>{var u;return t==null?null:(u=i??o)!=null?u:null},[i,t])}function Ly(l,t){return j.useMemo(()=>l.reduce((r,i)=>{const{sensor:o}=i,u=o.activators.map(f=>({eventName:f.eventName,handler:t(f.handler,i)}));return[...r,...u]},[]),[l,t])}var Do;(function(l){l[l.Always=0]="Always",l[l.BeforeDragging=1]="BeforeDragging",l[l.WhileDragging=2]="WhileDragging"})(Do||(Do={}));var kf;(function(l){l.Optimized="optimized"})(kf||(kf={}));const vp=new Map;function Py(l,t){let{dragging:r,dependencies:i,config:o}=t;const[u,f]=j.useState(null),{frequency:d,measure:p,strategy:m}=o,w=j.useRef(l),v=b(),x=Ro(v),z=j.useCallback(function(B){B===void 0&&(B=[]),!x.current&&f(P=>P===null?B:P.concat(B.filter(W=>!P.includes(W))))},[x]),R=j.useRef(null),k=Oo(B=>{if(v&&!r)return vp;if(!B||B===vp||w.current!==l||u!=null){const P=new Map;for(let W of l){if(!W)continue;if(u&&u.length>0&&!u.includes(W.id)&&W.rect.current){P.set(W.id,W.rect.current);continue}const V=W.node.current,Z=V?new Uf(p(V),V):null;W.rect.current=Z,Z&&P.set(W.id,Z)}return P}return B},[l,u,r,v,p]);return j.useEffect(()=>{w.current=l},[l]),j.useEffect(()=>{v||z()},[r,v]),j.useEffect(()=>{u&&u.length>0&&f(null)},[JSON.stringify(u)]),j.useEffect(()=>{v||typeof d!="number"||R.current!==null||(R.current=setTimeout(()=>{z(),R.current=null},d))},[d,v,z,...i]),{droppableRects:k,measureDroppableContainers:z,measuringScheduled:u!=null};function b(){switch(m){case Do.Always:return!1;case Do.BeforeDragging:return r;default:return!r}}}function Gf(l,t){return Oo(r=>l?r||(typeof t=="function"?t(l):l):null,[t,l])}function Ay(l,t){return Gf(l,t)}function Iy(l){let{callback:t,disabled:r}=l;const i=Su(t),o=j.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:u}=window;return new u(i)},[i,r]);return j.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function _u(l){let{callback:t,disabled:r}=l;const i=Su(t),o=j.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:u}=window;return new u(i)},[r]);return j.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function Hy(l){return new Uf(Lo(l),l)}function yp(l,t,r){t===void 0&&(t=Hy);const[i,o]=j.useState(null);function u(){o(p=>{if(!l)return null;if(l.isConnected===!1){var m;return(m=p??r)!=null?m:null}const w=t(l);return JSON.stringify(p)===JSON.stringify(w)?p:w})}const f=Iy({callback(p){if(l)for(const m of p){const{type:w,target:v}=m;if(w==="childList"&&v instanceof HTMLElement&&v.contains(l)){u();break}}}}),d=_u({callback:u});return ki(()=>{u(),l?(d==null||d.observe(l),f==null||f.observe(document.body,{childList:!0,subtree:!0})):(d==null||d.disconnect(),f==null||f.disconnect())},[l]),i}function Fy(l){const t=Gf(l);return zg(l,t)}const wp=[];function jy(l){const t=j.useRef(l),r=Oo(i=>l?i&&i!==wp&&l&&t.current&&l.parentNode===t.current.parentNode?i:Bf(l):wp,[l]);return j.useEffect(()=>{t.current=l},[l]),r}function Wy(l){const[t,r]=j.useState(null),i=j.useRef(l),o=j.useCallback(u=>{const f=lf(u.target);f&&r(d=>d?(d.set(f,Ef(f)),new Map(d)):null)},[]);return j.useEffect(()=>{const u=i.current;if(l!==u){f(u);const d=l.map(p=>{const m=lf(p);return m?(m.addEventListener("scroll",o,{passive:!0}),[m,Ef(m)]):null}).filter(p=>p!=null);r(d.length?new Map(d):null),i.current=l}return()=>{f(l),f(u)};function f(d){d.forEach(p=>{const m=lf(p);m==null||m.removeEventListener("scroll",o)})}},[o,l]),j.useMemo(()=>l.length?t?Array.from(t.values()).reduce((u,f)=>wl(u,f),Qr):Ig(l):Qr,[l,t])}function Sp(l,t){t===void 0&&(t=[]);const r=j.useRef(null);return j.useEffect(()=>{r.current=null},t),j.useEffect(()=>{const i=l!==Qr;i&&!r.current&&(r.current=l),!i&&r.current&&(r.current=null)},[l]),r.current?lu(l,r.current):Qr}function By(l){j.useEffect(()=>{if(!wu)return;const t=l.map(r=>{let{sensor:i}=r;return i.setup==null?void 0:i.setup()});return()=>{for(const r of t)r==null||r()}},l.map(t=>{let{sensor:r}=t;return r}))}function Uy(l,t){return j.useMemo(()=>l.reduce((r,i)=>{let{eventName:o,handler:u}=i;return r[o]=f=>{u(f,t)},r},{}),[l,t])}function Wg(l){return j.useMemo(()=>l?py(l):null,[l])}const xp=[];function Vy(l,t){t===void 0&&(t=Lo);const[r]=l,i=Wg(r?Yn(r):null),[o,u]=j.useState(xp);function f(){u(()=>l.length?l.map(p=>Pg(p)?i:new Uf(t(p),p)):xp)}const d=_u({callback:f});return ki(()=>{d==null||d.disconnect(),f(),l.forEach(p=>d==null?void 0:d.observe(p))},[l]),o}function Bg(l){if(!l)return null;if(l.children.length>1)return l;const t=l.children[0];return bo(t)?t:l}function $y(l){let{measure:t}=l;const[r,i]=j.useState(null),o=j.useCallback(m=>{for(const{target:w}of m)if(bo(w)){i(v=>{const x=t(w);return v?{...v,width:x.width,height:x.height}:x});break}},[t]),u=_u({callback:o}),f=j.useCallback(m=>{const w=Bg(m);u==null||u.disconnect(),w&&(u==null||u.observe(w)),i(w?t(w):null)},[t,u]),[d,p]=iu(f);return j.useMemo(()=>({nodeRef:d,rect:r,setRef:p}),[r,d,p])}const Gy=[{sensor:$f,options:{}},{sensor:jg,options:{}}],Yy={current:{}},qa={draggable:{measure:hp},droppable:{measure:hp,strategy:Do.WhileDragging,frequency:kf.Optimized},dragOverlay:{measure:Lo}};class _o extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,i;return(r=(i=this.get(t))==null?void 0:i.node.current)!=null?r:void 0}}const Ky={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new _o,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:au},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:qa,measureDroppableContainers:au,windowRect:null,measuringScheduled:!1},Ug={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:au,draggableNodes:new Map,over:null,measureDroppableContainers:au},Po=j.createContext(Ug),Vg=j.createContext(Ky);function Qy(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new _o}}}function Xy(l,t){switch(t.type){case en.DragStart:return{...l,draggable:{...l.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case en.DragMove:return l.draggable.active==null?l:{...l,draggable:{...l.draggable,translate:{x:t.coordinates.x-l.draggable.initialCoordinates.x,y:t.coordinates.y-l.draggable.initialCoordinates.y}}};case en.DragEnd:case en.DragCancel:return{...l,draggable:{...l.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case en.RegisterDroppable:{const{element:r}=t,{id:i}=r,o=new _o(l.droppable.containers);return o.set(i,r),{...l,droppable:{...l.droppable,containers:o}}}case en.SetDroppableDisabled:{const{id:r,key:i,disabled:o}=t,u=l.droppable.containers.get(r);if(!u||i!==u.key)return l;const f=new _o(l.droppable.containers);return f.set(r,{...u,disabled:o}),{...l,droppable:{...l.droppable,containers:f}}}case en.UnregisterDroppable:{const{id:r,key:i}=t,o=l.droppable.containers.get(r);if(!o||i!==o.key)return l;const u=new _o(l.droppable.containers);return u.delete(r),{...l,droppable:{...l.droppable,containers:u}}}default:return l}}function qy(l){let{disabled:t}=l;const{active:r,activatorEvent:i,draggableNodes:o}=j.useContext(Po),u=su(i),f=su(r==null?void 0:r.id);return j.useEffect(()=>{if(!t&&!i&&u&&f!=null){if(!Wf(u)||document.activeElement===u.target)return;const d=o.get(f);if(!d)return;const{activatorNode:p,node:m}=d;if(!p.current&&!m.current)return;requestAnimationFrame(()=>{for(const w of[p.current,m.current]){if(!w)continue;const v=Gv(w);if(v){v.focus();break}}})}},[i,t,o,f,u]),null}function $g(l,t){let{transform:r,...i}=t;return l!=null&&l.length?l.reduce((o,u)=>u({transform:o,...i}),r):r}function Jy(l){return j.useMemo(()=>({draggable:{...qa.draggable,...l==null?void 0:l.draggable},droppable:{...qa.droppable,...l==null?void 0:l.droppable},dragOverlay:{...qa.dragOverlay,...l==null?void 0:l.dragOverlay}}),[l==null?void 0:l.draggable,l==null?void 0:l.droppable,l==null?void 0:l.dragOverlay])}function Zy(l){let{activeNode:t,measure:r,initialRect:i,config:o=!0}=l;const u=j.useRef(!1),{x:f,y:d}=typeof o=="boolean"?{x:o,y:o}:o;ki(()=>{if(!f&&!d||!t){u.current=!1;return}if(u.current||!i)return;const m=t==null?void 0:t.node.current;if(!m||m.isConnected===!1)return;const w=r(m),v=zg(w,i);if(f||(v.x=0),d||(v.y=0),u.current=!0,Math.abs(v.x)>0||Math.abs(v.y)>0){const x=bg(m);x&&x.scrollBy({top:v.y,left:v.x})}},[t,f,d,i,r])}const Eu=j.createContext({...Qr,scaleX:1,scaleY:1});var ns;(function(l){l[l.Uninitialized=0]="Uninitialized",l[l.Initializing=1]="Initializing",l[l.Initialized=2]="Initialized"})(ns||(ns={}));const e0=j.memo(function(t){var r,i,o,u;let{id:f,accessibility:d,autoScroll:p=!0,children:m,sensors:w=Gy,collisionDetection:v=ay,measuring:x,modifiers:z,...R}=t;const k=j.useReducer(Xy,void 0,Qy),[b,B]=k,[P,W]=Jv(),[V,Z]=j.useState(ns.Uninitialized),G=V===ns.Initialized,{draggable:{active:ee,nodes:re,translate:ve},droppable:{containers:de}}=b,Y=ee!=null?re.get(ee):null,Ce=j.useRef({initial:null,translated:null}),ae=j.useMemo(()=>{var lt;return ee!=null?{id:ee,data:(lt=Y==null?void 0:Y.data)!=null?lt:Yy,rect:Ce}:null},[ee,Y]),ye=j.useRef(null),[me,De]=j.useState(null),[le,ie]=j.useState(null),oe=Ro(R,Object.values(R)),X=xu("DndDescribedBy",f),D=j.useMemo(()=>de.getEnabled(),[de]),H=Jy(x),{droppableRects:K,measureDroppableContainers:xe,measuringScheduled:be}=Py(D,{dragging:G,dependencies:[ve.x,ve.y],config:H.droppable}),ge=Oy(re,ee),_e=j.useMemo(()=>le?ou(le):null,[le]),He=zt(),Fe=Ay(ge,H.draggable.measure);Zy({activeNode:ee!=null?re.get(ee):null,config:He.layoutShiftCompensation,initialRect:Fe,measure:H.draggable.measure});const Oe=yp(ge,H.draggable.measure,Fe),$t=yp(ge?ge.parentElement:null),Pt=j.useRef({activatorEvent:null,active:null,activeNode:ge,collisionRect:null,collisions:null,droppableRects:K,draggableNodes:re,draggingNode:null,draggingNodeRect:null,droppableContainers:de,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),At=de.getNodeFor((r=Pt.current.over)==null?void 0:r.id),It=$y({measure:H.dragOverlay.measure}),Kn=(i=It.nodeRef.current)!=null?i:ge,Cn=G?(o=It.rect)!=null?o:Oe:null,_r=!!(It.nodeRef.current&&It.rect),Xr=Fy(_r?null:Oe),Pn=Wg(Kn?Yn(Kn):null),Ze=jy(G?At??ge:null),nn=Vy(Ze),rn=$g(z,{transform:{x:ve.x-Xr.x,y:ve.y-Xr.y,scaleX:1,scaleY:1},activatorEvent:le,active:ae,activeNodeRect:Oe,containerNodeRect:$t,draggingNodeRect:Cn,over:Pt.current.over,overlayNodeRect:It.rect,scrollableAncestors:Ze,scrollableAncestorRects:nn,windowRect:Pn}),sr=_e?wl(_e,ve):null,Pe=Wy(Ze),ce=Sp(Pe),qe=Sp(Pe,[Oe]),et=wl(rn,ce),sn=Cn?fy(Cn,rn):null,kn=ae&&sn?v({active:ae,collisionRect:sn,droppableRects:K,droppableContainers:D,pointerCoordinates:sr}):null,Gt=ly(kn,"id"),[Rt,ln]=j.useState(null),mn=_r?rn:wl(rn,qe),Yt=uy(mn,(u=Rt==null?void 0:Rt.rect)!=null?u:null,Oe),vn=j.useRef(null),qr=j.useCallback((lt,Kt)=>{let{sensor:on,options:ar}=Kt;if(ye.current==null)return;const yn=re.get(ye.current);if(!yn)return;const an=lt.nativeEvent,Rn=new on({active:ye.current,activeNode:yn,event:an,options:ar,context:Pt,onAbort(We){if(!re.get(We))return;const{onDragAbort:_t}=oe.current,un={id:We};_t==null||_t(un),P({type:"onDragAbort",event:un})},onPending(We,xt,_t,un){if(!re.get(We))return;const{onDragPending:Sn}=oe.current,Ht={id:We,constraint:xt,initialCoordinates:_t,offset:un};Sn==null||Sn(Ht),P({type:"onDragPending",event:Ht})},onStart(We){const xt=ye.current;if(xt==null)return;const _t=re.get(xt);if(!_t)return;const{onDragStart:un}=oe.current,vt={activatorEvent:an,active:{id:xt,data:_t.data,rect:Ce}};bs.unstable_batchedUpdates(()=>{un==null||un(vt),Z(ns.Initializing),B({type:en.DragStart,initialCoordinates:We,active:xt}),P({type:"onDragStart",event:vt}),De(vn.current),ie(an)})},onMove(We){B({type:en.DragMove,coordinates:We})},onEnd:wn(en.DragEnd),onCancel:wn(en.DragCancel)});vn.current=Rn;function wn(We){return async function(){const{active:_t,collisions:un,over:vt,scrollAdjustedTranslate:Sn}=Pt.current;let Ht=null;if(_t&&Sn){const{cancelDrop:Er}=oe.current;Ht={activatorEvent:an,active:_t,collisions:un,delta:Sn,over:vt},We===en.DragEnd&&typeof Er=="function"&&await Promise.resolve(Er(Ht))&&(We=en.DragCancel)}ye.current=null,bs.unstable_batchedUpdates(()=>{B({type:We}),Z(ns.Uninitialized),ln(null),De(null),ie(null),vn.current=null;const Er=We===en.DragEnd?"onDragEnd":"onDragCancel";if(Ht){const Ri=oe.current[Er];Ri==null||Ri(Ht),P({type:Er,event:Ht})}})}}},[re]),Jr=j.useCallback((lt,Kt)=>(on,ar)=>{const yn=on.nativeEvent,an=re.get(ar);if(ye.current!==null||!an||yn.dndKit||yn.defaultPrevented)return;const Rn={active:an};lt(on,Kt.options,Rn)===!0&&(yn.dndKit={capturedBy:Kt.sensor},ye.current=ar,qr(on,Kt))},[re,qr]),lr=Ly(w,Jr);By(w),ki(()=>{Oe&&V===ns.Initializing&&Z(ns.Initialized)},[Oe,V]),j.useEffect(()=>{const{onDragMove:lt}=oe.current,{active:Kt,activatorEvent:on,collisions:ar,over:yn}=Pt.current;if(!Kt||!on)return;const an={active:Kt,activatorEvent:on,collisions:ar,delta:{x:et.x,y:et.y},over:yn};bs.unstable_batchedUpdates(()=>{lt==null||lt(an),P({type:"onDragMove",event:an})})},[et.x,et.y]),j.useEffect(()=>{const{active:lt,activatorEvent:Kt,collisions:on,droppableContainers:ar,scrollAdjustedTranslate:yn}=Pt.current;if(!lt||ye.current==null||!Kt||!yn)return;const{onDragOver:an}=oe.current,Rn=ar.get(Gt),wn=Rn&&Rn.rect.current?{id:Rn.id,rect:Rn.rect.current,data:Rn.data,disabled:Rn.disabled}:null,We={active:lt,activatorEvent:Kt,collisions:on,delta:{x:yn.x,y:yn.y},over:wn};bs.unstable_batchedUpdates(()=>{ln(wn),an==null||an(We),P({type:"onDragOver",event:We})})},[Gt]),ki(()=>{Pt.current={activatorEvent:le,active:ae,activeNode:ge,collisionRect:sn,collisions:kn,droppableRects:K,draggableNodes:re,draggingNode:Kn,draggingNodeRect:Cn,droppableContainers:de,over:Rt,scrollableAncestors:Ze,scrollAdjustedTranslate:et},Ce.current={initial:Cn,translated:sn}},[ae,ge,kn,sn,re,Kn,Cn,K,de,Rt,Ze,et]),zy({...He,delta:ve,draggingRect:sn,pointerCoordinates:sr,scrollableAncestors:Ze,scrollableAncestorRects:nn});const or=j.useMemo(()=>({active:ae,activeNode:ge,activeNodeRect:Oe,activatorEvent:le,collisions:kn,containerNodeRect:$t,dragOverlay:It,draggableNodes:re,droppableContainers:de,droppableRects:K,over:Rt,measureDroppableContainers:xe,scrollableAncestors:Ze,scrollableAncestorRects:nn,measuringConfiguration:H,measuringScheduled:be,windowRect:Pn}),[ae,ge,Oe,le,kn,$t,It,re,de,K,Rt,xe,Ze,nn,H,be,Pn]),Zr=j.useMemo(()=>({activatorEvent:le,activators:lr,active:ae,activeNodeRect:Oe,ariaDescribedById:{draggable:X},dispatch:B,draggableNodes:re,over:Rt,measureDroppableContainers:xe}),[le,lr,ae,Oe,B,X,re,Rt,xe]);return ht.createElement(Tg.Provider,{value:W},ht.createElement(Po.Provider,{value:Zr},ht.createElement(Vg.Provider,{value:or},ht.createElement(Eu.Provider,{value:Yt},m)),ht.createElement(qy,{disabled:(d==null?void 0:d.restoreFocus)===!1})),ht.createElement(ty,{...d,hiddenTextDescribedById:X}));function zt(){const lt=(me==null?void 0:me.autoScrollEnabled)===!1,Kt=typeof p=="object"?p.enabled===!1:p===!1,on=G&&!lt&&!Kt;return typeof p=="object"?{...p,enabled:on}:{enabled:on}}}),t0=j.createContext(null),_p="button",n0="Draggable";function r0(l){let{id:t,data:r,disabled:i=!1,attributes:o}=l;const u=xu(n0),{activators:f,activatorEvent:d,active:p,activeNodeRect:m,ariaDescribedById:w,draggableNodes:v,over:x}=j.useContext(Po),{role:z=_p,roleDescription:R="draggable",tabIndex:k=0}=o??{},b=(p==null?void 0:p.id)===t,B=j.useContext(b?Eu:t0),[P,W]=iu(),[V,Z]=iu(),G=Uy(f,t),ee=Ro(r);ki(()=>(v.set(t,{id:t,key:u,node:P,activatorNode:V,data:ee}),()=>{const ve=v.get(t);ve&&ve.key===u&&v.delete(t)}),[v,t]);const re=j.useMemo(()=>({role:z,tabIndex:k,"aria-disabled":i,"aria-pressed":b&&z===_p?!0:void 0,"aria-roledescription":R,"aria-describedby":w.draggable}),[i,z,k,b,R,w.draggable]);return{active:p,activatorEvent:d,activeNodeRect:m,attributes:re,isDragging:b,listeners:i?void 0:G,node:P,over:x,setNodeRef:W,setActivatorNodeRef:Z,transform:B}}function i0(){return j.useContext(Vg)}const s0="Droppable",l0={timeout:25};function o0(l){let{data:t,disabled:r=!1,id:i,resizeObserverConfig:o}=l;const u=xu(s0),{active:f,dispatch:d,over:p,measureDroppableContainers:m}=j.useContext(Po),w=j.useRef({disabled:r}),v=j.useRef(!1),x=j.useRef(null),z=j.useRef(null),{disabled:R,updateMeasurementsFor:k,timeout:b}={...l0,...o},B=Ro(k??i),P=j.useCallback(()=>{if(!v.current){v.current=!0;return}z.current!=null&&clearTimeout(z.current),z.current=setTimeout(()=>{m(Array.isArray(B.current)?B.current:[B.current]),z.current=null},b)},[b]),W=_u({callback:P,disabled:R||!f}),V=j.useCallback((re,ve)=>{W&&(ve&&(W.unobserve(ve),v.current=!1),re&&W.observe(re))},[W]),[Z,G]=iu(V),ee=Ro(t);return j.useEffect(()=>{!W||!Z.current||(W.disconnect(),v.current=!1,W.observe(Z.current))},[Z,W]),j.useEffect(()=>(d({type:en.RegisterDroppable,element:{id:i,key:u,disabled:r,node:Z,rect:x,data:ee}}),()=>d({type:en.UnregisterDroppable,key:u,id:i})),[i]),j.useEffect(()=>{r!==w.current.disabled&&(d({type:en.SetDroppableDisabled,id:i,key:u,disabled:r}),w.current.disabled=r)},[i,u,r,d]),{active:f,rect:x,isOver:(p==null?void 0:p.id)===i,node:Z,over:p,setNodeRef:G}}function a0(l){let{animation:t,children:r}=l;const[i,o]=j.useState(null),[u,f]=j.useState(null),d=su(r);return!r&&!i&&d&&o(d),ki(()=>{if(!u)return;const p=i==null?void 0:i.key,m=i==null?void 0:i.props.id;if(p==null||m==null){o(null);return}Promise.resolve(t(m,u)).then(()=>{o(null)})},[t,i,u]),ht.createElement(ht.Fragment,null,r,i?j.cloneElement(i,{ref:f}):null)}const u0={x:0,y:0,scaleX:1,scaleY:1};function c0(l){let{children:t}=l;return ht.createElement(Po.Provider,{value:Ug},ht.createElement(Eu.Provider,{value:u0},t))}const f0={position:"fixed",touchAction:"none"},d0=l=>Wf(l)?"transform 250ms ease":void 0,h0=j.forwardRef((l,t)=>{let{as:r,activatorEvent:i,adjustScale:o,children:u,className:f,rect:d,style:p,transform:m,transition:w=d0}=l;if(!d)return null;const v=o?m:{...m,scaleX:1,scaleY:1},x={...f0,width:d.width,height:d.height,top:d.top,left:d.left,transform:No.Transform.toString(v),transformOrigin:o&&i?iy(i,d):void 0,transition:typeof w=="function"?w(i):w,...p};return ht.createElement(r,{className:f,style:x,ref:t},u)}),p0=l=>t=>{let{active:r,dragOverlay:i}=t;const o={},{styles:u,className:f}=l;if(u!=null&&u.active)for(const[d,p]of Object.entries(u.active))p!==void 0&&(o[d]=r.node.style.getPropertyValue(d),r.node.style.setProperty(d,p));if(u!=null&&u.dragOverlay)for(const[d,p]of Object.entries(u.dragOverlay))p!==void 0&&i.node.style.setProperty(d,p);return f!=null&&f.active&&r.node.classList.add(f.active),f!=null&&f.dragOverlay&&i.node.classList.add(f.dragOverlay),function(){for(const[p,m]of Object.entries(o))r.node.style.setProperty(p,m);f!=null&&f.active&&r.node.classList.remove(f.active)}},g0=l=>{let{transform:{initial:t,final:r}}=l;return[{transform:No.Transform.toString(t)},{transform:No.Transform.toString(r)}]},m0={duration:250,easing:"ease",keyframes:g0,sideEffects:p0({styles:{active:{opacity:"0"}}})};function v0(l){let{config:t,draggableNodes:r,droppableContainers:i,measuringConfiguration:o}=l;return Su((u,f)=>{if(t===null)return;const d=r.get(u);if(!d)return;const p=d.node.current;if(!p)return;const m=Bg(f);if(!m)return;const{transform:w}=Yn(f).getComputedStyle(f),v=Mg(w);if(!v)return;const x=typeof t=="function"?t:y0(t);return Hg(p,o.draggable.measure),x({active:{id:u,data:d.data,node:p,rect:o.draggable.measure(p)},draggableNodes:r,dragOverlay:{node:f,rect:o.dragOverlay.measure(m)},droppableContainers:i,measuringConfiguration:o,transform:v})})}function y0(l){const{duration:t,easing:r,sideEffects:i,keyframes:o}={...m0,...l};return u=>{let{active:f,dragOverlay:d,transform:p,...m}=u;if(!t)return;const w={x:d.rect.left-f.rect.left,y:d.rect.top-f.rect.top},v={scaleX:p.scaleX!==1?f.rect.width*p.scaleX/d.rect.width:1,scaleY:p.scaleY!==1?f.rect.height*p.scaleY/d.rect.height:1},x={x:p.x-w.x,y:p.y-w.y,...v},z=o({...m,active:f,dragOverlay:d,transform:{initial:p,final:x}}),[R]=z,k=z[z.length-1];if(JSON.stringify(R)===JSON.stringify(k))return;const b=i==null?void 0:i({active:f,dragOverlay:d,...m}),B=d.node.animate(z,{duration:t,easing:r,fill:"forwards"});return new Promise(P=>{B.onfinish=()=>{b==null||b(),P()}})}}let Ep=0;function w0(l){return j.useMemo(()=>{if(l!=null)return Ep++,Ep},[l])}const S0=ht.memo(l=>{let{adjustScale:t=!1,children:r,dropAnimation:i,style:o,transition:u,modifiers:f,wrapperElement:d="div",className:p,zIndex:m=999}=l;const{activatorEvent:w,active:v,activeNodeRect:x,containerNodeRect:z,draggableNodes:R,droppableContainers:k,dragOverlay:b,over:B,measuringConfiguration:P,scrollableAncestors:W,scrollableAncestorRects:V,windowRect:Z}=i0(),G=j.useContext(Eu),ee=w0(v==null?void 0:v.id),re=$g(f,{activatorEvent:w,active:v,activeNodeRect:x,containerNodeRect:z,draggingNodeRect:b.rect,over:B,overlayNodeRect:b.rect,scrollableAncestors:W,scrollableAncestorRects:V,transform:G,windowRect:Z}),ve=Gf(x),de=v0({config:i,draggableNodes:R,droppableContainers:k,measuringConfiguration:P}),Y=ve?b.setRef:void 0;return ht.createElement(c0,null,ht.createElement(a0,{animation:de},v&&ee?ht.createElement(h0,{key:ee,id:v.id,ref:Y,as:d,activatorEvent:w,adjustScale:t,className:p,transition:u,rect:ve,style:{zIndex:m,...o},transform:re},r):null))}),Cp=l=>{let t;const r=new Set,i=(m,w)=>{const v=typeof m=="function"?m(t):m;if(!Object.is(v,t)){const x=t;t=w??(typeof v!="object"||v===null)?v:Object.assign({},t,v),r.forEach(z=>z(t,x))}},o=()=>t,d={setState:i,getState:o,getInitialState:()=>p,subscribe:m=>(r.add(m),()=>r.delete(m))},p=t=l(i,o,d);return d},x0=(l=>l?Cp(l):Cp),_0=l=>l;function E0(l,t=_0){const r=ht.useSyncExternalStore(l.subscribe,ht.useCallback(()=>t(l.getState()),[l,t]),ht.useCallback(()=>t(l.getInitialState()),[l,t]));return ht.useDebugValue(r),r}const kp=l=>{const t=x0(l),r=i=>E0(t,i);return Object.assign(r,t),r},Gg=(l=>l?kp(l):kp),Yg="damiao.monitor.plotConfigs";function C0(){try{return JSON.parse(localStorage.getItem(Yg)||"{}")}catch{return{}}}function k0(l){try{localStorage.setItem(Yg,JSON.stringify(l))}catch{}}const gn=Gg((l,t)=>({connected:!1,status:null,signals:[],pairs:[],motors:[],motorTypes:[],plotConfigs:C0(),setConnected:r=>l({connected:r}),setStatus:r=>l({status:r}),setMeta:(r,i)=>l({signals:r,pairs:i}),setMotors:r=>l({motors:r}),setMotorTypes:r=>l({motorTypes:r}),ensurePlot:r=>l(i=>i.plotConfigs[r]?i:{plotConfigs:{...i.plotConfigs,[r]:{signals:[],duration:10}}}),setPlotConfig:(r,i)=>l(o=>({plotConfigs:{...o.plotConfigs,[r]:{...o.plotConfigs[r]||{signals:[],duration:10},...i}}})),addSignalToPlot:(r,i)=>l(o=>{const u=o.plotConfigs[r]||{signals:[],duration:10};return u.signals.includes(i)?o:{plotConfigs:{...o.plotConfigs,[r]:{...u,signals:[...u.signals,i]}}}}),removeSignalFromPlot:(r,i)=>l(o=>{const u=o.plotConfigs[r];return u?{plotConfigs:{...o.plotConfigs,[r]:{...u,signals:u.signals.filter(f=>f!==i)}}}:o}),dropPlot:r=>l(i=>{const o={...i.plotConfigs};return delete o[r],{plotConfigs:o}})}));gn.subscribe(l=>k0(l.plotConfigs));const Yf="damiao.monitor.widgets.v2";function R0(){try{const l=localStorage.getItem(Yf);if(!l)return null;const t=JSON.parse(l);return Array.isArray(t)&&t.length?t:null}catch{return null}}function uf(l){try{localStorage.setItem(Yf,JSON.stringify(l))}catch{}}const Rp=[{id:"plot-1",kind:"plot",x:0,y:0,w:7,h:6},{id:"cards-1",kind:"cards",x:7,y:0,w:5,h:6},{id:"table-1",kind:"table",x:0,y:6,w:7,h:5},{id:"rawlog-1",kind:"rawlog",x:7,y:6,w:5,h:5}];let Np=1;const Eo=Gg((l,t)=>({widgets:R0()||Rp,addWidget:r=>{Np+=1;const i=`${r}-${Date.now().toString(36)}-${Np}`,o=t().widgets.reduce((d,p)=>Math.max(d,p.y+p.h),0),u={id:i,kind:r,x:0,y:o,w:6,h:5},f=[...t().widgets,u];return uf(f),l({widgets:f}),i},removeWidget:r=>{const i=t().widgets.filter(o=>o.id!==r);uf(i),l({widgets:i})},updateGeom:r=>{const i=new Map(r.map(u=>[u.id,u])),o=t().widgets.map(u=>{const f=i.get(u.id);return f?{...u,x:f.x,y:f.y,w:f.w,h:f.h}:u});uf(o),l({widgets:o})},resetWidgets:()=>{try{localStorage.removeItem(Yf),localStorage.removeItem("damiao.monitor.plotConfigs")}catch{}l({widgets:Rp.map(r=>({...r}))})}})),N0=!0,tn="u-",D0="uplot",T0=tn+"hz",z0=tn+"vt",M0=tn+"title",b0=tn+"wrap",O0=tn+"under",L0=tn+"over",P0=tn+"axis",Ms=tn+"off",A0=tn+"select",I0=tn+"cursor-x",H0=tn+"cursor-y",F0=tn+"cursor-pt",j0=tn+"legend",W0=tn+"live",B0=tn+"inline",U0=tn+"series",V0=tn+"marker",Dp=tn+"label",$0=tn+"value",vo="width",yo="height",po="top",Tp="bottom",gl="left",cf="right",Kf="#000",zp=Kf+"0",ff="mousemove",Mp="mousedown",df="mouseup",bp="mouseenter",Op="mouseleave",Lp="dblclick",G0="resize",Y0="scroll",Pp="change",cu="dppxchange",Qf="--",Tl=typeof window<"u",Rf=Tl?document:null,Sl=Tl?window:null,K0=Tl?navigator:null;let Je,Ka;function Nf(){let l=devicePixelRatio;Je!=l&&(Je=l,Ka&&Tf(Pp,Ka,Nf),Ka=matchMedia(`(min-resolution: ${Je-.001}dppx) and (max-resolution: ${Je+.001}dppx)`),Os(Pp,Ka,Nf),Sl.dispatchEvent(new CustomEvent(cu)))}function wr(l,t){if(t!=null){let r=l.classList;!r.contains(t)&&r.add(t)}}function Df(l,t){let r=l.classList;r.contains(t)&&r.remove(t)}function mt(l,t,r){l.style[t]=r+"px"}function $r(l,t,r,i){let o=Rf.createElement(l);return t!=null&&wr(o,t),r!=null&&r.insertBefore(o,i),o}function Lr(l,t){return $r("div",l,t)}const Ap=new WeakMap;function oi(l,t,r,i,o){let u="translate("+t+"px,"+r+"px)",f=Ap.get(l);u!=f&&(l.style.transform=u,Ap.set(l,u),t<0||r<0||t>i||r>o?wr(l,Ms):Df(l,Ms))}const Ip=new WeakMap;function Hp(l,t,r){let i=t+r,o=Ip.get(l);i!=o&&(Ip.set(l,i),l.style.background=t,l.style.borderColor=r)}const Fp=new WeakMap;function jp(l,t,r,i){let o=t+""+r,u=Fp.get(l);o!=u&&(Fp.set(l,o),l.style.height=r+"px",l.style.width=t+"px",l.style.marginLeft=i?-t/2+"px":0,l.style.marginTop=i?-r/2+"px":0)}const Xf={passive:!0},Q0={...Xf,capture:!0};function Os(l,t,r,i){t.addEventListener(l,r,i?Q0:Xf)}function Tf(l,t,r,i){t.removeEventListener(l,r,Xf)}Tl&&Nf();function Gr(l,t,r,i){let o;r=r||0,i=i||t.length-1;let u=i<=2147483647;for(;i-r>1;)o=u?r+i>>1:Sr((r+i)/2),t[o]{let u=-1,f=-1;for(let d=i;d<=o;d++)if(l(r[d])){u=d;break}for(let d=o;d>=i;d--)if(l(r[d])){f=d;break}return[u,f]}}const Qg=l=>l!=null,Xg=l=>l!=null&&l>0,Cu=Kg(Qg),X0=Kg(Xg);function q0(l,t,r,i=0,o=!1){let u=o?X0:Cu,f=o?Xg:Qg;[t,r]=u(l,t,r);let d=l[t],p=l[t];if(t>-1)if(i==1)d=l[t],p=l[r];else if(i==-1)d=l[r],p=l[t];else for(let m=t;m<=r;m++){let w=l[m];f(w)&&(wp&&(p=w))}return[d??ct,p??-ct]}function ku(l,t,r,i){let o=Up(l),u=Up(t);l==t&&(o==-1?(l*=r,t/=r):(l/=r,t*=r));let f=r==10?Ei:qg,d=o==1?Sr:Ar,p=u==1?Ar:Sr,m=d(f(Zt(l))),w=p(f(Zt(t))),v=_l(r,m),x=_l(r,w);return r==10&&(m<0&&(v=ft(v,-m)),w<0&&(x=ft(x,-w))),i||r==2?(l=v*o,t=x*u):(l=tm(l,v),t=Ru(t,x)),[l,t]}function qf(l,t,r,i){let o=ku(l,t,r,i);return l==0&&(o[0]=0),t==0&&(o[1]=0),o}const Jf=.1,Wp={mode:3,pad:Jf},Co={pad:0,soft:null,mode:0},J0={min:Co,max:Co};function fu(l,t,r,i){return Nu(r)?Bp(l,t,r):(Co.pad=r,Co.soft=i?0:null,Co.mode=i?3:0,Bp(l,t,J0))}function Xe(l,t){return l??t}function Z0(l,t,r){for(t=Xe(t,0),r=Xe(r,l.length-1);t<=r;){if(l[t]!=null)return!0;t++}return!1}function Bp(l,t,r){let i=r.min,o=r.max,u=Xe(i.pad,0),f=Xe(o.pad,0),d=Xe(i.hard,-ct),p=Xe(o.hard,ct),m=Xe(i.soft,ct),w=Xe(o.soft,-ct),v=Xe(i.mode,0),x=Xe(o.mode,0),z=t-l,R=Ei(z),k=Gn(Zt(l),Zt(t)),b=Ei(k),B=Zt(b-R);(z<1e-24||B>10)&&(z=0,(l==0||t==0)&&(z=1e-24,v==2&&m!=ct&&(u=0),x==2&&w!=-ct&&(f=0)));let P=z||k||1e3,W=Ei(P),V=_l(10,Sr(W)),Z=P*(z==0?l==0?.1:1:u),G=ft(tm(l-Z,V/10),24),ee=l>=m&&(v==1||v==3&&G<=m||v==2&&G>=m)?m:ct,re=Gn(d,G=ee?ee:Yr(ee,G)),ve=P*(z==0?t==0?.1:1:f),de=ft(Ru(t+ve,V/10),24),Y=t<=w&&(x==1||x==3&&de>=w||x==2&&de<=w)?w:-ct,Ce=Yr(p,de>Y&&t<=Y?Y:Gn(Y,de));return re==Ce&&re==0&&(Ce=100),[re,Ce]}const ew=new Intl.NumberFormat(Tl?K0.language:"en-US"),Zf=l=>ew.format(l),xr=Math,Ja=xr.PI,Zt=xr.abs,Sr=xr.floor,Jt=xr.round,Ar=xr.ceil,Yr=xr.min,Gn=xr.max,_l=xr.pow,Up=xr.sign,Ei=xr.log10,qg=xr.log2,tw=(l,t=1)=>xr.sinh(l)*t,hf=(l,t=1)=>xr.asinh(l/t),ct=1/0;function Vp(l){return(Ei((l^l>>31)-(l>>31))|0)+1}function zf(l,t,r){return Yr(Gn(l,t),r)}function Jg(l){return typeof l=="function"}function Ve(l){return Jg(l)?l:()=>l}const nw=()=>{},Zg=l=>l,em=(l,t)=>t,rw=l=>null,$p=l=>!0,Gp=(l,t)=>l==t,iw=/\.\d*?(?=9{6,}|0{6,})/gm,Ps=l=>{if(rm(l)||is.has(l))return l;const t=`${l}`,r=t.match(iw);if(r==null)return l;let i=r[0].length-1;if(t.indexOf("e-")!=-1){let[o,u]=t.split("e");return+`${Ps(o)}e${u}`}return ft(l,i)};function Ts(l,t){return Ps(ft(Ps(l/t))*t)}function Ru(l,t){return Ps(Ar(Ps(l/t))*t)}function tm(l,t){return Ps(Sr(Ps(l/t))*t)}function ft(l,t=0){if(rm(l))return l;let r=10**t,i=l*r*(1+Number.EPSILON);return Jt(i)/r}const is=new Map;function nm(l){return((""+l).split(".")[1]||"").length}function To(l,t,r,i){let o=[],u=i.map(nm);for(let f=t;f=0?0:d)+(f>=u[m]?0:u[m]),x=l==10?w:ft(w,v);o.push(x),is.set(x,v)}}return o}const ko={},ed=[],El=[null,null],rs=Array.isArray,rm=Number.isInteger,sw=l=>l===void 0;function Yp(l){return typeof l=="string"}function Nu(l){let t=!1;if(l!=null){let r=l.constructor;t=r==null||r==Object}return t}function lw(l){return l!=null&&typeof l=="object"}const ow=Object.getPrototypeOf(Uint8Array),im="__proto__";function Cl(l,t=Nu){let r;if(rs(l)){let i=l.find(o=>o!=null);if(rs(i)||t(i)){r=Array(l.length);for(let o=0;ou){for(o=f-1;o>=0&&l[o]==null;)l[o--]=null;for(o=f+1;of-d)],o=i[0].length,u=new Map;for(let f=0;f"u"?l=>Promise.resolve().then(l):queueMicrotask;function pw(l){let t=l[0],r=t.length,i=Array(r);for(let u=0;ut[u]-t[f]);let o=[];for(let u=0;u=i&&l[o]==null;)o--;if(o<=i)return!0;const u=Gn(1,Sr((o-i+1)/t));for(let f=l[i],d=i+u;d<=o;d+=u){const p=l[d];if(p!=null){if(p<=f)return!1;f=p}}return!0}const sm=["January","February","March","April","May","June","July","August","September","October","November","December"],lm=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function om(l){return l.slice(0,3)}const vw=lm.map(om),yw=sm.map(om),ww={MMMM:sm,MMM:yw,WWWW:lm,WWW:vw};function go(l){return(l<10?"0":"")+l}function Sw(l){return(l<10?"00":l<100?"0":"")+l}const xw={YYYY:l=>l.getFullYear(),YY:l=>(l.getFullYear()+"").slice(2),MMMM:(l,t)=>t.MMMM[l.getMonth()],MMM:(l,t)=>t.MMM[l.getMonth()],MM:l=>go(l.getMonth()+1),M:l=>l.getMonth()+1,DD:l=>go(l.getDate()),D:l=>l.getDate(),WWWW:(l,t)=>t.WWWW[l.getDay()],WWW:(l,t)=>t.WWW[l.getDay()],HH:l=>go(l.getHours()),H:l=>l.getHours(),h:l=>{let t=l.getHours();return t==0?12:t>12?t-12:t},AA:l=>l.getHours()>=12?"PM":"AM",aa:l=>l.getHours()>=12?"pm":"am",a:l=>l.getHours()>=12?"p":"a",mm:l=>go(l.getMinutes()),m:l=>l.getMinutes(),ss:l=>go(l.getSeconds()),s:l=>l.getSeconds(),fff:l=>Sw(l.getMilliseconds())};function td(l,t){t=t||ww;let r=[],i=/\{([a-z]+)\}|[^{]+/gi,o;for(;o=i.exec(l);)r.push(o[0][0]=="{"?xw[o[1]]:o[0]);return u=>{let f="";for(let d=0;dl%1==0,du=[1,2,2.5,5],Cw=To(10,-32,0,du),um=To(10,0,32,du),kw=um.filter(am),zs=Cw.concat(um),nd=` -`,cm="{YYYY}",Kp=nd+cm,fm="{M}/{D}",wo=nd+fm,Qa=wo+"/{YY}",dm="{aa}",Rw="{h}:{mm}",vl=Rw+dm,Qp=nd+vl,Xp=":{ss}",nt=null;function hm(l){let t=l*1e3,r=t*60,i=r*60,o=i*24,u=o*30,f=o*365,p=(l==1?To(10,0,3,du).filter(am):To(10,-3,0,du)).concat([t,t*5,t*10,t*15,t*30,r,r*5,r*10,r*15,r*30,i,i*2,i*3,i*4,i*6,i*8,i*12,o,o*2,o*3,o*4,o*5,o*6,o*7,o*8,o*9,o*10,o*15,u,u*2,u*3,u*4,u*6,f,f*2,f*5,f*10,f*25,f*50,f*100]);const m=[[f,cm,nt,nt,nt,nt,nt,nt,1],[o*28,"{MMM}",Kp,nt,nt,nt,nt,nt,1],[o,fm,Kp,nt,nt,nt,nt,nt,1],[i,"{h}"+dm,Qa,nt,wo,nt,nt,nt,1],[r,vl,Qa,nt,wo,nt,nt,nt,1],[t,Xp,Qa+" "+vl,nt,wo+" "+vl,nt,Qp,nt,1],[l,Xp+".{fff}",Qa+" "+vl,nt,wo+" "+vl,nt,Qp,nt,1]];function w(v){return(x,z,R,k,b,B)=>{let P=[],W=b>=f,V=b>=u&&b=o?o:b,de=Sr(R)-Sr(G),Y=re+de+Ru(G-re,ve);P.push(Y);let Ce=v(Y),ae=Ce.getHours()+Ce.getMinutes()/r+Ce.getSeconds()/i,ye=b/i,me=x.axes[z]._space,De=B/me;for(;Y=ft(Y+b,l==1?0:3),!(Y>k);)if(ye>1){let le=Sr(ft(ae+ye,6))%24,X=v(Y).getHours()-le;X>1&&(X=-1),Y-=X*i,ae=(ae+ye)%24;let D=P[P.length-1];ft((Y-D)/b,3)*De>=.7&&P.push(Y)}else P.push(Y)}return P}}return[p,m,w]}const[Nw,Dw,Tw]=hm(1),[zw,Mw,bw]=hm(.001);To(2,-53,53,[1]);function qp(l,t){return l.map(r=>r.map((i,o)=>o==0||o==8||i==null?i:t(o==1||r[8]==0?i:r[1]+i)))}function Jp(l,t){return(r,i,o,u,f)=>{let d=t.find(R=>f>=R[0])||t[t.length-1],p,m,w,v,x,z;return i.map(R=>{let k=l(R),b=k.getFullYear(),B=k.getMonth(),P=k.getDate(),W=k.getHours(),V=k.getMinutes(),Z=k.getSeconds(),G=b!=p&&d[2]||B!=m&&d[3]||P!=w&&d[4]||W!=v&&d[5]||V!=x&&d[6]||Z!=z&&d[7]||d[1];return p=b,m=B,w=P,v=W,x=V,z=Z,G(k)})}}function Ow(l,t){let r=td(t);return(i,o,u,f,d)=>o.map(p=>r(l(p)))}function pf(l,t,r){return new Date(l,t,r)}function Zp(l,t){return t(l)}const Lw="{YYYY}-{MM}-{DD} {h}:{mm}{aa}";function eg(l,t){return(r,i,o,u)=>u==null?Qf:t(l(i))}function Pw(l,t){let r=l.series[t];return r.width?r.stroke(l,t):r.points.width?r.points.stroke(l,t):null}function Aw(l,t){return l.series[t].fill(l,t)}const Iw={show:!0,live:!0,isolate:!1,mount:nw,markers:{show:!0,width:2,stroke:Pw,fill:Aw,dash:"solid"},idx:null,idxs:null,values:[]};function Hw(l,t){let r=l.cursor.points,i=Lr(),o=r.size(l,t);mt(i,vo,o),mt(i,yo,o);let u=o/-2;mt(i,"marginLeft",u),mt(i,"marginTop",u);let f=r.width(l,t,o);return f&&mt(i,"borderWidth",f),i}function Fw(l,t){let r=l.series[t].points;return r._fill||r._stroke}function jw(l,t){let r=l.series[t].points;return r._stroke||r._fill}function Ww(l,t){return l.series[t].points.size}const gf=[0,0];function Bw(l,t,r){return gf[0]=t,gf[1]=r,gf}function Xa(l,t,r,i=!0){return o=>{o.button==0&&(!i||o.target==t)&&r(o)}}function mf(l,t,r,i=!0){return o=>{(!i||o.target==t)&&r(o)}}const Uw={show:!0,x:!0,y:!0,lock:!1,move:Bw,points:{one:!1,show:Hw,size:Ww,width:0,stroke:jw,fill:Fw},bind:{mousedown:Xa,mouseup:Xa,click:Xa,dblclick:Xa,mousemove:mf,mouseleave:mf,mouseenter:mf},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,click:(l,t)=>{t.stopPropagation(),t.stopImmediatePropagation()},_x:!1,_y:!1},focus:{dist:(l,t,r,i,o)=>i-o,prox:-1,bias:0},hover:{skip:[void 0],prox:null,bias:0},left:-10,top:-10,idx:null,dataIdx:null,idxs:null,event:null},pm={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},rd=Vt({},pm,{filter:em}),gm=Vt({},rd,{size:10}),mm=Vt({},pm,{show:!1}),id='12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',vm="bold "+id,ym=1.5,tg={show:!0,scale:"x",stroke:Kf,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:vm,side:2,grid:rd,ticks:gm,border:mm,font:id,lineGap:ym,rotate:0},Vw="Value",$w="Time",ng={show:!0,scale:"x",auto:!1,sorted:1,min:ct,max:-ct,idxs:[]};function Gw(l,t,r,i,o){return t.map(u=>u==null?"":Zf(u))}function Yw(l,t,r,i,o,u,f){let d=[],p=is.get(o)||0;r=f?r:ft(Ru(r,o),p);for(let m=r;m<=i;m=ft(m+o,p))d.push(Object.is(m,-0)?0:m);return d}function Mf(l,t,r,i,o,u,f){const d=[],p=l.scales[l.axes[t].scale].log,m=p==10?Ei:qg,w=Sr(m(r));o=_l(p,w),p==10&&(o=zs[Gr(o,zs)]);let v=r,x=o*p;p==10&&(x=zs[Gr(x,zs)]);do d.push(v),v=v+o,p==10&&!is.has(v)&&(v=ft(v,is.get(o))),v>=x&&(o=v,x=o*p,p==10&&(x=zs[Gr(x,zs)]));while(v<=i);return d}function Kw(l,t,r,i,o,u,f){let p=l.scales[l.axes[t].scale].asinh,m=i>p?Mf(l,t,Gn(p,r),i,o):[p],w=i>=0&&r<=0?[0]:[];return(r<-p?Mf(l,t,Gn(p,-i),-r,o):[p]).reverse().map(x=>-x).concat(w,m)}const wm=/./,Qw=/[12357]/,Xw=/[125]/,rg=/1/,bf=(l,t,r,i)=>l.map((o,u)=>t==4&&o==0||u%i==0&&r.test(o.toExponential()[o<0?1:0])?o:null);function qw(l,t,r,i,o){let u=l.axes[r],f=u.scale,d=l.scales[f],p=l.valToPos,m=u._space,w=p(10,f),v=p(9,f)-w>=m?wm:p(7,f)-w>=m?Qw:p(5,f)-w>=m?Xw:rg;if(v==rg){let x=Zt(p(1,f)-w);if(xo,lg={show:!0,auto:!0,sorted:0,gaps:Sm,alpha:1,facets:[Vt({},sg,{scale:"x"}),Vt({},sg,{scale:"y"})]},og={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:Sm,alpha:1,points:{show:t1,filter:null},values:null,min:ct,max:-ct,idxs:[],path:null,clip:null};function n1(l,t,r,i,o){return r/10}const xm={time:N0,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},r1=Vt({},xm,{time:!1,ori:1}),ag={};function _m(l,t){let r=ag[l];return r||(r={key:l,plots:[],sub(i){r.plots.push(i)},unsub(i){r.plots=r.plots.filter(o=>o!=i)},pub(i,o,u,f,d,p,m){for(let w=0;w{let B=f.pxRound;const P=m.dir*(m.ori==0?1:-1),W=m.ori==0?zl:Ml;let V,Z;P==1?(V=r,Z=i):(V=i,Z=r);let G=B(v(d[V],m,k,z)),ee=B(x(p[V],w,b,R)),re=B(v(d[Z],m,k,z)),ve=B(x(u==1?w.max:w.min,w,b,R)),de=new Path2D(o);return W(de,re,ve),W(de,G,ve),W(de,G,ee),de})}function Du(l,t,r,i,o,u){let f=null;if(l.length>0){f=new Path2D;const d=t==0?Mu:od;let p=r;for(let v=0;vx[0]){let z=x[0]-p;z>0&&d(f,p,i,z,i+u),p=x[1]}}let m=r+o-p,w=10;m>0&&d(f,p,i-w/2,m,i+u+w)}return f}function s1(l,t,r){let i=l[l.length-1];i&&i[0]==t?i[1]=r:l.push([t,r])}function ld(l,t,r,i,o,u,f){let d=[],p=l.length;for(let m=o==1?r:i;m>=r&&m<=i;m+=o)if(t[m]===null){let v=m,x=m;if(o==1)for(;++m<=i&&t[m]===null;)x=m;else for(;--m>=r&&t[m]===null;)x=m;let z=u(l[v]),R=x==v?z:u(l[x]),k=v-o;z=f<=0&&k>=0&&k=0&&B>=0&&B=z&&d.push([z,R])}return d}function ug(l){return l==0?Zg:l==1?Jt:t=>Ts(t,l)}function Em(l){let t=l==0?Tu:zu,r=l==0?(o,u,f,d,p,m)=>{o.arcTo(u,f,d,p,m)}:(o,u,f,d,p,m)=>{o.arcTo(f,u,p,d,m)},i=l==0?(o,u,f,d,p)=>{o.rect(u,f,d,p)}:(o,u,f,d,p)=>{o.rect(f,u,p,d)};return(o,u,f,d,p,m=0,w=0)=>{m==0&&w==0?i(o,u,f,d,p):(m=Yr(m,d/2,p/2),w=Yr(w,d/2,p/2),t(o,u+m,f),r(o,u+d,f,u+d,f+p,m),r(o,u+d,f+p,u,f+p,w),r(o,u,f+p,u,f,w),r(o,u,f,u+d,f,m),o.closePath())}}const Tu=(l,t,r)=>{l.moveTo(t,r)},zu=(l,t,r)=>{l.moveTo(r,t)},zl=(l,t,r)=>{l.lineTo(t,r)},Ml=(l,t,r)=>{l.lineTo(r,t)},Mu=Em(0),od=Em(1),Cm=(l,t,r,i,o,u)=>{l.arc(t,r,i,o,u)},km=(l,t,r,i,o,u)=>{l.arc(r,t,i,o,u)},Rm=(l,t,r,i,o,u,f)=>{l.bezierCurveTo(t,r,i,o,u,f)},Nm=(l,t,r,i,o,u,f)=>{l.bezierCurveTo(r,t,o,i,f,u)};function Dm(l){return(t,r,i,o,u)=>As(t,r,(f,d,p,m,w,v,x,z,R,k,b)=>{let{pxRound:B,points:P}=f,W,V;m.ori==0?(W=Tu,V=Cm):(W=zu,V=km);const Z=ft(P.width*Je,3);let G=(P.size-P.width)/2*Je,ee=ft(G*2,3),re=new Path2D,ve=new Path2D,{left:de,top:Y,width:Ce,height:ae}=t.bbox;Mu(ve,de-ee,Y-ee,Ce+ee*2,ae+ee*2);const ye=me=>{if(p[me]!=null){let De=B(v(d[me],m,k,z)),le=B(x(p[me],w,b,R));W(re,De+G,le),V(re,De,le,G,0,Ja*2)}};if(u)u.forEach(ye);else for(let me=i;me<=o;me++)ye(me);return{stroke:Z>0?re:null,fill:re,clip:ve,flags:kl|Of}})}function Tm(l){return(t,r,i,o,u,f)=>{i!=o&&(u!=i&&f!=i&&l(t,r,i),u!=o&&f!=o&&l(t,r,o),l(t,r,f))}}const l1=Tm(zl),o1=Tm(Ml);function zm(l){const t=Xe(l==null?void 0:l.alignGaps,0);return(r,i,o,u)=>As(r,i,(f,d,p,m,w,v,x,z,R,k,b)=>{[o,u]=Cu(p,o,u);let B=f.pxRound,P=ae=>B(v(ae,m,k,z)),W=ae=>B(x(ae,w,b,R)),V,Z;m.ori==0?(V=zl,Z=l1):(V=Ml,Z=o1);const G=m.dir*(m.ori==0?1:-1),ee={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:kl},re=ee.stroke;let ve=!1;if(u-o>=k*4){let ae=K=>r.posToVal(K,m.key,!0),ye=null,me=null,De,le,ie,oe=P(d[G==1?o:u]),X=P(d[o]),D=P(d[u]),H=ae(G==1?X+1:D-1);for(let K=G==1?o:u;K>=o&&K<=u;K+=G){let xe=d[K],ge=(G==1?xeH)?oe:P(xe),_e=p[K];ge==oe?_e!=null?(le=_e,ye==null?(V(re,ge,W(le)),De=ye=me=le):leme&&(me=le)):_e===null&&(ve=!0):(ye!=null&&Z(re,oe,W(ye),W(me),W(De),W(le)),_e!=null?(le=_e,V(re,ge,W(le)),ye=me=De=le):(ye=me=null,_e===null&&(ve=!0)),oe=ge,H=ae(oe+G))}ye!=null&&ye!=me&&ie!=oe&&Z(re,oe,W(ye),W(me),W(De),W(le))}else for(let ae=G==1?o:u;ae>=o&&ae<=u;ae+=G){let ye=p[ae];ye===null?ve=!0:ye!=null&&V(re,P(d[ae]),W(ye))}let[Y,Ce]=sd(r,i);if(f.fill!=null||Y!=0){let ae=ee.fill=new Path2D(re),ye=f.fillTo(r,i,f.min,f.max,Y),me=W(ye),De=P(d[o]),le=P(d[u]);G==-1&&([le,De]=[De,le]),V(ae,le,me),V(ae,De,me)}if(!f.spanGaps){let ae=[];ve&&ae.push(...ld(d,p,o,u,G,P,t)),ee.gaps=ae=f.gaps(r,i,o,u,ae),ee.clip=Du(ae,m.ori,z,R,k,b)}return Ce!=0&&(ee.band=Ce==2?[Ci(r,i,o,u,re,-1),Ci(r,i,o,u,re,1)]:Ci(r,i,o,u,re,Ce)),ee})}function a1(l){const t=Xe(l.align,1),r=Xe(l.ascDesc,!1),i=Xe(l.alignGaps,0),o=Xe(l.extend,!1);return(u,f,d,p)=>As(u,f,(m,w,v,x,z,R,k,b,B,P,W)=>{[d,p]=Cu(v,d,p);let V=m.pxRound,{left:Z,width:G}=u.bbox,ee=X=>V(R(X,x,P,b)),re=X=>V(k(X,z,W,B)),ve=x.ori==0?zl:Ml;const de={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:kl},Y=de.stroke,Ce=x.dir*(x.ori==0?1:-1);let ae=re(v[Ce==1?d:p]),ye=ee(w[Ce==1?d:p]),me=ye,De=ye;o&&t==-1&&(De=Z,ve(Y,De,ae)),ve(Y,ye,ae);for(let X=Ce==1?d:p;X>=d&&X<=p;X+=Ce){let D=v[X];if(D==null)continue;let H=ee(w[X]),K=re(D);t==1?ve(Y,H,ae):ve(Y,me,K),ve(Y,H,K),ae=K,me=H}let le=me;o&&t==1&&(le=Z+G,ve(Y,le,ae));let[ie,oe]=sd(u,f);if(m.fill!=null||ie!=0){let X=de.fill=new Path2D(Y),D=m.fillTo(u,f,m.min,m.max,ie),H=re(D);ve(X,le,H),ve(X,De,H)}if(!m.spanGaps){let X=[];X.push(...ld(w,v,d,p,Ce,ee,i));let D=m.width*Je/2,H=r||t==1?D:-D,K=r||t==-1?-D:D;X.forEach(xe=>{xe[0]+=H,xe[1]+=K}),de.gaps=X=m.gaps(u,f,d,p,X),de.clip=Du(X,x.ori,b,B,P,W)}return oe!=0&&(de.band=oe==2?[Ci(u,f,d,p,Y,-1),Ci(u,f,d,p,Y,1)]:Ci(u,f,d,p,Y,oe)),de})}function cg(l,t,r,i,o,u,f=ct){if(l.length>1){let d=null;for(let p=0,m=1/0;p{}),{fill:v,stroke:x}=m;return(z,R,k,b)=>As(z,R,(B,P,W,V,Z,G,ee,re,ve,de,Y)=>{let Ce=B.pxRound,ae=r,ye=i*Je,me=d*Je,De=p*Je,le,ie;V.ori==0?[le,ie]=u(z,R):[ie,le]=u(z,R);const oe=V.dir*(V.ori==0?1:-1);let X=V.ori==0?Mu:od,D=V.ori==0?w:(ce,qe,et,sn,kn,Gt,Rt)=>{w(ce,qe,et,kn,sn,Rt,Gt)},H=Xe(z.bands,ed).find(ce=>ce.series[0]==R),K=H!=null?H.dir:0,xe=B.fillTo(z,R,B.min,B.max,K),be=Ce(ee(xe,Z,Y,ve)),ge,_e,He,Fe=de,Oe=Ce(B.width*Je),$t=!1,Pt=null,At=null,It=null,Kn=null;v!=null&&(Oe==0||x!=null)&&($t=!0,Pt=v.values(z,R,k,b),At=new Map,new Set(Pt).forEach(ce=>{ce!=null&&At.set(ce,new Path2D)}),Oe>0&&(It=x.values(z,R,k,b),Kn=new Map,new Set(It).forEach(ce=>{ce!=null&&Kn.set(ce,new Path2D)})));let{x0:Cn,size:_r}=m;if(Cn!=null&&_r!=null){ae=1,P=Cn.values(z,R,k,b),Cn.unit==2&&(P=P.map(et=>z.posToVal(re+et*de,V.key,!0)));let ce=_r.values(z,R,k,b);_r.unit==2?_e=ce[0]*de:_e=G(ce[0],V,de,re)-G(0,V,de,re),Fe=cg(P,W,G,V,de,re,Fe),He=Fe-_e+ye}else Fe=cg(P,W,G,V,de,re,Fe),He=Fe*f+ye,_e=Fe-He;He<1&&(He=0),Oe>=_e/2&&(Oe=0),He<5&&(Ce=Zg);let Xr=He>0,Pn=Fe-He-(Xr?Oe:0);_e=Ce(zf(Pn,De,me)),ge=(ae==0?_e/2:ae==oe?0:_e)-ae*oe*((ae==0?ye/2:0)+(Xr?Oe/2:0));const Ze={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},nn=$t?null:new Path2D;let rn=null;if(H!=null)rn=z.data[H.series[1]];else{let{y0:ce,y1:qe}=m;ce!=null&&qe!=null&&(W=qe.values(z,R,k,b),rn=ce.values(z,R,k,b))}let sr=le*_e,Pe=ie*_e;for(let ce=oe==1?k:b;ce>=k&&ce<=b;ce+=oe){let qe=W[ce];if(qe==null)continue;if(rn!=null){let Yt=rn[ce]??0;if(qe-Yt==0)continue;be=ee(Yt,Z,Y,ve)}let et=V.distr!=2||m!=null?P[ce]:ce,sn=G(et,V,de,re),kn=ee(Xe(qe,xe),Z,Y,ve),Gt=Ce(sn-ge),Rt=Ce(Gn(kn,be)),ln=Ce(Yr(kn,be)),mn=Rt-ln;if(qe!=null){let Yt=qe<0?Pe:sr,vn=qe<0?sr:Pe;$t?(Oe>0&&It[ce]!=null&&X(Kn.get(It[ce]),Gt,ln+Sr(Oe/2),_e,Gn(0,mn-Oe),Yt,vn),Pt[ce]!=null&&X(At.get(Pt[ce]),Gt,ln+Sr(Oe/2),_e,Gn(0,mn-Oe),Yt,vn)):X(nn,Gt,ln+Sr(Oe/2),_e,Gn(0,mn-Oe),Yt,vn),D(z,R,ce,Gt-Oe/2,ln,_e+Oe,mn)}}return Oe>0?Ze.stroke=$t?Kn:nn:$t||(Ze._fill=B.width==0?B._fill:B._stroke??B._fill,Ze.width=0),Ze.fill=$t?At:nn,Ze})}function c1(l,t){const r=Xe(t==null?void 0:t.alignGaps,0);return(i,o,u,f)=>As(i,o,(d,p,m,w,v,x,z,R,k,b,B)=>{[u,f]=Cu(m,u,f);let P=d.pxRound,W=le=>P(x(le,w,b,R)),V=le=>P(z(le,v,B,k)),Z,G,ee;w.ori==0?(Z=Tu,ee=zl,G=Rm):(Z=zu,ee=Ml,G=Nm);const re=w.dir*(w.ori==0?1:-1);let ve=W(p[re==1?u:f]),de=ve,Y=[],Ce=[];for(let le=re==1?u:f;le>=u&&le<=f;le+=re)if(m[le]!=null){let oe=p[le],X=W(oe);Y.push(de=X),Ce.push(V(m[le]))}const ae={stroke:l(Y,Ce,Z,ee,G,P),fill:null,clip:null,band:null,gaps:null,flags:kl},ye=ae.stroke;let[me,De]=sd(i,o);if(d.fill!=null||me!=0){let le=ae.fill=new Path2D(ye),ie=d.fillTo(i,o,d.min,d.max,me),oe=V(ie);ee(le,de,oe),ee(le,ve,oe)}if(!d.spanGaps){let le=[];le.push(...ld(p,m,u,f,re,W,r)),ae.gaps=le=d.gaps(i,o,u,f,le),ae.clip=Du(le,w.ori,R,k,b,B)}return De!=0&&(ae.band=De==2?[Ci(i,o,u,f,ye,-1),Ci(i,o,u,f,ye,1)]:Ci(i,o,u,f,ye,De)),ae})}function f1(l){return c1(d1,l)}function d1(l,t,r,i,o,u){const f=l.length;if(f<2)return null;const d=new Path2D;if(r(d,l[0],t[0]),f==2)i(d,l[1],t[1]);else{let p=Array(f),m=Array(f-1),w=Array(f-1),v=Array(f-1);for(let x=0;x0!=m[x]>0?p[x]=0:(p[x]=3*(v[x-1]+v[x])/((2*v[x]+v[x-1])/m[x-1]+(v[x]+2*v[x-1])/m[x]),isFinite(p[x])||(p[x]=0));p[f-1]=m[f-2];for(let x=0;x{Ln.pxRatio=Je}));const h1=zm(),p1=Dm();function dg(l,t,r,i){return(i?[l[0],l[1]].concat(l.slice(2)):[l[0]].concat(l.slice(1))).map((u,f)=>Pf(u,f,t,r))}function g1(l,t){return l.map((r,i)=>i==0?{}:Vt({},t,r))}function Pf(l,t,r,i){return Vt({},t==0?r:i,l)}function Mm(l,t,r){return t==null?El:[t,r]}const m1=Mm;function v1(l,t,r){return t==null?El:fu(t,r,Jf,!0)}function bm(l,t,r,i){return t==null?El:ku(t,r,l.scales[i].log,!1)}const y1=bm;function Om(l,t,r,i){return t==null?El:qf(t,r,l.scales[i].log,!1)}const w1=Om;function S1(l,t,r,i,o){let u=Gn(Vp(l),Vp(t)),f=t-l,d=Gr(o/i*f,r);do{let p=r[d],m=i*p/f;if(m>=o&&u+(p<5?is.get(p):0)<=17)return[p,m]}while(++d(t=Jt((r=+o)*Je))+"px"),[l,t,r]}function x1(l){l.show&&[l.font,l.labelFont].forEach(t=>{let r=ft(t[2]*Je,1);t[0]=t[0].replace(/[0-9.]+px/,r+"px"),t[1]=r})}function Ln(l,t,r){const i={mode:Xe(l.mode,1)},o=i.mode;function u(g,S,_,E){let T=S.valToPct(g);return E+_*(S.dir==-1?1-T:T)}function f(g,S,_,E){let T=S.valToPct(g);return E+_*(S.dir==-1?T:1-T)}function d(g,S,_,E){return S.ori==0?u(g,S,_,E):f(g,S,_,E)}i.valToPosH=u,i.valToPosV=f;let p=!1;i.status=0;const m=i.root=Lr(D0);if(l.id!=null&&(m.id=l.id),wr(m,l.class),l.title){let g=Lr(M0,m);g.textContent=l.title}const w=$r("canvas"),v=i.ctx=w.getContext("2d"),x=Lr(b0,m);Os("click",x,g=>{g.target===R&&(Ke!=fi||rt!=Ii)&&Qt.click(i,g)},!0);const z=i.under=Lr(O0,x);x.appendChild(w);const R=i.over=Lr(L0,x);l=Cl(l);const k=+Xe(l.pxAlign,1),b=ug(k);(l.plugins||[]).forEach(g=>{g.opts&&(l=g.opts(i,l)||l)});const B=l.ms||.001,P=i.series=o==1?dg(l.series||[],ng,og,!1):g1(l.series||[null],lg),W=i.axes=dg(l.axes||[],tg,ig,!0),V=i.scales={},Z=i.bands=l.bands||[];Z.forEach(g=>{g.fill=Ve(g.fill||null),g.dir=Xe(g.dir,-1)});const G=o==2?P[1].facets[0].scale:P[0].scale,ee={axes:Bo,series:Au},re=(l.drawOrder||["axes","series"]).map(g=>ee[g]);function ve(g){const S=g.distr==3?_=>Ei(_>0?_:g.clamp(i,_,g.min,g.max,g.key)):g.distr==4?_=>hf(_,g.asinh):g.distr==100?_=>g.fwd(_):_=>_;return _=>{let E=S(_),{_min:T,_max:L}=g,$=L-T;return(E-T)/$}}function de(g){let S=V[g];if(S==null){let _=(l.scales||ko)[g]||ko;if(_.from!=null){de(_.from);let E=Vt({},V[_.from],_,{key:g});E.valToPct=ve(E),V[g]=E}else{S=V[g]=Vt({},g==G?xm:r1,_),S.key=g;let E=S.time,T=S.range,L=rs(T);if((g!=G||o==2&&!E)&&(L&&(T[0]==null||T[1]==null)&&(T={min:T[0]==null?Wp:{mode:1,hard:T[0],soft:T[0]},max:T[1]==null?Wp:{mode:1,hard:T[1],soft:T[1]}},L=!1),!L&&Nu(T))){let $=T;T=(q,ne,ue)=>ne==null?El:fu(ne,ue,$)}S.range=Ve(T||(E?m1:g==G?S.distr==3?y1:S.distr==4?w1:Mm:S.distr==3?bm:S.distr==4?Om:v1)),S.auto=Ve(L?!1:S.auto),S.clamp=Ve(S.clamp||n1),S._min=S._max=null,S.valToPct=ve(S)}}}de("x"),de("y"),o==1&&P.forEach(g=>{de(g.scale)}),W.forEach(g=>{de(g.scale)});for(let g in l.scales)de(g);const Y=V[G],Ce=Y.distr;let ae,ye;Y.ori==0?(wr(m,T0),ae=u,ye=f):(wr(m,z0),ae=f,ye=u);const me={};for(let g in V){let S=V[g];(S.min!=null||S.max!=null)&&(me[g]={min:S.min,max:S.max},S.min=S.max=null)}const De=l.tzDate||(g=>new Date(Jt(g/B))),le=l.fmtDate||td,ie=B==1?Tw(De):bw(De),oe=Jp(De,qp(B==1?Dw:Mw,le)),X=eg(De,Zp(Lw,le)),D=[],H=i.legend=Vt({},Iw,l.legend),K=i.cursor=Vt({},Uw,{drag:{y:o==2}},l.cursor),xe=H.show,be=K.show,ge=H.markers;H.idxs=D,ge.width=Ve(ge.width),ge.dash=Ve(ge.dash),ge.stroke=Ve(ge.stroke),ge.fill=Ve(ge.fill);let _e,He,Fe,Oe=[],$t=[],Pt,At=!1,It={};if(H.live){const g=P[1]?P[1].values:null;At=g!=null,Pt=At?g(i,1,0):{_:0};for(let S in Pt)It[S]=Qf}if(xe)if(_e=$r("table",j0,m),Fe=$r("tbody",null,_e),H.mount(i,_e),At){He=$r("thead",null,_e,Fe);let g=$r("tr",null,He);$r("th",null,g);for(var Kn in Pt)$r("th",Dp,g).textContent=Kn}else wr(_e,B0),H.live&&wr(_e,W0);const Cn={show:!0},_r={show:!1};function Xr(g,S){if(S==0&&(At||!H.live||o==2))return El;let _=[],E=$r("tr",U0,Fe,Fe.childNodes[S]);wr(E,g.class),g.show||wr(E,Ms);let T=$r("th",null,E);if(ge.show){let q=Lr(V0,T);if(S>0){let ne=ge.width(i,S);ne&&(q.style.border=ne+"px "+ge.dash(i,S)+" "+ge.stroke(i,S)),q.style.background=ge.fill(i,S)}}let L=Lr(Dp,T);g.label instanceof HTMLElement?L.appendChild(g.label):L.textContent=g.label,S>0&&(ge.show||(L.style.color=g.width>0?ge.stroke(i,S):ge.fill(i,S)),Ze("click",T,q=>{if(K._lock)return;wn(q);let ne=P.indexOf(g);if((q.ctrlKey||q.metaKey)!=H.isolate){let ue=P.some((fe,he)=>he>0&&he!=ne&&fe.show);P.forEach((fe,he)=>{he>0&&dr(he,ue?he==ne?Cn:_r:Cn,!0,Dt.setSeries)})}else dr(ne,{show:!g.show},!0,Dt.setSeries)},!1),_t&&Ze(bp,T,q=>{K._lock||(wn(q),dr(P.indexOf(g),ji,!0,Dt.setSeries))},!1));for(var $ in Pt){let q=$r("td",$0,E);q.textContent="--",_.push(q)}return[E,_]}const Pn=new Map;function Ze(g,S,_,E=!0){const T=Pn.get(S)||{},L=K.bind[g](i,S,_,E);L&&(Os(g,S,T[g]=L),Pn.set(S,T))}function nn(g,S,_){const E=Pn.get(S)||{};for(let T in E)(g==null||T==g)&&(Tf(T,S,E[T]),delete E[T]);g==null&&Pn.delete(S)}let rn=0,sr=0,Pe=0,ce=0,qe=0,et=0,sn=qe,kn=et,Gt=Pe,Rt=ce,ln=0,mn=0,Yt=0,vn=0;i.bbox={};let qr=!1,Jr=!1,lr=!1,or=!1,Zr=!1,zt=!1;function lt(g,S,_){(_||g!=i.width||S!=i.height)&&Kt(g,S),ci(!1),lr=!0,Jr=!0,Hn()}function Kt(g,S){i.width=rn=Pe=g,i.height=sr=ce=S,qe=et=0,an(),Rn();let _=i.bbox;ln=_.left=Ts(qe*Je,.5),mn=_.top=Ts(et*Je,.5),Yt=_.width=Ts(Pe*Je,.5),vn=_.height=Ts(ce*Je,.5)}const on=3;function ar(){let g=!1,S=0;for(;!g;){S++;let _=Hl(S),E=Wo(S);g=S==on||_&&E,g||(Kt(i.width,i.height),Jr=!0)}}function yn({width:g,height:S}){lt(g,S)}i.setSize=yn;function an(){let g=!1,S=!1,_=!1,E=!1;W.forEach((T,L)=>{if(T.show&&T._show){let{side:$,_size:q}=T,ne=$%2,ue=T.label!=null?T.labelSize:0,fe=q+ue;fe>0&&(ne?(Pe-=fe,$==3?(qe+=fe,E=!0):_=!0):(ce-=fe,$==0?(et+=fe,g=!0):S=!0))}}),An[0]=g,An[1]=_,An[2]=S,An[3]=E,Pe-=Ir[1]+Ir[3],qe+=Ir[3],ce-=Ir[2]+Ir[0],et+=Ir[0]}function Rn(){let g=qe+Pe,S=et+ce,_=qe,E=et;function T(L,$){switch(L){case 1:return g+=$,g-$;case 2:return S+=$,S-$;case 3:return _-=$,_+$;case 0:return E-=$,E+$}}W.forEach((L,$)=>{if(L.show&&L._show){let q=L.side;L._pos=T(q,L._size),L.label!=null&&(L._lpos=T(q,L.labelSize))}})}if(K.dataIdx==null){let g=K.hover,S=g.skip=new Set(g.skip??[]);S.add(void 0);let _=g.prox=Ve(g.prox),E=g.bias??(g.bias=0);K.dataIdx=(T,L,$,q)=>{if(L==0)return $;let ne=$,ue=_(T,L,$,q)??ct,fe=ue>=0&&ue0;)S.has(Ue[ke])||(je=ke);if(E==0||E==1)for(ke=$;Te==null&&ke++ue&&(ne=null);return ne}}const wn=g=>{K.event=g};K.idxs=D,K._lock=!1;let We=K.points;We.show=Ve(We.show),We.size=Ve(We.size),We.stroke=Ve(We.stroke),We.width=Ve(We.width),We.fill=Ve(We.fill);const xt=i.focus=Vt({},l.focus||{alpha:.3},K.focus),_t=xt.prox>=0,un=_t&&We.one;let vt=[],Sn=[],Ht=[];function Er(g,S){let _=We.show(i,S);if(_ instanceof HTMLElement)return wr(_,F0),wr(_,g.class),oi(_,-10,-10,Pe,ce),R.insertBefore(_,vt[S]),_}function Ri(g,S){if(o==1||S>0){let _=o==1&&V[g.scale].time,E=g.value;g.value=_?Yp(E)?eg(De,Zp(E,le)):E||X:E||Zw,g.label=g.label||(_?$w:Vw)}if(un||S>0){g.width=g.width==null?1:g.width,g.paths=g.paths||h1||rw,g.fillTo=Ve(g.fillTo||i1),g.pxAlign=+Xe(g.pxAlign,k),g.pxRound=ug(g.pxAlign),g.stroke=Ve(g.stroke||null),g.fill=Ve(g.fill||null),g._stroke=g._fill=g._paths=g._focus=null;let _=e1(Gn(1,g.width),1),E=g.points=Vt({},{size:_,width:Gn(1,_*.2),stroke:g.stroke,space:_*2,paths:p1,_stroke:null,_fill:null},g.points);E.show=Ve(E.show),E.filter=Ve(E.filter),E.fill=Ve(E.fill),E.stroke=Ve(E.stroke),E.paths=Ve(E.paths),E.pxAlign=g.pxAlign}if(xe){let _=Xr(g,S);Oe.splice(S,0,_[0]),$t.splice(S,0,_[1]),H.values.push(null)}if(be){D.splice(S,0,null);let _=null;un?S==0&&(_=Er(g,S)):S>0&&(_=Er(g,S)),vt.splice(S,0,_),Sn.splice(S,0,0),Ht.splice(S,0,0)}jt("addSeries",S)}function Ou(g,S){S=S??P.length,g=o==1?Pf(g,S,ng,og):Pf(g,S,{},lg),P.splice(S,0,g),Ri(P[S],S)}i.addSeries=Ou;function Lu(g){if(P.splice(g,1),xe){H.values.splice(g,1),$t.splice(g,1);let S=Oe.splice(g,1)[0];nn(null,S.firstChild),S.remove()}be&&(D.splice(g,1),vt.splice(g,1)[0].remove(),Sn.splice(g,1),Ht.splice(g,1)),jt("delSeries",g)}i.delSeries=Lu;const An=[!1,!1,!1,!1];function Ao(g,S){if(g._show=g.show,g.show){let _=g.side%2,E=V[g.scale];E==null&&(g.scale=_?P[1].scale:G,E=V[g.scale]);let T=E.time;g.size=Ve(g.size),g.space=Ve(g.space),g.rotate=Ve(g.rotate),rs(g.incrs)&&g.incrs.forEach($=>{!is.has($)&&is.set($,nm($))}),g.incrs=Ve(g.incrs||(E.distr==2?kw:T?B==1?Nw:zw:zs)),g.splits=Ve(g.splits||(T&&E.distr==1?ie:E.distr==3?Mf:E.distr==4?Kw:Yw)),g.stroke=Ve(g.stroke),g.grid.stroke=Ve(g.grid.stroke),g.ticks.stroke=Ve(g.ticks.stroke),g.border.stroke=Ve(g.border.stroke);let L=g.values;g.values=rs(L)&&!rs(L[0])?Ve(L):T?rs(L)?Jp(De,qp(L,le)):Yp(L)?Ow(De,L):L||oe:L||Gw,g.filter=Ve(g.filter||(E.distr>=3&&E.log==10?qw:E.distr==3&&E.log==2?Jw:em)),g.font=hg(g.font),g.labelFont=hg(g.labelFont),g._size=g.size(i,null,S,0),g._space=g._rotate=g._incrs=g._found=g._splits=g._values=null,g._size>0&&(An[S]=!0,g._el=Lr(P0,x))}}function Ni(g,S,_,E){let[T,L,$,q]=_,ne=S%2,ue=0;return ne==0&&(q||L)&&(ue=S==0&&!T||S==2&&!$?Jt(tg.size/3):0),ne==1&&(T||$)&&(ue=S==1&&!L||S==3&&!q?Jt(ig.size/2):0),ue}const Io=i.padding=(l.padding||[Ni,Ni,Ni,Ni]).map(g=>Ve(Xe(g,Ni))),Ir=i._padding=Io.map((g,S)=>g(i,S,An,0));let Ft,Mt=null,bt=null;const Is=o==1?P[0].idxs:null;let ur=null,ot=!1;function Ho(g,S){if(t=g??[],i.data=i._data=t,o==2){Ft=0;for(let _=1;_=0,zt=!0,Hn()}}i.setData=Ho;function ss(){ot=!0;let g,S;o==1&&(Ft>0?(Mt=Is[0]=0,bt=Is[1]=Ft-1,g=t[0][Mt],S=t[0][bt],Ce==2?(g=Mt,S=bt):g==S&&(Ce==3?[g,S]=ku(g,g,Y.log,!1):Ce==4?[g,S]=qf(g,g,Y.log,!1):Y.time?S=g+Jt(86400/B):[g,S]=fu(g,S,Jf,!0))):(Mt=Is[0]=g=null,bt=Is[1]=S=null)),fr(G,g,S)}let ls,Hr,bl,Hs,Di,Qn,Ol,In,Ll,Nn;function Fo(g,S,_,E,T,L){g??(g=zp),_??(_=ed),E??(E="butt"),T??(T=zp),L??(L="round"),g!=ls&&(v.strokeStyle=ls=g),T!=Hr&&(v.fillStyle=Hr=T),S!=bl&&(v.lineWidth=bl=S),L!=Di&&(v.lineJoin=Di=L),E!=Qn&&(v.lineCap=Qn=E),_!=Hs&&v.setLineDash(Hs=_)}function os(g,S,_,E){S!=Hr&&(v.fillStyle=Hr=S),g!=Ol&&(v.font=Ol=g),_!=In&&(v.textAlign=In=_),E!=Ll&&(v.textBaseline=Ll=E)}function Ti(g,S,_,E,T=0){if(E.length>0&&g.auto(i,ot)&&(S==null||S.min==null)){let L=Xe(Mt,0),$=Xe(bt,E.length-1),q=_.min==null?q0(E,L,$,T,g.distr==3):[_.min,_.max];g.min=Yr(g.min,_.min=q[0]),g.max=Gn(g.max,_.max=q[1])}}const zi={min:null,max:null};function Fs(){for(let E in V){let T=V[E];me[E]==null&&(T.min==null||me[G]!=null&&T.auto(i,ot))&&(me[E]=zi)}for(let E in V){let T=V[E];me[E]==null&&T.from!=null&&me[T.from]!=null&&(me[E]=zi)}me[G]!=null&&ci(!0);let g={};for(let E in me){let T=me[E];if(T!=null){let L=g[E]=Cl(V[E],lw);if(T.min!=null)Vt(L,T);else if(E!=G||o==2)if(Ft==0&&L.from==null){let $=L.range(i,null,null,E);L.min=$[0],L.max=$[1]}else L.min=ct,L.max=-ct}}if(Ft>0){P.forEach((E,T)=>{if(o==1){let L=E.scale,$=me[L];if($==null)return;let q=g[L];if(T==0){let ne=q.range(i,q.min,q.max,L);q.min=ne[0],q.max=ne[1],Mt=Gr(q.min,t[0]),bt=Gr(q.max,t[0]),bt-Mt>1&&(t[0][Mt]q.max&&bt--),E.min=ur[Mt],E.max=ur[bt]}else E.show&&E.auto&&Ti(q,$,E,t[T],E.sorted);E.idxs[0]=Mt,E.idxs[1]=bt}else if(T>0&&E.show&&E.auto){let[L,$]=E.facets,q=L.scale,ne=$.scale,[ue,fe]=t[T],he=g[q],Ae=g[ne];he!=null&&Ti(he,me[q],L,ue,L.sorted),Ae!=null&&Ti(Ae,me[ne],$,fe,$.sorted),E.min=$.min,E.max=$.max}});for(let E in g){let T=g[E],L=me[E];if(T.from==null&&(L==null||L.min==null)){let $=T.range(i,T.min==ct?null:T.min,T.max==-ct?null:T.max,E);T.min=$[0],T.max=$[1]}}}for(let E in g){let T=g[E];if(T.from!=null){let L=g[T.from];if(L.min==null)T.min=T.max=null;else{let $=T.range(i,L.min,L.max,E);T.min=$[0],T.max=$[1]}}}let S={},_=!1;for(let E in g){let T=g[E],L=V[E];if(L.min!=T.min||L.max!=T.max){L.min=T.min,L.max=T.max;let $=L.distr;L._min=$==3?Ei(L.min):$==4?hf(L.min,L.asinh):$==100?L.fwd(L.min):L.min,L._max=$==3?Ei(L.max):$==4?hf(L.max,L.asinh):$==100?L.fwd(L.max):L.max,S[E]=_=!0}}if(_){P.forEach((E,T)=>{o==2?T>0&&S.y&&(E._paths=null):S[E.scale]&&(E._paths=null)});for(let E in S)lr=!0,jt("setScale",E);be&&K.left>=0&&(or=zt=!0)}for(let E in me)me[E]=null}function Pu(g){let S=zf(Mt-1,0,Ft-1),_=zf(bt+1,0,Ft-1);for(;g[S]==null&&S>0;)S--;for(;g[_]==null&&_0){let g=P.some(S=>S._focus)&&Nn!=xt.alpha;g&&(v.globalAlpha=Nn=xt.alpha),P.forEach((S,_)=>{if(_>0&&S.show&&(js(_,!1),js(_,!0),S._paths==null)){let E=Nn;Nn!=S.alpha&&(v.globalAlpha=Nn=S.alpha);let T=o==2?[0,t[_][0].length-1]:Pu(t[_]);S._paths=S.paths(i,_,T[0],T[1]),Nn!=E&&(v.globalAlpha=Nn=E)}}),P.forEach((S,_)=>{if(_>0&&S.show){let E=Nn;Nn!=S.alpha&&(v.globalAlpha=Nn=S.alpha),S._paths!=null&&Pl(_,!1);{let T=S._paths!=null?S._paths.gaps:null,L=S.points.show(i,_,Mt,bt,T),$=S.points.filter(i,_,L,T);(L||$)&&(S.points._paths=S.points.paths(i,_,Mt,bt,$),Pl(_,!0))}Nn!=E&&(v.globalAlpha=Nn=E),jt("drawSeries",_)}}),g&&(v.globalAlpha=Nn=1)}}function js(g,S){let _=S?P[g].points:P[g];_._stroke=_.stroke(i,g),_._fill=_.fill(i,g)}function Pl(g,S){let _=S?P[g].points:P[g],{stroke:E,fill:T,clip:L,flags:$,_stroke:q=_._stroke,_fill:ne=_._fill,_width:ue=_.width}=_._paths;ue=ft(ue*Je,3);let fe=null,he=ue%2/2;S&&ne==null&&(ne=ue>0?"#fff":q);let Ae=_.pxAlign==1&&he>0;if(Ae&&v.translate(he,he),!S){let Ge=ln-ue/2,Ue=mn-ue/2,je=Yt+ue,Te=vn+ue;fe=new Path2D,fe.rect(Ge,Ue,je,Te)}S?Il(q,ue,_.dash,_.cap,ne,E,T,$,L):Al(g,q,ue,_.dash,_.cap,ne,E,T,$,fe,L),Ae&&v.translate(-he,-he)}function Al(g,S,_,E,T,L,$,q,ne,ue,fe){let he=!1;ne!=0&&Z.forEach((Ae,Ge)=>{if(Ae.series[0]==g){let Ue=P[Ae.series[1]],je=t[Ae.series[1]],Te=(Ue._paths||ko).band;rs(Te)&&(Te=Ae.dir==1?Te[0]:Te[1]);let ke,st=null;Ue.show&&Te&&Z0(je,Mt,bt)?(st=Ae.fill(i,Ge)||L,ke=Ue._paths.clip):Te=null,Il(S,_,E,T,st,$,q,ne,ue,fe,ke,Te),he=!0}}),he||Il(S,_,E,T,L,$,q,ne,ue,fe)}const Mi=kl|Of;function Il(g,S,_,E,T,L,$,q,ne,ue,fe,he){Fo(g,S,_,E,T),(ne||ue||he)&&(v.save(),ne&&v.clip(ne),ue&&v.clip(ue)),he?(q&Mi)==Mi?(v.clip(he),fe&&v.clip(fe),$e(T,$),bi(g,L,S)):q&Of?($e(T,$),v.clip(he),bi(g,L,S)):q&kl&&(v.save(),v.clip(he),fe&&v.clip(fe),$e(T,$),v.restore(),bi(g,L,S)):($e(T,$),bi(g,L,S)),(ne||ue||he)&&v.restore()}function bi(g,S,_){_>0&&(S instanceof Map?S.forEach((E,T)=>{v.strokeStyle=ls=T,v.stroke(E)}):S!=null&&g&&v.stroke(S))}function $e(g,S){S instanceof Map?S.forEach((_,E)=>{v.fillStyle=Hr=E,v.fill(_)}):S!=null&&g&&v.fill(S)}function jo(g,S,_,E){let T=W[g],L;if(E<=0)L=[0,0];else{let $=T._space=T.space(i,g,S,_,E),q=T._incrs=T.incrs(i,g,S,_,E,$);L=S1(S,_,q,E,$)}return T._found=L}function Ws(g,S,_,E,T,L,$,q,ne,ue){let fe=$%2/2;k==1&&v.translate(fe,fe),Fo(q,$,ne,ue,q),v.beginPath();let he,Ae,Ge,Ue,je=T+(E==0||E==3?-L:L);_==0?(Ae=T,Ue=je):(he=T,Ge=je);for(let Te=0;Te{if(!_.show)return;let T=V[_.scale];if(T.min==null){_._show&&(S=!1,_._show=!1,ci(!1));return}else _._show||(S=!1,_._show=!0,ci(!1));let L=_.side,$=L%2,{min:q,max:ne}=T,[ue,fe]=jo(E,q,ne,$==0?Pe:ce);if(fe==0)return;let he=T.distr==2,Ae=_._splits=_.splits(i,E,q,ne,ue,fe,he),Ge=T.distr==2?Ae.map(ke=>ur[ke]):Ae,Ue=T.distr==2?ur[Ae[1]]-ur[Ae[0]]:ue,je=_._values=_.values(i,_.filter(i,Ge,E,fe,Ue),E,fe,Ue);_._rotate=L==2?_.rotate(i,je,E,fe):0;let Te=_._size;_._size=Ar(_.size(i,je,E,g)),Te!=null&&_._size!=Te&&(S=!1)}),S}function Wo(g){let S=!0;return Io.forEach((_,E)=>{let T=_(i,E,An,g);T!=Ir[E]&&(S=!1),Ir[E]=T}),S}function Bo(){for(let g=0;gur[xn]):Ge,je=fe.distr==2?ur[Ge[1]]-ur[Ge[0]]:ne,Te=S.ticks,ke=S.border,st=Te.show?Te.size:0,yt=Jt(st*Je),Wt=Jt((S.alignTo==2?S._size-st-S.gap:S.gap)*Je),tt=S._rotate*-Ja/180,wt=b(S._pos*Je),jn=(yt+Wt)*q,at=wt+jn;L=E==0?at:0,T=E==1?at:0;let cn=S.font[0],Jn=S.align==1?gl:S.align==2?cf:tt>0?gl:tt<0?cf:E==0?"center":_==3?cf:gl,pr=tt||E==1?"middle":_==2?po:Tp;os(cn,$,Jn,pr);let Tn=S.font[1]*S.lineGap,Wn=Ge.map(xn=>b(d(xn,fe,he,Ae))),Bn=S._values;for(let xn=0;xn{_>0&&(S._paths=null,g&&(o==1?(S.min=null,S.max=null):S.facets.forEach(E=>{E.min=null,E.max=null})))})}let Oi=!1,Li=!1,Xn=[];function ei(){Li=!1;for(let g=0;g0&&queueMicrotask(ei)}i.batch=as;function Pi(){if(qr&&(Fs(),qr=!1),lr&&(ar(),lr=!1),Jr){if(mt(z,gl,qe),mt(z,po,et),mt(z,vo,Pe),mt(z,yo,ce),mt(R,gl,qe),mt(R,po,et),mt(R,vo,Pe),mt(R,yo,ce),mt(x,vo,rn),mt(x,yo,sr),w.width=Jt(rn*Je),w.height=Jt(sr*Je),W.forEach(({_el:g,_show:S,_size:_,_pos:E,side:T})=>{if(g!=null)if(S){let L=T===3||T===0?_:0,$=T%2==1;mt(g,$?"left":"top",E-L),mt(g,$?"width":"height",_),mt(g,$?"top":"left",$?et:qe),mt(g,$?"height":"width",$?ce:Pe),Df(g,Ms)}else wr(g,Ms)}),ls=Hr=bl=Di=Qn=Ol=In=Ll=Hs=null,Nn=1,gs(!0),qe!=sn||et!=kn||Pe!=Gt||ce!=Rt){ci(!1);let g=Pe/Gt,S=ce/Rt;if(be&&!or&&K.left>=0){K.left*=g,K.top*=S,kr&&oi(kr,Jt(K.left),0,Pe,ce),Ai&&oi(Ai,0,Jt(K.top),Pe,ce);for(let _=0;_=0&&it.width>0){it.left*=g,it.width*=g,it.top*=S,it.height*=S;for(let _ in Vl)mt(di,_,it[_])}sn=qe,kn=et,Gt=Pe,Rt=ce}jt("setSize"),Jr=!1}rn>0&&sr>0&&(v.clearRect(0,0,w.width,w.height),jt("drawClear"),re.forEach(g=>g()),jt("draw")),it.show&&Zr&&(cr(it),Zr=!1),be&&or&&(hi(null,!0,!1),or=!1),H.show&&H.live&&zt&&(ps(),zt=!1),p||(p=!0,i.status=1,jt("ready")),ot=!1,Oi=!1}i.redraw=(g,S)=>{lr=S||!1,g!==!1?fr(G,Y.min,Y.max):Hn()};function Cr(g,S){let _=V[g];if(_.from==null){if(Ft==0){let E=_.range(i,S.min,S.max,g);S.min=E[0],S.max=E[1]}if(S.min>S.max){let E=S.min;S.min=S.max,S.max=E}if(Ft>1&&S.min!=null&&S.max!=null&&S.max-S.min<1e-16)return;g==G&&_.distr==2&&Ft>0&&(S.min=Gr(S.min,t[0]),S.max=Gr(S.max,t[0]),S.min==S.max&&S.max++),me[g]=S,qr=!0,Hn()}}i.setScale=Cr;let Fl,Bs,kr,Ai,jl,us,fi,Ii,Hi,Fi,Ke,rt,ti=!1;const Qt=K.drag;let Nt=Qt.x,Et=Qt.y;be&&(K.x&&(Fl=Lr(I0,R)),K.y&&(Bs=Lr(H0,R)),Y.ori==0?(kr=Fl,Ai=Bs):(kr=Bs,Ai=Fl),Ke=K.left,rt=K.top);const it=i.select=Vt({show:!0,over:!0,left:0,width:0,top:0,height:0},l.select),di=it.show?Lr(A0,it.over?R:z):null;function cr(g,S){if(it.show){for(let _ in g)it[_]=g[_],_ in Vl&&mt(di,_,g[_]);S!==!1&&jt("setSelect")}}i.setSelect=cr;function Wl(g){if(P[g].show)xe&&Df(Oe[g],Ms);else if(xe&&wr(Oe[g],Ms),be){let _=un?vt[0]:vt[g];_!=null&&oi(_,-10,-10,Pe,ce)}}function fr(g,S,_){Cr(g,{min:S,max:_})}function dr(g,S,_,E){S.focus!=null&&Bl(g),S.show!=null&&P.forEach((T,L)=>{L>0&&(g==L||g==null)&&(T.show=S.show,Wl(L),o==2?(fr(T.facets[0].scale,null,null),fr(T.facets[1].scale,null,null)):fr(T.scale,null,null),Hn())}),_!==!1&&jt("setSeries",g,S),E&&ms("setSeries",i,g,S)}i.setSeries=dr;function Us(g,S){Vt(Z[g],S)}function Vs(g,S){g.fill=Ve(g.fill||null),g.dir=Xe(g.dir,-1),S=S??Z.length,Z.splice(S,0,g)}function Uo(g){g==null?Z.length=0:Z.splice(g,1)}i.addBand=Vs,i.setBand=Us,i.delBand=Uo;function Fn(g,S){P[g].alpha=S,be&&vt[g]!=null&&(vt[g].style.opacity=S),xe&&Oe[g]&&(Oe[g].style.opacity=S)}let Dn,Rr,hr;const ji={focus:!0};function Bl(g){if(g!=hr){let S=g==null,_=xt.alpha!=1;P.forEach((E,T)=>{if(o==1||T>0){let L=S||T==0||T==g;E._focus=S?null:L,_&&Fn(T,L?1:xt.alpha)}}),hr=g,_&&Hn()}}xe&&_t&&Ze(Op,_e,g=>{K._lock||(wn(g),hr!=null&&dr(null,ji,!0,Dt.setSeries))});function qn(g,S,_){let E=V[S];_&&(g=g/Je-(E.ori==1?et:qe));let T=Pe;E.ori==1&&(T=ce,g=T-g),E.dir==-1&&(g=T-g);let L=E._min,$=E._max,q=g/T,ne=L+($-L)*q,ue=E.distr;return ue==3?_l(10,ne):ue==4?tw(ne,E.asinh):ue==100?E.bwd(ne):ne}function cs(g,S){let _=qn(g,G,S);return Gr(_,t[0],Mt,bt)}i.valToIdx=g=>Gr(g,t[0]),i.posToIdx=cs,i.posToVal=qn,i.valToPos=(g,S,_)=>V[S].ori==0?u(g,V[S],_?Yt:Pe,_?ln:0):f(g,V[S],_?vn:ce,_?mn:0),i.setCursor=(g,S,_)=>{Ke=g.left,rt=g.top,hi(null,S,_)};function fs(g,S){mt(di,gl,it.left=g),mt(di,vo,it.width=S)}function Ul(g,S){mt(di,po,it.top=g),mt(di,yo,it.height=S)}let ds=Y.ori==0?fs:Ul,hs=Y.ori==1?fs:Ul;function Iu(){if(xe&&H.live)for(let g=o==2?1:0;g{D[E]=_}):sw(g.idx)||D.fill(g.idx),H.idx=D[0]),xe&&H.live){for(let _=0;_0||o==1&&!At)&&Hu(_,D[_]);Iu()}zt=!1,S!==!1&&jt("setLegend")}i.setLegend=ps;function Hu(g,S){let _=P[g],E=g==0&&Ce==2?ur:t[g],T;At?T=_.values(i,g,S)??It:(T=_.value(i,S==null?null:E[S],g,S),T=T==null?It:{_:T}),H.values[g]=T}function hi(g,S,_){Hi=Ke,Fi=rt,[Ke,rt]=K.move(i,Ke,rt),K.left=Ke,K.top=rt,be&&(kr&&oi(kr,Jt(Ke),0,Pe,ce),Ai&&oi(Ai,0,Jt(rt),Pe,ce));let E,T=Mt>bt;Dn=ct,Rr=null;let L=Y.ori==0?Pe:ce,$=Y.ori==1?Pe:ce;if(Ke<0||Ft==0||T){E=K.idx=null;for(let q=0;q0&&st.show){let jn=tt==null?-10:tt==E?ue:ae(o==1?t[0][tt]:t[ke][0][tt],Y,L,0),at=wt==null?-10:ye(wt,o==1?V[st.scale]:V[st.facets[1].scale],$,0);if(_t&&wt!=null){let cn=Y.ori==1?Ke:rt,Jn=Zt(xt.dist(i,ke,tt,at,cn));if(Jn=0?1:-1,Bn=Tn>=0?1:-1;Bn==Wn&&(Bn==1?pr==1?wt>=Tn:wt<=Tn:pr==1?wt<=Tn:wt>=Tn)&&(Dn=Jn,Rr=ke)}else Dn=Jn,Rr=ke}}if(zt||un){let cn,Jn;Y.ori==0?(cn=jn,Jn=at):(cn=at,Jn=jn);let pr,Tn,Wn,Bn,Nr,xn,Bt=!0,Fr=We.bbox;if(Fr!=null){Bt=!1;let Ot=Fr(i,ke);Wn=Ot.left,Bn=Ot.top,pr=Ot.width,Tn=Ot.height}else Wn=cn,Bn=Jn,pr=Tn=We.size(i,ke);if(xn=We.fill(i,ke),Nr=We.stroke(i,ke),un)ke==Rr&&Dn<=xt.prox&&(fe=Wn,he=Bn,Ae=pr,Ge=Tn,Ue=Bt,je=xn,Te=Nr);else{let Ot=vt[ke];Ot!=null&&(Sn[ke]=Wn,Ht[ke]=Bn,jp(Ot,pr,Tn,Bt),Hp(Ot,xn,Nr),oi(Ot,Ar(Wn),Ar(Bn),Pe,ce))}}}}if(un){let ke=xt.prox,st=hr==null?Dn<=ke:Dn>ke||Rr!=hr;if(zt||st){let yt=vt[0];yt!=null&&(Sn[0]=fe,Ht[0]=he,jp(yt,Ae,Ge,Ue),Hp(yt,je,Te),oi(yt,Ar(fe),Ar(he),Pe,ce))}}}if(it.show&&ti)if(g!=null){let[q,ne]=Dt.scales,[ue,fe]=Dt.match,[he,Ae]=g.cursor.sync.scales,Ge=g.cursor.drag;if(Nt=Ge._x,Et=Ge._y,Nt||Et){let{left:Ue,top:je,width:Te,height:ke}=g.select,st=g.scales[he].ori,yt=g.posToVal,Wt,tt,wt,jn,at,cn=q!=null&&ue(q,he),Jn=ne!=null&&fe(ne,Ae);cn&&Nt?(st==0?(Wt=Ue,tt=Te):(Wt=je,tt=ke),wt=V[q],jn=ae(yt(Wt,he),wt,L,0),at=ae(yt(Wt+tt,he),wt,L,0),ds(Yr(jn,at),Zt(at-jn))):ds(0,L),Jn&&Et?(st==1?(Wt=Ue,tt=Te):(Wt=je,tt=ke),wt=V[ne],jn=ye(yt(Wt,Ae),wt,$,0),at=ye(yt(Wt+tt,Ae),wt,$,0),hs(Yr(jn,at),Zt(at-jn))):hs(0,$)}else $l()}else{let q=Zt(Hi-jl),ne=Zt(Fi-us);if(Y.ori==1){let Ae=q;q=ne,ne=Ae}Nt=Qt.x&&q>=Qt.dist,Et=Qt.y&&ne>=Qt.dist;let ue=Qt.uni;ue!=null?Nt&&Et&&(Nt=q>=ue,Et=ne>=ue,!Nt&&!Et&&(ne>q?Et=!0:Nt=!0)):Qt.x&&Qt.y&&(Nt||Et)&&(Nt=Et=!0);let fe,he;Nt&&(Y.ori==0?(fe=fi,he=Ke):(fe=Ii,he=rt),ds(Yr(fe,he),Zt(he-fe)),Et||hs(0,$)),Et&&(Y.ori==1?(fe=fi,he=Ke):(fe=Ii,he=rt),hs(Yr(fe,he),Zt(he-fe)),Nt||ds(0,L)),!Nt&&!Et&&(ds(0,0),hs(0,0))}if(Qt._x=Nt,Qt._y=Et,g==null){if(_){if(Ks!=null){let[q,ne]=Dt.scales;Dt.values[0]=q!=null?qn(Y.ori==0?Ke:rt,q):null,Dt.values[1]=ne!=null?qn(Y.ori==1?Ke:rt,ne):null}ms(ff,i,Ke,rt,Pe,ce,E)}if(_t){let q=_&&Dt.setSeries,ne=xt.prox;hr==null?Dn<=ne&&dr(Rr,ji,!0,q):Dn>ne?dr(null,ji,!0,q):Rr!=hr&&dr(Rr,ji,!0,q)}}zt&&(H.idx=E,ps()),S!==!1&&jt("setCursor")}let ni=null;Object.defineProperty(i,"rect",{get(){return ni==null&&gs(!1),ni}});function gs(g=!1){g?ni=null:(ni=R.getBoundingClientRect(),jt("syncRect",ni))}function Vo(g,S,_,E,T,L,$){K._lock||ti&&g!=null&&g.movementX==0&&g.movementY==0||($s(g,S,_,E,T,L,$,!1,g!=null),g!=null?hi(null,!0,!0):hi(S,!0,!1))}function $s(g,S,_,E,T,L,$,q,ne){if(ni==null&&gs(!1),wn(g),g!=null)_=g.clientX-ni.left,E=g.clientY-ni.top;else{if(_<0||E<0){Ke=-10,rt=-10;return}let[ue,fe]=Dt.scales,he=S.cursor.sync,[Ae,Ge]=he.values,[Ue,je]=he.scales,[Te,ke]=Dt.match,st=S.axes[0].side%2==1,yt=Y.ori==0?Pe:ce,Wt=Y.ori==1?Pe:ce,tt=st?L:T,wt=st?T:L,jn=st?E:_,at=st?_:E;if(Ue!=null?_=Te(ue,Ue)?d(Ae,V[ue],yt,0):-10:_=yt*(jn/tt),je!=null?E=ke(fe,je)?d(Ge,V[fe],Wt,0):-10:E=Wt*(at/wt),Y.ori==1){let cn=_;_=E,E=cn}}ne&&(S==null||S.cursor.event.type==ff)&&((_<=1||_>=Pe-1)&&(_=Ts(_,Pe)),(E<=1||E>=ce-1)&&(E=Ts(E,ce))),q?(jl=_,us=E,[fi,Ii]=K.move(i,_,E)):(Ke=_,rt=E)}const Vl={width:0,height:0,left:0,top:0};function $l(){cr(Vl,!1)}let $o,Go,Gs,Yo;function Ko(g,S,_,E,T,L,$){ti=!0,Nt=Et=Qt._x=Qt._y=!1,$s(g,S,_,E,T,L,$,!0,!1),g!=null&&(Ze(df,Rf,Qo,!1),ms(Mp,i,fi,Ii,Pe,ce,null));let{left:q,top:ne,width:ue,height:fe}=it;$o=q,Go=ne,Gs=ue,Yo=fe}function Qo(g,S,_,E,T,L,$){ti=Qt._x=Qt._y=!1,$s(g,S,_,E,T,L,$,!1,!0);let{left:q,top:ne,width:ue,height:fe}=it,he=ue>0||fe>0,Ae=$o!=q||Go!=ne||Gs!=ue||Yo!=fe;if(he&&Ae&&cr(it),Qt.setScale&&he&&Ae){let Ge=q,Ue=ue,je=ne,Te=fe;if(Y.ori==1&&(Ge=ne,Ue=fe,je=q,Te=ue),Nt&&fr(G,qn(Ge,G),qn(Ge+Ue,G)),Et)for(let ke in V){let st=V[ke];ke!=G&&st.from==null&&st.min!=ct&&fr(ke,qn(je+Te,ke),qn(je,ke))}$l()}else K.lock&&(K._lock=!K._lock,hi(S,!0,g!=null));g!=null&&(nn(df,Rf),ms(df,i,Ke,rt,Pe,ce,null))}function Xo(g,S,_,E,T,L,$){if(K._lock)return;wn(g);let q=ti;if(ti){let ne=!0,ue=!0,fe=10,he,Ae;Y.ori==0?(he=Nt,Ae=Et):(he=Et,Ae=Nt),he&&Ae&&(ne=Ke<=fe||Ke>=Pe-fe,ue=rt<=fe||rt>=ce-fe),he&&ne&&(Ke=Ke{let T=Dt.match[2];_=T(i,S,_),_!=-1&&dr(_,E,!0,!1)},be&&(Ze(Mp,R,Ko),Ze(ff,R,Vo),Ze(bp,R,g=>{wn(g),gs(!1)}),Ze(Op,R,Xo),Ze(Lp,R,qo),Lf.add(i),i.syncRect=gs);const Ys=i.hooks=l.hooks||{};function jt(g,S,_){Li?Xn.push([g,S,_]):g in Ys&&Ys[g].forEach(E=>{E.call(null,i,S,_)})}(l.plugins||[]).forEach(g=>{for(let S in g.hooks)Ys[S]=(Ys[S]||[]).concat(g.hooks[S])});const Zo=(g,S,_)=>_,Dt=Vt({key:null,setSeries:!1,filters:{pub:$p,sub:$p},scales:[G,P[1]?P[1].scale:null],match:[Gp,Gp,Zo],values:[null,null]},K.sync);Dt.match.length==2&&Dt.match.push(Zo),K.sync=Dt;const Ks=Dt.key,pi=_m(Ks);function ms(g,S,_,E,T,L,$){Dt.filters.pub(g,S,_,E,T,L,$)&&pi.pub(g,S,_,E,T,L,$)}pi.sub(i);function ea(g,S,_,E,T,L,$){Dt.filters.sub(g,S,_,E,T,L,$)&&Wi[g](null,S,_,E,T,L,$)}i.pub=ea;function ta(){pi.unsub(i),Lf.delete(i),Pn.clear(),Tf(cu,Sl,Jo),m.remove(),_e==null||_e.remove(),jt("destroy")}i.destroy=ta;function Qs(){jt("init",l,t),Ho(t||l.data,!1),me[G]?Cr(G,me[G]):ss(),Zr=it.show&&(it.width>0||it.height>0),or=zt=!0,lt(l.width,l.height)}return P.forEach(Ri),W.forEach(Ao),r?r instanceof HTMLElement?(r.appendChild(m),Qs()):r(i,Qs):Qs(),i}Ln.assign=Vt;Ln.fmtNum=Zf;Ln.rangeNum=fu;Ln.rangeLog=ku;Ln.rangeAsinh=qf;Ln.orient=As;Ln.pxRatio=Je;Ln.join=dw;Ln.fmtDate=td,Ln.tzDate=Ew;Ln.sync=_m;{Ln.addGap=s1,Ln.clipGaps=Du;let l=Ln.paths={points:Dm};l.linear=zm,l.stepped=a1,l.bars=u1,l.spline=f1}const _1=6e3;class E1{constructor(t=_1){fo(this,"t");fo(this,"v");fo(this,"len",0);fo(this,"head",0);this.t=new Float64Array(t),this.v=new Float64Array(t)}push(t,r){const i=this.t.length;this.t[this.head]=t,this.v[this.head]=r,this.head=(this.head+1)%i,this.len=t&&(u[d]=this.t[m],f[d]=this.v[m],d++)}return{t:u.subarray(0,d),v:f.subarray(0,d)}}last(){if(this.len===0)return null;const t=this.t.length;return this.v[(this.head-1+t)%t]}}const Af=new Map;function C1(l){let t=Af.get(l);return t||(t=new E1,Af.set(l,t)),t}function Lm(l,t){const r=C1(l);for(const[i,o]of t)r.push(i,o)}function Pm(l,t=-1/0){const r=Af.get(l);return r?r.read(t):{t:new Float64Array(0),v:new Float64Array(0)}}const xl=new Map;let Za=[];function Am(){Za.forEach(l=>l())}function k1(l){xl.set(l,(xl.get(l)||0)+1),Am()}function R1(l){const t=(xl.get(l)||0)-1;t<=0?xl.delete(l):xl.set(l,t),Am()}function N1(){return Array.from(xl.keys())}function D1(l){return Za.push(l),()=>{Za=Za.filter(t=>t!==l)}}const pg=3e3;let yl=[],eu=[];function T1(l){l.length&&(yl=yl.concat(l),yl.length>pg&&(yl=yl.slice(-pg)),eu.forEach(t=>t()))}function z1(){return yl}function M1(l){return eu.push(l),()=>{eu=eu.filter(t=>t!==l)}}let tu=0,nu=[];function gg(l){tu+=l?1:-1,tu<0&&(tu=0),nu.forEach(t=>t())}function b1(){return tu>0}function O1(l){return nu.push(l),()=>{nu=nu.filter(t=>t!==l)}}let Ls=null,vf=null;function L1(){return`${location.protocol==="https:"?"wss":"ws"}://${location.host}/api/monitor/stream`}function mg(){Ls&&Ls.readyState===WebSocket.OPEN&&Ls.send(JSON.stringify({type:"subscribe",signals:N1()}))}function vg(){Ls&&Ls.readyState===WebSocket.OPEN&&Ls.send(JSON.stringify({type:"raw",enabled:b1()}))}function Im(){const l=new WebSocket(L1());Ls=l,l.onopen=()=>{gn.getState().setConnected(!0),mg(),vg()},l.onclose=()=>{gn.getState().setConnected(!1),vf==null&&(vf=window.setTimeout(()=>{vf=null,Im()},1e3))},l.onerror=()=>l.close(),l.onmessage=r=>{let i;try{i=JSON.parse(r.data)}catch{return}const o=gn.getState();switch(i.type){case"meta":o.setMeta(i.signals,i.pairs),o.setMotors(i.motors);break;case"motors":o.setMotors(i.motors),i.status&&o.setStatus(i.status);break;case"samples":for(const[u,f]of Object.entries(i.data))Lm(u,f);break;case"raw":T1(i.frames);break}};let t=null;D1(()=>{t==null&&(t=window.setTimeout(()=>{t=null,mg()},80))}),O1(vg)}async function P1(l,t=600){return l.length?(await fetch(`/api/monitor/snapshot?signals=${l.join(",")}&n=${t}`)).json():{}}async function A1(){try{return(await(await fetch("/api/monitor/motor-types")).json()).types||[]}catch{return[]}}async function I1(l,t){await fetch("/api/monitor/motor-type",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({motorId:l,motorType:t})})}const H1={pos:"#58a6ff",vel:"#3fb950",torque:"#d29922",kp:"#bc8cff",kd:"#f778ba",vel_limit:"#56d4dd",torque_limit:"#e3b341",t_mos:"#ff7b72",t_rotor:"#ffa657",status_code:"#8b949e"};function F1(l){return H1[l]||"#8b949e"}function ru(l){const t=F1(l.field);return l.source==="cmd"?j1(t,.15):t}function If(l){const t=l.split(":");return t.length>=3?`${t[1]} ${t[2]}`:l}function yg(l){return l.includes(":cmd.")}const wg=["pos","vel","torque","kp","kd","t_mos","t_rotor"];function j1(l,t){const r=l.replace("#",""),i=Math.min(255,Math.round(parseInt(r.slice(0,2),16)+255*t)),o=Math.min(255,Math.round(parseInt(r.slice(2,4),16)+255*t)),u=Math.min(255,Math.round(parseInt(r.slice(4,6),16)+255*t));return`rgb(${i},${o},${u})`}function Rl(l,t=3){return l==null||Number.isNaN(l)?"—":l.toFixed(t)}const Sg=2e3;function W1(l,t){const r=l.map(f=>Pm(f,t)),i=new Set;for(const f of r)for(let d=0;df-d);if(o.length>Sg){const f=Math.ceil(o.length/Sg);o=o.filter((d,p)=>p%f===0)}const u=[o];for(const f of r){const d=new Array(o.length).fill(null);let p=0,m=null;for(let w=0;wk.ensurePlot),r=gn(k=>k.removeSignalFromPlot),i=gn(k=>k.setPlotConfig),o=gn(k=>k.plotConfigs[l]),u=gn(k=>k.signals);j.useEffect(()=>{t(l)},[l,t]);const f=(o==null?void 0:o.signals)??[],d=(o==null?void 0:o.duration)??10,p=f.join("|"),{setNodeRef:m,isOver:w}=o0({id:`plot:${l}`,data:{panelId:l}}),v=j.useRef(null),x=j.useRef(null),z=j.useRef(0);j.useEffect(()=>{if(!v.current)return;const k=v.current,b=new Map(u.map(Z=>[Z.id,Z])),B=[{label:"t"},...f.map(Z=>{const G=b.get(Z),ee=G?ru(G):"#8b949e";return{label:If(Z),stroke:ee,width:1.5,dash:yg(Z)?[6,4]:void 0,points:{show:!1}}})],P={width:k.clientWidth||400,height:k.clientHeight||220,legend:{show:!1},series:B,cursor:{y:!1,points:{show:!0}},scales:{x:{time:!1}},axes:[{stroke:"#8b949e",grid:{stroke:"rgba(139,148,158,0.12)"},ticks:{stroke:"rgba(139,148,158,0.2)"},values:(Z,G)=>G.map(ee=>(ee-z.current).toFixed(1)+"s")},{stroke:"#8b949e",grid:{stroke:"rgba(139,148,158,0.12)"},ticks:{stroke:"rgba(139,148,158,0.2)"}}]},W=new Ln(P,[[],...f.map(()=>[])],k);x.current=W;const V=new ResizeObserver(()=>{W.setSize({width:k.clientWidth,height:k.clientHeight})});return V.observe(k),()=>{V.disconnect(),W.destroy(),x.current=null}},[p,u.length]),j.useEffect(()=>{if(!f.length)return;f.forEach(k1);let k=!1;return P1(f,1200).then(b=>{if(!k)for(const[B,P]of Object.entries(b))Lm(B,P)}),()=>{k=!0,f.forEach(R1)}},[p]),j.useEffect(()=>{let k=0;const b=()=>{const B=x.current;if(B&&f.length){let P=0;for(const V of f){const Z=Pm(V);Z.t.length&&(P=Math.max(P,Z.t[Z.t.length-1]))}z.current=P;const W=W1(f,P-d);B.setData(W,!1),B.setScale("x",{min:P-d,max:P})}k=requestAnimationFrame(b)};return k=requestAnimationFrame(b),()=>cancelAnimationFrame(k)},[p,d]);const R=j.useMemo(()=>new Map(u.map(k=>[k.id,k])),[u]);return U.jsxs("div",{className:"panel plot-panel",ref:m,children:[U.jsxs("div",{className:"plot-toolbar",children:[U.jsx("span",{className:"muted",children:"window"}),U.jsx("select",{value:d,onChange:k=>i(l,{duration:Number(k.target.value)}),children:[5,10,20,30,60].map(k=>U.jsxs("option",{value:k,children:[k,"s"]},k))}),U.jsx("div",{className:"legend",children:f.map(k=>{const b=R.get(k);return U.jsxs("span",{className:"legend-chip",style:{borderColor:b?ru(b):"#555"},children:[U.jsx("span",{className:"legend-swatch",style:{background:b?ru(b):"#555",borderStyle:yg(k)?"dashed":"solid"}}),If(k),U.jsx("button",{className:"legend-x",onClick:()=>r(l,k),children:"×"})]},k)})})]}),U.jsx("div",{className:"plot-host"+(w?" drop-over":""),ref:v,children:f.length===0&&U.jsx("div",{className:"drop-hint",children:"Drag signals here to plot — drop cmd onto fb to overlay"})})]})}const yf=[["pos","cmd p"],["vel","cmd v"],["kp","kp"],["kd","kd"],["torque","cmd τ"]],wf=[["pos","act p"],["vel","act v"],["torque","act τ"],["t_mos","Tmos"],["t_rotor","Trot"]];function U1(){const l=gn(t=>t.motors);return U.jsx("div",{className:"panel table-panel",children:U.jsxs("table",{className:"motor-table",children:[U.jsx("thead",{children:U.jsxs("tr",{children:[U.jsx("th",{children:"Motor"}),U.jsx("th",{children:"Mode"}),U.jsx("th",{children:"Status"}),yf.map(([t,r])=>U.jsx("th",{className:"cmd-col",children:r},"c"+t)),wf.map(([t,r])=>U.jsx("th",{children:r},"f"+t))]})}),U.jsxs("tbody",{children:[l.length===0&&U.jsx("tr",{children:U.jsx("td",{colSpan:3+yf.length+wf.length,className:"muted center",children:"Waiting for traffic…"})}),l.map(t=>U.jsxs("tr",{children:[U.jsxs("td",{className:"mono",children:["m",t.motorId]}),U.jsx("td",{className:"muted",children:t.mode||"—"}),U.jsx("td",{children:U.jsx("span",{className:"status-pill "+(t.status==="ENABLED"?"ok":t.status==="DISABLED"?"off":"warn"),children:t.status||"—"})}),yf.map(([r])=>U.jsx("td",{className:"mono cmd-col",children:Rl(t.cmd[r],r==="kp"?0:3)},"c"+r)),wf.map(([r])=>U.jsx("td",{className:"mono",children:Rl(t.fb[r],r.startsWith("t_")?1:3)},"f"+r))]},`${t.bus}:${t.motorId}`))]})]})})}function Sf({label:l,cmd:t,act:r,unit:i,digits:o=2}){return U.jsxs("div",{className:"metric",children:[U.jsxs("div",{className:"metric-label",children:[l," ",U.jsx("span",{className:"muted",children:i})]}),U.jsxs("div",{className:"metric-values",children:[U.jsx("span",{className:"metric-act",children:Rl(r,o)}),t!==void 0&&U.jsxs("span",{className:"metric-cmd",children:["⌖ ",Rl(t,o)]})]})]})}function V1(){const l=gn(r=>r.motors),t=gn(r=>r.motorTypes);return U.jsxs("div",{className:"panel cards-panel",children:[l.length===0&&U.jsx("div",{className:"muted center pad",children:"Waiting for traffic…"}),U.jsx("div",{className:"cards-grid",children:l.map(r=>U.jsxs("div",{className:"motor-card",children:[U.jsxs("div",{className:"motor-card-head",children:[U.jsxs("span",{className:"mono strong",children:["Motor ",r.motorId]}),U.jsx("span",{className:"status-pill "+(r.status==="ENABLED"?"ok":r.status==="DISABLED"?"off":"warn"),children:r.status||"—"})]}),U.jsxs("div",{className:"motor-card-sub",children:[U.jsx("span",{className:"muted",children:r.mode||"—"}),t.length>0&&U.jsxs("select",{className:"type-select",defaultValue:"",onChange:i=>i.target.value&&I1(r.motorId,i.target.value),title:"Override motor type used to scale this motor's values",children:[U.jsx("option",{value:"",children:"set type…"}),t.map(i=>U.jsx("option",{value:i,children:i},i))]})]}),U.jsx(Sf,{label:"Position",unit:"rad",cmd:r.cmd.pos,act:r.fb.pos,digits:3}),U.jsx(Sf,{label:"Velocity",unit:"rad/s",cmd:r.cmd.vel,act:r.fb.vel,digits:2}),U.jsx(Sf,{label:"Torque",unit:"Nm",cmd:r.cmd.torque,act:r.fb.torque,digits:2}),U.jsxs("div",{className:"temp-row",children:[U.jsxs("span",{children:["MOS ",Rl(r.fb.t_mos,1),"°"]}),U.jsxs("span",{children:["Rotor ",Rl(r.fb.t_rotor,1),"°"]})]})]},`${r.bus}:${r.motorId}`))})]})}function $1(l,t,r){const i=new Array(l);return new Proxy(i,{get(o,u,f){if(typeof u=="string"){const d=u.charCodeAt(0);if(d>=48&&d<=57){const p=+u;if(Number.isInteger(p)&&p>=0&&pi[w]!==m))&&(i=d,o=t(...d),r!=null&&r.onChange&&!(u&&r.skipInitialOnChange)&&r.onChange(o),u=!1),o}return f.updateDeps=d=>{i=d},f}function xg(l,t){if(l===void 0)throw new Error("Unexpected undefined");return l}const G1=(l,t)=>Math.abs(l-t)<1.01,Y1=(l,t,r)=>{let i;return function(...o){l.clearTimeout(i),i=l.setTimeout(()=>t.apply(this,o),r)}};let mo;const xf=()=>{if(mo!==void 0)return mo;if(typeof navigator>"u")return mo=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return mo=!0;const l=navigator.maxTouchPoints;return mo=navigator.platform==="MacIntel"&&l!==void 0&&l>0},_g=l=>{const{offsetWidth:t,offsetHeight:r}=l;return{width:t,height:r}},K1=l=>l,Q1=l=>{const t=Math.max(l.startIndex-l.overscan,0),i=Math.min(l.endIndex+l.overscan,l.count-1)-t+1,o=new Array(i);for(let u=0;u{const r=l.scrollElement;if(!r)return;const i=l.targetWindow;if(!i)return;const o=f=>{const{width:d,height:p}=f;t({width:Math.round(d),height:Math.round(p)})};if(o(_g(r)),!i.ResizeObserver)return()=>{};const u=new i.ResizeObserver(f=>{const d=()=>{const p=f[0];if(p!=null&&p.borderBoxSize){const m=p.borderBoxSize[0];if(m){o({width:m.inlineSize,height:m.blockSize});return}}o(_g(r))};l.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(d):d()});return u.observe(r,{box:"border-box"}),()=>{u.unobserve(r)}},hu={passive:!0},q1=typeof window>"u"?!0:"onscrollend"in window,J1=(l,t,r)=>{const i=l.scrollElement;if(!i)return;const o=l.targetWindow;if(!o)return;const u=l.options.useScrollendEvent&&q1;let f=0;const d=u?null:Y1(o,()=>t(f,!1),l.options.isScrollingResetDelay),p=v=>()=>{f=r(i),d==null||d(),t(f,v)},m=p(!0),w=p(!1);return i.addEventListener("scroll",m,hu),u&&i.addEventListener("scrollend",w,hu),()=>{i.removeEventListener("scroll",m),u&&i.removeEventListener("scrollend",w)}},Z1=(l,t)=>J1(l,t,r=>{const{horizontal:i,isRtl:o}=l.options;return i?r.scrollLeft*(o&&-1||1):r.scrollTop}),eS=(l,t,r)=>{if(r.options.useCachedMeasurements){const i=r.indexFromElement(l),o=r.options.getItemKey(i);return r.itemSizeCache.get(o)??r.options.estimateSize(i)}if(t!=null&&t.borderBoxSize){const i=t.borderBoxSize[0];if(i)return Math.round(i[r.options.horizontal?"inlineSize":"blockSize"])}if(!t){const i=r.indexFromElement(l),o=r.options.getItemKey(i),u=r.itemSizeCache.get(o);if(u!==void 0)return u}return l[r.options.horizontal?"offsetWidth":"offsetHeight"]},tS=(l,{adjustments:t=0,behavior:r},i)=>{var o,u;(u=(o=i.scrollElement)==null?void 0:o.scrollTo)==null||u.call(o,{[i.options.horizontal?"left":"top"]:l+t,behavior:r})},nS=tS;class rS{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var r,i,o;return((o=(i=(r=this.targetWindow)==null?void 0:r.performance)==null?void 0:i.now)==null?void 0:o.call(i))??Date.now()},this.observer=(()=>{let r=null;const i=()=>r||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:r=new this.targetWindow.ResizeObserver(o=>{o.forEach(u=>{const f=()=>{const d=u.target,p=this.indexFromElement(d);if(!d.isConnected){this.observer.unobserve(d);for(const[m,w]of this.elementsCache)if(w===d){this.elementsCache.delete(m);break}return}this.shouldMeasureDuringScroll(p)&&this.resizeItem(p,this.options.measureElement(d,u,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(f):f()})}));return{disconnect:()=>{var o;(o=i())==null||o.disconnect(),r=null},observe:o=>{var u;return(u=i())==null?void 0:u.observe(o,{box:"border-box"})},unobserve:o=>{var u;return(u=i())==null?void 0:u.unobserve(o)}}})(),this.range=null,this.setOptions=r=>{var i,o;const u={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:K1,rangeExtractor:Q1,onChange:()=>{},measureElement:eS,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const x in r){const z=r[x];z!==void 0&&(u[x]=z)}const f=this.options;let d=null,p=null,m=!1;if(f!==void 0&&f.enabled&&u.enabled&&u.anchorTo==="end"&&this.scrollElement!==null){const x=f.count,z=u.count,R=this.getMeasurements(),k=x>0?((i=R[0])==null?void 0:i.key)??f.getItemKey(0):null,b=x>0?((o=R[x-1])==null?void 0:o.key)??f.getItemKey(x-1):null;if(z!==x||x>0&&z>0&&(u.getItemKey(0)!==k||u.getItemKey(z-1)!==b)){m=!0;const W=x>0?this.getVirtualItemForOffset(this.getScrollOffset())??R[0]:null;W&&(d=[W.key,this.getScrollOffset()-W.start]);const V=u.followOnAppend===!0?"auto":u.followOnAppend||null;V&&z>x&&this.isAtEnd(f.scrollEndThreshold)&&(x===0||u.getItemKey(z-1)!==b)&&(p=V)}}this.options=u,m&&(this.pendingMin=0,this.itemSizeCacheVersion++);let w=!1,v=0;if(d&&this.scrollOffset!==null){const[x,z]=d,R=this.getMeasurements(),{count:k,getItemKey:b}=this.options;let B=0;for(;B{var i,o;(o=(i=this.options).onChange)==null||o.call(i,this,r)},this.maybeNotify=ml(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),r=>{this.notify(r)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(r=>r()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var r;const i=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==i){if(this.cleanup(),!i){this.maybeNotify();return}if(this.scrollElement=i,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((r=this.scrollElement)==null?void 0:r.window)??null,this.elementsCache.forEach(u=>{this.observer.observe(u)}),this.unsubs.push(this.options.observeElementRect(this,u=>{this.scrollRect=u,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(u,f)=>{this._intendedScrollOffset!==null&&Math.abs(u-this._intendedScrollOffset)<1.5&&(u=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=f?this.getScrollOffset(){this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},d=()=>{this._iosTouching=!1,!(!xf()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};u.addEventListener("touchstart",f,hu),u.addEventListener("touchend",d,hu),this.unsubs.push(()=>{u.removeEventListener("touchstart",f),u.removeEventListener("touchend",d),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const o=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,o&&this.scrollElement&&this.options.enabled){const[u,f,d,p]=o;u!==null&&!d&&(xf()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?p!==0&&(this._iosDeferredAdjustment+=p):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),d&&this.scrollToEnd({behavior:d})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const r=this.getScrollOffset(),i=this.getMaxScrollOffset();if(r<0||r>i)return;const o=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(r,{adjustments:this.scrollAdjustments+=o,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(r,i)=>{const o=new Map,u=new Map;for(let f=i-1;f>=0;f--){const d=r[f];if(o.has(d.lane))continue;const p=u.get(d.lane);if(p==null||d.end>p.end?u.set(d.lane,d):d.endf.end===d.end?f.index-d.index:f.end-d.end)[0]:void 0},this.getMeasurementOptions=ml(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(r,i,o,u,f,d,p)=>(this.prevLanes!==void 0&&this.prevLanes!==d&&(this.lanesChangedFlag=!0),this.prevLanes=d,this.pendingMin=null,{count:r,paddingStart:i,scrollMargin:o,getItemKey:u,enabled:f,lanes:d,laneAssignmentMode:p}),{key:!1}),this.getMeasurements=ml(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:r,paddingStart:i,scrollMargin:o,getItemKey:u,enabled:f,lanes:d,laneAssignmentMode:p},m)=>{const w=this.itemSizeCache;if(!f)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>r)for(const R of this.laneAssignments.keys())R>=r&&this.laneAssignments.delete(R);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(R=>{this.itemSizeCache.set(R.key,R.size)}));const v=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===r&&(this.lanesSettling=!1),d===1){const R=this.options.gap,k=r*2;let b=this._flatMeasurements;if(!b||b.length0&&W.set(b.subarray(0,v*2)),b=W,this._flatMeasurements=b}let B;if(v===0)B=i+o;else{const W=v-1;B=b[W*2]+b[W*2+1]+R}for(let W=v;W1){B=b;const ee=z[B],re=ee!==void 0?x[ee]:void 0;P=re?re.end+this.options.gap:i+o}else{const ee=this.options.lanes===1?x[R-1]:this.getFurthestMeasurement(x,R);P=ee?ee.end+this.options.gap:i+o,B=ee?ee.lane:R%this.options.lanes,this.options.lanes>1&&W&&this.laneAssignments.set(R,B)}const V=w.get(k),Z=typeof V=="number"?V:this.options.estimateSize(R),G=P+Z;x[R]={index:R,start:P,size:Z,end:G,key:k,lane:B},z[B]=R}return this.measurementsCache=x,x},{key:!1,debug:()=>this.options.debug}),this.calculateRange=ml(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(r,i,o,u)=>this.range=r.length>0&&i>0?iS({measurements:r,outerSize:i,scrollOffset:o,lanes:u,flat:u===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=ml(()=>{let r=null,i=null;const o=this.calculateRange();return o&&(r=o.startIndex,i=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,r,i]),[this.options.rangeExtractor,this.options.overscan,this.options.count,r,i]},(r,i,o,u,f)=>u===null||f===null?[]:r({startIndex:u,endIndex:f,overscan:i,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=r=>{const i=this.options.indexAttribute,o=r.getAttribute(i);return o?parseInt(o,10):(console.warn(`Missing attribute name '${i}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=r=>{var i;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const o=this.scrollState.index??((i=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:i.index);if(o!==void 0&&this.range){const u=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),f=Math.max(0,o-u),d=Math.min(this.options.count-1,o+u);return r>=f&&r<=d}return!0},this.measureElement=r=>{if(!r){this.elementsCache.forEach((f,d)=>{f.isConnected||(this.observer.unobserve(f),this.elementsCache.delete(d))});return}const i=this.indexFromElement(r),o=this.options.getItemKey(i),u=this.elementsCache.get(o);u!==r&&(u&&this.observer.unobserve(u),this.observer.observe(r),this.elementsCache.set(o,r)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(i)&&this.resizeItem(i,this.options.measureElement(r,void 0,this))},this.resizeItem=(r,i)=>{var o,u;if(r<0||r>=this.options.count)return;let f,d,p;const m=this._flatMeasurements;if(this.options.lanes===1&&m!==null)p=this.options.getItemKey(r),d=m[r*2],f=m[r*2+1];else{const x=this.measurementsCache[r];if(!x)return;p=x.key,d=x.start,f=x.size}const w=this.itemSizeCache.get(p)??f,v=i-w;if(v!==0){const x=this.options.anchorTo==="end"&&((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,z=x?this.getTotalSize():0,R=((u=this.scrollState)==null?void 0:u.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[r]??{index:r,key:p,start:d,size:f,end:d+f,lane:0},v,this):d[this.getVirtualIndexes(),this.getMeasurements()],(r,i)=>{const o=[];for(let u=0,f=r.length;uthis.options.debug}),this.getVirtualItemForOffset=r=>{const i=this.getMeasurements();if(i.length===0)return;const o=this._flatMeasurements,u=this.options.lanes===1&&o!=null,f=Hm(0,i.length-1,u?d=>o[d*2]:d=>xg(i[d]).start,r);return xg(i[f])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const r=this.scrollElement.document.documentElement;return this.options.horizontal?r.scrollWidth-this.scrollElement.innerWidth:r.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(r=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=r,this.getOffsetForAlignment=(r,i,o=0)=>{if(!this.scrollElement)return 0;const u=this.getSize(),f=this.getScrollOffset();i==="auto"&&(i=r>=f+u?"end":"start"),i==="center"?r+=(o-u)/2:i==="end"&&(r-=u);const d=this.getMaxScrollOffset();return Math.max(Math.min(d,r),0)},this.getOffsetForIndex=(r,i="auto")=>{r=Math.max(0,Math.min(r,this.options.count-1));const o=this.getSize(),u=this.getScrollOffset(),f=this.measurementsCache[r];if(!f)return;if(i==="auto")if(f.end>=u+o-this.options.scrollPaddingEnd)i="end";else if(f.start<=u+this.options.scrollPaddingStart)i="start";else return[u,i];if(i==="end"&&r===this.options.count-1)return[this.getMaxScrollOffset(),i];const d=i==="end"?f.end+this.options.scrollPaddingEnd:f.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(d,i,f.size),i]},this.scrollToOffset=(r,{align:i="start",behavior:o="auto"}={})=>{const u=this.getOffsetForAlignment(r,i),f=this.now();this.scrollState={index:null,align:i,behavior:o,startedAt:f,lastTargetOffset:u,stableFrames:0},this._scrollToOffset(u,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(r,{align:i="auto",behavior:o="auto"}={})=>{r=Math.max(0,Math.min(r,this.options.count-1));const u=this.getOffsetForIndex(r,i);if(!u)return;const[f,d]=u,p=this.now();this.scrollState={index:r,align:d,behavior:o,startedAt:p,lastTargetOffset:f,stableFrames:0},this._scrollToOffset(f,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(r,{behavior:i="auto"}={})=>{const o=this.getScrollOffset()+r,u=this.now();this.scrollState={index:null,align:"start",behavior:i,startedAt:u,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:r="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:r});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:r})},this.getTotalSize=()=>{var r;const i=this.getMeasurements();let o;if(i.length===0)o=this.options.paddingStart;else if(this.options.lanes===1){const u=i.length-1,f=this._flatMeasurements;f!=null?o=f[u*2]+f[u*2+1]:o=((r=i[u])==null?void 0:r.end)??0}else{const u=Array(this.options.lanes).fill(null);let f=i.length-1;for(;f>=0&&u.some(d=>d===null);){const d=i[f];u[d.lane]===null&&(u[d.lane]=d.end),f--}o=Math.max(...u.filter(d=>d!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const r=[];if(this.itemSizeCache.size===0)return r;const i=this.getMeasurements();for(const o of i)o&&this.itemSizeCache.has(o.key)&&r.push({index:o.index,key:o.key,start:o.start,size:o.size,end:o.end,lane:o.lane});return r},this._scrollToOffset=(r,{adjustments:i,behavior:o})=>{this._intendedScrollOffset=r+(i??0),this.options.scrollToFn(r,{behavior:o,adjustments:i},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}applyScrollAdjustment(t,r){t!==0&&(xf()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=t:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:r}))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const i=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,o=i?i[0]:this.scrollState.lastTargetOffset,u=1,f=o!==this.scrollState.lastTargetOffset;if(!f&&G1(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=u){this.getScrollOffset()!==o&&this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,f){const d=this.getSize()||600,p=Math.abs(o-this.getScrollOffset()),m=this.scrollState.behavior==="smooth"&&p>d;this.scrollState.lastTargetOffset=o,m||(this.scrollState.behavior="auto"),this._scrollToOffset(o,{adjustments:void 0,behavior:m?"smooth":"auto"})}this.scheduleScrollReconcile()}}const Hm=(l,t,r,i)=>{for(;l<=t;){const o=(l+t)/2|0,u=r(o);if(ui)t=o-1;else return o}return l>0?l-1:0};function iS({measurements:l,outerSize:t,scrollOffset:r,lanes:i,flat:o}){const u=l.length-1,f=o?w=>o[w*2]:w=>l[w].start,d=o?w=>o[w*2]+o[w*2+1]:w=>l[w].end;if(l.length<=i)return{startIndex:0,endIndex:u};let p=Hm(0,u,f,r),m=p;if(i===1)for(;m1){const w=Array(i).fill(0);for(;mx=0&&v.some(x=>x>=r);){const x=l[p];v[x.lane]=x.start,p--}p=Math.max(0,p-p%i),m=Math.min(u,m+(i-1-m%i))}return{startIndex:p,endIndex:m}}const _f=typeof document<"u"?j.useLayoutEffect:j.useEffect;function sS({useFlushSync:l=!0,directDomUpdates:t=!1,directDomUpdatesMode:r="transform",...i}){const o=j.useReducer(m=>m+1,0)[1],u=j.useRef({enabled:t,mode:r,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});u.current.enabled=t,u.current.mode=r;const f=m=>{const w=u.current;if(!w.enabled||!w.container)return;const v=m.getTotalSize();if(v!==w.lastSize){w.lastSize=v;const B=m.options.horizontal?"width":"height";w.container.style[B]=`${v}px`}const x=!!m.options.horizontal,z=w.mode==="transform",R=x?"left":"top",k=m.options.scrollMargin,b=m.getVirtualItems();for(const B of b){const P=B.start-k,W=m.elementsCache.get(B.key);W&&w.lastPositions.get(W)!==P&&(w.lastPositions.set(W,P),z?W.style.transform=x?`translate3d(${P}px, 0, 0)`:`translate3d(0, ${P}px, 0)`:W.style[R]=`${P}px`)}},d={...i,onChange:(m,w)=>{var v;const x=u.current;let z=!0;if(x.enabled){f(m);const R=m.range,k=x.prevRange;z=!k||k.isScrolling!==m.isScrolling||k.startIndex!==(R==null?void 0:R.startIndex)||k.endIndex!==(R==null?void 0:R.endIndex),z&&(x.prevRange=R?{startIndex:R.startIndex,endIndex:R.endIndex,isScrolling:m.isScrolling}:null)}z&&(l&&w?bs.flushSync(o):o()),(v=i.onChange)==null||v.call(i,m,w)}},[p]=j.useState(()=>{const m=new rS(d);return Object.assign(m,{containerRef:w=>{const v=u.current;if(v.container=w,v.lastSize=null,w&&v.enabled){const x=m.getTotalSize();v.lastSize=x;const z=m.options.horizontal?"width":"height";w.style[z]=`${x}px`}}})});return p.setOptions(d),_f(()=>p._didMount(),[]),_f(()=>p._willUpdate()),_f(()=>{f(p)}),p}function lS(l){return sS({observeElementRect:X1,observeElementOffset:Z1,scrollToFn:nS,...l})}const oS={pos:"p",vel:"v",torque:"τ",kp:"kp",kd:"kd",vel_limit:"vlim",torque_limit:"τlim",t_mos:"Tm",t_rotor:"Tr"},aS=["pos","vel","torque","kp","kd","t_mos","t_rotor"];function uS(l){const t=[];for(const r of aS)r in l.fields&&t.push(`${oS[r]||r} ${l.fields[r].toFixed(2)}`);return t.join(" ")||l.note||""}function cS(l){const t=new Date(l*1e3),r=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0"),o=String(t.getSeconds()).padStart(2,"0"),u=String(Math.floor(l%1*1e3)).padStart(3,"0");return`${r}:${i}:${o}.${u}`}function fS(){const[,l]=j.useState(0),[t,r]=j.useState(!1),i=j.useRef(null),o=j.useRef([]);j.useEffect(()=>{gg(!0);const d=M1(()=>{t||(o.current=z1(),l(p=>p+1))});return()=>{gg(!1),d()}},[t]);const u=o.current,f=lS({count:u.length,getScrollElement:()=>i.current,estimateSize:()=>22,overscan:12});return j.useEffect(()=>{!t&&u.length&&f.scrollToIndex(u.length-1)},[u.length,t,f]),U.jsxs("div",{className:"panel rawlog-panel",children:[U.jsxs("div",{className:"rawlog-toolbar",children:[U.jsx("button",{className:t?"btn small":"btn small active",onClick:()=>r(d=>!d),children:t?"Resume":"Pause"}),U.jsxs("span",{className:"muted",children:[u.length," frames"]})]}),U.jsxs("div",{className:"rawlog-body",ref:i,children:[U.jsxs("div",{className:"rawlog-head",children:[U.jsx("span",{className:"c-t",children:"time"}),U.jsx("span",{className:"c-arb",children:"arb"}),U.jsx("span",{className:"c-m",children:"motor"}),U.jsx("span",{className:"c-k",children:"kind"}),U.jsx("span",{className:"c-f",children:"decoded"}),U.jsx("span",{className:"c-r",children:"raw"})]}),U.jsx("div",{style:{height:f.getTotalSize(),position:"relative"},children:f.getVirtualItems().map(d=>{const p=u[d.index];return U.jsxs("div",{className:"rawlog-row k-"+p.kind,style:{transform:`translateY(${d.start}px)`},children:[U.jsx("span",{className:"c-t mono",children:cS(p.t)}),U.jsxs("span",{className:"c-arb mono",children:["0x",p.arb.toString(16).toUpperCase()]}),U.jsxs("span",{className:"c-m mono",children:["m",p.motorId]}),U.jsx("span",{className:"c-k",children:p.mode||p.kind}),U.jsx("span",{className:"c-f mono",children:uS(p)}),U.jsx("span",{className:"c-r mono dim",children:p.raw})]},p.seq)})})]})]})}const Fm=[{kind:"plot",title:"Plot",icon:"〜",description:"Time-series chart; drag signals onto it (cmd over fb to overlay).",render:l=>U.jsx(B1,{panelId:l})},{kind:"table",title:"Motor Table",icon:"▦",description:"One row per motor: commanded vs actual.",render:()=>U.jsx(U1,{})},{kind:"cards",title:"Motor Cards",icon:"▢",description:"Per-motor cards/gauges with big readouts.",render:()=>U.jsx(V1,{})},{kind:"rawlog",title:"Raw CAN Log",icon:"≣",description:"Scrolling decoded frame log.",render:()=>U.jsx(fS,{})}],dS=Object.fromEntries(Fm.map(l=>[l.kind,l]));function hS(){const l=gn(u=>u.connected),t=gn(u=>u.status),r=Eo(u=>u.addWidget),i=Eo(u=>u.resetWidgets),o=()=>i();return U.jsxs("header",{className:"toolbar",children:[U.jsxs("div",{className:"brand",children:[U.jsx("span",{className:"brand-dot"}),"DaMiao ",U.jsx("span",{className:"brand-sub",children:"Passive Monitor"})]}),U.jsxs("div",{className:"conn",children:[U.jsx("span",{className:"dot "+(l?"on":"off")}),U.jsx("span",{className:"mono",children:t!=null&&t.demo?"demo":(t==null?void 0:t.channel)||"—"}),t&&!t.demo&&U.jsx("span",{className:"badge "+(t.listenOnly?"ok":"warn"),title:"hardware listen-only",children:t.listenOnly?"listen-only":"rx (no TX)"}),(t==null?void 0:t.error)&&U.jsx("span",{className:"badge err",title:t.error,children:"bus error"}),t&&U.jsxs("span",{className:"muted small",children:[t.framesSeen.toLocaleString()," frames · +",t.feedbackOffset," fb"]})]}),U.jsx("div",{className:"spacer"}),U.jsxs("div",{className:"actions",children:[Fm.map(u=>U.jsxs("button",{className:"btn",title:u.description,onClick:()=>r(u.kind),children:[U.jsx("span",{className:"btn-icon",children:u.icon})," ",u.title]},u.kind)),U.jsx("button",{className:"btn ghost",onClick:o,children:"Reset"})]})]})}function pS({sig:l}){const{attributes:t,listeners:r,setNodeRef:i,isDragging:o}=r0({id:`sig:${l.id}`,data:{signalId:l.id}}),u=ru(l);return U.jsxs("div",{ref:i,className:"sig-chip"+(o?" dragging":""),...r,...t,title:l.id,children:[U.jsx("span",{className:"sig-swatch",style:{background:u,borderStyle:l.source==="cmd"?"dashed":"solid"}}),U.jsxs("span",{className:"sig-name",children:[l.source,".",l.field]}),l.unit&&U.jsx("span",{className:"sig-unit",children:l.unit})]})}function gS(l){return[...l].sort((t,r)=>{if(t.source!==r.source)return t.source==="cmd"?-1:1;const i=wg.indexOf(t.field),o=wg.indexOf(r.field);return(i<0?99:i)-(o<0?99:o)})}function mS(){const l=gn(u=>u.signals),t=gn(u=>u.status),[r,i]=j.useState(""),o=j.useMemo(()=>{const u=new Map;for(const f of l){if(r&&!f.id.toLowerCase().includes(r.toLowerCase()))continue;const d=u.get(f.motorId)||[];d.push(f),u.set(f.motorId,d)}return Array.from(u.entries()).sort((f,d)=>f[0]-d[0])},[l,r]);return U.jsxs("aside",{className:"sidebar",children:[U.jsxs("div",{className:"sidebar-head",children:[U.jsx("div",{className:"sidebar-title",children:"Signals"}),U.jsx("input",{className:"filter",placeholder:"filter…",value:r,onChange:u=>i(u.target.value)})]}),U.jsxs("div",{className:"sidebar-body",children:[o.length===0&&U.jsx("div",{className:"muted pad",children:t!=null&&t.error?"Bus error — see top bar.":"No signals yet. Start a controller on the bus (or run --demo)."}),o.map(([u,f])=>U.jsxs("div",{className:"motor-group",children:[U.jsxs("div",{className:"motor-group-title",children:["Motor ",u]}),U.jsx("div",{className:"chips",children:gS(f).map(d=>U.jsx(pS,{sig:d},d.id))})]},u))]}),U.jsxs("div",{className:"sidebar-foot muted",children:["Drag a signal onto a plot. Drop ",U.jsx("b",{children:"cmd"})," onto its ",U.jsx("b",{children:"fb"})," plot to overlay."]})]})}function vS(l,t,r,i,o){const u=(...f)=>(console.warn("gridstack.js: Function `"+r+"` is deprecated in "+o+" and has been replaced with `"+i+"`. It will be **removed** in a future release"),t.apply(l,f));return u.prototype=t.prototype,u}class A{static getElements(t,r=document){if(typeof t=="string"){const i="getElementById"in r?r:void 0;if(i&&!isNaN(+t[0])){const u=i.getElementById(t);return u?[u]:[]}let o=r.querySelectorAll(t);return!o.length&&t[0]!=="."&&t[0]!=="#"&&(o=r.querySelectorAll("."+t),o.length||(o=r.querySelectorAll("#"+t))),Array.from(o)}return[t]}static getElement(t,r=document){if(typeof t=="string"){const i="getElementById"in r?r:void 0;if(!t.length)return null;if(i&&t[0]==="#")return i.getElementById(t.substring(1));if(t[0]==="#"||t[0]==="."||t[0]==="[")return r.querySelector(t);if(i&&!isNaN(+t[0]))return i.getElementById(t);let o=r.querySelector(t);return i&&!o&&(o=i.getElementById(t)),o||(o=r.querySelector("."+t)),o}return t}static lazyLoad(t){var r,i;return t.lazyLoad||((i=(r=t.grid)==null?void 0:r.opts)==null?void 0:i.lazyLoad)&&t.lazyLoad!==!1}static createDiv(t,r){const i=document.createElement("div");return t.forEach(o=>{o&&i.classList.add(o)}),r==null||r.appendChild(i),i}static shouldSizeToContent(t,r=!1){return(t==null?void 0:t.grid)&&(r?t.sizeToContent===!0||t.grid.opts.sizeToContent===!0&&t.sizeToContent===void 0:!!t.sizeToContent||t.grid.opts.sizeToContent&&t.sizeToContent!==!1)}static isIntercepted(t,r){return!(t.y>=r.y+r.h||t.y+t.h<=r.y||t.x+t.w<=r.x||t.x>=r.x+r.w)}static isTouching(t,r){return A.isIntercepted(t,{x:r.x-.5,y:r.y-.5,w:r.w+1,h:r.h+1})}static areaIntercept(t,r){const i=t.x>r.x?t.x:r.x,o=t.x+t.wr.y?t.y:r.y,f=t.y+t.h{const f=r*((o.y??1e4)-(u.y??1e4));return f===0?r*((o.x??1e4)-(u.x??1e4)):f})}static find(t,r){return r?t.find(i=>i.id===r):void 0}static createStylesheet(t,r,i){const o=document.createElement("style"),u=i==null?void 0:i.nonce;return u&&(o.nonce=u),o.setAttribute("type","text/css"),o.setAttribute("gs-style-id",t),o.styleSheet?o.styleSheet.cssText="":o.appendChild(document.createTextNode("")),r?r.insertBefore(o,r.firstChild):(r=document.getElementsByTagName("head")[0],r.appendChild(o)),o}static removeStylesheet(t,r){const o=(r||document).querySelector("STYLE[gs-style-id="+t+"]");o&&o.parentNode&&o.remove()}static addCSSRule(t,r,i){t.textContent+=`${r} { ${i} } `}static toBool(t){return typeof t=="boolean"?t:typeof t=="string"?(t=t.toLowerCase(),!(t===""||t==="no"||t==="false"||t==="0")):!!t}static toNumber(t){return t===null||t.length===0?void 0:Number(t)}static parseHeight(t){let r,i="px";if(typeof t=="string")if(t==="auto"||t==="")r=0;else{const o=t.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!o)throw new Error(`Invalid height val = ${t}`);i=o[2]||"px",r=parseFloat(o[1])}else r=t;return{h:r,unit:i}}static defaults(t,...r){return r.forEach(i=>{for(const o in i){if(!i.hasOwnProperty(o))return;t[o]===null||t[o]===void 0?t[o]=i[o]:typeof i[o]=="object"&&typeof t[o]=="object"&&this.defaults(t[o],i[o])}}),t}static same(t,r){if(typeof t!="object")return t==r;if(typeof t!=typeof r||Object.keys(t).length!==Object.keys(r).length)return!1;for(const i in t)if(t[i]!==r[i])return!1;return!0}static copyPos(t,r,i=!1){return r.x!==void 0&&(t.x=r.x),r.y!==void 0&&(t.y=r.y),r.w!==void 0&&(t.w=r.w),r.h!==void 0&&(t.h=r.h),i&&(r.minW&&(t.minW=r.minW),r.minH&&(t.minH=r.minH),r.maxW&&(t.maxW=r.maxW),r.maxH&&(t.maxH=r.maxH)),t}static samePos(t,r){return t&&r&&t.x===r.x&&t.y===r.y&&(t.w||1)===(r.w||1)&&(t.h||1)===(r.h||1)}static sanitizeMinMax(t){t.minW||delete t.minW,t.minH||delete t.minH,t.maxW||delete t.maxW,t.maxH||delete t.maxH}static removeInternalAndSame(t,r){if(!(typeof t!="object"||typeof r!="object"))for(let i in t){const o=t[i],u=r[i];i[0]==="_"||o===u?delete t[i]:o&&typeof o=="object"&&u!==void 0&&(A.removeInternalAndSame(o,u),Object.keys(o).length||delete t[i])}}static removeInternalForSave(t,r=!0){for(let i in t)(i[0]==="_"||t[i]===null||t[i]===void 0)&&delete t[i];delete t.grid,r&&delete t.el,t.autoPosition||delete t.autoPosition,t.noResize||delete t.noResize,t.noMove||delete t.noMove,t.locked||delete t.locked,(t.w===1||t.w===t.minW)&&delete t.w,(t.h===1||t.h===t.minH)&&delete t.h}static throttle(t,r){let i=!1;return(...o)=>{i||(i=!0,setTimeout(()=>{t(...o),i=!1},r))}}static removePositioningStyles(t){const r=t.style;r.position&&r.removeProperty("position"),r.left&&r.removeProperty("left"),r.top&&r.removeProperty("top"),r.width&&r.removeProperty("width"),r.height&&r.removeProperty("height")}static getScrollElement(t){if(!t)return document.scrollingElement||document.documentElement;const r=getComputedStyle(t);return/(auto|scroll)/.test(r.overflow+r.overflowY)?t:this.getScrollElement(t.parentElement)}static updateScrollPosition(t,r,i){const o=t.getBoundingClientRect(),u=window.innerHeight||document.documentElement.clientHeight;if(o.top<0||o.bottom>u){const f=o.bottom-u,d=o.top,p=this.getScrollElement(t);if(p!==null){const m=p.scrollTop;o.top<0&&i<0?t.offsetHeight>u?p.scrollTop+=i:p.scrollTop+=Math.abs(d)>Math.abs(i)?i:d:i>0&&(t.offsetHeight>u?p.scrollTop+=i:p.scrollTop+=f>i?i:f),r.top+=p.scrollTop-m}}}static updateScrollResize(t,r,i){const o=this.getScrollElement(r),u=o.clientHeight,f=o===this.getScrollElement()?0:o.getBoundingClientRect().top,d=t.clientY-f,p=du-i;p?o.scrollBy({behavior:"smooth",top:d-i}):m&&o.scrollBy({behavior:"smooth",top:i-(u-d)})}static clone(t){return t==null||typeof t!="object"?t:t instanceof Array?[...t]:{...t}}static cloneDeep(t){const r=["parentGrid","el","grid","subGrid","engine"],i=A.clone(t);for(const o in i)i.hasOwnProperty(o)&&typeof i[o]=="object"&&o.substring(0,2)!=="__"&&!r.find(u=>u===o)&&(i[o]=A.cloneDeep(t[o]));return i}static cloneNode(t){const r=t.cloneNode(!0);return r.removeAttribute("id"),r}static appendTo(t,r){let i;typeof r=="string"?i=A.getElement(r):i=r,i&&i.appendChild(t)}static addElStyles(t,r){if(r instanceof Object)for(const i in r)r.hasOwnProperty(i)&&(Array.isArray(r[i])?r[i].forEach(o=>{t.style[i]=o}):t.style[i]=r[i])}static initEvent(t,r){const i={type:r.type},o={button:0,which:0,buttons:1,bubbles:!0,cancelable:!0,target:r.target?r.target:t.target};return["altKey","ctrlKey","metaKey","shiftKey"].forEach(u=>i[u]=t[u]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(u=>i[u]=t[u]),{...i,...o}}static simulateMouseEvent(t,r,i){const o=t,u=new MouseEvent(r,{bubbles:!0,composed:!0,cancelable:!0,view:window,detail:1,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY,ctrlKey:o.ctrlKey??!1,altKey:o.altKey??!1,shiftKey:o.shiftKey??!1,metaKey:o.metaKey??!1,button:0,relatedTarget:t.target});(i||t.target).dispatchEvent(u)}static getValuesFromTransformedElement(t){const r=document.createElement("div");A.addElStyles(r,{opacity:"0",position:"fixed",top:"0px",left:"0px",width:"1px",height:"1px",zIndex:"-999999"}),t.appendChild(r);const i=r.getBoundingClientRect();return t.removeChild(r),r.remove(),{xScale:1/i.width,yScale:1/i.height,xOffset:i.left,yOffset:i.top}}static swap(t,r,i){if(!t)return;const o=t[r];t[r]=t[i],t[i]=o}static canBeRotated(t){var r;return!(!t||t.w===t.h||t.locked||t.noResize||(r=t.grid)!=null&&r.opts.disableResize||t.minW&&t.minW===t.maxW||t.minH&&t.minH===t.maxH)}}class ai{constructor(t={}){this.addedNodes=[],this.removedNodes=[],this.defaultColumn=12,this.column=t.column||this.defaultColumn,this.column>this.defaultColumn&&(this.defaultColumn=this.column),this.maxRow=t.maxRow,this._float=t.float,this.nodes=t.nodes||[],this.onChange=t.onChange}batchUpdate(t=!0,r=!0){return!!this.batchMode===t?this:(this.batchMode=t,t?(this._prevFloat=this._float,this._float=!0,this.cleanNodes(),this.saveInitial()):(this._float=this._prevFloat,delete this._prevFloat,r&&this._packNodes(),this._notify()),this)}_useEntireRowArea(t,r){return(!this.float||this.batchMode&&!this._prevFloat)&&!this._hasLocked&&(!t._moving||t._skipDown||r.y<=t.y)}_fixCollisions(t,r=t,i,o={}){if(this.sortNodes(-1),i=i||this.collide(t,r),!i)return!1;if(t._moving&&!o.nested&&!this.float&&this.swap(t,i))return!0;let u=r;!this._loading&&this._useEntireRowArea(t,r)&&(u={x:0,w:this.column,y:r.y,h:r.h},i=this.collide(t,u,o.skip));let f=!1;const d={nested:!0,pack:!1};let p=0;for(;i=i||this.collide(t,u,o.skip);){if(p++>this.nodes.length*2)throw new Error("Infinite collide check");let m;if(i.locked||this._loading||t._moving&&!t._skipDown&&r.y>t.y&&!this.float&&(!this.collide(i,{...i,y:t.y},t)||!this.collide(i,{...i,y:r.y-i.h},t))){t._skipDown=t._skipDown||r.y>t.y;const w={...r,y:i.y+i.h,...d};m=this._loading&&A.samePos(t,w)?!0:this.moveNode(t,w),(i.locked||this._loading)&&m?A.copyPos(r,t):!i.locked&&m&&o.pack&&(this._packNodes(),r.y=i.y+i.h,A.copyPos(t,r)),f=f||m}else m=this.moveNode(i,{...i,y:r.y+r.h,skip:t,...d});if(!m)return f;i=void 0}return f}collide(t,r=t,i){const o=t._id,u=i==null?void 0:i._id;return this.nodes.find(f=>f._id!==o&&f._id!==u&&A.isIntercepted(f,r))}collideAll(t,r=t,i){const o=t._id,u=i==null?void 0:i._id;return this.nodes.filter(f=>f._id!==o&&f._id!==u&&A.isIntercepted(f,r))}directionCollideCoverage(t,r,i){if(!r.rect||!t._rect)return;const o=t._rect,u={...r.rect};u.y>o.y?(u.h+=u.y-o.y,u.y=o.y):u.h+=o.y-u.y,u.x>o.x?(u.w+=u.x-o.x,u.x=o.x):u.w+=o.x-u.x;let f,d=.5;for(let p of i){if(p.locked||!p._rect)break;const m=p._rect;let w=Number.MAX_VALUE,v=Number.MAX_VALUE;o.ym.y+m.h&&(w=(m.y+m.h-u.y)/m.h),o.xm.x+m.w&&(v=(m.x+m.w-u.x)/m.w);const x=Math.min(v,w);x>d&&(d=x,f=p)}return r.collide=f,f}cacheRects(t,r,i,o,u,f){return this.nodes.forEach(d=>d._rect={y:d.y*r+i,x:d.x*t+f,w:d.w*t-f-o,h:d.h*r-i-u}),this}swap(t,r){if(!r||r.locked||!t||t.locked)return!1;function i(){const u=r.x,f=r.y;return r.x=t.x,r.y=t.y,t.h!=r.h?(t.x=u,t.y=r.y+r.h):t.w!=r.w?(t.x=r.x+r.w,t.y=f):(t.x=u,t.y=f),t._dirty=r._dirty=!0,!0}let o;if(t.w===r.w&&t.h===r.h&&(t.x===r.x||t.y===r.y)&&(o=A.isTouching(t,r)))return i();if(o!==!1){if(t.w===r.w&&t.x===r.x&&(o||(o=A.isTouching(t,r)))){if(r.y{let m;f.locked||(f.autoPosition=!0,t==="list"&&d&&(m=p[d-1])),this.addNode(f,!1,m)}),o||delete this._inColumnResize,i||this.batchUpdate(!1),this}set float(t){this._float!==t&&(this._float=t||!1,t||this._packNodes()._notify())}get float(){return this._float||!1}sortNodes(t=1){return this.nodes=A.sort(this.nodes,t),this}_packNodes(){return this.batchMode?this:(this.sortNodes(),this.float?this.nodes.forEach(t=>{if(t._updating||t._orig===void 0||t.y===t._orig.y)return;let r=t.y;for(;r>t._orig.y;)--r,this.collide(t,{x:t.x,y:r,w:t.w,h:t.h})||(t._dirty=!0,t.y=r)}):this.nodes.forEach((t,r)=>{if(!t.locked)for(;t.y>0;){const i=r===0?0:t.y-1;if(!(r===0||!this.collide(t,{x:t.x,y:i,w:t.w,h:t.h})))break;t._dirty=t.y!==i,t.y=i}}),this)}prepareNode(t,r){t._id=t._id??ai._idSeq++;const i=t.id;if(i){let u=1;for(;this.nodes.find(f=>f.id===t.id&&f!==t);)t.id=i+"_"+u++}(t.x===void 0||t.y===void 0||t.x===null||t.y===null)&&(t.autoPosition=!0);const o={x:0,y:0,w:1,h:1};return A.defaults(t,o),t.autoPosition||delete t.autoPosition,t.noResize||delete t.noResize,t.noMove||delete t.noMove,A.sanitizeMinMax(t),typeof t.x=="string"&&(t.x=Number(t.x)),typeof t.y=="string"&&(t.y=Number(t.y)),typeof t.w=="string"&&(t.w=Number(t.w)),typeof t.h=="string"&&(t.h=Number(t.h)),isNaN(t.x)&&(t.x=o.x,t.autoPosition=!0),isNaN(t.y)&&(t.y=o.y,t.autoPosition=!0),isNaN(t.w)&&(t.w=o.w),isNaN(t.h)&&(t.h=o.h),this.nodeBoundFix(t,r),t}nodeBoundFix(t,r){const i=t._orig||A.copyPos({},t);if(t.maxW&&(t.w=Math.min(t.w||1,t.maxW)),t.maxH&&(t.h=Math.min(t.h||1,t.maxH)),t.minW&&(t.w=Math.max(t.w||1,t.minW)),t.minH&&(t.h=Math.max(t.h||1,t.minH)),(t.x||0)+(t.w||1)>this.column&&this.columnthis.column?t.w=this.column:t.w<1&&(t.w=1),this.maxRow&&t.h>this.maxRow?t.h=this.maxRow:t.h<1&&(t.h=1),t.x<0&&(t.x=0),t.y<0&&(t.y=0),t.x+t.w>this.column&&(r?t.w=this.column-t.x:t.x=this.column-t.w),this.maxRow&&t.y+t.h>this.maxRow&&(r?t.h=this.maxRow-t.y:t.y=this.maxRow-t.h),A.samePos(t,i)||(t._dirty=!0),this}getDirtyNodes(t){return t?this.nodes.filter(r=>r._dirty&&!A.samePos(r,r._orig)):this.nodes.filter(r=>r._dirty)}_notify(t){if(this.batchMode||!this.onChange)return this;const r=(t||[]).concat(this.getDirtyNodes());return this.onChange(r),this}cleanNodes(){return this.batchMode?this:(this.nodes.forEach(t=>{delete t._dirty,delete t._lastTried}),this)}saveInitial(){return this.nodes.forEach(t=>{t._orig=A.copyPos({},t),delete t._dirty}),this._hasLocked=this.nodes.some(t=>t.locked),this}restoreInitial(){return this.nodes.forEach(t=>{!t._orig||A.samePos(t,t._orig)||(A.copyPos(t,t._orig),t._dirty=!0)}),this._notify(),this}findEmptyPosition(t,r=this.nodes,i=this.column,o){const u=o?o.y*i+(o.x+o.w):0;let f=!1;for(let d=u;!f;++d){const p=d%i,m=Math.floor(d/i);if(p+t.w>i)continue;const w={x:p,y:m,w:t.w,h:t.h};r.find(v=>A.isIntercepted(w,v))||((t.x!==p||t.y!==m)&&(t._dirty=!0),t.x=p,t.y=m,delete t.autoPosition,f=!0)}return f}addNode(t,r=!1,i){const o=this.nodes.find(f=>f._id===t._id);if(o)return o;this._inColumnResize?this.nodeBoundFix(t):this.prepareNode(t),delete t._temporaryRemoved,delete t._removeDOM;let u;return t.autoPosition&&this.findEmptyPosition(t,this.nodes,this.column,i)&&(delete t.autoPosition,u=!0),this.nodes.push(t),r&&this.addedNodes.push(t),u||this._fixCollisions(t),this.batchMode||this._packNodes()._notify(),t}removeNode(t,r=!0,i=!1){return this.nodes.find(o=>o._id===t._id)?(i&&this.removedNodes.push(t),r&&(t._removeDOM=!0),this.nodes=this.nodes.filter(o=>o._id!==t._id),t._isAboutToRemove||this._packNodes(),this._notify([t]),this):this}removeAll(t=!0,r=!0){if(delete this._layouts,!this.nodes.length)return this;t&&this.nodes.forEach(o=>o._removeDOM=!0);const i=this.nodes;return this.removedNodes=r?i:[],this.nodes=[],this._notify(i)}moveNodeCheck(t,r){if(!this.changedPosConstrain(t,r))return!1;if(r.pack=!0,!this.maxRow)return this.moveNode(t,r);let i;const o=new ai({column:this.column,float:this.float,nodes:this.nodes.map(f=>f._id===t._id?(i={...f},i):{...f})});if(!i)return!1;const u=o.moveNode(i,r)&&o.getRow()<=Math.max(this.getRow(),this.maxRow);if(!u&&!r.resizing&&r.collide){const f=r.collide.el.gridstackNode;if(this.swap(t,f))return this._notify(),!0}return u?(o.nodes.filter(f=>f._dirty).forEach(f=>{const d=this.nodes.find(p=>p._id===f._id);d&&(A.copyPos(d,f),d._dirty=!0)}),this._notify(),!0):!1}willItFit(t){if(delete t._willFitPos,!this.maxRow)return!0;const r=new ai({column:this.column,float:this.float,nodes:this.nodes.map(o=>({...o}))}),i={...t};return this.cleanupNode(i),delete i.el,delete i._id,delete i.content,delete i.grid,r.addNode(i),r.getRow()<=this.maxRow?(t._willFitPos=A.copyPos({},i),!0):!1}changedPosConstrain(t,r){return r.w=r.w||t.w,r.h=r.h||t.h,t.x!==r.x||t.y!==r.y?!0:(t.maxW&&(r.w=Math.min(r.w,t.maxW)),t.maxH&&(r.h=Math.min(r.h,t.maxH)),t.minW&&(r.w=Math.max(r.w,t.minW)),t.minH&&(r.h=Math.max(r.h,t.minH)),t.w!==r.w||t.h!==r.h)}moveNode(t,r){var m,w;if(!t||!r)return!1;let i;r.pack===void 0&&!this.batchMode&&(i=r.pack=!0),typeof r.x!="number"&&(r.x=t.x),typeof r.y!="number"&&(r.y=t.y),typeof r.w!="number"&&(r.w=t.w),typeof r.h!="number"&&(r.h=t.h);const o=t.w!==r.w||t.h!==r.h,u=A.copyPos({},t,!0);if(A.copyPos(u,r),this.nodeBoundFix(u,o),A.copyPos(r,u),!r.forceCollide&&A.samePos(t,r))return!1;const f=A.copyPos({},t),d=this.collideAll(t,u,r.skip);let p=!0;if(d.length){const v=t._moving&&!r.nested;let x=v?this.directionCollideCoverage(t,r,d):d[0];if(v&&x&&((w=(m=t.grid)==null?void 0:m.opts)!=null&&w.subGridDynamic)&&!t.grid._isTemp){const z=A.areaIntercept(r.rect,x._rect),R=A.area(r.rect),k=A.area(x._rect);z/(R.8&&(x.grid.makeSubGrid(x.el,void 0,t),x=void 0)}x?p=!this._fixCollisions(t,u,x,r):(p=!1,i&&delete r.pack)}return p&&!A.samePos(t,u)&&(t._dirty=!0,A.copyPos(t,u)),r.pack&&this._packNodes()._notify(),!A.samePos(t,f)}getRow(){return this.nodes.reduce((t,r)=>Math.max(t,r.y+r.h),0)}beginUpdate(t){return t._updating||(t._updating=!0,delete t._skipDown,this.batchMode||this.saveInitial()),this}endUpdate(){const t=this.nodes.find(r=>r._updating);return t&&(delete t._updating,delete t._skipDown),this}save(t=!0,r){var f;const i=(f=this._layouts)==null?void 0:f.length,o=i&&this.column!==i-1?this._layouts[i-1]:null,u=[];return this.sortNodes(),this.nodes.forEach(d=>{const p=o==null?void 0:o.find(w=>w._id===d._id),m={...d,...p||{}};A.removeInternalForSave(m,!t),r&&r(d,m),u.push(m)}),u}layoutsNodesChange(t){return!this._layouts||this._inColumnResize?this:(this._layouts.forEach((r,i)=>{if(!r||i===this.column)return this;if(i{if(!u._orig)return;const f=r.find(d=>d._id===u._id);f&&(f.y>=0&&u.y!==u._orig.y&&(f.y+=u.y-u._orig.y),u.x!==u._orig.x&&(f.x=Math.round(u.x*o)),u.w!==u._orig.w&&(f.w=Math.round(u.w*o)))})}}),this)}columnChanged(t,r,i="moveScale"){var d;if(!this.nodes.length||!r||t===r)return this;const o=i==="compact"||i==="list";o&&this.sortNodes(1),rt&&this._layouts){const p=this._layouts[r]||[],m=this._layouts.length-1;!p.length&&t!==m&&((d=this._layouts[m])!=null&&d.length)&&(t=m,this._layouts[m].forEach(w=>{const v=f.find(x=>x._id===w._id);v&&(!o&&!w.autoPosition&&(v.x=w.x??v.x,v.y=w.y??v.y),v.w=w.w??v.w,(w.x==null||w.y===void 0)&&(v.autoPosition=!0))})),p.forEach(w=>{const v=f.findIndex(x=>x._id===w._id);if(v!==-1){const x=f[v];if(o){x.w=w.w;return}(w.autoPosition||isNaN(w.x)||isNaN(w.y))&&this.findEmptyPosition(w,u),w.autoPosition||(x.x=w.x??x.x,x.y=w.y??x.y,x.w=w.w??x.w,u.push(x)),f.splice(v,1)}})}if(o)this.compact(i,!1);else{if(f.length)if(typeof i=="function")i(r,t,u,f);else{const p=o||i==="none"?1:r/t,m=i==="move"||i==="moveScale",w=i==="scale"||i==="moveScale";f.forEach(v=>{v.x=r===1?0:m?Math.round(v.x*p):Math.min(v.x,r-1),v.w=r===1||t===1?1:w?Math.round(v.w*p)||1:Math.min(v.w,r),u.push(v)}),f=[]}u=A.sort(u,-1),this._inColumnResize=!0,this.nodes=[],u.forEach(p=>{this.addNode(p,!1),delete p._orig})}return this.nodes.forEach(p=>delete p._orig),this.batchUpdate(!1,!o),delete this._inColumnResize,this}cacheLayout(t,r,i=!1){const o=[];return t.forEach((u,f)=>{if(u._id===void 0){const d=u.id?this.nodes.find(p=>p.id===u.id):void 0;u._id=(d==null?void 0:d._id)??ai._idSeq++}o[f]={x:u.x,y:u.y,w:u.w,_id:u._id}}),this._layouts=i?[]:this._layouts||[],this._layouts[r]=o,this}cacheOneLayout(t,r){t._id=t._id??ai._idSeq++;const i={x:t.x,y:t.y,w:t.w,_id:t._id};(t.autoPosition||t.x===void 0)&&(delete i.x,delete i.y,t.autoPosition&&(i.autoPosition=!0)),this._layouts=this._layouts||[],this._layouts[r]=this._layouts[r]||[];const o=this.findCacheLayout(t,r);return o===-1?this._layouts[r].push(i):this._layouts[r][o]=i,this}findCacheLayout(t,r){var i,o;return((o=(i=this._layouts)==null?void 0:i[r])==null?void 0:o.findIndex(u=>u._id===t._id))??-1}removeNodeFromLayoutCache(t){if(this._layouts)for(let r=0;r0||navigator.msMaxTouchPoints>0);class ui{}function pu(l,t){l.touches.length>1||(l.cancelable&&l.preventDefault(),A.simulateMouseEvent(l.changedTouches[0],t))}function jm(l,t){l.cancelable&&l.preventDefault(),A.simulateMouseEvent(l,t)}function gu(l){ui.touchHandled||(ui.touchHandled=!0,pu(l,"mousedown"))}function mu(l){ui.touchHandled&&pu(l,"mousemove")}function vu(l){if(!ui.touchHandled)return;ui.pointerLeaveTimeout&&(window.clearTimeout(ui.pointerLeaveTimeout),delete ui.pointerLeaveTimeout);const t=!!Le.dragElement;pu(l,"mouseup"),t||pu(l,"click"),ui.touchHandled=!1}function yu(l){l.pointerType!=="mouse"&&l.target.releasePointerCapture(l.pointerId)}function Eg(l){Le.dragElement&&l.pointerType!=="mouse"&&jm(l,"mouseenter")}function Cg(l){Le.dragElement&&l.pointerType!=="mouse"&&(ui.pointerLeaveTimeout=window.setTimeout(()=>{delete ui.pointerLeaveTimeout,jm(l,"mouseleave")},10))}class bu{constructor(t,r,i){this.host=t,this.dir=r,this.option=i,this.moving=!1,this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this._init()}_init(){const t=this.el=document.createElement("div");return t.classList.add("ui-resizable-handle"),t.classList.add(`${bu.prefix}${this.dir}`),t.style.zIndex="100",t.style.userSelect="none",this.host.appendChild(this.el),this.el.addEventListener("mousedown",this._mouseDown),Kr&&(this.el.addEventListener("touchstart",gu),this.el.addEventListener("pointerdown",yu)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),Kr&&(this.el.removeEventListener("touchstart",gu),this.el.removeEventListener("pointerdown",yu)),this.host.removeChild(this.el),delete this.el,delete this.host,this}_mouseDown(t){this.mouseDownEvent=t,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),Kr&&(this.el.addEventListener("touchmove",mu),this.el.addEventListener("touchend",vu)),t.stopPropagation(),t.preventDefault()}_mouseMove(t){const r=this.mouseDownEvent;this.moving?this._triggerEvent("move",t):Math.abs(t.x-r.x)+Math.abs(t.y-r.y)>2&&(this.moving=!0,this._triggerEvent("start",this.mouseDownEvent),this._triggerEvent("move",t),document.addEventListener("keydown",this._keyEvent)),t.stopPropagation()}_mouseUp(t){this.moving&&(this._triggerEvent("stop",t),document.removeEventListener("keydown",this._keyEvent)),document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),Kr&&(this.el.removeEventListener("touchmove",mu),this.el.removeEventListener("touchend",vu)),delete this.moving,delete this.mouseDownEvent,t.stopPropagation(),t.preventDefault()}_keyEvent(t){var r,i;t.key==="Escape"&&((i=(r=this.host.gridstackNode)==null?void 0:r.grid)==null||i.engine.restoreInitial(),this._mouseUp(this.mouseDownEvent))}_triggerEvent(t,r){return this.option[t]&&this.option[t](r),this}}bu.prefix="ui-resizable-";class ad{constructor(){this._eventRegister={}}get disabled(){return this._disabled}on(t,r){this._eventRegister[t]=r}off(t){delete this._eventRegister[t]}enable(){this._disabled=!1}disable(){this._disabled=!0}destroy(){delete this._eventRegister}triggerEvent(t,r){if(!this.disabled&&this._eventRegister&&this._eventRegister[t])return this._eventRegister[t](r)}}class zo extends ad{constructor(t,r={}){super(),this.el=t,this.option=r,this.rectScale={x:1,y:1},this._ui=()=>{const o=this.el.parentElement.getBoundingClientRect(),u={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},f=this.temporalRect||u;return{position:{left:(f.left-o.left)*this.rectScale.x,top:(f.top-o.top)*this.rectScale.y},size:{width:f.width*this.rectScale.x,height:f.height*this.rectScale.y}}},this._mouseOver=this._mouseOver.bind(this),this._mouseOut=this._mouseOut.bind(this),this.enable(),this._setupAutoHide(this.option.autoHide),this._setupHandlers()}on(t,r){super.on(t,r)}off(t){super.off(t)}enable(){super.enable(),this.el.classList.remove("ui-resizable-disabled"),this._setupAutoHide(this.option.autoHide)}disable(){super.disable(),this.el.classList.add("ui-resizable-disabled"),this._setupAutoHide(!1)}destroy(){this._removeHandlers(),this._setupAutoHide(!1),delete this.el,super.destroy()}updateOption(t){const r=t.handles&&t.handles!==this.option.handles,i=t.autoHide&&t.autoHide!==this.option.autoHide;return Object.keys(t).forEach(o=>this.option[o]=t[o]),r&&(this._removeHandlers(),this._setupHandlers()),i&&this._setupAutoHide(this.option.autoHide),this}_setupAutoHide(t){return t?(this.el.classList.add("ui-resizable-autohide"),this.el.addEventListener("mouseover",this._mouseOver),this.el.addEventListener("mouseout",this._mouseOut)):(this.el.classList.remove("ui-resizable-autohide"),this.el.removeEventListener("mouseover",this._mouseOver),this.el.removeEventListener("mouseout",this._mouseOut),Le.overResizeElement===this&&delete Le.overResizeElement),this}_mouseOver(t){Le.overResizeElement||Le.dragElement||(Le.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(t){Le.overResizeElement===this&&(delete Le.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(t=>t.trim()).map(t=>new bu(this.el,t,{start:r=>{this._resizeStart(r)},stop:r=>{this._resizeStop(r)},move:r=>{this._resizing(r,t)}})),this}_resizeStart(t){this.sizeToContent=A.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=A.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=t,this._setupHelper(),this._applyChange();const r=A.initEvent(t,{type:"resizestart",target:this.el});return this.option.start&&this.option.start(r,this._ui()),this.el.classList.add("ui-resizable-resizing"),this.triggerEvent("resizestart",r),this}_resizing(t,r){this.scrolled=this.scrollEl.scrollTop-this.scrollY,this.temporalRect=this._getChange(t,r),this._applyChange();const i=A.initEvent(t,{type:"resize",target:this.el});return this.option.resize&&this.option.resize(i,this._ui()),this.triggerEvent("resize",i),this}_resizeStop(t){const r=A.initEvent(t,{type:"resizestop",target:this.el});return this.option.stop&&this.option.stop(r),this.el.classList.remove("ui-resizable-resizing"),this.triggerEvent("resizestop",r),this._cleanHelper(),delete this.startEvent,delete this.originalRect,delete this.temporalRect,delete this.scrollY,delete this.scrolled,this}_setupHelper(){this.elOriginStyleVal=zo._originStyleProp.map(i=>this.el.style[i]),this.parentOriginStylePosition=this.el.parentElement.style.position;const t=this.el.parentElement,r=A.getValuesFromTransformedElement(t);return this.rectScale={x:r.xScale,y:r.yScale},getComputedStyle(this.el.parentElement).position.match(/static/)&&(this.el.parentElement.style.position="relative"),this.el.style.position="absolute",this.el.style.opacity="0.8",this}_cleanHelper(){return zo._originStyleProp.forEach((t,r)=>{this.el.style[t]=this.elOriginStyleVal[r]||null}),this.el.parentElement.style.position=this.parentOriginStylePosition||null,this}_getChange(t,r){const i=this.startEvent,o={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},u=t.clientX-i.clientX,f=this.sizeToContent?0:t.clientY-i.clientY;let d,p;r.indexOf("e")>-1?o.width+=u:r.indexOf("w")>-1&&(o.width-=u,o.left+=u,d=!0),r.indexOf("s")>-1?o.height+=f:r.indexOf("n")>-1&&(o.height-=f,o.top+=f,p=!0);const m=this._constrainSize(o.width,o.height,d,p);return Math.round(o.width)!==Math.round(m.width)&&(r.indexOf("w")>-1&&(o.left+=o.width-m.width),o.width=m.width),Math.round(o.height)!==Math.round(m.height)&&(r.indexOf("n")>-1&&(o.top+=o.height-m.height),o.height=m.height),o}_constrainSize(t,r,i,o){const u=this.option,f=(i?u.maxWidthMoveLeft:u.maxWidth)||Number.MAX_SAFE_INTEGER,d=u.minWidth/this.rectScale.x||t,p=(o?u.maxHeightMoveUp:u.maxHeight)||Number.MAX_SAFE_INTEGER,m=u.minHeight/this.rectScale.y||r,w=Math.min(f,Math.max(d,t)),v=Math.min(p,Math.max(m,r));return{width:w,height:v}}_applyChange(){let t={left:0,top:0,width:0,height:0};if(this.el.style.position==="absolute"){const r=this.el.parentElement,{left:i,top:o}=r.getBoundingClientRect();t={left:i,top:o,width:0,height:0}}return this.temporalRect?(Object.keys(this.temporalRect).forEach(r=>{const i=this.temporalRect[r],o=r==="width"||r==="left"?this.rectScale.x:r==="height"||r==="top"?this.rectScale.y:1;this.el.style[r]=(i-t[r])*o+"px"}),this):this}_removeHandlers(){return this.handlers.forEach(t=>t.destroy()),delete this.handlers,this}}zo._originStyleProp=["width","height","position","left","top","opacity","zIndex"];const yS='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class Mo extends ad{constructor(t,r={}){var u;super(),this.el=t,this.option=r,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0};const i=(u=r==null?void 0:r.handle)==null?void 0:u.substring(1),o=t.gridstackNode;this.dragEls=!i||t.classList.contains(i)?[t]:o!=null&&o.subGrid?[t.querySelector(r.handle)||t]:Array.from(t.querySelectorAll(r.handle)),this.dragEls.length===0&&(this.dragEls=[t]),this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this.enable()}on(t,r){super.on(t,r)}off(t){super.off(t)}enable(){this.disabled!==!1&&(super.enable(),this.dragEls.forEach(t=>{t.addEventListener("mousedown",this._mouseDown),Kr&&(t.addEventListener("touchstart",gu),t.addEventListener("pointerdown",yu))}),this.el.classList.remove("ui-draggable-disabled"))}disable(t=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(r=>{r.removeEventListener("mousedown",this._mouseDown),Kr&&(r.removeEventListener("touchstart",gu),r.removeEventListener("pointerdown",yu))}),t||this.el.classList.add("ui-draggable-disabled"))}destroy(){this.dragTimeout&&window.clearTimeout(this.dragTimeout),delete this.dragTimeout,this.mouseDownEvent&&this._mouseUp(this.mouseDownEvent),this.disable(!0),delete this.el,delete this.helper,delete this.option,super.destroy()}updateOption(t){return Object.keys(t).forEach(r=>this.option[r]=t[r]),this}_mouseDown(t){if(!Le.mouseHandled)return t.button!==0||!this.dragEls.find(r=>r===t.target)&&t.target.closest(yS)||this.option.cancel&&t.target.closest(this.option.cancel)||(this.mouseDownEvent=t,delete this.dragging,delete Le.dragElement,delete Le.dropElement,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),Kr&&(t.currentTarget.addEventListener("touchmove",mu),t.currentTarget.addEventListener("touchend",vu)),t.preventDefault(),document.activeElement&&document.activeElement.blur(),Le.mouseHandled=!0),!0}_callDrag(t){if(!this.dragging)return;const r=A.initEvent(t,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(r,this.ui()),this.triggerEvent("drag",r)}_mouseMove(t){var i;const r=this.mouseDownEvent;if(this.lastDrag=t,this.dragging)if(this._dragFollow(t),Le.pauseDrag){const o=Number.isInteger(Le.pauseDrag)?Le.pauseDrag:100;this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>this._callDrag(t),o)}else this._callDrag(t);else if(Math.abs(t.x-r.x)+Math.abs(t.y-r.y)>3){this.dragging=!0,Le.dragElement=this;const o=(i=this.el.gridstackNode)==null?void 0:i.grid;o?Le.dropElement=o.el.ddElement.ddDroppable:delete Le.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=A.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(t,this.el,this.helperContainment),this._setupHelperStyle(t);const u=A.initEvent(t,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(u,this.ui()),this.triggerEvent("dragstart",u),document.addEventListener("keydown",this._keyEvent)}return!0}_mouseUp(t){var r,i;if(document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),Kr&&t.currentTarget&&(t.currentTarget.removeEventListener("touchmove",mu,!0),t.currentTarget.removeEventListener("touchend",vu,!0)),this.dragging){delete this.dragging,(r=this.el.gridstackNode)==null||delete r._origRotate,document.removeEventListener("keydown",this._keyEvent),((i=Le.dropElement)==null?void 0:i.el)===this.el.parentElement&&delete Le.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();const o=A.initEvent(t,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(o),this.triggerEvent("dragstop",o),Le.dropElement&&Le.dropElement.drop(t)}delete this.helper,delete this.mouseDownEvent,delete Le.dragElement,delete Le.dropElement,delete Le.mouseHandled,t.preventDefault()}_keyEvent(t){var o,u;const r=this.el.gridstackNode,i=(r==null?void 0:r.grid)||((u=(o=Le.dropElement)==null?void 0:o.el)==null?void 0:u.gridstack);if(t.key==="Escape")r&&r._origRotate&&(r._orig=r._origRotate,delete r._origRotate),i==null||i.cancelDrag(),this._mouseUp(this.mouseDownEvent);else if(r&&i&&(t.key==="r"||t.key==="R")){if(!A.canBeRotated(r))return;r._origRotate=r._origRotate||{...r._orig},delete r._moving,i.setAnimation(!1).rotate(r.el,{top:-this.dragOffset.offsetTop,left:-this.dragOffset.offsetLeft}).setAnimation(),r._moving=!0,this.dragOffset=this._getDragOffset(this.lastDrag,r.el,this.helperContainment),this.helper.style.width=this.dragOffset.width+"px",this.helper.style.height=this.dragOffset.height+"px",A.swap(r._orig,"w","h"),delete r._rect,this._mouseMove(this.lastDrag)}}_createHelper(){let t=this.el;return typeof this.option.helper=="function"?t=this.option.helper(this.el):this.option.helper==="clone"&&(t=A.cloneNode(this.el)),t.parentElement||A.appendTo(t,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=Mo.originStyleProp.map(r=>this.el.style[r]),t}_setupHelperStyle(t){this.helper.classList.add("ui-draggable-dragging");const r=this.helper.style;return r.pointerEvents="none",r.width=this.dragOffset.width+"px",r.height=this.dragOffset.height+"px",r.willChange="left, top",r.position="fixed",this._dragFollow(t),r.transition="none",setTimeout(()=>{this.helper&&(r.transition=null)},0),this}_removeHelperStyle(){var r;this.helper.classList.remove("ui-draggable-dragging");const t=(r=this.helper)==null?void 0:r.gridstackNode;if(!(t!=null&&t._isAboutToRemove)&&this.dragElementOriginStyle){const i=this.helper,o=this.dragElementOriginStyle.transition||null;i.style.transition=this.dragElementOriginStyle.transition="none",Mo.originStyleProp.forEach(u=>i.style[u]=this.dragElementOriginStyle[u]||null),setTimeout(()=>i.style.transition=o,50)}return delete this.dragElementOriginStyle,this}_dragFollow(t){const r={left:0,top:0},i=this.helper.style,o=this.dragOffset;i.left=(t.clientX+o.offsetLeft-r.left)*this.dragTransform.xScale+"px",i.top=(t.clientY+o.offsetTop-r.top)*this.dragTransform.yScale+"px"}_setupHelperContainmentStyle(){return this.helperContainment=this.helper.parentElement,this.helper.style.position!=="fixed"&&(this.parentOriginStylePosition=this.helperContainment.style.position,getComputedStyle(this.helperContainment).position.match(/static/)&&(this.helperContainment.style.position="relative")),this}_getDragOffset(t,r,i){let o=0,u=0;i&&(o=this.dragTransform.xOffset,u=this.dragTransform.yOffset);const f=r.getBoundingClientRect();return{left:f.left,top:f.top,offsetLeft:-t.clientX+f.left-o,offsetTop:-t.clientY+f.top-u,width:f.width*this.dragTransform.xScale,height:f.height*this.dragTransform.yScale}}ui(){const r=this.el.parentElement.getBoundingClientRect(),i=this.helper.getBoundingClientRect();return{position:{top:(i.top-r.top)*this.dragTransform.yScale,left:(i.left-r.left)*this.dragTransform.xScale}}}}Mo.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","top","minWidth","willChange"];class wS extends ad{constructor(t,r={}){super(),this.el=t,this.option=r,this._mouseEnter=this._mouseEnter.bind(this),this._mouseLeave=this._mouseLeave.bind(this),this.enable(),this._setupAccept()}on(t,r){super.on(t,r)}off(t){super.off(t)}enable(){this.disabled!==!1&&(super.enable(),this.el.classList.add("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),this.el.addEventListener("mouseenter",this._mouseEnter),this.el.addEventListener("mouseleave",this._mouseLeave),Kr&&(this.el.addEventListener("pointerenter",Eg),this.el.addEventListener("pointerleave",Cg)))}disable(t=!1){this.disabled!==!0&&(super.disable(),this.el.classList.remove("ui-droppable"),t||this.el.classList.add("ui-droppable-disabled"),this.el.removeEventListener("mouseenter",this._mouseEnter),this.el.removeEventListener("mouseleave",this._mouseLeave),Kr&&(this.el.removeEventListener("pointerenter",Eg),this.el.removeEventListener("pointerleave",Cg)))}destroy(){this.disable(!0),this.el.classList.remove("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),super.destroy()}updateOption(t){return Object.keys(t).forEach(r=>this.option[r]=t[r]),this._setupAccept(),this}_mouseEnter(t){if(!Le.dragElement||!this._canDrop(Le.dragElement.el))return;t.preventDefault(),t.stopPropagation(),Le.dropElement&&Le.dropElement!==this&&Le.dropElement._mouseLeave(t,!0),Le.dropElement=this;const r=A.initEvent(t,{target:this.el,type:"dropover"});this.option.over&&this.option.over(r,this._ui(Le.dragElement)),this.triggerEvent("dropover",r),this.el.classList.add("ui-droppable-over")}_mouseLeave(t,r=!1){var o;if(!Le.dragElement||Le.dropElement!==this)return;t.preventDefault(),t.stopPropagation();const i=A.initEvent(t,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(i,this._ui(Le.dragElement)),this.triggerEvent("dropout",i),Le.dropElement===this&&(delete Le.dropElement,!r)){let u,f=this.el.parentElement;for(;!u&&f;)u=(o=f.ddElement)==null?void 0:o.ddDroppable,f=f.parentElement;u&&u._mouseEnter(t)}}drop(t){t.preventDefault();const r=A.initEvent(t,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(r,this._ui(Le.dragElement)),this.triggerEvent("drop",r)}_canDrop(t){return t&&(!this.accept||this.accept(t))}_setupAccept(){return this.option.accept?(typeof this.option.accept=="string"?this.accept=t=>t.classList.contains(this.option.accept)||t.matches(this.option.accept):this.accept=this.option.accept,this):this}_ui(t){return{draggable:t.el,...t.ui()}}}class ud{static init(t){return t.ddElement||(t.ddElement=new ud(t)),t.ddElement}constructor(t){this.el=t}on(t,r){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(t)>-1?this.ddDraggable.on(t,r):this.ddDroppable&&["drop","dropover","dropout"].indexOf(t)>-1?this.ddDroppable.on(t,r):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(t)>-1&&this.ddResizable.on(t,r),this}off(t){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(t)>-1?this.ddDraggable.off(t):this.ddDroppable&&["drop","dropover","dropout"].indexOf(t)>-1?this.ddDroppable.off(t):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(t)>-1&&this.ddResizable.off(t),this}setupDraggable(t){return this.ddDraggable?this.ddDraggable.updateOption(t):this.ddDraggable=new Mo(this.el,t),this}cleanDraggable(){return this.ddDraggable&&(this.ddDraggable.destroy(),delete this.ddDraggable),this}setupResizable(t){return this.ddResizable?this.ddResizable.updateOption(t):this.ddResizable=new zo(this.el,t),this}cleanResizable(){return this.ddResizable&&(this.ddResizable.destroy(),delete this.ddResizable),this}setupDroppable(t){return this.ddDroppable?this.ddDroppable.updateOption(t):this.ddDroppable=new wS(this.el,t),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class SS{resizable(t,r,i,o){return this._getDDElements(t,r).forEach(u=>{if(r==="disable"||r==="enable")u.ddResizable&&u.ddResizable[r]();else if(r==="destroy")u.ddResizable&&u.cleanResizable();else if(r==="option")u.setupResizable({[i]:o});else{const d=u.el.gridstackNode.grid;let p=u.el.getAttribute("gs-resize-handles")||d.opts.resizable.handles||"e,s,se";p==="all"&&(p="n,e,s,w,se,sw,ne,nw");const m=!d.opts.alwaysShowResizeHandle;u.setupResizable({...d.opts.resizable,handles:p,autoHide:m,start:r.start,stop:r.stop,resize:r.resize})}}),this}draggable(t,r,i,o){return this._getDDElements(t,r).forEach(u=>{if(r==="disable"||r==="enable")u.ddDraggable&&u.ddDraggable[r]();else if(r==="destroy")u.ddDraggable&&u.cleanDraggable();else if(r==="option")u.setupDraggable({[i]:o});else{const f=u.el.gridstackNode.grid;u.setupDraggable({...f.opts.draggable,start:r.start,stop:r.stop,drag:r.drag})}}),this}dragIn(t,r){return this._getDDElements(t).forEach(i=>i.setupDraggable(r)),this}droppable(t,r,i,o){return typeof r.accept=="function"&&!r._accept&&(r._accept=r.accept,r.accept=u=>r._accept(u)),this._getDDElements(t,r).forEach(u=>{r==="disable"||r==="enable"?u.ddDroppable&&u.ddDroppable[r]():r==="destroy"?u.ddDroppable&&u.cleanDroppable():r==="option"?u.setupDroppable({[i]:o}):u.setupDroppable(r)}),this}isDroppable(t){var r;return!!((r=t==null?void 0:t.ddElement)!=null&&r.ddDroppable&&!t.ddElement.ddDroppable.disabled)}isDraggable(t){var r;return!!((r=t==null?void 0:t.ddElement)!=null&&r.ddDraggable&&!t.ddElement.ddDraggable.disabled)}isResizable(t){var r;return!!((r=t==null?void 0:t.ddElement)!=null&&r.ddResizable&&!t.ddElement.ddResizable.disabled)}on(t,r,i){return this._getDDElements(t).forEach(o=>o.on(r,u=>{i(u,Le.dragElement?Le.dragElement.el:u.target,Le.dragElement?Le.dragElement.helper:null)})),this}off(t,r){return this._getDDElements(t).forEach(i=>i.off(r)),this}_getDDElements(t,r){const i=t.gridstack||r!=="destroy"&&r!=="disable",o=A.getElements(t);return o.length?o.map(f=>f.ddElement||(i?ud.init(f):null)).filter(f=>f):[]}}/*! + `},ry={onDragStart(l){let{active:t}=l;return"Picked up draggable item "+t.id+"."},onDragOver(l){let{active:t,over:r}=l;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(l){let{active:t,over:r}=l;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(l){let{active:t}=l;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function iy(l){let{announcements:t=ry,container:r,hiddenTextDescribedById:i,screenReaderInstructions:o=ny}=l;const{announce:u,announcement:c}=Zv(),d=xu("DndLiveRegion"),[p,m]=j.useState(!1);if(j.useEffect(()=>{m(!0)},[]),ey(j.useMemo(()=>({onDragStart(v){let{active:x}=v;u(t.onDragStart({active:x}))},onDragMove(v){let{active:x,over:z}=v;t.onDragMove&&u(t.onDragMove({active:x,over:z}))},onDragOver(v){let{active:x,over:z}=v;u(t.onDragOver({active:x,over:z}))},onDragEnd(v){let{active:x,over:z}=v;u(t.onDragEnd({active:x,over:z}))},onDragCancel(v){let{active:x,over:z}=v;u(t.onDragCancel({active:x,over:z}))}}),[u,t])),!p)return null;const w=ht.createElement(ht.Fragment,null,ht.createElement(qv,{id:i,value:o.draggable}),ht.createElement(Jv,{id:d,announcement:c}));return r?bs.createPortal(w,r):w}var en;(function(l){l.DragStart="dragStart",l.DragMove="dragMove",l.DragEnd="dragEnd",l.DragCancel="dragCancel",l.DragOver="dragOver",l.RegisterDroppable="registerDroppable",l.SetDroppableDisabled="setDroppableDisabled",l.UnregisterDroppable="unregisterDroppable"})(en||(en={}));function au(){}function sy(l,t){return j.useMemo(()=>({sensor:l,options:t??{}}),[l,t])}function ly(){for(var l=arguments.length,t=new Array(l),r=0;r[...t].filter(i=>i!=null),[...t])}const Qr=Object.freeze({x:0,y:0});function oy(l,t){const r=ou(l);if(!r)return"0 0";const i={x:(r.x-t.left)/t.width*100,y:(r.y-t.top)/t.height*100};return i.x+"% "+i.y+"%"}function ay(l,t){let{data:{value:r}}=l,{data:{value:i}}=t;return i-r}function uy(l,t){if(!l||l.length===0)return null;const[r]=l;return r[t]}function cy(l,t){const r=Math.max(t.top,l.top),i=Math.max(t.left,l.left),o=Math.min(t.left+t.width,l.left+l.width),u=Math.min(t.top+t.height,l.top+l.height),c=o-i,d=u-r;if(i{let{collisionRect:t,droppableRects:r,droppableContainers:i}=l;const o=[];for(const u of i){const{id:c}=u,d=r.get(c);if(d){const p=cy(d,t);p>0&&o.push({id:c,data:{droppableContainer:u,value:p}})}}return o.sort(ay)};function dy(l,t,r){return{...l,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function zg(l,t){return l&&t?{x:l.left-t.left,y:l.top-t.top}:Qr}function hy(l){return function(r){for(var i=arguments.length,o=new Array(i>1?i-1:0),u=1;u({...c,top:c.top+l*d.y,bottom:c.bottom+l*d.y,left:c.left+l*d.x,right:c.right+l*d.x}),{...r})}}const py=hy(1);function Mg(l){if(l.startsWith("matrix3d(")){const t=l.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(l.startsWith("matrix(")){const t=l.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function gy(l,t,r){const i=Mg(t);if(!i)return l;const{scaleX:o,scaleY:u,x:c,y:d}=i,p=l.left-c-(1-o)*parseFloat(r),m=l.top-d-(1-u)*parseFloat(r.slice(r.indexOf(" ")+1)),w=o?l.width/o:l.width,v=u?l.height/u:l.height;return{width:w,height:v,top:m,right:p+w,bottom:m+v,left:p}}const my={ignoreTransform:!1};function Lo(l,t){t===void 0&&(t=my);let r=l.getBoundingClientRect();if(t.ignoreTransform){const{transform:m,transformOrigin:w}=Yn(l).getComputedStyle(l);m&&(r=gy(r,m,w))}const{top:i,left:o,width:u,height:c,bottom:d,right:p}=r;return{top:i,left:o,width:u,height:c,bottom:d,right:p}}function hp(l){return Lo(l,{ignoreTransform:!0})}function vy(l){const t=l.innerWidth,r=l.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function yy(l,t){return t===void 0&&(t=Yn(l).getComputedStyle(l)),t.position==="fixed"}function wy(l,t){t===void 0&&(t=Yn(l).getComputedStyle(l));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const u=t[o];return typeof u=="string"?r.test(u):!1})}function Bf(l,t){const r=[];function i(o){if(t!=null&&r.length>=t||!o)return r;if(jf(o)&&o.scrollingElement!=null&&!r.includes(o.scrollingElement))return r.push(o.scrollingElement),r;if(!bo(o)||Ng(o)||r.includes(o))return r;const u=Yn(l).getComputedStyle(o);return o!==l&&wy(o,u)&&r.push(o),yy(o,u)?r:i(o.parentNode)}return l?i(l):r}function bg(l){const[t]=Bf(l,1);return t??null}function lf(l){return!wu||!l?null:Nl(l)?l:Ff(l)?jf(l)||l===Dl(l).scrollingElement?window:bo(l)?l:null:null}function Og(l){return Nl(l)?l.scrollX:l.scrollLeft}function Lg(l){return Nl(l)?l.scrollY:l.scrollTop}function Ef(l){return{x:Og(l),y:Lg(l)}}var pn;(function(l){l[l.Forward=1]="Forward",l[l.Backward=-1]="Backward"})(pn||(pn={}));function Pg(l){return!wu||!l?!1:l===document.scrollingElement}function Ag(l){const t={x:0,y:0},r=Pg(l)?{height:window.innerHeight,width:window.innerWidth}:{height:l.clientHeight,width:l.clientWidth},i={x:l.scrollWidth-r.width,y:l.scrollHeight-r.height},o=l.scrollTop<=t.y,u=l.scrollLeft<=t.x,c=l.scrollTop>=i.y,d=l.scrollLeft>=i.x;return{isTop:o,isLeft:u,isBottom:c,isRight:d,maxScroll:i,minScroll:t}}const Sy={x:.2,y:.2};function xy(l,t,r,i,o){let{top:u,left:c,right:d,bottom:p}=r;i===void 0&&(i=10),o===void 0&&(o=Sy);const{isTop:m,isBottom:w,isLeft:v,isRight:x}=Ag(l),z={x:0,y:0},R={x:0,y:0},k={height:t.height*o.y,width:t.width*o.x};return!m&&u<=t.top+k.height?(z.y=pn.Backward,R.y=i*Math.abs((t.top+k.height-u)/k.height)):!w&&p>=t.bottom-k.height&&(z.y=pn.Forward,R.y=i*Math.abs((t.bottom-k.height-p)/k.height)),!x&&d>=t.right-k.width?(z.x=pn.Forward,R.x=i*Math.abs((t.right-k.width-d)/k.width)):!v&&c<=t.left+k.width&&(z.x=pn.Backward,R.x=i*Math.abs((t.left+k.width-c)/k.width)),{direction:z,speed:R}}function _y(l){if(l===document.scrollingElement){const{innerWidth:u,innerHeight:c}=window;return{top:0,left:0,right:u,bottom:c,width:u,height:c}}const{top:t,left:r,right:i,bottom:o}=l.getBoundingClientRect();return{top:t,left:r,right:i,bottom:o,width:l.clientWidth,height:l.clientHeight}}function Ig(l){return l.reduce((t,r)=>wl(t,Ef(r)),Qr)}function Ey(l){return l.reduce((t,r)=>t+Og(r),0)}function Cy(l){return l.reduce((t,r)=>t+Lg(r),0)}function Hg(l,t){if(t===void 0&&(t=Lo),!l)return;const{top:r,left:i,bottom:o,right:u}=t(l);bg(l)&&(o<=0||u<=0||r>=window.innerHeight||i>=window.innerWidth)&&l.scrollIntoView({block:"center",inline:"center"})}const ky=[["x",["left","right"],Ey],["y",["top","bottom"],Cy]];class Uf{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const i=Bf(r),o=Ig(i);this.rect={...t},this.width=t.width,this.height=t.height;for(const[u,c,d]of ky)for(const p of c)Object.defineProperty(this,p,{get:()=>{const m=d(i),w=o[u]-m;return this.rect[p]+w},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class So{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var i;return(i=this.target)==null?void 0:i.removeEventListener(...r)})},this.target=t}add(t,r,i){var o;(o=this.target)==null||o.addEventListener(t,r,i),this.listeners.push([t,r,i])}}function Ry(l){const{EventTarget:t}=Yn(l);return l instanceof t?l:Dl(l)}function of(l,t){const r=Math.abs(l.x),i=Math.abs(l.y);return typeof t=="number"?Math.sqrt(r**2+i**2)>t:"x"in t&&"y"in t?r>t.x&&i>t.y:"x"in t?r>t.x:"y"in t?i>t.y:!1}var Pr;(function(l){l.Click="click",l.DragStart="dragstart",l.Keydown="keydown",l.ContextMenu="contextmenu",l.Resize="resize",l.SelectionChange="selectionchange",l.VisibilityChange="visibilitychange"})(Pr||(Pr={}));function pp(l){l.preventDefault()}function Ny(l){l.stopPropagation()}var ut;(function(l){l.Space="Space",l.Down="ArrowDown",l.Right="ArrowRight",l.Left="ArrowLeft",l.Up="ArrowUp",l.Esc="Escape",l.Enter="Enter",l.Tab="Tab"})(ut||(ut={}));const Fg={start:[ut.Space,ut.Enter],cancel:[ut.Esc],end:[ut.Space,ut.Enter,ut.Tab]},Dy=(l,t)=>{let{currentCoordinates:r}=t;switch(l.code){case ut.Right:return{...r,x:r.x+25};case ut.Left:return{...r,x:r.x-25};case ut.Down:return{...r,y:r.y+25};case ut.Up:return{...r,y:r.y-25}}};class jg{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:r}}=t;this.props=t,this.listeners=new So(Dl(r)),this.windowListeners=new So(Yn(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Pr.Resize,this.handleCancel),this.windowListeners.add(Pr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Pr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,i=t.node.current;i&&Hg(i),r(Qr)}handleKeyDown(t){if(Wf(t)){const{active:r,context:i,options:o}=this.props,{keyboardCodes:u=Fg,coordinateGetter:c=Dy,scrollBehavior:d="smooth"}=o,{code:p}=t;if(u.end.includes(p)){this.handleEnd(t);return}if(u.cancel.includes(p)){this.handleCancel(t);return}const{collisionRect:m}=i.current,w=m?{x:m.left,y:m.top}:Qr;this.referenceCoordinates||(this.referenceCoordinates=w);const v=c(t,{active:r,context:i.current,currentCoordinates:w});if(v){const x=lu(v,w),z={x:0,y:0},{scrollableAncestors:R}=i.current;for(const k of R){const b=t.code,{isTop:U,isRight:P,isLeft:W,isBottom:V,maxScroll:Z,minScroll:G}=Ag(k),ee=_y(k),re={x:Math.min(b===ut.Right?ee.right-ee.width/2:ee.right,Math.max(b===ut.Right?ee.left:ee.left+ee.width/2,v.x)),y:Math.min(b===ut.Down?ee.bottom-ee.height/2:ee.bottom,Math.max(b===ut.Down?ee.top:ee.top+ee.height/2,v.y))},ve=b===ut.Right&&!P||b===ut.Left&&!W,de=b===ut.Down&&!V||b===ut.Up&&!U;if(ve&&re.x!==v.x){const Y=k.scrollLeft+x.x,Ce=b===ut.Right&&Y<=Z.x||b===ut.Left&&Y>=G.x;if(Ce&&!x.y){k.scrollTo({left:Y,behavior:d});return}Ce?z.x=k.scrollLeft-Y:z.x=b===ut.Right?k.scrollLeft-Z.x:k.scrollLeft-G.x,z.x&&k.scrollBy({left:-z.x,behavior:d});break}else if(de&&re.y!==v.y){const Y=k.scrollTop+x.y,Ce=b===ut.Down&&Y<=Z.y||b===ut.Up&&Y>=G.y;if(Ce&&!x.x){k.scrollTo({top:Y,behavior:d});return}Ce?z.y=k.scrollTop-Y:z.y=b===ut.Down?k.scrollTop-Z.y:k.scrollTop-G.y,z.y&&k.scrollBy({top:-z.y,behavior:d});break}}this.handleMove(t,wl(lu(v,this.referenceCoordinates),z))}}}handleMove(t,r){const{onMove:i}=this.props;t.preventDefault(),i(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}jg.activators=[{eventName:"onKeyDown",handler:(l,t,r)=>{let{keyboardCodes:i=Fg,onActivation:o}=t,{active:u}=r;const{code:c}=l.nativeEvent;if(i.start.includes(c)){const d=u.activatorNode.current;return d&&l.target!==d?!1:(l.preventDefault(),o==null||o({event:l.nativeEvent}),!0)}return!1}}];function gp(l){return!!(l&&"distance"in l)}function mp(l){return!!(l&&"delay"in l)}class Vf{constructor(t,r,i){var o;i===void 0&&(i=Ry(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;const{event:u}=t,{target:c}=u;this.props=t,this.events=r,this.document=Dl(c),this.documentListeners=new So(this.document),this.listeners=new So(i),this.windowListeners=new So(Yn(c)),this.initialCoordinates=(o=ou(u))!=null?o:Qr,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:i}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Pr.Resize,this.handleCancel),this.windowListeners.add(Pr.DragStart,pp),this.windowListeners.add(Pr.VisibilityChange,this.handleCancel),this.windowListeners.add(Pr.ContextMenu,pp),this.documentListeners.add(Pr.Keydown,this.handleKeydown),r){if(i!=null&&i({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(mp(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(gp(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,r){const{active:i,onPending:o}=this.props;o(i,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(Pr.Click,Ny,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Pr.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:i,initialCoordinates:o,props:u}=this,{onMove:c,options:{activationConstraint:d}}=u;if(!o)return;const p=(r=ou(t))!=null?r:Qr,m=lu(o,p);if(!i&&d){if(gp(d)){if(d.tolerance!=null&&of(m,d.tolerance))return this.handleCancel();if(of(m,d.distance))return this.handleStart()}if(mp(d)&&of(m,d.tolerance))return this.handleCancel();this.handlePending(d,m);return}t.cancelable&&t.preventDefault(),c(p)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===ut.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Ty={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class $f extends Vf{constructor(t){const{event:r}=t,i=Dl(r.target);super(t,Ty,i)}}$f.activators=[{eventName:"onPointerDown",handler:(l,t)=>{let{nativeEvent:r}=l,{onActivation:i}=t;return!r.isPrimary||r.button!==0?!1:(i==null||i({event:r}),!0)}}];const zy={move:{name:"mousemove"},end:{name:"mouseup"}};var Cf;(function(l){l[l.RightClick=2]="RightClick"})(Cf||(Cf={}));class My extends Vf{constructor(t){super(t,zy,Dl(t.event.target))}}My.activators=[{eventName:"onMouseDown",handler:(l,t)=>{let{nativeEvent:r}=l,{onActivation:i}=t;return r.button===Cf.RightClick?!1:(i==null||i({event:r}),!0)}}];const af={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class by extends Vf{constructor(t){super(t,af)}static setup(){return window.addEventListener(af.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(af.move.name,t)};function t(){}}}by.activators=[{eventName:"onTouchStart",handler:(l,t)=>{let{nativeEvent:r}=l,{onActivation:i}=t;const{touches:o}=r;return o.length>1?!1:(i==null||i({event:r}),!0)}}];var xo;(function(l){l[l.Pointer=0]="Pointer",l[l.DraggableRect=1]="DraggableRect"})(xo||(xo={}));var uu;(function(l){l[l.TreeOrder=0]="TreeOrder",l[l.ReversedTreeOrder=1]="ReversedTreeOrder"})(uu||(uu={}));function Oy(l){let{acceleration:t,activator:r=xo.Pointer,canScroll:i,draggingRect:o,enabled:u,interval:c=5,order:d=uu.TreeOrder,pointerCoordinates:p,scrollableAncestors:m,scrollableAncestorRects:w,delta:v,threshold:x}=l;const z=Py({delta:v,disabled:!u}),[R,k]=Gv(),b=j.useRef({x:0,y:0}),U=j.useRef({x:0,y:0}),P=j.useMemo(()=>{switch(r){case xo.Pointer:return p?{top:p.y,bottom:p.y,left:p.x,right:p.x}:null;case xo.DraggableRect:return o}},[r,o,p]),W=j.useRef(null),V=j.useCallback(()=>{const G=W.current;if(!G)return;const ee=b.current.x*U.current.x,re=b.current.y*U.current.y;G.scrollBy(ee,re)},[]),Z=j.useMemo(()=>d===uu.TreeOrder?[...m].reverse():m,[d,m]);j.useEffect(()=>{if(!u||!m.length||!P){k();return}for(const G of Z){if((i==null?void 0:i(G))===!1)continue;const ee=m.indexOf(G),re=w[ee];if(!re)continue;const{direction:ve,speed:de}=xy(G,re,P,t,x);for(const Y of["x","y"])z[Y][ve[Y]]||(de[Y]=0,ve[Y]=0);if(de.x>0||de.y>0){k(),W.current=G,R(V,c),b.current=de,U.current=ve;return}}b.current={x:0,y:0},U.current={x:0,y:0},k()},[t,V,i,k,u,c,JSON.stringify(P),JSON.stringify(z),R,m,Z,w,JSON.stringify(x)])}const Ly={x:{[pn.Backward]:!1,[pn.Forward]:!1},y:{[pn.Backward]:!1,[pn.Forward]:!1}};function Py(l){let{delta:t,disabled:r}=l;const i=su(t);return Oo(o=>{if(r||!i||!o)return Ly;const u={x:Math.sign(t.x-i.x),y:Math.sign(t.y-i.y)};return{x:{[pn.Backward]:o.x[pn.Backward]||u.x===-1,[pn.Forward]:o.x[pn.Forward]||u.x===1},y:{[pn.Backward]:o.y[pn.Backward]||u.y===-1,[pn.Forward]:o.y[pn.Forward]||u.y===1}}},[r,t,i])}function Ay(l,t){const r=t!=null?l.get(t):void 0,i=r?r.node.current:null;return Oo(o=>{var u;return t==null?null:(u=i??o)!=null?u:null},[i,t])}function Iy(l,t){return j.useMemo(()=>l.reduce((r,i)=>{const{sensor:o}=i,u=o.activators.map(c=>({eventName:c.eventName,handler:t(c.handler,i)}));return[...r,...u]},[]),[l,t])}var Do;(function(l){l[l.Always=0]="Always",l[l.BeforeDragging=1]="BeforeDragging",l[l.WhileDragging=2]="WhileDragging"})(Do||(Do={}));var kf;(function(l){l.Optimized="optimized"})(kf||(kf={}));const vp=new Map;function Hy(l,t){let{dragging:r,dependencies:i,config:o}=t;const[u,c]=j.useState(null),{frequency:d,measure:p,strategy:m}=o,w=j.useRef(l),v=b(),x=Ro(v),z=j.useCallback(function(U){U===void 0&&(U=[]),!x.current&&c(P=>P===null?U:P.concat(U.filter(W=>!P.includes(W))))},[x]),R=j.useRef(null),k=Oo(U=>{if(v&&!r)return vp;if(!U||U===vp||w.current!==l||u!=null){const P=new Map;for(let W of l){if(!W)continue;if(u&&u.length>0&&!u.includes(W.id)&&W.rect.current){P.set(W.id,W.rect.current);continue}const V=W.node.current,Z=V?new Uf(p(V),V):null;W.rect.current=Z,Z&&P.set(W.id,Z)}return P}return U},[l,u,r,v,p]);return j.useEffect(()=>{w.current=l},[l]),j.useEffect(()=>{v||z()},[r,v]),j.useEffect(()=>{u&&u.length>0&&c(null)},[JSON.stringify(u)]),j.useEffect(()=>{v||typeof d!="number"||R.current!==null||(R.current=setTimeout(()=>{z(),R.current=null},d))},[d,v,z,...i]),{droppableRects:k,measureDroppableContainers:z,measuringScheduled:u!=null};function b(){switch(m){case Do.Always:return!1;case Do.BeforeDragging:return r;default:return!r}}}function Gf(l,t){return Oo(r=>l?r||(typeof t=="function"?t(l):l):null,[t,l])}function Fy(l,t){return Gf(l,t)}function jy(l){let{callback:t,disabled:r}=l;const i=Su(t),o=j.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:u}=window;return new u(i)},[i,r]);return j.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function _u(l){let{callback:t,disabled:r}=l;const i=Su(t),o=j.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:u}=window;return new u(i)},[r]);return j.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function Wy(l){return new Uf(Lo(l),l)}function yp(l,t,r){t===void 0&&(t=Wy);const[i,o]=j.useState(null);function u(){o(p=>{if(!l)return null;if(l.isConnected===!1){var m;return(m=p??r)!=null?m:null}const w=t(l);return JSON.stringify(p)===JSON.stringify(w)?p:w})}const c=jy({callback(p){if(l)for(const m of p){const{type:w,target:v}=m;if(w==="childList"&&v instanceof HTMLElement&&v.contains(l)){u();break}}}}),d=_u({callback:u});return ki(()=>{u(),l?(d==null||d.observe(l),c==null||c.observe(document.body,{childList:!0,subtree:!0})):(d==null||d.disconnect(),c==null||c.disconnect())},[l]),i}function By(l){const t=Gf(l);return zg(l,t)}const wp=[];function Uy(l){const t=j.useRef(l),r=Oo(i=>l?i&&i!==wp&&l&&t.current&&l.parentNode===t.current.parentNode?i:Bf(l):wp,[l]);return j.useEffect(()=>{t.current=l},[l]),r}function Vy(l){const[t,r]=j.useState(null),i=j.useRef(l),o=j.useCallback(u=>{const c=lf(u.target);c&&r(d=>d?(d.set(c,Ef(c)),new Map(d)):null)},[]);return j.useEffect(()=>{const u=i.current;if(l!==u){c(u);const d=l.map(p=>{const m=lf(p);return m?(m.addEventListener("scroll",o,{passive:!0}),[m,Ef(m)]):null}).filter(p=>p!=null);r(d.length?new Map(d):null),i.current=l}return()=>{c(l),c(u)};function c(d){d.forEach(p=>{const m=lf(p);m==null||m.removeEventListener("scroll",o)})}},[o,l]),j.useMemo(()=>l.length?t?Array.from(t.values()).reduce((u,c)=>wl(u,c),Qr):Ig(l):Qr,[l,t])}function Sp(l,t){t===void 0&&(t=[]);const r=j.useRef(null);return j.useEffect(()=>{r.current=null},t),j.useEffect(()=>{const i=l!==Qr;i&&!r.current&&(r.current=l),!i&&r.current&&(r.current=null)},[l]),r.current?lu(l,r.current):Qr}function $y(l){j.useEffect(()=>{if(!wu)return;const t=l.map(r=>{let{sensor:i}=r;return i.setup==null?void 0:i.setup()});return()=>{for(const r of t)r==null||r()}},l.map(t=>{let{sensor:r}=t;return r}))}function Gy(l,t){return j.useMemo(()=>l.reduce((r,i)=>{let{eventName:o,handler:u}=i;return r[o]=c=>{u(c,t)},r},{}),[l,t])}function Wg(l){return j.useMemo(()=>l?vy(l):null,[l])}const xp=[];function Yy(l,t){t===void 0&&(t=Lo);const[r]=l,i=Wg(r?Yn(r):null),[o,u]=j.useState(xp);function c(){u(()=>l.length?l.map(p=>Pg(p)?i:new Uf(t(p),p)):xp)}const d=_u({callback:c});return ki(()=>{d==null||d.disconnect(),c(),l.forEach(p=>d==null?void 0:d.observe(p))},[l]),o}function Bg(l){if(!l)return null;if(l.children.length>1)return l;const t=l.children[0];return bo(t)?t:l}function Ky(l){let{measure:t}=l;const[r,i]=j.useState(null),o=j.useCallback(m=>{for(const{target:w}of m)if(bo(w)){i(v=>{const x=t(w);return v?{...v,width:x.width,height:x.height}:x});break}},[t]),u=_u({callback:o}),c=j.useCallback(m=>{const w=Bg(m);u==null||u.disconnect(),w&&(u==null||u.observe(w)),i(w?t(w):null)},[t,u]),[d,p]=iu(c);return j.useMemo(()=>({nodeRef:d,rect:r,setRef:p}),[r,d,p])}const Qy=[{sensor:$f,options:{}},{sensor:jg,options:{}}],Xy={current:{}},qa={draggable:{measure:hp},droppable:{measure:hp,strategy:Do.WhileDragging,frequency:kf.Optimized},dragOverlay:{measure:Lo}};class _o extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,i;return(r=(i=this.get(t))==null?void 0:i.node.current)!=null?r:void 0}}const qy={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new _o,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:au},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:qa,measureDroppableContainers:au,windowRect:null,measuringScheduled:!1},Ug={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:au,draggableNodes:new Map,over:null,measureDroppableContainers:au},Po=j.createContext(Ug),Vg=j.createContext(qy);function Jy(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new _o}}}function Zy(l,t){switch(t.type){case en.DragStart:return{...l,draggable:{...l.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case en.DragMove:return l.draggable.active==null?l:{...l,draggable:{...l.draggable,translate:{x:t.coordinates.x-l.draggable.initialCoordinates.x,y:t.coordinates.y-l.draggable.initialCoordinates.y}}};case en.DragEnd:case en.DragCancel:return{...l,draggable:{...l.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case en.RegisterDroppable:{const{element:r}=t,{id:i}=r,o=new _o(l.droppable.containers);return o.set(i,r),{...l,droppable:{...l.droppable,containers:o}}}case en.SetDroppableDisabled:{const{id:r,key:i,disabled:o}=t,u=l.droppable.containers.get(r);if(!u||i!==u.key)return l;const c=new _o(l.droppable.containers);return c.set(r,{...u,disabled:o}),{...l,droppable:{...l.droppable,containers:c}}}case en.UnregisterDroppable:{const{id:r,key:i}=t,o=l.droppable.containers.get(r);if(!o||i!==o.key)return l;const u=new _o(l.droppable.containers);return u.delete(r),{...l,droppable:{...l.droppable,containers:u}}}default:return l}}function e0(l){let{disabled:t}=l;const{active:r,activatorEvent:i,draggableNodes:o}=j.useContext(Po),u=su(i),c=su(r==null?void 0:r.id);return j.useEffect(()=>{if(!t&&!i&&u&&c!=null){if(!Wf(u)||document.activeElement===u.target)return;const d=o.get(c);if(!d)return;const{activatorNode:p,node:m}=d;if(!p.current&&!m.current)return;requestAnimationFrame(()=>{for(const w of[p.current,m.current]){if(!w)continue;const v=Qv(w);if(v){v.focus();break}}})}},[i,t,o,c,u]),null}function $g(l,t){let{transform:r,...i}=t;return l!=null&&l.length?l.reduce((o,u)=>u({transform:o,...i}),r):r}function t0(l){return j.useMemo(()=>({draggable:{...qa.draggable,...l==null?void 0:l.draggable},droppable:{...qa.droppable,...l==null?void 0:l.droppable},dragOverlay:{...qa.dragOverlay,...l==null?void 0:l.dragOverlay}}),[l==null?void 0:l.draggable,l==null?void 0:l.droppable,l==null?void 0:l.dragOverlay])}function n0(l){let{activeNode:t,measure:r,initialRect:i,config:o=!0}=l;const u=j.useRef(!1),{x:c,y:d}=typeof o=="boolean"?{x:o,y:o}:o;ki(()=>{if(!c&&!d||!t){u.current=!1;return}if(u.current||!i)return;const m=t==null?void 0:t.node.current;if(!m||m.isConnected===!1)return;const w=r(m),v=zg(w,i);if(c||(v.x=0),d||(v.y=0),u.current=!0,Math.abs(v.x)>0||Math.abs(v.y)>0){const x=bg(m);x&&x.scrollBy({top:v.y,left:v.x})}},[t,c,d,i,r])}const Eu=j.createContext({...Qr,scaleX:1,scaleY:1});var ns;(function(l){l[l.Uninitialized=0]="Uninitialized",l[l.Initializing=1]="Initializing",l[l.Initialized=2]="Initialized"})(ns||(ns={}));const r0=j.memo(function(t){var r,i,o,u;let{id:c,accessibility:d,autoScroll:p=!0,children:m,sensors:w=Qy,collisionDetection:v=fy,measuring:x,modifiers:z,...R}=t;const k=j.useReducer(Zy,void 0,Jy),[b,U]=k,[P,W]=ty(),[V,Z]=j.useState(ns.Uninitialized),G=V===ns.Initialized,{draggable:{active:ee,nodes:re,translate:ve},droppable:{containers:de}}=b,Y=ee!=null?re.get(ee):null,Ce=j.useRef({initial:null,translated:null}),ae=j.useMemo(()=>{var lt;return ee!=null?{id:ee,data:(lt=Y==null?void 0:Y.data)!=null?lt:Xy,rect:Ce}:null},[ee,Y]),ye=j.useRef(null),[me,De]=j.useState(null),[le,ie]=j.useState(null),oe=Ro(R,Object.values(R)),X=xu("DndDescribedBy",c),D=j.useMemo(()=>de.getEnabled(),[de]),H=t0(x),{droppableRects:K,measureDroppableContainers:xe,measuringScheduled:be}=Hy(D,{dragging:G,dependencies:[ve.x,ve.y],config:H.droppable}),ge=Ay(re,ee),_e=j.useMemo(()=>le?ou(le):null,[le]),He=zt(),Fe=Fy(ge,H.draggable.measure);n0({activeNode:ee!=null?re.get(ee):null,config:He.layoutShiftCompensation,initialRect:Fe,measure:H.draggable.measure});const Oe=yp(ge,H.draggable.measure,Fe),$t=yp(ge?ge.parentElement:null),Pt=j.useRef({activatorEvent:null,active:null,activeNode:ge,collisionRect:null,collisions:null,droppableRects:K,draggableNodes:re,draggingNode:null,draggingNodeRect:null,droppableContainers:de,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),At=de.getNodeFor((r=Pt.current.over)==null?void 0:r.id),It=Ky({measure:H.dragOverlay.measure}),Kn=(i=It.nodeRef.current)!=null?i:ge,Cn=G?(o=It.rect)!=null?o:Oe:null,_r=!!(It.nodeRef.current&&It.rect),Xr=By(_r?null:Oe),Pn=Wg(Kn?Yn(Kn):null),Ze=Uy(G?At??ge:null),nn=Yy(Ze),rn=$g(z,{transform:{x:ve.x-Xr.x,y:ve.y-Xr.y,scaleX:1,scaleY:1},activatorEvent:le,active:ae,activeNodeRect:Oe,containerNodeRect:$t,draggingNodeRect:Cn,over:Pt.current.over,overlayNodeRect:It.rect,scrollableAncestors:Ze,scrollableAncestorRects:nn,windowRect:Pn}),sr=_e?wl(_e,ve):null,Pe=Vy(Ze),ce=Sp(Pe),qe=Sp(Pe,[Oe]),et=wl(rn,ce),sn=Cn?py(Cn,rn):null,kn=ae&&sn?v({active:ae,collisionRect:sn,droppableRects:K,droppableContainers:D,pointerCoordinates:sr}):null,Gt=uy(kn,"id"),[Rt,ln]=j.useState(null),mn=_r?rn:wl(rn,qe),Yt=dy(mn,(u=Rt==null?void 0:Rt.rect)!=null?u:null,Oe),vn=j.useRef(null),qr=j.useCallback((lt,Kt)=>{let{sensor:on,options:ar}=Kt;if(ye.current==null)return;const yn=re.get(ye.current);if(!yn)return;const an=lt.nativeEvent,Rn=new on({active:ye.current,activeNode:yn,event:an,options:ar,context:Pt,onAbort(We){if(!re.get(We))return;const{onDragAbort:_t}=oe.current,un={id:We};_t==null||_t(un),P({type:"onDragAbort",event:un})},onPending(We,xt,_t,un){if(!re.get(We))return;const{onDragPending:Sn}=oe.current,Ht={id:We,constraint:xt,initialCoordinates:_t,offset:un};Sn==null||Sn(Ht),P({type:"onDragPending",event:Ht})},onStart(We){const xt=ye.current;if(xt==null)return;const _t=re.get(xt);if(!_t)return;const{onDragStart:un}=oe.current,vt={activatorEvent:an,active:{id:xt,data:_t.data,rect:Ce}};bs.unstable_batchedUpdates(()=>{un==null||un(vt),Z(ns.Initializing),U({type:en.DragStart,initialCoordinates:We,active:xt}),P({type:"onDragStart",event:vt}),De(vn.current),ie(an)})},onMove(We){U({type:en.DragMove,coordinates:We})},onEnd:wn(en.DragEnd),onCancel:wn(en.DragCancel)});vn.current=Rn;function wn(We){return async function(){const{active:_t,collisions:un,over:vt,scrollAdjustedTranslate:Sn}=Pt.current;let Ht=null;if(_t&&Sn){const{cancelDrop:Er}=oe.current;Ht={activatorEvent:an,active:_t,collisions:un,delta:Sn,over:vt},We===en.DragEnd&&typeof Er=="function"&&await Promise.resolve(Er(Ht))&&(We=en.DragCancel)}ye.current=null,bs.unstable_batchedUpdates(()=>{U({type:We}),Z(ns.Uninitialized),ln(null),De(null),ie(null),vn.current=null;const Er=We===en.DragEnd?"onDragEnd":"onDragCancel";if(Ht){const Ri=oe.current[Er];Ri==null||Ri(Ht),P({type:Er,event:Ht})}})}}},[re]),Jr=j.useCallback((lt,Kt)=>(on,ar)=>{const yn=on.nativeEvent,an=re.get(ar);if(ye.current!==null||!an||yn.dndKit||yn.defaultPrevented)return;const Rn={active:an};lt(on,Kt.options,Rn)===!0&&(yn.dndKit={capturedBy:Kt.sensor},ye.current=ar,qr(on,Kt))},[re,qr]),lr=Iy(w,Jr);$y(w),ki(()=>{Oe&&V===ns.Initializing&&Z(ns.Initialized)},[Oe,V]),j.useEffect(()=>{const{onDragMove:lt}=oe.current,{active:Kt,activatorEvent:on,collisions:ar,over:yn}=Pt.current;if(!Kt||!on)return;const an={active:Kt,activatorEvent:on,collisions:ar,delta:{x:et.x,y:et.y},over:yn};bs.unstable_batchedUpdates(()=>{lt==null||lt(an),P({type:"onDragMove",event:an})})},[et.x,et.y]),j.useEffect(()=>{const{active:lt,activatorEvent:Kt,collisions:on,droppableContainers:ar,scrollAdjustedTranslate:yn}=Pt.current;if(!lt||ye.current==null||!Kt||!yn)return;const{onDragOver:an}=oe.current,Rn=ar.get(Gt),wn=Rn&&Rn.rect.current?{id:Rn.id,rect:Rn.rect.current,data:Rn.data,disabled:Rn.disabled}:null,We={active:lt,activatorEvent:Kt,collisions:on,delta:{x:yn.x,y:yn.y},over:wn};bs.unstable_batchedUpdates(()=>{ln(wn),an==null||an(We),P({type:"onDragOver",event:We})})},[Gt]),ki(()=>{Pt.current={activatorEvent:le,active:ae,activeNode:ge,collisionRect:sn,collisions:kn,droppableRects:K,draggableNodes:re,draggingNode:Kn,draggingNodeRect:Cn,droppableContainers:de,over:Rt,scrollableAncestors:Ze,scrollAdjustedTranslate:et},Ce.current={initial:Cn,translated:sn}},[ae,ge,kn,sn,re,Kn,Cn,K,de,Rt,Ze,et]),Oy({...He,delta:ve,draggingRect:sn,pointerCoordinates:sr,scrollableAncestors:Ze,scrollableAncestorRects:nn});const or=j.useMemo(()=>({active:ae,activeNode:ge,activeNodeRect:Oe,activatorEvent:le,collisions:kn,containerNodeRect:$t,dragOverlay:It,draggableNodes:re,droppableContainers:de,droppableRects:K,over:Rt,measureDroppableContainers:xe,scrollableAncestors:Ze,scrollableAncestorRects:nn,measuringConfiguration:H,measuringScheduled:be,windowRect:Pn}),[ae,ge,Oe,le,kn,$t,It,re,de,K,Rt,xe,Ze,nn,H,be,Pn]),Zr=j.useMemo(()=>({activatorEvent:le,activators:lr,active:ae,activeNodeRect:Oe,ariaDescribedById:{draggable:X},dispatch:U,draggableNodes:re,over:Rt,measureDroppableContainers:xe}),[le,lr,ae,Oe,U,X,re,Rt,xe]);return ht.createElement(Tg.Provider,{value:W},ht.createElement(Po.Provider,{value:Zr},ht.createElement(Vg.Provider,{value:or},ht.createElement(Eu.Provider,{value:Yt},m)),ht.createElement(e0,{disabled:(d==null?void 0:d.restoreFocus)===!1})),ht.createElement(iy,{...d,hiddenTextDescribedById:X}));function zt(){const lt=(me==null?void 0:me.autoScrollEnabled)===!1,Kt=typeof p=="object"?p.enabled===!1:p===!1,on=G&&!lt&&!Kt;return typeof p=="object"?{...p,enabled:on}:{enabled:on}}}),i0=j.createContext(null),_p="button",s0="Draggable";function l0(l){let{id:t,data:r,disabled:i=!1,attributes:o}=l;const u=xu(s0),{activators:c,activatorEvent:d,active:p,activeNodeRect:m,ariaDescribedById:w,draggableNodes:v,over:x}=j.useContext(Po),{role:z=_p,roleDescription:R="draggable",tabIndex:k=0}=o??{},b=(p==null?void 0:p.id)===t,U=j.useContext(b?Eu:i0),[P,W]=iu(),[V,Z]=iu(),G=Gy(c,t),ee=Ro(r);ki(()=>(v.set(t,{id:t,key:u,node:P,activatorNode:V,data:ee}),()=>{const ve=v.get(t);ve&&ve.key===u&&v.delete(t)}),[v,t]);const re=j.useMemo(()=>({role:z,tabIndex:k,"aria-disabled":i,"aria-pressed":b&&z===_p?!0:void 0,"aria-roledescription":R,"aria-describedby":w.draggable}),[i,z,k,b,R,w.draggable]);return{active:p,activatorEvent:d,activeNodeRect:m,attributes:re,isDragging:b,listeners:i?void 0:G,node:P,over:x,setNodeRef:W,setActivatorNodeRef:Z,transform:U}}function o0(){return j.useContext(Vg)}const a0="Droppable",u0={timeout:25};function c0(l){let{data:t,disabled:r=!1,id:i,resizeObserverConfig:o}=l;const u=xu(a0),{active:c,dispatch:d,over:p,measureDroppableContainers:m}=j.useContext(Po),w=j.useRef({disabled:r}),v=j.useRef(!1),x=j.useRef(null),z=j.useRef(null),{disabled:R,updateMeasurementsFor:k,timeout:b}={...u0,...o},U=Ro(k??i),P=j.useCallback(()=>{if(!v.current){v.current=!0;return}z.current!=null&&clearTimeout(z.current),z.current=setTimeout(()=>{m(Array.isArray(U.current)?U.current:[U.current]),z.current=null},b)},[b]),W=_u({callback:P,disabled:R||!c}),V=j.useCallback((re,ve)=>{W&&(ve&&(W.unobserve(ve),v.current=!1),re&&W.observe(re))},[W]),[Z,G]=iu(V),ee=Ro(t);return j.useEffect(()=>{!W||!Z.current||(W.disconnect(),v.current=!1,W.observe(Z.current))},[Z,W]),j.useEffect(()=>(d({type:en.RegisterDroppable,element:{id:i,key:u,disabled:r,node:Z,rect:x,data:ee}}),()=>d({type:en.UnregisterDroppable,key:u,id:i})),[i]),j.useEffect(()=>{r!==w.current.disabled&&(d({type:en.SetDroppableDisabled,id:i,key:u,disabled:r}),w.current.disabled=r)},[i,u,r,d]),{active:c,rect:x,isOver:(p==null?void 0:p.id)===i,node:Z,over:p,setNodeRef:G}}function f0(l){let{animation:t,children:r}=l;const[i,o]=j.useState(null),[u,c]=j.useState(null),d=su(r);return!r&&!i&&d&&o(d),ki(()=>{if(!u)return;const p=i==null?void 0:i.key,m=i==null?void 0:i.props.id;if(p==null||m==null){o(null);return}Promise.resolve(t(m,u)).then(()=>{o(null)})},[t,i,u]),ht.createElement(ht.Fragment,null,r,i?j.cloneElement(i,{ref:c}):null)}const d0={x:0,y:0,scaleX:1,scaleY:1};function h0(l){let{children:t}=l;return ht.createElement(Po.Provider,{value:Ug},ht.createElement(Eu.Provider,{value:d0},t))}const p0={position:"fixed",touchAction:"none"},g0=l=>Wf(l)?"transform 250ms ease":void 0,m0=j.forwardRef((l,t)=>{let{as:r,activatorEvent:i,adjustScale:o,children:u,className:c,rect:d,style:p,transform:m,transition:w=g0}=l;if(!d)return null;const v=o?m:{...m,scaleX:1,scaleY:1},x={...p0,width:d.width,height:d.height,top:d.top,left:d.left,transform:No.Transform.toString(v),transformOrigin:o&&i?oy(i,d):void 0,transition:typeof w=="function"?w(i):w,...p};return ht.createElement(r,{className:c,style:x,ref:t},u)}),v0=l=>t=>{let{active:r,dragOverlay:i}=t;const o={},{styles:u,className:c}=l;if(u!=null&&u.active)for(const[d,p]of Object.entries(u.active))p!==void 0&&(o[d]=r.node.style.getPropertyValue(d),r.node.style.setProperty(d,p));if(u!=null&&u.dragOverlay)for(const[d,p]of Object.entries(u.dragOverlay))p!==void 0&&i.node.style.setProperty(d,p);return c!=null&&c.active&&r.node.classList.add(c.active),c!=null&&c.dragOverlay&&i.node.classList.add(c.dragOverlay),function(){for(const[p,m]of Object.entries(o))r.node.style.setProperty(p,m);c!=null&&c.active&&r.node.classList.remove(c.active)}},y0=l=>{let{transform:{initial:t,final:r}}=l;return[{transform:No.Transform.toString(t)},{transform:No.Transform.toString(r)}]},w0={duration:250,easing:"ease",keyframes:y0,sideEffects:v0({styles:{active:{opacity:"0"}}})};function S0(l){let{config:t,draggableNodes:r,droppableContainers:i,measuringConfiguration:o}=l;return Su((u,c)=>{if(t===null)return;const d=r.get(u);if(!d)return;const p=d.node.current;if(!p)return;const m=Bg(c);if(!m)return;const{transform:w}=Yn(c).getComputedStyle(c),v=Mg(w);if(!v)return;const x=typeof t=="function"?t:x0(t);return Hg(p,o.draggable.measure),x({active:{id:u,data:d.data,node:p,rect:o.draggable.measure(p)},draggableNodes:r,dragOverlay:{node:c,rect:o.dragOverlay.measure(m)},droppableContainers:i,measuringConfiguration:o,transform:v})})}function x0(l){const{duration:t,easing:r,sideEffects:i,keyframes:o}={...w0,...l};return u=>{let{active:c,dragOverlay:d,transform:p,...m}=u;if(!t)return;const w={x:d.rect.left-c.rect.left,y:d.rect.top-c.rect.top},v={scaleX:p.scaleX!==1?c.rect.width*p.scaleX/d.rect.width:1,scaleY:p.scaleY!==1?c.rect.height*p.scaleY/d.rect.height:1},x={x:p.x-w.x,y:p.y-w.y,...v},z=o({...m,active:c,dragOverlay:d,transform:{initial:p,final:x}}),[R]=z,k=z[z.length-1];if(JSON.stringify(R)===JSON.stringify(k))return;const b=i==null?void 0:i({active:c,dragOverlay:d,...m}),U=d.node.animate(z,{duration:t,easing:r,fill:"forwards"});return new Promise(P=>{U.onfinish=()=>{b==null||b(),P()}})}}let Ep=0;function _0(l){return j.useMemo(()=>{if(l!=null)return Ep++,Ep},[l])}const E0=ht.memo(l=>{let{adjustScale:t=!1,children:r,dropAnimation:i,style:o,transition:u,modifiers:c,wrapperElement:d="div",className:p,zIndex:m=999}=l;const{activatorEvent:w,active:v,activeNodeRect:x,containerNodeRect:z,draggableNodes:R,droppableContainers:k,dragOverlay:b,over:U,measuringConfiguration:P,scrollableAncestors:W,scrollableAncestorRects:V,windowRect:Z}=o0(),G=j.useContext(Eu),ee=_0(v==null?void 0:v.id),re=$g(c,{activatorEvent:w,active:v,activeNodeRect:x,containerNodeRect:z,draggingNodeRect:b.rect,over:U,overlayNodeRect:b.rect,scrollableAncestors:W,scrollableAncestorRects:V,transform:G,windowRect:Z}),ve=Gf(x),de=S0({config:i,draggableNodes:R,droppableContainers:k,measuringConfiguration:P}),Y=ve?b.setRef:void 0;return ht.createElement(h0,null,ht.createElement(f0,{animation:de},v&&ee?ht.createElement(m0,{key:ee,id:v.id,ref:Y,as:d,activatorEvent:w,adjustScale:t,className:p,transition:u,rect:ve,style:{zIndex:m,...o},transform:re},r):null))}),Cp=l=>{let t;const r=new Set,i=(m,w)=>{const v=typeof m=="function"?m(t):m;if(!Object.is(v,t)){const x=t;t=w??(typeof v!="object"||v===null)?v:Object.assign({},t,v),r.forEach(z=>z(t,x))}},o=()=>t,d={setState:i,getState:o,getInitialState:()=>p,subscribe:m=>(r.add(m),()=>r.delete(m))},p=t=l(i,o,d);return d},C0=(l=>l?Cp(l):Cp),k0=l=>l;function R0(l,t=k0){const r=ht.useSyncExternalStore(l.subscribe,ht.useCallback(()=>t(l.getState()),[l,t]),ht.useCallback(()=>t(l.getInitialState()),[l,t]));return ht.useDebugValue(r),r}const kp=l=>{const t=C0(l),r=i=>R0(t,i);return Object.assign(r,t),r},Gg=(l=>l?kp(l):kp),Yg="damiao.monitor.plotConfigs";function N0(){try{return JSON.parse(localStorage.getItem(Yg)||"{}")}catch{return{}}}function D0(l){try{localStorage.setItem(Yg,JSON.stringify(l))}catch{}}const gn=Gg((l,t)=>({connected:!1,status:null,signals:[],pairs:[],motors:[],motorTypes:[],plotConfigs:N0(),setConnected:r=>l({connected:r}),setStatus:r=>l({status:r}),setMeta:(r,i)=>l({signals:r,pairs:i}),setMotors:r=>l({motors:r}),setMotorTypes:r=>l({motorTypes:r}),ensurePlot:r=>l(i=>i.plotConfigs[r]?i:{plotConfigs:{...i.plotConfigs,[r]:{signals:[],duration:10}}}),setPlotConfig:(r,i)=>l(o=>({plotConfigs:{...o.plotConfigs,[r]:{...o.plotConfigs[r]||{signals:[],duration:10},...i}}})),addSignalToPlot:(r,i)=>l(o=>{const u=o.plotConfigs[r]||{signals:[],duration:10};return u.signals.includes(i)?o:{plotConfigs:{...o.plotConfigs,[r]:{...u,signals:[...u.signals,i]}}}}),removeSignalFromPlot:(r,i)=>l(o=>{const u=o.plotConfigs[r];return u?{plotConfigs:{...o.plotConfigs,[r]:{...u,signals:u.signals.filter(c=>c!==i)}}}:o}),dropPlot:r=>l(i=>{const o={...i.plotConfigs};return delete o[r],{plotConfigs:o}})}));gn.subscribe(l=>D0(l.plotConfigs));const Yf="damiao.monitor.widgets.v2";function T0(){try{const l=localStorage.getItem(Yf);if(!l)return null;const t=JSON.parse(l);return Array.isArray(t)&&t.length?t:null}catch{return null}}function uf(l){try{localStorage.setItem(Yf,JSON.stringify(l))}catch{}}const Rp=[{id:"plot-1",kind:"plot",x:0,y:0,w:7,h:6},{id:"cards-1",kind:"cards",x:7,y:0,w:5,h:6},{id:"table-1",kind:"table",x:0,y:6,w:7,h:5},{id:"rawlog-1",kind:"rawlog",x:7,y:6,w:5,h:5}];let Np=1;const Eo=Gg((l,t)=>({widgets:T0()||Rp,addWidget:r=>{Np+=1;const i=`${r}-${Date.now().toString(36)}-${Np}`,o=t().widgets.reduce((d,p)=>Math.max(d,p.y+p.h),0),u={id:i,kind:r,x:0,y:o,w:6,h:5},c=[...t().widgets,u];return uf(c),l({widgets:c}),i},removeWidget:r=>{const i=t().widgets.filter(o=>o.id!==r);uf(i),l({widgets:i})},updateGeom:r=>{const i=new Map(r.map(u=>[u.id,u])),o=t().widgets.map(u=>{const c=i.get(u.id);return c?{...u,x:c.x,y:c.y,w:c.w,h:c.h}:u});uf(o),l({widgets:o})},resetWidgets:()=>{try{localStorage.removeItem(Yf),localStorage.removeItem("damiao.monitor.plotConfigs")}catch{}l({widgets:Rp.map(r=>({...r}))})}})),z0=!0,tn="u-",M0="uplot",b0=tn+"hz",O0=tn+"vt",L0=tn+"title",P0=tn+"wrap",A0=tn+"under",I0=tn+"over",H0=tn+"axis",Ms=tn+"off",F0=tn+"select",j0=tn+"cursor-x",W0=tn+"cursor-y",B0=tn+"cursor-pt",U0=tn+"legend",V0=tn+"live",$0=tn+"inline",G0=tn+"series",Y0=tn+"marker",Dp=tn+"label",K0=tn+"value",vo="width",yo="height",po="top",Tp="bottom",gl="left",cf="right",Kf="#000",zp=Kf+"0",ff="mousemove",Mp="mousedown",df="mouseup",bp="mouseenter",Op="mouseleave",Lp="dblclick",Q0="resize",X0="scroll",Pp="change",cu="dppxchange",Qf="--",Tl=typeof window<"u",Rf=Tl?document:null,Sl=Tl?window:null,q0=Tl?navigator:null;let Je,Ka;function Nf(){let l=devicePixelRatio;Je!=l&&(Je=l,Ka&&Tf(Pp,Ka,Nf),Ka=matchMedia(`(min-resolution: ${Je-.001}dppx) and (max-resolution: ${Je+.001}dppx)`),Os(Pp,Ka,Nf),Sl.dispatchEvent(new CustomEvent(cu)))}function wr(l,t){if(t!=null){let r=l.classList;!r.contains(t)&&r.add(t)}}function Df(l,t){let r=l.classList;r.contains(t)&&r.remove(t)}function mt(l,t,r){l.style[t]=r+"px"}function $r(l,t,r,i){let o=Rf.createElement(l);return t!=null&&wr(o,t),r!=null&&r.insertBefore(o,i),o}function Lr(l,t){return $r("div",l,t)}const Ap=new WeakMap;function oi(l,t,r,i,o){let u="translate("+t+"px,"+r+"px)",c=Ap.get(l);u!=c&&(l.style.transform=u,Ap.set(l,u),t<0||r<0||t>i||r>o?wr(l,Ms):Df(l,Ms))}const Ip=new WeakMap;function Hp(l,t,r){let i=t+r,o=Ip.get(l);i!=o&&(Ip.set(l,i),l.style.background=t,l.style.borderColor=r)}const Fp=new WeakMap;function jp(l,t,r,i){let o=t+""+r,u=Fp.get(l);o!=u&&(Fp.set(l,o),l.style.height=r+"px",l.style.width=t+"px",l.style.marginLeft=i?-t/2+"px":0,l.style.marginTop=i?-r/2+"px":0)}const Xf={passive:!0},J0={...Xf,capture:!0};function Os(l,t,r,i){t.addEventListener(l,r,i?J0:Xf)}function Tf(l,t,r,i){t.removeEventListener(l,r,Xf)}Tl&&Nf();function Gr(l,t,r,i){let o;r=r||0,i=i||t.length-1;let u=i<=2147483647;for(;i-r>1;)o=u?r+i>>1:Sr((r+i)/2),t[o]{let u=-1,c=-1;for(let d=i;d<=o;d++)if(l(r[d])){u=d;break}for(let d=o;d>=i;d--)if(l(r[d])){c=d;break}return[u,c]}}const Qg=l=>l!=null,Xg=l=>l!=null&&l>0,Cu=Kg(Qg),Z0=Kg(Xg);function ew(l,t,r,i=0,o=!1){let u=o?Z0:Cu,c=o?Xg:Qg;[t,r]=u(l,t,r);let d=l[t],p=l[t];if(t>-1)if(i==1)d=l[t],p=l[r];else if(i==-1)d=l[r],p=l[t];else for(let m=t;m<=r;m++){let w=l[m];c(w)&&(wp&&(p=w))}return[d??ct,p??-ct]}function ku(l,t,r,i){let o=Up(l),u=Up(t);l==t&&(o==-1?(l*=r,t/=r):(l/=r,t*=r));let c=r==10?Ei:qg,d=o==1?Sr:Ar,p=u==1?Ar:Sr,m=d(c(Zt(l))),w=p(c(Zt(t))),v=_l(r,m),x=_l(r,w);return r==10&&(m<0&&(v=ft(v,-m)),w<0&&(x=ft(x,-w))),i||r==2?(l=v*o,t=x*u):(l=tm(l,v),t=Ru(t,x)),[l,t]}function qf(l,t,r,i){let o=ku(l,t,r,i);return l==0&&(o[0]=0),t==0&&(o[1]=0),o}const Jf=.1,Wp={mode:3,pad:Jf},Co={pad:0,soft:null,mode:0},tw={min:Co,max:Co};function fu(l,t,r,i){return Nu(r)?Bp(l,t,r):(Co.pad=r,Co.soft=i?0:null,Co.mode=i?3:0,Bp(l,t,tw))}function Xe(l,t){return l??t}function nw(l,t,r){for(t=Xe(t,0),r=Xe(r,l.length-1);t<=r;){if(l[t]!=null)return!0;t++}return!1}function Bp(l,t,r){let i=r.min,o=r.max,u=Xe(i.pad,0),c=Xe(o.pad,0),d=Xe(i.hard,-ct),p=Xe(o.hard,ct),m=Xe(i.soft,ct),w=Xe(o.soft,-ct),v=Xe(i.mode,0),x=Xe(o.mode,0),z=t-l,R=Ei(z),k=Gn(Zt(l),Zt(t)),b=Ei(k),U=Zt(b-R);(z<1e-24||U>10)&&(z=0,(l==0||t==0)&&(z=1e-24,v==2&&m!=ct&&(u=0),x==2&&w!=-ct&&(c=0)));let P=z||k||1e3,W=Ei(P),V=_l(10,Sr(W)),Z=P*(z==0?l==0?.1:1:u),G=ft(tm(l-Z,V/10),24),ee=l>=m&&(v==1||v==3&&G<=m||v==2&&G>=m)?m:ct,re=Gn(d,G=ee?ee:Yr(ee,G)),ve=P*(z==0?t==0?.1:1:c),de=ft(Ru(t+ve,V/10),24),Y=t<=w&&(x==1||x==3&&de>=w||x==2&&de<=w)?w:-ct,Ce=Yr(p,de>Y&&t<=Y?Y:Gn(Y,de));return re==Ce&&re==0&&(Ce=100),[re,Ce]}const rw=new Intl.NumberFormat(Tl?q0.language:"en-US"),Zf=l=>rw.format(l),xr=Math,Ja=xr.PI,Zt=xr.abs,Sr=xr.floor,Jt=xr.round,Ar=xr.ceil,Yr=xr.min,Gn=xr.max,_l=xr.pow,Up=xr.sign,Ei=xr.log10,qg=xr.log2,iw=(l,t=1)=>xr.sinh(l)*t,hf=(l,t=1)=>xr.asinh(l/t),ct=1/0;function Vp(l){return(Ei((l^l>>31)-(l>>31))|0)+1}function zf(l,t,r){return Yr(Gn(l,t),r)}function Jg(l){return typeof l=="function"}function Ve(l){return Jg(l)?l:()=>l}const sw=()=>{},Zg=l=>l,em=(l,t)=>t,lw=l=>null,$p=l=>!0,Gp=(l,t)=>l==t,ow=/\.\d*?(?=9{6,}|0{6,})/gm,Ps=l=>{if(rm(l)||is.has(l))return l;const t=`${l}`,r=t.match(ow);if(r==null)return l;let i=r[0].length-1;if(t.indexOf("e-")!=-1){let[o,u]=t.split("e");return+`${Ps(o)}e${u}`}return ft(l,i)};function Ts(l,t){return Ps(ft(Ps(l/t))*t)}function Ru(l,t){return Ps(Ar(Ps(l/t))*t)}function tm(l,t){return Ps(Sr(Ps(l/t))*t)}function ft(l,t=0){if(rm(l))return l;let r=10**t,i=l*r*(1+Number.EPSILON);return Jt(i)/r}const is=new Map;function nm(l){return((""+l).split(".")[1]||"").length}function To(l,t,r,i){let o=[],u=i.map(nm);for(let c=t;c=0?0:d)+(c>=u[m]?0:u[m]),x=l==10?w:ft(w,v);o.push(x),is.set(x,v)}}return o}const ko={},ed=[],El=[null,null],rs=Array.isArray,rm=Number.isInteger,aw=l=>l===void 0;function Yp(l){return typeof l=="string"}function Nu(l){let t=!1;if(l!=null){let r=l.constructor;t=r==null||r==Object}return t}function uw(l){return l!=null&&typeof l=="object"}const cw=Object.getPrototypeOf(Uint8Array),im="__proto__";function Cl(l,t=Nu){let r;if(rs(l)){let i=l.find(o=>o!=null);if(rs(i)||t(i)){r=Array(l.length);for(let o=0;ou){for(o=c-1;o>=0&&l[o]==null;)l[o--]=null;for(o=c+1;oc-d)],o=i[0].length,u=new Map;for(let c=0;c"u"?l=>Promise.resolve().then(l):queueMicrotask;function vw(l){let t=l[0],r=t.length,i=Array(r);for(let u=0;ut[u]-t[c]);let o=[];for(let u=0;u=i&&l[o]==null;)o--;if(o<=i)return!0;const u=Gn(1,Sr((o-i+1)/t));for(let c=l[i],d=i+u;d<=o;d+=u){const p=l[d];if(p!=null){if(p<=c)return!1;c=p}}return!0}const sm=["January","February","March","April","May","June","July","August","September","October","November","December"],lm=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function om(l){return l.slice(0,3)}const Sw=lm.map(om),xw=sm.map(om),_w={MMMM:sm,MMM:xw,WWWW:lm,WWW:Sw};function go(l){return(l<10?"0":"")+l}function Ew(l){return(l<10?"00":l<100?"0":"")+l}const Cw={YYYY:l=>l.getFullYear(),YY:l=>(l.getFullYear()+"").slice(2),MMMM:(l,t)=>t.MMMM[l.getMonth()],MMM:(l,t)=>t.MMM[l.getMonth()],MM:l=>go(l.getMonth()+1),M:l=>l.getMonth()+1,DD:l=>go(l.getDate()),D:l=>l.getDate(),WWWW:(l,t)=>t.WWWW[l.getDay()],WWW:(l,t)=>t.WWW[l.getDay()],HH:l=>go(l.getHours()),H:l=>l.getHours(),h:l=>{let t=l.getHours();return t==0?12:t>12?t-12:t},AA:l=>l.getHours()>=12?"PM":"AM",aa:l=>l.getHours()>=12?"pm":"am",a:l=>l.getHours()>=12?"p":"a",mm:l=>go(l.getMinutes()),m:l=>l.getMinutes(),ss:l=>go(l.getSeconds()),s:l=>l.getSeconds(),fff:l=>Ew(l.getMilliseconds())};function td(l,t){t=t||_w;let r=[],i=/\{([a-z]+)\}|[^{]+/gi,o;for(;o=i.exec(l);)r.push(o[0][0]=="{"?Cw[o[1]]:o[0]);return u=>{let c="";for(let d=0;dl%1==0,du=[1,2,2.5,5],Nw=To(10,-32,0,du),um=To(10,0,32,du),Dw=um.filter(am),zs=Nw.concat(um),nd=` +`,cm="{YYYY}",Kp=nd+cm,fm="{M}/{D}",wo=nd+fm,Qa=wo+"/{YY}",dm="{aa}",Tw="{h}:{mm}",vl=Tw+dm,Qp=nd+vl,Xp=":{ss}",nt=null;function hm(l){let t=l*1e3,r=t*60,i=r*60,o=i*24,u=o*30,c=o*365,p=(l==1?To(10,0,3,du).filter(am):To(10,-3,0,du)).concat([t,t*5,t*10,t*15,t*30,r,r*5,r*10,r*15,r*30,i,i*2,i*3,i*4,i*6,i*8,i*12,o,o*2,o*3,o*4,o*5,o*6,o*7,o*8,o*9,o*10,o*15,u,u*2,u*3,u*4,u*6,c,c*2,c*5,c*10,c*25,c*50,c*100]);const m=[[c,cm,nt,nt,nt,nt,nt,nt,1],[o*28,"{MMM}",Kp,nt,nt,nt,nt,nt,1],[o,fm,Kp,nt,nt,nt,nt,nt,1],[i,"{h}"+dm,Qa,nt,wo,nt,nt,nt,1],[r,vl,Qa,nt,wo,nt,nt,nt,1],[t,Xp,Qa+" "+vl,nt,wo+" "+vl,nt,Qp,nt,1],[l,Xp+".{fff}",Qa+" "+vl,nt,wo+" "+vl,nt,Qp,nt,1]];function w(v){return(x,z,R,k,b,U)=>{let P=[],W=b>=c,V=b>=u&&b=o?o:b,de=Sr(R)-Sr(G),Y=re+de+Ru(G-re,ve);P.push(Y);let Ce=v(Y),ae=Ce.getHours()+Ce.getMinutes()/r+Ce.getSeconds()/i,ye=b/i,me=x.axes[z]._space,De=U/me;for(;Y=ft(Y+b,l==1?0:3),!(Y>k);)if(ye>1){let le=Sr(ft(ae+ye,6))%24,X=v(Y).getHours()-le;X>1&&(X=-1),Y-=X*i,ae=(ae+ye)%24;let D=P[P.length-1];ft((Y-D)/b,3)*De>=.7&&P.push(Y)}else P.push(Y)}return P}}return[p,m,w]}const[zw,Mw,bw]=hm(1),[Ow,Lw,Pw]=hm(.001);To(2,-53,53,[1]);function qp(l,t){return l.map(r=>r.map((i,o)=>o==0||o==8||i==null?i:t(o==1||r[8]==0?i:r[1]+i)))}function Jp(l,t){return(r,i,o,u,c)=>{let d=t.find(R=>c>=R[0])||t[t.length-1],p,m,w,v,x,z;return i.map(R=>{let k=l(R),b=k.getFullYear(),U=k.getMonth(),P=k.getDate(),W=k.getHours(),V=k.getMinutes(),Z=k.getSeconds(),G=b!=p&&d[2]||U!=m&&d[3]||P!=w&&d[4]||W!=v&&d[5]||V!=x&&d[6]||Z!=z&&d[7]||d[1];return p=b,m=U,w=P,v=W,x=V,z=Z,G(k)})}}function Aw(l,t){let r=td(t);return(i,o,u,c,d)=>o.map(p=>r(l(p)))}function pf(l,t,r){return new Date(l,t,r)}function Zp(l,t){return t(l)}const Iw="{YYYY}-{MM}-{DD} {h}:{mm}{aa}";function eg(l,t){return(r,i,o,u)=>u==null?Qf:t(l(i))}function Hw(l,t){let r=l.series[t];return r.width?r.stroke(l,t):r.points.width?r.points.stroke(l,t):null}function Fw(l,t){return l.series[t].fill(l,t)}const jw={show:!0,live:!0,isolate:!1,mount:sw,markers:{show:!0,width:2,stroke:Hw,fill:Fw,dash:"solid"},idx:null,idxs:null,values:[]};function Ww(l,t){let r=l.cursor.points,i=Lr(),o=r.size(l,t);mt(i,vo,o),mt(i,yo,o);let u=o/-2;mt(i,"marginLeft",u),mt(i,"marginTop",u);let c=r.width(l,t,o);return c&&mt(i,"borderWidth",c),i}function Bw(l,t){let r=l.series[t].points;return r._fill||r._stroke}function Uw(l,t){let r=l.series[t].points;return r._stroke||r._fill}function Vw(l,t){return l.series[t].points.size}const gf=[0,0];function $w(l,t,r){return gf[0]=t,gf[1]=r,gf}function Xa(l,t,r,i=!0){return o=>{o.button==0&&(!i||o.target==t)&&r(o)}}function mf(l,t,r,i=!0){return o=>{(!i||o.target==t)&&r(o)}}const Gw={show:!0,x:!0,y:!0,lock:!1,move:$w,points:{one:!1,show:Ww,size:Vw,width:0,stroke:Uw,fill:Bw},bind:{mousedown:Xa,mouseup:Xa,click:Xa,dblclick:Xa,mousemove:mf,mouseleave:mf,mouseenter:mf},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,click:(l,t)=>{t.stopPropagation(),t.stopImmediatePropagation()},_x:!1,_y:!1},focus:{dist:(l,t,r,i,o)=>i-o,prox:-1,bias:0},hover:{skip:[void 0],prox:null,bias:0},left:-10,top:-10,idx:null,dataIdx:null,idxs:null,event:null},pm={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},rd=Vt({},pm,{filter:em}),gm=Vt({},rd,{size:10}),mm=Vt({},pm,{show:!1}),id='12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',vm="bold "+id,ym=1.5,tg={show:!0,scale:"x",stroke:Kf,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:vm,side:2,grid:rd,ticks:gm,border:mm,font:id,lineGap:ym,rotate:0},Yw="Value",Kw="Time",ng={show:!0,scale:"x",auto:!1,sorted:1,min:ct,max:-ct,idxs:[]};function Qw(l,t,r,i,o){return t.map(u=>u==null?"":Zf(u))}function Xw(l,t,r,i,o,u,c){let d=[],p=is.get(o)||0;r=c?r:ft(Ru(r,o),p);for(let m=r;m<=i;m=ft(m+o,p))d.push(Object.is(m,-0)?0:m);return d}function Mf(l,t,r,i,o,u,c){const d=[],p=l.scales[l.axes[t].scale].log,m=p==10?Ei:qg,w=Sr(m(r));o=_l(p,w),p==10&&(o=zs[Gr(o,zs)]);let v=r,x=o*p;p==10&&(x=zs[Gr(x,zs)]);do d.push(v),v=v+o,p==10&&!is.has(v)&&(v=ft(v,is.get(o))),v>=x&&(o=v,x=o*p,p==10&&(x=zs[Gr(x,zs)]));while(v<=i);return d}function qw(l,t,r,i,o,u,c){let p=l.scales[l.axes[t].scale].asinh,m=i>p?Mf(l,t,Gn(p,r),i,o):[p],w=i>=0&&r<=0?[0]:[];return(r<-p?Mf(l,t,Gn(p,-i),-r,o):[p]).reverse().map(x=>-x).concat(w,m)}const wm=/./,Jw=/[12357]/,Zw=/[125]/,rg=/1/,bf=(l,t,r,i)=>l.map((o,u)=>t==4&&o==0||u%i==0&&r.test(o.toExponential()[o<0?1:0])?o:null);function e1(l,t,r,i,o){let u=l.axes[r],c=u.scale,d=l.scales[c],p=l.valToPos,m=u._space,w=p(10,c),v=p(9,c)-w>=m?wm:p(7,c)-w>=m?Jw:p(5,c)-w>=m?Zw:rg;if(v==rg){let x=Zt(p(1,c)-w);if(xo,lg={show:!0,auto:!0,sorted:0,gaps:Sm,alpha:1,facets:[Vt({},sg,{scale:"x"}),Vt({},sg,{scale:"y"})]},og={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:Sm,alpha:1,points:{show:i1,filter:null},values:null,min:ct,max:-ct,idxs:[],path:null,clip:null};function s1(l,t,r,i,o){return r/10}const xm={time:z0,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},l1=Vt({},xm,{time:!1,ori:1}),ag={};function _m(l,t){let r=ag[l];return r||(r={key:l,plots:[],sub(i){r.plots.push(i)},unsub(i){r.plots=r.plots.filter(o=>o!=i)},pub(i,o,u,c,d,p,m){for(let w=0;w{let U=c.pxRound;const P=m.dir*(m.ori==0?1:-1),W=m.ori==0?zl:Ml;let V,Z;P==1?(V=r,Z=i):(V=i,Z=r);let G=U(v(d[V],m,k,z)),ee=U(x(p[V],w,b,R)),re=U(v(d[Z],m,k,z)),ve=U(x(u==1?w.max:w.min,w,b,R)),de=new Path2D(o);return W(de,re,ve),W(de,G,ve),W(de,G,ee),de})}function Du(l,t,r,i,o,u){let c=null;if(l.length>0){c=new Path2D;const d=t==0?Mu:od;let p=r;for(let v=0;vx[0]){let z=x[0]-p;z>0&&d(c,p,i,z,i+u),p=x[1]}}let m=r+o-p,w=10;m>0&&d(c,p,i-w/2,m,i+u+w)}return c}function a1(l,t,r){let i=l[l.length-1];i&&i[0]==t?i[1]=r:l.push([t,r])}function ld(l,t,r,i,o,u,c){let d=[],p=l.length;for(let m=o==1?r:i;m>=r&&m<=i;m+=o)if(t[m]===null){let v=m,x=m;if(o==1)for(;++m<=i&&t[m]===null;)x=m;else for(;--m>=r&&t[m]===null;)x=m;let z=u(l[v]),R=x==v?z:u(l[x]),k=v-o;z=c<=0&&k>=0&&k=0&&U>=0&&U=z&&d.push([z,R])}return d}function ug(l){return l==0?Zg:l==1?Jt:t=>Ts(t,l)}function Em(l){let t=l==0?Tu:zu,r=l==0?(o,u,c,d,p,m)=>{o.arcTo(u,c,d,p,m)}:(o,u,c,d,p,m)=>{o.arcTo(c,u,p,d,m)},i=l==0?(o,u,c,d,p)=>{o.rect(u,c,d,p)}:(o,u,c,d,p)=>{o.rect(c,u,p,d)};return(o,u,c,d,p,m=0,w=0)=>{m==0&&w==0?i(o,u,c,d,p):(m=Yr(m,d/2,p/2),w=Yr(w,d/2,p/2),t(o,u+m,c),r(o,u+d,c,u+d,c+p,m),r(o,u+d,c+p,u,c+p,w),r(o,u,c+p,u,c,w),r(o,u,c,u+d,c,m),o.closePath())}}const Tu=(l,t,r)=>{l.moveTo(t,r)},zu=(l,t,r)=>{l.moveTo(r,t)},zl=(l,t,r)=>{l.lineTo(t,r)},Ml=(l,t,r)=>{l.lineTo(r,t)},Mu=Em(0),od=Em(1),Cm=(l,t,r,i,o,u)=>{l.arc(t,r,i,o,u)},km=(l,t,r,i,o,u)=>{l.arc(r,t,i,o,u)},Rm=(l,t,r,i,o,u,c)=>{l.bezierCurveTo(t,r,i,o,u,c)},Nm=(l,t,r,i,o,u,c)=>{l.bezierCurveTo(r,t,o,i,c,u)};function Dm(l){return(t,r,i,o,u)=>As(t,r,(c,d,p,m,w,v,x,z,R,k,b)=>{let{pxRound:U,points:P}=c,W,V;m.ori==0?(W=Tu,V=Cm):(W=zu,V=km);const Z=ft(P.width*Je,3);let G=(P.size-P.width)/2*Je,ee=ft(G*2,3),re=new Path2D,ve=new Path2D,{left:de,top:Y,width:Ce,height:ae}=t.bbox;Mu(ve,de-ee,Y-ee,Ce+ee*2,ae+ee*2);const ye=me=>{if(p[me]!=null){let De=U(v(d[me],m,k,z)),le=U(x(p[me],w,b,R));W(re,De+G,le),V(re,De,le,G,0,Ja*2)}};if(u)u.forEach(ye);else for(let me=i;me<=o;me++)ye(me);return{stroke:Z>0?re:null,fill:re,clip:ve,flags:kl|Of}})}function Tm(l){return(t,r,i,o,u,c)=>{i!=o&&(u!=i&&c!=i&&l(t,r,i),u!=o&&c!=o&&l(t,r,o),l(t,r,c))}}const u1=Tm(zl),c1=Tm(Ml);function zm(l){const t=Xe(l==null?void 0:l.alignGaps,0);return(r,i,o,u)=>As(r,i,(c,d,p,m,w,v,x,z,R,k,b)=>{[o,u]=Cu(p,o,u);let U=c.pxRound,P=ae=>U(v(ae,m,k,z)),W=ae=>U(x(ae,w,b,R)),V,Z;m.ori==0?(V=zl,Z=u1):(V=Ml,Z=c1);const G=m.dir*(m.ori==0?1:-1),ee={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:kl},re=ee.stroke;let ve=!1;if(u-o>=k*4){let ae=K=>r.posToVal(K,m.key,!0),ye=null,me=null,De,le,ie,oe=P(d[G==1?o:u]),X=P(d[o]),D=P(d[u]),H=ae(G==1?X+1:D-1);for(let K=G==1?o:u;K>=o&&K<=u;K+=G){let xe=d[K],ge=(G==1?xeH)?oe:P(xe),_e=p[K];ge==oe?_e!=null?(le=_e,ye==null?(V(re,ge,W(le)),De=ye=me=le):leme&&(me=le)):_e===null&&(ve=!0):(ye!=null&&Z(re,oe,W(ye),W(me),W(De),W(le)),_e!=null?(le=_e,V(re,ge,W(le)),ye=me=De=le):(ye=me=null,_e===null&&(ve=!0)),oe=ge,H=ae(oe+G))}ye!=null&&ye!=me&&ie!=oe&&Z(re,oe,W(ye),W(me),W(De),W(le))}else for(let ae=G==1?o:u;ae>=o&&ae<=u;ae+=G){let ye=p[ae];ye===null?ve=!0:ye!=null&&V(re,P(d[ae]),W(ye))}let[Y,Ce]=sd(r,i);if(c.fill!=null||Y!=0){let ae=ee.fill=new Path2D(re),ye=c.fillTo(r,i,c.min,c.max,Y),me=W(ye),De=P(d[o]),le=P(d[u]);G==-1&&([le,De]=[De,le]),V(ae,le,me),V(ae,De,me)}if(!c.spanGaps){let ae=[];ve&&ae.push(...ld(d,p,o,u,G,P,t)),ee.gaps=ae=c.gaps(r,i,o,u,ae),ee.clip=Du(ae,m.ori,z,R,k,b)}return Ce!=0&&(ee.band=Ce==2?[Ci(r,i,o,u,re,-1),Ci(r,i,o,u,re,1)]:Ci(r,i,o,u,re,Ce)),ee})}function f1(l){const t=Xe(l.align,1),r=Xe(l.ascDesc,!1),i=Xe(l.alignGaps,0),o=Xe(l.extend,!1);return(u,c,d,p)=>As(u,c,(m,w,v,x,z,R,k,b,U,P,W)=>{[d,p]=Cu(v,d,p);let V=m.pxRound,{left:Z,width:G}=u.bbox,ee=X=>V(R(X,x,P,b)),re=X=>V(k(X,z,W,U)),ve=x.ori==0?zl:Ml;const de={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:kl},Y=de.stroke,Ce=x.dir*(x.ori==0?1:-1);let ae=re(v[Ce==1?d:p]),ye=ee(w[Ce==1?d:p]),me=ye,De=ye;o&&t==-1&&(De=Z,ve(Y,De,ae)),ve(Y,ye,ae);for(let X=Ce==1?d:p;X>=d&&X<=p;X+=Ce){let D=v[X];if(D==null)continue;let H=ee(w[X]),K=re(D);t==1?ve(Y,H,ae):ve(Y,me,K),ve(Y,H,K),ae=K,me=H}let le=me;o&&t==1&&(le=Z+G,ve(Y,le,ae));let[ie,oe]=sd(u,c);if(m.fill!=null||ie!=0){let X=de.fill=new Path2D(Y),D=m.fillTo(u,c,m.min,m.max,ie),H=re(D);ve(X,le,H),ve(X,De,H)}if(!m.spanGaps){let X=[];X.push(...ld(w,v,d,p,Ce,ee,i));let D=m.width*Je/2,H=r||t==1?D:-D,K=r||t==-1?-D:D;X.forEach(xe=>{xe[0]+=H,xe[1]+=K}),de.gaps=X=m.gaps(u,c,d,p,X),de.clip=Du(X,x.ori,b,U,P,W)}return oe!=0&&(de.band=oe==2?[Ci(u,c,d,p,Y,-1),Ci(u,c,d,p,Y,1)]:Ci(u,c,d,p,Y,oe)),de})}function cg(l,t,r,i,o,u,c=ct){if(l.length>1){let d=null;for(let p=0,m=1/0;p{}),{fill:v,stroke:x}=m;return(z,R,k,b)=>As(z,R,(U,P,W,V,Z,G,ee,re,ve,de,Y)=>{let Ce=U.pxRound,ae=r,ye=i*Je,me=d*Je,De=p*Je,le,ie;V.ori==0?[le,ie]=u(z,R):[ie,le]=u(z,R);const oe=V.dir*(V.ori==0?1:-1);let X=V.ori==0?Mu:od,D=V.ori==0?w:(ce,qe,et,sn,kn,Gt,Rt)=>{w(ce,qe,et,kn,sn,Rt,Gt)},H=Xe(z.bands,ed).find(ce=>ce.series[0]==R),K=H!=null?H.dir:0,xe=U.fillTo(z,R,U.min,U.max,K),be=Ce(ee(xe,Z,Y,ve)),ge,_e,He,Fe=de,Oe=Ce(U.width*Je),$t=!1,Pt=null,At=null,It=null,Kn=null;v!=null&&(Oe==0||x!=null)&&($t=!0,Pt=v.values(z,R,k,b),At=new Map,new Set(Pt).forEach(ce=>{ce!=null&&At.set(ce,new Path2D)}),Oe>0&&(It=x.values(z,R,k,b),Kn=new Map,new Set(It).forEach(ce=>{ce!=null&&Kn.set(ce,new Path2D)})));let{x0:Cn,size:_r}=m;if(Cn!=null&&_r!=null){ae=1,P=Cn.values(z,R,k,b),Cn.unit==2&&(P=P.map(et=>z.posToVal(re+et*de,V.key,!0)));let ce=_r.values(z,R,k,b);_r.unit==2?_e=ce[0]*de:_e=G(ce[0],V,de,re)-G(0,V,de,re),Fe=cg(P,W,G,V,de,re,Fe),He=Fe-_e+ye}else Fe=cg(P,W,G,V,de,re,Fe),He=Fe*c+ye,_e=Fe-He;He<1&&(He=0),Oe>=_e/2&&(Oe=0),He<5&&(Ce=Zg);let Xr=He>0,Pn=Fe-He-(Xr?Oe:0);_e=Ce(zf(Pn,De,me)),ge=(ae==0?_e/2:ae==oe?0:_e)-ae*oe*((ae==0?ye/2:0)+(Xr?Oe/2:0));const Ze={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},nn=$t?null:new Path2D;let rn=null;if(H!=null)rn=z.data[H.series[1]];else{let{y0:ce,y1:qe}=m;ce!=null&&qe!=null&&(W=qe.values(z,R,k,b),rn=ce.values(z,R,k,b))}let sr=le*_e,Pe=ie*_e;for(let ce=oe==1?k:b;ce>=k&&ce<=b;ce+=oe){let qe=W[ce];if(qe==null)continue;if(rn!=null){let Yt=rn[ce]??0;if(qe-Yt==0)continue;be=ee(Yt,Z,Y,ve)}let et=V.distr!=2||m!=null?P[ce]:ce,sn=G(et,V,de,re),kn=ee(Xe(qe,xe),Z,Y,ve),Gt=Ce(sn-ge),Rt=Ce(Gn(kn,be)),ln=Ce(Yr(kn,be)),mn=Rt-ln;if(qe!=null){let Yt=qe<0?Pe:sr,vn=qe<0?sr:Pe;$t?(Oe>0&&It[ce]!=null&&X(Kn.get(It[ce]),Gt,ln+Sr(Oe/2),_e,Gn(0,mn-Oe),Yt,vn),Pt[ce]!=null&&X(At.get(Pt[ce]),Gt,ln+Sr(Oe/2),_e,Gn(0,mn-Oe),Yt,vn)):X(nn,Gt,ln+Sr(Oe/2),_e,Gn(0,mn-Oe),Yt,vn),D(z,R,ce,Gt-Oe/2,ln,_e+Oe,mn)}}return Oe>0?Ze.stroke=$t?Kn:nn:$t||(Ze._fill=U.width==0?U._fill:U._stroke??U._fill,Ze.width=0),Ze.fill=$t?At:nn,Ze})}function h1(l,t){const r=Xe(t==null?void 0:t.alignGaps,0);return(i,o,u,c)=>As(i,o,(d,p,m,w,v,x,z,R,k,b,U)=>{[u,c]=Cu(m,u,c);let P=d.pxRound,W=le=>P(x(le,w,b,R)),V=le=>P(z(le,v,U,k)),Z,G,ee;w.ori==0?(Z=Tu,ee=zl,G=Rm):(Z=zu,ee=Ml,G=Nm);const re=w.dir*(w.ori==0?1:-1);let ve=W(p[re==1?u:c]),de=ve,Y=[],Ce=[];for(let le=re==1?u:c;le>=u&&le<=c;le+=re)if(m[le]!=null){let oe=p[le],X=W(oe);Y.push(de=X),Ce.push(V(m[le]))}const ae={stroke:l(Y,Ce,Z,ee,G,P),fill:null,clip:null,band:null,gaps:null,flags:kl},ye=ae.stroke;let[me,De]=sd(i,o);if(d.fill!=null||me!=0){let le=ae.fill=new Path2D(ye),ie=d.fillTo(i,o,d.min,d.max,me),oe=V(ie);ee(le,de,oe),ee(le,ve,oe)}if(!d.spanGaps){let le=[];le.push(...ld(p,m,u,c,re,W,r)),ae.gaps=le=d.gaps(i,o,u,c,le),ae.clip=Du(le,w.ori,R,k,b,U)}return De!=0&&(ae.band=De==2?[Ci(i,o,u,c,ye,-1),Ci(i,o,u,c,ye,1)]:Ci(i,o,u,c,ye,De)),ae})}function p1(l){return h1(g1,l)}function g1(l,t,r,i,o,u){const c=l.length;if(c<2)return null;const d=new Path2D;if(r(d,l[0],t[0]),c==2)i(d,l[1],t[1]);else{let p=Array(c),m=Array(c-1),w=Array(c-1),v=Array(c-1);for(let x=0;x0!=m[x]>0?p[x]=0:(p[x]=3*(v[x-1]+v[x])/((2*v[x]+v[x-1])/m[x-1]+(v[x]+2*v[x-1])/m[x]),isFinite(p[x])||(p[x]=0));p[c-1]=m[c-2];for(let x=0;x{Ln.pxRatio=Je}));const m1=zm(),v1=Dm();function dg(l,t,r,i){return(i?[l[0],l[1]].concat(l.slice(2)):[l[0]].concat(l.slice(1))).map((u,c)=>Pf(u,c,t,r))}function y1(l,t){return l.map((r,i)=>i==0?{}:Vt({},t,r))}function Pf(l,t,r,i){return Vt({},t==0?r:i,l)}function Mm(l,t,r){return t==null?El:[t,r]}const w1=Mm;function S1(l,t,r){return t==null?El:fu(t,r,Jf,!0)}function bm(l,t,r,i){return t==null?El:ku(t,r,l.scales[i].log,!1)}const x1=bm;function Om(l,t,r,i){return t==null?El:qf(t,r,l.scales[i].log,!1)}const _1=Om;function E1(l,t,r,i,o){let u=Gn(Vp(l),Vp(t)),c=t-l,d=Gr(o/i*c,r);do{let p=r[d],m=i*p/c;if(m>=o&&u+(p<5?is.get(p):0)<=17)return[p,m]}while(++d(t=Jt((r=+o)*Je))+"px"),[l,t,r]}function C1(l){l.show&&[l.font,l.labelFont].forEach(t=>{let r=ft(t[2]*Je,1);t[0]=t[0].replace(/[0-9.]+px/,r+"px"),t[1]=r})}function Ln(l,t,r){const i={mode:Xe(l.mode,1)},o=i.mode;function u(g,S,_,E){let T=S.valToPct(g);return E+_*(S.dir==-1?1-T:T)}function c(g,S,_,E){let T=S.valToPct(g);return E+_*(S.dir==-1?T:1-T)}function d(g,S,_,E){return S.ori==0?u(g,S,_,E):c(g,S,_,E)}i.valToPosH=u,i.valToPosV=c;let p=!1;i.status=0;const m=i.root=Lr(M0);if(l.id!=null&&(m.id=l.id),wr(m,l.class),l.title){let g=Lr(L0,m);g.textContent=l.title}const w=$r("canvas"),v=i.ctx=w.getContext("2d"),x=Lr(P0,m);Os("click",x,g=>{g.target===R&&(Ke!=fi||rt!=Ii)&&Qt.click(i,g)},!0);const z=i.under=Lr(A0,x);x.appendChild(w);const R=i.over=Lr(I0,x);l=Cl(l);const k=+Xe(l.pxAlign,1),b=ug(k);(l.plugins||[]).forEach(g=>{g.opts&&(l=g.opts(i,l)||l)});const U=l.ms||.001,P=i.series=o==1?dg(l.series||[],ng,og,!1):y1(l.series||[null],lg),W=i.axes=dg(l.axes||[],tg,ig,!0),V=i.scales={},Z=i.bands=l.bands||[];Z.forEach(g=>{g.fill=Ve(g.fill||null),g.dir=Xe(g.dir,-1)});const G=o==2?P[1].facets[0].scale:P[0].scale,ee={axes:Bo,series:Au},re=(l.drawOrder||["axes","series"]).map(g=>ee[g]);function ve(g){const S=g.distr==3?_=>Ei(_>0?_:g.clamp(i,_,g.min,g.max,g.key)):g.distr==4?_=>hf(_,g.asinh):g.distr==100?_=>g.fwd(_):_=>_;return _=>{let E=S(_),{_min:T,_max:L}=g,$=L-T;return(E-T)/$}}function de(g){let S=V[g];if(S==null){let _=(l.scales||ko)[g]||ko;if(_.from!=null){de(_.from);let E=Vt({},V[_.from],_,{key:g});E.valToPct=ve(E),V[g]=E}else{S=V[g]=Vt({},g==G?xm:l1,_),S.key=g;let E=S.time,T=S.range,L=rs(T);if((g!=G||o==2&&!E)&&(L&&(T[0]==null||T[1]==null)&&(T={min:T[0]==null?Wp:{mode:1,hard:T[0],soft:T[0]},max:T[1]==null?Wp:{mode:1,hard:T[1],soft:T[1]}},L=!1),!L&&Nu(T))){let $=T;T=(q,ne,ue)=>ne==null?El:fu(ne,ue,$)}S.range=Ve(T||(E?w1:g==G?S.distr==3?x1:S.distr==4?_1:Mm:S.distr==3?bm:S.distr==4?Om:S1)),S.auto=Ve(L?!1:S.auto),S.clamp=Ve(S.clamp||s1),S._min=S._max=null,S.valToPct=ve(S)}}}de("x"),de("y"),o==1&&P.forEach(g=>{de(g.scale)}),W.forEach(g=>{de(g.scale)});for(let g in l.scales)de(g);const Y=V[G],Ce=Y.distr;let ae,ye;Y.ori==0?(wr(m,b0),ae=u,ye=c):(wr(m,O0),ae=c,ye=u);const me={};for(let g in V){let S=V[g];(S.min!=null||S.max!=null)&&(me[g]={min:S.min,max:S.max},S.min=S.max=null)}const De=l.tzDate||(g=>new Date(Jt(g/U))),le=l.fmtDate||td,ie=U==1?bw(De):Pw(De),oe=Jp(De,qp(U==1?Mw:Lw,le)),X=eg(De,Zp(Iw,le)),D=[],H=i.legend=Vt({},jw,l.legend),K=i.cursor=Vt({},Gw,{drag:{y:o==2}},l.cursor),xe=H.show,be=K.show,ge=H.markers;H.idxs=D,ge.width=Ve(ge.width),ge.dash=Ve(ge.dash),ge.stroke=Ve(ge.stroke),ge.fill=Ve(ge.fill);let _e,He,Fe,Oe=[],$t=[],Pt,At=!1,It={};if(H.live){const g=P[1]?P[1].values:null;At=g!=null,Pt=At?g(i,1,0):{_:0};for(let S in Pt)It[S]=Qf}if(xe)if(_e=$r("table",U0,m),Fe=$r("tbody",null,_e),H.mount(i,_e),At){He=$r("thead",null,_e,Fe);let g=$r("tr",null,He);$r("th",null,g);for(var Kn in Pt)$r("th",Dp,g).textContent=Kn}else wr(_e,$0),H.live&&wr(_e,V0);const Cn={show:!0},_r={show:!1};function Xr(g,S){if(S==0&&(At||!H.live||o==2))return El;let _=[],E=$r("tr",G0,Fe,Fe.childNodes[S]);wr(E,g.class),g.show||wr(E,Ms);let T=$r("th",null,E);if(ge.show){let q=Lr(Y0,T);if(S>0){let ne=ge.width(i,S);ne&&(q.style.border=ne+"px "+ge.dash(i,S)+" "+ge.stroke(i,S)),q.style.background=ge.fill(i,S)}}let L=Lr(Dp,T);g.label instanceof HTMLElement?L.appendChild(g.label):L.textContent=g.label,S>0&&(ge.show||(L.style.color=g.width>0?ge.stroke(i,S):ge.fill(i,S)),Ze("click",T,q=>{if(K._lock)return;wn(q);let ne=P.indexOf(g);if((q.ctrlKey||q.metaKey)!=H.isolate){let ue=P.some((fe,he)=>he>0&&he!=ne&&fe.show);P.forEach((fe,he)=>{he>0&&dr(he,ue?he==ne?Cn:_r:Cn,!0,Dt.setSeries)})}else dr(ne,{show:!g.show},!0,Dt.setSeries)},!1),_t&&Ze(bp,T,q=>{K._lock||(wn(q),dr(P.indexOf(g),ji,!0,Dt.setSeries))},!1));for(var $ in Pt){let q=$r("td",K0,E);q.textContent="--",_.push(q)}return[E,_]}const Pn=new Map;function Ze(g,S,_,E=!0){const T=Pn.get(S)||{},L=K.bind[g](i,S,_,E);L&&(Os(g,S,T[g]=L),Pn.set(S,T))}function nn(g,S,_){const E=Pn.get(S)||{};for(let T in E)(g==null||T==g)&&(Tf(T,S,E[T]),delete E[T]);g==null&&Pn.delete(S)}let rn=0,sr=0,Pe=0,ce=0,qe=0,et=0,sn=qe,kn=et,Gt=Pe,Rt=ce,ln=0,mn=0,Yt=0,vn=0;i.bbox={};let qr=!1,Jr=!1,lr=!1,or=!1,Zr=!1,zt=!1;function lt(g,S,_){(_||g!=i.width||S!=i.height)&&Kt(g,S),ci(!1),lr=!0,Jr=!0,Hn()}function Kt(g,S){i.width=rn=Pe=g,i.height=sr=ce=S,qe=et=0,an(),Rn();let _=i.bbox;ln=_.left=Ts(qe*Je,.5),mn=_.top=Ts(et*Je,.5),Yt=_.width=Ts(Pe*Je,.5),vn=_.height=Ts(ce*Je,.5)}const on=3;function ar(){let g=!1,S=0;for(;!g;){S++;let _=Hl(S),E=Wo(S);g=S==on||_&&E,g||(Kt(i.width,i.height),Jr=!0)}}function yn({width:g,height:S}){lt(g,S)}i.setSize=yn;function an(){let g=!1,S=!1,_=!1,E=!1;W.forEach((T,L)=>{if(T.show&&T._show){let{side:$,_size:q}=T,ne=$%2,ue=T.label!=null?T.labelSize:0,fe=q+ue;fe>0&&(ne?(Pe-=fe,$==3?(qe+=fe,E=!0):_=!0):(ce-=fe,$==0?(et+=fe,g=!0):S=!0))}}),An[0]=g,An[1]=_,An[2]=S,An[3]=E,Pe-=Ir[1]+Ir[3],qe+=Ir[3],ce-=Ir[2]+Ir[0],et+=Ir[0]}function Rn(){let g=qe+Pe,S=et+ce,_=qe,E=et;function T(L,$){switch(L){case 1:return g+=$,g-$;case 2:return S+=$,S-$;case 3:return _-=$,_+$;case 0:return E-=$,E+$}}W.forEach((L,$)=>{if(L.show&&L._show){let q=L.side;L._pos=T(q,L._size),L.label!=null&&(L._lpos=T(q,L.labelSize))}})}if(K.dataIdx==null){let g=K.hover,S=g.skip=new Set(g.skip??[]);S.add(void 0);let _=g.prox=Ve(g.prox),E=g.bias??(g.bias=0);K.dataIdx=(T,L,$,q)=>{if(L==0)return $;let ne=$,ue=_(T,L,$,q)??ct,fe=ue>=0&&ue0;)S.has(Ue[ke])||(je=ke);if(E==0||E==1)for(ke=$;Te==null&&ke++ue&&(ne=null);return ne}}const wn=g=>{K.event=g};K.idxs=D,K._lock=!1;let We=K.points;We.show=Ve(We.show),We.size=Ve(We.size),We.stroke=Ve(We.stroke),We.width=Ve(We.width),We.fill=Ve(We.fill);const xt=i.focus=Vt({},l.focus||{alpha:.3},K.focus),_t=xt.prox>=0,un=_t&&We.one;let vt=[],Sn=[],Ht=[];function Er(g,S){let _=We.show(i,S);if(_ instanceof HTMLElement)return wr(_,B0),wr(_,g.class),oi(_,-10,-10,Pe,ce),R.insertBefore(_,vt[S]),_}function Ri(g,S){if(o==1||S>0){let _=o==1&&V[g.scale].time,E=g.value;g.value=_?Yp(E)?eg(De,Zp(E,le)):E||X:E||n1,g.label=g.label||(_?Kw:Yw)}if(un||S>0){g.width=g.width==null?1:g.width,g.paths=g.paths||m1||lw,g.fillTo=Ve(g.fillTo||o1),g.pxAlign=+Xe(g.pxAlign,k),g.pxRound=ug(g.pxAlign),g.stroke=Ve(g.stroke||null),g.fill=Ve(g.fill||null),g._stroke=g._fill=g._paths=g._focus=null;let _=r1(Gn(1,g.width),1),E=g.points=Vt({},{size:_,width:Gn(1,_*.2),stroke:g.stroke,space:_*2,paths:v1,_stroke:null,_fill:null},g.points);E.show=Ve(E.show),E.filter=Ve(E.filter),E.fill=Ve(E.fill),E.stroke=Ve(E.stroke),E.paths=Ve(E.paths),E.pxAlign=g.pxAlign}if(xe){let _=Xr(g,S);Oe.splice(S,0,_[0]),$t.splice(S,0,_[1]),H.values.push(null)}if(be){D.splice(S,0,null);let _=null;un?S==0&&(_=Er(g,S)):S>0&&(_=Er(g,S)),vt.splice(S,0,_),Sn.splice(S,0,0),Ht.splice(S,0,0)}jt("addSeries",S)}function Ou(g,S){S=S??P.length,g=o==1?Pf(g,S,ng,og):Pf(g,S,{},lg),P.splice(S,0,g),Ri(P[S],S)}i.addSeries=Ou;function Lu(g){if(P.splice(g,1),xe){H.values.splice(g,1),$t.splice(g,1);let S=Oe.splice(g,1)[0];nn(null,S.firstChild),S.remove()}be&&(D.splice(g,1),vt.splice(g,1)[0].remove(),Sn.splice(g,1),Ht.splice(g,1)),jt("delSeries",g)}i.delSeries=Lu;const An=[!1,!1,!1,!1];function Ao(g,S){if(g._show=g.show,g.show){let _=g.side%2,E=V[g.scale];E==null&&(g.scale=_?P[1].scale:G,E=V[g.scale]);let T=E.time;g.size=Ve(g.size),g.space=Ve(g.space),g.rotate=Ve(g.rotate),rs(g.incrs)&&g.incrs.forEach($=>{!is.has($)&&is.set($,nm($))}),g.incrs=Ve(g.incrs||(E.distr==2?Dw:T?U==1?zw:Ow:zs)),g.splits=Ve(g.splits||(T&&E.distr==1?ie:E.distr==3?Mf:E.distr==4?qw:Xw)),g.stroke=Ve(g.stroke),g.grid.stroke=Ve(g.grid.stroke),g.ticks.stroke=Ve(g.ticks.stroke),g.border.stroke=Ve(g.border.stroke);let L=g.values;g.values=rs(L)&&!rs(L[0])?Ve(L):T?rs(L)?Jp(De,qp(L,le)):Yp(L)?Aw(De,L):L||oe:L||Qw,g.filter=Ve(g.filter||(E.distr>=3&&E.log==10?e1:E.distr==3&&E.log==2?t1:em)),g.font=hg(g.font),g.labelFont=hg(g.labelFont),g._size=g.size(i,null,S,0),g._space=g._rotate=g._incrs=g._found=g._splits=g._values=null,g._size>0&&(An[S]=!0,g._el=Lr(H0,x))}}function Ni(g,S,_,E){let[T,L,$,q]=_,ne=S%2,ue=0;return ne==0&&(q||L)&&(ue=S==0&&!T||S==2&&!$?Jt(tg.size/3):0),ne==1&&(T||$)&&(ue=S==1&&!L||S==3&&!q?Jt(ig.size/2):0),ue}const Io=i.padding=(l.padding||[Ni,Ni,Ni,Ni]).map(g=>Ve(Xe(g,Ni))),Ir=i._padding=Io.map((g,S)=>g(i,S,An,0));let Ft,Mt=null,bt=null;const Is=o==1?P[0].idxs:null;let ur=null,ot=!1;function Ho(g,S){if(t=g??[],i.data=i._data=t,o==2){Ft=0;for(let _=1;_=0,zt=!0,Hn()}}i.setData=Ho;function ss(){ot=!0;let g,S;o==1&&(Ft>0?(Mt=Is[0]=0,bt=Is[1]=Ft-1,g=t[0][Mt],S=t[0][bt],Ce==2?(g=Mt,S=bt):g==S&&(Ce==3?[g,S]=ku(g,g,Y.log,!1):Ce==4?[g,S]=qf(g,g,Y.log,!1):Y.time?S=g+Jt(86400/U):[g,S]=fu(g,S,Jf,!0))):(Mt=Is[0]=g=null,bt=Is[1]=S=null)),fr(G,g,S)}let ls,Hr,bl,Hs,Di,Qn,Ol,In,Ll,Nn;function Fo(g,S,_,E,T,L){g??(g=zp),_??(_=ed),E??(E="butt"),T??(T=zp),L??(L="round"),g!=ls&&(v.strokeStyle=ls=g),T!=Hr&&(v.fillStyle=Hr=T),S!=bl&&(v.lineWidth=bl=S),L!=Di&&(v.lineJoin=Di=L),E!=Qn&&(v.lineCap=Qn=E),_!=Hs&&v.setLineDash(Hs=_)}function os(g,S,_,E){S!=Hr&&(v.fillStyle=Hr=S),g!=Ol&&(v.font=Ol=g),_!=In&&(v.textAlign=In=_),E!=Ll&&(v.textBaseline=Ll=E)}function Ti(g,S,_,E,T=0){if(E.length>0&&g.auto(i,ot)&&(S==null||S.min==null)){let L=Xe(Mt,0),$=Xe(bt,E.length-1),q=_.min==null?ew(E,L,$,T,g.distr==3):[_.min,_.max];g.min=Yr(g.min,_.min=q[0]),g.max=Gn(g.max,_.max=q[1])}}const zi={min:null,max:null};function Fs(){for(let E in V){let T=V[E];me[E]==null&&(T.min==null||me[G]!=null&&T.auto(i,ot))&&(me[E]=zi)}for(let E in V){let T=V[E];me[E]==null&&T.from!=null&&me[T.from]!=null&&(me[E]=zi)}me[G]!=null&&ci(!0);let g={};for(let E in me){let T=me[E];if(T!=null){let L=g[E]=Cl(V[E],uw);if(T.min!=null)Vt(L,T);else if(E!=G||o==2)if(Ft==0&&L.from==null){let $=L.range(i,null,null,E);L.min=$[0],L.max=$[1]}else L.min=ct,L.max=-ct}}if(Ft>0){P.forEach((E,T)=>{if(o==1){let L=E.scale,$=me[L];if($==null)return;let q=g[L];if(T==0){let ne=q.range(i,q.min,q.max,L);q.min=ne[0],q.max=ne[1],Mt=Gr(q.min,t[0]),bt=Gr(q.max,t[0]),bt-Mt>1&&(t[0][Mt]q.max&&bt--),E.min=ur[Mt],E.max=ur[bt]}else E.show&&E.auto&&Ti(q,$,E,t[T],E.sorted);E.idxs[0]=Mt,E.idxs[1]=bt}else if(T>0&&E.show&&E.auto){let[L,$]=E.facets,q=L.scale,ne=$.scale,[ue,fe]=t[T],he=g[q],Ae=g[ne];he!=null&&Ti(he,me[q],L,ue,L.sorted),Ae!=null&&Ti(Ae,me[ne],$,fe,$.sorted),E.min=$.min,E.max=$.max}});for(let E in g){let T=g[E],L=me[E];if(T.from==null&&(L==null||L.min==null)){let $=T.range(i,T.min==ct?null:T.min,T.max==-ct?null:T.max,E);T.min=$[0],T.max=$[1]}}}for(let E in g){let T=g[E];if(T.from!=null){let L=g[T.from];if(L.min==null)T.min=T.max=null;else{let $=T.range(i,L.min,L.max,E);T.min=$[0],T.max=$[1]}}}let S={},_=!1;for(let E in g){let T=g[E],L=V[E];if(L.min!=T.min||L.max!=T.max){L.min=T.min,L.max=T.max;let $=L.distr;L._min=$==3?Ei(L.min):$==4?hf(L.min,L.asinh):$==100?L.fwd(L.min):L.min,L._max=$==3?Ei(L.max):$==4?hf(L.max,L.asinh):$==100?L.fwd(L.max):L.max,S[E]=_=!0}}if(_){P.forEach((E,T)=>{o==2?T>0&&S.y&&(E._paths=null):S[E.scale]&&(E._paths=null)});for(let E in S)lr=!0,jt("setScale",E);be&&K.left>=0&&(or=zt=!0)}for(let E in me)me[E]=null}function Pu(g){let S=zf(Mt-1,0,Ft-1),_=zf(bt+1,0,Ft-1);for(;g[S]==null&&S>0;)S--;for(;g[_]==null&&_0){let g=P.some(S=>S._focus)&&Nn!=xt.alpha;g&&(v.globalAlpha=Nn=xt.alpha),P.forEach((S,_)=>{if(_>0&&S.show&&(js(_,!1),js(_,!0),S._paths==null)){let E=Nn;Nn!=S.alpha&&(v.globalAlpha=Nn=S.alpha);let T=o==2?[0,t[_][0].length-1]:Pu(t[_]);S._paths=S.paths(i,_,T[0],T[1]),Nn!=E&&(v.globalAlpha=Nn=E)}}),P.forEach((S,_)=>{if(_>0&&S.show){let E=Nn;Nn!=S.alpha&&(v.globalAlpha=Nn=S.alpha),S._paths!=null&&Pl(_,!1);{let T=S._paths!=null?S._paths.gaps:null,L=S.points.show(i,_,Mt,bt,T),$=S.points.filter(i,_,L,T);(L||$)&&(S.points._paths=S.points.paths(i,_,Mt,bt,$),Pl(_,!0))}Nn!=E&&(v.globalAlpha=Nn=E),jt("drawSeries",_)}}),g&&(v.globalAlpha=Nn=1)}}function js(g,S){let _=S?P[g].points:P[g];_._stroke=_.stroke(i,g),_._fill=_.fill(i,g)}function Pl(g,S){let _=S?P[g].points:P[g],{stroke:E,fill:T,clip:L,flags:$,_stroke:q=_._stroke,_fill:ne=_._fill,_width:ue=_.width}=_._paths;ue=ft(ue*Je,3);let fe=null,he=ue%2/2;S&&ne==null&&(ne=ue>0?"#fff":q);let Ae=_.pxAlign==1&&he>0;if(Ae&&v.translate(he,he),!S){let Ge=ln-ue/2,Ue=mn-ue/2,je=Yt+ue,Te=vn+ue;fe=new Path2D,fe.rect(Ge,Ue,je,Te)}S?Il(q,ue,_.dash,_.cap,ne,E,T,$,L):Al(g,q,ue,_.dash,_.cap,ne,E,T,$,fe,L),Ae&&v.translate(-he,-he)}function Al(g,S,_,E,T,L,$,q,ne,ue,fe){let he=!1;ne!=0&&Z.forEach((Ae,Ge)=>{if(Ae.series[0]==g){let Ue=P[Ae.series[1]],je=t[Ae.series[1]],Te=(Ue._paths||ko).band;rs(Te)&&(Te=Ae.dir==1?Te[0]:Te[1]);let ke,st=null;Ue.show&&Te&&nw(je,Mt,bt)?(st=Ae.fill(i,Ge)||L,ke=Ue._paths.clip):Te=null,Il(S,_,E,T,st,$,q,ne,ue,fe,ke,Te),he=!0}}),he||Il(S,_,E,T,L,$,q,ne,ue,fe)}const Mi=kl|Of;function Il(g,S,_,E,T,L,$,q,ne,ue,fe,he){Fo(g,S,_,E,T),(ne||ue||he)&&(v.save(),ne&&v.clip(ne),ue&&v.clip(ue)),he?(q&Mi)==Mi?(v.clip(he),fe&&v.clip(fe),$e(T,$),bi(g,L,S)):q&Of?($e(T,$),v.clip(he),bi(g,L,S)):q&kl&&(v.save(),v.clip(he),fe&&v.clip(fe),$e(T,$),v.restore(),bi(g,L,S)):($e(T,$),bi(g,L,S)),(ne||ue||he)&&v.restore()}function bi(g,S,_){_>0&&(S instanceof Map?S.forEach((E,T)=>{v.strokeStyle=ls=T,v.stroke(E)}):S!=null&&g&&v.stroke(S))}function $e(g,S){S instanceof Map?S.forEach((_,E)=>{v.fillStyle=Hr=E,v.fill(_)}):S!=null&&g&&v.fill(S)}function jo(g,S,_,E){let T=W[g],L;if(E<=0)L=[0,0];else{let $=T._space=T.space(i,g,S,_,E),q=T._incrs=T.incrs(i,g,S,_,E,$);L=E1(S,_,q,E,$)}return T._found=L}function Ws(g,S,_,E,T,L,$,q,ne,ue){let fe=$%2/2;k==1&&v.translate(fe,fe),Fo(q,$,ne,ue,q),v.beginPath();let he,Ae,Ge,Ue,je=T+(E==0||E==3?-L:L);_==0?(Ae=T,Ue=je):(he=T,Ge=je);for(let Te=0;Te{if(!_.show)return;let T=V[_.scale];if(T.min==null){_._show&&(S=!1,_._show=!1,ci(!1));return}else _._show||(S=!1,_._show=!0,ci(!1));let L=_.side,$=L%2,{min:q,max:ne}=T,[ue,fe]=jo(E,q,ne,$==0?Pe:ce);if(fe==0)return;let he=T.distr==2,Ae=_._splits=_.splits(i,E,q,ne,ue,fe,he),Ge=T.distr==2?Ae.map(ke=>ur[ke]):Ae,Ue=T.distr==2?ur[Ae[1]]-ur[Ae[0]]:ue,je=_._values=_.values(i,_.filter(i,Ge,E,fe,Ue),E,fe,Ue);_._rotate=L==2?_.rotate(i,je,E,fe):0;let Te=_._size;_._size=Ar(_.size(i,je,E,g)),Te!=null&&_._size!=Te&&(S=!1)}),S}function Wo(g){let S=!0;return Io.forEach((_,E)=>{let T=_(i,E,An,g);T!=Ir[E]&&(S=!1),Ir[E]=T}),S}function Bo(){for(let g=0;gur[xn]):Ge,je=fe.distr==2?ur[Ge[1]]-ur[Ge[0]]:ne,Te=S.ticks,ke=S.border,st=Te.show?Te.size:0,yt=Jt(st*Je),Wt=Jt((S.alignTo==2?S._size-st-S.gap:S.gap)*Je),tt=S._rotate*-Ja/180,wt=b(S._pos*Je),jn=(yt+Wt)*q,at=wt+jn;L=E==0?at:0,T=E==1?at:0;let cn=S.font[0],Jn=S.align==1?gl:S.align==2?cf:tt>0?gl:tt<0?cf:E==0?"center":_==3?cf:gl,pr=tt||E==1?"middle":_==2?po:Tp;os(cn,$,Jn,pr);let Tn=S.font[1]*S.lineGap,Wn=Ge.map(xn=>b(d(xn,fe,he,Ae))),Bn=S._values;for(let xn=0;xn{_>0&&(S._paths=null,g&&(o==1?(S.min=null,S.max=null):S.facets.forEach(E=>{E.min=null,E.max=null})))})}let Oi=!1,Li=!1,Xn=[];function ei(){Li=!1;for(let g=0;g0&&queueMicrotask(ei)}i.batch=as;function Pi(){if(qr&&(Fs(),qr=!1),lr&&(ar(),lr=!1),Jr){if(mt(z,gl,qe),mt(z,po,et),mt(z,vo,Pe),mt(z,yo,ce),mt(R,gl,qe),mt(R,po,et),mt(R,vo,Pe),mt(R,yo,ce),mt(x,vo,rn),mt(x,yo,sr),w.width=Jt(rn*Je),w.height=Jt(sr*Je),W.forEach(({_el:g,_show:S,_size:_,_pos:E,side:T})=>{if(g!=null)if(S){let L=T===3||T===0?_:0,$=T%2==1;mt(g,$?"left":"top",E-L),mt(g,$?"width":"height",_),mt(g,$?"top":"left",$?et:qe),mt(g,$?"height":"width",$?ce:Pe),Df(g,Ms)}else wr(g,Ms)}),ls=Hr=bl=Di=Qn=Ol=In=Ll=Hs=null,Nn=1,gs(!0),qe!=sn||et!=kn||Pe!=Gt||ce!=Rt){ci(!1);let g=Pe/Gt,S=ce/Rt;if(be&&!or&&K.left>=0){K.left*=g,K.top*=S,kr&&oi(kr,Jt(K.left),0,Pe,ce),Ai&&oi(Ai,0,Jt(K.top),Pe,ce);for(let _=0;_=0&&it.width>0){it.left*=g,it.width*=g,it.top*=S,it.height*=S;for(let _ in Vl)mt(di,_,it[_])}sn=qe,kn=et,Gt=Pe,Rt=ce}jt("setSize"),Jr=!1}rn>0&&sr>0&&(v.clearRect(0,0,w.width,w.height),jt("drawClear"),re.forEach(g=>g()),jt("draw")),it.show&&Zr&&(cr(it),Zr=!1),be&&or&&(hi(null,!0,!1),or=!1),H.show&&H.live&&zt&&(ps(),zt=!1),p||(p=!0,i.status=1,jt("ready")),ot=!1,Oi=!1}i.redraw=(g,S)=>{lr=S||!1,g!==!1?fr(G,Y.min,Y.max):Hn()};function Cr(g,S){let _=V[g];if(_.from==null){if(Ft==0){let E=_.range(i,S.min,S.max,g);S.min=E[0],S.max=E[1]}if(S.min>S.max){let E=S.min;S.min=S.max,S.max=E}if(Ft>1&&S.min!=null&&S.max!=null&&S.max-S.min<1e-16)return;g==G&&_.distr==2&&Ft>0&&(S.min=Gr(S.min,t[0]),S.max=Gr(S.max,t[0]),S.min==S.max&&S.max++),me[g]=S,qr=!0,Hn()}}i.setScale=Cr;let Fl,Bs,kr,Ai,jl,us,fi,Ii,Hi,Fi,Ke,rt,ti=!1;const Qt=K.drag;let Nt=Qt.x,Et=Qt.y;be&&(K.x&&(Fl=Lr(j0,R)),K.y&&(Bs=Lr(W0,R)),Y.ori==0?(kr=Fl,Ai=Bs):(kr=Bs,Ai=Fl),Ke=K.left,rt=K.top);const it=i.select=Vt({show:!0,over:!0,left:0,width:0,top:0,height:0},l.select),di=it.show?Lr(F0,it.over?R:z):null;function cr(g,S){if(it.show){for(let _ in g)it[_]=g[_],_ in Vl&&mt(di,_,g[_]);S!==!1&&jt("setSelect")}}i.setSelect=cr;function Wl(g){if(P[g].show)xe&&Df(Oe[g],Ms);else if(xe&&wr(Oe[g],Ms),be){let _=un?vt[0]:vt[g];_!=null&&oi(_,-10,-10,Pe,ce)}}function fr(g,S,_){Cr(g,{min:S,max:_})}function dr(g,S,_,E){S.focus!=null&&Bl(g),S.show!=null&&P.forEach((T,L)=>{L>0&&(g==L||g==null)&&(T.show=S.show,Wl(L),o==2?(fr(T.facets[0].scale,null,null),fr(T.facets[1].scale,null,null)):fr(T.scale,null,null),Hn())}),_!==!1&&jt("setSeries",g,S),E&&ms("setSeries",i,g,S)}i.setSeries=dr;function Us(g,S){Vt(Z[g],S)}function Vs(g,S){g.fill=Ve(g.fill||null),g.dir=Xe(g.dir,-1),S=S??Z.length,Z.splice(S,0,g)}function Uo(g){g==null?Z.length=0:Z.splice(g,1)}i.addBand=Vs,i.setBand=Us,i.delBand=Uo;function Fn(g,S){P[g].alpha=S,be&&vt[g]!=null&&(vt[g].style.opacity=S),xe&&Oe[g]&&(Oe[g].style.opacity=S)}let Dn,Rr,hr;const ji={focus:!0};function Bl(g){if(g!=hr){let S=g==null,_=xt.alpha!=1;P.forEach((E,T)=>{if(o==1||T>0){let L=S||T==0||T==g;E._focus=S?null:L,_&&Fn(T,L?1:xt.alpha)}}),hr=g,_&&Hn()}}xe&&_t&&Ze(Op,_e,g=>{K._lock||(wn(g),hr!=null&&dr(null,ji,!0,Dt.setSeries))});function qn(g,S,_){let E=V[S];_&&(g=g/Je-(E.ori==1?et:qe));let T=Pe;E.ori==1&&(T=ce,g=T-g),E.dir==-1&&(g=T-g);let L=E._min,$=E._max,q=g/T,ne=L+($-L)*q,ue=E.distr;return ue==3?_l(10,ne):ue==4?iw(ne,E.asinh):ue==100?E.bwd(ne):ne}function cs(g,S){let _=qn(g,G,S);return Gr(_,t[0],Mt,bt)}i.valToIdx=g=>Gr(g,t[0]),i.posToIdx=cs,i.posToVal=qn,i.valToPos=(g,S,_)=>V[S].ori==0?u(g,V[S],_?Yt:Pe,_?ln:0):c(g,V[S],_?vn:ce,_?mn:0),i.setCursor=(g,S,_)=>{Ke=g.left,rt=g.top,hi(null,S,_)};function fs(g,S){mt(di,gl,it.left=g),mt(di,vo,it.width=S)}function Ul(g,S){mt(di,po,it.top=g),mt(di,yo,it.height=S)}let ds=Y.ori==0?fs:Ul,hs=Y.ori==1?fs:Ul;function Iu(){if(xe&&H.live)for(let g=o==2?1:0;g{D[E]=_}):aw(g.idx)||D.fill(g.idx),H.idx=D[0]),xe&&H.live){for(let _=0;_0||o==1&&!At)&&Hu(_,D[_]);Iu()}zt=!1,S!==!1&&jt("setLegend")}i.setLegend=ps;function Hu(g,S){let _=P[g],E=g==0&&Ce==2?ur:t[g],T;At?T=_.values(i,g,S)??It:(T=_.value(i,S==null?null:E[S],g,S),T=T==null?It:{_:T}),H.values[g]=T}function hi(g,S,_){Hi=Ke,Fi=rt,[Ke,rt]=K.move(i,Ke,rt),K.left=Ke,K.top=rt,be&&(kr&&oi(kr,Jt(Ke),0,Pe,ce),Ai&&oi(Ai,0,Jt(rt),Pe,ce));let E,T=Mt>bt;Dn=ct,Rr=null;let L=Y.ori==0?Pe:ce,$=Y.ori==1?Pe:ce;if(Ke<0||Ft==0||T){E=K.idx=null;for(let q=0;q0&&st.show){let jn=tt==null?-10:tt==E?ue:ae(o==1?t[0][tt]:t[ke][0][tt],Y,L,0),at=wt==null?-10:ye(wt,o==1?V[st.scale]:V[st.facets[1].scale],$,0);if(_t&&wt!=null){let cn=Y.ori==1?Ke:rt,Jn=Zt(xt.dist(i,ke,tt,at,cn));if(Jn=0?1:-1,Bn=Tn>=0?1:-1;Bn==Wn&&(Bn==1?pr==1?wt>=Tn:wt<=Tn:pr==1?wt<=Tn:wt>=Tn)&&(Dn=Jn,Rr=ke)}else Dn=Jn,Rr=ke}}if(zt||un){let cn,Jn;Y.ori==0?(cn=jn,Jn=at):(cn=at,Jn=jn);let pr,Tn,Wn,Bn,Nr,xn,Bt=!0,Fr=We.bbox;if(Fr!=null){Bt=!1;let Ot=Fr(i,ke);Wn=Ot.left,Bn=Ot.top,pr=Ot.width,Tn=Ot.height}else Wn=cn,Bn=Jn,pr=Tn=We.size(i,ke);if(xn=We.fill(i,ke),Nr=We.stroke(i,ke),un)ke==Rr&&Dn<=xt.prox&&(fe=Wn,he=Bn,Ae=pr,Ge=Tn,Ue=Bt,je=xn,Te=Nr);else{let Ot=vt[ke];Ot!=null&&(Sn[ke]=Wn,Ht[ke]=Bn,jp(Ot,pr,Tn,Bt),Hp(Ot,xn,Nr),oi(Ot,Ar(Wn),Ar(Bn),Pe,ce))}}}}if(un){let ke=xt.prox,st=hr==null?Dn<=ke:Dn>ke||Rr!=hr;if(zt||st){let yt=vt[0];yt!=null&&(Sn[0]=fe,Ht[0]=he,jp(yt,Ae,Ge,Ue),Hp(yt,je,Te),oi(yt,Ar(fe),Ar(he),Pe,ce))}}}if(it.show&&ti)if(g!=null){let[q,ne]=Dt.scales,[ue,fe]=Dt.match,[he,Ae]=g.cursor.sync.scales,Ge=g.cursor.drag;if(Nt=Ge._x,Et=Ge._y,Nt||Et){let{left:Ue,top:je,width:Te,height:ke}=g.select,st=g.scales[he].ori,yt=g.posToVal,Wt,tt,wt,jn,at,cn=q!=null&&ue(q,he),Jn=ne!=null&&fe(ne,Ae);cn&&Nt?(st==0?(Wt=Ue,tt=Te):(Wt=je,tt=ke),wt=V[q],jn=ae(yt(Wt,he),wt,L,0),at=ae(yt(Wt+tt,he),wt,L,0),ds(Yr(jn,at),Zt(at-jn))):ds(0,L),Jn&&Et?(st==1?(Wt=Ue,tt=Te):(Wt=je,tt=ke),wt=V[ne],jn=ye(yt(Wt,Ae),wt,$,0),at=ye(yt(Wt+tt,Ae),wt,$,0),hs(Yr(jn,at),Zt(at-jn))):hs(0,$)}else $l()}else{let q=Zt(Hi-jl),ne=Zt(Fi-us);if(Y.ori==1){let Ae=q;q=ne,ne=Ae}Nt=Qt.x&&q>=Qt.dist,Et=Qt.y&&ne>=Qt.dist;let ue=Qt.uni;ue!=null?Nt&&Et&&(Nt=q>=ue,Et=ne>=ue,!Nt&&!Et&&(ne>q?Et=!0:Nt=!0)):Qt.x&&Qt.y&&(Nt||Et)&&(Nt=Et=!0);let fe,he;Nt&&(Y.ori==0?(fe=fi,he=Ke):(fe=Ii,he=rt),ds(Yr(fe,he),Zt(he-fe)),Et||hs(0,$)),Et&&(Y.ori==1?(fe=fi,he=Ke):(fe=Ii,he=rt),hs(Yr(fe,he),Zt(he-fe)),Nt||ds(0,L)),!Nt&&!Et&&(ds(0,0),hs(0,0))}if(Qt._x=Nt,Qt._y=Et,g==null){if(_){if(Ks!=null){let[q,ne]=Dt.scales;Dt.values[0]=q!=null?qn(Y.ori==0?Ke:rt,q):null,Dt.values[1]=ne!=null?qn(Y.ori==1?Ke:rt,ne):null}ms(ff,i,Ke,rt,Pe,ce,E)}if(_t){let q=_&&Dt.setSeries,ne=xt.prox;hr==null?Dn<=ne&&dr(Rr,ji,!0,q):Dn>ne?dr(null,ji,!0,q):Rr!=hr&&dr(Rr,ji,!0,q)}}zt&&(H.idx=E,ps()),S!==!1&&jt("setCursor")}let ni=null;Object.defineProperty(i,"rect",{get(){return ni==null&&gs(!1),ni}});function gs(g=!1){g?ni=null:(ni=R.getBoundingClientRect(),jt("syncRect",ni))}function Vo(g,S,_,E,T,L,$){K._lock||ti&&g!=null&&g.movementX==0&&g.movementY==0||($s(g,S,_,E,T,L,$,!1,g!=null),g!=null?hi(null,!0,!0):hi(S,!0,!1))}function $s(g,S,_,E,T,L,$,q,ne){if(ni==null&&gs(!1),wn(g),g!=null)_=g.clientX-ni.left,E=g.clientY-ni.top;else{if(_<0||E<0){Ke=-10,rt=-10;return}let[ue,fe]=Dt.scales,he=S.cursor.sync,[Ae,Ge]=he.values,[Ue,je]=he.scales,[Te,ke]=Dt.match,st=S.axes[0].side%2==1,yt=Y.ori==0?Pe:ce,Wt=Y.ori==1?Pe:ce,tt=st?L:T,wt=st?T:L,jn=st?E:_,at=st?_:E;if(Ue!=null?_=Te(ue,Ue)?d(Ae,V[ue],yt,0):-10:_=yt*(jn/tt),je!=null?E=ke(fe,je)?d(Ge,V[fe],Wt,0):-10:E=Wt*(at/wt),Y.ori==1){let cn=_;_=E,E=cn}}ne&&(S==null||S.cursor.event.type==ff)&&((_<=1||_>=Pe-1)&&(_=Ts(_,Pe)),(E<=1||E>=ce-1)&&(E=Ts(E,ce))),q?(jl=_,us=E,[fi,Ii]=K.move(i,_,E)):(Ke=_,rt=E)}const Vl={width:0,height:0,left:0,top:0};function $l(){cr(Vl,!1)}let $o,Go,Gs,Yo;function Ko(g,S,_,E,T,L,$){ti=!0,Nt=Et=Qt._x=Qt._y=!1,$s(g,S,_,E,T,L,$,!0,!1),g!=null&&(Ze(df,Rf,Qo,!1),ms(Mp,i,fi,Ii,Pe,ce,null));let{left:q,top:ne,width:ue,height:fe}=it;$o=q,Go=ne,Gs=ue,Yo=fe}function Qo(g,S,_,E,T,L,$){ti=Qt._x=Qt._y=!1,$s(g,S,_,E,T,L,$,!1,!0);let{left:q,top:ne,width:ue,height:fe}=it,he=ue>0||fe>0,Ae=$o!=q||Go!=ne||Gs!=ue||Yo!=fe;if(he&&Ae&&cr(it),Qt.setScale&&he&&Ae){let Ge=q,Ue=ue,je=ne,Te=fe;if(Y.ori==1&&(Ge=ne,Ue=fe,je=q,Te=ue),Nt&&fr(G,qn(Ge,G),qn(Ge+Ue,G)),Et)for(let ke in V){let st=V[ke];ke!=G&&st.from==null&&st.min!=ct&&fr(ke,qn(je+Te,ke),qn(je,ke))}$l()}else K.lock&&(K._lock=!K._lock,hi(S,!0,g!=null));g!=null&&(nn(df,Rf),ms(df,i,Ke,rt,Pe,ce,null))}function Xo(g,S,_,E,T,L,$){if(K._lock)return;wn(g);let q=ti;if(ti){let ne=!0,ue=!0,fe=10,he,Ae;Y.ori==0?(he=Nt,Ae=Et):(he=Et,Ae=Nt),he&&Ae&&(ne=Ke<=fe||Ke>=Pe-fe,ue=rt<=fe||rt>=ce-fe),he&&ne&&(Ke=Ke{let T=Dt.match[2];_=T(i,S,_),_!=-1&&dr(_,E,!0,!1)},be&&(Ze(Mp,R,Ko),Ze(ff,R,Vo),Ze(bp,R,g=>{wn(g),gs(!1)}),Ze(Op,R,Xo),Ze(Lp,R,qo),Lf.add(i),i.syncRect=gs);const Ys=i.hooks=l.hooks||{};function jt(g,S,_){Li?Xn.push([g,S,_]):g in Ys&&Ys[g].forEach(E=>{E.call(null,i,S,_)})}(l.plugins||[]).forEach(g=>{for(let S in g.hooks)Ys[S]=(Ys[S]||[]).concat(g.hooks[S])});const Zo=(g,S,_)=>_,Dt=Vt({key:null,setSeries:!1,filters:{pub:$p,sub:$p},scales:[G,P[1]?P[1].scale:null],match:[Gp,Gp,Zo],values:[null,null]},K.sync);Dt.match.length==2&&Dt.match.push(Zo),K.sync=Dt;const Ks=Dt.key,pi=_m(Ks);function ms(g,S,_,E,T,L,$){Dt.filters.pub(g,S,_,E,T,L,$)&&pi.pub(g,S,_,E,T,L,$)}pi.sub(i);function ea(g,S,_,E,T,L,$){Dt.filters.sub(g,S,_,E,T,L,$)&&Wi[g](null,S,_,E,T,L,$)}i.pub=ea;function ta(){pi.unsub(i),Lf.delete(i),Pn.clear(),Tf(cu,Sl,Jo),m.remove(),_e==null||_e.remove(),jt("destroy")}i.destroy=ta;function Qs(){jt("init",l,t),Ho(t||l.data,!1),me[G]?Cr(G,me[G]):ss(),Zr=it.show&&(it.width>0||it.height>0),or=zt=!0,lt(l.width,l.height)}return P.forEach(Ri),W.forEach(Ao),r?r instanceof HTMLElement?(r.appendChild(m),Qs()):r(i,Qs):Qs(),i}Ln.assign=Vt;Ln.fmtNum=Zf;Ln.rangeNum=fu;Ln.rangeLog=ku;Ln.rangeAsinh=qf;Ln.orient=As;Ln.pxRatio=Je;Ln.join=gw;Ln.fmtDate=td,Ln.tzDate=Rw;Ln.sync=_m;{Ln.addGap=a1,Ln.clipGaps=Du;let l=Ln.paths={points:Dm};l.linear=zm,l.stepped=f1,l.bars=d1,l.spline=p1}const k1=6e3;class R1{constructor(t=k1){fo(this,"t");fo(this,"v");fo(this,"len",0);fo(this,"head",0);this.t=new Float64Array(t),this.v=new Float64Array(t)}push(t,r){const i=this.t.length;this.t[this.head]=t,this.v[this.head]=r,this.head=(this.head+1)%i,this.len=t&&(u[d]=this.t[m],c[d]=this.v[m],d++)}return{t:u.subarray(0,d),v:c.subarray(0,d)}}last(){if(this.len===0)return null;const t=this.t.length;return this.v[(this.head-1+t)%t]}}const Af=new Map;function N1(l){let t=Af.get(l);return t||(t=new R1,Af.set(l,t)),t}function Lm(l,t){const r=N1(l);for(const[i,o]of t)r.push(i,o)}function Pm(l,t=-1/0){const r=Af.get(l);return r?r.read(t):{t:new Float64Array(0),v:new Float64Array(0)}}const xl=new Map;let Za=[];function Am(){Za.forEach(l=>l())}function D1(l){xl.set(l,(xl.get(l)||0)+1),Am()}function T1(l){const t=(xl.get(l)||0)-1;t<=0?xl.delete(l):xl.set(l,t),Am()}function z1(){return Array.from(xl.keys())}function M1(l){return Za.push(l),()=>{Za=Za.filter(t=>t!==l)}}const pg=3e3;let yl=[],eu=[];function b1(l){l.length&&(yl=yl.concat(l),yl.length>pg&&(yl=yl.slice(-pg)),eu.forEach(t=>t()))}function O1(){return yl}function L1(l){return eu.push(l),()=>{eu=eu.filter(t=>t!==l)}}let tu=0,nu=[];function gg(l){tu+=l?1:-1,tu<0&&(tu=0),nu.forEach(t=>t())}function P1(){return tu>0}function A1(l){return nu.push(l),()=>{nu=nu.filter(t=>t!==l)}}let Ls=null,vf=null;function I1(){return`${location.protocol==="https:"?"wss":"ws"}://${location.host}/api/monitor/stream`}function mg(){Ls&&Ls.readyState===WebSocket.OPEN&&Ls.send(JSON.stringify({type:"subscribe",signals:z1()}))}function vg(){Ls&&Ls.readyState===WebSocket.OPEN&&Ls.send(JSON.stringify({type:"raw",enabled:P1()}))}function Im(){const l=new WebSocket(I1());Ls=l,l.onopen=()=>{gn.getState().setConnected(!0),mg(),vg()},l.onclose=()=>{gn.getState().setConnected(!1),vf==null&&(vf=window.setTimeout(()=>{vf=null,Im()},1e3))},l.onerror=()=>l.close(),l.onmessage=r=>{let i;try{i=JSON.parse(r.data)}catch{return}const o=gn.getState();switch(i.type){case"meta":o.setMeta(i.signals,i.pairs),o.setMotors(i.motors);break;case"motors":o.setMotors(i.motors),i.status&&o.setStatus(i.status);break;case"samples":for(const[u,c]of Object.entries(i.data))Lm(u,c);break;case"raw":b1(i.frames);break}};let t=null;M1(()=>{t==null&&(t=window.setTimeout(()=>{t=null,mg()},80))}),A1(vg)}async function H1(l,t=600){return l.length?(await fetch(`/api/monitor/snapshot?signals=${l.join(",")}&n=${t}`)).json():{}}async function F1(){try{return(await(await fetch("/api/monitor/motor-types")).json()).types||[]}catch{return[]}}async function j1(l,t){await fetch("/api/monitor/motor-type",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({motorId:l,motorType:t})})}const W1={pos:"#58a6ff",vel:"#3fb950",torque:"#d29922",kp:"#bc8cff",kd:"#f778ba",vel_limit:"#56d4dd",torque_limit:"#e3b341",t_mos:"#ff7b72",t_rotor:"#ffa657",status_code:"#8b949e"};function B1(l){return W1[l]||"#8b949e"}function ru(l){const t=B1(l.field);return l.source==="cmd"?U1(t,.15):t}function If(l){const t=l.split(":");return t.length>=3?`${t[1]} ${t[2]}`:l}function yg(l){return l.includes(":cmd.")}const wg=["pos","vel","torque","kp","kd","t_mos","t_rotor"];function U1(l,t){const r=l.replace("#",""),i=Math.min(255,Math.round(parseInt(r.slice(0,2),16)+255*t)),o=Math.min(255,Math.round(parseInt(r.slice(2,4),16)+255*t)),u=Math.min(255,Math.round(parseInt(r.slice(4,6),16)+255*t));return`rgb(${i},${o},${u})`}function Rl(l,t=3){return l==null||Number.isNaN(l)?"—":l.toFixed(t)}const Sg=2e3;function V1(l,t){const r=l.map(c=>Pm(c,t)),i=new Set;for(const c of r)for(let d=0;dc-d);if(o.length>Sg){const c=Math.ceil(o.length/Sg);o=o.filter((d,p)=>p%c===0)}const u=[o];for(const c of r){const d=new Array(o.length).fill(null);let p=0,m=null;for(let w=0;wk.ensurePlot),r=gn(k=>k.removeSignalFromPlot),i=gn(k=>k.setPlotConfig),o=gn(k=>k.plotConfigs[l]),u=gn(k=>k.signals);j.useEffect(()=>{t(l)},[l,t]);const c=(o==null?void 0:o.signals)??[],d=(o==null?void 0:o.duration)??10,p=c.join("|"),{setNodeRef:m,isOver:w}=c0({id:`plot:${l}`,data:{panelId:l}}),v=j.useRef(null),x=j.useRef(null),z=j.useRef(0);j.useEffect(()=>{if(!v.current)return;const k=v.current,b=new Map(u.map(Z=>[Z.id,Z])),U=[{label:"t"},...c.map(Z=>{const G=b.get(Z),ee=G?ru(G):"#8b949e";return{label:If(Z),stroke:ee,width:1.5,dash:yg(Z)?[6,4]:void 0,points:{show:!1}}})],P={width:k.clientWidth||400,height:k.clientHeight||220,legend:{show:!1},series:U,cursor:{y:!1,points:{show:!0}},scales:{x:{time:!1}},axes:[{stroke:"#8b949e",grid:{stroke:"rgba(139,148,158,0.12)"},ticks:{stroke:"rgba(139,148,158,0.2)"},values:(Z,G)=>G.map(ee=>(ee-z.current).toFixed(1)+"s")},{stroke:"#8b949e",grid:{stroke:"rgba(139,148,158,0.12)"},ticks:{stroke:"rgba(139,148,158,0.2)"}}]},W=new Ln(P,[[],...c.map(()=>[])],k);x.current=W;const V=new ResizeObserver(()=>{W.setSize({width:k.clientWidth,height:k.clientHeight})});return V.observe(k),()=>{V.disconnect(),W.destroy(),x.current=null}},[p,u.length]),j.useEffect(()=>{if(!c.length)return;c.forEach(D1);let k=!1;return H1(c,1200).then(b=>{if(!k)for(const[U,P]of Object.entries(b))Lm(U,P)}),()=>{k=!0,c.forEach(T1)}},[p]),j.useEffect(()=>{let k=0;const b=()=>{const U=x.current;if(U&&c.length){let P=0;for(const V of c){const Z=Pm(V);Z.t.length&&(P=Math.max(P,Z.t[Z.t.length-1]))}z.current=P;const W=V1(c,P-d);U.setData(W,!1),U.setScale("x",{min:P-d,max:P})}k=requestAnimationFrame(b)};return k=requestAnimationFrame(b),()=>cancelAnimationFrame(k)},[p,d]);const R=j.useMemo(()=>new Map(u.map(k=>[k.id,k])),[u]);return B.jsxs("div",{className:"panel plot-panel",ref:m,children:[B.jsxs("div",{className:"plot-toolbar",children:[B.jsx("span",{className:"muted",children:"window"}),B.jsx("select",{value:d,onChange:k=>i(l,{duration:Number(k.target.value)}),children:[5,10,20,30,60].map(k=>B.jsxs("option",{value:k,children:[k,"s"]},k))}),B.jsx("div",{className:"legend",children:c.map(k=>{const b=R.get(k);return B.jsxs("span",{className:"legend-chip",style:{borderColor:b?ru(b):"#555"},children:[B.jsx("span",{className:"legend-swatch",style:{background:b?ru(b):"#555",borderStyle:yg(k)?"dashed":"solid"}}),If(k),B.jsx("button",{className:"legend-x",onClick:()=>r(l,k),children:"×"})]},k)})})]}),B.jsx("div",{className:"plot-host"+(w?" drop-over":""),ref:v,children:c.length===0&&B.jsx("div",{className:"drop-hint",children:"Drag signals here to plot — drop cmd onto fb to overlay"})})]})}const yf=[["pos","cmd p"],["vel","cmd v"],["kp","kp"],["kd","kd"],["torque","cmd τ"]],wf=[["pos","act p"],["vel","act v"],["torque","act τ"],["t_mos","Tmos"],["t_rotor","Trot"]];function G1(){const l=gn(t=>t.motors);return B.jsx("div",{className:"panel table-panel",children:B.jsxs("table",{className:"motor-table",children:[B.jsx("thead",{children:B.jsxs("tr",{children:[B.jsx("th",{children:"Motor"}),B.jsx("th",{children:"Mode"}),B.jsx("th",{children:"Status"}),yf.map(([t,r])=>B.jsx("th",{className:"cmd-col",children:r},"c"+t)),wf.map(([t,r])=>B.jsx("th",{children:r},"f"+t))]})}),B.jsxs("tbody",{children:[l.length===0&&B.jsx("tr",{children:B.jsx("td",{colSpan:3+yf.length+wf.length,className:"muted center",children:"Waiting for traffic…"})}),l.map(t=>B.jsxs("tr",{children:[B.jsxs("td",{className:"mono",children:["m",t.motorId]}),B.jsx("td",{className:"muted",children:t.mode||"—"}),B.jsx("td",{children:B.jsx("span",{className:"status-pill "+(t.status==="ENABLED"?"ok":t.status==="DISABLED"?"off":"warn"),children:t.status||"—"})}),yf.map(([r])=>B.jsx("td",{className:"mono cmd-col",children:Rl(t.cmd[r],r==="kp"?0:3)},"c"+r)),wf.map(([r])=>B.jsx("td",{className:"mono",children:Rl(t.fb[r],r.startsWith("t_")?1:3)},"f"+r))]},`${t.bus}:${t.motorId}`))]})]})})}function Sf({label:l,cmd:t,act:r,unit:i,digits:o=2}){return B.jsxs("div",{className:"metric",children:[B.jsxs("div",{className:"metric-label",children:[l," ",B.jsx("span",{className:"muted",children:i})]}),B.jsxs("div",{className:"metric-values",children:[B.jsx("span",{className:"metric-act",children:Rl(r,o)}),t!==void 0&&B.jsxs("span",{className:"metric-cmd",children:["⌖ ",Rl(t,o)]})]})]})}function Y1(){const l=gn(r=>r.motors),t=gn(r=>r.motorTypes);return B.jsxs("div",{className:"panel cards-panel",children:[l.length===0&&B.jsx("div",{className:"muted center pad",children:"Waiting for traffic…"}),B.jsx("div",{className:"cards-grid",children:l.map(r=>B.jsxs("div",{className:"motor-card",children:[B.jsxs("div",{className:"motor-card-head",children:[B.jsxs("span",{className:"mono strong",children:["Motor ",r.motorId]}),B.jsx("span",{className:"status-pill "+(r.status==="ENABLED"?"ok":r.status==="DISABLED"?"off":"warn"),children:r.status||"—"})]}),B.jsxs("div",{className:"motor-card-sub",children:[B.jsx("span",{className:"muted",children:r.mode||"—"}),t.length>0&&B.jsxs("select",{className:"type-select",defaultValue:"",onChange:i=>i.target.value&&j1(r.motorId,i.target.value),title:"Override motor type used to scale this motor's values",children:[B.jsx("option",{value:"",children:"set type…"}),t.map(i=>B.jsx("option",{value:i,children:i},i))]})]}),B.jsx(Sf,{label:"Position",unit:"rad",cmd:r.cmd.pos,act:r.fb.pos,digits:3}),B.jsx(Sf,{label:"Velocity",unit:"rad/s",cmd:r.cmd.vel,act:r.fb.vel,digits:2}),B.jsx(Sf,{label:"Torque",unit:"Nm",cmd:r.cmd.torque,act:r.fb.torque,digits:2}),B.jsxs("div",{className:"temp-row",children:[B.jsxs("span",{children:["MOS ",Rl(r.fb.t_mos,1),"°"]}),B.jsxs("span",{children:["Rotor ",Rl(r.fb.t_rotor,1),"°"]})]})]},`${r.bus}:${r.motorId}`))})]})}function K1(l,t,r){const i=new Array(l);return new Proxy(i,{get(o,u,c){if(typeof u=="string"){const d=u.charCodeAt(0);if(d>=48&&d<=57){const p=+u;if(Number.isInteger(p)&&p>=0&&pi[w]!==m))&&(i=d,o=t(...d),r!=null&&r.onChange&&!(u&&r.skipInitialOnChange)&&r.onChange(o),u=!1),o}return c.updateDeps=d=>{i=d},c}function xg(l,t){if(l===void 0)throw new Error("Unexpected undefined");return l}const Q1=(l,t)=>Math.abs(l-t)<1.01,X1=(l,t,r)=>{let i;return function(...o){l.clearTimeout(i),i=l.setTimeout(()=>t.apply(this,o),r)}};let mo;const xf=()=>{if(mo!==void 0)return mo;if(typeof navigator>"u")return mo=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return mo=!0;const l=navigator.maxTouchPoints;return mo=navigator.platform==="MacIntel"&&l!==void 0&&l>0},_g=l=>{const{offsetWidth:t,offsetHeight:r}=l;return{width:t,height:r}},q1=l=>l,J1=l=>{const t=Math.max(l.startIndex-l.overscan,0),i=Math.min(l.endIndex+l.overscan,l.count-1)-t+1,o=new Array(i);for(let u=0;u{const r=l.scrollElement;if(!r)return;const i=l.targetWindow;if(!i)return;const o=c=>{const{width:d,height:p}=c;t({width:Math.round(d),height:Math.round(p)})};if(o(_g(r)),!i.ResizeObserver)return()=>{};const u=new i.ResizeObserver(c=>{const d=()=>{const p=c[0];if(p!=null&&p.borderBoxSize){const m=p.borderBoxSize[0];if(m){o({width:m.inlineSize,height:m.blockSize});return}}o(_g(r))};l.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(d):d()});return u.observe(r,{box:"border-box"}),()=>{u.unobserve(r)}},hu={passive:!0},eS=typeof window>"u"?!0:"onscrollend"in window,tS=(l,t,r)=>{const i=l.scrollElement;if(!i)return;const o=l.targetWindow;if(!o)return;const u=l.options.useScrollendEvent&&eS;let c=0;const d=u?null:X1(o,()=>t(c,!1),l.options.isScrollingResetDelay),p=v=>()=>{c=r(i),d==null||d(),t(c,v)},m=p(!0),w=p(!1);return i.addEventListener("scroll",m,hu),u&&i.addEventListener("scrollend",w,hu),()=>{i.removeEventListener("scroll",m),u&&i.removeEventListener("scrollend",w)}},nS=(l,t)=>tS(l,t,r=>{const{horizontal:i,isRtl:o}=l.options;return i?r.scrollLeft*(o&&-1||1):r.scrollTop}),rS=(l,t,r)=>{if(r.options.useCachedMeasurements){const i=r.indexFromElement(l),o=r.options.getItemKey(i);return r.itemSizeCache.get(o)??r.options.estimateSize(i)}if(t!=null&&t.borderBoxSize){const i=t.borderBoxSize[0];if(i)return Math.round(i[r.options.horizontal?"inlineSize":"blockSize"])}if(!t){const i=r.indexFromElement(l),o=r.options.getItemKey(i),u=r.itemSizeCache.get(o);if(u!==void 0)return u}return l[r.options.horizontal?"offsetWidth":"offsetHeight"]},iS=(l,{adjustments:t=0,behavior:r},i)=>{var o,u;(u=(o=i.scrollElement)==null?void 0:o.scrollTo)==null||u.call(o,{[i.options.horizontal?"left":"top"]:l+t,behavior:r})},sS=iS;class lS{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var r,i,o;return((o=(i=(r=this.targetWindow)==null?void 0:r.performance)==null?void 0:i.now)==null?void 0:o.call(i))??Date.now()},this.observer=(()=>{let r=null;const i=()=>r||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:r=new this.targetWindow.ResizeObserver(o=>{o.forEach(u=>{const c=()=>{const d=u.target,p=this.indexFromElement(d);if(!d.isConnected){this.observer.unobserve(d);for(const[m,w]of this.elementsCache)if(w===d){this.elementsCache.delete(m);break}return}this.shouldMeasureDuringScroll(p)&&this.resizeItem(p,this.options.measureElement(d,u,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(c):c()})}));return{disconnect:()=>{var o;(o=i())==null||o.disconnect(),r=null},observe:o=>{var u;return(u=i())==null?void 0:u.observe(o,{box:"border-box"})},unobserve:o=>{var u;return(u=i())==null?void 0:u.unobserve(o)}}})(),this.range=null,this.setOptions=r=>{var i,o;const u={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:q1,rangeExtractor:J1,onChange:()=>{},measureElement:rS,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const x in r){const z=r[x];z!==void 0&&(u[x]=z)}const c=this.options;let d=null,p=null,m=!1;if(c!==void 0&&c.enabled&&u.enabled&&u.anchorTo==="end"&&this.scrollElement!==null){const x=c.count,z=u.count,R=this.getMeasurements(),k=x>0?((i=R[0])==null?void 0:i.key)??c.getItemKey(0):null,b=x>0?((o=R[x-1])==null?void 0:o.key)??c.getItemKey(x-1):null;if(z!==x||x>0&&z>0&&(u.getItemKey(0)!==k||u.getItemKey(z-1)!==b)){m=!0;const W=x>0?this.getVirtualItemForOffset(this.getScrollOffset())??R[0]:null;W&&(d=[W.key,this.getScrollOffset()-W.start]);const V=u.followOnAppend===!0?"auto":u.followOnAppend||null;V&&z>x&&this.isAtEnd(c.scrollEndThreshold)&&(x===0||u.getItemKey(z-1)!==b)&&(p=V)}}this.options=u,m&&(this.pendingMin=0,this.itemSizeCacheVersion++);let w=!1,v=0;if(d&&this.scrollOffset!==null){const[x,z]=d,R=this.getMeasurements(),{count:k,getItemKey:b}=this.options;let U=0;for(;U{var i,o;(o=(i=this.options).onChange)==null||o.call(i,this,r)},this.maybeNotify=ml(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),r=>{this.notify(r)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(r=>r()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var r;const i=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==i){if(this.cleanup(),!i){this.maybeNotify();return}if(this.scrollElement=i,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((r=this.scrollElement)==null?void 0:r.window)??null,this.elementsCache.forEach(u=>{this.observer.observe(u)}),this.unsubs.push(this.options.observeElementRect(this,u=>{this.scrollRect=u,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(u,c)=>{this._intendedScrollOffset!==null&&Math.abs(u-this._intendedScrollOffset)<1.5&&(u=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=c?this.getScrollOffset(){this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},d=()=>{this._iosTouching=!1,!(!xf()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};u.addEventListener("touchstart",c,hu),u.addEventListener("touchend",d,hu),this.unsubs.push(()=>{u.removeEventListener("touchstart",c),u.removeEventListener("touchend",d),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const o=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,o&&this.scrollElement&&this.options.enabled){const[u,c,d,p]=o;u!==null&&!d&&(xf()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?p!==0&&(this._iosDeferredAdjustment+=p):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),d&&this.scrollToEnd({behavior:d})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const r=this.getScrollOffset(),i=this.getMaxScrollOffset();if(r<0||r>i)return;const o=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(r,{adjustments:this.scrollAdjustments+=o,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(r,i)=>{const o=new Map,u=new Map;for(let c=i-1;c>=0;c--){const d=r[c];if(o.has(d.lane))continue;const p=u.get(d.lane);if(p==null||d.end>p.end?u.set(d.lane,d):d.endc.end===d.end?c.index-d.index:c.end-d.end)[0]:void 0},this.getMeasurementOptions=ml(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(r,i,o,u,c,d,p)=>(this.prevLanes!==void 0&&this.prevLanes!==d&&(this.lanesChangedFlag=!0),this.prevLanes=d,this.pendingMin=null,{count:r,paddingStart:i,scrollMargin:o,getItemKey:u,enabled:c,lanes:d,laneAssignmentMode:p}),{key:!1}),this.getMeasurements=ml(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:r,paddingStart:i,scrollMargin:o,getItemKey:u,enabled:c,lanes:d,laneAssignmentMode:p},m)=>{const w=this.itemSizeCache;if(!c)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>r)for(const R of this.laneAssignments.keys())R>=r&&this.laneAssignments.delete(R);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(R=>{this.itemSizeCache.set(R.key,R.size)}));const v=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===r&&(this.lanesSettling=!1),d===1){const R=this.options.gap,k=r*2;let b=this._flatMeasurements;if(!b||b.length0&&W.set(b.subarray(0,v*2)),b=W,this._flatMeasurements=b}let U;if(v===0)U=i+o;else{const W=v-1;U=b[W*2]+b[W*2+1]+R}for(let W=v;W1){U=b;const ee=z[U],re=ee!==void 0?x[ee]:void 0;P=re?re.end+this.options.gap:i+o}else{const ee=this.options.lanes===1?x[R-1]:this.getFurthestMeasurement(x,R);P=ee?ee.end+this.options.gap:i+o,U=ee?ee.lane:R%this.options.lanes,this.options.lanes>1&&W&&this.laneAssignments.set(R,U)}const V=w.get(k),Z=typeof V=="number"?V:this.options.estimateSize(R),G=P+Z;x[R]={index:R,start:P,size:Z,end:G,key:k,lane:U},z[U]=R}return this.measurementsCache=x,x},{key:!1,debug:()=>this.options.debug}),this.calculateRange=ml(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(r,i,o,u)=>this.range=r.length>0&&i>0?oS({measurements:r,outerSize:i,scrollOffset:o,lanes:u,flat:u===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=ml(()=>{let r=null,i=null;const o=this.calculateRange();return o&&(r=o.startIndex,i=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,r,i]),[this.options.rangeExtractor,this.options.overscan,this.options.count,r,i]},(r,i,o,u,c)=>u===null||c===null?[]:r({startIndex:u,endIndex:c,overscan:i,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=r=>{const i=this.options.indexAttribute,o=r.getAttribute(i);return o?parseInt(o,10):(console.warn(`Missing attribute name '${i}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=r=>{var i;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const o=this.scrollState.index??((i=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:i.index);if(o!==void 0&&this.range){const u=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),c=Math.max(0,o-u),d=Math.min(this.options.count-1,o+u);return r>=c&&r<=d}return!0},this.measureElement=r=>{if(!r){this.elementsCache.forEach((c,d)=>{c.isConnected||(this.observer.unobserve(c),this.elementsCache.delete(d))});return}const i=this.indexFromElement(r),o=this.options.getItemKey(i),u=this.elementsCache.get(o);u!==r&&(u&&this.observer.unobserve(u),this.observer.observe(r),this.elementsCache.set(o,r)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(i)&&this.resizeItem(i,this.options.measureElement(r,void 0,this))},this.resizeItem=(r,i)=>{var o,u;if(r<0||r>=this.options.count)return;let c,d,p;const m=this._flatMeasurements;if(this.options.lanes===1&&m!==null)p=this.options.getItemKey(r),d=m[r*2],c=m[r*2+1];else{const x=this.measurementsCache[r];if(!x)return;p=x.key,d=x.start,c=x.size}const w=this.itemSizeCache.get(p)??c,v=i-w;if(v!==0){const x=this.options.anchorTo==="end"&&((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,z=x?this.getTotalSize():0,R=((u=this.scrollState)==null?void 0:u.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[r]??{index:r,key:p,start:d,size:c,end:d+c,lane:0},v,this):d[this.getVirtualIndexes(),this.getMeasurements()],(r,i)=>{const o=[];for(let u=0,c=r.length;uthis.options.debug}),this.getVirtualItemForOffset=r=>{const i=this.getMeasurements();if(i.length===0)return;const o=this._flatMeasurements,u=this.options.lanes===1&&o!=null,c=Hm(0,i.length-1,u?d=>o[d*2]:d=>xg(i[d]).start,r);return xg(i[c])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const r=this.scrollElement.document.documentElement;return this.options.horizontal?r.scrollWidth-this.scrollElement.innerWidth:r.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(r=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=r,this.getOffsetForAlignment=(r,i,o=0)=>{if(!this.scrollElement)return 0;const u=this.getSize(),c=this.getScrollOffset();i==="auto"&&(i=r>=c+u?"end":"start"),i==="center"?r+=(o-u)/2:i==="end"&&(r-=u);const d=this.getMaxScrollOffset();return Math.max(Math.min(d,r),0)},this.getOffsetForIndex=(r,i="auto")=>{r=Math.max(0,Math.min(r,this.options.count-1));const o=this.getSize(),u=this.getScrollOffset(),c=this.measurementsCache[r];if(!c)return;if(i==="auto")if(c.end>=u+o-this.options.scrollPaddingEnd)i="end";else if(c.start<=u+this.options.scrollPaddingStart)i="start";else return[u,i];if(i==="end"&&r===this.options.count-1)return[this.getMaxScrollOffset(),i];const d=i==="end"?c.end+this.options.scrollPaddingEnd:c.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(d,i,c.size),i]},this.scrollToOffset=(r,{align:i="start",behavior:o="auto"}={})=>{const u=this.getOffsetForAlignment(r,i),c=this.now();this.scrollState={index:null,align:i,behavior:o,startedAt:c,lastTargetOffset:u,stableFrames:0},this._scrollToOffset(u,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(r,{align:i="auto",behavior:o="auto"}={})=>{r=Math.max(0,Math.min(r,this.options.count-1));const u=this.getOffsetForIndex(r,i);if(!u)return;const[c,d]=u,p=this.now();this.scrollState={index:r,align:d,behavior:o,startedAt:p,lastTargetOffset:c,stableFrames:0},this._scrollToOffset(c,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(r,{behavior:i="auto"}={})=>{const o=this.getScrollOffset()+r,u=this.now();this.scrollState={index:null,align:"start",behavior:i,startedAt:u,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:r="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:r});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:r})},this.getTotalSize=()=>{var r;const i=this.getMeasurements();let o;if(i.length===0)o=this.options.paddingStart;else if(this.options.lanes===1){const u=i.length-1,c=this._flatMeasurements;c!=null?o=c[u*2]+c[u*2+1]:o=((r=i[u])==null?void 0:r.end)??0}else{const u=Array(this.options.lanes).fill(null);let c=i.length-1;for(;c>=0&&u.some(d=>d===null);){const d=i[c];u[d.lane]===null&&(u[d.lane]=d.end),c--}o=Math.max(...u.filter(d=>d!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const r=[];if(this.itemSizeCache.size===0)return r;const i=this.getMeasurements();for(const o of i)o&&this.itemSizeCache.has(o.key)&&r.push({index:o.index,key:o.key,start:o.start,size:o.size,end:o.end,lane:o.lane});return r},this._scrollToOffset=(r,{adjustments:i,behavior:o})=>{this._intendedScrollOffset=r+(i??0),this.options.scrollToFn(r,{behavior:o,adjustments:i},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}applyScrollAdjustment(t,r){t!==0&&(xf()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=t:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:r}))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const i=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,o=i?i[0]:this.scrollState.lastTargetOffset,u=1,c=o!==this.scrollState.lastTargetOffset;if(!c&&Q1(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=u){this.getScrollOffset()!==o&&this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,c){const d=this.getSize()||600,p=Math.abs(o-this.getScrollOffset()),m=this.scrollState.behavior==="smooth"&&p>d;this.scrollState.lastTargetOffset=o,m||(this.scrollState.behavior="auto"),this._scrollToOffset(o,{adjustments:void 0,behavior:m?"smooth":"auto"})}this.scheduleScrollReconcile()}}const Hm=(l,t,r,i)=>{for(;l<=t;){const o=(l+t)/2|0,u=r(o);if(ui)t=o-1;else return o}return l>0?l-1:0};function oS({measurements:l,outerSize:t,scrollOffset:r,lanes:i,flat:o}){const u=l.length-1,c=o?w=>o[w*2]:w=>l[w].start,d=o?w=>o[w*2]+o[w*2+1]:w=>l[w].end;if(l.length<=i)return{startIndex:0,endIndex:u};let p=Hm(0,u,c,r),m=p;if(i===1)for(;m1){const w=Array(i).fill(0);for(;mx=0&&v.some(x=>x>=r);){const x=l[p];v[x.lane]=x.start,p--}p=Math.max(0,p-p%i),m=Math.min(u,m+(i-1-m%i))}return{startIndex:p,endIndex:m}}const _f=typeof document<"u"?j.useLayoutEffect:j.useEffect;function aS({useFlushSync:l=!0,directDomUpdates:t=!1,directDomUpdatesMode:r="transform",...i}){const o=j.useReducer(m=>m+1,0)[1],u=j.useRef({enabled:t,mode:r,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});u.current.enabled=t,u.current.mode=r;const c=m=>{const w=u.current;if(!w.enabled||!w.container)return;const v=m.getTotalSize();if(v!==w.lastSize){w.lastSize=v;const U=m.options.horizontal?"width":"height";w.container.style[U]=`${v}px`}const x=!!m.options.horizontal,z=w.mode==="transform",R=x?"left":"top",k=m.options.scrollMargin,b=m.getVirtualItems();for(const U of b){const P=U.start-k,W=m.elementsCache.get(U.key);W&&w.lastPositions.get(W)!==P&&(w.lastPositions.set(W,P),z?W.style.transform=x?`translate3d(${P}px, 0, 0)`:`translate3d(0, ${P}px, 0)`:W.style[R]=`${P}px`)}},d={...i,onChange:(m,w)=>{var v;const x=u.current;let z=!0;if(x.enabled){c(m);const R=m.range,k=x.prevRange;z=!k||k.isScrolling!==m.isScrolling||k.startIndex!==(R==null?void 0:R.startIndex)||k.endIndex!==(R==null?void 0:R.endIndex),z&&(x.prevRange=R?{startIndex:R.startIndex,endIndex:R.endIndex,isScrolling:m.isScrolling}:null)}z&&(l&&w?bs.flushSync(o):o()),(v=i.onChange)==null||v.call(i,m,w)}},[p]=j.useState(()=>{const m=new lS(d);return Object.assign(m,{containerRef:w=>{const v=u.current;if(v.container=w,v.lastSize=null,w&&v.enabled){const x=m.getTotalSize();v.lastSize=x;const z=m.options.horizontal?"width":"height";w.style[z]=`${x}px`}}})});return p.setOptions(d),_f(()=>p._didMount(),[]),_f(()=>p._willUpdate()),_f(()=>{c(p)}),p}function uS(l){return aS({observeElementRect:Z1,observeElementOffset:nS,scrollToFn:sS,...l})}const cS={pos:"p",vel:"v",torque:"τ",kp:"kp",kd:"kd",vel_limit:"vlim",torque_limit:"τlim",t_mos:"Tm",t_rotor:"Tr"},fS=["pos","vel","torque","kp","kd","t_mos","t_rotor"];function dS(l){const t=[];for(const r of fS)r in l.fields&&t.push(`${cS[r]||r} ${l.fields[r].toFixed(2)}`);return t.join(" ")||l.note||""}function hS(l){const t=new Date(l*1e3),r=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0"),o=String(t.getSeconds()).padStart(2,"0"),u=String(Math.floor(l%1*1e3)).padStart(3,"0");return`${r}:${i}:${o}.${u}`}function pS(){const[,l]=j.useState(0),[t,r]=j.useState(!1),i=j.useRef(null),o=j.useRef([]);j.useEffect(()=>{gg(!0);const d=L1(()=>{t||(o.current=O1(),l(p=>p+1))});return()=>{gg(!1),d()}},[t]);const u=o.current,c=uS({count:u.length,getScrollElement:()=>i.current,estimateSize:()=>22,overscan:12});return j.useEffect(()=>{!t&&u.length&&c.scrollToIndex(u.length-1)},[u.length,t,c]),B.jsxs("div",{className:"panel rawlog-panel",children:[B.jsxs("div",{className:"rawlog-toolbar",children:[B.jsx("button",{className:t?"btn small":"btn small active",onClick:()=>r(d=>!d),children:t?"Resume":"Pause"}),B.jsxs("span",{className:"muted",children:[u.length," frames"]})]}),B.jsxs("div",{className:"rawlog-body",ref:i,children:[B.jsxs("div",{className:"rawlog-head",children:[B.jsx("span",{className:"c-t",children:"time"}),B.jsx("span",{className:"c-arb",children:"arb"}),B.jsx("span",{className:"c-m",children:"motor"}),B.jsx("span",{className:"c-k",children:"kind"}),B.jsx("span",{className:"c-f",children:"decoded"}),B.jsx("span",{className:"c-r",children:"raw"})]}),B.jsx("div",{style:{height:c.getTotalSize(),position:"relative"},children:c.getVirtualItems().map(d=>{const p=u[d.index];return B.jsxs("div",{className:"rawlog-row k-"+p.kind,style:{transform:`translateY(${d.start}px)`},children:[B.jsx("span",{className:"c-t mono",children:hS(p.t)}),B.jsxs("span",{className:"c-arb mono",children:["0x",p.arb.toString(16).toUpperCase()]}),B.jsxs("span",{className:"c-m mono",children:["m",p.motorId]}),B.jsx("span",{className:"c-k",children:p.mode||p.kind}),B.jsx("span",{className:"c-f mono",children:dS(p)}),B.jsx("span",{className:"c-r mono dim",children:p.raw})]},p.seq)})})]})]})}const Fm=[{kind:"plot",title:"Plot",icon:"〜",description:"Time-series chart; drag signals onto it (cmd over fb to overlay).",render:l=>B.jsx($1,{panelId:l})},{kind:"table",title:"Motor Table",icon:"▦",description:"One row per motor: commanded vs actual.",render:()=>B.jsx(G1,{})},{kind:"cards",title:"Motor Cards",icon:"▢",description:"Per-motor cards/gauges with big readouts.",render:()=>B.jsx(Y1,{})},{kind:"rawlog",title:"Raw CAN Log",icon:"≣",description:"Scrolling decoded frame log.",render:()=>B.jsx(pS,{})}],gS=Object.fromEntries(Fm.map(l=>[l.kind,l])),jm="damiao.monitor.theme";function Wm(){return localStorage.getItem(jm)==="dark"?"dark":"light"}function Bm(l){document.documentElement.setAttribute("data-theme",l)}function mS(l){try{localStorage.setItem(jm,l)}catch{}Bm(l)}function vS(){Bm(Wm())}function yS(){const l=gn(p=>p.connected),t=gn(p=>p.status),r=Eo(p=>p.addWidget),i=Eo(p=>p.resetWidgets),[o,u]=j.useState(Wm()),c=()=>i(),d=()=>{const p=o==="light"?"dark":"light";mS(p),u(p)};return B.jsxs("header",{className:"toolbar",children:[B.jsxs("div",{className:"brand",children:[B.jsx("span",{className:"brand-dot"}),"DaMiao ",B.jsx("span",{className:"brand-sub",children:"Passive Monitor"})]}),B.jsxs("div",{className:"conn",children:[B.jsx("span",{className:"dot "+(l?"on":"off")}),B.jsx("span",{className:"mono",children:t!=null&&t.demo?"demo":(t==null?void 0:t.channel)||"—"}),t&&!t.demo&&B.jsx("span",{className:"badge "+(t.listenOnly?"ok":"warn"),title:"hardware listen-only",children:t.listenOnly?"listen-only":"rx (no TX)"}),(t==null?void 0:t.error)&&B.jsx("span",{className:"badge err",title:t.error,children:"bus error"}),t&&B.jsxs("span",{className:"muted small",children:[t.framesSeen.toLocaleString()," frames · +",t.feedbackOffset," fb"]})]}),B.jsx("div",{className:"spacer"}),B.jsxs("div",{className:"actions",children:[Fm.map(p=>B.jsxs("button",{className:"btn",title:p.description,onClick:()=>r(p.kind),children:[B.jsx("span",{className:"btn-icon",children:p.icon})," ",p.title]},p.kind)),B.jsx("button",{className:"btn ghost",onClick:d,title:`Switch to ${o==="light"?"dark":"light"} mode`,children:o==="light"?"☾":"☀"}),B.jsx("button",{className:"btn ghost",onClick:c,children:"Reset"})]})]})}function wS({sig:l}){const{attributes:t,listeners:r,setNodeRef:i,isDragging:o}=l0({id:`sig:${l.id}`,data:{signalId:l.id}}),u=ru(l);return B.jsxs("div",{ref:i,className:"sig-chip"+(o?" dragging":""),...r,...t,title:l.id,children:[B.jsx("span",{className:"sig-swatch",style:{background:u,borderStyle:l.source==="cmd"?"dashed":"solid"}}),B.jsxs("span",{className:"sig-name",children:[l.source,".",l.field]}),l.unit&&B.jsx("span",{className:"sig-unit",children:l.unit})]})}function SS(l){return[...l].sort((t,r)=>{if(t.source!==r.source)return t.source==="cmd"?-1:1;const i=wg.indexOf(t.field),o=wg.indexOf(r.field);return(i<0?99:i)-(o<0?99:o)})}function xS(){const l=gn(u=>u.signals),t=gn(u=>u.status),[r,i]=j.useState(""),o=j.useMemo(()=>{const u=new Map;for(const c of l){if(r&&!c.id.toLowerCase().includes(r.toLowerCase()))continue;const d=u.get(c.motorId)||[];d.push(c),u.set(c.motorId,d)}return Array.from(u.entries()).sort((c,d)=>c[0]-d[0])},[l,r]);return B.jsxs("aside",{className:"sidebar",children:[B.jsxs("div",{className:"sidebar-head",children:[B.jsx("div",{className:"sidebar-title",children:"Signals"}),B.jsx("input",{className:"filter",placeholder:"filter…",value:r,onChange:u=>i(u.target.value)})]}),B.jsxs("div",{className:"sidebar-body",children:[o.length===0&&B.jsx("div",{className:"muted pad",children:t!=null&&t.error?"Bus error — see top bar.":"No signals yet. Start a controller on the bus (or run --demo)."}),o.map(([u,c])=>B.jsxs("div",{className:"motor-group",children:[B.jsxs("div",{className:"motor-group-title",children:["Motor ",u]}),B.jsx("div",{className:"chips",children:SS(c).map(d=>B.jsx(wS,{sig:d},d.id))})]},u))]}),B.jsxs("div",{className:"sidebar-foot muted",children:["Drag a signal onto a plot. Drop ",B.jsx("b",{children:"cmd"})," onto its ",B.jsx("b",{children:"fb"})," plot to overlay."]})]})}function _S(l,t,r,i,o){const u=(...c)=>(console.warn("gridstack.js: Function `"+r+"` is deprecated in "+o+" and has been replaced with `"+i+"`. It will be **removed** in a future release"),t.apply(l,c));return u.prototype=t.prototype,u}class A{static getElements(t,r=document){if(typeof t=="string"){const i="getElementById"in r?r:void 0;if(i&&!isNaN(+t[0])){const u=i.getElementById(t);return u?[u]:[]}let o=r.querySelectorAll(t);return!o.length&&t[0]!=="."&&t[0]!=="#"&&(o=r.querySelectorAll("."+t),o.length||(o=r.querySelectorAll("#"+t))),Array.from(o)}return[t]}static getElement(t,r=document){if(typeof t=="string"){const i="getElementById"in r?r:void 0;if(!t.length)return null;if(i&&t[0]==="#")return i.getElementById(t.substring(1));if(t[0]==="#"||t[0]==="."||t[0]==="[")return r.querySelector(t);if(i&&!isNaN(+t[0]))return i.getElementById(t);let o=r.querySelector(t);return i&&!o&&(o=i.getElementById(t)),o||(o=r.querySelector("."+t)),o}return t}static lazyLoad(t){var r,i;return t.lazyLoad||((i=(r=t.grid)==null?void 0:r.opts)==null?void 0:i.lazyLoad)&&t.lazyLoad!==!1}static createDiv(t,r){const i=document.createElement("div");return t.forEach(o=>{o&&i.classList.add(o)}),r==null||r.appendChild(i),i}static shouldSizeToContent(t,r=!1){return(t==null?void 0:t.grid)&&(r?t.sizeToContent===!0||t.grid.opts.sizeToContent===!0&&t.sizeToContent===void 0:!!t.sizeToContent||t.grid.opts.sizeToContent&&t.sizeToContent!==!1)}static isIntercepted(t,r){return!(t.y>=r.y+r.h||t.y+t.h<=r.y||t.x+t.w<=r.x||t.x>=r.x+r.w)}static isTouching(t,r){return A.isIntercepted(t,{x:r.x-.5,y:r.y-.5,w:r.w+1,h:r.h+1})}static areaIntercept(t,r){const i=t.x>r.x?t.x:r.x,o=t.x+t.wr.y?t.y:r.y,c=t.y+t.h{const c=r*((o.y??1e4)-(u.y??1e4));return c===0?r*((o.x??1e4)-(u.x??1e4)):c})}static find(t,r){return r?t.find(i=>i.id===r):void 0}static createStylesheet(t,r,i){const o=document.createElement("style"),u=i==null?void 0:i.nonce;return u&&(o.nonce=u),o.setAttribute("type","text/css"),o.setAttribute("gs-style-id",t),o.styleSheet?o.styleSheet.cssText="":o.appendChild(document.createTextNode("")),r?r.insertBefore(o,r.firstChild):(r=document.getElementsByTagName("head")[0],r.appendChild(o)),o}static removeStylesheet(t,r){const o=(r||document).querySelector("STYLE[gs-style-id="+t+"]");o&&o.parentNode&&o.remove()}static addCSSRule(t,r,i){t.textContent+=`${r} { ${i} } `}static toBool(t){return typeof t=="boolean"?t:typeof t=="string"?(t=t.toLowerCase(),!(t===""||t==="no"||t==="false"||t==="0")):!!t}static toNumber(t){return t===null||t.length===0?void 0:Number(t)}static parseHeight(t){let r,i="px";if(typeof t=="string")if(t==="auto"||t==="")r=0;else{const o=t.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!o)throw new Error(`Invalid height val = ${t}`);i=o[2]||"px",r=parseFloat(o[1])}else r=t;return{h:r,unit:i}}static defaults(t,...r){return r.forEach(i=>{for(const o in i){if(!i.hasOwnProperty(o))return;t[o]===null||t[o]===void 0?t[o]=i[o]:typeof i[o]=="object"&&typeof t[o]=="object"&&this.defaults(t[o],i[o])}}),t}static same(t,r){if(typeof t!="object")return t==r;if(typeof t!=typeof r||Object.keys(t).length!==Object.keys(r).length)return!1;for(const i in t)if(t[i]!==r[i])return!1;return!0}static copyPos(t,r,i=!1){return r.x!==void 0&&(t.x=r.x),r.y!==void 0&&(t.y=r.y),r.w!==void 0&&(t.w=r.w),r.h!==void 0&&(t.h=r.h),i&&(r.minW&&(t.minW=r.minW),r.minH&&(t.minH=r.minH),r.maxW&&(t.maxW=r.maxW),r.maxH&&(t.maxH=r.maxH)),t}static samePos(t,r){return t&&r&&t.x===r.x&&t.y===r.y&&(t.w||1)===(r.w||1)&&(t.h||1)===(r.h||1)}static sanitizeMinMax(t){t.minW||delete t.minW,t.minH||delete t.minH,t.maxW||delete t.maxW,t.maxH||delete t.maxH}static removeInternalAndSame(t,r){if(!(typeof t!="object"||typeof r!="object"))for(let i in t){const o=t[i],u=r[i];i[0]==="_"||o===u?delete t[i]:o&&typeof o=="object"&&u!==void 0&&(A.removeInternalAndSame(o,u),Object.keys(o).length||delete t[i])}}static removeInternalForSave(t,r=!0){for(let i in t)(i[0]==="_"||t[i]===null||t[i]===void 0)&&delete t[i];delete t.grid,r&&delete t.el,t.autoPosition||delete t.autoPosition,t.noResize||delete t.noResize,t.noMove||delete t.noMove,t.locked||delete t.locked,(t.w===1||t.w===t.minW)&&delete t.w,(t.h===1||t.h===t.minH)&&delete t.h}static throttle(t,r){let i=!1;return(...o)=>{i||(i=!0,setTimeout(()=>{t(...o),i=!1},r))}}static removePositioningStyles(t){const r=t.style;r.position&&r.removeProperty("position"),r.left&&r.removeProperty("left"),r.top&&r.removeProperty("top"),r.width&&r.removeProperty("width"),r.height&&r.removeProperty("height")}static getScrollElement(t){if(!t)return document.scrollingElement||document.documentElement;const r=getComputedStyle(t);return/(auto|scroll)/.test(r.overflow+r.overflowY)?t:this.getScrollElement(t.parentElement)}static updateScrollPosition(t,r,i){const o=t.getBoundingClientRect(),u=window.innerHeight||document.documentElement.clientHeight;if(o.top<0||o.bottom>u){const c=o.bottom-u,d=o.top,p=this.getScrollElement(t);if(p!==null){const m=p.scrollTop;o.top<0&&i<0?t.offsetHeight>u?p.scrollTop+=i:p.scrollTop+=Math.abs(d)>Math.abs(i)?i:d:i>0&&(t.offsetHeight>u?p.scrollTop+=i:p.scrollTop+=c>i?i:c),r.top+=p.scrollTop-m}}}static updateScrollResize(t,r,i){const o=this.getScrollElement(r),u=o.clientHeight,c=o===this.getScrollElement()?0:o.getBoundingClientRect().top,d=t.clientY-c,p=du-i;p?o.scrollBy({behavior:"smooth",top:d-i}):m&&o.scrollBy({behavior:"smooth",top:i-(u-d)})}static clone(t){return t==null||typeof t!="object"?t:t instanceof Array?[...t]:{...t}}static cloneDeep(t){const r=["parentGrid","el","grid","subGrid","engine"],i=A.clone(t);for(const o in i)i.hasOwnProperty(o)&&typeof i[o]=="object"&&o.substring(0,2)!=="__"&&!r.find(u=>u===o)&&(i[o]=A.cloneDeep(t[o]));return i}static cloneNode(t){const r=t.cloneNode(!0);return r.removeAttribute("id"),r}static appendTo(t,r){let i;typeof r=="string"?i=A.getElement(r):i=r,i&&i.appendChild(t)}static addElStyles(t,r){if(r instanceof Object)for(const i in r)r.hasOwnProperty(i)&&(Array.isArray(r[i])?r[i].forEach(o=>{t.style[i]=o}):t.style[i]=r[i])}static initEvent(t,r){const i={type:r.type},o={button:0,which:0,buttons:1,bubbles:!0,cancelable:!0,target:r.target?r.target:t.target};return["altKey","ctrlKey","metaKey","shiftKey"].forEach(u=>i[u]=t[u]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(u=>i[u]=t[u]),{...i,...o}}static simulateMouseEvent(t,r,i){const o=t,u=new MouseEvent(r,{bubbles:!0,composed:!0,cancelable:!0,view:window,detail:1,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY,ctrlKey:o.ctrlKey??!1,altKey:o.altKey??!1,shiftKey:o.shiftKey??!1,metaKey:o.metaKey??!1,button:0,relatedTarget:t.target});(i||t.target).dispatchEvent(u)}static getValuesFromTransformedElement(t){const r=document.createElement("div");A.addElStyles(r,{opacity:"0",position:"fixed",top:"0px",left:"0px",width:"1px",height:"1px",zIndex:"-999999"}),t.appendChild(r);const i=r.getBoundingClientRect();return t.removeChild(r),r.remove(),{xScale:1/i.width,yScale:1/i.height,xOffset:i.left,yOffset:i.top}}static swap(t,r,i){if(!t)return;const o=t[r];t[r]=t[i],t[i]=o}static canBeRotated(t){var r;return!(!t||t.w===t.h||t.locked||t.noResize||(r=t.grid)!=null&&r.opts.disableResize||t.minW&&t.minW===t.maxW||t.minH&&t.minH===t.maxH)}}class ai{constructor(t={}){this.addedNodes=[],this.removedNodes=[],this.defaultColumn=12,this.column=t.column||this.defaultColumn,this.column>this.defaultColumn&&(this.defaultColumn=this.column),this.maxRow=t.maxRow,this._float=t.float,this.nodes=t.nodes||[],this.onChange=t.onChange}batchUpdate(t=!0,r=!0){return!!this.batchMode===t?this:(this.batchMode=t,t?(this._prevFloat=this._float,this._float=!0,this.cleanNodes(),this.saveInitial()):(this._float=this._prevFloat,delete this._prevFloat,r&&this._packNodes(),this._notify()),this)}_useEntireRowArea(t,r){return(!this.float||this.batchMode&&!this._prevFloat)&&!this._hasLocked&&(!t._moving||t._skipDown||r.y<=t.y)}_fixCollisions(t,r=t,i,o={}){if(this.sortNodes(-1),i=i||this.collide(t,r),!i)return!1;if(t._moving&&!o.nested&&!this.float&&this.swap(t,i))return!0;let u=r;!this._loading&&this._useEntireRowArea(t,r)&&(u={x:0,w:this.column,y:r.y,h:r.h},i=this.collide(t,u,o.skip));let c=!1;const d={nested:!0,pack:!1};let p=0;for(;i=i||this.collide(t,u,o.skip);){if(p++>this.nodes.length*2)throw new Error("Infinite collide check");let m;if(i.locked||this._loading||t._moving&&!t._skipDown&&r.y>t.y&&!this.float&&(!this.collide(i,{...i,y:t.y},t)||!this.collide(i,{...i,y:r.y-i.h},t))){t._skipDown=t._skipDown||r.y>t.y;const w={...r,y:i.y+i.h,...d};m=this._loading&&A.samePos(t,w)?!0:this.moveNode(t,w),(i.locked||this._loading)&&m?A.copyPos(r,t):!i.locked&&m&&o.pack&&(this._packNodes(),r.y=i.y+i.h,A.copyPos(t,r)),c=c||m}else m=this.moveNode(i,{...i,y:r.y+r.h,skip:t,...d});if(!m)return c;i=void 0}return c}collide(t,r=t,i){const o=t._id,u=i==null?void 0:i._id;return this.nodes.find(c=>c._id!==o&&c._id!==u&&A.isIntercepted(c,r))}collideAll(t,r=t,i){const o=t._id,u=i==null?void 0:i._id;return this.nodes.filter(c=>c._id!==o&&c._id!==u&&A.isIntercepted(c,r))}directionCollideCoverage(t,r,i){if(!r.rect||!t._rect)return;const o=t._rect,u={...r.rect};u.y>o.y?(u.h+=u.y-o.y,u.y=o.y):u.h+=o.y-u.y,u.x>o.x?(u.w+=u.x-o.x,u.x=o.x):u.w+=o.x-u.x;let c,d=.5;for(let p of i){if(p.locked||!p._rect)break;const m=p._rect;let w=Number.MAX_VALUE,v=Number.MAX_VALUE;o.ym.y+m.h&&(w=(m.y+m.h-u.y)/m.h),o.xm.x+m.w&&(v=(m.x+m.w-u.x)/m.w);const x=Math.min(v,w);x>d&&(d=x,c=p)}return r.collide=c,c}cacheRects(t,r,i,o,u,c){return this.nodes.forEach(d=>d._rect={y:d.y*r+i,x:d.x*t+c,w:d.w*t-c-o,h:d.h*r-i-u}),this}swap(t,r){if(!r||r.locked||!t||t.locked)return!1;function i(){const u=r.x,c=r.y;return r.x=t.x,r.y=t.y,t.h!=r.h?(t.x=u,t.y=r.y+r.h):t.w!=r.w?(t.x=r.x+r.w,t.y=c):(t.x=u,t.y=c),t._dirty=r._dirty=!0,!0}let o;if(t.w===r.w&&t.h===r.h&&(t.x===r.x||t.y===r.y)&&(o=A.isTouching(t,r)))return i();if(o!==!1){if(t.w===r.w&&t.x===r.x&&(o||(o=A.isTouching(t,r)))){if(r.y{let m;c.locked||(c.autoPosition=!0,t==="list"&&d&&(m=p[d-1])),this.addNode(c,!1,m)}),o||delete this._inColumnResize,i||this.batchUpdate(!1),this}set float(t){this._float!==t&&(this._float=t||!1,t||this._packNodes()._notify())}get float(){return this._float||!1}sortNodes(t=1){return this.nodes=A.sort(this.nodes,t),this}_packNodes(){return this.batchMode?this:(this.sortNodes(),this.float?this.nodes.forEach(t=>{if(t._updating||t._orig===void 0||t.y===t._orig.y)return;let r=t.y;for(;r>t._orig.y;)--r,this.collide(t,{x:t.x,y:r,w:t.w,h:t.h})||(t._dirty=!0,t.y=r)}):this.nodes.forEach((t,r)=>{if(!t.locked)for(;t.y>0;){const i=r===0?0:t.y-1;if(!(r===0||!this.collide(t,{x:t.x,y:i,w:t.w,h:t.h})))break;t._dirty=t.y!==i,t.y=i}}),this)}prepareNode(t,r){t._id=t._id??ai._idSeq++;const i=t.id;if(i){let u=1;for(;this.nodes.find(c=>c.id===t.id&&c!==t);)t.id=i+"_"+u++}(t.x===void 0||t.y===void 0||t.x===null||t.y===null)&&(t.autoPosition=!0);const o={x:0,y:0,w:1,h:1};return A.defaults(t,o),t.autoPosition||delete t.autoPosition,t.noResize||delete t.noResize,t.noMove||delete t.noMove,A.sanitizeMinMax(t),typeof t.x=="string"&&(t.x=Number(t.x)),typeof t.y=="string"&&(t.y=Number(t.y)),typeof t.w=="string"&&(t.w=Number(t.w)),typeof t.h=="string"&&(t.h=Number(t.h)),isNaN(t.x)&&(t.x=o.x,t.autoPosition=!0),isNaN(t.y)&&(t.y=o.y,t.autoPosition=!0),isNaN(t.w)&&(t.w=o.w),isNaN(t.h)&&(t.h=o.h),this.nodeBoundFix(t,r),t}nodeBoundFix(t,r){const i=t._orig||A.copyPos({},t);if(t.maxW&&(t.w=Math.min(t.w||1,t.maxW)),t.maxH&&(t.h=Math.min(t.h||1,t.maxH)),t.minW&&(t.w=Math.max(t.w||1,t.minW)),t.minH&&(t.h=Math.max(t.h||1,t.minH)),(t.x||0)+(t.w||1)>this.column&&this.columnthis.column?t.w=this.column:t.w<1&&(t.w=1),this.maxRow&&t.h>this.maxRow?t.h=this.maxRow:t.h<1&&(t.h=1),t.x<0&&(t.x=0),t.y<0&&(t.y=0),t.x+t.w>this.column&&(r?t.w=this.column-t.x:t.x=this.column-t.w),this.maxRow&&t.y+t.h>this.maxRow&&(r?t.h=this.maxRow-t.y:t.y=this.maxRow-t.h),A.samePos(t,i)||(t._dirty=!0),this}getDirtyNodes(t){return t?this.nodes.filter(r=>r._dirty&&!A.samePos(r,r._orig)):this.nodes.filter(r=>r._dirty)}_notify(t){if(this.batchMode||!this.onChange)return this;const r=(t||[]).concat(this.getDirtyNodes());return this.onChange(r),this}cleanNodes(){return this.batchMode?this:(this.nodes.forEach(t=>{delete t._dirty,delete t._lastTried}),this)}saveInitial(){return this.nodes.forEach(t=>{t._orig=A.copyPos({},t),delete t._dirty}),this._hasLocked=this.nodes.some(t=>t.locked),this}restoreInitial(){return this.nodes.forEach(t=>{!t._orig||A.samePos(t,t._orig)||(A.copyPos(t,t._orig),t._dirty=!0)}),this._notify(),this}findEmptyPosition(t,r=this.nodes,i=this.column,o){const u=o?o.y*i+(o.x+o.w):0;let c=!1;for(let d=u;!c;++d){const p=d%i,m=Math.floor(d/i);if(p+t.w>i)continue;const w={x:p,y:m,w:t.w,h:t.h};r.find(v=>A.isIntercepted(w,v))||((t.x!==p||t.y!==m)&&(t._dirty=!0),t.x=p,t.y=m,delete t.autoPosition,c=!0)}return c}addNode(t,r=!1,i){const o=this.nodes.find(c=>c._id===t._id);if(o)return o;this._inColumnResize?this.nodeBoundFix(t):this.prepareNode(t),delete t._temporaryRemoved,delete t._removeDOM;let u;return t.autoPosition&&this.findEmptyPosition(t,this.nodes,this.column,i)&&(delete t.autoPosition,u=!0),this.nodes.push(t),r&&this.addedNodes.push(t),u||this._fixCollisions(t),this.batchMode||this._packNodes()._notify(),t}removeNode(t,r=!0,i=!1){return this.nodes.find(o=>o._id===t._id)?(i&&this.removedNodes.push(t),r&&(t._removeDOM=!0),this.nodes=this.nodes.filter(o=>o._id!==t._id),t._isAboutToRemove||this._packNodes(),this._notify([t]),this):this}removeAll(t=!0,r=!0){if(delete this._layouts,!this.nodes.length)return this;t&&this.nodes.forEach(o=>o._removeDOM=!0);const i=this.nodes;return this.removedNodes=r?i:[],this.nodes=[],this._notify(i)}moveNodeCheck(t,r){if(!this.changedPosConstrain(t,r))return!1;if(r.pack=!0,!this.maxRow)return this.moveNode(t,r);let i;const o=new ai({column:this.column,float:this.float,nodes:this.nodes.map(c=>c._id===t._id?(i={...c},i):{...c})});if(!i)return!1;const u=o.moveNode(i,r)&&o.getRow()<=Math.max(this.getRow(),this.maxRow);if(!u&&!r.resizing&&r.collide){const c=r.collide.el.gridstackNode;if(this.swap(t,c))return this._notify(),!0}return u?(o.nodes.filter(c=>c._dirty).forEach(c=>{const d=this.nodes.find(p=>p._id===c._id);d&&(A.copyPos(d,c),d._dirty=!0)}),this._notify(),!0):!1}willItFit(t){if(delete t._willFitPos,!this.maxRow)return!0;const r=new ai({column:this.column,float:this.float,nodes:this.nodes.map(o=>({...o}))}),i={...t};return this.cleanupNode(i),delete i.el,delete i._id,delete i.content,delete i.grid,r.addNode(i),r.getRow()<=this.maxRow?(t._willFitPos=A.copyPos({},i),!0):!1}changedPosConstrain(t,r){return r.w=r.w||t.w,r.h=r.h||t.h,t.x!==r.x||t.y!==r.y?!0:(t.maxW&&(r.w=Math.min(r.w,t.maxW)),t.maxH&&(r.h=Math.min(r.h,t.maxH)),t.minW&&(r.w=Math.max(r.w,t.minW)),t.minH&&(r.h=Math.max(r.h,t.minH)),t.w!==r.w||t.h!==r.h)}moveNode(t,r){var m,w;if(!t||!r)return!1;let i;r.pack===void 0&&!this.batchMode&&(i=r.pack=!0),typeof r.x!="number"&&(r.x=t.x),typeof r.y!="number"&&(r.y=t.y),typeof r.w!="number"&&(r.w=t.w),typeof r.h!="number"&&(r.h=t.h);const o=t.w!==r.w||t.h!==r.h,u=A.copyPos({},t,!0);if(A.copyPos(u,r),this.nodeBoundFix(u,o),A.copyPos(r,u),!r.forceCollide&&A.samePos(t,r))return!1;const c=A.copyPos({},t),d=this.collideAll(t,u,r.skip);let p=!0;if(d.length){const v=t._moving&&!r.nested;let x=v?this.directionCollideCoverage(t,r,d):d[0];if(v&&x&&((w=(m=t.grid)==null?void 0:m.opts)!=null&&w.subGridDynamic)&&!t.grid._isTemp){const z=A.areaIntercept(r.rect,x._rect),R=A.area(r.rect),k=A.area(x._rect);z/(R.8&&(x.grid.makeSubGrid(x.el,void 0,t),x=void 0)}x?p=!this._fixCollisions(t,u,x,r):(p=!1,i&&delete r.pack)}return p&&!A.samePos(t,u)&&(t._dirty=!0,A.copyPos(t,u)),r.pack&&this._packNodes()._notify(),!A.samePos(t,c)}getRow(){return this.nodes.reduce((t,r)=>Math.max(t,r.y+r.h),0)}beginUpdate(t){return t._updating||(t._updating=!0,delete t._skipDown,this.batchMode||this.saveInitial()),this}endUpdate(){const t=this.nodes.find(r=>r._updating);return t&&(delete t._updating,delete t._skipDown),this}save(t=!0,r){var c;const i=(c=this._layouts)==null?void 0:c.length,o=i&&this.column!==i-1?this._layouts[i-1]:null,u=[];return this.sortNodes(),this.nodes.forEach(d=>{const p=o==null?void 0:o.find(w=>w._id===d._id),m={...d,...p||{}};A.removeInternalForSave(m,!t),r&&r(d,m),u.push(m)}),u}layoutsNodesChange(t){return!this._layouts||this._inColumnResize?this:(this._layouts.forEach((r,i)=>{if(!r||i===this.column)return this;if(i{if(!u._orig)return;const c=r.find(d=>d._id===u._id);c&&(c.y>=0&&u.y!==u._orig.y&&(c.y+=u.y-u._orig.y),u.x!==u._orig.x&&(c.x=Math.round(u.x*o)),u.w!==u._orig.w&&(c.w=Math.round(u.w*o)))})}}),this)}columnChanged(t,r,i="moveScale"){var d;if(!this.nodes.length||!r||t===r)return this;const o=i==="compact"||i==="list";o&&this.sortNodes(1),rt&&this._layouts){const p=this._layouts[r]||[],m=this._layouts.length-1;!p.length&&t!==m&&((d=this._layouts[m])!=null&&d.length)&&(t=m,this._layouts[m].forEach(w=>{const v=c.find(x=>x._id===w._id);v&&(!o&&!w.autoPosition&&(v.x=w.x??v.x,v.y=w.y??v.y),v.w=w.w??v.w,(w.x==null||w.y===void 0)&&(v.autoPosition=!0))})),p.forEach(w=>{const v=c.findIndex(x=>x._id===w._id);if(v!==-1){const x=c[v];if(o){x.w=w.w;return}(w.autoPosition||isNaN(w.x)||isNaN(w.y))&&this.findEmptyPosition(w,u),w.autoPosition||(x.x=w.x??x.x,x.y=w.y??x.y,x.w=w.w??x.w,u.push(x)),c.splice(v,1)}})}if(o)this.compact(i,!1);else{if(c.length)if(typeof i=="function")i(r,t,u,c);else{const p=o||i==="none"?1:r/t,m=i==="move"||i==="moveScale",w=i==="scale"||i==="moveScale";c.forEach(v=>{v.x=r===1?0:m?Math.round(v.x*p):Math.min(v.x,r-1),v.w=r===1||t===1?1:w?Math.round(v.w*p)||1:Math.min(v.w,r),u.push(v)}),c=[]}u=A.sort(u,-1),this._inColumnResize=!0,this.nodes=[],u.forEach(p=>{this.addNode(p,!1),delete p._orig})}return this.nodes.forEach(p=>delete p._orig),this.batchUpdate(!1,!o),delete this._inColumnResize,this}cacheLayout(t,r,i=!1){const o=[];return t.forEach((u,c)=>{if(u._id===void 0){const d=u.id?this.nodes.find(p=>p.id===u.id):void 0;u._id=(d==null?void 0:d._id)??ai._idSeq++}o[c]={x:u.x,y:u.y,w:u.w,_id:u._id}}),this._layouts=i?[]:this._layouts||[],this._layouts[r]=o,this}cacheOneLayout(t,r){t._id=t._id??ai._idSeq++;const i={x:t.x,y:t.y,w:t.w,_id:t._id};(t.autoPosition||t.x===void 0)&&(delete i.x,delete i.y,t.autoPosition&&(i.autoPosition=!0)),this._layouts=this._layouts||[],this._layouts[r]=this._layouts[r]||[];const o=this.findCacheLayout(t,r);return o===-1?this._layouts[r].push(i):this._layouts[r][o]=i,this}findCacheLayout(t,r){var i,o;return((o=(i=this._layouts)==null?void 0:i[r])==null?void 0:o.findIndex(u=>u._id===t._id))??-1}removeNodeFromLayoutCache(t){if(this._layouts)for(let r=0;r0||navigator.msMaxTouchPoints>0);class ui{}function pu(l,t){l.touches.length>1||(l.cancelable&&l.preventDefault(),A.simulateMouseEvent(l.changedTouches[0],t))}function Um(l,t){l.cancelable&&l.preventDefault(),A.simulateMouseEvent(l,t)}function gu(l){ui.touchHandled||(ui.touchHandled=!0,pu(l,"mousedown"))}function mu(l){ui.touchHandled&&pu(l,"mousemove")}function vu(l){if(!ui.touchHandled)return;ui.pointerLeaveTimeout&&(window.clearTimeout(ui.pointerLeaveTimeout),delete ui.pointerLeaveTimeout);const t=!!Le.dragElement;pu(l,"mouseup"),t||pu(l,"click"),ui.touchHandled=!1}function yu(l){l.pointerType!=="mouse"&&l.target.releasePointerCapture(l.pointerId)}function Eg(l){Le.dragElement&&l.pointerType!=="mouse"&&Um(l,"mouseenter")}function Cg(l){Le.dragElement&&l.pointerType!=="mouse"&&(ui.pointerLeaveTimeout=window.setTimeout(()=>{delete ui.pointerLeaveTimeout,Um(l,"mouseleave")},10))}class bu{constructor(t,r,i){this.host=t,this.dir=r,this.option=i,this.moving=!1,this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this._init()}_init(){const t=this.el=document.createElement("div");return t.classList.add("ui-resizable-handle"),t.classList.add(`${bu.prefix}${this.dir}`),t.style.zIndex="100",t.style.userSelect="none",this.host.appendChild(this.el),this.el.addEventListener("mousedown",this._mouseDown),Kr&&(this.el.addEventListener("touchstart",gu),this.el.addEventListener("pointerdown",yu)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),Kr&&(this.el.removeEventListener("touchstart",gu),this.el.removeEventListener("pointerdown",yu)),this.host.removeChild(this.el),delete this.el,delete this.host,this}_mouseDown(t){this.mouseDownEvent=t,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),Kr&&(this.el.addEventListener("touchmove",mu),this.el.addEventListener("touchend",vu)),t.stopPropagation(),t.preventDefault()}_mouseMove(t){const r=this.mouseDownEvent;this.moving?this._triggerEvent("move",t):Math.abs(t.x-r.x)+Math.abs(t.y-r.y)>2&&(this.moving=!0,this._triggerEvent("start",this.mouseDownEvent),this._triggerEvent("move",t),document.addEventListener("keydown",this._keyEvent)),t.stopPropagation()}_mouseUp(t){this.moving&&(this._triggerEvent("stop",t),document.removeEventListener("keydown",this._keyEvent)),document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),Kr&&(this.el.removeEventListener("touchmove",mu),this.el.removeEventListener("touchend",vu)),delete this.moving,delete this.mouseDownEvent,t.stopPropagation(),t.preventDefault()}_keyEvent(t){var r,i;t.key==="Escape"&&((i=(r=this.host.gridstackNode)==null?void 0:r.grid)==null||i.engine.restoreInitial(),this._mouseUp(this.mouseDownEvent))}_triggerEvent(t,r){return this.option[t]&&this.option[t](r),this}}bu.prefix="ui-resizable-";class ad{constructor(){this._eventRegister={}}get disabled(){return this._disabled}on(t,r){this._eventRegister[t]=r}off(t){delete this._eventRegister[t]}enable(){this._disabled=!1}disable(){this._disabled=!0}destroy(){delete this._eventRegister}triggerEvent(t,r){if(!this.disabled&&this._eventRegister&&this._eventRegister[t])return this._eventRegister[t](r)}}class zo extends ad{constructor(t,r={}){super(),this.el=t,this.option=r,this.rectScale={x:1,y:1},this._ui=()=>{const o=this.el.parentElement.getBoundingClientRect(),u={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},c=this.temporalRect||u;return{position:{left:(c.left-o.left)*this.rectScale.x,top:(c.top-o.top)*this.rectScale.y},size:{width:c.width*this.rectScale.x,height:c.height*this.rectScale.y}}},this._mouseOver=this._mouseOver.bind(this),this._mouseOut=this._mouseOut.bind(this),this.enable(),this._setupAutoHide(this.option.autoHide),this._setupHandlers()}on(t,r){super.on(t,r)}off(t){super.off(t)}enable(){super.enable(),this.el.classList.remove("ui-resizable-disabled"),this._setupAutoHide(this.option.autoHide)}disable(){super.disable(),this.el.classList.add("ui-resizable-disabled"),this._setupAutoHide(!1)}destroy(){this._removeHandlers(),this._setupAutoHide(!1),delete this.el,super.destroy()}updateOption(t){const r=t.handles&&t.handles!==this.option.handles,i=t.autoHide&&t.autoHide!==this.option.autoHide;return Object.keys(t).forEach(o=>this.option[o]=t[o]),r&&(this._removeHandlers(),this._setupHandlers()),i&&this._setupAutoHide(this.option.autoHide),this}_setupAutoHide(t){return t?(this.el.classList.add("ui-resizable-autohide"),this.el.addEventListener("mouseover",this._mouseOver),this.el.addEventListener("mouseout",this._mouseOut)):(this.el.classList.remove("ui-resizable-autohide"),this.el.removeEventListener("mouseover",this._mouseOver),this.el.removeEventListener("mouseout",this._mouseOut),Le.overResizeElement===this&&delete Le.overResizeElement),this}_mouseOver(t){Le.overResizeElement||Le.dragElement||(Le.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(t){Le.overResizeElement===this&&(delete Le.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(t=>t.trim()).map(t=>new bu(this.el,t,{start:r=>{this._resizeStart(r)},stop:r=>{this._resizeStop(r)},move:r=>{this._resizing(r,t)}})),this}_resizeStart(t){this.sizeToContent=A.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=A.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=t,this._setupHelper(),this._applyChange();const r=A.initEvent(t,{type:"resizestart",target:this.el});return this.option.start&&this.option.start(r,this._ui()),this.el.classList.add("ui-resizable-resizing"),this.triggerEvent("resizestart",r),this}_resizing(t,r){this.scrolled=this.scrollEl.scrollTop-this.scrollY,this.temporalRect=this._getChange(t,r),this._applyChange();const i=A.initEvent(t,{type:"resize",target:this.el});return this.option.resize&&this.option.resize(i,this._ui()),this.triggerEvent("resize",i),this}_resizeStop(t){const r=A.initEvent(t,{type:"resizestop",target:this.el});return this.option.stop&&this.option.stop(r),this.el.classList.remove("ui-resizable-resizing"),this.triggerEvent("resizestop",r),this._cleanHelper(),delete this.startEvent,delete this.originalRect,delete this.temporalRect,delete this.scrollY,delete this.scrolled,this}_setupHelper(){this.elOriginStyleVal=zo._originStyleProp.map(i=>this.el.style[i]),this.parentOriginStylePosition=this.el.parentElement.style.position;const t=this.el.parentElement,r=A.getValuesFromTransformedElement(t);return this.rectScale={x:r.xScale,y:r.yScale},getComputedStyle(this.el.parentElement).position.match(/static/)&&(this.el.parentElement.style.position="relative"),this.el.style.position="absolute",this.el.style.opacity="0.8",this}_cleanHelper(){return zo._originStyleProp.forEach((t,r)=>{this.el.style[t]=this.elOriginStyleVal[r]||null}),this.el.parentElement.style.position=this.parentOriginStylePosition||null,this}_getChange(t,r){const i=this.startEvent,o={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},u=t.clientX-i.clientX,c=this.sizeToContent?0:t.clientY-i.clientY;let d,p;r.indexOf("e")>-1?o.width+=u:r.indexOf("w")>-1&&(o.width-=u,o.left+=u,d=!0),r.indexOf("s")>-1?o.height+=c:r.indexOf("n")>-1&&(o.height-=c,o.top+=c,p=!0);const m=this._constrainSize(o.width,o.height,d,p);return Math.round(o.width)!==Math.round(m.width)&&(r.indexOf("w")>-1&&(o.left+=o.width-m.width),o.width=m.width),Math.round(o.height)!==Math.round(m.height)&&(r.indexOf("n")>-1&&(o.top+=o.height-m.height),o.height=m.height),o}_constrainSize(t,r,i,o){const u=this.option,c=(i?u.maxWidthMoveLeft:u.maxWidth)||Number.MAX_SAFE_INTEGER,d=u.minWidth/this.rectScale.x||t,p=(o?u.maxHeightMoveUp:u.maxHeight)||Number.MAX_SAFE_INTEGER,m=u.minHeight/this.rectScale.y||r,w=Math.min(c,Math.max(d,t)),v=Math.min(p,Math.max(m,r));return{width:w,height:v}}_applyChange(){let t={left:0,top:0,width:0,height:0};if(this.el.style.position==="absolute"){const r=this.el.parentElement,{left:i,top:o}=r.getBoundingClientRect();t={left:i,top:o,width:0,height:0}}return this.temporalRect?(Object.keys(this.temporalRect).forEach(r=>{const i=this.temporalRect[r],o=r==="width"||r==="left"?this.rectScale.x:r==="height"||r==="top"?this.rectScale.y:1;this.el.style[r]=(i-t[r])*o+"px"}),this):this}_removeHandlers(){return this.handlers.forEach(t=>t.destroy()),delete this.handlers,this}}zo._originStyleProp=["width","height","position","left","top","opacity","zIndex"];const ES='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class Mo extends ad{constructor(t,r={}){var u;super(),this.el=t,this.option=r,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0};const i=(u=r==null?void 0:r.handle)==null?void 0:u.substring(1),o=t.gridstackNode;this.dragEls=!i||t.classList.contains(i)?[t]:o!=null&&o.subGrid?[t.querySelector(r.handle)||t]:Array.from(t.querySelectorAll(r.handle)),this.dragEls.length===0&&(this.dragEls=[t]),this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this.enable()}on(t,r){super.on(t,r)}off(t){super.off(t)}enable(){this.disabled!==!1&&(super.enable(),this.dragEls.forEach(t=>{t.addEventListener("mousedown",this._mouseDown),Kr&&(t.addEventListener("touchstart",gu),t.addEventListener("pointerdown",yu))}),this.el.classList.remove("ui-draggable-disabled"))}disable(t=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(r=>{r.removeEventListener("mousedown",this._mouseDown),Kr&&(r.removeEventListener("touchstart",gu),r.removeEventListener("pointerdown",yu))}),t||this.el.classList.add("ui-draggable-disabled"))}destroy(){this.dragTimeout&&window.clearTimeout(this.dragTimeout),delete this.dragTimeout,this.mouseDownEvent&&this._mouseUp(this.mouseDownEvent),this.disable(!0),delete this.el,delete this.helper,delete this.option,super.destroy()}updateOption(t){return Object.keys(t).forEach(r=>this.option[r]=t[r]),this}_mouseDown(t){if(!Le.mouseHandled)return t.button!==0||!this.dragEls.find(r=>r===t.target)&&t.target.closest(ES)||this.option.cancel&&t.target.closest(this.option.cancel)||(this.mouseDownEvent=t,delete this.dragging,delete Le.dragElement,delete Le.dropElement,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),Kr&&(t.currentTarget.addEventListener("touchmove",mu),t.currentTarget.addEventListener("touchend",vu)),t.preventDefault(),document.activeElement&&document.activeElement.blur(),Le.mouseHandled=!0),!0}_callDrag(t){if(!this.dragging)return;const r=A.initEvent(t,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(r,this.ui()),this.triggerEvent("drag",r)}_mouseMove(t){var i;const r=this.mouseDownEvent;if(this.lastDrag=t,this.dragging)if(this._dragFollow(t),Le.pauseDrag){const o=Number.isInteger(Le.pauseDrag)?Le.pauseDrag:100;this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>this._callDrag(t),o)}else this._callDrag(t);else if(Math.abs(t.x-r.x)+Math.abs(t.y-r.y)>3){this.dragging=!0,Le.dragElement=this;const o=(i=this.el.gridstackNode)==null?void 0:i.grid;o?Le.dropElement=o.el.ddElement.ddDroppable:delete Le.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=A.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(t,this.el,this.helperContainment),this._setupHelperStyle(t);const u=A.initEvent(t,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(u,this.ui()),this.triggerEvent("dragstart",u),document.addEventListener("keydown",this._keyEvent)}return!0}_mouseUp(t){var r,i;if(document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),Kr&&t.currentTarget&&(t.currentTarget.removeEventListener("touchmove",mu,!0),t.currentTarget.removeEventListener("touchend",vu,!0)),this.dragging){delete this.dragging,(r=this.el.gridstackNode)==null||delete r._origRotate,document.removeEventListener("keydown",this._keyEvent),((i=Le.dropElement)==null?void 0:i.el)===this.el.parentElement&&delete Le.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();const o=A.initEvent(t,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(o),this.triggerEvent("dragstop",o),Le.dropElement&&Le.dropElement.drop(t)}delete this.helper,delete this.mouseDownEvent,delete Le.dragElement,delete Le.dropElement,delete Le.mouseHandled,t.preventDefault()}_keyEvent(t){var o,u;const r=this.el.gridstackNode,i=(r==null?void 0:r.grid)||((u=(o=Le.dropElement)==null?void 0:o.el)==null?void 0:u.gridstack);if(t.key==="Escape")r&&r._origRotate&&(r._orig=r._origRotate,delete r._origRotate),i==null||i.cancelDrag(),this._mouseUp(this.mouseDownEvent);else if(r&&i&&(t.key==="r"||t.key==="R")){if(!A.canBeRotated(r))return;r._origRotate=r._origRotate||{...r._orig},delete r._moving,i.setAnimation(!1).rotate(r.el,{top:-this.dragOffset.offsetTop,left:-this.dragOffset.offsetLeft}).setAnimation(),r._moving=!0,this.dragOffset=this._getDragOffset(this.lastDrag,r.el,this.helperContainment),this.helper.style.width=this.dragOffset.width+"px",this.helper.style.height=this.dragOffset.height+"px",A.swap(r._orig,"w","h"),delete r._rect,this._mouseMove(this.lastDrag)}}_createHelper(){let t=this.el;return typeof this.option.helper=="function"?t=this.option.helper(this.el):this.option.helper==="clone"&&(t=A.cloneNode(this.el)),t.parentElement||A.appendTo(t,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=Mo.originStyleProp.map(r=>this.el.style[r]),t}_setupHelperStyle(t){this.helper.classList.add("ui-draggable-dragging");const r=this.helper.style;return r.pointerEvents="none",r.width=this.dragOffset.width+"px",r.height=this.dragOffset.height+"px",r.willChange="left, top",r.position="fixed",this._dragFollow(t),r.transition="none",setTimeout(()=>{this.helper&&(r.transition=null)},0),this}_removeHelperStyle(){var r;this.helper.classList.remove("ui-draggable-dragging");const t=(r=this.helper)==null?void 0:r.gridstackNode;if(!(t!=null&&t._isAboutToRemove)&&this.dragElementOriginStyle){const i=this.helper,o=this.dragElementOriginStyle.transition||null;i.style.transition=this.dragElementOriginStyle.transition="none",Mo.originStyleProp.forEach(u=>i.style[u]=this.dragElementOriginStyle[u]||null),setTimeout(()=>i.style.transition=o,50)}return delete this.dragElementOriginStyle,this}_dragFollow(t){const r={left:0,top:0},i=this.helper.style,o=this.dragOffset;i.left=(t.clientX+o.offsetLeft-r.left)*this.dragTransform.xScale+"px",i.top=(t.clientY+o.offsetTop-r.top)*this.dragTransform.yScale+"px"}_setupHelperContainmentStyle(){return this.helperContainment=this.helper.parentElement,this.helper.style.position!=="fixed"&&(this.parentOriginStylePosition=this.helperContainment.style.position,getComputedStyle(this.helperContainment).position.match(/static/)&&(this.helperContainment.style.position="relative")),this}_getDragOffset(t,r,i){let o=0,u=0;i&&(o=this.dragTransform.xOffset,u=this.dragTransform.yOffset);const c=r.getBoundingClientRect();return{left:c.left,top:c.top,offsetLeft:-t.clientX+c.left-o,offsetTop:-t.clientY+c.top-u,width:c.width*this.dragTransform.xScale,height:c.height*this.dragTransform.yScale}}ui(){const r=this.el.parentElement.getBoundingClientRect(),i=this.helper.getBoundingClientRect();return{position:{top:(i.top-r.top)*this.dragTransform.yScale,left:(i.left-r.left)*this.dragTransform.xScale}}}}Mo.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","top","minWidth","willChange"];class CS extends ad{constructor(t,r={}){super(),this.el=t,this.option=r,this._mouseEnter=this._mouseEnter.bind(this),this._mouseLeave=this._mouseLeave.bind(this),this.enable(),this._setupAccept()}on(t,r){super.on(t,r)}off(t){super.off(t)}enable(){this.disabled!==!1&&(super.enable(),this.el.classList.add("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),this.el.addEventListener("mouseenter",this._mouseEnter),this.el.addEventListener("mouseleave",this._mouseLeave),Kr&&(this.el.addEventListener("pointerenter",Eg),this.el.addEventListener("pointerleave",Cg)))}disable(t=!1){this.disabled!==!0&&(super.disable(),this.el.classList.remove("ui-droppable"),t||this.el.classList.add("ui-droppable-disabled"),this.el.removeEventListener("mouseenter",this._mouseEnter),this.el.removeEventListener("mouseleave",this._mouseLeave),Kr&&(this.el.removeEventListener("pointerenter",Eg),this.el.removeEventListener("pointerleave",Cg)))}destroy(){this.disable(!0),this.el.classList.remove("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),super.destroy()}updateOption(t){return Object.keys(t).forEach(r=>this.option[r]=t[r]),this._setupAccept(),this}_mouseEnter(t){if(!Le.dragElement||!this._canDrop(Le.dragElement.el))return;t.preventDefault(),t.stopPropagation(),Le.dropElement&&Le.dropElement!==this&&Le.dropElement._mouseLeave(t,!0),Le.dropElement=this;const r=A.initEvent(t,{target:this.el,type:"dropover"});this.option.over&&this.option.over(r,this._ui(Le.dragElement)),this.triggerEvent("dropover",r),this.el.classList.add("ui-droppable-over")}_mouseLeave(t,r=!1){var o;if(!Le.dragElement||Le.dropElement!==this)return;t.preventDefault(),t.stopPropagation();const i=A.initEvent(t,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(i,this._ui(Le.dragElement)),this.triggerEvent("dropout",i),Le.dropElement===this&&(delete Le.dropElement,!r)){let u,c=this.el.parentElement;for(;!u&&c;)u=(o=c.ddElement)==null?void 0:o.ddDroppable,c=c.parentElement;u&&u._mouseEnter(t)}}drop(t){t.preventDefault();const r=A.initEvent(t,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(r,this._ui(Le.dragElement)),this.triggerEvent("drop",r)}_canDrop(t){return t&&(!this.accept||this.accept(t))}_setupAccept(){return this.option.accept?(typeof this.option.accept=="string"?this.accept=t=>t.classList.contains(this.option.accept)||t.matches(this.option.accept):this.accept=this.option.accept,this):this}_ui(t){return{draggable:t.el,...t.ui()}}}class ud{static init(t){return t.ddElement||(t.ddElement=new ud(t)),t.ddElement}constructor(t){this.el=t}on(t,r){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(t)>-1?this.ddDraggable.on(t,r):this.ddDroppable&&["drop","dropover","dropout"].indexOf(t)>-1?this.ddDroppable.on(t,r):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(t)>-1&&this.ddResizable.on(t,r),this}off(t){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(t)>-1?this.ddDraggable.off(t):this.ddDroppable&&["drop","dropover","dropout"].indexOf(t)>-1?this.ddDroppable.off(t):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(t)>-1&&this.ddResizable.off(t),this}setupDraggable(t){return this.ddDraggable?this.ddDraggable.updateOption(t):this.ddDraggable=new Mo(this.el,t),this}cleanDraggable(){return this.ddDraggable&&(this.ddDraggable.destroy(),delete this.ddDraggable),this}setupResizable(t){return this.ddResizable?this.ddResizable.updateOption(t):this.ddResizable=new zo(this.el,t),this}cleanResizable(){return this.ddResizable&&(this.ddResizable.destroy(),delete this.ddResizable),this}setupDroppable(t){return this.ddDroppable?this.ddDroppable.updateOption(t):this.ddDroppable=new CS(this.el,t),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class kS{resizable(t,r,i,o){return this._getDDElements(t,r).forEach(u=>{if(r==="disable"||r==="enable")u.ddResizable&&u.ddResizable[r]();else if(r==="destroy")u.ddResizable&&u.cleanResizable();else if(r==="option")u.setupResizable({[i]:o});else{const d=u.el.gridstackNode.grid;let p=u.el.getAttribute("gs-resize-handles")||d.opts.resizable.handles||"e,s,se";p==="all"&&(p="n,e,s,w,se,sw,ne,nw");const m=!d.opts.alwaysShowResizeHandle;u.setupResizable({...d.opts.resizable,handles:p,autoHide:m,start:r.start,stop:r.stop,resize:r.resize})}}),this}draggable(t,r,i,o){return this._getDDElements(t,r).forEach(u=>{if(r==="disable"||r==="enable")u.ddDraggable&&u.ddDraggable[r]();else if(r==="destroy")u.ddDraggable&&u.cleanDraggable();else if(r==="option")u.setupDraggable({[i]:o});else{const c=u.el.gridstackNode.grid;u.setupDraggable({...c.opts.draggable,start:r.start,stop:r.stop,drag:r.drag})}}),this}dragIn(t,r){return this._getDDElements(t).forEach(i=>i.setupDraggable(r)),this}droppable(t,r,i,o){return typeof r.accept=="function"&&!r._accept&&(r._accept=r.accept,r.accept=u=>r._accept(u)),this._getDDElements(t,r).forEach(u=>{r==="disable"||r==="enable"?u.ddDroppable&&u.ddDroppable[r]():r==="destroy"?u.ddDroppable&&u.cleanDroppable():r==="option"?u.setupDroppable({[i]:o}):u.setupDroppable(r)}),this}isDroppable(t){var r;return!!((r=t==null?void 0:t.ddElement)!=null&&r.ddDroppable&&!t.ddElement.ddDroppable.disabled)}isDraggable(t){var r;return!!((r=t==null?void 0:t.ddElement)!=null&&r.ddDraggable&&!t.ddElement.ddDraggable.disabled)}isResizable(t){var r;return!!((r=t==null?void 0:t.ddElement)!=null&&r.ddResizable&&!t.ddElement.ddResizable.disabled)}on(t,r,i){return this._getDDElements(t).forEach(o=>o.on(r,u=>{i(u,Le.dragElement?Le.dragElement.el:u.target,Le.dragElement?Le.dragElement.helper:null)})),this}off(t,r){return this._getDDElements(t).forEach(i=>i.off(r)),this}_getDDElements(t,r){const i=t.gridstack||r!=="destroy"&&r!=="disable",o=A.getElements(t);return o.length?o.map(c=>c.ddElement||(i?ud.init(c):null)).filter(c=>c):[]}}/*! * GridStack 11.5.1 * https://gridstackjs.com/ * * Copyright (c) 2021-2024 Alain Dumesny * see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE - */const $n=new SS;class Ne{static init(t={},r=".grid-stack"){if(typeof document>"u")return null;const i=Ne.getGridElement(r);return i?(i.gridstack||(i.gridstack=new Ne(i,A.cloneDeep(t))),i.gridstack):(console.error(typeof r=="string"?'GridStack.initAll() no grid was found with selector "'+r+`" - element missing or wrong selector ? + */const $n=new kS;class Ne{static init(t={},r=".grid-stack"){if(typeof document>"u")return null;const i=Ne.getGridElement(r);return i?(i.gridstack||(i.gridstack=new Ne(i,A.cloneDeep(t))),i.gridstack):(console.error(typeof r=="string"?'GridStack.initAll() no grid was found with selector "'+r+`" - element missing or wrong selector ? Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`:"GridStack.init() no grid element was passed."),null)}static initAll(t={},r=".grid-stack"){const i=[];return typeof document>"u"||(Ne.getGridElements(r).forEach(o=>{o.gridstack||(o.gridstack=new Ne(o,A.cloneDeep(t))),i.push(o.gridstack)}),i.length===0&&console.error('GridStack.initAll() no grid was found with selector "'+r+`" - element missing or wrong selector ? -Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`)),i}static addGrid(t,r={}){if(!t)return null;let i=t;if(i.gridstack){const f=i.gridstack;return r&&(f.opts={...f.opts,...r}),r.children!==void 0&&f.load(r.children),f}return(!t.classList.contains("grid-stack")||Ne.addRemoveCB)&&(Ne.addRemoveCB?i=Ne.addRemoveCB(t,r,!0,!0):i=A.createDiv(["grid-stack",r.class],t)),Ne.init(r,i)}static registerEngine(t){Ne.engineClass=t}get placeholder(){if(!this._placeholder){this._placeholder=A.createDiv([this.opts.placeholderClass,yr.itemClass,this.opts.itemClass]);const t=A.createDiv(["placeholder-content"],this._placeholder);this.opts.placeholderText&&(t.textContent=this.opts.placeholderText)}return this._placeholder}constructor(t,r={}){var v,x,z;this.el=t,this.opts=r,this.animationDelay=310,this._gsEventHandler={},this._extraDragRow=0,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0},t.gridstack=this,this.opts=r=r||{},t.classList.contains("grid-stack")||this.el.classList.add("grid-stack"),r.row&&(r.minRow=r.maxRow=r.row,delete r.row);const i=A.toNumber(t.getAttribute("gs-row"));r.column==="auto"&&delete r.column,r.alwaysShowResizeHandle!==void 0&&(r._alwaysShowResizeHandle=r.alwaysShowResizeHandle);let o=(v=r.columnOpts)==null?void 0:v.breakpoints;const u=r;if(u.oneColumnModeDomSort&&(delete u.oneColumnModeDomSort,console.log("warning: Gridstack oneColumnModeDomSort no longer supported. Use GridStackOptions.columnOpts instead.")),u.oneColumnSize||u.disableOneColumnMode===!1){const R=u.oneColumnSize||768;delete u.oneColumnSize,delete u.disableOneColumnMode,r.columnOpts=r.columnOpts||{},o=r.columnOpts.breakpoints=r.columnOpts.breakpoints||[];let k=o.find(b=>b.c===1);k?k.w=R:(k={c:1,w:R},o.push(k,{c:12,w:R+1}))}const f=r.columnOpts;f&&(!f.columnWidth&&!((x=f.breakpoints)!=null&&x.length)?(delete r.columnOpts,o=void 0):f.columnMax=f.columnMax||12),(o==null?void 0:o.length)>1&&o.sort((R,k)=>(k.w||0)-(R.w||0));const d={...A.cloneDeep(yr),column:A.toNumber(t.getAttribute("gs-column"))||yr.column,minRow:i||A.toNumber(t.getAttribute("gs-min-row"))||yr.minRow,maxRow:i||A.toNumber(t.getAttribute("gs-max-row"))||yr.maxRow,staticGrid:A.toBool(t.getAttribute("gs-static"))||yr.staticGrid,sizeToContent:A.toBool(t.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(r.handleClass?"."+r.handleClass:r.handle?r.handle:"")||yr.draggable.handle},removableOptions:{accept:r.itemClass||yr.removableOptions.accept,decline:yr.removableOptions.decline}};t.getAttribute("gs-animate")&&(d.animate=A.toBool(t.getAttribute("gs-animate"))),r=A.defaults(r,d),this._initMargin(),this.checkDynamicColumn(),this.el.classList.add("gs-"+r.column),r.rtl==="auto"&&(r.rtl=t.style.direction==="rtl"),r.rtl&&this.el.classList.add("grid-stack-rtl");const p=this.el.closest("."+yr.itemClass),m=p==null?void 0:p.gridstackNode;m&&(m.subGrid=this,this.parentGridNode=m,this.el.classList.add("grid-stack-nested"),m.el.classList.add("grid-stack-sub-grid")),this._isAutoCellHeight=r.cellHeight==="auto",this._isAutoCellHeight||r.cellHeight==="initial"?this.cellHeight(void 0,!1):(typeof r.cellHeight=="number"&&r.cellHeightUnit&&r.cellHeightUnit!==yr.cellHeightUnit&&(r.cellHeight=r.cellHeight+r.cellHeightUnit,delete r.cellHeightUnit),this.cellHeight(r.cellHeight,!1)),r.alwaysShowResizeHandle==="mobile"&&(r.alwaysShowResizeHandle=Kr),this._styleSheetClass="gs-id-"+ai._idSeq++,this.el.classList.add(this._styleSheetClass),this._setStaticClass();const w=r.engineClass||Ne.engineClass||ai;if(this.engine=new w({column:this.getColumn(),float:r.float,maxRow:r.maxRow,onChange:R=>{let k=0;this.engine.nodes.forEach(b=>{k=Math.max(k,b.y+b.h)}),R.forEach(b=>{const B=b.el;B&&(b._removeDOM?(B&&B.remove(),delete b._removeDOM):this._writePosAttr(B,b))}),this._updateStyles(!1,k)}}),this._updateStyles(!1,0),r.auto&&(this.batchUpdate(),this.engine._loading=!0,this.getGridItems().forEach(R=>this._prepareElement(R)),delete this.engine._loading,this.batchUpdate(!1)),r.children){const R=r.children;delete r.children,R.length&&this.load(R)}this.setAnimation(),r.subGridDynamic&&!Le.pauseDrag&&(Le.pauseDrag=!0),((z=r.draggable)==null?void 0:z.pause)!==void 0&&(Le.pauseDrag=r.draggable.pause),this._setupRemoveDrop(),this._setupAcceptWidget(),this._updateResizeEvent()}addWidget(t){if(typeof t=="string"){console.error("V11: GridStack.addWidget() does not support string anymore. see #2736");return}if(t.ELEMENT_NODE)return console.error("V11: GridStack.addWidget() does not support HTMLElement anymore. use makeWidget()"),this.makeWidget(t);let r,i=t;if(i.grid=this,i!=null&&i.el?r=i.el:Ne.addRemoveCB?r=Ne.addRemoveCB(this.el,t,!0,!1):r=this.createWidgetDivs(i),!r)return;if(i=r.gridstackNode,i&&r.parentElement===this.el&&this.engine.nodes.find(u=>u._id===i._id))return r;const o=this._readAttr(r);return A.defaults(t,o),this.engine.prepareNode(t),this.el.appendChild(r),this.makeWidget(r,t),r}createWidgetDivs(t){const r=A.createDiv(["grid-stack-item",this.opts.itemClass]),i=A.createDiv(["grid-stack-item-content"],r);return A.lazyLoad(t)?t.visibleObservable||(t.visibleObservable=new IntersectionObserver(([o])=>{var u,f;o.isIntersecting&&((u=t.visibleObservable)==null||u.disconnect(),delete t.visibleObservable,Ne.renderCB(i,t),(f=t.grid)==null||f.prepareDragDrop(t.el))}),window.setTimeout(()=>{var o;return(o=t.visibleObservable)==null?void 0:o.observe(r)})):Ne.renderCB(i,t),r}makeSubGrid(t,r,i,o=!0){var z,R,k;let u=t.gridstackNode;if(u||(u=this.makeWidget(t).gridstackNode),(z=u.subGrid)!=null&&z.el)return u.subGrid;let f,d=this;for(;d&&!f;)f=(R=d.opts)==null?void 0:R.subGridOpts,d=(k=d.parentGridNode)==null?void 0:k.grid;r=A.cloneDeep({...this.opts,id:void 0,children:void 0,column:"auto",columnOpts:void 0,layout:"list",subGridOpts:void 0,...f||{},...r||u.subGridOpts||{}}),u.subGridOpts=r;let p;r.column==="auto"&&(p=!0,r.column=Math.max(u.w||1,(i==null?void 0:i.w)||1),delete r.columnOpts);let m=u.el.querySelector(".grid-stack-item-content"),w,v;if(o&&(this._removeDD(u.el),v={...u,x:0,y:0},A.removeInternalForSave(v),delete v.subGridOpts,u.content&&(v.content=u.content,delete u.content),Ne.addRemoveCB?w=Ne.addRemoveCB(this.el,v,!0,!1):(w=A.createDiv(["grid-stack-item"]),w.appendChild(m),m=A.createDiv(["grid-stack-item-content"],u.el)),this.prepareDragDrop(u.el)),i){const b=p?r.column:u.w,B=u.h+i.h,P=u.el.style;P.transition="none",this.update(u.el,{w:b,h:B}),setTimeout(()=>P.transition=null)}const x=u.subGrid=Ne.addGrid(m,r);return i!=null&&i._moving&&(x._isTemp=!0),p&&(x._autoColumn=!0),o&&x.makeWidget(w,v),i&&(i._moving?window.setTimeout(()=>A.simulateMouseEvent(i._event,"mouseenter",x.el),0):x.makeWidget(u.el,u)),this.resizeToContentCheck(!1,u),x}removeAsSubGrid(t){var i;const r=(i=this.parentGridNode)==null?void 0:i.grid;r&&(r.batchUpdate(),r.removeWidget(this.parentGridNode.el,!0,!0),this.engine.nodes.forEach(o=>{o.x+=this.parentGridNode.x,o.y+=this.parentGridNode.y,r.makeWidget(o.el,o)}),r.batchUpdate(!1),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,t&&window.setTimeout(()=>A.simulateMouseEvent(t._event,"mouseenter",r.el),0))}save(t=!0,r=!1,i=Ne.saveCB){const o=this.engine.save(t,i);if(o.forEach(u=>{var f;if(t&&u.el&&!u.subGrid&&!i){const d=u.el.querySelector(".grid-stack-item-content");u.content=d==null?void 0:d.innerHTML,u.content||delete u.content}else if(!t&&!i&&delete u.content,(f=u.subGrid)!=null&&f.el){const d=u.subGrid.save(t,r,i);u.subGridOpts=r?d:{children:d},delete u.subGrid}delete u.el}),r){const u=A.cloneDeep(this.opts);u.marginBottom===u.marginTop&&u.marginRight===u.marginLeft&&u.marginTop===u.marginRight&&(u.margin=u.marginTop,delete u.marginTop,delete u.marginRight,delete u.marginBottom,delete u.marginLeft),u.rtl===(this.el.style.direction==="rtl")&&(u.rtl="auto"),this._isAutoCellHeight&&(u.cellHeight="auto"),this._autoColumn&&(u.column="auto");const f=u._alwaysShowResizeHandle;return delete u._alwaysShowResizeHandle,f!==void 0?u.alwaysShowResizeHandle=f:delete u.alwaysShowResizeHandle,A.removeInternalAndSame(u,yr),u.children=o,u}return o}load(t,r=Ne.addRemoveCB||!0){var m;t=A.cloneDeep(t);const i=this.getColumn();t.forEach(w=>{w.w=w.w||1,w.h=w.h||1}),t=A.sort(t),this.engine.skipCacheUpdate=this._ignoreLayoutsNodeChange=!0;let o=0;t.forEach(w=>{o=Math.max(o,(w.x||0)+w.w)}),o>this.engine.defaultColumn&&(this.engine.defaultColumn=o),o>i&&this.engine.cacheLayout(t,o,!0);const u=Ne.addRemoveCB;typeof r=="function"&&(Ne.addRemoveCB=r);const f=[];this.batchUpdate();const d=!this.engine.nodes.length;d&&this.setAnimation(!1),!d&&r&&[...this.engine.nodes].forEach(v=>{if(!v.id)return;A.find(t,v.id)||(Ne.addRemoveCB&&Ne.addRemoveCB(this.el,v,!1,!1),f.push(v),this.removeWidget(v.el,!0,!1))}),this.engine._loading=!0;const p=[];return this.engine.nodes=this.engine.nodes.filter(w=>A.find(t,w.id)?(p.push(w),!1):!0),t.forEach(w=>{var x;const v=A.find(p,w.id);if(v){if(A.shouldSizeToContent(v)&&(w.h=v.h),this.engine.nodeBoundFix(w),(w.autoPosition||w.x===void 0||w.y===void 0)&&(w.w=w.w||v.w,w.h=w.h||v.h,this.engine.findEmptyPosition(w)),this.engine.nodes.push(v),A.samePos(v,w)&&this.engine.nodes.length>1&&(this.moveNode(v,{...w,forceCollide:!0}),A.copyPos(w,v)),this.update(v.el,w),(x=w.subGridOpts)!=null&&x.children){const z=v.el.querySelector(".grid-stack");z&&z.gridstack&&z.gridstack.load(w.subGridOpts.children)}}else r&&this.addWidget(w)}),delete this.engine._loading,this.engine.removedNodes=f,this.batchUpdate(!1),delete this._ignoreLayoutsNodeChange,delete this.engine.skipCacheUpdate,u?Ne.addRemoveCB=u:delete Ne.addRemoveCB,d&&((m=this.opts)!=null&&m.animate)&&this.setAnimation(this.opts.animate,!0),this}batchUpdate(t=!0){return this.engine.batchUpdate(t),t||(this._updateContainerHeight(),this._triggerRemoveEvent(),this._triggerAddEvent(),this._triggerChangeEvent()),this}getCellHeight(t=!1){if(this.opts.cellHeight&&this.opts.cellHeight!=="auto"&&(!t||!this.opts.cellHeightUnit||this.opts.cellHeightUnit==="px"))return this.opts.cellHeight;if(this.opts.cellHeightUnit==="rem")return this.opts.cellHeight*parseFloat(getComputedStyle(document.documentElement).fontSize);if(this.opts.cellHeightUnit==="em")return this.opts.cellHeight*parseFloat(getComputedStyle(this.el).fontSize);if(this.opts.cellHeightUnit==="cm")return this.opts.cellHeight*(96/2.54);if(this.opts.cellHeightUnit==="mm")return this.opts.cellHeight*(96/2.54)/10;const r=this.el.querySelector("."+this.opts.itemClass);if(r){const o=A.toNumber(r.getAttribute("gs-h"))||1;return Math.round(r.offsetHeight/o)}const i=parseInt(this.el.getAttribute("gs-current-row"));return i?Math.round(this.el.getBoundingClientRect().height/i):this.opts.cellHeight}cellHeight(t,r=!0){if(r&&t!==void 0&&this._isAutoCellHeight!==(t==="auto")&&(this._isAutoCellHeight=t==="auto",this._updateResizeEvent()),(t==="initial"||t==="auto")&&(t=void 0),t===void 0){const o=-this.opts.marginRight-this.opts.marginLeft+this.opts.marginTop+this.opts.marginBottom;t=this.cellWidth()+o}const i=A.parseHeight(t);return this.opts.cellHeightUnit===i.unit&&this.opts.cellHeight===i.h?this:(this.opts.cellHeightUnit=i.unit,this.opts.cellHeight=i.h,this.resizeToContentCheck(),r&&this._updateStyles(!0),this)}cellWidth(){return this._widthOrContainer()/this.getColumn()}_widthOrContainer(t=!1){var r;return t&&((r=this.opts.columnOpts)!=null&&r.breakpointForWindow)?window.innerWidth:this.el.clientWidth||this.el.parentElement.clientWidth||window.innerWidth}checkDynamicColumn(){var u,f;const t=this.opts.columnOpts;if(!t||!t.columnWidth&&!((u=t.breakpoints)!=null&&u.length))return!1;const r=this.getColumn();let i=r;const o=this._widthOrContainer(!0);if(t.columnWidth)i=Math.min(Math.round(o/t.columnWidth)||1,t.columnMax);else{i=t.columnMax;let d=0;for(;dp.c===i);return this.column(i,(d==null?void 0:d.layout)||t.layout),!0}return!1}compact(t="compact",r=!0){return this.engine.compact(t,r),this._triggerChangeEvent(),this}column(t,r="moveScale"){if(!t||t<1||this.opts.column===t)return this;const i=this.getColumn();return this.opts.column=t,this.engine?(this.engine.column=t,this.el.classList.remove("gs-"+i),this.el.classList.add("gs-"+t),this.engine.columnChanged(i,t,r),this._isAutoCellHeight&&this.cellHeight(),this.resizeToContentCheck(!0),this._ignoreLayoutsNodeChange=!0,this._triggerChangeEvent(),delete this._ignoreLayoutsNodeChange,this):this}getColumn(){return this.opts.column}getGridItems(){return Array.from(this.el.children).filter(t=>t.matches("."+this.opts.itemClass)&&!t.matches("."+this.opts.placeholderClass))}isIgnoreChangeCB(){return this._ignoreLayoutsNodeChange}destroy(t=!0){var r,i;if(this.el)return this.offAll(),this._updateResizeEvent(!0),this.setStatic(!0,!1),this.setAnimation(!1),t?this.el.parentNode.removeChild(this.el):(this.removeAll(t),this.el.classList.remove(this._styleSheetClass),this.el.removeAttribute("gs-current-row")),this._removeStylesheet(),(r=this.parentGridNode)==null||delete r.subGrid,delete this.parentGridNode,delete this.opts,(i=this._placeholder)==null||delete i.gridstackNode,delete this._placeholder,delete this.engine,delete this.el.gridstack,delete this.el,this}float(t){return this.opts.float!==t&&(this.opts.float=this.engine.float=t,this._triggerChangeEvent()),this}getFloat(){return this.engine.float}getCellFromPixel(t,r=!1){const i=this.el.getBoundingClientRect();let o;r?o={top:i.top+document.documentElement.scrollTop,left:i.left}:o={top:this.el.offsetTop,left:this.el.offsetLeft};const u=t.left-o.left,f=t.top-o.top,d=i.width/this.getColumn(),p=i.height/parseInt(this.el.getAttribute("gs-current-row"));return{x:Math.floor(u/d),y:Math.floor(f/p)}}getRow(){return Math.max(this.engine.getRow(),this.opts.minRow)}isAreaEmpty(t,r,i,o){return this.engine.isAreaEmpty(t,r,i,o)}makeWidget(t,r){const i=Ne.getElement(t);if(!i)return;i.parentElement||this.el.appendChild(i),this._prepareElement(i,!0,r);const o=i.gridstackNode;this._updateContainerHeight(),o.subGridOpts&&this.makeSubGrid(i,o.subGridOpts,void 0,!1);let u;return this.opts.column===1&&!this._ignoreLayoutsNodeChange&&(u=this._ignoreLayoutsNodeChange=!0),this._triggerAddEvent(),this._triggerChangeEvent(),u&&delete this._ignoreLayoutsNodeChange,i}on(t,r){return t.indexOf(" ")!==-1?(t.split(" ").forEach(o=>this.on(o,r)),this):(t==="change"||t==="added"||t==="removed"||t==="enable"||t==="disable"?(t==="enable"||t==="disable"?this._gsEventHandler[t]=o=>r(o):this._gsEventHandler[t]=o=>{o.detail&&r(o,o.detail)},this.el.addEventListener(t,this._gsEventHandler[t])):t==="drag"||t==="dragstart"||t==="dragstop"||t==="resizestart"||t==="resize"||t==="resizestop"||t==="dropped"||t==="resizecontent"?this._gsEventHandler[t]=r:console.error("GridStack.on("+t+") event not supported"),this)}off(t){return t.indexOf(" ")!==-1?(t.split(" ").forEach(i=>this.off(i)),this):((t==="change"||t==="added"||t==="removed"||t==="enable"||t==="disable")&&this._gsEventHandler[t]&&this.el.removeEventListener(t,this._gsEventHandler[t]),delete this._gsEventHandler[t],this)}offAll(){return Object.keys(this._gsEventHandler).forEach(t=>this.off(t)),this}removeWidget(t,r=!0,i=!0){return t?(Ne.getElements(t).forEach(o=>{if(o.parentElement&&o.parentElement!==this.el)return;let u=o.gridstackNode;u||(u=this.engine.nodes.find(f=>o===f.el)),u&&(r&&Ne.addRemoveCB&&Ne.addRemoveCB(this.el,u,!1,!1),delete o.gridstackNode,this._removeDD(o),this.engine.removeNode(u,r,i),r&&o.parentElement&&o.remove())}),i&&(this._triggerRemoveEvent(),this._triggerChangeEvent()),this):(console.error("Error: GridStack.removeWidget(undefined) called"),this)}removeAll(t=!0,r=!0){return this.engine.nodes.forEach(i=>{t&&Ne.addRemoveCB&&Ne.addRemoveCB(this.el,i,!1,!1),delete i.el.gridstackNode,this.opts.staticGrid||this._removeDD(i.el)}),this.engine.removeAll(t,r),r&&this._triggerRemoveEvent(),this}setAnimation(t=this.opts.animate,r){return r?setTimeout(()=>{this.opts&&this.setAnimation(t)}):t?this.el.classList.add("grid-stack-animate"):this.el.classList.remove("grid-stack-animate"),this}hasAnimationCSS(){return this.el.classList.contains("grid-stack-animate")}setStatic(t,r=!0,i=!0){return!!this.opts.staticGrid===t?this:(t?this.opts.staticGrid=!0:delete this.opts.staticGrid,this._setupRemoveDrop(),this._setupAcceptWidget(),this.engine.nodes.forEach(o=>{this.prepareDragDrop(o.el),o.subGrid&&i&&o.subGrid.setStatic(t,r,i)}),r&&this._setStaticClass(),this)}updateOptions(t){var i;const r=this.opts;return t.acceptWidgets!==void 0&&this._setupAcceptWidget(),t.animate!==void 0&&this.setAnimation(),t.cellHeight&&(this.cellHeight(t.cellHeight,!0),delete t.cellHeight),t.class&&t.class!==r.class&&(r.class&&this.el.classList.remove(r.class),this.el.classList.add(t.class)),typeof t.column=="number"&&!t.columnOpts&&(this.column(t.column),delete t.column),t.margin!==void 0&&this.margin(t.margin),t.staticGrid!==void 0&&this.setStatic(t.staticGrid),t.disableDrag!==void 0&&!t.staticGrid&&this.enableMove(!t.disableDrag),t.disableResize!==void 0&&!t.staticGrid&&this.enableResize(!t.disableResize),t.float!==void 0&&this.float(t.float),t.row!==void 0&&(r.minRow=r.maxRow=t.row),(i=t.children)!=null&&i.length&&(this.load(t.children),delete t.children),this.opts={...this.opts,...t},this}update(t,r){return Ne.getElements(t).forEach(i=>{var w;const o=i==null?void 0:i.gridstackNode;if(!o)return;const u={...A.copyPos({},o),...A.cloneDeep(r)};this.engine.nodeBoundFix(u),delete u.autoPosition;const f=["x","y","w","h"];let d;if(f.some(v=>u[v]!==void 0&&u[v]!==o[v])&&(d={},f.forEach(v=>{d[v]=u[v]!==void 0?u[v]:o[v],delete u[v]})),!d&&(u.minW||u.minH||u.maxW||u.maxH)&&(d={}),u.content!==void 0){const v=i.querySelector(".grid-stack-item-content");v&&v.textContent!==u.content&&(o.content=u.content,Ne.renderCB(v,u),(w=o.subGrid)!=null&&w.el&&(v.appendChild(o.subGrid.el),o.subGrid.opts.styleInHead||o.subGrid._updateStyles(!0))),delete u.content}let p=!1,m=!1;for(const v in u)v[0]!=="_"&&o[v]!==u[v]&&(o[v]=u[v],p=!0,m=m||!this.opts.staticGrid&&(v==="noResize"||v==="noMove"||v==="locked"));if(A.sanitizeMinMax(o),d){const v=d.w!==void 0&&d.w!==o.w;this.moveNode(o,d),v&&o.subGrid?o.subGrid.onResize(this.hasAnimationCSS()?o.w:void 0):this.resizeToContentCheck(v,o),delete o._orig}(d||p)&&this._writeAttr(i,o),m&&this.prepareDragDrop(o.el)}),this}moveNode(t,r){const i=t._updating;i||this.engine.cleanNodes().beginUpdate(t),this.engine.moveNode(t,r),this._updateContainerHeight(),i||(this._triggerChangeEvent(),this.engine.endUpdate())}resizeToContent(t){var x,z;if(!t||(t.classList.remove("size-to-content-max"),!t.clientHeight))return;const r=t.gridstackNode;if(!r)return;const i=r.grid;if(!i||t.parentElement!==i.el)return;const o=i.getCellHeight(!0);if(!o)return;let u=r.h?r.h*o:t.clientHeight,f;if(r.resizeToContentParent&&(f=t.querySelector(r.resizeToContentParent)),f||(f=t.querySelector(Ne.resizeToContentParent)),!f)return;const d=t.clientHeight-f.clientHeight,p=r.h?r.h*o-d:f.clientHeight;let m;if(r.subGrid){m=r.subGrid.getRow()*r.subGrid.getCellHeight(!0);const R=r.subGrid.el.getBoundingClientRect(),k=r.subGrid.el.parentElement.getBoundingClientRect();m+=R.top-k.top}else{if((z=(x=r.subGridOpts)==null?void 0:x.children)!=null&&z.length)return;{const R=f.firstElementChild;if(!R){console.error(`Error: GridStack.resizeToContent() widget id:${r.id} '${Ne.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return}m=R.getBoundingClientRect().height||p}}if(p===m)return;u+=m-p;let w=Math.ceil(u/o);const v=Number.isInteger(r.sizeToContent)?r.sizeToContent:0;v&&w>v&&(w=v,t.classList.add("size-to-content-max")),r.minH&&wr.maxH&&(w=r.maxH),w!==r.h&&(i._ignoreLayoutsNodeChange=!0,i.moveNode(r,{h:w}),delete i._ignoreLayoutsNodeChange)}resizeToContentCBCheck(t){Ne.resizeToContentCB?Ne.resizeToContentCB(t):this.resizeToContent(t)}rotate(t,r){return Ne.getElements(t).forEach(i=>{const o=i.gridstackNode;if(!A.canBeRotated(o))return;const u={w:o.h,h:o.w,minH:o.minW,minW:o.minH,maxH:o.maxW,maxW:o.maxH};if(r){const d=r.left>0?Math.floor(r.left/this.cellWidth()):0,p=r.top>0?Math.floor(r.top/this.opts.cellHeight):0;u.x=o.x+d-(o.h-(p+1)),u.y=o.y+p-d}Object.keys(u).forEach(d=>{u[d]===void 0&&delete u[d]});const f=o._orig;this.update(i,u),o._orig=f}),this}margin(t){if(!(typeof t=="string"&&t.split(" ").length>1)){const i=A.parseHeight(t);if(this.opts.marginUnit===i.unit&&this.opts.margin===i.h)return}return this.opts.margin=t,this.opts.marginTop=this.opts.marginBottom=this.opts.marginLeft=this.opts.marginRight=void 0,this._initMargin(),this._updateStyles(!0),this}getMargin(){return this.opts.margin}willItFit(t){if(arguments.length>1){console.warn("gridstack.ts: `willItFit(x,y,w,h,autoPosition)` is deprecated. Use `willItFit({x, y,...})`. It will be removed soon");const r=arguments;let i=0,o={x:r[i++],y:r[i++],w:r[i++],h:r[i++],autoPosition:r[i++]};return this.willItFit(o)}return this.engine.willItFit(t)}_triggerChangeEvent(){if(this.engine.batchMode)return this;const t=this.engine.getDirtyNodes(!0);return t&&t.length&&(this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(t),this._triggerEvent("change",t)),this.engine.saveInitial(),this}_triggerAddEvent(){var t;if(this.engine.batchMode)return this;if((t=this.engine.addedNodes)!=null&&t.length){this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(this.engine.addedNodes),this.engine.addedNodes.forEach(i=>{delete i._dirty});const r=[...this.engine.addedNodes];this.engine.addedNodes=[],this._triggerEvent("added",r)}return this}_triggerRemoveEvent(){var t;if(this.engine.batchMode)return this;if((t=this.engine.removedNodes)!=null&&t.length){const r=[...this.engine.removedNodes];this.engine.removedNodes=[],this._triggerEvent("removed",r)}return this}_triggerEvent(t,r){const i=r?new CustomEvent(t,{bubbles:!1,detail:r}):new Event(t);return this.el.dispatchEvent(i),this}_removeStylesheet(){if(this._styles){const t=this.opts.styleInHead?void 0:this.el.parentNode;A.removeStylesheet(this._styleSheetClass,t),delete this._styles}return this}_updateStyles(t=!1,r){if(t&&this._removeStylesheet(),r===void 0&&(r=this.getRow()),this._updateContainerHeight(),this.opts.cellHeight===0)return this;const i=this.opts.cellHeight,o=this.opts.cellHeightUnit,u=`.${this._styleSheetClass} > .${this.opts.itemClass}`;if(!this._styles){const f=this.opts.styleInHead?void 0:this.el.parentNode;if(this._styles=A.createStylesheet(this._styleSheetClass,f,{nonce:this.opts.nonce}),!this._styles)return this;this._styles._max=0,A.addCSSRule(this._styles,u,`height: ${i}${o}`);const d=this.opts.marginTop+this.opts.marginUnit,p=this.opts.marginBottom+this.opts.marginUnit,m=this.opts.marginRight+this.opts.marginUnit,w=this.opts.marginLeft+this.opts.marginUnit,v=`${u} > .grid-stack-item-content`,x=`.${this._styleSheetClass} > .grid-stack-placeholder > .placeholder-content`;A.addCSSRule(this._styles,v,`top: ${d}; right: ${m}; bottom: ${p}; left: ${w};`),A.addCSSRule(this._styles,x,`top: ${d}; right: ${m}; bottom: ${p}; left: ${w};`),A.addCSSRule(this._styles,`${u} > .ui-resizable-n`,`top: ${d};`),A.addCSSRule(this._styles,`${u} > .ui-resizable-s`,`bottom: ${p}`),A.addCSSRule(this._styles,`${u} > .ui-resizable-ne`,`right: ${m}; top: ${d}`),A.addCSSRule(this._styles,`${u} > .ui-resizable-e`,`right: ${m}`),A.addCSSRule(this._styles,`${u} > .ui-resizable-se`,`right: ${m}; bottom: ${p}`),A.addCSSRule(this._styles,`${u} > .ui-resizable-nw`,`left: ${w}; top: ${d}`),A.addCSSRule(this._styles,`${u} > .ui-resizable-w`,`left: ${w}`),A.addCSSRule(this._styles,`${u} > .ui-resizable-sw`,`left: ${w}; bottom: ${p}`)}if(r=r||this._styles._max,r>this._styles._max){const f=d=>i*d+o;for(let d=this._styles._max+1;d<=r;d++)A.addCSSRule(this._styles,`${u}[gs-y="${d}"]`,`top: ${f(d)}`),A.addCSSRule(this._styles,`${u}[gs-h="${d+1}"]`,`height: ${f(d+1)}`);this._styles._max=r}return this}_updateContainerHeight(){if(!this.engine||this.engine.batchMode)return this;const t=this.parentGridNode;let r=this.getRow()+this._extraDragRow;const i=this.opts.cellHeight,o=this.opts.cellHeightUnit;if(!i)return this;if(!t){const u=A.parseHeight(getComputedStyle(this.el).minHeight);if(u.h>0&&u.unit===o){const f=Math.floor(u.h/i);r1?t.setAttribute("gs-w",String(r.w)):t.removeAttribute("gs-w"),r.h>1?t.setAttribute("gs-h",String(r.h)):t.removeAttribute("gs-h"),this}_writeAttr(t,r){if(!r)return this;this._writePosAttr(t,r);const i={noResize:"gs-no-resize",noMove:"gs-no-move",locked:"gs-locked",id:"gs-id",sizeToContent:"gs-size-to-content"};for(const o in i)r[o]?t.setAttribute(i[o],String(r[o])):t.removeAttribute(i[o]);return this}_readAttr(t,r=!0){const i={};i.x=A.toNumber(t.getAttribute("gs-x")),i.y=A.toNumber(t.getAttribute("gs-y")),i.w=A.toNumber(t.getAttribute("gs-w")),i.h=A.toNumber(t.getAttribute("gs-h")),i.autoPosition=A.toBool(t.getAttribute("gs-auto-position")),i.noResize=A.toBool(t.getAttribute("gs-no-resize")),i.noMove=A.toBool(t.getAttribute("gs-no-move")),i.locked=A.toBool(t.getAttribute("gs-locked"));const o=t.getAttribute("gs-size-to-content");o&&(o==="true"||o==="false"?i.sizeToContent=A.toBool(o):i.sizeToContent=parseInt(o,10)),i.id=t.getAttribute("gs-id"),i.maxW=A.toNumber(t.getAttribute("gs-max-w")),i.minW=A.toNumber(t.getAttribute("gs-min-w")),i.maxH=A.toNumber(t.getAttribute("gs-max-h")),i.minH=A.toNumber(t.getAttribute("gs-min-h")),r&&(i.w===1&&t.removeAttribute("gs-w"),i.h===1&&t.removeAttribute("gs-h"),i.maxW&&t.removeAttribute("gs-max-w"),i.minW&&t.removeAttribute("gs-min-w"),i.maxH&&t.removeAttribute("gs-max-h"),i.minH&&t.removeAttribute("gs-min-h"));for(const u in i){if(!i.hasOwnProperty(u))return;!i[u]&&i[u]!==0&&u!=="gs-size-to-content"&&delete i[u]}return i}_setStaticClass(){const t=["grid-stack-static"];return this.opts.staticGrid?(this.el.classList.add(...t),this.el.setAttribute("gs-static","true")):(this.el.classList.remove(...t),this.el.removeAttribute("gs-static")),this}onResize(t=(r=>(r=this.el)==null?void 0:r.clientWidth)()){if(!t||this.prevWidth===t)return;this.prevWidth=t,this.batchUpdate();let i=!1;return this._autoColumn&&this.parentGridNode?this.opts.column!==this.parentGridNode.w&&(this.column(this.parentGridNode.w,this.opts.layout||"list"),i=!0):i=this.checkDynamicColumn(),this._isAutoCellHeight&&this.cellHeight(),this.engine.nodes.forEach(o=>{o.subGrid&&o.subGrid.onResize()}),this._skipInitialResize||this.resizeToContentCheck(i),delete this._skipInitialResize,this.batchUpdate(!1),this}resizeToContentCheck(t=!1,r=void 0){if(this.engine){if(t&&this.hasAnimationCSS())return setTimeout(()=>this.resizeToContentCheck(!1,r),this.animationDelay);if(r)A.shouldSizeToContent(r)&&this.resizeToContentCBCheck(r.el);else if(this.engine.nodes.some(i=>A.shouldSizeToContent(i))){const i=[...this.engine.nodes];this.batchUpdate(),i.forEach(o=>{A.shouldSizeToContent(o)&&this.resizeToContentCBCheck(o.el)}),this.batchUpdate(!1)}this._gsEventHandler.resizecontent&&this._gsEventHandler.resizecontent(null,r?[r]:this.engine.nodes)}}_updateResizeEvent(t=!1){const r=!this.parentGridNode&&(this._isAutoCellHeight||this.opts.sizeToContent||this.opts.columnOpts||this.engine.nodes.find(i=>i.sizeToContent));return!t&&r&&!this.resizeObserver?(this._sizeThrottle=A.throttle(()=>this.onResize(),this.opts.cellHeightThrottle),this.resizeObserver=new ResizeObserver(()=>this._sizeThrottle()),this.resizeObserver.observe(this.el),this._skipInitialResize=!0):(t||!r)&&this.resizeObserver&&(this.resizeObserver.disconnect(),delete this.resizeObserver,delete this._sizeThrottle),this}static getElement(t=".grid-stack-item"){return A.getElement(t)}static getElements(t=".grid-stack-item"){return A.getElements(t)}static getGridElement(t){return Ne.getElement(t)}static getGridElements(t){return A.getElements(t)}_initMargin(){let t,r=0,i=[];return typeof this.opts.margin=="string"&&(i=this.opts.margin.split(" ")),i.length===2?(this.opts.marginTop=this.opts.marginBottom=i[0],this.opts.marginLeft=this.opts.marginRight=i[1]):i.length===4?(this.opts.marginTop=i[0],this.opts.marginRight=i[1],this.opts.marginBottom=i[2],this.opts.marginLeft=i[3]):(t=A.parseHeight(this.opts.margin),this.opts.marginUnit=t.unit,r=this.opts.margin=t.h),this.opts.marginTop===void 0?this.opts.marginTop=r:(t=A.parseHeight(this.opts.marginTop),this.opts.marginTop=t.h,delete this.opts.margin),this.opts.marginBottom===void 0?this.opts.marginBottom=r:(t=A.parseHeight(this.opts.marginBottom),this.opts.marginBottom=t.h,delete this.opts.margin),this.opts.marginRight===void 0?this.opts.marginRight=r:(t=A.parseHeight(this.opts.marginRight),this.opts.marginRight=t.h,delete this.opts.margin),this.opts.marginLeft===void 0?this.opts.marginLeft=r:(t=A.parseHeight(this.opts.marginLeft),this.opts.marginLeft=t.h,delete this.opts.margin),this.opts.marginUnit=t.unit,this.opts.marginTop===this.opts.marginBottom&&this.opts.marginLeft===this.opts.marginRight&&this.opts.marginTop===this.opts.marginRight&&(this.opts.margin=this.opts.marginTop),this}static getDD(){return $n}static setupDragIn(t,r,i,o=document){(r==null?void 0:r.pause)!==void 0&&(Le.pauseDrag=r.pause),r={appendTo:"body",helper:"clone",...r||{}},(typeof t=="string"?A.getElements(t,o):t).forEach((f,d)=>{$n.isDraggable(f)||$n.dragIn(f,r),i!=null&&i[d]&&(f.gridstackNode=i[d])})}movable(t,r){return this.opts.staticGrid?this:(Ne.getElements(t).forEach(i=>{const o=i.gridstackNode;o&&(r?delete o.noMove:o.noMove=!0,this.prepareDragDrop(o.el))}),this)}resizable(t,r){return this.opts.staticGrid?this:(Ne.getElements(t).forEach(i=>{const o=i.gridstackNode;o&&(r?delete o.noResize:o.noResize=!0,this.prepareDragDrop(o.el))}),this)}disable(t=!0){if(!this.opts.staticGrid)return this.enableMove(!1,t),this.enableResize(!1,t),this._triggerEvent("disable"),this}enable(t=!0){if(!this.opts.staticGrid)return this.enableMove(!0,t),this.enableResize(!0,t),this._triggerEvent("enable"),this}enableMove(t,r=!0){return this.opts.staticGrid?this:(t?delete this.opts.disableDrag:this.opts.disableDrag=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&r&&i.subGrid.enableMove(t,r)}),this)}enableResize(t,r=!0){return this.opts.staticGrid?this:(t?delete this.opts.disableResize:this.opts.disableResize=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&r&&i.subGrid.enableResize(t,r)}),this)}cancelDrag(){var r;const t=(r=this._placeholder)==null?void 0:r.gridstackNode;t&&(t._isExternal?(t._isAboutToRemove=!0,this.engine.removeNode(t)):t._isAboutToRemove&&Ne._itemRemoving(t.el,!1),this.engine.restoreInitial())}_removeDD(t){return $n.draggable(t,"destroy").resizable(t,"destroy"),t.gridstackNode&&delete t.gridstackNode._initDD,delete t.ddElement,this}_setupAcceptWidget(){if(this.opts.staticGrid||!this.opts.acceptWidgets&&!this.opts.removable)return $n.droppable(this.el,"destroy"),this;let t,r;const i=(o,u,f)=>{var x;f=f||u;const d=f.gridstackNode;if(!d)return;if(!((x=d.grid)!=null&&x.el)){f.style.transform=`scale(${1/this.dragTransform.xScale},${1/this.dragTransform.yScale})`;const z=f.getBoundingClientRect();f.style.left=z.x+(this.dragTransform.xScale-1)*(o.clientX-z.x)/this.dragTransform.xScale+"px",f.style.top=z.y+(this.dragTransform.yScale-1)*(o.clientY-z.y)/this.dragTransform.yScale+"px",f.style.transformOrigin="0px 0px"}let{top:p,left:m}=f.getBoundingClientRect();const w=this.el.getBoundingClientRect();m-=w.left,p-=w.top;const v={position:{top:p*this.dragTransform.xScale,left:m*this.dragTransform.yScale}};if(d._temporaryRemoved){if(d.x=Math.max(0,Math.round(m/r)),d.y=Math.max(0,Math.round(p/t)),delete d.autoPosition,this.engine.nodeBoundFix(d),!this.engine.willItFit(d)){if(d.autoPosition=!0,!this.engine.willItFit(d)){$n.off(u,"drag");return}d._willFitPos&&(A.copyPos(d,d._willFitPos),delete d._willFitPos)}this._onStartMoving(f,o,v,d,r,t)}else this._dragOrResize(f,o,v,d,r,t)};return $n.droppable(this.el,{accept:o=>{const u=o.gridstackNode||this._readAttr(o,!1);if((u==null?void 0:u.grid)===this)return!0;if(!this.opts.acceptWidgets)return!1;let f=!0;if(typeof this.opts.acceptWidgets=="function")f=this.opts.acceptWidgets(o);else{const d=this.opts.acceptWidgets===!0?".grid-stack-item":this.opts.acceptWidgets;f=o.matches(d)}if(f&&u&&this.opts.maxRow){const d={w:u.w,h:u.h,minW:u.minW,minH:u.minH};f=this.engine.willItFit(d)}return f}}).on(this.el,"dropover",(o,u,f)=>{let d=(f==null?void 0:f.gridstackNode)||u.gridstackNode;if((d==null?void 0:d.grid)===this&&!d._temporaryRemoved)return!1;if(d!=null&&d._sidebarOrig&&(d.w=d._sidebarOrig.w,d.h=d._sidebarOrig.h),d!=null&&d.grid&&d.grid!==this&&!d._temporaryRemoved&&d.grid._leave(u,f),f=f||u,r=this.cellWidth(),t=this.getCellHeight(!0),!d){const w=f.getAttribute("data-gs-widget")||f.getAttribute("gridstacknode");if(w){try{d=JSON.parse(w)}catch{console.error("Gridstack dropover: Bad JSON format: ",w)}f.removeAttribute("data-gs-widget"),f.removeAttribute("gridstacknode")}d||(d=this._readAttr(f)),d._sidebarOrig={w:d.w,h:d.h}}d.grid||(d.el||(d={...d}),d._isExternal=!0,f.gridstackNode=d);const p=d.w||Math.round(f.offsetWidth/r)||1,m=d.h||Math.round(f.offsetHeight/t)||1;return d.grid&&d.grid!==this?(u._gridstackNodeOrig||(u._gridstackNodeOrig=d),u.gridstackNode=d={...d,w:p,h:m,grid:this},delete d.x,delete d.y,this.engine.cleanupNode(d).nodeBoundFix(d),d._initDD=d._isExternal=d._temporaryRemoved=!0):(d.w=p,d.h=m,d._temporaryRemoved=!0),Ne._itemRemoving(d.el,!1),$n.on(u,"drag",i),i(o,u,f),!1}).on(this.el,"dropout",(o,u,f)=>{const d=(f==null?void 0:f.gridstackNode)||u.gridstackNode;return d&&(!d.grid||d.grid===this)&&(this._leave(u,f),this._isTemp&&this.removeAsSubGrid(d)),!1}).on(this.el,"drop",(o,u,f)=>{var z,R,k;const d=(f==null?void 0:f.gridstackNode)||u.gridstackNode;if((d==null?void 0:d.grid)===this&&!d._isExternal)return!1;const p=!!this.placeholder.parentElement,m=u!==f;this.placeholder.remove(),delete this.placeholder.gridstackNode;const w=p&&this.opts.animate;w&&this.setAnimation(!1);const v=u._gridstackNodeOrig;if(delete u._gridstackNodeOrig,p&&(v!=null&&v.grid)&&v.grid!==this){const b=v.grid;b.engine.removeNodeFromLayoutCache(v),b.engine.removedNodes.push(v),b._triggerRemoveEvent()._triggerChangeEvent(),b.parentGridNode&&!b.engine.nodes.length&&b.opts.subGridDynamic&&b.removeAsSubGrid()}if(!d||(p&&(this.engine.cleanupNode(d),d.grid=this),(z=d.grid)==null||delete z._isTemp,$n.off(u,"drag"),f!==u?(f.remove(),u=f):u.remove(),this._removeDD(u),!p))return!1;const x=(k=(R=d.subGrid)==null?void 0:R.el)==null?void 0:k.gridstack;return A.copyPos(d,this._readAttr(this.placeholder)),A.removePositioningStyles(u),m&&(d.content||d.subGridOpts||Ne.addRemoveCB)?(delete d.el,u=this.addWidget(d)):(this._prepareElement(u,!0,d),this.el.appendChild(u),this.resizeToContentCheck(!1,d),x&&(x.parentGridNode=d,x.opts.styleInHead||x._updateStyles(!0)),this._updateContainerHeight()),this.engine.addedNodes.push(d),this._triggerAddEvent(),this._triggerChangeEvent(),this.engine.endUpdate(),this._gsEventHandler.dropped&&this._gsEventHandler.dropped({...o,type:"dropped"},v&&v.grid?v:void 0,d),w&&this.setAnimation(this.opts.animate,!0),!1}),this}static _itemRemoving(t,r){if(!t)return;const i=t?t.gridstackNode:void 0;!(i!=null&&i.grid)||t.classList.contains(i.grid.opts.removableOptions.decline)||(r?i._isAboutToRemove=!0:delete i._isAboutToRemove,r?t.classList.add("grid-stack-item-removing"):t.classList.remove("grid-stack-item-removing"))}_setupRemoveDrop(){if(typeof this.opts.removable!="string")return this;const t=document.querySelector(this.opts.removable);return t?(!this.opts.staticGrid&&!$n.isDroppable(t)&&$n.droppable(t,this.opts.removableOptions).on(t,"dropover",(r,i)=>Ne._itemRemoving(i,!0)).on(t,"dropout",(r,i)=>Ne._itemRemoving(i,!1)),this):this}prepareDragDrop(t,r=!1){const i=t==null?void 0:t.gridstackNode;if(!i)return;const o=i.noMove||this.opts.disableDrag,u=i.noResize||this.opts.disableResize,f=this.opts.staticGrid||o&&u;if((r||f)&&(i._initDD&&(this._removeDD(t),delete i._initDD),f&&t.classList.add("ui-draggable-disabled","ui-resizable-disabled"),!r))return this;if(!i._initDD){let d,p;const m=(x,z)=>{this._gsEventHandler[x.type]&&this._gsEventHandler[x.type](x,x.target),d=this.cellWidth(),p=this.getCellHeight(!0),this._onStartMoving(t,x,z,i,d,p)},w=(x,z)=>{this._dragOrResize(t,x,z,i,d,p)},v=x=>{this.placeholder.remove(),delete this.placeholder.gridstackNode,delete i._moving,delete i._event,delete i._lastTried;const z=i.w!==i._orig.w,R=x.target;if(!(!R.gridstackNode||R.gridstackNode.grid!==this)){if(i.el=R,i._isAboutToRemove){const k=t.gridstackNode.grid;k._gsEventHandler[x.type]&&k._gsEventHandler[x.type](x,R),k.engine.nodes.push(i),k.removeWidget(t,!0,!0)}else A.removePositioningStyles(R),i._temporaryRemoved?(A.copyPos(i,i._orig),this._writePosAttr(R,i),this.engine.addNode(i)):this._writePosAttr(R,i),this._gsEventHandler[x.type]&&this._gsEventHandler[x.type](x,R);this._extraDragRow=0,this._updateContainerHeight(),this._triggerChangeEvent(),this.engine.endUpdate(),x.type==="resizestop"&&(Number.isInteger(i.sizeToContent)&&(i.sizeToContent=i.h),this.resizeToContentCheck(z,i))}};$n.draggable(t,{start:m,stop:v,drag:w}).resizable(t,{start:m,stop:v,resize:w}),i._initDD=!0}return $n.draggable(t,o?"disable":"enable").resizable(t,u?"disable":"enable"),this}_onStartMoving(t,r,i,o,u,f){var d;if(this.engine.cleanNodes().beginUpdate(o),this._writePosAttr(this.placeholder,o),this.el.appendChild(this.placeholder),this.placeholder.gridstackNode=o,(d=o.grid)!=null&&d.el)this.dragTransform=A.getValuesFromTransformedElement(t);else if(this.placeholder&&this.placeholder.closest(".grid-stack")){const p=this.placeholder.closest(".grid-stack");this.dragTransform=A.getValuesFromTransformedElement(p)}else this.dragTransform={xScale:1,xOffset:0,yScale:1,yOffset:0};if(o.el=this.placeholder,o._lastUiPosition=i.position,o._prevYPix=i.position.top,o._moving=r.type==="dragstart",delete o._lastTried,r.type==="dropover"&&o._temporaryRemoved&&(this.engine.addNode(o),o._moving=!0),this.engine.cacheRects(u,f,this.opts.marginTop,this.opts.marginRight,this.opts.marginBottom,this.opts.marginLeft),r.type==="resizestart"){const p=this.getColumn()-o.x,m=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-o.y;$n.resizable(t,"option","minWidth",u*Math.min(o.minW||1,p)).resizable(t,"option","minHeight",f*Math.min(o.minH||1,m)).resizable(t,"option","maxWidth",u*Math.min(o.maxW||Number.MAX_SAFE_INTEGER,p)).resizable(t,"option","maxWidthMoveLeft",u*Math.min(o.maxW||Number.MAX_SAFE_INTEGER,o.x+o.w)).resizable(t,"option","maxHeight",f*Math.min(o.maxH||Number.MAX_SAFE_INTEGER,m)).resizable(t,"option","maxHeightMoveUp",f*Math.min(o.maxH||Number.MAX_SAFE_INTEGER,o.y+o.h))}}_dragOrResize(t,r,i,o,u,f){const d={...o._orig};let p,m=this.opts.marginLeft,w=this.opts.marginRight,v=this.opts.marginTop,x=this.opts.marginBottom;const z=Math.round(f*.1),R=Math.round(u*.1);if(m=Math.min(m,R),w=Math.min(w,R),v=Math.min(v,z),x=Math.min(x,z),r.type==="drag"){if(o._temporaryRemoved)return;const b=i.position.top-o._prevYPix;o._prevYPix=i.position.top,this.opts.draggable.scroll!==!1&&A.updateScrollPosition(t,i.position,b);const B=i.position.left+(i.position.left>o._lastUiPosition.left?-w:m),P=i.position.top+(i.position.top>o._lastUiPosition.top?-x:v);d.x=Math.round(B/u),d.y=Math.round(P/f);const W=this._extraDragRow;if(this.engine.collide(o,d)){const V=this.getRow();let Z=Math.max(0,d.y+o.h-V);this.opts.maxRow&&V+Z>this.opts.maxRow&&(Z=Math.max(0,this.opts.maxRow-V)),this._extraDragRow=Z}else this._extraDragRow=0;if(this._extraDragRow!==W&&this._updateContainerHeight(),o.x===d.x&&o.y===d.y)return}else if(r.type==="resize"){if(d.x<0||(A.updateScrollResize(r,t,f),d.w=Math.round((i.size.width-m)/u),d.h=Math.round((i.size.height-v)/f),o.w===d.w&&o.h===d.h)||o._lastTried&&o._lastTried.w===d.w&&o._lastTried.h===d.h)return;const b=i.position.left+m,B=i.position.top+v;d.x=Math.round(b/u),d.y=Math.round(B/f),p=!0}o._event=r,o._lastTried=d;const k={x:i.position.left+m,y:i.position.top+v,w:(i.size?i.size.width:o.w*u)-m-w,h:(i.size?i.size.height:o.h*f)-v-x};if(this.engine.moveNodeCheck(o,{...d,cellWidth:u,cellHeight:f,rect:k,resizing:p})){o._lastUiPosition=i.position,this.engine.cacheRects(u,f,v,w,x,m),delete o._skipDown,p&&o.subGrid&&o.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();const b=r.target;o._sidebarOrig||this._writePosAttr(b,o),this._gsEventHandler[r.type]&&this._gsEventHandler[r.type](r,b)}}_leave(t,r){r=r||t;const i=r.gridstackNode;if(!i||(r.style.transform=r.style.transformOrigin=null,$n.off(t,"drag"),i._temporaryRemoved))return;i._temporaryRemoved=!0,this.engine.removeNode(i),i.el=i._isExternal&&r?r:t;const o=i._sidebarOrig;i._isExternal&&this.engine.cleanupNode(i),i._sidebarOrig=o,this.opts.removable===!0&&Ne._itemRemoving(t,!0),t._gridstackNodeOrig?(t.gridstackNode=t._gridstackNodeOrig,delete t._gridstackNodeOrig):i._isExternal&&this.engine.restoreInitial()}commit(){return vS(this,this.batchUpdate(!1),"commit","batchUpdate","5.2"),this}}Ne.renderCB=(l,t)=>{l&&(t!=null&&t.content)&&(l.textContent=t.content)};Ne.resizeToContentParent=".grid-stack-item-content";Ne.Utils=A;Ne.Engine=ai;Ne.GDRev="11.5.1";function xS({widget:l,onRemove:t}){const r=dS[l.kind];return U.jsxs("div",{className:"widget",children:[U.jsxs("div",{className:"widget-header",children:[U.jsx("span",{className:"widget-grip","aria-hidden":!0,children:"⠿"}),U.jsx("span",{className:"widget-icon",children:r==null?void 0:r.icon}),U.jsx("span",{className:"widget-title",children:(r==null?void 0:r.title)||l.kind}),U.jsx("button",{className:"widget-close",title:"Remove widget",onClick:t,children:"×"})]}),U.jsx("div",{className:"widget-body",children:r?r.render(l.id):null})]})}function _S(){const l=Eo(w=>w.widgets),t=Eo(w=>w.updateGeom),r=Eo(w=>w.removeWidget),i=j.useRef(null),o=j.useRef(null),u=j.useRef(new Map),[f,d]=j.useState(new Map),[p,m]=j.useState(!1);return j.useEffect(()=>{if(!i.current)return;const w=Ne.init({column:12,cellHeight:56,margin:8,float:!0,handle:".widget-header",resizable:{handles:"e, se, s, sw, w"},animate:!0},i.current);return o.current=w,w.on("change",(v,x)=>{const z=x.map(R=>({id:String(R.id),x:R.x??0,y:R.y??0,w:R.w??1,h:R.h??1}));z.length&&t(z)}),m(!0),()=>{w.destroy(!1),o.current=null}},[t]),j.useEffect(()=>{const w=o.current;if(!w||!p)return;const v=new Set(l.map(R=>R.id));let x=!1;const z=new Map(f);w.batchUpdate();for(const R of l){if(u.current.has(R.id))continue;const k=w.addWidget({x:R.x,y:R.y,w:R.w,h:R.h,id:R.id}),b=k.querySelector(".grid-stack-item-content");u.current.set(R.id,k),z.set(R.id,b),x=!0}for(const[R,k]of Array.from(u.current.entries()))v.has(R)||(w.removeWidget(k,!0),u.current.delete(R),z.delete(R),x=!0);w.commit(),x&&d(z)},[l,p]),U.jsxs("div",{className:"canvas",children:[U.jsx("div",{className:"grid-stack",ref:i}),l.map(w=>{const v=f.get(w.id);return v?bs.createPortal(U.jsx(xS,{widget:w,onRemove:()=>r(w.id)}),v,w.id):null})]})}function ES(){const l=gn(d=>d.addSignalToPlot),t=gn(d=>d.setMotorTypes),[r,i]=j.useState(null),o=ry(ny($f,{activationConstraint:{distance:4}}));j.useEffect(()=>{Im(),A1().then(t)},[t]);const u=d=>{var m;const p=(m=d.active.data.current)==null?void 0:m.signalId;i(p?If(p):null)},f=d=>{var w,v,x,z;i(null);const p=(w=d.active.data.current)==null?void 0:w.signalId,m=((x=(v=d.over)==null?void 0:v.id)==null?void 0:x.toString())||"";if(p&&m.startsWith("plot:")){const R=(z=d.over.data.current)==null?void 0:z.panelId;l(R,p)}};return U.jsxs(e0,{sensors:o,onDragStart:u,onDragEnd:f,children:[U.jsxs("div",{className:"app",children:[U.jsx(hS,{}),U.jsxs("div",{className:"body",children:[U.jsx(mS,{}),U.jsx("main",{className:"canvas-host",children:U.jsx(_S,{})})]})]}),U.jsx(S0,{dropAnimation:null,children:r?U.jsx("div",{className:"drag-ghost",children:r}):null})]})}Bv.createRoot(document.getElementById("root")).render(U.jsx(ht.StrictMode,{children:U.jsx(ES,{})})); +Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`)),i}static addGrid(t,r={}){if(!t)return null;let i=t;if(i.gridstack){const c=i.gridstack;return r&&(c.opts={...c.opts,...r}),r.children!==void 0&&c.load(r.children),c}return(!t.classList.contains("grid-stack")||Ne.addRemoveCB)&&(Ne.addRemoveCB?i=Ne.addRemoveCB(t,r,!0,!0):i=A.createDiv(["grid-stack",r.class],t)),Ne.init(r,i)}static registerEngine(t){Ne.engineClass=t}get placeholder(){if(!this._placeholder){this._placeholder=A.createDiv([this.opts.placeholderClass,yr.itemClass,this.opts.itemClass]);const t=A.createDiv(["placeholder-content"],this._placeholder);this.opts.placeholderText&&(t.textContent=this.opts.placeholderText)}return this._placeholder}constructor(t,r={}){var v,x,z;this.el=t,this.opts=r,this.animationDelay=310,this._gsEventHandler={},this._extraDragRow=0,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0},t.gridstack=this,this.opts=r=r||{},t.classList.contains("grid-stack")||this.el.classList.add("grid-stack"),r.row&&(r.minRow=r.maxRow=r.row,delete r.row);const i=A.toNumber(t.getAttribute("gs-row"));r.column==="auto"&&delete r.column,r.alwaysShowResizeHandle!==void 0&&(r._alwaysShowResizeHandle=r.alwaysShowResizeHandle);let o=(v=r.columnOpts)==null?void 0:v.breakpoints;const u=r;if(u.oneColumnModeDomSort&&(delete u.oneColumnModeDomSort,console.log("warning: Gridstack oneColumnModeDomSort no longer supported. Use GridStackOptions.columnOpts instead.")),u.oneColumnSize||u.disableOneColumnMode===!1){const R=u.oneColumnSize||768;delete u.oneColumnSize,delete u.disableOneColumnMode,r.columnOpts=r.columnOpts||{},o=r.columnOpts.breakpoints=r.columnOpts.breakpoints||[];let k=o.find(b=>b.c===1);k?k.w=R:(k={c:1,w:R},o.push(k,{c:12,w:R+1}))}const c=r.columnOpts;c&&(!c.columnWidth&&!((x=c.breakpoints)!=null&&x.length)?(delete r.columnOpts,o=void 0):c.columnMax=c.columnMax||12),(o==null?void 0:o.length)>1&&o.sort((R,k)=>(k.w||0)-(R.w||0));const d={...A.cloneDeep(yr),column:A.toNumber(t.getAttribute("gs-column"))||yr.column,minRow:i||A.toNumber(t.getAttribute("gs-min-row"))||yr.minRow,maxRow:i||A.toNumber(t.getAttribute("gs-max-row"))||yr.maxRow,staticGrid:A.toBool(t.getAttribute("gs-static"))||yr.staticGrid,sizeToContent:A.toBool(t.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(r.handleClass?"."+r.handleClass:r.handle?r.handle:"")||yr.draggable.handle},removableOptions:{accept:r.itemClass||yr.removableOptions.accept,decline:yr.removableOptions.decline}};t.getAttribute("gs-animate")&&(d.animate=A.toBool(t.getAttribute("gs-animate"))),r=A.defaults(r,d),this._initMargin(),this.checkDynamicColumn(),this.el.classList.add("gs-"+r.column),r.rtl==="auto"&&(r.rtl=t.style.direction==="rtl"),r.rtl&&this.el.classList.add("grid-stack-rtl");const p=this.el.closest("."+yr.itemClass),m=p==null?void 0:p.gridstackNode;m&&(m.subGrid=this,this.parentGridNode=m,this.el.classList.add("grid-stack-nested"),m.el.classList.add("grid-stack-sub-grid")),this._isAutoCellHeight=r.cellHeight==="auto",this._isAutoCellHeight||r.cellHeight==="initial"?this.cellHeight(void 0,!1):(typeof r.cellHeight=="number"&&r.cellHeightUnit&&r.cellHeightUnit!==yr.cellHeightUnit&&(r.cellHeight=r.cellHeight+r.cellHeightUnit,delete r.cellHeightUnit),this.cellHeight(r.cellHeight,!1)),r.alwaysShowResizeHandle==="mobile"&&(r.alwaysShowResizeHandle=Kr),this._styleSheetClass="gs-id-"+ai._idSeq++,this.el.classList.add(this._styleSheetClass),this._setStaticClass();const w=r.engineClass||Ne.engineClass||ai;if(this.engine=new w({column:this.getColumn(),float:r.float,maxRow:r.maxRow,onChange:R=>{let k=0;this.engine.nodes.forEach(b=>{k=Math.max(k,b.y+b.h)}),R.forEach(b=>{const U=b.el;U&&(b._removeDOM?(U&&U.remove(),delete b._removeDOM):this._writePosAttr(U,b))}),this._updateStyles(!1,k)}}),this._updateStyles(!1,0),r.auto&&(this.batchUpdate(),this.engine._loading=!0,this.getGridItems().forEach(R=>this._prepareElement(R)),delete this.engine._loading,this.batchUpdate(!1)),r.children){const R=r.children;delete r.children,R.length&&this.load(R)}this.setAnimation(),r.subGridDynamic&&!Le.pauseDrag&&(Le.pauseDrag=!0),((z=r.draggable)==null?void 0:z.pause)!==void 0&&(Le.pauseDrag=r.draggable.pause),this._setupRemoveDrop(),this._setupAcceptWidget(),this._updateResizeEvent()}addWidget(t){if(typeof t=="string"){console.error("V11: GridStack.addWidget() does not support string anymore. see #2736");return}if(t.ELEMENT_NODE)return console.error("V11: GridStack.addWidget() does not support HTMLElement anymore. use makeWidget()"),this.makeWidget(t);let r,i=t;if(i.grid=this,i!=null&&i.el?r=i.el:Ne.addRemoveCB?r=Ne.addRemoveCB(this.el,t,!0,!1):r=this.createWidgetDivs(i),!r)return;if(i=r.gridstackNode,i&&r.parentElement===this.el&&this.engine.nodes.find(u=>u._id===i._id))return r;const o=this._readAttr(r);return A.defaults(t,o),this.engine.prepareNode(t),this.el.appendChild(r),this.makeWidget(r,t),r}createWidgetDivs(t){const r=A.createDiv(["grid-stack-item",this.opts.itemClass]),i=A.createDiv(["grid-stack-item-content"],r);return A.lazyLoad(t)?t.visibleObservable||(t.visibleObservable=new IntersectionObserver(([o])=>{var u,c;o.isIntersecting&&((u=t.visibleObservable)==null||u.disconnect(),delete t.visibleObservable,Ne.renderCB(i,t),(c=t.grid)==null||c.prepareDragDrop(t.el))}),window.setTimeout(()=>{var o;return(o=t.visibleObservable)==null?void 0:o.observe(r)})):Ne.renderCB(i,t),r}makeSubGrid(t,r,i,o=!0){var z,R,k;let u=t.gridstackNode;if(u||(u=this.makeWidget(t).gridstackNode),(z=u.subGrid)!=null&&z.el)return u.subGrid;let c,d=this;for(;d&&!c;)c=(R=d.opts)==null?void 0:R.subGridOpts,d=(k=d.parentGridNode)==null?void 0:k.grid;r=A.cloneDeep({...this.opts,id:void 0,children:void 0,column:"auto",columnOpts:void 0,layout:"list",subGridOpts:void 0,...c||{},...r||u.subGridOpts||{}}),u.subGridOpts=r;let p;r.column==="auto"&&(p=!0,r.column=Math.max(u.w||1,(i==null?void 0:i.w)||1),delete r.columnOpts);let m=u.el.querySelector(".grid-stack-item-content"),w,v;if(o&&(this._removeDD(u.el),v={...u,x:0,y:0},A.removeInternalForSave(v),delete v.subGridOpts,u.content&&(v.content=u.content,delete u.content),Ne.addRemoveCB?w=Ne.addRemoveCB(this.el,v,!0,!1):(w=A.createDiv(["grid-stack-item"]),w.appendChild(m),m=A.createDiv(["grid-stack-item-content"],u.el)),this.prepareDragDrop(u.el)),i){const b=p?r.column:u.w,U=u.h+i.h,P=u.el.style;P.transition="none",this.update(u.el,{w:b,h:U}),setTimeout(()=>P.transition=null)}const x=u.subGrid=Ne.addGrid(m,r);return i!=null&&i._moving&&(x._isTemp=!0),p&&(x._autoColumn=!0),o&&x.makeWidget(w,v),i&&(i._moving?window.setTimeout(()=>A.simulateMouseEvent(i._event,"mouseenter",x.el),0):x.makeWidget(u.el,u)),this.resizeToContentCheck(!1,u),x}removeAsSubGrid(t){var i;const r=(i=this.parentGridNode)==null?void 0:i.grid;r&&(r.batchUpdate(),r.removeWidget(this.parentGridNode.el,!0,!0),this.engine.nodes.forEach(o=>{o.x+=this.parentGridNode.x,o.y+=this.parentGridNode.y,r.makeWidget(o.el,o)}),r.batchUpdate(!1),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,t&&window.setTimeout(()=>A.simulateMouseEvent(t._event,"mouseenter",r.el),0))}save(t=!0,r=!1,i=Ne.saveCB){const o=this.engine.save(t,i);if(o.forEach(u=>{var c;if(t&&u.el&&!u.subGrid&&!i){const d=u.el.querySelector(".grid-stack-item-content");u.content=d==null?void 0:d.innerHTML,u.content||delete u.content}else if(!t&&!i&&delete u.content,(c=u.subGrid)!=null&&c.el){const d=u.subGrid.save(t,r,i);u.subGridOpts=r?d:{children:d},delete u.subGrid}delete u.el}),r){const u=A.cloneDeep(this.opts);u.marginBottom===u.marginTop&&u.marginRight===u.marginLeft&&u.marginTop===u.marginRight&&(u.margin=u.marginTop,delete u.marginTop,delete u.marginRight,delete u.marginBottom,delete u.marginLeft),u.rtl===(this.el.style.direction==="rtl")&&(u.rtl="auto"),this._isAutoCellHeight&&(u.cellHeight="auto"),this._autoColumn&&(u.column="auto");const c=u._alwaysShowResizeHandle;return delete u._alwaysShowResizeHandle,c!==void 0?u.alwaysShowResizeHandle=c:delete u.alwaysShowResizeHandle,A.removeInternalAndSame(u,yr),u.children=o,u}return o}load(t,r=Ne.addRemoveCB||!0){var m;t=A.cloneDeep(t);const i=this.getColumn();t.forEach(w=>{w.w=w.w||1,w.h=w.h||1}),t=A.sort(t),this.engine.skipCacheUpdate=this._ignoreLayoutsNodeChange=!0;let o=0;t.forEach(w=>{o=Math.max(o,(w.x||0)+w.w)}),o>this.engine.defaultColumn&&(this.engine.defaultColumn=o),o>i&&this.engine.cacheLayout(t,o,!0);const u=Ne.addRemoveCB;typeof r=="function"&&(Ne.addRemoveCB=r);const c=[];this.batchUpdate();const d=!this.engine.nodes.length;d&&this.setAnimation(!1),!d&&r&&[...this.engine.nodes].forEach(v=>{if(!v.id)return;A.find(t,v.id)||(Ne.addRemoveCB&&Ne.addRemoveCB(this.el,v,!1,!1),c.push(v),this.removeWidget(v.el,!0,!1))}),this.engine._loading=!0;const p=[];return this.engine.nodes=this.engine.nodes.filter(w=>A.find(t,w.id)?(p.push(w),!1):!0),t.forEach(w=>{var x;const v=A.find(p,w.id);if(v){if(A.shouldSizeToContent(v)&&(w.h=v.h),this.engine.nodeBoundFix(w),(w.autoPosition||w.x===void 0||w.y===void 0)&&(w.w=w.w||v.w,w.h=w.h||v.h,this.engine.findEmptyPosition(w)),this.engine.nodes.push(v),A.samePos(v,w)&&this.engine.nodes.length>1&&(this.moveNode(v,{...w,forceCollide:!0}),A.copyPos(w,v)),this.update(v.el,w),(x=w.subGridOpts)!=null&&x.children){const z=v.el.querySelector(".grid-stack");z&&z.gridstack&&z.gridstack.load(w.subGridOpts.children)}}else r&&this.addWidget(w)}),delete this.engine._loading,this.engine.removedNodes=c,this.batchUpdate(!1),delete this._ignoreLayoutsNodeChange,delete this.engine.skipCacheUpdate,u?Ne.addRemoveCB=u:delete Ne.addRemoveCB,d&&((m=this.opts)!=null&&m.animate)&&this.setAnimation(this.opts.animate,!0),this}batchUpdate(t=!0){return this.engine.batchUpdate(t),t||(this._updateContainerHeight(),this._triggerRemoveEvent(),this._triggerAddEvent(),this._triggerChangeEvent()),this}getCellHeight(t=!1){if(this.opts.cellHeight&&this.opts.cellHeight!=="auto"&&(!t||!this.opts.cellHeightUnit||this.opts.cellHeightUnit==="px"))return this.opts.cellHeight;if(this.opts.cellHeightUnit==="rem")return this.opts.cellHeight*parseFloat(getComputedStyle(document.documentElement).fontSize);if(this.opts.cellHeightUnit==="em")return this.opts.cellHeight*parseFloat(getComputedStyle(this.el).fontSize);if(this.opts.cellHeightUnit==="cm")return this.opts.cellHeight*(96/2.54);if(this.opts.cellHeightUnit==="mm")return this.opts.cellHeight*(96/2.54)/10;const r=this.el.querySelector("."+this.opts.itemClass);if(r){const o=A.toNumber(r.getAttribute("gs-h"))||1;return Math.round(r.offsetHeight/o)}const i=parseInt(this.el.getAttribute("gs-current-row"));return i?Math.round(this.el.getBoundingClientRect().height/i):this.opts.cellHeight}cellHeight(t,r=!0){if(r&&t!==void 0&&this._isAutoCellHeight!==(t==="auto")&&(this._isAutoCellHeight=t==="auto",this._updateResizeEvent()),(t==="initial"||t==="auto")&&(t=void 0),t===void 0){const o=-this.opts.marginRight-this.opts.marginLeft+this.opts.marginTop+this.opts.marginBottom;t=this.cellWidth()+o}const i=A.parseHeight(t);return this.opts.cellHeightUnit===i.unit&&this.opts.cellHeight===i.h?this:(this.opts.cellHeightUnit=i.unit,this.opts.cellHeight=i.h,this.resizeToContentCheck(),r&&this._updateStyles(!0),this)}cellWidth(){return this._widthOrContainer()/this.getColumn()}_widthOrContainer(t=!1){var r;return t&&((r=this.opts.columnOpts)!=null&&r.breakpointForWindow)?window.innerWidth:this.el.clientWidth||this.el.parentElement.clientWidth||window.innerWidth}checkDynamicColumn(){var u,c;const t=this.opts.columnOpts;if(!t||!t.columnWidth&&!((u=t.breakpoints)!=null&&u.length))return!1;const r=this.getColumn();let i=r;const o=this._widthOrContainer(!0);if(t.columnWidth)i=Math.min(Math.round(o/t.columnWidth)||1,t.columnMax);else{i=t.columnMax;let d=0;for(;dp.c===i);return this.column(i,(d==null?void 0:d.layout)||t.layout),!0}return!1}compact(t="compact",r=!0){return this.engine.compact(t,r),this._triggerChangeEvent(),this}column(t,r="moveScale"){if(!t||t<1||this.opts.column===t)return this;const i=this.getColumn();return this.opts.column=t,this.engine?(this.engine.column=t,this.el.classList.remove("gs-"+i),this.el.classList.add("gs-"+t),this.engine.columnChanged(i,t,r),this._isAutoCellHeight&&this.cellHeight(),this.resizeToContentCheck(!0),this._ignoreLayoutsNodeChange=!0,this._triggerChangeEvent(),delete this._ignoreLayoutsNodeChange,this):this}getColumn(){return this.opts.column}getGridItems(){return Array.from(this.el.children).filter(t=>t.matches("."+this.opts.itemClass)&&!t.matches("."+this.opts.placeholderClass))}isIgnoreChangeCB(){return this._ignoreLayoutsNodeChange}destroy(t=!0){var r,i;if(this.el)return this.offAll(),this._updateResizeEvent(!0),this.setStatic(!0,!1),this.setAnimation(!1),t?this.el.parentNode.removeChild(this.el):(this.removeAll(t),this.el.classList.remove(this._styleSheetClass),this.el.removeAttribute("gs-current-row")),this._removeStylesheet(),(r=this.parentGridNode)==null||delete r.subGrid,delete this.parentGridNode,delete this.opts,(i=this._placeholder)==null||delete i.gridstackNode,delete this._placeholder,delete this.engine,delete this.el.gridstack,delete this.el,this}float(t){return this.opts.float!==t&&(this.opts.float=this.engine.float=t,this._triggerChangeEvent()),this}getFloat(){return this.engine.float}getCellFromPixel(t,r=!1){const i=this.el.getBoundingClientRect();let o;r?o={top:i.top+document.documentElement.scrollTop,left:i.left}:o={top:this.el.offsetTop,left:this.el.offsetLeft};const u=t.left-o.left,c=t.top-o.top,d=i.width/this.getColumn(),p=i.height/parseInt(this.el.getAttribute("gs-current-row"));return{x:Math.floor(u/d),y:Math.floor(c/p)}}getRow(){return Math.max(this.engine.getRow(),this.opts.minRow)}isAreaEmpty(t,r,i,o){return this.engine.isAreaEmpty(t,r,i,o)}makeWidget(t,r){const i=Ne.getElement(t);if(!i)return;i.parentElement||this.el.appendChild(i),this._prepareElement(i,!0,r);const o=i.gridstackNode;this._updateContainerHeight(),o.subGridOpts&&this.makeSubGrid(i,o.subGridOpts,void 0,!1);let u;return this.opts.column===1&&!this._ignoreLayoutsNodeChange&&(u=this._ignoreLayoutsNodeChange=!0),this._triggerAddEvent(),this._triggerChangeEvent(),u&&delete this._ignoreLayoutsNodeChange,i}on(t,r){return t.indexOf(" ")!==-1?(t.split(" ").forEach(o=>this.on(o,r)),this):(t==="change"||t==="added"||t==="removed"||t==="enable"||t==="disable"?(t==="enable"||t==="disable"?this._gsEventHandler[t]=o=>r(o):this._gsEventHandler[t]=o=>{o.detail&&r(o,o.detail)},this.el.addEventListener(t,this._gsEventHandler[t])):t==="drag"||t==="dragstart"||t==="dragstop"||t==="resizestart"||t==="resize"||t==="resizestop"||t==="dropped"||t==="resizecontent"?this._gsEventHandler[t]=r:console.error("GridStack.on("+t+") event not supported"),this)}off(t){return t.indexOf(" ")!==-1?(t.split(" ").forEach(i=>this.off(i)),this):((t==="change"||t==="added"||t==="removed"||t==="enable"||t==="disable")&&this._gsEventHandler[t]&&this.el.removeEventListener(t,this._gsEventHandler[t]),delete this._gsEventHandler[t],this)}offAll(){return Object.keys(this._gsEventHandler).forEach(t=>this.off(t)),this}removeWidget(t,r=!0,i=!0){return t?(Ne.getElements(t).forEach(o=>{if(o.parentElement&&o.parentElement!==this.el)return;let u=o.gridstackNode;u||(u=this.engine.nodes.find(c=>o===c.el)),u&&(r&&Ne.addRemoveCB&&Ne.addRemoveCB(this.el,u,!1,!1),delete o.gridstackNode,this._removeDD(o),this.engine.removeNode(u,r,i),r&&o.parentElement&&o.remove())}),i&&(this._triggerRemoveEvent(),this._triggerChangeEvent()),this):(console.error("Error: GridStack.removeWidget(undefined) called"),this)}removeAll(t=!0,r=!0){return this.engine.nodes.forEach(i=>{t&&Ne.addRemoveCB&&Ne.addRemoveCB(this.el,i,!1,!1),delete i.el.gridstackNode,this.opts.staticGrid||this._removeDD(i.el)}),this.engine.removeAll(t,r),r&&this._triggerRemoveEvent(),this}setAnimation(t=this.opts.animate,r){return r?setTimeout(()=>{this.opts&&this.setAnimation(t)}):t?this.el.classList.add("grid-stack-animate"):this.el.classList.remove("grid-stack-animate"),this}hasAnimationCSS(){return this.el.classList.contains("grid-stack-animate")}setStatic(t,r=!0,i=!0){return!!this.opts.staticGrid===t?this:(t?this.opts.staticGrid=!0:delete this.opts.staticGrid,this._setupRemoveDrop(),this._setupAcceptWidget(),this.engine.nodes.forEach(o=>{this.prepareDragDrop(o.el),o.subGrid&&i&&o.subGrid.setStatic(t,r,i)}),r&&this._setStaticClass(),this)}updateOptions(t){var i;const r=this.opts;return t.acceptWidgets!==void 0&&this._setupAcceptWidget(),t.animate!==void 0&&this.setAnimation(),t.cellHeight&&(this.cellHeight(t.cellHeight,!0),delete t.cellHeight),t.class&&t.class!==r.class&&(r.class&&this.el.classList.remove(r.class),this.el.classList.add(t.class)),typeof t.column=="number"&&!t.columnOpts&&(this.column(t.column),delete t.column),t.margin!==void 0&&this.margin(t.margin),t.staticGrid!==void 0&&this.setStatic(t.staticGrid),t.disableDrag!==void 0&&!t.staticGrid&&this.enableMove(!t.disableDrag),t.disableResize!==void 0&&!t.staticGrid&&this.enableResize(!t.disableResize),t.float!==void 0&&this.float(t.float),t.row!==void 0&&(r.minRow=r.maxRow=t.row),(i=t.children)!=null&&i.length&&(this.load(t.children),delete t.children),this.opts={...this.opts,...t},this}update(t,r){return Ne.getElements(t).forEach(i=>{var w;const o=i==null?void 0:i.gridstackNode;if(!o)return;const u={...A.copyPos({},o),...A.cloneDeep(r)};this.engine.nodeBoundFix(u),delete u.autoPosition;const c=["x","y","w","h"];let d;if(c.some(v=>u[v]!==void 0&&u[v]!==o[v])&&(d={},c.forEach(v=>{d[v]=u[v]!==void 0?u[v]:o[v],delete u[v]})),!d&&(u.minW||u.minH||u.maxW||u.maxH)&&(d={}),u.content!==void 0){const v=i.querySelector(".grid-stack-item-content");v&&v.textContent!==u.content&&(o.content=u.content,Ne.renderCB(v,u),(w=o.subGrid)!=null&&w.el&&(v.appendChild(o.subGrid.el),o.subGrid.opts.styleInHead||o.subGrid._updateStyles(!0))),delete u.content}let p=!1,m=!1;for(const v in u)v[0]!=="_"&&o[v]!==u[v]&&(o[v]=u[v],p=!0,m=m||!this.opts.staticGrid&&(v==="noResize"||v==="noMove"||v==="locked"));if(A.sanitizeMinMax(o),d){const v=d.w!==void 0&&d.w!==o.w;this.moveNode(o,d),v&&o.subGrid?o.subGrid.onResize(this.hasAnimationCSS()?o.w:void 0):this.resizeToContentCheck(v,o),delete o._orig}(d||p)&&this._writeAttr(i,o),m&&this.prepareDragDrop(o.el)}),this}moveNode(t,r){const i=t._updating;i||this.engine.cleanNodes().beginUpdate(t),this.engine.moveNode(t,r),this._updateContainerHeight(),i||(this._triggerChangeEvent(),this.engine.endUpdate())}resizeToContent(t){var x,z;if(!t||(t.classList.remove("size-to-content-max"),!t.clientHeight))return;const r=t.gridstackNode;if(!r)return;const i=r.grid;if(!i||t.parentElement!==i.el)return;const o=i.getCellHeight(!0);if(!o)return;let u=r.h?r.h*o:t.clientHeight,c;if(r.resizeToContentParent&&(c=t.querySelector(r.resizeToContentParent)),c||(c=t.querySelector(Ne.resizeToContentParent)),!c)return;const d=t.clientHeight-c.clientHeight,p=r.h?r.h*o-d:c.clientHeight;let m;if(r.subGrid){m=r.subGrid.getRow()*r.subGrid.getCellHeight(!0);const R=r.subGrid.el.getBoundingClientRect(),k=r.subGrid.el.parentElement.getBoundingClientRect();m+=R.top-k.top}else{if((z=(x=r.subGridOpts)==null?void 0:x.children)!=null&&z.length)return;{const R=c.firstElementChild;if(!R){console.error(`Error: GridStack.resizeToContent() widget id:${r.id} '${Ne.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return}m=R.getBoundingClientRect().height||p}}if(p===m)return;u+=m-p;let w=Math.ceil(u/o);const v=Number.isInteger(r.sizeToContent)?r.sizeToContent:0;v&&w>v&&(w=v,t.classList.add("size-to-content-max")),r.minH&&wr.maxH&&(w=r.maxH),w!==r.h&&(i._ignoreLayoutsNodeChange=!0,i.moveNode(r,{h:w}),delete i._ignoreLayoutsNodeChange)}resizeToContentCBCheck(t){Ne.resizeToContentCB?Ne.resizeToContentCB(t):this.resizeToContent(t)}rotate(t,r){return Ne.getElements(t).forEach(i=>{const o=i.gridstackNode;if(!A.canBeRotated(o))return;const u={w:o.h,h:o.w,minH:o.minW,minW:o.minH,maxH:o.maxW,maxW:o.maxH};if(r){const d=r.left>0?Math.floor(r.left/this.cellWidth()):0,p=r.top>0?Math.floor(r.top/this.opts.cellHeight):0;u.x=o.x+d-(o.h-(p+1)),u.y=o.y+p-d}Object.keys(u).forEach(d=>{u[d]===void 0&&delete u[d]});const c=o._orig;this.update(i,u),o._orig=c}),this}margin(t){if(!(typeof t=="string"&&t.split(" ").length>1)){const i=A.parseHeight(t);if(this.opts.marginUnit===i.unit&&this.opts.margin===i.h)return}return this.opts.margin=t,this.opts.marginTop=this.opts.marginBottom=this.opts.marginLeft=this.opts.marginRight=void 0,this._initMargin(),this._updateStyles(!0),this}getMargin(){return this.opts.margin}willItFit(t){if(arguments.length>1){console.warn("gridstack.ts: `willItFit(x,y,w,h,autoPosition)` is deprecated. Use `willItFit({x, y,...})`. It will be removed soon");const r=arguments;let i=0,o={x:r[i++],y:r[i++],w:r[i++],h:r[i++],autoPosition:r[i++]};return this.willItFit(o)}return this.engine.willItFit(t)}_triggerChangeEvent(){if(this.engine.batchMode)return this;const t=this.engine.getDirtyNodes(!0);return t&&t.length&&(this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(t),this._triggerEvent("change",t)),this.engine.saveInitial(),this}_triggerAddEvent(){var t;if(this.engine.batchMode)return this;if((t=this.engine.addedNodes)!=null&&t.length){this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(this.engine.addedNodes),this.engine.addedNodes.forEach(i=>{delete i._dirty});const r=[...this.engine.addedNodes];this.engine.addedNodes=[],this._triggerEvent("added",r)}return this}_triggerRemoveEvent(){var t;if(this.engine.batchMode)return this;if((t=this.engine.removedNodes)!=null&&t.length){const r=[...this.engine.removedNodes];this.engine.removedNodes=[],this._triggerEvent("removed",r)}return this}_triggerEvent(t,r){const i=r?new CustomEvent(t,{bubbles:!1,detail:r}):new Event(t);return this.el.dispatchEvent(i),this}_removeStylesheet(){if(this._styles){const t=this.opts.styleInHead?void 0:this.el.parentNode;A.removeStylesheet(this._styleSheetClass,t),delete this._styles}return this}_updateStyles(t=!1,r){if(t&&this._removeStylesheet(),r===void 0&&(r=this.getRow()),this._updateContainerHeight(),this.opts.cellHeight===0)return this;const i=this.opts.cellHeight,o=this.opts.cellHeightUnit,u=`.${this._styleSheetClass} > .${this.opts.itemClass}`;if(!this._styles){const c=this.opts.styleInHead?void 0:this.el.parentNode;if(this._styles=A.createStylesheet(this._styleSheetClass,c,{nonce:this.opts.nonce}),!this._styles)return this;this._styles._max=0,A.addCSSRule(this._styles,u,`height: ${i}${o}`);const d=this.opts.marginTop+this.opts.marginUnit,p=this.opts.marginBottom+this.opts.marginUnit,m=this.opts.marginRight+this.opts.marginUnit,w=this.opts.marginLeft+this.opts.marginUnit,v=`${u} > .grid-stack-item-content`,x=`.${this._styleSheetClass} > .grid-stack-placeholder > .placeholder-content`;A.addCSSRule(this._styles,v,`top: ${d}; right: ${m}; bottom: ${p}; left: ${w};`),A.addCSSRule(this._styles,x,`top: ${d}; right: ${m}; bottom: ${p}; left: ${w};`),A.addCSSRule(this._styles,`${u} > .ui-resizable-n`,`top: ${d};`),A.addCSSRule(this._styles,`${u} > .ui-resizable-s`,`bottom: ${p}`),A.addCSSRule(this._styles,`${u} > .ui-resizable-ne`,`right: ${m}; top: ${d}`),A.addCSSRule(this._styles,`${u} > .ui-resizable-e`,`right: ${m}`),A.addCSSRule(this._styles,`${u} > .ui-resizable-se`,`right: ${m}; bottom: ${p}`),A.addCSSRule(this._styles,`${u} > .ui-resizable-nw`,`left: ${w}; top: ${d}`),A.addCSSRule(this._styles,`${u} > .ui-resizable-w`,`left: ${w}`),A.addCSSRule(this._styles,`${u} > .ui-resizable-sw`,`left: ${w}; bottom: ${p}`)}if(r=r||this._styles._max,r>this._styles._max){const c=d=>i*d+o;for(let d=this._styles._max+1;d<=r;d++)A.addCSSRule(this._styles,`${u}[gs-y="${d}"]`,`top: ${c(d)}`),A.addCSSRule(this._styles,`${u}[gs-h="${d+1}"]`,`height: ${c(d+1)}`);this._styles._max=r}return this}_updateContainerHeight(){if(!this.engine||this.engine.batchMode)return this;const t=this.parentGridNode;let r=this.getRow()+this._extraDragRow;const i=this.opts.cellHeight,o=this.opts.cellHeightUnit;if(!i)return this;if(!t){const u=A.parseHeight(getComputedStyle(this.el).minHeight);if(u.h>0&&u.unit===o){const c=Math.floor(u.h/i);r1?t.setAttribute("gs-w",String(r.w)):t.removeAttribute("gs-w"),r.h>1?t.setAttribute("gs-h",String(r.h)):t.removeAttribute("gs-h"),this}_writeAttr(t,r){if(!r)return this;this._writePosAttr(t,r);const i={noResize:"gs-no-resize",noMove:"gs-no-move",locked:"gs-locked",id:"gs-id",sizeToContent:"gs-size-to-content"};for(const o in i)r[o]?t.setAttribute(i[o],String(r[o])):t.removeAttribute(i[o]);return this}_readAttr(t,r=!0){const i={};i.x=A.toNumber(t.getAttribute("gs-x")),i.y=A.toNumber(t.getAttribute("gs-y")),i.w=A.toNumber(t.getAttribute("gs-w")),i.h=A.toNumber(t.getAttribute("gs-h")),i.autoPosition=A.toBool(t.getAttribute("gs-auto-position")),i.noResize=A.toBool(t.getAttribute("gs-no-resize")),i.noMove=A.toBool(t.getAttribute("gs-no-move")),i.locked=A.toBool(t.getAttribute("gs-locked"));const o=t.getAttribute("gs-size-to-content");o&&(o==="true"||o==="false"?i.sizeToContent=A.toBool(o):i.sizeToContent=parseInt(o,10)),i.id=t.getAttribute("gs-id"),i.maxW=A.toNumber(t.getAttribute("gs-max-w")),i.minW=A.toNumber(t.getAttribute("gs-min-w")),i.maxH=A.toNumber(t.getAttribute("gs-max-h")),i.minH=A.toNumber(t.getAttribute("gs-min-h")),r&&(i.w===1&&t.removeAttribute("gs-w"),i.h===1&&t.removeAttribute("gs-h"),i.maxW&&t.removeAttribute("gs-max-w"),i.minW&&t.removeAttribute("gs-min-w"),i.maxH&&t.removeAttribute("gs-max-h"),i.minH&&t.removeAttribute("gs-min-h"));for(const u in i){if(!i.hasOwnProperty(u))return;!i[u]&&i[u]!==0&&u!=="gs-size-to-content"&&delete i[u]}return i}_setStaticClass(){const t=["grid-stack-static"];return this.opts.staticGrid?(this.el.classList.add(...t),this.el.setAttribute("gs-static","true")):(this.el.classList.remove(...t),this.el.removeAttribute("gs-static")),this}onResize(t=(r=>(r=this.el)==null?void 0:r.clientWidth)()){if(!t||this.prevWidth===t)return;this.prevWidth=t,this.batchUpdate();let i=!1;return this._autoColumn&&this.parentGridNode?this.opts.column!==this.parentGridNode.w&&(this.column(this.parentGridNode.w,this.opts.layout||"list"),i=!0):i=this.checkDynamicColumn(),this._isAutoCellHeight&&this.cellHeight(),this.engine.nodes.forEach(o=>{o.subGrid&&o.subGrid.onResize()}),this._skipInitialResize||this.resizeToContentCheck(i),delete this._skipInitialResize,this.batchUpdate(!1),this}resizeToContentCheck(t=!1,r=void 0){if(this.engine){if(t&&this.hasAnimationCSS())return setTimeout(()=>this.resizeToContentCheck(!1,r),this.animationDelay);if(r)A.shouldSizeToContent(r)&&this.resizeToContentCBCheck(r.el);else if(this.engine.nodes.some(i=>A.shouldSizeToContent(i))){const i=[...this.engine.nodes];this.batchUpdate(),i.forEach(o=>{A.shouldSizeToContent(o)&&this.resizeToContentCBCheck(o.el)}),this.batchUpdate(!1)}this._gsEventHandler.resizecontent&&this._gsEventHandler.resizecontent(null,r?[r]:this.engine.nodes)}}_updateResizeEvent(t=!1){const r=!this.parentGridNode&&(this._isAutoCellHeight||this.opts.sizeToContent||this.opts.columnOpts||this.engine.nodes.find(i=>i.sizeToContent));return!t&&r&&!this.resizeObserver?(this._sizeThrottle=A.throttle(()=>this.onResize(),this.opts.cellHeightThrottle),this.resizeObserver=new ResizeObserver(()=>this._sizeThrottle()),this.resizeObserver.observe(this.el),this._skipInitialResize=!0):(t||!r)&&this.resizeObserver&&(this.resizeObserver.disconnect(),delete this.resizeObserver,delete this._sizeThrottle),this}static getElement(t=".grid-stack-item"){return A.getElement(t)}static getElements(t=".grid-stack-item"){return A.getElements(t)}static getGridElement(t){return Ne.getElement(t)}static getGridElements(t){return A.getElements(t)}_initMargin(){let t,r=0,i=[];return typeof this.opts.margin=="string"&&(i=this.opts.margin.split(" ")),i.length===2?(this.opts.marginTop=this.opts.marginBottom=i[0],this.opts.marginLeft=this.opts.marginRight=i[1]):i.length===4?(this.opts.marginTop=i[0],this.opts.marginRight=i[1],this.opts.marginBottom=i[2],this.opts.marginLeft=i[3]):(t=A.parseHeight(this.opts.margin),this.opts.marginUnit=t.unit,r=this.opts.margin=t.h),this.opts.marginTop===void 0?this.opts.marginTop=r:(t=A.parseHeight(this.opts.marginTop),this.opts.marginTop=t.h,delete this.opts.margin),this.opts.marginBottom===void 0?this.opts.marginBottom=r:(t=A.parseHeight(this.opts.marginBottom),this.opts.marginBottom=t.h,delete this.opts.margin),this.opts.marginRight===void 0?this.opts.marginRight=r:(t=A.parseHeight(this.opts.marginRight),this.opts.marginRight=t.h,delete this.opts.margin),this.opts.marginLeft===void 0?this.opts.marginLeft=r:(t=A.parseHeight(this.opts.marginLeft),this.opts.marginLeft=t.h,delete this.opts.margin),this.opts.marginUnit=t.unit,this.opts.marginTop===this.opts.marginBottom&&this.opts.marginLeft===this.opts.marginRight&&this.opts.marginTop===this.opts.marginRight&&(this.opts.margin=this.opts.marginTop),this}static getDD(){return $n}static setupDragIn(t,r,i,o=document){(r==null?void 0:r.pause)!==void 0&&(Le.pauseDrag=r.pause),r={appendTo:"body",helper:"clone",...r||{}},(typeof t=="string"?A.getElements(t,o):t).forEach((c,d)=>{$n.isDraggable(c)||$n.dragIn(c,r),i!=null&&i[d]&&(c.gridstackNode=i[d])})}movable(t,r){return this.opts.staticGrid?this:(Ne.getElements(t).forEach(i=>{const o=i.gridstackNode;o&&(r?delete o.noMove:o.noMove=!0,this.prepareDragDrop(o.el))}),this)}resizable(t,r){return this.opts.staticGrid?this:(Ne.getElements(t).forEach(i=>{const o=i.gridstackNode;o&&(r?delete o.noResize:o.noResize=!0,this.prepareDragDrop(o.el))}),this)}disable(t=!0){if(!this.opts.staticGrid)return this.enableMove(!1,t),this.enableResize(!1,t),this._triggerEvent("disable"),this}enable(t=!0){if(!this.opts.staticGrid)return this.enableMove(!0,t),this.enableResize(!0,t),this._triggerEvent("enable"),this}enableMove(t,r=!0){return this.opts.staticGrid?this:(t?delete this.opts.disableDrag:this.opts.disableDrag=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&r&&i.subGrid.enableMove(t,r)}),this)}enableResize(t,r=!0){return this.opts.staticGrid?this:(t?delete this.opts.disableResize:this.opts.disableResize=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&r&&i.subGrid.enableResize(t,r)}),this)}cancelDrag(){var r;const t=(r=this._placeholder)==null?void 0:r.gridstackNode;t&&(t._isExternal?(t._isAboutToRemove=!0,this.engine.removeNode(t)):t._isAboutToRemove&&Ne._itemRemoving(t.el,!1),this.engine.restoreInitial())}_removeDD(t){return $n.draggable(t,"destroy").resizable(t,"destroy"),t.gridstackNode&&delete t.gridstackNode._initDD,delete t.ddElement,this}_setupAcceptWidget(){if(this.opts.staticGrid||!this.opts.acceptWidgets&&!this.opts.removable)return $n.droppable(this.el,"destroy"),this;let t,r;const i=(o,u,c)=>{var x;c=c||u;const d=c.gridstackNode;if(!d)return;if(!((x=d.grid)!=null&&x.el)){c.style.transform=`scale(${1/this.dragTransform.xScale},${1/this.dragTransform.yScale})`;const z=c.getBoundingClientRect();c.style.left=z.x+(this.dragTransform.xScale-1)*(o.clientX-z.x)/this.dragTransform.xScale+"px",c.style.top=z.y+(this.dragTransform.yScale-1)*(o.clientY-z.y)/this.dragTransform.yScale+"px",c.style.transformOrigin="0px 0px"}let{top:p,left:m}=c.getBoundingClientRect();const w=this.el.getBoundingClientRect();m-=w.left,p-=w.top;const v={position:{top:p*this.dragTransform.xScale,left:m*this.dragTransform.yScale}};if(d._temporaryRemoved){if(d.x=Math.max(0,Math.round(m/r)),d.y=Math.max(0,Math.round(p/t)),delete d.autoPosition,this.engine.nodeBoundFix(d),!this.engine.willItFit(d)){if(d.autoPosition=!0,!this.engine.willItFit(d)){$n.off(u,"drag");return}d._willFitPos&&(A.copyPos(d,d._willFitPos),delete d._willFitPos)}this._onStartMoving(c,o,v,d,r,t)}else this._dragOrResize(c,o,v,d,r,t)};return $n.droppable(this.el,{accept:o=>{const u=o.gridstackNode||this._readAttr(o,!1);if((u==null?void 0:u.grid)===this)return!0;if(!this.opts.acceptWidgets)return!1;let c=!0;if(typeof this.opts.acceptWidgets=="function")c=this.opts.acceptWidgets(o);else{const d=this.opts.acceptWidgets===!0?".grid-stack-item":this.opts.acceptWidgets;c=o.matches(d)}if(c&&u&&this.opts.maxRow){const d={w:u.w,h:u.h,minW:u.minW,minH:u.minH};c=this.engine.willItFit(d)}return c}}).on(this.el,"dropover",(o,u,c)=>{let d=(c==null?void 0:c.gridstackNode)||u.gridstackNode;if((d==null?void 0:d.grid)===this&&!d._temporaryRemoved)return!1;if(d!=null&&d._sidebarOrig&&(d.w=d._sidebarOrig.w,d.h=d._sidebarOrig.h),d!=null&&d.grid&&d.grid!==this&&!d._temporaryRemoved&&d.grid._leave(u,c),c=c||u,r=this.cellWidth(),t=this.getCellHeight(!0),!d){const w=c.getAttribute("data-gs-widget")||c.getAttribute("gridstacknode");if(w){try{d=JSON.parse(w)}catch{console.error("Gridstack dropover: Bad JSON format: ",w)}c.removeAttribute("data-gs-widget"),c.removeAttribute("gridstacknode")}d||(d=this._readAttr(c)),d._sidebarOrig={w:d.w,h:d.h}}d.grid||(d.el||(d={...d}),d._isExternal=!0,c.gridstackNode=d);const p=d.w||Math.round(c.offsetWidth/r)||1,m=d.h||Math.round(c.offsetHeight/t)||1;return d.grid&&d.grid!==this?(u._gridstackNodeOrig||(u._gridstackNodeOrig=d),u.gridstackNode=d={...d,w:p,h:m,grid:this},delete d.x,delete d.y,this.engine.cleanupNode(d).nodeBoundFix(d),d._initDD=d._isExternal=d._temporaryRemoved=!0):(d.w=p,d.h=m,d._temporaryRemoved=!0),Ne._itemRemoving(d.el,!1),$n.on(u,"drag",i),i(o,u,c),!1}).on(this.el,"dropout",(o,u,c)=>{const d=(c==null?void 0:c.gridstackNode)||u.gridstackNode;return d&&(!d.grid||d.grid===this)&&(this._leave(u,c),this._isTemp&&this.removeAsSubGrid(d)),!1}).on(this.el,"drop",(o,u,c)=>{var z,R,k;const d=(c==null?void 0:c.gridstackNode)||u.gridstackNode;if((d==null?void 0:d.grid)===this&&!d._isExternal)return!1;const p=!!this.placeholder.parentElement,m=u!==c;this.placeholder.remove(),delete this.placeholder.gridstackNode;const w=p&&this.opts.animate;w&&this.setAnimation(!1);const v=u._gridstackNodeOrig;if(delete u._gridstackNodeOrig,p&&(v!=null&&v.grid)&&v.grid!==this){const b=v.grid;b.engine.removeNodeFromLayoutCache(v),b.engine.removedNodes.push(v),b._triggerRemoveEvent()._triggerChangeEvent(),b.parentGridNode&&!b.engine.nodes.length&&b.opts.subGridDynamic&&b.removeAsSubGrid()}if(!d||(p&&(this.engine.cleanupNode(d),d.grid=this),(z=d.grid)==null||delete z._isTemp,$n.off(u,"drag"),c!==u?(c.remove(),u=c):u.remove(),this._removeDD(u),!p))return!1;const x=(k=(R=d.subGrid)==null?void 0:R.el)==null?void 0:k.gridstack;return A.copyPos(d,this._readAttr(this.placeholder)),A.removePositioningStyles(u),m&&(d.content||d.subGridOpts||Ne.addRemoveCB)?(delete d.el,u=this.addWidget(d)):(this._prepareElement(u,!0,d),this.el.appendChild(u),this.resizeToContentCheck(!1,d),x&&(x.parentGridNode=d,x.opts.styleInHead||x._updateStyles(!0)),this._updateContainerHeight()),this.engine.addedNodes.push(d),this._triggerAddEvent(),this._triggerChangeEvent(),this.engine.endUpdate(),this._gsEventHandler.dropped&&this._gsEventHandler.dropped({...o,type:"dropped"},v&&v.grid?v:void 0,d),w&&this.setAnimation(this.opts.animate,!0),!1}),this}static _itemRemoving(t,r){if(!t)return;const i=t?t.gridstackNode:void 0;!(i!=null&&i.grid)||t.classList.contains(i.grid.opts.removableOptions.decline)||(r?i._isAboutToRemove=!0:delete i._isAboutToRemove,r?t.classList.add("grid-stack-item-removing"):t.classList.remove("grid-stack-item-removing"))}_setupRemoveDrop(){if(typeof this.opts.removable!="string")return this;const t=document.querySelector(this.opts.removable);return t?(!this.opts.staticGrid&&!$n.isDroppable(t)&&$n.droppable(t,this.opts.removableOptions).on(t,"dropover",(r,i)=>Ne._itemRemoving(i,!0)).on(t,"dropout",(r,i)=>Ne._itemRemoving(i,!1)),this):this}prepareDragDrop(t,r=!1){const i=t==null?void 0:t.gridstackNode;if(!i)return;const o=i.noMove||this.opts.disableDrag,u=i.noResize||this.opts.disableResize,c=this.opts.staticGrid||o&&u;if((r||c)&&(i._initDD&&(this._removeDD(t),delete i._initDD),c&&t.classList.add("ui-draggable-disabled","ui-resizable-disabled"),!r))return this;if(!i._initDD){let d,p;const m=(x,z)=>{this._gsEventHandler[x.type]&&this._gsEventHandler[x.type](x,x.target),d=this.cellWidth(),p=this.getCellHeight(!0),this._onStartMoving(t,x,z,i,d,p)},w=(x,z)=>{this._dragOrResize(t,x,z,i,d,p)},v=x=>{this.placeholder.remove(),delete this.placeholder.gridstackNode,delete i._moving,delete i._event,delete i._lastTried;const z=i.w!==i._orig.w,R=x.target;if(!(!R.gridstackNode||R.gridstackNode.grid!==this)){if(i.el=R,i._isAboutToRemove){const k=t.gridstackNode.grid;k._gsEventHandler[x.type]&&k._gsEventHandler[x.type](x,R),k.engine.nodes.push(i),k.removeWidget(t,!0,!0)}else A.removePositioningStyles(R),i._temporaryRemoved?(A.copyPos(i,i._orig),this._writePosAttr(R,i),this.engine.addNode(i)):this._writePosAttr(R,i),this._gsEventHandler[x.type]&&this._gsEventHandler[x.type](x,R);this._extraDragRow=0,this._updateContainerHeight(),this._triggerChangeEvent(),this.engine.endUpdate(),x.type==="resizestop"&&(Number.isInteger(i.sizeToContent)&&(i.sizeToContent=i.h),this.resizeToContentCheck(z,i))}};$n.draggable(t,{start:m,stop:v,drag:w}).resizable(t,{start:m,stop:v,resize:w}),i._initDD=!0}return $n.draggable(t,o?"disable":"enable").resizable(t,u?"disable":"enable"),this}_onStartMoving(t,r,i,o,u,c){var d;if(this.engine.cleanNodes().beginUpdate(o),this._writePosAttr(this.placeholder,o),this.el.appendChild(this.placeholder),this.placeholder.gridstackNode=o,(d=o.grid)!=null&&d.el)this.dragTransform=A.getValuesFromTransformedElement(t);else if(this.placeholder&&this.placeholder.closest(".grid-stack")){const p=this.placeholder.closest(".grid-stack");this.dragTransform=A.getValuesFromTransformedElement(p)}else this.dragTransform={xScale:1,xOffset:0,yScale:1,yOffset:0};if(o.el=this.placeholder,o._lastUiPosition=i.position,o._prevYPix=i.position.top,o._moving=r.type==="dragstart",delete o._lastTried,r.type==="dropover"&&o._temporaryRemoved&&(this.engine.addNode(o),o._moving=!0),this.engine.cacheRects(u,c,this.opts.marginTop,this.opts.marginRight,this.opts.marginBottom,this.opts.marginLeft),r.type==="resizestart"){const p=this.getColumn()-o.x,m=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-o.y;$n.resizable(t,"option","minWidth",u*Math.min(o.minW||1,p)).resizable(t,"option","minHeight",c*Math.min(o.minH||1,m)).resizable(t,"option","maxWidth",u*Math.min(o.maxW||Number.MAX_SAFE_INTEGER,p)).resizable(t,"option","maxWidthMoveLeft",u*Math.min(o.maxW||Number.MAX_SAFE_INTEGER,o.x+o.w)).resizable(t,"option","maxHeight",c*Math.min(o.maxH||Number.MAX_SAFE_INTEGER,m)).resizable(t,"option","maxHeightMoveUp",c*Math.min(o.maxH||Number.MAX_SAFE_INTEGER,o.y+o.h))}}_dragOrResize(t,r,i,o,u,c){const d={...o._orig};let p,m=this.opts.marginLeft,w=this.opts.marginRight,v=this.opts.marginTop,x=this.opts.marginBottom;const z=Math.round(c*.1),R=Math.round(u*.1);if(m=Math.min(m,R),w=Math.min(w,R),v=Math.min(v,z),x=Math.min(x,z),r.type==="drag"){if(o._temporaryRemoved)return;const b=i.position.top-o._prevYPix;o._prevYPix=i.position.top,this.opts.draggable.scroll!==!1&&A.updateScrollPosition(t,i.position,b);const U=i.position.left+(i.position.left>o._lastUiPosition.left?-w:m),P=i.position.top+(i.position.top>o._lastUiPosition.top?-x:v);d.x=Math.round(U/u),d.y=Math.round(P/c);const W=this._extraDragRow;if(this.engine.collide(o,d)){const V=this.getRow();let Z=Math.max(0,d.y+o.h-V);this.opts.maxRow&&V+Z>this.opts.maxRow&&(Z=Math.max(0,this.opts.maxRow-V)),this._extraDragRow=Z}else this._extraDragRow=0;if(this._extraDragRow!==W&&this._updateContainerHeight(),o.x===d.x&&o.y===d.y)return}else if(r.type==="resize"){if(d.x<0||(A.updateScrollResize(r,t,c),d.w=Math.round((i.size.width-m)/u),d.h=Math.round((i.size.height-v)/c),o.w===d.w&&o.h===d.h)||o._lastTried&&o._lastTried.w===d.w&&o._lastTried.h===d.h)return;const b=i.position.left+m,U=i.position.top+v;d.x=Math.round(b/u),d.y=Math.round(U/c),p=!0}o._event=r,o._lastTried=d;const k={x:i.position.left+m,y:i.position.top+v,w:(i.size?i.size.width:o.w*u)-m-w,h:(i.size?i.size.height:o.h*c)-v-x};if(this.engine.moveNodeCheck(o,{...d,cellWidth:u,cellHeight:c,rect:k,resizing:p})){o._lastUiPosition=i.position,this.engine.cacheRects(u,c,v,w,x,m),delete o._skipDown,p&&o.subGrid&&o.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();const b=r.target;o._sidebarOrig||this._writePosAttr(b,o),this._gsEventHandler[r.type]&&this._gsEventHandler[r.type](r,b)}}_leave(t,r){r=r||t;const i=r.gridstackNode;if(!i||(r.style.transform=r.style.transformOrigin=null,$n.off(t,"drag"),i._temporaryRemoved))return;i._temporaryRemoved=!0,this.engine.removeNode(i),i.el=i._isExternal&&r?r:t;const o=i._sidebarOrig;i._isExternal&&this.engine.cleanupNode(i),i._sidebarOrig=o,this.opts.removable===!0&&Ne._itemRemoving(t,!0),t._gridstackNodeOrig?(t.gridstackNode=t._gridstackNodeOrig,delete t._gridstackNodeOrig):i._isExternal&&this.engine.restoreInitial()}commit(){return _S(this,this.batchUpdate(!1),"commit","batchUpdate","5.2"),this}}Ne.renderCB=(l,t)=>{l&&(t!=null&&t.content)&&(l.textContent=t.content)};Ne.resizeToContentParent=".grid-stack-item-content";Ne.Utils=A;Ne.Engine=ai;Ne.GDRev="11.5.1";function RS({widget:l,onRemove:t}){const r=gS[l.kind];return B.jsxs("div",{className:"widget",children:[B.jsxs("div",{className:"widget-header",children:[B.jsx("span",{className:"widget-grip","aria-hidden":!0,children:"⠿"}),B.jsx("span",{className:"widget-icon",children:r==null?void 0:r.icon}),B.jsx("span",{className:"widget-title",children:(r==null?void 0:r.title)||l.kind}),B.jsx("button",{className:"widget-close",title:"Remove widget",onClick:t,children:"×"})]}),B.jsx("div",{className:"widget-body",children:r?r.render(l.id):null})]})}function NS(){const l=Eo(w=>w.widgets),t=Eo(w=>w.updateGeom),r=Eo(w=>w.removeWidget),i=j.useRef(null),o=j.useRef(null),u=j.useRef(new Map),[c,d]=j.useState(new Map),[p,m]=j.useState(!1);return j.useEffect(()=>{if(!i.current)return;const w=Ne.init({column:12,cellHeight:56,margin:8,float:!0,handle:".widget-header",resizable:{handles:"e, se, s, sw, w"},animate:!0},i.current);return o.current=w,w.on("change",(v,x)=>{const z=x.map(R=>({id:String(R.id),x:R.x??0,y:R.y??0,w:R.w??1,h:R.h??1}));z.length&&t(z)}),m(!0),()=>{w.destroy(!1),o.current=null}},[t]),j.useEffect(()=>{const w=o.current;if(!w||!p)return;const v=new Set(l.map(R=>R.id));let x=!1;const z=new Map(c);w.batchUpdate();for(const R of l){if(u.current.has(R.id))continue;const k=w.addWidget({x:R.x,y:R.y,w:R.w,h:R.h,id:R.id}),b=k.querySelector(".grid-stack-item-content");u.current.set(R.id,k),z.set(R.id,b),x=!0}for(const[R,k]of Array.from(u.current.entries()))v.has(R)||(w.removeWidget(k,!0),u.current.delete(R),z.delete(R),x=!0);w.commit(),x&&d(z)},[l,p]),B.jsxs("div",{className:"canvas",children:[B.jsx("div",{className:"grid-stack",ref:i}),l.map(w=>{const v=c.get(w.id);return v?bs.createPortal(B.jsx(RS,{widget:w,onRemove:()=>r(w.id)}),v,w.id):null})]})}function DS(){const l=gn(d=>d.addSignalToPlot),t=gn(d=>d.setMotorTypes),[r,i]=j.useState(null),o=ly(sy($f,{activationConstraint:{distance:4}}));j.useEffect(()=>{Im(),F1().then(t)},[t]);const u=d=>{var m;const p=(m=d.active.data.current)==null?void 0:m.signalId;i(p?If(p):null)},c=d=>{var w,v,x,z;i(null);const p=(w=d.active.data.current)==null?void 0:w.signalId,m=((x=(v=d.over)==null?void 0:v.id)==null?void 0:x.toString())||"";if(p&&m.startsWith("plot:")){const R=(z=d.over.data.current)==null?void 0:z.panelId;l(R,p)}};return B.jsxs(r0,{sensors:o,onDragStart:u,onDragEnd:c,children:[B.jsxs("div",{className:"app",children:[B.jsx(yS,{}),B.jsxs("div",{className:"body",children:[B.jsx(xS,{}),B.jsx("main",{className:"canvas-host",children:B.jsx(NS,{})})]})]}),B.jsx(E0,{dropAnimation:null,children:r?B.jsx("div",{className:"drag-ghost",children:r}):null})]})}vS();$v.createRoot(document.getElementById("root")).render(B.jsx(ht.StrictMode,{children:B.jsx(DS,{})})); diff --git a/damiao_motor/gui/webapp/dist/index.html b/damiao_motor/gui/webapp/dist/index.html index 800f72a..19b5309 100644 --- a/damiao_motor/gui/webapp/dist/index.html +++ b/damiao_motor/gui/webapp/dist/index.html @@ -4,8 +4,8 @@ DaMiao Monitor - - + +
diff --git a/damiao_motor/gui/webapp/src/components/Toolbar.tsx b/damiao_motor/gui/webapp/src/components/Toolbar.tsx index e29a45e..4756c0f 100644 --- a/damiao_motor/gui/webapp/src/components/Toolbar.tsx +++ b/damiao_motor/gui/webapp/src/components/Toolbar.tsx @@ -1,14 +1,22 @@ +import { useState } from "react"; import { useApp } from "../lib/store"; import { useWidgets } from "../lib/widgets"; import { PANELS } from "../panels/registry"; +import { getTheme, setTheme, type Theme } from "../lib/theme"; export default function Toolbar() { const connected = useApp((s) => s.connected); const status = useApp((s) => s.status); const addWidget = useWidgets((s) => s.addWidget); const resetWidgets = useWidgets((s) => s.resetWidgets); + const [theme, setThemeState] = useState(getTheme()); const resetLayout = () => resetWidgets(); + const toggleTheme = () => { + const next: Theme = theme === "light" ? "dark" : "light"; + setTheme(next); + setThemeState(next); + }; return (
@@ -48,6 +56,13 @@ export default function Toolbar() { {p.icon} {p.title} ))} +
diff --git a/damiao_motor/gui/webapp/src/index.css b/damiao_motor/gui/webapp/src/index.css index f4947cf..c93d14c 100644 --- a/damiao_motor/gui/webapp/src/index.css +++ b/damiao_motor/gui/webapp/src/index.css @@ -1,8 +1,31 @@ :root { + /* light theme (default) */ + --bg: #f4f6f9; + --bg-1: #eef1f6; + --surface: #ffffff; + --surface-2: #eef2f7; + --hover: #e6ecf3; + --border: #d6dde7; + --border-soft: #e7ecf2; + --text: #1e2733; + --muted: #5f6a78; + --accent: #2f6fed; + --ok: #16a34a; + --warn: #d97706; + --err: #e11d48; + --radius: 14px; + --radius-sm: 9px; + --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 24px -16px rgba(16, 24, 40, 0.28); + --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; + --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; +} + +:root[data-theme="dark"] { --bg: #0f1216; --bg-1: #141a21; --surface: #171d25; --surface-2: #1d242e; + --hover: #232c38; --border: #262e3a; --border-soft: #1f2630; --text: #d7dde5; @@ -11,11 +34,7 @@ --ok: #4ade80; --warn: #fbbf24; --err: #fb7185; - --radius: 14px; - --radius-sm: 9px; --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px -16px rgba(0, 0, 0, 0.65); - --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; - --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; } * { box-sizing: border-box; } @@ -47,8 +66,8 @@ body { gap: 16px; height: 52px; padding: 0 16px; - background: linear-gradient(180deg, #161c24, #0f1216); - border-bottom: 1px solid var(--border-soft); + background: var(--surface); + border-bottom: 1px solid var(--border); } .brand { font-weight: 650; font-size: 15px; letter-spacing: 0.2px; display: flex; align-items: center; gap: 9px; } .brand-sub { color: var(--muted); font-weight: 500; font-size: 12px; } @@ -73,7 +92,7 @@ body { border-radius: var(--radius-sm); padding: 6px 11px; font-size: 12px; cursor: pointer; transition: background 0.15s, border-color 0.15s, transform 0.05s; } -.btn:hover { background: #232c38; border-color: #33404f; } +.btn:hover { background: var(--hover); border-color: var(--border); } .btn:active { transform: translateY(1px); } .btn.ghost { background: transparent; } .btn.small { padding: 3px 9px; font-size: 11px; } @@ -141,7 +160,7 @@ body { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 8px 0 10px; flex-shrink: 0; border-bottom: 1px solid var(--border-soft); - background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent); + background: var(--surface-2); cursor: move; } .widget-grip { color: var(--muted); opacity: 0.5; font-size: 12px; letter-spacing: -2px; } @@ -198,7 +217,7 @@ body { position: sticky; top: 0; background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; } -.motor-table tr:hover td { background: var(--bg-1); } +.motor-table tr:hover td { background: var(--hover); } .cmd-col { color: var(--accent); } .status-pill { font-size: 10px; padding: 2px 8px; border-radius: 999px; font-weight: 650; } .status-pill.ok { color: var(--ok); background: rgba(74,222,128,0.12); } diff --git a/damiao_motor/gui/webapp/src/lib/theme.ts b/damiao_motor/gui/webapp/src/lib/theme.ts new file mode 100644 index 0000000..0521731 --- /dev/null +++ b/damiao_motor/gui/webapp/src/lib/theme.ts @@ -0,0 +1,26 @@ +/** Light/dark theme, default light, persisted. Applied via data-theme on . */ + +export type Theme = "light" | "dark"; +const KEY = "damiao.monitor.theme"; + +export function getTheme(): Theme { + const t = localStorage.getItem(KEY); + return t === "dark" ? "dark" : "light"; // default light +} + +export function applyTheme(t: Theme) { + document.documentElement.setAttribute("data-theme", t); +} + +export function setTheme(t: Theme) { + try { + localStorage.setItem(KEY, t); + } catch { + /* ignore */ + } + applyTheme(t); +} + +export function initTheme() { + applyTheme(getTheme()); +} diff --git a/damiao_motor/gui/webapp/src/main.tsx b/damiao_motor/gui/webapp/src/main.tsx index 9b67590..ef6c43e 100644 --- a/damiao_motor/gui/webapp/src/main.tsx +++ b/damiao_motor/gui/webapp/src/main.tsx @@ -1,8 +1,11 @@ import React from "react"; import ReactDOM from "react-dom/client"; import App from "./App"; +import { initTheme } from "./lib/theme"; import "./index.css"; +initTheme(); // apply persisted (or default light) theme before first paint + ReactDOM.createRoot(document.getElementById("root")!).render( diff --git a/damiao_motor/gui/webapp/tsconfig.tsbuildinfo b/damiao_motor/gui/webapp/tsconfig.tsbuildinfo index a76d453..13c3db2 100644 --- a/damiao_motor/gui/webapp/tsconfig.tsbuildinfo +++ b/damiao_motor/gui/webapp/tsconfig.tsbuildinfo @@ -1 +1 @@ -{"root":["./src/app.tsx","./src/main.tsx","./src/components/canvas.tsx","./src/components/signalchip.tsx","./src/components/signalsidebar.tsx","./src/components/toolbar.tsx","./src/lib/datastore.ts","./src/lib/format.ts","./src/lib/store.ts","./src/lib/types.ts","./src/lib/widgets.ts","./src/lib/ws.ts","./src/panels/cardspanel.tsx","./src/panels/plotpanel.tsx","./src/panels/rawlogpanel.tsx","./src/panels/tablepanel.tsx","./src/panels/registry.tsx"],"version":"5.9.3"} \ No newline at end of file +{"root":["./src/app.tsx","./src/main.tsx","./src/components/canvas.tsx","./src/components/signalchip.tsx","./src/components/signalsidebar.tsx","./src/components/toolbar.tsx","./src/lib/datastore.ts","./src/lib/format.ts","./src/lib/store.ts","./src/lib/theme.ts","./src/lib/types.ts","./src/lib/widgets.ts","./src/lib/ws.ts","./src/panels/cardspanel.tsx","./src/panels/plotpanel.tsx","./src/panels/rawlogpanel.tsx","./src/panels/tablepanel.tsx","./src/panels/registry.tsx"],"version":"5.9.3"} \ No newline at end of file From 30e29eddfc2f734993f4a4353015db883659b194 Mon Sep 17 00:00:00 2001 From: Jia Xie Date: Mon, 15 Jun 2026 20:31:44 -0700 Subject: [PATCH 10/14] fix(monitor plots): replace shimmering dashed command line with solid weight/opacity cue Dense data turned the dashed command trace into visual noise. Now: actual = bold solid, command = a fainter (45% alpha), thinner 'ghost' line in the same hue. Legend swatches match. Cleaner cmd-vs-actual read at any point density. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../gui/webapp/dist/assets/index-CSlWWdCi.js | 54 +++++++++++++++++++ .../gui/webapp/dist/assets/index-UZFR7yIJ.js | 54 ------------------- damiao_motor/gui/webapp/dist/index.html | 2 +- damiao_motor/gui/webapp/src/lib/format.ts | 16 ++++++ .../gui/webapp/src/panels/PlotPanel.tsx | 17 +++--- 5 files changed, 81 insertions(+), 62 deletions(-) create mode 100644 damiao_motor/gui/webapp/dist/assets/index-CSlWWdCi.js delete mode 100644 damiao_motor/gui/webapp/dist/assets/index-UZFR7yIJ.js diff --git a/damiao_motor/gui/webapp/dist/assets/index-CSlWWdCi.js b/damiao_motor/gui/webapp/dist/assets/index-CSlWWdCi.js new file mode 100644 index 0000000..d5f6e4c --- /dev/null +++ b/damiao_motor/gui/webapp/dist/assets/index-CSlWWdCi.js @@ -0,0 +1,54 @@ +var Pv=Object.defineProperty;var Av=(l,t,r)=>t in l?Pv(l,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[t]=r;var fo=(l,t,r)=>Av(l,typeof t!="symbol"?t+"":t,r);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const u of o)if(u.type==="childList")for(const c of u.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&i(c)}).observe(document,{childList:!0,subtree:!0});function r(o){const u={};return o.integrity&&(u.integrity=o.integrity),o.referrerPolicy&&(u.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?u.credentials="include":o.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function i(o){if(o.ep)return;o.ep=!0;const u=r(o);fetch(o.href,u)}})();function Cg(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var Jc={exports:{}},ho={},Zc={exports:{}},Be={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var np;function Iv(){if(np)return Be;np=1;var l=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),v=Symbol.iterator;function x(D){return D===null||typeof D!="object"?null:(D=v&&D[v]||D["@@iterator"],typeof D=="function"?D:null)}var z={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},R=Object.assign,k={};function b(D,H,K){this.props=D,this.context=H,this.refs=k,this.updater=K||z}b.prototype.isReactComponent={},b.prototype.setState=function(D,H){if(typeof D!="object"&&typeof D!="function"&&D!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,D,H,"setState")},b.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function W(){}W.prototype=b.prototype;function P(D,H,K){this.props=D,this.context=H,this.refs=k,this.updater=K||z}var B=P.prototype=new W;B.constructor=P,R(B,b.prototype),B.isPureReactComponent=!0;var V=Array.isArray,ee=Object.prototype.hasOwnProperty,G={current:null},Z={key:!0,ref:!0,__self:!0,__source:!0};function re(D,H,K){var xe,be={},ge=null,_e=null;if(H!=null)for(xe in H.ref!==void 0&&(_e=H.ref),H.key!==void 0&&(ge=""+H.key),H)ee.call(H,xe)&&!Z.hasOwnProperty(xe)&&(be[xe]=H[xe]);var He=arguments.length-2;if(He===1)be.children=K;else if(1>>1,H=ie[D];if(0>>1;Do(be,X))geo(_e,be)?(ie[D]=_e,ie[ge]=X,D=ge):(ie[D]=be,ie[xe]=X,D=xe);else if(geo(_e,X))ie[D]=_e,ie[ge]=X,D=ge;else break e}}return oe}function o(ie,oe){var X=ie.sortIndex-oe.sortIndex;return X!==0?X:ie.id-oe.id}if(typeof performance=="object"&&typeof performance.now=="function"){var u=performance;l.unstable_now=function(){return u.now()}}else{var c=Date,d=c.now();l.unstable_now=function(){return c.now()-d}}var p=[],m=[],w=1,v=null,x=3,z=!1,R=!1,k=!1,b=typeof setTimeout=="function"?setTimeout:null,W=typeof clearTimeout=="function"?clearTimeout:null,P=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function B(ie){for(var oe=r(m);oe!==null;){if(oe.callback===null)i(m);else if(oe.startTime<=ie)i(m),oe.sortIndex=oe.expirationTime,t(p,oe);else break;oe=r(m)}}function V(ie){if(k=!1,B(ie),!R)if(r(p)!==null)R=!0,De(ee);else{var oe=r(m);oe!==null&&le(V,oe.startTime-ie)}}function ee(ie,oe){R=!1,k&&(k=!1,W(re),re=-1),z=!0;var X=x;try{for(B(oe),v=r(p);v!==null&&(!(v.expirationTime>oe)||ie&&!Y());){var D=v.callback;if(typeof D=="function"){v.callback=null,x=v.priorityLevel;var H=D(v.expirationTime<=oe);oe=l.unstable_now(),typeof H=="function"?v.callback=H:v===r(p)&&i(p),B(oe)}else i(p);v=r(p)}if(v!==null)var K=!0;else{var xe=r(m);xe!==null&&le(V,xe.startTime-oe),K=!1}return K}finally{v=null,x=X,z=!1}}var G=!1,Z=null,re=-1,ve=5,de=-1;function Y(){return!(l.unstable_now()-deie||125D?(ie.sortIndex=X,t(m,ie),r(p)===null&&ie===r(m)&&(k?(W(re),re=-1):k=!0,le(V,X-D))):(ie.sortIndex=H,t(p,ie),R||z||(R=!0,De(ee))),ie},l.unstable_shouldYield=Y,l.unstable_wrapCallback=function(ie){var oe=x;return function(){var X=x;x=oe;try{return ie.apply(this,arguments)}finally{x=X}}}})(nf)),nf}var op;function Wv(){return op||(op=1,tf.exports=jv()),tf.exports}/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var ap;function Bv(){if(ap)return ir;ap=1;var l=If(),t=Wv();function r(e){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+e,s=1;s"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),p=Object.prototype.hasOwnProperty,m=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,w={},v={};function x(e){return p.call(v,e)?!0:p.call(w,e)?!1:m.test(e)?v[e]=!0:(w[e]=!0,!1)}function z(e,n,s,a){if(s!==null&&s.type===0)return!1;switch(typeof n){case"function":case"symbol":return!0;case"boolean":return a?!1:s!==null?!s.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function R(e,n,s,a){if(n===null||typeof n>"u"||z(e,n,s,a))return!0;if(a)return!1;if(s!==null)switch(s.type){case 3:return!n;case 4:return n===!1;case 5:return isNaN(n);case 6:return isNaN(n)||1>n}return!1}function k(e,n,s,a,f,h,y){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=a,this.attributeNamespace=f,this.mustUseProperty=s,this.propertyName=e,this.type=n,this.sanitizeURL=h,this.removeEmptyString=y}var b={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){b[e]=new k(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var n=e[0];b[n]=new k(n,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){b[e]=new k(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){b[e]=new k(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){b[e]=new k(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){b[e]=new k(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){b[e]=new k(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){b[e]=new k(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){b[e]=new k(e,5,!1,e.toLowerCase(),null,!1,!1)});var W=/[\-:]([a-z])/g;function P(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var n=e.replace(W,P);b[n]=new k(n,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var n=e.replace(W,P);b[n]=new k(n,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var n=e.replace(W,P);b[n]=new k(n,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){b[e]=new k(e,1,!1,e.toLowerCase(),null,!1,!1)}),b.xlinkHref=new k("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){b[e]=new k(e,1,!1,e.toLowerCase(),null,!0,!0)});function B(e,n,s,a){var f=b.hasOwnProperty(n)?b[n]:null;(f!==null?f.type!==0:a||!(2C||f[y]!==h[C]){var N=` +`+f[y].replace(" at new "," at ");return e.displayName&&N.includes("")&&(N=N.replace("",e.displayName)),N}while(1<=y&&0<=C);break}}}finally{K=!1,Error.prepareStackTrace=s}return(e=e?e.displayName||e.name:"")?H(e):""}function be(e){switch(e.tag){case 5:return H(e.type);case 16:return H("Lazy");case 13:return H("Suspense");case 19:return H("SuspenseList");case 0:case 2:case 15:return e=xe(e.type,!1),e;case 11:return e=xe(e.type.render,!1),e;case 1:return e=xe(e.type,!0),e;default:return""}}function ge(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Z:return"Fragment";case G:return"Portal";case ve:return"Profiler";case re:return"StrictMode";case ae:return"Suspense";case ye:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Y:return(e.displayName||"Context")+".Consumer";case de:return(e._context.displayName||"Context")+".Provider";case Ce:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case me:return n=e.displayName||null,n!==null?n:ge(e.type)||"Memo";case De:n=e._payload,e=e._init;try{return ge(e(n))}catch{}}return null}function _e(e){var n=e.type;switch(e.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=n.render,e=e.displayName||e.name||"",n.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ge(n);case 8:return n===re?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function He(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Fe(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Oe(e){var n=Fe(e)?"checked":"value",s=Object.getOwnPropertyDescriptor(e.constructor.prototype,n),a=""+e[n];if(!e.hasOwnProperty(n)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var f=s.get,h=s.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return f.call(this)},set:function(y){a=""+y,h.call(this,y)}}),Object.defineProperty(e,n,{enumerable:s.enumerable}),{getValue:function(){return a},setValue:function(y){a=""+y},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function $t(e){e._valueTracker||(e._valueTracker=Oe(e))}function Pt(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var s=n.getValue(),a="";return e&&(a=Fe(e)?e.checked?"true":"false":e.value),e=a,e!==s?(n.setValue(e),!0):!1}function At(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function It(e,n){var s=n.checked;return X({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:s??e._wrapperState.initialChecked})}function Kn(e,n){var s=n.defaultValue==null?"":n.defaultValue,a=n.checked!=null?n.checked:n.defaultChecked;s=He(n.value!=null?n.value:s),e._wrapperState={initialChecked:a,initialValue:s,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function Cn(e,n){n=n.checked,n!=null&&B(e,"checked",n,!1)}function _r(e,n){Cn(e,n);var s=He(n.value),a=n.type;if(s!=null)a==="number"?(s===0&&e.value===""||e.value!=s)&&(e.value=""+s):e.value!==""+s&&(e.value=""+s);else if(a==="submit"||a==="reset"){e.removeAttribute("value");return}n.hasOwnProperty("value")?Pn(e,n.type,s):n.hasOwnProperty("defaultValue")&&Pn(e,n.type,He(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(e.defaultChecked=!!n.defaultChecked)}function Xr(e,n,s){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var a=n.type;if(!(a!=="submit"&&a!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+e._wrapperState.initialValue,s||n===e.value||(e.value=n),e.defaultValue=n}s=e.name,s!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,s!==""&&(e.name=s)}function Pn(e,n,s){(n!=="number"||At(e.ownerDocument)!==e)&&(s==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+s&&(e.defaultValue=""+s))}var Ze=Array.isArray;function nn(e,n,s,a){if(e=e.options,n){n={};for(var f=0;f"+n.valueOf().toString()+"",n=sn.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;n.firstChild;)e.appendChild(n.firstChild)}});function Gt(e,n){if(n){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=n;return}}e.textContent=n}var Rt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ln=["Webkit","ms","Moz","O"];Object.keys(Rt).forEach(function(e){ln.forEach(function(n){n=n+e.charAt(0).toUpperCase()+e.substring(1),Rt[n]=Rt[e]})});function mn(e,n,s){return n==null||typeof n=="boolean"||n===""?"":s||typeof n!="number"||n===0||Rt.hasOwnProperty(e)&&Rt[e]?(""+n).trim():n+"px"}function Yt(e,n){e=e.style;for(var s in n)if(n.hasOwnProperty(s)){var a=s.indexOf("--")===0,f=mn(s,n[s],a);s==="float"&&(s="cssFloat"),a?e.setProperty(s,f):e[s]=f}}var vn=X({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function qr(e,n){if(n){if(vn[e]&&(n.children!=null||n.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(n.dangerouslySetInnerHTML!=null){if(n.children!=null)throw Error(r(60));if(typeof n.dangerouslySetInnerHTML!="object"||!("__html"in n.dangerouslySetInnerHTML))throw Error(r(61))}if(n.style!=null&&typeof n.style!="object")throw Error(r(62))}}function Jr(e,n){if(e.indexOf("-")===-1)return typeof n.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var lr=null;function or(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Zr=null,zt=null,lt=null;function Kt(e){if(e=Xl(e)){if(typeof Zr!="function")throw Error(r(280));var n=e.stateNode;n&&(n=aa(n),Zr(e.stateNode,e.type,n))}}function on(e){zt?lt?lt.push(e):lt=[e]:zt=e}function ar(){if(zt){var e=zt,n=lt;if(lt=zt=null,Kt(e),n)for(e=0;e>>=0,e===0?32:31-(Ll(e)/Nn|0)|0}var os=64,Ti=4194304;function zi(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Fs(e,n){var s=e.pendingLanes;if(s===0)return 0;var a=0,f=e.suspendedLanes,h=e.pingedLanes,y=s&268435455;if(y!==0){var C=y&~f;C!==0?a=zi(C):(h&=y,h!==0&&(a=zi(h)))}else y=s&~f,y!==0?a=zi(y):h!==0&&(a=zi(h));if(a===0)return 0;if(n!==0&&n!==a&&(n&f)===0&&(f=a&-a,h=n&-n,f>=h||f===16&&(h&4194240)!==0))return n;if((a&4)!==0&&(a|=s&16),n=e.entangledLanes,n!==0)for(e=e.entanglements,n&=a;0s;s++)n.push(e);return n}function Mi(e,n,s){e.pendingLanes|=n,n!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,n=31-In(n),e[n]=s}function Il(e,n){var s=e.pendingLanes&~n;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=n,e.mutableReadLanes&=n,e.entangledLanes&=n,n=e.entanglements;var a=e.eventTimes;for(e=e.expirationTimes;0=pi),ta=" ",Qs=!1;function g(e,n){switch(e){case"keyup":return Dt.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function S(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var _=!1;function E(e,n){switch(e){case"compositionend":return S(n);case"keypress":return n.which!==32?null:(Qs=!0,ta);case"textInput":return e=n.data,e===ta&&Qs?null:e;default:return null}}function T(e,n){if(_)return e==="compositionend"||!Ks&&g(e,n)?(e=dr(),fr=Wl=cr=null,_=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1=n)return{node:s,offset:n-e};e=a}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=Jn(s)}}function Tn(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Tn(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Wn(){for(var e=window,n=At();n instanceof e.HTMLIFrameElement;){try{var s=typeof n.contentWindow.location.href=="string"}catch{s=!1}if(s)e=n.contentWindow;else break;n=At(e.document)}return n}function Bn(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}function Nr(e){var n=Wn(),s=e.focusedElem,a=e.selectionRange;if(n!==s&&s&&s.ownerDocument&&Tn(s.ownerDocument.documentElement,s)){if(a!==null&&Bn(s)){if(n=a.start,e=a.end,e===void 0&&(e=n),"selectionStart"in s)s.selectionStart=n,s.selectionEnd=Math.min(e,s.value.length);else if(e=(n=s.ownerDocument||document)&&n.defaultView||window,e.getSelection){e=e.getSelection();var f=s.textContent.length,h=Math.min(a.start,f);a=a.end===void 0?h:Math.min(a.end,f),!e.extend&&h>a&&(f=a,a=h,h=f),f=pr(s,h);var y=pr(s,a);f&&y&&(e.rangeCount!==1||e.anchorNode!==f.node||e.anchorOffset!==f.offset||e.focusNode!==y.node||e.focusOffset!==y.offset)&&(n=n.createRange(),n.setStart(f.node,f.offset),e.removeAllRanges(),h>a?(e.addRange(n),e.extend(y.node,y.offset)):(n.setEnd(y.node,y.offset),e.addRange(n)))}}for(n=[],e=s;e=e.parentNode;)e.nodeType===1&&n.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s=document.documentMode,Bt=null,Fr=null,Ot=null,Xs=!1;function ud(e,n,s){var a=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;Xs||Bt==null||Bt!==At(a)||(a=Bt,"selectionStart"in a&&Bn(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),Ot&&cn(Ot,a)||(Ot=a,a=sa(Fr,"onSelect"),0tl||(e.current=Qu[tl],Qu[tl]=null,tl--)}function dt(e,n){tl++,Qu[tl]=e.current,e.current=n}var $i={},zn=Vi($i),Zn=Vi(!1),ys=$i;function nl(e,n){var s=e.type.contextTypes;if(!s)return $i;var a=e.stateNode;if(a&&a.__reactInternalMemoizedUnmaskedChildContext===n)return a.__reactInternalMemoizedMaskedChildContext;var f={},h;for(h in s)f[h]=n[h];return a&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=n,e.__reactInternalMemoizedMaskedChildContext=f),f}function er(e){return e=e.childContextTypes,e!=null}function ua(){gt(Zn),gt(zn)}function Cd(e,n,s){if(zn.current!==$i)throw Error(r(168));dt(zn,n),dt(Zn,s)}function kd(e,n,s){var a=e.stateNode;if(n=n.childContextTypes,typeof a.getChildContext!="function")return s;a=a.getChildContext();for(var f in a)if(!(f in n))throw Error(r(108,_e(e)||"Unknown",f));return X({},s,a)}function ca(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||$i,ys=zn.current,dt(zn,e),dt(Zn,Zn.current),!0}function Rd(e,n,s){var a=e.stateNode;if(!a)throw Error(r(169));s?(e=kd(e,n,ys),a.__reactInternalMemoizedMergedChildContext=e,gt(Zn),gt(zn),dt(zn,e)):gt(Zn),dt(Zn,s)}var mi=null,fa=!1,Xu=!1;function Nd(e){mi===null?mi=[e]:mi.push(e)}function ev(e){fa=!0,Nd(e)}function Gi(){if(!Xu&&mi!==null){Xu=!0;var e=0,n=$e;try{var s=mi;for($e=1;e>=y,f-=y,vi=1<<32-In(n)+f|s<Ie?(hn=Me,Me=null):hn=Me.sibling;var Qe=Q(O,Me,I[Ie],se);if(Qe===null){Me===null&&(Me=hn);break}e&&Me&&Qe.alternate===null&&n(O,Me),M=h(Qe,M,Ie),ze===null?Re=Qe:ze.sibling=Qe,ze=Qe,Me=hn}if(Ie===I.length)return s(O,Me),St&&Ss(O,Ie),Re;if(Me===null){for(;IeIe?(hn=Me,Me=null):hn=Me.sibling;var ts=Q(O,Me,Qe.value,se);if(ts===null){Me===null&&(Me=hn);break}e&&Me&&ts.alternate===null&&n(O,Me),M=h(ts,M,Ie),ze===null?Re=ts:ze.sibling=ts,ze=ts,Me=hn}if(Qe.done)return s(O,Me),St&&Ss(O,Ie),Re;if(Me===null){for(;!Qe.done;Ie++,Qe=I.next())Qe=te(O,Qe.value,se),Qe!==null&&(M=h(Qe,M,Ie),ze===null?Re=Qe:ze.sibling=Qe,ze=Qe);return St&&Ss(O,Ie),Re}for(Me=a(O,Me);!Qe.done;Ie++,Qe=I.next())Qe=pe(Me,O,Ie,Qe.value,se),Qe!==null&&(e&&Qe.alternate!==null&&Me.delete(Qe.key===null?Ie:Qe.key),M=h(Qe,M,Ie),ze===null?Re=Qe:ze.sibling=Qe,ze=Qe);return e&&Me.forEach(function(Lv){return n(O,Lv)}),St&&Ss(O,Ie),Re}function Lt(O,M,I,se){if(typeof I=="object"&&I!==null&&I.type===Z&&I.key===null&&(I=I.props.children),typeof I=="object"&&I!==null){switch(I.$$typeof){case ee:e:{for(var Re=I.key,ze=M;ze!==null;){if(ze.key===Re){if(Re=I.type,Re===Z){if(ze.tag===7){s(O,ze.sibling),M=f(ze,I.props.children),M.return=O,O=M;break e}}else if(ze.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===De&&Od(Re)===ze.type){s(O,ze.sibling),M=f(ze,I.props),M.ref=ql(O,ze,I),M.return=O,O=M;break e}s(O,ze);break}else n(O,ze);ze=ze.sibling}I.type===Z?(M=Ds(I.props.children,O.mode,se,I.key),M.return=O,O=M):(se=Fa(I.type,I.key,I.props,null,O.mode,se),se.ref=ql(O,M,I),se.return=O,O=se)}return y(O);case G:e:{for(ze=I.key;M!==null;){if(M.key===ze)if(M.tag===4&&M.stateNode.containerInfo===I.containerInfo&&M.stateNode.implementation===I.implementation){s(O,M.sibling),M=f(M,I.children||[]),M.return=O,O=M;break e}else{s(O,M);break}else n(O,M);M=M.sibling}M=Yc(I,O.mode,se),M.return=O,O=M}return y(O);case De:return ze=I._init,Lt(O,M,ze(I._payload),se)}if(Ze(I))return Se(O,M,I,se);if(oe(I))return Ee(O,M,I,se);ga(O,I)}return typeof I=="string"&&I!==""||typeof I=="number"?(I=""+I,M!==null&&M.tag===6?(s(O,M.sibling),M=f(M,I),M.return=O,O=M):(s(O,M),M=Gc(I,O.mode,se),M.return=O,O=M),y(O)):s(O,M)}return Lt}var ll=Ld(!0),Pd=Ld(!1),ma=Vi(null),va=null,ol=null,nc=null;function rc(){nc=ol=va=null}function ic(e){var n=ma.current;gt(ma),e._currentValue=n}function sc(e,n,s){for(;e!==null;){var a=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,a!==null&&(a.childLanes|=n)):a!==null&&(a.childLanes&n)!==n&&(a.childLanes|=n),e===s)break;e=e.return}}function al(e,n){va=e,nc=ol=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&n)!==0&&(tr=!0),e.firstContext=null)}function zr(e){var n=e._currentValue;if(nc!==e)if(e={context:e,memoizedValue:n,next:null},ol===null){if(va===null)throw Error(r(308));ol=e,va.dependencies={lanes:0,firstContext:e}}else ol=ol.next=e;return n}var xs=null;function lc(e){xs===null?xs=[e]:xs.push(e)}function Ad(e,n,s,a){var f=n.interleaved;return f===null?(s.next=s,lc(n)):(s.next=f.next,f.next=s),n.interleaved=s,wi(e,a)}function wi(e,n){e.lanes|=n;var s=e.alternate;for(s!==null&&(s.lanes|=n),s=e,e=e.return;e!==null;)e.childLanes|=n,s=e.alternate,s!==null&&(s.childLanes|=n),s=e,e=e.return;return s.tag===3?s.stateNode:null}var Yi=!1;function oc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Id(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Si(e,n){return{eventTime:e,lane:n,tag:0,payload:null,callback:null,next:null}}function Ki(e,n,s){var a=e.updateQueue;if(a===null)return null;if(a=a.shared,(Ye&2)!==0){var f=a.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),a.pending=n,wi(e,s)}return f=a.interleaved,f===null?(n.next=n,lc(a)):(n.next=f.next,f.next=n),a.interleaved=n,wi(e,s)}function ya(e,n,s){if(n=n.updateQueue,n!==null&&(n=n.shared,(s&4194240)!==0)){var a=n.lanes;a&=e.pendingLanes,s|=a,n.lanes=s,bi(e,s)}}function Hd(e,n){var s=e.updateQueue,a=e.alternate;if(a!==null&&(a=a.updateQueue,s===a)){var f=null,h=null;if(s=s.firstBaseUpdate,s!==null){do{var y={eventTime:s.eventTime,lane:s.lane,tag:s.tag,payload:s.payload,callback:s.callback,next:null};h===null?f=h=y:h=h.next=y,s=s.next}while(s!==null);h===null?f=h=n:h=h.next=n}else f=h=n;s={baseState:a.baseState,firstBaseUpdate:f,lastBaseUpdate:h,shared:a.shared,effects:a.effects},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=n:e.next=n,s.lastBaseUpdate=n}function wa(e,n,s,a){var f=e.updateQueue;Yi=!1;var h=f.firstBaseUpdate,y=f.lastBaseUpdate,C=f.shared.pending;if(C!==null){f.shared.pending=null;var N=C,F=N.next;N.next=null,y===null?h=F:y.next=F,y=N;var J=e.alternate;J!==null&&(J=J.updateQueue,C=J.lastBaseUpdate,C!==y&&(C===null?J.firstBaseUpdate=F:C.next=F,J.lastBaseUpdate=N))}if(h!==null){var te=f.baseState;y=0,J=F=N=null,C=h;do{var Q=C.lane,pe=C.eventTime;if((a&Q)===Q){J!==null&&(J=J.next={eventTime:pe,lane:0,tag:C.tag,payload:C.payload,callback:C.callback,next:null});e:{var Se=e,Ee=C;switch(Q=n,pe=s,Ee.tag){case 1:if(Se=Ee.payload,typeof Se=="function"){te=Se.call(pe,te,Q);break e}te=Se;break e;case 3:Se.flags=Se.flags&-65537|128;case 0:if(Se=Ee.payload,Q=typeof Se=="function"?Se.call(pe,te,Q):Se,Q==null)break e;te=X({},te,Q);break e;case 2:Yi=!0}}C.callback!==null&&C.lane!==0&&(e.flags|=64,Q=f.effects,Q===null?f.effects=[C]:Q.push(C))}else pe={eventTime:pe,lane:Q,tag:C.tag,payload:C.payload,callback:C.callback,next:null},J===null?(F=J=pe,N=te):J=J.next=pe,y|=Q;if(C=C.next,C===null){if(C=f.shared.pending,C===null)break;Q=C,C=Q.next,Q.next=null,f.lastBaseUpdate=Q,f.shared.pending=null}}while(!0);if(J===null&&(N=te),f.baseState=N,f.firstBaseUpdate=F,f.lastBaseUpdate=J,n=f.shared.interleaved,n!==null){f=n;do y|=f.lane,f=f.next;while(f!==n)}else h===null&&(f.shared.lanes=0);Cs|=y,e.lanes=y,e.memoizedState=te}}function Fd(e,n,s){if(e=n.effects,n.effects=null,e!==null)for(n=0;ns?s:4,e(!0);var a=dc.transition;dc.transition={};try{e(!1),n()}finally{$e=s,dc.transition=a}}function ih(){return Mr().memoizedState}function iv(e,n,s){var a=Ji(e);if(s={lane:a,action:s,hasEagerState:!1,eagerState:null,next:null},sh(e))lh(n,s);else if(s=Ad(e,n,s,a),s!==null){var f=Vn();Vr(s,e,a,f),oh(s,n,a)}}function sv(e,n,s){var a=Ji(e),f={lane:a,action:s,hasEagerState:!1,eagerState:null,next:null};if(sh(e))lh(n,f);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var y=n.lastRenderedState,C=h(y,s);if(f.hasEagerState=!0,f.eagerState=C,at(C,y)){var N=n.interleaved;N===null?(f.next=f,lc(n)):(f.next=N.next,N.next=f),n.interleaved=f;return}}catch{}finally{}s=Ad(e,n,f,a),s!==null&&(f=Vn(),Vr(s,e,a,f),oh(s,n,a))}}function sh(e){var n=e.alternate;return e===kt||n!==null&&n===kt}function lh(e,n){to=_a=!0;var s=e.pending;s===null?n.next=n:(n.next=s.next,s.next=n),e.pending=n}function oh(e,n,s){if((s&4194240)!==0){var a=n.lanes;a&=e.pendingLanes,s|=a,n.lanes=s,bi(e,s)}}var ka={readContext:zr,useCallback:Mn,useContext:Mn,useEffect:Mn,useImperativeHandle:Mn,useInsertionEffect:Mn,useLayoutEffect:Mn,useMemo:Mn,useReducer:Mn,useRef:Mn,useState:Mn,useDebugValue:Mn,useDeferredValue:Mn,useTransition:Mn,useMutableSource:Mn,useSyncExternalStore:Mn,useId:Mn,unstable_isNewReconciler:!1},lv={readContext:zr,useCallback:function(e,n){return si().memoizedState=[e,n===void 0?null:n],e},useContext:zr,useEffect:Xd,useImperativeHandle:function(e,n,s){return s=s!=null?s.concat([e]):null,Ea(4194308,4,Zd.bind(null,n,e),s)},useLayoutEffect:function(e,n){return Ea(4194308,4,e,n)},useInsertionEffect:function(e,n){return Ea(4,2,e,n)},useMemo:function(e,n){var s=si();return n=n===void 0?null:n,e=e(),s.memoizedState=[e,n],e},useReducer:function(e,n,s){var a=si();return n=s!==void 0?s(n):n,a.memoizedState=a.baseState=n,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:n},a.queue=e,e=e.dispatch=iv.bind(null,kt,e),[a.memoizedState,e]},useRef:function(e){var n=si();return e={current:e},n.memoizedState=e},useState:Kd,useDebugValue:wc,useDeferredValue:function(e){return si().memoizedState=e},useTransition:function(){var e=Kd(!1),n=e[0];return e=rv.bind(null,e[1]),si().memoizedState=e,[n,e]},useMutableSource:function(){},useSyncExternalStore:function(e,n,s){var a=kt,f=si();if(St){if(s===void 0)throw Error(r(407));s=s()}else{if(s=n(),dn===null)throw Error(r(349));(Es&30)!==0||Ud(a,n,s)}f.memoizedState=s;var h={value:s,getSnapshot:n};return f.queue=h,Xd($d.bind(null,a,h,e),[e]),a.flags|=2048,io(9,Vd.bind(null,a,h,s,n),void 0,null),s},useId:function(){var e=si(),n=dn.identifierPrefix;if(St){var s=yi,a=vi;s=(a&~(1<<32-In(a)-1)).toString(32)+s,n=":"+n+"R"+s,s=no++,0<\/script>",e=e.removeChild(e.firstChild)):typeof a.is=="string"?e=y.createElement(s,{is:a.is}):(e=y.createElement(s),s==="select"&&(y=e,a.multiple?y.multiple=!0:a.size&&(y.size=a.size))):e=y.createElementNS(e,s),e[ri]=n,e[Ql]=a,Nh(e,n,!1,!1),n.stateNode=e;e:{switch(y=Jr(s,a),s){case"dialog":pt("cancel",e),pt("close",e),f=a;break;case"iframe":case"object":case"embed":pt("load",e),f=a;break;case"video":case"audio":for(f=0;fhl&&(n.flags|=128,a=!0,so(h,!1),n.lanes=4194304)}else{if(!a)if(e=Sa(y),e!==null){if(n.flags|=128,a=!0,s=e.updateQueue,s!==null&&(n.updateQueue=s,n.flags|=4),so(h,!0),h.tail===null&&h.tailMode==="hidden"&&!y.alternate&&!St)return bn(n),null}else 2*ot()-h.renderingStartTime>hl&&s!==1073741824&&(n.flags|=128,a=!0,so(h,!1),n.lanes=4194304);h.isBackwards?(y.sibling=n.child,n.child=y):(s=h.last,s!==null?s.sibling=y:n.child=y,h.last=y)}return h.tail!==null?(n=h.tail,h.rendering=n,h.tail=n.sibling,h.renderingStartTime=ot(),n.sibling=null,s=Ct.current,dt(Ct,a?s&1|2:s&1),n):(bn(n),null);case 22:case 23:return Uc(),a=n.memoizedState!==null,e!==null&&e.memoizedState!==null!==a&&(n.flags|=8192),a&&(n.mode&1)!==0?(vr&1073741824)!==0&&(bn(n),n.subtreeFlags&6&&(n.flags|=8192)):bn(n),null;case 24:return null;case 25:return null}throw Error(r(156,n.tag))}function pv(e,n){switch(Ju(n),n.tag){case 1:return er(n.type)&&ua(),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return ul(),gt(Zn),gt(zn),fc(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 5:return uc(n),null;case 13:if(gt(Ct),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(r(340));sl()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return gt(Ct),null;case 4:return ul(),null;case 10:return ic(n.type._context),null;case 22:case 23:return Uc(),null;case 24:return null;default:return null}}var Ta=!1,On=!1,gv=typeof WeakSet=="function"?WeakSet:Set,we=null;function fl(e,n){var s=e.ref;if(s!==null)if(typeof s=="function")try{s(null)}catch(a){Tt(e,n,a)}else s.current=null}function Mc(e,n,s){try{s()}catch(a){Tt(e,n,a)}}var zh=!1;function mv(e,n){if(Uu=rt,e=Wn(),Bn(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{s=(s=e.ownerDocument)&&s.defaultView||window;var a=s.getSelection&&s.getSelection();if(a&&a.rangeCount!==0){s=a.anchorNode;var f=a.anchorOffset,h=a.focusNode;a=a.focusOffset;try{s.nodeType,h.nodeType}catch{s=null;break e}var y=0,C=-1,N=-1,F=0,J=0,te=e,Q=null;t:for(;;){for(var pe;te!==s||f!==0&&te.nodeType!==3||(C=y+f),te!==h||a!==0&&te.nodeType!==3||(N=y+a),te.nodeType===3&&(y+=te.nodeValue.length),(pe=te.firstChild)!==null;)Q=te,te=pe;for(;;){if(te===e)break t;if(Q===s&&++F===f&&(C=y),Q===h&&++J===a&&(N=y),(pe=te.nextSibling)!==null)break;te=Q,Q=te.parentNode}te=pe}s=C===-1||N===-1?null:{start:C,end:N}}else s=null}s=s||{start:0,end:0}}else s=null;for(Vu={focusedElem:e,selectionRange:s},rt=!1,we=n;we!==null;)if(n=we,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,we=e;else for(;we!==null;){n=we;try{var Se=n.alternate;if((n.flags&1024)!==0)switch(n.tag){case 0:case 11:case 15:break;case 1:if(Se!==null){var Ee=Se.memoizedProps,Lt=Se.memoizedState,O=n.stateNode,M=O.getSnapshotBeforeUpdate(n.elementType===n.type?Ee:Wr(n.type,Ee),Lt);O.__reactInternalSnapshotBeforeUpdate=M}break;case 3:var I=n.stateNode.containerInfo;I.nodeType===1?I.textContent="":I.nodeType===9&&I.documentElement&&I.removeChild(I.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(se){Tt(n,n.return,se)}if(e=n.sibling,e!==null){e.return=n.return,we=e;break}we=n.return}return Se=zh,zh=!1,Se}function lo(e,n,s){var a=n.updateQueue;if(a=a!==null?a.lastEffect:null,a!==null){var f=a=a.next;do{if((f.tag&e)===e){var h=f.destroy;f.destroy=void 0,h!==void 0&&Mc(n,s,h)}f=f.next}while(f!==a)}}function za(e,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var s=n=n.next;do{if((s.tag&e)===e){var a=s.create;s.destroy=a()}s=s.next}while(s!==n)}}function bc(e){var n=e.ref;if(n!==null){var s=e.stateNode;switch(e.tag){case 5:e=s;break;default:e=s}typeof n=="function"?n(e):n.current=e}}function Mh(e){var n=e.alternate;n!==null&&(e.alternate=null,Mh(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&(delete n[ri],delete n[Ql],delete n[Ku],delete n[Jm],delete n[Zm])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function bh(e){return e.tag===5||e.tag===3||e.tag===4}function Oh(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||bh(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.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Oc(e,n,s){var a=e.tag;if(a===5||a===6)e=e.stateNode,n?s.nodeType===8?s.parentNode.insertBefore(e,n):s.insertBefore(e,n):(s.nodeType===8?(n=s.parentNode,n.insertBefore(e,s)):(n=s,n.appendChild(e)),s=s._reactRootContainer,s!=null||n.onclick!==null||(n.onclick=oa));else if(a!==4&&(e=e.child,e!==null))for(Oc(e,n,s),e=e.sibling;e!==null;)Oc(e,n,s),e=e.sibling}function Lc(e,n,s){var a=e.tag;if(a===5||a===6)e=e.stateNode,n?s.insertBefore(e,n):s.appendChild(e);else if(a!==4&&(e=e.child,e!==null))for(Lc(e,n,s),e=e.sibling;e!==null;)Lc(e,n,s),e=e.sibling}var _n=null,Br=!1;function Qi(e,n,s){for(s=s.child;s!==null;)Lh(e,n,s),s=s.sibling}function Lh(e,n,s){if(Qn&&typeof Qn.onCommitFiberUnmount=="function")try{Qn.onCommitFiberUnmount(Di,s)}catch{}switch(s.tag){case 5:On||fl(s,n);case 6:var a=_n,f=Br;_n=null,Qi(e,n,s),_n=a,Br=f,_n!==null&&(Br?(e=_n,s=s.stateNode,e.nodeType===8?e.parentNode.removeChild(s):e.removeChild(s)):_n.removeChild(s.stateNode));break;case 18:_n!==null&&(Br?(e=_n,s=s.stateNode,e.nodeType===8?Yu(e.parentNode,s):e.nodeType===1&&Yu(e,s),Fi(e)):Yu(_n,s.stateNode));break;case 4:a=_n,f=Br,_n=s.stateNode.containerInfo,Br=!0,Qi(e,n,s),_n=a,Br=f;break;case 0:case 11:case 14:case 15:if(!On&&(a=s.updateQueue,a!==null&&(a=a.lastEffect,a!==null))){f=a=a.next;do{var h=f,y=h.destroy;h=h.tag,y!==void 0&&((h&2)!==0||(h&4)!==0)&&Mc(s,n,y),f=f.next}while(f!==a)}Qi(e,n,s);break;case 1:if(!On&&(fl(s,n),a=s.stateNode,typeof a.componentWillUnmount=="function"))try{a.props=s.memoizedProps,a.state=s.memoizedState,a.componentWillUnmount()}catch(C){Tt(s,n,C)}Qi(e,n,s);break;case 21:Qi(e,n,s);break;case 22:s.mode&1?(On=(a=On)||s.memoizedState!==null,Qi(e,n,s),On=a):Qi(e,n,s);break;default:Qi(e,n,s)}}function Ph(e){var n=e.updateQueue;if(n!==null){e.updateQueue=null;var s=e.stateNode;s===null&&(s=e.stateNode=new gv),n.forEach(function(a){var f=kv.bind(null,e,a);s.has(a)||(s.add(a),a.then(f,f))})}}function Ur(e,n){var s=n.deletions;if(s!==null)for(var a=0;af&&(f=y),a&=~h}if(a=f,a=ot()-a,a=(120>a?120:480>a?480:1080>a?1080:1920>a?1920:3e3>a?3e3:4320>a?4320:1960*yv(a/1960))-a,10e?16:e,qi===null)var a=!1;else{if(e=qi,qi=null,Pa=0,(Ye&6)!==0)throw Error(r(331));var f=Ye;for(Ye|=4,we=e.current;we!==null;){var h=we,y=h.child;if((we.flags&16)!==0){var C=h.deletions;if(C!==null){for(var N=0;Not()-Ic?Rs(e,0):Ac|=s),rr(e,n)}function Kh(e,n){n===0&&((e.mode&1)===0?n=1:(n=Ti,Ti<<=1,(Ti&130023424)===0&&(Ti=4194304)));var s=Vn();e=wi(e,n),e!==null&&(Mi(e,n,s),rr(e,s))}function Cv(e){var n=e.memoizedState,s=0;n!==null&&(s=n.retryLane),Kh(e,s)}function kv(e,n){var s=0;switch(e.tag){case 13:var a=e.stateNode,f=e.memoizedState;f!==null&&(s=f.retryLane);break;case 19:a=e.stateNode;break;default:throw Error(r(314))}a!==null&&a.delete(n),Kh(e,s)}var Qh;Qh=function(e,n,s){if(e!==null)if(e.memoizedProps!==n.pendingProps||Zn.current)tr=!0;else{if((e.lanes&s)===0&&(n.flags&128)===0)return tr=!1,dv(e,n,s);tr=(e.flags&131072)!==0}else tr=!1,St&&(n.flags&1048576)!==0&&Dd(n,ha,n.index);switch(n.lanes=0,n.tag){case 2:var a=n.type;Da(e,n),e=n.pendingProps;var f=nl(n,zn.current);al(n,s),f=pc(null,n,a,e,f,s);var h=gc();return n.flags|=1,typeof f=="object"&&f!==null&&typeof f.render=="function"&&f.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,er(a)?(h=!0,ca(n)):h=!1,n.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,oc(n),f.updater=Ra,n.stateNode=f,f._reactInternals=n,xc(n,a,e,s),n=kc(null,n,a,!0,h,s)):(n.tag=0,St&&h&&qu(n),Un(null,n,f,s),n=n.child),n;case 16:a=n.elementType;e:{switch(Da(e,n),e=n.pendingProps,f=a._init,a=f(a._payload),n.type=a,f=n.tag=Nv(a),e=Wr(a,e),f){case 0:n=Cc(null,n,a,e,s);break e;case 1:n=xh(null,n,a,e,s);break e;case 11:n=mh(null,n,a,e,s);break e;case 14:n=vh(null,n,a,Wr(a.type,e),s);break e}throw Error(r(306,a,""))}return n;case 0:return a=n.type,f=n.pendingProps,f=n.elementType===a?f:Wr(a,f),Cc(e,n,a,f,s);case 1:return a=n.type,f=n.pendingProps,f=n.elementType===a?f:Wr(a,f),xh(e,n,a,f,s);case 3:e:{if(_h(n),e===null)throw Error(r(387));a=n.pendingProps,h=n.memoizedState,f=h.element,Id(e,n),wa(n,a,null,s);var y=n.memoizedState;if(a=y.element,h.isDehydrated)if(h={element:a,isDehydrated:!1,cache:y.cache,pendingSuspenseBoundaries:y.pendingSuspenseBoundaries,transitions:y.transitions},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){f=cl(Error(r(423)),n),n=Eh(e,n,a,s,f);break e}else if(a!==f){f=cl(Error(r(424)),n),n=Eh(e,n,a,s,f);break e}else for(mr=Ui(n.stateNode.containerInfo.firstChild),gr=n,St=!0,jr=null,s=Pd(n,null,a,s),n.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(sl(),a===f){n=xi(e,n,s);break e}Un(e,n,a,s)}n=n.child}return n;case 5:return jd(n),e===null&&ec(n),a=n.type,f=n.pendingProps,h=e!==null?e.memoizedProps:null,y=f.children,$u(a,f)?y=null:h!==null&&$u(a,h)&&(n.flags|=32),Sh(e,n),Un(e,n,y,s),n.child;case 6:return e===null&&ec(n),null;case 13:return Ch(e,n,s);case 4:return ac(n,n.stateNode.containerInfo),a=n.pendingProps,e===null?n.child=ll(n,null,a,s):Un(e,n,a,s),n.child;case 11:return a=n.type,f=n.pendingProps,f=n.elementType===a?f:Wr(a,f),mh(e,n,a,f,s);case 7:return Un(e,n,n.pendingProps,s),n.child;case 8:return Un(e,n,n.pendingProps.children,s),n.child;case 12:return Un(e,n,n.pendingProps.children,s),n.child;case 10:e:{if(a=n.type._context,f=n.pendingProps,h=n.memoizedProps,y=f.value,dt(ma,a._currentValue),a._currentValue=y,h!==null)if(at(h.value,y)){if(h.children===f.children&&!Zn.current){n=xi(e,n,s);break e}}else for(h=n.child,h!==null&&(h.return=n);h!==null;){var C=h.dependencies;if(C!==null){y=h.child;for(var N=C.firstContext;N!==null;){if(N.context===a){if(h.tag===1){N=Si(-1,s&-s),N.tag=2;var F=h.updateQueue;if(F!==null){F=F.shared;var J=F.pending;J===null?N.next=N:(N.next=J.next,J.next=N),F.pending=N}}h.lanes|=s,N=h.alternate,N!==null&&(N.lanes|=s),sc(h.return,s,n),C.lanes|=s;break}N=N.next}}else if(h.tag===10)y=h.type===n.type?null:h.child;else if(h.tag===18){if(y=h.return,y===null)throw Error(r(341));y.lanes|=s,C=y.alternate,C!==null&&(C.lanes|=s),sc(y,s,n),y=h.sibling}else y=h.child;if(y!==null)y.return=h;else for(y=h;y!==null;){if(y===n){y=null;break}if(h=y.sibling,h!==null){h.return=y.return,y=h;break}y=y.return}h=y}Un(e,n,f.children,s),n=n.child}return n;case 9:return f=n.type,a=n.pendingProps.children,al(n,s),f=zr(f),a=a(f),n.flags|=1,Un(e,n,a,s),n.child;case 14:return a=n.type,f=Wr(a,n.pendingProps),f=Wr(a.type,f),vh(e,n,a,f,s);case 15:return yh(e,n,n.type,n.pendingProps,s);case 17:return a=n.type,f=n.pendingProps,f=n.elementType===a?f:Wr(a,f),Da(e,n),n.tag=1,er(a)?(e=!0,ca(n)):e=!1,al(n,s),uh(n,a,f),xc(n,a,f,s),kc(null,n,a,!0,e,s);case 19:return Rh(e,n,s);case 22:return wh(e,n,s)}throw Error(r(156,n.tag))};function Xh(e,n){return Mt(e,n)}function Rv(e,n,s,a){this.tag=e,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Or(e,n,s,a){return new Rv(e,n,s,a)}function $c(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Nv(e){if(typeof e=="function")return $c(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ce)return 11;if(e===me)return 14}return 2}function es(e,n){var s=e.alternate;return s===null?(s=Or(e.tag,n,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=n,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=e.flags&14680064,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,n=e.dependencies,s.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s}function Fa(e,n,s,a,f,h){var y=2;if(a=e,typeof e=="function")$c(e)&&(y=1);else if(typeof e=="string")y=5;else e:switch(e){case Z:return Ds(s.children,f,h,n);case re:y=8,f|=8;break;case ve:return e=Or(12,s,n,f|2),e.elementType=ve,e.lanes=h,e;case ae:return e=Or(13,s,n,f),e.elementType=ae,e.lanes=h,e;case ye:return e=Or(19,s,n,f),e.elementType=ye,e.lanes=h,e;case le:return ja(s,f,h,n);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case de:y=10;break e;case Y:y=9;break e;case Ce:y=11;break e;case me:y=14;break e;case De:y=16,a=null;break e}throw Error(r(130,e==null?e:typeof e,""))}return n=Or(y,s,n,f),n.elementType=e,n.type=a,n.lanes=h,n}function Ds(e,n,s,a){return e=Or(7,e,a,n),e.lanes=s,e}function ja(e,n,s,a){return e=Or(22,e,a,n),e.elementType=le,e.lanes=s,e.stateNode={isHidden:!1},e}function Gc(e,n,s){return e=Or(6,e,null,n),e.lanes=s,e}function Yc(e,n,s){return n=Or(4,e.children!==null?e.children:[],e.key,n),n.lanes=s,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function Dv(e,n,s,a,f){this.tag=n,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Al(0),this.expirationTimes=Al(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Al(0),this.identifierPrefix=a,this.onRecoverableError=f,this.mutableSourceEagerHydrationData=null}function Kc(e,n,s,a,f,h,y,C,N){return e=new Dv(e,n,s,C,N),n===1?(n=1,h===!0&&(n|=8)):n=0,h=Or(3,null,null,n),e.current=h,h.stateNode=e,h.memoizedState={element:a,isDehydrated:s,cache:null,transitions:null,pendingSuspenseBoundaries:null},oc(h),e}function Tv(e,n,s){var a=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l)}catch(t){console.error(t)}}return l(),ef.exports=Bv(),ef.exports}var cp;function Uv(){if(cp)return Ya;cp=1;var l=kg();return Ya.createRoot=l.createRoot,Ya.hydrateRoot=l.hydrateRoot,Ya}var Vv=Uv();const $v=Cg(Vv);var bs=kg();const yu=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Nl(l){const t=Object.prototype.toString.call(l);return t==="[object Window]"||t==="[object global]"}function Hf(l){return"nodeType"in l}function Yn(l){var t,r;return l?Nl(l)?l:Hf(l)&&(t=(r=l.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function Ff(l){const{Document:t}=Yn(l);return l instanceof t}function bo(l){return Nl(l)?!1:l instanceof Yn(l).HTMLElement}function Rg(l){return l instanceof Yn(l).SVGElement}function Dl(l){return l?Nl(l)?l.document:Hf(l)?Ff(l)?l:bo(l)||Rg(l)?l.ownerDocument:document:document:document}const ki=yu?j.useLayoutEffect:j.useEffect;function wu(l){const t=j.useRef(l);return ki(()=>{t.current=l}),j.useCallback(function(){for(var r=arguments.length,i=new Array(r),o=0;o{l.current=setInterval(i,o)},[]),r=j.useCallback(()=>{l.current!==null&&(clearInterval(l.current),l.current=null)},[]);return[t,r]}function Ro(l,t){t===void 0&&(t=[l]);const r=j.useRef(l);return ki(()=>{r.current!==l&&(r.current=l)},t),r}function Oo(l,t){const r=j.useRef();return j.useMemo(()=>{const i=l(r.current);return r.current=i,i},[...t])}function ru(l){const t=wu(l),r=j.useRef(null),i=j.useCallback(o=>{o!==r.current&&(t==null||t(o,r.current)),r.current=o},[]);return[r,i]}function iu(l){const t=j.useRef();return j.useEffect(()=>{t.current=l},[l]),t.current}let rf={};function Su(l,t){return j.useMemo(()=>{if(t)return t;const r=rf[l]==null?0:rf[l]+1;return rf[l]=r,l+"-"+r},[l,t])}function Ng(l){return function(t){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o{const d=Object.entries(c);for(const[p,m]of d){const w=u[p];w!=null&&(u[p]=w+l*m)}return u},{...t})}}const wl=Ng(1),su=Ng(-1);function Yv(l){return"clientX"in l&&"clientY"in l}function jf(l){if(!l)return!1;const{KeyboardEvent:t}=Yn(l.target);return t&&l instanceof t}function Kv(l){if(!l)return!1;const{TouchEvent:t}=Yn(l.target);return t&&l instanceof t}function lu(l){if(Kv(l)){if(l.touches&&l.touches.length){const{clientX:t,clientY:r}=l.touches[0];return{x:t,y:r}}else if(l.changedTouches&&l.changedTouches.length){const{clientX:t,clientY:r}=l.changedTouches[0];return{x:t,y:r}}}return Yv(l)?{x:l.clientX,y:l.clientY}:null}const No=Object.freeze({Translate:{toString(l){if(!l)return;const{x:t,y:r}=l;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(l){if(!l)return;const{scaleX:t,scaleY:r}=l;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(l){if(l)return[No.Translate.toString(l),No.Scale.toString(l)].join(" ")}},Transition:{toString(l){let{property:t,duration:r,easing:i}=l;return t+" "+r+"ms "+i}}}),fp="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Qv(l){return l.matches(fp)?l:l.querySelector(fp)}const Xv={display:"none"};function qv(l){let{id:t,value:r}=l;return ht.createElement("div",{id:t,style:Xv},r)}function Jv(l){let{id:t,announcement:r,ariaLiveType:i="assertive"}=l;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return ht.createElement("div",{id:t,style:o,role:"status","aria-live":i,"aria-atomic":!0},r)}function Zv(){const[l,t]=j.useState("");return{announce:j.useCallback(i=>{i!=null&&t(i)},[]),announcement:l}}const Dg=j.createContext(null);function ey(l){const t=j.useContext(Dg);j.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(l)},[l,t])}function ty(){const[l]=j.useState(()=>new Set),t=j.useCallback(i=>(l.add(i),()=>l.delete(i)),[l]);return[j.useCallback(i=>{let{type:o,event:u}=i;l.forEach(c=>{var d;return(d=c[o])==null?void 0:d.call(c,u)})},[l]),t]}const ny={draggable:` + To pick up a draggable item, press the space bar. + While dragging, use the arrow keys to move the item. + Press space again to drop the item in its new position, or press escape to cancel. + `},ry={onDragStart(l){let{active:t}=l;return"Picked up draggable item "+t.id+"."},onDragOver(l){let{active:t,over:r}=l;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(l){let{active:t,over:r}=l;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(l){let{active:t}=l;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function iy(l){let{announcements:t=ry,container:r,hiddenTextDescribedById:i,screenReaderInstructions:o=ny}=l;const{announce:u,announcement:c}=Zv(),d=Su("DndLiveRegion"),[p,m]=j.useState(!1);if(j.useEffect(()=>{m(!0)},[]),ey(j.useMemo(()=>({onDragStart(v){let{active:x}=v;u(t.onDragStart({active:x}))},onDragMove(v){let{active:x,over:z}=v;t.onDragMove&&u(t.onDragMove({active:x,over:z}))},onDragOver(v){let{active:x,over:z}=v;u(t.onDragOver({active:x,over:z}))},onDragEnd(v){let{active:x,over:z}=v;u(t.onDragEnd({active:x,over:z}))},onDragCancel(v){let{active:x,over:z}=v;u(t.onDragCancel({active:x,over:z}))}}),[u,t])),!p)return null;const w=ht.createElement(ht.Fragment,null,ht.createElement(qv,{id:i,value:o.draggable}),ht.createElement(Jv,{id:d,announcement:c}));return r?bs.createPortal(w,r):w}var en;(function(l){l.DragStart="dragStart",l.DragMove="dragMove",l.DragEnd="dragEnd",l.DragCancel="dragCancel",l.DragOver="dragOver",l.RegisterDroppable="registerDroppable",l.SetDroppableDisabled="setDroppableDisabled",l.UnregisterDroppable="unregisterDroppable"})(en||(en={}));function ou(){}function sy(l,t){return j.useMemo(()=>({sensor:l,options:t??{}}),[l,t])}function ly(){for(var l=arguments.length,t=new Array(l),r=0;r[...t].filter(i=>i!=null),[...t])}const Qr=Object.freeze({x:0,y:0});function oy(l,t){const r=lu(l);if(!r)return"0 0";const i={x:(r.x-t.left)/t.width*100,y:(r.y-t.top)/t.height*100};return i.x+"% "+i.y+"%"}function ay(l,t){let{data:{value:r}}=l,{data:{value:i}}=t;return i-r}function uy(l,t){if(!l||l.length===0)return null;const[r]=l;return r[t]}function cy(l,t){const r=Math.max(t.top,l.top),i=Math.max(t.left,l.left),o=Math.min(t.left+t.width,l.left+l.width),u=Math.min(t.top+t.height,l.top+l.height),c=o-i,d=u-r;if(i{let{collisionRect:t,droppableRects:r,droppableContainers:i}=l;const o=[];for(const u of i){const{id:c}=u,d=r.get(c);if(d){const p=cy(d,t);p>0&&o.push({id:c,data:{droppableContainer:u,value:p}})}}return o.sort(ay)};function dy(l,t,r){return{...l,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function Tg(l,t){return l&&t?{x:l.left-t.left,y:l.top-t.top}:Qr}function hy(l){return function(r){for(var i=arguments.length,o=new Array(i>1?i-1:0),u=1;u({...c,top:c.top+l*d.y,bottom:c.bottom+l*d.y,left:c.left+l*d.x,right:c.right+l*d.x}),{...r})}}const py=hy(1);function zg(l){if(l.startsWith("matrix3d(")){const t=l.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(l.startsWith("matrix(")){const t=l.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function gy(l,t,r){const i=zg(t);if(!i)return l;const{scaleX:o,scaleY:u,x:c,y:d}=i,p=l.left-c-(1-o)*parseFloat(r),m=l.top-d-(1-u)*parseFloat(r.slice(r.indexOf(" ")+1)),w=o?l.width/o:l.width,v=u?l.height/u:l.height;return{width:w,height:v,top:m,right:p+w,bottom:m+v,left:p}}const my={ignoreTransform:!1};function Lo(l,t){t===void 0&&(t=my);let r=l.getBoundingClientRect();if(t.ignoreTransform){const{transform:m,transformOrigin:w}=Yn(l).getComputedStyle(l);m&&(r=gy(r,m,w))}const{top:i,left:o,width:u,height:c,bottom:d,right:p}=r;return{top:i,left:o,width:u,height:c,bottom:d,right:p}}function dp(l){return Lo(l,{ignoreTransform:!0})}function vy(l){const t=l.innerWidth,r=l.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function yy(l,t){return t===void 0&&(t=Yn(l).getComputedStyle(l)),t.position==="fixed"}function wy(l,t){t===void 0&&(t=Yn(l).getComputedStyle(l));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const u=t[o];return typeof u=="string"?r.test(u):!1})}function Wf(l,t){const r=[];function i(o){if(t!=null&&r.length>=t||!o)return r;if(Ff(o)&&o.scrollingElement!=null&&!r.includes(o.scrollingElement))return r.push(o.scrollingElement),r;if(!bo(o)||Rg(o)||r.includes(o))return r;const u=Yn(l).getComputedStyle(o);return o!==l&&wy(o,u)&&r.push(o),yy(o,u)?r:i(o.parentNode)}return l?i(l):r}function Mg(l){const[t]=Wf(l,1);return t??null}function sf(l){return!yu||!l?null:Nl(l)?l:Hf(l)?Ff(l)||l===Dl(l).scrollingElement?window:bo(l)?l:null:null}function bg(l){return Nl(l)?l.scrollX:l.scrollLeft}function Og(l){return Nl(l)?l.scrollY:l.scrollTop}function _f(l){return{x:bg(l),y:Og(l)}}var pn;(function(l){l[l.Forward=1]="Forward",l[l.Backward=-1]="Backward"})(pn||(pn={}));function Lg(l){return!yu||!l?!1:l===document.scrollingElement}function Pg(l){const t={x:0,y:0},r=Lg(l)?{height:window.innerHeight,width:window.innerWidth}:{height:l.clientHeight,width:l.clientWidth},i={x:l.scrollWidth-r.width,y:l.scrollHeight-r.height},o=l.scrollTop<=t.y,u=l.scrollLeft<=t.x,c=l.scrollTop>=i.y,d=l.scrollLeft>=i.x;return{isTop:o,isLeft:u,isBottom:c,isRight:d,maxScroll:i,minScroll:t}}const Sy={x:.2,y:.2};function xy(l,t,r,i,o){let{top:u,left:c,right:d,bottom:p}=r;i===void 0&&(i=10),o===void 0&&(o=Sy);const{isTop:m,isBottom:w,isLeft:v,isRight:x}=Pg(l),z={x:0,y:0},R={x:0,y:0},k={height:t.height*o.y,width:t.width*o.x};return!m&&u<=t.top+k.height?(z.y=pn.Backward,R.y=i*Math.abs((t.top+k.height-u)/k.height)):!w&&p>=t.bottom-k.height&&(z.y=pn.Forward,R.y=i*Math.abs((t.bottom-k.height-p)/k.height)),!x&&d>=t.right-k.width?(z.x=pn.Forward,R.x=i*Math.abs((t.right-k.width-d)/k.width)):!v&&c<=t.left+k.width&&(z.x=pn.Backward,R.x=i*Math.abs((t.left+k.width-c)/k.width)),{direction:z,speed:R}}function _y(l){if(l===document.scrollingElement){const{innerWidth:u,innerHeight:c}=window;return{top:0,left:0,right:u,bottom:c,width:u,height:c}}const{top:t,left:r,right:i,bottom:o}=l.getBoundingClientRect();return{top:t,left:r,right:i,bottom:o,width:l.clientWidth,height:l.clientHeight}}function Ag(l){return l.reduce((t,r)=>wl(t,_f(r)),Qr)}function Ey(l){return l.reduce((t,r)=>t+bg(r),0)}function Cy(l){return l.reduce((t,r)=>t+Og(r),0)}function Ig(l,t){if(t===void 0&&(t=Lo),!l)return;const{top:r,left:i,bottom:o,right:u}=t(l);Mg(l)&&(o<=0||u<=0||r>=window.innerHeight||i>=window.innerWidth)&&l.scrollIntoView({block:"center",inline:"center"})}const ky=[["x",["left","right"],Ey],["y",["top","bottom"],Cy]];class Bf{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const i=Wf(r),o=Ag(i);this.rect={...t},this.width=t.width,this.height=t.height;for(const[u,c,d]of ky)for(const p of c)Object.defineProperty(this,p,{get:()=>{const m=d(i),w=o[u]-m;return this.rect[p]+w},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class So{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var i;return(i=this.target)==null?void 0:i.removeEventListener(...r)})},this.target=t}add(t,r,i){var o;(o=this.target)==null||o.addEventListener(t,r,i),this.listeners.push([t,r,i])}}function Ry(l){const{EventTarget:t}=Yn(l);return l instanceof t?l:Dl(l)}function lf(l,t){const r=Math.abs(l.x),i=Math.abs(l.y);return typeof t=="number"?Math.sqrt(r**2+i**2)>t:"x"in t&&"y"in t?r>t.x&&i>t.y:"x"in t?r>t.x:"y"in t?i>t.y:!1}var Pr;(function(l){l.Click="click",l.DragStart="dragstart",l.Keydown="keydown",l.ContextMenu="contextmenu",l.Resize="resize",l.SelectionChange="selectionchange",l.VisibilityChange="visibilitychange"})(Pr||(Pr={}));function hp(l){l.preventDefault()}function Ny(l){l.stopPropagation()}var ut;(function(l){l.Space="Space",l.Down="ArrowDown",l.Right="ArrowRight",l.Left="ArrowLeft",l.Up="ArrowUp",l.Esc="Escape",l.Enter="Enter",l.Tab="Tab"})(ut||(ut={}));const Hg={start:[ut.Space,ut.Enter],cancel:[ut.Esc],end:[ut.Space,ut.Enter,ut.Tab]},Dy=(l,t)=>{let{currentCoordinates:r}=t;switch(l.code){case ut.Right:return{...r,x:r.x+25};case ut.Left:return{...r,x:r.x-25};case ut.Down:return{...r,y:r.y+25};case ut.Up:return{...r,y:r.y-25}}};class Fg{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:r}}=t;this.props=t,this.listeners=new So(Dl(r)),this.windowListeners=new So(Yn(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Pr.Resize,this.handleCancel),this.windowListeners.add(Pr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Pr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,i=t.node.current;i&&Ig(i),r(Qr)}handleKeyDown(t){if(jf(t)){const{active:r,context:i,options:o}=this.props,{keyboardCodes:u=Hg,coordinateGetter:c=Dy,scrollBehavior:d="smooth"}=o,{code:p}=t;if(u.end.includes(p)){this.handleEnd(t);return}if(u.cancel.includes(p)){this.handleCancel(t);return}const{collisionRect:m}=i.current,w=m?{x:m.left,y:m.top}:Qr;this.referenceCoordinates||(this.referenceCoordinates=w);const v=c(t,{active:r,context:i.current,currentCoordinates:w});if(v){const x=su(v,w),z={x:0,y:0},{scrollableAncestors:R}=i.current;for(const k of R){const b=t.code,{isTop:W,isRight:P,isLeft:B,isBottom:V,maxScroll:ee,minScroll:G}=Pg(k),Z=_y(k),re={x:Math.min(b===ut.Right?Z.right-Z.width/2:Z.right,Math.max(b===ut.Right?Z.left:Z.left+Z.width/2,v.x)),y:Math.min(b===ut.Down?Z.bottom-Z.height/2:Z.bottom,Math.max(b===ut.Down?Z.top:Z.top+Z.height/2,v.y))},ve=b===ut.Right&&!P||b===ut.Left&&!B,de=b===ut.Down&&!V||b===ut.Up&&!W;if(ve&&re.x!==v.x){const Y=k.scrollLeft+x.x,Ce=b===ut.Right&&Y<=ee.x||b===ut.Left&&Y>=G.x;if(Ce&&!x.y){k.scrollTo({left:Y,behavior:d});return}Ce?z.x=k.scrollLeft-Y:z.x=b===ut.Right?k.scrollLeft-ee.x:k.scrollLeft-G.x,z.x&&k.scrollBy({left:-z.x,behavior:d});break}else if(de&&re.y!==v.y){const Y=k.scrollTop+x.y,Ce=b===ut.Down&&Y<=ee.y||b===ut.Up&&Y>=G.y;if(Ce&&!x.x){k.scrollTo({top:Y,behavior:d});return}Ce?z.y=k.scrollTop-Y:z.y=b===ut.Down?k.scrollTop-ee.y:k.scrollTop-G.y,z.y&&k.scrollBy({top:-z.y,behavior:d});break}}this.handleMove(t,wl(su(v,this.referenceCoordinates),z))}}}handleMove(t,r){const{onMove:i}=this.props;t.preventDefault(),i(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Fg.activators=[{eventName:"onKeyDown",handler:(l,t,r)=>{let{keyboardCodes:i=Hg,onActivation:o}=t,{active:u}=r;const{code:c}=l.nativeEvent;if(i.start.includes(c)){const d=u.activatorNode.current;return d&&l.target!==d?!1:(l.preventDefault(),o==null||o({event:l.nativeEvent}),!0)}return!1}}];function pp(l){return!!(l&&"distance"in l)}function gp(l){return!!(l&&"delay"in l)}class Uf{constructor(t,r,i){var o;i===void 0&&(i=Ry(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;const{event:u}=t,{target:c}=u;this.props=t,this.events=r,this.document=Dl(c),this.documentListeners=new So(this.document),this.listeners=new So(i),this.windowListeners=new So(Yn(c)),this.initialCoordinates=(o=lu(u))!=null?o:Qr,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:i}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Pr.Resize,this.handleCancel),this.windowListeners.add(Pr.DragStart,hp),this.windowListeners.add(Pr.VisibilityChange,this.handleCancel),this.windowListeners.add(Pr.ContextMenu,hp),this.documentListeners.add(Pr.Keydown,this.handleKeydown),r){if(i!=null&&i({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(gp(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(pp(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,r){const{active:i,onPending:o}=this.props;o(i,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(Pr.Click,Ny,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Pr.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:i,initialCoordinates:o,props:u}=this,{onMove:c,options:{activationConstraint:d}}=u;if(!o)return;const p=(r=lu(t))!=null?r:Qr,m=su(o,p);if(!i&&d){if(pp(d)){if(d.tolerance!=null&&lf(m,d.tolerance))return this.handleCancel();if(lf(m,d.distance))return this.handleStart()}if(gp(d)&&lf(m,d.tolerance))return this.handleCancel();this.handlePending(d,m);return}t.cancelable&&t.preventDefault(),c(p)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===ut.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Ty={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Vf extends Uf{constructor(t){const{event:r}=t,i=Dl(r.target);super(t,Ty,i)}}Vf.activators=[{eventName:"onPointerDown",handler:(l,t)=>{let{nativeEvent:r}=l,{onActivation:i}=t;return!r.isPrimary||r.button!==0?!1:(i==null||i({event:r}),!0)}}];const zy={move:{name:"mousemove"},end:{name:"mouseup"}};var Ef;(function(l){l[l.RightClick=2]="RightClick"})(Ef||(Ef={}));class My extends Uf{constructor(t){super(t,zy,Dl(t.event.target))}}My.activators=[{eventName:"onMouseDown",handler:(l,t)=>{let{nativeEvent:r}=l,{onActivation:i}=t;return r.button===Ef.RightClick?!1:(i==null||i({event:r}),!0)}}];const of={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class by extends Uf{constructor(t){super(t,of)}static setup(){return window.addEventListener(of.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(of.move.name,t)};function t(){}}}by.activators=[{eventName:"onTouchStart",handler:(l,t)=>{let{nativeEvent:r}=l,{onActivation:i}=t;const{touches:o}=r;return o.length>1?!1:(i==null||i({event:r}),!0)}}];var xo;(function(l){l[l.Pointer=0]="Pointer",l[l.DraggableRect=1]="DraggableRect"})(xo||(xo={}));var au;(function(l){l[l.TreeOrder=0]="TreeOrder",l[l.ReversedTreeOrder=1]="ReversedTreeOrder"})(au||(au={}));function Oy(l){let{acceleration:t,activator:r=xo.Pointer,canScroll:i,draggingRect:o,enabled:u,interval:c=5,order:d=au.TreeOrder,pointerCoordinates:p,scrollableAncestors:m,scrollableAncestorRects:w,delta:v,threshold:x}=l;const z=Py({delta:v,disabled:!u}),[R,k]=Gv(),b=j.useRef({x:0,y:0}),W=j.useRef({x:0,y:0}),P=j.useMemo(()=>{switch(r){case xo.Pointer:return p?{top:p.y,bottom:p.y,left:p.x,right:p.x}:null;case xo.DraggableRect:return o}},[r,o,p]),B=j.useRef(null),V=j.useCallback(()=>{const G=B.current;if(!G)return;const Z=b.current.x*W.current.x,re=b.current.y*W.current.y;G.scrollBy(Z,re)},[]),ee=j.useMemo(()=>d===au.TreeOrder?[...m].reverse():m,[d,m]);j.useEffect(()=>{if(!u||!m.length||!P){k();return}for(const G of ee){if((i==null?void 0:i(G))===!1)continue;const Z=m.indexOf(G),re=w[Z];if(!re)continue;const{direction:ve,speed:de}=xy(G,re,P,t,x);for(const Y of["x","y"])z[Y][ve[Y]]||(de[Y]=0,ve[Y]=0);if(de.x>0||de.y>0){k(),B.current=G,R(V,c),b.current=de,W.current=ve;return}}b.current={x:0,y:0},W.current={x:0,y:0},k()},[t,V,i,k,u,c,JSON.stringify(P),JSON.stringify(z),R,m,ee,w,JSON.stringify(x)])}const Ly={x:{[pn.Backward]:!1,[pn.Forward]:!1},y:{[pn.Backward]:!1,[pn.Forward]:!1}};function Py(l){let{delta:t,disabled:r}=l;const i=iu(t);return Oo(o=>{if(r||!i||!o)return Ly;const u={x:Math.sign(t.x-i.x),y:Math.sign(t.y-i.y)};return{x:{[pn.Backward]:o.x[pn.Backward]||u.x===-1,[pn.Forward]:o.x[pn.Forward]||u.x===1},y:{[pn.Backward]:o.y[pn.Backward]||u.y===-1,[pn.Forward]:o.y[pn.Forward]||u.y===1}}},[r,t,i])}function Ay(l,t){const r=t!=null?l.get(t):void 0,i=r?r.node.current:null;return Oo(o=>{var u;return t==null?null:(u=i??o)!=null?u:null},[i,t])}function Iy(l,t){return j.useMemo(()=>l.reduce((r,i)=>{const{sensor:o}=i,u=o.activators.map(c=>({eventName:c.eventName,handler:t(c.handler,i)}));return[...r,...u]},[]),[l,t])}var Do;(function(l){l[l.Always=0]="Always",l[l.BeforeDragging=1]="BeforeDragging",l[l.WhileDragging=2]="WhileDragging"})(Do||(Do={}));var Cf;(function(l){l.Optimized="optimized"})(Cf||(Cf={}));const mp=new Map;function Hy(l,t){let{dragging:r,dependencies:i,config:o}=t;const[u,c]=j.useState(null),{frequency:d,measure:p,strategy:m}=o,w=j.useRef(l),v=b(),x=Ro(v),z=j.useCallback(function(W){W===void 0&&(W=[]),!x.current&&c(P=>P===null?W:P.concat(W.filter(B=>!P.includes(B))))},[x]),R=j.useRef(null),k=Oo(W=>{if(v&&!r)return mp;if(!W||W===mp||w.current!==l||u!=null){const P=new Map;for(let B of l){if(!B)continue;if(u&&u.length>0&&!u.includes(B.id)&&B.rect.current){P.set(B.id,B.rect.current);continue}const V=B.node.current,ee=V?new Bf(p(V),V):null;B.rect.current=ee,ee&&P.set(B.id,ee)}return P}return W},[l,u,r,v,p]);return j.useEffect(()=>{w.current=l},[l]),j.useEffect(()=>{v||z()},[r,v]),j.useEffect(()=>{u&&u.length>0&&c(null)},[JSON.stringify(u)]),j.useEffect(()=>{v||typeof d!="number"||R.current!==null||(R.current=setTimeout(()=>{z(),R.current=null},d))},[d,v,z,...i]),{droppableRects:k,measureDroppableContainers:z,measuringScheduled:u!=null};function b(){switch(m){case Do.Always:return!1;case Do.BeforeDragging:return r;default:return!r}}}function $f(l,t){return Oo(r=>l?r||(typeof t=="function"?t(l):l):null,[t,l])}function Fy(l,t){return $f(l,t)}function jy(l){let{callback:t,disabled:r}=l;const i=wu(t),o=j.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:u}=window;return new u(i)},[i,r]);return j.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function xu(l){let{callback:t,disabled:r}=l;const i=wu(t),o=j.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:u}=window;return new u(i)},[r]);return j.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function Wy(l){return new Bf(Lo(l),l)}function vp(l,t,r){t===void 0&&(t=Wy);const[i,o]=j.useState(null);function u(){o(p=>{if(!l)return null;if(l.isConnected===!1){var m;return(m=p??r)!=null?m:null}const w=t(l);return JSON.stringify(p)===JSON.stringify(w)?p:w})}const c=jy({callback(p){if(l)for(const m of p){const{type:w,target:v}=m;if(w==="childList"&&v instanceof HTMLElement&&v.contains(l)){u();break}}}}),d=xu({callback:u});return ki(()=>{u(),l?(d==null||d.observe(l),c==null||c.observe(document.body,{childList:!0,subtree:!0})):(d==null||d.disconnect(),c==null||c.disconnect())},[l]),i}function By(l){const t=$f(l);return Tg(l,t)}const yp=[];function Uy(l){const t=j.useRef(l),r=Oo(i=>l?i&&i!==yp&&l&&t.current&&l.parentNode===t.current.parentNode?i:Wf(l):yp,[l]);return j.useEffect(()=>{t.current=l},[l]),r}function Vy(l){const[t,r]=j.useState(null),i=j.useRef(l),o=j.useCallback(u=>{const c=sf(u.target);c&&r(d=>d?(d.set(c,_f(c)),new Map(d)):null)},[]);return j.useEffect(()=>{const u=i.current;if(l!==u){c(u);const d=l.map(p=>{const m=sf(p);return m?(m.addEventListener("scroll",o,{passive:!0}),[m,_f(m)]):null}).filter(p=>p!=null);r(d.length?new Map(d):null),i.current=l}return()=>{c(l),c(u)};function c(d){d.forEach(p=>{const m=sf(p);m==null||m.removeEventListener("scroll",o)})}},[o,l]),j.useMemo(()=>l.length?t?Array.from(t.values()).reduce((u,c)=>wl(u,c),Qr):Ag(l):Qr,[l,t])}function wp(l,t){t===void 0&&(t=[]);const r=j.useRef(null);return j.useEffect(()=>{r.current=null},t),j.useEffect(()=>{const i=l!==Qr;i&&!r.current&&(r.current=l),!i&&r.current&&(r.current=null)},[l]),r.current?su(l,r.current):Qr}function $y(l){j.useEffect(()=>{if(!yu)return;const t=l.map(r=>{let{sensor:i}=r;return i.setup==null?void 0:i.setup()});return()=>{for(const r of t)r==null||r()}},l.map(t=>{let{sensor:r}=t;return r}))}function Gy(l,t){return j.useMemo(()=>l.reduce((r,i)=>{let{eventName:o,handler:u}=i;return r[o]=c=>{u(c,t)},r},{}),[l,t])}function jg(l){return j.useMemo(()=>l?vy(l):null,[l])}const Sp=[];function Yy(l,t){t===void 0&&(t=Lo);const[r]=l,i=jg(r?Yn(r):null),[o,u]=j.useState(Sp);function c(){u(()=>l.length?l.map(p=>Lg(p)?i:new Bf(t(p),p)):Sp)}const d=xu({callback:c});return ki(()=>{d==null||d.disconnect(),c(),l.forEach(p=>d==null?void 0:d.observe(p))},[l]),o}function Wg(l){if(!l)return null;if(l.children.length>1)return l;const t=l.children[0];return bo(t)?t:l}function Ky(l){let{measure:t}=l;const[r,i]=j.useState(null),o=j.useCallback(m=>{for(const{target:w}of m)if(bo(w)){i(v=>{const x=t(w);return v?{...v,width:x.width,height:x.height}:x});break}},[t]),u=xu({callback:o}),c=j.useCallback(m=>{const w=Wg(m);u==null||u.disconnect(),w&&(u==null||u.observe(w)),i(w?t(w):null)},[t,u]),[d,p]=ru(c);return j.useMemo(()=>({nodeRef:d,rect:r,setRef:p}),[r,d,p])}const Qy=[{sensor:Vf,options:{}},{sensor:Fg,options:{}}],Xy={current:{}},qa={draggable:{measure:dp},droppable:{measure:dp,strategy:Do.WhileDragging,frequency:Cf.Optimized},dragOverlay:{measure:Lo}};class _o extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,i;return(r=(i=this.get(t))==null?void 0:i.node.current)!=null?r:void 0}}const qy={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new _o,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ou},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:qa,measureDroppableContainers:ou,windowRect:null,measuringScheduled:!1},Bg={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ou,draggableNodes:new Map,over:null,measureDroppableContainers:ou},Po=j.createContext(Bg),Ug=j.createContext(qy);function Jy(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new _o}}}function Zy(l,t){switch(t.type){case en.DragStart:return{...l,draggable:{...l.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case en.DragMove:return l.draggable.active==null?l:{...l,draggable:{...l.draggable,translate:{x:t.coordinates.x-l.draggable.initialCoordinates.x,y:t.coordinates.y-l.draggable.initialCoordinates.y}}};case en.DragEnd:case en.DragCancel:return{...l,draggable:{...l.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case en.RegisterDroppable:{const{element:r}=t,{id:i}=r,o=new _o(l.droppable.containers);return o.set(i,r),{...l,droppable:{...l.droppable,containers:o}}}case en.SetDroppableDisabled:{const{id:r,key:i,disabled:o}=t,u=l.droppable.containers.get(r);if(!u||i!==u.key)return l;const c=new _o(l.droppable.containers);return c.set(r,{...u,disabled:o}),{...l,droppable:{...l.droppable,containers:c}}}case en.UnregisterDroppable:{const{id:r,key:i}=t,o=l.droppable.containers.get(r);if(!o||i!==o.key)return l;const u=new _o(l.droppable.containers);return u.delete(r),{...l,droppable:{...l.droppable,containers:u}}}default:return l}}function e0(l){let{disabled:t}=l;const{active:r,activatorEvent:i,draggableNodes:o}=j.useContext(Po),u=iu(i),c=iu(r==null?void 0:r.id);return j.useEffect(()=>{if(!t&&!i&&u&&c!=null){if(!jf(u)||document.activeElement===u.target)return;const d=o.get(c);if(!d)return;const{activatorNode:p,node:m}=d;if(!p.current&&!m.current)return;requestAnimationFrame(()=>{for(const w of[p.current,m.current]){if(!w)continue;const v=Qv(w);if(v){v.focus();break}}})}},[i,t,o,c,u]),null}function Vg(l,t){let{transform:r,...i}=t;return l!=null&&l.length?l.reduce((o,u)=>u({transform:o,...i}),r):r}function t0(l){return j.useMemo(()=>({draggable:{...qa.draggable,...l==null?void 0:l.draggable},droppable:{...qa.droppable,...l==null?void 0:l.droppable},dragOverlay:{...qa.dragOverlay,...l==null?void 0:l.dragOverlay}}),[l==null?void 0:l.draggable,l==null?void 0:l.droppable,l==null?void 0:l.dragOverlay])}function n0(l){let{activeNode:t,measure:r,initialRect:i,config:o=!0}=l;const u=j.useRef(!1),{x:c,y:d}=typeof o=="boolean"?{x:o,y:o}:o;ki(()=>{if(!c&&!d||!t){u.current=!1;return}if(u.current||!i)return;const m=t==null?void 0:t.node.current;if(!m||m.isConnected===!1)return;const w=r(m),v=Tg(w,i);if(c||(v.x=0),d||(v.y=0),u.current=!0,Math.abs(v.x)>0||Math.abs(v.y)>0){const x=Mg(m);x&&x.scrollBy({top:v.y,left:v.x})}},[t,c,d,i,r])}const _u=j.createContext({...Qr,scaleX:1,scaleY:1});var ns;(function(l){l[l.Uninitialized=0]="Uninitialized",l[l.Initializing=1]="Initializing",l[l.Initialized=2]="Initialized"})(ns||(ns={}));const r0=j.memo(function(t){var r,i,o,u;let{id:c,accessibility:d,autoScroll:p=!0,children:m,sensors:w=Qy,collisionDetection:v=fy,measuring:x,modifiers:z,...R}=t;const k=j.useReducer(Zy,void 0,Jy),[b,W]=k,[P,B]=ty(),[V,ee]=j.useState(ns.Uninitialized),G=V===ns.Initialized,{draggable:{active:Z,nodes:re,translate:ve},droppable:{containers:de}}=b,Y=Z!=null?re.get(Z):null,Ce=j.useRef({initial:null,translated:null}),ae=j.useMemo(()=>{var lt;return Z!=null?{id:Z,data:(lt=Y==null?void 0:Y.data)!=null?lt:Xy,rect:Ce}:null},[Z,Y]),ye=j.useRef(null),[me,De]=j.useState(null),[le,ie]=j.useState(null),oe=Ro(R,Object.values(R)),X=Su("DndDescribedBy",c),D=j.useMemo(()=>de.getEnabled(),[de]),H=t0(x),{droppableRects:K,measureDroppableContainers:xe,measuringScheduled:be}=Hy(D,{dragging:G,dependencies:[ve.x,ve.y],config:H.droppable}),ge=Ay(re,Z),_e=j.useMemo(()=>le?lu(le):null,[le]),He=zt(),Fe=Fy(ge,H.draggable.measure);n0({activeNode:Z!=null?re.get(Z):null,config:He.layoutShiftCompensation,initialRect:Fe,measure:H.draggable.measure});const Oe=vp(ge,H.draggable.measure,Fe),$t=vp(ge?ge.parentElement:null),Pt=j.useRef({activatorEvent:null,active:null,activeNode:ge,collisionRect:null,collisions:null,droppableRects:K,draggableNodes:re,draggingNode:null,draggingNodeRect:null,droppableContainers:de,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),At=de.getNodeFor((r=Pt.current.over)==null?void 0:r.id),It=Ky({measure:H.dragOverlay.measure}),Kn=(i=It.nodeRef.current)!=null?i:ge,Cn=G?(o=It.rect)!=null?o:Oe:null,_r=!!(It.nodeRef.current&&It.rect),Xr=By(_r?null:Oe),Pn=jg(Kn?Yn(Kn):null),Ze=Uy(G?At??ge:null),nn=Yy(Ze),rn=Vg(z,{transform:{x:ve.x-Xr.x,y:ve.y-Xr.y,scaleX:1,scaleY:1},activatorEvent:le,active:ae,activeNodeRect:Oe,containerNodeRect:$t,draggingNodeRect:Cn,over:Pt.current.over,overlayNodeRect:It.rect,scrollableAncestors:Ze,scrollableAncestorRects:nn,windowRect:Pn}),sr=_e?wl(_e,ve):null,Pe=Vy(Ze),ce=wp(Pe),qe=wp(Pe,[Oe]),et=wl(rn,ce),sn=Cn?py(Cn,rn):null,kn=ae&&sn?v({active:ae,collisionRect:sn,droppableRects:K,droppableContainers:D,pointerCoordinates:sr}):null,Gt=uy(kn,"id"),[Rt,ln]=j.useState(null),mn=_r?rn:wl(rn,qe),Yt=dy(mn,(u=Rt==null?void 0:Rt.rect)!=null?u:null,Oe),vn=j.useRef(null),qr=j.useCallback((lt,Kt)=>{let{sensor:on,options:ar}=Kt;if(ye.current==null)return;const yn=re.get(ye.current);if(!yn)return;const an=lt.nativeEvent,Rn=new on({active:ye.current,activeNode:yn,event:an,options:ar,context:Pt,onAbort(We){if(!re.get(We))return;const{onDragAbort:_t}=oe.current,un={id:We};_t==null||_t(un),P({type:"onDragAbort",event:un})},onPending(We,xt,_t,un){if(!re.get(We))return;const{onDragPending:Sn}=oe.current,Ht={id:We,constraint:xt,initialCoordinates:_t,offset:un};Sn==null||Sn(Ht),P({type:"onDragPending",event:Ht})},onStart(We){const xt=ye.current;if(xt==null)return;const _t=re.get(xt);if(!_t)return;const{onDragStart:un}=oe.current,vt={activatorEvent:an,active:{id:xt,data:_t.data,rect:Ce}};bs.unstable_batchedUpdates(()=>{un==null||un(vt),ee(ns.Initializing),W({type:en.DragStart,initialCoordinates:We,active:xt}),P({type:"onDragStart",event:vt}),De(vn.current),ie(an)})},onMove(We){W({type:en.DragMove,coordinates:We})},onEnd:wn(en.DragEnd),onCancel:wn(en.DragCancel)});vn.current=Rn;function wn(We){return async function(){const{active:_t,collisions:un,over:vt,scrollAdjustedTranslate:Sn}=Pt.current;let Ht=null;if(_t&&Sn){const{cancelDrop:Er}=oe.current;Ht={activatorEvent:an,active:_t,collisions:un,delta:Sn,over:vt},We===en.DragEnd&&typeof Er=="function"&&await Promise.resolve(Er(Ht))&&(We=en.DragCancel)}ye.current=null,bs.unstable_batchedUpdates(()=>{W({type:We}),ee(ns.Uninitialized),ln(null),De(null),ie(null),vn.current=null;const Er=We===en.DragEnd?"onDragEnd":"onDragCancel";if(Ht){const Ri=oe.current[Er];Ri==null||Ri(Ht),P({type:Er,event:Ht})}})}}},[re]),Jr=j.useCallback((lt,Kt)=>(on,ar)=>{const yn=on.nativeEvent,an=re.get(ar);if(ye.current!==null||!an||yn.dndKit||yn.defaultPrevented)return;const Rn={active:an};lt(on,Kt.options,Rn)===!0&&(yn.dndKit={capturedBy:Kt.sensor},ye.current=ar,qr(on,Kt))},[re,qr]),lr=Iy(w,Jr);$y(w),ki(()=>{Oe&&V===ns.Initializing&&ee(ns.Initialized)},[Oe,V]),j.useEffect(()=>{const{onDragMove:lt}=oe.current,{active:Kt,activatorEvent:on,collisions:ar,over:yn}=Pt.current;if(!Kt||!on)return;const an={active:Kt,activatorEvent:on,collisions:ar,delta:{x:et.x,y:et.y},over:yn};bs.unstable_batchedUpdates(()=>{lt==null||lt(an),P({type:"onDragMove",event:an})})},[et.x,et.y]),j.useEffect(()=>{const{active:lt,activatorEvent:Kt,collisions:on,droppableContainers:ar,scrollAdjustedTranslate:yn}=Pt.current;if(!lt||ye.current==null||!Kt||!yn)return;const{onDragOver:an}=oe.current,Rn=ar.get(Gt),wn=Rn&&Rn.rect.current?{id:Rn.id,rect:Rn.rect.current,data:Rn.data,disabled:Rn.disabled}:null,We={active:lt,activatorEvent:Kt,collisions:on,delta:{x:yn.x,y:yn.y},over:wn};bs.unstable_batchedUpdates(()=>{ln(wn),an==null||an(We),P({type:"onDragOver",event:We})})},[Gt]),ki(()=>{Pt.current={activatorEvent:le,active:ae,activeNode:ge,collisionRect:sn,collisions:kn,droppableRects:K,draggableNodes:re,draggingNode:Kn,draggingNodeRect:Cn,droppableContainers:de,over:Rt,scrollableAncestors:Ze,scrollAdjustedTranslate:et},Ce.current={initial:Cn,translated:sn}},[ae,ge,kn,sn,re,Kn,Cn,K,de,Rt,Ze,et]),Oy({...He,delta:ve,draggingRect:sn,pointerCoordinates:sr,scrollableAncestors:Ze,scrollableAncestorRects:nn});const or=j.useMemo(()=>({active:ae,activeNode:ge,activeNodeRect:Oe,activatorEvent:le,collisions:kn,containerNodeRect:$t,dragOverlay:It,draggableNodes:re,droppableContainers:de,droppableRects:K,over:Rt,measureDroppableContainers:xe,scrollableAncestors:Ze,scrollableAncestorRects:nn,measuringConfiguration:H,measuringScheduled:be,windowRect:Pn}),[ae,ge,Oe,le,kn,$t,It,re,de,K,Rt,xe,Ze,nn,H,be,Pn]),Zr=j.useMemo(()=>({activatorEvent:le,activators:lr,active:ae,activeNodeRect:Oe,ariaDescribedById:{draggable:X},dispatch:W,draggableNodes:re,over:Rt,measureDroppableContainers:xe}),[le,lr,ae,Oe,W,X,re,Rt,xe]);return ht.createElement(Dg.Provider,{value:B},ht.createElement(Po.Provider,{value:Zr},ht.createElement(Ug.Provider,{value:or},ht.createElement(_u.Provider,{value:Yt},m)),ht.createElement(e0,{disabled:(d==null?void 0:d.restoreFocus)===!1})),ht.createElement(iy,{...d,hiddenTextDescribedById:X}));function zt(){const lt=(me==null?void 0:me.autoScrollEnabled)===!1,Kt=typeof p=="object"?p.enabled===!1:p===!1,on=G&&!lt&&!Kt;return typeof p=="object"?{...p,enabled:on}:{enabled:on}}}),i0=j.createContext(null),xp="button",s0="Draggable";function l0(l){let{id:t,data:r,disabled:i=!1,attributes:o}=l;const u=Su(s0),{activators:c,activatorEvent:d,active:p,activeNodeRect:m,ariaDescribedById:w,draggableNodes:v,over:x}=j.useContext(Po),{role:z=xp,roleDescription:R="draggable",tabIndex:k=0}=o??{},b=(p==null?void 0:p.id)===t,W=j.useContext(b?_u:i0),[P,B]=ru(),[V,ee]=ru(),G=Gy(c,t),Z=Ro(r);ki(()=>(v.set(t,{id:t,key:u,node:P,activatorNode:V,data:Z}),()=>{const ve=v.get(t);ve&&ve.key===u&&v.delete(t)}),[v,t]);const re=j.useMemo(()=>({role:z,tabIndex:k,"aria-disabled":i,"aria-pressed":b&&z===xp?!0:void 0,"aria-roledescription":R,"aria-describedby":w.draggable}),[i,z,k,b,R,w.draggable]);return{active:p,activatorEvent:d,activeNodeRect:m,attributes:re,isDragging:b,listeners:i?void 0:G,node:P,over:x,setNodeRef:B,setActivatorNodeRef:ee,transform:W}}function o0(){return j.useContext(Ug)}const a0="Droppable",u0={timeout:25};function c0(l){let{data:t,disabled:r=!1,id:i,resizeObserverConfig:o}=l;const u=Su(a0),{active:c,dispatch:d,over:p,measureDroppableContainers:m}=j.useContext(Po),w=j.useRef({disabled:r}),v=j.useRef(!1),x=j.useRef(null),z=j.useRef(null),{disabled:R,updateMeasurementsFor:k,timeout:b}={...u0,...o},W=Ro(k??i),P=j.useCallback(()=>{if(!v.current){v.current=!0;return}z.current!=null&&clearTimeout(z.current),z.current=setTimeout(()=>{m(Array.isArray(W.current)?W.current:[W.current]),z.current=null},b)},[b]),B=xu({callback:P,disabled:R||!c}),V=j.useCallback((re,ve)=>{B&&(ve&&(B.unobserve(ve),v.current=!1),re&&B.observe(re))},[B]),[ee,G]=ru(V),Z=Ro(t);return j.useEffect(()=>{!B||!ee.current||(B.disconnect(),v.current=!1,B.observe(ee.current))},[ee,B]),j.useEffect(()=>(d({type:en.RegisterDroppable,element:{id:i,key:u,disabled:r,node:ee,rect:x,data:Z}}),()=>d({type:en.UnregisterDroppable,key:u,id:i})),[i]),j.useEffect(()=>{r!==w.current.disabled&&(d({type:en.SetDroppableDisabled,id:i,key:u,disabled:r}),w.current.disabled=r)},[i,u,r,d]),{active:c,rect:x,isOver:(p==null?void 0:p.id)===i,node:ee,over:p,setNodeRef:G}}function f0(l){let{animation:t,children:r}=l;const[i,o]=j.useState(null),[u,c]=j.useState(null),d=iu(r);return!r&&!i&&d&&o(d),ki(()=>{if(!u)return;const p=i==null?void 0:i.key,m=i==null?void 0:i.props.id;if(p==null||m==null){o(null);return}Promise.resolve(t(m,u)).then(()=>{o(null)})},[t,i,u]),ht.createElement(ht.Fragment,null,r,i?j.cloneElement(i,{ref:c}):null)}const d0={x:0,y:0,scaleX:1,scaleY:1};function h0(l){let{children:t}=l;return ht.createElement(Po.Provider,{value:Bg},ht.createElement(_u.Provider,{value:d0},t))}const p0={position:"fixed",touchAction:"none"},g0=l=>jf(l)?"transform 250ms ease":void 0,m0=j.forwardRef((l,t)=>{let{as:r,activatorEvent:i,adjustScale:o,children:u,className:c,rect:d,style:p,transform:m,transition:w=g0}=l;if(!d)return null;const v=o?m:{...m,scaleX:1,scaleY:1},x={...p0,width:d.width,height:d.height,top:d.top,left:d.left,transform:No.Transform.toString(v),transformOrigin:o&&i?oy(i,d):void 0,transition:typeof w=="function"?w(i):w,...p};return ht.createElement(r,{className:c,style:x,ref:t},u)}),v0=l=>t=>{let{active:r,dragOverlay:i}=t;const o={},{styles:u,className:c}=l;if(u!=null&&u.active)for(const[d,p]of Object.entries(u.active))p!==void 0&&(o[d]=r.node.style.getPropertyValue(d),r.node.style.setProperty(d,p));if(u!=null&&u.dragOverlay)for(const[d,p]of Object.entries(u.dragOverlay))p!==void 0&&i.node.style.setProperty(d,p);return c!=null&&c.active&&r.node.classList.add(c.active),c!=null&&c.dragOverlay&&i.node.classList.add(c.dragOverlay),function(){for(const[p,m]of Object.entries(o))r.node.style.setProperty(p,m);c!=null&&c.active&&r.node.classList.remove(c.active)}},y0=l=>{let{transform:{initial:t,final:r}}=l;return[{transform:No.Transform.toString(t)},{transform:No.Transform.toString(r)}]},w0={duration:250,easing:"ease",keyframes:y0,sideEffects:v0({styles:{active:{opacity:"0"}}})};function S0(l){let{config:t,draggableNodes:r,droppableContainers:i,measuringConfiguration:o}=l;return wu((u,c)=>{if(t===null)return;const d=r.get(u);if(!d)return;const p=d.node.current;if(!p)return;const m=Wg(c);if(!m)return;const{transform:w}=Yn(c).getComputedStyle(c),v=zg(w);if(!v)return;const x=typeof t=="function"?t:x0(t);return Ig(p,o.draggable.measure),x({active:{id:u,data:d.data,node:p,rect:o.draggable.measure(p)},draggableNodes:r,dragOverlay:{node:c,rect:o.dragOverlay.measure(m)},droppableContainers:i,measuringConfiguration:o,transform:v})})}function x0(l){const{duration:t,easing:r,sideEffects:i,keyframes:o}={...w0,...l};return u=>{let{active:c,dragOverlay:d,transform:p,...m}=u;if(!t)return;const w={x:d.rect.left-c.rect.left,y:d.rect.top-c.rect.top},v={scaleX:p.scaleX!==1?c.rect.width*p.scaleX/d.rect.width:1,scaleY:p.scaleY!==1?c.rect.height*p.scaleY/d.rect.height:1},x={x:p.x-w.x,y:p.y-w.y,...v},z=o({...m,active:c,dragOverlay:d,transform:{initial:p,final:x}}),[R]=z,k=z[z.length-1];if(JSON.stringify(R)===JSON.stringify(k))return;const b=i==null?void 0:i({active:c,dragOverlay:d,...m}),W=d.node.animate(z,{duration:t,easing:r,fill:"forwards"});return new Promise(P=>{W.onfinish=()=>{b==null||b(),P()}})}}let _p=0;function _0(l){return j.useMemo(()=>{if(l!=null)return _p++,_p},[l])}const E0=ht.memo(l=>{let{adjustScale:t=!1,children:r,dropAnimation:i,style:o,transition:u,modifiers:c,wrapperElement:d="div",className:p,zIndex:m=999}=l;const{activatorEvent:w,active:v,activeNodeRect:x,containerNodeRect:z,draggableNodes:R,droppableContainers:k,dragOverlay:b,over:W,measuringConfiguration:P,scrollableAncestors:B,scrollableAncestorRects:V,windowRect:ee}=o0(),G=j.useContext(_u),Z=_0(v==null?void 0:v.id),re=Vg(c,{activatorEvent:w,active:v,activeNodeRect:x,containerNodeRect:z,draggingNodeRect:b.rect,over:W,overlayNodeRect:b.rect,scrollableAncestors:B,scrollableAncestorRects:V,transform:G,windowRect:ee}),ve=$f(x),de=S0({config:i,draggableNodes:R,droppableContainers:k,measuringConfiguration:P}),Y=ve?b.setRef:void 0;return ht.createElement(h0,null,ht.createElement(f0,{animation:de},v&&Z?ht.createElement(m0,{key:Z,id:v.id,ref:Y,as:d,activatorEvent:w,adjustScale:t,className:p,transition:u,rect:ve,style:{zIndex:m,...o},transform:re},r):null))}),Ep=l=>{let t;const r=new Set,i=(m,w)=>{const v=typeof m=="function"?m(t):m;if(!Object.is(v,t)){const x=t;t=w??(typeof v!="object"||v===null)?v:Object.assign({},t,v),r.forEach(z=>z(t,x))}},o=()=>t,d={setState:i,getState:o,getInitialState:()=>p,subscribe:m=>(r.add(m),()=>r.delete(m))},p=t=l(i,o,d);return d},C0=(l=>l?Ep(l):Ep),k0=l=>l;function R0(l,t=k0){const r=ht.useSyncExternalStore(l.subscribe,ht.useCallback(()=>t(l.getState()),[l,t]),ht.useCallback(()=>t(l.getInitialState()),[l,t]));return ht.useDebugValue(r),r}const Cp=l=>{const t=C0(l),r=i=>R0(t,i);return Object.assign(r,t),r},$g=(l=>l?Cp(l):Cp),Gg="damiao.monitor.plotConfigs";function N0(){try{return JSON.parse(localStorage.getItem(Gg)||"{}")}catch{return{}}}function D0(l){try{localStorage.setItem(Gg,JSON.stringify(l))}catch{}}const gn=$g((l,t)=>({connected:!1,status:null,signals:[],pairs:[],motors:[],motorTypes:[],plotConfigs:N0(),setConnected:r=>l({connected:r}),setStatus:r=>l({status:r}),setMeta:(r,i)=>l({signals:r,pairs:i}),setMotors:r=>l({motors:r}),setMotorTypes:r=>l({motorTypes:r}),ensurePlot:r=>l(i=>i.plotConfigs[r]?i:{plotConfigs:{...i.plotConfigs,[r]:{signals:[],duration:10}}}),setPlotConfig:(r,i)=>l(o=>({plotConfigs:{...o.plotConfigs,[r]:{...o.plotConfigs[r]||{signals:[],duration:10},...i}}})),addSignalToPlot:(r,i)=>l(o=>{const u=o.plotConfigs[r]||{signals:[],duration:10};return u.signals.includes(i)?o:{plotConfigs:{...o.plotConfigs,[r]:{...u,signals:[...u.signals,i]}}}}),removeSignalFromPlot:(r,i)=>l(o=>{const u=o.plotConfigs[r];return u?{plotConfigs:{...o.plotConfigs,[r]:{...u,signals:u.signals.filter(c=>c!==i)}}}:o}),dropPlot:r=>l(i=>{const o={...i.plotConfigs};return delete o[r],{plotConfigs:o}})}));gn.subscribe(l=>D0(l.plotConfigs));const Gf="damiao.monitor.widgets.v2";function T0(){try{const l=localStorage.getItem(Gf);if(!l)return null;const t=JSON.parse(l);return Array.isArray(t)&&t.length?t:null}catch{return null}}function af(l){try{localStorage.setItem(Gf,JSON.stringify(l))}catch{}}const kp=[{id:"plot-1",kind:"plot",x:0,y:0,w:7,h:6},{id:"cards-1",kind:"cards",x:7,y:0,w:5,h:6},{id:"table-1",kind:"table",x:0,y:6,w:7,h:5},{id:"rawlog-1",kind:"rawlog",x:7,y:6,w:5,h:5}];let Rp=1;const Eo=$g((l,t)=>({widgets:T0()||kp,addWidget:r=>{Rp+=1;const i=`${r}-${Date.now().toString(36)}-${Rp}`,o=t().widgets.reduce((d,p)=>Math.max(d,p.y+p.h),0),u={id:i,kind:r,x:0,y:o,w:6,h:5},c=[...t().widgets,u];return af(c),l({widgets:c}),i},removeWidget:r=>{const i=t().widgets.filter(o=>o.id!==r);af(i),l({widgets:i})},updateGeom:r=>{const i=new Map(r.map(u=>[u.id,u])),o=t().widgets.map(u=>{const c=i.get(u.id);return c?{...u,x:c.x,y:c.y,w:c.w,h:c.h}:u});af(o),l({widgets:o})},resetWidgets:()=>{try{localStorage.removeItem(Gf),localStorage.removeItem("damiao.monitor.plotConfigs")}catch{}l({widgets:kp.map(r=>({...r}))})}})),z0=!0,tn="u-",M0="uplot",b0=tn+"hz",O0=tn+"vt",L0=tn+"title",P0=tn+"wrap",A0=tn+"under",I0=tn+"over",H0=tn+"axis",Ms=tn+"off",F0=tn+"select",j0=tn+"cursor-x",W0=tn+"cursor-y",B0=tn+"cursor-pt",U0=tn+"legend",V0=tn+"live",$0=tn+"inline",G0=tn+"series",Y0=tn+"marker",Np=tn+"label",K0=tn+"value",vo="width",yo="height",po="top",Dp="bottom",gl="left",uf="right",Yf="#000",Tp=Yf+"0",cf="mousemove",zp="mousedown",ff="mouseup",Mp="mouseenter",bp="mouseleave",Op="dblclick",Q0="resize",X0="scroll",Lp="change",uu="dppxchange",Kf="--",Tl=typeof window<"u",kf=Tl?document:null,Sl=Tl?window:null,q0=Tl?navigator:null;let Je,Ka;function Rf(){let l=devicePixelRatio;Je!=l&&(Je=l,Ka&&Df(Lp,Ka,Rf),Ka=matchMedia(`(min-resolution: ${Je-.001}dppx) and (max-resolution: ${Je+.001}dppx)`),Os(Lp,Ka,Rf),Sl.dispatchEvent(new CustomEvent(uu)))}function wr(l,t){if(t!=null){let r=l.classList;!r.contains(t)&&r.add(t)}}function Nf(l,t){let r=l.classList;r.contains(t)&&r.remove(t)}function mt(l,t,r){l.style[t]=r+"px"}function $r(l,t,r,i){let o=kf.createElement(l);return t!=null&&wr(o,t),r!=null&&r.insertBefore(o,i),o}function Lr(l,t){return $r("div",l,t)}const Pp=new WeakMap;function oi(l,t,r,i,o){let u="translate("+t+"px,"+r+"px)",c=Pp.get(l);u!=c&&(l.style.transform=u,Pp.set(l,u),t<0||r<0||t>i||r>o?wr(l,Ms):Nf(l,Ms))}const Ap=new WeakMap;function Ip(l,t,r){let i=t+r,o=Ap.get(l);i!=o&&(Ap.set(l,i),l.style.background=t,l.style.borderColor=r)}const Hp=new WeakMap;function Fp(l,t,r,i){let o=t+""+r,u=Hp.get(l);o!=u&&(Hp.set(l,o),l.style.height=r+"px",l.style.width=t+"px",l.style.marginLeft=i?-t/2+"px":0,l.style.marginTop=i?-r/2+"px":0)}const Qf={passive:!0},J0={...Qf,capture:!0};function Os(l,t,r,i){t.addEventListener(l,r,i?J0:Qf)}function Df(l,t,r,i){t.removeEventListener(l,r,Qf)}Tl&&Rf();function Gr(l,t,r,i){let o;r=r||0,i=i||t.length-1;let u=i<=2147483647;for(;i-r>1;)o=u?r+i>>1:Sr((r+i)/2),t[o]{let u=-1,c=-1;for(let d=i;d<=o;d++)if(l(r[d])){u=d;break}for(let d=o;d>=i;d--)if(l(r[d])){c=d;break}return[u,c]}}const Kg=l=>l!=null,Qg=l=>l!=null&&l>0,Eu=Yg(Kg),Z0=Yg(Qg);function ew(l,t,r,i=0,o=!1){let u=o?Z0:Eu,c=o?Qg:Kg;[t,r]=u(l,t,r);let d=l[t],p=l[t];if(t>-1)if(i==1)d=l[t],p=l[r];else if(i==-1)d=l[r],p=l[t];else for(let m=t;m<=r;m++){let w=l[m];c(w)&&(wp&&(p=w))}return[d??ct,p??-ct]}function Cu(l,t,r,i){let o=Bp(l),u=Bp(t);l==t&&(o==-1?(l*=r,t/=r):(l/=r,t*=r));let c=r==10?Ei:Xg,d=o==1?Sr:Ar,p=u==1?Ar:Sr,m=d(c(Zt(l))),w=p(c(Zt(t))),v=_l(r,m),x=_l(r,w);return r==10&&(m<0&&(v=ft(v,-m)),w<0&&(x=ft(x,-w))),i||r==2?(l=v*o,t=x*u):(l=em(l,v),t=ku(t,x)),[l,t]}function Xf(l,t,r,i){let o=Cu(l,t,r,i);return l==0&&(o[0]=0),t==0&&(o[1]=0),o}const qf=.1,jp={mode:3,pad:qf},Co={pad:0,soft:null,mode:0},tw={min:Co,max:Co};function cu(l,t,r,i){return Ru(r)?Wp(l,t,r):(Co.pad=r,Co.soft=i?0:null,Co.mode=i?3:0,Wp(l,t,tw))}function Xe(l,t){return l??t}function nw(l,t,r){for(t=Xe(t,0),r=Xe(r,l.length-1);t<=r;){if(l[t]!=null)return!0;t++}return!1}function Wp(l,t,r){let i=r.min,o=r.max,u=Xe(i.pad,0),c=Xe(o.pad,0),d=Xe(i.hard,-ct),p=Xe(o.hard,ct),m=Xe(i.soft,ct),w=Xe(o.soft,-ct),v=Xe(i.mode,0),x=Xe(o.mode,0),z=t-l,R=Ei(z),k=Gn(Zt(l),Zt(t)),b=Ei(k),W=Zt(b-R);(z<1e-24||W>10)&&(z=0,(l==0||t==0)&&(z=1e-24,v==2&&m!=ct&&(u=0),x==2&&w!=-ct&&(c=0)));let P=z||k||1e3,B=Ei(P),V=_l(10,Sr(B)),ee=P*(z==0?l==0?.1:1:u),G=ft(em(l-ee,V/10),24),Z=l>=m&&(v==1||v==3&&G<=m||v==2&&G>=m)?m:ct,re=Gn(d,G=Z?Z:Yr(Z,G)),ve=P*(z==0?t==0?.1:1:c),de=ft(ku(t+ve,V/10),24),Y=t<=w&&(x==1||x==3&&de>=w||x==2&&de<=w)?w:-ct,Ce=Yr(p,de>Y&&t<=Y?Y:Gn(Y,de));return re==Ce&&re==0&&(Ce=100),[re,Ce]}const rw=new Intl.NumberFormat(Tl?q0.language:"en-US"),Jf=l=>rw.format(l),xr=Math,Ja=xr.PI,Zt=xr.abs,Sr=xr.floor,Jt=xr.round,Ar=xr.ceil,Yr=xr.min,Gn=xr.max,_l=xr.pow,Bp=xr.sign,Ei=xr.log10,Xg=xr.log2,iw=(l,t=1)=>xr.sinh(l)*t,df=(l,t=1)=>xr.asinh(l/t),ct=1/0;function Up(l){return(Ei((l^l>>31)-(l>>31))|0)+1}function Tf(l,t,r){return Yr(Gn(l,t),r)}function qg(l){return typeof l=="function"}function Ve(l){return qg(l)?l:()=>l}const sw=()=>{},Jg=l=>l,Zg=(l,t)=>t,lw=l=>null,Vp=l=>!0,$p=(l,t)=>l==t,ow=/\.\d*?(?=9{6,}|0{6,})/gm,Ps=l=>{if(nm(l)||is.has(l))return l;const t=`${l}`,r=t.match(ow);if(r==null)return l;let i=r[0].length-1;if(t.indexOf("e-")!=-1){let[o,u]=t.split("e");return+`${Ps(o)}e${u}`}return ft(l,i)};function Ts(l,t){return Ps(ft(Ps(l/t))*t)}function ku(l,t){return Ps(Ar(Ps(l/t))*t)}function em(l,t){return Ps(Sr(Ps(l/t))*t)}function ft(l,t=0){if(nm(l))return l;let r=10**t,i=l*r*(1+Number.EPSILON);return Jt(i)/r}const is=new Map;function tm(l){return((""+l).split(".")[1]||"").length}function To(l,t,r,i){let o=[],u=i.map(tm);for(let c=t;c=0?0:d)+(c>=u[m]?0:u[m]),x=l==10?w:ft(w,v);o.push(x),is.set(x,v)}}return o}const ko={},Zf=[],El=[null,null],rs=Array.isArray,nm=Number.isInteger,aw=l=>l===void 0;function Gp(l){return typeof l=="string"}function Ru(l){let t=!1;if(l!=null){let r=l.constructor;t=r==null||r==Object}return t}function uw(l){return l!=null&&typeof l=="object"}const cw=Object.getPrototypeOf(Uint8Array),rm="__proto__";function Cl(l,t=Ru){let r;if(rs(l)){let i=l.find(o=>o!=null);if(rs(i)||t(i)){r=Array(l.length);for(let o=0;ou){for(o=c-1;o>=0&&l[o]==null;)l[o--]=null;for(o=c+1;oc-d)],o=i[0].length,u=new Map;for(let c=0;c"u"?l=>Promise.resolve().then(l):queueMicrotask;function vw(l){let t=l[0],r=t.length,i=Array(r);for(let u=0;ut[u]-t[c]);let o=[];for(let u=0;u=i&&l[o]==null;)o--;if(o<=i)return!0;const u=Gn(1,Sr((o-i+1)/t));for(let c=l[i],d=i+u;d<=o;d+=u){const p=l[d];if(p!=null){if(p<=c)return!1;c=p}}return!0}const im=["January","February","March","April","May","June","July","August","September","October","November","December"],sm=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function lm(l){return l.slice(0,3)}const Sw=sm.map(lm),xw=im.map(lm),_w={MMMM:im,MMM:xw,WWWW:sm,WWW:Sw};function go(l){return(l<10?"0":"")+l}function Ew(l){return(l<10?"00":l<100?"0":"")+l}const Cw={YYYY:l=>l.getFullYear(),YY:l=>(l.getFullYear()+"").slice(2),MMMM:(l,t)=>t.MMMM[l.getMonth()],MMM:(l,t)=>t.MMM[l.getMonth()],MM:l=>go(l.getMonth()+1),M:l=>l.getMonth()+1,DD:l=>go(l.getDate()),D:l=>l.getDate(),WWWW:(l,t)=>t.WWWW[l.getDay()],WWW:(l,t)=>t.WWW[l.getDay()],HH:l=>go(l.getHours()),H:l=>l.getHours(),h:l=>{let t=l.getHours();return t==0?12:t>12?t-12:t},AA:l=>l.getHours()>=12?"PM":"AM",aa:l=>l.getHours()>=12?"pm":"am",a:l=>l.getHours()>=12?"p":"a",mm:l=>go(l.getMinutes()),m:l=>l.getMinutes(),ss:l=>go(l.getSeconds()),s:l=>l.getSeconds(),fff:l=>Ew(l.getMilliseconds())};function ed(l,t){t=t||_w;let r=[],i=/\{([a-z]+)\}|[^{]+/gi,o;for(;o=i.exec(l);)r.push(o[0][0]=="{"?Cw[o[1]]:o[0]);return u=>{let c="";for(let d=0;dl%1==0,fu=[1,2,2.5,5],Nw=To(10,-32,0,fu),am=To(10,0,32,fu),Dw=am.filter(om),zs=Nw.concat(am),td=` +`,um="{YYYY}",Yp=td+um,cm="{M}/{D}",wo=td+cm,Qa=wo+"/{YY}",fm="{aa}",Tw="{h}:{mm}",vl=Tw+fm,Kp=td+vl,Qp=":{ss}",nt=null;function dm(l){let t=l*1e3,r=t*60,i=r*60,o=i*24,u=o*30,c=o*365,p=(l==1?To(10,0,3,fu).filter(om):To(10,-3,0,fu)).concat([t,t*5,t*10,t*15,t*30,r,r*5,r*10,r*15,r*30,i,i*2,i*3,i*4,i*6,i*8,i*12,o,o*2,o*3,o*4,o*5,o*6,o*7,o*8,o*9,o*10,o*15,u,u*2,u*3,u*4,u*6,c,c*2,c*5,c*10,c*25,c*50,c*100]);const m=[[c,um,nt,nt,nt,nt,nt,nt,1],[o*28,"{MMM}",Yp,nt,nt,nt,nt,nt,1],[o,cm,Yp,nt,nt,nt,nt,nt,1],[i,"{h}"+fm,Qa,nt,wo,nt,nt,nt,1],[r,vl,Qa,nt,wo,nt,nt,nt,1],[t,Qp,Qa+" "+vl,nt,wo+" "+vl,nt,Kp,nt,1],[l,Qp+".{fff}",Qa+" "+vl,nt,wo+" "+vl,nt,Kp,nt,1]];function w(v){return(x,z,R,k,b,W)=>{let P=[],B=b>=c,V=b>=u&&b=o?o:b,de=Sr(R)-Sr(G),Y=re+de+ku(G-re,ve);P.push(Y);let Ce=v(Y),ae=Ce.getHours()+Ce.getMinutes()/r+Ce.getSeconds()/i,ye=b/i,me=x.axes[z]._space,De=W/me;for(;Y=ft(Y+b,l==1?0:3),!(Y>k);)if(ye>1){let le=Sr(ft(ae+ye,6))%24,X=v(Y).getHours()-le;X>1&&(X=-1),Y-=X*i,ae=(ae+ye)%24;let D=P[P.length-1];ft((Y-D)/b,3)*De>=.7&&P.push(Y)}else P.push(Y)}return P}}return[p,m,w]}const[zw,Mw,bw]=dm(1),[Ow,Lw,Pw]=dm(.001);To(2,-53,53,[1]);function Xp(l,t){return l.map(r=>r.map((i,o)=>o==0||o==8||i==null?i:t(o==1||r[8]==0?i:r[1]+i)))}function qp(l,t){return(r,i,o,u,c)=>{let d=t.find(R=>c>=R[0])||t[t.length-1],p,m,w,v,x,z;return i.map(R=>{let k=l(R),b=k.getFullYear(),W=k.getMonth(),P=k.getDate(),B=k.getHours(),V=k.getMinutes(),ee=k.getSeconds(),G=b!=p&&d[2]||W!=m&&d[3]||P!=w&&d[4]||B!=v&&d[5]||V!=x&&d[6]||ee!=z&&d[7]||d[1];return p=b,m=W,w=P,v=B,x=V,z=ee,G(k)})}}function Aw(l,t){let r=ed(t);return(i,o,u,c,d)=>o.map(p=>r(l(p)))}function hf(l,t,r){return new Date(l,t,r)}function Jp(l,t){return t(l)}const Iw="{YYYY}-{MM}-{DD} {h}:{mm}{aa}";function Zp(l,t){return(r,i,o,u)=>u==null?Kf:t(l(i))}function Hw(l,t){let r=l.series[t];return r.width?r.stroke(l,t):r.points.width?r.points.stroke(l,t):null}function Fw(l,t){return l.series[t].fill(l,t)}const jw={show:!0,live:!0,isolate:!1,mount:sw,markers:{show:!0,width:2,stroke:Hw,fill:Fw,dash:"solid"},idx:null,idxs:null,values:[]};function Ww(l,t){let r=l.cursor.points,i=Lr(),o=r.size(l,t);mt(i,vo,o),mt(i,yo,o);let u=o/-2;mt(i,"marginLeft",u),mt(i,"marginTop",u);let c=r.width(l,t,o);return c&&mt(i,"borderWidth",c),i}function Bw(l,t){let r=l.series[t].points;return r._fill||r._stroke}function Uw(l,t){let r=l.series[t].points;return r._stroke||r._fill}function Vw(l,t){return l.series[t].points.size}const pf=[0,0];function $w(l,t,r){return pf[0]=t,pf[1]=r,pf}function Xa(l,t,r,i=!0){return o=>{o.button==0&&(!i||o.target==t)&&r(o)}}function gf(l,t,r,i=!0){return o=>{(!i||o.target==t)&&r(o)}}const Gw={show:!0,x:!0,y:!0,lock:!1,move:$w,points:{one:!1,show:Ww,size:Vw,width:0,stroke:Uw,fill:Bw},bind:{mousedown:Xa,mouseup:Xa,click:Xa,dblclick:Xa,mousemove:gf,mouseleave:gf,mouseenter:gf},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,click:(l,t)=>{t.stopPropagation(),t.stopImmediatePropagation()},_x:!1,_y:!1},focus:{dist:(l,t,r,i,o)=>i-o,prox:-1,bias:0},hover:{skip:[void 0],prox:null,bias:0},left:-10,top:-10,idx:null,dataIdx:null,idxs:null,event:null},hm={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},nd=Vt({},hm,{filter:Zg}),pm=Vt({},nd,{size:10}),gm=Vt({},hm,{show:!1}),rd='12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',mm="bold "+rd,vm=1.5,eg={show:!0,scale:"x",stroke:Yf,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:mm,side:2,grid:nd,ticks:pm,border:gm,font:rd,lineGap:vm,rotate:0},Yw="Value",Kw="Time",tg={show:!0,scale:"x",auto:!1,sorted:1,min:ct,max:-ct,idxs:[]};function Qw(l,t,r,i,o){return t.map(u=>u==null?"":Jf(u))}function Xw(l,t,r,i,o,u,c){let d=[],p=is.get(o)||0;r=c?r:ft(ku(r,o),p);for(let m=r;m<=i;m=ft(m+o,p))d.push(Object.is(m,-0)?0:m);return d}function zf(l,t,r,i,o,u,c){const d=[],p=l.scales[l.axes[t].scale].log,m=p==10?Ei:Xg,w=Sr(m(r));o=_l(p,w),p==10&&(o=zs[Gr(o,zs)]);let v=r,x=o*p;p==10&&(x=zs[Gr(x,zs)]);do d.push(v),v=v+o,p==10&&!is.has(v)&&(v=ft(v,is.get(o))),v>=x&&(o=v,x=o*p,p==10&&(x=zs[Gr(x,zs)]));while(v<=i);return d}function qw(l,t,r,i,o,u,c){let p=l.scales[l.axes[t].scale].asinh,m=i>p?zf(l,t,Gn(p,r),i,o):[p],w=i>=0&&r<=0?[0]:[];return(r<-p?zf(l,t,Gn(p,-i),-r,o):[p]).reverse().map(x=>-x).concat(w,m)}const ym=/./,Jw=/[12357]/,Zw=/[125]/,ng=/1/,Mf=(l,t,r,i)=>l.map((o,u)=>t==4&&o==0||u%i==0&&r.test(o.toExponential()[o<0?1:0])?o:null);function e1(l,t,r,i,o){let u=l.axes[r],c=u.scale,d=l.scales[c],p=l.valToPos,m=u._space,w=p(10,c),v=p(9,c)-w>=m?ym:p(7,c)-w>=m?Jw:p(5,c)-w>=m?Zw:ng;if(v==ng){let x=Zt(p(1,c)-w);if(xo,sg={show:!0,auto:!0,sorted:0,gaps:wm,alpha:1,facets:[Vt({},ig,{scale:"x"}),Vt({},ig,{scale:"y"})]},lg={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:wm,alpha:1,points:{show:i1,filter:null},values:null,min:ct,max:-ct,idxs:[],path:null,clip:null};function s1(l,t,r,i,o){return r/10}const Sm={time:z0,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},l1=Vt({},Sm,{time:!1,ori:1}),og={};function xm(l,t){let r=og[l];return r||(r={key:l,plots:[],sub(i){r.plots.push(i)},unsub(i){r.plots=r.plots.filter(o=>o!=i)},pub(i,o,u,c,d,p,m){for(let w=0;w{let W=c.pxRound;const P=m.dir*(m.ori==0?1:-1),B=m.ori==0?zl:Ml;let V,ee;P==1?(V=r,ee=i):(V=i,ee=r);let G=W(v(d[V],m,k,z)),Z=W(x(p[V],w,b,R)),re=W(v(d[ee],m,k,z)),ve=W(x(u==1?w.max:w.min,w,b,R)),de=new Path2D(o);return B(de,re,ve),B(de,G,ve),B(de,G,Z),de})}function Nu(l,t,r,i,o,u){let c=null;if(l.length>0){c=new Path2D;const d=t==0?zu:ld;let p=r;for(let v=0;vx[0]){let z=x[0]-p;z>0&&d(c,p,i,z,i+u),p=x[1]}}let m=r+o-p,w=10;m>0&&d(c,p,i-w/2,m,i+u+w)}return c}function a1(l,t,r){let i=l[l.length-1];i&&i[0]==t?i[1]=r:l.push([t,r])}function sd(l,t,r,i,o,u,c){let d=[],p=l.length;for(let m=o==1?r:i;m>=r&&m<=i;m+=o)if(t[m]===null){let v=m,x=m;if(o==1)for(;++m<=i&&t[m]===null;)x=m;else for(;--m>=r&&t[m]===null;)x=m;let z=u(l[v]),R=x==v?z:u(l[x]),k=v-o;z=c<=0&&k>=0&&k=0&&W>=0&&W=z&&d.push([z,R])}return d}function ag(l){return l==0?Jg:l==1?Jt:t=>Ts(t,l)}function _m(l){let t=l==0?Du:Tu,r=l==0?(o,u,c,d,p,m)=>{o.arcTo(u,c,d,p,m)}:(o,u,c,d,p,m)=>{o.arcTo(c,u,p,d,m)},i=l==0?(o,u,c,d,p)=>{o.rect(u,c,d,p)}:(o,u,c,d,p)=>{o.rect(c,u,p,d)};return(o,u,c,d,p,m=0,w=0)=>{m==0&&w==0?i(o,u,c,d,p):(m=Yr(m,d/2,p/2),w=Yr(w,d/2,p/2),t(o,u+m,c),r(o,u+d,c,u+d,c+p,m),r(o,u+d,c+p,u,c+p,w),r(o,u,c+p,u,c,w),r(o,u,c,u+d,c,m),o.closePath())}}const Du=(l,t,r)=>{l.moveTo(t,r)},Tu=(l,t,r)=>{l.moveTo(r,t)},zl=(l,t,r)=>{l.lineTo(t,r)},Ml=(l,t,r)=>{l.lineTo(r,t)},zu=_m(0),ld=_m(1),Em=(l,t,r,i,o,u)=>{l.arc(t,r,i,o,u)},Cm=(l,t,r,i,o,u)=>{l.arc(r,t,i,o,u)},km=(l,t,r,i,o,u,c)=>{l.bezierCurveTo(t,r,i,o,u,c)},Rm=(l,t,r,i,o,u,c)=>{l.bezierCurveTo(r,t,o,i,c,u)};function Nm(l){return(t,r,i,o,u)=>As(t,r,(c,d,p,m,w,v,x,z,R,k,b)=>{let{pxRound:W,points:P}=c,B,V;m.ori==0?(B=Du,V=Em):(B=Tu,V=Cm);const ee=ft(P.width*Je,3);let G=(P.size-P.width)/2*Je,Z=ft(G*2,3),re=new Path2D,ve=new Path2D,{left:de,top:Y,width:Ce,height:ae}=t.bbox;zu(ve,de-Z,Y-Z,Ce+Z*2,ae+Z*2);const ye=me=>{if(p[me]!=null){let De=W(v(d[me],m,k,z)),le=W(x(p[me],w,b,R));B(re,De+G,le),V(re,De,le,G,0,Ja*2)}};if(u)u.forEach(ye);else for(let me=i;me<=o;me++)ye(me);return{stroke:ee>0?re:null,fill:re,clip:ve,flags:kl|bf}})}function Dm(l){return(t,r,i,o,u,c)=>{i!=o&&(u!=i&&c!=i&&l(t,r,i),u!=o&&c!=o&&l(t,r,o),l(t,r,c))}}const u1=Dm(zl),c1=Dm(Ml);function Tm(l){const t=Xe(l==null?void 0:l.alignGaps,0);return(r,i,o,u)=>As(r,i,(c,d,p,m,w,v,x,z,R,k,b)=>{[o,u]=Eu(p,o,u);let W=c.pxRound,P=ae=>W(v(ae,m,k,z)),B=ae=>W(x(ae,w,b,R)),V,ee;m.ori==0?(V=zl,ee=u1):(V=Ml,ee=c1);const G=m.dir*(m.ori==0?1:-1),Z={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:kl},re=Z.stroke;let ve=!1;if(u-o>=k*4){let ae=K=>r.posToVal(K,m.key,!0),ye=null,me=null,De,le,ie,oe=P(d[G==1?o:u]),X=P(d[o]),D=P(d[u]),H=ae(G==1?X+1:D-1);for(let K=G==1?o:u;K>=o&&K<=u;K+=G){let xe=d[K],ge=(G==1?xeH)?oe:P(xe),_e=p[K];ge==oe?_e!=null?(le=_e,ye==null?(V(re,ge,B(le)),De=ye=me=le):leme&&(me=le)):_e===null&&(ve=!0):(ye!=null&&ee(re,oe,B(ye),B(me),B(De),B(le)),_e!=null?(le=_e,V(re,ge,B(le)),ye=me=De=le):(ye=me=null,_e===null&&(ve=!0)),oe=ge,H=ae(oe+G))}ye!=null&&ye!=me&&ie!=oe&&ee(re,oe,B(ye),B(me),B(De),B(le))}else for(let ae=G==1?o:u;ae>=o&&ae<=u;ae+=G){let ye=p[ae];ye===null?ve=!0:ye!=null&&V(re,P(d[ae]),B(ye))}let[Y,Ce]=id(r,i);if(c.fill!=null||Y!=0){let ae=Z.fill=new Path2D(re),ye=c.fillTo(r,i,c.min,c.max,Y),me=B(ye),De=P(d[o]),le=P(d[u]);G==-1&&([le,De]=[De,le]),V(ae,le,me),V(ae,De,me)}if(!c.spanGaps){let ae=[];ve&&ae.push(...sd(d,p,o,u,G,P,t)),Z.gaps=ae=c.gaps(r,i,o,u,ae),Z.clip=Nu(ae,m.ori,z,R,k,b)}return Ce!=0&&(Z.band=Ce==2?[Ci(r,i,o,u,re,-1),Ci(r,i,o,u,re,1)]:Ci(r,i,o,u,re,Ce)),Z})}function f1(l){const t=Xe(l.align,1),r=Xe(l.ascDesc,!1),i=Xe(l.alignGaps,0),o=Xe(l.extend,!1);return(u,c,d,p)=>As(u,c,(m,w,v,x,z,R,k,b,W,P,B)=>{[d,p]=Eu(v,d,p);let V=m.pxRound,{left:ee,width:G}=u.bbox,Z=X=>V(R(X,x,P,b)),re=X=>V(k(X,z,B,W)),ve=x.ori==0?zl:Ml;const de={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:kl},Y=de.stroke,Ce=x.dir*(x.ori==0?1:-1);let ae=re(v[Ce==1?d:p]),ye=Z(w[Ce==1?d:p]),me=ye,De=ye;o&&t==-1&&(De=ee,ve(Y,De,ae)),ve(Y,ye,ae);for(let X=Ce==1?d:p;X>=d&&X<=p;X+=Ce){let D=v[X];if(D==null)continue;let H=Z(w[X]),K=re(D);t==1?ve(Y,H,ae):ve(Y,me,K),ve(Y,H,K),ae=K,me=H}let le=me;o&&t==1&&(le=ee+G,ve(Y,le,ae));let[ie,oe]=id(u,c);if(m.fill!=null||ie!=0){let X=de.fill=new Path2D(Y),D=m.fillTo(u,c,m.min,m.max,ie),H=re(D);ve(X,le,H),ve(X,De,H)}if(!m.spanGaps){let X=[];X.push(...sd(w,v,d,p,Ce,Z,i));let D=m.width*Je/2,H=r||t==1?D:-D,K=r||t==-1?-D:D;X.forEach(xe=>{xe[0]+=H,xe[1]+=K}),de.gaps=X=m.gaps(u,c,d,p,X),de.clip=Nu(X,x.ori,b,W,P,B)}return oe!=0&&(de.band=oe==2?[Ci(u,c,d,p,Y,-1),Ci(u,c,d,p,Y,1)]:Ci(u,c,d,p,Y,oe)),de})}function ug(l,t,r,i,o,u,c=ct){if(l.length>1){let d=null;for(let p=0,m=1/0;p{}),{fill:v,stroke:x}=m;return(z,R,k,b)=>As(z,R,(W,P,B,V,ee,G,Z,re,ve,de,Y)=>{let Ce=W.pxRound,ae=r,ye=i*Je,me=d*Je,De=p*Je,le,ie;V.ori==0?[le,ie]=u(z,R):[ie,le]=u(z,R);const oe=V.dir*(V.ori==0?1:-1);let X=V.ori==0?zu:ld,D=V.ori==0?w:(ce,qe,et,sn,kn,Gt,Rt)=>{w(ce,qe,et,kn,sn,Rt,Gt)},H=Xe(z.bands,Zf).find(ce=>ce.series[0]==R),K=H!=null?H.dir:0,xe=W.fillTo(z,R,W.min,W.max,K),be=Ce(Z(xe,ee,Y,ve)),ge,_e,He,Fe=de,Oe=Ce(W.width*Je),$t=!1,Pt=null,At=null,It=null,Kn=null;v!=null&&(Oe==0||x!=null)&&($t=!0,Pt=v.values(z,R,k,b),At=new Map,new Set(Pt).forEach(ce=>{ce!=null&&At.set(ce,new Path2D)}),Oe>0&&(It=x.values(z,R,k,b),Kn=new Map,new Set(It).forEach(ce=>{ce!=null&&Kn.set(ce,new Path2D)})));let{x0:Cn,size:_r}=m;if(Cn!=null&&_r!=null){ae=1,P=Cn.values(z,R,k,b),Cn.unit==2&&(P=P.map(et=>z.posToVal(re+et*de,V.key,!0)));let ce=_r.values(z,R,k,b);_r.unit==2?_e=ce[0]*de:_e=G(ce[0],V,de,re)-G(0,V,de,re),Fe=ug(P,B,G,V,de,re,Fe),He=Fe-_e+ye}else Fe=ug(P,B,G,V,de,re,Fe),He=Fe*c+ye,_e=Fe-He;He<1&&(He=0),Oe>=_e/2&&(Oe=0),He<5&&(Ce=Jg);let Xr=He>0,Pn=Fe-He-(Xr?Oe:0);_e=Ce(Tf(Pn,De,me)),ge=(ae==0?_e/2:ae==oe?0:_e)-ae*oe*((ae==0?ye/2:0)+(Xr?Oe/2:0));const Ze={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},nn=$t?null:new Path2D;let rn=null;if(H!=null)rn=z.data[H.series[1]];else{let{y0:ce,y1:qe}=m;ce!=null&&qe!=null&&(B=qe.values(z,R,k,b),rn=ce.values(z,R,k,b))}let sr=le*_e,Pe=ie*_e;for(let ce=oe==1?k:b;ce>=k&&ce<=b;ce+=oe){let qe=B[ce];if(qe==null)continue;if(rn!=null){let Yt=rn[ce]??0;if(qe-Yt==0)continue;be=Z(Yt,ee,Y,ve)}let et=V.distr!=2||m!=null?P[ce]:ce,sn=G(et,V,de,re),kn=Z(Xe(qe,xe),ee,Y,ve),Gt=Ce(sn-ge),Rt=Ce(Gn(kn,be)),ln=Ce(Yr(kn,be)),mn=Rt-ln;if(qe!=null){let Yt=qe<0?Pe:sr,vn=qe<0?sr:Pe;$t?(Oe>0&&It[ce]!=null&&X(Kn.get(It[ce]),Gt,ln+Sr(Oe/2),_e,Gn(0,mn-Oe),Yt,vn),Pt[ce]!=null&&X(At.get(Pt[ce]),Gt,ln+Sr(Oe/2),_e,Gn(0,mn-Oe),Yt,vn)):X(nn,Gt,ln+Sr(Oe/2),_e,Gn(0,mn-Oe),Yt,vn),D(z,R,ce,Gt-Oe/2,ln,_e+Oe,mn)}}return Oe>0?Ze.stroke=$t?Kn:nn:$t||(Ze._fill=W.width==0?W._fill:W._stroke??W._fill,Ze.width=0),Ze.fill=$t?At:nn,Ze})}function h1(l,t){const r=Xe(t==null?void 0:t.alignGaps,0);return(i,o,u,c)=>As(i,o,(d,p,m,w,v,x,z,R,k,b,W)=>{[u,c]=Eu(m,u,c);let P=d.pxRound,B=le=>P(x(le,w,b,R)),V=le=>P(z(le,v,W,k)),ee,G,Z;w.ori==0?(ee=Du,Z=zl,G=km):(ee=Tu,Z=Ml,G=Rm);const re=w.dir*(w.ori==0?1:-1);let ve=B(p[re==1?u:c]),de=ve,Y=[],Ce=[];for(let le=re==1?u:c;le>=u&&le<=c;le+=re)if(m[le]!=null){let oe=p[le],X=B(oe);Y.push(de=X),Ce.push(V(m[le]))}const ae={stroke:l(Y,Ce,ee,Z,G,P),fill:null,clip:null,band:null,gaps:null,flags:kl},ye=ae.stroke;let[me,De]=id(i,o);if(d.fill!=null||me!=0){let le=ae.fill=new Path2D(ye),ie=d.fillTo(i,o,d.min,d.max,me),oe=V(ie);Z(le,de,oe),Z(le,ve,oe)}if(!d.spanGaps){let le=[];le.push(...sd(p,m,u,c,re,B,r)),ae.gaps=le=d.gaps(i,o,u,c,le),ae.clip=Nu(le,w.ori,R,k,b,W)}return De!=0&&(ae.band=De==2?[Ci(i,o,u,c,ye,-1),Ci(i,o,u,c,ye,1)]:Ci(i,o,u,c,ye,De)),ae})}function p1(l){return h1(g1,l)}function g1(l,t,r,i,o,u){const c=l.length;if(c<2)return null;const d=new Path2D;if(r(d,l[0],t[0]),c==2)i(d,l[1],t[1]);else{let p=Array(c),m=Array(c-1),w=Array(c-1),v=Array(c-1);for(let x=0;x0!=m[x]>0?p[x]=0:(p[x]=3*(v[x-1]+v[x])/((2*v[x]+v[x-1])/m[x-1]+(v[x]+2*v[x-1])/m[x]),isFinite(p[x])||(p[x]=0));p[c-1]=m[c-2];for(let x=0;x{Ln.pxRatio=Je}));const m1=Tm(),v1=Nm();function fg(l,t,r,i){return(i?[l[0],l[1]].concat(l.slice(2)):[l[0]].concat(l.slice(1))).map((u,c)=>Lf(u,c,t,r))}function y1(l,t){return l.map((r,i)=>i==0?{}:Vt({},t,r))}function Lf(l,t,r,i){return Vt({},t==0?r:i,l)}function zm(l,t,r){return t==null?El:[t,r]}const w1=zm;function S1(l,t,r){return t==null?El:cu(t,r,qf,!0)}function Mm(l,t,r,i){return t==null?El:Cu(t,r,l.scales[i].log,!1)}const x1=Mm;function bm(l,t,r,i){return t==null?El:Xf(t,r,l.scales[i].log,!1)}const _1=bm;function E1(l,t,r,i,o){let u=Gn(Up(l),Up(t)),c=t-l,d=Gr(o/i*c,r);do{let p=r[d],m=i*p/c;if(m>=o&&u+(p<5?is.get(p):0)<=17)return[p,m]}while(++d(t=Jt((r=+o)*Je))+"px"),[l,t,r]}function C1(l){l.show&&[l.font,l.labelFont].forEach(t=>{let r=ft(t[2]*Je,1);t[0]=t[0].replace(/[0-9.]+px/,r+"px"),t[1]=r})}function Ln(l,t,r){const i={mode:Xe(l.mode,1)},o=i.mode;function u(g,S,_,E){let T=S.valToPct(g);return E+_*(S.dir==-1?1-T:T)}function c(g,S,_,E){let T=S.valToPct(g);return E+_*(S.dir==-1?T:1-T)}function d(g,S,_,E){return S.ori==0?u(g,S,_,E):c(g,S,_,E)}i.valToPosH=u,i.valToPosV=c;let p=!1;i.status=0;const m=i.root=Lr(M0);if(l.id!=null&&(m.id=l.id),wr(m,l.class),l.title){let g=Lr(L0,m);g.textContent=l.title}const w=$r("canvas"),v=i.ctx=w.getContext("2d"),x=Lr(P0,m);Os("click",x,g=>{g.target===R&&(Ke!=fi||rt!=Ii)&&Qt.click(i,g)},!0);const z=i.under=Lr(A0,x);x.appendChild(w);const R=i.over=Lr(I0,x);l=Cl(l);const k=+Xe(l.pxAlign,1),b=ag(k);(l.plugins||[]).forEach(g=>{g.opts&&(l=g.opts(i,l)||l)});const W=l.ms||.001,P=i.series=o==1?fg(l.series||[],tg,lg,!1):y1(l.series||[null],sg),B=i.axes=fg(l.axes||[],eg,rg,!0),V=i.scales={},ee=i.bands=l.bands||[];ee.forEach(g=>{g.fill=Ve(g.fill||null),g.dir=Xe(g.dir,-1)});const G=o==2?P[1].facets[0].scale:P[0].scale,Z={axes:Bo,series:Pu},re=(l.drawOrder||["axes","series"]).map(g=>Z[g]);function ve(g){const S=g.distr==3?_=>Ei(_>0?_:g.clamp(i,_,g.min,g.max,g.key)):g.distr==4?_=>df(_,g.asinh):g.distr==100?_=>g.fwd(_):_=>_;return _=>{let E=S(_),{_min:T,_max:L}=g,$=L-T;return(E-T)/$}}function de(g){let S=V[g];if(S==null){let _=(l.scales||ko)[g]||ko;if(_.from!=null){de(_.from);let E=Vt({},V[_.from],_,{key:g});E.valToPct=ve(E),V[g]=E}else{S=V[g]=Vt({},g==G?Sm:l1,_),S.key=g;let E=S.time,T=S.range,L=rs(T);if((g!=G||o==2&&!E)&&(L&&(T[0]==null||T[1]==null)&&(T={min:T[0]==null?jp:{mode:1,hard:T[0],soft:T[0]},max:T[1]==null?jp:{mode:1,hard:T[1],soft:T[1]}},L=!1),!L&&Ru(T))){let $=T;T=(q,ne,ue)=>ne==null?El:cu(ne,ue,$)}S.range=Ve(T||(E?w1:g==G?S.distr==3?x1:S.distr==4?_1:zm:S.distr==3?Mm:S.distr==4?bm:S1)),S.auto=Ve(L?!1:S.auto),S.clamp=Ve(S.clamp||s1),S._min=S._max=null,S.valToPct=ve(S)}}}de("x"),de("y"),o==1&&P.forEach(g=>{de(g.scale)}),B.forEach(g=>{de(g.scale)});for(let g in l.scales)de(g);const Y=V[G],Ce=Y.distr;let ae,ye;Y.ori==0?(wr(m,b0),ae=u,ye=c):(wr(m,O0),ae=c,ye=u);const me={};for(let g in V){let S=V[g];(S.min!=null||S.max!=null)&&(me[g]={min:S.min,max:S.max},S.min=S.max=null)}const De=l.tzDate||(g=>new Date(Jt(g/W))),le=l.fmtDate||ed,ie=W==1?bw(De):Pw(De),oe=qp(De,Xp(W==1?Mw:Lw,le)),X=Zp(De,Jp(Iw,le)),D=[],H=i.legend=Vt({},jw,l.legend),K=i.cursor=Vt({},Gw,{drag:{y:o==2}},l.cursor),xe=H.show,be=K.show,ge=H.markers;H.idxs=D,ge.width=Ve(ge.width),ge.dash=Ve(ge.dash),ge.stroke=Ve(ge.stroke),ge.fill=Ve(ge.fill);let _e,He,Fe,Oe=[],$t=[],Pt,At=!1,It={};if(H.live){const g=P[1]?P[1].values:null;At=g!=null,Pt=At?g(i,1,0):{_:0};for(let S in Pt)It[S]=Kf}if(xe)if(_e=$r("table",U0,m),Fe=$r("tbody",null,_e),H.mount(i,_e),At){He=$r("thead",null,_e,Fe);let g=$r("tr",null,He);$r("th",null,g);for(var Kn in Pt)$r("th",Np,g).textContent=Kn}else wr(_e,$0),H.live&&wr(_e,V0);const Cn={show:!0},_r={show:!1};function Xr(g,S){if(S==0&&(At||!H.live||o==2))return El;let _=[],E=$r("tr",G0,Fe,Fe.childNodes[S]);wr(E,g.class),g.show||wr(E,Ms);let T=$r("th",null,E);if(ge.show){let q=Lr(Y0,T);if(S>0){let ne=ge.width(i,S);ne&&(q.style.border=ne+"px "+ge.dash(i,S)+" "+ge.stroke(i,S)),q.style.background=ge.fill(i,S)}}let L=Lr(Np,T);g.label instanceof HTMLElement?L.appendChild(g.label):L.textContent=g.label,S>0&&(ge.show||(L.style.color=g.width>0?ge.stroke(i,S):ge.fill(i,S)),Ze("click",T,q=>{if(K._lock)return;wn(q);let ne=P.indexOf(g);if((q.ctrlKey||q.metaKey)!=H.isolate){let ue=P.some((fe,he)=>he>0&&he!=ne&&fe.show);P.forEach((fe,he)=>{he>0&&dr(he,ue?he==ne?Cn:_r:Cn,!0,Dt.setSeries)})}else dr(ne,{show:!g.show},!0,Dt.setSeries)},!1),_t&&Ze(Mp,T,q=>{K._lock||(wn(q),dr(P.indexOf(g),ji,!0,Dt.setSeries))},!1));for(var $ in Pt){let q=$r("td",K0,E);q.textContent="--",_.push(q)}return[E,_]}const Pn=new Map;function Ze(g,S,_,E=!0){const T=Pn.get(S)||{},L=K.bind[g](i,S,_,E);L&&(Os(g,S,T[g]=L),Pn.set(S,T))}function nn(g,S,_){const E=Pn.get(S)||{};for(let T in E)(g==null||T==g)&&(Df(T,S,E[T]),delete E[T]);g==null&&Pn.delete(S)}let rn=0,sr=0,Pe=0,ce=0,qe=0,et=0,sn=qe,kn=et,Gt=Pe,Rt=ce,ln=0,mn=0,Yt=0,vn=0;i.bbox={};let qr=!1,Jr=!1,lr=!1,or=!1,Zr=!1,zt=!1;function lt(g,S,_){(_||g!=i.width||S!=i.height)&&Kt(g,S),ci(!1),lr=!0,Jr=!0,Hn()}function Kt(g,S){i.width=rn=Pe=g,i.height=sr=ce=S,qe=et=0,an(),Rn();let _=i.bbox;ln=_.left=Ts(qe*Je,.5),mn=_.top=Ts(et*Je,.5),Yt=_.width=Ts(Pe*Je,.5),vn=_.height=Ts(ce*Je,.5)}const on=3;function ar(){let g=!1,S=0;for(;!g;){S++;let _=Hl(S),E=Wo(S);g=S==on||_&&E,g||(Kt(i.width,i.height),Jr=!0)}}function yn({width:g,height:S}){lt(g,S)}i.setSize=yn;function an(){let g=!1,S=!1,_=!1,E=!1;B.forEach((T,L)=>{if(T.show&&T._show){let{side:$,_size:q}=T,ne=$%2,ue=T.label!=null?T.labelSize:0,fe=q+ue;fe>0&&(ne?(Pe-=fe,$==3?(qe+=fe,E=!0):_=!0):(ce-=fe,$==0?(et+=fe,g=!0):S=!0))}}),An[0]=g,An[1]=_,An[2]=S,An[3]=E,Pe-=Ir[1]+Ir[3],qe+=Ir[3],ce-=Ir[2]+Ir[0],et+=Ir[0]}function Rn(){let g=qe+Pe,S=et+ce,_=qe,E=et;function T(L,$){switch(L){case 1:return g+=$,g-$;case 2:return S+=$,S-$;case 3:return _-=$,_+$;case 0:return E-=$,E+$}}B.forEach((L,$)=>{if(L.show&&L._show){let q=L.side;L._pos=T(q,L._size),L.label!=null&&(L._lpos=T(q,L.labelSize))}})}if(K.dataIdx==null){let g=K.hover,S=g.skip=new Set(g.skip??[]);S.add(void 0);let _=g.prox=Ve(g.prox),E=g.bias??(g.bias=0);K.dataIdx=(T,L,$,q)=>{if(L==0)return $;let ne=$,ue=_(T,L,$,q)??ct,fe=ue>=0&&ue0;)S.has(Ue[ke])||(je=ke);if(E==0||E==1)for(ke=$;Te==null&&ke++ue&&(ne=null);return ne}}const wn=g=>{K.event=g};K.idxs=D,K._lock=!1;let We=K.points;We.show=Ve(We.show),We.size=Ve(We.size),We.stroke=Ve(We.stroke),We.width=Ve(We.width),We.fill=Ve(We.fill);const xt=i.focus=Vt({},l.focus||{alpha:.3},K.focus),_t=xt.prox>=0,un=_t&&We.one;let vt=[],Sn=[],Ht=[];function Er(g,S){let _=We.show(i,S);if(_ instanceof HTMLElement)return wr(_,B0),wr(_,g.class),oi(_,-10,-10,Pe,ce),R.insertBefore(_,vt[S]),_}function Ri(g,S){if(o==1||S>0){let _=o==1&&V[g.scale].time,E=g.value;g.value=_?Gp(E)?Zp(De,Jp(E,le)):E||X:E||n1,g.label=g.label||(_?Kw:Yw)}if(un||S>0){g.width=g.width==null?1:g.width,g.paths=g.paths||m1||lw,g.fillTo=Ve(g.fillTo||o1),g.pxAlign=+Xe(g.pxAlign,k),g.pxRound=ag(g.pxAlign),g.stroke=Ve(g.stroke||null),g.fill=Ve(g.fill||null),g._stroke=g._fill=g._paths=g._focus=null;let _=r1(Gn(1,g.width),1),E=g.points=Vt({},{size:_,width:Gn(1,_*.2),stroke:g.stroke,space:_*2,paths:v1,_stroke:null,_fill:null},g.points);E.show=Ve(E.show),E.filter=Ve(E.filter),E.fill=Ve(E.fill),E.stroke=Ve(E.stroke),E.paths=Ve(E.paths),E.pxAlign=g.pxAlign}if(xe){let _=Xr(g,S);Oe.splice(S,0,_[0]),$t.splice(S,0,_[1]),H.values.push(null)}if(be){D.splice(S,0,null);let _=null;un?S==0&&(_=Er(g,S)):S>0&&(_=Er(g,S)),vt.splice(S,0,_),Sn.splice(S,0,0),Ht.splice(S,0,0)}jt("addSeries",S)}function bu(g,S){S=S??P.length,g=o==1?Lf(g,S,tg,lg):Lf(g,S,{},sg),P.splice(S,0,g),Ri(P[S],S)}i.addSeries=bu;function Ou(g){if(P.splice(g,1),xe){H.values.splice(g,1),$t.splice(g,1);let S=Oe.splice(g,1)[0];nn(null,S.firstChild),S.remove()}be&&(D.splice(g,1),vt.splice(g,1)[0].remove(),Sn.splice(g,1),Ht.splice(g,1)),jt("delSeries",g)}i.delSeries=Ou;const An=[!1,!1,!1,!1];function Ao(g,S){if(g._show=g.show,g.show){let _=g.side%2,E=V[g.scale];E==null&&(g.scale=_?P[1].scale:G,E=V[g.scale]);let T=E.time;g.size=Ve(g.size),g.space=Ve(g.space),g.rotate=Ve(g.rotate),rs(g.incrs)&&g.incrs.forEach($=>{!is.has($)&&is.set($,tm($))}),g.incrs=Ve(g.incrs||(E.distr==2?Dw:T?W==1?zw:Ow:zs)),g.splits=Ve(g.splits||(T&&E.distr==1?ie:E.distr==3?zf:E.distr==4?qw:Xw)),g.stroke=Ve(g.stroke),g.grid.stroke=Ve(g.grid.stroke),g.ticks.stroke=Ve(g.ticks.stroke),g.border.stroke=Ve(g.border.stroke);let L=g.values;g.values=rs(L)&&!rs(L[0])?Ve(L):T?rs(L)?qp(De,Xp(L,le)):Gp(L)?Aw(De,L):L||oe:L||Qw,g.filter=Ve(g.filter||(E.distr>=3&&E.log==10?e1:E.distr==3&&E.log==2?t1:Zg)),g.font=dg(g.font),g.labelFont=dg(g.labelFont),g._size=g.size(i,null,S,0),g._space=g._rotate=g._incrs=g._found=g._splits=g._values=null,g._size>0&&(An[S]=!0,g._el=Lr(H0,x))}}function Ni(g,S,_,E){let[T,L,$,q]=_,ne=S%2,ue=0;return ne==0&&(q||L)&&(ue=S==0&&!T||S==2&&!$?Jt(eg.size/3):0),ne==1&&(T||$)&&(ue=S==1&&!L||S==3&&!q?Jt(rg.size/2):0),ue}const Io=i.padding=(l.padding||[Ni,Ni,Ni,Ni]).map(g=>Ve(Xe(g,Ni))),Ir=i._padding=Io.map((g,S)=>g(i,S,An,0));let Ft,Mt=null,bt=null;const Is=o==1?P[0].idxs:null;let ur=null,ot=!1;function Ho(g,S){if(t=g??[],i.data=i._data=t,o==2){Ft=0;for(let _=1;_=0,zt=!0,Hn()}}i.setData=Ho;function ss(){ot=!0;let g,S;o==1&&(Ft>0?(Mt=Is[0]=0,bt=Is[1]=Ft-1,g=t[0][Mt],S=t[0][bt],Ce==2?(g=Mt,S=bt):g==S&&(Ce==3?[g,S]=Cu(g,g,Y.log,!1):Ce==4?[g,S]=Xf(g,g,Y.log,!1):Y.time?S=g+Jt(86400/W):[g,S]=cu(g,S,qf,!0))):(Mt=Is[0]=g=null,bt=Is[1]=S=null)),fr(G,g,S)}let ls,Hr,bl,Hs,Di,Qn,Ol,In,Ll,Nn;function Fo(g,S,_,E,T,L){g??(g=Tp),_??(_=Zf),E??(E="butt"),T??(T=Tp),L??(L="round"),g!=ls&&(v.strokeStyle=ls=g),T!=Hr&&(v.fillStyle=Hr=T),S!=bl&&(v.lineWidth=bl=S),L!=Di&&(v.lineJoin=Di=L),E!=Qn&&(v.lineCap=Qn=E),_!=Hs&&v.setLineDash(Hs=_)}function os(g,S,_,E){S!=Hr&&(v.fillStyle=Hr=S),g!=Ol&&(v.font=Ol=g),_!=In&&(v.textAlign=In=_),E!=Ll&&(v.textBaseline=Ll=E)}function Ti(g,S,_,E,T=0){if(E.length>0&&g.auto(i,ot)&&(S==null||S.min==null)){let L=Xe(Mt,0),$=Xe(bt,E.length-1),q=_.min==null?ew(E,L,$,T,g.distr==3):[_.min,_.max];g.min=Yr(g.min,_.min=q[0]),g.max=Gn(g.max,_.max=q[1])}}const zi={min:null,max:null};function Fs(){for(let E in V){let T=V[E];me[E]==null&&(T.min==null||me[G]!=null&&T.auto(i,ot))&&(me[E]=zi)}for(let E in V){let T=V[E];me[E]==null&&T.from!=null&&me[T.from]!=null&&(me[E]=zi)}me[G]!=null&&ci(!0);let g={};for(let E in me){let T=me[E];if(T!=null){let L=g[E]=Cl(V[E],uw);if(T.min!=null)Vt(L,T);else if(E!=G||o==2)if(Ft==0&&L.from==null){let $=L.range(i,null,null,E);L.min=$[0],L.max=$[1]}else L.min=ct,L.max=-ct}}if(Ft>0){P.forEach((E,T)=>{if(o==1){let L=E.scale,$=me[L];if($==null)return;let q=g[L];if(T==0){let ne=q.range(i,q.min,q.max,L);q.min=ne[0],q.max=ne[1],Mt=Gr(q.min,t[0]),bt=Gr(q.max,t[0]),bt-Mt>1&&(t[0][Mt]q.max&&bt--),E.min=ur[Mt],E.max=ur[bt]}else E.show&&E.auto&&Ti(q,$,E,t[T],E.sorted);E.idxs[0]=Mt,E.idxs[1]=bt}else if(T>0&&E.show&&E.auto){let[L,$]=E.facets,q=L.scale,ne=$.scale,[ue,fe]=t[T],he=g[q],Ae=g[ne];he!=null&&Ti(he,me[q],L,ue,L.sorted),Ae!=null&&Ti(Ae,me[ne],$,fe,$.sorted),E.min=$.min,E.max=$.max}});for(let E in g){let T=g[E],L=me[E];if(T.from==null&&(L==null||L.min==null)){let $=T.range(i,T.min==ct?null:T.min,T.max==-ct?null:T.max,E);T.min=$[0],T.max=$[1]}}}for(let E in g){let T=g[E];if(T.from!=null){let L=g[T.from];if(L.min==null)T.min=T.max=null;else{let $=T.range(i,L.min,L.max,E);T.min=$[0],T.max=$[1]}}}let S={},_=!1;for(let E in g){let T=g[E],L=V[E];if(L.min!=T.min||L.max!=T.max){L.min=T.min,L.max=T.max;let $=L.distr;L._min=$==3?Ei(L.min):$==4?df(L.min,L.asinh):$==100?L.fwd(L.min):L.min,L._max=$==3?Ei(L.max):$==4?df(L.max,L.asinh):$==100?L.fwd(L.max):L.max,S[E]=_=!0}}if(_){P.forEach((E,T)=>{o==2?T>0&&S.y&&(E._paths=null):S[E.scale]&&(E._paths=null)});for(let E in S)lr=!0,jt("setScale",E);be&&K.left>=0&&(or=zt=!0)}for(let E in me)me[E]=null}function Lu(g){let S=Tf(Mt-1,0,Ft-1),_=Tf(bt+1,0,Ft-1);for(;g[S]==null&&S>0;)S--;for(;g[_]==null&&_0){let g=P.some(S=>S._focus)&&Nn!=xt.alpha;g&&(v.globalAlpha=Nn=xt.alpha),P.forEach((S,_)=>{if(_>0&&S.show&&(js(_,!1),js(_,!0),S._paths==null)){let E=Nn;Nn!=S.alpha&&(v.globalAlpha=Nn=S.alpha);let T=o==2?[0,t[_][0].length-1]:Lu(t[_]);S._paths=S.paths(i,_,T[0],T[1]),Nn!=E&&(v.globalAlpha=Nn=E)}}),P.forEach((S,_)=>{if(_>0&&S.show){let E=Nn;Nn!=S.alpha&&(v.globalAlpha=Nn=S.alpha),S._paths!=null&&Pl(_,!1);{let T=S._paths!=null?S._paths.gaps:null,L=S.points.show(i,_,Mt,bt,T),$=S.points.filter(i,_,L,T);(L||$)&&(S.points._paths=S.points.paths(i,_,Mt,bt,$),Pl(_,!0))}Nn!=E&&(v.globalAlpha=Nn=E),jt("drawSeries",_)}}),g&&(v.globalAlpha=Nn=1)}}function js(g,S){let _=S?P[g].points:P[g];_._stroke=_.stroke(i,g),_._fill=_.fill(i,g)}function Pl(g,S){let _=S?P[g].points:P[g],{stroke:E,fill:T,clip:L,flags:$,_stroke:q=_._stroke,_fill:ne=_._fill,_width:ue=_.width}=_._paths;ue=ft(ue*Je,3);let fe=null,he=ue%2/2;S&&ne==null&&(ne=ue>0?"#fff":q);let Ae=_.pxAlign==1&&he>0;if(Ae&&v.translate(he,he),!S){let Ge=ln-ue/2,Ue=mn-ue/2,je=Yt+ue,Te=vn+ue;fe=new Path2D,fe.rect(Ge,Ue,je,Te)}S?Il(q,ue,_.dash,_.cap,ne,E,T,$,L):Al(g,q,ue,_.dash,_.cap,ne,E,T,$,fe,L),Ae&&v.translate(-he,-he)}function Al(g,S,_,E,T,L,$,q,ne,ue,fe){let he=!1;ne!=0&&ee.forEach((Ae,Ge)=>{if(Ae.series[0]==g){let Ue=P[Ae.series[1]],je=t[Ae.series[1]],Te=(Ue._paths||ko).band;rs(Te)&&(Te=Ae.dir==1?Te[0]:Te[1]);let ke,st=null;Ue.show&&Te&&nw(je,Mt,bt)?(st=Ae.fill(i,Ge)||L,ke=Ue._paths.clip):Te=null,Il(S,_,E,T,st,$,q,ne,ue,fe,ke,Te),he=!0}}),he||Il(S,_,E,T,L,$,q,ne,ue,fe)}const Mi=kl|bf;function Il(g,S,_,E,T,L,$,q,ne,ue,fe,he){Fo(g,S,_,E,T),(ne||ue||he)&&(v.save(),ne&&v.clip(ne),ue&&v.clip(ue)),he?(q&Mi)==Mi?(v.clip(he),fe&&v.clip(fe),$e(T,$),bi(g,L,S)):q&bf?($e(T,$),v.clip(he),bi(g,L,S)):q&kl&&(v.save(),v.clip(he),fe&&v.clip(fe),$e(T,$),v.restore(),bi(g,L,S)):($e(T,$),bi(g,L,S)),(ne||ue||he)&&v.restore()}function bi(g,S,_){_>0&&(S instanceof Map?S.forEach((E,T)=>{v.strokeStyle=ls=T,v.stroke(E)}):S!=null&&g&&v.stroke(S))}function $e(g,S){S instanceof Map?S.forEach((_,E)=>{v.fillStyle=Hr=E,v.fill(_)}):S!=null&&g&&v.fill(S)}function jo(g,S,_,E){let T=B[g],L;if(E<=0)L=[0,0];else{let $=T._space=T.space(i,g,S,_,E),q=T._incrs=T.incrs(i,g,S,_,E,$);L=E1(S,_,q,E,$)}return T._found=L}function Ws(g,S,_,E,T,L,$,q,ne,ue){let fe=$%2/2;k==1&&v.translate(fe,fe),Fo(q,$,ne,ue,q),v.beginPath();let he,Ae,Ge,Ue,je=T+(E==0||E==3?-L:L);_==0?(Ae=T,Ue=je):(he=T,Ge=je);for(let Te=0;Te{if(!_.show)return;let T=V[_.scale];if(T.min==null){_._show&&(S=!1,_._show=!1,ci(!1));return}else _._show||(S=!1,_._show=!0,ci(!1));let L=_.side,$=L%2,{min:q,max:ne}=T,[ue,fe]=jo(E,q,ne,$==0?Pe:ce);if(fe==0)return;let he=T.distr==2,Ae=_._splits=_.splits(i,E,q,ne,ue,fe,he),Ge=T.distr==2?Ae.map(ke=>ur[ke]):Ae,Ue=T.distr==2?ur[Ae[1]]-ur[Ae[0]]:ue,je=_._values=_.values(i,_.filter(i,Ge,E,fe,Ue),E,fe,Ue);_._rotate=L==2?_.rotate(i,je,E,fe):0;let Te=_._size;_._size=Ar(_.size(i,je,E,g)),Te!=null&&_._size!=Te&&(S=!1)}),S}function Wo(g){let S=!0;return Io.forEach((_,E)=>{let T=_(i,E,An,g);T!=Ir[E]&&(S=!1),Ir[E]=T}),S}function Bo(){for(let g=0;gur[xn]):Ge,je=fe.distr==2?ur[Ge[1]]-ur[Ge[0]]:ne,Te=S.ticks,ke=S.border,st=Te.show?Te.size:0,yt=Jt(st*Je),Wt=Jt((S.alignTo==2?S._size-st-S.gap:S.gap)*Je),tt=S._rotate*-Ja/180,wt=b(S._pos*Je),jn=(yt+Wt)*q,at=wt+jn;L=E==0?at:0,T=E==1?at:0;let cn=S.font[0],Jn=S.align==1?gl:S.align==2?uf:tt>0?gl:tt<0?uf:E==0?"center":_==3?uf:gl,pr=tt||E==1?"middle":_==2?po:Dp;os(cn,$,Jn,pr);let Tn=S.font[1]*S.lineGap,Wn=Ge.map(xn=>b(d(xn,fe,he,Ae))),Bn=S._values;for(let xn=0;xn{_>0&&(S._paths=null,g&&(o==1?(S.min=null,S.max=null):S.facets.forEach(E=>{E.min=null,E.max=null})))})}let Oi=!1,Li=!1,Xn=[];function ei(){Li=!1;for(let g=0;g0&&queueMicrotask(ei)}i.batch=as;function Pi(){if(qr&&(Fs(),qr=!1),lr&&(ar(),lr=!1),Jr){if(mt(z,gl,qe),mt(z,po,et),mt(z,vo,Pe),mt(z,yo,ce),mt(R,gl,qe),mt(R,po,et),mt(R,vo,Pe),mt(R,yo,ce),mt(x,vo,rn),mt(x,yo,sr),w.width=Jt(rn*Je),w.height=Jt(sr*Je),B.forEach(({_el:g,_show:S,_size:_,_pos:E,side:T})=>{if(g!=null)if(S){let L=T===3||T===0?_:0,$=T%2==1;mt(g,$?"left":"top",E-L),mt(g,$?"width":"height",_),mt(g,$?"top":"left",$?et:qe),mt(g,$?"height":"width",$?ce:Pe),Nf(g,Ms)}else wr(g,Ms)}),ls=Hr=bl=Di=Qn=Ol=In=Ll=Hs=null,Nn=1,gs(!0),qe!=sn||et!=kn||Pe!=Gt||ce!=Rt){ci(!1);let g=Pe/Gt,S=ce/Rt;if(be&&!or&&K.left>=0){K.left*=g,K.top*=S,kr&&oi(kr,Jt(K.left),0,Pe,ce),Ai&&oi(Ai,0,Jt(K.top),Pe,ce);for(let _=0;_=0&&it.width>0){it.left*=g,it.width*=g,it.top*=S,it.height*=S;for(let _ in Vl)mt(di,_,it[_])}sn=qe,kn=et,Gt=Pe,Rt=ce}jt("setSize"),Jr=!1}rn>0&&sr>0&&(v.clearRect(0,0,w.width,w.height),jt("drawClear"),re.forEach(g=>g()),jt("draw")),it.show&&Zr&&(cr(it),Zr=!1),be&&or&&(hi(null,!0,!1),or=!1),H.show&&H.live&&zt&&(ps(),zt=!1),p||(p=!0,i.status=1,jt("ready")),ot=!1,Oi=!1}i.redraw=(g,S)=>{lr=S||!1,g!==!1?fr(G,Y.min,Y.max):Hn()};function Cr(g,S){let _=V[g];if(_.from==null){if(Ft==0){let E=_.range(i,S.min,S.max,g);S.min=E[0],S.max=E[1]}if(S.min>S.max){let E=S.min;S.min=S.max,S.max=E}if(Ft>1&&S.min!=null&&S.max!=null&&S.max-S.min<1e-16)return;g==G&&_.distr==2&&Ft>0&&(S.min=Gr(S.min,t[0]),S.max=Gr(S.max,t[0]),S.min==S.max&&S.max++),me[g]=S,qr=!0,Hn()}}i.setScale=Cr;let Fl,Bs,kr,Ai,jl,us,fi,Ii,Hi,Fi,Ke,rt,ti=!1;const Qt=K.drag;let Nt=Qt.x,Et=Qt.y;be&&(K.x&&(Fl=Lr(j0,R)),K.y&&(Bs=Lr(W0,R)),Y.ori==0?(kr=Fl,Ai=Bs):(kr=Bs,Ai=Fl),Ke=K.left,rt=K.top);const it=i.select=Vt({show:!0,over:!0,left:0,width:0,top:0,height:0},l.select),di=it.show?Lr(F0,it.over?R:z):null;function cr(g,S){if(it.show){for(let _ in g)it[_]=g[_],_ in Vl&&mt(di,_,g[_]);S!==!1&&jt("setSelect")}}i.setSelect=cr;function Wl(g){if(P[g].show)xe&&Nf(Oe[g],Ms);else if(xe&&wr(Oe[g],Ms),be){let _=un?vt[0]:vt[g];_!=null&&oi(_,-10,-10,Pe,ce)}}function fr(g,S,_){Cr(g,{min:S,max:_})}function dr(g,S,_,E){S.focus!=null&&Bl(g),S.show!=null&&P.forEach((T,L)=>{L>0&&(g==L||g==null)&&(T.show=S.show,Wl(L),o==2?(fr(T.facets[0].scale,null,null),fr(T.facets[1].scale,null,null)):fr(T.scale,null,null),Hn())}),_!==!1&&jt("setSeries",g,S),E&&ms("setSeries",i,g,S)}i.setSeries=dr;function Us(g,S){Vt(ee[g],S)}function Vs(g,S){g.fill=Ve(g.fill||null),g.dir=Xe(g.dir,-1),S=S??ee.length,ee.splice(S,0,g)}function Uo(g){g==null?ee.length=0:ee.splice(g,1)}i.addBand=Vs,i.setBand=Us,i.delBand=Uo;function Fn(g,S){P[g].alpha=S,be&&vt[g]!=null&&(vt[g].style.opacity=S),xe&&Oe[g]&&(Oe[g].style.opacity=S)}let Dn,Rr,hr;const ji={focus:!0};function Bl(g){if(g!=hr){let S=g==null,_=xt.alpha!=1;P.forEach((E,T)=>{if(o==1||T>0){let L=S||T==0||T==g;E._focus=S?null:L,_&&Fn(T,L?1:xt.alpha)}}),hr=g,_&&Hn()}}xe&&_t&&Ze(bp,_e,g=>{K._lock||(wn(g),hr!=null&&dr(null,ji,!0,Dt.setSeries))});function qn(g,S,_){let E=V[S];_&&(g=g/Je-(E.ori==1?et:qe));let T=Pe;E.ori==1&&(T=ce,g=T-g),E.dir==-1&&(g=T-g);let L=E._min,$=E._max,q=g/T,ne=L+($-L)*q,ue=E.distr;return ue==3?_l(10,ne):ue==4?iw(ne,E.asinh):ue==100?E.bwd(ne):ne}function cs(g,S){let _=qn(g,G,S);return Gr(_,t[0],Mt,bt)}i.valToIdx=g=>Gr(g,t[0]),i.posToIdx=cs,i.posToVal=qn,i.valToPos=(g,S,_)=>V[S].ori==0?u(g,V[S],_?Yt:Pe,_?ln:0):c(g,V[S],_?vn:ce,_?mn:0),i.setCursor=(g,S,_)=>{Ke=g.left,rt=g.top,hi(null,S,_)};function fs(g,S){mt(di,gl,it.left=g),mt(di,vo,it.width=S)}function Ul(g,S){mt(di,po,it.top=g),mt(di,yo,it.height=S)}let ds=Y.ori==0?fs:Ul,hs=Y.ori==1?fs:Ul;function Au(){if(xe&&H.live)for(let g=o==2?1:0;g{D[E]=_}):aw(g.idx)||D.fill(g.idx),H.idx=D[0]),xe&&H.live){for(let _=0;_0||o==1&&!At)&&Iu(_,D[_]);Au()}zt=!1,S!==!1&&jt("setLegend")}i.setLegend=ps;function Iu(g,S){let _=P[g],E=g==0&&Ce==2?ur:t[g],T;At?T=_.values(i,g,S)??It:(T=_.value(i,S==null?null:E[S],g,S),T=T==null?It:{_:T}),H.values[g]=T}function hi(g,S,_){Hi=Ke,Fi=rt,[Ke,rt]=K.move(i,Ke,rt),K.left=Ke,K.top=rt,be&&(kr&&oi(kr,Jt(Ke),0,Pe,ce),Ai&&oi(Ai,0,Jt(rt),Pe,ce));let E,T=Mt>bt;Dn=ct,Rr=null;let L=Y.ori==0?Pe:ce,$=Y.ori==1?Pe:ce;if(Ke<0||Ft==0||T){E=K.idx=null;for(let q=0;q0&&st.show){let jn=tt==null?-10:tt==E?ue:ae(o==1?t[0][tt]:t[ke][0][tt],Y,L,0),at=wt==null?-10:ye(wt,o==1?V[st.scale]:V[st.facets[1].scale],$,0);if(_t&&wt!=null){let cn=Y.ori==1?Ke:rt,Jn=Zt(xt.dist(i,ke,tt,at,cn));if(Jn=0?1:-1,Bn=Tn>=0?1:-1;Bn==Wn&&(Bn==1?pr==1?wt>=Tn:wt<=Tn:pr==1?wt<=Tn:wt>=Tn)&&(Dn=Jn,Rr=ke)}else Dn=Jn,Rr=ke}}if(zt||un){let cn,Jn;Y.ori==0?(cn=jn,Jn=at):(cn=at,Jn=jn);let pr,Tn,Wn,Bn,Nr,xn,Bt=!0,Fr=We.bbox;if(Fr!=null){Bt=!1;let Ot=Fr(i,ke);Wn=Ot.left,Bn=Ot.top,pr=Ot.width,Tn=Ot.height}else Wn=cn,Bn=Jn,pr=Tn=We.size(i,ke);if(xn=We.fill(i,ke),Nr=We.stroke(i,ke),un)ke==Rr&&Dn<=xt.prox&&(fe=Wn,he=Bn,Ae=pr,Ge=Tn,Ue=Bt,je=xn,Te=Nr);else{let Ot=vt[ke];Ot!=null&&(Sn[ke]=Wn,Ht[ke]=Bn,Fp(Ot,pr,Tn,Bt),Ip(Ot,xn,Nr),oi(Ot,Ar(Wn),Ar(Bn),Pe,ce))}}}}if(un){let ke=xt.prox,st=hr==null?Dn<=ke:Dn>ke||Rr!=hr;if(zt||st){let yt=vt[0];yt!=null&&(Sn[0]=fe,Ht[0]=he,Fp(yt,Ae,Ge,Ue),Ip(yt,je,Te),oi(yt,Ar(fe),Ar(he),Pe,ce))}}}if(it.show&&ti)if(g!=null){let[q,ne]=Dt.scales,[ue,fe]=Dt.match,[he,Ae]=g.cursor.sync.scales,Ge=g.cursor.drag;if(Nt=Ge._x,Et=Ge._y,Nt||Et){let{left:Ue,top:je,width:Te,height:ke}=g.select,st=g.scales[he].ori,yt=g.posToVal,Wt,tt,wt,jn,at,cn=q!=null&&ue(q,he),Jn=ne!=null&&fe(ne,Ae);cn&&Nt?(st==0?(Wt=Ue,tt=Te):(Wt=je,tt=ke),wt=V[q],jn=ae(yt(Wt,he),wt,L,0),at=ae(yt(Wt+tt,he),wt,L,0),ds(Yr(jn,at),Zt(at-jn))):ds(0,L),Jn&&Et?(st==1?(Wt=Ue,tt=Te):(Wt=je,tt=ke),wt=V[ne],jn=ye(yt(Wt,Ae),wt,$,0),at=ye(yt(Wt+tt,Ae),wt,$,0),hs(Yr(jn,at),Zt(at-jn))):hs(0,$)}else $l()}else{let q=Zt(Hi-jl),ne=Zt(Fi-us);if(Y.ori==1){let Ae=q;q=ne,ne=Ae}Nt=Qt.x&&q>=Qt.dist,Et=Qt.y&&ne>=Qt.dist;let ue=Qt.uni;ue!=null?Nt&&Et&&(Nt=q>=ue,Et=ne>=ue,!Nt&&!Et&&(ne>q?Et=!0:Nt=!0)):Qt.x&&Qt.y&&(Nt||Et)&&(Nt=Et=!0);let fe,he;Nt&&(Y.ori==0?(fe=fi,he=Ke):(fe=Ii,he=rt),ds(Yr(fe,he),Zt(he-fe)),Et||hs(0,$)),Et&&(Y.ori==1?(fe=fi,he=Ke):(fe=Ii,he=rt),hs(Yr(fe,he),Zt(he-fe)),Nt||ds(0,L)),!Nt&&!Et&&(ds(0,0),hs(0,0))}if(Qt._x=Nt,Qt._y=Et,g==null){if(_){if(Ks!=null){let[q,ne]=Dt.scales;Dt.values[0]=q!=null?qn(Y.ori==0?Ke:rt,q):null,Dt.values[1]=ne!=null?qn(Y.ori==1?Ke:rt,ne):null}ms(cf,i,Ke,rt,Pe,ce,E)}if(_t){let q=_&&Dt.setSeries,ne=xt.prox;hr==null?Dn<=ne&&dr(Rr,ji,!0,q):Dn>ne?dr(null,ji,!0,q):Rr!=hr&&dr(Rr,ji,!0,q)}}zt&&(H.idx=E,ps()),S!==!1&&jt("setCursor")}let ni=null;Object.defineProperty(i,"rect",{get(){return ni==null&&gs(!1),ni}});function gs(g=!1){g?ni=null:(ni=R.getBoundingClientRect(),jt("syncRect",ni))}function Vo(g,S,_,E,T,L,$){K._lock||ti&&g!=null&&g.movementX==0&&g.movementY==0||($s(g,S,_,E,T,L,$,!1,g!=null),g!=null?hi(null,!0,!0):hi(S,!0,!1))}function $s(g,S,_,E,T,L,$,q,ne){if(ni==null&&gs(!1),wn(g),g!=null)_=g.clientX-ni.left,E=g.clientY-ni.top;else{if(_<0||E<0){Ke=-10,rt=-10;return}let[ue,fe]=Dt.scales,he=S.cursor.sync,[Ae,Ge]=he.values,[Ue,je]=he.scales,[Te,ke]=Dt.match,st=S.axes[0].side%2==1,yt=Y.ori==0?Pe:ce,Wt=Y.ori==1?Pe:ce,tt=st?L:T,wt=st?T:L,jn=st?E:_,at=st?_:E;if(Ue!=null?_=Te(ue,Ue)?d(Ae,V[ue],yt,0):-10:_=yt*(jn/tt),je!=null?E=ke(fe,je)?d(Ge,V[fe],Wt,0):-10:E=Wt*(at/wt),Y.ori==1){let cn=_;_=E,E=cn}}ne&&(S==null||S.cursor.event.type==cf)&&((_<=1||_>=Pe-1)&&(_=Ts(_,Pe)),(E<=1||E>=ce-1)&&(E=Ts(E,ce))),q?(jl=_,us=E,[fi,Ii]=K.move(i,_,E)):(Ke=_,rt=E)}const Vl={width:0,height:0,left:0,top:0};function $l(){cr(Vl,!1)}let $o,Go,Gs,Yo;function Ko(g,S,_,E,T,L,$){ti=!0,Nt=Et=Qt._x=Qt._y=!1,$s(g,S,_,E,T,L,$,!0,!1),g!=null&&(Ze(ff,kf,Qo,!1),ms(zp,i,fi,Ii,Pe,ce,null));let{left:q,top:ne,width:ue,height:fe}=it;$o=q,Go=ne,Gs=ue,Yo=fe}function Qo(g,S,_,E,T,L,$){ti=Qt._x=Qt._y=!1,$s(g,S,_,E,T,L,$,!1,!0);let{left:q,top:ne,width:ue,height:fe}=it,he=ue>0||fe>0,Ae=$o!=q||Go!=ne||Gs!=ue||Yo!=fe;if(he&&Ae&&cr(it),Qt.setScale&&he&&Ae){let Ge=q,Ue=ue,je=ne,Te=fe;if(Y.ori==1&&(Ge=ne,Ue=fe,je=q,Te=ue),Nt&&fr(G,qn(Ge,G),qn(Ge+Ue,G)),Et)for(let ke in V){let st=V[ke];ke!=G&&st.from==null&&st.min!=ct&&fr(ke,qn(je+Te,ke),qn(je,ke))}$l()}else K.lock&&(K._lock=!K._lock,hi(S,!0,g!=null));g!=null&&(nn(ff,kf),ms(ff,i,Ke,rt,Pe,ce,null))}function Xo(g,S,_,E,T,L,$){if(K._lock)return;wn(g);let q=ti;if(ti){let ne=!0,ue=!0,fe=10,he,Ae;Y.ori==0?(he=Nt,Ae=Et):(he=Et,Ae=Nt),he&&Ae&&(ne=Ke<=fe||Ke>=Pe-fe,ue=rt<=fe||rt>=ce-fe),he&&ne&&(Ke=Ke{let T=Dt.match[2];_=T(i,S,_),_!=-1&&dr(_,E,!0,!1)},be&&(Ze(zp,R,Ko),Ze(cf,R,Vo),Ze(Mp,R,g=>{wn(g),gs(!1)}),Ze(bp,R,Xo),Ze(Op,R,qo),Of.add(i),i.syncRect=gs);const Ys=i.hooks=l.hooks||{};function jt(g,S,_){Li?Xn.push([g,S,_]):g in Ys&&Ys[g].forEach(E=>{E.call(null,i,S,_)})}(l.plugins||[]).forEach(g=>{for(let S in g.hooks)Ys[S]=(Ys[S]||[]).concat(g.hooks[S])});const Zo=(g,S,_)=>_,Dt=Vt({key:null,setSeries:!1,filters:{pub:Vp,sub:Vp},scales:[G,P[1]?P[1].scale:null],match:[$p,$p,Zo],values:[null,null]},K.sync);Dt.match.length==2&&Dt.match.push(Zo),K.sync=Dt;const Ks=Dt.key,pi=xm(Ks);function ms(g,S,_,E,T,L,$){Dt.filters.pub(g,S,_,E,T,L,$)&&pi.pub(g,S,_,E,T,L,$)}pi.sub(i);function ea(g,S,_,E,T,L,$){Dt.filters.sub(g,S,_,E,T,L,$)&&Wi[g](null,S,_,E,T,L,$)}i.pub=ea;function ta(){pi.unsub(i),Of.delete(i),Pn.clear(),Df(uu,Sl,Jo),m.remove(),_e==null||_e.remove(),jt("destroy")}i.destroy=ta;function Qs(){jt("init",l,t),Ho(t||l.data,!1),me[G]?Cr(G,me[G]):ss(),Zr=it.show&&(it.width>0||it.height>0),or=zt=!0,lt(l.width,l.height)}return P.forEach(Ri),B.forEach(Ao),r?r instanceof HTMLElement?(r.appendChild(m),Qs()):r(i,Qs):Qs(),i}Ln.assign=Vt;Ln.fmtNum=Jf;Ln.rangeNum=cu;Ln.rangeLog=Cu;Ln.rangeAsinh=Xf;Ln.orient=As;Ln.pxRatio=Je;Ln.join=gw;Ln.fmtDate=ed,Ln.tzDate=Rw;Ln.sync=xm;{Ln.addGap=a1,Ln.clipGaps=Nu;let l=Ln.paths={points:Nm};l.linear=Tm,l.stepped=f1,l.bars=d1,l.spline=p1}const k1=6e3;class R1{constructor(t=k1){fo(this,"t");fo(this,"v");fo(this,"len",0);fo(this,"head",0);this.t=new Float64Array(t),this.v=new Float64Array(t)}push(t,r){const i=this.t.length;this.t[this.head]=t,this.v[this.head]=r,this.head=(this.head+1)%i,this.len=t&&(u[d]=this.t[m],c[d]=this.v[m],d++)}return{t:u.subarray(0,d),v:c.subarray(0,d)}}last(){if(this.len===0)return null;const t=this.t.length;return this.v[(this.head-1+t)%t]}}const Pf=new Map;function N1(l){let t=Pf.get(l);return t||(t=new R1,Pf.set(l,t)),t}function Om(l,t){const r=N1(l);for(const[i,o]of t)r.push(i,o)}function Lm(l,t=-1/0){const r=Pf.get(l);return r?r.read(t):{t:new Float64Array(0),v:new Float64Array(0)}}const xl=new Map;let Za=[];function Pm(){Za.forEach(l=>l())}function D1(l){xl.set(l,(xl.get(l)||0)+1),Pm()}function T1(l){const t=(xl.get(l)||0)-1;t<=0?xl.delete(l):xl.set(l,t),Pm()}function z1(){return Array.from(xl.keys())}function M1(l){return Za.push(l),()=>{Za=Za.filter(t=>t!==l)}}const hg=3e3;let yl=[],eu=[];function b1(l){l.length&&(yl=yl.concat(l),yl.length>hg&&(yl=yl.slice(-hg)),eu.forEach(t=>t()))}function O1(){return yl}function L1(l){return eu.push(l),()=>{eu=eu.filter(t=>t!==l)}}let tu=0,nu=[];function pg(l){tu+=l?1:-1,tu<0&&(tu=0),nu.forEach(t=>t())}function P1(){return tu>0}function A1(l){return nu.push(l),()=>{nu=nu.filter(t=>t!==l)}}let Ls=null,mf=null;function I1(){return`${location.protocol==="https:"?"wss":"ws"}://${location.host}/api/monitor/stream`}function gg(){Ls&&Ls.readyState===WebSocket.OPEN&&Ls.send(JSON.stringify({type:"subscribe",signals:z1()}))}function mg(){Ls&&Ls.readyState===WebSocket.OPEN&&Ls.send(JSON.stringify({type:"raw",enabled:P1()}))}function Am(){const l=new WebSocket(I1());Ls=l,l.onopen=()=>{gn.getState().setConnected(!0),gg(),mg()},l.onclose=()=>{gn.getState().setConnected(!1),mf==null&&(mf=window.setTimeout(()=>{mf=null,Am()},1e3))},l.onerror=()=>l.close(),l.onmessage=r=>{let i;try{i=JSON.parse(r.data)}catch{return}const o=gn.getState();switch(i.type){case"meta":o.setMeta(i.signals,i.pairs),o.setMotors(i.motors);break;case"motors":o.setMotors(i.motors),i.status&&o.setStatus(i.status);break;case"samples":for(const[u,c]of Object.entries(i.data))Om(u,c);break;case"raw":b1(i.frames);break}};let t=null;M1(()=>{t==null&&(t=window.setTimeout(()=>{t=null,gg()},80))}),A1(mg)}async function H1(l,t=600){return l.length?(await fetch(`/api/monitor/snapshot?signals=${l.join(",")}&n=${t}`)).json():{}}async function F1(){try{return(await(await fetch("/api/monitor/motor-types")).json()).types||[]}catch{return[]}}async function j1(l,t){await fetch("/api/monitor/motor-type",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({motorId:l,motorType:t})})}const W1={pos:"#58a6ff",vel:"#3fb950",torque:"#d29922",kp:"#bc8cff",kd:"#f778ba",vel_limit:"#56d4dd",torque_limit:"#e3b341",t_mos:"#ff7b72",t_rotor:"#ffa657",status_code:"#8b949e"};function Im(l){return W1[l]||"#8b949e"}function B1(l){const t=Im(l.field);return l.source==="cmd"?$1(t,.15):t}function U1(l,t){const r=l.replace("#",""),i=parseInt(r.slice(0,2),16),o=parseInt(r.slice(2,4),16),u=parseInt(r.slice(4,6),16);return`rgba(${i},${o},${u},${t})`}function vg(l){const t=Im(l.field);return l.source==="cmd"?{stroke:U1(t,.45),width:1.25}:{stroke:t,width:1.85}}function Af(l){const t=l.split(":");return t.length>=3?`${t[1]} ${t[2]}`:l}function V1(l){return l.includes(":cmd.")}const yg=["pos","vel","torque","kp","kd","t_mos","t_rotor"];function $1(l,t){const r=l.replace("#",""),i=Math.min(255,Math.round(parseInt(r.slice(0,2),16)+255*t)),o=Math.min(255,Math.round(parseInt(r.slice(2,4),16)+255*t)),u=Math.min(255,Math.round(parseInt(r.slice(4,6),16)+255*t));return`rgb(${i},${o},${u})`}function Rl(l,t=3){return l==null||Number.isNaN(l)?"—":l.toFixed(t)}const wg=2e3;function G1(l,t){const r=l.map(c=>Lm(c,t)),i=new Set;for(const c of r)for(let d=0;dc-d);if(o.length>wg){const c=Math.ceil(o.length/wg);o=o.filter((d,p)=>p%c===0)}const u=[o];for(const c of r){const d=new Array(o.length).fill(null);let p=0,m=null;for(let w=0;wk.ensurePlot),r=gn(k=>k.removeSignalFromPlot),i=gn(k=>k.setPlotConfig),o=gn(k=>k.plotConfigs[l]),u=gn(k=>k.signals);j.useEffect(()=>{t(l)},[l,t]);const c=(o==null?void 0:o.signals)??[],d=(o==null?void 0:o.duration)??10,p=c.join("|"),{setNodeRef:m,isOver:w}=c0({id:`plot:${l}`,data:{panelId:l}}),v=j.useRef(null),x=j.useRef(null),z=j.useRef(0);j.useEffect(()=>{if(!v.current)return;const k=v.current,b=new Map(u.map(ee=>[ee.id,ee])),W=[{label:"t"},...c.map(ee=>{const G=b.get(ee),Z=G?vg(G):{stroke:"#8b949e",width:1.5};return{label:Af(ee),stroke:Z.stroke,width:Z.width,points:{show:!1}}})],P={width:k.clientWidth||400,height:k.clientHeight||220,legend:{show:!1},series:W,cursor:{y:!1,points:{show:!0}},scales:{x:{time:!1}},axes:[{stroke:"#8b949e",grid:{stroke:"rgba(139,148,158,0.12)"},ticks:{stroke:"rgba(139,148,158,0.2)"},values:(ee,G)=>G.map(Z=>(Z-z.current).toFixed(1)+"s")},{stroke:"#8b949e",grid:{stroke:"rgba(139,148,158,0.12)"},ticks:{stroke:"rgba(139,148,158,0.2)"}}]},B=new Ln(P,[[],...c.map(()=>[])],k);x.current=B;const V=new ResizeObserver(()=>{B.setSize({width:k.clientWidth,height:k.clientHeight})});return V.observe(k),()=>{V.disconnect(),B.destroy(),x.current=null}},[p,u.length]),j.useEffect(()=>{if(!c.length)return;c.forEach(D1);let k=!1;return H1(c,1200).then(b=>{if(!k)for(const[W,P]of Object.entries(b))Om(W,P)}),()=>{k=!0,c.forEach(T1)}},[p]),j.useEffect(()=>{let k=0;const b=()=>{const W=x.current;if(W&&c.length){let P=0;for(const V of c){const ee=Lm(V);ee.t.length&&(P=Math.max(P,ee.t[ee.t.length-1]))}z.current=P;const B=G1(c,P-d);W.setData(B,!1),W.setScale("x",{min:P-d,max:P})}k=requestAnimationFrame(b)};return k=requestAnimationFrame(b),()=>cancelAnimationFrame(k)},[p,d]);const R=j.useMemo(()=>new Map(u.map(k=>[k.id,k])),[u]);return U.jsxs("div",{className:"panel plot-panel",ref:m,children:[U.jsxs("div",{className:"plot-toolbar",children:[U.jsx("span",{className:"muted",children:"window"}),U.jsx("select",{value:d,onChange:k=>i(l,{duration:Number(k.target.value)}),children:[5,10,20,30,60].map(k=>U.jsxs("option",{value:k,children:[k,"s"]},k))}),U.jsx("div",{className:"legend",children:c.map(k=>{const b=R.get(k),W=b?vg(b):{stroke:"#555"};return U.jsxs("span",{className:"legend-chip",children:[U.jsx("span",{className:"legend-swatch",style:{background:W.stroke,opacity:V1(k)?.9:1}}),Af(k),U.jsx("button",{className:"legend-x",onClick:()=>r(l,k),children:"×"})]},k)})})]}),U.jsx("div",{className:"plot-host"+(w?" drop-over":""),ref:v,children:c.length===0&&U.jsx("div",{className:"drop-hint",children:"Drag signals here to plot — drop cmd onto fb to overlay"})})]})}const vf=[["pos","cmd p"],["vel","cmd v"],["kp","kp"],["kd","kd"],["torque","cmd τ"]],yf=[["pos","act p"],["vel","act v"],["torque","act τ"],["t_mos","Tmos"],["t_rotor","Trot"]];function K1(){const l=gn(t=>t.motors);return U.jsx("div",{className:"panel table-panel",children:U.jsxs("table",{className:"motor-table",children:[U.jsx("thead",{children:U.jsxs("tr",{children:[U.jsx("th",{children:"Motor"}),U.jsx("th",{children:"Mode"}),U.jsx("th",{children:"Status"}),vf.map(([t,r])=>U.jsx("th",{className:"cmd-col",children:r},"c"+t)),yf.map(([t,r])=>U.jsx("th",{children:r},"f"+t))]})}),U.jsxs("tbody",{children:[l.length===0&&U.jsx("tr",{children:U.jsx("td",{colSpan:3+vf.length+yf.length,className:"muted center",children:"Waiting for traffic…"})}),l.map(t=>U.jsxs("tr",{children:[U.jsxs("td",{className:"mono",children:["m",t.motorId]}),U.jsx("td",{className:"muted",children:t.mode||"—"}),U.jsx("td",{children:U.jsx("span",{className:"status-pill "+(t.status==="ENABLED"?"ok":t.status==="DISABLED"?"off":"warn"),children:t.status||"—"})}),vf.map(([r])=>U.jsx("td",{className:"mono cmd-col",children:Rl(t.cmd[r],r==="kp"?0:3)},"c"+r)),yf.map(([r])=>U.jsx("td",{className:"mono",children:Rl(t.fb[r],r.startsWith("t_")?1:3)},"f"+r))]},`${t.bus}:${t.motorId}`))]})]})})}function wf({label:l,cmd:t,act:r,unit:i,digits:o=2}){return U.jsxs("div",{className:"metric",children:[U.jsxs("div",{className:"metric-label",children:[l," ",U.jsx("span",{className:"muted",children:i})]}),U.jsxs("div",{className:"metric-values",children:[U.jsx("span",{className:"metric-act",children:Rl(r,o)}),t!==void 0&&U.jsxs("span",{className:"metric-cmd",children:["⌖ ",Rl(t,o)]})]})]})}function Q1(){const l=gn(r=>r.motors),t=gn(r=>r.motorTypes);return U.jsxs("div",{className:"panel cards-panel",children:[l.length===0&&U.jsx("div",{className:"muted center pad",children:"Waiting for traffic…"}),U.jsx("div",{className:"cards-grid",children:l.map(r=>U.jsxs("div",{className:"motor-card",children:[U.jsxs("div",{className:"motor-card-head",children:[U.jsxs("span",{className:"mono strong",children:["Motor ",r.motorId]}),U.jsx("span",{className:"status-pill "+(r.status==="ENABLED"?"ok":r.status==="DISABLED"?"off":"warn"),children:r.status||"—"})]}),U.jsxs("div",{className:"motor-card-sub",children:[U.jsx("span",{className:"muted",children:r.mode||"—"}),t.length>0&&U.jsxs("select",{className:"type-select",defaultValue:"",onChange:i=>i.target.value&&j1(r.motorId,i.target.value),title:"Override motor type used to scale this motor's values",children:[U.jsx("option",{value:"",children:"set type…"}),t.map(i=>U.jsx("option",{value:i,children:i},i))]})]}),U.jsx(wf,{label:"Position",unit:"rad",cmd:r.cmd.pos,act:r.fb.pos,digits:3}),U.jsx(wf,{label:"Velocity",unit:"rad/s",cmd:r.cmd.vel,act:r.fb.vel,digits:2}),U.jsx(wf,{label:"Torque",unit:"Nm",cmd:r.cmd.torque,act:r.fb.torque,digits:2}),U.jsxs("div",{className:"temp-row",children:[U.jsxs("span",{children:["MOS ",Rl(r.fb.t_mos,1),"°"]}),U.jsxs("span",{children:["Rotor ",Rl(r.fb.t_rotor,1),"°"]})]})]},`${r.bus}:${r.motorId}`))})]})}function X1(l,t,r){const i=new Array(l);return new Proxy(i,{get(o,u,c){if(typeof u=="string"){const d=u.charCodeAt(0);if(d>=48&&d<=57){const p=+u;if(Number.isInteger(p)&&p>=0&&pi[w]!==m))&&(i=d,o=t(...d),r!=null&&r.onChange&&!(u&&r.skipInitialOnChange)&&r.onChange(o),u=!1),o}return c.updateDeps=d=>{i=d},c}function Sg(l,t){if(l===void 0)throw new Error("Unexpected undefined");return l}const q1=(l,t)=>Math.abs(l-t)<1.01,J1=(l,t,r)=>{let i;return function(...o){l.clearTimeout(i),i=l.setTimeout(()=>t.apply(this,o),r)}};let mo;const Sf=()=>{if(mo!==void 0)return mo;if(typeof navigator>"u")return mo=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return mo=!0;const l=navigator.maxTouchPoints;return mo=navigator.platform==="MacIntel"&&l!==void 0&&l>0},xg=l=>{const{offsetWidth:t,offsetHeight:r}=l;return{width:t,height:r}},Z1=l=>l,eS=l=>{const t=Math.max(l.startIndex-l.overscan,0),i=Math.min(l.endIndex+l.overscan,l.count-1)-t+1,o=new Array(i);for(let u=0;u{const r=l.scrollElement;if(!r)return;const i=l.targetWindow;if(!i)return;const o=c=>{const{width:d,height:p}=c;t({width:Math.round(d),height:Math.round(p)})};if(o(xg(r)),!i.ResizeObserver)return()=>{};const u=new i.ResizeObserver(c=>{const d=()=>{const p=c[0];if(p!=null&&p.borderBoxSize){const m=p.borderBoxSize[0];if(m){o({width:m.inlineSize,height:m.blockSize});return}}o(xg(r))};l.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(d):d()});return u.observe(r,{box:"border-box"}),()=>{u.unobserve(r)}},du={passive:!0},nS=typeof window>"u"?!0:"onscrollend"in window,rS=(l,t,r)=>{const i=l.scrollElement;if(!i)return;const o=l.targetWindow;if(!o)return;const u=l.options.useScrollendEvent&&nS;let c=0;const d=u?null:J1(o,()=>t(c,!1),l.options.isScrollingResetDelay),p=v=>()=>{c=r(i),d==null||d(),t(c,v)},m=p(!0),w=p(!1);return i.addEventListener("scroll",m,du),u&&i.addEventListener("scrollend",w,du),()=>{i.removeEventListener("scroll",m),u&&i.removeEventListener("scrollend",w)}},iS=(l,t)=>rS(l,t,r=>{const{horizontal:i,isRtl:o}=l.options;return i?r.scrollLeft*(o&&-1||1):r.scrollTop}),sS=(l,t,r)=>{if(r.options.useCachedMeasurements){const i=r.indexFromElement(l),o=r.options.getItemKey(i);return r.itemSizeCache.get(o)??r.options.estimateSize(i)}if(t!=null&&t.borderBoxSize){const i=t.borderBoxSize[0];if(i)return Math.round(i[r.options.horizontal?"inlineSize":"blockSize"])}if(!t){const i=r.indexFromElement(l),o=r.options.getItemKey(i),u=r.itemSizeCache.get(o);if(u!==void 0)return u}return l[r.options.horizontal?"offsetWidth":"offsetHeight"]},lS=(l,{adjustments:t=0,behavior:r},i)=>{var o,u;(u=(o=i.scrollElement)==null?void 0:o.scrollTo)==null||u.call(o,{[i.options.horizontal?"left":"top"]:l+t,behavior:r})},oS=lS;class aS{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var r,i,o;return((o=(i=(r=this.targetWindow)==null?void 0:r.performance)==null?void 0:i.now)==null?void 0:o.call(i))??Date.now()},this.observer=(()=>{let r=null;const i=()=>r||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:r=new this.targetWindow.ResizeObserver(o=>{o.forEach(u=>{const c=()=>{const d=u.target,p=this.indexFromElement(d);if(!d.isConnected){this.observer.unobserve(d);for(const[m,w]of this.elementsCache)if(w===d){this.elementsCache.delete(m);break}return}this.shouldMeasureDuringScroll(p)&&this.resizeItem(p,this.options.measureElement(d,u,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(c):c()})}));return{disconnect:()=>{var o;(o=i())==null||o.disconnect(),r=null},observe:o=>{var u;return(u=i())==null?void 0:u.observe(o,{box:"border-box"})},unobserve:o=>{var u;return(u=i())==null?void 0:u.unobserve(o)}}})(),this.range=null,this.setOptions=r=>{var i,o;const u={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Z1,rangeExtractor:eS,onChange:()=>{},measureElement:sS,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const x in r){const z=r[x];z!==void 0&&(u[x]=z)}const c=this.options;let d=null,p=null,m=!1;if(c!==void 0&&c.enabled&&u.enabled&&u.anchorTo==="end"&&this.scrollElement!==null){const x=c.count,z=u.count,R=this.getMeasurements(),k=x>0?((i=R[0])==null?void 0:i.key)??c.getItemKey(0):null,b=x>0?((o=R[x-1])==null?void 0:o.key)??c.getItemKey(x-1):null;if(z!==x||x>0&&z>0&&(u.getItemKey(0)!==k||u.getItemKey(z-1)!==b)){m=!0;const B=x>0?this.getVirtualItemForOffset(this.getScrollOffset())??R[0]:null;B&&(d=[B.key,this.getScrollOffset()-B.start]);const V=u.followOnAppend===!0?"auto":u.followOnAppend||null;V&&z>x&&this.isAtEnd(c.scrollEndThreshold)&&(x===0||u.getItemKey(z-1)!==b)&&(p=V)}}this.options=u,m&&(this.pendingMin=0,this.itemSizeCacheVersion++);let w=!1,v=0;if(d&&this.scrollOffset!==null){const[x,z]=d,R=this.getMeasurements(),{count:k,getItemKey:b}=this.options;let W=0;for(;W{var i,o;(o=(i=this.options).onChange)==null||o.call(i,this,r)},this.maybeNotify=ml(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),r=>{this.notify(r)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(r=>r()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var r;const i=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==i){if(this.cleanup(),!i){this.maybeNotify();return}if(this.scrollElement=i,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((r=this.scrollElement)==null?void 0:r.window)??null,this.elementsCache.forEach(u=>{this.observer.observe(u)}),this.unsubs.push(this.options.observeElementRect(this,u=>{this.scrollRect=u,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(u,c)=>{this._intendedScrollOffset!==null&&Math.abs(u-this._intendedScrollOffset)<1.5&&(u=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=c?this.getScrollOffset(){this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},d=()=>{this._iosTouching=!1,!(!Sf()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};u.addEventListener("touchstart",c,du),u.addEventListener("touchend",d,du),this.unsubs.push(()=>{u.removeEventListener("touchstart",c),u.removeEventListener("touchend",d),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const o=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,o&&this.scrollElement&&this.options.enabled){const[u,c,d,p]=o;u!==null&&!d&&(Sf()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?p!==0&&(this._iosDeferredAdjustment+=p):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),d&&this.scrollToEnd({behavior:d})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const r=this.getScrollOffset(),i=this.getMaxScrollOffset();if(r<0||r>i)return;const o=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(r,{adjustments:this.scrollAdjustments+=o,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(r,i)=>{const o=new Map,u=new Map;for(let c=i-1;c>=0;c--){const d=r[c];if(o.has(d.lane))continue;const p=u.get(d.lane);if(p==null||d.end>p.end?u.set(d.lane,d):d.endc.end===d.end?c.index-d.index:c.end-d.end)[0]:void 0},this.getMeasurementOptions=ml(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(r,i,o,u,c,d,p)=>(this.prevLanes!==void 0&&this.prevLanes!==d&&(this.lanesChangedFlag=!0),this.prevLanes=d,this.pendingMin=null,{count:r,paddingStart:i,scrollMargin:o,getItemKey:u,enabled:c,lanes:d,laneAssignmentMode:p}),{key:!1}),this.getMeasurements=ml(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:r,paddingStart:i,scrollMargin:o,getItemKey:u,enabled:c,lanes:d,laneAssignmentMode:p},m)=>{const w=this.itemSizeCache;if(!c)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>r)for(const R of this.laneAssignments.keys())R>=r&&this.laneAssignments.delete(R);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(R=>{this.itemSizeCache.set(R.key,R.size)}));const v=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===r&&(this.lanesSettling=!1),d===1){const R=this.options.gap,k=r*2;let b=this._flatMeasurements;if(!b||b.length0&&B.set(b.subarray(0,v*2)),b=B,this._flatMeasurements=b}let W;if(v===0)W=i+o;else{const B=v-1;W=b[B*2]+b[B*2+1]+R}for(let B=v;B1){W=b;const Z=z[W],re=Z!==void 0?x[Z]:void 0;P=re?re.end+this.options.gap:i+o}else{const Z=this.options.lanes===1?x[R-1]:this.getFurthestMeasurement(x,R);P=Z?Z.end+this.options.gap:i+o,W=Z?Z.lane:R%this.options.lanes,this.options.lanes>1&&B&&this.laneAssignments.set(R,W)}const V=w.get(k),ee=typeof V=="number"?V:this.options.estimateSize(R),G=P+ee;x[R]={index:R,start:P,size:ee,end:G,key:k,lane:W},z[W]=R}return this.measurementsCache=x,x},{key:!1,debug:()=>this.options.debug}),this.calculateRange=ml(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(r,i,o,u)=>this.range=r.length>0&&i>0?uS({measurements:r,outerSize:i,scrollOffset:o,lanes:u,flat:u===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=ml(()=>{let r=null,i=null;const o=this.calculateRange();return o&&(r=o.startIndex,i=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,r,i]),[this.options.rangeExtractor,this.options.overscan,this.options.count,r,i]},(r,i,o,u,c)=>u===null||c===null?[]:r({startIndex:u,endIndex:c,overscan:i,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=r=>{const i=this.options.indexAttribute,o=r.getAttribute(i);return o?parseInt(o,10):(console.warn(`Missing attribute name '${i}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=r=>{var i;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const o=this.scrollState.index??((i=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:i.index);if(o!==void 0&&this.range){const u=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),c=Math.max(0,o-u),d=Math.min(this.options.count-1,o+u);return r>=c&&r<=d}return!0},this.measureElement=r=>{if(!r){this.elementsCache.forEach((c,d)=>{c.isConnected||(this.observer.unobserve(c),this.elementsCache.delete(d))});return}const i=this.indexFromElement(r),o=this.options.getItemKey(i),u=this.elementsCache.get(o);u!==r&&(u&&this.observer.unobserve(u),this.observer.observe(r),this.elementsCache.set(o,r)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(i)&&this.resizeItem(i,this.options.measureElement(r,void 0,this))},this.resizeItem=(r,i)=>{var o,u;if(r<0||r>=this.options.count)return;let c,d,p;const m=this._flatMeasurements;if(this.options.lanes===1&&m!==null)p=this.options.getItemKey(r),d=m[r*2],c=m[r*2+1];else{const x=this.measurementsCache[r];if(!x)return;p=x.key,d=x.start,c=x.size}const w=this.itemSizeCache.get(p)??c,v=i-w;if(v!==0){const x=this.options.anchorTo==="end"&&((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,z=x?this.getTotalSize():0,R=((u=this.scrollState)==null?void 0:u.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[r]??{index:r,key:p,start:d,size:c,end:d+c,lane:0},v,this):d[this.getVirtualIndexes(),this.getMeasurements()],(r,i)=>{const o=[];for(let u=0,c=r.length;uthis.options.debug}),this.getVirtualItemForOffset=r=>{const i=this.getMeasurements();if(i.length===0)return;const o=this._flatMeasurements,u=this.options.lanes===1&&o!=null,c=Hm(0,i.length-1,u?d=>o[d*2]:d=>Sg(i[d]).start,r);return Sg(i[c])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const r=this.scrollElement.document.documentElement;return this.options.horizontal?r.scrollWidth-this.scrollElement.innerWidth:r.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(r=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=r,this.getOffsetForAlignment=(r,i,o=0)=>{if(!this.scrollElement)return 0;const u=this.getSize(),c=this.getScrollOffset();i==="auto"&&(i=r>=c+u?"end":"start"),i==="center"?r+=(o-u)/2:i==="end"&&(r-=u);const d=this.getMaxScrollOffset();return Math.max(Math.min(d,r),0)},this.getOffsetForIndex=(r,i="auto")=>{r=Math.max(0,Math.min(r,this.options.count-1));const o=this.getSize(),u=this.getScrollOffset(),c=this.measurementsCache[r];if(!c)return;if(i==="auto")if(c.end>=u+o-this.options.scrollPaddingEnd)i="end";else if(c.start<=u+this.options.scrollPaddingStart)i="start";else return[u,i];if(i==="end"&&r===this.options.count-1)return[this.getMaxScrollOffset(),i];const d=i==="end"?c.end+this.options.scrollPaddingEnd:c.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(d,i,c.size),i]},this.scrollToOffset=(r,{align:i="start",behavior:o="auto"}={})=>{const u=this.getOffsetForAlignment(r,i),c=this.now();this.scrollState={index:null,align:i,behavior:o,startedAt:c,lastTargetOffset:u,stableFrames:0},this._scrollToOffset(u,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(r,{align:i="auto",behavior:o="auto"}={})=>{r=Math.max(0,Math.min(r,this.options.count-1));const u=this.getOffsetForIndex(r,i);if(!u)return;const[c,d]=u,p=this.now();this.scrollState={index:r,align:d,behavior:o,startedAt:p,lastTargetOffset:c,stableFrames:0},this._scrollToOffset(c,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(r,{behavior:i="auto"}={})=>{const o=this.getScrollOffset()+r,u=this.now();this.scrollState={index:null,align:"start",behavior:i,startedAt:u,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:r="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:r});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:r})},this.getTotalSize=()=>{var r;const i=this.getMeasurements();let o;if(i.length===0)o=this.options.paddingStart;else if(this.options.lanes===1){const u=i.length-1,c=this._flatMeasurements;c!=null?o=c[u*2]+c[u*2+1]:o=((r=i[u])==null?void 0:r.end)??0}else{const u=Array(this.options.lanes).fill(null);let c=i.length-1;for(;c>=0&&u.some(d=>d===null);){const d=i[c];u[d.lane]===null&&(u[d.lane]=d.end),c--}o=Math.max(...u.filter(d=>d!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const r=[];if(this.itemSizeCache.size===0)return r;const i=this.getMeasurements();for(const o of i)o&&this.itemSizeCache.has(o.key)&&r.push({index:o.index,key:o.key,start:o.start,size:o.size,end:o.end,lane:o.lane});return r},this._scrollToOffset=(r,{adjustments:i,behavior:o})=>{this._intendedScrollOffset=r+(i??0),this.options.scrollToFn(r,{behavior:o,adjustments:i},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}applyScrollAdjustment(t,r){t!==0&&(Sf()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=t:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:r}))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const i=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,o=i?i[0]:this.scrollState.lastTargetOffset,u=1,c=o!==this.scrollState.lastTargetOffset;if(!c&&q1(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=u){this.getScrollOffset()!==o&&this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,c){const d=this.getSize()||600,p=Math.abs(o-this.getScrollOffset()),m=this.scrollState.behavior==="smooth"&&p>d;this.scrollState.lastTargetOffset=o,m||(this.scrollState.behavior="auto"),this._scrollToOffset(o,{adjustments:void 0,behavior:m?"smooth":"auto"})}this.scheduleScrollReconcile()}}const Hm=(l,t,r,i)=>{for(;l<=t;){const o=(l+t)/2|0,u=r(o);if(ui)t=o-1;else return o}return l>0?l-1:0};function uS({measurements:l,outerSize:t,scrollOffset:r,lanes:i,flat:o}){const u=l.length-1,c=o?w=>o[w*2]:w=>l[w].start,d=o?w=>o[w*2]+o[w*2+1]:w=>l[w].end;if(l.length<=i)return{startIndex:0,endIndex:u};let p=Hm(0,u,c,r),m=p;if(i===1)for(;m1){const w=Array(i).fill(0);for(;mx=0&&v.some(x=>x>=r);){const x=l[p];v[x.lane]=x.start,p--}p=Math.max(0,p-p%i),m=Math.min(u,m+(i-1-m%i))}return{startIndex:p,endIndex:m}}const xf=typeof document<"u"?j.useLayoutEffect:j.useEffect;function cS({useFlushSync:l=!0,directDomUpdates:t=!1,directDomUpdatesMode:r="transform",...i}){const o=j.useReducer(m=>m+1,0)[1],u=j.useRef({enabled:t,mode:r,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});u.current.enabled=t,u.current.mode=r;const c=m=>{const w=u.current;if(!w.enabled||!w.container)return;const v=m.getTotalSize();if(v!==w.lastSize){w.lastSize=v;const W=m.options.horizontal?"width":"height";w.container.style[W]=`${v}px`}const x=!!m.options.horizontal,z=w.mode==="transform",R=x?"left":"top",k=m.options.scrollMargin,b=m.getVirtualItems();for(const W of b){const P=W.start-k,B=m.elementsCache.get(W.key);B&&w.lastPositions.get(B)!==P&&(w.lastPositions.set(B,P),z?B.style.transform=x?`translate3d(${P}px, 0, 0)`:`translate3d(0, ${P}px, 0)`:B.style[R]=`${P}px`)}},d={...i,onChange:(m,w)=>{var v;const x=u.current;let z=!0;if(x.enabled){c(m);const R=m.range,k=x.prevRange;z=!k||k.isScrolling!==m.isScrolling||k.startIndex!==(R==null?void 0:R.startIndex)||k.endIndex!==(R==null?void 0:R.endIndex),z&&(x.prevRange=R?{startIndex:R.startIndex,endIndex:R.endIndex,isScrolling:m.isScrolling}:null)}z&&(l&&w?bs.flushSync(o):o()),(v=i.onChange)==null||v.call(i,m,w)}},[p]=j.useState(()=>{const m=new aS(d);return Object.assign(m,{containerRef:w=>{const v=u.current;if(v.container=w,v.lastSize=null,w&&v.enabled){const x=m.getTotalSize();v.lastSize=x;const z=m.options.horizontal?"width":"height";w.style[z]=`${x}px`}}})});return p.setOptions(d),xf(()=>p._didMount(),[]),xf(()=>p._willUpdate()),xf(()=>{c(p)}),p}function fS(l){return cS({observeElementRect:tS,observeElementOffset:iS,scrollToFn:oS,...l})}const dS={pos:"p",vel:"v",torque:"τ",kp:"kp",kd:"kd",vel_limit:"vlim",torque_limit:"τlim",t_mos:"Tm",t_rotor:"Tr"},hS=["pos","vel","torque","kp","kd","t_mos","t_rotor"];function pS(l){const t=[];for(const r of hS)r in l.fields&&t.push(`${dS[r]||r} ${l.fields[r].toFixed(2)}`);return t.join(" ")||l.note||""}function gS(l){const t=new Date(l*1e3),r=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0"),o=String(t.getSeconds()).padStart(2,"0"),u=String(Math.floor(l%1*1e3)).padStart(3,"0");return`${r}:${i}:${o}.${u}`}function mS(){const[,l]=j.useState(0),[t,r]=j.useState(!1),i=j.useRef(null),o=j.useRef([]);j.useEffect(()=>{pg(!0);const d=L1(()=>{t||(o.current=O1(),l(p=>p+1))});return()=>{pg(!1),d()}},[t]);const u=o.current,c=fS({count:u.length,getScrollElement:()=>i.current,estimateSize:()=>22,overscan:12});return j.useEffect(()=>{!t&&u.length&&c.scrollToIndex(u.length-1)},[u.length,t,c]),U.jsxs("div",{className:"panel rawlog-panel",children:[U.jsxs("div",{className:"rawlog-toolbar",children:[U.jsx("button",{className:t?"btn small":"btn small active",onClick:()=>r(d=>!d),children:t?"Resume":"Pause"}),U.jsxs("span",{className:"muted",children:[u.length," frames"]})]}),U.jsxs("div",{className:"rawlog-body",ref:i,children:[U.jsxs("div",{className:"rawlog-head",children:[U.jsx("span",{className:"c-t",children:"time"}),U.jsx("span",{className:"c-arb",children:"arb"}),U.jsx("span",{className:"c-m",children:"motor"}),U.jsx("span",{className:"c-k",children:"kind"}),U.jsx("span",{className:"c-f",children:"decoded"}),U.jsx("span",{className:"c-r",children:"raw"})]}),U.jsx("div",{style:{height:c.getTotalSize(),position:"relative"},children:c.getVirtualItems().map(d=>{const p=u[d.index];return U.jsxs("div",{className:"rawlog-row k-"+p.kind,style:{transform:`translateY(${d.start}px)`},children:[U.jsx("span",{className:"c-t mono",children:gS(p.t)}),U.jsxs("span",{className:"c-arb mono",children:["0x",p.arb.toString(16).toUpperCase()]}),U.jsxs("span",{className:"c-m mono",children:["m",p.motorId]}),U.jsx("span",{className:"c-k",children:p.mode||p.kind}),U.jsx("span",{className:"c-f mono",children:pS(p)}),U.jsx("span",{className:"c-r mono dim",children:p.raw})]},p.seq)})})]})]})}const Fm=[{kind:"plot",title:"Plot",icon:"〜",description:"Time-series chart; drag signals onto it (cmd over fb to overlay).",render:l=>U.jsx(Y1,{panelId:l})},{kind:"table",title:"Motor Table",icon:"▦",description:"One row per motor: commanded vs actual.",render:()=>U.jsx(K1,{})},{kind:"cards",title:"Motor Cards",icon:"▢",description:"Per-motor cards/gauges with big readouts.",render:()=>U.jsx(Q1,{})},{kind:"rawlog",title:"Raw CAN Log",icon:"≣",description:"Scrolling decoded frame log.",render:()=>U.jsx(mS,{})}],vS=Object.fromEntries(Fm.map(l=>[l.kind,l])),jm="damiao.monitor.theme";function Wm(){return localStorage.getItem(jm)==="dark"?"dark":"light"}function Bm(l){document.documentElement.setAttribute("data-theme",l)}function yS(l){try{localStorage.setItem(jm,l)}catch{}Bm(l)}function wS(){Bm(Wm())}function SS(){const l=gn(p=>p.connected),t=gn(p=>p.status),r=Eo(p=>p.addWidget),i=Eo(p=>p.resetWidgets),[o,u]=j.useState(Wm()),c=()=>i(),d=()=>{const p=o==="light"?"dark":"light";yS(p),u(p)};return U.jsxs("header",{className:"toolbar",children:[U.jsxs("div",{className:"brand",children:[U.jsx("span",{className:"brand-dot"}),"DaMiao ",U.jsx("span",{className:"brand-sub",children:"Passive Monitor"})]}),U.jsxs("div",{className:"conn",children:[U.jsx("span",{className:"dot "+(l?"on":"off")}),U.jsx("span",{className:"mono",children:t!=null&&t.demo?"demo":(t==null?void 0:t.channel)||"—"}),t&&!t.demo&&U.jsx("span",{className:"badge "+(t.listenOnly?"ok":"warn"),title:"hardware listen-only",children:t.listenOnly?"listen-only":"rx (no TX)"}),(t==null?void 0:t.error)&&U.jsx("span",{className:"badge err",title:t.error,children:"bus error"}),t&&U.jsxs("span",{className:"muted small",children:[t.framesSeen.toLocaleString()," frames · +",t.feedbackOffset," fb"]})]}),U.jsx("div",{className:"spacer"}),U.jsxs("div",{className:"actions",children:[Fm.map(p=>U.jsxs("button",{className:"btn",title:p.description,onClick:()=>r(p.kind),children:[U.jsx("span",{className:"btn-icon",children:p.icon})," ",p.title]},p.kind)),U.jsx("button",{className:"btn ghost",onClick:d,title:`Switch to ${o==="light"?"dark":"light"} mode`,children:o==="light"?"☾":"☀"}),U.jsx("button",{className:"btn ghost",onClick:c,children:"Reset"})]})]})}function xS({sig:l}){const{attributes:t,listeners:r,setNodeRef:i,isDragging:o}=l0({id:`sig:${l.id}`,data:{signalId:l.id}}),u=B1(l);return U.jsxs("div",{ref:i,className:"sig-chip"+(o?" dragging":""),...r,...t,title:l.id,children:[U.jsx("span",{className:"sig-swatch",style:{background:u,borderStyle:l.source==="cmd"?"dashed":"solid"}}),U.jsxs("span",{className:"sig-name",children:[l.source,".",l.field]}),l.unit&&U.jsx("span",{className:"sig-unit",children:l.unit})]})}function _S(l){return[...l].sort((t,r)=>{if(t.source!==r.source)return t.source==="cmd"?-1:1;const i=yg.indexOf(t.field),o=yg.indexOf(r.field);return(i<0?99:i)-(o<0?99:o)})}function ES(){const l=gn(u=>u.signals),t=gn(u=>u.status),[r,i]=j.useState(""),o=j.useMemo(()=>{const u=new Map;for(const c of l){if(r&&!c.id.toLowerCase().includes(r.toLowerCase()))continue;const d=u.get(c.motorId)||[];d.push(c),u.set(c.motorId,d)}return Array.from(u.entries()).sort((c,d)=>c[0]-d[0])},[l,r]);return U.jsxs("aside",{className:"sidebar",children:[U.jsxs("div",{className:"sidebar-head",children:[U.jsx("div",{className:"sidebar-title",children:"Signals"}),U.jsx("input",{className:"filter",placeholder:"filter…",value:r,onChange:u=>i(u.target.value)})]}),U.jsxs("div",{className:"sidebar-body",children:[o.length===0&&U.jsx("div",{className:"muted pad",children:t!=null&&t.error?"Bus error — see top bar.":"No signals yet. Start a controller on the bus (or run --demo)."}),o.map(([u,c])=>U.jsxs("div",{className:"motor-group",children:[U.jsxs("div",{className:"motor-group-title",children:["Motor ",u]}),U.jsx("div",{className:"chips",children:_S(c).map(d=>U.jsx(xS,{sig:d},d.id))})]},u))]}),U.jsxs("div",{className:"sidebar-foot muted",children:["Drag a signal onto a plot. Drop ",U.jsx("b",{children:"cmd"})," onto its ",U.jsx("b",{children:"fb"})," plot to overlay."]})]})}function CS(l,t,r,i,o){const u=(...c)=>(console.warn("gridstack.js: Function `"+r+"` is deprecated in "+o+" and has been replaced with `"+i+"`. It will be **removed** in a future release"),t.apply(l,c));return u.prototype=t.prototype,u}class A{static getElements(t,r=document){if(typeof t=="string"){const i="getElementById"in r?r:void 0;if(i&&!isNaN(+t[0])){const u=i.getElementById(t);return u?[u]:[]}let o=r.querySelectorAll(t);return!o.length&&t[0]!=="."&&t[0]!=="#"&&(o=r.querySelectorAll("."+t),o.length||(o=r.querySelectorAll("#"+t))),Array.from(o)}return[t]}static getElement(t,r=document){if(typeof t=="string"){const i="getElementById"in r?r:void 0;if(!t.length)return null;if(i&&t[0]==="#")return i.getElementById(t.substring(1));if(t[0]==="#"||t[0]==="."||t[0]==="[")return r.querySelector(t);if(i&&!isNaN(+t[0]))return i.getElementById(t);let o=r.querySelector(t);return i&&!o&&(o=i.getElementById(t)),o||(o=r.querySelector("."+t)),o}return t}static lazyLoad(t){var r,i;return t.lazyLoad||((i=(r=t.grid)==null?void 0:r.opts)==null?void 0:i.lazyLoad)&&t.lazyLoad!==!1}static createDiv(t,r){const i=document.createElement("div");return t.forEach(o=>{o&&i.classList.add(o)}),r==null||r.appendChild(i),i}static shouldSizeToContent(t,r=!1){return(t==null?void 0:t.grid)&&(r?t.sizeToContent===!0||t.grid.opts.sizeToContent===!0&&t.sizeToContent===void 0:!!t.sizeToContent||t.grid.opts.sizeToContent&&t.sizeToContent!==!1)}static isIntercepted(t,r){return!(t.y>=r.y+r.h||t.y+t.h<=r.y||t.x+t.w<=r.x||t.x>=r.x+r.w)}static isTouching(t,r){return A.isIntercepted(t,{x:r.x-.5,y:r.y-.5,w:r.w+1,h:r.h+1})}static areaIntercept(t,r){const i=t.x>r.x?t.x:r.x,o=t.x+t.wr.y?t.y:r.y,c=t.y+t.h{const c=r*((o.y??1e4)-(u.y??1e4));return c===0?r*((o.x??1e4)-(u.x??1e4)):c})}static find(t,r){return r?t.find(i=>i.id===r):void 0}static createStylesheet(t,r,i){const o=document.createElement("style"),u=i==null?void 0:i.nonce;return u&&(o.nonce=u),o.setAttribute("type","text/css"),o.setAttribute("gs-style-id",t),o.styleSheet?o.styleSheet.cssText="":o.appendChild(document.createTextNode("")),r?r.insertBefore(o,r.firstChild):(r=document.getElementsByTagName("head")[0],r.appendChild(o)),o}static removeStylesheet(t,r){const o=(r||document).querySelector("STYLE[gs-style-id="+t+"]");o&&o.parentNode&&o.remove()}static addCSSRule(t,r,i){t.textContent+=`${r} { ${i} } `}static toBool(t){return typeof t=="boolean"?t:typeof t=="string"?(t=t.toLowerCase(),!(t===""||t==="no"||t==="false"||t==="0")):!!t}static toNumber(t){return t===null||t.length===0?void 0:Number(t)}static parseHeight(t){let r,i="px";if(typeof t=="string")if(t==="auto"||t==="")r=0;else{const o=t.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!o)throw new Error(`Invalid height val = ${t}`);i=o[2]||"px",r=parseFloat(o[1])}else r=t;return{h:r,unit:i}}static defaults(t,...r){return r.forEach(i=>{for(const o in i){if(!i.hasOwnProperty(o))return;t[o]===null||t[o]===void 0?t[o]=i[o]:typeof i[o]=="object"&&typeof t[o]=="object"&&this.defaults(t[o],i[o])}}),t}static same(t,r){if(typeof t!="object")return t==r;if(typeof t!=typeof r||Object.keys(t).length!==Object.keys(r).length)return!1;for(const i in t)if(t[i]!==r[i])return!1;return!0}static copyPos(t,r,i=!1){return r.x!==void 0&&(t.x=r.x),r.y!==void 0&&(t.y=r.y),r.w!==void 0&&(t.w=r.w),r.h!==void 0&&(t.h=r.h),i&&(r.minW&&(t.minW=r.minW),r.minH&&(t.minH=r.minH),r.maxW&&(t.maxW=r.maxW),r.maxH&&(t.maxH=r.maxH)),t}static samePos(t,r){return t&&r&&t.x===r.x&&t.y===r.y&&(t.w||1)===(r.w||1)&&(t.h||1)===(r.h||1)}static sanitizeMinMax(t){t.minW||delete t.minW,t.minH||delete t.minH,t.maxW||delete t.maxW,t.maxH||delete t.maxH}static removeInternalAndSame(t,r){if(!(typeof t!="object"||typeof r!="object"))for(let i in t){const o=t[i],u=r[i];i[0]==="_"||o===u?delete t[i]:o&&typeof o=="object"&&u!==void 0&&(A.removeInternalAndSame(o,u),Object.keys(o).length||delete t[i])}}static removeInternalForSave(t,r=!0){for(let i in t)(i[0]==="_"||t[i]===null||t[i]===void 0)&&delete t[i];delete t.grid,r&&delete t.el,t.autoPosition||delete t.autoPosition,t.noResize||delete t.noResize,t.noMove||delete t.noMove,t.locked||delete t.locked,(t.w===1||t.w===t.minW)&&delete t.w,(t.h===1||t.h===t.minH)&&delete t.h}static throttle(t,r){let i=!1;return(...o)=>{i||(i=!0,setTimeout(()=>{t(...o),i=!1},r))}}static removePositioningStyles(t){const r=t.style;r.position&&r.removeProperty("position"),r.left&&r.removeProperty("left"),r.top&&r.removeProperty("top"),r.width&&r.removeProperty("width"),r.height&&r.removeProperty("height")}static getScrollElement(t){if(!t)return document.scrollingElement||document.documentElement;const r=getComputedStyle(t);return/(auto|scroll)/.test(r.overflow+r.overflowY)?t:this.getScrollElement(t.parentElement)}static updateScrollPosition(t,r,i){const o=t.getBoundingClientRect(),u=window.innerHeight||document.documentElement.clientHeight;if(o.top<0||o.bottom>u){const c=o.bottom-u,d=o.top,p=this.getScrollElement(t);if(p!==null){const m=p.scrollTop;o.top<0&&i<0?t.offsetHeight>u?p.scrollTop+=i:p.scrollTop+=Math.abs(d)>Math.abs(i)?i:d:i>0&&(t.offsetHeight>u?p.scrollTop+=i:p.scrollTop+=c>i?i:c),r.top+=p.scrollTop-m}}}static updateScrollResize(t,r,i){const o=this.getScrollElement(r),u=o.clientHeight,c=o===this.getScrollElement()?0:o.getBoundingClientRect().top,d=t.clientY-c,p=du-i;p?o.scrollBy({behavior:"smooth",top:d-i}):m&&o.scrollBy({behavior:"smooth",top:i-(u-d)})}static clone(t){return t==null||typeof t!="object"?t:t instanceof Array?[...t]:{...t}}static cloneDeep(t){const r=["parentGrid","el","grid","subGrid","engine"],i=A.clone(t);for(const o in i)i.hasOwnProperty(o)&&typeof i[o]=="object"&&o.substring(0,2)!=="__"&&!r.find(u=>u===o)&&(i[o]=A.cloneDeep(t[o]));return i}static cloneNode(t){const r=t.cloneNode(!0);return r.removeAttribute("id"),r}static appendTo(t,r){let i;typeof r=="string"?i=A.getElement(r):i=r,i&&i.appendChild(t)}static addElStyles(t,r){if(r instanceof Object)for(const i in r)r.hasOwnProperty(i)&&(Array.isArray(r[i])?r[i].forEach(o=>{t.style[i]=o}):t.style[i]=r[i])}static initEvent(t,r){const i={type:r.type},o={button:0,which:0,buttons:1,bubbles:!0,cancelable:!0,target:r.target?r.target:t.target};return["altKey","ctrlKey","metaKey","shiftKey"].forEach(u=>i[u]=t[u]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(u=>i[u]=t[u]),{...i,...o}}static simulateMouseEvent(t,r,i){const o=t,u=new MouseEvent(r,{bubbles:!0,composed:!0,cancelable:!0,view:window,detail:1,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY,ctrlKey:o.ctrlKey??!1,altKey:o.altKey??!1,shiftKey:o.shiftKey??!1,metaKey:o.metaKey??!1,button:0,relatedTarget:t.target});(i||t.target).dispatchEvent(u)}static getValuesFromTransformedElement(t){const r=document.createElement("div");A.addElStyles(r,{opacity:"0",position:"fixed",top:"0px",left:"0px",width:"1px",height:"1px",zIndex:"-999999"}),t.appendChild(r);const i=r.getBoundingClientRect();return t.removeChild(r),r.remove(),{xScale:1/i.width,yScale:1/i.height,xOffset:i.left,yOffset:i.top}}static swap(t,r,i){if(!t)return;const o=t[r];t[r]=t[i],t[i]=o}static canBeRotated(t){var r;return!(!t||t.w===t.h||t.locked||t.noResize||(r=t.grid)!=null&&r.opts.disableResize||t.minW&&t.minW===t.maxW||t.minH&&t.minH===t.maxH)}}class ai{constructor(t={}){this.addedNodes=[],this.removedNodes=[],this.defaultColumn=12,this.column=t.column||this.defaultColumn,this.column>this.defaultColumn&&(this.defaultColumn=this.column),this.maxRow=t.maxRow,this._float=t.float,this.nodes=t.nodes||[],this.onChange=t.onChange}batchUpdate(t=!0,r=!0){return!!this.batchMode===t?this:(this.batchMode=t,t?(this._prevFloat=this._float,this._float=!0,this.cleanNodes(),this.saveInitial()):(this._float=this._prevFloat,delete this._prevFloat,r&&this._packNodes(),this._notify()),this)}_useEntireRowArea(t,r){return(!this.float||this.batchMode&&!this._prevFloat)&&!this._hasLocked&&(!t._moving||t._skipDown||r.y<=t.y)}_fixCollisions(t,r=t,i,o={}){if(this.sortNodes(-1),i=i||this.collide(t,r),!i)return!1;if(t._moving&&!o.nested&&!this.float&&this.swap(t,i))return!0;let u=r;!this._loading&&this._useEntireRowArea(t,r)&&(u={x:0,w:this.column,y:r.y,h:r.h},i=this.collide(t,u,o.skip));let c=!1;const d={nested:!0,pack:!1};let p=0;for(;i=i||this.collide(t,u,o.skip);){if(p++>this.nodes.length*2)throw new Error("Infinite collide check");let m;if(i.locked||this._loading||t._moving&&!t._skipDown&&r.y>t.y&&!this.float&&(!this.collide(i,{...i,y:t.y},t)||!this.collide(i,{...i,y:r.y-i.h},t))){t._skipDown=t._skipDown||r.y>t.y;const w={...r,y:i.y+i.h,...d};m=this._loading&&A.samePos(t,w)?!0:this.moveNode(t,w),(i.locked||this._loading)&&m?A.copyPos(r,t):!i.locked&&m&&o.pack&&(this._packNodes(),r.y=i.y+i.h,A.copyPos(t,r)),c=c||m}else m=this.moveNode(i,{...i,y:r.y+r.h,skip:t,...d});if(!m)return c;i=void 0}return c}collide(t,r=t,i){const o=t._id,u=i==null?void 0:i._id;return this.nodes.find(c=>c._id!==o&&c._id!==u&&A.isIntercepted(c,r))}collideAll(t,r=t,i){const o=t._id,u=i==null?void 0:i._id;return this.nodes.filter(c=>c._id!==o&&c._id!==u&&A.isIntercepted(c,r))}directionCollideCoverage(t,r,i){if(!r.rect||!t._rect)return;const o=t._rect,u={...r.rect};u.y>o.y?(u.h+=u.y-o.y,u.y=o.y):u.h+=o.y-u.y,u.x>o.x?(u.w+=u.x-o.x,u.x=o.x):u.w+=o.x-u.x;let c,d=.5;for(let p of i){if(p.locked||!p._rect)break;const m=p._rect;let w=Number.MAX_VALUE,v=Number.MAX_VALUE;o.ym.y+m.h&&(w=(m.y+m.h-u.y)/m.h),o.xm.x+m.w&&(v=(m.x+m.w-u.x)/m.w);const x=Math.min(v,w);x>d&&(d=x,c=p)}return r.collide=c,c}cacheRects(t,r,i,o,u,c){return this.nodes.forEach(d=>d._rect={y:d.y*r+i,x:d.x*t+c,w:d.w*t-c-o,h:d.h*r-i-u}),this}swap(t,r){if(!r||r.locked||!t||t.locked)return!1;function i(){const u=r.x,c=r.y;return r.x=t.x,r.y=t.y,t.h!=r.h?(t.x=u,t.y=r.y+r.h):t.w!=r.w?(t.x=r.x+r.w,t.y=c):(t.x=u,t.y=c),t._dirty=r._dirty=!0,!0}let o;if(t.w===r.w&&t.h===r.h&&(t.x===r.x||t.y===r.y)&&(o=A.isTouching(t,r)))return i();if(o!==!1){if(t.w===r.w&&t.x===r.x&&(o||(o=A.isTouching(t,r)))){if(r.y{let m;c.locked||(c.autoPosition=!0,t==="list"&&d&&(m=p[d-1])),this.addNode(c,!1,m)}),o||delete this._inColumnResize,i||this.batchUpdate(!1),this}set float(t){this._float!==t&&(this._float=t||!1,t||this._packNodes()._notify())}get float(){return this._float||!1}sortNodes(t=1){return this.nodes=A.sort(this.nodes,t),this}_packNodes(){return this.batchMode?this:(this.sortNodes(),this.float?this.nodes.forEach(t=>{if(t._updating||t._orig===void 0||t.y===t._orig.y)return;let r=t.y;for(;r>t._orig.y;)--r,this.collide(t,{x:t.x,y:r,w:t.w,h:t.h})||(t._dirty=!0,t.y=r)}):this.nodes.forEach((t,r)=>{if(!t.locked)for(;t.y>0;){const i=r===0?0:t.y-1;if(!(r===0||!this.collide(t,{x:t.x,y:i,w:t.w,h:t.h})))break;t._dirty=t.y!==i,t.y=i}}),this)}prepareNode(t,r){t._id=t._id??ai._idSeq++;const i=t.id;if(i){let u=1;for(;this.nodes.find(c=>c.id===t.id&&c!==t);)t.id=i+"_"+u++}(t.x===void 0||t.y===void 0||t.x===null||t.y===null)&&(t.autoPosition=!0);const o={x:0,y:0,w:1,h:1};return A.defaults(t,o),t.autoPosition||delete t.autoPosition,t.noResize||delete t.noResize,t.noMove||delete t.noMove,A.sanitizeMinMax(t),typeof t.x=="string"&&(t.x=Number(t.x)),typeof t.y=="string"&&(t.y=Number(t.y)),typeof t.w=="string"&&(t.w=Number(t.w)),typeof t.h=="string"&&(t.h=Number(t.h)),isNaN(t.x)&&(t.x=o.x,t.autoPosition=!0),isNaN(t.y)&&(t.y=o.y,t.autoPosition=!0),isNaN(t.w)&&(t.w=o.w),isNaN(t.h)&&(t.h=o.h),this.nodeBoundFix(t,r),t}nodeBoundFix(t,r){const i=t._orig||A.copyPos({},t);if(t.maxW&&(t.w=Math.min(t.w||1,t.maxW)),t.maxH&&(t.h=Math.min(t.h||1,t.maxH)),t.minW&&(t.w=Math.max(t.w||1,t.minW)),t.minH&&(t.h=Math.max(t.h||1,t.minH)),(t.x||0)+(t.w||1)>this.column&&this.columnthis.column?t.w=this.column:t.w<1&&(t.w=1),this.maxRow&&t.h>this.maxRow?t.h=this.maxRow:t.h<1&&(t.h=1),t.x<0&&(t.x=0),t.y<0&&(t.y=0),t.x+t.w>this.column&&(r?t.w=this.column-t.x:t.x=this.column-t.w),this.maxRow&&t.y+t.h>this.maxRow&&(r?t.h=this.maxRow-t.y:t.y=this.maxRow-t.h),A.samePos(t,i)||(t._dirty=!0),this}getDirtyNodes(t){return t?this.nodes.filter(r=>r._dirty&&!A.samePos(r,r._orig)):this.nodes.filter(r=>r._dirty)}_notify(t){if(this.batchMode||!this.onChange)return this;const r=(t||[]).concat(this.getDirtyNodes());return this.onChange(r),this}cleanNodes(){return this.batchMode?this:(this.nodes.forEach(t=>{delete t._dirty,delete t._lastTried}),this)}saveInitial(){return this.nodes.forEach(t=>{t._orig=A.copyPos({},t),delete t._dirty}),this._hasLocked=this.nodes.some(t=>t.locked),this}restoreInitial(){return this.nodes.forEach(t=>{!t._orig||A.samePos(t,t._orig)||(A.copyPos(t,t._orig),t._dirty=!0)}),this._notify(),this}findEmptyPosition(t,r=this.nodes,i=this.column,o){const u=o?o.y*i+(o.x+o.w):0;let c=!1;for(let d=u;!c;++d){const p=d%i,m=Math.floor(d/i);if(p+t.w>i)continue;const w={x:p,y:m,w:t.w,h:t.h};r.find(v=>A.isIntercepted(w,v))||((t.x!==p||t.y!==m)&&(t._dirty=!0),t.x=p,t.y=m,delete t.autoPosition,c=!0)}return c}addNode(t,r=!1,i){const o=this.nodes.find(c=>c._id===t._id);if(o)return o;this._inColumnResize?this.nodeBoundFix(t):this.prepareNode(t),delete t._temporaryRemoved,delete t._removeDOM;let u;return t.autoPosition&&this.findEmptyPosition(t,this.nodes,this.column,i)&&(delete t.autoPosition,u=!0),this.nodes.push(t),r&&this.addedNodes.push(t),u||this._fixCollisions(t),this.batchMode||this._packNodes()._notify(),t}removeNode(t,r=!0,i=!1){return this.nodes.find(o=>o._id===t._id)?(i&&this.removedNodes.push(t),r&&(t._removeDOM=!0),this.nodes=this.nodes.filter(o=>o._id!==t._id),t._isAboutToRemove||this._packNodes(),this._notify([t]),this):this}removeAll(t=!0,r=!0){if(delete this._layouts,!this.nodes.length)return this;t&&this.nodes.forEach(o=>o._removeDOM=!0);const i=this.nodes;return this.removedNodes=r?i:[],this.nodes=[],this._notify(i)}moveNodeCheck(t,r){if(!this.changedPosConstrain(t,r))return!1;if(r.pack=!0,!this.maxRow)return this.moveNode(t,r);let i;const o=new ai({column:this.column,float:this.float,nodes:this.nodes.map(c=>c._id===t._id?(i={...c},i):{...c})});if(!i)return!1;const u=o.moveNode(i,r)&&o.getRow()<=Math.max(this.getRow(),this.maxRow);if(!u&&!r.resizing&&r.collide){const c=r.collide.el.gridstackNode;if(this.swap(t,c))return this._notify(),!0}return u?(o.nodes.filter(c=>c._dirty).forEach(c=>{const d=this.nodes.find(p=>p._id===c._id);d&&(A.copyPos(d,c),d._dirty=!0)}),this._notify(),!0):!1}willItFit(t){if(delete t._willFitPos,!this.maxRow)return!0;const r=new ai({column:this.column,float:this.float,nodes:this.nodes.map(o=>({...o}))}),i={...t};return this.cleanupNode(i),delete i.el,delete i._id,delete i.content,delete i.grid,r.addNode(i),r.getRow()<=this.maxRow?(t._willFitPos=A.copyPos({},i),!0):!1}changedPosConstrain(t,r){return r.w=r.w||t.w,r.h=r.h||t.h,t.x!==r.x||t.y!==r.y?!0:(t.maxW&&(r.w=Math.min(r.w,t.maxW)),t.maxH&&(r.h=Math.min(r.h,t.maxH)),t.minW&&(r.w=Math.max(r.w,t.minW)),t.minH&&(r.h=Math.max(r.h,t.minH)),t.w!==r.w||t.h!==r.h)}moveNode(t,r){var m,w;if(!t||!r)return!1;let i;r.pack===void 0&&!this.batchMode&&(i=r.pack=!0),typeof r.x!="number"&&(r.x=t.x),typeof r.y!="number"&&(r.y=t.y),typeof r.w!="number"&&(r.w=t.w),typeof r.h!="number"&&(r.h=t.h);const o=t.w!==r.w||t.h!==r.h,u=A.copyPos({},t,!0);if(A.copyPos(u,r),this.nodeBoundFix(u,o),A.copyPos(r,u),!r.forceCollide&&A.samePos(t,r))return!1;const c=A.copyPos({},t),d=this.collideAll(t,u,r.skip);let p=!0;if(d.length){const v=t._moving&&!r.nested;let x=v?this.directionCollideCoverage(t,r,d):d[0];if(v&&x&&((w=(m=t.grid)==null?void 0:m.opts)!=null&&w.subGridDynamic)&&!t.grid._isTemp){const z=A.areaIntercept(r.rect,x._rect),R=A.area(r.rect),k=A.area(x._rect);z/(R.8&&(x.grid.makeSubGrid(x.el,void 0,t),x=void 0)}x?p=!this._fixCollisions(t,u,x,r):(p=!1,i&&delete r.pack)}return p&&!A.samePos(t,u)&&(t._dirty=!0,A.copyPos(t,u)),r.pack&&this._packNodes()._notify(),!A.samePos(t,c)}getRow(){return this.nodes.reduce((t,r)=>Math.max(t,r.y+r.h),0)}beginUpdate(t){return t._updating||(t._updating=!0,delete t._skipDown,this.batchMode||this.saveInitial()),this}endUpdate(){const t=this.nodes.find(r=>r._updating);return t&&(delete t._updating,delete t._skipDown),this}save(t=!0,r){var c;const i=(c=this._layouts)==null?void 0:c.length,o=i&&this.column!==i-1?this._layouts[i-1]:null,u=[];return this.sortNodes(),this.nodes.forEach(d=>{const p=o==null?void 0:o.find(w=>w._id===d._id),m={...d,...p||{}};A.removeInternalForSave(m,!t),r&&r(d,m),u.push(m)}),u}layoutsNodesChange(t){return!this._layouts||this._inColumnResize?this:(this._layouts.forEach((r,i)=>{if(!r||i===this.column)return this;if(i{if(!u._orig)return;const c=r.find(d=>d._id===u._id);c&&(c.y>=0&&u.y!==u._orig.y&&(c.y+=u.y-u._orig.y),u.x!==u._orig.x&&(c.x=Math.round(u.x*o)),u.w!==u._orig.w&&(c.w=Math.round(u.w*o)))})}}),this)}columnChanged(t,r,i="moveScale"){var d;if(!this.nodes.length||!r||t===r)return this;const o=i==="compact"||i==="list";o&&this.sortNodes(1),rt&&this._layouts){const p=this._layouts[r]||[],m=this._layouts.length-1;!p.length&&t!==m&&((d=this._layouts[m])!=null&&d.length)&&(t=m,this._layouts[m].forEach(w=>{const v=c.find(x=>x._id===w._id);v&&(!o&&!w.autoPosition&&(v.x=w.x??v.x,v.y=w.y??v.y),v.w=w.w??v.w,(w.x==null||w.y===void 0)&&(v.autoPosition=!0))})),p.forEach(w=>{const v=c.findIndex(x=>x._id===w._id);if(v!==-1){const x=c[v];if(o){x.w=w.w;return}(w.autoPosition||isNaN(w.x)||isNaN(w.y))&&this.findEmptyPosition(w,u),w.autoPosition||(x.x=w.x??x.x,x.y=w.y??x.y,x.w=w.w??x.w,u.push(x)),c.splice(v,1)}})}if(o)this.compact(i,!1);else{if(c.length)if(typeof i=="function")i(r,t,u,c);else{const p=o||i==="none"?1:r/t,m=i==="move"||i==="moveScale",w=i==="scale"||i==="moveScale";c.forEach(v=>{v.x=r===1?0:m?Math.round(v.x*p):Math.min(v.x,r-1),v.w=r===1||t===1?1:w?Math.round(v.w*p)||1:Math.min(v.w,r),u.push(v)}),c=[]}u=A.sort(u,-1),this._inColumnResize=!0,this.nodes=[],u.forEach(p=>{this.addNode(p,!1),delete p._orig})}return this.nodes.forEach(p=>delete p._orig),this.batchUpdate(!1,!o),delete this._inColumnResize,this}cacheLayout(t,r,i=!1){const o=[];return t.forEach((u,c)=>{if(u._id===void 0){const d=u.id?this.nodes.find(p=>p.id===u.id):void 0;u._id=(d==null?void 0:d._id)??ai._idSeq++}o[c]={x:u.x,y:u.y,w:u.w,_id:u._id}}),this._layouts=i?[]:this._layouts||[],this._layouts[r]=o,this}cacheOneLayout(t,r){t._id=t._id??ai._idSeq++;const i={x:t.x,y:t.y,w:t.w,_id:t._id};(t.autoPosition||t.x===void 0)&&(delete i.x,delete i.y,t.autoPosition&&(i.autoPosition=!0)),this._layouts=this._layouts||[],this._layouts[r]=this._layouts[r]||[];const o=this.findCacheLayout(t,r);return o===-1?this._layouts[r].push(i):this._layouts[r][o]=i,this}findCacheLayout(t,r){var i,o;return((o=(i=this._layouts)==null?void 0:i[r])==null?void 0:o.findIndex(u=>u._id===t._id))??-1}removeNodeFromLayoutCache(t){if(this._layouts)for(let r=0;r0||navigator.msMaxTouchPoints>0);class ui{}function hu(l,t){l.touches.length>1||(l.cancelable&&l.preventDefault(),A.simulateMouseEvent(l.changedTouches[0],t))}function Um(l,t){l.cancelable&&l.preventDefault(),A.simulateMouseEvent(l,t)}function pu(l){ui.touchHandled||(ui.touchHandled=!0,hu(l,"mousedown"))}function gu(l){ui.touchHandled&&hu(l,"mousemove")}function mu(l){if(!ui.touchHandled)return;ui.pointerLeaveTimeout&&(window.clearTimeout(ui.pointerLeaveTimeout),delete ui.pointerLeaveTimeout);const t=!!Le.dragElement;hu(l,"mouseup"),t||hu(l,"click"),ui.touchHandled=!1}function vu(l){l.pointerType!=="mouse"&&l.target.releasePointerCapture(l.pointerId)}function _g(l){Le.dragElement&&l.pointerType!=="mouse"&&Um(l,"mouseenter")}function Eg(l){Le.dragElement&&l.pointerType!=="mouse"&&(ui.pointerLeaveTimeout=window.setTimeout(()=>{delete ui.pointerLeaveTimeout,Um(l,"mouseleave")},10))}class Mu{constructor(t,r,i){this.host=t,this.dir=r,this.option=i,this.moving=!1,this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this._init()}_init(){const t=this.el=document.createElement("div");return t.classList.add("ui-resizable-handle"),t.classList.add(`${Mu.prefix}${this.dir}`),t.style.zIndex="100",t.style.userSelect="none",this.host.appendChild(this.el),this.el.addEventListener("mousedown",this._mouseDown),Kr&&(this.el.addEventListener("touchstart",pu),this.el.addEventListener("pointerdown",vu)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),Kr&&(this.el.removeEventListener("touchstart",pu),this.el.removeEventListener("pointerdown",vu)),this.host.removeChild(this.el),delete this.el,delete this.host,this}_mouseDown(t){this.mouseDownEvent=t,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),Kr&&(this.el.addEventListener("touchmove",gu),this.el.addEventListener("touchend",mu)),t.stopPropagation(),t.preventDefault()}_mouseMove(t){const r=this.mouseDownEvent;this.moving?this._triggerEvent("move",t):Math.abs(t.x-r.x)+Math.abs(t.y-r.y)>2&&(this.moving=!0,this._triggerEvent("start",this.mouseDownEvent),this._triggerEvent("move",t),document.addEventListener("keydown",this._keyEvent)),t.stopPropagation()}_mouseUp(t){this.moving&&(this._triggerEvent("stop",t),document.removeEventListener("keydown",this._keyEvent)),document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),Kr&&(this.el.removeEventListener("touchmove",gu),this.el.removeEventListener("touchend",mu)),delete this.moving,delete this.mouseDownEvent,t.stopPropagation(),t.preventDefault()}_keyEvent(t){var r,i;t.key==="Escape"&&((i=(r=this.host.gridstackNode)==null?void 0:r.grid)==null||i.engine.restoreInitial(),this._mouseUp(this.mouseDownEvent))}_triggerEvent(t,r){return this.option[t]&&this.option[t](r),this}}Mu.prefix="ui-resizable-";class od{constructor(){this._eventRegister={}}get disabled(){return this._disabled}on(t,r){this._eventRegister[t]=r}off(t){delete this._eventRegister[t]}enable(){this._disabled=!1}disable(){this._disabled=!0}destroy(){delete this._eventRegister}triggerEvent(t,r){if(!this.disabled&&this._eventRegister&&this._eventRegister[t])return this._eventRegister[t](r)}}class zo extends od{constructor(t,r={}){super(),this.el=t,this.option=r,this.rectScale={x:1,y:1},this._ui=()=>{const o=this.el.parentElement.getBoundingClientRect(),u={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},c=this.temporalRect||u;return{position:{left:(c.left-o.left)*this.rectScale.x,top:(c.top-o.top)*this.rectScale.y},size:{width:c.width*this.rectScale.x,height:c.height*this.rectScale.y}}},this._mouseOver=this._mouseOver.bind(this),this._mouseOut=this._mouseOut.bind(this),this.enable(),this._setupAutoHide(this.option.autoHide),this._setupHandlers()}on(t,r){super.on(t,r)}off(t){super.off(t)}enable(){super.enable(),this.el.classList.remove("ui-resizable-disabled"),this._setupAutoHide(this.option.autoHide)}disable(){super.disable(),this.el.classList.add("ui-resizable-disabled"),this._setupAutoHide(!1)}destroy(){this._removeHandlers(),this._setupAutoHide(!1),delete this.el,super.destroy()}updateOption(t){const r=t.handles&&t.handles!==this.option.handles,i=t.autoHide&&t.autoHide!==this.option.autoHide;return Object.keys(t).forEach(o=>this.option[o]=t[o]),r&&(this._removeHandlers(),this._setupHandlers()),i&&this._setupAutoHide(this.option.autoHide),this}_setupAutoHide(t){return t?(this.el.classList.add("ui-resizable-autohide"),this.el.addEventListener("mouseover",this._mouseOver),this.el.addEventListener("mouseout",this._mouseOut)):(this.el.classList.remove("ui-resizable-autohide"),this.el.removeEventListener("mouseover",this._mouseOver),this.el.removeEventListener("mouseout",this._mouseOut),Le.overResizeElement===this&&delete Le.overResizeElement),this}_mouseOver(t){Le.overResizeElement||Le.dragElement||(Le.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(t){Le.overResizeElement===this&&(delete Le.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(t=>t.trim()).map(t=>new Mu(this.el,t,{start:r=>{this._resizeStart(r)},stop:r=>{this._resizeStop(r)},move:r=>{this._resizing(r,t)}})),this}_resizeStart(t){this.sizeToContent=A.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=A.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=t,this._setupHelper(),this._applyChange();const r=A.initEvent(t,{type:"resizestart",target:this.el});return this.option.start&&this.option.start(r,this._ui()),this.el.classList.add("ui-resizable-resizing"),this.triggerEvent("resizestart",r),this}_resizing(t,r){this.scrolled=this.scrollEl.scrollTop-this.scrollY,this.temporalRect=this._getChange(t,r),this._applyChange();const i=A.initEvent(t,{type:"resize",target:this.el});return this.option.resize&&this.option.resize(i,this._ui()),this.triggerEvent("resize",i),this}_resizeStop(t){const r=A.initEvent(t,{type:"resizestop",target:this.el});return this.option.stop&&this.option.stop(r),this.el.classList.remove("ui-resizable-resizing"),this.triggerEvent("resizestop",r),this._cleanHelper(),delete this.startEvent,delete this.originalRect,delete this.temporalRect,delete this.scrollY,delete this.scrolled,this}_setupHelper(){this.elOriginStyleVal=zo._originStyleProp.map(i=>this.el.style[i]),this.parentOriginStylePosition=this.el.parentElement.style.position;const t=this.el.parentElement,r=A.getValuesFromTransformedElement(t);return this.rectScale={x:r.xScale,y:r.yScale},getComputedStyle(this.el.parentElement).position.match(/static/)&&(this.el.parentElement.style.position="relative"),this.el.style.position="absolute",this.el.style.opacity="0.8",this}_cleanHelper(){return zo._originStyleProp.forEach((t,r)=>{this.el.style[t]=this.elOriginStyleVal[r]||null}),this.el.parentElement.style.position=this.parentOriginStylePosition||null,this}_getChange(t,r){const i=this.startEvent,o={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},u=t.clientX-i.clientX,c=this.sizeToContent?0:t.clientY-i.clientY;let d,p;r.indexOf("e")>-1?o.width+=u:r.indexOf("w")>-1&&(o.width-=u,o.left+=u,d=!0),r.indexOf("s")>-1?o.height+=c:r.indexOf("n")>-1&&(o.height-=c,o.top+=c,p=!0);const m=this._constrainSize(o.width,o.height,d,p);return Math.round(o.width)!==Math.round(m.width)&&(r.indexOf("w")>-1&&(o.left+=o.width-m.width),o.width=m.width),Math.round(o.height)!==Math.round(m.height)&&(r.indexOf("n")>-1&&(o.top+=o.height-m.height),o.height=m.height),o}_constrainSize(t,r,i,o){const u=this.option,c=(i?u.maxWidthMoveLeft:u.maxWidth)||Number.MAX_SAFE_INTEGER,d=u.minWidth/this.rectScale.x||t,p=(o?u.maxHeightMoveUp:u.maxHeight)||Number.MAX_SAFE_INTEGER,m=u.minHeight/this.rectScale.y||r,w=Math.min(c,Math.max(d,t)),v=Math.min(p,Math.max(m,r));return{width:w,height:v}}_applyChange(){let t={left:0,top:0,width:0,height:0};if(this.el.style.position==="absolute"){const r=this.el.parentElement,{left:i,top:o}=r.getBoundingClientRect();t={left:i,top:o,width:0,height:0}}return this.temporalRect?(Object.keys(this.temporalRect).forEach(r=>{const i=this.temporalRect[r],o=r==="width"||r==="left"?this.rectScale.x:r==="height"||r==="top"?this.rectScale.y:1;this.el.style[r]=(i-t[r])*o+"px"}),this):this}_removeHandlers(){return this.handlers.forEach(t=>t.destroy()),delete this.handlers,this}}zo._originStyleProp=["width","height","position","left","top","opacity","zIndex"];const kS='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class Mo extends od{constructor(t,r={}){var u;super(),this.el=t,this.option=r,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0};const i=(u=r==null?void 0:r.handle)==null?void 0:u.substring(1),o=t.gridstackNode;this.dragEls=!i||t.classList.contains(i)?[t]:o!=null&&o.subGrid?[t.querySelector(r.handle)||t]:Array.from(t.querySelectorAll(r.handle)),this.dragEls.length===0&&(this.dragEls=[t]),this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this.enable()}on(t,r){super.on(t,r)}off(t){super.off(t)}enable(){this.disabled!==!1&&(super.enable(),this.dragEls.forEach(t=>{t.addEventListener("mousedown",this._mouseDown),Kr&&(t.addEventListener("touchstart",pu),t.addEventListener("pointerdown",vu))}),this.el.classList.remove("ui-draggable-disabled"))}disable(t=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(r=>{r.removeEventListener("mousedown",this._mouseDown),Kr&&(r.removeEventListener("touchstart",pu),r.removeEventListener("pointerdown",vu))}),t||this.el.classList.add("ui-draggable-disabled"))}destroy(){this.dragTimeout&&window.clearTimeout(this.dragTimeout),delete this.dragTimeout,this.mouseDownEvent&&this._mouseUp(this.mouseDownEvent),this.disable(!0),delete this.el,delete this.helper,delete this.option,super.destroy()}updateOption(t){return Object.keys(t).forEach(r=>this.option[r]=t[r]),this}_mouseDown(t){if(!Le.mouseHandled)return t.button!==0||!this.dragEls.find(r=>r===t.target)&&t.target.closest(kS)||this.option.cancel&&t.target.closest(this.option.cancel)||(this.mouseDownEvent=t,delete this.dragging,delete Le.dragElement,delete Le.dropElement,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),Kr&&(t.currentTarget.addEventListener("touchmove",gu),t.currentTarget.addEventListener("touchend",mu)),t.preventDefault(),document.activeElement&&document.activeElement.blur(),Le.mouseHandled=!0),!0}_callDrag(t){if(!this.dragging)return;const r=A.initEvent(t,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(r,this.ui()),this.triggerEvent("drag",r)}_mouseMove(t){var i;const r=this.mouseDownEvent;if(this.lastDrag=t,this.dragging)if(this._dragFollow(t),Le.pauseDrag){const o=Number.isInteger(Le.pauseDrag)?Le.pauseDrag:100;this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>this._callDrag(t),o)}else this._callDrag(t);else if(Math.abs(t.x-r.x)+Math.abs(t.y-r.y)>3){this.dragging=!0,Le.dragElement=this;const o=(i=this.el.gridstackNode)==null?void 0:i.grid;o?Le.dropElement=o.el.ddElement.ddDroppable:delete Le.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=A.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(t,this.el,this.helperContainment),this._setupHelperStyle(t);const u=A.initEvent(t,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(u,this.ui()),this.triggerEvent("dragstart",u),document.addEventListener("keydown",this._keyEvent)}return!0}_mouseUp(t){var r,i;if(document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),Kr&&t.currentTarget&&(t.currentTarget.removeEventListener("touchmove",gu,!0),t.currentTarget.removeEventListener("touchend",mu,!0)),this.dragging){delete this.dragging,(r=this.el.gridstackNode)==null||delete r._origRotate,document.removeEventListener("keydown",this._keyEvent),((i=Le.dropElement)==null?void 0:i.el)===this.el.parentElement&&delete Le.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();const o=A.initEvent(t,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(o),this.triggerEvent("dragstop",o),Le.dropElement&&Le.dropElement.drop(t)}delete this.helper,delete this.mouseDownEvent,delete Le.dragElement,delete Le.dropElement,delete Le.mouseHandled,t.preventDefault()}_keyEvent(t){var o,u;const r=this.el.gridstackNode,i=(r==null?void 0:r.grid)||((u=(o=Le.dropElement)==null?void 0:o.el)==null?void 0:u.gridstack);if(t.key==="Escape")r&&r._origRotate&&(r._orig=r._origRotate,delete r._origRotate),i==null||i.cancelDrag(),this._mouseUp(this.mouseDownEvent);else if(r&&i&&(t.key==="r"||t.key==="R")){if(!A.canBeRotated(r))return;r._origRotate=r._origRotate||{...r._orig},delete r._moving,i.setAnimation(!1).rotate(r.el,{top:-this.dragOffset.offsetTop,left:-this.dragOffset.offsetLeft}).setAnimation(),r._moving=!0,this.dragOffset=this._getDragOffset(this.lastDrag,r.el,this.helperContainment),this.helper.style.width=this.dragOffset.width+"px",this.helper.style.height=this.dragOffset.height+"px",A.swap(r._orig,"w","h"),delete r._rect,this._mouseMove(this.lastDrag)}}_createHelper(){let t=this.el;return typeof this.option.helper=="function"?t=this.option.helper(this.el):this.option.helper==="clone"&&(t=A.cloneNode(this.el)),t.parentElement||A.appendTo(t,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=Mo.originStyleProp.map(r=>this.el.style[r]),t}_setupHelperStyle(t){this.helper.classList.add("ui-draggable-dragging");const r=this.helper.style;return r.pointerEvents="none",r.width=this.dragOffset.width+"px",r.height=this.dragOffset.height+"px",r.willChange="left, top",r.position="fixed",this._dragFollow(t),r.transition="none",setTimeout(()=>{this.helper&&(r.transition=null)},0),this}_removeHelperStyle(){var r;this.helper.classList.remove("ui-draggable-dragging");const t=(r=this.helper)==null?void 0:r.gridstackNode;if(!(t!=null&&t._isAboutToRemove)&&this.dragElementOriginStyle){const i=this.helper,o=this.dragElementOriginStyle.transition||null;i.style.transition=this.dragElementOriginStyle.transition="none",Mo.originStyleProp.forEach(u=>i.style[u]=this.dragElementOriginStyle[u]||null),setTimeout(()=>i.style.transition=o,50)}return delete this.dragElementOriginStyle,this}_dragFollow(t){const r={left:0,top:0},i=this.helper.style,o=this.dragOffset;i.left=(t.clientX+o.offsetLeft-r.left)*this.dragTransform.xScale+"px",i.top=(t.clientY+o.offsetTop-r.top)*this.dragTransform.yScale+"px"}_setupHelperContainmentStyle(){return this.helperContainment=this.helper.parentElement,this.helper.style.position!=="fixed"&&(this.parentOriginStylePosition=this.helperContainment.style.position,getComputedStyle(this.helperContainment).position.match(/static/)&&(this.helperContainment.style.position="relative")),this}_getDragOffset(t,r,i){let o=0,u=0;i&&(o=this.dragTransform.xOffset,u=this.dragTransform.yOffset);const c=r.getBoundingClientRect();return{left:c.left,top:c.top,offsetLeft:-t.clientX+c.left-o,offsetTop:-t.clientY+c.top-u,width:c.width*this.dragTransform.xScale,height:c.height*this.dragTransform.yScale}}ui(){const r=this.el.parentElement.getBoundingClientRect(),i=this.helper.getBoundingClientRect();return{position:{top:(i.top-r.top)*this.dragTransform.yScale,left:(i.left-r.left)*this.dragTransform.xScale}}}}Mo.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","top","minWidth","willChange"];class RS extends od{constructor(t,r={}){super(),this.el=t,this.option=r,this._mouseEnter=this._mouseEnter.bind(this),this._mouseLeave=this._mouseLeave.bind(this),this.enable(),this._setupAccept()}on(t,r){super.on(t,r)}off(t){super.off(t)}enable(){this.disabled!==!1&&(super.enable(),this.el.classList.add("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),this.el.addEventListener("mouseenter",this._mouseEnter),this.el.addEventListener("mouseleave",this._mouseLeave),Kr&&(this.el.addEventListener("pointerenter",_g),this.el.addEventListener("pointerleave",Eg)))}disable(t=!1){this.disabled!==!0&&(super.disable(),this.el.classList.remove("ui-droppable"),t||this.el.classList.add("ui-droppable-disabled"),this.el.removeEventListener("mouseenter",this._mouseEnter),this.el.removeEventListener("mouseleave",this._mouseLeave),Kr&&(this.el.removeEventListener("pointerenter",_g),this.el.removeEventListener("pointerleave",Eg)))}destroy(){this.disable(!0),this.el.classList.remove("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),super.destroy()}updateOption(t){return Object.keys(t).forEach(r=>this.option[r]=t[r]),this._setupAccept(),this}_mouseEnter(t){if(!Le.dragElement||!this._canDrop(Le.dragElement.el))return;t.preventDefault(),t.stopPropagation(),Le.dropElement&&Le.dropElement!==this&&Le.dropElement._mouseLeave(t,!0),Le.dropElement=this;const r=A.initEvent(t,{target:this.el,type:"dropover"});this.option.over&&this.option.over(r,this._ui(Le.dragElement)),this.triggerEvent("dropover",r),this.el.classList.add("ui-droppable-over")}_mouseLeave(t,r=!1){var o;if(!Le.dragElement||Le.dropElement!==this)return;t.preventDefault(),t.stopPropagation();const i=A.initEvent(t,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(i,this._ui(Le.dragElement)),this.triggerEvent("dropout",i),Le.dropElement===this&&(delete Le.dropElement,!r)){let u,c=this.el.parentElement;for(;!u&&c;)u=(o=c.ddElement)==null?void 0:o.ddDroppable,c=c.parentElement;u&&u._mouseEnter(t)}}drop(t){t.preventDefault();const r=A.initEvent(t,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(r,this._ui(Le.dragElement)),this.triggerEvent("drop",r)}_canDrop(t){return t&&(!this.accept||this.accept(t))}_setupAccept(){return this.option.accept?(typeof this.option.accept=="string"?this.accept=t=>t.classList.contains(this.option.accept)||t.matches(this.option.accept):this.accept=this.option.accept,this):this}_ui(t){return{draggable:t.el,...t.ui()}}}class ad{static init(t){return t.ddElement||(t.ddElement=new ad(t)),t.ddElement}constructor(t){this.el=t}on(t,r){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(t)>-1?this.ddDraggable.on(t,r):this.ddDroppable&&["drop","dropover","dropout"].indexOf(t)>-1?this.ddDroppable.on(t,r):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(t)>-1&&this.ddResizable.on(t,r),this}off(t){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(t)>-1?this.ddDraggable.off(t):this.ddDroppable&&["drop","dropover","dropout"].indexOf(t)>-1?this.ddDroppable.off(t):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(t)>-1&&this.ddResizable.off(t),this}setupDraggable(t){return this.ddDraggable?this.ddDraggable.updateOption(t):this.ddDraggable=new Mo(this.el,t),this}cleanDraggable(){return this.ddDraggable&&(this.ddDraggable.destroy(),delete this.ddDraggable),this}setupResizable(t){return this.ddResizable?this.ddResizable.updateOption(t):this.ddResizable=new zo(this.el,t),this}cleanResizable(){return this.ddResizable&&(this.ddResizable.destroy(),delete this.ddResizable),this}setupDroppable(t){return this.ddDroppable?this.ddDroppable.updateOption(t):this.ddDroppable=new RS(this.el,t),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class NS{resizable(t,r,i,o){return this._getDDElements(t,r).forEach(u=>{if(r==="disable"||r==="enable")u.ddResizable&&u.ddResizable[r]();else if(r==="destroy")u.ddResizable&&u.cleanResizable();else if(r==="option")u.setupResizable({[i]:o});else{const d=u.el.gridstackNode.grid;let p=u.el.getAttribute("gs-resize-handles")||d.opts.resizable.handles||"e,s,se";p==="all"&&(p="n,e,s,w,se,sw,ne,nw");const m=!d.opts.alwaysShowResizeHandle;u.setupResizable({...d.opts.resizable,handles:p,autoHide:m,start:r.start,stop:r.stop,resize:r.resize})}}),this}draggable(t,r,i,o){return this._getDDElements(t,r).forEach(u=>{if(r==="disable"||r==="enable")u.ddDraggable&&u.ddDraggable[r]();else if(r==="destroy")u.ddDraggable&&u.cleanDraggable();else if(r==="option")u.setupDraggable({[i]:o});else{const c=u.el.gridstackNode.grid;u.setupDraggable({...c.opts.draggable,start:r.start,stop:r.stop,drag:r.drag})}}),this}dragIn(t,r){return this._getDDElements(t).forEach(i=>i.setupDraggable(r)),this}droppable(t,r,i,o){return typeof r.accept=="function"&&!r._accept&&(r._accept=r.accept,r.accept=u=>r._accept(u)),this._getDDElements(t,r).forEach(u=>{r==="disable"||r==="enable"?u.ddDroppable&&u.ddDroppable[r]():r==="destroy"?u.ddDroppable&&u.cleanDroppable():r==="option"?u.setupDroppable({[i]:o}):u.setupDroppable(r)}),this}isDroppable(t){var r;return!!((r=t==null?void 0:t.ddElement)!=null&&r.ddDroppable&&!t.ddElement.ddDroppable.disabled)}isDraggable(t){var r;return!!((r=t==null?void 0:t.ddElement)!=null&&r.ddDraggable&&!t.ddElement.ddDraggable.disabled)}isResizable(t){var r;return!!((r=t==null?void 0:t.ddElement)!=null&&r.ddResizable&&!t.ddElement.ddResizable.disabled)}on(t,r,i){return this._getDDElements(t).forEach(o=>o.on(r,u=>{i(u,Le.dragElement?Le.dragElement.el:u.target,Le.dragElement?Le.dragElement.helper:null)})),this}off(t,r){return this._getDDElements(t).forEach(i=>i.off(r)),this}_getDDElements(t,r){const i=t.gridstack||r!=="destroy"&&r!=="disable",o=A.getElements(t);return o.length?o.map(c=>c.ddElement||(i?ad.init(c):null)).filter(c=>c):[]}}/*! + * GridStack 11.5.1 + * https://gridstackjs.com/ + * + * Copyright (c) 2021-2024 Alain Dumesny + * see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE + */const $n=new NS;class Ne{static init(t={},r=".grid-stack"){if(typeof document>"u")return null;const i=Ne.getGridElement(r);return i?(i.gridstack||(i.gridstack=new Ne(i,A.cloneDeep(t))),i.gridstack):(console.error(typeof r=="string"?'GridStack.initAll() no grid was found with selector "'+r+`" - element missing or wrong selector ? +Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`:"GridStack.init() no grid element was passed."),null)}static initAll(t={},r=".grid-stack"){const i=[];return typeof document>"u"||(Ne.getGridElements(r).forEach(o=>{o.gridstack||(o.gridstack=new Ne(o,A.cloneDeep(t))),i.push(o.gridstack)}),i.length===0&&console.error('GridStack.initAll() no grid was found with selector "'+r+`" - element missing or wrong selector ? +Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`)),i}static addGrid(t,r={}){if(!t)return null;let i=t;if(i.gridstack){const c=i.gridstack;return r&&(c.opts={...c.opts,...r}),r.children!==void 0&&c.load(r.children),c}return(!t.classList.contains("grid-stack")||Ne.addRemoveCB)&&(Ne.addRemoveCB?i=Ne.addRemoveCB(t,r,!0,!0):i=A.createDiv(["grid-stack",r.class],t)),Ne.init(r,i)}static registerEngine(t){Ne.engineClass=t}get placeholder(){if(!this._placeholder){this._placeholder=A.createDiv([this.opts.placeholderClass,yr.itemClass,this.opts.itemClass]);const t=A.createDiv(["placeholder-content"],this._placeholder);this.opts.placeholderText&&(t.textContent=this.opts.placeholderText)}return this._placeholder}constructor(t,r={}){var v,x,z;this.el=t,this.opts=r,this.animationDelay=310,this._gsEventHandler={},this._extraDragRow=0,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0},t.gridstack=this,this.opts=r=r||{},t.classList.contains("grid-stack")||this.el.classList.add("grid-stack"),r.row&&(r.minRow=r.maxRow=r.row,delete r.row);const i=A.toNumber(t.getAttribute("gs-row"));r.column==="auto"&&delete r.column,r.alwaysShowResizeHandle!==void 0&&(r._alwaysShowResizeHandle=r.alwaysShowResizeHandle);let o=(v=r.columnOpts)==null?void 0:v.breakpoints;const u=r;if(u.oneColumnModeDomSort&&(delete u.oneColumnModeDomSort,console.log("warning: Gridstack oneColumnModeDomSort no longer supported. Use GridStackOptions.columnOpts instead.")),u.oneColumnSize||u.disableOneColumnMode===!1){const R=u.oneColumnSize||768;delete u.oneColumnSize,delete u.disableOneColumnMode,r.columnOpts=r.columnOpts||{},o=r.columnOpts.breakpoints=r.columnOpts.breakpoints||[];let k=o.find(b=>b.c===1);k?k.w=R:(k={c:1,w:R},o.push(k,{c:12,w:R+1}))}const c=r.columnOpts;c&&(!c.columnWidth&&!((x=c.breakpoints)!=null&&x.length)?(delete r.columnOpts,o=void 0):c.columnMax=c.columnMax||12),(o==null?void 0:o.length)>1&&o.sort((R,k)=>(k.w||0)-(R.w||0));const d={...A.cloneDeep(yr),column:A.toNumber(t.getAttribute("gs-column"))||yr.column,minRow:i||A.toNumber(t.getAttribute("gs-min-row"))||yr.minRow,maxRow:i||A.toNumber(t.getAttribute("gs-max-row"))||yr.maxRow,staticGrid:A.toBool(t.getAttribute("gs-static"))||yr.staticGrid,sizeToContent:A.toBool(t.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(r.handleClass?"."+r.handleClass:r.handle?r.handle:"")||yr.draggable.handle},removableOptions:{accept:r.itemClass||yr.removableOptions.accept,decline:yr.removableOptions.decline}};t.getAttribute("gs-animate")&&(d.animate=A.toBool(t.getAttribute("gs-animate"))),r=A.defaults(r,d),this._initMargin(),this.checkDynamicColumn(),this.el.classList.add("gs-"+r.column),r.rtl==="auto"&&(r.rtl=t.style.direction==="rtl"),r.rtl&&this.el.classList.add("grid-stack-rtl");const p=this.el.closest("."+yr.itemClass),m=p==null?void 0:p.gridstackNode;m&&(m.subGrid=this,this.parentGridNode=m,this.el.classList.add("grid-stack-nested"),m.el.classList.add("grid-stack-sub-grid")),this._isAutoCellHeight=r.cellHeight==="auto",this._isAutoCellHeight||r.cellHeight==="initial"?this.cellHeight(void 0,!1):(typeof r.cellHeight=="number"&&r.cellHeightUnit&&r.cellHeightUnit!==yr.cellHeightUnit&&(r.cellHeight=r.cellHeight+r.cellHeightUnit,delete r.cellHeightUnit),this.cellHeight(r.cellHeight,!1)),r.alwaysShowResizeHandle==="mobile"&&(r.alwaysShowResizeHandle=Kr),this._styleSheetClass="gs-id-"+ai._idSeq++,this.el.classList.add(this._styleSheetClass),this._setStaticClass();const w=r.engineClass||Ne.engineClass||ai;if(this.engine=new w({column:this.getColumn(),float:r.float,maxRow:r.maxRow,onChange:R=>{let k=0;this.engine.nodes.forEach(b=>{k=Math.max(k,b.y+b.h)}),R.forEach(b=>{const W=b.el;W&&(b._removeDOM?(W&&W.remove(),delete b._removeDOM):this._writePosAttr(W,b))}),this._updateStyles(!1,k)}}),this._updateStyles(!1,0),r.auto&&(this.batchUpdate(),this.engine._loading=!0,this.getGridItems().forEach(R=>this._prepareElement(R)),delete this.engine._loading,this.batchUpdate(!1)),r.children){const R=r.children;delete r.children,R.length&&this.load(R)}this.setAnimation(),r.subGridDynamic&&!Le.pauseDrag&&(Le.pauseDrag=!0),((z=r.draggable)==null?void 0:z.pause)!==void 0&&(Le.pauseDrag=r.draggable.pause),this._setupRemoveDrop(),this._setupAcceptWidget(),this._updateResizeEvent()}addWidget(t){if(typeof t=="string"){console.error("V11: GridStack.addWidget() does not support string anymore. see #2736");return}if(t.ELEMENT_NODE)return console.error("V11: GridStack.addWidget() does not support HTMLElement anymore. use makeWidget()"),this.makeWidget(t);let r,i=t;if(i.grid=this,i!=null&&i.el?r=i.el:Ne.addRemoveCB?r=Ne.addRemoveCB(this.el,t,!0,!1):r=this.createWidgetDivs(i),!r)return;if(i=r.gridstackNode,i&&r.parentElement===this.el&&this.engine.nodes.find(u=>u._id===i._id))return r;const o=this._readAttr(r);return A.defaults(t,o),this.engine.prepareNode(t),this.el.appendChild(r),this.makeWidget(r,t),r}createWidgetDivs(t){const r=A.createDiv(["grid-stack-item",this.opts.itemClass]),i=A.createDiv(["grid-stack-item-content"],r);return A.lazyLoad(t)?t.visibleObservable||(t.visibleObservable=new IntersectionObserver(([o])=>{var u,c;o.isIntersecting&&((u=t.visibleObservable)==null||u.disconnect(),delete t.visibleObservable,Ne.renderCB(i,t),(c=t.grid)==null||c.prepareDragDrop(t.el))}),window.setTimeout(()=>{var o;return(o=t.visibleObservable)==null?void 0:o.observe(r)})):Ne.renderCB(i,t),r}makeSubGrid(t,r,i,o=!0){var z,R,k;let u=t.gridstackNode;if(u||(u=this.makeWidget(t).gridstackNode),(z=u.subGrid)!=null&&z.el)return u.subGrid;let c,d=this;for(;d&&!c;)c=(R=d.opts)==null?void 0:R.subGridOpts,d=(k=d.parentGridNode)==null?void 0:k.grid;r=A.cloneDeep({...this.opts,id:void 0,children:void 0,column:"auto",columnOpts:void 0,layout:"list",subGridOpts:void 0,...c||{},...r||u.subGridOpts||{}}),u.subGridOpts=r;let p;r.column==="auto"&&(p=!0,r.column=Math.max(u.w||1,(i==null?void 0:i.w)||1),delete r.columnOpts);let m=u.el.querySelector(".grid-stack-item-content"),w,v;if(o&&(this._removeDD(u.el),v={...u,x:0,y:0},A.removeInternalForSave(v),delete v.subGridOpts,u.content&&(v.content=u.content,delete u.content),Ne.addRemoveCB?w=Ne.addRemoveCB(this.el,v,!0,!1):(w=A.createDiv(["grid-stack-item"]),w.appendChild(m),m=A.createDiv(["grid-stack-item-content"],u.el)),this.prepareDragDrop(u.el)),i){const b=p?r.column:u.w,W=u.h+i.h,P=u.el.style;P.transition="none",this.update(u.el,{w:b,h:W}),setTimeout(()=>P.transition=null)}const x=u.subGrid=Ne.addGrid(m,r);return i!=null&&i._moving&&(x._isTemp=!0),p&&(x._autoColumn=!0),o&&x.makeWidget(w,v),i&&(i._moving?window.setTimeout(()=>A.simulateMouseEvent(i._event,"mouseenter",x.el),0):x.makeWidget(u.el,u)),this.resizeToContentCheck(!1,u),x}removeAsSubGrid(t){var i;const r=(i=this.parentGridNode)==null?void 0:i.grid;r&&(r.batchUpdate(),r.removeWidget(this.parentGridNode.el,!0,!0),this.engine.nodes.forEach(o=>{o.x+=this.parentGridNode.x,o.y+=this.parentGridNode.y,r.makeWidget(o.el,o)}),r.batchUpdate(!1),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,t&&window.setTimeout(()=>A.simulateMouseEvent(t._event,"mouseenter",r.el),0))}save(t=!0,r=!1,i=Ne.saveCB){const o=this.engine.save(t,i);if(o.forEach(u=>{var c;if(t&&u.el&&!u.subGrid&&!i){const d=u.el.querySelector(".grid-stack-item-content");u.content=d==null?void 0:d.innerHTML,u.content||delete u.content}else if(!t&&!i&&delete u.content,(c=u.subGrid)!=null&&c.el){const d=u.subGrid.save(t,r,i);u.subGridOpts=r?d:{children:d},delete u.subGrid}delete u.el}),r){const u=A.cloneDeep(this.opts);u.marginBottom===u.marginTop&&u.marginRight===u.marginLeft&&u.marginTop===u.marginRight&&(u.margin=u.marginTop,delete u.marginTop,delete u.marginRight,delete u.marginBottom,delete u.marginLeft),u.rtl===(this.el.style.direction==="rtl")&&(u.rtl="auto"),this._isAutoCellHeight&&(u.cellHeight="auto"),this._autoColumn&&(u.column="auto");const c=u._alwaysShowResizeHandle;return delete u._alwaysShowResizeHandle,c!==void 0?u.alwaysShowResizeHandle=c:delete u.alwaysShowResizeHandle,A.removeInternalAndSame(u,yr),u.children=o,u}return o}load(t,r=Ne.addRemoveCB||!0){var m;t=A.cloneDeep(t);const i=this.getColumn();t.forEach(w=>{w.w=w.w||1,w.h=w.h||1}),t=A.sort(t),this.engine.skipCacheUpdate=this._ignoreLayoutsNodeChange=!0;let o=0;t.forEach(w=>{o=Math.max(o,(w.x||0)+w.w)}),o>this.engine.defaultColumn&&(this.engine.defaultColumn=o),o>i&&this.engine.cacheLayout(t,o,!0);const u=Ne.addRemoveCB;typeof r=="function"&&(Ne.addRemoveCB=r);const c=[];this.batchUpdate();const d=!this.engine.nodes.length;d&&this.setAnimation(!1),!d&&r&&[...this.engine.nodes].forEach(v=>{if(!v.id)return;A.find(t,v.id)||(Ne.addRemoveCB&&Ne.addRemoveCB(this.el,v,!1,!1),c.push(v),this.removeWidget(v.el,!0,!1))}),this.engine._loading=!0;const p=[];return this.engine.nodes=this.engine.nodes.filter(w=>A.find(t,w.id)?(p.push(w),!1):!0),t.forEach(w=>{var x;const v=A.find(p,w.id);if(v){if(A.shouldSizeToContent(v)&&(w.h=v.h),this.engine.nodeBoundFix(w),(w.autoPosition||w.x===void 0||w.y===void 0)&&(w.w=w.w||v.w,w.h=w.h||v.h,this.engine.findEmptyPosition(w)),this.engine.nodes.push(v),A.samePos(v,w)&&this.engine.nodes.length>1&&(this.moveNode(v,{...w,forceCollide:!0}),A.copyPos(w,v)),this.update(v.el,w),(x=w.subGridOpts)!=null&&x.children){const z=v.el.querySelector(".grid-stack");z&&z.gridstack&&z.gridstack.load(w.subGridOpts.children)}}else r&&this.addWidget(w)}),delete this.engine._loading,this.engine.removedNodes=c,this.batchUpdate(!1),delete this._ignoreLayoutsNodeChange,delete this.engine.skipCacheUpdate,u?Ne.addRemoveCB=u:delete Ne.addRemoveCB,d&&((m=this.opts)!=null&&m.animate)&&this.setAnimation(this.opts.animate,!0),this}batchUpdate(t=!0){return this.engine.batchUpdate(t),t||(this._updateContainerHeight(),this._triggerRemoveEvent(),this._triggerAddEvent(),this._triggerChangeEvent()),this}getCellHeight(t=!1){if(this.opts.cellHeight&&this.opts.cellHeight!=="auto"&&(!t||!this.opts.cellHeightUnit||this.opts.cellHeightUnit==="px"))return this.opts.cellHeight;if(this.opts.cellHeightUnit==="rem")return this.opts.cellHeight*parseFloat(getComputedStyle(document.documentElement).fontSize);if(this.opts.cellHeightUnit==="em")return this.opts.cellHeight*parseFloat(getComputedStyle(this.el).fontSize);if(this.opts.cellHeightUnit==="cm")return this.opts.cellHeight*(96/2.54);if(this.opts.cellHeightUnit==="mm")return this.opts.cellHeight*(96/2.54)/10;const r=this.el.querySelector("."+this.opts.itemClass);if(r){const o=A.toNumber(r.getAttribute("gs-h"))||1;return Math.round(r.offsetHeight/o)}const i=parseInt(this.el.getAttribute("gs-current-row"));return i?Math.round(this.el.getBoundingClientRect().height/i):this.opts.cellHeight}cellHeight(t,r=!0){if(r&&t!==void 0&&this._isAutoCellHeight!==(t==="auto")&&(this._isAutoCellHeight=t==="auto",this._updateResizeEvent()),(t==="initial"||t==="auto")&&(t=void 0),t===void 0){const o=-this.opts.marginRight-this.opts.marginLeft+this.opts.marginTop+this.opts.marginBottom;t=this.cellWidth()+o}const i=A.parseHeight(t);return this.opts.cellHeightUnit===i.unit&&this.opts.cellHeight===i.h?this:(this.opts.cellHeightUnit=i.unit,this.opts.cellHeight=i.h,this.resizeToContentCheck(),r&&this._updateStyles(!0),this)}cellWidth(){return this._widthOrContainer()/this.getColumn()}_widthOrContainer(t=!1){var r;return t&&((r=this.opts.columnOpts)!=null&&r.breakpointForWindow)?window.innerWidth:this.el.clientWidth||this.el.parentElement.clientWidth||window.innerWidth}checkDynamicColumn(){var u,c;const t=this.opts.columnOpts;if(!t||!t.columnWidth&&!((u=t.breakpoints)!=null&&u.length))return!1;const r=this.getColumn();let i=r;const o=this._widthOrContainer(!0);if(t.columnWidth)i=Math.min(Math.round(o/t.columnWidth)||1,t.columnMax);else{i=t.columnMax;let d=0;for(;dp.c===i);return this.column(i,(d==null?void 0:d.layout)||t.layout),!0}return!1}compact(t="compact",r=!0){return this.engine.compact(t,r),this._triggerChangeEvent(),this}column(t,r="moveScale"){if(!t||t<1||this.opts.column===t)return this;const i=this.getColumn();return this.opts.column=t,this.engine?(this.engine.column=t,this.el.classList.remove("gs-"+i),this.el.classList.add("gs-"+t),this.engine.columnChanged(i,t,r),this._isAutoCellHeight&&this.cellHeight(),this.resizeToContentCheck(!0),this._ignoreLayoutsNodeChange=!0,this._triggerChangeEvent(),delete this._ignoreLayoutsNodeChange,this):this}getColumn(){return this.opts.column}getGridItems(){return Array.from(this.el.children).filter(t=>t.matches("."+this.opts.itemClass)&&!t.matches("."+this.opts.placeholderClass))}isIgnoreChangeCB(){return this._ignoreLayoutsNodeChange}destroy(t=!0){var r,i;if(this.el)return this.offAll(),this._updateResizeEvent(!0),this.setStatic(!0,!1),this.setAnimation(!1),t?this.el.parentNode.removeChild(this.el):(this.removeAll(t),this.el.classList.remove(this._styleSheetClass),this.el.removeAttribute("gs-current-row")),this._removeStylesheet(),(r=this.parentGridNode)==null||delete r.subGrid,delete this.parentGridNode,delete this.opts,(i=this._placeholder)==null||delete i.gridstackNode,delete this._placeholder,delete this.engine,delete this.el.gridstack,delete this.el,this}float(t){return this.opts.float!==t&&(this.opts.float=this.engine.float=t,this._triggerChangeEvent()),this}getFloat(){return this.engine.float}getCellFromPixel(t,r=!1){const i=this.el.getBoundingClientRect();let o;r?o={top:i.top+document.documentElement.scrollTop,left:i.left}:o={top:this.el.offsetTop,left:this.el.offsetLeft};const u=t.left-o.left,c=t.top-o.top,d=i.width/this.getColumn(),p=i.height/parseInt(this.el.getAttribute("gs-current-row"));return{x:Math.floor(u/d),y:Math.floor(c/p)}}getRow(){return Math.max(this.engine.getRow(),this.opts.minRow)}isAreaEmpty(t,r,i,o){return this.engine.isAreaEmpty(t,r,i,o)}makeWidget(t,r){const i=Ne.getElement(t);if(!i)return;i.parentElement||this.el.appendChild(i),this._prepareElement(i,!0,r);const o=i.gridstackNode;this._updateContainerHeight(),o.subGridOpts&&this.makeSubGrid(i,o.subGridOpts,void 0,!1);let u;return this.opts.column===1&&!this._ignoreLayoutsNodeChange&&(u=this._ignoreLayoutsNodeChange=!0),this._triggerAddEvent(),this._triggerChangeEvent(),u&&delete this._ignoreLayoutsNodeChange,i}on(t,r){return t.indexOf(" ")!==-1?(t.split(" ").forEach(o=>this.on(o,r)),this):(t==="change"||t==="added"||t==="removed"||t==="enable"||t==="disable"?(t==="enable"||t==="disable"?this._gsEventHandler[t]=o=>r(o):this._gsEventHandler[t]=o=>{o.detail&&r(o,o.detail)},this.el.addEventListener(t,this._gsEventHandler[t])):t==="drag"||t==="dragstart"||t==="dragstop"||t==="resizestart"||t==="resize"||t==="resizestop"||t==="dropped"||t==="resizecontent"?this._gsEventHandler[t]=r:console.error("GridStack.on("+t+") event not supported"),this)}off(t){return t.indexOf(" ")!==-1?(t.split(" ").forEach(i=>this.off(i)),this):((t==="change"||t==="added"||t==="removed"||t==="enable"||t==="disable")&&this._gsEventHandler[t]&&this.el.removeEventListener(t,this._gsEventHandler[t]),delete this._gsEventHandler[t],this)}offAll(){return Object.keys(this._gsEventHandler).forEach(t=>this.off(t)),this}removeWidget(t,r=!0,i=!0){return t?(Ne.getElements(t).forEach(o=>{if(o.parentElement&&o.parentElement!==this.el)return;let u=o.gridstackNode;u||(u=this.engine.nodes.find(c=>o===c.el)),u&&(r&&Ne.addRemoveCB&&Ne.addRemoveCB(this.el,u,!1,!1),delete o.gridstackNode,this._removeDD(o),this.engine.removeNode(u,r,i),r&&o.parentElement&&o.remove())}),i&&(this._triggerRemoveEvent(),this._triggerChangeEvent()),this):(console.error("Error: GridStack.removeWidget(undefined) called"),this)}removeAll(t=!0,r=!0){return this.engine.nodes.forEach(i=>{t&&Ne.addRemoveCB&&Ne.addRemoveCB(this.el,i,!1,!1),delete i.el.gridstackNode,this.opts.staticGrid||this._removeDD(i.el)}),this.engine.removeAll(t,r),r&&this._triggerRemoveEvent(),this}setAnimation(t=this.opts.animate,r){return r?setTimeout(()=>{this.opts&&this.setAnimation(t)}):t?this.el.classList.add("grid-stack-animate"):this.el.classList.remove("grid-stack-animate"),this}hasAnimationCSS(){return this.el.classList.contains("grid-stack-animate")}setStatic(t,r=!0,i=!0){return!!this.opts.staticGrid===t?this:(t?this.opts.staticGrid=!0:delete this.opts.staticGrid,this._setupRemoveDrop(),this._setupAcceptWidget(),this.engine.nodes.forEach(o=>{this.prepareDragDrop(o.el),o.subGrid&&i&&o.subGrid.setStatic(t,r,i)}),r&&this._setStaticClass(),this)}updateOptions(t){var i;const r=this.opts;return t.acceptWidgets!==void 0&&this._setupAcceptWidget(),t.animate!==void 0&&this.setAnimation(),t.cellHeight&&(this.cellHeight(t.cellHeight,!0),delete t.cellHeight),t.class&&t.class!==r.class&&(r.class&&this.el.classList.remove(r.class),this.el.classList.add(t.class)),typeof t.column=="number"&&!t.columnOpts&&(this.column(t.column),delete t.column),t.margin!==void 0&&this.margin(t.margin),t.staticGrid!==void 0&&this.setStatic(t.staticGrid),t.disableDrag!==void 0&&!t.staticGrid&&this.enableMove(!t.disableDrag),t.disableResize!==void 0&&!t.staticGrid&&this.enableResize(!t.disableResize),t.float!==void 0&&this.float(t.float),t.row!==void 0&&(r.minRow=r.maxRow=t.row),(i=t.children)!=null&&i.length&&(this.load(t.children),delete t.children),this.opts={...this.opts,...t},this}update(t,r){return Ne.getElements(t).forEach(i=>{var w;const o=i==null?void 0:i.gridstackNode;if(!o)return;const u={...A.copyPos({},o),...A.cloneDeep(r)};this.engine.nodeBoundFix(u),delete u.autoPosition;const c=["x","y","w","h"];let d;if(c.some(v=>u[v]!==void 0&&u[v]!==o[v])&&(d={},c.forEach(v=>{d[v]=u[v]!==void 0?u[v]:o[v],delete u[v]})),!d&&(u.minW||u.minH||u.maxW||u.maxH)&&(d={}),u.content!==void 0){const v=i.querySelector(".grid-stack-item-content");v&&v.textContent!==u.content&&(o.content=u.content,Ne.renderCB(v,u),(w=o.subGrid)!=null&&w.el&&(v.appendChild(o.subGrid.el),o.subGrid.opts.styleInHead||o.subGrid._updateStyles(!0))),delete u.content}let p=!1,m=!1;for(const v in u)v[0]!=="_"&&o[v]!==u[v]&&(o[v]=u[v],p=!0,m=m||!this.opts.staticGrid&&(v==="noResize"||v==="noMove"||v==="locked"));if(A.sanitizeMinMax(o),d){const v=d.w!==void 0&&d.w!==o.w;this.moveNode(o,d),v&&o.subGrid?o.subGrid.onResize(this.hasAnimationCSS()?o.w:void 0):this.resizeToContentCheck(v,o),delete o._orig}(d||p)&&this._writeAttr(i,o),m&&this.prepareDragDrop(o.el)}),this}moveNode(t,r){const i=t._updating;i||this.engine.cleanNodes().beginUpdate(t),this.engine.moveNode(t,r),this._updateContainerHeight(),i||(this._triggerChangeEvent(),this.engine.endUpdate())}resizeToContent(t){var x,z;if(!t||(t.classList.remove("size-to-content-max"),!t.clientHeight))return;const r=t.gridstackNode;if(!r)return;const i=r.grid;if(!i||t.parentElement!==i.el)return;const o=i.getCellHeight(!0);if(!o)return;let u=r.h?r.h*o:t.clientHeight,c;if(r.resizeToContentParent&&(c=t.querySelector(r.resizeToContentParent)),c||(c=t.querySelector(Ne.resizeToContentParent)),!c)return;const d=t.clientHeight-c.clientHeight,p=r.h?r.h*o-d:c.clientHeight;let m;if(r.subGrid){m=r.subGrid.getRow()*r.subGrid.getCellHeight(!0);const R=r.subGrid.el.getBoundingClientRect(),k=r.subGrid.el.parentElement.getBoundingClientRect();m+=R.top-k.top}else{if((z=(x=r.subGridOpts)==null?void 0:x.children)!=null&&z.length)return;{const R=c.firstElementChild;if(!R){console.error(`Error: GridStack.resizeToContent() widget id:${r.id} '${Ne.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return}m=R.getBoundingClientRect().height||p}}if(p===m)return;u+=m-p;let w=Math.ceil(u/o);const v=Number.isInteger(r.sizeToContent)?r.sizeToContent:0;v&&w>v&&(w=v,t.classList.add("size-to-content-max")),r.minH&&wr.maxH&&(w=r.maxH),w!==r.h&&(i._ignoreLayoutsNodeChange=!0,i.moveNode(r,{h:w}),delete i._ignoreLayoutsNodeChange)}resizeToContentCBCheck(t){Ne.resizeToContentCB?Ne.resizeToContentCB(t):this.resizeToContent(t)}rotate(t,r){return Ne.getElements(t).forEach(i=>{const o=i.gridstackNode;if(!A.canBeRotated(o))return;const u={w:o.h,h:o.w,minH:o.minW,minW:o.minH,maxH:o.maxW,maxW:o.maxH};if(r){const d=r.left>0?Math.floor(r.left/this.cellWidth()):0,p=r.top>0?Math.floor(r.top/this.opts.cellHeight):0;u.x=o.x+d-(o.h-(p+1)),u.y=o.y+p-d}Object.keys(u).forEach(d=>{u[d]===void 0&&delete u[d]});const c=o._orig;this.update(i,u),o._orig=c}),this}margin(t){if(!(typeof t=="string"&&t.split(" ").length>1)){const i=A.parseHeight(t);if(this.opts.marginUnit===i.unit&&this.opts.margin===i.h)return}return this.opts.margin=t,this.opts.marginTop=this.opts.marginBottom=this.opts.marginLeft=this.opts.marginRight=void 0,this._initMargin(),this._updateStyles(!0),this}getMargin(){return this.opts.margin}willItFit(t){if(arguments.length>1){console.warn("gridstack.ts: `willItFit(x,y,w,h,autoPosition)` is deprecated. Use `willItFit({x, y,...})`. It will be removed soon");const r=arguments;let i=0,o={x:r[i++],y:r[i++],w:r[i++],h:r[i++],autoPosition:r[i++]};return this.willItFit(o)}return this.engine.willItFit(t)}_triggerChangeEvent(){if(this.engine.batchMode)return this;const t=this.engine.getDirtyNodes(!0);return t&&t.length&&(this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(t),this._triggerEvent("change",t)),this.engine.saveInitial(),this}_triggerAddEvent(){var t;if(this.engine.batchMode)return this;if((t=this.engine.addedNodes)!=null&&t.length){this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(this.engine.addedNodes),this.engine.addedNodes.forEach(i=>{delete i._dirty});const r=[...this.engine.addedNodes];this.engine.addedNodes=[],this._triggerEvent("added",r)}return this}_triggerRemoveEvent(){var t;if(this.engine.batchMode)return this;if((t=this.engine.removedNodes)!=null&&t.length){const r=[...this.engine.removedNodes];this.engine.removedNodes=[],this._triggerEvent("removed",r)}return this}_triggerEvent(t,r){const i=r?new CustomEvent(t,{bubbles:!1,detail:r}):new Event(t);return this.el.dispatchEvent(i),this}_removeStylesheet(){if(this._styles){const t=this.opts.styleInHead?void 0:this.el.parentNode;A.removeStylesheet(this._styleSheetClass,t),delete this._styles}return this}_updateStyles(t=!1,r){if(t&&this._removeStylesheet(),r===void 0&&(r=this.getRow()),this._updateContainerHeight(),this.opts.cellHeight===0)return this;const i=this.opts.cellHeight,o=this.opts.cellHeightUnit,u=`.${this._styleSheetClass} > .${this.opts.itemClass}`;if(!this._styles){const c=this.opts.styleInHead?void 0:this.el.parentNode;if(this._styles=A.createStylesheet(this._styleSheetClass,c,{nonce:this.opts.nonce}),!this._styles)return this;this._styles._max=0,A.addCSSRule(this._styles,u,`height: ${i}${o}`);const d=this.opts.marginTop+this.opts.marginUnit,p=this.opts.marginBottom+this.opts.marginUnit,m=this.opts.marginRight+this.opts.marginUnit,w=this.opts.marginLeft+this.opts.marginUnit,v=`${u} > .grid-stack-item-content`,x=`.${this._styleSheetClass} > .grid-stack-placeholder > .placeholder-content`;A.addCSSRule(this._styles,v,`top: ${d}; right: ${m}; bottom: ${p}; left: ${w};`),A.addCSSRule(this._styles,x,`top: ${d}; right: ${m}; bottom: ${p}; left: ${w};`),A.addCSSRule(this._styles,`${u} > .ui-resizable-n`,`top: ${d};`),A.addCSSRule(this._styles,`${u} > .ui-resizable-s`,`bottom: ${p}`),A.addCSSRule(this._styles,`${u} > .ui-resizable-ne`,`right: ${m}; top: ${d}`),A.addCSSRule(this._styles,`${u} > .ui-resizable-e`,`right: ${m}`),A.addCSSRule(this._styles,`${u} > .ui-resizable-se`,`right: ${m}; bottom: ${p}`),A.addCSSRule(this._styles,`${u} > .ui-resizable-nw`,`left: ${w}; top: ${d}`),A.addCSSRule(this._styles,`${u} > .ui-resizable-w`,`left: ${w}`),A.addCSSRule(this._styles,`${u} > .ui-resizable-sw`,`left: ${w}; bottom: ${p}`)}if(r=r||this._styles._max,r>this._styles._max){const c=d=>i*d+o;for(let d=this._styles._max+1;d<=r;d++)A.addCSSRule(this._styles,`${u}[gs-y="${d}"]`,`top: ${c(d)}`),A.addCSSRule(this._styles,`${u}[gs-h="${d+1}"]`,`height: ${c(d+1)}`);this._styles._max=r}return this}_updateContainerHeight(){if(!this.engine||this.engine.batchMode)return this;const t=this.parentGridNode;let r=this.getRow()+this._extraDragRow;const i=this.opts.cellHeight,o=this.opts.cellHeightUnit;if(!i)return this;if(!t){const u=A.parseHeight(getComputedStyle(this.el).minHeight);if(u.h>0&&u.unit===o){const c=Math.floor(u.h/i);r1?t.setAttribute("gs-w",String(r.w)):t.removeAttribute("gs-w"),r.h>1?t.setAttribute("gs-h",String(r.h)):t.removeAttribute("gs-h"),this}_writeAttr(t,r){if(!r)return this;this._writePosAttr(t,r);const i={noResize:"gs-no-resize",noMove:"gs-no-move",locked:"gs-locked",id:"gs-id",sizeToContent:"gs-size-to-content"};for(const o in i)r[o]?t.setAttribute(i[o],String(r[o])):t.removeAttribute(i[o]);return this}_readAttr(t,r=!0){const i={};i.x=A.toNumber(t.getAttribute("gs-x")),i.y=A.toNumber(t.getAttribute("gs-y")),i.w=A.toNumber(t.getAttribute("gs-w")),i.h=A.toNumber(t.getAttribute("gs-h")),i.autoPosition=A.toBool(t.getAttribute("gs-auto-position")),i.noResize=A.toBool(t.getAttribute("gs-no-resize")),i.noMove=A.toBool(t.getAttribute("gs-no-move")),i.locked=A.toBool(t.getAttribute("gs-locked"));const o=t.getAttribute("gs-size-to-content");o&&(o==="true"||o==="false"?i.sizeToContent=A.toBool(o):i.sizeToContent=parseInt(o,10)),i.id=t.getAttribute("gs-id"),i.maxW=A.toNumber(t.getAttribute("gs-max-w")),i.minW=A.toNumber(t.getAttribute("gs-min-w")),i.maxH=A.toNumber(t.getAttribute("gs-max-h")),i.minH=A.toNumber(t.getAttribute("gs-min-h")),r&&(i.w===1&&t.removeAttribute("gs-w"),i.h===1&&t.removeAttribute("gs-h"),i.maxW&&t.removeAttribute("gs-max-w"),i.minW&&t.removeAttribute("gs-min-w"),i.maxH&&t.removeAttribute("gs-max-h"),i.minH&&t.removeAttribute("gs-min-h"));for(const u in i){if(!i.hasOwnProperty(u))return;!i[u]&&i[u]!==0&&u!=="gs-size-to-content"&&delete i[u]}return i}_setStaticClass(){const t=["grid-stack-static"];return this.opts.staticGrid?(this.el.classList.add(...t),this.el.setAttribute("gs-static","true")):(this.el.classList.remove(...t),this.el.removeAttribute("gs-static")),this}onResize(t=(r=>(r=this.el)==null?void 0:r.clientWidth)()){if(!t||this.prevWidth===t)return;this.prevWidth=t,this.batchUpdate();let i=!1;return this._autoColumn&&this.parentGridNode?this.opts.column!==this.parentGridNode.w&&(this.column(this.parentGridNode.w,this.opts.layout||"list"),i=!0):i=this.checkDynamicColumn(),this._isAutoCellHeight&&this.cellHeight(),this.engine.nodes.forEach(o=>{o.subGrid&&o.subGrid.onResize()}),this._skipInitialResize||this.resizeToContentCheck(i),delete this._skipInitialResize,this.batchUpdate(!1),this}resizeToContentCheck(t=!1,r=void 0){if(this.engine){if(t&&this.hasAnimationCSS())return setTimeout(()=>this.resizeToContentCheck(!1,r),this.animationDelay);if(r)A.shouldSizeToContent(r)&&this.resizeToContentCBCheck(r.el);else if(this.engine.nodes.some(i=>A.shouldSizeToContent(i))){const i=[...this.engine.nodes];this.batchUpdate(),i.forEach(o=>{A.shouldSizeToContent(o)&&this.resizeToContentCBCheck(o.el)}),this.batchUpdate(!1)}this._gsEventHandler.resizecontent&&this._gsEventHandler.resizecontent(null,r?[r]:this.engine.nodes)}}_updateResizeEvent(t=!1){const r=!this.parentGridNode&&(this._isAutoCellHeight||this.opts.sizeToContent||this.opts.columnOpts||this.engine.nodes.find(i=>i.sizeToContent));return!t&&r&&!this.resizeObserver?(this._sizeThrottle=A.throttle(()=>this.onResize(),this.opts.cellHeightThrottle),this.resizeObserver=new ResizeObserver(()=>this._sizeThrottle()),this.resizeObserver.observe(this.el),this._skipInitialResize=!0):(t||!r)&&this.resizeObserver&&(this.resizeObserver.disconnect(),delete this.resizeObserver,delete this._sizeThrottle),this}static getElement(t=".grid-stack-item"){return A.getElement(t)}static getElements(t=".grid-stack-item"){return A.getElements(t)}static getGridElement(t){return Ne.getElement(t)}static getGridElements(t){return A.getElements(t)}_initMargin(){let t,r=0,i=[];return typeof this.opts.margin=="string"&&(i=this.opts.margin.split(" ")),i.length===2?(this.opts.marginTop=this.opts.marginBottom=i[0],this.opts.marginLeft=this.opts.marginRight=i[1]):i.length===4?(this.opts.marginTop=i[0],this.opts.marginRight=i[1],this.opts.marginBottom=i[2],this.opts.marginLeft=i[3]):(t=A.parseHeight(this.opts.margin),this.opts.marginUnit=t.unit,r=this.opts.margin=t.h),this.opts.marginTop===void 0?this.opts.marginTop=r:(t=A.parseHeight(this.opts.marginTop),this.opts.marginTop=t.h,delete this.opts.margin),this.opts.marginBottom===void 0?this.opts.marginBottom=r:(t=A.parseHeight(this.opts.marginBottom),this.opts.marginBottom=t.h,delete this.opts.margin),this.opts.marginRight===void 0?this.opts.marginRight=r:(t=A.parseHeight(this.opts.marginRight),this.opts.marginRight=t.h,delete this.opts.margin),this.opts.marginLeft===void 0?this.opts.marginLeft=r:(t=A.parseHeight(this.opts.marginLeft),this.opts.marginLeft=t.h,delete this.opts.margin),this.opts.marginUnit=t.unit,this.opts.marginTop===this.opts.marginBottom&&this.opts.marginLeft===this.opts.marginRight&&this.opts.marginTop===this.opts.marginRight&&(this.opts.margin=this.opts.marginTop),this}static getDD(){return $n}static setupDragIn(t,r,i,o=document){(r==null?void 0:r.pause)!==void 0&&(Le.pauseDrag=r.pause),r={appendTo:"body",helper:"clone",...r||{}},(typeof t=="string"?A.getElements(t,o):t).forEach((c,d)=>{$n.isDraggable(c)||$n.dragIn(c,r),i!=null&&i[d]&&(c.gridstackNode=i[d])})}movable(t,r){return this.opts.staticGrid?this:(Ne.getElements(t).forEach(i=>{const o=i.gridstackNode;o&&(r?delete o.noMove:o.noMove=!0,this.prepareDragDrop(o.el))}),this)}resizable(t,r){return this.opts.staticGrid?this:(Ne.getElements(t).forEach(i=>{const o=i.gridstackNode;o&&(r?delete o.noResize:o.noResize=!0,this.prepareDragDrop(o.el))}),this)}disable(t=!0){if(!this.opts.staticGrid)return this.enableMove(!1,t),this.enableResize(!1,t),this._triggerEvent("disable"),this}enable(t=!0){if(!this.opts.staticGrid)return this.enableMove(!0,t),this.enableResize(!0,t),this._triggerEvent("enable"),this}enableMove(t,r=!0){return this.opts.staticGrid?this:(t?delete this.opts.disableDrag:this.opts.disableDrag=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&r&&i.subGrid.enableMove(t,r)}),this)}enableResize(t,r=!0){return this.opts.staticGrid?this:(t?delete this.opts.disableResize:this.opts.disableResize=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&r&&i.subGrid.enableResize(t,r)}),this)}cancelDrag(){var r;const t=(r=this._placeholder)==null?void 0:r.gridstackNode;t&&(t._isExternal?(t._isAboutToRemove=!0,this.engine.removeNode(t)):t._isAboutToRemove&&Ne._itemRemoving(t.el,!1),this.engine.restoreInitial())}_removeDD(t){return $n.draggable(t,"destroy").resizable(t,"destroy"),t.gridstackNode&&delete t.gridstackNode._initDD,delete t.ddElement,this}_setupAcceptWidget(){if(this.opts.staticGrid||!this.opts.acceptWidgets&&!this.opts.removable)return $n.droppable(this.el,"destroy"),this;let t,r;const i=(o,u,c)=>{var x;c=c||u;const d=c.gridstackNode;if(!d)return;if(!((x=d.grid)!=null&&x.el)){c.style.transform=`scale(${1/this.dragTransform.xScale},${1/this.dragTransform.yScale})`;const z=c.getBoundingClientRect();c.style.left=z.x+(this.dragTransform.xScale-1)*(o.clientX-z.x)/this.dragTransform.xScale+"px",c.style.top=z.y+(this.dragTransform.yScale-1)*(o.clientY-z.y)/this.dragTransform.yScale+"px",c.style.transformOrigin="0px 0px"}let{top:p,left:m}=c.getBoundingClientRect();const w=this.el.getBoundingClientRect();m-=w.left,p-=w.top;const v={position:{top:p*this.dragTransform.xScale,left:m*this.dragTransform.yScale}};if(d._temporaryRemoved){if(d.x=Math.max(0,Math.round(m/r)),d.y=Math.max(0,Math.round(p/t)),delete d.autoPosition,this.engine.nodeBoundFix(d),!this.engine.willItFit(d)){if(d.autoPosition=!0,!this.engine.willItFit(d)){$n.off(u,"drag");return}d._willFitPos&&(A.copyPos(d,d._willFitPos),delete d._willFitPos)}this._onStartMoving(c,o,v,d,r,t)}else this._dragOrResize(c,o,v,d,r,t)};return $n.droppable(this.el,{accept:o=>{const u=o.gridstackNode||this._readAttr(o,!1);if((u==null?void 0:u.grid)===this)return!0;if(!this.opts.acceptWidgets)return!1;let c=!0;if(typeof this.opts.acceptWidgets=="function")c=this.opts.acceptWidgets(o);else{const d=this.opts.acceptWidgets===!0?".grid-stack-item":this.opts.acceptWidgets;c=o.matches(d)}if(c&&u&&this.opts.maxRow){const d={w:u.w,h:u.h,minW:u.minW,minH:u.minH};c=this.engine.willItFit(d)}return c}}).on(this.el,"dropover",(o,u,c)=>{let d=(c==null?void 0:c.gridstackNode)||u.gridstackNode;if((d==null?void 0:d.grid)===this&&!d._temporaryRemoved)return!1;if(d!=null&&d._sidebarOrig&&(d.w=d._sidebarOrig.w,d.h=d._sidebarOrig.h),d!=null&&d.grid&&d.grid!==this&&!d._temporaryRemoved&&d.grid._leave(u,c),c=c||u,r=this.cellWidth(),t=this.getCellHeight(!0),!d){const w=c.getAttribute("data-gs-widget")||c.getAttribute("gridstacknode");if(w){try{d=JSON.parse(w)}catch{console.error("Gridstack dropover: Bad JSON format: ",w)}c.removeAttribute("data-gs-widget"),c.removeAttribute("gridstacknode")}d||(d=this._readAttr(c)),d._sidebarOrig={w:d.w,h:d.h}}d.grid||(d.el||(d={...d}),d._isExternal=!0,c.gridstackNode=d);const p=d.w||Math.round(c.offsetWidth/r)||1,m=d.h||Math.round(c.offsetHeight/t)||1;return d.grid&&d.grid!==this?(u._gridstackNodeOrig||(u._gridstackNodeOrig=d),u.gridstackNode=d={...d,w:p,h:m,grid:this},delete d.x,delete d.y,this.engine.cleanupNode(d).nodeBoundFix(d),d._initDD=d._isExternal=d._temporaryRemoved=!0):(d.w=p,d.h=m,d._temporaryRemoved=!0),Ne._itemRemoving(d.el,!1),$n.on(u,"drag",i),i(o,u,c),!1}).on(this.el,"dropout",(o,u,c)=>{const d=(c==null?void 0:c.gridstackNode)||u.gridstackNode;return d&&(!d.grid||d.grid===this)&&(this._leave(u,c),this._isTemp&&this.removeAsSubGrid(d)),!1}).on(this.el,"drop",(o,u,c)=>{var z,R,k;const d=(c==null?void 0:c.gridstackNode)||u.gridstackNode;if((d==null?void 0:d.grid)===this&&!d._isExternal)return!1;const p=!!this.placeholder.parentElement,m=u!==c;this.placeholder.remove(),delete this.placeholder.gridstackNode;const w=p&&this.opts.animate;w&&this.setAnimation(!1);const v=u._gridstackNodeOrig;if(delete u._gridstackNodeOrig,p&&(v!=null&&v.grid)&&v.grid!==this){const b=v.grid;b.engine.removeNodeFromLayoutCache(v),b.engine.removedNodes.push(v),b._triggerRemoveEvent()._triggerChangeEvent(),b.parentGridNode&&!b.engine.nodes.length&&b.opts.subGridDynamic&&b.removeAsSubGrid()}if(!d||(p&&(this.engine.cleanupNode(d),d.grid=this),(z=d.grid)==null||delete z._isTemp,$n.off(u,"drag"),c!==u?(c.remove(),u=c):u.remove(),this._removeDD(u),!p))return!1;const x=(k=(R=d.subGrid)==null?void 0:R.el)==null?void 0:k.gridstack;return A.copyPos(d,this._readAttr(this.placeholder)),A.removePositioningStyles(u),m&&(d.content||d.subGridOpts||Ne.addRemoveCB)?(delete d.el,u=this.addWidget(d)):(this._prepareElement(u,!0,d),this.el.appendChild(u),this.resizeToContentCheck(!1,d),x&&(x.parentGridNode=d,x.opts.styleInHead||x._updateStyles(!0)),this._updateContainerHeight()),this.engine.addedNodes.push(d),this._triggerAddEvent(),this._triggerChangeEvent(),this.engine.endUpdate(),this._gsEventHandler.dropped&&this._gsEventHandler.dropped({...o,type:"dropped"},v&&v.grid?v:void 0,d),w&&this.setAnimation(this.opts.animate,!0),!1}),this}static _itemRemoving(t,r){if(!t)return;const i=t?t.gridstackNode:void 0;!(i!=null&&i.grid)||t.classList.contains(i.grid.opts.removableOptions.decline)||(r?i._isAboutToRemove=!0:delete i._isAboutToRemove,r?t.classList.add("grid-stack-item-removing"):t.classList.remove("grid-stack-item-removing"))}_setupRemoveDrop(){if(typeof this.opts.removable!="string")return this;const t=document.querySelector(this.opts.removable);return t?(!this.opts.staticGrid&&!$n.isDroppable(t)&&$n.droppable(t,this.opts.removableOptions).on(t,"dropover",(r,i)=>Ne._itemRemoving(i,!0)).on(t,"dropout",(r,i)=>Ne._itemRemoving(i,!1)),this):this}prepareDragDrop(t,r=!1){const i=t==null?void 0:t.gridstackNode;if(!i)return;const o=i.noMove||this.opts.disableDrag,u=i.noResize||this.opts.disableResize,c=this.opts.staticGrid||o&&u;if((r||c)&&(i._initDD&&(this._removeDD(t),delete i._initDD),c&&t.classList.add("ui-draggable-disabled","ui-resizable-disabled"),!r))return this;if(!i._initDD){let d,p;const m=(x,z)=>{this._gsEventHandler[x.type]&&this._gsEventHandler[x.type](x,x.target),d=this.cellWidth(),p=this.getCellHeight(!0),this._onStartMoving(t,x,z,i,d,p)},w=(x,z)=>{this._dragOrResize(t,x,z,i,d,p)},v=x=>{this.placeholder.remove(),delete this.placeholder.gridstackNode,delete i._moving,delete i._event,delete i._lastTried;const z=i.w!==i._orig.w,R=x.target;if(!(!R.gridstackNode||R.gridstackNode.grid!==this)){if(i.el=R,i._isAboutToRemove){const k=t.gridstackNode.grid;k._gsEventHandler[x.type]&&k._gsEventHandler[x.type](x,R),k.engine.nodes.push(i),k.removeWidget(t,!0,!0)}else A.removePositioningStyles(R),i._temporaryRemoved?(A.copyPos(i,i._orig),this._writePosAttr(R,i),this.engine.addNode(i)):this._writePosAttr(R,i),this._gsEventHandler[x.type]&&this._gsEventHandler[x.type](x,R);this._extraDragRow=0,this._updateContainerHeight(),this._triggerChangeEvent(),this.engine.endUpdate(),x.type==="resizestop"&&(Number.isInteger(i.sizeToContent)&&(i.sizeToContent=i.h),this.resizeToContentCheck(z,i))}};$n.draggable(t,{start:m,stop:v,drag:w}).resizable(t,{start:m,stop:v,resize:w}),i._initDD=!0}return $n.draggable(t,o?"disable":"enable").resizable(t,u?"disable":"enable"),this}_onStartMoving(t,r,i,o,u,c){var d;if(this.engine.cleanNodes().beginUpdate(o),this._writePosAttr(this.placeholder,o),this.el.appendChild(this.placeholder),this.placeholder.gridstackNode=o,(d=o.grid)!=null&&d.el)this.dragTransform=A.getValuesFromTransformedElement(t);else if(this.placeholder&&this.placeholder.closest(".grid-stack")){const p=this.placeholder.closest(".grid-stack");this.dragTransform=A.getValuesFromTransformedElement(p)}else this.dragTransform={xScale:1,xOffset:0,yScale:1,yOffset:0};if(o.el=this.placeholder,o._lastUiPosition=i.position,o._prevYPix=i.position.top,o._moving=r.type==="dragstart",delete o._lastTried,r.type==="dropover"&&o._temporaryRemoved&&(this.engine.addNode(o),o._moving=!0),this.engine.cacheRects(u,c,this.opts.marginTop,this.opts.marginRight,this.opts.marginBottom,this.opts.marginLeft),r.type==="resizestart"){const p=this.getColumn()-o.x,m=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-o.y;$n.resizable(t,"option","minWidth",u*Math.min(o.minW||1,p)).resizable(t,"option","minHeight",c*Math.min(o.minH||1,m)).resizable(t,"option","maxWidth",u*Math.min(o.maxW||Number.MAX_SAFE_INTEGER,p)).resizable(t,"option","maxWidthMoveLeft",u*Math.min(o.maxW||Number.MAX_SAFE_INTEGER,o.x+o.w)).resizable(t,"option","maxHeight",c*Math.min(o.maxH||Number.MAX_SAFE_INTEGER,m)).resizable(t,"option","maxHeightMoveUp",c*Math.min(o.maxH||Number.MAX_SAFE_INTEGER,o.y+o.h))}}_dragOrResize(t,r,i,o,u,c){const d={...o._orig};let p,m=this.opts.marginLeft,w=this.opts.marginRight,v=this.opts.marginTop,x=this.opts.marginBottom;const z=Math.round(c*.1),R=Math.round(u*.1);if(m=Math.min(m,R),w=Math.min(w,R),v=Math.min(v,z),x=Math.min(x,z),r.type==="drag"){if(o._temporaryRemoved)return;const b=i.position.top-o._prevYPix;o._prevYPix=i.position.top,this.opts.draggable.scroll!==!1&&A.updateScrollPosition(t,i.position,b);const W=i.position.left+(i.position.left>o._lastUiPosition.left?-w:m),P=i.position.top+(i.position.top>o._lastUiPosition.top?-x:v);d.x=Math.round(W/u),d.y=Math.round(P/c);const B=this._extraDragRow;if(this.engine.collide(o,d)){const V=this.getRow();let ee=Math.max(0,d.y+o.h-V);this.opts.maxRow&&V+ee>this.opts.maxRow&&(ee=Math.max(0,this.opts.maxRow-V)),this._extraDragRow=ee}else this._extraDragRow=0;if(this._extraDragRow!==B&&this._updateContainerHeight(),o.x===d.x&&o.y===d.y)return}else if(r.type==="resize"){if(d.x<0||(A.updateScrollResize(r,t,c),d.w=Math.round((i.size.width-m)/u),d.h=Math.round((i.size.height-v)/c),o.w===d.w&&o.h===d.h)||o._lastTried&&o._lastTried.w===d.w&&o._lastTried.h===d.h)return;const b=i.position.left+m,W=i.position.top+v;d.x=Math.round(b/u),d.y=Math.round(W/c),p=!0}o._event=r,o._lastTried=d;const k={x:i.position.left+m,y:i.position.top+v,w:(i.size?i.size.width:o.w*u)-m-w,h:(i.size?i.size.height:o.h*c)-v-x};if(this.engine.moveNodeCheck(o,{...d,cellWidth:u,cellHeight:c,rect:k,resizing:p})){o._lastUiPosition=i.position,this.engine.cacheRects(u,c,v,w,x,m),delete o._skipDown,p&&o.subGrid&&o.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();const b=r.target;o._sidebarOrig||this._writePosAttr(b,o),this._gsEventHandler[r.type]&&this._gsEventHandler[r.type](r,b)}}_leave(t,r){r=r||t;const i=r.gridstackNode;if(!i||(r.style.transform=r.style.transformOrigin=null,$n.off(t,"drag"),i._temporaryRemoved))return;i._temporaryRemoved=!0,this.engine.removeNode(i),i.el=i._isExternal&&r?r:t;const o=i._sidebarOrig;i._isExternal&&this.engine.cleanupNode(i),i._sidebarOrig=o,this.opts.removable===!0&&Ne._itemRemoving(t,!0),t._gridstackNodeOrig?(t.gridstackNode=t._gridstackNodeOrig,delete t._gridstackNodeOrig):i._isExternal&&this.engine.restoreInitial()}commit(){return CS(this,this.batchUpdate(!1),"commit","batchUpdate","5.2"),this}}Ne.renderCB=(l,t)=>{l&&(t!=null&&t.content)&&(l.textContent=t.content)};Ne.resizeToContentParent=".grid-stack-item-content";Ne.Utils=A;Ne.Engine=ai;Ne.GDRev="11.5.1";function DS({widget:l,onRemove:t}){const r=vS[l.kind];return U.jsxs("div",{className:"widget",children:[U.jsxs("div",{className:"widget-header",children:[U.jsx("span",{className:"widget-grip","aria-hidden":!0,children:"⠿"}),U.jsx("span",{className:"widget-icon",children:r==null?void 0:r.icon}),U.jsx("span",{className:"widget-title",children:(r==null?void 0:r.title)||l.kind}),U.jsx("button",{className:"widget-close",title:"Remove widget",onClick:t,children:"×"})]}),U.jsx("div",{className:"widget-body",children:r?r.render(l.id):null})]})}function TS(){const l=Eo(w=>w.widgets),t=Eo(w=>w.updateGeom),r=Eo(w=>w.removeWidget),i=j.useRef(null),o=j.useRef(null),u=j.useRef(new Map),[c,d]=j.useState(new Map),[p,m]=j.useState(!1);return j.useEffect(()=>{if(!i.current)return;const w=Ne.init({column:12,cellHeight:56,margin:8,float:!0,handle:".widget-header",resizable:{handles:"e, se, s, sw, w"},animate:!0},i.current);return o.current=w,w.on("change",(v,x)=>{const z=x.map(R=>({id:String(R.id),x:R.x??0,y:R.y??0,w:R.w??1,h:R.h??1}));z.length&&t(z)}),m(!0),()=>{w.destroy(!1),o.current=null}},[t]),j.useEffect(()=>{const w=o.current;if(!w||!p)return;const v=new Set(l.map(R=>R.id));let x=!1;const z=new Map(c);w.batchUpdate();for(const R of l){if(u.current.has(R.id))continue;const k=w.addWidget({x:R.x,y:R.y,w:R.w,h:R.h,id:R.id}),b=k.querySelector(".grid-stack-item-content");u.current.set(R.id,k),z.set(R.id,b),x=!0}for(const[R,k]of Array.from(u.current.entries()))v.has(R)||(w.removeWidget(k,!0),u.current.delete(R),z.delete(R),x=!0);w.commit(),x&&d(z)},[l,p]),U.jsxs("div",{className:"canvas",children:[U.jsx("div",{className:"grid-stack",ref:i}),l.map(w=>{const v=c.get(w.id);return v?bs.createPortal(U.jsx(DS,{widget:w,onRemove:()=>r(w.id)}),v,w.id):null})]})}function zS(){const l=gn(d=>d.addSignalToPlot),t=gn(d=>d.setMotorTypes),[r,i]=j.useState(null),o=ly(sy(Vf,{activationConstraint:{distance:4}}));j.useEffect(()=>{Am(),F1().then(t)},[t]);const u=d=>{var m;const p=(m=d.active.data.current)==null?void 0:m.signalId;i(p?Af(p):null)},c=d=>{var w,v,x,z;i(null);const p=(w=d.active.data.current)==null?void 0:w.signalId,m=((x=(v=d.over)==null?void 0:v.id)==null?void 0:x.toString())||"";if(p&&m.startsWith("plot:")){const R=(z=d.over.data.current)==null?void 0:z.panelId;l(R,p)}};return U.jsxs(r0,{sensors:o,onDragStart:u,onDragEnd:c,children:[U.jsxs("div",{className:"app",children:[U.jsx(SS,{}),U.jsxs("div",{className:"body",children:[U.jsx(ES,{}),U.jsx("main",{className:"canvas-host",children:U.jsx(TS,{})})]})]}),U.jsx(E0,{dropAnimation:null,children:r?U.jsx("div",{className:"drag-ghost",children:r}):null})]})}wS();$v.createRoot(document.getElementById("root")).render(U.jsx(ht.StrictMode,{children:U.jsx(zS,{})})); diff --git a/damiao_motor/gui/webapp/dist/assets/index-UZFR7yIJ.js b/damiao_motor/gui/webapp/dist/assets/index-UZFR7yIJ.js deleted file mode 100644 index 9f116cf..0000000 --- a/damiao_motor/gui/webapp/dist/assets/index-UZFR7yIJ.js +++ /dev/null @@ -1,54 +0,0 @@ -var Pv=Object.defineProperty;var Av=(l,t,r)=>t in l?Pv(l,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[t]=r;var fo=(l,t,r)=>Av(l,typeof t!="symbol"?t+"":t,r);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const u of o)if(u.type==="childList")for(const c of u.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&i(c)}).observe(document,{childList:!0,subtree:!0});function r(o){const u={};return o.integrity&&(u.integrity=o.integrity),o.referrerPolicy&&(u.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?u.credentials="include":o.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function i(o){if(o.ep)return;o.ep=!0;const u=r(o);fetch(o.href,u)}})();function kg(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var Zc={exports:{}},ho={},ef={exports:{}},Be={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var rp;function Iv(){if(rp)return Be;rp=1;var l=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),v=Symbol.iterator;function x(D){return D===null||typeof D!="object"?null:(D=v&&D[v]||D["@@iterator"],typeof D=="function"?D:null)}var z={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},R=Object.assign,k={};function b(D,H,K){this.props=D,this.context=H,this.refs=k,this.updater=K||z}b.prototype.isReactComponent={},b.prototype.setState=function(D,H){if(typeof D!="object"&&typeof D!="function"&&D!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,D,H,"setState")},b.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function U(){}U.prototype=b.prototype;function P(D,H,K){this.props=D,this.context=H,this.refs=k,this.updater=K||z}var W=P.prototype=new U;W.constructor=P,R(W,b.prototype),W.isPureReactComponent=!0;var V=Array.isArray,Z=Object.prototype.hasOwnProperty,G={current:null},ee={key:!0,ref:!0,__self:!0,__source:!0};function re(D,H,K){var xe,be={},ge=null,_e=null;if(H!=null)for(xe in H.ref!==void 0&&(_e=H.ref),H.key!==void 0&&(ge=""+H.key),H)Z.call(H,xe)&&!ee.hasOwnProperty(xe)&&(be[xe]=H[xe]);var He=arguments.length-2;if(He===1)be.children=K;else if(1>>1,H=ie[D];if(0>>1;Do(be,X))geo(_e,be)?(ie[D]=_e,ie[ge]=X,D=ge):(ie[D]=be,ie[xe]=X,D=xe);else if(geo(_e,X))ie[D]=_e,ie[ge]=X,D=ge;else break e}}return oe}function o(ie,oe){var X=ie.sortIndex-oe.sortIndex;return X!==0?X:ie.id-oe.id}if(typeof performance=="object"&&typeof performance.now=="function"){var u=performance;l.unstable_now=function(){return u.now()}}else{var c=Date,d=c.now();l.unstable_now=function(){return c.now()-d}}var p=[],m=[],w=1,v=null,x=3,z=!1,R=!1,k=!1,b=typeof setTimeout=="function"?setTimeout:null,U=typeof clearTimeout=="function"?clearTimeout:null,P=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function W(ie){for(var oe=r(m);oe!==null;){if(oe.callback===null)i(m);else if(oe.startTime<=ie)i(m),oe.sortIndex=oe.expirationTime,t(p,oe);else break;oe=r(m)}}function V(ie){if(k=!1,W(ie),!R)if(r(p)!==null)R=!0,De(Z);else{var oe=r(m);oe!==null&&le(V,oe.startTime-ie)}}function Z(ie,oe){R=!1,k&&(k=!1,U(re),re=-1),z=!0;var X=x;try{for(W(oe),v=r(p);v!==null&&(!(v.expirationTime>oe)||ie&&!Y());){var D=v.callback;if(typeof D=="function"){v.callback=null,x=v.priorityLevel;var H=D(v.expirationTime<=oe);oe=l.unstable_now(),typeof H=="function"?v.callback=H:v===r(p)&&i(p),W(oe)}else i(p);v=r(p)}if(v!==null)var K=!0;else{var xe=r(m);xe!==null&&le(V,xe.startTime-oe),K=!1}return K}finally{v=null,x=X,z=!1}}var G=!1,ee=null,re=-1,ve=5,de=-1;function Y(){return!(l.unstable_now()-deie||125D?(ie.sortIndex=X,t(m,ie),r(p)===null&&ie===r(m)&&(k?(U(re),re=-1):k=!0,le(V,X-D))):(ie.sortIndex=H,t(p,ie),R||z||(R=!0,De(Z))),ie},l.unstable_shouldYield=Y,l.unstable_wrapCallback=function(ie){var oe=x;return function(){var X=x;x=oe;try{return ie.apply(this,arguments)}finally{x=X}}}})(rf)),rf}var ap;function Wv(){return ap||(ap=1,nf.exports=jv()),nf.exports}/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var up;function Bv(){if(up)return ir;up=1;var l=Hf(),t=Wv();function r(e){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+e,s=1;s"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),p=Object.prototype.hasOwnProperty,m=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,w={},v={};function x(e){return p.call(v,e)?!0:p.call(w,e)?!1:m.test(e)?v[e]=!0:(w[e]=!0,!1)}function z(e,n,s,a){if(s!==null&&s.type===0)return!1;switch(typeof n){case"function":case"symbol":return!0;case"boolean":return a?!1:s!==null?!s.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function R(e,n,s,a){if(n===null||typeof n>"u"||z(e,n,s,a))return!0;if(a)return!1;if(s!==null)switch(s.type){case 3:return!n;case 4:return n===!1;case 5:return isNaN(n);case 6:return isNaN(n)||1>n}return!1}function k(e,n,s,a,f,h,y){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=a,this.attributeNamespace=f,this.mustUseProperty=s,this.propertyName=e,this.type=n,this.sanitizeURL=h,this.removeEmptyString=y}var b={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){b[e]=new k(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var n=e[0];b[n]=new k(n,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){b[e]=new k(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){b[e]=new k(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){b[e]=new k(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){b[e]=new k(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){b[e]=new k(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){b[e]=new k(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){b[e]=new k(e,5,!1,e.toLowerCase(),null,!1,!1)});var U=/[\-:]([a-z])/g;function P(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var n=e.replace(U,P);b[n]=new k(n,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var n=e.replace(U,P);b[n]=new k(n,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var n=e.replace(U,P);b[n]=new k(n,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){b[e]=new k(e,1,!1,e.toLowerCase(),null,!1,!1)}),b.xlinkHref=new k("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){b[e]=new k(e,1,!1,e.toLowerCase(),null,!0,!0)});function W(e,n,s,a){var f=b.hasOwnProperty(n)?b[n]:null;(f!==null?f.type!==0:a||!(2C||f[y]!==h[C]){var N=` -`+f[y].replace(" at new "," at ");return e.displayName&&N.includes("")&&(N=N.replace("",e.displayName)),N}while(1<=y&&0<=C);break}}}finally{K=!1,Error.prepareStackTrace=s}return(e=e?e.displayName||e.name:"")?H(e):""}function be(e){switch(e.tag){case 5:return H(e.type);case 16:return H("Lazy");case 13:return H("Suspense");case 19:return H("SuspenseList");case 0:case 2:case 15:return e=xe(e.type,!1),e;case 11:return e=xe(e.type.render,!1),e;case 1:return e=xe(e.type,!0),e;default:return""}}function ge(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ee:return"Fragment";case G:return"Portal";case ve:return"Profiler";case re:return"StrictMode";case ae:return"Suspense";case ye:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Y:return(e.displayName||"Context")+".Consumer";case de:return(e._context.displayName||"Context")+".Provider";case Ce:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case me:return n=e.displayName||null,n!==null?n:ge(e.type)||"Memo";case De:n=e._payload,e=e._init;try{return ge(e(n))}catch{}}return null}function _e(e){var n=e.type;switch(e.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=n.render,e=e.displayName||e.name||"",n.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ge(n);case 8:return n===re?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function He(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Fe(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Oe(e){var n=Fe(e)?"checked":"value",s=Object.getOwnPropertyDescriptor(e.constructor.prototype,n),a=""+e[n];if(!e.hasOwnProperty(n)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var f=s.get,h=s.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return f.call(this)},set:function(y){a=""+y,h.call(this,y)}}),Object.defineProperty(e,n,{enumerable:s.enumerable}),{getValue:function(){return a},setValue:function(y){a=""+y},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function $t(e){e._valueTracker||(e._valueTracker=Oe(e))}function Pt(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var s=n.getValue(),a="";return e&&(a=Fe(e)?e.checked?"true":"false":e.value),e=a,e!==s?(n.setValue(e),!0):!1}function At(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function It(e,n){var s=n.checked;return X({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:s??e._wrapperState.initialChecked})}function Kn(e,n){var s=n.defaultValue==null?"":n.defaultValue,a=n.checked!=null?n.checked:n.defaultChecked;s=He(n.value!=null?n.value:s),e._wrapperState={initialChecked:a,initialValue:s,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function Cn(e,n){n=n.checked,n!=null&&W(e,"checked",n,!1)}function _r(e,n){Cn(e,n);var s=He(n.value),a=n.type;if(s!=null)a==="number"?(s===0&&e.value===""||e.value!=s)&&(e.value=""+s):e.value!==""+s&&(e.value=""+s);else if(a==="submit"||a==="reset"){e.removeAttribute("value");return}n.hasOwnProperty("value")?Pn(e,n.type,s):n.hasOwnProperty("defaultValue")&&Pn(e,n.type,He(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(e.defaultChecked=!!n.defaultChecked)}function Xr(e,n,s){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var a=n.type;if(!(a!=="submit"&&a!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+e._wrapperState.initialValue,s||n===e.value||(e.value=n),e.defaultValue=n}s=e.name,s!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,s!==""&&(e.name=s)}function Pn(e,n,s){(n!=="number"||At(e.ownerDocument)!==e)&&(s==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+s&&(e.defaultValue=""+s))}var Ze=Array.isArray;function nn(e,n,s,a){if(e=e.options,n){n={};for(var f=0;f"+n.valueOf().toString()+"",n=sn.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;n.firstChild;)e.appendChild(n.firstChild)}});function Gt(e,n){if(n){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=n;return}}e.textContent=n}var Rt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ln=["Webkit","ms","Moz","O"];Object.keys(Rt).forEach(function(e){ln.forEach(function(n){n=n+e.charAt(0).toUpperCase()+e.substring(1),Rt[n]=Rt[e]})});function mn(e,n,s){return n==null||typeof n=="boolean"||n===""?"":s||typeof n!="number"||n===0||Rt.hasOwnProperty(e)&&Rt[e]?(""+n).trim():n+"px"}function Yt(e,n){e=e.style;for(var s in n)if(n.hasOwnProperty(s)){var a=s.indexOf("--")===0,f=mn(s,n[s],a);s==="float"&&(s="cssFloat"),a?e.setProperty(s,f):e[s]=f}}var vn=X({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function qr(e,n){if(n){if(vn[e]&&(n.children!=null||n.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(n.dangerouslySetInnerHTML!=null){if(n.children!=null)throw Error(r(60));if(typeof n.dangerouslySetInnerHTML!="object"||!("__html"in n.dangerouslySetInnerHTML))throw Error(r(61))}if(n.style!=null&&typeof n.style!="object")throw Error(r(62))}}function Jr(e,n){if(e.indexOf("-")===-1)return typeof n.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var lr=null;function or(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Zr=null,zt=null,lt=null;function Kt(e){if(e=Xl(e)){if(typeof Zr!="function")throw Error(r(280));var n=e.stateNode;n&&(n=aa(n),Zr(e.stateNode,e.type,n))}}function on(e){zt?lt?lt.push(e):lt=[e]:zt=e}function ar(){if(zt){var e=zt,n=lt;if(lt=zt=null,Kt(e),n)for(e=0;e>>=0,e===0?32:31-(Ll(e)/Nn|0)|0}var os=64,Ti=4194304;function zi(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Fs(e,n){var s=e.pendingLanes;if(s===0)return 0;var a=0,f=e.suspendedLanes,h=e.pingedLanes,y=s&268435455;if(y!==0){var C=y&~f;C!==0?a=zi(C):(h&=y,h!==0&&(a=zi(h)))}else y=s&~f,y!==0?a=zi(y):h!==0&&(a=zi(h));if(a===0)return 0;if(n!==0&&n!==a&&(n&f)===0&&(f=a&-a,h=n&-n,f>=h||f===16&&(h&4194240)!==0))return n;if((a&4)!==0&&(a|=s&16),n=e.entangledLanes,n!==0)for(e=e.entanglements,n&=a;0s;s++)n.push(e);return n}function Mi(e,n,s){e.pendingLanes|=n,n!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,n=31-In(n),e[n]=s}function Il(e,n){var s=e.pendingLanes&~n;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=n,e.mutableReadLanes&=n,e.entangledLanes&=n,n=e.entanglements;var a=e.eventTimes;for(e=e.expirationTimes;0=pi),ta=" ",Qs=!1;function g(e,n){switch(e){case"keyup":return Dt.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function S(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var _=!1;function E(e,n){switch(e){case"compositionend":return S(n);case"keypress":return n.which!==32?null:(Qs=!0,ta);case"textInput":return e=n.data,e===ta&&Qs?null:e;default:return null}}function T(e,n){if(_)return e==="compositionend"||!Ks&&g(e,n)?(e=dr(),fr=Wl=cr=null,_=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1=n)return{node:s,offset:n-e};e=a}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=Jn(s)}}function Tn(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Tn(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Wn(){for(var e=window,n=At();n instanceof e.HTMLIFrameElement;){try{var s=typeof n.contentWindow.location.href=="string"}catch{s=!1}if(s)e=n.contentWindow;else break;n=At(e.document)}return n}function Bn(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}function Nr(e){var n=Wn(),s=e.focusedElem,a=e.selectionRange;if(n!==s&&s&&s.ownerDocument&&Tn(s.ownerDocument.documentElement,s)){if(a!==null&&Bn(s)){if(n=a.start,e=a.end,e===void 0&&(e=n),"selectionStart"in s)s.selectionStart=n,s.selectionEnd=Math.min(e,s.value.length);else if(e=(n=s.ownerDocument||document)&&n.defaultView||window,e.getSelection){e=e.getSelection();var f=s.textContent.length,h=Math.min(a.start,f);a=a.end===void 0?h:Math.min(a.end,f),!e.extend&&h>a&&(f=a,a=h,h=f),f=pr(s,h);var y=pr(s,a);f&&y&&(e.rangeCount!==1||e.anchorNode!==f.node||e.anchorOffset!==f.offset||e.focusNode!==y.node||e.focusOffset!==y.offset)&&(n=n.createRange(),n.setStart(f.node,f.offset),e.removeAllRanges(),h>a?(e.addRange(n),e.extend(y.node,y.offset)):(n.setEnd(y.node,y.offset),e.addRange(n)))}}for(n=[],e=s;e=e.parentNode;)e.nodeType===1&&n.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s=document.documentMode,Bt=null,Fr=null,Ot=null,Xs=!1;function cd(e,n,s){var a=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;Xs||Bt==null||Bt!==At(a)||(a=Bt,"selectionStart"in a&&Bn(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),Ot&&cn(Ot,a)||(Ot=a,a=sa(Fr,"onSelect"),0tl||(e.current=Xu[tl],Xu[tl]=null,tl--)}function dt(e,n){tl++,Xu[tl]=e.current,e.current=n}var $i={},zn=Vi($i),Zn=Vi(!1),ys=$i;function nl(e,n){var s=e.type.contextTypes;if(!s)return $i;var a=e.stateNode;if(a&&a.__reactInternalMemoizedUnmaskedChildContext===n)return a.__reactInternalMemoizedMaskedChildContext;var f={},h;for(h in s)f[h]=n[h];return a&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=n,e.__reactInternalMemoizedMaskedChildContext=f),f}function er(e){return e=e.childContextTypes,e!=null}function ua(){gt(Zn),gt(zn)}function kd(e,n,s){if(zn.current!==$i)throw Error(r(168));dt(zn,n),dt(Zn,s)}function Rd(e,n,s){var a=e.stateNode;if(n=n.childContextTypes,typeof a.getChildContext!="function")return s;a=a.getChildContext();for(var f in a)if(!(f in n))throw Error(r(108,_e(e)||"Unknown",f));return X({},s,a)}function ca(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||$i,ys=zn.current,dt(zn,e),dt(Zn,Zn.current),!0}function Nd(e,n,s){var a=e.stateNode;if(!a)throw Error(r(169));s?(e=Rd(e,n,ys),a.__reactInternalMemoizedMergedChildContext=e,gt(Zn),gt(zn),dt(zn,e)):gt(Zn),dt(Zn,s)}var mi=null,fa=!1,qu=!1;function Dd(e){mi===null?mi=[e]:mi.push(e)}function ev(e){fa=!0,Dd(e)}function Gi(){if(!qu&&mi!==null){qu=!0;var e=0,n=$e;try{var s=mi;for($e=1;e>=y,f-=y,vi=1<<32-In(n)+f|s<Ie?(hn=Me,Me=null):hn=Me.sibling;var Qe=Q(O,Me,I[Ie],se);if(Qe===null){Me===null&&(Me=hn);break}e&&Me&&Qe.alternate===null&&n(O,Me),M=h(Qe,M,Ie),ze===null?Re=Qe:ze.sibling=Qe,ze=Qe,Me=hn}if(Ie===I.length)return s(O,Me),St&&Ss(O,Ie),Re;if(Me===null){for(;IeIe?(hn=Me,Me=null):hn=Me.sibling;var ts=Q(O,Me,Qe.value,se);if(ts===null){Me===null&&(Me=hn);break}e&&Me&&ts.alternate===null&&n(O,Me),M=h(ts,M,Ie),ze===null?Re=ts:ze.sibling=ts,ze=ts,Me=hn}if(Qe.done)return s(O,Me),St&&Ss(O,Ie),Re;if(Me===null){for(;!Qe.done;Ie++,Qe=I.next())Qe=te(O,Qe.value,se),Qe!==null&&(M=h(Qe,M,Ie),ze===null?Re=Qe:ze.sibling=Qe,ze=Qe);return St&&Ss(O,Ie),Re}for(Me=a(O,Me);!Qe.done;Ie++,Qe=I.next())Qe=pe(Me,O,Ie,Qe.value,se),Qe!==null&&(e&&Qe.alternate!==null&&Me.delete(Qe.key===null?Ie:Qe.key),M=h(Qe,M,Ie),ze===null?Re=Qe:ze.sibling=Qe,ze=Qe);return e&&Me.forEach(function(Lv){return n(O,Lv)}),St&&Ss(O,Ie),Re}function Lt(O,M,I,se){if(typeof I=="object"&&I!==null&&I.type===ee&&I.key===null&&(I=I.props.children),typeof I=="object"&&I!==null){switch(I.$$typeof){case Z:e:{for(var Re=I.key,ze=M;ze!==null;){if(ze.key===Re){if(Re=I.type,Re===ee){if(ze.tag===7){s(O,ze.sibling),M=f(ze,I.props.children),M.return=O,O=M;break e}}else if(ze.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===De&&Ld(Re)===ze.type){s(O,ze.sibling),M=f(ze,I.props),M.ref=ql(O,ze,I),M.return=O,O=M;break e}s(O,ze);break}else n(O,ze);ze=ze.sibling}I.type===ee?(M=Ds(I.props.children,O.mode,se,I.key),M.return=O,O=M):(se=Fa(I.type,I.key,I.props,null,O.mode,se),se.ref=ql(O,M,I),se.return=O,O=se)}return y(O);case G:e:{for(ze=I.key;M!==null;){if(M.key===ze)if(M.tag===4&&M.stateNode.containerInfo===I.containerInfo&&M.stateNode.implementation===I.implementation){s(O,M.sibling),M=f(M,I.children||[]),M.return=O,O=M;break e}else{s(O,M);break}else n(O,M);M=M.sibling}M=Kc(I,O.mode,se),M.return=O,O=M}return y(O);case De:return ze=I._init,Lt(O,M,ze(I._payload),se)}if(Ze(I))return Se(O,M,I,se);if(oe(I))return Ee(O,M,I,se);ga(O,I)}return typeof I=="string"&&I!==""||typeof I=="number"?(I=""+I,M!==null&&M.tag===6?(s(O,M.sibling),M=f(M,I),M.return=O,O=M):(s(O,M),M=Yc(I,O.mode,se),M.return=O,O=M),y(O)):s(O,M)}return Lt}var ll=Pd(!0),Ad=Pd(!1),ma=Vi(null),va=null,ol=null,rc=null;function ic(){rc=ol=va=null}function sc(e){var n=ma.current;gt(ma),e._currentValue=n}function lc(e,n,s){for(;e!==null;){var a=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,a!==null&&(a.childLanes|=n)):a!==null&&(a.childLanes&n)!==n&&(a.childLanes|=n),e===s)break;e=e.return}}function al(e,n){va=e,rc=ol=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&n)!==0&&(tr=!0),e.firstContext=null)}function zr(e){var n=e._currentValue;if(rc!==e)if(e={context:e,memoizedValue:n,next:null},ol===null){if(va===null)throw Error(r(308));ol=e,va.dependencies={lanes:0,firstContext:e}}else ol=ol.next=e;return n}var xs=null;function oc(e){xs===null?xs=[e]:xs.push(e)}function Id(e,n,s,a){var f=n.interleaved;return f===null?(s.next=s,oc(n)):(s.next=f.next,f.next=s),n.interleaved=s,wi(e,a)}function wi(e,n){e.lanes|=n;var s=e.alternate;for(s!==null&&(s.lanes|=n),s=e,e=e.return;e!==null;)e.childLanes|=n,s=e.alternate,s!==null&&(s.childLanes|=n),s=e,e=e.return;return s.tag===3?s.stateNode:null}var Yi=!1;function ac(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Hd(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Si(e,n){return{eventTime:e,lane:n,tag:0,payload:null,callback:null,next:null}}function Ki(e,n,s){var a=e.updateQueue;if(a===null)return null;if(a=a.shared,(Ye&2)!==0){var f=a.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),a.pending=n,wi(e,s)}return f=a.interleaved,f===null?(n.next=n,oc(a)):(n.next=f.next,f.next=n),a.interleaved=n,wi(e,s)}function ya(e,n,s){if(n=n.updateQueue,n!==null&&(n=n.shared,(s&4194240)!==0)){var a=n.lanes;a&=e.pendingLanes,s|=a,n.lanes=s,bi(e,s)}}function Fd(e,n){var s=e.updateQueue,a=e.alternate;if(a!==null&&(a=a.updateQueue,s===a)){var f=null,h=null;if(s=s.firstBaseUpdate,s!==null){do{var y={eventTime:s.eventTime,lane:s.lane,tag:s.tag,payload:s.payload,callback:s.callback,next:null};h===null?f=h=y:h=h.next=y,s=s.next}while(s!==null);h===null?f=h=n:h=h.next=n}else f=h=n;s={baseState:a.baseState,firstBaseUpdate:f,lastBaseUpdate:h,shared:a.shared,effects:a.effects},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=n:e.next=n,s.lastBaseUpdate=n}function wa(e,n,s,a){var f=e.updateQueue;Yi=!1;var h=f.firstBaseUpdate,y=f.lastBaseUpdate,C=f.shared.pending;if(C!==null){f.shared.pending=null;var N=C,F=N.next;N.next=null,y===null?h=F:y.next=F,y=N;var J=e.alternate;J!==null&&(J=J.updateQueue,C=J.lastBaseUpdate,C!==y&&(C===null?J.firstBaseUpdate=F:C.next=F,J.lastBaseUpdate=N))}if(h!==null){var te=f.baseState;y=0,J=F=N=null,C=h;do{var Q=C.lane,pe=C.eventTime;if((a&Q)===Q){J!==null&&(J=J.next={eventTime:pe,lane:0,tag:C.tag,payload:C.payload,callback:C.callback,next:null});e:{var Se=e,Ee=C;switch(Q=n,pe=s,Ee.tag){case 1:if(Se=Ee.payload,typeof Se=="function"){te=Se.call(pe,te,Q);break e}te=Se;break e;case 3:Se.flags=Se.flags&-65537|128;case 0:if(Se=Ee.payload,Q=typeof Se=="function"?Se.call(pe,te,Q):Se,Q==null)break e;te=X({},te,Q);break e;case 2:Yi=!0}}C.callback!==null&&C.lane!==0&&(e.flags|=64,Q=f.effects,Q===null?f.effects=[C]:Q.push(C))}else pe={eventTime:pe,lane:Q,tag:C.tag,payload:C.payload,callback:C.callback,next:null},J===null?(F=J=pe,N=te):J=J.next=pe,y|=Q;if(C=C.next,C===null){if(C=f.shared.pending,C===null)break;Q=C,C=Q.next,Q.next=null,f.lastBaseUpdate=Q,f.shared.pending=null}}while(!0);if(J===null&&(N=te),f.baseState=N,f.firstBaseUpdate=F,f.lastBaseUpdate=J,n=f.shared.interleaved,n!==null){f=n;do y|=f.lane,f=f.next;while(f!==n)}else h===null&&(f.shared.lanes=0);Cs|=y,e.lanes=y,e.memoizedState=te}}function jd(e,n,s){if(e=n.effects,n.effects=null,e!==null)for(n=0;ns?s:4,e(!0);var a=hc.transition;hc.transition={};try{e(!1),n()}finally{$e=s,hc.transition=a}}function sh(){return Mr().memoizedState}function iv(e,n,s){var a=Ji(e);if(s={lane:a,action:s,hasEagerState:!1,eagerState:null,next:null},lh(e))oh(n,s);else if(s=Id(e,n,s,a),s!==null){var f=Vn();Vr(s,e,a,f),ah(s,n,a)}}function sv(e,n,s){var a=Ji(e),f={lane:a,action:s,hasEagerState:!1,eagerState:null,next:null};if(lh(e))oh(n,f);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var y=n.lastRenderedState,C=h(y,s);if(f.hasEagerState=!0,f.eagerState=C,at(C,y)){var N=n.interleaved;N===null?(f.next=f,oc(n)):(f.next=N.next,N.next=f),n.interleaved=f;return}}catch{}finally{}s=Id(e,n,f,a),s!==null&&(f=Vn(),Vr(s,e,a,f),ah(s,n,a))}}function lh(e){var n=e.alternate;return e===kt||n!==null&&n===kt}function oh(e,n){to=_a=!0;var s=e.pending;s===null?n.next=n:(n.next=s.next,s.next=n),e.pending=n}function ah(e,n,s){if((s&4194240)!==0){var a=n.lanes;a&=e.pendingLanes,s|=a,n.lanes=s,bi(e,s)}}var ka={readContext:zr,useCallback:Mn,useContext:Mn,useEffect:Mn,useImperativeHandle:Mn,useInsertionEffect:Mn,useLayoutEffect:Mn,useMemo:Mn,useReducer:Mn,useRef:Mn,useState:Mn,useDebugValue:Mn,useDeferredValue:Mn,useTransition:Mn,useMutableSource:Mn,useSyncExternalStore:Mn,useId:Mn,unstable_isNewReconciler:!1},lv={readContext:zr,useCallback:function(e,n){return si().memoizedState=[e,n===void 0?null:n],e},useContext:zr,useEffect:qd,useImperativeHandle:function(e,n,s){return s=s!=null?s.concat([e]):null,Ea(4194308,4,eh.bind(null,n,e),s)},useLayoutEffect:function(e,n){return Ea(4194308,4,e,n)},useInsertionEffect:function(e,n){return Ea(4,2,e,n)},useMemo:function(e,n){var s=si();return n=n===void 0?null:n,e=e(),s.memoizedState=[e,n],e},useReducer:function(e,n,s){var a=si();return n=s!==void 0?s(n):n,a.memoizedState=a.baseState=n,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:n},a.queue=e,e=e.dispatch=iv.bind(null,kt,e),[a.memoizedState,e]},useRef:function(e){var n=si();return e={current:e},n.memoizedState=e},useState:Qd,useDebugValue:Sc,useDeferredValue:function(e){return si().memoizedState=e},useTransition:function(){var e=Qd(!1),n=e[0];return e=rv.bind(null,e[1]),si().memoizedState=e,[n,e]},useMutableSource:function(){},useSyncExternalStore:function(e,n,s){var a=kt,f=si();if(St){if(s===void 0)throw Error(r(407));s=s()}else{if(s=n(),dn===null)throw Error(r(349));(Es&30)!==0||Vd(a,n,s)}f.memoizedState=s;var h={value:s,getSnapshot:n};return f.queue=h,qd(Gd.bind(null,a,h,e),[e]),a.flags|=2048,io(9,$d.bind(null,a,h,s,n),void 0,null),s},useId:function(){var e=si(),n=dn.identifierPrefix;if(St){var s=yi,a=vi;s=(a&~(1<<32-In(a)-1)).toString(32)+s,n=":"+n+"R"+s,s=no++,0<\/script>",e=e.removeChild(e.firstChild)):typeof a.is=="string"?e=y.createElement(s,{is:a.is}):(e=y.createElement(s),s==="select"&&(y=e,a.multiple?y.multiple=!0:a.size&&(y.size=a.size))):e=y.createElementNS(e,s),e[ri]=n,e[Ql]=a,Dh(e,n,!1,!1),n.stateNode=e;e:{switch(y=Jr(s,a),s){case"dialog":pt("cancel",e),pt("close",e),f=a;break;case"iframe":case"object":case"embed":pt("load",e),f=a;break;case"video":case"audio":for(f=0;fhl&&(n.flags|=128,a=!0,so(h,!1),n.lanes=4194304)}else{if(!a)if(e=Sa(y),e!==null){if(n.flags|=128,a=!0,s=e.updateQueue,s!==null&&(n.updateQueue=s,n.flags|=4),so(h,!0),h.tail===null&&h.tailMode==="hidden"&&!y.alternate&&!St)return bn(n),null}else 2*ot()-h.renderingStartTime>hl&&s!==1073741824&&(n.flags|=128,a=!0,so(h,!1),n.lanes=4194304);h.isBackwards?(y.sibling=n.child,n.child=y):(s=h.last,s!==null?s.sibling=y:n.child=y,h.last=y)}return h.tail!==null?(n=h.tail,h.rendering=n,h.tail=n.sibling,h.renderingStartTime=ot(),n.sibling=null,s=Ct.current,dt(Ct,a?s&1|2:s&1),n):(bn(n),null);case 22:case 23:return Vc(),a=n.memoizedState!==null,e!==null&&e.memoizedState!==null!==a&&(n.flags|=8192),a&&(n.mode&1)!==0?(vr&1073741824)!==0&&(bn(n),n.subtreeFlags&6&&(n.flags|=8192)):bn(n),null;case 24:return null;case 25:return null}throw Error(r(156,n.tag))}function pv(e,n){switch(Zu(n),n.tag){case 1:return er(n.type)&&ua(),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return ul(),gt(Zn),gt(zn),dc(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 5:return cc(n),null;case 13:if(gt(Ct),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(r(340));sl()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return gt(Ct),null;case 4:return ul(),null;case 10:return sc(n.type._context),null;case 22:case 23:return Vc(),null;case 24:return null;default:return null}}var Ta=!1,On=!1,gv=typeof WeakSet=="function"?WeakSet:Set,we=null;function fl(e,n){var s=e.ref;if(s!==null)if(typeof s=="function")try{s(null)}catch(a){Tt(e,n,a)}else s.current=null}function bc(e,n,s){try{s()}catch(a){Tt(e,n,a)}}var Mh=!1;function mv(e,n){if(Vu=rt,e=Wn(),Bn(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{s=(s=e.ownerDocument)&&s.defaultView||window;var a=s.getSelection&&s.getSelection();if(a&&a.rangeCount!==0){s=a.anchorNode;var f=a.anchorOffset,h=a.focusNode;a=a.focusOffset;try{s.nodeType,h.nodeType}catch{s=null;break e}var y=0,C=-1,N=-1,F=0,J=0,te=e,Q=null;t:for(;;){for(var pe;te!==s||f!==0&&te.nodeType!==3||(C=y+f),te!==h||a!==0&&te.nodeType!==3||(N=y+a),te.nodeType===3&&(y+=te.nodeValue.length),(pe=te.firstChild)!==null;)Q=te,te=pe;for(;;){if(te===e)break t;if(Q===s&&++F===f&&(C=y),Q===h&&++J===a&&(N=y),(pe=te.nextSibling)!==null)break;te=Q,Q=te.parentNode}te=pe}s=C===-1||N===-1?null:{start:C,end:N}}else s=null}s=s||{start:0,end:0}}else s=null;for($u={focusedElem:e,selectionRange:s},rt=!1,we=n;we!==null;)if(n=we,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,we=e;else for(;we!==null;){n=we;try{var Se=n.alternate;if((n.flags&1024)!==0)switch(n.tag){case 0:case 11:case 15:break;case 1:if(Se!==null){var Ee=Se.memoizedProps,Lt=Se.memoizedState,O=n.stateNode,M=O.getSnapshotBeforeUpdate(n.elementType===n.type?Ee:Wr(n.type,Ee),Lt);O.__reactInternalSnapshotBeforeUpdate=M}break;case 3:var I=n.stateNode.containerInfo;I.nodeType===1?I.textContent="":I.nodeType===9&&I.documentElement&&I.removeChild(I.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(se){Tt(n,n.return,se)}if(e=n.sibling,e!==null){e.return=n.return,we=e;break}we=n.return}return Se=Mh,Mh=!1,Se}function lo(e,n,s){var a=n.updateQueue;if(a=a!==null?a.lastEffect:null,a!==null){var f=a=a.next;do{if((f.tag&e)===e){var h=f.destroy;f.destroy=void 0,h!==void 0&&bc(n,s,h)}f=f.next}while(f!==a)}}function za(e,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var s=n=n.next;do{if((s.tag&e)===e){var a=s.create;s.destroy=a()}s=s.next}while(s!==n)}}function Oc(e){var n=e.ref;if(n!==null){var s=e.stateNode;switch(e.tag){case 5:e=s;break;default:e=s}typeof n=="function"?n(e):n.current=e}}function bh(e){var n=e.alternate;n!==null&&(e.alternate=null,bh(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&(delete n[ri],delete n[Ql],delete n[Qu],delete n[Jm],delete n[Zm])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Oh(e){return e.tag===5||e.tag===3||e.tag===4}function Lh(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Oh(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.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Lc(e,n,s){var a=e.tag;if(a===5||a===6)e=e.stateNode,n?s.nodeType===8?s.parentNode.insertBefore(e,n):s.insertBefore(e,n):(s.nodeType===8?(n=s.parentNode,n.insertBefore(e,s)):(n=s,n.appendChild(e)),s=s._reactRootContainer,s!=null||n.onclick!==null||(n.onclick=oa));else if(a!==4&&(e=e.child,e!==null))for(Lc(e,n,s),e=e.sibling;e!==null;)Lc(e,n,s),e=e.sibling}function Pc(e,n,s){var a=e.tag;if(a===5||a===6)e=e.stateNode,n?s.insertBefore(e,n):s.appendChild(e);else if(a!==4&&(e=e.child,e!==null))for(Pc(e,n,s),e=e.sibling;e!==null;)Pc(e,n,s),e=e.sibling}var _n=null,Br=!1;function Qi(e,n,s){for(s=s.child;s!==null;)Ph(e,n,s),s=s.sibling}function Ph(e,n,s){if(Qn&&typeof Qn.onCommitFiberUnmount=="function")try{Qn.onCommitFiberUnmount(Di,s)}catch{}switch(s.tag){case 5:On||fl(s,n);case 6:var a=_n,f=Br;_n=null,Qi(e,n,s),_n=a,Br=f,_n!==null&&(Br?(e=_n,s=s.stateNode,e.nodeType===8?e.parentNode.removeChild(s):e.removeChild(s)):_n.removeChild(s.stateNode));break;case 18:_n!==null&&(Br?(e=_n,s=s.stateNode,e.nodeType===8?Ku(e.parentNode,s):e.nodeType===1&&Ku(e,s),Fi(e)):Ku(_n,s.stateNode));break;case 4:a=_n,f=Br,_n=s.stateNode.containerInfo,Br=!0,Qi(e,n,s),_n=a,Br=f;break;case 0:case 11:case 14:case 15:if(!On&&(a=s.updateQueue,a!==null&&(a=a.lastEffect,a!==null))){f=a=a.next;do{var h=f,y=h.destroy;h=h.tag,y!==void 0&&((h&2)!==0||(h&4)!==0)&&bc(s,n,y),f=f.next}while(f!==a)}Qi(e,n,s);break;case 1:if(!On&&(fl(s,n),a=s.stateNode,typeof a.componentWillUnmount=="function"))try{a.props=s.memoizedProps,a.state=s.memoizedState,a.componentWillUnmount()}catch(C){Tt(s,n,C)}Qi(e,n,s);break;case 21:Qi(e,n,s);break;case 22:s.mode&1?(On=(a=On)||s.memoizedState!==null,Qi(e,n,s),On=a):Qi(e,n,s);break;default:Qi(e,n,s)}}function Ah(e){var n=e.updateQueue;if(n!==null){e.updateQueue=null;var s=e.stateNode;s===null&&(s=e.stateNode=new gv),n.forEach(function(a){var f=kv.bind(null,e,a);s.has(a)||(s.add(a),a.then(f,f))})}}function Ur(e,n){var s=n.deletions;if(s!==null)for(var a=0;af&&(f=y),a&=~h}if(a=f,a=ot()-a,a=(120>a?120:480>a?480:1080>a?1080:1920>a?1920:3e3>a?3e3:4320>a?4320:1960*yv(a/1960))-a,10e?16:e,qi===null)var a=!1;else{if(e=qi,qi=null,Pa=0,(Ye&6)!==0)throw Error(r(331));var f=Ye;for(Ye|=4,we=e.current;we!==null;){var h=we,y=h.child;if((we.flags&16)!==0){var C=h.deletions;if(C!==null){for(var N=0;Not()-Hc?Rs(e,0):Ic|=s),rr(e,n)}function Qh(e,n){n===0&&((e.mode&1)===0?n=1:(n=Ti,Ti<<=1,(Ti&130023424)===0&&(Ti=4194304)));var s=Vn();e=wi(e,n),e!==null&&(Mi(e,n,s),rr(e,s))}function Cv(e){var n=e.memoizedState,s=0;n!==null&&(s=n.retryLane),Qh(e,s)}function kv(e,n){var s=0;switch(e.tag){case 13:var a=e.stateNode,f=e.memoizedState;f!==null&&(s=f.retryLane);break;case 19:a=e.stateNode;break;default:throw Error(r(314))}a!==null&&a.delete(n),Qh(e,s)}var Xh;Xh=function(e,n,s){if(e!==null)if(e.memoizedProps!==n.pendingProps||Zn.current)tr=!0;else{if((e.lanes&s)===0&&(n.flags&128)===0)return tr=!1,dv(e,n,s);tr=(e.flags&131072)!==0}else tr=!1,St&&(n.flags&1048576)!==0&&Td(n,ha,n.index);switch(n.lanes=0,n.tag){case 2:var a=n.type;Da(e,n),e=n.pendingProps;var f=nl(n,zn.current);al(n,s),f=gc(null,n,a,e,f,s);var h=mc();return n.flags|=1,typeof f=="object"&&f!==null&&typeof f.render=="function"&&f.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,er(a)?(h=!0,ca(n)):h=!1,n.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,ac(n),f.updater=Ra,n.stateNode=f,f._reactInternals=n,_c(n,a,e,s),n=Rc(null,n,a,!0,h,s)):(n.tag=0,St&&h&&Ju(n),Un(null,n,f,s),n=n.child),n;case 16:a=n.elementType;e:{switch(Da(e,n),e=n.pendingProps,f=a._init,a=f(a._payload),n.type=a,f=n.tag=Nv(a),e=Wr(a,e),f){case 0:n=kc(null,n,a,e,s);break e;case 1:n=_h(null,n,a,e,s);break e;case 11:n=vh(null,n,a,e,s);break e;case 14:n=yh(null,n,a,Wr(a.type,e),s);break e}throw Error(r(306,a,""))}return n;case 0:return a=n.type,f=n.pendingProps,f=n.elementType===a?f:Wr(a,f),kc(e,n,a,f,s);case 1:return a=n.type,f=n.pendingProps,f=n.elementType===a?f:Wr(a,f),_h(e,n,a,f,s);case 3:e:{if(Eh(n),e===null)throw Error(r(387));a=n.pendingProps,h=n.memoizedState,f=h.element,Hd(e,n),wa(n,a,null,s);var y=n.memoizedState;if(a=y.element,h.isDehydrated)if(h={element:a,isDehydrated:!1,cache:y.cache,pendingSuspenseBoundaries:y.pendingSuspenseBoundaries,transitions:y.transitions},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){f=cl(Error(r(423)),n),n=Ch(e,n,a,s,f);break e}else if(a!==f){f=cl(Error(r(424)),n),n=Ch(e,n,a,s,f);break e}else for(mr=Ui(n.stateNode.containerInfo.firstChild),gr=n,St=!0,jr=null,s=Ad(n,null,a,s),n.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(sl(),a===f){n=xi(e,n,s);break e}Un(e,n,a,s)}n=n.child}return n;case 5:return Wd(n),e===null&&tc(n),a=n.type,f=n.pendingProps,h=e!==null?e.memoizedProps:null,y=f.children,Gu(a,f)?y=null:h!==null&&Gu(a,h)&&(n.flags|=32),xh(e,n),Un(e,n,y,s),n.child;case 6:return e===null&&tc(n),null;case 13:return kh(e,n,s);case 4:return uc(n,n.stateNode.containerInfo),a=n.pendingProps,e===null?n.child=ll(n,null,a,s):Un(e,n,a,s),n.child;case 11:return a=n.type,f=n.pendingProps,f=n.elementType===a?f:Wr(a,f),vh(e,n,a,f,s);case 7:return Un(e,n,n.pendingProps,s),n.child;case 8:return Un(e,n,n.pendingProps.children,s),n.child;case 12:return Un(e,n,n.pendingProps.children,s),n.child;case 10:e:{if(a=n.type._context,f=n.pendingProps,h=n.memoizedProps,y=f.value,dt(ma,a._currentValue),a._currentValue=y,h!==null)if(at(h.value,y)){if(h.children===f.children&&!Zn.current){n=xi(e,n,s);break e}}else for(h=n.child,h!==null&&(h.return=n);h!==null;){var C=h.dependencies;if(C!==null){y=h.child;for(var N=C.firstContext;N!==null;){if(N.context===a){if(h.tag===1){N=Si(-1,s&-s),N.tag=2;var F=h.updateQueue;if(F!==null){F=F.shared;var J=F.pending;J===null?N.next=N:(N.next=J.next,J.next=N),F.pending=N}}h.lanes|=s,N=h.alternate,N!==null&&(N.lanes|=s),lc(h.return,s,n),C.lanes|=s;break}N=N.next}}else if(h.tag===10)y=h.type===n.type?null:h.child;else if(h.tag===18){if(y=h.return,y===null)throw Error(r(341));y.lanes|=s,C=y.alternate,C!==null&&(C.lanes|=s),lc(y,s,n),y=h.sibling}else y=h.child;if(y!==null)y.return=h;else for(y=h;y!==null;){if(y===n){y=null;break}if(h=y.sibling,h!==null){h.return=y.return,y=h;break}y=y.return}h=y}Un(e,n,f.children,s),n=n.child}return n;case 9:return f=n.type,a=n.pendingProps.children,al(n,s),f=zr(f),a=a(f),n.flags|=1,Un(e,n,a,s),n.child;case 14:return a=n.type,f=Wr(a,n.pendingProps),f=Wr(a.type,f),yh(e,n,a,f,s);case 15:return wh(e,n,n.type,n.pendingProps,s);case 17:return a=n.type,f=n.pendingProps,f=n.elementType===a?f:Wr(a,f),Da(e,n),n.tag=1,er(a)?(e=!0,ca(n)):e=!1,al(n,s),ch(n,a,f),_c(n,a,f,s),Rc(null,n,a,!0,e,s);case 19:return Nh(e,n,s);case 22:return Sh(e,n,s)}throw Error(r(156,n.tag))};function qh(e,n){return Mt(e,n)}function Rv(e,n,s,a){this.tag=e,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Or(e,n,s,a){return new Rv(e,n,s,a)}function Gc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Nv(e){if(typeof e=="function")return Gc(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ce)return 11;if(e===me)return 14}return 2}function es(e,n){var s=e.alternate;return s===null?(s=Or(e.tag,n,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=n,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=e.flags&14680064,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,n=e.dependencies,s.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s}function Fa(e,n,s,a,f,h){var y=2;if(a=e,typeof e=="function")Gc(e)&&(y=1);else if(typeof e=="string")y=5;else e:switch(e){case ee:return Ds(s.children,f,h,n);case re:y=8,f|=8;break;case ve:return e=Or(12,s,n,f|2),e.elementType=ve,e.lanes=h,e;case ae:return e=Or(13,s,n,f),e.elementType=ae,e.lanes=h,e;case ye:return e=Or(19,s,n,f),e.elementType=ye,e.lanes=h,e;case le:return ja(s,f,h,n);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case de:y=10;break e;case Y:y=9;break e;case Ce:y=11;break e;case me:y=14;break e;case De:y=16,a=null;break e}throw Error(r(130,e==null?e:typeof e,""))}return n=Or(y,s,n,f),n.elementType=e,n.type=a,n.lanes=h,n}function Ds(e,n,s,a){return e=Or(7,e,a,n),e.lanes=s,e}function ja(e,n,s,a){return e=Or(22,e,a,n),e.elementType=le,e.lanes=s,e.stateNode={isHidden:!1},e}function Yc(e,n,s){return e=Or(6,e,null,n),e.lanes=s,e}function Kc(e,n,s){return n=Or(4,e.children!==null?e.children:[],e.key,n),n.lanes=s,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function Dv(e,n,s,a,f){this.tag=n,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Al(0),this.expirationTimes=Al(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Al(0),this.identifierPrefix=a,this.onRecoverableError=f,this.mutableSourceEagerHydrationData=null}function Qc(e,n,s,a,f,h,y,C,N){return e=new Dv(e,n,s,C,N),n===1?(n=1,h===!0&&(n|=8)):n=0,h=Or(3,null,null,n),e.current=h,h.stateNode=e,h.memoizedState={element:a,isDehydrated:s,cache:null,transitions:null,pendingSuspenseBoundaries:null},ac(h),e}function Tv(e,n,s){var a=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l)}catch(t){console.error(t)}}return l(),tf.exports=Bv(),tf.exports}var fp;function Uv(){if(fp)return Ya;fp=1;var l=Rg();return Ya.createRoot=l.createRoot,Ya.hydrateRoot=l.hydrateRoot,Ya}var Vv=Uv();const $v=kg(Vv);var bs=Rg();const wu=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Nl(l){const t=Object.prototype.toString.call(l);return t==="[object Window]"||t==="[object global]"}function Ff(l){return"nodeType"in l}function Yn(l){var t,r;return l?Nl(l)?l:Ff(l)&&(t=(r=l.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function jf(l){const{Document:t}=Yn(l);return l instanceof t}function bo(l){return Nl(l)?!1:l instanceof Yn(l).HTMLElement}function Ng(l){return l instanceof Yn(l).SVGElement}function Dl(l){return l?Nl(l)?l.document:Ff(l)?jf(l)?l:bo(l)||Ng(l)?l.ownerDocument:document:document:document}const ki=wu?j.useLayoutEffect:j.useEffect;function Su(l){const t=j.useRef(l);return ki(()=>{t.current=l}),j.useCallback(function(){for(var r=arguments.length,i=new Array(r),o=0;o{l.current=setInterval(i,o)},[]),r=j.useCallback(()=>{l.current!==null&&(clearInterval(l.current),l.current=null)},[]);return[t,r]}function Ro(l,t){t===void 0&&(t=[l]);const r=j.useRef(l);return ki(()=>{r.current!==l&&(r.current=l)},t),r}function Oo(l,t){const r=j.useRef();return j.useMemo(()=>{const i=l(r.current);return r.current=i,i},[...t])}function iu(l){const t=Su(l),r=j.useRef(null),i=j.useCallback(o=>{o!==r.current&&(t==null||t(o,r.current)),r.current=o},[]);return[r,i]}function su(l){const t=j.useRef();return j.useEffect(()=>{t.current=l},[l]),t.current}let sf={};function xu(l,t){return j.useMemo(()=>{if(t)return t;const r=sf[l]==null?0:sf[l]+1;return sf[l]=r,l+"-"+r},[l,t])}function Dg(l){return function(t){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o{const d=Object.entries(c);for(const[p,m]of d){const w=u[p];w!=null&&(u[p]=w+l*m)}return u},{...t})}}const wl=Dg(1),lu=Dg(-1);function Yv(l){return"clientX"in l&&"clientY"in l}function Wf(l){if(!l)return!1;const{KeyboardEvent:t}=Yn(l.target);return t&&l instanceof t}function Kv(l){if(!l)return!1;const{TouchEvent:t}=Yn(l.target);return t&&l instanceof t}function ou(l){if(Kv(l)){if(l.touches&&l.touches.length){const{clientX:t,clientY:r}=l.touches[0];return{x:t,y:r}}else if(l.changedTouches&&l.changedTouches.length){const{clientX:t,clientY:r}=l.changedTouches[0];return{x:t,y:r}}}return Yv(l)?{x:l.clientX,y:l.clientY}:null}const No=Object.freeze({Translate:{toString(l){if(!l)return;const{x:t,y:r}=l;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(l){if(!l)return;const{scaleX:t,scaleY:r}=l;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(l){if(l)return[No.Translate.toString(l),No.Scale.toString(l)].join(" ")}},Transition:{toString(l){let{property:t,duration:r,easing:i}=l;return t+" "+r+"ms "+i}}}),dp="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Qv(l){return l.matches(dp)?l:l.querySelector(dp)}const Xv={display:"none"};function qv(l){let{id:t,value:r}=l;return ht.createElement("div",{id:t,style:Xv},r)}function Jv(l){let{id:t,announcement:r,ariaLiveType:i="assertive"}=l;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return ht.createElement("div",{id:t,style:o,role:"status","aria-live":i,"aria-atomic":!0},r)}function Zv(){const[l,t]=j.useState("");return{announce:j.useCallback(i=>{i!=null&&t(i)},[]),announcement:l}}const Tg=j.createContext(null);function ey(l){const t=j.useContext(Tg);j.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(l)},[l,t])}function ty(){const[l]=j.useState(()=>new Set),t=j.useCallback(i=>(l.add(i),()=>l.delete(i)),[l]);return[j.useCallback(i=>{let{type:o,event:u}=i;l.forEach(c=>{var d;return(d=c[o])==null?void 0:d.call(c,u)})},[l]),t]}const ny={draggable:` - To pick up a draggable item, press the space bar. - While dragging, use the arrow keys to move the item. - Press space again to drop the item in its new position, or press escape to cancel. - `},ry={onDragStart(l){let{active:t}=l;return"Picked up draggable item "+t.id+"."},onDragOver(l){let{active:t,over:r}=l;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(l){let{active:t,over:r}=l;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(l){let{active:t}=l;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function iy(l){let{announcements:t=ry,container:r,hiddenTextDescribedById:i,screenReaderInstructions:o=ny}=l;const{announce:u,announcement:c}=Zv(),d=xu("DndLiveRegion"),[p,m]=j.useState(!1);if(j.useEffect(()=>{m(!0)},[]),ey(j.useMemo(()=>({onDragStart(v){let{active:x}=v;u(t.onDragStart({active:x}))},onDragMove(v){let{active:x,over:z}=v;t.onDragMove&&u(t.onDragMove({active:x,over:z}))},onDragOver(v){let{active:x,over:z}=v;u(t.onDragOver({active:x,over:z}))},onDragEnd(v){let{active:x,over:z}=v;u(t.onDragEnd({active:x,over:z}))},onDragCancel(v){let{active:x,over:z}=v;u(t.onDragCancel({active:x,over:z}))}}),[u,t])),!p)return null;const w=ht.createElement(ht.Fragment,null,ht.createElement(qv,{id:i,value:o.draggable}),ht.createElement(Jv,{id:d,announcement:c}));return r?bs.createPortal(w,r):w}var en;(function(l){l.DragStart="dragStart",l.DragMove="dragMove",l.DragEnd="dragEnd",l.DragCancel="dragCancel",l.DragOver="dragOver",l.RegisterDroppable="registerDroppable",l.SetDroppableDisabled="setDroppableDisabled",l.UnregisterDroppable="unregisterDroppable"})(en||(en={}));function au(){}function sy(l,t){return j.useMemo(()=>({sensor:l,options:t??{}}),[l,t])}function ly(){for(var l=arguments.length,t=new Array(l),r=0;r[...t].filter(i=>i!=null),[...t])}const Qr=Object.freeze({x:0,y:0});function oy(l,t){const r=ou(l);if(!r)return"0 0";const i={x:(r.x-t.left)/t.width*100,y:(r.y-t.top)/t.height*100};return i.x+"% "+i.y+"%"}function ay(l,t){let{data:{value:r}}=l,{data:{value:i}}=t;return i-r}function uy(l,t){if(!l||l.length===0)return null;const[r]=l;return r[t]}function cy(l,t){const r=Math.max(t.top,l.top),i=Math.max(t.left,l.left),o=Math.min(t.left+t.width,l.left+l.width),u=Math.min(t.top+t.height,l.top+l.height),c=o-i,d=u-r;if(i{let{collisionRect:t,droppableRects:r,droppableContainers:i}=l;const o=[];for(const u of i){const{id:c}=u,d=r.get(c);if(d){const p=cy(d,t);p>0&&o.push({id:c,data:{droppableContainer:u,value:p}})}}return o.sort(ay)};function dy(l,t,r){return{...l,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function zg(l,t){return l&&t?{x:l.left-t.left,y:l.top-t.top}:Qr}function hy(l){return function(r){for(var i=arguments.length,o=new Array(i>1?i-1:0),u=1;u({...c,top:c.top+l*d.y,bottom:c.bottom+l*d.y,left:c.left+l*d.x,right:c.right+l*d.x}),{...r})}}const py=hy(1);function Mg(l){if(l.startsWith("matrix3d(")){const t=l.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(l.startsWith("matrix(")){const t=l.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function gy(l,t,r){const i=Mg(t);if(!i)return l;const{scaleX:o,scaleY:u,x:c,y:d}=i,p=l.left-c-(1-o)*parseFloat(r),m=l.top-d-(1-u)*parseFloat(r.slice(r.indexOf(" ")+1)),w=o?l.width/o:l.width,v=u?l.height/u:l.height;return{width:w,height:v,top:m,right:p+w,bottom:m+v,left:p}}const my={ignoreTransform:!1};function Lo(l,t){t===void 0&&(t=my);let r=l.getBoundingClientRect();if(t.ignoreTransform){const{transform:m,transformOrigin:w}=Yn(l).getComputedStyle(l);m&&(r=gy(r,m,w))}const{top:i,left:o,width:u,height:c,bottom:d,right:p}=r;return{top:i,left:o,width:u,height:c,bottom:d,right:p}}function hp(l){return Lo(l,{ignoreTransform:!0})}function vy(l){const t=l.innerWidth,r=l.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function yy(l,t){return t===void 0&&(t=Yn(l).getComputedStyle(l)),t.position==="fixed"}function wy(l,t){t===void 0&&(t=Yn(l).getComputedStyle(l));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const u=t[o];return typeof u=="string"?r.test(u):!1})}function Bf(l,t){const r=[];function i(o){if(t!=null&&r.length>=t||!o)return r;if(jf(o)&&o.scrollingElement!=null&&!r.includes(o.scrollingElement))return r.push(o.scrollingElement),r;if(!bo(o)||Ng(o)||r.includes(o))return r;const u=Yn(l).getComputedStyle(o);return o!==l&&wy(o,u)&&r.push(o),yy(o,u)?r:i(o.parentNode)}return l?i(l):r}function bg(l){const[t]=Bf(l,1);return t??null}function lf(l){return!wu||!l?null:Nl(l)?l:Ff(l)?jf(l)||l===Dl(l).scrollingElement?window:bo(l)?l:null:null}function Og(l){return Nl(l)?l.scrollX:l.scrollLeft}function Lg(l){return Nl(l)?l.scrollY:l.scrollTop}function Ef(l){return{x:Og(l),y:Lg(l)}}var pn;(function(l){l[l.Forward=1]="Forward",l[l.Backward=-1]="Backward"})(pn||(pn={}));function Pg(l){return!wu||!l?!1:l===document.scrollingElement}function Ag(l){const t={x:0,y:0},r=Pg(l)?{height:window.innerHeight,width:window.innerWidth}:{height:l.clientHeight,width:l.clientWidth},i={x:l.scrollWidth-r.width,y:l.scrollHeight-r.height},o=l.scrollTop<=t.y,u=l.scrollLeft<=t.x,c=l.scrollTop>=i.y,d=l.scrollLeft>=i.x;return{isTop:o,isLeft:u,isBottom:c,isRight:d,maxScroll:i,minScroll:t}}const Sy={x:.2,y:.2};function xy(l,t,r,i,o){let{top:u,left:c,right:d,bottom:p}=r;i===void 0&&(i=10),o===void 0&&(o=Sy);const{isTop:m,isBottom:w,isLeft:v,isRight:x}=Ag(l),z={x:0,y:0},R={x:0,y:0},k={height:t.height*o.y,width:t.width*o.x};return!m&&u<=t.top+k.height?(z.y=pn.Backward,R.y=i*Math.abs((t.top+k.height-u)/k.height)):!w&&p>=t.bottom-k.height&&(z.y=pn.Forward,R.y=i*Math.abs((t.bottom-k.height-p)/k.height)),!x&&d>=t.right-k.width?(z.x=pn.Forward,R.x=i*Math.abs((t.right-k.width-d)/k.width)):!v&&c<=t.left+k.width&&(z.x=pn.Backward,R.x=i*Math.abs((t.left+k.width-c)/k.width)),{direction:z,speed:R}}function _y(l){if(l===document.scrollingElement){const{innerWidth:u,innerHeight:c}=window;return{top:0,left:0,right:u,bottom:c,width:u,height:c}}const{top:t,left:r,right:i,bottom:o}=l.getBoundingClientRect();return{top:t,left:r,right:i,bottom:o,width:l.clientWidth,height:l.clientHeight}}function Ig(l){return l.reduce((t,r)=>wl(t,Ef(r)),Qr)}function Ey(l){return l.reduce((t,r)=>t+Og(r),0)}function Cy(l){return l.reduce((t,r)=>t+Lg(r),0)}function Hg(l,t){if(t===void 0&&(t=Lo),!l)return;const{top:r,left:i,bottom:o,right:u}=t(l);bg(l)&&(o<=0||u<=0||r>=window.innerHeight||i>=window.innerWidth)&&l.scrollIntoView({block:"center",inline:"center"})}const ky=[["x",["left","right"],Ey],["y",["top","bottom"],Cy]];class Uf{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const i=Bf(r),o=Ig(i);this.rect={...t},this.width=t.width,this.height=t.height;for(const[u,c,d]of ky)for(const p of c)Object.defineProperty(this,p,{get:()=>{const m=d(i),w=o[u]-m;return this.rect[p]+w},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class So{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var i;return(i=this.target)==null?void 0:i.removeEventListener(...r)})},this.target=t}add(t,r,i){var o;(o=this.target)==null||o.addEventListener(t,r,i),this.listeners.push([t,r,i])}}function Ry(l){const{EventTarget:t}=Yn(l);return l instanceof t?l:Dl(l)}function of(l,t){const r=Math.abs(l.x),i=Math.abs(l.y);return typeof t=="number"?Math.sqrt(r**2+i**2)>t:"x"in t&&"y"in t?r>t.x&&i>t.y:"x"in t?r>t.x:"y"in t?i>t.y:!1}var Pr;(function(l){l.Click="click",l.DragStart="dragstart",l.Keydown="keydown",l.ContextMenu="contextmenu",l.Resize="resize",l.SelectionChange="selectionchange",l.VisibilityChange="visibilitychange"})(Pr||(Pr={}));function pp(l){l.preventDefault()}function Ny(l){l.stopPropagation()}var ut;(function(l){l.Space="Space",l.Down="ArrowDown",l.Right="ArrowRight",l.Left="ArrowLeft",l.Up="ArrowUp",l.Esc="Escape",l.Enter="Enter",l.Tab="Tab"})(ut||(ut={}));const Fg={start:[ut.Space,ut.Enter],cancel:[ut.Esc],end:[ut.Space,ut.Enter,ut.Tab]},Dy=(l,t)=>{let{currentCoordinates:r}=t;switch(l.code){case ut.Right:return{...r,x:r.x+25};case ut.Left:return{...r,x:r.x-25};case ut.Down:return{...r,y:r.y+25};case ut.Up:return{...r,y:r.y-25}}};class jg{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:r}}=t;this.props=t,this.listeners=new So(Dl(r)),this.windowListeners=new So(Yn(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Pr.Resize,this.handleCancel),this.windowListeners.add(Pr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Pr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,i=t.node.current;i&&Hg(i),r(Qr)}handleKeyDown(t){if(Wf(t)){const{active:r,context:i,options:o}=this.props,{keyboardCodes:u=Fg,coordinateGetter:c=Dy,scrollBehavior:d="smooth"}=o,{code:p}=t;if(u.end.includes(p)){this.handleEnd(t);return}if(u.cancel.includes(p)){this.handleCancel(t);return}const{collisionRect:m}=i.current,w=m?{x:m.left,y:m.top}:Qr;this.referenceCoordinates||(this.referenceCoordinates=w);const v=c(t,{active:r,context:i.current,currentCoordinates:w});if(v){const x=lu(v,w),z={x:0,y:0},{scrollableAncestors:R}=i.current;for(const k of R){const b=t.code,{isTop:U,isRight:P,isLeft:W,isBottom:V,maxScroll:Z,minScroll:G}=Ag(k),ee=_y(k),re={x:Math.min(b===ut.Right?ee.right-ee.width/2:ee.right,Math.max(b===ut.Right?ee.left:ee.left+ee.width/2,v.x)),y:Math.min(b===ut.Down?ee.bottom-ee.height/2:ee.bottom,Math.max(b===ut.Down?ee.top:ee.top+ee.height/2,v.y))},ve=b===ut.Right&&!P||b===ut.Left&&!W,de=b===ut.Down&&!V||b===ut.Up&&!U;if(ve&&re.x!==v.x){const Y=k.scrollLeft+x.x,Ce=b===ut.Right&&Y<=Z.x||b===ut.Left&&Y>=G.x;if(Ce&&!x.y){k.scrollTo({left:Y,behavior:d});return}Ce?z.x=k.scrollLeft-Y:z.x=b===ut.Right?k.scrollLeft-Z.x:k.scrollLeft-G.x,z.x&&k.scrollBy({left:-z.x,behavior:d});break}else if(de&&re.y!==v.y){const Y=k.scrollTop+x.y,Ce=b===ut.Down&&Y<=Z.y||b===ut.Up&&Y>=G.y;if(Ce&&!x.x){k.scrollTo({top:Y,behavior:d});return}Ce?z.y=k.scrollTop-Y:z.y=b===ut.Down?k.scrollTop-Z.y:k.scrollTop-G.y,z.y&&k.scrollBy({top:-z.y,behavior:d});break}}this.handleMove(t,wl(lu(v,this.referenceCoordinates),z))}}}handleMove(t,r){const{onMove:i}=this.props;t.preventDefault(),i(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}jg.activators=[{eventName:"onKeyDown",handler:(l,t,r)=>{let{keyboardCodes:i=Fg,onActivation:o}=t,{active:u}=r;const{code:c}=l.nativeEvent;if(i.start.includes(c)){const d=u.activatorNode.current;return d&&l.target!==d?!1:(l.preventDefault(),o==null||o({event:l.nativeEvent}),!0)}return!1}}];function gp(l){return!!(l&&"distance"in l)}function mp(l){return!!(l&&"delay"in l)}class Vf{constructor(t,r,i){var o;i===void 0&&(i=Ry(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;const{event:u}=t,{target:c}=u;this.props=t,this.events=r,this.document=Dl(c),this.documentListeners=new So(this.document),this.listeners=new So(i),this.windowListeners=new So(Yn(c)),this.initialCoordinates=(o=ou(u))!=null?o:Qr,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:i}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Pr.Resize,this.handleCancel),this.windowListeners.add(Pr.DragStart,pp),this.windowListeners.add(Pr.VisibilityChange,this.handleCancel),this.windowListeners.add(Pr.ContextMenu,pp),this.documentListeners.add(Pr.Keydown,this.handleKeydown),r){if(i!=null&&i({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(mp(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(gp(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,r){const{active:i,onPending:o}=this.props;o(i,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(Pr.Click,Ny,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Pr.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:i,initialCoordinates:o,props:u}=this,{onMove:c,options:{activationConstraint:d}}=u;if(!o)return;const p=(r=ou(t))!=null?r:Qr,m=lu(o,p);if(!i&&d){if(gp(d)){if(d.tolerance!=null&&of(m,d.tolerance))return this.handleCancel();if(of(m,d.distance))return this.handleStart()}if(mp(d)&&of(m,d.tolerance))return this.handleCancel();this.handlePending(d,m);return}t.cancelable&&t.preventDefault(),c(p)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===ut.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Ty={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class $f extends Vf{constructor(t){const{event:r}=t,i=Dl(r.target);super(t,Ty,i)}}$f.activators=[{eventName:"onPointerDown",handler:(l,t)=>{let{nativeEvent:r}=l,{onActivation:i}=t;return!r.isPrimary||r.button!==0?!1:(i==null||i({event:r}),!0)}}];const zy={move:{name:"mousemove"},end:{name:"mouseup"}};var Cf;(function(l){l[l.RightClick=2]="RightClick"})(Cf||(Cf={}));class My extends Vf{constructor(t){super(t,zy,Dl(t.event.target))}}My.activators=[{eventName:"onMouseDown",handler:(l,t)=>{let{nativeEvent:r}=l,{onActivation:i}=t;return r.button===Cf.RightClick?!1:(i==null||i({event:r}),!0)}}];const af={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class by extends Vf{constructor(t){super(t,af)}static setup(){return window.addEventListener(af.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(af.move.name,t)};function t(){}}}by.activators=[{eventName:"onTouchStart",handler:(l,t)=>{let{nativeEvent:r}=l,{onActivation:i}=t;const{touches:o}=r;return o.length>1?!1:(i==null||i({event:r}),!0)}}];var xo;(function(l){l[l.Pointer=0]="Pointer",l[l.DraggableRect=1]="DraggableRect"})(xo||(xo={}));var uu;(function(l){l[l.TreeOrder=0]="TreeOrder",l[l.ReversedTreeOrder=1]="ReversedTreeOrder"})(uu||(uu={}));function Oy(l){let{acceleration:t,activator:r=xo.Pointer,canScroll:i,draggingRect:o,enabled:u,interval:c=5,order:d=uu.TreeOrder,pointerCoordinates:p,scrollableAncestors:m,scrollableAncestorRects:w,delta:v,threshold:x}=l;const z=Py({delta:v,disabled:!u}),[R,k]=Gv(),b=j.useRef({x:0,y:0}),U=j.useRef({x:0,y:0}),P=j.useMemo(()=>{switch(r){case xo.Pointer:return p?{top:p.y,bottom:p.y,left:p.x,right:p.x}:null;case xo.DraggableRect:return o}},[r,o,p]),W=j.useRef(null),V=j.useCallback(()=>{const G=W.current;if(!G)return;const ee=b.current.x*U.current.x,re=b.current.y*U.current.y;G.scrollBy(ee,re)},[]),Z=j.useMemo(()=>d===uu.TreeOrder?[...m].reverse():m,[d,m]);j.useEffect(()=>{if(!u||!m.length||!P){k();return}for(const G of Z){if((i==null?void 0:i(G))===!1)continue;const ee=m.indexOf(G),re=w[ee];if(!re)continue;const{direction:ve,speed:de}=xy(G,re,P,t,x);for(const Y of["x","y"])z[Y][ve[Y]]||(de[Y]=0,ve[Y]=0);if(de.x>0||de.y>0){k(),W.current=G,R(V,c),b.current=de,U.current=ve;return}}b.current={x:0,y:0},U.current={x:0,y:0},k()},[t,V,i,k,u,c,JSON.stringify(P),JSON.stringify(z),R,m,Z,w,JSON.stringify(x)])}const Ly={x:{[pn.Backward]:!1,[pn.Forward]:!1},y:{[pn.Backward]:!1,[pn.Forward]:!1}};function Py(l){let{delta:t,disabled:r}=l;const i=su(t);return Oo(o=>{if(r||!i||!o)return Ly;const u={x:Math.sign(t.x-i.x),y:Math.sign(t.y-i.y)};return{x:{[pn.Backward]:o.x[pn.Backward]||u.x===-1,[pn.Forward]:o.x[pn.Forward]||u.x===1},y:{[pn.Backward]:o.y[pn.Backward]||u.y===-1,[pn.Forward]:o.y[pn.Forward]||u.y===1}}},[r,t,i])}function Ay(l,t){const r=t!=null?l.get(t):void 0,i=r?r.node.current:null;return Oo(o=>{var u;return t==null?null:(u=i??o)!=null?u:null},[i,t])}function Iy(l,t){return j.useMemo(()=>l.reduce((r,i)=>{const{sensor:o}=i,u=o.activators.map(c=>({eventName:c.eventName,handler:t(c.handler,i)}));return[...r,...u]},[]),[l,t])}var Do;(function(l){l[l.Always=0]="Always",l[l.BeforeDragging=1]="BeforeDragging",l[l.WhileDragging=2]="WhileDragging"})(Do||(Do={}));var kf;(function(l){l.Optimized="optimized"})(kf||(kf={}));const vp=new Map;function Hy(l,t){let{dragging:r,dependencies:i,config:o}=t;const[u,c]=j.useState(null),{frequency:d,measure:p,strategy:m}=o,w=j.useRef(l),v=b(),x=Ro(v),z=j.useCallback(function(U){U===void 0&&(U=[]),!x.current&&c(P=>P===null?U:P.concat(U.filter(W=>!P.includes(W))))},[x]),R=j.useRef(null),k=Oo(U=>{if(v&&!r)return vp;if(!U||U===vp||w.current!==l||u!=null){const P=new Map;for(let W of l){if(!W)continue;if(u&&u.length>0&&!u.includes(W.id)&&W.rect.current){P.set(W.id,W.rect.current);continue}const V=W.node.current,Z=V?new Uf(p(V),V):null;W.rect.current=Z,Z&&P.set(W.id,Z)}return P}return U},[l,u,r,v,p]);return j.useEffect(()=>{w.current=l},[l]),j.useEffect(()=>{v||z()},[r,v]),j.useEffect(()=>{u&&u.length>0&&c(null)},[JSON.stringify(u)]),j.useEffect(()=>{v||typeof d!="number"||R.current!==null||(R.current=setTimeout(()=>{z(),R.current=null},d))},[d,v,z,...i]),{droppableRects:k,measureDroppableContainers:z,measuringScheduled:u!=null};function b(){switch(m){case Do.Always:return!1;case Do.BeforeDragging:return r;default:return!r}}}function Gf(l,t){return Oo(r=>l?r||(typeof t=="function"?t(l):l):null,[t,l])}function Fy(l,t){return Gf(l,t)}function jy(l){let{callback:t,disabled:r}=l;const i=Su(t),o=j.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:u}=window;return new u(i)},[i,r]);return j.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function _u(l){let{callback:t,disabled:r}=l;const i=Su(t),o=j.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:u}=window;return new u(i)},[r]);return j.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function Wy(l){return new Uf(Lo(l),l)}function yp(l,t,r){t===void 0&&(t=Wy);const[i,o]=j.useState(null);function u(){o(p=>{if(!l)return null;if(l.isConnected===!1){var m;return(m=p??r)!=null?m:null}const w=t(l);return JSON.stringify(p)===JSON.stringify(w)?p:w})}const c=jy({callback(p){if(l)for(const m of p){const{type:w,target:v}=m;if(w==="childList"&&v instanceof HTMLElement&&v.contains(l)){u();break}}}}),d=_u({callback:u});return ki(()=>{u(),l?(d==null||d.observe(l),c==null||c.observe(document.body,{childList:!0,subtree:!0})):(d==null||d.disconnect(),c==null||c.disconnect())},[l]),i}function By(l){const t=Gf(l);return zg(l,t)}const wp=[];function Uy(l){const t=j.useRef(l),r=Oo(i=>l?i&&i!==wp&&l&&t.current&&l.parentNode===t.current.parentNode?i:Bf(l):wp,[l]);return j.useEffect(()=>{t.current=l},[l]),r}function Vy(l){const[t,r]=j.useState(null),i=j.useRef(l),o=j.useCallback(u=>{const c=lf(u.target);c&&r(d=>d?(d.set(c,Ef(c)),new Map(d)):null)},[]);return j.useEffect(()=>{const u=i.current;if(l!==u){c(u);const d=l.map(p=>{const m=lf(p);return m?(m.addEventListener("scroll",o,{passive:!0}),[m,Ef(m)]):null}).filter(p=>p!=null);r(d.length?new Map(d):null),i.current=l}return()=>{c(l),c(u)};function c(d){d.forEach(p=>{const m=lf(p);m==null||m.removeEventListener("scroll",o)})}},[o,l]),j.useMemo(()=>l.length?t?Array.from(t.values()).reduce((u,c)=>wl(u,c),Qr):Ig(l):Qr,[l,t])}function Sp(l,t){t===void 0&&(t=[]);const r=j.useRef(null);return j.useEffect(()=>{r.current=null},t),j.useEffect(()=>{const i=l!==Qr;i&&!r.current&&(r.current=l),!i&&r.current&&(r.current=null)},[l]),r.current?lu(l,r.current):Qr}function $y(l){j.useEffect(()=>{if(!wu)return;const t=l.map(r=>{let{sensor:i}=r;return i.setup==null?void 0:i.setup()});return()=>{for(const r of t)r==null||r()}},l.map(t=>{let{sensor:r}=t;return r}))}function Gy(l,t){return j.useMemo(()=>l.reduce((r,i)=>{let{eventName:o,handler:u}=i;return r[o]=c=>{u(c,t)},r},{}),[l,t])}function Wg(l){return j.useMemo(()=>l?vy(l):null,[l])}const xp=[];function Yy(l,t){t===void 0&&(t=Lo);const[r]=l,i=Wg(r?Yn(r):null),[o,u]=j.useState(xp);function c(){u(()=>l.length?l.map(p=>Pg(p)?i:new Uf(t(p),p)):xp)}const d=_u({callback:c});return ki(()=>{d==null||d.disconnect(),c(),l.forEach(p=>d==null?void 0:d.observe(p))},[l]),o}function Bg(l){if(!l)return null;if(l.children.length>1)return l;const t=l.children[0];return bo(t)?t:l}function Ky(l){let{measure:t}=l;const[r,i]=j.useState(null),o=j.useCallback(m=>{for(const{target:w}of m)if(bo(w)){i(v=>{const x=t(w);return v?{...v,width:x.width,height:x.height}:x});break}},[t]),u=_u({callback:o}),c=j.useCallback(m=>{const w=Bg(m);u==null||u.disconnect(),w&&(u==null||u.observe(w)),i(w?t(w):null)},[t,u]),[d,p]=iu(c);return j.useMemo(()=>({nodeRef:d,rect:r,setRef:p}),[r,d,p])}const Qy=[{sensor:$f,options:{}},{sensor:jg,options:{}}],Xy={current:{}},qa={draggable:{measure:hp},droppable:{measure:hp,strategy:Do.WhileDragging,frequency:kf.Optimized},dragOverlay:{measure:Lo}};class _o extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,i;return(r=(i=this.get(t))==null?void 0:i.node.current)!=null?r:void 0}}const qy={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new _o,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:au},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:qa,measureDroppableContainers:au,windowRect:null,measuringScheduled:!1},Ug={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:au,draggableNodes:new Map,over:null,measureDroppableContainers:au},Po=j.createContext(Ug),Vg=j.createContext(qy);function Jy(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new _o}}}function Zy(l,t){switch(t.type){case en.DragStart:return{...l,draggable:{...l.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case en.DragMove:return l.draggable.active==null?l:{...l,draggable:{...l.draggable,translate:{x:t.coordinates.x-l.draggable.initialCoordinates.x,y:t.coordinates.y-l.draggable.initialCoordinates.y}}};case en.DragEnd:case en.DragCancel:return{...l,draggable:{...l.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case en.RegisterDroppable:{const{element:r}=t,{id:i}=r,o=new _o(l.droppable.containers);return o.set(i,r),{...l,droppable:{...l.droppable,containers:o}}}case en.SetDroppableDisabled:{const{id:r,key:i,disabled:o}=t,u=l.droppable.containers.get(r);if(!u||i!==u.key)return l;const c=new _o(l.droppable.containers);return c.set(r,{...u,disabled:o}),{...l,droppable:{...l.droppable,containers:c}}}case en.UnregisterDroppable:{const{id:r,key:i}=t,o=l.droppable.containers.get(r);if(!o||i!==o.key)return l;const u=new _o(l.droppable.containers);return u.delete(r),{...l,droppable:{...l.droppable,containers:u}}}default:return l}}function e0(l){let{disabled:t}=l;const{active:r,activatorEvent:i,draggableNodes:o}=j.useContext(Po),u=su(i),c=su(r==null?void 0:r.id);return j.useEffect(()=>{if(!t&&!i&&u&&c!=null){if(!Wf(u)||document.activeElement===u.target)return;const d=o.get(c);if(!d)return;const{activatorNode:p,node:m}=d;if(!p.current&&!m.current)return;requestAnimationFrame(()=>{for(const w of[p.current,m.current]){if(!w)continue;const v=Qv(w);if(v){v.focus();break}}})}},[i,t,o,c,u]),null}function $g(l,t){let{transform:r,...i}=t;return l!=null&&l.length?l.reduce((o,u)=>u({transform:o,...i}),r):r}function t0(l){return j.useMemo(()=>({draggable:{...qa.draggable,...l==null?void 0:l.draggable},droppable:{...qa.droppable,...l==null?void 0:l.droppable},dragOverlay:{...qa.dragOverlay,...l==null?void 0:l.dragOverlay}}),[l==null?void 0:l.draggable,l==null?void 0:l.droppable,l==null?void 0:l.dragOverlay])}function n0(l){let{activeNode:t,measure:r,initialRect:i,config:o=!0}=l;const u=j.useRef(!1),{x:c,y:d}=typeof o=="boolean"?{x:o,y:o}:o;ki(()=>{if(!c&&!d||!t){u.current=!1;return}if(u.current||!i)return;const m=t==null?void 0:t.node.current;if(!m||m.isConnected===!1)return;const w=r(m),v=zg(w,i);if(c||(v.x=0),d||(v.y=0),u.current=!0,Math.abs(v.x)>0||Math.abs(v.y)>0){const x=bg(m);x&&x.scrollBy({top:v.y,left:v.x})}},[t,c,d,i,r])}const Eu=j.createContext({...Qr,scaleX:1,scaleY:1});var ns;(function(l){l[l.Uninitialized=0]="Uninitialized",l[l.Initializing=1]="Initializing",l[l.Initialized=2]="Initialized"})(ns||(ns={}));const r0=j.memo(function(t){var r,i,o,u;let{id:c,accessibility:d,autoScroll:p=!0,children:m,sensors:w=Qy,collisionDetection:v=fy,measuring:x,modifiers:z,...R}=t;const k=j.useReducer(Zy,void 0,Jy),[b,U]=k,[P,W]=ty(),[V,Z]=j.useState(ns.Uninitialized),G=V===ns.Initialized,{draggable:{active:ee,nodes:re,translate:ve},droppable:{containers:de}}=b,Y=ee!=null?re.get(ee):null,Ce=j.useRef({initial:null,translated:null}),ae=j.useMemo(()=>{var lt;return ee!=null?{id:ee,data:(lt=Y==null?void 0:Y.data)!=null?lt:Xy,rect:Ce}:null},[ee,Y]),ye=j.useRef(null),[me,De]=j.useState(null),[le,ie]=j.useState(null),oe=Ro(R,Object.values(R)),X=xu("DndDescribedBy",c),D=j.useMemo(()=>de.getEnabled(),[de]),H=t0(x),{droppableRects:K,measureDroppableContainers:xe,measuringScheduled:be}=Hy(D,{dragging:G,dependencies:[ve.x,ve.y],config:H.droppable}),ge=Ay(re,ee),_e=j.useMemo(()=>le?ou(le):null,[le]),He=zt(),Fe=Fy(ge,H.draggable.measure);n0({activeNode:ee!=null?re.get(ee):null,config:He.layoutShiftCompensation,initialRect:Fe,measure:H.draggable.measure});const Oe=yp(ge,H.draggable.measure,Fe),$t=yp(ge?ge.parentElement:null),Pt=j.useRef({activatorEvent:null,active:null,activeNode:ge,collisionRect:null,collisions:null,droppableRects:K,draggableNodes:re,draggingNode:null,draggingNodeRect:null,droppableContainers:de,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),At=de.getNodeFor((r=Pt.current.over)==null?void 0:r.id),It=Ky({measure:H.dragOverlay.measure}),Kn=(i=It.nodeRef.current)!=null?i:ge,Cn=G?(o=It.rect)!=null?o:Oe:null,_r=!!(It.nodeRef.current&&It.rect),Xr=By(_r?null:Oe),Pn=Wg(Kn?Yn(Kn):null),Ze=Uy(G?At??ge:null),nn=Yy(Ze),rn=$g(z,{transform:{x:ve.x-Xr.x,y:ve.y-Xr.y,scaleX:1,scaleY:1},activatorEvent:le,active:ae,activeNodeRect:Oe,containerNodeRect:$t,draggingNodeRect:Cn,over:Pt.current.over,overlayNodeRect:It.rect,scrollableAncestors:Ze,scrollableAncestorRects:nn,windowRect:Pn}),sr=_e?wl(_e,ve):null,Pe=Vy(Ze),ce=Sp(Pe),qe=Sp(Pe,[Oe]),et=wl(rn,ce),sn=Cn?py(Cn,rn):null,kn=ae&&sn?v({active:ae,collisionRect:sn,droppableRects:K,droppableContainers:D,pointerCoordinates:sr}):null,Gt=uy(kn,"id"),[Rt,ln]=j.useState(null),mn=_r?rn:wl(rn,qe),Yt=dy(mn,(u=Rt==null?void 0:Rt.rect)!=null?u:null,Oe),vn=j.useRef(null),qr=j.useCallback((lt,Kt)=>{let{sensor:on,options:ar}=Kt;if(ye.current==null)return;const yn=re.get(ye.current);if(!yn)return;const an=lt.nativeEvent,Rn=new on({active:ye.current,activeNode:yn,event:an,options:ar,context:Pt,onAbort(We){if(!re.get(We))return;const{onDragAbort:_t}=oe.current,un={id:We};_t==null||_t(un),P({type:"onDragAbort",event:un})},onPending(We,xt,_t,un){if(!re.get(We))return;const{onDragPending:Sn}=oe.current,Ht={id:We,constraint:xt,initialCoordinates:_t,offset:un};Sn==null||Sn(Ht),P({type:"onDragPending",event:Ht})},onStart(We){const xt=ye.current;if(xt==null)return;const _t=re.get(xt);if(!_t)return;const{onDragStart:un}=oe.current,vt={activatorEvent:an,active:{id:xt,data:_t.data,rect:Ce}};bs.unstable_batchedUpdates(()=>{un==null||un(vt),Z(ns.Initializing),U({type:en.DragStart,initialCoordinates:We,active:xt}),P({type:"onDragStart",event:vt}),De(vn.current),ie(an)})},onMove(We){U({type:en.DragMove,coordinates:We})},onEnd:wn(en.DragEnd),onCancel:wn(en.DragCancel)});vn.current=Rn;function wn(We){return async function(){const{active:_t,collisions:un,over:vt,scrollAdjustedTranslate:Sn}=Pt.current;let Ht=null;if(_t&&Sn){const{cancelDrop:Er}=oe.current;Ht={activatorEvent:an,active:_t,collisions:un,delta:Sn,over:vt},We===en.DragEnd&&typeof Er=="function"&&await Promise.resolve(Er(Ht))&&(We=en.DragCancel)}ye.current=null,bs.unstable_batchedUpdates(()=>{U({type:We}),Z(ns.Uninitialized),ln(null),De(null),ie(null),vn.current=null;const Er=We===en.DragEnd?"onDragEnd":"onDragCancel";if(Ht){const Ri=oe.current[Er];Ri==null||Ri(Ht),P({type:Er,event:Ht})}})}}},[re]),Jr=j.useCallback((lt,Kt)=>(on,ar)=>{const yn=on.nativeEvent,an=re.get(ar);if(ye.current!==null||!an||yn.dndKit||yn.defaultPrevented)return;const Rn={active:an};lt(on,Kt.options,Rn)===!0&&(yn.dndKit={capturedBy:Kt.sensor},ye.current=ar,qr(on,Kt))},[re,qr]),lr=Iy(w,Jr);$y(w),ki(()=>{Oe&&V===ns.Initializing&&Z(ns.Initialized)},[Oe,V]),j.useEffect(()=>{const{onDragMove:lt}=oe.current,{active:Kt,activatorEvent:on,collisions:ar,over:yn}=Pt.current;if(!Kt||!on)return;const an={active:Kt,activatorEvent:on,collisions:ar,delta:{x:et.x,y:et.y},over:yn};bs.unstable_batchedUpdates(()=>{lt==null||lt(an),P({type:"onDragMove",event:an})})},[et.x,et.y]),j.useEffect(()=>{const{active:lt,activatorEvent:Kt,collisions:on,droppableContainers:ar,scrollAdjustedTranslate:yn}=Pt.current;if(!lt||ye.current==null||!Kt||!yn)return;const{onDragOver:an}=oe.current,Rn=ar.get(Gt),wn=Rn&&Rn.rect.current?{id:Rn.id,rect:Rn.rect.current,data:Rn.data,disabled:Rn.disabled}:null,We={active:lt,activatorEvent:Kt,collisions:on,delta:{x:yn.x,y:yn.y},over:wn};bs.unstable_batchedUpdates(()=>{ln(wn),an==null||an(We),P({type:"onDragOver",event:We})})},[Gt]),ki(()=>{Pt.current={activatorEvent:le,active:ae,activeNode:ge,collisionRect:sn,collisions:kn,droppableRects:K,draggableNodes:re,draggingNode:Kn,draggingNodeRect:Cn,droppableContainers:de,over:Rt,scrollableAncestors:Ze,scrollAdjustedTranslate:et},Ce.current={initial:Cn,translated:sn}},[ae,ge,kn,sn,re,Kn,Cn,K,de,Rt,Ze,et]),Oy({...He,delta:ve,draggingRect:sn,pointerCoordinates:sr,scrollableAncestors:Ze,scrollableAncestorRects:nn});const or=j.useMemo(()=>({active:ae,activeNode:ge,activeNodeRect:Oe,activatorEvent:le,collisions:kn,containerNodeRect:$t,dragOverlay:It,draggableNodes:re,droppableContainers:de,droppableRects:K,over:Rt,measureDroppableContainers:xe,scrollableAncestors:Ze,scrollableAncestorRects:nn,measuringConfiguration:H,measuringScheduled:be,windowRect:Pn}),[ae,ge,Oe,le,kn,$t,It,re,de,K,Rt,xe,Ze,nn,H,be,Pn]),Zr=j.useMemo(()=>({activatorEvent:le,activators:lr,active:ae,activeNodeRect:Oe,ariaDescribedById:{draggable:X},dispatch:U,draggableNodes:re,over:Rt,measureDroppableContainers:xe}),[le,lr,ae,Oe,U,X,re,Rt,xe]);return ht.createElement(Tg.Provider,{value:W},ht.createElement(Po.Provider,{value:Zr},ht.createElement(Vg.Provider,{value:or},ht.createElement(Eu.Provider,{value:Yt},m)),ht.createElement(e0,{disabled:(d==null?void 0:d.restoreFocus)===!1})),ht.createElement(iy,{...d,hiddenTextDescribedById:X}));function zt(){const lt=(me==null?void 0:me.autoScrollEnabled)===!1,Kt=typeof p=="object"?p.enabled===!1:p===!1,on=G&&!lt&&!Kt;return typeof p=="object"?{...p,enabled:on}:{enabled:on}}}),i0=j.createContext(null),_p="button",s0="Draggable";function l0(l){let{id:t,data:r,disabled:i=!1,attributes:o}=l;const u=xu(s0),{activators:c,activatorEvent:d,active:p,activeNodeRect:m,ariaDescribedById:w,draggableNodes:v,over:x}=j.useContext(Po),{role:z=_p,roleDescription:R="draggable",tabIndex:k=0}=o??{},b=(p==null?void 0:p.id)===t,U=j.useContext(b?Eu:i0),[P,W]=iu(),[V,Z]=iu(),G=Gy(c,t),ee=Ro(r);ki(()=>(v.set(t,{id:t,key:u,node:P,activatorNode:V,data:ee}),()=>{const ve=v.get(t);ve&&ve.key===u&&v.delete(t)}),[v,t]);const re=j.useMemo(()=>({role:z,tabIndex:k,"aria-disabled":i,"aria-pressed":b&&z===_p?!0:void 0,"aria-roledescription":R,"aria-describedby":w.draggable}),[i,z,k,b,R,w.draggable]);return{active:p,activatorEvent:d,activeNodeRect:m,attributes:re,isDragging:b,listeners:i?void 0:G,node:P,over:x,setNodeRef:W,setActivatorNodeRef:Z,transform:U}}function o0(){return j.useContext(Vg)}const a0="Droppable",u0={timeout:25};function c0(l){let{data:t,disabled:r=!1,id:i,resizeObserverConfig:o}=l;const u=xu(a0),{active:c,dispatch:d,over:p,measureDroppableContainers:m}=j.useContext(Po),w=j.useRef({disabled:r}),v=j.useRef(!1),x=j.useRef(null),z=j.useRef(null),{disabled:R,updateMeasurementsFor:k,timeout:b}={...u0,...o},U=Ro(k??i),P=j.useCallback(()=>{if(!v.current){v.current=!0;return}z.current!=null&&clearTimeout(z.current),z.current=setTimeout(()=>{m(Array.isArray(U.current)?U.current:[U.current]),z.current=null},b)},[b]),W=_u({callback:P,disabled:R||!c}),V=j.useCallback((re,ve)=>{W&&(ve&&(W.unobserve(ve),v.current=!1),re&&W.observe(re))},[W]),[Z,G]=iu(V),ee=Ro(t);return j.useEffect(()=>{!W||!Z.current||(W.disconnect(),v.current=!1,W.observe(Z.current))},[Z,W]),j.useEffect(()=>(d({type:en.RegisterDroppable,element:{id:i,key:u,disabled:r,node:Z,rect:x,data:ee}}),()=>d({type:en.UnregisterDroppable,key:u,id:i})),[i]),j.useEffect(()=>{r!==w.current.disabled&&(d({type:en.SetDroppableDisabled,id:i,key:u,disabled:r}),w.current.disabled=r)},[i,u,r,d]),{active:c,rect:x,isOver:(p==null?void 0:p.id)===i,node:Z,over:p,setNodeRef:G}}function f0(l){let{animation:t,children:r}=l;const[i,o]=j.useState(null),[u,c]=j.useState(null),d=su(r);return!r&&!i&&d&&o(d),ki(()=>{if(!u)return;const p=i==null?void 0:i.key,m=i==null?void 0:i.props.id;if(p==null||m==null){o(null);return}Promise.resolve(t(m,u)).then(()=>{o(null)})},[t,i,u]),ht.createElement(ht.Fragment,null,r,i?j.cloneElement(i,{ref:c}):null)}const d0={x:0,y:0,scaleX:1,scaleY:1};function h0(l){let{children:t}=l;return ht.createElement(Po.Provider,{value:Ug},ht.createElement(Eu.Provider,{value:d0},t))}const p0={position:"fixed",touchAction:"none"},g0=l=>Wf(l)?"transform 250ms ease":void 0,m0=j.forwardRef((l,t)=>{let{as:r,activatorEvent:i,adjustScale:o,children:u,className:c,rect:d,style:p,transform:m,transition:w=g0}=l;if(!d)return null;const v=o?m:{...m,scaleX:1,scaleY:1},x={...p0,width:d.width,height:d.height,top:d.top,left:d.left,transform:No.Transform.toString(v),transformOrigin:o&&i?oy(i,d):void 0,transition:typeof w=="function"?w(i):w,...p};return ht.createElement(r,{className:c,style:x,ref:t},u)}),v0=l=>t=>{let{active:r,dragOverlay:i}=t;const o={},{styles:u,className:c}=l;if(u!=null&&u.active)for(const[d,p]of Object.entries(u.active))p!==void 0&&(o[d]=r.node.style.getPropertyValue(d),r.node.style.setProperty(d,p));if(u!=null&&u.dragOverlay)for(const[d,p]of Object.entries(u.dragOverlay))p!==void 0&&i.node.style.setProperty(d,p);return c!=null&&c.active&&r.node.classList.add(c.active),c!=null&&c.dragOverlay&&i.node.classList.add(c.dragOverlay),function(){for(const[p,m]of Object.entries(o))r.node.style.setProperty(p,m);c!=null&&c.active&&r.node.classList.remove(c.active)}},y0=l=>{let{transform:{initial:t,final:r}}=l;return[{transform:No.Transform.toString(t)},{transform:No.Transform.toString(r)}]},w0={duration:250,easing:"ease",keyframes:y0,sideEffects:v0({styles:{active:{opacity:"0"}}})};function S0(l){let{config:t,draggableNodes:r,droppableContainers:i,measuringConfiguration:o}=l;return Su((u,c)=>{if(t===null)return;const d=r.get(u);if(!d)return;const p=d.node.current;if(!p)return;const m=Bg(c);if(!m)return;const{transform:w}=Yn(c).getComputedStyle(c),v=Mg(w);if(!v)return;const x=typeof t=="function"?t:x0(t);return Hg(p,o.draggable.measure),x({active:{id:u,data:d.data,node:p,rect:o.draggable.measure(p)},draggableNodes:r,dragOverlay:{node:c,rect:o.dragOverlay.measure(m)},droppableContainers:i,measuringConfiguration:o,transform:v})})}function x0(l){const{duration:t,easing:r,sideEffects:i,keyframes:o}={...w0,...l};return u=>{let{active:c,dragOverlay:d,transform:p,...m}=u;if(!t)return;const w={x:d.rect.left-c.rect.left,y:d.rect.top-c.rect.top},v={scaleX:p.scaleX!==1?c.rect.width*p.scaleX/d.rect.width:1,scaleY:p.scaleY!==1?c.rect.height*p.scaleY/d.rect.height:1},x={x:p.x-w.x,y:p.y-w.y,...v},z=o({...m,active:c,dragOverlay:d,transform:{initial:p,final:x}}),[R]=z,k=z[z.length-1];if(JSON.stringify(R)===JSON.stringify(k))return;const b=i==null?void 0:i({active:c,dragOverlay:d,...m}),U=d.node.animate(z,{duration:t,easing:r,fill:"forwards"});return new Promise(P=>{U.onfinish=()=>{b==null||b(),P()}})}}let Ep=0;function _0(l){return j.useMemo(()=>{if(l!=null)return Ep++,Ep},[l])}const E0=ht.memo(l=>{let{adjustScale:t=!1,children:r,dropAnimation:i,style:o,transition:u,modifiers:c,wrapperElement:d="div",className:p,zIndex:m=999}=l;const{activatorEvent:w,active:v,activeNodeRect:x,containerNodeRect:z,draggableNodes:R,droppableContainers:k,dragOverlay:b,over:U,measuringConfiguration:P,scrollableAncestors:W,scrollableAncestorRects:V,windowRect:Z}=o0(),G=j.useContext(Eu),ee=_0(v==null?void 0:v.id),re=$g(c,{activatorEvent:w,active:v,activeNodeRect:x,containerNodeRect:z,draggingNodeRect:b.rect,over:U,overlayNodeRect:b.rect,scrollableAncestors:W,scrollableAncestorRects:V,transform:G,windowRect:Z}),ve=Gf(x),de=S0({config:i,draggableNodes:R,droppableContainers:k,measuringConfiguration:P}),Y=ve?b.setRef:void 0;return ht.createElement(h0,null,ht.createElement(f0,{animation:de},v&&ee?ht.createElement(m0,{key:ee,id:v.id,ref:Y,as:d,activatorEvent:w,adjustScale:t,className:p,transition:u,rect:ve,style:{zIndex:m,...o},transform:re},r):null))}),Cp=l=>{let t;const r=new Set,i=(m,w)=>{const v=typeof m=="function"?m(t):m;if(!Object.is(v,t)){const x=t;t=w??(typeof v!="object"||v===null)?v:Object.assign({},t,v),r.forEach(z=>z(t,x))}},o=()=>t,d={setState:i,getState:o,getInitialState:()=>p,subscribe:m=>(r.add(m),()=>r.delete(m))},p=t=l(i,o,d);return d},C0=(l=>l?Cp(l):Cp),k0=l=>l;function R0(l,t=k0){const r=ht.useSyncExternalStore(l.subscribe,ht.useCallback(()=>t(l.getState()),[l,t]),ht.useCallback(()=>t(l.getInitialState()),[l,t]));return ht.useDebugValue(r),r}const kp=l=>{const t=C0(l),r=i=>R0(t,i);return Object.assign(r,t),r},Gg=(l=>l?kp(l):kp),Yg="damiao.monitor.plotConfigs";function N0(){try{return JSON.parse(localStorage.getItem(Yg)||"{}")}catch{return{}}}function D0(l){try{localStorage.setItem(Yg,JSON.stringify(l))}catch{}}const gn=Gg((l,t)=>({connected:!1,status:null,signals:[],pairs:[],motors:[],motorTypes:[],plotConfigs:N0(),setConnected:r=>l({connected:r}),setStatus:r=>l({status:r}),setMeta:(r,i)=>l({signals:r,pairs:i}),setMotors:r=>l({motors:r}),setMotorTypes:r=>l({motorTypes:r}),ensurePlot:r=>l(i=>i.plotConfigs[r]?i:{plotConfigs:{...i.plotConfigs,[r]:{signals:[],duration:10}}}),setPlotConfig:(r,i)=>l(o=>({plotConfigs:{...o.plotConfigs,[r]:{...o.plotConfigs[r]||{signals:[],duration:10},...i}}})),addSignalToPlot:(r,i)=>l(o=>{const u=o.plotConfigs[r]||{signals:[],duration:10};return u.signals.includes(i)?o:{plotConfigs:{...o.plotConfigs,[r]:{...u,signals:[...u.signals,i]}}}}),removeSignalFromPlot:(r,i)=>l(o=>{const u=o.plotConfigs[r];return u?{plotConfigs:{...o.plotConfigs,[r]:{...u,signals:u.signals.filter(c=>c!==i)}}}:o}),dropPlot:r=>l(i=>{const o={...i.plotConfigs};return delete o[r],{plotConfigs:o}})}));gn.subscribe(l=>D0(l.plotConfigs));const Yf="damiao.monitor.widgets.v2";function T0(){try{const l=localStorage.getItem(Yf);if(!l)return null;const t=JSON.parse(l);return Array.isArray(t)&&t.length?t:null}catch{return null}}function uf(l){try{localStorage.setItem(Yf,JSON.stringify(l))}catch{}}const Rp=[{id:"plot-1",kind:"plot",x:0,y:0,w:7,h:6},{id:"cards-1",kind:"cards",x:7,y:0,w:5,h:6},{id:"table-1",kind:"table",x:0,y:6,w:7,h:5},{id:"rawlog-1",kind:"rawlog",x:7,y:6,w:5,h:5}];let Np=1;const Eo=Gg((l,t)=>({widgets:T0()||Rp,addWidget:r=>{Np+=1;const i=`${r}-${Date.now().toString(36)}-${Np}`,o=t().widgets.reduce((d,p)=>Math.max(d,p.y+p.h),0),u={id:i,kind:r,x:0,y:o,w:6,h:5},c=[...t().widgets,u];return uf(c),l({widgets:c}),i},removeWidget:r=>{const i=t().widgets.filter(o=>o.id!==r);uf(i),l({widgets:i})},updateGeom:r=>{const i=new Map(r.map(u=>[u.id,u])),o=t().widgets.map(u=>{const c=i.get(u.id);return c?{...u,x:c.x,y:c.y,w:c.w,h:c.h}:u});uf(o),l({widgets:o})},resetWidgets:()=>{try{localStorage.removeItem(Yf),localStorage.removeItem("damiao.monitor.plotConfigs")}catch{}l({widgets:Rp.map(r=>({...r}))})}})),z0=!0,tn="u-",M0="uplot",b0=tn+"hz",O0=tn+"vt",L0=tn+"title",P0=tn+"wrap",A0=tn+"under",I0=tn+"over",H0=tn+"axis",Ms=tn+"off",F0=tn+"select",j0=tn+"cursor-x",W0=tn+"cursor-y",B0=tn+"cursor-pt",U0=tn+"legend",V0=tn+"live",$0=tn+"inline",G0=tn+"series",Y0=tn+"marker",Dp=tn+"label",K0=tn+"value",vo="width",yo="height",po="top",Tp="bottom",gl="left",cf="right",Kf="#000",zp=Kf+"0",ff="mousemove",Mp="mousedown",df="mouseup",bp="mouseenter",Op="mouseleave",Lp="dblclick",Q0="resize",X0="scroll",Pp="change",cu="dppxchange",Qf="--",Tl=typeof window<"u",Rf=Tl?document:null,Sl=Tl?window:null,q0=Tl?navigator:null;let Je,Ka;function Nf(){let l=devicePixelRatio;Je!=l&&(Je=l,Ka&&Tf(Pp,Ka,Nf),Ka=matchMedia(`(min-resolution: ${Je-.001}dppx) and (max-resolution: ${Je+.001}dppx)`),Os(Pp,Ka,Nf),Sl.dispatchEvent(new CustomEvent(cu)))}function wr(l,t){if(t!=null){let r=l.classList;!r.contains(t)&&r.add(t)}}function Df(l,t){let r=l.classList;r.contains(t)&&r.remove(t)}function mt(l,t,r){l.style[t]=r+"px"}function $r(l,t,r,i){let o=Rf.createElement(l);return t!=null&&wr(o,t),r!=null&&r.insertBefore(o,i),o}function Lr(l,t){return $r("div",l,t)}const Ap=new WeakMap;function oi(l,t,r,i,o){let u="translate("+t+"px,"+r+"px)",c=Ap.get(l);u!=c&&(l.style.transform=u,Ap.set(l,u),t<0||r<0||t>i||r>o?wr(l,Ms):Df(l,Ms))}const Ip=new WeakMap;function Hp(l,t,r){let i=t+r,o=Ip.get(l);i!=o&&(Ip.set(l,i),l.style.background=t,l.style.borderColor=r)}const Fp=new WeakMap;function jp(l,t,r,i){let o=t+""+r,u=Fp.get(l);o!=u&&(Fp.set(l,o),l.style.height=r+"px",l.style.width=t+"px",l.style.marginLeft=i?-t/2+"px":0,l.style.marginTop=i?-r/2+"px":0)}const Xf={passive:!0},J0={...Xf,capture:!0};function Os(l,t,r,i){t.addEventListener(l,r,i?J0:Xf)}function Tf(l,t,r,i){t.removeEventListener(l,r,Xf)}Tl&&Nf();function Gr(l,t,r,i){let o;r=r||0,i=i||t.length-1;let u=i<=2147483647;for(;i-r>1;)o=u?r+i>>1:Sr((r+i)/2),t[o]{let u=-1,c=-1;for(let d=i;d<=o;d++)if(l(r[d])){u=d;break}for(let d=o;d>=i;d--)if(l(r[d])){c=d;break}return[u,c]}}const Qg=l=>l!=null,Xg=l=>l!=null&&l>0,Cu=Kg(Qg),Z0=Kg(Xg);function ew(l,t,r,i=0,o=!1){let u=o?Z0:Cu,c=o?Xg:Qg;[t,r]=u(l,t,r);let d=l[t],p=l[t];if(t>-1)if(i==1)d=l[t],p=l[r];else if(i==-1)d=l[r],p=l[t];else for(let m=t;m<=r;m++){let w=l[m];c(w)&&(wp&&(p=w))}return[d??ct,p??-ct]}function ku(l,t,r,i){let o=Up(l),u=Up(t);l==t&&(o==-1?(l*=r,t/=r):(l/=r,t*=r));let c=r==10?Ei:qg,d=o==1?Sr:Ar,p=u==1?Ar:Sr,m=d(c(Zt(l))),w=p(c(Zt(t))),v=_l(r,m),x=_l(r,w);return r==10&&(m<0&&(v=ft(v,-m)),w<0&&(x=ft(x,-w))),i||r==2?(l=v*o,t=x*u):(l=tm(l,v),t=Ru(t,x)),[l,t]}function qf(l,t,r,i){let o=ku(l,t,r,i);return l==0&&(o[0]=0),t==0&&(o[1]=0),o}const Jf=.1,Wp={mode:3,pad:Jf},Co={pad:0,soft:null,mode:0},tw={min:Co,max:Co};function fu(l,t,r,i){return Nu(r)?Bp(l,t,r):(Co.pad=r,Co.soft=i?0:null,Co.mode=i?3:0,Bp(l,t,tw))}function Xe(l,t){return l??t}function nw(l,t,r){for(t=Xe(t,0),r=Xe(r,l.length-1);t<=r;){if(l[t]!=null)return!0;t++}return!1}function Bp(l,t,r){let i=r.min,o=r.max,u=Xe(i.pad,0),c=Xe(o.pad,0),d=Xe(i.hard,-ct),p=Xe(o.hard,ct),m=Xe(i.soft,ct),w=Xe(o.soft,-ct),v=Xe(i.mode,0),x=Xe(o.mode,0),z=t-l,R=Ei(z),k=Gn(Zt(l),Zt(t)),b=Ei(k),U=Zt(b-R);(z<1e-24||U>10)&&(z=0,(l==0||t==0)&&(z=1e-24,v==2&&m!=ct&&(u=0),x==2&&w!=-ct&&(c=0)));let P=z||k||1e3,W=Ei(P),V=_l(10,Sr(W)),Z=P*(z==0?l==0?.1:1:u),G=ft(tm(l-Z,V/10),24),ee=l>=m&&(v==1||v==3&&G<=m||v==2&&G>=m)?m:ct,re=Gn(d,G=ee?ee:Yr(ee,G)),ve=P*(z==0?t==0?.1:1:c),de=ft(Ru(t+ve,V/10),24),Y=t<=w&&(x==1||x==3&&de>=w||x==2&&de<=w)?w:-ct,Ce=Yr(p,de>Y&&t<=Y?Y:Gn(Y,de));return re==Ce&&re==0&&(Ce=100),[re,Ce]}const rw=new Intl.NumberFormat(Tl?q0.language:"en-US"),Zf=l=>rw.format(l),xr=Math,Ja=xr.PI,Zt=xr.abs,Sr=xr.floor,Jt=xr.round,Ar=xr.ceil,Yr=xr.min,Gn=xr.max,_l=xr.pow,Up=xr.sign,Ei=xr.log10,qg=xr.log2,iw=(l,t=1)=>xr.sinh(l)*t,hf=(l,t=1)=>xr.asinh(l/t),ct=1/0;function Vp(l){return(Ei((l^l>>31)-(l>>31))|0)+1}function zf(l,t,r){return Yr(Gn(l,t),r)}function Jg(l){return typeof l=="function"}function Ve(l){return Jg(l)?l:()=>l}const sw=()=>{},Zg=l=>l,em=(l,t)=>t,lw=l=>null,$p=l=>!0,Gp=(l,t)=>l==t,ow=/\.\d*?(?=9{6,}|0{6,})/gm,Ps=l=>{if(rm(l)||is.has(l))return l;const t=`${l}`,r=t.match(ow);if(r==null)return l;let i=r[0].length-1;if(t.indexOf("e-")!=-1){let[o,u]=t.split("e");return+`${Ps(o)}e${u}`}return ft(l,i)};function Ts(l,t){return Ps(ft(Ps(l/t))*t)}function Ru(l,t){return Ps(Ar(Ps(l/t))*t)}function tm(l,t){return Ps(Sr(Ps(l/t))*t)}function ft(l,t=0){if(rm(l))return l;let r=10**t,i=l*r*(1+Number.EPSILON);return Jt(i)/r}const is=new Map;function nm(l){return((""+l).split(".")[1]||"").length}function To(l,t,r,i){let o=[],u=i.map(nm);for(let c=t;c=0?0:d)+(c>=u[m]?0:u[m]),x=l==10?w:ft(w,v);o.push(x),is.set(x,v)}}return o}const ko={},ed=[],El=[null,null],rs=Array.isArray,rm=Number.isInteger,aw=l=>l===void 0;function Yp(l){return typeof l=="string"}function Nu(l){let t=!1;if(l!=null){let r=l.constructor;t=r==null||r==Object}return t}function uw(l){return l!=null&&typeof l=="object"}const cw=Object.getPrototypeOf(Uint8Array),im="__proto__";function Cl(l,t=Nu){let r;if(rs(l)){let i=l.find(o=>o!=null);if(rs(i)||t(i)){r=Array(l.length);for(let o=0;ou){for(o=c-1;o>=0&&l[o]==null;)l[o--]=null;for(o=c+1;oc-d)],o=i[0].length,u=new Map;for(let c=0;c"u"?l=>Promise.resolve().then(l):queueMicrotask;function vw(l){let t=l[0],r=t.length,i=Array(r);for(let u=0;ut[u]-t[c]);let o=[];for(let u=0;u=i&&l[o]==null;)o--;if(o<=i)return!0;const u=Gn(1,Sr((o-i+1)/t));for(let c=l[i],d=i+u;d<=o;d+=u){const p=l[d];if(p!=null){if(p<=c)return!1;c=p}}return!0}const sm=["January","February","March","April","May","June","July","August","September","October","November","December"],lm=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function om(l){return l.slice(0,3)}const Sw=lm.map(om),xw=sm.map(om),_w={MMMM:sm,MMM:xw,WWWW:lm,WWW:Sw};function go(l){return(l<10?"0":"")+l}function Ew(l){return(l<10?"00":l<100?"0":"")+l}const Cw={YYYY:l=>l.getFullYear(),YY:l=>(l.getFullYear()+"").slice(2),MMMM:(l,t)=>t.MMMM[l.getMonth()],MMM:(l,t)=>t.MMM[l.getMonth()],MM:l=>go(l.getMonth()+1),M:l=>l.getMonth()+1,DD:l=>go(l.getDate()),D:l=>l.getDate(),WWWW:(l,t)=>t.WWWW[l.getDay()],WWW:(l,t)=>t.WWW[l.getDay()],HH:l=>go(l.getHours()),H:l=>l.getHours(),h:l=>{let t=l.getHours();return t==0?12:t>12?t-12:t},AA:l=>l.getHours()>=12?"PM":"AM",aa:l=>l.getHours()>=12?"pm":"am",a:l=>l.getHours()>=12?"p":"a",mm:l=>go(l.getMinutes()),m:l=>l.getMinutes(),ss:l=>go(l.getSeconds()),s:l=>l.getSeconds(),fff:l=>Ew(l.getMilliseconds())};function td(l,t){t=t||_w;let r=[],i=/\{([a-z]+)\}|[^{]+/gi,o;for(;o=i.exec(l);)r.push(o[0][0]=="{"?Cw[o[1]]:o[0]);return u=>{let c="";for(let d=0;dl%1==0,du=[1,2,2.5,5],Nw=To(10,-32,0,du),um=To(10,0,32,du),Dw=um.filter(am),zs=Nw.concat(um),nd=` -`,cm="{YYYY}",Kp=nd+cm,fm="{M}/{D}",wo=nd+fm,Qa=wo+"/{YY}",dm="{aa}",Tw="{h}:{mm}",vl=Tw+dm,Qp=nd+vl,Xp=":{ss}",nt=null;function hm(l){let t=l*1e3,r=t*60,i=r*60,o=i*24,u=o*30,c=o*365,p=(l==1?To(10,0,3,du).filter(am):To(10,-3,0,du)).concat([t,t*5,t*10,t*15,t*30,r,r*5,r*10,r*15,r*30,i,i*2,i*3,i*4,i*6,i*8,i*12,o,o*2,o*3,o*4,o*5,o*6,o*7,o*8,o*9,o*10,o*15,u,u*2,u*3,u*4,u*6,c,c*2,c*5,c*10,c*25,c*50,c*100]);const m=[[c,cm,nt,nt,nt,nt,nt,nt,1],[o*28,"{MMM}",Kp,nt,nt,nt,nt,nt,1],[o,fm,Kp,nt,nt,nt,nt,nt,1],[i,"{h}"+dm,Qa,nt,wo,nt,nt,nt,1],[r,vl,Qa,nt,wo,nt,nt,nt,1],[t,Xp,Qa+" "+vl,nt,wo+" "+vl,nt,Qp,nt,1],[l,Xp+".{fff}",Qa+" "+vl,nt,wo+" "+vl,nt,Qp,nt,1]];function w(v){return(x,z,R,k,b,U)=>{let P=[],W=b>=c,V=b>=u&&b=o?o:b,de=Sr(R)-Sr(G),Y=re+de+Ru(G-re,ve);P.push(Y);let Ce=v(Y),ae=Ce.getHours()+Ce.getMinutes()/r+Ce.getSeconds()/i,ye=b/i,me=x.axes[z]._space,De=U/me;for(;Y=ft(Y+b,l==1?0:3),!(Y>k);)if(ye>1){let le=Sr(ft(ae+ye,6))%24,X=v(Y).getHours()-le;X>1&&(X=-1),Y-=X*i,ae=(ae+ye)%24;let D=P[P.length-1];ft((Y-D)/b,3)*De>=.7&&P.push(Y)}else P.push(Y)}return P}}return[p,m,w]}const[zw,Mw,bw]=hm(1),[Ow,Lw,Pw]=hm(.001);To(2,-53,53,[1]);function qp(l,t){return l.map(r=>r.map((i,o)=>o==0||o==8||i==null?i:t(o==1||r[8]==0?i:r[1]+i)))}function Jp(l,t){return(r,i,o,u,c)=>{let d=t.find(R=>c>=R[0])||t[t.length-1],p,m,w,v,x,z;return i.map(R=>{let k=l(R),b=k.getFullYear(),U=k.getMonth(),P=k.getDate(),W=k.getHours(),V=k.getMinutes(),Z=k.getSeconds(),G=b!=p&&d[2]||U!=m&&d[3]||P!=w&&d[4]||W!=v&&d[5]||V!=x&&d[6]||Z!=z&&d[7]||d[1];return p=b,m=U,w=P,v=W,x=V,z=Z,G(k)})}}function Aw(l,t){let r=td(t);return(i,o,u,c,d)=>o.map(p=>r(l(p)))}function pf(l,t,r){return new Date(l,t,r)}function Zp(l,t){return t(l)}const Iw="{YYYY}-{MM}-{DD} {h}:{mm}{aa}";function eg(l,t){return(r,i,o,u)=>u==null?Qf:t(l(i))}function Hw(l,t){let r=l.series[t];return r.width?r.stroke(l,t):r.points.width?r.points.stroke(l,t):null}function Fw(l,t){return l.series[t].fill(l,t)}const jw={show:!0,live:!0,isolate:!1,mount:sw,markers:{show:!0,width:2,stroke:Hw,fill:Fw,dash:"solid"},idx:null,idxs:null,values:[]};function Ww(l,t){let r=l.cursor.points,i=Lr(),o=r.size(l,t);mt(i,vo,o),mt(i,yo,o);let u=o/-2;mt(i,"marginLeft",u),mt(i,"marginTop",u);let c=r.width(l,t,o);return c&&mt(i,"borderWidth",c),i}function Bw(l,t){let r=l.series[t].points;return r._fill||r._stroke}function Uw(l,t){let r=l.series[t].points;return r._stroke||r._fill}function Vw(l,t){return l.series[t].points.size}const gf=[0,0];function $w(l,t,r){return gf[0]=t,gf[1]=r,gf}function Xa(l,t,r,i=!0){return o=>{o.button==0&&(!i||o.target==t)&&r(o)}}function mf(l,t,r,i=!0){return o=>{(!i||o.target==t)&&r(o)}}const Gw={show:!0,x:!0,y:!0,lock:!1,move:$w,points:{one:!1,show:Ww,size:Vw,width:0,stroke:Uw,fill:Bw},bind:{mousedown:Xa,mouseup:Xa,click:Xa,dblclick:Xa,mousemove:mf,mouseleave:mf,mouseenter:mf},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,click:(l,t)=>{t.stopPropagation(),t.stopImmediatePropagation()},_x:!1,_y:!1},focus:{dist:(l,t,r,i,o)=>i-o,prox:-1,bias:0},hover:{skip:[void 0],prox:null,bias:0},left:-10,top:-10,idx:null,dataIdx:null,idxs:null,event:null},pm={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},rd=Vt({},pm,{filter:em}),gm=Vt({},rd,{size:10}),mm=Vt({},pm,{show:!1}),id='12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',vm="bold "+id,ym=1.5,tg={show:!0,scale:"x",stroke:Kf,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:vm,side:2,grid:rd,ticks:gm,border:mm,font:id,lineGap:ym,rotate:0},Yw="Value",Kw="Time",ng={show:!0,scale:"x",auto:!1,sorted:1,min:ct,max:-ct,idxs:[]};function Qw(l,t,r,i,o){return t.map(u=>u==null?"":Zf(u))}function Xw(l,t,r,i,o,u,c){let d=[],p=is.get(o)||0;r=c?r:ft(Ru(r,o),p);for(let m=r;m<=i;m=ft(m+o,p))d.push(Object.is(m,-0)?0:m);return d}function Mf(l,t,r,i,o,u,c){const d=[],p=l.scales[l.axes[t].scale].log,m=p==10?Ei:qg,w=Sr(m(r));o=_l(p,w),p==10&&(o=zs[Gr(o,zs)]);let v=r,x=o*p;p==10&&(x=zs[Gr(x,zs)]);do d.push(v),v=v+o,p==10&&!is.has(v)&&(v=ft(v,is.get(o))),v>=x&&(o=v,x=o*p,p==10&&(x=zs[Gr(x,zs)]));while(v<=i);return d}function qw(l,t,r,i,o,u,c){let p=l.scales[l.axes[t].scale].asinh,m=i>p?Mf(l,t,Gn(p,r),i,o):[p],w=i>=0&&r<=0?[0]:[];return(r<-p?Mf(l,t,Gn(p,-i),-r,o):[p]).reverse().map(x=>-x).concat(w,m)}const wm=/./,Jw=/[12357]/,Zw=/[125]/,rg=/1/,bf=(l,t,r,i)=>l.map((o,u)=>t==4&&o==0||u%i==0&&r.test(o.toExponential()[o<0?1:0])?o:null);function e1(l,t,r,i,o){let u=l.axes[r],c=u.scale,d=l.scales[c],p=l.valToPos,m=u._space,w=p(10,c),v=p(9,c)-w>=m?wm:p(7,c)-w>=m?Jw:p(5,c)-w>=m?Zw:rg;if(v==rg){let x=Zt(p(1,c)-w);if(xo,lg={show:!0,auto:!0,sorted:0,gaps:Sm,alpha:1,facets:[Vt({},sg,{scale:"x"}),Vt({},sg,{scale:"y"})]},og={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:Sm,alpha:1,points:{show:i1,filter:null},values:null,min:ct,max:-ct,idxs:[],path:null,clip:null};function s1(l,t,r,i,o){return r/10}const xm={time:z0,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},l1=Vt({},xm,{time:!1,ori:1}),ag={};function _m(l,t){let r=ag[l];return r||(r={key:l,plots:[],sub(i){r.plots.push(i)},unsub(i){r.plots=r.plots.filter(o=>o!=i)},pub(i,o,u,c,d,p,m){for(let w=0;w{let U=c.pxRound;const P=m.dir*(m.ori==0?1:-1),W=m.ori==0?zl:Ml;let V,Z;P==1?(V=r,Z=i):(V=i,Z=r);let G=U(v(d[V],m,k,z)),ee=U(x(p[V],w,b,R)),re=U(v(d[Z],m,k,z)),ve=U(x(u==1?w.max:w.min,w,b,R)),de=new Path2D(o);return W(de,re,ve),W(de,G,ve),W(de,G,ee),de})}function Du(l,t,r,i,o,u){let c=null;if(l.length>0){c=new Path2D;const d=t==0?Mu:od;let p=r;for(let v=0;vx[0]){let z=x[0]-p;z>0&&d(c,p,i,z,i+u),p=x[1]}}let m=r+o-p,w=10;m>0&&d(c,p,i-w/2,m,i+u+w)}return c}function a1(l,t,r){let i=l[l.length-1];i&&i[0]==t?i[1]=r:l.push([t,r])}function ld(l,t,r,i,o,u,c){let d=[],p=l.length;for(let m=o==1?r:i;m>=r&&m<=i;m+=o)if(t[m]===null){let v=m,x=m;if(o==1)for(;++m<=i&&t[m]===null;)x=m;else for(;--m>=r&&t[m]===null;)x=m;let z=u(l[v]),R=x==v?z:u(l[x]),k=v-o;z=c<=0&&k>=0&&k=0&&U>=0&&U=z&&d.push([z,R])}return d}function ug(l){return l==0?Zg:l==1?Jt:t=>Ts(t,l)}function Em(l){let t=l==0?Tu:zu,r=l==0?(o,u,c,d,p,m)=>{o.arcTo(u,c,d,p,m)}:(o,u,c,d,p,m)=>{o.arcTo(c,u,p,d,m)},i=l==0?(o,u,c,d,p)=>{o.rect(u,c,d,p)}:(o,u,c,d,p)=>{o.rect(c,u,p,d)};return(o,u,c,d,p,m=0,w=0)=>{m==0&&w==0?i(o,u,c,d,p):(m=Yr(m,d/2,p/2),w=Yr(w,d/2,p/2),t(o,u+m,c),r(o,u+d,c,u+d,c+p,m),r(o,u+d,c+p,u,c+p,w),r(o,u,c+p,u,c,w),r(o,u,c,u+d,c,m),o.closePath())}}const Tu=(l,t,r)=>{l.moveTo(t,r)},zu=(l,t,r)=>{l.moveTo(r,t)},zl=(l,t,r)=>{l.lineTo(t,r)},Ml=(l,t,r)=>{l.lineTo(r,t)},Mu=Em(0),od=Em(1),Cm=(l,t,r,i,o,u)=>{l.arc(t,r,i,o,u)},km=(l,t,r,i,o,u)=>{l.arc(r,t,i,o,u)},Rm=(l,t,r,i,o,u,c)=>{l.bezierCurveTo(t,r,i,o,u,c)},Nm=(l,t,r,i,o,u,c)=>{l.bezierCurveTo(r,t,o,i,c,u)};function Dm(l){return(t,r,i,o,u)=>As(t,r,(c,d,p,m,w,v,x,z,R,k,b)=>{let{pxRound:U,points:P}=c,W,V;m.ori==0?(W=Tu,V=Cm):(W=zu,V=km);const Z=ft(P.width*Je,3);let G=(P.size-P.width)/2*Je,ee=ft(G*2,3),re=new Path2D,ve=new Path2D,{left:de,top:Y,width:Ce,height:ae}=t.bbox;Mu(ve,de-ee,Y-ee,Ce+ee*2,ae+ee*2);const ye=me=>{if(p[me]!=null){let De=U(v(d[me],m,k,z)),le=U(x(p[me],w,b,R));W(re,De+G,le),V(re,De,le,G,0,Ja*2)}};if(u)u.forEach(ye);else for(let me=i;me<=o;me++)ye(me);return{stroke:Z>0?re:null,fill:re,clip:ve,flags:kl|Of}})}function Tm(l){return(t,r,i,o,u,c)=>{i!=o&&(u!=i&&c!=i&&l(t,r,i),u!=o&&c!=o&&l(t,r,o),l(t,r,c))}}const u1=Tm(zl),c1=Tm(Ml);function zm(l){const t=Xe(l==null?void 0:l.alignGaps,0);return(r,i,o,u)=>As(r,i,(c,d,p,m,w,v,x,z,R,k,b)=>{[o,u]=Cu(p,o,u);let U=c.pxRound,P=ae=>U(v(ae,m,k,z)),W=ae=>U(x(ae,w,b,R)),V,Z;m.ori==0?(V=zl,Z=u1):(V=Ml,Z=c1);const G=m.dir*(m.ori==0?1:-1),ee={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:kl},re=ee.stroke;let ve=!1;if(u-o>=k*4){let ae=K=>r.posToVal(K,m.key,!0),ye=null,me=null,De,le,ie,oe=P(d[G==1?o:u]),X=P(d[o]),D=P(d[u]),H=ae(G==1?X+1:D-1);for(let K=G==1?o:u;K>=o&&K<=u;K+=G){let xe=d[K],ge=(G==1?xeH)?oe:P(xe),_e=p[K];ge==oe?_e!=null?(le=_e,ye==null?(V(re,ge,W(le)),De=ye=me=le):leme&&(me=le)):_e===null&&(ve=!0):(ye!=null&&Z(re,oe,W(ye),W(me),W(De),W(le)),_e!=null?(le=_e,V(re,ge,W(le)),ye=me=De=le):(ye=me=null,_e===null&&(ve=!0)),oe=ge,H=ae(oe+G))}ye!=null&&ye!=me&&ie!=oe&&Z(re,oe,W(ye),W(me),W(De),W(le))}else for(let ae=G==1?o:u;ae>=o&&ae<=u;ae+=G){let ye=p[ae];ye===null?ve=!0:ye!=null&&V(re,P(d[ae]),W(ye))}let[Y,Ce]=sd(r,i);if(c.fill!=null||Y!=0){let ae=ee.fill=new Path2D(re),ye=c.fillTo(r,i,c.min,c.max,Y),me=W(ye),De=P(d[o]),le=P(d[u]);G==-1&&([le,De]=[De,le]),V(ae,le,me),V(ae,De,me)}if(!c.spanGaps){let ae=[];ve&&ae.push(...ld(d,p,o,u,G,P,t)),ee.gaps=ae=c.gaps(r,i,o,u,ae),ee.clip=Du(ae,m.ori,z,R,k,b)}return Ce!=0&&(ee.band=Ce==2?[Ci(r,i,o,u,re,-1),Ci(r,i,o,u,re,1)]:Ci(r,i,o,u,re,Ce)),ee})}function f1(l){const t=Xe(l.align,1),r=Xe(l.ascDesc,!1),i=Xe(l.alignGaps,0),o=Xe(l.extend,!1);return(u,c,d,p)=>As(u,c,(m,w,v,x,z,R,k,b,U,P,W)=>{[d,p]=Cu(v,d,p);let V=m.pxRound,{left:Z,width:G}=u.bbox,ee=X=>V(R(X,x,P,b)),re=X=>V(k(X,z,W,U)),ve=x.ori==0?zl:Ml;const de={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:kl},Y=de.stroke,Ce=x.dir*(x.ori==0?1:-1);let ae=re(v[Ce==1?d:p]),ye=ee(w[Ce==1?d:p]),me=ye,De=ye;o&&t==-1&&(De=Z,ve(Y,De,ae)),ve(Y,ye,ae);for(let X=Ce==1?d:p;X>=d&&X<=p;X+=Ce){let D=v[X];if(D==null)continue;let H=ee(w[X]),K=re(D);t==1?ve(Y,H,ae):ve(Y,me,K),ve(Y,H,K),ae=K,me=H}let le=me;o&&t==1&&(le=Z+G,ve(Y,le,ae));let[ie,oe]=sd(u,c);if(m.fill!=null||ie!=0){let X=de.fill=new Path2D(Y),D=m.fillTo(u,c,m.min,m.max,ie),H=re(D);ve(X,le,H),ve(X,De,H)}if(!m.spanGaps){let X=[];X.push(...ld(w,v,d,p,Ce,ee,i));let D=m.width*Je/2,H=r||t==1?D:-D,K=r||t==-1?-D:D;X.forEach(xe=>{xe[0]+=H,xe[1]+=K}),de.gaps=X=m.gaps(u,c,d,p,X),de.clip=Du(X,x.ori,b,U,P,W)}return oe!=0&&(de.band=oe==2?[Ci(u,c,d,p,Y,-1),Ci(u,c,d,p,Y,1)]:Ci(u,c,d,p,Y,oe)),de})}function cg(l,t,r,i,o,u,c=ct){if(l.length>1){let d=null;for(let p=0,m=1/0;p{}),{fill:v,stroke:x}=m;return(z,R,k,b)=>As(z,R,(U,P,W,V,Z,G,ee,re,ve,de,Y)=>{let Ce=U.pxRound,ae=r,ye=i*Je,me=d*Je,De=p*Je,le,ie;V.ori==0?[le,ie]=u(z,R):[ie,le]=u(z,R);const oe=V.dir*(V.ori==0?1:-1);let X=V.ori==0?Mu:od,D=V.ori==0?w:(ce,qe,et,sn,kn,Gt,Rt)=>{w(ce,qe,et,kn,sn,Rt,Gt)},H=Xe(z.bands,ed).find(ce=>ce.series[0]==R),K=H!=null?H.dir:0,xe=U.fillTo(z,R,U.min,U.max,K),be=Ce(ee(xe,Z,Y,ve)),ge,_e,He,Fe=de,Oe=Ce(U.width*Je),$t=!1,Pt=null,At=null,It=null,Kn=null;v!=null&&(Oe==0||x!=null)&&($t=!0,Pt=v.values(z,R,k,b),At=new Map,new Set(Pt).forEach(ce=>{ce!=null&&At.set(ce,new Path2D)}),Oe>0&&(It=x.values(z,R,k,b),Kn=new Map,new Set(It).forEach(ce=>{ce!=null&&Kn.set(ce,new Path2D)})));let{x0:Cn,size:_r}=m;if(Cn!=null&&_r!=null){ae=1,P=Cn.values(z,R,k,b),Cn.unit==2&&(P=P.map(et=>z.posToVal(re+et*de,V.key,!0)));let ce=_r.values(z,R,k,b);_r.unit==2?_e=ce[0]*de:_e=G(ce[0],V,de,re)-G(0,V,de,re),Fe=cg(P,W,G,V,de,re,Fe),He=Fe-_e+ye}else Fe=cg(P,W,G,V,de,re,Fe),He=Fe*c+ye,_e=Fe-He;He<1&&(He=0),Oe>=_e/2&&(Oe=0),He<5&&(Ce=Zg);let Xr=He>0,Pn=Fe-He-(Xr?Oe:0);_e=Ce(zf(Pn,De,me)),ge=(ae==0?_e/2:ae==oe?0:_e)-ae*oe*((ae==0?ye/2:0)+(Xr?Oe/2:0));const Ze={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},nn=$t?null:new Path2D;let rn=null;if(H!=null)rn=z.data[H.series[1]];else{let{y0:ce,y1:qe}=m;ce!=null&&qe!=null&&(W=qe.values(z,R,k,b),rn=ce.values(z,R,k,b))}let sr=le*_e,Pe=ie*_e;for(let ce=oe==1?k:b;ce>=k&&ce<=b;ce+=oe){let qe=W[ce];if(qe==null)continue;if(rn!=null){let Yt=rn[ce]??0;if(qe-Yt==0)continue;be=ee(Yt,Z,Y,ve)}let et=V.distr!=2||m!=null?P[ce]:ce,sn=G(et,V,de,re),kn=ee(Xe(qe,xe),Z,Y,ve),Gt=Ce(sn-ge),Rt=Ce(Gn(kn,be)),ln=Ce(Yr(kn,be)),mn=Rt-ln;if(qe!=null){let Yt=qe<0?Pe:sr,vn=qe<0?sr:Pe;$t?(Oe>0&&It[ce]!=null&&X(Kn.get(It[ce]),Gt,ln+Sr(Oe/2),_e,Gn(0,mn-Oe),Yt,vn),Pt[ce]!=null&&X(At.get(Pt[ce]),Gt,ln+Sr(Oe/2),_e,Gn(0,mn-Oe),Yt,vn)):X(nn,Gt,ln+Sr(Oe/2),_e,Gn(0,mn-Oe),Yt,vn),D(z,R,ce,Gt-Oe/2,ln,_e+Oe,mn)}}return Oe>0?Ze.stroke=$t?Kn:nn:$t||(Ze._fill=U.width==0?U._fill:U._stroke??U._fill,Ze.width=0),Ze.fill=$t?At:nn,Ze})}function h1(l,t){const r=Xe(t==null?void 0:t.alignGaps,0);return(i,o,u,c)=>As(i,o,(d,p,m,w,v,x,z,R,k,b,U)=>{[u,c]=Cu(m,u,c);let P=d.pxRound,W=le=>P(x(le,w,b,R)),V=le=>P(z(le,v,U,k)),Z,G,ee;w.ori==0?(Z=Tu,ee=zl,G=Rm):(Z=zu,ee=Ml,G=Nm);const re=w.dir*(w.ori==0?1:-1);let ve=W(p[re==1?u:c]),de=ve,Y=[],Ce=[];for(let le=re==1?u:c;le>=u&&le<=c;le+=re)if(m[le]!=null){let oe=p[le],X=W(oe);Y.push(de=X),Ce.push(V(m[le]))}const ae={stroke:l(Y,Ce,Z,ee,G,P),fill:null,clip:null,band:null,gaps:null,flags:kl},ye=ae.stroke;let[me,De]=sd(i,o);if(d.fill!=null||me!=0){let le=ae.fill=new Path2D(ye),ie=d.fillTo(i,o,d.min,d.max,me),oe=V(ie);ee(le,de,oe),ee(le,ve,oe)}if(!d.spanGaps){let le=[];le.push(...ld(p,m,u,c,re,W,r)),ae.gaps=le=d.gaps(i,o,u,c,le),ae.clip=Du(le,w.ori,R,k,b,U)}return De!=0&&(ae.band=De==2?[Ci(i,o,u,c,ye,-1),Ci(i,o,u,c,ye,1)]:Ci(i,o,u,c,ye,De)),ae})}function p1(l){return h1(g1,l)}function g1(l,t,r,i,o,u){const c=l.length;if(c<2)return null;const d=new Path2D;if(r(d,l[0],t[0]),c==2)i(d,l[1],t[1]);else{let p=Array(c),m=Array(c-1),w=Array(c-1),v=Array(c-1);for(let x=0;x0!=m[x]>0?p[x]=0:(p[x]=3*(v[x-1]+v[x])/((2*v[x]+v[x-1])/m[x-1]+(v[x]+2*v[x-1])/m[x]),isFinite(p[x])||(p[x]=0));p[c-1]=m[c-2];for(let x=0;x{Ln.pxRatio=Je}));const m1=zm(),v1=Dm();function dg(l,t,r,i){return(i?[l[0],l[1]].concat(l.slice(2)):[l[0]].concat(l.slice(1))).map((u,c)=>Pf(u,c,t,r))}function y1(l,t){return l.map((r,i)=>i==0?{}:Vt({},t,r))}function Pf(l,t,r,i){return Vt({},t==0?r:i,l)}function Mm(l,t,r){return t==null?El:[t,r]}const w1=Mm;function S1(l,t,r){return t==null?El:fu(t,r,Jf,!0)}function bm(l,t,r,i){return t==null?El:ku(t,r,l.scales[i].log,!1)}const x1=bm;function Om(l,t,r,i){return t==null?El:qf(t,r,l.scales[i].log,!1)}const _1=Om;function E1(l,t,r,i,o){let u=Gn(Vp(l),Vp(t)),c=t-l,d=Gr(o/i*c,r);do{let p=r[d],m=i*p/c;if(m>=o&&u+(p<5?is.get(p):0)<=17)return[p,m]}while(++d(t=Jt((r=+o)*Je))+"px"),[l,t,r]}function C1(l){l.show&&[l.font,l.labelFont].forEach(t=>{let r=ft(t[2]*Je,1);t[0]=t[0].replace(/[0-9.]+px/,r+"px"),t[1]=r})}function Ln(l,t,r){const i={mode:Xe(l.mode,1)},o=i.mode;function u(g,S,_,E){let T=S.valToPct(g);return E+_*(S.dir==-1?1-T:T)}function c(g,S,_,E){let T=S.valToPct(g);return E+_*(S.dir==-1?T:1-T)}function d(g,S,_,E){return S.ori==0?u(g,S,_,E):c(g,S,_,E)}i.valToPosH=u,i.valToPosV=c;let p=!1;i.status=0;const m=i.root=Lr(M0);if(l.id!=null&&(m.id=l.id),wr(m,l.class),l.title){let g=Lr(L0,m);g.textContent=l.title}const w=$r("canvas"),v=i.ctx=w.getContext("2d"),x=Lr(P0,m);Os("click",x,g=>{g.target===R&&(Ke!=fi||rt!=Ii)&&Qt.click(i,g)},!0);const z=i.under=Lr(A0,x);x.appendChild(w);const R=i.over=Lr(I0,x);l=Cl(l);const k=+Xe(l.pxAlign,1),b=ug(k);(l.plugins||[]).forEach(g=>{g.opts&&(l=g.opts(i,l)||l)});const U=l.ms||.001,P=i.series=o==1?dg(l.series||[],ng,og,!1):y1(l.series||[null],lg),W=i.axes=dg(l.axes||[],tg,ig,!0),V=i.scales={},Z=i.bands=l.bands||[];Z.forEach(g=>{g.fill=Ve(g.fill||null),g.dir=Xe(g.dir,-1)});const G=o==2?P[1].facets[0].scale:P[0].scale,ee={axes:Bo,series:Au},re=(l.drawOrder||["axes","series"]).map(g=>ee[g]);function ve(g){const S=g.distr==3?_=>Ei(_>0?_:g.clamp(i,_,g.min,g.max,g.key)):g.distr==4?_=>hf(_,g.asinh):g.distr==100?_=>g.fwd(_):_=>_;return _=>{let E=S(_),{_min:T,_max:L}=g,$=L-T;return(E-T)/$}}function de(g){let S=V[g];if(S==null){let _=(l.scales||ko)[g]||ko;if(_.from!=null){de(_.from);let E=Vt({},V[_.from],_,{key:g});E.valToPct=ve(E),V[g]=E}else{S=V[g]=Vt({},g==G?xm:l1,_),S.key=g;let E=S.time,T=S.range,L=rs(T);if((g!=G||o==2&&!E)&&(L&&(T[0]==null||T[1]==null)&&(T={min:T[0]==null?Wp:{mode:1,hard:T[0],soft:T[0]},max:T[1]==null?Wp:{mode:1,hard:T[1],soft:T[1]}},L=!1),!L&&Nu(T))){let $=T;T=(q,ne,ue)=>ne==null?El:fu(ne,ue,$)}S.range=Ve(T||(E?w1:g==G?S.distr==3?x1:S.distr==4?_1:Mm:S.distr==3?bm:S.distr==4?Om:S1)),S.auto=Ve(L?!1:S.auto),S.clamp=Ve(S.clamp||s1),S._min=S._max=null,S.valToPct=ve(S)}}}de("x"),de("y"),o==1&&P.forEach(g=>{de(g.scale)}),W.forEach(g=>{de(g.scale)});for(let g in l.scales)de(g);const Y=V[G],Ce=Y.distr;let ae,ye;Y.ori==0?(wr(m,b0),ae=u,ye=c):(wr(m,O0),ae=c,ye=u);const me={};for(let g in V){let S=V[g];(S.min!=null||S.max!=null)&&(me[g]={min:S.min,max:S.max},S.min=S.max=null)}const De=l.tzDate||(g=>new Date(Jt(g/U))),le=l.fmtDate||td,ie=U==1?bw(De):Pw(De),oe=Jp(De,qp(U==1?Mw:Lw,le)),X=eg(De,Zp(Iw,le)),D=[],H=i.legend=Vt({},jw,l.legend),K=i.cursor=Vt({},Gw,{drag:{y:o==2}},l.cursor),xe=H.show,be=K.show,ge=H.markers;H.idxs=D,ge.width=Ve(ge.width),ge.dash=Ve(ge.dash),ge.stroke=Ve(ge.stroke),ge.fill=Ve(ge.fill);let _e,He,Fe,Oe=[],$t=[],Pt,At=!1,It={};if(H.live){const g=P[1]?P[1].values:null;At=g!=null,Pt=At?g(i,1,0):{_:0};for(let S in Pt)It[S]=Qf}if(xe)if(_e=$r("table",U0,m),Fe=$r("tbody",null,_e),H.mount(i,_e),At){He=$r("thead",null,_e,Fe);let g=$r("tr",null,He);$r("th",null,g);for(var Kn in Pt)$r("th",Dp,g).textContent=Kn}else wr(_e,$0),H.live&&wr(_e,V0);const Cn={show:!0},_r={show:!1};function Xr(g,S){if(S==0&&(At||!H.live||o==2))return El;let _=[],E=$r("tr",G0,Fe,Fe.childNodes[S]);wr(E,g.class),g.show||wr(E,Ms);let T=$r("th",null,E);if(ge.show){let q=Lr(Y0,T);if(S>0){let ne=ge.width(i,S);ne&&(q.style.border=ne+"px "+ge.dash(i,S)+" "+ge.stroke(i,S)),q.style.background=ge.fill(i,S)}}let L=Lr(Dp,T);g.label instanceof HTMLElement?L.appendChild(g.label):L.textContent=g.label,S>0&&(ge.show||(L.style.color=g.width>0?ge.stroke(i,S):ge.fill(i,S)),Ze("click",T,q=>{if(K._lock)return;wn(q);let ne=P.indexOf(g);if((q.ctrlKey||q.metaKey)!=H.isolate){let ue=P.some((fe,he)=>he>0&&he!=ne&&fe.show);P.forEach((fe,he)=>{he>0&&dr(he,ue?he==ne?Cn:_r:Cn,!0,Dt.setSeries)})}else dr(ne,{show:!g.show},!0,Dt.setSeries)},!1),_t&&Ze(bp,T,q=>{K._lock||(wn(q),dr(P.indexOf(g),ji,!0,Dt.setSeries))},!1));for(var $ in Pt){let q=$r("td",K0,E);q.textContent="--",_.push(q)}return[E,_]}const Pn=new Map;function Ze(g,S,_,E=!0){const T=Pn.get(S)||{},L=K.bind[g](i,S,_,E);L&&(Os(g,S,T[g]=L),Pn.set(S,T))}function nn(g,S,_){const E=Pn.get(S)||{};for(let T in E)(g==null||T==g)&&(Tf(T,S,E[T]),delete E[T]);g==null&&Pn.delete(S)}let rn=0,sr=0,Pe=0,ce=0,qe=0,et=0,sn=qe,kn=et,Gt=Pe,Rt=ce,ln=0,mn=0,Yt=0,vn=0;i.bbox={};let qr=!1,Jr=!1,lr=!1,or=!1,Zr=!1,zt=!1;function lt(g,S,_){(_||g!=i.width||S!=i.height)&&Kt(g,S),ci(!1),lr=!0,Jr=!0,Hn()}function Kt(g,S){i.width=rn=Pe=g,i.height=sr=ce=S,qe=et=0,an(),Rn();let _=i.bbox;ln=_.left=Ts(qe*Je,.5),mn=_.top=Ts(et*Je,.5),Yt=_.width=Ts(Pe*Je,.5),vn=_.height=Ts(ce*Je,.5)}const on=3;function ar(){let g=!1,S=0;for(;!g;){S++;let _=Hl(S),E=Wo(S);g=S==on||_&&E,g||(Kt(i.width,i.height),Jr=!0)}}function yn({width:g,height:S}){lt(g,S)}i.setSize=yn;function an(){let g=!1,S=!1,_=!1,E=!1;W.forEach((T,L)=>{if(T.show&&T._show){let{side:$,_size:q}=T,ne=$%2,ue=T.label!=null?T.labelSize:0,fe=q+ue;fe>0&&(ne?(Pe-=fe,$==3?(qe+=fe,E=!0):_=!0):(ce-=fe,$==0?(et+=fe,g=!0):S=!0))}}),An[0]=g,An[1]=_,An[2]=S,An[3]=E,Pe-=Ir[1]+Ir[3],qe+=Ir[3],ce-=Ir[2]+Ir[0],et+=Ir[0]}function Rn(){let g=qe+Pe,S=et+ce,_=qe,E=et;function T(L,$){switch(L){case 1:return g+=$,g-$;case 2:return S+=$,S-$;case 3:return _-=$,_+$;case 0:return E-=$,E+$}}W.forEach((L,$)=>{if(L.show&&L._show){let q=L.side;L._pos=T(q,L._size),L.label!=null&&(L._lpos=T(q,L.labelSize))}})}if(K.dataIdx==null){let g=K.hover,S=g.skip=new Set(g.skip??[]);S.add(void 0);let _=g.prox=Ve(g.prox),E=g.bias??(g.bias=0);K.dataIdx=(T,L,$,q)=>{if(L==0)return $;let ne=$,ue=_(T,L,$,q)??ct,fe=ue>=0&&ue0;)S.has(Ue[ke])||(je=ke);if(E==0||E==1)for(ke=$;Te==null&&ke++ue&&(ne=null);return ne}}const wn=g=>{K.event=g};K.idxs=D,K._lock=!1;let We=K.points;We.show=Ve(We.show),We.size=Ve(We.size),We.stroke=Ve(We.stroke),We.width=Ve(We.width),We.fill=Ve(We.fill);const xt=i.focus=Vt({},l.focus||{alpha:.3},K.focus),_t=xt.prox>=0,un=_t&&We.one;let vt=[],Sn=[],Ht=[];function Er(g,S){let _=We.show(i,S);if(_ instanceof HTMLElement)return wr(_,B0),wr(_,g.class),oi(_,-10,-10,Pe,ce),R.insertBefore(_,vt[S]),_}function Ri(g,S){if(o==1||S>0){let _=o==1&&V[g.scale].time,E=g.value;g.value=_?Yp(E)?eg(De,Zp(E,le)):E||X:E||n1,g.label=g.label||(_?Kw:Yw)}if(un||S>0){g.width=g.width==null?1:g.width,g.paths=g.paths||m1||lw,g.fillTo=Ve(g.fillTo||o1),g.pxAlign=+Xe(g.pxAlign,k),g.pxRound=ug(g.pxAlign),g.stroke=Ve(g.stroke||null),g.fill=Ve(g.fill||null),g._stroke=g._fill=g._paths=g._focus=null;let _=r1(Gn(1,g.width),1),E=g.points=Vt({},{size:_,width:Gn(1,_*.2),stroke:g.stroke,space:_*2,paths:v1,_stroke:null,_fill:null},g.points);E.show=Ve(E.show),E.filter=Ve(E.filter),E.fill=Ve(E.fill),E.stroke=Ve(E.stroke),E.paths=Ve(E.paths),E.pxAlign=g.pxAlign}if(xe){let _=Xr(g,S);Oe.splice(S,0,_[0]),$t.splice(S,0,_[1]),H.values.push(null)}if(be){D.splice(S,0,null);let _=null;un?S==0&&(_=Er(g,S)):S>0&&(_=Er(g,S)),vt.splice(S,0,_),Sn.splice(S,0,0),Ht.splice(S,0,0)}jt("addSeries",S)}function Ou(g,S){S=S??P.length,g=o==1?Pf(g,S,ng,og):Pf(g,S,{},lg),P.splice(S,0,g),Ri(P[S],S)}i.addSeries=Ou;function Lu(g){if(P.splice(g,1),xe){H.values.splice(g,1),$t.splice(g,1);let S=Oe.splice(g,1)[0];nn(null,S.firstChild),S.remove()}be&&(D.splice(g,1),vt.splice(g,1)[0].remove(),Sn.splice(g,1),Ht.splice(g,1)),jt("delSeries",g)}i.delSeries=Lu;const An=[!1,!1,!1,!1];function Ao(g,S){if(g._show=g.show,g.show){let _=g.side%2,E=V[g.scale];E==null&&(g.scale=_?P[1].scale:G,E=V[g.scale]);let T=E.time;g.size=Ve(g.size),g.space=Ve(g.space),g.rotate=Ve(g.rotate),rs(g.incrs)&&g.incrs.forEach($=>{!is.has($)&&is.set($,nm($))}),g.incrs=Ve(g.incrs||(E.distr==2?Dw:T?U==1?zw:Ow:zs)),g.splits=Ve(g.splits||(T&&E.distr==1?ie:E.distr==3?Mf:E.distr==4?qw:Xw)),g.stroke=Ve(g.stroke),g.grid.stroke=Ve(g.grid.stroke),g.ticks.stroke=Ve(g.ticks.stroke),g.border.stroke=Ve(g.border.stroke);let L=g.values;g.values=rs(L)&&!rs(L[0])?Ve(L):T?rs(L)?Jp(De,qp(L,le)):Yp(L)?Aw(De,L):L||oe:L||Qw,g.filter=Ve(g.filter||(E.distr>=3&&E.log==10?e1:E.distr==3&&E.log==2?t1:em)),g.font=hg(g.font),g.labelFont=hg(g.labelFont),g._size=g.size(i,null,S,0),g._space=g._rotate=g._incrs=g._found=g._splits=g._values=null,g._size>0&&(An[S]=!0,g._el=Lr(H0,x))}}function Ni(g,S,_,E){let[T,L,$,q]=_,ne=S%2,ue=0;return ne==0&&(q||L)&&(ue=S==0&&!T||S==2&&!$?Jt(tg.size/3):0),ne==1&&(T||$)&&(ue=S==1&&!L||S==3&&!q?Jt(ig.size/2):0),ue}const Io=i.padding=(l.padding||[Ni,Ni,Ni,Ni]).map(g=>Ve(Xe(g,Ni))),Ir=i._padding=Io.map((g,S)=>g(i,S,An,0));let Ft,Mt=null,bt=null;const Is=o==1?P[0].idxs:null;let ur=null,ot=!1;function Ho(g,S){if(t=g??[],i.data=i._data=t,o==2){Ft=0;for(let _=1;_=0,zt=!0,Hn()}}i.setData=Ho;function ss(){ot=!0;let g,S;o==1&&(Ft>0?(Mt=Is[0]=0,bt=Is[1]=Ft-1,g=t[0][Mt],S=t[0][bt],Ce==2?(g=Mt,S=bt):g==S&&(Ce==3?[g,S]=ku(g,g,Y.log,!1):Ce==4?[g,S]=qf(g,g,Y.log,!1):Y.time?S=g+Jt(86400/U):[g,S]=fu(g,S,Jf,!0))):(Mt=Is[0]=g=null,bt=Is[1]=S=null)),fr(G,g,S)}let ls,Hr,bl,Hs,Di,Qn,Ol,In,Ll,Nn;function Fo(g,S,_,E,T,L){g??(g=zp),_??(_=ed),E??(E="butt"),T??(T=zp),L??(L="round"),g!=ls&&(v.strokeStyle=ls=g),T!=Hr&&(v.fillStyle=Hr=T),S!=bl&&(v.lineWidth=bl=S),L!=Di&&(v.lineJoin=Di=L),E!=Qn&&(v.lineCap=Qn=E),_!=Hs&&v.setLineDash(Hs=_)}function os(g,S,_,E){S!=Hr&&(v.fillStyle=Hr=S),g!=Ol&&(v.font=Ol=g),_!=In&&(v.textAlign=In=_),E!=Ll&&(v.textBaseline=Ll=E)}function Ti(g,S,_,E,T=0){if(E.length>0&&g.auto(i,ot)&&(S==null||S.min==null)){let L=Xe(Mt,0),$=Xe(bt,E.length-1),q=_.min==null?ew(E,L,$,T,g.distr==3):[_.min,_.max];g.min=Yr(g.min,_.min=q[0]),g.max=Gn(g.max,_.max=q[1])}}const zi={min:null,max:null};function Fs(){for(let E in V){let T=V[E];me[E]==null&&(T.min==null||me[G]!=null&&T.auto(i,ot))&&(me[E]=zi)}for(let E in V){let T=V[E];me[E]==null&&T.from!=null&&me[T.from]!=null&&(me[E]=zi)}me[G]!=null&&ci(!0);let g={};for(let E in me){let T=me[E];if(T!=null){let L=g[E]=Cl(V[E],uw);if(T.min!=null)Vt(L,T);else if(E!=G||o==2)if(Ft==0&&L.from==null){let $=L.range(i,null,null,E);L.min=$[0],L.max=$[1]}else L.min=ct,L.max=-ct}}if(Ft>0){P.forEach((E,T)=>{if(o==1){let L=E.scale,$=me[L];if($==null)return;let q=g[L];if(T==0){let ne=q.range(i,q.min,q.max,L);q.min=ne[0],q.max=ne[1],Mt=Gr(q.min,t[0]),bt=Gr(q.max,t[0]),bt-Mt>1&&(t[0][Mt]q.max&&bt--),E.min=ur[Mt],E.max=ur[bt]}else E.show&&E.auto&&Ti(q,$,E,t[T],E.sorted);E.idxs[0]=Mt,E.idxs[1]=bt}else if(T>0&&E.show&&E.auto){let[L,$]=E.facets,q=L.scale,ne=$.scale,[ue,fe]=t[T],he=g[q],Ae=g[ne];he!=null&&Ti(he,me[q],L,ue,L.sorted),Ae!=null&&Ti(Ae,me[ne],$,fe,$.sorted),E.min=$.min,E.max=$.max}});for(let E in g){let T=g[E],L=me[E];if(T.from==null&&(L==null||L.min==null)){let $=T.range(i,T.min==ct?null:T.min,T.max==-ct?null:T.max,E);T.min=$[0],T.max=$[1]}}}for(let E in g){let T=g[E];if(T.from!=null){let L=g[T.from];if(L.min==null)T.min=T.max=null;else{let $=T.range(i,L.min,L.max,E);T.min=$[0],T.max=$[1]}}}let S={},_=!1;for(let E in g){let T=g[E],L=V[E];if(L.min!=T.min||L.max!=T.max){L.min=T.min,L.max=T.max;let $=L.distr;L._min=$==3?Ei(L.min):$==4?hf(L.min,L.asinh):$==100?L.fwd(L.min):L.min,L._max=$==3?Ei(L.max):$==4?hf(L.max,L.asinh):$==100?L.fwd(L.max):L.max,S[E]=_=!0}}if(_){P.forEach((E,T)=>{o==2?T>0&&S.y&&(E._paths=null):S[E.scale]&&(E._paths=null)});for(let E in S)lr=!0,jt("setScale",E);be&&K.left>=0&&(or=zt=!0)}for(let E in me)me[E]=null}function Pu(g){let S=zf(Mt-1,0,Ft-1),_=zf(bt+1,0,Ft-1);for(;g[S]==null&&S>0;)S--;for(;g[_]==null&&_0){let g=P.some(S=>S._focus)&&Nn!=xt.alpha;g&&(v.globalAlpha=Nn=xt.alpha),P.forEach((S,_)=>{if(_>0&&S.show&&(js(_,!1),js(_,!0),S._paths==null)){let E=Nn;Nn!=S.alpha&&(v.globalAlpha=Nn=S.alpha);let T=o==2?[0,t[_][0].length-1]:Pu(t[_]);S._paths=S.paths(i,_,T[0],T[1]),Nn!=E&&(v.globalAlpha=Nn=E)}}),P.forEach((S,_)=>{if(_>0&&S.show){let E=Nn;Nn!=S.alpha&&(v.globalAlpha=Nn=S.alpha),S._paths!=null&&Pl(_,!1);{let T=S._paths!=null?S._paths.gaps:null,L=S.points.show(i,_,Mt,bt,T),$=S.points.filter(i,_,L,T);(L||$)&&(S.points._paths=S.points.paths(i,_,Mt,bt,$),Pl(_,!0))}Nn!=E&&(v.globalAlpha=Nn=E),jt("drawSeries",_)}}),g&&(v.globalAlpha=Nn=1)}}function js(g,S){let _=S?P[g].points:P[g];_._stroke=_.stroke(i,g),_._fill=_.fill(i,g)}function Pl(g,S){let _=S?P[g].points:P[g],{stroke:E,fill:T,clip:L,flags:$,_stroke:q=_._stroke,_fill:ne=_._fill,_width:ue=_.width}=_._paths;ue=ft(ue*Je,3);let fe=null,he=ue%2/2;S&&ne==null&&(ne=ue>0?"#fff":q);let Ae=_.pxAlign==1&&he>0;if(Ae&&v.translate(he,he),!S){let Ge=ln-ue/2,Ue=mn-ue/2,je=Yt+ue,Te=vn+ue;fe=new Path2D,fe.rect(Ge,Ue,je,Te)}S?Il(q,ue,_.dash,_.cap,ne,E,T,$,L):Al(g,q,ue,_.dash,_.cap,ne,E,T,$,fe,L),Ae&&v.translate(-he,-he)}function Al(g,S,_,E,T,L,$,q,ne,ue,fe){let he=!1;ne!=0&&Z.forEach((Ae,Ge)=>{if(Ae.series[0]==g){let Ue=P[Ae.series[1]],je=t[Ae.series[1]],Te=(Ue._paths||ko).band;rs(Te)&&(Te=Ae.dir==1?Te[0]:Te[1]);let ke,st=null;Ue.show&&Te&&nw(je,Mt,bt)?(st=Ae.fill(i,Ge)||L,ke=Ue._paths.clip):Te=null,Il(S,_,E,T,st,$,q,ne,ue,fe,ke,Te),he=!0}}),he||Il(S,_,E,T,L,$,q,ne,ue,fe)}const Mi=kl|Of;function Il(g,S,_,E,T,L,$,q,ne,ue,fe,he){Fo(g,S,_,E,T),(ne||ue||he)&&(v.save(),ne&&v.clip(ne),ue&&v.clip(ue)),he?(q&Mi)==Mi?(v.clip(he),fe&&v.clip(fe),$e(T,$),bi(g,L,S)):q&Of?($e(T,$),v.clip(he),bi(g,L,S)):q&kl&&(v.save(),v.clip(he),fe&&v.clip(fe),$e(T,$),v.restore(),bi(g,L,S)):($e(T,$),bi(g,L,S)),(ne||ue||he)&&v.restore()}function bi(g,S,_){_>0&&(S instanceof Map?S.forEach((E,T)=>{v.strokeStyle=ls=T,v.stroke(E)}):S!=null&&g&&v.stroke(S))}function $e(g,S){S instanceof Map?S.forEach((_,E)=>{v.fillStyle=Hr=E,v.fill(_)}):S!=null&&g&&v.fill(S)}function jo(g,S,_,E){let T=W[g],L;if(E<=0)L=[0,0];else{let $=T._space=T.space(i,g,S,_,E),q=T._incrs=T.incrs(i,g,S,_,E,$);L=E1(S,_,q,E,$)}return T._found=L}function Ws(g,S,_,E,T,L,$,q,ne,ue){let fe=$%2/2;k==1&&v.translate(fe,fe),Fo(q,$,ne,ue,q),v.beginPath();let he,Ae,Ge,Ue,je=T+(E==0||E==3?-L:L);_==0?(Ae=T,Ue=je):(he=T,Ge=je);for(let Te=0;Te{if(!_.show)return;let T=V[_.scale];if(T.min==null){_._show&&(S=!1,_._show=!1,ci(!1));return}else _._show||(S=!1,_._show=!0,ci(!1));let L=_.side,$=L%2,{min:q,max:ne}=T,[ue,fe]=jo(E,q,ne,$==0?Pe:ce);if(fe==0)return;let he=T.distr==2,Ae=_._splits=_.splits(i,E,q,ne,ue,fe,he),Ge=T.distr==2?Ae.map(ke=>ur[ke]):Ae,Ue=T.distr==2?ur[Ae[1]]-ur[Ae[0]]:ue,je=_._values=_.values(i,_.filter(i,Ge,E,fe,Ue),E,fe,Ue);_._rotate=L==2?_.rotate(i,je,E,fe):0;let Te=_._size;_._size=Ar(_.size(i,je,E,g)),Te!=null&&_._size!=Te&&(S=!1)}),S}function Wo(g){let S=!0;return Io.forEach((_,E)=>{let T=_(i,E,An,g);T!=Ir[E]&&(S=!1),Ir[E]=T}),S}function Bo(){for(let g=0;gur[xn]):Ge,je=fe.distr==2?ur[Ge[1]]-ur[Ge[0]]:ne,Te=S.ticks,ke=S.border,st=Te.show?Te.size:0,yt=Jt(st*Je),Wt=Jt((S.alignTo==2?S._size-st-S.gap:S.gap)*Je),tt=S._rotate*-Ja/180,wt=b(S._pos*Je),jn=(yt+Wt)*q,at=wt+jn;L=E==0?at:0,T=E==1?at:0;let cn=S.font[0],Jn=S.align==1?gl:S.align==2?cf:tt>0?gl:tt<0?cf:E==0?"center":_==3?cf:gl,pr=tt||E==1?"middle":_==2?po:Tp;os(cn,$,Jn,pr);let Tn=S.font[1]*S.lineGap,Wn=Ge.map(xn=>b(d(xn,fe,he,Ae))),Bn=S._values;for(let xn=0;xn{_>0&&(S._paths=null,g&&(o==1?(S.min=null,S.max=null):S.facets.forEach(E=>{E.min=null,E.max=null})))})}let Oi=!1,Li=!1,Xn=[];function ei(){Li=!1;for(let g=0;g0&&queueMicrotask(ei)}i.batch=as;function Pi(){if(qr&&(Fs(),qr=!1),lr&&(ar(),lr=!1),Jr){if(mt(z,gl,qe),mt(z,po,et),mt(z,vo,Pe),mt(z,yo,ce),mt(R,gl,qe),mt(R,po,et),mt(R,vo,Pe),mt(R,yo,ce),mt(x,vo,rn),mt(x,yo,sr),w.width=Jt(rn*Je),w.height=Jt(sr*Je),W.forEach(({_el:g,_show:S,_size:_,_pos:E,side:T})=>{if(g!=null)if(S){let L=T===3||T===0?_:0,$=T%2==1;mt(g,$?"left":"top",E-L),mt(g,$?"width":"height",_),mt(g,$?"top":"left",$?et:qe),mt(g,$?"height":"width",$?ce:Pe),Df(g,Ms)}else wr(g,Ms)}),ls=Hr=bl=Di=Qn=Ol=In=Ll=Hs=null,Nn=1,gs(!0),qe!=sn||et!=kn||Pe!=Gt||ce!=Rt){ci(!1);let g=Pe/Gt,S=ce/Rt;if(be&&!or&&K.left>=0){K.left*=g,K.top*=S,kr&&oi(kr,Jt(K.left),0,Pe,ce),Ai&&oi(Ai,0,Jt(K.top),Pe,ce);for(let _=0;_=0&&it.width>0){it.left*=g,it.width*=g,it.top*=S,it.height*=S;for(let _ in Vl)mt(di,_,it[_])}sn=qe,kn=et,Gt=Pe,Rt=ce}jt("setSize"),Jr=!1}rn>0&&sr>0&&(v.clearRect(0,0,w.width,w.height),jt("drawClear"),re.forEach(g=>g()),jt("draw")),it.show&&Zr&&(cr(it),Zr=!1),be&&or&&(hi(null,!0,!1),or=!1),H.show&&H.live&&zt&&(ps(),zt=!1),p||(p=!0,i.status=1,jt("ready")),ot=!1,Oi=!1}i.redraw=(g,S)=>{lr=S||!1,g!==!1?fr(G,Y.min,Y.max):Hn()};function Cr(g,S){let _=V[g];if(_.from==null){if(Ft==0){let E=_.range(i,S.min,S.max,g);S.min=E[0],S.max=E[1]}if(S.min>S.max){let E=S.min;S.min=S.max,S.max=E}if(Ft>1&&S.min!=null&&S.max!=null&&S.max-S.min<1e-16)return;g==G&&_.distr==2&&Ft>0&&(S.min=Gr(S.min,t[0]),S.max=Gr(S.max,t[0]),S.min==S.max&&S.max++),me[g]=S,qr=!0,Hn()}}i.setScale=Cr;let Fl,Bs,kr,Ai,jl,us,fi,Ii,Hi,Fi,Ke,rt,ti=!1;const Qt=K.drag;let Nt=Qt.x,Et=Qt.y;be&&(K.x&&(Fl=Lr(j0,R)),K.y&&(Bs=Lr(W0,R)),Y.ori==0?(kr=Fl,Ai=Bs):(kr=Bs,Ai=Fl),Ke=K.left,rt=K.top);const it=i.select=Vt({show:!0,over:!0,left:0,width:0,top:0,height:0},l.select),di=it.show?Lr(F0,it.over?R:z):null;function cr(g,S){if(it.show){for(let _ in g)it[_]=g[_],_ in Vl&&mt(di,_,g[_]);S!==!1&&jt("setSelect")}}i.setSelect=cr;function Wl(g){if(P[g].show)xe&&Df(Oe[g],Ms);else if(xe&&wr(Oe[g],Ms),be){let _=un?vt[0]:vt[g];_!=null&&oi(_,-10,-10,Pe,ce)}}function fr(g,S,_){Cr(g,{min:S,max:_})}function dr(g,S,_,E){S.focus!=null&&Bl(g),S.show!=null&&P.forEach((T,L)=>{L>0&&(g==L||g==null)&&(T.show=S.show,Wl(L),o==2?(fr(T.facets[0].scale,null,null),fr(T.facets[1].scale,null,null)):fr(T.scale,null,null),Hn())}),_!==!1&&jt("setSeries",g,S),E&&ms("setSeries",i,g,S)}i.setSeries=dr;function Us(g,S){Vt(Z[g],S)}function Vs(g,S){g.fill=Ve(g.fill||null),g.dir=Xe(g.dir,-1),S=S??Z.length,Z.splice(S,0,g)}function Uo(g){g==null?Z.length=0:Z.splice(g,1)}i.addBand=Vs,i.setBand=Us,i.delBand=Uo;function Fn(g,S){P[g].alpha=S,be&&vt[g]!=null&&(vt[g].style.opacity=S),xe&&Oe[g]&&(Oe[g].style.opacity=S)}let Dn,Rr,hr;const ji={focus:!0};function Bl(g){if(g!=hr){let S=g==null,_=xt.alpha!=1;P.forEach((E,T)=>{if(o==1||T>0){let L=S||T==0||T==g;E._focus=S?null:L,_&&Fn(T,L?1:xt.alpha)}}),hr=g,_&&Hn()}}xe&&_t&&Ze(Op,_e,g=>{K._lock||(wn(g),hr!=null&&dr(null,ji,!0,Dt.setSeries))});function qn(g,S,_){let E=V[S];_&&(g=g/Je-(E.ori==1?et:qe));let T=Pe;E.ori==1&&(T=ce,g=T-g),E.dir==-1&&(g=T-g);let L=E._min,$=E._max,q=g/T,ne=L+($-L)*q,ue=E.distr;return ue==3?_l(10,ne):ue==4?iw(ne,E.asinh):ue==100?E.bwd(ne):ne}function cs(g,S){let _=qn(g,G,S);return Gr(_,t[0],Mt,bt)}i.valToIdx=g=>Gr(g,t[0]),i.posToIdx=cs,i.posToVal=qn,i.valToPos=(g,S,_)=>V[S].ori==0?u(g,V[S],_?Yt:Pe,_?ln:0):c(g,V[S],_?vn:ce,_?mn:0),i.setCursor=(g,S,_)=>{Ke=g.left,rt=g.top,hi(null,S,_)};function fs(g,S){mt(di,gl,it.left=g),mt(di,vo,it.width=S)}function Ul(g,S){mt(di,po,it.top=g),mt(di,yo,it.height=S)}let ds=Y.ori==0?fs:Ul,hs=Y.ori==1?fs:Ul;function Iu(){if(xe&&H.live)for(let g=o==2?1:0;g{D[E]=_}):aw(g.idx)||D.fill(g.idx),H.idx=D[0]),xe&&H.live){for(let _=0;_0||o==1&&!At)&&Hu(_,D[_]);Iu()}zt=!1,S!==!1&&jt("setLegend")}i.setLegend=ps;function Hu(g,S){let _=P[g],E=g==0&&Ce==2?ur:t[g],T;At?T=_.values(i,g,S)??It:(T=_.value(i,S==null?null:E[S],g,S),T=T==null?It:{_:T}),H.values[g]=T}function hi(g,S,_){Hi=Ke,Fi=rt,[Ke,rt]=K.move(i,Ke,rt),K.left=Ke,K.top=rt,be&&(kr&&oi(kr,Jt(Ke),0,Pe,ce),Ai&&oi(Ai,0,Jt(rt),Pe,ce));let E,T=Mt>bt;Dn=ct,Rr=null;let L=Y.ori==0?Pe:ce,$=Y.ori==1?Pe:ce;if(Ke<0||Ft==0||T){E=K.idx=null;for(let q=0;q0&&st.show){let jn=tt==null?-10:tt==E?ue:ae(o==1?t[0][tt]:t[ke][0][tt],Y,L,0),at=wt==null?-10:ye(wt,o==1?V[st.scale]:V[st.facets[1].scale],$,0);if(_t&&wt!=null){let cn=Y.ori==1?Ke:rt,Jn=Zt(xt.dist(i,ke,tt,at,cn));if(Jn=0?1:-1,Bn=Tn>=0?1:-1;Bn==Wn&&(Bn==1?pr==1?wt>=Tn:wt<=Tn:pr==1?wt<=Tn:wt>=Tn)&&(Dn=Jn,Rr=ke)}else Dn=Jn,Rr=ke}}if(zt||un){let cn,Jn;Y.ori==0?(cn=jn,Jn=at):(cn=at,Jn=jn);let pr,Tn,Wn,Bn,Nr,xn,Bt=!0,Fr=We.bbox;if(Fr!=null){Bt=!1;let Ot=Fr(i,ke);Wn=Ot.left,Bn=Ot.top,pr=Ot.width,Tn=Ot.height}else Wn=cn,Bn=Jn,pr=Tn=We.size(i,ke);if(xn=We.fill(i,ke),Nr=We.stroke(i,ke),un)ke==Rr&&Dn<=xt.prox&&(fe=Wn,he=Bn,Ae=pr,Ge=Tn,Ue=Bt,je=xn,Te=Nr);else{let Ot=vt[ke];Ot!=null&&(Sn[ke]=Wn,Ht[ke]=Bn,jp(Ot,pr,Tn,Bt),Hp(Ot,xn,Nr),oi(Ot,Ar(Wn),Ar(Bn),Pe,ce))}}}}if(un){let ke=xt.prox,st=hr==null?Dn<=ke:Dn>ke||Rr!=hr;if(zt||st){let yt=vt[0];yt!=null&&(Sn[0]=fe,Ht[0]=he,jp(yt,Ae,Ge,Ue),Hp(yt,je,Te),oi(yt,Ar(fe),Ar(he),Pe,ce))}}}if(it.show&&ti)if(g!=null){let[q,ne]=Dt.scales,[ue,fe]=Dt.match,[he,Ae]=g.cursor.sync.scales,Ge=g.cursor.drag;if(Nt=Ge._x,Et=Ge._y,Nt||Et){let{left:Ue,top:je,width:Te,height:ke}=g.select,st=g.scales[he].ori,yt=g.posToVal,Wt,tt,wt,jn,at,cn=q!=null&&ue(q,he),Jn=ne!=null&&fe(ne,Ae);cn&&Nt?(st==0?(Wt=Ue,tt=Te):(Wt=je,tt=ke),wt=V[q],jn=ae(yt(Wt,he),wt,L,0),at=ae(yt(Wt+tt,he),wt,L,0),ds(Yr(jn,at),Zt(at-jn))):ds(0,L),Jn&&Et?(st==1?(Wt=Ue,tt=Te):(Wt=je,tt=ke),wt=V[ne],jn=ye(yt(Wt,Ae),wt,$,0),at=ye(yt(Wt+tt,Ae),wt,$,0),hs(Yr(jn,at),Zt(at-jn))):hs(0,$)}else $l()}else{let q=Zt(Hi-jl),ne=Zt(Fi-us);if(Y.ori==1){let Ae=q;q=ne,ne=Ae}Nt=Qt.x&&q>=Qt.dist,Et=Qt.y&&ne>=Qt.dist;let ue=Qt.uni;ue!=null?Nt&&Et&&(Nt=q>=ue,Et=ne>=ue,!Nt&&!Et&&(ne>q?Et=!0:Nt=!0)):Qt.x&&Qt.y&&(Nt||Et)&&(Nt=Et=!0);let fe,he;Nt&&(Y.ori==0?(fe=fi,he=Ke):(fe=Ii,he=rt),ds(Yr(fe,he),Zt(he-fe)),Et||hs(0,$)),Et&&(Y.ori==1?(fe=fi,he=Ke):(fe=Ii,he=rt),hs(Yr(fe,he),Zt(he-fe)),Nt||ds(0,L)),!Nt&&!Et&&(ds(0,0),hs(0,0))}if(Qt._x=Nt,Qt._y=Et,g==null){if(_){if(Ks!=null){let[q,ne]=Dt.scales;Dt.values[0]=q!=null?qn(Y.ori==0?Ke:rt,q):null,Dt.values[1]=ne!=null?qn(Y.ori==1?Ke:rt,ne):null}ms(ff,i,Ke,rt,Pe,ce,E)}if(_t){let q=_&&Dt.setSeries,ne=xt.prox;hr==null?Dn<=ne&&dr(Rr,ji,!0,q):Dn>ne?dr(null,ji,!0,q):Rr!=hr&&dr(Rr,ji,!0,q)}}zt&&(H.idx=E,ps()),S!==!1&&jt("setCursor")}let ni=null;Object.defineProperty(i,"rect",{get(){return ni==null&&gs(!1),ni}});function gs(g=!1){g?ni=null:(ni=R.getBoundingClientRect(),jt("syncRect",ni))}function Vo(g,S,_,E,T,L,$){K._lock||ti&&g!=null&&g.movementX==0&&g.movementY==0||($s(g,S,_,E,T,L,$,!1,g!=null),g!=null?hi(null,!0,!0):hi(S,!0,!1))}function $s(g,S,_,E,T,L,$,q,ne){if(ni==null&&gs(!1),wn(g),g!=null)_=g.clientX-ni.left,E=g.clientY-ni.top;else{if(_<0||E<0){Ke=-10,rt=-10;return}let[ue,fe]=Dt.scales,he=S.cursor.sync,[Ae,Ge]=he.values,[Ue,je]=he.scales,[Te,ke]=Dt.match,st=S.axes[0].side%2==1,yt=Y.ori==0?Pe:ce,Wt=Y.ori==1?Pe:ce,tt=st?L:T,wt=st?T:L,jn=st?E:_,at=st?_:E;if(Ue!=null?_=Te(ue,Ue)?d(Ae,V[ue],yt,0):-10:_=yt*(jn/tt),je!=null?E=ke(fe,je)?d(Ge,V[fe],Wt,0):-10:E=Wt*(at/wt),Y.ori==1){let cn=_;_=E,E=cn}}ne&&(S==null||S.cursor.event.type==ff)&&((_<=1||_>=Pe-1)&&(_=Ts(_,Pe)),(E<=1||E>=ce-1)&&(E=Ts(E,ce))),q?(jl=_,us=E,[fi,Ii]=K.move(i,_,E)):(Ke=_,rt=E)}const Vl={width:0,height:0,left:0,top:0};function $l(){cr(Vl,!1)}let $o,Go,Gs,Yo;function Ko(g,S,_,E,T,L,$){ti=!0,Nt=Et=Qt._x=Qt._y=!1,$s(g,S,_,E,T,L,$,!0,!1),g!=null&&(Ze(df,Rf,Qo,!1),ms(Mp,i,fi,Ii,Pe,ce,null));let{left:q,top:ne,width:ue,height:fe}=it;$o=q,Go=ne,Gs=ue,Yo=fe}function Qo(g,S,_,E,T,L,$){ti=Qt._x=Qt._y=!1,$s(g,S,_,E,T,L,$,!1,!0);let{left:q,top:ne,width:ue,height:fe}=it,he=ue>0||fe>0,Ae=$o!=q||Go!=ne||Gs!=ue||Yo!=fe;if(he&&Ae&&cr(it),Qt.setScale&&he&&Ae){let Ge=q,Ue=ue,je=ne,Te=fe;if(Y.ori==1&&(Ge=ne,Ue=fe,je=q,Te=ue),Nt&&fr(G,qn(Ge,G),qn(Ge+Ue,G)),Et)for(let ke in V){let st=V[ke];ke!=G&&st.from==null&&st.min!=ct&&fr(ke,qn(je+Te,ke),qn(je,ke))}$l()}else K.lock&&(K._lock=!K._lock,hi(S,!0,g!=null));g!=null&&(nn(df,Rf),ms(df,i,Ke,rt,Pe,ce,null))}function Xo(g,S,_,E,T,L,$){if(K._lock)return;wn(g);let q=ti;if(ti){let ne=!0,ue=!0,fe=10,he,Ae;Y.ori==0?(he=Nt,Ae=Et):(he=Et,Ae=Nt),he&&Ae&&(ne=Ke<=fe||Ke>=Pe-fe,ue=rt<=fe||rt>=ce-fe),he&&ne&&(Ke=Ke{let T=Dt.match[2];_=T(i,S,_),_!=-1&&dr(_,E,!0,!1)},be&&(Ze(Mp,R,Ko),Ze(ff,R,Vo),Ze(bp,R,g=>{wn(g),gs(!1)}),Ze(Op,R,Xo),Ze(Lp,R,qo),Lf.add(i),i.syncRect=gs);const Ys=i.hooks=l.hooks||{};function jt(g,S,_){Li?Xn.push([g,S,_]):g in Ys&&Ys[g].forEach(E=>{E.call(null,i,S,_)})}(l.plugins||[]).forEach(g=>{for(let S in g.hooks)Ys[S]=(Ys[S]||[]).concat(g.hooks[S])});const Zo=(g,S,_)=>_,Dt=Vt({key:null,setSeries:!1,filters:{pub:$p,sub:$p},scales:[G,P[1]?P[1].scale:null],match:[Gp,Gp,Zo],values:[null,null]},K.sync);Dt.match.length==2&&Dt.match.push(Zo),K.sync=Dt;const Ks=Dt.key,pi=_m(Ks);function ms(g,S,_,E,T,L,$){Dt.filters.pub(g,S,_,E,T,L,$)&&pi.pub(g,S,_,E,T,L,$)}pi.sub(i);function ea(g,S,_,E,T,L,$){Dt.filters.sub(g,S,_,E,T,L,$)&&Wi[g](null,S,_,E,T,L,$)}i.pub=ea;function ta(){pi.unsub(i),Lf.delete(i),Pn.clear(),Tf(cu,Sl,Jo),m.remove(),_e==null||_e.remove(),jt("destroy")}i.destroy=ta;function Qs(){jt("init",l,t),Ho(t||l.data,!1),me[G]?Cr(G,me[G]):ss(),Zr=it.show&&(it.width>0||it.height>0),or=zt=!0,lt(l.width,l.height)}return P.forEach(Ri),W.forEach(Ao),r?r instanceof HTMLElement?(r.appendChild(m),Qs()):r(i,Qs):Qs(),i}Ln.assign=Vt;Ln.fmtNum=Zf;Ln.rangeNum=fu;Ln.rangeLog=ku;Ln.rangeAsinh=qf;Ln.orient=As;Ln.pxRatio=Je;Ln.join=gw;Ln.fmtDate=td,Ln.tzDate=Rw;Ln.sync=_m;{Ln.addGap=a1,Ln.clipGaps=Du;let l=Ln.paths={points:Dm};l.linear=zm,l.stepped=f1,l.bars=d1,l.spline=p1}const k1=6e3;class R1{constructor(t=k1){fo(this,"t");fo(this,"v");fo(this,"len",0);fo(this,"head",0);this.t=new Float64Array(t),this.v=new Float64Array(t)}push(t,r){const i=this.t.length;this.t[this.head]=t,this.v[this.head]=r,this.head=(this.head+1)%i,this.len=t&&(u[d]=this.t[m],c[d]=this.v[m],d++)}return{t:u.subarray(0,d),v:c.subarray(0,d)}}last(){if(this.len===0)return null;const t=this.t.length;return this.v[(this.head-1+t)%t]}}const Af=new Map;function N1(l){let t=Af.get(l);return t||(t=new R1,Af.set(l,t)),t}function Lm(l,t){const r=N1(l);for(const[i,o]of t)r.push(i,o)}function Pm(l,t=-1/0){const r=Af.get(l);return r?r.read(t):{t:new Float64Array(0),v:new Float64Array(0)}}const xl=new Map;let Za=[];function Am(){Za.forEach(l=>l())}function D1(l){xl.set(l,(xl.get(l)||0)+1),Am()}function T1(l){const t=(xl.get(l)||0)-1;t<=0?xl.delete(l):xl.set(l,t),Am()}function z1(){return Array.from(xl.keys())}function M1(l){return Za.push(l),()=>{Za=Za.filter(t=>t!==l)}}const pg=3e3;let yl=[],eu=[];function b1(l){l.length&&(yl=yl.concat(l),yl.length>pg&&(yl=yl.slice(-pg)),eu.forEach(t=>t()))}function O1(){return yl}function L1(l){return eu.push(l),()=>{eu=eu.filter(t=>t!==l)}}let tu=0,nu=[];function gg(l){tu+=l?1:-1,tu<0&&(tu=0),nu.forEach(t=>t())}function P1(){return tu>0}function A1(l){return nu.push(l),()=>{nu=nu.filter(t=>t!==l)}}let Ls=null,vf=null;function I1(){return`${location.protocol==="https:"?"wss":"ws"}://${location.host}/api/monitor/stream`}function mg(){Ls&&Ls.readyState===WebSocket.OPEN&&Ls.send(JSON.stringify({type:"subscribe",signals:z1()}))}function vg(){Ls&&Ls.readyState===WebSocket.OPEN&&Ls.send(JSON.stringify({type:"raw",enabled:P1()}))}function Im(){const l=new WebSocket(I1());Ls=l,l.onopen=()=>{gn.getState().setConnected(!0),mg(),vg()},l.onclose=()=>{gn.getState().setConnected(!1),vf==null&&(vf=window.setTimeout(()=>{vf=null,Im()},1e3))},l.onerror=()=>l.close(),l.onmessage=r=>{let i;try{i=JSON.parse(r.data)}catch{return}const o=gn.getState();switch(i.type){case"meta":o.setMeta(i.signals,i.pairs),o.setMotors(i.motors);break;case"motors":o.setMotors(i.motors),i.status&&o.setStatus(i.status);break;case"samples":for(const[u,c]of Object.entries(i.data))Lm(u,c);break;case"raw":b1(i.frames);break}};let t=null;M1(()=>{t==null&&(t=window.setTimeout(()=>{t=null,mg()},80))}),A1(vg)}async function H1(l,t=600){return l.length?(await fetch(`/api/monitor/snapshot?signals=${l.join(",")}&n=${t}`)).json():{}}async function F1(){try{return(await(await fetch("/api/monitor/motor-types")).json()).types||[]}catch{return[]}}async function j1(l,t){await fetch("/api/monitor/motor-type",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({motorId:l,motorType:t})})}const W1={pos:"#58a6ff",vel:"#3fb950",torque:"#d29922",kp:"#bc8cff",kd:"#f778ba",vel_limit:"#56d4dd",torque_limit:"#e3b341",t_mos:"#ff7b72",t_rotor:"#ffa657",status_code:"#8b949e"};function B1(l){return W1[l]||"#8b949e"}function ru(l){const t=B1(l.field);return l.source==="cmd"?U1(t,.15):t}function If(l){const t=l.split(":");return t.length>=3?`${t[1]} ${t[2]}`:l}function yg(l){return l.includes(":cmd.")}const wg=["pos","vel","torque","kp","kd","t_mos","t_rotor"];function U1(l,t){const r=l.replace("#",""),i=Math.min(255,Math.round(parseInt(r.slice(0,2),16)+255*t)),o=Math.min(255,Math.round(parseInt(r.slice(2,4),16)+255*t)),u=Math.min(255,Math.round(parseInt(r.slice(4,6),16)+255*t));return`rgb(${i},${o},${u})`}function Rl(l,t=3){return l==null||Number.isNaN(l)?"—":l.toFixed(t)}const Sg=2e3;function V1(l,t){const r=l.map(c=>Pm(c,t)),i=new Set;for(const c of r)for(let d=0;dc-d);if(o.length>Sg){const c=Math.ceil(o.length/Sg);o=o.filter((d,p)=>p%c===0)}const u=[o];for(const c of r){const d=new Array(o.length).fill(null);let p=0,m=null;for(let w=0;wk.ensurePlot),r=gn(k=>k.removeSignalFromPlot),i=gn(k=>k.setPlotConfig),o=gn(k=>k.plotConfigs[l]),u=gn(k=>k.signals);j.useEffect(()=>{t(l)},[l,t]);const c=(o==null?void 0:o.signals)??[],d=(o==null?void 0:o.duration)??10,p=c.join("|"),{setNodeRef:m,isOver:w}=c0({id:`plot:${l}`,data:{panelId:l}}),v=j.useRef(null),x=j.useRef(null),z=j.useRef(0);j.useEffect(()=>{if(!v.current)return;const k=v.current,b=new Map(u.map(Z=>[Z.id,Z])),U=[{label:"t"},...c.map(Z=>{const G=b.get(Z),ee=G?ru(G):"#8b949e";return{label:If(Z),stroke:ee,width:1.5,dash:yg(Z)?[6,4]:void 0,points:{show:!1}}})],P={width:k.clientWidth||400,height:k.clientHeight||220,legend:{show:!1},series:U,cursor:{y:!1,points:{show:!0}},scales:{x:{time:!1}},axes:[{stroke:"#8b949e",grid:{stroke:"rgba(139,148,158,0.12)"},ticks:{stroke:"rgba(139,148,158,0.2)"},values:(Z,G)=>G.map(ee=>(ee-z.current).toFixed(1)+"s")},{stroke:"#8b949e",grid:{stroke:"rgba(139,148,158,0.12)"},ticks:{stroke:"rgba(139,148,158,0.2)"}}]},W=new Ln(P,[[],...c.map(()=>[])],k);x.current=W;const V=new ResizeObserver(()=>{W.setSize({width:k.clientWidth,height:k.clientHeight})});return V.observe(k),()=>{V.disconnect(),W.destroy(),x.current=null}},[p,u.length]),j.useEffect(()=>{if(!c.length)return;c.forEach(D1);let k=!1;return H1(c,1200).then(b=>{if(!k)for(const[U,P]of Object.entries(b))Lm(U,P)}),()=>{k=!0,c.forEach(T1)}},[p]),j.useEffect(()=>{let k=0;const b=()=>{const U=x.current;if(U&&c.length){let P=0;for(const V of c){const Z=Pm(V);Z.t.length&&(P=Math.max(P,Z.t[Z.t.length-1]))}z.current=P;const W=V1(c,P-d);U.setData(W,!1),U.setScale("x",{min:P-d,max:P})}k=requestAnimationFrame(b)};return k=requestAnimationFrame(b),()=>cancelAnimationFrame(k)},[p,d]);const R=j.useMemo(()=>new Map(u.map(k=>[k.id,k])),[u]);return B.jsxs("div",{className:"panel plot-panel",ref:m,children:[B.jsxs("div",{className:"plot-toolbar",children:[B.jsx("span",{className:"muted",children:"window"}),B.jsx("select",{value:d,onChange:k=>i(l,{duration:Number(k.target.value)}),children:[5,10,20,30,60].map(k=>B.jsxs("option",{value:k,children:[k,"s"]},k))}),B.jsx("div",{className:"legend",children:c.map(k=>{const b=R.get(k);return B.jsxs("span",{className:"legend-chip",style:{borderColor:b?ru(b):"#555"},children:[B.jsx("span",{className:"legend-swatch",style:{background:b?ru(b):"#555",borderStyle:yg(k)?"dashed":"solid"}}),If(k),B.jsx("button",{className:"legend-x",onClick:()=>r(l,k),children:"×"})]},k)})})]}),B.jsx("div",{className:"plot-host"+(w?" drop-over":""),ref:v,children:c.length===0&&B.jsx("div",{className:"drop-hint",children:"Drag signals here to plot — drop cmd onto fb to overlay"})})]})}const yf=[["pos","cmd p"],["vel","cmd v"],["kp","kp"],["kd","kd"],["torque","cmd τ"]],wf=[["pos","act p"],["vel","act v"],["torque","act τ"],["t_mos","Tmos"],["t_rotor","Trot"]];function G1(){const l=gn(t=>t.motors);return B.jsx("div",{className:"panel table-panel",children:B.jsxs("table",{className:"motor-table",children:[B.jsx("thead",{children:B.jsxs("tr",{children:[B.jsx("th",{children:"Motor"}),B.jsx("th",{children:"Mode"}),B.jsx("th",{children:"Status"}),yf.map(([t,r])=>B.jsx("th",{className:"cmd-col",children:r},"c"+t)),wf.map(([t,r])=>B.jsx("th",{children:r},"f"+t))]})}),B.jsxs("tbody",{children:[l.length===0&&B.jsx("tr",{children:B.jsx("td",{colSpan:3+yf.length+wf.length,className:"muted center",children:"Waiting for traffic…"})}),l.map(t=>B.jsxs("tr",{children:[B.jsxs("td",{className:"mono",children:["m",t.motorId]}),B.jsx("td",{className:"muted",children:t.mode||"—"}),B.jsx("td",{children:B.jsx("span",{className:"status-pill "+(t.status==="ENABLED"?"ok":t.status==="DISABLED"?"off":"warn"),children:t.status||"—"})}),yf.map(([r])=>B.jsx("td",{className:"mono cmd-col",children:Rl(t.cmd[r],r==="kp"?0:3)},"c"+r)),wf.map(([r])=>B.jsx("td",{className:"mono",children:Rl(t.fb[r],r.startsWith("t_")?1:3)},"f"+r))]},`${t.bus}:${t.motorId}`))]})]})})}function Sf({label:l,cmd:t,act:r,unit:i,digits:o=2}){return B.jsxs("div",{className:"metric",children:[B.jsxs("div",{className:"metric-label",children:[l," ",B.jsx("span",{className:"muted",children:i})]}),B.jsxs("div",{className:"metric-values",children:[B.jsx("span",{className:"metric-act",children:Rl(r,o)}),t!==void 0&&B.jsxs("span",{className:"metric-cmd",children:["⌖ ",Rl(t,o)]})]})]})}function Y1(){const l=gn(r=>r.motors),t=gn(r=>r.motorTypes);return B.jsxs("div",{className:"panel cards-panel",children:[l.length===0&&B.jsx("div",{className:"muted center pad",children:"Waiting for traffic…"}),B.jsx("div",{className:"cards-grid",children:l.map(r=>B.jsxs("div",{className:"motor-card",children:[B.jsxs("div",{className:"motor-card-head",children:[B.jsxs("span",{className:"mono strong",children:["Motor ",r.motorId]}),B.jsx("span",{className:"status-pill "+(r.status==="ENABLED"?"ok":r.status==="DISABLED"?"off":"warn"),children:r.status||"—"})]}),B.jsxs("div",{className:"motor-card-sub",children:[B.jsx("span",{className:"muted",children:r.mode||"—"}),t.length>0&&B.jsxs("select",{className:"type-select",defaultValue:"",onChange:i=>i.target.value&&j1(r.motorId,i.target.value),title:"Override motor type used to scale this motor's values",children:[B.jsx("option",{value:"",children:"set type…"}),t.map(i=>B.jsx("option",{value:i,children:i},i))]})]}),B.jsx(Sf,{label:"Position",unit:"rad",cmd:r.cmd.pos,act:r.fb.pos,digits:3}),B.jsx(Sf,{label:"Velocity",unit:"rad/s",cmd:r.cmd.vel,act:r.fb.vel,digits:2}),B.jsx(Sf,{label:"Torque",unit:"Nm",cmd:r.cmd.torque,act:r.fb.torque,digits:2}),B.jsxs("div",{className:"temp-row",children:[B.jsxs("span",{children:["MOS ",Rl(r.fb.t_mos,1),"°"]}),B.jsxs("span",{children:["Rotor ",Rl(r.fb.t_rotor,1),"°"]})]})]},`${r.bus}:${r.motorId}`))})]})}function K1(l,t,r){const i=new Array(l);return new Proxy(i,{get(o,u,c){if(typeof u=="string"){const d=u.charCodeAt(0);if(d>=48&&d<=57){const p=+u;if(Number.isInteger(p)&&p>=0&&pi[w]!==m))&&(i=d,o=t(...d),r!=null&&r.onChange&&!(u&&r.skipInitialOnChange)&&r.onChange(o),u=!1),o}return c.updateDeps=d=>{i=d},c}function xg(l,t){if(l===void 0)throw new Error("Unexpected undefined");return l}const Q1=(l,t)=>Math.abs(l-t)<1.01,X1=(l,t,r)=>{let i;return function(...o){l.clearTimeout(i),i=l.setTimeout(()=>t.apply(this,o),r)}};let mo;const xf=()=>{if(mo!==void 0)return mo;if(typeof navigator>"u")return mo=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return mo=!0;const l=navigator.maxTouchPoints;return mo=navigator.platform==="MacIntel"&&l!==void 0&&l>0},_g=l=>{const{offsetWidth:t,offsetHeight:r}=l;return{width:t,height:r}},q1=l=>l,J1=l=>{const t=Math.max(l.startIndex-l.overscan,0),i=Math.min(l.endIndex+l.overscan,l.count-1)-t+1,o=new Array(i);for(let u=0;u{const r=l.scrollElement;if(!r)return;const i=l.targetWindow;if(!i)return;const o=c=>{const{width:d,height:p}=c;t({width:Math.round(d),height:Math.round(p)})};if(o(_g(r)),!i.ResizeObserver)return()=>{};const u=new i.ResizeObserver(c=>{const d=()=>{const p=c[0];if(p!=null&&p.borderBoxSize){const m=p.borderBoxSize[0];if(m){o({width:m.inlineSize,height:m.blockSize});return}}o(_g(r))};l.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(d):d()});return u.observe(r,{box:"border-box"}),()=>{u.unobserve(r)}},hu={passive:!0},eS=typeof window>"u"?!0:"onscrollend"in window,tS=(l,t,r)=>{const i=l.scrollElement;if(!i)return;const o=l.targetWindow;if(!o)return;const u=l.options.useScrollendEvent&&eS;let c=0;const d=u?null:X1(o,()=>t(c,!1),l.options.isScrollingResetDelay),p=v=>()=>{c=r(i),d==null||d(),t(c,v)},m=p(!0),w=p(!1);return i.addEventListener("scroll",m,hu),u&&i.addEventListener("scrollend",w,hu),()=>{i.removeEventListener("scroll",m),u&&i.removeEventListener("scrollend",w)}},nS=(l,t)=>tS(l,t,r=>{const{horizontal:i,isRtl:o}=l.options;return i?r.scrollLeft*(o&&-1||1):r.scrollTop}),rS=(l,t,r)=>{if(r.options.useCachedMeasurements){const i=r.indexFromElement(l),o=r.options.getItemKey(i);return r.itemSizeCache.get(o)??r.options.estimateSize(i)}if(t!=null&&t.borderBoxSize){const i=t.borderBoxSize[0];if(i)return Math.round(i[r.options.horizontal?"inlineSize":"blockSize"])}if(!t){const i=r.indexFromElement(l),o=r.options.getItemKey(i),u=r.itemSizeCache.get(o);if(u!==void 0)return u}return l[r.options.horizontal?"offsetWidth":"offsetHeight"]},iS=(l,{adjustments:t=0,behavior:r},i)=>{var o,u;(u=(o=i.scrollElement)==null?void 0:o.scrollTo)==null||u.call(o,{[i.options.horizontal?"left":"top"]:l+t,behavior:r})},sS=iS;class lS{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var r,i,o;return((o=(i=(r=this.targetWindow)==null?void 0:r.performance)==null?void 0:i.now)==null?void 0:o.call(i))??Date.now()},this.observer=(()=>{let r=null;const i=()=>r||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:r=new this.targetWindow.ResizeObserver(o=>{o.forEach(u=>{const c=()=>{const d=u.target,p=this.indexFromElement(d);if(!d.isConnected){this.observer.unobserve(d);for(const[m,w]of this.elementsCache)if(w===d){this.elementsCache.delete(m);break}return}this.shouldMeasureDuringScroll(p)&&this.resizeItem(p,this.options.measureElement(d,u,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(c):c()})}));return{disconnect:()=>{var o;(o=i())==null||o.disconnect(),r=null},observe:o=>{var u;return(u=i())==null?void 0:u.observe(o,{box:"border-box"})},unobserve:o=>{var u;return(u=i())==null?void 0:u.unobserve(o)}}})(),this.range=null,this.setOptions=r=>{var i,o;const u={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:q1,rangeExtractor:J1,onChange:()=>{},measureElement:rS,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const x in r){const z=r[x];z!==void 0&&(u[x]=z)}const c=this.options;let d=null,p=null,m=!1;if(c!==void 0&&c.enabled&&u.enabled&&u.anchorTo==="end"&&this.scrollElement!==null){const x=c.count,z=u.count,R=this.getMeasurements(),k=x>0?((i=R[0])==null?void 0:i.key)??c.getItemKey(0):null,b=x>0?((o=R[x-1])==null?void 0:o.key)??c.getItemKey(x-1):null;if(z!==x||x>0&&z>0&&(u.getItemKey(0)!==k||u.getItemKey(z-1)!==b)){m=!0;const W=x>0?this.getVirtualItemForOffset(this.getScrollOffset())??R[0]:null;W&&(d=[W.key,this.getScrollOffset()-W.start]);const V=u.followOnAppend===!0?"auto":u.followOnAppend||null;V&&z>x&&this.isAtEnd(c.scrollEndThreshold)&&(x===0||u.getItemKey(z-1)!==b)&&(p=V)}}this.options=u,m&&(this.pendingMin=0,this.itemSizeCacheVersion++);let w=!1,v=0;if(d&&this.scrollOffset!==null){const[x,z]=d,R=this.getMeasurements(),{count:k,getItemKey:b}=this.options;let U=0;for(;U{var i,o;(o=(i=this.options).onChange)==null||o.call(i,this,r)},this.maybeNotify=ml(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),r=>{this.notify(r)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(r=>r()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var r;const i=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==i){if(this.cleanup(),!i){this.maybeNotify();return}if(this.scrollElement=i,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((r=this.scrollElement)==null?void 0:r.window)??null,this.elementsCache.forEach(u=>{this.observer.observe(u)}),this.unsubs.push(this.options.observeElementRect(this,u=>{this.scrollRect=u,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(u,c)=>{this._intendedScrollOffset!==null&&Math.abs(u-this._intendedScrollOffset)<1.5&&(u=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=c?this.getScrollOffset(){this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},d=()=>{this._iosTouching=!1,!(!xf()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};u.addEventListener("touchstart",c,hu),u.addEventListener("touchend",d,hu),this.unsubs.push(()=>{u.removeEventListener("touchstart",c),u.removeEventListener("touchend",d),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const o=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,o&&this.scrollElement&&this.options.enabled){const[u,c,d,p]=o;u!==null&&!d&&(xf()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?p!==0&&(this._iosDeferredAdjustment+=p):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),d&&this.scrollToEnd({behavior:d})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const r=this.getScrollOffset(),i=this.getMaxScrollOffset();if(r<0||r>i)return;const o=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(r,{adjustments:this.scrollAdjustments+=o,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(r,i)=>{const o=new Map,u=new Map;for(let c=i-1;c>=0;c--){const d=r[c];if(o.has(d.lane))continue;const p=u.get(d.lane);if(p==null||d.end>p.end?u.set(d.lane,d):d.endc.end===d.end?c.index-d.index:c.end-d.end)[0]:void 0},this.getMeasurementOptions=ml(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(r,i,o,u,c,d,p)=>(this.prevLanes!==void 0&&this.prevLanes!==d&&(this.lanesChangedFlag=!0),this.prevLanes=d,this.pendingMin=null,{count:r,paddingStart:i,scrollMargin:o,getItemKey:u,enabled:c,lanes:d,laneAssignmentMode:p}),{key:!1}),this.getMeasurements=ml(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:r,paddingStart:i,scrollMargin:o,getItemKey:u,enabled:c,lanes:d,laneAssignmentMode:p},m)=>{const w=this.itemSizeCache;if(!c)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>r)for(const R of this.laneAssignments.keys())R>=r&&this.laneAssignments.delete(R);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(R=>{this.itemSizeCache.set(R.key,R.size)}));const v=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===r&&(this.lanesSettling=!1),d===1){const R=this.options.gap,k=r*2;let b=this._flatMeasurements;if(!b||b.length0&&W.set(b.subarray(0,v*2)),b=W,this._flatMeasurements=b}let U;if(v===0)U=i+o;else{const W=v-1;U=b[W*2]+b[W*2+1]+R}for(let W=v;W1){U=b;const ee=z[U],re=ee!==void 0?x[ee]:void 0;P=re?re.end+this.options.gap:i+o}else{const ee=this.options.lanes===1?x[R-1]:this.getFurthestMeasurement(x,R);P=ee?ee.end+this.options.gap:i+o,U=ee?ee.lane:R%this.options.lanes,this.options.lanes>1&&W&&this.laneAssignments.set(R,U)}const V=w.get(k),Z=typeof V=="number"?V:this.options.estimateSize(R),G=P+Z;x[R]={index:R,start:P,size:Z,end:G,key:k,lane:U},z[U]=R}return this.measurementsCache=x,x},{key:!1,debug:()=>this.options.debug}),this.calculateRange=ml(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(r,i,o,u)=>this.range=r.length>0&&i>0?oS({measurements:r,outerSize:i,scrollOffset:o,lanes:u,flat:u===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=ml(()=>{let r=null,i=null;const o=this.calculateRange();return o&&(r=o.startIndex,i=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,r,i]),[this.options.rangeExtractor,this.options.overscan,this.options.count,r,i]},(r,i,o,u,c)=>u===null||c===null?[]:r({startIndex:u,endIndex:c,overscan:i,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=r=>{const i=this.options.indexAttribute,o=r.getAttribute(i);return o?parseInt(o,10):(console.warn(`Missing attribute name '${i}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=r=>{var i;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const o=this.scrollState.index??((i=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:i.index);if(o!==void 0&&this.range){const u=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),c=Math.max(0,o-u),d=Math.min(this.options.count-1,o+u);return r>=c&&r<=d}return!0},this.measureElement=r=>{if(!r){this.elementsCache.forEach((c,d)=>{c.isConnected||(this.observer.unobserve(c),this.elementsCache.delete(d))});return}const i=this.indexFromElement(r),o=this.options.getItemKey(i),u=this.elementsCache.get(o);u!==r&&(u&&this.observer.unobserve(u),this.observer.observe(r),this.elementsCache.set(o,r)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(i)&&this.resizeItem(i,this.options.measureElement(r,void 0,this))},this.resizeItem=(r,i)=>{var o,u;if(r<0||r>=this.options.count)return;let c,d,p;const m=this._flatMeasurements;if(this.options.lanes===1&&m!==null)p=this.options.getItemKey(r),d=m[r*2],c=m[r*2+1];else{const x=this.measurementsCache[r];if(!x)return;p=x.key,d=x.start,c=x.size}const w=this.itemSizeCache.get(p)??c,v=i-w;if(v!==0){const x=this.options.anchorTo==="end"&&((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,z=x?this.getTotalSize():0,R=((u=this.scrollState)==null?void 0:u.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[r]??{index:r,key:p,start:d,size:c,end:d+c,lane:0},v,this):d[this.getVirtualIndexes(),this.getMeasurements()],(r,i)=>{const o=[];for(let u=0,c=r.length;uthis.options.debug}),this.getVirtualItemForOffset=r=>{const i=this.getMeasurements();if(i.length===0)return;const o=this._flatMeasurements,u=this.options.lanes===1&&o!=null,c=Hm(0,i.length-1,u?d=>o[d*2]:d=>xg(i[d]).start,r);return xg(i[c])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const r=this.scrollElement.document.documentElement;return this.options.horizontal?r.scrollWidth-this.scrollElement.innerWidth:r.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(r=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=r,this.getOffsetForAlignment=(r,i,o=0)=>{if(!this.scrollElement)return 0;const u=this.getSize(),c=this.getScrollOffset();i==="auto"&&(i=r>=c+u?"end":"start"),i==="center"?r+=(o-u)/2:i==="end"&&(r-=u);const d=this.getMaxScrollOffset();return Math.max(Math.min(d,r),0)},this.getOffsetForIndex=(r,i="auto")=>{r=Math.max(0,Math.min(r,this.options.count-1));const o=this.getSize(),u=this.getScrollOffset(),c=this.measurementsCache[r];if(!c)return;if(i==="auto")if(c.end>=u+o-this.options.scrollPaddingEnd)i="end";else if(c.start<=u+this.options.scrollPaddingStart)i="start";else return[u,i];if(i==="end"&&r===this.options.count-1)return[this.getMaxScrollOffset(),i];const d=i==="end"?c.end+this.options.scrollPaddingEnd:c.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(d,i,c.size),i]},this.scrollToOffset=(r,{align:i="start",behavior:o="auto"}={})=>{const u=this.getOffsetForAlignment(r,i),c=this.now();this.scrollState={index:null,align:i,behavior:o,startedAt:c,lastTargetOffset:u,stableFrames:0},this._scrollToOffset(u,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(r,{align:i="auto",behavior:o="auto"}={})=>{r=Math.max(0,Math.min(r,this.options.count-1));const u=this.getOffsetForIndex(r,i);if(!u)return;const[c,d]=u,p=this.now();this.scrollState={index:r,align:d,behavior:o,startedAt:p,lastTargetOffset:c,stableFrames:0},this._scrollToOffset(c,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(r,{behavior:i="auto"}={})=>{const o=this.getScrollOffset()+r,u=this.now();this.scrollState={index:null,align:"start",behavior:i,startedAt:u,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:r="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:r});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:r})},this.getTotalSize=()=>{var r;const i=this.getMeasurements();let o;if(i.length===0)o=this.options.paddingStart;else if(this.options.lanes===1){const u=i.length-1,c=this._flatMeasurements;c!=null?o=c[u*2]+c[u*2+1]:o=((r=i[u])==null?void 0:r.end)??0}else{const u=Array(this.options.lanes).fill(null);let c=i.length-1;for(;c>=0&&u.some(d=>d===null);){const d=i[c];u[d.lane]===null&&(u[d.lane]=d.end),c--}o=Math.max(...u.filter(d=>d!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const r=[];if(this.itemSizeCache.size===0)return r;const i=this.getMeasurements();for(const o of i)o&&this.itemSizeCache.has(o.key)&&r.push({index:o.index,key:o.key,start:o.start,size:o.size,end:o.end,lane:o.lane});return r},this._scrollToOffset=(r,{adjustments:i,behavior:o})=>{this._intendedScrollOffset=r+(i??0),this.options.scrollToFn(r,{behavior:o,adjustments:i},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}applyScrollAdjustment(t,r){t!==0&&(xf()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=t:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:r}))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const i=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,o=i?i[0]:this.scrollState.lastTargetOffset,u=1,c=o!==this.scrollState.lastTargetOffset;if(!c&&Q1(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=u){this.getScrollOffset()!==o&&this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,c){const d=this.getSize()||600,p=Math.abs(o-this.getScrollOffset()),m=this.scrollState.behavior==="smooth"&&p>d;this.scrollState.lastTargetOffset=o,m||(this.scrollState.behavior="auto"),this._scrollToOffset(o,{adjustments:void 0,behavior:m?"smooth":"auto"})}this.scheduleScrollReconcile()}}const Hm=(l,t,r,i)=>{for(;l<=t;){const o=(l+t)/2|0,u=r(o);if(ui)t=o-1;else return o}return l>0?l-1:0};function oS({measurements:l,outerSize:t,scrollOffset:r,lanes:i,flat:o}){const u=l.length-1,c=o?w=>o[w*2]:w=>l[w].start,d=o?w=>o[w*2]+o[w*2+1]:w=>l[w].end;if(l.length<=i)return{startIndex:0,endIndex:u};let p=Hm(0,u,c,r),m=p;if(i===1)for(;m1){const w=Array(i).fill(0);for(;mx=0&&v.some(x=>x>=r);){const x=l[p];v[x.lane]=x.start,p--}p=Math.max(0,p-p%i),m=Math.min(u,m+(i-1-m%i))}return{startIndex:p,endIndex:m}}const _f=typeof document<"u"?j.useLayoutEffect:j.useEffect;function aS({useFlushSync:l=!0,directDomUpdates:t=!1,directDomUpdatesMode:r="transform",...i}){const o=j.useReducer(m=>m+1,0)[1],u=j.useRef({enabled:t,mode:r,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});u.current.enabled=t,u.current.mode=r;const c=m=>{const w=u.current;if(!w.enabled||!w.container)return;const v=m.getTotalSize();if(v!==w.lastSize){w.lastSize=v;const U=m.options.horizontal?"width":"height";w.container.style[U]=`${v}px`}const x=!!m.options.horizontal,z=w.mode==="transform",R=x?"left":"top",k=m.options.scrollMargin,b=m.getVirtualItems();for(const U of b){const P=U.start-k,W=m.elementsCache.get(U.key);W&&w.lastPositions.get(W)!==P&&(w.lastPositions.set(W,P),z?W.style.transform=x?`translate3d(${P}px, 0, 0)`:`translate3d(0, ${P}px, 0)`:W.style[R]=`${P}px`)}},d={...i,onChange:(m,w)=>{var v;const x=u.current;let z=!0;if(x.enabled){c(m);const R=m.range,k=x.prevRange;z=!k||k.isScrolling!==m.isScrolling||k.startIndex!==(R==null?void 0:R.startIndex)||k.endIndex!==(R==null?void 0:R.endIndex),z&&(x.prevRange=R?{startIndex:R.startIndex,endIndex:R.endIndex,isScrolling:m.isScrolling}:null)}z&&(l&&w?bs.flushSync(o):o()),(v=i.onChange)==null||v.call(i,m,w)}},[p]=j.useState(()=>{const m=new lS(d);return Object.assign(m,{containerRef:w=>{const v=u.current;if(v.container=w,v.lastSize=null,w&&v.enabled){const x=m.getTotalSize();v.lastSize=x;const z=m.options.horizontal?"width":"height";w.style[z]=`${x}px`}}})});return p.setOptions(d),_f(()=>p._didMount(),[]),_f(()=>p._willUpdate()),_f(()=>{c(p)}),p}function uS(l){return aS({observeElementRect:Z1,observeElementOffset:nS,scrollToFn:sS,...l})}const cS={pos:"p",vel:"v",torque:"τ",kp:"kp",kd:"kd",vel_limit:"vlim",torque_limit:"τlim",t_mos:"Tm",t_rotor:"Tr"},fS=["pos","vel","torque","kp","kd","t_mos","t_rotor"];function dS(l){const t=[];for(const r of fS)r in l.fields&&t.push(`${cS[r]||r} ${l.fields[r].toFixed(2)}`);return t.join(" ")||l.note||""}function hS(l){const t=new Date(l*1e3),r=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0"),o=String(t.getSeconds()).padStart(2,"0"),u=String(Math.floor(l%1*1e3)).padStart(3,"0");return`${r}:${i}:${o}.${u}`}function pS(){const[,l]=j.useState(0),[t,r]=j.useState(!1),i=j.useRef(null),o=j.useRef([]);j.useEffect(()=>{gg(!0);const d=L1(()=>{t||(o.current=O1(),l(p=>p+1))});return()=>{gg(!1),d()}},[t]);const u=o.current,c=uS({count:u.length,getScrollElement:()=>i.current,estimateSize:()=>22,overscan:12});return j.useEffect(()=>{!t&&u.length&&c.scrollToIndex(u.length-1)},[u.length,t,c]),B.jsxs("div",{className:"panel rawlog-panel",children:[B.jsxs("div",{className:"rawlog-toolbar",children:[B.jsx("button",{className:t?"btn small":"btn small active",onClick:()=>r(d=>!d),children:t?"Resume":"Pause"}),B.jsxs("span",{className:"muted",children:[u.length," frames"]})]}),B.jsxs("div",{className:"rawlog-body",ref:i,children:[B.jsxs("div",{className:"rawlog-head",children:[B.jsx("span",{className:"c-t",children:"time"}),B.jsx("span",{className:"c-arb",children:"arb"}),B.jsx("span",{className:"c-m",children:"motor"}),B.jsx("span",{className:"c-k",children:"kind"}),B.jsx("span",{className:"c-f",children:"decoded"}),B.jsx("span",{className:"c-r",children:"raw"})]}),B.jsx("div",{style:{height:c.getTotalSize(),position:"relative"},children:c.getVirtualItems().map(d=>{const p=u[d.index];return B.jsxs("div",{className:"rawlog-row k-"+p.kind,style:{transform:`translateY(${d.start}px)`},children:[B.jsx("span",{className:"c-t mono",children:hS(p.t)}),B.jsxs("span",{className:"c-arb mono",children:["0x",p.arb.toString(16).toUpperCase()]}),B.jsxs("span",{className:"c-m mono",children:["m",p.motorId]}),B.jsx("span",{className:"c-k",children:p.mode||p.kind}),B.jsx("span",{className:"c-f mono",children:dS(p)}),B.jsx("span",{className:"c-r mono dim",children:p.raw})]},p.seq)})})]})]})}const Fm=[{kind:"plot",title:"Plot",icon:"〜",description:"Time-series chart; drag signals onto it (cmd over fb to overlay).",render:l=>B.jsx($1,{panelId:l})},{kind:"table",title:"Motor Table",icon:"▦",description:"One row per motor: commanded vs actual.",render:()=>B.jsx(G1,{})},{kind:"cards",title:"Motor Cards",icon:"▢",description:"Per-motor cards/gauges with big readouts.",render:()=>B.jsx(Y1,{})},{kind:"rawlog",title:"Raw CAN Log",icon:"≣",description:"Scrolling decoded frame log.",render:()=>B.jsx(pS,{})}],gS=Object.fromEntries(Fm.map(l=>[l.kind,l])),jm="damiao.monitor.theme";function Wm(){return localStorage.getItem(jm)==="dark"?"dark":"light"}function Bm(l){document.documentElement.setAttribute("data-theme",l)}function mS(l){try{localStorage.setItem(jm,l)}catch{}Bm(l)}function vS(){Bm(Wm())}function yS(){const l=gn(p=>p.connected),t=gn(p=>p.status),r=Eo(p=>p.addWidget),i=Eo(p=>p.resetWidgets),[o,u]=j.useState(Wm()),c=()=>i(),d=()=>{const p=o==="light"?"dark":"light";mS(p),u(p)};return B.jsxs("header",{className:"toolbar",children:[B.jsxs("div",{className:"brand",children:[B.jsx("span",{className:"brand-dot"}),"DaMiao ",B.jsx("span",{className:"brand-sub",children:"Passive Monitor"})]}),B.jsxs("div",{className:"conn",children:[B.jsx("span",{className:"dot "+(l?"on":"off")}),B.jsx("span",{className:"mono",children:t!=null&&t.demo?"demo":(t==null?void 0:t.channel)||"—"}),t&&!t.demo&&B.jsx("span",{className:"badge "+(t.listenOnly?"ok":"warn"),title:"hardware listen-only",children:t.listenOnly?"listen-only":"rx (no TX)"}),(t==null?void 0:t.error)&&B.jsx("span",{className:"badge err",title:t.error,children:"bus error"}),t&&B.jsxs("span",{className:"muted small",children:[t.framesSeen.toLocaleString()," frames · +",t.feedbackOffset," fb"]})]}),B.jsx("div",{className:"spacer"}),B.jsxs("div",{className:"actions",children:[Fm.map(p=>B.jsxs("button",{className:"btn",title:p.description,onClick:()=>r(p.kind),children:[B.jsx("span",{className:"btn-icon",children:p.icon})," ",p.title]},p.kind)),B.jsx("button",{className:"btn ghost",onClick:d,title:`Switch to ${o==="light"?"dark":"light"} mode`,children:o==="light"?"☾":"☀"}),B.jsx("button",{className:"btn ghost",onClick:c,children:"Reset"})]})]})}function wS({sig:l}){const{attributes:t,listeners:r,setNodeRef:i,isDragging:o}=l0({id:`sig:${l.id}`,data:{signalId:l.id}}),u=ru(l);return B.jsxs("div",{ref:i,className:"sig-chip"+(o?" dragging":""),...r,...t,title:l.id,children:[B.jsx("span",{className:"sig-swatch",style:{background:u,borderStyle:l.source==="cmd"?"dashed":"solid"}}),B.jsxs("span",{className:"sig-name",children:[l.source,".",l.field]}),l.unit&&B.jsx("span",{className:"sig-unit",children:l.unit})]})}function SS(l){return[...l].sort((t,r)=>{if(t.source!==r.source)return t.source==="cmd"?-1:1;const i=wg.indexOf(t.field),o=wg.indexOf(r.field);return(i<0?99:i)-(o<0?99:o)})}function xS(){const l=gn(u=>u.signals),t=gn(u=>u.status),[r,i]=j.useState(""),o=j.useMemo(()=>{const u=new Map;for(const c of l){if(r&&!c.id.toLowerCase().includes(r.toLowerCase()))continue;const d=u.get(c.motorId)||[];d.push(c),u.set(c.motorId,d)}return Array.from(u.entries()).sort((c,d)=>c[0]-d[0])},[l,r]);return B.jsxs("aside",{className:"sidebar",children:[B.jsxs("div",{className:"sidebar-head",children:[B.jsx("div",{className:"sidebar-title",children:"Signals"}),B.jsx("input",{className:"filter",placeholder:"filter…",value:r,onChange:u=>i(u.target.value)})]}),B.jsxs("div",{className:"sidebar-body",children:[o.length===0&&B.jsx("div",{className:"muted pad",children:t!=null&&t.error?"Bus error — see top bar.":"No signals yet. Start a controller on the bus (or run --demo)."}),o.map(([u,c])=>B.jsxs("div",{className:"motor-group",children:[B.jsxs("div",{className:"motor-group-title",children:["Motor ",u]}),B.jsx("div",{className:"chips",children:SS(c).map(d=>B.jsx(wS,{sig:d},d.id))})]},u))]}),B.jsxs("div",{className:"sidebar-foot muted",children:["Drag a signal onto a plot. Drop ",B.jsx("b",{children:"cmd"})," onto its ",B.jsx("b",{children:"fb"})," plot to overlay."]})]})}function _S(l,t,r,i,o){const u=(...c)=>(console.warn("gridstack.js: Function `"+r+"` is deprecated in "+o+" and has been replaced with `"+i+"`. It will be **removed** in a future release"),t.apply(l,c));return u.prototype=t.prototype,u}class A{static getElements(t,r=document){if(typeof t=="string"){const i="getElementById"in r?r:void 0;if(i&&!isNaN(+t[0])){const u=i.getElementById(t);return u?[u]:[]}let o=r.querySelectorAll(t);return!o.length&&t[0]!=="."&&t[0]!=="#"&&(o=r.querySelectorAll("."+t),o.length||(o=r.querySelectorAll("#"+t))),Array.from(o)}return[t]}static getElement(t,r=document){if(typeof t=="string"){const i="getElementById"in r?r:void 0;if(!t.length)return null;if(i&&t[0]==="#")return i.getElementById(t.substring(1));if(t[0]==="#"||t[0]==="."||t[0]==="[")return r.querySelector(t);if(i&&!isNaN(+t[0]))return i.getElementById(t);let o=r.querySelector(t);return i&&!o&&(o=i.getElementById(t)),o||(o=r.querySelector("."+t)),o}return t}static lazyLoad(t){var r,i;return t.lazyLoad||((i=(r=t.grid)==null?void 0:r.opts)==null?void 0:i.lazyLoad)&&t.lazyLoad!==!1}static createDiv(t,r){const i=document.createElement("div");return t.forEach(o=>{o&&i.classList.add(o)}),r==null||r.appendChild(i),i}static shouldSizeToContent(t,r=!1){return(t==null?void 0:t.grid)&&(r?t.sizeToContent===!0||t.grid.opts.sizeToContent===!0&&t.sizeToContent===void 0:!!t.sizeToContent||t.grid.opts.sizeToContent&&t.sizeToContent!==!1)}static isIntercepted(t,r){return!(t.y>=r.y+r.h||t.y+t.h<=r.y||t.x+t.w<=r.x||t.x>=r.x+r.w)}static isTouching(t,r){return A.isIntercepted(t,{x:r.x-.5,y:r.y-.5,w:r.w+1,h:r.h+1})}static areaIntercept(t,r){const i=t.x>r.x?t.x:r.x,o=t.x+t.wr.y?t.y:r.y,c=t.y+t.h{const c=r*((o.y??1e4)-(u.y??1e4));return c===0?r*((o.x??1e4)-(u.x??1e4)):c})}static find(t,r){return r?t.find(i=>i.id===r):void 0}static createStylesheet(t,r,i){const o=document.createElement("style"),u=i==null?void 0:i.nonce;return u&&(o.nonce=u),o.setAttribute("type","text/css"),o.setAttribute("gs-style-id",t),o.styleSheet?o.styleSheet.cssText="":o.appendChild(document.createTextNode("")),r?r.insertBefore(o,r.firstChild):(r=document.getElementsByTagName("head")[0],r.appendChild(o)),o}static removeStylesheet(t,r){const o=(r||document).querySelector("STYLE[gs-style-id="+t+"]");o&&o.parentNode&&o.remove()}static addCSSRule(t,r,i){t.textContent+=`${r} { ${i} } `}static toBool(t){return typeof t=="boolean"?t:typeof t=="string"?(t=t.toLowerCase(),!(t===""||t==="no"||t==="false"||t==="0")):!!t}static toNumber(t){return t===null||t.length===0?void 0:Number(t)}static parseHeight(t){let r,i="px";if(typeof t=="string")if(t==="auto"||t==="")r=0;else{const o=t.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!o)throw new Error(`Invalid height val = ${t}`);i=o[2]||"px",r=parseFloat(o[1])}else r=t;return{h:r,unit:i}}static defaults(t,...r){return r.forEach(i=>{for(const o in i){if(!i.hasOwnProperty(o))return;t[o]===null||t[o]===void 0?t[o]=i[o]:typeof i[o]=="object"&&typeof t[o]=="object"&&this.defaults(t[o],i[o])}}),t}static same(t,r){if(typeof t!="object")return t==r;if(typeof t!=typeof r||Object.keys(t).length!==Object.keys(r).length)return!1;for(const i in t)if(t[i]!==r[i])return!1;return!0}static copyPos(t,r,i=!1){return r.x!==void 0&&(t.x=r.x),r.y!==void 0&&(t.y=r.y),r.w!==void 0&&(t.w=r.w),r.h!==void 0&&(t.h=r.h),i&&(r.minW&&(t.minW=r.minW),r.minH&&(t.minH=r.minH),r.maxW&&(t.maxW=r.maxW),r.maxH&&(t.maxH=r.maxH)),t}static samePos(t,r){return t&&r&&t.x===r.x&&t.y===r.y&&(t.w||1)===(r.w||1)&&(t.h||1)===(r.h||1)}static sanitizeMinMax(t){t.minW||delete t.minW,t.minH||delete t.minH,t.maxW||delete t.maxW,t.maxH||delete t.maxH}static removeInternalAndSame(t,r){if(!(typeof t!="object"||typeof r!="object"))for(let i in t){const o=t[i],u=r[i];i[0]==="_"||o===u?delete t[i]:o&&typeof o=="object"&&u!==void 0&&(A.removeInternalAndSame(o,u),Object.keys(o).length||delete t[i])}}static removeInternalForSave(t,r=!0){for(let i in t)(i[0]==="_"||t[i]===null||t[i]===void 0)&&delete t[i];delete t.grid,r&&delete t.el,t.autoPosition||delete t.autoPosition,t.noResize||delete t.noResize,t.noMove||delete t.noMove,t.locked||delete t.locked,(t.w===1||t.w===t.minW)&&delete t.w,(t.h===1||t.h===t.minH)&&delete t.h}static throttle(t,r){let i=!1;return(...o)=>{i||(i=!0,setTimeout(()=>{t(...o),i=!1},r))}}static removePositioningStyles(t){const r=t.style;r.position&&r.removeProperty("position"),r.left&&r.removeProperty("left"),r.top&&r.removeProperty("top"),r.width&&r.removeProperty("width"),r.height&&r.removeProperty("height")}static getScrollElement(t){if(!t)return document.scrollingElement||document.documentElement;const r=getComputedStyle(t);return/(auto|scroll)/.test(r.overflow+r.overflowY)?t:this.getScrollElement(t.parentElement)}static updateScrollPosition(t,r,i){const o=t.getBoundingClientRect(),u=window.innerHeight||document.documentElement.clientHeight;if(o.top<0||o.bottom>u){const c=o.bottom-u,d=o.top,p=this.getScrollElement(t);if(p!==null){const m=p.scrollTop;o.top<0&&i<0?t.offsetHeight>u?p.scrollTop+=i:p.scrollTop+=Math.abs(d)>Math.abs(i)?i:d:i>0&&(t.offsetHeight>u?p.scrollTop+=i:p.scrollTop+=c>i?i:c),r.top+=p.scrollTop-m}}}static updateScrollResize(t,r,i){const o=this.getScrollElement(r),u=o.clientHeight,c=o===this.getScrollElement()?0:o.getBoundingClientRect().top,d=t.clientY-c,p=du-i;p?o.scrollBy({behavior:"smooth",top:d-i}):m&&o.scrollBy({behavior:"smooth",top:i-(u-d)})}static clone(t){return t==null||typeof t!="object"?t:t instanceof Array?[...t]:{...t}}static cloneDeep(t){const r=["parentGrid","el","grid","subGrid","engine"],i=A.clone(t);for(const o in i)i.hasOwnProperty(o)&&typeof i[o]=="object"&&o.substring(0,2)!=="__"&&!r.find(u=>u===o)&&(i[o]=A.cloneDeep(t[o]));return i}static cloneNode(t){const r=t.cloneNode(!0);return r.removeAttribute("id"),r}static appendTo(t,r){let i;typeof r=="string"?i=A.getElement(r):i=r,i&&i.appendChild(t)}static addElStyles(t,r){if(r instanceof Object)for(const i in r)r.hasOwnProperty(i)&&(Array.isArray(r[i])?r[i].forEach(o=>{t.style[i]=o}):t.style[i]=r[i])}static initEvent(t,r){const i={type:r.type},o={button:0,which:0,buttons:1,bubbles:!0,cancelable:!0,target:r.target?r.target:t.target};return["altKey","ctrlKey","metaKey","shiftKey"].forEach(u=>i[u]=t[u]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(u=>i[u]=t[u]),{...i,...o}}static simulateMouseEvent(t,r,i){const o=t,u=new MouseEvent(r,{bubbles:!0,composed:!0,cancelable:!0,view:window,detail:1,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY,ctrlKey:o.ctrlKey??!1,altKey:o.altKey??!1,shiftKey:o.shiftKey??!1,metaKey:o.metaKey??!1,button:0,relatedTarget:t.target});(i||t.target).dispatchEvent(u)}static getValuesFromTransformedElement(t){const r=document.createElement("div");A.addElStyles(r,{opacity:"0",position:"fixed",top:"0px",left:"0px",width:"1px",height:"1px",zIndex:"-999999"}),t.appendChild(r);const i=r.getBoundingClientRect();return t.removeChild(r),r.remove(),{xScale:1/i.width,yScale:1/i.height,xOffset:i.left,yOffset:i.top}}static swap(t,r,i){if(!t)return;const o=t[r];t[r]=t[i],t[i]=o}static canBeRotated(t){var r;return!(!t||t.w===t.h||t.locked||t.noResize||(r=t.grid)!=null&&r.opts.disableResize||t.minW&&t.minW===t.maxW||t.minH&&t.minH===t.maxH)}}class ai{constructor(t={}){this.addedNodes=[],this.removedNodes=[],this.defaultColumn=12,this.column=t.column||this.defaultColumn,this.column>this.defaultColumn&&(this.defaultColumn=this.column),this.maxRow=t.maxRow,this._float=t.float,this.nodes=t.nodes||[],this.onChange=t.onChange}batchUpdate(t=!0,r=!0){return!!this.batchMode===t?this:(this.batchMode=t,t?(this._prevFloat=this._float,this._float=!0,this.cleanNodes(),this.saveInitial()):(this._float=this._prevFloat,delete this._prevFloat,r&&this._packNodes(),this._notify()),this)}_useEntireRowArea(t,r){return(!this.float||this.batchMode&&!this._prevFloat)&&!this._hasLocked&&(!t._moving||t._skipDown||r.y<=t.y)}_fixCollisions(t,r=t,i,o={}){if(this.sortNodes(-1),i=i||this.collide(t,r),!i)return!1;if(t._moving&&!o.nested&&!this.float&&this.swap(t,i))return!0;let u=r;!this._loading&&this._useEntireRowArea(t,r)&&(u={x:0,w:this.column,y:r.y,h:r.h},i=this.collide(t,u,o.skip));let c=!1;const d={nested:!0,pack:!1};let p=0;for(;i=i||this.collide(t,u,o.skip);){if(p++>this.nodes.length*2)throw new Error("Infinite collide check");let m;if(i.locked||this._loading||t._moving&&!t._skipDown&&r.y>t.y&&!this.float&&(!this.collide(i,{...i,y:t.y},t)||!this.collide(i,{...i,y:r.y-i.h},t))){t._skipDown=t._skipDown||r.y>t.y;const w={...r,y:i.y+i.h,...d};m=this._loading&&A.samePos(t,w)?!0:this.moveNode(t,w),(i.locked||this._loading)&&m?A.copyPos(r,t):!i.locked&&m&&o.pack&&(this._packNodes(),r.y=i.y+i.h,A.copyPos(t,r)),c=c||m}else m=this.moveNode(i,{...i,y:r.y+r.h,skip:t,...d});if(!m)return c;i=void 0}return c}collide(t,r=t,i){const o=t._id,u=i==null?void 0:i._id;return this.nodes.find(c=>c._id!==o&&c._id!==u&&A.isIntercepted(c,r))}collideAll(t,r=t,i){const o=t._id,u=i==null?void 0:i._id;return this.nodes.filter(c=>c._id!==o&&c._id!==u&&A.isIntercepted(c,r))}directionCollideCoverage(t,r,i){if(!r.rect||!t._rect)return;const o=t._rect,u={...r.rect};u.y>o.y?(u.h+=u.y-o.y,u.y=o.y):u.h+=o.y-u.y,u.x>o.x?(u.w+=u.x-o.x,u.x=o.x):u.w+=o.x-u.x;let c,d=.5;for(let p of i){if(p.locked||!p._rect)break;const m=p._rect;let w=Number.MAX_VALUE,v=Number.MAX_VALUE;o.ym.y+m.h&&(w=(m.y+m.h-u.y)/m.h),o.xm.x+m.w&&(v=(m.x+m.w-u.x)/m.w);const x=Math.min(v,w);x>d&&(d=x,c=p)}return r.collide=c,c}cacheRects(t,r,i,o,u,c){return this.nodes.forEach(d=>d._rect={y:d.y*r+i,x:d.x*t+c,w:d.w*t-c-o,h:d.h*r-i-u}),this}swap(t,r){if(!r||r.locked||!t||t.locked)return!1;function i(){const u=r.x,c=r.y;return r.x=t.x,r.y=t.y,t.h!=r.h?(t.x=u,t.y=r.y+r.h):t.w!=r.w?(t.x=r.x+r.w,t.y=c):(t.x=u,t.y=c),t._dirty=r._dirty=!0,!0}let o;if(t.w===r.w&&t.h===r.h&&(t.x===r.x||t.y===r.y)&&(o=A.isTouching(t,r)))return i();if(o!==!1){if(t.w===r.w&&t.x===r.x&&(o||(o=A.isTouching(t,r)))){if(r.y{let m;c.locked||(c.autoPosition=!0,t==="list"&&d&&(m=p[d-1])),this.addNode(c,!1,m)}),o||delete this._inColumnResize,i||this.batchUpdate(!1),this}set float(t){this._float!==t&&(this._float=t||!1,t||this._packNodes()._notify())}get float(){return this._float||!1}sortNodes(t=1){return this.nodes=A.sort(this.nodes,t),this}_packNodes(){return this.batchMode?this:(this.sortNodes(),this.float?this.nodes.forEach(t=>{if(t._updating||t._orig===void 0||t.y===t._orig.y)return;let r=t.y;for(;r>t._orig.y;)--r,this.collide(t,{x:t.x,y:r,w:t.w,h:t.h})||(t._dirty=!0,t.y=r)}):this.nodes.forEach((t,r)=>{if(!t.locked)for(;t.y>0;){const i=r===0?0:t.y-1;if(!(r===0||!this.collide(t,{x:t.x,y:i,w:t.w,h:t.h})))break;t._dirty=t.y!==i,t.y=i}}),this)}prepareNode(t,r){t._id=t._id??ai._idSeq++;const i=t.id;if(i){let u=1;for(;this.nodes.find(c=>c.id===t.id&&c!==t);)t.id=i+"_"+u++}(t.x===void 0||t.y===void 0||t.x===null||t.y===null)&&(t.autoPosition=!0);const o={x:0,y:0,w:1,h:1};return A.defaults(t,o),t.autoPosition||delete t.autoPosition,t.noResize||delete t.noResize,t.noMove||delete t.noMove,A.sanitizeMinMax(t),typeof t.x=="string"&&(t.x=Number(t.x)),typeof t.y=="string"&&(t.y=Number(t.y)),typeof t.w=="string"&&(t.w=Number(t.w)),typeof t.h=="string"&&(t.h=Number(t.h)),isNaN(t.x)&&(t.x=o.x,t.autoPosition=!0),isNaN(t.y)&&(t.y=o.y,t.autoPosition=!0),isNaN(t.w)&&(t.w=o.w),isNaN(t.h)&&(t.h=o.h),this.nodeBoundFix(t,r),t}nodeBoundFix(t,r){const i=t._orig||A.copyPos({},t);if(t.maxW&&(t.w=Math.min(t.w||1,t.maxW)),t.maxH&&(t.h=Math.min(t.h||1,t.maxH)),t.minW&&(t.w=Math.max(t.w||1,t.minW)),t.minH&&(t.h=Math.max(t.h||1,t.minH)),(t.x||0)+(t.w||1)>this.column&&this.columnthis.column?t.w=this.column:t.w<1&&(t.w=1),this.maxRow&&t.h>this.maxRow?t.h=this.maxRow:t.h<1&&(t.h=1),t.x<0&&(t.x=0),t.y<0&&(t.y=0),t.x+t.w>this.column&&(r?t.w=this.column-t.x:t.x=this.column-t.w),this.maxRow&&t.y+t.h>this.maxRow&&(r?t.h=this.maxRow-t.y:t.y=this.maxRow-t.h),A.samePos(t,i)||(t._dirty=!0),this}getDirtyNodes(t){return t?this.nodes.filter(r=>r._dirty&&!A.samePos(r,r._orig)):this.nodes.filter(r=>r._dirty)}_notify(t){if(this.batchMode||!this.onChange)return this;const r=(t||[]).concat(this.getDirtyNodes());return this.onChange(r),this}cleanNodes(){return this.batchMode?this:(this.nodes.forEach(t=>{delete t._dirty,delete t._lastTried}),this)}saveInitial(){return this.nodes.forEach(t=>{t._orig=A.copyPos({},t),delete t._dirty}),this._hasLocked=this.nodes.some(t=>t.locked),this}restoreInitial(){return this.nodes.forEach(t=>{!t._orig||A.samePos(t,t._orig)||(A.copyPos(t,t._orig),t._dirty=!0)}),this._notify(),this}findEmptyPosition(t,r=this.nodes,i=this.column,o){const u=o?o.y*i+(o.x+o.w):0;let c=!1;for(let d=u;!c;++d){const p=d%i,m=Math.floor(d/i);if(p+t.w>i)continue;const w={x:p,y:m,w:t.w,h:t.h};r.find(v=>A.isIntercepted(w,v))||((t.x!==p||t.y!==m)&&(t._dirty=!0),t.x=p,t.y=m,delete t.autoPosition,c=!0)}return c}addNode(t,r=!1,i){const o=this.nodes.find(c=>c._id===t._id);if(o)return o;this._inColumnResize?this.nodeBoundFix(t):this.prepareNode(t),delete t._temporaryRemoved,delete t._removeDOM;let u;return t.autoPosition&&this.findEmptyPosition(t,this.nodes,this.column,i)&&(delete t.autoPosition,u=!0),this.nodes.push(t),r&&this.addedNodes.push(t),u||this._fixCollisions(t),this.batchMode||this._packNodes()._notify(),t}removeNode(t,r=!0,i=!1){return this.nodes.find(o=>o._id===t._id)?(i&&this.removedNodes.push(t),r&&(t._removeDOM=!0),this.nodes=this.nodes.filter(o=>o._id!==t._id),t._isAboutToRemove||this._packNodes(),this._notify([t]),this):this}removeAll(t=!0,r=!0){if(delete this._layouts,!this.nodes.length)return this;t&&this.nodes.forEach(o=>o._removeDOM=!0);const i=this.nodes;return this.removedNodes=r?i:[],this.nodes=[],this._notify(i)}moveNodeCheck(t,r){if(!this.changedPosConstrain(t,r))return!1;if(r.pack=!0,!this.maxRow)return this.moveNode(t,r);let i;const o=new ai({column:this.column,float:this.float,nodes:this.nodes.map(c=>c._id===t._id?(i={...c},i):{...c})});if(!i)return!1;const u=o.moveNode(i,r)&&o.getRow()<=Math.max(this.getRow(),this.maxRow);if(!u&&!r.resizing&&r.collide){const c=r.collide.el.gridstackNode;if(this.swap(t,c))return this._notify(),!0}return u?(o.nodes.filter(c=>c._dirty).forEach(c=>{const d=this.nodes.find(p=>p._id===c._id);d&&(A.copyPos(d,c),d._dirty=!0)}),this._notify(),!0):!1}willItFit(t){if(delete t._willFitPos,!this.maxRow)return!0;const r=new ai({column:this.column,float:this.float,nodes:this.nodes.map(o=>({...o}))}),i={...t};return this.cleanupNode(i),delete i.el,delete i._id,delete i.content,delete i.grid,r.addNode(i),r.getRow()<=this.maxRow?(t._willFitPos=A.copyPos({},i),!0):!1}changedPosConstrain(t,r){return r.w=r.w||t.w,r.h=r.h||t.h,t.x!==r.x||t.y!==r.y?!0:(t.maxW&&(r.w=Math.min(r.w,t.maxW)),t.maxH&&(r.h=Math.min(r.h,t.maxH)),t.minW&&(r.w=Math.max(r.w,t.minW)),t.minH&&(r.h=Math.max(r.h,t.minH)),t.w!==r.w||t.h!==r.h)}moveNode(t,r){var m,w;if(!t||!r)return!1;let i;r.pack===void 0&&!this.batchMode&&(i=r.pack=!0),typeof r.x!="number"&&(r.x=t.x),typeof r.y!="number"&&(r.y=t.y),typeof r.w!="number"&&(r.w=t.w),typeof r.h!="number"&&(r.h=t.h);const o=t.w!==r.w||t.h!==r.h,u=A.copyPos({},t,!0);if(A.copyPos(u,r),this.nodeBoundFix(u,o),A.copyPos(r,u),!r.forceCollide&&A.samePos(t,r))return!1;const c=A.copyPos({},t),d=this.collideAll(t,u,r.skip);let p=!0;if(d.length){const v=t._moving&&!r.nested;let x=v?this.directionCollideCoverage(t,r,d):d[0];if(v&&x&&((w=(m=t.grid)==null?void 0:m.opts)!=null&&w.subGridDynamic)&&!t.grid._isTemp){const z=A.areaIntercept(r.rect,x._rect),R=A.area(r.rect),k=A.area(x._rect);z/(R.8&&(x.grid.makeSubGrid(x.el,void 0,t),x=void 0)}x?p=!this._fixCollisions(t,u,x,r):(p=!1,i&&delete r.pack)}return p&&!A.samePos(t,u)&&(t._dirty=!0,A.copyPos(t,u)),r.pack&&this._packNodes()._notify(),!A.samePos(t,c)}getRow(){return this.nodes.reduce((t,r)=>Math.max(t,r.y+r.h),0)}beginUpdate(t){return t._updating||(t._updating=!0,delete t._skipDown,this.batchMode||this.saveInitial()),this}endUpdate(){const t=this.nodes.find(r=>r._updating);return t&&(delete t._updating,delete t._skipDown),this}save(t=!0,r){var c;const i=(c=this._layouts)==null?void 0:c.length,o=i&&this.column!==i-1?this._layouts[i-1]:null,u=[];return this.sortNodes(),this.nodes.forEach(d=>{const p=o==null?void 0:o.find(w=>w._id===d._id),m={...d,...p||{}};A.removeInternalForSave(m,!t),r&&r(d,m),u.push(m)}),u}layoutsNodesChange(t){return!this._layouts||this._inColumnResize?this:(this._layouts.forEach((r,i)=>{if(!r||i===this.column)return this;if(i{if(!u._orig)return;const c=r.find(d=>d._id===u._id);c&&(c.y>=0&&u.y!==u._orig.y&&(c.y+=u.y-u._orig.y),u.x!==u._orig.x&&(c.x=Math.round(u.x*o)),u.w!==u._orig.w&&(c.w=Math.round(u.w*o)))})}}),this)}columnChanged(t,r,i="moveScale"){var d;if(!this.nodes.length||!r||t===r)return this;const o=i==="compact"||i==="list";o&&this.sortNodes(1),rt&&this._layouts){const p=this._layouts[r]||[],m=this._layouts.length-1;!p.length&&t!==m&&((d=this._layouts[m])!=null&&d.length)&&(t=m,this._layouts[m].forEach(w=>{const v=c.find(x=>x._id===w._id);v&&(!o&&!w.autoPosition&&(v.x=w.x??v.x,v.y=w.y??v.y),v.w=w.w??v.w,(w.x==null||w.y===void 0)&&(v.autoPosition=!0))})),p.forEach(w=>{const v=c.findIndex(x=>x._id===w._id);if(v!==-1){const x=c[v];if(o){x.w=w.w;return}(w.autoPosition||isNaN(w.x)||isNaN(w.y))&&this.findEmptyPosition(w,u),w.autoPosition||(x.x=w.x??x.x,x.y=w.y??x.y,x.w=w.w??x.w,u.push(x)),c.splice(v,1)}})}if(o)this.compact(i,!1);else{if(c.length)if(typeof i=="function")i(r,t,u,c);else{const p=o||i==="none"?1:r/t,m=i==="move"||i==="moveScale",w=i==="scale"||i==="moveScale";c.forEach(v=>{v.x=r===1?0:m?Math.round(v.x*p):Math.min(v.x,r-1),v.w=r===1||t===1?1:w?Math.round(v.w*p)||1:Math.min(v.w,r),u.push(v)}),c=[]}u=A.sort(u,-1),this._inColumnResize=!0,this.nodes=[],u.forEach(p=>{this.addNode(p,!1),delete p._orig})}return this.nodes.forEach(p=>delete p._orig),this.batchUpdate(!1,!o),delete this._inColumnResize,this}cacheLayout(t,r,i=!1){const o=[];return t.forEach((u,c)=>{if(u._id===void 0){const d=u.id?this.nodes.find(p=>p.id===u.id):void 0;u._id=(d==null?void 0:d._id)??ai._idSeq++}o[c]={x:u.x,y:u.y,w:u.w,_id:u._id}}),this._layouts=i?[]:this._layouts||[],this._layouts[r]=o,this}cacheOneLayout(t,r){t._id=t._id??ai._idSeq++;const i={x:t.x,y:t.y,w:t.w,_id:t._id};(t.autoPosition||t.x===void 0)&&(delete i.x,delete i.y,t.autoPosition&&(i.autoPosition=!0)),this._layouts=this._layouts||[],this._layouts[r]=this._layouts[r]||[];const o=this.findCacheLayout(t,r);return o===-1?this._layouts[r].push(i):this._layouts[r][o]=i,this}findCacheLayout(t,r){var i,o;return((o=(i=this._layouts)==null?void 0:i[r])==null?void 0:o.findIndex(u=>u._id===t._id))??-1}removeNodeFromLayoutCache(t){if(this._layouts)for(let r=0;r0||navigator.msMaxTouchPoints>0);class ui{}function pu(l,t){l.touches.length>1||(l.cancelable&&l.preventDefault(),A.simulateMouseEvent(l.changedTouches[0],t))}function Um(l,t){l.cancelable&&l.preventDefault(),A.simulateMouseEvent(l,t)}function gu(l){ui.touchHandled||(ui.touchHandled=!0,pu(l,"mousedown"))}function mu(l){ui.touchHandled&&pu(l,"mousemove")}function vu(l){if(!ui.touchHandled)return;ui.pointerLeaveTimeout&&(window.clearTimeout(ui.pointerLeaveTimeout),delete ui.pointerLeaveTimeout);const t=!!Le.dragElement;pu(l,"mouseup"),t||pu(l,"click"),ui.touchHandled=!1}function yu(l){l.pointerType!=="mouse"&&l.target.releasePointerCapture(l.pointerId)}function Eg(l){Le.dragElement&&l.pointerType!=="mouse"&&Um(l,"mouseenter")}function Cg(l){Le.dragElement&&l.pointerType!=="mouse"&&(ui.pointerLeaveTimeout=window.setTimeout(()=>{delete ui.pointerLeaveTimeout,Um(l,"mouseleave")},10))}class bu{constructor(t,r,i){this.host=t,this.dir=r,this.option=i,this.moving=!1,this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this._init()}_init(){const t=this.el=document.createElement("div");return t.classList.add("ui-resizable-handle"),t.classList.add(`${bu.prefix}${this.dir}`),t.style.zIndex="100",t.style.userSelect="none",this.host.appendChild(this.el),this.el.addEventListener("mousedown",this._mouseDown),Kr&&(this.el.addEventListener("touchstart",gu),this.el.addEventListener("pointerdown",yu)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),Kr&&(this.el.removeEventListener("touchstart",gu),this.el.removeEventListener("pointerdown",yu)),this.host.removeChild(this.el),delete this.el,delete this.host,this}_mouseDown(t){this.mouseDownEvent=t,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),Kr&&(this.el.addEventListener("touchmove",mu),this.el.addEventListener("touchend",vu)),t.stopPropagation(),t.preventDefault()}_mouseMove(t){const r=this.mouseDownEvent;this.moving?this._triggerEvent("move",t):Math.abs(t.x-r.x)+Math.abs(t.y-r.y)>2&&(this.moving=!0,this._triggerEvent("start",this.mouseDownEvent),this._triggerEvent("move",t),document.addEventListener("keydown",this._keyEvent)),t.stopPropagation()}_mouseUp(t){this.moving&&(this._triggerEvent("stop",t),document.removeEventListener("keydown",this._keyEvent)),document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),Kr&&(this.el.removeEventListener("touchmove",mu),this.el.removeEventListener("touchend",vu)),delete this.moving,delete this.mouseDownEvent,t.stopPropagation(),t.preventDefault()}_keyEvent(t){var r,i;t.key==="Escape"&&((i=(r=this.host.gridstackNode)==null?void 0:r.grid)==null||i.engine.restoreInitial(),this._mouseUp(this.mouseDownEvent))}_triggerEvent(t,r){return this.option[t]&&this.option[t](r),this}}bu.prefix="ui-resizable-";class ad{constructor(){this._eventRegister={}}get disabled(){return this._disabled}on(t,r){this._eventRegister[t]=r}off(t){delete this._eventRegister[t]}enable(){this._disabled=!1}disable(){this._disabled=!0}destroy(){delete this._eventRegister}triggerEvent(t,r){if(!this.disabled&&this._eventRegister&&this._eventRegister[t])return this._eventRegister[t](r)}}class zo extends ad{constructor(t,r={}){super(),this.el=t,this.option=r,this.rectScale={x:1,y:1},this._ui=()=>{const o=this.el.parentElement.getBoundingClientRect(),u={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},c=this.temporalRect||u;return{position:{left:(c.left-o.left)*this.rectScale.x,top:(c.top-o.top)*this.rectScale.y},size:{width:c.width*this.rectScale.x,height:c.height*this.rectScale.y}}},this._mouseOver=this._mouseOver.bind(this),this._mouseOut=this._mouseOut.bind(this),this.enable(),this._setupAutoHide(this.option.autoHide),this._setupHandlers()}on(t,r){super.on(t,r)}off(t){super.off(t)}enable(){super.enable(),this.el.classList.remove("ui-resizable-disabled"),this._setupAutoHide(this.option.autoHide)}disable(){super.disable(),this.el.classList.add("ui-resizable-disabled"),this._setupAutoHide(!1)}destroy(){this._removeHandlers(),this._setupAutoHide(!1),delete this.el,super.destroy()}updateOption(t){const r=t.handles&&t.handles!==this.option.handles,i=t.autoHide&&t.autoHide!==this.option.autoHide;return Object.keys(t).forEach(o=>this.option[o]=t[o]),r&&(this._removeHandlers(),this._setupHandlers()),i&&this._setupAutoHide(this.option.autoHide),this}_setupAutoHide(t){return t?(this.el.classList.add("ui-resizable-autohide"),this.el.addEventListener("mouseover",this._mouseOver),this.el.addEventListener("mouseout",this._mouseOut)):(this.el.classList.remove("ui-resizable-autohide"),this.el.removeEventListener("mouseover",this._mouseOver),this.el.removeEventListener("mouseout",this._mouseOut),Le.overResizeElement===this&&delete Le.overResizeElement),this}_mouseOver(t){Le.overResizeElement||Le.dragElement||(Le.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(t){Le.overResizeElement===this&&(delete Le.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(t=>t.trim()).map(t=>new bu(this.el,t,{start:r=>{this._resizeStart(r)},stop:r=>{this._resizeStop(r)},move:r=>{this._resizing(r,t)}})),this}_resizeStart(t){this.sizeToContent=A.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=A.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=t,this._setupHelper(),this._applyChange();const r=A.initEvent(t,{type:"resizestart",target:this.el});return this.option.start&&this.option.start(r,this._ui()),this.el.classList.add("ui-resizable-resizing"),this.triggerEvent("resizestart",r),this}_resizing(t,r){this.scrolled=this.scrollEl.scrollTop-this.scrollY,this.temporalRect=this._getChange(t,r),this._applyChange();const i=A.initEvent(t,{type:"resize",target:this.el});return this.option.resize&&this.option.resize(i,this._ui()),this.triggerEvent("resize",i),this}_resizeStop(t){const r=A.initEvent(t,{type:"resizestop",target:this.el});return this.option.stop&&this.option.stop(r),this.el.classList.remove("ui-resizable-resizing"),this.triggerEvent("resizestop",r),this._cleanHelper(),delete this.startEvent,delete this.originalRect,delete this.temporalRect,delete this.scrollY,delete this.scrolled,this}_setupHelper(){this.elOriginStyleVal=zo._originStyleProp.map(i=>this.el.style[i]),this.parentOriginStylePosition=this.el.parentElement.style.position;const t=this.el.parentElement,r=A.getValuesFromTransformedElement(t);return this.rectScale={x:r.xScale,y:r.yScale},getComputedStyle(this.el.parentElement).position.match(/static/)&&(this.el.parentElement.style.position="relative"),this.el.style.position="absolute",this.el.style.opacity="0.8",this}_cleanHelper(){return zo._originStyleProp.forEach((t,r)=>{this.el.style[t]=this.elOriginStyleVal[r]||null}),this.el.parentElement.style.position=this.parentOriginStylePosition||null,this}_getChange(t,r){const i=this.startEvent,o={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},u=t.clientX-i.clientX,c=this.sizeToContent?0:t.clientY-i.clientY;let d,p;r.indexOf("e")>-1?o.width+=u:r.indexOf("w")>-1&&(o.width-=u,o.left+=u,d=!0),r.indexOf("s")>-1?o.height+=c:r.indexOf("n")>-1&&(o.height-=c,o.top+=c,p=!0);const m=this._constrainSize(o.width,o.height,d,p);return Math.round(o.width)!==Math.round(m.width)&&(r.indexOf("w")>-1&&(o.left+=o.width-m.width),o.width=m.width),Math.round(o.height)!==Math.round(m.height)&&(r.indexOf("n")>-1&&(o.top+=o.height-m.height),o.height=m.height),o}_constrainSize(t,r,i,o){const u=this.option,c=(i?u.maxWidthMoveLeft:u.maxWidth)||Number.MAX_SAFE_INTEGER,d=u.minWidth/this.rectScale.x||t,p=(o?u.maxHeightMoveUp:u.maxHeight)||Number.MAX_SAFE_INTEGER,m=u.minHeight/this.rectScale.y||r,w=Math.min(c,Math.max(d,t)),v=Math.min(p,Math.max(m,r));return{width:w,height:v}}_applyChange(){let t={left:0,top:0,width:0,height:0};if(this.el.style.position==="absolute"){const r=this.el.parentElement,{left:i,top:o}=r.getBoundingClientRect();t={left:i,top:o,width:0,height:0}}return this.temporalRect?(Object.keys(this.temporalRect).forEach(r=>{const i=this.temporalRect[r],o=r==="width"||r==="left"?this.rectScale.x:r==="height"||r==="top"?this.rectScale.y:1;this.el.style[r]=(i-t[r])*o+"px"}),this):this}_removeHandlers(){return this.handlers.forEach(t=>t.destroy()),delete this.handlers,this}}zo._originStyleProp=["width","height","position","left","top","opacity","zIndex"];const ES='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class Mo extends ad{constructor(t,r={}){var u;super(),this.el=t,this.option=r,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0};const i=(u=r==null?void 0:r.handle)==null?void 0:u.substring(1),o=t.gridstackNode;this.dragEls=!i||t.classList.contains(i)?[t]:o!=null&&o.subGrid?[t.querySelector(r.handle)||t]:Array.from(t.querySelectorAll(r.handle)),this.dragEls.length===0&&(this.dragEls=[t]),this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this.enable()}on(t,r){super.on(t,r)}off(t){super.off(t)}enable(){this.disabled!==!1&&(super.enable(),this.dragEls.forEach(t=>{t.addEventListener("mousedown",this._mouseDown),Kr&&(t.addEventListener("touchstart",gu),t.addEventListener("pointerdown",yu))}),this.el.classList.remove("ui-draggable-disabled"))}disable(t=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(r=>{r.removeEventListener("mousedown",this._mouseDown),Kr&&(r.removeEventListener("touchstart",gu),r.removeEventListener("pointerdown",yu))}),t||this.el.classList.add("ui-draggable-disabled"))}destroy(){this.dragTimeout&&window.clearTimeout(this.dragTimeout),delete this.dragTimeout,this.mouseDownEvent&&this._mouseUp(this.mouseDownEvent),this.disable(!0),delete this.el,delete this.helper,delete this.option,super.destroy()}updateOption(t){return Object.keys(t).forEach(r=>this.option[r]=t[r]),this}_mouseDown(t){if(!Le.mouseHandled)return t.button!==0||!this.dragEls.find(r=>r===t.target)&&t.target.closest(ES)||this.option.cancel&&t.target.closest(this.option.cancel)||(this.mouseDownEvent=t,delete this.dragging,delete Le.dragElement,delete Le.dropElement,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),Kr&&(t.currentTarget.addEventListener("touchmove",mu),t.currentTarget.addEventListener("touchend",vu)),t.preventDefault(),document.activeElement&&document.activeElement.blur(),Le.mouseHandled=!0),!0}_callDrag(t){if(!this.dragging)return;const r=A.initEvent(t,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(r,this.ui()),this.triggerEvent("drag",r)}_mouseMove(t){var i;const r=this.mouseDownEvent;if(this.lastDrag=t,this.dragging)if(this._dragFollow(t),Le.pauseDrag){const o=Number.isInteger(Le.pauseDrag)?Le.pauseDrag:100;this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>this._callDrag(t),o)}else this._callDrag(t);else if(Math.abs(t.x-r.x)+Math.abs(t.y-r.y)>3){this.dragging=!0,Le.dragElement=this;const o=(i=this.el.gridstackNode)==null?void 0:i.grid;o?Le.dropElement=o.el.ddElement.ddDroppable:delete Le.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=A.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(t,this.el,this.helperContainment),this._setupHelperStyle(t);const u=A.initEvent(t,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(u,this.ui()),this.triggerEvent("dragstart",u),document.addEventListener("keydown",this._keyEvent)}return!0}_mouseUp(t){var r,i;if(document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),Kr&&t.currentTarget&&(t.currentTarget.removeEventListener("touchmove",mu,!0),t.currentTarget.removeEventListener("touchend",vu,!0)),this.dragging){delete this.dragging,(r=this.el.gridstackNode)==null||delete r._origRotate,document.removeEventListener("keydown",this._keyEvent),((i=Le.dropElement)==null?void 0:i.el)===this.el.parentElement&&delete Le.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();const o=A.initEvent(t,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(o),this.triggerEvent("dragstop",o),Le.dropElement&&Le.dropElement.drop(t)}delete this.helper,delete this.mouseDownEvent,delete Le.dragElement,delete Le.dropElement,delete Le.mouseHandled,t.preventDefault()}_keyEvent(t){var o,u;const r=this.el.gridstackNode,i=(r==null?void 0:r.grid)||((u=(o=Le.dropElement)==null?void 0:o.el)==null?void 0:u.gridstack);if(t.key==="Escape")r&&r._origRotate&&(r._orig=r._origRotate,delete r._origRotate),i==null||i.cancelDrag(),this._mouseUp(this.mouseDownEvent);else if(r&&i&&(t.key==="r"||t.key==="R")){if(!A.canBeRotated(r))return;r._origRotate=r._origRotate||{...r._orig},delete r._moving,i.setAnimation(!1).rotate(r.el,{top:-this.dragOffset.offsetTop,left:-this.dragOffset.offsetLeft}).setAnimation(),r._moving=!0,this.dragOffset=this._getDragOffset(this.lastDrag,r.el,this.helperContainment),this.helper.style.width=this.dragOffset.width+"px",this.helper.style.height=this.dragOffset.height+"px",A.swap(r._orig,"w","h"),delete r._rect,this._mouseMove(this.lastDrag)}}_createHelper(){let t=this.el;return typeof this.option.helper=="function"?t=this.option.helper(this.el):this.option.helper==="clone"&&(t=A.cloneNode(this.el)),t.parentElement||A.appendTo(t,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=Mo.originStyleProp.map(r=>this.el.style[r]),t}_setupHelperStyle(t){this.helper.classList.add("ui-draggable-dragging");const r=this.helper.style;return r.pointerEvents="none",r.width=this.dragOffset.width+"px",r.height=this.dragOffset.height+"px",r.willChange="left, top",r.position="fixed",this._dragFollow(t),r.transition="none",setTimeout(()=>{this.helper&&(r.transition=null)},0),this}_removeHelperStyle(){var r;this.helper.classList.remove("ui-draggable-dragging");const t=(r=this.helper)==null?void 0:r.gridstackNode;if(!(t!=null&&t._isAboutToRemove)&&this.dragElementOriginStyle){const i=this.helper,o=this.dragElementOriginStyle.transition||null;i.style.transition=this.dragElementOriginStyle.transition="none",Mo.originStyleProp.forEach(u=>i.style[u]=this.dragElementOriginStyle[u]||null),setTimeout(()=>i.style.transition=o,50)}return delete this.dragElementOriginStyle,this}_dragFollow(t){const r={left:0,top:0},i=this.helper.style,o=this.dragOffset;i.left=(t.clientX+o.offsetLeft-r.left)*this.dragTransform.xScale+"px",i.top=(t.clientY+o.offsetTop-r.top)*this.dragTransform.yScale+"px"}_setupHelperContainmentStyle(){return this.helperContainment=this.helper.parentElement,this.helper.style.position!=="fixed"&&(this.parentOriginStylePosition=this.helperContainment.style.position,getComputedStyle(this.helperContainment).position.match(/static/)&&(this.helperContainment.style.position="relative")),this}_getDragOffset(t,r,i){let o=0,u=0;i&&(o=this.dragTransform.xOffset,u=this.dragTransform.yOffset);const c=r.getBoundingClientRect();return{left:c.left,top:c.top,offsetLeft:-t.clientX+c.left-o,offsetTop:-t.clientY+c.top-u,width:c.width*this.dragTransform.xScale,height:c.height*this.dragTransform.yScale}}ui(){const r=this.el.parentElement.getBoundingClientRect(),i=this.helper.getBoundingClientRect();return{position:{top:(i.top-r.top)*this.dragTransform.yScale,left:(i.left-r.left)*this.dragTransform.xScale}}}}Mo.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","top","minWidth","willChange"];class CS extends ad{constructor(t,r={}){super(),this.el=t,this.option=r,this._mouseEnter=this._mouseEnter.bind(this),this._mouseLeave=this._mouseLeave.bind(this),this.enable(),this._setupAccept()}on(t,r){super.on(t,r)}off(t){super.off(t)}enable(){this.disabled!==!1&&(super.enable(),this.el.classList.add("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),this.el.addEventListener("mouseenter",this._mouseEnter),this.el.addEventListener("mouseleave",this._mouseLeave),Kr&&(this.el.addEventListener("pointerenter",Eg),this.el.addEventListener("pointerleave",Cg)))}disable(t=!1){this.disabled!==!0&&(super.disable(),this.el.classList.remove("ui-droppable"),t||this.el.classList.add("ui-droppable-disabled"),this.el.removeEventListener("mouseenter",this._mouseEnter),this.el.removeEventListener("mouseleave",this._mouseLeave),Kr&&(this.el.removeEventListener("pointerenter",Eg),this.el.removeEventListener("pointerleave",Cg)))}destroy(){this.disable(!0),this.el.classList.remove("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),super.destroy()}updateOption(t){return Object.keys(t).forEach(r=>this.option[r]=t[r]),this._setupAccept(),this}_mouseEnter(t){if(!Le.dragElement||!this._canDrop(Le.dragElement.el))return;t.preventDefault(),t.stopPropagation(),Le.dropElement&&Le.dropElement!==this&&Le.dropElement._mouseLeave(t,!0),Le.dropElement=this;const r=A.initEvent(t,{target:this.el,type:"dropover"});this.option.over&&this.option.over(r,this._ui(Le.dragElement)),this.triggerEvent("dropover",r),this.el.classList.add("ui-droppable-over")}_mouseLeave(t,r=!1){var o;if(!Le.dragElement||Le.dropElement!==this)return;t.preventDefault(),t.stopPropagation();const i=A.initEvent(t,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(i,this._ui(Le.dragElement)),this.triggerEvent("dropout",i),Le.dropElement===this&&(delete Le.dropElement,!r)){let u,c=this.el.parentElement;for(;!u&&c;)u=(o=c.ddElement)==null?void 0:o.ddDroppable,c=c.parentElement;u&&u._mouseEnter(t)}}drop(t){t.preventDefault();const r=A.initEvent(t,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(r,this._ui(Le.dragElement)),this.triggerEvent("drop",r)}_canDrop(t){return t&&(!this.accept||this.accept(t))}_setupAccept(){return this.option.accept?(typeof this.option.accept=="string"?this.accept=t=>t.classList.contains(this.option.accept)||t.matches(this.option.accept):this.accept=this.option.accept,this):this}_ui(t){return{draggable:t.el,...t.ui()}}}class ud{static init(t){return t.ddElement||(t.ddElement=new ud(t)),t.ddElement}constructor(t){this.el=t}on(t,r){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(t)>-1?this.ddDraggable.on(t,r):this.ddDroppable&&["drop","dropover","dropout"].indexOf(t)>-1?this.ddDroppable.on(t,r):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(t)>-1&&this.ddResizable.on(t,r),this}off(t){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(t)>-1?this.ddDraggable.off(t):this.ddDroppable&&["drop","dropover","dropout"].indexOf(t)>-1?this.ddDroppable.off(t):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(t)>-1&&this.ddResizable.off(t),this}setupDraggable(t){return this.ddDraggable?this.ddDraggable.updateOption(t):this.ddDraggable=new Mo(this.el,t),this}cleanDraggable(){return this.ddDraggable&&(this.ddDraggable.destroy(),delete this.ddDraggable),this}setupResizable(t){return this.ddResizable?this.ddResizable.updateOption(t):this.ddResizable=new zo(this.el,t),this}cleanResizable(){return this.ddResizable&&(this.ddResizable.destroy(),delete this.ddResizable),this}setupDroppable(t){return this.ddDroppable?this.ddDroppable.updateOption(t):this.ddDroppable=new CS(this.el,t),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class kS{resizable(t,r,i,o){return this._getDDElements(t,r).forEach(u=>{if(r==="disable"||r==="enable")u.ddResizable&&u.ddResizable[r]();else if(r==="destroy")u.ddResizable&&u.cleanResizable();else if(r==="option")u.setupResizable({[i]:o});else{const d=u.el.gridstackNode.grid;let p=u.el.getAttribute("gs-resize-handles")||d.opts.resizable.handles||"e,s,se";p==="all"&&(p="n,e,s,w,se,sw,ne,nw");const m=!d.opts.alwaysShowResizeHandle;u.setupResizable({...d.opts.resizable,handles:p,autoHide:m,start:r.start,stop:r.stop,resize:r.resize})}}),this}draggable(t,r,i,o){return this._getDDElements(t,r).forEach(u=>{if(r==="disable"||r==="enable")u.ddDraggable&&u.ddDraggable[r]();else if(r==="destroy")u.ddDraggable&&u.cleanDraggable();else if(r==="option")u.setupDraggable({[i]:o});else{const c=u.el.gridstackNode.grid;u.setupDraggable({...c.opts.draggable,start:r.start,stop:r.stop,drag:r.drag})}}),this}dragIn(t,r){return this._getDDElements(t).forEach(i=>i.setupDraggable(r)),this}droppable(t,r,i,o){return typeof r.accept=="function"&&!r._accept&&(r._accept=r.accept,r.accept=u=>r._accept(u)),this._getDDElements(t,r).forEach(u=>{r==="disable"||r==="enable"?u.ddDroppable&&u.ddDroppable[r]():r==="destroy"?u.ddDroppable&&u.cleanDroppable():r==="option"?u.setupDroppable({[i]:o}):u.setupDroppable(r)}),this}isDroppable(t){var r;return!!((r=t==null?void 0:t.ddElement)!=null&&r.ddDroppable&&!t.ddElement.ddDroppable.disabled)}isDraggable(t){var r;return!!((r=t==null?void 0:t.ddElement)!=null&&r.ddDraggable&&!t.ddElement.ddDraggable.disabled)}isResizable(t){var r;return!!((r=t==null?void 0:t.ddElement)!=null&&r.ddResizable&&!t.ddElement.ddResizable.disabled)}on(t,r,i){return this._getDDElements(t).forEach(o=>o.on(r,u=>{i(u,Le.dragElement?Le.dragElement.el:u.target,Le.dragElement?Le.dragElement.helper:null)})),this}off(t,r){return this._getDDElements(t).forEach(i=>i.off(r)),this}_getDDElements(t,r){const i=t.gridstack||r!=="destroy"&&r!=="disable",o=A.getElements(t);return o.length?o.map(c=>c.ddElement||(i?ud.init(c):null)).filter(c=>c):[]}}/*! - * GridStack 11.5.1 - * https://gridstackjs.com/ - * - * Copyright (c) 2021-2024 Alain Dumesny - * see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE - */const $n=new kS;class Ne{static init(t={},r=".grid-stack"){if(typeof document>"u")return null;const i=Ne.getGridElement(r);return i?(i.gridstack||(i.gridstack=new Ne(i,A.cloneDeep(t))),i.gridstack):(console.error(typeof r=="string"?'GridStack.initAll() no grid was found with selector "'+r+`" - element missing or wrong selector ? -Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`:"GridStack.init() no grid element was passed."),null)}static initAll(t={},r=".grid-stack"){const i=[];return typeof document>"u"||(Ne.getGridElements(r).forEach(o=>{o.gridstack||(o.gridstack=new Ne(o,A.cloneDeep(t))),i.push(o.gridstack)}),i.length===0&&console.error('GridStack.initAll() no grid was found with selector "'+r+`" - element missing or wrong selector ? -Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`)),i}static addGrid(t,r={}){if(!t)return null;let i=t;if(i.gridstack){const c=i.gridstack;return r&&(c.opts={...c.opts,...r}),r.children!==void 0&&c.load(r.children),c}return(!t.classList.contains("grid-stack")||Ne.addRemoveCB)&&(Ne.addRemoveCB?i=Ne.addRemoveCB(t,r,!0,!0):i=A.createDiv(["grid-stack",r.class],t)),Ne.init(r,i)}static registerEngine(t){Ne.engineClass=t}get placeholder(){if(!this._placeholder){this._placeholder=A.createDiv([this.opts.placeholderClass,yr.itemClass,this.opts.itemClass]);const t=A.createDiv(["placeholder-content"],this._placeholder);this.opts.placeholderText&&(t.textContent=this.opts.placeholderText)}return this._placeholder}constructor(t,r={}){var v,x,z;this.el=t,this.opts=r,this.animationDelay=310,this._gsEventHandler={},this._extraDragRow=0,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0},t.gridstack=this,this.opts=r=r||{},t.classList.contains("grid-stack")||this.el.classList.add("grid-stack"),r.row&&(r.minRow=r.maxRow=r.row,delete r.row);const i=A.toNumber(t.getAttribute("gs-row"));r.column==="auto"&&delete r.column,r.alwaysShowResizeHandle!==void 0&&(r._alwaysShowResizeHandle=r.alwaysShowResizeHandle);let o=(v=r.columnOpts)==null?void 0:v.breakpoints;const u=r;if(u.oneColumnModeDomSort&&(delete u.oneColumnModeDomSort,console.log("warning: Gridstack oneColumnModeDomSort no longer supported. Use GridStackOptions.columnOpts instead.")),u.oneColumnSize||u.disableOneColumnMode===!1){const R=u.oneColumnSize||768;delete u.oneColumnSize,delete u.disableOneColumnMode,r.columnOpts=r.columnOpts||{},o=r.columnOpts.breakpoints=r.columnOpts.breakpoints||[];let k=o.find(b=>b.c===1);k?k.w=R:(k={c:1,w:R},o.push(k,{c:12,w:R+1}))}const c=r.columnOpts;c&&(!c.columnWidth&&!((x=c.breakpoints)!=null&&x.length)?(delete r.columnOpts,o=void 0):c.columnMax=c.columnMax||12),(o==null?void 0:o.length)>1&&o.sort((R,k)=>(k.w||0)-(R.w||0));const d={...A.cloneDeep(yr),column:A.toNumber(t.getAttribute("gs-column"))||yr.column,minRow:i||A.toNumber(t.getAttribute("gs-min-row"))||yr.minRow,maxRow:i||A.toNumber(t.getAttribute("gs-max-row"))||yr.maxRow,staticGrid:A.toBool(t.getAttribute("gs-static"))||yr.staticGrid,sizeToContent:A.toBool(t.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(r.handleClass?"."+r.handleClass:r.handle?r.handle:"")||yr.draggable.handle},removableOptions:{accept:r.itemClass||yr.removableOptions.accept,decline:yr.removableOptions.decline}};t.getAttribute("gs-animate")&&(d.animate=A.toBool(t.getAttribute("gs-animate"))),r=A.defaults(r,d),this._initMargin(),this.checkDynamicColumn(),this.el.classList.add("gs-"+r.column),r.rtl==="auto"&&(r.rtl=t.style.direction==="rtl"),r.rtl&&this.el.classList.add("grid-stack-rtl");const p=this.el.closest("."+yr.itemClass),m=p==null?void 0:p.gridstackNode;m&&(m.subGrid=this,this.parentGridNode=m,this.el.classList.add("grid-stack-nested"),m.el.classList.add("grid-stack-sub-grid")),this._isAutoCellHeight=r.cellHeight==="auto",this._isAutoCellHeight||r.cellHeight==="initial"?this.cellHeight(void 0,!1):(typeof r.cellHeight=="number"&&r.cellHeightUnit&&r.cellHeightUnit!==yr.cellHeightUnit&&(r.cellHeight=r.cellHeight+r.cellHeightUnit,delete r.cellHeightUnit),this.cellHeight(r.cellHeight,!1)),r.alwaysShowResizeHandle==="mobile"&&(r.alwaysShowResizeHandle=Kr),this._styleSheetClass="gs-id-"+ai._idSeq++,this.el.classList.add(this._styleSheetClass),this._setStaticClass();const w=r.engineClass||Ne.engineClass||ai;if(this.engine=new w({column:this.getColumn(),float:r.float,maxRow:r.maxRow,onChange:R=>{let k=0;this.engine.nodes.forEach(b=>{k=Math.max(k,b.y+b.h)}),R.forEach(b=>{const U=b.el;U&&(b._removeDOM?(U&&U.remove(),delete b._removeDOM):this._writePosAttr(U,b))}),this._updateStyles(!1,k)}}),this._updateStyles(!1,0),r.auto&&(this.batchUpdate(),this.engine._loading=!0,this.getGridItems().forEach(R=>this._prepareElement(R)),delete this.engine._loading,this.batchUpdate(!1)),r.children){const R=r.children;delete r.children,R.length&&this.load(R)}this.setAnimation(),r.subGridDynamic&&!Le.pauseDrag&&(Le.pauseDrag=!0),((z=r.draggable)==null?void 0:z.pause)!==void 0&&(Le.pauseDrag=r.draggable.pause),this._setupRemoveDrop(),this._setupAcceptWidget(),this._updateResizeEvent()}addWidget(t){if(typeof t=="string"){console.error("V11: GridStack.addWidget() does not support string anymore. see #2736");return}if(t.ELEMENT_NODE)return console.error("V11: GridStack.addWidget() does not support HTMLElement anymore. use makeWidget()"),this.makeWidget(t);let r,i=t;if(i.grid=this,i!=null&&i.el?r=i.el:Ne.addRemoveCB?r=Ne.addRemoveCB(this.el,t,!0,!1):r=this.createWidgetDivs(i),!r)return;if(i=r.gridstackNode,i&&r.parentElement===this.el&&this.engine.nodes.find(u=>u._id===i._id))return r;const o=this._readAttr(r);return A.defaults(t,o),this.engine.prepareNode(t),this.el.appendChild(r),this.makeWidget(r,t),r}createWidgetDivs(t){const r=A.createDiv(["grid-stack-item",this.opts.itemClass]),i=A.createDiv(["grid-stack-item-content"],r);return A.lazyLoad(t)?t.visibleObservable||(t.visibleObservable=new IntersectionObserver(([o])=>{var u,c;o.isIntersecting&&((u=t.visibleObservable)==null||u.disconnect(),delete t.visibleObservable,Ne.renderCB(i,t),(c=t.grid)==null||c.prepareDragDrop(t.el))}),window.setTimeout(()=>{var o;return(o=t.visibleObservable)==null?void 0:o.observe(r)})):Ne.renderCB(i,t),r}makeSubGrid(t,r,i,o=!0){var z,R,k;let u=t.gridstackNode;if(u||(u=this.makeWidget(t).gridstackNode),(z=u.subGrid)!=null&&z.el)return u.subGrid;let c,d=this;for(;d&&!c;)c=(R=d.opts)==null?void 0:R.subGridOpts,d=(k=d.parentGridNode)==null?void 0:k.grid;r=A.cloneDeep({...this.opts,id:void 0,children:void 0,column:"auto",columnOpts:void 0,layout:"list",subGridOpts:void 0,...c||{},...r||u.subGridOpts||{}}),u.subGridOpts=r;let p;r.column==="auto"&&(p=!0,r.column=Math.max(u.w||1,(i==null?void 0:i.w)||1),delete r.columnOpts);let m=u.el.querySelector(".grid-stack-item-content"),w,v;if(o&&(this._removeDD(u.el),v={...u,x:0,y:0},A.removeInternalForSave(v),delete v.subGridOpts,u.content&&(v.content=u.content,delete u.content),Ne.addRemoveCB?w=Ne.addRemoveCB(this.el,v,!0,!1):(w=A.createDiv(["grid-stack-item"]),w.appendChild(m),m=A.createDiv(["grid-stack-item-content"],u.el)),this.prepareDragDrop(u.el)),i){const b=p?r.column:u.w,U=u.h+i.h,P=u.el.style;P.transition="none",this.update(u.el,{w:b,h:U}),setTimeout(()=>P.transition=null)}const x=u.subGrid=Ne.addGrid(m,r);return i!=null&&i._moving&&(x._isTemp=!0),p&&(x._autoColumn=!0),o&&x.makeWidget(w,v),i&&(i._moving?window.setTimeout(()=>A.simulateMouseEvent(i._event,"mouseenter",x.el),0):x.makeWidget(u.el,u)),this.resizeToContentCheck(!1,u),x}removeAsSubGrid(t){var i;const r=(i=this.parentGridNode)==null?void 0:i.grid;r&&(r.batchUpdate(),r.removeWidget(this.parentGridNode.el,!0,!0),this.engine.nodes.forEach(o=>{o.x+=this.parentGridNode.x,o.y+=this.parentGridNode.y,r.makeWidget(o.el,o)}),r.batchUpdate(!1),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,t&&window.setTimeout(()=>A.simulateMouseEvent(t._event,"mouseenter",r.el),0))}save(t=!0,r=!1,i=Ne.saveCB){const o=this.engine.save(t,i);if(o.forEach(u=>{var c;if(t&&u.el&&!u.subGrid&&!i){const d=u.el.querySelector(".grid-stack-item-content");u.content=d==null?void 0:d.innerHTML,u.content||delete u.content}else if(!t&&!i&&delete u.content,(c=u.subGrid)!=null&&c.el){const d=u.subGrid.save(t,r,i);u.subGridOpts=r?d:{children:d},delete u.subGrid}delete u.el}),r){const u=A.cloneDeep(this.opts);u.marginBottom===u.marginTop&&u.marginRight===u.marginLeft&&u.marginTop===u.marginRight&&(u.margin=u.marginTop,delete u.marginTop,delete u.marginRight,delete u.marginBottom,delete u.marginLeft),u.rtl===(this.el.style.direction==="rtl")&&(u.rtl="auto"),this._isAutoCellHeight&&(u.cellHeight="auto"),this._autoColumn&&(u.column="auto");const c=u._alwaysShowResizeHandle;return delete u._alwaysShowResizeHandle,c!==void 0?u.alwaysShowResizeHandle=c:delete u.alwaysShowResizeHandle,A.removeInternalAndSame(u,yr),u.children=o,u}return o}load(t,r=Ne.addRemoveCB||!0){var m;t=A.cloneDeep(t);const i=this.getColumn();t.forEach(w=>{w.w=w.w||1,w.h=w.h||1}),t=A.sort(t),this.engine.skipCacheUpdate=this._ignoreLayoutsNodeChange=!0;let o=0;t.forEach(w=>{o=Math.max(o,(w.x||0)+w.w)}),o>this.engine.defaultColumn&&(this.engine.defaultColumn=o),o>i&&this.engine.cacheLayout(t,o,!0);const u=Ne.addRemoveCB;typeof r=="function"&&(Ne.addRemoveCB=r);const c=[];this.batchUpdate();const d=!this.engine.nodes.length;d&&this.setAnimation(!1),!d&&r&&[...this.engine.nodes].forEach(v=>{if(!v.id)return;A.find(t,v.id)||(Ne.addRemoveCB&&Ne.addRemoveCB(this.el,v,!1,!1),c.push(v),this.removeWidget(v.el,!0,!1))}),this.engine._loading=!0;const p=[];return this.engine.nodes=this.engine.nodes.filter(w=>A.find(t,w.id)?(p.push(w),!1):!0),t.forEach(w=>{var x;const v=A.find(p,w.id);if(v){if(A.shouldSizeToContent(v)&&(w.h=v.h),this.engine.nodeBoundFix(w),(w.autoPosition||w.x===void 0||w.y===void 0)&&(w.w=w.w||v.w,w.h=w.h||v.h,this.engine.findEmptyPosition(w)),this.engine.nodes.push(v),A.samePos(v,w)&&this.engine.nodes.length>1&&(this.moveNode(v,{...w,forceCollide:!0}),A.copyPos(w,v)),this.update(v.el,w),(x=w.subGridOpts)!=null&&x.children){const z=v.el.querySelector(".grid-stack");z&&z.gridstack&&z.gridstack.load(w.subGridOpts.children)}}else r&&this.addWidget(w)}),delete this.engine._loading,this.engine.removedNodes=c,this.batchUpdate(!1),delete this._ignoreLayoutsNodeChange,delete this.engine.skipCacheUpdate,u?Ne.addRemoveCB=u:delete Ne.addRemoveCB,d&&((m=this.opts)!=null&&m.animate)&&this.setAnimation(this.opts.animate,!0),this}batchUpdate(t=!0){return this.engine.batchUpdate(t),t||(this._updateContainerHeight(),this._triggerRemoveEvent(),this._triggerAddEvent(),this._triggerChangeEvent()),this}getCellHeight(t=!1){if(this.opts.cellHeight&&this.opts.cellHeight!=="auto"&&(!t||!this.opts.cellHeightUnit||this.opts.cellHeightUnit==="px"))return this.opts.cellHeight;if(this.opts.cellHeightUnit==="rem")return this.opts.cellHeight*parseFloat(getComputedStyle(document.documentElement).fontSize);if(this.opts.cellHeightUnit==="em")return this.opts.cellHeight*parseFloat(getComputedStyle(this.el).fontSize);if(this.opts.cellHeightUnit==="cm")return this.opts.cellHeight*(96/2.54);if(this.opts.cellHeightUnit==="mm")return this.opts.cellHeight*(96/2.54)/10;const r=this.el.querySelector("."+this.opts.itemClass);if(r){const o=A.toNumber(r.getAttribute("gs-h"))||1;return Math.round(r.offsetHeight/o)}const i=parseInt(this.el.getAttribute("gs-current-row"));return i?Math.round(this.el.getBoundingClientRect().height/i):this.opts.cellHeight}cellHeight(t,r=!0){if(r&&t!==void 0&&this._isAutoCellHeight!==(t==="auto")&&(this._isAutoCellHeight=t==="auto",this._updateResizeEvent()),(t==="initial"||t==="auto")&&(t=void 0),t===void 0){const o=-this.opts.marginRight-this.opts.marginLeft+this.opts.marginTop+this.opts.marginBottom;t=this.cellWidth()+o}const i=A.parseHeight(t);return this.opts.cellHeightUnit===i.unit&&this.opts.cellHeight===i.h?this:(this.opts.cellHeightUnit=i.unit,this.opts.cellHeight=i.h,this.resizeToContentCheck(),r&&this._updateStyles(!0),this)}cellWidth(){return this._widthOrContainer()/this.getColumn()}_widthOrContainer(t=!1){var r;return t&&((r=this.opts.columnOpts)!=null&&r.breakpointForWindow)?window.innerWidth:this.el.clientWidth||this.el.parentElement.clientWidth||window.innerWidth}checkDynamicColumn(){var u,c;const t=this.opts.columnOpts;if(!t||!t.columnWidth&&!((u=t.breakpoints)!=null&&u.length))return!1;const r=this.getColumn();let i=r;const o=this._widthOrContainer(!0);if(t.columnWidth)i=Math.min(Math.round(o/t.columnWidth)||1,t.columnMax);else{i=t.columnMax;let d=0;for(;dp.c===i);return this.column(i,(d==null?void 0:d.layout)||t.layout),!0}return!1}compact(t="compact",r=!0){return this.engine.compact(t,r),this._triggerChangeEvent(),this}column(t,r="moveScale"){if(!t||t<1||this.opts.column===t)return this;const i=this.getColumn();return this.opts.column=t,this.engine?(this.engine.column=t,this.el.classList.remove("gs-"+i),this.el.classList.add("gs-"+t),this.engine.columnChanged(i,t,r),this._isAutoCellHeight&&this.cellHeight(),this.resizeToContentCheck(!0),this._ignoreLayoutsNodeChange=!0,this._triggerChangeEvent(),delete this._ignoreLayoutsNodeChange,this):this}getColumn(){return this.opts.column}getGridItems(){return Array.from(this.el.children).filter(t=>t.matches("."+this.opts.itemClass)&&!t.matches("."+this.opts.placeholderClass))}isIgnoreChangeCB(){return this._ignoreLayoutsNodeChange}destroy(t=!0){var r,i;if(this.el)return this.offAll(),this._updateResizeEvent(!0),this.setStatic(!0,!1),this.setAnimation(!1),t?this.el.parentNode.removeChild(this.el):(this.removeAll(t),this.el.classList.remove(this._styleSheetClass),this.el.removeAttribute("gs-current-row")),this._removeStylesheet(),(r=this.parentGridNode)==null||delete r.subGrid,delete this.parentGridNode,delete this.opts,(i=this._placeholder)==null||delete i.gridstackNode,delete this._placeholder,delete this.engine,delete this.el.gridstack,delete this.el,this}float(t){return this.opts.float!==t&&(this.opts.float=this.engine.float=t,this._triggerChangeEvent()),this}getFloat(){return this.engine.float}getCellFromPixel(t,r=!1){const i=this.el.getBoundingClientRect();let o;r?o={top:i.top+document.documentElement.scrollTop,left:i.left}:o={top:this.el.offsetTop,left:this.el.offsetLeft};const u=t.left-o.left,c=t.top-o.top,d=i.width/this.getColumn(),p=i.height/parseInt(this.el.getAttribute("gs-current-row"));return{x:Math.floor(u/d),y:Math.floor(c/p)}}getRow(){return Math.max(this.engine.getRow(),this.opts.minRow)}isAreaEmpty(t,r,i,o){return this.engine.isAreaEmpty(t,r,i,o)}makeWidget(t,r){const i=Ne.getElement(t);if(!i)return;i.parentElement||this.el.appendChild(i),this._prepareElement(i,!0,r);const o=i.gridstackNode;this._updateContainerHeight(),o.subGridOpts&&this.makeSubGrid(i,o.subGridOpts,void 0,!1);let u;return this.opts.column===1&&!this._ignoreLayoutsNodeChange&&(u=this._ignoreLayoutsNodeChange=!0),this._triggerAddEvent(),this._triggerChangeEvent(),u&&delete this._ignoreLayoutsNodeChange,i}on(t,r){return t.indexOf(" ")!==-1?(t.split(" ").forEach(o=>this.on(o,r)),this):(t==="change"||t==="added"||t==="removed"||t==="enable"||t==="disable"?(t==="enable"||t==="disable"?this._gsEventHandler[t]=o=>r(o):this._gsEventHandler[t]=o=>{o.detail&&r(o,o.detail)},this.el.addEventListener(t,this._gsEventHandler[t])):t==="drag"||t==="dragstart"||t==="dragstop"||t==="resizestart"||t==="resize"||t==="resizestop"||t==="dropped"||t==="resizecontent"?this._gsEventHandler[t]=r:console.error("GridStack.on("+t+") event not supported"),this)}off(t){return t.indexOf(" ")!==-1?(t.split(" ").forEach(i=>this.off(i)),this):((t==="change"||t==="added"||t==="removed"||t==="enable"||t==="disable")&&this._gsEventHandler[t]&&this.el.removeEventListener(t,this._gsEventHandler[t]),delete this._gsEventHandler[t],this)}offAll(){return Object.keys(this._gsEventHandler).forEach(t=>this.off(t)),this}removeWidget(t,r=!0,i=!0){return t?(Ne.getElements(t).forEach(o=>{if(o.parentElement&&o.parentElement!==this.el)return;let u=o.gridstackNode;u||(u=this.engine.nodes.find(c=>o===c.el)),u&&(r&&Ne.addRemoveCB&&Ne.addRemoveCB(this.el,u,!1,!1),delete o.gridstackNode,this._removeDD(o),this.engine.removeNode(u,r,i),r&&o.parentElement&&o.remove())}),i&&(this._triggerRemoveEvent(),this._triggerChangeEvent()),this):(console.error("Error: GridStack.removeWidget(undefined) called"),this)}removeAll(t=!0,r=!0){return this.engine.nodes.forEach(i=>{t&&Ne.addRemoveCB&&Ne.addRemoveCB(this.el,i,!1,!1),delete i.el.gridstackNode,this.opts.staticGrid||this._removeDD(i.el)}),this.engine.removeAll(t,r),r&&this._triggerRemoveEvent(),this}setAnimation(t=this.opts.animate,r){return r?setTimeout(()=>{this.opts&&this.setAnimation(t)}):t?this.el.classList.add("grid-stack-animate"):this.el.classList.remove("grid-stack-animate"),this}hasAnimationCSS(){return this.el.classList.contains("grid-stack-animate")}setStatic(t,r=!0,i=!0){return!!this.opts.staticGrid===t?this:(t?this.opts.staticGrid=!0:delete this.opts.staticGrid,this._setupRemoveDrop(),this._setupAcceptWidget(),this.engine.nodes.forEach(o=>{this.prepareDragDrop(o.el),o.subGrid&&i&&o.subGrid.setStatic(t,r,i)}),r&&this._setStaticClass(),this)}updateOptions(t){var i;const r=this.opts;return t.acceptWidgets!==void 0&&this._setupAcceptWidget(),t.animate!==void 0&&this.setAnimation(),t.cellHeight&&(this.cellHeight(t.cellHeight,!0),delete t.cellHeight),t.class&&t.class!==r.class&&(r.class&&this.el.classList.remove(r.class),this.el.classList.add(t.class)),typeof t.column=="number"&&!t.columnOpts&&(this.column(t.column),delete t.column),t.margin!==void 0&&this.margin(t.margin),t.staticGrid!==void 0&&this.setStatic(t.staticGrid),t.disableDrag!==void 0&&!t.staticGrid&&this.enableMove(!t.disableDrag),t.disableResize!==void 0&&!t.staticGrid&&this.enableResize(!t.disableResize),t.float!==void 0&&this.float(t.float),t.row!==void 0&&(r.minRow=r.maxRow=t.row),(i=t.children)!=null&&i.length&&(this.load(t.children),delete t.children),this.opts={...this.opts,...t},this}update(t,r){return Ne.getElements(t).forEach(i=>{var w;const o=i==null?void 0:i.gridstackNode;if(!o)return;const u={...A.copyPos({},o),...A.cloneDeep(r)};this.engine.nodeBoundFix(u),delete u.autoPosition;const c=["x","y","w","h"];let d;if(c.some(v=>u[v]!==void 0&&u[v]!==o[v])&&(d={},c.forEach(v=>{d[v]=u[v]!==void 0?u[v]:o[v],delete u[v]})),!d&&(u.minW||u.minH||u.maxW||u.maxH)&&(d={}),u.content!==void 0){const v=i.querySelector(".grid-stack-item-content");v&&v.textContent!==u.content&&(o.content=u.content,Ne.renderCB(v,u),(w=o.subGrid)!=null&&w.el&&(v.appendChild(o.subGrid.el),o.subGrid.opts.styleInHead||o.subGrid._updateStyles(!0))),delete u.content}let p=!1,m=!1;for(const v in u)v[0]!=="_"&&o[v]!==u[v]&&(o[v]=u[v],p=!0,m=m||!this.opts.staticGrid&&(v==="noResize"||v==="noMove"||v==="locked"));if(A.sanitizeMinMax(o),d){const v=d.w!==void 0&&d.w!==o.w;this.moveNode(o,d),v&&o.subGrid?o.subGrid.onResize(this.hasAnimationCSS()?o.w:void 0):this.resizeToContentCheck(v,o),delete o._orig}(d||p)&&this._writeAttr(i,o),m&&this.prepareDragDrop(o.el)}),this}moveNode(t,r){const i=t._updating;i||this.engine.cleanNodes().beginUpdate(t),this.engine.moveNode(t,r),this._updateContainerHeight(),i||(this._triggerChangeEvent(),this.engine.endUpdate())}resizeToContent(t){var x,z;if(!t||(t.classList.remove("size-to-content-max"),!t.clientHeight))return;const r=t.gridstackNode;if(!r)return;const i=r.grid;if(!i||t.parentElement!==i.el)return;const o=i.getCellHeight(!0);if(!o)return;let u=r.h?r.h*o:t.clientHeight,c;if(r.resizeToContentParent&&(c=t.querySelector(r.resizeToContentParent)),c||(c=t.querySelector(Ne.resizeToContentParent)),!c)return;const d=t.clientHeight-c.clientHeight,p=r.h?r.h*o-d:c.clientHeight;let m;if(r.subGrid){m=r.subGrid.getRow()*r.subGrid.getCellHeight(!0);const R=r.subGrid.el.getBoundingClientRect(),k=r.subGrid.el.parentElement.getBoundingClientRect();m+=R.top-k.top}else{if((z=(x=r.subGridOpts)==null?void 0:x.children)!=null&&z.length)return;{const R=c.firstElementChild;if(!R){console.error(`Error: GridStack.resizeToContent() widget id:${r.id} '${Ne.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return}m=R.getBoundingClientRect().height||p}}if(p===m)return;u+=m-p;let w=Math.ceil(u/o);const v=Number.isInteger(r.sizeToContent)?r.sizeToContent:0;v&&w>v&&(w=v,t.classList.add("size-to-content-max")),r.minH&&wr.maxH&&(w=r.maxH),w!==r.h&&(i._ignoreLayoutsNodeChange=!0,i.moveNode(r,{h:w}),delete i._ignoreLayoutsNodeChange)}resizeToContentCBCheck(t){Ne.resizeToContentCB?Ne.resizeToContentCB(t):this.resizeToContent(t)}rotate(t,r){return Ne.getElements(t).forEach(i=>{const o=i.gridstackNode;if(!A.canBeRotated(o))return;const u={w:o.h,h:o.w,minH:o.minW,minW:o.minH,maxH:o.maxW,maxW:o.maxH};if(r){const d=r.left>0?Math.floor(r.left/this.cellWidth()):0,p=r.top>0?Math.floor(r.top/this.opts.cellHeight):0;u.x=o.x+d-(o.h-(p+1)),u.y=o.y+p-d}Object.keys(u).forEach(d=>{u[d]===void 0&&delete u[d]});const c=o._orig;this.update(i,u),o._orig=c}),this}margin(t){if(!(typeof t=="string"&&t.split(" ").length>1)){const i=A.parseHeight(t);if(this.opts.marginUnit===i.unit&&this.opts.margin===i.h)return}return this.opts.margin=t,this.opts.marginTop=this.opts.marginBottom=this.opts.marginLeft=this.opts.marginRight=void 0,this._initMargin(),this._updateStyles(!0),this}getMargin(){return this.opts.margin}willItFit(t){if(arguments.length>1){console.warn("gridstack.ts: `willItFit(x,y,w,h,autoPosition)` is deprecated. Use `willItFit({x, y,...})`. It will be removed soon");const r=arguments;let i=0,o={x:r[i++],y:r[i++],w:r[i++],h:r[i++],autoPosition:r[i++]};return this.willItFit(o)}return this.engine.willItFit(t)}_triggerChangeEvent(){if(this.engine.batchMode)return this;const t=this.engine.getDirtyNodes(!0);return t&&t.length&&(this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(t),this._triggerEvent("change",t)),this.engine.saveInitial(),this}_triggerAddEvent(){var t;if(this.engine.batchMode)return this;if((t=this.engine.addedNodes)!=null&&t.length){this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(this.engine.addedNodes),this.engine.addedNodes.forEach(i=>{delete i._dirty});const r=[...this.engine.addedNodes];this.engine.addedNodes=[],this._triggerEvent("added",r)}return this}_triggerRemoveEvent(){var t;if(this.engine.batchMode)return this;if((t=this.engine.removedNodes)!=null&&t.length){const r=[...this.engine.removedNodes];this.engine.removedNodes=[],this._triggerEvent("removed",r)}return this}_triggerEvent(t,r){const i=r?new CustomEvent(t,{bubbles:!1,detail:r}):new Event(t);return this.el.dispatchEvent(i),this}_removeStylesheet(){if(this._styles){const t=this.opts.styleInHead?void 0:this.el.parentNode;A.removeStylesheet(this._styleSheetClass,t),delete this._styles}return this}_updateStyles(t=!1,r){if(t&&this._removeStylesheet(),r===void 0&&(r=this.getRow()),this._updateContainerHeight(),this.opts.cellHeight===0)return this;const i=this.opts.cellHeight,o=this.opts.cellHeightUnit,u=`.${this._styleSheetClass} > .${this.opts.itemClass}`;if(!this._styles){const c=this.opts.styleInHead?void 0:this.el.parentNode;if(this._styles=A.createStylesheet(this._styleSheetClass,c,{nonce:this.opts.nonce}),!this._styles)return this;this._styles._max=0,A.addCSSRule(this._styles,u,`height: ${i}${o}`);const d=this.opts.marginTop+this.opts.marginUnit,p=this.opts.marginBottom+this.opts.marginUnit,m=this.opts.marginRight+this.opts.marginUnit,w=this.opts.marginLeft+this.opts.marginUnit,v=`${u} > .grid-stack-item-content`,x=`.${this._styleSheetClass} > .grid-stack-placeholder > .placeholder-content`;A.addCSSRule(this._styles,v,`top: ${d}; right: ${m}; bottom: ${p}; left: ${w};`),A.addCSSRule(this._styles,x,`top: ${d}; right: ${m}; bottom: ${p}; left: ${w};`),A.addCSSRule(this._styles,`${u} > .ui-resizable-n`,`top: ${d};`),A.addCSSRule(this._styles,`${u} > .ui-resizable-s`,`bottom: ${p}`),A.addCSSRule(this._styles,`${u} > .ui-resizable-ne`,`right: ${m}; top: ${d}`),A.addCSSRule(this._styles,`${u} > .ui-resizable-e`,`right: ${m}`),A.addCSSRule(this._styles,`${u} > .ui-resizable-se`,`right: ${m}; bottom: ${p}`),A.addCSSRule(this._styles,`${u} > .ui-resizable-nw`,`left: ${w}; top: ${d}`),A.addCSSRule(this._styles,`${u} > .ui-resizable-w`,`left: ${w}`),A.addCSSRule(this._styles,`${u} > .ui-resizable-sw`,`left: ${w}; bottom: ${p}`)}if(r=r||this._styles._max,r>this._styles._max){const c=d=>i*d+o;for(let d=this._styles._max+1;d<=r;d++)A.addCSSRule(this._styles,`${u}[gs-y="${d}"]`,`top: ${c(d)}`),A.addCSSRule(this._styles,`${u}[gs-h="${d+1}"]`,`height: ${c(d+1)}`);this._styles._max=r}return this}_updateContainerHeight(){if(!this.engine||this.engine.batchMode)return this;const t=this.parentGridNode;let r=this.getRow()+this._extraDragRow;const i=this.opts.cellHeight,o=this.opts.cellHeightUnit;if(!i)return this;if(!t){const u=A.parseHeight(getComputedStyle(this.el).minHeight);if(u.h>0&&u.unit===o){const c=Math.floor(u.h/i);r1?t.setAttribute("gs-w",String(r.w)):t.removeAttribute("gs-w"),r.h>1?t.setAttribute("gs-h",String(r.h)):t.removeAttribute("gs-h"),this}_writeAttr(t,r){if(!r)return this;this._writePosAttr(t,r);const i={noResize:"gs-no-resize",noMove:"gs-no-move",locked:"gs-locked",id:"gs-id",sizeToContent:"gs-size-to-content"};for(const o in i)r[o]?t.setAttribute(i[o],String(r[o])):t.removeAttribute(i[o]);return this}_readAttr(t,r=!0){const i={};i.x=A.toNumber(t.getAttribute("gs-x")),i.y=A.toNumber(t.getAttribute("gs-y")),i.w=A.toNumber(t.getAttribute("gs-w")),i.h=A.toNumber(t.getAttribute("gs-h")),i.autoPosition=A.toBool(t.getAttribute("gs-auto-position")),i.noResize=A.toBool(t.getAttribute("gs-no-resize")),i.noMove=A.toBool(t.getAttribute("gs-no-move")),i.locked=A.toBool(t.getAttribute("gs-locked"));const o=t.getAttribute("gs-size-to-content");o&&(o==="true"||o==="false"?i.sizeToContent=A.toBool(o):i.sizeToContent=parseInt(o,10)),i.id=t.getAttribute("gs-id"),i.maxW=A.toNumber(t.getAttribute("gs-max-w")),i.minW=A.toNumber(t.getAttribute("gs-min-w")),i.maxH=A.toNumber(t.getAttribute("gs-max-h")),i.minH=A.toNumber(t.getAttribute("gs-min-h")),r&&(i.w===1&&t.removeAttribute("gs-w"),i.h===1&&t.removeAttribute("gs-h"),i.maxW&&t.removeAttribute("gs-max-w"),i.minW&&t.removeAttribute("gs-min-w"),i.maxH&&t.removeAttribute("gs-max-h"),i.minH&&t.removeAttribute("gs-min-h"));for(const u in i){if(!i.hasOwnProperty(u))return;!i[u]&&i[u]!==0&&u!=="gs-size-to-content"&&delete i[u]}return i}_setStaticClass(){const t=["grid-stack-static"];return this.opts.staticGrid?(this.el.classList.add(...t),this.el.setAttribute("gs-static","true")):(this.el.classList.remove(...t),this.el.removeAttribute("gs-static")),this}onResize(t=(r=>(r=this.el)==null?void 0:r.clientWidth)()){if(!t||this.prevWidth===t)return;this.prevWidth=t,this.batchUpdate();let i=!1;return this._autoColumn&&this.parentGridNode?this.opts.column!==this.parentGridNode.w&&(this.column(this.parentGridNode.w,this.opts.layout||"list"),i=!0):i=this.checkDynamicColumn(),this._isAutoCellHeight&&this.cellHeight(),this.engine.nodes.forEach(o=>{o.subGrid&&o.subGrid.onResize()}),this._skipInitialResize||this.resizeToContentCheck(i),delete this._skipInitialResize,this.batchUpdate(!1),this}resizeToContentCheck(t=!1,r=void 0){if(this.engine){if(t&&this.hasAnimationCSS())return setTimeout(()=>this.resizeToContentCheck(!1,r),this.animationDelay);if(r)A.shouldSizeToContent(r)&&this.resizeToContentCBCheck(r.el);else if(this.engine.nodes.some(i=>A.shouldSizeToContent(i))){const i=[...this.engine.nodes];this.batchUpdate(),i.forEach(o=>{A.shouldSizeToContent(o)&&this.resizeToContentCBCheck(o.el)}),this.batchUpdate(!1)}this._gsEventHandler.resizecontent&&this._gsEventHandler.resizecontent(null,r?[r]:this.engine.nodes)}}_updateResizeEvent(t=!1){const r=!this.parentGridNode&&(this._isAutoCellHeight||this.opts.sizeToContent||this.opts.columnOpts||this.engine.nodes.find(i=>i.sizeToContent));return!t&&r&&!this.resizeObserver?(this._sizeThrottle=A.throttle(()=>this.onResize(),this.opts.cellHeightThrottle),this.resizeObserver=new ResizeObserver(()=>this._sizeThrottle()),this.resizeObserver.observe(this.el),this._skipInitialResize=!0):(t||!r)&&this.resizeObserver&&(this.resizeObserver.disconnect(),delete this.resizeObserver,delete this._sizeThrottle),this}static getElement(t=".grid-stack-item"){return A.getElement(t)}static getElements(t=".grid-stack-item"){return A.getElements(t)}static getGridElement(t){return Ne.getElement(t)}static getGridElements(t){return A.getElements(t)}_initMargin(){let t,r=0,i=[];return typeof this.opts.margin=="string"&&(i=this.opts.margin.split(" ")),i.length===2?(this.opts.marginTop=this.opts.marginBottom=i[0],this.opts.marginLeft=this.opts.marginRight=i[1]):i.length===4?(this.opts.marginTop=i[0],this.opts.marginRight=i[1],this.opts.marginBottom=i[2],this.opts.marginLeft=i[3]):(t=A.parseHeight(this.opts.margin),this.opts.marginUnit=t.unit,r=this.opts.margin=t.h),this.opts.marginTop===void 0?this.opts.marginTop=r:(t=A.parseHeight(this.opts.marginTop),this.opts.marginTop=t.h,delete this.opts.margin),this.opts.marginBottom===void 0?this.opts.marginBottom=r:(t=A.parseHeight(this.opts.marginBottom),this.opts.marginBottom=t.h,delete this.opts.margin),this.opts.marginRight===void 0?this.opts.marginRight=r:(t=A.parseHeight(this.opts.marginRight),this.opts.marginRight=t.h,delete this.opts.margin),this.opts.marginLeft===void 0?this.opts.marginLeft=r:(t=A.parseHeight(this.opts.marginLeft),this.opts.marginLeft=t.h,delete this.opts.margin),this.opts.marginUnit=t.unit,this.opts.marginTop===this.opts.marginBottom&&this.opts.marginLeft===this.opts.marginRight&&this.opts.marginTop===this.opts.marginRight&&(this.opts.margin=this.opts.marginTop),this}static getDD(){return $n}static setupDragIn(t,r,i,o=document){(r==null?void 0:r.pause)!==void 0&&(Le.pauseDrag=r.pause),r={appendTo:"body",helper:"clone",...r||{}},(typeof t=="string"?A.getElements(t,o):t).forEach((c,d)=>{$n.isDraggable(c)||$n.dragIn(c,r),i!=null&&i[d]&&(c.gridstackNode=i[d])})}movable(t,r){return this.opts.staticGrid?this:(Ne.getElements(t).forEach(i=>{const o=i.gridstackNode;o&&(r?delete o.noMove:o.noMove=!0,this.prepareDragDrop(o.el))}),this)}resizable(t,r){return this.opts.staticGrid?this:(Ne.getElements(t).forEach(i=>{const o=i.gridstackNode;o&&(r?delete o.noResize:o.noResize=!0,this.prepareDragDrop(o.el))}),this)}disable(t=!0){if(!this.opts.staticGrid)return this.enableMove(!1,t),this.enableResize(!1,t),this._triggerEvent("disable"),this}enable(t=!0){if(!this.opts.staticGrid)return this.enableMove(!0,t),this.enableResize(!0,t),this._triggerEvent("enable"),this}enableMove(t,r=!0){return this.opts.staticGrid?this:(t?delete this.opts.disableDrag:this.opts.disableDrag=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&r&&i.subGrid.enableMove(t,r)}),this)}enableResize(t,r=!0){return this.opts.staticGrid?this:(t?delete this.opts.disableResize:this.opts.disableResize=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&r&&i.subGrid.enableResize(t,r)}),this)}cancelDrag(){var r;const t=(r=this._placeholder)==null?void 0:r.gridstackNode;t&&(t._isExternal?(t._isAboutToRemove=!0,this.engine.removeNode(t)):t._isAboutToRemove&&Ne._itemRemoving(t.el,!1),this.engine.restoreInitial())}_removeDD(t){return $n.draggable(t,"destroy").resizable(t,"destroy"),t.gridstackNode&&delete t.gridstackNode._initDD,delete t.ddElement,this}_setupAcceptWidget(){if(this.opts.staticGrid||!this.opts.acceptWidgets&&!this.opts.removable)return $n.droppable(this.el,"destroy"),this;let t,r;const i=(o,u,c)=>{var x;c=c||u;const d=c.gridstackNode;if(!d)return;if(!((x=d.grid)!=null&&x.el)){c.style.transform=`scale(${1/this.dragTransform.xScale},${1/this.dragTransform.yScale})`;const z=c.getBoundingClientRect();c.style.left=z.x+(this.dragTransform.xScale-1)*(o.clientX-z.x)/this.dragTransform.xScale+"px",c.style.top=z.y+(this.dragTransform.yScale-1)*(o.clientY-z.y)/this.dragTransform.yScale+"px",c.style.transformOrigin="0px 0px"}let{top:p,left:m}=c.getBoundingClientRect();const w=this.el.getBoundingClientRect();m-=w.left,p-=w.top;const v={position:{top:p*this.dragTransform.xScale,left:m*this.dragTransform.yScale}};if(d._temporaryRemoved){if(d.x=Math.max(0,Math.round(m/r)),d.y=Math.max(0,Math.round(p/t)),delete d.autoPosition,this.engine.nodeBoundFix(d),!this.engine.willItFit(d)){if(d.autoPosition=!0,!this.engine.willItFit(d)){$n.off(u,"drag");return}d._willFitPos&&(A.copyPos(d,d._willFitPos),delete d._willFitPos)}this._onStartMoving(c,o,v,d,r,t)}else this._dragOrResize(c,o,v,d,r,t)};return $n.droppable(this.el,{accept:o=>{const u=o.gridstackNode||this._readAttr(o,!1);if((u==null?void 0:u.grid)===this)return!0;if(!this.opts.acceptWidgets)return!1;let c=!0;if(typeof this.opts.acceptWidgets=="function")c=this.opts.acceptWidgets(o);else{const d=this.opts.acceptWidgets===!0?".grid-stack-item":this.opts.acceptWidgets;c=o.matches(d)}if(c&&u&&this.opts.maxRow){const d={w:u.w,h:u.h,minW:u.minW,minH:u.minH};c=this.engine.willItFit(d)}return c}}).on(this.el,"dropover",(o,u,c)=>{let d=(c==null?void 0:c.gridstackNode)||u.gridstackNode;if((d==null?void 0:d.grid)===this&&!d._temporaryRemoved)return!1;if(d!=null&&d._sidebarOrig&&(d.w=d._sidebarOrig.w,d.h=d._sidebarOrig.h),d!=null&&d.grid&&d.grid!==this&&!d._temporaryRemoved&&d.grid._leave(u,c),c=c||u,r=this.cellWidth(),t=this.getCellHeight(!0),!d){const w=c.getAttribute("data-gs-widget")||c.getAttribute("gridstacknode");if(w){try{d=JSON.parse(w)}catch{console.error("Gridstack dropover: Bad JSON format: ",w)}c.removeAttribute("data-gs-widget"),c.removeAttribute("gridstacknode")}d||(d=this._readAttr(c)),d._sidebarOrig={w:d.w,h:d.h}}d.grid||(d.el||(d={...d}),d._isExternal=!0,c.gridstackNode=d);const p=d.w||Math.round(c.offsetWidth/r)||1,m=d.h||Math.round(c.offsetHeight/t)||1;return d.grid&&d.grid!==this?(u._gridstackNodeOrig||(u._gridstackNodeOrig=d),u.gridstackNode=d={...d,w:p,h:m,grid:this},delete d.x,delete d.y,this.engine.cleanupNode(d).nodeBoundFix(d),d._initDD=d._isExternal=d._temporaryRemoved=!0):(d.w=p,d.h=m,d._temporaryRemoved=!0),Ne._itemRemoving(d.el,!1),$n.on(u,"drag",i),i(o,u,c),!1}).on(this.el,"dropout",(o,u,c)=>{const d=(c==null?void 0:c.gridstackNode)||u.gridstackNode;return d&&(!d.grid||d.grid===this)&&(this._leave(u,c),this._isTemp&&this.removeAsSubGrid(d)),!1}).on(this.el,"drop",(o,u,c)=>{var z,R,k;const d=(c==null?void 0:c.gridstackNode)||u.gridstackNode;if((d==null?void 0:d.grid)===this&&!d._isExternal)return!1;const p=!!this.placeholder.parentElement,m=u!==c;this.placeholder.remove(),delete this.placeholder.gridstackNode;const w=p&&this.opts.animate;w&&this.setAnimation(!1);const v=u._gridstackNodeOrig;if(delete u._gridstackNodeOrig,p&&(v!=null&&v.grid)&&v.grid!==this){const b=v.grid;b.engine.removeNodeFromLayoutCache(v),b.engine.removedNodes.push(v),b._triggerRemoveEvent()._triggerChangeEvent(),b.parentGridNode&&!b.engine.nodes.length&&b.opts.subGridDynamic&&b.removeAsSubGrid()}if(!d||(p&&(this.engine.cleanupNode(d),d.grid=this),(z=d.grid)==null||delete z._isTemp,$n.off(u,"drag"),c!==u?(c.remove(),u=c):u.remove(),this._removeDD(u),!p))return!1;const x=(k=(R=d.subGrid)==null?void 0:R.el)==null?void 0:k.gridstack;return A.copyPos(d,this._readAttr(this.placeholder)),A.removePositioningStyles(u),m&&(d.content||d.subGridOpts||Ne.addRemoveCB)?(delete d.el,u=this.addWidget(d)):(this._prepareElement(u,!0,d),this.el.appendChild(u),this.resizeToContentCheck(!1,d),x&&(x.parentGridNode=d,x.opts.styleInHead||x._updateStyles(!0)),this._updateContainerHeight()),this.engine.addedNodes.push(d),this._triggerAddEvent(),this._triggerChangeEvent(),this.engine.endUpdate(),this._gsEventHandler.dropped&&this._gsEventHandler.dropped({...o,type:"dropped"},v&&v.grid?v:void 0,d),w&&this.setAnimation(this.opts.animate,!0),!1}),this}static _itemRemoving(t,r){if(!t)return;const i=t?t.gridstackNode:void 0;!(i!=null&&i.grid)||t.classList.contains(i.grid.opts.removableOptions.decline)||(r?i._isAboutToRemove=!0:delete i._isAboutToRemove,r?t.classList.add("grid-stack-item-removing"):t.classList.remove("grid-stack-item-removing"))}_setupRemoveDrop(){if(typeof this.opts.removable!="string")return this;const t=document.querySelector(this.opts.removable);return t?(!this.opts.staticGrid&&!$n.isDroppable(t)&&$n.droppable(t,this.opts.removableOptions).on(t,"dropover",(r,i)=>Ne._itemRemoving(i,!0)).on(t,"dropout",(r,i)=>Ne._itemRemoving(i,!1)),this):this}prepareDragDrop(t,r=!1){const i=t==null?void 0:t.gridstackNode;if(!i)return;const o=i.noMove||this.opts.disableDrag,u=i.noResize||this.opts.disableResize,c=this.opts.staticGrid||o&&u;if((r||c)&&(i._initDD&&(this._removeDD(t),delete i._initDD),c&&t.classList.add("ui-draggable-disabled","ui-resizable-disabled"),!r))return this;if(!i._initDD){let d,p;const m=(x,z)=>{this._gsEventHandler[x.type]&&this._gsEventHandler[x.type](x,x.target),d=this.cellWidth(),p=this.getCellHeight(!0),this._onStartMoving(t,x,z,i,d,p)},w=(x,z)=>{this._dragOrResize(t,x,z,i,d,p)},v=x=>{this.placeholder.remove(),delete this.placeholder.gridstackNode,delete i._moving,delete i._event,delete i._lastTried;const z=i.w!==i._orig.w,R=x.target;if(!(!R.gridstackNode||R.gridstackNode.grid!==this)){if(i.el=R,i._isAboutToRemove){const k=t.gridstackNode.grid;k._gsEventHandler[x.type]&&k._gsEventHandler[x.type](x,R),k.engine.nodes.push(i),k.removeWidget(t,!0,!0)}else A.removePositioningStyles(R),i._temporaryRemoved?(A.copyPos(i,i._orig),this._writePosAttr(R,i),this.engine.addNode(i)):this._writePosAttr(R,i),this._gsEventHandler[x.type]&&this._gsEventHandler[x.type](x,R);this._extraDragRow=0,this._updateContainerHeight(),this._triggerChangeEvent(),this.engine.endUpdate(),x.type==="resizestop"&&(Number.isInteger(i.sizeToContent)&&(i.sizeToContent=i.h),this.resizeToContentCheck(z,i))}};$n.draggable(t,{start:m,stop:v,drag:w}).resizable(t,{start:m,stop:v,resize:w}),i._initDD=!0}return $n.draggable(t,o?"disable":"enable").resizable(t,u?"disable":"enable"),this}_onStartMoving(t,r,i,o,u,c){var d;if(this.engine.cleanNodes().beginUpdate(o),this._writePosAttr(this.placeholder,o),this.el.appendChild(this.placeholder),this.placeholder.gridstackNode=o,(d=o.grid)!=null&&d.el)this.dragTransform=A.getValuesFromTransformedElement(t);else if(this.placeholder&&this.placeholder.closest(".grid-stack")){const p=this.placeholder.closest(".grid-stack");this.dragTransform=A.getValuesFromTransformedElement(p)}else this.dragTransform={xScale:1,xOffset:0,yScale:1,yOffset:0};if(o.el=this.placeholder,o._lastUiPosition=i.position,o._prevYPix=i.position.top,o._moving=r.type==="dragstart",delete o._lastTried,r.type==="dropover"&&o._temporaryRemoved&&(this.engine.addNode(o),o._moving=!0),this.engine.cacheRects(u,c,this.opts.marginTop,this.opts.marginRight,this.opts.marginBottom,this.opts.marginLeft),r.type==="resizestart"){const p=this.getColumn()-o.x,m=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-o.y;$n.resizable(t,"option","minWidth",u*Math.min(o.minW||1,p)).resizable(t,"option","minHeight",c*Math.min(o.minH||1,m)).resizable(t,"option","maxWidth",u*Math.min(o.maxW||Number.MAX_SAFE_INTEGER,p)).resizable(t,"option","maxWidthMoveLeft",u*Math.min(o.maxW||Number.MAX_SAFE_INTEGER,o.x+o.w)).resizable(t,"option","maxHeight",c*Math.min(o.maxH||Number.MAX_SAFE_INTEGER,m)).resizable(t,"option","maxHeightMoveUp",c*Math.min(o.maxH||Number.MAX_SAFE_INTEGER,o.y+o.h))}}_dragOrResize(t,r,i,o,u,c){const d={...o._orig};let p,m=this.opts.marginLeft,w=this.opts.marginRight,v=this.opts.marginTop,x=this.opts.marginBottom;const z=Math.round(c*.1),R=Math.round(u*.1);if(m=Math.min(m,R),w=Math.min(w,R),v=Math.min(v,z),x=Math.min(x,z),r.type==="drag"){if(o._temporaryRemoved)return;const b=i.position.top-o._prevYPix;o._prevYPix=i.position.top,this.opts.draggable.scroll!==!1&&A.updateScrollPosition(t,i.position,b);const U=i.position.left+(i.position.left>o._lastUiPosition.left?-w:m),P=i.position.top+(i.position.top>o._lastUiPosition.top?-x:v);d.x=Math.round(U/u),d.y=Math.round(P/c);const W=this._extraDragRow;if(this.engine.collide(o,d)){const V=this.getRow();let Z=Math.max(0,d.y+o.h-V);this.opts.maxRow&&V+Z>this.opts.maxRow&&(Z=Math.max(0,this.opts.maxRow-V)),this._extraDragRow=Z}else this._extraDragRow=0;if(this._extraDragRow!==W&&this._updateContainerHeight(),o.x===d.x&&o.y===d.y)return}else if(r.type==="resize"){if(d.x<0||(A.updateScrollResize(r,t,c),d.w=Math.round((i.size.width-m)/u),d.h=Math.round((i.size.height-v)/c),o.w===d.w&&o.h===d.h)||o._lastTried&&o._lastTried.w===d.w&&o._lastTried.h===d.h)return;const b=i.position.left+m,U=i.position.top+v;d.x=Math.round(b/u),d.y=Math.round(U/c),p=!0}o._event=r,o._lastTried=d;const k={x:i.position.left+m,y:i.position.top+v,w:(i.size?i.size.width:o.w*u)-m-w,h:(i.size?i.size.height:o.h*c)-v-x};if(this.engine.moveNodeCheck(o,{...d,cellWidth:u,cellHeight:c,rect:k,resizing:p})){o._lastUiPosition=i.position,this.engine.cacheRects(u,c,v,w,x,m),delete o._skipDown,p&&o.subGrid&&o.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();const b=r.target;o._sidebarOrig||this._writePosAttr(b,o),this._gsEventHandler[r.type]&&this._gsEventHandler[r.type](r,b)}}_leave(t,r){r=r||t;const i=r.gridstackNode;if(!i||(r.style.transform=r.style.transformOrigin=null,$n.off(t,"drag"),i._temporaryRemoved))return;i._temporaryRemoved=!0,this.engine.removeNode(i),i.el=i._isExternal&&r?r:t;const o=i._sidebarOrig;i._isExternal&&this.engine.cleanupNode(i),i._sidebarOrig=o,this.opts.removable===!0&&Ne._itemRemoving(t,!0),t._gridstackNodeOrig?(t.gridstackNode=t._gridstackNodeOrig,delete t._gridstackNodeOrig):i._isExternal&&this.engine.restoreInitial()}commit(){return _S(this,this.batchUpdate(!1),"commit","batchUpdate","5.2"),this}}Ne.renderCB=(l,t)=>{l&&(t!=null&&t.content)&&(l.textContent=t.content)};Ne.resizeToContentParent=".grid-stack-item-content";Ne.Utils=A;Ne.Engine=ai;Ne.GDRev="11.5.1";function RS({widget:l,onRemove:t}){const r=gS[l.kind];return B.jsxs("div",{className:"widget",children:[B.jsxs("div",{className:"widget-header",children:[B.jsx("span",{className:"widget-grip","aria-hidden":!0,children:"⠿"}),B.jsx("span",{className:"widget-icon",children:r==null?void 0:r.icon}),B.jsx("span",{className:"widget-title",children:(r==null?void 0:r.title)||l.kind}),B.jsx("button",{className:"widget-close",title:"Remove widget",onClick:t,children:"×"})]}),B.jsx("div",{className:"widget-body",children:r?r.render(l.id):null})]})}function NS(){const l=Eo(w=>w.widgets),t=Eo(w=>w.updateGeom),r=Eo(w=>w.removeWidget),i=j.useRef(null),o=j.useRef(null),u=j.useRef(new Map),[c,d]=j.useState(new Map),[p,m]=j.useState(!1);return j.useEffect(()=>{if(!i.current)return;const w=Ne.init({column:12,cellHeight:56,margin:8,float:!0,handle:".widget-header",resizable:{handles:"e, se, s, sw, w"},animate:!0},i.current);return o.current=w,w.on("change",(v,x)=>{const z=x.map(R=>({id:String(R.id),x:R.x??0,y:R.y??0,w:R.w??1,h:R.h??1}));z.length&&t(z)}),m(!0),()=>{w.destroy(!1),o.current=null}},[t]),j.useEffect(()=>{const w=o.current;if(!w||!p)return;const v=new Set(l.map(R=>R.id));let x=!1;const z=new Map(c);w.batchUpdate();for(const R of l){if(u.current.has(R.id))continue;const k=w.addWidget({x:R.x,y:R.y,w:R.w,h:R.h,id:R.id}),b=k.querySelector(".grid-stack-item-content");u.current.set(R.id,k),z.set(R.id,b),x=!0}for(const[R,k]of Array.from(u.current.entries()))v.has(R)||(w.removeWidget(k,!0),u.current.delete(R),z.delete(R),x=!0);w.commit(),x&&d(z)},[l,p]),B.jsxs("div",{className:"canvas",children:[B.jsx("div",{className:"grid-stack",ref:i}),l.map(w=>{const v=c.get(w.id);return v?bs.createPortal(B.jsx(RS,{widget:w,onRemove:()=>r(w.id)}),v,w.id):null})]})}function DS(){const l=gn(d=>d.addSignalToPlot),t=gn(d=>d.setMotorTypes),[r,i]=j.useState(null),o=ly(sy($f,{activationConstraint:{distance:4}}));j.useEffect(()=>{Im(),F1().then(t)},[t]);const u=d=>{var m;const p=(m=d.active.data.current)==null?void 0:m.signalId;i(p?If(p):null)},c=d=>{var w,v,x,z;i(null);const p=(w=d.active.data.current)==null?void 0:w.signalId,m=((x=(v=d.over)==null?void 0:v.id)==null?void 0:x.toString())||"";if(p&&m.startsWith("plot:")){const R=(z=d.over.data.current)==null?void 0:z.panelId;l(R,p)}};return B.jsxs(r0,{sensors:o,onDragStart:u,onDragEnd:c,children:[B.jsxs("div",{className:"app",children:[B.jsx(yS,{}),B.jsxs("div",{className:"body",children:[B.jsx(xS,{}),B.jsx("main",{className:"canvas-host",children:B.jsx(NS,{})})]})]}),B.jsx(E0,{dropAnimation:null,children:r?B.jsx("div",{className:"drag-ghost",children:r}):null})]})}vS();$v.createRoot(document.getElementById("root")).render(B.jsx(ht.StrictMode,{children:B.jsx(DS,{})})); diff --git a/damiao_motor/gui/webapp/dist/index.html b/damiao_motor/gui/webapp/dist/index.html index 19b5309..eff6602 100644 --- a/damiao_motor/gui/webapp/dist/index.html +++ b/damiao_motor/gui/webapp/dist/index.html @@ -4,7 +4,7 @@ DaMiao Monitor - + diff --git a/damiao_motor/gui/webapp/src/lib/format.ts b/damiao_motor/gui/webapp/src/lib/format.ts index c100813..9031762 100644 --- a/damiao_motor/gui/webapp/src/lib/format.ts +++ b/damiao_motor/gui/webapp/src/lib/format.ts @@ -23,6 +23,22 @@ export function signalColor(sig: { field: string; source: string }): string { return sig.source === "cmd" ? lighten(base, 0.15) : base; } +export function withAlpha(hex: string, a: number): string { + const c = hex.replace("#", ""); + const r = parseInt(c.slice(0, 2), 16); + const g = parseInt(c.slice(2, 4), 16); + const b = parseInt(c.slice(4, 6), 16); + return `rgba(${r},${g},${b},${a})`; +} + +/** Plot stroke style: actual = bold solid; command = fainter, thinner "ghost" of the same hue. */ +export function seriesStyle(sig: { field: string; source: string }): { stroke: string; width: number } { + const base = fieldColor(sig.field); + return sig.source === "cmd" + ? { stroke: withAlpha(base, 0.45), width: 1.25 } + : { stroke: base, width: 1.85 }; +} + export function signalLabel(sig: SignalDescriptor): string { return `m${sig.motorId} ${sig.source}.${sig.field}`; } diff --git a/damiao_motor/gui/webapp/src/panels/PlotPanel.tsx b/damiao_motor/gui/webapp/src/panels/PlotPanel.tsx index cf90c57..79040a7 100644 --- a/damiao_motor/gui/webapp/src/panels/PlotPanel.tsx +++ b/damiao_motor/gui/webapp/src/panels/PlotPanel.tsx @@ -11,7 +11,7 @@ import { unsubscribeSignal, } from "../lib/dataStore"; import { fetchSnapshot } from "../lib/ws"; -import { isCmd, shortSignal, signalColor } from "../lib/format"; +import { isCmd, shortSignal, seriesStyle } from "../lib/format"; const MAX_X = 2000; // cap aligned x points per frame @@ -72,12 +72,11 @@ export default function PlotPanel({ panelId }: { panelId: string }) { { label: "t" }, ...signals.map((id) => { const d = descById.get(id); - const color = d ? signalColor(d) : "#8b949e"; + const style = d ? seriesStyle(d) : { stroke: "#8b949e", width: 1.5 }; return { label: shortSignal(id), - stroke: color, - width: 1.5, - dash: isCmd(id) ? [6, 4] : undefined, + stroke: style.stroke, + width: style.width, points: { show: false }, } as uPlot.Series; }), @@ -178,9 +177,13 @@ export default function PlotPanel({ panelId }: { panelId: string }) {
{signals.map((id) => { const d = descById.get(id); + const style = d ? seriesStyle(d) : { stroke: "#555" }; return ( - - + + {shortSignal(id)} From f7d3941fc16b8436b6191b2063aaa4d76f8f5a5d Mon Sep 17 00:00:00 2001 From: Jia Xie Date: Mon, 15 Jun 2026 20:38:16 -0700 Subject: [PATCH 11/14] feat(studio): unified Control/Monitor backend (one server, shared store) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - monitor/control.py: ControlService wraps DaMiaoController; connect/scan/enable/disable/ command(4 modes)/set-zero/clear-error/store-params/registers(GET+PUT w/ ms + ID changes)/ motor-type. Pushes cmd+feedback into the shared SignalStore so the same plots/table/cards visualize active control (offset-agnostic). Transmits only in control mode. - monitor/server.py: unified Studio server. Two modes — monitor (passive listener) and control (ControlService) feeding ONE shared store. /api/mode switch, /api/connect, gated /api/control/*, shared /api/monitor/{signals,snapshot,stream}. Control endpoints 409 in monitor mode (passivity preserved structurally). Verified: demo monitor (33 signals/3 motors), control gating, mode switch, graceful connect failure, register table — all green. Co-Authored-By: Claude Opus 4.8 (1M context) --- damiao_motor/monitor/control.py | 242 ++++++++++++++++ damiao_motor/monitor/server.py | 482 ++++++++++++++++++++++++-------- 2 files changed, 604 insertions(+), 120 deletions(-) create mode 100644 damiao_motor/monitor/control.py diff --git a/damiao_motor/monitor/control.py b/damiao_motor/monitor/control.py new file mode 100644 index 0000000..8ebac55 --- /dev/null +++ b/damiao_motor/monitor/control.py @@ -0,0 +1,242 @@ +"""Active control service for the unified Control/Monitor UI. + +Wraps a :class:`~damiao_motor.core.controller.DaMiaoController` and, on every command and +state read, pushes the commanded values and the motor feedback into the shared +:class:`~damiao_motor.monitor.store.SignalStore` so the same realtime plots/table/cards +visualize what *we* are driving. This is offset-agnostic (the controller routes feedback +by the logical id in ``data[0]``), unlike the passive listener used in monitor mode. + +This module CAN transmit — it is only ever instantiated in Control mode. +""" + +from __future__ import annotations + +import time +from typing import Any, Dict, List, Optional + +from damiao_motor.core.controller import DaMiaoController +from damiao_motor.core.motor import REGISTER_TABLE +from damiao_motor.monitor.decode import KIND_COMMAND, KIND_FEEDBACK, DecodedFrame +from damiao_motor.monitor.store import SignalStore + +TIMEOUT_REGISTER_ID = 9 +TIMEOUT_UNITS_PER_MS = 20.0 + +# command-mode -> the cmd field names the store/plots expect (match decode.py) +_CONTROL_MODES = {"MIT", "POS_VEL", "VEL", "FORCE_POS"} + + +class ControlService: + def __init__(self, store: SignalStore, raw_push=None) -> None: + self.store = store + self._raw_push = raw_push + self.controller: Optional[DaMiaoController] = None + self.channel: Optional[str] = None + self.bustype: str = "socketcan" + self.bitrate: Optional[int] = None + self.connected = False + self.error: Optional[str] = None + + # ------------------------------------------------------------- lifecycle + def connect(self, channel: str, bustype: str = "socketcan", bitrate: Optional[int] = None) -> None: + self.disconnect() + self.controller = DaMiaoController(channel=channel, bustype=bustype, bitrate=bitrate) + self.channel, self.bustype, self.bitrate = channel, bustype, bitrate + self.connected = True + self.error = None + + def disconnect(self) -> None: + if self.controller is not None: + try: + self.controller.shutdown() + except Exception: + pass + self.controller = None + self.connected = False + + def _require(self): + if self.controller is None: + raise RuntimeError("Not connected") + return self.controller + + # ---------------------------------------------------------------- scan + def scan(self, motor_type: str, settle: float = 0.5) -> List[Dict[str, Any]]: + c = self._require() + c.motors = {} + c._motors_by_feedback = {} + c.flush_bus() + for motor_id in range(0x01, 0x11): + try: + m = c.add_motor(motor_id=motor_id, feedback_id=0x00, motor_type=motor_type) + m.send_cmd_mit(0.0, 0.0, 0.0, 0.0, 0.0) + except ValueError: + pass + except Exception: + pass + found: List[Dict[str, Any]] = [] + responded = set() + t0 = time.perf_counter() + while time.perf_counter() - t0 < settle: + c.poll_feedback() + for mid, m in c.motors.items(): + if m.state and m.state.get("can_id") is not None and mid not in responded: + responded.add(mid) + found.append({"id": mid, "arb_id": m.state.get("arbitration_id") or 0, + "motor_type": m.motor_type}) + self._push_feedback(mid, m.get_states()) + time.sleep(0.01) + # keep only responders + c.motors = {f["id"]: c.motors[f["id"]] for f in found} + return found + + def motors(self) -> List[Dict[str, Any]]: + c = self._require() + return [{"id": mid, "motor_type": m.motor_type} for mid, m in sorted(c.motors.items())] + + # ---------------------------------------------------------- store feed + def _push_command(self, motor_id: int, mode: str, fields: Dict[str, float]) -> None: + fr = DecodedFrame(t=time.time(), arbitration_id=motor_id, kind=KIND_COMMAND, + motor_id=motor_id, raw=b"", mode=mode, fields=fields) + self.store.ingest(fr) + if self._raw_push: + self._raw_push(fr) + + def _push_feedback(self, motor_id: int, state: Dict[str, Any]) -> None: + if not state: + return + fields = { + "pos": float(state.get("pos", 0.0)), + "vel": float(state.get("vel", 0.0)), + "torque": float(state.get("torq", 0.0)), + "t_mos": float(state.get("t_mos", 0.0)), + "t_rotor": float(state.get("t_rotor", 0.0)), + "status_code": float(state.get("status_code", 0)), + } + fr = DecodedFrame(t=time.time(), arbitration_id=motor_id + 16, kind=KIND_FEEDBACK, + motor_id=motor_id, raw=b"", fields=fields, + note=str(state.get("status", ""))) + self.store.ingest(fr) + if self._raw_push: + self._raw_push(fr) + + # ------------------------------------------------------------- actions + def enable(self, motor_id: int) -> None: + self._require().motors[motor_id].enable() + + def disable(self, motor_id: int) -> None: + m = self._require().motors[motor_id] + m.set_zero_command() + m.disable() + + def set_zero(self, motor_id: int) -> None: + self._require().motors[motor_id].set_zero_position() + + def clear_error(self, motor_id: int) -> None: + self._require().motors[motor_id].clear_error() + + def store_parameters(self, motor_id: int) -> None: + self._require().motors[motor_id].store_parameters() + + def set_motor_type(self, motor_id: int, motor_type: str) -> None: + self._require().motors[motor_id].set_motor_type(motor_type) + + def command(self, motor_id: int, data: Dict[str, Any]) -> Dict[str, Any]: + c = self._require() + m = c.motors[motor_id] + mode = data.get("control_mode", "MIT") + pos = float(data.get("target_position", 0.0)) + vel = float(data.get("target_velocity", 0.0)) + kp = float(data.get("stiffness", 0.0)) + kd = float(data.get("damping", 0.0)) + tau = float(data.get("feedforward_torque", 0.0)) + vlim = float(data.get("velocity_limit", 0.0)) + tlim = float(data.get("torque_limit_ratio", 0.0)) + + if mode == "MIT": + m.send_cmd_mit(pos, vel, kp, kd, tau) + self._push_command(motor_id, "MIT", + {"pos": pos, "vel": vel, "kp": kp, "kd": kd, "torque": tau}) + elif mode == "POS_VEL": + m.send_cmd_pos_vel(pos, vel) + self._push_command(motor_id, "POS_VEL", {"pos": pos, "vel_limit": vel}) + elif mode == "VEL": + m.send_cmd_vel(vel) + self._push_command(motor_id, "VEL", {"vel": vel}) + elif mode == "FORCE_POS": + m.send_cmd_force_pos(pos, vlim, tlim) + self._push_command(motor_id, "FORCE_POS", + {"pos": pos, "vel_limit": vlim, "torque_limit_ratio": tlim}) + else: + raise ValueError(f"Unknown control_mode: {mode}") + + c.poll_feedback() + state = m.get_states() + self._push_feedback(motor_id, state) + return state + + def get_state(self, motor_id: int) -> Dict[str, Any]: + c = self._require() + c.poll_feedback() + state = c.motors[motor_id].get_states() + self._push_feedback(motor_id, state) + return state + + # ------------------------------------------------------------ registers + def get_registers(self, motor_id: int) -> Dict[str, Any]: + m = self._require().motors[motor_id] + regs = m.read_all_registers(timeout=0.05) + clean: Dict[int, Any] = {} + for rid, value in regs.items(): + if isinstance(value, str) and value.startswith("ERROR"): + continue + if rid == TIMEOUT_REGISTER_ID: + clean[rid] = float(value) / TIMEOUT_UNITS_PER_MS + else: + clean[rid] = value + return {"registers": clean, "motor_type": m.motor_type} + + def set_register(self, motor_id: int, rid: int, value: Any) -> Dict[str, Any]: + c = self._require() + m = c.motors[motor_id] + updated_ids: Dict[str, int] = {} + + if rid == TIMEOUT_REGISTER_ID: + units = int(round(float(value) * TIMEOUT_UNITS_PER_MS)) + if units < 0: + raise ValueError("Timeout must be >= 0 ms") + m.write_register(rid, units) + else: + m.write_register(rid, value) + + if rid == 7: # MST_ID / feedback id + new_fb = int(value) + old_fb = m.feedback_id + m.feedback_id = new_fb + if old_fb in c._motors_by_feedback: + del c._motors_by_feedback[old_fb] + c._motors_by_feedback[new_fb] = m + updated_ids["feedback_id"] = new_fb + elif rid == 8: # ESC_ID / receive (motor) id + new_id = int(value) + old_id = m.motor_id + m.motor_id = new_id + if old_id in c.motors: + del c.motors[old_id] + c.motors[new_id] = m + updated_ids["motor_id"] = new_id + + if rid in (7, 8): + try: + m.store_parameters() + except Exception: + pass + + return {"updated_ids": updated_ids} + + @staticmethod + def register_table() -> List[Dict[str, Any]]: + return [ + {"rid": r.rid, "variable": r.variable, "description": r.description, + "access": r.access, "range_str": r.range_str, "data_type": r.data_type} + for r in REGISTER_TABLE.values() + ] diff --git a/damiao_motor/monitor/server.py b/damiao_motor/monitor/server.py index d9e522d..f689477 100644 --- a/damiao_motor/monitor/server.py +++ b/damiao_motor/monitor/server.py @@ -1,16 +1,15 @@ -"""Flask server for the passive monitor dashboard. - -Exposes a small REST surface plus a WebSocket stream (via ``flask-sock``) and serves the -built single-page app. The server is strictly passive — it only ever reads from the bus. - -Routes: - GET /api/monitor/status service + listener status - GET /api/monitor/signals registry: signals, cmd<->fb pairs, motor views - GET /api/monitor/snapshot?signals=&n= last-N samples (history backfill for a panel) - GET /api/monitor/motor-types known motor-type names - POST /api/monitor/motor-type {motorId, motorType} -> rescale decode for a motor - WS /api/monitor/stream realtime samples / motors / raw frames - GET / the SPA (built assets) or a dev placeholder +"""Unified Flask server for the DaMiao Studio UI (Control + Monitor). + +One app, one shared signal store, two modes: + +* **monitor** — passive listen-only: a :class:`PassiveCanListener` decodes another + controller's commands + the motors' feedback into the store. Never transmits. +* **control** — active: a :class:`ControlService` (DaMiaoController) connects/scans and + drives motors; every command + feedback is pushed into the same store, so the realtime + plots/table/cards show what we're driving. + +Visualization endpoints (signals / snapshot / WS stream) read the shared store and work in +both modes. Control endpoints are gated to control mode. """ from __future__ import annotations @@ -18,81 +17,244 @@ import json import logging import os +import sys import time -from typing import Optional +from collections import deque +from typing import Any, Deque, Dict, List, Optional, Tuple from flask import Flask, jsonify, request, send_from_directory from flask_sock import Sock -from damiao_motor.monitor.service import MonitorService +from damiao_motor.monitor.control import ControlService +from damiao_motor.monitor.decode import DEFAULT_FEEDBACK_OFFSET, DEFAULT_MOTOR_TYPE +from damiao_motor.monitor.listener import PassiveCanListener +from damiao_motor.monitor.service import _frame_to_log +from damiao_motor.monitor.store import SignalStore _WEBAPP_DIST = os.path.normpath( os.path.join(os.path.dirname(__file__), "..", "gui", "webapp", "dist") ) - -# Per-tick safety cap on samples streamed per signal (decimation for very high rates). _MAX_POINTS_PER_TICK = 240 _DEV_PLACEHOLDER = """ -DaMiao Monitor -

DaMiao Monitor

The dashboard bundle has not been built yet.

-

For development, run the Vite dev server:

-
cd damiao_motor/gui/webapp && npm install && npm run dev
-

and open the URL it prints (it proxies the API + WebSocket back here).

-

For a production bundle: npm run build, then reload this page.

-

The REST API is live now at /api/monitor/status.

""" - - -def create_app(service: MonitorService) -> Flask: +DaMiao Studio +

DaMiao Studio

The dashboard bundle has not been built yet.

+
cd damiao_motor/gui/webapp && npm install && npm run build
+

The REST API is live at /api/status.

""" + + +class Studio: + """Holds the shared store + the active mode's data source.""" + + def __init__(self, mode: str = "monitor", feedback_offset: int = DEFAULT_FEEDBACK_OFFSET, + default_motor_type: str = DEFAULT_MOTOR_TYPE, raw_log_size: int = 4000) -> None: + self.mode = mode # 'monitor' | 'control' + self.feedback_offset = feedback_offset + self.default_motor_type = default_motor_type + self.store = SignalStore(bus_name="bus") + self._raw: Deque[Dict[str, Any]] = deque(maxlen=raw_log_size) + self._raw_seq = 0 + self.listener: Optional[PassiveCanListener] = None + self._demo_source = None + self.control = ControlService(self.store, raw_push=self._raw_push) + self.channel: Optional[str] = None + self.bustype: str = "socketcan" + self.demo = False + self.error: Optional[str] = None + + # ------------------------------------------------------------- raw log + def _raw_push(self, frame) -> None: + self._raw_seq += 1 + self._raw.append(_frame_to_log(self._raw_seq, frame)) + + def raw_since(self, since_seq: int, limit: int = 400) -> Tuple[int, List[Dict[str, Any]]]: + if not self._raw: + return since_seq, [] + items = [r for r in self._raw if r["seq"] > since_seq] + if len(items) > limit: + items = items[-limit:] + return (items[-1]["seq"] if items else since_seq), items + + # ------------------------------------------------------------- sources + def _on_passive_frame(self, frame) -> None: + self.store.ingest(frame) + self._raw_push(frame) + + def connect(self, channel: str, bustype: str, bitrate: Optional[int], + motor_type: Optional[str] = None, feedback_offset: Optional[int] = None) -> Dict[str, Any]: + self.disconnect() + self.error = None + self.channel, self.bustype = channel, bustype + if feedback_offset is not None: + self.feedback_offset = feedback_offset + if self.mode == "control": + self.control.connect(channel, bustype, bitrate) + found = self.control.scan(motor_type or self.default_motor_type) + return {"motors": found} + else: + self.listener = PassiveCanListener( + channel=channel, bustype=bustype, bitrate=bitrate, + feedback_offset=self.feedback_offset, + default_motor_type=motor_type or self.default_motor_type, + on_frame=self._on_passive_frame, + ) + self.listener.start() + return {"motors": []} + + def disconnect(self) -> None: + if self.listener is not None: + self.listener.stop() + self.listener = None + if self._demo_source is not None: + self._demo_source.stop() + self._demo_source = None + self.control.disconnect() + + def start_demo(self) -> None: + from damiao_motor.monitor.demo import DemoSource + + self.demo = True + self.channel = "demo" + self._demo_source = DemoSource(on_frame=self._on_passive_frame, bus_name="bus") + self._demo_source.start() + + def set_mode(self, mode: str) -> None: + if mode not in ("monitor", "control"): + raise ValueError("mode must be 'monitor' or 'control'") + self.disconnect() + self.mode = mode + self.demo = False + + # ------------------------------------------------------------- readouts + def status(self) -> Dict[str, Any]: + connected = (self.mode == "control" and self.control.connected) or ( + self.listener is not None) or (self._demo_source is not None) + return { + "mode": self.mode, + "connected": connected, + "channel": self.channel, + "bustype": self.bustype, + "demo": self.demo, + "listenOnly": bool(self.listener and self.listener.listen_only_applied), + "framesSeen": self.listener.frames_seen if self.listener else self._raw_seq, + "decodeErrors": self.listener.decode_errors if self.listener else 0, + "feedbackOffset": self.feedback_offset, + "defaultMotorType": self.default_motor_type, + "registryVersion": self.store.registry_version, + "error": self.control.error or self.error, + } + + def signals(self) -> Dict[str, Any]: + return {"signals": self.store.list_signals(), "pairs": self.store.pairs(), + "motors": self.store.motor_views(), "version": self.store.registry_version} + + def snapshot(self, ids: List[str], n: int) -> Dict[str, List[Tuple[float, float]]]: + return {sid: self.store.series_last_n(sid, n) for sid in ids} + + +def _platform_defaults() -> Dict[str, Any]: + is_mac = sys.platform == "darwin" + return {"platform": sys.platform, + "default_bustype": "gs_usb" if is_mac else "socketcan", + "default_channel": "0" if is_mac else "can0"} + + +def create_app(studio: Studio) -> Flask: app = Flask(__name__) sock = Sock(app) - app.config["service"] = service - # ------------------------------------------------------------------ REST - @app.route("/api/monitor/status") + def control_guard(): + if studio.mode != "control": + return jsonify({"success": False, "error": "Not in control mode"}), 409 + if not studio.control.connected: + return jsonify({"success": False, "error": "Not connected"}), 400 + return None + + # ----------------------------------------------------------- common + @app.route("/api/status") def status(): - return jsonify(service.status()) + return jsonify(studio.status()) + + @app.route("/api/mode", methods=["POST"]) + def set_mode(): + data = request.get_json(force=True, silent=True) or {} + try: + studio.set_mode(str(data.get("mode"))) + except ValueError as e: + return jsonify({"success": False, "error": str(e)}), 400 + return jsonify({"success": True, "mode": studio.mode}) + + @app.route("/api/connect", methods=["POST"]) + def connect(): + data = request.get_json(force=True, silent=True) or {} + channel = data.get("channel", "can0") + bustype = data.get("bustype", "socketcan") + bitrate = data.get("bitrate") + bitrate = int(bitrate) if bitrate not in (None, "") else None + try: + res = studio.connect(channel, bustype, bitrate, + motor_type=data.get("motor_type"), + feedback_offset=data.get("feedback_offset")) + return jsonify({"success": True, **res}) + except Exception as e: + studio.error = str(e) + return jsonify({"success": False, "error": str(e)}), 500 + @app.route("/api/disconnect", methods=["POST"]) + def disconnect(): + studio.disconnect() + return jsonify({"success": True}) + + @app.route("/api/platform") + def platform(): + return jsonify({"success": True, **_platform_defaults()}) + + @app.route("/api/motor-types") + def motor_types(): + from damiao_motor.monitor.decode import MONITOR_MOTOR_PRESETS + return jsonify({"types": sorted(MONITOR_MOTOR_PRESETS.keys())}) + + @app.route("/api/register-table") + def register_table(): + return jsonify({"success": True, "registers": ControlService.register_table()}) + + @app.route("/api/can-interfaces") + def can_interfaces(): + bustype = request.args.get("bustype", "socketcan") + interfaces: List[str] = [] + if bustype != "gs_usb": + try: + net = "/sys/class/net" + if os.path.isdir(net): + interfaces = sorted(n for n in os.listdir(net) if n.startswith("can")) + except OSError: + pass + return jsonify({"success": True, "interfaces": interfaces}) + + # ----------------------------------------------------- visualization @app.route("/api/monitor/signals") def signals(): - return jsonify(service.signals()) + return jsonify(studio.signals()) @app.route("/api/monitor/snapshot") def snapshot(): - raw = request.args.get("signals", "") - ids = [s for s in raw.split(",") if s] + ids = [s for s in request.args.get("signals", "").split(",") if s] n = int(request.args.get("n", 600)) - return jsonify(service.snapshot(ids, n)) - - @app.route("/api/monitor/motor-types") - def motor_types(): - return jsonify({"types": service.available_motor_types()}) + return jsonify(studio.snapshot(ids, n)) - @app.route("/api/monitor/motor-type", methods=["POST"]) - def set_motor_type(): - data = request.get_json(force=True, silent=True) or {} - try: - motor_id = int(data["motorId"]) - motor_type = str(data["motorType"]) - except (KeyError, ValueError, TypeError): - return jsonify({"success": False, "error": "motorId and motorType required"}), 400 - service.set_motor_type(motor_id, motor_type) - return jsonify({"success": True}) - - # ------------------------------------------------------------- WebSocket @sock.route("/api/monitor/stream") def stream(ws): - subscribed: dict[str, float] = {} # signal id -> last-sent timestamp cursor + subscribed: Dict[str, float] = {} rate = 30.0 + period = 1.0 / rate raw_enabled = False raw_cursor = 0 last_version = -1 - period = 1.0 / rate - def drain_control(): - nonlocal rate, raw_enabled, period + def drain(): + nonlocal rate, period, raw_enabled while True: msg = ws.receive(timeout=0) if msg is None: @@ -101,41 +263,33 @@ def drain_control(): cmd = json.loads(msg) except (ValueError, TypeError): continue - ctype = cmd.get("type") - if ctype == "subscribe": + t = cmd.get("type") + if t == "subscribe": now = time.time() - new = {sid: now for sid in cmd.get("signals", [])} - # keep existing cursors for still-subscribed signals - for sid in list(new): - if sid in subscribed: - new[sid] = subscribed[sid] + new = {sid: subscribed.get(sid, now) for sid in cmd.get("signals", [])} subscribed.clear() subscribed.update(new) - elif ctype == "rate": + elif t == "rate": try: rate = max(1.0, min(120.0, float(cmd.get("value", 30)))) period = 1.0 / rate except (ValueError, TypeError): pass - elif ctype == "raw": + elif t == "raw": raw_enabled = bool(cmd.get("enabled", False)) try: while True: - drain_control() - - # registry / pairs only when it changes; motors every tick (cheap) - sig = service.signals() + drain() + sig = studio.signals() if sig["version"] != last_version: last_version = sig["version"] ws.send(json.dumps({"type": "meta", **sig})) ws.send(json.dumps({"type": "motors", "motors": sig["motors"], - "status": service.status()})) - - # sample batches for subscribed signals + "status": studio.status()})) batch = {} for sid, cursor in list(subscribed.items()): - pts = service.store.series_since(sid, cursor) + pts = studio.store.series_since(sid, cursor) if not pts: continue if len(pts) > _MAX_POINTS_PER_TICK: @@ -145,24 +299,130 @@ def drain_control(): subscribed[sid] = pts[-1][0] if batch: ws.send(json.dumps({"type": "samples", "data": batch})) - if raw_enabled: - raw_cursor, items = service.raw_since(raw_cursor, limit=300) + raw_cursor, items = studio.raw_since(raw_cursor, limit=300) if items: ws.send(json.dumps({"type": "raw", "frames": items})) - time.sleep(period) except Exception: - # client disconnected or socket error: end the handler cleanly return - # ------------------------------------------------------------------- SPA + # ---------------------------------------------------------- control + @app.route("/api/control/scan", methods=["POST"]) + def control_scan(): + g = control_guard() + if g: + return g + data = request.get_json(force=True, silent=True) or {} + try: + found = studio.control.scan(data.get("motor_type") or studio.default_motor_type) + return jsonify({"success": True, "motors": found}) + except Exception as e: + return jsonify({"success": False, "error": str(e)}), 500 + + @app.route("/api/control/motors") + def control_motors(): + g = control_guard() + if g: + return g + return jsonify({"success": True, "motors": studio.control.motors()}) + + def _simple_action(motor_id, fn): + g = control_guard() + if g: + return g + try: + fn(motor_id) + return jsonify({"success": True}) + except Exception as e: + return jsonify({"success": False, "error": str(e)}), 500 + + @app.route("/api/control/motors//enable", methods=["POST"]) + def c_enable(mid): + return _simple_action(mid, studio.control.enable) + + @app.route("/api/control/motors//disable", methods=["POST"]) + def c_disable(mid): + return _simple_action(mid, studio.control.disable) + + @app.route("/api/control/motors//set-zero", methods=["POST"]) + def c_zero(mid): + return _simple_action(mid, studio.control.set_zero) + + @app.route("/api/control/motors//clear-error", methods=["POST"]) + def c_clear(mid): + return _simple_action(mid, studio.control.clear_error) + + @app.route("/api/control/motors//store-parameters", methods=["POST"]) + def c_store(mid): + return _simple_action(mid, studio.control.store_parameters) + + @app.route("/api/control/motors//command", methods=["POST"]) + def c_command(mid): + g = control_guard() + if g: + return g + data = request.get_json(force=True, silent=True) or {} + try: + state = studio.control.command(mid, data) + return jsonify({"success": True, "state": state}) + except Exception as e: + return jsonify({"success": False, "error": str(e)}), 500 + + @app.route("/api/control/motors//state") + def c_state(mid): + g = control_guard() + if g: + return g + try: + return jsonify({"success": True, "state": studio.control.get_state(mid)}) + except Exception as e: + return jsonify({"success": False, "error": str(e)}), 500 + + @app.route("/api/control/motors//registers") + def c_get_regs(mid): + g = control_guard() + if g: + return g + try: + return jsonify({"success": True, **studio.control.get_registers(mid)}) + except Exception as e: + return jsonify({"success": False, "error": str(e)}), 500 + + @app.route("/api/control/motors//registers/", methods=["PUT"]) + def c_set_reg(mid, rid): + g = control_guard() + if g: + return g + data = request.get_json(force=True, silent=True) or {} + if "value" not in data: + return jsonify({"success": False, "error": "value required"}), 400 + try: + res = studio.control.set_register(mid, rid, data["value"]) + return jsonify({"success": True, **res}) + except Exception as e: + return jsonify({"success": False, "error": str(e)}), 500 + + @app.route("/api/control/motors//motor-type", methods=["PUT"]) + def c_motor_type(mid): + g = control_guard() + if g: + return g + data = request.get_json(force=True, silent=True) or {} + mt = data.get("motor_type") + if not mt: + return jsonify({"success": False, "error": "motor_type required"}), 400 + try: + studio.control.set_motor_type(mid, mt) + return jsonify({"success": True}) + except Exception as e: + return jsonify({"success": False, "error": str(e)}), 500 + + # --------------------------------------------------------------- SPA @app.route("/") def index(): idx = os.path.join(_WEBAPP_DIST, "index.html") - if os.path.exists(idx): - return send_from_directory(_WEBAPP_DIST, "index.html") - return _DEV_PLACEHOLDER + return send_from_directory(_WEBAPP_DIST, "index.html") if os.path.exists(idx) else _DEV_PLACEHOLDER @app.route("/") def spa(path): @@ -171,53 +431,35 @@ def spa(path): full = os.path.join(_WEBAPP_DIST, path) if os.path.exists(full) and os.path.isfile(full): return send_from_directory(_WEBAPP_DIST, path) - # SPA client-side routing fallback idx = os.path.join(_WEBAPP_DIST, "index.html") - if os.path.exists(idx): - return send_from_directory(_WEBAPP_DIST, "index.html") - return _DEV_PLACEHOLDER + return send_from_directory(_WEBAPP_DIST, "index.html") if os.path.exists(idx) else _DEV_PLACEHOLDER return app -def run_server( - host: str = "127.0.0.1", - port: int = 5001, - channel: str = "can0", - bustype: str = "socketcan", - bitrate: Optional[int] = None, - feedback_offset: int = 16, - default_motor_type: str = "DM4310", - debug: bool = False, - demo: bool = False, -) -> None: - """Start the passive monitor server (blocking).""" - service = MonitorService( - channel=channel, - bustype=bustype, - bitrate=bitrate, - feedback_offset=feedback_offset, - default_motor_type=default_motor_type, - demo=demo, - ) - service.start() - - app = create_app(service) - - print("Starting DaMiao Passive Monitor (listen-only)...") +def run_server(host: str = "127.0.0.1", port: int = 5001, mode: str = "monitor", + channel: str = "can0", bustype: str = "socketcan", bitrate: Optional[int] = None, + feedback_offset: int = 16, default_motor_type: str = "DM4310", + debug: bool = False, demo: bool = False) -> None: + """Start the unified DaMiao Studio server (blocking).""" + studio = Studio(mode=mode, feedback_offset=feedback_offset, default_motor_type=default_motor_type) + if demo: - print(" DEMO mode: synthesizing motor traffic (no CAN bus opened)") - print(f" bus: {channel} ({bustype}) feedback offset: +{feedback_offset}") - if service.error: - print(f" WARNING: could not open bus: {service.error}") - elif not service.listener.listen_only_applied: - print(" note: hardware listen-only not applied (still never transmits)") - print(f" open http://{host}:{port} in your browser") + studio.mode = "monitor" + studio.start_demo() + elif mode == "monitor": + try: + studio.connect(channel, bustype, bitrate) + except Exception as e: + studio.error = str(e) + + app = create_app(studio) + print(f"Starting DaMiao Studio ({'demo' if demo else mode} mode)...") + print(f" open http://{host}:{port}") if not debug: logging.getLogger("werkzeug").setLevel(logging.ERROR) try: - # threaded=True so the WS handler and HTTP requests run concurrently app.run(host=host, port=port, debug=debug, threaded=True) finally: - service.stop() + studio.disconnect() From a05ebad81e77b9e6359aa4f26f39511cd1924d12 Mon Sep 17 00:00:00 2001 From: Jia Xie Date: Mon, 15 Jun 2026 20:45:16 -0700 Subject: [PATCH 12/14] =?UTF-8?q?feat(studio=20ui):=20control=20UI=20in=20?= =?UTF-8?q?the=20canvas=20=E2=80=94=20unified=20Control/Monitor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Toolbar: Control/Monitor mode switch (+ active·TX / listen-only badge); 'DaMiao Studio'. - New widgets (registry): Connection (bus/scan/motor select), Motor Control (MIT/POS_VEL/ VEL/FORCE_POS, enable/disable, single+continuous send, set-zero/clear-error/store, motor- type), Registers (read/write incl. ms timeout, hex IDs, mode/baud dropdowns). - lib/control.ts REST client; store gains mode/currentMotor/controlMotors/registerTable. - Default canvas is now a full Studio layout; control widgets show an inert hint in monitor mode. Commands feed the same live plots/table/cards via the shared store. - CLI: 'damiao gui' now launches the unified Studio in control mode (legacy web_gui kept). - types: ServerStatus gains mode/connected. Builds clean; backend + tests green. UI pending visual check (local browser wedged). Co-Authored-By: Claude Opus 4.8 (1M context) --- damiao_motor/cli/commands.py | 8 +- .../gui/webapp/dist/assets/index-CDw8n6KX.js | 54 ++++++ .../gui/webapp/dist/assets/index-CSlWWdCi.js | 54 ------ ...{index-BzaSkbtY.css => index-CrxIlrMA.css} | 2 +- damiao_motor/gui/webapp/dist/index.html | 4 +- damiao_motor/gui/webapp/src/App.tsx | 19 +- .../gui/webapp/src/components/Toolbar.tsx | 60 ++++--- damiao_motor/gui/webapp/src/index.css | 35 ++++ damiao_motor/gui/webapp/src/lib/control.ts | 50 ++++++ damiao_motor/gui/webapp/src/lib/store.ts | 28 +++ damiao_motor/gui/webapp/src/lib/types.ts | 6 +- damiao_motor/gui/webapp/src/lib/widgets.ts | 12 +- .../gui/webapp/src/panels/ConnectionPanel.tsx | 134 ++++++++++++++ .../gui/webapp/src/panels/ControlPanel.tsx | 164 ++++++++++++++++++ .../gui/webapp/src/panels/RegisterPanel.tsx | 120 +++++++++++++ .../gui/webapp/src/panels/registry.tsx | 24 +++ damiao_motor/gui/webapp/tsconfig.tsbuildinfo | 2 +- 17 files changed, 681 insertions(+), 95 deletions(-) create mode 100644 damiao_motor/gui/webapp/dist/assets/index-CDw8n6KX.js delete mode 100644 damiao_motor/gui/webapp/dist/assets/index-CSlWWdCi.js rename damiao_motor/gui/webapp/dist/assets/{index-BzaSkbtY.css => index-CrxIlrMA.css} (91%) create mode 100644 damiao_motor/gui/webapp/src/lib/control.ts create mode 100644 damiao_motor/gui/webapp/src/panels/ConnectionPanel.tsx create mode 100644 damiao_motor/gui/webapp/src/panels/ControlPanel.tsx create mode 100644 damiao_motor/gui/webapp/src/panels/RegisterPanel.tsx diff --git a/damiao_motor/cli/commands.py b/damiao_motor/cli/commands.py index 6689c7b..96cc460 100644 --- a/damiao_motor/cli/commands.py +++ b/damiao_motor/cli/commands.py @@ -718,9 +718,11 @@ def cmd_gui(args) -> None: - debug: Enable debug mode (default: False) - production: Use production WSGI server (default: False) """ - web_gui.run_server( - host=args.host, port=args.port, debug=args.debug, production=args.production - ) + # `gui` now launches the unified DaMiao Studio in control mode (active control + + # the realtime monitor in one UI). The legacy Flask GUI remains in web_gui.py. + from damiao_motor.monitor import server as studio_server + + studio_server.run_server(host=args.host, port=args.port, mode="control", debug=args.debug) def cmd_monitor(args) -> None: diff --git a/damiao_motor/gui/webapp/dist/assets/index-CDw8n6KX.js b/damiao_motor/gui/webapp/dist/assets/index-CDw8n6KX.js new file mode 100644 index 0000000..173ee68 --- /dev/null +++ b/damiao_motor/gui/webapp/dist/assets/index-CDw8n6KX.js @@ -0,0 +1,54 @@ +var Wv=Object.defineProperty;var Bv=(l,t,r)=>t in l?Wv(l,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[t]=r;var mo=(l,t,r)=>Bv(l,typeof t!="symbol"?t+"":t,r);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const u of o)if(u.type==="childList")for(const c of u.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&i(c)}).observe(document,{childList:!0,subtree:!0});function r(o){const u={};return o.integrity&&(u.integrity=o.integrity),o.referrerPolicy&&(u.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?u.credentials="include":o.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function i(o){if(o.ep)return;o.ep=!0;const u=r(o);fetch(o.href,u)}})();function Mm(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var tf={exports:{}},go={},nf={exports:{}},Ue={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var sp;function Uv(){if(sp)return Ue;sp=1;var l=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),v=Symbol.iterator;function x(M){return M===null||typeof M!="object"?null:(M=v&&M[v]||M["@@iterator"],typeof M=="function"?M:null)}var T={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},N=Object.assign,C={};function L(M,W,X){this.props=M,this.context=W,this.refs=C,this.updater=X||T}L.prototype.isReactComponent={},L.prototype.setState=function(M,W){if(typeof M!="object"&&typeof M!="function"&&M!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,M,W,"setState")},L.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function U(){}U.prototype=L.prototype;function A(M,W,X){this.props=M,this.context=W,this.refs=C,this.updater=X||T}var V=A.prototype=new U;V.constructor=A,N(V,L.prototype),V.isPureReactComponent=!0;var z=Array.isArray,$=Object.prototype.hasOwnProperty,G={current:null},Y={key:!0,ref:!0,__self:!0,__source:!0};function Z(M,W,X){var ee,be={},he=null,Ee=null;if(W!=null)for(ee in W.ref!==void 0&&(Ee=W.ref),W.key!==void 0&&(he=""+W.key),W)$.call(W,ee)&&!Y.hasOwnProperty(ee)&&(be[ee]=W[ee]);var Ie=arguments.length-2;if(Ie===1)be.children=X;else if(1>>1,W=oe[M];if(0>>1;Mo(be,J))heo(Ee,be)?(oe[M]=Ee,oe[he]=J,M=he):(oe[M]=be,oe[ee]=J,M=ee);else if(heo(Ee,J))oe[M]=Ee,oe[he]=J,M=he;else break e}}return ae}function o(oe,ae){var J=oe.sortIndex-ae.sortIndex;return J!==0?J:oe.id-ae.id}if(typeof performance=="object"&&typeof performance.now=="function"){var u=performance;l.unstable_now=function(){return u.now()}}else{var c=Date,d=c.now();l.unstable_now=function(){return c.now()-d}}var p=[],g=[],y=1,v=null,x=3,T=!1,N=!1,C=!1,L=typeof setTimeout=="function"?setTimeout:null,U=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function V(oe){for(var ae=r(g);ae!==null;){if(ae.callback===null)i(g);else if(ae.startTime<=oe)i(g),ae.sortIndex=ae.expirationTime,t(p,ae);else break;ae=r(g)}}function z(oe){if(C=!1,V(oe),!N)if(r(p)!==null)N=!0,ke($);else{var ae=r(g);ae!==null&&le(z,ae.startTime-oe)}}function $(oe,ae){N=!1,C&&(C=!1,U(Z),Z=-1),T=!0;var J=x;try{for(V(ae),v=r(p);v!==null&&(!(v.expirationTime>ae)||oe&&!q());){var M=v.callback;if(typeof M=="function"){v.callback=null,x=v.priorityLevel;var W=M(v.expirationTime<=ae);ae=l.unstable_now(),typeof W=="function"?v.callback=W:v===r(p)&&i(p),V(ae)}else i(p);v=r(p)}if(v!==null)var X=!0;else{var ee=r(g);ee!==null&&le(z,ee.startTime-ae),X=!1}return X}finally{v=null,x=J,T=!1}}var G=!1,Y=null,Z=-1,K=5,fe=-1;function q(){return!(l.unstable_now()-feoe||125M?(oe.sortIndex=J,t(g,oe),r(p)===null&&oe===r(g)&&(C?(U(Z),Z=-1):C=!0,le(z,J-M))):(oe.sortIndex=W,t(p,oe),N||T||(N=!0,ke($))),oe},l.unstable_shouldYield=q,l.unstable_wrapCallback=function(oe){var ae=x;return function(){var J=x;x=ae;try{return oe.apply(this,arguments)}finally{x=J}}}})(lf)),lf}var cp;function Kv(){return cp||(cp=1,sf.exports=Gv()),sf.exports}/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var fp;function Yv(){if(fp)return sr;fp=1;var l=Hf(),t=Kv();function r(e){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+e,s=1;s"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),p=Object.prototype.hasOwnProperty,g=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,y={},v={};function x(e){return p.call(v,e)?!0:p.call(y,e)?!1:g.test(e)?v[e]=!0:(y[e]=!0,!1)}function T(e,n,s,a){if(s!==null&&s.type===0)return!1;switch(typeof n){case"function":case"symbol":return!0;case"boolean":return a?!1:s!==null?!s.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function N(e,n,s,a){if(n===null||typeof n>"u"||T(e,n,s,a))return!0;if(a)return!1;if(s!==null)switch(s.type){case 3:return!n;case 4:return n===!1;case 5:return isNaN(n);case 6:return isNaN(n)||1>n}return!1}function C(e,n,s,a,f,h,w){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=a,this.attributeNamespace=f,this.mustUseProperty=s,this.propertyName=e,this.type=n,this.sanitizeURL=h,this.removeEmptyString=w}var L={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){L[e]=new C(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var n=e[0];L[n]=new C(n,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){L[e]=new C(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){L[e]=new C(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){L[e]=new C(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){L[e]=new C(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){L[e]=new C(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){L[e]=new C(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){L[e]=new C(e,5,!1,e.toLowerCase(),null,!1,!1)});var U=/[\-:]([a-z])/g;function A(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var n=e.replace(U,A);L[n]=new C(n,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var n=e.replace(U,A);L[n]=new C(n,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var n=e.replace(U,A);L[n]=new C(n,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){L[e]=new C(e,1,!1,e.toLowerCase(),null,!1,!1)}),L.xlinkHref=new C("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){L[e]=new C(e,1,!1,e.toLowerCase(),null,!0,!0)});function V(e,n,s,a){var f=L.hasOwnProperty(n)?L[n]:null;(f!==null?f.type!==0:a||!(2k||f[w]!==h[k]){var b=` +`+f[w].replace(" at new "," at ");return e.displayName&&b.includes("")&&(b=b.replace("",e.displayName)),b}while(1<=w&&0<=k);break}}}finally{X=!1,Error.prepareStackTrace=s}return(e=e?e.displayName||e.name:"")?W(e):""}function be(e){switch(e.tag){case 5:return W(e.type);case 16:return W("Lazy");case 13:return W("Suspense");case 19:return W("SuspenseList");case 0:case 2:case 15:return e=ee(e.type,!1),e;case 11:return e=ee(e.type.render,!1),e;case 1:return e=ee(e.type,!0),e;default:return""}}function he(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Y:return"Fragment";case G:return"Portal";case K:return"Profiler";case Z:return"StrictMode";case ce:return"Suspense";case ge:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case q:return(e.displayName||"Context")+".Consumer";case fe:return(e._context.displayName||"Context")+".Provider";case xe:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ye:return n=e.displayName||null,n!==null?n:he(e.type)||"Memo";case ke:n=e._payload,e=e._init;try{return he(e(n))}catch{}}return null}function Ee(e){var n=e.type;switch(e.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=n.render,e=e.displayName||e.name||"",n.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return he(n);case 8:return n===Z?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function Ie(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Fe(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Oe(e){var n=Fe(e)?"checked":"value",s=Object.getOwnPropertyDescriptor(e.constructor.prototype,n),a=""+e[n];if(!e.hasOwnProperty(n)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var f=s.get,h=s.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return f.call(this)},set:function(w){a=""+w,h.call(this,w)}}),Object.defineProperty(e,n,{enumerable:s.enumerable}),{getValue:function(){return a},setValue:function(w){a=""+w},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function Gt(e){e._valueTracker||(e._valueTracker=Oe(e))}function At(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var s=n.getValue(),a="";return e&&(a=Fe(e)?e.checked?"true":"false":e.value),e=a,e!==s?(n.setValue(e),!0):!1}function jt(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function It(e,n){var s=n.checked;return J({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:s??e._wrapperState.initialChecked})}function Qn(e,n){var s=n.defaultValue==null?"":n.defaultValue,a=n.checked!=null?n.checked:n.defaultChecked;s=Ie(n.value!=null?n.value:s),e._wrapperState={initialChecked:a,initialValue:s,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function kn(e,n){n=n.checked,n!=null&&V(e,"checked",n,!1)}function Er(e,n){kn(e,n);var s=Ie(n.value),a=n.type;if(s!=null)a==="number"?(s===0&&e.value===""||e.value!=s)&&(e.value=""+s):e.value!==""+s&&(e.value=""+s);else if(a==="submit"||a==="reset"){e.removeAttribute("value");return}n.hasOwnProperty("value")?An(e,n.type,s):n.hasOwnProperty("defaultValue")&&An(e,n.type,Ie(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(e.defaultChecked=!!n.defaultChecked)}function Xr(e,n,s){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var a=n.type;if(!(a!=="submit"&&a!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+e._wrapperState.initialValue,s||n===e.value||(e.value=n),e.defaultValue=n}s=e.name,s!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,s!==""&&(e.name=s)}function An(e,n,s){(n!=="number"||jt(e.ownerDocument)!==e)&&(s==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+s&&(e.defaultValue=""+s))}var et=Array.isArray;function rn(e,n,s,a){if(e=e.options,n){n={};for(var f=0;f"+n.valueOf().toString()+"",n=ln.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;n.firstChild;)e.appendChild(n.firstChild)}});function Kt(e,n){if(n){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=n;return}}e.textContent=n}var Nt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},on=["Webkit","ms","Moz","O"];Object.keys(Nt).forEach(function(e){on.forEach(function(n){n=n+e.charAt(0).toUpperCase()+e.substring(1),Nt[n]=Nt[e]})});function gn(e,n,s){return n==null||typeof n=="boolean"||n===""?"":s||typeof n!="number"||n===0||Nt.hasOwnProperty(e)&&Nt[e]?(""+n).trim():n+"px"}function Yt(e,n){e=e.style;for(var s in n)if(n.hasOwnProperty(s)){var a=s.indexOf("--")===0,f=gn(s,n[s],a);s==="float"&&(s="cssFloat"),a?e.setProperty(s,f):e[s]=f}}var vn=J({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Jr(e,n){if(n){if(vn[e]&&(n.children!=null||n.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(n.dangerouslySetInnerHTML!=null){if(n.children!=null)throw Error(r(60));if(typeof n.dangerouslySetInnerHTML!="object"||!("__html"in n.dangerouslySetInnerHTML))throw Error(r(61))}if(n.style!=null&&typeof n.style!="object")throw Error(r(62))}}function Zr(e,n){if(e.indexOf("-")===-1)return typeof n.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var or=null;function ar(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ei=null,Dt=null,ot=null;function Qt(e){if(e=Zl(e)){if(typeof ei!="function")throw Error(r(280));var n=e.stateNode;n&&(n=fa(n),ei(e.stateNode,e.type,n))}}function an(e){Dt?ot?ot.push(e):ot=[e]:Dt=e}function ur(){if(Dt){var e=Dt,n=ot;if(ot=Dt=null,Qt(e),n)for(e=0;e>>=0,e===0?32:31-(jl(e)/bn|0)|0}var cs=64,Di=4194304;function zi(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Bs(e,n){var s=e.pendingLanes;if(s===0)return 0;var a=0,f=e.suspendedLanes,h=e.pingedLanes,w=s&268435455;if(w!==0){var k=w&~f;k!==0?a=zi(k):(h&=w,h!==0&&(a=zi(h)))}else w=s&~f,w!==0?a=zi(w):h!==0&&(a=zi(h));if(a===0)return 0;if(n!==0&&n!==a&&(n&f)===0&&(f=a&-a,h=n&-n,f>=h||f===16&&(h&4194240)!==0))return n;if((a&4)!==0&&(a|=s&16),n=e.entangledLanes,n!==0)for(e=e.entanglements,n&=a;0s;s++)n.push(e);return n}function Oi(e,n,s){e.pendingLanes|=n,n!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,n=31-In(n),e[n]=s}function Hl(e,n){var s=e.pendingLanes&~n;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=n,e.mutableReadLanes&=n,e.entangledLanes&=n,n=e.entanglements;var a=e.eventTimes;for(e=e.expirationTimes;0=gi),ia=" ",Js=!1;function m(e,n){switch(e){case"keyup":return Tt.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function S(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var _=!1;function E(e,n){switch(e){case"compositionend":return S(n);case"keypress":return n.which!==32?null:(Js=!0,ia);case"textInput":return e=n.data,e===ia&&Js?null:e;default:return null}}function D(e,n){if(_)return e==="compositionend"||!Xs&&m(e,n)?(e=hr(),dr=Vl=fr=null,_=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1=n)return{node:s,offset:n-e};e=a}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=Zn(s)}}function Mn(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Mn(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Bn(){for(var e=window,n=jt();n instanceof e.HTMLIFrameElement;){try{var s=typeof n.contentWindow.location.href=="string"}catch{s=!1}if(s)e=n.contentWindow;else break;n=jt(e.document)}return n}function Un(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}function br(e){var n=Bn(),s=e.focusedElem,a=e.selectionRange;if(n!==s&&s&&s.ownerDocument&&Mn(s.ownerDocument.documentElement,s)){if(a!==null&&Un(s)){if(n=a.start,e=a.end,e===void 0&&(e=n),"selectionStart"in s)s.selectionStart=n,s.selectionEnd=Math.min(e,s.value.length);else if(e=(n=s.ownerDocument||document)&&n.defaultView||window,e.getSelection){e=e.getSelection();var f=s.textContent.length,h=Math.min(a.start,f);a=a.end===void 0?h:Math.min(a.end,f),!e.extend&&h>a&&(f=a,a=h,h=f),f=mr(s,h);var w=mr(s,a);f&&w&&(e.rangeCount!==1||e.anchorNode!==f.node||e.anchorOffset!==f.offset||e.focusNode!==w.node||e.focusOffset!==w.offset)&&(n=n.createRange(),n.setStart(f.node,f.offset),e.removeAllRanges(),h>a?(e.addRange(n),e.extend(w.node,w.offset)):(n.setEnd(w.node,w.offset),e.addRange(n)))}}for(n=[],e=s;e=e.parentNode;)e.nodeType===1&&n.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s=document.documentMode,Ut=null,Hr=null,Lt=null,Zs=!1;function dd(e,n,s){var a=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;Zs||Ut==null||Ut!==jt(a)||(a=Ut,"selectionStart"in a&&Un(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),Lt&&fn(Lt,a)||(Lt=a,a=aa(Hr,"onSelect"),0il||(e.current=Ju[il],Ju[il]=null,il--)}function ht(e,n){il++,Ju[il]=e.current,e.current=n}var Ki={},Dn=Gi(Ki),er=Gi(!1),xs=Ki;function sl(e,n){var s=e.type.contextTypes;if(!s)return Ki;var a=e.stateNode;if(a&&a.__reactInternalMemoizedUnmaskedChildContext===n)return a.__reactInternalMemoizedMaskedChildContext;var f={},h;for(h in s)f[h]=n[h];return a&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=n,e.__reactInternalMemoizedMaskedChildContext=f),f}function tr(e){return e=e.childContextTypes,e!=null}function da(){gt(er),gt(Dn)}function Nd(e,n,s){if(Dn.current!==Ki)throw Error(r(168));ht(Dn,n),ht(er,s)}function bd(e,n,s){var a=e.stateNode;if(n=n.childContextTypes,typeof a.getChildContext!="function")return s;a=a.getChildContext();for(var f in a)if(!(f in n))throw Error(r(108,Ee(e)||"Unknown",f));return J({},s,a)}function ha(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ki,xs=Dn.current,ht(Dn,e),ht(er,er.current),!0}function Td(e,n,s){var a=e.stateNode;if(!a)throw Error(r(169));s?(e=bd(e,n,xs),a.__reactInternalMemoizedMergedChildContext=e,gt(er),gt(Dn),ht(Dn,e)):gt(er),ht(er,s)}var yi=null,pa=!1,Zu=!1;function Md(e){yi===null?yi=[e]:yi.push(e)}function lv(e){pa=!0,Md(e)}function Yi(){if(!Zu&&yi!==null){Zu=!0;var e=0,n=Ge;try{var s=yi;for(Ge=1;e>=w,f-=w,wi=1<<32-In(n)+f|s<je?(pn=ze,ze=null):pn=ze.sibling;var qe=te(j,ze,H[je],ue);if(qe===null){ze===null&&(ze=pn);break}e&&ze&&qe.alternate===null&&n(j,ze),O=h(qe,O,je),De===null?Ne=qe:De.sibling=qe,De=qe,ze=pn}if(je===H.length)return s(j,ze),xt&&Es(j,je),Ne;if(ze===null){for(;jeje?(pn=ze,ze=null):pn=ze.sibling;var rs=te(j,ze,qe.value,ue);if(rs===null){ze===null&&(ze=pn);break}e&&ze&&rs.alternate===null&&n(j,ze),O=h(rs,O,je),De===null?Ne=rs:De.sibling=rs,De=rs,ze=pn}if(qe.done)return s(j,ze),xt&&Es(j,je),Ne;if(ze===null){for(;!qe.done;je++,qe=H.next())qe=ie(j,qe.value,ue),qe!==null&&(O=h(qe,O,je),De===null?Ne=qe:De.sibling=qe,De=qe);return xt&&Es(j,je),Ne}for(ze=a(j,ze);!qe.done;je++,qe=H.next())qe=we(ze,j,je,qe.value,ue),qe!==null&&(e&&qe.alternate!==null&&ze.delete(qe.key===null?je:qe.key),O=h(qe,O,je),De===null?Ne=qe:De.sibling=qe,De=qe);return e&&ze.forEach(function(Hv){return n(j,Hv)}),xt&&Es(j,je),Ne}function Pt(j,O,H,ue){if(typeof H=="object"&&H!==null&&H.type===Y&&H.key===null&&(H=H.props.children),typeof H=="object"&&H!==null){switch(H.$$typeof){case $:e:{for(var Ne=H.key,De=O;De!==null;){if(De.key===Ne){if(Ne=H.type,Ne===Y){if(De.tag===7){s(j,De.sibling),O=f(De,H.props.children),O.return=j,j=O;break e}}else if(De.elementType===Ne||typeof Ne=="object"&&Ne!==null&&Ne.$$typeof===ke&&Ad(Ne)===De.type){s(j,De.sibling),O=f(De,H.props),O.ref=eo(j,De,H),O.return=j,j=O;break e}s(j,De);break}else n(j,De);De=De.sibling}H.type===Y?(O=Ds(H.props.children,j.mode,ue,H.key),O.return=j,j=O):(ue=Ba(H.type,H.key,H.props,null,j.mode,ue),ue.ref=eo(j,O,H),ue.return=j,j=ue)}return w(j);case G:e:{for(De=H.key;O!==null;){if(O.key===De)if(O.tag===4&&O.stateNode.containerInfo===H.containerInfo&&O.stateNode.implementation===H.implementation){s(j,O.sibling),O=f(O,H.children||[]),O.return=j,j=O;break e}else{s(j,O);break}else n(j,O);O=O.sibling}O=qc(H,j.mode,ue),O.return=j,j=O}return w(j);case ke:return De=H._init,Pt(j,O,De(H._payload),ue)}if(et(H))return _e(j,O,H,ue);if(ae(H))return Ce(j,O,H,ue);ya(j,H)}return typeof H=="string"&&H!==""||typeof H=="number"?(H=""+H,O!==null&&O.tag===6?(s(j,O.sibling),O=f(O,H),O.return=j,j=O):(s(j,O),O=Qc(H,j.mode,ue),O.return=j,j=O),w(j)):s(j,O)}return Pt}var ul=jd(!0),Id=jd(!1),wa=Gi(null),Sa=null,cl=null,sc=null;function lc(){sc=cl=Sa=null}function oc(e){var n=wa.current;gt(wa),e._currentValue=n}function ac(e,n,s){for(;e!==null;){var a=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,a!==null&&(a.childLanes|=n)):a!==null&&(a.childLanes&n)!==n&&(a.childLanes|=n),e===s)break;e=e.return}}function fl(e,n){Sa=e,sc=cl=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&n)!==0&&(nr=!0),e.firstContext=null)}function Dr(e){var n=e._currentValue;if(sc!==e)if(e={context:e,memoizedValue:n,next:null},cl===null){if(Sa===null)throw Error(r(308));cl=e,Sa.dependencies={lanes:0,firstContext:e}}else cl=cl.next=e;return n}var Cs=null;function uc(e){Cs===null?Cs=[e]:Cs.push(e)}function Fd(e,n,s,a){var f=n.interleaved;return f===null?(s.next=s,uc(n)):(s.next=f.next,f.next=s),n.interleaved=s,xi(e,a)}function xi(e,n){e.lanes|=n;var s=e.alternate;for(s!==null&&(s.lanes|=n),s=e,e=e.return;e!==null;)e.childLanes|=n,s=e.alternate,s!==null&&(s.childLanes|=n),s=e,e=e.return;return s.tag===3?s.stateNode:null}var Qi=!1;function cc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Hd(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function _i(e,n){return{eventTime:e,lane:n,tag:0,payload:null,callback:null,next:null}}function qi(e,n,s){var a=e.updateQueue;if(a===null)return null;if(a=a.shared,(Ye&2)!==0){var f=a.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),a.pending=n,xi(e,s)}return f=a.interleaved,f===null?(n.next=n,uc(a)):(n.next=f.next,f.next=n),a.interleaved=n,xi(e,s)}function xa(e,n,s){if(n=n.updateQueue,n!==null&&(n=n.shared,(s&4194240)!==0)){var a=n.lanes;a&=e.pendingLanes,s|=a,n.lanes=s,Li(e,s)}}function Wd(e,n){var s=e.updateQueue,a=e.alternate;if(a!==null&&(a=a.updateQueue,s===a)){var f=null,h=null;if(s=s.firstBaseUpdate,s!==null){do{var w={eventTime:s.eventTime,lane:s.lane,tag:s.tag,payload:s.payload,callback:s.callback,next:null};h===null?f=h=w:h=h.next=w,s=s.next}while(s!==null);h===null?f=h=n:h=h.next=n}else f=h=n;s={baseState:a.baseState,firstBaseUpdate:f,lastBaseUpdate:h,shared:a.shared,effects:a.effects},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=n:e.next=n,s.lastBaseUpdate=n}function _a(e,n,s,a){var f=e.updateQueue;Qi=!1;var h=f.firstBaseUpdate,w=f.lastBaseUpdate,k=f.shared.pending;if(k!==null){f.shared.pending=null;var b=k,B=b.next;b.next=null,w===null?h=B:w.next=B,w=b;var re=e.alternate;re!==null&&(re=re.updateQueue,k=re.lastBaseUpdate,k!==w&&(k===null?re.firstBaseUpdate=B:k.next=B,re.lastBaseUpdate=b))}if(h!==null){var ie=f.baseState;w=0,re=B=b=null,k=h;do{var te=k.lane,we=k.eventTime;if((a&te)===te){re!==null&&(re=re.next={eventTime:we,lane:0,tag:k.tag,payload:k.payload,callback:k.callback,next:null});e:{var _e=e,Ce=k;switch(te=n,we=s,Ce.tag){case 1:if(_e=Ce.payload,typeof _e=="function"){ie=_e.call(we,ie,te);break e}ie=_e;break e;case 3:_e.flags=_e.flags&-65537|128;case 0:if(_e=Ce.payload,te=typeof _e=="function"?_e.call(we,ie,te):_e,te==null)break e;ie=J({},ie,te);break e;case 2:Qi=!0}}k.callback!==null&&k.lane!==0&&(e.flags|=64,te=f.effects,te===null?f.effects=[k]:te.push(k))}else we={eventTime:we,lane:te,tag:k.tag,payload:k.payload,callback:k.callback,next:null},re===null?(B=re=we,b=ie):re=re.next=we,w|=te;if(k=k.next,k===null){if(k=f.shared.pending,k===null)break;te=k,k=te.next,te.next=null,f.lastBaseUpdate=te,f.shared.pending=null}}while(!0);if(re===null&&(b=ie),f.baseState=b,f.firstBaseUpdate=B,f.lastBaseUpdate=re,n=f.shared.interleaved,n!==null){f=n;do w|=f.lane,f=f.next;while(f!==n)}else h===null&&(f.shared.lanes=0);Ns|=w,e.lanes=w,e.memoizedState=ie}}function Bd(e,n,s){if(e=n.effects,n.effects=null,e!==null)for(n=0;ns?s:4,e(!0);var a=mc.transition;mc.transition={};try{e(!1),n()}finally{Ge=s,mc.transition=a}}function oh(){return zr().memoizedState}function cv(e,n,s){var a=es(e);if(s={lane:a,action:s,hasEagerState:!1,eagerState:null,next:null},ah(e))uh(n,s);else if(s=Fd(e,n,s,a),s!==null){var f=$n();$r(s,e,a,f),ch(s,n,a)}}function fv(e,n,s){var a=es(e),f={lane:a,action:s,hasEagerState:!1,eagerState:null,next:null};if(ah(e))uh(n,f);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var w=n.lastRenderedState,k=h(w,s);if(f.hasEagerState=!0,f.eagerState=k,ut(k,w)){var b=n.interleaved;b===null?(f.next=f,uc(n)):(f.next=b.next,b.next=f),n.interleaved=f;return}}catch{}finally{}s=Fd(e,n,f,a),s!==null&&(f=$n(),$r(s,e,a,f),ch(s,n,a))}}function ah(e){var n=e.alternate;return e===Rt||n!==null&&n===Rt}function uh(e,n){io=ka=!0;var s=e.pending;s===null?n.next=n:(n.next=s.next,s.next=n),e.pending=n}function ch(e,n,s){if((s&4194240)!==0){var a=n.lanes;a&=e.pendingLanes,s|=a,n.lanes=s,Li(e,s)}}var ba={readContext:Dr,useCallback:zn,useContext:zn,useEffect:zn,useImperativeHandle:zn,useInsertionEffect:zn,useLayoutEffect:zn,useMemo:zn,useReducer:zn,useRef:zn,useState:zn,useDebugValue:zn,useDeferredValue:zn,useTransition:zn,useMutableSource:zn,useSyncExternalStore:zn,useId:zn,unstable_isNewReconciler:!1},dv={readContext:Dr,useCallback:function(e,n){return li().memoizedState=[e,n===void 0?null:n],e},useContext:Dr,useEffect:Zd,useImperativeHandle:function(e,n,s){return s=s!=null?s.concat([e]):null,Ra(4194308,4,nh.bind(null,n,e),s)},useLayoutEffect:function(e,n){return Ra(4194308,4,e,n)},useInsertionEffect:function(e,n){return Ra(4,2,e,n)},useMemo:function(e,n){var s=li();return n=n===void 0?null:n,e=e(),s.memoizedState=[e,n],e},useReducer:function(e,n,s){var a=li();return n=s!==void 0?s(n):n,a.memoizedState=a.baseState=n,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:n},a.queue=e,e=e.dispatch=cv.bind(null,Rt,e),[a.memoizedState,e]},useRef:function(e){var n=li();return e={current:e},n.memoizedState=e},useState:Xd,useDebugValue:_c,useDeferredValue:function(e){return li().memoizedState=e},useTransition:function(){var e=Xd(!1),n=e[0];return e=uv.bind(null,e[1]),li().memoizedState=e,[n,e]},useMutableSource:function(){},useSyncExternalStore:function(e,n,s){var a=Rt,f=li();if(xt){if(s===void 0)throw Error(r(407));s=s()}else{if(s=n(),hn===null)throw Error(r(349));(Rs&30)!==0||Gd(a,n,s)}f.memoizedState=s;var h={value:s,getSnapshot:n};return f.queue=h,Zd(Yd.bind(null,a,h,e),[e]),a.flags|=2048,oo(9,Kd.bind(null,a,h,s,n),void 0,null),s},useId:function(){var e=li(),n=hn.identifierPrefix;if(xt){var s=Si,a=wi;s=(a&~(1<<32-In(a)-1)).toString(32)+s,n=":"+n+"R"+s,s=so++,0<\/script>",e=e.removeChild(e.firstChild)):typeof a.is=="string"?e=w.createElement(s,{is:a.is}):(e=w.createElement(s),s==="select"&&(w=e,a.multiple?w.multiple=!0:a.size&&(w.size=a.size))):e=w.createElementNS(e,s),e[ii]=n,e[Jl]=a,Mh(e,n,!1,!1),n.stateNode=e;e:{switch(w=Zr(s,a),s){case"dialog":mt("cancel",e),mt("close",e),f=a;break;case"iframe":case"object":case"embed":mt("load",e),f=a;break;case"video":case"audio":for(f=0;fgl&&(n.flags|=128,a=!0,ao(h,!1),n.lanes=4194304)}else{if(!a)if(e=Ea(w),e!==null){if(n.flags|=128,a=!0,s=e.updateQueue,s!==null&&(n.updateQueue=s,n.flags|=4),ao(h,!0),h.tail===null&&h.tailMode==="hidden"&&!w.alternate&&!xt)return On(n),null}else 2*at()-h.renderingStartTime>gl&&s!==1073741824&&(n.flags|=128,a=!0,ao(h,!1),n.lanes=4194304);h.isBackwards?(w.sibling=n.child,n.child=w):(s=h.last,s!==null?s.sibling=w:n.child=w,h.last=w)}return h.tail!==null?(n=h.tail,h.rendering=n,h.tail=n.sibling,h.renderingStartTime=at(),n.sibling=null,s=kt.current,ht(kt,a?s&1|2:s&1),n):(On(n),null);case 22:case 23:return Gc(),a=n.memoizedState!==null,e!==null&&e.memoizedState!==null!==a&&(n.flags|=8192),a&&(n.mode&1)!==0?(yr&1073741824)!==0&&(On(n),n.subtreeFlags&6&&(n.flags|=8192)):On(n),null;case 24:return null;case 25:return null}throw Error(r(156,n.tag))}function Sv(e,n){switch(tc(n),n.tag){case 1:return tr(n.type)&&da(),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return dl(),gt(er),gt(Dn),pc(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 5:return dc(n),null;case 13:if(gt(kt),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(r(340));al()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return gt(kt),null;case 4:return dl(),null;case 10:return oc(n.type._context),null;case 22:case 23:return Gc(),null;case 24:return null;default:return null}}var za=!1,Ln=!1,xv=typeof WeakSet=="function"?WeakSet:Set,Se=null;function pl(e,n){var s=e.ref;if(s!==null)if(typeof s=="function")try{s(null)}catch(a){Mt(e,n,a)}else s.current=null}function Lc(e,n,s){try{s()}catch(a){Mt(e,n,a)}}var Oh=!1;function _v(e,n){if(Gu=it,e=Bn(),Un(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{s=(s=e.ownerDocument)&&s.defaultView||window;var a=s.getSelection&&s.getSelection();if(a&&a.rangeCount!==0){s=a.anchorNode;var f=a.anchorOffset,h=a.focusNode;a=a.focusOffset;try{s.nodeType,h.nodeType}catch{s=null;break e}var w=0,k=-1,b=-1,B=0,re=0,ie=e,te=null;t:for(;;){for(var we;ie!==s||f!==0&&ie.nodeType!==3||(k=w+f),ie!==h||a!==0&&ie.nodeType!==3||(b=w+a),ie.nodeType===3&&(w+=ie.nodeValue.length),(we=ie.firstChild)!==null;)te=ie,ie=we;for(;;){if(ie===e)break t;if(te===s&&++B===f&&(k=w),te===h&&++re===a&&(b=w),(we=ie.nextSibling)!==null)break;ie=te,te=ie.parentNode}ie=we}s=k===-1||b===-1?null:{start:k,end:b}}else s=null}s=s||{start:0,end:0}}else s=null;for(Ku={focusedElem:e,selectionRange:s},it=!1,Se=n;Se!==null;)if(n=Se,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,Se=e;else for(;Se!==null;){n=Se;try{var _e=n.alternate;if((n.flags&1024)!==0)switch(n.tag){case 0:case 11:case 15:break;case 1:if(_e!==null){var Ce=_e.memoizedProps,Pt=_e.memoizedState,j=n.stateNode,O=j.getSnapshotBeforeUpdate(n.elementType===n.type?Ce:Br(n.type,Ce),Pt);j.__reactInternalSnapshotBeforeUpdate=O}break;case 3:var H=n.stateNode.containerInfo;H.nodeType===1?H.textContent="":H.nodeType===9&&H.documentElement&&H.removeChild(H.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(ue){Mt(n,n.return,ue)}if(e=n.sibling,e!==null){e.return=n.return,Se=e;break}Se=n.return}return _e=Oh,Oh=!1,_e}function uo(e,n,s){var a=n.updateQueue;if(a=a!==null?a.lastEffect:null,a!==null){var f=a=a.next;do{if((f.tag&e)===e){var h=f.destroy;f.destroy=void 0,h!==void 0&&Lc(n,s,h)}f=f.next}while(f!==a)}}function Oa(e,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var s=n=n.next;do{if((s.tag&e)===e){var a=s.create;s.destroy=a()}s=s.next}while(s!==n)}}function Pc(e){var n=e.ref;if(n!==null){var s=e.stateNode;switch(e.tag){case 5:e=s;break;default:e=s}typeof n=="function"?n(e):n.current=e}}function Lh(e){var n=e.alternate;n!==null&&(e.alternate=null,Lh(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&(delete n[ii],delete n[Jl],delete n[Xu],delete n[iv],delete n[sv])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Ph(e){return e.tag===5||e.tag===3||e.tag===4}function Ah(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ph(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.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Ac(e,n,s){var a=e.tag;if(a===5||a===6)e=e.stateNode,n?s.nodeType===8?s.parentNode.insertBefore(e,n):s.insertBefore(e,n):(s.nodeType===8?(n=s.parentNode,n.insertBefore(e,s)):(n=s,n.appendChild(e)),s=s._reactRootContainer,s!=null||n.onclick!==null||(n.onclick=ca));else if(a!==4&&(e=e.child,e!==null))for(Ac(e,n,s),e=e.sibling;e!==null;)Ac(e,n,s),e=e.sibling}function jc(e,n,s){var a=e.tag;if(a===5||a===6)e=e.stateNode,n?s.insertBefore(e,n):s.appendChild(e);else if(a!==4&&(e=e.child,e!==null))for(jc(e,n,s),e=e.sibling;e!==null;)jc(e,n,s),e=e.sibling}var _n=null,Ur=!1;function Xi(e,n,s){for(s=s.child;s!==null;)jh(e,n,s),s=s.sibling}function jh(e,n,s){if(qn&&typeof qn.onCommitFiberUnmount=="function")try{qn.onCommitFiberUnmount(Mi,s)}catch{}switch(s.tag){case 5:Ln||pl(s,n);case 6:var a=_n,f=Ur;_n=null,Xi(e,n,s),_n=a,Ur=f,_n!==null&&(Ur?(e=_n,s=s.stateNode,e.nodeType===8?e.parentNode.removeChild(s):e.removeChild(s)):_n.removeChild(s.stateNode));break;case 18:_n!==null&&(Ur?(e=_n,s=s.stateNode,e.nodeType===8?qu(e.parentNode,s):e.nodeType===1&&qu(e,s),Wi(e)):qu(_n,s.stateNode));break;case 4:a=_n,f=Ur,_n=s.stateNode.containerInfo,Ur=!0,Xi(e,n,s),_n=a,Ur=f;break;case 0:case 11:case 14:case 15:if(!Ln&&(a=s.updateQueue,a!==null&&(a=a.lastEffect,a!==null))){f=a=a.next;do{var h=f,w=h.destroy;h=h.tag,w!==void 0&&((h&2)!==0||(h&4)!==0)&&Lc(s,n,w),f=f.next}while(f!==a)}Xi(e,n,s);break;case 1:if(!Ln&&(pl(s,n),a=s.stateNode,typeof a.componentWillUnmount=="function"))try{a.props=s.memoizedProps,a.state=s.memoizedState,a.componentWillUnmount()}catch(k){Mt(s,n,k)}Xi(e,n,s);break;case 21:Xi(e,n,s);break;case 22:s.mode&1?(Ln=(a=Ln)||s.memoizedState!==null,Xi(e,n,s),Ln=a):Xi(e,n,s);break;default:Xi(e,n,s)}}function Ih(e){var n=e.updateQueue;if(n!==null){e.updateQueue=null;var s=e.stateNode;s===null&&(s=e.stateNode=new xv),n.forEach(function(a){var f=Dv.bind(null,e,a);s.has(a)||(s.add(a),a.then(f,f))})}}function Vr(e,n){var s=n.deletions;if(s!==null)for(var a=0;af&&(f=w),a&=~h}if(a=f,a=at()-a,a=(120>a?120:480>a?480:1080>a?1080:1920>a?1920:3e3>a?3e3:4320>a?4320:1960*Cv(a/1960))-a,10e?16:e,Zi===null)var a=!1;else{if(e=Zi,Zi=null,Ia=0,(Ye&6)!==0)throw Error(r(331));var f=Ye;for(Ye|=4,Se=e.current;Se!==null;){var h=Se,w=h.child;if((Se.flags&16)!==0){var k=h.deletions;if(k!==null){for(var b=0;bat()-Hc?Ts(e,0):Fc|=s),ir(e,n)}function Xh(e,n){n===0&&((e.mode&1)===0?n=1:(n=Di,Di<<=1,(Di&130023424)===0&&(Di=4194304)));var s=$n();e=xi(e,n),e!==null&&(Oi(e,n,s),ir(e,s))}function Mv(e){var n=e.memoizedState,s=0;n!==null&&(s=n.retryLane),Xh(e,s)}function Dv(e,n){var s=0;switch(e.tag){case 13:var a=e.stateNode,f=e.memoizedState;f!==null&&(s=f.retryLane);break;case 19:a=e.stateNode;break;default:throw Error(r(314))}a!==null&&a.delete(n),Xh(e,s)}var Jh;Jh=function(e,n,s){if(e!==null)if(e.memoizedProps!==n.pendingProps||er.current)nr=!0;else{if((e.lanes&s)===0&&(n.flags&128)===0)return nr=!1,yv(e,n,s);nr=(e.flags&131072)!==0}else nr=!1,xt&&(n.flags&1048576)!==0&&Dd(n,ga,n.index);switch(n.lanes=0,n.tag){case 2:var a=n.type;Da(e,n),e=n.pendingProps;var f=sl(n,Dn.current);fl(n,s),f=vc(null,n,a,e,f,s);var h=yc();return n.flags|=1,typeof f=="object"&&f!==null&&typeof f.render=="function"&&f.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,tr(a)?(h=!0,ha(n)):h=!1,n.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,cc(n),f.updater=Ta,n.stateNode=f,f._reactInternals=n,Cc(n,a,e,s),n=bc(null,n,a,!0,h,s)):(n.tag=0,xt&&h&&ec(n),Vn(null,n,f,s),n=n.child),n;case 16:a=n.elementType;e:{switch(Da(e,n),e=n.pendingProps,f=a._init,a=f(a._payload),n.type=a,f=n.tag=Ov(a),e=Br(a,e),f){case 0:n=Nc(null,n,a,e,s);break e;case 1:n=Ch(null,n,a,e,s);break e;case 11:n=wh(null,n,a,e,s);break e;case 14:n=Sh(null,n,a,Br(a.type,e),s);break e}throw Error(r(306,a,""))}return n;case 0:return a=n.type,f=n.pendingProps,f=n.elementType===a?f:Br(a,f),Nc(e,n,a,f,s);case 1:return a=n.type,f=n.pendingProps,f=n.elementType===a?f:Br(a,f),Ch(e,n,a,f,s);case 3:e:{if(kh(n),e===null)throw Error(r(387));a=n.pendingProps,h=n.memoizedState,f=h.element,Hd(e,n),_a(n,a,null,s);var w=n.memoizedState;if(a=w.element,h.isDehydrated)if(h={element:a,isDehydrated:!1,cache:w.cache,pendingSuspenseBoundaries:w.pendingSuspenseBoundaries,transitions:w.transitions},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){f=hl(Error(r(423)),n),n=Rh(e,n,a,s,f);break e}else if(a!==f){f=hl(Error(r(424)),n),n=Rh(e,n,a,s,f);break e}else for(vr=$i(n.stateNode.containerInfo.firstChild),gr=n,xt=!0,Wr=null,s=Id(n,null,a,s),n.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(al(),a===f){n=Ei(e,n,s);break e}Vn(e,n,a,s)}n=n.child}return n;case 5:return Ud(n),e===null&&rc(n),a=n.type,f=n.pendingProps,h=e!==null?e.memoizedProps:null,w=f.children,Yu(a,f)?w=null:h!==null&&Yu(a,h)&&(n.flags|=32),Eh(e,n),Vn(e,n,w,s),n.child;case 6:return e===null&&rc(n),null;case 13:return Nh(e,n,s);case 4:return fc(n,n.stateNode.containerInfo),a=n.pendingProps,e===null?n.child=ul(n,null,a,s):Vn(e,n,a,s),n.child;case 11:return a=n.type,f=n.pendingProps,f=n.elementType===a?f:Br(a,f),wh(e,n,a,f,s);case 7:return Vn(e,n,n.pendingProps,s),n.child;case 8:return Vn(e,n,n.pendingProps.children,s),n.child;case 12:return Vn(e,n,n.pendingProps.children,s),n.child;case 10:e:{if(a=n.type._context,f=n.pendingProps,h=n.memoizedProps,w=f.value,ht(wa,a._currentValue),a._currentValue=w,h!==null)if(ut(h.value,w)){if(h.children===f.children&&!er.current){n=Ei(e,n,s);break e}}else for(h=n.child,h!==null&&(h.return=n);h!==null;){var k=h.dependencies;if(k!==null){w=h.child;for(var b=k.firstContext;b!==null;){if(b.context===a){if(h.tag===1){b=_i(-1,s&-s),b.tag=2;var B=h.updateQueue;if(B!==null){B=B.shared;var re=B.pending;re===null?b.next=b:(b.next=re.next,re.next=b),B.pending=b}}h.lanes|=s,b=h.alternate,b!==null&&(b.lanes|=s),ac(h.return,s,n),k.lanes|=s;break}b=b.next}}else if(h.tag===10)w=h.type===n.type?null:h.child;else if(h.tag===18){if(w=h.return,w===null)throw Error(r(341));w.lanes|=s,k=w.alternate,k!==null&&(k.lanes|=s),ac(w,s,n),w=h.sibling}else w=h.child;if(w!==null)w.return=h;else for(w=h;w!==null;){if(w===n){w=null;break}if(h=w.sibling,h!==null){h.return=w.return,w=h;break}w=w.return}h=w}Vn(e,n,f.children,s),n=n.child}return n;case 9:return f=n.type,a=n.pendingProps.children,fl(n,s),f=Dr(f),a=a(f),n.flags|=1,Vn(e,n,a,s),n.child;case 14:return a=n.type,f=Br(a,n.pendingProps),f=Br(a.type,f),Sh(e,n,a,f,s);case 15:return xh(e,n,n.type,n.pendingProps,s);case 17:return a=n.type,f=n.pendingProps,f=n.elementType===a?f:Br(a,f),Da(e,n),n.tag=1,tr(a)?(e=!0,ha(n)):e=!1,fl(n,s),dh(n,a,f),Cc(n,a,f,s),bc(null,n,a,!0,e,s);case 19:return Th(e,n,s);case 22:return _h(e,n,s)}throw Error(r(156,n.tag))};function Zh(e,n){return zt(e,n)}function zv(e,n,s,a){this.tag=e,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Lr(e,n,s,a){return new zv(e,n,s,a)}function Yc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ov(e){if(typeof e=="function")return Yc(e)?1:0;if(e!=null){if(e=e.$$typeof,e===xe)return 11;if(e===ye)return 14}return 2}function ns(e,n){var s=e.alternate;return s===null?(s=Lr(e.tag,n,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=n,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=e.flags&14680064,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,n=e.dependencies,s.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s}function Ba(e,n,s,a,f,h){var w=2;if(a=e,typeof e=="function")Yc(e)&&(w=1);else if(typeof e=="string")w=5;else e:switch(e){case Y:return Ds(s.children,f,h,n);case Z:w=8,f|=8;break;case K:return e=Lr(12,s,n,f|2),e.elementType=K,e.lanes=h,e;case ce:return e=Lr(13,s,n,f),e.elementType=ce,e.lanes=h,e;case ge:return e=Lr(19,s,n,f),e.elementType=ge,e.lanes=h,e;case le:return Ua(s,f,h,n);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case fe:w=10;break e;case q:w=9;break e;case xe:w=11;break e;case ye:w=14;break e;case ke:w=16,a=null;break e}throw Error(r(130,e==null?e:typeof e,""))}return n=Lr(w,s,n,f),n.elementType=e,n.type=a,n.lanes=h,n}function Ds(e,n,s,a){return e=Lr(7,e,a,n),e.lanes=s,e}function Ua(e,n,s,a){return e=Lr(22,e,a,n),e.elementType=le,e.lanes=s,e.stateNode={isHidden:!1},e}function Qc(e,n,s){return e=Lr(6,e,null,n),e.lanes=s,e}function qc(e,n,s){return n=Lr(4,e.children!==null?e.children:[],e.key,n),n.lanes=s,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function Lv(e,n,s,a,f){this.tag=n,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Fl(0),this.expirationTimes=Fl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Fl(0),this.identifierPrefix=a,this.onRecoverableError=f,this.mutableSourceEagerHydrationData=null}function Xc(e,n,s,a,f,h,w,k,b){return e=new Lv(e,n,s,k,b),n===1?(n=1,h===!0&&(n|=8)):n=0,h=Lr(3,null,null,n),e.current=h,h.stateNode=e,h.memoizedState={element:a,isDehydrated:s,cache:null,transitions:null,pendingSuspenseBoundaries:null},cc(h),e}function Pv(e,n,s){var a=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l)}catch(t){console.error(t)}}return l(),rf.exports=Yv(),rf.exports}var hp;function Qv(){if(hp)return qa;hp=1;var l=Dm();return qa.createRoot=l.createRoot,qa.hydrateRoot=l.hydrateRoot,qa}var qv=Qv();const Xv=Mm(qv);var Ps=Dm();const xu=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ml(l){const t=Object.prototype.toString.call(l);return t==="[object Window]"||t==="[object global]"}function Wf(l){return"nodeType"in l}function Yn(l){var t,r;return l?Ml(l)?l:Wf(l)&&(t=(r=l.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function Bf(l){const{Document:t}=Yn(l);return l instanceof t}function Po(l){return Ml(l)?!1:l instanceof Yn(l).HTMLElement}function zm(l){return l instanceof Yn(l).SVGElement}function Dl(l){return l?Ml(l)?l.document:Wf(l)?Bf(l)?l:Po(l)||zm(l)?l.ownerDocument:document:document:document}const Ni=xu?P.useLayoutEffect:P.useEffect;function _u(l){const t=P.useRef(l);return Ni(()=>{t.current=l}),P.useCallback(function(){for(var r=arguments.length,i=new Array(r),o=0;o{l.current=setInterval(i,o)},[]),r=P.useCallback(()=>{l.current!==null&&(clearInterval(l.current),l.current=null)},[]);return[t,r]}function To(l,t){t===void 0&&(t=[l]);const r=P.useRef(l);return Ni(()=>{r.current!==l&&(r.current=l)},t),r}function Ao(l,t){const r=P.useRef();return P.useMemo(()=>{const i=l(r.current);return r.current=i,i},[...t])}function lu(l){const t=_u(l),r=P.useRef(null),i=P.useCallback(o=>{o!==r.current&&(t==null||t(o,r.current)),r.current=o},[]);return[r,i]}function ou(l){const t=P.useRef();return P.useEffect(()=>{t.current=l},[l]),t.current}let of={};function Eu(l,t){return P.useMemo(()=>{if(t)return t;const r=of[l]==null?0:of[l]+1;return of[l]=r,l+"-"+r},[l,t])}function Om(l){return function(t){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o{const d=Object.entries(c);for(const[p,g]of d){const y=u[p];y!=null&&(u[p]=y+l*g)}return u},{...t})}}const _l=Om(1),au=Om(-1);function Zv(l){return"clientX"in l&&"clientY"in l}function Uf(l){if(!l)return!1;const{KeyboardEvent:t}=Yn(l.target);return t&&l instanceof t}function ey(l){if(!l)return!1;const{TouchEvent:t}=Yn(l.target);return t&&l instanceof t}function uu(l){if(ey(l)){if(l.touches&&l.touches.length){const{clientX:t,clientY:r}=l.touches[0];return{x:t,y:r}}else if(l.changedTouches&&l.changedTouches.length){const{clientX:t,clientY:r}=l.changedTouches[0];return{x:t,y:r}}}return Zv(l)?{x:l.clientX,y:l.clientY}:null}const Mo=Object.freeze({Translate:{toString(l){if(!l)return;const{x:t,y:r}=l;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(l){if(!l)return;const{scaleX:t,scaleY:r}=l;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(l){if(l)return[Mo.Translate.toString(l),Mo.Scale.toString(l)].join(" ")}},Transition:{toString(l){let{property:t,duration:r,easing:i}=l;return t+" "+r+"ms "+i}}}),pp="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function ty(l){return l.matches(pp)?l:l.querySelector(pp)}const ny={display:"none"};function ry(l){let{id:t,value:r}=l;return pt.createElement("div",{id:t,style:ny},r)}function iy(l){let{id:t,announcement:r,ariaLiveType:i="assertive"}=l;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return pt.createElement("div",{id:t,style:o,role:"status","aria-live":i,"aria-atomic":!0},r)}function sy(){const[l,t]=P.useState("");return{announce:P.useCallback(i=>{i!=null&&t(i)},[]),announcement:l}}const Lm=P.createContext(null);function ly(l){const t=P.useContext(Lm);P.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(l)},[l,t])}function oy(){const[l]=P.useState(()=>new Set),t=P.useCallback(i=>(l.add(i),()=>l.delete(i)),[l]);return[P.useCallback(i=>{let{type:o,event:u}=i;l.forEach(c=>{var d;return(d=c[o])==null?void 0:d.call(c,u)})},[l]),t]}const ay={draggable:` + To pick up a draggable item, press the space bar. + While dragging, use the arrow keys to move the item. + Press space again to drop the item in its new position, or press escape to cancel. + `},uy={onDragStart(l){let{active:t}=l;return"Picked up draggable item "+t.id+"."},onDragOver(l){let{active:t,over:r}=l;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(l){let{active:t,over:r}=l;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(l){let{active:t}=l;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function cy(l){let{announcements:t=uy,container:r,hiddenTextDescribedById:i,screenReaderInstructions:o=ay}=l;const{announce:u,announcement:c}=sy(),d=Eu("DndLiveRegion"),[p,g]=P.useState(!1);if(P.useEffect(()=>{g(!0)},[]),ly(P.useMemo(()=>({onDragStart(v){let{active:x}=v;u(t.onDragStart({active:x}))},onDragMove(v){let{active:x,over:T}=v;t.onDragMove&&u(t.onDragMove({active:x,over:T}))},onDragOver(v){let{active:x,over:T}=v;u(t.onDragOver({active:x,over:T}))},onDragEnd(v){let{active:x,over:T}=v;u(t.onDragEnd({active:x,over:T}))},onDragCancel(v){let{active:x,over:T}=v;u(t.onDragCancel({active:x,over:T}))}}),[u,t])),!p)return null;const y=pt.createElement(pt.Fragment,null,pt.createElement(ry,{id:i,value:o.draggable}),pt.createElement(iy,{id:d,announcement:c}));return r?Ps.createPortal(y,r):y}var tn;(function(l){l.DragStart="dragStart",l.DragMove="dragMove",l.DragEnd="dragEnd",l.DragCancel="dragCancel",l.DragOver="dragOver",l.RegisterDroppable="registerDroppable",l.SetDroppableDisabled="setDroppableDisabled",l.UnregisterDroppable="unregisterDroppable"})(tn||(tn={}));function cu(){}function fy(l,t){return P.useMemo(()=>({sensor:l,options:t??{}}),[l,t])}function dy(){for(var l=arguments.length,t=new Array(l),r=0;r[...t].filter(i=>i!=null),[...t])}const qr=Object.freeze({x:0,y:0});function hy(l,t){const r=uu(l);if(!r)return"0 0";const i={x:(r.x-t.left)/t.width*100,y:(r.y-t.top)/t.height*100};return i.x+"% "+i.y+"%"}function py(l,t){let{data:{value:r}}=l,{data:{value:i}}=t;return i-r}function my(l,t){if(!l||l.length===0)return null;const[r]=l;return r[t]}function gy(l,t){const r=Math.max(t.top,l.top),i=Math.max(t.left,l.left),o=Math.min(t.left+t.width,l.left+l.width),u=Math.min(t.top+t.height,l.top+l.height),c=o-i,d=u-r;if(i{let{collisionRect:t,droppableRects:r,droppableContainers:i}=l;const o=[];for(const u of i){const{id:c}=u,d=r.get(c);if(d){const p=gy(d,t);p>0&&o.push({id:c,data:{droppableContainer:u,value:p}})}}return o.sort(py)};function yy(l,t,r){return{...l,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function Pm(l,t){return l&&t?{x:l.left-t.left,y:l.top-t.top}:qr}function wy(l){return function(r){for(var i=arguments.length,o=new Array(i>1?i-1:0),u=1;u({...c,top:c.top+l*d.y,bottom:c.bottom+l*d.y,left:c.left+l*d.x,right:c.right+l*d.x}),{...r})}}const Sy=wy(1);function Am(l){if(l.startsWith("matrix3d(")){const t=l.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(l.startsWith("matrix(")){const t=l.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function xy(l,t,r){const i=Am(t);if(!i)return l;const{scaleX:o,scaleY:u,x:c,y:d}=i,p=l.left-c-(1-o)*parseFloat(r),g=l.top-d-(1-u)*parseFloat(r.slice(r.indexOf(" ")+1)),y=o?l.width/o:l.width,v=u?l.height/u:l.height;return{width:y,height:v,top:g,right:p+y,bottom:g+v,left:p}}const _y={ignoreTransform:!1};function jo(l,t){t===void 0&&(t=_y);let r=l.getBoundingClientRect();if(t.ignoreTransform){const{transform:g,transformOrigin:y}=Yn(l).getComputedStyle(l);g&&(r=xy(r,g,y))}const{top:i,left:o,width:u,height:c,bottom:d,right:p}=r;return{top:i,left:o,width:u,height:c,bottom:d,right:p}}function mp(l){return jo(l,{ignoreTransform:!0})}function Ey(l){const t=l.innerWidth,r=l.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function Cy(l,t){return t===void 0&&(t=Yn(l).getComputedStyle(l)),t.position==="fixed"}function ky(l,t){t===void 0&&(t=Yn(l).getComputedStyle(l));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const u=t[o];return typeof u=="string"?r.test(u):!1})}function Vf(l,t){const r=[];function i(o){if(t!=null&&r.length>=t||!o)return r;if(Bf(o)&&o.scrollingElement!=null&&!r.includes(o.scrollingElement))return r.push(o.scrollingElement),r;if(!Po(o)||zm(o)||r.includes(o))return r;const u=Yn(l).getComputedStyle(o);return o!==l&&ky(o,u)&&r.push(o),Cy(o,u)?r:i(o.parentNode)}return l?i(l):r}function jm(l){const[t]=Vf(l,1);return t??null}function af(l){return!xu||!l?null:Ml(l)?l:Wf(l)?Bf(l)||l===Dl(l).scrollingElement?window:Po(l)?l:null:null}function Im(l){return Ml(l)?l.scrollX:l.scrollLeft}function Fm(l){return Ml(l)?l.scrollY:l.scrollTop}function kf(l){return{x:Im(l),y:Fm(l)}}var mn;(function(l){l[l.Forward=1]="Forward",l[l.Backward=-1]="Backward"})(mn||(mn={}));function Hm(l){return!xu||!l?!1:l===document.scrollingElement}function Wm(l){const t={x:0,y:0},r=Hm(l)?{height:window.innerHeight,width:window.innerWidth}:{height:l.clientHeight,width:l.clientWidth},i={x:l.scrollWidth-r.width,y:l.scrollHeight-r.height},o=l.scrollTop<=t.y,u=l.scrollLeft<=t.x,c=l.scrollTop>=i.y,d=l.scrollLeft>=i.x;return{isTop:o,isLeft:u,isBottom:c,isRight:d,maxScroll:i,minScroll:t}}const Ry={x:.2,y:.2};function Ny(l,t,r,i,o){let{top:u,left:c,right:d,bottom:p}=r;i===void 0&&(i=10),o===void 0&&(o=Ry);const{isTop:g,isBottom:y,isLeft:v,isRight:x}=Wm(l),T={x:0,y:0},N={x:0,y:0},C={height:t.height*o.y,width:t.width*o.x};return!g&&u<=t.top+C.height?(T.y=mn.Backward,N.y=i*Math.abs((t.top+C.height-u)/C.height)):!y&&p>=t.bottom-C.height&&(T.y=mn.Forward,N.y=i*Math.abs((t.bottom-C.height-p)/C.height)),!x&&d>=t.right-C.width?(T.x=mn.Forward,N.x=i*Math.abs((t.right-C.width-d)/C.width)):!v&&c<=t.left+C.width&&(T.x=mn.Backward,N.x=i*Math.abs((t.left+C.width-c)/C.width)),{direction:T,speed:N}}function by(l){if(l===document.scrollingElement){const{innerWidth:u,innerHeight:c}=window;return{top:0,left:0,right:u,bottom:c,width:u,height:c}}const{top:t,left:r,right:i,bottom:o}=l.getBoundingClientRect();return{top:t,left:r,right:i,bottom:o,width:l.clientWidth,height:l.clientHeight}}function Bm(l){return l.reduce((t,r)=>_l(t,kf(r)),qr)}function Ty(l){return l.reduce((t,r)=>t+Im(r),0)}function My(l){return l.reduce((t,r)=>t+Fm(r),0)}function Um(l,t){if(t===void 0&&(t=jo),!l)return;const{top:r,left:i,bottom:o,right:u}=t(l);jm(l)&&(o<=0||u<=0||r>=window.innerHeight||i>=window.innerWidth)&&l.scrollIntoView({block:"center",inline:"center"})}const Dy=[["x",["left","right"],Ty],["y",["top","bottom"],My]];class $f{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const i=Vf(r),o=Bm(i);this.rect={...t},this.width=t.width,this.height=t.height;for(const[u,c,d]of Dy)for(const p of c)Object.defineProperty(this,p,{get:()=>{const g=d(i),y=o[u]-g;return this.rect[p]+y},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Eo{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var i;return(i=this.target)==null?void 0:i.removeEventListener(...r)})},this.target=t}add(t,r,i){var o;(o=this.target)==null||o.addEventListener(t,r,i),this.listeners.push([t,r,i])}}function zy(l){const{EventTarget:t}=Yn(l);return l instanceof t?l:Dl(l)}function uf(l,t){const r=Math.abs(l.x),i=Math.abs(l.y);return typeof t=="number"?Math.sqrt(r**2+i**2)>t:"x"in t&&"y"in t?r>t.x&&i>t.y:"x"in t?r>t.x:"y"in t?i>t.y:!1}var Ar;(function(l){l.Click="click",l.DragStart="dragstart",l.Keydown="keydown",l.ContextMenu="contextmenu",l.Resize="resize",l.SelectionChange="selectionchange",l.VisibilityChange="visibilitychange"})(Ar||(Ar={}));function gp(l){l.preventDefault()}function Oy(l){l.stopPropagation()}var ct;(function(l){l.Space="Space",l.Down="ArrowDown",l.Right="ArrowRight",l.Left="ArrowLeft",l.Up="ArrowUp",l.Esc="Escape",l.Enter="Enter",l.Tab="Tab"})(ct||(ct={}));const Vm={start:[ct.Space,ct.Enter],cancel:[ct.Esc],end:[ct.Space,ct.Enter,ct.Tab]},Ly=(l,t)=>{let{currentCoordinates:r}=t;switch(l.code){case ct.Right:return{...r,x:r.x+25};case ct.Left:return{...r,x:r.x-25};case ct.Down:return{...r,y:r.y+25};case ct.Up:return{...r,y:r.y-25}}};class $m{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:r}}=t;this.props=t,this.listeners=new Eo(Dl(r)),this.windowListeners=new Eo(Yn(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Ar.Resize,this.handleCancel),this.windowListeners.add(Ar.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Ar.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,i=t.node.current;i&&Um(i),r(qr)}handleKeyDown(t){if(Uf(t)){const{active:r,context:i,options:o}=this.props,{keyboardCodes:u=Vm,coordinateGetter:c=Ly,scrollBehavior:d="smooth"}=o,{code:p}=t;if(u.end.includes(p)){this.handleEnd(t);return}if(u.cancel.includes(p)){this.handleCancel(t);return}const{collisionRect:g}=i.current,y=g?{x:g.left,y:g.top}:qr;this.referenceCoordinates||(this.referenceCoordinates=y);const v=c(t,{active:r,context:i.current,currentCoordinates:y});if(v){const x=au(v,y),T={x:0,y:0},{scrollableAncestors:N}=i.current;for(const C of N){const L=t.code,{isTop:U,isRight:A,isLeft:V,isBottom:z,maxScroll:$,minScroll:G}=Wm(C),Y=by(C),Z={x:Math.min(L===ct.Right?Y.right-Y.width/2:Y.right,Math.max(L===ct.Right?Y.left:Y.left+Y.width/2,v.x)),y:Math.min(L===ct.Down?Y.bottom-Y.height/2:Y.bottom,Math.max(L===ct.Down?Y.top:Y.top+Y.height/2,v.y))},K=L===ct.Right&&!A||L===ct.Left&&!V,fe=L===ct.Down&&!z||L===ct.Up&&!U;if(K&&Z.x!==v.x){const q=C.scrollLeft+x.x,xe=L===ct.Right&&q<=$.x||L===ct.Left&&q>=G.x;if(xe&&!x.y){C.scrollTo({left:q,behavior:d});return}xe?T.x=C.scrollLeft-q:T.x=L===ct.Right?C.scrollLeft-$.x:C.scrollLeft-G.x,T.x&&C.scrollBy({left:-T.x,behavior:d});break}else if(fe&&Z.y!==v.y){const q=C.scrollTop+x.y,xe=L===ct.Down&&q<=$.y||L===ct.Up&&q>=G.y;if(xe&&!x.x){C.scrollTo({top:q,behavior:d});return}xe?T.y=C.scrollTop-q:T.y=L===ct.Down?C.scrollTop-$.y:C.scrollTop-G.y,T.y&&C.scrollBy({top:-T.y,behavior:d});break}}this.handleMove(t,_l(au(v,this.referenceCoordinates),T))}}}handleMove(t,r){const{onMove:i}=this.props;t.preventDefault(),i(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}$m.activators=[{eventName:"onKeyDown",handler:(l,t,r)=>{let{keyboardCodes:i=Vm,onActivation:o}=t,{active:u}=r;const{code:c}=l.nativeEvent;if(i.start.includes(c)){const d=u.activatorNode.current;return d&&l.target!==d?!1:(l.preventDefault(),o==null||o({event:l.nativeEvent}),!0)}return!1}}];function vp(l){return!!(l&&"distance"in l)}function yp(l){return!!(l&&"delay"in l)}class Gf{constructor(t,r,i){var o;i===void 0&&(i=zy(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;const{event:u}=t,{target:c}=u;this.props=t,this.events=r,this.document=Dl(c),this.documentListeners=new Eo(this.document),this.listeners=new Eo(i),this.windowListeners=new Eo(Yn(c)),this.initialCoordinates=(o=uu(u))!=null?o:qr,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:i}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Ar.Resize,this.handleCancel),this.windowListeners.add(Ar.DragStart,gp),this.windowListeners.add(Ar.VisibilityChange,this.handleCancel),this.windowListeners.add(Ar.ContextMenu,gp),this.documentListeners.add(Ar.Keydown,this.handleKeydown),r){if(i!=null&&i({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(yp(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(vp(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,r){const{active:i,onPending:o}=this.props;o(i,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(Ar.Click,Oy,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Ar.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:i,initialCoordinates:o,props:u}=this,{onMove:c,options:{activationConstraint:d}}=u;if(!o)return;const p=(r=uu(t))!=null?r:qr,g=au(o,p);if(!i&&d){if(vp(d)){if(d.tolerance!=null&&uf(g,d.tolerance))return this.handleCancel();if(uf(g,d.distance))return this.handleStart()}if(yp(d)&&uf(g,d.tolerance))return this.handleCancel();this.handlePending(d,g);return}t.cancelable&&t.preventDefault(),c(p)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===ct.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Py={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Kf extends Gf{constructor(t){const{event:r}=t,i=Dl(r.target);super(t,Py,i)}}Kf.activators=[{eventName:"onPointerDown",handler:(l,t)=>{let{nativeEvent:r}=l,{onActivation:i}=t;return!r.isPrimary||r.button!==0?!1:(i==null||i({event:r}),!0)}}];const Ay={move:{name:"mousemove"},end:{name:"mouseup"}};var Rf;(function(l){l[l.RightClick=2]="RightClick"})(Rf||(Rf={}));class jy extends Gf{constructor(t){super(t,Ay,Dl(t.event.target))}}jy.activators=[{eventName:"onMouseDown",handler:(l,t)=>{let{nativeEvent:r}=l,{onActivation:i}=t;return r.button===Rf.RightClick?!1:(i==null||i({event:r}),!0)}}];const cf={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Iy extends Gf{constructor(t){super(t,cf)}static setup(){return window.addEventListener(cf.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(cf.move.name,t)};function t(){}}}Iy.activators=[{eventName:"onTouchStart",handler:(l,t)=>{let{nativeEvent:r}=l,{onActivation:i}=t;const{touches:o}=r;return o.length>1?!1:(i==null||i({event:r}),!0)}}];var Co;(function(l){l[l.Pointer=0]="Pointer",l[l.DraggableRect=1]="DraggableRect"})(Co||(Co={}));var fu;(function(l){l[l.TreeOrder=0]="TreeOrder",l[l.ReversedTreeOrder=1]="ReversedTreeOrder"})(fu||(fu={}));function Fy(l){let{acceleration:t,activator:r=Co.Pointer,canScroll:i,draggingRect:o,enabled:u,interval:c=5,order:d=fu.TreeOrder,pointerCoordinates:p,scrollableAncestors:g,scrollableAncestorRects:y,delta:v,threshold:x}=l;const T=Wy({delta:v,disabled:!u}),[N,C]=Jv(),L=P.useRef({x:0,y:0}),U=P.useRef({x:0,y:0}),A=P.useMemo(()=>{switch(r){case Co.Pointer:return p?{top:p.y,bottom:p.y,left:p.x,right:p.x}:null;case Co.DraggableRect:return o}},[r,o,p]),V=P.useRef(null),z=P.useCallback(()=>{const G=V.current;if(!G)return;const Y=L.current.x*U.current.x,Z=L.current.y*U.current.y;G.scrollBy(Y,Z)},[]),$=P.useMemo(()=>d===fu.TreeOrder?[...g].reverse():g,[d,g]);P.useEffect(()=>{if(!u||!g.length||!A){C();return}for(const G of $){if((i==null?void 0:i(G))===!1)continue;const Y=g.indexOf(G),Z=y[Y];if(!Z)continue;const{direction:K,speed:fe}=Ny(G,Z,A,t,x);for(const q of["x","y"])T[q][K[q]]||(fe[q]=0,K[q]=0);if(fe.x>0||fe.y>0){C(),V.current=G,N(z,c),L.current=fe,U.current=K;return}}L.current={x:0,y:0},U.current={x:0,y:0},C()},[t,z,i,C,u,c,JSON.stringify(A),JSON.stringify(T),N,g,$,y,JSON.stringify(x)])}const Hy={x:{[mn.Backward]:!1,[mn.Forward]:!1},y:{[mn.Backward]:!1,[mn.Forward]:!1}};function Wy(l){let{delta:t,disabled:r}=l;const i=ou(t);return Ao(o=>{if(r||!i||!o)return Hy;const u={x:Math.sign(t.x-i.x),y:Math.sign(t.y-i.y)};return{x:{[mn.Backward]:o.x[mn.Backward]||u.x===-1,[mn.Forward]:o.x[mn.Forward]||u.x===1},y:{[mn.Backward]:o.y[mn.Backward]||u.y===-1,[mn.Forward]:o.y[mn.Forward]||u.y===1}}},[r,t,i])}function By(l,t){const r=t!=null?l.get(t):void 0,i=r?r.node.current:null;return Ao(o=>{var u;return t==null?null:(u=i??o)!=null?u:null},[i,t])}function Uy(l,t){return P.useMemo(()=>l.reduce((r,i)=>{const{sensor:o}=i,u=o.activators.map(c=>({eventName:c.eventName,handler:t(c.handler,i)}));return[...r,...u]},[]),[l,t])}var Do;(function(l){l[l.Always=0]="Always",l[l.BeforeDragging=1]="BeforeDragging",l[l.WhileDragging=2]="WhileDragging"})(Do||(Do={}));var Nf;(function(l){l.Optimized="optimized"})(Nf||(Nf={}));const wp=new Map;function Vy(l,t){let{dragging:r,dependencies:i,config:o}=t;const[u,c]=P.useState(null),{frequency:d,measure:p,strategy:g}=o,y=P.useRef(l),v=L(),x=To(v),T=P.useCallback(function(U){U===void 0&&(U=[]),!x.current&&c(A=>A===null?U:A.concat(U.filter(V=>!A.includes(V))))},[x]),N=P.useRef(null),C=Ao(U=>{if(v&&!r)return wp;if(!U||U===wp||y.current!==l||u!=null){const A=new Map;for(let V of l){if(!V)continue;if(u&&u.length>0&&!u.includes(V.id)&&V.rect.current){A.set(V.id,V.rect.current);continue}const z=V.node.current,$=z?new $f(p(z),z):null;V.rect.current=$,$&&A.set(V.id,$)}return A}return U},[l,u,r,v,p]);return P.useEffect(()=>{y.current=l},[l]),P.useEffect(()=>{v||T()},[r,v]),P.useEffect(()=>{u&&u.length>0&&c(null)},[JSON.stringify(u)]),P.useEffect(()=>{v||typeof d!="number"||N.current!==null||(N.current=setTimeout(()=>{T(),N.current=null},d))},[d,v,T,...i]),{droppableRects:C,measureDroppableContainers:T,measuringScheduled:u!=null};function L(){switch(g){case Do.Always:return!1;case Do.BeforeDragging:return r;default:return!r}}}function Yf(l,t){return Ao(r=>l?r||(typeof t=="function"?t(l):l):null,[t,l])}function $y(l,t){return Yf(l,t)}function Gy(l){let{callback:t,disabled:r}=l;const i=_u(t),o=P.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:u}=window;return new u(i)},[i,r]);return P.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function Cu(l){let{callback:t,disabled:r}=l;const i=_u(t),o=P.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:u}=window;return new u(i)},[r]);return P.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function Ky(l){return new $f(jo(l),l)}function Sp(l,t,r){t===void 0&&(t=Ky);const[i,o]=P.useState(null);function u(){o(p=>{if(!l)return null;if(l.isConnected===!1){var g;return(g=p??r)!=null?g:null}const y=t(l);return JSON.stringify(p)===JSON.stringify(y)?p:y})}const c=Gy({callback(p){if(l)for(const g of p){const{type:y,target:v}=g;if(y==="childList"&&v instanceof HTMLElement&&v.contains(l)){u();break}}}}),d=Cu({callback:u});return Ni(()=>{u(),l?(d==null||d.observe(l),c==null||c.observe(document.body,{childList:!0,subtree:!0})):(d==null||d.disconnect(),c==null||c.disconnect())},[l]),i}function Yy(l){const t=Yf(l);return Pm(l,t)}const xp=[];function Qy(l){const t=P.useRef(l),r=Ao(i=>l?i&&i!==xp&&l&&t.current&&l.parentNode===t.current.parentNode?i:Vf(l):xp,[l]);return P.useEffect(()=>{t.current=l},[l]),r}function qy(l){const[t,r]=P.useState(null),i=P.useRef(l),o=P.useCallback(u=>{const c=af(u.target);c&&r(d=>d?(d.set(c,kf(c)),new Map(d)):null)},[]);return P.useEffect(()=>{const u=i.current;if(l!==u){c(u);const d=l.map(p=>{const g=af(p);return g?(g.addEventListener("scroll",o,{passive:!0}),[g,kf(g)]):null}).filter(p=>p!=null);r(d.length?new Map(d):null),i.current=l}return()=>{c(l),c(u)};function c(d){d.forEach(p=>{const g=af(p);g==null||g.removeEventListener("scroll",o)})}},[o,l]),P.useMemo(()=>l.length?t?Array.from(t.values()).reduce((u,c)=>_l(u,c),qr):Bm(l):qr,[l,t])}function _p(l,t){t===void 0&&(t=[]);const r=P.useRef(null);return P.useEffect(()=>{r.current=null},t),P.useEffect(()=>{const i=l!==qr;i&&!r.current&&(r.current=l),!i&&r.current&&(r.current=null)},[l]),r.current?au(l,r.current):qr}function Xy(l){P.useEffect(()=>{if(!xu)return;const t=l.map(r=>{let{sensor:i}=r;return i.setup==null?void 0:i.setup()});return()=>{for(const r of t)r==null||r()}},l.map(t=>{let{sensor:r}=t;return r}))}function Jy(l,t){return P.useMemo(()=>l.reduce((r,i)=>{let{eventName:o,handler:u}=i;return r[o]=c=>{u(c,t)},r},{}),[l,t])}function Gm(l){return P.useMemo(()=>l?Ey(l):null,[l])}const Ep=[];function Zy(l,t){t===void 0&&(t=jo);const[r]=l,i=Gm(r?Yn(r):null),[o,u]=P.useState(Ep);function c(){u(()=>l.length?l.map(p=>Hm(p)?i:new $f(t(p),p)):Ep)}const d=Cu({callback:c});return Ni(()=>{d==null||d.disconnect(),c(),l.forEach(p=>d==null?void 0:d.observe(p))},[l]),o}function Km(l){if(!l)return null;if(l.children.length>1)return l;const t=l.children[0];return Po(t)?t:l}function e0(l){let{measure:t}=l;const[r,i]=P.useState(null),o=P.useCallback(g=>{for(const{target:y}of g)if(Po(y)){i(v=>{const x=t(y);return v?{...v,width:x.width,height:x.height}:x});break}},[t]),u=Cu({callback:o}),c=P.useCallback(g=>{const y=Km(g);u==null||u.disconnect(),y&&(u==null||u.observe(y)),i(y?t(y):null)},[t,u]),[d,p]=lu(c);return P.useMemo(()=>({nodeRef:d,rect:r,setRef:p}),[r,d,p])}const t0=[{sensor:Kf,options:{}},{sensor:$m,options:{}}],n0={current:{}},eu={draggable:{measure:mp},droppable:{measure:mp,strategy:Do.WhileDragging,frequency:Nf.Optimized},dragOverlay:{measure:jo}};class ko extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,i;return(r=(i=this.get(t))==null?void 0:i.node.current)!=null?r:void 0}}const r0={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new ko,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:cu},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:eu,measureDroppableContainers:cu,windowRect:null,measuringScheduled:!1},Ym={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:cu,draggableNodes:new Map,over:null,measureDroppableContainers:cu},Io=P.createContext(Ym),Qm=P.createContext(r0);function i0(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new ko}}}function s0(l,t){switch(t.type){case tn.DragStart:return{...l,draggable:{...l.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case tn.DragMove:return l.draggable.active==null?l:{...l,draggable:{...l.draggable,translate:{x:t.coordinates.x-l.draggable.initialCoordinates.x,y:t.coordinates.y-l.draggable.initialCoordinates.y}}};case tn.DragEnd:case tn.DragCancel:return{...l,draggable:{...l.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case tn.RegisterDroppable:{const{element:r}=t,{id:i}=r,o=new ko(l.droppable.containers);return o.set(i,r),{...l,droppable:{...l.droppable,containers:o}}}case tn.SetDroppableDisabled:{const{id:r,key:i,disabled:o}=t,u=l.droppable.containers.get(r);if(!u||i!==u.key)return l;const c=new ko(l.droppable.containers);return c.set(r,{...u,disabled:o}),{...l,droppable:{...l.droppable,containers:c}}}case tn.UnregisterDroppable:{const{id:r,key:i}=t,o=l.droppable.containers.get(r);if(!o||i!==o.key)return l;const u=new ko(l.droppable.containers);return u.delete(r),{...l,droppable:{...l.droppable,containers:u}}}default:return l}}function l0(l){let{disabled:t}=l;const{active:r,activatorEvent:i,draggableNodes:o}=P.useContext(Io),u=ou(i),c=ou(r==null?void 0:r.id);return P.useEffect(()=>{if(!t&&!i&&u&&c!=null){if(!Uf(u)||document.activeElement===u.target)return;const d=o.get(c);if(!d)return;const{activatorNode:p,node:g}=d;if(!p.current&&!g.current)return;requestAnimationFrame(()=>{for(const y of[p.current,g.current]){if(!y)continue;const v=ty(y);if(v){v.focus();break}}})}},[i,t,o,c,u]),null}function qm(l,t){let{transform:r,...i}=t;return l!=null&&l.length?l.reduce((o,u)=>u({transform:o,...i}),r):r}function o0(l){return P.useMemo(()=>({draggable:{...eu.draggable,...l==null?void 0:l.draggable},droppable:{...eu.droppable,...l==null?void 0:l.droppable},dragOverlay:{...eu.dragOverlay,...l==null?void 0:l.dragOverlay}}),[l==null?void 0:l.draggable,l==null?void 0:l.droppable,l==null?void 0:l.dragOverlay])}function a0(l){let{activeNode:t,measure:r,initialRect:i,config:o=!0}=l;const u=P.useRef(!1),{x:c,y:d}=typeof o=="boolean"?{x:o,y:o}:o;Ni(()=>{if(!c&&!d||!t){u.current=!1;return}if(u.current||!i)return;const g=t==null?void 0:t.node.current;if(!g||g.isConnected===!1)return;const y=r(g),v=Pm(y,i);if(c||(v.x=0),d||(v.y=0),u.current=!0,Math.abs(v.x)>0||Math.abs(v.y)>0){const x=jm(g);x&&x.scrollBy({top:v.y,left:v.x})}},[t,c,d,i,r])}const ku=P.createContext({...qr,scaleX:1,scaleY:1});var ss;(function(l){l[l.Uninitialized=0]="Uninitialized",l[l.Initializing=1]="Initializing",l[l.Initialized=2]="Initialized"})(ss||(ss={}));const u0=P.memo(function(t){var r,i,o,u;let{id:c,accessibility:d,autoScroll:p=!0,children:g,sensors:y=t0,collisionDetection:v=vy,measuring:x,modifiers:T,...N}=t;const C=P.useReducer(s0,void 0,i0),[L,U]=C,[A,V]=oy(),[z,$]=P.useState(ss.Uninitialized),G=z===ss.Initialized,{draggable:{active:Y,nodes:Z,translate:K},droppable:{containers:fe}}=L,q=Y!=null?Z.get(Y):null,xe=P.useRef({initial:null,translated:null}),ce=P.useMemo(()=>{var ot;return Y!=null?{id:Y,data:(ot=q==null?void 0:q.data)!=null?ot:n0,rect:xe}:null},[Y,q]),ge=P.useRef(null),[ye,ke]=P.useState(null),[le,oe]=P.useState(null),ae=To(N,Object.values(N)),J=Eu("DndDescribedBy",c),M=P.useMemo(()=>fe.getEnabled(),[fe]),W=o0(x),{droppableRects:X,measureDroppableContainers:ee,measuringScheduled:be}=Vy(M,{dragging:G,dependencies:[K.x,K.y],config:W.droppable}),he=By(Z,Y),Ee=P.useMemo(()=>le?uu(le):null,[le]),Ie=Dt(),Fe=$y(he,W.draggable.measure);a0({activeNode:Y!=null?Z.get(Y):null,config:Ie.layoutShiftCompensation,initialRect:Fe,measure:W.draggable.measure});const Oe=Sp(he,W.draggable.measure,Fe),Gt=Sp(he?he.parentElement:null),At=P.useRef({activatorEvent:null,active:null,activeNode:he,collisionRect:null,collisions:null,droppableRects:X,draggableNodes:Z,draggingNode:null,draggingNodeRect:null,droppableContainers:fe,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),jt=fe.getNodeFor((r=At.current.over)==null?void 0:r.id),It=e0({measure:W.dragOverlay.measure}),Qn=(i=It.nodeRef.current)!=null?i:he,kn=G?(o=It.rect)!=null?o:Oe:null,Er=!!(It.nodeRef.current&&It.rect),Xr=Yy(Er?null:Oe),An=Gm(Qn?Yn(Qn):null),et=Qy(G?jt??he:null),rn=Zy(et),sn=qm(T,{transform:{x:K.x-Xr.x,y:K.y-Xr.y,scaleX:1,scaleY:1},activatorEvent:le,active:ce,activeNodeRect:Oe,containerNodeRect:Gt,draggingNodeRect:kn,over:At.current.over,overlayNodeRect:It.rect,scrollableAncestors:et,scrollableAncestorRects:rn,windowRect:An}),lr=Ee?_l(Ee,K):null,Pe=qy(et),pe=_p(Pe),Je=_p(Pe,[Oe]),tt=_l(sn,pe),ln=kn?Sy(kn,sn):null,Rn=ce&&ln?v({active:ce,collisionRect:ln,droppableRects:X,droppableContainers:M,pointerCoordinates:lr}):null,Kt=my(Rn,"id"),[Nt,on]=P.useState(null),gn=Er?sn:_l(sn,Je),Yt=yy(gn,(u=Nt==null?void 0:Nt.rect)!=null?u:null,Oe),vn=P.useRef(null),Jr=P.useCallback((ot,Qt)=>{let{sensor:an,options:ur}=Qt;if(ge.current==null)return;const yn=Z.get(ge.current);if(!yn)return;const un=ot.nativeEvent,Nn=new an({active:ge.current,activeNode:yn,event:un,options:ur,context:At,onAbort(Be){if(!Z.get(Be))return;const{onDragAbort:Et}=ae.current,cn={id:Be};Et==null||Et(cn),A({type:"onDragAbort",event:cn})},onPending(Be,_t,Et,cn){if(!Z.get(Be))return;const{onDragPending:Sn}=ae.current,Ft={id:Be,constraint:_t,initialCoordinates:Et,offset:cn};Sn==null||Sn(Ft),A({type:"onDragPending",event:Ft})},onStart(Be){const _t=ge.current;if(_t==null)return;const Et=Z.get(_t);if(!Et)return;const{onDragStart:cn}=ae.current,yt={activatorEvent:un,active:{id:_t,data:Et.data,rect:xe}};Ps.unstable_batchedUpdates(()=>{cn==null||cn(yt),$(ss.Initializing),U({type:tn.DragStart,initialCoordinates:Be,active:_t}),A({type:"onDragStart",event:yt}),ke(vn.current),oe(un)})},onMove(Be){U({type:tn.DragMove,coordinates:Be})},onEnd:wn(tn.DragEnd),onCancel:wn(tn.DragCancel)});vn.current=Nn;function wn(Be){return async function(){const{active:Et,collisions:cn,over:yt,scrollAdjustedTranslate:Sn}=At.current;let Ft=null;if(Et&&Sn){const{cancelDrop:Cr}=ae.current;Ft={activatorEvent:un,active:Et,collisions:cn,delta:Sn,over:yt},Be===tn.DragEnd&&typeof Cr=="function"&&await Promise.resolve(Cr(Ft))&&(Be=tn.DragCancel)}ge.current=null,Ps.unstable_batchedUpdates(()=>{U({type:Be}),$(ss.Uninitialized),on(null),ke(null),oe(null),vn.current=null;const Cr=Be===tn.DragEnd?"onDragEnd":"onDragCancel";if(Ft){const bi=ae.current[Cr];bi==null||bi(Ft),A({type:Cr,event:Ft})}})}}},[Z]),Zr=P.useCallback((ot,Qt)=>(an,ur)=>{const yn=an.nativeEvent,un=Z.get(ur);if(ge.current!==null||!un||yn.dndKit||yn.defaultPrevented)return;const Nn={active:un};ot(an,Qt.options,Nn)===!0&&(yn.dndKit={capturedBy:Qt.sensor},ge.current=ur,Jr(an,Qt))},[Z,Jr]),or=Uy(y,Zr);Xy(y),Ni(()=>{Oe&&z===ss.Initializing&&$(ss.Initialized)},[Oe,z]),P.useEffect(()=>{const{onDragMove:ot}=ae.current,{active:Qt,activatorEvent:an,collisions:ur,over:yn}=At.current;if(!Qt||!an)return;const un={active:Qt,activatorEvent:an,collisions:ur,delta:{x:tt.x,y:tt.y},over:yn};Ps.unstable_batchedUpdates(()=>{ot==null||ot(un),A({type:"onDragMove",event:un})})},[tt.x,tt.y]),P.useEffect(()=>{const{active:ot,activatorEvent:Qt,collisions:an,droppableContainers:ur,scrollAdjustedTranslate:yn}=At.current;if(!ot||ge.current==null||!Qt||!yn)return;const{onDragOver:un}=ae.current,Nn=ur.get(Kt),wn=Nn&&Nn.rect.current?{id:Nn.id,rect:Nn.rect.current,data:Nn.data,disabled:Nn.disabled}:null,Be={active:ot,activatorEvent:Qt,collisions:an,delta:{x:yn.x,y:yn.y},over:wn};Ps.unstable_batchedUpdates(()=>{on(wn),un==null||un(Be),A({type:"onDragOver",event:Be})})},[Kt]),Ni(()=>{At.current={activatorEvent:le,active:ce,activeNode:he,collisionRect:ln,collisions:Rn,droppableRects:X,draggableNodes:Z,draggingNode:Qn,draggingNodeRect:kn,droppableContainers:fe,over:Nt,scrollableAncestors:et,scrollAdjustedTranslate:tt},xe.current={initial:kn,translated:ln}},[ce,he,Rn,ln,Z,Qn,kn,X,fe,Nt,et,tt]),Fy({...Ie,delta:K,draggingRect:ln,pointerCoordinates:lr,scrollableAncestors:et,scrollableAncestorRects:rn});const ar=P.useMemo(()=>({active:ce,activeNode:he,activeNodeRect:Oe,activatorEvent:le,collisions:Rn,containerNodeRect:Gt,dragOverlay:It,draggableNodes:Z,droppableContainers:fe,droppableRects:X,over:Nt,measureDroppableContainers:ee,scrollableAncestors:et,scrollableAncestorRects:rn,measuringConfiguration:W,measuringScheduled:be,windowRect:An}),[ce,he,Oe,le,Rn,Gt,It,Z,fe,X,Nt,ee,et,rn,W,be,An]),ei=P.useMemo(()=>({activatorEvent:le,activators:or,active:ce,activeNodeRect:Oe,ariaDescribedById:{draggable:J},dispatch:U,draggableNodes:Z,over:Nt,measureDroppableContainers:ee}),[le,or,ce,Oe,U,J,Z,Nt,ee]);return pt.createElement(Lm.Provider,{value:V},pt.createElement(Io.Provider,{value:ei},pt.createElement(Qm.Provider,{value:ar},pt.createElement(ku.Provider,{value:Yt},g)),pt.createElement(l0,{disabled:(d==null?void 0:d.restoreFocus)===!1})),pt.createElement(cy,{...d,hiddenTextDescribedById:J}));function Dt(){const ot=(ye==null?void 0:ye.autoScrollEnabled)===!1,Qt=typeof p=="object"?p.enabled===!1:p===!1,an=G&&!ot&&!Qt;return typeof p=="object"?{...p,enabled:an}:{enabled:an}}}),c0=P.createContext(null),Cp="button",f0="Draggable";function d0(l){let{id:t,data:r,disabled:i=!1,attributes:o}=l;const u=Eu(f0),{activators:c,activatorEvent:d,active:p,activeNodeRect:g,ariaDescribedById:y,draggableNodes:v,over:x}=P.useContext(Io),{role:T=Cp,roleDescription:N="draggable",tabIndex:C=0}=o??{},L=(p==null?void 0:p.id)===t,U=P.useContext(L?ku:c0),[A,V]=lu(),[z,$]=lu(),G=Jy(c,t),Y=To(r);Ni(()=>(v.set(t,{id:t,key:u,node:A,activatorNode:z,data:Y}),()=>{const K=v.get(t);K&&K.key===u&&v.delete(t)}),[v,t]);const Z=P.useMemo(()=>({role:T,tabIndex:C,"aria-disabled":i,"aria-pressed":L&&T===Cp?!0:void 0,"aria-roledescription":N,"aria-describedby":y.draggable}),[i,T,C,L,N,y.draggable]);return{active:p,activatorEvent:d,activeNodeRect:g,attributes:Z,isDragging:L,listeners:i?void 0:G,node:A,over:x,setNodeRef:V,setActivatorNodeRef:$,transform:U}}function h0(){return P.useContext(Qm)}const p0="Droppable",m0={timeout:25};function g0(l){let{data:t,disabled:r=!1,id:i,resizeObserverConfig:o}=l;const u=Eu(p0),{active:c,dispatch:d,over:p,measureDroppableContainers:g}=P.useContext(Io),y=P.useRef({disabled:r}),v=P.useRef(!1),x=P.useRef(null),T=P.useRef(null),{disabled:N,updateMeasurementsFor:C,timeout:L}={...m0,...o},U=To(C??i),A=P.useCallback(()=>{if(!v.current){v.current=!0;return}T.current!=null&&clearTimeout(T.current),T.current=setTimeout(()=>{g(Array.isArray(U.current)?U.current:[U.current]),T.current=null},L)},[L]),V=Cu({callback:A,disabled:N||!c}),z=P.useCallback((Z,K)=>{V&&(K&&(V.unobserve(K),v.current=!1),Z&&V.observe(Z))},[V]),[$,G]=lu(z),Y=To(t);return P.useEffect(()=>{!V||!$.current||(V.disconnect(),v.current=!1,V.observe($.current))},[$,V]),P.useEffect(()=>(d({type:tn.RegisterDroppable,element:{id:i,key:u,disabled:r,node:$,rect:x,data:Y}}),()=>d({type:tn.UnregisterDroppable,key:u,id:i})),[i]),P.useEffect(()=>{r!==y.current.disabled&&(d({type:tn.SetDroppableDisabled,id:i,key:u,disabled:r}),y.current.disabled=r)},[i,u,r,d]),{active:c,rect:x,isOver:(p==null?void 0:p.id)===i,node:$,over:p,setNodeRef:G}}function v0(l){let{animation:t,children:r}=l;const[i,o]=P.useState(null),[u,c]=P.useState(null),d=ou(r);return!r&&!i&&d&&o(d),Ni(()=>{if(!u)return;const p=i==null?void 0:i.key,g=i==null?void 0:i.props.id;if(p==null||g==null){o(null);return}Promise.resolve(t(g,u)).then(()=>{o(null)})},[t,i,u]),pt.createElement(pt.Fragment,null,r,i?P.cloneElement(i,{ref:c}):null)}const y0={x:0,y:0,scaleX:1,scaleY:1};function w0(l){let{children:t}=l;return pt.createElement(Io.Provider,{value:Ym},pt.createElement(ku.Provider,{value:y0},t))}const S0={position:"fixed",touchAction:"none"},x0=l=>Uf(l)?"transform 250ms ease":void 0,_0=P.forwardRef((l,t)=>{let{as:r,activatorEvent:i,adjustScale:o,children:u,className:c,rect:d,style:p,transform:g,transition:y=x0}=l;if(!d)return null;const v=o?g:{...g,scaleX:1,scaleY:1},x={...S0,width:d.width,height:d.height,top:d.top,left:d.left,transform:Mo.Transform.toString(v),transformOrigin:o&&i?hy(i,d):void 0,transition:typeof y=="function"?y(i):y,...p};return pt.createElement(r,{className:c,style:x,ref:t},u)}),E0=l=>t=>{let{active:r,dragOverlay:i}=t;const o={},{styles:u,className:c}=l;if(u!=null&&u.active)for(const[d,p]of Object.entries(u.active))p!==void 0&&(o[d]=r.node.style.getPropertyValue(d),r.node.style.setProperty(d,p));if(u!=null&&u.dragOverlay)for(const[d,p]of Object.entries(u.dragOverlay))p!==void 0&&i.node.style.setProperty(d,p);return c!=null&&c.active&&r.node.classList.add(c.active),c!=null&&c.dragOverlay&&i.node.classList.add(c.dragOverlay),function(){for(const[p,g]of Object.entries(o))r.node.style.setProperty(p,g);c!=null&&c.active&&r.node.classList.remove(c.active)}},C0=l=>{let{transform:{initial:t,final:r}}=l;return[{transform:Mo.Transform.toString(t)},{transform:Mo.Transform.toString(r)}]},k0={duration:250,easing:"ease",keyframes:C0,sideEffects:E0({styles:{active:{opacity:"0"}}})};function R0(l){let{config:t,draggableNodes:r,droppableContainers:i,measuringConfiguration:o}=l;return _u((u,c)=>{if(t===null)return;const d=r.get(u);if(!d)return;const p=d.node.current;if(!p)return;const g=Km(c);if(!g)return;const{transform:y}=Yn(c).getComputedStyle(c),v=Am(y);if(!v)return;const x=typeof t=="function"?t:N0(t);return Um(p,o.draggable.measure),x({active:{id:u,data:d.data,node:p,rect:o.draggable.measure(p)},draggableNodes:r,dragOverlay:{node:c,rect:o.dragOverlay.measure(g)},droppableContainers:i,measuringConfiguration:o,transform:v})})}function N0(l){const{duration:t,easing:r,sideEffects:i,keyframes:o}={...k0,...l};return u=>{let{active:c,dragOverlay:d,transform:p,...g}=u;if(!t)return;const y={x:d.rect.left-c.rect.left,y:d.rect.top-c.rect.top},v={scaleX:p.scaleX!==1?c.rect.width*p.scaleX/d.rect.width:1,scaleY:p.scaleY!==1?c.rect.height*p.scaleY/d.rect.height:1},x={x:p.x-y.x,y:p.y-y.y,...v},T=o({...g,active:c,dragOverlay:d,transform:{initial:p,final:x}}),[N]=T,C=T[T.length-1];if(JSON.stringify(N)===JSON.stringify(C))return;const L=i==null?void 0:i({active:c,dragOverlay:d,...g}),U=d.node.animate(T,{duration:t,easing:r,fill:"forwards"});return new Promise(A=>{U.onfinish=()=>{L==null||L(),A()}})}}let kp=0;function b0(l){return P.useMemo(()=>{if(l!=null)return kp++,kp},[l])}const T0=pt.memo(l=>{let{adjustScale:t=!1,children:r,dropAnimation:i,style:o,transition:u,modifiers:c,wrapperElement:d="div",className:p,zIndex:g=999}=l;const{activatorEvent:y,active:v,activeNodeRect:x,containerNodeRect:T,draggableNodes:N,droppableContainers:C,dragOverlay:L,over:U,measuringConfiguration:A,scrollableAncestors:V,scrollableAncestorRects:z,windowRect:$}=h0(),G=P.useContext(ku),Y=b0(v==null?void 0:v.id),Z=qm(c,{activatorEvent:y,active:v,activeNodeRect:x,containerNodeRect:T,draggingNodeRect:L.rect,over:U,overlayNodeRect:L.rect,scrollableAncestors:V,scrollableAncestorRects:z,transform:G,windowRect:$}),K=Yf(x),fe=R0({config:i,draggableNodes:N,droppableContainers:C,measuringConfiguration:A}),q=K?L.setRef:void 0;return pt.createElement(w0,null,pt.createElement(v0,{animation:fe},v&&Y?pt.createElement(_0,{key:Y,id:v.id,ref:q,as:d,activatorEvent:y,adjustScale:t,className:p,transition:u,rect:K,style:{zIndex:g,...o},transform:Z},r):null))}),Rp=l=>{let t;const r=new Set,i=(g,y)=>{const v=typeof g=="function"?g(t):g;if(!Object.is(v,t)){const x=t;t=y??(typeof v!="object"||v===null)?v:Object.assign({},t,v),r.forEach(T=>T(t,x))}},o=()=>t,d={setState:i,getState:o,getInitialState:()=>p,subscribe:g=>(r.add(g),()=>r.delete(g))},p=t=l(i,o,d);return d},M0=(l=>l?Rp(l):Rp),D0=l=>l;function z0(l,t=D0){const r=pt.useSyncExternalStore(l.subscribe,pt.useCallback(()=>t(l.getState()),[l,t]),pt.useCallback(()=>t(l.getInitialState()),[l,t]));return pt.useDebugValue(r),r}const Np=l=>{const t=M0(l),r=i=>z0(t,i);return Object.assign(r,t),r},Xm=(l=>l?Np(l):Np),Jm="damiao.monitor.plotConfigs";function O0(){try{return JSON.parse(localStorage.getItem(Jm)||"{}")}catch{return{}}}function L0(l){try{localStorage.setItem(Jm,JSON.stringify(l))}catch{}}const We=Xm((l,t)=>({connected:!1,status:null,signals:[],pairs:[],motors:[],motorTypes:[],plotConfigs:O0(),mode:"monitor",controlMotors:[],currentMotorId:null,registerTable:{},setConnected:r=>l({connected:r}),setStatus:r=>l({status:r}),setMeta:(r,i)=>l({signals:r,pairs:i}),setMotors:r=>l({motors:r}),setMotorTypes:r=>l({motorTypes:r}),setMode:r=>l({mode:r}),setControlMotors:r=>l({controlMotors:r}),setCurrentMotor:r=>l({currentMotorId:r}),setRegisterTable:r=>l({registerTable:r}),ensurePlot:r=>l(i=>i.plotConfigs[r]?i:{plotConfigs:{...i.plotConfigs,[r]:{signals:[],duration:10}}}),setPlotConfig:(r,i)=>l(o=>({plotConfigs:{...o.plotConfigs,[r]:{...o.plotConfigs[r]||{signals:[],duration:10},...i}}})),addSignalToPlot:(r,i)=>l(o=>{const u=o.plotConfigs[r]||{signals:[],duration:10};return u.signals.includes(i)?o:{plotConfigs:{...o.plotConfigs,[r]:{...u,signals:[...u.signals,i]}}}}),removeSignalFromPlot:(r,i)=>l(o=>{const u=o.plotConfigs[r];return u?{plotConfigs:{...o.plotConfigs,[r]:{...u,signals:u.signals.filter(c=>c!==i)}}}:o}),dropPlot:r=>l(i=>{const o={...i.plotConfigs};return delete o[r],{plotConfigs:o}})}));We.subscribe(l=>L0(l.plotConfigs));const Qf="damiao.monitor.widgets.v3";function P0(){try{const l=localStorage.getItem(Qf);if(!l)return null;const t=JSON.parse(l);return Array.isArray(t)&&t.length?t:null}catch{return null}}function ff(l){try{localStorage.setItem(Qf,JSON.stringify(l))}catch{}}const bp=[{id:"connection-1",kind:"connection",x:0,y:0,w:3,h:4},{id:"control-1",kind:"control",x:0,y:4,w:3,h:8},{id:"plot-1",kind:"plot",x:3,y:0,w:6,h:6},{id:"cards-1",kind:"cards",x:9,y:0,w:3,h:6},{id:"table-1",kind:"table",x:3,y:6,w:6,h:6},{id:"registers-1",kind:"registers",x:9,y:6,w:3,h:6}];let Tp=1;const Ro=Xm((l,t)=>({widgets:P0()||bp,addWidget:r=>{Tp+=1;const i=`${r}-${Date.now().toString(36)}-${Tp}`,o=t().widgets.reduce((d,p)=>Math.max(d,p.y+p.h),0),u={id:i,kind:r,x:0,y:o,w:6,h:5},c=[...t().widgets,u];return ff(c),l({widgets:c}),i},removeWidget:r=>{const i=t().widgets.filter(o=>o.id!==r);ff(i),l({widgets:i})},updateGeom:r=>{const i=new Map(r.map(u=>[u.id,u])),o=t().widgets.map(u=>{const c=i.get(u.id);return c?{...u,x:c.x,y:c.y,w:c.w,h:c.h}:u});ff(o),l({widgets:o})},resetWidgets:()=>{try{localStorage.removeItem(Qf),localStorage.removeItem("damiao.monitor.plotConfigs")}catch{}l({widgets:bp.map(r=>({...r}))})}})),A0=!0,nn="u-",j0="uplot",I0=nn+"hz",F0=nn+"vt",H0=nn+"title",W0=nn+"wrap",B0=nn+"under",U0=nn+"over",V0=nn+"axis",Ls=nn+"off",$0=nn+"select",G0=nn+"cursor-x",K0=nn+"cursor-y",Y0=nn+"cursor-pt",Q0=nn+"legend",q0=nn+"live",X0=nn+"inline",J0=nn+"series",Z0=nn+"marker",Mp=nn+"label",ew=nn+"value",So="width",xo="height",vo="top",Dp="bottom",yl="left",df="right",qf="#000",zp=qf+"0",hf="mousemove",Op="mousedown",pf="mouseup",Lp="mouseenter",Pp="mouseleave",Ap="dblclick",tw="resize",nw="scroll",jp="change",du="dppxchange",Xf="--",zl=typeof window<"u",bf=zl?document:null,El=zl?window:null,rw=zl?navigator:null;let Ze,Xa;function Tf(){let l=devicePixelRatio;Ze!=l&&(Ze=l,Xa&&Df(jp,Xa,Tf),Xa=matchMedia(`(min-resolution: ${Ze-.001}dppx) and (max-resolution: ${Ze+.001}dppx)`),As(jp,Xa,Tf),El.dispatchEvent(new CustomEvent(du)))}function Sr(l,t){if(t!=null){let r=l.classList;!r.contains(t)&&r.add(t)}}function Mf(l,t){let r=l.classList;r.contains(t)&&r.remove(t)}function vt(l,t,r){l.style[t]=r+"px"}function Gr(l,t,r,i){let o=bf.createElement(l);return t!=null&&Sr(o,t),r!=null&&r.insertBefore(o,i),o}function Pr(l,t){return Gr("div",l,t)}const Ip=new WeakMap;function ai(l,t,r,i,o){let u="translate("+t+"px,"+r+"px)",c=Ip.get(l);u!=c&&(l.style.transform=u,Ip.set(l,u),t<0||r<0||t>i||r>o?Sr(l,Ls):Mf(l,Ls))}const Fp=new WeakMap;function Hp(l,t,r){let i=t+r,o=Fp.get(l);i!=o&&(Fp.set(l,i),l.style.background=t,l.style.borderColor=r)}const Wp=new WeakMap;function Bp(l,t,r,i){let o=t+""+r,u=Wp.get(l);o!=u&&(Wp.set(l,o),l.style.height=r+"px",l.style.width=t+"px",l.style.marginLeft=i?-t/2+"px":0,l.style.marginTop=i?-r/2+"px":0)}const Jf={passive:!0},iw={...Jf,capture:!0};function As(l,t,r,i){t.addEventListener(l,r,i?iw:Jf)}function Df(l,t,r,i){t.removeEventListener(l,r,Jf)}zl&&Tf();function Kr(l,t,r,i){let o;r=r||0,i=i||t.length-1;let u=i<=2147483647;for(;i-r>1;)o=u?r+i>>1:xr((r+i)/2),t[o]{let u=-1,c=-1;for(let d=i;d<=o;d++)if(l(r[d])){u=d;break}for(let d=o;d>=i;d--)if(l(r[d])){c=d;break}return[u,c]}}const eg=l=>l!=null,tg=l=>l!=null&&l>0,Ru=Zm(eg),sw=Zm(tg);function lw(l,t,r,i=0,o=!1){let u=o?sw:Ru,c=o?tg:eg;[t,r]=u(l,t,r);let d=l[t],p=l[t];if(t>-1)if(i==1)d=l[t],p=l[r];else if(i==-1)d=l[r],p=l[t];else for(let g=t;g<=r;g++){let y=l[g];c(y)&&(yp&&(p=y))}return[d??ft,p??-ft]}function Nu(l,t,r,i){let o=$p(l),u=$p(t);l==t&&(o==-1?(l*=r,t/=r):(l/=r,t*=r));let c=r==10?ki:ng,d=o==1?xr:jr,p=u==1?jr:xr,g=d(c(en(l))),y=p(c(en(t))),v=kl(r,g),x=kl(r,y);return r==10&&(g<0&&(v=dt(v,-g)),y<0&&(x=dt(x,-y))),i||r==2?(l=v*o,t=x*u):(l=lg(l,v),t=bu(t,x)),[l,t]}function Zf(l,t,r,i){let o=Nu(l,t,r,i);return l==0&&(o[0]=0),t==0&&(o[1]=0),o}const ed=.1,Up={mode:3,pad:ed},No={pad:0,soft:null,mode:0},ow={min:No,max:No};function hu(l,t,r,i){return Tu(r)?Vp(l,t,r):(No.pad=r,No.soft=i?0:null,No.mode=i?3:0,Vp(l,t,ow))}function Xe(l,t){return l??t}function aw(l,t,r){for(t=Xe(t,0),r=Xe(r,l.length-1);t<=r;){if(l[t]!=null)return!0;t++}return!1}function Vp(l,t,r){let i=r.min,o=r.max,u=Xe(i.pad,0),c=Xe(o.pad,0),d=Xe(i.hard,-ft),p=Xe(o.hard,ft),g=Xe(i.soft,ft),y=Xe(o.soft,-ft),v=Xe(i.mode,0),x=Xe(o.mode,0),T=t-l,N=ki(T),C=Kn(en(l),en(t)),L=ki(C),U=en(L-N);(T<1e-24||U>10)&&(T=0,(l==0||t==0)&&(T=1e-24,v==2&&g!=ft&&(u=0),x==2&&y!=-ft&&(c=0)));let A=T||C||1e3,V=ki(A),z=kl(10,xr(V)),$=A*(T==0?l==0?.1:1:u),G=dt(lg(l-$,z/10),24),Y=l>=g&&(v==1||v==3&&G<=g||v==2&&G>=g)?g:ft,Z=Kn(d,G=Y?Y:Yr(Y,G)),K=A*(T==0?t==0?.1:1:c),fe=dt(bu(t+K,z/10),24),q=t<=y&&(x==1||x==3&&fe>=y||x==2&&fe<=y)?y:-ft,xe=Yr(p,fe>q&&t<=q?q:Kn(q,fe));return Z==xe&&Z==0&&(xe=100),[Z,xe]}const uw=new Intl.NumberFormat(zl?rw.language:"en-US"),td=l=>uw.format(l),_r=Math,tu=_r.PI,en=_r.abs,xr=_r.floor,Zt=_r.round,jr=_r.ceil,Yr=_r.min,Kn=_r.max,kl=_r.pow,$p=_r.sign,ki=_r.log10,ng=_r.log2,cw=(l,t=1)=>_r.sinh(l)*t,mf=(l,t=1)=>_r.asinh(l/t),ft=1/0;function Gp(l){return(ki((l^l>>31)-(l>>31))|0)+1}function zf(l,t,r){return Yr(Kn(l,t),r)}function rg(l){return typeof l=="function"}function $e(l){return rg(l)?l:()=>l}const fw=()=>{},ig=l=>l,sg=(l,t)=>t,dw=l=>null,Kp=l=>!0,Yp=(l,t)=>l==t,hw=/\.\d*?(?=9{6,}|0{6,})/gm,Is=l=>{if(ag(l)||os.has(l))return l;const t=`${l}`,r=t.match(hw);if(r==null)return l;let i=r[0].length-1;if(t.indexOf("e-")!=-1){let[o,u]=t.split("e");return+`${Is(o)}e${u}`}return dt(l,i)};function zs(l,t){return Is(dt(Is(l/t))*t)}function bu(l,t){return Is(jr(Is(l/t))*t)}function lg(l,t){return Is(xr(Is(l/t))*t)}function dt(l,t=0){if(ag(l))return l;let r=10**t,i=l*r*(1+Number.EPSILON);return Zt(i)/r}const os=new Map;function og(l){return((""+l).split(".")[1]||"").length}function zo(l,t,r,i){let o=[],u=i.map(og);for(let c=t;c=0?0:d)+(c>=u[g]?0:u[g]),x=l==10?y:dt(y,v);o.push(x),os.set(x,v)}}return o}const bo={},nd=[],Rl=[null,null],ls=Array.isArray,ag=Number.isInteger,pw=l=>l===void 0;function Qp(l){return typeof l=="string"}function Tu(l){let t=!1;if(l!=null){let r=l.constructor;t=r==null||r==Object}return t}function mw(l){return l!=null&&typeof l=="object"}const gw=Object.getPrototypeOf(Uint8Array),ug="__proto__";function Nl(l,t=Tu){let r;if(ls(l)){let i=l.find(o=>o!=null);if(ls(i)||t(i)){r=Array(l.length);for(let o=0;ou){for(o=c-1;o>=0&&l[o]==null;)l[o--]=null;for(o=c+1;oc-d)],o=i[0].length,u=new Map;for(let c=0;c"u"?l=>Promise.resolve().then(l):queueMicrotask;function Ew(l){let t=l[0],r=t.length,i=Array(r);for(let u=0;ut[u]-t[c]);let o=[];for(let u=0;u=i&&l[o]==null;)o--;if(o<=i)return!0;const u=Kn(1,xr((o-i+1)/t));for(let c=l[i],d=i+u;d<=o;d+=u){const p=l[d];if(p!=null){if(p<=c)return!1;c=p}}return!0}const cg=["January","February","March","April","May","June","July","August","September","October","November","December"],fg=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function dg(l){return l.slice(0,3)}const Rw=fg.map(dg),Nw=cg.map(dg),bw={MMMM:cg,MMM:Nw,WWWW:fg,WWW:Rw};function yo(l){return(l<10?"0":"")+l}function Tw(l){return(l<10?"00":l<100?"0":"")+l}const Mw={YYYY:l=>l.getFullYear(),YY:l=>(l.getFullYear()+"").slice(2),MMMM:(l,t)=>t.MMMM[l.getMonth()],MMM:(l,t)=>t.MMM[l.getMonth()],MM:l=>yo(l.getMonth()+1),M:l=>l.getMonth()+1,DD:l=>yo(l.getDate()),D:l=>l.getDate(),WWWW:(l,t)=>t.WWWW[l.getDay()],WWW:(l,t)=>t.WWW[l.getDay()],HH:l=>yo(l.getHours()),H:l=>l.getHours(),h:l=>{let t=l.getHours();return t==0?12:t>12?t-12:t},AA:l=>l.getHours()>=12?"PM":"AM",aa:l=>l.getHours()>=12?"pm":"am",a:l=>l.getHours()>=12?"p":"a",mm:l=>yo(l.getMinutes()),m:l=>l.getMinutes(),ss:l=>yo(l.getSeconds()),s:l=>l.getSeconds(),fff:l=>Tw(l.getMilliseconds())};function rd(l,t){t=t||bw;let r=[],i=/\{([a-z]+)\}|[^{]+/gi,o;for(;o=i.exec(l);)r.push(o[0][0]=="{"?Mw[o[1]]:o[0]);return u=>{let c="";for(let d=0;dl%1==0,pu=[1,2,2.5,5],Ow=zo(10,-32,0,pu),pg=zo(10,0,32,pu),Lw=pg.filter(hg),Os=Ow.concat(pg),id=` +`,mg="{YYYY}",qp=id+mg,gg="{M}/{D}",_o=id+gg,Ja=_o+"/{YY}",vg="{aa}",Pw="{h}:{mm}",Sl=Pw+vg,Xp=id+Sl,Jp=":{ss}",rt=null;function yg(l){let t=l*1e3,r=t*60,i=r*60,o=i*24,u=o*30,c=o*365,p=(l==1?zo(10,0,3,pu).filter(hg):zo(10,-3,0,pu)).concat([t,t*5,t*10,t*15,t*30,r,r*5,r*10,r*15,r*30,i,i*2,i*3,i*4,i*6,i*8,i*12,o,o*2,o*3,o*4,o*5,o*6,o*7,o*8,o*9,o*10,o*15,u,u*2,u*3,u*4,u*6,c,c*2,c*5,c*10,c*25,c*50,c*100]);const g=[[c,mg,rt,rt,rt,rt,rt,rt,1],[o*28,"{MMM}",qp,rt,rt,rt,rt,rt,1],[o,gg,qp,rt,rt,rt,rt,rt,1],[i,"{h}"+vg,Ja,rt,_o,rt,rt,rt,1],[r,Sl,Ja,rt,_o,rt,rt,rt,1],[t,Jp,Ja+" "+Sl,rt,_o+" "+Sl,rt,Xp,rt,1],[l,Jp+".{fff}",Ja+" "+Sl,rt,_o+" "+Sl,rt,Xp,rt,1]];function y(v){return(x,T,N,C,L,U)=>{let A=[],V=L>=c,z=L>=u&&L=o?o:L,fe=xr(N)-xr(G),q=Z+fe+bu(G-Z,K);A.push(q);let xe=v(q),ce=xe.getHours()+xe.getMinutes()/r+xe.getSeconds()/i,ge=L/i,ye=x.axes[T]._space,ke=U/ye;for(;q=dt(q+L,l==1?0:3),!(q>C);)if(ge>1){let le=xr(dt(ce+ge,6))%24,J=v(q).getHours()-le;J>1&&(J=-1),q-=J*i,ce=(ce+ge)%24;let M=A[A.length-1];dt((q-M)/L,3)*ke>=.7&&A.push(q)}else A.push(q)}return A}}return[p,g,y]}const[Aw,jw,Iw]=yg(1),[Fw,Hw,Ww]=yg(.001);zo(2,-53,53,[1]);function Zp(l,t){return l.map(r=>r.map((i,o)=>o==0||o==8||i==null?i:t(o==1||r[8]==0?i:r[1]+i)))}function em(l,t){return(r,i,o,u,c)=>{let d=t.find(N=>c>=N[0])||t[t.length-1],p,g,y,v,x,T;return i.map(N=>{let C=l(N),L=C.getFullYear(),U=C.getMonth(),A=C.getDate(),V=C.getHours(),z=C.getMinutes(),$=C.getSeconds(),G=L!=p&&d[2]||U!=g&&d[3]||A!=y&&d[4]||V!=v&&d[5]||z!=x&&d[6]||$!=T&&d[7]||d[1];return p=L,g=U,y=A,v=V,x=z,T=$,G(C)})}}function Bw(l,t){let r=rd(t);return(i,o,u,c,d)=>o.map(p=>r(l(p)))}function gf(l,t,r){return new Date(l,t,r)}function tm(l,t){return t(l)}const Uw="{YYYY}-{MM}-{DD} {h}:{mm}{aa}";function nm(l,t){return(r,i,o,u)=>u==null?Xf:t(l(i))}function Vw(l,t){let r=l.series[t];return r.width?r.stroke(l,t):r.points.width?r.points.stroke(l,t):null}function $w(l,t){return l.series[t].fill(l,t)}const Gw={show:!0,live:!0,isolate:!1,mount:fw,markers:{show:!0,width:2,stroke:Vw,fill:$w,dash:"solid"},idx:null,idxs:null,values:[]};function Kw(l,t){let r=l.cursor.points,i=Pr(),o=r.size(l,t);vt(i,So,o),vt(i,xo,o);let u=o/-2;vt(i,"marginLeft",u),vt(i,"marginTop",u);let c=r.width(l,t,o);return c&&vt(i,"borderWidth",c),i}function Yw(l,t){let r=l.series[t].points;return r._fill||r._stroke}function Qw(l,t){let r=l.series[t].points;return r._stroke||r._fill}function qw(l,t){return l.series[t].points.size}const vf=[0,0];function Xw(l,t,r){return vf[0]=t,vf[1]=r,vf}function Za(l,t,r,i=!0){return o=>{o.button==0&&(!i||o.target==t)&&r(o)}}function yf(l,t,r,i=!0){return o=>{(!i||o.target==t)&&r(o)}}const Jw={show:!0,x:!0,y:!0,lock:!1,move:Xw,points:{one:!1,show:Kw,size:qw,width:0,stroke:Qw,fill:Yw},bind:{mousedown:Za,mouseup:Za,click:Za,dblclick:Za,mousemove:yf,mouseleave:yf,mouseenter:yf},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,click:(l,t)=>{t.stopPropagation(),t.stopImmediatePropagation()},_x:!1,_y:!1},focus:{dist:(l,t,r,i,o)=>i-o,prox:-1,bias:0},hover:{skip:[void 0],prox:null,bias:0},left:-10,top:-10,idx:null,dataIdx:null,idxs:null,event:null},wg={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},sd=$t({},wg,{filter:sg}),Sg=$t({},sd,{size:10}),xg=$t({},wg,{show:!1}),ld='12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',_g="bold "+ld,Eg=1.5,rm={show:!0,scale:"x",stroke:qf,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:_g,side:2,grid:sd,ticks:Sg,border:xg,font:ld,lineGap:Eg,rotate:0},Zw="Value",e1="Time",im={show:!0,scale:"x",auto:!1,sorted:1,min:ft,max:-ft,idxs:[]};function t1(l,t,r,i,o){return t.map(u=>u==null?"":td(u))}function n1(l,t,r,i,o,u,c){let d=[],p=os.get(o)||0;r=c?r:dt(bu(r,o),p);for(let g=r;g<=i;g=dt(g+o,p))d.push(Object.is(g,-0)?0:g);return d}function Of(l,t,r,i,o,u,c){const d=[],p=l.scales[l.axes[t].scale].log,g=p==10?ki:ng,y=xr(g(r));o=kl(p,y),p==10&&(o=Os[Kr(o,Os)]);let v=r,x=o*p;p==10&&(x=Os[Kr(x,Os)]);do d.push(v),v=v+o,p==10&&!os.has(v)&&(v=dt(v,os.get(o))),v>=x&&(o=v,x=o*p,p==10&&(x=Os[Kr(x,Os)]));while(v<=i);return d}function r1(l,t,r,i,o,u,c){let p=l.scales[l.axes[t].scale].asinh,g=i>p?Of(l,t,Kn(p,r),i,o):[p],y=i>=0&&r<=0?[0]:[];return(r<-p?Of(l,t,Kn(p,-i),-r,o):[p]).reverse().map(x=>-x).concat(y,g)}const Cg=/./,i1=/[12357]/,s1=/[125]/,sm=/1/,Lf=(l,t,r,i)=>l.map((o,u)=>t==4&&o==0||u%i==0&&r.test(o.toExponential()[o<0?1:0])?o:null);function l1(l,t,r,i,o){let u=l.axes[r],c=u.scale,d=l.scales[c],p=l.valToPos,g=u._space,y=p(10,c),v=p(9,c)-y>=g?Cg:p(7,c)-y>=g?i1:p(5,c)-y>=g?s1:sm;if(v==sm){let x=en(p(1,c)-y);if(xo,am={show:!0,auto:!0,sorted:0,gaps:kg,alpha:1,facets:[$t({},om,{scale:"x"}),$t({},om,{scale:"y"})]},um={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:kg,alpha:1,points:{show:c1,filter:null},values:null,min:ft,max:-ft,idxs:[],path:null,clip:null};function f1(l,t,r,i,o){return r/10}const Rg={time:A0,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},d1=$t({},Rg,{time:!1,ori:1}),cm={};function Ng(l,t){let r=cm[l];return r||(r={key:l,plots:[],sub(i){r.plots.push(i)},unsub(i){r.plots=r.plots.filter(o=>o!=i)},pub(i,o,u,c,d,p,g){for(let y=0;y{let U=c.pxRound;const A=g.dir*(g.ori==0?1:-1),V=g.ori==0?Ol:Ll;let z,$;A==1?(z=r,$=i):(z=i,$=r);let G=U(v(d[z],g,C,T)),Y=U(x(p[z],y,L,N)),Z=U(v(d[$],g,C,T)),K=U(x(u==1?y.max:y.min,y,L,N)),fe=new Path2D(o);return V(fe,Z,K),V(fe,G,K),V(fe,G,Y),fe})}function Mu(l,t,r,i,o,u){let c=null;if(l.length>0){c=new Path2D;const d=t==0?Ou:ud;let p=r;for(let v=0;vx[0]){let T=x[0]-p;T>0&&d(c,p,i,T,i+u),p=x[1]}}let g=r+o-p,y=10;g>0&&d(c,p,i-y/2,g,i+u+y)}return c}function p1(l,t,r){let i=l[l.length-1];i&&i[0]==t?i[1]=r:l.push([t,r])}function ad(l,t,r,i,o,u,c){let d=[],p=l.length;for(let g=o==1?r:i;g>=r&&g<=i;g+=o)if(t[g]===null){let v=g,x=g;if(o==1)for(;++g<=i&&t[g]===null;)x=g;else for(;--g>=r&&t[g]===null;)x=g;let T=u(l[v]),N=x==v?T:u(l[x]),C=v-o;T=c<=0&&C>=0&&C=0&&U>=0&&U=T&&d.push([T,N])}return d}function fm(l){return l==0?ig:l==1?Zt:t=>zs(t,l)}function bg(l){let t=l==0?Du:zu,r=l==0?(o,u,c,d,p,g)=>{o.arcTo(u,c,d,p,g)}:(o,u,c,d,p,g)=>{o.arcTo(c,u,p,d,g)},i=l==0?(o,u,c,d,p)=>{o.rect(u,c,d,p)}:(o,u,c,d,p)=>{o.rect(c,u,p,d)};return(o,u,c,d,p,g=0,y=0)=>{g==0&&y==0?i(o,u,c,d,p):(g=Yr(g,d/2,p/2),y=Yr(y,d/2,p/2),t(o,u+g,c),r(o,u+d,c,u+d,c+p,g),r(o,u+d,c+p,u,c+p,y),r(o,u,c+p,u,c,y),r(o,u,c,u+d,c,g),o.closePath())}}const Du=(l,t,r)=>{l.moveTo(t,r)},zu=(l,t,r)=>{l.moveTo(r,t)},Ol=(l,t,r)=>{l.lineTo(t,r)},Ll=(l,t,r)=>{l.lineTo(r,t)},Ou=bg(0),ud=bg(1),Tg=(l,t,r,i,o,u)=>{l.arc(t,r,i,o,u)},Mg=(l,t,r,i,o,u)=>{l.arc(r,t,i,o,u)},Dg=(l,t,r,i,o,u,c)=>{l.bezierCurveTo(t,r,i,o,u,c)},zg=(l,t,r,i,o,u,c)=>{l.bezierCurveTo(r,t,o,i,c,u)};function Og(l){return(t,r,i,o,u)=>Fs(t,r,(c,d,p,g,y,v,x,T,N,C,L)=>{let{pxRound:U,points:A}=c,V,z;g.ori==0?(V=Du,z=Tg):(V=zu,z=Mg);const $=dt(A.width*Ze,3);let G=(A.size-A.width)/2*Ze,Y=dt(G*2,3),Z=new Path2D,K=new Path2D,{left:fe,top:q,width:xe,height:ce}=t.bbox;Ou(K,fe-Y,q-Y,xe+Y*2,ce+Y*2);const ge=ye=>{if(p[ye]!=null){let ke=U(v(d[ye],g,C,T)),le=U(x(p[ye],y,L,N));V(Z,ke+G,le),z(Z,ke,le,G,0,tu*2)}};if(u)u.forEach(ge);else for(let ye=i;ye<=o;ye++)ge(ye);return{stroke:$>0?Z:null,fill:Z,clip:K,flags:bl|Pf}})}function Lg(l){return(t,r,i,o,u,c)=>{i!=o&&(u!=i&&c!=i&&l(t,r,i),u!=o&&c!=o&&l(t,r,o),l(t,r,c))}}const m1=Lg(Ol),g1=Lg(Ll);function Pg(l){const t=Xe(l==null?void 0:l.alignGaps,0);return(r,i,o,u)=>Fs(r,i,(c,d,p,g,y,v,x,T,N,C,L)=>{[o,u]=Ru(p,o,u);let U=c.pxRound,A=ce=>U(v(ce,g,C,T)),V=ce=>U(x(ce,y,L,N)),z,$;g.ori==0?(z=Ol,$=m1):(z=Ll,$=g1);const G=g.dir*(g.ori==0?1:-1),Y={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:bl},Z=Y.stroke;let K=!1;if(u-o>=C*4){let ce=X=>r.posToVal(X,g.key,!0),ge=null,ye=null,ke,le,oe,ae=A(d[G==1?o:u]),J=A(d[o]),M=A(d[u]),W=ce(G==1?J+1:M-1);for(let X=G==1?o:u;X>=o&&X<=u;X+=G){let ee=d[X],he=(G==1?eeW)?ae:A(ee),Ee=p[X];he==ae?Ee!=null?(le=Ee,ge==null?(z(Z,he,V(le)),ke=ge=ye=le):leye&&(ye=le)):Ee===null&&(K=!0):(ge!=null&&$(Z,ae,V(ge),V(ye),V(ke),V(le)),Ee!=null?(le=Ee,z(Z,he,V(le)),ge=ye=ke=le):(ge=ye=null,Ee===null&&(K=!0)),ae=he,W=ce(ae+G))}ge!=null&&ge!=ye&&oe!=ae&&$(Z,ae,V(ge),V(ye),V(ke),V(le))}else for(let ce=G==1?o:u;ce>=o&&ce<=u;ce+=G){let ge=p[ce];ge===null?K=!0:ge!=null&&z(Z,A(d[ce]),V(ge))}let[q,xe]=od(r,i);if(c.fill!=null||q!=0){let ce=Y.fill=new Path2D(Z),ge=c.fillTo(r,i,c.min,c.max,q),ye=V(ge),ke=A(d[o]),le=A(d[u]);G==-1&&([le,ke]=[ke,le]),z(ce,le,ye),z(ce,ke,ye)}if(!c.spanGaps){let ce=[];K&&ce.push(...ad(d,p,o,u,G,A,t)),Y.gaps=ce=c.gaps(r,i,o,u,ce),Y.clip=Mu(ce,g.ori,T,N,C,L)}return xe!=0&&(Y.band=xe==2?[Ri(r,i,o,u,Z,-1),Ri(r,i,o,u,Z,1)]:Ri(r,i,o,u,Z,xe)),Y})}function v1(l){const t=Xe(l.align,1),r=Xe(l.ascDesc,!1),i=Xe(l.alignGaps,0),o=Xe(l.extend,!1);return(u,c,d,p)=>Fs(u,c,(g,y,v,x,T,N,C,L,U,A,V)=>{[d,p]=Ru(v,d,p);let z=g.pxRound,{left:$,width:G}=u.bbox,Y=J=>z(N(J,x,A,L)),Z=J=>z(C(J,T,V,U)),K=x.ori==0?Ol:Ll;const fe={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:bl},q=fe.stroke,xe=x.dir*(x.ori==0?1:-1);let ce=Z(v[xe==1?d:p]),ge=Y(y[xe==1?d:p]),ye=ge,ke=ge;o&&t==-1&&(ke=$,K(q,ke,ce)),K(q,ge,ce);for(let J=xe==1?d:p;J>=d&&J<=p;J+=xe){let M=v[J];if(M==null)continue;let W=Y(y[J]),X=Z(M);t==1?K(q,W,ce):K(q,ye,X),K(q,W,X),ce=X,ye=W}let le=ye;o&&t==1&&(le=$+G,K(q,le,ce));let[oe,ae]=od(u,c);if(g.fill!=null||oe!=0){let J=fe.fill=new Path2D(q),M=g.fillTo(u,c,g.min,g.max,oe),W=Z(M);K(J,le,W),K(J,ke,W)}if(!g.spanGaps){let J=[];J.push(...ad(y,v,d,p,xe,Y,i));let M=g.width*Ze/2,W=r||t==1?M:-M,X=r||t==-1?-M:M;J.forEach(ee=>{ee[0]+=W,ee[1]+=X}),fe.gaps=J=g.gaps(u,c,d,p,J),fe.clip=Mu(J,x.ori,L,U,A,V)}return ae!=0&&(fe.band=ae==2?[Ri(u,c,d,p,q,-1),Ri(u,c,d,p,q,1)]:Ri(u,c,d,p,q,ae)),fe})}function dm(l,t,r,i,o,u,c=ft){if(l.length>1){let d=null;for(let p=0,g=1/0;p{}),{fill:v,stroke:x}=g;return(T,N,C,L)=>Fs(T,N,(U,A,V,z,$,G,Y,Z,K,fe,q)=>{let xe=U.pxRound,ce=r,ge=i*Ze,ye=d*Ze,ke=p*Ze,le,oe;z.ori==0?[le,oe]=u(T,N):[oe,le]=u(T,N);const ae=z.dir*(z.ori==0?1:-1);let J=z.ori==0?Ou:ud,M=z.ori==0?y:(pe,Je,tt,ln,Rn,Kt,Nt)=>{y(pe,Je,tt,Rn,ln,Nt,Kt)},W=Xe(T.bands,nd).find(pe=>pe.series[0]==N),X=W!=null?W.dir:0,ee=U.fillTo(T,N,U.min,U.max,X),be=xe(Y(ee,$,q,K)),he,Ee,Ie,Fe=fe,Oe=xe(U.width*Ze),Gt=!1,At=null,jt=null,It=null,Qn=null;v!=null&&(Oe==0||x!=null)&&(Gt=!0,At=v.values(T,N,C,L),jt=new Map,new Set(At).forEach(pe=>{pe!=null&&jt.set(pe,new Path2D)}),Oe>0&&(It=x.values(T,N,C,L),Qn=new Map,new Set(It).forEach(pe=>{pe!=null&&Qn.set(pe,new Path2D)})));let{x0:kn,size:Er}=g;if(kn!=null&&Er!=null){ce=1,A=kn.values(T,N,C,L),kn.unit==2&&(A=A.map(tt=>T.posToVal(Z+tt*fe,z.key,!0)));let pe=Er.values(T,N,C,L);Er.unit==2?Ee=pe[0]*fe:Ee=G(pe[0],z,fe,Z)-G(0,z,fe,Z),Fe=dm(A,V,G,z,fe,Z,Fe),Ie=Fe-Ee+ge}else Fe=dm(A,V,G,z,fe,Z,Fe),Ie=Fe*c+ge,Ee=Fe-Ie;Ie<1&&(Ie=0),Oe>=Ee/2&&(Oe=0),Ie<5&&(xe=ig);let Xr=Ie>0,An=Fe-Ie-(Xr?Oe:0);Ee=xe(zf(An,ke,ye)),he=(ce==0?Ee/2:ce==ae?0:Ee)-ce*ae*((ce==0?ge/2:0)+(Xr?Oe/2:0));const et={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},rn=Gt?null:new Path2D;let sn=null;if(W!=null)sn=T.data[W.series[1]];else{let{y0:pe,y1:Je}=g;pe!=null&&Je!=null&&(V=Je.values(T,N,C,L),sn=pe.values(T,N,C,L))}let lr=le*Ee,Pe=oe*Ee;for(let pe=ae==1?C:L;pe>=C&&pe<=L;pe+=ae){let Je=V[pe];if(Je==null)continue;if(sn!=null){let Yt=sn[pe]??0;if(Je-Yt==0)continue;be=Y(Yt,$,q,K)}let tt=z.distr!=2||g!=null?A[pe]:pe,ln=G(tt,z,fe,Z),Rn=Y(Xe(Je,ee),$,q,K),Kt=xe(ln-he),Nt=xe(Kn(Rn,be)),on=xe(Yr(Rn,be)),gn=Nt-on;if(Je!=null){let Yt=Je<0?Pe:lr,vn=Je<0?lr:Pe;Gt?(Oe>0&&It[pe]!=null&&J(Qn.get(It[pe]),Kt,on+xr(Oe/2),Ee,Kn(0,gn-Oe),Yt,vn),At[pe]!=null&&J(jt.get(At[pe]),Kt,on+xr(Oe/2),Ee,Kn(0,gn-Oe),Yt,vn)):J(rn,Kt,on+xr(Oe/2),Ee,Kn(0,gn-Oe),Yt,vn),M(T,N,pe,Kt-Oe/2,on,Ee+Oe,gn)}}return Oe>0?et.stroke=Gt?Qn:rn:Gt||(et._fill=U.width==0?U._fill:U._stroke??U._fill,et.width=0),et.fill=Gt?jt:rn,et})}function w1(l,t){const r=Xe(t==null?void 0:t.alignGaps,0);return(i,o,u,c)=>Fs(i,o,(d,p,g,y,v,x,T,N,C,L,U)=>{[u,c]=Ru(g,u,c);let A=d.pxRound,V=le=>A(x(le,y,L,N)),z=le=>A(T(le,v,U,C)),$,G,Y;y.ori==0?($=Du,Y=Ol,G=Dg):($=zu,Y=Ll,G=zg);const Z=y.dir*(y.ori==0?1:-1);let K=V(p[Z==1?u:c]),fe=K,q=[],xe=[];for(let le=Z==1?u:c;le>=u&&le<=c;le+=Z)if(g[le]!=null){let ae=p[le],J=V(ae);q.push(fe=J),xe.push(z(g[le]))}const ce={stroke:l(q,xe,$,Y,G,A),fill:null,clip:null,band:null,gaps:null,flags:bl},ge=ce.stroke;let[ye,ke]=od(i,o);if(d.fill!=null||ye!=0){let le=ce.fill=new Path2D(ge),oe=d.fillTo(i,o,d.min,d.max,ye),ae=z(oe);Y(le,fe,ae),Y(le,K,ae)}if(!d.spanGaps){let le=[];le.push(...ad(p,g,u,c,Z,V,r)),ce.gaps=le=d.gaps(i,o,u,c,le),ce.clip=Mu(le,y.ori,N,C,L,U)}return ke!=0&&(ce.band=ke==2?[Ri(i,o,u,c,ge,-1),Ri(i,o,u,c,ge,1)]:Ri(i,o,u,c,ge,ke)),ce})}function S1(l){return w1(x1,l)}function x1(l,t,r,i,o,u){const c=l.length;if(c<2)return null;const d=new Path2D;if(r(d,l[0],t[0]),c==2)i(d,l[1],t[1]);else{let p=Array(c),g=Array(c-1),y=Array(c-1),v=Array(c-1);for(let x=0;x0!=g[x]>0?p[x]=0:(p[x]=3*(v[x-1]+v[x])/((2*v[x]+v[x-1])/g[x-1]+(v[x]+2*v[x-1])/g[x]),isFinite(p[x])||(p[x]=0));p[c-1]=g[c-2];for(let x=0;x{Pn.pxRatio=Ze}));const _1=Pg(),E1=Og();function pm(l,t,r,i){return(i?[l[0],l[1]].concat(l.slice(2)):[l[0]].concat(l.slice(1))).map((u,c)=>jf(u,c,t,r))}function C1(l,t){return l.map((r,i)=>i==0?{}:$t({},t,r))}function jf(l,t,r,i){return $t({},t==0?r:i,l)}function Ag(l,t,r){return t==null?Rl:[t,r]}const k1=Ag;function R1(l,t,r){return t==null?Rl:hu(t,r,ed,!0)}function jg(l,t,r,i){return t==null?Rl:Nu(t,r,l.scales[i].log,!1)}const N1=jg;function Ig(l,t,r,i){return t==null?Rl:Zf(t,r,l.scales[i].log,!1)}const b1=Ig;function T1(l,t,r,i,o){let u=Kn(Gp(l),Gp(t)),c=t-l,d=Kr(o/i*c,r);do{let p=r[d],g=i*p/c;if(g>=o&&u+(p<5?os.get(p):0)<=17)return[p,g]}while(++d(t=Zt((r=+o)*Ze))+"px"),[l,t,r]}function M1(l){l.show&&[l.font,l.labelFont].forEach(t=>{let r=dt(t[2]*Ze,1);t[0]=t[0].replace(/[0-9.]+px/,r+"px"),t[1]=r})}function Pn(l,t,r){const i={mode:Xe(l.mode,1)},o=i.mode;function u(m,S,_,E){let D=S.valToPct(m);return E+_*(S.dir==-1?1-D:D)}function c(m,S,_,E){let D=S.valToPct(m);return E+_*(S.dir==-1?D:1-D)}function d(m,S,_,E){return S.ori==0?u(m,S,_,E):c(m,S,_,E)}i.valToPosH=u,i.valToPosV=c;let p=!1;i.status=0;const g=i.root=Pr(j0);if(l.id!=null&&(g.id=l.id),Sr(g,l.class),l.title){let m=Pr(H0,g);m.textContent=l.title}const y=Gr("canvas"),v=i.ctx=y.getContext("2d"),x=Pr(W0,g);As("click",x,m=>{m.target===N&&(Qe!=hi||it!=Fi)&&qt.click(i,m)},!0);const T=i.under=Pr(B0,x);x.appendChild(y);const N=i.over=Pr(U0,x);l=Nl(l);const C=+Xe(l.pxAlign,1),L=fm(C);(l.plugins||[]).forEach(m=>{m.opts&&(l=m.opts(i,l)||l)});const U=l.ms||.001,A=i.series=o==1?pm(l.series||[],im,um,!1):C1(l.series||[null],am),V=i.axes=pm(l.axes||[],rm,lm,!0),z=i.scales={},$=i.bands=l.bands||[];$.forEach(m=>{m.fill=$e(m.fill||null),m.dir=Xe(m.dir,-1)});const G=o==2?A[1].facets[0].scale:A[0].scale,Y={axes:$o,series:Iu},Z=(l.drawOrder||["axes","series"]).map(m=>Y[m]);function K(m){const S=m.distr==3?_=>ki(_>0?_:m.clamp(i,_,m.min,m.max,m.key)):m.distr==4?_=>mf(_,m.asinh):m.distr==100?_=>m.fwd(_):_=>_;return _=>{let E=S(_),{_min:D,_max:I}=m,Q=I-D;return(E-D)/Q}}function fe(m){let S=z[m];if(S==null){let _=(l.scales||bo)[m]||bo;if(_.from!=null){fe(_.from);let E=$t({},z[_.from],_,{key:m});E.valToPct=K(E),z[m]=E}else{S=z[m]=$t({},m==G?Rg:d1,_),S.key=m;let E=S.time,D=S.range,I=ls(D);if((m!=G||o==2&&!E)&&(I&&(D[0]==null||D[1]==null)&&(D={min:D[0]==null?Up:{mode:1,hard:D[0],soft:D[0]},max:D[1]==null?Up:{mode:1,hard:D[1],soft:D[1]}},I=!1),!I&&Tu(D))){let Q=D;D=(ne,se,de)=>se==null?Rl:hu(se,de,Q)}S.range=$e(D||(E?k1:m==G?S.distr==3?N1:S.distr==4?b1:Ag:S.distr==3?jg:S.distr==4?Ig:R1)),S.auto=$e(I?!1:S.auto),S.clamp=$e(S.clamp||f1),S._min=S._max=null,S.valToPct=K(S)}}}fe("x"),fe("y"),o==1&&A.forEach(m=>{fe(m.scale)}),V.forEach(m=>{fe(m.scale)});for(let m in l.scales)fe(m);const q=z[G],xe=q.distr;let ce,ge;q.ori==0?(Sr(g,I0),ce=u,ge=c):(Sr(g,F0),ce=c,ge=u);const ye={};for(let m in z){let S=z[m];(S.min!=null||S.max!=null)&&(ye[m]={min:S.min,max:S.max},S.min=S.max=null)}const ke=l.tzDate||(m=>new Date(Zt(m/U))),le=l.fmtDate||rd,oe=U==1?Iw(ke):Ww(ke),ae=em(ke,Zp(U==1?jw:Hw,le)),J=nm(ke,tm(Uw,le)),M=[],W=i.legend=$t({},Gw,l.legend),X=i.cursor=$t({},Jw,{drag:{y:o==2}},l.cursor),ee=W.show,be=X.show,he=W.markers;W.idxs=M,he.width=$e(he.width),he.dash=$e(he.dash),he.stroke=$e(he.stroke),he.fill=$e(he.fill);let Ee,Ie,Fe,Oe=[],Gt=[],At,jt=!1,It={};if(W.live){const m=A[1]?A[1].values:null;jt=m!=null,At=jt?m(i,1,0):{_:0};for(let S in At)It[S]=Xf}if(ee)if(Ee=Gr("table",Q0,g),Fe=Gr("tbody",null,Ee),W.mount(i,Ee),jt){Ie=Gr("thead",null,Ee,Fe);let m=Gr("tr",null,Ie);Gr("th",null,m);for(var Qn in At)Gr("th",Mp,m).textContent=Qn}else Sr(Ee,X0),W.live&&Sr(Ee,q0);const kn={show:!0},Er={show:!1};function Xr(m,S){if(S==0&&(jt||!W.live||o==2))return Rl;let _=[],E=Gr("tr",J0,Fe,Fe.childNodes[S]);Sr(E,m.class),m.show||Sr(E,Ls);let D=Gr("th",null,E);if(he.show){let ne=Pr(Z0,D);if(S>0){let se=he.width(i,S);se&&(ne.style.border=se+"px "+he.dash(i,S)+" "+he.stroke(i,S)),ne.style.background=he.fill(i,S)}}let I=Pr(Mp,D);m.label instanceof HTMLElement?I.appendChild(m.label):I.textContent=m.label,S>0&&(he.show||(I.style.color=m.width>0?he.stroke(i,S):he.fill(i,S)),et("click",D,ne=>{if(X._lock)return;wn(ne);let se=A.indexOf(m);if((ne.ctrlKey||ne.metaKey)!=W.isolate){let de=A.some((me,ve)=>ve>0&&ve!=se&&me.show);A.forEach((me,ve)=>{ve>0&&hr(ve,de?ve==se?kn:Er:kn,!0,Tt.setSeries)})}else hr(se,{show:!m.show},!0,Tt.setSeries)},!1),Et&&et(Lp,D,ne=>{X._lock||(wn(ne),hr(A.indexOf(m),Bi,!0,Tt.setSeries))},!1));for(var Q in At){let ne=Gr("td",ew,E);ne.textContent="--",_.push(ne)}return[E,_]}const An=new Map;function et(m,S,_,E=!0){const D=An.get(S)||{},I=X.bind[m](i,S,_,E);I&&(As(m,S,D[m]=I),An.set(S,D))}function rn(m,S,_){const E=An.get(S)||{};for(let D in E)(m==null||D==m)&&(Df(D,S,E[D]),delete E[D]);m==null&&An.delete(S)}let sn=0,lr=0,Pe=0,pe=0,Je=0,tt=0,ln=Je,Rn=tt,Kt=Pe,Nt=pe,on=0,gn=0,Yt=0,vn=0;i.bbox={};let Jr=!1,Zr=!1,or=!1,ar=!1,ei=!1,Dt=!1;function ot(m,S,_){(_||m!=i.width||S!=i.height)&&Qt(m,S),di(!1),or=!0,Zr=!0,Fn()}function Qt(m,S){i.width=sn=Pe=m,i.height=lr=pe=S,Je=tt=0,un(),Nn();let _=i.bbox;on=_.left=zs(Je*Ze,.5),gn=_.top=zs(tt*Ze,.5),Yt=_.width=zs(Pe*Ze,.5),vn=_.height=zs(pe*Ze,.5)}const an=3;function ur(){let m=!1,S=0;for(;!m;){S++;let _=Wl(S),E=Vo(S);m=S==an||_&&E,m||(Qt(i.width,i.height),Zr=!0)}}function yn({width:m,height:S}){ot(m,S)}i.setSize=yn;function un(){let m=!1,S=!1,_=!1,E=!1;V.forEach((D,I)=>{if(D.show&&D._show){let{side:Q,_size:ne}=D,se=Q%2,de=D.label!=null?D.labelSize:0,me=ne+de;me>0&&(se?(Pe-=me,Q==3?(Je+=me,E=!0):_=!0):(pe-=me,Q==0?(tt+=me,m=!0):S=!0))}}),jn[0]=m,jn[1]=_,jn[2]=S,jn[3]=E,Pe-=Ir[1]+Ir[3],Je+=Ir[3],pe-=Ir[2]+Ir[0],tt+=Ir[0]}function Nn(){let m=Je+Pe,S=tt+pe,_=Je,E=tt;function D(I,Q){switch(I){case 1:return m+=Q,m-Q;case 2:return S+=Q,S-Q;case 3:return _-=Q,_+Q;case 0:return E-=Q,E+Q}}V.forEach((I,Q)=>{if(I.show&&I._show){let ne=I.side;I._pos=D(ne,I._size),I.label!=null&&(I._lpos=D(ne,I.labelSize))}})}if(X.dataIdx==null){let m=X.hover,S=m.skip=new Set(m.skip??[]);S.add(void 0);let _=m.prox=$e(m.prox),E=m.bias??(m.bias=0);X.dataIdx=(D,I,Q,ne)=>{if(I==0)return Q;let se=Q,de=_(D,I,Q,ne)??ft,me=de>=0&&de0;)S.has(Ve[Re])||(He=Re);if(E==0||E==1)for(Re=Q;Me==null&&Re++de&&(se=null);return se}}const wn=m=>{X.event=m};X.idxs=M,X._lock=!1;let Be=X.points;Be.show=$e(Be.show),Be.size=$e(Be.size),Be.stroke=$e(Be.stroke),Be.width=$e(Be.width),Be.fill=$e(Be.fill);const _t=i.focus=$t({},l.focus||{alpha:.3},X.focus),Et=_t.prox>=0,cn=Et&&Be.one;let yt=[],Sn=[],Ft=[];function Cr(m,S){let _=Be.show(i,S);if(_ instanceof HTMLElement)return Sr(_,Y0),Sr(_,m.class),ai(_,-10,-10,Pe,pe),N.insertBefore(_,yt[S]),_}function bi(m,S){if(o==1||S>0){let _=o==1&&z[m.scale].time,E=m.value;m.value=_?Qp(E)?nm(ke,tm(E,le)):E||J:E||a1,m.label=m.label||(_?e1:Zw)}if(cn||S>0){m.width=m.width==null?1:m.width,m.paths=m.paths||_1||dw,m.fillTo=$e(m.fillTo||h1),m.pxAlign=+Xe(m.pxAlign,C),m.pxRound=fm(m.pxAlign),m.stroke=$e(m.stroke||null),m.fill=$e(m.fill||null),m._stroke=m._fill=m._paths=m._focus=null;let _=u1(Kn(1,m.width),1),E=m.points=$t({},{size:_,width:Kn(1,_*.2),stroke:m.stroke,space:_*2,paths:E1,_stroke:null,_fill:null},m.points);E.show=$e(E.show),E.filter=$e(E.filter),E.fill=$e(E.fill),E.stroke=$e(E.stroke),E.paths=$e(E.paths),E.pxAlign=m.pxAlign}if(ee){let _=Xr(m,S);Oe.splice(S,0,_[0]),Gt.splice(S,0,_[1]),W.values.push(null)}if(be){M.splice(S,0,null);let _=null;cn?S==0&&(_=Cr(m,S)):S>0&&(_=Cr(m,S)),yt.splice(S,0,_),Sn.splice(S,0,0),Ft.splice(S,0,0)}Wt("addSeries",S)}function Pu(m,S){S=S??A.length,m=o==1?jf(m,S,im,um):jf(m,S,{},am),A.splice(S,0,m),bi(A[S],S)}i.addSeries=Pu;function Au(m){if(A.splice(m,1),ee){W.values.splice(m,1),Gt.splice(m,1);let S=Oe.splice(m,1)[0];rn(null,S.firstChild),S.remove()}be&&(M.splice(m,1),yt.splice(m,1)[0].remove(),Sn.splice(m,1),Ft.splice(m,1)),Wt("delSeries",m)}i.delSeries=Au;const jn=[!1,!1,!1,!1];function Fo(m,S){if(m._show=m.show,m.show){let _=m.side%2,E=z[m.scale];E==null&&(m.scale=_?A[1].scale:G,E=z[m.scale]);let D=E.time;m.size=$e(m.size),m.space=$e(m.space),m.rotate=$e(m.rotate),ls(m.incrs)&&m.incrs.forEach(Q=>{!os.has(Q)&&os.set(Q,og(Q))}),m.incrs=$e(m.incrs||(E.distr==2?Lw:D?U==1?Aw:Fw:Os)),m.splits=$e(m.splits||(D&&E.distr==1?oe:E.distr==3?Of:E.distr==4?r1:n1)),m.stroke=$e(m.stroke),m.grid.stroke=$e(m.grid.stroke),m.ticks.stroke=$e(m.ticks.stroke),m.border.stroke=$e(m.border.stroke);let I=m.values;m.values=ls(I)&&!ls(I[0])?$e(I):D?ls(I)?em(ke,Zp(I,le)):Qp(I)?Bw(ke,I):I||ae:I||t1,m.filter=$e(m.filter||(E.distr>=3&&E.log==10?l1:E.distr==3&&E.log==2?o1:sg)),m.font=mm(m.font),m.labelFont=mm(m.labelFont),m._size=m.size(i,null,S,0),m._space=m._rotate=m._incrs=m._found=m._splits=m._values=null,m._size>0&&(jn[S]=!0,m._el=Pr(V0,x))}}function Ti(m,S,_,E){let[D,I,Q,ne]=_,se=S%2,de=0;return se==0&&(ne||I)&&(de=S==0&&!D||S==2&&!Q?Zt(rm.size/3):0),se==1&&(D||Q)&&(de=S==1&&!I||S==3&&!ne?Zt(lm.size/2):0),de}const Ho=i.padding=(l.padding||[Ti,Ti,Ti,Ti]).map(m=>$e(Xe(m,Ti))),Ir=i._padding=Ho.map((m,S)=>m(i,S,jn,0));let Ht,zt=null,Ot=null;const Hs=o==1?A[0].idxs:null;let cr=null,at=!1;function Wo(m,S){if(t=m??[],i.data=i._data=t,o==2){Ht=0;for(let _=1;_=0,Dt=!0,Fn()}}i.setData=Wo;function as(){at=!0;let m,S;o==1&&(Ht>0?(zt=Hs[0]=0,Ot=Hs[1]=Ht-1,m=t[0][zt],S=t[0][Ot],xe==2?(m=zt,S=Ot):m==S&&(xe==3?[m,S]=Nu(m,m,q.log,!1):xe==4?[m,S]=Zf(m,m,q.log,!1):q.time?S=m+Zt(86400/U):[m,S]=hu(m,S,ed,!0))):(zt=Hs[0]=m=null,Ot=Hs[1]=S=null)),dr(G,m,S)}let us,Fr,Pl,Ws,Mi,qn,Al,In,jl,bn;function Bo(m,S,_,E,D,I){m??(m=zp),_??(_=nd),E??(E="butt"),D??(D=zp),I??(I="round"),m!=us&&(v.strokeStyle=us=m),D!=Fr&&(v.fillStyle=Fr=D),S!=Pl&&(v.lineWidth=Pl=S),I!=Mi&&(v.lineJoin=Mi=I),E!=qn&&(v.lineCap=qn=E),_!=Ws&&v.setLineDash(Ws=_)}function cs(m,S,_,E){S!=Fr&&(v.fillStyle=Fr=S),m!=Al&&(v.font=Al=m),_!=In&&(v.textAlign=In=_),E!=jl&&(v.textBaseline=jl=E)}function Di(m,S,_,E,D=0){if(E.length>0&&m.auto(i,at)&&(S==null||S.min==null)){let I=Xe(zt,0),Q=Xe(Ot,E.length-1),ne=_.min==null?lw(E,I,Q,D,m.distr==3):[_.min,_.max];m.min=Yr(m.min,_.min=ne[0]),m.max=Kn(m.max,_.max=ne[1])}}const zi={min:null,max:null};function Bs(){for(let E in z){let D=z[E];ye[E]==null&&(D.min==null||ye[G]!=null&&D.auto(i,at))&&(ye[E]=zi)}for(let E in z){let D=z[E];ye[E]==null&&D.from!=null&&ye[D.from]!=null&&(ye[E]=zi)}ye[G]!=null&&di(!0);let m={};for(let E in ye){let D=ye[E];if(D!=null){let I=m[E]=Nl(z[E],mw);if(D.min!=null)$t(I,D);else if(E!=G||o==2)if(Ht==0&&I.from==null){let Q=I.range(i,null,null,E);I.min=Q[0],I.max=Q[1]}else I.min=ft,I.max=-ft}}if(Ht>0){A.forEach((E,D)=>{if(o==1){let I=E.scale,Q=ye[I];if(Q==null)return;let ne=m[I];if(D==0){let se=ne.range(i,ne.min,ne.max,I);ne.min=se[0],ne.max=se[1],zt=Kr(ne.min,t[0]),Ot=Kr(ne.max,t[0]),Ot-zt>1&&(t[0][zt]ne.max&&Ot--),E.min=cr[zt],E.max=cr[Ot]}else E.show&&E.auto&&Di(ne,Q,E,t[D],E.sorted);E.idxs[0]=zt,E.idxs[1]=Ot}else if(D>0&&E.show&&E.auto){let[I,Q]=E.facets,ne=I.scale,se=Q.scale,[de,me]=t[D],ve=m[ne],Ae=m[se];ve!=null&&Di(ve,ye[ne],I,de,I.sorted),Ae!=null&&Di(Ae,ye[se],Q,me,Q.sorted),E.min=Q.min,E.max=Q.max}});for(let E in m){let D=m[E],I=ye[E];if(D.from==null&&(I==null||I.min==null)){let Q=D.range(i,D.min==ft?null:D.min,D.max==-ft?null:D.max,E);D.min=Q[0],D.max=Q[1]}}}for(let E in m){let D=m[E];if(D.from!=null){let I=m[D.from];if(I.min==null)D.min=D.max=null;else{let Q=D.range(i,I.min,I.max,E);D.min=Q[0],D.max=Q[1]}}}let S={},_=!1;for(let E in m){let D=m[E],I=z[E];if(I.min!=D.min||I.max!=D.max){I.min=D.min,I.max=D.max;let Q=I.distr;I._min=Q==3?ki(I.min):Q==4?mf(I.min,I.asinh):Q==100?I.fwd(I.min):I.min,I._max=Q==3?ki(I.max):Q==4?mf(I.max,I.asinh):Q==100?I.fwd(I.max):I.max,S[E]=_=!0}}if(_){A.forEach((E,D)=>{o==2?D>0&&S.y&&(E._paths=null):S[E.scale]&&(E._paths=null)});for(let E in S)or=!0,Wt("setScale",E);be&&X.left>=0&&(ar=Dt=!0)}for(let E in ye)ye[E]=null}function ju(m){let S=zf(zt-1,0,Ht-1),_=zf(Ot+1,0,Ht-1);for(;m[S]==null&&S>0;)S--;for(;m[_]==null&&_0){let m=A.some(S=>S._focus)&&bn!=_t.alpha;m&&(v.globalAlpha=bn=_t.alpha),A.forEach((S,_)=>{if(_>0&&S.show&&(Us(_,!1),Us(_,!0),S._paths==null)){let E=bn;bn!=S.alpha&&(v.globalAlpha=bn=S.alpha);let D=o==2?[0,t[_][0].length-1]:ju(t[_]);S._paths=S.paths(i,_,D[0],D[1]),bn!=E&&(v.globalAlpha=bn=E)}}),A.forEach((S,_)=>{if(_>0&&S.show){let E=bn;bn!=S.alpha&&(v.globalAlpha=bn=S.alpha),S._paths!=null&&Il(_,!1);{let D=S._paths!=null?S._paths.gaps:null,I=S.points.show(i,_,zt,Ot,D),Q=S.points.filter(i,_,I,D);(I||Q)&&(S.points._paths=S.points.paths(i,_,zt,Ot,Q),Il(_,!0))}bn!=E&&(v.globalAlpha=bn=E),Wt("drawSeries",_)}}),m&&(v.globalAlpha=bn=1)}}function Us(m,S){let _=S?A[m].points:A[m];_._stroke=_.stroke(i,m),_._fill=_.fill(i,m)}function Il(m,S){let _=S?A[m].points:A[m],{stroke:E,fill:D,clip:I,flags:Q,_stroke:ne=_._stroke,_fill:se=_._fill,_width:de=_.width}=_._paths;de=dt(de*Ze,3);let me=null,ve=de%2/2;S&&se==null&&(se=de>0?"#fff":ne);let Ae=_.pxAlign==1&&ve>0;if(Ae&&v.translate(ve,ve),!S){let Ke=on-de/2,Ve=gn-de/2,He=Yt+de,Me=vn+de;me=new Path2D,me.rect(Ke,Ve,He,Me)}S?Hl(ne,de,_.dash,_.cap,se,E,D,Q,I):Fl(m,ne,de,_.dash,_.cap,se,E,D,Q,me,I),Ae&&v.translate(-ve,-ve)}function Fl(m,S,_,E,D,I,Q,ne,se,de,me){let ve=!1;se!=0&&$.forEach((Ae,Ke)=>{if(Ae.series[0]==m){let Ve=A[Ae.series[1]],He=t[Ae.series[1]],Me=(Ve._paths||bo).band;ls(Me)&&(Me=Ae.dir==1?Me[0]:Me[1]);let Re,lt=null;Ve.show&&Me&&aw(He,zt,Ot)?(lt=Ae.fill(i,Ke)||I,Re=Ve._paths.clip):Me=null,Hl(S,_,E,D,lt,Q,ne,se,de,me,Re,Me),ve=!0}}),ve||Hl(S,_,E,D,I,Q,ne,se,de,me)}const Oi=bl|Pf;function Hl(m,S,_,E,D,I,Q,ne,se,de,me,ve){Bo(m,S,_,E,D),(se||de||ve)&&(v.save(),se&&v.clip(se),de&&v.clip(de)),ve?(ne&Oi)==Oi?(v.clip(ve),me&&v.clip(me),Ge(D,Q),Li(m,I,S)):ne&Pf?(Ge(D,Q),v.clip(ve),Li(m,I,S)):ne&bl&&(v.save(),v.clip(ve),me&&v.clip(me),Ge(D,Q),v.restore(),Li(m,I,S)):(Ge(D,Q),Li(m,I,S)),(se||de||ve)&&v.restore()}function Li(m,S,_){_>0&&(S instanceof Map?S.forEach((E,D)=>{v.strokeStyle=us=D,v.stroke(E)}):S!=null&&m&&v.stroke(S))}function Ge(m,S){S instanceof Map?S.forEach((_,E)=>{v.fillStyle=Fr=E,v.fill(_)}):S!=null&&m&&v.fill(S)}function Uo(m,S,_,E){let D=V[m],I;if(E<=0)I=[0,0];else{let Q=D._space=D.space(i,m,S,_,E),ne=D._incrs=D.incrs(i,m,S,_,E,Q);I=T1(S,_,ne,E,Q)}return D._found=I}function Vs(m,S,_,E,D,I,Q,ne,se,de){let me=Q%2/2;C==1&&v.translate(me,me),Bo(ne,Q,se,de,ne),v.beginPath();let ve,Ae,Ke,Ve,He=D+(E==0||E==3?-I:I);_==0?(Ae=D,Ve=He):(ve=D,Ke=He);for(let Me=0;Me{if(!_.show)return;let D=z[_.scale];if(D.min==null){_._show&&(S=!1,_._show=!1,di(!1));return}else _._show||(S=!1,_._show=!0,di(!1));let I=_.side,Q=I%2,{min:ne,max:se}=D,[de,me]=Uo(E,ne,se,Q==0?Pe:pe);if(me==0)return;let ve=D.distr==2,Ae=_._splits=_.splits(i,E,ne,se,de,me,ve),Ke=D.distr==2?Ae.map(Re=>cr[Re]):Ae,Ve=D.distr==2?cr[Ae[1]]-cr[Ae[0]]:de,He=_._values=_.values(i,_.filter(i,Ke,E,me,Ve),E,me,Ve);_._rotate=I==2?_.rotate(i,He,E,me):0;let Me=_._size;_._size=jr(_.size(i,He,E,m)),Me!=null&&_._size!=Me&&(S=!1)}),S}function Vo(m){let S=!0;return Ho.forEach((_,E)=>{let D=_(i,E,jn,m);D!=Ir[E]&&(S=!1),Ir[E]=D}),S}function $o(){for(let m=0;mcr[xn]):Ke,He=me.distr==2?cr[Ke[1]]-cr[Ke[0]]:se,Me=S.ticks,Re=S.border,lt=Me.show?Me.size:0,wt=Zt(lt*Ze),Bt=Zt((S.alignTo==2?S._size-lt-S.gap:S.gap)*Ze),nt=S._rotate*-tu/180,St=L(S._pos*Ze),Wn=(wt+Bt)*ne,ut=St+Wn;I=E==0?ut:0,D=E==1?ut:0;let fn=S.font[0],Zn=S.align==1?yl:S.align==2?df:nt>0?yl:nt<0?df:E==0?"center":_==3?df:yl,mr=nt||E==1?"middle":_==2?vo:Dp;cs(fn,Q,Zn,mr);let Mn=S.font[1]*S.lineGap,Bn=Ke.map(xn=>L(d(xn,me,ve,Ae))),Un=S._values;for(let xn=0;xn{_>0&&(S._paths=null,m&&(o==1?(S.min=null,S.max=null):S.facets.forEach(E=>{E.min=null,E.max=null})))})}let Pi=!1,Ai=!1,Xn=[];function ti(){Ai=!1;for(let m=0;m0&&queueMicrotask(ti)}i.batch=fs;function ji(){if(Jr&&(Bs(),Jr=!1),or&&(ur(),or=!1),Zr){if(vt(T,yl,Je),vt(T,vo,tt),vt(T,So,Pe),vt(T,xo,pe),vt(N,yl,Je),vt(N,vo,tt),vt(N,So,Pe),vt(N,xo,pe),vt(x,So,sn),vt(x,xo,lr),y.width=Zt(sn*Ze),y.height=Zt(lr*Ze),V.forEach(({_el:m,_show:S,_size:_,_pos:E,side:D})=>{if(m!=null)if(S){let I=D===3||D===0?_:0,Q=D%2==1;vt(m,Q?"left":"top",E-I),vt(m,Q?"width":"height",_),vt(m,Q?"top":"left",Q?tt:Je),vt(m,Q?"height":"width",Q?pe:Pe),Mf(m,Ls)}else Sr(m,Ls)}),us=Fr=Pl=Mi=qn=Al=In=jl=Ws=null,bn=1,ys(!0),Je!=ln||tt!=Rn||Pe!=Kt||pe!=Nt){di(!1);let m=Pe/Kt,S=pe/Nt;if(be&&!ar&&X.left>=0){X.left*=m,X.top*=S,Rr&&ai(Rr,Zt(X.left),0,Pe,pe),Ii&&ai(Ii,0,Zt(X.top),Pe,pe);for(let _=0;_=0&&st.width>0){st.left*=m,st.width*=m,st.top*=S,st.height*=S;for(let _ in Kl)vt(pi,_,st[_])}ln=Je,Rn=tt,Kt=Pe,Nt=pe}Wt("setSize"),Zr=!1}sn>0&&lr>0&&(v.clearRect(0,0,y.width,y.height),Wt("drawClear"),Z.forEach(m=>m()),Wt("draw")),st.show&&ei&&(fr(st),ei=!1),be&&ar&&(mi(null,!0,!1),ar=!1),W.show&&W.live&&Dt&&(vs(),Dt=!1),p||(p=!0,i.status=1,Wt("ready")),at=!1,Pi=!1}i.redraw=(m,S)=>{or=S||!1,m!==!1?dr(G,q.min,q.max):Fn()};function kr(m,S){let _=z[m];if(_.from==null){if(Ht==0){let E=_.range(i,S.min,S.max,m);S.min=E[0],S.max=E[1]}if(S.min>S.max){let E=S.min;S.min=S.max,S.max=E}if(Ht>1&&S.min!=null&&S.max!=null&&S.max-S.min<1e-16)return;m==G&&_.distr==2&&Ht>0&&(S.min=Kr(S.min,t[0]),S.max=Kr(S.max,t[0]),S.min==S.max&&S.max++),ye[m]=S,Jr=!0,Fn()}}i.setScale=kr;let Bl,$s,Rr,Ii,Ul,ds,hi,Fi,Hi,Wi,Qe,it,ni=!1;const qt=X.drag;let bt=qt.x,Ct=qt.y;be&&(X.x&&(Bl=Pr(G0,N)),X.y&&($s=Pr(K0,N)),q.ori==0?(Rr=Bl,Ii=$s):(Rr=$s,Ii=Bl),Qe=X.left,it=X.top);const st=i.select=$t({show:!0,over:!0,left:0,width:0,top:0,height:0},l.select),pi=st.show?Pr($0,st.over?N:T):null;function fr(m,S){if(st.show){for(let _ in m)st[_]=m[_],_ in Kl&&vt(pi,_,m[_]);S!==!1&&Wt("setSelect")}}i.setSelect=fr;function Vl(m){if(A[m].show)ee&&Mf(Oe[m],Ls);else if(ee&&Sr(Oe[m],Ls),be){let _=cn?yt[0]:yt[m];_!=null&&ai(_,-10,-10,Pe,pe)}}function dr(m,S,_){kr(m,{min:S,max:_})}function hr(m,S,_,E){S.focus!=null&&$l(m),S.show!=null&&A.forEach((D,I)=>{I>0&&(m==I||m==null)&&(D.show=S.show,Vl(I),o==2?(dr(D.facets[0].scale,null,null),dr(D.facets[1].scale,null,null)):dr(D.scale,null,null),Fn())}),_!==!1&&Wt("setSeries",m,S),E&&ws("setSeries",i,m,S)}i.setSeries=hr;function Gs(m,S){$t($[m],S)}function Ks(m,S){m.fill=$e(m.fill||null),m.dir=Xe(m.dir,-1),S=S??$.length,$.splice(S,0,m)}function Go(m){m==null?$.length=0:$.splice(m,1)}i.addBand=Ks,i.setBand=Gs,i.delBand=Go;function Hn(m,S){A[m].alpha=S,be&&yt[m]!=null&&(yt[m].style.opacity=S),ee&&Oe[m]&&(Oe[m].style.opacity=S)}let Tn,Nr,pr;const Bi={focus:!0};function $l(m){if(m!=pr){let S=m==null,_=_t.alpha!=1;A.forEach((E,D)=>{if(o==1||D>0){let I=S||D==0||D==m;E._focus=S?null:I,_&&Hn(D,I?1:_t.alpha)}}),pr=m,_&&Fn()}}ee&&Et&&et(Pp,Ee,m=>{X._lock||(wn(m),pr!=null&&hr(null,Bi,!0,Tt.setSeries))});function Jn(m,S,_){let E=z[S];_&&(m=m/Ze-(E.ori==1?tt:Je));let D=Pe;E.ori==1&&(D=pe,m=D-m),E.dir==-1&&(m=D-m);let I=E._min,Q=E._max,ne=m/D,se=I+(Q-I)*ne,de=E.distr;return de==3?kl(10,se):de==4?cw(se,E.asinh):de==100?E.bwd(se):se}function hs(m,S){let _=Jn(m,G,S);return Kr(_,t[0],zt,Ot)}i.valToIdx=m=>Kr(m,t[0]),i.posToIdx=hs,i.posToVal=Jn,i.valToPos=(m,S,_)=>z[S].ori==0?u(m,z[S],_?Yt:Pe,_?on:0):c(m,z[S],_?vn:pe,_?gn:0),i.setCursor=(m,S,_)=>{Qe=m.left,it=m.top,mi(null,S,_)};function ps(m,S){vt(pi,yl,st.left=m),vt(pi,So,st.width=S)}function Gl(m,S){vt(pi,vo,st.top=m),vt(pi,xo,st.height=S)}let ms=q.ori==0?ps:Gl,gs=q.ori==1?ps:Gl;function Fu(){if(ee&&W.live)for(let m=o==2?1:0;m{M[E]=_}):pw(m.idx)||M.fill(m.idx),W.idx=M[0]),ee&&W.live){for(let _=0;_0||o==1&&!jt)&&Hu(_,M[_]);Fu()}Dt=!1,S!==!1&&Wt("setLegend")}i.setLegend=vs;function Hu(m,S){let _=A[m],E=m==0&&xe==2?cr:t[m],D;jt?D=_.values(i,m,S)??It:(D=_.value(i,S==null?null:E[S],m,S),D=D==null?It:{_:D}),W.values[m]=D}function mi(m,S,_){Hi=Qe,Wi=it,[Qe,it]=X.move(i,Qe,it),X.left=Qe,X.top=it,be&&(Rr&&ai(Rr,Zt(Qe),0,Pe,pe),Ii&&ai(Ii,0,Zt(it),Pe,pe));let E,D=zt>Ot;Tn=ft,Nr=null;let I=q.ori==0?Pe:pe,Q=q.ori==1?Pe:pe;if(Qe<0||Ht==0||D){E=X.idx=null;for(let ne=0;ne0&<.show){let Wn=nt==null?-10:nt==E?de:ce(o==1?t[0][nt]:t[Re][0][nt],q,I,0),ut=St==null?-10:ge(St,o==1?z[lt.scale]:z[lt.facets[1].scale],Q,0);if(Et&&St!=null){let fn=q.ori==1?Qe:it,Zn=en(_t.dist(i,Re,nt,ut,fn));if(Zn=0?1:-1,Un=Mn>=0?1:-1;Un==Bn&&(Un==1?mr==1?St>=Mn:St<=Mn:mr==1?St<=Mn:St>=Mn)&&(Tn=Zn,Nr=Re)}else Tn=Zn,Nr=Re}}if(Dt||cn){let fn,Zn;q.ori==0?(fn=Wn,Zn=ut):(fn=ut,Zn=Wn);let mr,Mn,Bn,Un,br,xn,Ut=!0,Hr=Be.bbox;if(Hr!=null){Ut=!1;let Lt=Hr(i,Re);Bn=Lt.left,Un=Lt.top,mr=Lt.width,Mn=Lt.height}else Bn=fn,Un=Zn,mr=Mn=Be.size(i,Re);if(xn=Be.fill(i,Re),br=Be.stroke(i,Re),cn)Re==Nr&&Tn<=_t.prox&&(me=Bn,ve=Un,Ae=mr,Ke=Mn,Ve=Ut,He=xn,Me=br);else{let Lt=yt[Re];Lt!=null&&(Sn[Re]=Bn,Ft[Re]=Un,Bp(Lt,mr,Mn,Ut),Hp(Lt,xn,br),ai(Lt,jr(Bn),jr(Un),Pe,pe))}}}}if(cn){let Re=_t.prox,lt=pr==null?Tn<=Re:Tn>Re||Nr!=pr;if(Dt||lt){let wt=yt[0];wt!=null&&(Sn[0]=me,Ft[0]=ve,Bp(wt,Ae,Ke,Ve),Hp(wt,He,Me),ai(wt,jr(me),jr(ve),Pe,pe))}}}if(st.show&&ni)if(m!=null){let[ne,se]=Tt.scales,[de,me]=Tt.match,[ve,Ae]=m.cursor.sync.scales,Ke=m.cursor.drag;if(bt=Ke._x,Ct=Ke._y,bt||Ct){let{left:Ve,top:He,width:Me,height:Re}=m.select,lt=m.scales[ve].ori,wt=m.posToVal,Bt,nt,St,Wn,ut,fn=ne!=null&&de(ne,ve),Zn=se!=null&&me(se,Ae);fn&&bt?(lt==0?(Bt=Ve,nt=Me):(Bt=He,nt=Re),St=z[ne],Wn=ce(wt(Bt,ve),St,I,0),ut=ce(wt(Bt+nt,ve),St,I,0),ms(Yr(Wn,ut),en(ut-Wn))):ms(0,I),Zn&&Ct?(lt==1?(Bt=Ve,nt=Me):(Bt=He,nt=Re),St=z[se],Wn=ge(wt(Bt,Ae),St,Q,0),ut=ge(wt(Bt+nt,Ae),St,Q,0),gs(Yr(Wn,ut),en(ut-Wn))):gs(0,Q)}else Yl()}else{let ne=en(Hi-Ul),se=en(Wi-ds);if(q.ori==1){let Ae=ne;ne=se,se=Ae}bt=qt.x&&ne>=qt.dist,Ct=qt.y&&se>=qt.dist;let de=qt.uni;de!=null?bt&&Ct&&(bt=ne>=de,Ct=se>=de,!bt&&!Ct&&(se>ne?Ct=!0:bt=!0)):qt.x&&qt.y&&(bt||Ct)&&(bt=Ct=!0);let me,ve;bt&&(q.ori==0?(me=hi,ve=Qe):(me=Fi,ve=it),ms(Yr(me,ve),en(ve-me)),Ct||gs(0,Q)),Ct&&(q.ori==1?(me=hi,ve=Qe):(me=Fi,ve=it),gs(Yr(me,ve),en(ve-me)),bt||ms(0,I)),!bt&&!Ct&&(ms(0,0),gs(0,0))}if(qt._x=bt,qt._y=Ct,m==null){if(_){if(Xs!=null){let[ne,se]=Tt.scales;Tt.values[0]=ne!=null?Jn(q.ori==0?Qe:it,ne):null,Tt.values[1]=se!=null?Jn(q.ori==1?Qe:it,se):null}ws(hf,i,Qe,it,Pe,pe,E)}if(Et){let ne=_&&Tt.setSeries,se=_t.prox;pr==null?Tn<=se&&hr(Nr,Bi,!0,ne):Tn>se?hr(null,Bi,!0,ne):Nr!=pr&&hr(Nr,Bi,!0,ne)}}Dt&&(W.idx=E,vs()),S!==!1&&Wt("setCursor")}let ri=null;Object.defineProperty(i,"rect",{get(){return ri==null&&ys(!1),ri}});function ys(m=!1){m?ri=null:(ri=N.getBoundingClientRect(),Wt("syncRect",ri))}function Ko(m,S,_,E,D,I,Q){X._lock||ni&&m!=null&&m.movementX==0&&m.movementY==0||(Ys(m,S,_,E,D,I,Q,!1,m!=null),m!=null?mi(null,!0,!0):mi(S,!0,!1))}function Ys(m,S,_,E,D,I,Q,ne,se){if(ri==null&&ys(!1),wn(m),m!=null)_=m.clientX-ri.left,E=m.clientY-ri.top;else{if(_<0||E<0){Qe=-10,it=-10;return}let[de,me]=Tt.scales,ve=S.cursor.sync,[Ae,Ke]=ve.values,[Ve,He]=ve.scales,[Me,Re]=Tt.match,lt=S.axes[0].side%2==1,wt=q.ori==0?Pe:pe,Bt=q.ori==1?Pe:pe,nt=lt?I:D,St=lt?D:I,Wn=lt?E:_,ut=lt?_:E;if(Ve!=null?_=Me(de,Ve)?d(Ae,z[de],wt,0):-10:_=wt*(Wn/nt),He!=null?E=Re(me,He)?d(Ke,z[me],Bt,0):-10:E=Bt*(ut/St),q.ori==1){let fn=_;_=E,E=fn}}se&&(S==null||S.cursor.event.type==hf)&&((_<=1||_>=Pe-1)&&(_=zs(_,Pe)),(E<=1||E>=pe-1)&&(E=zs(E,pe))),ne?(Ul=_,ds=E,[hi,Fi]=X.move(i,_,E)):(Qe=_,it=E)}const Kl={width:0,height:0,left:0,top:0};function Yl(){fr(Kl,!1)}let Yo,Qo,Qs,qo;function Xo(m,S,_,E,D,I,Q){ni=!0,bt=Ct=qt._x=qt._y=!1,Ys(m,S,_,E,D,I,Q,!0,!1),m!=null&&(et(pf,bf,Jo,!1),ws(Op,i,hi,Fi,Pe,pe,null));let{left:ne,top:se,width:de,height:me}=st;Yo=ne,Qo=se,Qs=de,qo=me}function Jo(m,S,_,E,D,I,Q){ni=qt._x=qt._y=!1,Ys(m,S,_,E,D,I,Q,!1,!0);let{left:ne,top:se,width:de,height:me}=st,ve=de>0||me>0,Ae=Yo!=ne||Qo!=se||Qs!=de||qo!=me;if(ve&&Ae&&fr(st),qt.setScale&&ve&&Ae){let Ke=ne,Ve=de,He=se,Me=me;if(q.ori==1&&(Ke=se,Ve=me,He=ne,Me=de),bt&&dr(G,Jn(Ke,G),Jn(Ke+Ve,G)),Ct)for(let Re in z){let lt=z[Re];Re!=G&<.from==null&<.min!=ft&&dr(Re,Jn(He+Me,Re),Jn(He,Re))}Yl()}else X.lock&&(X._lock=!X._lock,mi(S,!0,m!=null));m!=null&&(rn(pf,bf),ws(pf,i,Qe,it,Pe,pe,null))}function Zo(m,S,_,E,D,I,Q){if(X._lock)return;wn(m);let ne=ni;if(ni){let se=!0,de=!0,me=10,ve,Ae;q.ori==0?(ve=bt,Ae=Ct):(ve=Ct,Ae=bt),ve&&Ae&&(se=Qe<=me||Qe>=Pe-me,de=it<=me||it>=pe-me),ve&&se&&(Qe=Qe{let D=Tt.match[2];_=D(i,S,_),_!=-1&&hr(_,E,!0,!1)},be&&(et(Op,N,Xo),et(hf,N,Ko),et(Lp,N,m=>{wn(m),ys(!1)}),et(Pp,N,Zo),et(Ap,N,ea),Af.add(i),i.syncRect=ys);const qs=i.hooks=l.hooks||{};function Wt(m,S,_){Ai?Xn.push([m,S,_]):m in qs&&qs[m].forEach(E=>{E.call(null,i,S,_)})}(l.plugins||[]).forEach(m=>{for(let S in m.hooks)qs[S]=(qs[S]||[]).concat(m.hooks[S])});const na=(m,S,_)=>_,Tt=$t({key:null,setSeries:!1,filters:{pub:Kp,sub:Kp},scales:[G,A[1]?A[1].scale:null],match:[Yp,Yp,na],values:[null,null]},X.sync);Tt.match.length==2&&Tt.match.push(na),X.sync=Tt;const Xs=Tt.key,gi=Ng(Xs);function ws(m,S,_,E,D,I,Q){Tt.filters.pub(m,S,_,E,D,I,Q)&&gi.pub(m,S,_,E,D,I,Q)}gi.sub(i);function ra(m,S,_,E,D,I,Q){Tt.filters.sub(m,S,_,E,D,I,Q)&&Ui[m](null,S,_,E,D,I,Q)}i.pub=ra;function ia(){gi.unsub(i),Af.delete(i),An.clear(),Df(du,El,ta),g.remove(),Ee==null||Ee.remove(),Wt("destroy")}i.destroy=ia;function Js(){Wt("init",l,t),Wo(t||l.data,!1),ye[G]?kr(G,ye[G]):as(),ei=st.show&&(st.width>0||st.height>0),ar=Dt=!0,ot(l.width,l.height)}return A.forEach(bi),V.forEach(Fo),r?r instanceof HTMLElement?(r.appendChild(g),Js()):r(i,Js):Js(),i}Pn.assign=$t;Pn.fmtNum=td;Pn.rangeNum=hu;Pn.rangeLog=Nu;Pn.rangeAsinh=Zf;Pn.orient=Fs;Pn.pxRatio=Ze;Pn.join=xw;Pn.fmtDate=rd,Pn.tzDate=zw;Pn.sync=Ng;{Pn.addGap=p1,Pn.clipGaps=Mu;let l=Pn.paths={points:Og};l.linear=Pg,l.stepped=v1,l.bars=y1,l.spline=S1}const D1=6e3;class z1{constructor(t=D1){mo(this,"t");mo(this,"v");mo(this,"len",0);mo(this,"head",0);this.t=new Float64Array(t),this.v=new Float64Array(t)}push(t,r){const i=this.t.length;this.t[this.head]=t,this.v[this.head]=r,this.head=(this.head+1)%i,this.len=t&&(u[d]=this.t[g],c[d]=this.v[g],d++)}return{t:u.subarray(0,d),v:c.subarray(0,d)}}last(){if(this.len===0)return null;const t=this.t.length;return this.v[(this.head-1+t)%t]}}const If=new Map;function O1(l){let t=If.get(l);return t||(t=new z1,If.set(l,t)),t}function Fg(l,t){const r=O1(l);for(const[i,o]of t)r.push(i,o)}function Hg(l,t=-1/0){const r=If.get(l);return r?r.read(t):{t:new Float64Array(0),v:new Float64Array(0)}}const Cl=new Map;let nu=[];function Wg(){nu.forEach(l=>l())}function L1(l){Cl.set(l,(Cl.get(l)||0)+1),Wg()}function P1(l){const t=(Cl.get(l)||0)-1;t<=0?Cl.delete(l):Cl.set(l,t),Wg()}function A1(){return Array.from(Cl.keys())}function j1(l){return nu.push(l),()=>{nu=nu.filter(t=>t!==l)}}const gm=3e3;let xl=[],ru=[];function I1(l){l.length&&(xl=xl.concat(l),xl.length>gm&&(xl=xl.slice(-gm)),ru.forEach(t=>t()))}function F1(){return xl}function H1(l){return ru.push(l),()=>{ru=ru.filter(t=>t!==l)}}let iu=0,su=[];function vm(l){iu+=l?1:-1,iu<0&&(iu=0),su.forEach(t=>t())}function W1(){return iu>0}function B1(l){return su.push(l),()=>{su=su.filter(t=>t!==l)}}let js=null,wf=null;function U1(){return`${location.protocol==="https:"?"wss":"ws"}://${location.host}/api/monitor/stream`}function ym(){js&&js.readyState===WebSocket.OPEN&&js.send(JSON.stringify({type:"subscribe",signals:A1()}))}function wm(){js&&js.readyState===WebSocket.OPEN&&js.send(JSON.stringify({type:"raw",enabled:W1()}))}function Bg(){const l=new WebSocket(U1());js=l,l.onopen=()=>{We.getState().setConnected(!0),ym(),wm()},l.onclose=()=>{We.getState().setConnected(!1),wf==null&&(wf=window.setTimeout(()=>{wf=null,Bg()},1e3))},l.onerror=()=>l.close(),l.onmessage=r=>{let i;try{i=JSON.parse(r.data)}catch{return}const o=We.getState();switch(i.type){case"meta":o.setMeta(i.signals,i.pairs),o.setMotors(i.motors);break;case"motors":o.setMotors(i.motors),i.status&&o.setStatus(i.status);break;case"samples":for(const[u,c]of Object.entries(i.data))Fg(u,c);break;case"raw":I1(i.frames);break}};let t=null;j1(()=>{t==null&&(t=window.setTimeout(()=>{t=null,ym()},80))}),B1(wm)}async function V1(l,t=600){return l.length?(await fetch(`/api/monitor/snapshot?signals=${l.join(",")}&n=${t}`)).json():{}}async function $1(){try{return(await(await fetch("/api/monitor/motor-types")).json()).types||[]}catch{return[]}}async function G1(l,t){await fetch("/api/monitor/motor-type",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({motorId:l,motorType:t})})}const K1={pos:"#58a6ff",vel:"#3fb950",torque:"#d29922",kp:"#bc8cff",kd:"#f778ba",vel_limit:"#56d4dd",torque_limit:"#e3b341",t_mos:"#ff7b72",t_rotor:"#ffa657",status_code:"#8b949e"};function Ug(l){return K1[l]||"#8b949e"}function Y1(l){const t=Ug(l.field);return l.source==="cmd"?X1(t,.15):t}function Q1(l,t){const r=l.replace("#",""),i=parseInt(r.slice(0,2),16),o=parseInt(r.slice(2,4),16),u=parseInt(r.slice(4,6),16);return`rgba(${i},${o},${u},${t})`}function Sm(l){const t=Ug(l.field);return l.source==="cmd"?{stroke:Q1(t,.45),width:1.25}:{stroke:t,width:1.85}}function Ff(l){const t=l.split(":");return t.length>=3?`${t[1]} ${t[2]}`:l}function q1(l){return l.includes(":cmd.")}const xm=["pos","vel","torque","kp","kd","t_mos","t_rotor"];function X1(l,t){const r=l.replace("#",""),i=Math.min(255,Math.round(parseInt(r.slice(0,2),16)+255*t)),o=Math.min(255,Math.round(parseInt(r.slice(2,4),16)+255*t)),u=Math.min(255,Math.round(parseInt(r.slice(4,6),16)+255*t));return`rgb(${i},${o},${u})`}function Tl(l,t=3){return l==null||Number.isNaN(l)?"—":l.toFixed(t)}const _m=2e3;function J1(l,t){const r=l.map(c=>Hg(c,t)),i=new Set;for(const c of r)for(let d=0;dc-d);if(o.length>_m){const c=Math.ceil(o.length/_m);o=o.filter((d,p)=>p%c===0)}const u=[o];for(const c of r){const d=new Array(o.length).fill(null);let p=0,g=null;for(let y=0;yC.ensurePlot),r=We(C=>C.removeSignalFromPlot),i=We(C=>C.setPlotConfig),o=We(C=>C.plotConfigs[l]),u=We(C=>C.signals);P.useEffect(()=>{t(l)},[l,t]);const c=(o==null?void 0:o.signals)??[],d=(o==null?void 0:o.duration)??10,p=c.join("|"),{setNodeRef:g,isOver:y}=g0({id:`plot:${l}`,data:{panelId:l}}),v=P.useRef(null),x=P.useRef(null),T=P.useRef(0);P.useEffect(()=>{if(!v.current)return;const C=v.current,L=new Map(u.map($=>[$.id,$])),U=[{label:"t"},...c.map($=>{const G=L.get($),Y=G?Sm(G):{stroke:"#8b949e",width:1.5};return{label:Ff($),stroke:Y.stroke,width:Y.width,points:{show:!1}}})],A={width:C.clientWidth||400,height:C.clientHeight||220,legend:{show:!1},series:U,cursor:{y:!1,points:{show:!0}},scales:{x:{time:!1}},axes:[{stroke:"#8b949e",grid:{stroke:"rgba(139,148,158,0.12)"},ticks:{stroke:"rgba(139,148,158,0.2)"},values:($,G)=>G.map(Y=>(Y-T.current).toFixed(1)+"s")},{stroke:"#8b949e",grid:{stroke:"rgba(139,148,158,0.12)"},ticks:{stroke:"rgba(139,148,158,0.2)"}}]},V=new Pn(A,[[],...c.map(()=>[])],C);x.current=V;const z=new ResizeObserver(()=>{V.setSize({width:C.clientWidth,height:C.clientHeight})});return z.observe(C),()=>{z.disconnect(),V.destroy(),x.current=null}},[p,u.length]),P.useEffect(()=>{if(!c.length)return;c.forEach(L1);let C=!1;return V1(c,1200).then(L=>{if(!C)for(const[U,A]of Object.entries(L))Fg(U,A)}),()=>{C=!0,c.forEach(P1)}},[p]),P.useEffect(()=>{let C=0;const L=()=>{const U=x.current;if(U&&c.length){let A=0;for(const z of c){const $=Hg(z);$.t.length&&(A=Math.max(A,$.t[$.t.length-1]))}T.current=A;const V=J1(c,A-d);U.setData(V,!1),U.setScale("x",{min:A-d,max:A})}C=requestAnimationFrame(L)};return C=requestAnimationFrame(L),()=>cancelAnimationFrame(C)},[p,d]);const N=P.useMemo(()=>new Map(u.map(C=>[C.id,C])),[u]);return R.jsxs("div",{className:"panel plot-panel",ref:g,children:[R.jsxs("div",{className:"plot-toolbar",children:[R.jsx("span",{className:"muted",children:"window"}),R.jsx("select",{value:d,onChange:C=>i(l,{duration:Number(C.target.value)}),children:[5,10,20,30,60].map(C=>R.jsxs("option",{value:C,children:[C,"s"]},C))}),R.jsx("div",{className:"legend",children:c.map(C=>{const L=N.get(C),U=L?Sm(L):{stroke:"#555"};return R.jsxs("span",{className:"legend-chip",children:[R.jsx("span",{className:"legend-swatch",style:{background:U.stroke,opacity:q1(C)?.9:1}}),Ff(C),R.jsx("button",{className:"legend-x",onClick:()=>r(l,C),children:"×"})]},C)})})]}),R.jsx("div",{className:"plot-host"+(y?" drop-over":""),ref:v,children:c.length===0&&R.jsx("div",{className:"drop-hint",children:"Drag signals here to plot — drop cmd onto fb to overlay"})})]})}const Sf=[["pos","cmd p"],["vel","cmd v"],["kp","kp"],["kd","kd"],["torque","cmd τ"]],xf=[["pos","act p"],["vel","act v"],["torque","act τ"],["t_mos","Tmos"],["t_rotor","Trot"]];function eS(){const l=We(t=>t.motors);return R.jsx("div",{className:"panel table-panel",children:R.jsxs("table",{className:"motor-table",children:[R.jsx("thead",{children:R.jsxs("tr",{children:[R.jsx("th",{children:"Motor"}),R.jsx("th",{children:"Mode"}),R.jsx("th",{children:"Status"}),Sf.map(([t,r])=>R.jsx("th",{className:"cmd-col",children:r},"c"+t)),xf.map(([t,r])=>R.jsx("th",{children:r},"f"+t))]})}),R.jsxs("tbody",{children:[l.length===0&&R.jsx("tr",{children:R.jsx("td",{colSpan:3+Sf.length+xf.length,className:"muted center",children:"Waiting for traffic…"})}),l.map(t=>R.jsxs("tr",{children:[R.jsxs("td",{className:"mono",children:["m",t.motorId]}),R.jsx("td",{className:"muted",children:t.mode||"—"}),R.jsx("td",{children:R.jsx("span",{className:"status-pill "+(t.status==="ENABLED"?"ok":t.status==="DISABLED"?"off":"warn"),children:t.status||"—"})}),Sf.map(([r])=>R.jsx("td",{className:"mono cmd-col",children:Tl(t.cmd[r],r==="kp"?0:3)},"c"+r)),xf.map(([r])=>R.jsx("td",{className:"mono",children:Tl(t.fb[r],r.startsWith("t_")?1:3)},"f"+r))]},`${t.bus}:${t.motorId}`))]})]})})}function _f({label:l,cmd:t,act:r,unit:i,digits:o=2}){return R.jsxs("div",{className:"metric",children:[R.jsxs("div",{className:"metric-label",children:[l," ",R.jsx("span",{className:"muted",children:i})]}),R.jsxs("div",{className:"metric-values",children:[R.jsx("span",{className:"metric-act",children:Tl(r,o)}),t!==void 0&&R.jsxs("span",{className:"metric-cmd",children:["⌖ ",Tl(t,o)]})]})]})}function tS(){const l=We(r=>r.motors),t=We(r=>r.motorTypes);return R.jsxs("div",{className:"panel cards-panel",children:[l.length===0&&R.jsx("div",{className:"muted center pad",children:"Waiting for traffic…"}),R.jsx("div",{className:"cards-grid",children:l.map(r=>R.jsxs("div",{className:"motor-card",children:[R.jsxs("div",{className:"motor-card-head",children:[R.jsxs("span",{className:"mono strong",children:["Motor ",r.motorId]}),R.jsx("span",{className:"status-pill "+(r.status==="ENABLED"?"ok":r.status==="DISABLED"?"off":"warn"),children:r.status||"—"})]}),R.jsxs("div",{className:"motor-card-sub",children:[R.jsx("span",{className:"muted",children:r.mode||"—"}),t.length>0&&R.jsxs("select",{className:"type-select",defaultValue:"",onChange:i=>i.target.value&&G1(r.motorId,i.target.value),title:"Override motor type used to scale this motor's values",children:[R.jsx("option",{value:"",children:"set type…"}),t.map(i=>R.jsx("option",{value:i,children:i},i))]})]}),R.jsx(_f,{label:"Position",unit:"rad",cmd:r.cmd.pos,act:r.fb.pos,digits:3}),R.jsx(_f,{label:"Velocity",unit:"rad/s",cmd:r.cmd.vel,act:r.fb.vel,digits:2}),R.jsx(_f,{label:"Torque",unit:"Nm",cmd:r.cmd.torque,act:r.fb.torque,digits:2}),R.jsxs("div",{className:"temp-row",children:[R.jsxs("span",{children:["MOS ",Tl(r.fb.t_mos,1),"°"]}),R.jsxs("span",{children:["Rotor ",Tl(r.fb.t_rotor,1),"°"]})]})]},`${r.bus}:${r.motorId}`))})]})}function nS(l,t,r){const i=new Array(l);return new Proxy(i,{get(o,u,c){if(typeof u=="string"){const d=u.charCodeAt(0);if(d>=48&&d<=57){const p=+u;if(Number.isInteger(p)&&p>=0&&pi[y]!==g))&&(i=d,o=t(...d),r!=null&&r.onChange&&!(u&&r.skipInitialOnChange)&&r.onChange(o),u=!1),o}return c.updateDeps=d=>{i=d},c}function Em(l,t){if(l===void 0)throw new Error("Unexpected undefined");return l}const rS=(l,t)=>Math.abs(l-t)<1.01,iS=(l,t,r)=>{let i;return function(...o){l.clearTimeout(i),i=l.setTimeout(()=>t.apply(this,o),r)}};let wo;const Ef=()=>{if(wo!==void 0)return wo;if(typeof navigator>"u")return wo=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return wo=!0;const l=navigator.maxTouchPoints;return wo=navigator.platform==="MacIntel"&&l!==void 0&&l>0},Cm=l=>{const{offsetWidth:t,offsetHeight:r}=l;return{width:t,height:r}},sS=l=>l,lS=l=>{const t=Math.max(l.startIndex-l.overscan,0),i=Math.min(l.endIndex+l.overscan,l.count-1)-t+1,o=new Array(i);for(let u=0;u{const r=l.scrollElement;if(!r)return;const i=l.targetWindow;if(!i)return;const o=c=>{const{width:d,height:p}=c;t({width:Math.round(d),height:Math.round(p)})};if(o(Cm(r)),!i.ResizeObserver)return()=>{};const u=new i.ResizeObserver(c=>{const d=()=>{const p=c[0];if(p!=null&&p.borderBoxSize){const g=p.borderBoxSize[0];if(g){o({width:g.inlineSize,height:g.blockSize});return}}o(Cm(r))};l.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(d):d()});return u.observe(r,{box:"border-box"}),()=>{u.unobserve(r)}},mu={passive:!0},aS=typeof window>"u"?!0:"onscrollend"in window,uS=(l,t,r)=>{const i=l.scrollElement;if(!i)return;const o=l.targetWindow;if(!o)return;const u=l.options.useScrollendEvent&&aS;let c=0;const d=u?null:iS(o,()=>t(c,!1),l.options.isScrollingResetDelay),p=v=>()=>{c=r(i),d==null||d(),t(c,v)},g=p(!0),y=p(!1);return i.addEventListener("scroll",g,mu),u&&i.addEventListener("scrollend",y,mu),()=>{i.removeEventListener("scroll",g),u&&i.removeEventListener("scrollend",y)}},cS=(l,t)=>uS(l,t,r=>{const{horizontal:i,isRtl:o}=l.options;return i?r.scrollLeft*(o&&-1||1):r.scrollTop}),fS=(l,t,r)=>{if(r.options.useCachedMeasurements){const i=r.indexFromElement(l),o=r.options.getItemKey(i);return r.itemSizeCache.get(o)??r.options.estimateSize(i)}if(t!=null&&t.borderBoxSize){const i=t.borderBoxSize[0];if(i)return Math.round(i[r.options.horizontal?"inlineSize":"blockSize"])}if(!t){const i=r.indexFromElement(l),o=r.options.getItemKey(i),u=r.itemSizeCache.get(o);if(u!==void 0)return u}return l[r.options.horizontal?"offsetWidth":"offsetHeight"]},dS=(l,{adjustments:t=0,behavior:r},i)=>{var o,u;(u=(o=i.scrollElement)==null?void 0:o.scrollTo)==null||u.call(o,{[i.options.horizontal?"left":"top"]:l+t,behavior:r})},hS=dS;class pS{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var r,i,o;return((o=(i=(r=this.targetWindow)==null?void 0:r.performance)==null?void 0:i.now)==null?void 0:o.call(i))??Date.now()},this.observer=(()=>{let r=null;const i=()=>r||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:r=new this.targetWindow.ResizeObserver(o=>{o.forEach(u=>{const c=()=>{const d=u.target,p=this.indexFromElement(d);if(!d.isConnected){this.observer.unobserve(d);for(const[g,y]of this.elementsCache)if(y===d){this.elementsCache.delete(g);break}return}this.shouldMeasureDuringScroll(p)&&this.resizeItem(p,this.options.measureElement(d,u,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(c):c()})}));return{disconnect:()=>{var o;(o=i())==null||o.disconnect(),r=null},observe:o=>{var u;return(u=i())==null?void 0:u.observe(o,{box:"border-box"})},unobserve:o=>{var u;return(u=i())==null?void 0:u.unobserve(o)}}})(),this.range=null,this.setOptions=r=>{var i,o;const u={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:sS,rangeExtractor:lS,onChange:()=>{},measureElement:fS,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const x in r){const T=r[x];T!==void 0&&(u[x]=T)}const c=this.options;let d=null,p=null,g=!1;if(c!==void 0&&c.enabled&&u.enabled&&u.anchorTo==="end"&&this.scrollElement!==null){const x=c.count,T=u.count,N=this.getMeasurements(),C=x>0?((i=N[0])==null?void 0:i.key)??c.getItemKey(0):null,L=x>0?((o=N[x-1])==null?void 0:o.key)??c.getItemKey(x-1):null;if(T!==x||x>0&&T>0&&(u.getItemKey(0)!==C||u.getItemKey(T-1)!==L)){g=!0;const V=x>0?this.getVirtualItemForOffset(this.getScrollOffset())??N[0]:null;V&&(d=[V.key,this.getScrollOffset()-V.start]);const z=u.followOnAppend===!0?"auto":u.followOnAppend||null;z&&T>x&&this.isAtEnd(c.scrollEndThreshold)&&(x===0||u.getItemKey(T-1)!==L)&&(p=z)}}this.options=u,g&&(this.pendingMin=0,this.itemSizeCacheVersion++);let y=!1,v=0;if(d&&this.scrollOffset!==null){const[x,T]=d,N=this.getMeasurements(),{count:C,getItemKey:L}=this.options;let U=0;for(;U{var i,o;(o=(i=this.options).onChange)==null||o.call(i,this,r)},this.maybeNotify=wl(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),r=>{this.notify(r)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(r=>r()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var r;const i=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==i){if(this.cleanup(),!i){this.maybeNotify();return}if(this.scrollElement=i,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((r=this.scrollElement)==null?void 0:r.window)??null,this.elementsCache.forEach(u=>{this.observer.observe(u)}),this.unsubs.push(this.options.observeElementRect(this,u=>{this.scrollRect=u,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(u,c)=>{this._intendedScrollOffset!==null&&Math.abs(u-this._intendedScrollOffset)<1.5&&(u=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=c?this.getScrollOffset(){this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},d=()=>{this._iosTouching=!1,!(!Ef()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};u.addEventListener("touchstart",c,mu),u.addEventListener("touchend",d,mu),this.unsubs.push(()=>{u.removeEventListener("touchstart",c),u.removeEventListener("touchend",d),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const o=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,o&&this.scrollElement&&this.options.enabled){const[u,c,d,p]=o;u!==null&&!d&&(Ef()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?p!==0&&(this._iosDeferredAdjustment+=p):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),d&&this.scrollToEnd({behavior:d})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const r=this.getScrollOffset(),i=this.getMaxScrollOffset();if(r<0||r>i)return;const o=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(r,{adjustments:this.scrollAdjustments+=o,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(r,i)=>{const o=new Map,u=new Map;for(let c=i-1;c>=0;c--){const d=r[c];if(o.has(d.lane))continue;const p=u.get(d.lane);if(p==null||d.end>p.end?u.set(d.lane,d):d.endc.end===d.end?c.index-d.index:c.end-d.end)[0]:void 0},this.getMeasurementOptions=wl(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(r,i,o,u,c,d,p)=>(this.prevLanes!==void 0&&this.prevLanes!==d&&(this.lanesChangedFlag=!0),this.prevLanes=d,this.pendingMin=null,{count:r,paddingStart:i,scrollMargin:o,getItemKey:u,enabled:c,lanes:d,laneAssignmentMode:p}),{key:!1}),this.getMeasurements=wl(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:r,paddingStart:i,scrollMargin:o,getItemKey:u,enabled:c,lanes:d,laneAssignmentMode:p},g)=>{const y=this.itemSizeCache;if(!c)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>r)for(const N of this.laneAssignments.keys())N>=r&&this.laneAssignments.delete(N);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(N=>{this.itemSizeCache.set(N.key,N.size)}));const v=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===r&&(this.lanesSettling=!1),d===1){const N=this.options.gap,C=r*2;let L=this._flatMeasurements;if(!L||L.length0&&V.set(L.subarray(0,v*2)),L=V,this._flatMeasurements=L}let U;if(v===0)U=i+o;else{const V=v-1;U=L[V*2]+L[V*2+1]+N}for(let V=v;V1){U=L;const Y=T[U],Z=Y!==void 0?x[Y]:void 0;A=Z?Z.end+this.options.gap:i+o}else{const Y=this.options.lanes===1?x[N-1]:this.getFurthestMeasurement(x,N);A=Y?Y.end+this.options.gap:i+o,U=Y?Y.lane:N%this.options.lanes,this.options.lanes>1&&V&&this.laneAssignments.set(N,U)}const z=y.get(C),$=typeof z=="number"?z:this.options.estimateSize(N),G=A+$;x[N]={index:N,start:A,size:$,end:G,key:C,lane:U},T[U]=N}return this.measurementsCache=x,x},{key:!1,debug:()=>this.options.debug}),this.calculateRange=wl(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(r,i,o,u)=>this.range=r.length>0&&i>0?mS({measurements:r,outerSize:i,scrollOffset:o,lanes:u,flat:u===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=wl(()=>{let r=null,i=null;const o=this.calculateRange();return o&&(r=o.startIndex,i=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,r,i]),[this.options.rangeExtractor,this.options.overscan,this.options.count,r,i]},(r,i,o,u,c)=>u===null||c===null?[]:r({startIndex:u,endIndex:c,overscan:i,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=r=>{const i=this.options.indexAttribute,o=r.getAttribute(i);return o?parseInt(o,10):(console.warn(`Missing attribute name '${i}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=r=>{var i;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const o=this.scrollState.index??((i=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:i.index);if(o!==void 0&&this.range){const u=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),c=Math.max(0,o-u),d=Math.min(this.options.count-1,o+u);return r>=c&&r<=d}return!0},this.measureElement=r=>{if(!r){this.elementsCache.forEach((c,d)=>{c.isConnected||(this.observer.unobserve(c),this.elementsCache.delete(d))});return}const i=this.indexFromElement(r),o=this.options.getItemKey(i),u=this.elementsCache.get(o);u!==r&&(u&&this.observer.unobserve(u),this.observer.observe(r),this.elementsCache.set(o,r)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(i)&&this.resizeItem(i,this.options.measureElement(r,void 0,this))},this.resizeItem=(r,i)=>{var o,u;if(r<0||r>=this.options.count)return;let c,d,p;const g=this._flatMeasurements;if(this.options.lanes===1&&g!==null)p=this.options.getItemKey(r),d=g[r*2],c=g[r*2+1];else{const x=this.measurementsCache[r];if(!x)return;p=x.key,d=x.start,c=x.size}const y=this.itemSizeCache.get(p)??c,v=i-y;if(v!==0){const x=this.options.anchorTo==="end"&&((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,T=x?this.getTotalSize():0,N=((u=this.scrollState)==null?void 0:u.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[r]??{index:r,key:p,start:d,size:c,end:d+c,lane:0},v,this):d[this.getVirtualIndexes(),this.getMeasurements()],(r,i)=>{const o=[];for(let u=0,c=r.length;uthis.options.debug}),this.getVirtualItemForOffset=r=>{const i=this.getMeasurements();if(i.length===0)return;const o=this._flatMeasurements,u=this.options.lanes===1&&o!=null,c=Vg(0,i.length-1,u?d=>o[d*2]:d=>Em(i[d]).start,r);return Em(i[c])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const r=this.scrollElement.document.documentElement;return this.options.horizontal?r.scrollWidth-this.scrollElement.innerWidth:r.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(r=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=r,this.getOffsetForAlignment=(r,i,o=0)=>{if(!this.scrollElement)return 0;const u=this.getSize(),c=this.getScrollOffset();i==="auto"&&(i=r>=c+u?"end":"start"),i==="center"?r+=(o-u)/2:i==="end"&&(r-=u);const d=this.getMaxScrollOffset();return Math.max(Math.min(d,r),0)},this.getOffsetForIndex=(r,i="auto")=>{r=Math.max(0,Math.min(r,this.options.count-1));const o=this.getSize(),u=this.getScrollOffset(),c=this.measurementsCache[r];if(!c)return;if(i==="auto")if(c.end>=u+o-this.options.scrollPaddingEnd)i="end";else if(c.start<=u+this.options.scrollPaddingStart)i="start";else return[u,i];if(i==="end"&&r===this.options.count-1)return[this.getMaxScrollOffset(),i];const d=i==="end"?c.end+this.options.scrollPaddingEnd:c.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(d,i,c.size),i]},this.scrollToOffset=(r,{align:i="start",behavior:o="auto"}={})=>{const u=this.getOffsetForAlignment(r,i),c=this.now();this.scrollState={index:null,align:i,behavior:o,startedAt:c,lastTargetOffset:u,stableFrames:0},this._scrollToOffset(u,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(r,{align:i="auto",behavior:o="auto"}={})=>{r=Math.max(0,Math.min(r,this.options.count-1));const u=this.getOffsetForIndex(r,i);if(!u)return;const[c,d]=u,p=this.now();this.scrollState={index:r,align:d,behavior:o,startedAt:p,lastTargetOffset:c,stableFrames:0},this._scrollToOffset(c,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(r,{behavior:i="auto"}={})=>{const o=this.getScrollOffset()+r,u=this.now();this.scrollState={index:null,align:"start",behavior:i,startedAt:u,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:r="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:r});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:r})},this.getTotalSize=()=>{var r;const i=this.getMeasurements();let o;if(i.length===0)o=this.options.paddingStart;else if(this.options.lanes===1){const u=i.length-1,c=this._flatMeasurements;c!=null?o=c[u*2]+c[u*2+1]:o=((r=i[u])==null?void 0:r.end)??0}else{const u=Array(this.options.lanes).fill(null);let c=i.length-1;for(;c>=0&&u.some(d=>d===null);){const d=i[c];u[d.lane]===null&&(u[d.lane]=d.end),c--}o=Math.max(...u.filter(d=>d!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const r=[];if(this.itemSizeCache.size===0)return r;const i=this.getMeasurements();for(const o of i)o&&this.itemSizeCache.has(o.key)&&r.push({index:o.index,key:o.key,start:o.start,size:o.size,end:o.end,lane:o.lane});return r},this._scrollToOffset=(r,{adjustments:i,behavior:o})=>{this._intendedScrollOffset=r+(i??0),this.options.scrollToFn(r,{behavior:o,adjustments:i},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}applyScrollAdjustment(t,r){t!==0&&(Ef()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=t:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:r}))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const i=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,o=i?i[0]:this.scrollState.lastTargetOffset,u=1,c=o!==this.scrollState.lastTargetOffset;if(!c&&rS(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=u){this.getScrollOffset()!==o&&this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,c){const d=this.getSize()||600,p=Math.abs(o-this.getScrollOffset()),g=this.scrollState.behavior==="smooth"&&p>d;this.scrollState.lastTargetOffset=o,g||(this.scrollState.behavior="auto"),this._scrollToOffset(o,{adjustments:void 0,behavior:g?"smooth":"auto"})}this.scheduleScrollReconcile()}}const Vg=(l,t,r,i)=>{for(;l<=t;){const o=(l+t)/2|0,u=r(o);if(ui)t=o-1;else return o}return l>0?l-1:0};function mS({measurements:l,outerSize:t,scrollOffset:r,lanes:i,flat:o}){const u=l.length-1,c=o?y=>o[y*2]:y=>l[y].start,d=o?y=>o[y*2]+o[y*2+1]:y=>l[y].end;if(l.length<=i)return{startIndex:0,endIndex:u};let p=Vg(0,u,c,r),g=p;if(i===1)for(;g1){const y=Array(i).fill(0);for(;gx=0&&v.some(x=>x>=r);){const x=l[p];v[x.lane]=x.start,p--}p=Math.max(0,p-p%i),g=Math.min(u,g+(i-1-g%i))}return{startIndex:p,endIndex:g}}const Cf=typeof document<"u"?P.useLayoutEffect:P.useEffect;function gS({useFlushSync:l=!0,directDomUpdates:t=!1,directDomUpdatesMode:r="transform",...i}){const o=P.useReducer(g=>g+1,0)[1],u=P.useRef({enabled:t,mode:r,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});u.current.enabled=t,u.current.mode=r;const c=g=>{const y=u.current;if(!y.enabled||!y.container)return;const v=g.getTotalSize();if(v!==y.lastSize){y.lastSize=v;const U=g.options.horizontal?"width":"height";y.container.style[U]=`${v}px`}const x=!!g.options.horizontal,T=y.mode==="transform",N=x?"left":"top",C=g.options.scrollMargin,L=g.getVirtualItems();for(const U of L){const A=U.start-C,V=g.elementsCache.get(U.key);V&&y.lastPositions.get(V)!==A&&(y.lastPositions.set(V,A),T?V.style.transform=x?`translate3d(${A}px, 0, 0)`:`translate3d(0, ${A}px, 0)`:V.style[N]=`${A}px`)}},d={...i,onChange:(g,y)=>{var v;const x=u.current;let T=!0;if(x.enabled){c(g);const N=g.range,C=x.prevRange;T=!C||C.isScrolling!==g.isScrolling||C.startIndex!==(N==null?void 0:N.startIndex)||C.endIndex!==(N==null?void 0:N.endIndex),T&&(x.prevRange=N?{startIndex:N.startIndex,endIndex:N.endIndex,isScrolling:g.isScrolling}:null)}T&&(l&&y?Ps.flushSync(o):o()),(v=i.onChange)==null||v.call(i,g,y)}},[p]=P.useState(()=>{const g=new pS(d);return Object.assign(g,{containerRef:y=>{const v=u.current;if(v.container=y,v.lastSize=null,y&&v.enabled){const x=g.getTotalSize();v.lastSize=x;const T=g.options.horizontal?"width":"height";y.style[T]=`${x}px`}}})});return p.setOptions(d),Cf(()=>p._didMount(),[]),Cf(()=>p._willUpdate()),Cf(()=>{c(p)}),p}function vS(l){return gS({observeElementRect:oS,observeElementOffset:cS,scrollToFn:hS,...l})}const yS={pos:"p",vel:"v",torque:"τ",kp:"kp",kd:"kd",vel_limit:"vlim",torque_limit:"τlim",t_mos:"Tm",t_rotor:"Tr"},wS=["pos","vel","torque","kp","kd","t_mos","t_rotor"];function SS(l){const t=[];for(const r of wS)r in l.fields&&t.push(`${yS[r]||r} ${l.fields[r].toFixed(2)}`);return t.join(" ")||l.note||""}function xS(l){const t=new Date(l*1e3),r=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0"),o=String(t.getSeconds()).padStart(2,"0"),u=String(Math.floor(l%1*1e3)).padStart(3,"0");return`${r}:${i}:${o}.${u}`}function _S(){const[,l]=P.useState(0),[t,r]=P.useState(!1),i=P.useRef(null),o=P.useRef([]);P.useEffect(()=>{vm(!0);const d=H1(()=>{t||(o.current=F1(),l(p=>p+1))});return()=>{vm(!1),d()}},[t]);const u=o.current,c=vS({count:u.length,getScrollElement:()=>i.current,estimateSize:()=>22,overscan:12});return P.useEffect(()=>{!t&&u.length&&c.scrollToIndex(u.length-1)},[u.length,t,c]),R.jsxs("div",{className:"panel rawlog-panel",children:[R.jsxs("div",{className:"rawlog-toolbar",children:[R.jsx("button",{className:t?"btn small":"btn small active",onClick:()=>r(d=>!d),children:t?"Resume":"Pause"}),R.jsxs("span",{className:"muted",children:[u.length," frames"]})]}),R.jsxs("div",{className:"rawlog-body",ref:i,children:[R.jsxs("div",{className:"rawlog-head",children:[R.jsx("span",{className:"c-t",children:"time"}),R.jsx("span",{className:"c-arb",children:"arb"}),R.jsx("span",{className:"c-m",children:"motor"}),R.jsx("span",{className:"c-k",children:"kind"}),R.jsx("span",{className:"c-f",children:"decoded"}),R.jsx("span",{className:"c-r",children:"raw"})]}),R.jsx("div",{style:{height:c.getTotalSize(),position:"relative"},children:c.getVirtualItems().map(d=>{const p=u[d.index];return R.jsxs("div",{className:"rawlog-row k-"+p.kind,style:{transform:`translateY(${d.start}px)`},children:[R.jsx("span",{className:"c-t mono",children:xS(p.t)}),R.jsxs("span",{className:"c-arb mono",children:["0x",p.arb.toString(16).toUpperCase()]}),R.jsxs("span",{className:"c-m mono",children:["m",p.motorId]}),R.jsx("span",{className:"c-k",children:p.mode||p.kind}),R.jsx("span",{className:"c-f mono",children:SS(p)}),R.jsx("span",{className:"c-r mono dim",children:p.raw})]},p.seq)})})]})]})}async function is(l){return(await fetch(l)).json()}async function ui(l,t){return(await fetch(l,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t||{})})).json()}async function km(l,t){return(await fetch(l,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).json()}const Cn={status:()=>is("/api/status"),setMode:l=>ui("/api/mode",{mode:l}),connect:l=>ui("/api/connect",l),disconnect:()=>ui("/api/disconnect"),scan:l=>ui("/api/control/scan",{motor_type:l}),motors:()=>is("/api/control/motors"),enable:l=>ui(`/api/control/motors/${l}/enable`),disable:l=>ui(`/api/control/motors/${l}/disable`),setZero:l=>ui(`/api/control/motors/${l}/set-zero`),clearError:l=>ui(`/api/control/motors/${l}/clear-error`),storeParams:l=>ui(`/api/control/motors/${l}/store-parameters`),command:(l,t)=>ui(`/api/control/motors/${l}/command`,t),state:l=>is(`/api/control/motors/${l}/state`),getRegisters:l=>is(`/api/control/motors/${l}/registers`),setRegister:(l,t,r)=>km(`/api/control/motors/${l}/registers/${t}`,{value:r}),setMotorType:(l,t)=>km(`/api/control/motors/${l}/motor-type`,{motor_type:t}),registerTable:()=>is("/api/register-table"),motorTypes:()=>is("/api/motor-types"),canInterfaces:l=>is(`/api/can-interfaces?bustype=${l}`),platform:()=>is("/api/platform")};function ES(){const l=We(K=>K.mode),t=We(K=>K.status),r=We(K=>K.controlMotors),i=We(K=>K.currentMotorId),o=We(K=>K.setControlMotors),u=We(K=>K.setCurrentMotor),c=We(K=>K.motorTypes),[d,p]=P.useState("socketcan"),[g,y]=P.useState("can0"),[v,x]=P.useState(1e6),[T,N]=P.useState([]),[C,L]=P.useState("DM4310"),[U,A]=P.useState(!1),[V,z]=P.useState(null),$=!!(t!=null&&t.connected);P.useEffect(()=>{Cn.platform().then(K=>{K!=null&&K.success&&(p(K.default_bustype),y(K.default_channel))})},[]),P.useEffect(()=>{Cn.canInterfaces(d).then(K=>N((K==null?void 0:K.interfaces)||[]))},[d]);const G=async()=>{A(!0),z(null);const K={channel:g,bustype:d};d==="gs_usb"&&(K.bitrate=v),l==="control"&&(K.motor_type=C);const fe=await Cn.connect(K);if(A(!1),fe.success){const q=fe.motors||[];o(q),q.length&&u(q[0].id)}else z(fe.error||"Connect failed")},Y=async()=>{await Cn.disconnect(),o([]),u(null)},Z=async()=>{A(!0);const K=await Cn.scan(C);A(!1),K.success?(o(K.motors||[]),(K.motors||[]).length&&u(K.motors[0].id)):z(K.error||"Scan failed")};return R.jsxs("div",{className:"panel control-form",children:[R.jsxs("div",{className:"form-row",children:[R.jsx("label",{children:"Bus"}),R.jsxs("select",{value:d,onChange:K=>p(K.target.value),disabled:$,children:[R.jsx("option",{value:"socketcan",children:"socketcan"}),R.jsx("option",{value:"gs_usb",children:"gs_usb"})]})]}),R.jsxs("div",{className:"form-row",children:[R.jsx("label",{children:"Channel"}),R.jsx("input",{list:"ifaces",value:g,onChange:K=>y(K.target.value),disabled:$}),R.jsx("datalist",{id:"ifaces",children:T.map(K=>R.jsx("option",{value:K},K))})]}),d==="gs_usb"&&R.jsxs("div",{className:"form-row",children:[R.jsx("label",{children:"Bitrate"}),R.jsx("input",{type:"number",value:v,onChange:K=>x(Number(K.target.value)),disabled:$})]}),l==="control"&&R.jsxs("div",{className:"form-row",children:[R.jsx("label",{children:"Motor type"}),R.jsx("select",{value:C,onChange:K=>L(K.target.value),children:c.map(K=>R.jsx("option",{value:K,children:K},K))})]}),R.jsxs("div",{className:"form-actions",children:[$?R.jsx("button",{className:"btn",onClick:Y,children:"Disconnect"}):R.jsx("button",{className:"btn primary",onClick:G,disabled:U,children:U?"Connecting…":"Connect"}),l==="control"&&$&&R.jsx("button",{className:"btn",onClick:Z,disabled:U,children:"Rescan"})]}),l==="control"&&$&&R.jsxs("div",{className:"form-row",children:[R.jsx("label",{children:"Motor"}),R.jsxs("select",{value:i??"",onChange:K=>u(K.target.value?Number(K.target.value):null),children:[R.jsx("option",{value:"",children:"select…"}),r.map(K=>R.jsxs("option",{value:K.id,children:["Motor ",K.id," (0x",K.id.toString(16).toUpperCase(),")"]},K.id))]})]}),l==="monitor"&&R.jsx("div",{className:"muted small",style:{marginTop:6},children:"Monitor mode: listening only. Switch to Control to drive motors."}),V&&R.jsx("div",{className:"form-error",children:V})]})}function CS(){const l=We(ee=>ee.mode),t=We(ee=>ee.status),r=We(ee=>ee.currentMotorId),i=We(ee=>ee.motorTypes),o=!!(t!=null&&t.connected),u=l==="control"&&o&&r!=null,[c,d]=P.useState("MIT"),[p,g]=P.useState(0),[y,v]=P.useState(0),[x,T]=P.useState(0),[N,C]=P.useState(0),[L,U]=P.useState(0),[A,V]=P.useState(0),[z,$]=P.useState(0),[G,Y]=P.useState(!1),[Z,K]=P.useState(50),[fe,q]=P.useState(!1),[xe,ce]=P.useState(null),ge=P.useRef(null),ye=()=>({control_mode:c,target_position:p,target_velocity:y,stiffness:x,damping:N,feedforward_torque:L,velocity_limit:A,torque_limit_ratio:z}),ke=()=>{ge.current!=null&&(clearInterval(ge.current),ge.current=null),q(!1)};P.useEffect(()=>ke,[]),P.useEffect(()=>{ke()},[r,l]);const le=async()=>{if(r==null)return;const ee=await Cn.command(r,ye());ee.success||(ce(ee.error||"command failed"),ke())},oe=()=>{if(!G)le();else if(fe)ke();else{q(!0),ce(null),le();const ee=1e3/Math.max(1,Math.min(1e3,Z));ge.current=window.setInterval(le,ee)}},ae=async(ee,be)=>{const he=await ee();ce(he!=null&&he.success?`${be} ✓`:`${be} failed: ${(he==null?void 0:he.error)||""}`)};if(!u)return R.jsx("div",{className:"panel control-form",children:R.jsx("div",{className:"muted center pad",children:l!=="control"?"Monitor mode — switch to Control to drive motors.":o?"Select a motor in the Connection widget.":"Connect to a bus (Connection widget)."})});const J=c!=="VEL",M=c==="MIT",W=c==="FORCE_POS",X=c==="POS_VEL"||W?"Vel limit":"Velocity";return R.jsxs("div",{className:"panel control-form",children:[R.jsxs("div",{className:"form-row",children:[R.jsx("label",{children:"Mode"}),R.jsxs("select",{value:c,onChange:ee=>d(ee.target.value),children:[R.jsx("option",{children:"MIT"}),R.jsx("option",{children:"POS_VEL"}),R.jsx("option",{children:"VEL"}),R.jsx("option",{children:"FORCE_POS"})]})]}),J&&R.jsxs("div",{className:"form-row",children:[R.jsx("label",{children:"Position"}),R.jsx("input",{type:"number",step:"0.001",value:p,onChange:ee=>g(+ee.target.value)})]}),R.jsxs("div",{className:"form-row",children:[R.jsx("label",{children:X}),R.jsx("input",{type:"number",step:"0.01",value:c==="FORCE_POS"?A:y,onChange:ee=>c==="FORCE_POS"?V(+ee.target.value):v(+ee.target.value)})]}),M&&R.jsxs(R.Fragment,{children:[R.jsxs("div",{className:"form-row",children:[R.jsx("label",{children:"Stiffness Kp"}),R.jsx("input",{type:"number",step:"0.1",value:x,onChange:ee=>T(+ee.target.value)})]}),R.jsxs("div",{className:"form-row",children:[R.jsx("label",{children:"Damping Kd"}),R.jsx("input",{type:"number",step:"0.01",value:N,onChange:ee=>C(+ee.target.value)})]}),R.jsxs("div",{className:"form-row",children:[R.jsx("label",{children:"Torque"}),R.jsx("input",{type:"number",step:"0.01",value:L,onChange:ee=>U(+ee.target.value)})]})]}),W&&R.jsxs("div",{className:"form-row",children:[R.jsx("label",{children:"Torque limit"}),R.jsx("input",{type:"number",step:"0.01",min:"0",max:"1",value:z,onChange:ee=>$(+ee.target.value)})]}),R.jsxs("div",{className:"form-actions",children:[R.jsx("button",{className:"btn ok",onClick:()=>ae(()=>Cn.enable(r),"Enable"),children:"Enable"}),R.jsx("button",{className:"btn danger",onClick:()=>{ke(),ae(()=>Cn.disable(r),"Disable")},children:"Disable"})]}),R.jsxs("div",{className:"form-actions",children:[R.jsx("button",{className:"btn "+(fe?"danger":"primary"),onClick:oe,children:G?fe?"Stop":"Start":"Send"}),R.jsxs("label",{className:"toggle",children:[R.jsx("input",{type:"checkbox",checked:G,onChange:ee=>{Y(ee.target.checked),ke()}}),"continuous"]}),G&&R.jsx("input",{className:"freq",type:"number",min:"1",max:"1000",value:Z,onChange:ee=>K(+ee.target.value),title:"Hz"})]}),R.jsxs("div",{className:"form-actions wrap",children:[R.jsx("button",{className:"btn",onClick:()=>ae(()=>Cn.setZero(r),"Set zero"),children:"Set Zero"}),R.jsx("button",{className:"btn",onClick:()=>ae(()=>Cn.clearError(r),"Clear error"),children:"Clear Err"}),R.jsx("button",{className:"btn",onClick:()=>ae(()=>Cn.storeParams(r),"Store"),children:"Store"})]}),R.jsxs("div",{className:"form-row",children:[R.jsx("label",{children:"Type"}),R.jsxs("select",{defaultValue:"",onChange:ee=>ee.target.value&&ae(()=>Cn.setMotorType(r,ee.target.value),"Type"),children:[R.jsx("option",{value:"",children:"set…"}),i.map(ee=>R.jsx("option",{value:ee,children:ee},ee))]})]}),xe&&R.jsx("div",{className:"form-msg",children:xe})]})}const Rm={1:"MIT",2:"POS_VEL",3:"VEL",4:"FORCE_POS"},Nm={0:"125K",1:"200K",2:"250K",3:"500K",4:"1M"};function kS(){const l=We(z=>z.mode),t=We(z=>z.status),r=We(z=>z.currentMotorId),i=We(z=>z.registerTable),o=We(z=>z.setCurrentMotor),u=!!(t!=null&&t.connected),c=l==="control"&&u&&r!=null,[d,p]=P.useState({}),[g,y]=P.useState({}),[v,x]=P.useState(null),[T,N]=P.useState(!1),C=async()=>{if(r==null)return;N(!0);const z=await Cn.getRegisters(r);N(!1),z.success?(p(z.registers||{}),y({})):x(z.error||"read failed")};if(P.useEffect(()=>{c?C():p({})},[r,c]),!c)return R.jsx("div",{className:"panel control-form",children:R.jsx("div",{className:"muted center pad",children:l!=="control"?"Monitor mode — registers unavailable.":"Connect + select a motor."})});const L=(z,$,G)=>{if(z===7||z===8){const Y=$.trim();return Y.toLowerCase().startsWith("0x")?parseInt(Y,16):parseInt(Y,16)||parseInt(Y,10)}return G==="float"?parseFloat($):parseInt($,10)},U=async z=>{var K;const $=i[z],G=($==null?void 0:$.data_type)||"float";let Y;if(z===10||z===35?Y=parseInt(g[z],10):z===9?Y=parseFloat(g[z]):Y=L(z,g[z]??"",G),Number.isNaN(Y)){x("invalid value");return}const Z=await Cn.setRegister(r,z,Y);Z.success?(((K=Z.updated_ids)==null?void 0:K.motor_id)!=null&&o(Z.updated_ids.motor_id),x(`reg ${z} written ✓`),setTimeout(C,100)):x(Z.error||"write failed")},A=(z,$)=>{if(z===9)return`${$} ms`;if(z===7||z===8)return`0x${Number($).toString(16).toUpperCase()} (${$})`;if(z===10)return Rm[Number($)]||String($);if(z===35)return Nm[Number($)]||String($);const G=i[z];return(G==null?void 0:G.data_type)==="float"?Number($).toFixed(4):String($)},V=Object.keys(d).map(Number).sort((z,$)=>z-$);return R.jsxs("div",{className:"panel registers-panel",children:[R.jsxs("div",{className:"rawlog-toolbar",children:[R.jsx("button",{className:"btn small",onClick:C,children:T?"…":"Refresh"}),v&&R.jsx("span",{className:"muted small",children:v})]}),R.jsx("div",{className:"registers-body",children:R.jsxs("table",{className:"motor-table reg-table",children:[R.jsx("thead",{children:R.jsxs("tr",{children:[R.jsx("th",{children:"Register"}),R.jsx("th",{children:"Value"}),R.jsx("th",{})]})}),R.jsx("tbody",{children:V.map(z=>{const $=i[z],G=($==null?void 0:$.access)==="RO";return R.jsxs("tr",{children:[R.jsx("td",{title:$==null?void 0:$.variable,children:($==null?void 0:$.description)||`reg ${z}`}),R.jsx("td",{className:"mono",children:G?A(z,d[z]):z===10||z===35?R.jsx("select",{value:g[z]??String(d[z]),onChange:Y=>y({...g,[z]:Y.target.value}),children:Object.entries(z===10?Rm:Nm).map(([Y,Z])=>R.jsxs("option",{value:Y,children:[Z," (",Y,")"]},Y))}):R.jsx("input",{value:g[z]??(z===7||z===8?`0x${Number(d[z]).toString(16).toUpperCase()}`:String(d[z])),onChange:Y=>y({...g,[z]:Y.target.value})})}),R.jsx("td",{children:!G&&R.jsx("button",{className:"btn small",onClick:()=>U(z),children:"Write"})})]},z)})})]})})]})}const $g=[{kind:"connection",title:"Connection",icon:"⇄",description:"Connect to a CAN bus, scan, and select a motor.",render:()=>R.jsx(ES,{})},{kind:"control",title:"Motor Control",icon:"◉",description:"Drive the selected motor (MIT/POS_VEL/VEL/FORCE_POS), enable, zero, store.",render:()=>R.jsx(CS,{})},{kind:"registers",title:"Registers",icon:"≡",description:"Read/write the selected motor's registers.",render:()=>R.jsx(kS,{})},{kind:"plot",title:"Plot",icon:"〜",description:"Time-series chart; drag signals onto it (cmd over fb to overlay).",render:l=>R.jsx(Z1,{panelId:l})},{kind:"table",title:"Motor Table",icon:"▦",description:"One row per motor: commanded vs actual.",render:()=>R.jsx(eS,{})},{kind:"cards",title:"Motor Cards",icon:"▢",description:"Per-motor cards/gauges with big readouts.",render:()=>R.jsx(tS,{})},{kind:"rawlog",title:"Raw CAN Log",icon:"≣",description:"Scrolling decoded frame log.",render:()=>R.jsx(_S,{})}],RS=Object.fromEntries($g.map(l=>[l.kind,l])),Gg="damiao.monitor.theme";function Kg(){return localStorage.getItem(Gg)==="dark"?"dark":"light"}function Yg(l){document.documentElement.setAttribute("data-theme",l)}function NS(l){try{localStorage.setItem(Gg,l)}catch{}Yg(l)}function bS(){Yg(Kg())}function TS(){var T,N;const l=We(C=>C.connected),t=We(C=>C.status),r=We(C=>C.mode),i=We(C=>C.setMode),o=We(C=>C.setControlMotors),u=We(C=>C.setCurrentMotor),c=Ro(C=>C.addWidget),d=Ro(C=>C.resetWidgets),[p,g]=P.useState(Kg()),y=()=>{const C=p==="light"?"dark":"light";NS(C),g(C)},v=async C=>{C!==r&&(i(C),o([]),u(null),await Cn.setMode(C))},x=t!=null&&t.demo?"demo":(t==null?void 0:t.channel)||"—";return R.jsxs("header",{className:"toolbar",children:[R.jsxs("div",{className:"brand",children:[R.jsx("span",{className:"brand-dot"}),"DaMiao ",R.jsx("span",{className:"brand-sub",children:"Studio"})]}),R.jsxs("div",{className:"mode-switch",role:"tablist",children:[R.jsx("button",{className:"mode-tab "+(r==="control"?"active":""),onClick:()=>v("control"),children:"◉ Control"}),R.jsx("button",{className:"mode-tab "+(r==="monitor"?"active":""),onClick:()=>v("monitor"),children:"◎ Monitor"})]}),R.jsxs("div",{className:"conn",children:[R.jsx("span",{className:"dot "+(l?"on":"off")}),R.jsx("span",{className:"mono",children:x}),r==="control"?R.jsx("span",{className:"badge warn",title:"active mode — transmits",children:"active · TX"}):R.jsx("span",{className:"badge "+(t!=null&&t.listenOnly,"ok"),title:"passive — never transmits",children:"listen-only"}),(t==null?void 0:t.error)&&R.jsx("span",{className:"badge err",title:t.error,children:"error"}),t&&R.jsxs("span",{className:"muted small",children:[((N=(T=t.framesSeen)==null?void 0:T.toLocaleString)==null?void 0:N.call(T))??0," frames"]})]}),R.jsx("div",{className:"spacer"}),R.jsxs("div",{className:"actions",children:[$g.map(C=>R.jsxs("button",{className:"btn",title:C.description,onClick:()=>c(C.kind),children:[R.jsx("span",{className:"btn-icon",children:C.icon})," ",C.title]},C.kind)),R.jsx("button",{className:"btn ghost",onClick:y,title:`Switch to ${p==="light"?"dark":"light"} mode`,children:p==="light"?"☾":"☀"}),R.jsx("button",{className:"btn ghost",onClick:d,children:"Reset"})]})]})}function MS({sig:l}){const{attributes:t,listeners:r,setNodeRef:i,isDragging:o}=d0({id:`sig:${l.id}`,data:{signalId:l.id}}),u=Y1(l);return R.jsxs("div",{ref:i,className:"sig-chip"+(o?" dragging":""),...r,...t,title:l.id,children:[R.jsx("span",{className:"sig-swatch",style:{background:u,borderStyle:l.source==="cmd"?"dashed":"solid"}}),R.jsxs("span",{className:"sig-name",children:[l.source,".",l.field]}),l.unit&&R.jsx("span",{className:"sig-unit",children:l.unit})]})}function DS(l){return[...l].sort((t,r)=>{if(t.source!==r.source)return t.source==="cmd"?-1:1;const i=xm.indexOf(t.field),o=xm.indexOf(r.field);return(i<0?99:i)-(o<0?99:o)})}function zS(){const l=We(u=>u.signals),t=We(u=>u.status),[r,i]=P.useState(""),o=P.useMemo(()=>{const u=new Map;for(const c of l){if(r&&!c.id.toLowerCase().includes(r.toLowerCase()))continue;const d=u.get(c.motorId)||[];d.push(c),u.set(c.motorId,d)}return Array.from(u.entries()).sort((c,d)=>c[0]-d[0])},[l,r]);return R.jsxs("aside",{className:"sidebar",children:[R.jsxs("div",{className:"sidebar-head",children:[R.jsx("div",{className:"sidebar-title",children:"Signals"}),R.jsx("input",{className:"filter",placeholder:"filter…",value:r,onChange:u=>i(u.target.value)})]}),R.jsxs("div",{className:"sidebar-body",children:[o.length===0&&R.jsx("div",{className:"muted pad",children:t!=null&&t.error?"Bus error — see top bar.":"No signals yet. Start a controller on the bus (or run --demo)."}),o.map(([u,c])=>R.jsxs("div",{className:"motor-group",children:[R.jsxs("div",{className:"motor-group-title",children:["Motor ",u]}),R.jsx("div",{className:"chips",children:DS(c).map(d=>R.jsx(MS,{sig:d},d.id))})]},u))]}),R.jsxs("div",{className:"sidebar-foot muted",children:["Drag a signal onto a plot. Drop ",R.jsx("b",{children:"cmd"})," onto its ",R.jsx("b",{children:"fb"})," plot to overlay."]})]})}function OS(l,t,r,i,o){const u=(...c)=>(console.warn("gridstack.js: Function `"+r+"` is deprecated in "+o+" and has been replaced with `"+i+"`. It will be **removed** in a future release"),t.apply(l,c));return u.prototype=t.prototype,u}class F{static getElements(t,r=document){if(typeof t=="string"){const i="getElementById"in r?r:void 0;if(i&&!isNaN(+t[0])){const u=i.getElementById(t);return u?[u]:[]}let o=r.querySelectorAll(t);return!o.length&&t[0]!=="."&&t[0]!=="#"&&(o=r.querySelectorAll("."+t),o.length||(o=r.querySelectorAll("#"+t))),Array.from(o)}return[t]}static getElement(t,r=document){if(typeof t=="string"){const i="getElementById"in r?r:void 0;if(!t.length)return null;if(i&&t[0]==="#")return i.getElementById(t.substring(1));if(t[0]==="#"||t[0]==="."||t[0]==="[")return r.querySelector(t);if(i&&!isNaN(+t[0]))return i.getElementById(t);let o=r.querySelector(t);return i&&!o&&(o=i.getElementById(t)),o||(o=r.querySelector("."+t)),o}return t}static lazyLoad(t){var r,i;return t.lazyLoad||((i=(r=t.grid)==null?void 0:r.opts)==null?void 0:i.lazyLoad)&&t.lazyLoad!==!1}static createDiv(t,r){const i=document.createElement("div");return t.forEach(o=>{o&&i.classList.add(o)}),r==null||r.appendChild(i),i}static shouldSizeToContent(t,r=!1){return(t==null?void 0:t.grid)&&(r?t.sizeToContent===!0||t.grid.opts.sizeToContent===!0&&t.sizeToContent===void 0:!!t.sizeToContent||t.grid.opts.sizeToContent&&t.sizeToContent!==!1)}static isIntercepted(t,r){return!(t.y>=r.y+r.h||t.y+t.h<=r.y||t.x+t.w<=r.x||t.x>=r.x+r.w)}static isTouching(t,r){return F.isIntercepted(t,{x:r.x-.5,y:r.y-.5,w:r.w+1,h:r.h+1})}static areaIntercept(t,r){const i=t.x>r.x?t.x:r.x,o=t.x+t.wr.y?t.y:r.y,c=t.y+t.h{const c=r*((o.y??1e4)-(u.y??1e4));return c===0?r*((o.x??1e4)-(u.x??1e4)):c})}static find(t,r){return r?t.find(i=>i.id===r):void 0}static createStylesheet(t,r,i){const o=document.createElement("style"),u=i==null?void 0:i.nonce;return u&&(o.nonce=u),o.setAttribute("type","text/css"),o.setAttribute("gs-style-id",t),o.styleSheet?o.styleSheet.cssText="":o.appendChild(document.createTextNode("")),r?r.insertBefore(o,r.firstChild):(r=document.getElementsByTagName("head")[0],r.appendChild(o)),o}static removeStylesheet(t,r){const o=(r||document).querySelector("STYLE[gs-style-id="+t+"]");o&&o.parentNode&&o.remove()}static addCSSRule(t,r,i){t.textContent+=`${r} { ${i} } `}static toBool(t){return typeof t=="boolean"?t:typeof t=="string"?(t=t.toLowerCase(),!(t===""||t==="no"||t==="false"||t==="0")):!!t}static toNumber(t){return t===null||t.length===0?void 0:Number(t)}static parseHeight(t){let r,i="px";if(typeof t=="string")if(t==="auto"||t==="")r=0;else{const o=t.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!o)throw new Error(`Invalid height val = ${t}`);i=o[2]||"px",r=parseFloat(o[1])}else r=t;return{h:r,unit:i}}static defaults(t,...r){return r.forEach(i=>{for(const o in i){if(!i.hasOwnProperty(o))return;t[o]===null||t[o]===void 0?t[o]=i[o]:typeof i[o]=="object"&&typeof t[o]=="object"&&this.defaults(t[o],i[o])}}),t}static same(t,r){if(typeof t!="object")return t==r;if(typeof t!=typeof r||Object.keys(t).length!==Object.keys(r).length)return!1;for(const i in t)if(t[i]!==r[i])return!1;return!0}static copyPos(t,r,i=!1){return r.x!==void 0&&(t.x=r.x),r.y!==void 0&&(t.y=r.y),r.w!==void 0&&(t.w=r.w),r.h!==void 0&&(t.h=r.h),i&&(r.minW&&(t.minW=r.minW),r.minH&&(t.minH=r.minH),r.maxW&&(t.maxW=r.maxW),r.maxH&&(t.maxH=r.maxH)),t}static samePos(t,r){return t&&r&&t.x===r.x&&t.y===r.y&&(t.w||1)===(r.w||1)&&(t.h||1)===(r.h||1)}static sanitizeMinMax(t){t.minW||delete t.minW,t.minH||delete t.minH,t.maxW||delete t.maxW,t.maxH||delete t.maxH}static removeInternalAndSame(t,r){if(!(typeof t!="object"||typeof r!="object"))for(let i in t){const o=t[i],u=r[i];i[0]==="_"||o===u?delete t[i]:o&&typeof o=="object"&&u!==void 0&&(F.removeInternalAndSame(o,u),Object.keys(o).length||delete t[i])}}static removeInternalForSave(t,r=!0){for(let i in t)(i[0]==="_"||t[i]===null||t[i]===void 0)&&delete t[i];delete t.grid,r&&delete t.el,t.autoPosition||delete t.autoPosition,t.noResize||delete t.noResize,t.noMove||delete t.noMove,t.locked||delete t.locked,(t.w===1||t.w===t.minW)&&delete t.w,(t.h===1||t.h===t.minH)&&delete t.h}static throttle(t,r){let i=!1;return(...o)=>{i||(i=!0,setTimeout(()=>{t(...o),i=!1},r))}}static removePositioningStyles(t){const r=t.style;r.position&&r.removeProperty("position"),r.left&&r.removeProperty("left"),r.top&&r.removeProperty("top"),r.width&&r.removeProperty("width"),r.height&&r.removeProperty("height")}static getScrollElement(t){if(!t)return document.scrollingElement||document.documentElement;const r=getComputedStyle(t);return/(auto|scroll)/.test(r.overflow+r.overflowY)?t:this.getScrollElement(t.parentElement)}static updateScrollPosition(t,r,i){const o=t.getBoundingClientRect(),u=window.innerHeight||document.documentElement.clientHeight;if(o.top<0||o.bottom>u){const c=o.bottom-u,d=o.top,p=this.getScrollElement(t);if(p!==null){const g=p.scrollTop;o.top<0&&i<0?t.offsetHeight>u?p.scrollTop+=i:p.scrollTop+=Math.abs(d)>Math.abs(i)?i:d:i>0&&(t.offsetHeight>u?p.scrollTop+=i:p.scrollTop+=c>i?i:c),r.top+=p.scrollTop-g}}}static updateScrollResize(t,r,i){const o=this.getScrollElement(r),u=o.clientHeight,c=o===this.getScrollElement()?0:o.getBoundingClientRect().top,d=t.clientY-c,p=du-i;p?o.scrollBy({behavior:"smooth",top:d-i}):g&&o.scrollBy({behavior:"smooth",top:i-(u-d)})}static clone(t){return t==null||typeof t!="object"?t:t instanceof Array?[...t]:{...t}}static cloneDeep(t){const r=["parentGrid","el","grid","subGrid","engine"],i=F.clone(t);for(const o in i)i.hasOwnProperty(o)&&typeof i[o]=="object"&&o.substring(0,2)!=="__"&&!r.find(u=>u===o)&&(i[o]=F.cloneDeep(t[o]));return i}static cloneNode(t){const r=t.cloneNode(!0);return r.removeAttribute("id"),r}static appendTo(t,r){let i;typeof r=="string"?i=F.getElement(r):i=r,i&&i.appendChild(t)}static addElStyles(t,r){if(r instanceof Object)for(const i in r)r.hasOwnProperty(i)&&(Array.isArray(r[i])?r[i].forEach(o=>{t.style[i]=o}):t.style[i]=r[i])}static initEvent(t,r){const i={type:r.type},o={button:0,which:0,buttons:1,bubbles:!0,cancelable:!0,target:r.target?r.target:t.target};return["altKey","ctrlKey","metaKey","shiftKey"].forEach(u=>i[u]=t[u]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(u=>i[u]=t[u]),{...i,...o}}static simulateMouseEvent(t,r,i){const o=t,u=new MouseEvent(r,{bubbles:!0,composed:!0,cancelable:!0,view:window,detail:1,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY,ctrlKey:o.ctrlKey??!1,altKey:o.altKey??!1,shiftKey:o.shiftKey??!1,metaKey:o.metaKey??!1,button:0,relatedTarget:t.target});(i||t.target).dispatchEvent(u)}static getValuesFromTransformedElement(t){const r=document.createElement("div");F.addElStyles(r,{opacity:"0",position:"fixed",top:"0px",left:"0px",width:"1px",height:"1px",zIndex:"-999999"}),t.appendChild(r);const i=r.getBoundingClientRect();return t.removeChild(r),r.remove(),{xScale:1/i.width,yScale:1/i.height,xOffset:i.left,yOffset:i.top}}static swap(t,r,i){if(!t)return;const o=t[r];t[r]=t[i],t[i]=o}static canBeRotated(t){var r;return!(!t||t.w===t.h||t.locked||t.noResize||(r=t.grid)!=null&&r.opts.disableResize||t.minW&&t.minW===t.maxW||t.minH&&t.minH===t.maxH)}}class ci{constructor(t={}){this.addedNodes=[],this.removedNodes=[],this.defaultColumn=12,this.column=t.column||this.defaultColumn,this.column>this.defaultColumn&&(this.defaultColumn=this.column),this.maxRow=t.maxRow,this._float=t.float,this.nodes=t.nodes||[],this.onChange=t.onChange}batchUpdate(t=!0,r=!0){return!!this.batchMode===t?this:(this.batchMode=t,t?(this._prevFloat=this._float,this._float=!0,this.cleanNodes(),this.saveInitial()):(this._float=this._prevFloat,delete this._prevFloat,r&&this._packNodes(),this._notify()),this)}_useEntireRowArea(t,r){return(!this.float||this.batchMode&&!this._prevFloat)&&!this._hasLocked&&(!t._moving||t._skipDown||r.y<=t.y)}_fixCollisions(t,r=t,i,o={}){if(this.sortNodes(-1),i=i||this.collide(t,r),!i)return!1;if(t._moving&&!o.nested&&!this.float&&this.swap(t,i))return!0;let u=r;!this._loading&&this._useEntireRowArea(t,r)&&(u={x:0,w:this.column,y:r.y,h:r.h},i=this.collide(t,u,o.skip));let c=!1;const d={nested:!0,pack:!1};let p=0;for(;i=i||this.collide(t,u,o.skip);){if(p++>this.nodes.length*2)throw new Error("Infinite collide check");let g;if(i.locked||this._loading||t._moving&&!t._skipDown&&r.y>t.y&&!this.float&&(!this.collide(i,{...i,y:t.y},t)||!this.collide(i,{...i,y:r.y-i.h},t))){t._skipDown=t._skipDown||r.y>t.y;const y={...r,y:i.y+i.h,...d};g=this._loading&&F.samePos(t,y)?!0:this.moveNode(t,y),(i.locked||this._loading)&&g?F.copyPos(r,t):!i.locked&&g&&o.pack&&(this._packNodes(),r.y=i.y+i.h,F.copyPos(t,r)),c=c||g}else g=this.moveNode(i,{...i,y:r.y+r.h,skip:t,...d});if(!g)return c;i=void 0}return c}collide(t,r=t,i){const o=t._id,u=i==null?void 0:i._id;return this.nodes.find(c=>c._id!==o&&c._id!==u&&F.isIntercepted(c,r))}collideAll(t,r=t,i){const o=t._id,u=i==null?void 0:i._id;return this.nodes.filter(c=>c._id!==o&&c._id!==u&&F.isIntercepted(c,r))}directionCollideCoverage(t,r,i){if(!r.rect||!t._rect)return;const o=t._rect,u={...r.rect};u.y>o.y?(u.h+=u.y-o.y,u.y=o.y):u.h+=o.y-u.y,u.x>o.x?(u.w+=u.x-o.x,u.x=o.x):u.w+=o.x-u.x;let c,d=.5;for(let p of i){if(p.locked||!p._rect)break;const g=p._rect;let y=Number.MAX_VALUE,v=Number.MAX_VALUE;o.yg.y+g.h&&(y=(g.y+g.h-u.y)/g.h),o.xg.x+g.w&&(v=(g.x+g.w-u.x)/g.w);const x=Math.min(v,y);x>d&&(d=x,c=p)}return r.collide=c,c}cacheRects(t,r,i,o,u,c){return this.nodes.forEach(d=>d._rect={y:d.y*r+i,x:d.x*t+c,w:d.w*t-c-o,h:d.h*r-i-u}),this}swap(t,r){if(!r||r.locked||!t||t.locked)return!1;function i(){const u=r.x,c=r.y;return r.x=t.x,r.y=t.y,t.h!=r.h?(t.x=u,t.y=r.y+r.h):t.w!=r.w?(t.x=r.x+r.w,t.y=c):(t.x=u,t.y=c),t._dirty=r._dirty=!0,!0}let o;if(t.w===r.w&&t.h===r.h&&(t.x===r.x||t.y===r.y)&&(o=F.isTouching(t,r)))return i();if(o!==!1){if(t.w===r.w&&t.x===r.x&&(o||(o=F.isTouching(t,r)))){if(r.y{let g;c.locked||(c.autoPosition=!0,t==="list"&&d&&(g=p[d-1])),this.addNode(c,!1,g)}),o||delete this._inColumnResize,i||this.batchUpdate(!1),this}set float(t){this._float!==t&&(this._float=t||!1,t||this._packNodes()._notify())}get float(){return this._float||!1}sortNodes(t=1){return this.nodes=F.sort(this.nodes,t),this}_packNodes(){return this.batchMode?this:(this.sortNodes(),this.float?this.nodes.forEach(t=>{if(t._updating||t._orig===void 0||t.y===t._orig.y)return;let r=t.y;for(;r>t._orig.y;)--r,this.collide(t,{x:t.x,y:r,w:t.w,h:t.h})||(t._dirty=!0,t.y=r)}):this.nodes.forEach((t,r)=>{if(!t.locked)for(;t.y>0;){const i=r===0?0:t.y-1;if(!(r===0||!this.collide(t,{x:t.x,y:i,w:t.w,h:t.h})))break;t._dirty=t.y!==i,t.y=i}}),this)}prepareNode(t,r){t._id=t._id??ci._idSeq++;const i=t.id;if(i){let u=1;for(;this.nodes.find(c=>c.id===t.id&&c!==t);)t.id=i+"_"+u++}(t.x===void 0||t.y===void 0||t.x===null||t.y===null)&&(t.autoPosition=!0);const o={x:0,y:0,w:1,h:1};return F.defaults(t,o),t.autoPosition||delete t.autoPosition,t.noResize||delete t.noResize,t.noMove||delete t.noMove,F.sanitizeMinMax(t),typeof t.x=="string"&&(t.x=Number(t.x)),typeof t.y=="string"&&(t.y=Number(t.y)),typeof t.w=="string"&&(t.w=Number(t.w)),typeof t.h=="string"&&(t.h=Number(t.h)),isNaN(t.x)&&(t.x=o.x,t.autoPosition=!0),isNaN(t.y)&&(t.y=o.y,t.autoPosition=!0),isNaN(t.w)&&(t.w=o.w),isNaN(t.h)&&(t.h=o.h),this.nodeBoundFix(t,r),t}nodeBoundFix(t,r){const i=t._orig||F.copyPos({},t);if(t.maxW&&(t.w=Math.min(t.w||1,t.maxW)),t.maxH&&(t.h=Math.min(t.h||1,t.maxH)),t.minW&&(t.w=Math.max(t.w||1,t.minW)),t.minH&&(t.h=Math.max(t.h||1,t.minH)),(t.x||0)+(t.w||1)>this.column&&this.columnthis.column?t.w=this.column:t.w<1&&(t.w=1),this.maxRow&&t.h>this.maxRow?t.h=this.maxRow:t.h<1&&(t.h=1),t.x<0&&(t.x=0),t.y<0&&(t.y=0),t.x+t.w>this.column&&(r?t.w=this.column-t.x:t.x=this.column-t.w),this.maxRow&&t.y+t.h>this.maxRow&&(r?t.h=this.maxRow-t.y:t.y=this.maxRow-t.h),F.samePos(t,i)||(t._dirty=!0),this}getDirtyNodes(t){return t?this.nodes.filter(r=>r._dirty&&!F.samePos(r,r._orig)):this.nodes.filter(r=>r._dirty)}_notify(t){if(this.batchMode||!this.onChange)return this;const r=(t||[]).concat(this.getDirtyNodes());return this.onChange(r),this}cleanNodes(){return this.batchMode?this:(this.nodes.forEach(t=>{delete t._dirty,delete t._lastTried}),this)}saveInitial(){return this.nodes.forEach(t=>{t._orig=F.copyPos({},t),delete t._dirty}),this._hasLocked=this.nodes.some(t=>t.locked),this}restoreInitial(){return this.nodes.forEach(t=>{!t._orig||F.samePos(t,t._orig)||(F.copyPos(t,t._orig),t._dirty=!0)}),this._notify(),this}findEmptyPosition(t,r=this.nodes,i=this.column,o){const u=o?o.y*i+(o.x+o.w):0;let c=!1;for(let d=u;!c;++d){const p=d%i,g=Math.floor(d/i);if(p+t.w>i)continue;const y={x:p,y:g,w:t.w,h:t.h};r.find(v=>F.isIntercepted(y,v))||((t.x!==p||t.y!==g)&&(t._dirty=!0),t.x=p,t.y=g,delete t.autoPosition,c=!0)}return c}addNode(t,r=!1,i){const o=this.nodes.find(c=>c._id===t._id);if(o)return o;this._inColumnResize?this.nodeBoundFix(t):this.prepareNode(t),delete t._temporaryRemoved,delete t._removeDOM;let u;return t.autoPosition&&this.findEmptyPosition(t,this.nodes,this.column,i)&&(delete t.autoPosition,u=!0),this.nodes.push(t),r&&this.addedNodes.push(t),u||this._fixCollisions(t),this.batchMode||this._packNodes()._notify(),t}removeNode(t,r=!0,i=!1){return this.nodes.find(o=>o._id===t._id)?(i&&this.removedNodes.push(t),r&&(t._removeDOM=!0),this.nodes=this.nodes.filter(o=>o._id!==t._id),t._isAboutToRemove||this._packNodes(),this._notify([t]),this):this}removeAll(t=!0,r=!0){if(delete this._layouts,!this.nodes.length)return this;t&&this.nodes.forEach(o=>o._removeDOM=!0);const i=this.nodes;return this.removedNodes=r?i:[],this.nodes=[],this._notify(i)}moveNodeCheck(t,r){if(!this.changedPosConstrain(t,r))return!1;if(r.pack=!0,!this.maxRow)return this.moveNode(t,r);let i;const o=new ci({column:this.column,float:this.float,nodes:this.nodes.map(c=>c._id===t._id?(i={...c},i):{...c})});if(!i)return!1;const u=o.moveNode(i,r)&&o.getRow()<=Math.max(this.getRow(),this.maxRow);if(!u&&!r.resizing&&r.collide){const c=r.collide.el.gridstackNode;if(this.swap(t,c))return this._notify(),!0}return u?(o.nodes.filter(c=>c._dirty).forEach(c=>{const d=this.nodes.find(p=>p._id===c._id);d&&(F.copyPos(d,c),d._dirty=!0)}),this._notify(),!0):!1}willItFit(t){if(delete t._willFitPos,!this.maxRow)return!0;const r=new ci({column:this.column,float:this.float,nodes:this.nodes.map(o=>({...o}))}),i={...t};return this.cleanupNode(i),delete i.el,delete i._id,delete i.content,delete i.grid,r.addNode(i),r.getRow()<=this.maxRow?(t._willFitPos=F.copyPos({},i),!0):!1}changedPosConstrain(t,r){return r.w=r.w||t.w,r.h=r.h||t.h,t.x!==r.x||t.y!==r.y?!0:(t.maxW&&(r.w=Math.min(r.w,t.maxW)),t.maxH&&(r.h=Math.min(r.h,t.maxH)),t.minW&&(r.w=Math.max(r.w,t.minW)),t.minH&&(r.h=Math.max(r.h,t.minH)),t.w!==r.w||t.h!==r.h)}moveNode(t,r){var g,y;if(!t||!r)return!1;let i;r.pack===void 0&&!this.batchMode&&(i=r.pack=!0),typeof r.x!="number"&&(r.x=t.x),typeof r.y!="number"&&(r.y=t.y),typeof r.w!="number"&&(r.w=t.w),typeof r.h!="number"&&(r.h=t.h);const o=t.w!==r.w||t.h!==r.h,u=F.copyPos({},t,!0);if(F.copyPos(u,r),this.nodeBoundFix(u,o),F.copyPos(r,u),!r.forceCollide&&F.samePos(t,r))return!1;const c=F.copyPos({},t),d=this.collideAll(t,u,r.skip);let p=!0;if(d.length){const v=t._moving&&!r.nested;let x=v?this.directionCollideCoverage(t,r,d):d[0];if(v&&x&&((y=(g=t.grid)==null?void 0:g.opts)!=null&&y.subGridDynamic)&&!t.grid._isTemp){const T=F.areaIntercept(r.rect,x._rect),N=F.area(r.rect),C=F.area(x._rect);T/(N.8&&(x.grid.makeSubGrid(x.el,void 0,t),x=void 0)}x?p=!this._fixCollisions(t,u,x,r):(p=!1,i&&delete r.pack)}return p&&!F.samePos(t,u)&&(t._dirty=!0,F.copyPos(t,u)),r.pack&&this._packNodes()._notify(),!F.samePos(t,c)}getRow(){return this.nodes.reduce((t,r)=>Math.max(t,r.y+r.h),0)}beginUpdate(t){return t._updating||(t._updating=!0,delete t._skipDown,this.batchMode||this.saveInitial()),this}endUpdate(){const t=this.nodes.find(r=>r._updating);return t&&(delete t._updating,delete t._skipDown),this}save(t=!0,r){var c;const i=(c=this._layouts)==null?void 0:c.length,o=i&&this.column!==i-1?this._layouts[i-1]:null,u=[];return this.sortNodes(),this.nodes.forEach(d=>{const p=o==null?void 0:o.find(y=>y._id===d._id),g={...d,...p||{}};F.removeInternalForSave(g,!t),r&&r(d,g),u.push(g)}),u}layoutsNodesChange(t){return!this._layouts||this._inColumnResize?this:(this._layouts.forEach((r,i)=>{if(!r||i===this.column)return this;if(i{if(!u._orig)return;const c=r.find(d=>d._id===u._id);c&&(c.y>=0&&u.y!==u._orig.y&&(c.y+=u.y-u._orig.y),u.x!==u._orig.x&&(c.x=Math.round(u.x*o)),u.w!==u._orig.w&&(c.w=Math.round(u.w*o)))})}}),this)}columnChanged(t,r,i="moveScale"){var d;if(!this.nodes.length||!r||t===r)return this;const o=i==="compact"||i==="list";o&&this.sortNodes(1),rt&&this._layouts){const p=this._layouts[r]||[],g=this._layouts.length-1;!p.length&&t!==g&&((d=this._layouts[g])!=null&&d.length)&&(t=g,this._layouts[g].forEach(y=>{const v=c.find(x=>x._id===y._id);v&&(!o&&!y.autoPosition&&(v.x=y.x??v.x,v.y=y.y??v.y),v.w=y.w??v.w,(y.x==null||y.y===void 0)&&(v.autoPosition=!0))})),p.forEach(y=>{const v=c.findIndex(x=>x._id===y._id);if(v!==-1){const x=c[v];if(o){x.w=y.w;return}(y.autoPosition||isNaN(y.x)||isNaN(y.y))&&this.findEmptyPosition(y,u),y.autoPosition||(x.x=y.x??x.x,x.y=y.y??x.y,x.w=y.w??x.w,u.push(x)),c.splice(v,1)}})}if(o)this.compact(i,!1);else{if(c.length)if(typeof i=="function")i(r,t,u,c);else{const p=o||i==="none"?1:r/t,g=i==="move"||i==="moveScale",y=i==="scale"||i==="moveScale";c.forEach(v=>{v.x=r===1?0:g?Math.round(v.x*p):Math.min(v.x,r-1),v.w=r===1||t===1?1:y?Math.round(v.w*p)||1:Math.min(v.w,r),u.push(v)}),c=[]}u=F.sort(u,-1),this._inColumnResize=!0,this.nodes=[],u.forEach(p=>{this.addNode(p,!1),delete p._orig})}return this.nodes.forEach(p=>delete p._orig),this.batchUpdate(!1,!o),delete this._inColumnResize,this}cacheLayout(t,r,i=!1){const o=[];return t.forEach((u,c)=>{if(u._id===void 0){const d=u.id?this.nodes.find(p=>p.id===u.id):void 0;u._id=(d==null?void 0:d._id)??ci._idSeq++}o[c]={x:u.x,y:u.y,w:u.w,_id:u._id}}),this._layouts=i?[]:this._layouts||[],this._layouts[r]=o,this}cacheOneLayout(t,r){t._id=t._id??ci._idSeq++;const i={x:t.x,y:t.y,w:t.w,_id:t._id};(t.autoPosition||t.x===void 0)&&(delete i.x,delete i.y,t.autoPosition&&(i.autoPosition=!0)),this._layouts=this._layouts||[],this._layouts[r]=this._layouts[r]||[];const o=this.findCacheLayout(t,r);return o===-1?this._layouts[r].push(i):this._layouts[r][o]=i,this}findCacheLayout(t,r){var i,o;return((o=(i=this._layouts)==null?void 0:i[r])==null?void 0:o.findIndex(u=>u._id===t._id))??-1}removeNodeFromLayoutCache(t){if(this._layouts)for(let r=0;r0||navigator.msMaxTouchPoints>0);class fi{}function gu(l,t){l.touches.length>1||(l.cancelable&&l.preventDefault(),F.simulateMouseEvent(l.changedTouches[0],t))}function Qg(l,t){l.cancelable&&l.preventDefault(),F.simulateMouseEvent(l,t)}function vu(l){fi.touchHandled||(fi.touchHandled=!0,gu(l,"mousedown"))}function yu(l){fi.touchHandled&&gu(l,"mousemove")}function wu(l){if(!fi.touchHandled)return;fi.pointerLeaveTimeout&&(window.clearTimeout(fi.pointerLeaveTimeout),delete fi.pointerLeaveTimeout);const t=!!Le.dragElement;gu(l,"mouseup"),t||gu(l,"click"),fi.touchHandled=!1}function Su(l){l.pointerType!=="mouse"&&l.target.releasePointerCapture(l.pointerId)}function bm(l){Le.dragElement&&l.pointerType!=="mouse"&&Qg(l,"mouseenter")}function Tm(l){Le.dragElement&&l.pointerType!=="mouse"&&(fi.pointerLeaveTimeout=window.setTimeout(()=>{delete fi.pointerLeaveTimeout,Qg(l,"mouseleave")},10))}class Lu{constructor(t,r,i){this.host=t,this.dir=r,this.option=i,this.moving=!1,this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this._init()}_init(){const t=this.el=document.createElement("div");return t.classList.add("ui-resizable-handle"),t.classList.add(`${Lu.prefix}${this.dir}`),t.style.zIndex="100",t.style.userSelect="none",this.host.appendChild(this.el),this.el.addEventListener("mousedown",this._mouseDown),Qr&&(this.el.addEventListener("touchstart",vu),this.el.addEventListener("pointerdown",Su)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),Qr&&(this.el.removeEventListener("touchstart",vu),this.el.removeEventListener("pointerdown",Su)),this.host.removeChild(this.el),delete this.el,delete this.host,this}_mouseDown(t){this.mouseDownEvent=t,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),Qr&&(this.el.addEventListener("touchmove",yu),this.el.addEventListener("touchend",wu)),t.stopPropagation(),t.preventDefault()}_mouseMove(t){const r=this.mouseDownEvent;this.moving?this._triggerEvent("move",t):Math.abs(t.x-r.x)+Math.abs(t.y-r.y)>2&&(this.moving=!0,this._triggerEvent("start",this.mouseDownEvent),this._triggerEvent("move",t),document.addEventListener("keydown",this._keyEvent)),t.stopPropagation()}_mouseUp(t){this.moving&&(this._triggerEvent("stop",t),document.removeEventListener("keydown",this._keyEvent)),document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),Qr&&(this.el.removeEventListener("touchmove",yu),this.el.removeEventListener("touchend",wu)),delete this.moving,delete this.mouseDownEvent,t.stopPropagation(),t.preventDefault()}_keyEvent(t){var r,i;t.key==="Escape"&&((i=(r=this.host.gridstackNode)==null?void 0:r.grid)==null||i.engine.restoreInitial(),this._mouseUp(this.mouseDownEvent))}_triggerEvent(t,r){return this.option[t]&&this.option[t](r),this}}Lu.prefix="ui-resizable-";class cd{constructor(){this._eventRegister={}}get disabled(){return this._disabled}on(t,r){this._eventRegister[t]=r}off(t){delete this._eventRegister[t]}enable(){this._disabled=!1}disable(){this._disabled=!0}destroy(){delete this._eventRegister}triggerEvent(t,r){if(!this.disabled&&this._eventRegister&&this._eventRegister[t])return this._eventRegister[t](r)}}class Oo extends cd{constructor(t,r={}){super(),this.el=t,this.option=r,this.rectScale={x:1,y:1},this._ui=()=>{const o=this.el.parentElement.getBoundingClientRect(),u={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},c=this.temporalRect||u;return{position:{left:(c.left-o.left)*this.rectScale.x,top:(c.top-o.top)*this.rectScale.y},size:{width:c.width*this.rectScale.x,height:c.height*this.rectScale.y}}},this._mouseOver=this._mouseOver.bind(this),this._mouseOut=this._mouseOut.bind(this),this.enable(),this._setupAutoHide(this.option.autoHide),this._setupHandlers()}on(t,r){super.on(t,r)}off(t){super.off(t)}enable(){super.enable(),this.el.classList.remove("ui-resizable-disabled"),this._setupAutoHide(this.option.autoHide)}disable(){super.disable(),this.el.classList.add("ui-resizable-disabled"),this._setupAutoHide(!1)}destroy(){this._removeHandlers(),this._setupAutoHide(!1),delete this.el,super.destroy()}updateOption(t){const r=t.handles&&t.handles!==this.option.handles,i=t.autoHide&&t.autoHide!==this.option.autoHide;return Object.keys(t).forEach(o=>this.option[o]=t[o]),r&&(this._removeHandlers(),this._setupHandlers()),i&&this._setupAutoHide(this.option.autoHide),this}_setupAutoHide(t){return t?(this.el.classList.add("ui-resizable-autohide"),this.el.addEventListener("mouseover",this._mouseOver),this.el.addEventListener("mouseout",this._mouseOut)):(this.el.classList.remove("ui-resizable-autohide"),this.el.removeEventListener("mouseover",this._mouseOver),this.el.removeEventListener("mouseout",this._mouseOut),Le.overResizeElement===this&&delete Le.overResizeElement),this}_mouseOver(t){Le.overResizeElement||Le.dragElement||(Le.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(t){Le.overResizeElement===this&&(delete Le.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(t=>t.trim()).map(t=>new Lu(this.el,t,{start:r=>{this._resizeStart(r)},stop:r=>{this._resizeStop(r)},move:r=>{this._resizing(r,t)}})),this}_resizeStart(t){this.sizeToContent=F.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=F.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=t,this._setupHelper(),this._applyChange();const r=F.initEvent(t,{type:"resizestart",target:this.el});return this.option.start&&this.option.start(r,this._ui()),this.el.classList.add("ui-resizable-resizing"),this.triggerEvent("resizestart",r),this}_resizing(t,r){this.scrolled=this.scrollEl.scrollTop-this.scrollY,this.temporalRect=this._getChange(t,r),this._applyChange();const i=F.initEvent(t,{type:"resize",target:this.el});return this.option.resize&&this.option.resize(i,this._ui()),this.triggerEvent("resize",i),this}_resizeStop(t){const r=F.initEvent(t,{type:"resizestop",target:this.el});return this.option.stop&&this.option.stop(r),this.el.classList.remove("ui-resizable-resizing"),this.triggerEvent("resizestop",r),this._cleanHelper(),delete this.startEvent,delete this.originalRect,delete this.temporalRect,delete this.scrollY,delete this.scrolled,this}_setupHelper(){this.elOriginStyleVal=Oo._originStyleProp.map(i=>this.el.style[i]),this.parentOriginStylePosition=this.el.parentElement.style.position;const t=this.el.parentElement,r=F.getValuesFromTransformedElement(t);return this.rectScale={x:r.xScale,y:r.yScale},getComputedStyle(this.el.parentElement).position.match(/static/)&&(this.el.parentElement.style.position="relative"),this.el.style.position="absolute",this.el.style.opacity="0.8",this}_cleanHelper(){return Oo._originStyleProp.forEach((t,r)=>{this.el.style[t]=this.elOriginStyleVal[r]||null}),this.el.parentElement.style.position=this.parentOriginStylePosition||null,this}_getChange(t,r){const i=this.startEvent,o={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},u=t.clientX-i.clientX,c=this.sizeToContent?0:t.clientY-i.clientY;let d,p;r.indexOf("e")>-1?o.width+=u:r.indexOf("w")>-1&&(o.width-=u,o.left+=u,d=!0),r.indexOf("s")>-1?o.height+=c:r.indexOf("n")>-1&&(o.height-=c,o.top+=c,p=!0);const g=this._constrainSize(o.width,o.height,d,p);return Math.round(o.width)!==Math.round(g.width)&&(r.indexOf("w")>-1&&(o.left+=o.width-g.width),o.width=g.width),Math.round(o.height)!==Math.round(g.height)&&(r.indexOf("n")>-1&&(o.top+=o.height-g.height),o.height=g.height),o}_constrainSize(t,r,i,o){const u=this.option,c=(i?u.maxWidthMoveLeft:u.maxWidth)||Number.MAX_SAFE_INTEGER,d=u.minWidth/this.rectScale.x||t,p=(o?u.maxHeightMoveUp:u.maxHeight)||Number.MAX_SAFE_INTEGER,g=u.minHeight/this.rectScale.y||r,y=Math.min(c,Math.max(d,t)),v=Math.min(p,Math.max(g,r));return{width:y,height:v}}_applyChange(){let t={left:0,top:0,width:0,height:0};if(this.el.style.position==="absolute"){const r=this.el.parentElement,{left:i,top:o}=r.getBoundingClientRect();t={left:i,top:o,width:0,height:0}}return this.temporalRect?(Object.keys(this.temporalRect).forEach(r=>{const i=this.temporalRect[r],o=r==="width"||r==="left"?this.rectScale.x:r==="height"||r==="top"?this.rectScale.y:1;this.el.style[r]=(i-t[r])*o+"px"}),this):this}_removeHandlers(){return this.handlers.forEach(t=>t.destroy()),delete this.handlers,this}}Oo._originStyleProp=["width","height","position","left","top","opacity","zIndex"];const LS='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class Lo extends cd{constructor(t,r={}){var u;super(),this.el=t,this.option=r,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0};const i=(u=r==null?void 0:r.handle)==null?void 0:u.substring(1),o=t.gridstackNode;this.dragEls=!i||t.classList.contains(i)?[t]:o!=null&&o.subGrid?[t.querySelector(r.handle)||t]:Array.from(t.querySelectorAll(r.handle)),this.dragEls.length===0&&(this.dragEls=[t]),this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this.enable()}on(t,r){super.on(t,r)}off(t){super.off(t)}enable(){this.disabled!==!1&&(super.enable(),this.dragEls.forEach(t=>{t.addEventListener("mousedown",this._mouseDown),Qr&&(t.addEventListener("touchstart",vu),t.addEventListener("pointerdown",Su))}),this.el.classList.remove("ui-draggable-disabled"))}disable(t=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(r=>{r.removeEventListener("mousedown",this._mouseDown),Qr&&(r.removeEventListener("touchstart",vu),r.removeEventListener("pointerdown",Su))}),t||this.el.classList.add("ui-draggable-disabled"))}destroy(){this.dragTimeout&&window.clearTimeout(this.dragTimeout),delete this.dragTimeout,this.mouseDownEvent&&this._mouseUp(this.mouseDownEvent),this.disable(!0),delete this.el,delete this.helper,delete this.option,super.destroy()}updateOption(t){return Object.keys(t).forEach(r=>this.option[r]=t[r]),this}_mouseDown(t){if(!Le.mouseHandled)return t.button!==0||!this.dragEls.find(r=>r===t.target)&&t.target.closest(LS)||this.option.cancel&&t.target.closest(this.option.cancel)||(this.mouseDownEvent=t,delete this.dragging,delete Le.dragElement,delete Le.dropElement,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),Qr&&(t.currentTarget.addEventListener("touchmove",yu),t.currentTarget.addEventListener("touchend",wu)),t.preventDefault(),document.activeElement&&document.activeElement.blur(),Le.mouseHandled=!0),!0}_callDrag(t){if(!this.dragging)return;const r=F.initEvent(t,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(r,this.ui()),this.triggerEvent("drag",r)}_mouseMove(t){var i;const r=this.mouseDownEvent;if(this.lastDrag=t,this.dragging)if(this._dragFollow(t),Le.pauseDrag){const o=Number.isInteger(Le.pauseDrag)?Le.pauseDrag:100;this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>this._callDrag(t),o)}else this._callDrag(t);else if(Math.abs(t.x-r.x)+Math.abs(t.y-r.y)>3){this.dragging=!0,Le.dragElement=this;const o=(i=this.el.gridstackNode)==null?void 0:i.grid;o?Le.dropElement=o.el.ddElement.ddDroppable:delete Le.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=F.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(t,this.el,this.helperContainment),this._setupHelperStyle(t);const u=F.initEvent(t,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(u,this.ui()),this.triggerEvent("dragstart",u),document.addEventListener("keydown",this._keyEvent)}return!0}_mouseUp(t){var r,i;if(document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),Qr&&t.currentTarget&&(t.currentTarget.removeEventListener("touchmove",yu,!0),t.currentTarget.removeEventListener("touchend",wu,!0)),this.dragging){delete this.dragging,(r=this.el.gridstackNode)==null||delete r._origRotate,document.removeEventListener("keydown",this._keyEvent),((i=Le.dropElement)==null?void 0:i.el)===this.el.parentElement&&delete Le.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();const o=F.initEvent(t,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(o),this.triggerEvent("dragstop",o),Le.dropElement&&Le.dropElement.drop(t)}delete this.helper,delete this.mouseDownEvent,delete Le.dragElement,delete Le.dropElement,delete Le.mouseHandled,t.preventDefault()}_keyEvent(t){var o,u;const r=this.el.gridstackNode,i=(r==null?void 0:r.grid)||((u=(o=Le.dropElement)==null?void 0:o.el)==null?void 0:u.gridstack);if(t.key==="Escape")r&&r._origRotate&&(r._orig=r._origRotate,delete r._origRotate),i==null||i.cancelDrag(),this._mouseUp(this.mouseDownEvent);else if(r&&i&&(t.key==="r"||t.key==="R")){if(!F.canBeRotated(r))return;r._origRotate=r._origRotate||{...r._orig},delete r._moving,i.setAnimation(!1).rotate(r.el,{top:-this.dragOffset.offsetTop,left:-this.dragOffset.offsetLeft}).setAnimation(),r._moving=!0,this.dragOffset=this._getDragOffset(this.lastDrag,r.el,this.helperContainment),this.helper.style.width=this.dragOffset.width+"px",this.helper.style.height=this.dragOffset.height+"px",F.swap(r._orig,"w","h"),delete r._rect,this._mouseMove(this.lastDrag)}}_createHelper(){let t=this.el;return typeof this.option.helper=="function"?t=this.option.helper(this.el):this.option.helper==="clone"&&(t=F.cloneNode(this.el)),t.parentElement||F.appendTo(t,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=Lo.originStyleProp.map(r=>this.el.style[r]),t}_setupHelperStyle(t){this.helper.classList.add("ui-draggable-dragging");const r=this.helper.style;return r.pointerEvents="none",r.width=this.dragOffset.width+"px",r.height=this.dragOffset.height+"px",r.willChange="left, top",r.position="fixed",this._dragFollow(t),r.transition="none",setTimeout(()=>{this.helper&&(r.transition=null)},0),this}_removeHelperStyle(){var r;this.helper.classList.remove("ui-draggable-dragging");const t=(r=this.helper)==null?void 0:r.gridstackNode;if(!(t!=null&&t._isAboutToRemove)&&this.dragElementOriginStyle){const i=this.helper,o=this.dragElementOriginStyle.transition||null;i.style.transition=this.dragElementOriginStyle.transition="none",Lo.originStyleProp.forEach(u=>i.style[u]=this.dragElementOriginStyle[u]||null),setTimeout(()=>i.style.transition=o,50)}return delete this.dragElementOriginStyle,this}_dragFollow(t){const r={left:0,top:0},i=this.helper.style,o=this.dragOffset;i.left=(t.clientX+o.offsetLeft-r.left)*this.dragTransform.xScale+"px",i.top=(t.clientY+o.offsetTop-r.top)*this.dragTransform.yScale+"px"}_setupHelperContainmentStyle(){return this.helperContainment=this.helper.parentElement,this.helper.style.position!=="fixed"&&(this.parentOriginStylePosition=this.helperContainment.style.position,getComputedStyle(this.helperContainment).position.match(/static/)&&(this.helperContainment.style.position="relative")),this}_getDragOffset(t,r,i){let o=0,u=0;i&&(o=this.dragTransform.xOffset,u=this.dragTransform.yOffset);const c=r.getBoundingClientRect();return{left:c.left,top:c.top,offsetLeft:-t.clientX+c.left-o,offsetTop:-t.clientY+c.top-u,width:c.width*this.dragTransform.xScale,height:c.height*this.dragTransform.yScale}}ui(){const r=this.el.parentElement.getBoundingClientRect(),i=this.helper.getBoundingClientRect();return{position:{top:(i.top-r.top)*this.dragTransform.yScale,left:(i.left-r.left)*this.dragTransform.xScale}}}}Lo.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","top","minWidth","willChange"];class PS extends cd{constructor(t,r={}){super(),this.el=t,this.option=r,this._mouseEnter=this._mouseEnter.bind(this),this._mouseLeave=this._mouseLeave.bind(this),this.enable(),this._setupAccept()}on(t,r){super.on(t,r)}off(t){super.off(t)}enable(){this.disabled!==!1&&(super.enable(),this.el.classList.add("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),this.el.addEventListener("mouseenter",this._mouseEnter),this.el.addEventListener("mouseleave",this._mouseLeave),Qr&&(this.el.addEventListener("pointerenter",bm),this.el.addEventListener("pointerleave",Tm)))}disable(t=!1){this.disabled!==!0&&(super.disable(),this.el.classList.remove("ui-droppable"),t||this.el.classList.add("ui-droppable-disabled"),this.el.removeEventListener("mouseenter",this._mouseEnter),this.el.removeEventListener("mouseleave",this._mouseLeave),Qr&&(this.el.removeEventListener("pointerenter",bm),this.el.removeEventListener("pointerleave",Tm)))}destroy(){this.disable(!0),this.el.classList.remove("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),super.destroy()}updateOption(t){return Object.keys(t).forEach(r=>this.option[r]=t[r]),this._setupAccept(),this}_mouseEnter(t){if(!Le.dragElement||!this._canDrop(Le.dragElement.el))return;t.preventDefault(),t.stopPropagation(),Le.dropElement&&Le.dropElement!==this&&Le.dropElement._mouseLeave(t,!0),Le.dropElement=this;const r=F.initEvent(t,{target:this.el,type:"dropover"});this.option.over&&this.option.over(r,this._ui(Le.dragElement)),this.triggerEvent("dropover",r),this.el.classList.add("ui-droppable-over")}_mouseLeave(t,r=!1){var o;if(!Le.dragElement||Le.dropElement!==this)return;t.preventDefault(),t.stopPropagation();const i=F.initEvent(t,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(i,this._ui(Le.dragElement)),this.triggerEvent("dropout",i),Le.dropElement===this&&(delete Le.dropElement,!r)){let u,c=this.el.parentElement;for(;!u&&c;)u=(o=c.ddElement)==null?void 0:o.ddDroppable,c=c.parentElement;u&&u._mouseEnter(t)}}drop(t){t.preventDefault();const r=F.initEvent(t,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(r,this._ui(Le.dragElement)),this.triggerEvent("drop",r)}_canDrop(t){return t&&(!this.accept||this.accept(t))}_setupAccept(){return this.option.accept?(typeof this.option.accept=="string"?this.accept=t=>t.classList.contains(this.option.accept)||t.matches(this.option.accept):this.accept=this.option.accept,this):this}_ui(t){return{draggable:t.el,...t.ui()}}}class fd{static init(t){return t.ddElement||(t.ddElement=new fd(t)),t.ddElement}constructor(t){this.el=t}on(t,r){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(t)>-1?this.ddDraggable.on(t,r):this.ddDroppable&&["drop","dropover","dropout"].indexOf(t)>-1?this.ddDroppable.on(t,r):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(t)>-1&&this.ddResizable.on(t,r),this}off(t){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(t)>-1?this.ddDraggable.off(t):this.ddDroppable&&["drop","dropover","dropout"].indexOf(t)>-1?this.ddDroppable.off(t):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(t)>-1&&this.ddResizable.off(t),this}setupDraggable(t){return this.ddDraggable?this.ddDraggable.updateOption(t):this.ddDraggable=new Lo(this.el,t),this}cleanDraggable(){return this.ddDraggable&&(this.ddDraggable.destroy(),delete this.ddDraggable),this}setupResizable(t){return this.ddResizable?this.ddResizable.updateOption(t):this.ddResizable=new Oo(this.el,t),this}cleanResizable(){return this.ddResizable&&(this.ddResizable.destroy(),delete this.ddResizable),this}setupDroppable(t){return this.ddDroppable?this.ddDroppable.updateOption(t):this.ddDroppable=new PS(this.el,t),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class AS{resizable(t,r,i,o){return this._getDDElements(t,r).forEach(u=>{if(r==="disable"||r==="enable")u.ddResizable&&u.ddResizable[r]();else if(r==="destroy")u.ddResizable&&u.cleanResizable();else if(r==="option")u.setupResizable({[i]:o});else{const d=u.el.gridstackNode.grid;let p=u.el.getAttribute("gs-resize-handles")||d.opts.resizable.handles||"e,s,se";p==="all"&&(p="n,e,s,w,se,sw,ne,nw");const g=!d.opts.alwaysShowResizeHandle;u.setupResizable({...d.opts.resizable,handles:p,autoHide:g,start:r.start,stop:r.stop,resize:r.resize})}}),this}draggable(t,r,i,o){return this._getDDElements(t,r).forEach(u=>{if(r==="disable"||r==="enable")u.ddDraggable&&u.ddDraggable[r]();else if(r==="destroy")u.ddDraggable&&u.cleanDraggable();else if(r==="option")u.setupDraggable({[i]:o});else{const c=u.el.gridstackNode.grid;u.setupDraggable({...c.opts.draggable,start:r.start,stop:r.stop,drag:r.drag})}}),this}dragIn(t,r){return this._getDDElements(t).forEach(i=>i.setupDraggable(r)),this}droppable(t,r,i,o){return typeof r.accept=="function"&&!r._accept&&(r._accept=r.accept,r.accept=u=>r._accept(u)),this._getDDElements(t,r).forEach(u=>{r==="disable"||r==="enable"?u.ddDroppable&&u.ddDroppable[r]():r==="destroy"?u.ddDroppable&&u.cleanDroppable():r==="option"?u.setupDroppable({[i]:o}):u.setupDroppable(r)}),this}isDroppable(t){var r;return!!((r=t==null?void 0:t.ddElement)!=null&&r.ddDroppable&&!t.ddElement.ddDroppable.disabled)}isDraggable(t){var r;return!!((r=t==null?void 0:t.ddElement)!=null&&r.ddDraggable&&!t.ddElement.ddDraggable.disabled)}isResizable(t){var r;return!!((r=t==null?void 0:t.ddElement)!=null&&r.ddResizable&&!t.ddElement.ddResizable.disabled)}on(t,r,i){return this._getDDElements(t).forEach(o=>o.on(r,u=>{i(u,Le.dragElement?Le.dragElement.el:u.target,Le.dragElement?Le.dragElement.helper:null)})),this}off(t,r){return this._getDDElements(t).forEach(i=>i.off(r)),this}_getDDElements(t,r){const i=t.gridstack||r!=="destroy"&&r!=="disable",o=F.getElements(t);return o.length?o.map(c=>c.ddElement||(i?fd.init(c):null)).filter(c=>c):[]}}/*! + * GridStack 11.5.1 + * https://gridstackjs.com/ + * + * Copyright (c) 2021-2024 Alain Dumesny + * see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE + */const Gn=new AS;class Te{static init(t={},r=".grid-stack"){if(typeof document>"u")return null;const i=Te.getGridElement(r);return i?(i.gridstack||(i.gridstack=new Te(i,F.cloneDeep(t))),i.gridstack):(console.error(typeof r=="string"?'GridStack.initAll() no grid was found with selector "'+r+`" - element missing or wrong selector ? +Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`:"GridStack.init() no grid element was passed."),null)}static initAll(t={},r=".grid-stack"){const i=[];return typeof document>"u"||(Te.getGridElements(r).forEach(o=>{o.gridstack||(o.gridstack=new Te(o,F.cloneDeep(t))),i.push(o.gridstack)}),i.length===0&&console.error('GridStack.initAll() no grid was found with selector "'+r+`" - element missing or wrong selector ? +Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`)),i}static addGrid(t,r={}){if(!t)return null;let i=t;if(i.gridstack){const c=i.gridstack;return r&&(c.opts={...c.opts,...r}),r.children!==void 0&&c.load(r.children),c}return(!t.classList.contains("grid-stack")||Te.addRemoveCB)&&(Te.addRemoveCB?i=Te.addRemoveCB(t,r,!0,!0):i=F.createDiv(["grid-stack",r.class],t)),Te.init(r,i)}static registerEngine(t){Te.engineClass=t}get placeholder(){if(!this._placeholder){this._placeholder=F.createDiv([this.opts.placeholderClass,wr.itemClass,this.opts.itemClass]);const t=F.createDiv(["placeholder-content"],this._placeholder);this.opts.placeholderText&&(t.textContent=this.opts.placeholderText)}return this._placeholder}constructor(t,r={}){var v,x,T;this.el=t,this.opts=r,this.animationDelay=310,this._gsEventHandler={},this._extraDragRow=0,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0},t.gridstack=this,this.opts=r=r||{},t.classList.contains("grid-stack")||this.el.classList.add("grid-stack"),r.row&&(r.minRow=r.maxRow=r.row,delete r.row);const i=F.toNumber(t.getAttribute("gs-row"));r.column==="auto"&&delete r.column,r.alwaysShowResizeHandle!==void 0&&(r._alwaysShowResizeHandle=r.alwaysShowResizeHandle);let o=(v=r.columnOpts)==null?void 0:v.breakpoints;const u=r;if(u.oneColumnModeDomSort&&(delete u.oneColumnModeDomSort,console.log("warning: Gridstack oneColumnModeDomSort no longer supported. Use GridStackOptions.columnOpts instead.")),u.oneColumnSize||u.disableOneColumnMode===!1){const N=u.oneColumnSize||768;delete u.oneColumnSize,delete u.disableOneColumnMode,r.columnOpts=r.columnOpts||{},o=r.columnOpts.breakpoints=r.columnOpts.breakpoints||[];let C=o.find(L=>L.c===1);C?C.w=N:(C={c:1,w:N},o.push(C,{c:12,w:N+1}))}const c=r.columnOpts;c&&(!c.columnWidth&&!((x=c.breakpoints)!=null&&x.length)?(delete r.columnOpts,o=void 0):c.columnMax=c.columnMax||12),(o==null?void 0:o.length)>1&&o.sort((N,C)=>(C.w||0)-(N.w||0));const d={...F.cloneDeep(wr),column:F.toNumber(t.getAttribute("gs-column"))||wr.column,minRow:i||F.toNumber(t.getAttribute("gs-min-row"))||wr.minRow,maxRow:i||F.toNumber(t.getAttribute("gs-max-row"))||wr.maxRow,staticGrid:F.toBool(t.getAttribute("gs-static"))||wr.staticGrid,sizeToContent:F.toBool(t.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(r.handleClass?"."+r.handleClass:r.handle?r.handle:"")||wr.draggable.handle},removableOptions:{accept:r.itemClass||wr.removableOptions.accept,decline:wr.removableOptions.decline}};t.getAttribute("gs-animate")&&(d.animate=F.toBool(t.getAttribute("gs-animate"))),r=F.defaults(r,d),this._initMargin(),this.checkDynamicColumn(),this.el.classList.add("gs-"+r.column),r.rtl==="auto"&&(r.rtl=t.style.direction==="rtl"),r.rtl&&this.el.classList.add("grid-stack-rtl");const p=this.el.closest("."+wr.itemClass),g=p==null?void 0:p.gridstackNode;g&&(g.subGrid=this,this.parentGridNode=g,this.el.classList.add("grid-stack-nested"),g.el.classList.add("grid-stack-sub-grid")),this._isAutoCellHeight=r.cellHeight==="auto",this._isAutoCellHeight||r.cellHeight==="initial"?this.cellHeight(void 0,!1):(typeof r.cellHeight=="number"&&r.cellHeightUnit&&r.cellHeightUnit!==wr.cellHeightUnit&&(r.cellHeight=r.cellHeight+r.cellHeightUnit,delete r.cellHeightUnit),this.cellHeight(r.cellHeight,!1)),r.alwaysShowResizeHandle==="mobile"&&(r.alwaysShowResizeHandle=Qr),this._styleSheetClass="gs-id-"+ci._idSeq++,this.el.classList.add(this._styleSheetClass),this._setStaticClass();const y=r.engineClass||Te.engineClass||ci;if(this.engine=new y({column:this.getColumn(),float:r.float,maxRow:r.maxRow,onChange:N=>{let C=0;this.engine.nodes.forEach(L=>{C=Math.max(C,L.y+L.h)}),N.forEach(L=>{const U=L.el;U&&(L._removeDOM?(U&&U.remove(),delete L._removeDOM):this._writePosAttr(U,L))}),this._updateStyles(!1,C)}}),this._updateStyles(!1,0),r.auto&&(this.batchUpdate(),this.engine._loading=!0,this.getGridItems().forEach(N=>this._prepareElement(N)),delete this.engine._loading,this.batchUpdate(!1)),r.children){const N=r.children;delete r.children,N.length&&this.load(N)}this.setAnimation(),r.subGridDynamic&&!Le.pauseDrag&&(Le.pauseDrag=!0),((T=r.draggable)==null?void 0:T.pause)!==void 0&&(Le.pauseDrag=r.draggable.pause),this._setupRemoveDrop(),this._setupAcceptWidget(),this._updateResizeEvent()}addWidget(t){if(typeof t=="string"){console.error("V11: GridStack.addWidget() does not support string anymore. see #2736");return}if(t.ELEMENT_NODE)return console.error("V11: GridStack.addWidget() does not support HTMLElement anymore. use makeWidget()"),this.makeWidget(t);let r,i=t;if(i.grid=this,i!=null&&i.el?r=i.el:Te.addRemoveCB?r=Te.addRemoveCB(this.el,t,!0,!1):r=this.createWidgetDivs(i),!r)return;if(i=r.gridstackNode,i&&r.parentElement===this.el&&this.engine.nodes.find(u=>u._id===i._id))return r;const o=this._readAttr(r);return F.defaults(t,o),this.engine.prepareNode(t),this.el.appendChild(r),this.makeWidget(r,t),r}createWidgetDivs(t){const r=F.createDiv(["grid-stack-item",this.opts.itemClass]),i=F.createDiv(["grid-stack-item-content"],r);return F.lazyLoad(t)?t.visibleObservable||(t.visibleObservable=new IntersectionObserver(([o])=>{var u,c;o.isIntersecting&&((u=t.visibleObservable)==null||u.disconnect(),delete t.visibleObservable,Te.renderCB(i,t),(c=t.grid)==null||c.prepareDragDrop(t.el))}),window.setTimeout(()=>{var o;return(o=t.visibleObservable)==null?void 0:o.observe(r)})):Te.renderCB(i,t),r}makeSubGrid(t,r,i,o=!0){var T,N,C;let u=t.gridstackNode;if(u||(u=this.makeWidget(t).gridstackNode),(T=u.subGrid)!=null&&T.el)return u.subGrid;let c,d=this;for(;d&&!c;)c=(N=d.opts)==null?void 0:N.subGridOpts,d=(C=d.parentGridNode)==null?void 0:C.grid;r=F.cloneDeep({...this.opts,id:void 0,children:void 0,column:"auto",columnOpts:void 0,layout:"list",subGridOpts:void 0,...c||{},...r||u.subGridOpts||{}}),u.subGridOpts=r;let p;r.column==="auto"&&(p=!0,r.column=Math.max(u.w||1,(i==null?void 0:i.w)||1),delete r.columnOpts);let g=u.el.querySelector(".grid-stack-item-content"),y,v;if(o&&(this._removeDD(u.el),v={...u,x:0,y:0},F.removeInternalForSave(v),delete v.subGridOpts,u.content&&(v.content=u.content,delete u.content),Te.addRemoveCB?y=Te.addRemoveCB(this.el,v,!0,!1):(y=F.createDiv(["grid-stack-item"]),y.appendChild(g),g=F.createDiv(["grid-stack-item-content"],u.el)),this.prepareDragDrop(u.el)),i){const L=p?r.column:u.w,U=u.h+i.h,A=u.el.style;A.transition="none",this.update(u.el,{w:L,h:U}),setTimeout(()=>A.transition=null)}const x=u.subGrid=Te.addGrid(g,r);return i!=null&&i._moving&&(x._isTemp=!0),p&&(x._autoColumn=!0),o&&x.makeWidget(y,v),i&&(i._moving?window.setTimeout(()=>F.simulateMouseEvent(i._event,"mouseenter",x.el),0):x.makeWidget(u.el,u)),this.resizeToContentCheck(!1,u),x}removeAsSubGrid(t){var i;const r=(i=this.parentGridNode)==null?void 0:i.grid;r&&(r.batchUpdate(),r.removeWidget(this.parentGridNode.el,!0,!0),this.engine.nodes.forEach(o=>{o.x+=this.parentGridNode.x,o.y+=this.parentGridNode.y,r.makeWidget(o.el,o)}),r.batchUpdate(!1),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,t&&window.setTimeout(()=>F.simulateMouseEvent(t._event,"mouseenter",r.el),0))}save(t=!0,r=!1,i=Te.saveCB){const o=this.engine.save(t,i);if(o.forEach(u=>{var c;if(t&&u.el&&!u.subGrid&&!i){const d=u.el.querySelector(".grid-stack-item-content");u.content=d==null?void 0:d.innerHTML,u.content||delete u.content}else if(!t&&!i&&delete u.content,(c=u.subGrid)!=null&&c.el){const d=u.subGrid.save(t,r,i);u.subGridOpts=r?d:{children:d},delete u.subGrid}delete u.el}),r){const u=F.cloneDeep(this.opts);u.marginBottom===u.marginTop&&u.marginRight===u.marginLeft&&u.marginTop===u.marginRight&&(u.margin=u.marginTop,delete u.marginTop,delete u.marginRight,delete u.marginBottom,delete u.marginLeft),u.rtl===(this.el.style.direction==="rtl")&&(u.rtl="auto"),this._isAutoCellHeight&&(u.cellHeight="auto"),this._autoColumn&&(u.column="auto");const c=u._alwaysShowResizeHandle;return delete u._alwaysShowResizeHandle,c!==void 0?u.alwaysShowResizeHandle=c:delete u.alwaysShowResizeHandle,F.removeInternalAndSame(u,wr),u.children=o,u}return o}load(t,r=Te.addRemoveCB||!0){var g;t=F.cloneDeep(t);const i=this.getColumn();t.forEach(y=>{y.w=y.w||1,y.h=y.h||1}),t=F.sort(t),this.engine.skipCacheUpdate=this._ignoreLayoutsNodeChange=!0;let o=0;t.forEach(y=>{o=Math.max(o,(y.x||0)+y.w)}),o>this.engine.defaultColumn&&(this.engine.defaultColumn=o),o>i&&this.engine.cacheLayout(t,o,!0);const u=Te.addRemoveCB;typeof r=="function"&&(Te.addRemoveCB=r);const c=[];this.batchUpdate();const d=!this.engine.nodes.length;d&&this.setAnimation(!1),!d&&r&&[...this.engine.nodes].forEach(v=>{if(!v.id)return;F.find(t,v.id)||(Te.addRemoveCB&&Te.addRemoveCB(this.el,v,!1,!1),c.push(v),this.removeWidget(v.el,!0,!1))}),this.engine._loading=!0;const p=[];return this.engine.nodes=this.engine.nodes.filter(y=>F.find(t,y.id)?(p.push(y),!1):!0),t.forEach(y=>{var x;const v=F.find(p,y.id);if(v){if(F.shouldSizeToContent(v)&&(y.h=v.h),this.engine.nodeBoundFix(y),(y.autoPosition||y.x===void 0||y.y===void 0)&&(y.w=y.w||v.w,y.h=y.h||v.h,this.engine.findEmptyPosition(y)),this.engine.nodes.push(v),F.samePos(v,y)&&this.engine.nodes.length>1&&(this.moveNode(v,{...y,forceCollide:!0}),F.copyPos(y,v)),this.update(v.el,y),(x=y.subGridOpts)!=null&&x.children){const T=v.el.querySelector(".grid-stack");T&&T.gridstack&&T.gridstack.load(y.subGridOpts.children)}}else r&&this.addWidget(y)}),delete this.engine._loading,this.engine.removedNodes=c,this.batchUpdate(!1),delete this._ignoreLayoutsNodeChange,delete this.engine.skipCacheUpdate,u?Te.addRemoveCB=u:delete Te.addRemoveCB,d&&((g=this.opts)!=null&&g.animate)&&this.setAnimation(this.opts.animate,!0),this}batchUpdate(t=!0){return this.engine.batchUpdate(t),t||(this._updateContainerHeight(),this._triggerRemoveEvent(),this._triggerAddEvent(),this._triggerChangeEvent()),this}getCellHeight(t=!1){if(this.opts.cellHeight&&this.opts.cellHeight!=="auto"&&(!t||!this.opts.cellHeightUnit||this.opts.cellHeightUnit==="px"))return this.opts.cellHeight;if(this.opts.cellHeightUnit==="rem")return this.opts.cellHeight*parseFloat(getComputedStyle(document.documentElement).fontSize);if(this.opts.cellHeightUnit==="em")return this.opts.cellHeight*parseFloat(getComputedStyle(this.el).fontSize);if(this.opts.cellHeightUnit==="cm")return this.opts.cellHeight*(96/2.54);if(this.opts.cellHeightUnit==="mm")return this.opts.cellHeight*(96/2.54)/10;const r=this.el.querySelector("."+this.opts.itemClass);if(r){const o=F.toNumber(r.getAttribute("gs-h"))||1;return Math.round(r.offsetHeight/o)}const i=parseInt(this.el.getAttribute("gs-current-row"));return i?Math.round(this.el.getBoundingClientRect().height/i):this.opts.cellHeight}cellHeight(t,r=!0){if(r&&t!==void 0&&this._isAutoCellHeight!==(t==="auto")&&(this._isAutoCellHeight=t==="auto",this._updateResizeEvent()),(t==="initial"||t==="auto")&&(t=void 0),t===void 0){const o=-this.opts.marginRight-this.opts.marginLeft+this.opts.marginTop+this.opts.marginBottom;t=this.cellWidth()+o}const i=F.parseHeight(t);return this.opts.cellHeightUnit===i.unit&&this.opts.cellHeight===i.h?this:(this.opts.cellHeightUnit=i.unit,this.opts.cellHeight=i.h,this.resizeToContentCheck(),r&&this._updateStyles(!0),this)}cellWidth(){return this._widthOrContainer()/this.getColumn()}_widthOrContainer(t=!1){var r;return t&&((r=this.opts.columnOpts)!=null&&r.breakpointForWindow)?window.innerWidth:this.el.clientWidth||this.el.parentElement.clientWidth||window.innerWidth}checkDynamicColumn(){var u,c;const t=this.opts.columnOpts;if(!t||!t.columnWidth&&!((u=t.breakpoints)!=null&&u.length))return!1;const r=this.getColumn();let i=r;const o=this._widthOrContainer(!0);if(t.columnWidth)i=Math.min(Math.round(o/t.columnWidth)||1,t.columnMax);else{i=t.columnMax;let d=0;for(;dp.c===i);return this.column(i,(d==null?void 0:d.layout)||t.layout),!0}return!1}compact(t="compact",r=!0){return this.engine.compact(t,r),this._triggerChangeEvent(),this}column(t,r="moveScale"){if(!t||t<1||this.opts.column===t)return this;const i=this.getColumn();return this.opts.column=t,this.engine?(this.engine.column=t,this.el.classList.remove("gs-"+i),this.el.classList.add("gs-"+t),this.engine.columnChanged(i,t,r),this._isAutoCellHeight&&this.cellHeight(),this.resizeToContentCheck(!0),this._ignoreLayoutsNodeChange=!0,this._triggerChangeEvent(),delete this._ignoreLayoutsNodeChange,this):this}getColumn(){return this.opts.column}getGridItems(){return Array.from(this.el.children).filter(t=>t.matches("."+this.opts.itemClass)&&!t.matches("."+this.opts.placeholderClass))}isIgnoreChangeCB(){return this._ignoreLayoutsNodeChange}destroy(t=!0){var r,i;if(this.el)return this.offAll(),this._updateResizeEvent(!0),this.setStatic(!0,!1),this.setAnimation(!1),t?this.el.parentNode.removeChild(this.el):(this.removeAll(t),this.el.classList.remove(this._styleSheetClass),this.el.removeAttribute("gs-current-row")),this._removeStylesheet(),(r=this.parentGridNode)==null||delete r.subGrid,delete this.parentGridNode,delete this.opts,(i=this._placeholder)==null||delete i.gridstackNode,delete this._placeholder,delete this.engine,delete this.el.gridstack,delete this.el,this}float(t){return this.opts.float!==t&&(this.opts.float=this.engine.float=t,this._triggerChangeEvent()),this}getFloat(){return this.engine.float}getCellFromPixel(t,r=!1){const i=this.el.getBoundingClientRect();let o;r?o={top:i.top+document.documentElement.scrollTop,left:i.left}:o={top:this.el.offsetTop,left:this.el.offsetLeft};const u=t.left-o.left,c=t.top-o.top,d=i.width/this.getColumn(),p=i.height/parseInt(this.el.getAttribute("gs-current-row"));return{x:Math.floor(u/d),y:Math.floor(c/p)}}getRow(){return Math.max(this.engine.getRow(),this.opts.minRow)}isAreaEmpty(t,r,i,o){return this.engine.isAreaEmpty(t,r,i,o)}makeWidget(t,r){const i=Te.getElement(t);if(!i)return;i.parentElement||this.el.appendChild(i),this._prepareElement(i,!0,r);const o=i.gridstackNode;this._updateContainerHeight(),o.subGridOpts&&this.makeSubGrid(i,o.subGridOpts,void 0,!1);let u;return this.opts.column===1&&!this._ignoreLayoutsNodeChange&&(u=this._ignoreLayoutsNodeChange=!0),this._triggerAddEvent(),this._triggerChangeEvent(),u&&delete this._ignoreLayoutsNodeChange,i}on(t,r){return t.indexOf(" ")!==-1?(t.split(" ").forEach(o=>this.on(o,r)),this):(t==="change"||t==="added"||t==="removed"||t==="enable"||t==="disable"?(t==="enable"||t==="disable"?this._gsEventHandler[t]=o=>r(o):this._gsEventHandler[t]=o=>{o.detail&&r(o,o.detail)},this.el.addEventListener(t,this._gsEventHandler[t])):t==="drag"||t==="dragstart"||t==="dragstop"||t==="resizestart"||t==="resize"||t==="resizestop"||t==="dropped"||t==="resizecontent"?this._gsEventHandler[t]=r:console.error("GridStack.on("+t+") event not supported"),this)}off(t){return t.indexOf(" ")!==-1?(t.split(" ").forEach(i=>this.off(i)),this):((t==="change"||t==="added"||t==="removed"||t==="enable"||t==="disable")&&this._gsEventHandler[t]&&this.el.removeEventListener(t,this._gsEventHandler[t]),delete this._gsEventHandler[t],this)}offAll(){return Object.keys(this._gsEventHandler).forEach(t=>this.off(t)),this}removeWidget(t,r=!0,i=!0){return t?(Te.getElements(t).forEach(o=>{if(o.parentElement&&o.parentElement!==this.el)return;let u=o.gridstackNode;u||(u=this.engine.nodes.find(c=>o===c.el)),u&&(r&&Te.addRemoveCB&&Te.addRemoveCB(this.el,u,!1,!1),delete o.gridstackNode,this._removeDD(o),this.engine.removeNode(u,r,i),r&&o.parentElement&&o.remove())}),i&&(this._triggerRemoveEvent(),this._triggerChangeEvent()),this):(console.error("Error: GridStack.removeWidget(undefined) called"),this)}removeAll(t=!0,r=!0){return this.engine.nodes.forEach(i=>{t&&Te.addRemoveCB&&Te.addRemoveCB(this.el,i,!1,!1),delete i.el.gridstackNode,this.opts.staticGrid||this._removeDD(i.el)}),this.engine.removeAll(t,r),r&&this._triggerRemoveEvent(),this}setAnimation(t=this.opts.animate,r){return r?setTimeout(()=>{this.opts&&this.setAnimation(t)}):t?this.el.classList.add("grid-stack-animate"):this.el.classList.remove("grid-stack-animate"),this}hasAnimationCSS(){return this.el.classList.contains("grid-stack-animate")}setStatic(t,r=!0,i=!0){return!!this.opts.staticGrid===t?this:(t?this.opts.staticGrid=!0:delete this.opts.staticGrid,this._setupRemoveDrop(),this._setupAcceptWidget(),this.engine.nodes.forEach(o=>{this.prepareDragDrop(o.el),o.subGrid&&i&&o.subGrid.setStatic(t,r,i)}),r&&this._setStaticClass(),this)}updateOptions(t){var i;const r=this.opts;return t.acceptWidgets!==void 0&&this._setupAcceptWidget(),t.animate!==void 0&&this.setAnimation(),t.cellHeight&&(this.cellHeight(t.cellHeight,!0),delete t.cellHeight),t.class&&t.class!==r.class&&(r.class&&this.el.classList.remove(r.class),this.el.classList.add(t.class)),typeof t.column=="number"&&!t.columnOpts&&(this.column(t.column),delete t.column),t.margin!==void 0&&this.margin(t.margin),t.staticGrid!==void 0&&this.setStatic(t.staticGrid),t.disableDrag!==void 0&&!t.staticGrid&&this.enableMove(!t.disableDrag),t.disableResize!==void 0&&!t.staticGrid&&this.enableResize(!t.disableResize),t.float!==void 0&&this.float(t.float),t.row!==void 0&&(r.minRow=r.maxRow=t.row),(i=t.children)!=null&&i.length&&(this.load(t.children),delete t.children),this.opts={...this.opts,...t},this}update(t,r){return Te.getElements(t).forEach(i=>{var y;const o=i==null?void 0:i.gridstackNode;if(!o)return;const u={...F.copyPos({},o),...F.cloneDeep(r)};this.engine.nodeBoundFix(u),delete u.autoPosition;const c=["x","y","w","h"];let d;if(c.some(v=>u[v]!==void 0&&u[v]!==o[v])&&(d={},c.forEach(v=>{d[v]=u[v]!==void 0?u[v]:o[v],delete u[v]})),!d&&(u.minW||u.minH||u.maxW||u.maxH)&&(d={}),u.content!==void 0){const v=i.querySelector(".grid-stack-item-content");v&&v.textContent!==u.content&&(o.content=u.content,Te.renderCB(v,u),(y=o.subGrid)!=null&&y.el&&(v.appendChild(o.subGrid.el),o.subGrid.opts.styleInHead||o.subGrid._updateStyles(!0))),delete u.content}let p=!1,g=!1;for(const v in u)v[0]!=="_"&&o[v]!==u[v]&&(o[v]=u[v],p=!0,g=g||!this.opts.staticGrid&&(v==="noResize"||v==="noMove"||v==="locked"));if(F.sanitizeMinMax(o),d){const v=d.w!==void 0&&d.w!==o.w;this.moveNode(o,d),v&&o.subGrid?o.subGrid.onResize(this.hasAnimationCSS()?o.w:void 0):this.resizeToContentCheck(v,o),delete o._orig}(d||p)&&this._writeAttr(i,o),g&&this.prepareDragDrop(o.el)}),this}moveNode(t,r){const i=t._updating;i||this.engine.cleanNodes().beginUpdate(t),this.engine.moveNode(t,r),this._updateContainerHeight(),i||(this._triggerChangeEvent(),this.engine.endUpdate())}resizeToContent(t){var x,T;if(!t||(t.classList.remove("size-to-content-max"),!t.clientHeight))return;const r=t.gridstackNode;if(!r)return;const i=r.grid;if(!i||t.parentElement!==i.el)return;const o=i.getCellHeight(!0);if(!o)return;let u=r.h?r.h*o:t.clientHeight,c;if(r.resizeToContentParent&&(c=t.querySelector(r.resizeToContentParent)),c||(c=t.querySelector(Te.resizeToContentParent)),!c)return;const d=t.clientHeight-c.clientHeight,p=r.h?r.h*o-d:c.clientHeight;let g;if(r.subGrid){g=r.subGrid.getRow()*r.subGrid.getCellHeight(!0);const N=r.subGrid.el.getBoundingClientRect(),C=r.subGrid.el.parentElement.getBoundingClientRect();g+=N.top-C.top}else{if((T=(x=r.subGridOpts)==null?void 0:x.children)!=null&&T.length)return;{const N=c.firstElementChild;if(!N){console.error(`Error: GridStack.resizeToContent() widget id:${r.id} '${Te.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return}g=N.getBoundingClientRect().height||p}}if(p===g)return;u+=g-p;let y=Math.ceil(u/o);const v=Number.isInteger(r.sizeToContent)?r.sizeToContent:0;v&&y>v&&(y=v,t.classList.add("size-to-content-max")),r.minH&&yr.maxH&&(y=r.maxH),y!==r.h&&(i._ignoreLayoutsNodeChange=!0,i.moveNode(r,{h:y}),delete i._ignoreLayoutsNodeChange)}resizeToContentCBCheck(t){Te.resizeToContentCB?Te.resizeToContentCB(t):this.resizeToContent(t)}rotate(t,r){return Te.getElements(t).forEach(i=>{const o=i.gridstackNode;if(!F.canBeRotated(o))return;const u={w:o.h,h:o.w,minH:o.minW,minW:o.minH,maxH:o.maxW,maxW:o.maxH};if(r){const d=r.left>0?Math.floor(r.left/this.cellWidth()):0,p=r.top>0?Math.floor(r.top/this.opts.cellHeight):0;u.x=o.x+d-(o.h-(p+1)),u.y=o.y+p-d}Object.keys(u).forEach(d=>{u[d]===void 0&&delete u[d]});const c=o._orig;this.update(i,u),o._orig=c}),this}margin(t){if(!(typeof t=="string"&&t.split(" ").length>1)){const i=F.parseHeight(t);if(this.opts.marginUnit===i.unit&&this.opts.margin===i.h)return}return this.opts.margin=t,this.opts.marginTop=this.opts.marginBottom=this.opts.marginLeft=this.opts.marginRight=void 0,this._initMargin(),this._updateStyles(!0),this}getMargin(){return this.opts.margin}willItFit(t){if(arguments.length>1){console.warn("gridstack.ts: `willItFit(x,y,w,h,autoPosition)` is deprecated. Use `willItFit({x, y,...})`. It will be removed soon");const r=arguments;let i=0,o={x:r[i++],y:r[i++],w:r[i++],h:r[i++],autoPosition:r[i++]};return this.willItFit(o)}return this.engine.willItFit(t)}_triggerChangeEvent(){if(this.engine.batchMode)return this;const t=this.engine.getDirtyNodes(!0);return t&&t.length&&(this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(t),this._triggerEvent("change",t)),this.engine.saveInitial(),this}_triggerAddEvent(){var t;if(this.engine.batchMode)return this;if((t=this.engine.addedNodes)!=null&&t.length){this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(this.engine.addedNodes),this.engine.addedNodes.forEach(i=>{delete i._dirty});const r=[...this.engine.addedNodes];this.engine.addedNodes=[],this._triggerEvent("added",r)}return this}_triggerRemoveEvent(){var t;if(this.engine.batchMode)return this;if((t=this.engine.removedNodes)!=null&&t.length){const r=[...this.engine.removedNodes];this.engine.removedNodes=[],this._triggerEvent("removed",r)}return this}_triggerEvent(t,r){const i=r?new CustomEvent(t,{bubbles:!1,detail:r}):new Event(t);return this.el.dispatchEvent(i),this}_removeStylesheet(){if(this._styles){const t=this.opts.styleInHead?void 0:this.el.parentNode;F.removeStylesheet(this._styleSheetClass,t),delete this._styles}return this}_updateStyles(t=!1,r){if(t&&this._removeStylesheet(),r===void 0&&(r=this.getRow()),this._updateContainerHeight(),this.opts.cellHeight===0)return this;const i=this.opts.cellHeight,o=this.opts.cellHeightUnit,u=`.${this._styleSheetClass} > .${this.opts.itemClass}`;if(!this._styles){const c=this.opts.styleInHead?void 0:this.el.parentNode;if(this._styles=F.createStylesheet(this._styleSheetClass,c,{nonce:this.opts.nonce}),!this._styles)return this;this._styles._max=0,F.addCSSRule(this._styles,u,`height: ${i}${o}`);const d=this.opts.marginTop+this.opts.marginUnit,p=this.opts.marginBottom+this.opts.marginUnit,g=this.opts.marginRight+this.opts.marginUnit,y=this.opts.marginLeft+this.opts.marginUnit,v=`${u} > .grid-stack-item-content`,x=`.${this._styleSheetClass} > .grid-stack-placeholder > .placeholder-content`;F.addCSSRule(this._styles,v,`top: ${d}; right: ${g}; bottom: ${p}; left: ${y};`),F.addCSSRule(this._styles,x,`top: ${d}; right: ${g}; bottom: ${p}; left: ${y};`),F.addCSSRule(this._styles,`${u} > .ui-resizable-n`,`top: ${d};`),F.addCSSRule(this._styles,`${u} > .ui-resizable-s`,`bottom: ${p}`),F.addCSSRule(this._styles,`${u} > .ui-resizable-ne`,`right: ${g}; top: ${d}`),F.addCSSRule(this._styles,`${u} > .ui-resizable-e`,`right: ${g}`),F.addCSSRule(this._styles,`${u} > .ui-resizable-se`,`right: ${g}; bottom: ${p}`),F.addCSSRule(this._styles,`${u} > .ui-resizable-nw`,`left: ${y}; top: ${d}`),F.addCSSRule(this._styles,`${u} > .ui-resizable-w`,`left: ${y}`),F.addCSSRule(this._styles,`${u} > .ui-resizable-sw`,`left: ${y}; bottom: ${p}`)}if(r=r||this._styles._max,r>this._styles._max){const c=d=>i*d+o;for(let d=this._styles._max+1;d<=r;d++)F.addCSSRule(this._styles,`${u}[gs-y="${d}"]`,`top: ${c(d)}`),F.addCSSRule(this._styles,`${u}[gs-h="${d+1}"]`,`height: ${c(d+1)}`);this._styles._max=r}return this}_updateContainerHeight(){if(!this.engine||this.engine.batchMode)return this;const t=this.parentGridNode;let r=this.getRow()+this._extraDragRow;const i=this.opts.cellHeight,o=this.opts.cellHeightUnit;if(!i)return this;if(!t){const u=F.parseHeight(getComputedStyle(this.el).minHeight);if(u.h>0&&u.unit===o){const c=Math.floor(u.h/i);r1?t.setAttribute("gs-w",String(r.w)):t.removeAttribute("gs-w"),r.h>1?t.setAttribute("gs-h",String(r.h)):t.removeAttribute("gs-h"),this}_writeAttr(t,r){if(!r)return this;this._writePosAttr(t,r);const i={noResize:"gs-no-resize",noMove:"gs-no-move",locked:"gs-locked",id:"gs-id",sizeToContent:"gs-size-to-content"};for(const o in i)r[o]?t.setAttribute(i[o],String(r[o])):t.removeAttribute(i[o]);return this}_readAttr(t,r=!0){const i={};i.x=F.toNumber(t.getAttribute("gs-x")),i.y=F.toNumber(t.getAttribute("gs-y")),i.w=F.toNumber(t.getAttribute("gs-w")),i.h=F.toNumber(t.getAttribute("gs-h")),i.autoPosition=F.toBool(t.getAttribute("gs-auto-position")),i.noResize=F.toBool(t.getAttribute("gs-no-resize")),i.noMove=F.toBool(t.getAttribute("gs-no-move")),i.locked=F.toBool(t.getAttribute("gs-locked"));const o=t.getAttribute("gs-size-to-content");o&&(o==="true"||o==="false"?i.sizeToContent=F.toBool(o):i.sizeToContent=parseInt(o,10)),i.id=t.getAttribute("gs-id"),i.maxW=F.toNumber(t.getAttribute("gs-max-w")),i.minW=F.toNumber(t.getAttribute("gs-min-w")),i.maxH=F.toNumber(t.getAttribute("gs-max-h")),i.minH=F.toNumber(t.getAttribute("gs-min-h")),r&&(i.w===1&&t.removeAttribute("gs-w"),i.h===1&&t.removeAttribute("gs-h"),i.maxW&&t.removeAttribute("gs-max-w"),i.minW&&t.removeAttribute("gs-min-w"),i.maxH&&t.removeAttribute("gs-max-h"),i.minH&&t.removeAttribute("gs-min-h"));for(const u in i){if(!i.hasOwnProperty(u))return;!i[u]&&i[u]!==0&&u!=="gs-size-to-content"&&delete i[u]}return i}_setStaticClass(){const t=["grid-stack-static"];return this.opts.staticGrid?(this.el.classList.add(...t),this.el.setAttribute("gs-static","true")):(this.el.classList.remove(...t),this.el.removeAttribute("gs-static")),this}onResize(t=(r=>(r=this.el)==null?void 0:r.clientWidth)()){if(!t||this.prevWidth===t)return;this.prevWidth=t,this.batchUpdate();let i=!1;return this._autoColumn&&this.parentGridNode?this.opts.column!==this.parentGridNode.w&&(this.column(this.parentGridNode.w,this.opts.layout||"list"),i=!0):i=this.checkDynamicColumn(),this._isAutoCellHeight&&this.cellHeight(),this.engine.nodes.forEach(o=>{o.subGrid&&o.subGrid.onResize()}),this._skipInitialResize||this.resizeToContentCheck(i),delete this._skipInitialResize,this.batchUpdate(!1),this}resizeToContentCheck(t=!1,r=void 0){if(this.engine){if(t&&this.hasAnimationCSS())return setTimeout(()=>this.resizeToContentCheck(!1,r),this.animationDelay);if(r)F.shouldSizeToContent(r)&&this.resizeToContentCBCheck(r.el);else if(this.engine.nodes.some(i=>F.shouldSizeToContent(i))){const i=[...this.engine.nodes];this.batchUpdate(),i.forEach(o=>{F.shouldSizeToContent(o)&&this.resizeToContentCBCheck(o.el)}),this.batchUpdate(!1)}this._gsEventHandler.resizecontent&&this._gsEventHandler.resizecontent(null,r?[r]:this.engine.nodes)}}_updateResizeEvent(t=!1){const r=!this.parentGridNode&&(this._isAutoCellHeight||this.opts.sizeToContent||this.opts.columnOpts||this.engine.nodes.find(i=>i.sizeToContent));return!t&&r&&!this.resizeObserver?(this._sizeThrottle=F.throttle(()=>this.onResize(),this.opts.cellHeightThrottle),this.resizeObserver=new ResizeObserver(()=>this._sizeThrottle()),this.resizeObserver.observe(this.el),this._skipInitialResize=!0):(t||!r)&&this.resizeObserver&&(this.resizeObserver.disconnect(),delete this.resizeObserver,delete this._sizeThrottle),this}static getElement(t=".grid-stack-item"){return F.getElement(t)}static getElements(t=".grid-stack-item"){return F.getElements(t)}static getGridElement(t){return Te.getElement(t)}static getGridElements(t){return F.getElements(t)}_initMargin(){let t,r=0,i=[];return typeof this.opts.margin=="string"&&(i=this.opts.margin.split(" ")),i.length===2?(this.opts.marginTop=this.opts.marginBottom=i[0],this.opts.marginLeft=this.opts.marginRight=i[1]):i.length===4?(this.opts.marginTop=i[0],this.opts.marginRight=i[1],this.opts.marginBottom=i[2],this.opts.marginLeft=i[3]):(t=F.parseHeight(this.opts.margin),this.opts.marginUnit=t.unit,r=this.opts.margin=t.h),this.opts.marginTop===void 0?this.opts.marginTop=r:(t=F.parseHeight(this.opts.marginTop),this.opts.marginTop=t.h,delete this.opts.margin),this.opts.marginBottom===void 0?this.opts.marginBottom=r:(t=F.parseHeight(this.opts.marginBottom),this.opts.marginBottom=t.h,delete this.opts.margin),this.opts.marginRight===void 0?this.opts.marginRight=r:(t=F.parseHeight(this.opts.marginRight),this.opts.marginRight=t.h,delete this.opts.margin),this.opts.marginLeft===void 0?this.opts.marginLeft=r:(t=F.parseHeight(this.opts.marginLeft),this.opts.marginLeft=t.h,delete this.opts.margin),this.opts.marginUnit=t.unit,this.opts.marginTop===this.opts.marginBottom&&this.opts.marginLeft===this.opts.marginRight&&this.opts.marginTop===this.opts.marginRight&&(this.opts.margin=this.opts.marginTop),this}static getDD(){return Gn}static setupDragIn(t,r,i,o=document){(r==null?void 0:r.pause)!==void 0&&(Le.pauseDrag=r.pause),r={appendTo:"body",helper:"clone",...r||{}},(typeof t=="string"?F.getElements(t,o):t).forEach((c,d)=>{Gn.isDraggable(c)||Gn.dragIn(c,r),i!=null&&i[d]&&(c.gridstackNode=i[d])})}movable(t,r){return this.opts.staticGrid?this:(Te.getElements(t).forEach(i=>{const o=i.gridstackNode;o&&(r?delete o.noMove:o.noMove=!0,this.prepareDragDrop(o.el))}),this)}resizable(t,r){return this.opts.staticGrid?this:(Te.getElements(t).forEach(i=>{const o=i.gridstackNode;o&&(r?delete o.noResize:o.noResize=!0,this.prepareDragDrop(o.el))}),this)}disable(t=!0){if(!this.opts.staticGrid)return this.enableMove(!1,t),this.enableResize(!1,t),this._triggerEvent("disable"),this}enable(t=!0){if(!this.opts.staticGrid)return this.enableMove(!0,t),this.enableResize(!0,t),this._triggerEvent("enable"),this}enableMove(t,r=!0){return this.opts.staticGrid?this:(t?delete this.opts.disableDrag:this.opts.disableDrag=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&r&&i.subGrid.enableMove(t,r)}),this)}enableResize(t,r=!0){return this.opts.staticGrid?this:(t?delete this.opts.disableResize:this.opts.disableResize=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&r&&i.subGrid.enableResize(t,r)}),this)}cancelDrag(){var r;const t=(r=this._placeholder)==null?void 0:r.gridstackNode;t&&(t._isExternal?(t._isAboutToRemove=!0,this.engine.removeNode(t)):t._isAboutToRemove&&Te._itemRemoving(t.el,!1),this.engine.restoreInitial())}_removeDD(t){return Gn.draggable(t,"destroy").resizable(t,"destroy"),t.gridstackNode&&delete t.gridstackNode._initDD,delete t.ddElement,this}_setupAcceptWidget(){if(this.opts.staticGrid||!this.opts.acceptWidgets&&!this.opts.removable)return Gn.droppable(this.el,"destroy"),this;let t,r;const i=(o,u,c)=>{var x;c=c||u;const d=c.gridstackNode;if(!d)return;if(!((x=d.grid)!=null&&x.el)){c.style.transform=`scale(${1/this.dragTransform.xScale},${1/this.dragTransform.yScale})`;const T=c.getBoundingClientRect();c.style.left=T.x+(this.dragTransform.xScale-1)*(o.clientX-T.x)/this.dragTransform.xScale+"px",c.style.top=T.y+(this.dragTransform.yScale-1)*(o.clientY-T.y)/this.dragTransform.yScale+"px",c.style.transformOrigin="0px 0px"}let{top:p,left:g}=c.getBoundingClientRect();const y=this.el.getBoundingClientRect();g-=y.left,p-=y.top;const v={position:{top:p*this.dragTransform.xScale,left:g*this.dragTransform.yScale}};if(d._temporaryRemoved){if(d.x=Math.max(0,Math.round(g/r)),d.y=Math.max(0,Math.round(p/t)),delete d.autoPosition,this.engine.nodeBoundFix(d),!this.engine.willItFit(d)){if(d.autoPosition=!0,!this.engine.willItFit(d)){Gn.off(u,"drag");return}d._willFitPos&&(F.copyPos(d,d._willFitPos),delete d._willFitPos)}this._onStartMoving(c,o,v,d,r,t)}else this._dragOrResize(c,o,v,d,r,t)};return Gn.droppable(this.el,{accept:o=>{const u=o.gridstackNode||this._readAttr(o,!1);if((u==null?void 0:u.grid)===this)return!0;if(!this.opts.acceptWidgets)return!1;let c=!0;if(typeof this.opts.acceptWidgets=="function")c=this.opts.acceptWidgets(o);else{const d=this.opts.acceptWidgets===!0?".grid-stack-item":this.opts.acceptWidgets;c=o.matches(d)}if(c&&u&&this.opts.maxRow){const d={w:u.w,h:u.h,minW:u.minW,minH:u.minH};c=this.engine.willItFit(d)}return c}}).on(this.el,"dropover",(o,u,c)=>{let d=(c==null?void 0:c.gridstackNode)||u.gridstackNode;if((d==null?void 0:d.grid)===this&&!d._temporaryRemoved)return!1;if(d!=null&&d._sidebarOrig&&(d.w=d._sidebarOrig.w,d.h=d._sidebarOrig.h),d!=null&&d.grid&&d.grid!==this&&!d._temporaryRemoved&&d.grid._leave(u,c),c=c||u,r=this.cellWidth(),t=this.getCellHeight(!0),!d){const y=c.getAttribute("data-gs-widget")||c.getAttribute("gridstacknode");if(y){try{d=JSON.parse(y)}catch{console.error("Gridstack dropover: Bad JSON format: ",y)}c.removeAttribute("data-gs-widget"),c.removeAttribute("gridstacknode")}d||(d=this._readAttr(c)),d._sidebarOrig={w:d.w,h:d.h}}d.grid||(d.el||(d={...d}),d._isExternal=!0,c.gridstackNode=d);const p=d.w||Math.round(c.offsetWidth/r)||1,g=d.h||Math.round(c.offsetHeight/t)||1;return d.grid&&d.grid!==this?(u._gridstackNodeOrig||(u._gridstackNodeOrig=d),u.gridstackNode=d={...d,w:p,h:g,grid:this},delete d.x,delete d.y,this.engine.cleanupNode(d).nodeBoundFix(d),d._initDD=d._isExternal=d._temporaryRemoved=!0):(d.w=p,d.h=g,d._temporaryRemoved=!0),Te._itemRemoving(d.el,!1),Gn.on(u,"drag",i),i(o,u,c),!1}).on(this.el,"dropout",(o,u,c)=>{const d=(c==null?void 0:c.gridstackNode)||u.gridstackNode;return d&&(!d.grid||d.grid===this)&&(this._leave(u,c),this._isTemp&&this.removeAsSubGrid(d)),!1}).on(this.el,"drop",(o,u,c)=>{var T,N,C;const d=(c==null?void 0:c.gridstackNode)||u.gridstackNode;if((d==null?void 0:d.grid)===this&&!d._isExternal)return!1;const p=!!this.placeholder.parentElement,g=u!==c;this.placeholder.remove(),delete this.placeholder.gridstackNode;const y=p&&this.opts.animate;y&&this.setAnimation(!1);const v=u._gridstackNodeOrig;if(delete u._gridstackNodeOrig,p&&(v!=null&&v.grid)&&v.grid!==this){const L=v.grid;L.engine.removeNodeFromLayoutCache(v),L.engine.removedNodes.push(v),L._triggerRemoveEvent()._triggerChangeEvent(),L.parentGridNode&&!L.engine.nodes.length&&L.opts.subGridDynamic&&L.removeAsSubGrid()}if(!d||(p&&(this.engine.cleanupNode(d),d.grid=this),(T=d.grid)==null||delete T._isTemp,Gn.off(u,"drag"),c!==u?(c.remove(),u=c):u.remove(),this._removeDD(u),!p))return!1;const x=(C=(N=d.subGrid)==null?void 0:N.el)==null?void 0:C.gridstack;return F.copyPos(d,this._readAttr(this.placeholder)),F.removePositioningStyles(u),g&&(d.content||d.subGridOpts||Te.addRemoveCB)?(delete d.el,u=this.addWidget(d)):(this._prepareElement(u,!0,d),this.el.appendChild(u),this.resizeToContentCheck(!1,d),x&&(x.parentGridNode=d,x.opts.styleInHead||x._updateStyles(!0)),this._updateContainerHeight()),this.engine.addedNodes.push(d),this._triggerAddEvent(),this._triggerChangeEvent(),this.engine.endUpdate(),this._gsEventHandler.dropped&&this._gsEventHandler.dropped({...o,type:"dropped"},v&&v.grid?v:void 0,d),y&&this.setAnimation(this.opts.animate,!0),!1}),this}static _itemRemoving(t,r){if(!t)return;const i=t?t.gridstackNode:void 0;!(i!=null&&i.grid)||t.classList.contains(i.grid.opts.removableOptions.decline)||(r?i._isAboutToRemove=!0:delete i._isAboutToRemove,r?t.classList.add("grid-stack-item-removing"):t.classList.remove("grid-stack-item-removing"))}_setupRemoveDrop(){if(typeof this.opts.removable!="string")return this;const t=document.querySelector(this.opts.removable);return t?(!this.opts.staticGrid&&!Gn.isDroppable(t)&&Gn.droppable(t,this.opts.removableOptions).on(t,"dropover",(r,i)=>Te._itemRemoving(i,!0)).on(t,"dropout",(r,i)=>Te._itemRemoving(i,!1)),this):this}prepareDragDrop(t,r=!1){const i=t==null?void 0:t.gridstackNode;if(!i)return;const o=i.noMove||this.opts.disableDrag,u=i.noResize||this.opts.disableResize,c=this.opts.staticGrid||o&&u;if((r||c)&&(i._initDD&&(this._removeDD(t),delete i._initDD),c&&t.classList.add("ui-draggable-disabled","ui-resizable-disabled"),!r))return this;if(!i._initDD){let d,p;const g=(x,T)=>{this._gsEventHandler[x.type]&&this._gsEventHandler[x.type](x,x.target),d=this.cellWidth(),p=this.getCellHeight(!0),this._onStartMoving(t,x,T,i,d,p)},y=(x,T)=>{this._dragOrResize(t,x,T,i,d,p)},v=x=>{this.placeholder.remove(),delete this.placeholder.gridstackNode,delete i._moving,delete i._event,delete i._lastTried;const T=i.w!==i._orig.w,N=x.target;if(!(!N.gridstackNode||N.gridstackNode.grid!==this)){if(i.el=N,i._isAboutToRemove){const C=t.gridstackNode.grid;C._gsEventHandler[x.type]&&C._gsEventHandler[x.type](x,N),C.engine.nodes.push(i),C.removeWidget(t,!0,!0)}else F.removePositioningStyles(N),i._temporaryRemoved?(F.copyPos(i,i._orig),this._writePosAttr(N,i),this.engine.addNode(i)):this._writePosAttr(N,i),this._gsEventHandler[x.type]&&this._gsEventHandler[x.type](x,N);this._extraDragRow=0,this._updateContainerHeight(),this._triggerChangeEvent(),this.engine.endUpdate(),x.type==="resizestop"&&(Number.isInteger(i.sizeToContent)&&(i.sizeToContent=i.h),this.resizeToContentCheck(T,i))}};Gn.draggable(t,{start:g,stop:v,drag:y}).resizable(t,{start:g,stop:v,resize:y}),i._initDD=!0}return Gn.draggable(t,o?"disable":"enable").resizable(t,u?"disable":"enable"),this}_onStartMoving(t,r,i,o,u,c){var d;if(this.engine.cleanNodes().beginUpdate(o),this._writePosAttr(this.placeholder,o),this.el.appendChild(this.placeholder),this.placeholder.gridstackNode=o,(d=o.grid)!=null&&d.el)this.dragTransform=F.getValuesFromTransformedElement(t);else if(this.placeholder&&this.placeholder.closest(".grid-stack")){const p=this.placeholder.closest(".grid-stack");this.dragTransform=F.getValuesFromTransformedElement(p)}else this.dragTransform={xScale:1,xOffset:0,yScale:1,yOffset:0};if(o.el=this.placeholder,o._lastUiPosition=i.position,o._prevYPix=i.position.top,o._moving=r.type==="dragstart",delete o._lastTried,r.type==="dropover"&&o._temporaryRemoved&&(this.engine.addNode(o),o._moving=!0),this.engine.cacheRects(u,c,this.opts.marginTop,this.opts.marginRight,this.opts.marginBottom,this.opts.marginLeft),r.type==="resizestart"){const p=this.getColumn()-o.x,g=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-o.y;Gn.resizable(t,"option","minWidth",u*Math.min(o.minW||1,p)).resizable(t,"option","minHeight",c*Math.min(o.minH||1,g)).resizable(t,"option","maxWidth",u*Math.min(o.maxW||Number.MAX_SAFE_INTEGER,p)).resizable(t,"option","maxWidthMoveLeft",u*Math.min(o.maxW||Number.MAX_SAFE_INTEGER,o.x+o.w)).resizable(t,"option","maxHeight",c*Math.min(o.maxH||Number.MAX_SAFE_INTEGER,g)).resizable(t,"option","maxHeightMoveUp",c*Math.min(o.maxH||Number.MAX_SAFE_INTEGER,o.y+o.h))}}_dragOrResize(t,r,i,o,u,c){const d={...o._orig};let p,g=this.opts.marginLeft,y=this.opts.marginRight,v=this.opts.marginTop,x=this.opts.marginBottom;const T=Math.round(c*.1),N=Math.round(u*.1);if(g=Math.min(g,N),y=Math.min(y,N),v=Math.min(v,T),x=Math.min(x,T),r.type==="drag"){if(o._temporaryRemoved)return;const L=i.position.top-o._prevYPix;o._prevYPix=i.position.top,this.opts.draggable.scroll!==!1&&F.updateScrollPosition(t,i.position,L);const U=i.position.left+(i.position.left>o._lastUiPosition.left?-y:g),A=i.position.top+(i.position.top>o._lastUiPosition.top?-x:v);d.x=Math.round(U/u),d.y=Math.round(A/c);const V=this._extraDragRow;if(this.engine.collide(o,d)){const z=this.getRow();let $=Math.max(0,d.y+o.h-z);this.opts.maxRow&&z+$>this.opts.maxRow&&($=Math.max(0,this.opts.maxRow-z)),this._extraDragRow=$}else this._extraDragRow=0;if(this._extraDragRow!==V&&this._updateContainerHeight(),o.x===d.x&&o.y===d.y)return}else if(r.type==="resize"){if(d.x<0||(F.updateScrollResize(r,t,c),d.w=Math.round((i.size.width-g)/u),d.h=Math.round((i.size.height-v)/c),o.w===d.w&&o.h===d.h)||o._lastTried&&o._lastTried.w===d.w&&o._lastTried.h===d.h)return;const L=i.position.left+g,U=i.position.top+v;d.x=Math.round(L/u),d.y=Math.round(U/c),p=!0}o._event=r,o._lastTried=d;const C={x:i.position.left+g,y:i.position.top+v,w:(i.size?i.size.width:o.w*u)-g-y,h:(i.size?i.size.height:o.h*c)-v-x};if(this.engine.moveNodeCheck(o,{...d,cellWidth:u,cellHeight:c,rect:C,resizing:p})){o._lastUiPosition=i.position,this.engine.cacheRects(u,c,v,y,x,g),delete o._skipDown,p&&o.subGrid&&o.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();const L=r.target;o._sidebarOrig||this._writePosAttr(L,o),this._gsEventHandler[r.type]&&this._gsEventHandler[r.type](r,L)}}_leave(t,r){r=r||t;const i=r.gridstackNode;if(!i||(r.style.transform=r.style.transformOrigin=null,Gn.off(t,"drag"),i._temporaryRemoved))return;i._temporaryRemoved=!0,this.engine.removeNode(i),i.el=i._isExternal&&r?r:t;const o=i._sidebarOrig;i._isExternal&&this.engine.cleanupNode(i),i._sidebarOrig=o,this.opts.removable===!0&&Te._itemRemoving(t,!0),t._gridstackNodeOrig?(t.gridstackNode=t._gridstackNodeOrig,delete t._gridstackNodeOrig):i._isExternal&&this.engine.restoreInitial()}commit(){return OS(this,this.batchUpdate(!1),"commit","batchUpdate","5.2"),this}}Te.renderCB=(l,t)=>{l&&(t!=null&&t.content)&&(l.textContent=t.content)};Te.resizeToContentParent=".grid-stack-item-content";Te.Utils=F;Te.Engine=ci;Te.GDRev="11.5.1";function jS({widget:l,onRemove:t}){const r=RS[l.kind];return R.jsxs("div",{className:"widget",children:[R.jsxs("div",{className:"widget-header",children:[R.jsx("span",{className:"widget-grip","aria-hidden":!0,children:"⠿"}),R.jsx("span",{className:"widget-icon",children:r==null?void 0:r.icon}),R.jsx("span",{className:"widget-title",children:(r==null?void 0:r.title)||l.kind}),R.jsx("button",{className:"widget-close",title:"Remove widget",onClick:t,children:"×"})]}),R.jsx("div",{className:"widget-body",children:r?r.render(l.id):null})]})}function IS(){const l=Ro(y=>y.widgets),t=Ro(y=>y.updateGeom),r=Ro(y=>y.removeWidget),i=P.useRef(null),o=P.useRef(null),u=P.useRef(new Map),[c,d]=P.useState(new Map),[p,g]=P.useState(!1);return P.useEffect(()=>{if(!i.current)return;const y=Te.init({column:12,cellHeight:56,margin:8,float:!0,handle:".widget-header",resizable:{handles:"e, se, s, sw, w"},animate:!0},i.current);return o.current=y,y.on("change",(v,x)=>{const T=x.map(N=>({id:String(N.id),x:N.x??0,y:N.y??0,w:N.w??1,h:N.h??1}));T.length&&t(T)}),g(!0),()=>{y.destroy(!1),o.current=null}},[t]),P.useEffect(()=>{const y=o.current;if(!y||!p)return;const v=new Set(l.map(N=>N.id));let x=!1;const T=new Map(c);y.batchUpdate();for(const N of l){if(u.current.has(N.id))continue;const C=y.addWidget({x:N.x,y:N.y,w:N.w,h:N.h,id:N.id}),L=C.querySelector(".grid-stack-item-content");u.current.set(N.id,C),T.set(N.id,L),x=!0}for(const[N,C]of Array.from(u.current.entries()))v.has(N)||(y.removeWidget(C,!0),u.current.delete(N),T.delete(N),x=!0);y.commit(),x&&d(T)},[l,p]),R.jsxs("div",{className:"canvas",children:[R.jsx("div",{className:"grid-stack",ref:i}),l.map(y=>{const v=c.get(y.id);return v?Ps.createPortal(R.jsx(jS,{widget:y,onRemove:()=>r(y.id)}),v,y.id):null})]})}function FS(){const l=We(y=>y.addSignalToPlot),t=We(y=>y.setMotorTypes),r=We(y=>y.setMode),i=We(y=>y.setStatus),o=We(y=>y.setRegisterTable),[u,c]=P.useState(null),d=dy(fy(Kf,{activationConstraint:{distance:4}}));P.useEffect(()=>{Bg(),$1().then(t),Cn.status().then(y=>{y!=null&&y.mode&&r(y.mode),i(y)}),Cn.registerTable().then(y=>{if(y!=null&&y.registers){const v={};for(const x of y.registers)v[x.rid]=x;o(v)}})},[t,r,i,o]);const p=y=>{var x;const v=(x=y.active.data.current)==null?void 0:x.signalId;c(v?Ff(v):null)},g=y=>{var T,N,C,L;c(null);const v=(T=y.active.data.current)==null?void 0:T.signalId,x=((C=(N=y.over)==null?void 0:N.id)==null?void 0:C.toString())||"";if(v&&x.startsWith("plot:")){const U=(L=y.over.data.current)==null?void 0:L.panelId;l(U,v)}};return R.jsxs(u0,{sensors:d,onDragStart:p,onDragEnd:g,children:[R.jsxs("div",{className:"app",children:[R.jsx(TS,{}),R.jsxs("div",{className:"body",children:[R.jsx(zS,{}),R.jsx("main",{className:"canvas-host",children:R.jsx(IS,{})})]})]}),R.jsx(T0,{dropAnimation:null,children:u?R.jsx("div",{className:"drag-ghost",children:u}):null})]})}bS();Xv.createRoot(document.getElementById("root")).render(R.jsx(pt.StrictMode,{children:R.jsx(FS,{})})); diff --git a/damiao_motor/gui/webapp/dist/assets/index-CSlWWdCi.js b/damiao_motor/gui/webapp/dist/assets/index-CSlWWdCi.js deleted file mode 100644 index d5f6e4c..0000000 --- a/damiao_motor/gui/webapp/dist/assets/index-CSlWWdCi.js +++ /dev/null @@ -1,54 +0,0 @@ -var Pv=Object.defineProperty;var Av=(l,t,r)=>t in l?Pv(l,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[t]=r;var fo=(l,t,r)=>Av(l,typeof t!="symbol"?t+"":t,r);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const u of o)if(u.type==="childList")for(const c of u.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&i(c)}).observe(document,{childList:!0,subtree:!0});function r(o){const u={};return o.integrity&&(u.integrity=o.integrity),o.referrerPolicy&&(u.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?u.credentials="include":o.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function i(o){if(o.ep)return;o.ep=!0;const u=r(o);fetch(o.href,u)}})();function Cg(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var Jc={exports:{}},ho={},Zc={exports:{}},Be={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var np;function Iv(){if(np)return Be;np=1;var l=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),v=Symbol.iterator;function x(D){return D===null||typeof D!="object"?null:(D=v&&D[v]||D["@@iterator"],typeof D=="function"?D:null)}var z={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},R=Object.assign,k={};function b(D,H,K){this.props=D,this.context=H,this.refs=k,this.updater=K||z}b.prototype.isReactComponent={},b.prototype.setState=function(D,H){if(typeof D!="object"&&typeof D!="function"&&D!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,D,H,"setState")},b.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function W(){}W.prototype=b.prototype;function P(D,H,K){this.props=D,this.context=H,this.refs=k,this.updater=K||z}var B=P.prototype=new W;B.constructor=P,R(B,b.prototype),B.isPureReactComponent=!0;var V=Array.isArray,ee=Object.prototype.hasOwnProperty,G={current:null},Z={key:!0,ref:!0,__self:!0,__source:!0};function re(D,H,K){var xe,be={},ge=null,_e=null;if(H!=null)for(xe in H.ref!==void 0&&(_e=H.ref),H.key!==void 0&&(ge=""+H.key),H)ee.call(H,xe)&&!Z.hasOwnProperty(xe)&&(be[xe]=H[xe]);var He=arguments.length-2;if(He===1)be.children=K;else if(1>>1,H=ie[D];if(0>>1;Do(be,X))geo(_e,be)?(ie[D]=_e,ie[ge]=X,D=ge):(ie[D]=be,ie[xe]=X,D=xe);else if(geo(_e,X))ie[D]=_e,ie[ge]=X,D=ge;else break e}}return oe}function o(ie,oe){var X=ie.sortIndex-oe.sortIndex;return X!==0?X:ie.id-oe.id}if(typeof performance=="object"&&typeof performance.now=="function"){var u=performance;l.unstable_now=function(){return u.now()}}else{var c=Date,d=c.now();l.unstable_now=function(){return c.now()-d}}var p=[],m=[],w=1,v=null,x=3,z=!1,R=!1,k=!1,b=typeof setTimeout=="function"?setTimeout:null,W=typeof clearTimeout=="function"?clearTimeout:null,P=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function B(ie){for(var oe=r(m);oe!==null;){if(oe.callback===null)i(m);else if(oe.startTime<=ie)i(m),oe.sortIndex=oe.expirationTime,t(p,oe);else break;oe=r(m)}}function V(ie){if(k=!1,B(ie),!R)if(r(p)!==null)R=!0,De(ee);else{var oe=r(m);oe!==null&&le(V,oe.startTime-ie)}}function ee(ie,oe){R=!1,k&&(k=!1,W(re),re=-1),z=!0;var X=x;try{for(B(oe),v=r(p);v!==null&&(!(v.expirationTime>oe)||ie&&!Y());){var D=v.callback;if(typeof D=="function"){v.callback=null,x=v.priorityLevel;var H=D(v.expirationTime<=oe);oe=l.unstable_now(),typeof H=="function"?v.callback=H:v===r(p)&&i(p),B(oe)}else i(p);v=r(p)}if(v!==null)var K=!0;else{var xe=r(m);xe!==null&&le(V,xe.startTime-oe),K=!1}return K}finally{v=null,x=X,z=!1}}var G=!1,Z=null,re=-1,ve=5,de=-1;function Y(){return!(l.unstable_now()-deie||125D?(ie.sortIndex=X,t(m,ie),r(p)===null&&ie===r(m)&&(k?(W(re),re=-1):k=!0,le(V,X-D))):(ie.sortIndex=H,t(p,ie),R||z||(R=!0,De(ee))),ie},l.unstable_shouldYield=Y,l.unstable_wrapCallback=function(ie){var oe=x;return function(){var X=x;x=oe;try{return ie.apply(this,arguments)}finally{x=X}}}})(nf)),nf}var op;function Wv(){return op||(op=1,tf.exports=jv()),tf.exports}/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var ap;function Bv(){if(ap)return ir;ap=1;var l=If(),t=Wv();function r(e){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+e,s=1;s"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),p=Object.prototype.hasOwnProperty,m=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,w={},v={};function x(e){return p.call(v,e)?!0:p.call(w,e)?!1:m.test(e)?v[e]=!0:(w[e]=!0,!1)}function z(e,n,s,a){if(s!==null&&s.type===0)return!1;switch(typeof n){case"function":case"symbol":return!0;case"boolean":return a?!1:s!==null?!s.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function R(e,n,s,a){if(n===null||typeof n>"u"||z(e,n,s,a))return!0;if(a)return!1;if(s!==null)switch(s.type){case 3:return!n;case 4:return n===!1;case 5:return isNaN(n);case 6:return isNaN(n)||1>n}return!1}function k(e,n,s,a,f,h,y){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=a,this.attributeNamespace=f,this.mustUseProperty=s,this.propertyName=e,this.type=n,this.sanitizeURL=h,this.removeEmptyString=y}var b={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){b[e]=new k(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var n=e[0];b[n]=new k(n,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){b[e]=new k(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){b[e]=new k(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){b[e]=new k(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){b[e]=new k(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){b[e]=new k(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){b[e]=new k(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){b[e]=new k(e,5,!1,e.toLowerCase(),null,!1,!1)});var W=/[\-:]([a-z])/g;function P(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var n=e.replace(W,P);b[n]=new k(n,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var n=e.replace(W,P);b[n]=new k(n,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var n=e.replace(W,P);b[n]=new k(n,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){b[e]=new k(e,1,!1,e.toLowerCase(),null,!1,!1)}),b.xlinkHref=new k("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){b[e]=new k(e,1,!1,e.toLowerCase(),null,!0,!0)});function B(e,n,s,a){var f=b.hasOwnProperty(n)?b[n]:null;(f!==null?f.type!==0:a||!(2C||f[y]!==h[C]){var N=` -`+f[y].replace(" at new "," at ");return e.displayName&&N.includes("")&&(N=N.replace("",e.displayName)),N}while(1<=y&&0<=C);break}}}finally{K=!1,Error.prepareStackTrace=s}return(e=e?e.displayName||e.name:"")?H(e):""}function be(e){switch(e.tag){case 5:return H(e.type);case 16:return H("Lazy");case 13:return H("Suspense");case 19:return H("SuspenseList");case 0:case 2:case 15:return e=xe(e.type,!1),e;case 11:return e=xe(e.type.render,!1),e;case 1:return e=xe(e.type,!0),e;default:return""}}function ge(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Z:return"Fragment";case G:return"Portal";case ve:return"Profiler";case re:return"StrictMode";case ae:return"Suspense";case ye:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Y:return(e.displayName||"Context")+".Consumer";case de:return(e._context.displayName||"Context")+".Provider";case Ce:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case me:return n=e.displayName||null,n!==null?n:ge(e.type)||"Memo";case De:n=e._payload,e=e._init;try{return ge(e(n))}catch{}}return null}function _e(e){var n=e.type;switch(e.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=n.render,e=e.displayName||e.name||"",n.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ge(n);case 8:return n===re?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function He(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Fe(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Oe(e){var n=Fe(e)?"checked":"value",s=Object.getOwnPropertyDescriptor(e.constructor.prototype,n),a=""+e[n];if(!e.hasOwnProperty(n)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var f=s.get,h=s.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return f.call(this)},set:function(y){a=""+y,h.call(this,y)}}),Object.defineProperty(e,n,{enumerable:s.enumerable}),{getValue:function(){return a},setValue:function(y){a=""+y},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function $t(e){e._valueTracker||(e._valueTracker=Oe(e))}function Pt(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var s=n.getValue(),a="";return e&&(a=Fe(e)?e.checked?"true":"false":e.value),e=a,e!==s?(n.setValue(e),!0):!1}function At(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function It(e,n){var s=n.checked;return X({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:s??e._wrapperState.initialChecked})}function Kn(e,n){var s=n.defaultValue==null?"":n.defaultValue,a=n.checked!=null?n.checked:n.defaultChecked;s=He(n.value!=null?n.value:s),e._wrapperState={initialChecked:a,initialValue:s,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function Cn(e,n){n=n.checked,n!=null&&B(e,"checked",n,!1)}function _r(e,n){Cn(e,n);var s=He(n.value),a=n.type;if(s!=null)a==="number"?(s===0&&e.value===""||e.value!=s)&&(e.value=""+s):e.value!==""+s&&(e.value=""+s);else if(a==="submit"||a==="reset"){e.removeAttribute("value");return}n.hasOwnProperty("value")?Pn(e,n.type,s):n.hasOwnProperty("defaultValue")&&Pn(e,n.type,He(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(e.defaultChecked=!!n.defaultChecked)}function Xr(e,n,s){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var a=n.type;if(!(a!=="submit"&&a!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+e._wrapperState.initialValue,s||n===e.value||(e.value=n),e.defaultValue=n}s=e.name,s!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,s!==""&&(e.name=s)}function Pn(e,n,s){(n!=="number"||At(e.ownerDocument)!==e)&&(s==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+s&&(e.defaultValue=""+s))}var Ze=Array.isArray;function nn(e,n,s,a){if(e=e.options,n){n={};for(var f=0;f"+n.valueOf().toString()+"",n=sn.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;n.firstChild;)e.appendChild(n.firstChild)}});function Gt(e,n){if(n){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=n;return}}e.textContent=n}var Rt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ln=["Webkit","ms","Moz","O"];Object.keys(Rt).forEach(function(e){ln.forEach(function(n){n=n+e.charAt(0).toUpperCase()+e.substring(1),Rt[n]=Rt[e]})});function mn(e,n,s){return n==null||typeof n=="boolean"||n===""?"":s||typeof n!="number"||n===0||Rt.hasOwnProperty(e)&&Rt[e]?(""+n).trim():n+"px"}function Yt(e,n){e=e.style;for(var s in n)if(n.hasOwnProperty(s)){var a=s.indexOf("--")===0,f=mn(s,n[s],a);s==="float"&&(s="cssFloat"),a?e.setProperty(s,f):e[s]=f}}var vn=X({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function qr(e,n){if(n){if(vn[e]&&(n.children!=null||n.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(n.dangerouslySetInnerHTML!=null){if(n.children!=null)throw Error(r(60));if(typeof n.dangerouslySetInnerHTML!="object"||!("__html"in n.dangerouslySetInnerHTML))throw Error(r(61))}if(n.style!=null&&typeof n.style!="object")throw Error(r(62))}}function Jr(e,n){if(e.indexOf("-")===-1)return typeof n.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var lr=null;function or(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Zr=null,zt=null,lt=null;function Kt(e){if(e=Xl(e)){if(typeof Zr!="function")throw Error(r(280));var n=e.stateNode;n&&(n=aa(n),Zr(e.stateNode,e.type,n))}}function on(e){zt?lt?lt.push(e):lt=[e]:zt=e}function ar(){if(zt){var e=zt,n=lt;if(lt=zt=null,Kt(e),n)for(e=0;e>>=0,e===0?32:31-(Ll(e)/Nn|0)|0}var os=64,Ti=4194304;function zi(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Fs(e,n){var s=e.pendingLanes;if(s===0)return 0;var a=0,f=e.suspendedLanes,h=e.pingedLanes,y=s&268435455;if(y!==0){var C=y&~f;C!==0?a=zi(C):(h&=y,h!==0&&(a=zi(h)))}else y=s&~f,y!==0?a=zi(y):h!==0&&(a=zi(h));if(a===0)return 0;if(n!==0&&n!==a&&(n&f)===0&&(f=a&-a,h=n&-n,f>=h||f===16&&(h&4194240)!==0))return n;if((a&4)!==0&&(a|=s&16),n=e.entangledLanes,n!==0)for(e=e.entanglements,n&=a;0s;s++)n.push(e);return n}function Mi(e,n,s){e.pendingLanes|=n,n!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,n=31-In(n),e[n]=s}function Il(e,n){var s=e.pendingLanes&~n;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=n,e.mutableReadLanes&=n,e.entangledLanes&=n,n=e.entanglements;var a=e.eventTimes;for(e=e.expirationTimes;0=pi),ta=" ",Qs=!1;function g(e,n){switch(e){case"keyup":return Dt.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function S(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var _=!1;function E(e,n){switch(e){case"compositionend":return S(n);case"keypress":return n.which!==32?null:(Qs=!0,ta);case"textInput":return e=n.data,e===ta&&Qs?null:e;default:return null}}function T(e,n){if(_)return e==="compositionend"||!Ks&&g(e,n)?(e=dr(),fr=Wl=cr=null,_=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1=n)return{node:s,offset:n-e};e=a}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=Jn(s)}}function Tn(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Tn(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Wn(){for(var e=window,n=At();n instanceof e.HTMLIFrameElement;){try{var s=typeof n.contentWindow.location.href=="string"}catch{s=!1}if(s)e=n.contentWindow;else break;n=At(e.document)}return n}function Bn(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}function Nr(e){var n=Wn(),s=e.focusedElem,a=e.selectionRange;if(n!==s&&s&&s.ownerDocument&&Tn(s.ownerDocument.documentElement,s)){if(a!==null&&Bn(s)){if(n=a.start,e=a.end,e===void 0&&(e=n),"selectionStart"in s)s.selectionStart=n,s.selectionEnd=Math.min(e,s.value.length);else if(e=(n=s.ownerDocument||document)&&n.defaultView||window,e.getSelection){e=e.getSelection();var f=s.textContent.length,h=Math.min(a.start,f);a=a.end===void 0?h:Math.min(a.end,f),!e.extend&&h>a&&(f=a,a=h,h=f),f=pr(s,h);var y=pr(s,a);f&&y&&(e.rangeCount!==1||e.anchorNode!==f.node||e.anchorOffset!==f.offset||e.focusNode!==y.node||e.focusOffset!==y.offset)&&(n=n.createRange(),n.setStart(f.node,f.offset),e.removeAllRanges(),h>a?(e.addRange(n),e.extend(y.node,y.offset)):(n.setEnd(y.node,y.offset),e.addRange(n)))}}for(n=[],e=s;e=e.parentNode;)e.nodeType===1&&n.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s=document.documentMode,Bt=null,Fr=null,Ot=null,Xs=!1;function ud(e,n,s){var a=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;Xs||Bt==null||Bt!==At(a)||(a=Bt,"selectionStart"in a&&Bn(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),Ot&&cn(Ot,a)||(Ot=a,a=sa(Fr,"onSelect"),0tl||(e.current=Qu[tl],Qu[tl]=null,tl--)}function dt(e,n){tl++,Qu[tl]=e.current,e.current=n}var $i={},zn=Vi($i),Zn=Vi(!1),ys=$i;function nl(e,n){var s=e.type.contextTypes;if(!s)return $i;var a=e.stateNode;if(a&&a.__reactInternalMemoizedUnmaskedChildContext===n)return a.__reactInternalMemoizedMaskedChildContext;var f={},h;for(h in s)f[h]=n[h];return a&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=n,e.__reactInternalMemoizedMaskedChildContext=f),f}function er(e){return e=e.childContextTypes,e!=null}function ua(){gt(Zn),gt(zn)}function Cd(e,n,s){if(zn.current!==$i)throw Error(r(168));dt(zn,n),dt(Zn,s)}function kd(e,n,s){var a=e.stateNode;if(n=n.childContextTypes,typeof a.getChildContext!="function")return s;a=a.getChildContext();for(var f in a)if(!(f in n))throw Error(r(108,_e(e)||"Unknown",f));return X({},s,a)}function ca(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||$i,ys=zn.current,dt(zn,e),dt(Zn,Zn.current),!0}function Rd(e,n,s){var a=e.stateNode;if(!a)throw Error(r(169));s?(e=kd(e,n,ys),a.__reactInternalMemoizedMergedChildContext=e,gt(Zn),gt(zn),dt(zn,e)):gt(Zn),dt(Zn,s)}var mi=null,fa=!1,Xu=!1;function Nd(e){mi===null?mi=[e]:mi.push(e)}function ev(e){fa=!0,Nd(e)}function Gi(){if(!Xu&&mi!==null){Xu=!0;var e=0,n=$e;try{var s=mi;for($e=1;e>=y,f-=y,vi=1<<32-In(n)+f|s<Ie?(hn=Me,Me=null):hn=Me.sibling;var Qe=Q(O,Me,I[Ie],se);if(Qe===null){Me===null&&(Me=hn);break}e&&Me&&Qe.alternate===null&&n(O,Me),M=h(Qe,M,Ie),ze===null?Re=Qe:ze.sibling=Qe,ze=Qe,Me=hn}if(Ie===I.length)return s(O,Me),St&&Ss(O,Ie),Re;if(Me===null){for(;IeIe?(hn=Me,Me=null):hn=Me.sibling;var ts=Q(O,Me,Qe.value,se);if(ts===null){Me===null&&(Me=hn);break}e&&Me&&ts.alternate===null&&n(O,Me),M=h(ts,M,Ie),ze===null?Re=ts:ze.sibling=ts,ze=ts,Me=hn}if(Qe.done)return s(O,Me),St&&Ss(O,Ie),Re;if(Me===null){for(;!Qe.done;Ie++,Qe=I.next())Qe=te(O,Qe.value,se),Qe!==null&&(M=h(Qe,M,Ie),ze===null?Re=Qe:ze.sibling=Qe,ze=Qe);return St&&Ss(O,Ie),Re}for(Me=a(O,Me);!Qe.done;Ie++,Qe=I.next())Qe=pe(Me,O,Ie,Qe.value,se),Qe!==null&&(e&&Qe.alternate!==null&&Me.delete(Qe.key===null?Ie:Qe.key),M=h(Qe,M,Ie),ze===null?Re=Qe:ze.sibling=Qe,ze=Qe);return e&&Me.forEach(function(Lv){return n(O,Lv)}),St&&Ss(O,Ie),Re}function Lt(O,M,I,se){if(typeof I=="object"&&I!==null&&I.type===Z&&I.key===null&&(I=I.props.children),typeof I=="object"&&I!==null){switch(I.$$typeof){case ee:e:{for(var Re=I.key,ze=M;ze!==null;){if(ze.key===Re){if(Re=I.type,Re===Z){if(ze.tag===7){s(O,ze.sibling),M=f(ze,I.props.children),M.return=O,O=M;break e}}else if(ze.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===De&&Od(Re)===ze.type){s(O,ze.sibling),M=f(ze,I.props),M.ref=ql(O,ze,I),M.return=O,O=M;break e}s(O,ze);break}else n(O,ze);ze=ze.sibling}I.type===Z?(M=Ds(I.props.children,O.mode,se,I.key),M.return=O,O=M):(se=Fa(I.type,I.key,I.props,null,O.mode,se),se.ref=ql(O,M,I),se.return=O,O=se)}return y(O);case G:e:{for(ze=I.key;M!==null;){if(M.key===ze)if(M.tag===4&&M.stateNode.containerInfo===I.containerInfo&&M.stateNode.implementation===I.implementation){s(O,M.sibling),M=f(M,I.children||[]),M.return=O,O=M;break e}else{s(O,M);break}else n(O,M);M=M.sibling}M=Yc(I,O.mode,se),M.return=O,O=M}return y(O);case De:return ze=I._init,Lt(O,M,ze(I._payload),se)}if(Ze(I))return Se(O,M,I,se);if(oe(I))return Ee(O,M,I,se);ga(O,I)}return typeof I=="string"&&I!==""||typeof I=="number"?(I=""+I,M!==null&&M.tag===6?(s(O,M.sibling),M=f(M,I),M.return=O,O=M):(s(O,M),M=Gc(I,O.mode,se),M.return=O,O=M),y(O)):s(O,M)}return Lt}var ll=Ld(!0),Pd=Ld(!1),ma=Vi(null),va=null,ol=null,nc=null;function rc(){nc=ol=va=null}function ic(e){var n=ma.current;gt(ma),e._currentValue=n}function sc(e,n,s){for(;e!==null;){var a=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,a!==null&&(a.childLanes|=n)):a!==null&&(a.childLanes&n)!==n&&(a.childLanes|=n),e===s)break;e=e.return}}function al(e,n){va=e,nc=ol=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&n)!==0&&(tr=!0),e.firstContext=null)}function zr(e){var n=e._currentValue;if(nc!==e)if(e={context:e,memoizedValue:n,next:null},ol===null){if(va===null)throw Error(r(308));ol=e,va.dependencies={lanes:0,firstContext:e}}else ol=ol.next=e;return n}var xs=null;function lc(e){xs===null?xs=[e]:xs.push(e)}function Ad(e,n,s,a){var f=n.interleaved;return f===null?(s.next=s,lc(n)):(s.next=f.next,f.next=s),n.interleaved=s,wi(e,a)}function wi(e,n){e.lanes|=n;var s=e.alternate;for(s!==null&&(s.lanes|=n),s=e,e=e.return;e!==null;)e.childLanes|=n,s=e.alternate,s!==null&&(s.childLanes|=n),s=e,e=e.return;return s.tag===3?s.stateNode:null}var Yi=!1;function oc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Id(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Si(e,n){return{eventTime:e,lane:n,tag:0,payload:null,callback:null,next:null}}function Ki(e,n,s){var a=e.updateQueue;if(a===null)return null;if(a=a.shared,(Ye&2)!==0){var f=a.pending;return f===null?n.next=n:(n.next=f.next,f.next=n),a.pending=n,wi(e,s)}return f=a.interleaved,f===null?(n.next=n,lc(a)):(n.next=f.next,f.next=n),a.interleaved=n,wi(e,s)}function ya(e,n,s){if(n=n.updateQueue,n!==null&&(n=n.shared,(s&4194240)!==0)){var a=n.lanes;a&=e.pendingLanes,s|=a,n.lanes=s,bi(e,s)}}function Hd(e,n){var s=e.updateQueue,a=e.alternate;if(a!==null&&(a=a.updateQueue,s===a)){var f=null,h=null;if(s=s.firstBaseUpdate,s!==null){do{var y={eventTime:s.eventTime,lane:s.lane,tag:s.tag,payload:s.payload,callback:s.callback,next:null};h===null?f=h=y:h=h.next=y,s=s.next}while(s!==null);h===null?f=h=n:h=h.next=n}else f=h=n;s={baseState:a.baseState,firstBaseUpdate:f,lastBaseUpdate:h,shared:a.shared,effects:a.effects},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=n:e.next=n,s.lastBaseUpdate=n}function wa(e,n,s,a){var f=e.updateQueue;Yi=!1;var h=f.firstBaseUpdate,y=f.lastBaseUpdate,C=f.shared.pending;if(C!==null){f.shared.pending=null;var N=C,F=N.next;N.next=null,y===null?h=F:y.next=F,y=N;var J=e.alternate;J!==null&&(J=J.updateQueue,C=J.lastBaseUpdate,C!==y&&(C===null?J.firstBaseUpdate=F:C.next=F,J.lastBaseUpdate=N))}if(h!==null){var te=f.baseState;y=0,J=F=N=null,C=h;do{var Q=C.lane,pe=C.eventTime;if((a&Q)===Q){J!==null&&(J=J.next={eventTime:pe,lane:0,tag:C.tag,payload:C.payload,callback:C.callback,next:null});e:{var Se=e,Ee=C;switch(Q=n,pe=s,Ee.tag){case 1:if(Se=Ee.payload,typeof Se=="function"){te=Se.call(pe,te,Q);break e}te=Se;break e;case 3:Se.flags=Se.flags&-65537|128;case 0:if(Se=Ee.payload,Q=typeof Se=="function"?Se.call(pe,te,Q):Se,Q==null)break e;te=X({},te,Q);break e;case 2:Yi=!0}}C.callback!==null&&C.lane!==0&&(e.flags|=64,Q=f.effects,Q===null?f.effects=[C]:Q.push(C))}else pe={eventTime:pe,lane:Q,tag:C.tag,payload:C.payload,callback:C.callback,next:null},J===null?(F=J=pe,N=te):J=J.next=pe,y|=Q;if(C=C.next,C===null){if(C=f.shared.pending,C===null)break;Q=C,C=Q.next,Q.next=null,f.lastBaseUpdate=Q,f.shared.pending=null}}while(!0);if(J===null&&(N=te),f.baseState=N,f.firstBaseUpdate=F,f.lastBaseUpdate=J,n=f.shared.interleaved,n!==null){f=n;do y|=f.lane,f=f.next;while(f!==n)}else h===null&&(f.shared.lanes=0);Cs|=y,e.lanes=y,e.memoizedState=te}}function Fd(e,n,s){if(e=n.effects,n.effects=null,e!==null)for(n=0;ns?s:4,e(!0);var a=dc.transition;dc.transition={};try{e(!1),n()}finally{$e=s,dc.transition=a}}function ih(){return Mr().memoizedState}function iv(e,n,s){var a=Ji(e);if(s={lane:a,action:s,hasEagerState:!1,eagerState:null,next:null},sh(e))lh(n,s);else if(s=Ad(e,n,s,a),s!==null){var f=Vn();Vr(s,e,a,f),oh(s,n,a)}}function sv(e,n,s){var a=Ji(e),f={lane:a,action:s,hasEagerState:!1,eagerState:null,next:null};if(sh(e))lh(n,f);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var y=n.lastRenderedState,C=h(y,s);if(f.hasEagerState=!0,f.eagerState=C,at(C,y)){var N=n.interleaved;N===null?(f.next=f,lc(n)):(f.next=N.next,N.next=f),n.interleaved=f;return}}catch{}finally{}s=Ad(e,n,f,a),s!==null&&(f=Vn(),Vr(s,e,a,f),oh(s,n,a))}}function sh(e){var n=e.alternate;return e===kt||n!==null&&n===kt}function lh(e,n){to=_a=!0;var s=e.pending;s===null?n.next=n:(n.next=s.next,s.next=n),e.pending=n}function oh(e,n,s){if((s&4194240)!==0){var a=n.lanes;a&=e.pendingLanes,s|=a,n.lanes=s,bi(e,s)}}var ka={readContext:zr,useCallback:Mn,useContext:Mn,useEffect:Mn,useImperativeHandle:Mn,useInsertionEffect:Mn,useLayoutEffect:Mn,useMemo:Mn,useReducer:Mn,useRef:Mn,useState:Mn,useDebugValue:Mn,useDeferredValue:Mn,useTransition:Mn,useMutableSource:Mn,useSyncExternalStore:Mn,useId:Mn,unstable_isNewReconciler:!1},lv={readContext:zr,useCallback:function(e,n){return si().memoizedState=[e,n===void 0?null:n],e},useContext:zr,useEffect:Xd,useImperativeHandle:function(e,n,s){return s=s!=null?s.concat([e]):null,Ea(4194308,4,Zd.bind(null,n,e),s)},useLayoutEffect:function(e,n){return Ea(4194308,4,e,n)},useInsertionEffect:function(e,n){return Ea(4,2,e,n)},useMemo:function(e,n){var s=si();return n=n===void 0?null:n,e=e(),s.memoizedState=[e,n],e},useReducer:function(e,n,s){var a=si();return n=s!==void 0?s(n):n,a.memoizedState=a.baseState=n,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:n},a.queue=e,e=e.dispatch=iv.bind(null,kt,e),[a.memoizedState,e]},useRef:function(e){var n=si();return e={current:e},n.memoizedState=e},useState:Kd,useDebugValue:wc,useDeferredValue:function(e){return si().memoizedState=e},useTransition:function(){var e=Kd(!1),n=e[0];return e=rv.bind(null,e[1]),si().memoizedState=e,[n,e]},useMutableSource:function(){},useSyncExternalStore:function(e,n,s){var a=kt,f=si();if(St){if(s===void 0)throw Error(r(407));s=s()}else{if(s=n(),dn===null)throw Error(r(349));(Es&30)!==0||Ud(a,n,s)}f.memoizedState=s;var h={value:s,getSnapshot:n};return f.queue=h,Xd($d.bind(null,a,h,e),[e]),a.flags|=2048,io(9,Vd.bind(null,a,h,s,n),void 0,null),s},useId:function(){var e=si(),n=dn.identifierPrefix;if(St){var s=yi,a=vi;s=(a&~(1<<32-In(a)-1)).toString(32)+s,n=":"+n+"R"+s,s=no++,0<\/script>",e=e.removeChild(e.firstChild)):typeof a.is=="string"?e=y.createElement(s,{is:a.is}):(e=y.createElement(s),s==="select"&&(y=e,a.multiple?y.multiple=!0:a.size&&(y.size=a.size))):e=y.createElementNS(e,s),e[ri]=n,e[Ql]=a,Nh(e,n,!1,!1),n.stateNode=e;e:{switch(y=Jr(s,a),s){case"dialog":pt("cancel",e),pt("close",e),f=a;break;case"iframe":case"object":case"embed":pt("load",e),f=a;break;case"video":case"audio":for(f=0;fhl&&(n.flags|=128,a=!0,so(h,!1),n.lanes=4194304)}else{if(!a)if(e=Sa(y),e!==null){if(n.flags|=128,a=!0,s=e.updateQueue,s!==null&&(n.updateQueue=s,n.flags|=4),so(h,!0),h.tail===null&&h.tailMode==="hidden"&&!y.alternate&&!St)return bn(n),null}else 2*ot()-h.renderingStartTime>hl&&s!==1073741824&&(n.flags|=128,a=!0,so(h,!1),n.lanes=4194304);h.isBackwards?(y.sibling=n.child,n.child=y):(s=h.last,s!==null?s.sibling=y:n.child=y,h.last=y)}return h.tail!==null?(n=h.tail,h.rendering=n,h.tail=n.sibling,h.renderingStartTime=ot(),n.sibling=null,s=Ct.current,dt(Ct,a?s&1|2:s&1),n):(bn(n),null);case 22:case 23:return Uc(),a=n.memoizedState!==null,e!==null&&e.memoizedState!==null!==a&&(n.flags|=8192),a&&(n.mode&1)!==0?(vr&1073741824)!==0&&(bn(n),n.subtreeFlags&6&&(n.flags|=8192)):bn(n),null;case 24:return null;case 25:return null}throw Error(r(156,n.tag))}function pv(e,n){switch(Ju(n),n.tag){case 1:return er(n.type)&&ua(),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return ul(),gt(Zn),gt(zn),fc(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 5:return uc(n),null;case 13:if(gt(Ct),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(r(340));sl()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return gt(Ct),null;case 4:return ul(),null;case 10:return ic(n.type._context),null;case 22:case 23:return Uc(),null;case 24:return null;default:return null}}var Ta=!1,On=!1,gv=typeof WeakSet=="function"?WeakSet:Set,we=null;function fl(e,n){var s=e.ref;if(s!==null)if(typeof s=="function")try{s(null)}catch(a){Tt(e,n,a)}else s.current=null}function Mc(e,n,s){try{s()}catch(a){Tt(e,n,a)}}var zh=!1;function mv(e,n){if(Uu=rt,e=Wn(),Bn(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{s=(s=e.ownerDocument)&&s.defaultView||window;var a=s.getSelection&&s.getSelection();if(a&&a.rangeCount!==0){s=a.anchorNode;var f=a.anchorOffset,h=a.focusNode;a=a.focusOffset;try{s.nodeType,h.nodeType}catch{s=null;break e}var y=0,C=-1,N=-1,F=0,J=0,te=e,Q=null;t:for(;;){for(var pe;te!==s||f!==0&&te.nodeType!==3||(C=y+f),te!==h||a!==0&&te.nodeType!==3||(N=y+a),te.nodeType===3&&(y+=te.nodeValue.length),(pe=te.firstChild)!==null;)Q=te,te=pe;for(;;){if(te===e)break t;if(Q===s&&++F===f&&(C=y),Q===h&&++J===a&&(N=y),(pe=te.nextSibling)!==null)break;te=Q,Q=te.parentNode}te=pe}s=C===-1||N===-1?null:{start:C,end:N}}else s=null}s=s||{start:0,end:0}}else s=null;for(Vu={focusedElem:e,selectionRange:s},rt=!1,we=n;we!==null;)if(n=we,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,we=e;else for(;we!==null;){n=we;try{var Se=n.alternate;if((n.flags&1024)!==0)switch(n.tag){case 0:case 11:case 15:break;case 1:if(Se!==null){var Ee=Se.memoizedProps,Lt=Se.memoizedState,O=n.stateNode,M=O.getSnapshotBeforeUpdate(n.elementType===n.type?Ee:Wr(n.type,Ee),Lt);O.__reactInternalSnapshotBeforeUpdate=M}break;case 3:var I=n.stateNode.containerInfo;I.nodeType===1?I.textContent="":I.nodeType===9&&I.documentElement&&I.removeChild(I.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(se){Tt(n,n.return,se)}if(e=n.sibling,e!==null){e.return=n.return,we=e;break}we=n.return}return Se=zh,zh=!1,Se}function lo(e,n,s){var a=n.updateQueue;if(a=a!==null?a.lastEffect:null,a!==null){var f=a=a.next;do{if((f.tag&e)===e){var h=f.destroy;f.destroy=void 0,h!==void 0&&Mc(n,s,h)}f=f.next}while(f!==a)}}function za(e,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var s=n=n.next;do{if((s.tag&e)===e){var a=s.create;s.destroy=a()}s=s.next}while(s!==n)}}function bc(e){var n=e.ref;if(n!==null){var s=e.stateNode;switch(e.tag){case 5:e=s;break;default:e=s}typeof n=="function"?n(e):n.current=e}}function Mh(e){var n=e.alternate;n!==null&&(e.alternate=null,Mh(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&(delete n[ri],delete n[Ql],delete n[Ku],delete n[Jm],delete n[Zm])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function bh(e){return e.tag===5||e.tag===3||e.tag===4}function Oh(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||bh(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.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Oc(e,n,s){var a=e.tag;if(a===5||a===6)e=e.stateNode,n?s.nodeType===8?s.parentNode.insertBefore(e,n):s.insertBefore(e,n):(s.nodeType===8?(n=s.parentNode,n.insertBefore(e,s)):(n=s,n.appendChild(e)),s=s._reactRootContainer,s!=null||n.onclick!==null||(n.onclick=oa));else if(a!==4&&(e=e.child,e!==null))for(Oc(e,n,s),e=e.sibling;e!==null;)Oc(e,n,s),e=e.sibling}function Lc(e,n,s){var a=e.tag;if(a===5||a===6)e=e.stateNode,n?s.insertBefore(e,n):s.appendChild(e);else if(a!==4&&(e=e.child,e!==null))for(Lc(e,n,s),e=e.sibling;e!==null;)Lc(e,n,s),e=e.sibling}var _n=null,Br=!1;function Qi(e,n,s){for(s=s.child;s!==null;)Lh(e,n,s),s=s.sibling}function Lh(e,n,s){if(Qn&&typeof Qn.onCommitFiberUnmount=="function")try{Qn.onCommitFiberUnmount(Di,s)}catch{}switch(s.tag){case 5:On||fl(s,n);case 6:var a=_n,f=Br;_n=null,Qi(e,n,s),_n=a,Br=f,_n!==null&&(Br?(e=_n,s=s.stateNode,e.nodeType===8?e.parentNode.removeChild(s):e.removeChild(s)):_n.removeChild(s.stateNode));break;case 18:_n!==null&&(Br?(e=_n,s=s.stateNode,e.nodeType===8?Yu(e.parentNode,s):e.nodeType===1&&Yu(e,s),Fi(e)):Yu(_n,s.stateNode));break;case 4:a=_n,f=Br,_n=s.stateNode.containerInfo,Br=!0,Qi(e,n,s),_n=a,Br=f;break;case 0:case 11:case 14:case 15:if(!On&&(a=s.updateQueue,a!==null&&(a=a.lastEffect,a!==null))){f=a=a.next;do{var h=f,y=h.destroy;h=h.tag,y!==void 0&&((h&2)!==0||(h&4)!==0)&&Mc(s,n,y),f=f.next}while(f!==a)}Qi(e,n,s);break;case 1:if(!On&&(fl(s,n),a=s.stateNode,typeof a.componentWillUnmount=="function"))try{a.props=s.memoizedProps,a.state=s.memoizedState,a.componentWillUnmount()}catch(C){Tt(s,n,C)}Qi(e,n,s);break;case 21:Qi(e,n,s);break;case 22:s.mode&1?(On=(a=On)||s.memoizedState!==null,Qi(e,n,s),On=a):Qi(e,n,s);break;default:Qi(e,n,s)}}function Ph(e){var n=e.updateQueue;if(n!==null){e.updateQueue=null;var s=e.stateNode;s===null&&(s=e.stateNode=new gv),n.forEach(function(a){var f=kv.bind(null,e,a);s.has(a)||(s.add(a),a.then(f,f))})}}function Ur(e,n){var s=n.deletions;if(s!==null)for(var a=0;af&&(f=y),a&=~h}if(a=f,a=ot()-a,a=(120>a?120:480>a?480:1080>a?1080:1920>a?1920:3e3>a?3e3:4320>a?4320:1960*yv(a/1960))-a,10e?16:e,qi===null)var a=!1;else{if(e=qi,qi=null,Pa=0,(Ye&6)!==0)throw Error(r(331));var f=Ye;for(Ye|=4,we=e.current;we!==null;){var h=we,y=h.child;if((we.flags&16)!==0){var C=h.deletions;if(C!==null){for(var N=0;Not()-Ic?Rs(e,0):Ac|=s),rr(e,n)}function Kh(e,n){n===0&&((e.mode&1)===0?n=1:(n=Ti,Ti<<=1,(Ti&130023424)===0&&(Ti=4194304)));var s=Vn();e=wi(e,n),e!==null&&(Mi(e,n,s),rr(e,s))}function Cv(e){var n=e.memoizedState,s=0;n!==null&&(s=n.retryLane),Kh(e,s)}function kv(e,n){var s=0;switch(e.tag){case 13:var a=e.stateNode,f=e.memoizedState;f!==null&&(s=f.retryLane);break;case 19:a=e.stateNode;break;default:throw Error(r(314))}a!==null&&a.delete(n),Kh(e,s)}var Qh;Qh=function(e,n,s){if(e!==null)if(e.memoizedProps!==n.pendingProps||Zn.current)tr=!0;else{if((e.lanes&s)===0&&(n.flags&128)===0)return tr=!1,dv(e,n,s);tr=(e.flags&131072)!==0}else tr=!1,St&&(n.flags&1048576)!==0&&Dd(n,ha,n.index);switch(n.lanes=0,n.tag){case 2:var a=n.type;Da(e,n),e=n.pendingProps;var f=nl(n,zn.current);al(n,s),f=pc(null,n,a,e,f,s);var h=gc();return n.flags|=1,typeof f=="object"&&f!==null&&typeof f.render=="function"&&f.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,er(a)?(h=!0,ca(n)):h=!1,n.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,oc(n),f.updater=Ra,n.stateNode=f,f._reactInternals=n,xc(n,a,e,s),n=kc(null,n,a,!0,h,s)):(n.tag=0,St&&h&&qu(n),Un(null,n,f,s),n=n.child),n;case 16:a=n.elementType;e:{switch(Da(e,n),e=n.pendingProps,f=a._init,a=f(a._payload),n.type=a,f=n.tag=Nv(a),e=Wr(a,e),f){case 0:n=Cc(null,n,a,e,s);break e;case 1:n=xh(null,n,a,e,s);break e;case 11:n=mh(null,n,a,e,s);break e;case 14:n=vh(null,n,a,Wr(a.type,e),s);break e}throw Error(r(306,a,""))}return n;case 0:return a=n.type,f=n.pendingProps,f=n.elementType===a?f:Wr(a,f),Cc(e,n,a,f,s);case 1:return a=n.type,f=n.pendingProps,f=n.elementType===a?f:Wr(a,f),xh(e,n,a,f,s);case 3:e:{if(_h(n),e===null)throw Error(r(387));a=n.pendingProps,h=n.memoizedState,f=h.element,Id(e,n),wa(n,a,null,s);var y=n.memoizedState;if(a=y.element,h.isDehydrated)if(h={element:a,isDehydrated:!1,cache:y.cache,pendingSuspenseBoundaries:y.pendingSuspenseBoundaries,transitions:y.transitions},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){f=cl(Error(r(423)),n),n=Eh(e,n,a,s,f);break e}else if(a!==f){f=cl(Error(r(424)),n),n=Eh(e,n,a,s,f);break e}else for(mr=Ui(n.stateNode.containerInfo.firstChild),gr=n,St=!0,jr=null,s=Pd(n,null,a,s),n.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(sl(),a===f){n=xi(e,n,s);break e}Un(e,n,a,s)}n=n.child}return n;case 5:return jd(n),e===null&&ec(n),a=n.type,f=n.pendingProps,h=e!==null?e.memoizedProps:null,y=f.children,$u(a,f)?y=null:h!==null&&$u(a,h)&&(n.flags|=32),Sh(e,n),Un(e,n,y,s),n.child;case 6:return e===null&&ec(n),null;case 13:return Ch(e,n,s);case 4:return ac(n,n.stateNode.containerInfo),a=n.pendingProps,e===null?n.child=ll(n,null,a,s):Un(e,n,a,s),n.child;case 11:return a=n.type,f=n.pendingProps,f=n.elementType===a?f:Wr(a,f),mh(e,n,a,f,s);case 7:return Un(e,n,n.pendingProps,s),n.child;case 8:return Un(e,n,n.pendingProps.children,s),n.child;case 12:return Un(e,n,n.pendingProps.children,s),n.child;case 10:e:{if(a=n.type._context,f=n.pendingProps,h=n.memoizedProps,y=f.value,dt(ma,a._currentValue),a._currentValue=y,h!==null)if(at(h.value,y)){if(h.children===f.children&&!Zn.current){n=xi(e,n,s);break e}}else for(h=n.child,h!==null&&(h.return=n);h!==null;){var C=h.dependencies;if(C!==null){y=h.child;for(var N=C.firstContext;N!==null;){if(N.context===a){if(h.tag===1){N=Si(-1,s&-s),N.tag=2;var F=h.updateQueue;if(F!==null){F=F.shared;var J=F.pending;J===null?N.next=N:(N.next=J.next,J.next=N),F.pending=N}}h.lanes|=s,N=h.alternate,N!==null&&(N.lanes|=s),sc(h.return,s,n),C.lanes|=s;break}N=N.next}}else if(h.tag===10)y=h.type===n.type?null:h.child;else if(h.tag===18){if(y=h.return,y===null)throw Error(r(341));y.lanes|=s,C=y.alternate,C!==null&&(C.lanes|=s),sc(y,s,n),y=h.sibling}else y=h.child;if(y!==null)y.return=h;else for(y=h;y!==null;){if(y===n){y=null;break}if(h=y.sibling,h!==null){h.return=y.return,y=h;break}y=y.return}h=y}Un(e,n,f.children,s),n=n.child}return n;case 9:return f=n.type,a=n.pendingProps.children,al(n,s),f=zr(f),a=a(f),n.flags|=1,Un(e,n,a,s),n.child;case 14:return a=n.type,f=Wr(a,n.pendingProps),f=Wr(a.type,f),vh(e,n,a,f,s);case 15:return yh(e,n,n.type,n.pendingProps,s);case 17:return a=n.type,f=n.pendingProps,f=n.elementType===a?f:Wr(a,f),Da(e,n),n.tag=1,er(a)?(e=!0,ca(n)):e=!1,al(n,s),uh(n,a,f),xc(n,a,f,s),kc(null,n,a,!0,e,s);case 19:return Rh(e,n,s);case 22:return wh(e,n,s)}throw Error(r(156,n.tag))};function Xh(e,n){return Mt(e,n)}function Rv(e,n,s,a){this.tag=e,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Or(e,n,s,a){return new Rv(e,n,s,a)}function $c(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Nv(e){if(typeof e=="function")return $c(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ce)return 11;if(e===me)return 14}return 2}function es(e,n){var s=e.alternate;return s===null?(s=Or(e.tag,n,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=n,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=e.flags&14680064,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,n=e.dependencies,s.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s}function Fa(e,n,s,a,f,h){var y=2;if(a=e,typeof e=="function")$c(e)&&(y=1);else if(typeof e=="string")y=5;else e:switch(e){case Z:return Ds(s.children,f,h,n);case re:y=8,f|=8;break;case ve:return e=Or(12,s,n,f|2),e.elementType=ve,e.lanes=h,e;case ae:return e=Or(13,s,n,f),e.elementType=ae,e.lanes=h,e;case ye:return e=Or(19,s,n,f),e.elementType=ye,e.lanes=h,e;case le:return ja(s,f,h,n);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case de:y=10;break e;case Y:y=9;break e;case Ce:y=11;break e;case me:y=14;break e;case De:y=16,a=null;break e}throw Error(r(130,e==null?e:typeof e,""))}return n=Or(y,s,n,f),n.elementType=e,n.type=a,n.lanes=h,n}function Ds(e,n,s,a){return e=Or(7,e,a,n),e.lanes=s,e}function ja(e,n,s,a){return e=Or(22,e,a,n),e.elementType=le,e.lanes=s,e.stateNode={isHidden:!1},e}function Gc(e,n,s){return e=Or(6,e,null,n),e.lanes=s,e}function Yc(e,n,s){return n=Or(4,e.children!==null?e.children:[],e.key,n),n.lanes=s,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function Dv(e,n,s,a,f){this.tag=n,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Al(0),this.expirationTimes=Al(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Al(0),this.identifierPrefix=a,this.onRecoverableError=f,this.mutableSourceEagerHydrationData=null}function Kc(e,n,s,a,f,h,y,C,N){return e=new Dv(e,n,s,C,N),n===1?(n=1,h===!0&&(n|=8)):n=0,h=Or(3,null,null,n),e.current=h,h.stateNode=e,h.memoizedState={element:a,isDehydrated:s,cache:null,transitions:null,pendingSuspenseBoundaries:null},oc(h),e}function Tv(e,n,s){var a=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l)}catch(t){console.error(t)}}return l(),ef.exports=Bv(),ef.exports}var cp;function Uv(){if(cp)return Ya;cp=1;var l=kg();return Ya.createRoot=l.createRoot,Ya.hydrateRoot=l.hydrateRoot,Ya}var Vv=Uv();const $v=Cg(Vv);var bs=kg();const yu=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Nl(l){const t=Object.prototype.toString.call(l);return t==="[object Window]"||t==="[object global]"}function Hf(l){return"nodeType"in l}function Yn(l){var t,r;return l?Nl(l)?l:Hf(l)&&(t=(r=l.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function Ff(l){const{Document:t}=Yn(l);return l instanceof t}function bo(l){return Nl(l)?!1:l instanceof Yn(l).HTMLElement}function Rg(l){return l instanceof Yn(l).SVGElement}function Dl(l){return l?Nl(l)?l.document:Hf(l)?Ff(l)?l:bo(l)||Rg(l)?l.ownerDocument:document:document:document}const ki=yu?j.useLayoutEffect:j.useEffect;function wu(l){const t=j.useRef(l);return ki(()=>{t.current=l}),j.useCallback(function(){for(var r=arguments.length,i=new Array(r),o=0;o{l.current=setInterval(i,o)},[]),r=j.useCallback(()=>{l.current!==null&&(clearInterval(l.current),l.current=null)},[]);return[t,r]}function Ro(l,t){t===void 0&&(t=[l]);const r=j.useRef(l);return ki(()=>{r.current!==l&&(r.current=l)},t),r}function Oo(l,t){const r=j.useRef();return j.useMemo(()=>{const i=l(r.current);return r.current=i,i},[...t])}function ru(l){const t=wu(l),r=j.useRef(null),i=j.useCallback(o=>{o!==r.current&&(t==null||t(o,r.current)),r.current=o},[]);return[r,i]}function iu(l){const t=j.useRef();return j.useEffect(()=>{t.current=l},[l]),t.current}let rf={};function Su(l,t){return j.useMemo(()=>{if(t)return t;const r=rf[l]==null?0:rf[l]+1;return rf[l]=r,l+"-"+r},[l,t])}function Ng(l){return function(t){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o{const d=Object.entries(c);for(const[p,m]of d){const w=u[p];w!=null&&(u[p]=w+l*m)}return u},{...t})}}const wl=Ng(1),su=Ng(-1);function Yv(l){return"clientX"in l&&"clientY"in l}function jf(l){if(!l)return!1;const{KeyboardEvent:t}=Yn(l.target);return t&&l instanceof t}function Kv(l){if(!l)return!1;const{TouchEvent:t}=Yn(l.target);return t&&l instanceof t}function lu(l){if(Kv(l)){if(l.touches&&l.touches.length){const{clientX:t,clientY:r}=l.touches[0];return{x:t,y:r}}else if(l.changedTouches&&l.changedTouches.length){const{clientX:t,clientY:r}=l.changedTouches[0];return{x:t,y:r}}}return Yv(l)?{x:l.clientX,y:l.clientY}:null}const No=Object.freeze({Translate:{toString(l){if(!l)return;const{x:t,y:r}=l;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(l){if(!l)return;const{scaleX:t,scaleY:r}=l;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(l){if(l)return[No.Translate.toString(l),No.Scale.toString(l)].join(" ")}},Transition:{toString(l){let{property:t,duration:r,easing:i}=l;return t+" "+r+"ms "+i}}}),fp="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Qv(l){return l.matches(fp)?l:l.querySelector(fp)}const Xv={display:"none"};function qv(l){let{id:t,value:r}=l;return ht.createElement("div",{id:t,style:Xv},r)}function Jv(l){let{id:t,announcement:r,ariaLiveType:i="assertive"}=l;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return ht.createElement("div",{id:t,style:o,role:"status","aria-live":i,"aria-atomic":!0},r)}function Zv(){const[l,t]=j.useState("");return{announce:j.useCallback(i=>{i!=null&&t(i)},[]),announcement:l}}const Dg=j.createContext(null);function ey(l){const t=j.useContext(Dg);j.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(l)},[l,t])}function ty(){const[l]=j.useState(()=>new Set),t=j.useCallback(i=>(l.add(i),()=>l.delete(i)),[l]);return[j.useCallback(i=>{let{type:o,event:u}=i;l.forEach(c=>{var d;return(d=c[o])==null?void 0:d.call(c,u)})},[l]),t]}const ny={draggable:` - To pick up a draggable item, press the space bar. - While dragging, use the arrow keys to move the item. - Press space again to drop the item in its new position, or press escape to cancel. - `},ry={onDragStart(l){let{active:t}=l;return"Picked up draggable item "+t.id+"."},onDragOver(l){let{active:t,over:r}=l;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(l){let{active:t,over:r}=l;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(l){let{active:t}=l;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function iy(l){let{announcements:t=ry,container:r,hiddenTextDescribedById:i,screenReaderInstructions:o=ny}=l;const{announce:u,announcement:c}=Zv(),d=Su("DndLiveRegion"),[p,m]=j.useState(!1);if(j.useEffect(()=>{m(!0)},[]),ey(j.useMemo(()=>({onDragStart(v){let{active:x}=v;u(t.onDragStart({active:x}))},onDragMove(v){let{active:x,over:z}=v;t.onDragMove&&u(t.onDragMove({active:x,over:z}))},onDragOver(v){let{active:x,over:z}=v;u(t.onDragOver({active:x,over:z}))},onDragEnd(v){let{active:x,over:z}=v;u(t.onDragEnd({active:x,over:z}))},onDragCancel(v){let{active:x,over:z}=v;u(t.onDragCancel({active:x,over:z}))}}),[u,t])),!p)return null;const w=ht.createElement(ht.Fragment,null,ht.createElement(qv,{id:i,value:o.draggable}),ht.createElement(Jv,{id:d,announcement:c}));return r?bs.createPortal(w,r):w}var en;(function(l){l.DragStart="dragStart",l.DragMove="dragMove",l.DragEnd="dragEnd",l.DragCancel="dragCancel",l.DragOver="dragOver",l.RegisterDroppable="registerDroppable",l.SetDroppableDisabled="setDroppableDisabled",l.UnregisterDroppable="unregisterDroppable"})(en||(en={}));function ou(){}function sy(l,t){return j.useMemo(()=>({sensor:l,options:t??{}}),[l,t])}function ly(){for(var l=arguments.length,t=new Array(l),r=0;r[...t].filter(i=>i!=null),[...t])}const Qr=Object.freeze({x:0,y:0});function oy(l,t){const r=lu(l);if(!r)return"0 0";const i={x:(r.x-t.left)/t.width*100,y:(r.y-t.top)/t.height*100};return i.x+"% "+i.y+"%"}function ay(l,t){let{data:{value:r}}=l,{data:{value:i}}=t;return i-r}function uy(l,t){if(!l||l.length===0)return null;const[r]=l;return r[t]}function cy(l,t){const r=Math.max(t.top,l.top),i=Math.max(t.left,l.left),o=Math.min(t.left+t.width,l.left+l.width),u=Math.min(t.top+t.height,l.top+l.height),c=o-i,d=u-r;if(i{let{collisionRect:t,droppableRects:r,droppableContainers:i}=l;const o=[];for(const u of i){const{id:c}=u,d=r.get(c);if(d){const p=cy(d,t);p>0&&o.push({id:c,data:{droppableContainer:u,value:p}})}}return o.sort(ay)};function dy(l,t,r){return{...l,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function Tg(l,t){return l&&t?{x:l.left-t.left,y:l.top-t.top}:Qr}function hy(l){return function(r){for(var i=arguments.length,o=new Array(i>1?i-1:0),u=1;u({...c,top:c.top+l*d.y,bottom:c.bottom+l*d.y,left:c.left+l*d.x,right:c.right+l*d.x}),{...r})}}const py=hy(1);function zg(l){if(l.startsWith("matrix3d(")){const t=l.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(l.startsWith("matrix(")){const t=l.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function gy(l,t,r){const i=zg(t);if(!i)return l;const{scaleX:o,scaleY:u,x:c,y:d}=i,p=l.left-c-(1-o)*parseFloat(r),m=l.top-d-(1-u)*parseFloat(r.slice(r.indexOf(" ")+1)),w=o?l.width/o:l.width,v=u?l.height/u:l.height;return{width:w,height:v,top:m,right:p+w,bottom:m+v,left:p}}const my={ignoreTransform:!1};function Lo(l,t){t===void 0&&(t=my);let r=l.getBoundingClientRect();if(t.ignoreTransform){const{transform:m,transformOrigin:w}=Yn(l).getComputedStyle(l);m&&(r=gy(r,m,w))}const{top:i,left:o,width:u,height:c,bottom:d,right:p}=r;return{top:i,left:o,width:u,height:c,bottom:d,right:p}}function dp(l){return Lo(l,{ignoreTransform:!0})}function vy(l){const t=l.innerWidth,r=l.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function yy(l,t){return t===void 0&&(t=Yn(l).getComputedStyle(l)),t.position==="fixed"}function wy(l,t){t===void 0&&(t=Yn(l).getComputedStyle(l));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const u=t[o];return typeof u=="string"?r.test(u):!1})}function Wf(l,t){const r=[];function i(o){if(t!=null&&r.length>=t||!o)return r;if(Ff(o)&&o.scrollingElement!=null&&!r.includes(o.scrollingElement))return r.push(o.scrollingElement),r;if(!bo(o)||Rg(o)||r.includes(o))return r;const u=Yn(l).getComputedStyle(o);return o!==l&&wy(o,u)&&r.push(o),yy(o,u)?r:i(o.parentNode)}return l?i(l):r}function Mg(l){const[t]=Wf(l,1);return t??null}function sf(l){return!yu||!l?null:Nl(l)?l:Hf(l)?Ff(l)||l===Dl(l).scrollingElement?window:bo(l)?l:null:null}function bg(l){return Nl(l)?l.scrollX:l.scrollLeft}function Og(l){return Nl(l)?l.scrollY:l.scrollTop}function _f(l){return{x:bg(l),y:Og(l)}}var pn;(function(l){l[l.Forward=1]="Forward",l[l.Backward=-1]="Backward"})(pn||(pn={}));function Lg(l){return!yu||!l?!1:l===document.scrollingElement}function Pg(l){const t={x:0,y:0},r=Lg(l)?{height:window.innerHeight,width:window.innerWidth}:{height:l.clientHeight,width:l.clientWidth},i={x:l.scrollWidth-r.width,y:l.scrollHeight-r.height},o=l.scrollTop<=t.y,u=l.scrollLeft<=t.x,c=l.scrollTop>=i.y,d=l.scrollLeft>=i.x;return{isTop:o,isLeft:u,isBottom:c,isRight:d,maxScroll:i,minScroll:t}}const Sy={x:.2,y:.2};function xy(l,t,r,i,o){let{top:u,left:c,right:d,bottom:p}=r;i===void 0&&(i=10),o===void 0&&(o=Sy);const{isTop:m,isBottom:w,isLeft:v,isRight:x}=Pg(l),z={x:0,y:0},R={x:0,y:0},k={height:t.height*o.y,width:t.width*o.x};return!m&&u<=t.top+k.height?(z.y=pn.Backward,R.y=i*Math.abs((t.top+k.height-u)/k.height)):!w&&p>=t.bottom-k.height&&(z.y=pn.Forward,R.y=i*Math.abs((t.bottom-k.height-p)/k.height)),!x&&d>=t.right-k.width?(z.x=pn.Forward,R.x=i*Math.abs((t.right-k.width-d)/k.width)):!v&&c<=t.left+k.width&&(z.x=pn.Backward,R.x=i*Math.abs((t.left+k.width-c)/k.width)),{direction:z,speed:R}}function _y(l){if(l===document.scrollingElement){const{innerWidth:u,innerHeight:c}=window;return{top:0,left:0,right:u,bottom:c,width:u,height:c}}const{top:t,left:r,right:i,bottom:o}=l.getBoundingClientRect();return{top:t,left:r,right:i,bottom:o,width:l.clientWidth,height:l.clientHeight}}function Ag(l){return l.reduce((t,r)=>wl(t,_f(r)),Qr)}function Ey(l){return l.reduce((t,r)=>t+bg(r),0)}function Cy(l){return l.reduce((t,r)=>t+Og(r),0)}function Ig(l,t){if(t===void 0&&(t=Lo),!l)return;const{top:r,left:i,bottom:o,right:u}=t(l);Mg(l)&&(o<=0||u<=0||r>=window.innerHeight||i>=window.innerWidth)&&l.scrollIntoView({block:"center",inline:"center"})}const ky=[["x",["left","right"],Ey],["y",["top","bottom"],Cy]];class Bf{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const i=Wf(r),o=Ag(i);this.rect={...t},this.width=t.width,this.height=t.height;for(const[u,c,d]of ky)for(const p of c)Object.defineProperty(this,p,{get:()=>{const m=d(i),w=o[u]-m;return this.rect[p]+w},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class So{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var i;return(i=this.target)==null?void 0:i.removeEventListener(...r)})},this.target=t}add(t,r,i){var o;(o=this.target)==null||o.addEventListener(t,r,i),this.listeners.push([t,r,i])}}function Ry(l){const{EventTarget:t}=Yn(l);return l instanceof t?l:Dl(l)}function lf(l,t){const r=Math.abs(l.x),i=Math.abs(l.y);return typeof t=="number"?Math.sqrt(r**2+i**2)>t:"x"in t&&"y"in t?r>t.x&&i>t.y:"x"in t?r>t.x:"y"in t?i>t.y:!1}var Pr;(function(l){l.Click="click",l.DragStart="dragstart",l.Keydown="keydown",l.ContextMenu="contextmenu",l.Resize="resize",l.SelectionChange="selectionchange",l.VisibilityChange="visibilitychange"})(Pr||(Pr={}));function hp(l){l.preventDefault()}function Ny(l){l.stopPropagation()}var ut;(function(l){l.Space="Space",l.Down="ArrowDown",l.Right="ArrowRight",l.Left="ArrowLeft",l.Up="ArrowUp",l.Esc="Escape",l.Enter="Enter",l.Tab="Tab"})(ut||(ut={}));const Hg={start:[ut.Space,ut.Enter],cancel:[ut.Esc],end:[ut.Space,ut.Enter,ut.Tab]},Dy=(l,t)=>{let{currentCoordinates:r}=t;switch(l.code){case ut.Right:return{...r,x:r.x+25};case ut.Left:return{...r,x:r.x-25};case ut.Down:return{...r,y:r.y+25};case ut.Up:return{...r,y:r.y-25}}};class Fg{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:r}}=t;this.props=t,this.listeners=new So(Dl(r)),this.windowListeners=new So(Yn(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Pr.Resize,this.handleCancel),this.windowListeners.add(Pr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Pr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,i=t.node.current;i&&Ig(i),r(Qr)}handleKeyDown(t){if(jf(t)){const{active:r,context:i,options:o}=this.props,{keyboardCodes:u=Hg,coordinateGetter:c=Dy,scrollBehavior:d="smooth"}=o,{code:p}=t;if(u.end.includes(p)){this.handleEnd(t);return}if(u.cancel.includes(p)){this.handleCancel(t);return}const{collisionRect:m}=i.current,w=m?{x:m.left,y:m.top}:Qr;this.referenceCoordinates||(this.referenceCoordinates=w);const v=c(t,{active:r,context:i.current,currentCoordinates:w});if(v){const x=su(v,w),z={x:0,y:0},{scrollableAncestors:R}=i.current;for(const k of R){const b=t.code,{isTop:W,isRight:P,isLeft:B,isBottom:V,maxScroll:ee,minScroll:G}=Pg(k),Z=_y(k),re={x:Math.min(b===ut.Right?Z.right-Z.width/2:Z.right,Math.max(b===ut.Right?Z.left:Z.left+Z.width/2,v.x)),y:Math.min(b===ut.Down?Z.bottom-Z.height/2:Z.bottom,Math.max(b===ut.Down?Z.top:Z.top+Z.height/2,v.y))},ve=b===ut.Right&&!P||b===ut.Left&&!B,de=b===ut.Down&&!V||b===ut.Up&&!W;if(ve&&re.x!==v.x){const Y=k.scrollLeft+x.x,Ce=b===ut.Right&&Y<=ee.x||b===ut.Left&&Y>=G.x;if(Ce&&!x.y){k.scrollTo({left:Y,behavior:d});return}Ce?z.x=k.scrollLeft-Y:z.x=b===ut.Right?k.scrollLeft-ee.x:k.scrollLeft-G.x,z.x&&k.scrollBy({left:-z.x,behavior:d});break}else if(de&&re.y!==v.y){const Y=k.scrollTop+x.y,Ce=b===ut.Down&&Y<=ee.y||b===ut.Up&&Y>=G.y;if(Ce&&!x.x){k.scrollTo({top:Y,behavior:d});return}Ce?z.y=k.scrollTop-Y:z.y=b===ut.Down?k.scrollTop-ee.y:k.scrollTop-G.y,z.y&&k.scrollBy({top:-z.y,behavior:d});break}}this.handleMove(t,wl(su(v,this.referenceCoordinates),z))}}}handleMove(t,r){const{onMove:i}=this.props;t.preventDefault(),i(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Fg.activators=[{eventName:"onKeyDown",handler:(l,t,r)=>{let{keyboardCodes:i=Hg,onActivation:o}=t,{active:u}=r;const{code:c}=l.nativeEvent;if(i.start.includes(c)){const d=u.activatorNode.current;return d&&l.target!==d?!1:(l.preventDefault(),o==null||o({event:l.nativeEvent}),!0)}return!1}}];function pp(l){return!!(l&&"distance"in l)}function gp(l){return!!(l&&"delay"in l)}class Uf{constructor(t,r,i){var o;i===void 0&&(i=Ry(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;const{event:u}=t,{target:c}=u;this.props=t,this.events=r,this.document=Dl(c),this.documentListeners=new So(this.document),this.listeners=new So(i),this.windowListeners=new So(Yn(c)),this.initialCoordinates=(o=lu(u))!=null?o:Qr,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:i}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Pr.Resize,this.handleCancel),this.windowListeners.add(Pr.DragStart,hp),this.windowListeners.add(Pr.VisibilityChange,this.handleCancel),this.windowListeners.add(Pr.ContextMenu,hp),this.documentListeners.add(Pr.Keydown,this.handleKeydown),r){if(i!=null&&i({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(gp(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(pp(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,r){const{active:i,onPending:o}=this.props;o(i,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(Pr.Click,Ny,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Pr.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:i,initialCoordinates:o,props:u}=this,{onMove:c,options:{activationConstraint:d}}=u;if(!o)return;const p=(r=lu(t))!=null?r:Qr,m=su(o,p);if(!i&&d){if(pp(d)){if(d.tolerance!=null&&lf(m,d.tolerance))return this.handleCancel();if(lf(m,d.distance))return this.handleStart()}if(gp(d)&&lf(m,d.tolerance))return this.handleCancel();this.handlePending(d,m);return}t.cancelable&&t.preventDefault(),c(p)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===ut.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Ty={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Vf extends Uf{constructor(t){const{event:r}=t,i=Dl(r.target);super(t,Ty,i)}}Vf.activators=[{eventName:"onPointerDown",handler:(l,t)=>{let{nativeEvent:r}=l,{onActivation:i}=t;return!r.isPrimary||r.button!==0?!1:(i==null||i({event:r}),!0)}}];const zy={move:{name:"mousemove"},end:{name:"mouseup"}};var Ef;(function(l){l[l.RightClick=2]="RightClick"})(Ef||(Ef={}));class My extends Uf{constructor(t){super(t,zy,Dl(t.event.target))}}My.activators=[{eventName:"onMouseDown",handler:(l,t)=>{let{nativeEvent:r}=l,{onActivation:i}=t;return r.button===Ef.RightClick?!1:(i==null||i({event:r}),!0)}}];const of={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class by extends Uf{constructor(t){super(t,of)}static setup(){return window.addEventListener(of.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(of.move.name,t)};function t(){}}}by.activators=[{eventName:"onTouchStart",handler:(l,t)=>{let{nativeEvent:r}=l,{onActivation:i}=t;const{touches:o}=r;return o.length>1?!1:(i==null||i({event:r}),!0)}}];var xo;(function(l){l[l.Pointer=0]="Pointer",l[l.DraggableRect=1]="DraggableRect"})(xo||(xo={}));var au;(function(l){l[l.TreeOrder=0]="TreeOrder",l[l.ReversedTreeOrder=1]="ReversedTreeOrder"})(au||(au={}));function Oy(l){let{acceleration:t,activator:r=xo.Pointer,canScroll:i,draggingRect:o,enabled:u,interval:c=5,order:d=au.TreeOrder,pointerCoordinates:p,scrollableAncestors:m,scrollableAncestorRects:w,delta:v,threshold:x}=l;const z=Py({delta:v,disabled:!u}),[R,k]=Gv(),b=j.useRef({x:0,y:0}),W=j.useRef({x:0,y:0}),P=j.useMemo(()=>{switch(r){case xo.Pointer:return p?{top:p.y,bottom:p.y,left:p.x,right:p.x}:null;case xo.DraggableRect:return o}},[r,o,p]),B=j.useRef(null),V=j.useCallback(()=>{const G=B.current;if(!G)return;const Z=b.current.x*W.current.x,re=b.current.y*W.current.y;G.scrollBy(Z,re)},[]),ee=j.useMemo(()=>d===au.TreeOrder?[...m].reverse():m,[d,m]);j.useEffect(()=>{if(!u||!m.length||!P){k();return}for(const G of ee){if((i==null?void 0:i(G))===!1)continue;const Z=m.indexOf(G),re=w[Z];if(!re)continue;const{direction:ve,speed:de}=xy(G,re,P,t,x);for(const Y of["x","y"])z[Y][ve[Y]]||(de[Y]=0,ve[Y]=0);if(de.x>0||de.y>0){k(),B.current=G,R(V,c),b.current=de,W.current=ve;return}}b.current={x:0,y:0},W.current={x:0,y:0},k()},[t,V,i,k,u,c,JSON.stringify(P),JSON.stringify(z),R,m,ee,w,JSON.stringify(x)])}const Ly={x:{[pn.Backward]:!1,[pn.Forward]:!1},y:{[pn.Backward]:!1,[pn.Forward]:!1}};function Py(l){let{delta:t,disabled:r}=l;const i=iu(t);return Oo(o=>{if(r||!i||!o)return Ly;const u={x:Math.sign(t.x-i.x),y:Math.sign(t.y-i.y)};return{x:{[pn.Backward]:o.x[pn.Backward]||u.x===-1,[pn.Forward]:o.x[pn.Forward]||u.x===1},y:{[pn.Backward]:o.y[pn.Backward]||u.y===-1,[pn.Forward]:o.y[pn.Forward]||u.y===1}}},[r,t,i])}function Ay(l,t){const r=t!=null?l.get(t):void 0,i=r?r.node.current:null;return Oo(o=>{var u;return t==null?null:(u=i??o)!=null?u:null},[i,t])}function Iy(l,t){return j.useMemo(()=>l.reduce((r,i)=>{const{sensor:o}=i,u=o.activators.map(c=>({eventName:c.eventName,handler:t(c.handler,i)}));return[...r,...u]},[]),[l,t])}var Do;(function(l){l[l.Always=0]="Always",l[l.BeforeDragging=1]="BeforeDragging",l[l.WhileDragging=2]="WhileDragging"})(Do||(Do={}));var Cf;(function(l){l.Optimized="optimized"})(Cf||(Cf={}));const mp=new Map;function Hy(l,t){let{dragging:r,dependencies:i,config:o}=t;const[u,c]=j.useState(null),{frequency:d,measure:p,strategy:m}=o,w=j.useRef(l),v=b(),x=Ro(v),z=j.useCallback(function(W){W===void 0&&(W=[]),!x.current&&c(P=>P===null?W:P.concat(W.filter(B=>!P.includes(B))))},[x]),R=j.useRef(null),k=Oo(W=>{if(v&&!r)return mp;if(!W||W===mp||w.current!==l||u!=null){const P=new Map;for(let B of l){if(!B)continue;if(u&&u.length>0&&!u.includes(B.id)&&B.rect.current){P.set(B.id,B.rect.current);continue}const V=B.node.current,ee=V?new Bf(p(V),V):null;B.rect.current=ee,ee&&P.set(B.id,ee)}return P}return W},[l,u,r,v,p]);return j.useEffect(()=>{w.current=l},[l]),j.useEffect(()=>{v||z()},[r,v]),j.useEffect(()=>{u&&u.length>0&&c(null)},[JSON.stringify(u)]),j.useEffect(()=>{v||typeof d!="number"||R.current!==null||(R.current=setTimeout(()=>{z(),R.current=null},d))},[d,v,z,...i]),{droppableRects:k,measureDroppableContainers:z,measuringScheduled:u!=null};function b(){switch(m){case Do.Always:return!1;case Do.BeforeDragging:return r;default:return!r}}}function $f(l,t){return Oo(r=>l?r||(typeof t=="function"?t(l):l):null,[t,l])}function Fy(l,t){return $f(l,t)}function jy(l){let{callback:t,disabled:r}=l;const i=wu(t),o=j.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:u}=window;return new u(i)},[i,r]);return j.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function xu(l){let{callback:t,disabled:r}=l;const i=wu(t),o=j.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:u}=window;return new u(i)},[r]);return j.useEffect(()=>()=>o==null?void 0:o.disconnect(),[o]),o}function Wy(l){return new Bf(Lo(l),l)}function vp(l,t,r){t===void 0&&(t=Wy);const[i,o]=j.useState(null);function u(){o(p=>{if(!l)return null;if(l.isConnected===!1){var m;return(m=p??r)!=null?m:null}const w=t(l);return JSON.stringify(p)===JSON.stringify(w)?p:w})}const c=jy({callback(p){if(l)for(const m of p){const{type:w,target:v}=m;if(w==="childList"&&v instanceof HTMLElement&&v.contains(l)){u();break}}}}),d=xu({callback:u});return ki(()=>{u(),l?(d==null||d.observe(l),c==null||c.observe(document.body,{childList:!0,subtree:!0})):(d==null||d.disconnect(),c==null||c.disconnect())},[l]),i}function By(l){const t=$f(l);return Tg(l,t)}const yp=[];function Uy(l){const t=j.useRef(l),r=Oo(i=>l?i&&i!==yp&&l&&t.current&&l.parentNode===t.current.parentNode?i:Wf(l):yp,[l]);return j.useEffect(()=>{t.current=l},[l]),r}function Vy(l){const[t,r]=j.useState(null),i=j.useRef(l),o=j.useCallback(u=>{const c=sf(u.target);c&&r(d=>d?(d.set(c,_f(c)),new Map(d)):null)},[]);return j.useEffect(()=>{const u=i.current;if(l!==u){c(u);const d=l.map(p=>{const m=sf(p);return m?(m.addEventListener("scroll",o,{passive:!0}),[m,_f(m)]):null}).filter(p=>p!=null);r(d.length?new Map(d):null),i.current=l}return()=>{c(l),c(u)};function c(d){d.forEach(p=>{const m=sf(p);m==null||m.removeEventListener("scroll",o)})}},[o,l]),j.useMemo(()=>l.length?t?Array.from(t.values()).reduce((u,c)=>wl(u,c),Qr):Ag(l):Qr,[l,t])}function wp(l,t){t===void 0&&(t=[]);const r=j.useRef(null);return j.useEffect(()=>{r.current=null},t),j.useEffect(()=>{const i=l!==Qr;i&&!r.current&&(r.current=l),!i&&r.current&&(r.current=null)},[l]),r.current?su(l,r.current):Qr}function $y(l){j.useEffect(()=>{if(!yu)return;const t=l.map(r=>{let{sensor:i}=r;return i.setup==null?void 0:i.setup()});return()=>{for(const r of t)r==null||r()}},l.map(t=>{let{sensor:r}=t;return r}))}function Gy(l,t){return j.useMemo(()=>l.reduce((r,i)=>{let{eventName:o,handler:u}=i;return r[o]=c=>{u(c,t)},r},{}),[l,t])}function jg(l){return j.useMemo(()=>l?vy(l):null,[l])}const Sp=[];function Yy(l,t){t===void 0&&(t=Lo);const[r]=l,i=jg(r?Yn(r):null),[o,u]=j.useState(Sp);function c(){u(()=>l.length?l.map(p=>Lg(p)?i:new Bf(t(p),p)):Sp)}const d=xu({callback:c});return ki(()=>{d==null||d.disconnect(),c(),l.forEach(p=>d==null?void 0:d.observe(p))},[l]),o}function Wg(l){if(!l)return null;if(l.children.length>1)return l;const t=l.children[0];return bo(t)?t:l}function Ky(l){let{measure:t}=l;const[r,i]=j.useState(null),o=j.useCallback(m=>{for(const{target:w}of m)if(bo(w)){i(v=>{const x=t(w);return v?{...v,width:x.width,height:x.height}:x});break}},[t]),u=xu({callback:o}),c=j.useCallback(m=>{const w=Wg(m);u==null||u.disconnect(),w&&(u==null||u.observe(w)),i(w?t(w):null)},[t,u]),[d,p]=ru(c);return j.useMemo(()=>({nodeRef:d,rect:r,setRef:p}),[r,d,p])}const Qy=[{sensor:Vf,options:{}},{sensor:Fg,options:{}}],Xy={current:{}},qa={draggable:{measure:dp},droppable:{measure:dp,strategy:Do.WhileDragging,frequency:Cf.Optimized},dragOverlay:{measure:Lo}};class _o extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,i;return(r=(i=this.get(t))==null?void 0:i.node.current)!=null?r:void 0}}const qy={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new _o,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ou},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:qa,measureDroppableContainers:ou,windowRect:null,measuringScheduled:!1},Bg={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ou,draggableNodes:new Map,over:null,measureDroppableContainers:ou},Po=j.createContext(Bg),Ug=j.createContext(qy);function Jy(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new _o}}}function Zy(l,t){switch(t.type){case en.DragStart:return{...l,draggable:{...l.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case en.DragMove:return l.draggable.active==null?l:{...l,draggable:{...l.draggable,translate:{x:t.coordinates.x-l.draggable.initialCoordinates.x,y:t.coordinates.y-l.draggable.initialCoordinates.y}}};case en.DragEnd:case en.DragCancel:return{...l,draggable:{...l.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case en.RegisterDroppable:{const{element:r}=t,{id:i}=r,o=new _o(l.droppable.containers);return o.set(i,r),{...l,droppable:{...l.droppable,containers:o}}}case en.SetDroppableDisabled:{const{id:r,key:i,disabled:o}=t,u=l.droppable.containers.get(r);if(!u||i!==u.key)return l;const c=new _o(l.droppable.containers);return c.set(r,{...u,disabled:o}),{...l,droppable:{...l.droppable,containers:c}}}case en.UnregisterDroppable:{const{id:r,key:i}=t,o=l.droppable.containers.get(r);if(!o||i!==o.key)return l;const u=new _o(l.droppable.containers);return u.delete(r),{...l,droppable:{...l.droppable,containers:u}}}default:return l}}function e0(l){let{disabled:t}=l;const{active:r,activatorEvent:i,draggableNodes:o}=j.useContext(Po),u=iu(i),c=iu(r==null?void 0:r.id);return j.useEffect(()=>{if(!t&&!i&&u&&c!=null){if(!jf(u)||document.activeElement===u.target)return;const d=o.get(c);if(!d)return;const{activatorNode:p,node:m}=d;if(!p.current&&!m.current)return;requestAnimationFrame(()=>{for(const w of[p.current,m.current]){if(!w)continue;const v=Qv(w);if(v){v.focus();break}}})}},[i,t,o,c,u]),null}function Vg(l,t){let{transform:r,...i}=t;return l!=null&&l.length?l.reduce((o,u)=>u({transform:o,...i}),r):r}function t0(l){return j.useMemo(()=>({draggable:{...qa.draggable,...l==null?void 0:l.draggable},droppable:{...qa.droppable,...l==null?void 0:l.droppable},dragOverlay:{...qa.dragOverlay,...l==null?void 0:l.dragOverlay}}),[l==null?void 0:l.draggable,l==null?void 0:l.droppable,l==null?void 0:l.dragOverlay])}function n0(l){let{activeNode:t,measure:r,initialRect:i,config:o=!0}=l;const u=j.useRef(!1),{x:c,y:d}=typeof o=="boolean"?{x:o,y:o}:o;ki(()=>{if(!c&&!d||!t){u.current=!1;return}if(u.current||!i)return;const m=t==null?void 0:t.node.current;if(!m||m.isConnected===!1)return;const w=r(m),v=Tg(w,i);if(c||(v.x=0),d||(v.y=0),u.current=!0,Math.abs(v.x)>0||Math.abs(v.y)>0){const x=Mg(m);x&&x.scrollBy({top:v.y,left:v.x})}},[t,c,d,i,r])}const _u=j.createContext({...Qr,scaleX:1,scaleY:1});var ns;(function(l){l[l.Uninitialized=0]="Uninitialized",l[l.Initializing=1]="Initializing",l[l.Initialized=2]="Initialized"})(ns||(ns={}));const r0=j.memo(function(t){var r,i,o,u;let{id:c,accessibility:d,autoScroll:p=!0,children:m,sensors:w=Qy,collisionDetection:v=fy,measuring:x,modifiers:z,...R}=t;const k=j.useReducer(Zy,void 0,Jy),[b,W]=k,[P,B]=ty(),[V,ee]=j.useState(ns.Uninitialized),G=V===ns.Initialized,{draggable:{active:Z,nodes:re,translate:ve},droppable:{containers:de}}=b,Y=Z!=null?re.get(Z):null,Ce=j.useRef({initial:null,translated:null}),ae=j.useMemo(()=>{var lt;return Z!=null?{id:Z,data:(lt=Y==null?void 0:Y.data)!=null?lt:Xy,rect:Ce}:null},[Z,Y]),ye=j.useRef(null),[me,De]=j.useState(null),[le,ie]=j.useState(null),oe=Ro(R,Object.values(R)),X=Su("DndDescribedBy",c),D=j.useMemo(()=>de.getEnabled(),[de]),H=t0(x),{droppableRects:K,measureDroppableContainers:xe,measuringScheduled:be}=Hy(D,{dragging:G,dependencies:[ve.x,ve.y],config:H.droppable}),ge=Ay(re,Z),_e=j.useMemo(()=>le?lu(le):null,[le]),He=zt(),Fe=Fy(ge,H.draggable.measure);n0({activeNode:Z!=null?re.get(Z):null,config:He.layoutShiftCompensation,initialRect:Fe,measure:H.draggable.measure});const Oe=vp(ge,H.draggable.measure,Fe),$t=vp(ge?ge.parentElement:null),Pt=j.useRef({activatorEvent:null,active:null,activeNode:ge,collisionRect:null,collisions:null,droppableRects:K,draggableNodes:re,draggingNode:null,draggingNodeRect:null,droppableContainers:de,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),At=de.getNodeFor((r=Pt.current.over)==null?void 0:r.id),It=Ky({measure:H.dragOverlay.measure}),Kn=(i=It.nodeRef.current)!=null?i:ge,Cn=G?(o=It.rect)!=null?o:Oe:null,_r=!!(It.nodeRef.current&&It.rect),Xr=By(_r?null:Oe),Pn=jg(Kn?Yn(Kn):null),Ze=Uy(G?At??ge:null),nn=Yy(Ze),rn=Vg(z,{transform:{x:ve.x-Xr.x,y:ve.y-Xr.y,scaleX:1,scaleY:1},activatorEvent:le,active:ae,activeNodeRect:Oe,containerNodeRect:$t,draggingNodeRect:Cn,over:Pt.current.over,overlayNodeRect:It.rect,scrollableAncestors:Ze,scrollableAncestorRects:nn,windowRect:Pn}),sr=_e?wl(_e,ve):null,Pe=Vy(Ze),ce=wp(Pe),qe=wp(Pe,[Oe]),et=wl(rn,ce),sn=Cn?py(Cn,rn):null,kn=ae&&sn?v({active:ae,collisionRect:sn,droppableRects:K,droppableContainers:D,pointerCoordinates:sr}):null,Gt=uy(kn,"id"),[Rt,ln]=j.useState(null),mn=_r?rn:wl(rn,qe),Yt=dy(mn,(u=Rt==null?void 0:Rt.rect)!=null?u:null,Oe),vn=j.useRef(null),qr=j.useCallback((lt,Kt)=>{let{sensor:on,options:ar}=Kt;if(ye.current==null)return;const yn=re.get(ye.current);if(!yn)return;const an=lt.nativeEvent,Rn=new on({active:ye.current,activeNode:yn,event:an,options:ar,context:Pt,onAbort(We){if(!re.get(We))return;const{onDragAbort:_t}=oe.current,un={id:We};_t==null||_t(un),P({type:"onDragAbort",event:un})},onPending(We,xt,_t,un){if(!re.get(We))return;const{onDragPending:Sn}=oe.current,Ht={id:We,constraint:xt,initialCoordinates:_t,offset:un};Sn==null||Sn(Ht),P({type:"onDragPending",event:Ht})},onStart(We){const xt=ye.current;if(xt==null)return;const _t=re.get(xt);if(!_t)return;const{onDragStart:un}=oe.current,vt={activatorEvent:an,active:{id:xt,data:_t.data,rect:Ce}};bs.unstable_batchedUpdates(()=>{un==null||un(vt),ee(ns.Initializing),W({type:en.DragStart,initialCoordinates:We,active:xt}),P({type:"onDragStart",event:vt}),De(vn.current),ie(an)})},onMove(We){W({type:en.DragMove,coordinates:We})},onEnd:wn(en.DragEnd),onCancel:wn(en.DragCancel)});vn.current=Rn;function wn(We){return async function(){const{active:_t,collisions:un,over:vt,scrollAdjustedTranslate:Sn}=Pt.current;let Ht=null;if(_t&&Sn){const{cancelDrop:Er}=oe.current;Ht={activatorEvent:an,active:_t,collisions:un,delta:Sn,over:vt},We===en.DragEnd&&typeof Er=="function"&&await Promise.resolve(Er(Ht))&&(We=en.DragCancel)}ye.current=null,bs.unstable_batchedUpdates(()=>{W({type:We}),ee(ns.Uninitialized),ln(null),De(null),ie(null),vn.current=null;const Er=We===en.DragEnd?"onDragEnd":"onDragCancel";if(Ht){const Ri=oe.current[Er];Ri==null||Ri(Ht),P({type:Er,event:Ht})}})}}},[re]),Jr=j.useCallback((lt,Kt)=>(on,ar)=>{const yn=on.nativeEvent,an=re.get(ar);if(ye.current!==null||!an||yn.dndKit||yn.defaultPrevented)return;const Rn={active:an};lt(on,Kt.options,Rn)===!0&&(yn.dndKit={capturedBy:Kt.sensor},ye.current=ar,qr(on,Kt))},[re,qr]),lr=Iy(w,Jr);$y(w),ki(()=>{Oe&&V===ns.Initializing&&ee(ns.Initialized)},[Oe,V]),j.useEffect(()=>{const{onDragMove:lt}=oe.current,{active:Kt,activatorEvent:on,collisions:ar,over:yn}=Pt.current;if(!Kt||!on)return;const an={active:Kt,activatorEvent:on,collisions:ar,delta:{x:et.x,y:et.y},over:yn};bs.unstable_batchedUpdates(()=>{lt==null||lt(an),P({type:"onDragMove",event:an})})},[et.x,et.y]),j.useEffect(()=>{const{active:lt,activatorEvent:Kt,collisions:on,droppableContainers:ar,scrollAdjustedTranslate:yn}=Pt.current;if(!lt||ye.current==null||!Kt||!yn)return;const{onDragOver:an}=oe.current,Rn=ar.get(Gt),wn=Rn&&Rn.rect.current?{id:Rn.id,rect:Rn.rect.current,data:Rn.data,disabled:Rn.disabled}:null,We={active:lt,activatorEvent:Kt,collisions:on,delta:{x:yn.x,y:yn.y},over:wn};bs.unstable_batchedUpdates(()=>{ln(wn),an==null||an(We),P({type:"onDragOver",event:We})})},[Gt]),ki(()=>{Pt.current={activatorEvent:le,active:ae,activeNode:ge,collisionRect:sn,collisions:kn,droppableRects:K,draggableNodes:re,draggingNode:Kn,draggingNodeRect:Cn,droppableContainers:de,over:Rt,scrollableAncestors:Ze,scrollAdjustedTranslate:et},Ce.current={initial:Cn,translated:sn}},[ae,ge,kn,sn,re,Kn,Cn,K,de,Rt,Ze,et]),Oy({...He,delta:ve,draggingRect:sn,pointerCoordinates:sr,scrollableAncestors:Ze,scrollableAncestorRects:nn});const or=j.useMemo(()=>({active:ae,activeNode:ge,activeNodeRect:Oe,activatorEvent:le,collisions:kn,containerNodeRect:$t,dragOverlay:It,draggableNodes:re,droppableContainers:de,droppableRects:K,over:Rt,measureDroppableContainers:xe,scrollableAncestors:Ze,scrollableAncestorRects:nn,measuringConfiguration:H,measuringScheduled:be,windowRect:Pn}),[ae,ge,Oe,le,kn,$t,It,re,de,K,Rt,xe,Ze,nn,H,be,Pn]),Zr=j.useMemo(()=>({activatorEvent:le,activators:lr,active:ae,activeNodeRect:Oe,ariaDescribedById:{draggable:X},dispatch:W,draggableNodes:re,over:Rt,measureDroppableContainers:xe}),[le,lr,ae,Oe,W,X,re,Rt,xe]);return ht.createElement(Dg.Provider,{value:B},ht.createElement(Po.Provider,{value:Zr},ht.createElement(Ug.Provider,{value:or},ht.createElement(_u.Provider,{value:Yt},m)),ht.createElement(e0,{disabled:(d==null?void 0:d.restoreFocus)===!1})),ht.createElement(iy,{...d,hiddenTextDescribedById:X}));function zt(){const lt=(me==null?void 0:me.autoScrollEnabled)===!1,Kt=typeof p=="object"?p.enabled===!1:p===!1,on=G&&!lt&&!Kt;return typeof p=="object"?{...p,enabled:on}:{enabled:on}}}),i0=j.createContext(null),xp="button",s0="Draggable";function l0(l){let{id:t,data:r,disabled:i=!1,attributes:o}=l;const u=Su(s0),{activators:c,activatorEvent:d,active:p,activeNodeRect:m,ariaDescribedById:w,draggableNodes:v,over:x}=j.useContext(Po),{role:z=xp,roleDescription:R="draggable",tabIndex:k=0}=o??{},b=(p==null?void 0:p.id)===t,W=j.useContext(b?_u:i0),[P,B]=ru(),[V,ee]=ru(),G=Gy(c,t),Z=Ro(r);ki(()=>(v.set(t,{id:t,key:u,node:P,activatorNode:V,data:Z}),()=>{const ve=v.get(t);ve&&ve.key===u&&v.delete(t)}),[v,t]);const re=j.useMemo(()=>({role:z,tabIndex:k,"aria-disabled":i,"aria-pressed":b&&z===xp?!0:void 0,"aria-roledescription":R,"aria-describedby":w.draggable}),[i,z,k,b,R,w.draggable]);return{active:p,activatorEvent:d,activeNodeRect:m,attributes:re,isDragging:b,listeners:i?void 0:G,node:P,over:x,setNodeRef:B,setActivatorNodeRef:ee,transform:W}}function o0(){return j.useContext(Ug)}const a0="Droppable",u0={timeout:25};function c0(l){let{data:t,disabled:r=!1,id:i,resizeObserverConfig:o}=l;const u=Su(a0),{active:c,dispatch:d,over:p,measureDroppableContainers:m}=j.useContext(Po),w=j.useRef({disabled:r}),v=j.useRef(!1),x=j.useRef(null),z=j.useRef(null),{disabled:R,updateMeasurementsFor:k,timeout:b}={...u0,...o},W=Ro(k??i),P=j.useCallback(()=>{if(!v.current){v.current=!0;return}z.current!=null&&clearTimeout(z.current),z.current=setTimeout(()=>{m(Array.isArray(W.current)?W.current:[W.current]),z.current=null},b)},[b]),B=xu({callback:P,disabled:R||!c}),V=j.useCallback((re,ve)=>{B&&(ve&&(B.unobserve(ve),v.current=!1),re&&B.observe(re))},[B]),[ee,G]=ru(V),Z=Ro(t);return j.useEffect(()=>{!B||!ee.current||(B.disconnect(),v.current=!1,B.observe(ee.current))},[ee,B]),j.useEffect(()=>(d({type:en.RegisterDroppable,element:{id:i,key:u,disabled:r,node:ee,rect:x,data:Z}}),()=>d({type:en.UnregisterDroppable,key:u,id:i})),[i]),j.useEffect(()=>{r!==w.current.disabled&&(d({type:en.SetDroppableDisabled,id:i,key:u,disabled:r}),w.current.disabled=r)},[i,u,r,d]),{active:c,rect:x,isOver:(p==null?void 0:p.id)===i,node:ee,over:p,setNodeRef:G}}function f0(l){let{animation:t,children:r}=l;const[i,o]=j.useState(null),[u,c]=j.useState(null),d=iu(r);return!r&&!i&&d&&o(d),ki(()=>{if(!u)return;const p=i==null?void 0:i.key,m=i==null?void 0:i.props.id;if(p==null||m==null){o(null);return}Promise.resolve(t(m,u)).then(()=>{o(null)})},[t,i,u]),ht.createElement(ht.Fragment,null,r,i?j.cloneElement(i,{ref:c}):null)}const d0={x:0,y:0,scaleX:1,scaleY:1};function h0(l){let{children:t}=l;return ht.createElement(Po.Provider,{value:Bg},ht.createElement(_u.Provider,{value:d0},t))}const p0={position:"fixed",touchAction:"none"},g0=l=>jf(l)?"transform 250ms ease":void 0,m0=j.forwardRef((l,t)=>{let{as:r,activatorEvent:i,adjustScale:o,children:u,className:c,rect:d,style:p,transform:m,transition:w=g0}=l;if(!d)return null;const v=o?m:{...m,scaleX:1,scaleY:1},x={...p0,width:d.width,height:d.height,top:d.top,left:d.left,transform:No.Transform.toString(v),transformOrigin:o&&i?oy(i,d):void 0,transition:typeof w=="function"?w(i):w,...p};return ht.createElement(r,{className:c,style:x,ref:t},u)}),v0=l=>t=>{let{active:r,dragOverlay:i}=t;const o={},{styles:u,className:c}=l;if(u!=null&&u.active)for(const[d,p]of Object.entries(u.active))p!==void 0&&(o[d]=r.node.style.getPropertyValue(d),r.node.style.setProperty(d,p));if(u!=null&&u.dragOverlay)for(const[d,p]of Object.entries(u.dragOverlay))p!==void 0&&i.node.style.setProperty(d,p);return c!=null&&c.active&&r.node.classList.add(c.active),c!=null&&c.dragOverlay&&i.node.classList.add(c.dragOverlay),function(){for(const[p,m]of Object.entries(o))r.node.style.setProperty(p,m);c!=null&&c.active&&r.node.classList.remove(c.active)}},y0=l=>{let{transform:{initial:t,final:r}}=l;return[{transform:No.Transform.toString(t)},{transform:No.Transform.toString(r)}]},w0={duration:250,easing:"ease",keyframes:y0,sideEffects:v0({styles:{active:{opacity:"0"}}})};function S0(l){let{config:t,draggableNodes:r,droppableContainers:i,measuringConfiguration:o}=l;return wu((u,c)=>{if(t===null)return;const d=r.get(u);if(!d)return;const p=d.node.current;if(!p)return;const m=Wg(c);if(!m)return;const{transform:w}=Yn(c).getComputedStyle(c),v=zg(w);if(!v)return;const x=typeof t=="function"?t:x0(t);return Ig(p,o.draggable.measure),x({active:{id:u,data:d.data,node:p,rect:o.draggable.measure(p)},draggableNodes:r,dragOverlay:{node:c,rect:o.dragOverlay.measure(m)},droppableContainers:i,measuringConfiguration:o,transform:v})})}function x0(l){const{duration:t,easing:r,sideEffects:i,keyframes:o}={...w0,...l};return u=>{let{active:c,dragOverlay:d,transform:p,...m}=u;if(!t)return;const w={x:d.rect.left-c.rect.left,y:d.rect.top-c.rect.top},v={scaleX:p.scaleX!==1?c.rect.width*p.scaleX/d.rect.width:1,scaleY:p.scaleY!==1?c.rect.height*p.scaleY/d.rect.height:1},x={x:p.x-w.x,y:p.y-w.y,...v},z=o({...m,active:c,dragOverlay:d,transform:{initial:p,final:x}}),[R]=z,k=z[z.length-1];if(JSON.stringify(R)===JSON.stringify(k))return;const b=i==null?void 0:i({active:c,dragOverlay:d,...m}),W=d.node.animate(z,{duration:t,easing:r,fill:"forwards"});return new Promise(P=>{W.onfinish=()=>{b==null||b(),P()}})}}let _p=0;function _0(l){return j.useMemo(()=>{if(l!=null)return _p++,_p},[l])}const E0=ht.memo(l=>{let{adjustScale:t=!1,children:r,dropAnimation:i,style:o,transition:u,modifiers:c,wrapperElement:d="div",className:p,zIndex:m=999}=l;const{activatorEvent:w,active:v,activeNodeRect:x,containerNodeRect:z,draggableNodes:R,droppableContainers:k,dragOverlay:b,over:W,measuringConfiguration:P,scrollableAncestors:B,scrollableAncestorRects:V,windowRect:ee}=o0(),G=j.useContext(_u),Z=_0(v==null?void 0:v.id),re=Vg(c,{activatorEvent:w,active:v,activeNodeRect:x,containerNodeRect:z,draggingNodeRect:b.rect,over:W,overlayNodeRect:b.rect,scrollableAncestors:B,scrollableAncestorRects:V,transform:G,windowRect:ee}),ve=$f(x),de=S0({config:i,draggableNodes:R,droppableContainers:k,measuringConfiguration:P}),Y=ve?b.setRef:void 0;return ht.createElement(h0,null,ht.createElement(f0,{animation:de},v&&Z?ht.createElement(m0,{key:Z,id:v.id,ref:Y,as:d,activatorEvent:w,adjustScale:t,className:p,transition:u,rect:ve,style:{zIndex:m,...o},transform:re},r):null))}),Ep=l=>{let t;const r=new Set,i=(m,w)=>{const v=typeof m=="function"?m(t):m;if(!Object.is(v,t)){const x=t;t=w??(typeof v!="object"||v===null)?v:Object.assign({},t,v),r.forEach(z=>z(t,x))}},o=()=>t,d={setState:i,getState:o,getInitialState:()=>p,subscribe:m=>(r.add(m),()=>r.delete(m))},p=t=l(i,o,d);return d},C0=(l=>l?Ep(l):Ep),k0=l=>l;function R0(l,t=k0){const r=ht.useSyncExternalStore(l.subscribe,ht.useCallback(()=>t(l.getState()),[l,t]),ht.useCallback(()=>t(l.getInitialState()),[l,t]));return ht.useDebugValue(r),r}const Cp=l=>{const t=C0(l),r=i=>R0(t,i);return Object.assign(r,t),r},$g=(l=>l?Cp(l):Cp),Gg="damiao.monitor.plotConfigs";function N0(){try{return JSON.parse(localStorage.getItem(Gg)||"{}")}catch{return{}}}function D0(l){try{localStorage.setItem(Gg,JSON.stringify(l))}catch{}}const gn=$g((l,t)=>({connected:!1,status:null,signals:[],pairs:[],motors:[],motorTypes:[],plotConfigs:N0(),setConnected:r=>l({connected:r}),setStatus:r=>l({status:r}),setMeta:(r,i)=>l({signals:r,pairs:i}),setMotors:r=>l({motors:r}),setMotorTypes:r=>l({motorTypes:r}),ensurePlot:r=>l(i=>i.plotConfigs[r]?i:{plotConfigs:{...i.plotConfigs,[r]:{signals:[],duration:10}}}),setPlotConfig:(r,i)=>l(o=>({plotConfigs:{...o.plotConfigs,[r]:{...o.plotConfigs[r]||{signals:[],duration:10},...i}}})),addSignalToPlot:(r,i)=>l(o=>{const u=o.plotConfigs[r]||{signals:[],duration:10};return u.signals.includes(i)?o:{plotConfigs:{...o.plotConfigs,[r]:{...u,signals:[...u.signals,i]}}}}),removeSignalFromPlot:(r,i)=>l(o=>{const u=o.plotConfigs[r];return u?{plotConfigs:{...o.plotConfigs,[r]:{...u,signals:u.signals.filter(c=>c!==i)}}}:o}),dropPlot:r=>l(i=>{const o={...i.plotConfigs};return delete o[r],{plotConfigs:o}})}));gn.subscribe(l=>D0(l.plotConfigs));const Gf="damiao.monitor.widgets.v2";function T0(){try{const l=localStorage.getItem(Gf);if(!l)return null;const t=JSON.parse(l);return Array.isArray(t)&&t.length?t:null}catch{return null}}function af(l){try{localStorage.setItem(Gf,JSON.stringify(l))}catch{}}const kp=[{id:"plot-1",kind:"plot",x:0,y:0,w:7,h:6},{id:"cards-1",kind:"cards",x:7,y:0,w:5,h:6},{id:"table-1",kind:"table",x:0,y:6,w:7,h:5},{id:"rawlog-1",kind:"rawlog",x:7,y:6,w:5,h:5}];let Rp=1;const Eo=$g((l,t)=>({widgets:T0()||kp,addWidget:r=>{Rp+=1;const i=`${r}-${Date.now().toString(36)}-${Rp}`,o=t().widgets.reduce((d,p)=>Math.max(d,p.y+p.h),0),u={id:i,kind:r,x:0,y:o,w:6,h:5},c=[...t().widgets,u];return af(c),l({widgets:c}),i},removeWidget:r=>{const i=t().widgets.filter(o=>o.id!==r);af(i),l({widgets:i})},updateGeom:r=>{const i=new Map(r.map(u=>[u.id,u])),o=t().widgets.map(u=>{const c=i.get(u.id);return c?{...u,x:c.x,y:c.y,w:c.w,h:c.h}:u});af(o),l({widgets:o})},resetWidgets:()=>{try{localStorage.removeItem(Gf),localStorage.removeItem("damiao.monitor.plotConfigs")}catch{}l({widgets:kp.map(r=>({...r}))})}})),z0=!0,tn="u-",M0="uplot",b0=tn+"hz",O0=tn+"vt",L0=tn+"title",P0=tn+"wrap",A0=tn+"under",I0=tn+"over",H0=tn+"axis",Ms=tn+"off",F0=tn+"select",j0=tn+"cursor-x",W0=tn+"cursor-y",B0=tn+"cursor-pt",U0=tn+"legend",V0=tn+"live",$0=tn+"inline",G0=tn+"series",Y0=tn+"marker",Np=tn+"label",K0=tn+"value",vo="width",yo="height",po="top",Dp="bottom",gl="left",uf="right",Yf="#000",Tp=Yf+"0",cf="mousemove",zp="mousedown",ff="mouseup",Mp="mouseenter",bp="mouseleave",Op="dblclick",Q0="resize",X0="scroll",Lp="change",uu="dppxchange",Kf="--",Tl=typeof window<"u",kf=Tl?document:null,Sl=Tl?window:null,q0=Tl?navigator:null;let Je,Ka;function Rf(){let l=devicePixelRatio;Je!=l&&(Je=l,Ka&&Df(Lp,Ka,Rf),Ka=matchMedia(`(min-resolution: ${Je-.001}dppx) and (max-resolution: ${Je+.001}dppx)`),Os(Lp,Ka,Rf),Sl.dispatchEvent(new CustomEvent(uu)))}function wr(l,t){if(t!=null){let r=l.classList;!r.contains(t)&&r.add(t)}}function Nf(l,t){let r=l.classList;r.contains(t)&&r.remove(t)}function mt(l,t,r){l.style[t]=r+"px"}function $r(l,t,r,i){let o=kf.createElement(l);return t!=null&&wr(o,t),r!=null&&r.insertBefore(o,i),o}function Lr(l,t){return $r("div",l,t)}const Pp=new WeakMap;function oi(l,t,r,i,o){let u="translate("+t+"px,"+r+"px)",c=Pp.get(l);u!=c&&(l.style.transform=u,Pp.set(l,u),t<0||r<0||t>i||r>o?wr(l,Ms):Nf(l,Ms))}const Ap=new WeakMap;function Ip(l,t,r){let i=t+r,o=Ap.get(l);i!=o&&(Ap.set(l,i),l.style.background=t,l.style.borderColor=r)}const Hp=new WeakMap;function Fp(l,t,r,i){let o=t+""+r,u=Hp.get(l);o!=u&&(Hp.set(l,o),l.style.height=r+"px",l.style.width=t+"px",l.style.marginLeft=i?-t/2+"px":0,l.style.marginTop=i?-r/2+"px":0)}const Qf={passive:!0},J0={...Qf,capture:!0};function Os(l,t,r,i){t.addEventListener(l,r,i?J0:Qf)}function Df(l,t,r,i){t.removeEventListener(l,r,Qf)}Tl&&Rf();function Gr(l,t,r,i){let o;r=r||0,i=i||t.length-1;let u=i<=2147483647;for(;i-r>1;)o=u?r+i>>1:Sr((r+i)/2),t[o]{let u=-1,c=-1;for(let d=i;d<=o;d++)if(l(r[d])){u=d;break}for(let d=o;d>=i;d--)if(l(r[d])){c=d;break}return[u,c]}}const Kg=l=>l!=null,Qg=l=>l!=null&&l>0,Eu=Yg(Kg),Z0=Yg(Qg);function ew(l,t,r,i=0,o=!1){let u=o?Z0:Eu,c=o?Qg:Kg;[t,r]=u(l,t,r);let d=l[t],p=l[t];if(t>-1)if(i==1)d=l[t],p=l[r];else if(i==-1)d=l[r],p=l[t];else for(let m=t;m<=r;m++){let w=l[m];c(w)&&(wp&&(p=w))}return[d??ct,p??-ct]}function Cu(l,t,r,i){let o=Bp(l),u=Bp(t);l==t&&(o==-1?(l*=r,t/=r):(l/=r,t*=r));let c=r==10?Ei:Xg,d=o==1?Sr:Ar,p=u==1?Ar:Sr,m=d(c(Zt(l))),w=p(c(Zt(t))),v=_l(r,m),x=_l(r,w);return r==10&&(m<0&&(v=ft(v,-m)),w<0&&(x=ft(x,-w))),i||r==2?(l=v*o,t=x*u):(l=em(l,v),t=ku(t,x)),[l,t]}function Xf(l,t,r,i){let o=Cu(l,t,r,i);return l==0&&(o[0]=0),t==0&&(o[1]=0),o}const qf=.1,jp={mode:3,pad:qf},Co={pad:0,soft:null,mode:0},tw={min:Co,max:Co};function cu(l,t,r,i){return Ru(r)?Wp(l,t,r):(Co.pad=r,Co.soft=i?0:null,Co.mode=i?3:0,Wp(l,t,tw))}function Xe(l,t){return l??t}function nw(l,t,r){for(t=Xe(t,0),r=Xe(r,l.length-1);t<=r;){if(l[t]!=null)return!0;t++}return!1}function Wp(l,t,r){let i=r.min,o=r.max,u=Xe(i.pad,0),c=Xe(o.pad,0),d=Xe(i.hard,-ct),p=Xe(o.hard,ct),m=Xe(i.soft,ct),w=Xe(o.soft,-ct),v=Xe(i.mode,0),x=Xe(o.mode,0),z=t-l,R=Ei(z),k=Gn(Zt(l),Zt(t)),b=Ei(k),W=Zt(b-R);(z<1e-24||W>10)&&(z=0,(l==0||t==0)&&(z=1e-24,v==2&&m!=ct&&(u=0),x==2&&w!=-ct&&(c=0)));let P=z||k||1e3,B=Ei(P),V=_l(10,Sr(B)),ee=P*(z==0?l==0?.1:1:u),G=ft(em(l-ee,V/10),24),Z=l>=m&&(v==1||v==3&&G<=m||v==2&&G>=m)?m:ct,re=Gn(d,G=Z?Z:Yr(Z,G)),ve=P*(z==0?t==0?.1:1:c),de=ft(ku(t+ve,V/10),24),Y=t<=w&&(x==1||x==3&&de>=w||x==2&&de<=w)?w:-ct,Ce=Yr(p,de>Y&&t<=Y?Y:Gn(Y,de));return re==Ce&&re==0&&(Ce=100),[re,Ce]}const rw=new Intl.NumberFormat(Tl?q0.language:"en-US"),Jf=l=>rw.format(l),xr=Math,Ja=xr.PI,Zt=xr.abs,Sr=xr.floor,Jt=xr.round,Ar=xr.ceil,Yr=xr.min,Gn=xr.max,_l=xr.pow,Bp=xr.sign,Ei=xr.log10,Xg=xr.log2,iw=(l,t=1)=>xr.sinh(l)*t,df=(l,t=1)=>xr.asinh(l/t),ct=1/0;function Up(l){return(Ei((l^l>>31)-(l>>31))|0)+1}function Tf(l,t,r){return Yr(Gn(l,t),r)}function qg(l){return typeof l=="function"}function Ve(l){return qg(l)?l:()=>l}const sw=()=>{},Jg=l=>l,Zg=(l,t)=>t,lw=l=>null,Vp=l=>!0,$p=(l,t)=>l==t,ow=/\.\d*?(?=9{6,}|0{6,})/gm,Ps=l=>{if(nm(l)||is.has(l))return l;const t=`${l}`,r=t.match(ow);if(r==null)return l;let i=r[0].length-1;if(t.indexOf("e-")!=-1){let[o,u]=t.split("e");return+`${Ps(o)}e${u}`}return ft(l,i)};function Ts(l,t){return Ps(ft(Ps(l/t))*t)}function ku(l,t){return Ps(Ar(Ps(l/t))*t)}function em(l,t){return Ps(Sr(Ps(l/t))*t)}function ft(l,t=0){if(nm(l))return l;let r=10**t,i=l*r*(1+Number.EPSILON);return Jt(i)/r}const is=new Map;function tm(l){return((""+l).split(".")[1]||"").length}function To(l,t,r,i){let o=[],u=i.map(tm);for(let c=t;c=0?0:d)+(c>=u[m]?0:u[m]),x=l==10?w:ft(w,v);o.push(x),is.set(x,v)}}return o}const ko={},Zf=[],El=[null,null],rs=Array.isArray,nm=Number.isInteger,aw=l=>l===void 0;function Gp(l){return typeof l=="string"}function Ru(l){let t=!1;if(l!=null){let r=l.constructor;t=r==null||r==Object}return t}function uw(l){return l!=null&&typeof l=="object"}const cw=Object.getPrototypeOf(Uint8Array),rm="__proto__";function Cl(l,t=Ru){let r;if(rs(l)){let i=l.find(o=>o!=null);if(rs(i)||t(i)){r=Array(l.length);for(let o=0;ou){for(o=c-1;o>=0&&l[o]==null;)l[o--]=null;for(o=c+1;oc-d)],o=i[0].length,u=new Map;for(let c=0;c"u"?l=>Promise.resolve().then(l):queueMicrotask;function vw(l){let t=l[0],r=t.length,i=Array(r);for(let u=0;ut[u]-t[c]);let o=[];for(let u=0;u=i&&l[o]==null;)o--;if(o<=i)return!0;const u=Gn(1,Sr((o-i+1)/t));for(let c=l[i],d=i+u;d<=o;d+=u){const p=l[d];if(p!=null){if(p<=c)return!1;c=p}}return!0}const im=["January","February","March","April","May","June","July","August","September","October","November","December"],sm=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function lm(l){return l.slice(0,3)}const Sw=sm.map(lm),xw=im.map(lm),_w={MMMM:im,MMM:xw,WWWW:sm,WWW:Sw};function go(l){return(l<10?"0":"")+l}function Ew(l){return(l<10?"00":l<100?"0":"")+l}const Cw={YYYY:l=>l.getFullYear(),YY:l=>(l.getFullYear()+"").slice(2),MMMM:(l,t)=>t.MMMM[l.getMonth()],MMM:(l,t)=>t.MMM[l.getMonth()],MM:l=>go(l.getMonth()+1),M:l=>l.getMonth()+1,DD:l=>go(l.getDate()),D:l=>l.getDate(),WWWW:(l,t)=>t.WWWW[l.getDay()],WWW:(l,t)=>t.WWW[l.getDay()],HH:l=>go(l.getHours()),H:l=>l.getHours(),h:l=>{let t=l.getHours();return t==0?12:t>12?t-12:t},AA:l=>l.getHours()>=12?"PM":"AM",aa:l=>l.getHours()>=12?"pm":"am",a:l=>l.getHours()>=12?"p":"a",mm:l=>go(l.getMinutes()),m:l=>l.getMinutes(),ss:l=>go(l.getSeconds()),s:l=>l.getSeconds(),fff:l=>Ew(l.getMilliseconds())};function ed(l,t){t=t||_w;let r=[],i=/\{([a-z]+)\}|[^{]+/gi,o;for(;o=i.exec(l);)r.push(o[0][0]=="{"?Cw[o[1]]:o[0]);return u=>{let c="";for(let d=0;dl%1==0,fu=[1,2,2.5,5],Nw=To(10,-32,0,fu),am=To(10,0,32,fu),Dw=am.filter(om),zs=Nw.concat(am),td=` -`,um="{YYYY}",Yp=td+um,cm="{M}/{D}",wo=td+cm,Qa=wo+"/{YY}",fm="{aa}",Tw="{h}:{mm}",vl=Tw+fm,Kp=td+vl,Qp=":{ss}",nt=null;function dm(l){let t=l*1e3,r=t*60,i=r*60,o=i*24,u=o*30,c=o*365,p=(l==1?To(10,0,3,fu).filter(om):To(10,-3,0,fu)).concat([t,t*5,t*10,t*15,t*30,r,r*5,r*10,r*15,r*30,i,i*2,i*3,i*4,i*6,i*8,i*12,o,o*2,o*3,o*4,o*5,o*6,o*7,o*8,o*9,o*10,o*15,u,u*2,u*3,u*4,u*6,c,c*2,c*5,c*10,c*25,c*50,c*100]);const m=[[c,um,nt,nt,nt,nt,nt,nt,1],[o*28,"{MMM}",Yp,nt,nt,nt,nt,nt,1],[o,cm,Yp,nt,nt,nt,nt,nt,1],[i,"{h}"+fm,Qa,nt,wo,nt,nt,nt,1],[r,vl,Qa,nt,wo,nt,nt,nt,1],[t,Qp,Qa+" "+vl,nt,wo+" "+vl,nt,Kp,nt,1],[l,Qp+".{fff}",Qa+" "+vl,nt,wo+" "+vl,nt,Kp,nt,1]];function w(v){return(x,z,R,k,b,W)=>{let P=[],B=b>=c,V=b>=u&&b=o?o:b,de=Sr(R)-Sr(G),Y=re+de+ku(G-re,ve);P.push(Y);let Ce=v(Y),ae=Ce.getHours()+Ce.getMinutes()/r+Ce.getSeconds()/i,ye=b/i,me=x.axes[z]._space,De=W/me;for(;Y=ft(Y+b,l==1?0:3),!(Y>k);)if(ye>1){let le=Sr(ft(ae+ye,6))%24,X=v(Y).getHours()-le;X>1&&(X=-1),Y-=X*i,ae=(ae+ye)%24;let D=P[P.length-1];ft((Y-D)/b,3)*De>=.7&&P.push(Y)}else P.push(Y)}return P}}return[p,m,w]}const[zw,Mw,bw]=dm(1),[Ow,Lw,Pw]=dm(.001);To(2,-53,53,[1]);function Xp(l,t){return l.map(r=>r.map((i,o)=>o==0||o==8||i==null?i:t(o==1||r[8]==0?i:r[1]+i)))}function qp(l,t){return(r,i,o,u,c)=>{let d=t.find(R=>c>=R[0])||t[t.length-1],p,m,w,v,x,z;return i.map(R=>{let k=l(R),b=k.getFullYear(),W=k.getMonth(),P=k.getDate(),B=k.getHours(),V=k.getMinutes(),ee=k.getSeconds(),G=b!=p&&d[2]||W!=m&&d[3]||P!=w&&d[4]||B!=v&&d[5]||V!=x&&d[6]||ee!=z&&d[7]||d[1];return p=b,m=W,w=P,v=B,x=V,z=ee,G(k)})}}function Aw(l,t){let r=ed(t);return(i,o,u,c,d)=>o.map(p=>r(l(p)))}function hf(l,t,r){return new Date(l,t,r)}function Jp(l,t){return t(l)}const Iw="{YYYY}-{MM}-{DD} {h}:{mm}{aa}";function Zp(l,t){return(r,i,o,u)=>u==null?Kf:t(l(i))}function Hw(l,t){let r=l.series[t];return r.width?r.stroke(l,t):r.points.width?r.points.stroke(l,t):null}function Fw(l,t){return l.series[t].fill(l,t)}const jw={show:!0,live:!0,isolate:!1,mount:sw,markers:{show:!0,width:2,stroke:Hw,fill:Fw,dash:"solid"},idx:null,idxs:null,values:[]};function Ww(l,t){let r=l.cursor.points,i=Lr(),o=r.size(l,t);mt(i,vo,o),mt(i,yo,o);let u=o/-2;mt(i,"marginLeft",u),mt(i,"marginTop",u);let c=r.width(l,t,o);return c&&mt(i,"borderWidth",c),i}function Bw(l,t){let r=l.series[t].points;return r._fill||r._stroke}function Uw(l,t){let r=l.series[t].points;return r._stroke||r._fill}function Vw(l,t){return l.series[t].points.size}const pf=[0,0];function $w(l,t,r){return pf[0]=t,pf[1]=r,pf}function Xa(l,t,r,i=!0){return o=>{o.button==0&&(!i||o.target==t)&&r(o)}}function gf(l,t,r,i=!0){return o=>{(!i||o.target==t)&&r(o)}}const Gw={show:!0,x:!0,y:!0,lock:!1,move:$w,points:{one:!1,show:Ww,size:Vw,width:0,stroke:Uw,fill:Bw},bind:{mousedown:Xa,mouseup:Xa,click:Xa,dblclick:Xa,mousemove:gf,mouseleave:gf,mouseenter:gf},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,click:(l,t)=>{t.stopPropagation(),t.stopImmediatePropagation()},_x:!1,_y:!1},focus:{dist:(l,t,r,i,o)=>i-o,prox:-1,bias:0},hover:{skip:[void 0],prox:null,bias:0},left:-10,top:-10,idx:null,dataIdx:null,idxs:null,event:null},hm={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},nd=Vt({},hm,{filter:Zg}),pm=Vt({},nd,{size:10}),gm=Vt({},hm,{show:!1}),rd='12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',mm="bold "+rd,vm=1.5,eg={show:!0,scale:"x",stroke:Yf,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:mm,side:2,grid:nd,ticks:pm,border:gm,font:rd,lineGap:vm,rotate:0},Yw="Value",Kw="Time",tg={show:!0,scale:"x",auto:!1,sorted:1,min:ct,max:-ct,idxs:[]};function Qw(l,t,r,i,o){return t.map(u=>u==null?"":Jf(u))}function Xw(l,t,r,i,o,u,c){let d=[],p=is.get(o)||0;r=c?r:ft(ku(r,o),p);for(let m=r;m<=i;m=ft(m+o,p))d.push(Object.is(m,-0)?0:m);return d}function zf(l,t,r,i,o,u,c){const d=[],p=l.scales[l.axes[t].scale].log,m=p==10?Ei:Xg,w=Sr(m(r));o=_l(p,w),p==10&&(o=zs[Gr(o,zs)]);let v=r,x=o*p;p==10&&(x=zs[Gr(x,zs)]);do d.push(v),v=v+o,p==10&&!is.has(v)&&(v=ft(v,is.get(o))),v>=x&&(o=v,x=o*p,p==10&&(x=zs[Gr(x,zs)]));while(v<=i);return d}function qw(l,t,r,i,o,u,c){let p=l.scales[l.axes[t].scale].asinh,m=i>p?zf(l,t,Gn(p,r),i,o):[p],w=i>=0&&r<=0?[0]:[];return(r<-p?zf(l,t,Gn(p,-i),-r,o):[p]).reverse().map(x=>-x).concat(w,m)}const ym=/./,Jw=/[12357]/,Zw=/[125]/,ng=/1/,Mf=(l,t,r,i)=>l.map((o,u)=>t==4&&o==0||u%i==0&&r.test(o.toExponential()[o<0?1:0])?o:null);function e1(l,t,r,i,o){let u=l.axes[r],c=u.scale,d=l.scales[c],p=l.valToPos,m=u._space,w=p(10,c),v=p(9,c)-w>=m?ym:p(7,c)-w>=m?Jw:p(5,c)-w>=m?Zw:ng;if(v==ng){let x=Zt(p(1,c)-w);if(xo,sg={show:!0,auto:!0,sorted:0,gaps:wm,alpha:1,facets:[Vt({},ig,{scale:"x"}),Vt({},ig,{scale:"y"})]},lg={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:wm,alpha:1,points:{show:i1,filter:null},values:null,min:ct,max:-ct,idxs:[],path:null,clip:null};function s1(l,t,r,i,o){return r/10}const Sm={time:z0,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},l1=Vt({},Sm,{time:!1,ori:1}),og={};function xm(l,t){let r=og[l];return r||(r={key:l,plots:[],sub(i){r.plots.push(i)},unsub(i){r.plots=r.plots.filter(o=>o!=i)},pub(i,o,u,c,d,p,m){for(let w=0;w{let W=c.pxRound;const P=m.dir*(m.ori==0?1:-1),B=m.ori==0?zl:Ml;let V,ee;P==1?(V=r,ee=i):(V=i,ee=r);let G=W(v(d[V],m,k,z)),Z=W(x(p[V],w,b,R)),re=W(v(d[ee],m,k,z)),ve=W(x(u==1?w.max:w.min,w,b,R)),de=new Path2D(o);return B(de,re,ve),B(de,G,ve),B(de,G,Z),de})}function Nu(l,t,r,i,o,u){let c=null;if(l.length>0){c=new Path2D;const d=t==0?zu:ld;let p=r;for(let v=0;vx[0]){let z=x[0]-p;z>0&&d(c,p,i,z,i+u),p=x[1]}}let m=r+o-p,w=10;m>0&&d(c,p,i-w/2,m,i+u+w)}return c}function a1(l,t,r){let i=l[l.length-1];i&&i[0]==t?i[1]=r:l.push([t,r])}function sd(l,t,r,i,o,u,c){let d=[],p=l.length;for(let m=o==1?r:i;m>=r&&m<=i;m+=o)if(t[m]===null){let v=m,x=m;if(o==1)for(;++m<=i&&t[m]===null;)x=m;else for(;--m>=r&&t[m]===null;)x=m;let z=u(l[v]),R=x==v?z:u(l[x]),k=v-o;z=c<=0&&k>=0&&k=0&&W>=0&&W=z&&d.push([z,R])}return d}function ag(l){return l==0?Jg:l==1?Jt:t=>Ts(t,l)}function _m(l){let t=l==0?Du:Tu,r=l==0?(o,u,c,d,p,m)=>{o.arcTo(u,c,d,p,m)}:(o,u,c,d,p,m)=>{o.arcTo(c,u,p,d,m)},i=l==0?(o,u,c,d,p)=>{o.rect(u,c,d,p)}:(o,u,c,d,p)=>{o.rect(c,u,p,d)};return(o,u,c,d,p,m=0,w=0)=>{m==0&&w==0?i(o,u,c,d,p):(m=Yr(m,d/2,p/2),w=Yr(w,d/2,p/2),t(o,u+m,c),r(o,u+d,c,u+d,c+p,m),r(o,u+d,c+p,u,c+p,w),r(o,u,c+p,u,c,w),r(o,u,c,u+d,c,m),o.closePath())}}const Du=(l,t,r)=>{l.moveTo(t,r)},Tu=(l,t,r)=>{l.moveTo(r,t)},zl=(l,t,r)=>{l.lineTo(t,r)},Ml=(l,t,r)=>{l.lineTo(r,t)},zu=_m(0),ld=_m(1),Em=(l,t,r,i,o,u)=>{l.arc(t,r,i,o,u)},Cm=(l,t,r,i,o,u)=>{l.arc(r,t,i,o,u)},km=(l,t,r,i,o,u,c)=>{l.bezierCurveTo(t,r,i,o,u,c)},Rm=(l,t,r,i,o,u,c)=>{l.bezierCurveTo(r,t,o,i,c,u)};function Nm(l){return(t,r,i,o,u)=>As(t,r,(c,d,p,m,w,v,x,z,R,k,b)=>{let{pxRound:W,points:P}=c,B,V;m.ori==0?(B=Du,V=Em):(B=Tu,V=Cm);const ee=ft(P.width*Je,3);let G=(P.size-P.width)/2*Je,Z=ft(G*2,3),re=new Path2D,ve=new Path2D,{left:de,top:Y,width:Ce,height:ae}=t.bbox;zu(ve,de-Z,Y-Z,Ce+Z*2,ae+Z*2);const ye=me=>{if(p[me]!=null){let De=W(v(d[me],m,k,z)),le=W(x(p[me],w,b,R));B(re,De+G,le),V(re,De,le,G,0,Ja*2)}};if(u)u.forEach(ye);else for(let me=i;me<=o;me++)ye(me);return{stroke:ee>0?re:null,fill:re,clip:ve,flags:kl|bf}})}function Dm(l){return(t,r,i,o,u,c)=>{i!=o&&(u!=i&&c!=i&&l(t,r,i),u!=o&&c!=o&&l(t,r,o),l(t,r,c))}}const u1=Dm(zl),c1=Dm(Ml);function Tm(l){const t=Xe(l==null?void 0:l.alignGaps,0);return(r,i,o,u)=>As(r,i,(c,d,p,m,w,v,x,z,R,k,b)=>{[o,u]=Eu(p,o,u);let W=c.pxRound,P=ae=>W(v(ae,m,k,z)),B=ae=>W(x(ae,w,b,R)),V,ee;m.ori==0?(V=zl,ee=u1):(V=Ml,ee=c1);const G=m.dir*(m.ori==0?1:-1),Z={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:kl},re=Z.stroke;let ve=!1;if(u-o>=k*4){let ae=K=>r.posToVal(K,m.key,!0),ye=null,me=null,De,le,ie,oe=P(d[G==1?o:u]),X=P(d[o]),D=P(d[u]),H=ae(G==1?X+1:D-1);for(let K=G==1?o:u;K>=o&&K<=u;K+=G){let xe=d[K],ge=(G==1?xeH)?oe:P(xe),_e=p[K];ge==oe?_e!=null?(le=_e,ye==null?(V(re,ge,B(le)),De=ye=me=le):leme&&(me=le)):_e===null&&(ve=!0):(ye!=null&&ee(re,oe,B(ye),B(me),B(De),B(le)),_e!=null?(le=_e,V(re,ge,B(le)),ye=me=De=le):(ye=me=null,_e===null&&(ve=!0)),oe=ge,H=ae(oe+G))}ye!=null&&ye!=me&&ie!=oe&&ee(re,oe,B(ye),B(me),B(De),B(le))}else for(let ae=G==1?o:u;ae>=o&&ae<=u;ae+=G){let ye=p[ae];ye===null?ve=!0:ye!=null&&V(re,P(d[ae]),B(ye))}let[Y,Ce]=id(r,i);if(c.fill!=null||Y!=0){let ae=Z.fill=new Path2D(re),ye=c.fillTo(r,i,c.min,c.max,Y),me=B(ye),De=P(d[o]),le=P(d[u]);G==-1&&([le,De]=[De,le]),V(ae,le,me),V(ae,De,me)}if(!c.spanGaps){let ae=[];ve&&ae.push(...sd(d,p,o,u,G,P,t)),Z.gaps=ae=c.gaps(r,i,o,u,ae),Z.clip=Nu(ae,m.ori,z,R,k,b)}return Ce!=0&&(Z.band=Ce==2?[Ci(r,i,o,u,re,-1),Ci(r,i,o,u,re,1)]:Ci(r,i,o,u,re,Ce)),Z})}function f1(l){const t=Xe(l.align,1),r=Xe(l.ascDesc,!1),i=Xe(l.alignGaps,0),o=Xe(l.extend,!1);return(u,c,d,p)=>As(u,c,(m,w,v,x,z,R,k,b,W,P,B)=>{[d,p]=Eu(v,d,p);let V=m.pxRound,{left:ee,width:G}=u.bbox,Z=X=>V(R(X,x,P,b)),re=X=>V(k(X,z,B,W)),ve=x.ori==0?zl:Ml;const de={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:kl},Y=de.stroke,Ce=x.dir*(x.ori==0?1:-1);let ae=re(v[Ce==1?d:p]),ye=Z(w[Ce==1?d:p]),me=ye,De=ye;o&&t==-1&&(De=ee,ve(Y,De,ae)),ve(Y,ye,ae);for(let X=Ce==1?d:p;X>=d&&X<=p;X+=Ce){let D=v[X];if(D==null)continue;let H=Z(w[X]),K=re(D);t==1?ve(Y,H,ae):ve(Y,me,K),ve(Y,H,K),ae=K,me=H}let le=me;o&&t==1&&(le=ee+G,ve(Y,le,ae));let[ie,oe]=id(u,c);if(m.fill!=null||ie!=0){let X=de.fill=new Path2D(Y),D=m.fillTo(u,c,m.min,m.max,ie),H=re(D);ve(X,le,H),ve(X,De,H)}if(!m.spanGaps){let X=[];X.push(...sd(w,v,d,p,Ce,Z,i));let D=m.width*Je/2,H=r||t==1?D:-D,K=r||t==-1?-D:D;X.forEach(xe=>{xe[0]+=H,xe[1]+=K}),de.gaps=X=m.gaps(u,c,d,p,X),de.clip=Nu(X,x.ori,b,W,P,B)}return oe!=0&&(de.band=oe==2?[Ci(u,c,d,p,Y,-1),Ci(u,c,d,p,Y,1)]:Ci(u,c,d,p,Y,oe)),de})}function ug(l,t,r,i,o,u,c=ct){if(l.length>1){let d=null;for(let p=0,m=1/0;p{}),{fill:v,stroke:x}=m;return(z,R,k,b)=>As(z,R,(W,P,B,V,ee,G,Z,re,ve,de,Y)=>{let Ce=W.pxRound,ae=r,ye=i*Je,me=d*Je,De=p*Je,le,ie;V.ori==0?[le,ie]=u(z,R):[ie,le]=u(z,R);const oe=V.dir*(V.ori==0?1:-1);let X=V.ori==0?zu:ld,D=V.ori==0?w:(ce,qe,et,sn,kn,Gt,Rt)=>{w(ce,qe,et,kn,sn,Rt,Gt)},H=Xe(z.bands,Zf).find(ce=>ce.series[0]==R),K=H!=null?H.dir:0,xe=W.fillTo(z,R,W.min,W.max,K),be=Ce(Z(xe,ee,Y,ve)),ge,_e,He,Fe=de,Oe=Ce(W.width*Je),$t=!1,Pt=null,At=null,It=null,Kn=null;v!=null&&(Oe==0||x!=null)&&($t=!0,Pt=v.values(z,R,k,b),At=new Map,new Set(Pt).forEach(ce=>{ce!=null&&At.set(ce,new Path2D)}),Oe>0&&(It=x.values(z,R,k,b),Kn=new Map,new Set(It).forEach(ce=>{ce!=null&&Kn.set(ce,new Path2D)})));let{x0:Cn,size:_r}=m;if(Cn!=null&&_r!=null){ae=1,P=Cn.values(z,R,k,b),Cn.unit==2&&(P=P.map(et=>z.posToVal(re+et*de,V.key,!0)));let ce=_r.values(z,R,k,b);_r.unit==2?_e=ce[0]*de:_e=G(ce[0],V,de,re)-G(0,V,de,re),Fe=ug(P,B,G,V,de,re,Fe),He=Fe-_e+ye}else Fe=ug(P,B,G,V,de,re,Fe),He=Fe*c+ye,_e=Fe-He;He<1&&(He=0),Oe>=_e/2&&(Oe=0),He<5&&(Ce=Jg);let Xr=He>0,Pn=Fe-He-(Xr?Oe:0);_e=Ce(Tf(Pn,De,me)),ge=(ae==0?_e/2:ae==oe?0:_e)-ae*oe*((ae==0?ye/2:0)+(Xr?Oe/2:0));const Ze={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},nn=$t?null:new Path2D;let rn=null;if(H!=null)rn=z.data[H.series[1]];else{let{y0:ce,y1:qe}=m;ce!=null&&qe!=null&&(B=qe.values(z,R,k,b),rn=ce.values(z,R,k,b))}let sr=le*_e,Pe=ie*_e;for(let ce=oe==1?k:b;ce>=k&&ce<=b;ce+=oe){let qe=B[ce];if(qe==null)continue;if(rn!=null){let Yt=rn[ce]??0;if(qe-Yt==0)continue;be=Z(Yt,ee,Y,ve)}let et=V.distr!=2||m!=null?P[ce]:ce,sn=G(et,V,de,re),kn=Z(Xe(qe,xe),ee,Y,ve),Gt=Ce(sn-ge),Rt=Ce(Gn(kn,be)),ln=Ce(Yr(kn,be)),mn=Rt-ln;if(qe!=null){let Yt=qe<0?Pe:sr,vn=qe<0?sr:Pe;$t?(Oe>0&&It[ce]!=null&&X(Kn.get(It[ce]),Gt,ln+Sr(Oe/2),_e,Gn(0,mn-Oe),Yt,vn),Pt[ce]!=null&&X(At.get(Pt[ce]),Gt,ln+Sr(Oe/2),_e,Gn(0,mn-Oe),Yt,vn)):X(nn,Gt,ln+Sr(Oe/2),_e,Gn(0,mn-Oe),Yt,vn),D(z,R,ce,Gt-Oe/2,ln,_e+Oe,mn)}}return Oe>0?Ze.stroke=$t?Kn:nn:$t||(Ze._fill=W.width==0?W._fill:W._stroke??W._fill,Ze.width=0),Ze.fill=$t?At:nn,Ze})}function h1(l,t){const r=Xe(t==null?void 0:t.alignGaps,0);return(i,o,u,c)=>As(i,o,(d,p,m,w,v,x,z,R,k,b,W)=>{[u,c]=Eu(m,u,c);let P=d.pxRound,B=le=>P(x(le,w,b,R)),V=le=>P(z(le,v,W,k)),ee,G,Z;w.ori==0?(ee=Du,Z=zl,G=km):(ee=Tu,Z=Ml,G=Rm);const re=w.dir*(w.ori==0?1:-1);let ve=B(p[re==1?u:c]),de=ve,Y=[],Ce=[];for(let le=re==1?u:c;le>=u&&le<=c;le+=re)if(m[le]!=null){let oe=p[le],X=B(oe);Y.push(de=X),Ce.push(V(m[le]))}const ae={stroke:l(Y,Ce,ee,Z,G,P),fill:null,clip:null,band:null,gaps:null,flags:kl},ye=ae.stroke;let[me,De]=id(i,o);if(d.fill!=null||me!=0){let le=ae.fill=new Path2D(ye),ie=d.fillTo(i,o,d.min,d.max,me),oe=V(ie);Z(le,de,oe),Z(le,ve,oe)}if(!d.spanGaps){let le=[];le.push(...sd(p,m,u,c,re,B,r)),ae.gaps=le=d.gaps(i,o,u,c,le),ae.clip=Nu(le,w.ori,R,k,b,W)}return De!=0&&(ae.band=De==2?[Ci(i,o,u,c,ye,-1),Ci(i,o,u,c,ye,1)]:Ci(i,o,u,c,ye,De)),ae})}function p1(l){return h1(g1,l)}function g1(l,t,r,i,o,u){const c=l.length;if(c<2)return null;const d=new Path2D;if(r(d,l[0],t[0]),c==2)i(d,l[1],t[1]);else{let p=Array(c),m=Array(c-1),w=Array(c-1),v=Array(c-1);for(let x=0;x0!=m[x]>0?p[x]=0:(p[x]=3*(v[x-1]+v[x])/((2*v[x]+v[x-1])/m[x-1]+(v[x]+2*v[x-1])/m[x]),isFinite(p[x])||(p[x]=0));p[c-1]=m[c-2];for(let x=0;x{Ln.pxRatio=Je}));const m1=Tm(),v1=Nm();function fg(l,t,r,i){return(i?[l[0],l[1]].concat(l.slice(2)):[l[0]].concat(l.slice(1))).map((u,c)=>Lf(u,c,t,r))}function y1(l,t){return l.map((r,i)=>i==0?{}:Vt({},t,r))}function Lf(l,t,r,i){return Vt({},t==0?r:i,l)}function zm(l,t,r){return t==null?El:[t,r]}const w1=zm;function S1(l,t,r){return t==null?El:cu(t,r,qf,!0)}function Mm(l,t,r,i){return t==null?El:Cu(t,r,l.scales[i].log,!1)}const x1=Mm;function bm(l,t,r,i){return t==null?El:Xf(t,r,l.scales[i].log,!1)}const _1=bm;function E1(l,t,r,i,o){let u=Gn(Up(l),Up(t)),c=t-l,d=Gr(o/i*c,r);do{let p=r[d],m=i*p/c;if(m>=o&&u+(p<5?is.get(p):0)<=17)return[p,m]}while(++d(t=Jt((r=+o)*Je))+"px"),[l,t,r]}function C1(l){l.show&&[l.font,l.labelFont].forEach(t=>{let r=ft(t[2]*Je,1);t[0]=t[0].replace(/[0-9.]+px/,r+"px"),t[1]=r})}function Ln(l,t,r){const i={mode:Xe(l.mode,1)},o=i.mode;function u(g,S,_,E){let T=S.valToPct(g);return E+_*(S.dir==-1?1-T:T)}function c(g,S,_,E){let T=S.valToPct(g);return E+_*(S.dir==-1?T:1-T)}function d(g,S,_,E){return S.ori==0?u(g,S,_,E):c(g,S,_,E)}i.valToPosH=u,i.valToPosV=c;let p=!1;i.status=0;const m=i.root=Lr(M0);if(l.id!=null&&(m.id=l.id),wr(m,l.class),l.title){let g=Lr(L0,m);g.textContent=l.title}const w=$r("canvas"),v=i.ctx=w.getContext("2d"),x=Lr(P0,m);Os("click",x,g=>{g.target===R&&(Ke!=fi||rt!=Ii)&&Qt.click(i,g)},!0);const z=i.under=Lr(A0,x);x.appendChild(w);const R=i.over=Lr(I0,x);l=Cl(l);const k=+Xe(l.pxAlign,1),b=ag(k);(l.plugins||[]).forEach(g=>{g.opts&&(l=g.opts(i,l)||l)});const W=l.ms||.001,P=i.series=o==1?fg(l.series||[],tg,lg,!1):y1(l.series||[null],sg),B=i.axes=fg(l.axes||[],eg,rg,!0),V=i.scales={},ee=i.bands=l.bands||[];ee.forEach(g=>{g.fill=Ve(g.fill||null),g.dir=Xe(g.dir,-1)});const G=o==2?P[1].facets[0].scale:P[0].scale,Z={axes:Bo,series:Pu},re=(l.drawOrder||["axes","series"]).map(g=>Z[g]);function ve(g){const S=g.distr==3?_=>Ei(_>0?_:g.clamp(i,_,g.min,g.max,g.key)):g.distr==4?_=>df(_,g.asinh):g.distr==100?_=>g.fwd(_):_=>_;return _=>{let E=S(_),{_min:T,_max:L}=g,$=L-T;return(E-T)/$}}function de(g){let S=V[g];if(S==null){let _=(l.scales||ko)[g]||ko;if(_.from!=null){de(_.from);let E=Vt({},V[_.from],_,{key:g});E.valToPct=ve(E),V[g]=E}else{S=V[g]=Vt({},g==G?Sm:l1,_),S.key=g;let E=S.time,T=S.range,L=rs(T);if((g!=G||o==2&&!E)&&(L&&(T[0]==null||T[1]==null)&&(T={min:T[0]==null?jp:{mode:1,hard:T[0],soft:T[0]},max:T[1]==null?jp:{mode:1,hard:T[1],soft:T[1]}},L=!1),!L&&Ru(T))){let $=T;T=(q,ne,ue)=>ne==null?El:cu(ne,ue,$)}S.range=Ve(T||(E?w1:g==G?S.distr==3?x1:S.distr==4?_1:zm:S.distr==3?Mm:S.distr==4?bm:S1)),S.auto=Ve(L?!1:S.auto),S.clamp=Ve(S.clamp||s1),S._min=S._max=null,S.valToPct=ve(S)}}}de("x"),de("y"),o==1&&P.forEach(g=>{de(g.scale)}),B.forEach(g=>{de(g.scale)});for(let g in l.scales)de(g);const Y=V[G],Ce=Y.distr;let ae,ye;Y.ori==0?(wr(m,b0),ae=u,ye=c):(wr(m,O0),ae=c,ye=u);const me={};for(let g in V){let S=V[g];(S.min!=null||S.max!=null)&&(me[g]={min:S.min,max:S.max},S.min=S.max=null)}const De=l.tzDate||(g=>new Date(Jt(g/W))),le=l.fmtDate||ed,ie=W==1?bw(De):Pw(De),oe=qp(De,Xp(W==1?Mw:Lw,le)),X=Zp(De,Jp(Iw,le)),D=[],H=i.legend=Vt({},jw,l.legend),K=i.cursor=Vt({},Gw,{drag:{y:o==2}},l.cursor),xe=H.show,be=K.show,ge=H.markers;H.idxs=D,ge.width=Ve(ge.width),ge.dash=Ve(ge.dash),ge.stroke=Ve(ge.stroke),ge.fill=Ve(ge.fill);let _e,He,Fe,Oe=[],$t=[],Pt,At=!1,It={};if(H.live){const g=P[1]?P[1].values:null;At=g!=null,Pt=At?g(i,1,0):{_:0};for(let S in Pt)It[S]=Kf}if(xe)if(_e=$r("table",U0,m),Fe=$r("tbody",null,_e),H.mount(i,_e),At){He=$r("thead",null,_e,Fe);let g=$r("tr",null,He);$r("th",null,g);for(var Kn in Pt)$r("th",Np,g).textContent=Kn}else wr(_e,$0),H.live&&wr(_e,V0);const Cn={show:!0},_r={show:!1};function Xr(g,S){if(S==0&&(At||!H.live||o==2))return El;let _=[],E=$r("tr",G0,Fe,Fe.childNodes[S]);wr(E,g.class),g.show||wr(E,Ms);let T=$r("th",null,E);if(ge.show){let q=Lr(Y0,T);if(S>0){let ne=ge.width(i,S);ne&&(q.style.border=ne+"px "+ge.dash(i,S)+" "+ge.stroke(i,S)),q.style.background=ge.fill(i,S)}}let L=Lr(Np,T);g.label instanceof HTMLElement?L.appendChild(g.label):L.textContent=g.label,S>0&&(ge.show||(L.style.color=g.width>0?ge.stroke(i,S):ge.fill(i,S)),Ze("click",T,q=>{if(K._lock)return;wn(q);let ne=P.indexOf(g);if((q.ctrlKey||q.metaKey)!=H.isolate){let ue=P.some((fe,he)=>he>0&&he!=ne&&fe.show);P.forEach((fe,he)=>{he>0&&dr(he,ue?he==ne?Cn:_r:Cn,!0,Dt.setSeries)})}else dr(ne,{show:!g.show},!0,Dt.setSeries)},!1),_t&&Ze(Mp,T,q=>{K._lock||(wn(q),dr(P.indexOf(g),ji,!0,Dt.setSeries))},!1));for(var $ in Pt){let q=$r("td",K0,E);q.textContent="--",_.push(q)}return[E,_]}const Pn=new Map;function Ze(g,S,_,E=!0){const T=Pn.get(S)||{},L=K.bind[g](i,S,_,E);L&&(Os(g,S,T[g]=L),Pn.set(S,T))}function nn(g,S,_){const E=Pn.get(S)||{};for(let T in E)(g==null||T==g)&&(Df(T,S,E[T]),delete E[T]);g==null&&Pn.delete(S)}let rn=0,sr=0,Pe=0,ce=0,qe=0,et=0,sn=qe,kn=et,Gt=Pe,Rt=ce,ln=0,mn=0,Yt=0,vn=0;i.bbox={};let qr=!1,Jr=!1,lr=!1,or=!1,Zr=!1,zt=!1;function lt(g,S,_){(_||g!=i.width||S!=i.height)&&Kt(g,S),ci(!1),lr=!0,Jr=!0,Hn()}function Kt(g,S){i.width=rn=Pe=g,i.height=sr=ce=S,qe=et=0,an(),Rn();let _=i.bbox;ln=_.left=Ts(qe*Je,.5),mn=_.top=Ts(et*Je,.5),Yt=_.width=Ts(Pe*Je,.5),vn=_.height=Ts(ce*Je,.5)}const on=3;function ar(){let g=!1,S=0;for(;!g;){S++;let _=Hl(S),E=Wo(S);g=S==on||_&&E,g||(Kt(i.width,i.height),Jr=!0)}}function yn({width:g,height:S}){lt(g,S)}i.setSize=yn;function an(){let g=!1,S=!1,_=!1,E=!1;B.forEach((T,L)=>{if(T.show&&T._show){let{side:$,_size:q}=T,ne=$%2,ue=T.label!=null?T.labelSize:0,fe=q+ue;fe>0&&(ne?(Pe-=fe,$==3?(qe+=fe,E=!0):_=!0):(ce-=fe,$==0?(et+=fe,g=!0):S=!0))}}),An[0]=g,An[1]=_,An[2]=S,An[3]=E,Pe-=Ir[1]+Ir[3],qe+=Ir[3],ce-=Ir[2]+Ir[0],et+=Ir[0]}function Rn(){let g=qe+Pe,S=et+ce,_=qe,E=et;function T(L,$){switch(L){case 1:return g+=$,g-$;case 2:return S+=$,S-$;case 3:return _-=$,_+$;case 0:return E-=$,E+$}}B.forEach((L,$)=>{if(L.show&&L._show){let q=L.side;L._pos=T(q,L._size),L.label!=null&&(L._lpos=T(q,L.labelSize))}})}if(K.dataIdx==null){let g=K.hover,S=g.skip=new Set(g.skip??[]);S.add(void 0);let _=g.prox=Ve(g.prox),E=g.bias??(g.bias=0);K.dataIdx=(T,L,$,q)=>{if(L==0)return $;let ne=$,ue=_(T,L,$,q)??ct,fe=ue>=0&&ue0;)S.has(Ue[ke])||(je=ke);if(E==0||E==1)for(ke=$;Te==null&&ke++ue&&(ne=null);return ne}}const wn=g=>{K.event=g};K.idxs=D,K._lock=!1;let We=K.points;We.show=Ve(We.show),We.size=Ve(We.size),We.stroke=Ve(We.stroke),We.width=Ve(We.width),We.fill=Ve(We.fill);const xt=i.focus=Vt({},l.focus||{alpha:.3},K.focus),_t=xt.prox>=0,un=_t&&We.one;let vt=[],Sn=[],Ht=[];function Er(g,S){let _=We.show(i,S);if(_ instanceof HTMLElement)return wr(_,B0),wr(_,g.class),oi(_,-10,-10,Pe,ce),R.insertBefore(_,vt[S]),_}function Ri(g,S){if(o==1||S>0){let _=o==1&&V[g.scale].time,E=g.value;g.value=_?Gp(E)?Zp(De,Jp(E,le)):E||X:E||n1,g.label=g.label||(_?Kw:Yw)}if(un||S>0){g.width=g.width==null?1:g.width,g.paths=g.paths||m1||lw,g.fillTo=Ve(g.fillTo||o1),g.pxAlign=+Xe(g.pxAlign,k),g.pxRound=ag(g.pxAlign),g.stroke=Ve(g.stroke||null),g.fill=Ve(g.fill||null),g._stroke=g._fill=g._paths=g._focus=null;let _=r1(Gn(1,g.width),1),E=g.points=Vt({},{size:_,width:Gn(1,_*.2),stroke:g.stroke,space:_*2,paths:v1,_stroke:null,_fill:null},g.points);E.show=Ve(E.show),E.filter=Ve(E.filter),E.fill=Ve(E.fill),E.stroke=Ve(E.stroke),E.paths=Ve(E.paths),E.pxAlign=g.pxAlign}if(xe){let _=Xr(g,S);Oe.splice(S,0,_[0]),$t.splice(S,0,_[1]),H.values.push(null)}if(be){D.splice(S,0,null);let _=null;un?S==0&&(_=Er(g,S)):S>0&&(_=Er(g,S)),vt.splice(S,0,_),Sn.splice(S,0,0),Ht.splice(S,0,0)}jt("addSeries",S)}function bu(g,S){S=S??P.length,g=o==1?Lf(g,S,tg,lg):Lf(g,S,{},sg),P.splice(S,0,g),Ri(P[S],S)}i.addSeries=bu;function Ou(g){if(P.splice(g,1),xe){H.values.splice(g,1),$t.splice(g,1);let S=Oe.splice(g,1)[0];nn(null,S.firstChild),S.remove()}be&&(D.splice(g,1),vt.splice(g,1)[0].remove(),Sn.splice(g,1),Ht.splice(g,1)),jt("delSeries",g)}i.delSeries=Ou;const An=[!1,!1,!1,!1];function Ao(g,S){if(g._show=g.show,g.show){let _=g.side%2,E=V[g.scale];E==null&&(g.scale=_?P[1].scale:G,E=V[g.scale]);let T=E.time;g.size=Ve(g.size),g.space=Ve(g.space),g.rotate=Ve(g.rotate),rs(g.incrs)&&g.incrs.forEach($=>{!is.has($)&&is.set($,tm($))}),g.incrs=Ve(g.incrs||(E.distr==2?Dw:T?W==1?zw:Ow:zs)),g.splits=Ve(g.splits||(T&&E.distr==1?ie:E.distr==3?zf:E.distr==4?qw:Xw)),g.stroke=Ve(g.stroke),g.grid.stroke=Ve(g.grid.stroke),g.ticks.stroke=Ve(g.ticks.stroke),g.border.stroke=Ve(g.border.stroke);let L=g.values;g.values=rs(L)&&!rs(L[0])?Ve(L):T?rs(L)?qp(De,Xp(L,le)):Gp(L)?Aw(De,L):L||oe:L||Qw,g.filter=Ve(g.filter||(E.distr>=3&&E.log==10?e1:E.distr==3&&E.log==2?t1:Zg)),g.font=dg(g.font),g.labelFont=dg(g.labelFont),g._size=g.size(i,null,S,0),g._space=g._rotate=g._incrs=g._found=g._splits=g._values=null,g._size>0&&(An[S]=!0,g._el=Lr(H0,x))}}function Ni(g,S,_,E){let[T,L,$,q]=_,ne=S%2,ue=0;return ne==0&&(q||L)&&(ue=S==0&&!T||S==2&&!$?Jt(eg.size/3):0),ne==1&&(T||$)&&(ue=S==1&&!L||S==3&&!q?Jt(rg.size/2):0),ue}const Io=i.padding=(l.padding||[Ni,Ni,Ni,Ni]).map(g=>Ve(Xe(g,Ni))),Ir=i._padding=Io.map((g,S)=>g(i,S,An,0));let Ft,Mt=null,bt=null;const Is=o==1?P[0].idxs:null;let ur=null,ot=!1;function Ho(g,S){if(t=g??[],i.data=i._data=t,o==2){Ft=0;for(let _=1;_=0,zt=!0,Hn()}}i.setData=Ho;function ss(){ot=!0;let g,S;o==1&&(Ft>0?(Mt=Is[0]=0,bt=Is[1]=Ft-1,g=t[0][Mt],S=t[0][bt],Ce==2?(g=Mt,S=bt):g==S&&(Ce==3?[g,S]=Cu(g,g,Y.log,!1):Ce==4?[g,S]=Xf(g,g,Y.log,!1):Y.time?S=g+Jt(86400/W):[g,S]=cu(g,S,qf,!0))):(Mt=Is[0]=g=null,bt=Is[1]=S=null)),fr(G,g,S)}let ls,Hr,bl,Hs,Di,Qn,Ol,In,Ll,Nn;function Fo(g,S,_,E,T,L){g??(g=Tp),_??(_=Zf),E??(E="butt"),T??(T=Tp),L??(L="round"),g!=ls&&(v.strokeStyle=ls=g),T!=Hr&&(v.fillStyle=Hr=T),S!=bl&&(v.lineWidth=bl=S),L!=Di&&(v.lineJoin=Di=L),E!=Qn&&(v.lineCap=Qn=E),_!=Hs&&v.setLineDash(Hs=_)}function os(g,S,_,E){S!=Hr&&(v.fillStyle=Hr=S),g!=Ol&&(v.font=Ol=g),_!=In&&(v.textAlign=In=_),E!=Ll&&(v.textBaseline=Ll=E)}function Ti(g,S,_,E,T=0){if(E.length>0&&g.auto(i,ot)&&(S==null||S.min==null)){let L=Xe(Mt,0),$=Xe(bt,E.length-1),q=_.min==null?ew(E,L,$,T,g.distr==3):[_.min,_.max];g.min=Yr(g.min,_.min=q[0]),g.max=Gn(g.max,_.max=q[1])}}const zi={min:null,max:null};function Fs(){for(let E in V){let T=V[E];me[E]==null&&(T.min==null||me[G]!=null&&T.auto(i,ot))&&(me[E]=zi)}for(let E in V){let T=V[E];me[E]==null&&T.from!=null&&me[T.from]!=null&&(me[E]=zi)}me[G]!=null&&ci(!0);let g={};for(let E in me){let T=me[E];if(T!=null){let L=g[E]=Cl(V[E],uw);if(T.min!=null)Vt(L,T);else if(E!=G||o==2)if(Ft==0&&L.from==null){let $=L.range(i,null,null,E);L.min=$[0],L.max=$[1]}else L.min=ct,L.max=-ct}}if(Ft>0){P.forEach((E,T)=>{if(o==1){let L=E.scale,$=me[L];if($==null)return;let q=g[L];if(T==0){let ne=q.range(i,q.min,q.max,L);q.min=ne[0],q.max=ne[1],Mt=Gr(q.min,t[0]),bt=Gr(q.max,t[0]),bt-Mt>1&&(t[0][Mt]q.max&&bt--),E.min=ur[Mt],E.max=ur[bt]}else E.show&&E.auto&&Ti(q,$,E,t[T],E.sorted);E.idxs[0]=Mt,E.idxs[1]=bt}else if(T>0&&E.show&&E.auto){let[L,$]=E.facets,q=L.scale,ne=$.scale,[ue,fe]=t[T],he=g[q],Ae=g[ne];he!=null&&Ti(he,me[q],L,ue,L.sorted),Ae!=null&&Ti(Ae,me[ne],$,fe,$.sorted),E.min=$.min,E.max=$.max}});for(let E in g){let T=g[E],L=me[E];if(T.from==null&&(L==null||L.min==null)){let $=T.range(i,T.min==ct?null:T.min,T.max==-ct?null:T.max,E);T.min=$[0],T.max=$[1]}}}for(let E in g){let T=g[E];if(T.from!=null){let L=g[T.from];if(L.min==null)T.min=T.max=null;else{let $=T.range(i,L.min,L.max,E);T.min=$[0],T.max=$[1]}}}let S={},_=!1;for(let E in g){let T=g[E],L=V[E];if(L.min!=T.min||L.max!=T.max){L.min=T.min,L.max=T.max;let $=L.distr;L._min=$==3?Ei(L.min):$==4?df(L.min,L.asinh):$==100?L.fwd(L.min):L.min,L._max=$==3?Ei(L.max):$==4?df(L.max,L.asinh):$==100?L.fwd(L.max):L.max,S[E]=_=!0}}if(_){P.forEach((E,T)=>{o==2?T>0&&S.y&&(E._paths=null):S[E.scale]&&(E._paths=null)});for(let E in S)lr=!0,jt("setScale",E);be&&K.left>=0&&(or=zt=!0)}for(let E in me)me[E]=null}function Lu(g){let S=Tf(Mt-1,0,Ft-1),_=Tf(bt+1,0,Ft-1);for(;g[S]==null&&S>0;)S--;for(;g[_]==null&&_0){let g=P.some(S=>S._focus)&&Nn!=xt.alpha;g&&(v.globalAlpha=Nn=xt.alpha),P.forEach((S,_)=>{if(_>0&&S.show&&(js(_,!1),js(_,!0),S._paths==null)){let E=Nn;Nn!=S.alpha&&(v.globalAlpha=Nn=S.alpha);let T=o==2?[0,t[_][0].length-1]:Lu(t[_]);S._paths=S.paths(i,_,T[0],T[1]),Nn!=E&&(v.globalAlpha=Nn=E)}}),P.forEach((S,_)=>{if(_>0&&S.show){let E=Nn;Nn!=S.alpha&&(v.globalAlpha=Nn=S.alpha),S._paths!=null&&Pl(_,!1);{let T=S._paths!=null?S._paths.gaps:null,L=S.points.show(i,_,Mt,bt,T),$=S.points.filter(i,_,L,T);(L||$)&&(S.points._paths=S.points.paths(i,_,Mt,bt,$),Pl(_,!0))}Nn!=E&&(v.globalAlpha=Nn=E),jt("drawSeries",_)}}),g&&(v.globalAlpha=Nn=1)}}function js(g,S){let _=S?P[g].points:P[g];_._stroke=_.stroke(i,g),_._fill=_.fill(i,g)}function Pl(g,S){let _=S?P[g].points:P[g],{stroke:E,fill:T,clip:L,flags:$,_stroke:q=_._stroke,_fill:ne=_._fill,_width:ue=_.width}=_._paths;ue=ft(ue*Je,3);let fe=null,he=ue%2/2;S&&ne==null&&(ne=ue>0?"#fff":q);let Ae=_.pxAlign==1&&he>0;if(Ae&&v.translate(he,he),!S){let Ge=ln-ue/2,Ue=mn-ue/2,je=Yt+ue,Te=vn+ue;fe=new Path2D,fe.rect(Ge,Ue,je,Te)}S?Il(q,ue,_.dash,_.cap,ne,E,T,$,L):Al(g,q,ue,_.dash,_.cap,ne,E,T,$,fe,L),Ae&&v.translate(-he,-he)}function Al(g,S,_,E,T,L,$,q,ne,ue,fe){let he=!1;ne!=0&&ee.forEach((Ae,Ge)=>{if(Ae.series[0]==g){let Ue=P[Ae.series[1]],je=t[Ae.series[1]],Te=(Ue._paths||ko).band;rs(Te)&&(Te=Ae.dir==1?Te[0]:Te[1]);let ke,st=null;Ue.show&&Te&&nw(je,Mt,bt)?(st=Ae.fill(i,Ge)||L,ke=Ue._paths.clip):Te=null,Il(S,_,E,T,st,$,q,ne,ue,fe,ke,Te),he=!0}}),he||Il(S,_,E,T,L,$,q,ne,ue,fe)}const Mi=kl|bf;function Il(g,S,_,E,T,L,$,q,ne,ue,fe,he){Fo(g,S,_,E,T),(ne||ue||he)&&(v.save(),ne&&v.clip(ne),ue&&v.clip(ue)),he?(q&Mi)==Mi?(v.clip(he),fe&&v.clip(fe),$e(T,$),bi(g,L,S)):q&bf?($e(T,$),v.clip(he),bi(g,L,S)):q&kl&&(v.save(),v.clip(he),fe&&v.clip(fe),$e(T,$),v.restore(),bi(g,L,S)):($e(T,$),bi(g,L,S)),(ne||ue||he)&&v.restore()}function bi(g,S,_){_>0&&(S instanceof Map?S.forEach((E,T)=>{v.strokeStyle=ls=T,v.stroke(E)}):S!=null&&g&&v.stroke(S))}function $e(g,S){S instanceof Map?S.forEach((_,E)=>{v.fillStyle=Hr=E,v.fill(_)}):S!=null&&g&&v.fill(S)}function jo(g,S,_,E){let T=B[g],L;if(E<=0)L=[0,0];else{let $=T._space=T.space(i,g,S,_,E),q=T._incrs=T.incrs(i,g,S,_,E,$);L=E1(S,_,q,E,$)}return T._found=L}function Ws(g,S,_,E,T,L,$,q,ne,ue){let fe=$%2/2;k==1&&v.translate(fe,fe),Fo(q,$,ne,ue,q),v.beginPath();let he,Ae,Ge,Ue,je=T+(E==0||E==3?-L:L);_==0?(Ae=T,Ue=je):(he=T,Ge=je);for(let Te=0;Te{if(!_.show)return;let T=V[_.scale];if(T.min==null){_._show&&(S=!1,_._show=!1,ci(!1));return}else _._show||(S=!1,_._show=!0,ci(!1));let L=_.side,$=L%2,{min:q,max:ne}=T,[ue,fe]=jo(E,q,ne,$==0?Pe:ce);if(fe==0)return;let he=T.distr==2,Ae=_._splits=_.splits(i,E,q,ne,ue,fe,he),Ge=T.distr==2?Ae.map(ke=>ur[ke]):Ae,Ue=T.distr==2?ur[Ae[1]]-ur[Ae[0]]:ue,je=_._values=_.values(i,_.filter(i,Ge,E,fe,Ue),E,fe,Ue);_._rotate=L==2?_.rotate(i,je,E,fe):0;let Te=_._size;_._size=Ar(_.size(i,je,E,g)),Te!=null&&_._size!=Te&&(S=!1)}),S}function Wo(g){let S=!0;return Io.forEach((_,E)=>{let T=_(i,E,An,g);T!=Ir[E]&&(S=!1),Ir[E]=T}),S}function Bo(){for(let g=0;gur[xn]):Ge,je=fe.distr==2?ur[Ge[1]]-ur[Ge[0]]:ne,Te=S.ticks,ke=S.border,st=Te.show?Te.size:0,yt=Jt(st*Je),Wt=Jt((S.alignTo==2?S._size-st-S.gap:S.gap)*Je),tt=S._rotate*-Ja/180,wt=b(S._pos*Je),jn=(yt+Wt)*q,at=wt+jn;L=E==0?at:0,T=E==1?at:0;let cn=S.font[0],Jn=S.align==1?gl:S.align==2?uf:tt>0?gl:tt<0?uf:E==0?"center":_==3?uf:gl,pr=tt||E==1?"middle":_==2?po:Dp;os(cn,$,Jn,pr);let Tn=S.font[1]*S.lineGap,Wn=Ge.map(xn=>b(d(xn,fe,he,Ae))),Bn=S._values;for(let xn=0;xn{_>0&&(S._paths=null,g&&(o==1?(S.min=null,S.max=null):S.facets.forEach(E=>{E.min=null,E.max=null})))})}let Oi=!1,Li=!1,Xn=[];function ei(){Li=!1;for(let g=0;g0&&queueMicrotask(ei)}i.batch=as;function Pi(){if(qr&&(Fs(),qr=!1),lr&&(ar(),lr=!1),Jr){if(mt(z,gl,qe),mt(z,po,et),mt(z,vo,Pe),mt(z,yo,ce),mt(R,gl,qe),mt(R,po,et),mt(R,vo,Pe),mt(R,yo,ce),mt(x,vo,rn),mt(x,yo,sr),w.width=Jt(rn*Je),w.height=Jt(sr*Je),B.forEach(({_el:g,_show:S,_size:_,_pos:E,side:T})=>{if(g!=null)if(S){let L=T===3||T===0?_:0,$=T%2==1;mt(g,$?"left":"top",E-L),mt(g,$?"width":"height",_),mt(g,$?"top":"left",$?et:qe),mt(g,$?"height":"width",$?ce:Pe),Nf(g,Ms)}else wr(g,Ms)}),ls=Hr=bl=Di=Qn=Ol=In=Ll=Hs=null,Nn=1,gs(!0),qe!=sn||et!=kn||Pe!=Gt||ce!=Rt){ci(!1);let g=Pe/Gt,S=ce/Rt;if(be&&!or&&K.left>=0){K.left*=g,K.top*=S,kr&&oi(kr,Jt(K.left),0,Pe,ce),Ai&&oi(Ai,0,Jt(K.top),Pe,ce);for(let _=0;_=0&&it.width>0){it.left*=g,it.width*=g,it.top*=S,it.height*=S;for(let _ in Vl)mt(di,_,it[_])}sn=qe,kn=et,Gt=Pe,Rt=ce}jt("setSize"),Jr=!1}rn>0&&sr>0&&(v.clearRect(0,0,w.width,w.height),jt("drawClear"),re.forEach(g=>g()),jt("draw")),it.show&&Zr&&(cr(it),Zr=!1),be&&or&&(hi(null,!0,!1),or=!1),H.show&&H.live&&zt&&(ps(),zt=!1),p||(p=!0,i.status=1,jt("ready")),ot=!1,Oi=!1}i.redraw=(g,S)=>{lr=S||!1,g!==!1?fr(G,Y.min,Y.max):Hn()};function Cr(g,S){let _=V[g];if(_.from==null){if(Ft==0){let E=_.range(i,S.min,S.max,g);S.min=E[0],S.max=E[1]}if(S.min>S.max){let E=S.min;S.min=S.max,S.max=E}if(Ft>1&&S.min!=null&&S.max!=null&&S.max-S.min<1e-16)return;g==G&&_.distr==2&&Ft>0&&(S.min=Gr(S.min,t[0]),S.max=Gr(S.max,t[0]),S.min==S.max&&S.max++),me[g]=S,qr=!0,Hn()}}i.setScale=Cr;let Fl,Bs,kr,Ai,jl,us,fi,Ii,Hi,Fi,Ke,rt,ti=!1;const Qt=K.drag;let Nt=Qt.x,Et=Qt.y;be&&(K.x&&(Fl=Lr(j0,R)),K.y&&(Bs=Lr(W0,R)),Y.ori==0?(kr=Fl,Ai=Bs):(kr=Bs,Ai=Fl),Ke=K.left,rt=K.top);const it=i.select=Vt({show:!0,over:!0,left:0,width:0,top:0,height:0},l.select),di=it.show?Lr(F0,it.over?R:z):null;function cr(g,S){if(it.show){for(let _ in g)it[_]=g[_],_ in Vl&&mt(di,_,g[_]);S!==!1&&jt("setSelect")}}i.setSelect=cr;function Wl(g){if(P[g].show)xe&&Nf(Oe[g],Ms);else if(xe&&wr(Oe[g],Ms),be){let _=un?vt[0]:vt[g];_!=null&&oi(_,-10,-10,Pe,ce)}}function fr(g,S,_){Cr(g,{min:S,max:_})}function dr(g,S,_,E){S.focus!=null&&Bl(g),S.show!=null&&P.forEach((T,L)=>{L>0&&(g==L||g==null)&&(T.show=S.show,Wl(L),o==2?(fr(T.facets[0].scale,null,null),fr(T.facets[1].scale,null,null)):fr(T.scale,null,null),Hn())}),_!==!1&&jt("setSeries",g,S),E&&ms("setSeries",i,g,S)}i.setSeries=dr;function Us(g,S){Vt(ee[g],S)}function Vs(g,S){g.fill=Ve(g.fill||null),g.dir=Xe(g.dir,-1),S=S??ee.length,ee.splice(S,0,g)}function Uo(g){g==null?ee.length=0:ee.splice(g,1)}i.addBand=Vs,i.setBand=Us,i.delBand=Uo;function Fn(g,S){P[g].alpha=S,be&&vt[g]!=null&&(vt[g].style.opacity=S),xe&&Oe[g]&&(Oe[g].style.opacity=S)}let Dn,Rr,hr;const ji={focus:!0};function Bl(g){if(g!=hr){let S=g==null,_=xt.alpha!=1;P.forEach((E,T)=>{if(o==1||T>0){let L=S||T==0||T==g;E._focus=S?null:L,_&&Fn(T,L?1:xt.alpha)}}),hr=g,_&&Hn()}}xe&&_t&&Ze(bp,_e,g=>{K._lock||(wn(g),hr!=null&&dr(null,ji,!0,Dt.setSeries))});function qn(g,S,_){let E=V[S];_&&(g=g/Je-(E.ori==1?et:qe));let T=Pe;E.ori==1&&(T=ce,g=T-g),E.dir==-1&&(g=T-g);let L=E._min,$=E._max,q=g/T,ne=L+($-L)*q,ue=E.distr;return ue==3?_l(10,ne):ue==4?iw(ne,E.asinh):ue==100?E.bwd(ne):ne}function cs(g,S){let _=qn(g,G,S);return Gr(_,t[0],Mt,bt)}i.valToIdx=g=>Gr(g,t[0]),i.posToIdx=cs,i.posToVal=qn,i.valToPos=(g,S,_)=>V[S].ori==0?u(g,V[S],_?Yt:Pe,_?ln:0):c(g,V[S],_?vn:ce,_?mn:0),i.setCursor=(g,S,_)=>{Ke=g.left,rt=g.top,hi(null,S,_)};function fs(g,S){mt(di,gl,it.left=g),mt(di,vo,it.width=S)}function Ul(g,S){mt(di,po,it.top=g),mt(di,yo,it.height=S)}let ds=Y.ori==0?fs:Ul,hs=Y.ori==1?fs:Ul;function Au(){if(xe&&H.live)for(let g=o==2?1:0;g{D[E]=_}):aw(g.idx)||D.fill(g.idx),H.idx=D[0]),xe&&H.live){for(let _=0;_0||o==1&&!At)&&Iu(_,D[_]);Au()}zt=!1,S!==!1&&jt("setLegend")}i.setLegend=ps;function Iu(g,S){let _=P[g],E=g==0&&Ce==2?ur:t[g],T;At?T=_.values(i,g,S)??It:(T=_.value(i,S==null?null:E[S],g,S),T=T==null?It:{_:T}),H.values[g]=T}function hi(g,S,_){Hi=Ke,Fi=rt,[Ke,rt]=K.move(i,Ke,rt),K.left=Ke,K.top=rt,be&&(kr&&oi(kr,Jt(Ke),0,Pe,ce),Ai&&oi(Ai,0,Jt(rt),Pe,ce));let E,T=Mt>bt;Dn=ct,Rr=null;let L=Y.ori==0?Pe:ce,$=Y.ori==1?Pe:ce;if(Ke<0||Ft==0||T){E=K.idx=null;for(let q=0;q0&&st.show){let jn=tt==null?-10:tt==E?ue:ae(o==1?t[0][tt]:t[ke][0][tt],Y,L,0),at=wt==null?-10:ye(wt,o==1?V[st.scale]:V[st.facets[1].scale],$,0);if(_t&&wt!=null){let cn=Y.ori==1?Ke:rt,Jn=Zt(xt.dist(i,ke,tt,at,cn));if(Jn=0?1:-1,Bn=Tn>=0?1:-1;Bn==Wn&&(Bn==1?pr==1?wt>=Tn:wt<=Tn:pr==1?wt<=Tn:wt>=Tn)&&(Dn=Jn,Rr=ke)}else Dn=Jn,Rr=ke}}if(zt||un){let cn,Jn;Y.ori==0?(cn=jn,Jn=at):(cn=at,Jn=jn);let pr,Tn,Wn,Bn,Nr,xn,Bt=!0,Fr=We.bbox;if(Fr!=null){Bt=!1;let Ot=Fr(i,ke);Wn=Ot.left,Bn=Ot.top,pr=Ot.width,Tn=Ot.height}else Wn=cn,Bn=Jn,pr=Tn=We.size(i,ke);if(xn=We.fill(i,ke),Nr=We.stroke(i,ke),un)ke==Rr&&Dn<=xt.prox&&(fe=Wn,he=Bn,Ae=pr,Ge=Tn,Ue=Bt,je=xn,Te=Nr);else{let Ot=vt[ke];Ot!=null&&(Sn[ke]=Wn,Ht[ke]=Bn,Fp(Ot,pr,Tn,Bt),Ip(Ot,xn,Nr),oi(Ot,Ar(Wn),Ar(Bn),Pe,ce))}}}}if(un){let ke=xt.prox,st=hr==null?Dn<=ke:Dn>ke||Rr!=hr;if(zt||st){let yt=vt[0];yt!=null&&(Sn[0]=fe,Ht[0]=he,Fp(yt,Ae,Ge,Ue),Ip(yt,je,Te),oi(yt,Ar(fe),Ar(he),Pe,ce))}}}if(it.show&&ti)if(g!=null){let[q,ne]=Dt.scales,[ue,fe]=Dt.match,[he,Ae]=g.cursor.sync.scales,Ge=g.cursor.drag;if(Nt=Ge._x,Et=Ge._y,Nt||Et){let{left:Ue,top:je,width:Te,height:ke}=g.select,st=g.scales[he].ori,yt=g.posToVal,Wt,tt,wt,jn,at,cn=q!=null&&ue(q,he),Jn=ne!=null&&fe(ne,Ae);cn&&Nt?(st==0?(Wt=Ue,tt=Te):(Wt=je,tt=ke),wt=V[q],jn=ae(yt(Wt,he),wt,L,0),at=ae(yt(Wt+tt,he),wt,L,0),ds(Yr(jn,at),Zt(at-jn))):ds(0,L),Jn&&Et?(st==1?(Wt=Ue,tt=Te):(Wt=je,tt=ke),wt=V[ne],jn=ye(yt(Wt,Ae),wt,$,0),at=ye(yt(Wt+tt,Ae),wt,$,0),hs(Yr(jn,at),Zt(at-jn))):hs(0,$)}else $l()}else{let q=Zt(Hi-jl),ne=Zt(Fi-us);if(Y.ori==1){let Ae=q;q=ne,ne=Ae}Nt=Qt.x&&q>=Qt.dist,Et=Qt.y&&ne>=Qt.dist;let ue=Qt.uni;ue!=null?Nt&&Et&&(Nt=q>=ue,Et=ne>=ue,!Nt&&!Et&&(ne>q?Et=!0:Nt=!0)):Qt.x&&Qt.y&&(Nt||Et)&&(Nt=Et=!0);let fe,he;Nt&&(Y.ori==0?(fe=fi,he=Ke):(fe=Ii,he=rt),ds(Yr(fe,he),Zt(he-fe)),Et||hs(0,$)),Et&&(Y.ori==1?(fe=fi,he=Ke):(fe=Ii,he=rt),hs(Yr(fe,he),Zt(he-fe)),Nt||ds(0,L)),!Nt&&!Et&&(ds(0,0),hs(0,0))}if(Qt._x=Nt,Qt._y=Et,g==null){if(_){if(Ks!=null){let[q,ne]=Dt.scales;Dt.values[0]=q!=null?qn(Y.ori==0?Ke:rt,q):null,Dt.values[1]=ne!=null?qn(Y.ori==1?Ke:rt,ne):null}ms(cf,i,Ke,rt,Pe,ce,E)}if(_t){let q=_&&Dt.setSeries,ne=xt.prox;hr==null?Dn<=ne&&dr(Rr,ji,!0,q):Dn>ne?dr(null,ji,!0,q):Rr!=hr&&dr(Rr,ji,!0,q)}}zt&&(H.idx=E,ps()),S!==!1&&jt("setCursor")}let ni=null;Object.defineProperty(i,"rect",{get(){return ni==null&&gs(!1),ni}});function gs(g=!1){g?ni=null:(ni=R.getBoundingClientRect(),jt("syncRect",ni))}function Vo(g,S,_,E,T,L,$){K._lock||ti&&g!=null&&g.movementX==0&&g.movementY==0||($s(g,S,_,E,T,L,$,!1,g!=null),g!=null?hi(null,!0,!0):hi(S,!0,!1))}function $s(g,S,_,E,T,L,$,q,ne){if(ni==null&&gs(!1),wn(g),g!=null)_=g.clientX-ni.left,E=g.clientY-ni.top;else{if(_<0||E<0){Ke=-10,rt=-10;return}let[ue,fe]=Dt.scales,he=S.cursor.sync,[Ae,Ge]=he.values,[Ue,je]=he.scales,[Te,ke]=Dt.match,st=S.axes[0].side%2==1,yt=Y.ori==0?Pe:ce,Wt=Y.ori==1?Pe:ce,tt=st?L:T,wt=st?T:L,jn=st?E:_,at=st?_:E;if(Ue!=null?_=Te(ue,Ue)?d(Ae,V[ue],yt,0):-10:_=yt*(jn/tt),je!=null?E=ke(fe,je)?d(Ge,V[fe],Wt,0):-10:E=Wt*(at/wt),Y.ori==1){let cn=_;_=E,E=cn}}ne&&(S==null||S.cursor.event.type==cf)&&((_<=1||_>=Pe-1)&&(_=Ts(_,Pe)),(E<=1||E>=ce-1)&&(E=Ts(E,ce))),q?(jl=_,us=E,[fi,Ii]=K.move(i,_,E)):(Ke=_,rt=E)}const Vl={width:0,height:0,left:0,top:0};function $l(){cr(Vl,!1)}let $o,Go,Gs,Yo;function Ko(g,S,_,E,T,L,$){ti=!0,Nt=Et=Qt._x=Qt._y=!1,$s(g,S,_,E,T,L,$,!0,!1),g!=null&&(Ze(ff,kf,Qo,!1),ms(zp,i,fi,Ii,Pe,ce,null));let{left:q,top:ne,width:ue,height:fe}=it;$o=q,Go=ne,Gs=ue,Yo=fe}function Qo(g,S,_,E,T,L,$){ti=Qt._x=Qt._y=!1,$s(g,S,_,E,T,L,$,!1,!0);let{left:q,top:ne,width:ue,height:fe}=it,he=ue>0||fe>0,Ae=$o!=q||Go!=ne||Gs!=ue||Yo!=fe;if(he&&Ae&&cr(it),Qt.setScale&&he&&Ae){let Ge=q,Ue=ue,je=ne,Te=fe;if(Y.ori==1&&(Ge=ne,Ue=fe,je=q,Te=ue),Nt&&fr(G,qn(Ge,G),qn(Ge+Ue,G)),Et)for(let ke in V){let st=V[ke];ke!=G&&st.from==null&&st.min!=ct&&fr(ke,qn(je+Te,ke),qn(je,ke))}$l()}else K.lock&&(K._lock=!K._lock,hi(S,!0,g!=null));g!=null&&(nn(ff,kf),ms(ff,i,Ke,rt,Pe,ce,null))}function Xo(g,S,_,E,T,L,$){if(K._lock)return;wn(g);let q=ti;if(ti){let ne=!0,ue=!0,fe=10,he,Ae;Y.ori==0?(he=Nt,Ae=Et):(he=Et,Ae=Nt),he&&Ae&&(ne=Ke<=fe||Ke>=Pe-fe,ue=rt<=fe||rt>=ce-fe),he&&ne&&(Ke=Ke{let T=Dt.match[2];_=T(i,S,_),_!=-1&&dr(_,E,!0,!1)},be&&(Ze(zp,R,Ko),Ze(cf,R,Vo),Ze(Mp,R,g=>{wn(g),gs(!1)}),Ze(bp,R,Xo),Ze(Op,R,qo),Of.add(i),i.syncRect=gs);const Ys=i.hooks=l.hooks||{};function jt(g,S,_){Li?Xn.push([g,S,_]):g in Ys&&Ys[g].forEach(E=>{E.call(null,i,S,_)})}(l.plugins||[]).forEach(g=>{for(let S in g.hooks)Ys[S]=(Ys[S]||[]).concat(g.hooks[S])});const Zo=(g,S,_)=>_,Dt=Vt({key:null,setSeries:!1,filters:{pub:Vp,sub:Vp},scales:[G,P[1]?P[1].scale:null],match:[$p,$p,Zo],values:[null,null]},K.sync);Dt.match.length==2&&Dt.match.push(Zo),K.sync=Dt;const Ks=Dt.key,pi=xm(Ks);function ms(g,S,_,E,T,L,$){Dt.filters.pub(g,S,_,E,T,L,$)&&pi.pub(g,S,_,E,T,L,$)}pi.sub(i);function ea(g,S,_,E,T,L,$){Dt.filters.sub(g,S,_,E,T,L,$)&&Wi[g](null,S,_,E,T,L,$)}i.pub=ea;function ta(){pi.unsub(i),Of.delete(i),Pn.clear(),Df(uu,Sl,Jo),m.remove(),_e==null||_e.remove(),jt("destroy")}i.destroy=ta;function Qs(){jt("init",l,t),Ho(t||l.data,!1),me[G]?Cr(G,me[G]):ss(),Zr=it.show&&(it.width>0||it.height>0),or=zt=!0,lt(l.width,l.height)}return P.forEach(Ri),B.forEach(Ao),r?r instanceof HTMLElement?(r.appendChild(m),Qs()):r(i,Qs):Qs(),i}Ln.assign=Vt;Ln.fmtNum=Jf;Ln.rangeNum=cu;Ln.rangeLog=Cu;Ln.rangeAsinh=Xf;Ln.orient=As;Ln.pxRatio=Je;Ln.join=gw;Ln.fmtDate=ed,Ln.tzDate=Rw;Ln.sync=xm;{Ln.addGap=a1,Ln.clipGaps=Nu;let l=Ln.paths={points:Nm};l.linear=Tm,l.stepped=f1,l.bars=d1,l.spline=p1}const k1=6e3;class R1{constructor(t=k1){fo(this,"t");fo(this,"v");fo(this,"len",0);fo(this,"head",0);this.t=new Float64Array(t),this.v=new Float64Array(t)}push(t,r){const i=this.t.length;this.t[this.head]=t,this.v[this.head]=r,this.head=(this.head+1)%i,this.len=t&&(u[d]=this.t[m],c[d]=this.v[m],d++)}return{t:u.subarray(0,d),v:c.subarray(0,d)}}last(){if(this.len===0)return null;const t=this.t.length;return this.v[(this.head-1+t)%t]}}const Pf=new Map;function N1(l){let t=Pf.get(l);return t||(t=new R1,Pf.set(l,t)),t}function Om(l,t){const r=N1(l);for(const[i,o]of t)r.push(i,o)}function Lm(l,t=-1/0){const r=Pf.get(l);return r?r.read(t):{t:new Float64Array(0),v:new Float64Array(0)}}const xl=new Map;let Za=[];function Pm(){Za.forEach(l=>l())}function D1(l){xl.set(l,(xl.get(l)||0)+1),Pm()}function T1(l){const t=(xl.get(l)||0)-1;t<=0?xl.delete(l):xl.set(l,t),Pm()}function z1(){return Array.from(xl.keys())}function M1(l){return Za.push(l),()=>{Za=Za.filter(t=>t!==l)}}const hg=3e3;let yl=[],eu=[];function b1(l){l.length&&(yl=yl.concat(l),yl.length>hg&&(yl=yl.slice(-hg)),eu.forEach(t=>t()))}function O1(){return yl}function L1(l){return eu.push(l),()=>{eu=eu.filter(t=>t!==l)}}let tu=0,nu=[];function pg(l){tu+=l?1:-1,tu<0&&(tu=0),nu.forEach(t=>t())}function P1(){return tu>0}function A1(l){return nu.push(l),()=>{nu=nu.filter(t=>t!==l)}}let Ls=null,mf=null;function I1(){return`${location.protocol==="https:"?"wss":"ws"}://${location.host}/api/monitor/stream`}function gg(){Ls&&Ls.readyState===WebSocket.OPEN&&Ls.send(JSON.stringify({type:"subscribe",signals:z1()}))}function mg(){Ls&&Ls.readyState===WebSocket.OPEN&&Ls.send(JSON.stringify({type:"raw",enabled:P1()}))}function Am(){const l=new WebSocket(I1());Ls=l,l.onopen=()=>{gn.getState().setConnected(!0),gg(),mg()},l.onclose=()=>{gn.getState().setConnected(!1),mf==null&&(mf=window.setTimeout(()=>{mf=null,Am()},1e3))},l.onerror=()=>l.close(),l.onmessage=r=>{let i;try{i=JSON.parse(r.data)}catch{return}const o=gn.getState();switch(i.type){case"meta":o.setMeta(i.signals,i.pairs),o.setMotors(i.motors);break;case"motors":o.setMotors(i.motors),i.status&&o.setStatus(i.status);break;case"samples":for(const[u,c]of Object.entries(i.data))Om(u,c);break;case"raw":b1(i.frames);break}};let t=null;M1(()=>{t==null&&(t=window.setTimeout(()=>{t=null,gg()},80))}),A1(mg)}async function H1(l,t=600){return l.length?(await fetch(`/api/monitor/snapshot?signals=${l.join(",")}&n=${t}`)).json():{}}async function F1(){try{return(await(await fetch("/api/monitor/motor-types")).json()).types||[]}catch{return[]}}async function j1(l,t){await fetch("/api/monitor/motor-type",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({motorId:l,motorType:t})})}const W1={pos:"#58a6ff",vel:"#3fb950",torque:"#d29922",kp:"#bc8cff",kd:"#f778ba",vel_limit:"#56d4dd",torque_limit:"#e3b341",t_mos:"#ff7b72",t_rotor:"#ffa657",status_code:"#8b949e"};function Im(l){return W1[l]||"#8b949e"}function B1(l){const t=Im(l.field);return l.source==="cmd"?$1(t,.15):t}function U1(l,t){const r=l.replace("#",""),i=parseInt(r.slice(0,2),16),o=parseInt(r.slice(2,4),16),u=parseInt(r.slice(4,6),16);return`rgba(${i},${o},${u},${t})`}function vg(l){const t=Im(l.field);return l.source==="cmd"?{stroke:U1(t,.45),width:1.25}:{stroke:t,width:1.85}}function Af(l){const t=l.split(":");return t.length>=3?`${t[1]} ${t[2]}`:l}function V1(l){return l.includes(":cmd.")}const yg=["pos","vel","torque","kp","kd","t_mos","t_rotor"];function $1(l,t){const r=l.replace("#",""),i=Math.min(255,Math.round(parseInt(r.slice(0,2),16)+255*t)),o=Math.min(255,Math.round(parseInt(r.slice(2,4),16)+255*t)),u=Math.min(255,Math.round(parseInt(r.slice(4,6),16)+255*t));return`rgb(${i},${o},${u})`}function Rl(l,t=3){return l==null||Number.isNaN(l)?"—":l.toFixed(t)}const wg=2e3;function G1(l,t){const r=l.map(c=>Lm(c,t)),i=new Set;for(const c of r)for(let d=0;dc-d);if(o.length>wg){const c=Math.ceil(o.length/wg);o=o.filter((d,p)=>p%c===0)}const u=[o];for(const c of r){const d=new Array(o.length).fill(null);let p=0,m=null;for(let w=0;wk.ensurePlot),r=gn(k=>k.removeSignalFromPlot),i=gn(k=>k.setPlotConfig),o=gn(k=>k.plotConfigs[l]),u=gn(k=>k.signals);j.useEffect(()=>{t(l)},[l,t]);const c=(o==null?void 0:o.signals)??[],d=(o==null?void 0:o.duration)??10,p=c.join("|"),{setNodeRef:m,isOver:w}=c0({id:`plot:${l}`,data:{panelId:l}}),v=j.useRef(null),x=j.useRef(null),z=j.useRef(0);j.useEffect(()=>{if(!v.current)return;const k=v.current,b=new Map(u.map(ee=>[ee.id,ee])),W=[{label:"t"},...c.map(ee=>{const G=b.get(ee),Z=G?vg(G):{stroke:"#8b949e",width:1.5};return{label:Af(ee),stroke:Z.stroke,width:Z.width,points:{show:!1}}})],P={width:k.clientWidth||400,height:k.clientHeight||220,legend:{show:!1},series:W,cursor:{y:!1,points:{show:!0}},scales:{x:{time:!1}},axes:[{stroke:"#8b949e",grid:{stroke:"rgba(139,148,158,0.12)"},ticks:{stroke:"rgba(139,148,158,0.2)"},values:(ee,G)=>G.map(Z=>(Z-z.current).toFixed(1)+"s")},{stroke:"#8b949e",grid:{stroke:"rgba(139,148,158,0.12)"},ticks:{stroke:"rgba(139,148,158,0.2)"}}]},B=new Ln(P,[[],...c.map(()=>[])],k);x.current=B;const V=new ResizeObserver(()=>{B.setSize({width:k.clientWidth,height:k.clientHeight})});return V.observe(k),()=>{V.disconnect(),B.destroy(),x.current=null}},[p,u.length]),j.useEffect(()=>{if(!c.length)return;c.forEach(D1);let k=!1;return H1(c,1200).then(b=>{if(!k)for(const[W,P]of Object.entries(b))Om(W,P)}),()=>{k=!0,c.forEach(T1)}},[p]),j.useEffect(()=>{let k=0;const b=()=>{const W=x.current;if(W&&c.length){let P=0;for(const V of c){const ee=Lm(V);ee.t.length&&(P=Math.max(P,ee.t[ee.t.length-1]))}z.current=P;const B=G1(c,P-d);W.setData(B,!1),W.setScale("x",{min:P-d,max:P})}k=requestAnimationFrame(b)};return k=requestAnimationFrame(b),()=>cancelAnimationFrame(k)},[p,d]);const R=j.useMemo(()=>new Map(u.map(k=>[k.id,k])),[u]);return U.jsxs("div",{className:"panel plot-panel",ref:m,children:[U.jsxs("div",{className:"plot-toolbar",children:[U.jsx("span",{className:"muted",children:"window"}),U.jsx("select",{value:d,onChange:k=>i(l,{duration:Number(k.target.value)}),children:[5,10,20,30,60].map(k=>U.jsxs("option",{value:k,children:[k,"s"]},k))}),U.jsx("div",{className:"legend",children:c.map(k=>{const b=R.get(k),W=b?vg(b):{stroke:"#555"};return U.jsxs("span",{className:"legend-chip",children:[U.jsx("span",{className:"legend-swatch",style:{background:W.stroke,opacity:V1(k)?.9:1}}),Af(k),U.jsx("button",{className:"legend-x",onClick:()=>r(l,k),children:"×"})]},k)})})]}),U.jsx("div",{className:"plot-host"+(w?" drop-over":""),ref:v,children:c.length===0&&U.jsx("div",{className:"drop-hint",children:"Drag signals here to plot — drop cmd onto fb to overlay"})})]})}const vf=[["pos","cmd p"],["vel","cmd v"],["kp","kp"],["kd","kd"],["torque","cmd τ"]],yf=[["pos","act p"],["vel","act v"],["torque","act τ"],["t_mos","Tmos"],["t_rotor","Trot"]];function K1(){const l=gn(t=>t.motors);return U.jsx("div",{className:"panel table-panel",children:U.jsxs("table",{className:"motor-table",children:[U.jsx("thead",{children:U.jsxs("tr",{children:[U.jsx("th",{children:"Motor"}),U.jsx("th",{children:"Mode"}),U.jsx("th",{children:"Status"}),vf.map(([t,r])=>U.jsx("th",{className:"cmd-col",children:r},"c"+t)),yf.map(([t,r])=>U.jsx("th",{children:r},"f"+t))]})}),U.jsxs("tbody",{children:[l.length===0&&U.jsx("tr",{children:U.jsx("td",{colSpan:3+vf.length+yf.length,className:"muted center",children:"Waiting for traffic…"})}),l.map(t=>U.jsxs("tr",{children:[U.jsxs("td",{className:"mono",children:["m",t.motorId]}),U.jsx("td",{className:"muted",children:t.mode||"—"}),U.jsx("td",{children:U.jsx("span",{className:"status-pill "+(t.status==="ENABLED"?"ok":t.status==="DISABLED"?"off":"warn"),children:t.status||"—"})}),vf.map(([r])=>U.jsx("td",{className:"mono cmd-col",children:Rl(t.cmd[r],r==="kp"?0:3)},"c"+r)),yf.map(([r])=>U.jsx("td",{className:"mono",children:Rl(t.fb[r],r.startsWith("t_")?1:3)},"f"+r))]},`${t.bus}:${t.motorId}`))]})]})})}function wf({label:l,cmd:t,act:r,unit:i,digits:o=2}){return U.jsxs("div",{className:"metric",children:[U.jsxs("div",{className:"metric-label",children:[l," ",U.jsx("span",{className:"muted",children:i})]}),U.jsxs("div",{className:"metric-values",children:[U.jsx("span",{className:"metric-act",children:Rl(r,o)}),t!==void 0&&U.jsxs("span",{className:"metric-cmd",children:["⌖ ",Rl(t,o)]})]})]})}function Q1(){const l=gn(r=>r.motors),t=gn(r=>r.motorTypes);return U.jsxs("div",{className:"panel cards-panel",children:[l.length===0&&U.jsx("div",{className:"muted center pad",children:"Waiting for traffic…"}),U.jsx("div",{className:"cards-grid",children:l.map(r=>U.jsxs("div",{className:"motor-card",children:[U.jsxs("div",{className:"motor-card-head",children:[U.jsxs("span",{className:"mono strong",children:["Motor ",r.motorId]}),U.jsx("span",{className:"status-pill "+(r.status==="ENABLED"?"ok":r.status==="DISABLED"?"off":"warn"),children:r.status||"—"})]}),U.jsxs("div",{className:"motor-card-sub",children:[U.jsx("span",{className:"muted",children:r.mode||"—"}),t.length>0&&U.jsxs("select",{className:"type-select",defaultValue:"",onChange:i=>i.target.value&&j1(r.motorId,i.target.value),title:"Override motor type used to scale this motor's values",children:[U.jsx("option",{value:"",children:"set type…"}),t.map(i=>U.jsx("option",{value:i,children:i},i))]})]}),U.jsx(wf,{label:"Position",unit:"rad",cmd:r.cmd.pos,act:r.fb.pos,digits:3}),U.jsx(wf,{label:"Velocity",unit:"rad/s",cmd:r.cmd.vel,act:r.fb.vel,digits:2}),U.jsx(wf,{label:"Torque",unit:"Nm",cmd:r.cmd.torque,act:r.fb.torque,digits:2}),U.jsxs("div",{className:"temp-row",children:[U.jsxs("span",{children:["MOS ",Rl(r.fb.t_mos,1),"°"]}),U.jsxs("span",{children:["Rotor ",Rl(r.fb.t_rotor,1),"°"]})]})]},`${r.bus}:${r.motorId}`))})]})}function X1(l,t,r){const i=new Array(l);return new Proxy(i,{get(o,u,c){if(typeof u=="string"){const d=u.charCodeAt(0);if(d>=48&&d<=57){const p=+u;if(Number.isInteger(p)&&p>=0&&pi[w]!==m))&&(i=d,o=t(...d),r!=null&&r.onChange&&!(u&&r.skipInitialOnChange)&&r.onChange(o),u=!1),o}return c.updateDeps=d=>{i=d},c}function Sg(l,t){if(l===void 0)throw new Error("Unexpected undefined");return l}const q1=(l,t)=>Math.abs(l-t)<1.01,J1=(l,t,r)=>{let i;return function(...o){l.clearTimeout(i),i=l.setTimeout(()=>t.apply(this,o),r)}};let mo;const Sf=()=>{if(mo!==void 0)return mo;if(typeof navigator>"u")return mo=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return mo=!0;const l=navigator.maxTouchPoints;return mo=navigator.platform==="MacIntel"&&l!==void 0&&l>0},xg=l=>{const{offsetWidth:t,offsetHeight:r}=l;return{width:t,height:r}},Z1=l=>l,eS=l=>{const t=Math.max(l.startIndex-l.overscan,0),i=Math.min(l.endIndex+l.overscan,l.count-1)-t+1,o=new Array(i);for(let u=0;u{const r=l.scrollElement;if(!r)return;const i=l.targetWindow;if(!i)return;const o=c=>{const{width:d,height:p}=c;t({width:Math.round(d),height:Math.round(p)})};if(o(xg(r)),!i.ResizeObserver)return()=>{};const u=new i.ResizeObserver(c=>{const d=()=>{const p=c[0];if(p!=null&&p.borderBoxSize){const m=p.borderBoxSize[0];if(m){o({width:m.inlineSize,height:m.blockSize});return}}o(xg(r))};l.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(d):d()});return u.observe(r,{box:"border-box"}),()=>{u.unobserve(r)}},du={passive:!0},nS=typeof window>"u"?!0:"onscrollend"in window,rS=(l,t,r)=>{const i=l.scrollElement;if(!i)return;const o=l.targetWindow;if(!o)return;const u=l.options.useScrollendEvent&&nS;let c=0;const d=u?null:J1(o,()=>t(c,!1),l.options.isScrollingResetDelay),p=v=>()=>{c=r(i),d==null||d(),t(c,v)},m=p(!0),w=p(!1);return i.addEventListener("scroll",m,du),u&&i.addEventListener("scrollend",w,du),()=>{i.removeEventListener("scroll",m),u&&i.removeEventListener("scrollend",w)}},iS=(l,t)=>rS(l,t,r=>{const{horizontal:i,isRtl:o}=l.options;return i?r.scrollLeft*(o&&-1||1):r.scrollTop}),sS=(l,t,r)=>{if(r.options.useCachedMeasurements){const i=r.indexFromElement(l),o=r.options.getItemKey(i);return r.itemSizeCache.get(o)??r.options.estimateSize(i)}if(t!=null&&t.borderBoxSize){const i=t.borderBoxSize[0];if(i)return Math.round(i[r.options.horizontal?"inlineSize":"blockSize"])}if(!t){const i=r.indexFromElement(l),o=r.options.getItemKey(i),u=r.itemSizeCache.get(o);if(u!==void 0)return u}return l[r.options.horizontal?"offsetWidth":"offsetHeight"]},lS=(l,{adjustments:t=0,behavior:r},i)=>{var o,u;(u=(o=i.scrollElement)==null?void 0:o.scrollTo)==null||u.call(o,{[i.options.horizontal?"left":"top"]:l+t,behavior:r})},oS=lS;class aS{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var r,i,o;return((o=(i=(r=this.targetWindow)==null?void 0:r.performance)==null?void 0:i.now)==null?void 0:o.call(i))??Date.now()},this.observer=(()=>{let r=null;const i=()=>r||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:r=new this.targetWindow.ResizeObserver(o=>{o.forEach(u=>{const c=()=>{const d=u.target,p=this.indexFromElement(d);if(!d.isConnected){this.observer.unobserve(d);for(const[m,w]of this.elementsCache)if(w===d){this.elementsCache.delete(m);break}return}this.shouldMeasureDuringScroll(p)&&this.resizeItem(p,this.options.measureElement(d,u,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(c):c()})}));return{disconnect:()=>{var o;(o=i())==null||o.disconnect(),r=null},observe:o=>{var u;return(u=i())==null?void 0:u.observe(o,{box:"border-box"})},unobserve:o=>{var u;return(u=i())==null?void 0:u.unobserve(o)}}})(),this.range=null,this.setOptions=r=>{var i,o;const u={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Z1,rangeExtractor:eS,onChange:()=>{},measureElement:sS,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const x in r){const z=r[x];z!==void 0&&(u[x]=z)}const c=this.options;let d=null,p=null,m=!1;if(c!==void 0&&c.enabled&&u.enabled&&u.anchorTo==="end"&&this.scrollElement!==null){const x=c.count,z=u.count,R=this.getMeasurements(),k=x>0?((i=R[0])==null?void 0:i.key)??c.getItemKey(0):null,b=x>0?((o=R[x-1])==null?void 0:o.key)??c.getItemKey(x-1):null;if(z!==x||x>0&&z>0&&(u.getItemKey(0)!==k||u.getItemKey(z-1)!==b)){m=!0;const B=x>0?this.getVirtualItemForOffset(this.getScrollOffset())??R[0]:null;B&&(d=[B.key,this.getScrollOffset()-B.start]);const V=u.followOnAppend===!0?"auto":u.followOnAppend||null;V&&z>x&&this.isAtEnd(c.scrollEndThreshold)&&(x===0||u.getItemKey(z-1)!==b)&&(p=V)}}this.options=u,m&&(this.pendingMin=0,this.itemSizeCacheVersion++);let w=!1,v=0;if(d&&this.scrollOffset!==null){const[x,z]=d,R=this.getMeasurements(),{count:k,getItemKey:b}=this.options;let W=0;for(;W{var i,o;(o=(i=this.options).onChange)==null||o.call(i,this,r)},this.maybeNotify=ml(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),r=>{this.notify(r)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(r=>r()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var r;const i=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==i){if(this.cleanup(),!i){this.maybeNotify();return}if(this.scrollElement=i,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((r=this.scrollElement)==null?void 0:r.window)??null,this.elementsCache.forEach(u=>{this.observer.observe(u)}),this.unsubs.push(this.options.observeElementRect(this,u=>{this.scrollRect=u,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(u,c)=>{this._intendedScrollOffset!==null&&Math.abs(u-this._intendedScrollOffset)<1.5&&(u=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=c?this.getScrollOffset(){this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},d=()=>{this._iosTouching=!1,!(!Sf()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};u.addEventListener("touchstart",c,du),u.addEventListener("touchend",d,du),this.unsubs.push(()=>{u.removeEventListener("touchstart",c),u.removeEventListener("touchend",d),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const o=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,o&&this.scrollElement&&this.options.enabled){const[u,c,d,p]=o;u!==null&&!d&&(Sf()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?p!==0&&(this._iosDeferredAdjustment+=p):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),d&&this.scrollToEnd({behavior:d})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const r=this.getScrollOffset(),i=this.getMaxScrollOffset();if(r<0||r>i)return;const o=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(r,{adjustments:this.scrollAdjustments+=o,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(r,i)=>{const o=new Map,u=new Map;for(let c=i-1;c>=0;c--){const d=r[c];if(o.has(d.lane))continue;const p=u.get(d.lane);if(p==null||d.end>p.end?u.set(d.lane,d):d.endc.end===d.end?c.index-d.index:c.end-d.end)[0]:void 0},this.getMeasurementOptions=ml(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(r,i,o,u,c,d,p)=>(this.prevLanes!==void 0&&this.prevLanes!==d&&(this.lanesChangedFlag=!0),this.prevLanes=d,this.pendingMin=null,{count:r,paddingStart:i,scrollMargin:o,getItemKey:u,enabled:c,lanes:d,laneAssignmentMode:p}),{key:!1}),this.getMeasurements=ml(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:r,paddingStart:i,scrollMargin:o,getItemKey:u,enabled:c,lanes:d,laneAssignmentMode:p},m)=>{const w=this.itemSizeCache;if(!c)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>r)for(const R of this.laneAssignments.keys())R>=r&&this.laneAssignments.delete(R);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(R=>{this.itemSizeCache.set(R.key,R.size)}));const v=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===r&&(this.lanesSettling=!1),d===1){const R=this.options.gap,k=r*2;let b=this._flatMeasurements;if(!b||b.length0&&B.set(b.subarray(0,v*2)),b=B,this._flatMeasurements=b}let W;if(v===0)W=i+o;else{const B=v-1;W=b[B*2]+b[B*2+1]+R}for(let B=v;B1){W=b;const Z=z[W],re=Z!==void 0?x[Z]:void 0;P=re?re.end+this.options.gap:i+o}else{const Z=this.options.lanes===1?x[R-1]:this.getFurthestMeasurement(x,R);P=Z?Z.end+this.options.gap:i+o,W=Z?Z.lane:R%this.options.lanes,this.options.lanes>1&&B&&this.laneAssignments.set(R,W)}const V=w.get(k),ee=typeof V=="number"?V:this.options.estimateSize(R),G=P+ee;x[R]={index:R,start:P,size:ee,end:G,key:k,lane:W},z[W]=R}return this.measurementsCache=x,x},{key:!1,debug:()=>this.options.debug}),this.calculateRange=ml(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(r,i,o,u)=>this.range=r.length>0&&i>0?uS({measurements:r,outerSize:i,scrollOffset:o,lanes:u,flat:u===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=ml(()=>{let r=null,i=null;const o=this.calculateRange();return o&&(r=o.startIndex,i=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,r,i]),[this.options.rangeExtractor,this.options.overscan,this.options.count,r,i]},(r,i,o,u,c)=>u===null||c===null?[]:r({startIndex:u,endIndex:c,overscan:i,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=r=>{const i=this.options.indexAttribute,o=r.getAttribute(i);return o?parseInt(o,10):(console.warn(`Missing attribute name '${i}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=r=>{var i;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const o=this.scrollState.index??((i=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:i.index);if(o!==void 0&&this.range){const u=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),c=Math.max(0,o-u),d=Math.min(this.options.count-1,o+u);return r>=c&&r<=d}return!0},this.measureElement=r=>{if(!r){this.elementsCache.forEach((c,d)=>{c.isConnected||(this.observer.unobserve(c),this.elementsCache.delete(d))});return}const i=this.indexFromElement(r),o=this.options.getItemKey(i),u=this.elementsCache.get(o);u!==r&&(u&&this.observer.unobserve(u),this.observer.observe(r),this.elementsCache.set(o,r)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(i)&&this.resizeItem(i,this.options.measureElement(r,void 0,this))},this.resizeItem=(r,i)=>{var o,u;if(r<0||r>=this.options.count)return;let c,d,p;const m=this._flatMeasurements;if(this.options.lanes===1&&m!==null)p=this.options.getItemKey(r),d=m[r*2],c=m[r*2+1];else{const x=this.measurementsCache[r];if(!x)return;p=x.key,d=x.start,c=x.size}const w=this.itemSizeCache.get(p)??c,v=i-w;if(v!==0){const x=this.options.anchorTo==="end"&&((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,z=x?this.getTotalSize():0,R=((u=this.scrollState)==null?void 0:u.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[r]??{index:r,key:p,start:d,size:c,end:d+c,lane:0},v,this):d[this.getVirtualIndexes(),this.getMeasurements()],(r,i)=>{const o=[];for(let u=0,c=r.length;uthis.options.debug}),this.getVirtualItemForOffset=r=>{const i=this.getMeasurements();if(i.length===0)return;const o=this._flatMeasurements,u=this.options.lanes===1&&o!=null,c=Hm(0,i.length-1,u?d=>o[d*2]:d=>Sg(i[d]).start,r);return Sg(i[c])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const r=this.scrollElement.document.documentElement;return this.options.horizontal?r.scrollWidth-this.scrollElement.innerWidth:r.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(r=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=r,this.getOffsetForAlignment=(r,i,o=0)=>{if(!this.scrollElement)return 0;const u=this.getSize(),c=this.getScrollOffset();i==="auto"&&(i=r>=c+u?"end":"start"),i==="center"?r+=(o-u)/2:i==="end"&&(r-=u);const d=this.getMaxScrollOffset();return Math.max(Math.min(d,r),0)},this.getOffsetForIndex=(r,i="auto")=>{r=Math.max(0,Math.min(r,this.options.count-1));const o=this.getSize(),u=this.getScrollOffset(),c=this.measurementsCache[r];if(!c)return;if(i==="auto")if(c.end>=u+o-this.options.scrollPaddingEnd)i="end";else if(c.start<=u+this.options.scrollPaddingStart)i="start";else return[u,i];if(i==="end"&&r===this.options.count-1)return[this.getMaxScrollOffset(),i];const d=i==="end"?c.end+this.options.scrollPaddingEnd:c.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(d,i,c.size),i]},this.scrollToOffset=(r,{align:i="start",behavior:o="auto"}={})=>{const u=this.getOffsetForAlignment(r,i),c=this.now();this.scrollState={index:null,align:i,behavior:o,startedAt:c,lastTargetOffset:u,stableFrames:0},this._scrollToOffset(u,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(r,{align:i="auto",behavior:o="auto"}={})=>{r=Math.max(0,Math.min(r,this.options.count-1));const u=this.getOffsetForIndex(r,i);if(!u)return;const[c,d]=u,p=this.now();this.scrollState={index:r,align:d,behavior:o,startedAt:p,lastTargetOffset:c,stableFrames:0},this._scrollToOffset(c,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(r,{behavior:i="auto"}={})=>{const o=this.getScrollOffset()+r,u=this.now();this.scrollState={index:null,align:"start",behavior:i,startedAt:u,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:r="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:r});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:r})},this.getTotalSize=()=>{var r;const i=this.getMeasurements();let o;if(i.length===0)o=this.options.paddingStart;else if(this.options.lanes===1){const u=i.length-1,c=this._flatMeasurements;c!=null?o=c[u*2]+c[u*2+1]:o=((r=i[u])==null?void 0:r.end)??0}else{const u=Array(this.options.lanes).fill(null);let c=i.length-1;for(;c>=0&&u.some(d=>d===null);){const d=i[c];u[d.lane]===null&&(u[d.lane]=d.end),c--}o=Math.max(...u.filter(d=>d!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const r=[];if(this.itemSizeCache.size===0)return r;const i=this.getMeasurements();for(const o of i)o&&this.itemSizeCache.has(o.key)&&r.push({index:o.index,key:o.key,start:o.start,size:o.size,end:o.end,lane:o.lane});return r},this._scrollToOffset=(r,{adjustments:i,behavior:o})=>{this._intendedScrollOffset=r+(i??0),this.options.scrollToFn(r,{behavior:o,adjustments:i},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}applyScrollAdjustment(t,r){t!==0&&(Sf()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=t:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:r}))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const i=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,o=i?i[0]:this.scrollState.lastTargetOffset,u=1,c=o!==this.scrollState.lastTargetOffset;if(!c&&q1(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=u){this.getScrollOffset()!==o&&this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,c){const d=this.getSize()||600,p=Math.abs(o-this.getScrollOffset()),m=this.scrollState.behavior==="smooth"&&p>d;this.scrollState.lastTargetOffset=o,m||(this.scrollState.behavior="auto"),this._scrollToOffset(o,{adjustments:void 0,behavior:m?"smooth":"auto"})}this.scheduleScrollReconcile()}}const Hm=(l,t,r,i)=>{for(;l<=t;){const o=(l+t)/2|0,u=r(o);if(ui)t=o-1;else return o}return l>0?l-1:0};function uS({measurements:l,outerSize:t,scrollOffset:r,lanes:i,flat:o}){const u=l.length-1,c=o?w=>o[w*2]:w=>l[w].start,d=o?w=>o[w*2]+o[w*2+1]:w=>l[w].end;if(l.length<=i)return{startIndex:0,endIndex:u};let p=Hm(0,u,c,r),m=p;if(i===1)for(;m1){const w=Array(i).fill(0);for(;mx=0&&v.some(x=>x>=r);){const x=l[p];v[x.lane]=x.start,p--}p=Math.max(0,p-p%i),m=Math.min(u,m+(i-1-m%i))}return{startIndex:p,endIndex:m}}const xf=typeof document<"u"?j.useLayoutEffect:j.useEffect;function cS({useFlushSync:l=!0,directDomUpdates:t=!1,directDomUpdatesMode:r="transform",...i}){const o=j.useReducer(m=>m+1,0)[1],u=j.useRef({enabled:t,mode:r,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});u.current.enabled=t,u.current.mode=r;const c=m=>{const w=u.current;if(!w.enabled||!w.container)return;const v=m.getTotalSize();if(v!==w.lastSize){w.lastSize=v;const W=m.options.horizontal?"width":"height";w.container.style[W]=`${v}px`}const x=!!m.options.horizontal,z=w.mode==="transform",R=x?"left":"top",k=m.options.scrollMargin,b=m.getVirtualItems();for(const W of b){const P=W.start-k,B=m.elementsCache.get(W.key);B&&w.lastPositions.get(B)!==P&&(w.lastPositions.set(B,P),z?B.style.transform=x?`translate3d(${P}px, 0, 0)`:`translate3d(0, ${P}px, 0)`:B.style[R]=`${P}px`)}},d={...i,onChange:(m,w)=>{var v;const x=u.current;let z=!0;if(x.enabled){c(m);const R=m.range,k=x.prevRange;z=!k||k.isScrolling!==m.isScrolling||k.startIndex!==(R==null?void 0:R.startIndex)||k.endIndex!==(R==null?void 0:R.endIndex),z&&(x.prevRange=R?{startIndex:R.startIndex,endIndex:R.endIndex,isScrolling:m.isScrolling}:null)}z&&(l&&w?bs.flushSync(o):o()),(v=i.onChange)==null||v.call(i,m,w)}},[p]=j.useState(()=>{const m=new aS(d);return Object.assign(m,{containerRef:w=>{const v=u.current;if(v.container=w,v.lastSize=null,w&&v.enabled){const x=m.getTotalSize();v.lastSize=x;const z=m.options.horizontal?"width":"height";w.style[z]=`${x}px`}}})});return p.setOptions(d),xf(()=>p._didMount(),[]),xf(()=>p._willUpdate()),xf(()=>{c(p)}),p}function fS(l){return cS({observeElementRect:tS,observeElementOffset:iS,scrollToFn:oS,...l})}const dS={pos:"p",vel:"v",torque:"τ",kp:"kp",kd:"kd",vel_limit:"vlim",torque_limit:"τlim",t_mos:"Tm",t_rotor:"Tr"},hS=["pos","vel","torque","kp","kd","t_mos","t_rotor"];function pS(l){const t=[];for(const r of hS)r in l.fields&&t.push(`${dS[r]||r} ${l.fields[r].toFixed(2)}`);return t.join(" ")||l.note||""}function gS(l){const t=new Date(l*1e3),r=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0"),o=String(t.getSeconds()).padStart(2,"0"),u=String(Math.floor(l%1*1e3)).padStart(3,"0");return`${r}:${i}:${o}.${u}`}function mS(){const[,l]=j.useState(0),[t,r]=j.useState(!1),i=j.useRef(null),o=j.useRef([]);j.useEffect(()=>{pg(!0);const d=L1(()=>{t||(o.current=O1(),l(p=>p+1))});return()=>{pg(!1),d()}},[t]);const u=o.current,c=fS({count:u.length,getScrollElement:()=>i.current,estimateSize:()=>22,overscan:12});return j.useEffect(()=>{!t&&u.length&&c.scrollToIndex(u.length-1)},[u.length,t,c]),U.jsxs("div",{className:"panel rawlog-panel",children:[U.jsxs("div",{className:"rawlog-toolbar",children:[U.jsx("button",{className:t?"btn small":"btn small active",onClick:()=>r(d=>!d),children:t?"Resume":"Pause"}),U.jsxs("span",{className:"muted",children:[u.length," frames"]})]}),U.jsxs("div",{className:"rawlog-body",ref:i,children:[U.jsxs("div",{className:"rawlog-head",children:[U.jsx("span",{className:"c-t",children:"time"}),U.jsx("span",{className:"c-arb",children:"arb"}),U.jsx("span",{className:"c-m",children:"motor"}),U.jsx("span",{className:"c-k",children:"kind"}),U.jsx("span",{className:"c-f",children:"decoded"}),U.jsx("span",{className:"c-r",children:"raw"})]}),U.jsx("div",{style:{height:c.getTotalSize(),position:"relative"},children:c.getVirtualItems().map(d=>{const p=u[d.index];return U.jsxs("div",{className:"rawlog-row k-"+p.kind,style:{transform:`translateY(${d.start}px)`},children:[U.jsx("span",{className:"c-t mono",children:gS(p.t)}),U.jsxs("span",{className:"c-arb mono",children:["0x",p.arb.toString(16).toUpperCase()]}),U.jsxs("span",{className:"c-m mono",children:["m",p.motorId]}),U.jsx("span",{className:"c-k",children:p.mode||p.kind}),U.jsx("span",{className:"c-f mono",children:pS(p)}),U.jsx("span",{className:"c-r mono dim",children:p.raw})]},p.seq)})})]})]})}const Fm=[{kind:"plot",title:"Plot",icon:"〜",description:"Time-series chart; drag signals onto it (cmd over fb to overlay).",render:l=>U.jsx(Y1,{panelId:l})},{kind:"table",title:"Motor Table",icon:"▦",description:"One row per motor: commanded vs actual.",render:()=>U.jsx(K1,{})},{kind:"cards",title:"Motor Cards",icon:"▢",description:"Per-motor cards/gauges with big readouts.",render:()=>U.jsx(Q1,{})},{kind:"rawlog",title:"Raw CAN Log",icon:"≣",description:"Scrolling decoded frame log.",render:()=>U.jsx(mS,{})}],vS=Object.fromEntries(Fm.map(l=>[l.kind,l])),jm="damiao.monitor.theme";function Wm(){return localStorage.getItem(jm)==="dark"?"dark":"light"}function Bm(l){document.documentElement.setAttribute("data-theme",l)}function yS(l){try{localStorage.setItem(jm,l)}catch{}Bm(l)}function wS(){Bm(Wm())}function SS(){const l=gn(p=>p.connected),t=gn(p=>p.status),r=Eo(p=>p.addWidget),i=Eo(p=>p.resetWidgets),[o,u]=j.useState(Wm()),c=()=>i(),d=()=>{const p=o==="light"?"dark":"light";yS(p),u(p)};return U.jsxs("header",{className:"toolbar",children:[U.jsxs("div",{className:"brand",children:[U.jsx("span",{className:"brand-dot"}),"DaMiao ",U.jsx("span",{className:"brand-sub",children:"Passive Monitor"})]}),U.jsxs("div",{className:"conn",children:[U.jsx("span",{className:"dot "+(l?"on":"off")}),U.jsx("span",{className:"mono",children:t!=null&&t.demo?"demo":(t==null?void 0:t.channel)||"—"}),t&&!t.demo&&U.jsx("span",{className:"badge "+(t.listenOnly?"ok":"warn"),title:"hardware listen-only",children:t.listenOnly?"listen-only":"rx (no TX)"}),(t==null?void 0:t.error)&&U.jsx("span",{className:"badge err",title:t.error,children:"bus error"}),t&&U.jsxs("span",{className:"muted small",children:[t.framesSeen.toLocaleString()," frames · +",t.feedbackOffset," fb"]})]}),U.jsx("div",{className:"spacer"}),U.jsxs("div",{className:"actions",children:[Fm.map(p=>U.jsxs("button",{className:"btn",title:p.description,onClick:()=>r(p.kind),children:[U.jsx("span",{className:"btn-icon",children:p.icon})," ",p.title]},p.kind)),U.jsx("button",{className:"btn ghost",onClick:d,title:`Switch to ${o==="light"?"dark":"light"} mode`,children:o==="light"?"☾":"☀"}),U.jsx("button",{className:"btn ghost",onClick:c,children:"Reset"})]})]})}function xS({sig:l}){const{attributes:t,listeners:r,setNodeRef:i,isDragging:o}=l0({id:`sig:${l.id}`,data:{signalId:l.id}}),u=B1(l);return U.jsxs("div",{ref:i,className:"sig-chip"+(o?" dragging":""),...r,...t,title:l.id,children:[U.jsx("span",{className:"sig-swatch",style:{background:u,borderStyle:l.source==="cmd"?"dashed":"solid"}}),U.jsxs("span",{className:"sig-name",children:[l.source,".",l.field]}),l.unit&&U.jsx("span",{className:"sig-unit",children:l.unit})]})}function _S(l){return[...l].sort((t,r)=>{if(t.source!==r.source)return t.source==="cmd"?-1:1;const i=yg.indexOf(t.field),o=yg.indexOf(r.field);return(i<0?99:i)-(o<0?99:o)})}function ES(){const l=gn(u=>u.signals),t=gn(u=>u.status),[r,i]=j.useState(""),o=j.useMemo(()=>{const u=new Map;for(const c of l){if(r&&!c.id.toLowerCase().includes(r.toLowerCase()))continue;const d=u.get(c.motorId)||[];d.push(c),u.set(c.motorId,d)}return Array.from(u.entries()).sort((c,d)=>c[0]-d[0])},[l,r]);return U.jsxs("aside",{className:"sidebar",children:[U.jsxs("div",{className:"sidebar-head",children:[U.jsx("div",{className:"sidebar-title",children:"Signals"}),U.jsx("input",{className:"filter",placeholder:"filter…",value:r,onChange:u=>i(u.target.value)})]}),U.jsxs("div",{className:"sidebar-body",children:[o.length===0&&U.jsx("div",{className:"muted pad",children:t!=null&&t.error?"Bus error — see top bar.":"No signals yet. Start a controller on the bus (or run --demo)."}),o.map(([u,c])=>U.jsxs("div",{className:"motor-group",children:[U.jsxs("div",{className:"motor-group-title",children:["Motor ",u]}),U.jsx("div",{className:"chips",children:_S(c).map(d=>U.jsx(xS,{sig:d},d.id))})]},u))]}),U.jsxs("div",{className:"sidebar-foot muted",children:["Drag a signal onto a plot. Drop ",U.jsx("b",{children:"cmd"})," onto its ",U.jsx("b",{children:"fb"})," plot to overlay."]})]})}function CS(l,t,r,i,o){const u=(...c)=>(console.warn("gridstack.js: Function `"+r+"` is deprecated in "+o+" and has been replaced with `"+i+"`. It will be **removed** in a future release"),t.apply(l,c));return u.prototype=t.prototype,u}class A{static getElements(t,r=document){if(typeof t=="string"){const i="getElementById"in r?r:void 0;if(i&&!isNaN(+t[0])){const u=i.getElementById(t);return u?[u]:[]}let o=r.querySelectorAll(t);return!o.length&&t[0]!=="."&&t[0]!=="#"&&(o=r.querySelectorAll("."+t),o.length||(o=r.querySelectorAll("#"+t))),Array.from(o)}return[t]}static getElement(t,r=document){if(typeof t=="string"){const i="getElementById"in r?r:void 0;if(!t.length)return null;if(i&&t[0]==="#")return i.getElementById(t.substring(1));if(t[0]==="#"||t[0]==="."||t[0]==="[")return r.querySelector(t);if(i&&!isNaN(+t[0]))return i.getElementById(t);let o=r.querySelector(t);return i&&!o&&(o=i.getElementById(t)),o||(o=r.querySelector("."+t)),o}return t}static lazyLoad(t){var r,i;return t.lazyLoad||((i=(r=t.grid)==null?void 0:r.opts)==null?void 0:i.lazyLoad)&&t.lazyLoad!==!1}static createDiv(t,r){const i=document.createElement("div");return t.forEach(o=>{o&&i.classList.add(o)}),r==null||r.appendChild(i),i}static shouldSizeToContent(t,r=!1){return(t==null?void 0:t.grid)&&(r?t.sizeToContent===!0||t.grid.opts.sizeToContent===!0&&t.sizeToContent===void 0:!!t.sizeToContent||t.grid.opts.sizeToContent&&t.sizeToContent!==!1)}static isIntercepted(t,r){return!(t.y>=r.y+r.h||t.y+t.h<=r.y||t.x+t.w<=r.x||t.x>=r.x+r.w)}static isTouching(t,r){return A.isIntercepted(t,{x:r.x-.5,y:r.y-.5,w:r.w+1,h:r.h+1})}static areaIntercept(t,r){const i=t.x>r.x?t.x:r.x,o=t.x+t.wr.y?t.y:r.y,c=t.y+t.h{const c=r*((o.y??1e4)-(u.y??1e4));return c===0?r*((o.x??1e4)-(u.x??1e4)):c})}static find(t,r){return r?t.find(i=>i.id===r):void 0}static createStylesheet(t,r,i){const o=document.createElement("style"),u=i==null?void 0:i.nonce;return u&&(o.nonce=u),o.setAttribute("type","text/css"),o.setAttribute("gs-style-id",t),o.styleSheet?o.styleSheet.cssText="":o.appendChild(document.createTextNode("")),r?r.insertBefore(o,r.firstChild):(r=document.getElementsByTagName("head")[0],r.appendChild(o)),o}static removeStylesheet(t,r){const o=(r||document).querySelector("STYLE[gs-style-id="+t+"]");o&&o.parentNode&&o.remove()}static addCSSRule(t,r,i){t.textContent+=`${r} { ${i} } `}static toBool(t){return typeof t=="boolean"?t:typeof t=="string"?(t=t.toLowerCase(),!(t===""||t==="no"||t==="false"||t==="0")):!!t}static toNumber(t){return t===null||t.length===0?void 0:Number(t)}static parseHeight(t){let r,i="px";if(typeof t=="string")if(t==="auto"||t==="")r=0;else{const o=t.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!o)throw new Error(`Invalid height val = ${t}`);i=o[2]||"px",r=parseFloat(o[1])}else r=t;return{h:r,unit:i}}static defaults(t,...r){return r.forEach(i=>{for(const o in i){if(!i.hasOwnProperty(o))return;t[o]===null||t[o]===void 0?t[o]=i[o]:typeof i[o]=="object"&&typeof t[o]=="object"&&this.defaults(t[o],i[o])}}),t}static same(t,r){if(typeof t!="object")return t==r;if(typeof t!=typeof r||Object.keys(t).length!==Object.keys(r).length)return!1;for(const i in t)if(t[i]!==r[i])return!1;return!0}static copyPos(t,r,i=!1){return r.x!==void 0&&(t.x=r.x),r.y!==void 0&&(t.y=r.y),r.w!==void 0&&(t.w=r.w),r.h!==void 0&&(t.h=r.h),i&&(r.minW&&(t.minW=r.minW),r.minH&&(t.minH=r.minH),r.maxW&&(t.maxW=r.maxW),r.maxH&&(t.maxH=r.maxH)),t}static samePos(t,r){return t&&r&&t.x===r.x&&t.y===r.y&&(t.w||1)===(r.w||1)&&(t.h||1)===(r.h||1)}static sanitizeMinMax(t){t.minW||delete t.minW,t.minH||delete t.minH,t.maxW||delete t.maxW,t.maxH||delete t.maxH}static removeInternalAndSame(t,r){if(!(typeof t!="object"||typeof r!="object"))for(let i in t){const o=t[i],u=r[i];i[0]==="_"||o===u?delete t[i]:o&&typeof o=="object"&&u!==void 0&&(A.removeInternalAndSame(o,u),Object.keys(o).length||delete t[i])}}static removeInternalForSave(t,r=!0){for(let i in t)(i[0]==="_"||t[i]===null||t[i]===void 0)&&delete t[i];delete t.grid,r&&delete t.el,t.autoPosition||delete t.autoPosition,t.noResize||delete t.noResize,t.noMove||delete t.noMove,t.locked||delete t.locked,(t.w===1||t.w===t.minW)&&delete t.w,(t.h===1||t.h===t.minH)&&delete t.h}static throttle(t,r){let i=!1;return(...o)=>{i||(i=!0,setTimeout(()=>{t(...o),i=!1},r))}}static removePositioningStyles(t){const r=t.style;r.position&&r.removeProperty("position"),r.left&&r.removeProperty("left"),r.top&&r.removeProperty("top"),r.width&&r.removeProperty("width"),r.height&&r.removeProperty("height")}static getScrollElement(t){if(!t)return document.scrollingElement||document.documentElement;const r=getComputedStyle(t);return/(auto|scroll)/.test(r.overflow+r.overflowY)?t:this.getScrollElement(t.parentElement)}static updateScrollPosition(t,r,i){const o=t.getBoundingClientRect(),u=window.innerHeight||document.documentElement.clientHeight;if(o.top<0||o.bottom>u){const c=o.bottom-u,d=o.top,p=this.getScrollElement(t);if(p!==null){const m=p.scrollTop;o.top<0&&i<0?t.offsetHeight>u?p.scrollTop+=i:p.scrollTop+=Math.abs(d)>Math.abs(i)?i:d:i>0&&(t.offsetHeight>u?p.scrollTop+=i:p.scrollTop+=c>i?i:c),r.top+=p.scrollTop-m}}}static updateScrollResize(t,r,i){const o=this.getScrollElement(r),u=o.clientHeight,c=o===this.getScrollElement()?0:o.getBoundingClientRect().top,d=t.clientY-c,p=du-i;p?o.scrollBy({behavior:"smooth",top:d-i}):m&&o.scrollBy({behavior:"smooth",top:i-(u-d)})}static clone(t){return t==null||typeof t!="object"?t:t instanceof Array?[...t]:{...t}}static cloneDeep(t){const r=["parentGrid","el","grid","subGrid","engine"],i=A.clone(t);for(const o in i)i.hasOwnProperty(o)&&typeof i[o]=="object"&&o.substring(0,2)!=="__"&&!r.find(u=>u===o)&&(i[o]=A.cloneDeep(t[o]));return i}static cloneNode(t){const r=t.cloneNode(!0);return r.removeAttribute("id"),r}static appendTo(t,r){let i;typeof r=="string"?i=A.getElement(r):i=r,i&&i.appendChild(t)}static addElStyles(t,r){if(r instanceof Object)for(const i in r)r.hasOwnProperty(i)&&(Array.isArray(r[i])?r[i].forEach(o=>{t.style[i]=o}):t.style[i]=r[i])}static initEvent(t,r){const i={type:r.type},o={button:0,which:0,buttons:1,bubbles:!0,cancelable:!0,target:r.target?r.target:t.target};return["altKey","ctrlKey","metaKey","shiftKey"].forEach(u=>i[u]=t[u]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(u=>i[u]=t[u]),{...i,...o}}static simulateMouseEvent(t,r,i){const o=t,u=new MouseEvent(r,{bubbles:!0,composed:!0,cancelable:!0,view:window,detail:1,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY,ctrlKey:o.ctrlKey??!1,altKey:o.altKey??!1,shiftKey:o.shiftKey??!1,metaKey:o.metaKey??!1,button:0,relatedTarget:t.target});(i||t.target).dispatchEvent(u)}static getValuesFromTransformedElement(t){const r=document.createElement("div");A.addElStyles(r,{opacity:"0",position:"fixed",top:"0px",left:"0px",width:"1px",height:"1px",zIndex:"-999999"}),t.appendChild(r);const i=r.getBoundingClientRect();return t.removeChild(r),r.remove(),{xScale:1/i.width,yScale:1/i.height,xOffset:i.left,yOffset:i.top}}static swap(t,r,i){if(!t)return;const o=t[r];t[r]=t[i],t[i]=o}static canBeRotated(t){var r;return!(!t||t.w===t.h||t.locked||t.noResize||(r=t.grid)!=null&&r.opts.disableResize||t.minW&&t.minW===t.maxW||t.minH&&t.minH===t.maxH)}}class ai{constructor(t={}){this.addedNodes=[],this.removedNodes=[],this.defaultColumn=12,this.column=t.column||this.defaultColumn,this.column>this.defaultColumn&&(this.defaultColumn=this.column),this.maxRow=t.maxRow,this._float=t.float,this.nodes=t.nodes||[],this.onChange=t.onChange}batchUpdate(t=!0,r=!0){return!!this.batchMode===t?this:(this.batchMode=t,t?(this._prevFloat=this._float,this._float=!0,this.cleanNodes(),this.saveInitial()):(this._float=this._prevFloat,delete this._prevFloat,r&&this._packNodes(),this._notify()),this)}_useEntireRowArea(t,r){return(!this.float||this.batchMode&&!this._prevFloat)&&!this._hasLocked&&(!t._moving||t._skipDown||r.y<=t.y)}_fixCollisions(t,r=t,i,o={}){if(this.sortNodes(-1),i=i||this.collide(t,r),!i)return!1;if(t._moving&&!o.nested&&!this.float&&this.swap(t,i))return!0;let u=r;!this._loading&&this._useEntireRowArea(t,r)&&(u={x:0,w:this.column,y:r.y,h:r.h},i=this.collide(t,u,o.skip));let c=!1;const d={nested:!0,pack:!1};let p=0;for(;i=i||this.collide(t,u,o.skip);){if(p++>this.nodes.length*2)throw new Error("Infinite collide check");let m;if(i.locked||this._loading||t._moving&&!t._skipDown&&r.y>t.y&&!this.float&&(!this.collide(i,{...i,y:t.y},t)||!this.collide(i,{...i,y:r.y-i.h},t))){t._skipDown=t._skipDown||r.y>t.y;const w={...r,y:i.y+i.h,...d};m=this._loading&&A.samePos(t,w)?!0:this.moveNode(t,w),(i.locked||this._loading)&&m?A.copyPos(r,t):!i.locked&&m&&o.pack&&(this._packNodes(),r.y=i.y+i.h,A.copyPos(t,r)),c=c||m}else m=this.moveNode(i,{...i,y:r.y+r.h,skip:t,...d});if(!m)return c;i=void 0}return c}collide(t,r=t,i){const o=t._id,u=i==null?void 0:i._id;return this.nodes.find(c=>c._id!==o&&c._id!==u&&A.isIntercepted(c,r))}collideAll(t,r=t,i){const o=t._id,u=i==null?void 0:i._id;return this.nodes.filter(c=>c._id!==o&&c._id!==u&&A.isIntercepted(c,r))}directionCollideCoverage(t,r,i){if(!r.rect||!t._rect)return;const o=t._rect,u={...r.rect};u.y>o.y?(u.h+=u.y-o.y,u.y=o.y):u.h+=o.y-u.y,u.x>o.x?(u.w+=u.x-o.x,u.x=o.x):u.w+=o.x-u.x;let c,d=.5;for(let p of i){if(p.locked||!p._rect)break;const m=p._rect;let w=Number.MAX_VALUE,v=Number.MAX_VALUE;o.ym.y+m.h&&(w=(m.y+m.h-u.y)/m.h),o.xm.x+m.w&&(v=(m.x+m.w-u.x)/m.w);const x=Math.min(v,w);x>d&&(d=x,c=p)}return r.collide=c,c}cacheRects(t,r,i,o,u,c){return this.nodes.forEach(d=>d._rect={y:d.y*r+i,x:d.x*t+c,w:d.w*t-c-o,h:d.h*r-i-u}),this}swap(t,r){if(!r||r.locked||!t||t.locked)return!1;function i(){const u=r.x,c=r.y;return r.x=t.x,r.y=t.y,t.h!=r.h?(t.x=u,t.y=r.y+r.h):t.w!=r.w?(t.x=r.x+r.w,t.y=c):(t.x=u,t.y=c),t._dirty=r._dirty=!0,!0}let o;if(t.w===r.w&&t.h===r.h&&(t.x===r.x||t.y===r.y)&&(o=A.isTouching(t,r)))return i();if(o!==!1){if(t.w===r.w&&t.x===r.x&&(o||(o=A.isTouching(t,r)))){if(r.y{let m;c.locked||(c.autoPosition=!0,t==="list"&&d&&(m=p[d-1])),this.addNode(c,!1,m)}),o||delete this._inColumnResize,i||this.batchUpdate(!1),this}set float(t){this._float!==t&&(this._float=t||!1,t||this._packNodes()._notify())}get float(){return this._float||!1}sortNodes(t=1){return this.nodes=A.sort(this.nodes,t),this}_packNodes(){return this.batchMode?this:(this.sortNodes(),this.float?this.nodes.forEach(t=>{if(t._updating||t._orig===void 0||t.y===t._orig.y)return;let r=t.y;for(;r>t._orig.y;)--r,this.collide(t,{x:t.x,y:r,w:t.w,h:t.h})||(t._dirty=!0,t.y=r)}):this.nodes.forEach((t,r)=>{if(!t.locked)for(;t.y>0;){const i=r===0?0:t.y-1;if(!(r===0||!this.collide(t,{x:t.x,y:i,w:t.w,h:t.h})))break;t._dirty=t.y!==i,t.y=i}}),this)}prepareNode(t,r){t._id=t._id??ai._idSeq++;const i=t.id;if(i){let u=1;for(;this.nodes.find(c=>c.id===t.id&&c!==t);)t.id=i+"_"+u++}(t.x===void 0||t.y===void 0||t.x===null||t.y===null)&&(t.autoPosition=!0);const o={x:0,y:0,w:1,h:1};return A.defaults(t,o),t.autoPosition||delete t.autoPosition,t.noResize||delete t.noResize,t.noMove||delete t.noMove,A.sanitizeMinMax(t),typeof t.x=="string"&&(t.x=Number(t.x)),typeof t.y=="string"&&(t.y=Number(t.y)),typeof t.w=="string"&&(t.w=Number(t.w)),typeof t.h=="string"&&(t.h=Number(t.h)),isNaN(t.x)&&(t.x=o.x,t.autoPosition=!0),isNaN(t.y)&&(t.y=o.y,t.autoPosition=!0),isNaN(t.w)&&(t.w=o.w),isNaN(t.h)&&(t.h=o.h),this.nodeBoundFix(t,r),t}nodeBoundFix(t,r){const i=t._orig||A.copyPos({},t);if(t.maxW&&(t.w=Math.min(t.w||1,t.maxW)),t.maxH&&(t.h=Math.min(t.h||1,t.maxH)),t.minW&&(t.w=Math.max(t.w||1,t.minW)),t.minH&&(t.h=Math.max(t.h||1,t.minH)),(t.x||0)+(t.w||1)>this.column&&this.columnthis.column?t.w=this.column:t.w<1&&(t.w=1),this.maxRow&&t.h>this.maxRow?t.h=this.maxRow:t.h<1&&(t.h=1),t.x<0&&(t.x=0),t.y<0&&(t.y=0),t.x+t.w>this.column&&(r?t.w=this.column-t.x:t.x=this.column-t.w),this.maxRow&&t.y+t.h>this.maxRow&&(r?t.h=this.maxRow-t.y:t.y=this.maxRow-t.h),A.samePos(t,i)||(t._dirty=!0),this}getDirtyNodes(t){return t?this.nodes.filter(r=>r._dirty&&!A.samePos(r,r._orig)):this.nodes.filter(r=>r._dirty)}_notify(t){if(this.batchMode||!this.onChange)return this;const r=(t||[]).concat(this.getDirtyNodes());return this.onChange(r),this}cleanNodes(){return this.batchMode?this:(this.nodes.forEach(t=>{delete t._dirty,delete t._lastTried}),this)}saveInitial(){return this.nodes.forEach(t=>{t._orig=A.copyPos({},t),delete t._dirty}),this._hasLocked=this.nodes.some(t=>t.locked),this}restoreInitial(){return this.nodes.forEach(t=>{!t._orig||A.samePos(t,t._orig)||(A.copyPos(t,t._orig),t._dirty=!0)}),this._notify(),this}findEmptyPosition(t,r=this.nodes,i=this.column,o){const u=o?o.y*i+(o.x+o.w):0;let c=!1;for(let d=u;!c;++d){const p=d%i,m=Math.floor(d/i);if(p+t.w>i)continue;const w={x:p,y:m,w:t.w,h:t.h};r.find(v=>A.isIntercepted(w,v))||((t.x!==p||t.y!==m)&&(t._dirty=!0),t.x=p,t.y=m,delete t.autoPosition,c=!0)}return c}addNode(t,r=!1,i){const o=this.nodes.find(c=>c._id===t._id);if(o)return o;this._inColumnResize?this.nodeBoundFix(t):this.prepareNode(t),delete t._temporaryRemoved,delete t._removeDOM;let u;return t.autoPosition&&this.findEmptyPosition(t,this.nodes,this.column,i)&&(delete t.autoPosition,u=!0),this.nodes.push(t),r&&this.addedNodes.push(t),u||this._fixCollisions(t),this.batchMode||this._packNodes()._notify(),t}removeNode(t,r=!0,i=!1){return this.nodes.find(o=>o._id===t._id)?(i&&this.removedNodes.push(t),r&&(t._removeDOM=!0),this.nodes=this.nodes.filter(o=>o._id!==t._id),t._isAboutToRemove||this._packNodes(),this._notify([t]),this):this}removeAll(t=!0,r=!0){if(delete this._layouts,!this.nodes.length)return this;t&&this.nodes.forEach(o=>o._removeDOM=!0);const i=this.nodes;return this.removedNodes=r?i:[],this.nodes=[],this._notify(i)}moveNodeCheck(t,r){if(!this.changedPosConstrain(t,r))return!1;if(r.pack=!0,!this.maxRow)return this.moveNode(t,r);let i;const o=new ai({column:this.column,float:this.float,nodes:this.nodes.map(c=>c._id===t._id?(i={...c},i):{...c})});if(!i)return!1;const u=o.moveNode(i,r)&&o.getRow()<=Math.max(this.getRow(),this.maxRow);if(!u&&!r.resizing&&r.collide){const c=r.collide.el.gridstackNode;if(this.swap(t,c))return this._notify(),!0}return u?(o.nodes.filter(c=>c._dirty).forEach(c=>{const d=this.nodes.find(p=>p._id===c._id);d&&(A.copyPos(d,c),d._dirty=!0)}),this._notify(),!0):!1}willItFit(t){if(delete t._willFitPos,!this.maxRow)return!0;const r=new ai({column:this.column,float:this.float,nodes:this.nodes.map(o=>({...o}))}),i={...t};return this.cleanupNode(i),delete i.el,delete i._id,delete i.content,delete i.grid,r.addNode(i),r.getRow()<=this.maxRow?(t._willFitPos=A.copyPos({},i),!0):!1}changedPosConstrain(t,r){return r.w=r.w||t.w,r.h=r.h||t.h,t.x!==r.x||t.y!==r.y?!0:(t.maxW&&(r.w=Math.min(r.w,t.maxW)),t.maxH&&(r.h=Math.min(r.h,t.maxH)),t.minW&&(r.w=Math.max(r.w,t.minW)),t.minH&&(r.h=Math.max(r.h,t.minH)),t.w!==r.w||t.h!==r.h)}moveNode(t,r){var m,w;if(!t||!r)return!1;let i;r.pack===void 0&&!this.batchMode&&(i=r.pack=!0),typeof r.x!="number"&&(r.x=t.x),typeof r.y!="number"&&(r.y=t.y),typeof r.w!="number"&&(r.w=t.w),typeof r.h!="number"&&(r.h=t.h);const o=t.w!==r.w||t.h!==r.h,u=A.copyPos({},t,!0);if(A.copyPos(u,r),this.nodeBoundFix(u,o),A.copyPos(r,u),!r.forceCollide&&A.samePos(t,r))return!1;const c=A.copyPos({},t),d=this.collideAll(t,u,r.skip);let p=!0;if(d.length){const v=t._moving&&!r.nested;let x=v?this.directionCollideCoverage(t,r,d):d[0];if(v&&x&&((w=(m=t.grid)==null?void 0:m.opts)!=null&&w.subGridDynamic)&&!t.grid._isTemp){const z=A.areaIntercept(r.rect,x._rect),R=A.area(r.rect),k=A.area(x._rect);z/(R.8&&(x.grid.makeSubGrid(x.el,void 0,t),x=void 0)}x?p=!this._fixCollisions(t,u,x,r):(p=!1,i&&delete r.pack)}return p&&!A.samePos(t,u)&&(t._dirty=!0,A.copyPos(t,u)),r.pack&&this._packNodes()._notify(),!A.samePos(t,c)}getRow(){return this.nodes.reduce((t,r)=>Math.max(t,r.y+r.h),0)}beginUpdate(t){return t._updating||(t._updating=!0,delete t._skipDown,this.batchMode||this.saveInitial()),this}endUpdate(){const t=this.nodes.find(r=>r._updating);return t&&(delete t._updating,delete t._skipDown),this}save(t=!0,r){var c;const i=(c=this._layouts)==null?void 0:c.length,o=i&&this.column!==i-1?this._layouts[i-1]:null,u=[];return this.sortNodes(),this.nodes.forEach(d=>{const p=o==null?void 0:o.find(w=>w._id===d._id),m={...d,...p||{}};A.removeInternalForSave(m,!t),r&&r(d,m),u.push(m)}),u}layoutsNodesChange(t){return!this._layouts||this._inColumnResize?this:(this._layouts.forEach((r,i)=>{if(!r||i===this.column)return this;if(i{if(!u._orig)return;const c=r.find(d=>d._id===u._id);c&&(c.y>=0&&u.y!==u._orig.y&&(c.y+=u.y-u._orig.y),u.x!==u._orig.x&&(c.x=Math.round(u.x*o)),u.w!==u._orig.w&&(c.w=Math.round(u.w*o)))})}}),this)}columnChanged(t,r,i="moveScale"){var d;if(!this.nodes.length||!r||t===r)return this;const o=i==="compact"||i==="list";o&&this.sortNodes(1),rt&&this._layouts){const p=this._layouts[r]||[],m=this._layouts.length-1;!p.length&&t!==m&&((d=this._layouts[m])!=null&&d.length)&&(t=m,this._layouts[m].forEach(w=>{const v=c.find(x=>x._id===w._id);v&&(!o&&!w.autoPosition&&(v.x=w.x??v.x,v.y=w.y??v.y),v.w=w.w??v.w,(w.x==null||w.y===void 0)&&(v.autoPosition=!0))})),p.forEach(w=>{const v=c.findIndex(x=>x._id===w._id);if(v!==-1){const x=c[v];if(o){x.w=w.w;return}(w.autoPosition||isNaN(w.x)||isNaN(w.y))&&this.findEmptyPosition(w,u),w.autoPosition||(x.x=w.x??x.x,x.y=w.y??x.y,x.w=w.w??x.w,u.push(x)),c.splice(v,1)}})}if(o)this.compact(i,!1);else{if(c.length)if(typeof i=="function")i(r,t,u,c);else{const p=o||i==="none"?1:r/t,m=i==="move"||i==="moveScale",w=i==="scale"||i==="moveScale";c.forEach(v=>{v.x=r===1?0:m?Math.round(v.x*p):Math.min(v.x,r-1),v.w=r===1||t===1?1:w?Math.round(v.w*p)||1:Math.min(v.w,r),u.push(v)}),c=[]}u=A.sort(u,-1),this._inColumnResize=!0,this.nodes=[],u.forEach(p=>{this.addNode(p,!1),delete p._orig})}return this.nodes.forEach(p=>delete p._orig),this.batchUpdate(!1,!o),delete this._inColumnResize,this}cacheLayout(t,r,i=!1){const o=[];return t.forEach((u,c)=>{if(u._id===void 0){const d=u.id?this.nodes.find(p=>p.id===u.id):void 0;u._id=(d==null?void 0:d._id)??ai._idSeq++}o[c]={x:u.x,y:u.y,w:u.w,_id:u._id}}),this._layouts=i?[]:this._layouts||[],this._layouts[r]=o,this}cacheOneLayout(t,r){t._id=t._id??ai._idSeq++;const i={x:t.x,y:t.y,w:t.w,_id:t._id};(t.autoPosition||t.x===void 0)&&(delete i.x,delete i.y,t.autoPosition&&(i.autoPosition=!0)),this._layouts=this._layouts||[],this._layouts[r]=this._layouts[r]||[];const o=this.findCacheLayout(t,r);return o===-1?this._layouts[r].push(i):this._layouts[r][o]=i,this}findCacheLayout(t,r){var i,o;return((o=(i=this._layouts)==null?void 0:i[r])==null?void 0:o.findIndex(u=>u._id===t._id))??-1}removeNodeFromLayoutCache(t){if(this._layouts)for(let r=0;r0||navigator.msMaxTouchPoints>0);class ui{}function hu(l,t){l.touches.length>1||(l.cancelable&&l.preventDefault(),A.simulateMouseEvent(l.changedTouches[0],t))}function Um(l,t){l.cancelable&&l.preventDefault(),A.simulateMouseEvent(l,t)}function pu(l){ui.touchHandled||(ui.touchHandled=!0,hu(l,"mousedown"))}function gu(l){ui.touchHandled&&hu(l,"mousemove")}function mu(l){if(!ui.touchHandled)return;ui.pointerLeaveTimeout&&(window.clearTimeout(ui.pointerLeaveTimeout),delete ui.pointerLeaveTimeout);const t=!!Le.dragElement;hu(l,"mouseup"),t||hu(l,"click"),ui.touchHandled=!1}function vu(l){l.pointerType!=="mouse"&&l.target.releasePointerCapture(l.pointerId)}function _g(l){Le.dragElement&&l.pointerType!=="mouse"&&Um(l,"mouseenter")}function Eg(l){Le.dragElement&&l.pointerType!=="mouse"&&(ui.pointerLeaveTimeout=window.setTimeout(()=>{delete ui.pointerLeaveTimeout,Um(l,"mouseleave")},10))}class Mu{constructor(t,r,i){this.host=t,this.dir=r,this.option=i,this.moving=!1,this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this._init()}_init(){const t=this.el=document.createElement("div");return t.classList.add("ui-resizable-handle"),t.classList.add(`${Mu.prefix}${this.dir}`),t.style.zIndex="100",t.style.userSelect="none",this.host.appendChild(this.el),this.el.addEventListener("mousedown",this._mouseDown),Kr&&(this.el.addEventListener("touchstart",pu),this.el.addEventListener("pointerdown",vu)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),Kr&&(this.el.removeEventListener("touchstart",pu),this.el.removeEventListener("pointerdown",vu)),this.host.removeChild(this.el),delete this.el,delete this.host,this}_mouseDown(t){this.mouseDownEvent=t,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),Kr&&(this.el.addEventListener("touchmove",gu),this.el.addEventListener("touchend",mu)),t.stopPropagation(),t.preventDefault()}_mouseMove(t){const r=this.mouseDownEvent;this.moving?this._triggerEvent("move",t):Math.abs(t.x-r.x)+Math.abs(t.y-r.y)>2&&(this.moving=!0,this._triggerEvent("start",this.mouseDownEvent),this._triggerEvent("move",t),document.addEventListener("keydown",this._keyEvent)),t.stopPropagation()}_mouseUp(t){this.moving&&(this._triggerEvent("stop",t),document.removeEventListener("keydown",this._keyEvent)),document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),Kr&&(this.el.removeEventListener("touchmove",gu),this.el.removeEventListener("touchend",mu)),delete this.moving,delete this.mouseDownEvent,t.stopPropagation(),t.preventDefault()}_keyEvent(t){var r,i;t.key==="Escape"&&((i=(r=this.host.gridstackNode)==null?void 0:r.grid)==null||i.engine.restoreInitial(),this._mouseUp(this.mouseDownEvent))}_triggerEvent(t,r){return this.option[t]&&this.option[t](r),this}}Mu.prefix="ui-resizable-";class od{constructor(){this._eventRegister={}}get disabled(){return this._disabled}on(t,r){this._eventRegister[t]=r}off(t){delete this._eventRegister[t]}enable(){this._disabled=!1}disable(){this._disabled=!0}destroy(){delete this._eventRegister}triggerEvent(t,r){if(!this.disabled&&this._eventRegister&&this._eventRegister[t])return this._eventRegister[t](r)}}class zo extends od{constructor(t,r={}){super(),this.el=t,this.option=r,this.rectScale={x:1,y:1},this._ui=()=>{const o=this.el.parentElement.getBoundingClientRect(),u={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},c=this.temporalRect||u;return{position:{left:(c.left-o.left)*this.rectScale.x,top:(c.top-o.top)*this.rectScale.y},size:{width:c.width*this.rectScale.x,height:c.height*this.rectScale.y}}},this._mouseOver=this._mouseOver.bind(this),this._mouseOut=this._mouseOut.bind(this),this.enable(),this._setupAutoHide(this.option.autoHide),this._setupHandlers()}on(t,r){super.on(t,r)}off(t){super.off(t)}enable(){super.enable(),this.el.classList.remove("ui-resizable-disabled"),this._setupAutoHide(this.option.autoHide)}disable(){super.disable(),this.el.classList.add("ui-resizable-disabled"),this._setupAutoHide(!1)}destroy(){this._removeHandlers(),this._setupAutoHide(!1),delete this.el,super.destroy()}updateOption(t){const r=t.handles&&t.handles!==this.option.handles,i=t.autoHide&&t.autoHide!==this.option.autoHide;return Object.keys(t).forEach(o=>this.option[o]=t[o]),r&&(this._removeHandlers(),this._setupHandlers()),i&&this._setupAutoHide(this.option.autoHide),this}_setupAutoHide(t){return t?(this.el.classList.add("ui-resizable-autohide"),this.el.addEventListener("mouseover",this._mouseOver),this.el.addEventListener("mouseout",this._mouseOut)):(this.el.classList.remove("ui-resizable-autohide"),this.el.removeEventListener("mouseover",this._mouseOver),this.el.removeEventListener("mouseout",this._mouseOut),Le.overResizeElement===this&&delete Le.overResizeElement),this}_mouseOver(t){Le.overResizeElement||Le.dragElement||(Le.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(t){Le.overResizeElement===this&&(delete Le.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(t=>t.trim()).map(t=>new Mu(this.el,t,{start:r=>{this._resizeStart(r)},stop:r=>{this._resizeStop(r)},move:r=>{this._resizing(r,t)}})),this}_resizeStart(t){this.sizeToContent=A.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=A.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=t,this._setupHelper(),this._applyChange();const r=A.initEvent(t,{type:"resizestart",target:this.el});return this.option.start&&this.option.start(r,this._ui()),this.el.classList.add("ui-resizable-resizing"),this.triggerEvent("resizestart",r),this}_resizing(t,r){this.scrolled=this.scrollEl.scrollTop-this.scrollY,this.temporalRect=this._getChange(t,r),this._applyChange();const i=A.initEvent(t,{type:"resize",target:this.el});return this.option.resize&&this.option.resize(i,this._ui()),this.triggerEvent("resize",i),this}_resizeStop(t){const r=A.initEvent(t,{type:"resizestop",target:this.el});return this.option.stop&&this.option.stop(r),this.el.classList.remove("ui-resizable-resizing"),this.triggerEvent("resizestop",r),this._cleanHelper(),delete this.startEvent,delete this.originalRect,delete this.temporalRect,delete this.scrollY,delete this.scrolled,this}_setupHelper(){this.elOriginStyleVal=zo._originStyleProp.map(i=>this.el.style[i]),this.parentOriginStylePosition=this.el.parentElement.style.position;const t=this.el.parentElement,r=A.getValuesFromTransformedElement(t);return this.rectScale={x:r.xScale,y:r.yScale},getComputedStyle(this.el.parentElement).position.match(/static/)&&(this.el.parentElement.style.position="relative"),this.el.style.position="absolute",this.el.style.opacity="0.8",this}_cleanHelper(){return zo._originStyleProp.forEach((t,r)=>{this.el.style[t]=this.elOriginStyleVal[r]||null}),this.el.parentElement.style.position=this.parentOriginStylePosition||null,this}_getChange(t,r){const i=this.startEvent,o={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},u=t.clientX-i.clientX,c=this.sizeToContent?0:t.clientY-i.clientY;let d,p;r.indexOf("e")>-1?o.width+=u:r.indexOf("w")>-1&&(o.width-=u,o.left+=u,d=!0),r.indexOf("s")>-1?o.height+=c:r.indexOf("n")>-1&&(o.height-=c,o.top+=c,p=!0);const m=this._constrainSize(o.width,o.height,d,p);return Math.round(o.width)!==Math.round(m.width)&&(r.indexOf("w")>-1&&(o.left+=o.width-m.width),o.width=m.width),Math.round(o.height)!==Math.round(m.height)&&(r.indexOf("n")>-1&&(o.top+=o.height-m.height),o.height=m.height),o}_constrainSize(t,r,i,o){const u=this.option,c=(i?u.maxWidthMoveLeft:u.maxWidth)||Number.MAX_SAFE_INTEGER,d=u.minWidth/this.rectScale.x||t,p=(o?u.maxHeightMoveUp:u.maxHeight)||Number.MAX_SAFE_INTEGER,m=u.minHeight/this.rectScale.y||r,w=Math.min(c,Math.max(d,t)),v=Math.min(p,Math.max(m,r));return{width:w,height:v}}_applyChange(){let t={left:0,top:0,width:0,height:0};if(this.el.style.position==="absolute"){const r=this.el.parentElement,{left:i,top:o}=r.getBoundingClientRect();t={left:i,top:o,width:0,height:0}}return this.temporalRect?(Object.keys(this.temporalRect).forEach(r=>{const i=this.temporalRect[r],o=r==="width"||r==="left"?this.rectScale.x:r==="height"||r==="top"?this.rectScale.y:1;this.el.style[r]=(i-t[r])*o+"px"}),this):this}_removeHandlers(){return this.handlers.forEach(t=>t.destroy()),delete this.handlers,this}}zo._originStyleProp=["width","height","position","left","top","opacity","zIndex"];const kS='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class Mo extends od{constructor(t,r={}){var u;super(),this.el=t,this.option=r,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0};const i=(u=r==null?void 0:r.handle)==null?void 0:u.substring(1),o=t.gridstackNode;this.dragEls=!i||t.classList.contains(i)?[t]:o!=null&&o.subGrid?[t.querySelector(r.handle)||t]:Array.from(t.querySelectorAll(r.handle)),this.dragEls.length===0&&(this.dragEls=[t]),this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this.enable()}on(t,r){super.on(t,r)}off(t){super.off(t)}enable(){this.disabled!==!1&&(super.enable(),this.dragEls.forEach(t=>{t.addEventListener("mousedown",this._mouseDown),Kr&&(t.addEventListener("touchstart",pu),t.addEventListener("pointerdown",vu))}),this.el.classList.remove("ui-draggable-disabled"))}disable(t=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(r=>{r.removeEventListener("mousedown",this._mouseDown),Kr&&(r.removeEventListener("touchstart",pu),r.removeEventListener("pointerdown",vu))}),t||this.el.classList.add("ui-draggable-disabled"))}destroy(){this.dragTimeout&&window.clearTimeout(this.dragTimeout),delete this.dragTimeout,this.mouseDownEvent&&this._mouseUp(this.mouseDownEvent),this.disable(!0),delete this.el,delete this.helper,delete this.option,super.destroy()}updateOption(t){return Object.keys(t).forEach(r=>this.option[r]=t[r]),this}_mouseDown(t){if(!Le.mouseHandled)return t.button!==0||!this.dragEls.find(r=>r===t.target)&&t.target.closest(kS)||this.option.cancel&&t.target.closest(this.option.cancel)||(this.mouseDownEvent=t,delete this.dragging,delete Le.dragElement,delete Le.dropElement,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),Kr&&(t.currentTarget.addEventListener("touchmove",gu),t.currentTarget.addEventListener("touchend",mu)),t.preventDefault(),document.activeElement&&document.activeElement.blur(),Le.mouseHandled=!0),!0}_callDrag(t){if(!this.dragging)return;const r=A.initEvent(t,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(r,this.ui()),this.triggerEvent("drag",r)}_mouseMove(t){var i;const r=this.mouseDownEvent;if(this.lastDrag=t,this.dragging)if(this._dragFollow(t),Le.pauseDrag){const o=Number.isInteger(Le.pauseDrag)?Le.pauseDrag:100;this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>this._callDrag(t),o)}else this._callDrag(t);else if(Math.abs(t.x-r.x)+Math.abs(t.y-r.y)>3){this.dragging=!0,Le.dragElement=this;const o=(i=this.el.gridstackNode)==null?void 0:i.grid;o?Le.dropElement=o.el.ddElement.ddDroppable:delete Le.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=A.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(t,this.el,this.helperContainment),this._setupHelperStyle(t);const u=A.initEvent(t,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(u,this.ui()),this.triggerEvent("dragstart",u),document.addEventListener("keydown",this._keyEvent)}return!0}_mouseUp(t){var r,i;if(document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),Kr&&t.currentTarget&&(t.currentTarget.removeEventListener("touchmove",gu,!0),t.currentTarget.removeEventListener("touchend",mu,!0)),this.dragging){delete this.dragging,(r=this.el.gridstackNode)==null||delete r._origRotate,document.removeEventListener("keydown",this._keyEvent),((i=Le.dropElement)==null?void 0:i.el)===this.el.parentElement&&delete Le.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();const o=A.initEvent(t,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(o),this.triggerEvent("dragstop",o),Le.dropElement&&Le.dropElement.drop(t)}delete this.helper,delete this.mouseDownEvent,delete Le.dragElement,delete Le.dropElement,delete Le.mouseHandled,t.preventDefault()}_keyEvent(t){var o,u;const r=this.el.gridstackNode,i=(r==null?void 0:r.grid)||((u=(o=Le.dropElement)==null?void 0:o.el)==null?void 0:u.gridstack);if(t.key==="Escape")r&&r._origRotate&&(r._orig=r._origRotate,delete r._origRotate),i==null||i.cancelDrag(),this._mouseUp(this.mouseDownEvent);else if(r&&i&&(t.key==="r"||t.key==="R")){if(!A.canBeRotated(r))return;r._origRotate=r._origRotate||{...r._orig},delete r._moving,i.setAnimation(!1).rotate(r.el,{top:-this.dragOffset.offsetTop,left:-this.dragOffset.offsetLeft}).setAnimation(),r._moving=!0,this.dragOffset=this._getDragOffset(this.lastDrag,r.el,this.helperContainment),this.helper.style.width=this.dragOffset.width+"px",this.helper.style.height=this.dragOffset.height+"px",A.swap(r._orig,"w","h"),delete r._rect,this._mouseMove(this.lastDrag)}}_createHelper(){let t=this.el;return typeof this.option.helper=="function"?t=this.option.helper(this.el):this.option.helper==="clone"&&(t=A.cloneNode(this.el)),t.parentElement||A.appendTo(t,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=Mo.originStyleProp.map(r=>this.el.style[r]),t}_setupHelperStyle(t){this.helper.classList.add("ui-draggable-dragging");const r=this.helper.style;return r.pointerEvents="none",r.width=this.dragOffset.width+"px",r.height=this.dragOffset.height+"px",r.willChange="left, top",r.position="fixed",this._dragFollow(t),r.transition="none",setTimeout(()=>{this.helper&&(r.transition=null)},0),this}_removeHelperStyle(){var r;this.helper.classList.remove("ui-draggable-dragging");const t=(r=this.helper)==null?void 0:r.gridstackNode;if(!(t!=null&&t._isAboutToRemove)&&this.dragElementOriginStyle){const i=this.helper,o=this.dragElementOriginStyle.transition||null;i.style.transition=this.dragElementOriginStyle.transition="none",Mo.originStyleProp.forEach(u=>i.style[u]=this.dragElementOriginStyle[u]||null),setTimeout(()=>i.style.transition=o,50)}return delete this.dragElementOriginStyle,this}_dragFollow(t){const r={left:0,top:0},i=this.helper.style,o=this.dragOffset;i.left=(t.clientX+o.offsetLeft-r.left)*this.dragTransform.xScale+"px",i.top=(t.clientY+o.offsetTop-r.top)*this.dragTransform.yScale+"px"}_setupHelperContainmentStyle(){return this.helperContainment=this.helper.parentElement,this.helper.style.position!=="fixed"&&(this.parentOriginStylePosition=this.helperContainment.style.position,getComputedStyle(this.helperContainment).position.match(/static/)&&(this.helperContainment.style.position="relative")),this}_getDragOffset(t,r,i){let o=0,u=0;i&&(o=this.dragTransform.xOffset,u=this.dragTransform.yOffset);const c=r.getBoundingClientRect();return{left:c.left,top:c.top,offsetLeft:-t.clientX+c.left-o,offsetTop:-t.clientY+c.top-u,width:c.width*this.dragTransform.xScale,height:c.height*this.dragTransform.yScale}}ui(){const r=this.el.parentElement.getBoundingClientRect(),i=this.helper.getBoundingClientRect();return{position:{top:(i.top-r.top)*this.dragTransform.yScale,left:(i.left-r.left)*this.dragTransform.xScale}}}}Mo.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","top","minWidth","willChange"];class RS extends od{constructor(t,r={}){super(),this.el=t,this.option=r,this._mouseEnter=this._mouseEnter.bind(this),this._mouseLeave=this._mouseLeave.bind(this),this.enable(),this._setupAccept()}on(t,r){super.on(t,r)}off(t){super.off(t)}enable(){this.disabled!==!1&&(super.enable(),this.el.classList.add("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),this.el.addEventListener("mouseenter",this._mouseEnter),this.el.addEventListener("mouseleave",this._mouseLeave),Kr&&(this.el.addEventListener("pointerenter",_g),this.el.addEventListener("pointerleave",Eg)))}disable(t=!1){this.disabled!==!0&&(super.disable(),this.el.classList.remove("ui-droppable"),t||this.el.classList.add("ui-droppable-disabled"),this.el.removeEventListener("mouseenter",this._mouseEnter),this.el.removeEventListener("mouseleave",this._mouseLeave),Kr&&(this.el.removeEventListener("pointerenter",_g),this.el.removeEventListener("pointerleave",Eg)))}destroy(){this.disable(!0),this.el.classList.remove("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),super.destroy()}updateOption(t){return Object.keys(t).forEach(r=>this.option[r]=t[r]),this._setupAccept(),this}_mouseEnter(t){if(!Le.dragElement||!this._canDrop(Le.dragElement.el))return;t.preventDefault(),t.stopPropagation(),Le.dropElement&&Le.dropElement!==this&&Le.dropElement._mouseLeave(t,!0),Le.dropElement=this;const r=A.initEvent(t,{target:this.el,type:"dropover"});this.option.over&&this.option.over(r,this._ui(Le.dragElement)),this.triggerEvent("dropover",r),this.el.classList.add("ui-droppable-over")}_mouseLeave(t,r=!1){var o;if(!Le.dragElement||Le.dropElement!==this)return;t.preventDefault(),t.stopPropagation();const i=A.initEvent(t,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(i,this._ui(Le.dragElement)),this.triggerEvent("dropout",i),Le.dropElement===this&&(delete Le.dropElement,!r)){let u,c=this.el.parentElement;for(;!u&&c;)u=(o=c.ddElement)==null?void 0:o.ddDroppable,c=c.parentElement;u&&u._mouseEnter(t)}}drop(t){t.preventDefault();const r=A.initEvent(t,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(r,this._ui(Le.dragElement)),this.triggerEvent("drop",r)}_canDrop(t){return t&&(!this.accept||this.accept(t))}_setupAccept(){return this.option.accept?(typeof this.option.accept=="string"?this.accept=t=>t.classList.contains(this.option.accept)||t.matches(this.option.accept):this.accept=this.option.accept,this):this}_ui(t){return{draggable:t.el,...t.ui()}}}class ad{static init(t){return t.ddElement||(t.ddElement=new ad(t)),t.ddElement}constructor(t){this.el=t}on(t,r){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(t)>-1?this.ddDraggable.on(t,r):this.ddDroppable&&["drop","dropover","dropout"].indexOf(t)>-1?this.ddDroppable.on(t,r):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(t)>-1&&this.ddResizable.on(t,r),this}off(t){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(t)>-1?this.ddDraggable.off(t):this.ddDroppable&&["drop","dropover","dropout"].indexOf(t)>-1?this.ddDroppable.off(t):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(t)>-1&&this.ddResizable.off(t),this}setupDraggable(t){return this.ddDraggable?this.ddDraggable.updateOption(t):this.ddDraggable=new Mo(this.el,t),this}cleanDraggable(){return this.ddDraggable&&(this.ddDraggable.destroy(),delete this.ddDraggable),this}setupResizable(t){return this.ddResizable?this.ddResizable.updateOption(t):this.ddResizable=new zo(this.el,t),this}cleanResizable(){return this.ddResizable&&(this.ddResizable.destroy(),delete this.ddResizable),this}setupDroppable(t){return this.ddDroppable?this.ddDroppable.updateOption(t):this.ddDroppable=new RS(this.el,t),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class NS{resizable(t,r,i,o){return this._getDDElements(t,r).forEach(u=>{if(r==="disable"||r==="enable")u.ddResizable&&u.ddResizable[r]();else if(r==="destroy")u.ddResizable&&u.cleanResizable();else if(r==="option")u.setupResizable({[i]:o});else{const d=u.el.gridstackNode.grid;let p=u.el.getAttribute("gs-resize-handles")||d.opts.resizable.handles||"e,s,se";p==="all"&&(p="n,e,s,w,se,sw,ne,nw");const m=!d.opts.alwaysShowResizeHandle;u.setupResizable({...d.opts.resizable,handles:p,autoHide:m,start:r.start,stop:r.stop,resize:r.resize})}}),this}draggable(t,r,i,o){return this._getDDElements(t,r).forEach(u=>{if(r==="disable"||r==="enable")u.ddDraggable&&u.ddDraggable[r]();else if(r==="destroy")u.ddDraggable&&u.cleanDraggable();else if(r==="option")u.setupDraggable({[i]:o});else{const c=u.el.gridstackNode.grid;u.setupDraggable({...c.opts.draggable,start:r.start,stop:r.stop,drag:r.drag})}}),this}dragIn(t,r){return this._getDDElements(t).forEach(i=>i.setupDraggable(r)),this}droppable(t,r,i,o){return typeof r.accept=="function"&&!r._accept&&(r._accept=r.accept,r.accept=u=>r._accept(u)),this._getDDElements(t,r).forEach(u=>{r==="disable"||r==="enable"?u.ddDroppable&&u.ddDroppable[r]():r==="destroy"?u.ddDroppable&&u.cleanDroppable():r==="option"?u.setupDroppable({[i]:o}):u.setupDroppable(r)}),this}isDroppable(t){var r;return!!((r=t==null?void 0:t.ddElement)!=null&&r.ddDroppable&&!t.ddElement.ddDroppable.disabled)}isDraggable(t){var r;return!!((r=t==null?void 0:t.ddElement)!=null&&r.ddDraggable&&!t.ddElement.ddDraggable.disabled)}isResizable(t){var r;return!!((r=t==null?void 0:t.ddElement)!=null&&r.ddResizable&&!t.ddElement.ddResizable.disabled)}on(t,r,i){return this._getDDElements(t).forEach(o=>o.on(r,u=>{i(u,Le.dragElement?Le.dragElement.el:u.target,Le.dragElement?Le.dragElement.helper:null)})),this}off(t,r){return this._getDDElements(t).forEach(i=>i.off(r)),this}_getDDElements(t,r){const i=t.gridstack||r!=="destroy"&&r!=="disable",o=A.getElements(t);return o.length?o.map(c=>c.ddElement||(i?ad.init(c):null)).filter(c=>c):[]}}/*! - * GridStack 11.5.1 - * https://gridstackjs.com/ - * - * Copyright (c) 2021-2024 Alain Dumesny - * see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE - */const $n=new NS;class Ne{static init(t={},r=".grid-stack"){if(typeof document>"u")return null;const i=Ne.getGridElement(r);return i?(i.gridstack||(i.gridstack=new Ne(i,A.cloneDeep(t))),i.gridstack):(console.error(typeof r=="string"?'GridStack.initAll() no grid was found with selector "'+r+`" - element missing or wrong selector ? -Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`:"GridStack.init() no grid element was passed."),null)}static initAll(t={},r=".grid-stack"){const i=[];return typeof document>"u"||(Ne.getGridElements(r).forEach(o=>{o.gridstack||(o.gridstack=new Ne(o,A.cloneDeep(t))),i.push(o.gridstack)}),i.length===0&&console.error('GridStack.initAll() no grid was found with selector "'+r+`" - element missing or wrong selector ? -Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`)),i}static addGrid(t,r={}){if(!t)return null;let i=t;if(i.gridstack){const c=i.gridstack;return r&&(c.opts={...c.opts,...r}),r.children!==void 0&&c.load(r.children),c}return(!t.classList.contains("grid-stack")||Ne.addRemoveCB)&&(Ne.addRemoveCB?i=Ne.addRemoveCB(t,r,!0,!0):i=A.createDiv(["grid-stack",r.class],t)),Ne.init(r,i)}static registerEngine(t){Ne.engineClass=t}get placeholder(){if(!this._placeholder){this._placeholder=A.createDiv([this.opts.placeholderClass,yr.itemClass,this.opts.itemClass]);const t=A.createDiv(["placeholder-content"],this._placeholder);this.opts.placeholderText&&(t.textContent=this.opts.placeholderText)}return this._placeholder}constructor(t,r={}){var v,x,z;this.el=t,this.opts=r,this.animationDelay=310,this._gsEventHandler={},this._extraDragRow=0,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0},t.gridstack=this,this.opts=r=r||{},t.classList.contains("grid-stack")||this.el.classList.add("grid-stack"),r.row&&(r.minRow=r.maxRow=r.row,delete r.row);const i=A.toNumber(t.getAttribute("gs-row"));r.column==="auto"&&delete r.column,r.alwaysShowResizeHandle!==void 0&&(r._alwaysShowResizeHandle=r.alwaysShowResizeHandle);let o=(v=r.columnOpts)==null?void 0:v.breakpoints;const u=r;if(u.oneColumnModeDomSort&&(delete u.oneColumnModeDomSort,console.log("warning: Gridstack oneColumnModeDomSort no longer supported. Use GridStackOptions.columnOpts instead.")),u.oneColumnSize||u.disableOneColumnMode===!1){const R=u.oneColumnSize||768;delete u.oneColumnSize,delete u.disableOneColumnMode,r.columnOpts=r.columnOpts||{},o=r.columnOpts.breakpoints=r.columnOpts.breakpoints||[];let k=o.find(b=>b.c===1);k?k.w=R:(k={c:1,w:R},o.push(k,{c:12,w:R+1}))}const c=r.columnOpts;c&&(!c.columnWidth&&!((x=c.breakpoints)!=null&&x.length)?(delete r.columnOpts,o=void 0):c.columnMax=c.columnMax||12),(o==null?void 0:o.length)>1&&o.sort((R,k)=>(k.w||0)-(R.w||0));const d={...A.cloneDeep(yr),column:A.toNumber(t.getAttribute("gs-column"))||yr.column,minRow:i||A.toNumber(t.getAttribute("gs-min-row"))||yr.minRow,maxRow:i||A.toNumber(t.getAttribute("gs-max-row"))||yr.maxRow,staticGrid:A.toBool(t.getAttribute("gs-static"))||yr.staticGrid,sizeToContent:A.toBool(t.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(r.handleClass?"."+r.handleClass:r.handle?r.handle:"")||yr.draggable.handle},removableOptions:{accept:r.itemClass||yr.removableOptions.accept,decline:yr.removableOptions.decline}};t.getAttribute("gs-animate")&&(d.animate=A.toBool(t.getAttribute("gs-animate"))),r=A.defaults(r,d),this._initMargin(),this.checkDynamicColumn(),this.el.classList.add("gs-"+r.column),r.rtl==="auto"&&(r.rtl=t.style.direction==="rtl"),r.rtl&&this.el.classList.add("grid-stack-rtl");const p=this.el.closest("."+yr.itemClass),m=p==null?void 0:p.gridstackNode;m&&(m.subGrid=this,this.parentGridNode=m,this.el.classList.add("grid-stack-nested"),m.el.classList.add("grid-stack-sub-grid")),this._isAutoCellHeight=r.cellHeight==="auto",this._isAutoCellHeight||r.cellHeight==="initial"?this.cellHeight(void 0,!1):(typeof r.cellHeight=="number"&&r.cellHeightUnit&&r.cellHeightUnit!==yr.cellHeightUnit&&(r.cellHeight=r.cellHeight+r.cellHeightUnit,delete r.cellHeightUnit),this.cellHeight(r.cellHeight,!1)),r.alwaysShowResizeHandle==="mobile"&&(r.alwaysShowResizeHandle=Kr),this._styleSheetClass="gs-id-"+ai._idSeq++,this.el.classList.add(this._styleSheetClass),this._setStaticClass();const w=r.engineClass||Ne.engineClass||ai;if(this.engine=new w({column:this.getColumn(),float:r.float,maxRow:r.maxRow,onChange:R=>{let k=0;this.engine.nodes.forEach(b=>{k=Math.max(k,b.y+b.h)}),R.forEach(b=>{const W=b.el;W&&(b._removeDOM?(W&&W.remove(),delete b._removeDOM):this._writePosAttr(W,b))}),this._updateStyles(!1,k)}}),this._updateStyles(!1,0),r.auto&&(this.batchUpdate(),this.engine._loading=!0,this.getGridItems().forEach(R=>this._prepareElement(R)),delete this.engine._loading,this.batchUpdate(!1)),r.children){const R=r.children;delete r.children,R.length&&this.load(R)}this.setAnimation(),r.subGridDynamic&&!Le.pauseDrag&&(Le.pauseDrag=!0),((z=r.draggable)==null?void 0:z.pause)!==void 0&&(Le.pauseDrag=r.draggable.pause),this._setupRemoveDrop(),this._setupAcceptWidget(),this._updateResizeEvent()}addWidget(t){if(typeof t=="string"){console.error("V11: GridStack.addWidget() does not support string anymore. see #2736");return}if(t.ELEMENT_NODE)return console.error("V11: GridStack.addWidget() does not support HTMLElement anymore. use makeWidget()"),this.makeWidget(t);let r,i=t;if(i.grid=this,i!=null&&i.el?r=i.el:Ne.addRemoveCB?r=Ne.addRemoveCB(this.el,t,!0,!1):r=this.createWidgetDivs(i),!r)return;if(i=r.gridstackNode,i&&r.parentElement===this.el&&this.engine.nodes.find(u=>u._id===i._id))return r;const o=this._readAttr(r);return A.defaults(t,o),this.engine.prepareNode(t),this.el.appendChild(r),this.makeWidget(r,t),r}createWidgetDivs(t){const r=A.createDiv(["grid-stack-item",this.opts.itemClass]),i=A.createDiv(["grid-stack-item-content"],r);return A.lazyLoad(t)?t.visibleObservable||(t.visibleObservable=new IntersectionObserver(([o])=>{var u,c;o.isIntersecting&&((u=t.visibleObservable)==null||u.disconnect(),delete t.visibleObservable,Ne.renderCB(i,t),(c=t.grid)==null||c.prepareDragDrop(t.el))}),window.setTimeout(()=>{var o;return(o=t.visibleObservable)==null?void 0:o.observe(r)})):Ne.renderCB(i,t),r}makeSubGrid(t,r,i,o=!0){var z,R,k;let u=t.gridstackNode;if(u||(u=this.makeWidget(t).gridstackNode),(z=u.subGrid)!=null&&z.el)return u.subGrid;let c,d=this;for(;d&&!c;)c=(R=d.opts)==null?void 0:R.subGridOpts,d=(k=d.parentGridNode)==null?void 0:k.grid;r=A.cloneDeep({...this.opts,id:void 0,children:void 0,column:"auto",columnOpts:void 0,layout:"list",subGridOpts:void 0,...c||{},...r||u.subGridOpts||{}}),u.subGridOpts=r;let p;r.column==="auto"&&(p=!0,r.column=Math.max(u.w||1,(i==null?void 0:i.w)||1),delete r.columnOpts);let m=u.el.querySelector(".grid-stack-item-content"),w,v;if(o&&(this._removeDD(u.el),v={...u,x:0,y:0},A.removeInternalForSave(v),delete v.subGridOpts,u.content&&(v.content=u.content,delete u.content),Ne.addRemoveCB?w=Ne.addRemoveCB(this.el,v,!0,!1):(w=A.createDiv(["grid-stack-item"]),w.appendChild(m),m=A.createDiv(["grid-stack-item-content"],u.el)),this.prepareDragDrop(u.el)),i){const b=p?r.column:u.w,W=u.h+i.h,P=u.el.style;P.transition="none",this.update(u.el,{w:b,h:W}),setTimeout(()=>P.transition=null)}const x=u.subGrid=Ne.addGrid(m,r);return i!=null&&i._moving&&(x._isTemp=!0),p&&(x._autoColumn=!0),o&&x.makeWidget(w,v),i&&(i._moving?window.setTimeout(()=>A.simulateMouseEvent(i._event,"mouseenter",x.el),0):x.makeWidget(u.el,u)),this.resizeToContentCheck(!1,u),x}removeAsSubGrid(t){var i;const r=(i=this.parentGridNode)==null?void 0:i.grid;r&&(r.batchUpdate(),r.removeWidget(this.parentGridNode.el,!0,!0),this.engine.nodes.forEach(o=>{o.x+=this.parentGridNode.x,o.y+=this.parentGridNode.y,r.makeWidget(o.el,o)}),r.batchUpdate(!1),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,t&&window.setTimeout(()=>A.simulateMouseEvent(t._event,"mouseenter",r.el),0))}save(t=!0,r=!1,i=Ne.saveCB){const o=this.engine.save(t,i);if(o.forEach(u=>{var c;if(t&&u.el&&!u.subGrid&&!i){const d=u.el.querySelector(".grid-stack-item-content");u.content=d==null?void 0:d.innerHTML,u.content||delete u.content}else if(!t&&!i&&delete u.content,(c=u.subGrid)!=null&&c.el){const d=u.subGrid.save(t,r,i);u.subGridOpts=r?d:{children:d},delete u.subGrid}delete u.el}),r){const u=A.cloneDeep(this.opts);u.marginBottom===u.marginTop&&u.marginRight===u.marginLeft&&u.marginTop===u.marginRight&&(u.margin=u.marginTop,delete u.marginTop,delete u.marginRight,delete u.marginBottom,delete u.marginLeft),u.rtl===(this.el.style.direction==="rtl")&&(u.rtl="auto"),this._isAutoCellHeight&&(u.cellHeight="auto"),this._autoColumn&&(u.column="auto");const c=u._alwaysShowResizeHandle;return delete u._alwaysShowResizeHandle,c!==void 0?u.alwaysShowResizeHandle=c:delete u.alwaysShowResizeHandle,A.removeInternalAndSame(u,yr),u.children=o,u}return o}load(t,r=Ne.addRemoveCB||!0){var m;t=A.cloneDeep(t);const i=this.getColumn();t.forEach(w=>{w.w=w.w||1,w.h=w.h||1}),t=A.sort(t),this.engine.skipCacheUpdate=this._ignoreLayoutsNodeChange=!0;let o=0;t.forEach(w=>{o=Math.max(o,(w.x||0)+w.w)}),o>this.engine.defaultColumn&&(this.engine.defaultColumn=o),o>i&&this.engine.cacheLayout(t,o,!0);const u=Ne.addRemoveCB;typeof r=="function"&&(Ne.addRemoveCB=r);const c=[];this.batchUpdate();const d=!this.engine.nodes.length;d&&this.setAnimation(!1),!d&&r&&[...this.engine.nodes].forEach(v=>{if(!v.id)return;A.find(t,v.id)||(Ne.addRemoveCB&&Ne.addRemoveCB(this.el,v,!1,!1),c.push(v),this.removeWidget(v.el,!0,!1))}),this.engine._loading=!0;const p=[];return this.engine.nodes=this.engine.nodes.filter(w=>A.find(t,w.id)?(p.push(w),!1):!0),t.forEach(w=>{var x;const v=A.find(p,w.id);if(v){if(A.shouldSizeToContent(v)&&(w.h=v.h),this.engine.nodeBoundFix(w),(w.autoPosition||w.x===void 0||w.y===void 0)&&(w.w=w.w||v.w,w.h=w.h||v.h,this.engine.findEmptyPosition(w)),this.engine.nodes.push(v),A.samePos(v,w)&&this.engine.nodes.length>1&&(this.moveNode(v,{...w,forceCollide:!0}),A.copyPos(w,v)),this.update(v.el,w),(x=w.subGridOpts)!=null&&x.children){const z=v.el.querySelector(".grid-stack");z&&z.gridstack&&z.gridstack.load(w.subGridOpts.children)}}else r&&this.addWidget(w)}),delete this.engine._loading,this.engine.removedNodes=c,this.batchUpdate(!1),delete this._ignoreLayoutsNodeChange,delete this.engine.skipCacheUpdate,u?Ne.addRemoveCB=u:delete Ne.addRemoveCB,d&&((m=this.opts)!=null&&m.animate)&&this.setAnimation(this.opts.animate,!0),this}batchUpdate(t=!0){return this.engine.batchUpdate(t),t||(this._updateContainerHeight(),this._triggerRemoveEvent(),this._triggerAddEvent(),this._triggerChangeEvent()),this}getCellHeight(t=!1){if(this.opts.cellHeight&&this.opts.cellHeight!=="auto"&&(!t||!this.opts.cellHeightUnit||this.opts.cellHeightUnit==="px"))return this.opts.cellHeight;if(this.opts.cellHeightUnit==="rem")return this.opts.cellHeight*parseFloat(getComputedStyle(document.documentElement).fontSize);if(this.opts.cellHeightUnit==="em")return this.opts.cellHeight*parseFloat(getComputedStyle(this.el).fontSize);if(this.opts.cellHeightUnit==="cm")return this.opts.cellHeight*(96/2.54);if(this.opts.cellHeightUnit==="mm")return this.opts.cellHeight*(96/2.54)/10;const r=this.el.querySelector("."+this.opts.itemClass);if(r){const o=A.toNumber(r.getAttribute("gs-h"))||1;return Math.round(r.offsetHeight/o)}const i=parseInt(this.el.getAttribute("gs-current-row"));return i?Math.round(this.el.getBoundingClientRect().height/i):this.opts.cellHeight}cellHeight(t,r=!0){if(r&&t!==void 0&&this._isAutoCellHeight!==(t==="auto")&&(this._isAutoCellHeight=t==="auto",this._updateResizeEvent()),(t==="initial"||t==="auto")&&(t=void 0),t===void 0){const o=-this.opts.marginRight-this.opts.marginLeft+this.opts.marginTop+this.opts.marginBottom;t=this.cellWidth()+o}const i=A.parseHeight(t);return this.opts.cellHeightUnit===i.unit&&this.opts.cellHeight===i.h?this:(this.opts.cellHeightUnit=i.unit,this.opts.cellHeight=i.h,this.resizeToContentCheck(),r&&this._updateStyles(!0),this)}cellWidth(){return this._widthOrContainer()/this.getColumn()}_widthOrContainer(t=!1){var r;return t&&((r=this.opts.columnOpts)!=null&&r.breakpointForWindow)?window.innerWidth:this.el.clientWidth||this.el.parentElement.clientWidth||window.innerWidth}checkDynamicColumn(){var u,c;const t=this.opts.columnOpts;if(!t||!t.columnWidth&&!((u=t.breakpoints)!=null&&u.length))return!1;const r=this.getColumn();let i=r;const o=this._widthOrContainer(!0);if(t.columnWidth)i=Math.min(Math.round(o/t.columnWidth)||1,t.columnMax);else{i=t.columnMax;let d=0;for(;dp.c===i);return this.column(i,(d==null?void 0:d.layout)||t.layout),!0}return!1}compact(t="compact",r=!0){return this.engine.compact(t,r),this._triggerChangeEvent(),this}column(t,r="moveScale"){if(!t||t<1||this.opts.column===t)return this;const i=this.getColumn();return this.opts.column=t,this.engine?(this.engine.column=t,this.el.classList.remove("gs-"+i),this.el.classList.add("gs-"+t),this.engine.columnChanged(i,t,r),this._isAutoCellHeight&&this.cellHeight(),this.resizeToContentCheck(!0),this._ignoreLayoutsNodeChange=!0,this._triggerChangeEvent(),delete this._ignoreLayoutsNodeChange,this):this}getColumn(){return this.opts.column}getGridItems(){return Array.from(this.el.children).filter(t=>t.matches("."+this.opts.itemClass)&&!t.matches("."+this.opts.placeholderClass))}isIgnoreChangeCB(){return this._ignoreLayoutsNodeChange}destroy(t=!0){var r,i;if(this.el)return this.offAll(),this._updateResizeEvent(!0),this.setStatic(!0,!1),this.setAnimation(!1),t?this.el.parentNode.removeChild(this.el):(this.removeAll(t),this.el.classList.remove(this._styleSheetClass),this.el.removeAttribute("gs-current-row")),this._removeStylesheet(),(r=this.parentGridNode)==null||delete r.subGrid,delete this.parentGridNode,delete this.opts,(i=this._placeholder)==null||delete i.gridstackNode,delete this._placeholder,delete this.engine,delete this.el.gridstack,delete this.el,this}float(t){return this.opts.float!==t&&(this.opts.float=this.engine.float=t,this._triggerChangeEvent()),this}getFloat(){return this.engine.float}getCellFromPixel(t,r=!1){const i=this.el.getBoundingClientRect();let o;r?o={top:i.top+document.documentElement.scrollTop,left:i.left}:o={top:this.el.offsetTop,left:this.el.offsetLeft};const u=t.left-o.left,c=t.top-o.top,d=i.width/this.getColumn(),p=i.height/parseInt(this.el.getAttribute("gs-current-row"));return{x:Math.floor(u/d),y:Math.floor(c/p)}}getRow(){return Math.max(this.engine.getRow(),this.opts.minRow)}isAreaEmpty(t,r,i,o){return this.engine.isAreaEmpty(t,r,i,o)}makeWidget(t,r){const i=Ne.getElement(t);if(!i)return;i.parentElement||this.el.appendChild(i),this._prepareElement(i,!0,r);const o=i.gridstackNode;this._updateContainerHeight(),o.subGridOpts&&this.makeSubGrid(i,o.subGridOpts,void 0,!1);let u;return this.opts.column===1&&!this._ignoreLayoutsNodeChange&&(u=this._ignoreLayoutsNodeChange=!0),this._triggerAddEvent(),this._triggerChangeEvent(),u&&delete this._ignoreLayoutsNodeChange,i}on(t,r){return t.indexOf(" ")!==-1?(t.split(" ").forEach(o=>this.on(o,r)),this):(t==="change"||t==="added"||t==="removed"||t==="enable"||t==="disable"?(t==="enable"||t==="disable"?this._gsEventHandler[t]=o=>r(o):this._gsEventHandler[t]=o=>{o.detail&&r(o,o.detail)},this.el.addEventListener(t,this._gsEventHandler[t])):t==="drag"||t==="dragstart"||t==="dragstop"||t==="resizestart"||t==="resize"||t==="resizestop"||t==="dropped"||t==="resizecontent"?this._gsEventHandler[t]=r:console.error("GridStack.on("+t+") event not supported"),this)}off(t){return t.indexOf(" ")!==-1?(t.split(" ").forEach(i=>this.off(i)),this):((t==="change"||t==="added"||t==="removed"||t==="enable"||t==="disable")&&this._gsEventHandler[t]&&this.el.removeEventListener(t,this._gsEventHandler[t]),delete this._gsEventHandler[t],this)}offAll(){return Object.keys(this._gsEventHandler).forEach(t=>this.off(t)),this}removeWidget(t,r=!0,i=!0){return t?(Ne.getElements(t).forEach(o=>{if(o.parentElement&&o.parentElement!==this.el)return;let u=o.gridstackNode;u||(u=this.engine.nodes.find(c=>o===c.el)),u&&(r&&Ne.addRemoveCB&&Ne.addRemoveCB(this.el,u,!1,!1),delete o.gridstackNode,this._removeDD(o),this.engine.removeNode(u,r,i),r&&o.parentElement&&o.remove())}),i&&(this._triggerRemoveEvent(),this._triggerChangeEvent()),this):(console.error("Error: GridStack.removeWidget(undefined) called"),this)}removeAll(t=!0,r=!0){return this.engine.nodes.forEach(i=>{t&&Ne.addRemoveCB&&Ne.addRemoveCB(this.el,i,!1,!1),delete i.el.gridstackNode,this.opts.staticGrid||this._removeDD(i.el)}),this.engine.removeAll(t,r),r&&this._triggerRemoveEvent(),this}setAnimation(t=this.opts.animate,r){return r?setTimeout(()=>{this.opts&&this.setAnimation(t)}):t?this.el.classList.add("grid-stack-animate"):this.el.classList.remove("grid-stack-animate"),this}hasAnimationCSS(){return this.el.classList.contains("grid-stack-animate")}setStatic(t,r=!0,i=!0){return!!this.opts.staticGrid===t?this:(t?this.opts.staticGrid=!0:delete this.opts.staticGrid,this._setupRemoveDrop(),this._setupAcceptWidget(),this.engine.nodes.forEach(o=>{this.prepareDragDrop(o.el),o.subGrid&&i&&o.subGrid.setStatic(t,r,i)}),r&&this._setStaticClass(),this)}updateOptions(t){var i;const r=this.opts;return t.acceptWidgets!==void 0&&this._setupAcceptWidget(),t.animate!==void 0&&this.setAnimation(),t.cellHeight&&(this.cellHeight(t.cellHeight,!0),delete t.cellHeight),t.class&&t.class!==r.class&&(r.class&&this.el.classList.remove(r.class),this.el.classList.add(t.class)),typeof t.column=="number"&&!t.columnOpts&&(this.column(t.column),delete t.column),t.margin!==void 0&&this.margin(t.margin),t.staticGrid!==void 0&&this.setStatic(t.staticGrid),t.disableDrag!==void 0&&!t.staticGrid&&this.enableMove(!t.disableDrag),t.disableResize!==void 0&&!t.staticGrid&&this.enableResize(!t.disableResize),t.float!==void 0&&this.float(t.float),t.row!==void 0&&(r.minRow=r.maxRow=t.row),(i=t.children)!=null&&i.length&&(this.load(t.children),delete t.children),this.opts={...this.opts,...t},this}update(t,r){return Ne.getElements(t).forEach(i=>{var w;const o=i==null?void 0:i.gridstackNode;if(!o)return;const u={...A.copyPos({},o),...A.cloneDeep(r)};this.engine.nodeBoundFix(u),delete u.autoPosition;const c=["x","y","w","h"];let d;if(c.some(v=>u[v]!==void 0&&u[v]!==o[v])&&(d={},c.forEach(v=>{d[v]=u[v]!==void 0?u[v]:o[v],delete u[v]})),!d&&(u.minW||u.minH||u.maxW||u.maxH)&&(d={}),u.content!==void 0){const v=i.querySelector(".grid-stack-item-content");v&&v.textContent!==u.content&&(o.content=u.content,Ne.renderCB(v,u),(w=o.subGrid)!=null&&w.el&&(v.appendChild(o.subGrid.el),o.subGrid.opts.styleInHead||o.subGrid._updateStyles(!0))),delete u.content}let p=!1,m=!1;for(const v in u)v[0]!=="_"&&o[v]!==u[v]&&(o[v]=u[v],p=!0,m=m||!this.opts.staticGrid&&(v==="noResize"||v==="noMove"||v==="locked"));if(A.sanitizeMinMax(o),d){const v=d.w!==void 0&&d.w!==o.w;this.moveNode(o,d),v&&o.subGrid?o.subGrid.onResize(this.hasAnimationCSS()?o.w:void 0):this.resizeToContentCheck(v,o),delete o._orig}(d||p)&&this._writeAttr(i,o),m&&this.prepareDragDrop(o.el)}),this}moveNode(t,r){const i=t._updating;i||this.engine.cleanNodes().beginUpdate(t),this.engine.moveNode(t,r),this._updateContainerHeight(),i||(this._triggerChangeEvent(),this.engine.endUpdate())}resizeToContent(t){var x,z;if(!t||(t.classList.remove("size-to-content-max"),!t.clientHeight))return;const r=t.gridstackNode;if(!r)return;const i=r.grid;if(!i||t.parentElement!==i.el)return;const o=i.getCellHeight(!0);if(!o)return;let u=r.h?r.h*o:t.clientHeight,c;if(r.resizeToContentParent&&(c=t.querySelector(r.resizeToContentParent)),c||(c=t.querySelector(Ne.resizeToContentParent)),!c)return;const d=t.clientHeight-c.clientHeight,p=r.h?r.h*o-d:c.clientHeight;let m;if(r.subGrid){m=r.subGrid.getRow()*r.subGrid.getCellHeight(!0);const R=r.subGrid.el.getBoundingClientRect(),k=r.subGrid.el.parentElement.getBoundingClientRect();m+=R.top-k.top}else{if((z=(x=r.subGridOpts)==null?void 0:x.children)!=null&&z.length)return;{const R=c.firstElementChild;if(!R){console.error(`Error: GridStack.resizeToContent() widget id:${r.id} '${Ne.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return}m=R.getBoundingClientRect().height||p}}if(p===m)return;u+=m-p;let w=Math.ceil(u/o);const v=Number.isInteger(r.sizeToContent)?r.sizeToContent:0;v&&w>v&&(w=v,t.classList.add("size-to-content-max")),r.minH&&wr.maxH&&(w=r.maxH),w!==r.h&&(i._ignoreLayoutsNodeChange=!0,i.moveNode(r,{h:w}),delete i._ignoreLayoutsNodeChange)}resizeToContentCBCheck(t){Ne.resizeToContentCB?Ne.resizeToContentCB(t):this.resizeToContent(t)}rotate(t,r){return Ne.getElements(t).forEach(i=>{const o=i.gridstackNode;if(!A.canBeRotated(o))return;const u={w:o.h,h:o.w,minH:o.minW,minW:o.minH,maxH:o.maxW,maxW:o.maxH};if(r){const d=r.left>0?Math.floor(r.left/this.cellWidth()):0,p=r.top>0?Math.floor(r.top/this.opts.cellHeight):0;u.x=o.x+d-(o.h-(p+1)),u.y=o.y+p-d}Object.keys(u).forEach(d=>{u[d]===void 0&&delete u[d]});const c=o._orig;this.update(i,u),o._orig=c}),this}margin(t){if(!(typeof t=="string"&&t.split(" ").length>1)){const i=A.parseHeight(t);if(this.opts.marginUnit===i.unit&&this.opts.margin===i.h)return}return this.opts.margin=t,this.opts.marginTop=this.opts.marginBottom=this.opts.marginLeft=this.opts.marginRight=void 0,this._initMargin(),this._updateStyles(!0),this}getMargin(){return this.opts.margin}willItFit(t){if(arguments.length>1){console.warn("gridstack.ts: `willItFit(x,y,w,h,autoPosition)` is deprecated. Use `willItFit({x, y,...})`. It will be removed soon");const r=arguments;let i=0,o={x:r[i++],y:r[i++],w:r[i++],h:r[i++],autoPosition:r[i++]};return this.willItFit(o)}return this.engine.willItFit(t)}_triggerChangeEvent(){if(this.engine.batchMode)return this;const t=this.engine.getDirtyNodes(!0);return t&&t.length&&(this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(t),this._triggerEvent("change",t)),this.engine.saveInitial(),this}_triggerAddEvent(){var t;if(this.engine.batchMode)return this;if((t=this.engine.addedNodes)!=null&&t.length){this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(this.engine.addedNodes),this.engine.addedNodes.forEach(i=>{delete i._dirty});const r=[...this.engine.addedNodes];this.engine.addedNodes=[],this._triggerEvent("added",r)}return this}_triggerRemoveEvent(){var t;if(this.engine.batchMode)return this;if((t=this.engine.removedNodes)!=null&&t.length){const r=[...this.engine.removedNodes];this.engine.removedNodes=[],this._triggerEvent("removed",r)}return this}_triggerEvent(t,r){const i=r?new CustomEvent(t,{bubbles:!1,detail:r}):new Event(t);return this.el.dispatchEvent(i),this}_removeStylesheet(){if(this._styles){const t=this.opts.styleInHead?void 0:this.el.parentNode;A.removeStylesheet(this._styleSheetClass,t),delete this._styles}return this}_updateStyles(t=!1,r){if(t&&this._removeStylesheet(),r===void 0&&(r=this.getRow()),this._updateContainerHeight(),this.opts.cellHeight===0)return this;const i=this.opts.cellHeight,o=this.opts.cellHeightUnit,u=`.${this._styleSheetClass} > .${this.opts.itemClass}`;if(!this._styles){const c=this.opts.styleInHead?void 0:this.el.parentNode;if(this._styles=A.createStylesheet(this._styleSheetClass,c,{nonce:this.opts.nonce}),!this._styles)return this;this._styles._max=0,A.addCSSRule(this._styles,u,`height: ${i}${o}`);const d=this.opts.marginTop+this.opts.marginUnit,p=this.opts.marginBottom+this.opts.marginUnit,m=this.opts.marginRight+this.opts.marginUnit,w=this.opts.marginLeft+this.opts.marginUnit,v=`${u} > .grid-stack-item-content`,x=`.${this._styleSheetClass} > .grid-stack-placeholder > .placeholder-content`;A.addCSSRule(this._styles,v,`top: ${d}; right: ${m}; bottom: ${p}; left: ${w};`),A.addCSSRule(this._styles,x,`top: ${d}; right: ${m}; bottom: ${p}; left: ${w};`),A.addCSSRule(this._styles,`${u} > .ui-resizable-n`,`top: ${d};`),A.addCSSRule(this._styles,`${u} > .ui-resizable-s`,`bottom: ${p}`),A.addCSSRule(this._styles,`${u} > .ui-resizable-ne`,`right: ${m}; top: ${d}`),A.addCSSRule(this._styles,`${u} > .ui-resizable-e`,`right: ${m}`),A.addCSSRule(this._styles,`${u} > .ui-resizable-se`,`right: ${m}; bottom: ${p}`),A.addCSSRule(this._styles,`${u} > .ui-resizable-nw`,`left: ${w}; top: ${d}`),A.addCSSRule(this._styles,`${u} > .ui-resizable-w`,`left: ${w}`),A.addCSSRule(this._styles,`${u} > .ui-resizable-sw`,`left: ${w}; bottom: ${p}`)}if(r=r||this._styles._max,r>this._styles._max){const c=d=>i*d+o;for(let d=this._styles._max+1;d<=r;d++)A.addCSSRule(this._styles,`${u}[gs-y="${d}"]`,`top: ${c(d)}`),A.addCSSRule(this._styles,`${u}[gs-h="${d+1}"]`,`height: ${c(d+1)}`);this._styles._max=r}return this}_updateContainerHeight(){if(!this.engine||this.engine.batchMode)return this;const t=this.parentGridNode;let r=this.getRow()+this._extraDragRow;const i=this.opts.cellHeight,o=this.opts.cellHeightUnit;if(!i)return this;if(!t){const u=A.parseHeight(getComputedStyle(this.el).minHeight);if(u.h>0&&u.unit===o){const c=Math.floor(u.h/i);r1?t.setAttribute("gs-w",String(r.w)):t.removeAttribute("gs-w"),r.h>1?t.setAttribute("gs-h",String(r.h)):t.removeAttribute("gs-h"),this}_writeAttr(t,r){if(!r)return this;this._writePosAttr(t,r);const i={noResize:"gs-no-resize",noMove:"gs-no-move",locked:"gs-locked",id:"gs-id",sizeToContent:"gs-size-to-content"};for(const o in i)r[o]?t.setAttribute(i[o],String(r[o])):t.removeAttribute(i[o]);return this}_readAttr(t,r=!0){const i={};i.x=A.toNumber(t.getAttribute("gs-x")),i.y=A.toNumber(t.getAttribute("gs-y")),i.w=A.toNumber(t.getAttribute("gs-w")),i.h=A.toNumber(t.getAttribute("gs-h")),i.autoPosition=A.toBool(t.getAttribute("gs-auto-position")),i.noResize=A.toBool(t.getAttribute("gs-no-resize")),i.noMove=A.toBool(t.getAttribute("gs-no-move")),i.locked=A.toBool(t.getAttribute("gs-locked"));const o=t.getAttribute("gs-size-to-content");o&&(o==="true"||o==="false"?i.sizeToContent=A.toBool(o):i.sizeToContent=parseInt(o,10)),i.id=t.getAttribute("gs-id"),i.maxW=A.toNumber(t.getAttribute("gs-max-w")),i.minW=A.toNumber(t.getAttribute("gs-min-w")),i.maxH=A.toNumber(t.getAttribute("gs-max-h")),i.minH=A.toNumber(t.getAttribute("gs-min-h")),r&&(i.w===1&&t.removeAttribute("gs-w"),i.h===1&&t.removeAttribute("gs-h"),i.maxW&&t.removeAttribute("gs-max-w"),i.minW&&t.removeAttribute("gs-min-w"),i.maxH&&t.removeAttribute("gs-max-h"),i.minH&&t.removeAttribute("gs-min-h"));for(const u in i){if(!i.hasOwnProperty(u))return;!i[u]&&i[u]!==0&&u!=="gs-size-to-content"&&delete i[u]}return i}_setStaticClass(){const t=["grid-stack-static"];return this.opts.staticGrid?(this.el.classList.add(...t),this.el.setAttribute("gs-static","true")):(this.el.classList.remove(...t),this.el.removeAttribute("gs-static")),this}onResize(t=(r=>(r=this.el)==null?void 0:r.clientWidth)()){if(!t||this.prevWidth===t)return;this.prevWidth=t,this.batchUpdate();let i=!1;return this._autoColumn&&this.parentGridNode?this.opts.column!==this.parentGridNode.w&&(this.column(this.parentGridNode.w,this.opts.layout||"list"),i=!0):i=this.checkDynamicColumn(),this._isAutoCellHeight&&this.cellHeight(),this.engine.nodes.forEach(o=>{o.subGrid&&o.subGrid.onResize()}),this._skipInitialResize||this.resizeToContentCheck(i),delete this._skipInitialResize,this.batchUpdate(!1),this}resizeToContentCheck(t=!1,r=void 0){if(this.engine){if(t&&this.hasAnimationCSS())return setTimeout(()=>this.resizeToContentCheck(!1,r),this.animationDelay);if(r)A.shouldSizeToContent(r)&&this.resizeToContentCBCheck(r.el);else if(this.engine.nodes.some(i=>A.shouldSizeToContent(i))){const i=[...this.engine.nodes];this.batchUpdate(),i.forEach(o=>{A.shouldSizeToContent(o)&&this.resizeToContentCBCheck(o.el)}),this.batchUpdate(!1)}this._gsEventHandler.resizecontent&&this._gsEventHandler.resizecontent(null,r?[r]:this.engine.nodes)}}_updateResizeEvent(t=!1){const r=!this.parentGridNode&&(this._isAutoCellHeight||this.opts.sizeToContent||this.opts.columnOpts||this.engine.nodes.find(i=>i.sizeToContent));return!t&&r&&!this.resizeObserver?(this._sizeThrottle=A.throttle(()=>this.onResize(),this.opts.cellHeightThrottle),this.resizeObserver=new ResizeObserver(()=>this._sizeThrottle()),this.resizeObserver.observe(this.el),this._skipInitialResize=!0):(t||!r)&&this.resizeObserver&&(this.resizeObserver.disconnect(),delete this.resizeObserver,delete this._sizeThrottle),this}static getElement(t=".grid-stack-item"){return A.getElement(t)}static getElements(t=".grid-stack-item"){return A.getElements(t)}static getGridElement(t){return Ne.getElement(t)}static getGridElements(t){return A.getElements(t)}_initMargin(){let t,r=0,i=[];return typeof this.opts.margin=="string"&&(i=this.opts.margin.split(" ")),i.length===2?(this.opts.marginTop=this.opts.marginBottom=i[0],this.opts.marginLeft=this.opts.marginRight=i[1]):i.length===4?(this.opts.marginTop=i[0],this.opts.marginRight=i[1],this.opts.marginBottom=i[2],this.opts.marginLeft=i[3]):(t=A.parseHeight(this.opts.margin),this.opts.marginUnit=t.unit,r=this.opts.margin=t.h),this.opts.marginTop===void 0?this.opts.marginTop=r:(t=A.parseHeight(this.opts.marginTop),this.opts.marginTop=t.h,delete this.opts.margin),this.opts.marginBottom===void 0?this.opts.marginBottom=r:(t=A.parseHeight(this.opts.marginBottom),this.opts.marginBottom=t.h,delete this.opts.margin),this.opts.marginRight===void 0?this.opts.marginRight=r:(t=A.parseHeight(this.opts.marginRight),this.opts.marginRight=t.h,delete this.opts.margin),this.opts.marginLeft===void 0?this.opts.marginLeft=r:(t=A.parseHeight(this.opts.marginLeft),this.opts.marginLeft=t.h,delete this.opts.margin),this.opts.marginUnit=t.unit,this.opts.marginTop===this.opts.marginBottom&&this.opts.marginLeft===this.opts.marginRight&&this.opts.marginTop===this.opts.marginRight&&(this.opts.margin=this.opts.marginTop),this}static getDD(){return $n}static setupDragIn(t,r,i,o=document){(r==null?void 0:r.pause)!==void 0&&(Le.pauseDrag=r.pause),r={appendTo:"body",helper:"clone",...r||{}},(typeof t=="string"?A.getElements(t,o):t).forEach((c,d)=>{$n.isDraggable(c)||$n.dragIn(c,r),i!=null&&i[d]&&(c.gridstackNode=i[d])})}movable(t,r){return this.opts.staticGrid?this:(Ne.getElements(t).forEach(i=>{const o=i.gridstackNode;o&&(r?delete o.noMove:o.noMove=!0,this.prepareDragDrop(o.el))}),this)}resizable(t,r){return this.opts.staticGrid?this:(Ne.getElements(t).forEach(i=>{const o=i.gridstackNode;o&&(r?delete o.noResize:o.noResize=!0,this.prepareDragDrop(o.el))}),this)}disable(t=!0){if(!this.opts.staticGrid)return this.enableMove(!1,t),this.enableResize(!1,t),this._triggerEvent("disable"),this}enable(t=!0){if(!this.opts.staticGrid)return this.enableMove(!0,t),this.enableResize(!0,t),this._triggerEvent("enable"),this}enableMove(t,r=!0){return this.opts.staticGrid?this:(t?delete this.opts.disableDrag:this.opts.disableDrag=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&r&&i.subGrid.enableMove(t,r)}),this)}enableResize(t,r=!0){return this.opts.staticGrid?this:(t?delete this.opts.disableResize:this.opts.disableResize=!0,this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&r&&i.subGrid.enableResize(t,r)}),this)}cancelDrag(){var r;const t=(r=this._placeholder)==null?void 0:r.gridstackNode;t&&(t._isExternal?(t._isAboutToRemove=!0,this.engine.removeNode(t)):t._isAboutToRemove&&Ne._itemRemoving(t.el,!1),this.engine.restoreInitial())}_removeDD(t){return $n.draggable(t,"destroy").resizable(t,"destroy"),t.gridstackNode&&delete t.gridstackNode._initDD,delete t.ddElement,this}_setupAcceptWidget(){if(this.opts.staticGrid||!this.opts.acceptWidgets&&!this.opts.removable)return $n.droppable(this.el,"destroy"),this;let t,r;const i=(o,u,c)=>{var x;c=c||u;const d=c.gridstackNode;if(!d)return;if(!((x=d.grid)!=null&&x.el)){c.style.transform=`scale(${1/this.dragTransform.xScale},${1/this.dragTransform.yScale})`;const z=c.getBoundingClientRect();c.style.left=z.x+(this.dragTransform.xScale-1)*(o.clientX-z.x)/this.dragTransform.xScale+"px",c.style.top=z.y+(this.dragTransform.yScale-1)*(o.clientY-z.y)/this.dragTransform.yScale+"px",c.style.transformOrigin="0px 0px"}let{top:p,left:m}=c.getBoundingClientRect();const w=this.el.getBoundingClientRect();m-=w.left,p-=w.top;const v={position:{top:p*this.dragTransform.xScale,left:m*this.dragTransform.yScale}};if(d._temporaryRemoved){if(d.x=Math.max(0,Math.round(m/r)),d.y=Math.max(0,Math.round(p/t)),delete d.autoPosition,this.engine.nodeBoundFix(d),!this.engine.willItFit(d)){if(d.autoPosition=!0,!this.engine.willItFit(d)){$n.off(u,"drag");return}d._willFitPos&&(A.copyPos(d,d._willFitPos),delete d._willFitPos)}this._onStartMoving(c,o,v,d,r,t)}else this._dragOrResize(c,o,v,d,r,t)};return $n.droppable(this.el,{accept:o=>{const u=o.gridstackNode||this._readAttr(o,!1);if((u==null?void 0:u.grid)===this)return!0;if(!this.opts.acceptWidgets)return!1;let c=!0;if(typeof this.opts.acceptWidgets=="function")c=this.opts.acceptWidgets(o);else{const d=this.opts.acceptWidgets===!0?".grid-stack-item":this.opts.acceptWidgets;c=o.matches(d)}if(c&&u&&this.opts.maxRow){const d={w:u.w,h:u.h,minW:u.minW,minH:u.minH};c=this.engine.willItFit(d)}return c}}).on(this.el,"dropover",(o,u,c)=>{let d=(c==null?void 0:c.gridstackNode)||u.gridstackNode;if((d==null?void 0:d.grid)===this&&!d._temporaryRemoved)return!1;if(d!=null&&d._sidebarOrig&&(d.w=d._sidebarOrig.w,d.h=d._sidebarOrig.h),d!=null&&d.grid&&d.grid!==this&&!d._temporaryRemoved&&d.grid._leave(u,c),c=c||u,r=this.cellWidth(),t=this.getCellHeight(!0),!d){const w=c.getAttribute("data-gs-widget")||c.getAttribute("gridstacknode");if(w){try{d=JSON.parse(w)}catch{console.error("Gridstack dropover: Bad JSON format: ",w)}c.removeAttribute("data-gs-widget"),c.removeAttribute("gridstacknode")}d||(d=this._readAttr(c)),d._sidebarOrig={w:d.w,h:d.h}}d.grid||(d.el||(d={...d}),d._isExternal=!0,c.gridstackNode=d);const p=d.w||Math.round(c.offsetWidth/r)||1,m=d.h||Math.round(c.offsetHeight/t)||1;return d.grid&&d.grid!==this?(u._gridstackNodeOrig||(u._gridstackNodeOrig=d),u.gridstackNode=d={...d,w:p,h:m,grid:this},delete d.x,delete d.y,this.engine.cleanupNode(d).nodeBoundFix(d),d._initDD=d._isExternal=d._temporaryRemoved=!0):(d.w=p,d.h=m,d._temporaryRemoved=!0),Ne._itemRemoving(d.el,!1),$n.on(u,"drag",i),i(o,u,c),!1}).on(this.el,"dropout",(o,u,c)=>{const d=(c==null?void 0:c.gridstackNode)||u.gridstackNode;return d&&(!d.grid||d.grid===this)&&(this._leave(u,c),this._isTemp&&this.removeAsSubGrid(d)),!1}).on(this.el,"drop",(o,u,c)=>{var z,R,k;const d=(c==null?void 0:c.gridstackNode)||u.gridstackNode;if((d==null?void 0:d.grid)===this&&!d._isExternal)return!1;const p=!!this.placeholder.parentElement,m=u!==c;this.placeholder.remove(),delete this.placeholder.gridstackNode;const w=p&&this.opts.animate;w&&this.setAnimation(!1);const v=u._gridstackNodeOrig;if(delete u._gridstackNodeOrig,p&&(v!=null&&v.grid)&&v.grid!==this){const b=v.grid;b.engine.removeNodeFromLayoutCache(v),b.engine.removedNodes.push(v),b._triggerRemoveEvent()._triggerChangeEvent(),b.parentGridNode&&!b.engine.nodes.length&&b.opts.subGridDynamic&&b.removeAsSubGrid()}if(!d||(p&&(this.engine.cleanupNode(d),d.grid=this),(z=d.grid)==null||delete z._isTemp,$n.off(u,"drag"),c!==u?(c.remove(),u=c):u.remove(),this._removeDD(u),!p))return!1;const x=(k=(R=d.subGrid)==null?void 0:R.el)==null?void 0:k.gridstack;return A.copyPos(d,this._readAttr(this.placeholder)),A.removePositioningStyles(u),m&&(d.content||d.subGridOpts||Ne.addRemoveCB)?(delete d.el,u=this.addWidget(d)):(this._prepareElement(u,!0,d),this.el.appendChild(u),this.resizeToContentCheck(!1,d),x&&(x.parentGridNode=d,x.opts.styleInHead||x._updateStyles(!0)),this._updateContainerHeight()),this.engine.addedNodes.push(d),this._triggerAddEvent(),this._triggerChangeEvent(),this.engine.endUpdate(),this._gsEventHandler.dropped&&this._gsEventHandler.dropped({...o,type:"dropped"},v&&v.grid?v:void 0,d),w&&this.setAnimation(this.opts.animate,!0),!1}),this}static _itemRemoving(t,r){if(!t)return;const i=t?t.gridstackNode:void 0;!(i!=null&&i.grid)||t.classList.contains(i.grid.opts.removableOptions.decline)||(r?i._isAboutToRemove=!0:delete i._isAboutToRemove,r?t.classList.add("grid-stack-item-removing"):t.classList.remove("grid-stack-item-removing"))}_setupRemoveDrop(){if(typeof this.opts.removable!="string")return this;const t=document.querySelector(this.opts.removable);return t?(!this.opts.staticGrid&&!$n.isDroppable(t)&&$n.droppable(t,this.opts.removableOptions).on(t,"dropover",(r,i)=>Ne._itemRemoving(i,!0)).on(t,"dropout",(r,i)=>Ne._itemRemoving(i,!1)),this):this}prepareDragDrop(t,r=!1){const i=t==null?void 0:t.gridstackNode;if(!i)return;const o=i.noMove||this.opts.disableDrag,u=i.noResize||this.opts.disableResize,c=this.opts.staticGrid||o&&u;if((r||c)&&(i._initDD&&(this._removeDD(t),delete i._initDD),c&&t.classList.add("ui-draggable-disabled","ui-resizable-disabled"),!r))return this;if(!i._initDD){let d,p;const m=(x,z)=>{this._gsEventHandler[x.type]&&this._gsEventHandler[x.type](x,x.target),d=this.cellWidth(),p=this.getCellHeight(!0),this._onStartMoving(t,x,z,i,d,p)},w=(x,z)=>{this._dragOrResize(t,x,z,i,d,p)},v=x=>{this.placeholder.remove(),delete this.placeholder.gridstackNode,delete i._moving,delete i._event,delete i._lastTried;const z=i.w!==i._orig.w,R=x.target;if(!(!R.gridstackNode||R.gridstackNode.grid!==this)){if(i.el=R,i._isAboutToRemove){const k=t.gridstackNode.grid;k._gsEventHandler[x.type]&&k._gsEventHandler[x.type](x,R),k.engine.nodes.push(i),k.removeWidget(t,!0,!0)}else A.removePositioningStyles(R),i._temporaryRemoved?(A.copyPos(i,i._orig),this._writePosAttr(R,i),this.engine.addNode(i)):this._writePosAttr(R,i),this._gsEventHandler[x.type]&&this._gsEventHandler[x.type](x,R);this._extraDragRow=0,this._updateContainerHeight(),this._triggerChangeEvent(),this.engine.endUpdate(),x.type==="resizestop"&&(Number.isInteger(i.sizeToContent)&&(i.sizeToContent=i.h),this.resizeToContentCheck(z,i))}};$n.draggable(t,{start:m,stop:v,drag:w}).resizable(t,{start:m,stop:v,resize:w}),i._initDD=!0}return $n.draggable(t,o?"disable":"enable").resizable(t,u?"disable":"enable"),this}_onStartMoving(t,r,i,o,u,c){var d;if(this.engine.cleanNodes().beginUpdate(o),this._writePosAttr(this.placeholder,o),this.el.appendChild(this.placeholder),this.placeholder.gridstackNode=o,(d=o.grid)!=null&&d.el)this.dragTransform=A.getValuesFromTransformedElement(t);else if(this.placeholder&&this.placeholder.closest(".grid-stack")){const p=this.placeholder.closest(".grid-stack");this.dragTransform=A.getValuesFromTransformedElement(p)}else this.dragTransform={xScale:1,xOffset:0,yScale:1,yOffset:0};if(o.el=this.placeholder,o._lastUiPosition=i.position,o._prevYPix=i.position.top,o._moving=r.type==="dragstart",delete o._lastTried,r.type==="dropover"&&o._temporaryRemoved&&(this.engine.addNode(o),o._moving=!0),this.engine.cacheRects(u,c,this.opts.marginTop,this.opts.marginRight,this.opts.marginBottom,this.opts.marginLeft),r.type==="resizestart"){const p=this.getColumn()-o.x,m=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-o.y;$n.resizable(t,"option","minWidth",u*Math.min(o.minW||1,p)).resizable(t,"option","minHeight",c*Math.min(o.minH||1,m)).resizable(t,"option","maxWidth",u*Math.min(o.maxW||Number.MAX_SAFE_INTEGER,p)).resizable(t,"option","maxWidthMoveLeft",u*Math.min(o.maxW||Number.MAX_SAFE_INTEGER,o.x+o.w)).resizable(t,"option","maxHeight",c*Math.min(o.maxH||Number.MAX_SAFE_INTEGER,m)).resizable(t,"option","maxHeightMoveUp",c*Math.min(o.maxH||Number.MAX_SAFE_INTEGER,o.y+o.h))}}_dragOrResize(t,r,i,o,u,c){const d={...o._orig};let p,m=this.opts.marginLeft,w=this.opts.marginRight,v=this.opts.marginTop,x=this.opts.marginBottom;const z=Math.round(c*.1),R=Math.round(u*.1);if(m=Math.min(m,R),w=Math.min(w,R),v=Math.min(v,z),x=Math.min(x,z),r.type==="drag"){if(o._temporaryRemoved)return;const b=i.position.top-o._prevYPix;o._prevYPix=i.position.top,this.opts.draggable.scroll!==!1&&A.updateScrollPosition(t,i.position,b);const W=i.position.left+(i.position.left>o._lastUiPosition.left?-w:m),P=i.position.top+(i.position.top>o._lastUiPosition.top?-x:v);d.x=Math.round(W/u),d.y=Math.round(P/c);const B=this._extraDragRow;if(this.engine.collide(o,d)){const V=this.getRow();let ee=Math.max(0,d.y+o.h-V);this.opts.maxRow&&V+ee>this.opts.maxRow&&(ee=Math.max(0,this.opts.maxRow-V)),this._extraDragRow=ee}else this._extraDragRow=0;if(this._extraDragRow!==B&&this._updateContainerHeight(),o.x===d.x&&o.y===d.y)return}else if(r.type==="resize"){if(d.x<0||(A.updateScrollResize(r,t,c),d.w=Math.round((i.size.width-m)/u),d.h=Math.round((i.size.height-v)/c),o.w===d.w&&o.h===d.h)||o._lastTried&&o._lastTried.w===d.w&&o._lastTried.h===d.h)return;const b=i.position.left+m,W=i.position.top+v;d.x=Math.round(b/u),d.y=Math.round(W/c),p=!0}o._event=r,o._lastTried=d;const k={x:i.position.left+m,y:i.position.top+v,w:(i.size?i.size.width:o.w*u)-m-w,h:(i.size?i.size.height:o.h*c)-v-x};if(this.engine.moveNodeCheck(o,{...d,cellWidth:u,cellHeight:c,rect:k,resizing:p})){o._lastUiPosition=i.position,this.engine.cacheRects(u,c,v,w,x,m),delete o._skipDown,p&&o.subGrid&&o.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();const b=r.target;o._sidebarOrig||this._writePosAttr(b,o),this._gsEventHandler[r.type]&&this._gsEventHandler[r.type](r,b)}}_leave(t,r){r=r||t;const i=r.gridstackNode;if(!i||(r.style.transform=r.style.transformOrigin=null,$n.off(t,"drag"),i._temporaryRemoved))return;i._temporaryRemoved=!0,this.engine.removeNode(i),i.el=i._isExternal&&r?r:t;const o=i._sidebarOrig;i._isExternal&&this.engine.cleanupNode(i),i._sidebarOrig=o,this.opts.removable===!0&&Ne._itemRemoving(t,!0),t._gridstackNodeOrig?(t.gridstackNode=t._gridstackNodeOrig,delete t._gridstackNodeOrig):i._isExternal&&this.engine.restoreInitial()}commit(){return CS(this,this.batchUpdate(!1),"commit","batchUpdate","5.2"),this}}Ne.renderCB=(l,t)=>{l&&(t!=null&&t.content)&&(l.textContent=t.content)};Ne.resizeToContentParent=".grid-stack-item-content";Ne.Utils=A;Ne.Engine=ai;Ne.GDRev="11.5.1";function DS({widget:l,onRemove:t}){const r=vS[l.kind];return U.jsxs("div",{className:"widget",children:[U.jsxs("div",{className:"widget-header",children:[U.jsx("span",{className:"widget-grip","aria-hidden":!0,children:"⠿"}),U.jsx("span",{className:"widget-icon",children:r==null?void 0:r.icon}),U.jsx("span",{className:"widget-title",children:(r==null?void 0:r.title)||l.kind}),U.jsx("button",{className:"widget-close",title:"Remove widget",onClick:t,children:"×"})]}),U.jsx("div",{className:"widget-body",children:r?r.render(l.id):null})]})}function TS(){const l=Eo(w=>w.widgets),t=Eo(w=>w.updateGeom),r=Eo(w=>w.removeWidget),i=j.useRef(null),o=j.useRef(null),u=j.useRef(new Map),[c,d]=j.useState(new Map),[p,m]=j.useState(!1);return j.useEffect(()=>{if(!i.current)return;const w=Ne.init({column:12,cellHeight:56,margin:8,float:!0,handle:".widget-header",resizable:{handles:"e, se, s, sw, w"},animate:!0},i.current);return o.current=w,w.on("change",(v,x)=>{const z=x.map(R=>({id:String(R.id),x:R.x??0,y:R.y??0,w:R.w??1,h:R.h??1}));z.length&&t(z)}),m(!0),()=>{w.destroy(!1),o.current=null}},[t]),j.useEffect(()=>{const w=o.current;if(!w||!p)return;const v=new Set(l.map(R=>R.id));let x=!1;const z=new Map(c);w.batchUpdate();for(const R of l){if(u.current.has(R.id))continue;const k=w.addWidget({x:R.x,y:R.y,w:R.w,h:R.h,id:R.id}),b=k.querySelector(".grid-stack-item-content");u.current.set(R.id,k),z.set(R.id,b),x=!0}for(const[R,k]of Array.from(u.current.entries()))v.has(R)||(w.removeWidget(k,!0),u.current.delete(R),z.delete(R),x=!0);w.commit(),x&&d(z)},[l,p]),U.jsxs("div",{className:"canvas",children:[U.jsx("div",{className:"grid-stack",ref:i}),l.map(w=>{const v=c.get(w.id);return v?bs.createPortal(U.jsx(DS,{widget:w,onRemove:()=>r(w.id)}),v,w.id):null})]})}function zS(){const l=gn(d=>d.addSignalToPlot),t=gn(d=>d.setMotorTypes),[r,i]=j.useState(null),o=ly(sy(Vf,{activationConstraint:{distance:4}}));j.useEffect(()=>{Am(),F1().then(t)},[t]);const u=d=>{var m;const p=(m=d.active.data.current)==null?void 0:m.signalId;i(p?Af(p):null)},c=d=>{var w,v,x,z;i(null);const p=(w=d.active.data.current)==null?void 0:w.signalId,m=((x=(v=d.over)==null?void 0:v.id)==null?void 0:x.toString())||"";if(p&&m.startsWith("plot:")){const R=(z=d.over.data.current)==null?void 0:z.panelId;l(R,p)}};return U.jsxs(r0,{sensors:o,onDragStart:u,onDragEnd:c,children:[U.jsxs("div",{className:"app",children:[U.jsx(SS,{}),U.jsxs("div",{className:"body",children:[U.jsx(ES,{}),U.jsx("main",{className:"canvas-host",children:U.jsx(TS,{})})]})]}),U.jsx(E0,{dropAnimation:null,children:r?U.jsx("div",{className:"drag-ghost",children:r}):null})]})}wS();$v.createRoot(document.getElementById("root")).render(U.jsx(ht.StrictMode,{children:U.jsx(zS,{})})); diff --git a/damiao_motor/gui/webapp/dist/assets/index-BzaSkbtY.css b/damiao_motor/gui/webapp/dist/assets/index-CrxIlrMA.css similarity index 91% rename from damiao_motor/gui/webapp/dist/assets/index-BzaSkbtY.css rename to damiao_motor/gui/webapp/dist/assets/index-CrxIlrMA.css index 4e988af..4d9e3ad 100644 --- a/damiao_motor/gui/webapp/dist/assets/index-BzaSkbtY.css +++ b/damiao_motor/gui/webapp/dist/assets/index-CrxIlrMA.css @@ -1 +1 @@ -.uplot,.uplot *,.uplot *:before,.uplot *:after{box-sizing:border-box}.uplot{font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";line-height:1.5;width:min-content}.u-title{text-align:center;font-size:18px;font-weight:700}.u-wrap{position:relative;-webkit-user-select:none;user-select:none}.u-over,.u-under{position:absolute}.u-under{overflow:hidden}.uplot canvas{display:block;position:relative;width:100%;height:100%}.u-axis{position:absolute}.u-legend{font-size:14px;margin:auto;text-align:center}.u-inline{display:block}.u-inline *{display:inline-block}.u-inline tr{margin-right:16px}.u-legend th{font-weight:600}.u-legend th>*{vertical-align:middle;display:inline-block}.u-legend .u-marker{width:1em;height:1em;margin-right:4px;background-clip:padding-box!important}.u-inline.u-live th:after{content:":";vertical-align:middle}.u-inline:not(.u-live) .u-value{display:none}.u-series>*{padding:4px}.u-series th{cursor:pointer}.u-legend .u-off>*{opacity:.3}.u-select{background:#00000012;position:absolute;pointer-events:none}.u-cursor-x,.u-cursor-y{position:absolute;left:0;top:0;pointer-events:none;will-change:transform}.u-hz .u-cursor-x,.u-vt .u-cursor-y{height:100%;border-right:1px dashed #607D8B}.u-hz .u-cursor-y,.u-vt .u-cursor-x{width:100%;border-bottom:1px dashed #607D8B}.u-cursor-pt{position:absolute;top:0;left:0;border-radius:50%;border:0 solid;pointer-events:none;will-change:transform;background-clip:padding-box!important}.u-axis.u-off,.u-select.u-off,.u-cursor-x.u-off,.u-cursor-y.u-off,.u-cursor-pt.u-off{display:none}.grid-stack{position:relative}.grid-stack-rtl{direction:ltr}.grid-stack-rtl>.grid-stack-item{direction:rtl}.grid-stack-placeholder>.placeholder-content{background-color:#0000001a;margin:0;position:absolute;width:auto;z-index:0!important}.grid-stack>.grid-stack-item{position:absolute;padding:0}.grid-stack>.grid-stack-item>.grid-stack-item-content{margin:0;position:absolute;width:auto;overflow-x:hidden;overflow-y:auto}.grid-stack>.grid-stack-item.size-to-content:not(.size-to-content-max)>.grid-stack-item-content{overflow-y:hidden}.grid-stack-item>.ui-resizable-handle{position:absolute;font-size:.1px;display:block;-ms-touch-action:none;touch-action:none}.grid-stack-item.ui-resizable-autohide>.ui-resizable-handle,.grid-stack-item.ui-resizable-disabled>.ui-resizable-handle{display:none}.grid-stack-item>.ui-resizable-ne,.grid-stack-item>.ui-resizable-nw,.grid-stack-item>.ui-resizable-se,.grid-stack-item>.ui-resizable-sw{background-image:url('data:image/svg+xml;utf8,');background-repeat:no-repeat;background-position:center}.grid-stack-item>.ui-resizable-ne{transform:rotate(45deg)}.grid-stack-item>.ui-resizable-sw{transform:rotate(45deg)}.grid-stack-item>.ui-resizable-nw{transform:rotate(-45deg)}.grid-stack-item>.ui-resizable-se{transform:rotate(-45deg)}.grid-stack-item>.ui-resizable-nw{cursor:nw-resize;width:20px;height:20px;top:0}.grid-stack-item>.ui-resizable-n{cursor:n-resize;height:10px;top:0;left:25px;right:25px}.grid-stack-item>.ui-resizable-ne{cursor:ne-resize;width:20px;height:20px;top:0}.grid-stack-item>.ui-resizable-e{cursor:e-resize;width:10px;top:15px;bottom:15px}.grid-stack-item>.ui-resizable-se{cursor:se-resize;width:20px;height:20px}.grid-stack-item>.ui-resizable-s{cursor:s-resize;height:10px;left:25px;bottom:0;right:25px}.grid-stack-item>.ui-resizable-sw{cursor:sw-resize;width:20px;height:20px}.grid-stack-item>.ui-resizable-w{cursor:w-resize;width:10px;top:15px;bottom:15px}.grid-stack-item.ui-draggable-dragging>.ui-resizable-handle{display:none!important}.grid-stack-item.ui-draggable-dragging{will-change:left,top;cursor:move}.grid-stack-item.ui-resizable-resizing{will-change:width,height}.ui-draggable-dragging,.ui-resizable-resizing{z-index:10000}.ui-draggable-dragging>.grid-stack-item-content,.ui-resizable-resizing>.grid-stack-item-content{box-shadow:1px 4px 6px #0003;opacity:.8}.grid-stack-animate,.grid-stack-animate .grid-stack-item{transition:left .3s,top .3s,height .3s,width .3s}.grid-stack-animate .grid-stack-item.grid-stack-placeholder,.grid-stack-animate .grid-stack-item.ui-draggable-dragging,.grid-stack-animate .grid-stack-item.ui-resizable-resizing{transition:left 0s,top 0s,height 0s,width 0s}.grid-stack>.grid-stack-item[gs-y="0"]{top:0}.grid-stack>.grid-stack-item[gs-x="0"]{left:0}.gs-12>.grid-stack-item{width:8.333%}.gs-12>.grid-stack-item[gs-x="1"]{left:8.333%}.gs-12>.grid-stack-item[gs-w="2"]{width:16.667%}.gs-12>.grid-stack-item[gs-x="2"]{left:16.667%}.gs-12>.grid-stack-item[gs-w="3"]{width:25%}.gs-12>.grid-stack-item[gs-x="3"]{left:25%}.gs-12>.grid-stack-item[gs-w="4"]{width:33.333%}.gs-12>.grid-stack-item[gs-x="4"]{left:33.333%}.gs-12>.grid-stack-item[gs-w="5"]{width:41.667%}.gs-12>.grid-stack-item[gs-x="5"]{left:41.667%}.gs-12>.grid-stack-item[gs-w="6"]{width:50%}.gs-12>.grid-stack-item[gs-x="6"]{left:50%}.gs-12>.grid-stack-item[gs-w="7"]{width:58.333%}.gs-12>.grid-stack-item[gs-x="7"]{left:58.333%}.gs-12>.grid-stack-item[gs-w="8"]{width:66.667%}.gs-12>.grid-stack-item[gs-x="8"]{left:66.667%}.gs-12>.grid-stack-item[gs-w="9"]{width:75%}.gs-12>.grid-stack-item[gs-x="9"]{left:75%}.gs-12>.grid-stack-item[gs-w="10"]{width:83.333%}.gs-12>.grid-stack-item[gs-x="10"]{left:83.333%}.gs-12>.grid-stack-item[gs-w="11"]{width:91.667%}.gs-12>.grid-stack-item[gs-x="11"]{left:91.667%}.gs-12>.grid-stack-item[gs-w="12"]{width:100%}.gs-1>.grid-stack-item{width:100%}:root{--bg: #f4f6f9;--bg-1: #eef1f6;--surface: #ffffff;--surface-2: #eef2f7;--hover: #e6ecf3;--border: #d6dde7;--border-soft: #e7ecf2;--text: #1e2733;--muted: #5f6a78;--accent: #2f6fed;--ok: #16a34a;--warn: #d97706;--err: #e11d48;--radius: 14px;--radius-sm: 9px;--shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px -16px rgba(16, 24, 40, .28);--font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;--mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace}:root[data-theme=dark]{--bg: #0f1216;--bg-1: #141a21;--surface: #171d25;--surface-2: #1d242e;--hover: #232c38;--border: #262e3a;--border-soft: #1f2630;--text: #d7dde5;--muted: #8a94a3;--accent: #6aa3ff;--ok: #4ade80;--warn: #fbbf24;--err: #fb7185;--shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px -16px rgba(0, 0, 0, .65)}*{box-sizing:border-box}html,body,#root{height:100%;margin:0}body{font-family:var(--font);background:var(--bg);color:var(--text);font-size:13px;-webkit-font-smoothing:antialiased}.mono{font-family:var(--mono);font-variant-numeric:tabular-nums}.muted{color:var(--muted)}.small{font-size:11px}.center{text-align:center}.pad{padding:16px}.strong{font-weight:650}.dim{opacity:.5}.app{display:flex;flex-direction:column;height:100%}.body{flex:1;display:flex;min-height:0}.canvas-host{flex:1;min-width:0;position:relative;overflow:auto}.canvas{min-height:100%;padding:6px}.toolbar{display:flex;align-items:center;gap:16px;height:52px;padding:0 16px;background:var(--surface);border-bottom:1px solid var(--border)}.brand{font-weight:650;font-size:15px;letter-spacing:.2px;display:flex;align-items:center;gap:9px}.brand-sub{color:var(--muted);font-weight:500;font-size:12px}.brand-dot{width:9px;height:9px;border-radius:50%;background:var(--accent);box-shadow:0 0 12px var(--accent)}.conn{display:flex;align-items:center;gap:9px}.conn .dot{width:8px;height:8px;border-radius:50%}.dot.on{background:var(--ok);box-shadow:0 0 9px var(--ok)}.dot.off{background:var(--err)}.spacer{flex:1}.actions{display:flex;gap:7px}.badge{font-size:10.5px;padding:2px 8px;border-radius:999px;font-weight:650;border:1px solid transparent;text-transform:uppercase;letter-spacing:.4px}.badge.ok{color:var(--ok);border-color:#4ade8059;background:#4ade801a}.badge.warn{color:var(--warn);border-color:#fbbf2459;background:#fbbf241a}.badge.err{color:var(--err);border-color:#fb718559;background:#fb71851a}.btn{background:var(--surface-2);color:var(--text);border:1px solid var(--border);border-radius:var(--radius-sm);padding:6px 11px;font-size:12px;cursor:pointer;transition:background .15s,border-color .15s,transform .05s}.btn:hover{background:var(--hover);border-color:var(--border)}.btn:active{transform:translateY(1px)}.btn.ghost{background:transparent}.btn.small{padding:3px 9px;font-size:11px}.btn.active{border-color:var(--accent);color:var(--accent)}.btn-icon{color:var(--accent);margin-right:2px}.sidebar{width:236px;flex-shrink:0;background:var(--bg-1);border-right:1px solid var(--border-soft);display:flex;flex-direction:column}.sidebar-head{padding:12px 14px;border-bottom:1px solid var(--border-soft)}.sidebar-title{font-weight:650;margin-bottom:9px}.filter,.type-select,select,input[type=text],input[type=number]{width:100%;background:var(--surface-2);border:1px solid var(--border);color:var(--text);border-radius:var(--radius-sm);padding:6px 9px;font-size:12px;outline:none;transition:border-color .15s,box-shadow .15s}.filter:focus,select:focus,input:focus{border-color:var(--accent);box-shadow:0 0 0 3px #6aa3ff26}.sidebar-body{flex:1;overflow-y:auto;padding:10px}.sidebar-foot{padding:10px 14px;border-top:1px solid var(--border-soft);font-size:11px;line-height:1.55;color:var(--muted)}.motor-group{margin-bottom:14px}.motor-group-title{font-size:11px;text-transform:uppercase;letter-spacing:.6px;color:var(--muted);margin:0 2px 6px}.chips{display:flex;flex-direction:column;gap:5px}.sig-chip{display:flex;align-items:center;gap:8px;padding:6px 9px;background:var(--surface);border:1px solid var(--border-soft);border-radius:var(--radius-sm);cursor:grab;-webkit-user-select:none;user-select:none;font-size:12px;transition:background .12s,border-color .12s}.sig-chip:hover{background:var(--surface-2);border-color:var(--border)}.sig-chip.dragging{opacity:.4}.sig-swatch{width:10px;height:10px;border-radius:3px;border:2px solid;flex-shrink:0}.sig-name{flex:1;font-family:var(--mono)}.sig-unit{color:var(--muted);font-size:10.5px}.drag-ghost{background:var(--accent);color:#05203f;font-weight:650;font-size:12px;padding:6px 11px;border-radius:var(--radius-sm);font-family:var(--mono);box-shadow:0 10px 26px #0000008c}.grid-stack{background:transparent}.grid-stack-item-content{top:0;right:0;bottom:0;left:0;overflow:visible;background:transparent;border:none}.widget{height:100%;display:flex;flex-direction:column;background:var(--surface);border:1px solid var(--border-soft);border-radius:var(--radius);box-shadow:var(--shadow);overflow:hidden}.widget-header{display:flex;align-items:center;gap:8px;height:34px;padding:0 8px 0 10px;flex-shrink:0;border-bottom:1px solid var(--border-soft);background:var(--surface-2);cursor:move}.widget-grip{color:var(--muted);opacity:.5;font-size:12px;letter-spacing:-2px}.widget-icon{color:var(--accent);font-size:12px}.widget-title{flex:1;font-size:12.5px;font-weight:600;letter-spacing:.2px}.widget-close{width:22px;height:22px;border:none;background:transparent;color:var(--muted);border-radius:6px;cursor:pointer;font-size:16px;line-height:1;opacity:0;transition:opacity .12s,background .12s,color .12s}.widget:hover .widget-close{opacity:1}.widget-close:hover{background:#fb718526;color:var(--err)}.widget-body{flex:1;min-height:0;position:relative}.widget-body .panel{height:100%}.grid-stack-item>.ui-resizable-handle{filter:opacity(.45)}.grid-stack-item:hover>.ui-resizable-handle{filter:opacity(.9)}.grid-stack-placeholder>.placeholder-content{border:1px dashed var(--accent);border-radius:var(--radius);background:#6aa3ff0f}.panel{height:100%;display:flex;flex-direction:column;overflow:hidden}.plot-toolbar{display:flex;align-items:center;gap:8px;padding:6px 10px;border-bottom:1px solid var(--border-soft);flex-wrap:wrap}.plot-toolbar select{width:auto}.legend{display:flex;gap:6px;flex-wrap:wrap}.legend-chip{display:inline-flex;align-items:center;gap:5px;font-size:11px;padding:2px 7px 2px 6px;border:1px solid var(--border);border-radius:999px;font-family:var(--mono)}.legend-swatch{width:9px;height:9px;border-radius:2px;border:1.5px solid}.legend-x{background:none;border:none;color:var(--muted);cursor:pointer;font-size:13px;padding:0 0 0 2px}.legend-x:hover{color:var(--err)}.plot-host{flex:1;min-height:0;position:relative;padding:6px}.plot-host.drop-over{outline:2px dashed var(--accent);outline-offset:-5px;background:#6aa3ff0f;border-radius:10px}.drop-hint{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;color:var(--muted);font-size:12px;pointer-events:none;text-align:center;padding:22px}.table-panel{overflow:auto}.motor-table{width:100%;border-collapse:collapse;font-size:12px}.motor-table th,.motor-table td{padding:6px 10px;text-align:right;border-bottom:1px solid var(--border-soft);white-space:nowrap}.motor-table th:first-child,.motor-table td:first-child{text-align:left}.motor-table th{position:sticky;top:0;background:var(--surface-2);color:var(--muted);font-weight:600;font-size:11px;text-transform:uppercase;letter-spacing:.4px}.motor-table tr:hover td{background:var(--hover)}.cmd-col{color:var(--accent)}.status-pill{font-size:10px;padding:2px 8px;border-radius:999px;font-weight:650}.status-pill.ok{color:var(--ok);background:#4ade801f}.status-pill.off{color:var(--muted);background:#8a94a31f}.status-pill.warn{color:var(--warn);background:#fbbf241f}.cards-panel{overflow:auto}.cards-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:11px;padding:12px}.motor-card{background:var(--bg-1);border:1px solid var(--border-soft);border-radius:12px;padding:13px}.motor-card-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:5px}.motor-card-sub{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:11px}.type-select{width:auto;padding:3px 7px;font-size:11px}.metric{margin-bottom:9px}.metric-label{font-size:11px;color:var(--text);margin-bottom:3px}.metric-values{display:flex;align-items:baseline;gap:10px}.metric-act{font-family:var(--mono);font-size:20px;font-weight:650}.metric-cmd{font-family:var(--mono);font-size:12px;color:var(--accent)}.temp-row{display:flex;justify-content:space-between;font-size:11px;color:var(--muted);margin-top:7px;border-top:1px solid var(--border-soft);padding-top:7px}.rawlog-panel{font-size:11.5px}.rawlog-toolbar{display:flex;align-items:center;gap:10px;padding:6px 10px;border-bottom:1px solid var(--border-soft)}.rawlog-body{flex:1;overflow:auto}.rawlog-head,.rawlog-row{display:grid;grid-template-columns:96px 60px 46px 76px minmax(0,1fr) 150px;gap:10px;align-items:center;padding:0 10px}.rawlog-head{position:sticky;top:0;z-index:2;height:26px;background:var(--surface-2);border-bottom:1px solid var(--border-soft);color:var(--muted);font-size:10.5px;text-transform:uppercase;letter-spacing:.4px}.rawlog-row{position:absolute;left:0;right:0;height:22px;line-height:22px;border-bottom:1px solid var(--border-soft)}.rawlog-head>span,.rawlog-row>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.rawlog-row .c-f{color:var(--text)}.rawlog-row.k-command .c-k{color:var(--accent)}.rawlog-row.k-feedback .c-k{color:var(--ok)}.rawlog-row.k-special .c-k{color:var(--warn)}.message,.loading{color:var(--muted);text-align:center;padding:24px} +.uplot,.uplot *,.uplot *:before,.uplot *:after{box-sizing:border-box}.uplot{font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";line-height:1.5;width:min-content}.u-title{text-align:center;font-size:18px;font-weight:700}.u-wrap{position:relative;-webkit-user-select:none;user-select:none}.u-over,.u-under{position:absolute}.u-under{overflow:hidden}.uplot canvas{display:block;position:relative;width:100%;height:100%}.u-axis{position:absolute}.u-legend{font-size:14px;margin:auto;text-align:center}.u-inline{display:block}.u-inline *{display:inline-block}.u-inline tr{margin-right:16px}.u-legend th{font-weight:600}.u-legend th>*{vertical-align:middle;display:inline-block}.u-legend .u-marker{width:1em;height:1em;margin-right:4px;background-clip:padding-box!important}.u-inline.u-live th:after{content:":";vertical-align:middle}.u-inline:not(.u-live) .u-value{display:none}.u-series>*{padding:4px}.u-series th{cursor:pointer}.u-legend .u-off>*{opacity:.3}.u-select{background:#00000012;position:absolute;pointer-events:none}.u-cursor-x,.u-cursor-y{position:absolute;left:0;top:0;pointer-events:none;will-change:transform}.u-hz .u-cursor-x,.u-vt .u-cursor-y{height:100%;border-right:1px dashed #607D8B}.u-hz .u-cursor-y,.u-vt .u-cursor-x{width:100%;border-bottom:1px dashed #607D8B}.u-cursor-pt{position:absolute;top:0;left:0;border-radius:50%;border:0 solid;pointer-events:none;will-change:transform;background-clip:padding-box!important}.u-axis.u-off,.u-select.u-off,.u-cursor-x.u-off,.u-cursor-y.u-off,.u-cursor-pt.u-off{display:none}.grid-stack{position:relative}.grid-stack-rtl{direction:ltr}.grid-stack-rtl>.grid-stack-item{direction:rtl}.grid-stack-placeholder>.placeholder-content{background-color:#0000001a;margin:0;position:absolute;width:auto;z-index:0!important}.grid-stack>.grid-stack-item{position:absolute;padding:0}.grid-stack>.grid-stack-item>.grid-stack-item-content{margin:0;position:absolute;width:auto;overflow-x:hidden;overflow-y:auto}.grid-stack>.grid-stack-item.size-to-content:not(.size-to-content-max)>.grid-stack-item-content{overflow-y:hidden}.grid-stack-item>.ui-resizable-handle{position:absolute;font-size:.1px;display:block;-ms-touch-action:none;touch-action:none}.grid-stack-item.ui-resizable-autohide>.ui-resizable-handle,.grid-stack-item.ui-resizable-disabled>.ui-resizable-handle{display:none}.grid-stack-item>.ui-resizable-ne,.grid-stack-item>.ui-resizable-nw,.grid-stack-item>.ui-resizable-se,.grid-stack-item>.ui-resizable-sw{background-image:url('data:image/svg+xml;utf8,');background-repeat:no-repeat;background-position:center}.grid-stack-item>.ui-resizable-ne{transform:rotate(45deg)}.grid-stack-item>.ui-resizable-sw{transform:rotate(45deg)}.grid-stack-item>.ui-resizable-nw{transform:rotate(-45deg)}.grid-stack-item>.ui-resizable-se{transform:rotate(-45deg)}.grid-stack-item>.ui-resizable-nw{cursor:nw-resize;width:20px;height:20px;top:0}.grid-stack-item>.ui-resizable-n{cursor:n-resize;height:10px;top:0;left:25px;right:25px}.grid-stack-item>.ui-resizable-ne{cursor:ne-resize;width:20px;height:20px;top:0}.grid-stack-item>.ui-resizable-e{cursor:e-resize;width:10px;top:15px;bottom:15px}.grid-stack-item>.ui-resizable-se{cursor:se-resize;width:20px;height:20px}.grid-stack-item>.ui-resizable-s{cursor:s-resize;height:10px;left:25px;bottom:0;right:25px}.grid-stack-item>.ui-resizable-sw{cursor:sw-resize;width:20px;height:20px}.grid-stack-item>.ui-resizable-w{cursor:w-resize;width:10px;top:15px;bottom:15px}.grid-stack-item.ui-draggable-dragging>.ui-resizable-handle{display:none!important}.grid-stack-item.ui-draggable-dragging{will-change:left,top;cursor:move}.grid-stack-item.ui-resizable-resizing{will-change:width,height}.ui-draggable-dragging,.ui-resizable-resizing{z-index:10000}.ui-draggable-dragging>.grid-stack-item-content,.ui-resizable-resizing>.grid-stack-item-content{box-shadow:1px 4px 6px #0003;opacity:.8}.grid-stack-animate,.grid-stack-animate .grid-stack-item{transition:left .3s,top .3s,height .3s,width .3s}.grid-stack-animate .grid-stack-item.grid-stack-placeholder,.grid-stack-animate .grid-stack-item.ui-draggable-dragging,.grid-stack-animate .grid-stack-item.ui-resizable-resizing{transition:left 0s,top 0s,height 0s,width 0s}.grid-stack>.grid-stack-item[gs-y="0"]{top:0}.grid-stack>.grid-stack-item[gs-x="0"]{left:0}.gs-12>.grid-stack-item{width:8.333%}.gs-12>.grid-stack-item[gs-x="1"]{left:8.333%}.gs-12>.grid-stack-item[gs-w="2"]{width:16.667%}.gs-12>.grid-stack-item[gs-x="2"]{left:16.667%}.gs-12>.grid-stack-item[gs-w="3"]{width:25%}.gs-12>.grid-stack-item[gs-x="3"]{left:25%}.gs-12>.grid-stack-item[gs-w="4"]{width:33.333%}.gs-12>.grid-stack-item[gs-x="4"]{left:33.333%}.gs-12>.grid-stack-item[gs-w="5"]{width:41.667%}.gs-12>.grid-stack-item[gs-x="5"]{left:41.667%}.gs-12>.grid-stack-item[gs-w="6"]{width:50%}.gs-12>.grid-stack-item[gs-x="6"]{left:50%}.gs-12>.grid-stack-item[gs-w="7"]{width:58.333%}.gs-12>.grid-stack-item[gs-x="7"]{left:58.333%}.gs-12>.grid-stack-item[gs-w="8"]{width:66.667%}.gs-12>.grid-stack-item[gs-x="8"]{left:66.667%}.gs-12>.grid-stack-item[gs-w="9"]{width:75%}.gs-12>.grid-stack-item[gs-x="9"]{left:75%}.gs-12>.grid-stack-item[gs-w="10"]{width:83.333%}.gs-12>.grid-stack-item[gs-x="10"]{left:83.333%}.gs-12>.grid-stack-item[gs-w="11"]{width:91.667%}.gs-12>.grid-stack-item[gs-x="11"]{left:91.667%}.gs-12>.grid-stack-item[gs-w="12"]{width:100%}.gs-1>.grid-stack-item{width:100%}:root{--bg: #f4f6f9;--bg-1: #eef1f6;--surface: #ffffff;--surface-2: #eef2f7;--hover: #e6ecf3;--border: #d6dde7;--border-soft: #e7ecf2;--text: #1e2733;--muted: #5f6a78;--accent: #2f6fed;--ok: #16a34a;--warn: #d97706;--err: #e11d48;--radius: 14px;--radius-sm: 9px;--shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px -16px rgba(16, 24, 40, .28);--font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;--mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace}:root[data-theme=dark]{--bg: #0f1216;--bg-1: #141a21;--surface: #171d25;--surface-2: #1d242e;--hover: #232c38;--border: #262e3a;--border-soft: #1f2630;--text: #d7dde5;--muted: #8a94a3;--accent: #6aa3ff;--ok: #4ade80;--warn: #fbbf24;--err: #fb7185;--shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px -16px rgba(0, 0, 0, .65)}*{box-sizing:border-box}html,body,#root{height:100%;margin:0}body{font-family:var(--font);background:var(--bg);color:var(--text);font-size:13px;-webkit-font-smoothing:antialiased}.mono{font-family:var(--mono);font-variant-numeric:tabular-nums}.muted{color:var(--muted)}.small{font-size:11px}.center{text-align:center}.pad{padding:16px}.strong{font-weight:650}.dim{opacity:.5}.app{display:flex;flex-direction:column;height:100%}.body{flex:1;display:flex;min-height:0}.canvas-host{flex:1;min-width:0;position:relative;overflow:auto}.canvas{min-height:100%;padding:6px}.toolbar{display:flex;align-items:center;gap:16px;height:52px;padding:0 16px;background:var(--surface);border-bottom:1px solid var(--border)}.brand{font-weight:650;font-size:15px;letter-spacing:.2px;display:flex;align-items:center;gap:9px}.brand-sub{color:var(--muted);font-weight:500;font-size:12px}.brand-dot{width:9px;height:9px;border-radius:50%;background:var(--accent);box-shadow:0 0 12px var(--accent)}.conn{display:flex;align-items:center;gap:9px}.conn .dot{width:8px;height:8px;border-radius:50%}.dot.on{background:var(--ok);box-shadow:0 0 9px var(--ok)}.dot.off{background:var(--err)}.spacer{flex:1}.actions{display:flex;gap:7px}.badge{font-size:10.5px;padding:2px 8px;border-radius:999px;font-weight:650;border:1px solid transparent;text-transform:uppercase;letter-spacing:.4px}.badge.ok{color:var(--ok);border-color:#4ade8059;background:#4ade801a}.badge.warn{color:var(--warn);border-color:#fbbf2459;background:#fbbf241a}.badge.err{color:var(--err);border-color:#fb718559;background:#fb71851a}.btn{background:var(--surface-2);color:var(--text);border:1px solid var(--border);border-radius:var(--radius-sm);padding:6px 11px;font-size:12px;cursor:pointer;transition:background .15s,border-color .15s,transform .05s}.btn:hover{background:var(--hover);border-color:var(--border)}.btn:active{transform:translateY(1px)}.btn.ghost{background:transparent}.btn.small{padding:3px 9px;font-size:11px}.btn.active{border-color:var(--accent);color:var(--accent)}.btn-icon{color:var(--accent);margin-right:2px}.sidebar{width:236px;flex-shrink:0;background:var(--bg-1);border-right:1px solid var(--border-soft);display:flex;flex-direction:column}.sidebar-head{padding:12px 14px;border-bottom:1px solid var(--border-soft)}.sidebar-title{font-weight:650;margin-bottom:9px}.filter,.type-select,select,input[type=text],input[type=number]{width:100%;background:var(--surface-2);border:1px solid var(--border);color:var(--text);border-radius:var(--radius-sm);padding:6px 9px;font-size:12px;outline:none;transition:border-color .15s,box-shadow .15s}.filter:focus,select:focus,input:focus{border-color:var(--accent);box-shadow:0 0 0 3px #6aa3ff26}.sidebar-body{flex:1;overflow-y:auto;padding:10px}.sidebar-foot{padding:10px 14px;border-top:1px solid var(--border-soft);font-size:11px;line-height:1.55;color:var(--muted)}.motor-group{margin-bottom:14px}.motor-group-title{font-size:11px;text-transform:uppercase;letter-spacing:.6px;color:var(--muted);margin:0 2px 6px}.chips{display:flex;flex-direction:column;gap:5px}.sig-chip{display:flex;align-items:center;gap:8px;padding:6px 9px;background:var(--surface);border:1px solid var(--border-soft);border-radius:var(--radius-sm);cursor:grab;-webkit-user-select:none;user-select:none;font-size:12px;transition:background .12s,border-color .12s}.sig-chip:hover{background:var(--surface-2);border-color:var(--border)}.sig-chip.dragging{opacity:.4}.sig-swatch{width:10px;height:10px;border-radius:3px;border:2px solid;flex-shrink:0}.sig-name{flex:1;font-family:var(--mono)}.sig-unit{color:var(--muted);font-size:10.5px}.drag-ghost{background:var(--accent);color:#05203f;font-weight:650;font-size:12px;padding:6px 11px;border-radius:var(--radius-sm);font-family:var(--mono);box-shadow:0 10px 26px #0000008c}.grid-stack{background:transparent}.grid-stack-item-content{top:0;right:0;bottom:0;left:0;overflow:visible;background:transparent;border:none}.widget{height:100%;display:flex;flex-direction:column;background:var(--surface);border:1px solid var(--border-soft);border-radius:var(--radius);box-shadow:var(--shadow);overflow:hidden}.widget-header{display:flex;align-items:center;gap:8px;height:34px;padding:0 8px 0 10px;flex-shrink:0;border-bottom:1px solid var(--border-soft);background:var(--surface-2);cursor:move}.widget-grip{color:var(--muted);opacity:.5;font-size:12px;letter-spacing:-2px}.widget-icon{color:var(--accent);font-size:12px}.widget-title{flex:1;font-size:12.5px;font-weight:600;letter-spacing:.2px}.widget-close{width:22px;height:22px;border:none;background:transparent;color:var(--muted);border-radius:6px;cursor:pointer;font-size:16px;line-height:1;opacity:0;transition:opacity .12s,background .12s,color .12s}.widget:hover .widget-close{opacity:1}.widget-close:hover{background:#fb718526;color:var(--err)}.widget-body{flex:1;min-height:0;position:relative}.widget-body .panel{height:100%}.grid-stack-item>.ui-resizable-handle{filter:opacity(.45)}.grid-stack-item:hover>.ui-resizable-handle{filter:opacity(.9)}.grid-stack-placeholder>.placeholder-content{border:1px dashed var(--accent);border-radius:var(--radius);background:#6aa3ff0f}.panel{height:100%;display:flex;flex-direction:column;overflow:hidden}.plot-toolbar{display:flex;align-items:center;gap:8px;padding:6px 10px;border-bottom:1px solid var(--border-soft);flex-wrap:wrap}.plot-toolbar select{width:auto}.legend{display:flex;gap:6px;flex-wrap:wrap}.legend-chip{display:inline-flex;align-items:center;gap:5px;font-size:11px;padding:2px 7px 2px 6px;border:1px solid var(--border);border-radius:999px;font-family:var(--mono)}.legend-swatch{width:9px;height:9px;border-radius:2px;border:1.5px solid}.legend-x{background:none;border:none;color:var(--muted);cursor:pointer;font-size:13px;padding:0 0 0 2px}.legend-x:hover{color:var(--err)}.plot-host{flex:1;min-height:0;position:relative;padding:6px}.plot-host.drop-over{outline:2px dashed var(--accent);outline-offset:-5px;background:#6aa3ff0f;border-radius:10px}.drop-hint{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;color:var(--muted);font-size:12px;pointer-events:none;text-align:center;padding:22px}.table-panel{overflow:auto}.motor-table{width:100%;border-collapse:collapse;font-size:12px}.motor-table th,.motor-table td{padding:6px 10px;text-align:right;border-bottom:1px solid var(--border-soft);white-space:nowrap}.motor-table th:first-child,.motor-table td:first-child{text-align:left}.motor-table th{position:sticky;top:0;background:var(--surface-2);color:var(--muted);font-weight:600;font-size:11px;text-transform:uppercase;letter-spacing:.4px}.motor-table tr:hover td{background:var(--hover)}.cmd-col{color:var(--accent)}.status-pill{font-size:10px;padding:2px 8px;border-radius:999px;font-weight:650}.status-pill.ok{color:var(--ok);background:#4ade801f}.status-pill.off{color:var(--muted);background:#8a94a31f}.status-pill.warn{color:var(--warn);background:#fbbf241f}.cards-panel{overflow:auto}.cards-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:11px;padding:12px}.motor-card{background:var(--bg-1);border:1px solid var(--border-soft);border-radius:12px;padding:13px}.motor-card-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:5px}.motor-card-sub{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:11px}.type-select{width:auto;padding:3px 7px;font-size:11px}.metric{margin-bottom:9px}.metric-label{font-size:11px;color:var(--text);margin-bottom:3px}.metric-values{display:flex;align-items:baseline;gap:10px}.metric-act{font-family:var(--mono);font-size:20px;font-weight:650}.metric-cmd{font-family:var(--mono);font-size:12px;color:var(--accent)}.temp-row{display:flex;justify-content:space-between;font-size:11px;color:var(--muted);margin-top:7px;border-top:1px solid var(--border-soft);padding-top:7px}.rawlog-panel{font-size:11.5px}.rawlog-toolbar{display:flex;align-items:center;gap:10px;padding:6px 10px;border-bottom:1px solid var(--border-soft)}.rawlog-body{flex:1;overflow:auto}.rawlog-head,.rawlog-row{display:grid;grid-template-columns:96px 60px 46px 76px minmax(0,1fr) 150px;gap:10px;align-items:center;padding:0 10px}.rawlog-head{position:sticky;top:0;z-index:2;height:26px;background:var(--surface-2);border-bottom:1px solid var(--border-soft);color:var(--muted);font-size:10.5px;text-transform:uppercase;letter-spacing:.4px}.rawlog-row{position:absolute;left:0;right:0;height:22px;line-height:22px;border-bottom:1px solid var(--border-soft)}.rawlog-head>span,.rawlog-row>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.rawlog-row .c-f{color:var(--text)}.rawlog-row.k-command .c-k{color:var(--accent)}.rawlog-row.k-feedback .c-k{color:var(--ok)}.rawlog-row.k-special .c-k{color:var(--warn)}.message,.loading{color:var(--muted);text-align:center;padding:24px}.mode-switch{display:inline-flex;background:var(--surface-2);border:1px solid var(--border);border-radius:999px;padding:2px;gap:2px}.mode-tab{border:none;background:transparent;color:var(--muted);cursor:pointer;font-size:12px;font-weight:600;padding:4px 12px;border-radius:999px;transition:all .12s}.mode-tab:hover{color:var(--text)}.mode-tab.active{background:var(--accent);color:#fff}.btn.primary{background:var(--accent);color:#fff;border-color:transparent}.btn.primary:hover{filter:brightness(1.06)}.btn.ok{background:#16a34a24;color:var(--ok);border-color:#16a34a66}.btn.danger{background:#e11d4824;color:var(--err);border-color:#e11d4866}.control-form{padding:12px;overflow:auto;gap:0}.form-row{display:grid;grid-template-columns:92px 1fr;align-items:center;gap:8px;margin-bottom:8px}.form-row label{font-size:12px;color:var(--muted)}.form-row input,.form-row select{width:100%}.form-actions{display:flex;align-items:center;gap:8px;margin:10px 0 4px}.form-actions.wrap{flex-wrap:wrap}.form-actions .toggle{display:inline-flex;align-items:center;gap:5px;font-size:12px;color:var(--muted)}.form-actions .freq{width:64px}.form-error{color:var(--err);font-size:12px;margin-top:8px}.form-msg{color:var(--muted);font-size:12px;margin-top:8px}.registers-panel{overflow:hidden}.registers-body{flex:1;overflow:auto}.reg-table td{vertical-align:middle}.reg-table td:first-child{white-space:normal;max-width:160px}.reg-table input,.reg-table select{padding:3px 6px;font-size:11.5px}.reg-table .btn.small{padding:2px 8px} diff --git a/damiao_motor/gui/webapp/dist/index.html b/damiao_motor/gui/webapp/dist/index.html index eff6602..e628999 100644 --- a/damiao_motor/gui/webapp/dist/index.html +++ b/damiao_motor/gui/webapp/dist/index.html @@ -4,8 +4,8 @@ DaMiao Monitor - - + +
diff --git a/damiao_motor/gui/webapp/src/App.tsx b/damiao_motor/gui/webapp/src/App.tsx index 20edabb..1bf9609 100644 --- a/damiao_motor/gui/webapp/src/App.tsx +++ b/damiao_motor/gui/webapp/src/App.tsx @@ -15,20 +15,35 @@ import Canvas from "./components/Canvas"; import { useApp } from "./lib/store"; import { connectWs, fetchMotorTypes } from "./lib/ws"; import { shortSignal } from "./lib/format"; +import { api } from "./lib/control"; export default function App() { const addSignalToPlot = useApp((s) => s.addSignalToPlot); const setMotorTypes = useApp((s) => s.setMotorTypes); + const setMode = useApp((s) => s.setMode); + const setStatus = useApp((s) => s.setStatus); + const setRegisterTable = useApp((s) => s.setRegisterTable); const [dragLabel, setDragLabel] = useState(null); // a 4 px activation distance so clicks on chips don't accidentally start drags const sensors = useSensors(useSensor(PointerSensor, { activationConstraint: { distance: 4 } })); useEffect(() => { - // store hydrates plot configs synchronously at creation; just connect + load types + // store hydrates plot configs synchronously at creation; just connect + load metadata connectWs(); fetchMotorTypes().then(setMotorTypes); - }, [setMotorTypes]); + api.status().then((s) => { + if (s?.mode) setMode(s.mode); + setStatus(s); + }); + api.registerTable().then((d) => { + if (d?.registers) { + const t: Record = {}; + for (const r of d.registers) t[r.rid] = r; + setRegisterTable(t); + } + }); + }, [setMotorTypes, setMode, setStatus, setRegisterTable]); const onDragStart = (e: DragStartEvent) => { const sid = e.active.data.current?.signalId as string | undefined; diff --git a/damiao_motor/gui/webapp/src/components/Toolbar.tsx b/damiao_motor/gui/webapp/src/components/Toolbar.tsx index 4756c0f..75ddbb5 100644 --- a/damiao_motor/gui/webapp/src/components/Toolbar.tsx +++ b/damiao_motor/gui/webapp/src/components/Toolbar.tsx @@ -3,43 +3,64 @@ import { useApp } from "../lib/store"; import { useWidgets } from "../lib/widgets"; import { PANELS } from "../panels/registry"; import { getTheme, setTheme, type Theme } from "../lib/theme"; +import { api } from "../lib/control"; export default function Toolbar() { const connected = useApp((s) => s.connected); const status = useApp((s) => s.status); + const mode = useApp((s) => s.mode); + const setMode = useApp((s) => s.setMode); + const setControlMotors = useApp((s) => s.setControlMotors); + const setCurrentMotor = useApp((s) => s.setCurrentMotor); const addWidget = useWidgets((s) => s.addWidget); const resetWidgets = useWidgets((s) => s.resetWidgets); const [theme, setThemeState] = useState(getTheme()); - const resetLayout = () => resetWidgets(); const toggleTheme = () => { const next: Theme = theme === "light" ? "dark" : "light"; setTheme(next); setThemeState(next); }; + const switchMode = async (m: "monitor" | "control") => { + if (m === mode) return; + setMode(m); + setControlMotors([]); + setCurrentMotor(null); + await api.setMode(m); + }; + + const busLabel = status?.demo ? "demo" : status?.channel || "—"; + return (
- DaMiao Passive Monitor + DaMiao Studio +
+ +
+ +
- - {status?.demo ? "demo" : status?.channel || "—"} - - {status && !status.demo && ( - - {status.listenOnly ? "listen-only" : "rx (no TX)"} + {busLabel} + {mode === "control" ? ( + active · TX + ) : ( + + listen-only )} - {status?.error && bus error} + {status?.error && error} {status && ( - - {status.framesSeen.toLocaleString()} frames · +{status.feedbackOffset} fb - + {status.framesSeen?.toLocaleString?.() ?? 0} frames )}
@@ -47,23 +68,14 @@ export default function Toolbar() {
{PANELS.map((p) => ( - ))} - - +
); diff --git a/damiao_motor/gui/webapp/src/index.css b/damiao_motor/gui/webapp/src/index.css index c93d14c..97d6814 100644 --- a/damiao_motor/gui/webapp/src/index.css +++ b/damiao_motor/gui/webapp/src/index.css @@ -260,3 +260,38 @@ body { .rawlog-row.k-special .c-k { color: var(--warn); } .message, .loading { color: var(--muted); text-align: center; padding: 24px; } + +/* ----------------------------------------------------- mode switch */ +.mode-switch { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 2px; gap: 2px; } +.mode-tab { + border: none; background: transparent; color: var(--muted); cursor: pointer; + font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 999px; transition: all 0.12s; +} +.mode-tab:hover { color: var(--text); } +.mode-tab.active { background: var(--accent); color: #fff; } + +/* button color variants */ +.btn.primary { background: var(--accent); color: #fff; border-color: transparent; } +.btn.primary:hover { filter: brightness(1.06); } +.btn.ok { background: rgba(22,163,74,0.14); color: var(--ok); border-color: rgba(22,163,74,0.4); } +.btn.danger { background: rgba(225,29,72,0.14); color: var(--err); border-color: rgba(225,29,72,0.4); } + +/* ----------------------------------------------------- control forms */ +.control-form { padding: 12px; overflow: auto; gap: 0; } +.form-row { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 8px; margin-bottom: 8px; } +.form-row label { font-size: 12px; color: var(--muted); } +.form-row input, .form-row select { width: 100%; } +.form-actions { display: flex; align-items: center; gap: 8px; margin: 10px 0 4px; } +.form-actions.wrap { flex-wrap: wrap; } +.form-actions .toggle { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); } +.form-actions .freq { width: 64px; } +.form-error { color: var(--err); font-size: 12px; margin-top: 8px; } +.form-msg { color: var(--muted); font-size: 12px; margin-top: 8px; } + +/* registers panel */ +.registers-panel { overflow: hidden; } +.registers-body { flex: 1; overflow: auto; } +.reg-table td { vertical-align: middle; } +.reg-table td:first-child { white-space: normal; max-width: 160px; } +.reg-table input, .reg-table select { padding: 3px 6px; font-size: 11.5px; } +.reg-table .btn.small { padding: 2px 8px; } diff --git a/damiao_motor/gui/webapp/src/lib/control.ts b/damiao_motor/gui/webapp/src/lib/control.ts new file mode 100644 index 0000000..7cf62a0 --- /dev/null +++ b/damiao_motor/gui/webapp/src/lib/control.ts @@ -0,0 +1,50 @@ +/** REST client for the unified server (control + common endpoints). */ + +async function jget(url: string): Promise { + const r = await fetch(url); + return r.json(); +} +async function jpost(url: string, body?: any): Promise { + const r = await fetch(url, { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify(body || {}), + }); + return r.json(); +} +async function jput(url: string, body: any): Promise { + const r = await fetch(url, { + method: "PUT", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify(body), + }); + return r.json(); +} + +export const api = { + status: () => jget("/api/status"), + setMode: (mode: "control" | "monitor") => jpost("/api/mode", { mode }), + connect: (body: { channel: string; bustype: string; bitrate?: number | null; motor_type?: string; feedback_offset?: number }) => + jpost("/api/connect", body), + disconnect: () => jpost("/api/disconnect"), + + scan: (motor_type: string) => jpost("/api/control/scan", { motor_type }), + motors: () => jget("/api/control/motors"), + enable: (id: number) => jpost(`/api/control/motors/${id}/enable`), + disable: (id: number) => jpost(`/api/control/motors/${id}/disable`), + setZero: (id: number) => jpost(`/api/control/motors/${id}/set-zero`), + clearError: (id: number) => jpost(`/api/control/motors/${id}/clear-error`), + storeParams: (id: number) => jpost(`/api/control/motors/${id}/store-parameters`), + command: (id: number, body: any) => jpost(`/api/control/motors/${id}/command`, body), + state: (id: number) => jget(`/api/control/motors/${id}/state`), + getRegisters: (id: number) => jget(`/api/control/motors/${id}/registers`), + setRegister: (id: number, rid: number, value: number) => + jput(`/api/control/motors/${id}/registers/${rid}`, { value }), + setMotorType: (id: number, motor_type: string) => + jput(`/api/control/motors/${id}/motor-type`, { motor_type }), + + registerTable: () => jget("/api/register-table"), + motorTypes: () => jget("/api/motor-types"), + canInterfaces: (bustype: string) => jget(`/api/can-interfaces?bustype=${bustype}`), + platform: () => jget("/api/platform"), +}; diff --git a/damiao_motor/gui/webapp/src/lib/store.ts b/damiao_motor/gui/webapp/src/lib/store.ts index c141ccd..72dff97 100644 --- a/damiao_motor/gui/webapp/src/lib/store.ts +++ b/damiao_motor/gui/webapp/src/lib/store.ts @@ -26,6 +26,15 @@ export function persistPlotConfigs(cfgs: Record) { } } +export interface RegisterInfo { + rid: number; + variable: string; + description: string; + access: string; + range_str: string; + data_type: string; +} + interface AppState { connected: boolean; status: ServerStatus | null; @@ -36,11 +45,21 @@ interface AppState { // per-panel plot configs (signals shown), persisted alongside the dock layout plotConfigs: Record; + // control state + mode: "monitor" | "control"; + controlMotors: { id: number; motor_type: string }[]; + currentMotorId: number | null; + registerTable: Record; + setConnected: (c: boolean) => void; setStatus: (s: ServerStatus) => void; setMeta: (signals: SignalDescriptor[], pairs: Pair[]) => void; setMotors: (m: MotorView[]) => void; setMotorTypes: (t: string[]) => void; + setMode: (m: "monitor" | "control") => void; + setControlMotors: (m: { id: number; motor_type: string }[]) => void; + setCurrentMotor: (id: number | null) => void; + setRegisterTable: (t: Record) => void; ensurePlot: (id: string) => void; setPlotConfig: (id: string, cfg: Partial) => void; @@ -58,11 +77,20 @@ export const useApp = create((set, get) => ({ motorTypes: [], plotConfigs: loadPlotConfigs(), // hydrate synchronously to avoid effect-ordering races + mode: "monitor", + controlMotors: [], + currentMotorId: null, + registerTable: {}, + setConnected: (c) => set({ connected: c }), setStatus: (s) => set({ status: s }), setMeta: (signals, pairs) => set({ signals, pairs }), setMotors: (motors) => set({ motors }), setMotorTypes: (motorTypes) => set({ motorTypes }), + setMode: (mode) => set({ mode }), + setControlMotors: (controlMotors) => set({ controlMotors }), + setCurrentMotor: (currentMotorId) => set({ currentMotorId }), + setRegisterTable: (registerTable) => set({ registerTable }), ensurePlot: (id) => set((st) => diff --git a/damiao_motor/gui/webapp/src/lib/types.ts b/damiao_motor/gui/webapp/src/lib/types.ts index 75e20b8..f5e2194 100644 --- a/damiao_motor/gui/webapp/src/lib/types.ts +++ b/damiao_motor/gui/webapp/src/lib/types.ts @@ -25,10 +25,10 @@ export interface MotorView { } export interface ServerStatus { - channel: string; + mode: "monitor" | "control"; + connected: boolean; + channel: string | null; bustype: string; - bitrate: number | null; - started: boolean; error: string | null; listenOnly: boolean; feedbackOffset: number; diff --git a/damiao_motor/gui/webapp/src/lib/widgets.ts b/damiao_motor/gui/webapp/src/lib/widgets.ts index 15e4925..b43c79b 100644 --- a/damiao_motor/gui/webapp/src/lib/widgets.ts +++ b/damiao_motor/gui/webapp/src/lib/widgets.ts @@ -11,7 +11,7 @@ export interface Widget { h: number; } -const KEY = "damiao.monitor.widgets.v2"; +const KEY = "damiao.monitor.widgets.v3"; function load(): Widget[] | null { try { @@ -33,10 +33,12 @@ function persist(widgets: Widget[]) { } const DEFAULT_WIDGETS: Widget[] = [ - { id: "plot-1", kind: "plot", x: 0, y: 0, w: 7, h: 6 }, - { id: "cards-1", kind: "cards", x: 7, y: 0, w: 5, h: 6 }, - { id: "table-1", kind: "table", x: 0, y: 6, w: 7, h: 5 }, - { id: "rawlog-1", kind: "rawlog", x: 7, y: 6, w: 5, h: 5 }, + { id: "connection-1", kind: "connection", x: 0, y: 0, w: 3, h: 4 }, + { id: "control-1", kind: "control", x: 0, y: 4, w: 3, h: 8 }, + { id: "plot-1", kind: "plot", x: 3, y: 0, w: 6, h: 6 }, + { id: "cards-1", kind: "cards", x: 9, y: 0, w: 3, h: 6 }, + { id: "table-1", kind: "table", x: 3, y: 6, w: 6, h: 6 }, + { id: "registers-1", kind: "registers", x: 9, y: 6, w: 3, h: 6 }, ]; let counter = 1; diff --git a/damiao_motor/gui/webapp/src/panels/ConnectionPanel.tsx b/damiao_motor/gui/webapp/src/panels/ConnectionPanel.tsx new file mode 100644 index 0000000..b1d6448 --- /dev/null +++ b/damiao_motor/gui/webapp/src/panels/ConnectionPanel.tsx @@ -0,0 +1,134 @@ +import { useEffect, useState } from "react"; +import { useApp } from "../lib/store"; +import { api } from "../lib/control"; + +export default function ConnectionPanel() { + const mode = useApp((s) => s.mode); + const status = useApp((s) => s.status); + const controlMotors = useApp((s) => s.controlMotors); + const currentMotorId = useApp((s) => s.currentMotorId); + const setControlMotors = useApp((s) => s.setControlMotors); + const setCurrentMotor = useApp((s) => s.setCurrentMotor); + const motorTypes = useApp((s) => s.motorTypes); + + const [bustype, setBustype] = useState("socketcan"); + const [channel, setChannel] = useState("can0"); + const [bitrate, setBitrate] = useState(1000000); + const [ifaces, setIfaces] = useState([]); + const [motorType, setMotorType] = useState("DM4310"); + const [busy, setBusy] = useState(false); + const [err, setErr] = useState(null); + + const connected = !!status?.connected; + + useEffect(() => { + api.platform().then((p) => { + if (p?.success) { + setBustype(p.default_bustype); + setChannel(p.default_channel); + } + }); + }, []); + useEffect(() => { + api.canInterfaces(bustype).then((d) => setIfaces(d?.interfaces || [])); + }, [bustype]); + + const connect = async () => { + setBusy(true); + setErr(null); + const body: any = { channel, bustype }; + if (bustype === "gs_usb") body.bitrate = bitrate; + if (mode === "control") body.motor_type = motorType; + const r = await api.connect(body); + setBusy(false); + if (r.success) { + const motors = r.motors || []; + setControlMotors(motors); + if (motors.length) setCurrentMotor(motors[0].id); + } else { + setErr(r.error || "Connect failed"); + } + }; + const disconnect = async () => { + await api.disconnect(); + setControlMotors([]); + setCurrentMotor(null); + }; + const rescan = async () => { + setBusy(true); + const r = await api.scan(motorType); + setBusy(false); + if (r.success) { + setControlMotors(r.motors || []); + if ((r.motors || []).length) setCurrentMotor(r.motors[0].id); + } else setErr(r.error || "Scan failed"); + }; + + return ( +
+
+ + +
+
+ + setChannel(e.target.value)} disabled={connected} /> + + {ifaces.map((i) => +
+ {bustype === "gs_usb" && ( +
+ + setBitrate(Number(e.target.value))} disabled={connected} /> +
+ )} + {mode === "control" && ( +
+ + +
+ )} +
+ {!connected ? ( + + ) : ( + + )} + {mode === "control" && connected && ( + + )} +
+ + {mode === "control" && connected && ( +
+ + +
+ )} + {mode === "monitor" && ( +
+ Monitor mode: listening only. Switch to Control to drive motors. +
+ )} + {err &&
{err}
} +
+ ); +} diff --git a/damiao_motor/gui/webapp/src/panels/ControlPanel.tsx b/damiao_motor/gui/webapp/src/panels/ControlPanel.tsx new file mode 100644 index 0000000..ef09d6c --- /dev/null +++ b/damiao_motor/gui/webapp/src/panels/ControlPanel.tsx @@ -0,0 +1,164 @@ +import { useEffect, useRef, useState } from "react"; +import { useApp } from "../lib/store"; +import { api } from "../lib/control"; + +type Mode = "MIT" | "POS_VEL" | "VEL" | "FORCE_POS"; + +export default function ControlPanel() { + const appMode = useApp((s) => s.mode); + const status = useApp((s) => s.status); + const id = useApp((s) => s.currentMotorId); + const motorTypes = useApp((s) => s.motorTypes); + const connected = !!status?.connected; + const active = appMode === "control" && connected && id != null; + + const [mode, setMode] = useState("MIT"); + const [pos, setPos] = useState(0); + const [vel, setVel] = useState(0); + const [kp, setKp] = useState(0); + const [kd, setKd] = useState(0); + const [tau, setTau] = useState(0); + const [vlim, setVlim] = useState(0); + const [tlim, setTlim] = useState(0); + const [continuous, setContinuous] = useState(false); + const [freq, setFreq] = useState(50); + const [running, setRunning] = useState(false); + const [msg, setMsg] = useState(null); + const timer = useRef(null); + + const body = () => ({ + control_mode: mode, + target_position: pos, + target_velocity: vel, + stiffness: kp, + damping: kd, + feedforward_torque: tau, + velocity_limit: vlim, + torque_limit_ratio: tlim, + }); + + const stop = () => { + if (timer.current != null) { + clearInterval(timer.current); + timer.current = null; + } + setRunning(false); + }; + + useEffect(() => stop, []); // cleanup on unmount + useEffect(() => { + stop(); + }, [id, appMode]); + + const sendOnce = async () => { + if (id == null) return; + const r = await api.command(id, body()); + if (!r.success) { + setMsg(r.error || "command failed"); + stop(); + } + }; + const onSend = () => { + if (!continuous) { + sendOnce(); + } else if (running) { + stop(); + } else { + setRunning(true); + setMsg(null); + sendOnce(); + const ms = 1000 / Math.max(1, Math.min(1000, freq)); + timer.current = window.setInterval(sendOnce, ms); + } + }; + + const act = async (fn: () => Promise, label: string) => { + const r = await fn(); + setMsg(r?.success ? `${label} ✓` : `${label} failed: ${r?.error || ""}`); + }; + + if (!active) { + return ( +
+
+ {appMode !== "control" + ? "Monitor mode — switch to Control to drive motors." + : !connected + ? "Connect to a bus (Connection widget)." + : "Select a motor in the Connection widget."} +
+
+ ); + } + + const showPos = mode !== "VEL"; + const showMit = mode === "MIT"; + const showForce = mode === "FORCE_POS"; + const velLabel = mode === "POS_VEL" || showForce ? "Vel limit" : "Velocity"; + + return ( +
+
+ + +
+ {showPos && ( +
+ setPos(+e.target.value)} />
+ )} +
+ (mode === "FORCE_POS" ? setVlim(+e.target.value) : setVel(+e.target.value))} />
+ {showMit && <> +
+ setKp(+e.target.value)} />
+
+ setKd(+e.target.value)} />
+
+ setTau(+e.target.value)} />
+ } + {showForce && ( +
+ setTlim(+e.target.value)} />
+ )} + +
+ + +
+ +
+ + + {continuous && ( + setFreq(+e.target.value)} title="Hz" /> + )} +
+ +
+ + + +
+
+ + +
+ {msg &&
{msg}
} +
+ ); +} diff --git a/damiao_motor/gui/webapp/src/panels/RegisterPanel.tsx b/damiao_motor/gui/webapp/src/panels/RegisterPanel.tsx new file mode 100644 index 0000000..04c94c1 --- /dev/null +++ b/damiao_motor/gui/webapp/src/panels/RegisterPanel.tsx @@ -0,0 +1,120 @@ +import { useEffect, useState } from "react"; +import { useApp } from "../lib/store"; +import { api } from "../lib/control"; + +const CTRL_MODES: Record = { 1: "MIT", 2: "POS_VEL", 3: "VEL", 4: "FORCE_POS" }; +const BAUDS: Record = { 0: "125K", 1: "200K", 2: "250K", 3: "500K", 4: "1M" }; + +export default function RegisterPanel() { + const appMode = useApp((s) => s.mode); + const status = useApp((s) => s.status); + const id = useApp((s) => s.currentMotorId); + const regTable = useApp((s) => s.registerTable); + const setCurrentMotor = useApp((s) => s.setCurrentMotor); + const connected = !!status?.connected; + const active = appMode === "control" && connected && id != null; + + const [values, setValues] = useState>({}); + const [edits, setEdits] = useState>({}); + const [msg, setMsg] = useState(null); + const [loading, setLoading] = useState(false); + + const load = async () => { + if (id == null) return; + setLoading(true); + const r = await api.getRegisters(id); + setLoading(false); + if (r.success) { + setValues(r.registers || {}); + setEdits({}); + } else setMsg(r.error || "read failed"); + }; + useEffect(() => { + if (active) load(); + else setValues({}); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [id, active]); + + if (!active) { + return
+ {appMode !== "control" ? "Monitor mode — registers unavailable." : "Connect + select a motor."} +
; + } + + const parseFor = (rid: number, raw: string, dtype: string): number => { + if (rid === 7 || rid === 8) { + const s = raw.trim(); + return s.toLowerCase().startsWith("0x") ? parseInt(s, 16) : (parseInt(s, 16) || parseInt(s, 10)); + } + return dtype === "float" ? parseFloat(raw) : parseInt(raw, 10); + }; + + const write = async (rid: number) => { + const info = regTable[rid]; + const dtype = info?.data_type || "float"; + let val: number; + if (rid === 10 || rid === 35) val = parseInt(edits[rid], 10); + else if (rid === 9) val = parseFloat(edits[rid]); + else val = parseFor(rid, edits[rid] ?? "", dtype); + if (Number.isNaN(val)) { setMsg("invalid value"); return; } + const r = await api.setRegister(id!, rid, val); + if (r.success) { + if (r.updated_ids?.motor_id != null) setCurrentMotor(r.updated_ids.motor_id); + setMsg(`reg ${rid} written ✓`); + setTimeout(load, 100); + } else setMsg(r.error || "write failed"); + }; + + const display = (rid: number, v: any): string => { + if (rid === 9) return `${v} ms`; + if (rid === 7 || rid === 8) return `0x${Number(v).toString(16).toUpperCase()} (${v})`; + if (rid === 10) return CTRL_MODES[Number(v)] || String(v); + if (rid === 35) return BAUDS[Number(v)] || String(v); + const info = regTable[rid]; + return info?.data_type === "float" ? Number(v).toFixed(4) : String(v); + }; + + const rids = Object.keys(values).map(Number).sort((a, b) => a - b); + + return ( +
+
+ + {msg && {msg}} +
+
+ + + + {rids.map((rid) => { + const info = regTable[rid]; + const ro = info?.access === "RO"; + return ( + + + + + + ); + })} + +
RegisterValue
{info?.description || `reg ${rid}`} + {ro ? ( + display(rid, values[rid]) + ) : rid === 10 || rid === 35 ? ( + + ) : ( + setEdits({ ...edits, [rid]: e.target.value })} + /> + )} + {!ro && }
+
+
+ ); +} diff --git a/damiao_motor/gui/webapp/src/panels/registry.tsx b/damiao_motor/gui/webapp/src/panels/registry.tsx index 131c46d..268d273 100644 --- a/damiao_motor/gui/webapp/src/panels/registry.tsx +++ b/damiao_motor/gui/webapp/src/panels/registry.tsx @@ -10,6 +10,9 @@ import PlotPanel from "./PlotPanel"; import TablePanel from "./TablePanel"; import CardsPanel from "./CardsPanel"; import RawLogPanel from "./RawLogPanel"; +import ConnectionPanel from "./ConnectionPanel"; +import ControlPanel from "./ControlPanel"; +import RegisterPanel from "./RegisterPanel"; export interface PanelDef { kind: string; @@ -21,6 +24,27 @@ export interface PanelDef { } export const PANELS: PanelDef[] = [ + { + kind: "connection", + title: "Connection", + icon: "⇄", + description: "Connect to a CAN bus, scan, and select a motor.", + render: () => , + }, + { + kind: "control", + title: "Motor Control", + icon: "◉", + description: "Drive the selected motor (MIT/POS_VEL/VEL/FORCE_POS), enable, zero, store.", + render: () => , + }, + { + kind: "registers", + title: "Registers", + icon: "≡", + description: "Read/write the selected motor's registers.", + render: () => , + }, { kind: "plot", title: "Plot", diff --git a/damiao_motor/gui/webapp/tsconfig.tsbuildinfo b/damiao_motor/gui/webapp/tsconfig.tsbuildinfo index 13c3db2..4599721 100644 --- a/damiao_motor/gui/webapp/tsconfig.tsbuildinfo +++ b/damiao_motor/gui/webapp/tsconfig.tsbuildinfo @@ -1 +1 @@ -{"root":["./src/app.tsx","./src/main.tsx","./src/components/canvas.tsx","./src/components/signalchip.tsx","./src/components/signalsidebar.tsx","./src/components/toolbar.tsx","./src/lib/datastore.ts","./src/lib/format.ts","./src/lib/store.ts","./src/lib/theme.ts","./src/lib/types.ts","./src/lib/widgets.ts","./src/lib/ws.ts","./src/panels/cardspanel.tsx","./src/panels/plotpanel.tsx","./src/panels/rawlogpanel.tsx","./src/panels/tablepanel.tsx","./src/panels/registry.tsx"],"version":"5.9.3"} \ No newline at end of file +{"root":["./src/app.tsx","./src/main.tsx","./src/components/canvas.tsx","./src/components/signalchip.tsx","./src/components/signalsidebar.tsx","./src/components/toolbar.tsx","./src/lib/control.ts","./src/lib/datastore.ts","./src/lib/format.ts","./src/lib/store.ts","./src/lib/theme.ts","./src/lib/types.ts","./src/lib/widgets.ts","./src/lib/ws.ts","./src/panels/cardspanel.tsx","./src/panels/connectionpanel.tsx","./src/panels/controlpanel.tsx","./src/panels/plotpanel.tsx","./src/panels/rawlogpanel.tsx","./src/panels/registerpanel.tsx","./src/panels/tablepanel.tsx","./src/panels/registry.tsx"],"version":"5.9.3"} \ No newline at end of file From dbe5573c206c8b540ddfd9e86984a85a92e46c0a Mon Sep 17 00:00:00 2001 From: Jia Xie Date: Mon, 15 Jun 2026 21:17:12 -0700 Subject: [PATCH 13/14] fix(studio control): map extended motor-type names to core presets ControlService passed UI/default names like 'DM4310' straight to DaMiaoController, whose core preset table only knows '4310' -> scan silently added no motors. Map extended->core (_core_motor_type) in scan + set_motor_type. Hardware-validated on linearbot can_arm_l motor 7 through the full ControlService path: connect -> scan (motors 1-7) -> clear_error -> enable (ENABLED) -> MIT command MOVES the motor (-1.2255 -> -1.154 toward target) -> return -> registers read -> disable; cmd+fb signals land in the shared store. (Tip surfaced: latched status 0x3 needs clear-error before enable.) Co-Authored-By: Claude Opus 4.8 (1M context) --- damiao_motor/monitor/control.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/damiao_motor/monitor/control.py b/damiao_motor/monitor/control.py index 8ebac55..23079f9 100644 --- a/damiao_motor/monitor/control.py +++ b/damiao_motor/monitor/control.py @@ -15,13 +15,23 @@ from typing import Any, Dict, List, Optional from damiao_motor.core.controller import DaMiaoController -from damiao_motor.core.motor import REGISTER_TABLE +from damiao_motor.core.motor import MOTOR_TYPE_PRESETS, REGISTER_TABLE from damiao_motor.monitor.decode import KIND_COMMAND, KIND_FEEDBACK, DecodedFrame from damiao_motor.monitor.store import SignalStore TIMEOUT_REGISTER_ID = 9 TIMEOUT_UNITS_PER_MS = 20.0 + +def _core_motor_type(name: str) -> str: + """Map a (possibly extended, e.g. 'DM4310') motor-type name to a core preset name + the DaMiaoController understands ('4310'). Falls back to '4310'.""" + if name in MOTOR_TYPE_PRESETS: + return name + if name.startswith("DM") and name[2:] in MOTOR_TYPE_PRESETS: + return name[2:] + return "4310" + # command-mode -> the cmd field names the store/plots expect (match decode.py) _CONTROL_MODES = {"MIT", "POS_VEL", "VEL", "FORCE_POS"} @@ -62,12 +72,13 @@ def _require(self): # ---------------------------------------------------------------- scan def scan(self, motor_type: str, settle: float = 0.5) -> List[Dict[str, Any]]: c = self._require() + core_type = _core_motor_type(motor_type) c.motors = {} c._motors_by_feedback = {} c.flush_bus() for motor_id in range(0x01, 0x11): try: - m = c.add_motor(motor_id=motor_id, feedback_id=0x00, motor_type=motor_type) + m = c.add_motor(motor_id=motor_id, feedback_id=0x00, motor_type=core_type) m.send_cmd_mit(0.0, 0.0, 0.0, 0.0, 0.0) except ValueError: pass @@ -138,7 +149,7 @@ def store_parameters(self, motor_id: int) -> None: self._require().motors[motor_id].store_parameters() def set_motor_type(self, motor_id: int, motor_type: str) -> None: - self._require().motors[motor_id].set_motor_type(motor_type) + self._require().motors[motor_id].set_motor_type(_core_motor_type(motor_type)) def command(self, motor_id: int, data: Dict[str, Any]) -> Dict[str, Any]: c = self._require() From ea0834adac7998493d60a89222a4fea898bc81ff Mon Sep 17 00:00:00 2001 From: Jia Xie Date: Mon, 15 Jun 2026 21:21:41 -0700 Subject: [PATCH 14/14] style: ruff check --fix + format (CI Ruff workflow clean) Remove now-unused web_gui import from cli/commands.py and ruff-format the new monitor/ modules + edited cli/tests files so the Ruff workflow (ruff check . / ruff format --check .) passes. No behavior change. Co-Authored-By: Claude Opus 4.8 (1M context) --- damiao_motor/cli/__init__.py | 66 +++++++++++++----- damiao_motor/cli/commands.py | 5 +- damiao_motor/monitor/control.py | 80 +++++++++++++++++----- damiao_motor/monitor/decode.py | 60 +++++++++++++--- damiao_motor/monitor/demo.py | 63 +++++++++++++---- damiao_motor/monitor/server.py | 118 ++++++++++++++++++++++++-------- damiao_motor/monitor/service.py | 8 ++- tests/test_monitor.py | 70 ++++++++++++------- 8 files changed, 352 insertions(+), 118 deletions(-) diff --git a/damiao_motor/cli/__init__.py b/damiao_motor/cli/__init__.py index 8013de7..ee37292 100644 --- a/damiao_motor/cli/__init__.py +++ b/damiao_motor/cli/__init__.py @@ -183,23 +183,55 @@ def unified_main() -> None: damiao monitor --demo """, ) - monitor_parser.add_argument("--host", type=str, default="127.0.0.1", - help="Host to bind to (default: 127.0.0.1)") - monitor_parser.add_argument("--port", type=int, default=5001, - help="Port to bind to (default: 5001)") - monitor_parser.add_argument("--channel", type=str, default="can0", - help="CAN channel to listen on (default: can0)") - monitor_parser.add_argument("--bustype", type=str, default="socketcan", - help="CAN bus type (default: socketcan)") - monitor_parser.add_argument("--bitrate", type=int, default=None, - help="CAN bitrate (required for some interfaces, e.g. gs_usb)") - monitor_parser.add_argument("--feedback-offset", type=int, default=16, dest="feedback_offset", - help="feedback arb id = motor id + offset (default: 16, the p16 scheme)") - monitor_parser.add_argument("--motor-type", type=str, default="DM4310", dest="default_motor_type", - help="Default motor type for value scaling (default: DM4310)") - monitor_parser.add_argument("--demo", action="store_true", - help="Synthesize traffic instead of opening a CAN bus") - monitor_parser.add_argument("--debug", action="store_true", help="Enable debug mode") + monitor_parser.add_argument( + "--host", + type=str, + default="127.0.0.1", + help="Host to bind to (default: 127.0.0.1)", + ) + monitor_parser.add_argument( + "--port", type=int, default=5001, help="Port to bind to (default: 5001)" + ) + monitor_parser.add_argument( + "--channel", + type=str, + default="can0", + help="CAN channel to listen on (default: can0)", + ) + monitor_parser.add_argument( + "--bustype", + type=str, + default="socketcan", + help="CAN bus type (default: socketcan)", + ) + monitor_parser.add_argument( + "--bitrate", + type=int, + default=None, + help="CAN bitrate (required for some interfaces, e.g. gs_usb)", + ) + monitor_parser.add_argument( + "--feedback-offset", + type=int, + default=16, + dest="feedback_offset", + help="feedback arb id = motor id + offset (default: 16, the p16 scheme)", + ) + monitor_parser.add_argument( + "--motor-type", + type=str, + default="DM4310", + dest="default_motor_type", + help="Default motor type for value scaling (default: DM4310)", + ) + monitor_parser.add_argument( + "--demo", + action="store_true", + help="Synthesize traffic instead of opening a CAN bus", + ) + monitor_parser.add_argument( + "--debug", action="store_true", help="Enable debug mode" + ) monitor_parser.set_defaults(func=cmd_monitor) # Helper function to add global arguments to subcommands diff --git a/damiao_motor/cli/commands.py b/damiao_motor/cli/commands.py index 96cc460..f9f2830 100644 --- a/damiao_motor/cli/commands.py +++ b/damiao_motor/cli/commands.py @@ -6,7 +6,6 @@ import time from damiao_motor.core.controller import DaMiaoController -from damiao_motor.gui import web_gui from .display import ( BOX_CORNER_TL, BOX_CORNER_TR, @@ -722,7 +721,9 @@ def cmd_gui(args) -> None: # the realtime monitor in one UI). The legacy Flask GUI remains in web_gui.py. from damiao_motor.monitor import server as studio_server - studio_server.run_server(host=args.host, port=args.port, mode="control", debug=args.debug) + studio_server.run_server( + host=args.host, port=args.port, mode="control", debug=args.debug + ) def cmd_monitor(args) -> None: diff --git a/damiao_motor/monitor/control.py b/damiao_motor/monitor/control.py index 23079f9..5bd8e92 100644 --- a/damiao_motor/monitor/control.py +++ b/damiao_motor/monitor/control.py @@ -32,6 +32,7 @@ def _core_motor_type(name: str) -> str: return name[2:] return "4310" + # command-mode -> the cmd field names the store/plots expect (match decode.py) _CONTROL_MODES = {"MIT", "POS_VEL", "VEL", "FORCE_POS"} @@ -48,9 +49,13 @@ def __init__(self, store: SignalStore, raw_push=None) -> None: self.error: Optional[str] = None # ------------------------------------------------------------- lifecycle - def connect(self, channel: str, bustype: str = "socketcan", bitrate: Optional[int] = None) -> None: + def connect( + self, channel: str, bustype: str = "socketcan", bitrate: Optional[int] = None + ) -> None: self.disconnect() - self.controller = DaMiaoController(channel=channel, bustype=bustype, bitrate=bitrate) + self.controller = DaMiaoController( + channel=channel, bustype=bustype, bitrate=bitrate + ) self.channel, self.bustype, self.bitrate = channel, bustype, bitrate self.connected = True self.error = None @@ -78,7 +83,9 @@ def scan(self, motor_type: str, settle: float = 0.5) -> List[Dict[str, Any]]: c.flush_bus() for motor_id in range(0x01, 0x11): try: - m = c.add_motor(motor_id=motor_id, feedback_id=0x00, motor_type=core_type) + m = c.add_motor( + motor_id=motor_id, feedback_id=0x00, motor_type=core_type + ) m.send_cmd_mit(0.0, 0.0, 0.0, 0.0, 0.0) except ValueError: pass @@ -90,10 +97,19 @@ def scan(self, motor_type: str, settle: float = 0.5) -> List[Dict[str, Any]]: while time.perf_counter() - t0 < settle: c.poll_feedback() for mid, m in c.motors.items(): - if m.state and m.state.get("can_id") is not None and mid not in responded: + if ( + m.state + and m.state.get("can_id") is not None + and mid not in responded + ): responded.add(mid) - found.append({"id": mid, "arb_id": m.state.get("arbitration_id") or 0, - "motor_type": m.motor_type}) + found.append( + { + "id": mid, + "arb_id": m.state.get("arbitration_id") or 0, + "motor_type": m.motor_type, + } + ) self._push_feedback(mid, m.get_states()) time.sleep(0.01) # keep only responders @@ -102,12 +118,22 @@ def scan(self, motor_type: str, settle: float = 0.5) -> List[Dict[str, Any]]: def motors(self) -> List[Dict[str, Any]]: c = self._require() - return [{"id": mid, "motor_type": m.motor_type} for mid, m in sorted(c.motors.items())] + return [ + {"id": mid, "motor_type": m.motor_type} + for mid, m in sorted(c.motors.items()) + ] # ---------------------------------------------------------- store feed def _push_command(self, motor_id: int, mode: str, fields: Dict[str, float]) -> None: - fr = DecodedFrame(t=time.time(), arbitration_id=motor_id, kind=KIND_COMMAND, - motor_id=motor_id, raw=b"", mode=mode, fields=fields) + fr = DecodedFrame( + t=time.time(), + arbitration_id=motor_id, + kind=KIND_COMMAND, + motor_id=motor_id, + raw=b"", + mode=mode, + fields=fields, + ) self.store.ingest(fr) if self._raw_push: self._raw_push(fr) @@ -123,9 +149,15 @@ def _push_feedback(self, motor_id: int, state: Dict[str, Any]) -> None: "t_rotor": float(state.get("t_rotor", 0.0)), "status_code": float(state.get("status_code", 0)), } - fr = DecodedFrame(t=time.time(), arbitration_id=motor_id + 16, kind=KIND_FEEDBACK, - motor_id=motor_id, raw=b"", fields=fields, - note=str(state.get("status", ""))) + fr = DecodedFrame( + t=time.time(), + arbitration_id=motor_id + 16, + kind=KIND_FEEDBACK, + motor_id=motor_id, + raw=b"", + fields=fields, + note=str(state.get("status", "")), + ) self.store.ingest(fr) if self._raw_push: self._raw_push(fr) @@ -165,8 +197,11 @@ def command(self, motor_id: int, data: Dict[str, Any]) -> Dict[str, Any]: if mode == "MIT": m.send_cmd_mit(pos, vel, kp, kd, tau) - self._push_command(motor_id, "MIT", - {"pos": pos, "vel": vel, "kp": kp, "kd": kd, "torque": tau}) + self._push_command( + motor_id, + "MIT", + {"pos": pos, "vel": vel, "kp": kp, "kd": kd, "torque": tau}, + ) elif mode == "POS_VEL": m.send_cmd_pos_vel(pos, vel) self._push_command(motor_id, "POS_VEL", {"pos": pos, "vel_limit": vel}) @@ -175,8 +210,11 @@ def command(self, motor_id: int, data: Dict[str, Any]) -> Dict[str, Any]: self._push_command(motor_id, "VEL", {"vel": vel}) elif mode == "FORCE_POS": m.send_cmd_force_pos(pos, vlim, tlim) - self._push_command(motor_id, "FORCE_POS", - {"pos": pos, "vel_limit": vlim, "torque_limit_ratio": tlim}) + self._push_command( + motor_id, + "FORCE_POS", + {"pos": pos, "vel_limit": vlim, "torque_limit_ratio": tlim}, + ) else: raise ValueError(f"Unknown control_mode: {mode}") @@ -247,7 +285,13 @@ def set_register(self, motor_id: int, rid: int, value: Any) -> Dict[str, Any]: @staticmethod def register_table() -> List[Dict[str, Any]]: return [ - {"rid": r.rid, "variable": r.variable, "description": r.description, - "access": r.access, "range_str": r.range_str, "data_type": r.data_type} + { + "rid": r.rid, + "variable": r.variable, + "description": r.description, + "access": r.access, + "range_str": r.range_str, + "data_type": r.data_type, + } for r in REGISTER_TABLE.values() ] diff --git a/damiao_motor/monitor/decode.py b/damiao_motor/monitor/decode.py index fe31625..d1f4333 100644 --- a/damiao_motor/monitor/decode.py +++ b/damiao_motor/monitor/decode.py @@ -239,19 +239,37 @@ def lim_for(mid: int) -> Dict[str, float]: if POS_VEL_BASE <= arbitration_id < POS_VEL_BASE + 0x100: mid = arbitration_id - POS_VEL_BASE pos, vel_limit = struct.unpack(" Dict[str, float]: lim = lim_for(mid) fb = _decode_feedback(data, lim) status_name = _decode_status_name(int(fb["status_code"])) - return DecodedFrame(t, arbitration_id, KIND_FEEDBACK, mid, bytes(data), - fields=fb, note=status_name) + return DecodedFrame( + t, + arbitration_id, + KIND_FEEDBACK, + mid, + bytes(data), + fields=fb, + note=status_name, + ) # 5) Otherwise treat a low-id frame as an MIT command. if 1 <= arbitration_id < POS_VEL_BASE: lim = lim_for(arbitration_id) - return DecodedFrame(t, arbitration_id, KIND_COMMAND, arbitration_id, bytes(data), - mode="MIT", fields=_decode_mit(data, lim)) + return DecodedFrame( + t, + arbitration_id, + KIND_COMMAND, + arbitration_id, + bytes(data), + mode="MIT", + fields=_decode_mit(data, lim), + ) # 6) Register command space / anything else. if arbitration_id == REGISTER_ARB: - return DecodedFrame(t, arbitration_id, KIND_REGISTER, - data[0] | (data[1] << 8), bytes(data), note="register cmd") + return DecodedFrame( + t, + arbitration_id, + KIND_REGISTER, + data[0] | (data[1] << 8), + bytes(data), + note="register cmd", + ) return DecodedFrame(t, arbitration_id, KIND_UNKNOWN, arbitration_id, bytes(data)) diff --git a/damiao_motor/monitor/demo.py b/damiao_motor/monitor/demo.py index 558667f..a95e2b0 100644 --- a/damiao_motor/monitor/demo.py +++ b/damiao_motor/monitor/demo.py @@ -22,8 +22,13 @@ class DemoSource: - def __init__(self, on_frame: FrameCallback, bus_name: str = "demo", - motor_ids: List[int] = (1, 2, 3), rate_hz: float = 100.0) -> None: + def __init__( + self, + on_frame: FrameCallback, + bus_name: str = "demo", + motor_ids: List[int] = (1, 2, 3), + rate_hz: float = 100.0, + ) -> None: self.on_frame = on_frame self.bus_name = bus_name self.motor_ids = list(motor_ids) @@ -37,7 +42,9 @@ def start(self) -> None: if self._running: return self._running = True - self._thread = threading.Thread(target=self._loop, name="demo-source", daemon=True) + self._thread = threading.Thread( + target=self._loop, name="demo-source", daemon=True + ) self._thread.start() def stop(self) -> None: @@ -56,7 +63,9 @@ def _loop(self) -> None: phase = i * 0.7 freq = 0.25 + 0.15 * i cmd_pos = 1.5 * math.sin(2 * math.pi * freq * t + phase) - cmd_vel = 1.5 * 2 * math.pi * freq * math.cos(2 * math.pi * freq * t + phase) + cmd_vel = ( + 1.5 * 2 * math.pi * freq * math.cos(2 * math.pi * freq * t + phase) + ) kp, kd = 60.0, 1.5 # feedback lags the command and carries noise + load torque lag = 0.15 @@ -68,15 +77,39 @@ def _loop(self) -> None: t_mos = 32 + 3 * math.sin(0.1 * t + mid) t_rotor = 35 + 4 * math.sin(0.08 * t + mid) - self.on_frame(DecodedFrame( - t=now, arbitration_id=mid, kind=KIND_COMMAND, motor_id=mid, - raw=b"\x00" * 8, mode="MIT", - fields={"pos": cmd_pos, "vel": cmd_vel, "torque": 0.0, "kp": kp, "kd": kd}, - )) - self.on_frame(DecodedFrame( - t=now, arbitration_id=mid + 16, kind=KIND_FEEDBACK, motor_id=mid, - raw=b"\x00" * 8, note="ENABLED", - fields={"pos": fb_pos, "vel": fb_vel, "torque": fb_torq, - "t_mos": t_mos, "t_rotor": t_rotor, "status_code": 1.0}, - )) + self.on_frame( + DecodedFrame( + t=now, + arbitration_id=mid, + kind=KIND_COMMAND, + motor_id=mid, + raw=b"\x00" * 8, + mode="MIT", + fields={ + "pos": cmd_pos, + "vel": cmd_vel, + "torque": 0.0, + "kp": kp, + "kd": kd, + }, + ) + ) + self.on_frame( + DecodedFrame( + t=now, + arbitration_id=mid + 16, + kind=KIND_FEEDBACK, + motor_id=mid, + raw=b"\x00" * 8, + note="ENABLED", + fields={ + "pos": fb_pos, + "vel": fb_vel, + "torque": fb_torq, + "t_mos": t_mos, + "t_rotor": t_rotor, + "status_code": 1.0, + }, + ) + ) time.sleep(period) diff --git a/damiao_motor/monitor/server.py b/damiao_motor/monitor/server.py index f689477..2af774b 100644 --- a/damiao_motor/monitor/server.py +++ b/damiao_motor/monitor/server.py @@ -48,8 +48,13 @@ class Studio: """Holds the shared store + the active mode's data source.""" - def __init__(self, mode: str = "monitor", feedback_offset: int = DEFAULT_FEEDBACK_OFFSET, - default_motor_type: str = DEFAULT_MOTOR_TYPE, raw_log_size: int = 4000) -> None: + def __init__( + self, + mode: str = "monitor", + feedback_offset: int = DEFAULT_FEEDBACK_OFFSET, + default_motor_type: str = DEFAULT_MOTOR_TYPE, + raw_log_size: int = 4000, + ) -> None: self.mode = mode # 'monitor' | 'control' self.feedback_offset = feedback_offset self.default_motor_type = default_motor_type @@ -69,7 +74,9 @@ def _raw_push(self, frame) -> None: self._raw_seq += 1 self._raw.append(_frame_to_log(self._raw_seq, frame)) - def raw_since(self, since_seq: int, limit: int = 400) -> Tuple[int, List[Dict[str, Any]]]: + def raw_since( + self, since_seq: int, limit: int = 400 + ) -> Tuple[int, List[Dict[str, Any]]]: if not self._raw: return since_seq, [] items = [r for r in self._raw if r["seq"] > since_seq] @@ -82,8 +89,14 @@ def _on_passive_frame(self, frame) -> None: self.store.ingest(frame) self._raw_push(frame) - def connect(self, channel: str, bustype: str, bitrate: Optional[int], - motor_type: Optional[str] = None, feedback_offset: Optional[int] = None) -> Dict[str, Any]: + def connect( + self, + channel: str, + bustype: str, + bitrate: Optional[int], + motor_type: Optional[str] = None, + feedback_offset: Optional[int] = None, + ) -> Dict[str, Any]: self.disconnect() self.error = None self.channel, self.bustype = channel, bustype @@ -95,7 +108,9 @@ def connect(self, channel: str, bustype: str, bitrate: Optional[int], return {"motors": found} else: self.listener = PassiveCanListener( - channel=channel, bustype=bustype, bitrate=bitrate, + channel=channel, + bustype=bustype, + bitrate=bitrate, feedback_offset=self.feedback_offset, default_motor_type=motor_type or self.default_motor_type, on_frame=self._on_passive_frame, @@ -129,8 +144,11 @@ def set_mode(self, mode: str) -> None: # ------------------------------------------------------------- readouts def status(self) -> Dict[str, Any]: - connected = (self.mode == "control" and self.control.connected) or ( - self.listener is not None) or (self._demo_source is not None) + connected = ( + (self.mode == "control" and self.control.connected) + or (self.listener is not None) + or (self._demo_source is not None) + ) return { "mode": self.mode, "connected": connected, @@ -147,8 +165,12 @@ def status(self) -> Dict[str, Any]: } def signals(self) -> Dict[str, Any]: - return {"signals": self.store.list_signals(), "pairs": self.store.pairs(), - "motors": self.store.motor_views(), "version": self.store.registry_version} + return { + "signals": self.store.list_signals(), + "pairs": self.store.pairs(), + "motors": self.store.motor_views(), + "version": self.store.registry_version, + } def snapshot(self, ids: List[str], n: int) -> Dict[str, List[Tuple[float, float]]]: return {sid: self.store.series_last_n(sid, n) for sid in ids} @@ -156,9 +178,11 @@ def snapshot(self, ids: List[str], n: int) -> Dict[str, List[Tuple[float, float] def _platform_defaults() -> Dict[str, Any]: is_mac = sys.platform == "darwin" - return {"platform": sys.platform, - "default_bustype": "gs_usb" if is_mac else "socketcan", - "default_channel": "0" if is_mac else "can0"} + return { + "platform": sys.platform, + "default_bustype": "gs_usb" if is_mac else "socketcan", + "default_channel": "0" if is_mac else "can0", + } def create_app(studio: Studio) -> Flask: @@ -194,9 +218,13 @@ def connect(): bitrate = data.get("bitrate") bitrate = int(bitrate) if bitrate not in (None, "") else None try: - res = studio.connect(channel, bustype, bitrate, - motor_type=data.get("motor_type"), - feedback_offset=data.get("feedback_offset")) + res = studio.connect( + channel, + bustype, + bitrate, + motor_type=data.get("motor_type"), + feedback_offset=data.get("feedback_offset"), + ) return jsonify({"success": True, **res}) except Exception as e: studio.error = str(e) @@ -214,6 +242,7 @@ def platform(): @app.route("/api/motor-types") def motor_types(): from damiao_motor.monitor.decode import MONITOR_MOTOR_PRESETS + return jsonify({"types": sorted(MONITOR_MOTOR_PRESETS.keys())}) @app.route("/api/register-table") @@ -228,7 +257,9 @@ def can_interfaces(): try: net = "/sys/class/net" if os.path.isdir(net): - interfaces = sorted(n for n in os.listdir(net) if n.startswith("can")) + interfaces = sorted( + n for n in os.listdir(net) if n.startswith("can") + ) except OSError: pass return jsonify({"success": True, "interfaces": interfaces}) @@ -266,7 +297,9 @@ def drain(): t = cmd.get("type") if t == "subscribe": now = time.time() - new = {sid: subscribed.get(sid, now) for sid in cmd.get("signals", [])} + new = { + sid: subscribed.get(sid, now) for sid in cmd.get("signals", []) + } subscribed.clear() subscribed.update(new) elif t == "rate": @@ -285,8 +318,15 @@ def drain(): if sig["version"] != last_version: last_version = sig["version"] ws.send(json.dumps({"type": "meta", **sig})) - ws.send(json.dumps({"type": "motors", "motors": sig["motors"], - "status": studio.status()})) + ws.send( + json.dumps( + { + "type": "motors", + "motors": sig["motors"], + "status": studio.status(), + } + ) + ) batch = {} for sid, cursor in list(subscribed.items()): pts = studio.store.series_since(sid, cursor) @@ -315,7 +355,9 @@ def control_scan(): return g data = request.get_json(force=True, silent=True) or {} try: - found = studio.control.scan(data.get("motor_type") or studio.default_motor_type) + found = studio.control.scan( + data.get("motor_type") or studio.default_motor_type + ) return jsonify({"success": True, "motors": found}) except Exception as e: return jsonify({"success": False, "error": str(e)}), 500 @@ -422,7 +464,11 @@ def c_motor_type(mid): @app.route("/") def index(): idx = os.path.join(_WEBAPP_DIST, "index.html") - return send_from_directory(_WEBAPP_DIST, "index.html") if os.path.exists(idx) else _DEV_PLACEHOLDER + return ( + send_from_directory(_WEBAPP_DIST, "index.html") + if os.path.exists(idx) + else _DEV_PLACEHOLDER + ) @app.route("/") def spa(path): @@ -432,17 +478,33 @@ def spa(path): if os.path.exists(full) and os.path.isfile(full): return send_from_directory(_WEBAPP_DIST, path) idx = os.path.join(_WEBAPP_DIST, "index.html") - return send_from_directory(_WEBAPP_DIST, "index.html") if os.path.exists(idx) else _DEV_PLACEHOLDER + return ( + send_from_directory(_WEBAPP_DIST, "index.html") + if os.path.exists(idx) + else _DEV_PLACEHOLDER + ) return app -def run_server(host: str = "127.0.0.1", port: int = 5001, mode: str = "monitor", - channel: str = "can0", bustype: str = "socketcan", bitrate: Optional[int] = None, - feedback_offset: int = 16, default_motor_type: str = "DM4310", - debug: bool = False, demo: bool = False) -> None: +def run_server( + host: str = "127.0.0.1", + port: int = 5001, + mode: str = "monitor", + channel: str = "can0", + bustype: str = "socketcan", + bitrate: Optional[int] = None, + feedback_offset: int = 16, + default_motor_type: str = "DM4310", + debug: bool = False, + demo: bool = False, +) -> None: """Start the unified DaMiao Studio server (blocking).""" - studio = Studio(mode=mode, feedback_offset=feedback_offset, default_motor_type=default_motor_type) + studio = Studio( + mode=mode, + feedback_offset=feedback_offset, + default_motor_type=default_motor_type, + ) if demo: studio.mode = "monitor" diff --git a/damiao_motor/monitor/service.py b/damiao_motor/monitor/service.py index 981376a..6e3e600 100644 --- a/damiao_motor/monitor/service.py +++ b/damiao_motor/monitor/service.py @@ -130,10 +130,14 @@ def signals(self) -> Dict[str, object]: "version": self.store.registry_version, } - def snapshot(self, signal_ids: List[str], n: int) -> Dict[str, List[Tuple[float, float]]]: + def snapshot( + self, signal_ids: List[str], n: int + ) -> Dict[str, List[Tuple[float, float]]]: return {sid: self.store.series_last_n(sid, n) for sid in signal_ids} - def raw_since(self, since_seq: int, limit: int = 500) -> Tuple[int, List[Dict[str, object]]]: + def raw_since( + self, since_seq: int, limit: int = 500 + ) -> Tuple[int, List[Dict[str, object]]]: with self._raw_lock: if not self._raw_log: return since_seq, [] diff --git a/tests/test_monitor.py b/tests/test_monitor.py index 48912be..6cebb8f 100644 --- a/tests/test_monitor.py +++ b/tests/test_monitor.py @@ -26,24 +26,27 @@ def _motor(): # bus is unused by the encode_* helpers, so None is fine here. - return DaMiaoMotor(motor_id=MOTOR_ID, feedback_id=MOTOR_ID + 16, bus=None, - motor_type=MOTOR_TYPE) + return DaMiaoMotor( + motor_id=MOTOR_ID, feedback_id=MOTOR_ID + 16, bus=None, motor_type=MOTOR_TYPE + ) def _make_feedback_frame(motor_id, status, pos, vel, torq, t_mos, t_rotor, lim): pos_u = float_to_uint(pos, lim["p_min"], lim["p_max"], 16) vel_u = float_to_uint(vel, lim["v_min"], lim["v_max"], 12) torq_u = float_to_uint(torq, lim["t_min"], lim["t_max"], 12) - return bytes([ - (status << 4) | (motor_id & 0x0F), - (pos_u >> 8) & 0xFF, - pos_u & 0xFF, - (vel_u >> 4) & 0xFF, - ((vel_u & 0xF) << 4) | ((torq_u >> 8) & 0xF), - torq_u & 0xFF, - t_mos & 0xFF, - t_rotor & 0xFF, - ]) + return bytes( + [ + (status << 4) | (motor_id & 0x0F), + (pos_u >> 8) & 0xFF, + pos_u & 0xFF, + (vel_u >> 4) & 0xFF, + ((vel_u & 0xF) << 4) | ((torq_u >> 8) & 0xF), + torq_u & 0xFF, + t_mos & 0xFF, + t_rotor & 0xFF, + ] + ) # --------------------------------------------------------------------- decode @@ -120,12 +123,19 @@ def test_special_command(): def test_mit_and_feedback_not_confused(): """A MIT command to motor 3 (arb 3) and feedback from motor 3 (arb 19) classify distinctly.""" m = _motor() - cmd = decode_frame(MOTOR_ID, m.encode_cmd_msg(0.0, 0.0, 0.0, 10.0, 1.0), t=0.0, - motor_types={MOTOR_ID: MOTOR_TYPE}) + cmd = decode_frame( + MOTOR_ID, + m.encode_cmd_msg(0.0, 0.0, 0.0, 10.0, 1.0), + t=0.0, + motor_types={MOTOR_ID: MOTOR_TYPE}, + ) lim = resolve_limits(MOTOR_TYPE) - fb = decode_frame(MOTOR_ID + 16, - _make_feedback_frame(MOTOR_ID, 1, 0.0, 0.0, 0.0, 30, 30, lim), - t=0.0, motor_types={MOTOR_ID: MOTOR_TYPE}) + fb = decode_frame( + MOTOR_ID + 16, + _make_feedback_frame(MOTOR_ID, 1, 0.0, 0.0, 0.0, 30, 30, lim), + t=0.0, + motor_types={MOTOR_ID: MOTOR_TYPE}, + ) assert cmd.kind == KIND_COMMAND and cmd.mode == "MIT" assert fb.kind == KIND_FEEDBACK @@ -135,11 +145,18 @@ def test_store_ingest_and_pairing(): store = SignalStore("can_test") m = _motor() lim = resolve_limits(MOTOR_TYPE) - cmd = decode_frame(MOTOR_ID, m.encode_cmd_msg(1.0, 0.0, 0.0, 10.0, 1.0), t=1.0, - motor_types={MOTOR_ID: MOTOR_TYPE}) - fb = decode_frame(MOTOR_ID + 16, - _make_feedback_frame(MOTOR_ID, 1, 0.9, 0.0, 0.0, 30, 30, lim), - t=1.0, motor_types={MOTOR_ID: MOTOR_TYPE}) + cmd = decode_frame( + MOTOR_ID, + m.encode_cmd_msg(1.0, 0.0, 0.0, 10.0, 1.0), + t=1.0, + motor_types={MOTOR_ID: MOTOR_TYPE}, + ) + fb = decode_frame( + MOTOR_ID + 16, + _make_feedback_frame(MOTOR_ID, 1, 0.9, 0.0, 0.0, 30, 30, lim), + t=1.0, + motor_types={MOTOR_ID: MOTOR_TYPE}, + ) store.ingest(cmd) store.ingest(fb) @@ -183,9 +200,12 @@ def shutdown(self): def test_listener_never_transmits_and_decodes(): lim = resolve_limits(MOTOR_TYPE) msgs = [ - can.Message(arbitration_id=MOTOR_ID + 16, - data=_make_feedback_frame(MOTOR_ID, 1, 1.0, 2.0, 0.5, 30, 31, lim), - timestamp=1.0, is_extended_id=False), + can.Message( + arbitration_id=MOTOR_ID + 16, + data=_make_feedback_frame(MOTOR_ID, 1, 1.0, 2.0, 0.5, 30, 31, lim), + timestamp=1.0, + is_extended_id=False, + ), ] received = [] listener = PassiveCanListener(channel="vcan_test", on_frame=received.append)